package com.l7tech.policy.assertion.ext;

import com.l7tech.policy.assertion.ext.message.CustomPolicyContext;
import java.io.IOException;
import java.security.GeneralSecurityException;

public abstract class ServiceInvocation {
   protected CustomAssertion customAssertion;
   private CustomAuditor a;
   private static final String[] b;

   public void setCustomAssertion(CustomAssertion var1) {
      try {
         if (var1 == null) {
            throw new NullPointerException(b[0]);
         }
      } catch (NullPointerException var2) {
         throw a(var2);
      }

      this.customAssertion = var1;
   }

   @Deprecated
   public void onRequest(ServiceRequest var1) throws IOException, GeneralSecurityException {
   }

   @Deprecated
   public void onResponse(ServiceResponse var1) throws IOException, GeneralSecurityException {
   }

   public CustomAssertionStatus checkRequest(CustomPolicyContext param1) {
      // $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:
      // 00: aload 1
      // 01: invokeinterface com/l7tech/policy/assertion/ext/message/CustomPolicyContext.getContext ()Ljava/util/Map; 1
      // 06: getstatic com/l7tech/policy/assertion/ext/ServiceInvocation.b [Ljava/lang/String;
      // 09: astore 4
      // 0b: aload 4
      // 0d: bipush 1
      // 0e: aaload
      // 0f: invokeinterface java/util/Map.get (Ljava/lang/Object;)Ljava/lang/Object; 2
      // 14: checkcast com/l7tech/policy/assertion/ext/ServiceRequest
      // 17: astore 2
      // 18: aload 1
      // 19: invokeinterface com/l7tech/policy/assertion/ext/message/CustomPolicyContext.getContext ()Ljava/util/Map; 1
      // 1e: aload 4
      // 20: bipush 2
      // 21: aaload
      // 22: invokeinterface java/util/Map.get (Ljava/lang/Object;)Ljava/lang/Object; 2
      // 27: checkcast com/l7tech/policy/assertion/ext/ServiceResponse
      // 2a: astore 3
      // 2b: aload 1
      // 2c: invokeinterface com/l7tech/policy/assertion/ext/message/CustomPolicyContext.isPostRouting ()Z 1
      // 31: ifeq 4b
      // 34: aload 3
      // 35: ifnull 4b
      // 38: goto 3f
      // 3b: invokestatic com/l7tech/policy/assertion/ext/ServiceInvocation.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 3e: athrow
      // 3f: aload 0
      // 40: aload 3
      // 41: invokevirtual com/l7tech/policy/assertion/ext/ServiceInvocation.onResponse (Lcom/l7tech/policy/assertion/ext/ServiceResponse;)V
      // 44: goto 50
      // 47: invokestatic com/l7tech/policy/assertion/ext/ServiceInvocation.a (Ljava/lang/Exception;)Ljava/lang/Exception;
      // 4a: athrow
      // 4b: aload 0
      // 4c: aload 2
      // 4d: invokevirtual com/l7tech/policy/assertion/ext/ServiceInvocation.onRequest (Lcom/l7tech/policy/assertion/ext/ServiceRequest;)V
      // 50: goto 67
      // 53: astore 2
      // 54: new java/lang/RuntimeException
      // 57: dup
      // 58: aload 2
      // 59: invokespecial java/lang/RuntimeException.<init> (Ljava/lang/Throwable;)V
      // 5c: athrow
      // 5d: astore 2
      // 5e: new java/lang/RuntimeException
      // 61: dup
      // 62: aload 2
      // 63: invokespecial java/lang/RuntimeException.<init> (Ljava/lang/Throwable;)V
      // 66: athrow
      // 67: getstatic com/l7tech/policy/assertion/ext/CustomAssertionStatus.NONE Lcom/l7tech/policy/assertion/ext/CustomAssertionStatus;
      // 6a: areturn
      // try (21 -> 30): 30 java/security/GeneralSecurityException
      // try (18 -> 23): 24 java/security/GeneralSecurityException
      // try (0 -> 35): 36 java/security/GeneralSecurityException
      // try (0 -> 35): 42 java/io/IOException
   }

   public boolean loadsMessagePartsIntoMemory() {
      return true;
   }

   protected void auditInfo(String var1) {
      try {
         if (this.a != null) {
            this.a.auditInfo(this.customAssertion, var1);
         }
      } catch (NullPointerException var2) {
         throw a(var2);
      }
   }

   protected void auditWarn(String var1) {
      try {
         if (this.a != null) {
            this.a.auditWarning(this.customAssertion, var1);
         }
      } catch (NullPointerException var2) {
         throw a(var2);
      }
   }

   void setCustomAuditor(CustomAuditor var1) {
      this.a = var1;
   }

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

   static {
      String[] var5 = new String[3];
      int var3 = 0;
      String var2 = "|VK\u0000A\"]lP]\u0006Z&sq\u0003U\u0001];<qLLTL*<qVT\u0018\u0007mFI\u0001K<h\bmFK\u0004A!oz";
      int var4 = "|VK\u0000A\"]lP]\u0006Z&sq\u0003U\u0001];<qLLTL*<qVT\u0018\u0007mFI\u0001K<h\bmFK\u0004A!oz".length();
      char var1 = ' ';
      int var0 = -1;

      while (true) {
         String var10002 = a(94, a(var2.substring(++var0, var0 + var1)));
         byte var10001 = -1;
         var5[var3++] = var10002;
         if ((var0 += var1) >= var4) {
            b = var5;
            return;
         }

         var1 = var2.charAt(var0);
      }
   }

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

      return var10000;
   }

   private static String a(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 -> 65;
            case 1 -> 125;
            case 2 -> 102;
            case 3 -> 42;
            case 4 -> 112;
            case 5 -> 17;
            default -> 66;
         });
      }

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