/*
 * 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 java.io.IOException;
import java.util.Set;
import org.w3c.dom.ls.LSInput;
import org.w3c.dom.ls.LSResourceResolver;

class i
implements LSResourceResolver {
    static final boolean a;
    final Set val$localDependencies;
    final Audit val$audit;
    final SchemaSourceResolver.SchemaSource val$source;
    final Set val$dependencies;
    final SchemaManagerImpl this$0;
    private static final String b;

    /*
     * Ignored method signature, as it can't be verified against descriptor
     */
    i(SchemaManagerImpl schemaManagerImpl, Set set, Audit audit, SchemaSourceResolver.SchemaSource schemaSource, Set set2) {
        this.this$0 = schemaManagerImpl;
        this.val$localDependencies = set;
        this.val$audit = audit;
        this.val$source = schemaSource;
        this.val$dependencies = set2;
    }

    /*
     * Loose catch block
     */
    @Override
    public LSInput resolveResource(String string, String string2, String string3, String string4, String string5) {
        try {
            if (b.equals(string)) {
                return this.this$0.a(string3, string4, string5);
            }
        }
        catch (IOException iOException) {
            throw i.a(iOException);
        }
        try {
            SchemaSourceResolver.SchemaSource schemaSource;
            block14: {
                schemaSource = null;
                boolean bl2 = this.val$localDependencies.contains(string5);
                if (string4 != null) {
                    schemaSource = this.this$0.a(this.val$audit, string5, string4, false, false, bl2, false);
                }
                if (schemaSource == null) {
                    schemaSource = this.this$0.a(this.val$audit, string5, string2, false, false, bl2);
                }
                if (a) break block14;
                try {
                    block15: {
                        if (schemaSource != null) break block14;
                        break block15;
                        catch (IOException iOException) {
                            throw i.a(iOException);
                        }
                    }
                    throw new AssertionError();
                }
                catch (IOException iOException) {
                    throw i.a(iOException);
                }
            }
            try {
                if (!this.this$0.e(schemaSource.getResolverId())) {
                    this.val$localDependencies.add(this.val$source.getUri());
                }
            }
            catch (IOException iOException) {
                throw i.a(iOException);
            }
            this.val$dependencies.add(schemaSource.getUri());
            return this.this$0.o.get().makeLsInput(schemaSource);
        }
        catch (IOException iOException) {
            throw new SchemaManagerImpl.UnresolvableException(iOException, SchemaManagerImpl.a(string5, string4, string3, string2));
        }
    }

    /*
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     */
    static {
        boolean bl2;
        b = i.a(4, i.a("\u001c9(+Fo\u007f\u0003:+u\u000bs~\u001b?;t(\u0012\u007f&\b\u001fv\u0004-<"));
        try {
            bl2 = !SchemaManagerImpl.class.desiredAssertionStatus();
        }
        catch (SchemaManagerImpl.UnresolvableException unresolvableException) {
            throw i.a(unresolvableException);
        }
        a = bl2;
    }

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

    private static char[] a(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x54);
        }
        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 -> 112;
                    case 1 -> 73;
                    case 2 -> 88;
                    case 3 -> 95;
                    case 4 -> 120;
                    case 5 -> 68;
                    default -> 84;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }
}

