/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.common.io.ResourceReference
 *  com.l7tech.common.io.SchemaUtil
 *  com.l7tech.gateway.common.audit.Audit
 *  com.l7tech.gateway.common.audit.LoggingAudit
 *  com.l7tech.gateway.common.resources.ResourceEntry
 *  com.l7tech.gateway.common.resources.ResourceEntryHeader
 *  com.l7tech.gateway.common.resources.ResourceType
 *  com.l7tech.objectmodel.EntityHeader
 *  com.l7tech.objectmodel.FindException
 *  com.l7tech.objectmodel.Goid
 *  com.l7tech.util.Config
 *  com.l7tech.util.ExceptionUtils
 *  com.l7tech.util.ResourceUtils
 *  com.l7tech.util.Triple
 *  org.springframework.beans.factory.InitializingBean
 *  org.springframework.context.ApplicationEvent
 */
package com.l7tech.server.globalresources;

import com.l7tech.common.io.ResourceReference;
import com.l7tech.common.io.SchemaUtil;
import com.l7tech.gateway.common.audit.Audit;
import com.l7tech.gateway.common.audit.LoggingAudit;
import com.l7tech.gateway.common.resources.ResourceEntry;
import com.l7tech.gateway.common.resources.ResourceEntryHeader;
import com.l7tech.gateway.common.resources.ResourceType;
import com.l7tech.objectmodel.EntityHeader;
import com.l7tech.objectmodel.FindException;
import com.l7tech.objectmodel.Goid;
import com.l7tech.server.communityschemas.SchemaManager;
import com.l7tech.server.event.EntityClassEvent;
import com.l7tech.server.globalresources.ResourceEntryManager;
import com.l7tech.server.globalresources.ResourceEntrySchemaSourceResolver;
import com.l7tech.server.globalresources.q;
import com.l7tech.server.globalresources.r;
import com.l7tech.server.globalresources.v;
import com.l7tech.server.util.PostStartupApplicationListener;
import com.l7tech.util.Config;
import com.l7tech.util.ExceptionUtils;
import com.l7tech.util.ResourceUtils;
import com.l7tech.util.Triple;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.Closeable;
import java.io.IOException;
import java.io.StringReader;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicLong;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationEvent;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

public class SchemaResourceManager
implements PostStartupApplicationListener,
InitializingBean,
PropertyChangeListener {
    private static final Logger a;
    private final Config b;
    private final Timer c;
    private final ResourceEntryManager d;
    private final SchemaManager e;
    private final Map<String, q> f = new ConcurrentHashMap<String, q>();
    private final Map<r, Collection<q>> g = new ConcurrentHashMap<r, Collection<q>>();
    private final AtomicLong h = new AtomicLong();
    private final Object i = new Object();
    private Set<String> j = Collections.emptySet();
    private long k;
    private static final String[] l;

    public SchemaResourceManager(Config config, Timer timer, ResourceEntryManager resourceEntryManager, SchemaManager schemaManager) {
        this.b = config;
        this.c = timer;
        this.d = resourceEntryManager;
        this.e = schemaManager;
    }

    public boolean isSchemaRequired(String string) {
        boolean bl2 = false;
        Set<String> set = this.e.getRequiredSchemaUris();
        if (set.contains(string)) {
            bl2 = true;
        } else {
            Set<String> set2;
            Object object = set.iterator();
            while (object.hasNext()) {
                set2 = object.next();
                if (!this.a(string, (String)((Object)set2), new HashSet<String>())) continue;
                bl2 = true;
                break;
            }
            if (!bl2 && (object = this.f.get(string)) != null) {
                set2 = this.e.getRequiredSchemaTargetNamespaces();
                if (set2.contains(((q)object).d)) {
                    bl2 = true;
                } else {
                    block1: for (String string2 : set2) {
                        Collection<q> collection = this.g.get(SchemaResourceManager.a(string2));
                        if (collection == null) continue;
                        for (q q2 : collection) {
                            if (!this.a(string, q2.c, new HashSet<String>())) continue;
                            bl2 = true;
                            break block1;
                        }
                    }
                }
            }
        }
        return bl2;
    }

    @Override
    public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
        this.h.set(System.currentTimeMillis());
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    public void afterPropertiesSet() throws Exception {
        Object object = this.i;
        synchronized (object) {
            this.b();
        }
        this.c.schedule((TimerTask)new v(this), 15731L, 5331L);
    }

    public void onApplicationEvent(ApplicationEvent applicationEvent) {
        if (applicationEvent instanceof EntityClassEvent) {
            EntityClassEvent entityClassEvent = (EntityClassEvent)applicationEvent;
            try {
                if (ResourceEntry.class.isAssignableFrom(entityClassEvent.getEntityClass())) {
                    this.h.set(System.currentTimeMillis());
                }
            }
            catch (IllegalArgumentException illegalArgumentException) {
                throw SchemaResourceManager.a(illegalArgumentException);
            }
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    private void a() {
        long l2;
        long l3 = this.h.get();
        Object object = this.i;
        synchronized (object) {
            l2 = this.k;
        }
        if (l2 < l3) {
            object = this.i;
            synchronized (object) {
                this.b();
            }
        }
    }

    private void b() {
        this.c();
        this.d();
    }

    /*
     * Loose catch block
     */
    private void c() {
        try {
            Collection collection = this.d.findAll();
            HashSet<String> hashSet = new HashSet<String>();
            HashSet<String> hashSet2 = new HashSet<String>();
            for (ResourceEntry resourceEntry : collection) {
                String[] stringArray;
                q q2;
                block16: {
                    try {
                        if (resourceEntry.getType() != ResourceType.XML_SCHEMA) {
                            continue;
                        }
                    }
                    catch (SAXException sAXException) {
                        throw SchemaResourceManager.a(sAXException);
                    }
                    hashSet.add(resourceEntry.getUri());
                    hashSet2.add(resourceEntry.getResourceKey1());
                    q2 = this.f.get(resourceEntry.getUri());
                    if (q2 == null) break block16;
                    try {
                        block17: {
                            if (!Goid.equals((Goid)q2.a, (Goid)resourceEntry.getGoid())) break block16;
                            break block17;
                            catch (SAXException sAXException) {
                                throw SchemaResourceManager.a(sAXException);
                            }
                        }
                        if (q2.b == resourceEntry.getVersion()) continue;
                    }
                    catch (SAXException sAXException) {
                        throw SchemaResourceManager.a(sAXException);
                    }
                }
                List<ResourceReference> list = Collections.emptyList();
                try {
                    list = SchemaUtil.getDependencies((InputSource)this.a(resourceEntry), (EntityResolver)new ResourceEntrySchemaSourceResolver(this.d));
                }
                catch (SAXException sAXException) {
                    stringArray = l;
                    a.log(Level.WARNING, stringArray[6] + resourceEntry.getUri() + stringArray[11] + ExceptionUtils.getMessage((Throwable)sAXException), ExceptionUtils.getDebugException((Throwable)sAXException));
                }
                catch (IOException iOException) {
                    stringArray = l;
                    a.log(Level.WARNING, stringArray[9] + resourceEntry.getUri() + stringArray[21] + ExceptionUtils.getMessage((Throwable)iOException), ExceptionUtils.getDebugException((Throwable)iOException));
                }
                q2 = new q(resourceEntry.getGoid(), resourceEntry.getVersion(), resourceEntry.getUri(), resourceEntry.getResourceKey1(), list);
                this.f.put(resourceEntry.getUri(), q2);
                Collection<q> collection2 = this.g.get(SchemaResourceManager.a(resourceEntry.getResourceKey1()));
                try {
                    if (collection2 == null) {
                        this.g.put(SchemaResourceManager.a(resourceEntry.getResourceKey1()), Collections.singleton(q2));
                        continue;
                    }
                }
                catch (SAXException sAXException) {
                    throw SchemaResourceManager.a(sAXException);
                }
                ArrayList<q> arrayList = new ArrayList<q>(collection2);
                arrayList.add(q2);
                this.g.put(SchemaResourceManager.a(resourceEntry.getResourceKey1()), Collections.unmodifiableCollection(arrayList));
            }
            this.f.keySet().retainAll(hashSet);
            this.g.keySet().retainAll(hashSet2);
        }
        catch (FindException findException) {
            a.log(Level.WARNING, l[14], findException);
        }
    }

    private InputSource a(ResourceEntry resourceEntry) {
        InputSource inputSource = new InputSource();
        inputSource.setSystemId(resourceEntry.getUri());
        inputSource.setCharacterStream(new StringReader(resourceEntry.getContent()));
        return inputSource;
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     * Could not resolve type clashes
     * Loose catch block
     */
    private void d() {
        block25: {
            Object object;
            String[] stringArray;
            Set<String> set;
            HashSet<SchemaResource> hashSet;
            HashSet<String> hashSet2;
            block26: {
                this.k = System.currentTimeMillis();
                hashSet2 = new HashSet<String>();
                hashSet = new HashSet<SchemaResource>();
                boolean bl2 = false;
                try {
                    set = this.j;
                    Iterator<Object> iterator = new HashSet();
                    stringArray = l;
                    Object object2 = this.b.getProperty(stringArray[16], "").split(stringArray[18]);
                    object = new HashMap<String, ResourceEntryHeader>();
                    for (String string : object2) {
                        Collection<ResourceEntryHeader> collection = this.d.findHeadersByTNS(string);
                        if (collection.size() == 1) {
                            ResourceEntryHeader resourceEntryHeader = collection.iterator().next();
                            object.put(resourceEntryHeader.getUri(), resourceEntryHeader);
                            iterator.add(resourceEntryHeader.getUri());
                            continue;
                        }
                        try {
                            if (collection.isEmpty()) {
                                a.warning(l[23] + string + l[3]);
                                continue;
                            }
                        }
                        catch (FindException findException) {
                            throw SchemaResourceManager.a((Exception)((Object)findException));
                        }
                        stringArray = l;
                        a.warning(stringArray[22] + collection.size() + stringArray[5] + string + stringArray[13]);
                    }
                    hashSet2.addAll(set);
                    hashSet2.removeAll((Collection<?>)((Object)iterator));
                    Iterator iterator2 = iterator.iterator();
                    while (iterator2.hasNext()) {
                        String string = (String)iterator2.next();
                        ResourceEntry resourceEntry = (ResourceEntry)this.d.findByHeader((EntityHeader)object.get(string));
                        if (resourceEntry == null) continue;
                        try {
                            block27: {
                                if (resourceEntry.getType() != ResourceType.XML_SCHEMA) continue;
                                break block27;
                                catch (FindException findException) {
                                    throw SchemaResourceManager.a((Exception)((Object)findException));
                                }
                            }
                            hashSet.add(new SchemaResource(resourceEntry.getUri(), resourceEntry.getResourceKey1(), resourceEntry.getContent()));
                        }
                        catch (FindException findException) {
                            throw SchemaResourceManager.a((Exception)((Object)findException));
                        }
                    }
                    bl2 = true;
                }
                catch (FindException findException) {
                    stringArray = l;
                    a.log(Level.WARNING, stringArray[7], findException);
                }
                if (!bl2) break block25;
                try {
                    block28: {
                        if (!hashSet2.isEmpty()) break block26;
                        break block28;
                        catch (FindException findException) {
                            throw SchemaResourceManager.a((Exception)((Object)findException));
                        }
                    }
                    if (hashSet.isEmpty()) break block25;
                }
                catch (FindException findException) {
                    throw SchemaResourceManager.a((Exception)((Object)findException));
                }
            }
            stringArray = l;
            a.info(stringArray[20]);
            set = new HashSet<String>(this.j);
            for (Object object2 : hashSet2) {
                set.remove(object2);
                this.e.unregisterSchema((String)object2);
            }
            for (Object object2 : hashSet) {
                set.add(((SchemaResource)((Object)object2)).getUri());
                this.e.registerSchema(((SchemaResource)((Object)object2)).getUri(), ((SchemaResource)((Object)object2)).getTargetNamespaceForRegistration(), ((SchemaResource)((Object)object2)).getContent());
            }
            this.j = Collections.unmodifiableSet(set);
            for (Object object2 : this.j) {
                object = null;
                try {
                    object = this.e.getSchemaByUri((Audit)new LoggingAudit(a), (String)object2);
                }
                catch (SAXException sAXException) {
                    stringArray = l;
                    a.log(Level.WARNING, stringArray[4] + (String)object2 + stringArray[1] + ExceptionUtils.getMessage((Throwable)sAXException), ExceptionUtils.getDebugException((Throwable)sAXException));
                    ResourceUtils.closeQuietly((Closeable)object);
                    continue;
                }
                catch (IOException iOException) {
                    stringArray = l;
                    a.log(Level.WARNING, stringArray[19] + (String)object2 + stringArray[8] + ExceptionUtils.getMessage((Throwable)iOException), ExceptionUtils.getDebugException((Throwable)iOException));
                    {
                        catch (Throwable throwable) {
                            ResourceUtils.closeQuietly(object);
                            throw throwable;
                        }
                    }
                    ResourceUtils.closeQuietly((Closeable)object);
                    continue;
                }
                ResourceUtils.closeQuietly((Closeable)object);
            }
        }
    }

    private boolean a(String string, String string2, Set<String> set) {
        boolean bl2 = false;
        if (!set.contains(string2)) {
            set.add(string2);
            q q2 = this.f.get(string);
            q q3 = this.f.get(string2);
            if (q3 != null) {
                HashSet<String> hashSet = new HashSet<String>();
                for (ResourceReference object : q3.e) {
                    block26: {
                        block24: {
                            String[] stringArray;
                            block23: {
                                try {
                                    if (object.getUri() == null || !object.getUri().equals(string)) break block23;
                                }
                                catch (URISyntaxException uRISyntaxException) {
                                    throw SchemaResourceManager.a(uRISyntaxException);
                                }
                                bl2 = true;
                                break;
                            }
                            try {
                                if (object.getUri() == null || object.getBaseUri() == null) break block24;
                            }
                            catch (URISyntaxException uRISyntaxException) {
                                throw SchemaResourceManager.a(uRISyntaxException);
                            }
                            try {
                                String illegalArgumentException = new URI(object.getBaseUri()).resolve(object.getUri()).toString();
                                hashSet.add(illegalArgumentException);
                                if (illegalArgumentException.equals(string)) {
                                    bl2 = true;
                                    break;
                                }
                            }
                            catch (URISyntaxException uRISyntaxException) {
                                String string3 = ExceptionUtils.getMessage((Throwable)uRISyntaxException);
                                String string4 = object.getBaseUri();
                                String string5 = object.getUri();
                                stringArray = l;
                                a.log(Level.FINE, stringArray[15] + string5 + stringArray[17] + string4 + stringArray[12] + string3, ExceptionUtils.getDebugException((Throwable)uRISyntaxException));
                            }
                            catch (IllegalArgumentException illegalArgumentException) {
                                String string6 = ExceptionUtils.getMessage((Throwable)illegalArgumentException);
                                String string7 = object.getBaseUri();
                                String string8 = object.getUri();
                                stringArray = l;
                                a.log(Level.FINE, stringArray[0] + string8 + stringArray[10] + string7 + stringArray[2] + string6, ExceptionUtils.getDebugException((Throwable)illegalArgumentException));
                            }
                        }
                        try {
                            try {
                                block25: {
                                    try {
                                        try {
                                            try {
                                                if (q2 == null || !object.hasTargetNamespace()) continue;
                                            }
                                            catch (URISyntaxException uRISyntaxException) {
                                                throw SchemaResourceManager.a(uRISyntaxException);
                                            }
                                            if (object.getTargetNamespace() != null) break block25;
                                        }
                                        catch (URISyntaxException uRISyntaxException) {
                                            throw SchemaResourceManager.a(uRISyntaxException);
                                        }
                                        if (q2.d == null) break block26;
                                    }
                                    catch (URISyntaxException uRISyntaxException) {
                                        throw SchemaResourceManager.a(uRISyntaxException);
                                    }
                                }
                                if (object.getTargetNamespace() == null) continue;
                            }
                            catch (URISyntaxException uRISyntaxException) {
                                throw SchemaResourceManager.a(uRISyntaxException);
                            }
                            if (!object.getTargetNamespace().equals(q2.d)) continue;
                        }
                        catch (URISyntaxException uRISyntaxException) {
                            throw SchemaResourceManager.a(uRISyntaxException);
                        }
                    }
                    bl2 = true;
                    break;
                }
                if (!bl2) {
                    for (String string9 : hashSet) {
                        if (!this.a(string, string9, set)) continue;
                        bl2 = true;
                        break;
                    }
                }
            }
        }
        return bl2;
    }

    private static r a(String string) {
        return new r(string);
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[24];
                var3_1 = 0;
                var2_2 = "\t\u0017\u0005<\u0006X\u001a)\u0016\u0018?\u0002\u0011\u0006+E\u00136\u0004\u001d\u0006(\u0000\u00190\rX=\u001e,Wt#kE_$\u001c\u001d\u0006l\u0017\u00124\u001d\u000b\u001c)\u0017\u001e=\u0013X\u000e#\u0017W;\u0015\n\f;\u0004\u00056]BH\u0003k_W#kIW&\u001a\u0019\n \u0000W'\u001bX\u001a)\u0002\u001e \u0000\u001d\u001al\u0003\u0018!T\u0010\t>\u0001\u00002\u0006\u001dF\u0014\u0005\u000b\u00012\u0018\u0011\fl=:\u001fT+\u000b$\u0000\u001a2T_+eE/\u001e8X;/\r\u0012>\u0015\u000bH*\n\u0002=\u0010X\u001f%\u0011\u001fs\u0000\u0019\u001a+\u0000\u0003s\u001a\u0019\u0005)\u0016\u00072\u0017\u001dHk\u0016\t\u0017\u0005<\u0006X\u0004#\u0004\u0013:\u001a\u001fH?\u0006\u001f6\u0019\u0019Hk'\t\u0017\u0005<\u0006X\u001a)\u0002\u001e \u0000\u001d\u001a%\u000b\u0010s\u0007\u001b\u0000)\b\u0016 T\u001e\u0007>E\u001f2\u0006\u001c\u001f-\u0017\u0012}#kE_$\u001c\u001d\u0006l\u0017\u00124\u001d\u000b\u001c)\u0017\u001e=\u0013X\u000e#\u0017W;\u0015\n\f;\u0004\u00056]BH\u0016\t\u0017\u0005<\u0006X\u0004#\u0004\u0013:\u001a\u001fH?\u0006\u001f6\u0019\u0019Hk\u000bkE\u00164\u0015\u0011\u0006?\u0011Wt\u001ekE\u0003<T\r\u0018(\u0004\u00036T\u001c\r<\u0000\u00197\u0011\u0016\u000b5E\u00142\u0017\u0010\rvE\u0003k_W#kIW&\u001a\u0019\n \u0000W'\u001bX\u001a)\u0002\u001e \u0000\u001d\u001al\u0003\u0018!T\u0010\t>\u0001\u00002\u0006\u001dF1\t\u0017\u0005<\u0006X\u0004#\u0004\u0013:\u001a\u001fH?\u0006\u001f6\u0019\u0019\u001bl\u0011\u0018s\u0001\b\f-\u0011\u0012s\u0010\u001d\u0018)\u000b\u00136\u001a\u001b\u0011l\u0006\u00160\u001c\u001dF \t\u0017\u0005<\u0006X\u001a)\u0016\u0018?\u0002\u0011\u0006+E\u00136\u0004\u001d\u0006(\u0000\u00190\rX=\u001e,Wt\u001f?\u0006\u001f6\u0019\u0019F$\u0004\u00057\u0003\u0019\u001a)1\u0016!\u0013\u001d\u001c\u0002\u0004\u001a6\u0007\b\t/\u0000\u0004\u000bkE\u00164\u0015\u0011\u0006?\u0011Wt\ndZ\u001az(\u000b\u0013}I\n\u0014\u0005\u000b\u00012\u0018\u0011\fl=:\u001fT+\u000b$\u0000\u001a2T_)d7\u0012z\u0006\u001d\u000f%\u0016\u00036\u0006\u0011\u0006+E/\u001e8X;/\r\u0012>\u0015\u000bH*\n\u0005s\u001c\u0019\u001a(\u0012\u0016!\u0011V\u001ekE\u0003<T\r\u0018(\u0004\u00036T\u001c\r<\u0000\u00197\u0011\u0016\u000b5E\u00142\u0017\u0010\rvE";
                var4_3 = "\t\u0017\u0005<\u0006X\u001a)\u0016\u0018?\u0002\u0011\u0006+E\u00136\u0004\u001d\u0006(\u0000\u00190\rX=\u001e,Wt#kE_$\u001c\u001d\u0006l\u0017\u00124\u001d\u000b\u001c)\u0017\u001e=\u0013X\u000e#\u0017W;\u0015\n\f;\u0004\u00056]BH\u0003k_W#kIW&\u001a\u0019\n \u0000W'\u001bX\u001a)\u0002\u001e \u0000\u001d\u001al\u0003\u0018!T\u0010\t>\u0001\u00002\u0006\u001dF\u0014\u0005\u000b\u00012\u0018\u0011\fl=:\u001fT+\u000b$\u0000\u001a2T_+eE/\u001e8X;/\r\u0012>\u0015\u000bH*\n\u0002=\u0010X\u001f%\u0011\u001fs\u0000\u0019\u001a+\u0000\u0003s\u001a\u0019\u0005)\u0016\u00072\u0017\u001dHk\u0016\t\u0017\u0005<\u0006X\u0004#\u0004\u0013:\u001a\u001fH?\u0006\u001f6\u0019\u0019Hk'\t\u0017\u0005<\u0006X\u001a)\u0002\u001e \u0000\u001d\u001a%\u000b\u0010s\u0007\u001b\u0000)\b\u0016 T\u001e\u0007>E\u001f2\u0006\u001c\u001f-\u0017\u0012}#kE_$\u001c\u001d\u0006l\u0017\u00124\u001d\u000b\u001c)\u0017\u001e=\u0013X\u000e#\u0017W;\u0015\n\f;\u0004\u00056]BH\u0016\t\u0017\u0005<\u0006X\u0004#\u0004\u0013:\u001a\u001fH?\u0006\u001f6\u0019\u0019Hk\u000bkE\u00164\u0015\u0011\u0006?\u0011Wt\u001ekE\u0003<T\r\u0018(\u0004\u00036T\u001c\r<\u0000\u00197\u0011\u0016\u000b5E\u00142\u0017\u0010\rvE\u0003k_W#kIW&\u001a\u0019\n \u0000W'\u001bX\u001a)\u0002\u001e \u0000\u001d\u001al\u0003\u0018!T\u0010\t>\u0001\u00002\u0006\u001dF1\t\u0017\u0005<\u0006X\u0004#\u0004\u0013:\u001a\u001fH?\u0006\u001f6\u0019\u0019\u001bl\u0011\u0018s\u0001\b\f-\u0011\u0012s\u0010\u001d\u0018)\u000b\u00136\u001a\u001b\u0011l\u0006\u00160\u001c\u001dF \t\u0017\u0005<\u0006X\u001a)\u0016\u0018?\u0002\u0011\u0006+E\u00136\u0004\u001d\u0006(\u0000\u00190\rX=\u001e,Wt\u001f?\u0006\u001f6\u0019\u0019F$\u0004\u00057\u0003\u0019\u001a)1\u0016!\u0013\u001d\u001c\u0002\u0004\u001a6\u0007\b\t/\u0000\u0004\u000bkE\u00164\u0015\u0011\u0006?\u0011Wt\ndZ\u001az(\u000b\u0013}I\n\u0014\u0005\u000b\u00012\u0018\u0011\fl=:\u001fT+\u000b$\u0000\u001a2T_)d7\u0012z\u0006\u001d\u000f%\u0016\u00036\u0006\u0011\u0006+E/\u001e8X;/\r\u0012>\u0015\u000bH*\n\u0005s\u001c\u0019\u001a(\u0012\u0016!\u0011V\u001ekE\u0003<T\r\u0018(\u0004\u00036T\u001c\r<\u0000\u00197\u0011\u0016\u000b5E\u00142\u0017\u0010\rvE".length();
                var1_4 = 32;
                var0_5 = -1;
lbl7:
                // 2 sources

                while (true) {
                    v0 = 63;
                    v1 = ++var0_5;
                    v2 = var2_2.substring(v1, v1 + var1_4);
                    v3 = -1;
                    break block9;
                    break;
                }
lbl13:
                // 1 sources

                while (true) {
                    var5[var3_1++] = SchemaResourceManager.a(v0, SchemaResourceManager.b(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "5$/\u0013)<0\u001dqk, \u001c\u000fG\u0013/4\u001d<\"G.#(X7,\u0012.(|\u000f87\u000f`8=\n6&\u0013`\"=\u001540\u0017!/9Xv";
                    var4_3 = "5$/\u0013)<0\u001dqk, \u001c\u000fG\u0013/4\u001d<\"G.#(X7,\u0012.(|\u000f87\u000f`8=\n6&\u0013`\"=\u001540\u0017!/9Xv".length();
                    var1_4 = 10;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 11;
                        v4 = ++var0_5;
                        v2 = var2_2.substring(v4, v4 + var1_4);
                        v3 = 0;
                        break block9;
                        break;
                    }
                    break;
                }
lbl28:
                // 1 sources

                while (true) {
                    var5[var3_1++] = SchemaResourceManager.a(v0, SchemaResourceManager.b(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    break block10;
                    break;
                }
            }
            switch (v3) {
                default: {
                    ** continue;
                }
                ** case 0:
lbl39:
                // 1 sources

                ** continue;
            }
        }
        SchemaResourceManager.l = var5;
        SchemaResourceManager.a = Logger.getLogger(SchemaResourceManager.class.getName());
    }

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

    private static char[] b(String string) {
        char[] cArray = string.toCharArray();
        if (cArray.length < 2) {
            cArray = cArray;
            cArray[0] = (char)(cArray[0] ^ 0x57);
        }
        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 -> 115;
                    case 1 -> 90;
                    case 2 -> 72;
                    case 3 -> 108;
                    case 4 -> 75;
                    case 5 -> 71;
                    default -> 87;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }

    private static final class SchemaResource
    extends Triple<String, String, String> {
        static final long serialVersionUID = 7523781160212339989L;

        private SchemaResource(String string, String string2, String string3) {
            super((Object)string, (Object)string2, (Object)string3);
        }

        public String getUri() {
            return (String)this.left;
        }

        public String getTargetNamespaceForRegistration() {
            return this.middle == null ? "" : (String)this.middle;
        }

        public String getContent() {
            return (String)this.right;
        }
    }
}

