discord-jadx/app/src/main/java/i0/p.java

406 lines
12 KiB
Java

package i0;
import d0.z.d.m;
import f0.e;
import f0.f;
import f0.u;
import f0.w;
import f0.y;
import f0.z;
import g0.g;
import g0.j;
import g0.r;
import g0.x;
import i0.v;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Objects;
import okhttp3.Headers;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.Response;
import okhttp3.ResponseBody;
/* compiled from: OkHttpCall */
public final class p<T> implements d<T> {
public final w i;
public final Object[] j;
public final e.a k;
public final h<ResponseBody, T> l;
public volatile boolean m;
public e n;
public Throwable o;
public boolean p;
/* compiled from: OkHttpCall */
public class a implements f {
public final /* synthetic */ f a;
public a(f fVar) {
this.a = fVar;
}
@Override // f0.f
public void a(e eVar, Response response) {
try {
try {
this.a.b(p.this, p.this.g(response));
} catch (Throwable th) {
c0.o(th);
th.printStackTrace();
}
} catch (Throwable th2) {
c0.o(th2);
th2.printStackTrace();
}
}
@Override // f0.f
public void b(e eVar, IOException iOException) {
try {
this.a.a(p.this, iOException);
} catch (Throwable th) {
c0.o(th);
th.printStackTrace();
}
}
}
/* compiled from: OkHttpCall */
public static final class b extends ResponseBody {
public final ResponseBody k;
public final g l;
public IOException m;
/* compiled from: OkHttpCall */
public class a extends j {
public a(x xVar) {
super(xVar);
}
@Override // g0.x
public long h0(g0.e eVar, long j) throws IOException {
try {
m.checkParameterIsNotNull(eVar, "sink");
return this.i.h0(eVar, j);
} catch (IOException e) {
b.this.m = e;
throw e;
}
}
}
public b(ResponseBody responseBody) {
this.k = responseBody;
a aVar = new a(responseBody.c());
m.checkParameterIsNotNull(aVar, "$this$buffer");
this.l = new r(aVar);
}
@Override // okhttp3.ResponseBody
public long a() {
return this.k.a();
}
@Override // okhttp3.ResponseBody
public MediaType b() {
return this.k.b();
}
@Override // okhttp3.ResponseBody
public g c() {
return this.l;
}
@Override // okhttp3.ResponseBody, java.io.Closeable, java.lang.AutoCloseable
public void close() {
this.k.close();
}
}
/* compiled from: OkHttpCall */
public static final class c extends ResponseBody {
public final MediaType k;
public final long l;
public c(MediaType mediaType, long j) {
this.k = mediaType;
this.l = j;
}
@Override // okhttp3.ResponseBody
public long a() {
return this.l;
}
@Override // okhttp3.ResponseBody
public MediaType b() {
return this.k;
}
@Override // okhttp3.ResponseBody
public g c() {
throw new IllegalStateException("Cannot read raw response body of a converted body.");
}
}
public p(w wVar, Object[] objArr, e.a aVar, h<ResponseBody, T> hVar) {
this.i = wVar;
this.j = objArr;
this.k = aVar;
this.l = hVar;
}
@Override // i0.d
public void B(f<T> fVar) {
e eVar;
Throwable th;
synchronized (this) {
if (!this.p) {
this.p = true;
eVar = this.n;
th = this.o;
if (eVar == null && th == null) {
try {
e b2 = b();
this.n = b2;
eVar = b2;
} catch (Throwable th2) {
th = th2;
c0.o(th);
this.o = th;
}
}
} else {
throw new IllegalStateException("Already executed.");
}
}
if (th != null) {
fVar.a(this, th);
return;
}
if (this.m) {
eVar.cancel();
}
eVar.e(new a(fVar));
}
@Override // i0.d
public d K() {
return new p(this.i, this.j, this.k, this.l);
}
/* JADX DEBUG: Multi-variable search result rejected for r3v4, resolved type: f0.z$a */
/* JADX WARN: Multi-variable type inference failed */
public final e b() throws IOException {
w wVar;
e.a aVar = this.k;
w wVar2 = this.i;
Object[] objArr = this.j;
t<?>[] tVarArr = wVar2.j;
int length = objArr.length;
if (length == tVarArr.length) {
v vVar = new v(wVar2.f2844c, wVar2.b, wVar2.d, wVar2.e, wVar2.f, wVar2.g, wVar2.h, wVar2.i);
if (wVar2.k) {
length--;
}
ArrayList arrayList = new ArrayList(length);
for (int i = 0; i < length; i++) {
arrayList.add(objArr[i]);
tVarArr[i].a(vVar, objArr[i]);
}
w.a aVar2 = vVar.f;
if (aVar2 != null) {
wVar = aVar2.b();
} else {
w wVar3 = vVar.d;
String str = vVar.e;
Objects.requireNonNull(wVar3);
m.checkParameterIsNotNull(str, "link");
w.a g = wVar3.g(str);
wVar = g != null ? g.b() : null;
if (wVar == null) {
StringBuilder K = c.d.b.a.a.K("Malformed URL. Base: ");
K.append(vVar.d);
K.append(", Relative: ");
K.append(vVar.e);
throw new IllegalArgumentException(K.toString());
}
}
RequestBody requestBody = vVar.m;
if (requestBody == null) {
u.a aVar3 = vVar.l;
if (aVar3 != null) {
requestBody = new u(aVar3.a, aVar3.b);
} else {
MultipartBody.a aVar4 = vVar.k;
if (aVar4 != null) {
requestBody = aVar4.b();
} else if (vVar.j) {
requestBody = RequestBody.create((MediaType) null, new byte[0]);
}
}
}
MediaType mediaType = vVar.i;
v.a aVar5 = requestBody;
if (mediaType != null) {
if (requestBody != null) {
aVar5 = new v.a(requestBody, mediaType);
} else {
vVar.h.a("Content-Type", mediaType.d);
aVar5 = requestBody;
}
}
z.a aVar6 = vVar.g;
aVar6.g(wVar);
Headers c2 = vVar.h.c();
m.checkParameterIsNotNull(c2, "headers");
aVar6.f2793c = c2.e();
aVar6.c(vVar.f2843c, aVar5);
aVar6.e(k.class, new k(wVar2.a, arrayList));
e b2 = aVar.b(aVar6.a());
Objects.requireNonNull(b2, "Call.Factory returned null.");
return b2;
}
throw new IllegalArgumentException(c.d.b.a.a.w(c.d.b.a.a.L("Argument count (", length, ") doesn't match expected count ("), tVarArr.length, ")"));
}
@Override // i0.d
public synchronized z c() {
try {
} catch (IOException e) {
throw new RuntimeException("Unable to create request.", e);
}
return f().c();
}
@Override // i0.d
public void cancel() {
e eVar;
this.m = true;
synchronized (this) {
eVar = this.n;
}
if (eVar != null) {
eVar.cancel();
}
}
@Override // java.lang.Object
public Object clone() throws CloneNotSupportedException {
return new p(this.i, this.j, this.k, this.l);
}
@Override // i0.d
public boolean d() {
boolean z2 = true;
if (this.m) {
return true;
}
synchronized (this) {
e eVar = this.n;
if (eVar == null || !eVar.d()) {
z2 = false;
}
}
return z2;
}
@Override // i0.d
public retrofit2.Response<T> execute() throws IOException {
e f;
synchronized (this) {
if (!this.p) {
this.p = true;
f = f();
} else {
throw new IllegalStateException("Already executed.");
}
}
if (this.m) {
f.cancel();
}
return g(f.execute());
}
public final e f() throws IOException {
e eVar = this.n;
if (eVar != null) {
return eVar;
}
Throwable th = this.o;
if (th == null) {
try {
e b2 = b();
this.n = b2;
return b2;
} catch (IOException | Error | RuntimeException e) {
c0.o(e);
this.o = e;
throw e;
}
} else if (th instanceof IOException) {
throw ((IOException) th);
} else if (th instanceof RuntimeException) {
throw ((RuntimeException) th);
} else {
throw ((Error) th);
}
}
public retrofit2.Response<T> g(Response response) throws IOException {
ResponseBody responseBody = response.o;
m.checkParameterIsNotNull(response, "response");
z zVar = response.i;
y yVar = response.j;
int i = response.l;
String str = response.k;
f0.v vVar = response.m;
Headers.a e = response.n.e();
Response response2 = response.p;
Response response3 = response.q;
Response response4 = response.r;
long j = response.f2879s;
long j2 = response.t;
f0.f0.g.c cVar = response.u;
c cVar2 = new c(responseBody.b(), responseBody.a());
if (!(i >= 0)) {
throw new IllegalStateException(c.d.b.a.a.j("code < 0: ", i).toString());
} else if (zVar == null) {
throw new IllegalStateException("request == null".toString());
} else if (yVar == null) {
throw new IllegalStateException("protocol == null".toString());
} else if (str != null) {
Response response5 = new Response(zVar, yVar, str, i, vVar, e.c(), cVar2, response2, response3, response4, j, j2, cVar);
int i2 = response5.l;
if (i2 < 200 || i2 >= 300) {
try {
ResponseBody a2 = c0.a(responseBody);
if (!response5.b()) {
return new retrofit2.Response<>(response5, null, a2);
}
throw new IllegalArgumentException("rawResponse should not be successful response");
} finally {
responseBody.close();
}
} else if (i2 == 204 || i2 == 205) {
responseBody.close();
return retrofit2.Response.b(null, response5);
} else {
b bVar = new b(responseBody);
try {
return retrofit2.Response.b(this.l.convert(bVar), response5);
} catch (RuntimeException e2) {
IOException iOException = bVar.m;
if (iOException == null) {
throw e2;
}
throw iOException;
}
}
} else {
throw new IllegalStateException("message == null".toString());
}
}
}