package defpackage;

import android.widget.TextView;
import androidx.fragment.app.o;
import androidx.lifecycle.n;
import androidx.lifecycle.s;
import com.strmr.ps.data.model.ContentItem;
import com.strmr.ps.data.model.trakt.TraktDeviceCodeResponse;
import com.strmr.ps.data.remote.AddonMetadataClient;
import com.strmr.ps.data.remote.NetworkMonitor;
import com.strmr.ps.data.remote.api.TMDBApiService;
import com.strmr.ps.data.remote.model.alldebrid.AllDebridPinData;
import com.strmr.ps.data.remote.model.premiumize.PremiumizeDeviceCodeResponse;
import com.strmr.ps.data.remote.model.realdebrid.RealDebridDeviceCodeResponse;
import com.strmr.ps.data.remote.model.torbox.TorBoxDeviceCodeData;
import com.strmr.ps.ui.home.HomeFragment;
import com.strmr.ps.ui.mobile.settings.MobileAccountsFragment;
import com.strmr.ps.ui.movies.MoviesFragment;
import com.strmr.ps.ui.tvshows.TvShowsFragment;
import defpackage.cf1;
import defpackage.dw7;
import defpackage.ec7;
import defpackage.s16;
import defpackage.vn8;
import defpackage.wm8;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;

/* JADX INFO: loaded from: classes3.dex */
public final /* synthetic */ class dz5 implements qq3 {
    public final /* synthetic */ int a;
    public final /* synthetic */ Object b;
    public final /* synthetic */ Object c;

    public /* synthetic */ dz5(Object obj, Object obj2, int i) {
        this.a = i;
        this.b = obj;
        this.c = obj2;
    }

    @Override // defpackage.qq3
    public final Object invoke() {
        dk1 dk1Var;
        dk1 dk1Var2;
        String showStatus;
        String showStatus2;
        String showStatus3;
        int iY;
        int i = this.a;
        final int i2 = 1;
        e6a e6aVar = e6a.a;
        Object obj = this.c;
        Object obj2 = this.b;
        switch (i) {
            case 0:
                MobileAccountsFragment mobileAccountsFragment = (MobileAccountsFragment) obj2;
                AllDebridPinData allDebridPinData = (AllDebridPinData) obj;
                String pin = allDebridPinData.getPin();
                String check = allDebridPinData.getCheck();
                int expiresIn = allDebridPinData.getExpiresIn();
                fx4 fx4Var = mobileAccountsFragment.ag;
                if (fx4Var != null) {
                    ((rx4) fx4Var).h(null);
                }
                n nVarE = n41.e(mobileAccountsFragment, "getViewLifecycleOwner(...)");
                m12 m12Var = sc2.a;
                mobileAccountsFragment.ag = wj0.c(nVarE, m02.c, null, new ty5(expiresIn, mobileAccountsFragment, pin, check, null), 2);
                return e6aVar;
            case 1:
                MobileAccountsFragment mobileAccountsFragment2 = (MobileAccountsFragment) obj2;
                PremiumizeDeviceCodeResponse premiumizeDeviceCodeResponse = (PremiumizeDeviceCodeResponse) obj;
                String deviceCode = premiumizeDeviceCodeResponse.getDeviceCode();
                int interval = premiumizeDeviceCodeResponse.getInterval();
                int expiresIn2 = premiumizeDeviceCodeResponse.getExpiresIn();
                fx4 fx4Var2 = mobileAccountsFragment2.ag;
                if (fx4Var2 != null) {
                    ((rx4) fx4Var2).h(null);
                }
                n nVarE2 = n41.e(mobileAccountsFragment2, "getViewLifecycleOwner(...)");
                m12 m12Var2 = sc2.a;
                mobileAccountsFragment2.ag = wj0.c(nVarE2, m02.c, null, new vy5(expiresIn2, interval, mobileAccountsFragment2, deviceCode, null), 2);
                return e6aVar;
            case 2:
                MobileAccountsFragment mobileAccountsFragment3 = (MobileAccountsFragment) obj2;
                RealDebridDeviceCodeResponse realDebridDeviceCodeResponse = (RealDebridDeviceCodeResponse) obj;
                String deviceCode2 = realDebridDeviceCodeResponse.getDeviceCode();
                int interval2 = realDebridDeviceCodeResponse.getInterval();
                int expiresIn3 = realDebridDeviceCodeResponse.getExpiresIn();
                fx4 fx4Var3 = mobileAccountsFragment3.ag;
                if (fx4Var3 != null) {
                    ((rx4) fx4Var3).h(null);
                }
                n nVarE3 = n41.e(mobileAccountsFragment3, "getViewLifecycleOwner(...)");
                m12 m12Var3 = sc2.a;
                mobileAccountsFragment3.ag = wj0.c(nVarE3, m02.c, null, new xy5(expiresIn3, interval2, mobileAccountsFragment3, deviceCode2, null), 2);
                return e6aVar;
            case 3:
                MobileAccountsFragment mobileAccountsFragment4 = (MobileAccountsFragment) obj2;
                TorBoxDeviceCodeData torBoxDeviceCodeData = (TorBoxDeviceCodeData) obj;
                String deviceCode3 = torBoxDeviceCodeData.getDeviceCode();
                Integer interval3 = torBoxDeviceCodeData.getInterval();
                int iIntValue = interval3 != null ? interval3.intValue() : 5;
                int expiresInSeconds = torBoxDeviceCodeData.getExpiresInSeconds();
                fx4 fx4Var4 = mobileAccountsFragment4.ag;
                if (fx4Var4 != null) {
                    dk1Var = null;
                    ((rx4) fx4Var4).h(null);
                } else {
                    dk1Var = null;
                }
                n nVarE4 = n41.e(mobileAccountsFragment4, "getViewLifecycleOwner(...)");
                m12 m12Var4 = sc2.a;
                mobileAccountsFragment4.ag = wj0.c(nVarE4, m02.c, dk1Var, new zy5(expiresInSeconds, iIntValue, mobileAccountsFragment4, deviceCode3, null), 2);
                return e6aVar;
            case 4:
                MobileAccountsFragment mobileAccountsFragment5 = (MobileAccountsFragment) obj2;
                TraktDeviceCodeResponse traktDeviceCodeResponse = (TraktDeviceCodeResponse) obj;
                String deviceCode4 = traktDeviceCodeResponse.getDeviceCode();
                int interval4 = traktDeviceCodeResponse.getInterval();
                int expiresIn4 = traktDeviceCodeResponse.getExpiresIn();
                fx4 fx4Var5 = mobileAccountsFragment5.ag;
                if (fx4Var5 != null) {
                    dk1Var2 = null;
                    ((rx4) fx4Var5).h(null);
                } else {
                    dk1Var2 = null;
                }
                n nVarE5 = n41.e(mobileAccountsFragment5, "getViewLifecycleOwner(...)");
                m12 m12Var5 = sc2.a;
                mobileAccountsFragment5.ag = wj0.c(nVarE5, m02.c, dk1Var2, new cz5(expiresIn4, interval4, mobileAccountsFragment5, deviceCode4, null), 2);
                return e6aVar;
            case 5:
                return kp0.g(bw3.a, (gj1) obj2, new tt6((vy6) obj, null), 2).a;
            case 6:
                int i3 = cf1.a.d;
                sq3 sq3Var = ((cf1) obj2).e;
                Object obj3 = ((dw7.h) obj).a;
                cr4.d(obj3);
                sq3Var.invoke(Integer.valueOf(((kd7) obj3).m));
                return e6aVar;
            case 7:
                Enum[] enumArr = ((sn2) obj2).a;
                gn2 gn2Var = new gn2((String) obj, enumArr.length);
                for (Enum r0 : enumArr) {
                    gn2Var.j(r0.name(), false);
                }
                return gn2Var;
            case 8:
                TextView textView = (TextView) obj2;
                textView.post(new yg(textView, (ContentItem) obj, 25));
                return e6aVar;
            case 9:
                final HomeFragment homeFragment = (HomeFragment) obj2;
                final ContentItem contentItem = (ContentItem) obj;
                int i4 = HomeFragment.aq;
                String logoUrl = contentItem.getLogoUrl();
                u24 u24Var = homeFragment.r;
                if (u24Var == null) {
                    cr4.n("heroLogoLoader");
                    throw null;
                }
                u24Var.b(logoUrl, true);
                nl3 nl3Var = homeFragment.f;
                cr4.d(nl3Var);
                nl3Var.o.setText(contentItem.getTitle());
                nl3 nl3Var2 = homeFragment.f;
                cr4.d(nl3Var2);
                x24.g(nl3Var2.n, contentItem.getTagline());
                String strC = x24.c(contentItem);
                nl3 nl3Var3 = homeFragment.f;
                cr4.d(nl3Var3);
                nl3Var3.l.setText(strC != null ? strC : "");
                nl3 nl3Var4 = homeFragment.f;
                cr4.d(nl3Var4);
                x24.f(nl3Var4.k, contentItem);
                nl3 nl3Var5 = homeFragment.f;
                cr4.d(nl3Var5);
                x24.e(nl3Var5.h, contentItem.getGenres());
                nl3 nl3Var6 = homeFragment.f;
                cr4.d(nl3Var6);
                x24.d(nl3Var6.g, contentItem.getCast());
                String cast = contentItem.getCast();
                boolean z = cast == null || n89.ab(cast);
                String genres = contentItem.getGenres();
                boolean z2 = genres == null || n89.ab(genres);
                String logoUrl2 = contentItem.getLogoUrl();
                final boolean z3 = logoUrl2 == null || n89.ab(logoUrl2);
                boolean z4 = contentItem.isTvShow() && ((showStatus = contentItem.getShowStatus()) == null || n89.ab(showStatus));
                String tagline = contentItem.getTagline();
                if (tagline != null && !n89.ab(tagline)) {
                    i2 = 0;
                }
                if (z || z2 || z3 || z4 || i2 != 0) {
                    m24 m24Var = m24.a;
                    i85 viewLifecycleOwner = homeFragment.getViewLifecycleOwner();
                    cr4.f(viewLifecycleOwner, "getViewLifecycleOwner(...)");
                    n nVarA = s.a(viewLifecycleOwner);
                    rx4 rx4Var = homeFragment.p;
                    TMDBApiService tMDBApiServiceQ = homeFragment.q();
                    AddonMetadataClient addonMetadataClient = homeFragment.af;
                    if (addonMetadataClient == null) {
                        cr4.n("addonMetadataClient");
                        throw null;
                    }
                    final int i5 = 0;
                    homeFragment.p = m24.c(nVarA, rx4Var, contentItem, tMDBApiServiceQ, addonMetadataClient, new sq3() { // from class: y74
                        @Override // defpackage.sq3
                        public final Object invoke(Object obj4) {
                            d34 d34Var;
                            String logoUrl3;
                            d34 d34Var2;
                            String logoUrl4;
                            d34 d34Var3;
                            String logoUrl5;
                            int i6 = i5;
                            e6a e6aVar2 = e6a.a;
                            ContentItem contentItem2 = contentItem;
                            boolean z5 = z3;
                            o oVar = homeFragment;
                            switch (i6) {
                                case 0:
                                    HomeFragment homeFragment2 = (HomeFragment) oVar;
                                    ContentItem contentItem3 = (ContentItem) obj4;
                                    int i7 = HomeFragment.aq;
                                    cr4.g(contentItem3, "enrichedItem");
                                    nl3 nl3Var7 = homeFragment2.f;
                                    if (nl3Var7 != null) {
                                        x24.e(nl3Var7.h, contentItem3.getGenres());
                                        x24.d(nl3Var7.g, contentItem3.getCast());
                                        x24.g(nl3Var7.n, contentItem3.getTagline());
                                        if (z5 && (logoUrl3 = contentItem3.getLogoUrl()) != null && !n89.ab(logoUrl3)) {
                                            u24 u24Var2 = homeFragment2.r;
                                            if (u24Var2 == null) {
                                                cr4.n("heroLogoLoader");
                                                throw null;
                                            }
                                            u24Var2.b(contentItem3.getLogoUrl(), false);
                                        }
                                        String showStatus4 = contentItem3.getShowStatus();
                                        if (showStatus4 != null && !n89.ab(showStatus4)) {
                                            x24.f(nl3Var7.k, contentItem3);
                                        }
                                        if (contentItem2.getTmdbId() <= 0 && contentItem3.getTmdbId() > 0 && (d34Var = homeFragment2.ak) != null) {
                                            d34Var.h(contentItem3);
                                        }
                                    }
                                    return e6aVar2;
                                case 1:
                                    MoviesFragment moviesFragment = (MoviesFragment) oVar;
                                    ContentItem contentItem4 = (ContentItem) obj4;
                                    cr4.g(contentItem4, "enrichedItem");
                                    TextView textView2 = moviesFragment.r;
                                    if (textView2 == null) {
                                        cr4.n("heroGenreText");
                                        throw null;
                                    }
                                    x24.e(textView2, contentItem4.getGenres());
                                    TextView textView3 = moviesFragment.t;
                                    if (textView3 == null) {
                                        cr4.n("heroCast");
                                        throw null;
                                    }
                                    x24.d(textView3, contentItem4.getCast());
                                    TextView textView4 = moviesFragment.u;
                                    if (textView4 == null) {
                                        cr4.n("heroTagline");
                                        throw null;
                                    }
                                    x24.g(textView4, contentItem4.getTagline());
                                    if (z5 && (logoUrl4 = contentItem4.getLogoUrl()) != null && !n89.ab(logoUrl4)) {
                                        u24 u24Var3 = moviesFragment.z;
                                        if (u24Var3 == null) {
                                            cr4.n("heroLogoLoader");
                                            throw null;
                                        }
                                        u24Var3.b(contentItem4.getLogoUrl(), false);
                                    }
                                    String showStatus5 = contentItem4.getShowStatus();
                                    if (showStatus5 != null && !n89.ab(showStatus5)) {
                                        TextView textView5 = moviesFragment.q;
                                        if (textView5 == null) {
                                            cr4.n("heroMetadata");
                                            throw null;
                                        }
                                        x24.f(textView5, contentItem4);
                                    }
                                    if (contentItem2.getTmdbId() <= 0 && contentItem4.getTmdbId() > 0 && (d34Var2 = moviesFragment.ba) != null) {
                                        d34Var2.h(contentItem4);
                                    }
                                    return e6aVar2;
                                default:
                                    TvShowsFragment tvShowsFragment = (TvShowsFragment) oVar;
                                    ContentItem contentItem5 = (ContentItem) obj4;
                                    cr4.g(contentItem5, "enrichedItem");
                                    TextView textView6 = tvShowsFragment.ah;
                                    if (textView6 == null) {
                                        cr4.n("heroGenreText");
                                        throw null;
                                    }
                                    x24.e(textView6, contentItem5.getGenres());
                                    TextView textView7 = tvShowsFragment.aj;
                                    if (textView7 == null) {
                                        cr4.n("heroCast");
                                        throw null;
                                    }
                                    x24.d(textView7, contentItem5.getCast());
                                    TextView textView8 = tvShowsFragment.ak;
                                    if (textView8 == null) {
                                        cr4.n("heroTagline");
                                        throw null;
                                    }
                                    x24.g(textView8, contentItem5.getTagline());
                                    if (z5 && (logoUrl5 = contentItem5.getLogoUrl()) != null && !n89.ab(logoUrl5)) {
                                        u24 u24Var4 = tvShowsFragment.as;
                                        if (u24Var4 == null) {
                                            cr4.n("heroLogoLoader");
                                            throw null;
                                        }
                                        u24Var4.b(contentItem5.getLogoUrl(), false);
                                    }
                                    String showStatus6 = contentItem5.getShowStatus();
                                    if (showStatus6 != null && !n89.ab(showStatus6)) {
                                        TextView textView9 = tvShowsFragment.ag;
                                        if (textView9 == null) {
                                            cr4.n("heroMetadata");
                                            throw null;
                                        }
                                        x24.f(textView9, contentItem5);
                                    }
                                    if (contentItem2.getTmdbId() <= 0 && contentItem5.getTmdbId() > 0 && (d34Var3 = tvShowsFragment.w) != null) {
                                        d34Var3.h(contentItem5);
                                    }
                                    return e6aVar2;
                            }
                        }
                    });
                }
                return e6aVar;
            case 10:
                bi8 bi8Var = (bi8) obj2;
                dy4 dy4Var = (dy4) obj;
                LinkedHashMap linkedHashMap = new LinkedHashMap();
                ky4 ky4Var = dy4Var.a;
                wz4.e(dy4Var, bi8Var);
                int iD = bi8Var.getC();
                for (int i6 = 0; i6 < iD; i6++) {
                    List listF = bi8Var.f(i6);
                    ArrayList arrayList = new ArrayList();
                    for (Object obj4 : listF) {
                        if (obj4 instanceof uz4) {
                            arrayList.add(obj4);
                        }
                    }
                }
                return linkedHashMap.isEmpty() ? jk2.a : linkedHashMap;
            case 11:
                int i7 = s16.c.j;
                ((s16) obj2).f.invoke(Integer.valueOf(((s16.c) obj).h));
                return e6aVar;
            case 12:
                final MoviesFragment moviesFragment = (MoviesFragment) obj2;
                final ContentItem contentItem2 = (ContentItem) obj;
                String logoUrl3 = contentItem2.getLogoUrl();
                u24 u24Var2 = moviesFragment.z;
                if (u24Var2 == null) {
                    cr4.n("heroLogoLoader");
                    throw null;
                }
                u24Var2.b(logoUrl3, true);
                TextView textView2 = moviesFragment.p;
                if (textView2 == null) {
                    cr4.n("heroTitle");
                    throw null;
                }
                textView2.setText(contentItem2.getTitle());
                TextView textView3 = moviesFragment.u;
                if (textView3 == null) {
                    cr4.n("heroTagline");
                    throw null;
                }
                x24.g(textView3, contentItem2.getTagline());
                String strC2 = x24.c(contentItem2);
                TextView textView4 = moviesFragment.s;
                if (textView4 == null) {
                    cr4.n("heroOverview");
                    throw null;
                }
                textView4.setText(strC2 != null ? strC2 : "");
                TextView textView5 = moviesFragment.r;
                if (textView5 == null) {
                    cr4.n("heroGenreText");
                    throw null;
                }
                x24.e(textView5, contentItem2.getGenres());
                TextView textView6 = moviesFragment.q;
                if (textView6 == null) {
                    cr4.n("heroMetadata");
                    throw null;
                }
                x24.f(textView6, contentItem2);
                TextView textView7 = moviesFragment.t;
                if (textView7 == null) {
                    cr4.n("heroCast");
                    throw null;
                }
                x24.d(textView7, contentItem2.getCast());
                String cast2 = contentItem2.getCast();
                boolean z5 = cast2 == null || n89.ab(cast2);
                String genres2 = contentItem2.getGenres();
                boolean z6 = genres2 == null || n89.ab(genres2);
                String logoUrl4 = contentItem2.getLogoUrl();
                final boolean z7 = logoUrl4 == null || n89.ab(logoUrl4);
                boolean z8 = contentItem2.isTvShow() && ((showStatus2 = contentItem2.getShowStatus()) == null || n89.ab(showStatus2));
                String tagline2 = contentItem2.getTagline();
                boolean z9 = tagline2 == null || n89.ab(tagline2);
                if (z5 || z6 || z7 || z8 || z9) {
                    m24 m24Var2 = m24.a;
                    i85 viewLifecycleOwner2 = moviesFragment.getViewLifecycleOwner();
                    cr4.f(viewLifecycleOwner2, "getViewLifecycleOwner(...)");
                    n nVarA2 = s.a(viewLifecycleOwner2);
                    rx4 rx4Var2 = moviesFragment.ab;
                    TMDBApiService tMDBApiService = moviesFragment.ap;
                    if (tMDBApiService == null) {
                        cr4.n("tmdbApiService");
                        throw null;
                    }
                    AddonMetadataClient addonMetadataClient2 = moviesFragment.ax;
                    if (addonMetadataClient2 == null) {
                        cr4.n("addonMetadataClient");
                        throw null;
                    }
                    moviesFragment.ab = m24.c(nVarA2, rx4Var2, contentItem2, tMDBApiService, addonMetadataClient2, new sq3() { // from class: y74
                        @Override // defpackage.sq3
                        public final Object invoke(Object obj42) {
                            d34 d34Var;
                            String logoUrl32;
                            d34 d34Var2;
                            String logoUrl42;
                            d34 d34Var3;
                            String logoUrl5;
                            int i62 = i2;
                            e6a e6aVar2 = e6a.a;
                            ContentItem contentItem22 = contentItem2;
                            boolean z52 = z7;
                            o oVar = moviesFragment;
                            switch (i62) {
                                case 0:
                                    HomeFragment homeFragment2 = (HomeFragment) oVar;
                                    ContentItem contentItem3 = (ContentItem) obj42;
                                    int i72 = HomeFragment.aq;
                                    cr4.g(contentItem3, "enrichedItem");
                                    nl3 nl3Var7 = homeFragment2.f;
                                    if (nl3Var7 != null) {
                                        x24.e(nl3Var7.h, contentItem3.getGenres());
                                        x24.d(nl3Var7.g, contentItem3.getCast());
                                        x24.g(nl3Var7.n, contentItem3.getTagline());
                                        if (z52 && (logoUrl32 = contentItem3.getLogoUrl()) != null && !n89.ab(logoUrl32)) {
                                            u24 u24Var22 = homeFragment2.r;
                                            if (u24Var22 == null) {
                                                cr4.n("heroLogoLoader");
                                                throw null;
                                            }
                                            u24Var22.b(contentItem3.getLogoUrl(), false);
                                        }
                                        String showStatus4 = contentItem3.getShowStatus();
                                        if (showStatus4 != null && !n89.ab(showStatus4)) {
                                            x24.f(nl3Var7.k, contentItem3);
                                        }
                                        if (contentItem22.getTmdbId() <= 0 && contentItem3.getTmdbId() > 0 && (d34Var = homeFragment2.ak) != null) {
                                            d34Var.h(contentItem3);
                                        }
                                    }
                                    return e6aVar2;
                                case 1:
                                    MoviesFragment moviesFragment2 = (MoviesFragment) oVar;
                                    ContentItem contentItem4 = (ContentItem) obj42;
                                    cr4.g(contentItem4, "enrichedItem");
                                    TextView textView22 = moviesFragment2.r;
                                    if (textView22 == null) {
                                        cr4.n("heroGenreText");
                                        throw null;
                                    }
                                    x24.e(textView22, contentItem4.getGenres());
                                    TextView textView32 = moviesFragment2.t;
                                    if (textView32 == null) {
                                        cr4.n("heroCast");
                                        throw null;
                                    }
                                    x24.d(textView32, contentItem4.getCast());
                                    TextView textView42 = moviesFragment2.u;
                                    if (textView42 == null) {
                                        cr4.n("heroTagline");
                                        throw null;
                                    }
                                    x24.g(textView42, contentItem4.getTagline());
                                    if (z52 && (logoUrl42 = contentItem4.getLogoUrl()) != null && !n89.ab(logoUrl42)) {
                                        u24 u24Var3 = moviesFragment2.z;
                                        if (u24Var3 == null) {
                                            cr4.n("heroLogoLoader");
                                            throw null;
                                        }
                                        u24Var3.b(contentItem4.getLogoUrl(), false);
                                    }
                                    String showStatus5 = contentItem4.getShowStatus();
                                    if (showStatus5 != null && !n89.ab(showStatus5)) {
                                        TextView textView52 = moviesFragment2.q;
                                        if (textView52 == null) {
                                            cr4.n("heroMetadata");
                                            throw null;
                                        }
                                        x24.f(textView52, contentItem4);
                                    }
                                    if (contentItem22.getTmdbId() <= 0 && contentItem4.getTmdbId() > 0 && (d34Var2 = moviesFragment2.ba) != null) {
                                        d34Var2.h(contentItem4);
                                    }
                                    return e6aVar2;
                                default:
                                    TvShowsFragment tvShowsFragment = (TvShowsFragment) oVar;
                                    ContentItem contentItem5 = (ContentItem) obj42;
                                    cr4.g(contentItem5, "enrichedItem");
                                    TextView textView62 = tvShowsFragment.ah;
                                    if (textView62 == null) {
                                        cr4.n("heroGenreText");
                                        throw null;
                                    }
                                    x24.e(textView62, contentItem5.getGenres());
                                    TextView textView72 = tvShowsFragment.aj;
                                    if (textView72 == null) {
                                        cr4.n("heroCast");
                                        throw null;
                                    }
                                    x24.d(textView72, contentItem5.getCast());
                                    TextView textView8 = tvShowsFragment.ak;
                                    if (textView8 == null) {
                                        cr4.n("heroTagline");
                                        throw null;
                                    }
                                    x24.g(textView8, contentItem5.getTagline());
                                    if (z52 && (logoUrl5 = contentItem5.getLogoUrl()) != null && !n89.ab(logoUrl5)) {
                                        u24 u24Var4 = tvShowsFragment.as;
                                        if (u24Var4 == null) {
                                            cr4.n("heroLogoLoader");
                                            throw null;
                                        }
                                        u24Var4.b(contentItem5.getLogoUrl(), false);
                                    }
                                    String showStatus6 = contentItem5.getShowStatus();
                                    if (showStatus6 != null && !n89.ab(showStatus6)) {
                                        TextView textView9 = tvShowsFragment.ag;
                                        if (textView9 == null) {
                                            cr4.n("heroMetadata");
                                            throw null;
                                        }
                                        x24.f(textView9, contentItem5);
                                    }
                                    if (contentItem22.getTmdbId() <= 0 && contentItem5.getTmdbId() > 0 && (d34Var3 = tvShowsFragment.w) != null) {
                                        d34Var3.h(contentItem5);
                                    }
                                    return e6aVar2;
                            }
                        }
                    });
                }
                return e6aVar;
            case 13:
                ((NetworkMonitor) obj2).a.unregisterNetworkCallback((xm6) obj);
                return e6aVar;
            case 14:
                return ((pw7) obj2).b((String) obj);
            case 15:
                return ji8.c((String) obj2, ec7.b.a, new bi8[0], new tc8((vc8) obj, 0));
            case 16:
                int i8 = wm8.q.f;
                ((vn8.q) obj2).d.invoke((String) obj);
                return e6aVar;
            case 17:
                final TvShowsFragment tvShowsFragment = (TvShowsFragment) obj2;
                final ContentItem contentItem3 = (ContentItem) obj;
                String logoUrl5 = contentItem3.getLogoUrl();
                u24 u24Var3 = tvShowsFragment.as;
                if (u24Var3 == null) {
                    cr4.n("heroLogoLoader");
                    throw null;
                }
                u24Var3.b(logoUrl5, true);
                TextView textView8 = tvShowsFragment.af;
                if (textView8 == null) {
                    cr4.n("heroTitle");
                    throw null;
                }
                textView8.setText(contentItem3.getTitle());
                TextView textView9 = tvShowsFragment.ak;
                if (textView9 == null) {
                    cr4.n("heroTagline");
                    throw null;
                }
                x24.g(textView9, contentItem3.getTagline());
                String strC3 = x24.c(contentItem3);
                TextView textView10 = tvShowsFragment.ai;
                if (textView10 == null) {
                    cr4.n("heroOverview");
                    throw null;
                }
                textView10.setText(strC3 != null ? strC3 : "");
                TextView textView11 = tvShowsFragment.ah;
                if (textView11 == null) {
                    cr4.n("heroGenreText");
                    throw null;
                }
                x24.e(textView11, contentItem3.getGenres());
                TextView textView12 = tvShowsFragment.ag;
                if (textView12 == null) {
                    cr4.n("heroMetadata");
                    throw null;
                }
                x24.f(textView12, contentItem3);
                TextView textView13 = tvShowsFragment.aj;
                if (textView13 == null) {
                    cr4.n("heroCast");
                    throw null;
                }
                x24.d(textView13, contentItem3.getCast());
                String cast3 = contentItem3.getCast();
                boolean z10 = cast3 == null || n89.ab(cast3);
                String genres3 = contentItem3.getGenres();
                boolean z11 = genres3 == null || n89.ab(genres3);
                String logoUrl6 = contentItem3.getLogoUrl();
                final boolean z12 = logoUrl6 == null || n89.ab(logoUrl6);
                boolean z13 = contentItem3.isTvShow() && ((showStatus3 = contentItem3.getShowStatus()) == null || n89.ab(showStatus3));
                String tagline3 = contentItem3.getTagline();
                if (tagline3 != null && !n89.ab(tagline3)) {
                    i2 = 0;
                }
                if (z10 || z11 || z12 || z13 || i2 != 0) {
                    m24 m24Var3 = m24.a;
                    i85 viewLifecycleOwner3 = tvShowsFragment.getViewLifecycleOwner();
                    cr4.f(viewLifecycleOwner3, "getViewLifecycleOwner(...)");
                    n nVarA3 = s.a(viewLifecycleOwner3);
                    rx4 rx4Var3 = tvShowsFragment.ap;
                    TMDBApiService tMDBApiServiceP = tvShowsFragment.p();
                    AddonMetadataClient addonMetadataClient3 = tvShowsFragment.s;
                    if (addonMetadataClient3 == null) {
                        cr4.n("addonMetadataClient");
                        throw null;
                    }
                    final int i9 = 2;
                    tvShowsFragment.ap = m24.c(nVarA3, rx4Var3, contentItem3, tMDBApiServiceP, addonMetadataClient3, new sq3() { // from class: y74
                        @Override // defpackage.sq3
                        public final Object invoke(Object obj42) {
                            d34 d34Var;
                            String logoUrl32;
                            d34 d34Var2;
                            String logoUrl42;
                            d34 d34Var3;
                            String logoUrl52;
                            int i62 = i9;
                            e6a e6aVar2 = e6a.a;
                            ContentItem contentItem22 = contentItem3;
                            boolean z52 = z12;
                            o oVar = tvShowsFragment;
                            switch (i62) {
                                case 0:
                                    HomeFragment homeFragment2 = (HomeFragment) oVar;
                                    ContentItem contentItem32 = (ContentItem) obj42;
                                    int i72 = HomeFragment.aq;
                                    cr4.g(contentItem32, "enrichedItem");
                                    nl3 nl3Var7 = homeFragment2.f;
                                    if (nl3Var7 != null) {
                                        x24.e(nl3Var7.h, contentItem32.getGenres());
                                        x24.d(nl3Var7.g, contentItem32.getCast());
                                        x24.g(nl3Var7.n, contentItem32.getTagline());
                                        if (z52 && (logoUrl32 = contentItem32.getLogoUrl()) != null && !n89.ab(logoUrl32)) {
                                            u24 u24Var22 = homeFragment2.r;
                                            if (u24Var22 == null) {
                                                cr4.n("heroLogoLoader");
                                                throw null;
                                            }
                                            u24Var22.b(contentItem32.getLogoUrl(), false);
                                        }
                                        String showStatus4 = contentItem32.getShowStatus();
                                        if (showStatus4 != null && !n89.ab(showStatus4)) {
                                            x24.f(nl3Var7.k, contentItem32);
                                        }
                                        if (contentItem22.getTmdbId() <= 0 && contentItem32.getTmdbId() > 0 && (d34Var = homeFragment2.ak) != null) {
                                            d34Var.h(contentItem32);
                                        }
                                    }
                                    return e6aVar2;
                                case 1:
                                    MoviesFragment moviesFragment2 = (MoviesFragment) oVar;
                                    ContentItem contentItem4 = (ContentItem) obj42;
                                    cr4.g(contentItem4, "enrichedItem");
                                    TextView textView22 = moviesFragment2.r;
                                    if (textView22 == null) {
                                        cr4.n("heroGenreText");
                                        throw null;
                                    }
                                    x24.e(textView22, contentItem4.getGenres());
                                    TextView textView32 = moviesFragment2.t;
                                    if (textView32 == null) {
                                        cr4.n("heroCast");
                                        throw null;
                                    }
                                    x24.d(textView32, contentItem4.getCast());
                                    TextView textView42 = moviesFragment2.u;
                                    if (textView42 == null) {
                                        cr4.n("heroTagline");
                                        throw null;
                                    }
                                    x24.g(textView42, contentItem4.getTagline());
                                    if (z52 && (logoUrl42 = contentItem4.getLogoUrl()) != null && !n89.ab(logoUrl42)) {
                                        u24 u24Var32 = moviesFragment2.z;
                                        if (u24Var32 == null) {
                                            cr4.n("heroLogoLoader");
                                            throw null;
                                        }
                                        u24Var32.b(contentItem4.getLogoUrl(), false);
                                    }
                                    String showStatus5 = contentItem4.getShowStatus();
                                    if (showStatus5 != null && !n89.ab(showStatus5)) {
                                        TextView textView52 = moviesFragment2.q;
                                        if (textView52 == null) {
                                            cr4.n("heroMetadata");
                                            throw null;
                                        }
                                        x24.f(textView52, contentItem4);
                                    }
                                    if (contentItem22.getTmdbId() <= 0 && contentItem4.getTmdbId() > 0 && (d34Var2 = moviesFragment2.ba) != null) {
                                        d34Var2.h(contentItem4);
                                    }
                                    return e6aVar2;
                                default:
                                    TvShowsFragment tvShowsFragment2 = (TvShowsFragment) oVar;
                                    ContentItem contentItem5 = (ContentItem) obj42;
                                    cr4.g(contentItem5, "enrichedItem");
                                    TextView textView62 = tvShowsFragment2.ah;
                                    if (textView62 == null) {
                                        cr4.n("heroGenreText");
                                        throw null;
                                    }
                                    x24.e(textView62, contentItem5.getGenres());
                                    TextView textView72 = tvShowsFragment2.aj;
                                    if (textView72 == null) {
                                        cr4.n("heroCast");
                                        throw null;
                                    }
                                    x24.d(textView72, contentItem5.getCast());
                                    TextView textView82 = tvShowsFragment2.ak;
                                    if (textView82 == null) {
                                        cr4.n("heroTagline");
                                        throw null;
                                    }
                                    x24.g(textView82, contentItem5.getTagline());
                                    if (z52 && (logoUrl52 = contentItem5.getLogoUrl()) != null && !n89.ab(logoUrl52)) {
                                        u24 u24Var4 = tvShowsFragment2.as;
                                        if (u24Var4 == null) {
                                            cr4.n("heroLogoLoader");
                                            throw null;
                                        }
                                        u24Var4.b(contentItem5.getLogoUrl(), false);
                                    }
                                    String showStatus6 = contentItem5.getShowStatus();
                                    if (showStatus6 != null && !n89.ab(showStatus6)) {
                                        TextView textView92 = tvShowsFragment2.ag;
                                        if (textView92 == null) {
                                            cr4.n("heroMetadata");
                                            throw null;
                                        }
                                        x24.f(textView92, contentItem5);
                                    }
                                    if (contentItem22.getTmdbId() <= 0 && contentItem5.getTmdbId() > 0 && (d34Var3 = tvShowsFragment2.w) != null) {
                                        d34Var3.h(contentItem5);
                                    }
                                    return e6aVar2;
                            }
                        }
                    });
                }
                return e6aVar;
            default:
                faa faaVar = (faa) obj;
                String str = faaVar.g;
                if (((ArrayList) obj2).isEmpty() || (iY = n89.y(str, '/', faaVar.j.a.length() + 3, 4)) == -1) {
                    return "";
                }
                int iE = a99.e(str, new char[]{'?', '#'}, iY, false);
                if (iE == -1) {
                    String strSubstring = str.substring(iY);
                    cr4.f(strSubstring, "substring(...)");
                    return strSubstring;
                }
                String strSubstring2 = str.substring(iY, iE);
                cr4.f(strSubstring2, "substring(...)");
                return strSubstring2;
        }
    }
}
