package defpackage;

import android.os.Bundle;
import java.util.Iterator;
import java.util.TreeSet;
import org.json.JSONException;

/* renamed from: ᵠᵞᵕᵦ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class RunnableC3136 implements Runnable {

    /* renamed from: ᵢˇᵭ, reason: contains not printable characters */
    public final /* synthetic */ C1757 f11922;

    /* renamed from: ᵧᵾˀˈ, reason: contains not printable characters */
    public final /* synthetic */ int f11923;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public final /* synthetic */ Bundle f11924;

    public /* synthetic */ RunnableC3136(C1757 c1757, Bundle bundle, int i) {
        this.f11923 = i;
        this.f11924 = bundle;
        this.f11922 = c1757;
    }

    @Override // java.lang.Runnable
    public final void run() throws JSONException {
        int i = this.f11923;
        Bundle bundle = this.f11924;
        C1757 c1757 = this.f11922;
        switch (i) {
            case 0:
                c1757.m6590();
                c1757.m3663();
                String string = bundle.getString("name");
                ᵩʛʽ.ˏˋٴ(string);
                C4205 c4205 = (C4205) ((ᵢˇᵭ) c1757).ᵧᵾˀˈ;
                if (!c4205.m9142()) {
                    C1736 c1736 = c4205.f15715;
                    C4205.m9132(c1736);
                    c1736.f6935.m6038("Conditional property not cleared since app measurement is disabled");
                    break;
                } else {
                    C3861 c3861 = new C3861(0L, null, string, "");
                    try {
                        C4864 c4864 = c4205.f15708;
                        C4205.m9134(c4864);
                        bundle.getString("app_id");
                        c4205.m9136().m1743(new C3122(bundle.getString("app_id"), "", c3861, bundle.getLong("creation_timestamp"), bundle.getBoolean("active"), bundle.getString("trigger_event_name"), null, bundle.getLong("trigger_timeout"), null, bundle.getLong("time_to_live"), c4864.m10227(bundle.getString("expired_event_name"), bundle.getBundle("expired_event_params"), "", bundle.getLong("creation_timestamp"), 0L, true)));
                        break;
                    } catch (IllegalArgumentException unused) {
                        return;
                    }
                }
            default:
                C5246 c5246 = c1757.f7060;
                C4205 c42052 = (C4205) ((ᵢˇᵭ) c1757).ᵧᵾˀˈ;
                if (!bundle.isEmpty()) {
                    C4180 c4180 = c42052.f15717;
                    C4864 c48642 = c42052.f15708;
                    C1904 c1904 = c42052.f15726;
                    C1736 c17362 = c42052.f15715;
                    C4205.m9134(c4180);
                    Bundle bundle2 = new Bundle(c4180.f15630.m1018());
                    for (String str : bundle.keySet()) {
                        Object obj = bundle.get(str);
                        if (obj != null && !(obj instanceof String) && !(obj instanceof Long) && !(obj instanceof Double)) {
                            C4205.m9134(c48642);
                            if (C4864.m10187(obj)) {
                                C4864.m10192(c5246, null, 27, null, null, 0);
                            }
                            C4205.m9132(c17362);
                            c17362.f6940.m6037("Invalid default event parameter type. Name, value", str, obj);
                        } else if (C4864.m10197(str)) {
                            C4205.m9132(c17362);
                            c17362.f6940.m6039(str, "Invalid default event parameter name. Name");
                        } else if (obj == null) {
                            bundle2.remove(str);
                        } else {
                            C4205.m9134(c48642);
                            c1904.getClass();
                            if (c48642.m10235("param", str, 500, obj)) {
                                c48642.m10223(bundle2, str, obj);
                            }
                        }
                    }
                    C4205.m9134(c48642);
                    C4864 c48643 = ((C4205) ((ᵢˇᵭ) c1904).ᵧᵾˀˈ).f15708;
                    C4205.m9134(c48643);
                    int i2 = c48643.m10232(201500000) ? 100 : 25;
                    if (bundle2.size() > i2) {
                        Iterator it = new TreeSet(bundle2.keySet()).iterator();
                        int i3 = 0;
                        while (it.hasNext()) {
                            String str2 = (String) it.next();
                            i3++;
                            if (i3 > i2) {
                                bundle2.remove(str2);
                            }
                        }
                        C4205.m9134(c48642);
                        C4864.m10192(c5246, null, 26, null, null, 0);
                        C4205.m9132(c17362);
                        c17362.f6940.m6038("Too many default event parameters set. Discarding beyond event parameter limit");
                    }
                    bundle = bundle2;
                }
                C4180 c41802 = c42052.f15717;
                C4205.m9134(c41802);
                c41802.f15630.m1017(bundle);
                c42052.m9136().m1741(bundle);
                break;
        }
    }
}
