package o;

import com.google.android.gms.common.api.Api;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.eN, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C1091eN extends VW implements InterfaceC1760lO, InterfaceC3059z2, InterfaceC0712aQ {
    public boolean E;
    public Object G;
    public boolean H;
    public final C2800wK q;
    public boolean r;
    public boolean v;
    public boolean w;
    public C0634Yl x;
    public OC z;
    public int s = Api.BaseClientBuilder.API_PRIORITY_OTHER;
    public int t = Api.BaseClientBuilder.API_PRIORITY_OTHER;
    public int u = 3;
    public long y = 0;
    public int A = 3;
    public final C2515tK B = new C2515tK(this, 1);
    public final C1479iR C = new C1479iR(new C1091eN[16]);
    public boolean D = true;
    public boolean F = true;

    public C1091eN(C2800wK c2800wK) {
        this.q = c2800wK;
        this.G = c2800wK.f773o.A;
    }

    @Override // o.InterfaceC1760lO
    public final int O(int i) {
        h0();
        return this.q.a().N0().O(i);
    }

    @Override // o.InterfaceC3059z2
    public final void R() {
        C2420sK.O(this.q.a, false, 7);
    }

    @Override // o.InterfaceC1760lO
    public final int U(int i) {
        h0();
        return this.q.a().N0().U(i);
    }

    @Override // o.InterfaceC1760lO
    public final int V(int i) {
        h0();
        return this.q.a().N0().V(i);
    }

    @Override // o.InterfaceC3059z2
    public final C2515tK a() {
        return this.B;
    }

    @Override // o.VW
    public final void a0(long j, float f, OC oc) throws Throwable {
        o0(j, oc);
    }

    @Override // o.InterfaceC1760lO
    public final VW c(long j) {
        C2800wK c2800wK = this.q;
        C2420sK c2420sK = c2800wK.a;
        C2420sK c2420sK2 = c2800wK.a;
        C2420sK c2420sKS = c2420sK.s();
        int i = 2;
        if ((c2420sKS != null ? c2420sKS.O.c : 0) != 2) {
            C2420sK c2420sKS2 = c2420sK2.s();
            if (c2420sKS2 != null) {
                int i2 = c2420sKS2.O.c;
            }
        }
        C2420sK c2420sKS3 = c2420sK2.s();
        if (c2420sKS3 != null) {
            C2800wK c2800wK2 = c2420sKS3.O;
            if (this.u != 3 && !c2420sK2.M) {
                AbstractC2133pH.b("measure() may not be called multiple times on the same Measurable. If you want to get the content size of the Measurable before calculating the final constraints, please use methods like minIntrinsicWidth()/maxIntrinsicWidth() and minIntrinsicHeight()/maxIntrinsicHeight()");
            }
            int iW = AbstractC2462sn.w(c2800wK2.c);
            if (iW == 0 || iW == 1) {
                i = 1;
            } else if (iW != 2 && iW != 3) {
                throw new IllegalStateException("Measurable could be only measured from the parent's measure or layout block. Parents state is ".concat(AbstractC0126Ew.r(c2800wK2.c)));
            }
            this.u = i;
        } else {
            this.u = 3;
        }
        if (c2420sK2.Y == 3) {
            c2420sK2.c();
        }
        p0(j);
        return this;
    }

    @Override // o.InterfaceC1760lO
    public final int d(int i) {
        h0();
        return this.q.a().N0().d(i);
    }

    public final void d0(boolean z) {
        C2800wK c2800wK = this.q;
        if (z && c2800wK.b) {
            return;
        }
        if (z || c2800wK.b) {
            this.A = 3;
            C1479iR c1479iRW = c2800wK.a.w();
            Object[] objArr = c1479iRW.l;
            int i = c1479iRW.n;
            for (int i2 = 0; i2 < i; i2++) {
                ((C2420sK) objArr[i2]).O.p.d0(true);
            }
        }
    }

    public final void f0() {
        int i = this.A;
        C2800wK c2800wK = this.q;
        boolean z = c2800wK.b;
        C2420sK c2420sK = c2800wK.a;
        if (z) {
            this.A = 2;
        } else {
            this.A = 1;
        }
        if (i != 1 && c2800wK.d) {
            C2420sK.O(c2420sK, true, 6);
        }
        C1479iR c1479iRW = c2420sK.w();
        Object[] objArr = c1479iRW.l;
        int i2 = c1479iRW.n;
        for (int i3 = 0; i3 < i2; i3++) {
            C2420sK c2420sK2 = (C2420sK) objArr[i3];
            C1091eN c1091eN = c2420sK2.O.p;
            if (c1091eN == null) {
                throw new IllegalArgumentException("Error: Child node's lookahead pass delegate cannot be null when in a lookahead scope.");
            }
            if (c1091eN.t != Integer.MAX_VALUE) {
                c1091eN.f0();
                C2420sK.R(c2420sK2);
            }
        }
    }

    public final void g0() {
        C2800wK c2800wK = this.q;
        if (c2800wK.n > 0) {
            C1479iR c1479iRW = c2800wK.a.w();
            Object[] objArr = c1479iRW.l;
            int i = c1479iRW.n;
            for (int i2 = 0; i2 < i; i2++) {
                C2420sK c2420sK = (C2420sK) objArr[i2];
                C2800wK c2800wK2 = c2420sK.O;
                if ((c2800wK2.l || c2800wK2.m) && !c2800wK2.e) {
                    c2420sK.N(false);
                }
                C1091eN c1091eN = c2800wK2.p;
                if (c1091eN != null) {
                    c1091eN.g0();
                }
            }
        }
    }

    public final void h0() {
        int i;
        C2800wK c2800wK = this.q;
        C2420sK.O(c2800wK.a, false, 7);
        C2420sK c2420sK = c2800wK.a;
        C2420sK c2420sKS = c2420sK.s();
        if (c2420sKS == null || c2420sK.Y != 3) {
            return;
        }
        int iW = AbstractC2462sn.w(c2420sKS.O.c);
        if (iW != 0) {
            i = 2;
            if (iW != 2) {
                i = c2420sKS.Y;
            }
        } else {
            i = 1;
        }
        c2420sK.Y = i;
    }

    @Override // o.InterfaceC3059z2
    public final void j(C2769w c2769w) {
        C1479iR c1479iRW = this.q.a.w();
        Object[] objArr = c1479iRW.l;
        int i = c1479iRW.n;
        for (int i2 = 0; i2 < i; i2++) {
            c2769w.g(((C2420sK) objArr[i2]).O.p);
        }
    }

    @Override // o.VW, o.InterfaceC1760lO
    public final Object k() {
        return this.G;
    }

    public final void l0() {
        int i;
        this.H = true;
        C2800wK c2800wK = this.q;
        C2420sK c2420sKS = c2800wK.a.s();
        int i2 = this.A;
        if ((i2 != 1 && !c2800wK.b) || (i2 != 2 && c2800wK.b)) {
            f0();
            if (this.r && c2420sKS != null) {
                c2420sKS.N(false);
            }
        }
        if (c2420sKS != null) {
            C2800wK c2800wK2 = c2420sKS.O;
            if (!this.r && ((i = c2800wK2.c) == 3 || i == 4)) {
                if (this.t != Integer.MAX_VALUE) {
                    AbstractC2133pH.b("Place was called on a node which was placed already");
                }
                int i3 = c2800wK2.g;
                this.t = i3;
                c2800wK2.g = i3 + 1;
            }
        } else {
            this.t = 0;
        }
        s();
    }

    @Override // o.InterfaceC0712aQ
    public final void m(boolean z) {
        AbstractC0709aN abstractC0709aNN0;
        C2800wK c2800wK = this.q;
        AbstractC0709aN abstractC0709aNN02 = c2800wK.a().N0();
        if (Boolean.valueOf(z).equals(abstractC0709aNN02 != null ? Boolean.valueOf(abstractC0709aNN02.t) : null) || (abstractC0709aNN0 = c2800wK.a().N0()) == null) {
            return;
        }
        abstractC0709aNN0.t = z;
    }

    @Override // o.InterfaceC3059z2
    public final C2702vH n() {
        return (C2702vH) this.q.a.N.d;
    }

    public final void o0(long j, OC oc) throws Throwable {
        C2800wK c2800wK = this.q;
        C2420sK c2420sK = c2800wK.a;
        C2420sK c2420sK2 = c2800wK.a;
        try {
            C2420sK c2420sKS = c2420sK.s();
            if ((c2420sKS != null ? c2420sKS.O.c : 0) == 4) {
                c2800wK.b = false;
            }
            if (c2420sK2.X) {
                AbstractC2133pH.a("place is called on a deactivated node");
            }
            c2800wK.c = 4;
            this.v = true;
            this.H = false;
            if (!C0704aI.a(j, this.y)) {
                if (c2800wK.m || c2800wK.l) {
                    c2800wK.e = true;
                }
                g0();
            }
            InterfaceC1577jV interfaceC1577jVA = AbstractC2705vK.a(c2420sK2);
            if (c2800wK.e || !u()) {
                c2800wK.h(false);
                this.B.e = false;
                C1767lV snapshotObserver = ((C2207q3) interfaceC1577jVA).getSnapshotObserver();
                C0996dN c0996dN = new C0996dN(this, interfaceC1577jVA, j);
                snapshotObserver.getClass();
                if (c2420sK2.r != null) {
                    snapshotObserver.a(c2420sK2, snapshotObserver.g, c0996dN);
                } else {
                    snapshotObserver.a(c2420sK2, snapshotObserver.f, c0996dN);
                }
            } else {
                AbstractC0709aN abstractC0709aNN0 = c2800wK.a().N0();
                abstractC0709aNN0.G0(C0704aI.c(j, abstractC0709aNN0.p));
                l0();
            }
            this.y = j;
            this.z = oc;
            c2800wK.c = 5;
        } catch (Throwable th) {
            c2420sK.T(th);
            throw null;
        }
    }

    public final boolean p0(long j) {
        long j2;
        C2800wK c2800wK = this.q;
        C2420sK c2420sK = c2800wK.a;
        C2420sK c2420sK2 = c2800wK.a;
        try {
            if (c2420sK.X) {
                AbstractC2133pH.a("measure is called on a deactivated node");
            }
            C2420sK c2420sKS = c2420sK2.s();
            c2420sK2.M = c2420sK2.M || (c2420sKS != null && c2420sKS.M);
            if (!c2420sK2.O.d) {
                C0634Yl c0634Yl = this.x;
                if (c0634Yl == null ? false : C0634Yl.b(c0634Yl.a, j)) {
                    InterfaceC1577jV interfaceC1577jV = c2420sK2.x;
                    if (interfaceC1577jV != null) {
                        ((C2207q3) interfaceC1577jV).m(c2420sK2, true);
                    }
                    c2420sK2.S();
                    return false;
                }
            }
            this.x = new C0634Yl(j);
            c0(j);
            this.B.d = false;
            C1479iR c1479iRW = c2420sK2.w();
            Object[] objArr = c1479iRW.l;
            int i = c1479iRW.n;
            for (int i2 = 0; i2 < i; i2++) {
                ((C2420sK) objArr[i2]).O.p.B.getClass();
            }
            if (this.w) {
                j2 = this.n;
            } else {
                long j3 = Integer.MIN_VALUE;
                j2 = (j3 & 4294967295L) | (j3 << 32);
            }
            this.w = true;
            AbstractC0709aN abstractC0709aNN0 = c2800wK.a().N0();
            if (!(abstractC0709aNN0 != null)) {
                AbstractC2133pH.b("Lookahead result from lookaheadRemeasure cannot be null");
            }
            c2800wK.c(j);
            b0((abstractC0709aNN0.m & 4294967295L) | (abstractC0709aNN0.l << 32));
            return (((int) (j2 >> 32)) == abstractC0709aNN0.l && ((int) (j2 & 4294967295L)) == abstractC0709aNN0.m) ? false : true;
        } catch (Throwable th) {
            c2420sK.T(th);
            throw null;
        }
    }

    @Override // o.InterfaceC3059z2
    public final InterfaceC3059z2 r() {
        C2800wK c2800wK;
        C2420sK c2420sKS = this.q.a.s();
        if (c2420sKS == null || (c2800wK = c2420sKS.O) == null) {
            return null;
        }
        return c2800wK.p;
    }

    @Override // o.InterfaceC3059z2
    public final void requestLayout() {
        this.q.a.N(false);
    }

    @Override // o.InterfaceC3059z2
    public final void s() {
        this.E = true;
        C2515tK c2515tK = this.B;
        c2515tK.h();
        C2800wK c2800wK = this.q;
        boolean z = c2800wK.e;
        C2420sK c2420sK = c2800wK.a;
        if (z) {
            C1479iR c1479iRW = c2420sK.w();
            Object[] objArr = c1479iRW.l;
            int i = c1479iRW.n;
            for (int i2 = 0; i2 < i; i2++) {
                C2420sK c2420sK2 = (C2420sK) objArr[i2];
                if (c2420sK2.O.d && c2420sK2.q() == 1) {
                    C1091eN c1091eN = c2420sK2.O.p;
                    if (c1091eN.p0((c1091eN != null ? c1091eN.x : null).a)) {
                        C2420sK.O(c2420sK, false, 7);
                    }
                }
            }
        }
        C2607uH c2607uH = n().a0;
        if (c2800wK.f || (!c2607uH.v && c2800wK.e)) {
            c2800wK.e = false;
            int i3 = c2800wK.c;
            c2800wK.c = 4;
            InterfaceC1577jV interfaceC1577jVA = AbstractC2705vK.a(c2420sK);
            c2800wK.i(false);
            C1767lV snapshotObserver = ((C2207q3) interfaceC1577jVA).getSnapshotObserver();
            C1352h3 c1352h3 = new C1352h3(8, this, c2607uH);
            snapshotObserver.getClass();
            if (c2420sK.r != null) {
                snapshotObserver.a(c2420sK, snapshotObserver.h, c1352h3);
            } else {
                snapshotObserver.a(c2420sK, snapshotObserver.e, c1352h3);
            }
            c2800wK.c = i3;
            if (c2800wK.l && c2607uH.v) {
                requestLayout();
            }
            c2800wK.f = false;
        }
        if (c2515tK.b && c2515tK.e()) {
            c2515tK.g();
        }
        this.E = false;
    }

    @Override // o.InterfaceC3059z2
    public final boolean u() {
        return this.A != 3;
    }
}
