package o;

import java.util.ArrayList;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.Rg, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C0447Rg extends AbstractC0745al0 {
    public final ArrayList k;
    public int l;

    public C0447Rg(C0530Ul c0530Ul, int i) {
        C0530Ul c0530Ul2;
        super(c0530Ul);
        ArrayList arrayList = new ArrayList();
        this.k = arrayList;
        this.f = i;
        C0530Ul c0530Ul3 = this.b;
        C0530Ul c0530UlM = c0530Ul3.m(i);
        while (true) {
            c0530Ul2 = c0530Ul3;
            c0530Ul3 = c0530UlM;
            if (c0530Ul3 == null) {
                break;
            } else {
                c0530UlM = c0530Ul3.m(this.f);
            }
        }
        this.b = c0530Ul2;
        int i2 = this.f;
        arrayList.add(i2 == 0 ? c0530Ul2.d : i2 == 1 ? c0530Ul2.e : null);
        C0530Ul c0530UlL = c0530Ul2.l(this.f);
        while (c0530UlL != null) {
            int i3 = this.f;
            arrayList.add(i3 == 0 ? c0530UlL.d : i3 == 1 ? c0530UlL.e : null);
            c0530UlL = c0530UlL.l(this.f);
        }
        int size = arrayList.size();
        int i4 = 0;
        while (i4 < size) {
            Object obj = arrayList.get(i4);
            i4++;
            AbstractC0745al0 abstractC0745al0 = (AbstractC0745al0) obj;
            int i5 = this.f;
            if (i5 == 0) {
                abstractC0745al0.b.b = this;
            } else if (i5 == 1) {
                abstractC0745al0.b.c = this;
            }
        }
        if (this.f == 0 && ((C0556Vl) this.b.T).v0 && arrayList.size() > 1) {
            this.b = ((AbstractC0745al0) arrayList.get(arrayList.size() - 1)).b;
        }
        this.l = this.f == 0 ? this.b.i0 : this.b.j0;
    }

    /* JADX WARN: Removed duplicated region for block: B:62:0x00ce  */
    /* JADX WARN: Removed duplicated region for block: B:65:0x00dd  */
    @Override // o.InterfaceC2755vr
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void a(o.InterfaceC2755vr r28) {
        /*
            Method dump skipped, instructions count: 945
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C0447Rg.a(o.vr):void");
    }

    @Override // o.AbstractC0745al0
    public final void d() {
        ArrayList arrayList = this.k;
        int size = arrayList.size();
        int i = 0;
        while (i < size) {
            Object obj = arrayList.get(i);
            i++;
            ((AbstractC0745al0) obj).d();
        }
        int size2 = arrayList.size();
        if (size2 < 1) {
            return;
        }
        C0530Ul c0530Ul = ((AbstractC0745al0) arrayList.get(0)).b;
        C0530Ul c0530Ul2 = ((AbstractC0745al0) arrayList.get(size2 - 1)).b;
        int i2 = this.f;
        C0017Ar c0017Ar = this.i;
        C0017Ar c0017Ar2 = this.h;
        if (i2 == 0) {
            C3123zl c3123zl = c0530Ul.I;
            C3123zl c3123zl2 = c0530Ul2.K;
            C0017Ar c0017ArI = AbstractC0745al0.i(c3123zl, 0);
            int iE = c3123zl.e();
            C0530Ul c0530UlM = m();
            if (c0530UlM != null) {
                iE = c0530UlM.I.e();
            }
            if (c0017ArI != null) {
                AbstractC0745al0.b(c0017Ar2, c0017ArI, iE);
            }
            C0017Ar c0017ArI2 = AbstractC0745al0.i(c3123zl2, 0);
            int iE2 = c3123zl2.e();
            C0530Ul c0530UlN = n();
            if (c0530UlN != null) {
                iE2 = c0530UlN.K.e();
            }
            if (c0017ArI2 != null) {
                AbstractC0745al0.b(c0017Ar, c0017ArI2, -iE2);
            }
        } else {
            C3123zl c3123zl3 = c0530Ul.J;
            C3123zl c3123zl4 = c0530Ul2.L;
            C0017Ar c0017ArI3 = AbstractC0745al0.i(c3123zl3, 1);
            int iE3 = c3123zl3.e();
            C0530Ul c0530UlM2 = m();
            if (c0530UlM2 != null) {
                iE3 = c0530UlM2.J.e();
            }
            if (c0017ArI3 != null) {
                AbstractC0745al0.b(c0017Ar2, c0017ArI3, iE3);
            }
            C0017Ar c0017ArI4 = AbstractC0745al0.i(c3123zl4, 1);
            int iE4 = c3123zl4.e();
            C0530Ul c0530UlN2 = n();
            if (c0530UlN2 != null) {
                iE4 = c0530UlN2.L.e();
            }
            if (c0017ArI4 != null) {
                AbstractC0745al0.b(c0017Ar, c0017ArI4, -iE4);
            }
        }
        c0017Ar2.a = this;
        c0017Ar.a = this;
    }

    @Override // o.AbstractC0745al0
    public final void e() {
        int i = 0;
        while (true) {
            ArrayList arrayList = this.k;
            if (i >= arrayList.size()) {
                return;
            }
            ((AbstractC0745al0) arrayList.get(i)).e();
            i++;
        }
    }

    @Override // o.AbstractC0745al0
    public final void f() {
        this.c = null;
        ArrayList arrayList = this.k;
        int size = arrayList.size();
        int i = 0;
        while (i < size) {
            Object obj = arrayList.get(i);
            i++;
            ((AbstractC0745al0) obj).f();
        }
    }

    @Override // o.AbstractC0745al0
    public final long j() {
        ArrayList arrayList = this.k;
        int size = arrayList.size();
        long j = 0;
        for (int i = 0; i < size; i++) {
            j = r5.i.f + ((AbstractC0745al0) arrayList.get(i)).j() + j + r5.h.f;
        }
        return j;
    }

    @Override // o.AbstractC0745al0
    public final boolean k() {
        ArrayList arrayList = this.k;
        int size = arrayList.size();
        for (int i = 0; i < size; i++) {
            if (!((AbstractC0745al0) arrayList.get(i)).k()) {
                return false;
            }
        }
        return true;
    }

    public final C0530Ul m() {
        int i = 0;
        while (true) {
            ArrayList arrayList = this.k;
            if (i >= arrayList.size()) {
                return null;
            }
            C0530Ul c0530Ul = ((AbstractC0745al0) arrayList.get(i)).b;
            if (c0530Ul.g0 != 8) {
                return c0530Ul;
            }
            i++;
        }
    }

    public final C0530Ul n() {
        ArrayList arrayList = this.k;
        for (int size = arrayList.size() - 1; size >= 0; size--) {
            C0530Ul c0530Ul = ((AbstractC0745al0) arrayList.get(size)).b;
            if (c0530Ul.g0 != 8) {
                return c0530Ul;
            }
        }
        return null;
    }

    public final String toString() {
        StringBuilder sb = new StringBuilder("ChainRun ");
        sb.append(this.f == 0 ? "horizontal : " : "vertical : ");
        ArrayList arrayList = this.k;
        int size = arrayList.size();
        int i = 0;
        while (i < size) {
            Object obj = arrayList.get(i);
            i++;
            sb.append("<");
            sb.append((AbstractC0745al0) obj);
            sb.append("> ");
        }
        return sb.toString();
    }
}
