package androidx.lifecycle;

import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.intrinsics.CoroutineSingletons;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import kotlin.jvm.functions.Function2;

/* JADX INFO: loaded from: classes.dex */
@Metadata(d1 = {"\u0000\b\n\u0000\n\u0002\u0018\u0002\n\u0000\u0010\u0002\u001a\u00028\u0000\"\u0004\b\u0000\u0010\u0000*\u00020\u0001H\u008a@"}, d2 = {"T", "Lkotlinx/coroutines/x;", "<anonymous>"}, k = 3, mv = {1, 8, 0})
@DebugMetadata(c = "androidx.lifecycle.PausingDispatcherKt$whenStateAtLeast$2", f = "PausingDispatcher.jvm.kt", i = {0}, l = {205}, m = "invokeSuspend", n = {"controller"}, s = {"L$0"})
final class PausingDispatcherKt$whenStateAtLeast$2 extends SuspendLambda implements Function2 {
    final /* synthetic */ Function2 $block;
    final /* synthetic */ Lifecycle$State $minState;
    final /* synthetic */ l $this_whenStateAtLeast;
    private /* synthetic */ Object L$0;
    int label;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public PausingDispatcherKt$whenStateAtLeast$2(l lVar, Lifecycle$State lifecycle$State, Function2 function2, Continuation continuation) {
        super(2, continuation);
        this.$this_whenStateAtLeast = lVar;
        this.$minState = lifecycle$State;
        this.$block = function2;
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Continuation create(Object obj, Continuation continuation) {
        PausingDispatcherKt$whenStateAtLeast$2 pausingDispatcherKt$whenStateAtLeast$2 = new PausingDispatcherKt$whenStateAtLeast$2(this.$this_whenStateAtLeast, this.$minState, this.$block, continuation);
        pausingDispatcherKt$whenStateAtLeast$2.L$0 = obj;
        return pausingDispatcherKt$whenStateAtLeast$2;
    }

    @Override // kotlin.jvm.functions.Function2
    public final Object invoke(Object obj, Object obj2) {
        return ((PausingDispatcherKt$whenStateAtLeast$2) create((kotlinx.coroutines.x) obj, (Continuation) obj2)).invokeSuspend(kd.e.f29109a);
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Object invokeSuspend(Object obj) throws Throwable {
        m mVar;
        CoroutineSingletons coroutineSingletons = CoroutineSingletons.f29226a;
        int i10 = this.label;
        if (i10 != 0) {
            if (i10 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            mVar = (m) this.L$0;
            try {
                kotlin.a.d(obj);
                mVar.a();
                return obj;
            } catch (Throwable th) {
                th = th;
                mVar.a();
                throw th;
            }
        }
        kotlin.a.d(obj);
        kotlinx.coroutines.y0 y0Var = (kotlinx.coroutines.y0) ((kotlinx.coroutines.x) this.L$0).getCoroutineContext().m(kotlinx.coroutines.u.f29565b);
        if (y0Var == null) {
            throw new IllegalStateException("when[State] methods should have a parent job".toString());
        }
        y yVar = new y();
        m mVar2 = new m(this.$this_whenStateAtLeast, this.$minState, yVar.f2720c, y0Var);
        try {
            Function2 function2 = this.$block;
            this.L$0 = mVar2;
            this.label = 1;
            obj = hb.a.G0(this, yVar, function2);
            if (obj == coroutineSingletons) {
                return coroutineSingletons;
            }
            mVar = mVar2;
            mVar.a();
            return obj;
        } catch (Throwable th2) {
            th = th2;
            mVar = mVar2;
            mVar.a();
            throw th;
        }
    }
}
