package XnFJ5_9;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import javax.annotation.Nullable;
import javax.net.ssl.SSLSocket;
/* compiled from: ConnectionSpec.java */
/* loaded from: classes.dex */
public final class LGe8pk_15 {
    public static final LGe8pk_15 KQgRr5e_0;
    public static final LGe8pk_15 QxJ9d_1;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final boolean f1663KQgRr5e_0;
    @Nullable

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public final String[] f1664KQgRr5e_0;

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public final boolean f1665QxJ9d_1;
    @Nullable

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public final String[] f1666QxJ9d_1;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public static final EuDEkJe_12[] f1661KQgRr5e_0 = {EuDEkJe_12.WwEq_13, EuDEkJe_12.YghfZG_14, EuDEkJe_12.LGe8pk_15, EuDEkJe_12.f3363FSaI4_7, EuDEkJe_12.f3371XnFJ5_9, EuDEkJe_12.f3370Xgtqvk_8, EuDEkJe_12.f3368Nm6q_10, EuDEkJe_12.EuDEkJe_12, EuDEkJe_12.f3366KNBe_11};

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public static final EuDEkJe_12[] f1662QxJ9d_1 = {EuDEkJe_12.WwEq_13, EuDEkJe_12.YghfZG_14, EuDEkJe_12.LGe8pk_15, EuDEkJe_12.f3363FSaI4_7, EuDEkJe_12.f3371XnFJ5_9, EuDEkJe_12.f3370Xgtqvk_8, EuDEkJe_12.f3368Nm6q_10, EuDEkJe_12.EuDEkJe_12, EuDEkJe_12.f3366KNBe_11, EuDEkJe_12.f3364IFxWkV_5, EuDEkJe_12.f3365IMuAHx_6, EuDEkJe_12.f3367Mqv2r_3, EuDEkJe_12.f3369X6FRs_4, EuDEkJe_12.QxJ9d_1, EuDEkJe_12.PGPF6hQ_2, EuDEkJe_12.KQgRr5e_0};

    static {
        KQgRr5e_0 kQgRr5e_0 = new KQgRr5e_0(true);
        kQgRr5e_0.KQgRr5e_0(f1661KQgRr5e_0);
        kQgRr5e_0.KQgRr5e_0(R6WQ_35.TLS_1_3, R6WQ_35.TLS_1_2);
        kQgRr5e_0.KQgRr5e_0(true);
        kQgRr5e_0.KQgRr5e_0();
        KQgRr5e_0 kQgRr5e_02 = new KQgRr5e_0(true);
        kQgRr5e_02.KQgRr5e_0(f1662QxJ9d_1);
        kQgRr5e_02.KQgRr5e_0(R6WQ_35.TLS_1_3, R6WQ_35.TLS_1_2);
        kQgRr5e_02.KQgRr5e_0(true);
        KQgRr5e_0 = kQgRr5e_02.KQgRr5e_0();
        KQgRr5e_0 kQgRr5e_03 = new KQgRr5e_0(true);
        kQgRr5e_03.KQgRr5e_0(f1662QxJ9d_1);
        kQgRr5e_03.KQgRr5e_0(R6WQ_35.TLS_1_3, R6WQ_35.TLS_1_2, R6WQ_35.TLS_1_1, R6WQ_35.TLS_1_0);
        kQgRr5e_03.KQgRr5e_0(true);
        kQgRr5e_03.KQgRr5e_0();
        QxJ9d_1 = new KQgRr5e_0(false).KQgRr5e_0();
    }

    public LGe8pk_15(KQgRr5e_0 kQgRr5e_0) {
        this.f1663KQgRr5e_0 = kQgRr5e_0.KQgRr5e_0;
        this.f1664KQgRr5e_0 = kQgRr5e_0.f1667KQgRr5e_0;
        this.f1666QxJ9d_1 = kQgRr5e_0.f1668QxJ9d_1;
        this.f1665QxJ9d_1 = kQgRr5e_0.QxJ9d_1;
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public boolean m765KQgRr5e_0() {
        return this.f1663KQgRr5e_0;
    }

    @Nullable
    public List<R6WQ_35> QxJ9d_1() {
        String[] strArr = this.f1666QxJ9d_1;
        if (strArr != null) {
            return R6WQ_35.KQgRr5e_0(strArr);
        }
        return null;
    }

    public boolean equals(@Nullable Object obj) {
        if (obj instanceof LGe8pk_15) {
            if (obj == this) {
                return true;
            }
            LGe8pk_15 lGe8pk_15 = (LGe8pk_15) obj;
            boolean z = this.f1663KQgRr5e_0;
            if (z != lGe8pk_15.f1663KQgRr5e_0) {
                return false;
            }
            return !z || (Arrays.equals(this.f1664KQgRr5e_0, lGe8pk_15.f1664KQgRr5e_0) && Arrays.equals(this.f1666QxJ9d_1, lGe8pk_15.f1666QxJ9d_1) && this.f1665QxJ9d_1 == lGe8pk_15.f1665QxJ9d_1);
        }
        return false;
    }

    public int hashCode() {
        if (this.f1663KQgRr5e_0) {
            return ((((527 + Arrays.hashCode(this.f1664KQgRr5e_0)) * 31) + Arrays.hashCode(this.f1666QxJ9d_1)) * 31) + (!this.f1665QxJ9d_1 ? 1 : 0);
        }
        return 17;
    }

    public String toString() {
        if (this.f1663KQgRr5e_0) {
            return "ConnectionSpec(cipherSuites=" + defpackage.PGPF6hQ_2.KQgRr5e_0(KQgRr5e_0(), "[all enabled]") + ", tlsVersions=" + defpackage.PGPF6hQ_2.KQgRr5e_0(QxJ9d_1(), "[all enabled]") + ", supportsTlsExtensions=" + this.f1665QxJ9d_1 + ")";
        }
        return "ConnectionSpec()";
    }

    /* compiled from: ConnectionSpec.java */
    /* loaded from: classes.dex */
    public static final class KQgRr5e_0 {
        public boolean KQgRr5e_0;
        @Nullable

        /* renamed from: KQgRr5e_0  reason: collision with other field name */
        public String[] f1667KQgRr5e_0;
        public boolean QxJ9d_1;
        @Nullable

        /* renamed from: QxJ9d_1  reason: collision with other field name */
        public String[] f1668QxJ9d_1;

        public KQgRr5e_0(boolean z) {
            this.KQgRr5e_0 = z;
        }

        public KQgRr5e_0 KQgRr5e_0(EuDEkJe_12... euDEkJe_12Arr) {
            if (this.KQgRr5e_0) {
                String[] strArr = new String[euDEkJe_12Arr.length];
                for (int i = 0; i < euDEkJe_12Arr.length; i++) {
                    strArr[i] = euDEkJe_12Arr[i].f1445KQgRr5e_0;
                }
                KQgRr5e_0(strArr);
                return this;
            }
            throw new IllegalStateException("no cipher suites for cleartext connections");
        }

        public KQgRr5e_0 QxJ9d_1(String... strArr) {
            if (this.KQgRr5e_0) {
                if (strArr.length != 0) {
                    this.f1668QxJ9d_1 = (String[]) strArr.clone();
                    return this;
                }
                throw new IllegalArgumentException("At least one TLS version is required");
            }
            throw new IllegalStateException("no TLS versions for cleartext connections");
        }

        public KQgRr5e_0(LGe8pk_15 lGe8pk_15) {
            this.KQgRr5e_0 = lGe8pk_15.f1663KQgRr5e_0;
            this.f1667KQgRr5e_0 = lGe8pk_15.f1664KQgRr5e_0;
            this.f1668QxJ9d_1 = lGe8pk_15.f1666QxJ9d_1;
            this.QxJ9d_1 = lGe8pk_15.f1665QxJ9d_1;
        }

        public KQgRr5e_0 KQgRr5e_0(String... strArr) {
            if (this.KQgRr5e_0) {
                if (strArr.length != 0) {
                    this.f1667KQgRr5e_0 = (String[]) strArr.clone();
                    return this;
                }
                throw new IllegalArgumentException("At least one cipher suite is required");
            }
            throw new IllegalStateException("no cipher suites for cleartext connections");
        }

        public KQgRr5e_0 KQgRr5e_0(R6WQ_35... r6wq_35Arr) {
            if (this.KQgRr5e_0) {
                String[] strArr = new String[r6wq_35Arr.length];
                for (int i = 0; i < r6wq_35Arr.length; i++) {
                    strArr[i] = r6wq_35Arr[i].f1674KQgRr5e_0;
                }
                QxJ9d_1(strArr);
                return this;
            }
            throw new IllegalStateException("no TLS versions for cleartext connections");
        }

        public KQgRr5e_0 KQgRr5e_0(boolean z) {
            if (this.KQgRr5e_0) {
                this.QxJ9d_1 = z;
                return this;
            }
            throw new IllegalStateException("no TLS extensions for cleartext connections");
        }

        public LGe8pk_15 KQgRr5e_0() {
            return new LGe8pk_15(this);
        }
    }

    @Nullable
    public List<EuDEkJe_12> KQgRr5e_0() {
        String[] strArr = this.f1664KQgRr5e_0;
        if (strArr != null) {
            return EuDEkJe_12.KQgRr5e_0(strArr);
        }
        return null;
    }

    /* renamed from: QxJ9d_1  reason: collision with other method in class */
    public boolean m766QxJ9d_1() {
        return this.f1665QxJ9d_1;
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public void m764KQgRr5e_0(SSLSocket sSLSocket, boolean z) {
        LGe8pk_15 KQgRr5e_02 = KQgRr5e_0(sSLSocket, z);
        String[] strArr = KQgRr5e_02.f1666QxJ9d_1;
        if (strArr != null) {
            sSLSocket.setEnabledProtocols(strArr);
        }
        String[] strArr2 = KQgRr5e_02.f1664KQgRr5e_0;
        if (strArr2 != null) {
            sSLSocket.setEnabledCipherSuites(strArr2);
        }
    }

    public final LGe8pk_15 KQgRr5e_0(SSLSocket sSLSocket, boolean z) {
        String[] enabledCipherSuites;
        String[] enabledProtocols;
        if (this.f1664KQgRr5e_0 != null) {
            enabledCipherSuites = XnFJ5_9.Ft6VRog_36.X6FRs_4.m733KQgRr5e_0((Comparator<? super String>) EuDEkJe_12.f1443KQgRr5e_0, sSLSocket.getEnabledCipherSuites(), this.f1664KQgRr5e_0);
        } else {
            enabledCipherSuites = sSLSocket.getEnabledCipherSuites();
        }
        if (this.f1666QxJ9d_1 != null) {
            enabledProtocols = XnFJ5_9.Ft6VRog_36.X6FRs_4.m733KQgRr5e_0((Comparator<? super String>) XnFJ5_9.Ft6VRog_36.X6FRs_4.f1614KQgRr5e_0, sSLSocket.getEnabledProtocols(), this.f1666QxJ9d_1);
        } else {
            enabledProtocols = sSLSocket.getEnabledProtocols();
        }
        String[] supportedCipherSuites = sSLSocket.getSupportedCipherSuites();
        int KQgRr5e_02 = XnFJ5_9.Ft6VRog_36.X6FRs_4.KQgRr5e_0(EuDEkJe_12.f1443KQgRr5e_0, supportedCipherSuites, "TLS_FALLBACK_SCSV");
        if (z && KQgRr5e_02 != -1) {
            enabledCipherSuites = XnFJ5_9.Ft6VRog_36.X6FRs_4.KQgRr5e_0(enabledCipherSuites, supportedCipherSuites[KQgRr5e_02]);
        }
        KQgRr5e_0 kQgRr5e_0 = new KQgRr5e_0(this);
        kQgRr5e_0.KQgRr5e_0(enabledCipherSuites);
        kQgRr5e_0.QxJ9d_1(enabledProtocols);
        return kQgRr5e_0.KQgRr5e_0();
    }

    public boolean KQgRr5e_0(SSLSocket sSLSocket) {
        if (this.f1663KQgRr5e_0) {
            String[] strArr = this.f1666QxJ9d_1;
            if (strArr == null || XnFJ5_9.Ft6VRog_36.X6FRs_4.KQgRr5e_0(XnFJ5_9.Ft6VRog_36.X6FRs_4.f1614KQgRr5e_0, strArr, sSLSocket.getEnabledProtocols())) {
                String[] strArr2 = this.f1664KQgRr5e_0;
                return strArr2 == null || XnFJ5_9.Ft6VRog_36.X6FRs_4.KQgRr5e_0(EuDEkJe_12.f1443KQgRr5e_0, strArr2, sSLSocket.getEnabledCipherSuites());
            }
            return false;
        }
        return false;
    }
}
