package defpackage;

import androidx.media3.container.NalUnitUtil;
import kotlin.Metadata;
import kotlin.coroutines.jvm.internal.ContinuationImpl;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.reflect.KClass;
import kotlin.reflect.KType;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(k = 3, mv = {2, 1, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
@DebugMetadata(c = "io.github.jan.supabase.auth.providers.builtin.DefaultAuthProvider$DefaultImpls", f = "DefaultAuthProvider.kt", i = {0, 1}, l = {115, 121, 64}, m = "login", n = {"onSuccess", "onSuccess"}, s = {"L$0", "L$0"})
final class kz1<C, R> extends ContinuationImpl {
    public Object a;
    public /* synthetic */ Object b;
    public int c;

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Object invokeSuspend(Object obj) throws Throwable {
        gr3 gr3Var;
        KType kTypeA;
        this.b = obj;
        int i = (this.c | Integer.MIN_VALUE) - Integer.MIN_VALUE;
        this.c = i;
        ck1 ck1Var = ck1.a;
        if (i == 0) {
            s38.b(obj);
            throw new IllegalArgumentException("Credentials are required");
        }
        if (i == 1) {
            gr3Var = (gr3) this.a;
            s38.b(obj);
            ua4 a = ((rd4) obj).getA();
            KClass orCreateKotlinClass = iw7.a.getOrCreateKotlinClass(pba.class);
            try {
                kTypeA = iw7.a(pba.class);
            } catch (Throwable unused) {
                kTypeA = null;
            }
            fz9 fz9Var = new fz9(orCreateKotlinClass, kTypeA);
            this.a = gr3Var;
            this.c = 2;
            obj = a.c(fz9Var, this);
            if (obj == ck1Var) {
                return ck1Var;
            }
        } else {
            if (i != 2) {
                if (i != 3) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                s38.b(obj);
                return e6a.a;
            }
            gr3Var = (gr3) this.a;
            s38.b(obj);
        }
        if (obj == null) {
            throw new NullPointerException("null cannot be cast to non-null type io.github.jan.supabase.auth.user.UserSession");
        }
        pba pbaVar = (pba) obj;
        this.a = pbaVar;
        this.c = 3;
        if (gr3Var.invoke(pbaVar, this) == ck1Var) {
            return ck1Var;
        }
        return e6a.a;
    }
}
