package p000.p001.p002.p003.p004.p005;

import androidx.lifecycle.LiveData;
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.prefs.ރ;
import ar.tvplayer.core.data.repositories.ʳ;
import ar.tvplayer.core.data.repositories.ލ;
import ar.tvplayer.core.util.CommonUtilsKt;
import java.util.List;
import java.util.concurrent.CancellationException;
import kotlin.TypeCastException;
import p025.p026.C1340;
import p025.p026.InterfaceC1327;
import p025.p026.InterfaceC1363;
import p037.p041.p042.LayoutInflaterFactory2C1494;
import p037.p099.AbstractC2245;
import p037.p099.C2229;
import p037.p099.InterfaceC2230;
import p037.p109.C2409;
import p138.p139.p143.p144.C2803;
import p138.p176.p177.p242.p246.p251.C4303;
import p402.C6549;
import p402.InterfaceC6540;
import p402.p403.C6563;
import p402.p405.InterfaceC6575;
import p402.p405.InterfaceC6578;
import p402.p405.p406.EnumC6586;
import p402.p405.p407.p408.AbstractC6597;
import p402.p405.p407.p408.InterfaceC6593;
import p402.p411.p412.InterfaceC6618;
import p402.p411.p413.C6635;

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

    /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
    public final LiveData<C0498> f2554 = new C2229();

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

    /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
    public ނ f2556;

    /* JADX INFO: renamed from: ރ, reason: contains not printable characters */
    public InterfaceC1363 f2557;

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

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

        @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 C0498 {

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

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

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public final List<ޱ> f2561;

        /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
        public final boolean f2562;

        public C0498(int i, ނ r3, List<ޱ> list, boolean z) {
            if (r3 == null) {
                C6635.m9824("channel");
                throw null;
            }
            if (list == null) {
                C6635.m9824("programs");
                throw null;
            }
            this.f2559 = i;
            this.f2560 = r3;
            this.f2561 = list;
            this.f2562 = z;
        }

        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (!(obj instanceof C0498)) {
                return false;
            }
            C0498 c0498 = (C0498) obj;
            return this.f2559 == c0498.f2559 && C6635.m9825(this.f2560, c0498.f2560) && C6635.m9825(this.f2561, c0498.f2561) && this.f2562 == c0498.f2562;
        }

        /* JADX WARN: Multi-variable type inference failed */
        /* JADX WARN: Type inference failed for: r1v5, types: [int] */
        /* JADX WARN: Type inference failed for: r1v6 */
        /* JADX WARN: Type inference failed for: r1v8 */
        public int hashCode() {
            int i = this.f2559 * 31;
            ނ r1 = this.f2560;
            int iHashCode = (i + (r1 != null ? r1.hashCode() : 0)) * 31;
            List<ޱ> list = this.f2561;
            int iHashCode2 = (iHashCode + (list != null ? list.hashCode() : 0)) * 31;
            boolean z = this.f2562;
            ?? r12 = z;
            if (z) {
                r12 = 1;
            }
            return iHashCode2 + r12;
        }

        public String toString() {
            StringBuilder sbM4889 = C2803.m4889("ProgramsData(number=");
            sbM4889.append(this.f2559);
            sbM4889.append(", channel=");
            sbM4889.append(this.f2560);
            sbM4889.append(", programs=");
            sbM4889.append(this.f2561);
            sbM4889.append(", reset=");
            return C2803.m4885(sbM4889, this.f2562, ")");
        }
    }

    /* JADX INFO: renamed from: ނ.֏.֏.֏.֏.ހ.ޙ$ހ, reason: contains not printable characters */
    @InterfaceC6593(c = "ar.tvplayer.tv.player.ui.channels.PlayerProgramsViewModel$loadPrograms$1", f = "PlayerProgramsViewModel.kt", l = {55}, m = "invokeSuspend")
    public static final class C0499 extends AbstractC6597 implements InterfaceC6618<InterfaceC1327, InterfaceC6575<? super C6549>, Object> {

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

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

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

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

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

        /* JADX INFO: renamed from: ލ, reason: contains not printable characters */
        public final /* synthetic */ ނ f2569;

        /* JADX INFO: renamed from: ގ, reason: contains not printable characters */
        public final /* synthetic */ int f2570;

        /* JADX INFO: renamed from: ޏ, reason: contains not printable characters */
        public final /* synthetic */ boolean f2571;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C0499(ނ r2, int i, boolean z, InterfaceC6575 interfaceC6575) {
            super(2, interfaceC6575);
            this.f2569 = r2;
            this.f2570 = i;
            this.f2571 = z;
        }

        @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;
            }
            C0499 c0499 = C0496.this.new C0499(this.f2569, this.f2570, this.f2571, interfaceC6575);
            c0499.f2563 = (InterfaceC1327) obj;
            return c0499;
        }

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

        @Override // p402.p405.p407.p408.AbstractC6589
        /* JADX INFO: renamed from: ށ */
        public final Object mo839(Object obj) {
            InterfaceC1327 interfaceC1327;
            EnumC6586 enumC6586 = EnumC6586.COROUTINE_SUSPENDED;
            int i = this.f2567;
            if (i == 0) {
                C4303.m7198(obj);
                InterfaceC1327 interfaceC13272 = this.f2563;
                ނ r1 = this.f2569;
                Long l = r1.ޒ;
                if (l == null) {
                    C0496.m1668(C0496.this, this.f2570, r1, C6563.f19343, this.f2571);
                    return C6549.f19328;
                }
                List list = ʳ.ނ.ހ(l.longValue(), this.f2569.ށ());
                if (list != null) {
                    C0496.m1668(C0496.this, this.f2570, this.f2569, list, this.f2571);
                    return C6549.f19328;
                }
                ʳ r4 = ʳ.ނ;
                long jLongValue = l.longValue();
                long j = this.f2569.ށ();
                this.f2564 = interfaceC13272;
                this.f2565 = l;
                this.f2566 = list;
                this.f2567 = 1;
                Object obj2 = ʳ.֏(r4, jLongValue, j, (Long) null, this, 4);
                if (obj2 == enumC6586) {
                    return enumC6586;
                }
                interfaceC1327 = interfaceC13272;
                obj = obj2;
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                interfaceC1327 = (InterfaceC1327) this.f2564;
                C4303.m7198(obj);
            }
            List list2 = (List) obj;
            if (C4303.m7134(interfaceC1327)) {
                C0496.m1668(C0496.this, this.f2570, this.f2569, list2, this.f2571);
            }
            return C6549.f19328;
        }
    }

    /* JADX INFO: renamed from: ނ.֏.֏.֏.֏.ހ.ޙ$ށ, reason: contains not printable characters */
    @InterfaceC6593(c = "ar.tvplayer.tv.player.ui.channels.PlayerProgramsViewModel$updateProgramsCache$1", f = "PlayerProgramsViewModel.kt", l = {81, 86}, m = "invokeSuspend")
    public static final class C0500 extends AbstractC6597 implements InterfaceC6618<InterfaceC1327, InterfaceC6575<? super C6549>, Object> {

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

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

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

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

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

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

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C0500(long j, InterfaceC6575 interfaceC6575) {
            super(2, interfaceC6575);
            this.f2577 = j;
        }

        @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;
            }
            C0500 c0500 = new C0500(this.f2577, interfaceC6575);
            c0500.f2572 = (InterfaceC1327) obj;
            return c0500;
        }

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

        @Override // p402.p405.p407.p408.AbstractC6589
        /* JADX INFO: renamed from: ށ */
        public final Object mo839(Object obj) throws Throwable {
            InterfaceC1327 interfaceC1327;
            EnumC6586 enumC6586 = EnumC6586.COROUTINE_SUSPENDED;
            int i = this.f2576;
            if (i == 0) {
                C4303.m7198(obj);
                interfaceC1327 = this.f2572;
                long j = this.f2577;
                this.f2573 = interfaceC1327;
                this.f2576 = 1;
                obj = C4303.m7018((InterfaceC6578) C1340.f4488, (InterfaceC6618) new ލ(j, (InterfaceC6575) null), (InterfaceC6575) this);
                if (obj == enumC6586) {
                    return enumC6586;
                }
            } else {
                if (i != 1) {
                    if (i != 2) {
                        throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                    }
                    C4303.m7198(obj);
                    return C6549.f19328;
                }
                interfaceC1327 = (InterfaceC1327) this.f2573;
                C4303.m7198(obj);
            }
            ހ r14 = (ހ) obj;
            if (C4303.m7134(interfaceC1327)) {
                if ((r14 != null ? r14.ޜ : null) != null) {
                    ʳ r3 = ʳ.ނ;
                    Long l = r14.ޜ;
                    if (l == null) {
                        C6635.m9822();
                        throw null;
                    }
                    List list = r3.ހ(l.longValue(), r14.ށ());
                    if (list == null) {
                        ʳ r5 = ʳ.ނ;
                        Long l2 = r14.ޜ;
                        if (l2 == null) {
                            C6635.m9822();
                            throw null;
                        }
                        long jLongValue = l2.longValue();
                        long j2 = r14.ށ();
                        this.f2573 = interfaceC1327;
                        this.f2574 = r14;
                        this.f2575 = list;
                        this.f2576 = 2;
                        if (ʳ.֏(r5, jLongValue, j2, (Long) null, this, 4) == enumC6586) {
                            return enumC6586;
                        }
                    }
                }
            }
            return C6549.f19328;
        }
    }

    public C0496() {
        ޙ r0 = ar.tvplayer.core.data.db.ހ.֏().ލ();
        if (r0 == null) {
            throw null;
        }
        LiveData<Integer> liveData = CommonUtilsKt.֏(r0.֏.f7599.m4455(new String[]{"playlists"}, false, new ޞ(r0, C2409.m4490("SELECT COUNT(*) FROM playlists WHERE is_enabled == 1", 0))));
        this.f2555 = liveData;
        liveData.m343(C0497.f2558);
        m1670();
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public static final /* synthetic */ void m1668(C0496 c0496, int i, ނ r3, List list, boolean z) {
        LiveData<C0498> liveData = c0496.f2554;
        if (liveData == null) {
            throw new TypeCastException("null cannot be cast to non-null type androidx.lifecycle.MutableLiveData<ar.tvplayer.tv.player.ui.channels.PlayerProgramsViewModel.ProgramsData>");
        }
        ((C2229) liveData).mo345(new C0498(i, r3, list, z));
    }

    /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
    public final void m1669(int i, ނ r10, boolean z, boolean z2) {
        ނ r1;
        if (r10 == null) {
            C6635.m9824("channel");
            throw null;
        }
        ނ r12 = this.f2556;
        if ((r12 == null || r12.ބ != r10.ބ || (C6635.m9825((Object) r12.ހ(), (Object) r10.ހ()) ^ true) || (r1 = this.f2556) == null || r1.֏() != r10.֏()) || z2) {
            this.f2556 = r10;
            InterfaceC1363 interfaceC1363 = this.f2557;
            if (interfaceC1363 != null) {
                C4303.m7098(interfaceC1363, (CancellationException) null, 1, (Object) null);
            }
            this.f2557 = CommonUtilsKt.ؠ(LayoutInflaterFactory2C1494.C1505.m2925((AbstractC2245) this), new C0499(r10, i, z, null));
        }
    }

    /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
    public final void m1670() {
        long j = ރ.ߠ.ޔ();
        if (j != 0) {
            C4303.m7160(LayoutInflaterFactory2C1494.C1505.m2925((AbstractC2245) this), C1340.f4488, null, new C0500(j, null), 2, null);
        }
    }
}
