package g3;

import V2.AbstractC0661f3;
import V2.AbstractC0696m3;
import V2.C0636a3;
import V2.C0706p0;
import V2.C0716s;
import V2.Q2;
import V2.n3;
import V2.u3;
import V2.z3;
import V4.C;
import V4.E;
import V4.N;
import Y4.J;
import Y4.a0;
import Y4.c0;
import android.content.Context;
import androidx.media3.extractor.text.ttml.TtmlNode;
import com.debridstream.tv.PlayerViewModel;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import i3.I;
import j$.time.Instant;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.atomic.AtomicBoolean;
import m3.AbstractC2467b;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import s2.SharedPreferencesC2907b;
import w4.C3137A;
import x4.AbstractC3229F;
import x4.AbstractC3251q;
import x4.AbstractC3257w;

/* JADX INFO: loaded from: classes.dex */
public final class t extends C4.j implements J4.e {

    /* JADX INFO: renamed from: A, reason: collision with root package name */
    public final /* synthetic */ AtomicBoolean f16557A;

    /* JADX INFO: renamed from: B, reason: collision with root package name */
    public final /* synthetic */ Integer f16558B;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public Object f16559a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public String f16560b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public Object f16561c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public Object f16562d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public Object f16563e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public String f16564f;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public double f16565j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public int f16566k;
    public int l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    public int f16567m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    public int f16568n;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    public int f16569o;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    public boolean f16570p;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    public int f16571q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    public /* synthetic */ Object f16572r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    public final /* synthetic */ n f16573s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    public final /* synthetic */ double f16574t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    public final /* synthetic */ double f16575u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    public final /* synthetic */ Integer f16576v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    public final /* synthetic */ Integer f16577w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    public final /* synthetic */ Context f16578x;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    public final /* synthetic */ PlayerViewModel f16579y;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public final /* synthetic */ boolean f16580z;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public t(n nVar, double d6, double d7, Integer num, Integer num2, Context context, PlayerViewModel playerViewModel, boolean z6, AtomicBoolean atomicBoolean, Integer num3, A4.d dVar) {
        super(2, dVar);
        this.f16573s = nVar;
        this.f16574t = d6;
        this.f16575u = d7;
        this.f16576v = num;
        this.f16577w = num2;
        this.f16578x = context;
        this.f16579y = playerViewModel;
        this.f16580z = z6;
        this.f16557A = atomicBoolean;
        this.f16558B = num3;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        t tVar = new t(this.f16573s, this.f16574t, this.f16575u, this.f16576v, this.f16577w, this.f16578x, this.f16579y, this.f16580z, this.f16557A, this.f16558B, dVar);
        tVar.f16572r = obj;
        return tVar;
    }

    @Override // J4.e
    public final Object invoke(Object obj, Object obj2) {
        return ((t) create((C) obj, (A4.d) obj2)).invokeSuspend(C3137A.f25453a);
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:103:0x029d  */
    /* JADX WARN: Removed duplicated region for block: B:106:0x02b2  */
    /* JADX WARN: Removed duplicated region for block: B:108:0x02dc  */
    /* JADX WARN: Removed duplicated region for block: B:119:0x031c  */
    /* JADX WARN: Removed duplicated region for block: B:122:0x0323  */
    /* JADX WARN: Removed duplicated region for block: B:127:0x033f  */
    /* JADX WARN: Removed duplicated region for block: B:129:0x0342 A[ADDED_TO_REGION] */
    /* JADX WARN: Removed duplicated region for block: B:133:0x0351  */
    /* JADX WARN: Removed duplicated region for block: B:139:0x0374  */
    /* JADX WARN: Removed duplicated region for block: B:232:0x0585  */
    /* JADX WARN: Removed duplicated region for block: B:235:0x05ab  */
    /* JADX WARN: Removed duplicated region for block: B:284:0x0633  */
    /* JADX WARN: Removed duplicated region for block: B:292:0x0648  */
    /* JADX WARN: Removed duplicated region for block: B:295:0x065e  */
    /* JADX WARN: Removed duplicated region for block: B:300:0x067c  */
    /* JADX WARN: Removed duplicated region for block: B:302:0x068c  */
    /* JADX WARN: Removed duplicated region for block: B:322:0x074a  */
    /* JADX WARN: Removed duplicated region for block: B:332:0x078b  */
    /* JADX WARN: Removed duplicated region for block: B:339:0x07d9  */
    /* JADX WARN: Removed duplicated region for block: B:378:0x097a  */
    /* JADX WARN: Removed duplicated region for block: B:392:0x0a01  */
    /* JADX WARN: Removed duplicated region for block: B:398:0x0a17  */
    /* JADX WARN: Removed duplicated region for block: B:41:0x01d5  */
    /* JADX WARN: Removed duplicated region for block: B:44:0x01db  */
    /* JADX WARN: Removed duplicated region for block: B:465:0x0b51  */
    /* JADX WARN: Removed duplicated region for block: B:469:0x0b6e  */
    /* JADX WARN: Removed duplicated region for block: B:50:0x01ea  */
    /* JADX WARN: Removed duplicated region for block: B:53:0x01f4  */
    /* JADX WARN: Removed duplicated region for block: B:54:0x01f7  */
    /* JADX WARN: Removed duplicated region for block: B:569:? A[RETURN, SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:57:0x0206  */
    /* JADX WARN: Removed duplicated region for block: B:66:0x021c  */
    /* JADX WARN: Removed duplicated region for block: B:86:0x026e  */
    /* JADX WARN: Removed duplicated region for block: B:87:0x0278  */
    /* JADX WARN: Removed duplicated region for block: B:89:0x027c  */
    /* JADX WARN: Removed duplicated region for block: B:92:0x0285  */
    /* JADX WARN: Type inference failed for: r1v101 */
    /* JADX WARN: Type inference failed for: r1v103, types: [boolean] */
    /* JADX WARN: Type inference failed for: r1v107 */
    /* JADX WARN: Type inference failed for: r1v57 */
    /* JADX WARN: Type inference failed for: r1v96 */
    /* JADX WARN: Type inference failed for: r39v13 */
    /* JADX WARN: Type inference failed for: r39v14 */
    /* JADX WARN: Type inference failed for: r39v15 */
    /* JADX WARN: Type inference failed for: r39v3 */
    /* JADX WARN: Type inference failed for: r39v5 */
    /* JADX WARN: Type inference failed for: r39v6 */
    /* JADX WARN: Type inference failed for: r4v0, types: [int, java.lang.Object] */
    @Override // C4.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) throws JSONException {
        C3137A c3137a;
        String str;
        String str2;
        String str3;
        String lowerCase;
        B4.a aVar;
        int iIntValue;
        Integer num;
        int iIntValue2;
        String str4;
        boolean zEquals;
        int i6;
        String str5;
        String str6;
        n nVar;
        y wVar;
        int i7;
        boolean z6;
        int i8;
        boolean z7;
        String str7;
        boolean z8;
        JSONObject jSONObjectX;
        n nVar2;
        String strA;
        boolean z9;
        String str8;
        Object obj2;
        String str9;
        String str10;
        String str11;
        String str12;
        String str13;
        String str14;
        String str15;
        JSONObject jSONObject;
        double d6;
        C c6;
        boolean z10;
        int i9;
        String str16;
        int i10;
        String str17;
        y yVar;
        y yVar2;
        double d7;
        B4.a aVar2;
        JSONObject jSONObject2;
        int i11;
        n nVar3;
        C c7;
        int i12;
        JSONArray jSONArrayOptJSONArray;
        l lVar;
        ?? r39;
        double d8;
        String str18;
        int i13;
        int i14;
        String str19;
        String str20;
        String str21;
        String str22;
        String str23;
        double d9;
        int i15;
        String profileKey;
        int i16;
        y yVar3;
        boolean z11;
        int i17;
        int i18;
        JSONObject item;
        String str24;
        String str25;
        int i19;
        String str26;
        String str27;
        boolean z12;
        int i20;
        double d10;
        q qVar;
        String str28;
        String str29;
        String str30;
        String str31;
        int i21;
        JSONObject jSONObject3;
        Object objB;
        double d11;
        int i22;
        boolean z13;
        int i23;
        int i24;
        n nVar4;
        String str32;
        String str33;
        String str34;
        String string;
        String string2;
        a0 uiState;
        ?? r392;
        int i25;
        int i26;
        boolean z14;
        B4.a aVar3;
        double d12;
        C c8;
        int i27;
        y yVar4;
        n nVar5;
        String str35;
        String str36;
        String str37;
        int i28;
        String str38;
        int i29;
        Object obj3;
        String str39;
        int i30;
        B4.a aVar4;
        y yVar5;
        int i31;
        String str40;
        int i32;
        boolean z15;
        String str41;
        int i33;
        String str42;
        ?? BooleanValue;
        String str43;
        Integer num2;
        Integer num3;
        Long l;
        int i34;
        Object objH;
        int i35;
        String str44;
        String str45;
        String str46;
        int i36;
        String str47;
        C c9;
        String str48;
        String str49;
        B4.a aVar5 = B4.a.f492a;
        ?? r42 = this.f16571q;
        C3137A c3137a2 = C3137A.f25453a;
        String str50 = "main";
        String str51 = "localStreamUrl";
        try {
            try {
            } catch (Exception unused) {
                return r42;
            }
        } catch (Exception unused2) {
        }
        switch (r42) {
            case 0:
                c3137a = c3137a2;
                str = "localImdbId";
                str2 = "getApplicationContext(...)";
                AbstractC2467b.l(obj);
                C c10 = (C) this.f16572r;
                n nVar6 = this.f16573s;
                if (nVar6 == null || nVar6.f16513a <= 0) {
                    return c3137a;
                }
                String str52 = "localLinkHash";
                double d13 = this.f16574t;
                if (d13 < 60.0d) {
                    return c3137a;
                }
                double d14 = this.f16575u;
                if (d14 <= 0.0d) {
                    return c3137a;
                }
                double d15 = (d13 / d14) * 100.0d;
                String string3 = S4.p.o1(nVar6.f16514b).toString();
                str3 = "imdbId";
                Locale locale = Locale.ROOT;
                lowerCase = string3.toLowerCase(locale);
                kotlin.jvm.internal.o.g(lowerCase, "toLowerCase(...)");
                if (S4.p.Q0(lowerCase)) {
                    lowerCase = "movie";
                }
                aVar = aVar5;
                String strC = m.c(nVar6.f16513a, lowerCase);
                if (strC == null) {
                    return c3137a;
                }
                Integer num4 = this.f16576v;
                if (num4 == null) {
                    iIntValue = 1;
                    num = this.f16577w;
                    if (num == null) {
                        iIntValue2 = 1;
                        str4 = strC;
                        int i37 = d15 < 80.0d ? 1 : 0;
                        zEquals = lowerCase.equals("tv");
                        i6 = i37;
                        v vVar = v.f16584a;
                        x xVar = x.f16587a;
                        if (zEquals) {
                            str5 = "localStreamUrl";
                        } else {
                            str5 = "localStreamUrl";
                            Map map = nVar6.f16526o;
                            if (d15 >= 80.0d) {
                                if (map == null) {
                                    str6 = "type";
                                    nVar = nVar6;
                                    wVar = vVar;
                                } else {
                                    if (map.isEmpty()) {
                                        map = null;
                                    }
                                    if (map != null) {
                                        if (iIntValue <= 0 || iIntValue2 <= 0) {
                                            str6 = "type";
                                            nVar = nVar6;
                                        } else {
                                            nVar = nVar6;
                                            Integer num5 = (Integer) map.get(Integer.valueOf(iIntValue));
                                            if (num5 != null) {
                                                boolean z16 = iIntValue2 == num5.intValue();
                                                int i38 = iIntValue + 1;
                                                str6 = "type";
                                                boolean zContainsKey = map.containsKey(Integer.valueOf(i38));
                                                if (z16 && zContainsKey) {
                                                    lVar = new l(i38, 1);
                                                } else if (!z16) {
                                                    lVar = new l(iIntValue, iIntValue2 + 1);
                                                }
                                                wVar = lVar == null ? new w(lVar.f16509a, lVar.f16510b) : xVar;
                                            } else {
                                                str6 = "type";
                                            }
                                        }
                                        lVar = null;
                                        if (lVar == null) {
                                        }
                                    }
                                }
                            }
                            if (i6 == 0) {
                                i7 = 0;
                                J j4 = u3.f8112c;
                                boolean z17 = ((n3) ((c0) j4.f8871a).getValue()).f7972b.f7759c;
                                z6 = wVar instanceof w;
                                if (z6) {
                                    z7 = z6;
                                    w wVar2 = (w) wVar;
                                    z8 = z17;
                                    i8 = i7;
                                    jSONObjectX = W.a.X(nVar, 0.0d, 0.0d, new Integer(wVar2.f16585a), new Integer(wVar2.f16586b), true);
                                    str7 = "optString(...)";
                                } else {
                                    i8 = i7;
                                    z7 = z6;
                                    str7 = "optString(...)";
                                    z8 = z17;
                                    jSONObjectX = W.a.X(nVar, this.f16574t, this.f16575u, lowerCase.equals("tv") ? new Integer(iIntValue) : null, lowerCase.equals("tv") ? new Integer(iIntValue2) : null, false);
                                }
                                nVar2 = nVar;
                                c0 c0Var = z3.f8212a;
                                strA = z3.a(this.f16578x);
                                if (strA == null) {
                                    strA = "main";
                                }
                                if (strA.equals("main") && ((n3) ((c0) j4.f8871a).getValue()).f7972b.f7757a) {
                                    C0716s c0716s = C0716s.f8049a;
                                    if (C0716s.j(this.f16578x)) {
                                        z9 = true;
                                    }
                                    if (i6 == 0) {
                                        str8 = str7;
                                        obj2 = "tv";
                                        if (i8 != 0) {
                                        }
                                    }
                                } else {
                                    z9 = false;
                                    if (i6 == 0 || z9) {
                                        str8 = str7;
                                        obj2 = "tv";
                                        if (i8 != 0) {
                                            int i39 = nVar2.f16513a;
                                            String lowerCase2 = S4.p.o1(lowerCase).toString().toLowerCase(locale);
                                            kotlin.jvm.internal.o.g(lowerCase2, "toLowerCase(...)");
                                            if (S4.p.Q0(lowerCase2)) {
                                                lowerCase2 = "movie";
                                            }
                                            c0 c0Var2 = C0706p0.f7996a;
                                            Iterator it = C0706p0.b(strA).iterator();
                                            while (true) {
                                                if (it.hasNext()) {
                                                    JSONObject jSONObject4 = (JSONObject) it.next();
                                                    Iterator it2 = it;
                                                    str9 = str50;
                                                    if (jSONObject4.optInt("tmdbId", 0) == i39) {
                                                        str13 = str8;
                                                        int i40 = i39;
                                                        String lowerCase3 = A0.a.p(jSONObject4, str6, "movie", str13).toLowerCase(Locale.ROOT);
                                                        kotlin.jvm.internal.o.g(lowerCase3, "toLowerCase(...)");
                                                        if (S4.p.Q0(lowerCase3)) {
                                                            lowerCase3 = "movie";
                                                        }
                                                        if (lowerCase3.equals(lowerCase2)) {
                                                            String strB = m.b(jSONObjectX);
                                                            if (strB == null || S4.p.Q0(strB)) {
                                                                String strB2 = m.b(jSONObject4);
                                                                if (strB2 == null) {
                                                                    strB2 = m.a(jSONObject4);
                                                                }
                                                                if (strB2 != null) {
                                                                    String strA2 = u.a(strB2, false);
                                                                    if (!S4.p.Q0(strA2)) {
                                                                        strB2 = strA2;
                                                                    }
                                                                    jSONObjectX.put("posterUrl", strB2);
                                                                }
                                                            }
                                                            String strA3 = m.a(jSONObjectX);
                                                            if (strA3 == null || S4.p.Q0(strA3)) {
                                                                String strA4 = m.a(jSONObject4);
                                                                if (strA4 == null) {
                                                                    strA4 = m.b(jSONObject4);
                                                                }
                                                                if (strA4 != null) {
                                                                    String strA5 = u.a(strA4, true);
                                                                    if (!S4.p.Q0(strA5)) {
                                                                        strA4 = strA5;
                                                                    }
                                                                    jSONObjectX.put("backdropUrl", strA4);
                                                                }
                                                            }
                                                            if (jSONObjectX.optBoolean("upNextEpisode", false)) {
                                                                str10 = "tmdbId";
                                                                str12 = str52;
                                                                str51 = str5;
                                                                str14 = "movie";
                                                                str15 = "localDebridProvider";
                                                            } else {
                                                                str51 = str5;
                                                                String strOptString = jSONObject4.optString(str51);
                                                                kotlin.jvm.internal.o.e(strOptString);
                                                                if (S4.p.Q0(strOptString)) {
                                                                    strOptString = null;
                                                                }
                                                                String strOptString2 = jSONObjectX.optString(str51);
                                                                kotlin.jvm.internal.o.g(strOptString2, str13);
                                                                if (S4.p.Q0(strOptString2) && strOptString != null) {
                                                                    jSONObjectX.put(str51, strOptString);
                                                                }
                                                                str12 = str52;
                                                                String strOptString3 = jSONObject4.optString(str12);
                                                                kotlin.jvm.internal.o.e(strOptString3);
                                                                if (S4.p.Q0(strOptString3)) {
                                                                    strOptString3 = null;
                                                                }
                                                                str14 = "movie";
                                                                String strOptString4 = jSONObjectX.optString(str12);
                                                                kotlin.jvm.internal.o.g(strOptString4, str13);
                                                                if (S4.p.Q0(strOptString4) && strOptString3 != null) {
                                                                    jSONObjectX.put(str12, strOptString3);
                                                                }
                                                                str15 = "localDebridProvider";
                                                                String strOptString5 = jSONObject4.optString(str15);
                                                                kotlin.jvm.internal.o.e(strOptString5);
                                                                if (S4.p.Q0(strOptString5)) {
                                                                    strOptString5 = null;
                                                                }
                                                                str10 = "tmdbId";
                                                                String strOptString6 = jSONObjectX.optString(str15);
                                                                kotlin.jvm.internal.o.g(strOptString6, str13);
                                                                if (S4.p.Q0(strOptString6) && strOptString5 != null) {
                                                                    jSONObjectX.put(str15, strOptString5);
                                                                }
                                                            }
                                                            JSONArray jSONArrayOptJSONArray2 = jSONObjectX.optJSONArray("originCountries");
                                                            if ((jSONArrayOptJSONArray2 != null ? jSONArrayOptJSONArray2.length() : 0) > 0 || (jSONArrayOptJSONArray = jSONObject4.optJSONArray("originCountries")) == null || jSONArrayOptJSONArray.length() <= 0) {
                                                                str11 = "toLowerCase(...)";
                                                            } else {
                                                                str11 = "toLowerCase(...)";
                                                                jSONObjectX.put("originCountries", new JSONArray(jSONArrayOptJSONArray.toString()));
                                                            }
                                                            String strOptString7 = jSONObjectX.optString("originalLanguage", "");
                                                            kotlin.jvm.internal.o.g(strOptString7, str13);
                                                            if (S4.p.Q0(strOptString7)) {
                                                                String strP = A0.a.p(jSONObject4, "originalLanguage", "", str13);
                                                                if (strP.length() > 0) {
                                                                    jSONObjectX.put("originalLanguage", strP);
                                                                }
                                                            }
                                                        } else {
                                                            i39 = i40;
                                                            str52 = str52;
                                                            str8 = str13;
                                                            it = it2;
                                                            str50 = str9;
                                                        }
                                                    } else {
                                                        str50 = str9;
                                                        str52 = str52;
                                                        it = it2;
                                                    }
                                                } else {
                                                    str9 = str50;
                                                    str10 = "tmdbId";
                                                    str11 = "toLowerCase(...)";
                                                    str12 = str52;
                                                    str13 = str8;
                                                    str51 = str5;
                                                    str14 = "movie";
                                                    str15 = "localDebridProvider";
                                                }
                                            }
                                            int i41 = nVar2.f16513a;
                                            this.f16572r = c10;
                                            this.f16559a = nVar2;
                                            this.f16560b = lowerCase;
                                            this.f16561c = str4;
                                            this.f16562d = wVar;
                                            this.f16563e = jSONObjectX;
                                            this.f16564f = strA;
                                            yVar2 = wVar;
                                            d7 = d15;
                                            this.f16565j = d7;
                                            this.f16566k = iIntValue;
                                            this.l = iIntValue2;
                                            this.f16567m = i6;
                                            this.f16568n = i8;
                                            this.f16570p = z8;
                                            this.f16569o = z7 ? 1 : 0 ? 1 : 0;
                                            this.f16571q = 1;
                                            aVar2 = aVar;
                                            if (C2064f.a(i41, lowerCase, jSONObjectX, this) != aVar2) {
                                                jSONObject2 = jSONObjectX;
                                                i11 = iIntValue2;
                                                nVar3 = nVar2;
                                                c7 = c10;
                                                z10 = z8;
                                                i12 = i8;
                                                r392 = z7;
                                                iIntValue2 = i11;
                                                i9 = i12;
                                                jSONObject = jSONObject2;
                                                nVar2 = nVar3;
                                                aVar = aVar2;
                                                double d16 = d7;
                                                c6 = c7;
                                                d6 = d16;
                                                str17 = strA;
                                                i10 = i6;
                                                yVar = yVar2;
                                                str16 = str4;
                                                r39 = r392;
                                                if (i9 == 0) {
                                                    i14 = iIntValue2;
                                                    PlayerViewModel playerViewModel = this.f16579y;
                                                    Q2 q22 = (playerViewModel == null || (uiState = playerViewModel.getUiState()) == null) ? null : (Q2) uiState.getValue();
                                                    i13 = iIntValue;
                                                    if (q22 == null || (str32 = q22.f7496a) == null || S4.p.Q0(str32)) {
                                                        str32 = null;
                                                    }
                                                    d8 = d6;
                                                    if (q22 == null || (str33 = q22.f7497b) == null || S4.p.Q0(str33)) {
                                                        str33 = null;
                                                    }
                                                    if (q22 == null || (str34 = q22.f7498c) == null || S4.p.Q0(str34)) {
                                                        str34 = null;
                                                    }
                                                    String str53 = ((C0636a3) AbstractC0661f3.f7767d.getValue()).f7682a;
                                                    if (str53 == null || (string2 = S4.p.o1(str53).toString()) == null) {
                                                        str18 = str16;
                                                    } else {
                                                        str18 = str16;
                                                        if (!S4.w.A0(string2, TtmlNode.TAG_TT, true)) {
                                                            string2 = null;
                                                        }
                                                        if (string2 != null) {
                                                            string = string2;
                                                        }
                                                        if (r39 == 0) {
                                                            if (str32 != null) {
                                                                jSONObject.put(str51, str32);
                                                            }
                                                            if (str33 != null) {
                                                                jSONObject.put(str12, str33);
                                                            }
                                                            if (str34 != null) {
                                                                jSONObject.put(str15, str34);
                                                            }
                                                        }
                                                        String str54 = str33;
                                                        str20 = str3;
                                                        if (string == null) {
                                                            String strOptString8 = jSONObject.optString(str20);
                                                            kotlin.jvm.internal.o.g(strOptString8, str13);
                                                            if (S4.p.Q0(strOptString8)) {
                                                                jSONObject.put(str20, string);
                                                                str21 = str;
                                                                jSONObject.put(str21, string);
                                                            } else {
                                                                str21 = str;
                                                            }
                                                            if (r39 == 0) {
                                                                Object obj4 = AbstractC2060b.f16469a;
                                                                String str55 = lowerCase;
                                                                AbstractC2060b.d(str17, str55, str32, str54, nVar2.f16513a, string, str34);
                                                                str22 = str17;
                                                                str19 = str55;
                                                                if (i9 == 0 || !(yVar instanceof w)) {
                                                                    String str56 = str19;
                                                                    str23 = str13;
                                                                    aVar2 = aVar;
                                                                    d9 = d8;
                                                                    i15 = i9;
                                                                    profileKey = str22;
                                                                    i16 = i13;
                                                                    yVar3 = yVar;
                                                                    z11 = z10;
                                                                    i17 = i10;
                                                                    i18 = i14;
                                                                    item = jSONObject;
                                                                    str24 = str18;
                                                                    str25 = str56;
                                                                    i25 = i15;
                                                                    if (i25 != 0) {
                                                                        c0 c0Var3 = C0706p0.f7996a;
                                                                        aVar3 = aVar2;
                                                                        C0706p0.e(nVar2.f16513a, profileKey, str25);
                                                                        int i42 = nVar2.f16513a;
                                                                        z14 = z11;
                                                                        i26 = i25;
                                                                        if (i42 <= 0) {
                                                                            d12 = d9;
                                                                            c8 = c6;
                                                                            i28 = i16;
                                                                            i27 = i17;
                                                                            yVar4 = yVar3;
                                                                            nVar5 = nVar2;
                                                                            str35 = str24;
                                                                            str36 = str25;
                                                                            str38 = str9;
                                                                            i29 = i18;
                                                                        } else {
                                                                            i27 = i17;
                                                                            yVar4 = yVar3;
                                                                            String lowerCase4 = S4.p.o1(str25).toString().toLowerCase(Locale.ROOT);
                                                                            String str57 = str11;
                                                                            kotlin.jvm.internal.o.g(lowerCase4, str57);
                                                                            if (S4.p.Q0(lowerCase4)) {
                                                                                lowerCase4 = str14;
                                                                            }
                                                                            str35 = str24;
                                                                            String str58 = str9;
                                                                            AbstractC2060b.e(i42, str58, lowerCase4);
                                                                            c8 = c6;
                                                                            c0 c0Var4 = C0706p0.f8002g;
                                                                            Iterable iterable = (Iterable) c0Var4.getValue();
                                                                            i29 = i18;
                                                                            ArrayList arrayList = new ArrayList();
                                                                            for (Object obj5 : iterable) {
                                                                                int i43 = i16;
                                                                                n nVar7 = nVar2;
                                                                                JSONObject jSONObject5 = (JSONObject) obj5;
                                                                                double d17 = d9;
                                                                                String str59 = str25;
                                                                                String str60 = str10;
                                                                                if (jSONObject5.optInt(str60, 0) == i42) {
                                                                                    str45 = str14;
                                                                                    str46 = str6;
                                                                                    i36 = i42;
                                                                                    str47 = str23;
                                                                                    str44 = str58;
                                                                                    String lowerCase5 = A0.a.p(jSONObject5, str46, str45, str47).toLowerCase(Locale.ROOT);
                                                                                    kotlin.jvm.internal.o.g(lowerCase5, str57);
                                                                                    if (S4.p.Q0(lowerCase5)) {
                                                                                        lowerCase5 = str45;
                                                                                    }
                                                                                    if (!lowerCase5.equals(lowerCase4)) {
                                                                                    }
                                                                                    str23 = str47;
                                                                                    str6 = str46;
                                                                                    i42 = i36;
                                                                                    str58 = str44;
                                                                                    i16 = i43;
                                                                                    nVar2 = nVar7;
                                                                                    str14 = str45;
                                                                                    str10 = str60;
                                                                                    str25 = str59;
                                                                                    d9 = d17;
                                                                                } else {
                                                                                    str44 = str58;
                                                                                    str45 = str14;
                                                                                    str46 = str6;
                                                                                    i36 = i42;
                                                                                    str47 = str23;
                                                                                }
                                                                                arrayList.add(obj5);
                                                                                str23 = str47;
                                                                                str6 = str46;
                                                                                i42 = i36;
                                                                                str58 = str44;
                                                                                i16 = i43;
                                                                                nVar2 = nVar7;
                                                                                str14 = str45;
                                                                                str10 = str60;
                                                                                str25 = str59;
                                                                                d9 = d17;
                                                                            }
                                                                            d12 = d9;
                                                                            i28 = i16;
                                                                            nVar5 = nVar2;
                                                                            str38 = str58;
                                                                            str36 = str25;
                                                                            c0Var4.k(null, arrayList);
                                                                            JSONArray jSONArray = new JSONArray();
                                                                            Iterator it3 = ((List) C0706p0.f8002g.getValue()).iterator();
                                                                            while (it3.hasNext()) {
                                                                                jSONArray.put(AbstractC2060b.g((JSONObject) it3.next()));
                                                                            }
                                                                            String string4 = jSONArray.toString();
                                                                            Context context = AbstractC0696m3.f7937d0;
                                                                            if (context != null) {
                                                                                context.getSharedPreferences("debridstream_app_progress_cache", 0).edit().putString("trakt_continue_watching_json", string4).apply();
                                                                            }
                                                                        }
                                                                        Context applicationContext = this.f16578x.getApplicationContext();
                                                                        str37 = str2;
                                                                        kotlin.jvm.internal.o.g(applicationContext, str37);
                                                                        w4.p pVar = m.f16511a;
                                                                        Context applicationContext2 = applicationContext.getApplicationContext();
                                                                        kotlin.jvm.internal.o.g(applicationContext2, str37);
                                                                        SharedPreferencesC2907b sharedPreferencesC2907b = (SharedPreferencesC2907b) W.c.D(applicationContext2);
                                                                        String string5 = sharedPreferencesC2907b.getString("continue_watching_sync_time", null);
                                                                        if (string5 == null) {
                                                                            string5 = Instant.now().toString();
                                                                            kotlin.jvm.internal.o.g(string5, "toString(...)");
                                                                        }
                                                                        JSONArray jSONArray2 = new JSONArray();
                                                                        Iterator it4 = ((List) ((c0) C0706p0.f8003h.f8871a).getValue()).iterator();
                                                                        while (it4.hasNext()) {
                                                                            jSONArray2.put(AbstractC2060b.g((JSONObject) it4.next()));
                                                                        }
                                                                        String string6 = jSONArray2.toString();
                                                                        kotlin.jvm.internal.o.g(string6, "toString(...)");
                                                                        sharedPreferencesC2907b.edit().putString("continue_watching_sync_time", string5).putString("continue_watching_payload", string6).apply();
                                                                        Context context2 = AbstractC0696m3.f7937d0;
                                                                        if (context2 != null) {
                                                                            context2.getSharedPreferences("debridstream_app_progress_cache", 0).edit().putString("trakt_continue_watching_json", string6).apply();
                                                                        }
                                                                    } else {
                                                                        i26 = i25;
                                                                        z14 = z11;
                                                                        aVar3 = aVar2;
                                                                        d12 = d9;
                                                                        c8 = c6;
                                                                        i27 = i17;
                                                                        yVar4 = yVar3;
                                                                        nVar5 = nVar2;
                                                                        str35 = str24;
                                                                        str36 = str25;
                                                                        String str61 = str14;
                                                                        str37 = str2;
                                                                        String str62 = str10;
                                                                        String str63 = str11;
                                                                        String str64 = str23;
                                                                        String str65 = str6;
                                                                        i28 = i16;
                                                                        str38 = str9;
                                                                        i29 = i18;
                                                                        c0 c0Var5 = C0706p0.f7996a;
                                                                        kotlin.jvm.internal.o.h(profileKey, "profileKey");
                                                                        kotlin.jvm.internal.o.h(item, "item");
                                                                        int iOptInt = item.optInt(str62, 0);
                                                                        if (iOptInt > 0) {
                                                                            String lowerCase6 = A0.a.p(item, str65, str61, str64).toLowerCase(Locale.ROOT);
                                                                            kotlin.jvm.internal.o.g(lowerCase6, str63);
                                                                            String str66 = S4.p.Q0(lowerCase6) ? str61 : lowerCase6;
                                                                            c0 c0Var6 = C0706p0.f7996a;
                                                                            LinkedHashMap linkedHashMapI = AbstractC3229F.I((Map) c0Var6.getValue());
                                                                            Collection collection = (List) linkedHashMapI.get(profileKey);
                                                                            if (collection == null) {
                                                                                collection = x4.y.f26065a;
                                                                            }
                                                                            ArrayList arrayListE0 = AbstractC3251q.E0(collection);
                                                                            AbstractC3257w.P(new D.C(iOptInt, 3, str66), arrayListE0);
                                                                            arrayListE0.add(0, item);
                                                                            linkedHashMapI.put(profileKey, arrayListE0);
                                                                            c0Var6.k(null, linkedHashMapI);
                                                                            AbstractC0696m3.j(linkedHashMapI);
                                                                        }
                                                                    }
                                                                    if (!this.f16580z) {
                                                                        return c3137a;
                                                                    }
                                                                    if (kotlin.jvm.internal.o.c(profileKey, str38)) {
                                                                        C0716s c0716s2 = C0716s.f8049a;
                                                                        boolean z18 = C0716s.j(this.f16578x);
                                                                        int iV = L4.a.v((int) d12, 0, 100);
                                                                        obj3 = obj2;
                                                                        str39 = str36;
                                                                        boolean zC = kotlin.jvm.internal.o.c(str39, obj3);
                                                                        if (!z18 || S4.p.Q0("cb6c23120401d06808b06c16c78d0e54e1953df0fce43d921280c708619c1b34")) {
                                                                            i30 = i26;
                                                                            aVar4 = aVar3;
                                                                            yVar5 = yVar4;
                                                                            i31 = i28;
                                                                            str40 = str35;
                                                                            i32 = i29;
                                                                        } else {
                                                                            if (i27 != 0 && this.f16557A.get() && z14) {
                                                                                return c3137a;
                                                                            }
                                                                            try {
                                                                                Context applicationContext3 = this.f16578x.getApplicationContext();
                                                                                kotlin.jvm.internal.o.g(applicationContext3, str37);
                                                                                i3.J j6 = new i3.J(applicationContext3);
                                                                                boolean z19 = !zC;
                                                                                int i44 = nVar5.f16513a;
                                                                                if (zC) {
                                                                                    try {
                                                                                        i31 = i28;
                                                                                        try {
                                                                                            num2 = new Integer(i31);
                                                                                        } catch (Exception unused3) {
                                                                                            z15 = z14;
                                                                                            i30 = i26;
                                                                                            aVar4 = aVar3;
                                                                                            yVar5 = yVar4;
                                                                                            str41 = str35;
                                                                                            i33 = i29;
                                                                                            str42 = str41;
                                                                                            i32 = i33;
                                                                                            BooleanValue = 0;
                                                                                            str43 = profileKey;
                                                                                            profileKey = str43;
                                                                                            if (z15) {
                                                                                            }
                                                                                        }
                                                                                    } catch (Exception unused4) {
                                                                                        i31 = i28;
                                                                                    }
                                                                                } else {
                                                                                    i31 = i28;
                                                                                    num2 = null;
                                                                                }
                                                                                if (zC) {
                                                                                    try {
                                                                                        i33 = i29;
                                                                                    } catch (Exception unused5) {
                                                                                        i33 = i29;
                                                                                        z15 = z14;
                                                                                        i30 = i26;
                                                                                        aVar4 = aVar3;
                                                                                        yVar5 = yVar4;
                                                                                        str41 = str35;
                                                                                        str42 = str41;
                                                                                        i32 = i33;
                                                                                        BooleanValue = 0;
                                                                                        str43 = profileKey;
                                                                                        profileKey = str43;
                                                                                        if (z15) {
                                                                                        }
                                                                                    }
                                                                                    try {
                                                                                        num3 = new Integer(i33);
                                                                                    } catch (Exception unused6) {
                                                                                        z15 = z14;
                                                                                        i30 = i26;
                                                                                        aVar4 = aVar3;
                                                                                        yVar5 = yVar4;
                                                                                        str41 = str35;
                                                                                        str42 = str41;
                                                                                        i32 = i33;
                                                                                        BooleanValue = 0;
                                                                                        str43 = profileKey;
                                                                                        profileKey = str43;
                                                                                        if (z15) {
                                                                                        }
                                                                                    }
                                                                                } else {
                                                                                    i33 = i29;
                                                                                    num3 = null;
                                                                                }
                                                                                Integer num6 = !zC ? null : this.f16558B;
                                                                                boolean z20 = i27 != 0;
                                                                                PlayerViewModel playerViewModel2 = this.f16579y;
                                                                                if (playerViewModel2 != null) {
                                                                                    try {
                                                                                        l = new Long(playerViewModel2.currentPlaybackSessionId());
                                                                                    } catch (Exception unused7) {
                                                                                        z15 = z14;
                                                                                        i32 = i33;
                                                                                        i30 = i26;
                                                                                        aVar4 = aVar3;
                                                                                        yVar5 = yVar4;
                                                                                        str42 = str35;
                                                                                        BooleanValue = 0;
                                                                                        str43 = profileKey;
                                                                                    }
                                                                                } else {
                                                                                    l = null;
                                                                                }
                                                                                this.f16572r = c8;
                                                                                this.f16559a = str39;
                                                                                str41 = str35;
                                                                                try {
                                                                                    this.f16560b = str41;
                                                                                    yVar5 = yVar4;
                                                                                    try {
                                                                                        this.f16561c = yVar5;
                                                                                        this.f16562d = item;
                                                                                        this.f16563e = profileKey;
                                                                                        this.f16564f = null;
                                                                                        this.f16566k = i31;
                                                                                        this.l = i33;
                                                                                        i34 = i27;
                                                                                        this.f16567m = i34;
                                                                                        i30 = i26;
                                                                                        try {
                                                                                            this.f16568n = i30;
                                                                                            z15 = z14;
                                                                                            try {
                                                                                                this.f16570p = z15;
                                                                                                this.f16569o = 0;
                                                                                                this.f16571q = 3;
                                                                                                c5.e eVar = N.f8259a;
                                                                                                objH = E.H(c5.d.f13466b, new I(i44, iV, z20, z19, num2, num3, num6, l, j6, null), this);
                                                                                                aVar4 = aVar3;
                                                                                            } catch (Exception unused8) {
                                                                                                aVar4 = aVar3;
                                                                                                str42 = str41;
                                                                                                i32 = i33;
                                                                                                BooleanValue = 0;
                                                                                                str43 = profileKey;
                                                                                            }
                                                                                        } catch (Exception unused9) {
                                                                                            z15 = z14;
                                                                                        }
                                                                                    } catch (Exception unused10) {
                                                                                        z15 = z14;
                                                                                        i30 = i26;
                                                                                    }
                                                                                } catch (Exception unused11) {
                                                                                    z15 = z14;
                                                                                    i30 = i26;
                                                                                    aVar4 = aVar3;
                                                                                    yVar5 = yVar4;
                                                                                }
                                                                            } catch (Exception unused12) {
                                                                                z15 = z14;
                                                                                i30 = i26;
                                                                                aVar4 = aVar3;
                                                                                yVar5 = yVar4;
                                                                                str41 = str35;
                                                                                i33 = i29;
                                                                                i31 = i28;
                                                                            }
                                                                            if (objH == aVar4) {
                                                                                return aVar4;
                                                                            }
                                                                            str42 = str41;
                                                                            i32 = i33;
                                                                            i35 = 0;
                                                                            str43 = profileKey;
                                                                            try {
                                                                                BooleanValue = ((Boolean) objH).booleanValue();
                                                                                if (BooleanValue != 0 && z15 && i34 != 0) {
                                                                                    try {
                                                                                        this.f16557A.set(true);
                                                                                        break;
                                                                                    } catch (Exception unused13) {
                                                                                    }
                                                                                }
                                                                            } catch (Exception unused14) {
                                                                                BooleanValue = i35;
                                                                            }
                                                                            profileKey = str43;
                                                                            if (z15) {
                                                                                if (BooleanValue == 0 || i30 != 0) {
                                                                                    return c3137a;
                                                                                }
                                                                                c0 c0Var7 = C0706p0.f7996a;
                                                                                Context applicationContext4 = this.f16578x.getApplicationContext();
                                                                                kotlin.jvm.internal.o.g(applicationContext4, str37);
                                                                                C0706p0.m(applicationContext4, new JSONObject(item.toString()));
                                                                                return c3137a;
                                                                            }
                                                                            str40 = str42;
                                                                        }
                                                                    }
                                                                } else {
                                                                    PlayerViewModel playerViewModel3 = this.f16579y;
                                                                    i19 = (playerViewModel3 == null || !playerViewModel3.tryMarkUpNextPrefetchAttempted()) ? 0 : 1;
                                                                    if (i19 != 0) {
                                                                        w wVar3 = (w) yVar;
                                                                        str26 = str21;
                                                                        int i45 = wVar3.f16585a;
                                                                        int i46 = wVar3.f16586b;
                                                                        str27 = str15;
                                                                        String strOptString9 = jSONObject.optString(str20);
                                                                        kotlin.jvm.internal.o.g(strOptString9, str13);
                                                                        String string7 = S4.p.o1(strOptString9).toString();
                                                                        str23 = str13;
                                                                        if (!S4.w.A0(string7, TtmlNode.TAG_TT, true)) {
                                                                            string7 = null;
                                                                        }
                                                                        this.f16572r = c6;
                                                                        this.f16559a = nVar2;
                                                                        this.f16560b = str19;
                                                                        this.f16561c = str18;
                                                                        this.f16562d = yVar;
                                                                        this.f16563e = jSONObject;
                                                                        this.f16564f = str22;
                                                                        str31 = str19;
                                                                        double d18 = d8;
                                                                        this.f16565j = d18;
                                                                        i21 = i13;
                                                                        this.f16566k = i21;
                                                                        jSONObject3 = jSONObject;
                                                                        this.l = i14;
                                                                        this.f16567m = i10;
                                                                        int i47 = i9;
                                                                        this.f16568n = i47;
                                                                        this.f16570p = z10;
                                                                        this.f16569o = i19;
                                                                        this.f16571q = 2;
                                                                        objB = C2064f.b(nVar2, i45, i46, string7, this);
                                                                        aVar2 = aVar;
                                                                        if (objB != aVar2) {
                                                                            d11 = d18;
                                                                            i22 = i19;
                                                                            z13 = z10;
                                                                            i23 = i10;
                                                                            i20 = i14;
                                                                            i24 = i47;
                                                                            nVar4 = nVar2;
                                                                            i19 = i22;
                                                                            z12 = z13;
                                                                            i16 = i21;
                                                                            i17 = i23;
                                                                            nVar2 = nVar4;
                                                                            qVar = (q) objB;
                                                                            i15 = i24;
                                                                            d10 = d11;
                                                                            str28 = str22;
                                                                            str29 = str18;
                                                                            str30 = str31;
                                                                            jSONObject = jSONObject3;
                                                                            if (qVar != null) {
                                                                                jSONObject.put(str51, qVar.f16545a);
                                                                                String str67 = qVar.f16546b;
                                                                                if (str67 != null) {
                                                                                    jSONObject.put(str12, str67);
                                                                                }
                                                                                String str68 = qVar.f16547c;
                                                                                if (str68 != null) {
                                                                                    jSONObject.put(str27, str68);
                                                                                }
                                                                                String str69 = qVar.f16548d;
                                                                                if (str69 != null) {
                                                                                    jSONObject.put(str20, str69);
                                                                                    jSONObject.put(str26, str69);
                                                                                }
                                                                                Object obj6 = AbstractC2060b.f16469a;
                                                                                AbstractC2060b.d(str28, str30, qVar.f16545a, qVar.f16546b, nVar2.f16513a, qVar.f16548d, qVar.f16547c);
                                                                                str48 = str28;
                                                                                c9 = c6;
                                                                                str49 = str30;
                                                                            } else {
                                                                                c9 = c6;
                                                                                String str70 = str27;
                                                                                String str71 = str26;
                                                                                str48 = str28;
                                                                                str49 = str30;
                                                                                if (i19 != 0) {
                                                                                    jSONObject.remove(str51);
                                                                                    jSONObject.remove(str12);
                                                                                    jSONObject.remove(str70);
                                                                                    jSONObject.remove(str71);
                                                                                    Object obj7 = AbstractC2060b.f16469a;
                                                                                    AbstractC2060b.e(nVar2.f16513a, str48, str49);
                                                                                }
                                                                            }
                                                                            item = jSONObject;
                                                                            profileKey = str48;
                                                                            yVar3 = yVar;
                                                                            z11 = z12;
                                                                            d9 = d10;
                                                                            str25 = str49;
                                                                            str24 = str29;
                                                                            i18 = i20;
                                                                            c6 = c9;
                                                                            i25 = i15;
                                                                            if (i25 != 0) {
                                                                            }
                                                                            if (!this.f16580z) {
                                                                            }
                                                                        }
                                                                    } else {
                                                                        str26 = str21;
                                                                        String str72 = str19;
                                                                        str23 = str13;
                                                                        str27 = str15;
                                                                        aVar2 = aVar;
                                                                        double d19 = d8;
                                                                        i15 = i9;
                                                                        i16 = i13;
                                                                        z12 = z10;
                                                                        i17 = i10;
                                                                        i20 = i14;
                                                                        d10 = d19;
                                                                        qVar = null;
                                                                        str28 = str22;
                                                                        str29 = str18;
                                                                        str30 = str72;
                                                                        if (qVar != null) {
                                                                        }
                                                                        item = jSONObject;
                                                                        profileKey = str48;
                                                                        yVar3 = yVar;
                                                                        z11 = z12;
                                                                        d9 = d10;
                                                                        str25 = str49;
                                                                        str24 = str29;
                                                                        i18 = i20;
                                                                        c6 = c9;
                                                                        i25 = i15;
                                                                        if (i25 != 0) {
                                                                        }
                                                                        if (!this.f16580z) {
                                                                        }
                                                                    }
                                                                }
                                                            } else {
                                                                str19 = lowerCase;
                                                            }
                                                        }
                                                    }
                                                    Map map2 = X2.j.f8601a;
                                                    String strB3 = X2.j.b(nVar2.f16513a, lowerCase);
                                                    if (strB3 == null || (string = S4.p.o1(strB3).toString()) == null || !S4.w.A0(string, TtmlNode.TAG_TT, true)) {
                                                        string = null;
                                                    }
                                                    if (r39 == 0) {
                                                    }
                                                    String str542 = str33;
                                                    str20 = str3;
                                                    if (string == null) {
                                                    }
                                                } else {
                                                    d8 = d6;
                                                    str18 = str16;
                                                    i13 = iIntValue;
                                                    i14 = iIntValue2;
                                                    str19 = lowerCase;
                                                    str20 = str3;
                                                    str21 = str;
                                                }
                                                str22 = str17;
                                                if (i9 == 0) {
                                                }
                                                String str562 = str19;
                                                str23 = str13;
                                                aVar2 = aVar;
                                                d9 = d8;
                                                i15 = i9;
                                                profileKey = str22;
                                                i16 = i13;
                                                yVar3 = yVar;
                                                z11 = z10;
                                                i17 = i10;
                                                i18 = i14;
                                                item = jSONObject;
                                                str24 = str18;
                                                str25 = str562;
                                                i25 = i15;
                                                if (i25 != 0) {
                                                }
                                                if (!this.f16580z) {
                                                }
                                            }
                                            return aVar2;
                                        }
                                        str9 = "main";
                                        str10 = "tmdbId";
                                        str11 = "toLowerCase(...)";
                                        str12 = str52;
                                        str13 = str8;
                                        str51 = str5;
                                        y yVar6 = wVar;
                                        str14 = "movie";
                                        str15 = "localDebridProvider";
                                        jSONObject = jSONObjectX;
                                        d6 = d15;
                                        c6 = c10;
                                        z10 = z8;
                                        i9 = i8;
                                        str16 = str4;
                                        i10 = i6;
                                        str17 = strA;
                                        yVar = yVar6;
                                        r39 = z7;
                                        if (i9 == 0) {
                                        }
                                        str22 = str17;
                                        if (i9 == 0) {
                                        }
                                        String str5622 = str19;
                                        str23 = str13;
                                        aVar2 = aVar;
                                        d9 = d8;
                                        i15 = i9;
                                        profileKey = str22;
                                        i16 = i13;
                                        yVar3 = yVar;
                                        z11 = z10;
                                        i17 = i10;
                                        i18 = i14;
                                        item = jSONObject;
                                        str24 = str18;
                                        str25 = str5622;
                                        i25 = i15;
                                        if (i25 != 0) {
                                        }
                                        if (!this.f16580z) {
                                        }
                                    } else {
                                        if (lowerCase.equals("tv")) {
                                            Context context3 = k.f16500a;
                                            k.b(nVar2.f16513a, iIntValue, iIntValue2, strA);
                                        } else {
                                            Context context4 = k.f16500a;
                                            int i48 = nVar2.f16513a;
                                            if (i48 > 0) {
                                                str8 = str7;
                                                obj2 = "tv";
                                                k.g(strA, "m-" + i48);
                                            }
                                            if (i8 != 0) {
                                            }
                                        }
                                        str8 = str7;
                                        obj2 = "tv";
                                        if (i8 != 0) {
                                        }
                                    }
                                }
                            } else {
                                if (lowerCase.equals("tv")) {
                                    if (!kotlin.jvm.internal.o.c(wVar, vVar) && !(wVar instanceof w)) {
                                        kotlin.jvm.internal.o.c(wVar, xVar);
                                    }
                                    i7 = 0;
                                    J j42 = u3.f8112c;
                                    boolean z172 = ((n3) ((c0) j42.f8871a).getValue()).f7972b.f7759c;
                                    z6 = wVar instanceof w;
                                    if (z6) {
                                    }
                                    nVar2 = nVar;
                                    c0 c0Var8 = z3.f8212a;
                                    strA = z3.a(this.f16578x);
                                    if (strA == null) {
                                    }
                                    if (strA.equals("main")) {
                                        z9 = false;
                                        if (i6 == 0) {
                                        }
                                    }
                                }
                                i7 = 1;
                                J j422 = u3.f8112c;
                                boolean z1722 = ((n3) ((c0) j422.f8871a).getValue()).f7972b.f7759c;
                                z6 = wVar instanceof w;
                                if (z6) {
                                }
                                nVar2 = nVar;
                                c0 c0Var82 = z3.f8212a;
                                strA = z3.a(this.f16578x);
                                if (strA == null) {
                                }
                                if (strA.equals("main")) {
                                }
                            }
                        }
                        str6 = "type";
                        nVar = nVar6;
                        wVar = null;
                        if (i6 == 0) {
                        }
                    } else {
                        if (num.intValue() <= 0) {
                            num = null;
                        }
                        if (num != null) {
                            iIntValue2 = num.intValue();
                        }
                        str4 = strC;
                        if (d15 < 80.0d) {
                        }
                        zEquals = lowerCase.equals("tv");
                        i6 = i37;
                        v vVar2 = v.f16584a;
                        x xVar2 = x.f16587a;
                        if (zEquals) {
                        }
                        str6 = "type";
                        nVar = nVar6;
                        wVar = null;
                        if (i6 == 0) {
                        }
                    }
                } else {
                    if (num4.intValue() <= 0) {
                        num4 = null;
                    }
                    if (num4 != null) {
                        iIntValue = num4.intValue();
                    }
                    num = this.f16577w;
                    if (num == null) {
                    }
                }
                int i49 = i30;
                y yVar7 = yVar5;
                String str73 = profileKey;
                FirebaseUser currentUser = FirebaseAuth.getInstance().getCurrentUser();
                if (currentUser == null) {
                    return c3137a;
                }
                if (i49 != 0) {
                    if (this.f16557A.get()) {
                        return c3137a;
                    }
                    this.f16557A.set(true);
                    C2064f c2064f = C2064f.f16487a;
                    String uid = currentUser.getUid();
                    kotlin.jvm.internal.o.g(uid, "getUid(...)");
                    this.f16572r = null;
                    this.f16559a = null;
                    this.f16560b = null;
                    this.f16561c = null;
                    this.f16562d = null;
                    this.f16563e = null;
                    this.f16564f = null;
                    this.f16571q = 4;
                    return c2064f.c(uid, str73, str40, this) == aVar4 ? aVar4 : c3137a;
                }
                if (yVar7 instanceof w) {
                    this.f16557A.set(true);
                    String uid2 = currentUser.getUid();
                    kotlin.jvm.internal.o.g(uid2, "getUid(...)");
                    Integer num7 = new Integer(((w) yVar7).f16585a);
                    Integer num8 = new Integer(((w) yVar7).f16586b);
                    this.f16572r = null;
                    this.f16559a = null;
                    this.f16560b = null;
                    this.f16561c = null;
                    this.f16562d = null;
                    this.f16563e = null;
                    this.f16564f = null;
                    this.f16571q = 5;
                    c5.e eVar2 = N.f8259a;
                    return E.H(c5.d.f13466b, new C2063e(uid2, 0, 0, true, num7, num8, str73, str40, null), this) == aVar4 ? aVar4 : c3137a;
                }
                String uid3 = currentUser.getUid();
                kotlin.jvm.internal.o.g(uid3, "getUid(...)");
                int i50 = (int) this.f16574t;
                if (i50 < 0) {
                    i50 = 0;
                }
                int i51 = (int) this.f16575u;
                int i52 = i51 < 0 ? 0 : i51;
                Integer num9 = kotlin.jvm.internal.o.c(str39, obj3) ? new Integer(i31) : null;
                Integer num10 = kotlin.jvm.internal.o.c(str39, obj3) ? new Integer(i32) : null;
                this.f16572r = null;
                this.f16559a = null;
                this.f16560b = null;
                this.f16561c = null;
                this.f16562d = null;
                this.f16563e = null;
                this.f16564f = null;
                this.f16571q = 6;
                c5.e eVar3 = N.f8259a;
                return E.H(c5.d.f13466b, new C2063e(uid3, i50, i52, false, num9, num10, str73, str40, null), this) == aVar4 ? aVar4 : c3137a;
            case 1:
                c3137a = c3137a2;
                str = "localImdbId";
                str2 = "getApplicationContext(...)";
                int i53 = this.f16569o;
                boolean z21 = this.f16570p;
                int i54 = this.f16568n;
                int i55 = this.f16567m;
                i11 = this.l;
                int i56 = this.f16566k;
                z10 = z21;
                i12 = i54;
                double d20 = this.f16565j;
                String str74 = this.f16564f;
                jSONObject2 = (JSONObject) this.f16563e;
                y yVar8 = (y) this.f16562d;
                String str75 = (String) this.f16561c;
                String str76 = this.f16560b;
                nVar3 = (n) this.f16559a;
                c7 = (C) this.f16572r;
                AbstractC2467b.l(obj);
                str6 = "type";
                r392 = i53;
                i6 = i55;
                str4 = str75;
                str3 = "imdbId";
                str10 = "tmdbId";
                str14 = "movie";
                str15 = "localDebridProvider";
                d7 = d20;
                iIntValue = i56;
                strA = str74;
                lowerCase = str76;
                obj2 = "tv";
                str11 = "toLowerCase(...)";
                yVar2 = yVar8;
                aVar2 = aVar5;
                str9 = "main";
                str12 = "localLinkHash";
                str13 = "optString(...)";
                iIntValue2 = i11;
                i9 = i12;
                jSONObject = jSONObject2;
                nVar2 = nVar3;
                aVar = aVar2;
                double d162 = d7;
                c6 = c7;
                d6 = d162;
                str17 = strA;
                i10 = i6;
                yVar = yVar2;
                str16 = str4;
                r39 = r392;
                if (i9 == 0) {
                }
                str22 = str17;
                if (i9 == 0) {
                }
                String str56222 = str19;
                str23 = str13;
                aVar2 = aVar;
                d9 = d8;
                i15 = i9;
                profileKey = str22;
                i16 = i13;
                yVar3 = yVar;
                z11 = z10;
                i17 = i10;
                i18 = i14;
                item = jSONObject;
                str24 = str18;
                str25 = str56222;
                i25 = i15;
                if (i25 != 0) {
                }
                if (!this.f16580z) {
                }
                break;
            case 2:
                c3137a = c3137a2;
                int i57 = this.f16569o;
                boolean z22 = this.f16570p;
                i24 = this.f16568n;
                i23 = this.f16567m;
                i20 = this.l;
                int i58 = this.f16566k;
                str26 = "localImdbId";
                str2 = "getApplicationContext(...)";
                double d21 = this.f16565j;
                String str77 = this.f16564f;
                jSONObject3 = (JSONObject) this.f16563e;
                y yVar9 = (y) this.f16562d;
                String str78 = (String) this.f16561c;
                String str79 = this.f16560b;
                nVar4 = (n) this.f16559a;
                C c11 = (C) this.f16572r;
                AbstractC2467b.l(obj);
                str6 = "type";
                str23 = "optString(...)";
                d11 = d21;
                yVar = yVar9;
                str18 = str78;
                str31 = str79;
                c6 = c11;
                str9 = "main";
                str10 = "tmdbId";
                str11 = "toLowerCase(...)";
                i22 = i57;
                z13 = z22;
                i21 = i58;
                str22 = str77;
                obj2 = "tv";
                str14 = "movie";
                str27 = "localDebridProvider";
                aVar2 = aVar5;
                str12 = "localLinkHash";
                str20 = "imdbId";
                objB = obj;
                i19 = i22;
                z12 = z13;
                i16 = i21;
                i17 = i23;
                nVar2 = nVar4;
                qVar = (q) objB;
                i15 = i24;
                d10 = d11;
                str28 = str22;
                str29 = str18;
                str30 = str31;
                jSONObject = jSONObject3;
                if (qVar != null) {
                }
                item = jSONObject;
                profileKey = str48;
                yVar3 = yVar;
                z11 = z12;
                d9 = d10;
                str25 = str49;
                str24 = str29;
                i18 = i20;
                c6 = c9;
                i25 = i15;
                if (i25 != 0) {
                }
                if (!this.f16580z) {
                }
                break;
            case 3:
                int i59 = this.f16569o;
                boolean z23 = this.f16570p;
                int i60 = this.f16568n;
                int i61 = this.f16567m;
                i32 = this.l;
                i31 = this.f16566k;
                str43 = (String) this.f16563e;
                item = (JSONObject) this.f16562d;
                y yVar10 = (y) this.f16561c;
                str42 = this.f16560b;
                String str80 = (String) this.f16559a;
                i35 = i59;
                try {
                    AbstractC2467b.l(obj);
                    objH = obj;
                    c3137a = c3137a2;
                    i34 = i61;
                    str37 = "getApplicationContext(...)";
                    z15 = z23;
                    obj3 = "tv";
                    str39 = str80;
                    yVar5 = yVar10;
                    i30 = i60;
                    aVar4 = aVar5;
                    BooleanValue = ((Boolean) objH).booleanValue();
                    if (BooleanValue != 0) {
                        this.f16557A.set(true);
                    }
                } catch (Exception unused15) {
                    c3137a = c3137a2;
                    str37 = "getApplicationContext(...)";
                    BooleanValue = i35;
                    z15 = z23;
                    obj3 = "tv";
                    str39 = str80;
                    yVar5 = yVar10;
                    i30 = i60;
                    aVar4 = aVar5;
                }
                profileKey = str43;
                if (z15) {
                }
                break;
            case 4:
                AbstractC2467b.l(obj);
                ((w4.n) obj).getClass();
                return c3137a2;
            case 5:
            case 6:
                AbstractC2467b.l(obj);
                return c3137a2;
            default:
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
        }
    }
}
