package defpackage;

import android.app.Application;
import android.content.Context;
import com.google.firebase.remoteconfig.internal.ConfigFetchHttpClient;
import j$.util.concurrent.ConcurrentHashMap;
import java.util.Collections;
import java.util.HashMap;
import java.util.Random;
import java.util.concurrent.Executor;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.atomic.AtomicReference;

/* JADX INFO: renamed from: ᵠʿʖ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C3133 implements InterfaceC4856 {

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public static final Random f11948 = new Random();

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public static final HashMap f11949 = new HashMap();

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final Context f11950;

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public final String f11951;

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final ScheduledExecutorService f11952;

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public final InterfaceC4093 f11953;

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public final InterfaceC5081 f11955;

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final C1191 f11956;

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public final C0081 f11958;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final HashMap f11954 = new HashMap();

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public final HashMap f11957 = new HashMap();

    public C3133(Context context, ScheduledExecutorService scheduledExecutorService, C1191 c1191, InterfaceC4093 interfaceC4093, C0081 c0081, InterfaceC5081 interfaceC5081) {
        this.f11950 = context;
        this.f11952 = scheduledExecutorService;
        this.f11956 = c1191;
        this.f11953 = interfaceC4093;
        this.f11958 = c0081;
        this.f11955 = interfaceC5081;
        c1191.m3677();
        this.f11951 = c1191.f5073.f16223;
        AtomicReference atomicReference = C5301.f20022;
        Application application = (Application) context.getApplicationContext();
        AtomicReference atomicReference2 = C5301.f20022;
        if (atomicReference2.get() == null) {
            C5301 c5301 = new C5301();
            while (true) {
                if (atomicReference2.compareAndSet(null, c5301)) {
                    ComponentCallbacks2C1363.m3908(application);
                    ComponentCallbacks2C1363.f5638.m3910(c5301);
                    break;
                } else if (atomicReference2.get() != null) {
                    break;
                }
            }
        }
        ᵥˈᵛ.ᵶᵥᵝ(new ᵫᵔˊᵲ(6, this), scheduledExecutorService);
    }

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final synchronized C1053 m7242(C1191 c1191, InterfaceC4093 interfaceC4093, C0081 c0081, Executor executor, C0708 c0708, C0708 c07082, C0708 c07083, C4107 c4107, C3656 c3656, C4331 c4331, ᵥᵵᵶᵩ r24) {
        try {
            if (!this.f11954.containsKey("firebase")) {
                c1191.m3677();
                C1053 c1053 = new C1053(c1191.f5071.equals("[DEFAULT]") ? c0081 : null, executor, c0708, c07082, c07083, c4107, c3656, c4331, m7244(c1191, interfaceC4093, c4107, c07082, this.f11950, c4331), r24);
                c07082.m2560();
                c07083.m2560();
                c0708.m2560();
                this.f11954.put("firebase", c1053);
                f11949.put("firebase", c1053);
            }
        } catch (Throwable th) {
            throw th;
        }
        return (C1053) this.f11954.get("firebase");
    }

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final C0708 m7243(String str) {
        C1516 c1516;
        String strM8234 = AbstractC3653.m8234("frc_", this.f11951, "_firebase_", str, ".json");
        ScheduledExecutorService scheduledExecutorService = this.f11952;
        Context context = this.f11950;
        HashMap map = C1516.f6141;
        synchronized (C1516.class) {
            try {
                HashMap map2 = C1516.f6141;
                if (!map2.containsKey(strM8234)) {
                    map2.put(strM8234, new C1516(context, strM8234));
                }
                c1516 = (C1516) map2.get(strM8234);
            } catch (Throwable th) {
                throw th;
            }
        }
        return C0708.m2559(scheduledExecutorService, c1516);
    }

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public final synchronized ˊˊᵞᵽ m7244(C1191 c1191, InterfaceC4093 interfaceC4093, C4107 c4107, C0708 c0708, Context context, C4331 c4331) {
        return new ˊˊᵞᵽ(c1191, interfaceC4093, c4107, c0708, context, c4331, this.f11952);
    }

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final synchronized C1053 m7245() throws Throwable {
        C3133 c3133;
        C0708 c0708M7243;
        C0708 c0708M72432;
        C0708 c0708M72433;
        C4331 c4331;
        C3656 c3656;
        ᵥᵵᵶᵩ r13;
        try {
            try {
                c0708M7243 = m7243("fetch");
                c0708M72432 = m7243("activate");
                c0708M72433 = m7243("defaults");
                try {
                } catch (Throwable th) {
                    th = th;
                    c3133 = this;
                }
            } catch (Throwable th2) {
                th = th2;
            }
            try {
                boolean z = false;
                c4331 = new C4331(this.f11950.getSharedPreferences("frc_" + this.f11951 + "_firebase_settings", 0));
                c3656 = new C3656(this.f11952, c0708M72432, c0708M72433);
                C1191 c1191 = this.f11956;
                InterfaceC5081 interfaceC5081 = this.f11955;
                c1191.m3677();
                C1709 c1709 = c1191.f5071.equals("[DEFAULT]") ? new C1709(interfaceC5081) : null;
                if (c1709 != null) {
                    c3656.m8247(new C0873(c1709));
                }
                C1709 c17092 = new C1709(15, z);
                c17092.f6833 = c0708M72432;
                c17092.f6832 = c0708M72433;
                ScheduledExecutorService scheduledExecutorService = this.f11952;
                r13 = new ᵥᵵᵶᵩ(26, false);
                r13.ᵯᵷʽ = Collections.newSetFromMap(new ConcurrentHashMap());
                r13.ᵜᵪʾ = c0708M72432;
                r13.ᵔᵖᵹᵫ = c17092;
                r13.ᵨᵼⁱ = scheduledExecutorService;
            } catch (Throwable th3) {
                c3133 = this;
                th = th3;
                throw th;
            }
        } catch (Throwable th4) {
            th = th4;
            c3133 = this;
        }
        return m7242(this.f11956, this.f11953, this.f11958, this.f11952, c0708M7243, c0708M72432, c0708M72433, m7246(c0708M7243, c4331), c3656, c4331, r13);
    }

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final synchronized C4107 m7246(C0708 c0708, C4331 c4331) {
        InterfaceC4093 interfaceC4093;
        InterfaceC5081 c5181;
        ScheduledExecutorService scheduledExecutorService;
        Random random;
        String str;
        C1191 c1191;
        try {
            interfaceC4093 = this.f11953;
            C1191 c11912 = this.f11956;
            c11912.m3677();
            c5181 = c11912.f5071.equals("[DEFAULT]") ? this.f11955 : new C5181(6);
            scheduledExecutorService = this.f11952;
            random = f11948;
            C1191 c11913 = this.f11956;
            c11913.m3677();
            str = c11913.f5073.f16226;
            c1191 = this.f11956;
            c1191.m3677();
        } catch (Throwable th) {
            throw th;
        }
        return new C4107(interfaceC4093, c5181, scheduledExecutorService, random, c0708, new ConfigFetchHttpClient(this.f11950, c1191.f5073.f16223, str, c4331.f16493.getLong("fetch_timeout_in_seconds", 60L), c4331.f16493.getLong("fetch_timeout_in_seconds", 60L)), c4331, this.f11957);
    }
}
