/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.cluster.ClusterProperty
 *  com.l7tech.policy.variable.BuiltinVariables
 */
package com.l7tech.server.policy.variable;

import com.l7tech.gateway.common.cluster.ClusterProperty;
import com.l7tech.policy.variable.BuiltinVariables;
import com.l7tech.server.ServerConfig;
import com.l7tech.server.message.PolicyEnforcementContext;
import com.l7tech.server.policy.variable.ServerVariables;
import com.l7tech.server.policy.variable.bg;

class dg
extends bg {
    private static final String[] a;

    dg() {
    }

    @Override
    public Object get(String string, PolicyEnforcementContext policyEnforcementContext) {
        if (string.length() < BuiltinVariables.PREFIX_CLUSTER_PROPERTY.length() + 2) {
            String[] stringArray = a;
            ServerVariables.a.warning(stringArray[0] + string + stringArray[1]);
            return null;
        }
        string = string.substring(BuiltinVariables.PREFIX_CLUSTER_PROPERTY.length() + 1);
        ServerConfig serverConfig = ServerConfig.getInstance();
        String string2 = serverConfig.getNameFromClusterName(string);
        if (string2 != null) {
            return serverConfig.getProperty(string2);
        }
        if (ServerVariables.b() != null) {
            ClusterProperty clusterProperty = ServerVariables.b().getCachedEntityByName(string);
            if (clusterProperty != null && clusterProperty.isHiddenProperty()) {
                return null;
            }
            return clusterProperty != null ? clusterProperty.getValue() : null;
        }
        ServerVariables.a.severe(a[2]);
        return null;
    }

    /*
     * Enabled aggressive block sorting
     */
    static {
        String[] stringArray = new String[3];
        int n2 = 0;
        String string = "lpBQ}p\u0002\u007f1^YqwN):rQVr}\u001a:sU\u0018nw\u001du}F]x2\u001au1Q\u0018\u007f~\u001bieUJ<b\u001cuaUJhk'yp^VsfN}tD\u0018_~\u001bieUJL`\u0001jtBLeQ\u000fyyU\u0018\u007f}\u0000ntHL";
        int n3 = "lpBQ}p\u0002\u007f1^YqwN):rQVr}\u001a:sU\u0018nw\u001du}F]x2\u001au1Q\u0018\u007f~\u001bieUJ<b\u001cuaUJhk'yp^VsfN}tD\u0018_~\u001bieUJL`\u0001jtBLeQ\u000fyyU\u0018\u007f}\u0000ntHL".length();
        int n4 = 14;
        int n5 = -1;
        while (true) {
            int n6 = ++n5;
            stringArray[n2++] = dg.a(13, dg.a(string.substring(n6, n6 + n4)));
            if ((n5 += n4) >= n3) {
                a = stringArray;
                return;
            }
            n4 = string.charAt(n5);
        }
    }

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x63);
        }
        return cArray;
    }

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String a(int n2, char[] cArray) {
        char[] cArray2;
        block11: {
            int n3;
            int n4;
            int n5;
            block10: {
                n5 = n2;
                cArray2 = cArray;
                n4 = cArray.length;
                n3 = 0;
                if (!true) break block10;
                n4 = n4;
                if (n4 <= n3) break block11;
            }
            do {
                n5 = n5;
                cArray2 = cArray2;
                int n6 = n3;
                cArray2[n6] = (char)(cArray2[n6] ^ (n5 ^ (switch (n3 % 7) {
                    case 0 -> 23;
                    case 1 -> 28;
                    case 2 -> 61;
                    case 3 -> 53;
                    case 4 -> 17;
                    case 5 -> 31;
                    default -> 99;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

