package o;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Map;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.zr, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C3135zr {
    public final /* synthetic */ int a = 0;
    public boolean b;
    public boolean c;
    public Object d;
    public Object e;
    public Serializable f;
    public Serializable g;
    public Object h;
    public Object i;

    public /* synthetic */ C3135zr() {
    }

    public void a(C0017Ar c0017Ar, int i, ArrayList arrayList, E30 e30) {
        AbstractC0745al0 abstractC0745al0 = c0017Ar.d;
        E30 e302 = abstractC0745al0.c;
        C0017Ar c0017Ar2 = abstractC0745al0.i;
        C0017Ar c0017Ar3 = abstractC0745al0.h;
        if (e302 == null) {
            C0556Vl c0556Vl = (C0556Vl) this.d;
            if (abstractC0745al0 == c0556Vl.d || abstractC0745al0 == c0556Vl.e) {
                return;
            }
            if (e30 == null) {
                e30 = new E30();
                e30.a = null;
                e30.b = new ArrayList();
                e30.a = abstractC0745al0;
                arrayList.add(e30);
            }
            abstractC0745al0.c = e30;
            e30.b.add(abstractC0745al0);
            ArrayList arrayList2 = c0017Ar3.k;
            int size = arrayList2.size();
            int i2 = 0;
            int i3 = 0;
            while (i3 < size) {
                Object obj = arrayList2.get(i3);
                i3++;
                InterfaceC2755vr interfaceC2755vr = (InterfaceC2755vr) obj;
                if (interfaceC2755vr instanceof C0017Ar) {
                    a((C0017Ar) interfaceC2755vr, i, arrayList, e30);
                }
            }
            ArrayList arrayList3 = c0017Ar2.k;
            int size2 = arrayList3.size();
            int i4 = 0;
            while (i4 < size2) {
                Object obj2 = arrayList3.get(i4);
                i4++;
                InterfaceC2755vr interfaceC2755vr2 = (InterfaceC2755vr) obj2;
                if (interfaceC2755vr2 instanceof C0017Ar) {
                    a((C0017Ar) interfaceC2755vr2, i, arrayList, e30);
                }
            }
            if (i == 1 && (abstractC0745al0 instanceof C3120zj0)) {
                ArrayList arrayList4 = ((C3120zj0) abstractC0745al0).k.k;
                int size3 = arrayList4.size();
                int i5 = 0;
                while (i5 < size3) {
                    Object obj3 = arrayList4.get(i5);
                    i5++;
                    InterfaceC2755vr interfaceC2755vr3 = (InterfaceC2755vr) obj3;
                    if (interfaceC2755vr3 instanceof C0017Ar) {
                        a((C0017Ar) interfaceC2755vr3, i, arrayList, e30);
                    }
                }
            }
            ArrayList arrayList5 = c0017Ar3.l;
            int size4 = arrayList5.size();
            int i6 = 0;
            while (i6 < size4) {
                Object obj4 = arrayList5.get(i6);
                i6++;
                a((C0017Ar) obj4, i, arrayList, e30);
            }
            ArrayList arrayList6 = c0017Ar2.l;
            int size5 = arrayList6.size();
            int i7 = 0;
            while (i7 < size5) {
                Object obj5 = arrayList6.get(i7);
                i7++;
                a((C0017Ar) obj5, i, arrayList, e30);
            }
            if (i == 1 && (abstractC0745al0 instanceof C3120zj0)) {
                ArrayList arrayList7 = ((C3120zj0) abstractC0745al0).k.l;
                int size6 = arrayList7.size();
                while (i2 < size6) {
                    Object obj6 = arrayList7.get(i2);
                    i2++;
                    a((C0017Ar) obj6, i, arrayList, e30);
                }
            }
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:68:0x00c9, code lost:
    
        if (r6 == 2) goto L69;
     */
    /* JADX WARN: Removed duplicated region for block: B:102:0x01ba  */
    /* JADX WARN: Removed duplicated region for block: B:134:0x029a  */
    /* JADX WARN: Removed duplicated region for block: B:136:0x02a1 A[ADDED_TO_REGION] */
    /* JADX WARN: Removed duplicated region for block: B:148:0x02e8  */
    /* JADX WARN: Removed duplicated region for block: B:152:0x0311  */
    /* JADX WARN: Removed duplicated region for block: B:155:0x0324  */
    /* JADX WARN: Removed duplicated region for block: B:156:0x0337  */
    /* JADX WARN: Removed duplicated region for block: B:63:0x00c2  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public void b(o.C0556Vl r25) {
        /*
            Method dump skipped, instructions count: 860
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C3135zr.b(o.Vl):void");
    }

    public void c() {
        C0556Vl c0556Vl = (C0556Vl) this.d;
        ArrayList arrayList = (ArrayList) this.g;
        ArrayList arrayList2 = (ArrayList) this.f;
        arrayList2.clear();
        C0556Vl c0556Vl2 = (C0556Vl) this.e;
        c0556Vl2.d.f();
        c0556Vl2.e.f();
        arrayList2.add(c0556Vl2.d);
        arrayList2.add(c0556Vl2.e);
        ArrayList arrayList3 = c0556Vl2.q0;
        int size = arrayList3.size();
        HashSet hashSet = null;
        int i = 0;
        while (i < size) {
            Object obj = arrayList3.get(i);
            i++;
            C0530Ul c0530Ul = (C0530Ul) obj;
            if (c0530Ul instanceof C2604uE) {
                C2699vE c2699vE = new C2699vE(c0530Ul);
                c0530Ul.d.f();
                c0530Ul.e.f();
                c2699vE.f = ((C2604uE) c0530Ul).u0;
                arrayList2.add(c2699vE);
            } else {
                if (c0530Ul.x()) {
                    if (c0530Ul.b == null) {
                        c0530Ul.b = new C0447Rg(c0530Ul, 0);
                    }
                    if (hashSet == null) {
                        hashSet = new HashSet();
                    }
                    hashSet.add(c0530Ul.b);
                } else {
                    arrayList2.add(c0530Ul.d);
                }
                if (c0530Ul.y()) {
                    if (c0530Ul.c == null) {
                        c0530Ul.c = new C0447Rg(c0530Ul, 1);
                    }
                    if (hashSet == null) {
                        hashSet = new HashSet();
                    }
                    hashSet.add(c0530Ul.c);
                } else {
                    arrayList2.add(c0530Ul.e);
                }
                if (c0530Ul instanceof AbstractC0701aF) {
                    arrayList2.add(new ZE(c0530Ul));
                }
            }
        }
        if (hashSet != null) {
            arrayList2.addAll(hashSet);
        }
        int size2 = arrayList2.size();
        int i2 = 0;
        while (i2 < size2) {
            Object obj2 = arrayList2.get(i2);
            i2++;
            ((AbstractC0745al0) obj2).f();
        }
        int size3 = arrayList2.size();
        int i3 = 0;
        while (i3 < size3) {
            Object obj3 = arrayList2.get(i3);
            i3++;
            AbstractC0745al0 abstractC0745al0 = (AbstractC0745al0) obj3;
            if (abstractC0745al0.b != c0556Vl2) {
                abstractC0745al0.d();
            }
        }
        arrayList.clear();
        e(c0556Vl.d, 0, arrayList);
        e(c0556Vl.e, 1, arrayList);
        this.b = false;
    }

    public int d(C0556Vl c0556Vl, int i) {
        ArrayList arrayList;
        int i2;
        long jMax;
        float f;
        C0556Vl c0556Vl2 = c0556Vl;
        ArrayList arrayList2 = (ArrayList) this.g;
        int size = arrayList2.size();
        long j = 0;
        int i3 = 0;
        long jMax2 = 0;
        while (i3 < size) {
            AbstractC0745al0 abstractC0745al0 = ((E30) arrayList2.get(i3)).a;
            if (!(abstractC0745al0 instanceof C0447Rg) ? !(i != 0 ? (abstractC0745al0 instanceof C3120zj0) : (abstractC0745al0 instanceof C1941nF)) : ((C0447Rg) abstractC0745al0).f != i) {
                C0017Ar c0017Ar = (i == 0 ? c0556Vl2.d : c0556Vl2.e).h;
                C0017Ar c0017Ar2 = (i == 0 ? c0556Vl2.d : c0556Vl2.e).i;
                C0017Ar c0017Ar3 = abstractC0745al0.h;
                C0017Ar c0017Ar4 = abstractC0745al0.i;
                boolean zContains = c0017Ar3.l.contains(c0017Ar);
                boolean zContains2 = c0017Ar4.l.contains(c0017Ar2);
                long j2 = abstractC0745al0.j();
                if (zContains && zContains2) {
                    long jB = E30.b(c0017Ar3, j);
                    long jA = E30.a(c0017Ar4, j);
                    long j3 = jB - j2;
                    int i4 = c0017Ar4.f;
                    arrayList = arrayList2;
                    i2 = size;
                    if (j3 >= (-i4)) {
                        j3 += i4;
                    }
                    long j4 = c0017Ar3.f;
                    long j5 = ((-jA) - j2) - j4;
                    if (j5 >= j4) {
                        j5 -= j4;
                    }
                    C0530Ul c0530Ul = abstractC0745al0.b;
                    if (i == 0) {
                        f = c0530Ul.d0;
                    } else if (i == 1) {
                        f = c0530Ul.e0;
                    } else {
                        c0530Ul.getClass();
                        f = -1.0f;
                    }
                    float f2 = f > 0.0f ? (long) ((j3 / (1.0f - f)) + (j5 / f)) : 0L;
                    jMax = (c0017Ar3.f + ((((long) ((f2 * f) + 0.5f)) + j2) + ((long) AbstractC2462sn.f(1.0f, f, f2, 0.5f)))) - c0017Ar4.f;
                } else {
                    arrayList = arrayList2;
                    i2 = size;
                    jMax = zContains ? Math.max(E30.b(c0017Ar3, c0017Ar3.f), c0017Ar3.f + j2) : zContains2 ? Math.max(-E30.a(c0017Ar4, c0017Ar4.f), (-c0017Ar4.f) + j2) : (abstractC0745al0.j() + c0017Ar3.f) - c0017Ar4.f;
                }
            } else {
                arrayList = arrayList2;
                i2 = size;
                jMax = j;
            }
            jMax2 = Math.max(jMax2, jMax);
            i3++;
            c0556Vl2 = c0556Vl;
            arrayList2 = arrayList;
            size = i2;
            j = 0;
        }
        return (int) jMax2;
    }

    public void e(AbstractC0745al0 abstractC0745al0, int i, ArrayList arrayList) {
        C0017Ar c0017Ar = abstractC0745al0.h;
        C0017Ar c0017Ar2 = abstractC0745al0.i;
        ArrayList arrayList2 = c0017Ar.k;
        int size = arrayList2.size();
        int i2 = 0;
        int i3 = 0;
        while (i3 < size) {
            Object obj = arrayList2.get(i3);
            i3++;
            InterfaceC2755vr interfaceC2755vr = (InterfaceC2755vr) obj;
            if (interfaceC2755vr instanceof C0017Ar) {
                a((C0017Ar) interfaceC2755vr, i, arrayList, null);
            } else if (interfaceC2755vr instanceof AbstractC0745al0) {
                a(((AbstractC0745al0) interfaceC2755vr).h, i, arrayList, null);
            }
        }
        ArrayList arrayList3 = c0017Ar2.k;
        int size2 = arrayList3.size();
        int i4 = 0;
        while (i4 < size2) {
            Object obj2 = arrayList3.get(i4);
            i4++;
            InterfaceC2755vr interfaceC2755vr2 = (InterfaceC2755vr) obj2;
            if (interfaceC2755vr2 instanceof C0017Ar) {
                a((C0017Ar) interfaceC2755vr2, i, arrayList, null);
            } else if (interfaceC2755vr2 instanceof AbstractC0745al0) {
                a(((AbstractC0745al0) interfaceC2755vr2).i, i, arrayList, null);
            }
        }
        if (i == 1) {
            ArrayList arrayList4 = ((C3120zj0) abstractC0745al0).k.k;
            int size3 = arrayList4.size();
            while (i2 < size3) {
                Object obj3 = arrayList4.get(i2);
                i2++;
                InterfaceC2755vr interfaceC2755vr3 = (InterfaceC2755vr) obj3;
                if (interfaceC2755vr3 instanceof C0017Ar) {
                    a((C0017Ar) interfaceC2755vr3, i, arrayList, null);
                }
            }
        }
    }

    public void f(int i, int i2, int i3, int i4, C0530Ul c0530Ul) {
        C1778ld c1778ld = (C1778ld) this.i;
        c1778ld.a = i;
        c1778ld.b = i3;
        c1778ld.c = i2;
        c1778ld.d = i4;
        ((C0167Gl) this.h).b(c0530Ul, c1778ld);
        c0530Ul.O(c1778ld.e);
        c0530Ul.L(c1778ld.f);
        c0530Ul.E = c1778ld.h;
        c0530Ul.I(c1778ld.g);
    }

    public void g() {
        C1398hd c1398hd;
        C3135zr c3135zr = this;
        ArrayList arrayList = ((C0556Vl) c3135zr.d).q0;
        int size = arrayList.size();
        int i = 0;
        while (i < size) {
            int i2 = i + 1;
            C0530Ul c0530Ul = (C0530Ul) arrayList.get(i);
            if (!c0530Ul.a) {
                int[] iArr = c0530Ul.p0;
                int i3 = iArr[0];
                int i4 = iArr[1];
                int i5 = c0530Ul.r;
                int i6 = c0530Ul.s;
                boolean z = i3 == 2 || (i3 == 3 && i5 == 1);
                boolean z2 = i4 == 2 || (i4 == 3 && i6 == 1);
                C0588Wr c0588Wr = c0530Ul.d.e;
                boolean z3 = c0588Wr.j;
                C0588Wr c0588Wr2 = c0530Ul.e.e;
                boolean z4 = c0588Wr2.j;
                boolean z5 = z;
                if (z3 && z4) {
                    c3135zr.f(1, c0588Wr.g, 1, c0588Wr2.g, c0530Ul);
                    c0530Ul.a = true;
                } else if (z3 && z2) {
                    f(1, c0588Wr.g, 2, c0588Wr2.g, c0530Ul);
                    if (i4 == 3) {
                        c0530Ul.e.e.m = c0530Ul.k();
                    } else {
                        c0530Ul.e.e.d(c0530Ul.k());
                        c0530Ul.a = true;
                    }
                } else if (z4 && z5) {
                    f(2, c0588Wr.g, 1, c0588Wr2.g, c0530Ul);
                    if (i3 == 3) {
                        c0530Ul.d.e.m = c0530Ul.q();
                    } else {
                        c0530Ul.d.e.d(c0530Ul.q());
                        c0530Ul.a = true;
                    }
                }
                if (c0530Ul.a && (c1398hd = c0530Ul.e.l) != null) {
                    c1398hd.d(c0530Ul.a0);
                }
                c3135zr = this;
            }
            i = i2;
        }
    }

    public String toString() {
        switch (this.a) {
            case 1:
                Map map = (Map) this.i;
                Long l = (Long) this.h;
                Long l2 = (Long) this.g;
                Long l3 = (Long) this.f;
                Long l4 = (Long) this.e;
                ArrayList arrayList = new ArrayList();
                if (this.b) {
                    arrayList.add("isRegularFile");
                }
                if (this.c) {
                    arrayList.add("isDirectory");
                }
                if (l4 != null) {
                    arrayList.add("byteCount=" + l4);
                }
                if (l3 != null) {
                    arrayList.add("createdAt=" + l3);
                }
                if (l2 != null) {
                    arrayList.add("lastModifiedAt=" + l2);
                }
                if (l != null) {
                    arrayList.add("lastAccessedAt=" + l);
                }
                if (!map.isEmpty()) {
                    arrayList.add("extras=" + map);
                }
                return AbstractC3117zi.i0(arrayList, ", ", "FileMetadata(", ")", null, 56);
            default:
                return super.toString();
        }
    }

    public C3135zr(boolean z, boolean z2, SV sv, Long l, Long l2, Long l3, Long l4, Map map) {
        this.b = z;
        this.c = z2;
        this.d = sv;
        this.e = l;
        this.f = l2;
        this.g = l3;
        this.h = l4;
        this.i = GN.d0(map);
    }

    public /* synthetic */ C3135zr(boolean z, boolean z2, SV sv, Long l, Long l2, Long l3, Long l4) {
        this(z, z2, sv, l, l2, l3, l4, C0358Nv.l);
    }
}
