package I0;

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

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

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

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

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

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

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

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

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

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public C2069a f2275q;

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

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

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

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

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

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public S f2278t = S.f2259c;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public final I f2279u = new I(this, 1);

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

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

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public final T f2283y = new T(this, 0);

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

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

    /* JADX INFO: renamed from: C, reason: collision with root package name */
    public final T f2265C = new T(this, 2);

    /* JADX INFO: renamed from: D, reason: collision with root package name */
    public final T f2266D = new T(this, 1);

    public U(L l) {
        this.f2268f = l;
        this.f2263A = l.f2227p.f2324u;
    }

    public final void A0() throws Throwable {
        L l;
        D d6;
        this.f2267E = true;
        L l6 = this.f2268f;
        H hT = l6.f2213a.t();
        S s6 = this.f2278t;
        if ((s6 != S.f2257a && !l6.f2215c) || (s6 != S.f2258b && l6.f2215c)) {
            x0();
            if (this.f2269j && hT != null) {
                hT.S(false);
            }
        }
        if (hT == null) {
            this.l = 0;
        } else if (!this.f2269j && ((d6 = (l = hT.f2163K).f2216d) == D.f2138c || d6 == D.f2139d)) {
            if (this.l != Integer.MAX_VALUE) {
                F0.a.b("Place was called on a node which was placed already");
            }
            int i6 = l.f2220h;
            this.l = i6;
            l.f2220h = i6 + 1;
        }
        Z();
    }

    @Override // I0.InterfaceC0281a
    public final void B(C0.Z z6) {
        MutableVector mutableVectorX = this.f2268f.f2213a.x();
        Object[] objArr = mutableVectorX.content;
        int size = mutableVectorX.getSize();
        for (int i6 = 0; i6 < size; i6++) {
            U u6 = ((H) objArr[i6]).f2163K.f2228q;
            kotlin.jvm.internal.o.e(u6);
            z6.invoke(u6);
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:31:0x006e A[Catch: all -> 0x0024, TryCatch #0 {all -> 0x0024, blocks: (B:3:0x0007, B:5:0x000d, B:7:0x0013, B:9:0x0018, B:10:0x001a, B:12:0x001e, B:15:0x0026, B:17:0x0035, B:19:0x0039, B:22:0x003f, B:21:0x003d, B:23:0x0042, B:25:0x004c, B:30:0x0056, B:32:0x0084, B:31:0x006e), top: B:36:0x0007 }] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void B0(long j4, J4.c cVar) {
        L l = this.f2268f;
        H h5 = l.f2213a;
        H h6 = l.f2213a;
        try {
            H hT = h5.t();
            D d6 = hT != null ? hT.f2163K.f2216d : null;
            D d7 = D.f2139d;
            if (d6 == d7) {
                l.f2215c = false;
            }
            if (h6.f2173U) {
                F0.a.a("place is called on a deactivated node");
            }
            l.f2216d = d7;
            boolean z6 = true;
            this.f2273o = true;
            this.f2267E = false;
            if (!h1.j.a(j4, this.f2276r)) {
                if (l.f2225n || l.f2224m) {
                    l.f2218f = true;
                }
                y0();
            }
            t0 t0VarA = K.a(h6);
            this.f2276r = j4;
            if (l.f2218f) {
                l.h(false);
                this.f2279u.f2206g = false;
                v0 snapshotObserver = ((J0.A) t0VarA).getSnapshotObserver();
                snapshotObserver.f2468a.observeReads(h6, snapshotObserver.f2474g, this.f2266D);
            } else {
                if (this.f2278t == S.f2259c) {
                    z6 = false;
                }
                if (z6) {
                    Q qT0 = l.a().T0();
                    kotlin.jvm.internal.o.e(qT0);
                    qT0.M0(h1.j.c(j4, qT0.f2002e));
                    A0();
                }
            }
            this.f2277s = cVar;
            l.f2216d = D.f2140e;
        } catch (Throwable th) {
            h5.Y(th);
            throw null;
        }
    }

    public final boolean C0(long j4) {
        long j6;
        L l = this.f2268f;
        H h5 = l.f2213a;
        H h6 = l.f2213a;
        try {
            if (h5.f2173U) {
                F0.a.a("measure is called on a deactivated node");
            }
            H hT = h6.t();
            h6.f2161I = h6.f2161I || (hT != null && hT.f2161I);
            if (!h6.f2163K.f2217e) {
                C2069a c2069a = this.f2275q;
                if (c2069a == null ? false : C2069a.b(c2069a.f16612a, j4)) {
                    J0.A a6 = h6.f2187r;
                    if (a6 != null) {
                        a6.k(h6, true);
                    }
                    h6.X();
                    return false;
                }
            }
            this.f2275q = new C2069a(j4);
            u0(j4);
            this.f2279u.f2205f = false;
            MutableVector mutableVectorX = h6.x();
            Object[] objArr = mutableVectorX.content;
            int size = mutableVectorX.getSize();
            for (int i6 = 0; i6 < size; i6++) {
                U u6 = ((H) objArr[i6]).f2163K.f2228q;
                kotlin.jvm.internal.o.e(u6);
                u6.f2279u.f2202c = false;
            }
            if (this.f2274p) {
                j6 = this.f2000c;
            } else {
                long j7 = Integer.MIN_VALUE;
                j6 = (j7 & 4294967295L) | (j7 << 32);
            }
            this.f2274p = true;
            Q qT0 = l.a().T0();
            if (!(qT0 != null)) {
                F0.a.b("Lookahead result from lookaheadRemeasure cannot be null");
            }
            l.c(j4);
            t0((((long) qT0.f1999b) & 4294967295L) | (((long) qT0.f1998a) << 32));
            return (((int) (j6 >> 32)) == qT0.f1998a && ((int) (j6 & 4294967295L)) == qT0.f1999b) ? false : true;
        } catch (Throwable th) {
            h5.Y(th);
            throw null;
        }
    }

    @Override // G0.InterfaceC0273s
    public final int G(int i6) {
        z0();
        Q qT0 = this.f2268f.a().T0();
        kotlin.jvm.internal.o.e(qT0);
        return qT0.G(i6);
    }

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

    @Override // G0.InterfaceC0273s
    public final int K(int i6) {
        z0();
        Q qT0 = this.f2268f.a().T0();
        kotlin.jvm.internal.o.e(qT0);
        return qT0.K(i6);
    }

    /* JADX WARN: Removed duplicated region for block: B:13:0x0025  */
    @Override // G0.Z
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final G0.q0 Q(long j4) {
        F f6;
        L l = this.f2268f;
        H hT = l.f2213a.t();
        if ((hT != null ? hT.f2163K.f2216d : null) == D.f2137b) {
            l.f2214b = false;
        } else {
            H hT2 = l.f2213a.t();
            if ((hT2 != null ? hT2.f2163K.f2216d : null) == D.f2139d) {
            }
        }
        H h5 = l.f2213a;
        H hT3 = h5.t();
        if (hT3 != null) {
            if (this.f2271m != F.f2145c && !h5.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 = hT3.f2163K;
            int iOrdinal = l6.f2216d.ordinal();
            if (iOrdinal == 0 || iOrdinal == 1) {
                f6 = F.f2143a;
            } else {
                if (iOrdinal != 2 && iOrdinal != 3) {
                    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.f2271m = f6;
        } else {
            this.f2271m = F.f2145c;
        }
        H h6 = l.f2213a;
        if (h6.f2159G == F.f2145c) {
            h6.c();
        }
        C0(j4);
        return this;
    }

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

    @Override // I0.InterfaceC0282a0
    public final void X(boolean z6) {
        Q qT0;
        L l = this.f2268f;
        Q qT02 = l.a().T0();
        if (Boolean.valueOf(z6).equals(qT02 != null ? Boolean.valueOf(qT02.l) : null) || (qT0 = l.a().T0()) == null) {
            return;
        }
        qT0.l = z6;
    }

    @Override // I0.InterfaceC0281a
    public final void Z() throws Throwable {
        this.f2282x = true;
        I i6 = this.f2279u;
        i6.h();
        L l = this.f2268f;
        boolean z6 = l.f2218f;
        H h5 = l.f2213a;
        if (z6) {
            MutableVector mutableVectorX = h5.x();
            Object[] objArr = mutableVectorX.content;
            int size = mutableVectorX.getSize();
            for (int i7 = 0; i7 < size; i7++) {
                H h6 = (H) objArr[i7];
                if (h6.f2163K.f2217e && h6.q() == F.f2143a) {
                    L l6 = h6.f2163K;
                    U u6 = l6.f2228q;
                    kotlin.jvm.internal.o.e(u6);
                    U u7 = l6.f2228q;
                    C2069a c2069a = u7 != null ? u7.f2275q : null;
                    kotlin.jvm.internal.o.e(c2069a);
                    if (u6.C0(c2069a.f16612a)) {
                        H.T(h5, false, 7);
                    }
                }
            }
        }
        C0309s c0309s = l().f2460V;
        kotlin.jvm.internal.o.e(c0309s);
        if (l.f2219g || (!this.f2272n && !c0309s.f2247n && l.f2218f)) {
            l.f2218f = false;
            D d6 = l.f2216d;
            l.f2216d = D.f2139d;
            l.i(false);
            v0 snapshotObserver = ((J0.A) K.a(h5)).getSnapshotObserver();
            snapshotObserver.f2468a.observeReads(h5, snapshotObserver.f2475h, this.f2283y);
            l.f2216d = d6;
            if (l.f2224m && c0309s.f2247n) {
                requestLayout();
            }
            l.f2219g = false;
        }
        if (i6.f2203d) {
            i6.f2204e = true;
        }
        if (i6.f2201b && i6.e()) {
            i6.g();
        }
        this.f2282x = false;
    }

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

    @Override // G0.InterfaceC0273s
    public final int d(int i6) {
        z0();
        Q qT0 = this.f2268f.a().T0();
        kotlin.jvm.internal.o.e(qT0);
        return qT0.d(i6);
    }

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

    @Override // G0.InterfaceC0273s
    public final int j0(int i6) {
        z0();
        Q qT0 = this.f2268f.a().T0();
        kotlin.jvm.internal.o.e(qT0);
        return qT0.j0(i6);
    }

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

    @Override // G0.q0
    public final int m0(AbstractC0244a abstractC0244a) {
        L l = this.f2268f;
        H hT = l.f2213a.t();
        D d6 = hT != null ? hT.f2163K.f2216d : null;
        D d7 = D.f2137b;
        I i6 = this.f2279u;
        if (d6 == d7) {
            i6.f2202c = true;
        } else {
            H hT2 = l.f2213a.t();
            if ((hT2 != null ? hT2.f2163K.f2216d : null) == D.f2139d) {
                i6.f2203d = true;
            }
        }
        this.f2272n = true;
        Q qT0 = l.a().T0();
        kotlin.jvm.internal.o.e(qT0);
        int iM0 = qT0.m0(abstractC0244a);
        this.f2272n = false;
        return iM0;
    }

    @Override // G0.q0
    public final int n0() {
        Q qT0 = this.f2268f.a().T0();
        kotlin.jvm.internal.o.e(qT0);
        return qT0.n0();
    }

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

    @Override // G0.q0
    public final int q0() {
        Q qT0 = this.f2268f.a().T0();
        kotlin.jvm.internal.o.e(qT0);
        return qT0.q0();
    }

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

    @Override // G0.q0
    public final void s0(long j4, float f6, J4.c cVar) {
        B0(j4, cVar);
    }

    public final boolean v0() {
        L l = this.f2268f;
        return AbstractC0303l.o(l.f2213a) || l.f2215c;
    }

    public final void w0(boolean z6) {
        if (z6 && v0()) {
            return;
        }
        if (z6 || v0()) {
            this.f2278t = S.f2259c;
            MutableVector mutableVectorX = this.f2268f.f2213a.x();
            Object[] objArr = mutableVectorX.content;
            int size = mutableVectorX.getSize();
            for (int i6 = 0; i6 < size; i6++) {
                U u6 = ((H) objArr[i6]).f2163K.f2228q;
                kotlin.jvm.internal.o.e(u6);
                u6.w0(true);
            }
        }
    }

    public final void x0() {
        S s6 = this.f2278t;
        L l = this.f2268f;
        if (l.f2215c) {
            this.f2278t = S.f2258b;
        } else {
            this.f2278t = S.f2257a;
        }
        S s7 = S.f2257a;
        H h5 = l.f2213a;
        if (s6 != s7 && l.f2217e) {
            H.T(h5, true, 6);
        }
        MutableVector mutableVectorX = h5.x();
        Object[] objArr = mutableVectorX.content;
        int size = mutableVectorX.getSize();
        for (int i6 = 0; i6 < size; i6++) {
            H h6 = (H) objArr[i6];
            U u6 = h6.f2163K.f2228q;
            if (u6 == null) {
                throw new IllegalArgumentException("Error: Child node's lookahead pass delegate cannot be null when in a lookahead scope.");
            }
            if (u6.l != Integer.MAX_VALUE) {
                u6.x0();
                H.W(h6);
            }
        }
    }

    public final void y0() {
        L l = this.f2268f;
        if (l.f2226o > 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;
                if ((l6.f2224m || l6.f2225n) && !l6.f2218f) {
                    h5.S(false);
                }
                U u6 = l6.f2228q;
                if (u6 != null) {
                    u6.y0();
                }
            }
        }
    }

    public final void z0() {
        L l = this.f2268f;
        H.T(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;
    }
}
