/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  com.l7tech.common.protocol.SecureSpanConstants
 *  com.l7tech.common.protocol.SecureSpanConstants$HttpHeaders
 *  com.l7tech.gateway.common.audit.AuditDetailMessage
 *  com.l7tech.gateway.common.audit.AuditFactory
 *  com.l7tech.gateway.common.audit.MessageProcessingMessages
 *  com.l7tech.gateway.common.service.PublishedService
 *  com.l7tech.gateway.common.transport.ResolutionConfiguration
 *  com.l7tech.message.HttpRequestKnob
 *  com.l7tech.message.Message
 *  com.l7tech.message.UriKnob
 *  com.l7tech.objectmodel.Goid
 *  com.l7tech.util.ConfigFactory
 *  com.l7tech.util.ConfigFactory$ConfigurationListener
 *  com.l7tech.util.ExceptionUtils
 */
package com.l7tech.server.service.resolution;

import com.l7tech.common.protocol.SecureSpanConstants;
import com.l7tech.gateway.common.audit.AuditDetailMessage;
import com.l7tech.gateway.common.audit.AuditFactory;
import com.l7tech.gateway.common.audit.MessageProcessingMessages;
import com.l7tech.gateway.common.service.PublishedService;
import com.l7tech.gateway.common.transport.ResolutionConfiguration;
import com.l7tech.message.HttpRequestKnob;
import com.l7tech.message.Message;
import com.l7tech.message.UriKnob;
import com.l7tech.objectmodel.Goid;
import com.l7tech.server.service.resolution.Result;
import com.l7tech.server.service.resolution.ServiceResolutionException;
import com.l7tech.server.service.resolution.ServiceResolver;
import com.l7tech.server.service.resolution.TrieBasedResolver;
import com.l7tech.server.service.resolution.i;
import com.l7tech.util.ConfigFactory;
import com.l7tech.util.ExceptionUtils;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLDecoder;
import java.text.MessageFormat;
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.Objects;
import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.logging.Level;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

public class UriResolver
extends ServiceResolver<String> {
    protected static final String SUFFIX_EXACT_ONLY;
    protected final String PROP_EXACT_ONLY;
    private final boolean b;
    private final ArrayList<String> c;
    private final Map<URIResolutionParam, List<Goid>> d;
    private final Map<Goid, URIResolutionParam> e;
    private final Executor f;
    private TrieBasedResolver g;
    private final ReadWriteLock h;
    private static final URIResolutionParam i;
    private final AtomicBoolean j;
    private final AtomicBoolean k;
    private static final String[] m;

    public UriResolver(AuditFactory auditFactory) {
        this(auditFactory, true);
    }

    protected UriResolver(AuditFactory auditFactory, boolean bl2) {
        super(auditFactory);
        this.PROP_EXACT_ONLY = this.PROP_BASE + m[5];
        this.c = new ArrayList();
        this.d = new HashMap<URIResolutionParam, List<Goid>>();
        this.e = new HashMap<Goid, URIResolutionParam>();
        this.f = Executors.newSingleThreadExecutor();
        this.h = new ReentrantReadWriteLock(false);
        this.j = new AtomicBoolean(true);
        this.k = new AtomicBoolean(true);
        this.b = bl2;
        this.a();
        this.g = this.b();
    }

    @Override
    public void configure(ResolutionConfiguration resolutionConfiguration) {
        super.configure(resolutionConfiguration);
        this.j.set(resolutionConfiguration.isPathCaseSensitive());
        this.k.set(resolutionConfiguration.isUseL7OriginalUrl());
    }

    @Override
    public boolean usesMessageContent() {
        return false;
    }

    private void a() {
        ConfigFactory.addListener((ConfigFactory.ConfigurationListener)new i(this), (String[])new String[0]);
    }

    private Result a(String string, Collection<PublishedService> collection, boolean bl2) {
        ArrayList<URIResolutionParam> arrayList;
        boolean bl3;
        boolean bl4;
        List<Goid> list;
        block38: {
            block39: {
                block36: {
                    block37: {
                        Set<URIResolutionParam> set;
                        block32: {
                            block33: {
                                list = this.d.get(new URIResolutionParam(string));
                                try {
                                    try {
                                        try {
                                            if (list == null || list.size() <= 0) break block32;
                                        }
                                        catch (RuntimeException runtimeException) {
                                            throw UriResolver.a(runtimeException);
                                        }
                                        if (this.auditor == null) break block33;
                                    }
                                    catch (RuntimeException runtimeException) {
                                        throw UriResolver.a(runtimeException);
                                    }
                                    this.auditor.logAndAudit((AuditDetailMessage)MessageProcessingMessages.SR_HTTPURI_PERFECT, new String[]{string});
                                }
                                catch (RuntimeException runtimeException) {
                                    throw UriResolver.a(runtimeException);
                                }
                            }
                            set = this.b(collection, list);
                            try {
                                if (set.size() > 0) {
                                    return new Result(set);
                                }
                            }
                            catch (RuntimeException runtimeException) {
                                throw UriResolver.a(runtimeException);
                            }
                        }
                        try {
                            if (bl2) {
                                return Result.NO_MATCH;
                            }
                        }
                        catch (RuntimeException runtimeException) {
                            throw UriResolver.a(runtimeException);
                        }
                        set = this.b(string);
                        bl4 = false;
                        bl3 = false;
                        arrayList = new ArrayList<URIResolutionParam>();
                        for (URIResolutionParam uRIResolutionParam : set) {
                            block40: {
                                block35: {
                                    try {
                                        block34: {
                                            try {
                                                try {
                                                    try {
                                                        if (!uRIResolutionParam.c || !this.a(collection, this.d.get(uRIResolutionParam))) continue;
                                                    }
                                                    catch (RuntimeException runtimeException) {
                                                        throw UriResolver.a(runtimeException);
                                                    }
                                                    if (uRIResolutionParam.d) break block34;
                                                }
                                                catch (RuntimeException runtimeException) {
                                                    throw UriResolver.a(runtimeException);
                                                }
                                                if (!((Pattern)uRIResolutionParam.b).matcher(string).matches()) continue;
                                            }
                                            catch (RuntimeException runtimeException) {
                                                throw UriResolver.a(runtimeException);
                                            }
                                        }
                                        if (!uRIResolutionParam.e) break block35;
                                    }
                                    catch (RuntimeException runtimeException) {
                                        throw UriResolver.a(runtimeException);
                                    }
                                    bl4 = true;
                                    break block40;
                                }
                                bl3 = true;
                            }
                            arrayList.add(uRIResolutionParam);
                        }
                        try {
                            try {
                                if (arrayList.size() > 0) break block36;
                                if (this.auditor == null) break block37;
                            }
                            catch (RuntimeException runtimeException) {
                                throw UriResolver.a(runtimeException);
                            }
                            this.auditor.logAndAudit((AuditDetailMessage)MessageProcessingMessages.SR_HTTPURI_WILD_NONE, new String[]{string});
                        }
                        catch (RuntimeException runtimeException) {
                            throw UriResolver.a(runtimeException);
                        }
                    }
                    return Result.NO_MATCH;
                }
                try {
                    try {
                        if (arrayList.size() != 1) break block38;
                        if (this.auditor == null) break block39;
                    }
                    catch (RuntimeException runtimeException) {
                        throw UriResolver.a(runtimeException);
                    }
                    this.auditor.logAndAudit((AuditDetailMessage)MessageProcessingMessages.SR_HTTPURI_WILD_ONE, new String[]{string});
                }
                catch (RuntimeException runtimeException) {
                    throw UriResolver.a(runtimeException);
                }
            }
            list = this.d.get(arrayList.get(0));
            return new Result(this.b(collection, list));
        }
        try {
            if (this.auditor != null) {
                this.auditor.logAndAudit((AuditDetailMessage)MessageProcessingMessages.SR_HTTPURI_WILD_MULTI, new String[]{string});
            }
        }
        catch (RuntimeException runtimeException) {
            throw UriResolver.a(runtimeException);
        }
        URIResolutionParam uRIResolutionParam = UriResolver.a(arrayList, bl4, bl3);
        list = this.d.get(uRIResolutionParam);
        return new Result(this.b(collection, list));
    }

    @Override
    public void populateResolutionParameters(Message message, Map<String, Object> map) throws ServiceResolutionException {
        if (this.appliesToMessage(message)) {
            String string = this.a(message);
            map.put(this.PROP_VALUE, string);
        }
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     * Loose catch block
     */
    @Override
    public Result resolve(Map<String, Object> map, Collection<PublishedService> collection) throws ServiceResolutionException {
        try {
            if (this.b != this.j.get()) {
                return Result.NOT_APPLICABLE;
            }
        }
        catch (ServiceResolutionException serviceResolutionException) {
            throw UriResolver.a(serviceResolutionException);
        }
        try {
            if (!map.containsKey(this.PROP_VALUE)) {
                return Result.NOT_APPLICABLE;
            }
        }
        catch (ServiceResolutionException serviceResolutionException) {
            throw UriResolver.a(serviceResolutionException);
        }
        String string = this.a((String)map.get(this.PROP_VALUE));
        boolean bl2 = Boolean.TRUE.equals(map.get(this.PROP_EXACT_ONLY));
        this.h.readLock().lock();
        try {
            Result result;
            block15: {
                if (this.c.contains(string)) {
                    this.auditor.logAndAudit((AuditDetailMessage)MessageProcessingMessages.SR_HTTPURI_CACHEDFAIL, new String[]{string});
                    Result result2 = Result.NO_MATCH;
                    return result2;
                }
                result = this.a(string, collection, bl2);
                if (result != Result.NO_MATCH) break block15;
                try {
                    block16: {
                        if (bl2) break block15;
                        break block16;
                        catch (ServiceResolutionException serviceResolutionException) {
                            throw UriResolver.a(serviceResolutionException);
                        }
                    }
                    this.c.add(string);
                }
                catch (ServiceResolutionException serviceResolutionException) {
                    throw UriResolver.a(serviceResolutionException);
                }
            }
            Result result3 = result;
            return result3;
        }
        finally {
            this.h.readLock().unlock();
        }
    }

    private String a(String string) {
        String string2;
        block4: {
            string2 = string;
            try {
                String[] stringArray = m;
                string2 = URLDecoder.decode(string, stringArray[1]);
            }
            catch (UnsupportedEncodingException unsupportedEncodingException) {
                throw new RuntimeException(m[4]);
            }
            try {
                if (this.b || string == null) break block4;
            }
            catch (UnsupportedEncodingException unsupportedEncodingException) {
                throw UriResolver.a(unsupportedEncodingException);
            }
            string2 = string.toLowerCase();
        }
        return string2;
    }

    private boolean a(Collection<PublishedService> collection, List<Goid> list) {
        try {
            if (this.serviceResolutionHelper != null) {
                return this.serviceResolutionHelper.anyMatch(list);
            }
        }
        catch (RuntimeException runtimeException) {
            throw UriResolver.a(runtimeException);
        }
        for (PublishedService publishedService : collection) {
            try {
                if (!list.contains(publishedService.getGoid())) continue;
                return true;
            }
            catch (RuntimeException runtimeException) {
                throw UriResolver.a(runtimeException);
            }
        }
        return false;
    }

    private Set<PublishedService> b(Collection<PublishedService> collection, List<Goid> list) {
        try {
            if (this.serviceResolutionHelper != null) {
                return this.serviceResolutionHelper.narrowList(list);
            }
        }
        catch (RuntimeException runtimeException) {
            throw UriResolver.a(runtimeException);
        }
        HashSet<PublishedService> hashSet = new HashSet<PublishedService>();
        for (PublishedService publishedService : collection) {
            try {
                if (!list.contains(publishedService.getGoid())) continue;
                hashSet.add(publishedService);
            }
            catch (RuntimeException runtimeException) {
                throw UriResolver.a(runtimeException);
            }
        }
        return hashSet;
    }

    @Override
    public void serviceDeleted(PublishedService publishedService) {
        this.h.writeLock().lock();
        try {
            this.a(publishedService);
        }
        finally {
            this.h.writeLock().unlock();
        }
    }

    @Override
    public void serviceUpdated(PublishedService publishedService) throws ServiceResolutionException {
        this.h.writeLock().lock();
        try {
            this.serviceDeleted(publishedService);
            this.serviceCreated(publishedService);
        }
        finally {
            this.h.writeLock().unlock();
        }
    }

    @Override
    protected List<String> buildTargetValues(PublishedService publishedService) {
        String string = publishedService.getRoutingUri();
        if (string == null) {
            string = "";
        }
        return Collections.singletonList(this.a(string));
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     */
    @Override
    protected void updateServiceValues(PublishedService publishedService, List<String> list) {
        this.h.writeLock().lock();
        try {
            for (String string : list) {
                this.a(publishedService, string);
            }
            this.c.clear();
        }
        finally {
            this.h.writeLock().unlock();
        }
    }

    private Set<URIResolutionParam> b(String string) {
        List<Goid> list = this.g.search(string);
        try {
            if (list == null) {
                return this.d.keySet();
            }
        }
        catch (RuntimeException runtimeException) {
            throw UriResolver.a(runtimeException);
        }
        try {
            if (list.isEmpty()) {
                return Collections.emptySet();
            }
        }
        catch (RuntimeException runtimeException) {
            throw UriResolver.a(runtimeException);
        }
        return list.stream().map(this.e::get).filter(Objects::nonNull).collect(Collectors.toSet());
    }

    private TrieBasedResolver b() {
        boolean bl2 = TrieBasedResolver.isResolverEnabled();
        boolean bl3 = TrieBasedResolver.useInStrictMode();
        try {
            if (bl2) {
                this.logger.log(Level.INFO, m[9], new Object[]{this.b, bl3});
                return new TrieBasedResolver(bl3);
            }
        }
        catch (RuntimeException runtimeException) {
            throw UriResolver.a(runtimeException);
        }
        return TrieBasedResolver.NOOP_RESOLVER;
    }

    private void a(TrieBasedResolver trieBasedResolver) {
        this.g = trieBasedResolver;
    }

    private void c() {
        TrieBasedResolver trieBasedResolver = this.b();
        try {
            if (trieBasedResolver == TrieBasedResolver.NOOP_RESOLVER) {
                this.logger.log(Level.INFO, m[0], this.b);
                this.a(trieBasedResolver);
                return;
            }
        }
        catch (RuntimeException runtimeException) {
            throw UriResolver.a(runtimeException);
        }
        this.f.execute(() -> {
            try {
                this.b(trieBasedResolver);
                this.a(trieBasedResolver);
                String[] stringArray = m;
                this.logger.log(Level.INFO, stringArray[2], this.b);
            }
            catch (Exception exception) {
                this.logger.log(Level.WARNING, m[6], new Object[]{this.b, ExceptionUtils.getMessageWithCause((Throwable)exception)});
            }
        });
    }

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     * Enabled force condition propagation
     * Lifted jumps to return sites
     */
    private void b(TrieBasedResolver trieBasedResolver) {
        this.h.writeLock().lock();
        try {
            Collection<PublishedService> collection = this.serviceResolutionHelper.allServices();
            for (PublishedService publishedService : collection) {
                String string = publishedService.getRoutingUri();
                if (string == null) continue;
                URIResolutionParam uRIResolutionParam = new URIResolutionParam(this.a(string));
                try {
                    if (!uRIResolutionParam.c) continue;
                    trieBasedResolver.insert(uRIResolutionParam.a, publishedService.getGoid());
                }
                catch (RuntimeException runtimeException) {
                    throw UriResolver.a(runtimeException);
                    return;
                }
            }
        }
        finally {
            this.h.writeLock().unlock();
        }
    }

    private void a(PublishedService publishedService, String string) {
        URIResolutionParam uRIResolutionParam = new URIResolutionParam(string);
        List<Goid> list = this.d.get(uRIResolutionParam);
        if (list == null) {
            list = new ArrayList<Goid>();
            this.d.put(uRIResolutionParam, list);
        }
        try {
            list.add(publishedService.getGoid());
            this.e.put(publishedService.getGoid(), uRIResolutionParam);
            if (uRIResolutionParam.c) {
                this.g.insert(uRIResolutionParam.a, publishedService.getGoid());
            }
        }
        catch (RuntimeException runtimeException) {
            throw UriResolver.a(runtimeException);
        }
    }

    private void a(PublishedService publishedService) {
        URIResolutionParam uRIResolutionParam = this.e.get(publishedService.getGoid());
        try {
            if (uRIResolutionParam == null) {
                return;
            }
        }
        catch (RuntimeException runtimeException) {
            throw UriResolver.a(runtimeException);
        }
        List<Goid> list = this.d.get(uRIResolutionParam);
        try {
            list.remove(publishedService.getGoid());
            this.e.remove(publishedService.getGoid());
            if (uRIResolutionParam.c) {
                this.g.delete(uRIResolutionParam.a, publishedService.getGoid());
            }
        }
        catch (RuntimeException runtimeException) {
            throw UriResolver.a(runtimeException);
        }
    }

    private static URIResolutionParam a(List<URIResolutionParam> list, boolean bl2, boolean bl3) {
        block12: {
            try {
                list.remove(i);
                if (list.size() == 1) {
                    return list.get(0);
                }
            }
            catch (RuntimeException runtimeException) {
                throw UriResolver.a(runtimeException);
            }
            try {
                if (!bl2 || !bl3) break block12;
            }
            catch (RuntimeException runtimeException) {
                throw UriResolver.a(runtimeException);
            }
            Iterator<URIResolutionParam> iterator = list.iterator();
            while (iterator.hasNext()) {
                URIResolutionParam uRIResolutionParam = iterator.next();
                try {
                    if (uRIResolutionParam.e) continue;
                    iterator.remove();
                }
                catch (RuntimeException runtimeException) {
                    throw UriResolver.a(runtimeException);
                }
            }
        }
        try {
            if (list.size() == 1) {
                return list.get(0);
            }
        }
        catch (RuntimeException runtimeException) {
            throw UriResolver.a(runtimeException);
        }
        long l2 = 0L;
        URIResolutionParam uRIResolutionParam = null;
        for (URIResolutionParam uRIResolutionParam2 : list) {
            if ((long)uRIResolutionParam2.a.length() <= l2) continue;
            uRIResolutionParam = uRIResolutionParam2;
            l2 = uRIResolutionParam2.a.length();
        }
        return uRIResolutionParam;
    }

    /*
     * Loose catch block
     */
    private String a(Message message) throws ServiceResolutionException {
        String string;
        block18: {
            block14: {
                String string2;
                block16: {
                    String string3;
                    block15: {
                        UriKnob uriKnob = (UriKnob)message.getKnob(UriKnob.class);
                        try {
                            if (uriKnob == null) {
                                throw new ServiceResolutionException(m[10]);
                            }
                        }
                        catch (MalformedURLException malformedURLException) {
                            throw UriResolver.a(malformedURLException);
                        }
                        string = uriKnob.getRequestUri();
                        HttpRequestKnob httpRequestKnob = (HttpRequestKnob)message.getKnob(HttpRequestKnob.class);
                        if (httpRequestKnob == null) break block14;
                        try {
                            block19: {
                                if (!this.k.get()) break block15;
                                break block19;
                                catch (MalformedURLException malformedURLException) {
                                    throw UriResolver.a(malformedURLException);
                                }
                            }
                            string3 = httpRequestKnob.getHeaderFirstValue(SecureSpanConstants.HttpHeaders.ORIGINAL_URL);
                            break block16;
                        }
                        catch (MalformedURLException malformedURLException) {
                            throw UriResolver.a(malformedURLException);
                        }
                    }
                    string3 = string2 = null;
                }
                if (string2 != null) {
                    try {
                        block17: {
                            URL uRL = new URL(string2);
                            string = uRL.getFile();
                            try {
                                if (!string.startsWith(SecureSpanConstants.SSG_RESERVEDURI_PREFIX) && !string.equals("/")) break block17;
                            }
                            catch (MalformedURLException malformedURLException) {
                                throw UriResolver.a(malformedURLException);
                            }
                            string = "";
                        }
                        this.auditor.logAndAudit((AuditDetailMessage)MessageProcessingMessages.SR_HTTPURI_URI_FROM_HEADER, new String[]{string});
                        return string;
                    }
                    catch (MalformedURLException malformedURLException) {
                        String string4 = MessageFormat.format(m[8], string2);
                        this.logger.log(Level.WARNING, string4, malformedURLException);
                        throw new ServiceResolutionException(string4);
                    }
                }
            }
            try {
                if (string != null && !string.startsWith(SecureSpanConstants.SSG_RESERVEDURI_PREFIX)) break block18;
            }
            catch (MalformedURLException malformedURLException) {
                throw UriResolver.a(malformedURLException);
            }
            string = "";
        }
        this.auditor.logAndAudit((AuditDetailMessage)MessageProcessingMessages.SR_HTTPURI_REAL_URI, new String[]{string});
        return string;
    }

    public boolean appliesToMessage(Message message) {
        return UriResolver.canResolveByURI(message);
    }

    public static boolean canResolveByURI(Message message) {
        boolean bl2;
        try {
            bl2 = message.getKnob(UriKnob.class) != null;
        }
        catch (RuntimeException runtimeException) {
            throw UriResolver.a(runtimeException);
        }
        return bl2;
    }

    /*
     * Unable to fully structure code
     */
    static {
        block10: {
            block9: {
                var5 = new String[11];
                var3_1 = 0;
                var2_2 = "c[8e\u007f2\\FJ<b+/BB\u001e?gx/\nPW5bh:XC\u001e\fTB{XBM6j}>X\u0007\u0016:gx>\u0007T[7ub/CQ[d};&\u0003\u0005rj\u001f+3Ju[?tn(BBZyrc>\nA_*r+,CKZ:gy?\nrl\u0010&y>YHR/cy{\u0002D_*c&(OIM0rb-O\u001aEi{\"{YR]:cx(LRR5\u007f\u0002\b\u0014\u0017sV0u+(BHK5b+5ES\u001e1g{+OI\u001f\n\t[!gh/eIR ^bL+iy{OI]6se/OU[=&b5\nU[?tn(BNP>&\u007f3O\u0007X8u\u007f{]NR=ej)N\u0007k\u000bO+)OTQ5pn)\n\u000f]8unvYBP*o\u007f2\\B\u0003\"6vr\u0006\u0007]8sx>\u0017\\\u000e$\n\t[!gh/eIR &nP/gg2N\u0007rn+D)C@W7ggv\u007furypj7_B\u0004y!, \u001aZ\u0019~";
                var4_3 = "c[8e\u007f2\\FJ<b+/BB\u001e?gx/\nPW5bh:XC\u001e\fTB{XBM6j}>X\u0007\u0016:gx>\u0007T[7ub/CQ[d};&\u0003\u0005rj\u001f+3Ju[?tn(BBZyrc>\nA_*r+,CKZ:gy?\nrl\u0010&y>YHR/cy{\u0002D_*c&(OIM0rb-O\u001aEi{\"{YR]:cx(LRR5\u007f\u0002\b\u0014\u0017sV0u+(BHK5b+5ES\u001e1g{+OI\u001f\n\t[!gh/eIR ^bL+iy{OI]6se/OU[=&b5\nU[?tn(BNP>&\u007f3O\u0007X8u\u007f{]NR=ej)N\u0007k\u000bO+)OTQ5pn)\n\u000f]8unvYBP*o\u007f2\\B\u0003\"6vr\u0006\u0007]8sx>\u0017\\\u000e$\n\t[!gh/eIR &nP/gg2N\u0007rn+D)C@W7ggv\u007furypj7_B\u0004y!, \u001aZ\u0019~".length();
                var1_4 = 63;
                var0_5 = -1;
lbl7:
                // 2 sources

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

                while (true) {
                    var5[var3_1++] = UriResolver.b(v0, UriResolver.d(v2));
                    if ((var0_5 += var1_4) < var4_3) {
                        var1_4 = var2_2.charAt(var0_5);
                        ** continue;
                    }
                    var2_2 = "3\u001bk0(e\u0013\u0017Ioq:m\u000e\u0004Iy80h\u001e\u0011\u001bjq\t^4P\u001bk\"3`\u000b\u0015\u001b.y?m\u000e\u0015D}42\u007f\u0014\u0004\u0000x4awM\rE.\"(~\u0014\u0013\u001d#<3h\u0018M\u0012?,u\u001d%\u0007o30i]\u0004\u0006.0?o\u0018\u0003\u001a.#9}\b\u0015\u001azq\t^4^";
                    var4_3 = "3\u001bk0(e\u0013\u0017Ioq:m\u000e\u0004Iy80h\u001e\u0011\u001bjq\t^4P\u001bk\"3`\u000b\u0015\u001b.y?m\u000e\u0015D}42\u007f\u0014\u0004\u0000x4awM\rE.\"(~\u0014\u0013\u001d#<3h\u0018M\u0012?,u\u001d%\u0007o30i]\u0004\u0006.0?o\u0018\u0003\u001a.#9}\b\u0015\u001azq\t^4^".length();
                    var1_4 = 75;
                    var0_5 = -1;
lbl22:
                    // 2 sources

                    while (true) {
                        v0 = 38;
                        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++] = UriResolver.b(v0, UriResolver.d(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;
            }
        }
        UriResolver.m = var5;
        UriResolver.SUFFIX_EXACT_ONLY = UriResolver.m[7];
        UriResolver.i = new URIResolutionParam(UriResolver.m[3]);
    }

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

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

    /*
     * Handled impossible loop by duplicating code
     * Enabled aggressive block sorting
     */
    private static String b(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 -> 86;
                    case 1 -> 79;
                    case 2 -> 40;
                    case 3 -> 119;
                    case 4 -> 122;
                    case 5 -> 42;
                    default -> 91;
                })));
                ++n3;
                n4 = n4;
            } while (n4 > n3);
        }
        return new String(cArray2).intern();
    }

    public static class URIResolutionParam {
        final String a;
        final Object b;
        final boolean c;
        final boolean d;
        final boolean e;
        private static final String[] f;

        public URIResolutionParam(String string) {
            String[] stringArray;
            while (string.indexOf((stringArray = f)[0]) >= 0) {
                string = string.replace(stringArray[3], "*");
            }
            this.a = string;
            if (string.indexOf(42) > 0) {
                this.e = string.charAt(string.length() - 1) == '*';
                stringArray = f;
                String string2 = Pattern.quote(string).replace("*", stringArray[2]);
                this.b = Pattern.compile(string2);
                this.c = true;
                this.d = stringArray[1].equals(string);
            } else {
                this.b = string;
                this.c = false;
                this.d = false;
                this.e = true;
            }
        }

        public String toString() {
            return this.a;
        }

        public boolean equals(Object object) {
            if (this == object) {
                return true;
            }
            if (object instanceof String) {
                return object.equals(this.a);
            }
            if (object == null || this.getClass() != object.getClass()) {
                return false;
            }
            URIResolutionParam uRIResolutionParam = (URIResolutionParam)object;
            return !(this.a == null ? uRIResolutionParam.a != null : !this.a.equals(uRIResolutionParam.a));
        }

        public int hashCode() {
            return this.a.hashCode();
        }

        /*
         * Unable to fully structure code
         */
        static {
            block10: {
                block9: {
                    var5 = new String[4];
                    var3_1 = 0;
                    var2_2 = "9\u001f\u0002<\u001f";
                    var4_3 = "9\u001f\u0002<\u001f".length();
                    var1_4 = 2;
                    var0_5 = -1;
lbl7:
                    // 2 sources

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

                    while (true) {
                        var5[var3_1++] = URIResolutionParam.a(v0, URIResolutionParam.a(v2));
                        if ((var0_5 += var1_4) < var4_3) {
                            var1_4 = var2_2.charAt(var0_5);
                            ** continue;
                        }
                        var2_2 = "uJ=6\u00027\u0002\u0003%";
                        var4_3 = "uJ=6\u00027\u0002\u0003%".length();
                        var1_4 = 6;
                        var0_5 = -1;
lbl22:
                        // 2 sources

                        while (true) {
                            v0 = 2;
                            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++] = URIResolutionParam.a(v0, URIResolutionParam.a(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;
                }
            }
            URIResolutionParam.f = var5;
        }

        private static char[] a(String string) {
            char[] cArray = string.toCharArray();
            if (cArray.length < 2) {
                cArray = cArray;
                cArray[0] = (char)(cArray[0] ^ 0x73);
            }
            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 -> 43;
                        case 1 -> 13;
                        case 2 -> 17;
                        case 3 -> 30;
                        case 4 -> 92;
                        case 5 -> 100;
                        default -> 115;
                    })));
                    ++n3;
                    n4 = n4;
                } while (n4 > n3);
            }
            return new String(cArray2).intern();
        }
    }
}

