package com.strmr.ps.ui.contextmenu;

import android.util.Log;
import androidx.media3.container.NalUnitUtil;
import androidx.media3.extractor.flac.FlacConstants;
import androidx.media3.extractor.ts.TsExtractor;
import com.strmr.ps.data.event.PlaybackStateManager;
import com.strmr.ps.data.model.ContentItem;
import com.strmr.ps.data.repository.ContinueWatchingRepository;
import com.strmr.ps.data.repository.TraktSyncRepository;
import com.strmr.ps.ui.contextmenu.a;
import defpackage.ak1;
import defpackage.ck1;
import defpackage.e6a;
import defpackage.gr3;
import defpackage.io6;
import defpackage.m12;
import defpackage.qm5;
import defpackage.s38;
import defpackage.sc2;
import defpackage.sm5;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.Boxing;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;

/* JADX INFO: loaded from: classes3.dex */
@Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0002\u001a\u00020\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0002\u0010\u0003"}, d2 = {"Lak1;", "Le6a;", "<anonymous>", "(Lak1;)V"}, k = 3, mv = {2, 0, 0})
@DebugMetadata(c = "com.strmr.ps.ui.contextmenu.ContextMenuActionHandler$executeAction$2", f = "ContextMenuActionHandler.kt", i = {0, 1, 2, 3, 4, 7, 8, 10, 12, 14, 16, 18, 20, 21, 22, 24, 25, 27, 28, 29, 31, 32, 34, 35, 37}, l = {162, 164, 170, TsExtractor.TS_STREAM_TYPE_AC4, 174, 181, 183, TsExtractor.TS_PACKET_SIZE, 190, 196, 199, 205, 208, 214, 217, 223, 229, 238, 243, TsExtractor.TS_STREAM_TYPE_AIT, 260, 265, 267, 280, 283, 287, 303, 306, 313, 315, 322, 325, 331, 337, 339, 343, 349, 354, 412}, m = "invokeSuspend", n = {"isMovie", "isMovie", "success", "success", "success", "success", "success", "success", "success", "success", "success", "success", "watchSuccess", "watchSuccess", "watchSuccess", "unwatchSuccess", "unwatchSuccess", "success", "success", "success", "success", "success", "success", "success", "success"}, s = {"I$0", "I$0", "Z$0", "Z$0", "Z$0", "Z$0", "Z$0", "Z$0", "Z$0", "Z$0", "Z$0", "Z$0", "Z$0", "Z$0", "Z$0", "Z$0", "Z$0", "Z$0", "Z$0", "Z$0", "Z$0", "Z$0", "Z$0", "Z$0", "Z$0"})
final class d extends SuspendLambda implements gr3<ak1, Continuation<? super e6a>, Object> {
    public int a;
    public boolean b;
    public int c;
    public final /* synthetic */ ContentItem d;
    public final /* synthetic */ a e;
    public final /* synthetic */ ContextMenuActionHandler f;
    public final /* synthetic */ k i;

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public d(ContentItem contentItem, a aVar, ContextMenuActionHandler contextMenuActionHandler, k kVar, Continuation continuation) {
        super(2, continuation);
        this.d = contentItem;
        this.e = aVar;
        this.f = contextMenuActionHandler;
        this.i = kVar;
    }

    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    public final Continuation create(Object obj, Continuation continuation) {
        return new d(this.d, this.e, this.f, this.i, continuation);
    }

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

    /* JADX WARN: Code restructure failed: missing block: B:106:0x0223, code lost:
    
        if (r11.syncCollectionOnly(r10) == r0) goto L279;
     */
    /* JADX WARN: Code restructure failed: missing block: B:116:0x025a, code lost:
    
        if (r11.syncWatchlistOnly(r10) == r0) goto L279;
     */
    /* JADX WARN: Code restructure failed: missing block: B:126:0x0291, code lost:
    
        if (r11.syncWatchlistOnly(r10) == r0) goto L279;
     */
    /* JADX WARN: Code restructure failed: missing block: B:138:0x02d0, code lost:
    
        if (r11.a(r10) == r0) goto L279;
     */
    /* JADX WARN: Code restructure failed: missing block: B:152:0x0338, code lost:
    
        if (r11 == r0) goto L279;
     */
    /* JADX WARN: Code restructure failed: missing block: B:160:0x0375, code lost:
    
        if (r11.a(r10) != r0) goto L67;
     */
    /* JADX WARN: Code restructure failed: missing block: B:173:0x03bf, code lost:
    
        if (r11 == r0) goto L279;
     */
    /* JADX WARN: Code restructure failed: missing block: B:178:0x03df, code lost:
    
        if (r11.a(r10) == r0) goto L279;
     */
    /* JADX WARN: Code restructure failed: missing block: B:191:0x041c, code lost:
    
        if (r11 == r0) goto L279;
     */
    /* JADX WARN: Code restructure failed: missing block: B:199:0x0462, code lost:
    
        if (r11.a(r10) != r0) goto L67;
     */
    /* JADX WARN: Code restructure failed: missing block: B:209:0x0498, code lost:
    
        if (r11 == r0) goto L279;
     */
    /* JADX WARN: Code restructure failed: missing block: B:214:0x04c1, code lost:
    
        if (r11.a(r10) == r0) goto L279;
     */
    /* JADX WARN: Code restructure failed: missing block: B:224:0x04f7, code lost:
    
        if (r11 == r0) goto L279;
     */
    /* JADX WARN: Code restructure failed: missing block: B:229:0x0517, code lost:
    
        if (r11.a(r10) == r0) goto L279;
     */
    /* JADX WARN: Code restructure failed: missing block: B:239:0x0553, code lost:
    
        if (r11.a(r10) == r0) goto L279;
     */
    /* JADX WARN: Code restructure failed: missing block: B:278:0x05b4, code lost:
    
        if (defpackage.wj0.f(r11, r1, r10) == r0) goto L279;
     */
    /* JADX WARN: Code restructure failed: missing block: B:46:0x00e2, code lost:
    
        if (r11 == r0) goto L279;
     */
    /* JADX WARN: Code restructure failed: missing block: B:51:0x00ff, code lost:
    
        if (r11 == r0) goto L279;
     */
    /* JADX WARN: Code restructure failed: missing block: B:65:0x014e, code lost:
    
        if (r11.a(r10) != r0) goto L67;
     */
    /* JADX WARN: Code restructure failed: missing block: B:72:0x0168, code lost:
    
        if (r11 == r0) goto L279;
     */
    /* JADX WARN: Code restructure failed: missing block: B:76:0x0180, code lost:
    
        if (r11 == r0) goto L279;
     */
    /* JADX WARN: Code restructure failed: missing block: B:85:0x01b2, code lost:
    
        if (r11.a(r10) != r0) goto L67;
     */
    /* JADX WARN: Code restructure failed: missing block: B:96:0x01ec, code lost:
    
        if (r11.syncCollectionOnly(r10) == r0) goto L279;
     */
    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Removed duplicated region for block: B:105:0x020e  */
    /* JADX WARN: Removed duplicated region for block: B:115:0x0245  */
    /* JADX WARN: Removed duplicated region for block: B:125:0x027c  */
    /* JADX WARN: Removed duplicated region for block: B:137:0x02bf  */
    /* JADX WARN: Removed duplicated region for block: B:151:0x0328  */
    /* JADX WARN: Removed duplicated region for block: B:155:0x0345 A[PHI: r1
      0x0345: PHI (r1v41 boolean) = (r1v40 boolean), (r1v42 boolean) binds: [B:150:0x0326, B:154:0x033c] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:156:0x0347  */
    /* JADX WARN: Removed duplicated region for block: B:172:0x03af  */
    /* JADX WARN: Removed duplicated region for block: B:176:0x03cc A[PHI: r1
      0x03cc: PHI (r1v47 boolean) = (r1v46 boolean), (r1v48 boolean) binds: [B:171:0x03ad, B:175:0x03c3] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:177:0x03ce  */
    /* JADX WARN: Removed duplicated region for block: B:190:0x040c  */
    /* JADX WARN: Removed duplicated region for block: B:194:0x0429 A[PHI: r1
      0x0429: PHI (r1v51 boolean) = (r1v50 boolean), (r1v52 boolean) binds: [B:189:0x040a, B:193:0x0420] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:195:0x042b  */
    /* JADX WARN: Removed duplicated region for block: B:208:0x0488  */
    /* JADX WARN: Removed duplicated region for block: B:212:0x04a5 A[PHI: r1
      0x04a5: PHI (r1v57 boolean) = (r1v56 boolean), (r1v58 boolean) binds: [B:207:0x0486, B:211:0x049c] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:213:0x04a7  */
    /* JADX WARN: Removed duplicated region for block: B:223:0x04e7  */
    /* JADX WARN: Removed duplicated region for block: B:227:0x0504 A[PHI: r1
      0x0504: PHI (r1v61 boolean) = (r1v60 boolean), (r1v62 boolean) binds: [B:222:0x04e5, B:226:0x04fb] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:228:0x0506  */
    /* JADX WARN: Removed duplicated region for block: B:238:0x0539  */
    /* JADX WARN: Removed duplicated region for block: B:277:0x05a0 A[PHI: r3
      0x05a0: PHI (r3v39 boolean) = 
      (r3v1 boolean)
      (r3v0 boolean)
      (r3v0 boolean)
      (r3v0 boolean)
      (r3v0 boolean)
      (r3v0 boolean)
      (r3v17 boolean)
      (r3v40 boolean)
     binds: [B:182:0x03e7, B:165:0x0385, B:166:0x0387, B:144:0x02fe, B:145:0x0300, B:140:0x02d4, B:87:0x01b6, B:67:0x0152] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:55:0x010c  */
    /* JADX WARN: Removed duplicated region for block: B:64:0x0143 A[PHI: r1
      0x0143: PHI (r1v26 boolean) = (r1v24 boolean), (r1v27 boolean) binds: [B:62:0x013f, B:29:0x009c] A[DONT_GENERATE, DONT_INLINE]] */
    /* JADX WARN: Removed duplicated region for block: B:80:0x018c  */
    /* JADX WARN: Removed duplicated region for block: B:87:0x01b6  */
    /* JADX WARN: Removed duplicated region for block: B:95:0x01d7  */
    /* JADX WARN: Type inference failed for: r11v51, types: [com.strmr.ps.data.repository.TraktSyncRepository] */
    /* JADX WARN: Type inference failed for: r11v53, types: [com.strmr.ps.data.repository.TraktSyncRepository] */
    /* JADX WARN: Type inference failed for: r11v55, types: [com.strmr.ps.data.repository.TraktSyncRepository] */
    /* JADX WARN: Type inference failed for: r11v57, types: [com.strmr.ps.data.repository.TraktSyncRepository] */
    /* JADX WARN: Type inference failed for: r1v17 */
    /* JADX WARN: Type inference failed for: r1v18 */
    /* JADX WARN: Type inference failed for: r1v2 */
    /* JADX WARN: Type inference failed for: r1v20 */
    /* JADX WARN: Type inference failed for: r1v22 */
    /* JADX WARN: Type inference failed for: r1v3, types: [boolean, int] */
    /* JADX WARN: Type inference failed for: r1v67 */
    /* JADX WARN: Type inference failed for: r1v68 */
    /* JADX WARN: Type inference failed for: r1v69 */
    /* JADX WARN: Type inference failed for: r1v70 */
    /* JADX WARN: Type inference failed for: r1v71 */
    /* JADX WARN: Type inference failed for: r1v72 */
    /* JADX WARN: Type inference failed for: r9v0 */
    /* JADX WARN: Type inference fix 'apply assigned field type' failed
    java.lang.UnsupportedOperationException: ArgType.getObject(), call class: class jadx.core.dex.instructions.args.ArgType$PrimitiveArg
    	at jadx.core.dex.instructions.args.ArgType.getObject(ArgType.java:593)
    	at jadx.core.dex.attributes.nodes.ClassTypeVarsAttr.getTypeVarsMapFor(ClassTypeVarsAttr.java:35)
    	at jadx.core.dex.nodes.utils.TypeUtils.replaceClassGenerics(TypeUtils.java:177)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.insertExplicitUseCast(FixTypesVisitor.java:397)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.tryFieldTypeWithNewCasts(FixTypesVisitor.java:359)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.applyFieldType(FixTypesVisitor.java:309)
    	at jadx.core.dex.visitors.typeinference.FixTypesVisitor.visit(FixTypesVisitor.java:94)
     */
    @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
    /*
        Code decompiled incorrectly, please refer to instructions dump.
    */
    public final Object invokeSuspend(Object obj) {
        ?? r1;
        boolean zBooleanValue;
        ?? r12;
        boolean zBooleanValue2;
        ?? r13;
        TraktSyncRepository traktSyncRepository;
        boolean zBooleanValue3;
        Long continueWatchingPlaybackId;
        Long continueWatchingPlaybackId2;
        Long continueWatchingPlaybackId3;
        Long continueWatchingPlaybackId4;
        Long continueWatchingPlaybackId5;
        ck1 ck1Var = ck1.a;
        int i = this.c;
        a aVar = this.e;
        ContentItem contentItem = this.d;
        ContextMenuActionHandler contextMenuActionHandler = this.f;
        switch (i) {
            case 0:
                s38.b(obj);
                ?? r14 = contentItem.getItemType() == ContentItem.ItemType.MOVIE ? 1 : 0;
                if (!(aVar instanceof a.m) && !(aVar instanceof a.y)) {
                    if (!(aVar instanceof a.k)) {
                        if (!(aVar instanceof a.j)) {
                            if (!(aVar instanceof a.C0109a)) {
                                if (!(aVar instanceof a.q)) {
                                    if (!(aVar instanceof a.c)) {
                                        if (!(aVar instanceof a.t)) {
                                            if (!(aVar instanceof a.r)) {
                                                if (!(aVar instanceof a.i)) {
                                                    if (!(aVar instanceof a.h)) {
                                                        if (!(aVar instanceof a.u)) {
                                                            if (!(aVar instanceof a.g)) {
                                                                if (aVar instanceof a.f) {
                                                                    TraktSyncRepository traktSyncRepository2 = contextMenuActionHandler.a;
                                                                    int tmdbId = contentItem.getTmdbId();
                                                                    this.c = 31;
                                                                    obj = traktSyncRepository2.markShowUnwatched(tmdbId, this);
                                                                    if (obj != ck1Var) {
                                                                        zBooleanValue2 = ((Boolean) obj).booleanValue();
                                                                        continueWatchingPlaybackId4 = contentItem.getContinueWatchingPlaybackId();
                                                                        if (continueWatchingPlaybackId4 != null) {
                                                                            if (zBooleanValue2) {
                                                                                contextMenuActionHandler.d.unhideShow(contentItem.getTmdbId());
                                                                                contextMenuActionHandler.d.invalidateCache();
                                                                                PlaybackStateManager playbackStateManager = contextMenuActionHandler.c;
                                                                                this.b = zBooleanValue2;
                                                                                this.c = 33;
                                                                            }
                                                                            z = zBooleanValue2;
                                                                            m12 m12Var = sc2.a;
                                                                            qm5 qm5Var = sm5.a;
                                                                            c cVar = new c(z, this.i, aVar, null);
                                                                            this.c = 39;
                                                                        } else {
                                                                            long jLongValue = continueWatchingPlaybackId4.longValue();
                                                                            ContinueWatchingRepository continueWatchingRepository = contextMenuActionHandler.d;
                                                                            this.b = zBooleanValue2;
                                                                            this.c = 32;
                                                                            obj = continueWatchingRepository.removePlayback(jLongValue, this);
                                                                        }
                                                                    }
                                                                } else if (aVar instanceof a.e) {
                                                                    TraktSyncRepository traktSyncRepository3 = contextMenuActionHandler.a;
                                                                    int tmdbId2 = contentItem.getTmdbId();
                                                                    this.c = 34;
                                                                    obj = traktSyncRepository3.addToDropped(tmdbId2, this);
                                                                    if (obj != ck1Var) {
                                                                        zBooleanValue2 = ((Boolean) obj).booleanValue();
                                                                        continueWatchingPlaybackId5 = contentItem.getContinueWatchingPlaybackId();
                                                                        if (continueWatchingPlaybackId5 != null) {
                                                                            if (zBooleanValue2) {
                                                                                contextMenuActionHandler.d.invalidateCache();
                                                                                PlaybackStateManager playbackStateManager2 = contextMenuActionHandler.c;
                                                                                this.b = zBooleanValue2;
                                                                                this.c = 36;
                                                                            }
                                                                            z = zBooleanValue2;
                                                                            m12 m12Var2 = sc2.a;
                                                                            qm5 qm5Var2 = sm5.a;
                                                                            c cVar2 = new c(z, this.i, aVar, null);
                                                                            this.c = 39;
                                                                        } else {
                                                                            long jLongValue2 = continueWatchingPlaybackId5.longValue();
                                                                            ContinueWatchingRepository continueWatchingRepository2 = contextMenuActionHandler.d;
                                                                            this.b = zBooleanValue2;
                                                                            this.c = 35;
                                                                            obj = continueWatchingRepository2.removePlayback(jLongValue2, this);
                                                                        }
                                                                    }
                                                                } else if (aVar instanceof a.ab) {
                                                                    TraktSyncRepository traktSyncRepository4 = contextMenuActionHandler.a;
                                                                    int tmdbId3 = contentItem.getTmdbId();
                                                                    this.c = 37;
                                                                    obj = traktSyncRepository4.removeFromDropped(tmdbId3, this);
                                                                    if (obj != ck1Var) {
                                                                        zBooleanValue2 = ((Boolean) obj).booleanValue();
                                                                        if (zBooleanValue2) {
                                                                            contextMenuActionHandler.d.unhideShow(contentItem.getTmdbId());
                                                                            contextMenuActionHandler.d.invalidateCache();
                                                                            PlaybackStateManager playbackStateManager3 = contextMenuActionHandler.c;
                                                                            this.b = zBooleanValue2;
                                                                            this.c = 38;
                                                                        }
                                                                        z = zBooleanValue2;
                                                                        m12 m12Var22 = sc2.a;
                                                                        qm5 qm5Var22 = sm5.a;
                                                                        c cVar22 = new c(z, this.i, aVar, null);
                                                                        this.c = 39;
                                                                    }
                                                                } else if (!(aVar instanceof a.b) && !(aVar instanceof a.s) && !(aVar instanceof a.o) && !(aVar instanceof a.l) && !(aVar instanceof a.w) && !(aVar instanceof a.n) && !(aVar instanceof a.p) && !(aVar instanceof a.x) && !(aVar instanceof a.aa) && !(aVar instanceof a.z) && !(aVar instanceof a.d) && !(aVar instanceof a.v)) {
                                                                    throw new io6();
                                                                }
                                                                break;
                                                            } else {
                                                                TraktSyncRepository traktSyncRepository5 = contextMenuActionHandler.a;
                                                                int tmdbId4 = contentItem.getTmdbId();
                                                                this.c = 27;
                                                                obj = traktSyncRepository5.markShowWatched(tmdbId4, this);
                                                                if (obj != ck1Var) {
                                                                    zBooleanValue2 = ((Boolean) obj).booleanValue();
                                                                    continueWatchingPlaybackId3 = contentItem.getContinueWatchingPlaybackId();
                                                                    if (continueWatchingPlaybackId3 != null) {
                                                                        if (zBooleanValue2) {
                                                                            contextMenuActionHandler.d.hideShow(contentItem.getTmdbId());
                                                                            contextMenuActionHandler.b.removeFromWatchlist(contentItem.getTmdbId());
                                                                            TraktSyncRepository traktSyncRepository6 = contextMenuActionHandler.a;
                                                                            int tmdbId5 = contentItem.getTmdbId();
                                                                            this.b = zBooleanValue2;
                                                                            this.c = 29;
                                                                            if (traktSyncRepository6.removeFromWatchlistLocally(tmdbId5, false, this) != ck1Var) {
                                                                                contextMenuActionHandler.d.invalidateCache();
                                                                                PlaybackStateManager playbackStateManager4 = contextMenuActionHandler.c;
                                                                                this.b = zBooleanValue2;
                                                                                this.c = 30;
                                                                            }
                                                                        }
                                                                        z = zBooleanValue2;
                                                                        m12 m12Var222 = sc2.a;
                                                                        qm5 qm5Var222 = sm5.a;
                                                                        c cVar222 = new c(z, this.i, aVar, null);
                                                                        this.c = 39;
                                                                    } else {
                                                                        long jLongValue3 = continueWatchingPlaybackId3.longValue();
                                                                        ContinueWatchingRepository continueWatchingRepository3 = contextMenuActionHandler.d;
                                                                        this.b = zBooleanValue2;
                                                                        this.c = 28;
                                                                        obj = continueWatchingRepository3.removePlayback(jLongValue3, this);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                        break;
                                                    } else {
                                                        Integer continueWatchingSeason = contentItem.getContinueWatchingSeason();
                                                        Integer continueWatchingEpisode = contentItem.getContinueWatchingEpisode();
                                                        if (continueWatchingSeason != null && continueWatchingEpisode != null) {
                                                            TraktSyncRepository traktSyncRepository7 = contextMenuActionHandler.a;
                                                            int tmdbId6 = contentItem.getTmdbId();
                                                            int iIntValue = continueWatchingSeason.intValue();
                                                            int iIntValue2 = continueWatchingEpisode.intValue();
                                                            this.c = 24;
                                                            obj = traktSyncRepository7.markEpisodeUnwatched(tmdbId6, iIntValue, iIntValue2, this);
                                                            if (obj != ck1Var) {
                                                                zBooleanValue2 = ((Boolean) obj).booleanValue();
                                                                continueWatchingPlaybackId2 = contentItem.getContinueWatchingPlaybackId();
                                                                if (continueWatchingPlaybackId2 != null) {
                                                                    if (zBooleanValue2) {
                                                                        contextMenuActionHandler.d.invalidateCache();
                                                                        PlaybackStateManager playbackStateManager5 = contextMenuActionHandler.c;
                                                                        this.b = zBooleanValue2;
                                                                        this.c = 26;
                                                                    }
                                                                    z = zBooleanValue2;
                                                                    m12 m12Var2222 = sc2.a;
                                                                    qm5 qm5Var2222 = sm5.a;
                                                                    c cVar2222 = new c(z, this.i, aVar, null);
                                                                    this.c = 39;
                                                                } else {
                                                                    long jLongValue4 = continueWatchingPlaybackId2.longValue();
                                                                    ContinueWatchingRepository continueWatchingRepository4 = contextMenuActionHandler.d;
                                                                    this.b = zBooleanValue2;
                                                                    this.c = 25;
                                                                    obj = continueWatchingRepository4.removePlayback(jLongValue4, this);
                                                                }
                                                            }
                                                            break;
                                                        }
                                                    }
                                                } else {
                                                    Integer continueWatchingSeason2 = contentItem.getContinueWatchingSeason();
                                                    Integer continueWatchingEpisode2 = contentItem.getContinueWatchingEpisode();
                                                    if (continueWatchingSeason2 == null || continueWatchingEpisode2 == null) {
                                                        m12 m12Var22222 = sc2.a;
                                                        qm5 qm5Var22222 = sm5.a;
                                                        c cVar22222 = new c(z, this.i, aVar, null);
                                                        this.c = 39;
                                                    } else {
                                                        TraktSyncRepository traktSyncRepository8 = contextMenuActionHandler.a;
                                                        int tmdbId7 = contentItem.getTmdbId();
                                                        int iIntValue3 = continueWatchingSeason2.intValue();
                                                        int iIntValue4 = continueWatchingEpisode2.intValue();
                                                        this.c = 20;
                                                        obj = traktSyncRepository8.markEpisodeWatched(tmdbId7, iIntValue3, iIntValue4, this);
                                                        if (obj != ck1Var) {
                                                            zBooleanValue2 = ((Boolean) obj).booleanValue();
                                                            continueWatchingPlaybackId = contentItem.getContinueWatchingPlaybackId();
                                                            if (continueWatchingPlaybackId != null) {
                                                                if (zBooleanValue2) {
                                                                    contextMenuActionHandler.b.removeFromWatchlist(contentItem.getTmdbId());
                                                                    TraktSyncRepository traktSyncRepository9 = contextMenuActionHandler.a;
                                                                    int tmdbId8 = contentItem.getTmdbId();
                                                                    this.b = zBooleanValue2;
                                                                    this.c = 22;
                                                                    if (traktSyncRepository9.removeFromWatchlistLocally(tmdbId8, false, this) != ck1Var) {
                                                                        contextMenuActionHandler.d.invalidateCache();
                                                                        PlaybackStateManager playbackStateManager6 = contextMenuActionHandler.c;
                                                                        this.b = zBooleanValue2;
                                                                        this.c = 23;
                                                                    }
                                                                }
                                                                z = zBooleanValue2;
                                                                m12 m12Var222222 = sc2.a;
                                                                qm5 qm5Var222222 = sm5.a;
                                                                c cVar222222 = new c(z, this.i, aVar, null);
                                                                this.c = 39;
                                                            } else {
                                                                long jLongValue5 = continueWatchingPlaybackId.longValue();
                                                                ContinueWatchingRepository continueWatchingRepository5 = contextMenuActionHandler.d;
                                                                this.b = zBooleanValue2;
                                                                this.c = 21;
                                                                obj = continueWatchingRepository5.removePlayback(jLongValue5, this);
                                                            }
                                                        }
                                                    }
                                                    break;
                                                }
                                            } else {
                                                contentItem.getTitle();
                                                contentItem.getContinueWatchingPlaybackId();
                                                Long continueWatchingPlaybackId6 = contentItem.getContinueWatchingPlaybackId();
                                                if (continueWatchingPlaybackId6 == null) {
                                                    Log.w("ContextMenuAction", "No playbackId for '" + contentItem.getTitle() + "', cannot remove");
                                                    m12 m12Var2222222 = sc2.a;
                                                    qm5 qm5Var2222222 = sm5.a;
                                                    c cVar2222222 = new c(z, this.i, aVar, null);
                                                    this.c = 39;
                                                } else {
                                                    ContinueWatchingRepository continueWatchingRepository6 = contextMenuActionHandler.d;
                                                    long jLongValue6 = continueWatchingPlaybackId6.longValue();
                                                    this.c = 18;
                                                    obj = continueWatchingRepository6.removePlayback(jLongValue6, this);
                                                    if (obj != ck1Var) {
                                                        zBooleanValue2 = ((Boolean) obj).booleanValue();
                                                        if (zBooleanValue2) {
                                                            contextMenuActionHandler.d.invalidateCache();
                                                            PlaybackStateManager playbackStateManager7 = contextMenuActionHandler.c;
                                                            this.b = zBooleanValue2;
                                                            this.c = 19;
                                                        }
                                                        z = zBooleanValue2;
                                                        m12 m12Var22222222 = sc2.a;
                                                        qm5 qm5Var22222222 = sm5.a;
                                                        c cVar22222222 = new c(z, this.i, aVar, null);
                                                        this.c = 39;
                                                    }
                                                }
                                                break;
                                            }
                                        } else {
                                            ?? r11 = contextMenuActionHandler.a;
                                            int tmdbId9 = contentItem.getTmdbId();
                                            this.c = 16;
                                            obj = r11.removeFromWatchlist(tmdbId9, r14, this);
                                            if (obj != ck1Var) {
                                                zBooleanValue2 = ((Boolean) obj).booleanValue();
                                                if (zBooleanValue2) {
                                                    contextMenuActionHandler.b.removeFromWatchlist(contentItem.getTmdbId());
                                                    TraktSyncRepository traktSyncRepository10 = contextMenuActionHandler.a;
                                                    this.b = zBooleanValue2;
                                                    this.c = 17;
                                                }
                                                z = zBooleanValue2;
                                                m12 m12Var222222222 = sc2.a;
                                                qm5 qm5Var222222222 = sm5.a;
                                                c cVar222222222 = new c(z, this.i, aVar, null);
                                                this.c = 39;
                                            }
                                            break;
                                        }
                                    } else {
                                        ?? r112 = contextMenuActionHandler.a;
                                        int tmdbId10 = contentItem.getTmdbId();
                                        this.c = 14;
                                        obj = r112.addToWatchlist(tmdbId10, r14, this);
                                        if (obj != ck1Var) {
                                            zBooleanValue2 = ((Boolean) obj).booleanValue();
                                            if (zBooleanValue2) {
                                                contextMenuActionHandler.b.addToWatchlist(contentItem.getTmdbId());
                                                TraktSyncRepository traktSyncRepository11 = contextMenuActionHandler.a;
                                                this.b = zBooleanValue2;
                                                this.c = 15;
                                            }
                                            z = zBooleanValue2;
                                            m12 m12Var2222222222 = sc2.a;
                                            qm5 qm5Var2222222222 = sm5.a;
                                            c cVar2222222222 = new c(z, this.i, aVar, null);
                                            this.c = 39;
                                        }
                                        break;
                                    }
                                } else {
                                    ?? r113 = contextMenuActionHandler.a;
                                    int tmdbId11 = contentItem.getTmdbId();
                                    this.c = 12;
                                    obj = r113.removeFromCollection(tmdbId11, r14, this);
                                    if (obj != ck1Var) {
                                        zBooleanValue2 = ((Boolean) obj).booleanValue();
                                        if (zBooleanValue2) {
                                            contextMenuActionHandler.b.removeFromCollection(contentItem.getTmdbId());
                                            TraktSyncRepository traktSyncRepository12 = contextMenuActionHandler.a;
                                            this.b = zBooleanValue2;
                                            this.c = 13;
                                        }
                                        z = zBooleanValue2;
                                        m12 m12Var22222222222 = sc2.a;
                                        qm5 qm5Var22222222222 = sm5.a;
                                        c cVar22222222222 = new c(z, this.i, aVar, null);
                                        this.c = 39;
                                    }
                                    break;
                                }
                            } else {
                                ?? r114 = contextMenuActionHandler.a;
                                int tmdbId12 = contentItem.getTmdbId();
                                this.c = 10;
                                obj = r114.addToCollection(tmdbId12, r14, this);
                                if (obj != ck1Var) {
                                    zBooleanValue2 = ((Boolean) obj).booleanValue();
                                    if (zBooleanValue2) {
                                        contextMenuActionHandler.b.addToCollection(contentItem.getTmdbId());
                                        TraktSyncRepository traktSyncRepository13 = contextMenuActionHandler.a;
                                        this.b = zBooleanValue2;
                                        this.c = 11;
                                    }
                                    z = zBooleanValue2;
                                    m12 m12Var222222222222 = sc2.a;
                                    qm5 qm5Var222222222222 = sm5.a;
                                    c cVar222222222222 = new c(z, this.i, aVar, null);
                                    this.c = 39;
                                }
                                break;
                            }
                        } else {
                            if (r14 == 0) {
                                TraktSyncRepository traktSyncRepository14 = contextMenuActionHandler.a;
                                int tmdbId13 = contentItem.getTmdbId();
                                this.c = 7;
                                obj = traktSyncRepository14.markShowUnwatched(tmdbId13, this);
                            } else {
                                TraktSyncRepository traktSyncRepository15 = contextMenuActionHandler.a;
                                int tmdbId14 = contentItem.getTmdbId();
                                this.c = 6;
                                obj = traktSyncRepository15.markMovieUnwatched(tmdbId14, this);
                            }
                            break;
                        }
                    } else {
                        if (r14 == 0) {
                            TraktSyncRepository traktSyncRepository16 = contextMenuActionHandler.a;
                            int tmdbId15 = contentItem.getTmdbId();
                            this.a = r14;
                            this.c = 2;
                            obj = traktSyncRepository16.markShowWatched(tmdbId15, this);
                            r13 = r14;
                        } else {
                            TraktSyncRepository traktSyncRepository17 = contextMenuActionHandler.a;
                            int tmdbId16 = contentItem.getTmdbId();
                            this.a = r14;
                            this.c = 1;
                            obj = traktSyncRepository17.markMovieWatched(tmdbId16, this);
                            r1 = r14;
                        }
                        break;
                    }
                    return ck1Var;
                }
                z = true;
                m12 m12Var2222222222222 = sc2.a;
                qm5 qm5Var2222222222222 = sm5.a;
                c cVar2222222222222 = new c(z, this.i, aVar, null);
                this.c = 39;
                break;
            case 1:
                int i2 = this.a;
                s38.b(obj);
                r1 = i2;
                zBooleanValue = ((Boolean) obj).booleanValue();
                r12 = r1;
                ?? r9 = r12;
                zBooleanValue2 = zBooleanValue;
                if (zBooleanValue2) {
                    contextMenuActionHandler.b.markWatched(contentItem.getTmdbId());
                    contextMenuActionHandler.b.removeFromWatchlist(contentItem.getTmdbId());
                    TraktSyncRepository traktSyncRepository18 = contextMenuActionHandler.a;
                    int tmdbId17 = contentItem.getTmdbId();
                    z = r9 != 0;
                    this.b = zBooleanValue2;
                    this.c = 3;
                    if (traktSyncRepository18.removeFromWatchlistLocally(tmdbId17, z, this) != ck1Var) {
                        traktSyncRepository = contextMenuActionHandler.a;
                        this.b = zBooleanValue2;
                        this.c = 4;
                        if (traktSyncRepository.syncHistoryOnly(this) != ck1Var) {
                            PlaybackStateManager playbackStateManager8 = contextMenuActionHandler.c;
                            this.b = zBooleanValue2;
                            this.c = 5;
                        }
                        break;
                    }
                    return ck1Var;
                }
                z = zBooleanValue2;
                m12 m12Var22222222222222 = sc2.a;
                qm5 qm5Var22222222222222 = sm5.a;
                c cVar22222222222222 = new c(z, this.i, aVar, null);
                this.c = 39;
                break;
            case 2:
                int i3 = this.a;
                s38.b(obj);
                r13 = i3;
                zBooleanValue = ((Boolean) obj).booleanValue();
                r12 = r13;
                ?? r92 = r12;
                zBooleanValue2 = zBooleanValue;
                if (zBooleanValue2) {
                }
                z = zBooleanValue2;
                m12 m12Var222222222222222 = sc2.a;
                qm5 qm5Var222222222222222 = sm5.a;
                c cVar222222222222222 = new c(z, this.i, aVar, null);
                this.c = 39;
                break;
            case 3:
                zBooleanValue2 = this.b;
                s38.b(obj);
                traktSyncRepository = contextMenuActionHandler.a;
                this.b = zBooleanValue2;
                this.c = 4;
                if (traktSyncRepository.syncHistoryOnly(this) != ck1Var) {
                }
                return ck1Var;
            case 4:
                zBooleanValue2 = this.b;
                s38.b(obj);
                PlaybackStateManager playbackStateManager82 = contextMenuActionHandler.c;
                this.b = zBooleanValue2;
                this.c = 5;
                break;
            case 5:
            case 9:
            case 11:
            case 13:
            case 15:
            case 17:
            case 19:
            case 23:
            case 26:
            case 30:
            case 33:
            case TsExtractor.TS_STREAM_TYPE_H265 /* 36 */:
            case FlacConstants.STREAM_INFO_BLOCK_SIZE /* 38 */:
                zBooleanValue2 = this.b;
                s38.b(obj);
                z = zBooleanValue2;
                m12 m12Var2222222222222222 = sc2.a;
                qm5 qm5Var2222222222222222 = sm5.a;
                c cVar2222222222222222 = new c(z, this.i, aVar, null);
                this.c = 39;
                break;
            case 6:
                s38.b(obj);
                zBooleanValue3 = ((Boolean) obj).booleanValue();
                if (!zBooleanValue3) {
                    contextMenuActionHandler.b.markUnwatched(contentItem.getTmdbId());
                    TraktSyncRepository traktSyncRepository19 = contextMenuActionHandler.a;
                    this.b = zBooleanValue3;
                    this.c = 8;
                    if (traktSyncRepository19.syncHistoryOnly(this) != ck1Var) {
                        zBooleanValue2 = zBooleanValue3;
                        PlaybackStateManager playbackStateManager9 = contextMenuActionHandler.c;
                        this.b = zBooleanValue2;
                        this.c = 9;
                        break;
                    }
                    return ck1Var;
                }
                z = zBooleanValue3;
                m12 m12Var22222222222222222 = sc2.a;
                qm5 qm5Var22222222222222222 = sm5.a;
                c cVar22222222222222222 = new c(z, this.i, aVar, null);
                this.c = 39;
                break;
                break;
            case 7:
                s38.b(obj);
                zBooleanValue3 = ((Boolean) obj).booleanValue();
                if (!zBooleanValue3) {
                }
                break;
            case 8:
                zBooleanValue2 = this.b;
                s38.b(obj);
                PlaybackStateManager playbackStateManager92 = contextMenuActionHandler.c;
                this.b = zBooleanValue2;
                this.c = 9;
                break;
            case 10:
                s38.b(obj);
                zBooleanValue2 = ((Boolean) obj).booleanValue();
                if (zBooleanValue2) {
                }
                z = zBooleanValue2;
                m12 m12Var222222222222222222 = sc2.a;
                qm5 qm5Var222222222222222222 = sm5.a;
                c cVar222222222222222222 = new c(z, this.i, aVar, null);
                this.c = 39;
                break;
            case 12:
                s38.b(obj);
                zBooleanValue2 = ((Boolean) obj).booleanValue();
                if (zBooleanValue2) {
                }
                z = zBooleanValue2;
                m12 m12Var2222222222222222222 = sc2.a;
                qm5 qm5Var2222222222222222222 = sm5.a;
                c cVar2222222222222222222 = new c(z, this.i, aVar, null);
                this.c = 39;
                break;
            case 14:
                s38.b(obj);
                zBooleanValue2 = ((Boolean) obj).booleanValue();
                if (zBooleanValue2) {
                }
                z = zBooleanValue2;
                m12 m12Var22222222222222222222 = sc2.a;
                qm5 qm5Var22222222222222222222 = sm5.a;
                c cVar22222222222222222222 = new c(z, this.i, aVar, null);
                this.c = 39;
                break;
            case 16:
                s38.b(obj);
                zBooleanValue2 = ((Boolean) obj).booleanValue();
                if (zBooleanValue2) {
                }
                z = zBooleanValue2;
                m12 m12Var222222222222222222222 = sc2.a;
                qm5 qm5Var222222222222222222222 = sm5.a;
                c cVar222222222222222222222 = new c(z, this.i, aVar, null);
                this.c = 39;
                break;
            case 18:
                s38.b(obj);
                zBooleanValue2 = ((Boolean) obj).booleanValue();
                if (zBooleanValue2) {
                }
                z = zBooleanValue2;
                m12 m12Var2222222222222222222222 = sc2.a;
                qm5 qm5Var2222222222222222222222 = sm5.a;
                c cVar2222222222222222222222 = new c(z, this.i, aVar, null);
                this.c = 39;
                break;
            case 20:
                s38.b(obj);
                zBooleanValue2 = ((Boolean) obj).booleanValue();
                continueWatchingPlaybackId = contentItem.getContinueWatchingPlaybackId();
                if (continueWatchingPlaybackId != null) {
                }
                return ck1Var;
            case 21:
                zBooleanValue2 = this.b;
                s38.b(obj);
                Boxing.boxBoolean(((Boolean) obj).booleanValue());
                if (zBooleanValue2) {
                }
                z = zBooleanValue2;
                m12 m12Var22222222222222222222222 = sc2.a;
                qm5 qm5Var22222222222222222222222 = sm5.a;
                c cVar22222222222222222222222 = new c(z, this.i, aVar, null);
                this.c = 39;
                break;
            case 22:
                zBooleanValue2 = this.b;
                s38.b(obj);
                contextMenuActionHandler.d.invalidateCache();
                PlaybackStateManager playbackStateManager62 = contextMenuActionHandler.c;
                this.b = zBooleanValue2;
                this.c = 23;
                break;
            case 24:
                s38.b(obj);
                zBooleanValue2 = ((Boolean) obj).booleanValue();
                continueWatchingPlaybackId2 = contentItem.getContinueWatchingPlaybackId();
                if (continueWatchingPlaybackId2 != null) {
                }
                return ck1Var;
            case 25:
                zBooleanValue2 = this.b;
                s38.b(obj);
                Boxing.boxBoolean(((Boolean) obj).booleanValue());
                if (zBooleanValue2) {
                }
                z = zBooleanValue2;
                m12 m12Var222222222222222222222222 = sc2.a;
                qm5 qm5Var222222222222222222222222 = sm5.a;
                c cVar222222222222222222222222 = new c(z, this.i, aVar, null);
                this.c = 39;
                break;
            case 27:
                s38.b(obj);
                zBooleanValue2 = ((Boolean) obj).booleanValue();
                continueWatchingPlaybackId3 = contentItem.getContinueWatchingPlaybackId();
                if (continueWatchingPlaybackId3 != null) {
                }
                return ck1Var;
            case 28:
                zBooleanValue2 = this.b;
                s38.b(obj);
                Boxing.boxBoolean(((Boolean) obj).booleanValue());
                if (zBooleanValue2) {
                }
                z = zBooleanValue2;
                m12 m12Var2222222222222222222222222 = sc2.a;
                qm5 qm5Var2222222222222222222222222 = sm5.a;
                c cVar2222222222222222222222222 = new c(z, this.i, aVar, null);
                this.c = 39;
                break;
            case 29:
                zBooleanValue2 = this.b;
                s38.b(obj);
                contextMenuActionHandler.d.invalidateCache();
                PlaybackStateManager playbackStateManager42 = contextMenuActionHandler.c;
                this.b = zBooleanValue2;
                this.c = 30;
                break;
            case 31:
                s38.b(obj);
                zBooleanValue2 = ((Boolean) obj).booleanValue();
                continueWatchingPlaybackId4 = contentItem.getContinueWatchingPlaybackId();
                if (continueWatchingPlaybackId4 != null) {
                }
                return ck1Var;
            case 32:
                zBooleanValue2 = this.b;
                s38.b(obj);
                Boxing.boxBoolean(((Boolean) obj).booleanValue());
                if (zBooleanValue2) {
                }
                z = zBooleanValue2;
                m12 m12Var22222222222222222222222222 = sc2.a;
                qm5 qm5Var22222222222222222222222222 = sm5.a;
                c cVar22222222222222222222222222 = new c(z, this.i, aVar, null);
                this.c = 39;
                break;
            case 34:
                s38.b(obj);
                zBooleanValue2 = ((Boolean) obj).booleanValue();
                continueWatchingPlaybackId5 = contentItem.getContinueWatchingPlaybackId();
                if (continueWatchingPlaybackId5 != null) {
                }
                return ck1Var;
            case 35:
                zBooleanValue2 = this.b;
                s38.b(obj);
                Boxing.boxBoolean(((Boolean) obj).booleanValue());
                if (zBooleanValue2) {
                }
                z = zBooleanValue2;
                m12 m12Var222222222222222222222222222 = sc2.a;
                qm5 qm5Var222222222222222222222222222 = sm5.a;
                c cVar222222222222222222222222222 = new c(z, this.i, aVar, null);
                this.c = 39;
                break;
            case 37:
                s38.b(obj);
                zBooleanValue2 = ((Boolean) obj).booleanValue();
                if (zBooleanValue2) {
                }
                z = zBooleanValue2;
                m12 m12Var2222222222222222222222222222 = sc2.a;
                qm5 qm5Var2222222222222222222222222222 = sm5.a;
                c cVar2222222222222222222222222222 = new c(z, this.i, aVar, null);
                this.c = 39;
                break;
            case NalUnitUtil.H265_NAL_UNIT_TYPE_PREFIX_SEI /* 39 */:
                s38.b(obj);
                return e6a.a;
            default:
                throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
        }
    }
}
