/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.gateway.common.audit.Audit
 */
package com.l7tech.server.communityschemas;

import com.l7tech.gateway.common.audit.Audit;
import com.l7tech.server.communityschemas.SchemaManagerImpl;
import com.l7tech.server.communityschemas.SchemaSourceResolver;
import com.l7tech.server.communityschemas.n;
import java.io.IOException;
import java.util.Map;
import java.util.Set;
import org.w3c.dom.ls.LSInput;
import org.w3c.dom.ls.LSResourceResolver;
import org.xml.sax.SAXException;

class k
implements LSResourceResolver {
    final Set val$includes;
    final Map val$directIncludes;
    final Map val$directImports;
    final Audit val$audit;
    final Set val$seenSystemIds;
    final SchemaSourceResolver.SchemaSource val$source;
    final SchemaManagerImpl this$0;
    private static final String[] a;

    /*
     * Ignored method signature, as it can't be verified against descriptor
     */
    k(SchemaManagerImpl schemaManagerImpl, Set set, Map map, Map map2, Audit audit, Set set2, SchemaSourceResolver.SchemaSource schemaSource) {
        this.this$0 = schemaManagerImpl;
        this.val$includes = set;
        this.val$directIncludes = map;
        this.val$directImports = map2;
        this.val$audit = audit;
        this.val$seenSystemIds = set2;
        this.val$source = schemaSource;
    }

    @Override
    public LSInput resolveResource(String string, String string2, String string3, String string4, String string5) {
        Map map;
        try {
            if (a[0].equals(string)) {
                return this.this$0.a(string3, string4, string5);
            }
        }
        catch (IOException iOException) {
            throw k.a(iOException);
        }
        try {
            if (!a[1].equals(string)) {
                throw new SchemaManagerImpl.UnresolvableException(null, SchemaManagerImpl.a(string5, string4, string3, string2));
            }
        }
        catch (IOException iOException) {
            throw k.a(iOException);
        }
        try {
            map = this.val$includes.contains(string4) ? this.val$directIncludes : this.val$directImports;
        }
        catch (IOException iOException) {
            throw k.a(iOException);
        }
        Map map2 = map;
        try {
            boolean bl2;
            Map map3;
            Set set;
            String string6;
            String string7;
            String string8;
            Audit audit;
            SchemaManagerImpl schemaManagerImpl;
            n n2;
            try {
                n2 = this.this$0.o.get();
                schemaManagerImpl = this.this$0;
                audit = this.val$audit;
                string8 = string2;
                string7 = string4;
                string6 = string5;
                set = this.val$seenSystemIds;
                map3 = map2;
                bl2 = !this.this$0.e(this.val$source.getResolverId());
            }
            catch (IOException iOException) {
                throw k.a(iOException);
            }
            return n2.makeLsInput(schemaManagerImpl.a(audit, string8, string7, string6, set, map3, bl2));
        }
        catch (IOException iOException) {
            throw new SchemaManagerImpl.UnresolvableException(iOException, SchemaManagerImpl.a(string5, string4, string3, string2));
        }
        catch (SAXException sAXException) {
            throw new SchemaManagerImpl.UnresolvableException(sAXException, SchemaManagerImpl.a(string5, string4, string3, string2));
        }
    }

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

    /*
     * Enabled aggressive block sorting
     */
    static {
        String[] stringArray = new String[2];
        int n2 = 0;
        String string = "\u0000`\u0019d\u0005Vo\u001fc\u001a:HJn\u0007f\n;k+o:Q.9G\u0014, \u0000`\u0019d\u0005Vo\u001fc\u001a:HJn\u0007f\n;\rIpY;5Ys*#\u0000q\u0000u";
        int n3 = "\u0000`\u0019d\u0005Vo\u001fc\u001a:HJn\u0007f\n;k+o:Q.9G\u0014, \u0000`\u0019d\u0005Vo\u001fc\u001a:HJn\u0007f\n;\rIpY;5Ys*#\u0000q\u0000u".length();
        int n4 = 28;
        int n5 = -1;
        while (true) {
            int n6 = ++n5;
            stringArray[n2++] = k.a(78, k.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] ^ 0xE);
        }
        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 -> 38;
                    case 1 -> 90;
                    case 2 -> 35;
                    case 3 -> 90;
                    case 4 -> 113;
                    case 5 -> 55;
                    default -> 14;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

