package P4;

import K4.o;
import K4.p;
import K4.u;
import O4.h;
import java.util.ArrayList;
import r4.AbstractC0983h;

/* JADX INFO: loaded from: classes.dex */
public final class f {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final h f2551a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final ArrayList f2552b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final int f2553c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final O4.c f2554d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final F3.e f2555e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final int f2556f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public final int f2557g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final int f2558h;
    public int i;

    public f(h hVar, ArrayList arrayList, int i, O4.c cVar, F3.e eVar, int i5, int i6, int i7) {
        AbstractC0983h.e("call", hVar);
        this.f2551a = hVar;
        this.f2552b = arrayList;
        this.f2553c = i;
        this.f2554d = cVar;
        this.f2555e = eVar;
        this.f2556f = i5;
        this.f2557g = i6;
        this.f2558h = i7;
    }

    public static f a(f fVar, int i, O4.c cVar, F3.e eVar, int i5) {
        if ((i5 & 1) != 0) {
            i = fVar.f2553c;
        }
        int i6 = i;
        if ((i5 & 2) != 0) {
            cVar = fVar.f2554d;
        }
        O4.c cVar2 = cVar;
        if ((i5 & 4) != 0) {
            eVar = fVar.f2555e;
        }
        F3.e eVar2 = eVar;
        AbstractC0983h.e("request", eVar2);
        return new f(fVar.f2551a, fVar.f2552b, i6, cVar2, eVar2, fVar.f2556f, fVar.f2557g, fVar.f2558h);
    }

    public final u b(F3.e eVar) {
        AbstractC0983h.e("request", eVar);
        ArrayList arrayList = this.f2552b;
        int size = arrayList.size();
        int i = this.f2553c;
        if (i >= size) {
            throw new IllegalStateException("Check failed.");
        }
        this.i++;
        O4.c cVar = this.f2554d;
        if (cVar != null) {
            if (!((O4.d) cVar.f2321c).b((o) eVar.f714l)) {
                throw new IllegalStateException(("network interceptor " + arrayList.get(i - 1) + " must retain the same host and port").toString());
            }
            if (this.i != 1) {
                throw new IllegalStateException(("network interceptor " + arrayList.get(i - 1) + " must call proceed() exactly once").toString());
            }
        }
        int i5 = i + 1;
        f fVarA = a(this, i5, null, eVar, 58);
        p pVar = (p) arrayList.get(i);
        u uVarA = pVar.a(fVarA);
        if (uVarA == null) {
            throw new NullPointerException("interceptor " + pVar + " returned null");
        }
        if (cVar != null && i5 < arrayList.size() && fVarA.i != 1) {
            throw new IllegalStateException(("network interceptor " + pVar + " must call proceed() exactly once").toString());
        }
        if (uVarA.q != null) {
            return uVarA;
        }
        throw new IllegalStateException(("interceptor " + pVar + " returned a response with no body").toString());
    }
}
