导航菜单

页面标题

页面副标题

Dostt v1.0.89 - Y.java 源代码

正在查看: Dostt v1.0.89 应用的 Y.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package o5;

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.database.Cursor;
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.text.TextUtils;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.Display;
import android.view.autofill.AutofillManager;
import android.webkit.CookieManager;
import android.webkit.CookieSyncManager;
import com.cashfree.pg.core.hidden.utils.Constants;
import com.facebook.C0865a;
import com.facebook.C1037v;
import com.facebook.M;
import java.io.BufferedInputStream;
import java.io.Closeable;
import java.io.File;
import java.io.FilenameFilter;
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.nio.charset.Charset;
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.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.Random;
import java.util.Set;
import java.util.TimeZone;
import java.util.regex.Pattern;
import o5.C1399s;
import o5.Y;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.json.JSONTokener;
import t5.C1612a;
import x3.C1766I;

public final class Y {

    private static int f19482b;

    public static final Y f19481a = new Y();

    private static long f19483c = -1;

    private static long f19484d = -1;

    private static long f19485e = -1;

    private static String f19486f = "";

    private static String f19487g = "";

    private static String f19488h = "NoCarrier";

    public interface a {
        void a(JSONObject jSONObject);

        void b(C1037v c1037v);
    }

    private Y() {
    }

    public static final JSONObject A() {
        if (C1612a.d(Y.class)) {
            return null;
        }
        try {
            String string = com.facebook.I.l().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 th) {
            C1612a.b(th, Y.class);
            return null;
        }
    }

    public static final void A0(JSONObject jSONObject, C1383b c1383b, String str, boolean z6, Context context) {
        kotlin.jvm.internal.r.f(jSONObject, "params");
        kotlin.jvm.internal.r.f(context, "context");
        C1399s c1399s = C1399s.f19606a;
        C1399s.b bVar = C1399s.b.ServiceUpdateCompliance;
        if (!C1399s.g(bVar)) {
            jSONObject.put("anon_id", str);
        }
        jSONObject.put("application_tracking_enabled", !z6);
        jSONObject.put("advertiser_id_collection_enabled", com.facebook.I.k());
        if (c1383b != null) {
            if (C1399s.g(bVar)) {
                f19481a.c(jSONObject, c1383b, str, context);
            }
            if (c1383b.j() != null) {
                if (C1399s.g(bVar)) {
                    f19481a.d(jSONObject, c1383b, context);
                } else {
                    jSONObject.put("attribution", c1383b.j());
                }
            }
            if (c1383b.h() != null) {
                jSONObject.put("advertiser_id", c1383b.h());
                jSONObject.put("advertiser_tracking_enabled", !c1383b.l());
            }
            if (!c1383b.l()) {
                String c7 = C1766I.c();
                if (c7.length() != 0) {
                    jSONObject.put("ud", c7);
                }
            }
            if (c1383b.i() != null) {
                jSONObject.put("installer_package", c1383b.i());
            }
        }
    }

    public static final String B(String str) {
        String u6 = com.facebook.I.u();
        return str == null ? u6 : kotlin.jvm.internal.r.b(str, "gaming") ? Aj.o.E(u6, "facebook.com", "fb.gg", false, 4, (Object) null) : kotlin.jvm.internal.r.b(str, "instagram") ? Aj.o.E(u6, "facebook.com", "instagram.com", false, 4, (Object) null) : u6;
    }

    public static final void B0(JSONObject jSONObject, Context context) {
        String str;
        Locale locale;
        int i7;
        Display display;
        PackageInfo packageInfo;
        kotlin.jvm.internal.r.f(jSONObject, "params");
        kotlin.jvm.internal.r.f(context, "appContext");
        JSONArray jSONArray = new JSONArray();
        jSONArray.put("a2");
        f19481a.w0(context);
        String packageName = context.getPackageName();
        int i8 = 0;
        int i9 = -1;
        try {
            packageInfo = context.getPackageManager().getPackageInfo(packageName, 0);
        } catch (PackageManager.NameNotFoundException unused) {
            str = "";
        }
        if (packageInfo == null) {
            return;
        }
        i9 = packageInfo.versionCode;
        str = packageInfo.versionName;
        jSONArray.put(packageName);
        jSONArray.put(i9);
        jSONArray.put(str);
        jSONArray.put(Build.VERSION.RELEASE);
        jSONArray.put(Build.MODEL);
        try {
            locale = context.getResources().getConfiguration().locale;
        } catch (Exception unused2) {
            locale = Locale.getDefault();
        }
        jSONArray.put(locale.getLanguage() + '_' + ((Object) locale.getCountry()));
        jSONArray.put(f19486f);
        jSONArray.put(f19488h);
        double d7 = 0.0d;
        try {
            Object systemService = context.getSystemService("display");
            display = null;
            DisplayManager displayManager = systemService instanceof DisplayManager ? (DisplayManager) systemService : null;
            if (displayManager != null) {
                display = displayManager.getDisplay(0);
            }
        } catch (Exception unused3) {
        }
        if (display != null) {
            DisplayMetrics displayMetrics = new DisplayMetrics();
            display.getMetrics(displayMetrics);
            int i10 = displayMetrics.widthPixels;
            try {
                i8 = displayMetrics.heightPixels;
                d7 = displayMetrics.density;
            } catch (Exception unused4) {
            }
            i7 = i8;
            i8 = i10;
            jSONArray.put(i8);
            jSONArray.put(i7);
            jSONArray.put(new DecimalFormat("#.##").format(d7));
            jSONArray.put(f19481a.t0());
            jSONArray.put(f19484d);
            jSONArray.put(f19485e);
            jSONArray.put(f19487g);
            jSONObject.put("extinfo", jSONArray.toString());
        }
        i7 = 0;
        jSONArray.put(i8);
        jSONArray.put(i7);
        jSONArray.put(new DecimalFormat("#.##").format(d7));
        jSONArray.put(f19481a.t0());
        jSONArray.put(f19484d);
        jSONArray.put(f19485e);
        jSONArray.put(f19487g);
        jSONObject.put("extinfo", jSONArray.toString());
    }

    private final com.facebook.M C(String str) {
        Bundle bundle = new Bundle();
        bundle.putString("fields", I(z()));
        bundle.putString("access_token", str);
        com.facebook.M y6 = com.facebook.M.f13531n.y(null, null);
        y6.J(bundle);
        y6.I(com.facebook.T.GET);
        return y6;
    }

    public static final String C0(byte[] bArr) {
        kotlin.jvm.internal.r.f(bArr, "bytes");
        return f19481a.O("SHA-1", bArr);
    }

    public static final void D(final String str, final a aVar) {
        kotlin.jvm.internal.r.f(str, "accessToken");
        kotlin.jvm.internal.r.f(aVar, "callback");
        JSONObject a7 = O.a(str);
        if (a7 != null) {
            aVar.a(a7);
            return;
        }
        M.b bVar = new M.b() {
            @Override
            public final void a(com.facebook.S s6) {
                Y.E(Y.a.this, str, s6);
            }
        };
        com.facebook.M C6 = f19481a.C(str);
        C6.E(bVar);
        C6.l();
    }

    public static final String D0(String str) {
        if (str == null) {
            return null;
        }
        return f19481a.N("SHA-256", str);
    }

    public static final void E(a aVar, String str, com.facebook.S s6) {
        kotlin.jvm.internal.r.f(aVar, "$callback");
        kotlin.jvm.internal.r.f(str, "$accessToken");
        kotlin.jvm.internal.r.f(s6, "response");
        if (s6.b() != null) {
            aVar.b(s6.b().k());
            return;
        }
        O o7 = O.f19468a;
        JSONObject d7 = s6.d();
        if (d7 == null) {
            throw new IllegalStateException("Required value was null.");
        }
        O.b(str, d7);
        aVar.a(s6.d());
    }

    public static final boolean E0(String str, String str2) {
        boolean z6 = str == null || str.length() == 0;
        boolean z7 = str2 == null || str2.length() == 0;
        if (z6 && z7) {
            return true;
        }
        if (z6 || z7) {
            return false;
        }
        return kotlin.jvm.internal.r.b(str, str2);
    }

    public static final String F(Context context) {
        Z.m(context, "context");
        return com.facebook.I.m();
    }

    public static final void F0(Parcel parcel, Map map) {
        kotlin.jvm.internal.r.f(parcel, "parcel");
        if (map == null) {
            parcel.writeInt(-1);
            return;
        }
        parcel.writeInt(map.size());
        for (Map.Entry entry : map.entrySet()) {
            String str = (String) entry.getKey();
            String str2 = (String) entry.getValue();
            parcel.writeString(str);
            parcel.writeString(str2);
        }
    }

    public static final Method G(Class cls, String str, Class... clsArr) {
        kotlin.jvm.internal.r.f(cls, "clazz");
        kotlin.jvm.internal.r.f(str, "methodName");
        kotlin.jvm.internal.r.f(clsArr, "parameterTypes");
        try {
            return cls.getMethod(str, (Class[]) Arrays.copyOf(clsArr, clsArr.length));
        } catch (NoSuchMethodException unused) {
            return null;
        }
    }

    public static final void G0(Parcel parcel, Map map) {
        kotlin.jvm.internal.r.f(parcel, "parcel");
        if (map == null) {
            parcel.writeInt(-1);
            return;
        }
        parcel.writeInt(map.size());
        for (Map.Entry entry : map.entrySet()) {
            String str = (String) entry.getKey();
            String str2 = (String) entry.getValue();
            parcel.writeString(str);
            parcel.writeString(str2);
        }
    }

    public static final Method H(String str, String str2, Class... clsArr) {
        kotlin.jvm.internal.r.f(str, "className");
        kotlin.jvm.internal.r.f(str2, "methodName");
        kotlin.jvm.internal.r.f(clsArr, "parameterTypes");
        try {
            Class<?> cls = Class.forName(str);
            kotlin.jvm.internal.r.e(cls, "clazz");
            return G(cls, str2, (Class[]) Arrays.copyOf(clsArr, clsArr.length));
        } catch (ClassNotFoundException unused) {
            return null;
        }
    }

    private final String I(String str) {
        return kotlin.jvm.internal.r.b(str, "instagram") ? "id,name,profile_picture" : "id,name,first_name,middle_name,last_name";
    }

    public static final Locale J() {
        try {
            return com.facebook.I.l().getResources().getConfiguration().locale;
        } catch (Exception unused) {
            return null;
        }
    }

    public static final Object K(JSONObject jSONObject, String str, String str2) {
        kotlin.jvm.internal.r.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) {
            throw new C1037v("Got an unexpected non-JSON object.");
        }
        JSONObject jSONObject2 = new JSONObject();
        jSONObject2.putOpt(str2, opt);
        return jSONObject2;
    }

    public static final String L(Uri uri) {
        if (uri == null) {
            return null;
        }
        return uri.toString();
    }

    private final String M(MessageDigest messageDigest, byte[] bArr) {
        messageDigest.update(bArr);
        byte[] digest = messageDigest.digest();
        StringBuilder sb = new StringBuilder();
        kotlin.jvm.internal.r.e(digest, "digest");
        int length = digest.length;
        int i7 = 0;
        while (i7 < length) {
            byte b7 = digest[i7];
            i7++;
            sb.append(Integer.toHexString((b7 >> 4) & 15));
            sb.append(Integer.toHexString(b7 & 15));
        }
        String sb2 = sb.toString();
        kotlin.jvm.internal.r.e(sb2, "builder.toString()");
        return sb2;
    }

    private final String N(String str, String str2) {
        Charset charset = Aj.d.b;
        if (str2 == null) {
            throw new NullPointerException("null cannot be cast to non-null type java.lang.String");
        }
        byte[] bytes = str2.getBytes(charset);
        kotlin.jvm.internal.r.e(bytes, "(this as java.lang.String).getBytes(charset)");
        return O(str, bytes);
    }

    private final String O(String str, byte[] bArr) {
        try {
            MessageDigest messageDigest = MessageDigest.getInstance(str);
            kotlin.jvm.internal.r.e(messageDigest, "hash");
            return M(messageDigest, bArr);
        } catch (NoSuchAlgorithmException unused) {
            return null;
        }
    }

    public static final Object P(Object obj, Method method, Object... objArr) {
        kotlin.jvm.internal.r.f(method, "method");
        kotlin.jvm.internal.r.f(objArr, "args");
        try {
            return method.invoke(obj, Arrays.copyOf(objArr, objArr.length));
        } catch (IllegalAccessException | InvocationTargetException unused) {
            return null;
        }
    }

    public static final boolean Q() {
        try {
            Intent intent = new Intent("android.intent.action.VIEW");
            kotlin.jvm.internal.S s6 = kotlin.jvm.internal.S.a;
            String format = String.format("fb%s://applinks", Arrays.copyOf(new Object[]{com.facebook.I.m()}, 1));
            kotlin.jvm.internal.r.e(format, "java.lang.String.format(format, *args)");
            intent.setData(Uri.parse(format));
            Context l7 = com.facebook.I.l();
            PackageManager packageManager = l7.getPackageManager();
            String packageName = l7.getPackageName();
            List<ResolveInfo> queryIntentActivities = packageManager.queryIntentActivities(intent, 65536);
            kotlin.jvm.internal.r.e(queryIntentActivities, "packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY)");
            Iterator<ResolveInfo> it = queryIntentActivities.iterator();
            while (it.hasNext()) {
                if (kotlin.jvm.internal.r.b(packageName, it.next().activityInfo.packageName)) {
                    return true;
                }
            }
            return false;
        } catch (Exception unused) {
            return false;
        }
    }

    public static final boolean R(Context context) {
        AutofillManager a7;
        boolean isAutofillSupported;
        boolean isEnabled;
        kotlin.jvm.internal.r.f(context, "context");
        if (Build.VERSION.SDK_INT < 26 || (a7 = T.a(context.getSystemService(S.a()))) == null) {
            return false;
        }
        isAutofillSupported = a7.isAutofillSupported();
        if (!isAutofillSupported) {
            return false;
        }
        isEnabled = a7.isEnabled();
        return isEnabled;
    }

    public static final boolean S(Context context) {
        kotlin.jvm.internal.r.f(context, "context");
        if (Build.VERSION.SDK_INT >= 27) {
            return context.getPackageManager().hasSystemFeature("android.hardware.type.pc");
        }
        String str = Build.DEVICE;
        if (str != null) {
            kotlin.jvm.internal.r.e(str, "DEVICE");
            if (new Aj.l(".+_cheets|cheets_.+").d(str)) {
                return true;
            }
        }
        return false;
    }

    public static final boolean T(Uri uri) {
        return uri != null && Aj.o.u("content", uri.getScheme(), true);
    }

    public static final boolean U(C0865a c0865a) {
        return c0865a != null && kotlin.jvm.internal.r.b(c0865a, C0865a.f13622t.e());
    }

    public static final boolean V() {
        if (C1612a.d(Y.class)) {
            return false;
        }
        try {
            JSONObject A6 = A();
            if (A6 == null) {
                return false;
            }
            try {
                JSONArray jSONArray = A6.getJSONArray("data_processing_options");
                int length = jSONArray.length();
                if (length > 0) {
                    int i7 = 0;
                    while (true) {
                        int i8 = i7 + 1;
                        String string = jSONArray.getString(i7);
                        kotlin.jvm.internal.r.e(string, "options.getString(i)");
                        String lowerCase = string.toLowerCase();
                        kotlin.jvm.internal.r.e(lowerCase, "(this as java.lang.String).toLowerCase()");
                        if (kotlin.jvm.internal.r.b(lowerCase, "ldu")) {
                            return true;
                        }
                        if (i8 >= length) {
                            break;
                        }
                        i7 = i8;
                    }
                }
            } catch (Exception unused) {
            }
            return false;
        } catch (Throwable th) {
            C1612a.b(th, Y.class);
            return false;
        }
    }

    public static final boolean W(Uri uri) {
        return uri != null && Aj.o.u("file", uri.getScheme(), true);
    }

    private final boolean X(Context context) {
        Method H6 = H("com.google.android.gms.common.GooglePlayServicesUtil", "isGooglePlayServicesAvailable", Context.class);
        if (H6 == null) {
            return false;
        }
        Object P6 = P(null, H6, context);
        return (P6 instanceof Integer) && kotlin.jvm.internal.r.b(P6, 0);
    }

    public static final boolean Y(String str) {
        return str == null || str.length() == 0;
    }

    public static final boolean Z(Collection collection) {
        return collection == null || collection.isEmpty();
    }

    public static final boolean a0(Uri uri) {
        return uri != null && (Aj.o.u("http", uri.getScheme(), true) || Aj.o.u("https", uri.getScheme(), true) || Aj.o.u("fbstaging", uri.getScheme(), true));
    }

    public static final Set b0(JSONArray jSONArray) {
        kotlin.jvm.internal.r.f(jSONArray, "jsonArray");
        HashSet hashSet = new HashSet();
        int length = jSONArray.length();
        if (length > 0) {
            int i7 = 0;
            while (true) {
                int i8 = i7 + 1;
                String string = jSONArray.getString(i7);
                kotlin.jvm.internal.r.e(string, "jsonArray.getString(i)");
                hashSet.add(string);
                if (i8 >= length) {
                    break;
                }
                i7 = i8;
            }
        }
        return hashSet;
    }

    private final void c(JSONObject jSONObject, C1383b c1383b, String str, Context context) {
        if (Build.VERSION.SDK_INT < 31 || !X(context)) {
            jSONObject.put("anon_id", str);
        } else {
            if (c1383b.l()) {
                return;
            }
            jSONObject.put("anon_id", str);
        }
    }

    public static final List c0(JSONArray jSONArray) {
        kotlin.jvm.internal.r.f(jSONArray, "jsonArray");
        ArrayList arrayList = new ArrayList();
        int length = jSONArray.length();
        if (length > 0) {
            int i7 = 0;
            while (true) {
                int i8 = i7 + 1;
                arrayList.add(jSONArray.getString(i7));
                if (i8 >= length) {
                    break;
                }
                i7 = i8;
            }
        }
        return arrayList;
    }

    private final void d(JSONObject jSONObject, C1383b c1383b, Context context) {
        if (Build.VERSION.SDK_INT < 31 || !X(context)) {
            jSONObject.put("attribution", c1383b.j());
        } else {
            if (c1383b.l()) {
                return;
            }
            jSONObject.put("attribution", c1383b.j());
        }
    }

    public static final Map d0(String str) {
        kotlin.jvm.internal.r.f(str, "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();
                kotlin.jvm.internal.r.e(next, "key");
                String string = jSONObject.getString(next);
                kotlin.jvm.internal.r.e(string, "jsonObject.getString(key)");
                hashMap.put(next, string);
            }
            return hashMap;
        } catch (JSONException unused) {
            return new HashMap();
        }
    }

    public static final boolean e(Object obj, Object obj2) {
        return obj == null ? obj2 == null : kotlin.jvm.internal.r.b(obj, obj2);
    }

    public static final void e0(String str, Exception exc) {
        if (!com.facebook.I.D() || str == null || exc == null) {
            return;
        }
        Log.d(str, exc.getClass().getSimpleName() + ": " + ((Object) exc.getMessage()));
    }

    public static final JSONObject f(String str) {
        kotlin.jvm.internal.r.f(str, "accessToken");
        JSONObject a7 = O.a(str);
        if (a7 != null) {
            return a7;
        }
        com.facebook.S k7 = f19481a.C(str).k();
        if (k7.b() != null) {
            return null;
        }
        return k7.d();
    }

    public static final void f0(String str, String str2) {
        if (!com.facebook.I.D() || str == null || str2 == null) {
            return;
        }
        Log.d(str, str2);
    }

    public static final Uri g(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();
        kotlin.jvm.internal.r.e(build, "builder.build()");
        return build;
    }

    public static final void g0(String str, String str2, Throwable th) {
        if (!com.facebook.I.D() || Y(str)) {
            return;
        }
        Log.d(str, str2, th);
    }

    private final void h(Context context, String str) {
        CookieSyncManager.createInstance(context).sync();
        CookieManager cookieManager = CookieManager.getInstance();
        String cookie = cookieManager.getCookie(str);
        if (cookie == null) {
            return;
        }
        Object[] array = Aj.o.F0(cookie, new String[]{";"}, false, 0, 6, (Object) null).toArray(new String[0]);
        if (array == null) {
            throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
        }
        String[] strArr = (String[]) array;
        int length = strArr.length;
        int i7 = 0;
        while (i7 < length) {
            String str2 = strArr[i7];
            i7++;
            Object[] array2 = Aj.o.F0(str2, new String[]{"="}, false, 0, 6, (Object) null).toArray(new String[0]);
            if (array2 == null) {
                throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
            }
            String[] strArr2 = (String[]) array2;
            if (strArr2.length > 0) {
                String str3 = strArr2[0];
                int length2 = str3.length() - 1;
                int i8 = 0;
                boolean z6 = false;
                while (i8 <= length2) {
                    boolean z7 = kotlin.jvm.internal.r.g(str3.charAt(!z6 ? i8 : length2), 32) <= 0;
                    if (z6) {
                        if (!z7) {
                            break;
                        } else {
                            length2--;
                        }
                    } else if (z7) {
                        i8++;
                    } else {
                        z6 = true;
                    }
                }
                cookieManager.setCookie(str, kotlin.jvm.internal.r.m(str3.subSequence(i8, length2 + 1).toString(), "=;expires=Sat, 1 Jan 2000 00:00:01 UTC;"));
            }
        }
        cookieManager.removeExpiredCookie();
    }

    public static final String h0(Map map) {
        kotlin.jvm.internal.r.f(map, "map");
        String str = "";
        if (!map.isEmpty()) {
            try {
                JSONObject jSONObject = new JSONObject();
                for (Map.Entry entry : map.entrySet()) {
                    jSONObject.put((String) entry.getKey(), (String) entry.getValue());
                }
                str = jSONObject.toString();
            } catch (JSONException unused) {
            }
            kotlin.jvm.internal.r.e(str, "{\n      try {\n        val jsonObject = JSONObject()\n        for ((key, value) in map) {\n          jsonObject.put(key, value)\n        }\n        jsonObject.toString()\n      } catch (_e: JSONException) {\n        \"\"\n      }\n    }");
        }
        return str;
    }

    public static final void i(Context context) {
        kotlin.jvm.internal.r.f(context, "context");
        try {
            Y y6 = f19481a;
            y6.h(context, "facebook.com");
            y6.h(context, ".facebook.com");
            y6.h(context, "https://facebook.com");
            y6.h(context, "https://.facebook.com");
        } catch (Exception unused) {
        }
    }

    public static final String i0(String str) {
        kotlin.jvm.internal.r.f(str, "key");
        return f19481a.N("MD5", str);
    }

    public static final void j(Closeable closeable) {
        if (closeable == null) {
            return;
        }
        try {
            closeable.close();
        } catch (IOException unused) {
        }
    }

    public static final boolean j0(Context context) {
        kotlin.jvm.internal.r.f(context, "context");
        return R(context);
    }

    public static final String k(String str, String str2) {
        return Y(str) ? str2 : str;
    }

    public static final Bundle k0(String str) {
        Bundle bundle = new Bundle();
        if (!Y(str)) {
            if (str == null) {
                throw new IllegalStateException("Required value was null.");
            }
            Object[] array = Aj.o.F0(str, new String[]{"&"}, false, 0, 6, (Object) null).toArray(new String[0]);
            if (array == null) {
                throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
            }
            String[] strArr = (String[]) array;
            int length = strArr.length;
            int i7 = 0;
            while (i7 < length) {
                String str2 = strArr[i7];
                i7++;
                Object[] array2 = Aj.o.F0(str2, new String[]{"="}, false, 0, 6, (Object) null).toArray(new String[0]);
                if (array2 == null) {
                    throw new NullPointerException("null cannot be cast to non-null type kotlin.Array<T>");
                }
                String[] strArr2 = (String[]) array2;
                try {
                    if (strArr2.length == 2) {
                        bundle.putString(URLDecoder.decode(strArr2[0], "UTF-8"), URLDecoder.decode(strArr2[1], "UTF-8"));
                    } else if (strArr2.length == 1) {
                        bundle.putString(URLDecoder.decode(strArr2[0], "UTF-8"), "");
                    }
                } catch (UnsupportedEncodingException e7) {
                    e0("FacebookSDK", e7);
                }
            }
        }
        return bundle;
    }

    private final long l(double d7) {
        return Math.round(d7 / 1.073741824E9d);
    }

    public static final void l0(Bundle bundle, String str, List list) {
        kotlin.jvm.internal.r.f(bundle, "b");
        if (list != null) {
            bundle.putString(str, TextUtils.join(",", list));
        }
    }

    public static final List m(JSONArray jSONArray) {
        kotlin.jvm.internal.r.f(jSONArray, "jsonArray");
        try {
            ArrayList arrayList = new ArrayList();
            int length = jSONArray.length();
            if (length <= 0) {
                return arrayList;
            }
            int i7 = 0;
            while (true) {
                int i8 = i7 + 1;
                String string = jSONArray.getString(i7);
                kotlin.jvm.internal.r.e(string, "jsonArray.getString(i)");
                arrayList.add(string);
                if (i8 >= length) {
                    return arrayList;
                }
                i7 = i8;
            }
        } catch (JSONException unused) {
            return new ArrayList();
        }
    }

    public static final boolean m0(Bundle bundle, String str, Object obj) {
        kotlin.jvm.internal.r.f(bundle, "bundle");
        if (obj == null) {
            bundle.remove(str);
            return true;
        }
        if (obj instanceof Boolean) {
            bundle.putBoolean(str, ((Boolean) obj).booleanValue());
            return true;
        }
        if (obj instanceof boolean[]) {
            bundle.putBooleanArray(str, (boolean[]) obj);
            return true;
        }
        if (obj instanceof Double) {
            bundle.putDouble(str, ((Number) obj).doubleValue());
            return true;
        }
        if (obj instanceof double[]) {
            bundle.putDoubleArray(str, (double[]) obj);
            return true;
        }
        if (obj instanceof Integer) {
            bundle.putInt(str, ((Number) obj).intValue());
            return true;
        }
        if (obj instanceof int[]) {
            bundle.putIntArray(str, (int[]) obj);
            return true;
        }
        if (obj instanceof Long) {
            bundle.putLong(str, ((Number) obj).longValue());
            return true;
        }
        if (obj instanceof long[]) {
            bundle.putLongArray(str, (long[]) obj);
            return true;
        }
        if (obj instanceof String) {
            bundle.putString(str, (String) obj);
            return true;
        }
        if (obj instanceof JSONArray) {
            bundle.putString(str, ((JSONArray) obj).toString());
            return true;
        }
        if (!(obj instanceof JSONObject)) {
            return false;
        }
        bundle.putString(str, ((JSONObject) obj).toString());
        return true;
    }

    public static final Map n(JSONObject jSONObject) {
        kotlin.jvm.internal.r.f(jSONObject, "jsonObject");
        HashMap hashMap = new HashMap();
        JSONArray names = jSONObject.names();
        if (names == null) {
            return hashMap;
        }
        int length = names.length();
        if (length > 0) {
            int i7 = 0;
            while (true) {
                int i8 = i7 + 1;
                try {
                    String string = names.getString(i7);
                    kotlin.jvm.internal.r.e(string, "keys.getString(i)");
                    Object obj = jSONObject.get(string);
                    if (obj instanceof JSONObject) {
                        obj = n((JSONObject) obj);
                    }
                    kotlin.jvm.internal.r.e(obj, "value");
                    hashMap.put(string, obj);
                } catch (JSONException unused) {
                }
                if (i8 >= length) {
                    break;
                }
                i7 = i8;
            }
        }
        return hashMap;
    }

    public static final void n0(Bundle bundle, String str, String str2) {
        kotlin.jvm.internal.r.f(bundle, "b");
        if (Y(str2)) {
            return;
        }
        bundle.putString(str, str2);
    }

    public static final Map o(JSONObject jSONObject) {
        kotlin.jvm.internal.r.f(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) {
                kotlin.jvm.internal.r.e(next, "key");
                hashMap.put(next, optString);
            }
        }
        return hashMap;
    }

    public static final void o0(Bundle bundle, String str, Uri uri) {
        kotlin.jvm.internal.r.f(bundle, "b");
        if (uri != null) {
            n0(bundle, str, uri.toString());
        }
    }

    public static final int p(InputStream inputStream, OutputStream outputStream) {
        BufferedInputStream bufferedInputStream;
        kotlin.jvm.internal.r.f(outputStream, "outputStream");
        BufferedInputStream bufferedInputStream2 = null;
        try {
            bufferedInputStream = new BufferedInputStream(inputStream);
        } catch (Throwable th) {
            th = th;
        }
        try {
            byte[] bArr = new byte[8192];
            int i7 = 0;
            while (true) {
                int read = bufferedInputStream.read(bArr);
                if (read == -1) {
                    break;
                }
                outputStream.write(bArr, 0, read);
                i7 += read;
            }
            bufferedInputStream.close();
            if (inputStream != null) {
                inputStream.close();
            }
            return i7;
        } catch (Throwable th2) {
            th = th2;
            bufferedInputStream2 = bufferedInputStream;
            if (bufferedInputStream2 != null) {
                bufferedInputStream2.close();
            }
            if (inputStream != null) {
                inputStream.close();
            }
            throw th;
        }
    }

    public static final Map p0(Parcel parcel) {
        kotlin.jvm.internal.r.f(parcel, "parcel");
        int readInt = parcel.readInt();
        if (readInt < 0) {
            return null;
        }
        HashMap hashMap = new HashMap();
        if (readInt > 0) {
            int i7 = 0;
            do {
                i7++;
                String readString = parcel.readString();
                String readString2 = parcel.readString();
                if (readString != null && readString2 != null) {
                    hashMap.put(readString, readString2);
                }
            } while (i7 < readInt);
        }
        return hashMap;
    }

    public static final void q(URLConnection uRLConnection) {
        if (uRLConnection == null || !(uRLConnection instanceof HttpURLConnection)) {
            return;
        }
        ((HttpURLConnection) uRLConnection).disconnect();
    }

    public static final String q0(InputStream inputStream) {
        BufferedInputStream bufferedInputStream;
        Throwable th;
        InputStreamReader inputStreamReader;
        try {
            bufferedInputStream = new BufferedInputStream(inputStream);
            try {
                inputStreamReader = new InputStreamReader(bufferedInputStream);
                try {
                    StringBuilder sb = new StringBuilder();
                    char[] cArr = new char[2048];
                    while (true) {
                        int read = inputStreamReader.read(cArr);
                        if (read == -1) {
                            String sb2 = sb.toString();
                            kotlin.jvm.internal.r.e(sb2, "{\n      bufferedInputStream = BufferedInputStream(inputStream)\n      reader = InputStreamReader(bufferedInputStream)\n      val stringBuilder = StringBuilder()\n      val bufferSize = 1024 * 2\n      val buffer = CharArray(bufferSize)\n      var n = 0\n      while (reader.read(buffer).also { n = it } != -1) {\n        stringBuilder.append(buffer, 0, n)\n      }\n      stringBuilder.toString()\n    }");
                            j(bufferedInputStream);
                            j(inputStreamReader);
                            return sb2;
                        }
                        sb.append(cArr, 0, read);
                    }
                } catch (Throwable th2) {
                    th = th2;
                    j(bufferedInputStream);
                    j(inputStreamReader);
                    throw th;
                }
            } catch (Throwable th3) {
                th = th3;
                inputStreamReader = null;
            }
        } catch (Throwable th4) {
            bufferedInputStream = null;
            th = th4;
            inputStreamReader = null;
        }
    }

    private final boolean r() {
        return kotlin.jvm.internal.r.b("mounted", Environment.getExternalStorageState());
    }

    public static final Map r0(Parcel parcel) {
        kotlin.jvm.internal.r.f(parcel, "parcel");
        int readInt = parcel.readInt();
        if (readInt < 0) {
            return null;
        }
        HashMap hashMap = new HashMap();
        if (readInt > 0) {
            int i7 = 0;
            do {
                i7++;
                hashMap.put(parcel.readString(), parcel.readString());
            } while (i7 < readInt);
        }
        return hashMap;
    }

    public static final String s(int i7) {
        String bigInteger = new BigInteger(i7 * 5, new Random()).toString(32);
        kotlin.jvm.internal.r.e(bigInteger, "BigInteger(length * 5, r).toString(32)");
        return bigInteger;
    }

    private final void s0() {
        try {
            if (r()) {
                StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
                f19485e = statFs.getAvailableBlocks() * statFs.getBlockSize();
            }
            f19485e = l(f19485e);
        } catch (Exception unused) {
        }
    }

    public static final String t(Context context) {
        if (context == null) {
            return "null";
        }
        if (context == context.getApplicationContext()) {
            return "unknown";
        }
        String simpleName = context.getClass().getSimpleName();
        kotlin.jvm.internal.r.e(simpleName, "{\n      context.javaClass.simpleName\n    }");
        return simpleName;
    }

    private final int t0() {
        int i7 = f19482b;
        if (i7 > 0) {
            return i7;
        }
        try {
            File[] listFiles = new File("/sys/devices/system/cpu/").listFiles(new FilenameFilter() {
                @Override
                public final boolean accept(File file, String str) {
                    boolean u02;
                    u02 = Y.u0(file, str);
                    return u02;
                }
            });
            if (listFiles != null) {
                f19482b = listFiles.length;
            }
        } catch (Exception unused) {
        }
        if (f19482b <= 0) {
            f19482b = Math.max(Runtime.getRuntime().availableProcessors(), 1);
        }
        return f19482b;
    }

    public static final String u(Context context) {
        String string;
        kotlin.jvm.internal.r.f(context, "context");
        try {
            String n7 = com.facebook.I.n();
            if (n7 != null) {
                return n7;
            }
            ApplicationInfo applicationInfo = context.getApplicationInfo();
            int i7 = applicationInfo.labelRes;
            if (i7 == 0) {
                string = applicationInfo.nonLocalizedLabel.toString();
            } else {
                string = context.getString(i7);
                kotlin.jvm.internal.r.e(string, "context.getString(stringId)");
            }
            return string;
        } catch (Exception unused) {
            return "";
        }
    }

    public static final boolean u0(File file, String str) {
        return Pattern.matches("cpu[0-9]+", str);
    }

    public static final String v() {
        Context l7 = com.facebook.I.l();
        if (l7 == null) {
            return null;
        }
        try {
            PackageInfo packageInfo = l7.getPackageManager().getPackageInfo(l7.getPackageName(), 0);
            if (packageInfo == null) {
                return null;
            }
            return packageInfo.versionName;
        } catch (PackageManager.NameNotFoundException unused) {
            return null;
        }
    }

    private final void v0(Context context) {
        if (kotlin.jvm.internal.r.b(f19488h, "NoCarrier")) {
            try {
                Object systemService = context.getSystemService(Constants.PHONE);
                if (systemService == null) {
                    throw new NullPointerException("null cannot be cast to non-null type android.telephony.TelephonyManager");
                }
                String networkOperatorName = ((TelephonyManager) systemService).getNetworkOperatorName();
                kotlin.jvm.internal.r.e(networkOperatorName, "telephonyManager.networkOperatorName");
                f19488h = networkOperatorName;
            } catch (Exception unused) {
            }
        }
    }

    public static final Date w(Bundle bundle, String str, Date date) {
        long parseLong;
        kotlin.jvm.internal.r.f(date, "dateBase");
        if (bundle == null) {
            return null;
        }
        Object obj = bundle.get(str);
        if (!(obj instanceof Long)) {
            if (obj instanceof String) {
                try {
                    parseLong = Long.parseLong((String) obj);
                } catch (NumberFormatException unused) {
                }
            }
            return null;
        }
        parseLong = ((Number) obj).longValue();
        return parseLong == 0 ? new Date(Long.MAX_VALUE) : new Date(date.getTime() + (parseLong * 1000));
    }

    private final void w0(Context context) {
        if (f19483c == -1 || System.currentTimeMillis() - f19483c >= 1800000) {
            f19483c = System.currentTimeMillis();
            x0();
            v0(context);
            y0();
            s0();
        }
    }

    public static final long x(Uri uri) {
        kotlin.jvm.internal.r.f(uri, "contentUri");
        Cursor cursor = null;
        try {
            cursor = com.facebook.I.l().getContentResolver().query(uri, null, null, null, null);
            if (cursor == null) {
                return 0L;
            }
            int columnIndex = cursor.getColumnIndex("_size");
            cursor.moveToFirst();
            long j7 = cursor.getLong(columnIndex);
            cursor.close();
            return j7;
        } catch (Throwable th) {
            if (cursor != null) {
                cursor.close();
            }
            throw th;
        }
    }

    private final void x0() {
        try {
            TimeZone timeZone = TimeZone.getDefault();
            String displayName = timeZone.getDisplayName(timeZone.inDaylightTime(new Date()), 0);
            kotlin.jvm.internal.r.e(displayName, "tz.getDisplayName(tz.inDaylightTime(Date()), TimeZone.SHORT)");
            f19486f = displayName;
            String id = timeZone.getID();
            kotlin.jvm.internal.r.e(id, "tz.id");
            f19487g = id;
        } catch (AssertionError | Exception unused) {
        }
    }

    public static final Locale y() {
        Locale J6 = J();
        if (J6 != null) {
            return J6;
        }
        Locale locale = Locale.getDefault();
        kotlin.jvm.internal.r.e(locale, "getDefault()");
        return locale;
    }

    private final void y0() {
        try {
            if (r()) {
                StatFs statFs = new StatFs(Environment.getExternalStorageDirectory().getPath());
                f19484d = statFs.getBlockCount() * statFs.getBlockSize();
            }
            f19484d = l(f19484d);
        } catch (Exception unused) {
        }
    }

    private final String z() {
        C0865a e7 = C0865a.f13622t.e();
        return (e7 == null || e7.l() == null) ? "facebook" : e7.l();
    }

    public static final void z0(Runnable runnable) {
        try {
            com.facebook.I.t().execute(runnable);
        } catch (Exception unused) {
        }
    }
}