package defpackage;

import androidx.media3.container.NalUnitUtil;
import defpackage.hf1;
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.mfa.MfaApiImpl", f = "MfaApi.kt", i = {0, 0, 1, 1, 2}, l = {197, 203, 169}, m = "verifyChallenge", n = {"this", "saveSession", "this", "saveSession", "session"}, s = {"L$0", "Z$0", "L$0", "Z$0", "L$0"})
final class iw5 extends ContinuationImpl {
    public Object a;
    public /* synthetic */ Object b;
    public final /* synthetic */ jw5 c;
    public int d;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public iw5(jw5 jw5Var, ContinuationImpl continuationImpl) {
        super(continuationImpl);
        this.c = jw5Var;
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x001f  */
    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) throws Throwable {
        iw5 iw5Var;
        KType kTypeA;
        this.b = obj;
        this.d |= Integer.MIN_VALUE;
        jw5 jw5Var = this.c;
        jw5Var.getClass();
        if (this instanceof iw5) {
            int i = this.d;
            if ((i & Integer.MIN_VALUE) != 0) {
                this.d = i - Integer.MIN_VALUE;
                iw5Var = this;
            } else {
                iw5Var = new iw5(jw5Var, this);
            }
        }
        Object objC = iw5Var.b;
        ck1 ck1Var = ck1.a;
        int i2 = iw5Var.d;
        if (i2 == 0) {
            s38.b(objC);
            vw2.ab("factors/", null, "/verify");
            b05 b05Var = new b05();
            xy4.a(b05Var, "code", null);
            xy4.a(b05Var, "challenge_id", null);
            new hw5(hf1.a.a, b05Var.a());
            iw5Var.a = jw5Var;
            iw5Var.d = 1;
            throw null;
        }
        if (i2 == 1) {
            jw5 jw5Var2 = (jw5) iw5Var.a;
            s38.b(objC);
            ua4 a = ((rd4) objC).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);
            iw5Var.a = jw5Var2;
            iw5Var.d = 2;
            objC = a.c(fz9Var, iw5Var);
            if (objC == ck1Var) {
                return ck1Var;
            }
        } else {
            if (i2 != 2) {
                if (i2 != 3) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                pba pbaVar = (pba) iw5Var.a;
                s38.b(objC);
                return pbaVar;
            }
            s38.b(objC);
        }
        if (objC != null) {
            return (pba) objC;
        }
        throw new NullPointerException("null cannot be cast to non-null type io.github.jan.supabase.auth.user.UserSession");
    }
}
