package s7; import ai.clova.cic.clientlib.login.util.AuthConst; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.content.res.Resources; import android.hardware.display.DisplayManager; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Environment; import android.os.Parcel; import android.os.StatFs; import android.telephony.TelephonyManager; import android.util.DisplayMetrics; import android.view.Display; import android.webkit.CookieManager; import android.webkit.CookieSyncManager; import com.facebook.AccessToken; import com.facebook.FacebookRequestError; import com.facebook.GraphRequest; import com.linecorp.linekeep.dto.KeepContentDTO; import e7.a0; import e7.l; import e7.y; import e7.z; import em3.q; import java.io.BufferedInputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.UnsupportedEncodingException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.math.BigInteger; import java.net.HttpURLConnection; import java.net.URLConnection; import java.net.URLDecoder; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Objects; import java.util.Random; import java.util.TimeZone; import java.util.concurrent.ConcurrentHashMap; import java.util.regex.Pattern; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.json.JSONTokener; import sm3.r; import sm3.x; public final class b0 { /* renamed from: a reason: collision with root package name */ public static int f141693a = 0; /* renamed from: b reason: collision with root package name */ public static long f141694b = -1; /* renamed from: c reason: collision with root package name */ public static long f141695c = -1; /* renamed from: d reason: collision with root package name */ public static long f141696d = -1; /* renamed from: e reason: collision with root package name */ public static String f141697e = ""; /* renamed from: f reason: collision with root package name */ public static String f141698f = ""; /* renamed from: g reason: collision with root package name */ public static String f141699g = "NoCarrier"; public interface a { void a(JSONObject jSONObject); void b(l lVar); } public static final class b { /* renamed from: a reason: collision with root package name */ public List<String> f141700a; /* renamed from: b reason: collision with root package name */ public List<String> f141701b; /* renamed from: c reason: collision with root package name */ public List<String> f141702c; public b(List<String> list, List<String> list2, List<String> list3) { this.f141700a = list; this.f141701b = list2; this.f141702c = list3; } } public static final class c implements GraphRequest.b { /* renamed from: a reason: collision with root package name */ public final /* synthetic */ a f141703a; /* renamed from: b reason: collision with root package name */ public final /* synthetic */ String f141704b; public c(a aVar, String str) { this.f141703a = aVar; this.f141704b = str; } @Override // com.facebook.GraphRequest.b public final void a(y yVar) { q.f(yVar, "response"); FacebookRequestError facebookRequestError = yVar.f67064d; if (facebookRequestError != null) { this.f141703a.b(facebookRequestError.f21960c); return; } String str = this.f141704b; JSONObject jSONObject = yVar.f67061a; if (jSONObject != null) { ConcurrentHashMap<String, JSONObject> concurrentHashMap = x.f141797a; q.f(str, "key"); x.f141797a.put(str, jSONObject); this.f141703a.a(yVar.f67061a); return; } throw new IllegalStateException("Required value was null.".toString()); } } public static final boolean A() { try { Intent intent = new Intent("android.intent.action.VIEW"); String format = String.format("fb%s://applinks", Arrays.copyOf(new Object[]{e7.q.c()}, 1)); q.e(format, "java.lang.String.format(format, *args)"); intent.setData(Uri.parse(format)); Context b14 = e7.q.b(); PackageManager packageManager = b14.getPackageManager(); String packageName = b14.getPackageName(); for (ResolveInfo resolveInfo : packageManager.queryIntentActivities(intent, 65536)) { if (q.b(packageName, resolveInfo.activityInfo.packageName)) { return true; } } } catch (Exception unused) { } return false; } public static final boolean B(Context context) { q.f(context, "context"); if (Build.VERSION.SDK_INT >= 27) { return context.getPackageManager().hasSystemFeature("android.hardware.type.pc"); } String str = Build.DEVICE; if (str != null) { q.e(str, "Build.DEVICE"); Pattern compile = Pattern.compile(".+_cheets|cheets_.+"); q.e(compile, "compile(pattern)"); if (compile.matcher(str).matches()) { return true; } } return false; } public static final boolean C() { if (x7.a.b(b0.class)) { return false; } try { JSONObject p14 = p(); if (p14 != null) { try { JSONArray jSONArray = p14.getJSONArray("data_processing_options"); int length = jSONArray.length(); for (int i14 = 0; i14 < length; i14++) { String string = jSONArray.getString(i14); q.e(string, "options.getString(i)"); String lowerCase = string.toLowerCase(); q.e(lowerCase, "(this as java.lang.String).toLowerCase()"); if (q.b(lowerCase, "ldu")) { return true; } } } catch (Exception unused) { } } return false; } catch (Throwable th4) { x7.a.a(th4, b0.class); return false; } } public static final boolean D(String str) { if (str != null) { if (!(str.length() == 0)) { return false; } } return true; } public static final boolean E(Uri uri) { if (uri == null || (!r.r("http", uri.getScheme(), true) && !r.r("https", uri.getScheme(), true) && !r.r("fbstaging", uri.getScheme(), true))) { return false; } return true; } public static final List<String> F(JSONArray jSONArray) throws JSONException { ArrayList arrayList = new ArrayList(); int length = jSONArray.length(); for (int i14 = 0; i14 < length; i14++) { arrayList.add(jSONArray.getString(i14)); } return arrayList; } public static final Map<String, String> G(String str) { if (str.length() == 0) { return new HashMap(); } try { HashMap hashMap = new HashMap(); JSONObject jSONObject = new JSONObject(str); Iterator<String> keys = jSONObject.keys(); while (keys.hasNext()) { String next = keys.next(); q.e(next, "key"); String string = jSONObject.getString(next); q.e(string, "jsonObject.getString(key)"); hashMap.put(next, string); } return hashMap; } catch (JSONException unused) { return new HashMap(); } } public static final String H(Map<String, String> map) { q.f(map, "map"); String str = ""; if (!map.isEmpty()) { try { JSONObject jSONObject = new JSONObject(); for (Map.Entry<String, String> entry : map.entrySet()) { jSONObject.put(entry.getKey(), entry.getValue()); } str = jSONObject.toString(); } catch (JSONException unused) { } q.e(str, "try {\n val jsonOb…ion) {\n \"\"\n }"); } return str; } public static final Bundle I(String str) { Bundle bundle = new Bundle(); if (!D(str)) { if (str != null) { Object[] array = x.k0(str, new String[]{"&"}, false, 0, 6).toArray(new String[0]); Objects.requireNonNull(array, "null cannot be cast to non-null type kotlin.Array<T>"); for (String str2 : (String[]) array) { Object[] array2 = x.k0(str2, new String[]{"="}, false, 0, 6).toArray(new String[0]); Objects.requireNonNull(array2, "null cannot be cast to non-null type kotlin.Array<T>"); String[] strArr = (String[]) array2; try { if (strArr.length == 2) { bundle.putString(URLDecoder.decode(strArr[0], "UTF-8"), URLDecoder.decode(strArr[1], "UTF-8")); } else if (strArr.length == 1) { bundle.putString(URLDecoder.decode(strArr[0], "UTF-8"), ""); } } catch (UnsupportedEncodingException unused) { HashSet<a0> hashSet = e7.q.f67019a; } } } else { throw new IllegalStateException("Required value was null.".toString()); } } return bundle; } public static final boolean J(Bundle bundle, String str, Object obj) { q.f(bundle, "bundle"); if (obj instanceof Boolean) { bundle.putBoolean(str, ((Boolean) obj).booleanValue()); return true; } else if (obj instanceof boolean[]) { bundle.putBooleanArray(str, (boolean[]) obj); return true; } else if (obj instanceof Double) { bundle.putDouble(str, ((Number) obj).doubleValue()); return true; } else if (obj instanceof double[]) { bundle.putDoubleArray(str, (double[]) obj); return true; } else if (obj instanceof Integer) { bundle.putInt(str, ((Number) obj).intValue()); return true; } else if (obj instanceof int[]) { bundle.putIntArray(str, (int[]) obj); return true; } else if (obj instanceof Long) { bundle.putLong(str, ((Number) obj).longValue()); return true; } else if (obj instanceof long[]) { bundle.putLongArray(str, (long[]) obj); return true; } else if (obj instanceof String) { bundle.putString(str, (String) obj); return true; } else { bundle.putString(str, obj.toString()); return true; } } public static final void K(Bundle bundle, String str, String str2) { if (!D(str2)) { bundle.putString(str, str2); } } /* JADX WARNING: Failed to process nested try/catch */ /* JADX WARNING: Missing exception handler attribute for start block: B:13:0x002c */ /* JADX WARNING: Removed duplicated region for block: B:23:0x003d A[SYNTHETIC, Splitter:B:23:0x003d] */ /* JADX WARNING: Removed duplicated region for block: B:27:0x0042 A[SYNTHETIC, Splitter:B:27:0x0042] */ public static final String L(InputStream inputStream) throws IOException { InputStreamReader inputStreamReader; BufferedInputStream bufferedInputStream; Throwable th4; try { bufferedInputStream = new BufferedInputStream(inputStream); try { inputStreamReader = new InputStreamReader(bufferedInputStream); } catch (Throwable th5) { th4 = th5; inputStreamReader = null; if (bufferedInputStream != null) { } if (inputStreamReader != null) { } throw th4; } try { StringBuilder sb4 = new StringBuilder(); char[] cArr = new char[2048]; while (true) { int read = inputStreamReader.read(cArr); if (read == -1) { break; } sb4.append(cArr, 0, read); } String sb5 = sb4.toString(); q.e(sb5, "stringBuilder.toString()"); bufferedInputStream.close(); try { inputStreamReader.close(); } catch (IOException unused) { } return sb5; } catch (Throwable th6) { th4 = th6; if (bufferedInputStream != null) { try { bufferedInputStream.close(); } catch (IOException unused2) { } } if (inputStreamReader != null) { try { inputStreamReader.close(); } catch (IOException unused3) { } } throw th4; } } catch (Throwable th7) { bufferedInputStream = null; th4 = th7; inputStreamReader = null; if (bufferedInputStream != null) { } if (inputStreamReader != null) { } throw th4; } } public static final Map<String, String> M(Parcel parcel) { q.f(parcel, "parcel"); int readInt = parcel.readInt(); if (readInt < 0) { return null; } HashMap hashMap = new HashMap(); for (int i14 = 0; i14 < readInt; i14++) { hashMap.put(parcel.readString(), parcel.readString()); } return hashMap; } public static final void N(Runnable runnable) { try { e7.q.e().execute(runnable); } catch (Exception unused) { } } /* JADX WARNING: Can't wrap try/catch for region: R(14:4|5|6|7|(4:10|11|12|(1:14)(2:15|16))|17|19|20|(1:22)|23|24|25|(1:27)|28) */ /* JADX WARNING: Failed to process nested try/catch */ /* JADX WARNING: Missing exception handler attribute for start block: B:24:0x00aa */ /* JADX WARNING: Removed duplicated region for block: B:27:0x00b4 A[Catch:{ Exception -> 0x00db }] */ /* JADX WARNING: Removed duplicated region for block: B:62:0x018b A[SYNTHETIC, Splitter:B:62:0x018b] */ public static final void O(JSONObject jSONObject, Context context) throws JSONException { String str; Locale locale; int i14; int i15; JSONArray jSONArray = new JSONArray(); jSONArray.put("a2"); int i16 = 0; if (f141694b == -1 || System.currentTimeMillis() - f141694b >= ((long) 1800000)) { f141694b = System.currentTimeMillis(); try { TimeZone timeZone = TimeZone.getDefault(); String displayName = timeZone.getDisplayName(timeZone.inDaylightTime(new Date()), 0); q.e(displayName, "tz.getDisplayName(tz.inD…(Date()), TimeZone.SHORT)"); f141697e = displayName; String id4 = timeZone.getID(); q.e(id4, "tz.id"); f141698f = id4; } catch (AssertionError | Exception unused) { } if (q.b(f141699g, "NoCarrier")) { try { Object systemService = context.getSystemService("phone"); if (systemService != null) { String networkOperatorName = ((TelephonyManager) systemService).getNetworkOperatorName(); q.e(networkOperatorName, "telephonyManager.networkOperatorName"); f141699g = networkOperatorName; } else { throw new NullPointerException("null cannot be cast to non-null type android.telephony.TelephonyManager"); } } catch (Exception unused2) { } } if (q.b("mounted", Environment.getExternalStorageState())) { File externalStorageDirectory = Environment.getExternalStorageDirectory(); q.e(externalStorageDirectory, "path"); StatFs statFs = new StatFs(externalStorageDirectory.getPath()); f141695c = ((long) statFs.getBlockCount()) * ((long) statFs.getBlockSize()); } f141695c = Math.round(((double) f141695c) / 1.073741824E9d); if (q.b("mounted", Environment.getExternalStorageState())) { File externalStorageDirectory2 = Environment.getExternalStorageDirectory(); q.e(externalStorageDirectory2, "path"); StatFs statFs2 = new StatFs(externalStorageDirectory2.getPath()); f141696d = ((long) statFs2.getAvailableBlocks()) * ((long) statFs2.getBlockSize()); } f141696d = Math.round(((double) f141696d) / 1.073741824E9d); } String packageName = context.getPackageName(); int i17 = -1; try { PackageInfo packageInfo = context.getPackageManager().getPackageInfo(packageName, 0); if (packageInfo != null) { i17 = packageInfo.versionCode; str = packageInfo.versionName; jSONArray.put(packageName); jSONArray.put(i17); jSONArray.put(str); jSONArray.put(Build.VERSION.RELEASE); jSONArray.put(Build.MODEL); try { Resources resources = context.getResources(); q.e(resources, "appContext.resources"); locale = resources.getConfiguration().locale; } catch (Exception unused3) { locale = Locale.getDefault(); } StringBuilder sb4 = new StringBuilder(); q.e(locale, "locale"); sb4.append(locale.getLanguage()); sb4.append("_"); sb4.append(locale.getCountry()); jSONArray.put(sb4.toString()); jSONArray.put(f141697e); jSONArray.put(f141699g); double d14 = 0.0d; try { Object systemService2 = context.getSystemService("display"); Display display = null; if (!(systemService2 instanceof DisplayManager)) { systemService2 = null; } DisplayManager displayManager = (DisplayManager) systemService2; if (displayManager != null) { display = displayManager.getDisplay(0); } if (display != null) { DisplayMetrics displayMetrics = new DisplayMetrics(); display.getMetrics(displayMetrics); int i18 = displayMetrics.widthPixels; try { i16 = displayMetrics.heightPixels; d14 = (double) displayMetrics.density; } catch (Exception unused4) { } i14 = i16; i16 = i18; jSONArray.put(i16); jSONArray.put(i14); jSONArray.put(new DecimalFormat("#.##").format(d14)); i15 = f141693a; if (i15 <= 0) { try { File[] listFiles = new File("/sys/devices/system/cpu/").listFiles(c0.f141706b); if (listFiles != null) { f141693a = listFiles.length; } } catch (Exception unused5) { } if (f141693a <= 0) { f141693a = Math.max(Runtime.getRuntime().availableProcessors(), 1); } i15 = f141693a; } jSONArray.put(i15); jSONArray.put(f141695c); jSONArray.put(f141696d); jSONArray.put(f141698f); jSONObject.put("extinfo", jSONArray.toString()); } } catch (Exception unused6) { } i14 = 0; jSONArray.put(i16); jSONArray.put(i14); jSONArray.put(new DecimalFormat("#.##").format(d14)); i15 = f141693a; if (i15 <= 0) { } jSONArray.put(i15); jSONArray.put(f141695c); jSONArray.put(f141696d); jSONArray.put(f141698f); jSONObject.put("extinfo", jSONArray.toString()); } } catch (PackageManager.NameNotFoundException unused7) { str = ""; } } public static final String P(String str) { if (str == null) { return null; } byte[] bytes = str.getBytes(sm3.b.f143620b); q.e(bytes, "(this as java.lang.String).getBytes(charset)"); return y("SHA-256", bytes); } public static final <T> Collection<T> Q(T... tArr) { Collection<T> unmodifiableCollection = Collections.unmodifiableCollection(Arrays.asList(Arrays.copyOf(tArr, tArr.length))); q.e(unmodifiableCollection, "Collections.unmodifiable…ction(Arrays.asList(*ts))"); return unmodifiableCollection; } public static final void R(Parcel parcel, Map<String, String> map) { q.f(parcel, "parcel"); if (map == null) { parcel.writeInt(-1); return; } Iterator a14 = a0.a(map, parcel); while (a14.hasNext()) { Map.Entry entry = (Map.Entry) a14.next(); parcel.writeString((String) entry.getKey()); parcel.writeString((String) entry.getValue()); } } public static final <T> boolean a(T t14, T t15) { if (t14 == null) { return t15 == null; } return q.b(t14, t15); } public static final Uri b(String str, String str2, Bundle bundle) { Uri.Builder builder = new Uri.Builder(); builder.scheme("https"); builder.authority(str); builder.path(str2); if (bundle != null) { for (String str3 : bundle.keySet()) { Object obj = bundle.get(str3); if (obj instanceof String) { builder.appendQueryParameter(str3, (String) obj); } } } Uri build = builder.build(); q.e(build, "builder.build()"); return build; } public static final void c(Context context, String str) { CookieSyncManager.createInstance(context).sync(); CookieManager instance = CookieManager.getInstance(); String cookie = instance.getCookie(str); if (cookie != null) { Object[] array = x.k0(cookie, new String[]{";"}, false, 0, 6).toArray(new String[0]); Objects.requireNonNull(array, "null cannot be cast to non-null type kotlin.Array<T>"); for (String str2 : (String[]) array) { Object[] array2 = x.k0(str2, new String[]{"="}, false, 0, 6).toArray(new String[0]); Objects.requireNonNull(array2, "null cannot be cast to non-null type kotlin.Array<T>"); String[] strArr = (String[]) array2; if (strArr.length > 0) { StringBuilder sb4 = new StringBuilder(); String str3 = strArr[0]; int length = str3.length() - 1; int i14 = 0; boolean z14 = false; while (i14 <= length) { boolean z15 = q.g(str3.charAt(!z14 ? i14 : length), 32) <= 0; if (!z14) { if (!z15) { z14 = true; } else { i14++; } } else if (!z15) { break; } else { length--; } } sb4.append(str3.subSequence(i14, length + 1).toString()); sb4.append("=;expires=Sat, 1 Jan 2000 00:00:01 UTC;"); instance.setCookie(str, sb4.toString()); } } instance.removeExpiredCookie(); } } public static final void d(Context context) { q.f(context, "context"); c(context, "facebook.com"); c(context, ".facebook.com"); c(context, "https://facebook.com"); c(context, "https://.facebook.com"); } public static final String e(String str, String str2) { return D(str) ? str2 : str; } public static final List<String> f(JSONArray jSONArray) { try { ArrayList arrayList = new ArrayList(); int length = jSONArray.length(); for (int i14 = 0; i14 < length; i14++) { String string = jSONArray.getString(i14); q.e(string, "jsonArray.getString(i)"); arrayList.add(string); } return arrayList; } catch (JSONException unused) { return new ArrayList(); } } public static final Map<String, Object> g(JSONObject jSONObject) { q.f(jSONObject, "jsonObject"); HashMap hashMap = new HashMap(); JSONArray names = jSONObject.names(); int length = names.length(); for (int i14 = 0; i14 < length; i14++) { try { String string = names.getString(i14); q.e(string, "keys.getString(i)"); Object obj = jSONObject.get(string); if (obj instanceof JSONObject) { obj = g((JSONObject) obj); } q.e(obj, "value"); hashMap.put(string, obj); } catch (JSONException unused) { } } return hashMap; } public static final Map<String, String> h(JSONObject jSONObject) { HashMap hashMap = new HashMap(); Iterator<String> keys = jSONObject.keys(); while (keys.hasNext()) { String next = keys.next(); String optString = jSONObject.optString(next); if (optString != null) { q.e(next, "key"); hashMap.put(next, optString); } } return hashMap; } /* JADX WARNING: Removed duplicated region for block: B:18:0x002c */ /* JADX WARNING: Removed duplicated region for block: B:20:0x0031 */ public static final int i(InputStream inputStream, OutputStream outputStream) throws IOException { Throwable th4; q.f(outputStream, "outputStream"); BufferedInputStream bufferedInputStream = null; try { BufferedInputStream bufferedInputStream2 = new BufferedInputStream(inputStream); try { byte[] bArr = new byte[8192]; int i14 = 0; while (true) { int read = bufferedInputStream2.read(bArr); if (read == -1) { break; } outputStream.write(bArr, 0, read); i14 += read; } bufferedInputStream2.close(); if (inputStream != null) { inputStream.close(); } return i14; } catch (Throwable th5) { th4 = th5; bufferedInputStream = bufferedInputStream2; if (bufferedInputStream != null) { bufferedInputStream.close(); } if (inputStream != null) { inputStream.close(); } throw th4; } } catch (Throwable th6) { th4 = th6; if (bufferedInputStream != null) { } if (inputStream != null) { } throw th4; } } public static final void j(URLConnection uRLConnection) { if (uRLConnection != null && (uRLConnection instanceof HttpURLConnection)) { ((HttpURLConnection) uRLConnection).disconnect(); } } public static final String k(int i14) { String bigInteger = new BigInteger(i14 * 5, new Random()).toString(32); q.e(bigInteger, "BigInteger(length * 5, r).toString(32)"); return bigInteger; } public static final String l(Context context) { if (context == null) { return "null"; } if (context == context.getApplicationContext()) { return "unknown"; } return context.getClass().getSimpleName(); } public static final String m(Context context) { q.f(context, "context"); try { HashSet<a0> hashSet = e7.q.f67019a; d0.g(); String str = e7.q.f67022d; if (str != null) { return str; } ApplicationInfo applicationInfo = context.getApplicationInfo(); int i14 = applicationInfo.labelRes; if (i14 == 0) { return applicationInfo.nonLocalizedLabel.toString(); } String string = context.getString(i14); q.e(string, "context.getString(stringId)"); return string; } catch (Exception unused) { return ""; } } public static final String n() { Context b14 = e7.q.b(); if (b14 != null) { try { PackageInfo packageInfo = b14.getPackageManager().getPackageInfo(b14.getPackageName(), 0); if (packageInfo != null) { return packageInfo.versionName; } } catch (PackageManager.NameNotFoundException unused) { } } return null; } public static final Date o(Bundle bundle, String str, Date date) { long j14; if (bundle == null) { return null; } Object obj = bundle.get(str); if (obj instanceof Long) { j14 = ((Number) obj).longValue(); } else { if (obj instanceof String) { try { j14 = Long.parseLong((String) obj); } catch (NumberFormatException unused) { } } return null; } if (j14 == 0) { return new Date(Long.MAX_VALUE); } return new Date((j14 * 1000) + date.getTime()); } public static final JSONObject p() { if (x7.a.b(b0.class)) { return null; } try { String string = e7.q.b().getSharedPreferences("com.facebook.sdk.DataProcessingOptions", 0).getString("data_processing_options", null); if (string != null) { try { return new JSONObject(string); } catch (JSONException unused) { } } return null; } catch (Throwable th4) { x7.a.a(th4, b0.class); return null; } } public static final GraphRequest q(String str) { String str2; Bundle bundle = new Bundle(); AccessToken b14 = AccessToken.f21912p.b(); if (b14 == null || (str2 = b14.f21923l) == null) { str2 = "facebook"; } bundle.putString("fields", q.b(str2, "instagram") ? "id,name,profile_picture" : "id,name,first_name,middle_name,last_name"); bundle.putString("access_token", str); return new GraphRequest(null, "me", bundle, z.GET, null, null, 32); } public static final void r(String str, a aVar) { q.f(str, AuthConst.CLOVA_LEGACY_ACCESS_TOKEN_KEY); ConcurrentHashMap<String, JSONObject> concurrentHashMap = x.f141797a; JSONObject jSONObject = x.f141797a.get(str); if (jSONObject != null) { aVar.a(jSONObject); return; } c cVar = new c(aVar, str); GraphRequest q14 = q(str); q14.k(cVar); q14.d(); } public static final String s(Context context) { d0.e(context, "context"); return e7.q.c(); } public static final Method t(Class<?> cls, String str, Class<?>... clsArr) { q.f(clsArr, "parameterTypes"); try { return cls.getMethod(str, (Class[]) Arrays.copyOf(clsArr, clsArr.length)); } catch (NoSuchMethodException unused) { return null; } } public static final Method u(String str, String str2, Class<?>... clsArr) { try { return t(Class.forName(str), str2, (Class[]) Arrays.copyOf(clsArr, clsArr.length)); } catch (ClassNotFoundException unused) { return null; } } public static final Locale v() { try { Resources resources = e7.q.b().getResources(); q.e(resources, "FacebookSdk.getApplicationContext().resources"); return resources.getConfiguration().locale; } catch (Exception unused) { return null; } } public static final Object w(JSONObject jSONObject, String str, String str2) throws JSONException { q.f(jSONObject, "jsonObject"); Object opt = jSONObject.opt(str); if (opt != null && (opt instanceof String)) { opt = new JSONTokener((String) opt).nextValue(); } if (opt == null || (opt instanceof JSONObject) || (opt instanceof JSONArray)) { return opt; } if (str2 != null) { JSONObject jSONObject2 = new JSONObject(); jSONObject2.putOpt(str2, opt); return jSONObject2; } throw new l("Got an unexpected non-JSON object."); } public static final b x(JSONObject jSONObject) throws JSONException { String optString; JSONArray jSONArray = jSONObject.getJSONObject("permissions").getJSONArray("data"); ArrayList arrayList = new ArrayList(jSONArray.length()); ArrayList arrayList2 = new ArrayList(jSONArray.length()); ArrayList arrayList3 = new ArrayList(jSONArray.length()); int length = jSONArray.length(); for (int i14 = 0; i14 < length; i14++) { JSONObject optJSONObject = jSONArray.optJSONObject(i14); String optString2 = optJSONObject.optString("permission"); if (!(optString2 == null || q.b(optString2, "installed") || (optString = optJSONObject.optString(KeepContentDTO.COLUMN_STATUS)) == null)) { if (q.b(optString, "granted")) { arrayList.add(optString2); } else if (q.b(optString, "declined")) { arrayList2.add(optString2); } else if (q.b(optString, "expired")) { arrayList3.add(optString2); } } } return new b(arrayList, arrayList2, arrayList3); } public static final String y(String str, byte[] bArr) { try { MessageDigest instance = MessageDigest.getInstance(str); q.e(instance, "hash"); instance.update(bArr); byte[] digest = instance.digest(); StringBuilder sb4 = new StringBuilder(); for (byte b14 : digest) { sb4.append(Integer.toHexString((b14 >> 4) & 15)); sb4.append(Integer.toHexString((b14 >> 0) & 15)); } String sb5 = sb4.toString(); q.e(sb5, "builder.toString()"); return sb5; } catch (NoSuchAlgorithmException unused) { return null; } } public static final Object z(Object obj, Method method, Object... objArr) { q.f(method, "method"); try { return method.invoke(obj, Arrays.copyOf(objArr, objArr.length)); } catch (IllegalAccessException | InvocationTargetException unused) { return null; } } }