package com.l7tech.server.policy.assertion;

import com.l7tech.policy.assertion.AssertionStatus;
import com.l7tech.policy.assertion.HttpFormPost;
import com.l7tech.policy.assertion.PolicyAssertionException;
import com.l7tech.server.StashManagerFactory;
import com.l7tech.server.message.PolicyEnforcementContext;
import java.io.IOException;
import org.springframework.context.ApplicationContext;

public class ServerHttpFormPost extends AbstractServerAssertion<HttpFormPost> implements ServerAssertion<HttpFormPost> {
   private final StashManagerFactory d;
   private static final String[] e;

   public ServerHttpFormPost(HttpFormPost var1, ApplicationContext var2) {
      super(var1);
      this.d = (StashManagerFactory)var2.getBean(e[3], StashManagerFactory.class);
   }

   @Override
   public AssertionStatus checkRequest(PolicyEnforcementContext param1) throws IOException, PolicyAssertionException {
      // $VF: Couldn't be decompiled
      // Please report this to the Vineflower issue tracker, at https://github.com/Vineflower/vineflower/issues with a copy of the class file (if you have the rights to distribute it!)
      // java.lang.RuntimeException: parsing failure!
      //   at org.jetbrains.java.decompiler.modules.decompiler.decompose.DomHelper.parseGraph(DomHelper.java:211)
      //   at org.jetbrains.java.decompiler.main.rels.MethodProcessor.codeToJava(MethodProcessor.java:174)
      //
      // Bytecode:
      // 000: aload 1
      // 001: invokeinterface com/l7tech/server/message/PolicyEnforcementContext.getRequest ()Lcom/l7tech/message/Message; 1
      // 006: astore 2
      // 007: aload 2
      // 008: invokevirtual com/l7tech/message/Message.getMimeKnob ()Lcom/l7tech/message/MimeKnob;
      // 00b: astore 3
      // 00c: aload 3
      // 00d: invokeinterface com/l7tech/message/MimeKnob.getOuterContentType ()Lcom/l7tech/common/mime/ContentTypeHeader; 1
      // 012: astore 4
      // 014: aload 2
      // 015: ldc com/l7tech/message/HttpRequestKnob
      // 017: invokevirtual com/l7tech/message/Message.getKnob (Ljava/lang/Class;)Ljava/lang/Object;
      // 01a: checkcast com/l7tech/message/HttpRequestKnob
      // 01d: astore 5
      // 01f: aload 5
      // 021: ifnonnull 033
      // 024: aload 0
      // 025: getstatic com/l7tech/gateway/common/audit/AssertionMessages.HTTPFORM_NON_HTTP Lcom/l7tech/gateway/common/audit/Messages$M;
      // 028: invokevirtual com/l7tech/server/policy/assertion/ServerHttpFormPost.logAndAudit (Lcom/l7tech/gateway/common/audit/AuditDetailMessage;)V
      // 02b: getstatic com/l7tech/policy/assertion/AssertionStatus.NOT_APPLICABLE Lcom/l7tech/policy/assertion/AssertionStatus;
      // 02e: areturn
      // 02f: invokestatic com/l7tech/server/policy/assertion/ServerHttpFormPost.a (Ljava/io/IOException;)Ljava/io/IOException;
      // 032: athrow
      // 033: getstatic com/l7tech/common/http/HttpMethod.POST Lcom/l7tech/common/http/HttpMethod;
      // 036: aload 5
      // 038: invokeinterface com/l7tech/message/HttpRequestKnob.getMethod ()Lcom/l7tech/common/http/HttpMethod; 1
      // 03d: if_acmpne 077
      // 040: aload 4
      // 042: invokevirtual com/l7tech/common/mime/ContentTypeHeader.isApplication ()Z
      // 045: ifeq 077
      // 048: goto 04f
      // 04b: invokestatic com/l7tech/server/policy/assertion/ServerHttpFormPost.a (Ljava/io/IOException;)Ljava/io/IOException;
      // 04e: athrow
      // 04f: getstatic com/l7tech/policy/assertion/HttpFormPost.X_WWW_FORM_URLENCODED Ljava/lang/String;
      // 052: aload 4
      // 054: invokevirtual com/l7tech/common/mime/ContentTypeHeader.getSubtype ()Ljava/lang/String;
      // 057: invokevirtual java/lang/String.equals (Ljava/lang/Object;)Z
      // 05a: ifeq 077
      // 05d: goto 064
      // 060: invokestatic com/l7tech/server/policy/assertion/ServerHttpFormPost.a (Ljava/io/IOException;)Ljava/io/IOException;
      // 063: athrow
      // 064: aload 0
      // 065: getfield com/l7tech/server/policy/assertion/ServerHttpFormPost.logger Ljava/util/logging/Logger;
      // 068: getstatic com/l7tech/server/policy/assertion/ServerHttpFormPost.e [Ljava/lang/String;
      // 06b: bipush 1
      // 06c: aaload
      // 06d: invokevirtual java/util/logging/Logger.fine (Ljava/lang/String;)V
      // 070: goto 0e2
      // 073: invokestatic com/l7tech/server/policy/assertion/ServerHttpFormPost.a (Ljava/io/IOException;)Ljava/io/IOException;
      // 076: athrow
      // 077: getstatic com/l7tech/common/http/HttpMethod.GET Lcom/l7tech/common/http/HttpMethod;
      // 07a: aload 5
      // 07c: invokeinterface com/l7tech/message/HttpRequestKnob.getMethod ()Lcom/l7tech/common/http/HttpMethod; 1
      // 081: if_acmpne 0bc
      // 084: aload 5
      // 086: invokeinterface com/l7tech/message/HttpRequestKnob.getQueryString ()Ljava/lang/String; 1
      // 08b: ifnull 0bc
      // 08e: goto 095
      // 091: invokestatic com/l7tech/server/policy/assertion/ServerHttpFormPost.a (Ljava/io/IOException;)Ljava/io/IOException;
      // 094: athrow
      // 095: aload 5
      // 097: invokeinterface com/l7tech/message/HttpRequestKnob.getQueryString ()Ljava/lang/String; 1
      // 09c: invokevirtual java/lang/String.length ()I
      // 09f: ifle 0bc
      // 0a2: goto 0a9
      // 0a5: invokestatic com/l7tech/server/policy/assertion/ServerHttpFormPost.a (Ljava/io/IOException;)Ljava/io/IOException;
      // 0a8: athrow
      // 0a9: aload 0
      // 0aa: getfield com/l7tech/server/policy/assertion/ServerHttpFormPost.logger Ljava/util/logging/Logger;
      // 0ad: getstatic com/l7tech/server/policy/assertion/ServerHttpFormPost.e [Ljava/lang/String;
      // 0b0: bipush 0
      // 0b1: aaload
      // 0b2: invokevirtual java/util/logging/Logger.fine (Ljava/lang/String;)V
      // 0b5: goto 0e2
      // 0b8: invokestatic com/l7tech/server/policy/assertion/ServerHttpFormPost.a (Ljava/io/IOException;)Ljava/io/IOException;
      // 0bb: athrow
      // 0bc: aload 0
      // 0bd: getstatic com/l7tech/gateway/common/audit/AssertionMessages.HTTPFORM_WRONG_TYPE Lcom/l7tech/gateway/common/audit/Messages$M;
      // 0c0: bipush 1
      // 0c1: anewarray 77
      // 0c4: dup
      // 0c5: bipush 0
      // 0c6: aload 4
      // 0c8: invokevirtual com/l7tech/common/mime/ContentTypeHeader.getFullValue ()Ljava/lang/String;
      // 0cb: getstatic com/l7tech/server/policy/assertion/ServerHttpFormPost.e [Ljava/lang/String;
      // 0ce: astore 14
      // 0d0: aload 14
      // 0d2: bipush 4
      // 0d3: aaload
      // 0d4: swap
      // 0d5: invokedynamic makeConcatWithConstants (Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; bsm=java/lang/invoke/StringConcatFactory.makeConcatWithConstants (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite; args=[ "\u0001\u0001" ]
      // 0da: aastore
      // 0db: invokevirtual com/l7tech/server/policy/assertion/ServerHttpFormPost.logAndAudit (Lcom/l7tech/gateway/common/audit/AuditDetailMessage;[Ljava/lang/String;)V
      // 0de: getstatic com/l7tech/policy/assertion/AssertionStatus.NOT_APPLICABLE Lcom/l7tech/policy/assertion/AssertionStatus;
      // 0e1: areturn
      // 0e2: aload 0
      // 0e3: getfield com/l7tech/server/policy/assertion/ServerHttpFormPost.assertion Lcom/l7tech/policy/assertion/Assertion;
      // 0e6: checkcast com/l7tech/policy/assertion/HttpFormPost
      // 0e9: invokevirtual com/l7tech/policy/assertion/HttpFormPost.getFieldInfos ()[Lcom/l7tech/policy/assertion/HttpFormPost$FieldInfo;
      // 0ec: arraylength
      // 0ed: anewarray 203
      // 0f0: astore 6
      // 0f2: aload 0
      // 0f3: getfield com/l7tech/server/policy/assertion/ServerHttpFormPost.assertion Lcom/l7tech/policy/assertion/Assertion;
      // 0f6: checkcast com/l7tech/policy/assertion/HttpFormPost
      // 0f9: invokevirtual com/l7tech/policy/assertion/HttpFormPost.getFieldInfos ()[Lcom/l7tech/policy/assertion/HttpFormPost$FieldInfo;
      // 0fc: arraylength
      // 0fd: anewarray 77
      // 100: astore 7
      // 102: bipush 0
      // 103: istore 8
      // 105: iload 8
      // 107: aload 0
      // 108: getfield com/l7tech/server/policy/assertion/ServerHttpFormPost.assertion Lcom/l7tech/policy/assertion/Assertion;
      // 10b: checkcast com/l7tech/policy/assertion/HttpFormPost
      // 10e: invokevirtual com/l7tech/policy/assertion/HttpFormPost.getFieldInfos ()[Lcom/l7tech/policy/assertion/HttpFormPost$FieldInfo;
      // 111: arraylength
      // 112: if_icmpge 1cd
      // 115: aload 0
      // 116: getfield com/l7tech/server/policy/assertion/ServerHttpFormPost.assertion Lcom/l7tech/policy/assertion/Assertion;
      // 119: checkcast com/l7tech/policy/assertion/HttpFormPost
      // 11c: invokevirtual com/l7tech/policy/assertion/HttpFormPost.getFieldInfos ()[Lcom/l7tech/policy/assertion/HttpFormPost$FieldInfo;
      // 11f: iload 8
      // 121: aaload
      // 122: invokevirtual com/l7tech/policy/assertion/HttpFormPost$FieldInfo.getFieldname ()Ljava/lang/String;
      // 125: astore 9
      // 127: aload 0
      // 128: getfield com/l7tech/server/policy/assertion/ServerHttpFormPost.assertion Lcom/l7tech/policy/assertion/Assertion;
      // 12b: checkcast com/l7tech/policy/assertion/HttpFormPost
      // 12e: invokevirtual com/l7tech/policy/assertion/HttpFormPost.getFieldInfos ()[Lcom/l7tech/policy/assertion/HttpFormPost$FieldInfo;
      // 131: iload 8
      // 133: aaload
      // 134: invokevirtual com/l7tech/policy/assertion/HttpFormPost$FieldInfo.getContentType ()Ljava/lang/String;
      // 137: astore 10
      // 139: aload 10
      // 13b: invokestatic com/l7tech/common/mime/ContentTypeHeader.parseValue (Ljava/lang/String;)Lcom/l7tech/common/mime/ContentTypeHeader;
      // 13e: astore 11
      // 140: aload 5
      // 142: aload 9
      // 144: invokeinterface com/l7tech/message/HttpRequestKnob.getParameterValues (Ljava/lang/String;)[Ljava/lang/String; 2
      // 149: astore 12
      // 14b: aload 12
      // 14d: ifnonnull 168
      // 150: aload 0
      // 151: getstatic com/l7tech/gateway/common/audit/AssertionMessages.HTTPFORM_NO_SUCH_FIELD Lcom/l7tech/gateway/common/audit/Messages$M;
      // 154: bipush 1
      // 155: anewarray 77
      // 158: dup
      // 159: bipush 0
      // 15a: aload 9
      // 15c: aastore
      // 15d: invokevirtual com/l7tech/server/policy/assertion/ServerHttpFormPost.logAndAudit (Lcom/l7tech/gateway/common/audit/AuditDetailMessage;[Ljava/lang/String;)V
      // 160: getstatic com/l7tech/policy/assertion/AssertionStatus.FAILED Lcom/l7tech/policy/assertion/AssertionStatus;
      // 163: areturn
      // 164: invokestatic com/l7tech/server/policy/assertion/ServerHttpFormPost.a (Ljava/io/IOException;)Ljava/io/IOException;
      // 167: athrow
      // 168: aload 12
      // 16a: arraylength
      // 16b: bipush 1
      // 16c: if_icmple 186
      // 16f: aload 0
      // 170: getstatic com/l7tech/gateway/common/audit/AssertionMessages.HTTPFORM_MULTIVALUE Lcom/l7tech/gateway/common/audit/Messages$M;
      // 173: bipush 1
      // 174: anewarray 77
      // 177: dup
      // 178: bipush 0
      // 179: aload 9
      // 17b: aastore
      // 17c: invokevirtual com/l7tech/server/policy/assertion/ServerHttpFormPost.logAndAudit (Lcom/l7tech/gateway/common/audit/AuditDetailMessage;[Ljava/lang/String;)V
      // 17f: goto 1c7
      // 182: invokestatic com/l7tech/server/policy/assertion/ServerHttpFormPost.a (Ljava/io/IOException;)Ljava/io/IOException;
      // 185: athrow
      // 186: aload 12
      // 188: bipush 0
      // 189: aaload
      // 18a: astore 13
      // 18c: aload 13
      // 18e: invokevirtual java/lang/String.length ()I
      // 191: ldc 524288
      // 193: if_icmplt 1ae
      // 196: aload 0
      // 197: getstatic com/l7tech/gateway/common/audit/AssertionMessages.HTTPFORM_TOO_BIG Lcom/l7tech/gateway/common/audit/Messages$M;
      // 19a: bipush 1
      // 19b: anewarray 77
      // 19e: dup
      // 19f: bipush 0
      // 1a0: aload 9
      // 1a2: aastore
      // 1a3: invokevirtual com/l7tech/server/policy/assertion/ServerHttpFormPost.logAndAudit (Lcom/l7tech/gateway/common/audit/AuditDetailMessage;[Ljava/lang/String;)V
      // 1a6: getstatic com/l7tech/policy/assertion/AssertionStatus.FAILED Lcom/l7tech/policy/assertion/AssertionStatus;
      // 1a9: areturn
      // 1aa: invokestatic com/l7tech/server/policy/assertion/ServerHttpFormPost.a (Ljava/io/IOException;)Ljava/io/IOException;
      // 1ad: athrow
      // 1ae: aload 6
      // 1b0: iload 8
      // 1b2: aload 13
      // 1b4: aload 11
      // 1b6: invokevirtual com/l7tech/common/mime/ContentTypeHeader.getEncoding ()Ljava/nio/charset/Charset;
      // 1b9: invokevirtual java/lang/String.getBytes (Ljava/nio/charset/Charset;)[B
      // 1bc: aastore
      // 1bd: aload 7
      // 1bf: iload 8
      // 1c1: aload 11
      // 1c3: invokevirtual com/l7tech/common/mime/ContentTypeHeader.getFullValue ()Ljava/lang/String;
      // 1c6: aastore
      // 1c7: iinc 8 1
      // 1ca: goto 105
      // 1cd: aload 6
      // 1cf: arraylength
      // 1d0: bipush 1
      // 1d1: if_icmpne 1e3
      // 1d4: aload 6
      // 1d6: bipush 0
      // 1d7: aaload
      // 1d8: astore 8
      // 1da: aload 7
      // 1dc: bipush 0
      // 1dd: aaload
      // 1de: astore 9
      // 1e0: goto 20b
      // 1e3: invokestatic com/l7tech/common/mime/MimeUtil.randomBoundary ()[B
      // 1e6: astore 10
      // 1e8: aload 10
      // 1ea: aload 6
      // 1ec: aload 7
      // 1ee: invokestatic com/l7tech/common/mime/MimeUtil.makeMultipartMessage ([B[[B[Ljava/lang/String;)[B
      // 1f1: astore 8
      // 1f3: new java/lang/String
      // 1f6: dup
      // 1f7: aload 10
      // 1f9: invokespecial java/lang/String.<init> ([B)V
      // 1fc: getstatic com/l7tech/server/policy/assertion/ServerHttpFormPost.e [Ljava/lang/String;
      // 1ff: bipush 2
      // 200: aaload
      // 201: swap
      // 202: ldc "\""
      // 204: invokedynamic makeConcatWithConstants (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; bsm=java/lang/invoke/StringConcatFactory.makeConcatWithConstants (Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite; args=[ "\u0001\u0001\u0001" ]
      // 209: astore 9
      // 20b: aload 2
      // 20c: aload 0
      // 20d: getfield com/l7tech/server/policy/assertion/ServerHttpFormPost.d Lcom/l7tech/server/StashManagerFactory;
      // 210: invokeinterface com/l7tech/server/StashManagerFactory.createStashManager ()Lcom/l7tech/common/mime/StashManager; 1
      // 215: aload 9
      // 217: invokestatic com/l7tech/common/mime/ContentTypeHeader.parseValue (Ljava/lang/String;)Lcom/l7tech/common/mime/ContentTypeHeader;
      // 21a: new java/io/ByteArrayInputStream
      // 21d: dup
      // 21e: aload 8
      // 220: invokespecial java/io/ByteArrayInputStream.<init> ([B)V
      // 223: invokevirtual com/l7tech/message/Message.initialize (Lcom/l7tech/common/mime/StashManager;Lcom/l7tech/common/mime/ContentTypeHeader;Ljava/io/InputStream;)V
      // 226: getstatic com/l7tech/policy/assertion/AssertionStatus.NONE Lcom/l7tech/policy/assertion/AssertionStatus;
      // 229: areturn
      // try (14 -> 21): 21 java/io/IOException
      // try (23 -> 30): 31 java/io/IOException
      // try (27 -> 38): 39 java/io/IOException
      // try (33 -> 48): 48 java/io/IOException
      // try (50 -> 57): 58 java/io/IOException
      // try (54 -> 64): 65 java/io/IOException
      // try (60 -> 74): 74 java/io/IOException
      // try (141 -> 154): 154 java/io/IOException
      // try (156 -> 170): 170 java/io/IOException
      // try (176 -> 191): 191 java/io/IOException
   }

   private static IOException a(IOException var0) {
      return var0;
   }

   static {
      String[] var5 = new String[5];
      int var3 = 0;
      String var2 = "\u0006\n`\u0005D\u0019i0OD%yOj;\u001dn\u0012\u0006\n`\u0005D\u0019i0OS/~;,2\u0000q\r\u001d9\u001ao\u0014D\u001fm&\u001b,\u0012H\u0003m \ng[\r\rc!\u0001g\u0001_\u00161v";
      int var4 = "\u0006\n`\u0005D\u0019i0OD%yOj;\u001dn\u0012\u0006\n`\u0005D\u0019i0OS/~;,2\u0000q\r\u001d9\u001ao\u0014D\u001fm&\u001b,\u0012H\u0003m \ng[\r\rc!\u0001g\u0001_\u00161v"
         .length();
      char var1 = 17;
      int var7 = -1;

      label24:
      while (true) {
         byte var10000 = 27;
         String var10001 = var2.substring(++var7, var7 + var1);
         byte var10002 = -1;

         while (true) {
            String var8 = b(var10000, a(var10001));
            switch (var10002) {
               case 0:
                  var5[var3++] = var8;
                  if ((var7 += var1) >= var4) {
                     e = var5;
                     return;
                  }

                  var1 = var2.charAt(var7);
                  break;
               default:
                  var5[var3++] = var8;
                  if ((var7 += var1) < var4) {
                     var1 = var2.charAt(var7);
                     continue label24;
                  }

                  var2 = "\u0010,U$r\u0015Z\r9S2h\u001eZ\u0000,[%c\u0011 7Z#\u007f6ON\fM'\u007fxL\u0002+\u0014";
                  var4 = "\u0010,U$r\u0015Z\r9S2h\u001eZ\u0000,[%c\u0011 7Z#\u007f6ON\fM'\u007fxL\u0002+\u0014".length();
                  var1 = 19;
                  var7 = -1;
            }

            var10000 = 44;
            var10001 = var2.substring(++var7, var7 + var1);
            var10002 = 0;
         }
      }
   }

   private static char[] a(String var0) {
      char[] var10000 = var0.toCharArray();
      if (var10000.length < 2) {
         var10000[0] = (char)(var10000[0] ^ 23);
      }

      return var10000;
   }

   private static String b(int var0, char[] var1) {
      int var10003 = var1.length;
      int var10002 = var0;
      char[] var10001 = var1;
      int var10000 = var10003;

      for (int var2 = 0; var10000 > var2; var2++) {
         var10001[var2] = (char)(var10001[var2] ^ var10002 ^ switch (var2 % 7) {
            case 0 -> 79;
            case 1 -> 116;
            case 2 -> 24;
            case 3 -> 123;
            case 4 -> 54;
            case 5 -> 116;
            default -> 23;
         });
      }

      return new String(var10001).intern();
   }
}
