package o;

import androidx.work.impl.WorkDatabase;
import androidx.work.impl.background.systemalarm.RescheduleReceiver;
import java.util.HashSet;
import java.util.Iterator;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.lw, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class RunnableC1816lw implements Runnable {
    public final C1797lm0 l;
    public final C3031ym0 m;

    static {
        C0669Zu.l("EnqueueRunnable");
    }

    public RunnableC1816lw(C1797lm0 c1797lm0) {
        C3031ym0 c3031ym0 = new C3031ym0(1);
        this.l = c1797lm0;
        this.m = c3031ym0;
    }

    /* JADX WARN: Finally extract failed */
    /* JADX WARN: Removed duplicated region for block: B:101:0x0244  */
    /* JADX WARN: Removed duplicated region for block: B:112:0x028d  */
    /* JADX WARN: Removed duplicated region for block: B:119:0x02b7  */
    /* JADX WARN: Removed duplicated region for block: B:155:0x02e1 A[SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:73:0x0159  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
        To view partially-correct add '--show-bad-code' argument
    */
    public static boolean a(o.C1797lm0 r55) throws java.lang.Throwable {
        /*
            Method dump skipped, instructions count: 753
            To view this dump add '--comments-level debug' option
        */
        throw new UnsupportedOperationException("Method not decompiled: o.RunnableC1816lw.a(o.lm0):boolean");
    }

    @Override // java.lang.Runnable
    public final void run() {
        boolean z;
        C3031ym0 c3031ym0 = this.m;
        C1797lm0 c1797lm0 = this.l;
        try {
            c1797lm0.getClass();
            C2651um0 c2651um0 = c1797lm0.x;
            HashSet hashSet = new HashSet();
            hashSet.addAll(c1797lm0.z);
            HashSet hashSetF = C1797lm0.F(c1797lm0);
            Iterator it = hashSet.iterator();
            while (true) {
                if (!it.hasNext()) {
                    hashSet.removeAll(c1797lm0.z);
                    z = false;
                    break;
                } else if (hashSetF.contains((String) it.next())) {
                    z = true;
                    break;
                }
            }
            if (z) {
                throw new IllegalStateException("WorkContinuation has cycles (" + c1797lm0 + ")");
            }
            WorkDatabase workDatabase = c2651um0.m;
            workDatabase.c();
            try {
                YT.m(workDatabase, c2651um0.l, c1797lm0);
                boolean zA = a(c1797lm0);
                workDatabase.n();
                if (zA) {
                    AbstractC1862mV.a(c2651um0.k, RescheduleReceiver.class, true);
                    H40.b(c2651um0.l, c2651um0.m, c2651um0.f748o);
                }
                c3031ym0.a(C3031ym0.f811o);
            } finally {
                workDatabase.j();
            }
        } catch (Throwable th) {
            c3031ym0.a(new C3095zU(th));
        }
    }
}
