package defpackage;

import com.google.firebase.remoteconfig.FirebaseRemoteConfigClientException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.concurrent.ScheduledExecutorService;
import org.json.JSONException;
import org.json.JSONObject;

/* renamed from: ᵧⁱᵚ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class RunnableC3695 implements Runnable {

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

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

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

    public RunnableC3695(C0975 c0975, int i, long j) {
        this.f13816 = c0975;
        this.f13815 = i;
        this.f13814 = j;
    }

    @Override // java.lang.Runnable
    public final void run() {
        final C0975 c0975 = this.f13816;
        int i = this.f13815;
        final long j = this.f13814;
        synchronized (c0975) {
            final int i2 = i - 1;
            final C3921 c3921M10447 = ((C4995) c0975.f4341).m10447(3 - i2);
            final C3921 c3921M1831 = ((C0382) c0975.f4346).m1831();
            ʼٴ.ﹶـ(new C3921[]{c3921M10447, c3921M1831}).m8703((ScheduledExecutorService) c0975.f4340, new InterfaceC3610() { // from class: ᵕˈᵷ
                @Override // defpackage.InterfaceC3610
                /* renamed from: ᵝᵵᵺ */
                public final Object mo1888(C3921 c3921) throws JSONException {
                    Boolean boolValueOf;
                    C0975 c09752 = c0975;
                    C3921 c39212 = c3921M10447;
                    C3921 c39213 = c3921M1831;
                    long j2 = j;
                    int i3 = i2;
                    if (!c39212.m8709()) {
                        return ʼٴ.ᵡˎ(new FirebaseRemoteConfigClientException("Failed to auto-fetch config update.", c39212.m8707()));
                    }
                    if (!c39213.m8709()) {
                        return ʼٴ.ᵡˎ(new FirebaseRemoteConfigClientException("Failed to get activated config for auto-fetch", c39213.m8707()));
                    }
                    C0063 c0063 = (C0063) c39212.m8706();
                    C2275 c2275M7745 = (C2275) c39213.m8706();
                    C2275 c2275 = c0063.f1283;
                    if (c2275 != null) {
                        boolValueOf = Boolean.valueOf(c2275.f8893 >= j2);
                    } else {
                        boolValueOf = Boolean.valueOf(c0063.f1282 == 1);
                    }
                    if (!boolValueOf.booleanValue()) {
                        c09752.m3324(j2, i3);
                        return ʼٴ.ˑᵥˁ((Object) null);
                    }
                    if (c0063.f1283 == null) {
                        return ʼٴ.ˑᵥˁ((Object) null);
                    }
                    if (c2275M7745 == null) {
                        c2275M7745 = C2275.m5947().m7745();
                    }
                    C2275 c22752 = c0063.f1283;
                    JSONObject jSONObject = c2275M7745.f8891;
                    JSONObject jSONObject2 = c22752.f8895;
                    JSONObject jSONObject3 = c22752.f8896;
                    JSONObject jSONObject4 = c22752.f8891;
                    JSONObject jSONObject5 = C2275.m5946(new JSONObject(jSONObject2.toString())).f8896;
                    HashMap mapM5948 = c2275M7745.m5948();
                    HashMap mapM59482 = c22752.m5948();
                    HashMap mapM5949 = c2275M7745.m5949();
                    HashMap mapM59492 = c22752.m5949();
                    HashSet hashSet = new HashSet();
                    JSONObject jSONObject6 = c2275M7745.f8896;
                    Iterator<String> itKeys = jSONObject6.keys();
                    while (itKeys.hasNext()) {
                        String next = itKeys.next();
                        if (!jSONObject3.has(next)) {
                            hashSet.add(next);
                        } else if (!jSONObject6.get(next).equals(jSONObject3.get(next))) {
                            hashSet.add(next);
                        } else if ((jSONObject.has(next) && !jSONObject4.has(next)) || (!jSONObject.has(next) && jSONObject4.has(next))) {
                            hashSet.add(next);
                        } else if (jSONObject.has(next) && jSONObject4.has(next) && !jSONObject.getJSONObject(next).toString().equals(jSONObject4.getJSONObject(next).toString())) {
                            hashSet.add(next);
                        } else if (mapM5948.containsKey(next) != mapM59482.containsKey(next)) {
                            hashSet.add(next);
                        } else if (mapM5948.containsKey(next) && mapM59482.containsKey(next) && !((Map) mapM5948.get(next)).equals(mapM59482.get(next))) {
                            hashSet.add(next);
                        } else if (mapM5949.containsKey(next) != mapM59492.containsKey(next)) {
                            hashSet.add(next);
                        } else if (mapM59492.containsKey(next) && mapM5949.containsKey(next) && !((JSONObject) mapM59492.get(next)).toString().equals(((JSONObject) mapM5949.get(next)).toString())) {
                            hashSet.add(next);
                        } else {
                            jSONObject5.remove(next);
                        }
                    }
                    Iterator<String> itKeys2 = jSONObject5.keys();
                    while (itKeys2.hasNext()) {
                        hashSet.add(itKeys2.next());
                    }
                    if (hashSet.isEmpty()) {
                        return ʼٴ.ˑᵥˁ((Object) null);
                    }
                    synchronized (c09752) {
                        Iterator it = ((LinkedHashSet) c09752.f4343).iterator();
                        while (it.hasNext()) {
                            ((C3583) it.next()).getClass();
                        }
                    }
                    return ʼٴ.ˑᵥˁ((Object) null);
                }
            });
        }
    }
}
