package V2;

import com.debridstream.tv.CollectionHubViewModel;
import java.util.List;
import m3.AbstractC2467b;
import w4.C3137A;

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

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

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

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

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

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

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final /* synthetic */ AbstractC0742y1 f7561f;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final /* synthetic */ CollectionHubViewModel f7562j;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public U0(AbstractC0742y1 abstractC0742y1, CollectionHubViewModel collectionHubViewModel, A4.d dVar) {
        super(2, dVar);
        this.f7561f = abstractC0742y1;
        this.f7562j = collectionHubViewModel;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        return new U0(this.f7561f, this.f7562j, dVar);
    }

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

    /* JADX WARN: Code restructure failed: missing block: B:102:0x0274, code lost:
    
        if (r14 == r1) goto L103;
     */
    /* JADX WARN: Code restructure failed: missing block: B:84:0x020a, code lost:
    
        if (r14 == r1) goto L103;
     */
    /* JADX WARN: Removed duplicated region for block: B:43:0x00fe  */
    /* JADX WARN: Removed duplicated region for block: B:61:0x0166  */
    /* JADX WARN: Removed duplicated region for block: B:75:0x01c4  */
    /* JADX WARN: Removed duplicated region for block: B:94:0x0240  */
    @Override // C4.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) throws Throwable {
        U0 u02;
        Throwable th;
        e5.c cVar;
        Throwable th2;
        e5.a aVar;
        e5.a aVar2;
        e5.a aVar3;
        List list;
        e5.c cVar2;
        AbstractC0742y1 abstractC0742y1;
        CollectionHubViewModel collectionHubViewModel;
        e5.a aVar4;
        List list2;
        e5.c cVar3;
        AbstractC0742y1 abstractC0742y12;
        CollectionHubViewModel collectionHubViewModel2;
        e5.a aVar5;
        List list3;
        e5.c cVar4;
        AbstractC0742y1 abstractC0742y13;
        CollectionHubViewModel collectionHubViewModel3;
        e5.a aVar6;
        e5.a aVar7;
        B4.a aVar8 = B4.a.f492a;
        int i6 = this.f7560e;
        AbstractC0742y1 abstractC0742y14 = this.f7561f;
        CollectionHubViewModel collectionHubViewModel4 = this.f7562j;
        try {
            try {
                try {
                } catch (Exception unused) {
                    u02 = this;
                    e5.a aVar9 = collectionHubViewModel4.sectionLoadMutex;
                    u02.f7556a = aVar9;
                    u02.f7557b = collectionHubViewModel4;
                    u02.f7558c = abstractC0742y14;
                    u02.f7559d = null;
                    u02.f7560e = 8;
                    e5.c cVar5 = (e5.c) aVar9;
                    Object objE = cVar5.e(this);
                    aVar2 = cVar5;
                }
            } catch (Throwable th3) {
                th = th3;
                u02 = this;
                e5.a aVar10 = collectionHubViewModel4.sectionLoadMutex;
                u02.f7556a = th;
                u02.f7557b = aVar10;
                u02.f7558c = collectionHubViewModel4;
                u02.f7559d = abstractC0742y14;
                u02.f7560e = 9;
                cVar = (e5.c) aVar10;
                if (cVar.e(this) != aVar8) {
                    th2 = th;
                    aVar3 = cVar;
                    e5.a aVar11 = aVar3;
                    try {
                        collectionHubViewModel4.loading.remove(abstractC0742y14.a());
                        throw th2;
                    } finally {
                    }
                }
                return aVar8;
            }
        } catch (Exception unused2) {
            e5.a aVar92 = collectionHubViewModel4.sectionLoadMutex;
            u02.f7556a = aVar92;
            u02.f7557b = collectionHubViewModel4;
            u02.f7558c = abstractC0742y14;
            u02.f7559d = null;
            u02.f7560e = 8;
            e5.c cVar52 = (e5.c) aVar92;
            Object objE2 = cVar52.e(this);
            aVar2 = cVar52;
        } catch (Throwable th4) {
            th = th4;
            th = th;
            e5.a aVar102 = collectionHubViewModel4.sectionLoadMutex;
            u02.f7556a = th;
            u02.f7557b = aVar102;
            u02.f7558c = collectionHubViewModel4;
            u02.f7559d = abstractC0742y14;
            u02.f7560e = 9;
            cVar = (e5.c) aVar102;
            if (cVar.e(this) != aVar8) {
            }
        }
        switch (i6) {
            case 0:
                AbstractC2467b.l(obj);
                try {
                    if ((abstractC0742y14 instanceof C0726u1) || (abstractC0742y14 instanceof C0718s1)) {
                        u02 = this;
                        e5.a aVar12 = collectionHubViewModel4.sectionLoadMutex;
                        u02.f7556a = aVar12;
                        u02.f7557b = collectionHubViewModel4;
                        u02.f7558c = abstractC0742y14;
                        u02.f7559d = null;
                        u02.f7560e = 7;
                        e5.c cVar6 = (e5.c) aVar12;
                        Object objE3 = cVar6.e(this);
                        aVar7 = cVar6;
                        break;
                    } else if (abstractC0742y14 instanceof C0738x1) {
                        Y2.o oVar = collectionHubViewModel4.repository;
                        String str = ((C0738x1) abstractC0742y14).f8157c;
                        String str2 = ((C0738x1) abstractC0742y14).f8158d;
                        Integer num = ((C0738x1) abstractC0742y14).f8159e;
                        Integer num2 = ((C0738x1) abstractC0742y14).f8160f;
                        this.f7560e = 1;
                        u02 = this;
                        obj = oVar.o(str, str2, 1, (28 & 8) != 0 ? 100 : 10, (28 & 16) == 0, (28 & 32) != 0 ? null : num, (28 & 64) != 0 ? null : num2, u02);
                        if (obj != aVar8) {
                            list = (List) obj;
                            e5.a aVar13 = collectionHubViewModel4.sectionLoadMutex;
                            u02.f7556a = list;
                            u02.f7557b = aVar13;
                            u02.f7558c = collectionHubViewModel4;
                            u02.f7559d = abstractC0742y14;
                            u02.f7560e = 2;
                            cVar2 = (e5.c) aVar13;
                            if (cVar2.e(this) != aVar8) {
                                abstractC0742y1 = abstractC0742y14;
                                collectionHubViewModel = collectionHubViewModel4;
                                aVar4 = cVar2;
                                try {
                                    collectionHubViewModel.loaded.add(((C0738x1) abstractC0742y1).f8155a);
                                    ((e5.c) aVar4).g(null);
                                    collectionHubViewModel4.updateSection(((C0738x1) abstractC0742y14).f8155a, ((C0738x1) abstractC0742y14).f8156b, list);
                                    e5.a aVar122 = collectionHubViewModel4.sectionLoadMutex;
                                    u02.f7556a = aVar122;
                                    u02.f7557b = collectionHubViewModel4;
                                    u02.f7558c = abstractC0742y14;
                                    u02.f7559d = null;
                                    u02.f7560e = 7;
                                    e5.c cVar62 = (e5.c) aVar122;
                                    Object objE32 = cVar62.e(this);
                                    aVar7 = cVar62;
                                } finally {
                                }
                            }
                            break;
                        }
                    } else {
                        u02 = this;
                        if (abstractC0742y14 instanceof C0734w1) {
                            Y2.o oVar2 = collectionHubViewModel4.repository;
                            String str3 = ((C0734w1) abstractC0742y14).f8139c;
                            u02.f7560e = 3;
                            obj = oVar2.m(str3, 1, (6 & 4) == 0, this);
                            if (obj != aVar8) {
                                list2 = (List) obj;
                                e5.a aVar14 = collectionHubViewModel4.sectionLoadMutex;
                                u02.f7556a = list2;
                                u02.f7557b = aVar14;
                                u02.f7558c = collectionHubViewModel4;
                                u02.f7559d = abstractC0742y14;
                                u02.f7560e = 4;
                                cVar3 = (e5.c) aVar14;
                                if (cVar3.e(this) != aVar8) {
                                    abstractC0742y12 = abstractC0742y14;
                                    collectionHubViewModel2 = collectionHubViewModel4;
                                    aVar5 = cVar3;
                                    try {
                                        collectionHubViewModel2.loaded.add(((C0734w1) abstractC0742y12).f8137a);
                                        ((e5.c) aVar5).g(null);
                                        collectionHubViewModel4.updateSection(((C0734w1) abstractC0742y14).f8137a, ((C0734w1) abstractC0742y14).f8138b, list2);
                                        e5.a aVar1222 = collectionHubViewModel4.sectionLoadMutex;
                                        u02.f7556a = aVar1222;
                                        u02.f7557b = collectionHubViewModel4;
                                        u02.f7558c = abstractC0742y14;
                                        u02.f7559d = null;
                                        u02.f7560e = 7;
                                        e5.c cVar622 = (e5.c) aVar1222;
                                        Object objE322 = cVar622.e(this);
                                        aVar7 = cVar622;
                                    } finally {
                                    }
                                }
                                break;
                            }
                        } else {
                            if (!(abstractC0742y14 instanceof C0730v1)) {
                                throw new E3.v();
                            }
                            Y2.o oVar3 = collectionHubViewModel4.repository;
                            String str4 = ((C0730v1) abstractC0742y14).f8125c;
                            u02.f7560e = 5;
                            obj = oVar3.k(str4, 1, (6 & 4) == 0, this);
                            if (obj != aVar8) {
                                list3 = (List) obj;
                                e5.a aVar15 = collectionHubViewModel4.sectionLoadMutex;
                                u02.f7556a = list3;
                                u02.f7557b = aVar15;
                                u02.f7558c = collectionHubViewModel4;
                                u02.f7559d = abstractC0742y14;
                                u02.f7560e = 6;
                                cVar4 = (e5.c) aVar15;
                                if (cVar4.e(this) != aVar8) {
                                    abstractC0742y13 = abstractC0742y14;
                                    collectionHubViewModel3 = collectionHubViewModel4;
                                    aVar6 = cVar4;
                                    try {
                                        collectionHubViewModel3.loaded.add(((C0730v1) abstractC0742y13).f8123a);
                                        ((e5.c) aVar6).g(null);
                                        collectionHubViewModel4.updateSection(((C0730v1) abstractC0742y14).f8123a, ((C0730v1) abstractC0742y14).f8124b, list3);
                                        e5.a aVar12222 = collectionHubViewModel4.sectionLoadMutex;
                                        u02.f7556a = aVar12222;
                                        u02.f7557b = collectionHubViewModel4;
                                        u02.f7558c = abstractC0742y14;
                                        u02.f7559d = null;
                                        u02.f7560e = 7;
                                        e5.c cVar6222 = (e5.c) aVar12222;
                                        Object objE3222 = cVar6222.e(this);
                                        aVar7 = cVar6222;
                                    } finally {
                                    }
                                }
                                break;
                            }
                        }
                    }
                } catch (Throwable th5) {
                    th = th5;
                    u02 = this;
                    th = th;
                    e5.a aVar1022 = collectionHubViewModel4.sectionLoadMutex;
                    u02.f7556a = th;
                    u02.f7557b = aVar1022;
                    u02.f7558c = collectionHubViewModel4;
                    u02.f7559d = abstractC0742y14;
                    u02.f7560e = 9;
                    cVar = (e5.c) aVar1022;
                    if (cVar.e(this) != aVar8) {
                    }
                }
                return aVar8;
            case 1:
                AbstractC2467b.l(obj);
                u02 = this;
                list = (List) obj;
                e5.a aVar132 = collectionHubViewModel4.sectionLoadMutex;
                u02.f7556a = list;
                u02.f7557b = aVar132;
                u02.f7558c = collectionHubViewModel4;
                u02.f7559d = abstractC0742y14;
                u02.f7560e = 2;
                cVar2 = (e5.c) aVar132;
                if (cVar2.e(this) != aVar8) {
                }
                return aVar8;
            case 2:
                abstractC0742y1 = this.f7559d;
                collectionHubViewModel = (CollectionHubViewModel) this.f7558c;
                e5.a aVar16 = (e5.a) this.f7557b;
                list = (List) this.f7556a;
                AbstractC2467b.l(obj);
                u02 = this;
                aVar4 = aVar16;
                collectionHubViewModel.loaded.add(((C0738x1) abstractC0742y1).f8155a);
                ((e5.c) aVar4).g(null);
                collectionHubViewModel4.updateSection(((C0738x1) abstractC0742y14).f8155a, ((C0738x1) abstractC0742y14).f8156b, list);
                e5.a aVar122222 = collectionHubViewModel4.sectionLoadMutex;
                u02.f7556a = aVar122222;
                u02.f7557b = collectionHubViewModel4;
                u02.f7558c = abstractC0742y14;
                u02.f7559d = null;
                u02.f7560e = 7;
                e5.c cVar62222 = (e5.c) aVar122222;
                Object objE32222 = cVar62222.e(this);
                aVar7 = cVar62222;
                break;
            case 3:
                AbstractC2467b.l(obj);
                u02 = this;
                list2 = (List) obj;
                e5.a aVar142 = collectionHubViewModel4.sectionLoadMutex;
                u02.f7556a = list2;
                u02.f7557b = aVar142;
                u02.f7558c = collectionHubViewModel4;
                u02.f7559d = abstractC0742y14;
                u02.f7560e = 4;
                cVar3 = (e5.c) aVar142;
                if (cVar3.e(this) != aVar8) {
                }
                return aVar8;
            case 4:
                abstractC0742y12 = this.f7559d;
                collectionHubViewModel2 = (CollectionHubViewModel) this.f7558c;
                e5.a aVar17 = (e5.a) this.f7557b;
                list2 = (List) this.f7556a;
                AbstractC2467b.l(obj);
                u02 = this;
                aVar5 = aVar17;
                collectionHubViewModel2.loaded.add(((C0734w1) abstractC0742y12).f8137a);
                ((e5.c) aVar5).g(null);
                collectionHubViewModel4.updateSection(((C0734w1) abstractC0742y14).f8137a, ((C0734w1) abstractC0742y14).f8138b, list2);
                e5.a aVar1222222 = collectionHubViewModel4.sectionLoadMutex;
                u02.f7556a = aVar1222222;
                u02.f7557b = collectionHubViewModel4;
                u02.f7558c = abstractC0742y14;
                u02.f7559d = null;
                u02.f7560e = 7;
                e5.c cVar622222 = (e5.c) aVar1222222;
                Object objE322222 = cVar622222.e(this);
                aVar7 = cVar622222;
                break;
            case 5:
                AbstractC2467b.l(obj);
                u02 = this;
                list3 = (List) obj;
                e5.a aVar152 = collectionHubViewModel4.sectionLoadMutex;
                u02.f7556a = list3;
                u02.f7557b = aVar152;
                u02.f7558c = collectionHubViewModel4;
                u02.f7559d = abstractC0742y14;
                u02.f7560e = 6;
                cVar4 = (e5.c) aVar152;
                if (cVar4.e(this) != aVar8) {
                }
                return aVar8;
            case 6:
                abstractC0742y13 = this.f7559d;
                collectionHubViewModel3 = (CollectionHubViewModel) this.f7558c;
                e5.a aVar18 = (e5.a) this.f7557b;
                list3 = (List) this.f7556a;
                AbstractC2467b.l(obj);
                u02 = this;
                aVar6 = aVar18;
                collectionHubViewModel3.loaded.add(((C0730v1) abstractC0742y13).f8123a);
                ((e5.c) aVar6).g(null);
                collectionHubViewModel4.updateSection(((C0730v1) abstractC0742y14).f8123a, ((C0730v1) abstractC0742y14).f8124b, list3);
                e5.a aVar12222222 = collectionHubViewModel4.sectionLoadMutex;
                u02.f7556a = aVar12222222;
                u02.f7557b = collectionHubViewModel4;
                u02.f7558c = abstractC0742y14;
                u02.f7559d = null;
                u02.f7560e = 7;
                e5.c cVar6222222 = (e5.c) aVar12222222;
                Object objE3222222 = cVar6222222.e(this);
                aVar7 = cVar6222222;
                break;
            case 7:
                abstractC0742y14 = (AbstractC0742y1) this.f7558c;
                collectionHubViewModel4 = (CollectionHubViewModel) this.f7557b;
                e5.a aVar19 = (e5.a) this.f7556a;
                AbstractC2467b.l(obj);
                aVar7 = aVar19;
                e5.a aVar20 = aVar7;
                try {
                    collectionHubViewModel4.loading.remove(abstractC0742y14.a());
                    aVar = aVar20;
                    return C3137A.f25453a;
                } finally {
                }
            case 8:
                abstractC0742y14 = (AbstractC0742y1) this.f7558c;
                collectionHubViewModel4 = (CollectionHubViewModel) this.f7557b;
                e5.a aVar21 = (e5.a) this.f7556a;
                AbstractC2467b.l(obj);
                aVar2 = aVar21;
                e5.a aVar22 = aVar2;
                try {
                    collectionHubViewModel4.loading.remove(abstractC0742y14.a());
                    aVar = aVar22;
                    return C3137A.f25453a;
                } finally {
                }
            case 9:
                abstractC0742y14 = this.f7559d;
                collectionHubViewModel4 = (CollectionHubViewModel) this.f7558c;
                e5.a aVar23 = (e5.a) this.f7557b;
                th2 = (Throwable) this.f7556a;
                AbstractC2467b.l(obj);
                aVar3 = aVar23;
                e5.a aVar112 = aVar3;
                collectionHubViewModel4.loading.remove(abstractC0742y14.a());
                throw th2;
            default:
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
        }
    }
}
