package n4;

import android.content.Context;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.security.keystore.KeyGenParameterSpec;
import android.util.Base64;
import androidx.room.RoomDatabase;
import androidx.room.s0;
import androidx.room.t0;
import androidx.work.WorkInfo$State;
import com.google.android.gms.internal.ads.a80;
import com.google.android.gms.internal.ads.jg2;
import com.google.android.gms.internal.ads.lg2;
import com.google.android.gms.internal.ads.ni;
import com.google.android.gms.internal.ads.og2;
import com.google.android.gms.internal.ads.ot0;
import com.google.android.gms.internal.ads.pd0;
import com.google.android.gms.internal.ads.za2;
import com.google.android.gms.measurement.internal.u1;
import com.google.android.gms.stats.CodePackage;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.security.spec.AlgorithmParameterSpec;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import javax.crypto.Cipher;
import n7.f4;
import xyz.stream.download.config.InnerConstant;

/* JADX INFO: loaded from: classes.dex */
public final class r implements p {

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

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

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final Object f30840d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public Object f30841e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public Object f30842f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public Object f30843g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public Object f30844h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    public Object f30845i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public Object f30846j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    public Object f30847k;

    public r(a80 a80Var, Context context, String str, f4 f4Var) {
        this.f30837a = 1;
        this.f30841e = a80Var;
        this.f30838b = context;
        this.f30839c = f4Var;
        this.f30840d = str;
        this.f30842f = lg2.a(context);
        this.f30843g = lg2.a(f4Var);
        a80 a80Var2 = (a80) this.f30841e;
        this.f30844h = jg2.a(new ot0(a80Var2.f8543l, 8));
        this.f30845i = jg2.a(ni.R);
        og2 og2VarA = jg2.a(ni.G);
        this.f30846j = og2VarA;
        this.f30847k = jg2.a(new pd0((og2) this.f30842f, a80Var2.f8527d, (og2) this.f30843g, a80Var2.J, (og2) this.f30844h, (og2) this.f30845i, za2.C, og2VarA, 5));
    }

    public final int A(WorkInfo$State workInfo$State, String... strArr) {
        Object obj = this.f30838b;
        RoomDatabase roomDatabase = (RoomDatabase) obj;
        roomDatabase.assertNotSuspendingTransaction();
        StringBuilder sb = new StringBuilder("UPDATE workspec SET state=? WHERE id IN (");
        int length = strArr.length;
        for (int i10 = 0; i10 < length; i10++) {
            sb.append("?");
            if (i10 < length - 1) {
                sb.append(",");
            }
        }
        sb.append(")");
        l3.j jVarCompileStatement = roomDatabase.compileStatement(sb.toString());
        jVarCompileStatement.a(1, androidx.datastore.preferences.core.c.r(workInfo$State));
        int i11 = 2;
        for (String str : strArr) {
            if (str == null) {
                jVarCompileStatement.d(i11);
            } else {
                jVarCompileStatement.l(i11, str);
            }
            i11++;
        }
        roomDatabase.beginTransaction();
        try {
            int iN = jVarCompileStatement.n();
            ((RoomDatabase) obj).setTransactionSuccessful();
            return iN;
        } finally {
            roomDatabase.endTransaction();
        }
    }

    public final void B(String str, String str2) {
        e();
        SharedPreferences.Editor editorEdit = ((SharedPreferences) this.f30844h).edit();
        if (o()) {
            editorEdit.putString(str, str2);
        } else {
            editorEdit.putString(str, Base64.encodeToString(((com.it_nomads.fluttersecurestorage.ciphers.d) this.f30845i).a(str2.getBytes((Charset) this.f30839c)), 0));
        }
        editorEdit.apply();
    }

    public final void a(SharedPreferences sharedPreferences, SharedPreferences sharedPreferences2) {
        try {
            for (Map.Entry<String, ?> entry : sharedPreferences.getAll().entrySet()) {
                Object value = entry.getValue();
                String key = entry.getKey();
                if ((value instanceof String) && key.contains((String) this.f30841e)) {
                    sharedPreferences2.edit().putString(key, b((String) value)).apply();
                    sharedPreferences.edit().remove(key).apply();
                }
            }
            SharedPreferences.Editor editorEdit = sharedPreferences.edit();
            ((com.it_nomads.fluttersecurestorage.ciphers.e) this.f30846j).getClass();
            editorEdit.remove("FlutterSecureSAlgorithmKey");
            editorEdit.remove("FlutterSecureSAlgorithmStorage");
            editorEdit.apply();
        } catch (Exception unused) {
        }
    }

    public final String b(String str) {
        if (str == null) {
            return null;
        }
        byte[] bArrDecode = Base64.decode(str, 0);
        com.it_nomads.fluttersecurestorage.ciphers.d dVar = (com.it_nomads.fluttersecurestorage.ciphers.d) this.f30845i;
        int iD = dVar.d();
        byte[] bArr = new byte[iD];
        System.arraycopy(bArrDecode, 0, bArr, 0, iD);
        AlgorithmParameterSpec algorithmParameterSpecE = dVar.e(bArr);
        int length = bArrDecode.length - dVar.d();
        byte[] bArr2 = new byte[length];
        System.arraycopy(bArrDecode, iD, bArr2, 0, length);
        Cipher cipher = dVar.f24552a;
        cipher.init(2, dVar.f24554c, algorithmParameterSpecE);
        return new String(cipher.doFinal(bArr2), (Charset) this.f30839c);
    }

    public final void c(String str) {
        switch (this.f30837a) {
            case 0:
                Object obj = this.f30838b;
                RoomDatabase roomDatabase = (RoomDatabase) obj;
                roomDatabase.assertNotSuspendingTransaction();
                t0 t0Var = (t0) this.f30840d;
                l3.j jVarA = t0Var.a();
                if (str == null) {
                    jVarA.d(1);
                } else {
                    jVarA.l(1, str);
                }
                roomDatabase.beginTransaction();
                try {
                    jVarA.n();
                    ((RoomDatabase) obj).setTransactionSuccessful();
                    return;
                } finally {
                    roomDatabase.endTransaction();
                    t0Var.c(jVarA);
                }
            default:
                e();
                SharedPreferences.Editor editorEdit = ((SharedPreferences) this.f30844h).edit();
                editorEdit.remove(str);
                editorEdit.apply();
                return;
        }
    }

    public final void d() {
        e();
        SharedPreferences.Editor editorEdit = ((SharedPreferences) this.f30844h).edit();
        editorEdit.clear();
        if (!o()) {
            com.it_nomads.fluttersecurestorage.ciphers.e eVar = (com.it_nomads.fluttersecurestorage.ciphers.e) this.f30846j;
            editorEdit.putString("FlutterSecureSAlgorithmKey", eVar.f24557c.name());
            editorEdit.putString("FlutterSecureSAlgorithmStorage", eVar.f24558d.name());
        }
        editorEdit.apply();
    }

    public final void e() {
        f();
        Object obj = this.f30840d;
        SharedPreferences sharedPreferences = ((Context) obj).getSharedPreferences((String) this.f30843g, 0);
        if (((com.it_nomads.fluttersecurestorage.ciphers.d) this.f30845i) == null) {
            try {
                t(sharedPreferences);
            } catch (Exception unused) {
            }
        }
        if (!o()) {
            this.f30844h = sharedPreferences;
            return;
        }
        try {
            androidx.security.crypto.b bVarU = u((Context) obj);
            this.f30844h = bVarU;
            a(sharedPreferences, bVarU);
        } catch (Exception unused2) {
            this.f30844h = sharedPreferences;
            this.f30847k = Boolean.TRUE;
        }
    }

    public final void f() {
        if (((Map) this.f30842f).containsKey("sharedPreferencesName") && !((String) ((Map) this.f30842f).get("sharedPreferencesName")).isEmpty()) {
            this.f30843g = (String) ((Map) this.f30842f).get("sharedPreferencesName");
        }
        if (!((Map) this.f30842f).containsKey("preferencesKeyPrefix") || ((String) ((Map) this.f30842f).get("preferencesKeyPrefix")).isEmpty()) {
            return;
        }
        this.f30841e = (String) ((Map) this.f30842f).get("preferencesKeyPrefix");
    }

    public final ArrayList g() throws Throwable {
        s0 s0Var;
        int iA;
        int iA2;
        int iA3;
        int iA4;
        int iA5;
        int iA6;
        int iA7;
        int iA8;
        int iA9;
        int iA10;
        int iA11;
        int iA12;
        int iA13;
        int iA14;
        s0 s0VarK = s0.k(1, "SELECT `required_network_type`, `requires_charging`, `requires_device_idle`, `requires_battery_not_low`, `requires_storage_not_low`, `trigger_content_update_delay`, `trigger_max_content_delay`, `content_uri_triggers`, `WorkSpec`.`id` AS `id`, `WorkSpec`.`state` AS `state`, `WorkSpec`.`worker_class_name` AS `worker_class_name`, `WorkSpec`.`input_merger_class_name` AS `input_merger_class_name`, `WorkSpec`.`input` AS `input`, `WorkSpec`.`output` AS `output`, `WorkSpec`.`initial_delay` AS `initial_delay`, `WorkSpec`.`interval_duration` AS `interval_duration`, `WorkSpec`.`flex_duration` AS `flex_duration`, `WorkSpec`.`run_attempt_count` AS `run_attempt_count`, `WorkSpec`.`backoff_policy` AS `backoff_policy`, `WorkSpec`.`backoff_delay_duration` AS `backoff_delay_duration`, `WorkSpec`.`period_start_time` AS `period_start_time`, `WorkSpec`.`minimum_retention_duration` AS `minimum_retention_duration`, `WorkSpec`.`schedule_requested_at` AS `schedule_requested_at`, `WorkSpec`.`run_in_foreground` AS `run_in_foreground`, `WorkSpec`.`out_of_quota_policy` AS `out_of_quota_policy` FROM workspec WHERE state=0 ORDER BY period_start_time LIMIT ?");
        s0VarK.a(1, 200);
        RoomDatabase roomDatabase = (RoomDatabase) this.f30838b;
        roomDatabase.assertNotSuspendingTransaction();
        Cursor cursorC = androidx.room.util.b.c(roomDatabase, s0VarK);
        try {
            iA = androidx.room.util.a.a(cursorC, "required_network_type");
            iA2 = androidx.room.util.a.a(cursorC, "requires_charging");
            iA3 = androidx.room.util.a.a(cursorC, "requires_device_idle");
            iA4 = androidx.room.util.a.a(cursorC, "requires_battery_not_low");
            iA5 = androidx.room.util.a.a(cursorC, "requires_storage_not_low");
            iA6 = androidx.room.util.a.a(cursorC, "trigger_content_update_delay");
            iA7 = androidx.room.util.a.a(cursorC, "trigger_max_content_delay");
            iA8 = androidx.room.util.a.a(cursorC, "content_uri_triggers");
            iA9 = androidx.room.util.a.a(cursorC, InnerConstant.Db.f36069id);
            iA10 = androidx.room.util.a.a(cursorC, "state");
            iA11 = androidx.room.util.a.a(cursorC, "worker_class_name");
            iA12 = androidx.room.util.a.a(cursorC, "input_merger_class_name");
            iA13 = androidx.room.util.a.a(cursorC, "input");
            iA14 = androidx.room.util.a.a(cursorC, "output");
            s0Var = s0VarK;
        } catch (Throwable th) {
            th = th;
            s0Var = s0VarK;
        }
        try {
            int iA15 = androidx.room.util.a.a(cursorC, "initial_delay");
            int iA16 = androidx.room.util.a.a(cursorC, "interval_duration");
            int iA17 = androidx.room.util.a.a(cursorC, "flex_duration");
            int iA18 = androidx.room.util.a.a(cursorC, "run_attempt_count");
            int iA19 = androidx.room.util.a.a(cursorC, "backoff_policy");
            int iA20 = androidx.room.util.a.a(cursorC, "backoff_delay_duration");
            int iA21 = androidx.room.util.a.a(cursorC, "period_start_time");
            int iA22 = androidx.room.util.a.a(cursorC, "minimum_retention_duration");
            int iA23 = androidx.room.util.a.a(cursorC, "schedule_requested_at");
            int iA24 = androidx.room.util.a.a(cursorC, "run_in_foreground");
            int iA25 = androidx.room.util.a.a(cursorC, "out_of_quota_policy");
            int i10 = iA14;
            ArrayList arrayList = new ArrayList(cursorC.getCount());
            while (cursorC.moveToNext()) {
                String string = cursorC.getString(iA9);
                int i11 = iA9;
                String string2 = cursorC.getString(iA11);
                int i12 = iA11;
                androidx.work.e eVar = new androidx.work.e();
                int i13 = iA;
                eVar.f4549a = androidx.datastore.preferences.core.c.j(cursorC.getInt(iA));
                eVar.f4550b = cursorC.getInt(iA2) != 0;
                eVar.f4551c = cursorC.getInt(iA3) != 0;
                eVar.f4552d = cursorC.getInt(iA4) != 0;
                eVar.f4553e = cursorC.getInt(iA5) != 0;
                int i14 = iA2;
                int i15 = iA3;
                eVar.f4554f = cursorC.getLong(iA6);
                eVar.f4555g = cursorC.getLong(iA7);
                eVar.setContentUriTriggers(androidx.datastore.preferences.core.c.a(cursorC.getBlob(iA8)));
                o oVar = new o(string, string2);
                oVar.f30819b = androidx.datastore.preferences.core.c.l(cursorC.getInt(iA10));
                oVar.f30821d = cursorC.getString(iA12);
                oVar.f30822e = androidx.work.i.a(cursorC.getBlob(iA13));
                int i16 = i10;
                oVar.f30823f = androidx.work.i.a(cursorC.getBlob(i16));
                int i17 = iA13;
                int i18 = iA15;
                oVar.f30824g = cursorC.getLong(i18);
                int i19 = iA4;
                int i20 = iA16;
                oVar.f30825h = cursorC.getLong(i20);
                int i21 = iA17;
                oVar.f30826i = cursorC.getLong(i21);
                int i22 = iA18;
                oVar.f30828k = cursorC.getInt(i22);
                int i23 = iA19;
                oVar.f30829l = androidx.datastore.preferences.core.c.i(cursorC.getInt(i23));
                int i24 = iA20;
                oVar.f30830m = cursorC.getLong(i24);
                int i25 = iA21;
                oVar.f30831n = cursorC.getLong(i25);
                int i26 = iA22;
                oVar.f30832o = cursorC.getLong(i26);
                int i27 = iA23;
                oVar.f30833p = cursorC.getLong(i27);
                int i28 = iA24;
                oVar.f30834q = cursorC.getInt(i28) != 0;
                int i29 = iA25;
                oVar.f30835r = androidx.datastore.preferences.core.c.k(cursorC.getInt(i29));
                oVar.f30827j = eVar;
                arrayList.add(oVar);
                i10 = i16;
                iA2 = i14;
                iA15 = i18;
                iA16 = i20;
                iA20 = i24;
                iA21 = i25;
                iA24 = i28;
                iA11 = i12;
                iA = i13;
                iA25 = i29;
                iA23 = i27;
                iA13 = i17;
                iA9 = i11;
                iA3 = i15;
                iA22 = i26;
                iA4 = i19;
                iA17 = i21;
                iA18 = i22;
                iA19 = i23;
            }
            cursorC.close();
            s0Var.m();
            return arrayList;
        } catch (Throwable th2) {
            th = th2;
            cursorC.close();
            s0Var.m();
            throw th;
        }
    }

    public final ArrayList h(int i10) throws Throwable {
        s0 s0Var;
        int iA;
        int iA2;
        int iA3;
        int iA4;
        int iA5;
        int iA6;
        int iA7;
        int iA8;
        int iA9;
        int iA10;
        int iA11;
        int iA12;
        int iA13;
        int iA14;
        s0 s0VarK = s0.k(1, "SELECT `required_network_type`, `requires_charging`, `requires_device_idle`, `requires_battery_not_low`, `requires_storage_not_low`, `trigger_content_update_delay`, `trigger_max_content_delay`, `content_uri_triggers`, `WorkSpec`.`id` AS `id`, `WorkSpec`.`state` AS `state`, `WorkSpec`.`worker_class_name` AS `worker_class_name`, `WorkSpec`.`input_merger_class_name` AS `input_merger_class_name`, `WorkSpec`.`input` AS `input`, `WorkSpec`.`output` AS `output`, `WorkSpec`.`initial_delay` AS `initial_delay`, `WorkSpec`.`interval_duration` AS `interval_duration`, `WorkSpec`.`flex_duration` AS `flex_duration`, `WorkSpec`.`run_attempt_count` AS `run_attempt_count`, `WorkSpec`.`backoff_policy` AS `backoff_policy`, `WorkSpec`.`backoff_delay_duration` AS `backoff_delay_duration`, `WorkSpec`.`period_start_time` AS `period_start_time`, `WorkSpec`.`minimum_retention_duration` AS `minimum_retention_duration`, `WorkSpec`.`schedule_requested_at` AS `schedule_requested_at`, `WorkSpec`.`run_in_foreground` AS `run_in_foreground`, `WorkSpec`.`out_of_quota_policy` AS `out_of_quota_policy` FROM workspec WHERE state=0 AND schedule_requested_at=-1 ORDER BY period_start_time LIMIT (SELECT MAX(?-COUNT(*), 0) FROM workspec WHERE schedule_requested_at<>-1 AND state NOT IN (2, 3, 5))");
        s0VarK.a(1, i10);
        RoomDatabase roomDatabase = (RoomDatabase) this.f30838b;
        roomDatabase.assertNotSuspendingTransaction();
        Cursor cursorC = androidx.room.util.b.c(roomDatabase, s0VarK);
        try {
            iA = androidx.room.util.a.a(cursorC, "required_network_type");
            iA2 = androidx.room.util.a.a(cursorC, "requires_charging");
            iA3 = androidx.room.util.a.a(cursorC, "requires_device_idle");
            iA4 = androidx.room.util.a.a(cursorC, "requires_battery_not_low");
            iA5 = androidx.room.util.a.a(cursorC, "requires_storage_not_low");
            iA6 = androidx.room.util.a.a(cursorC, "trigger_content_update_delay");
            iA7 = androidx.room.util.a.a(cursorC, "trigger_max_content_delay");
            iA8 = androidx.room.util.a.a(cursorC, "content_uri_triggers");
            iA9 = androidx.room.util.a.a(cursorC, InnerConstant.Db.f36069id);
            iA10 = androidx.room.util.a.a(cursorC, "state");
            iA11 = androidx.room.util.a.a(cursorC, "worker_class_name");
            iA12 = androidx.room.util.a.a(cursorC, "input_merger_class_name");
            iA13 = androidx.room.util.a.a(cursorC, "input");
            iA14 = androidx.room.util.a.a(cursorC, "output");
            s0Var = s0VarK;
        } catch (Throwable th) {
            th = th;
            s0Var = s0VarK;
        }
        try {
            int iA15 = androidx.room.util.a.a(cursorC, "initial_delay");
            int iA16 = androidx.room.util.a.a(cursorC, "interval_duration");
            int iA17 = androidx.room.util.a.a(cursorC, "flex_duration");
            int iA18 = androidx.room.util.a.a(cursorC, "run_attempt_count");
            int iA19 = androidx.room.util.a.a(cursorC, "backoff_policy");
            int iA20 = androidx.room.util.a.a(cursorC, "backoff_delay_duration");
            int iA21 = androidx.room.util.a.a(cursorC, "period_start_time");
            int iA22 = androidx.room.util.a.a(cursorC, "minimum_retention_duration");
            int iA23 = androidx.room.util.a.a(cursorC, "schedule_requested_at");
            int iA24 = androidx.room.util.a.a(cursorC, "run_in_foreground");
            int iA25 = androidx.room.util.a.a(cursorC, "out_of_quota_policy");
            int i11 = iA14;
            ArrayList arrayList = new ArrayList(cursorC.getCount());
            while (cursorC.moveToNext()) {
                String string = cursorC.getString(iA9);
                int i12 = iA9;
                String string2 = cursorC.getString(iA11);
                int i13 = iA11;
                androidx.work.e eVar = new androidx.work.e();
                int i14 = iA;
                eVar.f4549a = androidx.datastore.preferences.core.c.j(cursorC.getInt(iA));
                eVar.f4550b = cursorC.getInt(iA2) != 0;
                eVar.f4551c = cursorC.getInt(iA3) != 0;
                eVar.f4552d = cursorC.getInt(iA4) != 0;
                eVar.f4553e = cursorC.getInt(iA5) != 0;
                int i15 = iA2;
                int i16 = iA3;
                eVar.f4554f = cursorC.getLong(iA6);
                eVar.f4555g = cursorC.getLong(iA7);
                eVar.setContentUriTriggers(androidx.datastore.preferences.core.c.a(cursorC.getBlob(iA8)));
                o oVar = new o(string, string2);
                oVar.f30819b = androidx.datastore.preferences.core.c.l(cursorC.getInt(iA10));
                oVar.f30821d = cursorC.getString(iA12);
                oVar.f30822e = androidx.work.i.a(cursorC.getBlob(iA13));
                int i17 = i11;
                oVar.f30823f = androidx.work.i.a(cursorC.getBlob(i17));
                int i18 = iA15;
                int i19 = iA13;
                oVar.f30824g = cursorC.getLong(i18);
                int i20 = iA4;
                int i21 = iA16;
                oVar.f30825h = cursorC.getLong(i21);
                int i22 = iA17;
                oVar.f30826i = cursorC.getLong(i22);
                int i23 = iA18;
                oVar.f30828k = cursorC.getInt(i23);
                int i24 = iA19;
                oVar.f30829l = androidx.datastore.preferences.core.c.i(cursorC.getInt(i24));
                int i25 = iA20;
                oVar.f30830m = cursorC.getLong(i25);
                int i26 = iA21;
                oVar.f30831n = cursorC.getLong(i26);
                int i27 = iA22;
                oVar.f30832o = cursorC.getLong(i27);
                int i28 = iA23;
                oVar.f30833p = cursorC.getLong(i28);
                int i29 = iA24;
                oVar.f30834q = cursorC.getInt(i29) != 0;
                int i30 = iA25;
                oVar.f30835r = androidx.datastore.preferences.core.c.k(cursorC.getInt(i30));
                oVar.f30827j = eVar;
                arrayList.add(oVar);
                i11 = i17;
                iA2 = i15;
                iA24 = i29;
                iA9 = i12;
                iA11 = i13;
                iA = i14;
                iA25 = i30;
                iA13 = i19;
                iA15 = i18;
                iA16 = i21;
                iA20 = i25;
                iA21 = i26;
                iA23 = i28;
                iA3 = i16;
                iA22 = i27;
                iA4 = i20;
                iA17 = i22;
                iA18 = i23;
                iA19 = i24;
            }
            cursorC.close();
            s0Var.m();
            return arrayList;
        } catch (Throwable th2) {
            th = th2;
            cursorC.close();
            s0Var.m();
            throw th;
        }
    }

    public final boolean i() {
        return ((Map) this.f30842f).containsKey("resetOnError") && ((Map) this.f30842f).get("resetOnError").equals("true");
    }

    public final ArrayList j() throws Throwable {
        s0 s0Var;
        s0 s0VarK = s0.k(0, "SELECT `required_network_type`, `requires_charging`, `requires_device_idle`, `requires_battery_not_low`, `requires_storage_not_low`, `trigger_content_update_delay`, `trigger_max_content_delay`, `content_uri_triggers`, `WorkSpec`.`id` AS `id`, `WorkSpec`.`state` AS `state`, `WorkSpec`.`worker_class_name` AS `worker_class_name`, `WorkSpec`.`input_merger_class_name` AS `input_merger_class_name`, `WorkSpec`.`input` AS `input`, `WorkSpec`.`output` AS `output`, `WorkSpec`.`initial_delay` AS `initial_delay`, `WorkSpec`.`interval_duration` AS `interval_duration`, `WorkSpec`.`flex_duration` AS `flex_duration`, `WorkSpec`.`run_attempt_count` AS `run_attempt_count`, `WorkSpec`.`backoff_policy` AS `backoff_policy`, `WorkSpec`.`backoff_delay_duration` AS `backoff_delay_duration`, `WorkSpec`.`period_start_time` AS `period_start_time`, `WorkSpec`.`minimum_retention_duration` AS `minimum_retention_duration`, `WorkSpec`.`schedule_requested_at` AS `schedule_requested_at`, `WorkSpec`.`run_in_foreground` AS `run_in_foreground`, `WorkSpec`.`out_of_quota_policy` AS `out_of_quota_policy` FROM workspec WHERE state=1");
        RoomDatabase roomDatabase = (RoomDatabase) this.f30838b;
        roomDatabase.assertNotSuspendingTransaction();
        Cursor cursorC = androidx.room.util.b.c(roomDatabase, s0VarK);
        try {
            int iA = androidx.room.util.a.a(cursorC, "required_network_type");
            int iA2 = androidx.room.util.a.a(cursorC, "requires_charging");
            int iA3 = androidx.room.util.a.a(cursorC, "requires_device_idle");
            int iA4 = androidx.room.util.a.a(cursorC, "requires_battery_not_low");
            int iA5 = androidx.room.util.a.a(cursorC, "requires_storage_not_low");
            int iA6 = androidx.room.util.a.a(cursorC, "trigger_content_update_delay");
            int iA7 = androidx.room.util.a.a(cursorC, "trigger_max_content_delay");
            int iA8 = androidx.room.util.a.a(cursorC, "content_uri_triggers");
            int iA9 = androidx.room.util.a.a(cursorC, InnerConstant.Db.f36069id);
            int iA10 = androidx.room.util.a.a(cursorC, "state");
            int iA11 = androidx.room.util.a.a(cursorC, "worker_class_name");
            int iA12 = androidx.room.util.a.a(cursorC, "input_merger_class_name");
            int iA13 = androidx.room.util.a.a(cursorC, "input");
            int iA14 = androidx.room.util.a.a(cursorC, "output");
            s0Var = s0VarK;
            try {
                int iA15 = androidx.room.util.a.a(cursorC, "initial_delay");
                int iA16 = androidx.room.util.a.a(cursorC, "interval_duration");
                int iA17 = androidx.room.util.a.a(cursorC, "flex_duration");
                int iA18 = androidx.room.util.a.a(cursorC, "run_attempt_count");
                int iA19 = androidx.room.util.a.a(cursorC, "backoff_policy");
                int iA20 = androidx.room.util.a.a(cursorC, "backoff_delay_duration");
                int iA21 = androidx.room.util.a.a(cursorC, "period_start_time");
                int iA22 = androidx.room.util.a.a(cursorC, "minimum_retention_duration");
                int iA23 = androidx.room.util.a.a(cursorC, "schedule_requested_at");
                int iA24 = androidx.room.util.a.a(cursorC, "run_in_foreground");
                int iA25 = androidx.room.util.a.a(cursorC, "out_of_quota_policy");
                int i10 = iA14;
                ArrayList arrayList = new ArrayList(cursorC.getCount());
                while (cursorC.moveToNext()) {
                    String string = cursorC.getString(iA9);
                    int i11 = iA9;
                    String string2 = cursorC.getString(iA11);
                    int i12 = iA11;
                    androidx.work.e eVar = new androidx.work.e();
                    int i13 = iA;
                    eVar.f4549a = androidx.datastore.preferences.core.c.j(cursorC.getInt(iA));
                    eVar.f4550b = cursorC.getInt(iA2) != 0;
                    eVar.f4551c = cursorC.getInt(iA3) != 0;
                    eVar.f4552d = cursorC.getInt(iA4) != 0;
                    eVar.f4553e = cursorC.getInt(iA5) != 0;
                    int i14 = iA2;
                    int i15 = iA3;
                    eVar.f4554f = cursorC.getLong(iA6);
                    eVar.f4555g = cursorC.getLong(iA7);
                    eVar.setContentUriTriggers(androidx.datastore.preferences.core.c.a(cursorC.getBlob(iA8)));
                    o oVar = new o(string, string2);
                    oVar.f30819b = androidx.datastore.preferences.core.c.l(cursorC.getInt(iA10));
                    oVar.f30821d = cursorC.getString(iA12);
                    oVar.f30822e = androidx.work.i.a(cursorC.getBlob(iA13));
                    int i16 = i10;
                    oVar.f30823f = androidx.work.i.a(cursorC.getBlob(i16));
                    int i17 = iA13;
                    int i18 = iA15;
                    oVar.f30824g = cursorC.getLong(i18);
                    int i19 = iA4;
                    int i20 = iA16;
                    oVar.f30825h = cursorC.getLong(i20);
                    int i21 = iA17;
                    oVar.f30826i = cursorC.getLong(i21);
                    int i22 = iA18;
                    oVar.f30828k = cursorC.getInt(i22);
                    int i23 = iA19;
                    oVar.f30829l = androidx.datastore.preferences.core.c.i(cursorC.getInt(i23));
                    int i24 = iA20;
                    oVar.f30830m = cursorC.getLong(i24);
                    int i25 = iA21;
                    oVar.f30831n = cursorC.getLong(i25);
                    int i26 = iA22;
                    oVar.f30832o = cursorC.getLong(i26);
                    int i27 = iA23;
                    oVar.f30833p = cursorC.getLong(i27);
                    int i28 = iA24;
                    oVar.f30834q = cursorC.getInt(i28) != 0;
                    int i29 = iA25;
                    oVar.f30835r = androidx.datastore.preferences.core.c.k(cursorC.getInt(i29));
                    oVar.f30827j = eVar;
                    arrayList.add(oVar);
                    i10 = i16;
                    iA2 = i14;
                    iA15 = i18;
                    iA16 = i20;
                    iA20 = i24;
                    iA21 = i25;
                    iA24 = i28;
                    iA11 = i12;
                    iA = i13;
                    iA25 = i29;
                    iA23 = i27;
                    iA13 = i17;
                    iA9 = i11;
                    iA3 = i15;
                    iA22 = i26;
                    iA4 = i19;
                    iA17 = i21;
                    iA18 = i22;
                    iA19 = i23;
                }
                cursorC.close();
                s0Var.m();
                return arrayList;
            } catch (Throwable th) {
                th = th;
                cursorC.close();
                s0Var.m();
                throw th;
            }
        } catch (Throwable th2) {
            th = th2;
            s0Var = s0VarK;
        }
    }

    public final ArrayList k() {
        s0 s0Var;
        s0 s0VarK = s0.k(0, "SELECT `required_network_type`, `requires_charging`, `requires_device_idle`, `requires_battery_not_low`, `requires_storage_not_low`, `trigger_content_update_delay`, `trigger_max_content_delay`, `content_uri_triggers`, `WorkSpec`.`id` AS `id`, `WorkSpec`.`state` AS `state`, `WorkSpec`.`worker_class_name` AS `worker_class_name`, `WorkSpec`.`input_merger_class_name` AS `input_merger_class_name`, `WorkSpec`.`input` AS `input`, `WorkSpec`.`output` AS `output`, `WorkSpec`.`initial_delay` AS `initial_delay`, `WorkSpec`.`interval_duration` AS `interval_duration`, `WorkSpec`.`flex_duration` AS `flex_duration`, `WorkSpec`.`run_attempt_count` AS `run_attempt_count`, `WorkSpec`.`backoff_policy` AS `backoff_policy`, `WorkSpec`.`backoff_delay_duration` AS `backoff_delay_duration`, `WorkSpec`.`period_start_time` AS `period_start_time`, `WorkSpec`.`minimum_retention_duration` AS `minimum_retention_duration`, `WorkSpec`.`schedule_requested_at` AS `schedule_requested_at`, `WorkSpec`.`run_in_foreground` AS `run_in_foreground`, `WorkSpec`.`out_of_quota_policy` AS `out_of_quota_policy` FROM workspec WHERE state=0 AND schedule_requested_at<>-1");
        RoomDatabase roomDatabase = (RoomDatabase) this.f30838b;
        roomDatabase.assertNotSuspendingTransaction();
        Cursor cursorC = androidx.room.util.b.c(roomDatabase, s0VarK);
        try {
            int iA = androidx.room.util.a.a(cursorC, "required_network_type");
            int iA2 = androidx.room.util.a.a(cursorC, "requires_charging");
            int iA3 = androidx.room.util.a.a(cursorC, "requires_device_idle");
            int iA4 = androidx.room.util.a.a(cursorC, "requires_battery_not_low");
            int iA5 = androidx.room.util.a.a(cursorC, "requires_storage_not_low");
            int iA6 = androidx.room.util.a.a(cursorC, "trigger_content_update_delay");
            int iA7 = androidx.room.util.a.a(cursorC, "trigger_max_content_delay");
            int iA8 = androidx.room.util.a.a(cursorC, "content_uri_triggers");
            int iA9 = androidx.room.util.a.a(cursorC, InnerConstant.Db.f36069id);
            int iA10 = androidx.room.util.a.a(cursorC, "state");
            int iA11 = androidx.room.util.a.a(cursorC, "worker_class_name");
            int iA12 = androidx.room.util.a.a(cursorC, "input_merger_class_name");
            int iA13 = androidx.room.util.a.a(cursorC, "input");
            int iA14 = androidx.room.util.a.a(cursorC, "output");
            s0Var = s0VarK;
            try {
                int iA15 = androidx.room.util.a.a(cursorC, "initial_delay");
                int iA16 = androidx.room.util.a.a(cursorC, "interval_duration");
                int iA17 = androidx.room.util.a.a(cursorC, "flex_duration");
                int iA18 = androidx.room.util.a.a(cursorC, "run_attempt_count");
                int iA19 = androidx.room.util.a.a(cursorC, "backoff_policy");
                int iA20 = androidx.room.util.a.a(cursorC, "backoff_delay_duration");
                int iA21 = androidx.room.util.a.a(cursorC, "period_start_time");
                int iA22 = androidx.room.util.a.a(cursorC, "minimum_retention_duration");
                int iA23 = androidx.room.util.a.a(cursorC, "schedule_requested_at");
                int iA24 = androidx.room.util.a.a(cursorC, "run_in_foreground");
                int iA25 = androidx.room.util.a.a(cursorC, "out_of_quota_policy");
                int i10 = iA14;
                ArrayList arrayList = new ArrayList(cursorC.getCount());
                while (cursorC.moveToNext()) {
                    String string = cursorC.getString(iA9);
                    int i11 = iA9;
                    String string2 = cursorC.getString(iA11);
                    int i12 = iA11;
                    androidx.work.e eVar = new androidx.work.e();
                    int i13 = iA;
                    eVar.f4549a = androidx.datastore.preferences.core.c.j(cursorC.getInt(iA));
                    eVar.f4550b = cursorC.getInt(iA2) != 0;
                    eVar.f4551c = cursorC.getInt(iA3) != 0;
                    eVar.f4552d = cursorC.getInt(iA4) != 0;
                    eVar.f4553e = cursorC.getInt(iA5) != 0;
                    int i14 = iA2;
                    int i15 = iA3;
                    eVar.f4554f = cursorC.getLong(iA6);
                    eVar.f4555g = cursorC.getLong(iA7);
                    eVar.setContentUriTriggers(androidx.datastore.preferences.core.c.a(cursorC.getBlob(iA8)));
                    o oVar = new o(string, string2);
                    oVar.f30819b = androidx.datastore.preferences.core.c.l(cursorC.getInt(iA10));
                    oVar.f30821d = cursorC.getString(iA12);
                    oVar.f30822e = androidx.work.i.a(cursorC.getBlob(iA13));
                    int i16 = i10;
                    oVar.f30823f = androidx.work.i.a(cursorC.getBlob(i16));
                    int i17 = iA13;
                    int i18 = iA15;
                    oVar.f30824g = cursorC.getLong(i18);
                    int i19 = iA4;
                    int i20 = iA16;
                    oVar.f30825h = cursorC.getLong(i20);
                    int i21 = iA17;
                    oVar.f30826i = cursorC.getLong(i21);
                    int i22 = iA18;
                    oVar.f30828k = cursorC.getInt(i22);
                    int i23 = iA19;
                    oVar.f30829l = androidx.datastore.preferences.core.c.i(cursorC.getInt(i23));
                    int i24 = iA20;
                    oVar.f30830m = cursorC.getLong(i24);
                    int i25 = iA21;
                    oVar.f30831n = cursorC.getLong(i25);
                    int i26 = iA22;
                    oVar.f30832o = cursorC.getLong(i26);
                    int i27 = iA23;
                    oVar.f30833p = cursorC.getLong(i27);
                    int i28 = iA24;
                    oVar.f30834q = cursorC.getInt(i28) != 0;
                    int i29 = iA25;
                    oVar.f30835r = androidx.datastore.preferences.core.c.k(cursorC.getInt(i29));
                    oVar.f30827j = eVar;
                    arrayList.add(oVar);
                    i10 = i16;
                    iA2 = i14;
                    iA15 = i18;
                    iA16 = i20;
                    iA20 = i24;
                    iA21 = i25;
                    iA24 = i28;
                    iA11 = i12;
                    iA = i13;
                    iA25 = i29;
                    iA23 = i27;
                    iA13 = i17;
                    iA9 = i11;
                    iA3 = i15;
                    iA22 = i26;
                    iA4 = i19;
                    iA17 = i21;
                    iA18 = i22;
                    iA19 = i23;
                }
                cursorC.close();
                s0Var.m();
                return arrayList;
            } catch (Throwable th) {
                th = th;
                cursorC.close();
                s0Var.m();
                throw th;
            }
        } catch (Throwable th2) {
            th = th2;
            s0Var = s0VarK;
        }
    }

    public final WorkInfo$State l(String str) {
        s0 s0VarK = s0.k(1, "SELECT state FROM workspec WHERE id=?");
        if (str == null) {
            s0VarK.d(1);
        } else {
            s0VarK.l(1, str);
        }
        RoomDatabase roomDatabase = (RoomDatabase) this.f30838b;
        roomDatabase.assertNotSuspendingTransaction();
        Cursor cursorC = androidx.room.util.b.c(roomDatabase, s0VarK);
        try {
            return cursorC.moveToFirst() ? androidx.datastore.preferences.core.c.l(cursorC.getInt(0)) : null;
        } finally {
            cursorC.close();
            s0VarK.m();
        }
    }

    public final ArrayList m(String str) {
        s0 s0VarK = s0.k(1, "SELECT id FROM workspec WHERE state NOT IN (2, 3, 5) AND id IN (SELECT work_spec_id FROM workname WHERE name=?)");
        if (str == null) {
            s0VarK.d(1);
        } else {
            s0VarK.l(1, str);
        }
        RoomDatabase roomDatabase = (RoomDatabase) this.f30838b;
        roomDatabase.assertNotSuspendingTransaction();
        Cursor cursorC = androidx.room.util.b.c(roomDatabase, s0VarK);
        try {
            ArrayList arrayList = new ArrayList(cursorC.getCount());
            while (cursorC.moveToNext()) {
                arrayList.add(cursorC.getString(0));
            }
            return arrayList;
        } finally {
            cursorC.close();
            s0VarK.m();
        }
    }

    public final ArrayList n(String str) {
        s0 s0VarK = s0.k(1, "SELECT id FROM workspec WHERE state NOT IN (2, 3, 5) AND id IN (SELECT work_spec_id FROM worktag WHERE tag=?)");
        if (str == null) {
            s0VarK.d(1);
        } else {
            s0VarK.l(1, str);
        }
        RoomDatabase roomDatabase = (RoomDatabase) this.f30838b;
        roomDatabase.assertNotSuspendingTransaction();
        Cursor cursorC = androidx.room.util.b.c(roomDatabase, s0VarK);
        try {
            ArrayList arrayList = new ArrayList(cursorC.getCount());
            while (cursorC.moveToNext()) {
                arrayList.add(cursorC.getString(0));
            }
            return arrayList;
        } finally {
            cursorC.close();
            s0VarK.m();
        }
    }

    public final boolean o() {
        return !((Boolean) this.f30847k).booleanValue() && ((Map) this.f30842f).containsKey("encryptedSharedPreferences") && ((Map) this.f30842f).get("encryptedSharedPreferences").equals("true");
    }

    public final o p(String str) {
        s0 s0Var;
        o oVar;
        s0 s0VarK = s0.k(1, "SELECT `required_network_type`, `requires_charging`, `requires_device_idle`, `requires_battery_not_low`, `requires_storage_not_low`, `trigger_content_update_delay`, `trigger_max_content_delay`, `content_uri_triggers`, `WorkSpec`.`id` AS `id`, `WorkSpec`.`state` AS `state`, `WorkSpec`.`worker_class_name` AS `worker_class_name`, `WorkSpec`.`input_merger_class_name` AS `input_merger_class_name`, `WorkSpec`.`input` AS `input`, `WorkSpec`.`output` AS `output`, `WorkSpec`.`initial_delay` AS `initial_delay`, `WorkSpec`.`interval_duration` AS `interval_duration`, `WorkSpec`.`flex_duration` AS `flex_duration`, `WorkSpec`.`run_attempt_count` AS `run_attempt_count`, `WorkSpec`.`backoff_policy` AS `backoff_policy`, `WorkSpec`.`backoff_delay_duration` AS `backoff_delay_duration`, `WorkSpec`.`period_start_time` AS `period_start_time`, `WorkSpec`.`minimum_retention_duration` AS `minimum_retention_duration`, `WorkSpec`.`schedule_requested_at` AS `schedule_requested_at`, `WorkSpec`.`run_in_foreground` AS `run_in_foreground`, `WorkSpec`.`out_of_quota_policy` AS `out_of_quota_policy` FROM workspec WHERE id=?");
        if (str == null) {
            s0VarK.d(1);
        } else {
            s0VarK.l(1, str);
        }
        RoomDatabase roomDatabase = (RoomDatabase) this.f30838b;
        roomDatabase.assertNotSuspendingTransaction();
        Cursor cursorC = androidx.room.util.b.c(roomDatabase, s0VarK);
        try {
            int iA = androidx.room.util.a.a(cursorC, "required_network_type");
            int iA2 = androidx.room.util.a.a(cursorC, "requires_charging");
            int iA3 = androidx.room.util.a.a(cursorC, "requires_device_idle");
            int iA4 = androidx.room.util.a.a(cursorC, "requires_battery_not_low");
            int iA5 = androidx.room.util.a.a(cursorC, "requires_storage_not_low");
            int iA6 = androidx.room.util.a.a(cursorC, "trigger_content_update_delay");
            int iA7 = androidx.room.util.a.a(cursorC, "trigger_max_content_delay");
            int iA8 = androidx.room.util.a.a(cursorC, "content_uri_triggers");
            int iA9 = androidx.room.util.a.a(cursorC, InnerConstant.Db.f36069id);
            int iA10 = androidx.room.util.a.a(cursorC, "state");
            int iA11 = androidx.room.util.a.a(cursorC, "worker_class_name");
            int iA12 = androidx.room.util.a.a(cursorC, "input_merger_class_name");
            int iA13 = androidx.room.util.a.a(cursorC, "input");
            int iA14 = androidx.room.util.a.a(cursorC, "output");
            s0Var = s0VarK;
            try {
                int iA15 = androidx.room.util.a.a(cursorC, "initial_delay");
                int iA16 = androidx.room.util.a.a(cursorC, "interval_duration");
                int iA17 = androidx.room.util.a.a(cursorC, "flex_duration");
                int iA18 = androidx.room.util.a.a(cursorC, "run_attempt_count");
                int iA19 = androidx.room.util.a.a(cursorC, "backoff_policy");
                int iA20 = androidx.room.util.a.a(cursorC, "backoff_delay_duration");
                int iA21 = androidx.room.util.a.a(cursorC, "period_start_time");
                int iA22 = androidx.room.util.a.a(cursorC, "minimum_retention_duration");
                int iA23 = androidx.room.util.a.a(cursorC, "schedule_requested_at");
                int iA24 = androidx.room.util.a.a(cursorC, "run_in_foreground");
                int iA25 = androidx.room.util.a.a(cursorC, "out_of_quota_policy");
                if (cursorC.moveToFirst()) {
                    String string = cursorC.getString(iA9);
                    String string2 = cursorC.getString(iA11);
                    androidx.work.e eVar = new androidx.work.e();
                    eVar.f4549a = androidx.datastore.preferences.core.c.j(cursorC.getInt(iA));
                    eVar.f4550b = cursorC.getInt(iA2) != 0;
                    eVar.f4551c = cursorC.getInt(iA3) != 0;
                    eVar.f4552d = cursorC.getInt(iA4) != 0;
                    eVar.f4553e = cursorC.getInt(iA5) != 0;
                    eVar.f4554f = cursorC.getLong(iA6);
                    eVar.f4555g = cursorC.getLong(iA7);
                    eVar.setContentUriTriggers(androidx.datastore.preferences.core.c.a(cursorC.getBlob(iA8)));
                    oVar = new o(string, string2);
                    oVar.f30819b = androidx.datastore.preferences.core.c.l(cursorC.getInt(iA10));
                    oVar.f30821d = cursorC.getString(iA12);
                    oVar.f30822e = androidx.work.i.a(cursorC.getBlob(iA13));
                    oVar.f30823f = androidx.work.i.a(cursorC.getBlob(iA14));
                    oVar.f30824g = cursorC.getLong(iA15);
                    oVar.f30825h = cursorC.getLong(iA16);
                    oVar.f30826i = cursorC.getLong(iA17);
                    oVar.f30828k = cursorC.getInt(iA18);
                    oVar.f30829l = androidx.datastore.preferences.core.c.i(cursorC.getInt(iA19));
                    oVar.f30830m = cursorC.getLong(iA20);
                    oVar.f30831n = cursorC.getLong(iA21);
                    oVar.f30832o = cursorC.getLong(iA22);
                    oVar.f30833p = cursorC.getLong(iA23);
                    oVar.f30834q = cursorC.getInt(iA24) != 0;
                    oVar.f30835r = androidx.datastore.preferences.core.c.k(cursorC.getInt(iA25));
                    oVar.f30827j = eVar;
                } else {
                    oVar = null;
                }
                cursorC.close();
                s0Var.m();
                return oVar;
            } catch (Throwable th) {
                th = th;
                cursorC.close();
                s0Var.m();
                throw th;
            }
        } catch (Throwable th2) {
            th = th2;
            s0Var = s0VarK;
        }
    }

    public final ArrayList q(String str) {
        s0 s0VarK = s0.k(1, "SELECT id, state FROM workspec WHERE id IN (SELECT work_spec_id FROM workname WHERE name=?)");
        if (str == null) {
            s0VarK.d(1);
        } else {
            s0VarK.l(1, str);
        }
        RoomDatabase roomDatabase = (RoomDatabase) this.f30838b;
        roomDatabase.assertNotSuspendingTransaction();
        Cursor cursorC = androidx.room.util.b.c(roomDatabase, s0VarK);
        try {
            int iA = androidx.room.util.a.a(cursorC, InnerConstant.Db.f36069id);
            int iA2 = androidx.room.util.a.a(cursorC, "state");
            ArrayList arrayList = new ArrayList(cursorC.getCount());
            while (cursorC.moveToNext()) {
                n nVar = new n();
                nVar.f30816a = cursorC.getString(iA);
                nVar.f30817b = androidx.datastore.preferences.core.c.l(cursorC.getInt(iA2));
                arrayList.add(nVar);
            }
            return arrayList;
        } finally {
            cursorC.close();
            s0VarK.m();
        }
    }

    public final boolean r() {
        boolean z10 = false;
        s0 s0VarK = s0.k(0, "SELECT COUNT(*) > 0 FROM workspec WHERE state NOT IN (2, 3, 5) LIMIT 1");
        RoomDatabase roomDatabase = (RoomDatabase) this.f30838b;
        roomDatabase.assertNotSuspendingTransaction();
        Cursor cursorC = androidx.room.util.b.c(roomDatabase, s0VarK);
        try {
            if (cursorC.moveToFirst()) {
                if (cursorC.getInt(0) != 0) {
                    z10 = true;
                }
            }
            return z10;
        } finally {
            cursorC.close();
            s0VarK.m();
        }
    }

    public final int s(String str) {
        Object obj = this.f30838b;
        ((RoomDatabase) obj).assertNotSuspendingTransaction();
        l3.j jVarA = ((t0) this.f30843g).a();
        if (str == null) {
            jVarA.d(1);
        } else {
            jVarA.l(1, str);
        }
        ((RoomDatabase) obj).beginTransaction();
        try {
            int iN = jVarA.n();
            ((RoomDatabase) obj).setTransactionSuccessful();
            return iN;
        } finally {
            ((RoomDatabase) obj).endTransaction();
            ((t0) this.f30843g).c(jVarA);
        }
    }

    public final void t(SharedPreferences sharedPreferences) {
        this.f30846j = new com.it_nomads.fluttersecurestorage.ciphers.e(sharedPreferences, (Map) this.f30842f);
        boolean zO = o();
        Object obj = this.f30840d;
        if (zO) {
            this.f30845i = ((com.it_nomads.fluttersecurestorage.ciphers.e) this.f30846j).b((Context) obj);
            return;
        }
        com.it_nomads.fluttersecurestorage.ciphers.e eVar = (com.it_nomads.fluttersecurestorage.ciphers.e) this.f30846j;
        if (eVar.f24555a == eVar.f24557c && eVar.f24556b == eVar.f24558d) {
            this.f30845i = eVar.a((Context) obj);
            return;
        }
        try {
            this.f30845i = eVar.b((Context) obj);
            HashMap map = new HashMap();
            for (Map.Entry<String, ?> entry : sharedPreferences.getAll().entrySet()) {
                Object value = entry.getValue();
                String key = entry.getKey();
                if ((value instanceof String) && key.contains((String) this.f30841e)) {
                    map.put(key, b((String) value));
                }
            }
            this.f30845i = eVar.a((Context) obj);
            SharedPreferences.Editor editorEdit = sharedPreferences.edit();
            for (Map.Entry entry2 : map.entrySet()) {
                editorEdit.putString((String) entry2.getKey(), Base64.encodeToString(((com.it_nomads.fluttersecurestorage.ciphers.d) this.f30845i).a(((String) entry2.getValue()).getBytes((Charset) this.f30839c)), 0));
            }
            editorEdit.putString("FlutterSecureSAlgorithmKey", eVar.f24557c.name());
            editorEdit.putString("FlutterSecureSAlgorithmStorage", eVar.f24558d.name());
            editorEdit.apply();
        } catch (Exception unused) {
            this.f30845i = eVar.b((Context) obj);
        }
    }

    public final androidx.security.crypto.b u(Context context) {
        j3.a aVar = new j3.a(context);
        KeyGenParameterSpec keyGenParameterSpecBuild = new KeyGenParameterSpec.Builder("_androidx_security_master_key_", 3).setEncryptionPaddings("NoPadding").setBlockModes(CodePackage.GCM).setKeySize(256).build();
        if (aVar.f28624c != null) {
            throw new IllegalArgumentException("KeyGenParamSpec set after setting a KeyScheme");
        }
        String keystoreAlias = keyGenParameterSpecBuild.getKeystoreAlias();
        String str = aVar.f28622a;
        if (str.equals(keystoreAlias)) {
            aVar.f28623b = keyGenParameterSpecBuild;
            return androidx.security.crypto.b.a(context, (String) this.f30843g, aVar.a());
        }
        StringBuilder sbN = u1.n("KeyGenParamSpec's key alias does not match provided alias (", str, " vs ");
        sbN.append(keyGenParameterSpecBuild.getKeystoreAlias());
        throw new IllegalArgumentException(sbN.toString());
    }

    public final int v(long j10, String str) {
        Object obj = this.f30838b;
        ((RoomDatabase) obj).assertNotSuspendingTransaction();
        l3.j jVarA = ((t0) this.f30845i).a();
        jVarA.a(1, j10);
        if (str == null) {
            jVarA.d(2);
        } else {
            jVarA.l(2, str);
        }
        ((RoomDatabase) obj).beginTransaction();
        try {
            int iN = jVarA.n();
            ((RoomDatabase) obj).setTransactionSuccessful();
            return iN;
        } finally {
            ((RoomDatabase) obj).endTransaction();
            ((t0) this.f30845i).c(jVarA);
        }
    }

    public final HashMap w() {
        e();
        Map<String, ?> all = ((SharedPreferences) this.f30844h).getAll();
        HashMap map = new HashMap();
        for (Map.Entry<String, ?> entry : all.entrySet()) {
            if (entry.getKey().contains((String) this.f30841e)) {
                String strReplaceFirst = entry.getKey().replaceFirst(((String) this.f30841e) + '_', "");
                if (o()) {
                    map.put(strReplaceFirst, (String) entry.getValue());
                } else {
                    map.put(strReplaceFirst, b((String) entry.getValue()));
                }
            }
        }
        return map;
    }

    public final int x(String str) {
        Object obj = this.f30838b;
        ((RoomDatabase) obj).assertNotSuspendingTransaction();
        l3.j jVarA = ((t0) this.f30844h).a();
        if (str == null) {
            jVarA.d(1);
        } else {
            jVarA.l(1, str);
        }
        ((RoomDatabase) obj).beginTransaction();
        try {
            int iN = jVarA.n();
            ((RoomDatabase) obj).setTransactionSuccessful();
            return iN;
        } finally {
            ((RoomDatabase) obj).endTransaction();
            ((t0) this.f30844h).c(jVarA);
        }
    }

    public final void y(String str, androidx.work.i iVar) {
        Object obj = this.f30838b;
        ((RoomDatabase) obj).assertNotSuspendingTransaction();
        l3.j jVarA = ((t0) this.f30841e).a();
        byte[] bArrB = androidx.work.i.b(iVar);
        if (bArrB == null) {
            jVarA.d(1);
        } else {
            jVarA.w(1, bArrB);
        }
        if (str == null) {
            jVarA.d(2);
        } else {
            jVarA.l(2, str);
        }
        ((RoomDatabase) obj).beginTransaction();
        try {
            jVarA.n();
            ((RoomDatabase) obj).setTransactionSuccessful();
        } finally {
            ((RoomDatabase) obj).endTransaction();
            ((t0) this.f30841e).c(jVarA);
        }
    }

    public final void z(long j10, String str) {
        Object obj = this.f30838b;
        ((RoomDatabase) obj).assertNotSuspendingTransaction();
        l3.j jVarA = ((t0) this.f30842f).a();
        jVarA.a(1, j10);
        if (str == null) {
            jVarA.d(2);
        } else {
            jVarA.l(2, str);
        }
        ((RoomDatabase) obj).beginTransaction();
        try {
            jVarA.n();
            ((RoomDatabase) obj).setTransactionSuccessful();
        } finally {
            ((RoomDatabase) obj).endTransaction();
            ((t0) this.f30842f).c(jVarA);
        }
    }

    public r(Context context, HashMap map) {
        this.f30837a = 2;
        this.f30838b = "SecureStorageAndroid";
        this.f30841e = "VGhpcyBpcyB0aGUgcHJlZml4IGZvciBhIHNlY3VyZSBzdG9yYWdlCg";
        this.f30843g = "FlutterSecureStorage";
        this.f30847k = Boolean.FALSE;
        this.f30842f = map;
        this.f30840d = context.getApplicationContext();
        this.f30839c = StandardCharsets.UTF_8;
    }

    public r(RoomDatabase roomDatabase) {
        this.f30837a = 0;
        this.f30838b = roomDatabase;
        this.f30839c = new c(this, roomDatabase, 5);
        this.f30840d = new q(roomDatabase, 0);
        this.f30841e = new q(roomDatabase, 1);
        this.f30842f = new q(roomDatabase, 2);
        this.f30843g = new q(roomDatabase, 3);
        this.f30844h = new q(roomDatabase, 4);
        this.f30845i = new q(roomDatabase, 5);
        this.f30846j = new q(roomDatabase, 6);
        this.f30847k = new q(roomDatabase, 7);
    }
}
