package V2;

import android.content.Context;
import androidx.compose.runtime.State;
import com.debridstream.tv.PlayerViewModel;
import com.debridstream.tv.data.home.HomeMetaItem;
import com.debridstream.tv.screens.VideoDetailsViewModel;
import java.util.List;
import m3.AbstractC2467b;
import org.json.JSONException;
import w4.C3137A;

/* JADX INFO: loaded from: classes.dex */
public final class Q extends C4.j implements J4.e {

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

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

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

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

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

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public final /* synthetic */ androidx.navigation.H f7489f;

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

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

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public Q(Context context, HomeMetaItem homeMetaItem, boolean z6, PlayerViewModel playerViewModel, androidx.navigation.H h5, VideoDetailsViewModel videoDetailsViewModel, String str, State state, A4.d dVar) {
        super(2, dVar);
        this.f7485b = context;
        this.f7486c = homeMetaItem;
        this.f7487d = z6;
        this.f7488e = playerViewModel;
        this.f7489f = h5;
        this.f7490j = videoDetailsViewModel;
        this.f7491k = str;
        this.l = state;
    }

    @Override // C4.a
    public final A4.d create(Object obj, A4.d dVar) {
        return new Q(this.f7485b, this.f7486c, this.f7487d, this.f7488e, this.f7489f, this.f7490j, this.f7491k, this.l, dVar);
    }

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

    @Override // C4.a
    public final Object invokeSuspend(Object obj) throws JSONException {
        Q q6;
        B4.a aVar = B4.a.f492a;
        int i6 = this.f7484a;
        if (i6 == 0) {
            AbstractC2467b.l(obj);
            Context applicationContext = this.f7485b.getApplicationContext();
            Y4.c0 c0Var = z3.f8212a;
            kotlin.jvm.internal.o.e(applicationContext);
            String strA = z3.a(applicationContext);
            String str = strA == null ? "main" : strA;
            Y4.c0 c0Var2 = C0706p0.f7996a;
            List listB = C0706p0.b(str);
            List list = (List) ((Y4.c0) C0706p0.f8003h.f8871a).getValue();
            q.F0 f0 = AbstractC0693m0.f7892a;
            boolean z6 = ((n3) this.l.getValue()).f7972b.f7759c && str.equals("main");
            this.f7484a = 1;
            q6 = this;
            obj = AbstractC0693m0.c(this.f7486c, str, listB, list, z6, this.f7487d, this.f7488e, q6);
            if (obj == aVar) {
                return aVar;
            }
        } else {
            if (i6 != 1) {
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
            }
            AbstractC2467b.l(obj);
            q6 = this;
        }
        boolean zBooleanValue = ((Boolean) obj).booleanValue();
        androidx.navigation.H h5 = q6.f7489f;
        if (zBooleanValue) {
            androidx.navigation.H.n(h5, "video_player", null, 6);
        } else {
            q6.f7490j.selectVideoItem(q6.f7486c, q6.f7487d, q6.f7491k);
            AbstractC0693m0.b(h5);
        }
        return C3137A.f25453a;
    }
}
