package com.strmr.ps.data.local.dao;

import android.database.Cursor;
import android.os.CancellationSignal;
import androidx.media3.exoplayer.rtsp.SessionDescription;
import androidx.media3.extractor.text.ttml.TtmlNode;
import androidx.room.RoomDatabase;
import com.strmr.ps.data.local.entity.PlaybackProgress;
import defpackage.e6a;
import defpackage.j43;
import defpackage.mk1;
import defpackage.oq8;
import defpackage.p58;
import defpackage.pe9;
import defpackage.rq6;
import defpackage.sp1;
import defpackage.vo6;
import defpackage.vw2;
import defpackage.xm2;
import defpackage.yn1;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
import kotlin.coroutines.Continuation;

/* JADX INFO: loaded from: classes3.dex */
public final class PlaybackProgressDao_Impl implements PlaybackProgressDao {
    private final RoomDatabase __db;
    private final xm2<PlaybackProgress> __insertionAdapterOfPlaybackProgress;
    private final oq8 __preparedStmtOfClearAll;
    private final oq8 __preparedStmtOfDeleteProgress;
    private final oq8 __preparedStmtOfDeleteShowProgress;
    private final oq8 __preparedStmtOfMarkSynced;
    private final oq8 __preparedStmtOfMarkWatched;

    public PlaybackProgressDao_Impl(@vo6 RoomDatabase roomDatabase) {
        this.__db = roomDatabase;
        this.__insertionAdapterOfPlaybackProgress = new xm2<PlaybackProgress>(roomDatabase) { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.1
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "INSERT OR REPLACE INTO `playback_progress` (`id`,`tmdbId`,`type`,`title`,`posterUrl`,`showTitle`,`season`,`episode`,`positionMs`,`durationMs`,`percent`,`lastWatchedAt`,`syncedToTrakt`,`sourceInfoHash`,`sourceScraperId`,`sourceBingeGroup`) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
            }

            @Override // defpackage.xm2
            public void bind(@vo6 pe9 pe9Var, @vo6 PlaybackProgress playbackProgress) {
                pe9Var.bindString(1, playbackProgress.getId());
                pe9Var.bindLong(2, playbackProgress.getTmdbId());
                pe9Var.bindString(3, playbackProgress.getType());
                pe9Var.bindString(4, playbackProgress.getTitle());
                if (playbackProgress.getPosterUrl() == null) {
                    pe9Var.bindNull(5);
                } else {
                    pe9Var.bindString(5, playbackProgress.getPosterUrl());
                }
                if (playbackProgress.getShowTitle() == null) {
                    pe9Var.bindNull(6);
                } else {
                    pe9Var.bindString(6, playbackProgress.getShowTitle());
                }
                if (playbackProgress.getSeason() == null) {
                    pe9Var.bindNull(7);
                } else {
                    pe9Var.bindLong(7, playbackProgress.getSeason().intValue());
                }
                if (playbackProgress.getEpisode() == null) {
                    pe9Var.bindNull(8);
                } else {
                    pe9Var.bindLong(8, playbackProgress.getEpisode().intValue());
                }
                pe9Var.bindLong(9, playbackProgress.getPositionMs());
                pe9Var.bindLong(10, playbackProgress.getDurationMs());
                pe9Var.bindDouble(11, playbackProgress.getPercent());
                pe9Var.bindLong(12, playbackProgress.getLastWatchedAt());
                pe9Var.bindLong(13, playbackProgress.getSyncedToTrakt() ? 1L : 0L);
                if (playbackProgress.getSourceInfoHash() == null) {
                    pe9Var.bindNull(14);
                } else {
                    pe9Var.bindString(14, playbackProgress.getSourceInfoHash());
                }
                if (playbackProgress.getSourceScraperId() == null) {
                    pe9Var.bindNull(15);
                } else {
                    pe9Var.bindString(15, playbackProgress.getSourceScraperId());
                }
                if (playbackProgress.getSourceBingeGroup() == null) {
                    pe9Var.bindNull(16);
                } else {
                    pe9Var.bindString(16, playbackProgress.getSourceBingeGroup());
                }
            }
        };
        this.__preparedStmtOfDeleteProgress = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.2
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "DELETE FROM playback_progress WHERE id = ?";
            }
        };
        this.__preparedStmtOfDeleteShowProgress = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.3
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "DELETE FROM playback_progress WHERE tmdbId = ? AND type = 'episode'";
            }
        };
        this.__preparedStmtOfMarkWatched = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.4
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "UPDATE playback_progress SET percent = 1.0, syncedToTrakt = ? WHERE id = ?";
            }
        };
        this.__preparedStmtOfMarkSynced = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.5
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "UPDATE playback_progress SET syncedToTrakt = 1 WHERE id = ?";
            }
        };
        this.__preparedStmtOfClearAll = new oq8(roomDatabase) { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.6
            @Override // defpackage.oq8
            @vo6
            public String createQuery() {
                return "DELETE FROM playback_progress";
            }
        };
    }

    @vo6
    public static List<Class<?>> getRequiredConverters() {
        return Collections.EMPTY_LIST;
    }

    @Override // com.strmr.ps.data.local.dao.PlaybackProgressDao
    public Object clearAll(Continuation<? super e6a> continuation) {
        return mk1.b(this.__db, new Callable<e6a>() { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.12
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @vo6
            public e6a call() throws Exception {
                pe9 pe9VarAcquire = PlaybackProgressDao_Impl.this.__preparedStmtOfClearAll.acquire();
                try {
                    PlaybackProgressDao_Impl.this.__db.beginTransaction();
                    try {
                        pe9VarAcquire.executeUpdateDelete();
                        PlaybackProgressDao_Impl.this.__db.setTransactionSuccessful();
                        return e6a.a;
                    } finally {
                        PlaybackProgressDao_Impl.this.__db.endTransaction();
                    }
                } finally {
                    PlaybackProgressDao_Impl.this.__preparedStmtOfClearAll.release(pe9VarAcquire);
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.PlaybackProgressDao
    public Object deleteProgress(final String str, Continuation<? super e6a> continuation) {
        return mk1.b(this.__db, new Callable<e6a>() { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.8
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @vo6
            public e6a call() throws Exception {
                pe9 pe9VarAcquire = PlaybackProgressDao_Impl.this.__preparedStmtOfDeleteProgress.acquire();
                pe9VarAcquire.bindString(1, str);
                try {
                    PlaybackProgressDao_Impl.this.__db.beginTransaction();
                    try {
                        pe9VarAcquire.executeUpdateDelete();
                        PlaybackProgressDao_Impl.this.__db.setTransactionSuccessful();
                        return e6a.a;
                    } finally {
                        PlaybackProgressDao_Impl.this.__db.endTransaction();
                    }
                } finally {
                    PlaybackProgressDao_Impl.this.__preparedStmtOfDeleteProgress.release(pe9VarAcquire);
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.PlaybackProgressDao
    public Object deleteShowProgress(final int i, Continuation<? super e6a> continuation) {
        return mk1.b(this.__db, new Callable<e6a>() { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.9
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @vo6
            public e6a call() throws Exception {
                pe9 pe9VarAcquire = PlaybackProgressDao_Impl.this.__preparedStmtOfDeleteShowProgress.acquire();
                pe9VarAcquire.bindLong(1, i);
                try {
                    PlaybackProgressDao_Impl.this.__db.beginTransaction();
                    try {
                        pe9VarAcquire.executeUpdateDelete();
                        PlaybackProgressDao_Impl.this.__db.setTransactionSuccessful();
                        return e6a.a;
                    } finally {
                        PlaybackProgressDao_Impl.this.__db.endTransaction();
                    }
                } finally {
                    PlaybackProgressDao_Impl.this.__preparedStmtOfDeleteShowProgress.release(pe9VarAcquire);
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.PlaybackProgressDao
    public Object getContinueWatching(int i, Continuation<? super List<PlaybackProgress>> continuation) {
        final p58 p58VarD = p58.d(1, "\n        SELECT * FROM playback_progress\n        WHERE percent > 0.05 AND percent < 0.90\n        ORDER BY lastWatchedAt DESC\n        LIMIT ?\n    ");
        return mk1.c(this.__db, false, vw2.e(p58VarD, 1, i), new Callable<List<PlaybackProgress>>() { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.18
            @Override // java.util.concurrent.Callable
            @vo6
            public List<PlaybackProgress> call() throws Exception {
                AnonymousClass18 anonymousClass18;
                int iB;
                int iB2;
                int iB3;
                int iB4;
                int iB5;
                int iB6;
                int iB7;
                int iB8;
                int iB9;
                int iB10;
                int iB11;
                int iB12;
                int iB13;
                int iB14;
                int i2;
                int i3;
                String string;
                int i4;
                int i5;
                String str;
                Cursor cursorB = sp1.b(PlaybackProgressDao_Impl.this.__db, p58VarD, false);
                try {
                    iB = yn1.b(cursorB, TtmlNode.ATTR_ID);
                    iB2 = yn1.b(cursorB, "tmdbId");
                    iB3 = yn1.b(cursorB, SessionDescription.ATTR_TYPE);
                    iB4 = yn1.b(cursorB, "title");
                    iB5 = yn1.b(cursorB, "posterUrl");
                    iB6 = yn1.b(cursorB, "showTitle");
                    iB7 = yn1.b(cursorB, "season");
                    iB8 = yn1.b(cursorB, PlaybackProgress.TYPE_EPISODE);
                    iB9 = yn1.b(cursorB, "positionMs");
                    iB10 = yn1.b(cursorB, "durationMs");
                    iB11 = yn1.b(cursorB, "percent");
                    iB12 = yn1.b(cursorB, "lastWatchedAt");
                    iB13 = yn1.b(cursorB, "syncedToTrakt");
                    iB14 = yn1.b(cursorB, "sourceInfoHash");
                } catch (Throwable th) {
                    th = th;
                    anonymousClass18 = this;
                }
                try {
                    int iB15 = yn1.b(cursorB, "sourceScraperId");
                    int iB16 = yn1.b(cursorB, "sourceBingeGroup");
                    int i6 = iB14;
                    ArrayList arrayList = new ArrayList(cursorB.getCount());
                    while (cursorB.moveToNext()) {
                        String string2 = cursorB.getString(iB);
                        int i7 = cursorB.getInt(iB2);
                        String string3 = cursorB.getString(iB3);
                        String string4 = cursorB.getString(iB4);
                        String string5 = cursorB.isNull(iB5) ? null : cursorB.getString(iB5);
                        String string6 = cursorB.isNull(iB6) ? null : cursorB.getString(iB6);
                        Integer numValueOf = cursorB.isNull(iB7) ? null : Integer.valueOf(cursorB.getInt(iB7));
                        Integer numValueOf2 = cursorB.isNull(iB8) ? null : Integer.valueOf(cursorB.getInt(iB8));
                        long j = cursorB.getLong(iB9);
                        long j2 = cursorB.getLong(iB10);
                        float f = cursorB.getFloat(iB11);
                        long j3 = cursorB.getLong(iB12);
                        boolean z = cursorB.getInt(iB13) != 0;
                        int i8 = i6;
                        if (cursorB.isNull(i8)) {
                            int i9 = iB15;
                            i2 = iB;
                            i3 = i9;
                            string = null;
                        } else {
                            int i10 = iB15;
                            i2 = iB;
                            i3 = i10;
                            string = cursorB.getString(i8);
                        }
                        if (cursorB.isNull(i3)) {
                            int i11 = iB16;
                            i4 = i3;
                            i5 = i11;
                            str = null;
                        } else {
                            String string7 = cursorB.getString(i3);
                            int i12 = iB16;
                            i4 = i3;
                            i5 = i12;
                            str = string7;
                        }
                        int i13 = i5;
                        arrayList.add(new PlaybackProgress(string2, i7, string3, string4, string5, string6, numValueOf, numValueOf2, j, j2, f, j3, z, string, str, cursorB.isNull(i5) ? null : cursorB.getString(i5)));
                        iB = i2;
                        iB15 = i4;
                        iB16 = i13;
                        i6 = i8;
                    }
                    cursorB.close();
                    p58VarD.release();
                    return arrayList;
                } catch (Throwable th2) {
                    th = th2;
                    anonymousClass18 = this;
                    cursorB.close();
                    p58VarD.release();
                    throw th;
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.PlaybackProgressDao
    public j43<List<PlaybackProgress>> getContinueWatchingFlow(int i) {
        final p58 p58VarD = p58.d(1, "\n        SELECT * FROM playback_progress\n        WHERE percent > 0.05 AND percent < 0.90\n        ORDER BY lastWatchedAt DESC\n        LIMIT ?\n    ");
        p58VarD.bindLong(1, i);
        return mk1.a(this.__db, false, new String[]{"playback_progress"}, new Callable<List<PlaybackProgress>>() { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.17
            public void finalize() {
                p58VarD.release();
            }

            @Override // java.util.concurrent.Callable
            @vo6
            public List<PlaybackProgress> call() throws Exception {
                int i2;
                int i3;
                String string;
                int i4;
                int i5;
                String str;
                Cursor cursorB = sp1.b(PlaybackProgressDao_Impl.this.__db, p58VarD, false);
                try {
                    int iB = yn1.b(cursorB, TtmlNode.ATTR_ID);
                    int iB2 = yn1.b(cursorB, "tmdbId");
                    int iB3 = yn1.b(cursorB, SessionDescription.ATTR_TYPE);
                    int iB4 = yn1.b(cursorB, "title");
                    int iB5 = yn1.b(cursorB, "posterUrl");
                    int iB6 = yn1.b(cursorB, "showTitle");
                    int iB7 = yn1.b(cursorB, "season");
                    int iB8 = yn1.b(cursorB, PlaybackProgress.TYPE_EPISODE);
                    int iB9 = yn1.b(cursorB, "positionMs");
                    int iB10 = yn1.b(cursorB, "durationMs");
                    int iB11 = yn1.b(cursorB, "percent");
                    int iB12 = yn1.b(cursorB, "lastWatchedAt");
                    int iB13 = yn1.b(cursorB, "syncedToTrakt");
                    int iB14 = yn1.b(cursorB, "sourceInfoHash");
                    int iB15 = yn1.b(cursorB, "sourceScraperId");
                    int iB16 = yn1.b(cursorB, "sourceBingeGroup");
                    int i6 = iB14;
                    ArrayList arrayList = new ArrayList(cursorB.getCount());
                    while (cursorB.moveToNext()) {
                        String string2 = cursorB.getString(iB);
                        int i7 = cursorB.getInt(iB2);
                        String string3 = cursorB.getString(iB3);
                        String string4 = cursorB.getString(iB4);
                        String string5 = cursorB.isNull(iB5) ? null : cursorB.getString(iB5);
                        String string6 = cursorB.isNull(iB6) ? null : cursorB.getString(iB6);
                        Integer numValueOf = cursorB.isNull(iB7) ? null : Integer.valueOf(cursorB.getInt(iB7));
                        Integer numValueOf2 = cursorB.isNull(iB8) ? null : Integer.valueOf(cursorB.getInt(iB8));
                        long j = cursorB.getLong(iB9);
                        long j2 = cursorB.getLong(iB10);
                        float f = cursorB.getFloat(iB11);
                        long j3 = cursorB.getLong(iB12);
                        boolean z = cursorB.getInt(iB13) != 0;
                        int i8 = i6;
                        if (cursorB.isNull(i8)) {
                            int i9 = iB15;
                            i2 = iB;
                            i3 = i9;
                            string = null;
                        } else {
                            int i10 = iB15;
                            i2 = iB;
                            i3 = i10;
                            string = cursorB.getString(i8);
                        }
                        if (cursorB.isNull(i3)) {
                            int i11 = iB16;
                            i4 = i3;
                            i5 = i11;
                            str = null;
                        } else {
                            String string7 = cursorB.getString(i3);
                            int i12 = iB16;
                            i4 = i3;
                            i5 = i12;
                            str = string7;
                        }
                        int i13 = i5;
                        arrayList.add(new PlaybackProgress(string2, i7, string3, string4, string5, string6, numValueOf, numValueOf2, j, j2, f, j3, z, string, str, cursorB.isNull(i5) ? null : cursorB.getString(i5)));
                        iB = i2;
                        iB15 = i4;
                        iB16 = i13;
                        i6 = i8;
                    }
                    return arrayList;
                } finally {
                    cursorB.close();
                }
            }
        });
    }

    @Override // com.strmr.ps.data.local.dao.PlaybackProgressDao
    public Object getEpisodeProgress(int i, int i2, int i3, Continuation<? super PlaybackProgress> continuation) {
        final p58 p58VarD = p58.d(3, "SELECT * FROM playback_progress WHERE tmdbId = ? AND season = ? AND episode = ? AND type = 'episode'");
        p58VarD.bindLong(1, i);
        p58VarD.bindLong(2, i2);
        return mk1.c(this.__db, false, vw2.e(p58VarD, 3, i3), new Callable<PlaybackProgress>() { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.15
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @rq6
            public PlaybackProgress call() throws Exception {
                AnonymousClass15 anonymousClass15 = this;
                Cursor cursorB = sp1.b(PlaybackProgressDao_Impl.this.__db, p58VarD, false);
                try {
                    int iB = yn1.b(cursorB, TtmlNode.ATTR_ID);
                    int iB2 = yn1.b(cursorB, "tmdbId");
                    int iB3 = yn1.b(cursorB, SessionDescription.ATTR_TYPE);
                    int iB4 = yn1.b(cursorB, "title");
                    int iB5 = yn1.b(cursorB, "posterUrl");
                    int iB6 = yn1.b(cursorB, "showTitle");
                    int iB7 = yn1.b(cursorB, "season");
                    int iB8 = yn1.b(cursorB, PlaybackProgress.TYPE_EPISODE);
                    int iB9 = yn1.b(cursorB, "positionMs");
                    int iB10 = yn1.b(cursorB, "durationMs");
                    int iB11 = yn1.b(cursorB, "percent");
                    int iB12 = yn1.b(cursorB, "lastWatchedAt");
                    int iB13 = yn1.b(cursorB, "syncedToTrakt");
                    int iB14 = yn1.b(cursorB, "sourceInfoHash");
                    try {
                        int iB15 = yn1.b(cursorB, "sourceScraperId");
                        int iB16 = yn1.b(cursorB, "sourceBingeGroup");
                        PlaybackProgress playbackProgress = null;
                        if (cursorB.moveToFirst()) {
                            playbackProgress = new PlaybackProgress(cursorB.getString(iB), cursorB.getInt(iB2), cursorB.getString(iB3), cursorB.getString(iB4), cursorB.isNull(iB5) ? null : cursorB.getString(iB5), cursorB.isNull(iB6) ? null : cursorB.getString(iB6), cursorB.isNull(iB7) ? null : Integer.valueOf(cursorB.getInt(iB7)), cursorB.isNull(iB8) ? null : Integer.valueOf(cursorB.getInt(iB8)), cursorB.getLong(iB9), cursorB.getLong(iB10), cursorB.getFloat(iB11), cursorB.getLong(iB12), cursorB.getInt(iB13) != 0, cursorB.isNull(iB14) ? null : cursorB.getString(iB14), cursorB.isNull(iB15) ? null : cursorB.getString(iB15), cursorB.isNull(iB16) ? null : cursorB.getString(iB16));
                        }
                        cursorB.close();
                        p58VarD.release();
                        return playbackProgress;
                    } catch (Throwable th) {
                        th = th;
                        anonymousClass15 = this;
                        cursorB.close();
                        p58VarD.release();
                        throw th;
                    }
                } catch (Throwable th2) {
                    th = th2;
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.PlaybackProgressDao
    public Object getLatestEpisodeFingerprint(int i, Continuation<? super PlaybackProgress> continuation) {
        final p58 p58VarD = p58.d(1, "\n        SELECT * FROM playback_progress\n        WHERE tmdbId = ? AND type = 'episode'\n        AND sourceBingeGroup IS NOT NULL\n        ORDER BY lastWatchedAt DESC\n        LIMIT 1\n    ");
        return mk1.c(this.__db, false, vw2.e(p58VarD, 1, i), new Callable<PlaybackProgress>() { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.20
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @rq6
            public PlaybackProgress call() throws Exception {
                AnonymousClass20 anonymousClass20 = this;
                Cursor cursorB = sp1.b(PlaybackProgressDao_Impl.this.__db, p58VarD, false);
                try {
                    int iB = yn1.b(cursorB, TtmlNode.ATTR_ID);
                    int iB2 = yn1.b(cursorB, "tmdbId");
                    int iB3 = yn1.b(cursorB, SessionDescription.ATTR_TYPE);
                    int iB4 = yn1.b(cursorB, "title");
                    int iB5 = yn1.b(cursorB, "posterUrl");
                    int iB6 = yn1.b(cursorB, "showTitle");
                    int iB7 = yn1.b(cursorB, "season");
                    int iB8 = yn1.b(cursorB, PlaybackProgress.TYPE_EPISODE);
                    int iB9 = yn1.b(cursorB, "positionMs");
                    int iB10 = yn1.b(cursorB, "durationMs");
                    int iB11 = yn1.b(cursorB, "percent");
                    int iB12 = yn1.b(cursorB, "lastWatchedAt");
                    int iB13 = yn1.b(cursorB, "syncedToTrakt");
                    int iB14 = yn1.b(cursorB, "sourceInfoHash");
                    try {
                        int iB15 = yn1.b(cursorB, "sourceScraperId");
                        int iB16 = yn1.b(cursorB, "sourceBingeGroup");
                        PlaybackProgress playbackProgress = null;
                        if (cursorB.moveToFirst()) {
                            playbackProgress = new PlaybackProgress(cursorB.getString(iB), cursorB.getInt(iB2), cursorB.getString(iB3), cursorB.getString(iB4), cursorB.isNull(iB5) ? null : cursorB.getString(iB5), cursorB.isNull(iB6) ? null : cursorB.getString(iB6), cursorB.isNull(iB7) ? null : Integer.valueOf(cursorB.getInt(iB7)), cursorB.isNull(iB8) ? null : Integer.valueOf(cursorB.getInt(iB8)), cursorB.getLong(iB9), cursorB.getLong(iB10), cursorB.getFloat(iB11), cursorB.getLong(iB12), cursorB.getInt(iB13) != 0, cursorB.isNull(iB14) ? null : cursorB.getString(iB14), cursorB.isNull(iB15) ? null : cursorB.getString(iB15), cursorB.isNull(iB16) ? null : cursorB.getString(iB16));
                        }
                        cursorB.close();
                        p58VarD.release();
                        return playbackProgress;
                    } catch (Throwable th) {
                        th = th;
                        anonymousClass20 = this;
                        cursorB.close();
                        p58VarD.release();
                        throw th;
                    }
                } catch (Throwable th2) {
                    th = th2;
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.PlaybackProgressDao
    public Object getMovieProgress(int i, Continuation<? super PlaybackProgress> continuation) {
        final p58 p58VarD = p58.d(1, "SELECT * FROM playback_progress WHERE tmdbId = ? AND type = 'movie'");
        return mk1.c(this.__db, false, vw2.e(p58VarD, 1, i), new Callable<PlaybackProgress>() { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.14
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @rq6
            public PlaybackProgress call() throws Exception {
                AnonymousClass14 anonymousClass14 = this;
                Cursor cursorB = sp1.b(PlaybackProgressDao_Impl.this.__db, p58VarD, false);
                try {
                    int iB = yn1.b(cursorB, TtmlNode.ATTR_ID);
                    int iB2 = yn1.b(cursorB, "tmdbId");
                    int iB3 = yn1.b(cursorB, SessionDescription.ATTR_TYPE);
                    int iB4 = yn1.b(cursorB, "title");
                    int iB5 = yn1.b(cursorB, "posterUrl");
                    int iB6 = yn1.b(cursorB, "showTitle");
                    int iB7 = yn1.b(cursorB, "season");
                    int iB8 = yn1.b(cursorB, PlaybackProgress.TYPE_EPISODE);
                    int iB9 = yn1.b(cursorB, "positionMs");
                    int iB10 = yn1.b(cursorB, "durationMs");
                    int iB11 = yn1.b(cursorB, "percent");
                    int iB12 = yn1.b(cursorB, "lastWatchedAt");
                    int iB13 = yn1.b(cursorB, "syncedToTrakt");
                    int iB14 = yn1.b(cursorB, "sourceInfoHash");
                    try {
                        int iB15 = yn1.b(cursorB, "sourceScraperId");
                        int iB16 = yn1.b(cursorB, "sourceBingeGroup");
                        PlaybackProgress playbackProgress = null;
                        if (cursorB.moveToFirst()) {
                            playbackProgress = new PlaybackProgress(cursorB.getString(iB), cursorB.getInt(iB2), cursorB.getString(iB3), cursorB.getString(iB4), cursorB.isNull(iB5) ? null : cursorB.getString(iB5), cursorB.isNull(iB6) ? null : cursorB.getString(iB6), cursorB.isNull(iB7) ? null : Integer.valueOf(cursorB.getInt(iB7)), cursorB.isNull(iB8) ? null : Integer.valueOf(cursorB.getInt(iB8)), cursorB.getLong(iB9), cursorB.getLong(iB10), cursorB.getFloat(iB11), cursorB.getLong(iB12), cursorB.getInt(iB13) != 0, cursorB.isNull(iB14) ? null : cursorB.getString(iB14), cursorB.isNull(iB15) ? null : cursorB.getString(iB15), cursorB.isNull(iB16) ? null : cursorB.getString(iB16));
                        }
                        cursorB.close();
                        p58VarD.release();
                        return playbackProgress;
                    } catch (Throwable th) {
                        th = th;
                        anonymousClass14 = this;
                        cursorB.close();
                        p58VarD.release();
                        throw th;
                    }
                } catch (Throwable th2) {
                    th = th2;
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.PlaybackProgressDao
    public Object getProgress(String str, Continuation<? super PlaybackProgress> continuation) {
        final p58 p58VarD = p58.d(1, "SELECT * FROM playback_progress WHERE id = ?");
        return mk1.c(this.__db, false, vw2.f(p58VarD, 1, str), new Callable<PlaybackProgress>() { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.13
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @rq6
            public PlaybackProgress call() throws Exception {
                AnonymousClass13 anonymousClass13 = this;
                Cursor cursorB = sp1.b(PlaybackProgressDao_Impl.this.__db, p58VarD, false);
                try {
                    int iB = yn1.b(cursorB, TtmlNode.ATTR_ID);
                    int iB2 = yn1.b(cursorB, "tmdbId");
                    int iB3 = yn1.b(cursorB, SessionDescription.ATTR_TYPE);
                    int iB4 = yn1.b(cursorB, "title");
                    int iB5 = yn1.b(cursorB, "posterUrl");
                    int iB6 = yn1.b(cursorB, "showTitle");
                    int iB7 = yn1.b(cursorB, "season");
                    int iB8 = yn1.b(cursorB, PlaybackProgress.TYPE_EPISODE);
                    int iB9 = yn1.b(cursorB, "positionMs");
                    int iB10 = yn1.b(cursorB, "durationMs");
                    int iB11 = yn1.b(cursorB, "percent");
                    int iB12 = yn1.b(cursorB, "lastWatchedAt");
                    int iB13 = yn1.b(cursorB, "syncedToTrakt");
                    int iB14 = yn1.b(cursorB, "sourceInfoHash");
                    try {
                        int iB15 = yn1.b(cursorB, "sourceScraperId");
                        int iB16 = yn1.b(cursorB, "sourceBingeGroup");
                        PlaybackProgress playbackProgress = null;
                        if (cursorB.moveToFirst()) {
                            playbackProgress = new PlaybackProgress(cursorB.getString(iB), cursorB.getInt(iB2), cursorB.getString(iB3), cursorB.getString(iB4), cursorB.isNull(iB5) ? null : cursorB.getString(iB5), cursorB.isNull(iB6) ? null : cursorB.getString(iB6), cursorB.isNull(iB7) ? null : Integer.valueOf(cursorB.getInt(iB7)), cursorB.isNull(iB8) ? null : Integer.valueOf(cursorB.getInt(iB8)), cursorB.getLong(iB9), cursorB.getLong(iB10), cursorB.getFloat(iB11), cursorB.getLong(iB12), cursorB.getInt(iB13) != 0, cursorB.isNull(iB14) ? null : cursorB.getString(iB14), cursorB.isNull(iB15) ? null : cursorB.getString(iB15), cursorB.isNull(iB16) ? null : cursorB.getString(iB16));
                        }
                        cursorB.close();
                        p58VarD.release();
                        return playbackProgress;
                    } catch (Throwable th) {
                        th = th;
                        anonymousClass13 = this;
                        cursorB.close();
                        p58VarD.release();
                        throw th;
                    }
                } catch (Throwable th2) {
                    th = th2;
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.PlaybackProgressDao
    public Object getRecentlyWatched(int i, Continuation<? super List<PlaybackProgress>> continuation) {
        final p58 p58VarD = p58.d(1, "\n        SELECT * FROM playback_progress\n        ORDER BY lastWatchedAt DESC\n        LIMIT ?\n    ");
        return mk1.c(this.__db, false, vw2.e(p58VarD, 1, i), new Callable<List<PlaybackProgress>>() { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.21
            @Override // java.util.concurrent.Callable
            @vo6
            public List<PlaybackProgress> call() throws Exception {
                AnonymousClass21 anonymousClass21;
                int iB;
                int iB2;
                int iB3;
                int iB4;
                int iB5;
                int iB6;
                int iB7;
                int iB8;
                int iB9;
                int iB10;
                int iB11;
                int iB12;
                int iB13;
                int iB14;
                int i2;
                int i3;
                String string;
                int i4;
                int i5;
                String str;
                Cursor cursorB = sp1.b(PlaybackProgressDao_Impl.this.__db, p58VarD, false);
                try {
                    iB = yn1.b(cursorB, TtmlNode.ATTR_ID);
                    iB2 = yn1.b(cursorB, "tmdbId");
                    iB3 = yn1.b(cursorB, SessionDescription.ATTR_TYPE);
                    iB4 = yn1.b(cursorB, "title");
                    iB5 = yn1.b(cursorB, "posterUrl");
                    iB6 = yn1.b(cursorB, "showTitle");
                    iB7 = yn1.b(cursorB, "season");
                    iB8 = yn1.b(cursorB, PlaybackProgress.TYPE_EPISODE);
                    iB9 = yn1.b(cursorB, "positionMs");
                    iB10 = yn1.b(cursorB, "durationMs");
                    iB11 = yn1.b(cursorB, "percent");
                    iB12 = yn1.b(cursorB, "lastWatchedAt");
                    iB13 = yn1.b(cursorB, "syncedToTrakt");
                    iB14 = yn1.b(cursorB, "sourceInfoHash");
                } catch (Throwable th) {
                    th = th;
                    anonymousClass21 = this;
                }
                try {
                    int iB15 = yn1.b(cursorB, "sourceScraperId");
                    int iB16 = yn1.b(cursorB, "sourceBingeGroup");
                    int i6 = iB14;
                    ArrayList arrayList = new ArrayList(cursorB.getCount());
                    while (cursorB.moveToNext()) {
                        String string2 = cursorB.getString(iB);
                        int i7 = cursorB.getInt(iB2);
                        String string3 = cursorB.getString(iB3);
                        String string4 = cursorB.getString(iB4);
                        String string5 = cursorB.isNull(iB5) ? null : cursorB.getString(iB5);
                        String string6 = cursorB.isNull(iB6) ? null : cursorB.getString(iB6);
                        Integer numValueOf = cursorB.isNull(iB7) ? null : Integer.valueOf(cursorB.getInt(iB7));
                        Integer numValueOf2 = cursorB.isNull(iB8) ? null : Integer.valueOf(cursorB.getInt(iB8));
                        long j = cursorB.getLong(iB9);
                        long j2 = cursorB.getLong(iB10);
                        float f = cursorB.getFloat(iB11);
                        long j3 = cursorB.getLong(iB12);
                        boolean z = cursorB.getInt(iB13) != 0;
                        int i8 = i6;
                        if (cursorB.isNull(i8)) {
                            int i9 = iB15;
                            i2 = iB;
                            i3 = i9;
                            string = null;
                        } else {
                            int i10 = iB15;
                            i2 = iB;
                            i3 = i10;
                            string = cursorB.getString(i8);
                        }
                        if (cursorB.isNull(i3)) {
                            int i11 = iB16;
                            i4 = i3;
                            i5 = i11;
                            str = null;
                        } else {
                            String string7 = cursorB.getString(i3);
                            int i12 = iB16;
                            i4 = i3;
                            i5 = i12;
                            str = string7;
                        }
                        int i13 = i5;
                        arrayList.add(new PlaybackProgress(string2, i7, string3, string4, string5, string6, numValueOf, numValueOf2, j, j2, f, j3, z, string, str, cursorB.isNull(i5) ? null : cursorB.getString(i5)));
                        iB = i2;
                        iB15 = i4;
                        iB16 = i13;
                        i6 = i8;
                    }
                    cursorB.close();
                    p58VarD.release();
                    return arrayList;
                } catch (Throwable th2) {
                    th = th2;
                    anonymousClass21 = this;
                    cursorB.close();
                    p58VarD.release();
                    throw th;
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.PlaybackProgressDao
    public Object getShowProgress(int i, Continuation<? super List<PlaybackProgress>> continuation) {
        final p58 p58VarD = p58.d(1, "SELECT * FROM playback_progress WHERE tmdbId = ? AND type = 'episode' ORDER BY season, episode");
        return mk1.c(this.__db, false, vw2.e(p58VarD, 1, i), new Callable<List<PlaybackProgress>>() { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.16
            @Override // java.util.concurrent.Callable
            @vo6
            public List<PlaybackProgress> call() throws Exception {
                AnonymousClass16 anonymousClass16;
                int iB;
                int iB2;
                int iB3;
                int iB4;
                int iB5;
                int iB6;
                int iB7;
                int iB8;
                int iB9;
                int iB10;
                int iB11;
                int iB12;
                int iB13;
                int iB14;
                int i2;
                int i3;
                String string;
                int i4;
                int i5;
                String str;
                Cursor cursorB = sp1.b(PlaybackProgressDao_Impl.this.__db, p58VarD, false);
                try {
                    iB = yn1.b(cursorB, TtmlNode.ATTR_ID);
                    iB2 = yn1.b(cursorB, "tmdbId");
                    iB3 = yn1.b(cursorB, SessionDescription.ATTR_TYPE);
                    iB4 = yn1.b(cursorB, "title");
                    iB5 = yn1.b(cursorB, "posterUrl");
                    iB6 = yn1.b(cursorB, "showTitle");
                    iB7 = yn1.b(cursorB, "season");
                    iB8 = yn1.b(cursorB, PlaybackProgress.TYPE_EPISODE);
                    iB9 = yn1.b(cursorB, "positionMs");
                    iB10 = yn1.b(cursorB, "durationMs");
                    iB11 = yn1.b(cursorB, "percent");
                    iB12 = yn1.b(cursorB, "lastWatchedAt");
                    iB13 = yn1.b(cursorB, "syncedToTrakt");
                    iB14 = yn1.b(cursorB, "sourceInfoHash");
                } catch (Throwable th) {
                    th = th;
                    anonymousClass16 = this;
                }
                try {
                    int iB15 = yn1.b(cursorB, "sourceScraperId");
                    int iB16 = yn1.b(cursorB, "sourceBingeGroup");
                    int i6 = iB14;
                    ArrayList arrayList = new ArrayList(cursorB.getCount());
                    while (cursorB.moveToNext()) {
                        String string2 = cursorB.getString(iB);
                        int i7 = cursorB.getInt(iB2);
                        String string3 = cursorB.getString(iB3);
                        String string4 = cursorB.getString(iB4);
                        String string5 = cursorB.isNull(iB5) ? null : cursorB.getString(iB5);
                        String string6 = cursorB.isNull(iB6) ? null : cursorB.getString(iB6);
                        Integer numValueOf = cursorB.isNull(iB7) ? null : Integer.valueOf(cursorB.getInt(iB7));
                        Integer numValueOf2 = cursorB.isNull(iB8) ? null : Integer.valueOf(cursorB.getInt(iB8));
                        long j = cursorB.getLong(iB9);
                        long j2 = cursorB.getLong(iB10);
                        float f = cursorB.getFloat(iB11);
                        long j3 = cursorB.getLong(iB12);
                        boolean z = cursorB.getInt(iB13) != 0;
                        int i8 = i6;
                        if (cursorB.isNull(i8)) {
                            int i9 = iB15;
                            i2 = iB;
                            i3 = i9;
                            string = null;
                        } else {
                            int i10 = iB15;
                            i2 = iB;
                            i3 = i10;
                            string = cursorB.getString(i8);
                        }
                        if (cursorB.isNull(i3)) {
                            int i11 = iB16;
                            i4 = i3;
                            i5 = i11;
                            str = null;
                        } else {
                            String string7 = cursorB.getString(i3);
                            int i12 = iB16;
                            i4 = i3;
                            i5 = i12;
                            str = string7;
                        }
                        int i13 = i5;
                        arrayList.add(new PlaybackProgress(string2, i7, string3, string4, string5, string6, numValueOf, numValueOf2, j, j2, f, j3, z, string, str, cursorB.isNull(i5) ? null : cursorB.getString(i5)));
                        iB = i2;
                        iB15 = i4;
                        iB16 = i13;
                        i6 = i8;
                    }
                    cursorB.close();
                    p58VarD.release();
                    return arrayList;
                } catch (Throwable th2) {
                    th = th2;
                    anonymousClass16 = this;
                    cursorB.close();
                    p58VarD.release();
                    throw th;
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.PlaybackProgressDao
    public Object getUnsyncedProgress(Continuation<? super List<PlaybackProgress>> continuation) {
        final p58 p58VarD = p58.d(0, "SELECT * FROM playback_progress WHERE syncedToTrakt = 0");
        return mk1.c(this.__db, false, new CancellationSignal(), new Callable<List<PlaybackProgress>>() { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.19
            @Override // java.util.concurrent.Callable
            @vo6
            public List<PlaybackProgress> call() throws Exception {
                AnonymousClass19 anonymousClass19;
                int iB;
                int iB2;
                int iB3;
                int iB4;
                int iB5;
                int iB6;
                int iB7;
                int iB8;
                int iB9;
                int iB10;
                int iB11;
                int iB12;
                int iB13;
                int iB14;
                int i;
                int i2;
                String string;
                int i3;
                int i4;
                String str;
                Cursor cursorB = sp1.b(PlaybackProgressDao_Impl.this.__db, p58VarD, false);
                try {
                    iB = yn1.b(cursorB, TtmlNode.ATTR_ID);
                    iB2 = yn1.b(cursorB, "tmdbId");
                    iB3 = yn1.b(cursorB, SessionDescription.ATTR_TYPE);
                    iB4 = yn1.b(cursorB, "title");
                    iB5 = yn1.b(cursorB, "posterUrl");
                    iB6 = yn1.b(cursorB, "showTitle");
                    iB7 = yn1.b(cursorB, "season");
                    iB8 = yn1.b(cursorB, PlaybackProgress.TYPE_EPISODE);
                    iB9 = yn1.b(cursorB, "positionMs");
                    iB10 = yn1.b(cursorB, "durationMs");
                    iB11 = yn1.b(cursorB, "percent");
                    iB12 = yn1.b(cursorB, "lastWatchedAt");
                    iB13 = yn1.b(cursorB, "syncedToTrakt");
                    iB14 = yn1.b(cursorB, "sourceInfoHash");
                } catch (Throwable th) {
                    th = th;
                    anonymousClass19 = this;
                }
                try {
                    int iB15 = yn1.b(cursorB, "sourceScraperId");
                    int iB16 = yn1.b(cursorB, "sourceBingeGroup");
                    int i5 = iB14;
                    ArrayList arrayList = new ArrayList(cursorB.getCount());
                    while (cursorB.moveToNext()) {
                        String string2 = cursorB.getString(iB);
                        int i6 = cursorB.getInt(iB2);
                        String string3 = cursorB.getString(iB3);
                        String string4 = cursorB.getString(iB4);
                        String string5 = cursorB.isNull(iB5) ? null : cursorB.getString(iB5);
                        String string6 = cursorB.isNull(iB6) ? null : cursorB.getString(iB6);
                        Integer numValueOf = cursorB.isNull(iB7) ? null : Integer.valueOf(cursorB.getInt(iB7));
                        Integer numValueOf2 = cursorB.isNull(iB8) ? null : Integer.valueOf(cursorB.getInt(iB8));
                        long j = cursorB.getLong(iB9);
                        long j2 = cursorB.getLong(iB10);
                        float f = cursorB.getFloat(iB11);
                        long j3 = cursorB.getLong(iB12);
                        boolean z = cursorB.getInt(iB13) != 0;
                        int i7 = i5;
                        if (cursorB.isNull(i7)) {
                            int i8 = iB15;
                            i = iB;
                            i2 = i8;
                            string = null;
                        } else {
                            int i9 = iB15;
                            i = iB;
                            i2 = i9;
                            string = cursorB.getString(i7);
                        }
                        if (cursorB.isNull(i2)) {
                            int i10 = iB16;
                            i3 = i2;
                            i4 = i10;
                            str = null;
                        } else {
                            String string7 = cursorB.getString(i2);
                            int i11 = iB16;
                            i3 = i2;
                            i4 = i11;
                            str = string7;
                        }
                        int i12 = i4;
                        arrayList.add(new PlaybackProgress(string2, i6, string3, string4, string5, string6, numValueOf, numValueOf2, j, j2, f, j3, z, string, str, cursorB.isNull(i4) ? null : cursorB.getString(i4)));
                        iB = i;
                        iB15 = i3;
                        iB16 = i12;
                        i5 = i7;
                    }
                    cursorB.close();
                    p58VarD.release();
                    return arrayList;
                } catch (Throwable th2) {
                    th = th2;
                    anonymousClass19 = this;
                    cursorB.close();
                    p58VarD.release();
                    throw th;
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.PlaybackProgressDao
    public Object markSynced(final String str, Continuation<? super e6a> continuation) {
        return mk1.b(this.__db, new Callable<e6a>() { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.11
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @vo6
            public e6a call() throws Exception {
                pe9 pe9VarAcquire = PlaybackProgressDao_Impl.this.__preparedStmtOfMarkSynced.acquire();
                pe9VarAcquire.bindString(1, str);
                try {
                    PlaybackProgressDao_Impl.this.__db.beginTransaction();
                    try {
                        pe9VarAcquire.executeUpdateDelete();
                        PlaybackProgressDao_Impl.this.__db.setTransactionSuccessful();
                        return e6a.a;
                    } finally {
                        PlaybackProgressDao_Impl.this.__db.endTransaction();
                    }
                } finally {
                    PlaybackProgressDao_Impl.this.__preparedStmtOfMarkSynced.release(pe9VarAcquire);
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.PlaybackProgressDao
    public Object markWatched(final String str, final boolean z, Continuation<? super e6a> continuation) {
        return mk1.b(this.__db, new Callable<e6a>() { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.10
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @vo6
            public e6a call() throws Exception {
                pe9 pe9VarAcquire = PlaybackProgressDao_Impl.this.__preparedStmtOfMarkWatched.acquire();
                pe9VarAcquire.bindLong(1, z ? 1L : 0L);
                pe9VarAcquire.bindString(2, str);
                try {
                    PlaybackProgressDao_Impl.this.__db.beginTransaction();
                    try {
                        pe9VarAcquire.executeUpdateDelete();
                        PlaybackProgressDao_Impl.this.__db.setTransactionSuccessful();
                        return e6a.a;
                    } finally {
                        PlaybackProgressDao_Impl.this.__db.endTransaction();
                    }
                } finally {
                    PlaybackProgressDao_Impl.this.__preparedStmtOfMarkWatched.release(pe9VarAcquire);
                }
            }
        }, continuation);
    }

    @Override // com.strmr.ps.data.local.dao.PlaybackProgressDao
    public Object saveProgress(final PlaybackProgress playbackProgress, Continuation<? super e6a> continuation) {
        return mk1.b(this.__db, new Callable<e6a>() { // from class: com.strmr.ps.data.local.dao.PlaybackProgressDao_Impl.7
            /* JADX WARN: Can't rename method to resolve collision */
            @Override // java.util.concurrent.Callable
            @vo6
            public e6a call() throws Exception {
                PlaybackProgressDao_Impl.this.__db.beginTransaction();
                try {
                    PlaybackProgressDao_Impl.this.__insertionAdapterOfPlaybackProgress.insert(playbackProgress);
                    PlaybackProgressDao_Impl.this.__db.setTransactionSuccessful();
                    return e6a.a;
                } finally {
                    PlaybackProgressDao_Impl.this.__db.endTransaction();
                }
            }
        }, continuation);
    }
}
