discord-jadx/app/src/main/java/f0/x.java

450 lines
16 KiB
Java

package f0;
import d0.t.r;
import d0.t.u;
import d0.z.d.m;
import f0.e;
import f0.f0.c;
import f0.f0.g.l;
import f0.f0.k.h;
import f0.f0.m.d;
import f0.t;
import f0.z;
import java.net.ProtocolException;
import java.net.Proxy;
import java.net.ProxySelector;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import javax.net.SocketFactory;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.X509TrustManager;
import kotlin.TypeCastException;
import kotlin.jvm.internal.DefaultConstructorMarker;
import okhttp3.Interceptor;
import okhttp3.WebSocket;
import okhttp3.WebSocketListener;
/* compiled from: OkHttpClient.kt */
public class x implements Cloneable, e.a {
public static final List<y> i = c.m(y.HTTP_2, y.HTTP_1_1);
public static final List<m> j = c.m(m.f2774c, m.d);
public static final b k = new b(null);
public final SSLSocketFactory A;
public final X509TrustManager B;
public final List<m> C;
public final List<y> D;
public final HostnameVerifier E;
public final g F;
public final f0.f0.m.c G;
public final int H;
public final int I;
public final int J;
public final int K;
public final int L;
public final long M;
public final l N;
public final q l;
public final l m;
public final List<Interceptor> n;
public final List<Interceptor> o;
public final t.b p;
public final boolean q;
public final c r;
/* renamed from: s reason: collision with root package name */
public final boolean f2783s;
public final boolean t;
public final p u;
public final s v;
public final Proxy w;
/* renamed from: x reason: collision with root package name */
public final ProxySelector f2784x;
/* renamed from: y reason: collision with root package name */
public final c f2785y;
/* renamed from: z reason: collision with root package name */
public final SocketFactory f2786z;
/* compiled from: OkHttpClient.kt */
public static final class a {
public int A;
public long B;
public l C;
public q a = new q();
public l b = new l();
/* renamed from: c reason: collision with root package name */
public final List<Interceptor> f2787c = new ArrayList();
public final List<Interceptor> d = new ArrayList();
public t.b e;
public boolean f;
public c g;
public boolean h;
public boolean i;
public p j;
public s k;
public Proxy l;
public ProxySelector m;
public c n;
public SocketFactory o;
public SSLSocketFactory p;
public X509TrustManager q;
public List<m> r;
/* renamed from: s reason: collision with root package name */
public List<? extends y> f2788s;
public HostnameVerifier t;
public g u;
public f0.f0.m.c v;
public int w;
/* renamed from: x reason: collision with root package name */
public int f2789x;
/* renamed from: y reason: collision with root package name */
public int f2790y;
/* renamed from: z reason: collision with root package name */
public int f2791z;
public a() {
t tVar = t.a;
m.checkParameterIsNotNull(tVar, "$this$asFactory");
this.e = new f0.f0.a(tVar);
this.f = true;
c cVar = c.a;
this.g = cVar;
this.h = true;
this.i = true;
this.j = p.a;
this.k = s.a;
this.n = cVar;
SocketFactory socketFactory = SocketFactory.getDefault();
m.checkExpressionValueIsNotNull(socketFactory, "SocketFactory.getDefault()");
this.o = socketFactory;
b bVar = x.k;
this.r = x.j;
this.f2788s = x.i;
this.t = d.a;
this.u = g.a;
this.f2789x = 10000;
this.f2790y = 10000;
this.f2791z = 10000;
this.B = 1024;
}
public final a a(long j, TimeUnit timeUnit) {
m.checkParameterIsNotNull(timeUnit, "unit");
this.f2790y = c.b("timeout", j, timeUnit);
return this;
}
public final a b(SSLSocketFactory sSLSocketFactory, X509TrustManager x509TrustManager) {
m.checkParameterIsNotNull(sSLSocketFactory, "sslSocketFactory");
m.checkParameterIsNotNull(x509TrustManager, "trustManager");
if ((!m.areEqual(sSLSocketFactory, this.p)) || (!m.areEqual(x509TrustManager, this.q))) {
this.C = null;
}
this.p = sSLSocketFactory;
m.checkParameterIsNotNull(x509TrustManager, "trustManager");
h.a aVar = h.f2756c;
this.v = h.a.b(x509TrustManager);
this.q = x509TrustManager;
return this;
}
}
/* compiled from: OkHttpClient.kt */
public static final class b {
public b(DefaultConstructorMarker defaultConstructorMarker) {
}
}
public x() {
this(new a());
}
/* JADX DEBUG: Type inference failed for r1v0. Raw type applied. Possible types: java.util.List<? extends f0.y>, java.util.List<f0.y> */
/* JADX WARNING: Removed duplicated region for block: B:110:0x0211 */
/* JADX WARNING: Removed duplicated region for block: B:24:0x00b3 */
/* JADX WARNING: Removed duplicated region for block: B:25:0x00be */
/* JADX WARNING: Removed duplicated region for block: B:49:0x0120 */
public x(a aVar) {
ProxySelector proxySelector;
boolean z2;
List<Interceptor> list;
boolean z3;
m.checkParameterIsNotNull(aVar, "builder");
this.l = aVar.a;
this.m = aVar.b;
this.n = c.z(aVar.f2787c);
this.o = c.z(aVar.d);
this.p = aVar.e;
this.q = aVar.f;
this.r = aVar.g;
this.f2783s = aVar.h;
this.t = aVar.i;
this.u = aVar.j;
this.v = aVar.k;
Proxy proxy = aVar.l;
this.w = proxy;
if (proxy != null) {
proxySelector = f0.f0.l.a.a;
} else {
proxySelector = aVar.m;
proxySelector = proxySelector == null ? ProxySelector.getDefault() : proxySelector;
if (proxySelector == null) {
proxySelector = f0.f0.l.a.a;
}
}
this.f2784x = proxySelector;
this.f2785y = aVar.n;
this.f2786z = aVar.o;
List<m> list2 = aVar.r;
this.C = list2;
this.D = aVar.f2788s;
this.E = aVar.t;
this.H = aVar.w;
this.I = aVar.f2789x;
this.J = aVar.f2790y;
this.K = aVar.f2791z;
this.L = aVar.A;
this.M = aVar.B;
l lVar = aVar.C;
this.N = lVar == null ? new l() : lVar;
boolean z4 = false;
if (!(list2 instanceof Collection) || !list2.isEmpty()) {
Iterator<T> it = list2.iterator();
while (true) {
if (it.hasNext()) {
if (((m) it.next()).e) {
z2 = false;
break;
}
} else {
break;
}
}
if (!z2) {
this.A = null;
this.G = null;
this.B = null;
this.F = g.a;
} else {
SSLSocketFactory sSLSocketFactory = aVar.p;
if (sSLSocketFactory != null) {
this.A = sSLSocketFactory;
f0.f0.m.c cVar = aVar.v;
if (cVar == null) {
m.throwNpe();
}
this.G = cVar;
X509TrustManager x509TrustManager = aVar.q;
if (x509TrustManager == null) {
m.throwNpe();
}
this.B = x509TrustManager;
g gVar = aVar.u;
if (cVar == null) {
m.throwNpe();
}
this.F = gVar.b(cVar);
} else {
h.a aVar2 = h.f2756c;
X509TrustManager n = h.a.n();
this.B = n;
h hVar = h.a;
if (n == null) {
m.throwNpe();
}
this.A = hVar.m(n);
if (n == null) {
m.throwNpe();
}
m.checkParameterIsNotNull(n, "trustManager");
f0.f0.m.c b2 = h.a.b(n);
this.G = b2;
g gVar2 = aVar.u;
if (b2 == null) {
m.throwNpe();
}
this.F = gVar2.b(b2);
}
}
list = this.n;
if (list != null) {
throw new TypeCastException("null cannot be cast to non-null type kotlin.collections.List<okhttp3.Interceptor?>");
} else if (!list.contains(null)) {
List<Interceptor> list3 = this.o;
if (list3 == null) {
throw new TypeCastException("null cannot be cast to non-null type kotlin.collections.List<okhttp3.Interceptor?>");
} else if (!list3.contains(null)) {
List<m> list4 = this.C;
if (!(list4 instanceof Collection) || !list4.isEmpty()) {
Iterator<T> it2 = list4.iterator();
while (true) {
if (it2.hasNext()) {
if (((m) it2.next()).e) {
z3 = false;
break;
}
} else {
break;
}
}
}
z3 = true;
if (z3) {
if (this.A == null) {
if (this.G == null) {
if (!(this.B == null ? true : z4)) {
throw new IllegalStateException("Check failed.".toString());
} else if (!m.areEqual(this.F, g.a)) {
throw new IllegalStateException("Check failed.".toString());
} else {
return;
}
} else {
throw new IllegalStateException("Check failed.".toString());
}
} else {
throw new IllegalStateException("Check failed.".toString());
}
} else if (this.A == null) {
throw new IllegalStateException("sslSocketFactory == null".toString());
} else if (this.G == null) {
throw new IllegalStateException("certificateChainCleaner == null".toString());
} else if (this.B == null) {
throw new IllegalStateException("x509TrustManager == null".toString());
} else {
return;
}
} else {
StringBuilder K = c.d.b.a.a.K("Null network interceptor: ");
K.append(this.o);
throw new IllegalStateException(K.toString().toString());
}
} else {
StringBuilder K2 = c.d.b.a.a.K("Null interceptor: ");
K2.append(this.n);
throw new IllegalStateException(K2.toString().toString());
}
}
z2 = true;
if (!z2) {
}
list = this.n;
if (list != null) {
}
}
@Override // f0.e.a
public e b(z zVar) {
m.checkParameterIsNotNull(zVar, "request");
return new f0.f0.g.e(this, zVar, false);
}
@Override // java.lang.Object
public Object clone() {
return super.clone();
}
public a f() {
m.checkParameterIsNotNull(this, "okHttpClient");
a aVar = new a();
aVar.a = this.l;
aVar.b = this.m;
r.addAll(aVar.f2787c, this.n);
r.addAll(aVar.d, this.o);
aVar.e = this.p;
aVar.f = this.q;
aVar.g = this.r;
aVar.h = this.f2783s;
aVar.i = this.t;
aVar.j = this.u;
aVar.k = this.v;
aVar.l = this.w;
aVar.m = this.f2784x;
aVar.n = this.f2785y;
aVar.o = this.f2786z;
aVar.p = this.A;
aVar.q = this.B;
aVar.r = this.C;
aVar.f2788s = this.D;
aVar.t = this.E;
aVar.u = this.F;
aVar.v = this.G;
aVar.w = this.H;
aVar.f2789x = this.I;
aVar.f2790y = this.J;
aVar.f2791z = this.K;
aVar.A = this.L;
aVar.B = this.M;
aVar.C = this.N;
return aVar;
}
public WebSocket g(z zVar, WebSocketListener webSocketListener) {
m.checkParameterIsNotNull(zVar, "request");
m.checkParameterIsNotNull(webSocketListener, "listener");
f0.f0.n.d dVar = new f0.f0.n.d(f0.f0.f.d.a, zVar, webSocketListener, new Random(), (long) this.L, null, this.M);
m.checkParameterIsNotNull(this, "client");
if (dVar.u.b("Sec-WebSocket-Extensions") != null) {
dVar.i(new ProtocolException("Request header not permitted: 'Sec-WebSocket-Extensions'"), null);
} else {
a f = f();
t tVar = t.a;
m.checkParameterIsNotNull(tVar, "eventListener");
byte[] bArr = c.a;
m.checkParameterIsNotNull(tVar, "$this$asFactory");
f.e = new f0.f0.a(tVar);
List<y> list = f0.f0.n.d.a;
m.checkParameterIsNotNull(list, "protocols");
List mutableList = u.toMutableList((Collection) list);
y yVar = y.H2_PRIOR_KNOWLEDGE;
boolean z2 = false;
if (mutableList.contains(yVar) || mutableList.contains(y.HTTP_1_1)) {
if (!mutableList.contains(yVar) || mutableList.size() <= 1) {
z2 = true;
}
if (!z2) {
throw new IllegalArgumentException(("protocols containing h2_prior_knowledge cannot use other protocols: " + mutableList).toString());
} else if (!(!mutableList.contains(y.HTTP_1_0))) {
throw new IllegalArgumentException(("protocols must not contain http/1.0: " + mutableList).toString());
} else if (!mutableList.contains(null)) {
mutableList.remove(y.SPDY_3);
if (!m.areEqual(mutableList, f.f2788s)) {
f.C = null;
}
List<? extends y> unmodifiableList = Collections.unmodifiableList(mutableList);
m.checkExpressionValueIsNotNull(unmodifiableList, "Collections.unmodifiableList(protocolsCopy)");
f.f2788s = unmodifiableList;
x xVar = new x(f);
z.a aVar = new z.a(dVar.u);
aVar.b("Upgrade", "websocket");
aVar.b("Connection", "Upgrade");
aVar.b("Sec-WebSocket-Key", dVar.b);
aVar.b("Sec-WebSocket-Version", "13");
aVar.b("Sec-WebSocket-Extensions", "permessage-deflate");
z a2 = aVar.a();
f0.f0.g.e eVar = new f0.f0.g.e(xVar, a2, true);
dVar.f2760c = eVar;
eVar.e(new f0.f0.n.e(dVar, a2));
} else {
throw new IllegalArgumentException("protocols must not contain null".toString());
}
} else {
throw new IllegalArgumentException(("protocols must contain h2_prior_knowledge or http/1.1: " + mutableList).toString());
}
}
return dVar;
}
}