package d3;

import V2.C0706p0;
import V2.z3;
import android.content.Context;
import androidx.compose.runtime.MutableIntState;
import androidx.compose.runtime.MutableState;
import androidx.compose.runtime.State;
import androidx.media3.common.TrackSelectionParameters;
import androidx.media3.exoplayer.ExoPlayer;
import com.debridstream.tv.PlayerViewModel;
import com.debridstream.tv.data.home.HomeMetaItem;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
import h3.F2;
import h3.R3;
import h3.T3;
import h3.e5;
import h3.n5;
import org.json.JSONException;
import w4.C3137A;

/* JADX INFO: loaded from: classes.dex */
public final /* synthetic */ class D0 implements J4.a {

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

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

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

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

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

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

    public /* synthetic */ D0(V4.C c6, MutableIntState mutableIntState, MutableState mutableState, MutableState mutableState2, String str) {
        this.f15046a = 2;
        this.f15047b = c6;
        this.f15049d = mutableState;
        this.f15050e = mutableState2;
        this.f15048c = str;
        this.f15051f = mutableIntState;
    }

    /* JADX WARN: Multi-variable type inference failed */
    @Override // J4.a
    public final Object invoke() throws JSONException {
        C3137A c3137a = C3137A.f25453a;
        Object obj = this.f15050e;
        Object obj2 = this.f15049d;
        Object obj3 = this.f15051f;
        Object obj4 = this.f15048c;
        Object obj5 = this.f15047b;
        switch (this.f15046a) {
            case 0:
                ((PlayerViewModel) obj5).setExternalSubtitle(null, null);
                ((MutableState) obj2).setValue(null);
                ExoPlayer exoPlayer = (ExoPlayer) obj4;
                TrackSelectionParameters.Builder builderBuildUpon = exoPlayer.getTrackSelectionParameters().buildUpon();
                kotlin.jvm.internal.o.g(builderBuildUpon, "buildUpon(...)");
                builderBuildUpon.setTrackTypeDisabled(3, true);
                builderBuildUpon.clearOverridesOfType(3);
                exoPlayer.setTrackSelectionParameters(builderBuildUpon.build());
                ((MutableState) obj).setValue(0L);
                ((MutableState) obj3).setValue(Boolean.FALSE);
                break;
            case 1:
                V4.E.y((V4.C) obj5, null, null, new F2((n0.x) obj4, (n0.x) obj2, (D.H) obj, (State) obj3, null), 3);
                break;
            case 2:
                J.f fVar = T3.f17405a;
                MutableState mutableState = (MutableState) obj2;
                String str = (String) mutableState.getValue();
                if (str != null) {
                    V4.C c6 = (V4.C) obj5;
                    V4.E.y(c6, null, null, new R3((MutableState) obj, (String) obj4, str, mutableState, (MutableIntState) obj3, null), 3);
                }
                break;
            default:
                Y4.c0 c0Var = z3.f8212a;
                String strA = z3.a((Context) obj5);
                if (strA == null) {
                    strA = "main";
                }
                Y4.c0 c0Var2 = C0706p0.f7996a;
                HomeMetaItem homeMetaItem = (HomeMetaItem) obj4;
                C0706p0.e(homeMetaItem.getTmdbId(), strA, homeMetaItem.getType());
                FirebaseUser currentUser = FirebaseAuth.getInstance().getCurrentUser();
                String strC = g3.m.c(homeMetaItem.getTmdbId(), homeMetaItem.getType());
                if (currentUser != null && strC != null) {
                    V4.E.y((V4.C) obj3, c5.d.f13466b, null, new e5(currentUser, strA, strC, null), 2);
                }
                ((MutableState) obj2).setValue(null);
                n5.o((MutableState) obj, false);
                break;
        }
        return c3137a;
    }

    public /* synthetic */ D0(Context context, HomeMetaItem homeMetaItem, V4.C c6, MutableState mutableState, MutableState mutableState2) {
        this.f15046a = 3;
        this.f15047b = context;
        this.f15048c = homeMetaItem;
        this.f15051f = c6;
        this.f15049d = mutableState;
        this.f15050e = mutableState2;
    }

    public /* synthetic */ D0(Object obj, Object obj2, Object obj3, Object obj4, State state, int i6) {
        this.f15046a = i6;
        this.f15047b = obj;
        this.f15048c = obj2;
        this.f15049d = obj3;
        this.f15050e = obj4;
        this.f15051f = state;
    }
}
