package okhttp3.n0.http;

import g.a.a.a.a;
import io.netty.handler.codec.rtsp.RtspHeaders;
import java.util.List;
import kotlin.Metadata;
import kotlin.jvm.internal.o;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.n0.connection.Exchange;
import okhttp3.n0.connection.RealCall;

/* JADX INFO: renamed from: y.n0.h.g, reason: from Kotlin metadata */
/* JADX INFO: loaded from: classes2.dex */
@Metadata(d1 = {"\u0000L\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u000f\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0003\u0018\u00002\u00020\u0001BM\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\f\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00060\u0005\u0012\u0006\u0010\u0007\u001a\u00020\b\u0012\b\u0010\t\u001a\u0004\u0018\u00010\n\u0012\u0006\u0010\u000b\u001a\u00020\f\u0012\u0006\u0010\r\u001a\u00020\b\u0012\u0006\u0010\u000e\u001a\u00020\b\u0012\u0006\u0010\u000f\u001a\u00020\b¢\u0006\u0002\u0010\u0010J\b\u0010\u0002\u001a\u00020\u001cH\u0016J\b\u0010\r\u001a\u00020\bH\u0016J\n\u0010\u001d\u001a\u0004\u0018\u00010\u001eH\u0016JK\u0010\u001f\u001a\u00020\u00002\b\b\u0002\u0010\u0007\u001a\u00020\b2\n\b\u0002\u0010\t\u001a\u0004\u0018\u00010\n2\b\b\u0002\u0010\u000b\u001a\u00020\f2\b\b\u0002\u0010\r\u001a\u00020\b2\b\b\u0002\u0010\u000e\u001a\u00020\b2\b\b\u0002\u0010\u000f\u001a\u00020\bH\u0000¢\u0006\u0002\b J\u0010\u0010!\u001a\u00020\"2\u0006\u0010\u000b\u001a\u00020\fH\u0016J\b\u0010\u000e\u001a\u00020\bH\u0016J\b\u0010\u000b\u001a\u00020\fH\u0016J\u0018\u0010#\u001a\u00020\u00012\u0006\u0010$\u001a\u00020\b2\u0006\u0010%\u001a\u00020&H\u0016J\u0018\u0010'\u001a\u00020\u00012\u0006\u0010$\u001a\u00020\b2\u0006\u0010%\u001a\u00020&H\u0016J\u0018\u0010(\u001a\u00020\u00012\u0006\u0010$\u001a\u00020\b2\u0006\u0010%\u001a\u00020&H\u0016J\b\u0010\u000f\u001a\u00020\bH\u0016R\u0014\u0010\u0002\u001a\u00020\u0003X\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0011\u0010\u0012R\u000e\u0010\u0013\u001a\u00020\bX\u0082\u000e¢\u0006\u0002\n\u0000R\u0014\u0010\r\u001a\u00020\bX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0014\u0010\u0015R\u0016\u0010\t\u001a\u0004\u0018\u00010\nX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0016\u0010\u0017R\u000e\u0010\u0007\u001a\u00020\bX\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u0004\u001a\b\u0012\u0004\u0012\u00020\u00060\u0005X\u0082\u0004¢\u0006\u0002\n\u0000R\u0014\u0010\u000e\u001a\u00020\bX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0018\u0010\u0015R\u0014\u0010\u000b\u001a\u00020\fX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u0019\u0010\u001aR\u0014\u0010\u000f\u001a\u00020\bX\u0080\u0004¢\u0006\b\n\u0000\u001a\u0004\b\u001b\u0010\u0015¨\u0006)"}, d2 = {"Lokhttp3/internal/http/RealInterceptorChain;", "Lokhttp3/Interceptor$Chain;", "call", "Lokhttp3/internal/connection/RealCall;", "interceptors", "", "Lokhttp3/Interceptor;", "index", "", "exchange", "Lokhttp3/internal/connection/Exchange;", "request", "Lokhttp3/Request;", "connectTimeoutMillis", "readTimeoutMillis", "writeTimeoutMillis", "(Lokhttp3/internal/connection/RealCall;Ljava/util/List;ILokhttp3/internal/connection/Exchange;Lokhttp3/Request;III)V", "getCall$okhttp", "()Lokhttp3/internal/connection/RealCall;", "calls", "getConnectTimeoutMillis$okhttp", "()I", "getExchange$okhttp", "()Lokhttp3/internal/connection/Exchange;", "getReadTimeoutMillis$okhttp", "getRequest$okhttp", "()Lokhttp3/Request;", "getWriteTimeoutMillis$okhttp", "Lokhttp3/Call;", "connection", "Lokhttp3/Connection;", "copy", "copy$okhttp", "proceed", "Lokhttp3/Response;", "withConnectTimeout", RtspHeaders.Values.TIMEOUT, "unit", "Ljava/util/concurrent/TimeUnit;", "withReadTimeout", "withWriteTimeout", "okhttp"}, k = 1, mv = {1, 6, 0}, xi = 48)
public final class RealInterceptorChain implements Interceptor.a {
    public final RealCall a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final List<Interceptor> f9826b;

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final Exchange f9828d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final Request f9829e;

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

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

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

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

    /* JADX WARN: Multi-variable type inference failed */
    public RealInterceptorChain(RealCall realCall, List<? extends Interceptor> list, int i2, Exchange exchange, Request request, int i3, int i4, int i5) {
        o.f(realCall, "call");
        o.f(list, "interceptors");
        o.f(request, "request");
        this.a = realCall;
        this.f9826b = list;
        this.f9827c = i2;
        this.f9828d = exchange;
        this.f9829e = request;
        this.f9830f = i3;
        this.f9831g = i4;
        this.f9832h = i5;
    }

    public static RealInterceptorChain b(RealInterceptorChain realInterceptorChain, int i2, Exchange exchange, Request request, int i3, int i4, int i5, int i6) {
        int i7 = (i6 & 1) != 0 ? realInterceptorChain.f9827c : i2;
        Exchange exchange2 = (i6 & 2) != 0 ? realInterceptorChain.f9828d : exchange;
        Request request2 = (i6 & 4) != 0 ? realInterceptorChain.f9829e : request;
        int i8 = (i6 & 8) != 0 ? realInterceptorChain.f9830f : i3;
        int i9 = (i6 & 16) != 0 ? realInterceptorChain.f9831g : i4;
        int i10 = (i6 & 32) != 0 ? realInterceptorChain.f9832h : i5;
        o.f(request2, "request");
        return new RealInterceptorChain(realInterceptorChain.a, realInterceptorChain.f9826b, i7, exchange2, request2, i8, i9, i10);
    }

    @Override // okhttp3.Interceptor.a
    public Response a(Request request) {
        o.f(request, "request");
        if (!(this.f9827c < this.f9826b.size())) {
            throw new IllegalStateException("Check failed.".toString());
        }
        this.f9833i++;
        Exchange exchange = this.f9828d;
        if (exchange != null) {
            if (!exchange.f9744c.b(request.a)) {
                StringBuilder sbF = a.F("network interceptor ");
                sbF.append(this.f9826b.get(this.f9827c - 1));
                sbF.append(" must retain the same host and port");
                throw new IllegalStateException(sbF.toString().toString());
            }
            if (!(this.f9833i == 1)) {
                StringBuilder sbF2 = a.F("network interceptor ");
                sbF2.append(this.f9826b.get(this.f9827c - 1));
                sbF2.append(" must call proceed() exactly once");
                throw new IllegalStateException(sbF2.toString().toString());
            }
        }
        RealInterceptorChain realInterceptorChainB = b(this, this.f9827c + 1, null, request, 0, 0, 0, 58);
        Interceptor interceptor = this.f9826b.get(this.f9827c);
        Response responseIntercept = interceptor.intercept(realInterceptorChainB);
        if (responseIntercept == null) {
            throw new NullPointerException("interceptor " + interceptor + " returned null");
        }
        if (this.f9828d != null) {
            if (!(this.f9827c + 1 >= this.f9826b.size() || realInterceptorChainB.f9833i == 1)) {
                throw new IllegalStateException(("network interceptor " + interceptor + " must call proceed() exactly once").toString());
            }
        }
        if (responseIntercept.f9647r != null) {
            return responseIntercept;
        }
        throw new IllegalStateException(("interceptor " + interceptor + " returned a response with no body").toString());
    }

    @Override // okhttp3.Interceptor.a
    /* JADX INFO: renamed from: e, reason: from getter */
    public Request getF9829e() {
        return this.f9829e;
    }
}
