package V2;

import Y4.InterfaceC0844j;
import com.debridstream.tv.HomeViewModel;
import com.debridstream.tv.MultiTabHomeUiState;
import java.util.ArrayList;
import java.util.List;
import m3.AbstractC2467b;
import w4.C3137A;

/* JADX INFO: loaded from: classes.dex */
public final class J1 implements InterfaceC0844j {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final /* synthetic */ int f7376a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final /* synthetic */ HomeViewModel f7377b;

    public /* synthetic */ J1(HomeViewModel homeViewModel, int i6) {
        this.f7376a = i6;
        this.f7377b = homeViewModel;
    }

    /* JADX WARN: Removed duplicated region for block: B:7:0x0013  */
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public Object b(List list, A4.d dVar) throws Throwable {
        I1 i12;
        J1 j12;
        Y4.c0 c0Var;
        Object value;
        if (dVar instanceof I1) {
            i12 = (I1) dVar;
            int i6 = i12.f7366d;
            if ((i6 & Integer.MIN_VALUE) != 0) {
                i12.f7366d = i6 - Integer.MIN_VALUE;
            } else {
                i12 = new I1(this, dVar);
            }
        }
        Object objComputeMainCatalogs = i12.f7364b;
        B4.a aVar = B4.a.f492a;
        int i7 = i12.f7366d;
        if (i7 == 0) {
            AbstractC2467b.l(objComputeMainCatalogs);
            i12.f7363a = this;
            i12.f7366d = 1;
            objComputeMainCatalogs = this.f7377b.computeMainCatalogs(list, i12);
            if (objComputeMainCatalogs == aVar) {
                return aVar;
            }
            j12 = this;
        } else {
            if (i7 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            j12 = i12.f7363a;
            AbstractC2467b.l(objComputeMainCatalogs);
        }
        List list2 = (List) objComputeMainCatalogs;
        HomeViewModel homeViewModel = j12.f7377b;
        boolean zSameCatalogIds = homeViewModel.sameCatalogIds(list2, homeViewModel.configsMainList);
        C3137A c3137a = C3137A.f25453a;
        if (zSameCatalogIds) {
            return c3137a;
        }
        HomeViewModel homeViewModel2 = j12.f7377b;
        homeViewModel2.configsMainList = list2;
        homeViewModel2.loadedMain.clear();
        homeViewModel2.loadingMain.clear();
        Y4.H h5 = homeViewModel2._uiState;
        do {
            c0Var = (Y4.c0) h5;
            value = c0Var.getValue();
        } while (!c0Var.i(value, MultiTabHomeUiState.copy$default((MultiTabHomeUiState) value, homeViewModel2.shellState(homeViewModel2.configsMainList), null, null, 6, null)));
        homeViewModel2.refreshContinueWatchingFromStore();
        HomeViewModel.requestSectionsAround$default(homeViewModel2, F1.f7316a, 0, 0, 4, null);
        return c3137a;
    }

    @Override // Y4.InterfaceC0844j
    public final Object emit(Object obj, A4.d dVar) throws Throwable {
        switch (this.f7376a) {
            case 0:
                break;
            case 1:
                V1 v12 = (V1) obj;
                F1 f12 = F1.f7316a;
                String str = v12.f7584a;
                ArrayList arrayList = v12.f7585b;
                HomeViewModel homeViewModel = this.f7377b;
                HomeViewModel.updateTabSections$default(homeViewModel, f12, "continue_watching", str, arrayList, false, 16, null);
                homeViewModel.syncKidsContinueWatchingRow(arrayList);
                break;
            default:
                Object objApplyBecauseYouWatchedDependencyChangeIfNeeded = this.f7377b.applyBecauseYouWatchedDependencyChangeIfNeeded(dVar);
                if (objApplyBecauseYouWatchedDependencyChangeIfNeeded != B4.a.f492a) {
                    break;
                }
                break;
        }
        return C3137A.f25453a;
    }
}
