package defpackage;

import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;

/* JADX INFO: renamed from: ᵫʿʤ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C3951 extends AbstractC1676 {

    /* JADX INFO: renamed from: ᵯᵷʽ, reason: contains not printable characters */
    public static final C0599 f15080;

    /* JADX INFO: renamed from: ᵜᵪʾ, reason: contains not printable characters */
    public final ClassLoader f15082;

    /* JADX INFO: renamed from: ᵔᵖᵹᵫ, reason: contains not printable characters */
    public final AbstractC1676 f15081 = AbstractC1676.f6615;

    /* JADX INFO: renamed from: ᵨᵼⁱ, reason: contains not printable characters */
    public final C5127 f15083 = new C5127(new ᵬᵶᵫ(11, this));

    static {
        String str = C0599.f2912;
        f15080 = ˑᵤʽˏ.ᵱᵽʡᵚ("/");
    }

    public C3951(ClassLoader classLoader) {
        this.f15082 = classLoader;
    }

    @Override // defpackage.AbstractC1676
    /* JADX INFO: renamed from: ᵲᵶᵳˈ */
    public final C4034 mo3504(C0599 c0599) throws FileNotFoundException {
        C0599 c05992 = c0599;
        if (!C5314.m10898(c05992)) {
            C4935.m10234(c05992, "file not found: ");
            return null;
        }
        C0599 c05993 = f15080;
        c05993.getClass();
        C0599 c0599M5321 = AbstractC1970.m5321(c05993, c05992, true);
        C1054 c1054 = c0599M5321.f2913;
        C1054 c10542 = c05993.f2913;
        int iM5324 = AbstractC1970.m5324(c0599M5321);
        C0599 c05994 = iM5324 == -1 ? null : new C0599(c1054.mo3457(0, iM5324));
        int iM53242 = AbstractC1970.m5324(c05993);
        if (!ᵥˈᵛ.ˊᵫᵗ(c05994, iM53242 == -1 ? null : new C0599(c10542.mo3457(0, iM53242)))) {
            throw new IllegalArgumentException(("Paths of different roots cannot be relative to each other: " + c0599M5321 + " and " + c05993).toString());
        }
        ArrayList arrayListM2226 = c0599M5321.m2226();
        ArrayList arrayListM22262 = c05993.m2226();
        int iMin = Math.min(arrayListM2226.size(), arrayListM22262.size());
        int i = 0;
        while (i < iMin && ᵥˈᵛ.ˊᵫᵗ(arrayListM2226.get(i), arrayListM22262.get(i))) {
            i++;
        }
        if (i == iMin && c1054.mo3458() == c10542.mo3458()) {
            String str = C0599.f2912;
            c0599M5321 = ˑᵤʽˏ.ᵱᵽʡᵚ(".");
        } else {
            if (arrayListM22262.subList(i, arrayListM22262.size()).indexOf(AbstractC1970.f7824) != -1) {
                throw new IllegalArgumentException(("Impossible relative path to resolve: " + c0599M5321 + " and " + c05993).toString());
            }
            if (!ᵥˈᵛ.ˊᵫᵗ(c10542, AbstractC1970.f7826)) {
                C4903 c4903 = new C4903();
                C1054 c1054M5322 = AbstractC1970.m5322(c05993);
                if (c1054M5322 == null && (c1054M5322 = AbstractC1970.m5322(c0599M5321)) == null) {
                    c1054M5322 = AbstractC1970.m5326(C0599.f2912);
                }
                int size = arrayListM22262.size();
                for (int i2 = i; i2 < size; i2++) {
                    c4903.m10208(AbstractC1970.f7824);
                    c4903.m10208(c1054M5322);
                }
                int size2 = arrayListM2226.size();
                while (i < size2) {
                    c4903.m10208((C1054) arrayListM2226.get(i));
                    c4903.m10208(c1054M5322);
                    i++;
                }
                c0599M5321 = AbstractC1970.m5325(c4903, false);
            }
        }
        String strM3463 = c0599M5321.f2913.m3463();
        for (C1081 c1081 : (List) this.f15083.getValue()) {
            try {
                return ((AbstractC1676) c1081.f4615).mo3504(((C0599) c1081.f4616).m2224(strM3463));
            } catch (FileNotFoundException unused) {
            }
        }
        C4935.m10234(c05992, "file not found: ");
        return null;
    }
}
