package com.l7tech.server.policy.custom;

import com.l7tech.gateway.common.custom.CustomAssertionDescriptor;
import com.l7tech.policy.assertion.ext.ServiceFinder;
import com.l7tech.server.policy.module.ModuleException;
import com.l7tech.server.policy.module.ScannerCallbacks;
import org.jetbrains.annotations.NotNull;
import org.springframework.context.ApplicationEvent;

class b implements ScannerCallbacks.CustomAssertion {
   final CustomAssertionsRegistrarImpl this$0;
   private static final String[] a;

   b(CustomAssertionsRegistrarImpl var1) {
      this.this$0 = var1;
   }

   @Override
   public void registerAssertion(@NotNull CustomAssertionDescriptor var1) throws ModuleException {
      try {
         if (var1 == null) {
            a(0);
         }
      } catch (IllegalAccessException var6) {
         throw a(var6);
      }

      try {
         com.l7tech.server.policy.custom.a.a(var1);
         this.this$0.registerCustomExtensionInterface(var1.getExtensionInterfaceClass());
      } catch (IllegalAccessException | InstantiationException var4) {
         String var8 = var1.getName();
         String var9 = var1.getModuleFileName();
         String[] var7 = a;
         throw new ModuleException(var7[5] + var8 + var7[0] + var9 + "]", var4);
      } catch (Throwable var5) {
         String var10002 = var1.getName();
         String var10003 = var1.getModuleFileName();
         String[] var3 = a;
         throw new ModuleException(var3[2] + var10002 + var3[3] + var10003 + "]", var5);
      }
   }

   @Override
   public void unregisterAssertion(@NotNull CustomAssertionDescriptor var1) {
      try {
         if (var1 == null) {
            a(1);
         }
      } catch (IllegalArgumentException var2) {
         throw a(var2);
      }

      com.l7tech.server.policy.custom.a.b(var1);
   }

   @Override
   public ServiceFinder getServiceFinder() {
      return this.this$0.a();
   }

   @Override
   public void publishEvent(@NotNull ApplicationEvent var1) {
      try {
         if (var1 == null) {
            a(2);
         }
      } catch (IllegalArgumentException var2) {
         throw a(var2);
      }

      this.this$0.a(var1);
   }

   private static void a(int var0) {
      String var10000;
      Object[] var10001;
      label32: {
         try {
            var10000 = a[7];
            var10001 = new Object[3];
            switch (var0) {
               case 0:
               case 1:
               default:
                  var10001[0] = a[4];
                  break label32;
               case 2:
            }
         } catch (IllegalArgumentException var3) {
            throw a(var3);
         }

         String[] var1 = a;
         var10001[0] = var1[6];
      }

      label40: {
         try {
            var10001[1] = a[10];
            switch (var0) {
               case 0:
               default:
                  var10001[2] = a[9];
                  throw new IllegalArgumentException(String.format(var10000, var10001));
               case 1:
                  break label40;
               case 2:
            }
         } catch (IllegalArgumentException var2) {
            throw a(var2);
         }

         var10001[2] = a[8];
         throw new IllegalArgumentException(String.format(var10000, var10001));
      }

      String[] var4 = a;
      var10001[2] = var4[1];
      throw new IllegalArgumentException(String.format(var10000, var10001));
   }

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

   static {
      String[] var5 = new String[11];
      int var3 = 0;
      String var2 = "\u007f\u000b\f\u0004hk>QB\u0006\u0012<g>VN\u001b\u001a}m5\u000e\u000b\u000f\u0013n.=MO\u001c\u0010y.\u000b\u0013WE\u001b\u0019{g#VN\u001b=o}5P_\u0000\u0013r*gY\u001b\u0013n.'JB\u0005\u0019<|5EB\u001a\by|9LLI\u001fi}$MFI\u001do}5P_\u0000\u0013r.\u000b\u000e\u007f\u000b\u000f\u0013n.=MO\u001c\u0010y.\u000b\nFN\u001a\u001fng VD\u001b*gY\u001b\u0013n.'JB\u0005\u0019<|5EB\u001a\by|9LLI\u001fi}$MFI\u001do}5P_\u0000\u0013r.\u000b\u0005G]\f\u0012h>cY\u000e\tqk>V\u000b\u000f\u0013n.\u0010lD\u001d2ib<\u0002[\b\u000e}c5VN\u001b\\;+#\u0005\u000b\u0006\u001a<+#\f\u000e\u001a\\q{#V\u000b\u0007\u0013h.2G\u000b\u0007\tpb\fR^\u000b\u0010u}8g]\f\u0012h";
      int var4 = "\u007f\u000b\f\u0004hk>QB\u0006\u0012<g>VN\u001b\u001a}m5\u000e\u000b\u000f\u0013n.=MO\u001c\u0010y.\u000b\u0013WE\u001b\u0019{g#VN\u001b=o}5P_\u0000\u0013r*gY\u001b\u0013n.'JB\u0005\u0019<|5EB\u001a\by|9LLI\u001fi}$MFI\u001do}5P_\u0000\u0013r.\u000b\u000e\u007f\u000b\u000f\u0013n.=MO\u001c\u0010y.\u000b\nFN\u001a\u001fng VD\u001b*gY\u001b\u0013n.'JB\u0005\u0019<|5EB\u001a\by|9LLI\u001fi}$MFI\u001do}5P_\u0000\u0013r.\u000b\u0005G]\f\u0012h>cY\u000e\tqk>V\u000b\u000f\u0013n.\u0010lD\u001d2ib<\u0002[\b\u000e}c5VN\u001b\\;+#\u0005\u000b\u0006\u001a<+#\f\u000e\u001a\\q{#V\u000b\u0007\u0013h.2G\u000b\u0007\tpb\fR^\u000b\u0010u}8g]\f\u0012h"
         .length();
      char var1 = '#';
      int var7 = -1;

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

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

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

                  var2 = "C]\u001d\u0006|i&Cy\t\u001cjo7XW\u0014!RW\u0017@c*7T[\u0012@|x1G]\b@\u007fr/X[\u0003@lh0EW\u0017@m";
                  var4 = "C]\u001d\u0006|i&Cy\t\u001cjo7XW\u0014!RW\u0017@c*7T[\u0012@|x1G]\b@\u007fr/X[\u0003@lh0EW\u0017@m".length();
                  var1 = 17;
                  var7 = -1;
            }

            var10000 = 83;
            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] ^ 16);
      }

      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 -> 98;
            case 1 -> 107;
            case 2 -> 41;
            case 3 -> 60;
            case 4 -> 92;
            case 5 -> 78;
            default -> 16;
         });
      }

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