package defpackage;

import androidx.media3.container.NalUnitUtil;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\u000e\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0003\u001a\u00020\u00022\u0006\u0010\u0001\u001a\u00020\u0000H\n¢\u0006\u0004\b\u0003\u0010\u0004"}, d2 = {"Lrd4;", "response", "Le6a;", "<anonymous>", "(Lrd4;)V"}, k = 3, mv = {2, 0, 0})
@DebugMetadata(c = "io.ktor.client.plugins.DefaultResponseValidationKt$addDefaultResponseValidation$1$1", f = "DefaultResponseValidation.kt", i = {0, 0, 1, 1, 1}, l = {NalUnitUtil.H265_NAL_UNIT_TYPE_SUFFIX_SEI, 46}, m = "invokeSuspend", n = {"response", "statusCode", "response", "exceptionResponse", "statusCode"}, s = {"L$0", "I$0", "L$0", "L$1", "I$0"})
final class i12 extends SuspendLambda implements gr3<rd4, Continuation<? super e6a>, Object> {
    public rd4 a;
    public int b;
    public int c;
    public /* synthetic */ Object d;

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Continuation create(Object obj, Continuation continuation) {
        i12 i12Var = new i12(2, continuation);
        i12Var.d = obj;
        return i12Var;
    }

    @Override // defpackage.gr3
    public final Object invoke(Object obj, Object obj2) {
        return ((i12) create((rd4) obj, (Continuation) obj2)).invokeSuspend(e6a.a);
    }

    /* JADX WARN: Can't wrap try/catch for region: R(8:0|2|(1:(1:(8:6|53|7|30|34|(2:39|(1:(1:48)(1:47))(1:43))(1:38)|49|50)(2:9|10))(1:11))(2:12|(2:14|15)(2:16|(1:51)(3:21|(1:24)|28)))|25|55|26|(6:29|30|34|(2:39|(1:(2:45|48)(0))(0))(0)|49|50)|28) */
    /* JADX WARN: Code restructure failed: missing block: B:32:0x00bd, code lost:
    
        r0 = r1;
        r3 = r5;
        r1 = r11;
     */
    /* JADX WARN: Removed duplicated region for block: B:39:0x00cf  */
    /* JADX WARN: Removed duplicated region for block: B:44:0x00dc  */
    /* JADX WARN: Removed duplicated region for block: B:48:0x00e8  */
    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) throws Throwable {
        int i;
        rd4 rd4Var;
        int i2;
        rd4 rd4Var2;
        rd4 rd4Var3;
        String str;
        ck1 ck1Var = ck1.a;
        int i3 = this.c;
        e6a e6aVar = e6a.a;
        if (i3 == 0) {
            s38.b(obj);
            rd4 rd4Var4 = (rd4) this.d;
            if (!((Boolean) rd4Var4.getA().getAttributes().g(la4.c)).booleanValue()) {
                j12.b.h("Skipping default response validation for " + rd4Var4.getA().e().getB());
                return e6aVar;
            }
            i = rd4Var4.getC().a;
            ua4 a = rd4Var4.getA();
            if (i < 300 || a.getAttributes().f(j12.a)) {
                return e6aVar;
            }
            this.d = rd4Var4;
            this.b = i;
            this.c = 1;
            Object objA = oa8.a(a, this);
            if (objA != ck1Var) {
                rd4Var = rd4Var4;
                obj = objA;
            }
            return ck1Var;
        }
        if (i3 != 1) {
            if (i3 != 2) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            i2 = this.b;
            rd4Var3 = this.a;
            rd4Var2 = (rd4) this.d;
            try {
                s38.b(obj);
                str = (String) obj;
            } catch (wm5 unused) {
                str = "<body failed decoding>";
            }
            Throwable a38Var = (300 <= i2 || i2 >= 400) ? (400 <= i2 || i2 >= 500) ? (500 <= i2 || i2 >= 600) ? new a38(rd4Var3, str) : new wj8(rd4Var3, str) : new m11(rd4Var3, str) : new qv7(rd4Var3, str);
            j12.b.h("Default response validation for " + rd4Var2.getA().e().getB() + " failed with " + a38Var);
            throw a38Var;
        }
        i = this.b;
        rd4Var = (rd4) this.d;
        s38.b(obj);
        ua4 ua4Var = (ua4) obj;
        ua4Var.getAttributes().d(j12.a, e6aVar);
        rd4 rd4VarG = ua4Var.g();
        this.d = rd4Var;
        this.a = rd4VarG;
        this.b = i;
        this.c = 2;
        Object objA2 = yd4.a(rd4VarG, bz0.a, this);
        if (objA2 != ck1Var) {
            i2 = i;
            rd4Var3 = rd4VarG;
            obj = objA2;
            rd4Var2 = rd4Var;
            str = (String) obj;
            if (300 <= i2) {
            }
            j12.b.h("Default response validation for " + rd4Var2.getA().e().getB() + " failed with " + a38Var);
            throw a38Var;
        }
        return ck1Var;
    }
}
