package r1;

import kotlin.coroutines.jvm.internal.h;
import kotlin.coroutines.jvm.internal.j;
import kotlin.jvm.internal.z;
import n1.m;
import q1.g;
import y1.l;
import y1.p;

/* JADX INFO: Access modifiers changed from: package-private */
/* JADX INFO: loaded from: classes.dex */
public abstract class c {

    public static final class a extends j {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        private int f6364b;

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        final /* synthetic */ l f6365g;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public a(q1.d dVar, l lVar) {
            super(dVar);
            this.f6365g = lVar;
            kotlin.jvm.internal.l.c(dVar, "null cannot be cast to non-null type kotlin.coroutines.Continuation<kotlin.Any?>");
        }

        @Override // kotlin.coroutines.jvm.internal.a
        protected Object invokeSuspend(Object obj) {
            int i2 = this.f6364b;
            if (i2 == 0) {
                this.f6364b = 1;
                m.b(obj);
                kotlin.jvm.internal.l.c(this.f6365g, "null cannot be cast to non-null type kotlin.Function1<kotlin.coroutines.Continuation<T of kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted$lambda$0>, kotlin.Any?>");
                return ((l) z.b(this.f6365g, 1)).invoke(this);
            }
            if (i2 != 1) {
                throw new IllegalStateException("This coroutine had already completed");
            }
            this.f6364b = 2;
            m.b(obj);
            return obj;
        }
    }

    public static final class b extends kotlin.coroutines.jvm.internal.d {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        private int f6366b;

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        final /* synthetic */ l f6367g;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public b(q1.d dVar, g gVar, l lVar) {
            super(dVar, gVar);
            this.f6367g = lVar;
            kotlin.jvm.internal.l.c(dVar, "null cannot be cast to non-null type kotlin.coroutines.Continuation<kotlin.Any?>");
        }

        @Override // kotlin.coroutines.jvm.internal.a
        protected Object invokeSuspend(Object obj) {
            int i2 = this.f6366b;
            if (i2 == 0) {
                this.f6366b = 1;
                m.b(obj);
                kotlin.jvm.internal.l.c(this.f6367g, "null cannot be cast to non-null type kotlin.Function1<kotlin.coroutines.Continuation<T of kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted$lambda$0>, kotlin.Any?>");
                return ((l) z.b(this.f6367g, 1)).invoke(this);
            }
            if (i2 != 1) {
                throw new IllegalStateException("This coroutine had already completed");
            }
            this.f6366b = 2;
            m.b(obj);
            return obj;
        }
    }

    /* JADX INFO: renamed from: r1.c$c, reason: collision with other inner class name */
    public static final class C0092c extends j {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        private int f6368b;

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        final /* synthetic */ p f6369g;

        /* JADX INFO: renamed from: r, reason: collision with root package name */
        final /* synthetic */ Object f6370r;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C0092c(q1.d dVar, p pVar, Object obj) {
            super(dVar);
            this.f6369g = pVar;
            this.f6370r = obj;
            kotlin.jvm.internal.l.c(dVar, "null cannot be cast to non-null type kotlin.coroutines.Continuation<kotlin.Any?>");
        }

        @Override // kotlin.coroutines.jvm.internal.a
        protected Object invokeSuspend(Object obj) {
            int i2 = this.f6368b;
            if (i2 == 0) {
                this.f6368b = 1;
                m.b(obj);
                kotlin.jvm.internal.l.c(this.f6369g, "null cannot be cast to non-null type kotlin.Function2<R of kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted$lambda$1, kotlin.coroutines.Continuation<T of kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted$lambda$1>, kotlin.Any?>");
                return ((p) z.b(this.f6369g, 2)).invoke(this.f6370r, this);
            }
            if (i2 != 1) {
                throw new IllegalStateException("This coroutine had already completed");
            }
            this.f6368b = 2;
            m.b(obj);
            return obj;
        }
    }

    public static final class d extends kotlin.coroutines.jvm.internal.d {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        private int f6371b;

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        final /* synthetic */ p f6372g;

        /* JADX INFO: renamed from: r, reason: collision with root package name */
        final /* synthetic */ Object f6373r;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public d(q1.d dVar, g gVar, p pVar, Object obj) {
            super(dVar, gVar);
            this.f6372g = pVar;
            this.f6373r = obj;
            kotlin.jvm.internal.l.c(dVar, "null cannot be cast to non-null type kotlin.coroutines.Continuation<kotlin.Any?>");
        }

        @Override // kotlin.coroutines.jvm.internal.a
        protected Object invokeSuspend(Object obj) {
            int i2 = this.f6371b;
            if (i2 == 0) {
                this.f6371b = 1;
                m.b(obj);
                kotlin.jvm.internal.l.c(this.f6372g, "null cannot be cast to non-null type kotlin.Function2<R of kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted$lambda$1, kotlin.coroutines.Continuation<T of kotlin.coroutines.intrinsics.IntrinsicsKt__IntrinsicsJvmKt.createCoroutineUnintercepted$lambda$1>, kotlin.Any?>");
                return ((p) z.b(this.f6372g, 2)).invoke(this.f6373r, this);
            }
            if (i2 != 1) {
                throw new IllegalStateException("This coroutine had already completed");
            }
            this.f6371b = 2;
            m.b(obj);
            return obj;
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    public static q1.d a(l lVar, q1.d completion) {
        kotlin.jvm.internal.l.e(lVar, "<this>");
        kotlin.jvm.internal.l.e(completion, "completion");
        q1.d dVarA = h.a(completion);
        if (lVar instanceof kotlin.coroutines.jvm.internal.a) {
            return ((kotlin.coroutines.jvm.internal.a) lVar).create(dVarA);
        }
        g context = dVarA.getContext();
        return context == q1.h.f6277b ? new a(dVarA, lVar) : new b(dVarA, context, lVar);
    }

    /* JADX WARN: Multi-variable type inference failed */
    public static q1.d b(p pVar, Object obj, q1.d completion) {
        kotlin.jvm.internal.l.e(pVar, "<this>");
        kotlin.jvm.internal.l.e(completion, "completion");
        q1.d dVarA = h.a(completion);
        if (pVar instanceof kotlin.coroutines.jvm.internal.a) {
            return ((kotlin.coroutines.jvm.internal.a) pVar).create(obj, dVarA);
        }
        g context = dVarA.getContext();
        return context == q1.h.f6277b ? new C0092c(dVarA, pVar, obj) : new d(dVarA, context, pVar, obj);
    }

    public static q1.d c(q1.d dVar) {
        q1.d dVarIntercepted;
        kotlin.jvm.internal.l.e(dVar, "<this>");
        kotlin.coroutines.jvm.internal.d dVar2 = dVar instanceof kotlin.coroutines.jvm.internal.d ? (kotlin.coroutines.jvm.internal.d) dVar : null;
        return (dVar2 == null || (dVarIntercepted = dVar2.intercepted()) == null) ? dVar : dVarIntercepted;
    }
}
