package M2;

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

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

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

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

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

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

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

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

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

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C0526l0(Context context, HomeMetaItem homeMetaItem, String str, boolean z6, Integer num, Integer num2, boolean z7, A4.d dVar) {
        super(2, dVar);
        this.f4815b = context;
        this.f4816c = homeMetaItem;
        this.f4817d = str;
        this.f4818e = z6;
        this.f4819f = num;
        this.f4820j = num2;
        this.f4821k = z7;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        return new C0526l0(this.f4815b, this.f4816c, this.f4817d, this.f4818e, this.f4819f, this.f4820j, this.f4821k, dVar);
    }

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

    @Override // C4.a
    public final Object invokeSuspend(Object obj) {
        C0526l0 c0526l0;
        B4.a aVar = B4.a.f492a;
        int i6 = this.f4814a;
        HomeMetaItem homeMetaItem = this.f4816c;
        boolean z6 = this.f4821k;
        if (i6 == 0) {
            AbstractC2467b.l(obj);
            Integer num = kotlin.jvm.internal.o.c(homeMetaItem.getType(), "tv") ? this.f4819f : null;
            Integer num2 = kotlin.jvm.internal.o.c(homeMetaItem.getType(), "tv") ? this.f4820j : null;
            this.f4814a = 1;
            c0526l0 = this;
            obj = W0.e.L(this.f4815b, homeMetaItem, this.f4817d, this.f4818e, num, num2, !z6, c0526l0);
            if (obj == aVar) {
                return aVar;
            }
        } else {
            if (i6 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            AbstractC2467b.l(obj);
            c0526l0 = this;
        }
        boolean zBooleanValue = ((Boolean) obj).booleanValue();
        String str = (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) {
            str = c0526l0.f4818e ? "Failed to update Trakt history" : "Failed to update watched state";
        }
        K2.p.a(str, (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;
    }
}
