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

499 lines
18 KiB
Java

package i0;
import java.io.IOException;
import java.lang.reflect.Method;
import java.util.Map;
import java.util.Objects;
import okhttp3.Headers;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
/* compiled from: ParameterHandler */
public abstract class t<T> {
/* compiled from: ParameterHandler */
public static final class a<T> extends t<T> {
public final Method a;
public final int b;
/* renamed from: c reason: collision with root package name */
public final h<T, RequestBody> f2826c;
public a(Method method, int i, h<T, RequestBody> hVar) {
this.a = method;
this.b = i;
this.f2826c = hVar;
}
@Override // i0.t
public void a(v vVar, T t) {
if (t != null) {
try {
vVar.m = this.f2826c.convert(t);
} catch (IOException e) {
Method method = this.a;
int i = this.b;
throw d0.m(method, e, i, "Unable to convert " + ((Object) t) + " to RequestBody", new Object[0]);
}
} else {
throw d0.l(this.a, this.b, "Body parameter value must not be null.", new Object[0]);
}
}
}
/* compiled from: ParameterHandler */
public static final class b<T> extends t<T> {
public final String a;
public final h<T, String> b;
/* renamed from: c reason: collision with root package name */
public final boolean f2827c;
public b(String str, h<T, String> hVar, boolean z2) {
Objects.requireNonNull(str, "name == null");
this.a = str;
this.b = hVar;
this.f2827c = z2;
}
@Override // i0.t
public void a(v vVar, T t) throws IOException {
String convert;
if (t != null && (convert = this.b.convert(t)) != null) {
vVar.a(this.a, convert, this.f2827c);
}
}
}
/* compiled from: ParameterHandler */
public static final class c<T> extends t<Map<String, T>> {
public final Method a;
public final int b;
/* renamed from: c reason: collision with root package name */
public final h<T, String> f2828c;
public final boolean d;
public c(Method method, int i, h<T, String> hVar, boolean z2) {
this.a = method;
this.b = i;
this.f2828c = hVar;
this.d = z2;
}
/* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: i0.h<T, java.lang.String> */
/* JADX WARN: Multi-variable type inference failed */
@Override // i0.t
public void a(v vVar, Object obj) throws IOException {
Map map = (Map) obj;
if (map != null) {
for (Map.Entry entry : map.entrySet()) {
String str = (String) entry.getKey();
if (str != null) {
Object value = entry.getValue();
if (value != null) {
String str2 = (String) this.f2828c.convert(value);
if (str2 != null) {
vVar.a(str, str2, this.d);
} else {
Method method = this.a;
int i = this.b;
throw d0.l(method, i, "Field map value '" + value + "' converted to null by " + this.f2828c.getClass().getName() + " for key '" + str + "'.", new Object[0]);
}
} else {
throw d0.l(this.a, this.b, c.d.b.a.a.u("Field map contained null value for key '", str, "'."), new Object[0]);
}
} else {
throw d0.l(this.a, this.b, "Field map contained null key.", new Object[0]);
}
}
return;
}
throw d0.l(this.a, this.b, "Field map was null.", new Object[0]);
}
}
/* compiled from: ParameterHandler */
public static final class d<T> extends t<T> {
public final String a;
public final h<T, String> b;
public d(String str, h<T, String> hVar) {
Objects.requireNonNull(str, "name == null");
this.a = str;
this.b = hVar;
}
@Override // i0.t
public void a(v vVar, T t) throws IOException {
String convert;
if (t != null && (convert = this.b.convert(t)) != null) {
vVar.b(this.a, convert);
}
}
}
/* compiled from: ParameterHandler */
public static final class e<T> extends t<Map<String, T>> {
public final Method a;
public final int b;
/* renamed from: c reason: collision with root package name */
public final h<T, String> f2829c;
public e(Method method, int i, h<T, String> hVar) {
this.a = method;
this.b = i;
this.f2829c = hVar;
}
/* JADX DEBUG: Multi-variable search result rejected for r3v1, resolved type: i0.h<T, java.lang.String> */
/* JADX WARN: Multi-variable type inference failed */
@Override // i0.t
public void a(v vVar, Object obj) throws IOException {
Map map = (Map) obj;
if (map != null) {
for (Map.Entry entry : map.entrySet()) {
String str = (String) entry.getKey();
if (str != null) {
Object value = entry.getValue();
if (value != null) {
vVar.b(str, (String) this.f2829c.convert(value));
} else {
throw d0.l(this.a, this.b, c.d.b.a.a.u("Header map contained null value for key '", str, "'."), new Object[0]);
}
} else {
throw d0.l(this.a, this.b, "Header map contained null key.", new Object[0]);
}
}
return;
}
throw d0.l(this.a, this.b, "Header map was null.", new Object[0]);
}
}
/* compiled from: ParameterHandler */
public static final class f extends t<Headers> {
public final Method a;
public final int b;
public f(Method method, int i) {
this.a = method;
this.b = i;
}
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [i0.v, java.lang.Object] */
@Override // i0.t
public void a(v vVar, Headers headers) throws IOException {
Headers headers2 = headers;
if (headers2 != null) {
Headers.a aVar = vVar.h;
Objects.requireNonNull(aVar);
d0.z.d.m.checkParameterIsNotNull(headers2, "headers");
int size = headers2.size();
for (int i = 0; i < size; i++) {
aVar.b(headers2.d(i), headers2.g(i));
}
return;
}
throw d0.l(this.a, this.b, "Headers parameter must not be null.", new Object[0]);
}
}
/* compiled from: ParameterHandler */
public static final class g<T> extends t<T> {
public final Method a;
public final int b;
/* renamed from: c reason: collision with root package name */
public final Headers f2830c;
public final h<T, RequestBody> d;
public g(Method method, int i, Headers headers, h<T, RequestBody> hVar) {
this.a = method;
this.b = i;
this.f2830c = headers;
this.d = hVar;
}
@Override // i0.t
public void a(v vVar, T t) {
if (t != null) {
try {
vVar.c(this.f2830c, this.d.convert(t));
} catch (IOException e) {
Method method = this.a;
int i = this.b;
throw d0.l(method, i, "Unable to convert " + ((Object) t) + " to RequestBody", e);
}
}
}
}
/* compiled from: ParameterHandler */
public static final class h<T> extends t<Map<String, T>> {
public final Method a;
public final int b;
/* renamed from: c reason: collision with root package name */
public final h<T, RequestBody> f2831c;
public final String d;
public h(Method method, int i, h<T, RequestBody> hVar, String str) {
this.a = method;
this.b = i;
this.f2831c = hVar;
this.d = str;
}
/* JADX DEBUG: Multi-variable search result rejected for r3v3, resolved type: i0.h<T, okhttp3.RequestBody> */
/* JADX WARN: Multi-variable type inference failed */
@Override // i0.t
public void a(v vVar, Object obj) throws IOException {
Map map = (Map) obj;
if (map != null) {
for (Map.Entry entry : map.entrySet()) {
String str = (String) entry.getKey();
if (str != null) {
Object value = entry.getValue();
if (value != null) {
vVar.c(Headers.i.c("Content-Disposition", c.d.b.a.a.u("form-data; name=\"", str, "\""), "Content-Transfer-Encoding", this.d), (RequestBody) this.f2831c.convert(value));
} else {
throw d0.l(this.a, this.b, c.d.b.a.a.u("Part map contained null value for key '", str, "'."), new Object[0]);
}
} else {
throw d0.l(this.a, this.b, "Part map contained null key.", new Object[0]);
}
}
return;
}
throw d0.l(this.a, this.b, "Part map was null.", new Object[0]);
}
}
/* compiled from: ParameterHandler */
public static final class i<T> extends t<T> {
public final Method a;
public final int b;
/* renamed from: c reason: collision with root package name */
public final String f2832c;
public final h<T, String> d;
public final boolean e;
public i(Method method, int i, String str, h<T, String> hVar, boolean z2) {
this.a = method;
this.b = i;
Objects.requireNonNull(str, "name == null");
this.f2832c = str;
this.d = hVar;
this.e = z2;
}
@Override // i0.t
public void a(v vVar, T t) throws IOException {
String str;
int i;
int i2;
if (t != null) {
String str2 = this.f2832c;
String convert = this.d.convert(t);
boolean z2 = this.e;
if (vVar.e != null) {
int length = convert.length();
int i3 = 0;
while (true) {
if (i3 >= length) {
str = convert;
break;
}
int codePointAt = convert.codePointAt(i3);
i = 47;
i2 = -1;
if (codePointAt < 32 || codePointAt >= 127 || " \"<>^`{}|\\?#".indexOf(codePointAt) != -1 || (!z2 && (codePointAt == 47 || codePointAt == 37))) {
break;
}
i3 += Character.charCount(codePointAt);
}
g0.e eVar = new g0.e();
eVar.c0(convert, 0, i3);
g0.e eVar2 = null;
while (i3 < length) {
int codePointAt2 = convert.codePointAt(i3);
if (!z2 || !(codePointAt2 == 9 || codePointAt2 == 10 || codePointAt2 == 12 || codePointAt2 == 13)) {
if (codePointAt2 < 32 || codePointAt2 >= 127 || " \"<>^`{}|\\?#".indexOf(codePointAt2) != i2 || (!z2 && (codePointAt2 == i || codePointAt2 == 37))) {
if (eVar2 == null) {
eVar2 = new g0.e();
}
eVar2.e0(codePointAt2);
while (!eVar2.v()) {
int readByte = eVar2.readByte() & 255;
eVar.T(37);
char[] cArr = v.a;
eVar.T(cArr[(readByte >> 4) & 15]);
eVar.T(cArr[readByte & 15]);
}
} else {
eVar.e0(codePointAt2);
}
}
i3 += Character.charCount(codePointAt2);
i = 47;
i2 = -1;
}
str = eVar.G();
String str3 = vVar.e;
String replace = str3.replace("{" + str2 + "}", str);
if (!v.b.matcher(replace).matches()) {
vVar.e = replace;
return;
}
throw new IllegalArgumentException(c.d.b.a.a.t("@Path parameters shouldn't perform path traversal ('.' or '..'): ", convert));
}
throw new AssertionError();
}
throw d0.l(this.a, this.b, c.d.b.a.a.D(c.d.b.a.a.L("Path parameter \""), this.f2832c, "\" value must not be null."), new Object[0]);
}
}
/* compiled from: ParameterHandler */
public static final class j<T> extends t<T> {
public final String a;
public final h<T, String> b;
/* renamed from: c reason: collision with root package name */
public final boolean f2833c;
public j(String str, h<T, String> hVar, boolean z2) {
Objects.requireNonNull(str, "name == null");
this.a = str;
this.b = hVar;
this.f2833c = z2;
}
@Override // i0.t
public void a(v vVar, T t) throws IOException {
String convert;
if (t != null && (convert = this.b.convert(t)) != null) {
vVar.d(this.a, convert, this.f2833c);
}
}
}
/* compiled from: ParameterHandler */
public static final class k<T> extends t<Map<String, T>> {
public final Method a;
public final int b;
/* renamed from: c reason: collision with root package name */
public final h<T, String> f2834c;
public final boolean d;
public k(Method method, int i, h<T, String> hVar, boolean z2) {
this.a = method;
this.b = i;
this.f2834c = hVar;
this.d = z2;
}
/* JADX DEBUG: Multi-variable search result rejected for r4v0, resolved type: i0.h<T, java.lang.String> */
/* JADX WARN: Multi-variable type inference failed */
@Override // i0.t
public void a(v vVar, Object obj) throws IOException {
Map map = (Map) obj;
if (map != null) {
for (Map.Entry entry : map.entrySet()) {
String str = (String) entry.getKey();
if (str != null) {
Object value = entry.getValue();
if (value != null) {
String str2 = (String) this.f2834c.convert(value);
if (str2 != null) {
vVar.d(str, str2, this.d);
} else {
Method method = this.a;
int i = this.b;
throw d0.l(method, i, "Query map value '" + value + "' converted to null by " + this.f2834c.getClass().getName() + " for key '" + str + "'.", new Object[0]);
}
} else {
throw d0.l(this.a, this.b, c.d.b.a.a.u("Query map contained null value for key '", str, "'."), new Object[0]);
}
} else {
throw d0.l(this.a, this.b, "Query map contained null key.", new Object[0]);
}
}
return;
}
throw d0.l(this.a, this.b, "Query map was null", new Object[0]);
}
}
/* compiled from: ParameterHandler */
public static final class l<T> extends t<T> {
public final h<T, String> a;
public final boolean b;
public l(h<T, String> hVar, boolean z2) {
this.a = hVar;
this.b = z2;
}
@Override // i0.t
public void a(v vVar, T t) throws IOException {
if (t != null) {
vVar.d(this.a.convert(t), null, this.b);
}
}
}
/* compiled from: ParameterHandler */
public static final class m extends t<MultipartBody.Part> {
public static final m a = new m();
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [i0.v, java.lang.Object] */
@Override // i0.t
public void a(v vVar, MultipartBody.Part part) throws IOException {
MultipartBody.Part part2 = part;
if (part2 != null) {
vVar.k.a(part2);
}
}
}
/* compiled from: ParameterHandler */
public static final class n extends t<Object> {
public final Method a;
public final int b;
public n(Method method, int i) {
this.a = method;
this.b = i;
}
@Override // i0.t
public void a(v vVar, Object obj) {
if (obj != null) {
Objects.requireNonNull(vVar);
vVar.e = obj.toString();
return;
}
throw d0.l(this.a, this.b, "@Url parameter is null.", new Object[0]);
}
}
/* compiled from: ParameterHandler */
public static final class o<T> extends t<T> {
public final Class<T> a;
public o(Class<T> cls) {
this.a = cls;
}
@Override // i0.t
public void a(v vVar, T t) {
vVar.g.e(this.a, t);
}
}
public abstract void a(v vVar, T t) throws IOException;
}