package I0;

import G0.AbstractC0244a;
import androidx.compose.runtime.collection.MutableVector;
import h1.C2069a;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
public final class Y extends G0.q0 implements G0.Z, InterfaceC0281a, InterfaceC0282a0 {

    /* JADX INFO: renamed from: D, reason: collision with root package name */
    public boolean f2302D;

    /* JADX INFO: renamed from: H, reason: collision with root package name */
    public float f2306H;

    /* JADX INFO: renamed from: I, reason: collision with root package name */
    public boolean f2307I;

    /* JADX INFO: renamed from: J, reason: collision with root package name */
    public J4.c f2308J;

    /* JADX INFO: renamed from: L, reason: collision with root package name */
    public float f2310L;

    /* JADX INFO: renamed from: N, reason: collision with root package name */
    public boolean f2312N;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final L f2313f;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public boolean f2314j;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public boolean f2316m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public boolean f2317n;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public boolean f2319p;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public J4.c f2321r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public float f2322s;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public Object f2324u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public boolean f2325v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public boolean f2326w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public boolean f2327x;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public boolean f2328y;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public boolean f2329z;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public int f2315k = Integer.MAX_VALUE;
    public int l = Integer.MAX_VALUE;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public F f2318o = F.f2145c;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public long f2320q = 0;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public boolean f2323t = true;

    /* JADX INFO: renamed from: A, reason: collision with root package name */
    public final I f2299A = new I(this, 0);

    /* JADX INFO: renamed from: B, reason: collision with root package name */
    public final MutableVector f2300B = new MutableVector(new Y[16], 0);

    /* JADX INFO: renamed from: C, reason: collision with root package name */
    public boolean f2301C = true;

    /* JADX INFO: renamed from: E, reason: collision with root package name */
    public long f2303E = h1.b.b(0, 0, 15);

    /* JADX INFO: renamed from: F, reason: collision with root package name */
    public final X f2304F = new X(this, 1);

    /* JADX INFO: renamed from: G, reason: collision with root package name */
    public final X f2305G = new X(this, 0);

    /* JADX INFO: renamed from: K, reason: collision with root package name */
    public long f2309K = 0;

    /* JADX INFO: renamed from: M, reason: collision with root package name */
    public final X f2311M = new X(this, 2);

    public Y(L l) {
        this.f2313f = l;
    }

    public final void A0() {
        this.f2307I = true;
        L l = this.f2313f;
        H hT = l.f2213a.t();
        float f6 = l().f2409D;
        H h5 = l.f2213a;
        C0290e0 c0290e0 = h5.f2162J;
        AbstractC0300j0 abstractC0300j0 = (AbstractC0300j0) c0290e0.f2363e;
        while (abstractC0300j0 != ((C0310t) c0290e0.f2362d)) {
            kotlin.jvm.internal.o.f(abstractC0300j0, "null cannot be cast to non-null type androidx.compose.ui.node.LayoutModifierNodeCoordinator");
            A a6 = (A) abstractC0300j0;
            f6 += a6.f2409D;
            abstractC0300j0 = a6.f2422s;
        }
        if (f6 != this.f2306H) {
            this.f2306H = f6;
            if (hT != null) {
                hT.M();
            }
            if (hT != null) {
                hT.A();
            }
        }
        if (!l().f2247n) {
            boolean z6 = this.f2325v;
            if (!z6 || this.f2299A.d()) {
                w0();
            }
            if (z6) {
                ((C0310t) h5.f2162J.f2362d).g1();
            } else {
                if (hT != null) {
                    hT.A();
                }
                if (this.f2314j && hT != null) {
                    hT.U(false);
                }
            }
        }
        if (hT == null) {
            this.l = 0;
        } else if (!this.f2314j) {
            L l6 = hT.f2163K;
            if (l6.f2216d == D.f2138c) {
                if (this.l != Integer.MAX_VALUE) {
                    F0.a.b("Place was called on a node which was placed already");
                }
                int i6 = l6.f2221i;
                this.l = i6;
                l6.f2221i = i6 + 1;
            }
        }
        Z();
    }

    @Override // I0.InterfaceC0281a
    public final void B(C0.Z z6) {
        MutableVector mutableVectorX = this.f2313f.f2213a.x();
        Object[] objArr = mutableVectorX.content;
        int size = mutableVectorX.getSize();
        for (int i6 = 0; i6 < size; i6++) {
            z6.invoke(((H) objArr[i6]).f2163K.f2227p);
        }
    }

    public final void B0(long j4, float f6, J4.c cVar) throws Throwable {
        L l = this.f2313f;
        if (l.f2213a.f2173U) {
            F0.a.a("place is called on a deactivated node");
        }
        l.f2216d = D.f2138c;
        this.f2320q = j4;
        this.f2322s = f6;
        this.f2321r = cVar;
        this.f2307I = false;
        H h5 = l.f2213a;
        t0 t0VarA = K.a(h5);
        if (this.f2328y || !this.f2325v) {
            this.f2299A.f2206g = false;
            l.f(false);
            this.f2308J = cVar;
            this.f2309K = j4;
            this.f2310L = f6;
            v0 snapshotObserver = ((J0.A) t0VarA).getSnapshotObserver();
            snapshotObserver.f2468a.observeReads(h5, snapshotObserver.f2473f, this.f2311M);
        } else {
            AbstractC0300j0 abstractC0300j0A = l.a();
            abstractC0300j0A.l1(h1.j.c(j4, abstractC0300j0A.f2002e), f6, cVar);
            A0();
        }
        l.f2216d = D.f2140e;
        if (l.a().f2247n && (l.f2223k || l.f2222j)) {
            requestLayout();
        }
        this.f2317n = true;
    }

    public final boolean C0(long j4) {
        L l = this.f2313f;
        H h5 = l.f2213a;
        H h6 = l.f2213a;
        try {
            if (h5.f2173U) {
                F0.a.a("measure is called on a deactivated node");
            }
            t0 t0VarA = K.a(h6);
            H hT = h6.t();
            boolean z6 = true;
            h6.f2161I = h6.f2161I || (hT != null && hT.f2161I);
            if (!h6.o() && C2069a.b(this.f2001d, j4)) {
                ((J0.A) t0VarA).k(h6, false);
                h6.X();
                return false;
            }
            this.f2299A.f2205f = false;
            MutableVector mutableVectorX = h6.x();
            Object[] objArr = mutableVectorX.content;
            int size = mutableVectorX.getSize();
            for (int i6 = 0; i6 < size; i6++) {
                ((H) objArr[i6]).f2163K.f2227p.f2299A.f2202c = false;
            }
            this.f2316m = true;
            long j6 = l.a().f2000c;
            u0(j4);
            D d6 = l.f2216d;
            D d7 = D.f2140e;
            if (d6 != d7) {
                F0.a.b("layout state is not idle before measure starts");
            }
            this.f2303E = j4;
            D d8 = D.f2136a;
            l.f2216d = d8;
            this.f2327x = false;
            v0 snapshotObserver = ((J0.A) K.a(h6)).getSnapshotObserver();
            snapshotObserver.f2468a.observeReads(h6, snapshotObserver.f2470c, this.f2304F);
            if (l.f2216d == d8) {
                this.f2328y = true;
                this.f2329z = true;
                l.f2216d = d7;
            }
            if (h1.l.a(l.a().f2000c, j6) && l.a().f1998a == this.f1998a && l.a().f1999b == this.f1999b) {
                z6 = false;
            }
            t0((((long) l.a().f1999b) & 4294967295L) | (((long) l.a().f1998a) << 32));
            return z6;
        } catch (Throwable th) {
            h5.Y(th);
            throw null;
        }
    }

    @Override // G0.InterfaceC0273s
    public final int G(int i6) {
        L l = this.f2313f;
        if (!AbstractC0303l.o(l.f2213a)) {
            z0();
            return l.a().G(i6);
        }
        U u6 = l.f2228q;
        kotlin.jvm.internal.o.e(u6);
        return u6.G(i6);
    }

    @Override // I0.InterfaceC0281a
    public final int J() {
        return this.l;
    }

    @Override // G0.InterfaceC0273s
    public final int K(int i6) {
        L l = this.f2313f;
        if (!AbstractC0303l.o(l.f2213a)) {
            z0();
            return l.a().K(i6);
        }
        U u6 = l.f2228q;
        kotlin.jvm.internal.o.e(u6);
        return u6.K(i6);
    }

    @Override // G0.Z
    public final G0.q0 Q(long j4) {
        F f6;
        L l = this.f2313f;
        H h5 = l.f2213a;
        F f7 = h5.f2159G;
        F f8 = F.f2145c;
        if (f7 == f8) {
            h5.c();
        }
        if (AbstractC0303l.o(l.f2213a)) {
            U u6 = l.f2228q;
            kotlin.jvm.internal.o.e(u6);
            u6.f2271m = f8;
            u6.Q(j4);
        }
        H h6 = l.f2213a;
        H hT = h6.t();
        if (hT != null) {
            if (this.f2318o != f8 && !h6.f2161I) {
                F0.a.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()");
            }
            L l6 = hT.f2163K;
            int iOrdinal = l6.f2216d.ordinal();
            if (iOrdinal == 0) {
                f6 = F.f2143a;
            } else {
                if (iOrdinal != 2) {
                    throw new IllegalStateException("Measurable could be only measured from the parent's measure or layout block. Parents state is " + l6.f2216d);
                }
                f6 = F.f2144b;
            }
            this.f2318o = f6;
        } else {
            this.f2318o = f8;
        }
        C0(j4);
        return this;
    }

    @Override // G0.q0, G0.InterfaceC0273s
    public final Object S() {
        return this.f2324u;
    }

    @Override // I0.InterfaceC0282a0
    public final void X(boolean z6) {
        L l = this.f2313f;
        if (z6 != l.a().l) {
            l.a().l = z6;
            this.f2312N = true;
        }
    }

    @Override // I0.InterfaceC0281a
    public final void Z() {
        this.f2302D = true;
        I i6 = this.f2299A;
        i6.h();
        boolean z6 = this.f2328y;
        L l = this.f2313f;
        if (z6) {
            MutableVector mutableVectorX = l.f2213a.x();
            Object[] objArr = mutableVectorX.content;
            int size = mutableVectorX.getSize();
            for (int i7 = 0; i7 < size; i7++) {
                H h5 = (H) objArr[i7];
                if (h5.o() && h5.p() == F.f2143a && H.O(h5)) {
                    H.V(l.f2213a, false, 7);
                }
            }
        }
        if (this.f2329z || (!this.f2319p && !l().f2247n && this.f2328y)) {
            this.f2328y = false;
            D d6 = l.f2216d;
            l.f2216d = D.f2138c;
            l.g(false);
            H h6 = l.f2213a;
            v0 snapshotObserver = ((J0.A) K.a(h6)).getSnapshotObserver();
            snapshotObserver.f2468a.observeReads(h6, snapshotObserver.f2472e, this.f2305G);
            l.f2216d = d6;
            this.f2329z = false;
        }
        if (i6.f2203d) {
            i6.f2204e = true;
        }
        if (i6.f2201b && i6.e()) {
            i6.g();
        }
        this.f2302D = false;
    }

    @Override // I0.InterfaceC0281a
    public final I b() {
        return this.f2299A;
    }

    @Override // G0.InterfaceC0273s
    public final int d(int i6) {
        L l = this.f2313f;
        if (!AbstractC0303l.o(l.f2213a)) {
            z0();
            return l.a().d(i6);
        }
        U u6 = l.f2228q;
        kotlin.jvm.internal.o.e(u6);
        return u6.d(i6);
    }

    @Override // I0.InterfaceC0281a
    public final void h0() {
        H.V(this.f2313f.f2213a, false, 7);
    }

    @Override // G0.InterfaceC0273s
    public final int j0(int i6) {
        L l = this.f2313f;
        if (!AbstractC0303l.o(l.f2213a)) {
            z0();
            return l.a().j0(i6);
        }
        U u6 = l.f2228q;
        kotlin.jvm.internal.o.e(u6);
        return u6.j0(i6);
    }

    @Override // I0.InterfaceC0281a
    public final C0310t l() {
        return (C0310t) this.f2313f.f2213a.f2162J.f2362d;
    }

    @Override // G0.q0
    public final int m0(AbstractC0244a abstractC0244a) {
        L l = this.f2313f;
        H hT = l.f2213a.t();
        D d6 = hT != null ? hT.f2163K.f2216d : null;
        D d7 = D.f2136a;
        I i6 = this.f2299A;
        if (d6 == d7) {
            i6.f2202c = true;
        } else {
            H hT2 = l.f2213a.t();
            if ((hT2 != null ? hT2.f2163K.f2216d : null) == D.f2138c) {
                i6.f2203d = true;
            }
        }
        this.f2319p = true;
        int iM0 = l.a().m0(abstractC0244a);
        this.f2319p = false;
        return iM0;
    }

    @Override // G0.q0
    public final int n0() {
        return this.f2313f.a().n0();
    }

    @Override // I0.InterfaceC0281a
    public final InterfaceC0281a q() {
        L l;
        H hT = this.f2313f.f2213a.t();
        if (hT == null || (l = hT.f2163K) == null) {
            return null;
        }
        return l.f2227p;
    }

    @Override // G0.q0
    public final int q0() {
        return this.f2313f.a().q0();
    }

    @Override // I0.InterfaceC0281a
    public final void requestLayout() {
        this.f2313f.f2213a.U(false);
    }

    @Override // G0.q0
    public final void s0(long j4, float f6, J4.c cVar) {
        G0.p0 placementScope;
        L l = this.f2313f;
        H h5 = l.f2213a;
        try {
            this.f2326w = true;
            if (!h1.j.a(j4, this.f2320q) || this.f2312N) {
                if (l.f2223k || l.f2222j || this.f2312N) {
                    this.f2328y = true;
                    this.f2312N = false;
                }
                y0();
            }
            U u6 = l.f2228q;
            if (u6 != null && u6.f2278t == S.f2259c) {
                L l6 = u6.f2268f;
                if (!AbstractC0303l.o(l6.f2213a)) {
                    l6.f2215c = true;
                }
            }
            U u7 = l.f2228q;
            if (u7 != null && u7.v0()) {
                AbstractC0300j0 abstractC0300j0 = l.a().f2423t;
                H h6 = l.f2213a;
                if (abstractC0300j0 == null || (placementScope = abstractC0300j0.f2248o) == null) {
                    placementScope = ((J0.A) K.a(h6)).getPlacementScope();
                }
                U u8 = l.f2228q;
                kotlin.jvm.internal.o.e(u8);
                H hT = h6.t();
                if (hT != null) {
                    hT.f2163K.f2220h = 0;
                }
                u8.l = Integer.MAX_VALUE;
                placementScope.l(u8, (int) (j4 >> 32), (int) (4294967295L & j4), 0.0f);
            }
            U u9 = l.f2228q;
            if (u9 != null && !u9.f2273o) {
                F0.a.b("Error: Placement happened before lookahead.");
            }
            B0(j4, f6, cVar);
        } catch (Throwable th) {
            h5.Y(th);
            throw null;
        }
    }

    public final List v0() {
        L l = this.f2313f;
        l.f2213a.f0();
        boolean z6 = this.f2301C;
        MutableVector mutableVector = this.f2300B;
        if (!z6) {
            return mutableVector.asMutableList();
        }
        H h5 = l.f2213a;
        MutableVector mutableVectorX = h5.x();
        Object[] objArr = mutableVectorX.content;
        int size = mutableVectorX.getSize();
        for (int i6 = 0; i6 < size; i6++) {
            H h6 = (H) objArr[i6];
            if (mutableVector.getSize() <= i6) {
                mutableVector.add(h6.f2163K.f2227p);
            } else {
                mutableVector.set(i6, h6.f2163K.f2227p);
            }
        }
        mutableVector.removeRange(h5.l().size(), mutableVector.getSize());
        this.f2301C = false;
        return mutableVector.asMutableList();
    }

    public final void w0() {
        boolean z6 = this.f2325v;
        this.f2325v = true;
        L l = this.f2313f;
        H h5 = l.f2213a;
        if (!z6) {
            ((C0310t) h5.f2162J.f2362d).g1();
            ((J0.A) K.a(h5)).getRectManager().e(l.f2213a, true);
            if (h5.o()) {
                H.V(h5, true, 6);
            } else if (h5.f2163K.f2217e) {
                H.T(h5, true, 6);
            }
        }
        C0290e0 c0290e0 = h5.f2162J;
        AbstractC0300j0 abstractC0300j0 = ((C0310t) c0290e0.f2362d).f2422s;
        for (AbstractC0300j0 abstractC0300j02 = (AbstractC0300j0) c0290e0.f2363e; !kotlin.jvm.internal.o.c(abstractC0300j02, abstractC0300j0) && abstractC0300j02 != null; abstractC0300j02 = abstractC0300j02.f2422s) {
            if (abstractC0300j02.f2419N) {
                abstractC0300j02.c1();
            }
        }
        MutableVector mutableVectorX = h5.x();
        Object[] objArr = mutableVectorX.content;
        int size = mutableVectorX.getSize();
        for (int i6 = 0; i6 < size; i6++) {
            H h6 = (H) objArr[i6];
            if (h6.u() != Integer.MAX_VALUE) {
                h6.f2163K.f2227p.w0();
                H.W(h6);
            }
        }
    }

    public final void x0() {
        if (this.f2325v) {
            this.f2325v = false;
            L l = this.f2313f;
            R0.b rectManager = ((J0.A) K.a(l.f2213a)).getRectManager();
            H h5 = l.f2213a;
            rectManager.g(h5);
            C0290e0 c0290e0 = h5.f2162J;
            AbstractC0300j0 abstractC0300j0 = ((C0310t) c0290e0.f2362d).f2422s;
            for (AbstractC0300j0 abstractC0300j02 = (AbstractC0300j0) c0290e0.f2363e; !kotlin.jvm.internal.o.c(abstractC0300j02, abstractC0300j0) && abstractC0300j02 != null; abstractC0300j02 = abstractC0300j02.f2422s) {
                abstractC0300j02.i1();
                abstractC0300j02.n1();
            }
            MutableVector mutableVectorX = h5.x();
            Object[] objArr = mutableVectorX.content;
            int size = mutableVectorX.getSize();
            for (int i6 = 0; i6 < size; i6++) {
                ((H) objArr[i6]).f2163K.f2227p.x0();
            }
        }
    }

    public final void y0() {
        L l = this.f2313f;
        if (l.l > 0) {
            MutableVector mutableVectorX = l.f2213a.x();
            Object[] objArr = mutableVectorX.content;
            int size = mutableVectorX.getSize();
            for (int i6 = 0; i6 < size; i6++) {
                H h5 = (H) objArr[i6];
                L l6 = h5.f2163K;
                boolean z6 = l6.f2222j;
                Y y6 = l6.f2227p;
                if ((z6 || l6.f2223k) && !y6.f2328y) {
                    h5.U(false);
                }
                y6.y0();
            }
        }
    }

    public final void z0() {
        L l = this.f2313f;
        H.V(l.f2213a, false, 7);
        H h5 = l.f2213a;
        H hT = h5.t();
        if (hT == null || h5.f2159G != F.f2145c) {
            return;
        }
        int iOrdinal = hT.f2163K.f2216d.ordinal();
        h5.f2159G = iOrdinal != 0 ? iOrdinal != 2 ? hT.f2159G : F.f2144b : F.f2143a;
    }
}
