package o;

import android.content.Context;
import android.database.Cursor;
import android.graphics.Typeface;
import android.os.Handler;
import android.os.Looper;
import androidx.work.impl.WorkDatabase_Impl;
import com.google.android.gms.common.api.Api;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.ExecutorService;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.oc0, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C2062oc0 {
    public final Object a;
    public Object b;
    public Object c;
    public Object d;

    public /* synthetic */ C2062oc0(Object obj, Object obj2, Object obj3, Object obj4) {
        this.a = obj;
        this.b = obj2;
        this.c = obj3;
        this.d = obj4;
    }

    public void a(Object obj, ArrayList arrayList, HashSet hashSet) {
        if (arrayList.contains(obj)) {
            return;
        }
        if (hashSet.contains(obj)) {
            throw new RuntimeException("This graph contains cyclic dependencies");
        }
        hashSet.add(obj);
        ArrayList arrayList2 = (ArrayList) ((I80) this.b).get(obj);
        if (arrayList2 != null) {
            int size = arrayList2.size();
            for (int i = 0; i < size; i++) {
                a(arrayList2.get(i), arrayList, hashSet);
            }
        }
        hashSet.remove(obj);
        arrayList.add(obj);
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x0017  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public java.lang.Object b(o.AbstractC0298Lm r7) {
        /*
            r6 = this;
            java.lang.Object r0 = r6.d
            o.Bp r0 = (o.C0041Bp) r0
            boolean r1 = r7 instanceof o.C1422hp
            if (r1 == 0) goto L17
            r1 = r7
            o.hp r1 = (o.C1422hp) r1
            int r2 = r1.r
            r3 = -2147483648(0xffffffff80000000, float:-0.0)
            r4 = r2 & r3
            if (r4 == 0) goto L17
            int r2 = r2 - r3
            r1.r = r2
            goto L1c
        L17:
            o.hp r1 = new o.hp
            r1.<init>(r6, r7)
        L1c:
            java.lang.Object r7 = r1.p
            int r2 = r1.r
            r3 = 2
            r4 = 1
            if (r2 == 0) goto L3c
            if (r2 == r4) goto L36
            if (r2 != r3) goto L2e
            o.oc0 r0 = r1.f570o
            o.IJ.H(r7)
            goto L64
        L2e:
            java.lang.IllegalStateException r7 = new java.lang.IllegalStateException
            java.lang.String r0 = "call to 'resume' before 'invoke' with coroutine"
            r7.<init>(r0)
            throw r7
        L36:
            o.oc0 r0 = r1.f570o
            o.IJ.H(r7)
            goto L74
        L3c:
            o.IJ.H(r7)
            java.lang.Object r7 = r6.c
            java.util.List r7 = (java.util.List) r7
            o.Dn r2 = o.EnumC0091Dn.l
            if (r7 == 0) goto L67
            boolean r7 = r7.isEmpty()
            if (r7 == 0) goto L4e
            goto L67
        L4e:
            o.lI r7 = r0.h()
            o.kp r4 = new o.kp
            r5 = 0
            r4.<init>(r0, r6, r5)
            r1.f570o = r6
            r1.r = r3
            java.lang.Object r7 = r7.a(r4, r1)
            if (r7 != r2) goto L63
            goto L72
        L63:
            r0 = r6
        L64:
            o.Xo r7 = (o.C0611Xo) r7
            goto L76
        L67:
            r1.f570o = r6
            r1.r = r4
            r7 = 0
            java.lang.Object r7 = o.C0041Bp.g(r0, r7, r1)
            if (r7 != r2) goto L73
        L72:
            return r2
        L73:
            r0 = r6
        L74:
            o.Xo r7 = (o.C0611Xo) r7
        L76:
            java.lang.Object r0 = r0.d
            o.Bp r0 = (o.C0041Bp) r0
            o.Jn r0 = r0.h
            r0.x(r7)
            o.Oh0 r7 = o.Oh0.a
            return r7
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C2062oc0.b(o.Lm):java.lang.Object");
    }

    public void c(Runnable runnable) {
        ((E7) this.a).execute(runnable);
    }

    public C1872mc0 d(C2366rm0 c2366rm0) {
        String str = c2366rm0.a;
        int i = c2366rm0.b;
        WorkDatabase_Impl workDatabase_Impl = (WorkDatabase_Impl) this.a;
        C1449i30 c1449i30D = C1449i30.d(2, "SELECT * FROM SystemIdInfo WHERE work_spec_id=? AND generation=?");
        if (str == null) {
            c1449i30D.r(1);
        } else {
            c1449i30D.k(1, str);
        }
        c1449i30D.B(2, i);
        workDatabase_Impl.b();
        Cursor cursorL = workDatabase_Impl.l(c1449i30D);
        try {
            int iB = Co0.B(cursorL, "work_spec_id");
            int iB2 = Co0.B(cursorL, "generation");
            int iB3 = Co0.B(cursorL, "system_id");
            C1872mc0 c1872mc0 = null;
            String string = null;
            if (cursorL.moveToFirst()) {
                if (!cursorL.isNull(iB)) {
                    string = cursorL.getString(iB);
                }
                c1872mc0 = new C1872mc0(cursorL.getInt(iB2), string, cursorL.getInt(iB3));
            }
            return c1872mc0;
        } finally {
            cursorL.close();
            c1449i30D.release();
        }
    }

    public Y6 e(long j, Y6 y6, Y6 y62) {
        if (((Y6) this.c) == null) {
            this.c = y6.c();
        }
        Y6 y63 = (Y6) this.c;
        if (y63 == null) {
            y63 = null;
        }
        int iB = y63.b();
        for (int i = 0; i < iB; i++) {
            Y6 y64 = (Y6) this.c;
            if (y64 == null) {
                y64 = null;
            }
            WT wt = (WT) this.a;
            y6.getClass();
            long j2 = j / 1000000;
            C1152ez c1152ezA = ((C1248fz) wt.m).a(y62.a(i));
            long j3 = c1152ezA.c;
            y64.e(i, (((Math.signum(c1152ezA.a) * AbstractC2114p4.a(j3 > 0 ? j2 / j3 : 1.0f).b) * c1152ezA.b) / j3) * 1000.0f);
        }
        Y6 y65 = (Y6) this.c;
        if (y65 == null) {
            return null;
        }
        return y65;
    }

    public void f(C1872mc0 c1872mc0) {
        WorkDatabase_Impl workDatabase_Impl = (WorkDatabase_Impl) this.a;
        workDatabase_Impl.b();
        workDatabase_Impl.c();
        try {
            ((C2945xr) this.b).e(c1872mc0);
            workDatabase_Impl.n();
        } finally {
            workDatabase_Impl.j();
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:7:0x0013  */
    /* JADX WARN: Type inference failed for: r1v0, types: [int] */
    /* JADX WARN: Type inference failed for: r1v1 */
    /* JADX WARN: Type inference failed for: r1v10, types: [o.qR] */
    /* JADX WARN: Type inference failed for: r1v14 */
    /* JADX WARN: Type inference failed for: r1v15 */
    /* JADX WARN: Type inference failed for: r1v9 */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public java.lang.Object g(o.AbstractC0298Lm r9) {
        /*
            r8 = this;
            boolean r0 = r9 instanceof o.F30
            if (r0 == 0) goto L13
            r0 = r9
            o.F30 r0 = (o.F30) r0
            int r1 = r0.s
            r2 = -2147483648(0xffffffff80000000, float:-0.0)
            r3 = r1 & r2
            if (r3 == 0) goto L13
            int r1 = r1 - r2
            r0.s = r1
            goto L18
        L13:
            o.F30 r0 = new o.F30
            r0.<init>(r8, r9)
        L18:
            java.lang.Object r9 = r0.q
            int r1 = r0.s
            r2 = 2
            r3 = 1
            o.Oh0 r4 = o.Oh0.a
            r5 = 0
            o.Dn r6 = o.EnumC0091Dn.l
            if (r1 == 0) goto L43
            if (r1 == r3) goto L3b
            if (r1 != r2) goto L33
            o.qR r1 = r0.p
            o.oc0 r0 = r0.f111o
            o.IJ.H(r9)     // Catch: java.lang.Throwable -> L31
            goto L90
        L31:
            r9 = move-exception
            goto L98
        L33:
            java.lang.IllegalStateException r9 = new java.lang.IllegalStateException
            java.lang.String r0 = "call to 'resume' before 'invoke' with coroutine"
            r9.<init>(r0)
            throw r9
        L3b:
            o.qR r1 = r0.p
            o.oc0 r3 = r0.f111o
            o.IJ.H(r9)
            goto L6b
        L43:
            o.IJ.H(r9)
            java.lang.Object r9 = r8.b
            o.lj r9 = (o.C1790lj) r9
            r9.getClass()
            java.util.concurrent.atomic.AtomicReferenceFieldUpdater r1 = o.C1375hJ.l
            java.lang.Object r9 = r1.get(r9)
            boolean r9 = r9 instanceof o.WG
            if (r9 != 0) goto L58
            return r4
        L58:
            java.lang.Object r9 = r8.a
            o.sR r9 = (o.C2427sR) r9
            r0.f111o = r8
            r0.p = r9
            r0.s = r3
            java.lang.Object r1 = r9.d(r0)
            if (r1 != r6) goto L69
            goto L8e
        L69:
            r3 = r8
            r1 = r9
        L6b:
            java.lang.Object r9 = r3.b     // Catch: java.lang.Throwable -> L31
            o.lj r9 = (o.C1790lj) r9     // Catch: java.lang.Throwable -> L31
            r9.getClass()     // Catch: java.lang.Throwable -> L31
            java.util.concurrent.atomic.AtomicReferenceFieldUpdater r7 = o.C1375hJ.l     // Catch: java.lang.Throwable -> L31
            java.lang.Object r9 = r7.get(r9)     // Catch: java.lang.Throwable -> L31
            boolean r9 = r9 instanceof o.WG     // Catch: java.lang.Throwable -> L31
            if (r9 != 0) goto L82
        L7c:
            o.sR r1 = (o.C2427sR) r1
            r1.f(r5)
            return r4
        L82:
            r0.f111o = r3     // Catch: java.lang.Throwable -> L31
            r0.p = r1     // Catch: java.lang.Throwable -> L31
            r0.s = r2     // Catch: java.lang.Throwable -> L31
            java.lang.Object r9 = r3.b(r0)     // Catch: java.lang.Throwable -> L31
            if (r9 != r6) goto L8f
        L8e:
            return r6
        L8f:
            r0 = r3
        L90:
            java.lang.Object r9 = r0.b     // Catch: java.lang.Throwable -> L31
            o.lj r9 = (o.C1790lj) r9     // Catch: java.lang.Throwable -> L31
            r9.X(r4)     // Catch: java.lang.Throwable -> L31
            goto L7c
        L98:
            o.sR r1 = (o.C2427sR) r1
            r1.f(r5)
            throw r9
        */
        throw new UnsupportedOperationException("Method not decompiled: o.C2062oc0.g(o.Lm):java.lang.Object");
    }

    public InterfaceC1991no0 h(InterfaceC1991no0 interfaceC1991no0) {
        return ((C3031ym0) this.b).h(this, interfaceC1991no0);
    }

    public InterfaceC1991no0 i(Pn0 pn0) {
        InterfaceC1991no0 interfaceC1991no0H = InterfaceC1991no0.d;
        Iterator itK = pn0.k();
        while (itK.hasNext()) {
            interfaceC1991no0H = ((C3031ym0) this.b).h(this, pn0.m(((Integer) itK.next()).intValue()));
            if (interfaceC1991no0H instanceof Un0) {
                break;
            }
        }
        return interfaceC1991no0H;
    }

    public C2062oc0 j() {
        return new C2062oc0(this, (C3031ym0) this.b);
    }

    public boolean k(String str) {
        if (((HashMap) this.c).containsKey(str)) {
            return true;
        }
        C2062oc0 c2062oc0 = (C2062oc0) this.a;
        if (c2062oc0 != null) {
            return c2062oc0.k(str);
        }
        return false;
    }

    public void l(String str, InterfaceC1991no0 interfaceC1991no0) {
        C2062oc0 c2062oc0;
        HashMap map = (HashMap) this.c;
        if (!map.containsKey(str) && (c2062oc0 = (C2062oc0) this.a) != null && c2062oc0.k(str)) {
            c2062oc0.l(str, interfaceC1991no0);
        } else {
            if (((HashMap) this.d).containsKey(str)) {
                return;
            }
            if (interfaceC1991no0 == null) {
                map.remove(str);
            } else {
                map.put(str, interfaceC1991no0);
            }
        }
    }

    public void m(String str, InterfaceC1991no0 interfaceC1991no0) {
        HashMap map = (HashMap) this.c;
        if (((HashMap) this.d).containsKey(str)) {
            return;
        }
        if (interfaceC1991no0 == null) {
            map.remove(str);
        } else {
            map.put(str, interfaceC1991no0);
        }
    }

    public InterfaceC1991no0 n(String str) {
        HashMap map = (HashMap) this.c;
        if (map.containsKey(str)) {
            return (InterfaceC1991no0) map.get(str);
        }
        C2062oc0 c2062oc0 = (C2062oc0) this.a;
        if (c2062oc0 != null) {
            return c2062oc0.n(str);
        }
        throw new IllegalArgumentException(AbstractC2462sn.i(str, " is not defined"));
    }

    public C2062oc0(C2062oc0 c2062oc0, C3031ym0 c3031ym0) {
        this.c = new HashMap();
        this.d = new HashMap();
        this.a = c2062oc0;
        this.b = c3031ym0;
    }

    public C2062oc0(C0168Gm c0168Gm, C2769w c2769w, C2105p c2105p) {
        this.a = c0168Gm;
        this.b = c2105p;
        this.c = AbstractC2841wm0.a(Api.BaseClientBuilder.API_PRIORITY_OTHER, 0, 6);
        this.d = new OD(14);
        TI ti = (TI) c0168Gm.l.m(C0669Zu.K);
        if (ti != null) {
            ti.d(new K3(15, c2769w, this));
        }
    }

    public C2062oc0(WorkDatabase_Impl workDatabase_Impl) {
        this.a = workDatabase_Impl;
        this.b = new C2945xr(workDatabase_Impl, 2);
        this.c = new C1967nc0(workDatabase_Impl, 0);
        this.d = new C1967nc0(workDatabase_Impl, 1);
    }

    public C2062oc0(Context context, C2062oc0 c2062oc0) {
        C3012yd c3012yd = new C3012yd(context.getApplicationContext(), c2062oc0, 0);
        C3012yd c3012yd2 = new C3012yd(context.getApplicationContext(), c2062oc0, 1);
        Context applicationContext = context.getApplicationContext();
        int i = AbstractC1192fS.a;
        C1096eS c1096eS = new C1096eS(applicationContext, c2062oc0);
        C3012yd c3012yd3 = new C3012yd(context.getApplicationContext(), c2062oc0, 2);
        this.a = c3012yd;
        this.b = c3012yd2;
        this.c = c1096eS;
        this.d = c3012yd3;
    }

    public C2062oc0() {
        this.a = new RX(10);
        this.b = new I80(0);
        this.c = new ArrayList();
        this.d = new HashSet();
    }

    public C2062oc0(ExecutorService executorService) {
        this.c = new Handler(Looper.getMainLooper());
        this.d = new ExecutorC1921n20(2, this);
        E7 e7 = new E7(executorService);
        this.a = e7;
        this.b = new C0768ax(e7);
    }

    public C2062oc0(Typeface typeface, C3090zP c3090zP) {
        int i;
        int i2;
        int i3;
        int i4;
        this.d = typeface;
        this.a = c3090zP;
        this.c = new AP(1024);
        int iA = c3090zP.a(6);
        if (iA != 0) {
            int i5 = iA + c3090zP.l;
            i = ((ByteBuffer) c3090zP.f756o).getInt(((ByteBuffer) c3090zP.f756o).getInt(i5) + i5);
        } else {
            i = 0;
        }
        this.b = new char[i * 2];
        int iA2 = c3090zP.a(6);
        if (iA2 != 0) {
            int i6 = iA2 + c3090zP.l;
            i2 = ((ByteBuffer) c3090zP.f756o).getInt(((ByteBuffer) c3090zP.f756o).getInt(i6) + i6);
        } else {
            i2 = 0;
        }
        for (int i7 = 0; i7 < i2; i7++) {
            C2641uh0 c2641uh0 = new C2641uh0(this, i7);
            C2995yP c2995yPB = c2641uh0.b();
            int iA3 = c2995yPB.a(4);
            Character.toChars(iA3 != 0 ? ((ByteBuffer) c2995yPB.f756o).getInt(iA3 + c2995yPB.l) : 0, (char[]) this.b, i7 * 2);
            C2995yP c2995yPB2 = c2641uh0.b();
            int iA4 = c2995yPB2.a(16);
            if (iA4 != 0) {
                int i8 = iA4 + c2995yPB2.l;
                i3 = ((ByteBuffer) c2995yPB2.f756o).getInt(((ByteBuffer) c2995yPB2.f756o).getInt(i8) + i8);
            } else {
                i3 = 0;
            }
            AbstractC0249Jp.v("invalid metadata codepoint length", i3 > 0);
            AP ap = (AP) this.c;
            C2995yP c2995yPB3 = c2641uh0.b();
            int iA5 = c2995yPB3.a(16);
            if (iA5 != 0) {
                int i9 = iA5 + c2995yPB3.l;
                i4 = ((ByteBuffer) c2995yPB3.f756o).getInt(((ByteBuffer) c2995yPB3.f756o).getInt(i9) + i9);
            } else {
                i4 = 0;
            }
            ap.a(c2641uh0, 0, i4 - 1);
        }
    }

    public C2062oc0(WT wt) {
        this.a = wt;
    }

    public C2062oc0(C0041Bp c0041Bp, List list) {
        this.d = c0041Bp;
        this.a = C1884mi0.d();
        C1790lj c1790lj = new C1790lj(true);
        c1790lj.U(null);
        this.b = c1790lj;
        this.c = AbstractC3117zi.t0(list);
    }
}
