package androidx.datastore.core;

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;
import kotlinx.coroutines.channels.BufferOverflow;

/* JADX INFO: loaded from: classes.dex */
@Metadata(d1 = {"\u0000\f\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\u0010\u0003\u001a\u00020\u0002\"\u0004\b\u0000\u0010\u0000*\u00020\u0001H\u008a@"}, d2 = {"T", "Lkotlinx/coroutines/x;", "Lkd/e;", "<anonymous>"}, k = 3, mv = {1, 8, 0})
@DebugMetadata(c = "androidx.datastore.core.DataStoreImpl$incrementCollector$2$1", f = "DataStoreImpl.kt", i = {}, l = {134, 135}, m = "invokeSuspend", n = {}, s = {})
final class DataStoreImpl$incrementCollector$2$1 extends SuspendLambda implements Function2 {
    int label;
    final /* synthetic */ n this$0;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public DataStoreImpl$incrementCollector$2$1(n nVar, Continuation continuation) {
        super(2, continuation);
        this.this$0 = nVar;
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Continuation create(Object obj, Continuation continuation) {
        return new DataStoreImpl$incrementCollector$2$1(this.this$0, continuation);
    }

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

    /* JADX WARN: Multi-variable type inference failed */
    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Object invokeSuspend(Object obj) throws Throwable {
        CoroutineSingletons coroutineSingletons = CoroutineSingletons.f29226a;
        int i10 = this.label;
        kd.e eVar = kd.e.f29109a;
        if (i10 == 0) {
            kotlin.a.d(obj);
            j jVar = this.this$0.f1940i;
            this.label = 1;
            Object objY = jVar.f1966b.Y(this);
            if (objY != coroutineSingletons) {
                objY = eVar;
            }
            if (objY == coroutineSingletons) {
                return coroutineSingletons;
            }
        } else {
            if (i10 != 1) {
                if (i10 == 2) {
                    kotlin.a.d(obj);
                }
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            kotlin.a.d(obj);
        }
        kotlinx.coroutines.flow.q qVar = ((b0) this.this$0.g()).f1911c;
        BufferOverflow bufferOverflow = BufferOverflow.f29298b;
        kotlinx.coroutines.flow.f fVarP = qVar instanceof kotlinx.coroutines.flow.internal.h ? kotlinx.coroutines.y.p((kotlinx.coroutines.flow.internal.h) qVar, null, 0, bufferOverflow, 1) : new kotlinx.coroutines.flow.internal.f(qVar, 0, bufferOverflow, 2);
        m mVar = new m(this.this$0, 0);
        this.label = 2;
        return fVarP.a(mVar, this) == coroutineSingletons ? coroutineSingletons : eVar;
    }
}
