package o;

import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.view.View;
import android.view.ViewStructure;
import android.view.autofill.AutofillId;
import android.view.contentcapture.ContentCaptureSession;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class Q3 implements InterfaceC1994nq, View.OnAttachStateChangeListener {
    public final C2207q3 l;
    public final C1256g3 m;
    public C3031ym0 n;

    /* renamed from: o, reason: collision with root package name */
    public final ArrayList f293o = new ArrayList();
    public final long p = 100;
    public int q = 1;
    public boolean r = true;
    public final C1210ff s = AbstractC2841wm0.a(1, 0, 6);
    public final Handler t = new Handler(Looper.getMainLooper());
    public IQ u;
    public long v;
    public final IQ w;
    public S50 x;
    public boolean y;
    public final RunnableC2108p1 z;

    public Q3(C2207q3 c2207q3, C1256g3 c1256g3) {
        this.l = c2207q3;
        this.m = c1256g3;
        IQ iq = ZH.a;
        this.u = iq;
        this.w = new IQ();
        this.x = new S50(c2207q3.getSemanticsOwner().a(), iq);
        this.z = new RunnableC2108p1(3, this);
    }

    /* JADX WARN: Removed duplicated region for block: B:22:0x005a  */
    /* JADX WARN: Removed duplicated region for block: B:31:0x0080  */
    /* JADX WARN: Removed duplicated region for block: B:7:0x0013  */
    /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:29:0x007d -> B:17:0x0047). Please report as a decompilation issue!!! */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final java.lang.Object a(o.AbstractC0298Lm r8) throws java.lang.Throwable {
        /*
            r7 = this;
            boolean r0 = r8 instanceof o.P3
            if (r0 == 0) goto L13
            r0 = r8
            o.P3 r0 = (o.P3) r0
            int r1 = r0.r
            r2 = -2147483648(0xffffffff80000000, float:-0.0)
            r3 = r1 & r2
            if (r3 == 0) goto L13
            int r1 = r1 - r2
            r0.r = r1
            goto L18
        L13:
            o.P3 r0 = new o.P3
            r0.<init>(r7, r8)
        L18:
            java.lang.Object r8 = r0.p
            int r1 = r0.r
            r2 = 2
            r3 = 1
            o.Dn r4 = o.EnumC0091Dn.l
            if (r1 == 0) goto L3a
            if (r1 == r3) goto L34
            if (r1 != r2) goto L2c
            o.cf r1 = r0.f280o
            o.IJ.H(r8)
            goto L47
        L2c:
            java.lang.IllegalStateException r8 = new java.lang.IllegalStateException
            java.lang.String r0 = "call to 'resume' before 'invoke' with coroutine"
            r8.<init>(r0)
            throw r8
        L34:
            o.cf r1 = r0.f280o
            o.IJ.H(r8)
            goto L52
        L3a:
            o.IJ.H(r8)
            o.ff r8 = r7.s
            r8.getClass()
            o.cf r1 = new o.cf
            r1.<init>(r8)
        L47:
            r0.f280o = r1
            r0.r = r3
            java.lang.Object r8 = r1.b(r0)
            if (r8 != r4) goto L52
            goto L7f
        L52:
            java.lang.Boolean r8 = (java.lang.Boolean) r8
            boolean r8 = r8.booleanValue()
            if (r8 == 0) goto L80
            r1.c()
            boolean r8 = r7.i()
            if (r8 == 0) goto L66
            r7.j()
        L66:
            boolean r8 = r7.y
            if (r8 != 0) goto L73
            r7.y = r3
            android.os.Handler r8 = r7.t
            o.p1 r5 = r7.z
            r8.post(r5)
        L73:
            r0.f280o = r1
            r0.r = r2
            long r5 = r7.p
            java.lang.Object r8 = o.F3.t(r5, r0)
            if (r8 != r4) goto L47
        L7f:
            return r4
        L80:
            o.Oh0 r8 = o.Oh0.a
            return r8
        */
        throw new UnsupportedOperationException("Method not decompiled: o.Q3.a(o.Lm):java.lang.Object");
    }

    @Override // o.InterfaceC1994nq
    public final void b() {
        this.n = (C3031ym0) this.m.a();
        m(-1, this.l.getSemanticsOwner().a());
        j();
    }

    @Override // o.InterfaceC1994nq
    public final void c() {
        n(this.l.getSemanticsOwner().a());
        j();
        this.n = null;
    }

    /* JADX WARN: Removed duplicated region for block: B:38:0x00c7  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void e(o.YH r35) {
        /*
            Method dump skipped, instructions count: 433
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.Q3.e(o.YH):void");
    }

    public final YH h() {
        if (this.r) {
            this.r = false;
            this.u = As0.B(this.l.getSemanticsOwner());
            this.v = System.currentTimeMillis();
        }
        return this.u;
    }

    public final boolean i() {
        return this.n != null;
    }

    public final void j() {
        C3031ym0 c3031ym0 = this.n;
        if (c3031ym0 == null) {
            return;
        }
        Object obj = c3031ym0.m;
        if (Build.VERSION.SDK_INT < 29) {
            return;
        }
        ArrayList arrayList = this.f293o;
        if (arrayList.isEmpty()) {
            return;
        }
        int size = arrayList.size();
        for (int i = 0; i < size; i++) {
            C1511im c1511im = (C1511im) arrayList.get(i);
            int iW = AbstractC2462sn.w(c1511im.c);
            if (iW == 0) {
                C1696kj0 c1696kj0 = c1511im.d;
                if (c1696kj0 != null) {
                    ViewStructure viewStructure = (ViewStructure) c1696kj0.m;
                    if (Build.VERSION.SDK_INT >= 29) {
                        R8.f(S2.k(obj), viewStructure);
                    }
                }
            } else {
                if (iW != 1) {
                    throw new C2170pj();
                }
                AutofillId autofillIdB = c3031ym0.b(c1511im.a);
                if (autofillIdB != null && Build.VERSION.SDK_INT >= 29) {
                    R8.g(S2.k(obj), autofillIdB);
                }
            }
        }
        if (Build.VERSION.SDK_INT >= 29) {
            ContentCaptureSession contentCaptureSessionK = S2.k(obj);
            G0 g0O = IJ.o((View) c3031ym0.n);
            Objects.requireNonNull(g0O);
            R8.i(contentCaptureSessionK, AbstractC2440sc.e(g0O.m), new long[]{Long.MIN_VALUE});
        }
        arrayList.clear();
    }

    public final void k(R50 r50, S50 s50) {
        I3 i3 = new I3(1, s50, this);
        r50.getClass();
        List listJ = R50.j(4, r50);
        int size = listJ.size();
        int i = 0;
        for (int i2 = 0; i2 < size; i2++) {
            Object obj = listJ.get(i2);
            if (h().a(((R50) obj).g)) {
                i3.f(Integer.valueOf(i), obj);
                i++;
            }
        }
        List listJ2 = R50.j(4, r50);
        int size2 = listJ2.size();
        for (int i4 = 0; i4 < size2; i4++) {
            R50 r502 = (R50) listJ2.get(i4);
            YH yhH = h();
            int i5 = r502.g;
            if (yhH.a(i5)) {
                IQ iq = this.w;
                if (iq.a(i5)) {
                    Object objB = iq.b(i5);
                    if (objB == null) {
                        throw AbstractC2462sn.q("node not present in pruned tree before this change");
                    }
                    k(r502, (S50) objB);
                } else {
                    continue;
                }
            }
        }
    }

    public final void l(int i, String str) {
        C3031ym0 c3031ym0;
        int i2 = Build.VERSION.SDK_INT;
        if (i2 >= 29 && (c3031ym0 = this.n) != null) {
            AutofillId autofillIdB = c3031ym0.b(i);
            if (autofillIdB == null) {
                throw AbstractC2462sn.q("Invalid content capture ID");
            }
            if (i2 >= 29) {
                R8.h(S2.k(c3031ym0.m), autofillIdB, str);
            }
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:107:0x0193  */
    /* JADX WARN: Removed duplicated region for block: B:34:0x0073  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void m(int r19, o.R50 r20) {
        /*
            Method dump skipped, instructions count: 487
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.Q3.m(int, o.R50):void");
    }

    public final void n(R50 r50) {
        if (i()) {
            this.f293o.add(new C1511im(r50.g, this.v, 2, null));
            List listJ = R50.j(4, r50);
            int size = listJ.size();
            for (int i = 0; i < size; i++) {
                n((R50) listJ.get(i));
            }
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:14:0x0059  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void o() {
        /*
            r17 = this;
            r0 = r17
            o.IQ r1 = r0.w
            r1.c()
            o.YH r2 = r0.h()
            int[] r3 = r2.b
            java.lang.Object[] r4 = r2.c
            long[] r2 = r2.a
            int r5 = r2.length
            int r5 = r5 + (-2)
            if (r5 < 0) goto L5e
            r7 = 0
        L17:
            r8 = r2[r7]
            long r10 = ~r8
            r12 = 7
            long r10 = r10 << r12
            long r10 = r10 & r8
            r12 = -9187201950435737472(0x8080808080808080, double:-2.937446524422997E-306)
            long r10 = r10 & r12
            int r10 = (r10 > r12 ? 1 : (r10 == r12 ? 0 : -1))
            if (r10 == 0) goto L59
            int r10 = r7 - r5
            int r10 = ~r10
            int r10 = r10 >>> 31
            r11 = 8
            int r10 = 8 - r10
            r12 = 0
        L31:
            if (r12 >= r10) goto L57
            r13 = 255(0xff, double:1.26E-321)
            long r13 = r13 & r8
            r15 = 128(0x80, double:6.3E-322)
            int r13 = (r13 > r15 ? 1 : (r13 == r15 ? 0 : -1))
            if (r13 >= 0) goto L53
            int r13 = r7 << 3
            int r13 = r13 + r12
            r14 = r3[r13]
            r13 = r4[r13]
            o.T50 r13 = (o.T50) r13
            o.S50 r15 = new o.S50
            o.R50 r13 = r13.a
            o.YH r6 = r0.h()
            r15.<init>(r13, r6)
            r1.h(r14, r15)
        L53:
            long r8 = r8 >> r11
            int r12 = r12 + 1
            goto L31
        L57:
            if (r10 != r11) goto L5e
        L59:
            if (r7 == r5) goto L5e
            int r7 = r7 + 1
            goto L17
        L5e:
            o.S50 r1 = new o.S50
            o.q3 r2 = r0.l
            o.U50 r2 = r2.getSemanticsOwner()
            o.R50 r2 = r2.a()
            o.YH r3 = r0.h()
            r1.<init>(r2, r3)
            r0.x = r1
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: o.Q3.o():void");
    }

    @Override // android.view.View.OnAttachStateChangeListener
    public final void onViewDetachedFromWindow(View view) {
        this.t.removeCallbacks(this.z);
        this.n = null;
    }

    @Override // android.view.View.OnAttachStateChangeListener
    public final void onViewAttachedToWindow(View view) {
    }
}
