package defpackage;

import androidx.media3.container.NalUnitUtil;
import defpackage.qg;
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\u0018\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002*B\u0010\u0005\"\u001e\b\u0001\u0012\u0004\u0012\u00020\u0001\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00030\u0002\u0012\u0006\u0012\u0004\u0018\u00010\u00040\u00002\u001e\b\u0001\u0012\u0004\u0012\u00020\u0001\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00030\u0002\u0012\u0006\u0012\u0004\u0018\u00010\u00040\u0000¨\u0006\u0006"}, d2 = {"Lkotlin/Function2;", "Lrd4;", "Lkotlin/coroutines/Continuation;", "Le6a;", "", "ResponseHandler", "ktor-client-core"}, k = 2, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
public final class g38 {
    public static final i11 a = tm1.a(a.a, new od0(12), "ResponseObserver");

    @Metadata(k = 3, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public /* synthetic */ class a extends xr3 implements qq3<e38> {
        public static final a a = new a(0, e38.class, "<init>", "<init>()V", 0);

        @Override // defpackage.qq3
        public final Object invoke() {
            e38 e38Var = new e38();
            e38Var.a = new d38(2, null);
            return e38Var;
        }
    }

    @Metadata(d1 = {"\u0000\u0012\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0004\u001a\u00020\u0003*\u00020\u00002\u0006\u0010\u0002\u001a\u00020\u0001H\n¢\u0006\u0004\b\u0004\u0010\u0005"}, d2 = {"Lqg$a;", "Lrd4;", "response", "Le6a;", "<anonymous>", "(Lqg$a;Lrd4;)V"}, k = 3, mv = {2, 0, 0})
    @DebugMetadata(c = "io.ktor.client.plugins.observer.ResponseObserverKt$ResponseObserver$2$1", f = "ResponseObserver.kt", i = {0, 0, 0}, l = {63, 72}, m = "invokeSuspend", n = {"$this$on", "newResponse", "sideResponse"}, s = {"L$0", "L$1", "L$2"})
    public static final class b extends SuspendLambda implements ir3<qg.a, rd4, Continuation<? super e6a>, Object> {
        public rd4 a;
        public ta4 b;
        public int c;
        public /* synthetic */ qg.a d;
        public /* synthetic */ rd4 e;
        public final /* synthetic */ j11 f;
        public final /* synthetic */ gr3 i;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public b(j11 j11Var, gr3 gr3Var, Continuation continuation) {
            super(3, continuation);
            this.f = j11Var;
            this.i = gr3Var;
        }

        @Override // defpackage.ir3
        public final Object invoke(Object obj, Object obj2, Object obj3) {
            b bVar = new b(this.f, this.i, (Continuation) obj3);
            bVar.d = (qg.a) obj;
            bVar.e = (rd4) obj2;
            return bVar.invokeSuspend(e6a.a);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) {
            qg.a aVar;
            rd4 rd4Var;
            rd4 rd4Var2;
            ta4 ta4Var;
            ck1 ck1Var = ck1.a;
            int i = this.c;
            e6a e6aVar = e6a.a;
            if (i == 0) {
                s38.b(obj);
                aVar = this.d;
                rd4 rd4Var3 = this.e;
                bn0 i2 = rd4Var3.getI();
                cr4.g(i2, "<this>");
                cr4.g(rd4Var3, "coroutineScope");
                xl0 xl0Var = new xl0(true);
                xl0 xl0Var2 = new xl0(true);
                ((rx4) wj0.c(rd4Var3, null, null, new nm0(i2, xl0Var, xl0Var2, null), 3)).at(new q2(xl0Var, xl0Var2, 6));
                q07 q07Var = new q07(xl0Var, xl0Var2);
                bn0 bn0Var = (bn0) q07Var.a;
                rd4 rd4VarG = n32.a(rd4Var3.getA(), (bn0) q07Var.b).g();
                rd4 rd4VarG2 = n32.a(rd4Var3.getA(), bn0Var).g();
                ta4 ta4Var2 = this.f.a;
                this.d = aVar;
                this.e = rd4VarG;
                this.a = rd4VarG2;
                this.b = ta4Var2;
                this.c = 1;
                Object obj2 = (gm5) getB().cb(gm5.b);
                if (obj2 == null) {
                    obj2 = ak2.a;
                }
                if (obj2 != ck1Var) {
                    Object obj3 = obj2;
                    rd4Var = rd4VarG2;
                    obj = obj3;
                    rd4Var2 = rd4VarG;
                    ta4Var = ta4Var2;
                }
            }
            if (i != 1) {
                if (i != 2) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                s38.b(obj);
                return e6aVar;
            }
            ta4Var = this.b;
            rd4Var = this.a;
            rd4Var2 = this.e;
            aVar = this.d;
            s38.b(obj);
            wj0.c(ta4Var, (gj1) obj, null, new h38(rd4Var, this.i, null), 2);
            this.d = null;
            this.e = null;
            this.a = null;
            this.b = null;
            this.c = 2;
            return aVar.a.h(rd4Var2, this) == ck1Var ? ck1Var : e6aVar;
        }
    }
}
