Pinjamwinwin v2.0.7版本的 MD5 值为:254981700b50ce03309ecdaac5d16485

以下内容为反编译后的 w5.java 源代码,内容仅作参考


package f6;

import android.content.ComponentName;
import android.content.Context;
import android.content.pm.ActivityInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.Signature;
import android.net.Uri;
import android.os.Bundle;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.text.TextUtils;
import com.adjust.sdk.Constants;
import com.google.android.gms.internal.measurement.q8;
import com.google.android.gms.internal.measurement.r8;
import java.io.ByteArrayInputStream;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Random;
import java.util.TreeSet;
import java.util.concurrent.atomic.AtomicLong;
import javax.security.auth.x500.X500Principal;
public final class w5 extends z3 {
    public static final String[] f7170p = {"firebase_", "google_", "ga_"};
    public static final String[] f7171s = {"_err"};
    public SecureRandom f7172c;
    public final AtomicLong f7173d;
    public int f7174j;
    public Integer f7175m;

    public w5(u3 u3Var) {
        super(u3Var);
        this.f7175m = null;
        this.f7173d = new AtomicLong(0L);
    }

    public static void B(t4 t4Var, Bundle bundle, boolean z8) {
        if (bundle != null && t4Var != null) {
            if (!bundle.containsKey("_sc") || z8) {
                String str = t4Var.f7073a;
                if (str != null) {
                    bundle.putString("_sn", str);
                } else {
                    bundle.remove("_sn");
                }
                String str2 = t4Var.f7074b;
                if (str2 != null) {
                    bundle.putString("_sc", str2);
                } else {
                    bundle.remove("_sc");
                }
                bundle.putLong("_si", t4Var.f7075c);
                return;
            }
            z8 = false;
        }
        if (bundle != null && t4Var == null && z8) {
            bundle.remove("_sn");
            bundle.remove("_sc");
            bundle.remove("_si");
        }
    }

    public static void F(v5 v5Var, String str, int i3, String str2, String str3, int i10) {
        Bundle bundle = new Bundle();
        h0(i3, bundle);
        if (!TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3)) {
            bundle.putString(str2, str3);
        }
        if (i3 == 6 || i3 == 7 || i3 == 2) {
            bundle.putLong("_el", i10);
        }
        v5Var.l(str, bundle);
    }

    public static boolean Z(Object obj) {
        return (obj instanceof Parcelable[]) || (obj instanceof ArrayList) || (obj instanceof Bundle);
    }

    public static boolean c0(String str) {
        return !TextUtils.isEmpty(str) && str.startsWith("_");
    }

    public static boolean d0(String str) {
        com.bumptech.glide.c.e(str);
        return str.charAt(0) != '_' || str.equals("_ep");
    }

    public static boolean e0(Context context) {
        ActivityInfo receiverInfo;
        com.bumptech.glide.c.h(context);
        try {
            PackageManager packageManager = context.getPackageManager();
            if (packageManager != null && (receiverInfo = packageManager.getReceiverInfo(new ComponentName(context, "com.google.android.gms.measurement.AppMeasurementReceiver"), 0)) != null) {
                if (receiverInfo.enabled) {
                    return true;
                }
            }
        } catch (PackageManager.NameNotFoundException unused) {
        }
        return false;
    }

    public static boolean f0(String str, String str2, String str3, String str4) {
        boolean isEmpty = TextUtils.isEmpty(str);
        boolean isEmpty2 = TextUtils.isEmpty(str2);
        if (!isEmpty && !isEmpty2) {
            com.bumptech.glide.c.h(str);
            return !str.equals(str2);
        } else if (isEmpty && isEmpty2) {
            return (TextUtils.isEmpty(str3) || TextUtils.isEmpty(str4)) ? !TextUtils.isEmpty(str4) : !str3.equals(str4);
        } else if (isEmpty) {
            return TextUtils.isEmpty(str3) || !str3.equals(str4);
        } else if (TextUtils.isEmpty(str4)) {
            return false;
        } else {
            return TextUtils.isEmpty(str3) || !str3.equals(str4);
        }
    }

    public static byte[] g0(Parcelable parcelable) {
        if (parcelable == null) {
            return null;
        }
        Parcel obtain = Parcel.obtain();
        try {
            parcelable.writeToParcel(obtain, 0);
            return obtain.marshall();
        } finally {
            obtain.recycle();
        }
    }

    public static final boolean h0(int i3, Bundle bundle) {
        if (bundle != null && bundle.getLong("_err") == 0) {
            bundle.putLong("_err", i3);
            return true;
        }
        return false;
    }

    public static boolean k0(String str, String[] strArr) {
        boolean z8;
        com.bumptech.glide.c.h(strArr);
        for (String str2 : strArr) {
            if (str != str2 && (str == null || !str.equals(str2))) {
                z8 = false;
            } else {
                z8 = true;
            }
            if (z8) {
                return true;
            }
        }
        return false;
    }

    public static long r0(byte[] bArr) {
        com.bumptech.glide.c.h(bArr);
        int length = bArr.length;
        int i3 = 0;
        com.bumptech.glide.c.k(length > 0);
        long j10 = 0;
        for (int i10 = length - 1; i10 >= 0 && i10 >= bArr.length - 8; i10--) {
            j10 += (bArr[i10] & 255) << i3;
            i3 += 8;
        }
        return j10;
    }

    public static String u(String str, int i3, boolean z8) {
        if (str == null) {
            return null;
        }
        if (str.codePointCount(0, str.length()) > i3) {
            if (z8) {
                return String.valueOf(str.substring(0, str.offsetByCodePoints(0, i3))).concat("...");
            }
            return null;
        }
        return str;
    }

    public static MessageDigest v() {
        MessageDigest messageDigest;
        for (int i3 = 0; i3 < 2; i3++) {
            try {
                messageDigest = MessageDigest.getInstance("MD5");
            } catch (NoSuchAlgorithmException unused) {
            }
            if (messageDigest != null) {
                return messageDigest;
            }
        }
        return null;
    }

    public static ArrayList x(List list) {
        if (list == null) {
            return new ArrayList(0);
        }
        ArrayList arrayList = new ArrayList(list.size());
        Iterator it = list.iterator();
        while (it.hasNext()) {
            c cVar = (c) it.next();
            Bundle bundle = new Bundle();
            bundle.putString("app_id", cVar.f6687a);
            bundle.putString("origin", cVar.f6688b);
            bundle.putLong("creation_timestamp", cVar.f6690d);
            bundle.putString("name", cVar.f6689c.f7080b);
            Object f3 = cVar.f6689c.f();
            com.bumptech.glide.c.h(f3);
            com.bumptech.glide.c.v(bundle, f3);
            bundle.putBoolean("active", cVar.f6691j);
            String str = cVar.f6692m;
            if (str != null) {
                bundle.putString("trigger_event_name", str);
            }
            n nVar = cVar.f6693p;
            if (nVar != null) {
                bundle.putString("timed_out_event_name", nVar.f6897a);
                m mVar = nVar.f6898b;
                if (mVar != null) {
                    bundle.putBundle("timed_out_event_params", mVar.f());
                }
            }
            bundle.putLong("trigger_timeout", cVar.f6694s);
            n nVar2 = cVar.X;
            if (nVar2 != null) {
                bundle.putString("triggered_event_name", nVar2.f6897a);
                m mVar2 = nVar2.f6898b;
                if (mVar2 != null) {
                    bundle.putBundle("triggered_event_params", mVar2.f());
                }
            }
            bundle.putLong("triggered_timestamp", cVar.f6689c.f7081c);
            bundle.putLong("time_to_live", cVar.Y);
            n nVar3 = cVar.Z;
            if (nVar3 != null) {
                bundle.putString("expired_event_name", nVar3.f6897a);
                m mVar3 = nVar3.f6898b;
                if (mVar3 != null) {
                    bundle.putBundle("expired_event_params", mVar3.f());
                }
            }
            arrayList.add(bundle);
        }
        return arrayList;
    }

    public final void A(Bundle bundle, int i3, String str, Object obj) {
        if (h0(i3, bundle)) {
            ((u3) this.f8832a).getClass();
            bundle.putString("_ev", u(str, 40, true));
            if (obj != null) {
                if ((obj instanceof String) || (obj instanceof CharSequence)) {
                    bundle.putLong("_el", obj.toString().length());
                }
            }
        }
    }

    public final void C(Bundle bundle, Bundle bundle2) {
        if (bundle2 == null) {
            return;
        }
        for (String str : bundle2.keySet()) {
            if (!bundle.containsKey(str)) {
                w5 w5Var = ((u3) this.f8832a).f7104e0;
                u3.i(w5Var);
                w5Var.G(bundle, str, bundle2.get(str));
            }
        }
    }

    public final void D(Parcelable[] parcelableArr, int i3, boolean z8) {
        int i10;
        com.bumptech.glide.c.h(parcelableArr);
        for (Parcelable parcelable : parcelableArr) {
            Bundle bundle = (Bundle) parcelable;
            Iterator it = new TreeSet(bundle.keySet()).iterator();
            int i11 = 0;
            while (it.hasNext()) {
                String str = (String) it.next();
                if (d0(str) && !k0(str, b6.w4.f2936d) && (i11 = i11 + 1) > i3) {
                    u3 u3Var = (u3) this.f8832a;
                    if (z8) {
                        a3 a3Var = u3Var.X;
                        u3.k(a3Var);
                        a3Var.f6629s.d(u3Var.f7105f0.e(str), u3Var.f7105f0.b(bundle), "Param can't contain more than " + i3 + " item-scoped custom parameters");
                        i10 = 28;
                    } else {
                        a3 a3Var2 = u3Var.X;
                        u3.k(a3Var2);
                        a3Var2.f6629s.d(u3Var.f7105f0.e(str), u3Var.f7105f0.b(bundle), "Param cannot contain item-scoped custom parameters");
                        i10 = 23;
                    }
                    h0(i10, bundle);
                    bundle.remove(str);
                }
            }
        }
    }

    public final void E(b3 b3Var, int i3) {
        Object obj = b3Var.f6651e;
        Iterator it = new TreeSet(((Bundle) obj).keySet()).iterator();
        int i10 = 0;
        while (it.hasNext()) {
            String str = (String) it.next();
            if (d0(str) && (i10 = i10 + 1) > i3) {
                String g10 = e0.a0.g("Event can't contain more than ", i3, " params");
                u3 u3Var = (u3) this.f8832a;
                a3 a3Var = u3Var.X;
                u3.k(a3Var);
                Bundle bundle = (Bundle) obj;
                a3Var.f6629s.d(u3Var.f7105f0.d((String) b3Var.f6649c), u3Var.f7105f0.b(bundle), g10);
                h0(5, bundle);
                bundle.remove(str);
            }
        }
    }

    public final void G(Bundle bundle, String str, Object obj) {
        String str2;
        if (bundle == null) {
            return;
        }
        if (obj instanceof Long) {
            bundle.putLong(str, ((Long) obj).longValue());
        } else if (obj instanceof String) {
            bundle.putString(str, String.valueOf(obj));
        } else if (obj instanceof Double) {
            bundle.putDouble(str, ((Double) obj).doubleValue());
        } else if (obj instanceof Bundle[]) {
            bundle.putParcelableArray(str, (Bundle[]) obj);
        } else if (str != null) {
            if (obj != null) {
                str2 = obj.getClass().getSimpleName();
            } else {
                str2 = null;
            }
            Object obj2 = this.f8832a;
            a3 a3Var = ((u3) obj2).X;
            u3.k(a3Var);
            a3Var.Z.d(((u3) obj2).f7105f0.e(str), str2, "Not putting event parameter. Invalid value type. name, type");
        }
    }

    public final void H(com.google.android.gms.internal.measurement.k0 k0Var, boolean z8) {
        Bundle bundle = new Bundle();
        bundle.putBoolean("r", z8);
        try {
            k0Var.r(bundle);
        } catch (RemoteException e10) {
            a3 a3Var = ((u3) this.f8832a).X;
            u3.k(a3Var);
            a3Var.X.c(e10, "Error returning boolean value to wrapper");
        }
    }

    public final void I(com.google.android.gms.internal.measurement.k0 k0Var, ArrayList arrayList) {
        Bundle bundle = new Bundle();
        bundle.putParcelableArrayList("r", arrayList);
        try {
            k0Var.r(bundle);
        } catch (RemoteException e10) {
            a3 a3Var = ((u3) this.f8832a).X;
            u3.k(a3Var);
            a3Var.X.c(e10, "Error returning bundle list to wrapper");
        }
    }

    public final void J(com.google.android.gms.internal.measurement.k0 k0Var, Bundle bundle) {
        try {
            k0Var.r(bundle);
        } catch (RemoteException e10) {
            a3 a3Var = ((u3) this.f8832a).X;
            u3.k(a3Var);
            a3Var.X.c(e10, "Error returning bundle value to wrapper");
        }
    }

    public final void K(com.google.android.gms.internal.measurement.k0 k0Var, byte[] bArr) {
        Bundle bundle = new Bundle();
        bundle.putByteArray("r", bArr);
        try {
            k0Var.r(bundle);
        } catch (RemoteException e10) {
            a3 a3Var = ((u3) this.f8832a).X;
            u3.k(a3Var);
            a3Var.X.c(e10, "Error returning byte array to wrapper");
        }
    }

    public final void L(com.google.android.gms.internal.measurement.k0 k0Var, int i3) {
        Bundle bundle = new Bundle();
        bundle.putInt("r", i3);
        try {
            k0Var.r(bundle);
        } catch (RemoteException e10) {
            a3 a3Var = ((u3) this.f8832a).X;
            u3.k(a3Var);
            a3Var.X.c(e10, "Error returning int value to wrapper");
        }
    }

    public final void M(com.google.android.gms.internal.measurement.k0 k0Var, long j10) {
        Bundle bundle = new Bundle();
        bundle.putLong("r", j10);
        try {
            k0Var.r(bundle);
        } catch (RemoteException e10) {
            a3 a3Var = ((u3) this.f8832a).X;
            u3.k(a3Var);
            a3Var.X.c(e10, "Error returning long value to wrapper");
        }
    }

    public final void N(String str, com.google.android.gms.internal.measurement.k0 k0Var) {
        Bundle bundle = new Bundle();
        bundle.putString("r", str);
        try {
            k0Var.r(bundle);
        } catch (RemoteException e10) {
            a3 a3Var = ((u3) this.f8832a).X;
            u3.k(a3Var);
            a3Var.X.c(e10, "Error returning string value to wrapper");
        }
    }

    public final void O(String str, String str2, Bundle bundle, List list, boolean z8) {
        int i3;
        Iterator it;
        int i10;
        String str3;
        int i11;
        int R;
        String str4;
        String str5;
        if (bundle == null) {
            return;
        }
        u3 u3Var = (u3) this.f8832a;
        e eVar = u3Var.f7117p;
        ((r8) q8.f4518b.f4519a.a()).getClass();
        String str6 = null;
        if (((u3) eVar.f8832a).f7117p.v(null, r2.f7004s0)) {
            w5 w5Var = ((u3) eVar.f8832a).f7104e0;
            u3.i(w5Var);
            if (w5Var.b0(231100000)) {
                i3 = 35;
                it = new TreeSet(bundle.keySet()).iterator();
                int i12 = 0;
                while (it.hasNext()) {
                    String str7 = (String) it.next();
                    if (list != null && list.contains(str7)) {
                        i10 = 0;
                    } else {
                        if (!z8) {
                            i10 = o0(str7);
                        } else {
                            i10 = 0;
                        }
                        if (i10 == 0) {
                            i10 = n0(str7);
                        }
                    }
                    if (i10 != 0) {
                        if (i10 == 3) {
                            str5 = str7;
                        } else {
                            str5 = str6;
                        }
                        A(bundle, i10, str7, str5);
                        bundle.remove(str7);
                        str4 = str6;
                        i11 = i3;
                    } else {
                        if (Z(bundle.get(str7))) {
                            a3 a3Var = u3Var.X;
                            u3.k(a3Var);
                            a3Var.Z.e("Nested Bundle parameters are not allowed; discarded. event name, param name, child param name", str, str2, str7);
                            R = 22;
                            str3 = str7;
                            i11 = i3;
                        } else {
                            str3 = str7;
                            i11 = i3;
                            R = R(str, str7, bundle.get(str7), bundle, list, z8, false);
                        }
                        if (R != 0 && !"_ev".equals(str3)) {
                            A(bundle, R, str3, bundle.get(str3));
                            bundle.remove(str3);
                        } else if (d0(str3) && !k0(str3, b6.w4.f2936d)) {
                            int i13 = i12 + 1;
                            int i14 = 23;
                            if (!b0(231100000)) {
                                a3 a3Var2 = u3Var.X;
                                u3.k(a3Var2);
                                a3Var2.f6629s.d(u3Var.f7105f0.d(str), u3Var.f7105f0.b(bundle), "Item array not supported on client's version of Google Play Services (Android Only)");
                                h0(23, bundle);
                                bundle.remove(str3);
                            } else if (i13 > i11) {
                                ((r8) q8.f4518b.f4519a.a()).getClass();
                                str4 = null;
                                if (u3Var.f7117p.v(null, r2.f7004s0)) {
                                    a3 a3Var3 = u3Var.X;
                                    u3.k(a3Var3);
                                    a3Var3.f6629s.d(u3Var.f7105f0.d(str), u3Var.f7105f0.b(bundle), "Item can't contain more than " + i11 + " item-scoped custom params");
                                    i14 = 28;
                                } else {
                                    a3 a3Var4 = u3Var.X;
                                    u3.k(a3Var4);
                                    a3Var4.f6629s.d(u3Var.f7105f0.d(str), u3Var.f7105f0.b(bundle), "Item cannot contain custom parameters");
                                }
                                h0(i14, bundle);
                                bundle.remove(str3);
                                i12 = i13;
                            }
                            str4 = null;
                            i12 = i13;
                        }
                        str4 = null;
                    }
                    i3 = i11;
                    str6 = str4;
                }
            }
        }
        i3 = 0;
        it = new TreeSet(bundle.keySet()).iterator();
        int i122 = 0;
        while (it.hasNext()) {
        }
    }

    public final boolean P(String str, String str2) {
        boolean isEmpty = TextUtils.isEmpty(str);
        Object obj = this.f8832a;
        if (!isEmpty) {
            com.bumptech.glide.c.h(str);
            if (!str.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
                u3 u3Var = (u3) obj;
                if (TextUtils.isEmpty(u3Var.f7101b)) {
                    a3 a3Var = u3Var.X;
                    u3.k(a3Var);
                    a3Var.f6629s.c(a3.w(str), "Invalid google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI. provided id");
                }
                return false;
            }
            return true;
        } else if (!TextUtils.isEmpty(str2)) {
            com.bumptech.glide.c.h(str2);
            if (!str2.matches("^(1:\\d+:android:[a-f0-9]+|ca-app-pub-.*)$")) {
                a3 a3Var2 = ((u3) obj).X;
                u3.k(a3Var2);
                a3Var2.f6629s.c(a3.w(str2), "Invalid admob_app_id. Analytics disabled.");
                return false;
            }
            return true;
        } else {
            u3 u3Var2 = (u3) obj;
            if (TextUtils.isEmpty(u3Var2.f7101b)) {
                a3 a3Var3 = u3Var2.X;
                u3.k(a3Var3);
                a3Var3.f6629s.b("Missing google_app_id. Firebase Analytics disabled. See https://goo.gl/NAOOOI");
            }
            return false;
        }
    }

    public final boolean Q(int i3, String str, String str2) {
        Object obj = this.f8832a;
        if (str2 == null) {
            a3 a3Var = ((u3) obj).X;
            u3.k(a3Var);
            a3Var.f6629s.c(str, "Name is required and can't be null. Type");
            return false;
        } else if (str2.codePointCount(0, str2.length()) > i3) {
            a3 a3Var2 = ((u3) obj).X;
            u3.k(a3Var2);
            a3Var2.f6629s.e("Name is too long. Type, maximum supported length, name", str, Integer.valueOf(i3), str2);
            return false;
        } else {
            return true;
        }
    }

    public final int R(String str, String str2, Object obj, Bundle bundle, List list, boolean z8, boolean z10) {
        int i3;
        int i10;
        a3 a3Var;
        Class<?> cls;
        String str3;
        Parcelable[] parcelableArr;
        int size;
        n();
        boolean Z = Z(obj);
        Object obj2 = this.f8832a;
        if (Z) {
            if (z10) {
                if (!k0(str2, b6.w4.f2935c)) {
                    return 20;
                }
                u3 u3Var = (u3) obj2;
                e5 t10 = u3Var.t();
                t10.n();
                t10.o();
                if (t10.v()) {
                    w5 w5Var = ((u3) t10.f8832a).f7104e0;
                    u3.i(w5Var);
                    if (w5Var.q0() < 200900) {
                        return 25;
                    }
                }
                u3Var.getClass();
                boolean z11 = obj instanceof Parcelable[];
                if (z11) {
                    size = ((Parcelable[]) obj).length;
                } else if (obj instanceof ArrayList) {
                    size = ((ArrayList) obj).size();
                }
                if (size > 200) {
                    a3 a3Var2 = u3Var.X;
                    u3.k(a3Var2);
                    a3Var2.Z.e("Parameter array is too long; discarded. Value kind, name, array length", "param", str2, Integer.valueOf(size));
                    u3Var.getClass();
                    if (z11) {
                        Parcelable[] parcelableArr2 = (Parcelable[]) obj;
                        if (parcelableArr2.length > 200) {
                            bundle.putParcelableArray(str2, (Parcelable[]) Arrays.copyOf(parcelableArr2, 200));
                        }
                    } else if (obj instanceof ArrayList) {
                        ArrayList arrayList = (ArrayList) obj;
                        if (arrayList.size() > 200) {
                            bundle.putParcelableArrayList(str2, new ArrayList<>(arrayList.subList(0, 200)));
                        }
                    }
                    i3 = 17;
                    if (c0(str) && !c0(str2)) {
                        ((u3) obj2).getClass();
                        i10 = 100;
                    } else {
                        ((u3) obj2).getClass();
                        i10 = 256;
                    }
                    if (!U("param", str2, i10, obj)) {
                        return i3;
                    }
                    if (z10) {
                        if (obj instanceof Bundle) {
                            O(str, str2, (Bundle) obj, list, z8);
                        } else if (obj instanceof Parcelable[]) {
                            for (Parcelable parcelable : (Parcelable[]) obj) {
                                if (!(parcelable instanceof Bundle)) {
                                    a3Var = ((u3) obj2).X;
                                    u3.k(a3Var);
                                    cls = parcelable.getClass();
                                    str3 = "All Parcelable[] elements must be of type Bundle. Value type, name";
                                    a3Var.Z.d(cls, str2, str3);
                                    return 4;
                                }
                                O(str, str2, (Bundle) parcelable, list, z8);
                            }
                        } else if (obj instanceof ArrayList) {
                            ArrayList arrayList2 = (ArrayList) obj;
                            int size2 = arrayList2.size();
                            for (int i11 = 0; i11 < size2; i11++) {
                                Object obj3 = arrayList2.get(i11);
                                if (!(obj3 instanceof Bundle)) {
                                    a3Var = ((u3) obj2).X;
                                    u3.k(a3Var);
                                    if (obj3 != null) {
                                        cls = obj3.getClass();
                                    } else {
                                        cls = "null";
                                    }
                                    str3 = "All ArrayList elements must be of type Bundle. Value type, name";
                                    a3Var.Z.d(cls, str2, str3);
                                    return 4;
                                }
                                O(str, str2, (Bundle) obj3, list, z8);
                            }
                        } else {
                            return 4;
                        }
                        return i3;
                    }
                    return 4;
                }
            } else {
                return 21;
            }
        }
        i3 = 0;
        if (c0(str)) {
        }
        ((u3) obj2).getClass();
        i10 = 256;
        if (!U("param", str2, i10, obj)) {
        }
    }

    public final void S() {
        n();
        SecureRandom secureRandom = new SecureRandom();
        long nextLong = secureRandom.nextLong();
        if (nextLong == 0) {
            nextLong = secureRandom.nextLong();
            if (nextLong == 0) {
                a3 a3Var = ((u3) this.f8832a).X;
                u3.k(a3Var);
                a3Var.X.b("Utils falling back to Random for random id");
            }
        }
        this.f7173d.set(nextLong);
    }

    public final boolean T(String str, String[] strArr, String[] strArr2, String str2) {
        Object obj = this.f8832a;
        if (str2 == null) {
            a3 a3Var = ((u3) obj).X;
            u3.k(a3Var);
            a3Var.f6629s.c(str, "Name is required and can't be null. Type");
            return false;
        }
        String[] strArr3 = f7170p;
        for (int i3 = 0; i3 < 3; i3++) {
            if (str2.startsWith(strArr3[i3])) {
                a3 a3Var2 = ((u3) obj).X;
                u3.k(a3Var2);
                a3Var2.f6629s.d(str, str2, "Name starts with reserved prefix. Type, name");
                return false;
            }
        }
        if (strArr != null && k0(str2, strArr)) {
            if (strArr2 == null || !k0(str2, strArr2)) {
                a3 a3Var3 = ((u3) obj).X;
                u3.k(a3Var3);
                a3Var3.f6629s.d(str, str2, "Name is reserved. Type, name");
                return false;
            }
            return true;
        }
        return true;
    }

    public final boolean U(String str, String str2, int i3, Object obj) {
        if (obj != null && !(obj instanceof Long) && !(obj instanceof Float) && !(obj instanceof Integer) && !(obj instanceof Byte) && !(obj instanceof Short) && !(obj instanceof Boolean) && !(obj instanceof Double)) {
            if (!(obj instanceof String) && !(obj instanceof Character) && !(obj instanceof CharSequence)) {
                return false;
            }
            String obj2 = obj.toString();
            if (obj2.codePointCount(0, obj2.length()) > i3) {
                a3 a3Var = ((u3) this.f8832a).X;
                u3.k(a3Var);
                a3Var.Z.e("Value is too long; discarded. Value kind, name, value length", str, str2, Integer.valueOf(obj2.length()));
                return false;
            }
        }
        return true;
    }

    public final boolean V(String str, String str2) {
        Object obj = this.f8832a;
        if (str2 == null) {
            a3 a3Var = ((u3) obj).X;
            u3.k(a3Var);
            a3Var.f6629s.c(str, "Name is required and can't be null. Type");
            return false;
        } else if (str2.length() == 0) {
            a3 a3Var2 = ((u3) obj).X;
            u3.k(a3Var2);
            a3Var2.f6629s.c(str, "Name is required and can't be empty. Type");
            return false;
        } else {
            int codePointAt = str2.codePointAt(0);
            if (!Character.isLetter(codePointAt)) {
                if (codePointAt == 95) {
                    codePointAt = 95;
                } else {
                    a3 a3Var3 = ((u3) obj).X;
                    u3.k(a3Var3);
                    a3Var3.f6629s.d(str, str2, "Name must start with a letter or _ (underscore). Type, name");
                    return false;
                }
            }
            int length = str2.length();
            int charCount = Character.charCount(codePointAt);
            while (charCount < length) {
                int codePointAt2 = str2.codePointAt(charCount);
                if (codePointAt2 != 95 && !Character.isLetterOrDigit(codePointAt2)) {
                    a3 a3Var4 = ((u3) obj).X;
                    u3.k(a3Var4);
                    a3Var4.f6629s.d(str, str2, "Name must consist of letters, digits or _ (underscores). Type, name");
                    return false;
                }
                charCount += Character.charCount(codePointAt2);
            }
            return true;
        }
    }

    public final boolean W(String str, String str2) {
        Object obj = this.f8832a;
        if (str2 == null) {
            a3 a3Var = ((u3) obj).X;
            u3.k(a3Var);
            a3Var.f6629s.c(str, "Name is required and can't be null. Type");
            return false;
        } else if (str2.length() == 0) {
            a3 a3Var2 = ((u3) obj).X;
            u3.k(a3Var2);
            a3Var2.f6629s.c(str, "Name is required and can't be empty. Type");
            return false;
        } else {
            int codePointAt = str2.codePointAt(0);
            if (!Character.isLetter(codePointAt)) {
                a3 a3Var3 = ((u3) obj).X;
                u3.k(a3Var3);
                a3Var3.f6629s.d(str, str2, "Name must start with a letter. Type, name");
                return false;
            }
            int length = str2.length();
            int charCount = Character.charCount(codePointAt);
            while (charCount < length) {
                int codePointAt2 = str2.codePointAt(charCount);
                if (codePointAt2 != 95 && !Character.isLetterOrDigit(codePointAt2)) {
                    a3 a3Var4 = ((u3) obj).X;
                    u3.k(a3Var4);
                    a3Var4.f6629s.d(str, str2, "Name must consist of letters, digits or _ (underscores). Type, name");
                    return false;
                }
                charCount += Character.charCount(codePointAt2);
            }
            return true;
        }
    }

    public final boolean X(String str) {
        n();
        u3 u3Var = (u3) this.f8832a;
        if (q5.b.a(u3Var.f7100a).f13219a.checkCallingOrSelfPermission(str) == 0) {
            return true;
        }
        a3 a3Var = u3Var.X;
        u3.k(a3Var);
        a3Var.f6624f0.c(str, "Permission not granted");
        return false;
    }

    public final boolean Y(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        u3 u3Var = (u3) this.f8832a;
        String o10 = u3Var.f7117p.o("debug.firebase.analytics.app");
        u3Var.getClass();
        return o10.equals(str);
    }

    public final boolean a0(Context context, String str) {
        a3 a3Var;
        String str2;
        Signature[] signatureArr;
        Object obj = this.f8832a;
        X500Principal x500Principal = new X500Principal("CN=Android Debug,O=Android,C=US");
        try {
            PackageInfo b10 = q5.b.a(context).b(64, str);
            if (b10 != null && (signatureArr = b10.signatures) != null && signatureArr.length > 0) {
                return ((X509Certificate) CertificateFactory.getInstance("X.509").generateCertificate(new ByteArrayInputStream(signatureArr[0].toByteArray()))).getSubjectX500Principal().equals(x500Principal);
            }
            return true;
        } catch (PackageManager.NameNotFoundException e10) {
            e = e10;
            a3Var = ((u3) obj).X;
            u3.k(a3Var);
            str2 = "Package name not found";
            a3Var.f6627m.c(e, str2);
            return true;
        } catch (CertificateException e11) {
            e = e11;
            a3Var = ((u3) obj).X;
            u3.k(a3Var);
            str2 = "Error obtaining certificate";
            a3Var.f6627m.c(e, str2);
            return true;
        }
    }

    public final boolean b0(int i3) {
        Boolean bool = ((u3) this.f8832a).t().f6728j;
        if (q0() < i3 / Constants.ONE_SECOND && (bool == null || bool.booleanValue())) {
            return false;
        }
        return true;
    }

    public final int i0(String str) {
        boolean equals = "_ldl".equals(str);
        Object obj = this.f8832a;
        if (equals) {
            ((u3) obj).getClass();
            return 2048;
        } else if ("_id".equals(str)) {
            ((u3) obj).getClass();
            return 256;
        } else {
            boolean equals2 = "_lgclid".equals(str);
            ((u3) obj).getClass();
            return equals2 ? 100 : 36;
        }
    }

    public final Object j0(int i3, Object obj, boolean z8, boolean z10) {
        Parcelable[] parcelableArr;
        if (obj == null) {
            return null;
        }
        if ((obj instanceof Long) || (obj instanceof Double)) {
            return obj;
        }
        if (obj instanceof Integer) {
            return Long.valueOf(((Integer) obj).intValue());
        }
        if (obj instanceof Byte) {
            return Long.valueOf(((Byte) obj).byteValue());
        }
        if (obj instanceof Short) {
            return Long.valueOf(((Short) obj).shortValue());
        }
        if (obj instanceof Boolean) {
            return Long.valueOf(true != ((Boolean) obj).booleanValue() ? 0L : 1L);
        } else if (obj instanceof Float) {
            return Double.valueOf(((Float) obj).doubleValue());
        } else {
            if ((obj instanceof String) || (obj instanceof Character) || (obj instanceof CharSequence)) {
                return u(obj.toString(), i3, z8);
            }
            if (z10 && ((obj instanceof Bundle[]) || (obj instanceof Parcelable[]))) {
                ArrayList arrayList = new ArrayList();
                for (Parcelable parcelable : (Parcelable[]) obj) {
                    if (parcelable instanceof Bundle) {
                        Bundle u0 = u0((Bundle) parcelable);
                        if (!u0.isEmpty()) {
                            arrayList.add(u0);
                        }
                    }
                }
                return arrayList.toArray(new Bundle[arrayList.size()]);
            }
            return null;
        }
    }

    public final int l0(Object obj, String str) {
        int i02;
        String str2;
        if ("_ldl".equals(str)) {
            i02 = i0(str);
            str2 = "user property referrer";
        } else {
            i02 = i0(str);
            str2 = "user property";
        }
        return U(str2, str, i02, obj) ? 0 : 7;
    }

    public final int m0(String str) {
        if (V("event", str)) {
            if (T("event", b6.v4.f2920a, b6.v4.f2921b, str)) {
                ((u3) this.f8832a).getClass();
                return !Q(40, "event", str) ? 2 : 0;
            }
            return 13;
        }
        return 2;
    }

    public final int n0(String str) {
        if (V("event param", str)) {
            if (T("event param", null, null, str)) {
                ((u3) this.f8832a).getClass();
                return !Q(40, "event param", str) ? 3 : 0;
            }
            return 14;
        }
        return 3;
    }

    @Override
    public final boolean o() {
        return true;
    }

    public final int o0(String str) {
        if (W("event param", str)) {
            if (T("event param", null, null, str)) {
                ((u3) this.f8832a).getClass();
                return !Q(40, "event param", str) ? 3 : 0;
            }
            return 14;
        }
        return 3;
    }

    public final int p0(String str) {
        if (V("user property", str)) {
            if (T("user property", b6.x4.f2948a, null, str)) {
                ((u3) this.f8832a).getClass();
                return !Q(24, "user property", str) ? 6 : 0;
            }
            return 15;
        }
        return 6;
    }

    public final int q0() {
        if (this.f7175m == null) {
            i5.e eVar = i5.e.f8264b;
            Context context = ((u3) this.f8832a).f7100a;
            eVar.getClass();
            this.f7175m = Integer.valueOf(i5.e.a(context) / Constants.ONE_SECOND);
        }
        return this.f7175m.intValue();
    }

    public final Object r(Object obj, String str) {
        boolean equals = "_ev".equals(str);
        Object obj2 = this.f8832a;
        if (equals) {
            ((u3) obj2).getClass();
            return j0(256, obj, true, true);
        }
        boolean c02 = c0(str);
        ((u3) obj2).getClass();
        return j0(c02 ? 256 : 100, obj, false, true);
    }

    public final Object s(Object obj, String str) {
        boolean equals = "_ldl".equals(str);
        int i02 = i0(str);
        return equals ? j0(i02, obj, true, false) : j0(i02, obj, false, false);
    }

    public final long s0() {
        long andIncrement;
        long j10;
        if (this.f7173d.get() == 0) {
            synchronized (this.f7173d) {
                long nanoTime = System.nanoTime();
                ((u3) this.f8832a).f7106g0.getClass();
                long nextLong = new Random(nanoTime ^ System.currentTimeMillis()).nextLong();
                int i3 = this.f7174j + 1;
                this.f7174j = i3;
                j10 = nextLong + i3;
            }
            return j10;
        }
        synchronized (this.f7173d) {
            this.f7173d.compareAndSet(-1L, 1L);
            andIncrement = this.f7173d.getAndIncrement();
        }
        return andIncrement;
    }

    public final String t() {
        byte[] bArr = new byte[16];
        w().nextBytes(bArr);
        return String.format(Locale.US, "%032x", new BigInteger(1, bArr));
    }

    public final Bundle t0(boolean z8, Uri uri) {
        String str;
        String str2;
        String str3;
        String str4;
        String str5;
        String str6;
        String str7;
        String str8;
        if (uri == null) {
            return null;
        }
        try {
            if (uri.isHierarchical()) {
                str = uri.getQueryParameter("utm_campaign");
                str2 = uri.getQueryParameter("utm_source");
                str3 = uri.getQueryParameter("utm_medium");
                str4 = uri.getQueryParameter("gclid");
                str5 = uri.getQueryParameter("utm_id");
                str6 = uri.getQueryParameter("dclid");
                str7 = uri.getQueryParameter("srsltid");
                if (z8) {
                    str8 = uri.getQueryParameter("sfmc_id");
                } else {
                    str8 = null;
                }
            } else {
                str = null;
                str2 = null;
                str3 = null;
                str4 = null;
                str5 = null;
                str6 = null;
                str7 = null;
                str8 = null;
            }
            if (TextUtils.isEmpty(str) && TextUtils.isEmpty(str2) && TextUtils.isEmpty(str3) && TextUtils.isEmpty(str4) && TextUtils.isEmpty(str5) && TextUtils.isEmpty(str6) && TextUtils.isEmpty(str7) && (!z8 || TextUtils.isEmpty(str8))) {
                return null;
            }
            Bundle bundle = new Bundle();
            if (!TextUtils.isEmpty(str)) {
                bundle.putString("campaign", str);
            }
            if (!TextUtils.isEmpty(str2)) {
                bundle.putString("source", str2);
            }
            if (!TextUtils.isEmpty(str3)) {
                bundle.putString(Constants.MEDIUM, str3);
            }
            if (!TextUtils.isEmpty(str4)) {
                bundle.putString("gclid", str4);
            }
            String queryParameter = uri.getQueryParameter("utm_term");
            if (!TextUtils.isEmpty(queryParameter)) {
                bundle.putString("term", queryParameter);
            }
            String queryParameter2 = uri.getQueryParameter("utm_content");
            if (!TextUtils.isEmpty(queryParameter2)) {
                bundle.putString("content", queryParameter2);
            }
            String queryParameter3 = uri.getQueryParameter("aclid");
            if (!TextUtils.isEmpty(queryParameter3)) {
                bundle.putString("aclid", queryParameter3);
            }
            String queryParameter4 = uri.getQueryParameter("cp1");
            if (!TextUtils.isEmpty(queryParameter4)) {
                bundle.putString("cp1", queryParameter4);
            }
            String queryParameter5 = uri.getQueryParameter("anid");
            if (!TextUtils.isEmpty(queryParameter5)) {
                bundle.putString("anid", queryParameter5);
            }
            if (!TextUtils.isEmpty(str5)) {
                bundle.putString("campaign_id", str5);
            }
            if (!TextUtils.isEmpty(str6)) {
                bundle.putString("dclid", str6);
            }
            String queryParameter6 = uri.getQueryParameter("utm_source_platform");
            if (!TextUtils.isEmpty(queryParameter6)) {
                bundle.putString("source_platform", queryParameter6);
            }
            String queryParameter7 = uri.getQueryParameter("utm_creative_format");
            if (!TextUtils.isEmpty(queryParameter7)) {
                bundle.putString("creative_format", queryParameter7);
            }
            String queryParameter8 = uri.getQueryParameter("utm_marketing_tactic");
            if (!TextUtils.isEmpty(queryParameter8)) {
                bundle.putString("marketing_tactic", queryParameter8);
            }
            if (!TextUtils.isEmpty(str7)) {
                bundle.putString("srsltid", str7);
            }
            if (z8 && !TextUtils.isEmpty(str8)) {
                bundle.putString("sfmc_id", str8);
            }
            return bundle;
        } catch (UnsupportedOperationException e10) {
            a3 a3Var = ((u3) this.f8832a).X;
            u3.k(a3Var);
            a3Var.X.c(e10, "Install referrer url isn't a hierarchical URI");
            return null;
        }
    }

    public final Bundle u0(Bundle bundle) {
        Bundle bundle2 = new Bundle();
        if (bundle != null) {
            for (String str : bundle.keySet()) {
                Object r10 = r(bundle.get(str), str);
                if (r10 == null) {
                    Object obj = this.f8832a;
                    a3 a3Var = ((u3) obj).X;
                    u3.k(a3Var);
                    a3Var.Z.c(((u3) obj).f7105f0.e(str), "Param value can't be null");
                } else {
                    G(bundle2, str, r10);
                }
            }
        }
        return bundle2;
    }

    public final Bundle v0(String str, Bundle bundle, List list, boolean z8) {
        int i3;
        int i10;
        String str2;
        String str3;
        List list2 = list;
        boolean k02 = k0(str, b6.v4.f2923d);
        if (bundle != null) {
            Bundle bundle2 = new Bundle(bundle);
            u3 u3Var = (u3) this.f8832a;
            w5 w5Var = ((u3) u3Var.f7117p.f8832a).f7104e0;
            u3.i(w5Var);
            if (w5Var.b0(201500000)) {
                i3 = 100;
            } else {
                i3 = 25;
            }
            int i11 = i3;
            Iterator it = new TreeSet(bundle.keySet()).iterator();
            int i12 = 0;
            while (it.hasNext()) {
                String str4 = (String) it.next();
                if (list2 != null && list2.contains(str4)) {
                    i10 = 0;
                } else {
                    if (!z8) {
                        i10 = o0(str4);
                    } else {
                        i10 = 0;
                    }
                    if (i10 == 0) {
                        i10 = n0(str4);
                    }
                }
                if (i10 != 0) {
                    if (i10 == 3) {
                        str3 = str4;
                    } else {
                        str3 = null;
                    }
                    A(bundle2, i10, str4, str3);
                    bundle2.remove(str4);
                } else {
                    int R = R(str, str4, bundle.get(str4), bundle2, list, z8, k02);
                    if (R == 17) {
                        A(bundle2, 17, str4, Boolean.FALSE);
                    } else if (R != 0 && !"_ev".equals(str4)) {
                        if (R == 21) {
                            str2 = str;
                        } else {
                            str2 = str4;
                        }
                        A(bundle2, R, str2, bundle.get(str4));
                        bundle2.remove(str4);
                    }
                    if (d0(str4)) {
                        int i13 = i12 + 1;
                        if (i13 > i11) {
                            String g10 = e0.a0.g("Event can't contain more than ", i11, " params");
                            a3 a3Var = u3Var.X;
                            u3.k(a3Var);
                            a3Var.f6629s.d(u3Var.f7105f0.d(str), u3Var.f7105f0.b(bundle), g10);
                            h0(5, bundle2);
                            bundle2.remove(str4);
                        }
                        i12 = i13;
                    }
                }
                list2 = list;
            }
            return bundle2;
        }
        return null;
    }

    public final SecureRandom w() {
        n();
        if (this.f7172c == null) {
            this.f7172c = new SecureRandom();
        }
        return this.f7172c;
    }

    public final n w0(String str, Bundle bundle, String str2, long j10, boolean z8) {
        Bundle bundle2;
        if (TextUtils.isEmpty(str)) {
            return null;
        }
        if (m0(str) == 0) {
            if (bundle != null) {
                bundle2 = new Bundle(bundle);
            } else {
                bundle2 = new Bundle();
            }
            bundle2.putString("_o", str2);
            Bundle v02 = v0(str, bundle2, Collections.singletonList("_o"), true);
            if (z8) {
                v02 = u0(v02);
            }
            com.bumptech.glide.c.h(v02);
            return new n(str, new m(v02), str2, j10);
        }
        u3 u3Var = (u3) this.f8832a;
        a3 a3Var = u3Var.X;
        u3.k(a3Var);
        a3Var.f6627m.c(u3Var.f7105f0.f(str), "Invalid conditional property event name");
        throw new IllegalArgumentException();
    }

    public final void y(Bundle bundle, long j10) {
        long j11 = bundle.getLong("_et");
        if (j11 != 0) {
            a3 a3Var = ((u3) this.f8832a).X;
            u3.k(a3Var);
            a3Var.X.c(Long.valueOf(j11), "Params already contained engagement");
        } else {
            j11 = 0;
        }
        bundle.putLong("_et", j10 + j11);
    }
}