package o;

import androidx.compose.ui.input.pointer.PointerInputEventHandler;
import java.util.ArrayList;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class Wb0 extends LP implements MX, InterfaceC2281qr, LX {
    public Object A;
    public PointerInputEventHandler B;
    public C2058oa0 C;
    public CX D = Tb0.a;
    public final C1479iR E;
    public final C1479iR F;
    public final C1479iR G;
    public CX H;
    public long I;
    public Object z;

    public Wb0(Object obj, Object obj2, PointerInputEventHandler pointerInputEventHandler) {
        this.z = obj;
        this.A = obj2;
        this.B = pointerInputEventHandler;
        C1479iR c1479iR = new C1479iR(new Vb0[16]);
        this.E = c1479iR;
        this.F = c1479iR;
        this.G = new C1479iR(new Vb0[16]);
        this.I = 0L;
    }

    @Override // o.LP
    public final void A0() {
        J0();
    }

    public final Object H0(SC sc, InterfaceC0220Im interfaceC0220Im) {
        C2448sg c2448sg = new C2448sg(1, AbstractC2539te.G(interfaceC0220Im));
        c2448sg.r();
        Vb0 vb0 = new Vb0(this, c2448sg);
        synchronized (this.F) {
            this.E.b(vb0);
            new P30(AbstractC2539te.G(AbstractC2539te.u(vb0, vb0, sc))).resumeWith(Oh0.a);
        }
        c2448sg.w(new J80(2, vb0));
        return c2448sg.q();
    }

    /* JADX WARN: Removed duplicated region for block: B:28:0x004c A[Catch: all -> 0x0021, TryCatch #0 {all -> 0x0021, blocks: (B:6:0x000d, B:13:0x001b, B:14:0x0020, B:17:0x0023, B:20:0x002f, B:22:0x0037, B:24:0x003b, B:25:0x0040, B:26:0x0043, B:28:0x004c, B:30:0x0054, B:32:0x0058), top: B:41:0x000d }] */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void I0(o.CX r7, o.DX r8) {
        /*
            r6 = this;
            o.iR r0 = r6.F
            monitor-enter(r0)
            o.iR r1 = r6.G     // Catch: java.lang.Throwable -> L6c
            o.iR r2 = r6.E     // Catch: java.lang.Throwable -> L6c
            int r3 = r1.n     // Catch: java.lang.Throwable -> L6c
            r1.d(r3, r2)     // Catch: java.lang.Throwable -> L6c
            monitor-exit(r0)
            int r0 = r8.ordinal()     // Catch: java.lang.Throwable -> L21
            r1 = 0
            if (r0 == 0) goto L43
            r2 = 1
            if (r0 == r2) goto L23
            r2 = 2
            if (r0 != r2) goto L1b
            goto L43
        L1b:
            o.pj r7 = new o.pj     // Catch: java.lang.Throwable -> L21
            r7.<init>()     // Catch: java.lang.Throwable -> L21
            throw r7     // Catch: java.lang.Throwable -> L21
        L21:
            r7 = move-exception
            goto L66
        L23:
            o.iR r0 = r6.G     // Catch: java.lang.Throwable -> L21
            int r3 = r0.n     // Catch: java.lang.Throwable -> L21
            int r3 = r3 - r2
            java.lang.Object[] r0 = r0.l     // Catch: java.lang.Throwable -> L21
            int r2 = r0.length     // Catch: java.lang.Throwable -> L21
            if (r3 >= r2) goto L60
        L2d:
            if (r3 < 0) goto L60
            r2 = r0[r3]     // Catch: java.lang.Throwable -> L21
            o.Vb0 r2 = (o.Vb0) r2     // Catch: java.lang.Throwable -> L21
            o.DX r4 = r2.f378o     // Catch: java.lang.Throwable -> L21
            if (r8 != r4) goto L40
            o.sg r4 = r2.n     // Catch: java.lang.Throwable -> L21
            if (r4 == 0) goto L40
            r2.n = r1     // Catch: java.lang.Throwable -> L21
            r4.resumeWith(r7)     // Catch: java.lang.Throwable -> L21
        L40:
            int r3 = r3 + (-1)
            goto L2d
        L43:
            o.iR r0 = r6.G     // Catch: java.lang.Throwable -> L21
            java.lang.Object[] r2 = r0.l     // Catch: java.lang.Throwable -> L21
            int r0 = r0.n     // Catch: java.lang.Throwable -> L21
            r3 = 0
        L4a:
            if (r3 >= r0) goto L60
            r4 = r2[r3]     // Catch: java.lang.Throwable -> L21
            o.Vb0 r4 = (o.Vb0) r4     // Catch: java.lang.Throwable -> L21
            o.DX r5 = r4.f378o     // Catch: java.lang.Throwable -> L21
            if (r8 != r5) goto L5d
            o.sg r5 = r4.n     // Catch: java.lang.Throwable -> L21
            if (r5 == 0) goto L5d
            r4.n = r1     // Catch: java.lang.Throwable -> L21
            r5.resumeWith(r7)     // Catch: java.lang.Throwable -> L21
        L5d:
            int r3 = r3 + 1
            goto L4a
        L60:
            o.iR r7 = r6.G
            r7.h()
            return
        L66:
            o.iR r8 = r6.G
            r8.h()
            throw r7
        L6c:
            r7 = move-exception
            monitor-exit(r0)
            throw r7
        */
        throw new UnsupportedOperationException("Method not decompiled: o.Wb0.I0(o.CX, o.DX):void");
    }

    public final void J0() {
        C2058oa0 c2058oa0 = this.C;
        if (c2058oa0 != null) {
            c2058oa0.C(new QP("Pointer input was reset", 2));
            this.C = null;
        }
    }

    @Override // o.LX
    public final void W() {
        J0();
    }

    /* JADX WARN: Type inference failed for: r4v1, types: [java.lang.Object, java.util.Collection, java.util.List] */
    @Override // o.LX
    public final void Z(CX cx, DX dx, long j) {
        this.I = j;
        if (dx == DX.l) {
            this.D = cx;
        }
        InterfaceC0220Im interfaceC0220Im = null;
        if (this.C == null) {
            this.C = AbstractC1692kh0.C(v0(), null, new D9(this, interfaceC0220Im, 8), 1);
        }
        I0(cx, dx);
        ?? r4 = cx.a;
        int size = r4.size();
        int i = 0;
        while (true) {
            if (i >= size) {
                cx = null;
                break;
            } else if (!As0.r((IX) r4.get(i))) {
                break;
            } else {
                i++;
            }
        }
        this.H = cx;
    }

    /* JADX WARN: Type inference failed for: r1v1, types: [java.lang.Object, java.util.Collection, java.util.List] */
    @Override // o.LX
    public final void a0() {
        CX cx = this.H;
        if (cx == null) {
            return;
        }
        ?? r1 = cx.a;
        int size = r1.size();
        for (int i = 0; i < size; i++) {
            if (((IX) r1.get(i)).d) {
                ArrayList arrayList = new ArrayList(r1.size());
                int size2 = r1.size();
                for (int i2 = 0; i2 < size2; i2++) {
                    IX ix = (IX) r1.get(i2);
                    long j = ix.a;
                    long j2 = ix.c;
                    long j3 = ix.b;
                    float f = ix.e;
                    boolean z = ix.d;
                    arrayList.add(new IX(j, j3, j2, false, f, j3, j2, z, z, ix.i, 0L));
                }
                CX cx2 = new CX(arrayList, null);
                this.D = cx2;
                I0(cx2, DX.l);
                I0(cx2, DX.m);
                I0(cx2, DX.n);
                this.H = null;
                return;
            }
        }
    }

    @Override // o.InterfaceC0535Uq, o.LX
    public final void c() {
        J0();
    }

    @Override // o.InterfaceC2281qr
    public final float e() {
        return AbstractC2539te.S(this).I.e();
    }

    @Override // o.InterfaceC2281qr
    public final float q() {
        return AbstractC2539te.S(this).I.q();
    }
}
