package o;

import java.util.ArrayList;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class A00 {
    public final C2202q00 a;
    public final ArrayList b;
    public final int c;
    public final C2398s4 d;
    public final U7 e;
    public final int f;
    public final int g;
    public final int h;
    public int i;

    public A00(C2202q00 c2202q00, ArrayList arrayList, int i, C2398s4 c2398s4, U7 u7, int i2, int i3, int i4) {
        this.a = c2202q00;
        this.b = arrayList;
        this.c = i;
        this.d = c2398s4;
        this.e = u7;
        this.f = i2;
        this.g = i3;
        this.h = i4;
    }

    public static A00 a(A00 a00, int i, C2398s4 c2398s4, U7 u7, int i2) {
        if ((i2 & 1) != 0) {
            i = a00.c;
        }
        int i3 = i;
        if ((i2 & 2) != 0) {
            c2398s4 = a00.d;
        }
        C2398s4 c2398s42 = c2398s4;
        if ((i2 & 4) != 0) {
            u7 = a00.e;
        }
        int i4 = a00.f;
        int i5 = a00.g;
        int i6 = a00.h;
        return new A00(a00.a, a00.b, i3, c2398s42, u7, i4, i5, i6);
    }

    public final C20 b(U7 u7) {
        ArrayList arrayList = this.b;
        int size = arrayList.size();
        int i = this.c;
        if (i >= size) {
            throw new IllegalStateException("Check failed.");
        }
        this.i++;
        C2398s4 c2398s4 = this.d;
        if (c2398s4 != null) {
            C1414hl c1414hl = (C1414hl) c2398s4.c;
            ZF zf = (ZF) u7.m;
            ZF zf2 = ((U1) c1414hl.e).h;
            if (zf.e != zf2.e || !F3.c(zf.d, zf2.d)) {
                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 i2 = i + 1;
        A00 a00A = a(this, i2, null, u7, 58);
        InterfaceC2229qI interfaceC2229qI = (InterfaceC2229qI) arrayList.get(i);
        C20 c20A = interfaceC2229qI.a(a00A);
        if (c20A == null) {
            throw new NullPointerException("interceptor " + interfaceC2229qI + " returned null");
        }
        if (c2398s4 != null && i2 < arrayList.size() && a00A.i != 1) {
            throw new IllegalStateException(("network interceptor " + interfaceC2229qI + " must call proceed() exactly once").toString());
        }
        if (c20A.r != null) {
            return c20A;
        }
        throw new IllegalStateException(("interceptor " + interfaceC2229qI + " returned a response with no body").toString());
    }
}
