package h3;

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

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

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

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

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

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

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public final /* synthetic */ boolean f18688e;

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

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

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C2217x1(MoreEpisodesViewModel moreEpisodesViewModel, int i6, int i7, boolean z6, String str, String str2, int i8, A4.d dVar) {
        super(2, dVar);
        this.f18685b = moreEpisodesViewModel;
        this.f18686c = i6;
        this.f18687d = i7;
        this.f18688e = z6;
        this.f18689f = str;
        this.f18690j = str2;
        this.f18691k = i8;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        return new C2217x1(this.f18685b, this.f18686c, this.f18687d, this.f18688e, this.f18689f, this.f18690j, this.f18691k, dVar);
    }

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

    @Override // C4.a
    public final Object invokeSuspend(Object obj) {
        B4.a aVar = B4.a.f492a;
        int i6 = this.f18684a;
        x4.y yVar = x4.y.f26065a;
        MoreEpisodesViewModel moreEpisodesViewModel = this.f18685b;
        int i7 = this.f18691k;
        try {
            if (i6 == 0) {
                AbstractC2467b.l(obj);
                Y4.H h5 = moreEpisodesViewModel._isLoading;
                Boolean bool = Boolean.TRUE;
                Y4.c0 c0Var = (Y4.c0) h5;
                c0Var.getClass();
                c0Var.k(null, bool);
                ((Y4.c0) moreEpisodesViewModel._error).j(null);
                Y4.c0 c0Var2 = (Y4.c0) moreEpisodesViewModel._episodes;
                c0Var2.getClass();
                c0Var2.k(null, yVar);
                X2.f fVar = moreEpisodesViewModel.repository;
                int i8 = this.f18686c;
                int i9 = this.f18687d;
                boolean z6 = this.f18688e;
                String str = this.f18689f;
                String str2 = this.f18690j;
                this.f18684a = 1;
                obj = fVar.f(i8, i9, z6, str, str2, this);
                if (obj == aVar) {
                    return aVar;
                }
            } else {
                if (i6 != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                AbstractC2467b.l(obj);
            }
            List list = (List) obj;
            if (i7 == moreEpisodesViewModel.requestGen) {
                ((Y4.c0) moreEpisodesViewModel._episodes).j(list);
                Y4.H h6 = moreEpisodesViewModel._isLoading;
                Boolean bool2 = Boolean.FALSE;
                Y4.c0 c0Var3 = (Y4.c0) h6;
                c0Var3.getClass();
                c0Var3.k(null, bool2);
            }
        } catch (Exception e6) {
            if (i7 == moreEpisodesViewModel.requestGen) {
                Y4.c0 c0Var4 = (Y4.c0) moreEpisodesViewModel._episodes;
                c0Var4.getClass();
                c0Var4.k(null, yVar);
                Y4.H h7 = moreEpisodesViewModel._error;
                String message = e6.getMessage();
                if (message == null) {
                    message = "Failed to load episodes";
                }
                Y4.c0 c0Var5 = (Y4.c0) h7;
                c0Var5.getClass();
                c0Var5.k(null, message);
                Y4.H h8 = moreEpisodesViewModel._isLoading;
                Boolean bool3 = Boolean.FALSE;
                Y4.c0 c0Var6 = (Y4.c0) h8;
                c0Var6.getClass();
                c0Var6.k(null, bool3);
            }
        }
        return C3137A.f25453a;
    }
}
