package k7;

import d3.V0;
import e4.C0878i;
import java.net.ProxySelector;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.util.Iterator;
import java.util.List;
import javax.net.SocketFactory;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.X509TrustManager;
import l6.C1139a;

/* JADX INFO: loaded from: classes.dex */
public final class w implements Cloneable, InterfaceC1112d {

    /* JADX INFO: renamed from: Q, reason: collision with root package name */
    public static final List f14168Q = l7.b.l(x.f14197u, x.f14195s);

    /* JADX INFO: renamed from: R, reason: collision with root package name */
    public static final List f14169R = l7.b.l(j.f14084e, j.f14085f);

    /* JADX INFO: renamed from: A, reason: collision with root package name */
    public final l f14170A;

    /* JADX INFO: renamed from: B, reason: collision with root package name */
    public final ProxySelector f14171B;

    /* JADX INFO: renamed from: C, reason: collision with root package name */
    public final l f14172C;
    public final SocketFactory D;

    /* JADX INFO: renamed from: E, reason: collision with root package name */
    public final SSLSocketFactory f14173E;

    /* JADX INFO: renamed from: F, reason: collision with root package name */
    public final X509TrustManager f14174F;

    /* JADX INFO: renamed from: G, reason: collision with root package name */
    public final List f14175G;
    public final List H;

    /* JADX INFO: renamed from: I, reason: collision with root package name */
    public final HostnameVerifier f14176I;

    /* JADX INFO: renamed from: J, reason: collision with root package name */
    public final C1114f f14177J;

    /* JADX INFO: renamed from: K, reason: collision with root package name */
    public final W3.b f14178K;

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

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

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

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

    /* JADX INFO: renamed from: P, reason: collision with root package name */
    public final C1139a f14183P;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public final C2.a f14184q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public final V0 f14185r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final List f14186s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public final List f14187t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public final C0878i f14188u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public final boolean f14189v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public final InterfaceC1110b f14190w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public final boolean f14191x;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public final boolean f14192y;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public final l f14193z;

    public w(v vVar) throws NoSuchAlgorithmException, KeyStoreException {
        this.f14184q = vVar.f14145a;
        this.f14185r = vVar.f14146b;
        this.f14186s = l7.b.x(vVar.f14147c);
        this.f14187t = l7.b.x(vVar.f14148d);
        this.f14188u = vVar.f14149e;
        this.f14189v = vVar.f14150f;
        this.f14190w = vVar.f14151g;
        this.f14191x = vVar.f14152h;
        this.f14192y = vVar.i;
        this.f14193z = vVar.f14153j;
        this.f14170A = vVar.f14154k;
        ProxySelector proxySelector = ProxySelector.getDefault();
        this.f14171B = proxySelector == null ? u7.a.f17847a : proxySelector;
        this.f14172C = vVar.f14155l;
        this.D = vVar.f14156m;
        List list = vVar.f14159p;
        this.f14175G = list;
        this.H = vVar.f14160q;
        this.f14176I = vVar.f14161r;
        this.f14179L = vVar.f14164u;
        this.f14180M = vVar.f14165v;
        this.f14181N = vVar.f14166w;
        this.f14182O = vVar.f14167x;
        this.f14183P = new C1139a(12);
        if (list == null || !list.isEmpty()) {
            Iterator it = list.iterator();
            while (it.hasNext()) {
                if (((j) it.next()).f14086a) {
                    SSLSocketFactory sSLSocketFactory = vVar.f14157n;
                    if (sSLSocketFactory != null) {
                        this.f14173E = sSLSocketFactory;
                        W3.b bVar = vVar.f14163t;
                        P6.g.b(bVar);
                        this.f14178K = bVar;
                        X509TrustManager x509TrustManager = vVar.f14158o;
                        P6.g.b(x509TrustManager);
                        this.f14174F = x509TrustManager;
                        C1114f c1114f = vVar.f14162s;
                        c1114f.getClass();
                        this.f14177J = P6.g.a(c1114f.f14060b, bVar) ? c1114f : new C1114f(c1114f.f14059a, bVar);
                    } else {
                        s7.n nVar = s7.n.f16942a;
                        X509TrustManager x509TrustManagerM = s7.n.f16942a.m();
                        this.f14174F = x509TrustManagerM;
                        this.f14173E = s7.n.f16942a.l(x509TrustManagerM);
                        W3.b bVarB = s7.n.f16942a.b(x509TrustManagerM);
                        this.f14178K = bVarB;
                        C1114f c1114f2 = vVar.f14162s;
                        c1114f2.getClass();
                        this.f14177J = P6.g.a(c1114f2.f14060b, bVarB) ? c1114f2 : new C1114f(c1114f2.f14059a, bVarB);
                    }
                }
            }
            this.f14173E = null;
            this.f14178K = null;
            this.f14174F = null;
            this.f14177J = C1114f.f14058c;
        } else {
            this.f14173E = null;
            this.f14178K = null;
            this.f14174F = null;
            this.f14177J = C1114f.f14058c;
        }
        List list2 = this.f14186s;
        P6.g.c(list2, "null cannot be cast to non-null type kotlin.collections.List<okhttp3.Interceptor?>");
        if (list2.contains(null)) {
            throw new IllegalStateException(("Null interceptor: " + list2).toString());
        }
        List list3 = this.f14187t;
        P6.g.c(list3, "null cannot be cast to non-null type kotlin.collections.List<okhttp3.Interceptor?>");
        if (list3.contains(null)) {
            throw new IllegalStateException(("Null network interceptor: " + list3).toString());
        }
        List list4 = this.f14175G;
        boolean z8 = list4 != null;
        X509TrustManager x509TrustManager2 = this.f14174F;
        W3.b bVar2 = this.f14178K;
        SSLSocketFactory sSLSocketFactory2 = this.f14173E;
        if (!z8 || !list4.isEmpty()) {
            Iterator it2 = list4.iterator();
            while (it2.hasNext()) {
                if (((j) it2.next()).f14086a) {
                    if (sSLSocketFactory2 == null) {
                        throw new IllegalStateException("sslSocketFactory == null");
                    }
                    if (bVar2 == null) {
                        throw new IllegalStateException("certificateChainCleaner == null");
                    }
                    if (x509TrustManager2 == null) {
                        throw new IllegalStateException("x509TrustManager == null");
                    }
                    return;
                }
            }
        }
        if (sSLSocketFactory2 != null) {
            throw new IllegalStateException("Check failed.");
        }
        if (bVar2 != null) {
            throw new IllegalStateException("Check failed.");
        }
        if (x509TrustManager2 != null) {
            throw new IllegalStateException("Check failed.");
        }
        if (!P6.g.a(this.f14177J, C1114f.f14058c)) {
            throw new IllegalStateException("Check failed.");
        }
    }

    public final Object clone() {
        return super.clone();
    }

    public w() {
        this(new v());
    }
}
