package h3;

import android.content.Context;
import androidx.compose.runtime.State;
import com.debridstream.tv.data.home.HomeMetaItem;
import m3.AbstractC2467b;
import w4.C3137A;

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

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

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

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

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

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

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

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

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C2137j4(Context context, HomeMetaItem homeMetaItem, boolean z6, Integer num, Integer num2, boolean z7, State state, A4.d dVar) {
        super(2, dVar);
        this.f18089b = context;
        this.f18090c = homeMetaItem;
        this.f18091d = z6;
        this.f18092e = num;
        this.f18093f = num2;
        this.f18094j = z7;
        this.f18095k = state;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        return new C2137j4(this.f18089b, this.f18090c, this.f18091d, this.f18092e, this.f18093f, this.f18094j, this.f18095k, dVar);
    }

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

    @Override // C4.a
    public final Object invokeSuspend(Object obj) {
        C2137j4 c2137j4;
        B4.a aVar = B4.a.f492a;
        int i6 = this.f18088a;
        HomeMetaItem homeMetaItem = this.f18090c;
        boolean z6 = this.f18094j;
        if (i6 == 0) {
            AbstractC2467b.l(obj);
            float f6 = AbstractC2190s4.f18484a;
            String str = (String) this.f18095k.getValue();
            Integer num = kotlin.jvm.internal.o.c(homeMetaItem.getType(), "tv") ? this.f18092e : null;
            Integer num2 = kotlin.jvm.internal.o.c(homeMetaItem.getType(), "tv") ? this.f18093f : null;
            this.f18088a = 1;
            c2137j4 = this;
            obj = W0.e.L(this.f18089b, homeMetaItem, str, this.f18091d, num, num2, !z6, c2137j4);
            if (obj == aVar) {
                return aVar;
            }
        } else {
            if (i6 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            AbstractC2467b.l(obj);
            c2137j4 = this;
        }
        boolean zBooleanValue = ((Boolean) obj).booleanValue();
        String str2 = (kotlin.jvm.internal.o.c(homeMetaItem.getType(), "tv") && z6) ? "Episode marked as unwatched" : kotlin.jvm.internal.o.c(homeMetaItem.getType(), "tv") ? "Episode marked as watched" : z6 ? "Movie marked as unwatched" : "Movie marked as watched";
        a5.c cVar = K2.p.f4116a;
        if (!zBooleanValue) {
            str2 = c2137j4.f18091d ? "Failed to update Trakt history" : "Failed to update watched state";
        }
        K2.p.a(str2, (10 & 2) != 0 ? "" : "Could not resolve a playable download URL for this link.", zBooleanValue ? K2.r.f4126a : K2.r.f4127b, (10 & 8) != 0 ? androidx.media3.common.C.DEFAULT_MAX_SEEK_TO_PREVIOUS_POSITION_MS : 4000L);
        return C3137A.f25453a;
    }
}
