package com.tekartik.sqflite;

import a0.v;
import android.app.Activity;
import android.content.Intent;
import android.widget.PopupWindow;
import android.widget.TextView;
import androidx.media3.common.p;
import androidx.recyclerview.widget.RecyclerView;
import com.google.android.gms.internal.ads.p80;
import com.google.android.gms.measurement.internal.u1;
import dev.fluttercommunity.plus.connectivity.ConnectivityBroadcastReceiver;
import ed.q;
import ie.g4;
import ie.h1;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;
import org.drive_hunter.R;
import tv.danmaku.ijk.media.player.ui.CacheManager;
import tv.danmaku.ijk.media.player.ui.subtitleconverter.SubtitleView;
import tv.danmaku.ijk.media.player.ui.subtitleconverter.subtitleFile.TimedTextObject;
import xyz.netfly.mobile.player.VideoDetailActivity;
import xyz.netfly.mobile.player.s;
import xyz.netfly.mobile.player.t;
import xyz.netfly.mobile.view.CastAndCrewDetailActivity;
import xyz.netfly.mobile.view.EpisodesActivity;
import xyz.netfly.ui.SubscriptionActivity;
import xyz.netfly.ui.live.epg.EPGView;
import xyz.netfly.ui.live.tablet.CategorySettingActivity;
import xyz.netfly.ui.live.tablet.LivePlayActivity;
import xyz.stream.api.entity.AiSubtitleResult;
import xyz.stream.api.entity.BaseEntity;
import xyz.stream.api.entity.CmsVideoSource;
import xyz.stream.api.entity.LiveCategoryEntity;
import xyz.stream.api.entity.MobileBaseEntity;
import xyz.stream.api.entity.SeriesEntity;
import xyz.stream.api.entity.SubtitlePlayEntity;
import xyz.stream.api.o;
import xyz.stream.api.z;
import xyz.stream.utils.f0;
import xyz.stream.view.RecyclerWithPositionView;
import xyz.stream.view.UiUtils;

/* JADX INFO: loaded from: classes.dex */
public final /* synthetic */ class g implements Runnable {

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

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

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

    public /* synthetic */ g(v vVar, h hVar) {
        this.f24843a = 1;
        this.f24845c = vVar;
        this.f24844b = hVar;
    }

    @Override // java.lang.Runnable
    public final void run() {
        int i10 = 3;
        final int i11 = 1;
        final int i12 = 0;
        switch (this.f24843a) {
            case 0:
                h hVar = (h) this.f24844b;
                f fVar = (f) this.f24845c;
                hVar.getClass();
                fVar.f24842a.run();
                hVar.f24851f = fVar;
                hVar.f24850e.run();
                return;
            case 1:
                v vVar = (v) this.f24845c;
                h hVar2 = (h) this.f24844b;
                synchronized (vVar) {
                    try {
                        HashSet hashSet = new HashSet((Set) vVar.f216e);
                        ((Set) vVar.f217f).remove(hVar2);
                        ((Set) vVar.f216e).add(hVar2);
                        f fVar2 = hVar2.f24851f;
                        if (fVar2 == null || !fVar2.b()) {
                            f fVar3 = hVar2.f24851f;
                            if ((fVar3 != null ? fVar3.a() : null) != null) {
                                Map map = (Map) vVar.f218g;
                                f fVar4 = hVar2.f24851f;
                                map.remove(fVar4 != null ? fVar4.a() : null);
                            }
                        }
                        vVar.n(hVar2);
                        Iterator it = hashSet.iterator();
                        while (it.hasNext()) {
                            vVar.n((h) it.next());
                        }
                    } catch (Throwable th) {
                        throw th;
                    }
                    break;
                }
                return;
            case 2:
                ((ConnectivityBroadcastReceiver) this.f24844b).f25183c.a((List) this.f24845c);
                return;
            case 3:
                ((CacheManager) this.f24844b).lambda$deleteCacheFile$0((String) this.f24845c);
                return;
            case 4:
                t tVar = (t) this.f24844b;
                List list = (List) this.f24845c;
                tVar.getClass();
                Iterator it2 = list.iterator();
                while (it2.hasNext()) {
                    int iIntValue = ((Integer) it2.next()).intValue();
                    List listU = o.f().u(tVar.f35030x.getId().intValue(), iIntValue);
                    if (listU != null && !listU.isEmpty()) {
                        String videoSource = t4.f.x(listU).p(new fa.h(19), 0) ? ((CmsVideoSource) t4.f.x(listU).e(new fa.h(20)).g().a()).getVideoSource() : ((CmsVideoSource) listU.get(0)).getVideoSource();
                        SeriesEntity seriesEntity = (SeriesEntity) t4.f.x(tVar.P).e(new xyz.netfly.mobile.player.c(iIntValue, i12)).g().a();
                        tVar.f35007a.runOnUiThread(new xyz.netfly.mobile.player.d(tVar, iIntValue, seriesEntity, videoSource, tVar.f35030x.getTitle() + "S" + seriesEntity.getSeasonNumber() + "E" + seriesEntity.getEpisodeNumber(), f0.o().q("flutter.selectRoles", "")));
                    }
                }
                return;
            case 5:
                xyz.netfly.mobile.player.m mVar = (xyz.netfly.mobile.player.m) this.f24844b;
                ke.n nVar = (ke.n) this.f24845c;
                mVar.getClass();
                nVar.notifyDataSetChanged();
                t tVar2 = mVar.f34993c;
                tVar2.getClass();
                new Thread(new xyz.netfly.mobile.player.e(tVar2, i12)).start();
                return;
            case 6:
                s sVar = (s) this.f24844b;
                String str = (String) this.f24845c;
                t tVar3 = sVar.f35006a;
                tVar3.y();
                String strM = kotlinx.coroutines.flow.h.m(tVar3.f35030x.getRuntime());
                if (tVar3.f35030x.getSourceType().intValue() == 3) {
                    strM = kotlinx.coroutines.flow.h.m(tVar3.f35031y.getRuntime() + "");
                }
                tVar3.f35009c.S.setText(str + " - " + strM);
                return;
            case 7:
                VideoDetailActivity videoDetailActivity = (VideoDetailActivity) this.f24844b;
                String str2 = (String) this.f24845c;
                WeakReference weakReference = VideoDetailActivity.f34914n0;
                if (videoDetailActivity.isFinishing() || videoDetailActivity.isDestroyed()) {
                    return;
                }
                if (str2 != null && !str2.isEmpty()) {
                    videoDetailActivity.f34922e = str2;
                }
                videoDetailActivity.b0(true);
                return;
            case 8:
                ((xyz.netfly.mobile.plugin.e) this.f24844b).f35056a.startActivity((Intent) this.f24845c);
                return;
            case 9:
                xyz.netfly.mobile.plugin.e eVar = (xyz.netfly.mobile.plugin.e) this.f24844b;
                ed.t tVar4 = (ed.t) this.f24845c;
                eVar.getClass();
                tVar4.success(MobileBaseEntity.successResult(Boolean.valueOf(z.b().d(eVar))));
                return;
            case 10:
                q qVar = (q) this.f24844b;
                ed.t tVar5 = (ed.t) this.f24845c;
                Object objA = z.b().a(Boolean.parseBoolean((String) qVar.argument("params")));
                if (objA == null) {
                    objA = "";
                }
                tVar5.success(MobileBaseEntity.successResult(objA));
                return;
            case 11:
                xyz.netfly.mobile.plugin.e eVar2 = (xyz.netfly.mobile.plugin.e) this.f24844b;
                eVar2.getClass();
                Object obj = this.f24845c;
                if (obj instanceof String) {
                    xyz.stream.utils.h.e(eVar2.f35056a, (String) obj);
                    return;
                }
                ed.j jVar = (ed.j) eVar2.f35058c.f36098a;
                if (jVar != null) {
                    jVar.a(obj);
                    return;
                }
                return;
            case 12:
                ((ed.j) ((xyz.netfly.mobile.plugin.e) this.f24844b).f35057b.f36098a).a((Map) this.f24845c);
                return;
            case 13:
                xyz.netfly.mobile.plugin.e eVar3 = (xyz.netfly.mobile.plugin.e) this.f24844b;
                String str3 = (String) this.f24845c;
                ed.j jVar2 = (ed.j) eVar3.f35058c.f36098a;
                if (jVar2 == null || jVar2.f25835a.get()) {
                    return;
                }
                tb.d dVar = jVar2.f25836b;
                if (((AtomicReference) dVar.f33021c).get() != jVar2) {
                    return;
                }
                ed.l lVar = (ed.l) dVar.f33022d;
                lVar.f25837a.send(lVar.f25838b, lVar.f25839c.encodeErrorEnvelope("10001", str3, null));
                return;
            case 14:
                xyz.netfly.mobile.view.e eVar4 = (xyz.netfly.mobile.view.e) this.f24844b;
                List list2 = (List) this.f24845c;
                eVar4.getClass();
                if (list2 == null || list2.isEmpty()) {
                    return;
                }
                CastAndCrewDetailActivity castAndCrewDetailActivity = eVar4.f35153a;
                castAndCrewDetailActivity.f35118d.addAll(list2);
                castAndCrewDetailActivity.f35119e.notifyItemRangeInserted(castAndCrewDetailActivity.f35118d.size() - list2.size(), list2.size());
                return;
            case 15:
                final EpisodesActivity episodesActivity = (EpisodesActivity) this.f24844b;
                PopupWindow popupWindow = (PopupWindow) this.f24845c;
                ArrayList arrayList = episodesActivity.f35123d;
                arrayList.clear();
                episodesActivity.runOnUiThread(new Runnable() { // from class: xyz.netfly.mobile.view.i
                    @Override // java.lang.Runnable
                    public final void run() {
                        int i13 = i12;
                        EpisodesActivity episodesActivity2 = episodesActivity;
                        switch (i13) {
                            case 0:
                                episodesActivity2.K(episodesActivity2.f35123d);
                                break;
                            default:
                                xyz.netfly.mobile.player.i iVar = EpisodesActivity.f35120i;
                                episodesActivity2.L();
                                UiUtils.dismissProgressDialog();
                                ((g4) episodesActivity2.binding).f26900g.setText(episodesActivity2.getString(R.string.season) + " " + episodesActivity2.f35124e);
                                break;
                        }
                    }
                });
                List listM = o.f().m(episodesActivity.f35126g, null, Integer.valueOf(episodesActivity.f35124e));
                if (listM == null || listM.isEmpty()) {
                    Objects.requireNonNull(popupWindow);
                    episodesActivity.runOnUiThread(new xyz.netfly.ads.h(popupWindow, 6));
                    return;
                } else {
                    arrayList.addAll(listM);
                    episodesActivity.runOnUiThread(new Runnable() { // from class: xyz.netfly.mobile.view.i
                        @Override // java.lang.Runnable
                        public final void run() {
                            int i13 = i11;
                            EpisodesActivity episodesActivity2 = episodesActivity;
                            switch (i13) {
                                case 0:
                                    episodesActivity2.K(episodesActivity2.f35123d);
                                    break;
                                default:
                                    xyz.netfly.mobile.player.i iVar = EpisodesActivity.f35120i;
                                    episodesActivity2.L();
                                    UiUtils.dismissProgressDialog();
                                    ((g4) episodesActivity2.binding).f26900g.setText(episodesActivity2.getString(R.string.season) + " " + episodesActivity2.f35124e);
                                    break;
                            }
                        }
                    });
                    return;
                }
            case 16:
                xyz.netfly.player.n nVar2 = (xyz.netfly.player.n) this.f24844b;
                String str4 = (String) this.f24845c;
                nVar2.getClass();
                o oVarF = o.f();
                xyz.netfly.player.i iVar = new xyz.netfly.player.i(nVar2, i12);
                oVarF.getClass();
                HashMap mapO = u1.o("task_id", str4);
                o.g("translation/task/progress", oVarF.n(), mapO, new xyz.stream.api.j(oVarF, iVar, "translation/task/progress", mapO, 8));
                return;
            case 17:
                xyz.netfly.player.n nVar3 = (xyz.netfly.player.n) this.f24844b;
                nVar3.f35224j = (TimedTextObject) this.f24845c;
                SubtitleView subtitleViewK = nVar3.k();
                TextView textViewI = nVar3.i();
                if (subtitleViewK == null || textViewI == null || nVar3.f35224j == null) {
                    return;
                }
                textViewI.setVisibility(8);
                subtitleViewK.setData(nVar3.f35224j);
                subtitleViewK.setLanguage(1);
                return;
            case 18:
                xyz.netfly.player.h hVar3 = (xyz.netfly.player.h) this.f24844b;
                BaseEntity baseEntity = (BaseEntity) this.f24845c;
                hVar3.getClass();
                UiUtils.dismissProgressDialog();
                xyz.netfly.player.n nVar4 = hVar3.f35200b;
                Activity activity = nVar4.f35233s;
                UiUtils.showTip(activity, baseEntity != null ? baseEntity.getMsg() : activity.getString(R.string.translation_failed));
                WeakReference weakReference2 = nVar4.f35223i;
                if (weakReference2 == null || weakReference2.get() == null) {
                    return;
                }
                ((wf.a) nVar4.f35223i.get()).d();
                return;
            case 19:
                xyz.netfly.player.h hVar4 = (xyz.netfly.player.h) this.f24844b;
                String str5 = (String) this.f24845c;
                hVar4.getClass();
                UiUtils.dismissProgressDialog();
                xyz.stream.utils.h.c("Translation error: " + str5);
                xyz.netfly.player.n nVar5 = hVar4.f35200b;
                WeakReference weakReference3 = nVar5.f35223i;
                if (weakReference3 == null || weakReference3.get() == null) {
                    return;
                }
                ((wf.a) nVar5.f35223i.get()).d();
                return;
            case 20:
                xyz.netfly.player.i iVar2 = (xyz.netfly.player.i) this.f24844b;
                AiSubtitleResult aiSubtitleResult = (AiSubtitleResult) this.f24845c;
                xyz.netfly.player.n nVar6 = (xyz.netfly.player.n) iVar2.f35202b;
                if (nVar6.f35227m.isEmpty()) {
                    return;
                }
                xyz.netfly.player.n.a(nVar6, aiSubtitleResult.getTurboUrl(), ((SubtitlePlayEntity) nVar6.f35227m.get(0)).getTitle());
                return;
            case 21:
                SubscriptionActivity.L(((ne.c) this.f24844b).f31249a, (String) this.f24845c);
                return;
            case 22:
                ((EPGView) this.f24844b).setVerticalExtraLayoutSpace((RecyclerView) this.f24845c);
                return;
            case 23:
                EPGView ePGView = (EPGView) this.f24844b;
                RecyclerWithPositionView recyclerWithPositionView = (RecyclerWithPositionView) this.f24845c;
                int i13 = EPGView.f35314u0;
                ePGView.getClass();
                recyclerWithPositionView.scrollHorizontallyTo(0);
                int i14 = -ePGView.f35317c0;
                ePGView.j(recyclerWithPositionView, i14);
                ePGView.l(recyclerWithPositionView, i14);
                ePGView.o();
                return;
            case 24:
                xyz.netfly.ui.live.epg.q qVar2 = (xyz.netfly.ui.live.epg.q) this.f24844b;
                xyz.netfly.ui.live.epg.m mVar2 = (xyz.netfly.ui.live.epg.m) this.f24845c;
                qVar2.getClass();
                try {
                    try {
                        if (qVar2.s(mVar2) && !Thread.currentThread().isInterrupted()) {
                            List listM2 = qVar2.m(mVar2.f35367a, mVar2.f35368b, new p(mVar2.f35370d, i10, qVar2));
                            if (qVar2.s(mVar2) && !Thread.currentThread().isInterrupted()) {
                                mVar2.f35369c.onSuccess(listM2);
                            }
                        }
                    } finally {
                        qVar2.h(mVar2);
                    }
                    break;
                } catch (Exception e10) {
                    xyz.stream.utils.h.c("runEpgListRequest error: " + e10.getMessage());
                    if (qVar2.s(mVar2)) {
                        mVar2.f35369c.a(e10.getMessage());
                    }
                }
                return;
            case 25:
                xyz.netfly.ui.live.epg.q qVar3 = (xyz.netfly.ui.live.epg.q) this.f24844b;
                xyz.netfly.ui.live.epg.n nVar7 = (xyz.netfly.ui.live.epg.n) this.f24845c;
                qVar3.getClass();
                if (Thread.currentThread().isInterrupted() || !qVar3.t(nVar7)) {
                    qVar3.i(nVar7);
                    return;
                }
                try {
                    try {
                        List listM3 = qVar3.m(nVar7.f35371a, kotlinx.coroutines.flow.h.y("yyyy-MM-dd"), new androidx.media3.exoplayer.analytics.g(qVar3, nVar7, 26));
                        if (qVar3.t(nVar7) && !Thread.currentThread().isInterrupted()) {
                            if (!((ArrayList) listM3).isEmpty()) {
                                qVar3.e(nVar7.f35371a);
                            }
                            qVar3.x(nVar7, xyz.netfly.ui.live.epg.q.g(listM3));
                        }
                        break;
                    } catch (Exception e11) {
                        xyz.stream.utils.h.c("fetchNowEpgData error: " + e11.getMessage());
                        if (qVar3.t(nVar7)) {
                            qVar3.x(nVar7, null);
                        }
                        break;
                    }
                    return;
                } finally {
                    qVar3.i(nVar7);
                }
            case 26:
                se.e eVar5 = (se.e) this.f24844b;
                h1 h1Var = (h1) this.f24845c;
                eVar5.getClass();
                h1Var.f26948a.clearOnScrollListeners();
                int i15 = eVar5.f32757d;
                RecyclerWithPositionView recyclerWithPositionView2 = h1Var.f26948a;
                recyclerWithPositionView2.scrollBy(i15, 0);
                recyclerWithPositionView2.setScrollListener(eVar5.f32758e);
                return;
            case 27:
                oe.f fVar5 = (oe.f) this.f24844b;
                List list3 = (List) this.f24845c;
                fVar5.getClass();
                UiUtils.dismissProgressDialog();
                if (list3 == null || list3.isEmpty()) {
                    return;
                }
                CategorySettingActivity categorySettingActivity = (CategorySettingActivity) fVar5.f31492b;
                categorySettingActivity.f35444c.clear();
                Iterator it3 = list3.iterator();
                while (it3.hasNext()) {
                    categorySettingActivity.f35444c.add(((LiveCategoryEntity) it3.next()).clone());
                }
                categorySettingActivity.f35443b.notifyDataSetChanged();
                ((ie.d) categorySettingActivity.binding).f26744c.post(new xyz.netfly.ads.h(fVar5, 15));
                return;
            case 28:
                xyz.netfly.player.i iVar3 = (xyz.netfly.player.i) this.f24844b;
                List list4 = (List) this.f24845c;
                LivePlayActivity livePlayActivity = (LivePlayActivity) iVar3.f35202b;
                if (livePlayActivity.isFinishing() || livePlayActivity.isDestroyed() || livePlayActivity.binding == 0) {
                    return;
                }
                livePlayActivity.f35449b.r(list4);
                return;
            default:
                p80 p80Var = (p80) this.f24844b;
                String str6 = (String) this.f24845c;
                ag.c cVar = (ag.c) p80Var.f15297e;
                if (cVar != null) {
                    cVar.u(str6);
                    return;
                }
                return;
        }
    }

    public /* synthetic */ g(Object obj, Object obj2, int i10) {
        this.f24843a = i10;
        this.f24844b = obj;
        this.f24845c = obj2;
    }
}
