package com.strmr.ps.ui.details;

import android.widget.TextView;
import androidx.media3.common.C;
import androidx.media3.exoplayer.source.ProgressiveMediaSource;
import androidx.media3.session.MediaUtils;
import com.strmr.ps.R;
import com.strmr.ps.data.model.ContentItem;
import defpackage.C0609lc;
import defpackage.ak1;
import defpackage.ck1;
import defpackage.cr4;
import defpackage.e24;
import defpackage.e6a;
import defpackage.gr3;
import defpackage.n89;
import defpackage.s38;
import defpackage.st;
import defpackage.u69;
import defpackage.vx8;
import defpackage.x24;
import defpackage.y41;
import java.util.ArrayList;
import java.util.List;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import okhttp3.internal.http2.Http2Connection;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0002\u001a\u00020\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0002\u0010\u0003"}, d2 = {"Lak1;", "Le6a;", "<anonymous>", "(Lak1;)V"}, k = 3, mv = {2, 0, 0})
@DebugMetadata(c = "com.strmr.ps.ui.details.DetailsFragment$resolveViaAddonMeta$2$1", f = "DetailsFragment.kt", i = {}, l = {}, m = "invokeSuspend", n = {}, s = {})
@vx8
final class ad extends SuspendLambda implements gr3<ak1, Continuation<? super e6a>, Object> {
    public final /* synthetic */ u69 a;
    public final /* synthetic */ DetailsFragment b;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public ad(u69 u69Var, DetailsFragment detailsFragment, Continuation continuation) {
        super(2, continuation);
        this.a = u69Var;
        this.b = detailsFragment;
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Continuation create(Object obj, Continuation continuation) {
        return new ad(this.a, this.b, continuation);
    }

    @Override // defpackage.gr3
    public final Object invoke(Object obj, Object obj2) {
        ad adVar = (ad) create((ak1) obj, (Continuation) obj2);
        e6a e6aVar = e6a.a;
        adVar.invokeSuspend(e6aVar);
        return e6aVar;
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Object invokeSuspend(Object obj) {
        String releaseInfo;
        String poster;
        String background;
        String logo;
        String strAi;
        String strAi2;
        ck1 ck1Var = ck1.a;
        s38.b(obj);
        u69 u69Var = this.a;
        String description = u69Var.getDescription();
        DetailsFragment detailsFragment = this.b;
        if (description != null) {
            TextView textView = detailsFragment.r;
            if (textView == null) {
                cr4.n("overview");
                throw null;
            }
            textView.setText(description);
        }
        Object year = u69Var.getYear();
        if (year == null || (releaseInfo = year.toString()) == null) {
            releaseInfo = u69Var.getReleaseInfo();
        }
        ArrayList arrayListW = st.w(new String[]{releaseInfo, u69Var.getRuntime()});
        if (!arrayListW.isEmpty()) {
            TextView textView2 = detailsFragment.p;
            if (textView2 == null) {
                cr4.n("detailsMetadata");
                throw null;
            }
            textView2.setText(y41.ai(arrayListW, "  •  ", null, null, null, 62));
        }
        List genres = u69Var.getGenres();
        if (genres != null && (strAi2 = y41.ai(genres, ", ", null, null, null, 62)) != null) {
            TextView textView3 = detailsFragment.q;
            if (textView3 == null) {
                cr4.n("detailsGenreText");
                throw null;
            }
            textView3.setText(strAi2);
        }
        List cast = u69Var.getCast();
        if (cast != null && (strAi = y41.ai(y41.bk(cast, 5), ", ", null, null, null, 62)) != null) {
            ContentItem contentItem = detailsFragment.f;
            String cast2 = contentItem != null ? contentItem.getCast() : null;
            if (cast2 == null || n89.ab(cast2)) {
                TextView textView4 = detailsFragment.s;
                if (textView4 == null) {
                    cr4.n("detailsCast");
                    throw null;
                }
                x24.d(textView4, strAi);
            }
        }
        String imdbRating = u69Var.getImdbRating();
        if (imdbRating != null && n89.bc(imdbRating) != null) {
            int i = DetailsFragment.cn;
            cr4.n("ratingImdbValue");
            throw null;
        }
        ContentItem contentItem2 = detailsFragment.f;
        String posterUrl = contentItem2 != null ? contentItem2.getPosterUrl() : null;
        if ((posterUrl == null || n89.ab(posterUrl)) && (poster = u69Var.getPoster()) != null && !n89.ab(poster)) {
            ContentItem contentItem3 = detailsFragment.f;
            detailsFragment.f = contentItem3 != null ? contentItem3.copy(((-1179113) & 1) != 0 ? contentItem3.id : 0, ((-1179113) & 2) != 0 ? contentItem3.itemType : null, ((-1179113) & 4) != 0 ? contentItem3.tmdbId : 0, ((-1179113) & 8) != 0 ? contentItem3.imdbId : null, ((-1179113) & 16) != 0 ? contentItem3.title : null, ((-1179113) & 32) != 0 ? contentItem3.overview : null, ((-1179113) & 64) != 0 ? contentItem3.posterUrl : u69Var.getPoster(), ((-1179113) & 128) != 0 ? contentItem3.backdropUrl : null, ((-1179113) & 256) != 0 ? contentItem3.logoUrl : null, ((-1179113) & 512) != 0 ? contentItem3.episodeStillUrl : null, ((-1179113) & 1024) != 0 ? contentItem3.year : null, ((-1179113) & 2048) != 0 ? contentItem3.rating : null, ((-1179113) & 4096) != 0 ? contentItem3.ratingPercentage : null, ((-1179113) & 8192) != 0 ? contentItem3.genres : null, ((-1179113) & 16384) != 0 ? contentItem3.runtime : null, ((-1179113) & 32768) != 0 ? contentItem3.cast : null, ((-1179113) & 65536) != 0 ? contentItem3.certification : null, ((-1179113) & 131072) != 0 ? contentItem3.imdbRating : null, ((-1179113) & MediaUtils.TRANSACTION_SIZE_LIMIT_IN_BYTES) != 0 ? contentItem3.rottenTomatoesRating : null, ((-1179113) & 524288) != 0 ? contentItem3.traktRating : null, ((-1179113) & ProgressiveMediaSource.DEFAULT_LOADING_CHECK_INTERVAL_BYTES) != 0 ? contentItem3.watchProgress : null, ((-1179113) & 2097152) != 0 ? contentItem3.continueWatchingPlaybackId : null, ((-1179113) & 4194304) != 0 ? contentItem3.continueWatchingSeason : null, ((-1179113) & 8388608) != 0 ? contentItem3.continueWatchingEpisode : null, ((-1179113) & Http2Connection.OKHTTP_CLIENT_WINDOW_SIZE) != 0 ? contentItem3.continueWatchingIsRewatch : false, ((-1179113) & 33554432) != 0 ? contentItem3.showTitle : null, ((-1179113) & C.BUFFER_FLAG_NOT_DEPENDED_ON) != 0 ? contentItem3.sourceAddonUrl : null, ((-1179113) & C.BUFFER_FLAG_FIRST_SAMPLE) != 0 ? contentItem3.directStreamUrl : null, ((-1179113) & 268435456) != 0 ? contentItem3.calendarDate : null, ((-1179113) & 536870912) != 0 ? contentItem3.calendarDayLabel : null, ((-1179113) & 1073741824) != 0 ? contentItem3.calendarShowCount : 0, ((-1179113) & Integer.MIN_VALUE) != 0 ? contentItem3.calendarEpisodes : null, (2047 & 1) != 0 ? contentItem3.showStatus : null, (2047 & 2) != 0 ? contentItem3.episodeIndicator : null, (2047 & 4) != 0 ? contentItem3.unwatchedEpisodeCount : null, (2047 & 8) != 0 ? contentItem3.addedAt : null, (2047 & 16) != 0 ? contentItem3.watchedAt : null, (2047 & 32) != 0 ? contentItem3.watchers : null, (2047 & 64) != 0 ? contentItem3.tagline : null, (2047 & 128) != 0 ? contentItem3.stremioId : null, (2047 & 256) != 0 ? contentItem3.stremioType : null, (2047 & 512) != 0 ? contentItem3.extraData : null, (2047 & 1024) != 0 ? contentItem3.focusGifUrl : null) : null;
        }
        ContentItem contentItem4 = detailsFragment.f;
        String backdropUrl = contentItem4 != null ? contentItem4.getBackdropUrl() : null;
        if ((backdropUrl == null || n89.ab(backdropUrl)) && (background = u69Var.getBackground()) != null && !n89.ab(background)) {
            ContentItem contentItem5 = detailsFragment.f;
            detailsFragment.f = contentItem5 != null ? contentItem5.copy(((-1179113) & 1) != 0 ? contentItem5.id : 0, ((-1179113) & 2) != 0 ? contentItem5.itemType : null, ((-1179113) & 4) != 0 ? contentItem5.tmdbId : 0, ((-1179113) & 8) != 0 ? contentItem5.imdbId : null, ((-1179113) & 16) != 0 ? contentItem5.title : null, ((-1179113) & 32) != 0 ? contentItem5.overview : null, ((-1179113) & 64) != 0 ? contentItem5.posterUrl : null, ((-1179113) & 128) != 0 ? contentItem5.backdropUrl : u69Var.getBackground(), ((-1179113) & 256) != 0 ? contentItem5.logoUrl : null, ((-1179113) & 512) != 0 ? contentItem5.episodeStillUrl : null, ((-1179113) & 1024) != 0 ? contentItem5.year : null, ((-1179113) & 2048) != 0 ? contentItem5.rating : null, ((-1179113) & 4096) != 0 ? contentItem5.ratingPercentage : null, ((-1179113) & 8192) != 0 ? contentItem5.genres : null, ((-1179113) & 16384) != 0 ? contentItem5.runtime : null, ((-1179113) & 32768) != 0 ? contentItem5.cast : null, ((-1179113) & 65536) != 0 ? contentItem5.certification : null, ((-1179113) & 131072) != 0 ? contentItem5.imdbRating : null, ((-1179113) & MediaUtils.TRANSACTION_SIZE_LIMIT_IN_BYTES) != 0 ? contentItem5.rottenTomatoesRating : null, ((-1179113) & 524288) != 0 ? contentItem5.traktRating : null, ((-1179113) & ProgressiveMediaSource.DEFAULT_LOADING_CHECK_INTERVAL_BYTES) != 0 ? contentItem5.watchProgress : null, ((-1179113) & 2097152) != 0 ? contentItem5.continueWatchingPlaybackId : null, ((-1179113) & 4194304) != 0 ? contentItem5.continueWatchingSeason : null, ((-1179113) & 8388608) != 0 ? contentItem5.continueWatchingEpisode : null, ((-1179113) & Http2Connection.OKHTTP_CLIENT_WINDOW_SIZE) != 0 ? contentItem5.continueWatchingIsRewatch : false, ((-1179113) & 33554432) != 0 ? contentItem5.showTitle : null, ((-1179113) & C.BUFFER_FLAG_NOT_DEPENDED_ON) != 0 ? contentItem5.sourceAddonUrl : null, ((-1179113) & C.BUFFER_FLAG_FIRST_SAMPLE) != 0 ? contentItem5.directStreamUrl : null, ((-1179113) & 268435456) != 0 ? contentItem5.calendarDate : null, ((-1179113) & 536870912) != 0 ? contentItem5.calendarDayLabel : null, ((-1179113) & 1073741824) != 0 ? contentItem5.calendarShowCount : 0, ((-1179113) & Integer.MIN_VALUE) != 0 ? contentItem5.calendarEpisodes : null, (2047 & 1) != 0 ? contentItem5.showStatus : null, (2047 & 2) != 0 ? contentItem5.episodeIndicator : null, (2047 & 4) != 0 ? contentItem5.unwatchedEpisodeCount : null, (2047 & 8) != 0 ? contentItem5.addedAt : null, (2047 & 16) != 0 ? contentItem5.watchedAt : null, (2047 & 32) != 0 ? contentItem5.watchers : null, (2047 & 64) != 0 ? contentItem5.tagline : null, (2047 & 128) != 0 ? contentItem5.stremioId : null, (2047 & 256) != 0 ? contentItem5.stremioType : null, (2047 & 512) != 0 ? contentItem5.extraData : null, (2047 & 1024) != 0 ? contentItem5.focusGifUrl : null) : null;
            e24 e24Var = detailsFragment.ck;
            if (e24Var == null) {
                cr4.n("heroBackgroundController");
                throw null;
            }
            e24Var.e(u69Var.getBackground(), detailsFragment.getResources().getDrawable(R.drawable.default_background, null), null);
        }
        ContentItem contentItem6 = detailsFragment.f;
        String logoUrl = contentItem6 != null ? contentItem6.getLogoUrl() : null;
        if ((logoUrl == null || n89.ab(logoUrl)) && (logo = u69Var.getLogo()) != null && !n89.ab(logo)) {
            detailsFragment.ac(u69Var.getLogo());
            ContentItem contentItem7 = detailsFragment.f;
            detailsFragment.f = contentItem7 != null ? contentItem7.copy(((-1179113) & 1) != 0 ? contentItem7.id : 0, ((-1179113) & 2) != 0 ? contentItem7.itemType : null, ((-1179113) & 4) != 0 ? contentItem7.tmdbId : 0, ((-1179113) & 8) != 0 ? contentItem7.imdbId : null, ((-1179113) & 16) != 0 ? contentItem7.title : null, ((-1179113) & 32) != 0 ? contentItem7.overview : null, ((-1179113) & 64) != 0 ? contentItem7.posterUrl : null, ((-1179113) & 128) != 0 ? contentItem7.backdropUrl : null, ((-1179113) & 256) != 0 ? contentItem7.logoUrl : u69Var.getLogo(), ((-1179113) & 512) != 0 ? contentItem7.episodeStillUrl : null, ((-1179113) & 1024) != 0 ? contentItem7.year : null, ((-1179113) & 2048) != 0 ? contentItem7.rating : null, ((-1179113) & 4096) != 0 ? contentItem7.ratingPercentage : null, ((-1179113) & 8192) != 0 ? contentItem7.genres : null, ((-1179113) & 16384) != 0 ? contentItem7.runtime : null, ((-1179113) & 32768) != 0 ? contentItem7.cast : null, ((-1179113) & 65536) != 0 ? contentItem7.certification : null, ((-1179113) & 131072) != 0 ? contentItem7.imdbRating : null, ((-1179113) & MediaUtils.TRANSACTION_SIZE_LIMIT_IN_BYTES) != 0 ? contentItem7.rottenTomatoesRating : null, ((-1179113) & 524288) != 0 ? contentItem7.traktRating : null, ((-1179113) & ProgressiveMediaSource.DEFAULT_LOADING_CHECK_INTERVAL_BYTES) != 0 ? contentItem7.watchProgress : null, ((-1179113) & 2097152) != 0 ? contentItem7.continueWatchingPlaybackId : null, ((-1179113) & 4194304) != 0 ? contentItem7.continueWatchingSeason : null, ((-1179113) & 8388608) != 0 ? contentItem7.continueWatchingEpisode : null, ((-1179113) & Http2Connection.OKHTTP_CLIENT_WINDOW_SIZE) != 0 ? contentItem7.continueWatchingIsRewatch : false, ((-1179113) & 33554432) != 0 ? contentItem7.showTitle : null, ((-1179113) & C.BUFFER_FLAG_NOT_DEPENDED_ON) != 0 ? contentItem7.sourceAddonUrl : null, ((-1179113) & C.BUFFER_FLAG_FIRST_SAMPLE) != 0 ? contentItem7.directStreamUrl : null, ((-1179113) & 268435456) != 0 ? contentItem7.calendarDate : null, ((-1179113) & 536870912) != 0 ? contentItem7.calendarDayLabel : null, ((-1179113) & 1073741824) != 0 ? contentItem7.calendarShowCount : 0, ((-1179113) & Integer.MIN_VALUE) != 0 ? contentItem7.calendarEpisodes : null, (2047 & 1) != 0 ? contentItem7.showStatus : null, (2047 & 2) != 0 ? contentItem7.episodeIndicator : null, (2047 & 4) != 0 ? contentItem7.unwatchedEpisodeCount : null, (2047 & 8) != 0 ? contentItem7.addedAt : null, (2047 & 16) != 0 ? contentItem7.watchedAt : null, (2047 & 32) != 0 ? contentItem7.watchers : null, (2047 & 64) != 0 ? contentItem7.tagline : null, (2047 & 128) != 0 ? contentItem7.stremioId : null, (2047 & 256) != 0 ? contentItem7.stremioType : null, (2047 & 512) != 0 ? contentItem7.extraData : null, (2047 & 1024) != 0 ? contentItem7.focusGifUrl : null) : null;
        }
        String strA = C0609lc.a(u69Var);
        String str = detailsFragment.bt;
        if ((str == null || n89.ab(str)) && strA != null) {
            detailsFragment.bt = strA;
        }
        return e6a.a;
    }
}
