package androidx.room; import androidx.room.InvalidationTracker; import java.util.Set; import java.util.concurrent.Callable; import kotlin.ResultKt; import kotlin.Unit; import kotlin.coroutines.Continuation; import kotlin.coroutines.ContinuationInterceptor; import kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsKt; import kotlin.coroutines.jvm.internal.DebugMetadata; import kotlin.coroutines.jvm.internal.SuspendLambda; import kotlin.jvm.functions.Function2; import kotlinx.coroutines.BuildersKt__Builders_commonKt; import kotlinx.coroutines.CoroutineScope; import kotlinx.coroutines.CoroutineScopeKt; import kotlinx.coroutines.channels.Channel; import kotlinx.coroutines.channels.ChannelKt; import kotlinx.coroutines.flow.FlowCollector; import kotlinx.coroutines.flow.FlowKt; @DebugMetadata(c = "androidx.room.CoroutinesRoom$Companion$createFlow$1", f = "CoroutinesRoom.kt", l = {111}, m = "invokeSuspend") /* loaded from: classes.dex */ public final class CoroutinesRoom$Companion$createFlow$1 extends SuspendLambda implements Function2 { final /* synthetic */ Callable $callable; final /* synthetic */ RoomDatabase $db; final /* synthetic */ boolean $inTransaction; final /* synthetic */ String[] $tableNames; private /* synthetic */ Object L$0; int label; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ public CoroutinesRoom$Companion$createFlow$1(boolean z, RoomDatabase roomDatabase, String[] strArr, Callable callable, Continuation continuation) { super(2, continuation); this.$inTransaction = z; this.$db = roomDatabase; this.$tableNames = strArr; this.$callable = callable; } @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl public final Continuation create(Object obj, Continuation continuation) { CoroutinesRoom$Companion$createFlow$1 coroutinesRoom$Companion$createFlow$1 = new CoroutinesRoom$Companion$createFlow$1(this.$inTransaction, this.$db, this.$tableNames, this.$callable, continuation); coroutinesRoom$Companion$createFlow$1.L$0 = obj; return coroutinesRoom$Companion$createFlow$1; } @Override // kotlin.jvm.functions.Function2 public final Object invoke(FlowCollector flowCollector, Continuation continuation) { return ((CoroutinesRoom$Companion$createFlow$1) create(flowCollector, continuation)).invokeSuspend(Unit.INSTANCE); } @DebugMetadata(c = "androidx.room.CoroutinesRoom$Companion$createFlow$1$1", f = "CoroutinesRoom.kt", l = {137}, m = "invokeSuspend") /* renamed from: androidx.room.CoroutinesRoom$Companion$createFlow$1$1, reason: invalid class name */ public static final class AnonymousClass1 extends SuspendLambda implements Function2 { final /* synthetic */ FlowCollector $$this$flow; final /* synthetic */ Callable $callable; final /* synthetic */ RoomDatabase $db; final /* synthetic */ boolean $inTransaction; final /* synthetic */ String[] $tableNames; private /* synthetic */ Object L$0; int label; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ public AnonymousClass1(boolean z, RoomDatabase roomDatabase, FlowCollector flowCollector, String[] strArr, Callable callable, Continuation continuation) { super(2, continuation); this.$inTransaction = z; this.$db = roomDatabase; this.$$this$flow = flowCollector; this.$tableNames = strArr; this.$callable = callable; } @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl public final Continuation create(Object obj, Continuation continuation) { AnonymousClass1 anonymousClass1 = new AnonymousClass1(this.$inTransaction, this.$db, this.$$this$flow, this.$tableNames, this.$callable, continuation); anonymousClass1.L$0 = obj; return anonymousClass1; } @Override // kotlin.jvm.functions.Function2 public final Object invoke(CoroutineScope coroutineScope, Continuation continuation) { return ((AnonymousClass1) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE); } /* JADX WARN: Type inference failed for: r7v0, types: [androidx.room.CoroutinesRoom$Companion$createFlow$1$1$observer$1] */ @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl public final Object invokeSuspend(Object obj) { Object coroutine_suspended; ContinuationInterceptor transactionDispatcher; coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED(); int i = this.label; if (i == 0) { ResultKt.throwOnFailure(obj); CoroutineScope coroutineScope = (CoroutineScope) this.L$0; final Channel Channel$default = ChannelKt.Channel$default(-1, null, null, 6, null); final String[] strArr = this.$tableNames; ?? r7 = new InvalidationTracker.Observer(strArr) { // from class: androidx.room.CoroutinesRoom$Companion$createFlow$1$1$observer$1 @Override // androidx.room.InvalidationTracker.Observer public void onInvalidated(Set set) { Channel$default.mo4126trySendJP2dKIU(Unit.INSTANCE); } }; Channel$default.mo4126trySendJP2dKIU(Unit.INSTANCE); TransactionElement transactionElement = (TransactionElement) coroutineScope.getCoroutineContext().get(TransactionElement.Key); if (transactionElement == null || (transactionDispatcher = transactionElement.getTransactionDispatcher$room_ktx_release()) == null) { transactionDispatcher = this.$inTransaction ? CoroutinesRoomKt.getTransactionDispatcher(this.$db) : CoroutinesRoomKt.getQueryDispatcher(this.$db); } Channel Channel$default2 = ChannelKt.Channel$default(0, null, null, 7, null); BuildersKt__Builders_commonKt.launch$default(coroutineScope, transactionDispatcher, null, new C00051(this.$db, r7, Channel$default, this.$callable, Channel$default2, null), 2, null); FlowCollector flowCollector = this.$$this$flow; this.label = 1; if (FlowKt.emitAll(flowCollector, Channel$default2, this) == coroutine_suspended) { return coroutine_suspended; } } else { if (i != 1) { throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine"); } ResultKt.throwOnFailure(obj); } return Unit.INSTANCE; } @DebugMetadata(c = "androidx.room.CoroutinesRoom$Companion$createFlow$1$1$1", f = "CoroutinesRoom.kt", l = {128, 130}, m = "invokeSuspend") /* renamed from: androidx.room.CoroutinesRoom$Companion$createFlow$1$1$1, reason: invalid class name and collision with other inner class name */ public static final class C00051 extends SuspendLambda implements Function2 { final /* synthetic */ Callable $callable; final /* synthetic */ RoomDatabase $db; final /* synthetic */ CoroutinesRoom$Companion$createFlow$1$1$observer$1 $observer; final /* synthetic */ Channel $observerChannel; final /* synthetic */ Channel $resultChannel; Object L$0; int label; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ public C00051(RoomDatabase roomDatabase, CoroutinesRoom$Companion$createFlow$1$1$observer$1 coroutinesRoom$Companion$createFlow$1$1$observer$1, Channel channel, Callable callable, Channel channel2, Continuation continuation) { super(2, continuation); this.$db = roomDatabase; this.$observer = coroutinesRoom$Companion$createFlow$1$1$observer$1; this.$observerChannel = channel; this.$callable = callable; this.$resultChannel = channel2; } @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl public final Continuation create(Object obj, Continuation continuation) { return new C00051(this.$db, this.$observer, this.$observerChannel, this.$callable, this.$resultChannel, continuation); } @Override // kotlin.jvm.functions.Function2 public final Object invoke(CoroutineScope coroutineScope, Continuation continuation) { return ((C00051) create(coroutineScope, continuation)).invokeSuspend(Unit.INSTANCE); } /* JADX WARN: Removed duplicated region for block: B:13:0x004b A[RETURN] */ /* JADX WARN: Removed duplicated region for block: B:15:0x004c */ /* JADX WARN: Removed duplicated region for block: B:18:0x0057 A[Catch: all -> 0x006f, TRY_LEAVE, TryCatch #1 {all -> 0x006f, blocks: (B:11:0x0041, B:16:0x004f, B:18:0x0057), top: B:10:0x0041 }] */ /* JADX WARN: Removed duplicated region for block: B:22:0x0071 */ /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:21:0x006d -> B:10:0x0041). Please report as a decompilation issue!!! */ @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public final java.lang.Object invokeSuspend(java.lang.Object r8) { /* r7 = this; java.lang.Object r0 = kotlin.coroutines.intrinsics.IntrinsicsKt.getCOROUTINE_SUSPENDED() int r1 = r7.label r2 = 2 r3 = 1 if (r1 == 0) goto L2c if (r1 == r3) goto L22 if (r1 != r2) goto L1a java.lang.Object r1 = r7.L$0 kotlinx.coroutines.channels.ChannelIterator r1 = (kotlinx.coroutines.channels.ChannelIterator) r1 kotlin.ResultKt.throwOnFailure(r8) // Catch: java.lang.Throwable -> L17 r8 = r1 goto L40 L17: r8 = move-exception r1 = r7 goto L7f L1a: java.lang.IllegalStateException r8 = new java.lang.IllegalStateException java.lang.String r0 = "call to 'resume' before 'invoke' with coroutine" r8.(r0) throw r8 L22: java.lang.Object r1 = r7.L$0 kotlinx.coroutines.channels.ChannelIterator r1 = (kotlinx.coroutines.channels.ChannelIterator) r1 kotlin.ResultKt.throwOnFailure(r8) // Catch: java.lang.Throwable -> L17 r4 = r1 r1 = r7 goto L4f L2c: kotlin.ResultKt.throwOnFailure(r8) androidx.room.RoomDatabase r8 = r7.$db androidx.room.InvalidationTracker r8 = r8.getInvalidationTracker() androidx.room.CoroutinesRoom$Companion$createFlow$1$1$observer$1 r1 = r7.$observer r8.addObserver(r1) kotlinx.coroutines.channels.Channel r8 = r7.$observerChannel // Catch: java.lang.Throwable -> L17 kotlinx.coroutines.channels.ChannelIterator r8 = r8.iterator() // Catch: java.lang.Throwable -> L17 L40: r1 = r7 L41: r1.L$0 = r8 // Catch: java.lang.Throwable -> L6f r1.label = r3 // Catch: java.lang.Throwable -> L6f java.lang.Object r4 = r8.hasNext(r1) // Catch: java.lang.Throwable -> L6f if (r4 != r0) goto L4c return r0 L4c: r6 = r4 r4 = r8 r8 = r6 L4f: java.lang.Boolean r8 = (java.lang.Boolean) r8 // Catch: java.lang.Throwable -> L6f boolean r8 = r8.booleanValue() // Catch: java.lang.Throwable -> L6f if (r8 == 0) goto L71 r4.next() // Catch: java.lang.Throwable -> L6f java.util.concurrent.Callable r8 = r1.$callable // Catch: java.lang.Throwable -> L6f java.lang.Object r8 = r8.call() // Catch: java.lang.Throwable -> L6f kotlinx.coroutines.channels.Channel r5 = r1.$resultChannel // Catch: java.lang.Throwable -> L6f r1.L$0 = r4 // Catch: java.lang.Throwable -> L6f r1.label = r2 // Catch: java.lang.Throwable -> L6f java.lang.Object r8 = r5.send(r8, r1) // Catch: java.lang.Throwable -> L6f if (r8 != r0) goto L6d return r0 L6d: r8 = r4 goto L41 L6f: r8 = move-exception goto L7f L71: androidx.room.RoomDatabase r8 = r1.$db androidx.room.InvalidationTracker r8 = r8.getInvalidationTracker() androidx.room.CoroutinesRoom$Companion$createFlow$1$1$observer$1 r0 = r1.$observer r8.removeObserver(r0) kotlin.Unit r8 = kotlin.Unit.INSTANCE return r8 L7f: androidx.room.RoomDatabase r0 = r1.$db androidx.room.InvalidationTracker r0 = r0.getInvalidationTracker() androidx.room.CoroutinesRoom$Companion$createFlow$1$1$observer$1 r1 = r1.$observer r0.removeObserver(r1) throw r8 */ throw new UnsupportedOperationException("Method not decompiled: androidx.room.CoroutinesRoom$Companion$createFlow$1.AnonymousClass1.C00051.invokeSuspend(java.lang.Object):java.lang.Object"); } } } @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl public final Object invokeSuspend(Object obj) { Object coroutine_suspended; coroutine_suspended = IntrinsicsKt__IntrinsicsKt.getCOROUTINE_SUSPENDED(); int i = this.label; if (i == 0) { ResultKt.throwOnFailure(obj); AnonymousClass1 anonymousClass1 = new AnonymousClass1(this.$inTransaction, this.$db, (FlowCollector) this.L$0, this.$tableNames, this.$callable, null); this.label = 1; if (CoroutineScopeKt.coroutineScope(anonymousClass1, this) == coroutine_suspended) { return coroutine_suspended; } } else { if (i != 1) { throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine"); } ResultKt.throwOnFailure(obj); } return Unit.INSTANCE; } }