package p000.p001.p002.p003.p004;

import android.database.Cursor;
import android.util.LongSparseArray;
import androidx.lifecycle.LiveData;
import ar.tvplayer.core.data.db.dao.ބ;
import ar.tvplayer.core.data.db.dao.ޅ;
import ar.tvplayer.core.data.db.dao.އ;
import ar.tvplayer.core.data.db.dao.ވ;
import ar.tvplayer.core.data.db.dao.ތ;
import ar.tvplayer.core.data.db.dao.ޞ;
import ar.tvplayer.core.data.db.entities.ؠ;
import ar.tvplayer.core.data.db.entities.ހ;
import ar.tvplayer.core.data.db.entities.ކ;
import ar.tvplayer.core.data.db.entities.ގ;
import ar.tvplayer.core.data.db.entities.ޑ;
import ar.tvplayer.core.data.db.entities.ޙ;
import ar.tvplayer.core.data.db.entities.ޤ;
import ar.tvplayer.core.data.prefs.ރ;
import ar.tvplayer.core.data.repositories.ʳ;
import ar.tvplayer.core.data.repositories.ʼ;
import ar.tvplayer.core.data.repositories.ޒ;
import ar.tvplayer.core.data.repositories.ࢣ;
import ar.tvplayer.core.data.repositories.ࢧ;
import ar.tvplayer.core.data.repositories.ࢩ;
import ar.tvplayer.core.domain.ލ;
import ar.tvplayer.core.domain.ޏ;
import ar.tvplayer.core.util.CommonUtilsKt;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
import p000.p001.p021.C1255;
import p000.p001.p021.p023.C1262;
import p000.p001.p021.p023.C1267;
import p000.p001.p021.p023.EnumC1270;
import p025.p026.AbstractC1323;
import p025.p026.C1340;
import p025.p026.C1356;
import p025.p026.InterfaceC1327;
import p037.p041.p042.LayoutInflaterFactory2C1494;
import p037.p065.p077.C1900;
import p037.p099.AbstractC2245;
import p037.p099.C2226;
import p037.p099.C2240;
import p037.p099.InterfaceC2230;
import p037.p109.C2409;
import p037.p109.p111.C2421;
import p138.p139.p143.p144.C2803;
import p138.p176.p177.p242.p246.p251.C4303;
import p402.C6549;
import p402.InterfaceC6540;
import p402.p403.C6560;
import p402.p403.C6563;
import p402.p405.InterfaceC6575;
import p402.p405.InterfaceC6578;
import p402.p405.p406.EnumC6586;
import p402.p405.p407.p408.AbstractC6591;
import p402.p405.p407.p408.AbstractC6597;
import p402.p405.p407.p408.InterfaceC6593;
import p402.p411.p412.InterfaceC6618;
import p402.p411.p413.C6635;
import p402.p411.p413.C6646;
import p402.p419.InterfaceC6684;

/* JADX INFO: renamed from: ނ.֏.֏.֏.֏.ၮ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
@InterfaceC6540
public final class C0636 extends AbstractC2245 {

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public volatile long f2994;

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public volatile C1267 f2995;

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public final C2226<C0640> f2996;

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public LiveData<ހ> f2997;

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public LiveData<List<ؠ>> f2998;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public LiveData<ކ> f2999;

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public final LiveData<Integer> f3000;

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public ގ f3001;

    /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
    public long f3002;

    /* JADX INFO: renamed from: މ, reason: contains not printable characters */
    public List<C0639> f3003;

    /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
    public final LiveData<Long> f3004;

    /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
    public final AtomicBoolean f3005;

    /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
    public LiveData<ޙ> f3006;

    /* JADX INFO: renamed from: ލ, reason: contains not printable characters */
    public final C2240 f3007;

    /* JADX INFO: renamed from: ނ.֏.֏.֏.֏.ၮ$֏, reason: contains not printable characters */
    public static final class C0637<T> implements InterfaceC2230<Integer> {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public static final C0637 f3008 = new C0637();

        @Override // p037.p099.InterfaceC2230
        /* JADX INFO: renamed from: ֏ */
        public void mo1576(Integer num) {
        }
    }

    /* JADX INFO: renamed from: ނ.֏.֏.֏.֏.ၮ$ؠ, reason: contains not printable characters */
    public static final class C0638<T> implements InterfaceC2230<Long> {
        public C0638() {
        }

        @Override // p037.p099.InterfaceC2230
        /* JADX INFO: renamed from: ֏ */
        public void mo1576(Long l) {
            C0636.this.m1982();
        }
    }

    /* JADX INFO: renamed from: ނ.֏.֏.֏.֏.ၮ$ހ, reason: contains not printable characters */
    public static final class C0639 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final ހ f3010;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public final String f3011;

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public final ޤ f3012;

        public C0639(ހ r2, String str, ޤ r4) {
            if (r2 == null) {
                C6635.m9824("channel");
                throw null;
            }
            if (str == null) {
                C6635.m9824("number");
                throw null;
            }
            this.f3010 = r2;
            this.f3011 = str;
            this.f3012 = r4;
        }

        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (!(obj instanceof C0639)) {
                return false;
            }
            C0639 c0639 = (C0639) obj;
            return C6635.m9825(this.f3010, c0639.f3010) && C6635.m9825((Object) this.f3011, (Object) c0639.f3011) && C6635.m9825(this.f3012, c0639.f3012);
        }

        public int hashCode() {
            ހ r0 = this.f3010;
            int iHashCode = (r0 != null ? r0.hashCode() : 0) * 31;
            String str = this.f3011;
            int iHashCode2 = (iHashCode + (str != null ? str.hashCode() : 0)) * 31;
            ޤ r2 = this.f3012;
            return iHashCode2 + (r2 != null ? r2.hashCode() : 0);
        }

        public String toString() {
            StringBuilder sbM4889 = C2803.m4889("ChannelForPlayerData(channel=");
            sbM4889.append(this.f3010);
            sbM4889.append(", number=");
            sbM4889.append(this.f3011);
            sbM4889.append(", currentProgram=");
            sbM4889.append(this.f3012);
            sbM4889.append(")");
            return sbM4889.toString();
        }
    }

    /* JADX INFO: renamed from: ނ.֏.֏.֏.֏.ၮ$ށ, reason: contains not printable characters */
    public static final class C0640 {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final ހ f3013;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public final List<ؠ> f3014;

        public C0640(ހ r1, List<ؠ> list) {
            this.f3013 = r1;
            this.f3014 = list;
        }

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public static /* synthetic */ C0640 m1983(C0640 c0640, ހ r2, List list, int i) {
            if ((i & 1) != 0) {
                r2 = c0640.f3013;
            }
            if ((i & 2) != 0) {
                list = c0640.f3014;
            }
            if (c0640 != null) {
                return new C0640(r2, list);
            }
            throw null;
        }

        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (!(obj instanceof C0640)) {
                return false;
            }
            C0640 c0640 = (C0640) obj;
            return C6635.m9825(this.f3013, c0640.f3013) && C6635.m9825(this.f3014, c0640.f3014);
        }

        public int hashCode() {
            ހ r0 = this.f3013;
            int iHashCode = (r0 != null ? r0.hashCode() : 0) * 31;
            List<ؠ> list = this.f3014;
            return iHashCode + (list != null ? list.hashCode() : 0);
        }

        public String toString() {
            StringBuilder sbM4889 = C2803.m4889("PlayerData(channel=");
            sbM4889.append(this.f3013);
            sbM4889.append(", groupChannels=");
            sbM4889.append(this.f3014);
            sbM4889.append(")");
            return sbM4889.toString();
        }
    }

    /* JADX INFO: renamed from: ނ.֏.֏.֏.֏.ၮ$ނ, reason: contains not printable characters */
    @InterfaceC6593(c = "ar.tvplayer.tv.player.ui.PlayerViewModel", f = "PlayerViewModel.kt", l = {184, 189}, m = "addHistoryProgram")
    public static final class C0641 extends AbstractC6591 {

        /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
        public /* synthetic */ Object f3015;

        /* JADX INFO: renamed from: އ, reason: contains not printable characters */
        public int f3016;

        /* JADX INFO: renamed from: މ, reason: contains not printable characters */
        public Object f3018;

        /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
        public Object f3019;

        /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
        public Object f3020;

        /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
        public Object f3021;

        /* JADX INFO: renamed from: ލ, reason: contains not printable characters */
        public Object f3022;

        /* JADX INFO: renamed from: ގ, reason: contains not printable characters */
        public Object f3023;

        /* JADX INFO: renamed from: ޏ, reason: contains not printable characters */
        public long f3024;

        /* JADX INFO: renamed from: ސ, reason: contains not printable characters */
        public long f3025;

        public C0641(InterfaceC6575 interfaceC6575) {
            super(interfaceC6575);
        }

        @Override // p402.p405.p407.p408.AbstractC6589
        /* JADX INFO: renamed from: ށ */
        public final Object mo839(Object obj) {
            this.f3015 = obj;
            this.f3016 |= Integer.MIN_VALUE;
            return C0636.this.m1970(0L, null, this);
        }
    }

    /* JADX INFO: renamed from: ނ.֏.֏.֏.֏.ၮ$ރ, reason: contains not printable characters */
    @InterfaceC6593(c = "ar.tvplayer.tv.player.ui.PlayerViewModel", f = "PlayerViewModel.kt", l = {302}, m = "getChannelCurrentProgram")
    public static final class C0642 extends AbstractC6591 {

        /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
        public /* synthetic */ Object f3026;

        /* JADX INFO: renamed from: އ, reason: contains not printable characters */
        public int f3027;

        /* JADX INFO: renamed from: މ, reason: contains not printable characters */
        public Object f3029;

        /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
        public Object f3030;

        /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
        public long f3031;

        public C0642(InterfaceC6575 interfaceC6575) {
            super(interfaceC6575);
        }

        @Override // p402.p405.p407.p408.AbstractC6589
        /* JADX INFO: renamed from: ށ */
        public final Object mo839(Object obj) {
            this.f3026 = obj;
            this.f3027 |= Integer.MIN_VALUE;
            return C0636.this.m1971((ހ) null, this);
        }
    }

    /* JADX INFO: Add missing generic type declarations: [S] */
    /* JADX INFO: renamed from: ނ.֏.֏.֏.֏.ၮ$ބ, reason: contains not printable characters */
    public static final class C0643<T, S> implements InterfaceC2230<S> {
        public C0643() {
        }

        @Override // p037.p099.InterfaceC2230
        /* JADX INFO: renamed from: ֏ */
        public void mo1576(Object obj) {
            C0636 c0636 = C0636.this;
            c0636.f2996.mo345(C0640.m1983(c0636.m1981(), (ހ) obj, null, 2));
        }
    }

    /* JADX INFO: renamed from: ނ.֏.֏.֏.֏.ၮ$ޅ, reason: contains not printable characters */
    @InterfaceC6593(c = "ar.tvplayer.tv.player.ui.PlayerViewModel", f = "PlayerViewModel.kt", l = {336}, m = "loadChannelsByNumberInternal")
    public static final class C0644 extends AbstractC6591 {

        /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
        public /* synthetic */ Object f3033;

        /* JADX INFO: renamed from: އ, reason: contains not printable characters */
        public int f3034;

        /* JADX INFO: renamed from: މ, reason: contains not printable characters */
        public Object f3036;

        /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
        public Object f3037;

        /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
        public Object f3038;

        /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
        public Object f3039;

        /* JADX INFO: renamed from: ލ, reason: contains not printable characters */
        public Object f3040;

        /* JADX INFO: renamed from: ގ, reason: contains not printable characters */
        public Object f3041;

        /* JADX INFO: renamed from: ޏ, reason: contains not printable characters */
        public Object f3042;

        /* JADX INFO: renamed from: ސ, reason: contains not printable characters */
        public Object f3043;

        /* JADX INFO: renamed from: ޑ, reason: contains not printable characters */
        public Object f3044;

        /* JADX INFO: renamed from: ޒ, reason: contains not printable characters */
        public Object f3045;

        /* JADX INFO: renamed from: ޓ, reason: contains not printable characters */
        public Object f3046;

        /* JADX INFO: renamed from: ޔ, reason: contains not printable characters */
        public Object f3047;

        /* JADX INFO: renamed from: ޕ, reason: contains not printable characters */
        public int f3048;

        /* JADX INFO: renamed from: ޖ, reason: contains not printable characters */
        public long f3049;

        public C0644(InterfaceC6575 interfaceC6575) {
            super(interfaceC6575);
        }

        @Override // p402.p405.p407.p408.AbstractC6589
        /* JADX INFO: renamed from: ށ */
        public final Object mo839(Object obj) {
            this.f3033 = obj;
            this.f3034 |= Integer.MIN_VALUE;
            return C0636.this.m1972((String) null, (InterfaceC6575<? super List<C0639>>) this);
        }
    }

    /* JADX INFO: renamed from: ނ.֏.֏.֏.֏.ၮ$ކ, reason: contains not printable characters */
    public static final class C0645<T> implements Comparator<ހ> {

        /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
        public final /* synthetic */ LongSparseArray f3050;

        public C0645(LongSparseArray longSparseArray) {
            this.f3050 = longSparseArray;
        }

        @Override // java.util.Comparator
        public int compare(ހ r5, ހ r6) {
            ހ r62 = r6;
            Object obj = this.f3050.get(r5.އ);
            if (obj == null) {
                C6635.m9822();
                throw null;
            }
            int iIntValue = ((Number) obj).intValue();
            Object obj2 = this.f3050.get(r62.އ);
            if (obj2 != null) {
                return C6635.m9819(iIntValue, ((Number) obj2).intValue());
            }
            C6635.m9822();
            throw null;
        }
    }

    /* JADX INFO: Add missing generic type declarations: [S] */
    /* JADX INFO: renamed from: ނ.֏.֏.֏.֏.ၮ$އ, reason: contains not printable characters */
    public static final class C0646<T, S> implements InterfaceC2230<S> {
        public C0646() {
        }

        @Override // p037.p099.InterfaceC2230
        /* JADX INFO: renamed from: ֏ */
        public void mo1576(Object obj) {
            List list = (List) obj;
            C0636 c0636 = C0636.this;
            if (c0636.f3001 != null) {
                C6635.m9823((Object) list, "it");
                LiveData<ކ> liveData = C0636.this.f2999;
                if (liveData == null) {
                    C6635.m9826("optionsLiveData");
                    throw null;
                }
                ގ r1 = LayoutInflaterFactory2C1494.C1505.m2901(liveData.m339());
                ގ r3 = C0636.this.f3001;
                if (r3 != null) {
                    C0636.m1969(c0636, list, r1, r3);
                } else {
                    C6635.m9822();
                    throw null;
                }
            }
        }
    }

    /* JADX INFO: renamed from: ނ.֏.֏.֏.֏.ၮ$ވ, reason: contains not printable characters */
    @InterfaceC6593(c = "ar.tvplayer.tv.player.ui.PlayerViewModel", f = "PlayerViewModel.kt", l = {232}, m = "loadRecentChannels")
    public static final class C0647 extends AbstractC6591 {

        /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
        public /* synthetic */ Object f3052;

        /* JADX INFO: renamed from: އ, reason: contains not printable characters */
        public int f3053;

        /* JADX INFO: renamed from: މ, reason: contains not printable characters */
        public Object f3055;

        /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
        public Object f3056;

        public C0647(InterfaceC6575 interfaceC6575) {
            super(interfaceC6575);
        }

        @Override // p402.p405.p407.p408.AbstractC6589
        /* JADX INFO: renamed from: ށ */
        public final Object mo839(Object obj) {
            this.f3052 = obj;
            this.f3053 |= Integer.MIN_VALUE;
            return C0636.this.m1974(this);
        }
    }

    /* JADX INFO: renamed from: ނ.֏.֏.֏.֏.ၮ$މ, reason: contains not printable characters */
    @InterfaceC6593(c = "ar.tvplayer.tv.player.ui.PlayerViewModel$loadRecentChannels$2", f = "PlayerViewModel.kt", l = {235}, m = "invokeSuspend")
    public static final class C0648 extends AbstractC6597 implements InterfaceC6618<InterfaceC1327, InterfaceC6575<? super C6549>, Object> {

        /* JADX INFO: renamed from: އ, reason: contains not printable characters */
        public InterfaceC1327 f3057;

        /* JADX INFO: renamed from: ވ, reason: contains not printable characters */
        public Object f3058;

        /* JADX INFO: renamed from: މ, reason: contains not printable characters */
        public Object f3059;

        /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
        public int f3060;

        /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
        public final /* synthetic */ C6646 f3062;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C0648(C6646 c6646, InterfaceC6575 interfaceC6575) {
            super(2, interfaceC6575);
            this.f3062 = c6646;
        }

        @Override // p402.p405.p407.p408.AbstractC6589
        /* JADX INFO: renamed from: ֏ */
        public final InterfaceC6575<C6549> mo837(Object obj, InterfaceC6575<?> interfaceC6575) {
            if (interfaceC6575 == null) {
                C6635.m9824("completion");
                throw null;
            }
            C0648 c0648 = C0636.this.new C0648(this.f3062, interfaceC6575);
            c0648.f3057 = (InterfaceC1327) obj;
            return c0648;
        }

        @Override // p402.p411.p412.InterfaceC6618
        /* JADX INFO: renamed from: ؠ */
        public final Object mo838(InterfaceC1327 interfaceC1327, InterfaceC6575<? super C6549> interfaceC6575) {
            return ((C0648) mo837(interfaceC1327, interfaceC6575)).mo839(C6549.f19328);
        }

        /* JADX WARN: Removed duplicated region for block: B:11:0x0044 A[RETURN] */
        /* JADX WARN: Removed duplicated region for block: B:12:0x0045  */
        /* JADX WARN: Removed duplicated region for block: B:15:0x0059  */
        /* JADX WARN: Removed duplicated region for block: B:16:0x0062  */
        /* JADX WARN: Type inference failed for: r8v6, types: [T, java.util.List] */
        /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:12:0x0045 -> B:13:0x004b). Please report as a decompilation issue!!! */
        @Override // p402.p405.p407.p408.AbstractC6589
        /* JADX INFO: renamed from: ށ */
        /*
            Code decompiled incorrectly, please refer to instructions dump.
        */
        public final Object mo839(Object obj) {
            InterfaceC1327 interfaceC1327;
            C0648 c0648;
            Object objM1973;
            EnumC6586 enumC6586 = EnumC6586.COROUTINE_SUSPENDED;
            int i = this.f3060;
            if (i == 0) {
                C4303.m7198(obj);
                interfaceC1327 = this.f3057;
                c0648 = this;
                C0636.this.f3005.set(false);
                C6646 c6646 = c0648.f3062;
                C0636 c0636 = C0636.this;
                List<C0639> list = (List) c6646.f19405;
                c0648.f3058 = interfaceC1327;
                c0648.f3059 = c6646;
                c0648.f3060 = 1;
                objM1973 = c0636.m1973(list, c0648);
                if (objM1973 != enumC6586) {
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                C6646 c66462 = (C6646) this.f3059;
                InterfaceC1327 interfaceC13272 = (InterfaceC1327) this.f3058;
                C4303.m7198(obj);
                InterfaceC1327 interfaceC13273 = interfaceC13272;
                C6646 c66463 = c66462;
                EnumC6586 enumC65862 = enumC6586;
                C0648 c06482 = this;
                c66463.f19405 = (List) obj;
                if (!C0636.this.f3005.get()) {
                    c06482.f3062.f19405 = null;
                    c0648 = c06482;
                    enumC6586 = enumC65862;
                    interfaceC1327 = interfaceC13273;
                    C0636.this.f3005.set(false);
                    C6646 c66464 = c0648.f3062;
                    C0636 c06362 = C0636.this;
                    List<C0639> list2 = (List) c66464.f19405;
                    c0648.f3058 = interfaceC1327;
                    c0648.f3059 = c66464;
                    c0648.f3060 = 1;
                    objM1973 = c06362.m1973(list2, c0648);
                    if (objM1973 != enumC6586) {
                        return enumC6586;
                    }
                    EnumC6586 enumC65863 = enumC6586;
                    c06482 = c0648;
                    obj = objM1973;
                    interfaceC13273 = interfaceC1327;
                    c66463 = c66464;
                    enumC65862 = enumC65863;
                    c66463.f19405 = (List) obj;
                    if (!C0636.this.f3005.get()) {
                        return C6549.f19328;
                    }
                }
            }
        }
    }

    /* JADX INFO: renamed from: ނ.֏.֏.֏.֏.ၮ$ފ, reason: contains not printable characters */
    @InterfaceC6593(c = "ar.tvplayer.tv.player.ui.PlayerViewModel", f = "PlayerViewModel.kt", l = {252, 294}, m = "loadRecentChannelsInternal")
    public static final class C0649 extends AbstractC6591 {

        /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
        public /* synthetic */ Object f3063;

        /* JADX INFO: renamed from: އ, reason: contains not printable characters */
        public int f3064;

        /* JADX INFO: renamed from: މ, reason: contains not printable characters */
        public Object f3066;

        /* JADX INFO: renamed from: ފ, reason: contains not printable characters */
        public Object f3067;

        /* JADX INFO: renamed from: ދ, reason: contains not printable characters */
        public Object f3068;

        /* JADX INFO: renamed from: ތ, reason: contains not printable characters */
        public Object f3069;

        /* JADX INFO: renamed from: ލ, reason: contains not printable characters */
        public Object f3070;

        /* JADX INFO: renamed from: ގ, reason: contains not printable characters */
        public Object f3071;

        /* JADX INFO: renamed from: ޏ, reason: contains not printable characters */
        public Object f3072;

        /* JADX INFO: renamed from: ސ, reason: contains not printable characters */
        public Object f3073;

        /* JADX INFO: renamed from: ޑ, reason: contains not printable characters */
        public Object f3074;

        /* JADX INFO: renamed from: ޒ, reason: contains not printable characters */
        public Object f3075;

        /* JADX INFO: renamed from: ޓ, reason: contains not printable characters */
        public Object f3076;

        /* JADX INFO: renamed from: ޔ, reason: contains not printable characters */
        public Object f3077;

        /* JADX INFO: renamed from: ޕ, reason: contains not printable characters */
        public int f3078;

        public C0649(InterfaceC6575 interfaceC6575) {
            super(interfaceC6575);
        }

        @Override // p402.p405.p407.p408.AbstractC6589
        /* JADX INFO: renamed from: ށ */
        public final Object mo839(Object obj) {
            this.f3063 = obj;
            this.f3064 |= Integer.MIN_VALUE;
            return C0636.this.m1973((List<C0639>) null, this);
        }
    }

    public C0636(C2240 c2240) {
        if (c2240 == null) {
            C6635.m9824("savedStateHandle");
            throw null;
        }
        this.f3007 = c2240;
        this.f2996 = new C2226<>();
        ar.tvplayer.core.data.db.dao.ޙ r8 = ar.tvplayer.core.data.db.ހ.֏().ލ();
        if (r8 == null) {
            throw null;
        }
        this.f3000 = CommonUtilsKt.֏(r8.֏.f7599.m4455(new String[]{"playlists"}, false, new ޞ(r8, C2409.m4490("SELECT COUNT(*) FROM playlists WHERE is_enabled == 1", 0))));
        ar.tvplayer.core.data.db.dao.ؠ r82 = ar.tvplayer.core.data.db.ހ.֏().އ();
        if (r82 == null) {
            throw null;
        }
        this.f3004 = r82.֏.f7599.m4455(new String[]{"channels", "playlists", "channel_group_options", "channel_manual_positions"}, false, new ވ(r82, C2409.m4490("\n        SELECT channels.id\n        FROM channels, playlists, channel_group_options, channel_manual_positions\n        LIMIT 1\n        ", 0)));
        this.f3005 = new AtomicBoolean(false);
        this.f3000.m343(C0637.f3008);
        this.f3004.m343(new C0638());
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static final /* synthetic */ void m1969(C0636 c0636, List list, ގ r12, ގ r13) {
        if (c0636 == null) {
            throw null;
        }
        C4303.m7160(LayoutInflaterFactory2C1494.C1505.m2925((AbstractC2245) c0636), C1340.f4487, null, new C0654(c0636, list, r12, r13, null), 2, null);
    }

    /* JADX WARN: Removed duplicated region for block: B:34:0x00c4  */
    /* JADX WARN: Removed duplicated region for block: B:38:0x00f1 A[RETURN] */
    /* JADX WARN: Removed duplicated region for block: B:39:0x00f2  */
    /* JADX WARN: Removed duplicated region for block: B:42:0x00fe  */
    /* JADX WARN: Removed duplicated region for block: B:50:0x0124  */
    /* JADX WARN: Removed duplicated region for block: B:7:0x0017  */
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object m1970(long j, Long l, InterfaceC6575<? super C6549> interfaceC6575) throws Throwable {
        C0641 c0641;
        ހ r1;
        long j2;
        Long l2;
        C0636 c0636;
        ހ r3;
        ހ r5;
        List list;
        C0636 c06362;
        long j3;
        ޤ r4;
        C1267 c1267;
        long j4;
        C1267 c12672;
        ޤ r8;
        ޑ r12;
        if (interfaceC6575 instanceof C0641) {
            c0641 = (C0641) interfaceC6575;
            int i = c0641.f3016;
            if ((i & Integer.MIN_VALUE) != 0) {
                c0641.f3016 = i - Integer.MIN_VALUE;
            } else {
                c0641 = new C0641(interfaceC6575);
            }
        }
        Object objM7018 = c0641.f3015;
        EnumC6586 enumC6586 = EnumC6586.COROUTINE_SUSPENDED;
        int i2 = c0641.f3016;
        if (i2 == 0) {
            C4303.m7198(objM7018);
            C0640 c0640M339 = this.f2996.m339();
            if (c0640M339 == null || (r1 = c0640M339.f3013) == null) {
                return C6549.f19328;
            }
            Long l3 = r1.ޜ;
            if (l3 == null) {
                j2 = j;
                l2 = l;
                c0636 = this;
                r5 = r1;
                list = C6563.f19343;
                c06362 = c0636;
                j3 = j2;
                r4 = (ޤ) C6560.m9792(list);
                if (r4 != null && (c1267 = c06362.f2995) != null) {
                    long j5 = r5.އ;
                    long j6 = r4.ހ;
                    c0641.f3018 = c06362;
                    c0641.f3024 = j3;
                    c0641.f3019 = l2;
                    c0641.f3020 = r5;
                    c0641.f3021 = list;
                    c0641.f3022 = r4;
                    c0641.f3023 = c1267;
                    c0641.f3016 = 2;
                    objM7018 = C4303.m7018((InterfaceC6578) C1340.f4488, (InterfaceC6618) new ࢧ(j5, j6, (InterfaceC6575) null), (InterfaceC6575) c0641);
                    if (objM7018 != enumC6586) {
                        return enumC6586;
                    }
                    j4 = j3;
                    c12672 = c1267;
                    r8 = r4;
                    r12 = (ޑ) objM7018;
                    if (r12 != null) {
                    }
                }
                return C6549.f19328;
            }
            long jLongValue = l3.longValue();
            ʳ r32 = ʳ.ނ;
            long j7 = r1.ށ();
            c0641.f3018 = this;
            j2 = j;
            c0641.f3024 = j2;
            l2 = l;
            c0641.f3019 = l2;
            c0641.f3020 = r1;
            c0641.f3025 = jLongValue;
            c0641.f3016 = 1;
            Object obj = r32.֏(jLongValue, j7, l, c0641);
            if (obj == enumC6586) {
                return enumC6586;
            }
            c0636 = this;
            r3 = r1;
            objM7018 = obj;
        } else {
            if (i2 != 1) {
                if (i2 != 2) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                C1267 c12673 = (C1267) c0641.f3023;
                ޤ r42 = (ޤ) c0641.f3022;
                r5 = (ހ) c0641.f3020;
                long j8 = c0641.f3024;
                C4303.m7198(objM7018);
                r8 = r42;
                j4 = j8;
                c12672 = c12673;
                r12 = (ޑ) objM7018;
                if (r12 != null) {
                    long j9 = r5.އ;
                    if (c12672 == null) {
                        C6635.m9824("groupData");
                        throw null;
                    }
                    if (r8 == null) {
                        C6635.m9824("program");
                        throw null;
                    }
                    C4303.m7160(C1356.f4507, C1340.f4488, null, new ࢣ(j9, c12672, r8, j4, (InterfaceC6575) null), 2, null);
                } else {
                    long j10 = r12.֏;
                    long j11 = r5.އ;
                    if (c12672 == null) {
                        C6635.m9824("groupData");
                        throw null;
                    }
                    if (r8 == null) {
                        C6635.m9824("program");
                        throw null;
                    }
                    C4303.m7160(C1356.f4507, C1340.f4488, null, new ࢩ(j10, j11, c12672, r8, j4, (InterfaceC6575) null), 2, null);
                }
                return C6549.f19328;
            }
            r3 = (ހ) c0641.f3020;
            Long l4 = (Long) c0641.f3019;
            long j12 = c0641.f3024;
            c0636 = (C0636) c0641.f3018;
            C4303.m7198(objM7018);
            l2 = l4;
            j2 = j12;
        }
        list = (List) objM7018;
        if (list == null) {
            r1 = r3;
            r5 = r1;
            list = C6563.f19343;
            c06362 = c0636;
            j3 = j2;
            r4 = (ޤ) C6560.m9792(list);
            if (r4 != null) {
            }
            return C6549.f19328;
        }
        r5 = r3;
        c06362 = c0636;
        j3 = j2;
        r4 = (ޤ) C6560.m9792(list);
        if (r4 != null) {
            long j52 = r5.އ;
            long j62 = r4.ހ;
            c0641.f3018 = c06362;
            c0641.f3024 = j3;
            c0641.f3019 = l2;
            c0641.f3020 = r5;
            c0641.f3021 = list;
            c0641.f3022 = r4;
            c0641.f3023 = c1267;
            c0641.f3016 = 2;
            objM7018 = C4303.m7018((InterfaceC6578) C1340.f4488, (InterfaceC6618) new ࢧ(j52, j62, (InterfaceC6575) null), (InterfaceC6575) c0641);
            if (objM7018 != enumC6586) {
            }
        }
        return C6549.f19328;
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x0013  */
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final /* synthetic */ Object m1971(ހ r10, InterfaceC6575<? super ޤ> interfaceC6575) {
        C0642 c0642;
        if (interfaceC6575 instanceof C0642) {
            c0642 = (C0642) interfaceC6575;
            int i = c0642.f3027;
            if ((i & Integer.MIN_VALUE) != 0) {
                c0642.f3027 = i - Integer.MIN_VALUE;
            } else {
                c0642 = new C0642(interfaceC6575);
            }
        }
        C0642 c06422 = c0642;
        Object obj = c06422.f3026;
        EnumC6586 enumC6586 = EnumC6586.COROUTINE_SUSPENDED;
        int i2 = c06422.f3027;
        if (i2 == 0) {
            C4303.m7198(obj);
            Long l = r10.ޜ;
            if (l == null) {
                return null;
            }
            long jLongValue = l.longValue();
            ޤ r11 = ʳ.ނ.֏(jLongValue, r10.ށ());
            if (r11 != null) {
                return r11;
            }
            ʳ r1 = ʳ.ނ;
            long j = r10.ށ();
            c06422.f3029 = this;
            c06422.f3030 = r10;
            c06422.f3031 = jLongValue;
            c06422.f3027 = 1;
            obj = r1.֏(jLongValue, j, c06422);
            if (obj == enumC6586) {
                return enumC6586;
            }
        } else {
            if (i2 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            C4303.m7198(obj);
        }
        return (ޤ) obj;
    }

    /* JADX WARN: Removed duplicated region for block: B:48:0x011c  */
    /* JADX WARN: Removed duplicated region for block: B:61:0x01e8  */
    /* JADX WARN: Removed duplicated region for block: B:7:0x0017  */
    /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:52:0x014d -> B:58:0x01be). Please report as a decompilation issue!!! */
    /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:56:0x019d -> B:57:0x01ae). Please report as a decompilation issue!!! */
    /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:59:0x01c3 -> B:60:0x01d7). Please report as a decompilation issue!!! */
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final /* synthetic */ Object m1972(String str, InterfaceC6575<? super List<C0639>> interfaceC6575) {
        C0644 c0644;
        int i;
        List list;
        C0636 c0636;
        Iterable iterable;
        Iterable iterable2;
        EnumC6586 enumC6586;
        LongSparseArray longSparseArray;
        Collection arrayList;
        Iterator it;
        String str2;
        C0644 c06442;
        List list2;
        int i2;
        if (interfaceC6575 instanceof C0644) {
            c0644 = (C0644) interfaceC6575;
            int i3 = c0644.f3034;
            if ((i3 & Integer.MIN_VALUE) != 0) {
                c0644.f3034 = i3 - Integer.MIN_VALUE;
            } else {
                c0644 = new C0644(interfaceC6575);
            }
        }
        Object obj = c0644.f3033;
        EnumC6586 enumC65862 = EnumC6586.COROUTINE_SUSPENDED;
        int i4 = c0644.f3034;
        if (i4 == 0) {
            C4303.m7198(obj);
            int i5 = 0;
            try {
                i = Integer.parseInt(str);
            } catch (NumberFormatException unused) {
                i = 0;
            }
            C0640 c0640M339 = this.f2996.m339();
            if (c0640M339 == null || (list = c0640M339.f3014) == null) {
                list = C6563.f19343;
            }
            if (i <= 0 || i > list.size()) {
                return C6563.f19343;
            }
            LongSparseArray longSparseArray2 = new LongSparseArray();
            for (Object obj2 : list) {
                int i6 = i5 + 1;
                if (i5 < 0) {
                    C4303.m7193();
                    throw null;
                }
                ؠ r8 = (ؠ) obj2;
                int iIntValue = new Integer(i5).intValue() + 1;
                if (iIntValue == i || (iIntValue >= i * 10 && iIntValue < (i + 1) * 10)) {
                    longSparseArray2.put(r8.ؠ, new Integer(iIntValue));
                }
                i5 = i6;
            }
            InterfaceC6684 interfaceC6684M7070 = C4303.m7070((Iterator) new C1900(longSparseArray2));
            LinkedHashSet linkedHashSet = new LinkedHashSet();
            C4303.m7039(interfaceC6684M7070, linkedHashSet);
            Set setM9785 = C6560.m9785((Set) linkedHashSet);
            if (setM9785 == null) {
                C6635.m9824("ids");
                throw null;
            }
            List listM9778 = C6560.m9778((Iterable) ar.tvplayer.core.data.db.ހ.֏().އ().֏(setM9785), (Comparator) new C0645(longSparseArray2));
            c0636 = this;
            iterable = listM9778;
            iterable2 = iterable;
            enumC6586 = enumC65862;
            longSparseArray = longSparseArray2;
            arrayList = new ArrayList(C4303.m6985(listM9778, 10));
            it = listM9778.iterator();
            str2 = str;
            c06442 = c0644;
            list2 = list;
            i2 = i;
            if (it.hasNext()) {
            }
        } else {
            if (i4 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            Collection collection = (Collection) c0644.f3047;
            String str3 = (String) c0644.f3046;
            ހ r82 = (ހ) c0644.f3045;
            Iterator it2 = (Iterator) c0644.f3043;
            Collection collection2 = (Collection) c0644.f3042;
            Iterable iterable3 = (Iterable) c0644.f3041;
            Iterable iterable4 = (Iterable) c0644.f3040;
            LongSparseArray longSparseArray3 = (LongSparseArray) c0644.f3039;
            List list3 = (List) c0644.f3038;
            int i7 = c0644.f3048;
            String str4 = (String) c0644.f3037;
            C0636 c06362 = (C0636) c0644.f3036;
            C4303.m7198(obj);
            int i8 = i7;
            longSparseArray = longSparseArray3;
            iterable = iterable3;
            ޤ r1 = (ޤ) obj;
            C0636 c06363 = c06362;
            ހ r6 = r82;
            Collection collection3 = collection2;
            c06442 = c0644;
            arrayList = collection;
            Iterator it3 = it2;
            enumC6586 = enumC65862;
            String str5 = str3;
            list2 = list3;
            iterable2 = iterable4;
            it = it3;
            String str6 = str4;
            i2 = i8;
            arrayList.add(new C0639(r6, str5, r1));
            c0636 = c06363;
            arrayList = collection3;
            str2 = str6;
            if (it.hasNext()) {
                Object next = it.next();
                r6 = (ހ) next;
                String strValueOf = String.valueOf(((Number) longSparseArray.get(r6.އ)).intValue());
                Long l = r6.ޜ;
                if (l != null) {
                    long jLongValue = l.longValue();
                    EnumC6586 enumC65863 = enumC6586;
                    collection3 = arrayList;
                    ޤ r0 = ʳ.ނ.֏(jLongValue, r6.ށ());
                    if (r0 != null) {
                        str5 = strValueOf;
                        i8 = i2;
                        enumC6586 = enumC65863;
                        arrayList = collection3;
                        str4 = str2;
                        r1 = r0;
                        c06363 = c0636;
                        String str62 = str4;
                        i2 = i8;
                        arrayList.add(new C0639(r6, str5, r1));
                        c0636 = c06363;
                        arrayList = collection3;
                        str2 = str62;
                        if (it.hasNext()) {
                            return (List) arrayList;
                        }
                    } else {
                        ʳ r02 = ʳ.ނ;
                        long j = r6.ށ();
                        c06442.f3036 = c0636;
                        c06442.f3037 = str2;
                        c06442.f3048 = i2;
                        c06442.f3038 = list2;
                        c06442.f3039 = longSparseArray;
                        c06442.f3040 = iterable2;
                        c06442.f3041 = iterable;
                        String str7 = str2;
                        c06442.f3042 = collection3;
                        c06442.f3043 = it;
                        c06442.f3044 = next;
                        c06442.f3045 = r6;
                        c06442.f3046 = strValueOf;
                        c06442.f3049 = jLongValue;
                        c06442.f3047 = collection3;
                        C0636 c06364 = c0636;
                        c06442.f3034 = 1;
                        i8 = i2;
                        List list4 = list2;
                        Object obj3 = r02.֏(jLongValue, j, c06442);
                        enumC65862 = enumC65863;
                        if (obj3 == enumC65862) {
                            return enumC65862;
                        }
                        str3 = strValueOf;
                        collection = collection3;
                        collection2 = collection;
                        obj = obj3;
                        c0644 = c06442;
                        c06362 = c06364;
                        str4 = str7;
                        r82 = r6;
                        Iterable iterable5 = iterable2;
                        list3 = list4;
                        it2 = it;
                        iterable4 = iterable5;
                        ޤ r12 = (ޤ) obj;
                        C0636 c063632 = c06362;
                        ހ r62 = r82;
                        Collection collection32 = collection2;
                        c06442 = c0644;
                        arrayList = collection;
                        Iterator it32 = it2;
                        enumC6586 = enumC65862;
                        String str52 = str3;
                        list2 = list3;
                        iterable2 = iterable4;
                        it = it32;
                        String str622 = str4;
                        i2 = i8;
                        arrayList.add(new C0639(r62, str52, r12));
                        c0636 = c063632;
                        arrayList = collection32;
                        str2 = str622;
                        if (it.hasNext()) {
                        }
                    }
                } else {
                    str622 = str2;
                    enumC6586 = enumC6586;
                    r12 = null;
                    str52 = strValueOf;
                    c063632 = c0636;
                    collection32 = arrayList;
                    arrayList.add(new C0639(r62, str52, r12));
                    c0636 = c063632;
                    arrayList = collection32;
                    str2 = str622;
                    if (it.hasNext()) {
                    }
                }
            }
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:137:0x038f  */
    /* JADX WARN: Removed duplicated region for block: B:141:0x0396  */
    /* JADX WARN: Removed duplicated region for block: B:184:0x04b1  */
    /* JADX WARN: Removed duplicated region for block: B:188:0x04b8  */
    /* JADX WARN: Removed duplicated region for block: B:21:0x00c0  */
    /* JADX WARN: Removed duplicated region for block: B:236:0x0625  */
    /* JADX WARN: Removed duplicated region for block: B:249:0x0697  */
    /* JADX WARN: Removed duplicated region for block: B:265:0x0321 A[SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:267:0x045a A[SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:269:0x05f1 A[SYNTHETIC] */
    /* JADX WARN: Removed duplicated region for block: B:26:0x00fe  */
    /* JADX WARN: Removed duplicated region for block: B:7:0x0019  */
    /* JADX WARN: Removed duplicated region for block: B:85:0x024e  */
    /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:247:0x0676 -> B:248:0x0682). Please report as a decompilation issue!!! */
    /* JADX WARN: Unsupported multi-entry loop pattern (BACK_EDGE: B:24:0x00e4 -> B:25:0x00eb). Please report as a decompilation issue!!! */
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final /* synthetic */ Object m1973(List<C0639> list, InterfaceC6575<? super List<C0639>> interfaceC6575) {
        C0649 c0649;
        Iterable iterable;
        Iterable iterable2;
        Iterable iterable3;
        C0636 c0636;
        Iterator it;
        LongSparseArray longSparseArray;
        C0649 c06492;
        Collection collection;
        List<C0639> list2;
        C0649 c06493;
        EnumC6586 enumC6586;
        Iterator it2;
        ArrayList arrayList;
        List list3;
        LongSparseArray longSparseArray2;
        List<ހ> list4;
        ކ r22;
        int i;
        ar.tvplayer.core.data.db.dao.ؠ r1;
        C2409 c2409M4490;
        Cursor cursorM4504;
        ArrayList arrayList2;
        List<ؠ> listM2922;
        int i2;
        ar.tvplayer.core.data.db.dao.ؠ r12;
        String str;
        int i3;
        ar.tvplayer.core.data.db.dao.ؠ r13;
        Collection arrayList3;
        C0636 c06362;
        Iterator it3;
        EnumC6586 enumC65862;
        Iterable iterable4;
        C0649 c06494;
        Iterable iterable5;
        int i4;
        C0636 c06363 = this;
        List<C0639> list5 = list;
        if (interfaceC6575 instanceof C0649) {
            c0649 = (C0649) interfaceC6575;
            int i5 = c0649.f3064;
            if ((i5 & Integer.MIN_VALUE) != 0) {
                c0649.f3064 = i5 - Integer.MIN_VALUE;
            } else {
                c0649 = c06363.new C0649(interfaceC6575);
            }
        }
        Object obj = c0649.f3063;
        EnumC6586 enumC65863 = EnumC6586.COROUTINE_SUSPENDED;
        int i6 = c0649.f3064;
        if (i6 == 0) {
            C4303.m7198(obj);
            if (list5 != null) {
                arrayList3 = new ArrayList(C4303.m6985(list5, 10));
                c06362 = c06363;
                it3 = list.iterator();
                enumC65862 = enumC65863;
                iterable4 = list5;
                c06494 = c0649;
                iterable5 = iterable4;
                if (it3.hasNext()) {
                }
            } else {
                List list6 = ޒ.֏.֏(c06363.f2994, ރ.ߠ.ޤ());
                if (c06363.f3005.get()) {
                    return C6563.f19343;
                }
                LongSparseArray longSparseArray3 = new LongSparseArray();
                LinkedHashMap linkedHashMap = new LinkedHashMap();
                ArrayList arrayList4 = (ArrayList) list6;
                for (Object obj2 : arrayList4) {
                    C1267 c1267 = ((ހ) obj2).ؠ();
                    Object arrayList5 = linkedHashMap.get(c1267);
                    if (arrayList5 == null) {
                        arrayList5 = new ArrayList();
                        linkedHashMap.put(c1267, arrayList5);
                    }
                    ((List) arrayList5).add(obj2);
                }
                Iterator it4 = linkedHashMap.entrySet().iterator();
                while (it4.hasNext()) {
                    Map.Entry entry = (Map.Entry) it4.next();
                    C1267 c12672 = (C1267) entry.getKey();
                    List list7 = (List) entry.getValue();
                    if (c12672 != null) {
                        if (C6635.m9825(c12672, c06363.f2995)) {
                            C0640 c0640M339 = c06363.f2996.m339();
                            if (c0640M339 != null) {
                                listM2922 = c0640M339.f3014;
                                c06493 = c0649;
                                enumC6586 = enumC65863;
                                list3 = list6;
                                longSparseArray2 = longSparseArray3;
                                it2 = it4;
                                arrayList = arrayList4;
                                list4 = list7;
                            } else {
                                c06493 = c0649;
                                enumC6586 = enumC65863;
                                list3 = list6;
                                longSparseArray2 = longSparseArray3;
                                it2 = it4;
                                arrayList = arrayList4;
                                list4 = list7;
                                listM2922 = null;
                            }
                        } else {
                            ކ r132 = ar.tvplayer.core.data.repositories.ހ.֏(c12672);
                            if (c06363.f3005.get()) {
                                return C6563.f19343;
                            }
                            EnumC1270 enumC1270M2558 = c12672.m2558();
                            int iOrdinal = enumC1270M2558.ordinal();
                            c06493 = c0649;
                            enumC6586 = enumC65863;
                            it2 = it4;
                            arrayList = arrayList4;
                            list3 = list6;
                            if (iOrdinal == 1) {
                                longSparseArray2 = longSparseArray3;
                                list4 = list7;
                                r22 = r132;
                                ar.tvplayer.core.data.db.dao.ؠ r14 = ar.tvplayer.core.data.db.ހ.֏().އ();
                                long j = c12672.f4385;
                                if (!(ޏ.ވ.ހ().length() > 0)) {
                                    if (CommonUtilsKt.ރ()) {
                                        ޏ r2 = ޏ.ވ;
                                        if (r2 == null) {
                                            throw null;
                                        }
                                        boolean z = ((Number) ޏ.ބ.m9835(r2, ޏ.ށ[2])).intValue() == 2;
                                        boolean z2 = ar.tvplayer.core.domain.ޑ.֏;
                                        boolean z3 = C1255.f4369;
                                        boolean z4 = ލ.ؠ;
                                        if (z && z2 && (!z3 || z4)) {
                                            i = 1;
                                        }
                                        r1 = r14;
                                        if (r1 != null) {
                                            throw null;
                                        }
                                        c2409M4490 = C2409.m4490("\n        SELECT c.id, c.name, c.custom_name, c.playlist_id, p.name playlist_name, p.position playlist_position,\n        c.position_in_playlist, m.position manual_position, c.watch_time\n        FROM channels c\n        INNER JOIN playlists p ON c.playlist_id == p.id\n        LEFT OUTER JOIN channel_manual_positions m ON c.id == m.channel_id\n            AND m.type == 2\n            AND m.playlist_id == ?\n        LEFT OUTER JOIN channel_group_options o ON o.playlist_id == c.playlist_id\n            AND o.type == 4\n            AND o.group_name == c.`group`\n        LEFT OUTER JOIN channel_group_options o2 ON o2.playlist_id == ?\n            AND o2.type == 2\n        WHERE p.is_enabled == 1\n            AND c.is_vod == 0\n            AND (c.is_visible == 1 OR ? == 0)\n            AND CASE WHEN ? == 0\n                THEN p.is_visible_in_all_channels == 1\n                ELSE p.id == ?\n                END\n            AND (o.is_visible IS NULL OR o.is_visible == 1\n                OR (o2.show_channels_from_hidden_groups IS NOT NULL AND o2.show_channels_from_hidden_groups == 1)\n                OR ? == 0)\n        ", 6);
                                        c2409M4490.bindLong(1, j);
                                        c2409M4490.bindLong(2, j);
                                        long j2 = i;
                                        c2409M4490.bindLong(3, j2);
                                        c2409M4490.bindLong(4, j);
                                        c2409M4490.bindLong(5, j);
                                        c2409M4490.bindLong(6, j2);
                                        r1.֏.m4478();
                                        cursorM4504 = C2421.m4504(r1.֏, c2409M4490, false, null);
                                        try {
                                            int iM2969 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "id");
                                            int iM29692 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "name");
                                            int iM29693 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "custom_name");
                                            int iM29694 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "playlist_id");
                                            int iM29695 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "playlist_name");
                                            int iM29696 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "playlist_position");
                                            int iM29697 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "position_in_playlist");
                                            int iM29698 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "manual_position");
                                            int iM29699 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "watch_time");
                                            ArrayList arrayList6 = new ArrayList(cursorM4504.getCount());
                                            while (cursorM4504.moveToNext()) {
                                                arrayList6.add(new ؠ(cursorM4504.getLong(iM2969), cursorM4504.getString(iM29692), cursorM4504.getString(iM29693), cursorM4504.getLong(iM29694), cursorM4504.getString(iM29695), cursorM4504.isNull(iM29696) ? null : Integer.valueOf(cursorM4504.getInt(iM29696)), cursorM4504.getInt(iM29697), cursorM4504.isNull(iM29698) ? null : Integer.valueOf(cursorM4504.getInt(iM29698)), cursorM4504.getLong(iM29699)));
                                            }
                                            cursorM4504.close();
                                            c2409M4490.m4493();
                                            arrayList2 = arrayList6;
                                        } finally {
                                        }
                                    }
                                    i = 0;
                                    r1 = r14;
                                    if (r1 != null) {
                                    }
                                }
                            } else if (iOrdinal == 2) {
                                longSparseArray2 = longSparseArray3;
                                list4 = list7;
                                r22 = r132;
                                ar.tvplayer.core.data.db.dao.ؠ r15 = ar.tvplayer.core.data.db.ހ.֏().އ();
                                long j3 = c12672.f4385;
                                if (!(ޏ.ވ.ހ().length() > 0)) {
                                    if (CommonUtilsKt.ރ()) {
                                        ޏ r23 = ޏ.ވ;
                                        if (r23 == null) {
                                            throw null;
                                        }
                                        boolean z5 = ((Number) ޏ.ބ.m9835(r23, ޏ.ށ[2])).intValue() == 2;
                                        boolean z6 = ar.tvplayer.core.domain.ޑ.֏;
                                        boolean z7 = C1255.f4369;
                                        boolean z8 = ލ.ؠ;
                                        if (z5 && z6 && (!z7 || z8)) {
                                            i2 = 1;
                                        }
                                        r12 = r15;
                                        if (r12 != null) {
                                            throw null;
                                        }
                                        c2409M4490 = C2409.m4490("\n        SELECT c.id, c.name, c.custom_name, c.playlist_id, p.name playlist_name, p.position playlist_position,\n        c.position_in_playlist, m.position manual_position, c.watch_time\n        FROM channels c\n        INNER JOIN playlists p ON c.playlist_id == p.id\n        LEFT OUTER JOIN channel_manual_positions m ON c.id == m.channel_id\n            AND m.type == 3\n            AND m.playlist_id == ?\n        LEFT OUTER JOIN channel_group_options o ON o.playlist_id == c.playlist_id\n            AND o.type == 4\n            AND o.group_name == c.`group`\n        LEFT OUTER JOIN channel_group_options o2 ON o2.playlist_id == ?\n            AND o2.type == 3\n        WHERE p.is_enabled == 1\n            AND (c.is_visible == 1 OR ? == 0)\n            AND (c.is_favorite == 1 AND ? == 1)\n            AND CASE WHEN ? == 0\n                THEN p.is_visible_in_all_favorites == 1\n                ELSE p.id == ?\n                END\n            AND (o.is_visible IS NULL OR o.is_visible == 1\n                OR (o2.show_channels_from_hidden_groups IS NOT NULL AND o2.show_channels_from_hidden_groups == 1)\n                OR ? == 0)\n        ", 7);
                                        c2409M4490.bindLong(1, j3);
                                        c2409M4490.bindLong(2, j3);
                                        long j4 = i2;
                                        c2409M4490.bindLong(3, j4);
                                        c2409M4490.bindLong(4, j4);
                                        c2409M4490.bindLong(5, j3);
                                        c2409M4490.bindLong(6, j3);
                                        c2409M4490.bindLong(7, j4);
                                        r12.֏.m4478();
                                        cursorM4504 = C2421.m4504(r12.֏, c2409M4490, false, null);
                                        try {
                                            int iM296910 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "id");
                                            int iM296911 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "name");
                                            int iM296912 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "custom_name");
                                            int iM296913 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "playlist_id");
                                            int iM296914 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "playlist_name");
                                            int iM296915 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "playlist_position");
                                            int iM296916 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "position_in_playlist");
                                            int iM296917 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "manual_position");
                                            int iM296918 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "watch_time");
                                            arrayList2 = new ArrayList(cursorM4504.getCount());
                                            while (cursorM4504.moveToNext()) {
                                                arrayList2.add(new ؠ(cursorM4504.getLong(iM296910), cursorM4504.getString(iM296911), cursorM4504.getString(iM296912), cursorM4504.getLong(iM296913), cursorM4504.getString(iM296914), cursorM4504.isNull(iM296915) ? null : Integer.valueOf(cursorM4504.getInt(iM296915)), cursorM4504.getInt(iM296916), cursorM4504.isNull(iM296917) ? null : Integer.valueOf(cursorM4504.getInt(iM296917)), cursorM4504.getLong(iM296918)));
                                            }
                                        } finally {
                                        }
                                    }
                                    i2 = 0;
                                    r12 = r15;
                                    if (r12 != null) {
                                    }
                                }
                            } else {
                                if (iOrdinal != 3) {
                                    throw new IllegalStateException("Unhandled group type: " + enumC1270M2558);
                                }
                                ar.tvplayer.core.data.db.dao.ؠ r16 = ar.tvplayer.core.data.db.ހ.֏().އ();
                                r22 = r132;
                                long j5 = c12672.f4385;
                                String str2 = c12672.f4386;
                                if (ޏ.ވ.ހ().length() > 0) {
                                    longSparseArray2 = longSparseArray3;
                                    list4 = list7;
                                    str = "watch_time";
                                } else {
                                    if (CommonUtilsKt.ރ()) {
                                        ޏ r122 = ޏ.ވ;
                                        if (r122 == null) {
                                            throw null;
                                        }
                                        longSparseArray2 = longSparseArray3;
                                        list4 = list7;
                                        str = "watch_time";
                                        boolean z9 = ((Number) ޏ.ބ.m9835(r122, ޏ.ށ[2])).intValue() == 2;
                                        boolean z10 = ar.tvplayer.core.domain.ޑ.֏;
                                        boolean z11 = C1255.f4369;
                                        boolean z12 = ލ.ؠ;
                                        if (!z9 || !z10 || (z11 && !z12)) {
                                        }
                                        r13 = r16;
                                        if (r13 == null) {
                                            throw null;
                                        }
                                        c2409M4490 = C2409.m4490("\n        SELECT c.id, c.name, c.custom_name, c.playlist_id, p.name playlist_name, p.position playlist_position,\n        c.position_in_playlist, m.position manual_position, c.watch_time\n        FROM channels c\n        INNER JOIN playlists p ON c.playlist_id == p.id\n        LEFT OUTER JOIN channel_manual_positions m ON c.id == m.channel_id\n            AND m.type == 4\n            AND m.playlist_id == ?\n            AND m.group_name == ?\n        LEFT OUTER JOIN channel_group_options o ON o.playlist_id == c.playlist_id\n            AND o.type == 4\n            AND o.group_name == c.`group`\n        WHERE p.is_enabled == 1\n            AND (c.is_visible == 1 OR ? == 0)\n            AND p.id == ?\n            AND c.`group` == ?\n            AND (o.is_visible IS NULL OR o.is_visible == 1 OR ? == 0)\n            AND (o.are_favorites_only IS NULL OR o.are_favorites_only == 0 OR c.is_favorite == 1 OR ? == 0)\n        ", 7);
                                        c2409M4490.bindLong(1, j5);
                                        if (str2 == null) {
                                            c2409M4490.bindNull(2);
                                        } else {
                                            c2409M4490.bindString(2, str2);
                                        }
                                        long j6 = i3;
                                        c2409M4490.bindLong(3, j6);
                                        c2409M4490.bindLong(4, j5);
                                        if (str2 == null) {
                                            c2409M4490.bindNull(5);
                                        } else {
                                            c2409M4490.bindString(5, str2);
                                        }
                                        c2409M4490.bindLong(6, j6);
                                        c2409M4490.bindLong(7, j6);
                                        r13.֏.m4478();
                                        cursorM4504 = C2421.m4504(r13.֏, c2409M4490, false, null);
                                        try {
                                            int iM296919 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "id");
                                            int iM296920 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "name");
                                            int iM296921 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "custom_name");
                                            int iM296922 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "playlist_id");
                                            int iM296923 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "playlist_name");
                                            int iM296924 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "playlist_position");
                                            int iM296925 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "position_in_playlist");
                                            int iM296926 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, "manual_position");
                                            int iM296927 = LayoutInflaterFactory2C1494.C1505.m2969(cursorM4504, str);
                                            arrayList2 = new ArrayList(cursorM4504.getCount());
                                            while (cursorM4504.moveToNext()) {
                                                arrayList2.add(new ؠ(cursorM4504.getLong(iM296919), cursorM4504.getString(iM296920), cursorM4504.getString(iM296921), cursorM4504.getLong(iM296922), cursorM4504.getString(iM296923), cursorM4504.isNull(iM296924) ? null : Integer.valueOf(cursorM4504.getInt(iM296924)), cursorM4504.getInt(iM296925), cursorM4504.isNull(iM296926) ? null : Integer.valueOf(cursorM4504.getInt(iM296926)), cursorM4504.getLong(iM296927)));
                                            }
                                        } finally {
                                        }
                                    } else {
                                        longSparseArray2 = longSparseArray3;
                                        list4 = list7;
                                        str = "watch_time";
                                    }
                                    i3 = 0;
                                    r13 = r16;
                                    if (r13 == null) {
                                    }
                                }
                                i3 = 1;
                                r13 = r16;
                                if (r13 == null) {
                                }
                            }
                            listM2922 = LayoutInflaterFactory2C1494.C1505.m2922(arrayList2, LayoutInflaterFactory2C1494.C1505.m2901(r22), LayoutInflaterFactory2C1494.C1505.m2973(r22));
                        }
                        if (listM2922 != null) {
                            for (ހ r17 : list4) {
                                long j7 = r17.އ;
                                Iterator<ؠ> it5 = listM2922.iterator();
                                int i7 = 0;
                                while (true) {
                                    if (!it5.hasNext()) {
                                        i7 = -1;
                                        break;
                                    }
                                    if (Boolean.valueOf(it5.next().ؠ == r17.އ).booleanValue()) {
                                        break;
                                    }
                                    i7++;
                                }
                                longSparseArray2.put(j7, new Integer(i7));
                            }
                        }
                        LongSparseArray longSparseArray4 = longSparseArray2;
                        if (this.f3005.get()) {
                            return C6563.f19343;
                        }
                        c06363 = this;
                        longSparseArray3 = longSparseArray4;
                        c0649 = c06493;
                        enumC65863 = enumC6586;
                        it4 = it2;
                        arrayList4 = arrayList;
                        list6 = list3;
                    }
                }
                List list8 = list6;
                LongSparseArray longSparseArray5 = longSparseArray3;
                ArrayList arrayList7 = new ArrayList(C4303.m6985(list8, 10));
                iterable = list8;
                iterable2 = iterable;
                iterable3 = iterable2;
                c0636 = c06363;
                it = arrayList4.iterator();
                longSparseArray = longSparseArray5;
                c06492 = c0649;
                collection = arrayList7;
                list2 = list;
                if (it.hasNext()) {
                }
            }
        } else if (i6 == 1) {
            Collection collection2 = (Collection) c0649.f3074;
            C0639 c0639 = (C0639) c0649.f3073;
            Iterator it6 = (Iterator) c0649.f3071;
            Collection collection3 = (Collection) c0649.f3070;
            Iterable iterable6 = (Iterable) c0649.f3069;
            Iterable iterable7 = (Iterable) c0649.f3068;
            List<C0639> list9 = (List) c0649.f3067;
            c06362 = (C0636) c0649.f3066;
            C4303.m7198(obj);
            c06494 = c0649;
            iterable5 = iterable6;
            Iterator it7 = it6;
            enumC65862 = enumC65863;
            collection2.add(new C0639(c0639.f3010, c0639.f3011, (ޤ) obj));
            arrayList3 = collection3;
            it3 = it7;
            iterable4 = iterable7;
            list5 = list9;
            if (it3.hasNext()) {
                Object next = it3.next();
                C0639 c06392 = (C0639) next;
                ހ r11 = c06392.f3010;
                c06494.f3066 = c06362;
                c06494.f3067 = list5;
                c06494.f3068 = iterable4;
                c06494.f3069 = iterable5;
                c06494.f3070 = arrayList3;
                c06494.f3071 = it3;
                c06494.f3072 = next;
                c06494.f3073 = c06392;
                c06494.f3074 = arrayList3;
                c06494.f3064 = 1;
                Object objM1971 = c06362.m1971(r11, c06494);
                if (objM1971 == enumC65862) {
                    return enumC65862;
                }
                list9 = list5;
                collection2 = arrayList3;
                c0639 = c06392;
                iterable7 = iterable4;
                obj = objM1971;
                it7 = it3;
                collection3 = collection2;
                collection2.add(new C0639(c0639.f3010, c0639.f3011, (ޤ) obj));
                arrayList3 = collection3;
                it3 = it7;
                iterable4 = iterable7;
                list5 = list9;
                if (it3.hasNext()) {
                    return (List) arrayList3;
                }
            }
        } else {
            if (i6 != 2) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            Collection collection4 = (Collection) c0649.f3077;
            String str3 = (String) c0649.f3076;
            ހ r8 = (ހ) c0649.f3075;
            Iterator it8 = (Iterator) c0649.f3073;
            Collection collection5 = (Collection) c0649.f3072;
            Iterable iterable8 = (Iterable) c0649.f3071;
            Iterable iterable9 = (Iterable) c0649.f3070;
            LongSparseArray longSparseArray6 = (LongSparseArray) c0649.f3069;
            List list10 = (List) c0649.f3068;
            List<C0639> list11 = (List) c0649.f3067;
            C0636 c06364 = (C0636) c0649.f3066;
            C4303.m7198(obj);
            EnumC6586 enumC65864 = enumC65863;
            Iterable iterable10 = list10;
            LongSparseArray longSparseArray7 = longSparseArray6;
            Iterable iterable11 = iterable9;
            Iterable iterable12 = iterable8;
            Iterator it9 = it8;
            ހ r9 = r8;
            C0636 c06365 = c06364;
            C0649 c06495 = c0649;
            Object obj3 = obj;
            collection = collection5;
            String strValueOf = str3;
            collection4.add(new C0639(r9, strValueOf, (ޤ) obj3));
            c06492 = c06495;
            enumC65863 = enumC65864;
            c0636 = c06365;
            it = it9;
            iterable = iterable12;
            iterable2 = iterable11;
            longSparseArray = longSparseArray7;
            list2 = list11;
            iterable3 = iterable10;
            if (it.hasNext()) {
                Object next2 = it.next();
                ހ r82 = (ހ) next2;
                enumC65864 = enumC65863;
                Object num = longSparseArray.get(r82.އ);
                if (num != null) {
                    i4 = -1;
                } else {
                    i4 = -1;
                    num = new Integer(-1);
                }
                int iIntValue = ((Number) num).intValue();
                strValueOf = iIntValue != i4 ? String.valueOf(iIntValue + 1) : "";
                c06492.f3066 = c0636;
                c06492.f3067 = list2;
                c06492.f3068 = iterable3;
                c06492.f3069 = longSparseArray;
                c06492.f3070 = iterable2;
                c06492.f3071 = iterable;
                c06492.f3072 = collection;
                c06492.f3073 = it;
                c06492.f3074 = next2;
                c06492.f3075 = r82;
                c06492.f3076 = strValueOf;
                c06492.f3078 = iIntValue;
                c06492.f3077 = collection;
                c06492.f3064 = 2;
                Object objM19712 = c0636.m1971(r82, c06492);
                if (objM19712 == enumC65864) {
                    return enumC65864;
                }
                iterable10 = iterable3;
                longSparseArray7 = longSparseArray;
                iterable11 = iterable2;
                iterable12 = iterable;
                it9 = it;
                r9 = r82;
                c06365 = c0636;
                c06495 = c06492;
                obj3 = objM19712;
                list11 = list2;
                collection4 = collection;
                collection4.add(new C0639(r9, strValueOf, (ޤ) obj3));
                c06492 = c06495;
                enumC65863 = enumC65864;
                c0636 = c06365;
                it = it9;
                iterable = iterable12;
                iterable2 = iterable11;
                longSparseArray = longSparseArray7;
                list2 = list11;
                iterable3 = iterable10;
                if (it.hasNext()) {
                    return (List) collection;
                }
            }
        }
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x0013  */
    /* JADX WARN: Type inference failed for: r2v1, types: [T, java.util.List<ނ.֏.֏.֏.֏.ၮ$ހ>] */
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object m1974(InterfaceC6575<? super List<C0639>> interfaceC6575) {
        C0647 c0647;
        C0636 c0636;
        C6646 c6646;
        if (interfaceC6575 instanceof C0647) {
            c0647 = (C0647) interfaceC6575;
            int i = c0647.f3053;
            if ((i & Integer.MIN_VALUE) != 0) {
                c0647.f3053 = i - Integer.MIN_VALUE;
            } else {
                c0647 = new C0647(interfaceC6575);
            }
        }
        Object obj = c0647.f3052;
        EnumC6586 enumC6586 = EnumC6586.COROUTINE_SUSPENDED;
        int i2 = c0647.f3053;
        if (i2 == 0) {
            C4303.m7198(obj);
            C6646 c66462 = new C6646();
            c66462.f19405 = this.f3003;
            AbstractC1323 abstractC1323 = C1340.f4488;
            C0648 c0648 = new C0648(c66462, null);
            c0647.f3055 = this;
            c0647.f3056 = c66462;
            c0647.f3053 = 1;
            if (C4303.m7018(abstractC1323, c0648, c0647) == enumC6586) {
                return enumC6586;
            }
            c0636 = this;
            c6646 = c66462;
        } else {
            if (i2 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            c6646 = (C6646) c0647.f3056;
            c0636 = (C0636) c0647.f3055;
            C4303.m7198(obj);
        }
        List<C0639> list = (List) c6646.f19405;
        c0636.f3003 = list;
        if (list != null) {
            return list;
        }
        C6635.m9822();
        throw null;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m1975(long j, C1267 c1267) {
        this.f3007.m4298("channel_id", Long.valueOf(j));
        this.f3007.m4298("channel_group", c1267);
        this.f2996.mo345(C0640.m1983(m1981(), null, null, 2));
        LiveData<ހ> liveData = this.f2997;
        if (liveData != null) {
            this.f2996.m4289(liveData);
        }
        this.f2994 = j;
        ar.tvplayer.core.data.db.dao.ؠ r0 = ar.tvplayer.core.data.db.ހ.֏().އ();
        if (r0 == null) {
            throw null;
        }
        C2409 c2409M4490 = C2409.m4490("\n        SELECT c.id, c.playlist_id, p.url playlist_url, p.name playlist_name, p.is_vod is_playlist_vod,\n        p.tvg_shift playlist_tvg_shift, p.catchup_type playlist_catchup_type, p.catchup_days playlist_catchup_days,\n        p.user_catchup_type playlist_user_catchup_type, p.user_catchup_days playlist_user_catchup_days,\n        p.catchup_source playlist_catchup_source, p.user_catchup_time_offset playlist_catchup_time_offset,\n        p.server_timezone playlist_server_timezone, c.server_timezone, c.name, c.custom_name, c.url, c.logo, c.`group`,\n        t.icon_url logo_from_tvg, c.tvg_shift, b.tvg_channel_id tvg_channel_id, s.time_offset tvg_source_time_offset,\n        c.user_tvg_time_offset, c.drm_scheme, c.drm_license_url, c.catchup_type, c.catchup_days, c.catchup_source,\n        c.is_vod, c.is_favorite, c.is_blocked, o.is_blocked is_group_blocked, c.last_group_type_id, c.last_group_playlist_id,\n        p.logos_priority, c.audio_track_selection, c.closed_captions_selection, c.display_mode, c.audio_offset,\n        c.audio_decoder_priority, c.video_decoder_priority, c.use_external_player\n        FROM channels c\n        INNER JOIN playlists p ON c.playlist_id == p.id\n        LEFT OUTER JOIN channel_tvg_bindings b ON c.id == b.channel_id\n        LEFT OUTER JOIN tvg_channels t ON b.tvg_channel_id == t.id\n        LEFT OUTER JOIN tvg_sources s ON t.tvg_source_id == s.id\n        LEFT OUTER JOIN channel_group_options o ON o.playlist_id == c.playlist_id\n            AND o.type == 4\n            AND o.group_name == c.`group`\n        WHERE c.id == ?\n        ", 1);
        c2409M4490.bindLong(1, j);
        LiveData<ހ> liveData2 = CommonUtilsKt.֏(r0.֏.f7599.m4455(new String[]{"channels", "playlists", "channel_tvg_bindings", "tvg_channels", "tvg_sources", "channel_group_options"}, false, new އ(r0, c2409M4490)));
        this.f2997 = liveData2;
        this.f2996.m4290(liveData2, new C0643());
        m1977(c1267, false);
        m1980(false);
        this.f3003 = null;
        this.f3006 = null;
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m1976(C1262 c1262) {
        this.f2994 = 0L;
        this.f2995 = null;
        this.f3001 = null;
        LiveData<ހ> liveData = this.f2997;
        if (liveData != null) {
            C2226<C0640> c2226 = this.f2996;
            if (liveData == null) {
                C6635.m9826("channelLiveData");
                throw null;
            }
            c2226.m4289(liveData);
        }
        LiveData<List<ؠ>> liveData2 = this.f2998;
        if (liveData2 != null) {
            C2226<C0640> c22262 = this.f2996;
            if (liveData2 == null) {
                C6635.m9826("groupChannelsLiveData");
                throw null;
            }
            c22262.m4289(liveData2);
        }
        LiveData<ކ> liveData3 = this.f2999;
        if (liveData3 != null) {
            C2226<C0640> c22263 = this.f2996;
            if (liveData3 == null) {
                C6635.m9826("optionsLiveData");
                throw null;
            }
            c22263.m4289(liveData3);
        }
        this.f2996.mo345(new C0640(null, null));
        this.f3006 = null;
        this.f3007.m4298("catchup_info", c1262);
    }

    /* JADX WARN: Removed duplicated region for block: B:107:0x01d5  */
    /* JADX WARN: Removed duplicated region for block: B:111:0x01dc  */
    /* JADX WARN: Removed duplicated region for block: B:133:0x028e  */
    /* JADX WARN: Removed duplicated region for block: B:39:0x009d  */
    /* JADX WARN: Removed duplicated region for block: B:43:0x00a4  */
    /* JADX WARN: Removed duplicated region for block: B:52:0x00e5  */
    /* JADX WARN: Removed duplicated region for block: B:78:0x014a  */
    /* JADX WARN: Removed duplicated region for block: B:82:0x0151  */
    /* JADX WARN: Removed duplicated region for block: B:83:0x0186  */
    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final void m1977(C1267 c1267, boolean z) {
        int i;
        ar.tvplayer.core.data.db.dao.ؠ r2;
        LiveData liveDataM4455;
        int i2;
        ar.tvplayer.core.data.db.dao.ؠ r3;
        int i3;
        ar.tvplayer.core.data.db.dao.ؠ r32;
        if (!C6635.m9825(this.f2995, c1267) || z) {
            this.f2995 = c1267;
            this.f3001 = null;
            this.f2996.mo345(C0640.m1983(m1981(), null, null, 1));
            LiveData<List<ؠ>> liveData = this.f2998;
            if (liveData != null) {
                C2226<C0640> c2226 = this.f2996;
                if (liveData == null) {
                    C6635.m9826("groupChannelsLiveData");
                    throw null;
                }
                c2226.m4289(liveData);
            }
            if (c1267 == null) {
                C6635.m9824("group");
                throw null;
            }
            EnumC1270 enumC1270M2558 = c1267.m2558();
            int iOrdinal = enumC1270M2558.ordinal();
            if (iOrdinal == 1) {
                ar.tvplayer.core.data.db.dao.ؠ r22 = ar.tvplayer.core.data.db.ހ.֏().އ();
                long j = c1267.f4385;
                if (!(ޏ.ވ.ހ().length() > 0)) {
                    if (CommonUtilsKt.ރ()) {
                        ޏ r1 = ޏ.ވ;
                        if (r1 == null) {
                            throw null;
                        }
                        boolean z2 = ((Number) ޏ.ބ.m9835(r1, ޏ.ށ[2])).intValue() == 2;
                        boolean z3 = ar.tvplayer.core.domain.ޑ.֏;
                        boolean z4 = C1255.f4369;
                        boolean z5 = ލ.ؠ;
                        if (z2 && z3 && (!z4 || z5)) {
                            i = 1;
                        }
                        r2 = r22;
                        if (r2 != null) {
                            throw null;
                        }
                        C2409 c2409M4490 = C2409.m4490("\n        SELECT c.id, c.name, c.custom_name, c.playlist_id, p.name playlist_name, p.position playlist_position,\n        c.position_in_playlist, m.position manual_position, c.watch_time\n        FROM channels c\n        INNER JOIN playlists p ON c.playlist_id == p.id\n        LEFT OUTER JOIN channel_manual_positions m ON c.id == m.channel_id\n            AND m.type == 2\n            AND m.playlist_id == ?\n        LEFT OUTER JOIN channel_group_options o ON o.playlist_id == c.playlist_id\n            AND o.type == 4\n            AND o.group_name == c.`group`\n        LEFT OUTER JOIN channel_group_options o2 ON o2.playlist_id == ?\n            AND o2.type == 2\n        WHERE p.is_enabled == 1\n            AND c.is_vod == 0\n            AND (c.is_visible == 1 OR ? == 0)\n            AND CASE WHEN ? == 0\n                THEN p.is_visible_in_all_channels == 1\n                ELSE p.id == ?\n                END\n            AND (o.is_visible IS NULL OR o.is_visible == 1\n                OR (o2.show_channels_from_hidden_groups IS NOT NULL AND o2.show_channels_from_hidden_groups == 1)\n                OR ? == 0)\n        ", 6);
                        c2409M4490.bindLong(1, j);
                        c2409M4490.bindLong(2, j);
                        long j2 = i;
                        c2409M4490.bindLong(3, j2);
                        c2409M4490.bindLong(4, j);
                        c2409M4490.bindLong(5, j);
                        c2409M4490.bindLong(6, j2);
                        liveDataM4455 = r2.֏.f7599.m4455(new String[]{"channels", "playlists", "channel_manual_positions", "channel_group_options"}, false, new ބ(r2, c2409M4490));
                    }
                    i = 0;
                    r2 = r22;
                    if (r2 != null) {
                    }
                }
            } else if (iOrdinal == 2) {
                ar.tvplayer.core.data.db.dao.ؠ r33 = ar.tvplayer.core.data.db.ހ.֏().އ();
                long j3 = c1267.f4385;
                if (!(ޏ.ވ.ހ().length() > 0)) {
                    if (CommonUtilsKt.ރ()) {
                        ޏ r12 = ޏ.ވ;
                        if (r12 == null) {
                            throw null;
                        }
                        boolean z6 = ((Number) ޏ.ބ.m9835(r12, ޏ.ށ[2])).intValue() == 2;
                        boolean z7 = ar.tvplayer.core.domain.ޑ.֏;
                        boolean z8 = C1255.f4369;
                        boolean z9 = ލ.ؠ;
                        if (z6 && z7 && (!z8 || z9)) {
                            i2 = 1;
                        }
                        r3 = r33;
                        if (r3 != null) {
                            throw null;
                        }
                        C2409 c2409M44902 = C2409.m4490("\n        SELECT c.id, c.name, c.custom_name, c.playlist_id, p.name playlist_name, p.position playlist_position,\n        c.position_in_playlist, m.position manual_position, c.watch_time\n        FROM channels c\n        INNER JOIN playlists p ON c.playlist_id == p.id\n        LEFT OUTER JOIN channel_manual_positions m ON c.id == m.channel_id\n            AND m.type == 3\n            AND m.playlist_id == ?\n        LEFT OUTER JOIN channel_group_options o ON o.playlist_id == c.playlist_id\n            AND o.type == 4\n            AND o.group_name == c.`group`\n        LEFT OUTER JOIN channel_group_options o2 ON o2.playlist_id == ?\n            AND o2.type == 3\n        WHERE p.is_enabled == 1\n            AND (c.is_visible == 1 OR ? == 0)\n            AND (c.is_favorite == 1 AND ? == 1)\n            AND CASE WHEN ? == 0\n                THEN p.is_visible_in_all_favorites == 1\n                ELSE p.id == ?\n                END\n            AND (o.is_visible IS NULL OR o.is_visible == 1\n                OR (o2.show_channels_from_hidden_groups IS NOT NULL AND o2.show_channels_from_hidden_groups == 1)\n                OR ? == 0)\n        ", 7);
                        c2409M44902.bindLong(1, j3);
                        c2409M44902.bindLong(2, j3);
                        long j4 = i2;
                        c2409M44902.bindLong(3, j4);
                        c2409M44902.bindLong(4, j4);
                        c2409M44902.bindLong(5, j3);
                        c2409M44902.bindLong(6, j3);
                        c2409M44902.bindLong(7, j4);
                        liveDataM4455 = r3.֏.f7599.m4455(new String[]{"channels", "playlists", "channel_manual_positions", "channel_group_options"}, false, new ޅ(r3, c2409M44902));
                    }
                    i2 = 0;
                    r3 = r33;
                    if (r3 != null) {
                    }
                }
            } else {
                if (iOrdinal != 3) {
                    throw new IllegalStateException("Unhandled group type: " + enumC1270M2558);
                }
                ar.tvplayer.core.data.db.dao.ؠ r34 = ar.tvplayer.core.data.db.ހ.֏().އ();
                long j5 = c1267.f4385;
                String str = c1267.f4386;
                if (!(ޏ.ވ.ހ().length() > 0)) {
                    if (CommonUtilsKt.ރ()) {
                        ޏ r6 = ޏ.ވ;
                        if (r6 == null) {
                            throw null;
                        }
                        boolean z10 = ((Number) ޏ.ބ.m9835(r6, ޏ.ށ[2])).intValue() == 2;
                        boolean z11 = ar.tvplayer.core.domain.ޑ.֏;
                        boolean z12 = C1255.f4369;
                        boolean z13 = ލ.ؠ;
                        if (z10 && z11 && (!z12 || z13)) {
                            i3 = 1;
                        }
                        r32 = r34;
                        if (r32 != null) {
                            throw null;
                        }
                        C2409 c2409M44903 = C2409.m4490("\n        SELECT c.id, c.name, c.custom_name, c.playlist_id, p.name playlist_name, p.position playlist_position,\n        c.position_in_playlist, m.position manual_position, c.watch_time\n        FROM channels c\n        INNER JOIN playlists p ON c.playlist_id == p.id\n        LEFT OUTER JOIN channel_manual_positions m ON c.id == m.channel_id\n            AND m.type == 4\n            AND m.playlist_id == ?\n            AND m.group_name == ?\n        LEFT OUTER JOIN channel_group_options o ON o.playlist_id == c.playlist_id\n            AND o.type == 4\n            AND o.group_name == c.`group`\n        WHERE p.is_enabled == 1\n            AND (c.is_visible == 1 OR ? == 0)\n            AND p.id == ?\n            AND c.`group` == ?\n            AND (o.is_visible IS NULL OR o.is_visible == 1 OR ? == 0)\n            AND (o.are_favorites_only IS NULL OR o.are_favorites_only == 0 OR c.is_favorite == 1 OR ? == 0)\n        ", 7);
                        c2409M44903.bindLong(1, j5);
                        if (str == null) {
                            c2409M44903.bindNull(2);
                        } else {
                            c2409M44903.bindString(2, str);
                        }
                        long j6 = i3;
                        c2409M44903.bindLong(3, j6);
                        c2409M44903.bindLong(4, j5);
                        if (str == null) {
                            c2409M44903.bindNull(5);
                        } else {
                            c2409M44903.bindString(5, str);
                        }
                        c2409M44903.bindLong(6, j6);
                        c2409M44903.bindLong(7, j6);
                        liveDataM4455 = r32.֏.f7599.m4455(new String[]{"channels", "playlists", "channel_manual_positions", "channel_group_options"}, false, new ar.tvplayer.core.data.db.dao.ކ(r32, c2409M44903));
                    }
                    i3 = 0;
                    r32 = r34;
                    if (r32 != null) {
                    }
                }
            }
            LiveData<List<ؠ>> liveData2 = CommonUtilsKt.֏(liveDataM4455);
            this.f2998 = liveData2;
            C2226<C0640> c22262 = this.f2996;
            if (liveData2 == null) {
                C6635.m9826("groupChannelsLiveData");
                throw null;
            }
            c22262.m4290(liveData2, new C0646());
            LiveData<ކ> liveData3 = this.f2999;
            if (liveData3 != null) {
                this.f2996.m4289(liveData3);
            }
            C1267 c12672 = this.f2995;
            if (c12672 == null) {
                C6635.m9822();
                throw null;
            }
            ތ r23 = ar.tvplayer.core.data.db.ހ.֏().ވ();
            EnumC1270 enumC1270M25582 = c12672.m2558();
            long j7 = c12672.f4385;
            String str2 = c12672.f4386;
            ތ r24 = r23;
            if (r24 == null) {
                throw null;
            }
            C2409 c2409M44904 = C2409.m4490("\n        SELECT * FROM channel_group_options\n        WHERE type == ? AND playlist_id == ? AND group_name == ?\n        ", 3);
            c2409M44904.bindLong(1, r24.ހ.֏(enumC1270M25582));
            c2409M44904.bindLong(2, j7);
            if (str2 == null) {
                c2409M44904.bindNull(3);
            } else {
                c2409M44904.bindString(3, str2);
            }
            LiveData<ކ> liveData4 = CommonUtilsKt.֏(r24.֏.f7599.m4455(new String[]{"channel_group_options"}, false, new ar.tvplayer.core.data.db.dao.ލ(r24, c2409M44904)));
            this.f2999 = liveData4;
            this.f2996.m4290(liveData4, new C0650(this));
        }
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m1978(boolean z) {
        if (this.f2994 != 0 && this.f2995 != null) {
            long j = this.f2994;
            C1267 c1267 = this.f2995;
            if (c1267 != null) {
                m1975(j, c1267);
                return;
            } else {
                C6635.m9822();
                throw null;
            }
        }
        if (z) {
            Long l = (Long) this.f3007.f7188.get("channel_id");
            if (l == null) {
                l = 0L;
            }
            C6635.m9823((Object) l, "savedStateHandle.get<Long>(KEY_CHANNEL_ID) ?: 0L");
            long jLongValue = l.longValue();
            C1267 c12672 = (C1267) this.f3007.f7188.get("channel_group");
            if (jLongValue == 0 || c12672 == null) {
                return;
            }
            m1975(jLongValue, c12672);
        }
    }

    /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
    public final void m1979(boolean z) {
        if (z) {
            C1267 c1267 = this.f2995;
            if ((c1267 != null ? c1267.f4384 : null) != EnumC1270.PLAYLIST) {
                return;
            }
        }
        C1267 c12672 = this.f2995;
        if (c12672 != null) {
            m1977(c12672, true);
        }
    }

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final void m1980(boolean z) {
        C0640 c0640M339;
        List<ؠ> list;
        if ((this.f2994 == this.f3002 && !z) || (c0640M339 = this.f2996.m339()) == null || (list = c0640M339.f3014) == null) {
            return;
        }
        Iterator<ؠ> it = list.iterator();
        int i = 0;
        while (true) {
            if (!it.hasNext()) {
                i = -1;
                break;
            } else if (it.next().ؠ == this.f2994) {
                break;
            } else {
                i++;
            }
        }
        if (i == -1) {
            return;
        }
        ArrayList arrayList = new ArrayList();
        arrayList.add(Long.valueOf(this.f2994));
        for (int i2 = 0; i2 < 6; i2++) {
            ؠ r4 = (ؠ) C6560.m9773(list, i + i2 + 1);
            if (r4 != null) {
                arrayList.add(Long.valueOf(r4.ؠ));
            }
            ؠ r42 = (ؠ) C6560.m9773(list, (i - i2) - 1);
            if (r42 != null) {
                arrayList.add(Long.valueOf(r42.ؠ));
            }
        }
        ʳ r11 = ʳ.ނ;
        if (!arrayList.isEmpty()) {
            C4303.m7160(C1356.f4507, C1340.f4488, null, new ʼ(arrayList, (InterfaceC6575) null), 2, null);
        }
        this.f3002 = this.f2994;
    }

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public final C0640 m1981() {
        C0640 c0640M339 = this.f2996.m339();
        if (c0640M339 == null) {
            c0640M339 = new C0640(null, null);
        }
        C6635.m9823((Object) c0640M339, "playerLiveData.value ?: PlayerData(null, null)");
        return c0640M339;
    }

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public final void m1982() {
        this.f3003 = null;
        this.f3005.set(true);
    }
}
