package com.strmr.ps.data.repository;

import androidx.media3.container.NalUnitUtil;
import androidx.media3.exoplayer.rtsp.SessionDescription;
import androidx.media3.extractor.text.ttml.TtmlNode;
import androidx.media3.extractor.ts.TsExtractor;
import com.strmr.ps.data.local.dao.PlaybackProgressDao;
import com.strmr.ps.data.local.entity.PlaybackProgress;
import com.strmr.ps.data.model.ContentItem;
import defpackage.ak1;
import defpackage.ck1;
import defpackage.cr4;
import defpackage.e6a;
import defpackage.gr3;
import defpackage.j43;
import defpackage.kp6;
import defpackage.m02;
import defpackage.m12;
import defpackage.pq6;
import defpackage.s38;
import defpackage.sc2;
import defpackage.wj0;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
import kotlin.Metadata;
import kotlin.coroutines.Continuation;
import kotlin.coroutines.jvm.internal.DebugMetadata;
import kotlin.coroutines.jvm.internal.SuspendLambda;
import okhttp3.internal.ws.WebSocketProtocol;

/* JADX INFO: loaded from: classes3.dex */
@Singleton
@Metadata(d1 = {"\u0000V\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b\u0002\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u000e\n\u0002\b\u0004\n\u0002\u0018\u0002\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010 \n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\u000e\b\u0007\u0018\u00002\u00020\u0001B\u0011\b\u0007\u0012\u0006\u0010\u0003\u001a\u00020\u0002¢\u0006\u0004\b\u0004\u0010\u0005Jp\u0010\u0014\u001a\u00020\u00132\u0006\u0010\u0007\u001a\u00020\u00062\u0006\u0010\t\u001a\u00020\b2\u0006\u0010\n\u001a\u00020\b2\n\b\u0002\u0010\f\u001a\u0004\u0018\u00010\u000b2\n\b\u0002\u0010\r\u001a\u0004\u0018\u00010\u000b2\n\b\u0002\u0010\u000f\u001a\u0004\u0018\u00010\u000e2\n\b\u0002\u0010\u0010\u001a\u0004\u0018\u00010\u000e2\n\b\u0002\u0010\u0011\u001a\u0004\u0018\u00010\u000e2\n\b\u0002\u0010\u0012\u001a\u0004\u0018\u00010\u000eH\u0086@¢\u0006\u0004\b\u0014\u0010\u0015J\u001a\u0010\u0018\u001a\u0004\u0018\u00010\u00172\u0006\u0010\u0016\u001a\u00020\u000bH\u0086@¢\u0006\u0004\b\u0018\u0010\u0019J*\u0010\u001b\u001a\u0004\u0018\u00010\u00172\u0006\u0010\u001a\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\u000b2\u0006\u0010\r\u001a\u00020\u000bH\u0086@¢\u0006\u0004\b\u001b\u0010\u001cJ\u001e\u0010\u001e\u001a\b\u0012\u0004\u0012\u00020\u00170\u001d2\u0006\u0010\u001a\u001a\u00020\u000bH\u0086@¢\u0006\u0004\b\u001e\u0010\u0019J#\u0010!\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u00020\u00170\u001d0 2\b\b\u0002\u0010\u001f\u001a\u00020\u000b¢\u0006\u0004\b!\u0010\"J \u0010#\u001a\b\u0012\u0004\u0012\u00020\u00170\u001d2\b\b\u0002\u0010\u001f\u001a\u00020\u000bH\u0086@¢\u0006\u0004\b#\u0010\u0019JB\u0010'\u001a\u00020\u00132\u0006\u0010\u0016\u001a\u00020\u000b2\u0006\u0010$\u001a\u00020\u000e2\n\b\u0002\u0010\f\u001a\u0004\u0018\u00010\u000b2\n\b\u0002\u0010\r\u001a\u0004\u0018\u00010\u000b2\b\b\u0002\u0010&\u001a\u00020%H\u0086@¢\u0006\u0004\b'\u0010(J\u0018\u0010*\u001a\u00020\u00132\u0006\u0010)\u001a\u00020\u000eH\u0086@¢\u0006\u0004\b*\u0010+J\u0016\u0010,\u001a\b\u0012\u0004\u0012\u00020\u00170\u001dH\u0086@¢\u0006\u0004\b,\u0010-J8\u0010.\u001a\u00020\u00132\u0006\u0010\u0016\u001a\u00020\u000b2\u0006\u0010$\u001a\u00020\u000e2\n\b\u0002\u0010\f\u001a\u0004\u0018\u00010\u000b2\n\b\u0002\u0010\r\u001a\u0004\u0018\u00010\u000bH\u0086@¢\u0006\u0004\b.\u0010/J\u001a\u00100\u001a\u0004\u0018\u00010\u00172\u0006\u0010\u001a\u001a\u00020\u000bH\u0086@¢\u0006\u0004\b0\u0010\u0019J\u0010\u00101\u001a\u00020\u0013H\u0086@¢\u0006\u0004\b1\u0010-R\u0014\u0010\u0003\u001a\u00020\u00028\u0002X\u0082\u0004¢\u0006\u0006\n\u0004\b\u0003\u00102¨\u00063"}, d2 = {"Lcom/strmr/ps/data/repository/PlaybackProgressRepository;", "", "Lcom/strmr/ps/data/local/dao/PlaybackProgressDao;", "playbackProgressDao", "<init>", "(Lcom/strmr/ps/data/local/dao/PlaybackProgressDao;)V", "Lcom/strmr/ps/data/model/ContentItem;", "contentItem", "", "positionMs", "durationMs", "", "season", PlaybackProgress.TYPE_EPISODE, "", "showTitle", "sourceInfoHash", "sourceScraperId", "sourceBingeGroup", "Le6a;", "saveProgress", "(Lcom/strmr/ps/data/model/ContentItem;JJLjava/lang/Integer;Ljava/lang/Integer;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "tmdbId", "Lcom/strmr/ps/data/local/entity/PlaybackProgress;", "getMovieProgress", "(ILkotlin/coroutines/Continuation;)Ljava/lang/Object;", "showTmdbId", "getEpisodeProgress", "(IIILkotlin/coroutines/Continuation;)Ljava/lang/Object;", "", "getShowProgress", "limit", "Lj43;", "getContinueWatchingFlow", "(I)Lj43;", "getContinueWatching", SessionDescription.ATTR_TYPE, "", "synced", "markWatched", "(ILjava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;ZLkotlin/coroutines/Continuation;)Ljava/lang/Object;", TtmlNode.ATTR_ID, "markSynced", "(Ljava/lang/String;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "getUnsyncedProgress", "(Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "deleteProgress", "(ILjava/lang/String;Ljava/lang/Integer;Ljava/lang/Integer;Lkotlin/coroutines/Continuation;)Ljava/lang/Object;", "getLatestEpisodeFingerprint", "clearAll", "Lcom/strmr/ps/data/local/dao/PlaybackProgressDao;", "app_sideloadRelease"}, k = 1, mv = {2, 0, 0}, xi = NalUnitUtil.H265_NAL_UNIT_TYPE_UNSPECIFIED)
public final class PlaybackProgressRepository {

    @kp6
    private final PlaybackProgressDao playbackProgressDao;

    /* JADX INFO: renamed from: com.strmr.ps.data.repository.PlaybackProgressRepository$clearAll$2, reason: invalid class name */
    @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.data.repository.PlaybackProgressRepository$clearAll$2", f = "PlaybackProgressRepository.kt", i = {}, l = {169}, m = "invokeSuspend", n = {}, s = {})
    public static final class AnonymousClass2 extends SuspendLambda implements gr3<ak1, Continuation<? super e6a>, Object> {
        int label;

        public AnonymousClass2(Continuation<? super AnonymousClass2> continuation) {
            super(2, continuation);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Continuation<e6a> create(Object obj, Continuation<?> continuation) {
            return PlaybackProgressRepository.this.new AnonymousClass2(continuation);
        }

        @Override // defpackage.gr3
        public final Object invoke(ak1 ak1Var, Continuation<? super e6a> continuation) {
            return ((AnonymousClass2) create(ak1Var, continuation)).invokeSuspend(e6a.a);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) {
            ck1 ck1Var = ck1.a;
            int i = this.label;
            if (i == 0) {
                s38.b(obj);
                PlaybackProgressDao playbackProgressDao = PlaybackProgressRepository.this.playbackProgressDao;
                this.label = 1;
                if (playbackProgressDao.clearAll(this) == ck1Var) {
                    return ck1Var;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                s38.b(obj);
            }
            return e6a.a;
        }
    }

    /* JADX INFO: renamed from: com.strmr.ps.data.repository.PlaybackProgressRepository$deleteProgress$2, reason: invalid class name and case insensitive filesystem */
    @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.data.repository.PlaybackProgressRepository$deleteProgress$2", f = "PlaybackProgressRepository.kt", i = {}, l = {154}, m = "invokeSuspend", n = {}, s = {})
    public static final class C03332 extends SuspendLambda implements gr3<ak1, Continuation<? super e6a>, Object> {
        final /* synthetic */ Integer $episode;
        final /* synthetic */ Integer $season;
        final /* synthetic */ int $tmdbId;
        final /* synthetic */ String $type;
        int label;
        final /* synthetic */ PlaybackProgressRepository this$0;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C03332(int i, String str, Integer num, Integer num2, PlaybackProgressRepository playbackProgressRepository, Continuation<? super C03332> continuation) {
            super(2, continuation);
            this.$tmdbId = i;
            this.$type = str;
            this.$season = num;
            this.$episode = num2;
            this.this$0 = playbackProgressRepository;
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Continuation<e6a> create(Object obj, Continuation<?> continuation) {
            return new C03332(this.$tmdbId, this.$type, this.$season, this.$episode, this.this$0, continuation);
        }

        @Override // defpackage.gr3
        public final Object invoke(ak1 ak1Var, Continuation<? super e6a> continuation) {
            return ((C03332) create(ak1Var, continuation)).invokeSuspend(e6a.a);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) {
            ck1 ck1Var = ck1.a;
            int i = this.label;
            if (i == 0) {
                s38.b(obj);
                String strCreateId = PlaybackProgress.INSTANCE.createId(this.$tmdbId, this.$type, this.$season, this.$episode);
                PlaybackProgressDao playbackProgressDao = this.this$0.playbackProgressDao;
                this.label = 1;
                if (playbackProgressDao.deleteProgress(strCreateId, this) == ck1Var) {
                    return ck1Var;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                s38.b(obj);
            }
            return e6a.a;
        }
    }

    /* JADX INFO: renamed from: com.strmr.ps.data.repository.PlaybackProgressRepository$getContinueWatching$2, reason: invalid class name and case insensitive filesystem */
    @Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00020\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0003\u0010\u0004"}, d2 = {"Lak1;", "", "Lcom/strmr/ps/data/local/entity/PlaybackProgress;", "<anonymous>", "(Lak1;)Ljava/util/List;"}, k = 3, mv = {2, 0, 0})
    @DebugMetadata(c = "com.strmr.ps.data.repository.PlaybackProgressRepository$getContinueWatching$2", f = "PlaybackProgressRepository.kt", i = {}, l = {112}, m = "invokeSuspend", n = {}, s = {})
    public static final class C03342 extends SuspendLambda implements gr3<ak1, Continuation<? super List<? extends PlaybackProgress>>, Object> {
        final /* synthetic */ int $limit;
        int label;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C03342(int i, Continuation<? super C03342> continuation) {
            super(2, continuation);
            this.$limit = i;
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Continuation<e6a> create(Object obj, Continuation<?> continuation) {
            return PlaybackProgressRepository.this.new C03342(this.$limit, continuation);
        }

        @Override // defpackage.gr3
        public final Object invoke(ak1 ak1Var, Continuation<? super List<PlaybackProgress>> continuation) {
            return ((C03342) create(ak1Var, continuation)).invokeSuspend(e6a.a);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) {
            ck1 ck1Var = ck1.a;
            int i = this.label;
            if (i != 0) {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                s38.b(obj);
                return obj;
            }
            s38.b(obj);
            PlaybackProgressDao playbackProgressDao = PlaybackProgressRepository.this.playbackProgressDao;
            int i2 = this.$limit;
            this.label = 1;
            Object continueWatching = playbackProgressDao.getContinueWatching(i2, this);
            return continueWatching == ck1Var ? ck1Var : continueWatching;
        }
    }

    /* JADX INFO: renamed from: com.strmr.ps.data.repository.PlaybackProgressRepository$getEpisodeProgress$2, reason: invalid class name and case insensitive filesystem */
    @Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0002\u001a\u0004\u0018\u00010\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0002\u0010\u0003"}, d2 = {"Lak1;", "Lcom/strmr/ps/data/local/entity/PlaybackProgress;", "<anonymous>", "(Lak1;)Lcom/strmr/ps/data/local/entity/PlaybackProgress;"}, k = 3, mv = {2, 0, 0})
    @DebugMetadata(c = "com.strmr.ps.data.repository.PlaybackProgressRepository$getEpisodeProgress$2", f = "PlaybackProgressRepository.kt", i = {}, l = {TsExtractor.TS_STREAM_TYPE_DVBSUBS}, m = "invokeSuspend", n = {}, s = {})
    public static final class C03352 extends SuspendLambda implements gr3<ak1, Continuation<? super PlaybackProgress>, Object> {
        final /* synthetic */ int $episode;
        final /* synthetic */ int $season;
        final /* synthetic */ int $showTmdbId;
        int label;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C03352(int i, int i2, int i3, Continuation<? super C03352> continuation) {
            super(2, continuation);
            this.$showTmdbId = i;
            this.$season = i2;
            this.$episode = i3;
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Continuation<e6a> create(Object obj, Continuation<?> continuation) {
            return PlaybackProgressRepository.this.new C03352(this.$showTmdbId, this.$season, this.$episode, continuation);
        }

        @Override // defpackage.gr3
        public final Object invoke(ak1 ak1Var, Continuation<? super PlaybackProgress> continuation) {
            return ((C03352) create(ak1Var, continuation)).invokeSuspend(e6a.a);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) {
            ck1 ck1Var = ck1.a;
            int i = this.label;
            if (i != 0) {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                s38.b(obj);
                return obj;
            }
            s38.b(obj);
            PlaybackProgressDao playbackProgressDao = PlaybackProgressRepository.this.playbackProgressDao;
            int i2 = this.$showTmdbId;
            int i3 = this.$season;
            int i4 = this.$episode;
            this.label = 1;
            Object episodeProgress = playbackProgressDao.getEpisodeProgress(i2, i3, i4, this);
            return episodeProgress == ck1Var ? ck1Var : episodeProgress;
        }
    }

    /* JADX INFO: renamed from: com.strmr.ps.data.repository.PlaybackProgressRepository$getLatestEpisodeFingerprint$2, reason: invalid class name and case insensitive filesystem */
    @Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0002\u001a\u0004\u0018\u00010\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0002\u0010\u0003"}, d2 = {"Lak1;", "Lcom/strmr/ps/data/local/entity/PlaybackProgress;", "<anonymous>", "(Lak1;)Lcom/strmr/ps/data/local/entity/PlaybackProgress;"}, k = 3, mv = {2, 0, 0})
    @DebugMetadata(c = "com.strmr.ps.data.repository.PlaybackProgressRepository$getLatestEpisodeFingerprint$2", f = "PlaybackProgressRepository.kt", i = {}, l = {162}, m = "invokeSuspend", n = {}, s = {})
    public static final class C03362 extends SuspendLambda implements gr3<ak1, Continuation<? super PlaybackProgress>, Object> {
        final /* synthetic */ int $showTmdbId;
        int label;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C03362(int i, Continuation<? super C03362> continuation) {
            super(2, continuation);
            this.$showTmdbId = i;
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Continuation<e6a> create(Object obj, Continuation<?> continuation) {
            return PlaybackProgressRepository.this.new C03362(this.$showTmdbId, continuation);
        }

        @Override // defpackage.gr3
        public final Object invoke(ak1 ak1Var, Continuation<? super PlaybackProgress> continuation) {
            return ((C03362) create(ak1Var, continuation)).invokeSuspend(e6a.a);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) {
            ck1 ck1Var = ck1.a;
            int i = this.label;
            if (i != 0) {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                s38.b(obj);
                return obj;
            }
            s38.b(obj);
            PlaybackProgressDao playbackProgressDao = PlaybackProgressRepository.this.playbackProgressDao;
            int i2 = this.$showTmdbId;
            this.label = 1;
            Object latestEpisodeFingerprint = playbackProgressDao.getLatestEpisodeFingerprint(i2, this);
            return latestEpisodeFingerprint == ck1Var ? ck1Var : latestEpisodeFingerprint;
        }
    }

    /* JADX INFO: renamed from: com.strmr.ps.data.repository.PlaybackProgressRepository$getMovieProgress$2, reason: invalid class name and case insensitive filesystem */
    @Metadata(d1 = {"\u0000\f\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0002\u001a\u0004\u0018\u00010\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0002\u0010\u0003"}, d2 = {"Lak1;", "Lcom/strmr/ps/data/local/entity/PlaybackProgress;", "<anonymous>", "(Lak1;)Lcom/strmr/ps/data/local/entity/PlaybackProgress;"}, k = 3, mv = {2, 0, 0})
    @DebugMetadata(c = "com.strmr.ps.data.repository.PlaybackProgressRepository$getMovieProgress$2", f = "PlaybackProgressRepository.kt", i = {}, l = {81}, m = "invokeSuspend", n = {}, s = {})
    public static final class C03372 extends SuspendLambda implements gr3<ak1, Continuation<? super PlaybackProgress>, Object> {
        final /* synthetic */ int $tmdbId;
        int label;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C03372(int i, Continuation<? super C03372> continuation) {
            super(2, continuation);
            this.$tmdbId = i;
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Continuation<e6a> create(Object obj, Continuation<?> continuation) {
            return PlaybackProgressRepository.this.new C03372(this.$tmdbId, continuation);
        }

        @Override // defpackage.gr3
        public final Object invoke(ak1 ak1Var, Continuation<? super PlaybackProgress> continuation) {
            return ((C03372) create(ak1Var, continuation)).invokeSuspend(e6a.a);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) {
            ck1 ck1Var = ck1.a;
            int i = this.label;
            if (i != 0) {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                s38.b(obj);
                return obj;
            }
            s38.b(obj);
            PlaybackProgressDao playbackProgressDao = PlaybackProgressRepository.this.playbackProgressDao;
            int i2 = this.$tmdbId;
            this.label = 1;
            Object movieProgress = playbackProgressDao.getMovieProgress(i2, this);
            return movieProgress == ck1Var ? ck1Var : movieProgress;
        }
    }

    /* JADX INFO: renamed from: com.strmr.ps.data.repository.PlaybackProgressRepository$getShowProgress$2, reason: invalid class name and case insensitive filesystem */
    @Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00020\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0003\u0010\u0004"}, d2 = {"Lak1;", "", "Lcom/strmr/ps/data/local/entity/PlaybackProgress;", "<anonymous>", "(Lak1;)Ljava/util/List;"}, k = 3, mv = {2, 0, 0})
    @DebugMetadata(c = "com.strmr.ps.data.repository.PlaybackProgressRepository$getShowProgress$2", f = "PlaybackProgressRepository.kt", i = {}, l = {97}, m = "invokeSuspend", n = {}, s = {})
    public static final class C03382 extends SuspendLambda implements gr3<ak1, Continuation<? super List<? extends PlaybackProgress>>, Object> {
        final /* synthetic */ int $showTmdbId;
        int label;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C03382(int i, Continuation<? super C03382> continuation) {
            super(2, continuation);
            this.$showTmdbId = i;
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Continuation<e6a> create(Object obj, Continuation<?> continuation) {
            return PlaybackProgressRepository.this.new C03382(this.$showTmdbId, continuation);
        }

        @Override // defpackage.gr3
        public final Object invoke(ak1 ak1Var, Continuation<? super List<PlaybackProgress>> continuation) {
            return ((C03382) create(ak1Var, continuation)).invokeSuspend(e6a.a);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) {
            ck1 ck1Var = ck1.a;
            int i = this.label;
            if (i != 0) {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                s38.b(obj);
                return obj;
            }
            s38.b(obj);
            PlaybackProgressDao playbackProgressDao = PlaybackProgressRepository.this.playbackProgressDao;
            int i2 = this.$showTmdbId;
            this.label = 1;
            Object showProgress = playbackProgressDao.getShowProgress(i2, this);
            return showProgress == ck1Var ? ck1Var : showProgress;
        }
    }

    /* JADX INFO: renamed from: com.strmr.ps.data.repository.PlaybackProgressRepository$getUnsyncedProgress$2, reason: invalid class name and case insensitive filesystem */
    @Metadata(d1 = {"\u0000\u0010\n\u0002\u0018\u0002\n\u0002\u0010 \n\u0002\u0018\u0002\n\u0002\b\u0002\u0010\u0003\u001a\b\u0012\u0004\u0012\u00020\u00020\u0001*\u00020\u0000H\n¢\u0006\u0004\b\u0003\u0010\u0004"}, d2 = {"Lak1;", "", "Lcom/strmr/ps/data/local/entity/PlaybackProgress;", "<anonymous>", "(Lak1;)Ljava/util/List;"}, k = 3, mv = {2, 0, 0})
    @DebugMetadata(c = "com.strmr.ps.data.repository.PlaybackProgressRepository$getUnsyncedProgress$2", f = "PlaybackProgressRepository.kt", i = {}, l = {141}, m = "invokeSuspend", n = {}, s = {})
    public static final class C03392 extends SuspendLambda implements gr3<ak1, Continuation<? super List<? extends PlaybackProgress>>, Object> {
        int label;

        public C03392(Continuation<? super C03392> continuation) {
            super(2, continuation);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Continuation<e6a> create(Object obj, Continuation<?> continuation) {
            return PlaybackProgressRepository.this.new C03392(continuation);
        }

        @Override // defpackage.gr3
        public final Object invoke(ak1 ak1Var, Continuation<? super List<PlaybackProgress>> continuation) {
            return ((C03392) create(ak1Var, continuation)).invokeSuspend(e6a.a);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) {
            ck1 ck1Var = ck1.a;
            int i = this.label;
            if (i != 0) {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                s38.b(obj);
                return obj;
            }
            s38.b(obj);
            PlaybackProgressDao playbackProgressDao = PlaybackProgressRepository.this.playbackProgressDao;
            this.label = 1;
            Object unsyncedProgress = playbackProgressDao.getUnsyncedProgress(this);
            return unsyncedProgress == ck1Var ? ck1Var : unsyncedProgress;
        }
    }

    /* JADX INFO: renamed from: com.strmr.ps.data.repository.PlaybackProgressRepository$markSynced$2, reason: invalid class name and case insensitive filesystem */
    @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.data.repository.PlaybackProgressRepository$markSynced$2", f = "PlaybackProgressRepository.kt", i = {}, l = {133}, m = "invokeSuspend", n = {}, s = {})
    public static final class C03402 extends SuspendLambda implements gr3<ak1, Continuation<? super e6a>, Object> {
        final /* synthetic */ String $id;
        int label;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C03402(String str, Continuation<? super C03402> continuation) {
            super(2, continuation);
            this.$id = str;
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Continuation<e6a> create(Object obj, Continuation<?> continuation) {
            return PlaybackProgressRepository.this.new C03402(this.$id, continuation);
        }

        @Override // defpackage.gr3
        public final Object invoke(ak1 ak1Var, Continuation<? super e6a> continuation) {
            return ((C03402) create(ak1Var, continuation)).invokeSuspend(e6a.a);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) {
            ck1 ck1Var = ck1.a;
            int i = this.label;
            if (i == 0) {
                s38.b(obj);
                PlaybackProgressDao playbackProgressDao = PlaybackProgressRepository.this.playbackProgressDao;
                String str = this.$id;
                this.label = 1;
                if (playbackProgressDao.markSynced(str, this) == ck1Var) {
                    return ck1Var;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                s38.b(obj);
            }
            return e6a.a;
        }
    }

    /* JADX INFO: renamed from: com.strmr.ps.data.repository.PlaybackProgressRepository$markWatched$2, reason: invalid class name and case insensitive filesystem */
    @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.data.repository.PlaybackProgressRepository$markWatched$2", f = "PlaybackProgressRepository.kt", i = {}, l = {WebSocketProtocol.PAYLOAD_SHORT}, m = "invokeSuspend", n = {}, s = {})
    public static final class C03412 extends SuspendLambda implements gr3<ak1, Continuation<? super e6a>, Object> {
        final /* synthetic */ Integer $episode;
        final /* synthetic */ Integer $season;
        final /* synthetic */ boolean $synced;
        final /* synthetic */ int $tmdbId;
        final /* synthetic */ String $type;
        int label;
        final /* synthetic */ PlaybackProgressRepository this$0;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C03412(int i, String str, Integer num, Integer num2, PlaybackProgressRepository playbackProgressRepository, boolean z, Continuation<? super C03412> continuation) {
            super(2, continuation);
            this.$tmdbId = i;
            this.$type = str;
            this.$season = num;
            this.$episode = num2;
            this.this$0 = playbackProgressRepository;
            this.$synced = z;
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Continuation<e6a> create(Object obj, Continuation<?> continuation) {
            return new C03412(this.$tmdbId, this.$type, this.$season, this.$episode, this.this$0, this.$synced, continuation);
        }

        @Override // defpackage.gr3
        public final Object invoke(ak1 ak1Var, Continuation<? super e6a> continuation) {
            return ((C03412) create(ak1Var, continuation)).invokeSuspend(e6a.a);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) {
            ck1 ck1Var = ck1.a;
            int i = this.label;
            if (i == 0) {
                s38.b(obj);
                String strCreateId = PlaybackProgress.INSTANCE.createId(this.$tmdbId, this.$type, this.$season, this.$episode);
                PlaybackProgressDao playbackProgressDao = this.this$0.playbackProgressDao;
                boolean z = this.$synced;
                this.label = 1;
                if (playbackProgressDao.markWatched(strCreateId, z, this) == ck1Var) {
                    return ck1Var;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                s38.b(obj);
            }
            return e6a.a;
        }
    }

    /* JADX INFO: renamed from: com.strmr.ps.data.repository.PlaybackProgressRepository$saveProgress$2, reason: invalid class name and case insensitive filesystem */
    @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.data.repository.PlaybackProgressRepository$saveProgress$2", f = "PlaybackProgressRepository.kt", i = {}, l = {73}, m = "invokeSuspend", n = {}, s = {})
    public static final class C03422 extends SuspendLambda implements gr3<ak1, Continuation<? super e6a>, Object> {
        final /* synthetic */ ContentItem $contentItem;
        final /* synthetic */ long $durationMs;
        final /* synthetic */ Integer $episode;
        final /* synthetic */ long $positionMs;
        final /* synthetic */ Integer $season;
        final /* synthetic */ String $showTitle;
        final /* synthetic */ String $sourceBingeGroup;
        final /* synthetic */ String $sourceInfoHash;
        final /* synthetic */ String $sourceScraperId;
        int label;
        final /* synthetic */ PlaybackProgressRepository this$0;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C03422(long j, long j2, ContentItem contentItem, Integer num, Integer num2, String str, String str2, String str3, String str4, PlaybackProgressRepository playbackProgressRepository, Continuation<? super C03422> continuation) {
            super(2, continuation);
            this.$durationMs = j;
            this.$positionMs = j2;
            this.$contentItem = contentItem;
            this.$season = num;
            this.$episode = num2;
            this.$showTitle = str;
            this.$sourceInfoHash = str2;
            this.$sourceScraperId = str3;
            this.$sourceBingeGroup = str4;
            this.this$0 = playbackProgressRepository;
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Continuation<e6a> create(Object obj, Continuation<?> continuation) {
            return new C03422(this.$durationMs, this.$positionMs, this.$contentItem, this.$season, this.$episode, this.$showTitle, this.$sourceInfoHash, this.$sourceScraperId, this.$sourceBingeGroup, this.this$0, continuation);
        }

        @Override // defpackage.gr3
        public final Object invoke(ak1 ak1Var, Continuation<? super e6a> continuation) {
            return ((C03422) create(ak1Var, continuation)).invokeSuspend(e6a.a);
        }

        @Override // kotlin.coroutines.jvm.internal.BaseContinuationImpl
        public final Object invokeSuspend(Object obj) {
            String strCreateMovieId;
            String title;
            Integer num;
            ck1 ck1Var = ck1.a;
            int i = this.label;
            if (i == 0) {
                s38.b(obj);
                long j = this.$durationMs;
                float f = j > 0 ? this.$positionMs / j : 0.0f;
                boolean z = this.$contentItem.getItemType() == ContentItem.ItemType.TV_SHOW && (num = this.$season) != null && this.$episode != null && num.intValue() > 0 && this.$episode.intValue() > 0;
                if (z) {
                    PlaybackProgress.Companion companion = PlaybackProgress.INSTANCE;
                    int tmdbId = this.$contentItem.getTmdbId();
                    Integer num2 = this.$season;
                    cr4.d(num2);
                    int iIntValue = num2.intValue();
                    Integer num3 = this.$episode;
                    cr4.d(num3);
                    strCreateMovieId = companion.createEpisodeId(tmdbId, iIntValue, num3.intValue());
                } else {
                    strCreateMovieId = PlaybackProgress.INSTANCE.createMovieId(this.$contentItem.getTmdbId());
                }
                String str = strCreateMovieId;
                int tmdbId2 = this.$contentItem.getTmdbId();
                String str2 = z ? PlaybackProgress.TYPE_EPISODE : PlaybackProgress.TYPE_MOVIE;
                if (z) {
                    title = "S" + this.$season + "E" + this.$episode + ": " + this.$contentItem.getTitle();
                } else {
                    title = this.$contentItem.getTitle();
                }
                PlaybackProgress playbackProgress = new PlaybackProgress(str, tmdbId2, str2, title, this.$contentItem.getPosterUrl(), this.$showTitle, z ? this.$season : null, z ? this.$episode : null, this.$positionMs, this.$durationMs, f, System.currentTimeMillis(), false, this.$sourceInfoHash, this.$sourceScraperId, this.$sourceBingeGroup);
                PlaybackProgressDao playbackProgressDao = this.this$0.playbackProgressDao;
                this.label = 1;
                if (playbackProgressDao.saveProgress(playbackProgress, this) == ck1Var) {
                    return ck1Var;
                }
            } else {
                if (i != 1) {
                    throw new IllegalStateException("call to 'resume' before 'invoke' with coroutine");
                }
                s38.b(obj);
            }
            return e6a.a;
        }
    }

    @Inject
    public PlaybackProgressRepository(@kp6 PlaybackProgressDao playbackProgressDao) {
        cr4.g(playbackProgressDao, "playbackProgressDao");
        this.playbackProgressDao = playbackProgressDao;
    }

    public static /* synthetic */ Object deleteProgress$default(PlaybackProgressRepository playbackProgressRepository, int i, String str, Integer num, Integer num2, Continuation continuation, int i2, Object obj) {
        if ((i2 & 4) != 0) {
            num = null;
        }
        if ((i2 & 8) != 0) {
            num2 = null;
        }
        return playbackProgressRepository.deleteProgress(i, str, num, num2, continuation);
    }

    public static /* synthetic */ Object getContinueWatching$default(PlaybackProgressRepository playbackProgressRepository, int i, Continuation continuation, int i2, Object obj) {
        if ((i2 & 1) != 0) {
            i = 20;
        }
        return playbackProgressRepository.getContinueWatching(i, continuation);
    }

    public static /* synthetic */ j43 getContinueWatchingFlow$default(PlaybackProgressRepository playbackProgressRepository, int i, int i2, Object obj) {
        if ((i2 & 1) != 0) {
            i = 20;
        }
        return playbackProgressRepository.getContinueWatchingFlow(i);
    }

    public static /* synthetic */ Object markWatched$default(PlaybackProgressRepository playbackProgressRepository, int i, String str, Integer num, Integer num2, boolean z, Continuation continuation, int i2, Object obj) {
        if ((i2 & 4) != 0) {
            num = null;
        }
        if ((i2 & 8) != 0) {
            num2 = null;
        }
        if ((i2 & 16) != 0) {
            z = false;
        }
        return playbackProgressRepository.markWatched(i, str, num, num2, z, continuation);
    }

    public static /* synthetic */ Object saveProgress$default(PlaybackProgressRepository playbackProgressRepository, ContentItem contentItem, long j, long j2, Integer num, Integer num2, String str, String str2, String str3, String str4, Continuation continuation, int i, Object obj) {
        if ((i & 8) != 0) {
            num = null;
        }
        if ((i & 16) != 0) {
            num2 = null;
        }
        if ((i & 32) != 0) {
            str = null;
        }
        if ((i & 64) != 0) {
            str2 = null;
        }
        if ((i & 128) != 0) {
            str3 = null;
        }
        if ((i & 256) != 0) {
            str4 = null;
        }
        return playbackProgressRepository.saveProgress(contentItem, j, j2, num, num2, str, str2, str3, str4, continuation);
    }

    @pq6
    public final Object clearAll(@kp6 Continuation<? super e6a> continuation) throws Throwable {
        m12 m12Var = sc2.a;
        Object objF = wj0.f(m02.c, new AnonymousClass2(null), continuation);
        return objF == ck1.a ? objF : e6a.a;
    }

    @pq6
    public final Object deleteProgress(int i, @kp6 String str, @pq6 Integer num, @pq6 Integer num2, @kp6 Continuation<? super e6a> continuation) throws Throwable {
        m12 m12Var = sc2.a;
        Object objF = wj0.f(m02.c, new C03332(i, str, num, num2, this, null), continuation);
        return objF == ck1.a ? objF : e6a.a;
    }

    @pq6
    public final Object getContinueWatching(int i, @kp6 Continuation<? super List<PlaybackProgress>> continuation) {
        m12 m12Var = sc2.a;
        return wj0.f(m02.c, new C03342(i, null), continuation);
    }

    @kp6
    public final j43<List<PlaybackProgress>> getContinueWatchingFlow(int limit) {
        return this.playbackProgressDao.getContinueWatchingFlow(limit);
    }

    @pq6
    public final Object getEpisodeProgress(int i, int i2, int i3, @kp6 Continuation<? super PlaybackProgress> continuation) {
        m12 m12Var = sc2.a;
        return wj0.f(m02.c, new C03352(i, i2, i3, null), continuation);
    }

    @pq6
    public final Object getLatestEpisodeFingerprint(int i, @kp6 Continuation<? super PlaybackProgress> continuation) {
        m12 m12Var = sc2.a;
        return wj0.f(m02.c, new C03362(i, null), continuation);
    }

    @pq6
    public final Object getMovieProgress(int i, @kp6 Continuation<? super PlaybackProgress> continuation) {
        m12 m12Var = sc2.a;
        return wj0.f(m02.c, new C03372(i, null), continuation);
    }

    @pq6
    public final Object getShowProgress(int i, @kp6 Continuation<? super List<PlaybackProgress>> continuation) {
        m12 m12Var = sc2.a;
        return wj0.f(m02.c, new C03382(i, null), continuation);
    }

    @pq6
    public final Object getUnsyncedProgress(@kp6 Continuation<? super List<PlaybackProgress>> continuation) {
        m12 m12Var = sc2.a;
        return wj0.f(m02.c, new C03392(null), continuation);
    }

    @pq6
    public final Object markSynced(@kp6 String str, @kp6 Continuation<? super e6a> continuation) throws Throwable {
        m12 m12Var = sc2.a;
        Object objF = wj0.f(m02.c, new C03402(str, null), continuation);
        return objF == ck1.a ? objF : e6a.a;
    }

    @pq6
    public final Object markWatched(int i, @kp6 String str, @pq6 Integer num, @pq6 Integer num2, boolean z, @kp6 Continuation<? super e6a> continuation) throws Throwable {
        m12 m12Var = sc2.a;
        Object objF = wj0.f(m02.c, new C03412(i, str, num, num2, this, z, null), continuation);
        return objF == ck1.a ? objF : e6a.a;
    }

    @pq6
    public final Object saveProgress(@kp6 ContentItem contentItem, long j, long j2, @pq6 Integer num, @pq6 Integer num2, @pq6 String str, @pq6 String str2, @pq6 String str3, @pq6 String str4, @kp6 Continuation<? super e6a> continuation) throws Throwable {
        m12 m12Var = sc2.a;
        Object objF = wj0.f(m02.c, new C03422(j2, j, contentItem, num, num2, str, str2, str3, str4, this, null), continuation);
        return objF == ck1.a ? objF : e6a.a;
    }
}
