package defpackage;

import android.content.Context;
import android.os.Bundle;
import androidx.media3.container.NalUnitUtil;
import androidx.view.j;
import com.strmr.ps.R;
import com.strmr.ps.data.local.entity.PlaybackProgress;
import com.strmr.ps.data.model.ContentItem;
import com.strmr.ps.ui.sources.SourcesActivity;
import kotlin.Metadata;

/* JADX INFO: renamed from: s87, reason: from Kotlin metadata and case insensitive filesystem */
/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\u0002\n\u0000¨\u0006\u0000"}, d2 = {"app_sideloadRelease"}, k = 2, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
public final class C0690s87 {
    public static final void a(Context context, ContentItem contentItem, j jVar) {
        Integer continueWatchingEpisode;
        Integer continueWatchingSeason;
        Double dBc;
        cr4.g(contentItem, "item");
        String runtime = contentItem.getRuntime();
        double dDoubleValue = (runtime == null || (dBc = n89.bc(runtime)) == null) ? 0.0d : dBc.doubleValue();
        Double watchProgress = contentItem.getWatchProgress();
        long jDoubleValue = (long) (dDoubleValue * ((double) 60) * ((double) 1000) * (watchProgress != null ? watchProgress.doubleValue() : 0.0d));
        contentItem.getTitle();
        if (jVar == null) {
            if (!contentItem.isTvShow() || contentItem.getContinueWatchingSeason() == null || contentItem.getContinueWatchingEpisode() == null) {
                int i = SourcesActivity.bd;
                SourcesActivity.a.d(context, contentItem, jDoubleValue);
                return;
            } else {
                int i2 = SourcesActivity.bd;
                SourcesActivity.a.c(context, contentItem, contentItem.getContinueWatchingSeason().intValue(), contentItem.getContinueWatchingEpisode().intValue(), jDoubleValue, 32);
                return;
            }
        }
        int iIntValue = -1;
        int iIntValue2 = (!contentItem.isTvShow() || (continueWatchingSeason = contentItem.getContinueWatchingSeason()) == null) ? -1 : continueWatchingSeason.intValue();
        if (contentItem.isTvShow() && (continueWatchingEpisode = contentItem.getContinueWatchingEpisode()) != null) {
            iIntValue = continueWatchingEpisode.intValue();
        }
        Bundle bundle = new Bundle();
        bundle.putParcelable("content_item", contentItem);
        bundle.putInt("season", iIntValue2);
        bundle.putInt(PlaybackProgress.TYPE_EPISODE, iIntValue);
        bundle.putLong("resume_position_ms", jDoubleValue);
        jVar.k(R.id.action_global_to_mobileSources, bundle, null);
    }

    public static void b(Context context, ContentItem contentItem, int i, int i2, j jVar) {
        cr4.g(contentItem, "item");
        if (jVar == null) {
            int i3 = SourcesActivity.bd;
            SourcesActivity.a.b(context, contentItem, i, i2, 0L, null);
            return;
        }
        Bundle bundle = new Bundle();
        bundle.putParcelable("content_item", contentItem);
        bundle.putInt("season", i);
        bundle.putInt(PlaybackProgress.TYPE_EPISODE, i2);
        bundle.putString("air_date", null);
        bundle.putLong("resume_position_ms", 0L);
        jVar.k(R.id.action_global_to_mobileSources, bundle, null);
    }
}
