package androidx.lifecycle; import androidx.lifecycle.Lifecycle; import d0.w.f; import d0.w.g.b; import d0.w.g.c; import d0.w.h.a.g; import d0.z.d.l; import d0.z.d.m; import kotlin.coroutines.Continuation; import kotlin.jvm.functions.Function0; import kotlinx.coroutines.CoroutineDispatcher; import s.a.a.n; import s.a.j0; import s.a.k; import s.a.k1; /* compiled from: WithLifecycleState.kt */ public final class WithLifecycleStateKt { public static final Object suspendWithStateAtLeastUnchecked(Lifecycle lifecycle, Lifecycle.State state, boolean z2, CoroutineDispatcher coroutineDispatcher, Function0 function0, Continuation continuation) { k kVar = new k(b.intercepted(continuation), 1); kVar.A(); WithLifecycleStateKt$suspendWithStateAtLeastUnchecked$$inlined$suspendCancellableCoroutine$lambda$1 withLifecycleStateKt$suspendWithStateAtLeastUnchecked$$inlined$suspendCancellableCoroutine$lambda$1 = new WithLifecycleStateKt$suspendWithStateAtLeastUnchecked$$inlined$suspendCancellableCoroutine$lambda$1(kVar, lifecycle, state, function0, z2, coroutineDispatcher); if (z2) { coroutineDispatcher.dispatch(f.i, new WithLifecycleStateKt$suspendWithStateAtLeastUnchecked$$inlined$suspendCancellableCoroutine$lambda$2(withLifecycleStateKt$suspendWithStateAtLeastUnchecked$$inlined$suspendCancellableCoroutine$lambda$1, lifecycle, state, function0, z2, coroutineDispatcher)); } else { lifecycle.addObserver(withLifecycleStateKt$suspendWithStateAtLeastUnchecked$$inlined$suspendCancellableCoroutine$lambda$1); } kVar.e(new WithLifecycleStateKt$suspendWithStateAtLeastUnchecked$$inlined$suspendCancellableCoroutine$lambda$3(withLifecycleStateKt$suspendWithStateAtLeastUnchecked$$inlined$suspendCancellableCoroutine$lambda$1, lifecycle, state, function0, z2, coroutineDispatcher)); Object u = kVar.u(); if (u == c.getCOROUTINE_SUSPENDED()) { g.probeCoroutineSuspended(continuation); } return u; } public static final Object withCreated(Lifecycle lifecycle, Function0 function0, Continuation continuation) { Lifecycle.State state = Lifecycle.State.CREATED; CoroutineDispatcher coroutineDispatcher = j0.a; k1 H = n.b.H(); boolean isDispatchNeeded = H.isDispatchNeeded(continuation.getContext()); if (!isDispatchNeeded) { if (lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) { throw new LifecycleDestroyedException(); } else if (lifecycle.getCurrentState().compareTo(state) >= 0) { return function0.mo1invoke(); } } return suspendWithStateAtLeastUnchecked(lifecycle, state, isDispatchNeeded, H, new WithLifecycleStateKt$withStateAtLeastUnchecked$2(function0), continuation); } public static final Object withCreated(LifecycleOwner lifecycleOwner, Function0 function0, Continuation continuation) { Lifecycle lifecycle = lifecycleOwner.getLifecycle(); m.checkNotNullExpressionValue(lifecycle, "lifecycle"); Lifecycle.State state = Lifecycle.State.CREATED; CoroutineDispatcher coroutineDispatcher = j0.a; k1 H = n.b.H(); boolean isDispatchNeeded = H.isDispatchNeeded(continuation.getContext()); if (!isDispatchNeeded) { if (lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) { throw new LifecycleDestroyedException(); } else if (lifecycle.getCurrentState().compareTo(state) >= 0) { return function0.mo1invoke(); } } return suspendWithStateAtLeastUnchecked(lifecycle, state, isDispatchNeeded, H, new WithLifecycleStateKt$withStateAtLeastUnchecked$2(function0), continuation); } private static final Object withCreated$$forInline(Lifecycle lifecycle, Function0 function0, Continuation continuation) { Lifecycle.State state = Lifecycle.State.CREATED; CoroutineDispatcher coroutineDispatcher = j0.a; n.b.H(); l.mark(3); throw null; } private static final Object withCreated$$forInline(LifecycleOwner lifecycleOwner, Function0 function0, Continuation continuation) { m.checkNotNullExpressionValue(lifecycleOwner.getLifecycle(), "lifecycle"); Lifecycle.State state = Lifecycle.State.CREATED; CoroutineDispatcher coroutineDispatcher = j0.a; n.b.H(); l.mark(3); throw null; } public static final Object withResumed(Lifecycle lifecycle, Function0 function0, Continuation continuation) { Lifecycle.State state = Lifecycle.State.RESUMED; CoroutineDispatcher coroutineDispatcher = j0.a; k1 H = n.b.H(); boolean isDispatchNeeded = H.isDispatchNeeded(continuation.getContext()); if (!isDispatchNeeded) { if (lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) { throw new LifecycleDestroyedException(); } else if (lifecycle.getCurrentState().compareTo(state) >= 0) { return function0.mo1invoke(); } } return suspendWithStateAtLeastUnchecked(lifecycle, state, isDispatchNeeded, H, new WithLifecycleStateKt$withStateAtLeastUnchecked$2(function0), continuation); } public static final Object withResumed(LifecycleOwner lifecycleOwner, Function0 function0, Continuation continuation) { Lifecycle lifecycle = lifecycleOwner.getLifecycle(); m.checkNotNullExpressionValue(lifecycle, "lifecycle"); Lifecycle.State state = Lifecycle.State.RESUMED; CoroutineDispatcher coroutineDispatcher = j0.a; k1 H = n.b.H(); boolean isDispatchNeeded = H.isDispatchNeeded(continuation.getContext()); if (!isDispatchNeeded) { if (lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) { throw new LifecycleDestroyedException(); } else if (lifecycle.getCurrentState().compareTo(state) >= 0) { return function0.mo1invoke(); } } return suspendWithStateAtLeastUnchecked(lifecycle, state, isDispatchNeeded, H, new WithLifecycleStateKt$withStateAtLeastUnchecked$2(function0), continuation); } private static final Object withResumed$$forInline(Lifecycle lifecycle, Function0 function0, Continuation continuation) { Lifecycle.State state = Lifecycle.State.RESUMED; CoroutineDispatcher coroutineDispatcher = j0.a; n.b.H(); l.mark(3); throw null; } private static final Object withResumed$$forInline(LifecycleOwner lifecycleOwner, Function0 function0, Continuation continuation) { m.checkNotNullExpressionValue(lifecycleOwner.getLifecycle(), "lifecycle"); Lifecycle.State state = Lifecycle.State.RESUMED; CoroutineDispatcher coroutineDispatcher = j0.a; n.b.H(); l.mark(3); throw null; } public static final Object withStarted(Lifecycle lifecycle, Function0 function0, Continuation continuation) { Lifecycle.State state = Lifecycle.State.STARTED; CoroutineDispatcher coroutineDispatcher = j0.a; k1 H = n.b.H(); boolean isDispatchNeeded = H.isDispatchNeeded(continuation.getContext()); if (!isDispatchNeeded) { if (lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) { throw new LifecycleDestroyedException(); } else if (lifecycle.getCurrentState().compareTo(state) >= 0) { return function0.mo1invoke(); } } return suspendWithStateAtLeastUnchecked(lifecycle, state, isDispatchNeeded, H, new WithLifecycleStateKt$withStateAtLeastUnchecked$2(function0), continuation); } public static final Object withStarted(LifecycleOwner lifecycleOwner, Function0 function0, Continuation continuation) { Lifecycle lifecycle = lifecycleOwner.getLifecycle(); m.checkNotNullExpressionValue(lifecycle, "lifecycle"); Lifecycle.State state = Lifecycle.State.STARTED; CoroutineDispatcher coroutineDispatcher = j0.a; k1 H = n.b.H(); boolean isDispatchNeeded = H.isDispatchNeeded(continuation.getContext()); if (!isDispatchNeeded) { if (lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) { throw new LifecycleDestroyedException(); } else if (lifecycle.getCurrentState().compareTo(state) >= 0) { return function0.mo1invoke(); } } return suspendWithStateAtLeastUnchecked(lifecycle, state, isDispatchNeeded, H, new WithLifecycleStateKt$withStateAtLeastUnchecked$2(function0), continuation); } private static final Object withStarted$$forInline(Lifecycle lifecycle, Function0 function0, Continuation continuation) { Lifecycle.State state = Lifecycle.State.STARTED; CoroutineDispatcher coroutineDispatcher = j0.a; n.b.H(); l.mark(3); throw null; } private static final Object withStarted$$forInline(LifecycleOwner lifecycleOwner, Function0 function0, Continuation continuation) { m.checkNotNullExpressionValue(lifecycleOwner.getLifecycle(), "lifecycle"); Lifecycle.State state = Lifecycle.State.STARTED; CoroutineDispatcher coroutineDispatcher = j0.a; n.b.H(); l.mark(3); throw null; } public static final Object withStateAtLeast(Lifecycle lifecycle, Lifecycle.State state, Function0 function0, Continuation continuation) { if (state.compareTo(Lifecycle.State.CREATED) >= 0) { CoroutineDispatcher coroutineDispatcher = j0.a; k1 H = n.b.H(); boolean isDispatchNeeded = H.isDispatchNeeded(continuation.getContext()); if (!isDispatchNeeded) { if (lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) { throw new LifecycleDestroyedException(); } else if (lifecycle.getCurrentState().compareTo(state) >= 0) { return function0.mo1invoke(); } } return suspendWithStateAtLeastUnchecked(lifecycle, state, isDispatchNeeded, H, new WithLifecycleStateKt$withStateAtLeastUnchecked$2(function0), continuation); } throw new IllegalArgumentException(("target state must be CREATED or greater, found " + state).toString()); } public static final Object withStateAtLeast(LifecycleOwner lifecycleOwner, Lifecycle.State state, Function0 function0, Continuation continuation) { Lifecycle lifecycle = lifecycleOwner.getLifecycle(); m.checkNotNullExpressionValue(lifecycle, "lifecycle"); if (state.compareTo(Lifecycle.State.CREATED) >= 0) { CoroutineDispatcher coroutineDispatcher = j0.a; k1 H = n.b.H(); boolean isDispatchNeeded = H.isDispatchNeeded(continuation.getContext()); if (!isDispatchNeeded) { if (lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) { throw new LifecycleDestroyedException(); } else if (lifecycle.getCurrentState().compareTo(state) >= 0) { return function0.mo1invoke(); } } return suspendWithStateAtLeastUnchecked(lifecycle, state, isDispatchNeeded, H, new WithLifecycleStateKt$withStateAtLeastUnchecked$2(function0), continuation); } throw new IllegalArgumentException(("target state must be CREATED or greater, found " + state).toString()); } private static final Object withStateAtLeast$$forInline(Lifecycle lifecycle, Lifecycle.State state, Function0 function0, Continuation continuation) { if (!(state.compareTo(Lifecycle.State.CREATED) >= 0)) { throw new IllegalArgumentException(("target state must be CREATED or greater, found " + state).toString()); } CoroutineDispatcher coroutineDispatcher = j0.a; n.b.H(); l.mark(3); throw null; } private static final Object withStateAtLeast$$forInline(LifecycleOwner lifecycleOwner, Lifecycle.State state, Function0 function0, Continuation continuation) { m.checkNotNullExpressionValue(lifecycleOwner.getLifecycle(), "lifecycle"); if (!(state.compareTo(Lifecycle.State.CREATED) >= 0)) { throw new IllegalArgumentException(("target state must be CREATED or greater, found " + state).toString()); } CoroutineDispatcher coroutineDispatcher = j0.a; n.b.H(); l.mark(3); throw null; } public static final Object withStateAtLeastUnchecked(Lifecycle lifecycle, Lifecycle.State state, Function0 function0, Continuation continuation) { CoroutineDispatcher coroutineDispatcher = j0.a; k1 H = n.b.H(); boolean isDispatchNeeded = H.isDispatchNeeded(continuation.getContext()); if (!isDispatchNeeded) { if (lifecycle.getCurrentState() == Lifecycle.State.DESTROYED) { throw new LifecycleDestroyedException(); } else if (lifecycle.getCurrentState().compareTo(state) >= 0) { return function0.mo1invoke(); } } return suspendWithStateAtLeastUnchecked(lifecycle, state, isDispatchNeeded, H, new WithLifecycleStateKt$withStateAtLeastUnchecked$2(function0), continuation); } private static final Object withStateAtLeastUnchecked$$forInline(Lifecycle lifecycle, Lifecycle.State state, Function0 function0, Continuation continuation) { CoroutineDispatcher coroutineDispatcher = j0.a; n.b.H(); l.mark(3); throw null; } }