package h3;

import android.content.Context;
import androidx.compose.runtime.MutableIntState;
import androidx.compose.runtime.State;
import java.util.Set;
import m3.AbstractC2467b;
import w4.C3137A;

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

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

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final /* synthetic */ X2.i f18136c;

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

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

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

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

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public C2146l1(X2.i iVar, Set set, int i6, boolean z6, MutableIntState mutableIntState, Context context, State state, A4.d dVar) {
        super(2, dVar);
        this.f18136c = iVar;
        this.f18137d = set;
        this.f18138e = i6;
        this.f18139f = z6;
        this.f18140j = mutableIntState;
        this.f18141k = context;
        this.l = state;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        return new C2146l1(this.f18136c, this.f18137d, this.f18138e, this.f18139f, this.f18140j, this.f18141k, this.l, dVar);
    }

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

    @Override // C4.a
    public final Object invokeSuspend(Object obj) {
        C2146l1 c2146l1;
        boolean z6;
        B4.a aVar = B4.a.f492a;
        int i6 = this.f18135b;
        if (i6 == 0) {
            AbstractC2467b.l(obj);
            J.f fVar = AbstractC2211w1.f18642a;
            int intValue = this.f18140j.getIntValue();
            int i7 = intValue < 1 ? 1 : intValue;
            int i8 = this.f18136c.f8597e;
            int i9 = i8 < 1 ? 1 : i8;
            Context context = i3.M.f18897a;
            boolean zContains = this.f18137d.contains(i3.M.g(this.f18138e, i7, i9));
            this.f18134a = zContains;
            this.f18135b = 1;
            c2146l1 = this;
            Object objL = AbstractC2211w1.l(this.f18139f, this.f18138e, this.f18141k, this.l, i7, i9, !zContains, c2146l1);
            if (objL == aVar) {
                return aVar;
            }
            z6 = zContains;
            obj = objL;
        } else {
            if (i6 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            z6 = this.f18134a;
            AbstractC2467b.l(obj);
            c2146l1 = this;
        }
        boolean zBooleanValue = ((Boolean) obj).booleanValue();
        a5.c cVar = K2.p.f4116a;
        K2.p.a(zBooleanValue ? z6 ? "Episode marked as unwatched" : "Episode marked as watched" : c2146l1.f18139f ? "Failed to update Trakt history" : "Failed to update episode watched state", (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;
    }
}
