package o;

import android.view.KeyEvent;
import android.view.ViewGroup;
import android.view.ViewParent;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.bi, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public class C0834bi extends AbstractC0561Vq implements LX, KJ, P50, Xg0, InterfaceC0581Wk, InterfaceC1575jT {
    public static final C0669Zu U = new C0669Zu(27);
    public KQ B;
    public InterfaceC0894cH C;
    public boolean D;
    public String E;
    public C1065e30 F;
    public boolean G;
    public NC H;
    public final C1936nA I;
    public InterfaceC0894cH J;
    public InterfaceC0535Uq K;
    public AY L;
    public C2131pF M;
    public final NQ N;
    public long O;
    public KQ P;
    public boolean Q;
    public C2058oa0 R;
    public final C0669Zu S;
    public IX T;

    public C0834bi(KQ kq, InterfaceC0894cH interfaceC0894cH, boolean z, boolean z2, String str, C1065e30 c1065e30, NC nc) {
        this.B = kq;
        this.C = interfaceC0894cH;
        this.D = z;
        this.E = str;
        this.F = c1065e30;
        this.G = z2;
        this.H = nc;
        this.I = new C1936nA(kq, 0, new C2200q(1, this, C0834bi.class, "onFocusChange", "onFocusChange(Z)V", 0, 0, 0));
        int i = LM.a;
        this.N = new NQ(6);
        this.O = 0L;
        KQ kq2 = this.B;
        this.P = kq2;
        this.Q = kq2 == null;
        this.S = U;
    }

    @Override // o.LP
    public final void A0() {
        L0();
        if (this.P == null) {
            this.B = null;
        }
        InterfaceC0535Uq interfaceC0535Uq = this.K;
        if (interfaceC0535Uq != null) {
            I0(interfaceC0535Uq);
        }
        this.K = null;
    }

    @Override // o.InterfaceC1575jT
    public final void K() {
        if (this.D) {
            AbstractC2841wm0.A(this, new C2010o(this, 0));
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:22:0x0065  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void L0() {
        /*
            r17 = this;
            r0 = r17
            o.KQ r1 = r0.B
            o.NQ r2 = r0.N
            if (r1 == 0) goto L6a
            o.AY r3 = r0.L
            if (r3 == 0) goto L14
            o.zY r4 = new o.zY
            r4.<init>(r3)
            r1.b(r4)
        L14:
            o.pF r3 = r0.M
            if (r3 == 0) goto L20
            o.qF r4 = new o.qF
            r4.<init>(r3)
            r1.b(r4)
        L20:
            java.lang.Object[] r3 = r2.c
            long[] r4 = r2.a
            int r5 = r4.length
            int r5 = r5 + (-2)
            if (r5 < 0) goto L6a
            r6 = 0
            r7 = r6
        L2b:
            r8 = r4[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 L65
            int r10 = r7 - r5
            int r10 = ~r10
            int r10 = r10 >>> 31
            r11 = 8
            int r10 = 8 - r10
            r12 = r6
        L45:
            if (r12 >= r10) goto L63
            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 L5f
            int r13 = r7 << 3
            int r13 = r13 + r12
            r13 = r3[r13]
            o.AY r13 = (o.AY) r13
            o.zY r14 = new o.zY
            r14.<init>(r13)
            r1.b(r14)
        L5f:
            long r8 = r8 >> r11
            int r12 = r12 + 1
            goto L45
        L63:
            if (r10 != r11) goto L6a
        L65:
            if (r7 == r5) goto L6a
            int r7 = r7 + 1
            goto L2b
        L6a:
            r1 = 0
            r0.L = r1
            r0.M = r1
            r2.a()
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C0834bi.L0():void");
    }

    public final void M0() {
        KQ kq = this.B;
        if (kq != null) {
            C2058oa0 c2058oa0 = this.R;
            InterfaceC0220Im interfaceC0220Im = null;
            if (c2058oa0 == null || !c2058oa0.b()) {
                AY ay = this.L;
                if (ay != null) {
                    AbstractC1692kh0.C(v0(), null, new r(ay, kq, interfaceC0220Im, 0), 3);
                }
            } else {
                C2058oa0 c2058oa02 = this.R;
                if (c2058oa02 != null) {
                    c2058oa02.c(null);
                }
            }
            this.L = null;
        }
    }

    public final void N0() {
        if (this.K != null) {
            return;
        }
        InterfaceC0894cH interfaceC0894cH = this.D ? this.J : this.C;
        if (interfaceC0894cH != null) {
            if (this.B == null) {
                this.B = new KQ();
            }
            this.I.M0(this.B);
            InterfaceC0535Uq interfaceC0535UqA = interfaceC0894cH.a(this.B);
            H0(interfaceC0535UqA);
            this.K = interfaceC0535UqA;
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:31:0x00ca, code lost:
    
        if (((r7 & ((~r7) << 6)) & r14) == 0) goto L44;
     */
    /* JADX WARN: Code restructure failed: missing block: B:32:0x00cc, code lost:
    
        r16 = -1;
     */
    /* JADX WARN: Multi-variable type inference failed */
    @Override // o.KJ
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final boolean O(android.view.KeyEvent r24) {
        /*
            Method dump skipped, instructions count: 293
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C0834bi.O(android.view.KeyEvent):boolean");
    }

    /* JADX WARN: Removed duplicated region for block: B:39:0x0075  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void O0(o.KQ r4, o.InterfaceC0894cH r5, boolean r6, boolean r7, java.lang.String r8, o.C1065e30 r9, o.NC r10) {
        /*
            r3 = this;
            o.KQ r0 = r3.P
            boolean r0 = o.F3.c(r0, r4)
            r1 = 1
            r2 = 0
            if (r0 != 0) goto L13
            r3.L0()
            r3.P = r4
            r3.B = r4
            r4 = r1
            goto L14
        L13:
            r4 = r2
        L14:
            o.cH r0 = r3.C
            boolean r0 = o.F3.c(r0, r5)
            if (r0 != 0) goto L1f
            r3.C = r5
            r4 = r1
        L1f:
            boolean r5 = r3.D
            if (r5 == r6) goto L2b
            r3.D = r6
            if (r6 == 0) goto L2a
            r3.K()
        L2a:
            r4 = r1
        L2b:
            boolean r5 = r3.G
            o.nA r6 = r3.I
            if (r5 == r7) goto L42
            if (r7 == 0) goto L37
            r3.H0(r6)
            goto L3d
        L37:
            r3.I0(r6)
            r3.L0()
        L3d:
            o.C2887xC.t(r3)
            r3.G = r7
        L42:
            java.lang.String r5 = r3.E
            boolean r5 = o.F3.c(r5, r8)
            if (r5 != 0) goto L4f
            r3.E = r8
            o.C2887xC.t(r3)
        L4f:
            o.e30 r5 = r3.F
            boolean r5 = o.F3.c(r5, r9)
            if (r5 != 0) goto L5c
            r3.F = r9
            o.C2887xC.t(r3)
        L5c:
            r3.H = r10
            boolean r5 = r3.Q
            o.KQ r7 = r3.P
            if (r7 != 0) goto L66
            r8 = r1
            goto L67
        L66:
            r8 = r2
        L67:
            if (r5 == r8) goto L75
            if (r7 != 0) goto L6c
            r2 = r1
        L6c:
            r3.Q = r2
            if (r2 != 0) goto L75
            o.Uq r5 = r3.K
            if (r5 != 0) goto L75
            goto L76
        L75:
            r1 = r4
        L76:
            if (r1 == 0) goto L8b
            o.Uq r4 = r3.K
            if (r4 != 0) goto L80
            boolean r5 = r3.Q
            if (r5 != 0) goto L8b
        L80:
            if (r4 == 0) goto L85
            r3.I0(r4)
        L85:
            r4 = 0
            r3.K = r4
            r3.N0()
        L8b:
            o.KQ r4 = r3.B
            r6.M0(r4)
            return
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C0834bi.O0(o.KQ, o.cH, boolean, boolean, java.lang.String, o.e30, o.NC):void");
    }

    /* JADX WARN: Type inference failed for: r0v1, types: [java.lang.Object, java.util.Collection, java.util.List] */
    /* JADX WARN: Type inference failed for: r0v11, types: [java.lang.Object, java.util.List] */
    /* JADX WARN: Type inference failed for: r0v2, types: [java.lang.Object, java.util.Collection, java.util.List] */
    @Override // o.LX
    public final void Z(CX cx, DX dx, long j) {
        long j2 = ((j >> 33) << 32) | (((j << 32) >> 33) & 4294967295L);
        this.O = (Float.floatToRawIntBits((int) (j2 >> 32)) << 32) | (Float.floatToRawIntBits((int) (j2 & 4294967295L)) & 4294967295L);
        N0();
        boolean z = this.G;
        int i = 4;
        DX dx2 = DX.m;
        int i2 = 1;
        InterfaceC0220Im interfaceC0220Im = null;
        int i3 = 0;
        if (z && dx == dx2) {
            int i4 = cx.e;
            if (i4 == 4) {
                AbstractC1692kh0.C(v0(), null, new C2674v(this, interfaceC0220Im, i3), 3);
            } else if (i4 == 5) {
                AbstractC1692kh0.C(v0(), null, new C2674v(this, interfaceC0220Im, i2), 3);
            }
        }
        if (dx != dx2) {
            if (dx != DX.n || this.T == null) {
                return;
            }
            ?? r0 = cx.a;
            int size = r0.size();
            while (i3 < size) {
                IX ix = (IX) r0.get(i3);
                if (ix.b() && !ix.equals(this.T)) {
                    this.T = null;
                    M0();
                    return;
                }
                i3++;
            }
            return;
        }
        IX ix2 = this.T;
        if (ix2 == null) {
            if (Kc0.c(cx, true)) {
                IX ix3 = (IX) cx.a.get(0);
                ix3.a();
                this.T = ix3;
                if (this.G) {
                    long j3 = ix3.c;
                    KQ kq = this.B;
                    if (kq != null) {
                        AY ay = new AY(j3);
                        C2773w10 c2773w10 = new C2773w10();
                        YT.U(this, C0687a50.A, new S1(i, c2773w10));
                        if (!c2773w10.l) {
                            int i5 = AbstractC0929ci.b;
                            ViewParent parent = AbstractC0662Zn.F(this).getParent();
                            while (parent != null && (parent instanceof ViewGroup)) {
                                ViewGroup viewGroup = (ViewGroup) parent;
                                if (!viewGroup.shouldDelayChildPressedState()) {
                                    parent = viewGroup.getParent();
                                }
                            }
                            this.L = ay;
                            AbstractC1692kh0.C(v0(), null, new r(kq, ay, null), 3);
                            return;
                        }
                        this.R = AbstractC1692kh0.C(v0(), null, new C2484t(kq, ay, this, interfaceC0220Im, 0), 3);
                        return;
                    }
                    return;
                }
                return;
            }
            return;
        }
        ?? r02 = cx.a;
        int size2 = r02.size();
        for (int i6 = 0; i6 < size2; i6++) {
            if (!As0.q((IX) r02.get(i6))) {
                long jT = AbstractC2539te.S(this).I.T(((Qj0) AbstractC2461sm0.j(this, AbstractC0840bl.s)).g());
                float fMax = Math.max(0.0f, Float.intBitsToFloat((int) (jT >> 32)) - ((int) (j >> 32))) / 2.0f;
                float fMax2 = Math.max(0.0f, Float.intBitsToFloat((int) (jT & 4294967295L)) - ((int) (j & 4294967295L))) / 2.0f;
                long jFloatToRawIntBits = (Float.floatToRawIntBits(fMax) << 32) | (Float.floatToRawIntBits(fMax2) & 4294967295L);
                int size3 = r02.size();
                while (i3 < size3) {
                    IX ix4 = (IX) r02.get(i3);
                    if (ix4.b() || As0.I(ix4, j, jFloatToRawIntBits)) {
                        this.T = null;
                        M0();
                        return;
                    }
                    i3++;
                }
                return;
            }
        }
        ((IX) r02.get(0)).a();
        if (this.G) {
            long j4 = ix2.c;
            KQ kq2 = this.B;
            if (kq2 != null) {
                C2058oa0 c2058oa0 = this.R;
                if (c2058oa0 == null || !c2058oa0.b()) {
                    AY ay2 = this.L;
                    if (ay2 != null) {
                        AbstractC1692kh0.C(v0(), null, new r(ay2, kq2, interfaceC0220Im, i2), 3);
                    }
                } else {
                    AbstractC1692kh0.C(v0(), null, new C2389s(this, j4, kq2, null, 0), 3);
                }
                this.L = null;
            }
            this.H.a();
        }
        this.T = null;
    }

    @Override // o.LX
    public final void a0() {
        C2131pF c2131pF;
        KQ kq = this.B;
        if (kq != null && (c2131pF = this.M) != null) {
            kq.b(new C2226qF(c2131pF));
        }
        this.M = null;
        if (this.T != null) {
            this.T = null;
            M0();
        }
    }

    @Override // o.P50
    public final boolean c0() {
        return true;
    }

    @Override // o.P50
    public final void d0(N50 n50) {
        C1065e30 c1065e30 = this.F;
        if (c1065e30 != null) {
            Y50.c(n50, c1065e30.a);
        }
        String str = this.E;
        C2010o c2010o = new C2010o(this, 1);
        DJ[] djArr = Y50.a;
        n50.d(M50.b, new C1726l0(str, c2010o));
        if (this.G) {
            this.I.d0(n50);
        } else {
            n50.d(W50.i, Oh0.a);
        }
        K0(n50);
    }

    @Override // o.KJ
    public final boolean m(KeyEvent keyEvent) {
        return false;
    }

    @Override // o.Xg0
    public final Object s() {
        return this.S;
    }

    @Override // o.LP
    public final boolean w0() {
        return false;
    }

    @Override // o.LP
    public final void z0() {
        K();
        if (!this.Q) {
            N0();
        }
        if (this.G) {
            H0(this.I);
        }
    }

    public void K0(N50 n50) {
    }
}
