package h3;

import androidx.compose.runtime.SnapshotStateKt;
import b0.C1180b;
import com.debridstream.tv.data.home.HomeMetaItem;
import com.debridstream.tv.screens.SearchRecommendationsViewModel;
import d3.C1931v0;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import m3.AbstractC2467b;
import w4.C3137A;

/* JADX INFO: renamed from: h3.v2, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public final class C2206v2 extends C4.j implements J4.e {

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

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

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ SearchRecommendationsViewModel f18623d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final /* synthetic */ E.D f18624e;

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C2206v2(SearchRecommendationsViewModel searchRecommendationsViewModel, E.D d6, Map map, A4.d dVar) {
        super(2, dVar);
        this.f18623d = searchRecommendationsViewModel;
        this.f18624e = d6;
        this.f18625f = map;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        return new C2206v2(this.f18623d, this.f18624e, this.f18625f, dVar);
    }

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

    /* JADX WARN: Code restructure failed: missing block: B:47:0x00f1, code lost:
    
        if (V4.E.J(5000, r6, r12) == r0) goto L48;
     */
    /* JADX WARN: Removed duplicated region for block: B:12:0x002a A[PHI: r1 r4
      0x002a: PHI (r1v6 int) = (r1v5 int), (r1v9 int) binds: [B:26:0x008c, B:11:0x0023] A[DONT_GENERATE, DONT_INLINE]
      0x002a: PHI (r4v5 java.lang.String) = (r4v4 java.lang.String), (r4v11 java.lang.String) binds: [B:26:0x008c, B:11:0x0023] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:31:0x00a6  */
    /* JADX WARN: Removed duplicated region for block: B:37:0x00bd  */
    /* JADX WARN: Removed duplicated region for block: B:39:0x00c1  */
    /* JADX WARN: Removed duplicated region for block: B:52:0x00ba A[SYNTHETIC] */
    @Override // C4.a
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) {
        String str;
        int i6;
        Iterator it;
        int i7;
        B4.a aVar = B4.a.f492a;
        int i8 = this.f18622c;
        C3137A c3137a = C3137A.f25453a;
        SearchRecommendationsViewModel searchRecommendationsViewModel = this.f18623d;
        if (i8 == 0) {
            AbstractC2467b.l(obj);
            w4.k kVarPeekPendingPosterRestore = searchRecommendationsViewModel.peekPendingPosterRestore();
            if (kVarPeekPendingPosterRestore == null) {
                return c3137a;
            }
            String str2 = (String) kVarPeekPendingPosterRestore.f25469a;
            int iIntValue = ((Number) kVarPeekPendingPosterRestore.f25470b).intValue();
            C1180b c1180b = new C1180b(SnapshotStateKt.snapshotFlow(new C1931v0(searchRecommendationsViewModel, 6)), 1);
            this.f18620a = str2;
            this.f18621b = iIntValue;
            this.f18622c = 1;
            if (Y4.O.l(c1180b, this) != aVar) {
                str = str2;
                i6 = iIntValue;
            }
            return aVar;
        }
        if (i8 == 1) {
            i6 = this.f18621b;
            str = this.f18620a;
            AbstractC2467b.l(obj);
        } else {
            if (i8 == 2) {
                i6 = this.f18621b;
                str = this.f18620a;
                AbstractC2467b.l(obj);
                this.f18620a = str;
                this.f18621b = i6;
                this.f18622c = 3;
                if (V4.E.l(48L, this) != aVar) {
                    String str3 = str;
                    List list = ((C2105e2) searchRecommendationsViewModel.getUiState().getValue()).f17893c;
                    it = list.iterator();
                    i7 = 0;
                    while (true) {
                        if (it.hasNext()) {
                        }
                        i7++;
                    }
                    if (i7 >= 0) {
                    }
                }
                return aVar;
            }
            if (i8 != 3) {
                if (i8 != 4) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                AbstractC2467b.l(obj);
                searchRecommendationsViewModel.consumePosterRestorePending();
                return c3137a;
            }
            i6 = this.f18621b;
            str = this.f18620a;
            AbstractC2467b.l(obj);
            String str32 = str;
            List list2 = ((C2105e2) searchRecommendationsViewModel.getUiState().getValue()).f17893c;
            it = list2.iterator();
            i7 = 0;
            while (true) {
                if (it.hasNext()) {
                    i7 = -1;
                    break;
                }
                if (W.a.V((HomeMetaItem) it.next()).equals(str32)) {
                    break;
                }
                i7++;
            }
            if (i7 >= 0) {
                searchRecommendationsViewModel.consumePosterRestorePending();
                return c3137a;
            }
            C2194t2 c2194t2 = new C2194t2(this.f18624e, (i6 < 0 || i6 >= list2.size() || !W.a.V((HomeMetaItem) list2.get(i6)).equals(str32)) ? i7 : i6, this.f18625f, str32, null);
            this.f18620a = null;
            this.f18622c = 4;
        }
        this.f18620a = str;
        this.f18621b = i6;
        this.f18622c = 2;
        if (V4.E.K(this) != aVar) {
            this.f18620a = str;
            this.f18621b = i6;
            this.f18622c = 3;
            if (V4.E.l(48L, this) != aVar) {
            }
        }
        return aVar;
    }
}
