package com.strmr.ps.ui.mobile.tvshows;

import android.content.Context;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import androidx.fragment.app.o;
import androidx.lifecycle.as;
import androidx.lifecycle.at;
import androidx.lifecycle.n;
import androidx.lifecycle.s;
import androidx.media3.container.NalUnitUtil;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
import androidx.view.fragment.d;
import com.google.android.material.bottomsheet.BottomSheetDialog;
import com.strmr.ps.R;
import com.strmr.ps.data.model.ContentItem;
import com.strmr.ps.data.remote.RateLimiter;
import com.strmr.ps.data.remote.api.TMDBApiService;
import com.strmr.ps.data.repository.ContentImageOverrideRepository;
import com.strmr.ps.data.repository.TraktStatusProvider;
import com.strmr.ps.ui.contextmenu.ContextMenuActionHandler;
import com.strmr.ps.ui.contextmenu.h;
import com.strmr.ps.ui.mobile.tvshows.MobileTvShowsFragment;
import com.strmr.ps.ui.mobile.tvshows.b;
import com.strmr.ps.ui.tvshows.TvShowsViewModel;
import com.strmr.ps.ui.util.DimensionScaler;
import dagger.hilt.android.AndroidEntryPoint;
import defpackage.cr4;
import defpackage.d75;
import defpackage.gr3;
import defpackage.h64;
import defpackage.i56;
import defpackage.i85;
import defpackage.ika;
import defpackage.iw7;
import defpackage.j65;
import defpackage.jka;
import defpackage.lr3;
import defpackage.mia;
import defpackage.q36;
import defpackage.qq3;
import defpackage.rm3;
import defpackage.s16;
import defpackage.sq3;
import defpackage.sr3;
import defpackage.u55;
import defpackage.ux3;
import defpackage.v65;
import defpackage.vx8;
import defpackage.wm1;
import defpackage.zs6;
import defpackage.zw8;
import java.util.Iterator;
import java.util.List;
import kotlin.Metadata;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\b\u0007\u0018\u00002\u00020\u0001B\u0007¢\u0006\u0004\b\u0002\u0010\u0003¨\u0006\u0004"}, d2 = {"Lcom/strmr/ps/ui/mobile/tvshows/MobileTvShowsFragment;", "Landroidx/fragment/app/o;", "<init>", "()V", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
@AndroidEntryPoint
@vx8
public final class MobileTvShowsFragment extends h64 {
    public rm3 f;
    public final as i;
    public DimensionScaler j;
    public ContextMenuActionHandler k;
    public TraktStatusProvider l;
    public TMDBApiService m;
    public RateLimiter n;
    public ContentImageOverrideRepository o;
    public s16 p;
    public h q;
    public final RecyclerView.v r;

    @Metadata(k = 3, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
    public static final class a implements zs6, sr3 {
        public final /* synthetic */ sq3 a;

        public a(sq3 sq3Var) {
            this.a = sq3Var;
        }

        @Override // defpackage.zs6
        public final /* synthetic */ void a(Object obj) {
            this.a.invoke(obj);
        }

        @Override // defpackage.sr3
        public final lr3 b() {
            return this.a;
        }

        public final boolean equals(Object obj) {
            if (!(obj instanceof zs6) || !(obj instanceof sr3)) {
                return false;
            }
            return this.a.equals(((sr3) obj).b());
        }

        public final int hashCode() {
            return this.a.hashCode();
        }
    }

    @Metadata(d1 = {"\u0000\u000e\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\u0010\u0006\u001a\u00020\u0002\"\n\b\u0000\u0010\u0001\u0018\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0003\u0010\u0004¨\u0006\u0005"}, d2 = {"Lxja;", "VM", "Landroidx/fragment/app/o;", "invoke", "()Landroidx/fragment/app/o;", "cp3", "<anonymous>"}, k = 3, mv = {2, 0, 0})
    public static final class b extends u55 implements qq3<o> {
        public b() {
            super(0);
        }

        @Override // defpackage.qq3
        public final Object invoke() {
            return MobileTvShowsFragment.this;
        }
    }

    @Metadata(d1 = {"\u0000\u000e\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\u0010\u0006\u001a\u00020\u0002\"\n\b\u0000\u0010\u0001\u0018\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0003\u0010\u0004¨\u0006\u0005"}, d2 = {"Lxja;", "VM", "Ljka;", "invoke", "()Ljka;", "hp3", "<anonymous>"}, k = 3, mv = {2, 0, 0})
    public static final class c extends u55 implements qq3<jka> {
        public final /* synthetic */ b a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public c(b bVar) {
            super(0);
            this.a = bVar;
        }

        @Override // defpackage.qq3
        public final Object invoke() {
            return (jka) this.a.invoke();
        }
    }

    @Metadata(d1 = {"\u0000\u000e\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\u0010\u0006\u001a\u00020\u0002\"\n\b\u0000\u0010\u0001\u0018\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0003\u0010\u0004¨\u0006\u0005"}, d2 = {"Lxja;", "VM", "Lika;", "invoke", "()Lika;", "dp3", "<anonymous>"}, k = 3, mv = {2, 0, 0})
    public static final class d extends u55 implements qq3<ika> {
        public final /* synthetic */ Object a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public d(j65 j65Var) {
            super(0);
            this.a = j65Var;
        }

        /* JADX WARN: Type inference failed for: r0v0, types: [j65, java.lang.Object] */
        @Override // defpackage.qq3
        public final Object invoke() {
            return ((jka) this.a.getValue()).getViewModelStore();
        }
    }

    @Metadata(d1 = {"\u0000\u000e\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\u0010\u0006\u001a\u00020\u0002\"\n\b\u0000\u0010\u0001\u0018\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0003\u0010\u0004¨\u0006\u0005"}, d2 = {"Lxja;", "VM", "Lwm1;", "invoke", "()Lwm1;", "ep3", "<anonymous>"}, k = 3, mv = {2, 0, 0})
    public static final class e extends u55 implements qq3<wm1> {
        public final /* synthetic */ Object a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public e(j65 j65Var) {
            super(0);
            this.a = j65Var;
        }

        /* JADX WARN: Type inference failed for: r0v0, types: [j65, java.lang.Object] */
        @Override // defpackage.qq3
        public final Object invoke() {
            jka jkaVar = (jka) this.a.getValue();
            androidx.lifecycle.h hVar = jkaVar instanceof androidx.lifecycle.h ? (androidx.lifecycle.h) jkaVar : null;
            return hVar != null ? hVar.getDefaultViewModelCreationExtras() : wm1.a.b;
        }
    }

    @Metadata(d1 = {"\u0000\u000e\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0004\u0010\u0006\u001a\u00020\u0002\"\n\b\u0000\u0010\u0001\u0018\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0003\u0010\u0004¨\u0006\u0005"}, d2 = {"Lxja;", "VM", "Landroidx/lifecycle/at$c;", "invoke", "()Landroidx/lifecycle/at$c;", "fp3", "<anonymous>"}, k = 3, mv = {2, 0, 0})
    public static final class f extends u55 implements qq3<at.c> {
        public final /* synthetic */ Object b;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public f(j65 j65Var) {
            super(0);
            this.b = j65Var;
        }

        /* JADX WARN: Type inference failed for: r0v0, types: [j65, java.lang.Object] */
        @Override // defpackage.qq3
        public final Object invoke() {
            at.c defaultViewModelProviderFactory;
            jka jkaVar = (jka) this.b.getValue();
            androidx.lifecycle.h hVar = jkaVar instanceof androidx.lifecycle.h ? (androidx.lifecycle.h) jkaVar : null;
            return (hVar == null || (defaultViewModelProviderFactory = hVar.getDefaultViewModelProviderFactory()) == null) ? MobileTvShowsFragment.this.getDefaultViewModelProviderFactory() : defaultViewModelProviderFactory;
        }
    }

    public MobileTvShowsFragment() {
        j65 j65VarB = v65.b(d75.b, new c(new b()));
        this.i = new as(iw7.a.getOrCreateKotlinClass(TvShowsViewModel.class), new d(j65VarB), new f(j65VarB), new e(j65VarB));
        this.r = new RecyclerView.v();
    }

    public static void m(MobileTvShowsFragment mobileTvShowsFragment, String str, String str2, String str3, String str4, String str5, String str6, String str7, String str8, int i) {
        String str9 = (i & 4) != 0 ? "" : str3;
        androidx.view.fragment.d.a(mobileTvShowsFragment).l(b.c.a(str, str2, (i & 64) != 0 ? "" : str7, null, null, (i & 8) != 0 ? "" : str4, (i & 16) != 0 ? "" : str5, (i & 32) != 0 ? "" : str6, str9, (i & 128) != 0 ? "" : str8, null, null, null, null, 15384));
    }

    public final TvShowsViewModel l() {
        return (TvShowsViewModel) this.i.getValue();
    }

    @Override // androidx.fragment.app.o
    public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        cr4.g(layoutInflater, "inflater");
        View viewInflate = layoutInflater.inflate(R.layout.fragment_mobile_tv_shows, viewGroup, false);
        RecyclerView recyclerView = (RecyclerView) mia.a(R.id.rows_recycler_view, viewInflate);
        if (recyclerView == null) {
            throw new NullPointerException("Missing required view with ID: ".concat(viewInflate.getResources().getResourceName(R.id.rows_recycler_view)));
        }
        SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) viewInflate;
        this.f = new rm3(swipeRefreshLayout, recyclerView, swipeRefreshLayout);
        cr4.f(swipeRefreshLayout, "getRoot(...)");
        return swipeRefreshLayout;
    }

    @Override // androidx.fragment.app.o
    public final void onDestroyView() {
        super.onDestroyView();
        this.f = null;
    }

    @Override // androidx.fragment.app.o
    public final void onResume() {
        super.onResume();
        l().e();
    }

    @Override // androidx.fragment.app.o
    public final void onViewCreated(View view, Bundle bundle) {
        cr4.g(view, "view");
        super.onViewCreated(view, bundle);
        Context contextRequireContext = requireContext();
        cr4.f(contextRequireContext, "requireContext(...)");
        i85 viewLifecycleOwner = getViewLifecycleOwner();
        cr4.f(viewLifecycleOwner, "getViewLifecycleOwner(...)");
        n nVarA = s.a(viewLifecycleOwner);
        ContextMenuActionHandler contextMenuActionHandler = this.k;
        if (contextMenuActionHandler == null) {
            cr4.n("contextMenuActionHandler");
            throw null;
        }
        TraktStatusProvider traktStatusProvider = this.l;
        if (traktStatusProvider == null) {
            cr4.n("traktStatusProvider");
            throw null;
        }
        final int i = 1;
        sq3 sq3Var = new sq3(this) { // from class: j76
            public final /* synthetic */ MobileTvShowsFragment b;

            {
                this.b = this;
            }

            /* JADX WARN: Removed duplicated region for block: B:51:0x0141  */
            @Override // defpackage.sq3
            /*
                Code decompiled incorrectly, please refer to instructions dump.
            */
            public final Object invoke(Object obj) {
                boolean z;
                zw8.a aVar;
                Iterator it;
                String strAb;
                int i2 = i;
                MobileTvShowsFragment mobileTvShowsFragment = this.b;
                e6a e6aVar = e6a.a;
                switch (i2) {
                    case 0:
                        ContentItem contentItem = (ContentItem) obj;
                        cr4.g(contentItem, "item");
                        if (contentItem.getItemType() == ContentItem.ItemType.TV_SHOW) {
                            i85 viewLifecycleOwner2 = mobileTvShowsFragment.getViewLifecycleOwner();
                            cr4.f(viewLifecycleOwner2, "getViewLifecycleOwner(...)");
                            wj0.c(s.a(viewLifecycleOwner2), null, null, new m76(contentItem, mobileTvShowsFragment, null), 3);
                        }
                        return e6aVar;
                    case 1:
                        ContentItem contentItem2 = (ContentItem) obj;
                        cr4.g(contentItem2, "item");
                        Context contextRequireContext2 = mobileTvShowsFragment.requireContext();
                        cr4.f(contextRequireContext2, "requireContext(...)");
                        C0690s87.a(contextRequireContext2, contentItem2, d.a(mobileTvShowsFragment));
                        return e6aVar;
                    case 2:
                        mobileTvShowsFragment.l().m(((Integer) obj).intValue());
                        return e6aVar;
                    case 3:
                        af1 af1Var = (af1) obj;
                        cr4.g(af1Var, "row");
                        List list = zw8.a;
                        String str = af1Var.d;
                        List listC = zw8.c(str);
                        if (!listC.isEmpty()) {
                            String str2 = af1Var.h;
                            String str3 = af1Var.i;
                            zw8.a aVarB = zw8.b(str);
                            MobileTvShowsFragment mobileTvShowsFragment2 = this.b;
                            BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(mobileTvShowsFragment2.requireContext());
                            View viewInflate = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(R.layout.bottom_sheet_sort, (ViewGroup) null);
                            ((TextView) viewInflate.findViewById(R.id.sort_sheet_title)).setText(mobileTvShowsFragment2.getString(R.string.sort_dialog_title, af1Var.a));
                            LinearLayout linearLayout = (LinearLayout) viewInflate.findViewById(R.id.sort_options_container);
                            int i3 = R.layout.item_sort_option;
                            if (str2 != null) {
                                View viewInflate2 = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(R.layout.item_sort_option, (ViewGroup) linearLayout, false);
                                TextView textView = (TextView) viewInflate2.findViewById(R.id.sort_option_label);
                                ImageView imageView = (ImageView) viewInflate2.findViewById(R.id.sort_option_check);
                                textView.setText(mobileTvShowsFragment2.getString(R.string.sort_reset_default));
                                imageView.setVisibility(8);
                                viewInflate2.setOnClickListener(new s36(af1Var, mobileTvShowsFragment2, bottomSheetDialog, 2));
                                linearLayout.addView(viewInflate2);
                            }
                            Iterator it2 = listC.iterator();
                            while (it2.hasNext()) {
                                zw8.b bVar = (zw8.b) it2.next();
                                if (cr4.b(str2, bVar.a)) {
                                    z = true;
                                } else {
                                    if (str2 == null) {
                                        if (cr4.b(aVarB != null ? aVarB.a : null, bVar.a)) {
                                        }
                                    }
                                    z = false;
                                }
                                View viewInflate3 = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(i3, (ViewGroup) linearLayout, false);
                                TextView textView2 = (TextView) viewInflate3.findViewById(R.id.sort_option_label);
                                ImageView imageView2 = (ImageView) viewInflate3.findViewById(R.id.sort_option_check);
                                if (!z || str2 == null) {
                                    aVar = aVarB;
                                    it = it2;
                                    strAb = "";
                                } else {
                                    aVar = aVarB;
                                    it = it2;
                                    strAb = vw2.ab("  (", mobileTvShowsFragment2.getString((str3 == null ? bVar.c : str3).equals("asc") ? R.string.sort_ascending : R.string.sort_descending), ")");
                                }
                                textView2.setText(bVar.b + strAb);
                                imageView2.setVisibility(z ? 0 : 8);
                                viewInflate3.setOnClickListener(new t36(af1Var, z, str2, str3, bVar, mobileTvShowsFragment2, bottomSheetDialog, 2));
                                linearLayout.addView(viewInflate3);
                                aVarB = aVar;
                                it2 = it;
                                i3 = R.layout.item_sort_option;
                            }
                            bottomSheetDialog.setContentView(viewInflate);
                            bottomSheetDialog.show();
                        }
                        return e6aVar;
                    case 4:
                        List list2 = (List) obj;
                        s16 s16Var = mobileTvShowsFragment.p;
                        if (s16Var != null) {
                            s16Var.e(list2);
                            return e6aVar;
                        }
                        cr4.n("contentRowAdapter");
                        throw null;
                    case 5:
                        i68 i68Var = (i68) obj;
                        if (i68Var == null) {
                            i68Var = null;
                        }
                        if (i68Var != null) {
                            List list3 = i68Var.b;
                            if (!list3.isEmpty()) {
                                if (mobileTvShowsFragment.p == null) {
                                    cr4.n("contentRowAdapter");
                                    throw null;
                                }
                                rm3 rm3Var = mobileTvShowsFragment.f;
                                cr4.d(rm3Var);
                                s16.g(rm3Var.a, i68Var.a, list3);
                            }
                        }
                        return e6aVar;
                    case 6:
                        if (((Boolean) obj).booleanValue()) {
                            rm3 rm3Var2 = mobileTvShowsFragment.f;
                            cr4.d(rm3Var2);
                            rm3Var2.b.setRefreshing(false);
                        }
                        return e6aVar;
                    default:
                        String str4 = (String) obj;
                        if (str4 != null) {
                            Toast.makeText(mobileTvShowsFragment.requireContext(), str4, 0).show();
                        }
                        return e6aVar;
                }
            }
        };
        final int i2 = 0;
        sq3 sq3Var2 = new sq3(this) { // from class: j76
            public final /* synthetic */ MobileTvShowsFragment b;

            {
                this.b = this;
            }

            /* JADX WARN: Removed duplicated region for block: B:51:0x0141  */
            @Override // defpackage.sq3
            /*
                Code decompiled incorrectly, please refer to instructions dump.
            */
            public final Object invoke(Object obj) {
                boolean z;
                zw8.a aVar;
                Iterator it;
                String strAb;
                int i22 = i2;
                MobileTvShowsFragment mobileTvShowsFragment = this.b;
                e6a e6aVar = e6a.a;
                switch (i22) {
                    case 0:
                        ContentItem contentItem = (ContentItem) obj;
                        cr4.g(contentItem, "item");
                        if (contentItem.getItemType() == ContentItem.ItemType.TV_SHOW) {
                            i85 viewLifecycleOwner2 = mobileTvShowsFragment.getViewLifecycleOwner();
                            cr4.f(viewLifecycleOwner2, "getViewLifecycleOwner(...)");
                            wj0.c(s.a(viewLifecycleOwner2), null, null, new m76(contentItem, mobileTvShowsFragment, null), 3);
                        }
                        return e6aVar;
                    case 1:
                        ContentItem contentItem2 = (ContentItem) obj;
                        cr4.g(contentItem2, "item");
                        Context contextRequireContext2 = mobileTvShowsFragment.requireContext();
                        cr4.f(contextRequireContext2, "requireContext(...)");
                        C0690s87.a(contextRequireContext2, contentItem2, d.a(mobileTvShowsFragment));
                        return e6aVar;
                    case 2:
                        mobileTvShowsFragment.l().m(((Integer) obj).intValue());
                        return e6aVar;
                    case 3:
                        af1 af1Var = (af1) obj;
                        cr4.g(af1Var, "row");
                        List list = zw8.a;
                        String str = af1Var.d;
                        List listC = zw8.c(str);
                        if (!listC.isEmpty()) {
                            String str2 = af1Var.h;
                            String str3 = af1Var.i;
                            zw8.a aVarB = zw8.b(str);
                            MobileTvShowsFragment mobileTvShowsFragment2 = this.b;
                            BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(mobileTvShowsFragment2.requireContext());
                            View viewInflate = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(R.layout.bottom_sheet_sort, (ViewGroup) null);
                            ((TextView) viewInflate.findViewById(R.id.sort_sheet_title)).setText(mobileTvShowsFragment2.getString(R.string.sort_dialog_title, af1Var.a));
                            LinearLayout linearLayout = (LinearLayout) viewInflate.findViewById(R.id.sort_options_container);
                            int i3 = R.layout.item_sort_option;
                            if (str2 != null) {
                                View viewInflate2 = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(R.layout.item_sort_option, (ViewGroup) linearLayout, false);
                                TextView textView = (TextView) viewInflate2.findViewById(R.id.sort_option_label);
                                ImageView imageView = (ImageView) viewInflate2.findViewById(R.id.sort_option_check);
                                textView.setText(mobileTvShowsFragment2.getString(R.string.sort_reset_default));
                                imageView.setVisibility(8);
                                viewInflate2.setOnClickListener(new s36(af1Var, mobileTvShowsFragment2, bottomSheetDialog, 2));
                                linearLayout.addView(viewInflate2);
                            }
                            Iterator it2 = listC.iterator();
                            while (it2.hasNext()) {
                                zw8.b bVar = (zw8.b) it2.next();
                                if (cr4.b(str2, bVar.a)) {
                                    z = true;
                                } else {
                                    if (str2 == null) {
                                        if (cr4.b(aVarB != null ? aVarB.a : null, bVar.a)) {
                                        }
                                    }
                                    z = false;
                                }
                                View viewInflate3 = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(i3, (ViewGroup) linearLayout, false);
                                TextView textView2 = (TextView) viewInflate3.findViewById(R.id.sort_option_label);
                                ImageView imageView2 = (ImageView) viewInflate3.findViewById(R.id.sort_option_check);
                                if (!z || str2 == null) {
                                    aVar = aVarB;
                                    it = it2;
                                    strAb = "";
                                } else {
                                    aVar = aVarB;
                                    it = it2;
                                    strAb = vw2.ab("  (", mobileTvShowsFragment2.getString((str3 == null ? bVar.c : str3).equals("asc") ? R.string.sort_ascending : R.string.sort_descending), ")");
                                }
                                textView2.setText(bVar.b + strAb);
                                imageView2.setVisibility(z ? 0 : 8);
                                viewInflate3.setOnClickListener(new t36(af1Var, z, str2, str3, bVar, mobileTvShowsFragment2, bottomSheetDialog, 2));
                                linearLayout.addView(viewInflate3);
                                aVarB = aVar;
                                it2 = it;
                                i3 = R.layout.item_sort_option;
                            }
                            bottomSheetDialog.setContentView(viewInflate);
                            bottomSheetDialog.show();
                        }
                        return e6aVar;
                    case 4:
                        List list2 = (List) obj;
                        s16 s16Var = mobileTvShowsFragment.p;
                        if (s16Var != null) {
                            s16Var.e(list2);
                            return e6aVar;
                        }
                        cr4.n("contentRowAdapter");
                        throw null;
                    case 5:
                        i68 i68Var = (i68) obj;
                        if (i68Var == null) {
                            i68Var = null;
                        }
                        if (i68Var != null) {
                            List list3 = i68Var.b;
                            if (!list3.isEmpty()) {
                                if (mobileTvShowsFragment.p == null) {
                                    cr4.n("contentRowAdapter");
                                    throw null;
                                }
                                rm3 rm3Var = mobileTvShowsFragment.f;
                                cr4.d(rm3Var);
                                s16.g(rm3Var.a, i68Var.a, list3);
                            }
                        }
                        return e6aVar;
                    case 6:
                        if (((Boolean) obj).booleanValue()) {
                            rm3 rm3Var2 = mobileTvShowsFragment.f;
                            cr4.d(rm3Var2);
                            rm3Var2.b.setRefreshing(false);
                        }
                        return e6aVar;
                    default:
                        String str4 = (String) obj;
                        if (str4 != null) {
                            Toast.makeText(mobileTvShowsFragment.requireContext(), str4, 0).show();
                        }
                        return e6aVar;
                }
            }
        };
        ContentImageOverrideRepository contentImageOverrideRepository = this.o;
        if (contentImageOverrideRepository == null) {
            cr4.n("imageOverrideRepository");
            throw null;
        }
        TMDBApiService tMDBApiService = this.m;
        if (tMDBApiService == null) {
            cr4.n("tmdbApiService");
            throw null;
        }
        this.q = new h(contextRequireContext, nVarA, contextMenuActionHandler, traktStatusProvider, null, null, sq3Var, sq3Var2, null, contentImageOverrideRepository, tMDBApiService, new ux3(this, 5), 288);
        final int i3 = 0;
        com.strmr.ps.ui.mobile.tvshows.a aVar = new com.strmr.ps.ui.mobile.tvshows.a(this, i3);
        gr3 gr3Var = new gr3(this) { // from class: k76
            public final /* synthetic */ MobileTvShowsFragment b;

            {
                this.b = this;
            }

            @Override // defpackage.gr3
            public final Object invoke(Object obj, Object obj2) {
                switch (i3) {
                    case 0:
                        ContentItem contentItem = (ContentItem) obj;
                        af1 af1Var = (af1) obj2;
                        cr4.g(contentItem, "item");
                        h hVar = this.b.q;
                        if (hVar == null) {
                            cr4.n("contextMenuHelper");
                            throw null;
                        }
                        hVar.b(contentItem, af1Var);
                        break;
                        break;
                    default:
                        af1 af1Var2 = (af1) obj;
                        ((Integer) obj2).getClass();
                        cr4.g(af1Var2, "row");
                        i56.b bVarC = i56.c(af1Var2, "shows");
                        d.a(this.b).l(b.c.a(bVarC.a, "row_content", null, bVarC.c, bVarC.b, null, null, null, null, null, bVarC.d, bVarC.e, bVarC.f, bVarC.g, 996));
                        break;
                }
                return e6a.a;
            }
        };
        final int i4 = 1;
        gr3 gr3Var2 = new gr3(this) { // from class: k76
            public final /* synthetic */ MobileTvShowsFragment b;

            {
                this.b = this;
            }

            @Override // defpackage.gr3
            public final Object invoke(Object obj, Object obj2) {
                switch (i4) {
                    case 0:
                        ContentItem contentItem = (ContentItem) obj;
                        af1 af1Var = (af1) obj2;
                        cr4.g(contentItem, "item");
                        h hVar = this.b.q;
                        if (hVar == null) {
                            cr4.n("contextMenuHelper");
                            throw null;
                        }
                        hVar.b(contentItem, af1Var);
                        break;
                        break;
                    default:
                        af1 af1Var2 = (af1) obj;
                        ((Integer) obj2).getClass();
                        cr4.g(af1Var2, "row");
                        i56.b bVarC = i56.c(af1Var2, "shows");
                        d.a(this.b).l(b.c.a(bVarC.a, "row_content", null, bVarC.c, bVarC.b, null, null, null, null, null, bVarC.d, bVarC.e, bVarC.f, bVarC.g, 996));
                        break;
                }
                return e6a.a;
            }
        };
        final int i5 = 2;
        sq3 sq3Var3 = new sq3(this) { // from class: j76
            public final /* synthetic */ MobileTvShowsFragment b;

            {
                this.b = this;
            }

            /* JADX WARN: Removed duplicated region for block: B:51:0x0141  */
            @Override // defpackage.sq3
            /*
                Code decompiled incorrectly, please refer to instructions dump.
            */
            public final Object invoke(Object obj) {
                boolean z;
                zw8.a aVar2;
                Iterator it;
                String strAb;
                int i22 = i5;
                MobileTvShowsFragment mobileTvShowsFragment = this.b;
                e6a e6aVar = e6a.a;
                switch (i22) {
                    case 0:
                        ContentItem contentItem = (ContentItem) obj;
                        cr4.g(contentItem, "item");
                        if (contentItem.getItemType() == ContentItem.ItemType.TV_SHOW) {
                            i85 viewLifecycleOwner2 = mobileTvShowsFragment.getViewLifecycleOwner();
                            cr4.f(viewLifecycleOwner2, "getViewLifecycleOwner(...)");
                            wj0.c(s.a(viewLifecycleOwner2), null, null, new m76(contentItem, mobileTvShowsFragment, null), 3);
                        }
                        return e6aVar;
                    case 1:
                        ContentItem contentItem2 = (ContentItem) obj;
                        cr4.g(contentItem2, "item");
                        Context contextRequireContext2 = mobileTvShowsFragment.requireContext();
                        cr4.f(contextRequireContext2, "requireContext(...)");
                        C0690s87.a(contextRequireContext2, contentItem2, d.a(mobileTvShowsFragment));
                        return e6aVar;
                    case 2:
                        mobileTvShowsFragment.l().m(((Integer) obj).intValue());
                        return e6aVar;
                    case 3:
                        af1 af1Var = (af1) obj;
                        cr4.g(af1Var, "row");
                        List list = zw8.a;
                        String str = af1Var.d;
                        List listC = zw8.c(str);
                        if (!listC.isEmpty()) {
                            String str2 = af1Var.h;
                            String str3 = af1Var.i;
                            zw8.a aVarB = zw8.b(str);
                            MobileTvShowsFragment mobileTvShowsFragment2 = this.b;
                            BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(mobileTvShowsFragment2.requireContext());
                            View viewInflate = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(R.layout.bottom_sheet_sort, (ViewGroup) null);
                            ((TextView) viewInflate.findViewById(R.id.sort_sheet_title)).setText(mobileTvShowsFragment2.getString(R.string.sort_dialog_title, af1Var.a));
                            LinearLayout linearLayout = (LinearLayout) viewInflate.findViewById(R.id.sort_options_container);
                            int i32 = R.layout.item_sort_option;
                            if (str2 != null) {
                                View viewInflate2 = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(R.layout.item_sort_option, (ViewGroup) linearLayout, false);
                                TextView textView = (TextView) viewInflate2.findViewById(R.id.sort_option_label);
                                ImageView imageView = (ImageView) viewInflate2.findViewById(R.id.sort_option_check);
                                textView.setText(mobileTvShowsFragment2.getString(R.string.sort_reset_default));
                                imageView.setVisibility(8);
                                viewInflate2.setOnClickListener(new s36(af1Var, mobileTvShowsFragment2, bottomSheetDialog, 2));
                                linearLayout.addView(viewInflate2);
                            }
                            Iterator it2 = listC.iterator();
                            while (it2.hasNext()) {
                                zw8.b bVar = (zw8.b) it2.next();
                                if (cr4.b(str2, bVar.a)) {
                                    z = true;
                                } else {
                                    if (str2 == null) {
                                        if (cr4.b(aVarB != null ? aVarB.a : null, bVar.a)) {
                                        }
                                    }
                                    z = false;
                                }
                                View viewInflate3 = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(i32, (ViewGroup) linearLayout, false);
                                TextView textView2 = (TextView) viewInflate3.findViewById(R.id.sort_option_label);
                                ImageView imageView2 = (ImageView) viewInflate3.findViewById(R.id.sort_option_check);
                                if (!z || str2 == null) {
                                    aVar2 = aVarB;
                                    it = it2;
                                    strAb = "";
                                } else {
                                    aVar2 = aVarB;
                                    it = it2;
                                    strAb = vw2.ab("  (", mobileTvShowsFragment2.getString((str3 == null ? bVar.c : str3).equals("asc") ? R.string.sort_ascending : R.string.sort_descending), ")");
                                }
                                textView2.setText(bVar.b + strAb);
                                imageView2.setVisibility(z ? 0 : 8);
                                viewInflate3.setOnClickListener(new t36(af1Var, z, str2, str3, bVar, mobileTvShowsFragment2, bottomSheetDialog, 2));
                                linearLayout.addView(viewInflate3);
                                aVarB = aVar2;
                                it2 = it;
                                i32 = R.layout.item_sort_option;
                            }
                            bottomSheetDialog.setContentView(viewInflate);
                            bottomSheetDialog.show();
                        }
                        return e6aVar;
                    case 4:
                        List list2 = (List) obj;
                        s16 s16Var = mobileTvShowsFragment.p;
                        if (s16Var != null) {
                            s16Var.e(list2);
                            return e6aVar;
                        }
                        cr4.n("contentRowAdapter");
                        throw null;
                    case 5:
                        i68 i68Var = (i68) obj;
                        if (i68Var == null) {
                            i68Var = null;
                        }
                        if (i68Var != null) {
                            List list3 = i68Var.b;
                            if (!list3.isEmpty()) {
                                if (mobileTvShowsFragment.p == null) {
                                    cr4.n("contentRowAdapter");
                                    throw null;
                                }
                                rm3 rm3Var = mobileTvShowsFragment.f;
                                cr4.d(rm3Var);
                                s16.g(rm3Var.a, i68Var.a, list3);
                            }
                        }
                        return e6aVar;
                    case 6:
                        if (((Boolean) obj).booleanValue()) {
                            rm3 rm3Var2 = mobileTvShowsFragment.f;
                            cr4.d(rm3Var2);
                            rm3Var2.b.setRefreshing(false);
                        }
                        return e6aVar;
                    default:
                        String str4 = (String) obj;
                        if (str4 != null) {
                            Toast.makeText(mobileTvShowsFragment.requireContext(), str4, 0).show();
                        }
                        return e6aVar;
                }
            }
        };
        DimensionScaler dimensionScaler = this.j;
        if (dimensionScaler == null) {
            cr4.n("dimensionScaler");
            throw null;
        }
        final int i6 = 3;
        this.p = new s16(aVar, gr3Var, gr3Var2, sq3Var3, this.r, dimensionScaler, new sq3(this) { // from class: j76
            public final /* synthetic */ MobileTvShowsFragment b;

            {
                this.b = this;
            }

            /* JADX WARN: Removed duplicated region for block: B:51:0x0141  */
            @Override // defpackage.sq3
            /*
                Code decompiled incorrectly, please refer to instructions dump.
            */
            public final Object invoke(Object obj) {
                boolean z;
                zw8.a aVar2;
                Iterator it;
                String strAb;
                int i22 = i6;
                MobileTvShowsFragment mobileTvShowsFragment = this.b;
                e6a e6aVar = e6a.a;
                switch (i22) {
                    case 0:
                        ContentItem contentItem = (ContentItem) obj;
                        cr4.g(contentItem, "item");
                        if (contentItem.getItemType() == ContentItem.ItemType.TV_SHOW) {
                            i85 viewLifecycleOwner2 = mobileTvShowsFragment.getViewLifecycleOwner();
                            cr4.f(viewLifecycleOwner2, "getViewLifecycleOwner(...)");
                            wj0.c(s.a(viewLifecycleOwner2), null, null, new m76(contentItem, mobileTvShowsFragment, null), 3);
                        }
                        return e6aVar;
                    case 1:
                        ContentItem contentItem2 = (ContentItem) obj;
                        cr4.g(contentItem2, "item");
                        Context contextRequireContext2 = mobileTvShowsFragment.requireContext();
                        cr4.f(contextRequireContext2, "requireContext(...)");
                        C0690s87.a(contextRequireContext2, contentItem2, d.a(mobileTvShowsFragment));
                        return e6aVar;
                    case 2:
                        mobileTvShowsFragment.l().m(((Integer) obj).intValue());
                        return e6aVar;
                    case 3:
                        af1 af1Var = (af1) obj;
                        cr4.g(af1Var, "row");
                        List list = zw8.a;
                        String str = af1Var.d;
                        List listC = zw8.c(str);
                        if (!listC.isEmpty()) {
                            String str2 = af1Var.h;
                            String str3 = af1Var.i;
                            zw8.a aVarB = zw8.b(str);
                            MobileTvShowsFragment mobileTvShowsFragment2 = this.b;
                            BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(mobileTvShowsFragment2.requireContext());
                            View viewInflate = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(R.layout.bottom_sheet_sort, (ViewGroup) null);
                            ((TextView) viewInflate.findViewById(R.id.sort_sheet_title)).setText(mobileTvShowsFragment2.getString(R.string.sort_dialog_title, af1Var.a));
                            LinearLayout linearLayout = (LinearLayout) viewInflate.findViewById(R.id.sort_options_container);
                            int i32 = R.layout.item_sort_option;
                            if (str2 != null) {
                                View viewInflate2 = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(R.layout.item_sort_option, (ViewGroup) linearLayout, false);
                                TextView textView = (TextView) viewInflate2.findViewById(R.id.sort_option_label);
                                ImageView imageView = (ImageView) viewInflate2.findViewById(R.id.sort_option_check);
                                textView.setText(mobileTvShowsFragment2.getString(R.string.sort_reset_default));
                                imageView.setVisibility(8);
                                viewInflate2.setOnClickListener(new s36(af1Var, mobileTvShowsFragment2, bottomSheetDialog, 2));
                                linearLayout.addView(viewInflate2);
                            }
                            Iterator it2 = listC.iterator();
                            while (it2.hasNext()) {
                                zw8.b bVar = (zw8.b) it2.next();
                                if (cr4.b(str2, bVar.a)) {
                                    z = true;
                                } else {
                                    if (str2 == null) {
                                        if (cr4.b(aVarB != null ? aVarB.a : null, bVar.a)) {
                                        }
                                    }
                                    z = false;
                                }
                                View viewInflate3 = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(i32, (ViewGroup) linearLayout, false);
                                TextView textView2 = (TextView) viewInflate3.findViewById(R.id.sort_option_label);
                                ImageView imageView2 = (ImageView) viewInflate3.findViewById(R.id.sort_option_check);
                                if (!z || str2 == null) {
                                    aVar2 = aVarB;
                                    it = it2;
                                    strAb = "";
                                } else {
                                    aVar2 = aVarB;
                                    it = it2;
                                    strAb = vw2.ab("  (", mobileTvShowsFragment2.getString((str3 == null ? bVar.c : str3).equals("asc") ? R.string.sort_ascending : R.string.sort_descending), ")");
                                }
                                textView2.setText(bVar.b + strAb);
                                imageView2.setVisibility(z ? 0 : 8);
                                viewInflate3.setOnClickListener(new t36(af1Var, z, str2, str3, bVar, mobileTvShowsFragment2, bottomSheetDialog, 2));
                                linearLayout.addView(viewInflate3);
                                aVarB = aVar2;
                                it2 = it;
                                i32 = R.layout.item_sort_option;
                            }
                            bottomSheetDialog.setContentView(viewInflate);
                            bottomSheetDialog.show();
                        }
                        return e6aVar;
                    case 4:
                        List list2 = (List) obj;
                        s16 s16Var = mobileTvShowsFragment.p;
                        if (s16Var != null) {
                            s16Var.e(list2);
                            return e6aVar;
                        }
                        cr4.n("contentRowAdapter");
                        throw null;
                    case 5:
                        i68 i68Var = (i68) obj;
                        if (i68Var == null) {
                            i68Var = null;
                        }
                        if (i68Var != null) {
                            List list3 = i68Var.b;
                            if (!list3.isEmpty()) {
                                if (mobileTvShowsFragment.p == null) {
                                    cr4.n("contentRowAdapter");
                                    throw null;
                                }
                                rm3 rm3Var = mobileTvShowsFragment.f;
                                cr4.d(rm3Var);
                                s16.g(rm3Var.a, i68Var.a, list3);
                            }
                        }
                        return e6aVar;
                    case 6:
                        if (((Boolean) obj).booleanValue()) {
                            rm3 rm3Var2 = mobileTvShowsFragment.f;
                            cr4.d(rm3Var2);
                            rm3Var2.b.setRefreshing(false);
                        }
                        return e6aVar;
                    default:
                        String str4 = (String) obj;
                        if (str4 != null) {
                            Toast.makeText(mobileTvShowsFragment.requireContext(), str4, 0).show();
                        }
                        return e6aVar;
                }
            }
        });
        rm3 rm3Var = this.f;
        cr4.d(rm3Var);
        RecyclerView recyclerView = rm3Var.a;
        requireContext();
        recyclerView.setLayoutManager(new LinearLayoutManager());
        s16 s16Var = this.p;
        if (s16Var == null) {
            cr4.n("contentRowAdapter");
            throw null;
        }
        recyclerView.setAdapter(s16Var);
        recyclerView.setHasFixedSize(false);
        recyclerView.setItemViewCacheSize(10);
        rm3 rm3Var2 = this.f;
        cr4.d(rm3Var2);
        SwipeRefreshLayout swipeRefreshLayout = rm3Var2.b;
        TypedValue typedValue = new TypedValue();
        requireContext().getTheme().resolveAttribute(R.attr.colorAccentPrimary, typedValue, true);
        swipeRefreshLayout.setColorSchemeColors(typedValue.data);
        swipeRefreshLayout.setProgressBackgroundColorSchemeResource(R.color.mobile_surface);
        swipeRefreshLayout.setOnRefreshListener(new q36(this, 3));
        final int i7 = 4;
        l().m.f(getViewLifecycleOwner(), new a(new sq3(this) { // from class: j76
            public final /* synthetic */ MobileTvShowsFragment b;

            {
                this.b = this;
            }

            /* JADX WARN: Removed duplicated region for block: B:51:0x0141  */
            @Override // defpackage.sq3
            /*
                Code decompiled incorrectly, please refer to instructions dump.
            */
            public final Object invoke(Object obj) {
                boolean z;
                zw8.a aVar2;
                Iterator it;
                String strAb;
                int i22 = i7;
                MobileTvShowsFragment mobileTvShowsFragment = this.b;
                e6a e6aVar = e6a.a;
                switch (i22) {
                    case 0:
                        ContentItem contentItem = (ContentItem) obj;
                        cr4.g(contentItem, "item");
                        if (contentItem.getItemType() == ContentItem.ItemType.TV_SHOW) {
                            i85 viewLifecycleOwner2 = mobileTvShowsFragment.getViewLifecycleOwner();
                            cr4.f(viewLifecycleOwner2, "getViewLifecycleOwner(...)");
                            wj0.c(s.a(viewLifecycleOwner2), null, null, new m76(contentItem, mobileTvShowsFragment, null), 3);
                        }
                        return e6aVar;
                    case 1:
                        ContentItem contentItem2 = (ContentItem) obj;
                        cr4.g(contentItem2, "item");
                        Context contextRequireContext2 = mobileTvShowsFragment.requireContext();
                        cr4.f(contextRequireContext2, "requireContext(...)");
                        C0690s87.a(contextRequireContext2, contentItem2, d.a(mobileTvShowsFragment));
                        return e6aVar;
                    case 2:
                        mobileTvShowsFragment.l().m(((Integer) obj).intValue());
                        return e6aVar;
                    case 3:
                        af1 af1Var = (af1) obj;
                        cr4.g(af1Var, "row");
                        List list = zw8.a;
                        String str = af1Var.d;
                        List listC = zw8.c(str);
                        if (!listC.isEmpty()) {
                            String str2 = af1Var.h;
                            String str3 = af1Var.i;
                            zw8.a aVarB = zw8.b(str);
                            MobileTvShowsFragment mobileTvShowsFragment2 = this.b;
                            BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(mobileTvShowsFragment2.requireContext());
                            View viewInflate = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(R.layout.bottom_sheet_sort, (ViewGroup) null);
                            ((TextView) viewInflate.findViewById(R.id.sort_sheet_title)).setText(mobileTvShowsFragment2.getString(R.string.sort_dialog_title, af1Var.a));
                            LinearLayout linearLayout = (LinearLayout) viewInflate.findViewById(R.id.sort_options_container);
                            int i32 = R.layout.item_sort_option;
                            if (str2 != null) {
                                View viewInflate2 = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(R.layout.item_sort_option, (ViewGroup) linearLayout, false);
                                TextView textView = (TextView) viewInflate2.findViewById(R.id.sort_option_label);
                                ImageView imageView = (ImageView) viewInflate2.findViewById(R.id.sort_option_check);
                                textView.setText(mobileTvShowsFragment2.getString(R.string.sort_reset_default));
                                imageView.setVisibility(8);
                                viewInflate2.setOnClickListener(new s36(af1Var, mobileTvShowsFragment2, bottomSheetDialog, 2));
                                linearLayout.addView(viewInflate2);
                            }
                            Iterator it2 = listC.iterator();
                            while (it2.hasNext()) {
                                zw8.b bVar = (zw8.b) it2.next();
                                if (cr4.b(str2, bVar.a)) {
                                    z = true;
                                } else {
                                    if (str2 == null) {
                                        if (cr4.b(aVarB != null ? aVarB.a : null, bVar.a)) {
                                        }
                                    }
                                    z = false;
                                }
                                View viewInflate3 = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(i32, (ViewGroup) linearLayout, false);
                                TextView textView2 = (TextView) viewInflate3.findViewById(R.id.sort_option_label);
                                ImageView imageView2 = (ImageView) viewInflate3.findViewById(R.id.sort_option_check);
                                if (!z || str2 == null) {
                                    aVar2 = aVarB;
                                    it = it2;
                                    strAb = "";
                                } else {
                                    aVar2 = aVarB;
                                    it = it2;
                                    strAb = vw2.ab("  (", mobileTvShowsFragment2.getString((str3 == null ? bVar.c : str3).equals("asc") ? R.string.sort_ascending : R.string.sort_descending), ")");
                                }
                                textView2.setText(bVar.b + strAb);
                                imageView2.setVisibility(z ? 0 : 8);
                                viewInflate3.setOnClickListener(new t36(af1Var, z, str2, str3, bVar, mobileTvShowsFragment2, bottomSheetDialog, 2));
                                linearLayout.addView(viewInflate3);
                                aVarB = aVar2;
                                it2 = it;
                                i32 = R.layout.item_sort_option;
                            }
                            bottomSheetDialog.setContentView(viewInflate);
                            bottomSheetDialog.show();
                        }
                        return e6aVar;
                    case 4:
                        List list2 = (List) obj;
                        s16 s16Var2 = mobileTvShowsFragment.p;
                        if (s16Var2 != null) {
                            s16Var2.e(list2);
                            return e6aVar;
                        }
                        cr4.n("contentRowAdapter");
                        throw null;
                    case 5:
                        i68 i68Var = (i68) obj;
                        if (i68Var == null) {
                            i68Var = null;
                        }
                        if (i68Var != null) {
                            List list3 = i68Var.b;
                            if (!list3.isEmpty()) {
                                if (mobileTvShowsFragment.p == null) {
                                    cr4.n("contentRowAdapter");
                                    throw null;
                                }
                                rm3 rm3Var3 = mobileTvShowsFragment.f;
                                cr4.d(rm3Var3);
                                s16.g(rm3Var3.a, i68Var.a, list3);
                            }
                        }
                        return e6aVar;
                    case 6:
                        if (((Boolean) obj).booleanValue()) {
                            rm3 rm3Var22 = mobileTvShowsFragment.f;
                            cr4.d(rm3Var22);
                            rm3Var22.b.setRefreshing(false);
                        }
                        return e6aVar;
                    default:
                        String str4 = (String) obj;
                        if (str4 != null) {
                            Toast.makeText(mobileTvShowsFragment.requireContext(), str4, 0).show();
                        }
                        return e6aVar;
                }
            }
        }));
        final int i8 = 5;
        l().o.f(getViewLifecycleOwner(), new a(new sq3(this) { // from class: j76
            public final /* synthetic */ MobileTvShowsFragment b;

            {
                this.b = this;
            }

            /* JADX WARN: Removed duplicated region for block: B:51:0x0141  */
            @Override // defpackage.sq3
            /*
                Code decompiled incorrectly, please refer to instructions dump.
            */
            public final Object invoke(Object obj) {
                boolean z;
                zw8.a aVar2;
                Iterator it;
                String strAb;
                int i22 = i8;
                MobileTvShowsFragment mobileTvShowsFragment = this.b;
                e6a e6aVar = e6a.a;
                switch (i22) {
                    case 0:
                        ContentItem contentItem = (ContentItem) obj;
                        cr4.g(contentItem, "item");
                        if (contentItem.getItemType() == ContentItem.ItemType.TV_SHOW) {
                            i85 viewLifecycleOwner2 = mobileTvShowsFragment.getViewLifecycleOwner();
                            cr4.f(viewLifecycleOwner2, "getViewLifecycleOwner(...)");
                            wj0.c(s.a(viewLifecycleOwner2), null, null, new m76(contentItem, mobileTvShowsFragment, null), 3);
                        }
                        return e6aVar;
                    case 1:
                        ContentItem contentItem2 = (ContentItem) obj;
                        cr4.g(contentItem2, "item");
                        Context contextRequireContext2 = mobileTvShowsFragment.requireContext();
                        cr4.f(contextRequireContext2, "requireContext(...)");
                        C0690s87.a(contextRequireContext2, contentItem2, d.a(mobileTvShowsFragment));
                        return e6aVar;
                    case 2:
                        mobileTvShowsFragment.l().m(((Integer) obj).intValue());
                        return e6aVar;
                    case 3:
                        af1 af1Var = (af1) obj;
                        cr4.g(af1Var, "row");
                        List list = zw8.a;
                        String str = af1Var.d;
                        List listC = zw8.c(str);
                        if (!listC.isEmpty()) {
                            String str2 = af1Var.h;
                            String str3 = af1Var.i;
                            zw8.a aVarB = zw8.b(str);
                            MobileTvShowsFragment mobileTvShowsFragment2 = this.b;
                            BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(mobileTvShowsFragment2.requireContext());
                            View viewInflate = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(R.layout.bottom_sheet_sort, (ViewGroup) null);
                            ((TextView) viewInflate.findViewById(R.id.sort_sheet_title)).setText(mobileTvShowsFragment2.getString(R.string.sort_dialog_title, af1Var.a));
                            LinearLayout linearLayout = (LinearLayout) viewInflate.findViewById(R.id.sort_options_container);
                            int i32 = R.layout.item_sort_option;
                            if (str2 != null) {
                                View viewInflate2 = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(R.layout.item_sort_option, (ViewGroup) linearLayout, false);
                                TextView textView = (TextView) viewInflate2.findViewById(R.id.sort_option_label);
                                ImageView imageView = (ImageView) viewInflate2.findViewById(R.id.sort_option_check);
                                textView.setText(mobileTvShowsFragment2.getString(R.string.sort_reset_default));
                                imageView.setVisibility(8);
                                viewInflate2.setOnClickListener(new s36(af1Var, mobileTvShowsFragment2, bottomSheetDialog, 2));
                                linearLayout.addView(viewInflate2);
                            }
                            Iterator it2 = listC.iterator();
                            while (it2.hasNext()) {
                                zw8.b bVar = (zw8.b) it2.next();
                                if (cr4.b(str2, bVar.a)) {
                                    z = true;
                                } else {
                                    if (str2 == null) {
                                        if (cr4.b(aVarB != null ? aVarB.a : null, bVar.a)) {
                                        }
                                    }
                                    z = false;
                                }
                                View viewInflate3 = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(i32, (ViewGroup) linearLayout, false);
                                TextView textView2 = (TextView) viewInflate3.findViewById(R.id.sort_option_label);
                                ImageView imageView2 = (ImageView) viewInflate3.findViewById(R.id.sort_option_check);
                                if (!z || str2 == null) {
                                    aVar2 = aVarB;
                                    it = it2;
                                    strAb = "";
                                } else {
                                    aVar2 = aVarB;
                                    it = it2;
                                    strAb = vw2.ab("  (", mobileTvShowsFragment2.getString((str3 == null ? bVar.c : str3).equals("asc") ? R.string.sort_ascending : R.string.sort_descending), ")");
                                }
                                textView2.setText(bVar.b + strAb);
                                imageView2.setVisibility(z ? 0 : 8);
                                viewInflate3.setOnClickListener(new t36(af1Var, z, str2, str3, bVar, mobileTvShowsFragment2, bottomSheetDialog, 2));
                                linearLayout.addView(viewInflate3);
                                aVarB = aVar2;
                                it2 = it;
                                i32 = R.layout.item_sort_option;
                            }
                            bottomSheetDialog.setContentView(viewInflate);
                            bottomSheetDialog.show();
                        }
                        return e6aVar;
                    case 4:
                        List list2 = (List) obj;
                        s16 s16Var2 = mobileTvShowsFragment.p;
                        if (s16Var2 != null) {
                            s16Var2.e(list2);
                            return e6aVar;
                        }
                        cr4.n("contentRowAdapter");
                        throw null;
                    case 5:
                        i68 i68Var = (i68) obj;
                        if (i68Var == null) {
                            i68Var = null;
                        }
                        if (i68Var != null) {
                            List list3 = i68Var.b;
                            if (!list3.isEmpty()) {
                                if (mobileTvShowsFragment.p == null) {
                                    cr4.n("contentRowAdapter");
                                    throw null;
                                }
                                rm3 rm3Var3 = mobileTvShowsFragment.f;
                                cr4.d(rm3Var3);
                                s16.g(rm3Var3.a, i68Var.a, list3);
                            }
                        }
                        return e6aVar;
                    case 6:
                        if (((Boolean) obj).booleanValue()) {
                            rm3 rm3Var22 = mobileTvShowsFragment.f;
                            cr4.d(rm3Var22);
                            rm3Var22.b.setRefreshing(false);
                        }
                        return e6aVar;
                    default:
                        String str4 = (String) obj;
                        if (str4 != null) {
                            Toast.makeText(mobileTvShowsFragment.requireContext(), str4, 0).show();
                        }
                        return e6aVar;
                }
            }
        }));
        final int i9 = 6;
        l().w.f(getViewLifecycleOwner(), new a(new sq3(this) { // from class: j76
            public final /* synthetic */ MobileTvShowsFragment b;

            {
                this.b = this;
            }

            /* JADX WARN: Removed duplicated region for block: B:51:0x0141  */
            @Override // defpackage.sq3
            /*
                Code decompiled incorrectly, please refer to instructions dump.
            */
            public final Object invoke(Object obj) {
                boolean z;
                zw8.a aVar2;
                Iterator it;
                String strAb;
                int i22 = i9;
                MobileTvShowsFragment mobileTvShowsFragment = this.b;
                e6a e6aVar = e6a.a;
                switch (i22) {
                    case 0:
                        ContentItem contentItem = (ContentItem) obj;
                        cr4.g(contentItem, "item");
                        if (contentItem.getItemType() == ContentItem.ItemType.TV_SHOW) {
                            i85 viewLifecycleOwner2 = mobileTvShowsFragment.getViewLifecycleOwner();
                            cr4.f(viewLifecycleOwner2, "getViewLifecycleOwner(...)");
                            wj0.c(s.a(viewLifecycleOwner2), null, null, new m76(contentItem, mobileTvShowsFragment, null), 3);
                        }
                        return e6aVar;
                    case 1:
                        ContentItem contentItem2 = (ContentItem) obj;
                        cr4.g(contentItem2, "item");
                        Context contextRequireContext2 = mobileTvShowsFragment.requireContext();
                        cr4.f(contextRequireContext2, "requireContext(...)");
                        C0690s87.a(contextRequireContext2, contentItem2, d.a(mobileTvShowsFragment));
                        return e6aVar;
                    case 2:
                        mobileTvShowsFragment.l().m(((Integer) obj).intValue());
                        return e6aVar;
                    case 3:
                        af1 af1Var = (af1) obj;
                        cr4.g(af1Var, "row");
                        List list = zw8.a;
                        String str = af1Var.d;
                        List listC = zw8.c(str);
                        if (!listC.isEmpty()) {
                            String str2 = af1Var.h;
                            String str3 = af1Var.i;
                            zw8.a aVarB = zw8.b(str);
                            MobileTvShowsFragment mobileTvShowsFragment2 = this.b;
                            BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(mobileTvShowsFragment2.requireContext());
                            View viewInflate = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(R.layout.bottom_sheet_sort, (ViewGroup) null);
                            ((TextView) viewInflate.findViewById(R.id.sort_sheet_title)).setText(mobileTvShowsFragment2.getString(R.string.sort_dialog_title, af1Var.a));
                            LinearLayout linearLayout = (LinearLayout) viewInflate.findViewById(R.id.sort_options_container);
                            int i32 = R.layout.item_sort_option;
                            if (str2 != null) {
                                View viewInflate2 = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(R.layout.item_sort_option, (ViewGroup) linearLayout, false);
                                TextView textView = (TextView) viewInflate2.findViewById(R.id.sort_option_label);
                                ImageView imageView = (ImageView) viewInflate2.findViewById(R.id.sort_option_check);
                                textView.setText(mobileTvShowsFragment2.getString(R.string.sort_reset_default));
                                imageView.setVisibility(8);
                                viewInflate2.setOnClickListener(new s36(af1Var, mobileTvShowsFragment2, bottomSheetDialog, 2));
                                linearLayout.addView(viewInflate2);
                            }
                            Iterator it2 = listC.iterator();
                            while (it2.hasNext()) {
                                zw8.b bVar = (zw8.b) it2.next();
                                if (cr4.b(str2, bVar.a)) {
                                    z = true;
                                } else {
                                    if (str2 == null) {
                                        if (cr4.b(aVarB != null ? aVarB.a : null, bVar.a)) {
                                        }
                                    }
                                    z = false;
                                }
                                View viewInflate3 = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(i32, (ViewGroup) linearLayout, false);
                                TextView textView2 = (TextView) viewInflate3.findViewById(R.id.sort_option_label);
                                ImageView imageView2 = (ImageView) viewInflate3.findViewById(R.id.sort_option_check);
                                if (!z || str2 == null) {
                                    aVar2 = aVarB;
                                    it = it2;
                                    strAb = "";
                                } else {
                                    aVar2 = aVarB;
                                    it = it2;
                                    strAb = vw2.ab("  (", mobileTvShowsFragment2.getString((str3 == null ? bVar.c : str3).equals("asc") ? R.string.sort_ascending : R.string.sort_descending), ")");
                                }
                                textView2.setText(bVar.b + strAb);
                                imageView2.setVisibility(z ? 0 : 8);
                                viewInflate3.setOnClickListener(new t36(af1Var, z, str2, str3, bVar, mobileTvShowsFragment2, bottomSheetDialog, 2));
                                linearLayout.addView(viewInflate3);
                                aVarB = aVar2;
                                it2 = it;
                                i32 = R.layout.item_sort_option;
                            }
                            bottomSheetDialog.setContentView(viewInflate);
                            bottomSheetDialog.show();
                        }
                        return e6aVar;
                    case 4:
                        List list2 = (List) obj;
                        s16 s16Var2 = mobileTvShowsFragment.p;
                        if (s16Var2 != null) {
                            s16Var2.e(list2);
                            return e6aVar;
                        }
                        cr4.n("contentRowAdapter");
                        throw null;
                    case 5:
                        i68 i68Var = (i68) obj;
                        if (i68Var == null) {
                            i68Var = null;
                        }
                        if (i68Var != null) {
                            List list3 = i68Var.b;
                            if (!list3.isEmpty()) {
                                if (mobileTvShowsFragment.p == null) {
                                    cr4.n("contentRowAdapter");
                                    throw null;
                                }
                                rm3 rm3Var3 = mobileTvShowsFragment.f;
                                cr4.d(rm3Var3);
                                s16.g(rm3Var3.a, i68Var.a, list3);
                            }
                        }
                        return e6aVar;
                    case 6:
                        if (((Boolean) obj).booleanValue()) {
                            rm3 rm3Var22 = mobileTvShowsFragment.f;
                            cr4.d(rm3Var22);
                            rm3Var22.b.setRefreshing(false);
                        }
                        return e6aVar;
                    default:
                        String str4 = (String) obj;
                        if (str4 != null) {
                            Toast.makeText(mobileTvShowsFragment.requireContext(), str4, 0).show();
                        }
                        return e6aVar;
                }
            }
        }));
        final int i10 = 7;
        l().s.f(getViewLifecycleOwner(), new a(new sq3(this) { // from class: j76
            public final /* synthetic */ MobileTvShowsFragment b;

            {
                this.b = this;
            }

            /* JADX WARN: Removed duplicated region for block: B:51:0x0141  */
            @Override // defpackage.sq3
            /*
                Code decompiled incorrectly, please refer to instructions dump.
            */
            public final Object invoke(Object obj) {
                boolean z;
                zw8.a aVar2;
                Iterator it;
                String strAb;
                int i22 = i10;
                MobileTvShowsFragment mobileTvShowsFragment = this.b;
                e6a e6aVar = e6a.a;
                switch (i22) {
                    case 0:
                        ContentItem contentItem = (ContentItem) obj;
                        cr4.g(contentItem, "item");
                        if (contentItem.getItemType() == ContentItem.ItemType.TV_SHOW) {
                            i85 viewLifecycleOwner2 = mobileTvShowsFragment.getViewLifecycleOwner();
                            cr4.f(viewLifecycleOwner2, "getViewLifecycleOwner(...)");
                            wj0.c(s.a(viewLifecycleOwner2), null, null, new m76(contentItem, mobileTvShowsFragment, null), 3);
                        }
                        return e6aVar;
                    case 1:
                        ContentItem contentItem2 = (ContentItem) obj;
                        cr4.g(contentItem2, "item");
                        Context contextRequireContext2 = mobileTvShowsFragment.requireContext();
                        cr4.f(contextRequireContext2, "requireContext(...)");
                        C0690s87.a(contextRequireContext2, contentItem2, d.a(mobileTvShowsFragment));
                        return e6aVar;
                    case 2:
                        mobileTvShowsFragment.l().m(((Integer) obj).intValue());
                        return e6aVar;
                    case 3:
                        af1 af1Var = (af1) obj;
                        cr4.g(af1Var, "row");
                        List list = zw8.a;
                        String str = af1Var.d;
                        List listC = zw8.c(str);
                        if (!listC.isEmpty()) {
                            String str2 = af1Var.h;
                            String str3 = af1Var.i;
                            zw8.a aVarB = zw8.b(str);
                            MobileTvShowsFragment mobileTvShowsFragment2 = this.b;
                            BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(mobileTvShowsFragment2.requireContext());
                            View viewInflate = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(R.layout.bottom_sheet_sort, (ViewGroup) null);
                            ((TextView) viewInflate.findViewById(R.id.sort_sheet_title)).setText(mobileTvShowsFragment2.getString(R.string.sort_dialog_title, af1Var.a));
                            LinearLayout linearLayout = (LinearLayout) viewInflate.findViewById(R.id.sort_options_container);
                            int i32 = R.layout.item_sort_option;
                            if (str2 != null) {
                                View viewInflate2 = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(R.layout.item_sort_option, (ViewGroup) linearLayout, false);
                                TextView textView = (TextView) viewInflate2.findViewById(R.id.sort_option_label);
                                ImageView imageView = (ImageView) viewInflate2.findViewById(R.id.sort_option_check);
                                textView.setText(mobileTvShowsFragment2.getString(R.string.sort_reset_default));
                                imageView.setVisibility(8);
                                viewInflate2.setOnClickListener(new s36(af1Var, mobileTvShowsFragment2, bottomSheetDialog, 2));
                                linearLayout.addView(viewInflate2);
                            }
                            Iterator it2 = listC.iterator();
                            while (it2.hasNext()) {
                                zw8.b bVar = (zw8.b) it2.next();
                                if (cr4.b(str2, bVar.a)) {
                                    z = true;
                                } else {
                                    if (str2 == null) {
                                        if (cr4.b(aVarB != null ? aVarB.a : null, bVar.a)) {
                                        }
                                    }
                                    z = false;
                                }
                                View viewInflate3 = LayoutInflater.from(mobileTvShowsFragment2.requireContext()).inflate(i32, (ViewGroup) linearLayout, false);
                                TextView textView2 = (TextView) viewInflate3.findViewById(R.id.sort_option_label);
                                ImageView imageView2 = (ImageView) viewInflate3.findViewById(R.id.sort_option_check);
                                if (!z || str2 == null) {
                                    aVar2 = aVarB;
                                    it = it2;
                                    strAb = "";
                                } else {
                                    aVar2 = aVarB;
                                    it = it2;
                                    strAb = vw2.ab("  (", mobileTvShowsFragment2.getString((str3 == null ? bVar.c : str3).equals("asc") ? R.string.sort_ascending : R.string.sort_descending), ")");
                                }
                                textView2.setText(bVar.b + strAb);
                                imageView2.setVisibility(z ? 0 : 8);
                                viewInflate3.setOnClickListener(new t36(af1Var, z, str2, str3, bVar, mobileTvShowsFragment2, bottomSheetDialog, 2));
                                linearLayout.addView(viewInflate3);
                                aVarB = aVar2;
                                it2 = it;
                                i32 = R.layout.item_sort_option;
                            }
                            bottomSheetDialog.setContentView(viewInflate);
                            bottomSheetDialog.show();
                        }
                        return e6aVar;
                    case 4:
                        List list2 = (List) obj;
                        s16 s16Var2 = mobileTvShowsFragment.p;
                        if (s16Var2 != null) {
                            s16Var2.e(list2);
                            return e6aVar;
                        }
                        cr4.n("contentRowAdapter");
                        throw null;
                    case 5:
                        i68 i68Var = (i68) obj;
                        if (i68Var == null) {
                            i68Var = null;
                        }
                        if (i68Var != null) {
                            List list3 = i68Var.b;
                            if (!list3.isEmpty()) {
                                if (mobileTvShowsFragment.p == null) {
                                    cr4.n("contentRowAdapter");
                                    throw null;
                                }
                                rm3 rm3Var3 = mobileTvShowsFragment.f;
                                cr4.d(rm3Var3);
                                s16.g(rm3Var3.a, i68Var.a, list3);
                            }
                        }
                        return e6aVar;
                    case 6:
                        if (((Boolean) obj).booleanValue()) {
                            rm3 rm3Var22 = mobileTvShowsFragment.f;
                            cr4.d(rm3Var22);
                            rm3Var22.b.setRefreshing(false);
                        }
                        return e6aVar;
                    default:
                        String str4 = (String) obj;
                        if (str4 != null) {
                            Toast.makeText(mobileTvShowsFragment.requireContext(), str4, 0).show();
                        }
                        return e6aVar;
                }
            }
        }));
    }
}
