package androidx.lifecycle; import d0.l; import d0.w.h.c; import d0.w.i.a.e; import d0.w.i.a.k; import d0.z.d.m; import kotlin.Unit; import kotlin.coroutines.Continuation; import kotlin.jvm.functions.Function2; import kotlinx.coroutines.CoroutineDispatcher; import kotlinx.coroutines.CoroutineScope; import s.a.a.n; import s.a.b2.f; import s.a.b2.g; import s.a.k0; import s.a.l1; import s.a.x0; /* compiled from: FlowLiveData.kt */ @e(c = "androidx.lifecycle.FlowLiveDataConversions$asFlow$1", f = "FlowLiveData.kt", l = {96, 100, 101}, m = "invokeSuspend") /* loaded from: classes.dex */ public final class FlowLiveDataConversions$asFlow$1 extends k implements Function2, Continuation, Object> { public final /* synthetic */ LiveData $this_asFlow; private /* synthetic */ Object L$0; public Object L$1; public Object L$2; public int label; /* compiled from: FlowLiveData.kt */ @e(c = "androidx.lifecycle.FlowLiveDataConversions$asFlow$1$1", f = "FlowLiveData.kt", l = {}, m = "invokeSuspend") /* renamed from: androidx.lifecycle.FlowLiveDataConversions$asFlow$1$1 reason: invalid class name */ /* loaded from: classes.dex */ public static final class AnonymousClass1 extends k implements Function2, Object> { public final /* synthetic */ Observer $observer; public int label; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ public AnonymousClass1(Observer observer, Continuation continuation) { super(2, continuation); this.$observer = observer; } @Override // d0.w.i.a.a public final Continuation create(Object obj, Continuation continuation) { m.checkNotNullParameter(continuation, "completion"); return new AnonymousClass1(this.$observer, continuation); } @Override // kotlin.jvm.functions.Function2 public final Object invoke(CoroutineScope coroutineScope, Continuation continuation) { return ((AnonymousClass1) create(coroutineScope, continuation)).invokeSuspend(Unit.a); } @Override // d0.w.i.a.a public final Object invokeSuspend(Object obj) { c.getCOROUTINE_SUSPENDED(); if (this.label == 0) { l.throwOnFailure(obj); FlowLiveDataConversions$asFlow$1.this.$this_asFlow.observeForever(this.$observer); return Unit.a; } throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine"); } } /* compiled from: FlowLiveData.kt */ @e(c = "androidx.lifecycle.FlowLiveDataConversions$asFlow$1$2", f = "FlowLiveData.kt", l = {}, m = "invokeSuspend") /* renamed from: androidx.lifecycle.FlowLiveDataConversions$asFlow$1$2 reason: invalid class name */ /* loaded from: classes.dex */ public static final class AnonymousClass2 extends k implements Function2, Object> { public final /* synthetic */ Observer $observer; public int label; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ public AnonymousClass2(Observer observer, Continuation continuation) { super(2, continuation); this.$observer = observer; } @Override // d0.w.i.a.a public final Continuation create(Object obj, Continuation continuation) { m.checkNotNullParameter(continuation, "completion"); return new AnonymousClass2(this.$observer, continuation); } @Override // kotlin.jvm.functions.Function2 public final Object invoke(CoroutineScope coroutineScope, Continuation continuation) { return ((AnonymousClass2) create(coroutineScope, continuation)).invokeSuspend(Unit.a); } @Override // d0.w.i.a.a public final Object invokeSuspend(Object obj) { c.getCOROUTINE_SUSPENDED(); if (this.label == 0) { l.throwOnFailure(obj); FlowLiveDataConversions$asFlow$1.this.$this_asFlow.removeObserver(this.$observer); return Unit.a; } throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine"); } } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ public FlowLiveDataConversions$asFlow$1(LiveData liveData, Continuation continuation) { super(2, continuation); this.$this_asFlow = liveData; } @Override // d0.w.i.a.a public final Continuation create(Object obj, Continuation continuation) { m.checkNotNullParameter(continuation, "completion"); FlowLiveDataConversions$asFlow$1 flowLiveDataConversions$asFlow$1 = new FlowLiveDataConversions$asFlow$1(this.$this_asFlow, continuation); flowLiveDataConversions$asFlow$1.L$0 = obj; return flowLiveDataConversions$asFlow$1; } @Override // kotlin.jvm.functions.Function2 public final Object invoke(Object obj, Continuation continuation) { return ((FlowLiveDataConversions$asFlow$1) create(obj, continuation)).invokeSuspend(Unit.a); } /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Removed duplicated region for block: B:27:0x0097 A[RETURN] */ /* JADX WARN: Removed duplicated region for block: B:28:0x0098 */ /* JADX WARN: Removed duplicated region for block: B:31:0x00a5 A[Catch: all -> 0x00d4, TRY_LEAVE, TryCatch #0 {all -> 0x00d4, blocks: (B:29:0x009d, B:31:0x00a5), top: B:44:0x009d }] */ /* JADX WARN: Removed duplicated region for block: B:35:0x00bc */ /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:34:0x00b8 -> B:46:0x0089). Please submit an issue!!! */ @Override // d0.w.i.a.a /* Code decompiled incorrectly, please refer to instructions dump. */ public final Object invokeSuspend(Object obj) { s.a.c2.e eVar; f fVar; Observer observer; g it; FlowLiveDataConversions$asFlow$1 flowLiveDataConversions$asFlow$1; Object a; g gVar; s.a.c2.e eVar2; Observer observer2; Object coroutine_suspended = c.getCOROUTINE_SUSPENDED(); int i = this.label; Observer observer3 = 1; try { try { if (i == 0) { l.throwOnFailure(obj); eVar = (s.a.c2.e) this.L$0; f b2 = b.i.a.f.e.o.f.b(-1, null, null, 6); observer = new FlowLiveDataConversions$asFlow$1$observer$1(b2); CoroutineDispatcher coroutineDispatcher = k0.a; l1 H = n.f3802b.H(); AnonymousClass1 r8 = new AnonymousClass1(observer, null); this.L$0 = eVar; this.L$1 = b2; this.L$2 = observer; this.label = 1; if (b.i.a.f.e.o.f.C1(H, r8, this) == coroutine_suspended) { return coroutine_suspended; } fVar = b2; } else if (i != 1) { try { if (i == 2) { gVar = (g) this.L$2; observer2 = (Observer) this.L$1; eVar2 = (s.a.c2.e) this.L$0; l.throwOnFailure(obj); flowLiveDataConversions$asFlow$1 = this; if (!((Boolean) obj).booleanValue()) { } } else if (i == 3) { it = (g) this.L$2; observer3 = (Observer) this.L$1; eVar = (s.a.c2.e) this.L$0; l.throwOnFailure(obj); flowLiveDataConversions$asFlow$1 = this; flowLiveDataConversions$asFlow$1.L$0 = eVar; flowLiveDataConversions$asFlow$1.L$1 = observer3; flowLiveDataConversions$asFlow$1.L$2 = it; flowLiveDataConversions$asFlow$1.label = 2; a = it.a(flowLiveDataConversions$asFlow$1); if (a == coroutine_suspended) { return coroutine_suspended; } gVar = it; obj = a; eVar2 = eVar; observer2 = observer3; try { if (!((Boolean) obj).booleanValue()) { Object next = gVar.next(); flowLiveDataConversions$asFlow$1.L$0 = eVar2; flowLiveDataConversions$asFlow$1.L$1 = observer2; flowLiveDataConversions$asFlow$1.L$2 = gVar; flowLiveDataConversions$asFlow$1.label = 3; if (eVar2.emit(next, flowLiveDataConversions$asFlow$1) == coroutine_suspended) { return coroutine_suspended; } it = gVar; observer3 = observer2; eVar = eVar2; flowLiveDataConversions$asFlow$1.L$0 = eVar; flowLiveDataConversions$asFlow$1.L$1 = observer3; flowLiveDataConversions$asFlow$1.L$2 = it; flowLiveDataConversions$asFlow$1.label = 2; a = it.a(flowLiveDataConversions$asFlow$1); if (a == coroutine_suspended) { } } else { x0 x0Var = x0.j; CoroutineDispatcher coroutineDispatcher2 = k0.a; b.i.a.f.e.o.f.H0(x0Var, n.f3802b.H(), null, new AnonymousClass2(observer2, null), 2, null); return Unit.a; } } catch (Throwable th) { th = th; observer3 = observer2; x0 x0Var2 = x0.j; CoroutineDispatcher coroutineDispatcher3 = k0.a; b.i.a.f.e.o.f.H0(x0Var2, n.f3802b.H(), null, new AnonymousClass2(observer3, null), 2, null); throw th; } } else { throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine"); } } catch (Throwable th2) { th = th2; flowLiveDataConversions$asFlow$1 = this; x0 x0Var22 = x0.j; CoroutineDispatcher coroutineDispatcher32 = k0.a; b.i.a.f.e.o.f.H0(x0Var22, n.f3802b.H(), null, new AnonymousClass2(observer3, null), 2, null); throw th; } } else { observer = (Observer) this.L$2; fVar = (f) this.L$1; eVar = (s.a.c2.e) this.L$0; l.throwOnFailure(obj); } flowLiveDataConversions$asFlow$1.L$0 = eVar; flowLiveDataConversions$asFlow$1.L$1 = observer3; flowLiveDataConversions$asFlow$1.L$2 = it; flowLiveDataConversions$asFlow$1.label = 2; a = it.a(flowLiveDataConversions$asFlow$1); if (a == coroutine_suspended) { } } catch (Throwable th3) { th = th3; x0 x0Var222 = x0.j; CoroutineDispatcher coroutineDispatcher322 = k0.a; b.i.a.f.e.o.f.H0(x0Var222, n.f3802b.H(), null, new AnonymousClass2(observer3, null), 2, null); throw th; } it = fVar.iterator(); observer3 = observer; flowLiveDataConversions$asFlow$1 = this; } catch (Throwable th4) { th = th4; observer3 = observer; flowLiveDataConversions$asFlow$1 = this; x0 x0Var2222 = x0.j; CoroutineDispatcher coroutineDispatcher3222 = k0.a; b.i.a.f.e.o.f.H0(x0Var2222, n.f3802b.H(), null, new AnonymousClass2(observer3, null), 2, null); throw th; } } }