package o;

import java.util.ArrayList;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.oe0, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C2066oe0 {
    public final C2513tI A;
    public boolean B;
    public final Kh0 a;
    public MK d;
    public NC g;
    public InterfaceC1598ji h;
    public InterfaceC0065Cn i;
    public C2149pX j;
    public GE k;
    public C0983dA l;
    public final MV m;
    public final MV n;

    /* renamed from: o, reason: collision with root package name */
    public long f663o;
    public Ue0 p;
    public long q;
    public final MV r;
    public final MV s;
    public int t;
    public C2730ve0 u;
    public C2513tI v;
    public Ue0 w;
    public final MV x;
    public final WT y;
    public final C1686ke0 z;
    public InterfaceC1955nT b = AbstractC2833wi0.a;
    public OC c = new C1072e7(20);
    public final MV e = AbstractC0752ap.X(new C2730ve0((String) null, 7, 0));
    public Hk0 f = C0669Zu.c0;

    public C2066oe0(Kh0 kh0) {
        this.a = kh0;
        Boolean bool = Boolean.TRUE;
        this.m = AbstractC0752ap.X(bool);
        this.n = AbstractC0752ap.X(bool);
        this.f663o = 0L;
        this.q = 0L;
        this.r = AbstractC0752ap.X(null);
        this.s = AbstractC0752ap.X(null);
        this.t = -1;
        this.u = new C2730ve0((String) null, 7, 0L);
        this.x = AbstractC0752ap.X(null);
        this.y = new WT(24, false);
        this.z = new C1686ke0(this);
        this.A = new C2513tI(this);
    }

    public static final void a(C2066oe0 c2066oe0, Ue0 ue0) {
        C0977d7 c0977d7L;
        String str;
        InterfaceC0065Cn interfaceC0065Cn;
        if (ue0 == null) {
            return;
        }
        long j = ue0.a;
        C2149pX c2149pX = c2066oe0.j;
        if (c2149pX == null || (c0977d7L = c2066oe0.l()) == null || (str = c0977d7L.m) == null) {
            return;
        }
        InterfaceC1955nT interfaceC1955nT = c2066oe0.b;
        long jU = AbstractC2378rs0.u(interfaceC1955nT.p((int) (j >> 32)), interfaceC1955nT.p((int) (j & 4294967295L)));
        if (str.length() <= 0 || Ue0.c(jU) || (interfaceC0065Cn = c2066oe0.i) == null) {
            return;
        }
        AbstractC1692kh0.C(interfaceC0065Cn, null, new C1781le0(c2149pX, str, jU, ue0, c2066oe0, interfaceC1955nT, null), 3);
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x0013  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static final java.lang.Object b(o.C2066oe0 r12, o.AbstractC0298Lm r13) {
        /*
            boolean r0 = r13 instanceof o.C1876me0
            if (r0 == 0) goto L13
            r0 = r13
            o.me0 r0 = (o.C1876me0) r0
            int r1 = r0.q
            r2 = -2147483648(0xffffffff80000000, float:-0.0)
            r3 = r1 & r2
            if (r3 == 0) goto L13
            int r1 = r1 - r2
            r0.q = r1
            goto L18
        L13:
            o.me0 r0 = new o.me0
            r0.<init>(r12, r13)
        L18:
            java.lang.Object r13 = r0.f638o
            int r1 = r0.q
            o.Oh0 r2 = o.Oh0.a
            r3 = 1
            if (r1 == 0) goto L2f
            if (r1 != r3) goto L27
            o.IJ.H(r13)
            return r2
        L27:
            java.lang.IllegalStateException r12 = new java.lang.IllegalStateException
            java.lang.String r13 = "call to 'resume' before 'invoke' with coroutine"
            r12.<init>(r13)
            throw r12
        L2f:
            o.IJ.H(r13)
            o.d7 r13 = r12.l()
            if (r13 == 0) goto L8a
            java.lang.String r7 = r13.m
            if (r7 == 0) goto L8a
            o.Ue0 r13 = r12.w
            if (r13 == 0) goto L8a
            long r4 = r13.a
            o.pX r9 = r12.j
            if (r9 == 0) goto L8a
            o.nT r13 = r12.b
            r1 = 32
            long r10 = r4 >> r1
            int r1 = (int) r10
            int r13 = r13.p(r1)
            o.nT r12 = r12.b
            r10 = 4294967295(0xffffffff, double:2.1219957905E-314)
            long r4 = r4 & r10
            int r1 = (int) r4
            int r12 = r12.p(r1)
            long r5 = o.AbstractC2378rs0.u(r13, r12)
            r0.q = r3
            int r12 = r7.length()
            if (r12 != 0) goto L6b
            goto L71
        L6b:
            boolean r12 = o.Ue0.c(r5)
            if (r12 == 0) goto L73
        L71:
            r12 = r2
            goto L85
        L73:
            o.s r4 = new o.s
            r8 = 0
            r4.<init>(r5, r7, r8, r9)
            o.vn r12 = r9.a
            o.z4 r13 = new o.z4
            r1 = 0
            r13.<init>(r9, r4, r1)
            java.lang.Object r12 = o.AbstractC1692kh0.T(r12, r13, r0)
        L85:
            o.Dn r13 = o.EnumC0091Dn.l
            if (r12 != r13) goto L8a
            return r13
        L8a:
            return r2
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C2066oe0.b(o.oe0, o.Lm):java.lang.Object");
    }

    public static final long c(C2066oe0 c2066oe0, C2730ve0 c2730ve0, long j, boolean z, boolean z2, C0387Oy c0387Oy, boolean z3) {
        Oe0 oe0D;
        long j2;
        A50 a50;
        long j3;
        C0977d7 c0977d7;
        A50 a502;
        boolean z4;
        boolean z5;
        GE ge;
        C3066z50 c3066z50E;
        C3066z50 c3066z50E2;
        MK mk = c2066oe0.d;
        if (mk == null || (oe0D = mk.d()) == null) {
            return Ue0.b;
        }
        InterfaceC1955nT interfaceC1955nT = c2066oe0.b;
        long j4 = c2730ve0.b;
        C0977d7 c0977d72 = c2730ve0.a;
        int i = Ue0.c;
        long jU = AbstractC2378rs0.u(interfaceC1955nT.p((int) (j4 >> 32)), c2066oe0.b.p((int) (j4 & 4294967295L)));
        int iB = oe0D.b(false, j);
        int i2 = (z2 || z) ? iB : (int) (jU >> 32);
        int i3 = (!z2 || z) ? iB : (int) (jU & 4294967295L);
        C2513tI c2513tI = c2066oe0.v;
        int i4 = -1;
        if (z || c2513tI == null) {
            j2 = 4294967295L;
        } else {
            j2 = 4294967295L;
            int i5 = c2066oe0.t;
            if (i5 != -1) {
                i4 = i5;
            }
        }
        Ne0 ne0 = oe0D.a;
        if (z) {
            a50 = null;
            c0977d7 = c0977d72;
            j3 = j4;
        } else {
            int i6 = (int) (jU >> 32);
            j3 = j4;
            int i7 = (int) (jU & j2);
            c0977d7 = c0977d72;
            a50 = new A50(new C3066z50(AbstractC0249Jp.L(ne0, i6), i6, 1L), new C3066z50(AbstractC0249Jp.L(ne0, i7), i7, 1L), Ue0.g(jU));
        }
        C2513tI c2513tI2 = new C2513tI(z2, a50, new C2642ui(i2, i3, i4, ne0));
        if (a50 != null && c2513tI != null && z2 == c2513tI.b) {
            C2642ui c2642ui = (C2642ui) c2513tI.d;
            if (i2 == c2642ui.b && i3 == c2642ui.c) {
                return j3;
            }
        }
        c2066oe0.v = c2513tI2;
        c2066oe0.t = iB;
        switch (c0387Oy.l) {
            case 12:
                C2642ui c2642ui2 = (C2642ui) c2513tI2.d;
                a502 = new A50(c2642ui2.b(c2642ui2.b), c2642ui2.b(c2642ui2.c), c2513tI2.b() == 1);
                break;
            case 13:
                a502 = AbstractC0662Zn.c(c2513tI2, ME.D);
                break;
            case 14:
                a502 = AbstractC0662Zn.c(c2513tI2, C0669Zu.T);
                break;
            default:
                a502 = (A50) c2513tI2.c;
                if (a502 != null) {
                    C3066z50 c3066z50 = a502.b;
                    C3066z50 c3066z502 = a502.a;
                    C2642ui c2642ui3 = (C2642ui) c2513tI2.d;
                    if (c2513tI2.b) {
                        c3066z50E2 = AbstractC0662Zn.e(c2513tI2, c2642ui3, c3066z502);
                        c3066z50E = c3066z50;
                        c3066z50 = c3066z502;
                        c3066z502 = c3066z50E2;
                    } else {
                        c3066z50E = AbstractC0662Zn.e(c2513tI2, c2642ui3, c3066z50);
                        c3066z50E2 = c3066z50E;
                    }
                    if (!F3.c(c3066z50E2, c3066z50)) {
                        a502 = AbstractC0662Zn.q(new A50(c3066z502, c3066z50E, c2513tI2.b() == 1 || (c2513tI2.b() == 3 && c3066z502.b > c3066z50E.b)), c2513tI2);
                        break;
                    }
                } else {
                    a502 = AbstractC0662Zn.c(c2513tI2, ME.D);
                    break;
                }
                break;
        }
        long jU2 = AbstractC2378rs0.u(c2066oe0.b.n(a502.a.b), c2066oe0.b.n(a502.b.b));
        long j5 = j3;
        if (Ue0.b(jU2, j5)) {
            return j5;
        }
        boolean z6 = Ue0.g(jU2) != Ue0.g(j5) && Ue0.b(AbstractC2378rs0.u((int) (jU2 & j2), (int) (jU2 >> 32)), j5);
        boolean z7 = Ue0.c(jU2) && Ue0.c(j5);
        if (z3 && c0977d7.m.length() > 0 && !z6 && !z7 && (ge = c2066oe0.k) != null) {
            ge.a();
        }
        c2066oe0.c.g(e(c0977d7, jU2));
        c2066oe0.w = new Ue0(jU2);
        if (!z3) {
            c2066oe0.s(!Ue0.c(jU2));
        }
        MK mk2 = c2066oe0.d;
        if (mk2 != null) {
            mk2.q.setValue(Boolean.valueOf(z3));
        }
        MK mk3 = c2066oe0.d;
        if (mk3 != null) {
            mk3.m.setValue(Boolean.valueOf(!Ue0.c(jU2) && AbstractC2841wm0.y(c2066oe0, true)));
        }
        MK mk4 = c2066oe0.d;
        if (mk4 != null) {
            if (Ue0.c(jU2)) {
                z4 = false;
            } else {
                z4 = false;
                if (AbstractC2841wm0.y(c2066oe0, false)) {
                    z5 = true;
                }
                mk4.n.setValue(Boolean.valueOf(z5));
            }
            z5 = z4;
            mk4.n.setValue(Boolean.valueOf(z5));
        } else {
            z4 = false;
        }
        MK mk5 = c2066oe0.d;
        if (mk5 != null) {
            mk5.f231o.setValue(Boolean.valueOf((Ue0.c(jU2) && AbstractC2841wm0.y(c2066oe0, true)) ? true : z4));
        }
        return jU2;
    }

    public static C2730ve0 e(C0977d7 c0977d7, long j) {
        return new C2730ve0(c0977d7, j, (Ue0) null);
    }

    public final C2058oa0 d(boolean z) {
        InterfaceC0065Cn interfaceC0065Cn = this.i;
        if (interfaceC0065Cn != null) {
            return AbstractC1692kh0.C(interfaceC0065Cn, null, new C1401he0(this, z, null), 1);
        }
        return null;
    }

    public final void f() {
        InterfaceC0065Cn interfaceC0065Cn = this.i;
        if (interfaceC0065Cn != null) {
            AbstractC1692kh0.C(interfaceC0065Cn, null, new C1591je0(this, null, 0), 1);
        }
    }

    public final void g(C1765lT c1765lT) {
        if (!Ue0.c(m().b)) {
            MK mk = this.d;
            Oe0 oe0D = mk != null ? mk.d() : null;
            int iE = (c1765lT == null || oe0D == null) ? Ue0.e(m().b) : this.b.n(oe0D.b(true, c1765lT.a));
            C2730ve0 c2730ve0A = C2730ve0.a(m(), null, AbstractC2378rs0.u(iE, iE), 5);
            this.c.g(c2730ve0A);
            this.w = new Ue0(c2730ve0A.b);
        }
        p((c1765lT == null || m().a.m.length() <= 0) ? EnumC3079zE.l : EnumC3079zE.n);
        s(false);
    }

    public final void h(boolean z) {
        C0983dA c0983dA;
        MK mk = this.d;
        if (mk != null && !mk.b() && (c0983dA = this.l) != null) {
            C0983dA.b(c0983dA);
        }
        this.u = m();
        s(z);
        p(EnumC3079zE.m);
    }

    public final C1765lT i() {
        return (C1765lT) this.s.getValue();
    }

    public final boolean j() {
        return ((Boolean) this.n.getValue()).booleanValue();
    }

    public final long k(boolean z) {
        Oe0 oe0D;
        long j;
        MK mk = this.d;
        if (mk == null || (oe0D = mk.d()) == null) {
            return 9205357640488583168L;
        }
        Ne0 ne0 = oe0D.a;
        C2331rQ c2331rQ = ne0.b;
        C0977d7 c0977d7L = l();
        if (c0977d7L == null) {
            return 9205357640488583168L;
        }
        if (!F3.c(c0977d7L.m, ne0.a.a.m)) {
            return 9205357640488583168L;
        }
        C2730ve0 c2730ve0M = m();
        if (z) {
            long j2 = c2730ve0M.b;
            int i = Ue0.c;
            j = j2 >> 32;
        } else {
            long j3 = c2730ve0M.b;
            int i2 = Ue0.c;
            j = j3 & 4294967295L;
        }
        int iP = this.b.p((int) j);
        boolean zG = Ue0.g(m().b);
        long j4 = ne0.c;
        if (c2331rQ.d(iP) >= c2331rQ.f) {
            return 9205357640488583168L;
        }
        boolean z2 = ne0.a(((!z || zG) && (z || !zG)) ? Math.max(iP + (-1), 0) : iP) == ne0.h(iP);
        ArrayList arrayList = c2331rQ.h;
        c2331rQ.k(iP);
        BV bv = (BV) arrayList.get(iP == ((C0977d7) c2331rQ.a.f292o).m.length() ? AbstractC0008Ai.R(arrayList) : AbstractC0249Jp.F(iP, arrayList));
        J4 j42 = bv.a;
        int iD = bv.d(iP);
        Le0 le0 = j42.d;
        return (Float.floatToRawIntBits(AbstractC0940cn0.j(c2331rQ.b(r9), 0.0f, (int) (j4 & 4294967295L))) & 4294967295L) | (Float.floatToRawIntBits(AbstractC0940cn0.j(z2 ? le0.h(iD, false) : le0.i(iD, false), 0.0f, (int) (j4 >> 32))) << 32);
    }

    public final C0977d7 l() {
        C3013yd0 c3013yd0;
        MK mk = this.d;
        if (mk == null || (c3013yd0 = mk.a) == null) {
            return null;
        }
        return c3013yd0.a;
    }

    public final C2730ve0 m() {
        return (C2730ve0) this.e.getValue();
    }

    public final void n() {
        C2058oa0 c2058oa0;
        C2728vd0 c2728vd0 = (C2728vd0) this.y.m;
        if (c2728vd0 == null || (c2058oa0 = c2728vd0.F) == null) {
            return;
        }
        c2058oa0.c(null);
        c2728vd0.F = null;
    }

    public final void o() {
        InterfaceC0065Cn interfaceC0065Cn = this.i;
        if (interfaceC0065Cn != null) {
            AbstractC1692kh0.C(interfaceC0065Cn, null, new C1591je0(this, null, 1), 1);
        }
    }

    public final void p(EnumC3079zE enumC3079zE) {
        MK mk = this.d;
        if (mk != null) {
            if (mk.a() == enumC3079zE) {
                mk = null;
            }
            if (mk != null) {
                mk.k.setValue(enumC3079zE);
            }
        }
    }

    /* JADX WARN: Code restructure failed: missing block: B:12:0x0027, code lost:
    
        if (((java.lang.Boolean) r4.q.getValue()).booleanValue() == false) goto L32;
     */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final void q() {
        /*
            r7 = this;
            o.q90 r0 = o.BP.o()
            r1 = 0
            if (r0 == 0) goto Lc
            o.OC r2 = r0.e()
            goto Ld
        Lc:
            r2 = r1
        Ld:
            o.q90 r3 = o.BP.q(r0)
            boolean r4 = r7.j()     // Catch: java.lang.Throwable -> L6d
            if (r4 == 0) goto L6f
            o.MK r4 = r7.d     // Catch: java.lang.Throwable -> L6d
            if (r4 == 0) goto L2a
            o.MV r4 = r4.q     // Catch: java.lang.Throwable -> L6d
            java.lang.Object r4 = r4.getValue()     // Catch: java.lang.Throwable -> L6d
            java.lang.Boolean r4 = (java.lang.Boolean) r4     // Catch: java.lang.Throwable -> L6d
            boolean r4 = r4.booleanValue()     // Catch: java.lang.Throwable -> L6d
            if (r4 != 0) goto L2a
            goto L6f
        L2a:
            o.BP.t(r0, r3, r2)
            o.WT r0 = r7.y
            java.lang.Object r0 = r0.m
            o.vd0 r0 = (o.C2728vd0) r0
            if (r0 == 0) goto L62
            boolean r2 = r0.y
            if (r2 == 0) goto L61
            o.oa0 r2 = r0.F
            r3 = 1
            if (r2 == 0) goto L45
            boolean r2 = r2.b()
            if (r2 != r3) goto L45
            goto L61
        L45:
            o.cl r2 = o.AbstractC2348rd0.b
            java.lang.Object r2 = o.AbstractC2461sm0.j(r0, r2)
            o.qd0 r2 = (o.InterfaceC2254qd0) r2
            if (r2 != 0) goto L50
            goto L61
        L50:
            o.Cn r4 = r0.v0()
            o.t r5 = new o.t
            r6 = 24
            r5.<init>(r0, r2, r1, r6)
            o.oa0 r1 = o.AbstractC1692kh0.C(r4, r1, r5, r3)
            r0.F = r1
        L61:
            return
        L62:
            java.lang.String r0 = "ToolbarRequester is not initialized."
            o.AbstractC2417sH.d(r0)
            o.pj r0 = new o.pj
            r0.<init>()
            throw r0
        L6d:
            r1 = move-exception
            goto L73
        L6f:
            o.BP.t(r0, r3, r2)
            return
        L73:
            o.BP.t(r0, r3, r2)
            throw r1
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C2066oe0.q():void");
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x0013  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public final java.lang.Object r(o.AbstractC0298Lm r5) {
        /*
            r4 = this;
            boolean r0 = r5 instanceof o.C1971ne0
            if (r0 == 0) goto L13
            r0 = r5
            o.ne0 r0 = (o.C1971ne0) 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.ne0 r0 = new o.ne0
            r0.<init>(r4, r5)
        L18:
            java.lang.Object r5 = r0.p
            int r1 = r0.r
            r2 = 1
            if (r1 == 0) goto L2f
            if (r1 != r2) goto L27
            o.oe0 r0 = r0.f651o
            o.IJ.H(r5)
            goto L55
        L27:
            java.lang.IllegalStateException r5 = new java.lang.IllegalStateException
            java.lang.String r0 = "call to 'resume' before 'invoke' with coroutine"
            r5.<init>(r0)
            throw r5
        L2f:
            o.IJ.H(r5)
            o.ji r5 = r4.h
            r1 = 0
            if (r5 == 0) goto L59
            r0.f651o = r4
            r0.r = r2
            o.X2 r5 = (o.X2) r5
            o.Y2 r5 = r5.a
            android.content.ClipboardManager r5 = r5.a
            android.content.ClipData r5 = r5.getPrimaryClip()
            if (r5 == 0) goto L4e
            o.hi r0 = new o.hi
            r0.<init>(r5)
            r5 = r0
            goto L4f
        L4e:
            r5 = r1
        L4f:
            o.Dn r0 = o.EnumC0091Dn.l
            if (r5 != r0) goto L54
            return r0
        L54:
            r0 = r4
        L55:
            r1 = r5
            o.hi r1 = (o.C1408hi) r1
            goto L5a
        L59:
            r0 = r4
        L5a:
            o.MV r5 = r0.x
            r5.setValue(r1)
            o.Oh0 r5 = o.Oh0.a
            return r5
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C2066oe0.r(o.Lm):java.lang.Object");
    }

    public final void s(boolean z) {
        MK mk = this.d;
        if (mk != null) {
            mk.l.setValue(Boolean.valueOf(z));
        }
        if (z) {
            q();
        } else {
            n();
        }
    }
}
