{"version":3,"file":"compat-BzCdaHjb.mjs","names":["Database","Statement","NativeEncryptionCipher","DatabaseCompat","NativeDB","bindParams","len","params","param","isPlainObject","bindNamedParams","stmt","bindPositionalParams","bindValue","obj","proto","paramCount","i","paramName","value","paramObj","bindIndex","j","index","SqliteError","message","code","rawCode","convertibleErrorTypes","convertError","err","createErrorByName","ErrorConstructor","name","isQueryOptions","splitBindParameters","bindParameters","toBindArgs","normalizeBatchMode","mode","normalizeBatchOptions","options","makeResultSet","Database$2","db","sql","Statement$1","fn","wrapTxn","result","properties","source","pragma","exec","queryOptions","stepResult","statements","wrap","results","statement","args","cols","columnNames","c","columnTypes","raw","totalChangesBefore","rows","rowsAffected","toggle","pluckMode","lastInsertRowid","row","require","createRequire","nativeBinding","loadErrors","isMusl","musl","isMuslFromFilesystem","isMuslFromReport","isMuslFromChildProcess","isFileMusl","f","readFileSync","report","requireNative","binding","bindingPackageVersion","Database$1","getCipherValue","EncryptionCipher","\"aes128gcm\"","\"aes256gcm\"","\"aegis256\"","\"aegis256x2\"","\"aegis128l\"","\"aegis128x2\"","\"aegis128x4\"","cipher","Database","nativeOpts","opts","path"],"sources":["../../../../node_modules/.pnpm/@tursodatabase+database-common@0.7.2/node_modules/@tursodatabase/database-common/dist/bind.js","../../../../node_modules/.pnpm/@tursodatabase+database-common@0.7.2/node_modules/@tursodatabase/database-common/dist/sqlite-error.js","../../../../node_modules/.pnpm/@tursodatabase+database-common@0.7.2/node_modules/@tursodatabase/database-common/dist/compat.js","../../../../node_modules/.pnpm/@tursodatabase+database@0.7.2/node_modules/@tursodatabase/database/index.js","../../../../node_modules/.pnpm/@tursodatabase+database@0.7.2/node_modules/@tursodatabase/database/dist/compat.js"],"sourcesContent":["// Bind parameters to a statement.\n//\n// This function is used to bind parameters to a statement. It supports both\n// named and positional parameters, and nested arrays.\n//\n// The `stmt` parameter is a statement object.\n// The `params` parameter is an array of parameters.\n//\n// The function returns void.\nexport function bindParams(stmt, params) {\n    const len = params?.length;\n    if (len === 0) {\n        return;\n    }\n    if (len === 1) {\n        const param = params[0];\n        if (isPlainObject(param)) {\n            bindNamedParams(stmt, param);\n            return;\n        }\n        if (Array.isArray(param)) {\n            bindPositionalParams(stmt, [param]);\n            return;\n        }\n        bindValue(stmt, 1, param);\n        return;\n    }\n    bindPositionalParams(stmt, params);\n}\n// Check if object is plain (no prototype chain)\nfunction isPlainObject(obj) {\n    if (!obj || typeof obj !== 'object')\n        return false;\n    const proto = Object.getPrototypeOf(obj);\n    return proto === Object.prototype || proto === null;\n}\n// Handle named parameters\nfunction bindNamedParams(stmt, paramObj) {\n    const paramCount = stmt.parameterCount();\n    for (let i = 1; i <= paramCount; i++) {\n        const paramName = stmt.parameterName(i);\n        if (paramName) {\n            const key = paramName.substring(1); // Remove ':' or '$' prefix\n            const value = paramObj[key];\n            if (value !== undefined) {\n                bindValue(stmt, i, value);\n            }\n        }\n    }\n}\n// Handle positional parameters (including nested arrays)\nfunction bindPositionalParams(stmt, params) {\n    let bindIndex = 1;\n    for (let i = 0; i < params.length; i++) {\n        const param = params[i];\n        if (Array.isArray(param)) {\n            for (let j = 0; j < param.length; j++) {\n                bindValue(stmt, bindIndex++, param[j]);\n            }\n        }\n        else {\n            bindValue(stmt, bindIndex++, param);\n        }\n    }\n}\nfunction bindValue(stmt, index, value) {\n    stmt.bindAt(index, value);\n}\n","export class SqliteError extends Error {\n    name;\n    code;\n    rawCode;\n    constructor(message, code, rawCode) {\n        super(message);\n        this.name = 'SqliteError';\n        this.code = code;\n        this.rawCode = rawCode;\n        Error.captureStackTrace(this, SqliteError);\n    }\n}\n","import { bindParams } from \"./bind.js\";\nimport { SqliteError } from \"./sqlite-error.js\";\nimport { STEP_IO, STEP_ROW, STEP_DONE } from \"./types.js\";\nconst convertibleErrorTypes = { TypeError };\nconst CONVERTIBLE_ERROR_PREFIX = \"[TURSO_CONVERT_TYPE]\";\nfunction convertError(err) {\n    if ((err.code ?? \"\").startsWith(CONVERTIBLE_ERROR_PREFIX)) {\n        return createErrorByName(err.code.substring(CONVERTIBLE_ERROR_PREFIX.length), err.message);\n    }\n    return new SqliteError(err.message, err.code, err.rawCode);\n}\nfunction createErrorByName(name, message) {\n    const ErrorConstructor = convertibleErrorTypes[name];\n    if (!ErrorConstructor) {\n        throw new Error(`unknown error type ${name} from Turso`);\n    }\n    return new ErrorConstructor(message);\n}\nfunction isQueryOptions(value) {\n    return value != null\n        && typeof value === \"object\"\n        && !Array.isArray(value)\n        && Object.prototype.hasOwnProperty.call(value, \"queryTimeout\");\n}\nfunction splitBindParameters(bindParameters) {\n    if (bindParameters.length === 0) {\n        return { params: undefined, queryOptions: undefined };\n    }\n    if (bindParameters.length > 1 && isQueryOptions(bindParameters[bindParameters.length - 1])) {\n        return {\n            params: bindParameters.length === 2 ? bindParameters[0] : bindParameters.slice(0, -1),\n            queryOptions: bindParameters[bindParameters.length - 1],\n        };\n    }\n    return { params: bindParameters.length === 1 ? bindParameters[0] : bindParameters, queryOptions: undefined };\n}\nfunction toBindArgs(params) {\n    if (params === undefined) {\n        return [];\n    }\n    return [params];\n}\nfunction normalizeBatchMode(mode) {\n    switch (String(mode).toLowerCase()) {\n        case \"write\":\n            return \"IMMEDIATE\";\n        case \"read\":\n        case \"deferred\":\n            return \"DEFERRED\";\n        case \"immediate\":\n            return \"IMMEDIATE\";\n        case \"exclusive\":\n            return \"EXCLUSIVE\";\n        case \"concurrent\":\n            return \"CONCURRENT\";\n        default:\n            return String(mode).toUpperCase();\n    }\n}\nfunction normalizeBatchOptions(options) {\n    if (options != null && typeof options === \"object\") {\n        return {\n            mode: options.mode,\n            raw: options.raw === true,\n        };\n    }\n    return {\n        mode: options,\n        raw: false,\n    };\n}\nfunction makeResultSet(columns, columnTypes, rows, rowsAffected) {\n    return {\n        columns,\n        columnTypes,\n        rows,\n        rowsAffected,\n    };\n}\n/**\n * Database represents a connection that can prepare and execute SQL statements.\n */\nclass Database {\n    name;\n    readonly;\n    open;\n    memory;\n    inTransaction;\n    db;\n    /**\n     * Creates a new database connection. If the database file pointed to by `path` does not exists, it will be created.\n     *\n     * @constructor\n     * @param {string} path - Path to the database file.\n     * @param {Object} opts - Options for database behavior.\n     * @param {boolean} [opts.readonly=false] - Open the database in read-only mode.\n     * @param {boolean} [opts.fileMustExist=false] - If true, throws if database file does not exist.\n     * @param {number} [opts.timeout=0] - Timeout duration in milliseconds for database operations. Defaults to 0 (no timeout).\n     * @param {number} [opts.defaultQueryTimeout=0] - Default maximum query execution time in milliseconds before interruption.\n     */\n    constructor(db) {\n        this.db = db;\n        this.db.connectSync();\n        Object.defineProperties(this, {\n            name: { get: () => this.db.path },\n            readonly: { get: () => this.db.readonly },\n            open: { get: () => this.db.open },\n            memory: { get: () => this.db.memory },\n            inTransaction: { get: () => this.db.inTransaction() },\n        });\n    }\n    /**\n     * Prepares a SQL statement for execution.\n     *\n     * @param {string} sql - The SQL statement string to prepare.\n     */\n    prepare(sql) {\n        if (!this.open) {\n            throw new TypeError(\"The database connection is not open\");\n        }\n        if (!sql) {\n            throw new RangeError(\"The supplied SQL string contains no statements\");\n        }\n        try {\n            return new Statement(this.db.prepare(sql), this.db);\n        }\n        catch (err) {\n            throw convertError(err);\n        }\n    }\n    /**\n     * Returns a function that executes the given function in a transaction.\n     *\n     * @param {function} fn - The function to wrap in a transaction.\n     */\n    transaction(fn) {\n        if (typeof fn !== \"function\")\n            throw new TypeError(\"Expected first argument to be a function\");\n        const db = this;\n        const wrapTxn = (mode) => {\n            return (...bindParameters) => {\n                db.exec(\"BEGIN \" + mode);\n                try {\n                    const result = fn(...bindParameters);\n                    db.exec(\"COMMIT\");\n                    return result;\n                }\n                catch (err) {\n                    db.exec(\"ROLLBACK\");\n                    throw err;\n                }\n            };\n        };\n        const properties = {\n            default: { value: wrapTxn(\"\") },\n            deferred: { value: wrapTxn(\"DEFERRED\") },\n            immediate: { value: wrapTxn(\"IMMEDIATE\") },\n            exclusive: { value: wrapTxn(\"EXCLUSIVE\") },\n            database: { value: this, enumerable: true },\n        };\n        Object.defineProperties(properties.default.value, properties);\n        Object.defineProperties(properties.deferred.value, properties);\n        Object.defineProperties(properties.immediate.value, properties);\n        Object.defineProperties(properties.exclusive.value, properties);\n        return properties.default.value;\n    }\n    pragma(source, options) {\n        if (options == null)\n            options = {};\n        if (typeof source !== \"string\")\n            throw new TypeError(\"Expected first argument to be a string\");\n        if (typeof options !== \"object\")\n            throw new TypeError(\"Expected second argument to be an options object\");\n        const pragma = `PRAGMA ${source}`;\n        const stmt = this.prepare(pragma);\n        try {\n            const results = stmt.all();\n            return results;\n        }\n        finally {\n            stmt.close();\n        }\n    }\n    backup(filename, options) {\n        throw new Error(\"not implemented\");\n    }\n    serialize(options) {\n        throw new Error(\"not implemented\");\n    }\n    function(name, options, fn) {\n        throw new Error(\"not implemented\");\n    }\n    aggregate(name, options) {\n        throw new Error(\"not implemented\");\n    }\n    table(name, factory) {\n        throw new Error(\"not implemented\");\n    }\n    loadExtension(path) {\n        throw new Error(\"not implemented\");\n    }\n    maxWriteReplicationIndex() {\n        throw new Error(\"not implemented\");\n    }\n    /**\n     * Executes the given SQL string\n     * Unlike prepared statements, this can execute strings that contain multiple SQL statements\n     *\n     * @param {string} sql - The string containing SQL statements to execute\n     */\n    exec(sql, queryOptions) {\n        if (!this.open) {\n            throw new TypeError(\"The database connection is not open\");\n        }\n        const exec = this.db.executor(sql, queryOptions);\n        try {\n            while (true) {\n                const stepResult = exec.stepSync();\n                if (stepResult === STEP_IO) {\n                    this.db.ioLoopSync();\n                    continue;\n                }\n                if (stepResult === STEP_DONE) {\n                    break;\n                }\n                if (stepResult === STEP_ROW) {\n                    // For exec(), we don't need the row data, just continue\n                    continue;\n                }\n            }\n        }\n        finally {\n            exec.reset();\n        }\n    }\n    batch(statements, options) {\n        if (!Array.isArray(statements)) {\n            throw new TypeError(\"Expected first argument to be an array of statements\");\n        }\n        if (!this.open) {\n            throw new TypeError(\"The database connection is not open\");\n        }\n        const { mode, raw } = normalizeBatchOptions(options);\n        const wrap = mode != null && !this.db.inTransaction();\n        if (wrap) {\n            this.exec(`BEGIN ${normalizeBatchMode(mode)}`);\n        }\n        const results = [];\n        try {\n            for (const statement of statements) {\n                const sql = typeof statement === \"string\" ? statement : statement.sql;\n                const args = typeof statement === \"string\" ? undefined : statement.args;\n                const stmt = this.db.prepare(sql);\n                try {\n                    if (args !== undefined) {\n                        bindParams(stmt, [args]);\n                    }\n                    const cols = stmt.columns();\n                    const columnNames = cols.map((c) => c.name);\n                    const columnTypes = cols.map((c) => c.type ?? \"\");\n                    if (columnNames.length > 0) {\n                        stmt.raw(raw);\n                    }\n                    const totalChangesBefore = this.db.totalChanges();\n                    const rows = [];\n                    try {\n                        while (true) {\n                            const stepResult = stmt.stepSync();\n                            if (stepResult === STEP_IO) {\n                                this.db.ioLoopSync();\n                                continue;\n                            }\n                            if (stepResult === STEP_DONE) {\n                                break;\n                            }\n                            if (stepResult === STEP_ROW) {\n                                rows.push(stmt.row());\n                            }\n                        }\n                        const rowsAffected = columnNames.length > 0\n                            ? 0\n                            : this.db.totalChanges() !== totalChangesBefore ? this.db.changes() : 0;\n                        results.push(makeResultSet(columnNames, columnTypes, rows, rowsAffected));\n                    }\n                    finally {\n                        stmt.reset();\n                    }\n                }\n                finally {\n                    stmt.finalize();\n                }\n            }\n            if (wrap) {\n                this.exec(\"COMMIT\");\n            }\n        }\n        catch (err) {\n            if (wrap) {\n                try {\n                    this.exec(\"ROLLBACK\");\n                }\n                catch {\n                    // Keep the original statement error.\n                }\n            }\n            throw convertError(err);\n        }\n        return results;\n    }\n    /**\n     * Interrupts the database connection.\n     */\n    interrupt() {\n        throw new Error(\"not implemented\");\n    }\n    /**\n     * Sets the default safe integers mode for all statements from this database.\n     *\n     * @param {boolean} [toggle] - Whether to use safe integers by default.\n     */\n    defaultSafeIntegers(toggle) {\n        this.db.defaultSafeIntegers(toggle);\n    }\n    /**\n     * Closes the database connection.\n     */\n    close() {\n        this.db.close();\n    }\n}\n/**\n * Statement represents a prepared SQL statement that can be executed.\n */\nclass Statement {\n    stmt;\n    db;\n    constructor(stmt, db) {\n        this.stmt = stmt;\n        this.db = db;\n    }\n    /**\n     * Toggle raw mode.\n     *\n     * @param raw Enable or disable raw mode. If you don't pass the parameter, raw mode is enabled.\n     */\n    raw(raw) {\n        this.stmt.raw(raw);\n        return this;\n    }\n    /**\n     * Toggle pluck mode.\n     *\n     * @param pluckMode Enable or disable pluck mode. If you don't pass the parameter, pluck mode is enabled.\n     */\n    pluck(pluckMode) {\n        this.stmt.pluck(pluckMode);\n        return this;\n    }\n    /**\n     * Sets safe integers mode for this statement.\n     *\n     * @param {boolean} [toggle] - Whether to use safe integers.\n     */\n    safeIntegers(toggle) {\n        this.stmt.safeIntegers(toggle);\n        return this;\n    }\n    /**\n     * Get column information for the statement.\n     *\n     * @returns {Array} An array of column objects with name, column, table, database, and type properties.\n     */\n    columns() {\n        return this.stmt.columns();\n    }\n    get source() {\n        throw new Error(\"not implemented\");\n    }\n    get reader() {\n        return this.stmt.columns().length > 0;\n    }\n    get database() {\n        return this.db;\n    }\n    /**\n     * Executes the SQL statement and returns an info object.\n     */\n    run(...bindParameters) {\n        const totalChangesBefore = this.db.totalChanges();\n        const { params, queryOptions } = splitBindParameters(bindParameters);\n        this.stmt.reset();\n        this.stmt.setQueryTimeout(queryOptions);\n        bindParams(this.stmt, toBindArgs(params));\n        for (;;) {\n            const stepResult = this.stmt.stepSync();\n            if (stepResult === STEP_IO) {\n                this.db.ioLoopSync();\n                continue;\n            }\n            if (stepResult === STEP_DONE) {\n                break;\n            }\n            if (stepResult === STEP_ROW) {\n                // For run(), we don't need the row data, just continue\n                continue;\n            }\n        }\n        const lastInsertRowid = this.db.lastInsertRowid();\n        const changes = this.db.totalChanges() === totalChangesBefore ? 0 : this.db.changes();\n        return { changes, lastInsertRowid };\n    }\n    /**\n     * Executes the SQL statement and returns the first row.\n     *\n     * @param bindParameters - The bind parameters for executing the statement.\n     */\n    get(...bindParameters) {\n        const { params, queryOptions } = splitBindParameters(bindParameters);\n        this.stmt.reset();\n        this.stmt.setQueryTimeout(queryOptions);\n        bindParams(this.stmt, toBindArgs(params));\n        let row = undefined;\n        for (;;) {\n            const stepResult = this.stmt.stepSync();\n            if (stepResult === STEP_IO) {\n                this.db.ioLoopSync();\n                continue;\n            }\n            if (stepResult === STEP_DONE) {\n                break;\n            }\n            if (stepResult === STEP_ROW && row === undefined) {\n                row = this.stmt.row();\n            }\n        }\n        return row;\n    }\n    /**\n     * Executes the SQL statement and returns an iterator to the resulting rows.\n     *\n     * @param bindParameters - The bind parameters for executing the statement.\n     */\n    *iterate(...bindParameters) {\n        const { params, queryOptions } = splitBindParameters(bindParameters);\n        this.stmt.reset();\n        this.stmt.setQueryTimeout(queryOptions);\n        bindParams(this.stmt, toBindArgs(params));\n        while (true) {\n            const stepResult = this.stmt.stepSync();\n            if (stepResult === STEP_IO) {\n                this.db.ioLoopSync();\n                continue;\n            }\n            if (stepResult === STEP_DONE) {\n                break;\n            }\n            if (stepResult === STEP_ROW) {\n                yield this.stmt.row();\n            }\n        }\n    }\n    /**\n     * Executes the SQL statement and returns an array of the resulting rows.\n     *\n     * @param bindParameters - The bind parameters for executing the statement.\n     */\n    all(...bindParameters) {\n        const { params, queryOptions } = splitBindParameters(bindParameters);\n        this.stmt.reset();\n        this.stmt.setQueryTimeout(queryOptions);\n        bindParams(this.stmt, toBindArgs(params));\n        const rows = [];\n        for (;;) {\n            const stepResult = this.stmt.stepSync();\n            if (stepResult === STEP_IO) {\n                this.db.ioLoopSync();\n                continue;\n            }\n            if (stepResult === STEP_DONE) {\n                break;\n            }\n            if (stepResult === STEP_ROW) {\n                rows.push(this.stmt.row());\n            }\n        }\n        return rows;\n    }\n    /**\n     * Interrupts the statement.\n     */\n    interrupt() {\n        throw new Error(\"not implemented\");\n    }\n    /**\n     * Binds the given parameters to the statement _permanently_\n     *\n     * @param bindParameters - The bind parameters for binding the statement.\n     * @returns this - Statement with binded parameters\n     */\n    bind(...bindParameters) {\n        try {\n            bindParams(this.stmt, bindParameters);\n            return this;\n        }\n        catch (err) {\n            throw convertError(err);\n        }\n    }\n    close() {\n        this.stmt.finalize();\n    }\n}\nexport { Database, Statement };\n","// prettier-ignore\n/* eslint-disable */\n// @ts-nocheck\n/* auto-generated by NAPI-RS */\n\nimport { createRequire } from 'node:module'\nconst require = createRequire(import.meta.url)\nconst __dirname = new URL('.', import.meta.url).pathname\n\nconst { readFileSync } = require('node:fs')\nlet nativeBinding = null\nconst loadErrors = []\n\nconst isMusl = () => {\n  let musl = false\n  if (process.platform === 'linux') {\n    musl = isMuslFromFilesystem()\n    if (musl === null) {\n      musl = isMuslFromReport()\n    }\n    if (musl === null) {\n      musl = isMuslFromChildProcess()\n    }\n  }\n  return musl\n}\n\nconst isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')\n\nconst isMuslFromFilesystem = () => {\n  try {\n    return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')\n  } catch {\n    return null\n  }\n}\n\nconst isMuslFromReport = () => {\n  let report = null\n  if (typeof process.report?.getReport === 'function') {\n    process.report.excludeNetwork = true\n    report = process.report.getReport()\n  }\n  if (!report) {\n    return null\n  }\n  if (report.header && report.header.glibcVersionRuntime) {\n    return false\n  }\n  if (Array.isArray(report.sharedObjects)) {\n    if (report.sharedObjects.some(isFileMusl)) {\n      return true\n    }\n  }\n  return false\n}\n\nconst isMuslFromChildProcess = () => {\n  try {\n    return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')\n  } catch (e) {\n    // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false\n    return false\n  }\n}\n\nfunction requireNative() {\n  if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {\n    try {\n      nativeBinding = require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);\n    } catch (err) {\n      loadErrors.push(err)\n    }\n  } else if (process.platform === 'android') {\n    if (process.arch === 'arm64') {\n      try {\n        return require('./turso.android-arm64.node')\n      } catch (e) {\n        loadErrors.push(e)\n      }\n      try {\n        const binding = require('@tursodatabase/database-android-arm64')\n        const bindingPackageVersion = require('@tursodatabase/database-android-arm64/package.json').version\n        if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n          throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n        }\n        return binding\n      } catch (e) {\n        loadErrors.push(e)\n      }\n    } else if (process.arch === 'arm') {\n      try {\n        return require('./turso.android-arm-eabi.node')\n      } catch (e) {\n        loadErrors.push(e)\n      }\n      try {\n        const binding = require('@tursodatabase/database-android-arm-eabi')\n        const bindingPackageVersion = require('@tursodatabase/database-android-arm-eabi/package.json').version\n        if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n          throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n        }\n        return binding\n      } catch (e) {\n        loadErrors.push(e)\n      }\n    } else {\n      loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))\n    }\n  } else if (process.platform === 'win32') {\n    if (process.arch === 'x64') {\n      try {\n        return require('./turso.win32-x64-msvc.node')\n      } catch (e) {\n        loadErrors.push(e)\n      }\n      try {\n        const binding = require('@tursodatabase/database-win32-x64-msvc')\n        const bindingPackageVersion = require('@tursodatabase/database-win32-x64-msvc/package.json').version\n        if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n          throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n        }\n        return binding\n      } catch (e) {\n        loadErrors.push(e)\n      }\n    } else if (process.arch === 'ia32') {\n      try {\n        return require('./turso.win32-ia32-msvc.node')\n      } catch (e) {\n        loadErrors.push(e)\n      }\n      try {\n        const binding = require('@tursodatabase/database-win32-ia32-msvc')\n        const bindingPackageVersion = require('@tursodatabase/database-win32-ia32-msvc/package.json').version\n        if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n          throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n        }\n        return binding\n      } catch (e) {\n        loadErrors.push(e)\n      }\n    } else if (process.arch === 'arm64') {\n      try {\n        return require('./turso.win32-arm64-msvc.node')\n      } catch (e) {\n        loadErrors.push(e)\n      }\n      try {\n        const binding = require('@tursodatabase/database-win32-arm64-msvc')\n        const bindingPackageVersion = require('@tursodatabase/database-win32-arm64-msvc/package.json').version\n        if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n          throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n        }\n        return binding\n      } catch (e) {\n        loadErrors.push(e)\n      }\n    } else {\n      loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))\n    }\n  } else if (process.platform === 'darwin') {\n    try {\n      return require('./turso.darwin-universal.node')\n    } catch (e) {\n      loadErrors.push(e)\n    }\n    try {\n      const binding = require('@tursodatabase/database-darwin-universal')\n      const bindingPackageVersion = require('@tursodatabase/database-darwin-universal/package.json').version\n      if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n        throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n      }\n      return binding\n    } catch (e) {\n      loadErrors.push(e)\n    }\n    if (process.arch === 'x64') {\n      try {\n        return require('./turso.darwin-x64.node')\n      } catch (e) {\n        loadErrors.push(e)\n      }\n      try {\n        const binding = require('@tursodatabase/database-darwin-x64')\n        const bindingPackageVersion = require('@tursodatabase/database-darwin-x64/package.json').version\n        if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n          throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n        }\n        return binding\n      } catch (e) {\n        loadErrors.push(e)\n      }\n    } else if (process.arch === 'arm64') {\n      try {\n        return require('./turso.darwin-arm64.node')\n      } catch (e) {\n        loadErrors.push(e)\n      }\n      try {\n        const binding = require('@tursodatabase/database-darwin-arm64')\n        const bindingPackageVersion = require('@tursodatabase/database-darwin-arm64/package.json').version\n        if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n          throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n        }\n        return binding\n      } catch (e) {\n        loadErrors.push(e)\n      }\n    } else {\n      loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))\n    }\n  } else if (process.platform === 'freebsd') {\n    if (process.arch === 'x64') {\n      try {\n        return require('./turso.freebsd-x64.node')\n      } catch (e) {\n        loadErrors.push(e)\n      }\n      try {\n        const binding = require('@tursodatabase/database-freebsd-x64')\n        const bindingPackageVersion = require('@tursodatabase/database-freebsd-x64/package.json').version\n        if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n          throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n        }\n        return binding\n      } catch (e) {\n        loadErrors.push(e)\n      }\n    } else if (process.arch === 'arm64') {\n      try {\n        return require('./turso.freebsd-arm64.node')\n      } catch (e) {\n        loadErrors.push(e)\n      }\n      try {\n        const binding = require('@tursodatabase/database-freebsd-arm64')\n        const bindingPackageVersion = require('@tursodatabase/database-freebsd-arm64/package.json').version\n        if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n          throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n        }\n        return binding\n      } catch (e) {\n        loadErrors.push(e)\n      }\n    } else {\n      loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))\n    }\n  } else if (process.platform === 'linux') {\n    if (process.arch === 'x64') {\n      if (isMusl()) {\n        try {\n          return require('./turso.linux-x64-musl.node')\n        } catch (e) {\n          loadErrors.push(e)\n        }\n        try {\n          const binding = require('@tursodatabase/database-linux-x64-musl')\n          const bindingPackageVersion = require('@tursodatabase/database-linux-x64-musl/package.json').version\n          if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n            throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n          }\n          return binding\n        } catch (e) {\n          loadErrors.push(e)\n        }\n      } else {\n        try {\n          return require('./turso.linux-x64-gnu.node')\n        } catch (e) {\n          loadErrors.push(e)\n        }\n        try {\n          const binding = require('@tursodatabase/database-linux-x64-gnu')\n          const bindingPackageVersion = require('@tursodatabase/database-linux-x64-gnu/package.json').version\n          if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n            throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n          }\n          return binding\n        } catch (e) {\n          loadErrors.push(e)\n        }\n      }\n    } else if (process.arch === 'arm64') {\n      if (isMusl()) {\n        try {\n          return require('./turso.linux-arm64-musl.node')\n        } catch (e) {\n          loadErrors.push(e)\n        }\n        try {\n          const binding = require('@tursodatabase/database-linux-arm64-musl')\n          const bindingPackageVersion = require('@tursodatabase/database-linux-arm64-musl/package.json').version\n          if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n            throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n          }\n          return binding\n        } catch (e) {\n          loadErrors.push(e)\n        }\n      } else {\n        try {\n          return require('./turso.linux-arm64-gnu.node')\n        } catch (e) {\n          loadErrors.push(e)\n        }\n        try {\n          const binding = require('@tursodatabase/database-linux-arm64-gnu')\n          const bindingPackageVersion = require('@tursodatabase/database-linux-arm64-gnu/package.json').version\n          if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n            throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n          }\n          return binding\n        } catch (e) {\n          loadErrors.push(e)\n        }\n      }\n    } else if (process.arch === 'arm') {\n      if (isMusl()) {\n        try {\n          return require('./turso.linux-arm-musleabihf.node')\n        } catch (e) {\n          loadErrors.push(e)\n        }\n        try {\n          const binding = require('@tursodatabase/database-linux-arm-musleabihf')\n          const bindingPackageVersion = require('@tursodatabase/database-linux-arm-musleabihf/package.json').version\n          if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n            throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n          }\n          return binding\n        } catch (e) {\n          loadErrors.push(e)\n        }\n      } else {\n        try {\n          return require('./turso.linux-arm-gnueabihf.node')\n        } catch (e) {\n          loadErrors.push(e)\n        }\n        try {\n          const binding = require('@tursodatabase/database-linux-arm-gnueabihf')\n          const bindingPackageVersion = require('@tursodatabase/database-linux-arm-gnueabihf/package.json').version\n          if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n            throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n          }\n          return binding\n        } catch (e) {\n          loadErrors.push(e)\n        }\n      }\n    } else if (process.arch === 'riscv64') {\n      if (isMusl()) {\n        try {\n          return require('./turso.linux-riscv64-musl.node')\n        } catch (e) {\n          loadErrors.push(e)\n        }\n        try {\n          const binding = require('@tursodatabase/database-linux-riscv64-musl')\n          const bindingPackageVersion = require('@tursodatabase/database-linux-riscv64-musl/package.json').version\n          if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n            throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n          }\n          return binding\n        } catch (e) {\n          loadErrors.push(e)\n        }\n      } else {\n        try {\n          return require('./turso.linux-riscv64-gnu.node')\n        } catch (e) {\n          loadErrors.push(e)\n        }\n        try {\n          const binding = require('@tursodatabase/database-linux-riscv64-gnu')\n          const bindingPackageVersion = require('@tursodatabase/database-linux-riscv64-gnu/package.json').version\n          if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n            throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n          }\n          return binding\n        } catch (e) {\n          loadErrors.push(e)\n        }\n      }\n    } else if (process.arch === 'ppc64') {\n      try {\n        return require('./turso.linux-ppc64-gnu.node')\n      } catch (e) {\n        loadErrors.push(e)\n      }\n      try {\n        const binding = require('@tursodatabase/database-linux-ppc64-gnu')\n        const bindingPackageVersion = require('@tursodatabase/database-linux-ppc64-gnu/package.json').version\n        if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n          throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n        }\n        return binding\n      } catch (e) {\n        loadErrors.push(e)\n      }\n    } else if (process.arch === 's390x') {\n      try {\n        return require('./turso.linux-s390x-gnu.node')\n      } catch (e) {\n        loadErrors.push(e)\n      }\n      try {\n        const binding = require('@tursodatabase/database-linux-s390x-gnu')\n        const bindingPackageVersion = require('@tursodatabase/database-linux-s390x-gnu/package.json').version\n        if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n          throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n        }\n        return binding\n      } catch (e) {\n        loadErrors.push(e)\n      }\n    } else {\n      loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))\n    }\n  } else if (process.platform === 'openharmony') {\n    if (process.arch === 'arm64') {\n      try {\n        return require('./turso.openharmony-arm64.node')\n      } catch (e) {\n        loadErrors.push(e)\n      }\n      try {\n        const binding = require('@tursodatabase/database-openharmony-arm64')\n        const bindingPackageVersion = require('@tursodatabase/database-openharmony-arm64/package.json').version\n        if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n          throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n        }\n        return binding\n      } catch (e) {\n        loadErrors.push(e)\n      }\n    } else if (process.arch === 'x64') {\n      try {\n        return require('./turso.openharmony-x64.node')\n      } catch (e) {\n        loadErrors.push(e)\n      }\n      try {\n        const binding = require('@tursodatabase/database-openharmony-x64')\n        const bindingPackageVersion = require('@tursodatabase/database-openharmony-x64/package.json').version\n        if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n          throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n        }\n        return binding\n      } catch (e) {\n        loadErrors.push(e)\n      }\n    } else if (process.arch === 'arm') {\n      try {\n        return require('./turso.openharmony-arm.node')\n      } catch (e) {\n        loadErrors.push(e)\n      }\n      try {\n        const binding = require('@tursodatabase/database-openharmony-arm')\n        const bindingPackageVersion = require('@tursodatabase/database-openharmony-arm/package.json').version\n        if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {\n          throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)\n        }\n        return binding\n      } catch (e) {\n        loadErrors.push(e)\n      }\n    } else {\n      loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))\n    }\n  } else {\n    loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))\n  }\n}\n\nnativeBinding = requireNative()\n\nif (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {\n  try {\n    nativeBinding = require('./turso.wasi.cjs')\n  } catch (err) {\n    if (process.env.NAPI_RS_FORCE_WASI) {\n      loadErrors.push(err)\n    }\n  }\n  if (!nativeBinding) {\n    try {\n      nativeBinding = require('@tursodatabase/database-wasm32-wasi')\n    } catch (err) {\n      if (process.env.NAPI_RS_FORCE_WASI) {\n        loadErrors.push(err)\n      }\n    }\n  }\n}\n\nif (!nativeBinding) {\n  if (loadErrors.length > 0) {\n    throw new Error(\n      `Cannot find native binding. ` +\n        `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +\n        'Please try `npm i` again after removing both package-lock.json and node_modules directory.',\n      { cause: loadErrors }\n    )\n  }\n  throw new Error(`Failed to load native binding`)\n}\n\nconst { BatchExecutor, Database, Statement, EncryptionCipher } = nativeBinding\nexport { BatchExecutor }\nexport { Database }\nexport { Statement }\nexport { EncryptionCipher }\n","import { DatabaseCompat, SqliteError } from \"@tursodatabase/database-common\";\nimport { Database as NativeDB, EncryptionCipher as NativeEncryptionCipher } from \"#index\";\n// Map string cipher names to native enum values (lazy to avoid errors if native module lacks encryption)\nfunction getCipherValue(cipher) {\n    if (!NativeEncryptionCipher) {\n        throw new Error('Encryption is not supported in this build');\n    }\n    const cipherMap = {\n        'aes128gcm': NativeEncryptionCipher.Aes128Gcm,\n        'aes256gcm': NativeEncryptionCipher.Aes256Gcm,\n        'aegis256': NativeEncryptionCipher.Aegis256,\n        'aegis256x2': NativeEncryptionCipher.Aegis256x2,\n        'aegis128l': NativeEncryptionCipher.Aegis128l,\n        'aegis128x2': NativeEncryptionCipher.Aegis128x2,\n        'aegis128x4': NativeEncryptionCipher.Aegis128x4,\n    };\n    return cipherMap[cipher];\n}\nclass Database extends DatabaseCompat {\n    constructor(path, opts = {}) {\n        const nativeOpts = { ...opts };\n        if (opts.encryption) {\n            nativeOpts.encryption = {\n                cipher: getCipherValue(opts.encryption.cipher),\n                hexkey: opts.encryption.hexkey,\n            };\n        }\n        super(new NativeDB(path, nativeOpts));\n    }\n}\nexport { Database, SqliteError };\n"],"ignoreList":[0,1,2,3,4],"mappings":"4CASA,SAAgBK,EAAW,EAAM,EAAQ,CACrC,I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