MD5 校验值:d38c125a348a8ed33e26dd4564e124be
e0.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package x0; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.Parcel; import android.os.ParcelFileDescriptor; import android.os.Parcelable; import android.text.TextUtils; import android.util.Log; import android.util.Pair; import com.adjust.sdk.Constants; import java.io.BufferedOutputStream; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; import java.nio.charset.Charset; import java.security.SecureRandom; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.zip.GZIPOutputStream; import n1.b0; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import x0.e0; import x0.i0; public final class e0 { public static final c f21292n = new c(null); public static final String f21293o; private static final String f21294p; private static String f21295q; private static final Pattern f21296r; private static volatile String f21297s; private x0.a f21298a; private String f21299b; private JSONObject f21300c; private String f21301d; private String f21302e; private boolean f21303f; private Bundle f21304g; private Object f21305h; private String f21306i; private b f21307j; private k0 f21308k; private boolean f21309l; private String f21310m; public static final class a { private final e0 f21311a; private final Object f21312b; public a(e0 request, Object obj) { kotlin.jvm.internal.m.e(request, "request"); this.f21311a = request; this.f21312b = obj; } public final e0 a() { return this.f21311a; } public final Object b() { return this.f21312b; } } public interface b { void b(j0 j0Var); } public static final class c { private c() { } public c(kotlin.jvm.internal.g gVar) { this(); } public final String C(Object obj) { if (obj instanceof String) { return (String) obj; } if (!(obj instanceof Boolean) && !(obj instanceof Number)) { if (obj instanceof Date) { String format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US).format((Date) obj); kotlin.jvm.internal.m.d(format, "iso8601DateFormat.format(value)"); return format; } throw new IllegalArgumentException("Unsupported parameter type."); } return obj.toString(); } public final void D(JSONObject jSONObject, String str, e eVar) { boolean z10; Iterator<String> keys; boolean z11; boolean n10; int I; int I2; if (u(str)) { I = ub.v.I(str, ":", 0, false, 6, null); I2 = ub.v.I(str, "?", 0, false, 6, null); if (I > 3 && (I2 == -1 || I < I2)) { z10 = true; keys = jSONObject.keys(); while (keys.hasNext()) { String key = keys.next(); Object value = jSONObject.opt(key); if (z10) { n10 = ub.u.n(key, "image", true); if (n10) { z11 = true; kotlin.jvm.internal.m.d(key, "key"); kotlin.jvm.internal.m.d(value, "value"); E(key, value, eVar, z11); } } z11 = false; kotlin.jvm.internal.m.d(key, "key"); kotlin.jvm.internal.m.d(value, "value"); E(key, value, eVar, z11); } } } z10 = false; keys = jSONObject.keys(); while (keys.hasNext()) { } } private final void E(String str, Object obj, e eVar, boolean z10) { Class<?> cls = obj.getClass(); if (JSONObject.class.isAssignableFrom(cls)) { JSONObject jSONObject = (JSONObject) obj; if (z10) { Iterator<String> keys = jSONObject.keys(); while (keys.hasNext()) { String next = keys.next(); kotlin.jvm.internal.c0 c0Var = kotlin.jvm.internal.c0.f13362a; String format = String.format("%s[%s]", Arrays.copyOf(new Object[]{str, next}, 2)); kotlin.jvm.internal.m.d(format, "java.lang.String.format(format, *args)"); Object opt = jSONObject.opt(next); kotlin.jvm.internal.m.d(opt, "jsonObject.opt(propertyName)"); E(format, opt, eVar, z10); } return; } if (jSONObject.has("id")) { String optString = jSONObject.optString("id"); kotlin.jvm.internal.m.d(optString, "jsonObject.optString(\"id\")"); E(str, optString, eVar, z10); return; } else if (jSONObject.has("url")) { String optString2 = jSONObject.optString("url"); kotlin.jvm.internal.m.d(optString2, "jsonObject.optString(\"url\")"); E(str, optString2, eVar, z10); return; } else { if (jSONObject.has("fbsdk:create_object")) { String jSONObject2 = jSONObject.toString(); kotlin.jvm.internal.m.d(jSONObject2, "jsonObject.toString()"); E(str, jSONObject2, eVar, z10); return; } return; } } if (JSONArray.class.isAssignableFrom(cls)) { JSONArray jSONArray = (JSONArray) obj; int length = jSONArray.length(); if (length <= 0) { return; } int i10 = 0; while (true) { int i11 = i10 + 1; kotlin.jvm.internal.c0 c0Var2 = kotlin.jvm.internal.c0.f13362a; String format2 = String.format(Locale.ROOT, "%s[%d]", Arrays.copyOf(new Object[]{str, Integer.valueOf(i10)}, 2)); kotlin.jvm.internal.m.d(format2, "java.lang.String.format(locale, format, *args)"); Object opt2 = jSONArray.opt(i10); kotlin.jvm.internal.m.d(opt2, "jsonArray.opt(i)"); E(format2, opt2, eVar, z10); if (i11 >= length) { return; } else { i10 = i11; } } } else { if (!String.class.isAssignableFrom(cls) && !Number.class.isAssignableFrom(cls) && !Boolean.class.isAssignableFrom(cls)) { if (Date.class.isAssignableFrom(cls)) { String format3 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US).format((Date) obj); kotlin.jvm.internal.m.d(format3, "iso8601DateFormat.format(date)"); eVar.a(str, format3); return; } n1.k0 k0Var = n1.k0.f15625a; n1.k0.e0(e0.f21293o, "The type of property " + str + " in the graph object is unknown. It won't be sent in the request."); return; } eVar.a(str, obj.toString()); } } private final void F(i0 i0Var, n1.b0 b0Var, int i10, URL url, OutputStream outputStream, boolean z10) { h hVar = new h(outputStream, b0Var, z10); if (i10 == 1) { e0 e0Var = i0Var.get(0); HashMap hashMap = new HashMap(); for (String key : e0Var.u().keySet()) { Object obj = e0Var.u().get(key); if (v(obj)) { kotlin.jvm.internal.m.d(key, "key"); hashMap.put(key, new a(e0Var, obj)); } } if (b0Var != null) { b0Var.b(" Parameters:\n"); } J(e0Var.u(), hVar, e0Var); if (b0Var != null) { b0Var.b(" Attachments:\n"); } I(hashMap, hVar); JSONObject q10 = e0Var.q(); if (q10 != null) { String path = url.getPath(); kotlin.jvm.internal.m.d(path, "url.path"); D(q10, path, hVar); return; } return; } String p10 = p(i0Var); if (!(p10.length() == 0)) { hVar.a("batch_app_id", p10); HashMap hashMap2 = new HashMap(); K(hVar, i0Var, hashMap2); if (b0Var != null) { b0Var.b(" Attachments:\n"); } I(hashMap2, hVar); return; } throw new n("App ID was not specified at the request or Settings."); } public static final void H(ArrayList callbacks, i0 requests) { kotlin.jvm.internal.m.e(callbacks, "$callbacks"); kotlin.jvm.internal.m.e(requests, "$requests"); Iterator it = callbacks.iterator(); while (it.hasNext()) { Pair pair = (Pair) it.next(); b bVar = (b) pair.first; Object obj = pair.second; kotlin.jvm.internal.m.d(obj, "pair.second"); bVar.b((j0) obj); } Iterator<i0.a> it2 = requests.z().iterator(); while (it2.hasNext()) { it2.next().b(requests); } } private final void I(Map<String, a> map, h hVar) { for (Map.Entry<String, a> entry : map.entrySet()) { if (e0.f21292n.v(entry.getValue().b())) { hVar.j(entry.getKey(), entry.getValue().b(), entry.getValue().a()); } } } private final void J(Bundle bundle, h hVar, e0 e0Var) { for (String key : bundle.keySet()) { Object obj = bundle.get(key); if (w(obj)) { kotlin.jvm.internal.m.d(key, "key"); hVar.j(key, obj, e0Var); } } } private final void K(h hVar, Collection<e0> collection, Map<String, a> map) { JSONArray jSONArray = new JSONArray(); Iterator<e0> it = collection.iterator(); while (it.hasNext()) { it.next().B(jSONArray, map); } hVar.l("batch", jSONArray, collection); } private final void M(HttpURLConnection httpURLConnection, boolean z10) { if (z10) { httpURLConnection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); httpURLConnection.setRequestProperty("Content-Encoding", "gzip"); } else { httpURLConnection.setRequestProperty("Content-Type", q()); } } private final HttpURLConnection g(URL url) { URLConnection openConnection = url.openConnection(); Objects.requireNonNull(openConnection, "null cannot be cast to non-null type java.net.HttpURLConnection"); HttpURLConnection httpURLConnection = (HttpURLConnection) openConnection; httpURLConnection.setRequestProperty("User-Agent", r()); httpURLConnection.setRequestProperty("Accept-Language", Locale.getDefault().toString()); httpURLConnection.setChunkedStreamingMode(0); return httpURLConnection; } private final String p(i0 i0Var) { String o10 = i0Var.o(); if (o10 != null && (!i0Var.isEmpty())) { return o10; } Iterator<e0> it = i0Var.iterator(); while (it.hasNext()) { x0.a m10 = it.next().m(); if (m10 != null) { return m10.c(); } } String str = e0.f21295q; if (str != null) { if (str.length() > 0) { return str; } } a0 a0Var = a0.f21253a; return a0.m(); } private final String q() { kotlin.jvm.internal.c0 c0Var = kotlin.jvm.internal.c0.f13362a; String format = String.format("multipart/form-data; boundary=%s", Arrays.copyOf(new Object[]{e0.f21294p}, 1)); kotlin.jvm.internal.m.d(format, "java.lang.String.format(format, *args)"); return format; } private final String r() { if (e0.f21297s == null) { kotlin.jvm.internal.c0 c0Var = kotlin.jvm.internal.c0.f13362a; String format = String.format("%s.%s", Arrays.copyOf(new Object[]{"FBAndroidSDK", "14.1.0"}, 2)); kotlin.jvm.internal.m.d(format, "java.lang.String.format(format, *args)"); e0.f21297s = format; n1.y yVar = n1.y.f15747a; String a10 = n1.y.a(); n1.k0 k0Var = n1.k0.f15625a; if (!n1.k0.X(a10)) { String format2 = String.format(Locale.ROOT, "%s/%s", Arrays.copyOf(new Object[]{e0.f21297s, a10}, 2)); kotlin.jvm.internal.m.d(format2, "java.lang.String.format(locale, format, *args)"); e0.f21297s = format2; } } return e0.f21297s; } private final boolean s(i0 i0Var) { Iterator<i0.a> it = i0Var.z().iterator(); while (it.hasNext()) { if (it.next() instanceof i0.c) { return true; } } Iterator<e0> it2 = i0Var.iterator(); while (it2.hasNext()) { if (it2.next().o() instanceof f) { return true; } } return false; } private final boolean t(i0 i0Var) { Iterator<e0> it = i0Var.iterator(); while (it.hasNext()) { e0 next = it.next(); Iterator<String> it2 = next.u().keySet().iterator(); while (it2.hasNext()) { if (v(next.u().get(it2.next()))) { return false; } } } return true; } private final boolean u(String str) { boolean v10; boolean v11; Matcher matcher = e0.f21296r.matcher(str); if (matcher.matches()) { str = matcher.group(1); kotlin.jvm.internal.m.d(str, "matcher.group(1)"); } v10 = ub.u.v(str, "me/", false, 2, null); if (v10) { return true; } v11 = ub.u.v(str, "/me/", false, 2, null); return v11; } public final boolean v(Object obj) { return (obj instanceof Bitmap) || (obj instanceof byte[]) || (obj instanceof Uri) || (obj instanceof ParcelFileDescriptor) || (obj instanceof g); } public final boolean w(Object obj) { return (obj instanceof String) || (obj instanceof Boolean) || (obj instanceof Number) || (obj instanceof Date); } public static final void z(d dVar, j0 response) { kotlin.jvm.internal.m.e(response, "response"); if (dVar == null) { return; } dVar.a(response.c(), response); } public final e0 A(x0.a aVar, String str, JSONObject jSONObject, b bVar) { e0 e0Var = new e0(aVar, str, null, k0.POST, bVar, null, 32, null); e0Var.E(jSONObject); return e0Var; } public final e0 B(x0.a aVar, String str, Bundle bundle, b bVar) { return new e0(aVar, str, bundle, k0.POST, bVar, null, 32, null); } public final void G(final i0 requests, List<j0> responses) { kotlin.jvm.internal.m.e(requests, "requests"); kotlin.jvm.internal.m.e(responses, "responses"); int size = requests.size(); final ArrayList arrayList = new ArrayList(); if (size > 0) { int i10 = 0; while (true) { int i11 = i10 + 1; e0 e0Var = requests.get(i10); if (e0Var.o() != null) { arrayList.add(new Pair(e0Var.o(), responses.get(i10))); } if (i11 >= size) { break; } else { i10 = i11; } } } if (arrayList.size() > 0) { Runnable runnable = new Runnable() { @Override public final void run() { e0.c.H(arrayList, requests); } }; Handler q10 = requests.q(); if ((q10 == null ? null : Boolean.valueOf(q10.post(runnable))) == null) { runnable.run(); } } } public final void L(i0 requests, HttpURLConnection connection) { OutputStream gZIPOutputStream; kotlin.jvm.internal.m.e(requests, "requests"); kotlin.jvm.internal.m.e(connection, "connection"); n1.b0 b0Var = new n1.b0(m0.REQUESTS, "Request"); int size = requests.size(); boolean t10 = t(requests); OutputStream outputStream = null; k0 t11 = size == 1 ? requests.get(0).t() : null; if (t11 == null) { t11 = k0.POST; } connection.setRequestMethod(t11.name()); M(connection, t10); URL url = connection.getURL(); b0Var.b("Request:\n"); b0Var.d("Id", requests.B()); kotlin.jvm.internal.m.d(url, "url"); b0Var.d("URL", url); Object requestMethod = connection.getRequestMethod(); kotlin.jvm.internal.m.d(requestMethod, "connection.requestMethod"); b0Var.d("Method", requestMethod); Object requestProperty = connection.getRequestProperty("User-Agent"); kotlin.jvm.internal.m.d(requestProperty, "connection.getRequestProperty(\"User-Agent\")"); b0Var.d("User-Agent", requestProperty); Object requestProperty2 = connection.getRequestProperty("Content-Type"); kotlin.jvm.internal.m.d(requestProperty2, "connection.getRequestProperty(\"Content-Type\")"); b0Var.d("Content-Type", requestProperty2); connection.setConnectTimeout(requests.H()); connection.setReadTimeout(requests.H()); if (!(t11 == k0.POST)) { b0Var.e(); return; } connection.setDoOutput(true); try { OutputStream bufferedOutputStream = new BufferedOutputStream(connection.getOutputStream()); if (t10) { try { gZIPOutputStream = new GZIPOutputStream(bufferedOutputStream); } catch (Throwable th) { th = th; outputStream = bufferedOutputStream; if (outputStream != null) { } throw th; } } else { gZIPOutputStream = bufferedOutputStream; } try { if (s(requests)) { q0 q0Var = new q0(requests.q()); F(requests, null, size, url, q0Var, t10); gZIPOutputStream = new s0(gZIPOutputStream, requests, q0Var.k(), q0Var.d()); } F(requests, b0Var, size, url, gZIPOutputStream, t10); gZIPOutputStream.close(); b0Var.e(); } catch (Throwable th2) { th = th2; outputStream = gZIPOutputStream; if (outputStream != null) { outputStream.close(); } throw th; } } catch (Throwable th3) { th = th3; } } public final HttpURLConnection N(i0 requests) { URL url; kotlin.jvm.internal.m.e(requests, "requests"); O(requests); try { if (requests.size() == 1) { url = new URL(requests.get(0).x()); } else { n1.g0 g0Var = n1.g0.f15601a; url = new URL(n1.g0.g()); } HttpURLConnection httpURLConnection = null; try { httpURLConnection = g(url); L(requests, httpURLConnection); return httpURLConnection; } catch (IOException e10) { n1.k0 k0Var = n1.k0.f15625a; n1.k0.q(httpURLConnection); throw new n("could not construct request body", e10); } catch (JSONException e11) { n1.k0 k0Var2 = n1.k0.f15625a; n1.k0.q(httpURLConnection); throw new n("could not construct request body", e11); } } catch (MalformedURLException e12) { throw new n("could not construct URL for request", e12); } } public final void O(i0 requests) { kotlin.jvm.internal.m.e(requests, "requests"); Iterator<e0> it = requests.iterator(); while (it.hasNext()) { e0 next = it.next(); if (k0.GET == next.t()) { n1.k0 k0Var = n1.k0.f15625a; if (n1.k0.X(next.u().getString("fields"))) { b0.a aVar = n1.b0.f15550e; m0 m0Var = m0.DEVELOPER_ERRORS; StringBuilder sb2 = new StringBuilder(); sb2.append("GET requests for /"); String r10 = next.r(); if (r10 == null) { r10 = ""; } sb2.append(r10); sb2.append(" should contain an explicit \"fields\" parameter."); aVar.a(m0Var, 5, "Request", sb2.toString()); } } } } public final j0 h(e0 request) { kotlin.jvm.internal.m.e(request, "request"); List<j0> k10 = k(request); if (k10.size() == 1) { return k10.get(0); } throw new n("invalid state: expected a single response"); } public final List<j0> i(Collection<e0> requests) { kotlin.jvm.internal.m.e(requests, "requests"); return j(new i0(requests)); } public final List<j0> j(i0 requests) { Exception exc; HttpURLConnection httpURLConnection; List<j0> list; kotlin.jvm.internal.m.e(requests, "requests"); n1.l0 l0Var = n1.l0.f15634a; n1.l0.i(requests, "requests"); HttpURLConnection httpURLConnection2 = null; try { httpURLConnection = N(requests); exc = null; } catch (Exception e10) { exc = e10; httpURLConnection = null; } catch (Throwable th) { th = th; n1.k0 k0Var = n1.k0.f15625a; n1.k0.q(httpURLConnection2); throw th; } try { if (httpURLConnection != null) { list = o(httpURLConnection, requests); } else { List<j0> a10 = j0.f21393i.a(requests.F(), null, new n(exc)); G(requests, a10); list = a10; } n1.k0 k0Var2 = n1.k0.f15625a; n1.k0.q(httpURLConnection); return list; } catch (Throwable th2) { th = th2; httpURLConnection2 = httpURLConnection; n1.k0 k0Var3 = n1.k0.f15625a; n1.k0.q(httpURLConnection2); throw th; } } public final List<j0> k(e0... requests) { List t10; kotlin.jvm.internal.m.e(requests, "requests"); t10 = db.j.t(requests); return i(t10); } public final h0 l(Collection<e0> requests) { kotlin.jvm.internal.m.e(requests, "requests"); return m(new i0(requests)); } public final h0 m(i0 requests) { kotlin.jvm.internal.m.e(requests, "requests"); n1.l0 l0Var = n1.l0.f15634a; n1.l0.i(requests, "requests"); h0 h0Var = new h0(requests); a0 a0Var = a0.f21253a; h0Var.executeOnExecutor(a0.t(), new Void[0]); return h0Var; } public final h0 n(e0... requests) { List t10; kotlin.jvm.internal.m.e(requests, "requests"); t10 = db.j.t(requests); return l(t10); } public final List<j0> o(HttpURLConnection connection, i0 requests) { kotlin.jvm.internal.m.e(connection, "connection"); kotlin.jvm.internal.m.e(requests, "requests"); List<j0> f10 = j0.f21393i.f(connection, requests); n1.k0 k0Var = n1.k0.f15625a; n1.k0.q(connection); int size = requests.size(); if (size == f10.size()) { G(requests, f10); x0.g.f21331f.e().h(); return f10; } kotlin.jvm.internal.c0 c0Var = kotlin.jvm.internal.c0.f13362a; String format = String.format(Locale.US, "Received %d responses while expecting %d", Arrays.copyOf(new Object[]{Integer.valueOf(f10.size()), Integer.valueOf(size)}, 2)); kotlin.jvm.internal.m.d(format, "java.lang.String.format(locale, format, *args)"); throw new n(format); } public final e0 x(x0.a aVar, String str, b bVar) { return new e0(aVar, str, null, null, bVar, null, 32, null); } public final e0 y(x0.a aVar, final d dVar) { return new e0(aVar, "me", null, null, new b() { @Override public final void b(j0 j0Var) { e0.c.z(e0.d.this, j0Var); } }, null, 32, null); } } public interface d { void a(JSONObject jSONObject, j0 j0Var); } public interface e { void a(String str, String str2); } public interface f extends b { void a(long j10, long j11); } public static final class h implements e { private final OutputStream f21316a; private final n1.b0 f21317b; private boolean f21318c; private final boolean f21319d; public h(OutputStream outputStream, n1.b0 b0Var, boolean z10) { kotlin.jvm.internal.m.e(outputStream, "outputStream"); this.f21316a = outputStream; this.f21317b = b0Var; this.f21318c = true; this.f21319d = z10; } private final RuntimeException b() { return new IllegalArgumentException("value is not a supported type."); } @Override public void a(String key, String value) { kotlin.jvm.internal.m.e(key, "key"); kotlin.jvm.internal.m.e(value, "value"); f(key, null, null); i("%s", value); k(); n1.b0 b0Var = this.f21317b; if (b0Var == null) { return; } b0Var.d(kotlin.jvm.internal.m.k(" ", key), value); } public final void c(String format, Object... args) { kotlin.jvm.internal.m.e(format, "format"); kotlin.jvm.internal.m.e(args, "args"); if (!this.f21319d) { if (this.f21318c) { OutputStream outputStream = this.f21316a; Charset charset = ub.d.f20252b; byte[] bytes = "--".getBytes(charset); kotlin.jvm.internal.m.d(bytes, "(this as java.lang.String).getBytes(charset)"); outputStream.write(bytes); OutputStream outputStream2 = this.f21316a; String str = e0.f21294p; Objects.requireNonNull(str, "null cannot be cast to non-null type java.lang.String"); byte[] bytes2 = str.getBytes(charset); kotlin.jvm.internal.m.d(bytes2, "(this as java.lang.String).getBytes(charset)"); outputStream2.write(bytes2); OutputStream outputStream3 = this.f21316a; byte[] bytes3 = "\r\n".getBytes(charset); kotlin.jvm.internal.m.d(bytes3, "(this as java.lang.String).getBytes(charset)"); outputStream3.write(bytes3); this.f21318c = false; } OutputStream outputStream4 = this.f21316a; kotlin.jvm.internal.c0 c0Var = kotlin.jvm.internal.c0.f13362a; Object[] copyOf = Arrays.copyOf(args, args.length); String format2 = String.format(format, Arrays.copyOf(copyOf, copyOf.length)); kotlin.jvm.internal.m.d(format2, "java.lang.String.format(format, *args)"); Charset charset2 = ub.d.f20252b; Objects.requireNonNull(format2, "null cannot be cast to non-null type java.lang.String"); byte[] bytes4 = format2.getBytes(charset2); kotlin.jvm.internal.m.d(bytes4, "(this as java.lang.String).getBytes(charset)"); outputStream4.write(bytes4); return; } OutputStream outputStream5 = this.f21316a; kotlin.jvm.internal.c0 c0Var2 = kotlin.jvm.internal.c0.f13362a; Locale locale = Locale.US; Object[] copyOf2 = Arrays.copyOf(args, args.length); String format3 = String.format(locale, format, Arrays.copyOf(copyOf2, copyOf2.length)); kotlin.jvm.internal.m.d(format3, "java.lang.String.format(locale, format, *args)"); String encode = URLEncoder.encode(format3, Constants.ENCODING); kotlin.jvm.internal.m.d(encode, "encode(String.format(Locale.US, format, *args), \"UTF-8\")"); byte[] bytes5 = encode.getBytes(ub.d.f20252b); kotlin.jvm.internal.m.d(bytes5, "(this as java.lang.String).getBytes(charset)"); outputStream5.write(bytes5); } public final void d(String key, Bitmap bitmap) { kotlin.jvm.internal.m.e(key, "key"); kotlin.jvm.internal.m.e(bitmap, "bitmap"); f(key, key, "image/png"); bitmap.compress(Bitmap.CompressFormat.PNG, 100, this.f21316a); i("", new Object[0]); k(); n1.b0 b0Var = this.f21317b; if (b0Var == null) { return; } b0Var.d(kotlin.jvm.internal.m.k(" ", key), "<Image>"); } public final void e(String key, byte[] bytes) { kotlin.jvm.internal.m.e(key, "key"); kotlin.jvm.internal.m.e(bytes, "bytes"); f(key, key, "content/unknown"); this.f21316a.write(bytes); i("", new Object[0]); k(); n1.b0 b0Var = this.f21317b; if (b0Var == null) { return; } String k10 = kotlin.jvm.internal.m.k(" ", key); kotlin.jvm.internal.c0 c0Var = kotlin.jvm.internal.c0.f13362a; String format = String.format(Locale.ROOT, "<Data: %d>", Arrays.copyOf(new Object[]{Integer.valueOf(bytes.length)}, 1)); kotlin.jvm.internal.m.d(format, "java.lang.String.format(locale, format, *args)"); b0Var.d(k10, format); } public final void f(String str, String str2, String str3) { if (!this.f21319d) { c("Content-Disposition: form-data; name=\"%s\"", str); if (str2 != null) { c("; filename=\"%s\"", str2); } i("", new Object[0]); if (str3 != null) { i("%s: %s", "Content-Type", str3); } i("", new Object[0]); return; } OutputStream outputStream = this.f21316a; kotlin.jvm.internal.c0 c0Var = kotlin.jvm.internal.c0.f13362a; String format = String.format("%s=", Arrays.copyOf(new Object[]{str}, 1)); kotlin.jvm.internal.m.d(format, "java.lang.String.format(format, *args)"); Charset charset = ub.d.f20252b; Objects.requireNonNull(format, "null cannot be cast to non-null type java.lang.String"); byte[] bytes = format.getBytes(charset); kotlin.jvm.internal.m.d(bytes, "(this as java.lang.String).getBytes(charset)"); outputStream.write(bytes); } public final void g(String key, Uri contentUri, String str) { int p10; kotlin.jvm.internal.m.e(key, "key"); kotlin.jvm.internal.m.e(contentUri, "contentUri"); if (str == null) { str = "content/unknown"; } f(key, key, str); if (this.f21316a instanceof q0) { n1.k0 k0Var = n1.k0.f15625a; ((q0) this.f21316a).b(n1.k0.x(contentUri)); p10 = 0; } else { a0 a0Var = a0.f21253a; InputStream openInputStream = a0.l().getContentResolver().openInputStream(contentUri); n1.k0 k0Var2 = n1.k0.f15625a; p10 = n1.k0.p(openInputStream, this.f21316a) + 0; } i("", new Object[0]); k(); n1.b0 b0Var = this.f21317b; if (b0Var == null) { return; } String k10 = kotlin.jvm.internal.m.k(" ", key); kotlin.jvm.internal.c0 c0Var = kotlin.jvm.internal.c0.f13362a; String format = String.format(Locale.ROOT, "<Data: %d>", Arrays.copyOf(new Object[]{Integer.valueOf(p10)}, 1)); kotlin.jvm.internal.m.d(format, "java.lang.String.format(locale, format, *args)"); b0Var.d(k10, format); } public final void h(String key, ParcelFileDescriptor descriptor, String str) { int p10; kotlin.jvm.internal.m.e(key, "key"); kotlin.jvm.internal.m.e(descriptor, "descriptor"); if (str == null) { str = "content/unknown"; } f(key, key, str); OutputStream outputStream = this.f21316a; if (outputStream instanceof q0) { ((q0) outputStream).b(descriptor.getStatSize()); p10 = 0; } else { ParcelFileDescriptor.AutoCloseInputStream autoCloseInputStream = new ParcelFileDescriptor.AutoCloseInputStream(descriptor); n1.k0 k0Var = n1.k0.f15625a; p10 = n1.k0.p(autoCloseInputStream, this.f21316a) + 0; } i("", new Object[0]); k(); n1.b0 b0Var = this.f21317b; if (b0Var == null) { return; } String k10 = kotlin.jvm.internal.m.k(" ", key); kotlin.jvm.internal.c0 c0Var = kotlin.jvm.internal.c0.f13362a; String format = String.format(Locale.ROOT, "<Data: %d>", Arrays.copyOf(new Object[]{Integer.valueOf(p10)}, 1)); kotlin.jvm.internal.m.d(format, "java.lang.String.format(locale, format, *args)"); b0Var.d(k10, format); } public final void i(String format, Object... args) { kotlin.jvm.internal.m.e(format, "format"); kotlin.jvm.internal.m.e(args, "args"); c(format, Arrays.copyOf(args, args.length)); if (this.f21319d) { return; } c("\r\n", new Object[0]); } public final void j(String key, Object obj, e0 e0Var) { kotlin.jvm.internal.m.e(key, "key"); Closeable closeable = this.f21316a; if (closeable instanceof t0) { ((t0) closeable).a(e0Var); } c cVar = e0.f21292n; if (cVar.w(obj)) { a(key, cVar.C(obj)); return; } if (obj instanceof Bitmap) { d(key, (Bitmap) obj); return; } if (obj instanceof byte[]) { e(key, (byte[]) obj); return; } if (obj instanceof Uri) { g(key, (Uri) obj, null); return; } if (obj instanceof ParcelFileDescriptor) { h(key, (ParcelFileDescriptor) obj, null); return; } if (obj instanceof g) { g gVar = (g) obj; Parcelable b10 = gVar.b(); String a10 = gVar.a(); if (b10 instanceof ParcelFileDescriptor) { h(key, (ParcelFileDescriptor) b10, a10); return; } else { if (b10 instanceof Uri) { g(key, (Uri) b10, a10); return; } throw b(); } } throw b(); } public final void k() { if (!this.f21319d) { i("--%s", e0.f21294p); return; } OutputStream outputStream = this.f21316a; byte[] bytes = "&".getBytes(ub.d.f20252b); kotlin.jvm.internal.m.d(bytes, "(this as java.lang.String).getBytes(charset)"); outputStream.write(bytes); } public final void l(String key, JSONArray requestJsonArray, Collection<e0> requests) { kotlin.jvm.internal.m.e(key, "key"); kotlin.jvm.internal.m.e(requestJsonArray, "requestJsonArray"); kotlin.jvm.internal.m.e(requests, "requests"); Closeable closeable = this.f21316a; if (!(closeable instanceof t0)) { String jSONArray = requestJsonArray.toString(); kotlin.jvm.internal.m.d(jSONArray, "requestJsonArray.toString()"); a(key, jSONArray); return; } t0 t0Var = (t0) closeable; f(key, null, null); c("[", new Object[0]); int i10 = 0; for (e0 e0Var : requests) { int i11 = i10 + 1; JSONObject jSONObject = requestJsonArray.getJSONObject(i10); t0Var.a(e0Var); if (i10 > 0) { c(",%s", jSONObject.toString()); } else { c("%s", jSONObject.toString()); } i10 = i11; } c("]", new Object[0]); n1.b0 b0Var = this.f21317b; if (b0Var == null) { return; } String k10 = kotlin.jvm.internal.m.k(" ", key); String jSONArray2 = requestJsonArray.toString(); kotlin.jvm.internal.m.d(jSONArray2, "requestJsonArray.toString()"); b0Var.d(k10, jSONArray2); } } public static final class i implements e { final ArrayList<String> f21320a; i(ArrayList<String> arrayList) { this.f21320a = arrayList; } @Override public void a(String key, String value) { kotlin.jvm.internal.m.e(key, "key"); kotlin.jvm.internal.m.e(value, "value"); ArrayList<String> arrayList = this.f21320a; kotlin.jvm.internal.c0 c0Var = kotlin.jvm.internal.c0.f13362a; String format = String.format(Locale.US, "%s=%s", Arrays.copyOf(new Object[]{key, URLEncoder.encode(value, Constants.ENCODING)}, 2)); kotlin.jvm.internal.m.d(format, "java.lang.String.format(locale, format, *args)"); arrayList.add(format); } } static { String simpleName = e0.class.getSimpleName(); kotlin.jvm.internal.m.d(simpleName, "GraphRequest::class.java.simpleName"); f21293o = simpleName; char[] charArray = "-_1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".toCharArray(); kotlin.jvm.internal.m.d(charArray, "(this as java.lang.String).toCharArray()"); StringBuilder sb2 = new StringBuilder(); SecureRandom secureRandom = new SecureRandom(); int nextInt = secureRandom.nextInt(11) + 30; if (nextInt > 0) { int i10 = 0; do { i10++; sb2.append(charArray[secureRandom.nextInt(charArray.length)]); } while (i10 < nextInt); } String sb3 = sb2.toString(); kotlin.jvm.internal.m.d(sb3, "buffer.toString()"); f21294p = sb3; f21296r = Pattern.compile("^/?v\\d+\\.\\d+/(.*)"); } public e0() { this(null, null, null, null, null, null, 63, null); } public e0(x0.a aVar, String str, Bundle bundle, k0 k0Var, b bVar, String str2, int i10, kotlin.jvm.internal.g gVar) { this((i10 & 1) != 0 ? null : aVar, (i10 & 2) != 0 ? null : str, (i10 & 4) != 0 ? null : bundle, (i10 & 8) != 0 ? null : k0Var, (i10 & 16) != 0 ? null : bVar, (i10 & 32) != 0 ? null : str2); } private final boolean A() { a0 a0Var = a0.f21253a; if (kotlin.jvm.internal.m.a(a0.w(), "instagram.com")) { return !z(); } return true; } public final void B(JSONArray jSONArray, Map<String, a> map) { JSONObject jSONObject = new JSONObject(); String str = this.f21301d; if (str != null) { jSONObject.put("name", str); jSONObject.put("omit_response_on_success", this.f21303f); } String str2 = this.f21302e; if (str2 != null) { jSONObject.put("depends_on", str2); } String v10 = v(); jSONObject.put("relative_url", v10); jSONObject.put("method", this.f21308k); x0.a aVar = this.f21298a; if (aVar != null) { n1.b0.f15550e.d(aVar.o()); } ArrayList arrayList = new ArrayList(); Iterator<String> it = this.f21304g.keySet().iterator(); while (it.hasNext()) { Object obj = this.f21304g.get(it.next()); if (f21292n.v(obj)) { kotlin.jvm.internal.c0 c0Var = kotlin.jvm.internal.c0.f13362a; String format = String.format(Locale.ROOT, "%s%d", Arrays.copyOf(new Object[]{"file", Integer.valueOf(map.size())}, 2)); kotlin.jvm.internal.m.d(format, "java.lang.String.format(locale, format, *args)"); arrayList.add(format); map.put(format, new a(this, obj)); } } if (!arrayList.isEmpty()) { jSONObject.put("attached_files", TextUtils.join(",", arrayList)); } JSONObject jSONObject2 = this.f21300c; if (jSONObject2 != null) { ArrayList arrayList2 = new ArrayList(); f21292n.D(jSONObject2, v10, new i(arrayList2)); jSONObject.put("body", TextUtils.join("&", arrayList2)); } jSONArray.put(jSONObject); } private final boolean I() { boolean z10; boolean v10; String n10 = n(); boolean y10 = n10 == null ? false : ub.v.y(n10, "|", false, 2, null); if (n10 != null) { v10 = ub.u.v(n10, "IG", false, 2, null); if (v10 && !y10) { z10 = true; if (z10 || !z()) { return A() && !y10; } return true; } } z10 = false; if (z10) { } if (A()) { } } public static final void b(b bVar, j0 response) { kotlin.jvm.internal.m.e(response, "response"); JSONObject c10 = response.c(); JSONObject optJSONObject = c10 == null ? null : c10.optJSONObject("__debug__"); JSONArray optJSONArray = optJSONObject == null ? null : optJSONObject.optJSONArray("messages"); if (optJSONArray != null) { int i10 = 0; int length = optJSONArray.length(); if (length > 0) { while (true) { int i11 = i10 + 1; JSONObject optJSONObject2 = optJSONArray.optJSONObject(i10); String optString = optJSONObject2 == null ? null : optJSONObject2.optString("message"); String optString2 = optJSONObject2 == null ? null : optJSONObject2.optString("type"); String optString3 = optJSONObject2 == null ? null : optJSONObject2.optString("link"); if (optString != null && optString2 != null) { m0 m0Var = m0.GRAPH_API_DEBUG_INFO; if (kotlin.jvm.internal.m.a(optString2, "warning")) { m0Var = m0.GRAPH_API_DEBUG_WARNING; } n1.k0 k0Var = n1.k0.f15625a; if (!n1.k0.X(optString3)) { optString = ((Object) optString) + " Link: " + ((Object) optString3); } n1.b0.f15550e.b(m0Var, f21293o, optString); } if (i11 >= length) { break; } else { i10 = i11; } } } } if (bVar == null) { return; } bVar.b(response); } private final void i() { Bundle bundle = this.f21304g; if (I()) { bundle.putString("access_token", p()); } else { String n10 = n(); if (n10 != null) { bundle.putString("access_token", n10); } } if (!bundle.containsKey("access_token")) { n1.k0 k0Var = n1.k0.f15625a; a0 a0Var = a0.f21253a; if (n1.k0.X(a0.r())) { Log.w(f21293o, "Starting with v13 of the SDK, a client token must be embedded in your client code before making Graph API calls. Visit https://developers.facebook.com/docs/android/getting-started#client-token to learn how to implement this change."); } } bundle.putString("sdk", "android"); bundle.putString("format", "json"); a0 a0Var2 = a0.f21253a; if (a0.G(m0.GRAPH_API_DEBUG_INFO)) { bundle.putString("debug", "info"); } else if (a0.G(m0.GRAPH_API_DEBUG_WARNING)) { bundle.putString("debug", "warning"); } } private final String j(String str, boolean z10) { if (!z10 && this.f21308k == k0.POST) { return str; } Uri.Builder buildUpon = Uri.parse(str).buildUpon(); for (String str2 : this.f21304g.keySet()) { Object obj = this.f21304g.get(str2); if (obj == null) { obj = ""; } c cVar = f21292n; if (cVar.w(obj)) { buildUpon.appendQueryParameter(str2, cVar.C(obj).toString()); } else if (this.f21308k != k0.GET) { kotlin.jvm.internal.c0 c0Var = kotlin.jvm.internal.c0.f13362a; String format = String.format(Locale.US, "Unsupported parameter type for GET request: %s", Arrays.copyOf(new Object[]{obj.getClass().getSimpleName()}, 1)); kotlin.jvm.internal.m.d(format, "java.lang.String.format(locale, format, *args)"); throw new IllegalArgumentException(format); } } String builder = buildUpon.toString(); kotlin.jvm.internal.m.d(builder, "uriBuilder.toString()"); return builder; } private final String n() { x0.a aVar = this.f21298a; if (aVar != null) { if (!this.f21304g.containsKey("access_token")) { String o10 = aVar.o(); n1.b0.f15550e.d(o10); return o10; } } else if (!this.f21304g.containsKey("access_token")) { return p(); } return this.f21304g.getString("access_token"); } private final String p() { a0 a0Var = a0.f21253a; String m10 = a0.m(); String r10 = a0.r(); if (m10.length() > 0) { if (r10.length() > 0) { return m10 + '|' + r10; } } n1.k0 k0Var = n1.k0.f15625a; n1.k0.e0(f21293o, "Warning: Request without access token missing application ID or client token."); return null; } private final String s() { if (f21296r.matcher(this.f21299b).matches()) { return this.f21299b; } kotlin.jvm.internal.c0 c0Var = kotlin.jvm.internal.c0.f13362a; String format = String.format("%s/%s", Arrays.copyOf(new Object[]{this.f21306i, this.f21299b}, 2)); kotlin.jvm.internal.m.d(format, "java.lang.String.format(format, *args)"); return format; } private final String y(String str) { if (!A()) { n1.g0 g0Var = n1.g0.f15601a; str = n1.g0.f(); } kotlin.jvm.internal.c0 c0Var = kotlin.jvm.internal.c0.f13362a; String format = String.format("%s/%s", Arrays.copyOf(new Object[]{str, s()}, 2)); kotlin.jvm.internal.m.d(format, "java.lang.String.format(format, *args)"); return format; } private final boolean z() { if (this.f21299b == null) { return false; } StringBuilder sb2 = new StringBuilder(); sb2.append("^/?"); a0 a0Var = a0.f21253a; sb2.append(a0.m()); sb2.append("/?.*"); return this.f21309l || Pattern.matches(sb2.toString(), this.f21299b) || Pattern.matches("^/?app/?.*", this.f21299b); } public final void C(final b bVar) { a0 a0Var = a0.f21253a; if (!a0.G(m0.GRAPH_API_DEBUG_INFO) && !a0.G(m0.GRAPH_API_DEBUG_WARNING)) { this.f21307j = bVar; } else { this.f21307j = new b() { @Override public final void b(j0 j0Var) { e0.b(e0.b.this, j0Var); } }; } } public final void D(boolean z10) { this.f21309l = z10; } public final void E(JSONObject jSONObject) { this.f21300c = jSONObject; } public final void F(k0 k0Var) { if (this.f21310m != null && k0Var != k0.GET) { throw new n("Can't change HTTP method on request with overridden URL."); } if (k0Var == null) { k0Var = k0.GET; } this.f21308k = k0Var; } public final void G(Bundle bundle) { kotlin.jvm.internal.m.e(bundle, "<set-?>"); this.f21304g = bundle; } public final void H(Object obj) { this.f21305h = obj; } public final j0 k() { return f21292n.h(this); } public final h0 l() { return f21292n.n(this); } public final x0.a m() { return this.f21298a; } public final b o() { return this.f21307j; } public final JSONObject q() { return this.f21300c; } public final String r() { return this.f21299b; } public final k0 t() { return this.f21308k; } public String toString() { StringBuilder sb2 = new StringBuilder(); sb2.append("{Request: "); sb2.append(" accessToken: "); Object obj = this.f21298a; if (obj == null) { obj = "null"; } sb2.append(obj); sb2.append(", graphPath: "); sb2.append(this.f21299b); sb2.append(", graphObject: "); sb2.append(this.f21300c); sb2.append(", httpMethod: "); sb2.append(this.f21308k); sb2.append(", parameters: "); sb2.append(this.f21304g); sb2.append("}"); String sb3 = sb2.toString(); kotlin.jvm.internal.m.d(sb3, "StringBuilder()\n .append(\"{Request: \")\n .append(\" accessToken: \")\n .append(if (accessToken == null) \"null\" else accessToken)\n .append(\", graphPath: \")\n .append(graphPath)\n .append(\", graphObject: \")\n .append(graphObject)\n .append(\", httpMethod: \")\n .append(httpMethod)\n .append(\", parameters: \")\n .append(parameters)\n .append(\"}\")\n .toString()"); return sb3; } public final Bundle u() { return this.f21304g; } public final String v() { if (this.f21310m == null) { n1.g0 g0Var = n1.g0.f15601a; String y10 = y(n1.g0.g()); i(); Uri parse = Uri.parse(j(y10, true)); kotlin.jvm.internal.c0 c0Var = kotlin.jvm.internal.c0.f13362a; String format = String.format("%s?%s", Arrays.copyOf(new Object[]{parse.getPath(), parse.getQuery()}, 2)); kotlin.jvm.internal.m.d(format, "java.lang.String.format(format, *args)"); return format; } throw new n("Can't override URL for a batch request"); } public final Object w() { return this.f21305h; } public final String x() { String h10; boolean m10; String str = this.f21310m; if (str != null) { return String.valueOf(str); } String str2 = this.f21299b; if (this.f21308k == k0.POST && str2 != null) { m10 = ub.u.m(str2, "/videos", false, 2, null); if (m10) { n1.g0 g0Var = n1.g0.f15601a; h10 = n1.g0.i(); String y10 = y(h10); i(); return j(y10, false); } } n1.g0 g0Var2 = n1.g0.f15601a; a0 a0Var = a0.f21253a; h10 = n1.g0.h(a0.w()); String y102 = y(h10); i(); return j(y102, false); } public e0(x0.a aVar, String str, Bundle bundle, k0 k0Var, b bVar, String str2) { this.f21303f = true; this.f21298a = aVar; this.f21299b = str; this.f21306i = str2; C(bVar); F(k0Var); if (bundle != null) { this.f21304g = new Bundle(bundle); } else { this.f21304g = new Bundle(); } if (this.f21306i == null) { a0 a0Var = a0.f21253a; this.f21306i = a0.v(); } } public static final class g<RESOURCE extends Parcelable> implements Parcelable { private final String f21314n; private final RESOURCE f21315o; public static final b f21313p = new b(null); public static final Parcelable.Creator<g<?>> CREATOR = new a(); public static final class a implements Parcelable.Creator<g<?>> { a() { } @Override public g<?> createFromParcel(Parcel source) { kotlin.jvm.internal.m.e(source, "source"); return new g<>(source, (kotlin.jvm.internal.g) null); } @Override public g<?>[] newArray(int i10) { return new g[i10]; } } public static final class b { private b() { } public b(kotlin.jvm.internal.g gVar) { this(); } } public g(Parcel parcel, kotlin.jvm.internal.g gVar) { this(parcel); } public g(RESOURCE resource, String str) { this.f21314n = str; this.f21315o = resource; } public final String a() { return this.f21314n; } public final RESOURCE b() { return this.f21315o; } @Override public int describeContents() { return 1; } @Override public void writeToParcel(Parcel out, int i10) { kotlin.jvm.internal.m.e(out, "out"); out.writeString(this.f21314n); out.writeParcelable(this.f21315o, i10); } private g(Parcel parcel) { this.f21314n = parcel.readString(); a0 a0Var = a0.f21253a; this.f21315o = (RESOURCE) parcel.readParcelable(a0.l().getClassLoader()); } } }