/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.cluster.ClusterContext
 *  com.l7tech.gateway.common.spring.remoting.RemoteUtils
 *  com.l7tech.gateway.common.spring.remoting.http.ConfigurableHttpInvokerRequestExecutor
 */
package com.l7tech.server.cluster;

import com.l7tech.gateway.common.cluster.ClusterContext;
import com.l7tech.gateway.common.spring.remoting.RemoteUtils;
import com.l7tech.gateway.common.spring.remoting.http.ConfigurableHttpInvokerRequestExecutor;
import com.l7tech.server.cluster.ClusterContextImpl;
import java.util.Collection;

public class ClusterContextFactory {
    private final String a;
    private final Collection<Object> b;
    private final ConfigurableHttpInvokerRequestExecutor c;
    private static final String[] d;

    public ClusterContextFactory(Collection<Object> collection, ConfigurableHttpInvokerRequestExecutor configurableHttpInvokerRequestExecutor, String string) {
        this.b = collection;
        this.c = configurableHttpInvokerRequestExecutor;
        this.a = string;
    }

    public ClusterContext buildClusterContext(String string, int n2) {
        block6: {
            if (this.a != null) {
                String string2 = RemoteUtils.getFacility();
                try {
                    try {
                        if (string2 != null && !this.a.equals(string2)) {
                        }
                        break block6;
                    }
                    catch (IllegalStateException illegalStateException) {
                        throw ClusterContextFactory.a(illegalStateException);
                    }
                    throw new IllegalStateException(d[2] + string2 + d[1] + this.a + d[0]);
                }
                catch (IllegalStateException illegalStateException) {
                    throw ClusterContextFactory.a(illegalStateException);
                }
            }
        }
        return new ClusterContextImpl(string, n2, this.b, this.c);
    }

    private static IllegalStateException a(IllegalStateException illegalStateException) {
        return illegalStateException;
    }

    /*
     * Enabled aggressive block sorting
     */
    static {
        String[] stringArray = new String[3];
        int n2 = 0;
        String string = ">8\f>:~V\u0002V\u00039t;\u001bP%_w=R\u001bL\u0003`60T\u0003\u0005\u0007|d3R\u0003Q\u0012}68T\u0005\u0005\u0011xu7W\u001eQ\u000e91";
        int n3 = ">8\f>:~V\u0002V\u00039t;\u001bP%_w=R\u001bL\u0003`60T\u0003\u0005\u0007|d3R\u0003Q\u0012}68T\u0005\u0005\u0011xu7W\u001eQ\u000e91".length();
        int n4 = 2;
        int n5 = -1;
        while (true) {
            int n6 = ++n5;
            stringArray[n2++] = ClusterContextFactory.a(74, ClusterContextFactory.a(string.substring(n6, n6 + n4)));
            if ((n5 += n4) >= n3) {
                d = 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] ^ 0x3D);
        }
        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 -> 83;
                    case 1 -> 92;
                    case 2 -> 20;
                    case 3 -> 113;
                    case 4 -> 61;
                    case 5 -> 111;
                    default -> 61;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

