diff --git a/dist/assets/db-worker-AHwpujSZ.js b/dist/assets/db-worker-AHwpujSZ.js new file mode 100644 index 0000000..650d626 --- /dev/null +++ b/dist/assets/db-worker-AHwpujSZ.js @@ -0,0 +1,3 @@ +var ft=(()=>{var qe=import.meta.url;return function(oe={}){var fe,i=oe,ye,be,Oe=new Promise((e,t)=>{ye=e,be=t}),Xe=typeof window=="object",Ce=typeof importScripts=="function";typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";const Pe=globalThis.sqlite3InitModuleState||Object.assign(Object.create(null),{debugModule:()=>{}});delete globalThis.sqlite3InitModuleState,Pe.debugModule("globalThis.location =",globalThis.location);var He=Object.assign({},i),re="./this.program",me="";function Ie(e){return i.locateFile?i.locateFile(e,me):me+e}var De,je;(Xe||Ce)&&(Ce?me=self.location.href:typeof document<"u"&&document.currentScript&&(me=document.currentScript.src),qe&&(me=qe),me.startsWith("blob:")?me="":me=me.substr(0,me.replace(/[?#].*/,"").lastIndexOf("/")+1),Ce&&(je=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),De=e=>fetch(e,{credentials:"same-origin"}).then(t=>t.ok?t.arrayBuffer():Promise.reject(new Error(t.status+" : "+t.url))));var Ve=i.print||console.log.bind(console),Le=i.printErr||console.error.bind(console);Object.assign(i,He),He=null,i.arguments&&i.arguments,i.thisProgram&&(re=i.thisProgram);var Ye=i.wasmBinary,Re,dt=!1,xe,Be,Ge,ue,Ee,ke;function pt(){var e=Re.buffer;i.HEAP8=xe=new Int8Array(e),i.HEAP16=Ge=new Int16Array(e),i.HEAPU8=Be=new Uint8Array(e),i.HEAPU16=new Uint16Array(e),i.HEAP32=ue=new Int32Array(e),i.HEAPU32=Ee=new Uint32Array(e),i.HEAPF32=new Float32Array(e),i.HEAPF64=new Float64Array(e),i.HEAP64=ke=new BigInt64Array(e),i.HEAPU64=new BigUint64Array(e)}if(i.wasmMemory)Re=i.wasmMemory;else{var Pt=i.INITIAL_MEMORY||16777216;Re=new WebAssembly.Memory({initial:Pt/65536,maximum:32768})}pt();var ht=[],mt=[],gt=[];function Lt(){var e=i.preRun;e&&(typeof e=="function"&&(e=[e]),e.forEach(Rt)),ot(ht)}function Ct(){!i.noFSInit&&!a.initialized&&a.init(),a.ignorePermissions=!1,ot(mt)}function Dt(){var e=i.postRun;e&&(typeof e=="function"&&(e=[e]),e.forEach(Mt)),ot(gt)}function Rt(e){ht.unshift(e)}function Nt(e){mt.unshift(e)}function Mt(e){gt.unshift(e)}var Ne=0,$e=null;function tr(e){return e}function rt(e){Ne++,i.monitorRunDependencies?.(Ne)}function Ze(e){if(Ne--,i.monitorRunDependencies?.(Ne),Ne==0&&$e){var t=$e;$e=null,t()}}function st(e){i.onAbort?.(e),e="Aborted("+e+")",Le(e),dt=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw be(t),t}var jt="data:application/octet-stream;base64,",qt=e=>e.startsWith(jt);function Bt(){if(i.locateFile){var e="sqlite3.wasm";return qt(e)?e:Ie(e)}return new URL("/assets/sqlite3-DBpDb1lf.wasm",import.meta.url).href}var it;function bt(e){if(e==it&&Ye)return new Uint8Array(Ye);if(je)return je(e);throw"both async and sync fetching of the wasm failed"}function Ut(e){return Ye?Promise.resolve().then(()=>bt(e)):De(e).then(t=>new Uint8Array(t),()=>bt(e))}function yt(e,t,n){return Ut(e).then(r=>WebAssembly.instantiate(r,t)).then(n,r=>{Le(`failed to asynchronously prepare wasm: ${r}`),st(r)})}function zt(e,t,n,r){return!e&&typeof WebAssembly.instantiateStreaming=="function"&&!qt(t)&&typeof fetch=="function"?fetch(t,{credentials:"same-origin"}).then(s=>{var o=WebAssembly.instantiateStreaming(s,n);return o.then(r,function(p){return Le(`wasm streaming compile failed: ${p}`),Le("falling back to ArrayBuffer instantiation"),yt(t,n,r)})}):yt(t,n,r)}function Wt(){return{env:It,wasi_snapshot_preview1:It}}function Qt(){var e=Wt();function t(r,s){return h=r.exports,Nt(h.__wasm_call_ctors),Ze(),h}rt();function n(r){t(r.instance)}if(i.instantiateWasm)try{return i.instantiateWasm(e,t)}catch(r){Le(`Module.instantiateWasm callback failed with error: ${r}`),be(r)}return it??=Bt(),zt(Ye,it,e,n).catch(be),{}}var ot=e=>{e.forEach(t=>t(i))};i.noExitRuntime;var de={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return t.exec(e).slice(1)},normalizeArray:(e,t)=>{for(var n=0,r=e.length-1;r>=0;r--){var s=e[r];s==="."?e.splice(r,1):s===".."?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n;n--)e.unshift("..");return e},normalize:e=>{var t=de.isAbs(e),n=e.substr(-1)==="/";return e=de.normalizeArray(e.split("/").filter(r=>!!r),!t).join("/"),!e&&!t&&(e="."),e&&n&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=de.splitPath(e),n=t[0],r=t[1];return!n&&!r?".":(r&&(r=r.substr(0,r.length-1)),n+r)},basename:e=>{if(e==="/")return"/";e=de.normalize(e),e=e.replace(/\/$/,"");var t=e.lastIndexOf("/");return t===-1?e:e.substr(t+1)},join:(...e)=>de.normalize(e.join("/")),join2:(e,t)=>de.normalize(e+"/"+t)},Ht=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return e=>crypto.getRandomValues(e);st("initRandomDevice")},wt=e=>(wt=Ht())(e),Te={resolve:(...e)=>{for(var t="",n=!1,r=e.length-1;r>=-1&&!n;r--){var s=r>=0?e[r]:a.cwd();if(typeof s!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!s)return"";t=s+"/"+t,n=de.isAbs(s)}return t=de.normalizeArray(t.split("/").filter(o=>!!o),!n).join("/"),(n?"/":"")+t||"."},relative:(e,t)=>{e=Te.resolve(e).substr(1),t=Te.resolve(t).substr(1);function n(R){for(var z=0;z=0&&R[Q]==="";Q--);return z>Q?[]:R.slice(z,Q-z+1)}for(var r=n(e.split("/")),s=n(t.split("/")),o=Math.min(r.length,s.length),p=o,g=0;g{for(var r=t+n,s=t;e[s]&&!(s>=r);)++s;if(s-t>16&&e.buffer&&Et)return Et.decode(e.subarray(t,s));for(var o="";t>10,56320|R&1023)}}return o},lt=[],et=e=>{for(var t=0,n=0;n=55296&&r<=57343?(t+=4,++n):t+=3}return t},at=(e,t,n,r)=>{if(!(r>0))return 0;for(var s=n,o=n+r-1,p=0;p=55296&&g<=57343){var O=e.charCodeAt(++p);g=65536+((g&1023)<<10)|O&1023}if(g<=127){if(n>=o)break;t[n++]=g}else if(g<=2047){if(n+1>=o)break;t[n++]=192|g>>6,t[n++]=128|g&63}else if(g<=65535){if(n+2>=o)break;t[n++]=224|g>>12,t[n++]=128|g>>6&63,t[n++]=128|g&63}else{if(n+3>=o)break;t[n++]=240|g>>18,t[n++]=128|g>>12&63,t[n++]=128|g>>6&63,t[n++]=128|g&63}}return t[n]=0,n-s};function vt(e,t,n){var r=et(e)+1,s=new Array(r),o=at(e,s,0,s.length);return s.length=o,s}var Vt=()=>{if(!lt.length){var e=null;if(typeof window<"u"&&typeof window.prompt=="function"&&(e=window.prompt("Input: "),e!==null&&(e+=` +`)),!e)return null;lt=vt(e)}return lt.shift()},Me={ttys:[],init(){},shutdown(){},register(e,t){Me.ttys[e]={input:[],output:[],ops:t},a.registerDevice(e,Me.stream_ops)},stream_ops:{open(e){var t=Me.ttys[e.node.rdev];if(!t)throw new a.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,n,r,s){if(!e.tty||!e.tty.ops.get_char)throw new a.ErrnoError(60);for(var o=0,p=0;p0&&(Ve(Ue(e.output)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,t,n){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,t){t===null||t===10?(Le(Ue(e.output)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(Le(Ue(e.output)),e.output=[])}}},Gt=(e,t)=>{Be.fill(0,e,e+t)},xt=(e,t)=>Math.ceil(e/t)*t,St=e=>{e=xt(e,65536);var t=kt(65536,e);return t&&Gt(t,e),t},le={ops_table:null,mount(e){return le.createNode(null,"/",16895,0)},createNode(e,t,n,r){if(a.isBlkdev(n)||a.isFIFO(n))throw new a.ErrnoError(63);le.ops_table||={dir:{node:{getattr:le.node_ops.getattr,setattr:le.node_ops.setattr,lookup:le.node_ops.lookup,mknod:le.node_ops.mknod,rename:le.node_ops.rename,unlink:le.node_ops.unlink,rmdir:le.node_ops.rmdir,readdir:le.node_ops.readdir,symlink:le.node_ops.symlink},stream:{llseek:le.stream_ops.llseek}},file:{node:{getattr:le.node_ops.getattr,setattr:le.node_ops.setattr},stream:{llseek:le.stream_ops.llseek,read:le.stream_ops.read,write:le.stream_ops.write,allocate:le.stream_ops.allocate,mmap:le.stream_ops.mmap,msync:le.stream_ops.msync}},link:{node:{getattr:le.node_ops.getattr,setattr:le.node_ops.setattr,readlink:le.node_ops.readlink},stream:{}},chrdev:{node:{getattr:le.node_ops.getattr,setattr:le.node_ops.setattr},stream:a.chrdev_stream_ops}};var s=a.createNode(e,t,n,r);return a.isDir(s.mode)?(s.node_ops=le.ops_table.dir.node,s.stream_ops=le.ops_table.dir.stream,s.contents={}):a.isFile(s.mode)?(s.node_ops=le.ops_table.file.node,s.stream_ops=le.ops_table.file.stream,s.usedBytes=0,s.contents=null):a.isLink(s.mode)?(s.node_ops=le.ops_table.link.node,s.stream_ops=le.ops_table.link.stream):a.isChrdev(s.mode)&&(s.node_ops=le.ops_table.chrdev.node,s.stream_ops=le.ops_table.chrdev.stream),s.timestamp=Date.now(),e&&(e.contents[t]=s,e.timestamp=s.timestamp),s},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage(e,t){var n=e.contents?e.contents.length:0;if(!(n>=t)){var r=1024*1024;t=Math.max(t,n*(n>>0),n!=0&&(t=Math.max(t,256));var s=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(s.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(t==0)e.contents=null,e.usedBytes=0;else{var n=e.contents;e.contents=new Uint8Array(t),n&&e.contents.set(n.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=a.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,a.isDir(e.mode)?t.size=4096:a.isFile(e.mode)?t.size=e.usedBytes:a.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){t.mode!==void 0&&(e.mode=t.mode),t.timestamp!==void 0&&(e.timestamp=t.timestamp),t.size!==void 0&&le.resizeFileStorage(e,t.size)},lookup(e,t){throw a.genericErrors[44]},mknod(e,t,n,r){return le.createNode(e,t,n,r)},rename(e,t,n){if(a.isDir(e.mode)){var r;try{r=a.lookupNode(t,n)}catch{}if(r)for(var s in r.contents)throw new a.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=n,t.contents[n]=e,t.timestamp=e.parent.timestamp},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var n=a.lookupNode(e,t);for(var r in n.contents)throw new a.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var n of Object.keys(e.contents))t.push(n);return t},symlink(e,t,n){var r=le.createNode(e,t,41471,0);return r.link=n,r},readlink(e){if(!a.isLink(e.mode))throw new a.ErrnoError(28);return e.link}},stream_ops:{read(e,t,n,r,s){var o=e.node.contents;if(s>=e.node.usedBytes)return 0;var p=Math.min(e.node.usedBytes-s,r);if(p>8&&o.subarray)t.set(o.subarray(s,s+p),n);else for(var g=0;g0||n+t{var s=`al ${e}`;De(e).then(o=>{t(new Uint8Array(o)),s&&Ze()},o=>{if(n)n();else throw`Loading data file "${e}" failed.`}),s&&rt()},Kt=(e,t,n,r,s,o)=>{a.createDataFile(e,t,n,r,s,o)},Jt=i.preloadPlugins||[],Xt=(e,t,n,r)=>{typeof Browser<"u"&&Browser.init();var s=!1;return Jt.forEach(o=>{s||o.canHandle(t)&&(o.handle(e,t,n,r),s=!0)}),s},Yt=(e,t,n,r,s,o,p,g,O,R)=>{var z=t?Te.resolve(de.join2(e,t)):e;function Q(T){function A(D){R?.(),g||Kt(e,t,D,r,s,O),o?.(),Ze()}Xt(T,z,A,()=>{p?.(),Ze()})||A(T)}rt(),typeof n=="string"?$t(n,Q,p):Q(n)},Zt=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},n=t[e];if(typeof n>"u")throw new Error(`Unknown file open mode: ${e}`);return n},ct=(e,t)=>{var n=0;return e&&(n|=365),t&&(n|=146),n},a={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{constructor(e){this.name="ErrnoError",this.errno=e}},genericErrors:{},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{constructor(e,t,n,r){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=a.nextInode++,this.name=t,this.mode=n,this.node_ops={},this.stream_ops={},this.rdev=r,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return a.isDir(this.mode)}get isDevice(){return a.isChrdev(this.mode)}},lookupPath(e,t={}){if(e=Te.resolve(e),!e)return{path:"",node:null};var n={follow_mount:!0,recurse_count:0};if(t=Object.assign(n,t),t.recurse_count>8)throw new a.ErrnoError(32);for(var r=e.split("/").filter(Q=>!!Q),s=a.root,o="/",p=0;p40)throw new a.ErrnoError(32)}}return{path:o,node:s}},getPath(e){for(var t;;){if(a.isRoot(e)){var n=e.mount.mountpoint;return t?n[n.length-1]!=="/"?`${n}/${t}`:n+t:n}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var n=0,r=0;r>>0)%a.nameTable.length},hashAddNode(e){var t=a.hashName(e.parent.id,e.name);e.name_next=a.nameTable[t],a.nameTable[t]=e},hashRemoveNode(e){var t=a.hashName(e.parent.id,e.name);if(a.nameTable[t]===e)a.nameTable[t]=e.name_next;else for(var n=a.nameTable[t];n;){if(n.name_next===e){n.name_next=e.name_next;break}n=n.name_next}},lookupNode(e,t){var n=a.mayLookup(e);if(n)throw new a.ErrnoError(n);for(var r=a.hashName(e.id,t),s=a.nameTable[r];s;s=s.name_next){var o=s.name;if(s.parent.id===e.id&&o===t)return s}return a.lookup(e,t)},createNode(e,t,n,r){var s=new a.FSNode(e,t,n,r);return a.hashAddNode(s),s},destroyNode(e){a.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)===32768},isDir(e){return(e&61440)===16384},isLink(e){return(e&61440)===40960},isChrdev(e){return(e&61440)===8192},isBlkdev(e){return(e&61440)===24576},isFIFO(e){return(e&61440)===4096},isSocket(e){return(e&49152)===49152},flagsToPermissionString(e){var t=["r","w","rw"][e&3];return e&512&&(t+="w"),t},nodePermissions(e,t){return a.ignorePermissions?0:t.includes("r")&&!(e.mode&292)||t.includes("w")&&!(e.mode&146)||t.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!a.isDir(e.mode))return 54;var t=a.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{var n=a.lookupNode(e,t);return 20}catch{}return a.nodePermissions(e,"wx")},mayDelete(e,t,n){var r;try{r=a.lookupNode(e,t)}catch(o){return o.errno}var s=a.nodePermissions(e,"wx");if(s)return s;if(n){if(!a.isDir(r.mode))return 54;if(a.isRoot(r)||a.getPath(r)===a.cwd())return 10}else if(a.isDir(r.mode))return 31;return 0},mayOpen(e,t){return e?a.isLink(e.mode)?32:a.isDir(e.mode)&&(a.flagsToPermissionString(t)!=="r"||t&512)?31:a.nodePermissions(e,a.flagsToPermissionString(t)):44},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=a.MAX_OPEN_FDS;e++)if(!a.streams[e])return e;throw new a.ErrnoError(33)},getStreamChecked(e){var t=a.getStream(e);if(!t)throw new a.ErrnoError(8);return t},getStream:e=>a.streams[e],createStream(e,t=-1){return e=Object.assign(new a.FSStream,e),t==-1&&(t=a.nextfd()),e.fd=t,a.streams[t]=e,e},closeStream(e){a.streams[e]=null},dupStream(e,t=-1){var n=a.createStream(e,t);return n.stream_ops?.dup?.(n),n},chrdev_stream_ops:{open(e){var t=a.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new a.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,t)=>e<<8|t,registerDevice(e,t){a.devices[e]={stream_ops:t}},getDevice:e=>a.devices[e],getMounts(e){for(var t=[],n=[e];n.length;){var r=n.pop();t.push(r),n.push(...r.mounts)}return t},syncfs(e,t){typeof e=="function"&&(t=e,e=!1),a.syncFSRequests++,a.syncFSRequests>1&&Le(`warning: ${a.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var n=a.getMounts(a.root.mount),r=0;function s(p){return a.syncFSRequests--,t(p)}function o(p){if(p)return o.errored?void 0:(o.errored=!0,s(p));++r>=n.length&&s(null)}n.forEach(p=>{if(!p.type.syncfs)return o(null);p.type.syncfs(p,e,o)})},mount(e,t,n){var r=n==="/",s=!n,o;if(r&&a.root)throw new a.ErrnoError(10);if(!r&&!s){var p=a.lookupPath(n,{follow_mount:!1});if(n=p.path,o=p.node,a.isMountpoint(o))throw new a.ErrnoError(10);if(!a.isDir(o.mode))throw new a.ErrnoError(54)}var g={type:e,opts:t,mountpoint:n,mounts:[]},O=e.mount(g);return O.mount=g,g.root=O,r?a.root=O:o&&(o.mounted=g,o.mount&&o.mount.mounts.push(g)),O},unmount(e){var t=a.lookupPath(e,{follow_mount:!1});if(!a.isMountpoint(t.node))throw new a.ErrnoError(28);var n=t.node,r=n.mounted,s=a.getMounts(r);Object.keys(a.nameTable).forEach(p=>{for(var g=a.nameTable[p];g;){var O=g.name_next;s.includes(g.mount)&&a.destroyNode(g),g=O}}),n.mounted=null;var o=n.mount.mounts.indexOf(r);n.mount.mounts.splice(o,1)},lookup(e,t){return e.node_ops.lookup(e,t)},mknod(e,t,n){var r=a.lookupPath(e,{parent:!0}),s=r.node,o=de.basename(e);if(!o||o==="."||o==="..")throw new a.ErrnoError(28);var p=a.mayCreate(s,o);if(p)throw new a.ErrnoError(p);if(!s.node_ops.mknod)throw new a.ErrnoError(63);return s.node_ops.mknod(s,o,t,n)},create(e,t){return t=t!==void 0?t:438,t&=4095,t|=32768,a.mknod(e,t,0)},mkdir(e,t){return t=t!==void 0?t:511,t&=1023,t|=16384,a.mknod(e,t,0)},mkdirTree(e,t){for(var n=e.split("/"),r="",s=0;s"u"&&(n=t,t=438),t|=8192,a.mknod(e,t,n)},symlink(e,t){if(!Te.resolve(e))throw new a.ErrnoError(44);var n=a.lookupPath(t,{parent:!0}),r=n.node;if(!r)throw new a.ErrnoError(44);var s=de.basename(t),o=a.mayCreate(r,s);if(o)throw new a.ErrnoError(o);if(!r.node_ops.symlink)throw new a.ErrnoError(63);return r.node_ops.symlink(r,s,e)},rename(e,t){var n=de.dirname(e),r=de.dirname(t),s=de.basename(e),o=de.basename(t),p,g,O;if(p=a.lookupPath(e,{parent:!0}),g=p.node,p=a.lookupPath(t,{parent:!0}),O=p.node,!g||!O)throw new a.ErrnoError(44);if(g.mount!==O.mount)throw new a.ErrnoError(75);var R=a.lookupNode(g,s),z=Te.relative(e,r);if(z.charAt(0)!==".")throw new a.ErrnoError(28);if(z=Te.relative(t,n),z.charAt(0)!==".")throw new a.ErrnoError(55);var Q;try{Q=a.lookupNode(O,o)}catch{}if(R!==Q){var T=a.isDir(R.mode),A=a.mayDelete(g,s,T);if(A)throw new a.ErrnoError(A);if(A=Q?a.mayDelete(O,o,T):a.mayCreate(O,o),A)throw new a.ErrnoError(A);if(!g.node_ops.rename)throw new a.ErrnoError(63);if(a.isMountpoint(R)||Q&&a.isMountpoint(Q))throw new a.ErrnoError(10);if(O!==g&&(A=a.nodePermissions(g,"w"),A))throw new a.ErrnoError(A);a.hashRemoveNode(R);try{g.node_ops.rename(R,O,o),R.parent=O}catch(D){throw D}finally{a.hashAddNode(R)}}},rmdir(e){var t=a.lookupPath(e,{parent:!0}),n=t.node,r=de.basename(e),s=a.lookupNode(n,r),o=a.mayDelete(n,r,!0);if(o)throw new a.ErrnoError(o);if(!n.node_ops.rmdir)throw new a.ErrnoError(63);if(a.isMountpoint(s))throw new a.ErrnoError(10);n.node_ops.rmdir(n,r),a.destroyNode(s)},readdir(e){var t=a.lookupPath(e,{follow:!0}),n=t.node;if(!n.node_ops.readdir)throw new a.ErrnoError(54);return n.node_ops.readdir(n)},unlink(e){var t=a.lookupPath(e,{parent:!0}),n=t.node;if(!n)throw new a.ErrnoError(44);var r=de.basename(e),s=a.lookupNode(n,r),o=a.mayDelete(n,r,!1);if(o)throw new a.ErrnoError(o);if(!n.node_ops.unlink)throw new a.ErrnoError(63);if(a.isMountpoint(s))throw new a.ErrnoError(10);n.node_ops.unlink(n,r),a.destroyNode(s)},readlink(e){var t=a.lookupPath(e),n=t.node;if(!n)throw new a.ErrnoError(44);if(!n.node_ops.readlink)throw new a.ErrnoError(28);return Te.resolve(a.getPath(n.parent),n.node_ops.readlink(n))},stat(e,t){var n=a.lookupPath(e,{follow:!t}),r=n.node;if(!r)throw new a.ErrnoError(44);if(!r.node_ops.getattr)throw new a.ErrnoError(63);return r.node_ops.getattr(r)},lstat(e){return a.stat(e,!0)},chmod(e,t,n){var r;if(typeof e=="string"){var s=a.lookupPath(e,{follow:!n});r=s.node}else r=e;if(!r.node_ops.setattr)throw new a.ErrnoError(63);r.node_ops.setattr(r,{mode:t&4095|r.mode&-4096,timestamp:Date.now()})},lchmod(e,t){a.chmod(e,t,!0)},fchmod(e,t){var n=a.getStreamChecked(e);a.chmod(n.node,t)},chown(e,t,n,r){var s;if(typeof e=="string"){var o=a.lookupPath(e,{follow:!r});s=o.node}else s=e;if(!s.node_ops.setattr)throw new a.ErrnoError(63);s.node_ops.setattr(s,{timestamp:Date.now()})},lchown(e,t,n){a.chown(e,t,n,!0)},fchown(e,t,n){var r=a.getStreamChecked(e);a.chown(r.node,t,n)},truncate(e,t){if(t<0)throw new a.ErrnoError(28);var n;if(typeof e=="string"){var r=a.lookupPath(e,{follow:!0});n=r.node}else n=e;if(!n.node_ops.setattr)throw new a.ErrnoError(63);if(a.isDir(n.mode))throw new a.ErrnoError(31);if(!a.isFile(n.mode))throw new a.ErrnoError(28);var s=a.nodePermissions(n,"w");if(s)throw new a.ErrnoError(s);n.node_ops.setattr(n,{size:t,timestamp:Date.now()})},ftruncate(e,t){var n=a.getStreamChecked(e);if((n.flags&2097155)===0)throw new a.ErrnoError(28);a.truncate(n.node,t)},utime(e,t,n){var r=a.lookupPath(e,{follow:!0}),s=r.node;s.node_ops.setattr(s,{timestamp:Math.max(t,n)})},open(e,t,n){if(e==="")throw new a.ErrnoError(44);t=typeof t=="string"?Zt(t):t,t&64?(n=typeof n>"u"?438:n,n=n&4095|32768):n=0;var r;if(typeof e=="object")r=e;else{e=de.normalize(e);try{var s=a.lookupPath(e,{follow:!(t&131072)});r=s.node}catch{}}var o=!1;if(t&64)if(r){if(t&128)throw new a.ErrnoError(20)}else r=a.mknod(e,n,0),o=!0;if(!r)throw new a.ErrnoError(44);if(a.isChrdev(r.mode)&&(t&=-513),t&65536&&!a.isDir(r.mode))throw new a.ErrnoError(54);if(!o){var p=a.mayOpen(r,t);if(p)throw new a.ErrnoError(p)}t&512&&!o&&a.truncate(r,0),t&=-131713;var g=a.createStream({node:r,path:a.getPath(r),flags:t,seekable:!0,position:0,stream_ops:r.stream_ops,ungotten:[],error:!1});return g.stream_ops.open&&g.stream_ops.open(g),i.logReadFiles&&!(t&1)&&(e in a.readFiles||(a.readFiles[e]=1)),g},close(e){if(a.isClosed(e))throw new a.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(t){throw t}finally{a.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,t,n){if(a.isClosed(e))throw new a.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new a.ErrnoError(70);if(n!=0&&n!=1&&n!=2)throw new a.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,n),e.ungotten=[],e.position},read(e,t,n,r,s){if(r<0||s<0)throw new a.ErrnoError(28);if(a.isClosed(e))throw new a.ErrnoError(8);if((e.flags&2097155)===1)throw new a.ErrnoError(8);if(a.isDir(e.node.mode))throw new a.ErrnoError(31);if(!e.stream_ops.read)throw new a.ErrnoError(28);var o=typeof s<"u";if(!o)s=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var p=e.stream_ops.read(e,t,n,r,s);return o||(e.position+=p),p},write(e,t,n,r,s,o){if(r<0||s<0)throw new a.ErrnoError(28);if(a.isClosed(e))throw new a.ErrnoError(8);if((e.flags&2097155)===0)throw new a.ErrnoError(8);if(a.isDir(e.node.mode))throw new a.ErrnoError(31);if(!e.stream_ops.write)throw new a.ErrnoError(28);e.seekable&&e.flags&1024&&a.llseek(e,0,2);var p=typeof s<"u";if(!p)s=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var g=e.stream_ops.write(e,t,n,r,s,o);return p||(e.position+=g),g},allocate(e,t,n){if(a.isClosed(e))throw new a.ErrnoError(8);if(t<0||n<=0)throw new a.ErrnoError(28);if((e.flags&2097155)===0)throw new a.ErrnoError(8);if(!a.isFile(e.node.mode)&&!a.isDir(e.node.mode))throw new a.ErrnoError(43);if(!e.stream_ops.allocate)throw new a.ErrnoError(138);e.stream_ops.allocate(e,t,n)},mmap(e,t,n,r,s){if((r&2)!==0&&(s&2)===0&&(e.flags&2097155)!==2)throw new a.ErrnoError(2);if((e.flags&2097155)===1)throw new a.ErrnoError(2);if(!e.stream_ops.mmap)throw new a.ErrnoError(43);if(!t)throw new a.ErrnoError(28);return e.stream_ops.mmap(e,t,n,r,s)},msync(e,t,n,r,s){return e.stream_ops.msync?e.stream_ops.msync(e,t,n,r,s):0},ioctl(e,t,n){if(!e.stream_ops.ioctl)throw new a.ErrnoError(59);return e.stream_ops.ioctl(e,t,n)},readFile(e,t={}){if(t.flags=t.flags||0,t.encoding=t.encoding||"binary",t.encoding!=="utf8"&&t.encoding!=="binary")throw new Error(`Invalid encoding type "${t.encoding}"`);var n,r=a.open(e,t.flags),s=a.stat(e),o=s.size,p=new Uint8Array(o);return a.read(r,p,0,o,0),t.encoding==="utf8"?n=Ue(p):t.encoding==="binary"&&(n=p),a.close(r),n},writeFile(e,t,n={}){n.flags=n.flags||577;var r=a.open(e,n.flags,n.mode);if(typeof t=="string"){var s=new Uint8Array(et(t)+1),o=at(t,s,0,s.length);a.write(r,s,0,o,void 0,n.canOwn)}else if(ArrayBuffer.isView(t))a.write(r,t,0,t.byteLength,void 0,n.canOwn);else throw new Error("Unsupported data type");a.close(r)},cwd:()=>a.currentPath,chdir(e){var t=a.lookupPath(e,{follow:!0});if(t.node===null)throw new a.ErrnoError(44);if(!a.isDir(t.node.mode))throw new a.ErrnoError(54);var n=a.nodePermissions(t.node,"x");if(n)throw new a.ErrnoError(n);a.currentPath=t.path},createDefaultDirectories(){a.mkdir("/tmp"),a.mkdir("/home"),a.mkdir("/home/web_user")},createDefaultDevices(){a.mkdir("/dev"),a.registerDevice(a.makedev(1,3),{read:()=>0,write:(r,s,o,p,g)=>p}),a.mkdev("/dev/null",a.makedev(1,3)),Me.register(a.makedev(5,0),Me.default_tty_ops),Me.register(a.makedev(6,0),Me.default_tty1_ops),a.mkdev("/dev/tty",a.makedev(5,0)),a.mkdev("/dev/tty1",a.makedev(6,0));var e=new Uint8Array(1024),t=0,n=()=>(t===0&&(t=wt(e).byteLength),e[--t]);a.createDevice("/dev","random",n),a.createDevice("/dev","urandom",n),a.mkdir("/dev/shm"),a.mkdir("/dev/shm/tmp")},createSpecialDirectories(){a.mkdir("/proc");var e=a.mkdir("/proc/self");a.mkdir("/proc/self/fd"),a.mount({mount(){var t=a.createNode(e,"fd",16895,73);return t.node_ops={lookup(n,r){var s=+r,o=a.getStreamChecked(s),p={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>o.path}};return p.parent=p,p}},t}},{},"/proc/self/fd")},createStandardStreams(e,t,n){e?a.createDevice("/dev","stdin",e):a.symlink("/dev/tty","/dev/stdin"),t?a.createDevice("/dev","stdout",null,t):a.symlink("/dev/tty","/dev/stdout"),n?a.createDevice("/dev","stderr",null,n):a.symlink("/dev/tty1","/dev/stderr"),a.open("/dev/stdin",0),a.open("/dev/stdout",1),a.open("/dev/stderr",1)},staticInit(){[44].forEach(e=>{a.genericErrors[e]=new a.ErrnoError(e),a.genericErrors[e].stack=""}),a.nameTable=new Array(4096),a.mount(le,{},"/"),a.createDefaultDirectories(),a.createDefaultDevices(),a.createSpecialDirectories(),a.filesystems={MEMFS:le}},init(e,t,n){a.initialized=!0,e??=i.stdin,t??=i.stdout,n??=i.stderr,a.createStandardStreams(e,t,n)},quit(){a.initialized=!1;for(var e=0;ethis.length-1||A<0)){var D=A%this.chunkSize,q=A/this.chunkSize|0;return this.getter(q)[D]}}setDataGetter(A){this.getter=A}cacheLength(){var A=new XMLHttpRequest;if(A.open("HEAD",n,!1),A.send(null),!(A.status>=200&&A.status<300||A.status===304))throw new Error("Couldn't load "+n+". Status: "+A.status);var D=Number(A.getResponseHeader("Content-length")),q,w=(q=A.getResponseHeader("Accept-Ranges"))&&q==="bytes",x=(q=A.getResponseHeader("Content-Encoding"))&&q==="gzip",N=1024*1024;w||(N=D);var P=(L,$)=>{if(L>$)throw new Error("invalid range ("+L+", "+$+") or no bytes requested!");if($>D-1)throw new Error("only "+D+" bytes available! programmer error!");var c=new XMLHttpRequest;if(c.open("GET",n,!1),D!==N&&c.setRequestHeader("Range","bytes="+L+"-"+$),c.responseType="arraybuffer",c.overrideMimeType&&c.overrideMimeType("text/plain; charset=x-user-defined"),c.send(null),!(c.status>=200&&c.status<300||c.status===304))throw new Error("Couldn't load "+n+". Status: "+c.status);return c.response!==void 0?new Uint8Array(c.response||[]):vt(c.responseText||"")},S=this;S.setDataGetter(L=>{var $=L*N,c=(L+1)*N-1;if(c=Math.min(c,D-1),typeof S.chunks[L]>"u"&&(S.chunks[L]=P($,c)),typeof S.chunks[L]>"u")throw new Error("doXHR failed!");return S.chunks[L]}),(x||!D)&&(N=D=1,D=this.getter(0).length,N=D,Ve("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=D,this._chunkSize=N,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!Ce)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var p=new o,g={isDevice:!1,contents:p}}else var g={isDevice:!1,url:n};var O=a.createFile(e,t,g,r,s);g.contents?O.contents=g.contents:g.url&&(O.contents=null,O.url=g.url),Object.defineProperties(O,{usedBytes:{get:function(){return this.contents.length}}});var R={},z=Object.keys(O.stream_ops);z.forEach(T=>{var A=O.stream_ops[T];R[T]=(...D)=>(a.forceLoadFile(O),A(...D))});function Q(T,A,D,q,w){var x=T.node.contents;if(w>=x.length)return 0;var N=Math.min(x.length-w,q);if(x.slice)for(var P=0;P(a.forceLoadFile(O),Q(T,A,D,q,w)),R.mmap=(T,A,D,q,w)=>{a.forceLoadFile(O);var x=St(A);if(!x)throw new a.ErrnoError(48);return Q(T,xe,x,A,D),{ptr:x,allocated:!0}},O.stream_ops=R,O}},en=(e,t)=>e?Ue(Be,e,t):"",ce={DEFAULT_POLLMASK:5,calculateAt(e,t,n){if(de.isAbs(t))return t;var r;if(e===-100)r=a.cwd();else{var s=ce.getStreamFromFD(e);r=s.path}if(t.length==0){if(!n)throw new a.ErrnoError(44);return r}return de.join2(r,t)},doStat(e,t,n){var r=e(t);ue[n>>2]=r.dev,ue[n+4>>2]=r.mode,Ee[n+8>>2]=r.nlink,ue[n+12>>2]=r.uid,ue[n+16>>2]=r.gid,ue[n+20>>2]=r.rdev,ke[n+24>>3]=BigInt(r.size),ue[n+32>>2]=4096,ue[n+36>>2]=r.blocks;var s=r.atime.getTime(),o=r.mtime.getTime(),p=r.ctime.getTime();return ke[n+40>>3]=BigInt(Math.floor(s/1e3)),Ee[n+48>>2]=s%1e3*1e3*1e3,ke[n+56>>3]=BigInt(Math.floor(o/1e3)),Ee[n+64>>2]=o%1e3*1e3*1e3,ke[n+72>>3]=BigInt(Math.floor(p/1e3)),Ee[n+80>>2]=p%1e3*1e3*1e3,ke[n+88>>3]=BigInt(r.ino),0},doMsync(e,t,n,r,s){if(!a.isFile(t.node.mode))throw new a.ErrnoError(43);if(r&2)return 0;var o=Be.slice(e,e+n);a.msync(t,o,s,n,r)},getStreamFromFD(e){var t=a.getStreamChecked(e);return t},varargs:void 0,getStr(e){var t=en(e);return t}};function tn(e,t){try{return e=ce.getStr(e),a.chmod(e,t),0}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}function nn(e,t,n,r){try{if(t=ce.getStr(t),t=ce.calculateAt(e,t),n&-8)return-28;var s=a.lookupPath(t,{follow:!0}),o=s.node;if(!o)return-44;var p="";return n&4&&(p+="r"),n&2&&(p+="w"),n&1&&(p+="x"),p&&a.nodePermissions(o,p)?-2:0}catch(g){if(typeof a>"u"||g.name!=="ErrnoError")throw g;return-g.errno}}function rn(e,t){try{return a.fchmod(e,t),0}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}function sn(e,t,n){try{return a.fchown(e,t,n),0}catch(r){if(typeof a>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}function tt(){var e=ue[+ce.varargs>>2];return ce.varargs+=4,e}var ze=tt;function on(e,t,n){ce.varargs=n;try{var r=ce.getStreamFromFD(e);switch(t){case 0:{var s=tt();if(s<0)return-28;for(;a.streams[s];)s++;var o;return o=a.dupStream(r,s),o.fd}case 1:case 2:return 0;case 3:return r.flags;case 4:{var s=tt();return r.flags|=s,0}case 12:{var s=ze(),p=0;return Ge[s+p>>1]=2,0}case 13:case 14:return 0}return-28}catch(g){if(typeof a>"u"||g.name!=="ErrnoError")throw g;return-g.errno}}function ln(e,t){try{var n=ce.getStreamFromFD(e);return ce.doStat(a.stat,n.path,t)}catch(r){if(typeof a>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}var an=9007199254740992,cn=-9007199254740992,Ke=e=>ean?NaN:Number(e);function _n(e,t){t=Ke(t);try{return isNaN(t)?61:(a.ftruncate(e,t),0)}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var We=(e,t,n)=>at(e,Be,t,n);function un(e,t){try{if(t===0)return-28;var n=a.cwd(),r=et(n)+1;return t"u"||s.name!=="ErrnoError")throw s;return-s.errno}}function fn(e,t,n){ce.varargs=n;try{var r=ce.getStreamFromFD(e);switch(t){case 21509:return r.tty?0:-59;case 21505:{if(!r.tty)return-59;if(r.tty.ops.ioctl_tcgets){var s=r.tty.ops.ioctl_tcgets(r),o=ze();ue[o>>2]=s.c_iflag||0,ue[o+4>>2]=s.c_oflag||0,ue[o+8>>2]=s.c_cflag||0,ue[o+12>>2]=s.c_lflag||0;for(var p=0;p<32;p++)xe[o+p+17]=s.c_cc[p]||0;return 0}return 0}case 21510:case 21511:case 21512:return r.tty?0:-59;case 21506:case 21507:case 21508:{if(!r.tty)return-59;if(r.tty.ops.ioctl_tcsets){for(var o=ze(),g=ue[o>>2],O=ue[o+4>>2],R=ue[o+8>>2],z=ue[o+12>>2],Q=[],p=0;p<32;p++)Q.push(xe[o+p+17]);return r.tty.ops.ioctl_tcsets(r.tty,t,{c_iflag:g,c_oflag:O,c_cflag:R,c_lflag:z,c_cc:Q})}return 0}case 21519:{if(!r.tty)return-59;var o=ze();return ue[o>>2]=0,0}case 21520:return r.tty?-28:-59;case 21531:{var o=ze();return a.ioctl(r,t,o)}case 21523:{if(!r.tty)return-59;if(r.tty.ops.ioctl_tiocgwinsz){var T=r.tty.ops.ioctl_tiocgwinsz(r.tty),o=ze();Ge[o>>1]=T[0],Ge[o+2>>1]=T[1]}return 0}case 21524:return r.tty?0:-59;case 21515:return r.tty?0:-59;default:return-28}}catch(A){if(typeof a>"u"||A.name!=="ErrnoError")throw A;return-A.errno}}function dn(e,t){try{return e=ce.getStr(e),ce.doStat(a.lstat,e,t)}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}function pn(e,t,n){try{return t=ce.getStr(t),t=ce.calculateAt(e,t),t=de.normalize(t),t[t.length-1]==="/"&&(t=t.substr(0,t.length-1)),a.mkdir(t,n,0),0}catch(r){if(typeof a>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}function hn(e,t,n,r){try{t=ce.getStr(t);var s=r&256,o=r&4096;return r=r&-6401,t=ce.calculateAt(e,t,o),ce.doStat(s?a.lstat:a.stat,t,n)}catch(p){if(typeof a>"u"||p.name!=="ErrnoError")throw p;return-p.errno}}function mn(e,t,n,r){ce.varargs=r;try{t=ce.getStr(t),t=ce.calculateAt(e,t);var s=r?tt():0;return a.open(t,n,s).fd}catch(o){if(typeof a>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function gn(e,t,n,r){try{if(t=ce.getStr(t),t=ce.calculateAt(e,t),r<=0)return-28;var s=a.readlink(t),o=Math.min(r,et(s)),p=xe[n+o];return We(s,n,r+1),xe[n+o]=p,o}catch(g){if(typeof a>"u"||g.name!=="ErrnoError")throw g;return-g.errno}}function qn(e){try{return e=ce.getStr(e),a.rmdir(e),0}catch(t){if(typeof a>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function bn(e,t){try{return e=ce.getStr(e),ce.doStat(a.stat,e,t)}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}function yn(e,t,n){try{return t=ce.getStr(t),t=ce.calculateAt(e,t),n===0?a.unlink(t):n===512?a.rmdir(t):st("Invalid flags passed to unlinkat"),0}catch(r){if(typeof a>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}var At=e=>Ee[e>>2]+ue[e+4>>2]*4294967296;function wn(e,t,n,r){try{t=ce.getStr(t),t=ce.calculateAt(e,t,!0);var s=Date.now(),o,p;if(!n)o=s,p=s;else{var g=At(n),O=ue[n+8>>2];O==1073741823?o=s:O==1073741822?o=-1:o=g*1e3+O/1e6,n+=16,g=At(n),O=ue[n+8>>2],O==1073741823?p=s:O==1073741822?p=-1:p=g*1e3+O/1e6}return(p!=-1||o!=-1)&&a.utime(t,o,p),0}catch(R){if(typeof a>"u"||R.name!=="ErrnoError")throw R;return-R.errno}}var En=1,vn=()=>En,xn=e=>e%4===0&&(e%100!==0||e%400===0),Sn=[0,31,60,91,121,152,182,213,244,274,305,335],An=[0,31,59,90,120,151,181,212,243,273,304,334],In=e=>{var t=xn(e.getFullYear()),n=t?Sn:An,r=n[e.getMonth()]+e.getDate()-1;return r};function kn(e,t){e=Ke(e);var n=new Date(e*1e3);ue[t>>2]=n.getSeconds(),ue[t+4>>2]=n.getMinutes(),ue[t+8>>2]=n.getHours(),ue[t+12>>2]=n.getDate(),ue[t+16>>2]=n.getMonth(),ue[t+20>>2]=n.getFullYear()-1900,ue[t+24>>2]=n.getDay();var r=In(n)|0;ue[t+28>>2]=r,ue[t+36>>2]=-(n.getTimezoneOffset()*60);var s=new Date(n.getFullYear(),0,1),o=new Date(n.getFullYear(),6,1).getTimezoneOffset(),p=s.getTimezoneOffset(),g=(o!=p&&n.getTimezoneOffset()==Math.min(p,o))|0;ue[t+32>>2]=g}function Tn(e,t,n,r,s,o,p){s=Ke(s);try{if(isNaN(s))return 61;var g=ce.getStreamFromFD(r),O=a.mmap(g,e,s,t,n),R=O.ptr;return ue[o>>2]=O.allocated,Ee[p>>2]=R,0}catch(z){if(typeof a>"u"||z.name!=="ErrnoError")throw z;return-z.errno}}function Fn(e,t,n,r,s,o){o=Ke(o);try{var p=ce.getStreamFromFD(s);n&2&&ce.doMsync(e,p,t,r,o)}catch(g){if(typeof a>"u"||g.name!=="ErrnoError")throw g;return-g.errno}}var On=(e,t,n,r)=>{var s=new Date().getFullYear(),o=new Date(s,0,1),p=new Date(s,6,1),g=o.getTimezoneOffset(),O=p.getTimezoneOffset(),R=Math.max(g,O);Ee[e>>2]=R*60,ue[t>>2]=+(g!=O);var z=A=>{var D=A>=0?"-":"+",q=Math.abs(A),w=String(Math.floor(q/60)).padStart(2,"0"),x=String(q%60).padStart(2,"0");return`UTC${D}${w}${x}`},Q=z(g),T=z(O);ODate.now(),Ln=()=>performance.now(),Cn=()=>2147483648,Dn=e=>{var t=Re.buffer,n=(e-t.byteLength+65535)/65536|0;try{return Re.grow(n),pt(),1}catch{}},Rn=e=>{var t=Be.length;e>>>=0;var n=Cn();if(e>n)return!1;for(var r=1;r<=4;r*=2){var s=t*(1+.2/r);s=Math.min(s,e+100663296);var o=Math.min(n,xt(Math.max(e,s),65536)),p=Dn(o);if(p)return!0}return!1},_t={},Nn=()=>re||"./this.program",Je=()=>{if(!Je.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:Nn()};for(var n in _t)_t[n]===void 0?delete t[n]:t[n]=_t[n];var r=[];for(var n in t)r.push(`${n}=${t[n]}`);Je.strings=r}return Je.strings},Mn=(e,t)=>{for(var n=0;n{var n=0;return Je().forEach((r,s)=>{var o=t+n;Ee[e+s*4>>2]=o,Mn(r,o),n+=r.length+1}),0},Bn=(e,t)=>{var n=Je();Ee[e>>2]=n.length;var r=0;return n.forEach(s=>r+=s.length+1),Ee[t>>2]=r,0};function Un(e){try{var t=ce.getStreamFromFD(e);return a.close(t),0}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return n.errno}}function zn(e,t){try{var n=0,r=0,s=0,o=ce.getStreamFromFD(e),p=o.tty?2:a.isDir(o.mode)?3:a.isLink(o.mode)?7:4;return xe[t]=p,Ge[t+2>>1]=s,ke[t+8>>3]=BigInt(n),ke[t+16>>3]=BigInt(r),0}catch(g){if(typeof a>"u"||g.name!=="ErrnoError")throw g;return g.errno}}var Wn=(e,t,n,r)=>{for(var s=0,o=0;o>2],g=Ee[t+4>>2];t+=8;var O=a.read(e,xe,p,g,r);if(O<0)return-1;if(s+=O,O>2]=o,0}catch(p){if(typeof a>"u"||p.name!=="ErrnoError")throw p;return p.errno}}function Hn(e,t,n,r){t=Ke(t);try{if(isNaN(t))return 61;var s=ce.getStreamFromFD(e);return a.llseek(s,t,n),ke[r>>3]=BigInt(s.position),s.getdents&&t===0&&n===0&&(s.getdents=null),0}catch(o){if(typeof a>"u"||o.name!=="ErrnoError")throw o;return o.errno}}function Vn(e){try{var t=ce.getStreamFromFD(e);return t.stream_ops?.fsync?t.stream_ops.fsync(t):0}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return n.errno}}var Gn=(e,t,n,r)=>{for(var s=0,o=0;o>2],g=Ee[t+4>>2];t+=8;var O=a.write(e,xe,p,g,r);if(O<0)return-1;if(s+=O,O>2]=o,0}catch(p){if(typeof a>"u"||p.name!=="ErrnoError")throw p;return p.errno}}a.createPreloadedFile=Yt,a.staticInit();var It={__syscall_chmod:tn,__syscall_faccessat:nn,__syscall_fchmod:rn,__syscall_fchown32:sn,__syscall_fcntl64:on,__syscall_fstat64:ln,__syscall_ftruncate64:_n,__syscall_getcwd:un,__syscall_ioctl:fn,__syscall_lstat64:dn,__syscall_mkdirat:pn,__syscall_newfstatat:hn,__syscall_openat:mn,__syscall_readlinkat:gn,__syscall_rmdir:qn,__syscall_stat64:bn,__syscall_unlinkat:yn,__syscall_utimensat:wn,_emscripten_get_now_is_monotonic:vn,_localtime_js:kn,_mmap_js:Tn,_munmap_js:Fn,_tzset_js:On,emscripten_date_now:Pn,emscripten_get_now:Ln,emscripten_resize_heap:Rn,environ_get:jn,environ_sizes_get:Bn,fd_close:Un,fd_fdstat_get:zn,fd_read:Qn,fd_seek:Hn,fd_sync:Vn,fd_write:$n,memory:Re},h=Qt();i._sqlite3_status64=(e,t,n,r)=>(i._sqlite3_status64=h.sqlite3_status64)(e,t,n,r),i._sqlite3_status=(e,t,n,r)=>(i._sqlite3_status=h.sqlite3_status)(e,t,n,r),i._sqlite3_db_status=(e,t,n,r,s)=>(i._sqlite3_db_status=h.sqlite3_db_status)(e,t,n,r,s),i._sqlite3_msize=e=>(i._sqlite3_msize=h.sqlite3_msize)(e),i._sqlite3_vfs_find=e=>(i._sqlite3_vfs_find=h.sqlite3_vfs_find)(e),i._sqlite3_initialize=()=>(i._sqlite3_initialize=h.sqlite3_initialize)(),i._sqlite3_malloc=e=>(i._sqlite3_malloc=h.sqlite3_malloc)(e),i._sqlite3_free=e=>(i._sqlite3_free=h.sqlite3_free)(e),i._sqlite3_vfs_register=(e,t)=>(i._sqlite3_vfs_register=h.sqlite3_vfs_register)(e,t),i._sqlite3_vfs_unregister=e=>(i._sqlite3_vfs_unregister=h.sqlite3_vfs_unregister)(e),i._sqlite3_malloc64=e=>(i._sqlite3_malloc64=h.sqlite3_malloc64)(e),i._sqlite3_realloc=(e,t)=>(i._sqlite3_realloc=h.sqlite3_realloc)(e,t),i._sqlite3_realloc64=(e,t)=>(i._sqlite3_realloc64=h.sqlite3_realloc64)(e,t),i._sqlite3_value_text=e=>(i._sqlite3_value_text=h.sqlite3_value_text)(e),i._sqlite3_randomness=(e,t)=>(i._sqlite3_randomness=h.sqlite3_randomness)(e,t),i._sqlite3_stricmp=(e,t)=>(i._sqlite3_stricmp=h.sqlite3_stricmp)(e,t),i._sqlite3_strnicmp=(e,t,n)=>(i._sqlite3_strnicmp=h.sqlite3_strnicmp)(e,t,n),i._sqlite3_uri_parameter=(e,t)=>(i._sqlite3_uri_parameter=h.sqlite3_uri_parameter)(e,t),i._sqlite3_uri_boolean=(e,t,n)=>(i._sqlite3_uri_boolean=h.sqlite3_uri_boolean)(e,t,n),i._sqlite3_serialize=(e,t,n,r)=>(i._sqlite3_serialize=h.sqlite3_serialize)(e,t,n,r),i._sqlite3_prepare_v2=(e,t,n,r,s)=>(i._sqlite3_prepare_v2=h.sqlite3_prepare_v2)(e,t,n,r,s),i._sqlite3_step=e=>(i._sqlite3_step=h.sqlite3_step)(e),i._sqlite3_column_int64=(e,t)=>(i._sqlite3_column_int64=h.sqlite3_column_int64)(e,t),i._sqlite3_reset=e=>(i._sqlite3_reset=h.sqlite3_reset)(e),i._sqlite3_exec=(e,t,n,r,s)=>(i._sqlite3_exec=h.sqlite3_exec)(e,t,n,r,s),i._sqlite3_column_int=(e,t)=>(i._sqlite3_column_int=h.sqlite3_column_int)(e,t),i._sqlite3_finalize=e=>(i._sqlite3_finalize=h.sqlite3_finalize)(e),i._sqlite3_file_control=(e,t,n,r)=>(i._sqlite3_file_control=h.sqlite3_file_control)(e,t,n,r),i._sqlite3_column_name=(e,t)=>(i._sqlite3_column_name=h.sqlite3_column_name)(e,t),i._sqlite3_column_text=(e,t)=>(i._sqlite3_column_text=h.sqlite3_column_text)(e,t),i._sqlite3_column_type=(e,t)=>(i._sqlite3_column_type=h.sqlite3_column_type)(e,t),i._sqlite3_errmsg=e=>(i._sqlite3_errmsg=h.sqlite3_errmsg)(e),i._sqlite3_deserialize=(e,t,n,r,s,o)=>(i._sqlite3_deserialize=h.sqlite3_deserialize)(e,t,n,r,s,o),i._sqlite3_clear_bindings=e=>(i._sqlite3_clear_bindings=h.sqlite3_clear_bindings)(e),i._sqlite3_value_blob=e=>(i._sqlite3_value_blob=h.sqlite3_value_blob)(e),i._sqlite3_value_bytes=e=>(i._sqlite3_value_bytes=h.sqlite3_value_bytes)(e),i._sqlite3_value_double=e=>(i._sqlite3_value_double=h.sqlite3_value_double)(e),i._sqlite3_value_int=e=>(i._sqlite3_value_int=h.sqlite3_value_int)(e),i._sqlite3_value_int64=e=>(i._sqlite3_value_int64=h.sqlite3_value_int64)(e),i._sqlite3_value_subtype=e=>(i._sqlite3_value_subtype=h.sqlite3_value_subtype)(e),i._sqlite3_value_pointer=(e,t)=>(i._sqlite3_value_pointer=h.sqlite3_value_pointer)(e,t),i._sqlite3_value_type=e=>(i._sqlite3_value_type=h.sqlite3_value_type)(e),i._sqlite3_value_nochange=e=>(i._sqlite3_value_nochange=h.sqlite3_value_nochange)(e),i._sqlite3_value_frombind=e=>(i._sqlite3_value_frombind=h.sqlite3_value_frombind)(e),i._sqlite3_value_dup=e=>(i._sqlite3_value_dup=h.sqlite3_value_dup)(e),i._sqlite3_value_free=e=>(i._sqlite3_value_free=h.sqlite3_value_free)(e),i._sqlite3_result_blob=(e,t,n,r)=>(i._sqlite3_result_blob=h.sqlite3_result_blob)(e,t,n,r),i._sqlite3_result_error_toobig=e=>(i._sqlite3_result_error_toobig=h.sqlite3_result_error_toobig)(e),i._sqlite3_result_error_nomem=e=>(i._sqlite3_result_error_nomem=h.sqlite3_result_error_nomem)(e),i._sqlite3_result_double=(e,t)=>(i._sqlite3_result_double=h.sqlite3_result_double)(e,t),i._sqlite3_result_error=(e,t,n)=>(i._sqlite3_result_error=h.sqlite3_result_error)(e,t,n),i._sqlite3_result_int=(e,t)=>(i._sqlite3_result_int=h.sqlite3_result_int)(e,t),i._sqlite3_result_int64=(e,t)=>(i._sqlite3_result_int64=h.sqlite3_result_int64)(e,t),i._sqlite3_result_null=e=>(i._sqlite3_result_null=h.sqlite3_result_null)(e),i._sqlite3_result_pointer=(e,t,n,r)=>(i._sqlite3_result_pointer=h.sqlite3_result_pointer)(e,t,n,r),i._sqlite3_result_subtype=(e,t)=>(i._sqlite3_result_subtype=h.sqlite3_result_subtype)(e,t),i._sqlite3_result_text=(e,t,n,r)=>(i._sqlite3_result_text=h.sqlite3_result_text)(e,t,n,r),i._sqlite3_result_zeroblob=(e,t)=>(i._sqlite3_result_zeroblob=h.sqlite3_result_zeroblob)(e,t),i._sqlite3_result_zeroblob64=(e,t)=>(i._sqlite3_result_zeroblob64=h.sqlite3_result_zeroblob64)(e,t),i._sqlite3_result_error_code=(e,t)=>(i._sqlite3_result_error_code=h.sqlite3_result_error_code)(e,t),i._sqlite3_user_data=e=>(i._sqlite3_user_data=h.sqlite3_user_data)(e),i._sqlite3_context_db_handle=e=>(i._sqlite3_context_db_handle=h.sqlite3_context_db_handle)(e),i._sqlite3_vtab_nochange=e=>(i._sqlite3_vtab_nochange=h.sqlite3_vtab_nochange)(e),i._sqlite3_vtab_in_first=(e,t)=>(i._sqlite3_vtab_in_first=h.sqlite3_vtab_in_first)(e,t),i._sqlite3_vtab_in_next=(e,t)=>(i._sqlite3_vtab_in_next=h.sqlite3_vtab_in_next)(e,t),i._sqlite3_aggregate_context=(e,t)=>(i._sqlite3_aggregate_context=h.sqlite3_aggregate_context)(e,t),i._sqlite3_get_auxdata=(e,t)=>(i._sqlite3_get_auxdata=h.sqlite3_get_auxdata)(e,t),i._sqlite3_set_auxdata=(e,t,n,r)=>(i._sqlite3_set_auxdata=h.sqlite3_set_auxdata)(e,t,n,r),i._sqlite3_column_count=e=>(i._sqlite3_column_count=h.sqlite3_column_count)(e),i._sqlite3_data_count=e=>(i._sqlite3_data_count=h.sqlite3_data_count)(e),i._sqlite3_column_blob=(e,t)=>(i._sqlite3_column_blob=h.sqlite3_column_blob)(e,t),i._sqlite3_column_bytes=(e,t)=>(i._sqlite3_column_bytes=h.sqlite3_column_bytes)(e,t),i._sqlite3_column_double=(e,t)=>(i._sqlite3_column_double=h.sqlite3_column_double)(e,t),i._sqlite3_column_value=(e,t)=>(i._sqlite3_column_value=h.sqlite3_column_value)(e,t),i._sqlite3_column_decltype=(e,t)=>(i._sqlite3_column_decltype=h.sqlite3_column_decltype)(e,t),i._sqlite3_bind_blob=(e,t,n,r,s)=>(i._sqlite3_bind_blob=h.sqlite3_bind_blob)(e,t,n,r,s),i._sqlite3_bind_double=(e,t,n)=>(i._sqlite3_bind_double=h.sqlite3_bind_double)(e,t,n),i._sqlite3_bind_int=(e,t,n)=>(i._sqlite3_bind_int=h.sqlite3_bind_int)(e,t,n),i._sqlite3_bind_int64=(e,t,n)=>(i._sqlite3_bind_int64=h.sqlite3_bind_int64)(e,t,n),i._sqlite3_bind_null=(e,t)=>(i._sqlite3_bind_null=h.sqlite3_bind_null)(e,t),i._sqlite3_bind_pointer=(e,t,n,r,s)=>(i._sqlite3_bind_pointer=h.sqlite3_bind_pointer)(e,t,n,r,s),i._sqlite3_bind_text=(e,t,n,r,s)=>(i._sqlite3_bind_text=h.sqlite3_bind_text)(e,t,n,r,s),i._sqlite3_bind_parameter_count=e=>(i._sqlite3_bind_parameter_count=h.sqlite3_bind_parameter_count)(e),i._sqlite3_bind_parameter_name=(e,t)=>(i._sqlite3_bind_parameter_name=h.sqlite3_bind_parameter_name)(e,t),i._sqlite3_bind_parameter_index=(e,t)=>(i._sqlite3_bind_parameter_index=h.sqlite3_bind_parameter_index)(e,t),i._sqlite3_db_handle=e=>(i._sqlite3_db_handle=h.sqlite3_db_handle)(e),i._sqlite3_stmt_readonly=e=>(i._sqlite3_stmt_readonly=h.sqlite3_stmt_readonly)(e),i._sqlite3_stmt_isexplain=e=>(i._sqlite3_stmt_isexplain=h.sqlite3_stmt_isexplain)(e),i._sqlite3_stmt_explain=(e,t)=>(i._sqlite3_stmt_explain=h.sqlite3_stmt_explain)(e,t),i._sqlite3_stmt_busy=e=>(i._sqlite3_stmt_busy=h.sqlite3_stmt_busy)(e),i._sqlite3_stmt_status=(e,t,n)=>(i._sqlite3_stmt_status=h.sqlite3_stmt_status)(e,t,n),i._sqlite3_sql=e=>(i._sqlite3_sql=h.sqlite3_sql)(e),i._sqlite3_expanded_sql=e=>(i._sqlite3_expanded_sql=h.sqlite3_expanded_sql)(e),i._sqlite3_preupdate_old=(e,t,n)=>(i._sqlite3_preupdate_old=h.sqlite3_preupdate_old)(e,t,n),i._sqlite3_preupdate_count=e=>(i._sqlite3_preupdate_count=h.sqlite3_preupdate_count)(e),i._sqlite3_preupdate_depth=e=>(i._sqlite3_preupdate_depth=h.sqlite3_preupdate_depth)(e),i._sqlite3_preupdate_blobwrite=e=>(i._sqlite3_preupdate_blobwrite=h.sqlite3_preupdate_blobwrite)(e),i._sqlite3_preupdate_new=(e,t,n)=>(i._sqlite3_preupdate_new=h.sqlite3_preupdate_new)(e,t,n),i._sqlite3_value_numeric_type=e=>(i._sqlite3_value_numeric_type=h.sqlite3_value_numeric_type)(e),i._sqlite3_set_authorizer=(e,t,n)=>(i._sqlite3_set_authorizer=h.sqlite3_set_authorizer)(e,t,n),i._sqlite3_strglob=(e,t)=>(i._sqlite3_strglob=h.sqlite3_strglob)(e,t),i._sqlite3_strlike=(e,t,n)=>(i._sqlite3_strlike=h.sqlite3_strlike)(e,t,n),i._sqlite3_auto_extension=e=>(i._sqlite3_auto_extension=h.sqlite3_auto_extension)(e),i._sqlite3_cancel_auto_extension=e=>(i._sqlite3_cancel_auto_extension=h.sqlite3_cancel_auto_extension)(e),i._sqlite3_reset_auto_extension=()=>(i._sqlite3_reset_auto_extension=h.sqlite3_reset_auto_extension)(),i._sqlite3_prepare_v3=(e,t,n,r,s,o)=>(i._sqlite3_prepare_v3=h.sqlite3_prepare_v3)(e,t,n,r,s,o),i._sqlite3_create_module=(e,t,n,r)=>(i._sqlite3_create_module=h.sqlite3_create_module)(e,t,n,r),i._sqlite3_create_module_v2=(e,t,n,r,s)=>(i._sqlite3_create_module_v2=h.sqlite3_create_module_v2)(e,t,n,r,s),i._sqlite3_drop_modules=(e,t)=>(i._sqlite3_drop_modules=h.sqlite3_drop_modules)(e,t),i._sqlite3_declare_vtab=(e,t)=>(i._sqlite3_declare_vtab=h.sqlite3_declare_vtab)(e,t),i._sqlite3_vtab_on_conflict=e=>(i._sqlite3_vtab_on_conflict=h.sqlite3_vtab_on_conflict)(e),i._sqlite3_vtab_collation=(e,t)=>(i._sqlite3_vtab_collation=h.sqlite3_vtab_collation)(e,t),i._sqlite3_vtab_in=(e,t,n)=>(i._sqlite3_vtab_in=h.sqlite3_vtab_in)(e,t,n),i._sqlite3_vtab_rhs_value=(e,t,n)=>(i._sqlite3_vtab_rhs_value=h.sqlite3_vtab_rhs_value)(e,t,n),i._sqlite3_vtab_distinct=e=>(i._sqlite3_vtab_distinct=h.sqlite3_vtab_distinct)(e),i._sqlite3_keyword_name=(e,t,n)=>(i._sqlite3_keyword_name=h.sqlite3_keyword_name)(e,t,n),i._sqlite3_keyword_count=()=>(i._sqlite3_keyword_count=h.sqlite3_keyword_count)(),i._sqlite3_keyword_check=(e,t)=>(i._sqlite3_keyword_check=h.sqlite3_keyword_check)(e,t),i._sqlite3_complete=e=>(i._sqlite3_complete=h.sqlite3_complete)(e),i._sqlite3_libversion=()=>(i._sqlite3_libversion=h.sqlite3_libversion)(),i._sqlite3_libversion_number=()=>(i._sqlite3_libversion_number=h.sqlite3_libversion_number)(),i._sqlite3_shutdown=()=>(i._sqlite3_shutdown=h.sqlite3_shutdown)(),i._sqlite3_last_insert_rowid=e=>(i._sqlite3_last_insert_rowid=h.sqlite3_last_insert_rowid)(e),i._sqlite3_set_last_insert_rowid=(e,t)=>(i._sqlite3_set_last_insert_rowid=h.sqlite3_set_last_insert_rowid)(e,t),i._sqlite3_changes64=e=>(i._sqlite3_changes64=h.sqlite3_changes64)(e),i._sqlite3_changes=e=>(i._sqlite3_changes=h.sqlite3_changes)(e),i._sqlite3_total_changes64=e=>(i._sqlite3_total_changes64=h.sqlite3_total_changes64)(e),i._sqlite3_total_changes=e=>(i._sqlite3_total_changes=h.sqlite3_total_changes)(e),i._sqlite3_txn_state=(e,t)=>(i._sqlite3_txn_state=h.sqlite3_txn_state)(e,t),i._sqlite3_close_v2=e=>(i._sqlite3_close_v2=h.sqlite3_close_v2)(e),i._sqlite3_busy_handler=(e,t,n)=>(i._sqlite3_busy_handler=h.sqlite3_busy_handler)(e,t,n),i._sqlite3_progress_handler=(e,t,n,r)=>(i._sqlite3_progress_handler=h.sqlite3_progress_handler)(e,t,n,r),i._sqlite3_busy_timeout=(e,t)=>(i._sqlite3_busy_timeout=h.sqlite3_busy_timeout)(e,t),i._sqlite3_interrupt=e=>(i._sqlite3_interrupt=h.sqlite3_interrupt)(e),i._sqlite3_is_interrupted=e=>(i._sqlite3_is_interrupted=h.sqlite3_is_interrupted)(e),i._sqlite3_create_function=(e,t,n,r,s,o,p,g)=>(i._sqlite3_create_function=h.sqlite3_create_function)(e,t,n,r,s,o,p,g),i._sqlite3_create_function_v2=(e,t,n,r,s,o,p,g,O)=>(i._sqlite3_create_function_v2=h.sqlite3_create_function_v2)(e,t,n,r,s,o,p,g,O),i._sqlite3_create_window_function=(e,t,n,r,s,o,p,g,O,R)=>(i._sqlite3_create_window_function=h.sqlite3_create_window_function)(e,t,n,r,s,o,p,g,O,R),i._sqlite3_overload_function=(e,t,n)=>(i._sqlite3_overload_function=h.sqlite3_overload_function)(e,t,n),i._sqlite3_trace_v2=(e,t,n,r)=>(i._sqlite3_trace_v2=h.sqlite3_trace_v2)(e,t,n,r),i._sqlite3_commit_hook=(e,t,n)=>(i._sqlite3_commit_hook=h.sqlite3_commit_hook)(e,t,n),i._sqlite3_update_hook=(e,t,n)=>(i._sqlite3_update_hook=h.sqlite3_update_hook)(e,t,n),i._sqlite3_rollback_hook=(e,t,n)=>(i._sqlite3_rollback_hook=h.sqlite3_rollback_hook)(e,t,n),i._sqlite3_preupdate_hook=(e,t,n)=>(i._sqlite3_preupdate_hook=h.sqlite3_preupdate_hook)(e,t,n),i._sqlite3_error_offset=e=>(i._sqlite3_error_offset=h.sqlite3_error_offset)(e),i._sqlite3_errcode=e=>(i._sqlite3_errcode=h.sqlite3_errcode)(e),i._sqlite3_extended_errcode=e=>(i._sqlite3_extended_errcode=h.sqlite3_extended_errcode)(e),i._sqlite3_errstr=e=>(i._sqlite3_errstr=h.sqlite3_errstr)(e),i._sqlite3_limit=(e,t,n)=>(i._sqlite3_limit=h.sqlite3_limit)(e,t,n),i._sqlite3_open=(e,t)=>(i._sqlite3_open=h.sqlite3_open)(e,t),i._sqlite3_open_v2=(e,t,n,r)=>(i._sqlite3_open_v2=h.sqlite3_open_v2)(e,t,n,r),i._sqlite3_create_collation=(e,t,n,r,s)=>(i._sqlite3_create_collation=h.sqlite3_create_collation)(e,t,n,r,s),i._sqlite3_create_collation_v2=(e,t,n,r,s,o)=>(i._sqlite3_create_collation_v2=h.sqlite3_create_collation_v2)(e,t,n,r,s,o),i._sqlite3_collation_needed=(e,t,n)=>(i._sqlite3_collation_needed=h.sqlite3_collation_needed)(e,t,n),i._sqlite3_get_autocommit=e=>(i._sqlite3_get_autocommit=h.sqlite3_get_autocommit)(e),i._sqlite3_table_column_metadata=(e,t,n,r,s,o,p,g,O)=>(i._sqlite3_table_column_metadata=h.sqlite3_table_column_metadata)(e,t,n,r,s,o,p,g,O),i._sqlite3_extended_result_codes=(e,t)=>(i._sqlite3_extended_result_codes=h.sqlite3_extended_result_codes)(e,t),i._sqlite3_uri_key=(e,t)=>(i._sqlite3_uri_key=h.sqlite3_uri_key)(e,t),i._sqlite3_uri_int64=(e,t,n)=>(i._sqlite3_uri_int64=h.sqlite3_uri_int64)(e,t,n),i._sqlite3_db_name=(e,t)=>(i._sqlite3_db_name=h.sqlite3_db_name)(e,t),i._sqlite3_db_filename=(e,t)=>(i._sqlite3_db_filename=h.sqlite3_db_filename)(e,t),i._sqlite3_db_readonly=(e,t)=>(i._sqlite3_db_readonly=h.sqlite3_db_readonly)(e,t),i._sqlite3_compileoption_used=e=>(i._sqlite3_compileoption_used=h.sqlite3_compileoption_used)(e),i._sqlite3_compileoption_get=e=>(i._sqlite3_compileoption_get=h.sqlite3_compileoption_get)(e),i._sqlite3session_diff=(e,t,n,r)=>(i._sqlite3session_diff=h.sqlite3session_diff)(e,t,n,r),i._sqlite3session_attach=(e,t)=>(i._sqlite3session_attach=h.sqlite3session_attach)(e,t),i._sqlite3session_create=(e,t,n)=>(i._sqlite3session_create=h.sqlite3session_create)(e,t,n),i._sqlite3session_delete=e=>(i._sqlite3session_delete=h.sqlite3session_delete)(e),i._sqlite3session_table_filter=(e,t,n)=>(i._sqlite3session_table_filter=h.sqlite3session_table_filter)(e,t,n),i._sqlite3session_changeset=(e,t,n)=>(i._sqlite3session_changeset=h.sqlite3session_changeset)(e,t,n),i._sqlite3session_changeset_strm=(e,t,n)=>(i._sqlite3session_changeset_strm=h.sqlite3session_changeset_strm)(e,t,n),i._sqlite3session_patchset_strm=(e,t,n)=>(i._sqlite3session_patchset_strm=h.sqlite3session_patchset_strm)(e,t,n),i._sqlite3session_patchset=(e,t,n)=>(i._sqlite3session_patchset=h.sqlite3session_patchset)(e,t,n),i._sqlite3session_enable=(e,t)=>(i._sqlite3session_enable=h.sqlite3session_enable)(e,t),i._sqlite3session_indirect=(e,t)=>(i._sqlite3session_indirect=h.sqlite3session_indirect)(e,t),i._sqlite3session_isempty=e=>(i._sqlite3session_isempty=h.sqlite3session_isempty)(e),i._sqlite3session_memory_used=e=>(i._sqlite3session_memory_used=h.sqlite3session_memory_used)(e),i._sqlite3session_object_config=(e,t,n)=>(i._sqlite3session_object_config=h.sqlite3session_object_config)(e,t,n),i._sqlite3session_changeset_size=e=>(i._sqlite3session_changeset_size=h.sqlite3session_changeset_size)(e),i._sqlite3changeset_start=(e,t,n)=>(i._sqlite3changeset_start=h.sqlite3changeset_start)(e,t,n),i._sqlite3changeset_start_v2=(e,t,n,r)=>(i._sqlite3changeset_start_v2=h.sqlite3changeset_start_v2)(e,t,n,r),i._sqlite3changeset_start_strm=(e,t,n)=>(i._sqlite3changeset_start_strm=h.sqlite3changeset_start_strm)(e,t,n),i._sqlite3changeset_start_v2_strm=(e,t,n,r)=>(i._sqlite3changeset_start_v2_strm=h.sqlite3changeset_start_v2_strm)(e,t,n,r),i._sqlite3changeset_next=e=>(i._sqlite3changeset_next=h.sqlite3changeset_next)(e),i._sqlite3changeset_op=(e,t,n,r,s)=>(i._sqlite3changeset_op=h.sqlite3changeset_op)(e,t,n,r,s),i._sqlite3changeset_pk=(e,t,n)=>(i._sqlite3changeset_pk=h.sqlite3changeset_pk)(e,t,n),i._sqlite3changeset_old=(e,t,n)=>(i._sqlite3changeset_old=h.sqlite3changeset_old)(e,t,n),i._sqlite3changeset_new=(e,t,n)=>(i._sqlite3changeset_new=h.sqlite3changeset_new)(e,t,n),i._sqlite3changeset_conflict=(e,t,n)=>(i._sqlite3changeset_conflict=h.sqlite3changeset_conflict)(e,t,n),i._sqlite3changeset_fk_conflicts=(e,t)=>(i._sqlite3changeset_fk_conflicts=h.sqlite3changeset_fk_conflicts)(e,t),i._sqlite3changeset_finalize=e=>(i._sqlite3changeset_finalize=h.sqlite3changeset_finalize)(e),i._sqlite3changeset_invert=(e,t,n,r)=>(i._sqlite3changeset_invert=h.sqlite3changeset_invert)(e,t,n,r),i._sqlite3changeset_invert_strm=(e,t,n,r)=>(i._sqlite3changeset_invert_strm=h.sqlite3changeset_invert_strm)(e,t,n,r),i._sqlite3changeset_apply_v2=(e,t,n,r,s,o,p,g,O)=>(i._sqlite3changeset_apply_v2=h.sqlite3changeset_apply_v2)(e,t,n,r,s,o,p,g,O),i._sqlite3changeset_apply=(e,t,n,r,s,o)=>(i._sqlite3changeset_apply=h.sqlite3changeset_apply)(e,t,n,r,s,o),i._sqlite3changeset_apply_v2_strm=(e,t,n,r,s,o,p,g,O)=>(i._sqlite3changeset_apply_v2_strm=h.sqlite3changeset_apply_v2_strm)(e,t,n,r,s,o,p,g,O),i._sqlite3changeset_apply_strm=(e,t,n,r,s,o)=>(i._sqlite3changeset_apply_strm=h.sqlite3changeset_apply_strm)(e,t,n,r,s,o),i._sqlite3changegroup_new=e=>(i._sqlite3changegroup_new=h.sqlite3changegroup_new)(e),i._sqlite3changegroup_add=(e,t,n)=>(i._sqlite3changegroup_add=h.sqlite3changegroup_add)(e,t,n),i._sqlite3changegroup_output=(e,t,n)=>(i._sqlite3changegroup_output=h.sqlite3changegroup_output)(e,t,n),i._sqlite3changegroup_add_strm=(e,t,n)=>(i._sqlite3changegroup_add_strm=h.sqlite3changegroup_add_strm)(e,t,n),i._sqlite3changegroup_output_strm=(e,t,n)=>(i._sqlite3changegroup_output_strm=h.sqlite3changegroup_output_strm)(e,t,n),i._sqlite3changegroup_delete=e=>(i._sqlite3changegroup_delete=h.sqlite3changegroup_delete)(e),i._sqlite3changeset_concat=(e,t,n,r,s,o)=>(i._sqlite3changeset_concat=h.sqlite3changeset_concat)(e,t,n,r,s,o),i._sqlite3changeset_concat_strm=(e,t,n,r,s,o)=>(i._sqlite3changeset_concat_strm=h.sqlite3changeset_concat_strm)(e,t,n,r,s,o),i._sqlite3session_config=(e,t)=>(i._sqlite3session_config=h.sqlite3session_config)(e,t),i._sqlite3_sourceid=()=>(i._sqlite3_sourceid=h.sqlite3_sourceid)(),i._sqlite3__wasm_pstack_ptr=()=>(i._sqlite3__wasm_pstack_ptr=h.sqlite3__wasm_pstack_ptr)(),i._sqlite3__wasm_pstack_restore=e=>(i._sqlite3__wasm_pstack_restore=h.sqlite3__wasm_pstack_restore)(e),i._sqlite3__wasm_pstack_alloc=e=>(i._sqlite3__wasm_pstack_alloc=h.sqlite3__wasm_pstack_alloc)(e),i._sqlite3__wasm_pstack_remaining=()=>(i._sqlite3__wasm_pstack_remaining=h.sqlite3__wasm_pstack_remaining)(),i._sqlite3__wasm_pstack_quota=()=>(i._sqlite3__wasm_pstack_quota=h.sqlite3__wasm_pstack_quota)(),i._sqlite3__wasm_db_error=(e,t,n)=>(i._sqlite3__wasm_db_error=h.sqlite3__wasm_db_error)(e,t,n),i._sqlite3__wasm_test_struct=e=>(i._sqlite3__wasm_test_struct=h.sqlite3__wasm_test_struct)(e),i._sqlite3__wasm_enum_json=()=>(i._sqlite3__wasm_enum_json=h.sqlite3__wasm_enum_json)(),i._sqlite3__wasm_vfs_unlink=(e,t)=>(i._sqlite3__wasm_vfs_unlink=h.sqlite3__wasm_vfs_unlink)(e,t),i._sqlite3__wasm_db_vfs=(e,t)=>(i._sqlite3__wasm_db_vfs=h.sqlite3__wasm_db_vfs)(e,t),i._sqlite3__wasm_db_reset=e=>(i._sqlite3__wasm_db_reset=h.sqlite3__wasm_db_reset)(e),i._sqlite3__wasm_db_export_chunked=(e,t)=>(i._sqlite3__wasm_db_export_chunked=h.sqlite3__wasm_db_export_chunked)(e,t),i._sqlite3__wasm_db_serialize=(e,t,n,r,s)=>(i._sqlite3__wasm_db_serialize=h.sqlite3__wasm_db_serialize)(e,t,n,r,s),i._sqlite3__wasm_vfs_create_file=(e,t,n,r)=>(i._sqlite3__wasm_vfs_create_file=h.sqlite3__wasm_vfs_create_file)(e,t,n,r),i._sqlite3__wasm_posix_create_file=(e,t,n)=>(i._sqlite3__wasm_posix_create_file=h.sqlite3__wasm_posix_create_file)(e,t,n),i._sqlite3__wasm_kvvfsMakeKeyOnPstack=(e,t)=>(i._sqlite3__wasm_kvvfsMakeKeyOnPstack=h.sqlite3__wasm_kvvfsMakeKeyOnPstack)(e,t),i._sqlite3__wasm_kvvfs_methods=()=>(i._sqlite3__wasm_kvvfs_methods=h.sqlite3__wasm_kvvfs_methods)(),i._sqlite3__wasm_vtab_config=(e,t,n)=>(i._sqlite3__wasm_vtab_config=h.sqlite3__wasm_vtab_config)(e,t,n),i._sqlite3__wasm_db_config_ip=(e,t,n,r)=>(i._sqlite3__wasm_db_config_ip=h.sqlite3__wasm_db_config_ip)(e,t,n,r),i._sqlite3__wasm_db_config_pii=(e,t,n,r,s)=>(i._sqlite3__wasm_db_config_pii=h.sqlite3__wasm_db_config_pii)(e,t,n,r,s),i._sqlite3__wasm_db_config_s=(e,t,n)=>(i._sqlite3__wasm_db_config_s=h.sqlite3__wasm_db_config_s)(e,t,n),i._sqlite3__wasm_config_i=(e,t)=>(i._sqlite3__wasm_config_i=h.sqlite3__wasm_config_i)(e,t),i._sqlite3__wasm_config_ii=(e,t,n)=>(i._sqlite3__wasm_config_ii=h.sqlite3__wasm_config_ii)(e,t,n),i._sqlite3__wasm_config_j=(e,t)=>(i._sqlite3__wasm_config_j=h.sqlite3__wasm_config_j)(e,t),i._sqlite3__wasm_qfmt_token=(e,t)=>(i._sqlite3__wasm_qfmt_token=h.sqlite3__wasm_qfmt_token)(e,t),i._sqlite3__wasm_init_wasmfs=e=>(i._sqlite3__wasm_init_wasmfs=h.sqlite3__wasm_init_wasmfs)(e),i._sqlite3__wasm_test_intptr=e=>(i._sqlite3__wasm_test_intptr=h.sqlite3__wasm_test_intptr)(e),i._sqlite3__wasm_test_voidptr=e=>(i._sqlite3__wasm_test_voidptr=h.sqlite3__wasm_test_voidptr)(e),i._sqlite3__wasm_test_int64_max=()=>(i._sqlite3__wasm_test_int64_max=h.sqlite3__wasm_test_int64_max)(),i._sqlite3__wasm_test_int64_min=()=>(i._sqlite3__wasm_test_int64_min=h.sqlite3__wasm_test_int64_min)(),i._sqlite3__wasm_test_int64_times2=e=>(i._sqlite3__wasm_test_int64_times2=h.sqlite3__wasm_test_int64_times2)(e),i._sqlite3__wasm_test_int64_minmax=(e,t)=>(i._sqlite3__wasm_test_int64_minmax=h.sqlite3__wasm_test_int64_minmax)(e,t),i._sqlite3__wasm_test_int64ptr=e=>(i._sqlite3__wasm_test_int64ptr=h.sqlite3__wasm_test_int64ptr)(e),i._sqlite3__wasm_test_stack_overflow=e=>(i._sqlite3__wasm_test_stack_overflow=h.sqlite3__wasm_test_stack_overflow)(e),i._sqlite3__wasm_test_str_hello=e=>(i._sqlite3__wasm_test_str_hello=h.sqlite3__wasm_test_str_hello)(e),i._sqlite3__wasm_SQLTester_strglob=(e,t)=>(i._sqlite3__wasm_SQLTester_strglob=h.sqlite3__wasm_SQLTester_strglob)(e,t),i._malloc=e=>(i._malloc=h.malloc)(e),i._free=e=>(i._free=h.free)(e),i._realloc=(e,t)=>(i._realloc=h.realloc)(e,t);var kt=(e,t)=>(kt=h.emscripten_builtin_memalign)(e,t);i.wasmMemory=Re;var nt,Tt;$e=function e(){nt||Ft(),nt||($e=e)};function Ft(){if(Ne>0||!Tt&&(Tt=1,Lt(),Ne>0))return;function e(){nt||(nt=1,i.calledRun=1,!dt&&(Ct(),ye(i),i.onRuntimeInitialized?.(),Dt()))}i.setStatus?(i.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>i.setStatus(""),1),e()},1)):e()}if(i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return Ft(),i.runSQLite3PostLoadInit=function(e){if(globalThis.sqlite3ApiBootstrap=function t(n=globalThis.sqlite3ApiConfig||t.defaultConfig){if(t.sqlite3)return(t.sqlite3.config||console).warn("sqlite3ApiBootstrap() called multiple times.","Config and external initializers are ignored on calls after the first."),t.sqlite3;const r=Object.assign(Object.create(null),{exports:void 0,memory:void 0,bigIntEnabled:typeof i<"u"&&i.HEAPU64?!0:!!globalThis.BigInt64Array,debug:console.debug.bind(console),warn:console.warn.bind(console),error:console.error.bind(console),log:console.log.bind(console),wasmfsOpfsDir:"/opfs",useStdAlloc:!1},n||{});Object.assign(r,{allocExportName:r.useStdAlloc?"malloc":"sqlite3_malloc",deallocExportName:r.useStdAlloc?"free":"sqlite3_free",reallocExportName:r.useStdAlloc?"realloc":"sqlite3_realloc"},r),["exports","memory","wasmfsOpfsDir"].forEach(l=>{typeof r[l]=="function"&&(r[l]=r[l]())}),delete globalThis.sqlite3ApiConfig,delete t.defaultConfig;const s=Object.create(null),o=Object.create(null),p=l=>s.sqlite3_js_rc_str&&s.sqlite3_js_rc_str(l)||"Unknown result code #"+l,g=l=>typeof l=="number"&&l===(l|0);class O extends Error{constructor(..._){let u;if(_.length)if(g(_[0]))if(u=_[0],_.length===1)super(p(_[0]));else{const I=p(u);typeof _[1]=="object"?super(I,_[1]):(_[0]=I+":",super(_.join(" ")))}else _.length===2&&typeof _[1]=="object"?super(..._):super(_.join(" "));this.resultCode=u||s.SQLITE_ERROR,this.name="SQLite3Error"}}O.toss=(...l)=>{throw new O(...l)};const R=O.toss;r.wasmfsOpfsDir&&!/^\/[^/]+$/.test(r.wasmfsOpfsDir)&&R("config.wasmfsOpfsDir must be falsy or in the form '/dir-name'.");const z=l=>typeof l!="bigint"&&l===(l|0)&&l<=2147483647&&l>=-2147483648,Q=function l(_){return l._max||(l._max=BigInt("0x7fffffffffffffff"),l._min=~l._max),_>=l._min&&_<=l._max},T=l=>l>=-0x7fffffffn-1n&&l<=0x7fffffffn,A=function l(_){return l._min||(l._min=Number.MIN_SAFE_INTEGER,l._max=Number.MAX_SAFE_INTEGER),_>=l._min&&_<=l._max},D=l=>l&&l.constructor&&z(l.constructor.BYTES_PER_ELEMENT)?l:!1,q=typeof SharedArrayBuffer>"u"?function(){}:SharedArrayBuffer,w=l=>l.buffer instanceof q,x=(l,_,u)=>w(l)?l.slice(_,u):l.subarray(_,u),N=l=>l&&(l instanceof Uint8Array||l instanceof Int8Array||l instanceof ArrayBuffer),P=l=>l&&(l instanceof Uint8Array||l instanceof Int8Array||l instanceof ArrayBuffer),S=l=>N(l)||R("Value is not of a supported TypedArray type."),L=new TextDecoder("utf-8"),$=function(l,_,u){return L.decode(x(l,_,u))},c=function(l){return P(l)?$(l instanceof ArrayBuffer?new Uint8Array(l):l):Array.isArray(l)?l.join(""):(o.isPtr(l)&&(l=o.cstrToJs(l)),l)};class d extends Error{constructor(..._){_.length===2&&typeof _[1]=="object"?super(..._):_.length?super(_.join(" ")):super("Allocation failed."),this.resultCode=s.SQLITE_NOMEM,this.name="WasmAllocError"}}d.toss=(...l)=>{throw new d(...l)},Object.assign(s,{sqlite3_bind_blob:void 0,sqlite3_bind_text:void 0,sqlite3_create_function_v2:(l,_,u,I,U,ee,ne,se,ie)=>{},sqlite3_create_function:(l,_,u,I,U,ee,ne,se)=>{},sqlite3_create_window_function:(l,_,u,I,U,ee,ne,se,ie,j)=>{},sqlite3_prepare_v3:(l,_,u,I,U,ee)=>{},sqlite3_prepare_v2:(l,_,u,I,U)=>{},sqlite3_exec:(l,_,u,I,U)=>{},sqlite3_randomness:(l,_)=>{}});const y={affirmBindableTypedArray:S,flexibleString:c,bigIntFits32:T,bigIntFits64:Q,bigIntFitsDouble:A,isBindableTypedArray:N,isInt32:z,isSQLableTypedArray:P,isTypedArray:D,typedArrayToString:$,isUIThread:()=>globalThis.window===globalThis&&!!globalThis.document,isSharedTypedArray:w,toss:function(...l){throw new Error(l.join(" "))},toss3:R,typedArrayPart:x,affirmDbHeader:function(l){l instanceof ArrayBuffer&&(l=new Uint8Array(l));const _="SQLite format 3";_.length>l.byteLength&&R("Input does not contain an SQLite3 database header.");for(let u=0;u<_.length;++u)_.charCodeAt(u)!==l[u]&&R("Input does not contain an SQLite3 database header.")},affirmIsDb:function(l){l instanceof ArrayBuffer&&(l=new Uint8Array(l));const _=l.byteLength;(_<512||_%512!==0)&&R("Byte array size",_,"is invalid for an SQLite3 db."),y.affirmDbHeader(l)}};Object.assign(o,{ptrSizeof:r.wasmPtrSizeof||4,ptrIR:r.wasmPtrIR||"i32",bigIntEnabled:!!r.bigIntEnabled,exports:r.exports||R("Missing API config.exports (WASM module exports)."),memory:r.memory||r.exports.memory||R("API config object requires a WebAssembly.Memory object","in either config.exports.memory (exported)","or config.memory (imported)."),alloc:void 0,realloc:void 0,dealloc:void 0}),o.allocFromTypedArray=function(l){l instanceof ArrayBuffer&&(l=new Uint8Array(l)),S(l);const _=o.alloc(l.byteLength||1);return o.heapForSize(l.constructor).set(l.byteLength?l:[0],_),_};{const l=r.allocExportName,_=r.deallocExportName,u=r.reallocExportName;for(const I of[l,_,u])o.exports[I]instanceof Function||R("Missing required exports[",I,"] function.");o.alloc=function I(U){return I.impl(U)||d.toss("Failed to allocate",U," bytes.")},o.alloc.impl=o.exports[l],o.realloc=function I(U,ee){const ne=I.impl(U,ee);return ee?ne||d.toss("Failed to reallocate",ee," bytes."):0},o.realloc.impl=o.exports[u],o.dealloc=o.exports[_]}o.compileOptionUsed=function l(_){if(arguments.length){if(Array.isArray(_)){const u={};return _.forEach(I=>{u[I]=s.sqlite3_compileoption_used(I)}),u}else if(typeof _=="object")return Object.keys(_).forEach(u=>{_[u]=s.sqlite3_compileoption_used(u)}),_}else{if(l._result)return l._result;l._opt||(l._rx=/^([^=]+)=(.+)/,l._rxInt=/^-?\d+$/,l._opt=function(ne,se){const ie=l._rx.exec(ne);se[0]=ie?ie[1]:ne,se[1]=ie?l._rxInt.test(ie[2])?+ie[2]:ie[2]:!0});const u={},I=[0,0];let U=0,ee;for(;ee=s.sqlite3_compileoption_get(U++);)l._opt(ee,I),u[I[0]]=I[1];return l._result=u}return typeof _=="string"?!!s.sqlite3_compileoption_used(_):!1},o.pstack=Object.assign(Object.create(null),{restore:o.exports.sqlite3__wasm_pstack_restore,alloc:function(l){return typeof l=="string"&&!(l=o.sizeofIR(l))&&d.toss("Invalid value for pstack.alloc(",arguments[0],")"),o.exports.sqlite3__wasm_pstack_alloc(l)||d.toss("Could not allocate",l,"bytes from the pstack.")},allocChunks:function(l,_){typeof _=="string"&&!(_=o.sizeofIR(_))&&d.toss("Invalid size value for allocChunks(",arguments[1],")");const u=o.pstack.alloc(l*_),I=[];let U=0,ee=0;for(;Ul===1?o.pstack.alloc(_?8:o.ptrSizeof):o.pstack.allocChunks(l,_?8:o.ptrSizeof),call:function(l){const _=o.pstack.pointer;try{return l(m)}finally{o.pstack.restore(_)}}}),Object.defineProperties(o.pstack,{pointer:{configurable:!1,iterable:!0,writeable:!1,get:o.exports.sqlite3__wasm_pstack_ptr},quota:{configurable:!1,iterable:!0,writeable:!1,get:o.exports.sqlite3__wasm_pstack_quota},remaining:{configurable:!1,iterable:!0,writeable:!1,get:o.exports.sqlite3__wasm_pstack_remaining}}),s.sqlite3_randomness=(...l)=>{if(l.length===1&&y.isTypedArray(l[0])&&l[0].BYTES_PER_ELEMENT===1){const _=l[0];if(_.byteLength===0)return o.exports.sqlite3_randomness(0,0),_;const u=o.pstack.pointer;try{let I=_.byteLength,U=0;const ee=o.exports.sqlite3_randomness,ne=o.heap8u(),se=I<512?I:512,ie=o.pstack.alloc(se);do{const j=I>se?se:I;ee(j,ie),_.set(x(ne,ie,ie+j),U),I-=j,U+=j}while(I>0)}catch(I){console.error("Highly unexpected (and ignored!) exception in sqlite3_randomness():",I)}finally{o.pstack.restore(u)}return _}o.exports.sqlite3_randomness(...l)};let B;if(s.sqlite3_wasmfs_opfs_dir=function(){if(B!==void 0)return B;const l=r.wasmfsOpfsDir;if(!l||!globalThis.FileSystemHandle||!globalThis.FileSystemDirectoryHandle||!globalThis.FileSystemFileHandle)return B="";try{return l&&o.xCallWrapped("sqlite3__wasm_init_wasmfs","i32",["string"],l)===0?B=l:B=""}catch{return B=""}},s.sqlite3_wasmfs_filename_is_persistent=function(l){const _=s.sqlite3_wasmfs_opfs_dir();return _&&l?l.startsWith(_+"/"):!1},s.sqlite3_js_db_uses_vfs=function(l,_,u=0){try{const I=s.sqlite3_vfs_find(_);return I?l?I===s.sqlite3_js_db_vfs(l,u)?I:!1:I===s.sqlite3_vfs_find(0)?I:!1:!1}catch{return!1}},s.sqlite3_js_vfs_list=function(){const l=[];let _=s.sqlite3_vfs_find(0);for(;_;){const u=new s.sqlite3_vfs(_);l.push(o.cstrToJs(u.$zName)),_=u.$pNext,u.dispose()}return l},s.sqlite3_js_db_export=function(l,_=0){l=o.xWrap.testConvertArg("sqlite3*",l),l||R("Invalid sqlite3* argument."),o.bigIntEnabled||R("BigInt64 support is not enabled.");const u=o.scopedAllocPush();let I;try{const U=o.scopedAlloc(8+o.ptrSizeof),ee=U+8,ne=_?o.isPtr(_)?_:o.scopedAllocCString(""+_):0;let se=o.exports.sqlite3__wasm_db_serialize(l,ne,ee,U,0);se&&R("Database serialization failed with code",m.capi.sqlite3_js_rc_str(se)),I=o.peekPtr(ee);const ie=o.peek(U,"i64");return se=ie?o.heap8u().slice(I,I+Number(ie)):new Uint8Array,se}finally{I&&o.exports.sqlite3_free(I),o.scopedAllocPop(u)}},s.sqlite3_js_db_vfs=(l,_=0)=>y.sqlite3__wasm_db_vfs(l,_),s.sqlite3_js_aggregate_context=(l,_)=>s.sqlite3_aggregate_context(l,_)||(_?d.toss("Cannot allocate",_,"bytes for sqlite3_aggregate_context()"):0),s.sqlite3_js_posix_create_file=function(l,_,u){let I;_&&o.isPtr(_)?I=_:_ instanceof ArrayBuffer||_ instanceof Uint8Array?(I=o.allocFromTypedArray(_),(arguments.length<3||!y.isInt32(u)||u<0)&&(u=_.byteLength)):O.toss("Invalid 2nd argument for sqlite3_js_posix_create_file().");try{(!y.isInt32(u)||u<0)&&O.toss("Invalid 3rd argument for sqlite3_js_posix_create_file().");const U=y.sqlite3__wasm_posix_create_file(l,I,u);U&&O.toss("Creation of file failed with sqlite3 result code",s.sqlite3_js_rc_str(U))}finally{o.dealloc(I)}},s.sqlite3_js_vfs_create_file=function(l,_,u,I){r.warn("sqlite3_js_vfs_create_file() is deprecated and","should be avoided because it can lead to C-level crashes.","See its documentation for alternative options.");let U;u?(o.isPtr(u)?U=u:u instanceof ArrayBuffer&&(u=new Uint8Array(u)),u instanceof Uint8Array?(U=o.allocFromTypedArray(u),(arguments.length<4||!y.isInt32(I)||I<0)&&(I=u.byteLength)):O.toss("Invalid 3rd argument type for sqlite3_js_vfs_create_file().")):U=0,(!y.isInt32(I)||I<0)&&(o.dealloc(U),O.toss("Invalid 4th argument for sqlite3_js_vfs_create_file()."));try{const ee=y.sqlite3__wasm_vfs_create_file(l,_,U,I);ee&&O.toss("Creation of file failed with sqlite3 result code",s.sqlite3_js_rc_str(ee))}finally{o.dealloc(U)}},s.sqlite3_js_sql_to_string=l=>{if(typeof l=="string")return l;const _=c(v);return _===v?void 0:_},y.isUIThread()){const l=function(_){const u=Object.create(null);return u.prefix="kvvfs-"+_,u.stores=[],(_==="session"||_==="")&&u.stores.push(globalThis.sessionStorage),(_==="local"||_==="")&&u.stores.push(globalThis.localStorage),u};s.sqlite3_js_kvvfs_clear=function(_=""){let u=0;const I=l(_);return I.stores.forEach(U=>{const ee=[];let ne;for(ne=0;neU.removeItem(se)),u+=ee.length}),u},s.sqlite3_js_kvvfs_size=function(_=""){let u=0;const I=l(_);return I.stores.forEach(U=>{let ee;for(ee=0;eef(l,_,"sqlite3_preupdate_new"),s.sqlite3_preupdate_old_js=(l,_)=>f(l,_,"sqlite3_preupdate_old"),s.sqlite3changeset_new_js=(l,_)=>f(l,_,"sqlite3changeset_new"),s.sqlite3changeset_old_js=(l,_)=>f(l,_,"sqlite3changeset_old");const m={WasmAllocError:d,SQLite3Error:O,capi:s,util:y,wasm:o,config:r,version:Object.create(null),client:void 0,asyncPostInit:async function l(){if(l.isReady instanceof Promise)return l.isReady;let _=t.initializersAsync;delete t.initializersAsync;const u=async()=>(m.__isUnderTest||(delete m.util,delete m.StructBinder),m),I=ee=>{throw r.error("an async sqlite3 initializer failed:",ee),ee};if(!_||!_.length)return l.isReady=u().catch(I);_=_.map(ee=>ee instanceof Function?async ne=>ee(m):ee),_.push(u);let U=Promise.resolve(m);for(;_.length;)U=U.then(_.shift());return l.isReady=U.catch(I)},scriptInfo:void 0};try{t.initializers.forEach(l=>{l(m)})}catch(l){throw console.error("sqlite3 bootstrap initializer threw:",l),l}return delete t.initializers,t.sqlite3=m,m},globalThis.sqlite3ApiBootstrap.initializers=[],globalThis.sqlite3ApiBootstrap.initializersAsync=[],globalThis.sqlite3ApiBootstrap.defaultConfig=Object.create(null),globalThis.sqlite3ApiBootstrap.sqlite3=void 0,globalThis.WhWasmUtilInstaller=function(t){t.bigIntEnabled===void 0&&(t.bigIntEnabled=!!globalThis.BigInt64Array);const n=(...c)=>{throw new Error(c.join(" "))};t.exports||Object.defineProperty(t,"exports",{enumerable:!0,configurable:!0,get:()=>t.instance&&t.instance.exports});const r=t.pointerIR||"i32",s=t.ptrSizeof=r==="i32"?4:r==="i64"?8:n("Unhandled ptrSizeof:",r),o=Object.create(null);o.heapSize=0,o.memory=null,o.freeFuncIndexes=[],o.scopedAlloc=[],o.utf8Decoder=new TextDecoder,o.utf8Encoder=new TextEncoder("utf-8"),t.sizeofIR=c=>{switch(c){case"i8":return 1;case"i16":return 2;case"i32":case"f32":case"float":return 4;case"i64":case"f64":case"double":return 8;case"*":return s;default:return(""+c).endsWith("*")?s:void 0}};const p=function(){if(!o.memory)o.memory=t.memory instanceof WebAssembly.Memory?t.memory:t.exports.memory;else if(o.heapSize===o.memory.buffer.byteLength)return o;const c=o.memory.buffer;return o.HEAP8=new Int8Array(c),o.HEAP8U=new Uint8Array(c),o.HEAP16=new Int16Array(c),o.HEAP16U=new Uint16Array(c),o.HEAP32=new Int32Array(c),o.HEAP32U=new Uint32Array(c),t.bigIntEnabled&&(o.HEAP64=new BigInt64Array(c),o.HEAP64U=new BigUint64Array(c)),o.HEAP32F=new Float32Array(c),o.HEAP64F=new Float64Array(c),o.heapSize=c.byteLength,o};t.heap8=()=>p().HEAP8,t.heap8u=()=>p().HEAP8U,t.heap16=()=>p().HEAP16,t.heap16u=()=>p().HEAP16U,t.heap32=()=>p().HEAP32,t.heap32u=()=>p().HEAP32U,t.heapForSize=function(c,d=!0){const y=o.memory&&o.heapSize===o.memory.buffer.byteLength?o:p();switch(c){case Int8Array:return y.HEAP8;case Uint8Array:return y.HEAP8U;case Int16Array:return y.HEAP16;case Uint16Array:return y.HEAP16U;case Int32Array:return y.HEAP32;case Uint32Array:return y.HEAP32U;case 8:return d?y.HEAP8U:y.HEAP8;case 16:return d?y.HEAP16U:y.HEAP16;case 32:return d?y.HEAP32U:y.HEAP32;case 64:if(y.HEAP64)return d?y.HEAP64U:y.HEAP64;break;default:if(t.bigIntEnabled){if(c===globalThis.BigUint64Array)return y.HEAP64U;if(c===globalThis.BigInt64Array)return y.HEAP64;break}}n("Invalid heapForSize() size: expecting 8, 16, 32,","or (if BigInt is enabled) 64.")},t.functionTable=function(){return t.exports.__indirect_function_table},t.functionEntry=function(c){const d=t.functionTable();return c>7)},rxJSig:/^(\w)\((\w*)\)$/,sigParams:function(m){const l=c._.rxJSig.exec(m);return l?l[2]:m.substr(1)},letterType:m=>c._.sigTypes[m]||n("Invalid signature letter:",m),pushSigType:(m,l)=>m.push(c._.typeCodes[c._.letterType(l)])}),typeof d=="string"){const m=y;y=d,d=m}const B=c._.sigParams(y),f=[1,96];c._.uleb128Encode(f,"push",B.length);for(const m of B)c._.pushSigType(f,m);return y[0]==="v"?f.push(0):(f.push(1),c._.pushSigType(f,y[0])),c._.uleb128Encode(f,"unshift",f.length),f.unshift(0,97,115,109,1,0,0,0,1),f.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array(f)),{e:{f:d}}).exports.f};const g=function(d,y,B){if(B&&!o.scopedAlloc.length&&n("No scopedAllocPush() scope is active."),typeof d=="string"){const _=y;y=d,d=_}(typeof y!="string"||!(d instanceof Function))&&n("Invalid arguments: expecting (function,signature) or (signature,function).");const f=t.functionTable(),m=f.length;let l;for(;o.freeFuncIndexes.length&&(l=o.freeFuncIndexes.pop(),f.get(l));){l=null;continue}l||(l=m,f.grow(1));try{return f.set(l,d),B&&o.scopedAlloc[o.scopedAlloc.length-1].push(l),l}catch(_){if(!(_ instanceof TypeError))throw l===m&&o.freeFuncIndexes.push(m),_}try{const _=t.jsFuncToWasm(d,y);f.set(l,_),B&&o.scopedAlloc[o.scopedAlloc.length-1].push(l)}catch(_){throw l===m&&o.freeFuncIndexes.push(m),_}return l};t.installFunction=(c,d)=>g(c,d,!1),t.scopedInstallFunction=(c,d)=>g(c,d,!0),t.uninstallFunction=function(c){if(!c&&c!==0)return;const d=o.freeFuncIndexes,y=t.functionTable();d.push(c);const B=y.get(c);return y.set(c,null),B},t.peek=function(d,y="i8"){y.endsWith("*")&&(y=r);const B=o.memory&&o.heapSize===o.memory.buffer.byteLength?o:p(),f=Array.isArray(d)?[]:void 0;let m;do{switch(f&&(d=arguments[0].shift()),y){case"i1":case"i8":m=B.HEAP8[d>>0];break;case"i16":m=B.HEAP16[d>>1];break;case"i32":m=B.HEAP32[d>>2];break;case"float":case"f32":m=B.HEAP32F[d>>2];break;case"double":case"f64":m=Number(B.HEAP64F[d>>3]);break;case"i64":if(t.bigIntEnabled){m=BigInt(B.HEAP64[d>>3]);break}default:n("Invalid type for peek():",y)}f&&f.push(m)}while(f&&arguments[0].length);return f||m},t.poke=function(c,d,y="i8"){y.endsWith("*")&&(y=r);const B=o.memory&&o.heapSize===o.memory.buffer.byteLength?o:p();for(const f of Array.isArray(c)?c:[c])switch(y){case"i1":case"i8":B.HEAP8[f>>0]=d;continue;case"i16":B.HEAP16[f>>1]=d;continue;case"i32":B.HEAP32[f>>2]=d;continue;case"float":case"f32":B.HEAP32F[f>>2]=d;continue;case"double":case"f64":B.HEAP64F[f>>3]=d;continue;case"i64":if(B.HEAP64){B.HEAP64[f>>3]=BigInt(d);continue}default:n("Invalid type for poke(): "+y)}return this},t.peekPtr=(...c)=>t.peek(c.length===1?c[0]:c,r),t.pokePtr=(c,d=0)=>t.poke(c,d,r),t.peek8=(...c)=>t.peek(c.length===1?c[0]:c,"i8"),t.poke8=(c,d)=>t.poke(c,d,"i8"),t.peek16=(...c)=>t.peek(c.length===1?c[0]:c,"i16"),t.poke16=(c,d)=>t.poke(c,d,"i16"),t.peek32=(...c)=>t.peek(c.length===1?c[0]:c,"i32"),t.poke32=(c,d)=>t.poke(c,d,"i32"),t.peek64=(...c)=>t.peek(c.length===1?c[0]:c,"i64"),t.poke64=(c,d)=>t.poke(c,d,"i64"),t.peek32f=(...c)=>t.peek(c.length===1?c[0]:c,"f32"),t.poke32f=(c,d)=>t.poke(c,d,"f32"),t.peek64f=(...c)=>t.peek(c.length===1?c[0]:c,"f64"),t.poke64f=(c,d)=>t.poke(c,d,"f64"),t.getMemValue=t.peek,t.getPtrValue=t.peekPtr,t.setMemValue=t.poke,t.setPtrValue=t.pokePtr,t.isPtr32=c=>typeof c=="number"&&c===(c|0)&&c>=0,t.isPtr=t.isPtr32,t.cstrlen=function(c){if(!c||!t.isPtr(c))return null;const d=p().HEAP8U;let y=c;for(;d[y]!==0;++y);return y-c};const O=typeof SharedArrayBuffer>"u"?function(){}:SharedArrayBuffer,R=function(c,d,y){return o.utf8Decoder.decode(c.buffer instanceof O?c.slice(d,y):c.subarray(d,y))};t.cstrToJs=function(c){const d=t.cstrlen(c);return d?R(p().HEAP8U,c,c+d):d===null?d:""},t.jstrlen=function(c){if(typeof c!="string")return null;const d=c.length;let y=0;for(let B=0;B=55296&&f<=57343&&(f=65536+((f&1023)<<10)|c.charCodeAt(++B)&1023),f<=127?++y:f<=2047?y+=2:f<=65535?y+=3:y+=4}return y},t.jstrcpy=function(c,d,y=0,B=-1,f=!0){if((!d||!(d instanceof Int8Array)&&!(d instanceof Uint8Array))&&n("jstrcpy() target must be an Int8Array or Uint8Array."),B<0&&(B=d.length-y),!(B>0)||!(y>=0))return 0;let m=0,l=c.length;const _=y,u=y+B-(f?1:0);for(;m=55296&&I<=57343&&(I=65536+((I&1023)<<10)|c.charCodeAt(++m)&1023),I<=127){if(y>=u)break;d[y++]=I}else if(I<=2047){if(y+1>=u)break;d[y++]=192|I>>6,d[y++]=128|I&63}else if(I<=65535){if(y+2>=u)break;d[y++]=224|I>>12,d[y++]=128|I>>6&63,d[y++]=128|I&63}else{if(y+3>=u)break;d[y++]=240|I>>18,d[y++]=128|I>>12&63,d[y++]=128|I>>6&63,d[y++]=128|I&63}}return f&&(d[y++]=0),y-_},t.cstrncpy=function(c,d,y){if((!c||!d)&&n("cstrncpy() does not accept NULL strings."),y<0)y=t.cstrlen(strPtr)+1;else if(!(y>0))return 0;const B=t.heap8u();let f=0,m;for(;fo.utf8Encoder.encode(d?c+"\0":c);const z=(c,d)=>{(!(c.alloc instanceof Function)||!(c.dealloc instanceof Function))&&n("Object is missing alloc() and/or dealloc() function(s)","required by",d+"().")},Q=function(c,d,y,B){if(z(t,B),typeof c!="string")return null;{const f=o.utf8Encoder.encode(c),m=y(f.length+1),l=p().HEAP8U;return l.set(f,m),l[m+f.length]=0,d?[m,f.length]:m}};t.allocCString=(c,d=!1)=>Q(c,d,t.alloc,"allocCString()"),t.scopedAllocPush=function(){z(t,"scopedAllocPush");const c=[];return o.scopedAlloc.push(c),c},t.scopedAllocPop=function(c){z(t,"scopedAllocPop");const d=arguments.length?o.scopedAlloc.indexOf(c):o.scopedAlloc.length-1;d<0&&n("Invalid state object for scopedAllocPop()."),arguments.length===0&&(c=o.scopedAlloc[d]),o.scopedAlloc.splice(d,1);for(let y;y=c.pop();)t.functionEntry(y)?t.uninstallFunction(y):t.dealloc(y)},t.scopedAlloc=function(c){o.scopedAlloc.length||n("No scopedAllocPush() scope is active.");const d=t.alloc(c);return o.scopedAlloc[o.scopedAlloc.length-1].push(d),d},Object.defineProperty(t.scopedAlloc,"level",{configurable:!1,enumerable:!1,get:()=>o.scopedAlloc.length,set:()=>n("The 'active' property is read-only.")}),t.scopedAllocCString=(c,d=!1)=>Q(c,d,t.scopedAlloc,"scopedAllocCString()");const T=function(c,d){const y=t[c?"scopedAlloc":"alloc"]((d.length+1)*t.ptrSizeof);let B=0;return d.forEach(f=>{t.pokePtr(y+t.ptrSizeof*B++,t[c?"scopedAllocCString":"allocCString"](""+f))}),t.pokePtr(y+t.ptrSizeof*B,0),y};t.scopedAllocMainArgv=c=>T(!0,c),t.allocMainArgv=c=>T(!1,c),t.cArgvToJs=(c,d)=>{const y=[];for(let B=0;BA(c,d,"alloc"),t.scopedAllocPtr=(c=1,d=!0)=>A(c,d,"scopedAlloc"),t.xGet=function(c){return t.exports[c]||n("Cannot find exported symbol:",c)};const D=(c,d)=>n(c+"() requires",d,"argument(s).");t.xCall=function(c,...d){const y=c instanceof Function?c:t.xGet(c);return y instanceof Function||n("Exported symbol",c,"is not a function."),y.length!==d.length&&D(y===c?y.name:c,y.length),arguments.length===2&&Array.isArray(arguments[1])?y.apply(null,arguments[1]):y.apply(null,d)},o.xWrap=Object.create(null),o.xWrap.convert=Object.create(null),o.xWrap.convert.arg=new Map,o.xWrap.convert.result=new Map;const q=o.xWrap.convert.arg,w=o.xWrap.convert.result;t.bigIntEnabled&&q.set("i64",c=>BigInt(c));const x=r==="i32"?c=>c|0:c=>BigInt(c)|BigInt(0);q.set("i32",x).set("i16",c=>(c|0)&65535).set("i8",c=>(c|0)&255).set("f32",c=>Number(c).valueOf()).set("float",q.get("f32")).set("f64",q.get("f32")).set("double",q.get("f64")).set("int",q.get("i32")).set("null",c=>c).set(null,q.get("null")).set("**",x).set("*",x),w.set("*",x).set("pointer",x).set("number",c=>Number(c)).set("void",c=>{}).set("null",c=>c).set(null,w.get("null"));{const c=["i8","i16","i32","int","f32","float","f64","double"];t.bigIntEnabled&&c.push("i64");const d=q.get(r);for(const y of c)q.set(y+"*",d),w.set(y+"*",d),w.set(y,q.get(y)||n("Missing arg converter:",y))}const N=function(c){return typeof c=="string"?t.scopedAllocCString(c):c?x(c):null};q.set("string",N).set("utf8",N).set("pointer",N),w.set("string",c=>t.cstrToJs(c)).set("utf8",w.get("string")).set("string:dealloc",c=>{try{return c?t.cstrToJs(c):null}finally{t.dealloc(c)}}).set("utf8:dealloc",w.get("string:dealloc")).set("json",c=>JSON.parse(t.cstrToJs(c))).set("json:dealloc",c=>{try{return c?JSON.parse(t.cstrToJs(c)):null}finally{t.dealloc(c)}});const P=class{constructor(c){this.name=c.name||"unnamed adapter"}convertArg(c,d,y){n("AbstractArgAdapter must be subclassed.")}};q.FuncPtrAdapter=class Fe extends P{constructor(d){super(d),q.FuncPtrAdapter.warnOnUse&&console.warn("xArg.FuncPtrAdapter is an internal-only API","and is not intended to be invoked from","client-level code. Invoked with:",d),this.name=d.name||"unnamed",this.signature=d.signature,d.contextKey instanceof Function&&(this.contextKey=d.contextKey,d.bindScope||(d.bindScope="context")),this.bindScope=d.bindScope||n("FuncPtrAdapter options requires a bindScope (explicit or implied)."),Fe.bindScopes.indexOf(d.bindScope)<0&&n("Invalid options.bindScope ("+d.bindMod+") for FuncPtrAdapter. Expecting one of: ("+Fe.bindScopes.join(", ")+")"),this.isTransient=this.bindScope==="transient",this.isContext=this.bindScope==="context",this.isPermanent=this.bindScope==="permanent",this.singleton=this.bindScope==="singleton"?[]:void 0,this.callProxy=d.callProxy instanceof Function?d.callProxy:void 0}contextKey(d,y){return this}contextMap(d){const y=this.__cmap||(this.__cmap=new Map);let B=y.get(d);return B===void 0&&y.set(d,B=[]),B}convertArg(d,y,B){let f=this.singleton;if(!f&&this.isContext&&(f=this.contextMap(this.contextKey(y,B))),f&&f[0]===d)return f[1];if(d instanceof Function){this.callProxy&&(d=this.callProxy(d));const m=g(d,this.signature,this.isTransient);if(Fe.debugFuncInstall&&Fe.debugOut("FuncPtrAdapter installed",this,this.contextKey(y,B),"@"+m,d),f){if(f[1]){Fe.debugFuncInstall&&Fe.debugOut("FuncPtrAdapter uninstalling",this,this.contextKey(y,B),"@"+f[1],d);try{o.scopedAlloc[o.scopedAlloc.length-1].push(f[1])}catch{}}f[0]=d,f[1]=m}return m}else if(t.isPtr(d)||d===null||d===void 0){if(f&&f[1]&&f[1]!==d){Fe.debugFuncInstall&&Fe.debugOut("FuncPtrAdapter uninstalling",this,this.contextKey(y,B),"@"+f[1],d);try{o.scopedAlloc[o.scopedAlloc.length-1].push(f[1])}catch{}f[0]=f[1]=d|0}return d||0}else throw new TypeError("Invalid FuncPtrAdapter argument type. Expecting a function pointer or a "+(this.name?this.name+" ":"")+"function matching signature "+this.signature+".")}},q.FuncPtrAdapter.warnOnUse=!1,q.FuncPtrAdapter.debugFuncInstall=!1,q.FuncPtrAdapter.debugOut=console.debug.bind(console),q.FuncPtrAdapter.bindScopes=["transient","context","singleton","permanent"];const S=c=>q.get(c)||n("Argument adapter not found:",c),L=c=>w.get(c)||n("Result adapter not found:",c);o.xWrap.convertArg=(c,...d)=>S(c)(...d),o.xWrap.convertArgNoCheck=(c,...d)=>q.get(c)(...d),o.xWrap.convertResult=(c,d)=>c===null?d:c?L(c)(d):void 0,o.xWrap.convertResultNoCheck=(c,d)=>c===null?d:c?w.get(c)(d):void 0,t.xWrap=function(c,d,...y){arguments.length===3&&Array.isArray(arguments[2])&&(y=arguments[2]),t.isPtr(c)&&(c=t.functionEntry(c)||n("Function pointer not found in WASM function table."));const B=c instanceof Function,f=B?c:t.xGet(c);if(B&&(c=f.name||"unnamed function"),y.length!==f.length&&D(c,f.length),d===null&&f.length===0)return f;d!=null&&L(d);for(const l of y)l instanceof P?q.set(l,(..._)=>l.convertArg(..._)):S(l);const m=o.xWrap;return f.length===0?(...l)=>l.length?D(c,f.length):m.convertResult(d,f.call(null)):function(...l){l.length!==f.length&&D(c,f.length);const _=t.scopedAllocPush();try{let u=0;for(;ufetch(t.uri,{credentials:"same-origin"}),r=this,s=function(p){if(t.wasmUtilTarget){const g=(...R)=>{throw new Error(R.join(" "))},O=t.wasmUtilTarget;if(O.module=p.module,O.instance=p.instance,O.instance.exports.memory||(O.memory=t.imports&&t.imports.env&&t.imports.env.memory||g("Missing 'memory' object!")),!O.alloc&&p.instance.exports.malloc){const R=p.instance.exports;O.alloc=function(z){return R.malloc(z)||g("Allocation of",z,"bytes failed.")},O.dealloc=function(z){R.free(z)}}r(O)}return t.onload&&t.onload(p,t),p};return WebAssembly.instantiateStreaming?function(){return WebAssembly.instantiateStreaming(n(),t.imports||{}).then(s)}:function(){return n().then(g=>g.arrayBuffer()).then(g=>WebAssembly.instantiate(g,t.imports||{})).then(s)}}).bind(globalThis.WhWasmUtilInstaller),globalThis.Jaccwabyt=function t(n){const r=(...F)=>{throw new Error(F.join(" "))};!(n.heap instanceof WebAssembly.Memory)&&!(n.heap instanceof Function)&&r("config.heap must be WebAssembly.Memory instance or a function."),["alloc","dealloc"].forEach(function(F){n[F]instanceof Function||r("Config option '"+F+"' must be a function.")});const s=t,o=n.heap instanceof Function?n.heap:()=>new Uint8Array(n.heap.buffer),p=n.alloc,g=n.dealloc,O=n.log||console.log.bind(console),R=n.memberPrefix||"",z=n.memberSuffix||"",Q=n.bigIntEnabled===void 0?!!globalThis.BigInt64Array:!!n.bigIntEnabled,T=globalThis.BigInt,A=globalThis.BigInt64Array,D=n.ptrSizeof||4,q=n.ptrIR||"i32";s.debugFlags||(s.__makeDebugFlags=function(F=null){F&&F.__flags&&(F=F.__flags);const V=function K(X){return arguments.length===0?K.__flags:(X<0?(delete K.__flags.getter,delete K.__flags.setter,delete K.__flags.alloc,delete K.__flags.dealloc):(K.__flags.getter=(1&X)!==0,K.__flags.setter=(2&X)!==0,K.__flags.alloc=(4&X)!==0,K.__flags.dealloc=(8&X)!==0),K._flags)};return Object.defineProperty(V,"__flags",{iterable:!1,writable:!1,value:Object.create(F)}),F||V(0),V},s.debugFlags=s.__makeDebugFlags());const w=(function(){const F=new ArrayBuffer(2);return new DataView(F).setInt16(0,256,!0),new Int16Array(F)[0]===256})(),x=F=>F[1]==="(",N=F=>F==="P",P=F=>x(F)?"p":F[0],S=function(F){switch(P(F)){case"c":case"C":return"i8";case"i":return"i32";case"p":case"P":case"s":return q;case"j":return"i64";case"f":return"float";case"d":return"double"}r("Unhandled signature IR:",F)},L=A?()=>!0:()=>r("BigInt64Array is not available."),$=function(F){switch(P(F)){case"p":case"P":case"s":{switch(D){case 4:return"getInt32";case 8:return L()&&"getBigInt64"}break}case"i":return"getInt32";case"c":return"getInt8";case"C":return"getUint8";case"j":return L()&&"getBigInt64";case"f":return"getFloat32";case"d":return"getFloat64"}r("Unhandled DataView getter for signature:",F)},c=function(F){switch(P(F)){case"p":case"P":case"s":{switch(D){case 4:return"setInt32";case 8:return L()&&"setBigInt64"}break}case"i":return"setInt32";case"c":return"setInt8";case"C":return"setUint8";case"j":return L()&&"setBigInt64";case"f":return"setFloat32";case"d":return"setFloat64"}r("Unhandled DataView setter for signature:",F)},d=function(F){switch(P(F)){case"i":case"f":case"c":case"C":case"d":return Number;case"j":return L()&&T;case"p":case"P":case"s":switch(D){case 4:return Number;case 8:return L()&&T}break}r("Unhandled DataView set wrapper for signature:",F)},y=(F,V)=>F+"::"+V,B=function(F,V){return()=>r(y(F,V),"is read-only.")},f=new WeakMap,m="(pointer-is-external)",l=function(F,V,K){if(K||(K=f.get(V)),K){if(f.delete(V),Array.isArray(V.ondispose)){let X;for(;X=V.ondispose.shift();)try{X instanceof Function?X.call(V):X instanceof te?X.dispose():typeof X=="number"&&g(X)}catch(_e){console.warn("ondispose() for",F.structName,"@",K,"threw. NOT propagating it.",_e)}}else if(V.ondispose instanceof Function)try{V.ondispose()}catch(X){console.warn("ondispose() for",F.structName,"@",K,"threw. NOT propagating it.",X)}delete V.ondispose,F.debugFlags.__flags.dealloc&&O("debug.dealloc:",V[m]?"EXTERNAL":"",F.structName,"instance:",F.structInfo.sizeof,"bytes @"+K),V[m]||g(K)}},_=F=>({configurable:!1,writable:!1,iterable:!1,value:F}),u=function(F,V,K){let X=!K;K?Object.defineProperty(V,m,_(K)):(K=p(F.structInfo.sizeof),K||r("Allocation of",F.structName,"structure failed."));try{F.debugFlags.__flags.alloc&&O("debug.alloc:",X?"":"EXTERNAL",F.structName,"instance:",F.structInfo.sizeof,"bytes @"+K),X&&o().fill(0,K,K+F.structInfo.sizeof),f.set(V,K)}catch(_e){throw l(F,V,K),_e}},I=function(){const F=this.pointer;return F?new Uint8Array(o().slice(F,F+this.structInfo.sizeof)):null},ee=_(F=>R+F+z),ne=function(F,V,K=!0){let X=F.members[V];if(!X&&(R||z)){for(const _e of Object.values(F.members))if(_e.key===V){X=_e;break}!X&&K&&r(y(F.name,V),"is not a mapped struct member.")}return X},se=function F(V,K,X=!1){F._||(F._=ge=>ge.replace(/[^vipPsjrdcC]/g,"").replace(/[pPscC]/g,"i"));const _e=ne(V.structInfo,K,!0);return X?F._(_e.signature):_e.signature},ie={configurable:!1,enumerable:!1,get:function(){return f.get(this)},set:()=>r("Cannot assign the 'pointer' property of a struct.")},j=_(function(){const F=[];for(const V of Object.keys(this.structInfo.members))F.push(this.memberKey(V));return F}),b=new TextDecoder("utf-8"),k=new TextEncoder,W=typeof SharedArrayBuffer>"u"?function(){}:SharedArrayBuffer,H=function(F,V,K){return b.decode(F.buffer instanceof W?F.slice(V,K):F.subarray(V,K))},Z=function(F,V,K=!1){const X=ne(F.structInfo,V,K);return X&&X.signature.length===1&&X.signature[0]==="s"?X:!1},E=function(F){F.signature!=="s"&&r("Invalid member type signature for C-string value:",JSON.stringify(F))},C=function(V,K){const X=ne(V.structInfo,K,!0);E(X);const _e=V[X.key];if(!_e)return null;let ge=_e;const pe=o();for(;pe[ge]!==0;++ge);return _e===ge?"":H(pe,_e,ge)},M=function(F,...V){F.ondispose?Array.isArray(F.ondispose)||(F.ondispose=[F.ondispose]):F.ondispose=[],F.ondispose.push(...V)},J=function(F){const V=k.encode(F),K=p(V.length+1);K||r("Allocation error while duplicating string:",F);const X=o();return X.set(V,K),X[K+V.length]=0,K},G=function(F,V,K){const X=ne(F.structInfo,V,!0);E(X);const _e=J(K);return F[X.key]=_e,M(F,_e),F},te=function(V,K){arguments[2]!==_&&r("Do not call the StructType constructor","from client-level code."),Object.defineProperties(this,{structName:_(V),structInfo:_(K)})};te.prototype=Object.create(null,{dispose:_(function(){l(this.constructor,this)}),lookupMember:_(function(F,V=!0){return ne(this.structInfo,F,V)}),memberToJsString:_(function(F){return C(this,F)}),memberIsString:_(function(F,V=!0){return Z(this,F,V)}),memberKey:ee,memberKeys:j,memberSignature:_(function(F,V=!1){return se(this,F,V)}),memoryDump:_(I),pointer:ie,setMemberCString:_(function(F,V){return G(this,F,V)})}),Object.assign(te.prototype,{addOnDispose:function(...F){return M(this,...F),this}}),Object.defineProperties(te,{allocCString:_(J),isA:_(F=>F instanceof te),hasExternalPointer:_(F=>F instanceof te&&!!F[m]),memberKey:ee});const ae=F=>Number.isFinite(F)||F instanceof(T||Number),Y=function F(V,K,X){if(!F._){F._={getters:{},setters:{},sw:{}};const ve=["i","c","C","p","P","s","f","d","v()"];Q&&ve.push("j"),ve.forEach(function(Se){F._.getters[Se]=$(Se),F._.setters[Se]=c(Se),F._.sw[Se]=d(Se)});const Kn=/^[ipPsjfdcC]$/,Jn=/^[vipPsjfdcC]\([ipPsjfdcC]*\)$/;F.sigCheck=function(Se,Xn,Ot,ut){Object.prototype.hasOwnProperty.call(Se,Ot)&&r(Se.structName,"already has a property named",Ot+"."),Kn.test(ut)||Jn.test(ut)||r("Malformed signature for",y(Se.structName,Xn)+":",ut)}}const _e=V.memberKey(K);F.sigCheck(V.prototype,K,_e,X.signature),X.key=_e,X.name=K;const ge=P(X.signature),pe=y(V.prototype.structName,_e),he=V.prototype.debugFlags.__flags,Qe=Object.create(null);Qe.configurable=!1,Qe.enumerable=!1,Qe.get=function(){he.getter&&O("debug.getter:",F._.getters[ge],"for",S(ge),pe,"@",this.pointer,"+",X.offset,"sz",X.sizeof);let ve=new DataView(o().buffer,this.pointer+X.offset,X.sizeof)[F._.getters[ge]](0,w);return he.getter&&O("debug.getter:",pe,"result =",ve),ve},X.readOnly?Qe.set=B(V.prototype.structName,_e):Qe.set=function(ve){if(he.setter&&O("debug.setter:",F._.setters[ge],"for",S(ge),pe,"@",this.pointer,"+",X.offset,"sz",X.sizeof,ve),this.pointer||r("Cannot set struct property on disposed instance."),ve===null)ve=0;else for(;!ae(ve);){if(N(X.signature)&&ve instanceof te){ve=ve.pointer||0,he.setter&&O("debug.setter:",pe,"resolved to",ve);break}r("Invalid value for pointer-type",pe+".")}new DataView(o().buffer,this.pointer+X.offset,X.sizeof)[F._.setters[ge]](0,F._.sw[ge](ve),w)},Object.defineProperty(V.prototype,_e,Qe)},we=function F(V,K){arguments.length===1?(K=V,V=K.name):K.name||(K.name=V),V||r("Struct name is required.");let X=!1;Object.keys(K.members).forEach(pe=>{const he=K.members[pe];he.sizeof?he.sizeof===1?he.signature==="c"||he.signature==="C"||r("Unexpected sizeof==1 member",y(K.name,pe),"with signature",he.signature):(he.sizeof%4!==0&&(console.warn("Invalid struct member description =",he,"from",K),r(V,"member",pe,"sizeof is not aligned. sizeof="+he.sizeof)),he.offset%4!==0&&(console.warn("Invalid struct member description =",he,"from",K),r(V,"member",pe,"offset is not aligned. offset="+he.offset))):r(V,"member",pe,"is missing sizeof."),(!X||X.offsetpe instanceof ge),memberKey:ee,memberKeys:j,methodInfoForKey:_(function(pe){}),structInfo:_(K),structName:_(V)}),ge.prototype=new te(V,K,_),Object.defineProperties(ge.prototype,{debugFlags:_e,constructor:_(ge)}),Object.keys(K.members).forEach(pe=>Y(ge,pe,K.members[pe])),ge};return we.StructType=te,we.config=n,we.allocCString=J,we.debugFlags||(we.debugFlags=s.__makeDebugFlags(s.debugFlags)),we},globalThis.sqlite3ApiBootstrap.initializers.push(function(t){const n=(...q)=>{throw new Error(q.join(" "))};t.SQLite3Error.toss;const r=t.capi,s=t.wasm,o=t.util;if(globalThis.WhWasmUtilInstaller(s),delete globalThis.WhWasmUtilInstaller,s.bindingSignatures=[["sqlite3_aggregate_context","void*","sqlite3_context*","int"],["sqlite3_bind_double","int","sqlite3_stmt*","int","f64"],["sqlite3_bind_int","int","sqlite3_stmt*","int","int"],["sqlite3_bind_null",void 0,"sqlite3_stmt*","int"],["sqlite3_bind_parameter_count","int","sqlite3_stmt*"],["sqlite3_bind_parameter_index","int","sqlite3_stmt*","string"],["sqlite3_bind_parameter_name","string","sqlite3_stmt*","int"],["sqlite3_bind_pointer","int","sqlite3_stmt*","int","*","string:static","*"],["sqlite3_busy_handler","int",["sqlite3*",new s.xWrap.FuncPtrAdapter({signature:"i(pi)",contextKey:(q,w)=>q[0]}),"*"]],["sqlite3_busy_timeout","int","sqlite3*","int"],["sqlite3_changes","int","sqlite3*"],["sqlite3_clear_bindings","int","sqlite3_stmt*"],["sqlite3_collation_needed","int","sqlite3*","*","*"],["sqlite3_column_blob","*","sqlite3_stmt*","int"],["sqlite3_column_bytes","int","sqlite3_stmt*","int"],["sqlite3_column_count","int","sqlite3_stmt*"],["sqlite3_column_decltype","string","sqlite3_stmt*","int"],["sqlite3_column_double","f64","sqlite3_stmt*","int"],["sqlite3_column_int","int","sqlite3_stmt*","int"],["sqlite3_column_name","string","sqlite3_stmt*","int"],["sqlite3_column_text","string","sqlite3_stmt*","int"],["sqlite3_column_type","int","sqlite3_stmt*","int"],["sqlite3_column_value","sqlite3_value*","sqlite3_stmt*","int"],["sqlite3_commit_hook","void*",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"sqlite3_commit_hook",signature:"i(p)",contextKey:q=>q[0]}),"*"]],["sqlite3_compileoption_get","string","int"],["sqlite3_compileoption_used","int","string"],["sqlite3_complete","int","string:flexible"],["sqlite3_context_db_handle","sqlite3*","sqlite3_context*"],["sqlite3_data_count","int","sqlite3_stmt*"],["sqlite3_db_filename","string","sqlite3*","string"],["sqlite3_db_handle","sqlite3*","sqlite3_stmt*"],["sqlite3_db_name","string","sqlite3*","int"],["sqlite3_db_readonly","int","sqlite3*","string"],["sqlite3_db_status","int","sqlite3*","int","*","*","int"],["sqlite3_errcode","int","sqlite3*"],["sqlite3_errmsg","string","sqlite3*"],["sqlite3_error_offset","int","sqlite3*"],["sqlite3_errstr","string","int"],["sqlite3_exec","int",["sqlite3*","string:flexible",new s.xWrap.FuncPtrAdapter({signature:"i(pipp)",bindScope:"transient",callProxy:q=>{let w;return(x,N,P,S)=>{try{const L=s.cArgvToJs(N,P);return w||(w=s.cArgvToJs(N,S)),q(L,w)|0}catch(L){return L.resultCode||r.SQLITE_ERROR}}}}),"*","**"]],["sqlite3_expanded_sql","string","sqlite3_stmt*"],["sqlite3_extended_errcode","int","sqlite3*"],["sqlite3_extended_result_codes","int","sqlite3*","int"],["sqlite3_file_control","int","sqlite3*","string","int","*"],["sqlite3_finalize","int","sqlite3_stmt*"],["sqlite3_free",void 0,"*"],["sqlite3_get_autocommit","int","sqlite3*"],["sqlite3_get_auxdata","*","sqlite3_context*","int"],["sqlite3_initialize",void 0],["sqlite3_interrupt",void 0,"sqlite3*"],["sqlite3_is_interrupted","int","sqlite3*"],["sqlite3_keyword_count","int"],["sqlite3_keyword_name","int",["int","**","*"]],["sqlite3_keyword_check","int",["string","int"]],["sqlite3_libversion","string"],["sqlite3_libversion_number","int"],["sqlite3_limit","int",["sqlite3*","int","int"]],["sqlite3_malloc","*","int"],["sqlite3_open","int","string","*"],["sqlite3_open_v2","int","string","*","int","string"],["sqlite3_realloc","*","*","int"],["sqlite3_reset","int","sqlite3_stmt*"],["sqlite3_result_blob",void 0,"sqlite3_context*","*","int","*"],["sqlite3_result_double",void 0,"sqlite3_context*","f64"],["sqlite3_result_error",void 0,"sqlite3_context*","string","int"],["sqlite3_result_error_code",void 0,"sqlite3_context*","int"],["sqlite3_result_error_nomem",void 0,"sqlite3_context*"],["sqlite3_result_error_toobig",void 0,"sqlite3_context*"],["sqlite3_result_int",void 0,"sqlite3_context*","int"],["sqlite3_result_null",void 0,"sqlite3_context*"],["sqlite3_result_pointer",void 0,"sqlite3_context*","*","string:static","*"],["sqlite3_result_subtype",void 0,"sqlite3_value*","int"],["sqlite3_result_text",void 0,"sqlite3_context*","string","int","*"],["sqlite3_result_zeroblob",void 0,"sqlite3_context*","int"],["sqlite3_rollback_hook","void*",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"sqlite3_rollback_hook",signature:"v(p)",contextKey:q=>q[0]}),"*"]],["sqlite3_set_auxdata",void 0,["sqlite3_context*","int","*","*"]],["sqlite3_shutdown",void 0],["sqlite3_sourceid","string"],["sqlite3_sql","string","sqlite3_stmt*"],["sqlite3_status","int","int","*","*","int"],["sqlite3_step","int","sqlite3_stmt*"],["sqlite3_stmt_busy","int","sqlite3_stmt*"],["sqlite3_stmt_readonly","int","sqlite3_stmt*"],["sqlite3_stmt_status","int","sqlite3_stmt*","int","int"],["sqlite3_strglob","int","string","string"],["sqlite3_stricmp","int","string","string"],["sqlite3_strlike","int","string","string","int"],["sqlite3_strnicmp","int","string","string","int"],["sqlite3_table_column_metadata","int","sqlite3*","string","string","string","**","**","*","*","*"],["sqlite3_total_changes","int","sqlite3*"],["sqlite3_trace_v2","int",["sqlite3*","int",new s.xWrap.FuncPtrAdapter({name:"sqlite3_trace_v2::callback",signature:"i(ippp)",contextKey:(q,w)=>q[0]}),"*"]],["sqlite3_txn_state","int",["sqlite3*","string"]],["sqlite3_uri_boolean","int","sqlite3_filename","string","int"],["sqlite3_uri_key","string","sqlite3_filename","int"],["sqlite3_uri_parameter","string","sqlite3_filename","string"],["sqlite3_user_data","void*","sqlite3_context*"],["sqlite3_value_blob","*","sqlite3_value*"],["sqlite3_value_bytes","int","sqlite3_value*"],["sqlite3_value_double","f64","sqlite3_value*"],["sqlite3_value_dup","sqlite3_value*","sqlite3_value*"],["sqlite3_value_free",void 0,"sqlite3_value*"],["sqlite3_value_frombind","int","sqlite3_value*"],["sqlite3_value_int","int","sqlite3_value*"],["sqlite3_value_nochange","int","sqlite3_value*"],["sqlite3_value_numeric_type","int","sqlite3_value*"],["sqlite3_value_pointer","*","sqlite3_value*","string:static"],["sqlite3_value_subtype","int","sqlite3_value*"],["sqlite3_value_text","string","sqlite3_value*"],["sqlite3_value_type","int","sqlite3_value*"],["sqlite3_vfs_find","*","string"],["sqlite3_vfs_register","int","sqlite3_vfs*","int"],["sqlite3_vfs_unregister","int","sqlite3_vfs*"]],s.exports.sqlite3_progress_handler&&s.bindingSignatures.push(["sqlite3_progress_handler",void 0,["sqlite3*","int",new s.xWrap.FuncPtrAdapter({name:"xProgressHandler",signature:"i(p)",bindScope:"context",contextKey:(q,w)=>q[0]}),"*"]]),s.exports.sqlite3_stmt_explain&&s.bindingSignatures.push(["sqlite3_stmt_explain","int","sqlite3_stmt*","int"],["sqlite3_stmt_isexplain","int","sqlite3_stmt*"]),s.exports.sqlite3_set_authorizer&&s.bindingSignatures.push(["sqlite3_set_authorizer","int",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"sqlite3_set_authorizer::xAuth",signature:"i(pissss)",contextKey:(q,w)=>q[0],callProxy:q=>(w,x,N,P,S,L)=>{try{return N=N&&s.cstrToJs(N),P=P&&s.cstrToJs(P),S=S&&s.cstrToJs(S),L=L&&s.cstrToJs(L),q(w,x,N,P,S,L)||0}catch($){return $.resultCode||r.SQLITE_ERROR}}}),"*"]]),s.bindingSignatures.int64=[["sqlite3_bind_int64","int",["sqlite3_stmt*","int","i64"]],["sqlite3_changes64","i64",["sqlite3*"]],["sqlite3_column_int64","i64",["sqlite3_stmt*","int"]],["sqlite3_deserialize","int","sqlite3*","string","*","i64","i64","int"],["sqlite3_last_insert_rowid","i64",["sqlite3*"]],["sqlite3_malloc64","*","i64"],["sqlite3_msize","i64","*"],["sqlite3_overload_function","int",["sqlite3*","string","int"]],["sqlite3_realloc64","*","*","i64"],["sqlite3_result_int64",void 0,"*","i64"],["sqlite3_result_zeroblob64","int","*","i64"],["sqlite3_serialize","*","sqlite3*","string","*","int"],["sqlite3_set_last_insert_rowid",void 0,["sqlite3*","i64"]],["sqlite3_status64","int","int","*","*","int"],["sqlite3_total_changes64","i64",["sqlite3*"]],["sqlite3_update_hook","*",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"sqlite3_update_hook",signature:"v(iippj)",contextKey:q=>q[0],callProxy:q=>(w,x,N,P,S)=>{q(w,x,s.cstrToJs(N),s.cstrToJs(P),S)}}),"*"]],["sqlite3_uri_int64","i64",["sqlite3_filename","string","i64"]],["sqlite3_value_int64","i64","sqlite3_value*"]],s.bigIntEnabled&&s.exports.sqlite3_declare_vtab&&s.bindingSignatures.int64.push(["sqlite3_create_module","int",["sqlite3*","string","sqlite3_module*","*"]],["sqlite3_create_module_v2","int",["sqlite3*","string","sqlite3_module*","*","*"]],["sqlite3_declare_vtab","int",["sqlite3*","string:flexible"]],["sqlite3_drop_modules","int",["sqlite3*","**"]],["sqlite3_vtab_collation","string","sqlite3_index_info*","int"],["sqlite3_vtab_distinct","int","sqlite3_index_info*"],["sqlite3_vtab_in","int","sqlite3_index_info*","int","int"],["sqlite3_vtab_in_first","int","sqlite3_value*","**"],["sqlite3_vtab_in_next","int","sqlite3_value*","**"],["sqlite3_vtab_nochange","int","sqlite3_context*"],["sqlite3_vtab_on_conflict","int","sqlite3*"],["sqlite3_vtab_rhs_value","int","sqlite3_index_info*","int","**"]),s.bigIntEnabled&&s.exports.sqlite3_preupdate_hook&&s.bindingSignatures.int64.push(["sqlite3_preupdate_blobwrite","int","sqlite3*"],["sqlite3_preupdate_count","int","sqlite3*"],["sqlite3_preupdate_depth","int","sqlite3*"],["sqlite3_preupdate_hook","*",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"sqlite3_preupdate_hook",signature:"v(ppippjj)",contextKey:q=>q[0],callProxy:q=>(w,x,N,P,S,L,$)=>{q(w,x,N,s.cstrToJs(P),s.cstrToJs(S),L,$)}}),"*"]],["sqlite3_preupdate_new","int",["sqlite3*","int","**"]],["sqlite3_preupdate_old","int",["sqlite3*","int","**"]]),s.bigIntEnabled&&s.exports.sqlite3changegroup_add&&s.exports.sqlite3session_create&&s.exports.sqlite3_preupdate_hook){const q={signature:"i(ps)",callProxy:w=>(x,N)=>{try{return w(x,s.cstrToJs(N))|0}catch(P){return P.resultCode||r.SQLITE_ERROR}}};s.bindingSignatures.int64.push(["sqlite3changegroup_add","int",["sqlite3_changegroup*","int","void*"]],["sqlite3changegroup_add_strm","int",["sqlite3_changegroup*",new s.xWrap.FuncPtrAdapter({name:"xInput",signature:"i(ppp)",bindScope:"transient"}),"void*"]],["sqlite3changegroup_delete",void 0,["sqlite3_changegroup*"]],["sqlite3changegroup_new","int",["**"]],["sqlite3changegroup_output","int",["sqlite3_changegroup*","int*","**"]],["sqlite3changegroup_output_strm","int",["sqlite3_changegroup*",new s.xWrap.FuncPtrAdapter({name:"xOutput",signature:"i(ppi)",bindScope:"transient"}),"void*"]],["sqlite3changeset_apply","int",["sqlite3*","int","void*",new s.xWrap.FuncPtrAdapter({name:"xFilter",bindScope:"transient",...q}),new s.xWrap.FuncPtrAdapter({name:"xConflict",signature:"i(pip)",bindScope:"transient"}),"void*"]],["sqlite3changeset_apply_strm","int",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"xInput",signature:"i(ppp)",bindScope:"transient"}),"void*",new s.xWrap.FuncPtrAdapter({name:"xFilter",bindScope:"transient",...q}),new s.xWrap.FuncPtrAdapter({name:"xConflict",signature:"i(pip)",bindScope:"transient"}),"void*"]],["sqlite3changeset_apply_v2","int",["sqlite3*","int","void*",new s.xWrap.FuncPtrAdapter({name:"xFilter",bindScope:"transient",...q}),new s.xWrap.FuncPtrAdapter({name:"xConflict",signature:"i(pip)",bindScope:"transient"}),"void*","**","int*","int"]],["sqlite3changeset_apply_v2_strm","int",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"xInput",signature:"i(ppp)",bindScope:"transient"}),"void*",new s.xWrap.FuncPtrAdapter({name:"xFilter",bindScope:"transient",...q}),new s.xWrap.FuncPtrAdapter({name:"xConflict",signature:"i(pip)",bindScope:"transient"}),"void*","**","int*","int"]],["sqlite3changeset_concat","int",["int","void*","int","void*","int*","**"]],["sqlite3changeset_concat_strm","int",[new s.xWrap.FuncPtrAdapter({name:"xInputA",signature:"i(ppp)",bindScope:"transient"}),"void*",new s.xWrap.FuncPtrAdapter({name:"xInputB",signature:"i(ppp)",bindScope:"transient"}),"void*",new s.xWrap.FuncPtrAdapter({name:"xOutput",signature:"i(ppi)",bindScope:"transient"}),"void*"]],["sqlite3changeset_conflict","int",["sqlite3_changeset_iter*","int","**"]],["sqlite3changeset_finalize","int",["sqlite3_changeset_iter*"]],["sqlite3changeset_fk_conflicts","int",["sqlite3_changeset_iter*","int*"]],["sqlite3changeset_invert","int",["int","void*","int*","**"]],["sqlite3changeset_invert_strm","int",[new s.xWrap.FuncPtrAdapter({name:"xInput",signature:"i(ppp)",bindScope:"transient"}),"void*",new s.xWrap.FuncPtrAdapter({name:"xOutput",signature:"i(ppi)",bindScope:"transient"}),"void*"]],["sqlite3changeset_new","int",["sqlite3_changeset_iter*","int","**"]],["sqlite3changeset_next","int",["sqlite3_changeset_iter*"]],["sqlite3changeset_old","int",["sqlite3_changeset_iter*","int","**"]],["sqlite3changeset_op","int",["sqlite3_changeset_iter*","**","int*","int*","int*"]],["sqlite3changeset_pk","int",["sqlite3_changeset_iter*","**","int*"]],["sqlite3changeset_start","int",["**","int","*"]],["sqlite3changeset_start_strm","int",["**",new s.xWrap.FuncPtrAdapter({name:"xInput",signature:"i(ppp)",bindScope:"transient"}),"void*"]],["sqlite3changeset_start_v2","int",["**","int","*","int"]],["sqlite3changeset_start_v2_strm","int",["**",new s.xWrap.FuncPtrAdapter({name:"xInput",signature:"i(ppp)",bindScope:"transient"}),"void*","int"]],["sqlite3session_attach","int",["sqlite3_session*","string"]],["sqlite3session_changeset","int",["sqlite3_session*","int*","**"]],["sqlite3session_changeset_size","i64",["sqlite3_session*"]],["sqlite3session_changeset_strm","int",["sqlite3_session*",new s.xWrap.FuncPtrAdapter({name:"xOutput",signature:"i(ppp)",bindScope:"transient"}),"void*"]],["sqlite3session_config","int",["int","void*"]],["sqlite3session_create","int",["sqlite3*","string","**"]],["sqlite3session_diff","int",["sqlite3_session*","string","string","**"]],["sqlite3session_enable","int",["sqlite3_session*","int"]],["sqlite3session_indirect","int",["sqlite3_session*","int"]],["sqlite3session_isempty","int",["sqlite3_session*"]],["sqlite3session_memory_used","i64",["sqlite3_session*"]],["sqlite3session_object_config","int",["sqlite3_session*","int","void*"]],["sqlite3session_patchset","int",["sqlite3_session*","*","**"]],["sqlite3session_patchset_strm","int",["sqlite3_session*",new s.xWrap.FuncPtrAdapter({name:"xOutput",signature:"i(ppp)",bindScope:"transient"}),"void*"]],["sqlite3session_table_filter",void 0,["sqlite3_session*",new s.xWrap.FuncPtrAdapter({name:"xFilter",...q,contextKey:(w,x)=>w[0]}),"*"]])}s.bindingSignatures.wasmInternal=[["sqlite3__wasm_db_reset","int","sqlite3*"],["sqlite3__wasm_db_vfs","sqlite3_vfs*","sqlite3*","string"],["sqlite3__wasm_vfs_create_file","int","sqlite3_vfs*","string","*","int"],["sqlite3__wasm_posix_create_file","int","string","*","int"],["sqlite3__wasm_vfs_unlink","int","sqlite3_vfs*","string"],["sqlite3__wasm_qfmt_token","string:dealloc","string","int"]],t.StructBinder=globalThis.Jaccwabyt({heap:s.heap8u,alloc:s.alloc,dealloc:s.dealloc,bigIntEnabled:s.bigIntEnabled,memberPrefix:"$"}),delete globalThis.Jaccwabyt;{const q=s.xWrap.argAdapter("string");s.xWrap.argAdapter("string:flexible",S=>q(o.flexibleString(S))),s.xWrap.argAdapter("string:static",(function(S){return s.isPtr(S)?S:(S=""+S,this[S]||(this[S]=s.allocCString(S)))}).bind(Object.create(null)));const w=s.xWrap.argAdapter("*"),x=function(){};s.xWrap.argAdapter("sqlite3_filename",w)("sqlite3_context*",w)("sqlite3_value*",w)("void*",w)("sqlite3_changegroup*",w)("sqlite3_changeset_iter*",w)("sqlite3_session*",w)("sqlite3_stmt*",S=>w(S instanceof(t?.oo1?.Stmt||x)?S.pointer:S))("sqlite3*",S=>w(S instanceof(t?.oo1?.DB||x)?S.pointer:S))("sqlite3_vfs*",S=>typeof S=="string"?r.sqlite3_vfs_find(S)||t.SQLite3Error.toss(r.SQLITE_NOTFOUND,"Unknown sqlite3_vfs name:",S):w(S instanceof(r.sqlite3_vfs||x)?S.pointer:S)),s.exports.sqlite3_declare_vtab&&s.xWrap.argAdapter("sqlite3_index_info*",S=>w(S instanceof(r.sqlite3_index_info||x)?S.pointer:S))("sqlite3_module*",S=>w(S instanceof(r.sqlite3_module||x)?S.pointer:S));const N=s.xWrap.resultAdapter("*");s.xWrap.resultAdapter("sqlite3*",N)("sqlite3_context*",N)("sqlite3_stmt*",N)("sqlite3_value*",N)("sqlite3_vfs*",N)("void*",N),s.exports.sqlite3_step.length===0&&(s.xWrap.doArgcCheck=!1,t.config.warn("Disabling sqlite3.wasm.xWrap.doArgcCheck due to environmental quirks."));for(const S of s.bindingSignatures)r[S[0]]=s.xWrap.apply(null,S);for(const S of s.bindingSignatures.wasmInternal)o[S[0]]=s.xWrap.apply(null,S);const P=function(S){return()=>n(S+"() is unavailable due to lack","of BigInt support in this build.")};for(const S of s.bindingSignatures.int64)r[S[0]]=s.bigIntEnabled?s.xWrap.apply(null,S):P(S[0]);if(delete s.bindingSignatures,s.exports.sqlite3__wasm_db_error){const S=s.xWrap("sqlite3__wasm_db_error","int","sqlite3*","int","string");o.sqlite3__wasm_db_error=function(L,$,c){return $ instanceof t.WasmAllocError?($=r.SQLITE_NOMEM,c=0):$ instanceof Error&&(c=c||""+$,$=$.resultCode||r.SQLITE_ERROR),L?S(L,$,c):$}}else o.sqlite3__wasm_db_error=function(S,L,$){return console.warn("sqlite3__wasm_db_error() is not exported.",arguments),L}}{const q=s.xCall("sqlite3__wasm_enum_json");q||n("Maintenance required: increase sqlite3__wasm_enum_json()'s","static buffer size!"),s.ctype=JSON.parse(s.cstrToJs(q));const w=["access","authorizer","blobFinalizers","changeset","config","dataTypes","dbConfig","dbStatus","encodings","fcntl","flock","ioCap","limits","openFlags","prepareFlags","resultCodes","sqlite3Status","stmtStatus","syncFlags","trace","txnState","udfFlags","version"];s.bigIntEnabled&&w.push("serialize","session","vtab");for(const P of w)for(const S of Object.entries(s.ctype[P]))r[S[0]]=S[1];s.functionEntry(r.SQLITE_WASM_DEALLOC)||n("Internal error: cannot resolve exported function","entry SQLITE_WASM_DEALLOC (=="+r.SQLITE_WASM_DEALLOC+").");const x=Object.create(null);for(const P of["resultCodes"])for(const S of Object.entries(s.ctype[P]))x[S[1]]=S[0];r.sqlite3_js_rc_str=P=>x[P];const N=Object.assign(Object.create(null),{WasmTestStruct:!0,sqlite3_kvvfs_methods:!o.isUIThread(),sqlite3_index_info:!s.bigIntEnabled,sqlite3_index_constraint:!s.bigIntEnabled,sqlite3_index_orderby:!s.bigIntEnabled,sqlite3_index_constraint_usage:!s.bigIntEnabled});for(const P of s.ctype.structs)N[P.name]||(r[P.name]=t.StructBinder(P));if(r.sqlite3_index_info){for(const P of["sqlite3_index_constraint","sqlite3_index_orderby","sqlite3_index_constraint_usage"])r.sqlite3_index_info[P]=r[P],delete r[P];r.sqlite3_vtab_config=s.xWrap("sqlite3__wasm_vtab_config","int",["sqlite3*","int","int"])}}const p=(q,w,x)=>o.sqlite3__wasm_db_error(q,r.SQLITE_MISUSE,w+"() requires "+x+" argument"+(x===1?"":"s")+"."),g=q=>o.sqlite3__wasm_db_error(q,r.SQLITE_FORMAT,"SQLITE_UTF8 is the only supported encoding."),O=q=>s.xWrap.argAdapter("sqlite3*")(q),R=q=>s.isPtr(q)?s.cstrToJs(q):q,z=(function(q,w){q=O(q);let x=this.dbMap.get(q);if(w)!x&&w>0&&this.dbMap.set(q,x=Object.create(null));else return this.dbMap.delete(q),x;return x}).bind(Object.assign(Object.create(null),{dbMap:new Map}));z.addCollation=function(q,w){const x=z(q,1);x.collation||(x.collation=new Set),x.collation.add(R(w).toLowerCase())},z._addUDF=function(q,w,x,N){w=R(w).toLowerCase();let P=N.get(w);P||N.set(w,P=new Set),P.add(x<0?-1:x)},z.addFunction=function(q,w,x){const N=z(q,1);N.udf||(N.udf=new Map),this._addUDF(q,w,x,N.udf)},s.exports.sqlite3_create_window_function&&(z.addWindowFunc=function(q,w,x){const N=z(q,1);N.wudf||(N.wudf=new Map),this._addUDF(q,w,x,N.wudf)}),z.cleanup=function(q){q=O(q);const w=[q];for(const P of["sqlite3_busy_handler","sqlite3_commit_hook","sqlite3_preupdate_hook","sqlite3_progress_handler","sqlite3_rollback_hook","sqlite3_set_authorizer","sqlite3_trace_v2","sqlite3_update_hook"]){const S=s.exports[P];if(S){w.length=S.length;try{r[P](...w)}catch(L){t.config.warn("close-time call of",P+"(",w,") threw:",L)}}}const x=z(q,0);if(!x)return;if(x.collation){for(const P of x.collation)try{r.sqlite3_create_collation_v2(q,P,r.SQLITE_UTF8,0,0,0)}catch{}delete x.collation}let N;for(N=0;N<2;++N){const P=N?x.wudf:x.udf;if(!P)continue;const S=N?r.sqlite3_create_window_function:r.sqlite3_create_function_v2;for(const L of P){const $=L[0],c=L[1],d=[q,$,0,r.SQLITE_UTF8,0,0,0,0,0];N&&d.push(0);for(const y of c)try{d[2]=y,S.apply(null,d)}catch{}c.clear()}P.clear()}delete x.udf,delete x.wudf};{const q=s.xWrap("sqlite3_close_v2","int","sqlite3*");r.sqlite3_close_v2=function(w){if(arguments.length!==1)return p(w,"sqlite3_close_v2",1);if(w)try{z.cleanup(w)}catch{}return q(w)}}if(r.sqlite3session_create){const q=s.xWrap("sqlite3session_delete",void 0,["sqlite3_session*"]);r.sqlite3session_delete=function(w){if(arguments.length!==1)return p(pDb,"sqlite3session_delete",1);w&&r.sqlite3session_table_filter(w,0,0),q(w)}}{const q=(x,N)=>"argv["+N+"]:"+x[0]+":"+s.cstrToJs(x[1]).toLowerCase(),w=s.xWrap("sqlite3_create_collation_v2","int",["sqlite3*","string","int","*",new s.xWrap.FuncPtrAdapter({name:"xCompare",signature:"i(pipip)",contextKey:q}),new s.xWrap.FuncPtrAdapter({name:"xDestroy",signature:"v(p)",contextKey:q})]);r.sqlite3_create_collation_v2=function(x,N,P,S,L,$){if(arguments.length!==6)return p(x,"sqlite3_create_collation_v2",6);if((P&15)===0)P|=r.SQLITE_UTF8;else if(r.SQLITE_UTF8!==(P&15))return g(x);try{const c=w(x,N,P,S,L,$);return c===0&&L instanceof Function&&z.addCollation(x,N),c}catch(c){return o.sqlite3__wasm_db_error(x,c)}},r.sqlite3_create_collation=(x,N,P,S,L)=>arguments.length===5?r.sqlite3_create_collation_v2(x,N,P,S,L,0):p(x,"sqlite3_create_collation",5)}{const q=function(P,S){return P[0]+":"+(P[2]<0?-1:P[2])+":"+S+":"+s.cstrToJs(P[1]).toLowerCase()},w=Object.assign(Object.create(null),{xInverseAndStep:{signature:"v(pip)",contextKey:q,callProxy:P=>(S,L,$)=>{try{P(S,...r.sqlite3_values_to_js(L,$))}catch(c){r.sqlite3_result_error_js(S,c)}}},xFinalAndValue:{signature:"v(p)",contextKey:q,callProxy:P=>S=>{try{r.sqlite3_result_js(S,P(S))}catch(L){r.sqlite3_result_error_js(S,L)}}},xFunc:{signature:"v(pip)",contextKey:q,callProxy:P=>(S,L,$)=>{try{r.sqlite3_result_js(S,P(S,...r.sqlite3_values_to_js(L,$)))}catch(c){r.sqlite3_result_error_js(S,c)}}},xDestroy:{signature:"v(p)",contextKey:q,callProxy:P=>S=>{try{P(S)}catch(L){console.error("UDF xDestroy method threw:",L)}}}}),x=s.xWrap("sqlite3_create_function_v2","int",["sqlite3*","string","int","int","*",new s.xWrap.FuncPtrAdapter({name:"xFunc",...w.xFunc}),new s.xWrap.FuncPtrAdapter({name:"xStep",...w.xInverseAndStep}),new s.xWrap.FuncPtrAdapter({name:"xFinal",...w.xFinalAndValue}),new s.xWrap.FuncPtrAdapter({name:"xDestroy",...w.xDestroy})]),N=s.exports.sqlite3_create_window_function?s.xWrap("sqlite3_create_window_function","int",["sqlite3*","string","int","int","*",new s.xWrap.FuncPtrAdapter({name:"xStep",...w.xInverseAndStep}),new s.xWrap.FuncPtrAdapter({name:"xFinal",...w.xFinalAndValue}),new s.xWrap.FuncPtrAdapter({name:"xValue",...w.xFinalAndValue}),new s.xWrap.FuncPtrAdapter({name:"xInverse",...w.xInverseAndStep}),new s.xWrap.FuncPtrAdapter({name:"xDestroy",...w.xDestroy})]):void 0;r.sqlite3_create_function_v2=function P(S,L,$,c,d,y,B,f,m){if(P.length!==arguments.length)return p(S,"sqlite3_create_function_v2",P.length);if((c&15)===0)c|=r.SQLITE_UTF8;else if(r.SQLITE_UTF8!==(c&15))return g(S);try{const l=x(S,L,$,c,d,y,B,f,m);return l===0&&(y instanceof Function||B instanceof Function||f instanceof Function||m instanceof Function)&&z.addFunction(S,L,$),l}catch(l){return console.error("sqlite3_create_function_v2() setup threw:",l),o.sqlite3__wasm_db_error(S,l,"Creation of UDF threw: "+l)}},r.sqlite3_create_function=function P(S,L,$,c,d,y,B,f){return P.length===arguments.length?r.sqlite3_create_function_v2(S,L,$,c,d,y,B,f,0):p(S,"sqlite3_create_function",P.length)},N?r.sqlite3_create_window_function=function P(S,L,$,c,d,y,B,f,m,l){if(P.length!==arguments.length)return p(S,"sqlite3_create_window_function",P.length);if((c&15)===0)c|=r.SQLITE_UTF8;else if(r.SQLITE_UTF8!==(c&15))return g(S);try{const _=N(S,L,$,c,d,y,B,f,m,l);return _===0&&(y instanceof Function||B instanceof Function||f instanceof Function||m instanceof Function||l instanceof Function)&&z.addWindowFunc(S,L,$),_}catch(_){return console.error("sqlite3_create_window_function() setup threw:",_),o.sqlite3__wasm_db_error(S,_,"Creation of UDF threw: "+_)}}:delete r.sqlite3_create_window_function,r.sqlite3_create_function_v2.udfSetResult=r.sqlite3_create_function.udfSetResult=r.sqlite3_result_js,r.sqlite3_create_window_function&&(r.sqlite3_create_window_function.udfSetResult=r.sqlite3_result_js),r.sqlite3_create_function_v2.udfConvertArgs=r.sqlite3_create_function.udfConvertArgs=r.sqlite3_values_to_js,r.sqlite3_create_window_function&&(r.sqlite3_create_window_function.udfConvertArgs=r.sqlite3_values_to_js),r.sqlite3_create_function_v2.udfSetError=r.sqlite3_create_function.udfSetError=r.sqlite3_result_error_js,r.sqlite3_create_window_function&&(r.sqlite3_create_window_function.udfSetError=r.sqlite3_result_error_js)}{const q=(x,N)=>(typeof x=="string"?N=-1:o.isSQLableTypedArray(x)?(N=x.byteLength,x=o.typedArrayToString(x instanceof ArrayBuffer?new Uint8Array(x):x)):Array.isArray(x)&&(x=x.join(""),N=-1),[x,N]),w={basic:s.xWrap("sqlite3_prepare_v3","int",["sqlite3*","string","int","int","**","**"]),full:s.xWrap("sqlite3_prepare_v3","int",["sqlite3*","*","int","int","**","**"])};r.sqlite3_prepare_v3=function x(N,P,S,L,$,c){if(x.length!==arguments.length)return p(N,"sqlite3_prepare_v3",x.length);const[d,y]=q(P,S);switch(typeof d){case"string":return w.basic(N,d,y,L,$,null);case"number":return w.full(N,d,y,L,$,c);default:return o.sqlite3__wasm_db_error(N,r.SQLITE_MISUSE,"Invalid SQL argument type for sqlite3_prepare_v2/v3().")}},r.sqlite3_prepare_v2=function x(N,P,S,L,$){return x.length===arguments.length?r.sqlite3_prepare_v3(N,P,S,0,L,$):p(N,"sqlite3_prepare_v2",x.length)}}{const q=s.xWrap("sqlite3_bind_text","int",["sqlite3_stmt*","int","string","int","*"]),w=s.xWrap("sqlite3_bind_blob","int",["sqlite3_stmt*","int","*","int","*"]);r.sqlite3_bind_text=function x(N,P,S,L,$){if(x.length!==arguments.length)return p(r.sqlite3_db_handle(N),"sqlite3_bind_text",x.length);if(s.isPtr(S)||S===null)return q(N,P,S,L,$);S instanceof ArrayBuffer?S=new Uint8Array(S):Array.isArray(pMem)&&(S=pMem.join(""));let c,d;try{if(o.isSQLableTypedArray(S))c=s.allocFromTypedArray(S),d=S.byteLength;else if(typeof S=="string")[c,d]=s.allocCString(S);else return o.sqlite3__wasm_db_error(r.sqlite3_db_handle(N),r.SQLITE_MISUSE,"Invalid 3rd argument type for sqlite3_bind_text().");return q(N,P,c,d,r.SQLITE_WASM_DEALLOC)}catch(y){return s.dealloc(c),o.sqlite3__wasm_db_error(r.sqlite3_db_handle(N),y)}},r.sqlite3_bind_blob=function x(N,P,S,L,$){if(x.length!==arguments.length)return p(r.sqlite3_db_handle(N),"sqlite3_bind_blob",x.length);if(s.isPtr(S)||S===null)return w(N,P,S,L,$);S instanceof ArrayBuffer?S=new Uint8Array(S):Array.isArray(S)&&(S=S.join(""));let c,d;try{if(o.isBindableTypedArray(S))c=s.allocFromTypedArray(S),d=L>=0?L:S.byteLength;else if(typeof S=="string")[c,d]=s.allocCString(S);else return o.sqlite3__wasm_db_error(r.sqlite3_db_handle(N),r.SQLITE_MISUSE,"Invalid 3rd argument type for sqlite3_bind_blob().");return w(N,P,c,d,r.SQLITE_WASM_DEALLOC)}catch(y){return s.dealloc(c),o.sqlite3__wasm_db_error(r.sqlite3_db_handle(N),y)}}}r.sqlite3_config=function(q,...w){if(arguments.length<2)return r.SQLITE_MISUSE;switch(q){case r.SQLITE_CONFIG_COVERING_INDEX_SCAN:case r.SQLITE_CONFIG_MEMSTATUS:case r.SQLITE_CONFIG_SMALL_MALLOC:case r.SQLITE_CONFIG_SORTERREF_SIZE:case r.SQLITE_CONFIG_STMTJRNL_SPILL:case r.SQLITE_CONFIG_URI:return s.exports.sqlite3__wasm_config_i(q,w[0]);case r.SQLITE_CONFIG_LOOKASIDE:return s.exports.sqlite3__wasm_config_ii(q,w[0],w[1]);case r.SQLITE_CONFIG_MEMDB_MAXSIZE:return s.exports.sqlite3__wasm_config_j(q,w[0]);case r.SQLITE_CONFIG_GETMALLOC:case r.SQLITE_CONFIG_GETMUTEX:case r.SQLITE_CONFIG_GETPCACHE2:case r.SQLITE_CONFIG_GETPCACHE:case r.SQLITE_CONFIG_HEAP:case r.SQLITE_CONFIG_LOG:case r.SQLITE_CONFIG_MALLOC:case r.SQLITE_CONFIG_MMAP_SIZE:case r.SQLITE_CONFIG_MULTITHREAD:case r.SQLITE_CONFIG_MUTEX:case r.SQLITE_CONFIG_PAGECACHE:case r.SQLITE_CONFIG_PCACHE2:case r.SQLITE_CONFIG_PCACHE:case r.SQLITE_CONFIG_PCACHE_HDRSZ:case r.SQLITE_CONFIG_PMASZ:case r.SQLITE_CONFIG_SERIALIZED:case r.SQLITE_CONFIG_SINGLETHREAD:case r.SQLITE_CONFIG_SQLLOG:case r.SQLITE_CONFIG_WIN32_HEAPSIZE:default:return r.SQLITE_NOTFOUND}};{const q=new Set;r.sqlite3_auto_extension=function(w){if(w instanceof Function)w=s.installFunction("i(ppp)",w);else if(arguments.length!==1||!s.isPtr(w))return r.SQLITE_MISUSE;const x=s.exports.sqlite3_auto_extension(w);return w!==arguments[0]&&(x===0?q.add(w):s.uninstallFunction(w)),x},r.sqlite3_cancel_auto_extension=function(w){return!w||arguments.length!==1||!s.isPtr(w)?0:s.exports.sqlite3_cancel_auto_extension(w)},r.sqlite3_reset_auto_extension=function(){s.exports.sqlite3_reset_auto_extension();for(const w of q)s.uninstallFunction(w);q.clear()}}const Q=r.sqlite3_vfs_find("kvvfs");if(Q)if(o.isUIThread()){const q=new r.sqlite3_kvvfs_methods(s.exports.sqlite3__wasm_kvvfs_methods());delete r.sqlite3_kvvfs_methods;const w=s.exports.sqlite3__wasm_kvvfsMakeKeyOnPstack,x=s.pstack,N=S=>s.peek(S)===115?sessionStorage:localStorage,P={xRead:(S,L,$,c)=>{const d=x.pointer,y=s.scopedAllocPush();try{const B=w(S,L);if(!B)return-3;const f=s.cstrToJs(B),m=N(S).getItem(f);if(!m)return-1;const l=m.length;if(c<=0)return l;if(c===1)return s.poke($,0),l;const _=s.scopedAllocCString(m);return c>l+1&&(c=l+1),s.heap8u().copyWithin($,_,_+c-1),s.poke($+c-1,0),c-1}catch(B){return console.error("kvstorageRead()",B),-2}finally{x.restore(d),s.scopedAllocPop(y)}},xWrite:(S,L,$)=>{const c=x.pointer;try{const d=w(S,L);if(!d)return 1;const y=s.cstrToJs(d);return N(S).setItem(y,s.cstrToJs($)),0}catch(d){return console.error("kvstorageWrite()",d),r.SQLITE_IOERR}finally{x.restore(c)}},xDelete:(S,L)=>{const $=x.pointer;try{const c=w(S,L);return c?(N(S).removeItem(s.cstrToJs(c)),0):1}catch(c){return console.error("kvstorageDelete()",c),r.SQLITE_IOERR}finally{x.restore($)}}};for(const S of Object.keys(P))q[q.memberKey(S)]=s.installFunction(q.memberSignature(S),P[S])}else r.sqlite3_vfs_unregister(Q);s.xWrap.FuncPtrAdapter.warnOnUse=!0;const T=t.StructBinder,A=function q(w,x,N,P=q.installMethodArgcCheck){if(w instanceof T.StructType?!(N instanceof Function)&&!s.isPtr(N)&&n("Usage error: expecting a Function or WASM pointer to one."):n("Usage error: target object is-not-a StructType."),arguments.length===1)return(c,d)=>q(w,c,d,P);q.argcProxy||(q.argcProxy=function(c,d,y,B){return function(...f){return y.length!==arguments.length&&n("Argument mismatch for",c.structInfo.name+"::"+d+": Native signature is:",B),y.apply(this,f)}},q.removeFuncList=function(){this.ondispose.__removeFuncList&&(this.ondispose.__removeFuncList.forEach((c,d)=>{if(typeof c=="number")try{s.uninstallFunction(c)}catch{}}),delete this.ondispose.__removeFuncList)});const S=w.memberSignature(x);S.length<2&&n("Member",x,"does not have a function pointer signature:",S);const L=w.memberKey(x),$=P&&!s.isPtr(N)?q.argcProxy(w,L,N,S):N;if(s.isPtr($))$&&!s.functionEntry($)&&n("Pointer",$,"is not a WASM function table entry."),w[L]=$;else{const c=s.installFunction($,w.memberSignature(x,!0));w[L]=c,(!w.ondispose||!w.ondispose.__removeFuncList)&&(w.addOnDispose("ondispose.__removeFuncList handler",q.removeFuncList),w.ondispose.__removeFuncList=[]),w.ondispose.__removeFuncList.push(L,c)}return(c,d)=>q(w,c,d,P)};A.installMethodArgcCheck=!1;const D=function(q,w,x=A.installMethodArgcCheck){const N=new Map;for(const P of Object.keys(w)){const S=w[P],L=N.get(S);if(L){const $=q.memberKey(P);q[$]=q[q.memberKey(L)]}else A(q,P,S,x),N.set(S,P)}return q};T.StructType.prototype.installMethod=function(w,x,N=A.installMethodArgcCheck){return arguments.length<3&&w&&typeof w=="object"?D(this,...arguments):A(this,...arguments)},T.StructType.prototype.installMethods=function(q,w=A.installMethodArgcCheck){return D(this,q,w)}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){t.version={libVersion:"3.50.4",libVersionNumber:3050004,sourceId:"2025-07-30 19:33:53 4d8adfb30e03f9cf27f800a2c1ba3c48fb4ca1b08b0f5ed59a4d5ecbf45e20a3",downloadVersion:3500400}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){const n=(...f)=>{throw new t.SQLite3Error(...f)},r=t.capi,s=t.wasm,o=t.util,p=new WeakMap,g=new WeakMap,O=(f,m,l)=>{const _=Object.getOwnPropertyDescriptor(f,m);return _?_.value:l},R=function(f,m){return m&&(f instanceof A&&(f=f.pointer),n(m,"sqlite3 result code",m+":",f?r.sqlite3_errmsg(f):r.sqlite3_errstr(m))),arguments[0]},z=s.installFunction("i(ippp)",(function(f,m,l,_){r.SQLITE_TRACE_STMT===f&&console.log("SQL TRACE #"+ ++this.counter+" via sqlite3@"+m+":",s.cstrToJs(_))}).bind({counter:0})),Q=Object.create(null),T=function f(...m){if(!f._name2vfs){f._name2vfs=Object.create(null);const j=typeof importScripts=="function"?b=>n("The VFS for",b,"is only available in the main window thread."):!1;f._name2vfs[":localStorage:"]={vfs:"kvvfs",filename:j||(()=>"local")},f._name2vfs[":sessionStorage:"]={vfs:"kvvfs",filename:j||(()=>"session")}}const l=f.normalizeArgs(...m);let _=l.filename,u=l.vfs,I=l.flags;(typeof _!="string"&&typeof _!="number"||typeof I!="string"||u&&typeof u!="string"&&typeof u!="number")&&(t.config.error("Invalid DB ctor args",l,arguments),n("Invalid arguments for DB constructor."));let U=typeof _=="number"?s.cstrToJs(_):_;const ee=f._name2vfs[U];ee&&(u=ee.vfs,_=U=ee.filename(U));let ne,se=0;I.indexOf("c")>=0&&(se|=r.SQLITE_OPEN_CREATE|r.SQLITE_OPEN_READWRITE),I.indexOf("w")>=0&&(se|=r.SQLITE_OPEN_READWRITE),se===0&&(se|=r.SQLITE_OPEN_READONLY),se|=r.SQLITE_OPEN_EXRESCODE;const ie=s.pstack.pointer;try{const j=s.pstack.allocPtr();let b=r.sqlite3_open_v2(_,j,se,u||0);ne=s.peekPtr(j),R(ne,b),r.sqlite3_extended_result_codes(ne,1),I.indexOf("t")>=0&&r.sqlite3_trace_v2(ne,r.SQLITE_TRACE_STMT,z,ne)}catch(j){throw ne&&r.sqlite3_close_v2(ne),j}finally{s.pstack.restore(ie)}this.filename=U,p.set(this,ne),g.set(this,Object.create(null));try{const j=r.sqlite3_js_db_vfs(ne)||n("Internal error: cannot get VFS for new db handle."),b=Q[j];b&&(b instanceof Function?b(this,t):R(ne,r.sqlite3_exec(ne,b,0,0,0)))}catch(j){throw this.close(),j}};T.setVfsPostOpenCallback=function(f,m){m instanceof Function||n("dbCtorHelper.setVfsPostOpenCallback() should not be used with a non-function argument.",arguments),Q[f]=m},T.normalizeArgs=function(f=":memory:",m="c",l=null){const _={};return arguments.length===1&&arguments[0]&&typeof arguments[0]=="object"?(Object.assign(_,arguments[0]),_.flags===void 0&&(_.flags="c"),_.vfs===void 0&&(_.vfs=null),_.filename===void 0&&(_.filename=":memory:")):(_.filename=f,_.flags=m,_.vfs=l),_};const A=function(...f){T.apply(this,f)};A.dbCtorHelper=T;const D={null:1,number:2,string:3,boolean:4,blob:5};D.undefined==D.null,s.bigIntEnabled&&(D.bigint=D.number);const q=function(){D!==arguments[2]&&n(r.SQLITE_MISUSE,"Do not call the Stmt constructor directly. Use DB.prepare()."),this.db=arguments[0],p.set(this,arguments[1]),this.parameterCount=r.sqlite3_bind_parameter_count(this.pointer)},w=function(f){return f.pointer||n("DB has been closed."),f},x=function(f,m){return(m!==(m|0)||m<0||m>=f.columnCount)&&n("Column index",m,"is out of range."),f},N=function(f,m){const l=Object.create(null);switch(l.opt=Object.create(null),m.length){case 1:typeof m[0]=="string"||o.isSQLableTypedArray(m[0])||Array.isArray(m[0])?l.sql=m[0]:m[0]&&typeof m[0]=="object"&&(l.opt=m[0],l.sql=l.opt.sql);break;case 2:l.sql=m[0],l.opt=m[1];break;default:n("Invalid argument count for exec().")}l.sql=o.flexibleString(l.sql),typeof l.sql!="string"&&n("Missing SQL argument or unsupported SQL value type.");const _=l.opt;switch(_.returnValue){case"resultRows":_.resultRows||(_.resultRows=[]),l.returnVal=()=>_.resultRows;break;case"saveSql":_.saveSql||(_.saveSql=[]),l.returnVal=()=>_.saveSql;break;case void 0:case"this":l.returnVal=()=>f;break;default:n("Invalid returnValue value:",_.returnValue)}if(!_.callback&&!_.returnValue&&_.rowMode!==void 0&&(_.resultRows||(_.resultRows=[]),l.returnVal=()=>_.resultRows),_.callback||_.resultRows)switch(_.rowMode===void 0?"array":_.rowMode){case"object":l.cbArg=(u,I)=>{I.columnNames||(I.columnNames=u.getColumnNames([]));const U=u.get([]),ee=Object.create(null);for(const ne in I.columnNames)ee[I.columnNames[ne]]=U[ne];return ee};break;case"array":l.cbArg=u=>u.get([]);break;case"stmt":Array.isArray(_.resultRows)&&n("exec(): invalid rowMode for a resultRows array: must","be one of 'array', 'object',","a result column number, or column name reference."),l.cbArg=u=>u;break;default:if(o.isInt32(_.rowMode)){l.cbArg=u=>u.get(_.rowMode);break}else if(typeof _.rowMode=="string"&&_.rowMode.length>1&&_.rowMode[0]==="$"){const u=_.rowMode.substr(1);l.cbArg=I=>{const U=I.get(Object.create(null))[u];return U===void 0?n(r.SQLITE_NOTFOUND,"exec(): unknown result column:",u):U};break}n("Invalid rowMode:",_.rowMode)}return l},P=(f,m,l,..._)=>{const u=f.prepare(m);try{const I=u.bind(l).step()?u.get(..._):void 0;return u.reset(),I}finally{u.finalize()}},S=(f,m,l,_)=>f.exec({sql:m,bind:l,rowMode:_,returnValue:"resultRows"});A.checkRc=(f,m)=>R(f,m),A.prototype={isOpen:function(){return!!this.pointer},affirmOpen:function(){return w(this)},close:function(){if(this.pointer){if(this.onclose&&this.onclose.before instanceof Function)try{this.onclose.before(this)}catch{}const f=this.pointer;if(Object.keys(g.get(this)).forEach((m,l)=>{if(l&&l.pointer)try{l.finalize()}catch{}}),p.delete(this),g.delete(this),r.sqlite3_close_v2(f),this.onclose&&this.onclose.after instanceof Function)try{this.onclose.after(this)}catch{}delete this.filename}},changes:function(f=!1,m=!1){const l=w(this).pointer;return f?m?r.sqlite3_total_changes64(l):r.sqlite3_total_changes(l):m?r.sqlite3_changes64(l):r.sqlite3_changes(l)},dbFilename:function(f="main"){return r.sqlite3_db_filename(w(this).pointer,f)},dbName:function(f=0){return r.sqlite3_db_name(w(this).pointer,f)},dbVfsName:function(f=0){let m;const l=r.sqlite3_js_db_vfs(w(this).pointer,f);if(l){const _=new r.sqlite3_vfs(l);try{m=s.cstrToJs(_.$zName)}finally{_.dispose()}}return m},prepare:function(f){w(this);const m=s.pstack.pointer;let l,_;try{l=s.pstack.alloc(8),A.checkRc(this,r.sqlite3_prepare_v2(this.pointer,f,-1,l,null)),_=s.peekPtr(l)}finally{s.pstack.restore(m)}_||n("Cannot prepare empty SQL.");const u=new q(this,_,D);return g.get(this)[_]=u,u},exec:function(){w(this);const f=N(this,arguments);if(!f.sql)return n("exec() requires an SQL string.");const m=f.opt,l=m.callback,_=Array.isArray(m.resultRows)?m.resultRows:void 0;let u,I=m.bind,U=!!(f.cbArg||m.columnNames||_);const ee=s.scopedAllocPush(),ne=Array.isArray(m.saveSql)?m.saveSql:void 0;try{const se=o.isSQLableTypedArray(f.sql);let ie=se?f.sql.byteLength:s.jstrlen(f.sql);const j=s.scopedAlloc(2*s.ptrSizeof+(ie+1)),b=j+s.ptrSizeof;let k=b+s.ptrSizeof;const W=k+ie;for(se?s.heap8().set(f.sql,k):s.jstrcpy(f.sql,s.heap8(),k,ie,!1),s.poke(k+ie,0);k&&s.peek(k,"i8");){s.pokePtr([j,b],0),A.checkRc(this,r.sqlite3_prepare_v3(this.pointer,k,ie,0,j,b));const H=s.peekPtr(j);if(k=s.peekPtr(b),ie=W-k,!!H){if(ne&&ne.push(r.sqlite3_sql(H).trim()),u=new q(this,H,D),I&&u.parameterCount&&(u.bind(I),I=null),U&&u.columnCount){let Z=Array.isArray(m.columnNames)?0:1;if(U=!1,f.cbArg||_){const E=Object.create(null);for(;u.step();u._lockedByExec=!1){Z++===0&&u.getColumnNames(E.columnNames=m.columnNames||[]),u._lockedByExec=!0;const C=f.cbArg(u,E);if(_&&_.push(C),l&&l.call(m,C,u)===!1)break}u._lockedByExec=!1}Z===0&&u.getColumnNames(m.columnNames)}else u.step();u.reset().finalize(),u=null}}}finally{s.scopedAllocPop(ee),u&&(delete u._lockedByExec,u.finalize())}return f.returnVal()},createFunction:function(m,l,_){const u=E=>E instanceof Function;switch(arguments.length){case 1:_=m,m=_.name,l=_.xFunc||0;break;case 2:u(l)||(_=l,l=_.xFunc||0);break}_||(_={}),typeof m!="string"&&n("Invalid arguments: missing function name.");let I=_.xStep||0,U=_.xFinal||0;const ee=_.xValue||0,ne=_.xInverse||0;let se;u(l)?(se=!1,(u(I)||u(U))&&n("Ambiguous arguments: scalar or aggregate?"),I=U=null):u(I)?(u(U)||n("Missing xFinal() callback for aggregate or window UDF."),l=null):u(U)?n("Missing xStep() callback for aggregate or window UDF."):n("Missing function-type properties."),se===!1?(u(ee)||u(ne))&&n("xValue and xInverse are not permitted for non-window UDFs."):u(ee)?(u(ne)||n("xInverse must be provided if xValue is."),se=!0):u(ne)&&n("xValue must be provided if xInverse is.");const ie=_.pApp;ie!=null&&(typeof ie!="number"||!o.isInt32(ie))&&n("Invalid value for pApp property. Must be a legal WASM pointer value.");const j=_.xDestroy||0;j&&!u(j)&&n("xDestroy property must be a function.");let b=0;O(_,"deterministic")&&(b|=r.SQLITE_DETERMINISTIC),O(_,"directOnly")&&(b|=r.SQLITE_DIRECTONLY),O(_,"innocuous")&&(b|=r.SQLITE_INNOCUOUS),m=m.toLowerCase();const k=l||I,W=O(_,"arity"),H=typeof W=="number"?W:k.length?k.length-1:0;let Z;return se?Z=r.sqlite3_create_window_function(this.pointer,m,H,r.SQLITE_UTF8|b,ie||0,I,U,ee,ne,j):Z=r.sqlite3_create_function_v2(this.pointer,m,H,r.SQLITE_UTF8|b,ie||0,l,I,U,j),A.checkRc(this,Z),this},selectValue:function(f,m,l){return P(this,f,m,0,l)},selectValues:function(f,m,l){const _=this.prepare(f),u=[];try{for(_.bind(m);_.step();)u.push(_.get(0,l));_.reset()}finally{_.finalize()}return u},selectArray:function(f,m){return P(this,f,m,[])},selectObject:function(f,m){return P(this,f,m,{})},selectArrays:function(f,m){return S(this,f,m,"array")},selectObjects:function(f,m){return S(this,f,m,"object")},openStatementCount:function(){return this.pointer?Object.keys(g.get(this)).length:0},transaction:function(f){let m="BEGIN";arguments.length>1&&(/[^a-zA-Z]/.test(arguments[0])&&n(r.SQLITE_MISUSE,"Invalid argument for BEGIN qualifier."),m+=" "+arguments[0],f=arguments[1]),w(this).exec(m);try{const l=f(this);return this.exec("COMMIT"),l}catch(l){throw this.exec("ROLLBACK"),l}},savepoint:function(f){w(this).exec("SAVEPOINT oo1");try{const m=f(this);return this.exec("RELEASE oo1"),m}catch(m){throw this.exec("ROLLBACK to SAVEPOINT oo1; RELEASE SAVEPOINT oo1"),m}},checkRc:function(f){return R(this,f)}};const L=function(f){return f.pointer||n("Stmt has been closed."),f},$=function(f){let m=D[f==null?"null":typeof f];switch(m){case D.boolean:case D.null:case D.number:case D.string:return m;case D.bigint:if(s.bigIntEnabled)return m;default:return o.isBindableTypedArray(f)?D.blob:void 0}},c=function(f){return $(f)||n("Unsupported bind() argument type:",typeof f)},d=function(f,m){const l=typeof m=="number"?m:r.sqlite3_bind_parameter_index(f.pointer,m);return l===0||!o.isInt32(l)?n("Invalid bind() parameter name: "+m):(l<1||l>f.parameterCount)&&n("Bind index",m,"is out of range."),l},y=function(f,m){return f._lockedByExec&&n("Operation is illegal when statement is locked:",m),f},B=function f(m,l,_,u){y(L(m),"bind()"),f._||(f._tooBigInt=U=>n("BigInt value is too big to store without precision loss:",U),f._={string:function(U,ee,ne,se){const[ie,j]=s.allocCString(ne,!0);return(se?r.sqlite3_bind_blob:r.sqlite3_bind_text)(U.pointer,ee,ie,j,r.SQLITE_WASM_DEALLOC)}}),c(u),l=d(m,l);let I=0;switch(u==null?D.null:_){case D.null:I=r.sqlite3_bind_null(m.pointer,l);break;case D.string:I=f._.string(m,l,u,!1);break;case D.number:{let U;o.isInt32(u)?U=r.sqlite3_bind_int:typeof u=="bigint"?o.bigIntFits64(u)?s.bigIntEnabled?U=r.sqlite3_bind_int64:o.bigIntFitsDouble(u)?(u=Number(u),U=r.sqlite3_bind_double):f._tooBigInt(u):f._tooBigInt(u):(u=Number(u),s.bigIntEnabled&&Number.isInteger(u)?U=r.sqlite3_bind_int64:U=r.sqlite3_bind_double),I=U(m.pointer,l,u);break}case D.boolean:I=r.sqlite3_bind_int(m.pointer,l,u?1:0);break;case D.blob:{if(typeof u=="string"){I=f._.string(m,l,u,!0);break}else u instanceof ArrayBuffer?u=new Uint8Array(u):o.isBindableTypedArray(u)||n("Binding a value as a blob requires","that it be a string, Uint8Array, Int8Array, or ArrayBuffer.");const U=s.alloc(u.byteLength||1);s.heap8().set(u.byteLength?u:[0],U),I=r.sqlite3_bind_blob(m.pointer,l,U,u.byteLength,r.SQLITE_WASM_DEALLOC);break}default:t.config.warn("Unsupported bind() argument type:",u),n("Unsupported bind() argument type: "+typeof u)}return I&&A.checkRc(m.db.pointer,I),m._mayGet=!1,m};q.prototype={finalize:function(){if(this.pointer){y(this,"finalize()");const f=r.sqlite3_finalize(this.pointer);return delete g.get(this.db)[this.pointer],p.delete(this),delete this._mayGet,delete this.parameterCount,delete this._lockedByExec,delete this.db,f}},clearBindings:function(){return y(L(this),"clearBindings()"),r.sqlite3_clear_bindings(this.pointer),this._mayGet=!1,this},reset:function(f){y(this,"reset()"),f&&this.clearBindings();const m=r.sqlite3_reset(L(this).pointer);return this._mayGet=!1,R(this.db,m),this},bind:function(){L(this);let f,m;switch(arguments.length){case 1:f=1,m=arguments[0];break;case 2:f=arguments[0],m=arguments[1];break;default:n("Invalid bind() arguments.")}return m===void 0?this:(this.parameterCount||n("This statement has no bindable parameters."),this._mayGet=!1,m===null?B(this,f,D.null,m):Array.isArray(m)?(arguments.length!==1&&n("When binding an array, an index argument is not permitted."),m.forEach((l,_)=>B(this,_+1,c(l),l)),this):(m instanceof ArrayBuffer&&(m=new Uint8Array(m)),typeof m=="object"&&!o.isBindableTypedArray(m)?(arguments.length!==1&&n("When binding an object, an index argument is not permitted."),Object.keys(m).forEach(l=>B(this,l,c(m[l]),m[l])),this):B(this,f,c(m),m)))},bindAsBlob:function(f,m){L(this),arguments.length===1&&(m=f,f=1);const l=c(m);return D.string!==l&&D.blob!==l&&D.null!==l&&n("Invalid value type for bindAsBlob()"),B(this,f,D.blob,m)},step:function(){y(this,"step()");const f=r.sqlite3_step(L(this).pointer);switch(f){case r.SQLITE_DONE:return this._mayGet=!1;case r.SQLITE_ROW:return this._mayGet=!0;default:this._mayGet=!1,t.config.warn("sqlite3_step() rc=",f,r.sqlite3_js_rc_str(f),"SQL =",r.sqlite3_sql(this.pointer)),A.checkRc(this.db.pointer,f)}},stepReset:function(){return this.step(),this.reset()},stepFinalize:function(){try{const f=this.step();return this.reset(),f}finally{try{this.finalize()}catch{}}},get:function(f,m){if(L(this)._mayGet||n("Stmt.step() has not (recently) returned true."),Array.isArray(f)){let l=0;const _=this.columnCount;for(;l<_;)f[l]=this.get(l++);return f}else if(f&&typeof f=="object"){let l=0;const _=this.columnCount;for(;l<_;)f[r.sqlite3_column_name(this.pointer,l)]=this.get(l++);return f}switch(x(this,f),m===void 0?r.sqlite3_column_type(this.pointer,f):m){case r.SQLITE_NULL:return null;case r.SQLITE_INTEGER:if(s.bigIntEnabled){const l=r.sqlite3_column_int64(this.pointer,f);return l>=Number.MIN_SAFE_INTEGER&&l<=Number.MAX_SAFE_INTEGER?Number(l).valueOf():l}else{const l=r.sqlite3_column_double(this.pointer,f);return(l>Number.MAX_SAFE_INTEGER||ln("The pointer property is read-only.")};Object.defineProperty(q.prototype,"pointer",f),Object.defineProperty(A.prototype,"pointer",f)}if(Object.defineProperty(q.prototype,"columnCount",{enumerable:!1,get:function(){return r.sqlite3_column_count(this.pointer)},set:()=>n("The columnCount property is read-only.")}),t.oo1={DB:A,Stmt:q},o.isUIThread()){t.oo1.JsStorageDb=function(m="session"){const l=T.normalizeArgs(...arguments);m=l.filename,m!=="session"&&m!=="local"&&n("JsStorageDb db name must be one of 'session' or 'local'."),l.vfs="kvvfs",T.call(this,l)};const f=t.oo1.JsStorageDb;f.prototype=Object.create(A.prototype),f.clearStorage=r.sqlite3_js_kvvfs_clear,f.prototype.clearStorage=function(){return f.clearStorage(w(this).filename)},f.storageSize=r.sqlite3_js_kvvfs_size,f.prototype.storageSize=function(){return f.storageSize(w(this).filename)}}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){const n=t.util;t.initWorker1API=(function(){const r=(...T)=>{throw new Error(T.join(" "))};globalThis.WorkerGlobalScope instanceof Function||r("initWorker1API() must be run from a Worker thread.");const s=this.sqlite3||r("Missing this.sqlite3 object."),o=s.oo1.DB,p=function(T){let A=g.idMap.get(T);return A||(A="db#"+ ++g.idSeq+"@"+T.pointer,g.idMap.set(T,A),A)},g={dbList:[],idSeq:0,idMap:new WeakMap,xfer:[],open:function(T){const A=new o(T);return this.dbs[p(A)]=A,this.dbList.indexOf(A)<0&&this.dbList.push(A),A},close:function(T,A){if(T){delete this.dbs[p(T)];const D=T.filename,q=n.sqlite3__wasm_db_vfs(T.pointer,0);T.close();const w=this.dbList.indexOf(T);w>=0&&this.dbList.splice(w,1),A&&D&&q&&n.sqlite3__wasm_vfs_unlink(q,D)}},post:function(T,A){A&&A.length?(globalThis.postMessage(T,Array.from(A)),A.length=0):globalThis.postMessage(T)},dbs:Object.create(null),getDb:function(T,A=!0){return this.dbs[T]||(A?r("Unknown (or closed) DB ID:",T):void 0)}},O=function(T=g.dbList[0]){return T&&T.pointer?T:r("DB is not opened.")},R=function(T,A=!0){const D=g.getDb(T.dbId,!1)||g.dbList[0];return A?O(D):D},z=function(){return g.dbList[0]&&p(g.dbList[0])},Q={open:function(T){const A=Object.create(null),D=T.args||Object.create(null);D.simulateError&&r("Throwing because of simulateError flag.");const q=Object.create(null);A.vfs=D.vfs,A.filename=D.filename||"";const w=g.open(A);return q.filename=w.filename,q.persistent=!!s.capi.sqlite3_js_db_uses_vfs(w.pointer,"opfs"),q.dbId=p(w),q.vfs=w.dbVfsName(),q},close:function(T){const A=R(T,!1),D={filename:A&&A.filename};if(A){const q=T.args&&typeof T.args=="object"?!!T.args.unlink:!1;g.close(A,q)}return D},exec:function(T){const A=typeof T.args=="string"?{sql:T.args}:T.args||Object.create(null);A.rowMode==="stmt"?r("Invalid rowMode for 'exec': stmt mode","does not work in the Worker API."):A.sql||r("'exec' requires input SQL.");const D=R(T);(A.callback||Array.isArray(A.resultRows))&&(D._blobXfer=g.xfer);const q=A.callback;let w=0;const x=!!A.columnNames;typeof q=="string"&&(x||(A.columnNames=[]),A.callback=function(N,P){g.post({type:q,columnNames:A.columnNames,rowNumber:++w,row:N},g.xfer)});try{const N=A.countChanges?D.changes(!0,A.countChanges===64):void 0;D.exec(A),N!==void 0&&(A.changeCount=D.changes(!0,A.countChanges===64)-N);const P=A.lastInsertRowId?s.capi.sqlite3_last_insert_rowid(D):void 0;P!==void 0&&(A.lastInsertRowId=P),A.callback instanceof Function&&(A.callback=q,g.post({type:q,columnNames:A.columnNames,rowNumber:null,row:void 0}))}finally{delete D._blobXfer,A.callback&&(A.callback=q)}return A},"config-get":function(){const T=Object.create(null),A=s.config;return["bigIntEnabled"].forEach(function(D){Object.getOwnPropertyDescriptor(A,D)&&(T[D]=A[D])}),T.version=s.version,T.vfsList=s.capi.sqlite3_js_vfs_list(),T},export:function(T){const A=R(T),D={byteArray:s.capi.sqlite3_js_db_export(A.pointer),filename:A.filename,mimetype:"application/x-sqlite3"};return g.xfer.push(D.byteArray.buffer),D},toss:function(T){r("Testing worker exception")}};globalThis.onmessage=async function(T){T=T.data;let A,D=T.dbId,q=T.type;const w=performance.now();try{Q.hasOwnProperty(q)&&Q[q]instanceof Function?A=await Q[q](T):r("Unknown db worker message type:",T.type)}catch(x){q="error",A={operation:T.type,message:x.message,errorClass:x.name,input:T},x.stack&&(A.stack=typeof x.stack=="string"?x.stack.split(/\n\s*/):x.stack)}D||(D=A.dbId||z()),g.post({type:q,dbId:D,messageId:T.messageId,workerReceivedTime:w,workerRespondTime:performance.now(),departureTime:T.departureTime,result:A},g.xfer)},globalThis.postMessage({type:"sqlite3-api",result:"worker1-ready"})}).bind({sqlite3:t})}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){const n=t.wasm,r=t.capi,s=t.util.toss3,o=Object.create(null);t.vfs=o,r.sqlite3_vfs.prototype.registerVfs=function(p=!1){this instanceof t.capi.sqlite3_vfs||s("Expecting a sqlite3_vfs-type argument.");const g=r.sqlite3_vfs_register(this,p?1:0);return g&&s("sqlite3_vfs_register(",this,") failed with rc",g),this.pointer!==r.sqlite3_vfs_find(this.$zName)&&s("BUG: sqlite3_vfs_find(vfs.$zName) failed for just-installed VFS",this),this},o.installVfs=function(p){let g=0;const O=["io","vfs"];for(const R of O){const z=p[R];z&&(++g,z.struct.installMethods(z.methods,!!z.applyArgcCheck),R==="vfs"&&(!z.struct.$zName&&typeof z.name=="string"&&z.struct.addOnDispose(z.struct.$zName=n.allocCString(z.name)),z.struct.registerVfs(!!z.asDefault)))}return g||s("Misuse: installVfs() options object requires at least","one of:",O),this}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){if(!t.wasm.exports.sqlite3_declare_vtab)return;const n=t.wasm,r=t.capi,s=t.util.toss3,o=Object.create(null);t.vtab=o;const p=r.sqlite3_index_info;p.prototype.nthConstraint=function(R,z=!1){if(R<0||R>=this.$nConstraint)return!1;const Q=this.$aConstraint+p.sqlite3_index_constraint.structInfo.sizeof*R;return z?Q:new p.sqlite3_index_constraint(Q)},p.prototype.nthConstraintUsage=function(R,z=!1){if(R<0||R>=this.$nConstraint)return!1;const Q=this.$aConstraintUsage+p.sqlite3_index_constraint_usage.structInfo.sizeof*R;return z?Q:new p.sqlite3_index_constraint_usage(Q)},p.prototype.nthOrderBy=function(R,z=!1){if(R<0||R>=this.$nOrderBy)return!1;const Q=this.$aOrderBy+p.sqlite3_index_orderby.structInfo.sizeof*R;return z?Q:new p.sqlite3_index_orderby(Q)};const g=function(R,z){return(function(Q,T=!1){if(arguments.length===0&&(Q=new z),Q instanceof z)return this.set(Q.pointer,Q),Q;n.isPtr(Q)||t.SQLite3Error.toss("Invalid argument to",R+"()");let A=this.get(Q);return T&&this.delete(Q),A}).bind(new Map)},O=function(R,z){const Q=g(R,z);return Object.assign(Object.create(null),{StructType:z,create:T=>{const A=Q();return n.pokePtr(T,A.pointer),A},get:T=>Q(T),unget:T=>Q(T,!0),dispose:T=>{const A=Q(T,!0);A&&A.dispose()}})};o.xVtab=O("xVtab",r.sqlite3_vtab),o.xCursor=O("xCursor",r.sqlite3_vtab_cursor),o.xIndexInfo=R=>new r.sqlite3_index_info(R),o.xError=function R(z,Q,T){if(R.errorReporter instanceof Function)try{R.errorReporter("sqlite3_module::"+z+"(): "+Q.message)}catch{}let A;return Q instanceof t.WasmAllocError?A=r.SQLITE_NOMEM:arguments.length>2?A=T:Q instanceof t.SQLite3Error&&(A=Q.resultCode),A||r.SQLITE_ERROR},o.xError.errorReporter=console.error.bind(console),o.xRowid=(R,z)=>n.poke(R,z,"i64"),o.setupModule=function(R){let z=!1;const Q=this instanceof r.sqlite3_module?this:R.struct||(z=new r.sqlite3_module);try{const T=R.methods||s("Missing 'methods' object.");for(const A of Object.entries({xConnect:"xCreate",xDisconnect:"xDestroy"})){const D=A[0],q=A[1];T[D]===!0?T[D]=T[q]:T[q]===!0&&(T[q]=T[D])}if(R.catchExceptions){const A=function(w,x){return["xConnect","xCreate"].indexOf(w)>=0?function(N,P,S,L,$,c){try{return x(...arguments)||0}catch(d){return d instanceof t.WasmAllocError||(n.dealloc(n.peekPtr(c)),n.pokePtr(c,n.allocCString(d.message))),o.xError(w,d)}}:function(...N){try{return x(...N)||0}catch(P){return o.xError(w,P)}}},D=["xCreate","xConnect","xBestIndex","xDisconnect","xDestroy","xOpen","xClose","xFilter","xNext","xEof","xColumn","xRowid","xUpdate","xBegin","xSync","xCommit","xRollback","xFindFunction","xRename","xSavepoint","xRelease","xRollbackTo","xShadowName"],q=Object.create(null);for(const w of D){const x=T[w];if(x instanceof Function)w==="xConnect"&&T.xCreate===x?q[w]=T.xCreate:w==="xCreate"&&T.xConnect===x?q[w]=T.xConnect:q[w]=A(w,x);else continue}Q.installMethods(q,!1)}else Q.installMethods(T,!!R.applyArgcCheck);if(Q.$iVersion===0){let A;typeof R.iVersion=="number"?A=R.iVersion:Q.$xShadowName?A=3:Q.$xSavePoint||Q.$xRelease||Q.$xRollbackTo?A=2:A=1,Q.$iVersion=A}}catch(T){throw z&&z.dispose(),T}return Q},r.sqlite3_module.prototype.setupModule=function(R){return o.setupModule.call(this,R)}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){const n=function r(s){if(!globalThis.SharedArrayBuffer||!globalThis.Atomics)return Promise.reject(new Error("Cannot install OPFS: Missing SharedArrayBuffer and/or Atomics. The server must emit the COOP/COEP response headers to enable those. See https://sqlite.org/wasm/doc/trunk/persistence.md#coop-coep"));if(typeof WorkerGlobalScope>"u")return Promise.reject(new Error("The OPFS sqlite3_vfs cannot run in the main thread because it requires Atomics.wait()."));if(!globalThis.FileSystemHandle||!globalThis.FileSystemDirectoryHandle||!globalThis.FileSystemFileHandle||!globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle||!navigator?.storage?.getDirectory)return Promise.reject(new Error("Missing required OPFS APIs."));(!s||typeof s!="object")&&(s=Object.create(null));const o=new URL(globalThis.location.href).searchParams;return o.has("opfs-disable")?Promise.resolve(t):(s.verbose===void 0&&(s.verbose=o.has("opfs-verbose")?+o.get("opfs-verbose")||2:1),s.sanityChecks===void 0&&(s.sanityChecks=o.has("opfs-sanity-check")),s.proxyUri===void 0&&(s.proxyUri=r.defaultProxyUri),typeof s.proxyUri=="function"&&(s.proxyUri=s.proxyUri()),new Promise(function(g,O){const R=[t.config.error,t.config.warn,t.config.log],z=(E,...C)=>{s.verbose>E&&R[E]("OPFS syncer:",...C)},Q=(...E)=>z(2,...E),T=(...E)=>z(1,...E),A=(...E)=>z(0,...E),D=t.util.toss,q=t.capi,w=t.util,x=t.wasm,N=q.sqlite3_vfs,P=q.sqlite3_file,S=q.sqlite3_io_methods,L=Object.create(null),$=()=>globalThis.FileSystemHandle&&globalThis.FileSystemDirectoryHandle&&globalThis.FileSystemFileHandle&&globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle&&navigator?.storage?.getDirectory;L.metrics={dump:function(){let E,C=0,M=0,J=0;for(E in u.opIds){const G=I[E];C+=G.count,M+=G.time,J+=G.wait,G.avgTime=G.count&&G.time?G.time/G.count:0,G.avgWait=G.count&&G.wait?G.wait/G.count:0}t.config.log(globalThis.location.href,"metrics for",globalThis.location.href,":",I,` +Total of`,C,"op(s) for",M,"ms (incl. "+J+" ms of waiting on the async side)"),t.config.log("Serialization metrics:",I.s11n),m.postMessage({type:"opfs-async-metrics"})},reset:function(){let E;const C=J=>J.count=J.time=J.wait=0;for(E in u.opIds)C(I[E]=Object.create(null));let M=I.s11n=Object.create(null);M=M.serialize=Object.create(null),M.count=M.time=0,M=I.s11n.deserialize=Object.create(null),M.count=M.time=0}};const c=new S,d=new N().addOnDispose(()=>c.dispose());let y;const B=E=>(y=!0,d.dispose(),O(E)),f=()=>(y=!1,g(t)),m=new Worker(new URL("/assets/sqlite3-opfs-async-proxy-B_ImRJXp.js",import.meta.url));setTimeout(()=>{y===void 0&&B(new Error("Timeout while waiting for OPFS async proxy worker."))},4e3),m._originalOnError=m.onerror,m.onerror=function(E){A("Error initializing OPFS asyncer:",E),B(new Error("Loading OPFS async Worker failed for unknown reasons."))};const l=q.sqlite3_vfs_find(null),_=l?new N(l):null;c.$iVersion=1,d.$iVersion=2,d.$szOsFile=q.sqlite3_file.structInfo.sizeof,d.$mxPathname=1024,d.$zName=x.allocCString("opfs"),d.$xDlOpen=d.$xDlError=d.$xDlSym=d.$xDlClose=null,d.addOnDispose("$zName",d.$zName,"cleanup default VFS wrapper",()=>_?_.dispose():null);const u=Object.create(null);u.verbose=s.verbose,u.littleEndian=(()=>{const E=new ArrayBuffer(2);return new DataView(E).setInt16(0,256,!0),new Int16Array(E)[0]===256})(),u.asyncIdleWaitTime=150,u.asyncS11nExceptions=1,u.fileBufferSize=1024*64,u.sabS11nOffset=u.fileBufferSize,u.sabS11nSize=d.$mxPathname*2,u.sabIO=new SharedArrayBuffer(u.fileBufferSize+u.sabS11nSize),u.opIds=Object.create(null);const I=Object.create(null);{let E=0;u.opIds.whichOp=E++,u.opIds.rc=E++,u.opIds.xAccess=E++,u.opIds.xClose=E++,u.opIds.xDelete=E++,u.opIds.xDeleteNoWait=E++,u.opIds.xFileSize=E++,u.opIds.xLock=E++,u.opIds.xOpen=E++,u.opIds.xRead=E++,u.opIds.xSleep=E++,u.opIds.xSync=E++,u.opIds.xTruncate=E++,u.opIds.xUnlock=E++,u.opIds.xWrite=E++,u.opIds.mkdir=E++,u.opIds["opfs-async-metrics"]=E++,u.opIds["opfs-async-shutdown"]=E++,u.opIds.retry=E++,u.sabOP=new SharedArrayBuffer(E*4),L.metrics.reset()}u.sq3Codes=Object.create(null),["SQLITE_ACCESS_EXISTS","SQLITE_ACCESS_READWRITE","SQLITE_BUSY","SQLITE_CANTOPEN","SQLITE_ERROR","SQLITE_IOERR","SQLITE_IOERR_ACCESS","SQLITE_IOERR_CLOSE","SQLITE_IOERR_DELETE","SQLITE_IOERR_FSYNC","SQLITE_IOERR_LOCK","SQLITE_IOERR_READ","SQLITE_IOERR_SHORT_READ","SQLITE_IOERR_TRUNCATE","SQLITE_IOERR_UNLOCK","SQLITE_IOERR_WRITE","SQLITE_LOCK_EXCLUSIVE","SQLITE_LOCK_NONE","SQLITE_LOCK_PENDING","SQLITE_LOCK_RESERVED","SQLITE_LOCK_SHARED","SQLITE_LOCKED","SQLITE_MISUSE","SQLITE_NOTFOUND","SQLITE_OPEN_CREATE","SQLITE_OPEN_DELETEONCLOSE","SQLITE_OPEN_MAIN_DB","SQLITE_OPEN_READONLY"].forEach(E=>{(u.sq3Codes[E]=q[E])===void 0&&D("Maintenance required: not found:",E)}),u.opfsFlags=Object.assign(Object.create(null),{OPFS_UNLOCK_ASAP:1,OPFS_UNLINK_BEFORE_OPEN:2,defaultUnlockAsap:!1});const U=(E,...C)=>{const M=u.opIds[E]||D("Invalid op ID:",E);u.s11n.serialize(...C),Atomics.store(u.sabOPView,u.opIds.rc,-1),Atomics.store(u.sabOPView,u.opIds.whichOp,M),Atomics.notify(u.sabOPView,u.opIds.whichOp);const J=performance.now();for(;Atomics.wait(u.sabOPView,u.opIds.rc,-1)!=="not-equal";);const G=Atomics.load(u.sabOPView,u.opIds.rc);if(I[E].wait+=performance.now()-J,G&&u.asyncS11nExceptions){const te=u.s11n.deserialize();te&&A(E+"() async error:",...te)}return G};L.debug={asyncShutdown:()=>{T("Shutting down OPFS async listener. The OPFS VFS will no longer work."),U("opfs-async-shutdown")},asyncRestart:()=>{T("Attempting to restart OPFS VFS async listener. Might work, might not."),m.postMessage({type:"opfs-async-restart"})}};const ee=()=>{if(u.s11n)return u.s11n;const E=new TextDecoder,C=new TextEncoder("utf-8"),M=new Uint8Array(u.sabIO,u.sabS11nOffset,u.sabS11nSize),J=new DataView(u.sabIO,u.sabS11nOffset,u.sabS11nSize);u.s11n=Object.create(null);const G=Object.create(null);G.number={id:1,size:8,getter:"getFloat64",setter:"setFloat64"},G.bigint={id:2,size:8,getter:"getBigInt64",setter:"setBigInt64"},G.boolean={id:3,size:4,getter:"getInt32",setter:"setInt32"},G.string={id:4};const te=Y=>G[typeof Y]||D("Maintenance required: this value type cannot be serialized.",Y),ae=Y=>{switch(Y){case G.number.id:return G.number;case G.bigint.id:return G.bigint;case G.boolean.id:return G.boolean;case G.string.id:return G.string;default:D("Invalid type ID:",Y)}};return u.s11n.deserialize=function(Y=!1){++I.s11n.deserialize.count;const we=performance.now(),F=M[0],V=F?[]:null;if(F){const K=[];let X=1,_e,ge,pe;for(_e=0;_e{ie.start=performance.now(),ie.op=E,++I[E].count},b=()=>I[ie.op].time+=performance.now()-ie.start,k={xCheckReservedLock:function(E,C){return x.poke(C,0,"i32"),0},xClose:function(E){j("xClose");let C=0;const M=se[E];return M&&(delete se[E],C=U("xClose",E),M.sq3File&&M.sq3File.dispose()),b(),C},xDeviceCharacteristics:function(E){return q.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN},xFileControl:function(E,C,M){return q.SQLITE_NOTFOUND},xFileSize:function(E,C){j("xFileSize");let M=U("xFileSize",E);if(M==0)try{const J=u.s11n.deserialize()[0];x.poke(C,J,"i64")}catch(J){A("Unexpected error reading xFileSize() result:",J),M=u.sq3Codes.SQLITE_IOERR}return b(),M},xLock:function(E,C){j("xLock");const M=se[E];let J=0;return M.lockType?M.lockType=C:(J=U("xLock",E,C),J===0&&(M.lockType=C)),b(),J},xRead:function(E,C,M,J){j("xRead");const G=se[E];let te;try{te=U("xRead",E,M,Number(J)),(te===0||q.SQLITE_IOERR_SHORT_READ===te)&&x.heap8u().set(G.sabView.subarray(0,M),C)}catch(ae){A("xRead(",arguments,") failed:",ae,G),te=q.SQLITE_IOERR_READ}return b(),te},xSync:function(E,C){j("xSync"),++I.xSync.count;const M=U("xSync",E,C);return b(),M},xTruncate:function(E,C){j("xTruncate");const M=U("xTruncate",E,Number(C));return b(),M},xUnlock:function(E,C){j("xUnlock");const M=se[E];let J=0;return q.SQLITE_LOCK_NONE===C&&M.lockType&&(J=U("xUnlock",E,C)),J===0&&(M.lockType=C),b(),J},xWrite:function(E,C,M,J){j("xWrite");const G=se[E];let te;try{G.sabView.set(x.heap8u().subarray(C,C+M)),te=U("xWrite",E,M,Number(J))}catch(ae){A("xWrite(",arguments,") failed:",ae,G),te=q.SQLITE_IOERR_WRITE}return b(),te}},W={xAccess:function(E,C,M,J){j("xAccess");const G=U("xAccess",x.cstrToJs(C));return x.poke(J,G?0:1,"i32"),b(),0},xCurrentTime:function(E,C){return x.poke(C,24405875e-1+new Date().getTime()/864e5,"double"),0},xCurrentTimeInt64:function(E,C){return x.poke(C,24405875e-1*864e5+new Date().getTime(),"i64"),0},xDelete:function(E,C,M){j("xDelete");const J=U("xDelete",x.cstrToJs(C),M,!1);return b(),J},xFullPathname:function(E,C,M,J){return x.cstrncpy(J,C,M)!!J):M},L.getDirForFilename=async function(C,M=!1){const J=L.getResolvedPath(C,!0),G=J.pop();let te=L.rootDirectory;for(const ae of J)ae&&(te=await te.getDirectoryHandle(ae,{create:!!M}));return[te,G]},L.mkdir=async function(E){try{return await L.getDirForFilename(E+"/filepart",!0),!0}catch{return!1}},L.entryExists=async function(E){try{const[C,M]=await L.getDirForFilename(E);return await C.getFileHandle(M),!0}catch{return!1}},L.randomFilename=ne,L.treeList=async function(){const E=async function M(J,G){G.name=J.name,G.dirs=[],G.files=[];for await(const te of J.values())if(te.kind==="directory"){const ae=Object.create(null);G.dirs.push(ae),await M(te,ae)}else G.files.push(te.name)},C=Object.create(null);return await E(L.rootDirectory,C),C},L.rmfr=async function(){const E=L.rootDirectory,C={recurse:!0};for await(const M of E.values())E.removeEntry(M.name,C)},L.unlink=async function(E,C=!1,M=!1){try{const[J,G]=await L.getDirForFilename(E,!1);return await J.removeEntry(G,{recursive:C}),!0}catch(J){if(M)throw new Error("unlink(",arguments[0],") failed: "+J.message,{cause:J});return!1}},L.traverse=async function(E){const C={recursive:!0,directory:L.rootDirectory};typeof E=="function"&&(E={callback:E}),E=Object.assign(C,E||{}),async function J(G,te){for await(const ae of G.values()){if(E.callback(ae,G,te)===!1)return!1;if(E.recursive&&ae.kind==="directory"&&await J(ae,te+1)===!1)break}}(E.directory,0)};const H=async function(E,C){const[M,J]=await L.getDirForFilename(E,!0);let te=await(await M.getFileHandle(J,{create:!0})).createSyncAccessHandle(),ae=0,Y,we=!1;try{for(te.truncate(0);(Y=await C())!==void 0;)Y instanceof ArrayBuffer&&(Y=new Uint8Array(Y)),ae===0&&Y.byteLength>=15&&(w.affirmDbHeader(Y),we=!0),te.write(Y,{at:ae}),ae+=Y.byteLength;if((ae<512||ae%512!==0)&&D("Input size",ae,"is not correct for an SQLite database."),!we){const F=new Uint8Array(20);te.read(F,{at:0}),w.affirmDbHeader(F)}return te.write(new Uint8Array([1,1]),{at:18}),ae}catch(F){throw await te.close(),te=void 0,await M.removeEntry(J).catch(()=>{}),F}finally{te&&await te.close()}};if(L.importDb=async function(E,C){if(C instanceof Function)return H(E,C);C instanceof ArrayBuffer&&(C=new Uint8Array(C)),w.affirmIsDb(C);const M=C.byteLength,[J,G]=await L.getDirForFilename(E,!0);let te,ae=0;try{return te=await(await J.getFileHandle(G,{create:!0})).createSyncAccessHandle(),te.truncate(0),ae=te.write(C,{at:0}),ae!=M&&D("Expected to write "+M+" bytes but wrote "+ae+"."),te.write(new Uint8Array([1,1]),{at:18}),ae}catch(Y){throw te&&(await te.close(),te=void 0),await J.removeEntry(G).catch(()=>{}),Y}finally{te&&await te.close()}},t.oo1){const E=function(...C){const M=t.oo1.DB.dbCtorHelper.normalizeArgs(...C);M.vfs=d.$zName,t.oo1.DB.dbCtorHelper.call(this,M)};E.prototype=Object.create(t.oo1.DB.prototype),t.oo1.OpfsDb=E,E.importDb=L.importDb,t.oo1.DB.dbCtorHelper.setVfsPostOpenCallback(d.pointer,function(C,M){M.capi.sqlite3_busy_timeout(C,1e4)})}const Z=function(){const E=x.scopedAllocPush(),C=new P;try{const M=C.pointer,J=q.SQLITE_OPEN_CREATE|q.SQLITE_OPEN_READWRITE|q.SQLITE_OPEN_MAIN_DB,G=x.scopedAlloc(8),te="/sanity/check/file"+ne(8),ae=x.scopedAllocCString(te);let Y;if(u.s11n.serialize("This is ä string."),Y=u.s11n.deserialize(),Q("deserialize() says:",Y),Y[0]!=="This is ä string."&&D("String d13n error."),W.xAccess(d.pointer,ae,0,G),Y=x.peek(G,"i32"),Q("xAccess(",te,") exists ?=",Y),Y=W.xOpen(d.pointer,ae,M,J,G),Q("open rc =",Y,"state.sabOPView[xOpen] =",u.sabOPView[u.opIds.xOpen]),Y!==0){A("open failed with code",Y);return}W.xAccess(d.pointer,ae,0,G),Y=x.peek(G,"i32"),Y||D("xAccess() failed to detect file."),Y=k.xSync(C.pointer,0),Y&&D("sync failed w/ rc",Y),Y=k.xTruncate(C.pointer,1024),Y&&D("truncate failed w/ rc",Y),x.poke(G,0,"i64"),Y=k.xFileSize(C.pointer,G),Y&&D("xFileSize failed w/ rc",Y),Q("xFileSize says:",x.peek(G,"i64")),Y=k.xWrite(C.pointer,ae,10,1),Y&&D("xWrite() failed!");const we=x.scopedAlloc(16);Y=k.xRead(C.pointer,we,6,2),x.poke(we+6,0);let F=x.cstrToJs(we);Q("xRead() got:",F),F!=="sanity"&&D("Unexpected xRead() value."),W.xSleep&&(Q("xSleep()ing before close()ing..."),W.xSleep(d.pointer,2e3),Q("waking up from xSleep()")),Y=k.xClose(M),Q("xClose rc =",Y,"sabOPView =",u.sabOPView),Q("Deleting file:",te),W.xDelete(d.pointer,ae,4660),W.xAccess(d.pointer,ae,0,G),Y=x.peek(G,"i32"),Y&&D("Expecting 0 from xAccess(",te,") after xDelete()."),T("End of OPFS sanity checks.")}finally{C.dispose(),x.scopedAllocPop(E)}};m.onmessage=function({data:E}){switch(E.type){case"opfs-unavailable":B(new Error(E.payload.join(" ")));break;case"opfs-async-loaded":m.postMessage({type:"opfs-async-init",args:u});break;case"opfs-async-inited":{if(y===!0)break;try{t.vfs.installVfs({io:{struct:c,methods:k},vfs:{struct:d,methods:W}}),u.sabOPView=new Int32Array(u.sabOP),u.sabFileBufView=new Uint8Array(u.sabIO,0,u.fileBufferSize),u.sabS11nView=new Uint8Array(u.sabIO,u.sabS11nOffset,u.sabS11nSize),ee(),s.sanityChecks&&(T("Running sanity checks because of opfs-sanity-check URL arg..."),Z()),$()?navigator.storage.getDirectory().then(C=>{m.onerror=m._originalOnError,delete m._originalOnError,t.opfs=L,L.rootDirectory=C,Q("End of OPFS sqlite3_vfs setup.",d),f()}).catch(B):f()}catch(C){A(C),B(C)}break}default:{const C="Unexpected message from the OPFS async worker: "+JSON.stringify(E);A(C),B(new Error(C));break}}}}))};n.defaultProxyUri="sqlite3-opfs-async-proxy.js",globalThis.sqlite3ApiBootstrap.initializersAsync.push(async r=>{try{let s=n.defaultProxyUri;return r.scriptInfo.sqlite3Dir&&(n.defaultProxyUri=r.scriptInfo.sqlite3Dir+s),n().catch(o=>{r.config.warn("Ignoring inability to install OPFS sqlite3_vfs:",o.message)})}catch(s){return r.config.error("installOpfsVfs() exception:",s),Promise.reject(s)}})}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){const n=t.util.toss,r=t.util.toss3,s=Object.create(null),o=t.capi,p=t.util,g=t.wasm,O=4096,R=512,z=4,Q=8,T=R+z,A=R,D=T,q=O,w=o.SQLITE_OPEN_MAIN_DB|o.SQLITE_OPEN_MAIN_JOURNAL|o.SQLITE_OPEN_SUPER_JOURNAL|o.SQLITE_OPEN_WAL,x=o.SQLITE_OPEN_MEMORY,N=".opaque",P=()=>Math.random().toString(36).slice(2),S=new TextDecoder,L=new TextEncoder,$=Object.assign(Object.create(null),{name:"opfs-sahpool",directory:void 0,initialCapacity:6,clearOnInit:!1,verbosity:2,forceReinitIfPreviouslyFailed:!1}),c=[t.config.error,t.config.warn,t.config.log];t.config.log;const d=t.config.warn;t.config.error;const y=new Map,B=j=>y.get(j),f=(j,b)=>{b?y.set(j,b):y.delete(j)},m=new Map,l=j=>m.get(j),_=(j,b)=>{b?m.set(j,b):m.delete(j)},u={xCheckReservedLock:function(j,b){const k=l(j);return k.log("xCheckReservedLock"),k.storeErr(),g.poke32(b,1),0},xClose:function(j){const b=l(j);b.storeErr();const k=b.getOFileForS3File(j);if(k)try{b.log(`xClose ${k.path}`),b.mapS3FileToOFile(j,!1),k.sah.flush(),k.flags&o.SQLITE_OPEN_DELETEONCLOSE&&b.deletePath(k.path)}catch(W){return b.storeErr(W,o.SQLITE_IOERR)}return 0},xDeviceCharacteristics:function(j){return o.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN},xFileControl:function(j,b,k){return o.SQLITE_NOTFOUND},xFileSize:function(j,b){const k=l(j);k.log("xFileSize");const H=k.getOFileForS3File(j).sah.getSize()-q;return g.poke64(b,BigInt(H)),0},xLock:function(j,b){const k=l(j);k.log(`xLock ${b}`),k.storeErr();const W=k.getOFileForS3File(j);return W.lockType=b,0},xRead:function(j,b,k,W){const H=l(j);H.storeErr();const Z=H.getOFileForS3File(j);H.log(`xRead ${Z.path} ${k} @ ${W}`);try{const E=Z.sah.read(g.heap8u().subarray(b,b+k),{at:q+Number(W)});return Eb&&g.poke8(k+b-1,0)}catch{return o.SQLITE_NOMEM}finally{g.scopedAllocPop(Z)}}return H?H.sqlite3Rc||o.SQLITE_IOERR:0},xOpen:function(b,k,W,H,Z){const E=B(b);try{H&=~x,E.log(`xOpen ${g.cstrToJs(k)} ${H}`);const C=k&&g.peek8(k)?E.getPath(k):P();let M=E.getSAHForPath(C);!M&&H&o.SQLITE_OPEN_CREATE&&(E.getFileCount()f(b.pointer,0)),W&&(b.$xRandomness=W.$xRandomness,b.$xSleep=W.$xSleep,W.dispose()),!b.$xRandomness&&!U.xRandomness&&(U.xRandomness=function(H,Z,E){const C=g.heap8u();let M=0;for(;M0),t.vfs.installVfs({vfs:{struct:b,methods:U}}),b};class ne{vfsDir;#e;#o;#a;#r=new Map;#t=new Map;#s=new Set;#l=new Map;#n=new Uint8Array(T);#c;#i;#u;constructor(b=Object.create(null)){this.#u=b.verbosity??$.verbosity,this.vfsName=b.name||$.name,this.#i=ee(this.vfsName),f(this.#i.pointer,this),this.vfsDir=b.directory||"."+this.vfsName,this.#c=new DataView(this.#n.buffer,this.#n.byteOffset),this.isReady=this.reset(!!(b.clearOnInit??$.clearOnInit)).then(()=>{if(this.$error)throw this.$error;return this.getCapacity()?Promise.resolve(void 0):this.addCapacity(b.initialCapacity||$.initialCapacity)})}#_(b,...k){this.#u>b&&c[b](this.vfsName+":",...k)}log(...b){this.#_(2,...b)}warn(...b){this.#_(1,...b)}error(...b){this.#_(0,...b)}getVfs(){return this.#i}getCapacity(){return this.#r.size}getFileCount(){return this.#t.size}getFileNames(){const b=[];for(const k of this.#t.keys())b.push(k);return b}async addCapacity(b){for(let k=0;k{try{const Z=await H.createSyncAccessHandle();if(this.#r.set(Z,W),b)Z.truncate(q),this.setAssociatedPath(Z,"",0);else{const E=this.getAssociatedPath(Z);E?this.#t.set(E,Z):this.#s.add(Z)}}catch(Z){throw this.storeErr(Z),this.releaseAccessHandles(),Z}}))}getAssociatedPath(b){b.read(this.#n,{at:0});const k=this.#c.getUint32(A);if(this.#n[0]&&(k&o.SQLITE_OPEN_DELETEONCLOSE||(k&w)===0))return d(`Removing file with unexpected flags ${k.toString(16)}`,this.#n),this.setAssociatedPath(b,"",0),"";const W=new Uint32Array(Q/4);b.read(W,{at:D});const H=this.computeDigest(this.#n,k);if(W.every((Z,E)=>Z===H[E])){const Z=this.#n.findIndex(E=>E===0);return Z===0&&b.truncate(q),Z?S.decode(this.#n.subarray(0,Z)):""}else return d("Disassociating file with bad digest."),this.setAssociatedPath(b,"",0),""}setAssociatedPath(b,k,W){const H=L.encodeInto(k,this.#n);R<=H.written+1&&n("Path too long:",k),k&&W&&(W|=x),this.#n.fill(0,H.written,R),this.#c.setUint32(A,W);const Z=this.computeDigest(this.#n,W);b.write(this.#n,{at:0}),b.write(Z,{at:D}),b.flush(),k?(this.#t.set(k,b),this.#s.delete(b)):(b.truncate(q),this.#s.add(b))}computeDigest(b,k){if(k&x){let W=3735928559,H=1103547991;for(const Z of b)W=Math.imul(W^Z,2654435761),H=Math.imul(H^Z,104729);return new Uint32Array([W>>>0,H>>>0])}else return new Uint32Array([0,0])}async reset(b){await this.isReady;let k=await navigator.storage.getDirectory(),W;for(const H of this.vfsDir.split("/"))H&&(W=k,k=await k.getDirectoryHandle(H,{create:!0}));return this.#e=k,this.#a=W,this.#o=await this.#e.getDirectoryHandle(N,{create:!0}),this.releaseAccessHandles(),this.acquireAccessHandles(b)}getPath(b){return g.isPtr(b)&&(b=g.cstrToJs(b)),(b instanceof URL?b:new URL(b,"file://localhost/")).pathname}deletePath(b){const k=this.#t.get(b);return k&&(this.#t.delete(b),this.setAssociatedPath(k,"",0)),!!k}storeErr(b,k){return b&&(b.sqlite3Rc=k||o.SQLITE_IOERR,this.error(b)),this.$error=b,k}popErr(){const b=this.$error;return this.$error=void 0,b}nextAvailableSAH(){const[b]=this.#s.keys();return b}getOFileForS3File(b){return this.#l.get(b)}mapS3FileToOFile(b,k){k?(this.#l.set(b,k),_(b,this)):(this.#l.delete(b),_(b,!1))}hasFilename(b){return this.#t.has(b)}getSAHForPath(b){return this.#t.get(b)}async removeVfs(){if(!this.#i.pointer||!this.#o)return!1;o.sqlite3_vfs_unregister(this.#i.pointer),this.#i.dispose(),delete s[this.vfsName];try{this.releaseAccessHandles(),await this.#e.removeEntry(N,{recursive:!0}),this.#o=void 0,await this.#a.removeEntry(this.#e.name,{recursive:!0}),this.#e=this.#a=void 0}catch(b){t.config.error(this.vfsName,"removeVfs() failed with no recovery strategy:",b)}return!0}pauseVfs(){return this.#l.size>0&&t.SQLite3Error.toss(o.SQLITE_MISUSE,"Cannot pause VFS",this.vfsName,"because it has opened files."),this.#r.size>0&&(o.sqlite3_vfs_unregister(this.vfsName),this.releaseAccessHandles()),this}isPaused(){return this.#r.size===0}async unpauseVfs(){return this.#r.size===0?this.acquireAccessHandles(!1).then(()=>o.sqlite3_vfs_register(this.#i,0),this):this}exportFile(b){const k=this.#t.get(b)||n("File not found:",b),W=k.getSize()-q,H=new Uint8Array(W>0?W:0);if(W>0){const Z=k.read(H,{at:q});Z!=W&&n("Expected to read "+W+" bytes but read "+Z+".")}return H}async importDbChunked(b,k){const W=this.#t.get(b)||this.nextAvailableSAH()||n("No available handles to import to.");W.truncate(0);let H=0,Z,E=!1;try{for(;(Z=await k())!==void 0;)Z instanceof ArrayBuffer&&(Z=new Uint8Array(Z)),H===0&&Z.byteLength>=15&&(p.affirmDbHeader(Z),E=!0),W.write(Z,{at:q+H}),H+=Z.byteLength;if((H<512||H%512!==0)&&n("Input size",H,"is not correct for an SQLite database."),!E){const C=new Uint8Array(20);W.read(C,{at:0}),p.affirmDbHeader(C)}W.write(new Uint8Array([1,1]),{at:q+18})}catch(C){throw this.setAssociatedPath(W,"",0),C}return this.setAssociatedPath(W,b,o.SQLITE_OPEN_MAIN_DB),H}importDb(b,k){if(k instanceof ArrayBuffer)k=new Uint8Array(k);else if(k instanceof Function)return this.importDbChunked(b,k);const W=this.#t.get(b)||this.nextAvailableSAH()||n("No available handles to import to."),H=k.byteLength;(H<512||H%512!=0)&&n("Byte array size is invalid for an SQLite db.");const Z="SQLite format 3";for(let C=0;Cthis)}isPaused(){return this.#e.isPaused()}}const ie=async()=>{const j=await navigator.storage.getDirectory(),b=".opfs-sahpool-sync-check-"+P(),H=(await(await j.getFileHandle(b,{create:!0})).createSyncAccessHandle()).close();return await H,await j.removeEntry(b),H?.then&&n("The local OPFS API is too old for opfs-sahpool:","it has an async FileSystemSyncAccessHandle.close() method."),!0};t.installOpfsSAHPoolVfs=async function(j=Object.create(null)){j=Object.assign(Object.create(null),$,j||{});const b=j.name;if(j.$testThrowPhase1)throw j.$testThrowPhase1;if(s[b])try{return await s[b]}catch(k){if(j.forceReinitIfPreviouslyFailed)delete s[b];else throw k}return!globalThis.FileSystemHandle||!globalThis.FileSystemDirectoryHandle||!globalThis.FileSystemFileHandle||!globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle||!navigator?.storage?.getDirectory?s[b]=Promise.reject(new Error("Missing required OPFS APIs.")):s[b]=ie().then(async function(){if(j.$testThrowPhase2)throw j.$testThrowPhase2;const k=new ne(j);return k.isReady.then(async()=>{const W=new se(k);if(t.oo1){const H=t.oo1,Z=k.getVfs(),E=function(...C){const M=H.DB.dbCtorHelper.normalizeArgs(...C);M.vfs=Z.$zName,H.DB.dbCtorHelper.call(this,M)};E.prototype=Object.create(H.DB.prototype),W.OpfsSAHPoolDb=E}return k.log("VFS initialized."),W}).catch(async W=>{throw await k.removeVfs().catch(()=>{}),W})}).catch(k=>s[b]=Promise.reject(k))}}),typeof i<"u"){const t=Object.assign(Object.create(null),{exports:typeof h>"u"?i.asm:h,memory:i.wasmMemory},globalThis.sqlite3ApiConfig||{});globalThis.sqlite3ApiConfig=t;let n;try{n=globalThis.sqlite3ApiBootstrap()}catch(r){throw console.error("sqlite3ApiBootstrap() error:",r),r}finally{delete globalThis.sqlite3ApiBootstrap,delete globalThis.sqlite3ApiConfig}i.sqlite3=n}else console.warn("This is not running in an Emscripten module context, so","globalThis.sqlite3ApiBootstrap() is _not_ being called due to lack","of config info for the WASM environment.","It must be called manually.")},fe=Oe,fe}})();const Yn=(function(){const qe=ft;if(!qe)throw new Error("Expecting globalThis.sqlite3InitModule to be defined by the Emscripten build.");const oe=globalThis.sqlite3InitModuleState=Object.assign(Object.create(null),{moduleScript:globalThis?.document?.currentScript,isWorker:typeof WorkerGlobalScope<"u",location:globalThis.location,urlParams:globalThis?.location?.href?new URL(globalThis.location.href).searchParams:new URLSearchParams});if(oe.debugModule=oe.urlParams.has("sqlite3.debugModule")?(...fe)=>console.warn("sqlite3.debugModule:",...fe):()=>{},oe.urlParams.has("sqlite3.dir"))oe.sqlite3Dir=oe.urlParams.get("sqlite3.dir")+"/";else if(oe.moduleScript){const fe=oe.moduleScript.src.split("/");fe.pop(),oe.sqlite3Dir=fe.join("/")+"/"}if(globalThis.sqlite3InitModule=function fe(...i){return qe(...i).then(ye=>{ye.runSQLite3PostLoadInit(ye);const be=ye.sqlite3;be.scriptInfo=oe,fe.__isUnderTest&&(be.__isUnderTest=!0);const Oe=be.asyncPostInit;return delete be.asyncPostInit,Oe()}).catch(ye=>{throw console.error("Exception loading sqlite3 module:",ye),ye})},globalThis.sqlite3InitModule.ready=qe.ready,globalThis.sqlite3InitModuleState.moduleScript){const fe=globalThis.sqlite3InitModuleState;let i=fe.moduleScript.src.split("/");i.pop(),fe.scriptDir=i.join("/")+"/"}return oe.debugModule("sqlite3InitModuleState =",oe),globalThis.sqlite3InitModule})();ft=Yn;var Zn=ft;globalThis.sqlite3Worker1Promiser=function qe(oe=qe.defaultConfig){if(arguments.length===1&&typeof arguments[0]=="function"){const re=oe;oe=Object.assign(Object.create(null),qe.defaultConfig),oe.onready=re}else oe=Object.assign(Object.create(null),qe.defaultConfig,oe);const fe=Object.create(null),i=function(){},ye=oe.onerror||i,be=oe.debug||i,Oe=oe.generateMessageId?void 0:Object.create(null),Xe=oe.generateMessageId||function(re){return re.type+"#"+(Oe[re.type]=(Oe[re.type]||0)+1)},Ce=(...re)=>{throw new Error(re.join(" "))};oe.worker||(oe.worker=qe.defaultConfig.worker),typeof oe.worker=="function"&&(oe.worker=oe.worker());let Pe,He;return oe.worker.onmessage=function(re){re=re.data,be("worker1.onmessage",re);let me=fe[re.messageId];if(!me){if(re&&re.type==="sqlite3-api"&&re.result==="worker1-ready"){oe.onready&&oe.onready(He);return}if(me=fe[re.type],me&&me.onrow){me.onrow(re);return}oe.onunhandled?oe.onunhandled(arguments[0]):ye("sqlite3Worker1Promiser() unhandled worker message:",re);return}switch(delete fe[re.messageId],re.type){case"error":me.reject(re);return;case"open":Pe||(Pe=re.dbId);break;case"close":re.dbId===Pe&&(Pe=void 0);break}try{me.resolve(re)}catch(Ie){me.reject(Ie)}},He=function(){let re;arguments.length===1?re=arguments[0]:arguments.length===2?(re=Object.create(null),re.type=arguments[0],re.args=arguments[1],re.dbId=re.args.dbId):Ce("Invalid arguments for sqlite3Worker1Promiser()-created factory."),!re.dbId&&re.type!=="open"&&(re.dbId=Pe),re.messageId=Xe(re),re.departureTime=performance.now();const me=Object.create(null);me.message=re;let Ie;re.type==="exec"&&re.args&&(typeof re.args.callback=="function"?(Ie=re.messageId+":row",me.onrow=re.args.callback,re.args.callback=Ie,fe[Ie]=me):typeof re.args.callback=="string"&&Ce("exec callback may not be a string when using the Promise interface."));let De=new Promise(function(je,Ve){me.resolve=je,me.reject=Ve,fe[re.messageId]=me,be("Posting",re.type,"message to Worker dbId="+(Pe||"default")+":",re),oe.worker.postMessage(re)});return Ie&&(De=De.finally(()=>delete fe[Ie])),De}};globalThis.sqlite3Worker1Promiser.defaultConfig={worker:function(){return new Worker(new URL("/assets/sqlite3-worker1-bundler-friendly-CqPDHTTx.js",import.meta.url),{type:"module"})},onerror:(...qe)=>console.error("worker1 promiser error",...qe)};sqlite3Worker1Promiser.v2=(function(qe){let oe;typeof qe=="function"?(oe=qe,qe={}):typeof qe?.onready=="function"&&(oe=qe.onready,delete qe.onready);const fe=Object.create(null);qe=Object.assign(qe||Object.create(null),{onready:async function(ye){try{oe&&await oe(ye),fe.resolve(ye)}catch(be){fe.reject(be)}}});const i=new Promise(function(ye,be){fe.resolve=ye,fe.reject=be});try{this.original(qe)}catch(ye){fe.reject(ye)}return i}).bind({original:sqlite3Worker1Promiser});sqlite3Worker1Promiser.v2;const er="japanese_app.db";let Ae=null;self.onmessage=async qe=>{const{type:oe,id:fe,sql:i,params:ye}=qe.data;try{switch(oe){case"start":{if(Ae!=null){self.postMessage({type:"success",id:fe,data:null});return}const be=await Zn({print:console.log,printErr:console.error}),Oe="/"+er;Ae=new be.oo1.OpfsDb(Oe,"rwt"),Ae.exec("PRAGMA foreign_keys = ON;"),self.postMessage({type:"success",id:fe,data:null});break}case"query":{if(Ae===null)throw new Error("БД не инициализирована");const be=Ae.selectObjects(i,ye??[]);self.postMessage({type:"success",id:fe,data:be});break}case"command":{if(Ae===null)throw new Error("БД не инициализирована");Ae.exec(i,ye??[]),self.postMessage({type:"success",id:fe,data:null});break}case"close":{if(Ae===null)throw new Error("БД не инициализирована");Ae.close(),Ae=null,self.postMessage({type:"success",id:fe,data:null});break}}}catch(be){console.error(be),self.postMessage({type:"error",error:be?.message??String(be),id:fe})}}; diff --git a/dist/assets/index-17GvxYKC.js b/dist/assets/index-17GvxYKC.js deleted file mode 100644 index 86ac3e2..0000000 --- a/dist/assets/index-17GvxYKC.js +++ /dev/null @@ -1,45 +0,0 @@ -(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))u(s);new MutationObserver(s=>{for(const l of s)if(l.type==="childList")for(const h of l.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&u(h)}).observe(document,{childList:!0,subtree:!0});function i(s){const l={};return s.integrity&&(l.integrity=s.integrity),s.referrerPolicy&&(l.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?l.credentials="include":s.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function u(s){if(s.ep)return;s.ep=!0;const l=i(s);fetch(s.href,l)}})();const vt="japanese_app.db";async function wt(){return navigator.storage.getDirectory()}async function gn(r){const i=await(await wt()).getFileHandle(vt,{create:!0}),u=i.createSyncAccessHandle;if(typeof u=="function")try{const l=await u.call(i);try{l.truncate(0),l.write(r,{at:0}),l.flush()}finally{l.close()}return}catch{}const s=await i.createWritable();try{await s.truncate(0);const l=new Uint8Array(r.length);l.set(r),await s.write(l)}finally{await s.close()}}async function vn(){const r=await wt();let n;try{n=await r.getFileHandle(vt)}catch{throw new Error("Локальная база не найдена — сначала скачай сохранение")}const i=await n.getFile();if(i.size===0)throw new Error("Локальная база пуста");return new Uint8Array(await i.arrayBuffer())}async function Se(){try{return(await(await(await wt()).getFileHandle(vt)).getFile()).size>0}catch{return!1}}var wn=ArrayBuffer,L=Uint8Array,Ye=Uint16Array,yn=Int16Array,De=Int32Array,ut=function(r,n,i){if(L.prototype.slice)return L.prototype.slice.call(r,n,i);(n==null||n<0)&&(n=0),(i==null||i>r.length)&&(i=r.length);var u=new L(i-n);return u.set(r.subarray(n,i)),u},$e=function(r,n,i,u){if(L.prototype.fill)return L.prototype.fill.call(r,n,i,u);for((i==null||i<0)&&(i=0),(u==null||u>r.length)&&(u=r.length);ir.length)&&(u=r.length);i2046MB)","invalid block type","FSE accuracy too high","match distance too far back","unexpected EOF"],I=function(r,n,i){var u=new Error(n||bn[r]);if(u.code=r,Error.captureStackTrace&&Error.captureStackTrace(u,I),!i)throw u;return u},Yt=function(r,n,i){for(var u=0,s=0;u>>0},Cn=function(r,n){var i=r[0]|r[1]<<8|r[2]<<16;if(i==3126568&&r[3]==253){var u=r[4],s=u>>5&1,l=u>>2&1,h=u&3,g=u>>6;u&8&&I(0);var y=6-s,E=h==3?4:h,U=Yt(r,y,E);y+=E;var k=g?1<>3);m=x+(x>>3)*(r[5]&7)}m>2145386496&&I(1);var w=new L((n==1?F||m:n?0:m)+12);return w[0]=1,w[4]=4,w[8]=8,{b:y+k,y:0,l:0,d:U,w:n&&n!=1?n:w.subarray(12),e:m,o:new De(w.buffer,0,3),u:F,c:l,m:Math.min(131072,m)}}else if((i>>4|r[3]<<20)==25481893)return Un(r,4)+8;I(0)},me=function(r){for(var n=0;1<i&&I(3);for(var l=1<0;){var X=me(h+1),J=u>>3,se=(1<>(u&7)&se,b=(1<b&&(R-=V)),F[++g]=--R,R==-1?(h+=R,$[--U]=g):h-=R,!R)do{var te=u>>3;y=(r[te]|r[te+1]<<8)>>(u&7)&3,u+=2,g+=y}while(y==3)}(g>255||h)&&I(0);for(var Y=0,re=(l>>1)+(l>>3)+3,ne=l-1,G=0;G<=g;++G){var N=F[G];if(N<1){m[G]=-N;continue}for(E=0;E=U)}}for(Y&&I(0),E=0;E>3,{b:s,s:$,n:D,t:x}]},Mn=function(r,n){var i=0,u=-1,s=new L(292),l=r[n],h=s.subarray(0,256),g=s.subarray(256,268),y=new Ye(s.buffer,268);if(l<128){var E=Te(r,n+1,6),U=E[0],k=E[1];n+=l;var F=U<<3,m=r[n];m||I(0);for(var x=0,w=0,$=k.b,D=$,X=(++n<<3)-8+me(m);X-=$,!(X>3;if(x+=(r[J]|r[J+1]<<8)>>(X&7)&(1<<$)-1,h[++u]=k.s[x],X-=D,X>3,w+=(r[J]|r[J+1]<<8)>>(X&7)&(1<255&&I(0)}else{for(u=l-127;i>4,h[i+1]=se&15}++n}var R=0;for(i=0;i11&&I(0),R+=b&&1<0;--i){var G=y[i];$e(ne,i,G,y[i-1]=G+g[i]*(1<g&&k>3,m=(r[F]|r[F+1]<<8|r[F+2]<<16)>>(U&7);y=(y<>2,h=l<<1,g=l+h;Pe(r.subarray(u,u+=r[0]|r[1]<<8),n.subarray(0,l),i),Pe(r.subarray(u,u+=r[2]|r[3]<<8),n.subarray(l,h),i),Pe(r.subarray(u,u+=r[4]|r[5]<<8),n.subarray(h,g),i),Pe(r.subarray(u),n.subarray(g),i)},Hn=function(r,n,i){var u,s=n.b,l=r[s],h=l>>1&3;n.l=l&1;var g=l>>3|r[s+1]<<5|r[s+2]<<13,y=(s+=3)+g;if(h==1)return s>=r.length?void 0:(n.b=s+1,i?($e(i,r[s],n.y,n.y+=g),i):$e(new L(g),r[s]));if(!(y>r.length)){if(h==0)return n.b=y,i?(i.set(r.subarray(s,y),n.y),n.y+=g,i):ut(r,s,y);if(h==2){var E=r[s],U=E&3,k=E>>2&3,F=E>>4,m=0,x=0;U<2?k&1?F|=r[++s]<<4|(k&2&&r[++s]<<12):F=E>>3:(x=k,k<2?(F|=(r[++s]&63)<<4,m=r[s]>>6|r[++s]<<2):k==2?(F|=r[++s]<<4|(r[++s]&3)<<12,m=r[s]>>2|r[++s]<<6):(F|=r[++s]<<4|(r[++s]&63)<<12,m=r[s]>>6|r[++s]<<2|r[++s]<<10)),++s;var w=i?i.subarray(n.y,n.y+n.m):new L(n.m),$=w.length-F;if(U==0)w.set(r.subarray(s,s+=F),$);else if(U==1)$e(w,r[s++],$);else{var D=n.h;if(U==2){var X=Mn(r,s);m+=s-(s=X[0]),n.h=D=X[1]}else D||I(0);(x?Nn:Pe)(r.subarray(s,s+=m),w.subarray($),D)}var J=r[s++];if(J){J==255?J=(r[s++]|r[s++]<<8)+32512:J>127&&(J=J-128<<8|r[s++]);var se=r[s++];se&3&&I(0);for(var R=[En,xn,Qn],b=2;b>-1;--b){var V=se>>(b<<1)+2&3;if(V==1){var Z=new L([0,0,r[s++]]);R[b]={s:Z.subarray(2,3),n:Z.subarray(0,1),t:new Ye(Z.buffer,0,1),b:0}}else V==2?(u=Te(r,s,9-(b&1)),s=u[0],R[b]=u[1]):V==3&&(n.t||I(0),R[b]=n.t[b])}var te=n.t=R,Y=te[0],re=te[1],ne=te[2],G=r[y-1];G||I(0);var N=(y<<3)-8+me(G)-ne.b,C=N>>3,S=0,j=(r[C]|r[C+1]<<8)>>(N&7)&(1<>3;var de=(r[C]|r[C+1]<<8)>>(N&7)&(1<>3;var q=(r[C]|r[C+1]<<8)>>(N&7)&(1<>3;var he=1<>>(N&7)&he-1);C=(N-=ft[Ce])>>3;var ae=Fn[Ce]+((r[C]|r[C+1]<<8|r[C+2]<<16)>>(N&7)&(1<>3;var pe=kn[Ue]+((r[C]|r[C+1]<<8|r[C+2]<<16)>>(N&7)&(1<>3,j=ne.t[j]+((r[C]|r[C+1]<<8)>>(N&7)&(1<>3,q=Y.t[q]+((r[C]|r[C+1]<<8)>>(N&7)&(1<>3,de=re.t[de]+((r[C]|r[C+1]<<8)>>(N&7)&(1<3)n.o[2]=n.o[1],n.o[1]=n.o[0],n.o[0]=W-=3;else{var be=W-(pe!=0);be?(W=be==3?n.o[0]-1:n.o[be],be>1&&(n.o[2]=n.o[1]),n.o[1]=n.o[0],n.o[0]=W):W=n.o[0]}for(var b=0;bae&&(A=ae);for(var b=0;b{throw e},u,s=console.log.bind(console),l=console.error.bind(console),h,g=!1,y,E=t=>t.startsWith("file://"),U=!1;function k(){return Ve.buffer}function F(){if(!Z?.buffer?.resizable){var t=k();Z=new Int8Array(t),Re=new Int16Array(t),n.HEAPU8=j=new Uint8Array(t),Ee=new Uint16Array(t),Ke=new Int32Array(t),q=new Uint32Array(t),Pt=new Float32Array(t),$t=new Float64Array(t),bt=new BigInt64Array(t),Ut=new BigUint64Array(t)}}function m(){U=!0,Fe.A()}function x(t){t=`Aborted(${t})`,l(t),g=!0,t+=". Build with -sASSERTIONS for more info.",U&&Rt();var e=new WebAssembly.RuntimeError(t);throw e}var w;let $=()=>"";function D(t){if(t==w&&h)return new Uint8Array(h);throw"both async and sync fetching of the wasm failed"}async function X(t){if(!h)try{var e=await u(t);return new Uint8Array(e)}catch{}return D(t)}async function J(t,e){try{var a=await X(t),o=await WebAssembly.instantiate(a,e);return o}catch(c){l(`failed to asynchronously prepare wasm: ${c}`),x(c)}}async function se(t,e,a){if(!t&&!E(e))try{var o=fetch(e,{credentials:"same-origin"}),c=await WebAssembly.instantiateStreaming(o,a);return c}catch(d){l(`wasm streaming compile failed: ${d}`),l("falling back to ArrayBuffer instantiation")}return J(e,a)}function R(){var t={a:fn};return t}async function b(){function t(d){return Fe=d.exports,pn(Fe),F(),Fe}function e(d){return t(d.instance)}var a=R();w??=$();var o=await se(h,w,a),c=e(o);return c}class V{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var Z,te=()=>Vt,Y=t=>{var e=t.getArg(te(),0);return zt(e)},re=()=>Xt(),ne=t=>Kt(t),G=t=>It(t),N=globalThis.TextDecoder&&new TextDecoder,C=(t,e,a,o)=>{var c=e+a;if(o)return c;for(;t[e]&&!(e>=c);)++e;return e},S=(t,e=0,a,o)=>{var c=C(t,e,a,o);if(c-e>16&&t.buffer&&N)return N.decode(t.subarray(e,c));for(var d="";e>10,56320|M&1023)}}return d},j,de=(t,e,a)=>t?S(j,t,e,a):"",q,Ue=t=>{var e=re(),a=G(4),o=G(4);Ot(t,a,o);var c=q[a>>2],d=q[o>>2],p=de(c);ce(c);var f;return d&&(f=de(d),ce(d)),ne(e),[p,f]},Le=t=>{var e=Y(t);return Ue(e)},Ce=t=>{var e=new WebAssembly.Exception(te(),[t],{traceStack:!0});throw e.message=Le(e),e},Je=()=>x(""),ve={},Me=t=>{for(;t.length;){var e=t.pop(),a=t.pop();a(e)}};function he(t){return this.fromWireType(q[t>>2])}var W={},ae={},pe={};class be extends Error{constructor(e){super(e),this.name="InternalError"}}var ue=t=>{throw new be(t)},A=(t,e,a)=>{t.forEach(f=>pe[f]=e);function o(f){var v=a(f);v.length!==t.length&&ue("Mismatched type converter count");for(var M=0;M{c[f]=ae[v],++p,p===d.length&&o(c)}));d.length===0&&o(c)},Ge=t=>{var e=ve[t];delete ve[t];var a=e.rawConstructor,o=e.rawDestructor,c=e.fields,d=c.map(p=>p.getterReturnType).concat(c.map(p=>p.setterArgumentType));A([t],d,p=>{var f={};for(var[v,M]of c.entries()){let Q=p[v],T=M.getter,P=M.getterContext,_=p[v+c.length],z=M.setter,ee=M.setterContext;f[M.fieldName]={read:O=>Q.fromWireType(T(P,O)),write:(O,K)=>{var ge=[];z(ee,O,_.toWireType(ge,K)),Me(ge)},optional:Q.optional}}return[{name:e.name,fromWireType:Q=>{var T={};for(var P in f)T[P]=f[P].read(Q);return o(Q),T},toWireType:(Q,T)=>{for(var P in f)if(!(P in T)&&!f[P].optional)throw new TypeError(`Missing field: "${P}"`);var _=a();for(P in f)f[P].write(_,T[P]);return Q!==null&&Q.push(o,_),_},readValueFromPointer:he,destructorFunction:o}]})},B=t=>{for(var e="";;){var a=j[t++];if(!a)return e;e+=String.fromCharCode(a)}};class Qe extends Error{constructor(e){super(e),this.name="BindingError"}}var H=t=>{throw new Qe(t)};function nr(t,e,a={}){var o=e.name;if(t||H(`type "${o}" must have a positive integer typeid pointer`),ae.hasOwnProperty(t)){if(a.ignoreDuplicateRegistrations)return;H(`Cannot register type '${o}' twice`)}if(ae[t]=e,delete pe[t],W.hasOwnProperty(t)){var c=W[t];delete W[t],c.forEach(d=>d())}}function le(t,e,a={}){return nr(t,e,a)}var Re,Ee,Ke,bt,Ut,Ct=(t,e,a)=>{switch(e){case 1:return a?o=>Z[o]:o=>j[o];case 2:return a?o=>Re[o>>1]:o=>Ee[o>>1];case 4:return a?o=>Ke[o>>2]:o=>q[o>>2];case 8:return a?o=>bt[o>>3]:o=>Ut[o>>3];default:throw new TypeError(`invalid integer width (${e}): ${t}`)}},ar=(t,e,a,o,c)=>{e=B(e);let d=o===0n,p=f=>f;if(d){let f=a*8;p=v=>BigInt.asUintN(f,v),c=p(c)}le(t,{name:e,fromWireType:p,toWireType:(f,v)=>(typeof v=="number"&&(v=BigInt(v)),v),readValueFromPointer:Ct(e,a,!d),destructorFunction:null})},ir=(t,e,a,o)=>{e=B(e),le(t,{name:e,fromWireType:function(c){return!!c},toWireType:function(c,d){return d?a:o},readValueFromPointer:function(c){return this.fromWireType(j[c])},destructorFunction:null})},or=t=>({count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType}),je=t=>{function e(a){return a.$$.ptrType.registeredClass.name}H(e(t)+" instance already deleted")},We=!1,Mt=t=>{},sr=t=>{t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)},Qt=t=>{t.count.value-=1;var e=t.count.value===0;e&&sr(t)},xe=t=>globalThis.FinalizationRegistry?(We=new FinalizationRegistry(e=>{Qt(e.$$)}),xe=e=>{var a=e.$$,o=!!a.smartPtr;if(o){var c={$$:a};We.register(e,c,e)}return e},Mt=e=>We.unregister(e),xe(t)):(xe=e=>e,t),ur=()=>{let t=Ie.prototype;Object.assign(t,{isAliasOf(a){if(!(this instanceof Ie)||!(a instanceof Ie))return!1;var o=this.$$.ptrType.registeredClass,c=this.$$.ptr;a.$$=a.$$;for(var d=a.$$.ptrType.registeredClass,p=a.$$.ptr;o.baseClass;)c=o.upcast(c),o=o.baseClass;for(;d.baseClass;)p=d.upcast(p),d=d.baseClass;return o===d&&c===p},clone(){if(this.$$.ptr||je(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var a=xe(Object.create(Object.getPrototypeOf(this),{$$:{value:or(this.$$)}}));return a.$$.count.value+=1,a.$$.deleteScheduled=!1,a},delete(){this.$$.ptr||je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&H("Object already scheduled for deletion"),Mt(this),Qt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||je(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&H("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}});let e=Symbol.dispose;e&&(t[e]=t.delete)};function Ie(){}var Et=(t,e)=>Object.defineProperty(e,"name",{value:t}),xt={},Ae=(t,e,a)=>{if(t[e].overloadTable===void 0){var o=t[e];t[e]=function(...c){return t[e].overloadTable.hasOwnProperty(c.length)||H(`Function '${a}' called with an invalid number of arguments (${c.length}) - expects one of (${t[e].overloadTable})!`),t[e].overloadTable[c.length].apply(this,c)},t[e].overloadTable=[],t[e].overloadTable[o.argCount]=o}},lr=(t,e,a)=>{n.hasOwnProperty(t)?(H(`Cannot register public name '${t}' twice`),Ae(n,t,t),n[t].overloadTable.hasOwnProperty(a)&&H(`Cannot register multiple overloads of a function with the same number of arguments (${a})!`),n[t].overloadTable[a]=e):(n[t]=e,n[t].argCount=a)},cr=48,dr=57,pr=t=>{t=t.replace(/[^a-zA-Z0-9_]/g,"$");var e=t.charCodeAt(0);return e>=cr&&e<=dr?`_${t}`:t};function fr(t,e,a,o,c,d,p,f){this.name=t,this.constructor=e,this.instancePrototype=a,this.rawDestructor=o,this.baseClass=c,this.getActualType=d,this.upcast=p,this.downcast=f,this.pureVirtualFunctions=[]}var et=(t,e,a)=>{for(;e!==a;)e.upcast||H(`Expected null or instance of ${a.name}, got an instance of ${e.name}`),t=e.upcast(t),e=e.baseClass;return t},tt=t=>{if(t===null)return"null";var e=typeof t;return e==="object"||e==="array"||e==="function"?t.toString():""+t};function hr(t,e){if(e===null)return this.isReference&&H(`null is not a valid ${this.name}`),0;e.$$||H(`Cannot pass "${tt(e)}" as a ${this.name}`),e.$$.ptr||H(`Cannot pass deleted object as a pointer of type ${this.name}`);var a=e.$$.ptrType.registeredClass,o=et(e.$$.ptr,a,this.registeredClass);return o}function gr(t,e){var a;if(e===null)return this.isReference&&H(`null is not a valid ${this.name}`),this.isSmartPointer?(a=this.rawConstructor(),t!==null&&t.push(this.rawDestructor,a),a):0;(!e||!e.$$)&&H(`Cannot pass "${tt(e)}" as a ${this.name}`),e.$$.ptr||H(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&e.$$.ptrType.isConst&&H(`Cannot convert argument of type ${e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name} to parameter type ${this.name}`);var o=e.$$.ptrType.registeredClass;if(a=et(e.$$.ptr,o,this.registeredClass),this.isSmartPointer)switch(e.$$.smartPtr===void 0&&H("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:e.$$.smartPtrType===this?a=e.$$.smartPtr:H(`Cannot convert argument of type ${e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:a=e.$$.smartPtr;break;case 2:if(e.$$.smartPtrType===this)a=e.$$.smartPtr;else{var c=e.clone();a=this.rawShare(a,at.toHandle(()=>c.delete())),t!==null&&t.push(this.rawDestructor,a)}break;default:H("Unsupported sharing policy")}return a}function vr(t,e){if(e===null)return this.isReference&&H(`null is not a valid ${this.name}`),0;e.$$||H(`Cannot pass "${tt(e)}" as a ${this.name}`),e.$$.ptr||H(`Cannot pass deleted object as a pointer of type ${this.name}`),e.$$.ptrType.isConst&&H(`Cannot convert argument of type ${e.$$.ptrType.name} to parameter type ${this.name}`);var a=e.$$.ptrType.registeredClass,o=et(e.$$.ptr,a,this.registeredClass);return o}var kt=(t,e,a)=>{if(e===a)return t;if(a.baseClass===void 0)return null;var o=kt(t,e,a.baseClass);return o===null?null:a.downcast(o)},wr={},yr=(t,e)=>{for(e===void 0&&H("ptr should not be undefined");t.baseClass;)e=t.upcast(e),t=t.baseClass;return e},mr=(t,e)=>(e=yr(t,e),wr[e]),Xe=(t,e)=>{(!e.ptrType||!e.ptr)&&ue("makeClassHandle requires ptr and ptrType");var a=!!e.smartPtrType,o=!!e.smartPtr;return a!==o&&ue("Both smartPtrType and smartPtr must be specified"),e.count={value:1},xe(Object.create(t,{$$:{value:e,writable:!0}}))};function br(t){var e=this.getPointee(t);if(!e)return this.destructor(t),null;var a=mr(this.registeredClass,e);if(a!==void 0){if(a.$$.count.value===0)return a.$$.ptr=e,a.$$.smartPtr=t,a.clone();var o=a.clone();return this.destructor(t),o}function c(){return this.isSmartPointer?Xe(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:e,smartPtrType:this,smartPtr:t}):Xe(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var d=this.registeredClass.getActualType(e),p=xt[d];if(!p)return c.call(this);var f;this.isConst?f=p.constPointerType:f=p.pointerType;var v=kt(e,this.registeredClass,f.registeredClass);return v===null?c.call(this):this.isSmartPointer?Xe(f.registeredClass.instancePrototype,{ptrType:f,ptr:v,smartPtrType:this,smartPtr:t}):Xe(f.registeredClass.instancePrototype,{ptrType:f,ptr:v})}var Ur=()=>{Object.assign(ze.prototype,{getPointee(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t},destructor(t){this.rawDestructor?.(t)},readValueFromPointer:he,fromWireType:br})};function ze(t,e,a,o,c,d,p,f,v,M,Q){this.name=t,this.registeredClass=e,this.isReference=a,this.isConst=o,this.isSmartPointer=c,this.pointeeType=d,this.sharingPolicy=p,this.rawGetPointee=f,this.rawConstructor=v,this.rawShare=M,this.rawDestructor=Q,!c&&e.baseClass===void 0?o?(this.toWireType=hr,this.destructorFunction=null):(this.toWireType=vr,this.destructorFunction=null):this.toWireType=gr}var Cr=(t,e,a)=>{n.hasOwnProperty(t)||ue("Replacing nonexistent public symbol"),n[t].overloadTable!==void 0&&a!==void 0?n[t].overloadTable[a]=e:(n[t]=e,n[t].argCount=a)},Mr=t=>Zt.get(t),oe=(t,e,a=!1)=>{t=B(t);function o(){var d=Mr(e);return d}var c=o();return typeof c!="function"&&H(`unknown function pointer with signature ${t}: ${e}`),c};class Qr extends Error{}var Er=t=>{var e=Lt(t),a=B(e);return ce(e),a},Oe=(t,e)=>{var a=[],o={};function c(d){if(!o[d]&&!ae[d]){if(pe[d]){pe[d].forEach(c);return}a.push(d),o[d]=!0}}throw e.forEach(c),new Qr(`${t}: `+a.map(Er).join([", "]))},xr=(t,e,a,o,c,d,p,f,v,M,Q,T,P)=>{Q=B(Q),d=oe(c,d),f&&=oe(p,f),M&&=oe(v,M),P=oe(T,P);var _=pr(Q);lr(_,function(){Oe(`Cannot construct ${Q} due to unbound types`,[o])}),A([t,e,a],o?[o]:[],z=>{z=z[0];var ee,O;o?(ee=z.registeredClass,O=ee.instancePrototype):O=Ie.prototype;var K=Et(Q,function(...st){if(Object.getPrototypeOf(this)!==ge)throw new Qe(`Use 'new' to construct ${Q}`);if(ie.constructor_body===void 0)throw new Qe(`${Q} has no accessible constructor`);var St=ie.constructor_body[st.length];if(St===void 0)throw new Qe(`Tried to invoke ctor of ${Q} with invalid number of parameters (${st.length}) - expected (${Object.keys(ie.constructor_body).toString()}) parameters instead!`);return St.apply(this,st)}),ge=Object.create(O,{constructor:{value:K}});K.prototype=ge;var ie=new fr(Q,K,ge,P,ee,d,f,M);ie.baseClass&&(ie.baseClass.__derivedClasses??=[],ie.baseClass.__derivedClasses.push(ie));var ot=new ze(Q,ie,!0,!1,!1),fe=new ze(Q+"*",ie,!1,!1,!1),Ze=new ze(Q+" const*",ie,!1,!0,!1);return xt[t]={pointerType:fe,constPointerType:Ze},Cr(_,K),[ot,fe,Ze]})};function kr(t){for(var e=1;e{for(var a=[],o=0;o>2]);return a},Ft=t=>{t=t.trim();let e=t.indexOf("(");return e===-1?t:t.slice(0,e)},Fr=(t,e,a,o,c,d,p,f,v)=>{var M=nt(a,o);e=B(e),e=Ft(e),d=oe(c,d,f),A([],[t],Q=>{Q=Q[0];var T=`${Q.name}.${e}`;function P(){Oe(`Cannot call ${T} due to unbound types`,M)}e.startsWith("@@")&&(e=Symbol[e.substring(2)]);var _=Q.registeredClass.constructor;return _[e]===void 0?(P.argCount=a-1,_[e]=P):(Ae(_,e,T),_[e].overloadTable[a-1]=P),A([],M,z=>{var ee=[z[0],null].concat(z.slice(1)),O=rt(T,ee,null,d,p);if(_[e].overloadTable===void 0?(O.argCount=a-1,_[e]=O):_[e].overloadTable[a-1]=O,Q.registeredClass.__derivedClasses)for(let K of Q.registeredClass.__derivedClasses)K.constructor.hasOwnProperty(e)||(K.constructor[e]=O);return[]}),[]})},Nr=(t,e,a,o,c,d)=>{var p=nt(e,a);c=oe(o,c),A([],[t],f=>{f=f[0];var v=`constructor ${f.name}`;if(f.registeredClass.constructor_body===void 0&&(f.registeredClass.constructor_body=[]),f.registeredClass.constructor_body[e-1]!==void 0)throw new Qe(`Cannot register multiple constructors with identical number of parameters (${e-1}) for class '${f.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return f.registeredClass.constructor_body[e-1]=()=>{Oe(`Cannot construct ${f.name} due to unbound types`,p)},A([],p,M=>(M.splice(1,0,null),f.registeredClass.constructor_body[e-1]=rt(v,M,null,c,d),[])),[]})},Hr=(t,e,a,o,c,d,p,f,v,M)=>{var Q=nt(a,o);e=B(e),e=Ft(e),d=oe(c,d,v),A([],[t],T=>{T=T[0];var P=`${T.name}.${e}`;e.startsWith("@@")&&(e=Symbol[e.substring(2)]),f&&T.registeredClass.pureVirtualFunctions.push(e);function _(){Oe(`Cannot call ${P} due to unbound types`,Q)}var z=T.registeredClass.instancePrototype,ee=z[e];return ee===void 0||ee.overloadTable===void 0&&ee.className!==T.name&&ee.argCount===a-2?(_.argCount=a-2,_.className=T.name,z[e]=_):(Ae(z,e,P),z[e].overloadTable[a-2]=_),A([],Q,O=>{var K=rt(P,O,T,d,p);return z[e].overloadTable===void 0?(K.argCount=a-2,z[e]=K):z[e].overloadTable[a-2]=K,[]}),[]})},Nt=[],we=[0,1,,1,null,1,!0,1,!1,1],Ht=[],Pr=t=>{if(t>9&&--we[t+1]===0){var e=we[t];we[t]=void 0;var a=Ht[t];a&&(Ht[t]=void 0,a(e)),Nt.push(t)}},at={toValue:t=>(t||H(`Cannot use deleted val. handle = ${t}`),we[t]),toHandle:t=>{switch(t){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let e=Nt.pop()||we.length;return we[e]=t,we[e+1]=1,e}}}},$r={name:"emscripten::val",fromWireType:t=>{var e=at.toValue(t);return Pr(t),e},toWireType:(t,e)=>at.toHandle(e),readValueFromPointer:he,destructorFunction:null},Tr=t=>le(t,$r),Pt,$t,_r=(t,e)=>{switch(e){case 4:return function(a){return this.fromWireType(Pt[a>>2])};case 8:return function(a){return this.fromWireType($t[a>>3])};default:throw new TypeError(`invalid float width (${e}): ${t}`)}},qr=(t,e,a)=>{e=B(e),le(t,{name:e,fromWireType:o=>o,toWireType:(o,c)=>c,readValueFromPointer:_r(e,a),destructorFunction:null})},Lr=(t,e,a,o,c)=>{e=B(e);let d=o===0,p=v=>v;if(d){var f=32-8*a;p=v=>v<>>f,c=p(c)}le(t,{name:e,fromWireType:p,toWireType:(v,M)=>M,readValueFromPointer:Ct(e,a,o!==0),destructorFunction:null})},Jr=(t,e,a)=>{var o=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],c=o[e];function d(p){var f=q[p>>2],v=q[p+4>>2];return new c(Z.buffer,v,f)}a=B(a),le(t,{name:a,fromWireType:d,readValueFromPointer:d},{ignoreDuplicateRegistrations:!0})},Rr=(t,e,a,o)=>{if(!(o>0))return 0;for(var c=a,d=a+o-1,p=0;p=d)break;e[a++]=f}else if(f<=2047){if(a+1>=d)break;e[a++]=192|f>>6,e[a++]=128|f&63}else if(f<=65535){if(a+2>=d)break;e[a++]=224|f>>12,e[a++]=128|f>>6&63,e[a++]=128|f&63}else{if(a+3>=d)break;e[a++]=240|f>>18,e[a++]=128|f>>12&63,e[a++]=128|f>>6&63,e[a++]=128|f&63,p++}}return e[a]=0,a-c},Tt=(t,e,a)=>Rr(t,j,e,a),_t=t=>{for(var e=0,a=0;a=55296&&o<=57343?(e+=4,++a):e+=3}return e},Kr=(t,e)=>{e=B(e),le(t,{name:e,fromWireType(a){var o=q[a>>2],c=a+4,d;return d=de(c,o,!0),ce(a),d},toWireType(a,o){o instanceof ArrayBuffer&&(o=new Uint8Array(o));var c,d=typeof o=="string";d||ArrayBuffer.isView(o)&&o.BYTES_PER_ELEMENT==1||H("Cannot pass non-string to std::string"),d?c=_t(o):c=o.length;var p=it(4+c+1),f=p+4;return q[p>>2]=c,d?Tt(o,f,c+1):j.set(o,f),a!==null&&a.push(ce,p),p},readValueFromPointer:he,destructorFunction(a){ce(a)}})},qt=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,Ir=(t,e,a)=>{var o=t>>1,c=C(Ee,o,e/2,a);if(c-o>16&&qt)return qt.decode(Ee.subarray(o,c));for(var d="",p=o;p{if(a<2)return 0;a-=2;for(var o=e,c=a>1]=p,e+=2}return Re[e>>1]=0,e-o},zr=t=>t.length*2,Or=(t,e,a)=>{for(var o="",c=t>>2,d=0;!(d>=e/4);d++){var p=q[c+d];if(!p&&!a)break;o+=String.fromCodePoint(p)}return o},Vr=(t,e,a=2147483647)=>{if(a<4)return 0;for(var o=e,c=o+a-4,d=0;d65535&&d++,Ke[e>>2]=p,e+=4,e+4>c)break}return Ke[e>>2]=0,e-o},Zr=t=>{for(var e=0,a=0;a65535&&a++,e+=4}return e},Sr=(t,e,a)=>{a=B(a);var o,c,d;e===2?(o=Ir,c=Xr,d=zr):(o=Or,c=Vr,d=Zr),le(t,{name:a,fromWireType:p=>{var f=q[p>>2],v=o(p+4,f*e,!0);return ce(p),v},toWireType:(p,f)=>{typeof f!="string"&&H(`Cannot pass non-string to C++ string type ${a}`);var v=d(f),M=it(4+v+e);return q[M>>2]=v/e,c(f,M+4,v+e),p!==null&&p.push(ce,M),M},readValueFromPointer:he,destructorFunction(p){ce(p)}})},Yr=(t,e,a,o,c,d)=>{ve[t]={name:B(e),rawConstructor:oe(a,o),rawDestructor:oe(c,d),fields:[]}},Br=(t,e,a,o,c,d,p,f,v,M)=>{ve[t].fields.push({fieldName:B(e),getterReturnType:a,getter:oe(o,c),getterContext:d,setterArgumentType:p,setter:oe(f,v),setterContext:M})},Dr=(t,e)=>{e=B(e),le(t,{isVoid:!0,name:e,fromWireType:()=>{},toWireType:(a,o)=>{}})},Gr=()=>{},ke={},jr=t=>{if(t instanceof V||t=="unwind")return y;i(1,t)},Wr=t=>{y=t,i(t,new V(t))},Ar=t=>{if(!g)try{return t()}catch(e){jr(e)}},en=()=>performance.now(),tn=(t,e)=>{if(ke[t]&&(clearTimeout(ke[t].id),delete ke[t]),!e)return 0;var a=setTimeout(()=>{delete ke[t],Ar(()=>Jt(t,en()))},e);return ke[t]={id:a,timeout_ms:e},0},rn=()=>2147483648,nn=(t,e)=>Math.ceil(t/e)*e,an=t=>{var e=Ve.buffer.byteLength,a=(t-e+65535)/65536|0;try{return Ve.grow(a),F(),1}catch{}},on=t=>{var e=j.length;t>>>=0;var a=rn();if(t>a)return!1;for(var o=1;o<=4;o*=2){var c=e*(1+.2/o);c=Math.min(c,t+100663296);var d=Math.min(a,nn(Math.max(t,c),65536)),p=an(d);if(p)return!0}return!1},sn=t=>52;function un(t,e,a,o){return 70}var ln=[null,[],[]],cn=(t,e)=>{var a=ln[t];!e||e===10?((t===1?s:l)(S(a)),a.length=0):a.push(e)},dn=(t,e,a,o)=>{for(var c=0,d=0;d>2],f=q[e+4>>2];e+=8;for(var v=0;v>2]=c,0};ur(),Ur(),n.wasmBinary&&(h=n.wasmBinary),n.UTF8ToString=de,n.stringToUTF8=Tt,n.lengthBytesUTF8=_t;var Lt,it,ce,Jt,Rt,Kt,It,Xt,zt,Ot,Vt,Ve,Zt;function pn(t){Lt=t.B,it=n._malloc=t.C,ce=n._free=t.D,Jt=t.F,Rt=t.G,Kt=t.H,It=t.I,Xt=t.J,zt=t.K,Ot=t.L,Ve=t.z,Zt=t.E,Vt=t.M}var fn={t:Ce,x:Je,f:Ge,i:ar,l:ir,o:xr,b:Fr,n:Nr,d:Hr,y:Tr,h:qr,c:Lr,a:Jr,k:Kr,g:Sr,j:Yr,e:Br,m:Dr,w:Gr,p:tn,u:on,s:sn,q:un,r:dn,v:Wr};async function hn(){!g&&m()}var Fe;return Fe=await b(),await hn(),n}var _n=Tn,qn=new Int8Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,90,63,64,65,66,-1,67,68,69,70,71,-1,72,73,52,53,54,55,56,57,58,59,60,61,74,75,76,77,78,79,80,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,81,-1,82,83,84,85,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,86,87,88,89,-1]);function Ln(r){let n=new Uint8Array(170930),i=0,u=0,s=0,l=-1;for(let h=0,g=r.length;h127)continue;let E=qn[y];if(!(E<0))if(l<0)l=E;else{l+=E*91,u|=l<88?13:14;do n[i++]=u,u>>>=8,s-=8;while(s>7);l=-1}}return l>=0&&(n[i++]=(u|l<""})}function Kn(){ht=void 0}var In=class{_module;constructor(r){this._module=r}malloc(r){let n=this._module._malloc(r);return{ptr:n,size:r,dispose:()=>this.free({ptr:n,size:r,dispose:()=>{}})}}free(r){this._module._free(r.ptr)}dataToHeap(r){let n=this.malloc(r.byteLength);return this._module.HEAPU8.set(r,n.ptr),n}heapView(r){return this._module.HEAPU8.subarray(r.ptr,r.ptr+r.size)}heapToUint8Array(r){return new Uint8Array([...this.heapView(r)])}lengthBytes(r){return this._module.lengthBytesUTF8(r)}stringToHeap(r){let n=this.lengthBytes(r)+1,i=this._module._malloc(n);return this._module.stringToUTF8(r,i,n),{ptr:i,size:n,dispose:()=>this.free({ptr:i,size:n,dispose:()=>{}})}}heapToString(r){return this._module.UTF8ToString(r.ptr,r.size)}hasFilesystem(){let r=this._module;return r.FS_createPath!==void 0&&r.FS_createDataFile!==void 0&&r.FS_preloadFile!==void 0&&r.FS_unlink!==void 0}createPath(r,n=!0,i=!0){return this._module.FS_createPath("/",r,n,i)}createDataFile(r,n,i=!0,u=!0,s=!0){return this._module.FS_createDataFile("/",r,n,i,u,s)}preloadFile(r,n,i=!0,u=!0,s=!1,l=!0,h=!1){return this._module.FS_preloadFile("/",r,n,i,u,s,l,h)}unlink(r){return this._module.FS_unlink(r)}},Ne,Xn=4294967295;function He(r,n){if(!Number.isInteger(r)||r<0||r>Xn)throw new Error(`${n} length ${r} is outside the WASM32-safe range`)}function lt(r){if(r.length===0)return new Uint8Array(0);if(r.length===1)return r[0];let n=0;for(let s of r)n+=s.length;let i=new Uint8Array(n),u=0;for(let s of r)i.set(s,u),u+=s.length;return i}var zn=class Wt{_mainModule;_zstdClass;_zstd;_compressionLevel;_decompressFrameCompleted=!1;_decompressRemaining=0;_decompressSawInput=!1;constructor(n){this._mainModule=new In(n),this._zstdClass=n.zstd,this._zstd=new this._zstdClass,this._compressionLevel=this._zstdClass.defaultCLevel()}static load(){return Ne||(Ne=Rn().then(n=>new Wt(n))),Ne}static unload(){Kn(),Ne?.then(n=>{n?._zstd?.delete()}),Ne=void 0}copyHeap(n){return this._mainModule.heapView(n).slice()}mallocChecked(n,i){He(n,i);let u=this._mainModule.malloc(n);if(!u.ptr)throw this._mainModule.free(u),new Error(`Failed to allocate ${n} bytes for ${i}`);return u}throwStreamError(n,i){throw new Error(`${n} failed: ${i.errorName||"unknown error"}`)}ensureStreamOk(n,i){i.error&&this.throwStreamError(n,i)}version(){return this._zstdClass.version()}reset(){let n=this._zstd.reset();this.ensureStreamOk("reset",n),this._decompressFrameCompleted=!1,this._decompressRemaining=0,this._decompressSawInput=!1}resetCompression(n){n!==void 0&&(this._compressionLevel=n);let i=this._zstd.resetCompression(this._compressionLevel);this.ensureStreamOk("resetCompression",i)}resetDecompression(){let n=this._zstd.resetDecompression();this.ensureStreamOk("resetDecompression",n),this._decompressFrameCompleted=!1,this._decompressRemaining=0,this._decompressSawInput=!1}setCompressionLevel(n){let i=this._zstd.setCompressionLevel(n);this.ensureStreamOk("setCompressionLevel",i),this._compressionLevel=n}compress(n,i=this.defaultCLevel()){He(n.length,"compress input");let u=this._mainModule.dataToHeap(n);try{if(!u.ptr&&n.length>0)throw new Error("Failed to allocate compress input buffer");let s=this._zstdClass.compressBound(n.length),l=this.mallocChecked(s,"compress output");try{if(l.size=this._zstdClass.compress(l.ptr,s,u.ptr,u.size,i),this._zstdClass.isError(l.size))throw new Error(`compress failed: ${this._zstdClass.getErrorName(l.size)}`);return this.copyHeap(l)}finally{this._mainModule.free(l)}}finally{this._mainModule.free(u)}}compressChunk(n){if(He(n.length,"compressChunk input"),n.length===0)return new Uint8Array(0);let i=this._mainModule.dataToHeap(n);try{if(!i.ptr)throw new Error("Failed to allocate compressChunk input buffer");let u=this._zstdClass.CStreamOutSize(),s=[],l=0;for(;l0&&(h.size=g.produced,s.push(this.copyHeap(h)))}finally{this._mainModule.free(h)}}return lt(s)}finally{this._mainModule.free(i)}}compressEnd(){let n=this._zstdClass.CStreamOutSize(),i=[],u=1;for(;u!==0;){let s=this.mallocChecked(n,"compressEnd output");try{let l=this._zstd.compressEnd(s.ptr,n);if(this.ensureStreamOk("compressEnd",l),l.produced===0&&l.remaining!==0)throw new Error("compressEnd failed: no progress while finishing stream");u=l.remaining,l.produced>0&&(s.size=l.produced,i.push(this.copyHeap(s)))}finally{this._mainModule.free(s)}}return lt(i)}frameContentSize(n){return this._zstdClass.getFrameContentSize(n.ptr,n.size)}decompress(n){He(n.length,"decompress input");let i=this._mainModule.dataToHeap(n);try{if(!i.ptr&&n.length>0)throw new Error("Failed to allocate decompress input buffer");let u=this.frameContentSize(i);if(u.error)throw new Error(`Failed to get frame content size: ${u.errorName}`);let s=u.known;if(s){let l=this._zstdClass.findFrameCompressedSize(i.ptr,i.size);if(this._zstdClass.isError(l))throw new Error(`Failed to find frame compressed size: ${this._zstdClass.getErrorName(l)}`);l0?i.ptr+l:0,U=this._zstd.decompressChunk(g.ptr,u,E,y);if(this.ensureStreamOk("decompressChunk",U),U.consumed===0&&U.produced===0){if(y===0){U.remaining>0&&(this._decompressRemaining=U.remaining);break}throw new Error("decompressChunk failed: no progress while consuming input")}l+=U.consumed,h=U.produced===u&&U.remaining!==0,U.produced>0&&(g.size=U.produced,s.push(this.copyHeap(g))),U.remaining===0?(this._decompressFrameCompleted=!0,this._decompressRemaining=0):this._decompressRemaining=U.remaining}finally{this._mainModule.free(g)}}return lt(s)}finally{this._mainModule.free(i)}}decompressEnd(){if(!this._decompressSawInput)throw new Error("decompressEnd failed: empty compressed input is not a completed frame");if(!this._decompressFrameCompleted||this._decompressRemaining!==0)throw new Error("decompressEnd failed: truncated Zstandard input")}defaultCLevel(){return this._zstdClass.defaultCLevel()}minCLevel(){return this._zstdClass.minCLevel()}maxCLevel(){return this._zstdClass.maxCLevel()}};let ct=null;function On(){return ct||(ct=zn.load()),ct}function Vn(r){return r.length>=4&&r[0]===40&&r[1]===181&&r[2]===47&&r[3]===253}function gt(r){const n="SQLite format 3\0";if(r.length -

🏠 Главная

-

Локальное сохранение и повторения — всё работает офлайн.

-
Проверка локальной базы…
-
- -
- - - `;const i=r.querySelector("#home-db-status"),u=r.querySelector("#btn-go-sync"),s=r.querySelector("#home-actions"),l=r.querySelector("#btn-start");u.addEventListener("click",()=>n.goSync()),l.addEventListener("click",()=>{i.textContent="Экран повторений — следующий шаг."}),(async()=>{if(!await Se()){i.textContent="Локальной базы нет. Скачай сохранение на странице «Синхронизация».",s.hidden=!0;return}try{const g=await vn(),y=gt(g);i.textContent=y?`Локальная база на месте: ${(g.length/1024).toFixed(1)} КБ, сигнатура SQLite OK.`:"Файл в OPFS есть, но это не похоже на SQLite — перекачай сохранение.",s.hidden=!y}catch(g){i.textContent=`Не удалось прочитать базу: ${g instanceof Error?g.message:String(g)}`,s.hidden=!0}})()}const Bt=24,Yn=/^[A-Za-z0-9]{24}$/,At="japlearn_sync_token";function Dt(r){return r.trim().replace(/\s+/g,"")}function ye(r){return Yn.test(r)}function Bn(){try{return localStorage.getItem(At)??""}catch{return""}}function dt(r){try{localStorage.setItem(At,r)}catch{}}const er="https://learning.micialware.ru";function Dn(r,n=er){return`${n.replace(/\/+$/,"")}/download/${encodeURIComponent(r)}`}async function Gn(r,n,i=er){const u=Dn(r,i);let s;try{s=await fetch(u,{method:"GET",...n})}catch(h){throw new Error(`Нет связи с сервером: ${h instanceof Error?h.message:String(h)}`)}if(!s.ok)throw s.status===404?new Error("Сохранение не найдено (404). Проверь токен."):new Error(`Сервер ответил ${s.status} ${s.statusText}`);const l=await s.arrayBuffer();if(l.byteLength===0)throw new Error("Сервер вернул пустой файл");return new Uint8Array(l)}function jn(r){r.innerHTML=` -
-

📡 Синхронизация

-

Токен сохранения — 24 символа: латинские буквы и цифры.

- - - -
- - 0 / 24 -
- -
- - -
- -

Введите токен из 24 символов

-
- `;const n=r.querySelector("#token-input"),i=r.querySelector("#token-error"),u=r.querySelector("#token-counter"),s=r.querySelector("#btn-download"),l=r.querySelector("#btn-upload"),h=r.querySelector("#status");function g(m){h.textContent=m,console.log(`[JapLearn] ${m}`)}function y(){return Dt(n.value)}function E(m){s.disabled=m||!ye(y()),l.disabled=!0,n.disabled=m,m||Se().then(x=>{!n.disabled&&ye(y())&&(l.disabled=!x)})}function U(){const m=y(),x=m.length;u.textContent=`${x} / ${Bt}`;const w=ye(m),$=x===0;n.classList.toggle("invalid",!$&&!w),n.setAttribute("aria-invalid",String(!$&&!w)),$?i.textContent="":x!==Bt?i.textContent=`Нужно 24 символа, сейчас ${x}`:i.textContent=w?"":"Только латинские буквы и цифры",s.disabled=!w,w?Se().then(D=>{n.disabled||(l.disabled=!D)}):l.disabled=!0}async function k(){const m=y();if(ye(m)){dt(m),E(!0),g("Скачивание сохранения...");try{const x=await Gn(m);g(`Скачано ${(x.length/1024).toFixed(1)} КБ, распаковка...`);const w=await Zn(x);g(`Распаковано ${(w.length/1024).toFixed(1)} КБ, сохранение в OPFS...`),await gn(w),g(`Готово: база ${(w.length/1024).toFixed(1)} КБ сохранена локально (OPFS).`)}catch(x){g(`Ошибка скачивания: ${x instanceof Error?x.message:String(x)}`)}finally{E(!1),U()}}}n.addEventListener("input",()=>{U()}),n.addEventListener("change",()=>{const m=y();n.value=m,ye(m)&&(dt(m),g("Токен сохранён локально. Можно скачивать или выгружать.")),U()}),s.addEventListener("click",()=>{k()}),l.addEventListener("click",()=>{const m=y();ye(m)&&(dt(m),g("Выгрузка — следующий шаг (POST /upload/stream/{id})."))});const F=Bn();F&&(n.value=F),U(),ye(Dt(F))&&Se().then(m=>{g(m?"Токен восстановлен, локальная база на месте.":"Токен восстановлен. Нажми «Скачать», чтобы получить базу."),U()})}const Wn={home:"Главная",sync:"Синхронизация"};function _e(r){const n=document.getElementById(r);if(!n)throw new Error(`[JapLearn] Не найден элемент #${r}`);return n}const tr=_e("burger-btn"),Be=_e("drawer"),rr=_e("drawer-overlay"),An=_e("page-title"),Gt=_e("page");let yt=!1;function qe(r){yt=r,Be.classList.toggle("open",r),rr.hidden=!r,tr.setAttribute("aria-expanded",String(r)),Be.setAttribute("aria-hidden",String(!r)),document.body.classList.toggle("drawer-open",r)}function ea(r){Be.querySelectorAll(".drawer-btn").forEach(n=>{n.classList.toggle("active",n.dataset.page===r)})}function mt(r){An.textContent=Wn[r],ea(r),r==="home"?Sn(Gt,{goSync:()=>mt("sync")}):jn(Gt)}tr.addEventListener("click",()=>{qe(!yt)});rr.addEventListener("click",()=>{qe(!1)});document.addEventListener("keydown",r=>{r.key==="Escape"&&yt&&qe(!1)});Be.querySelectorAll(".drawer-btn").forEach(r=>{r.addEventListener("click",()=>{const n=r.dataset.page;(n==="home"||n==="sync")&&mt(n),qe(!1)})});qe(!1);mt("home");console.log("[JapLearn] crossOriginIsolated =",window.crossOriginIsolated); diff --git a/dist/assets/index-BdLQfp0Z.js b/dist/assets/index-BdLQfp0Z.js new file mode 100644 index 0000000..909a145 --- /dev/null +++ b/dist/assets/index-BdLQfp0Z.js @@ -0,0 +1,60 @@ +(function(){const n=document.createElement("link").relList;if(n&&n.supports&&n.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))c(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const h of l.addedNodes)h.tagName==="LINK"&&h.rel==="modulepreload"&&c(h)}).observe(document,{childList:!0,subtree:!0});function i(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerPolicy&&(l.referrerPolicy=o.referrerPolicy),o.crossOrigin==="use-credentials"?l.credentials="include":o.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function c(o){if(o.ep)return;o.ep=!0;const l=i(o);fetch(o.href,l)}})();const _e=new Worker(new URL("/assets/db-worker-AHwpujSZ.js",import.meta.url),{type:"module"});let ir=0,Be=null;const De=new Map;function kn(){return Be||(Be=new Promise((r,n)=>{_e.onmessage=c=>{const o=c.data;if(o.type==="ready")return;const l=De.get(o.id);l&&(De.delete(o.id),o.type=="success"?l.resolve(o.data):l.reject(new Error(o.error??o.message??"Неизвестная ошибка Worker")))},_e.onerror=c=>{console.error("[SQLite Worker] Ошибка:",c),n(new Error("Ошибка Worker"))};const i=++ir;De.set(i,{resolve:r,reject:n}),_e.postMessage({type:"start",id:i})}),Be)}function $n(r,n){return new Promise((i,c)=>{if(!_e){c(new Error("Worker не создан"));return}const o=++ir;De.set(o,{resolve:i,reject:c}),_e.postMessage({type:r,id:o,...n})})}async function Ae(r,n){return await $n("query",{sql:r,params:n??[]})}function xn(r){if(r==null)return[];const n=String(r).trim();return n?n.split(/[,\s;]+/).map(i=>i.trim()).filter(i=>i.length>0):[]}function Qn(r){const n=new Map;if(r==null)return n;const i=String(r);if(!i)return n;const c=i.split("");for(let o=0;o+10?`WHERE ${n.join(" AND ")}`:"",params:i}}async function Nn(r={}){const{clause:n,params:i}=or(r),o=(await Ae(`SELECT COUNT(*) as cnt FROM words ${n}`,i))[0]?.cnt;return typeof o=="number"?o:Number(o??0)}async function Wt(r={}){const{clause:n,params:i}=or(r),c=Math.max(1,Math.min(r.limit??50,500)),o=Math.max(0,r.offset??0);return(await Ae(`SELECT id, key, value, tags, more, group_id FROM words ${n} ORDER BY id LIMIT ? OFFSET ?`,[...i,c,o])).map(Fn)}async function Tn(){return(await Ae("SELECT id, name FROM word_groups ORDER BY id")).map(n=>({id:Number(n.id),name:String(n.name??"")}))}async function Pn(){return(await Ae("SELECT id, name, identifier FROM custom_fields ORDER BY id")).map(n=>({id:Number(n.id),name:String(n.name??""),identifier:String(n.identifier??"")}))}const Ut="japanese_app.db";async function Ct(){return navigator.storage.getDirectory()}async function _n(r){r[18]=1,r[19]=1;const i=await(await Ct()).getFileHandle(Ut,{create:!0}),c=i.createSyncAccessHandle;if(typeof c=="function")try{const l=await c.call(i);try{l.truncate(0),l.write(r,{at:0}),l.flush()}finally{l.close()}return}catch{}const o=await i.createWritable();try{await o.truncate(0);const l=new Uint8Array(r.length);l.set(r),await o.write(l)}finally{await o.close()}}async function Hn(){const r=await Ct();let n;try{n=await r.getFileHandle(Ut)}catch{throw new Error("Локальная база не найдена — сначала скачай сохранение")}const i=await n.getFile();if(i.size===0)throw new Error("Локальная база пуста");return new Uint8Array(await i.arrayBuffer())}async function Ge(){try{return(await(await(await Ct()).getFileHandle(Ut)).getFile()).size>0}catch{return!1}}var qn=ArrayBuffer,z=Uint8Array,je=Uint16Array,Ln=Int16Array,et=Int32Array,ft=function(r,n,i){if(z.prototype.slice)return z.prototype.slice.call(r,n,i);(n==null||n<0)&&(n=0),(i==null||i>r.length)&&(i=r.length);var c=new z(i-n);return c.set(r.subarray(n,i)),c},He=function(r,n,i,c){if(z.prototype.fill)return z.prototype.fill.call(r,n,i,c);for((i==null||i<0)&&(i=0),(c==null||c>r.length)&&(c=r.length);ir.length)&&(c=r.length);i2046MB)","invalid block type","FSE accuracy too high","match distance too far back","unexpected EOF"],Y=function(r,n,i){var c=new Error(n||In[r]);if(c.code=r,Error.captureStackTrace&&Error.captureStackTrace(c,Y),!i)throw c;return c},At=function(r,n,i){for(var c=0,o=0;c>>0},Sn=function(r,n){var i=r[0]|r[1]<<8|r[2]<<16;if(i==3126568&&r[3]==253){var c=r[4],o=c>>5&1,l=c>>2&1,h=c&3,g=c>>6;c&8&&Y(0);var v=6-o,k=h==3?4:h,C=At(r,v,k);v+=k;var M=g?1<>3);y=N+(N>>3)*(r[5]&7)}y>2145386496&&Y(1);var w=new z((n==1?F||y:n?0:y)+12);return w[0]=1,w[4]=4,w[8]=8,{b:v+M,y:0,l:0,d:C,w:n&&n!=1?n:w.subarray(12),e:y,o:new et(w.buffer,0,3),u:F,c:l,m:Math.min(131072,y)}}else if((i>>4|r[3]<<20)==25481893)return Jn(r,4)+8;Y(0)},be=function(r){for(var n=0;1<i&&Y(3);for(var l=1<0;){var J=be(h+1),H=c>>3,te=(1<>(c&7)&te,b=(1<b&&(K-=B)),F[++g]=--K,K==-1?(h+=K,$[--C]=g):h-=K,!K)do{var G=c>>3;v=(r[G]|r[G+1]<<8)>>(c&7)&3,c+=2,g+=v}while(v==3)}(g>255||h)&&Y(0);for(var j=0,T=(l>>1)+(l>>3)+3,_=l-1,P=0;P<=g;++P){var U=F[P];if(U<1){y[P]=-U;continue}for(k=0;k=C)}}for(j&&Y(0),k=0;k>3,{b:o,s:$,n:D,t:N}]},Kn=function(r,n){var i=0,c=-1,o=new z(292),l=r[n],h=o.subarray(0,256),g=o.subarray(256,268),v=new je(o.buffer,268);if(l<128){var k=qe(r,n+1,6),C=k[0],M=k[1];n+=l;var F=C<<3,y=r[n];y||Y(0);for(var N=0,w=0,$=M.b,D=$,J=(++n<<3)-8+be(y);J-=$,!(J>3;if(N+=(r[H]|r[H+1]<<8)>>(J&7)&(1<<$)-1,h[++c]=M.s[N],J-=D,J>3,w+=(r[H]|r[H+1]<<8)>>(J&7)&(1<255&&Y(0)}else{for(c=l-127;i>4,h[i+1]=te&15}++n}var K=0;for(i=0;i11&&Y(0),K+=b&&1<0;--i){var P=v[i];He(_,i,P,v[i-1]=P+g[i]*(1<g&&M>3,y=(r[F]|r[F+1]<<8|r[F+2]<<16)>>(C&7);v=(v<>2,h=l<<1,g=l+h;Pe(r.subarray(c,c+=r[0]|r[1]<<8),n.subarray(0,l),i),Pe(r.subarray(c,c+=r[2]|r[3]<<8),n.subarray(l,h),i),Pe(r.subarray(c,c+=r[4]|r[5]<<8),n.subarray(h,g),i),Pe(r.subarray(c),n.subarray(g),i)},Bn=function(r,n,i){var c,o=n.b,l=r[o],h=l>>1&3;n.l=l&1;var g=l>>3|r[o+1]<<5|r[o+2]<<13,v=(o+=3)+g;if(h==1)return o>=r.length?void 0:(n.b=o+1,i?(He(i,r[o],n.y,n.y+=g),i):He(new z(g),r[o]));if(!(v>r.length)){if(h==0)return n.b=v,i?(i.set(r.subarray(o,v),n.y),n.y+=g,i):ft(r,o,v);if(h==2){var k=r[o],C=k&3,M=k>>2&3,F=k>>4,y=0,N=0;C<2?M&1?F|=r[++o]<<4|(M&2&&r[++o]<<12):F=k>>3:(N=M,M<2?(F|=(r[++o]&63)<<4,y=r[o]>>6|r[++o]<<2):M==2?(F|=r[++o]<<4|(r[++o]&3)<<12,y=r[o]>>2|r[++o]<<6):(F|=r[++o]<<4|(r[++o]&63)<<12,y=r[o]>>6|r[++o]<<2|r[++o]<<10)),++o;var w=i?i.subarray(n.y,n.y+n.m):new z(n.m),$=w.length-F;if(C==0)w.set(r.subarray(o,o+=F),$);else if(C==1)He(w,r[o++],$);else{var D=n.h;if(C==2){var J=Kn(r,o);y+=o-(o=J[0]),n.h=D=J[1]}else D||Y(0);(N?Yn:Pe)(r.subarray(o,o+=y),w.subarray($),D)}var H=r[o++];if(H){H==255?H=(r[o++]|r[o++]<<8)+32512:H>127&&(H=H-128<<8|r[o++]);var te=r[o++];te&3&&Y(0);for(var K=[Xn,zn,On],b=2;b>-1;--b){var B=te>>(b<<1)+2&3;if(B==1){var S=new z([0,0,r[o++]]);K[b]={s:S.subarray(2,3),n:S.subarray(0,1),t:new je(S.buffer,0,1),b:0}}else B==2?(c=qe(r,o,9-(b&1)),o=c[0],K[b]=c[1]):B==3&&(n.t||Y(0),K[b]=n.t[b])}var G=n.t=K,j=G[0],T=G[1],_=G[2],P=r[v-1];P||Y(0);var U=(v<<3)-8+be(P)-_.b,E=U>>3,V=0,O=(r[E]|r[E+1]<<8)>>(U&7)&(1<<_.b)-1;E=(U-=T.b)>>3;var de=(r[E]|r[E+1]<<8)>>(U&7)&(1<>3;var X=(r[E]|r[E+1]<<8)>>(U&7)&(1<>3;var he=1<>>(U&7)&he-1);E=(U-=vt[Ee])>>3;var ie=Zn[Ee]+((r[E]|r[E+1]<<8|r[E+2]<<16)>>(U&7)&(1<>3;var pe=Vn[Ce]+((r[E]|r[E+1]<<8|r[E+2]<<16)>>(U&7)&(1<>3,O=_.t[O]+((r[E]|r[E+1]<<8)>>(U&7)&(1<>3,X=j.t[X]+((r[E]|r[E+1]<<8)>>(U&7)&(1<>3,de=T.t[de]+((r[E]|r[E+1]<<8)>>(U&7)&(1<3)n.o[2]=n.o[1],n.o[1]=n.o[0],n.o[0]=re-=3;else{var Ue=re-(pe!=0);Ue?(re=Ue==3?n.o[0]-1:n.o[Ue],Ue>1&&(n.o[2]=n.o[1]),n.o[1]=n.o[0],n.o[0]=re):re=n.o[0]}for(var b=0;bie&&(ne=ie);for(var b=0;b{throw e},c,o=console.log.bind(console),l=console.error.bind(console),h,g=!1,v,k=t=>t.startsWith("file://"),C=!1;function M(){return Ze.buffer}function F(){if(!S?.buffer?.resizable){var t=M();S=new Int8Array(t),Se=new Int16Array(t),n.HEAPU8=O=new Uint8Array(t),$e=new Uint16Array(t),Ke=new Int32Array(t),X=new Uint32Array(t),Lt=new Float32Array(t),Rt=new Float64Array(t),kt=new BigInt64Array(t),$t=new BigUint64Array(t)}}function y(){C=!0,Fe.A()}function N(t){t=`Aborted(${t})`,l(t),g=!0,t+=". Build with -sASSERTIONS for more info.",C&&Xt();var e=new WebAssembly.RuntimeError(t);throw e}var w;let $=()=>"";function D(t){if(t==w&&h)return new Uint8Array(h);throw"both async and sync fetching of the wasm failed"}async function J(t){if(!h)try{var e=await c(t);return new Uint8Array(e)}catch{}return D(t)}async function H(t,e){try{var a=await J(t),s=await WebAssembly.instantiate(a,e);return s}catch(u){l(`failed to asynchronously prepare wasm: ${u}`),N(u)}}async function te(t,e,a){if(!t&&!k(e))try{var s=fetch(e,{credentials:"same-origin"}),u=await WebAssembly.instantiateStreaming(s,a);return u}catch(d){l(`wasm streaming compile failed: ${d}`),l("falling back to ArrayBuffer instantiation")}return H(e,a)}function K(){var t={a:En};return t}async function b(){function t(d){return Fe=d.exports,Cn(Fe),F(),Fe}function e(d){return t(d.instance)}var a=K();w??=$();var s=await te(h,w,a),u=e(s);return u}class B{name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var S,G=()=>Dt,j=t=>{var e=t.getArg(G(),0);return Yt(e)},T=()=>Zt(),_=t=>zt(t),P=t=>Vt(t),U=globalThis.TextDecoder&&new TextDecoder,E=(t,e,a,s)=>{var u=e+a;if(s)return u;for(;t[e]&&!(e>=u);)++e;return e},V=(t,e=0,a,s)=>{var u=E(t,e,a,s);if(u-e>16&&t.buffer&&U)return U.decode(t.subarray(e,u));for(var d="";e>10,56320|x&1023)}}return d},O,de=(t,e,a)=>t?V(O,t,e,a):"",X,Ce=t=>{var e=T(),a=P(4),s=P(4);Bt(t,a,s);var u=X[a>>2],d=X[s>>2],p=de(u);ue(u);var f;return d&&(f=de(d),ue(d)),_(e),[p,f]},Ie=t=>{var e=j(t);return Ce(e)},Ee=t=>{var e=new WebAssembly.Exception(G(),[t],{traceStack:!0});throw e.message=Ie(e),e},Je=()=>N(""),we={},Me=t=>{for(;t.length;){var e=t.pop(),a=t.pop();a(e)}};function he(t){return this.fromWireType(X[t>>2])}var re={},ie={},pe={};class Ue extends Error{constructor(e){super(e),this.name="InternalError"}}var ce=t=>{throw new Ue(t)},ne=(t,e,a)=>{t.forEach(f=>pe[f]=e);function s(f){var m=a(f);m.length!==t.length&&ce("Mismatched type converter count");for(var x=0;x{u[f]=ie[m],++p,p===d.length&&s(u)}));d.length===0&&s(u)},tt=t=>{var e=we[t];delete we[t];var a=e.rawConstructor,s=e.rawDestructor,u=e.fields,d=u.map(p=>p.getterReturnType).concat(u.map(p=>p.setterArgumentType));ne([t],d,p=>{var f={};for(var[m,x]of u.entries()){let Q=p[m],R=x.getter,L=x.getterContext,I=p[m+u.length],W=x.setter,ae=x.setterContext;f[x.fieldName]={read:A=>Q.fromWireType(R(L,A)),write:(A,Z)=>{var ge=[];W(ae,A,I.toWireType(ge,Z)),Me(ge)},optional:Q.optional}}return[{name:e.name,fromWireType:Q=>{var R={};for(var L in f)R[L]=f[L].read(Q);return s(Q),R},toWireType:(Q,R)=>{for(var L in f)if(!(L in R)&&!f[L].optional)throw new TypeError(`Missing field: "${L}"`);var I=a();for(L in f)f[L].write(I,R[L]);return Q!==null&&Q.push(s,I),I},readValueFromPointer:he,destructorFunction:s}]})},ee=t=>{for(var e="";;){var a=O[t++];if(!a)return e;e+=String.fromCharCode(a)}};class ke extends Error{constructor(e){super(e),this.name="BindingError"}}var q=t=>{throw new ke(t)};function fr(t,e,a={}){var s=e.name;if(t||q(`type "${s}" must have a positive integer typeid pointer`),ie.hasOwnProperty(t)){if(a.ignoreDuplicateRegistrations)return;q(`Cannot register type '${s}' twice`)}if(ie[t]=e,delete pe[t],re.hasOwnProperty(t)){var u=re[t];delete re[t],u.forEach(d=>d())}}function le(t,e,a={}){return fr(t,e,a)}var Se,$e,Ke,kt,$t,xt=(t,e,a)=>{switch(e){case 1:return a?s=>S[s]:s=>O[s];case 2:return a?s=>Se[s>>1]:s=>$e[s>>1];case 4:return a?s=>Ke[s>>2]:s=>X[s>>2];case 8:return a?s=>kt[s>>3]:s=>$t[s>>3];default:throw new TypeError(`invalid integer width (${e}): ${t}`)}},hr=(t,e,a,s,u)=>{e=ee(e);let d=s===0n,p=f=>f;if(d){let f=a*8;p=m=>BigInt.asUintN(f,m),u=p(u)}le(t,{name:e,fromWireType:p,toWireType:(f,m)=>(typeof m=="number"&&(m=BigInt(m)),m),readValueFromPointer:xt(e,a,!d),destructorFunction:null})},gr=(t,e,a,s)=>{e=ee(e),le(t,{name:e,fromWireType:function(u){return!!u},toWireType:function(u,d){return d?a:s},readValueFromPointer:function(u){return this.fromWireType(O[u])},destructorFunction:null})},wr=t=>({count:t.count,deleteScheduled:t.deleteScheduled,preservePointerOnDelete:t.preservePointerOnDelete,ptr:t.ptr,ptrType:t.ptrType,smartPtr:t.smartPtr,smartPtrType:t.smartPtrType}),rt=t=>{function e(a){return a.$$.ptrType.registeredClass.name}q(e(t)+" instance already deleted")},nt=!1,Qt=t=>{},mr=t=>{t.smartPtr?t.smartPtrType.rawDestructor(t.smartPtr):t.ptrType.registeredClass.rawDestructor(t.ptr)},Ft=t=>{t.count.value-=1;var e=t.count.value===0;e&&mr(t)},xe=t=>globalThis.FinalizationRegistry?(nt=new FinalizationRegistry(e=>{Ft(e.$$)}),xe=e=>{var a=e.$$,s=!!a.smartPtr;if(s){var u={$$:a};nt.register(e,u,e)}return e},Qt=e=>nt.unregister(e),xe(t)):(xe=e=>e,t),vr=()=>{let t=Oe.prototype;Object.assign(t,{isAliasOf(a){if(!(this instanceof Oe)||!(a instanceof Oe))return!1;var s=this.$$.ptrType.registeredClass,u=this.$$.ptr;a.$$=a.$$;for(var d=a.$$.ptrType.registeredClass,p=a.$$.ptr;s.baseClass;)u=s.upcast(u),s=s.baseClass;for(;d.baseClass;)p=d.upcast(p),d=d.baseClass;return s===d&&u===p},clone(){if(this.$$.ptr||rt(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var a=xe(Object.create(Object.getPrototypeOf(this),{$$:{value:wr(this.$$)}}));return a.$$.count.value+=1,a.$$.deleteScheduled=!1,a},delete(){this.$$.ptr||rt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&q("Object already scheduled for deletion"),Qt(this),Ft(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||rt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&q("Object already scheduled for deletion"),this.$$.deleteScheduled=!0,this}});let e=Symbol.dispose;e&&(t[e]=t.delete)};function Oe(){}var Nt=(t,e)=>Object.defineProperty(e,"name",{value:t}),Tt={},at=(t,e,a)=>{if(t[e].overloadTable===void 0){var s=t[e];t[e]=function(...u){return t[e].overloadTable.hasOwnProperty(u.length)||q(`Function '${a}' called with an invalid number of arguments (${u.length}) - expects one of (${t[e].overloadTable})!`),t[e].overloadTable[u.length].apply(this,u)},t[e].overloadTable=[],t[e].overloadTable[s.argCount]=s}},yr=(t,e,a)=>{n.hasOwnProperty(t)?(q(`Cannot register public name '${t}' twice`),at(n,t,t),n[t].overloadTable.hasOwnProperty(a)&&q(`Cannot register multiple overloads of a function with the same number of arguments (${a})!`),n[t].overloadTable[a]=e):(n[t]=e,n[t].argCount=a)},br=48,Ur=57,Cr=t=>{t=t.replace(/[^a-zA-Z0-9_]/g,"$");var e=t.charCodeAt(0);return e>=br&&e<=Ur?`_${t}`:t};function Er(t,e,a,s,u,d,p,f){this.name=t,this.constructor=e,this.instancePrototype=a,this.rawDestructor=s,this.baseClass=u,this.getActualType=d,this.upcast=p,this.downcast=f,this.pureVirtualFunctions=[]}var it=(t,e,a)=>{for(;e!==a;)e.upcast||q(`Expected null or instance of ${a.name}, got an instance of ${e.name}`),t=e.upcast(t),e=e.baseClass;return t},ot=t=>{if(t===null)return"null";var e=typeof t;return e==="object"||e==="array"||e==="function"?t.toString():""+t};function Mr(t,e){if(e===null)return this.isReference&&q(`null is not a valid ${this.name}`),0;e.$$||q(`Cannot pass "${ot(e)}" as a ${this.name}`),e.$$.ptr||q(`Cannot pass deleted object as a pointer of type ${this.name}`);var a=e.$$.ptrType.registeredClass,s=it(e.$$.ptr,a,this.registeredClass);return s}function kr(t,e){var a;if(e===null)return this.isReference&&q(`null is not a valid ${this.name}`),this.isSmartPointer?(a=this.rawConstructor(),t!==null&&t.push(this.rawDestructor,a),a):0;(!e||!e.$$)&&q(`Cannot pass "${ot(e)}" as a ${this.name}`),e.$$.ptr||q(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&e.$$.ptrType.isConst&&q(`Cannot convert argument of type ${e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name} to parameter type ${this.name}`);var s=e.$$.ptrType.registeredClass;if(a=it(e.$$.ptr,s,this.registeredClass),this.isSmartPointer)switch(e.$$.smartPtr===void 0&&q("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:e.$$.smartPtrType===this?a=e.$$.smartPtr:q(`Cannot convert argument of type ${e.$$.smartPtrType?e.$$.smartPtrType.name:e.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:a=e.$$.smartPtr;break;case 2:if(e.$$.smartPtrType===this)a=e.$$.smartPtr;else{var u=e.clone();a=this.rawShare(a,lt.toHandle(()=>u.delete())),t!==null&&t.push(this.rawDestructor,a)}break;default:q("Unsupported sharing policy")}return a}function $r(t,e){if(e===null)return this.isReference&&q(`null is not a valid ${this.name}`),0;e.$$||q(`Cannot pass "${ot(e)}" as a ${this.name}`),e.$$.ptr||q(`Cannot pass deleted object as a pointer of type ${this.name}`),e.$$.ptrType.isConst&&q(`Cannot convert argument of type ${e.$$.ptrType.name} to parameter type ${this.name}`);var a=e.$$.ptrType.registeredClass,s=it(e.$$.ptr,a,this.registeredClass);return s}var Pt=(t,e,a)=>{if(e===a)return t;if(a.baseClass===void 0)return null;var s=Pt(t,e,a.baseClass);return s===null?null:a.downcast(s)},xr={},Qr=(t,e)=>{for(e===void 0&&q("ptr should not be undefined");t.baseClass;)e=t.upcast(e),t=t.baseClass;return e},Fr=(t,e)=>(e=Qr(t,e),xr[e]),Xe=(t,e)=>{(!e.ptrType||!e.ptr)&&ce("makeClassHandle requires ptr and ptrType");var a=!!e.smartPtrType,s=!!e.smartPtr;return a!==s&&ce("Both smartPtrType and smartPtr must be specified"),e.count={value:1},xe(Object.create(t,{$$:{value:e,writable:!0}}))};function Nr(t){var e=this.getPointee(t);if(!e)return this.destructor(t),null;var a=Fr(this.registeredClass,e);if(a!==void 0){if(a.$$.count.value===0)return a.$$.ptr=e,a.$$.smartPtr=t,a.clone();var s=a.clone();return this.destructor(t),s}function u(){return this.isSmartPointer?Xe(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:e,smartPtrType:this,smartPtr:t}):Xe(this.registeredClass.instancePrototype,{ptrType:this,ptr:t})}var d=this.registeredClass.getActualType(e),p=Tt[d];if(!p)return u.call(this);var f;this.isConst?f=p.constPointerType:f=p.pointerType;var m=Pt(e,this.registeredClass,f.registeredClass);return m===null?u.call(this):this.isSmartPointer?Xe(f.registeredClass.instancePrototype,{ptrType:f,ptr:m,smartPtrType:this,smartPtr:t}):Xe(f.registeredClass.instancePrototype,{ptrType:f,ptr:m})}var Tr=()=>{Object.assign(ze.prototype,{getPointee(t){return this.rawGetPointee&&(t=this.rawGetPointee(t)),t},destructor(t){this.rawDestructor?.(t)},readValueFromPointer:he,fromWireType:Nr})};function ze(t,e,a,s,u,d,p,f,m,x,Q){this.name=t,this.registeredClass=e,this.isReference=a,this.isConst=s,this.isSmartPointer=u,this.pointeeType=d,this.sharingPolicy=p,this.rawGetPointee=f,this.rawConstructor=m,this.rawShare=x,this.rawDestructor=Q,!u&&e.baseClass===void 0?s?(this.toWireType=Mr,this.destructorFunction=null):(this.toWireType=$r,this.destructorFunction=null):this.toWireType=kr}var Pr=(t,e,a)=>{n.hasOwnProperty(t)||ce("Replacing nonexistent public symbol"),n[t].overloadTable!==void 0&&a!==void 0?n[t].overloadTable[a]=e:(n[t]=e,n[t].argCount=a)},_r=t=>Gt.get(t),se=(t,e,a=!1)=>{t=ee(t);function s(){var d=_r(e);return d}var u=s();return typeof u!="function"&&q(`unknown function pointer with signature ${t}: ${e}`),u};class Hr extends Error{}var qr=t=>{var e=Kt(t),a=ee(e);return ue(e),a},Ve=(t,e)=>{var a=[],s={};function u(d){if(!s[d]&&!ie[d]){if(pe[d]){pe[d].forEach(u);return}a.push(d),s[d]=!0}}throw e.forEach(u),new Hr(`${t}: `+a.map(qr).join([", "]))},Lr=(t,e,a,s,u,d,p,f,m,x,Q,R,L)=>{Q=ee(Q),d=se(u,d),f&&=se(p,f),x&&=se(m,x),L=se(R,L);var I=Cr(Q);yr(I,function(){Ve(`Cannot construct ${Q} due to unbound types`,[s])}),ne([t,e,a],s?[s]:[],W=>{W=W[0];var ae,A;s?(ae=W.registeredClass,A=ae.instancePrototype):A=Oe.prototype;var Z=Nt(Q,function(...pt){if(Object.getPrototypeOf(this)!==ge)throw new ke(`Use 'new' to construct ${Q}`);if(oe.constructor_body===void 0)throw new ke(`${Q} has no accessible constructor`);var jt=oe.constructor_body[pt.length];if(jt===void 0)throw new ke(`Tried to invoke ctor of ${Q} with invalid number of parameters (${pt.length}) - expected (${Object.keys(oe.constructor_body).toString()}) parameters instead!`);return jt.apply(this,pt)}),ge=Object.create(A,{constructor:{value:Z}});Z.prototype=ge;var oe=new Er(Q,Z,ge,L,ae,d,f,x);oe.baseClass&&(oe.baseClass.__derivedClasses??=[],oe.baseClass.__derivedClasses.push(oe));var dt=new ze(Q,oe,!0,!1,!1),fe=new ze(Q+"*",oe,!1,!1,!1),Ye=new ze(Q+" const*",oe,!1,!0,!1);return Tt[t]={pointerType:fe,constPointerType:Ye},Pr(I,Z),[dt,fe,Ye]})};function Rr(t){for(var e=1;e{for(var a=[],s=0;s>2]);return a},_t=t=>{t=t.trim();let e=t.indexOf("(");return e===-1?t:t.slice(0,e)},Ir=(t,e,a,s,u,d,p,f,m)=>{var x=ct(a,s);e=ee(e),e=_t(e),d=se(u,d,f),ne([],[t],Q=>{Q=Q[0];var R=`${Q.name}.${e}`;function L(){Ve(`Cannot call ${R} due to unbound types`,x)}e.startsWith("@@")&&(e=Symbol[e.substring(2)]);var I=Q.registeredClass.constructor;return I[e]===void 0?(L.argCount=a-1,I[e]=L):(at(I,e,R),I[e].overloadTable[a-1]=L),ne([],x,W=>{var ae=[W[0],null].concat(W.slice(1)),A=st(R,ae,null,d,p);if(I[e].overloadTable===void 0?(A.argCount=a-1,I[e]=A):I[e].overloadTable[a-1]=A,Q.registeredClass.__derivedClasses)for(let Z of Q.registeredClass.__derivedClasses)Z.constructor.hasOwnProperty(e)||(Z.constructor[e]=A);return[]}),[]})},Jr=(t,e,a,s,u,d)=>{var p=ct(e,a);u=se(s,u),ne([],[t],f=>{f=f[0];var m=`constructor ${f.name}`;if(f.registeredClass.constructor_body===void 0&&(f.registeredClass.constructor_body=[]),f.registeredClass.constructor_body[e-1]!==void 0)throw new ke(`Cannot register multiple constructors with identical number of parameters (${e-1}) for class '${f.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return f.registeredClass.constructor_body[e-1]=()=>{Ve(`Cannot construct ${f.name} due to unbound types`,p)},ne([],p,x=>(x.splice(1,0,null),f.registeredClass.constructor_body[e-1]=st(m,x,null,u,d),[])),[]})},Sr=(t,e,a,s,u,d,p,f,m,x)=>{var Q=ct(a,s);e=ee(e),e=_t(e),d=se(u,d,m),ne([],[t],R=>{R=R[0];var L=`${R.name}.${e}`;e.startsWith("@@")&&(e=Symbol[e.substring(2)]),f&&R.registeredClass.pureVirtualFunctions.push(e);function I(){Ve(`Cannot call ${L} due to unbound types`,Q)}var W=R.registeredClass.instancePrototype,ae=W[e];return ae===void 0||ae.overloadTable===void 0&&ae.className!==R.name&&ae.argCount===a-2?(I.argCount=a-2,I.className=R.name,W[e]=I):(at(W,e,L),W[e].overloadTable[a-2]=I),ne([],Q,A=>{var Z=st(L,A,R,d,p);return W[e].overloadTable===void 0?(Z.argCount=a-2,W[e]=Z):W[e].overloadTable[a-2]=Z,[]}),[]})},Ht=[],me=[0,1,,1,null,1,!0,1,!1,1],qt=[],Kr=t=>{if(t>9&&--me[t+1]===0){var e=me[t];me[t]=void 0;var a=qt[t];a&&(qt[t]=void 0,a(e)),Ht.push(t)}},lt={toValue:t=>(t||q(`Cannot use deleted val. handle = ${t}`),me[t]),toHandle:t=>{switch(t){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{let e=Ht.pop()||me.length;return me[e]=t,me[e+1]=1,e}}}},Or={name:"emscripten::val",fromWireType:t=>{var e=lt.toValue(t);return Kr(t),e},toWireType:(t,e)=>lt.toHandle(e),readValueFromPointer:he,destructorFunction:null},Xr=t=>le(t,Or),Lt,Rt,zr=(t,e)=>{switch(e){case 4:return function(a){return this.fromWireType(Lt[a>>2])};case 8:return function(a){return this.fromWireType(Rt[a>>3])};default:throw new TypeError(`invalid float width (${e}): ${t}`)}},Vr=(t,e,a)=>{e=ee(e),le(t,{name:e,fromWireType:s=>s,toWireType:(s,u)=>u,readValueFromPointer:zr(e,a),destructorFunction:null})},Zr=(t,e,a,s,u)=>{e=ee(e);let d=s===0,p=m=>m;if(d){var f=32-8*a;p=m=>m<>>f,u=p(u)}le(t,{name:e,fromWireType:p,toWireType:(m,x)=>x,readValueFromPointer:xt(e,a,s!==0),destructorFunction:null})},Yr=(t,e,a)=>{var s=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array],u=s[e];function d(p){var f=X[p>>2],m=X[p+4>>2];return new u(S.buffer,m,f)}a=ee(a),le(t,{name:a,fromWireType:d,readValueFromPointer:d},{ignoreDuplicateRegistrations:!0})},Br=(t,e,a,s)=>{if(!(s>0))return 0;for(var u=a,d=a+s-1,p=0;p=d)break;e[a++]=f}else if(f<=2047){if(a+1>=d)break;e[a++]=192|f>>6,e[a++]=128|f&63}else if(f<=65535){if(a+2>=d)break;e[a++]=224|f>>12,e[a++]=128|f>>6&63,e[a++]=128|f&63}else{if(a+3>=d)break;e[a++]=240|f>>18,e[a++]=128|f>>12&63,e[a++]=128|f>>6&63,e[a++]=128|f&63,p++}}return e[a]=0,a-u},It=(t,e,a)=>Br(t,O,e,a),Jt=t=>{for(var e=0,a=0;a=55296&&s<=57343?(e+=4,++a):e+=3}return e},Dr=(t,e)=>{e=ee(e),le(t,{name:e,fromWireType(a){var s=X[a>>2],u=a+4,d;return d=de(u,s,!0),ue(a),d},toWireType(a,s){s instanceof ArrayBuffer&&(s=new Uint8Array(s));var u,d=typeof s=="string";d||ArrayBuffer.isView(s)&&s.BYTES_PER_ELEMENT==1||q("Cannot pass non-string to std::string"),d?u=Jt(s):u=s.length;var p=ut(4+u+1),f=p+4;return X[p>>2]=u,d?It(s,f,u+1):O.set(s,f),a!==null&&a.push(ue,p),p},readValueFromPointer:he,destructorFunction(a){ue(a)}})},St=globalThis.TextDecoder?new TextDecoder("utf-16le"):void 0,Gr=(t,e,a)=>{var s=t>>1,u=E($e,s,e/2,a);if(u-s>16&&St)return St.decode($e.subarray(s,u));for(var d="",p=s;p{if(a<2)return 0;a-=2;for(var s=e,u=a>1]=p,e+=2}return Se[e>>1]=0,e-s},Wr=t=>t.length*2,Ar=(t,e,a)=>{for(var s="",u=t>>2,d=0;!(d>=e/4);d++){var p=X[u+d];if(!p&&!a)break;s+=String.fromCodePoint(p)}return s},en=(t,e,a=2147483647)=>{if(a<4)return 0;for(var s=e,u=s+a-4,d=0;d65535&&d++,Ke[e>>2]=p,e+=4,e+4>u)break}return Ke[e>>2]=0,e-s},tn=t=>{for(var e=0,a=0;a65535&&a++,e+=4}return e},rn=(t,e,a)=>{a=ee(a);var s,u,d;e===2?(s=Gr,u=jr,d=Wr):(s=Ar,u=en,d=tn),le(t,{name:a,fromWireType:p=>{var f=X[p>>2],m=s(p+4,f*e,!0);return ue(p),m},toWireType:(p,f)=>{typeof f!="string"&&q(`Cannot pass non-string to C++ string type ${a}`);var m=d(f),x=ut(4+m+e);return X[x>>2]=m/e,u(f,x+4,m+e),p!==null&&p.push(ue,x),x},readValueFromPointer:he,destructorFunction(p){ue(p)}})},nn=(t,e,a,s,u,d)=>{we[t]={name:ee(e),rawConstructor:se(a,s),rawDestructor:se(u,d),fields:[]}},an=(t,e,a,s,u,d,p,f,m,x)=>{we[t].fields.push({fieldName:ee(e),getterReturnType:a,getter:se(s,u),getterContext:d,setterArgumentType:p,setter:se(f,m),setterContext:x})},on=(t,e)=>{e=ee(e),le(t,{isVoid:!0,name:e,fromWireType:()=>{},toWireType:(a,s)=>{}})},sn=()=>{},Qe={},cn=t=>{if(t instanceof B||t=="unwind")return v;i(1,t)},ln=t=>{v=t,i(t,new B(t))},un=t=>{if(!g)try{return t()}catch(e){cn(e)}},dn=()=>performance.now(),pn=(t,e)=>{if(Qe[t]&&(clearTimeout(Qe[t].id),delete Qe[t]),!e)return 0;var a=setTimeout(()=>{delete Qe[t],un(()=>Ot(t,dn()))},e);return Qe[t]={id:a,timeout_ms:e},0},fn=()=>2147483648,hn=(t,e)=>Math.ceil(t/e)*e,gn=t=>{var e=Ze.buffer.byteLength,a=(t-e+65535)/65536|0;try{return Ze.grow(a),F(),1}catch{}},wn=t=>{var e=O.length;t>>>=0;var a=fn();if(t>a)return!1;for(var s=1;s<=4;s*=2){var u=e*(1+.2/s);u=Math.min(u,t+100663296);var d=Math.min(a,hn(Math.max(t,u),65536)),p=gn(d);if(p)return!0}return!1},mn=t=>52;function vn(t,e,a,s){return 70}var yn=[null,[],[]],bn=(t,e)=>{var a=yn[t];!e||e===10?((t===1?o:l)(V(a)),a.length=0):a.push(e)},Un=(t,e,a,s)=>{for(var u=0,d=0;d>2],f=X[e+4>>2];e+=8;for(var m=0;m>2]=u,0};vr(),Tr(),n.wasmBinary&&(h=n.wasmBinary),n.UTF8ToString=de,n.stringToUTF8=It,n.lengthBytesUTF8=Jt;var Kt,ut,ue,Ot,Xt,zt,Vt,Zt,Yt,Bt,Dt,Ze,Gt;function Cn(t){Kt=t.B,ut=n._malloc=t.C,ue=n._free=t.D,Ot=t.F,Xt=t.G,zt=t.H,Vt=t.I,Zt=t.J,Yt=t.K,Bt=t.L,Ze=t.z,Gt=t.E,Dt=t.M}var En={t:Ee,x:Je,f:tt,i:hr,l:gr,o:Lr,b:Ir,n:Jr,d:Sr,y:Xr,h:Vr,c:Zr,a:Yr,k:Dr,g:rn,j:nn,e:an,m:on,w:sn,p:pn,u:wn,s:mn,q:vn,r:Un,v:ln};async function Mn(){!g&&y()}var Fe;return Fe=await b(),await Mn(),n}var Wn=jn,An=new Int8Array([-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,90,63,64,65,66,-1,67,68,69,70,71,-1,72,73,52,53,54,55,56,57,58,59,60,61,74,75,76,77,78,79,80,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,81,-1,82,83,84,85,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,86,87,88,89,-1]);function ea(r){let n=new Uint8Array(170930),i=0,c=0,o=0,l=-1;for(let h=0,g=r.length;h127)continue;let k=An[v];if(!(k<0))if(l<0)l=k;else{l+=k*91,c|=l<88?13:14;do n[i++]=c,c>>>=8,o-=8;while(o>7);l=-1}}return l>=0&&(n[i++]=(c|l<""})}function na(){yt=void 0}var aa=class{_module;constructor(r){this._module=r}malloc(r){let n=this._module._malloc(r);return{ptr:n,size:r,dispose:()=>this.free({ptr:n,size:r,dispose:()=>{}})}}free(r){this._module._free(r.ptr)}dataToHeap(r){let n=this.malloc(r.byteLength);return this._module.HEAPU8.set(r,n.ptr),n}heapView(r){return this._module.HEAPU8.subarray(r.ptr,r.ptr+r.size)}heapToUint8Array(r){return new Uint8Array([...this.heapView(r)])}lengthBytes(r){return this._module.lengthBytesUTF8(r)}stringToHeap(r){let n=this.lengthBytes(r)+1,i=this._module._malloc(n);return this._module.stringToUTF8(r,i,n),{ptr:i,size:n,dispose:()=>this.free({ptr:i,size:n,dispose:()=>{}})}}heapToString(r){return this._module.UTF8ToString(r.ptr,r.size)}hasFilesystem(){let r=this._module;return r.FS_createPath!==void 0&&r.FS_createDataFile!==void 0&&r.FS_preloadFile!==void 0&&r.FS_unlink!==void 0}createPath(r,n=!0,i=!0){return this._module.FS_createPath("/",r,n,i)}createDataFile(r,n,i=!0,c=!0,o=!0){return this._module.FS_createDataFile("/",r,n,i,c,o)}preloadFile(r,n,i=!0,c=!0,o=!1,l=!0,h=!1){return this._module.FS_preloadFile("/",r,n,i,c,o,l,h)}unlink(r){return this._module.FS_unlink(r)}},Ne,ia=4294967295;function Te(r,n){if(!Number.isInteger(r)||r<0||r>ia)throw new Error(`${n} length ${r} is outside the WASM32-safe range`)}function ht(r){if(r.length===0)return new Uint8Array(0);if(r.length===1)return r[0];let n=0;for(let o of r)n+=o.length;let i=new Uint8Array(n),c=0;for(let o of r)i.set(o,c),c+=o.length;return i}var oa=class cr{_mainModule;_zstdClass;_zstd;_compressionLevel;_decompressFrameCompleted=!1;_decompressRemaining=0;_decompressSawInput=!1;constructor(n){this._mainModule=new aa(n),this._zstdClass=n.zstd,this._zstd=new this._zstdClass,this._compressionLevel=this._zstdClass.defaultCLevel()}static load(){return Ne||(Ne=ra().then(n=>new cr(n))),Ne}static unload(){na(),Ne?.then(n=>{n?._zstd?.delete()}),Ne=void 0}copyHeap(n){return this._mainModule.heapView(n).slice()}mallocChecked(n,i){Te(n,i);let c=this._mainModule.malloc(n);if(!c.ptr)throw this._mainModule.free(c),new Error(`Failed to allocate ${n} bytes for ${i}`);return c}throwStreamError(n,i){throw new Error(`${n} failed: ${i.errorName||"unknown error"}`)}ensureStreamOk(n,i){i.error&&this.throwStreamError(n,i)}version(){return this._zstdClass.version()}reset(){let n=this._zstd.reset();this.ensureStreamOk("reset",n),this._decompressFrameCompleted=!1,this._decompressRemaining=0,this._decompressSawInput=!1}resetCompression(n){n!==void 0&&(this._compressionLevel=n);let i=this._zstd.resetCompression(this._compressionLevel);this.ensureStreamOk("resetCompression",i)}resetDecompression(){let n=this._zstd.resetDecompression();this.ensureStreamOk("resetDecompression",n),this._decompressFrameCompleted=!1,this._decompressRemaining=0,this._decompressSawInput=!1}setCompressionLevel(n){let i=this._zstd.setCompressionLevel(n);this.ensureStreamOk("setCompressionLevel",i),this._compressionLevel=n}compress(n,i=this.defaultCLevel()){Te(n.length,"compress input");let c=this._mainModule.dataToHeap(n);try{if(!c.ptr&&n.length>0)throw new Error("Failed to allocate compress input buffer");let o=this._zstdClass.compressBound(n.length),l=this.mallocChecked(o,"compress output");try{if(l.size=this._zstdClass.compress(l.ptr,o,c.ptr,c.size,i),this._zstdClass.isError(l.size))throw new Error(`compress failed: ${this._zstdClass.getErrorName(l.size)}`);return this.copyHeap(l)}finally{this._mainModule.free(l)}}finally{this._mainModule.free(c)}}compressChunk(n){if(Te(n.length,"compressChunk input"),n.length===0)return new Uint8Array(0);let i=this._mainModule.dataToHeap(n);try{if(!i.ptr)throw new Error("Failed to allocate compressChunk input buffer");let c=this._zstdClass.CStreamOutSize(),o=[],l=0;for(;l0&&(h.size=g.produced,o.push(this.copyHeap(h)))}finally{this._mainModule.free(h)}}return ht(o)}finally{this._mainModule.free(i)}}compressEnd(){let n=this._zstdClass.CStreamOutSize(),i=[],c=1;for(;c!==0;){let o=this.mallocChecked(n,"compressEnd output");try{let l=this._zstd.compressEnd(o.ptr,n);if(this.ensureStreamOk("compressEnd",l),l.produced===0&&l.remaining!==0)throw new Error("compressEnd failed: no progress while finishing stream");c=l.remaining,l.produced>0&&(o.size=l.produced,i.push(this.copyHeap(o)))}finally{this._mainModule.free(o)}}return ht(i)}frameContentSize(n){return this._zstdClass.getFrameContentSize(n.ptr,n.size)}decompress(n){Te(n.length,"decompress input");let i=this._mainModule.dataToHeap(n);try{if(!i.ptr&&n.length>0)throw new Error("Failed to allocate decompress input buffer");let c=this.frameContentSize(i);if(c.error)throw new Error(`Failed to get frame content size: ${c.errorName}`);let o=c.known;if(o){let l=this._zstdClass.findFrameCompressedSize(i.ptr,i.size);if(this._zstdClass.isError(l))throw new Error(`Failed to find frame compressed size: ${this._zstdClass.getErrorName(l)}`);l0?i.ptr+l:0,C=this._zstd.decompressChunk(g.ptr,c,k,v);if(this.ensureStreamOk("decompressChunk",C),C.consumed===0&&C.produced===0){if(v===0){C.remaining>0&&(this._decompressRemaining=C.remaining);break}throw new Error("decompressChunk failed: no progress while consuming input")}l+=C.consumed,h=C.produced===c&&C.remaining!==0,C.produced>0&&(g.size=C.produced,o.push(this.copyHeap(g))),C.remaining===0?(this._decompressFrameCompleted=!0,this._decompressRemaining=0):this._decompressRemaining=C.remaining}finally{this._mainModule.free(g)}}return ht(o)}finally{this._mainModule.free(i)}}decompressEnd(){if(!this._decompressSawInput)throw new Error("decompressEnd failed: empty compressed input is not a completed frame");if(!this._decompressFrameCompleted||this._decompressRemaining!==0)throw new Error("decompressEnd failed: truncated Zstandard input")}defaultCLevel(){return this._zstdClass.defaultCLevel()}minCLevel(){return this._zstdClass.minCLevel()}maxCLevel(){return this._zstdClass.maxCLevel()}};let gt=null;function sa(){return gt||(gt=oa.load()),gt}function ca(r){return r.length>=4&&r[0]===40&&r[1]===181&&r[2]===47&&r[3]===253}function bt(r){const n="SQLite format 3\0";if(r.length/g,">").replace(/"/g,""").replace(/'/g,"'")}function tr(r,n,i){const c=r.tagsList.map(h=>`${ye(h)}`).join(""),o=[...r.more.entries()].map(([h,g])=>{const v=i.get(h);return`
${v?`${ye(v.name)} #${h}`:`Поле #${h}`}
${ye(g)}
`}).join(""),l=o?`
Дополнительно (${r.more.size})
${o}
`:"";return`
+
${ye(r.key)}
`+(n?`${ye(n)}`:"")+`
${ye(r.value)}
`+(c?`
${c}
`:"")+l+"
"}function ua(r,n){r.innerHTML=` +
+

🏠 Главная

+

Локальное сохранение и повторения — всё работает офлайн.

+
Проверка локальной базы…
+
+ +
+ +
+
+

📚 Слова

+
+ + +
+

+
База ещё не проверена.
+
+
+
+ `;const i=r.querySelector("#home-db-status"),c=r.querySelector("#btn-go-sync"),o=r.querySelector("#home-actions"),l=r.querySelector("#btn-start"),h=r.querySelector("#words-search"),g=r.querySelector("#words-group"),v=r.querySelector("#words-count"),k=r.querySelector("#words-status"),C=r.querySelector("#words-list"),M=r.querySelector("#words-more");c.addEventListener("click",()=>n.goSync()),l.addEventListener("click",()=>{i.textContent="Экран повторений — следующий шаг."});let F=!1,y=new Map,N=new Map,w=0,$=[],D=0,J=!1,H=0,te=0;function K(){const T=g.value;if(T==="")return{search:h.value.trim(),groupId:null};const _=Number(T);return{search:h.value.trim(),groupId:Number.isFinite(_)?_:null}}function b(){M.hidden=!(F&&$.lengthtr(T,y.get(T.group_id),N)).join(""),v.textContent=w>0?`Показано ${$.length} из ${w}`:"",b()}function S(T){k.textContent=T,k.hidden=T===""}async function G(){if(!F||J)return;J=!0;const T=++H,_=K();M.disabled=!0,$.length===0&&S("Загрузка слов…");try{const[P,U]=await Promise.all([Nn({search:_.search,groupId:_.groupId??void 0}),Wt({search:_.search,groupId:_.groupId??void 0,limit:er,offset:0})]);if(T!==H)return;w=P,$=U,D=U.length,B(),S(U.length===0?"По этому запросу слов нет.":""),U.length===0&&w===0&&(v.textContent="Слов в базе пока нет.")}catch(P){if(T!==H)return;S(`Не удалось загрузить слова: ${P instanceof Error?P.message:String(P)}`)}finally{T===H&&(J=!1,M.disabled=!1,b())}}async function j(){if(!F||J||$.length>=w)return;J=!0;const T=++H,_=K();M.disabled=!0,M.textContent="Загрузка…";try{const P=await Wt({search:_.search,groupId:_.groupId??void 0,limit:er,offset:D});if(T!==H)return;$=$.concat(P),D+=P.length,C.insertAdjacentHTML("beforeend",P.map(U=>tr(U,y.get(U.group_id),N)).join("")),v.textContent=`Показано ${$.length} из ${w}`,b()}catch(P){if(T!==H)return;S(`Не удалось догрузить: ${P instanceof Error?P.message:String(P)}`)}finally{T===H&&(J=!1,M.disabled=!1,b())}}h.addEventListener("input",()=>{window.clearTimeout(te),te=window.setTimeout(()=>{G()},300)}),h.addEventListener("keydown",T=>{T.key==="Enter"&&(window.clearTimeout(te),G())}),g.addEventListener("change",()=>{G()}),M.addEventListener("click",()=>{j()}),(async()=>{if(!await Ge()){i.textContent="Локальной базы нет. Скачай сохранение на странице «Синхронизация».",o.hidden=!0,S("Нет локальной базы — скачай сохранение на странице «Синхронизация»."),v.textContent="";return}try{const _=await Hn(),P=bt(_);if(i.textContent=P?`Локальная база на месте: ${(_.length/1024).toFixed(1)} КБ, сигнатура SQLite OK.`:"Файл в OPFS есть, но это не похоже на SQLite — перекачай сохранение.",o.hidden=!P,!P){S("Файл в OPFS не похож на SQLite — перекачай сохранение.");return}try{const[U,E]=await Promise.all([Tn(),Pn()]),V=U;y=new Map(V.map(O=>[O.id,O.name])),N=new Map(E.map(O=>[O.id,O])),g.innerHTML=''+V.map(O=>``).join(""),F=!0,await G(),g.options[0].textContent=`Все группы (${w})`}catch(U){S(`БД есть, но слова не прочитались: ${U instanceof Error?U.message:String(U)}`)}}catch(_){i.textContent=`Не удалось прочитать базу: ${_ instanceof Error?_.message:String(_)}`,o.hidden=!0}})()}const rr=24,da=/^[A-Za-z0-9]{24}$/,lr="japlearn_sync_token";function nr(r){return r.trim().replace(/\s+/g,"")}function ve(r){return da.test(r)}function pa(){try{return localStorage.getItem(lr)??""}catch{return""}}function wt(r){try{localStorage.setItem(lr,r)}catch{}}const ur="https://learning.micialware.ru";function fa(r,n=ur){return`${n.replace(/\/+$/,"")}/download/${encodeURIComponent(r)}`}async function ha(r,n,i=ur){const c=fa(r,i);let o;try{o=await fetch(c,{method:"GET",...n})}catch(h){throw new Error(`Нет связи с сервером: ${h instanceof Error?h.message:String(h)}`)}if(!o.ok)throw o.status===404?new Error("Сохранение не найдено (404). Проверь токен."):new Error(`Сервер ответил ${o.status} ${o.statusText}`);const l=await o.arrayBuffer();if(l.byteLength===0)throw new Error("Сервер вернул пустой файл");return new Uint8Array(l)}function ga(r){r.innerHTML=` +
+

📡 Синхронизация

+

Токен сохранения — 24 символа: латинские буквы и цифры.

+ + + +
+ + 0 / 24 +
+ +
+ + +
+ +

Введите токен из 24 символов

+
+ `;const n=r.querySelector("#token-input"),i=r.querySelector("#token-error"),c=r.querySelector("#token-counter"),o=r.querySelector("#btn-download"),l=r.querySelector("#btn-upload"),h=r.querySelector("#status");function g(y){h.textContent=y,console.log(`[JapLearn] ${y}`)}function v(){return nr(n.value)}function k(y){o.disabled=y||!ve(v()),l.disabled=!0,n.disabled=y,y||Ge().then(N=>{!n.disabled&&ve(v())&&(l.disabled=!N)})}function C(){const y=v(),N=y.length;c.textContent=`${N} / ${rr}`;const w=ve(y),$=N===0;n.classList.toggle("invalid",!$&&!w),n.setAttribute("aria-invalid",String(!$&&!w)),$?i.textContent="":N!==rr?i.textContent=`Нужно 24 символа, сейчас ${N}`:i.textContent=w?"":"Только латинские буквы и цифры",o.disabled=!w,w?Ge().then(D=>{n.disabled||(l.disabled=!D)}):l.disabled=!0}async function M(){const y=v();if(ve(y)){wt(y),k(!0),g("Скачивание сохранения...");try{const N=await ha(y);g(`Скачано ${(N.length/1024).toFixed(1)} КБ, распаковка...`);const w=await la(N);g(`Распаковано ${(w.length/1024).toFixed(1)} КБ, сохранение в OPFS...`),await _n(w),g(`Готово: база ${(w.length/1024).toFixed(1)} КБ сохранена локально (OPFS).`)}catch(N){g(`Ошибка скачивания: ${N instanceof Error?N.message:String(N)}`)}finally{k(!1),C()}}}n.addEventListener("input",()=>{C()}),n.addEventListener("change",()=>{const y=v();n.value=y,ve(y)&&(wt(y),g("Токен сохранён локально. Можно скачивать или выгружать.")),C()}),o.addEventListener("click",()=>{M()}),l.addEventListener("click",()=>{const y=v();ve(y)&&(wt(y),g("Выгрузка — следующий шаг (POST /upload/stream/{id})."))});const F=pa();F&&(n.value=F),C(),ve(nr(F))&&Ge().then(y=>{g(y?"Токен восстановлен, локальная база на месте.":"Токен восстановлен. Нажми «Скачать», чтобы получить базу."),C()})}const wa={home:"Главная",sync:"Синхронизация"};function Le(r){const n=document.getElementById(r);if(!n)throw new Error(`[JapLearn] Не найден элемент #${r}`);return n}const dr=Le("burger-btn"),We=Le("drawer"),pr=Le("drawer-overlay"),ma=Le("page-title"),ar=Le("page");let Et=!1;function Re(r){Et=r,We.classList.toggle("open",r),pr.hidden=!r,dr.setAttribute("aria-expanded",String(r)),We.setAttribute("aria-hidden",String(!r)),document.body.classList.toggle("drawer-open",r)}function va(r){We.querySelectorAll(".drawer-btn").forEach(n=>{n.classList.toggle("active",n.dataset.page===r)})}function Mt(r){ma.textContent=wa[r],va(r),r==="home"?ua(ar,{goSync:()=>Mt("sync")}):ga(ar)}dr.addEventListener("click",()=>{Re(!Et)});pr.addEventListener("click",()=>{Re(!1)});document.addEventListener("keydown",r=>{r.key==="Escape"&&Et&&Re(!1)});We.querySelectorAll(".drawer-btn").forEach(r=>{r.addEventListener("click",()=>{const n=r.dataset.page;(n==="home"||n==="sync")&&Mt(n),Re(!1)})});await kn();Re(!1);Mt("home");console.log("[JapLearn] crossOriginIsolated =",window.crossOriginIsolated); diff --git a/dist/assets/index-DhXfM6jc.css b/dist/assets/index-CbQBYl48.css similarity index 65% rename from dist/assets/index-DhXfM6jc.css rename to dist/assets/index-CbQBYl48.css index acf7f31..0cd98fa 100644 --- a/dist/assets/index-DhXfM6jc.css +++ b/dist/assets/index-CbQBYl48.css @@ -1 +1 @@ -:root{font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;line-height:1.5;color:#1e1b2e;background:#f4f1fa}*{box-sizing:border-box}body{margin:0;min-height:100dvh;display:flex;justify-content:center;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}#app{width:100%;max-width:480px;padding:24px 16px 32px;display:flex;flex-direction:column;gap:16px}.app-header h1{margin:0;font-size:1.75rem;letter-spacing:.02em}.app-subtitle{margin:4px 0 0;color:#6d6390}.top-bar{display:flex;align-items:center;gap:12px}.burger-btn{width:44px;height:44px;border:2px solid #d9d2f0;border-radius:12px;background:#fff;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;touch-action:manipulation;flex:none}.burger-btn span{display:block;width:20px;height:2px;border-radius:2px;background:#4c446b}.burger-btn[aria-expanded=true]{border-color:#7c3aed}.top-bar-title h1{margin:0;font-size:1.4rem;line-height:1.2}.top-bar-title p{margin:0;font-size:.9rem;color:#6d6390}.top-bar-spacer{flex:1}.app-content{display:flex;flex-direction:column;gap:16px}.drawer-overlay{position:fixed;inset:0;background:#1e1b2e73;z-index:40}.drawer-overlay[hidden]{display:none}.drawer{position:fixed;top:0;left:0;bottom:0;width:min(300px,85vw);background:#fff;z-index:50;transform:translate(-105%);transition:transform .22s ease;display:flex;flex-direction:column;gap:8px;padding:20px 14px;box-shadow:8px 0 32px #1e1b2e2e}.drawer.open{transform:translate(0)}.drawer-header{padding:4px 8px 14px;border-bottom:1px solid #eee9fb;margin-bottom:8px}.drawer-logo{font-size:1.3rem;font-weight:800;color:#7c3aed}.drawer-subtitle{font-size:.9rem;color:#6d6390}.drawer-btn{border:none;background:transparent;text-align:left;font-size:1.05rem;font-weight:600;color:#1e1b2e;padding:13px 12px;border-radius:12px;cursor:pointer;touch-action:manipulation}.drawer-btn.active{background:#f1eafe;color:#6d28d9}.drawer-btn:active{background:#e9defc}body.drawer-open{overflow:hidden}.card{background:#fff;border-radius:16px;padding:20px 16px;box-shadow:0 8px 24px #7c3aed1f;display:flex;flex-direction:column;gap:12px}.card-title{margin:0;font-size:1.25rem}.card-hint{margin:0;color:#6d6390;font-size:.95rem}.field-label{font-weight:600;font-size:.95rem}.token-input{width:100%;padding:14px 12px;font-size:1.05rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.04em;border:2px solid #d9d2f0;border-radius:12px;outline:none}.token-input:focus{border-color:#7c3aed}.token-input.invalid{border-color:#dc2626;background:#fef2f2}.token-meta{display:flex;justify-content:space-between;align-items:baseline;gap:8px;min-height:1.4em}.token-error{color:#dc2626;font-size:.9rem}.token-counter{color:#6d6390;font-variant-numeric:tabular-nums;white-space:nowrap}.btn-row{display:flex;gap:12px}.btn{flex:1;padding:14px 12px;font-size:1rem;font-weight:600;border-radius:12px;border:2px solid #7c3aed;background:#fff;color:#7c3aed;cursor:pointer;touch-action:manipulation}.btn-primary{background:#7c3aed;color:#fff}.btn:disabled{opacity:.4;cursor:not-allowed}.btn:not(:disabled):active{transform:scale(.98)}.status-bar{margin:0;padding:10px 12px;border-radius:10px;background:#f4f1fa;color:#4c446b;font-size:.95rem;word-break:break-word} +:root{font-family:system-ui,-apple-system,Segoe UI,Roboto,sans-serif;line-height:1.5;color:#1e1b2e;background:#f4f1fa}*{box-sizing:border-box}body{margin:0;min-height:100dvh;display:flex;justify-content:center;padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left)}#app{width:100%;max-width:480px;padding:24px 16px 32px;display:flex;flex-direction:column;gap:16px}.app-header h1{margin:0;font-size:1.75rem;letter-spacing:.02em}.app-subtitle{margin:4px 0 0;color:#6d6390}.top-bar{display:flex;align-items:center;gap:12px}.burger-btn{width:44px;height:44px;border:2px solid #d9d2f0;border-radius:12px;background:#fff;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;touch-action:manipulation;flex:none}.burger-btn span{display:block;width:20px;height:2px;border-radius:2px;background:#4c446b}.burger-btn[aria-expanded=true]{border-color:#7c3aed}.top-bar-title h1{margin:0;font-size:1.4rem;line-height:1.2}.top-bar-title p{margin:0;font-size:.9rem;color:#6d6390}.top-bar-spacer{flex:1}.app-content{display:flex;flex-direction:column;gap:16px}.drawer-overlay{position:fixed;inset:0;background:#1e1b2e73;z-index:40}.drawer-overlay[hidden]{display:none}.drawer{position:fixed;top:0;left:0;bottom:0;width:min(300px,85vw);background:#fff;z-index:50;transform:translate(-105%);transition:transform .22s ease;display:flex;flex-direction:column;gap:8px;padding:20px 14px;box-shadow:8px 0 32px #1e1b2e2e}.drawer.open{transform:translate(0)}.drawer-header{padding:4px 8px 14px;border-bottom:1px solid #eee9fb;margin-bottom:8px}.drawer-logo{font-size:1.3rem;font-weight:800;color:#7c3aed}.drawer-subtitle{font-size:.9rem;color:#6d6390}.drawer-btn{border:none;background:transparent;text-align:left;font-size:1.05rem;font-weight:600;color:#1e1b2e;padding:13px 12px;border-radius:12px;cursor:pointer;touch-action:manipulation}.drawer-btn.active{background:#f1eafe;color:#6d28d9}.drawer-btn:active{background:#e9defc}body.drawer-open{overflow:hidden}.card{background:#fff;border-radius:16px;padding:20px 16px;box-shadow:0 8px 24px #7c3aed1f;display:flex;flex-direction:column;gap:12px}.card-title{margin:0;font-size:1.25rem}.card-hint{margin:0;color:#6d6390;font-size:.95rem}.field-label{font-weight:600;font-size:.95rem}.token-input{width:100%;padding:14px 12px;font-size:1.05rem;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.04em;border:2px solid #d9d2f0;border-radius:12px;outline:none}.token-input:focus{border-color:#7c3aed}.token-input.invalid{border-color:#dc2626;background:#fef2f2}.token-meta{display:flex;justify-content:space-between;align-items:baseline;gap:8px;min-height:1.4em}.token-error{color:#dc2626;font-size:.9rem}.token-counter{color:#6d6390;font-variant-numeric:tabular-nums;white-space:nowrap}.btn-row{display:flex;gap:12px}.btn{flex:1;padding:14px 12px;font-size:1rem;font-weight:600;border-radius:12px;border:2px solid #7c3aed;background:#fff;color:#7c3aed;cursor:pointer;touch-action:manipulation}.btn-primary{background:#7c3aed;color:#fff}.btn:disabled{opacity:.4;cursor:not-allowed}.btn:not(:disabled):active{transform:scale(.98)}.status-bar{margin:0;padding:10px 12px;border-radius:10px;background:#f4f1fa;color:#4c446b;font-size:.95rem;word-break:break-word}.status-bar[hidden]{display:none}.words-toolbar{display:flex;gap:8px}.words-search{flex:1;min-width:0;padding:12px;font-size:1rem;border:2px solid #d9d2f0;border-radius:12px;outline:none;background:#fff;color:inherit}.words-search:focus{border-color:#7c3aed}.words-group{flex:none;max-width:42%;padding:12px 8px;font-size:.95rem;font-weight:600;color:#4c446b;border:2px solid #d9d2f0;border-radius:12px;background:#fff;outline:none}.words-group:focus{border-color:#7c3aed}.words-list{display:flex;flex-direction:column;gap:10px}.word-card{border:1px solid #eee9fb;border-radius:12px;padding:12px;background:#fbfaff;display:flex;flex-direction:column;gap:8px}.word-card-top{display:flex;align-items:flex-start;justify-content:space-between;gap:8px}.word-key{font-size:1.2rem;font-weight:700;line-height:1.3;word-break:break-word}.word-value{font-size:1rem;color:#4c446b;word-break:break-word}.word-group{flex:none;font-size:.75rem;font-weight:700;color:#6d28d9;background:#f1eafe;border-radius:999px;padding:4px 10px;white-space:nowrap}.tag-row{display:flex;flex-wrap:wrap;gap:6px}.tag-chip{font-size:.8rem;font-weight:600;color:#5b21b6;background:#ede9fe;border-radius:999px;padding:3px 10px;word-break:break-word}.word-more{font-size:.9rem;color:#4c446b}.word-more summary{cursor:pointer;font-weight:600;color:#6d28d9;touch-action:manipulation}.word-more-list{margin:8px 0 0;display:flex;flex-direction:column;gap:6px}.word-more-row{background:#fff;border:1px solid #eee9fb;border-radius:8px;padding:8px 10px}.word-more-row dt{font-size:.8rem;font-weight:700;color:#6d6390}.word-more-row dd{margin:2px 0 0;word-break:break-word}.word-more-id{font-weight:400;opacity:.7} diff --git a/dist/assets/sqlite3-DBpDb1lf.wasm b/dist/assets/sqlite3-DBpDb1lf.wasm new file mode 100644 index 0000000..f001d7a Binary files /dev/null and b/dist/assets/sqlite3-DBpDb1lf.wasm differ diff --git a/dist/assets/sqlite3-opfs-async-proxy-B_ImRJXp.js b/dist/assets/sqlite3-opfs-async-proxy-B_ImRJXp.js new file mode 100644 index 0000000..54ced98 --- /dev/null +++ b/dist/assets/sqlite3-opfs-async-proxy-B_ImRJXp.js @@ -0,0 +1 @@ +const m=(w,...t)=>postMessage({type:w,payload:t}),Q=function(){const w=function(...e){throw new Error(e.join(" "))};globalThis.window===globalThis?w("This code cannot run from the main thread.","Load it as a Worker from a separate Worker."):navigator?.storage?.getDirectory||w("This API requires navigator.storage.getDirectory.");const t=Object.create(null);t.verbose=1;const v={0:console.error.bind(console),1:console.warn.bind(console),2:console.log.bind(console)},A=(e,...s)=>{t.verbose>e&&v[e]("OPFS asyncer:",...s)},g=(...e)=>A(2,...e),S=(...e)=>A(1,...e),h=(...e)=>A(0,...e),E=Object.create(null),I=new Set,k=function(e,s){const n=new URL(e,"file://irrelevant").pathname;return s?n.split("/").filter(o=>!!o):n},x=async function(s,n=!1){const o=k(s,!0),a=o.pop();let i=t.rootDir;for(const r of o)r&&(i=await i.getDirectoryHandle(r,{create:!!n}));return[i,a]},R=async e=>{if(e.syncHandle){g("Closing sync handle for",e.filenameAbs);const s=e.syncHandle;return delete e.syncHandle,delete e.xLock,I.delete(e.fid),s.close()}},F=async e=>{try{await R(e)}catch(s){S("closeSyncHandleNoThrow() ignoring:",s,e)}},D=async()=>{if(I.size)for(const e of I){const s=E[e];await F(s),g("Auto-unlocked",e,s.filenameAbs)}},T=async e=>{if(e.releaseImplicitLocks&&I.has(e.fid))return F(e)};class b extends Error{constructor(s,...n){super([...n,": "+s.name+":",s.message].join(" "),{cause:s}),this.name="GetSyncHandleError"}}b.convertRc=(e,s)=>{if(e instanceof b){if(e.cause.name==="NoModificationAllowedError"||e.cause.name==="DOMException"&&e.cause.message.indexOf("Access Handles cannot")===0)return t.sq3Codes.SQLITE_BUSY;if(e.cause.name==="NotFoundError")return t.sq3Codes.SQLITE_CANTOPEN}else if(e?.name==="NotFoundError")return t.sq3Codes.SQLITE_CANTOPEN;return s};const O=async(e,s)=>{if(!e.syncHandle){const n=performance.now();g("Acquiring sync handle for",e.filenameAbs);const o=6,a=t.asyncIdleWaitTime*2;let i=1,r=a;for(;;r=a*++i)try{e.syncHandle=await e.fileHandle.createSyncAccessHandle();break}catch(c){if(i===o)throw new b(c,"Error getting sync handle for",s+"().",o,"attempts failed.",e.filenameAbs);S("Error getting sync handle for",s+"(). Waiting",r,"ms and trying again.",e.filenameAbs,c),Atomics.wait(t.sabOPView,t.opIds.retry,0,r)}g("Got",s+"() sync handle for",e.filenameAbs,"in",performance.now()-n,"ms"),e.xLock||(I.add(e.fid),g("Acquired implicit lock for",s+"()",e.fid,e.filenameAbs))}return e.syncHandle},d=(e,s)=>{g(e+"() => notify(",s,")"),Atomics.store(t.sabOPView,t.opIds.rc,s),Atomics.notify(t.sabOPView,t.opIds.rc)},H=function(e,s){s.readOnly&&w(e+"(): File is read-only: "+s.filenameAbs)};let L=!1;const _={"opfs-async-shutdown":async()=>{L=!0,d("opfs-async-shutdown",0)},mkdir:async e=>{let s=0;try{await x(e+"/filepart",!0)}catch(n){t.s11n.storeException(2,n),s=t.sq3Codes.SQLITE_IOERR}d("mkdir",s)},xAccess:async e=>{let s=0;try{const[n,o]=await x(e);await n.getFileHandle(o)}catch(n){t.s11n.storeException(2,n),s=t.sq3Codes.SQLITE_IOERR}d("xAccess",s)},xClose:async function(e){const s="xClose";I.delete(e);const n=E[e];let o=0;if(n){if(delete E[e],await R(n),n.deleteOnClose)try{await n.dirHandle.removeEntry(n.filenamePart)}catch(a){S("Ignoring dirHandle.removeEntry() failure of",n,a)}}else t.s11n.serialize(),o=t.sq3Codes.SQLITE_NOTFOUND;d(s,o)},xDelete:async function(...e){const s=await _.xDeleteNoWait(...e);d("xDelete",s)},xDeleteNoWait:async function(e,s=0,n=!1){let o=0;try{for(;e;){const[a,i]=await x(e,!1);if(!i||(await a.removeEntry(i,{recursive:n}),s!==4660))break;n=!1,e=k(e,!0),e.pop(),e=e.join("/")}}catch(a){t.s11n.storeException(2,a),o=t.sq3Codes.SQLITE_IOERR_DELETE}return o},xFileSize:async function(e){const s=E[e];let n=0;try{const o=await(await O(s,"xFileSize")).getSize();t.s11n.serialize(Number(o))}catch(o){t.s11n.storeException(1,o),n=b.convertRc(o,t.sq3Codes.SQLITE_IOERR)}await T(s),d("xFileSize",n)},xLock:async function(e,s){const n=E[e];let o=0;const a=n.xLock;if(n.xLock=s,!n.syncHandle)try{await O(n,"xLock"),I.delete(e)}catch(i){t.s11n.storeException(1,i),o=b.convertRc(i,t.sq3Codes.SQLITE_IOERR_LOCK),n.xLock=a}d("xLock",o)},xOpen:async function(e,s,n,o){const a="xOpen",i=t.sq3Codes.SQLITE_OPEN_CREATE&n;try{let r,c;try{[r,c]=await x(s,!!i)}catch(f){t.s11n.storeException(1,f),d(a,t.sq3Codes.SQLITE_NOTFOUND);return}if(t.opfsFlags.OPFS_UNLINK_BEFORE_OPEN&o)try{await r.removeEntry(c)}catch{}const y=await r.getFileHandle(c,{create:i}),l=Object.assign(Object.create(null),{fid:e,filenameAbs:s,filenamePart:c,dirHandle:r,fileHandle:y,sabView:t.sabFileBufView,readOnly:!i&&!!(t.sq3Codes.SQLITE_OPEN_READONLY&n),deleteOnClose:!!(t.sq3Codes.SQLITE_OPEN_DELETEONCLOSE&n)});l.releaseImplicitLocks=o&t.opfsFlags.OPFS_UNLOCK_ASAP||t.opfsFlags.defaultUnlockAsap,E[e]=l,d(a,0)}catch(r){h(a,r),t.s11n.storeException(1,r),d(a,t.sq3Codes.SQLITE_IOERR)}},xRead:async function(e,s,n){let o=0,a;const i=E[e];try{a=(await O(i,"xRead")).read(i.sabView.subarray(0,s),{at:Number(n)}),a{if(t.s11n)return t.s11n;const e=new TextDecoder,s=new TextEncoder("utf-8"),n=new Uint8Array(t.sabIO,t.sabS11nOffset,t.sabS11nSize),o=new DataView(t.sabIO,t.sabS11nOffset,t.sabS11nSize);t.s11n=Object.create(null);const a=Object.create(null);a.number={id:1,size:8,getter:"getFloat64",setter:"setFloat64"},a.bigint={id:2,size:8,getter:"getBigInt64",setter:"setBigInt64"},a.boolean={id:3,size:4,getter:"getInt32",setter:"setInt32"},a.string={id:4};const i=c=>a[typeof c]||w("Maintenance required: this value type cannot be serialized.",c),r=c=>{switch(c){case a.number.id:return a.number;case a.bigint.id:return a.bigint;case a.boolean.id:return a.boolean;case a.string.id:return a.string;default:w("Invalid type ID:",c)}};return t.s11n.deserialize=function(c=!1){const y=n[0],l=y?[]:null;if(y){const f=[];let u=1,p,C,N;for(p=0;p{c<=t.asyncS11nExceptions&&t.s11n.serialize([y.name,": ",y.message].join(""))}:()=>{},t.s11n},q=async function(){const s=Object.create(null);for(let n of Object.keys(t.opIds)){const o=_[n];if(!o)continue;const a=Object.create(null);s[t.opIds[n]]=a,a.key=n,a.f=o}for(;!L;)try{if(Atomics.wait(t.sabOPView,t.opIds.whichOp,0,t.asyncIdleWaitTime)!=="not-equal"){await D();continue}const n=Atomics.load(t.sabOPView,t.opIds.whichOp);Atomics.store(t.sabOPView,t.opIds.whichOp,0);const o=s[n]??w("No waitLoop handler for whichOp #",n),a=t.s11n.deserialize(!0)||[];o.f?await o.f(...a):h("Missing callback for opId",n)}catch(n){h("in waitLoop():",n)}};navigator.storage.getDirectory().then(function(e){t.rootDir=e,globalThis.onmessage=function({data:s}){switch(s.type){case"opfs-async-init":{const n=s.args;for(const o in n)t[o]=n[o];t.verbose=n.verbose??1,t.sabOPView=new Int32Array(t.sabOP),t.sabFileBufView=new Uint8Array(t.sabIO,0,t.fileBufferSize),t.sabS11nView=new Uint8Array(t.sabIO,t.sabS11nOffset,t.sabS11nSize),Object.keys(_).forEach(o=>{Number.isFinite(t.opIds[o])||w("Maintenance required: missing state.opIds[",o,"]")}),z(),g("init state",t),m("opfs-async-inited"),q();break}case"opfs-async-restart":L&&(S("Restarting after opfs-async-shutdown. Might or might not work."),L=!1,q());break}},m("opfs-async-loaded")}).catch(e=>h("error initializing OPFS asyncer:",e))};globalThis.SharedArrayBuffer?globalThis.Atomics?!globalThis.FileSystemHandle||!globalThis.FileSystemDirectoryHandle||!globalThis.FileSystemFileHandle||!globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle||!navigator?.storage?.getDirectory?m("opfs-unavailable","Missing required OPFS APIs."):Q():m("opfs-unavailable","Missing Atomics API.","The server must emit the COOP/COEP response headers to enable that."):m("opfs-unavailable","Missing SharedArrayBuffer API.","The server must emit the COOP/COEP response headers to enable that."); diff --git a/dist/assets/sqlite3-worker1-bundler-friendly-CqPDHTTx.js b/dist/assets/sqlite3-worker1-bundler-friendly-CqPDHTTx.js new file mode 100644 index 0000000..223325b --- /dev/null +++ b/dist/assets/sqlite3-worker1-bundler-friendly-CqPDHTTx.js @@ -0,0 +1,3 @@ +var ot=(()=>{var Ie=import.meta.url;return function(qe={}){var be,i=qe,ve,Ee,$e=new Promise((e,t)=>{ve=e,Ee=t}),lt=typeof window=="object",Ue=typeof importScripts=="function";typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";const Tt=globalThis.sqlite3InitModuleState||Object.assign(Object.create(null),{debugModule:()=>{}});delete globalThis.sqlite3InitModuleState,Tt.debugModule("globalThis.location =",globalThis.location);var at=Object.assign({},i),ct="./this.program",ye="";function Ft(e){return i.locateFile?i.locateFile(e,ye):ye+e}var Ke,ze;(lt||Ue)&&(Ue?ye=self.location.href:typeof document<"u"&&document.currentScript&&(ye=document.currentScript.src),Ie&&(ye=Ie),ye.startsWith("blob:")?ye="":ye=ye.substr(0,ye.replace(/[?#].*/,"").lastIndexOf("/")+1),Ue&&(ze=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),Ke=e=>fetch(e,{credentials:"same-origin"}).then(t=>t.ok?t.arrayBuffer():Promise.reject(new Error(t.status+" : "+t.url))));var Je=i.print||console.log.bind(console),ke=i.printErr||console.error.bind(console);Object.assign(i,at),at=null,i.arguments&&i.arguments,i.thisProgram&&(ct=i.thisProgram);var Qe=i.wasmBinary,Te,_t=!1,ge,Pe,Ne,ce,he,xe;function ut(){var e=Te.buffer;i.HEAP8=ge=new Int8Array(e),i.HEAP16=Ne=new Int16Array(e),i.HEAPU8=Pe=new Uint8Array(e),i.HEAPU16=new Uint16Array(e),i.HEAP32=ce=new Int32Array(e),i.HEAPU32=he=new Uint32Array(e),i.HEAPF32=new Float32Array(e),i.HEAPF64=new Float64Array(e),i.HEAP64=xe=new BigInt64Array(e),i.HEAPU64=new BigUint64Array(e)}if(i.wasmMemory)Te=i.wasmMemory;else{var Ot=i.INITIAL_MEMORY||16777216;Te=new WebAssembly.Memory({initial:Ot/65536,maximum:32768})}ut();var ft=[],dt=[],pt=[];function Pt(){var e=i.preRun;e&&(typeof e=="function"&&(e=[e]),e.forEach(Dt)),et(ft)}function Lt(){!i.noFSInit&&!a.initialized&&a.init(),a.ignorePermissions=!1,et(dt)}function Ct(){var e=i.postRun;e&&(typeof e=="function"&&(e=[e]),e.forEach(Nt)),et(pt)}function Dt(e){ft.unshift(e)}function Rt(e){dt.unshift(e)}function Nt(e){pt.unshift(e)}var Fe=0,Me=null;function Zn(e){return e}function Xe(e){Fe++,i.monitorRunDependencies?.(Fe)}function We(e){if(Fe--,i.monitorRunDependencies?.(Fe),Fe==0&&Me){var t=Me;Me=null,t()}}function Ye(e){i.onAbort?.(e),e="Aborted("+e+")",ke(e),_t=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw Ee(t),t}var Mt="data:application/octet-stream;base64,",ht=e=>e.startsWith(Mt);function jt(){if(i.locateFile){var e="sqlite3.wasm";return ht(e)?e:Ft(e)}return new URL("/assets/sqlite3-DBpDb1lf.wasm",import.meta.url).href}var Ze;function mt(e){if(e==Ze&&Qe)return new Uint8Array(Qe);if(ze)return ze(e);throw"both async and sync fetching of the wasm failed"}function Bt(e){return Qe?Promise.resolve().then(()=>mt(e)):Ke(e).then(t=>new Uint8Array(t),()=>mt(e))}function gt(e,t,n){return Bt(e).then(r=>WebAssembly.instantiate(r,t)).then(n,r=>{ke(`failed to asynchronously prepare wasm: ${r}`),Ye(r)})}function Ut(e,t,n,r){return!e&&typeof WebAssembly.instantiateStreaming=="function"&&!ht(t)&&typeof fetch=="function"?fetch(t,{credentials:"same-origin"}).then(s=>{var o=WebAssembly.instantiateStreaming(s,n);return o.then(r,function(p){return ke(`wasm streaming compile failed: ${p}`),ke("falling back to ArrayBuffer instantiation"),gt(t,n,r)})}):gt(t,n,r)}function zt(){return{env:xt,wasi_snapshot_preview1:xt}}function Qt(){var e=zt();function t(r,s){return h=r.exports,Rt(h.__wasm_call_ctors),We(),h}Xe();function n(r){t(r.instance)}if(i.instantiateWasm)try{return i.instantiateWasm(e,t)}catch(r){ke(`Module.instantiateWasm callback failed with error: ${r}`),Ee(r)}return Ze??=jt(),Ut(Qe,Ze,e,n).catch(Ee),{}}var et=e=>{e.forEach(t=>t(i))};i.noExitRuntime;var _e={isAbs:e=>e.charAt(0)==="/",splitPath:e=>{var t=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;return t.exec(e).slice(1)},normalizeArray:(e,t)=>{for(var n=0,r=e.length-1;r>=0;r--){var s=e[r];s==="."?e.splice(r,1):s===".."?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n;n--)e.unshift("..");return e},normalize:e=>{var t=_e.isAbs(e),n=e.substr(-1)==="/";return e=_e.normalizeArray(e.split("/").filter(r=>!!r),!t).join("/"),!e&&!t&&(e="."),e&&n&&(e+="/"),(t?"/":"")+e},dirname:e=>{var t=_e.splitPath(e),n=t[0],r=t[1];return!n&&!r?".":(r&&(r=r.substr(0,r.length-1)),n+r)},basename:e=>{if(e==="/")return"/";e=_e.normalize(e),e=e.replace(/\/$/,"");var t=e.lastIndexOf("/");return t===-1?e:e.substr(t+1)},join:(...e)=>_e.normalize(e.join("/")),join2:(e,t)=>_e.normalize(e+"/"+t)},Wt=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return e=>crypto.getRandomValues(e);Ye("initRandomDevice")},qt=e=>(qt=Wt())(e),Se={resolve:(...e)=>{for(var t="",n=!1,r=e.length-1;r>=-1&&!n;r--){var s=r>=0?e[r]:a.cwd();if(typeof s!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!s)return"";t=s+"/"+t,n=_e.isAbs(s)}return t=_e.normalizeArray(t.split("/").filter(o=>!!o),!n).join("/"),(n?"/":"")+t||"."},relative:(e,t)=>{e=Se.resolve(e).substr(1),t=Se.resolve(t).substr(1);function n(R){for(var z=0;z=0&&R[W]==="";W--);return z>W?[]:R.slice(z,W-z+1)}for(var r=n(e.split("/")),s=n(t.split("/")),o=Math.min(r.length,s.length),p=o,g=0;g{for(var r=t+n,s=t;e[s]&&!(s>=r);)++s;if(s-t>16&&e.buffer&&bt)return bt.decode(e.subarray(t,s));for(var o="";t>10,56320|R&1023)}}return o},tt=[],He=e=>{for(var t=0,n=0;n=55296&&r<=57343?(t+=4,++n):t+=3}return t},nt=(e,t,n,r)=>{if(!(r>0))return 0;for(var s=n,o=n+r-1,p=0;p=55296&&g<=57343){var O=e.charCodeAt(++p);g=65536+((g&1023)<<10)|O&1023}if(g<=127){if(n>=o)break;t[n++]=g}else if(g<=2047){if(n+1>=o)break;t[n++]=192|g>>6,t[n++]=128|g&63}else if(g<=65535){if(n+2>=o)break;t[n++]=224|g>>12,t[n++]=128|g>>6&63,t[n++]=128|g&63}else{if(n+3>=o)break;t[n++]=240|g>>18,t[n++]=128|g>>12&63,t[n++]=128|g>>6&63,t[n++]=128|g&63}}return t[n]=0,n-s};function yt(e,t,n){var r=He(e)+1,s=new Array(r),o=nt(e,s,0,s.length);return s.length=o,s}var Ht=()=>{if(!tt.length){var e=null;if(typeof window<"u"&&typeof window.prompt=="function"&&(e=window.prompt("Input: "),e!==null&&(e+=` +`)),!e)return null;tt=yt(e)}return tt.shift()},Oe={ttys:[],init(){},shutdown(){},register(e,t){Oe.ttys[e]={input:[],output:[],ops:t},a.registerDevice(e,Oe.stream_ops)},stream_ops:{open(e){var t=Oe.ttys[e.node.rdev];if(!t)throw new a.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,n,r,s){if(!e.tty||!e.tty.ops.get_char)throw new a.ErrnoError(60);for(var o=0,p=0;p0&&(Je(Le(e.output)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,t,n){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,t){t===null||t===10?(ke(Le(e.output)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(ke(Le(e.output)),e.output=[])}}},Vt=(e,t)=>{Pe.fill(0,e,e+t)},wt=(e,t)=>Math.ceil(e/t)*t,vt=e=>{e=wt(e,65536);var t=St(65536,e);return t&&Vt(t,e),t},ie={ops_table:null,mount(e){return ie.createNode(null,"/",16895,0)},createNode(e,t,n,r){if(a.isBlkdev(n)||a.isFIFO(n))throw new a.ErrnoError(63);ie.ops_table||={dir:{node:{getattr:ie.node_ops.getattr,setattr:ie.node_ops.setattr,lookup:ie.node_ops.lookup,mknod:ie.node_ops.mknod,rename:ie.node_ops.rename,unlink:ie.node_ops.unlink,rmdir:ie.node_ops.rmdir,readdir:ie.node_ops.readdir,symlink:ie.node_ops.symlink},stream:{llseek:ie.stream_ops.llseek}},file:{node:{getattr:ie.node_ops.getattr,setattr:ie.node_ops.setattr},stream:{llseek:ie.stream_ops.llseek,read:ie.stream_ops.read,write:ie.stream_ops.write,allocate:ie.stream_ops.allocate,mmap:ie.stream_ops.mmap,msync:ie.stream_ops.msync}},link:{node:{getattr:ie.node_ops.getattr,setattr:ie.node_ops.setattr,readlink:ie.node_ops.readlink},stream:{}},chrdev:{node:{getattr:ie.node_ops.getattr,setattr:ie.node_ops.setattr},stream:a.chrdev_stream_ops}};var s=a.createNode(e,t,n,r);return a.isDir(s.mode)?(s.node_ops=ie.ops_table.dir.node,s.stream_ops=ie.ops_table.dir.stream,s.contents={}):a.isFile(s.mode)?(s.node_ops=ie.ops_table.file.node,s.stream_ops=ie.ops_table.file.stream,s.usedBytes=0,s.contents=null):a.isLink(s.mode)?(s.node_ops=ie.ops_table.link.node,s.stream_ops=ie.ops_table.link.stream):a.isChrdev(s.mode)&&(s.node_ops=ie.ops_table.chrdev.node,s.stream_ops=ie.ops_table.chrdev.stream),s.timestamp=Date.now(),e&&(e.contents[t]=s,e.timestamp=s.timestamp),s},getFileDataAsTypedArray(e){return e.contents?e.contents.subarray?e.contents.subarray(0,e.usedBytes):new Uint8Array(e.contents):new Uint8Array(0)},expandFileStorage(e,t){var n=e.contents?e.contents.length:0;if(!(n>=t)){var r=1024*1024;t=Math.max(t,n*(n>>0),n!=0&&(t=Math.max(t,256));var s=e.contents;e.contents=new Uint8Array(t),e.usedBytes>0&&e.contents.set(s.subarray(0,e.usedBytes),0)}},resizeFileStorage(e,t){if(e.usedBytes!=t)if(t==0)e.contents=null,e.usedBytes=0;else{var n=e.contents;e.contents=new Uint8Array(t),n&&e.contents.set(n.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=a.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,a.isDir(e.mode)?t.size=4096:a.isFile(e.mode)?t.size=e.usedBytes:a.isLink(e.mode)?t.size=e.link.length:t.size=0,t.atime=new Date(e.timestamp),t.mtime=new Date(e.timestamp),t.ctime=new Date(e.timestamp),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){t.mode!==void 0&&(e.mode=t.mode),t.timestamp!==void 0&&(e.timestamp=t.timestamp),t.size!==void 0&&ie.resizeFileStorage(e,t.size)},lookup(e,t){throw a.genericErrors[44]},mknod(e,t,n,r){return ie.createNode(e,t,n,r)},rename(e,t,n){if(a.isDir(e.mode)){var r;try{r=a.lookupNode(t,n)}catch{}if(r)for(var s in r.contents)throw new a.ErrnoError(55)}delete e.parent.contents[e.name],e.parent.timestamp=Date.now(),e.name=n,t.contents[n]=e,t.timestamp=e.parent.timestamp},unlink(e,t){delete e.contents[t],e.timestamp=Date.now()},rmdir(e,t){var n=a.lookupNode(e,t);for(var r in n.contents)throw new a.ErrnoError(55);delete e.contents[t],e.timestamp=Date.now()},readdir(e){var t=[".",".."];for(var n of Object.keys(e.contents))t.push(n);return t},symlink(e,t,n){var r=ie.createNode(e,t,41471,0);return r.link=n,r},readlink(e){if(!a.isLink(e.mode))throw new a.ErrnoError(28);return e.link}},stream_ops:{read(e,t,n,r,s){var o=e.node.contents;if(s>=e.node.usedBytes)return 0;var p=Math.min(e.node.usedBytes-s,r);if(p>8&&o.subarray)t.set(o.subarray(s,s+p),n);else for(var g=0;g0||n+t{var s=`al ${e}`;Ke(e).then(o=>{t(new Uint8Array(o)),s&&We()},o=>{if(n)n();else throw`Loading data file "${e}" failed.`}),s&&Xe()},$t=(e,t,n,r,s,o)=>{a.createDataFile(e,t,n,r,s,o)},Kt=i.preloadPlugins||[],Jt=(e,t,n,r)=>{typeof Browser<"u"&&Browser.init();var s=!1;return Kt.forEach(o=>{s||o.canHandle(t)&&(o.handle(e,t,n,r),s=!0)}),s},Xt=(e,t,n,r,s,o,p,g,O,R)=>{var z=t?Se.resolve(_e.join2(e,t)):e;function W(T){function A(D){R?.(),g||$t(e,t,D,r,s,O),o?.(),We()}Jt(T,z,A,()=>{p?.(),We()})||A(T)}Xe(),typeof n=="string"?Gt(n,W,p):W(n)},Yt=e=>{var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090},n=t[e];if(typeof n>"u")throw new Error(`Unknown file open mode: ${e}`);return n},rt=(e,t)=>{var n=0;return e&&(n|=365),t&&(n|=146),n},a={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,ErrnoError:class{constructor(e){this.name="ErrnoError",this.errno=e}},genericErrors:{},filesystems:null,syncFSRequests:0,readFiles:{},FSStream:class{constructor(){this.shared={}}get object(){return this.node}set object(e){this.node=e}get isRead(){return(this.flags&2097155)!==1}get isWrite(){return(this.flags&2097155)!==0}get isAppend(){return this.flags&1024}get flags(){return this.shared.flags}set flags(e){this.shared.flags=e}get position(){return this.shared.position}set position(e){this.shared.position=e}},FSNode:class{constructor(e,t,n,r){e||(e=this),this.parent=e,this.mount=e.mount,this.mounted=null,this.id=a.nextInode++,this.name=t,this.mode=n,this.node_ops={},this.stream_ops={},this.rdev=r,this.readMode=365,this.writeMode=146}get read(){return(this.mode&this.readMode)===this.readMode}set read(e){e?this.mode|=this.readMode:this.mode&=~this.readMode}get write(){return(this.mode&this.writeMode)===this.writeMode}set write(e){e?this.mode|=this.writeMode:this.mode&=~this.writeMode}get isFolder(){return a.isDir(this.mode)}get isDevice(){return a.isChrdev(this.mode)}},lookupPath(e,t={}){if(e=Se.resolve(e),!e)return{path:"",node:null};var n={follow_mount:!0,recurse_count:0};if(t=Object.assign(n,t),t.recurse_count>8)throw new a.ErrnoError(32);for(var r=e.split("/").filter(W=>!!W),s=a.root,o="/",p=0;p40)throw new a.ErrnoError(32)}}return{path:o,node:s}},getPath(e){for(var t;;){if(a.isRoot(e)){var n=e.mount.mountpoint;return t?n[n.length-1]!=="/"?`${n}/${t}`:n+t:n}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var n=0,r=0;r>>0)%a.nameTable.length},hashAddNode(e){var t=a.hashName(e.parent.id,e.name);e.name_next=a.nameTable[t],a.nameTable[t]=e},hashRemoveNode(e){var t=a.hashName(e.parent.id,e.name);if(a.nameTable[t]===e)a.nameTable[t]=e.name_next;else for(var n=a.nameTable[t];n;){if(n.name_next===e){n.name_next=e.name_next;break}n=n.name_next}},lookupNode(e,t){var n=a.mayLookup(e);if(n)throw new a.ErrnoError(n);for(var r=a.hashName(e.id,t),s=a.nameTable[r];s;s=s.name_next){var o=s.name;if(s.parent.id===e.id&&o===t)return s}return a.lookup(e,t)},createNode(e,t,n,r){var s=new a.FSNode(e,t,n,r);return a.hashAddNode(s),s},destroyNode(e){a.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)===32768},isDir(e){return(e&61440)===16384},isLink(e){return(e&61440)===40960},isChrdev(e){return(e&61440)===8192},isBlkdev(e){return(e&61440)===24576},isFIFO(e){return(e&61440)===4096},isSocket(e){return(e&49152)===49152},flagsToPermissionString(e){var t=["r","w","rw"][e&3];return e&512&&(t+="w"),t},nodePermissions(e,t){return a.ignorePermissions?0:t.includes("r")&&!(e.mode&292)||t.includes("w")&&!(e.mode&146)||t.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!a.isDir(e.mode))return 54;var t=a.nodePermissions(e,"x");return t||(e.node_ops.lookup?0:2)},mayCreate(e,t){try{var n=a.lookupNode(e,t);return 20}catch{}return a.nodePermissions(e,"wx")},mayDelete(e,t,n){var r;try{r=a.lookupNode(e,t)}catch(o){return o.errno}var s=a.nodePermissions(e,"wx");if(s)return s;if(n){if(!a.isDir(r.mode))return 54;if(a.isRoot(r)||a.getPath(r)===a.cwd())return 10}else if(a.isDir(r.mode))return 31;return 0},mayOpen(e,t){return e?a.isLink(e.mode)?32:a.isDir(e.mode)&&(a.flagsToPermissionString(t)!=="r"||t&512)?31:a.nodePermissions(e,a.flagsToPermissionString(t)):44},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=a.MAX_OPEN_FDS;e++)if(!a.streams[e])return e;throw new a.ErrnoError(33)},getStreamChecked(e){var t=a.getStream(e);if(!t)throw new a.ErrnoError(8);return t},getStream:e=>a.streams[e],createStream(e,t=-1){return e=Object.assign(new a.FSStream,e),t==-1&&(t=a.nextfd()),e.fd=t,a.streams[t]=e,e},closeStream(e){a.streams[e]=null},dupStream(e,t=-1){var n=a.createStream(e,t);return n.stream_ops?.dup?.(n),n},chrdev_stream_ops:{open(e){var t=a.getDevice(e.node.rdev);e.stream_ops=t.stream_ops,e.stream_ops.open?.(e)},llseek(){throw new a.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,t)=>e<<8|t,registerDevice(e,t){a.devices[e]={stream_ops:t}},getDevice:e=>a.devices[e],getMounts(e){for(var t=[],n=[e];n.length;){var r=n.pop();t.push(r),n.push(...r.mounts)}return t},syncfs(e,t){typeof e=="function"&&(t=e,e=!1),a.syncFSRequests++,a.syncFSRequests>1&&ke(`warning: ${a.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var n=a.getMounts(a.root.mount),r=0;function s(p){return a.syncFSRequests--,t(p)}function o(p){if(p)return o.errored?void 0:(o.errored=!0,s(p));++r>=n.length&&s(null)}n.forEach(p=>{if(!p.type.syncfs)return o(null);p.type.syncfs(p,e,o)})},mount(e,t,n){var r=n==="/",s=!n,o;if(r&&a.root)throw new a.ErrnoError(10);if(!r&&!s){var p=a.lookupPath(n,{follow_mount:!1});if(n=p.path,o=p.node,a.isMountpoint(o))throw new a.ErrnoError(10);if(!a.isDir(o.mode))throw new a.ErrnoError(54)}var g={type:e,opts:t,mountpoint:n,mounts:[]},O=e.mount(g);return O.mount=g,g.root=O,r?a.root=O:o&&(o.mounted=g,o.mount&&o.mount.mounts.push(g)),O},unmount(e){var t=a.lookupPath(e,{follow_mount:!1});if(!a.isMountpoint(t.node))throw new a.ErrnoError(28);var n=t.node,r=n.mounted,s=a.getMounts(r);Object.keys(a.nameTable).forEach(p=>{for(var g=a.nameTable[p];g;){var O=g.name_next;s.includes(g.mount)&&a.destroyNode(g),g=O}}),n.mounted=null;var o=n.mount.mounts.indexOf(r);n.mount.mounts.splice(o,1)},lookup(e,t){return e.node_ops.lookup(e,t)},mknod(e,t,n){var r=a.lookupPath(e,{parent:!0}),s=r.node,o=_e.basename(e);if(!o||o==="."||o==="..")throw new a.ErrnoError(28);var p=a.mayCreate(s,o);if(p)throw new a.ErrnoError(p);if(!s.node_ops.mknod)throw new a.ErrnoError(63);return s.node_ops.mknod(s,o,t,n)},create(e,t){return t=t!==void 0?t:438,t&=4095,t|=32768,a.mknod(e,t,0)},mkdir(e,t){return t=t!==void 0?t:511,t&=1023,t|=16384,a.mknod(e,t,0)},mkdirTree(e,t){for(var n=e.split("/"),r="",s=0;s"u"&&(n=t,t=438),t|=8192,a.mknod(e,t,n)},symlink(e,t){if(!Se.resolve(e))throw new a.ErrnoError(44);var n=a.lookupPath(t,{parent:!0}),r=n.node;if(!r)throw new a.ErrnoError(44);var s=_e.basename(t),o=a.mayCreate(r,s);if(o)throw new a.ErrnoError(o);if(!r.node_ops.symlink)throw new a.ErrnoError(63);return r.node_ops.symlink(r,s,e)},rename(e,t){var n=_e.dirname(e),r=_e.dirname(t),s=_e.basename(e),o=_e.basename(t),p,g,O;if(p=a.lookupPath(e,{parent:!0}),g=p.node,p=a.lookupPath(t,{parent:!0}),O=p.node,!g||!O)throw new a.ErrnoError(44);if(g.mount!==O.mount)throw new a.ErrnoError(75);var R=a.lookupNode(g,s),z=Se.relative(e,r);if(z.charAt(0)!==".")throw new a.ErrnoError(28);if(z=Se.relative(t,n),z.charAt(0)!==".")throw new a.ErrnoError(55);var W;try{W=a.lookupNode(O,o)}catch{}if(R!==W){var T=a.isDir(R.mode),A=a.mayDelete(g,s,T);if(A)throw new a.ErrnoError(A);if(A=W?a.mayDelete(O,o,T):a.mayCreate(O,o),A)throw new a.ErrnoError(A);if(!g.node_ops.rename)throw new a.ErrnoError(63);if(a.isMountpoint(R)||W&&a.isMountpoint(W))throw new a.ErrnoError(10);if(O!==g&&(A=a.nodePermissions(g,"w"),A))throw new a.ErrnoError(A);a.hashRemoveNode(R);try{g.node_ops.rename(R,O,o),R.parent=O}catch(D){throw D}finally{a.hashAddNode(R)}}},rmdir(e){var t=a.lookupPath(e,{parent:!0}),n=t.node,r=_e.basename(e),s=a.lookupNode(n,r),o=a.mayDelete(n,r,!0);if(o)throw new a.ErrnoError(o);if(!n.node_ops.rmdir)throw new a.ErrnoError(63);if(a.isMountpoint(s))throw new a.ErrnoError(10);n.node_ops.rmdir(n,r),a.destroyNode(s)},readdir(e){var t=a.lookupPath(e,{follow:!0}),n=t.node;if(!n.node_ops.readdir)throw new a.ErrnoError(54);return n.node_ops.readdir(n)},unlink(e){var t=a.lookupPath(e,{parent:!0}),n=t.node;if(!n)throw new a.ErrnoError(44);var r=_e.basename(e),s=a.lookupNode(n,r),o=a.mayDelete(n,r,!1);if(o)throw new a.ErrnoError(o);if(!n.node_ops.unlink)throw new a.ErrnoError(63);if(a.isMountpoint(s))throw new a.ErrnoError(10);n.node_ops.unlink(n,r),a.destroyNode(s)},readlink(e){var t=a.lookupPath(e),n=t.node;if(!n)throw new a.ErrnoError(44);if(!n.node_ops.readlink)throw new a.ErrnoError(28);return Se.resolve(a.getPath(n.parent),n.node_ops.readlink(n))},stat(e,t){var n=a.lookupPath(e,{follow:!t}),r=n.node;if(!r)throw new a.ErrnoError(44);if(!r.node_ops.getattr)throw new a.ErrnoError(63);return r.node_ops.getattr(r)},lstat(e){return a.stat(e,!0)},chmod(e,t,n){var r;if(typeof e=="string"){var s=a.lookupPath(e,{follow:!n});r=s.node}else r=e;if(!r.node_ops.setattr)throw new a.ErrnoError(63);r.node_ops.setattr(r,{mode:t&4095|r.mode&-4096,timestamp:Date.now()})},lchmod(e,t){a.chmod(e,t,!0)},fchmod(e,t){var n=a.getStreamChecked(e);a.chmod(n.node,t)},chown(e,t,n,r){var s;if(typeof e=="string"){var o=a.lookupPath(e,{follow:!r});s=o.node}else s=e;if(!s.node_ops.setattr)throw new a.ErrnoError(63);s.node_ops.setattr(s,{timestamp:Date.now()})},lchown(e,t,n){a.chown(e,t,n,!0)},fchown(e,t,n){var r=a.getStreamChecked(e);a.chown(r.node,t,n)},truncate(e,t){if(t<0)throw new a.ErrnoError(28);var n;if(typeof e=="string"){var r=a.lookupPath(e,{follow:!0});n=r.node}else n=e;if(!n.node_ops.setattr)throw new a.ErrnoError(63);if(a.isDir(n.mode))throw new a.ErrnoError(31);if(!a.isFile(n.mode))throw new a.ErrnoError(28);var s=a.nodePermissions(n,"w");if(s)throw new a.ErrnoError(s);n.node_ops.setattr(n,{size:t,timestamp:Date.now()})},ftruncate(e,t){var n=a.getStreamChecked(e);if((n.flags&2097155)===0)throw new a.ErrnoError(28);a.truncate(n.node,t)},utime(e,t,n){var r=a.lookupPath(e,{follow:!0}),s=r.node;s.node_ops.setattr(s,{timestamp:Math.max(t,n)})},open(e,t,n){if(e==="")throw new a.ErrnoError(44);t=typeof t=="string"?Yt(t):t,t&64?(n=typeof n>"u"?438:n,n=n&4095|32768):n=0;var r;if(typeof e=="object")r=e;else{e=_e.normalize(e);try{var s=a.lookupPath(e,{follow:!(t&131072)});r=s.node}catch{}}var o=!1;if(t&64)if(r){if(t&128)throw new a.ErrnoError(20)}else r=a.mknod(e,n,0),o=!0;if(!r)throw new a.ErrnoError(44);if(a.isChrdev(r.mode)&&(t&=-513),t&65536&&!a.isDir(r.mode))throw new a.ErrnoError(54);if(!o){var p=a.mayOpen(r,t);if(p)throw new a.ErrnoError(p)}t&512&&!o&&a.truncate(r,0),t&=-131713;var g=a.createStream({node:r,path:a.getPath(r),flags:t,seekable:!0,position:0,stream_ops:r.stream_ops,ungotten:[],error:!1});return g.stream_ops.open&&g.stream_ops.open(g),i.logReadFiles&&!(t&1)&&(e in a.readFiles||(a.readFiles[e]=1)),g},close(e){if(a.isClosed(e))throw new a.ErrnoError(8);e.getdents&&(e.getdents=null);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(t){throw t}finally{a.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,t,n){if(a.isClosed(e))throw new a.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new a.ErrnoError(70);if(n!=0&&n!=1&&n!=2)throw new a.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,n),e.ungotten=[],e.position},read(e,t,n,r,s){if(r<0||s<0)throw new a.ErrnoError(28);if(a.isClosed(e))throw new a.ErrnoError(8);if((e.flags&2097155)===1)throw new a.ErrnoError(8);if(a.isDir(e.node.mode))throw new a.ErrnoError(31);if(!e.stream_ops.read)throw new a.ErrnoError(28);var o=typeof s<"u";if(!o)s=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var p=e.stream_ops.read(e,t,n,r,s);return o||(e.position+=p),p},write(e,t,n,r,s,o){if(r<0||s<0)throw new a.ErrnoError(28);if(a.isClosed(e))throw new a.ErrnoError(8);if((e.flags&2097155)===0)throw new a.ErrnoError(8);if(a.isDir(e.node.mode))throw new a.ErrnoError(31);if(!e.stream_ops.write)throw new a.ErrnoError(28);e.seekable&&e.flags&1024&&a.llseek(e,0,2);var p=typeof s<"u";if(!p)s=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var g=e.stream_ops.write(e,t,n,r,s,o);return p||(e.position+=g),g},allocate(e,t,n){if(a.isClosed(e))throw new a.ErrnoError(8);if(t<0||n<=0)throw new a.ErrnoError(28);if((e.flags&2097155)===0)throw new a.ErrnoError(8);if(!a.isFile(e.node.mode)&&!a.isDir(e.node.mode))throw new a.ErrnoError(43);if(!e.stream_ops.allocate)throw new a.ErrnoError(138);e.stream_ops.allocate(e,t,n)},mmap(e,t,n,r,s){if((r&2)!==0&&(s&2)===0&&(e.flags&2097155)!==2)throw new a.ErrnoError(2);if((e.flags&2097155)===1)throw new a.ErrnoError(2);if(!e.stream_ops.mmap)throw new a.ErrnoError(43);if(!t)throw new a.ErrnoError(28);return e.stream_ops.mmap(e,t,n,r,s)},msync(e,t,n,r,s){return e.stream_ops.msync?e.stream_ops.msync(e,t,n,r,s):0},ioctl(e,t,n){if(!e.stream_ops.ioctl)throw new a.ErrnoError(59);return e.stream_ops.ioctl(e,t,n)},readFile(e,t={}){if(t.flags=t.flags||0,t.encoding=t.encoding||"binary",t.encoding!=="utf8"&&t.encoding!=="binary")throw new Error(`Invalid encoding type "${t.encoding}"`);var n,r=a.open(e,t.flags),s=a.stat(e),o=s.size,p=new Uint8Array(o);return a.read(r,p,0,o,0),t.encoding==="utf8"?n=Le(p):t.encoding==="binary"&&(n=p),a.close(r),n},writeFile(e,t,n={}){n.flags=n.flags||577;var r=a.open(e,n.flags,n.mode);if(typeof t=="string"){var s=new Uint8Array(He(t)+1),o=nt(t,s,0,s.length);a.write(r,s,0,o,void 0,n.canOwn)}else if(ArrayBuffer.isView(t))a.write(r,t,0,t.byteLength,void 0,n.canOwn);else throw new Error("Unsupported data type");a.close(r)},cwd:()=>a.currentPath,chdir(e){var t=a.lookupPath(e,{follow:!0});if(t.node===null)throw new a.ErrnoError(44);if(!a.isDir(t.node.mode))throw new a.ErrnoError(54);var n=a.nodePermissions(t.node,"x");if(n)throw new a.ErrnoError(n);a.currentPath=t.path},createDefaultDirectories(){a.mkdir("/tmp"),a.mkdir("/home"),a.mkdir("/home/web_user")},createDefaultDevices(){a.mkdir("/dev"),a.registerDevice(a.makedev(1,3),{read:()=>0,write:(r,s,o,p,g)=>p}),a.mkdev("/dev/null",a.makedev(1,3)),Oe.register(a.makedev(5,0),Oe.default_tty_ops),Oe.register(a.makedev(6,0),Oe.default_tty1_ops),a.mkdev("/dev/tty",a.makedev(5,0)),a.mkdev("/dev/tty1",a.makedev(6,0));var e=new Uint8Array(1024),t=0,n=()=>(t===0&&(t=qt(e).byteLength),e[--t]);a.createDevice("/dev","random",n),a.createDevice("/dev","urandom",n),a.mkdir("/dev/shm"),a.mkdir("/dev/shm/tmp")},createSpecialDirectories(){a.mkdir("/proc");var e=a.mkdir("/proc/self");a.mkdir("/proc/self/fd"),a.mount({mount(){var t=a.createNode(e,"fd",16895,73);return t.node_ops={lookup(n,r){var s=+r,o=a.getStreamChecked(s),p={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>o.path}};return p.parent=p,p}},t}},{},"/proc/self/fd")},createStandardStreams(e,t,n){e?a.createDevice("/dev","stdin",e):a.symlink("/dev/tty","/dev/stdin"),t?a.createDevice("/dev","stdout",null,t):a.symlink("/dev/tty","/dev/stdout"),n?a.createDevice("/dev","stderr",null,n):a.symlink("/dev/tty1","/dev/stderr"),a.open("/dev/stdin",0),a.open("/dev/stdout",1),a.open("/dev/stderr",1)},staticInit(){[44].forEach(e=>{a.genericErrors[e]=new a.ErrnoError(e),a.genericErrors[e].stack=""}),a.nameTable=new Array(4096),a.mount(ie,{},"/"),a.createDefaultDirectories(),a.createDefaultDevices(),a.createSpecialDirectories(),a.filesystems={MEMFS:ie}},init(e,t,n){a.initialized=!0,e??=i.stdin,t??=i.stdout,n??=i.stderr,a.createStandardStreams(e,t,n)},quit(){a.initialized=!1;for(var e=0;ethis.length-1||A<0)){var D=A%this.chunkSize,q=A/this.chunkSize|0;return this.getter(q)[D]}}setDataGetter(A){this.getter=A}cacheLength(){var A=new XMLHttpRequest;if(A.open("HEAD",n,!1),A.send(null),!(A.status>=200&&A.status<300||A.status===304))throw new Error("Couldn't load "+n+". Status: "+A.status);var D=Number(A.getResponseHeader("Content-length")),q,w=(q=A.getResponseHeader("Accept-Ranges"))&&q==="bytes",x=(q=A.getResponseHeader("Content-Encoding"))&&q==="gzip",N=1024*1024;w||(N=D);var P=(L,$)=>{if(L>$)throw new Error("invalid range ("+L+", "+$+") or no bytes requested!");if($>D-1)throw new Error("only "+D+" bytes available! programmer error!");var c=new XMLHttpRequest;if(c.open("GET",n,!1),D!==N&&c.setRequestHeader("Range","bytes="+L+"-"+$),c.responseType="arraybuffer",c.overrideMimeType&&c.overrideMimeType("text/plain; charset=x-user-defined"),c.send(null),!(c.status>=200&&c.status<300||c.status===304))throw new Error("Couldn't load "+n+". Status: "+c.status);return c.response!==void 0?new Uint8Array(c.response||[]):yt(c.responseText||"")},S=this;S.setDataGetter(L=>{var $=L*N,c=(L+1)*N-1;if(c=Math.min(c,D-1),typeof S.chunks[L]>"u"&&(S.chunks[L]=P($,c)),typeof S.chunks[L]>"u")throw new Error("doXHR failed!");return S.chunks[L]}),(x||!D)&&(N=D=1,D=this.getter(0).length,N=D,Je("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=D,this._chunkSize=N,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(typeof XMLHttpRequest<"u"){if(!Ue)throw"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc";var p=new o,g={isDevice:!1,contents:p}}else var g={isDevice:!1,url:n};var O=a.createFile(e,t,g,r,s);g.contents?O.contents=g.contents:g.url&&(O.contents=null,O.url=g.url),Object.defineProperties(O,{usedBytes:{get:function(){return this.contents.length}}});var R={},z=Object.keys(O.stream_ops);z.forEach(T=>{var A=O.stream_ops[T];R[T]=(...D)=>(a.forceLoadFile(O),A(...D))});function W(T,A,D,q,w){var x=T.node.contents;if(w>=x.length)return 0;var N=Math.min(x.length-w,q);if(x.slice)for(var P=0;P(a.forceLoadFile(O),W(T,A,D,q,w)),R.mmap=(T,A,D,q,w)=>{a.forceLoadFile(O);var x=vt(A);if(!x)throw new a.ErrnoError(48);return W(T,ge,x,A,D),{ptr:x,allocated:!0}},O.stream_ops=R,O}},Zt=(e,t)=>e?Le(Pe,e,t):"",le={DEFAULT_POLLMASK:5,calculateAt(e,t,n){if(_e.isAbs(t))return t;var r;if(e===-100)r=a.cwd();else{var s=le.getStreamFromFD(e);r=s.path}if(t.length==0){if(!n)throw new a.ErrnoError(44);return r}return _e.join2(r,t)},doStat(e,t,n){var r=e(t);ce[n>>2]=r.dev,ce[n+4>>2]=r.mode,he[n+8>>2]=r.nlink,ce[n+12>>2]=r.uid,ce[n+16>>2]=r.gid,ce[n+20>>2]=r.rdev,xe[n+24>>3]=BigInt(r.size),ce[n+32>>2]=4096,ce[n+36>>2]=r.blocks;var s=r.atime.getTime(),o=r.mtime.getTime(),p=r.ctime.getTime();return xe[n+40>>3]=BigInt(Math.floor(s/1e3)),he[n+48>>2]=s%1e3*1e3*1e3,xe[n+56>>3]=BigInt(Math.floor(o/1e3)),he[n+64>>2]=o%1e3*1e3*1e3,xe[n+72>>3]=BigInt(Math.floor(p/1e3)),he[n+80>>2]=p%1e3*1e3*1e3,xe[n+88>>3]=BigInt(r.ino),0},doMsync(e,t,n,r,s){if(!a.isFile(t.node.mode))throw new a.ErrnoError(43);if(r&2)return 0;var o=Pe.slice(e,e+n);a.msync(t,o,s,n,r)},getStreamFromFD(e){var t=a.getStreamChecked(e);return t},varargs:void 0,getStr(e){var t=Zt(e);return t}};function en(e,t){try{return e=le.getStr(e),a.chmod(e,t),0}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}function tn(e,t,n,r){try{if(t=le.getStr(t),t=le.calculateAt(e,t),n&-8)return-28;var s=a.lookupPath(t,{follow:!0}),o=s.node;if(!o)return-44;var p="";return n&4&&(p+="r"),n&2&&(p+="w"),n&1&&(p+="x"),p&&a.nodePermissions(o,p)?-2:0}catch(g){if(typeof a>"u"||g.name!=="ErrnoError")throw g;return-g.errno}}function nn(e,t){try{return a.fchmod(e,t),0}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}function rn(e,t,n){try{return a.fchown(e,t,n),0}catch(r){if(typeof a>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}function Ve(){var e=ce[+le.varargs>>2];return le.varargs+=4,e}var Ce=Ve;function sn(e,t,n){le.varargs=n;try{var r=le.getStreamFromFD(e);switch(t){case 0:{var s=Ve();if(s<0)return-28;for(;a.streams[s];)s++;var o;return o=a.dupStream(r,s),o.fd}case 1:case 2:return 0;case 3:return r.flags;case 4:{var s=Ve();return r.flags|=s,0}case 12:{var s=Ce(),p=0;return Ne[s+p>>1]=2,0}case 13:case 14:return 0}return-28}catch(g){if(typeof a>"u"||g.name!=="ErrnoError")throw g;return-g.errno}}function on(e,t){try{var n=le.getStreamFromFD(e);return le.doStat(a.stat,n.path,t)}catch(r){if(typeof a>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}var ln=9007199254740992,an=-9007199254740992,je=e=>eln?NaN:Number(e);function cn(e,t){t=je(t);try{return isNaN(t)?61:(a.ftruncate(e,t),0)}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}var De=(e,t,n)=>nt(e,Pe,t,n);function _n(e,t){try{if(t===0)return-28;var n=a.cwd(),r=He(n)+1;return t"u"||s.name!=="ErrnoError")throw s;return-s.errno}}function un(e,t,n){le.varargs=n;try{var r=le.getStreamFromFD(e);switch(t){case 21509:return r.tty?0:-59;case 21505:{if(!r.tty)return-59;if(r.tty.ops.ioctl_tcgets){var s=r.tty.ops.ioctl_tcgets(r),o=Ce();ce[o>>2]=s.c_iflag||0,ce[o+4>>2]=s.c_oflag||0,ce[o+8>>2]=s.c_cflag||0,ce[o+12>>2]=s.c_lflag||0;for(var p=0;p<32;p++)ge[o+p+17]=s.c_cc[p]||0;return 0}return 0}case 21510:case 21511:case 21512:return r.tty?0:-59;case 21506:case 21507:case 21508:{if(!r.tty)return-59;if(r.tty.ops.ioctl_tcsets){for(var o=Ce(),g=ce[o>>2],O=ce[o+4>>2],R=ce[o+8>>2],z=ce[o+12>>2],W=[],p=0;p<32;p++)W.push(ge[o+p+17]);return r.tty.ops.ioctl_tcsets(r.tty,t,{c_iflag:g,c_oflag:O,c_cflag:R,c_lflag:z,c_cc:W})}return 0}case 21519:{if(!r.tty)return-59;var o=Ce();return ce[o>>2]=0,0}case 21520:return r.tty?-28:-59;case 21531:{var o=Ce();return a.ioctl(r,t,o)}case 21523:{if(!r.tty)return-59;if(r.tty.ops.ioctl_tiocgwinsz){var T=r.tty.ops.ioctl_tiocgwinsz(r.tty),o=Ce();Ne[o>>1]=T[0],Ne[o+2>>1]=T[1]}return 0}case 21524:return r.tty?0:-59;case 21515:return r.tty?0:-59;default:return-28}}catch(A){if(typeof a>"u"||A.name!=="ErrnoError")throw A;return-A.errno}}function fn(e,t){try{return e=le.getStr(e),le.doStat(a.lstat,e,t)}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}function dn(e,t,n){try{return t=le.getStr(t),t=le.calculateAt(e,t),t=_e.normalize(t),t[t.length-1]==="/"&&(t=t.substr(0,t.length-1)),a.mkdir(t,n,0),0}catch(r){if(typeof a>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}function pn(e,t,n,r){try{t=le.getStr(t);var s=r&256,o=r&4096;return r=r&-6401,t=le.calculateAt(e,t,o),le.doStat(s?a.lstat:a.stat,t,n)}catch(p){if(typeof a>"u"||p.name!=="ErrnoError")throw p;return-p.errno}}function hn(e,t,n,r){le.varargs=r;try{t=le.getStr(t),t=le.calculateAt(e,t);var s=r?Ve():0;return a.open(t,n,s).fd}catch(o){if(typeof a>"u"||o.name!=="ErrnoError")throw o;return-o.errno}}function mn(e,t,n,r){try{if(t=le.getStr(t),t=le.calculateAt(e,t),r<=0)return-28;var s=a.readlink(t),o=Math.min(r,He(s)),p=ge[n+o];return De(s,n,r+1),ge[n+o]=p,o}catch(g){if(typeof a>"u"||g.name!=="ErrnoError")throw g;return-g.errno}}function gn(e){try{return e=le.getStr(e),a.rmdir(e),0}catch(t){if(typeof a>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function qn(e,t){try{return e=le.getStr(e),le.doStat(a.stat,e,t)}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}function bn(e,t,n){try{return t=le.getStr(t),t=le.calculateAt(e,t),n===0?a.unlink(t):n===512?a.rmdir(t):Ye("Invalid flags passed to unlinkat"),0}catch(r){if(typeof a>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}var Et=e=>he[e>>2]+ce[e+4>>2]*4294967296;function yn(e,t,n,r){try{t=le.getStr(t),t=le.calculateAt(e,t,!0);var s=Date.now(),o,p;if(!n)o=s,p=s;else{var g=Et(n),O=ce[n+8>>2];O==1073741823?o=s:O==1073741822?o=-1:o=g*1e3+O/1e6,n+=16,g=Et(n),O=ce[n+8>>2],O==1073741823?p=s:O==1073741822?p=-1:p=g*1e3+O/1e6}return(p!=-1||o!=-1)&&a.utime(t,o,p),0}catch(R){if(typeof a>"u"||R.name!=="ErrnoError")throw R;return-R.errno}}var wn=1,vn=()=>wn,En=e=>e%4===0&&(e%100!==0||e%400===0),xn=[0,31,60,91,121,152,182,213,244,274,305,335],Sn=[0,31,59,90,120,151,181,212,243,273,304,334],An=e=>{var t=En(e.getFullYear()),n=t?xn:Sn,r=n[e.getMonth()]+e.getDate()-1;return r};function In(e,t){e=je(e);var n=new Date(e*1e3);ce[t>>2]=n.getSeconds(),ce[t+4>>2]=n.getMinutes(),ce[t+8>>2]=n.getHours(),ce[t+12>>2]=n.getDate(),ce[t+16>>2]=n.getMonth(),ce[t+20>>2]=n.getFullYear()-1900,ce[t+24>>2]=n.getDay();var r=An(n)|0;ce[t+28>>2]=r,ce[t+36>>2]=-(n.getTimezoneOffset()*60);var s=new Date(n.getFullYear(),0,1),o=new Date(n.getFullYear(),6,1).getTimezoneOffset(),p=s.getTimezoneOffset(),g=(o!=p&&n.getTimezoneOffset()==Math.min(p,o))|0;ce[t+32>>2]=g}function kn(e,t,n,r,s,o,p){s=je(s);try{if(isNaN(s))return 61;var g=le.getStreamFromFD(r),O=a.mmap(g,e,s,t,n),R=O.ptr;return ce[o>>2]=O.allocated,he[p>>2]=R,0}catch(z){if(typeof a>"u"||z.name!=="ErrnoError")throw z;return-z.errno}}function Tn(e,t,n,r,s,o){o=je(o);try{var p=le.getStreamFromFD(s);n&2&&le.doMsync(e,p,t,r,o)}catch(g){if(typeof a>"u"||g.name!=="ErrnoError")throw g;return-g.errno}}var Fn=(e,t,n,r)=>{var s=new Date().getFullYear(),o=new Date(s,0,1),p=new Date(s,6,1),g=o.getTimezoneOffset(),O=p.getTimezoneOffset(),R=Math.max(g,O);he[e>>2]=R*60,ce[t>>2]=+(g!=O);var z=A=>{var D=A>=0?"-":"+",q=Math.abs(A),w=String(Math.floor(q/60)).padStart(2,"0"),x=String(q%60).padStart(2,"0");return`UTC${D}${w}${x}`},W=z(g),T=z(O);ODate.now(),Pn=()=>performance.now(),Ln=()=>2147483648,Cn=e=>{var t=Te.buffer,n=(e-t.byteLength+65535)/65536|0;try{return Te.grow(n),ut(),1}catch{}},Dn=e=>{var t=Pe.length;e>>>=0;var n=Ln();if(e>n)return!1;for(var r=1;r<=4;r*=2){var s=t*(1+.2/r);s=Math.min(s,e+100663296);var o=Math.min(n,wt(Math.max(e,s),65536)),p=Cn(o);if(p)return!0}return!1},st={},Rn=()=>ct||"./this.program",Be=()=>{if(!Be.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",t={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:Rn()};for(var n in st)st[n]===void 0?delete t[n]:t[n]=st[n];var r=[];for(var n in t)r.push(`${n}=${t[n]}`);Be.strings=r}return Be.strings},Nn=(e,t)=>{for(var n=0;n{var n=0;return Be().forEach((r,s)=>{var o=t+n;he[e+s*4>>2]=o,Nn(r,o),n+=r.length+1}),0},jn=(e,t)=>{var n=Be();he[e>>2]=n.length;var r=0;return n.forEach(s=>r+=s.length+1),he[t>>2]=r,0};function Bn(e){try{var t=le.getStreamFromFD(e);return a.close(t),0}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return n.errno}}function Un(e,t){try{var n=0,r=0,s=0,o=le.getStreamFromFD(e),p=o.tty?2:a.isDir(o.mode)?3:a.isLink(o.mode)?7:4;return ge[t]=p,Ne[t+2>>1]=s,xe[t+8>>3]=BigInt(n),xe[t+16>>3]=BigInt(r),0}catch(g){if(typeof a>"u"||g.name!=="ErrnoError")throw g;return g.errno}}var zn=(e,t,n,r)=>{for(var s=0,o=0;o>2],g=he[t+4>>2];t+=8;var O=a.read(e,ge,p,g,r);if(O<0)return-1;if(s+=O,O>2]=o,0}catch(p){if(typeof a>"u"||p.name!=="ErrnoError")throw p;return p.errno}}function Wn(e,t,n,r){t=je(t);try{if(isNaN(t))return 61;var s=le.getStreamFromFD(e);return a.llseek(s,t,n),xe[r>>3]=BigInt(s.position),s.getdents&&t===0&&n===0&&(s.getdents=null),0}catch(o){if(typeof a>"u"||o.name!=="ErrnoError")throw o;return o.errno}}function Hn(e){try{var t=le.getStreamFromFD(e);return t.stream_ops?.fsync?t.stream_ops.fsync(t):0}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return n.errno}}var Vn=(e,t,n,r)=>{for(var s=0,o=0;o>2],g=he[t+4>>2];t+=8;var O=a.write(e,ge,p,g,r);if(O<0)return-1;if(s+=O,O>2]=o,0}catch(p){if(typeof a>"u"||p.name!=="ErrnoError")throw p;return p.errno}}a.createPreloadedFile=Xt,a.staticInit();var xt={__syscall_chmod:en,__syscall_faccessat:tn,__syscall_fchmod:nn,__syscall_fchown32:rn,__syscall_fcntl64:sn,__syscall_fstat64:on,__syscall_ftruncate64:cn,__syscall_getcwd:_n,__syscall_ioctl:un,__syscall_lstat64:fn,__syscall_mkdirat:dn,__syscall_newfstatat:pn,__syscall_openat:hn,__syscall_readlinkat:mn,__syscall_rmdir:gn,__syscall_stat64:qn,__syscall_unlinkat:bn,__syscall_utimensat:yn,_emscripten_get_now_is_monotonic:vn,_localtime_js:In,_mmap_js:kn,_munmap_js:Tn,_tzset_js:Fn,emscripten_date_now:On,emscripten_get_now:Pn,emscripten_resize_heap:Dn,environ_get:Mn,environ_sizes_get:jn,fd_close:Bn,fd_fdstat_get:Un,fd_read:Qn,fd_seek:Wn,fd_sync:Hn,fd_write:Gn,memory:Te},h=Qt();i._sqlite3_status64=(e,t,n,r)=>(i._sqlite3_status64=h.sqlite3_status64)(e,t,n,r),i._sqlite3_status=(e,t,n,r)=>(i._sqlite3_status=h.sqlite3_status)(e,t,n,r),i._sqlite3_db_status=(e,t,n,r,s)=>(i._sqlite3_db_status=h.sqlite3_db_status)(e,t,n,r,s),i._sqlite3_msize=e=>(i._sqlite3_msize=h.sqlite3_msize)(e),i._sqlite3_vfs_find=e=>(i._sqlite3_vfs_find=h.sqlite3_vfs_find)(e),i._sqlite3_initialize=()=>(i._sqlite3_initialize=h.sqlite3_initialize)(),i._sqlite3_malloc=e=>(i._sqlite3_malloc=h.sqlite3_malloc)(e),i._sqlite3_free=e=>(i._sqlite3_free=h.sqlite3_free)(e),i._sqlite3_vfs_register=(e,t)=>(i._sqlite3_vfs_register=h.sqlite3_vfs_register)(e,t),i._sqlite3_vfs_unregister=e=>(i._sqlite3_vfs_unregister=h.sqlite3_vfs_unregister)(e),i._sqlite3_malloc64=e=>(i._sqlite3_malloc64=h.sqlite3_malloc64)(e),i._sqlite3_realloc=(e,t)=>(i._sqlite3_realloc=h.sqlite3_realloc)(e,t),i._sqlite3_realloc64=(e,t)=>(i._sqlite3_realloc64=h.sqlite3_realloc64)(e,t),i._sqlite3_value_text=e=>(i._sqlite3_value_text=h.sqlite3_value_text)(e),i._sqlite3_randomness=(e,t)=>(i._sqlite3_randomness=h.sqlite3_randomness)(e,t),i._sqlite3_stricmp=(e,t)=>(i._sqlite3_stricmp=h.sqlite3_stricmp)(e,t),i._sqlite3_strnicmp=(e,t,n)=>(i._sqlite3_strnicmp=h.sqlite3_strnicmp)(e,t,n),i._sqlite3_uri_parameter=(e,t)=>(i._sqlite3_uri_parameter=h.sqlite3_uri_parameter)(e,t),i._sqlite3_uri_boolean=(e,t,n)=>(i._sqlite3_uri_boolean=h.sqlite3_uri_boolean)(e,t,n),i._sqlite3_serialize=(e,t,n,r)=>(i._sqlite3_serialize=h.sqlite3_serialize)(e,t,n,r),i._sqlite3_prepare_v2=(e,t,n,r,s)=>(i._sqlite3_prepare_v2=h.sqlite3_prepare_v2)(e,t,n,r,s),i._sqlite3_step=e=>(i._sqlite3_step=h.sqlite3_step)(e),i._sqlite3_column_int64=(e,t)=>(i._sqlite3_column_int64=h.sqlite3_column_int64)(e,t),i._sqlite3_reset=e=>(i._sqlite3_reset=h.sqlite3_reset)(e),i._sqlite3_exec=(e,t,n,r,s)=>(i._sqlite3_exec=h.sqlite3_exec)(e,t,n,r,s),i._sqlite3_column_int=(e,t)=>(i._sqlite3_column_int=h.sqlite3_column_int)(e,t),i._sqlite3_finalize=e=>(i._sqlite3_finalize=h.sqlite3_finalize)(e),i._sqlite3_file_control=(e,t,n,r)=>(i._sqlite3_file_control=h.sqlite3_file_control)(e,t,n,r),i._sqlite3_column_name=(e,t)=>(i._sqlite3_column_name=h.sqlite3_column_name)(e,t),i._sqlite3_column_text=(e,t)=>(i._sqlite3_column_text=h.sqlite3_column_text)(e,t),i._sqlite3_column_type=(e,t)=>(i._sqlite3_column_type=h.sqlite3_column_type)(e,t),i._sqlite3_errmsg=e=>(i._sqlite3_errmsg=h.sqlite3_errmsg)(e),i._sqlite3_deserialize=(e,t,n,r,s,o)=>(i._sqlite3_deserialize=h.sqlite3_deserialize)(e,t,n,r,s,o),i._sqlite3_clear_bindings=e=>(i._sqlite3_clear_bindings=h.sqlite3_clear_bindings)(e),i._sqlite3_value_blob=e=>(i._sqlite3_value_blob=h.sqlite3_value_blob)(e),i._sqlite3_value_bytes=e=>(i._sqlite3_value_bytes=h.sqlite3_value_bytes)(e),i._sqlite3_value_double=e=>(i._sqlite3_value_double=h.sqlite3_value_double)(e),i._sqlite3_value_int=e=>(i._sqlite3_value_int=h.sqlite3_value_int)(e),i._sqlite3_value_int64=e=>(i._sqlite3_value_int64=h.sqlite3_value_int64)(e),i._sqlite3_value_subtype=e=>(i._sqlite3_value_subtype=h.sqlite3_value_subtype)(e),i._sqlite3_value_pointer=(e,t)=>(i._sqlite3_value_pointer=h.sqlite3_value_pointer)(e,t),i._sqlite3_value_type=e=>(i._sqlite3_value_type=h.sqlite3_value_type)(e),i._sqlite3_value_nochange=e=>(i._sqlite3_value_nochange=h.sqlite3_value_nochange)(e),i._sqlite3_value_frombind=e=>(i._sqlite3_value_frombind=h.sqlite3_value_frombind)(e),i._sqlite3_value_dup=e=>(i._sqlite3_value_dup=h.sqlite3_value_dup)(e),i._sqlite3_value_free=e=>(i._sqlite3_value_free=h.sqlite3_value_free)(e),i._sqlite3_result_blob=(e,t,n,r)=>(i._sqlite3_result_blob=h.sqlite3_result_blob)(e,t,n,r),i._sqlite3_result_error_toobig=e=>(i._sqlite3_result_error_toobig=h.sqlite3_result_error_toobig)(e),i._sqlite3_result_error_nomem=e=>(i._sqlite3_result_error_nomem=h.sqlite3_result_error_nomem)(e),i._sqlite3_result_double=(e,t)=>(i._sqlite3_result_double=h.sqlite3_result_double)(e,t),i._sqlite3_result_error=(e,t,n)=>(i._sqlite3_result_error=h.sqlite3_result_error)(e,t,n),i._sqlite3_result_int=(e,t)=>(i._sqlite3_result_int=h.sqlite3_result_int)(e,t),i._sqlite3_result_int64=(e,t)=>(i._sqlite3_result_int64=h.sqlite3_result_int64)(e,t),i._sqlite3_result_null=e=>(i._sqlite3_result_null=h.sqlite3_result_null)(e),i._sqlite3_result_pointer=(e,t,n,r)=>(i._sqlite3_result_pointer=h.sqlite3_result_pointer)(e,t,n,r),i._sqlite3_result_subtype=(e,t)=>(i._sqlite3_result_subtype=h.sqlite3_result_subtype)(e,t),i._sqlite3_result_text=(e,t,n,r)=>(i._sqlite3_result_text=h.sqlite3_result_text)(e,t,n,r),i._sqlite3_result_zeroblob=(e,t)=>(i._sqlite3_result_zeroblob=h.sqlite3_result_zeroblob)(e,t),i._sqlite3_result_zeroblob64=(e,t)=>(i._sqlite3_result_zeroblob64=h.sqlite3_result_zeroblob64)(e,t),i._sqlite3_result_error_code=(e,t)=>(i._sqlite3_result_error_code=h.sqlite3_result_error_code)(e,t),i._sqlite3_user_data=e=>(i._sqlite3_user_data=h.sqlite3_user_data)(e),i._sqlite3_context_db_handle=e=>(i._sqlite3_context_db_handle=h.sqlite3_context_db_handle)(e),i._sqlite3_vtab_nochange=e=>(i._sqlite3_vtab_nochange=h.sqlite3_vtab_nochange)(e),i._sqlite3_vtab_in_first=(e,t)=>(i._sqlite3_vtab_in_first=h.sqlite3_vtab_in_first)(e,t),i._sqlite3_vtab_in_next=(e,t)=>(i._sqlite3_vtab_in_next=h.sqlite3_vtab_in_next)(e,t),i._sqlite3_aggregate_context=(e,t)=>(i._sqlite3_aggregate_context=h.sqlite3_aggregate_context)(e,t),i._sqlite3_get_auxdata=(e,t)=>(i._sqlite3_get_auxdata=h.sqlite3_get_auxdata)(e,t),i._sqlite3_set_auxdata=(e,t,n,r)=>(i._sqlite3_set_auxdata=h.sqlite3_set_auxdata)(e,t,n,r),i._sqlite3_column_count=e=>(i._sqlite3_column_count=h.sqlite3_column_count)(e),i._sqlite3_data_count=e=>(i._sqlite3_data_count=h.sqlite3_data_count)(e),i._sqlite3_column_blob=(e,t)=>(i._sqlite3_column_blob=h.sqlite3_column_blob)(e,t),i._sqlite3_column_bytes=(e,t)=>(i._sqlite3_column_bytes=h.sqlite3_column_bytes)(e,t),i._sqlite3_column_double=(e,t)=>(i._sqlite3_column_double=h.sqlite3_column_double)(e,t),i._sqlite3_column_value=(e,t)=>(i._sqlite3_column_value=h.sqlite3_column_value)(e,t),i._sqlite3_column_decltype=(e,t)=>(i._sqlite3_column_decltype=h.sqlite3_column_decltype)(e,t),i._sqlite3_bind_blob=(e,t,n,r,s)=>(i._sqlite3_bind_blob=h.sqlite3_bind_blob)(e,t,n,r,s),i._sqlite3_bind_double=(e,t,n)=>(i._sqlite3_bind_double=h.sqlite3_bind_double)(e,t,n),i._sqlite3_bind_int=(e,t,n)=>(i._sqlite3_bind_int=h.sqlite3_bind_int)(e,t,n),i._sqlite3_bind_int64=(e,t,n)=>(i._sqlite3_bind_int64=h.sqlite3_bind_int64)(e,t,n),i._sqlite3_bind_null=(e,t)=>(i._sqlite3_bind_null=h.sqlite3_bind_null)(e,t),i._sqlite3_bind_pointer=(e,t,n,r,s)=>(i._sqlite3_bind_pointer=h.sqlite3_bind_pointer)(e,t,n,r,s),i._sqlite3_bind_text=(e,t,n,r,s)=>(i._sqlite3_bind_text=h.sqlite3_bind_text)(e,t,n,r,s),i._sqlite3_bind_parameter_count=e=>(i._sqlite3_bind_parameter_count=h.sqlite3_bind_parameter_count)(e),i._sqlite3_bind_parameter_name=(e,t)=>(i._sqlite3_bind_parameter_name=h.sqlite3_bind_parameter_name)(e,t),i._sqlite3_bind_parameter_index=(e,t)=>(i._sqlite3_bind_parameter_index=h.sqlite3_bind_parameter_index)(e,t),i._sqlite3_db_handle=e=>(i._sqlite3_db_handle=h.sqlite3_db_handle)(e),i._sqlite3_stmt_readonly=e=>(i._sqlite3_stmt_readonly=h.sqlite3_stmt_readonly)(e),i._sqlite3_stmt_isexplain=e=>(i._sqlite3_stmt_isexplain=h.sqlite3_stmt_isexplain)(e),i._sqlite3_stmt_explain=(e,t)=>(i._sqlite3_stmt_explain=h.sqlite3_stmt_explain)(e,t),i._sqlite3_stmt_busy=e=>(i._sqlite3_stmt_busy=h.sqlite3_stmt_busy)(e),i._sqlite3_stmt_status=(e,t,n)=>(i._sqlite3_stmt_status=h.sqlite3_stmt_status)(e,t,n),i._sqlite3_sql=e=>(i._sqlite3_sql=h.sqlite3_sql)(e),i._sqlite3_expanded_sql=e=>(i._sqlite3_expanded_sql=h.sqlite3_expanded_sql)(e),i._sqlite3_preupdate_old=(e,t,n)=>(i._sqlite3_preupdate_old=h.sqlite3_preupdate_old)(e,t,n),i._sqlite3_preupdate_count=e=>(i._sqlite3_preupdate_count=h.sqlite3_preupdate_count)(e),i._sqlite3_preupdate_depth=e=>(i._sqlite3_preupdate_depth=h.sqlite3_preupdate_depth)(e),i._sqlite3_preupdate_blobwrite=e=>(i._sqlite3_preupdate_blobwrite=h.sqlite3_preupdate_blobwrite)(e),i._sqlite3_preupdate_new=(e,t,n)=>(i._sqlite3_preupdate_new=h.sqlite3_preupdate_new)(e,t,n),i._sqlite3_value_numeric_type=e=>(i._sqlite3_value_numeric_type=h.sqlite3_value_numeric_type)(e),i._sqlite3_set_authorizer=(e,t,n)=>(i._sqlite3_set_authorizer=h.sqlite3_set_authorizer)(e,t,n),i._sqlite3_strglob=(e,t)=>(i._sqlite3_strglob=h.sqlite3_strglob)(e,t),i._sqlite3_strlike=(e,t,n)=>(i._sqlite3_strlike=h.sqlite3_strlike)(e,t,n),i._sqlite3_auto_extension=e=>(i._sqlite3_auto_extension=h.sqlite3_auto_extension)(e),i._sqlite3_cancel_auto_extension=e=>(i._sqlite3_cancel_auto_extension=h.sqlite3_cancel_auto_extension)(e),i._sqlite3_reset_auto_extension=()=>(i._sqlite3_reset_auto_extension=h.sqlite3_reset_auto_extension)(),i._sqlite3_prepare_v3=(e,t,n,r,s,o)=>(i._sqlite3_prepare_v3=h.sqlite3_prepare_v3)(e,t,n,r,s,o),i._sqlite3_create_module=(e,t,n,r)=>(i._sqlite3_create_module=h.sqlite3_create_module)(e,t,n,r),i._sqlite3_create_module_v2=(e,t,n,r,s)=>(i._sqlite3_create_module_v2=h.sqlite3_create_module_v2)(e,t,n,r,s),i._sqlite3_drop_modules=(e,t)=>(i._sqlite3_drop_modules=h.sqlite3_drop_modules)(e,t),i._sqlite3_declare_vtab=(e,t)=>(i._sqlite3_declare_vtab=h.sqlite3_declare_vtab)(e,t),i._sqlite3_vtab_on_conflict=e=>(i._sqlite3_vtab_on_conflict=h.sqlite3_vtab_on_conflict)(e),i._sqlite3_vtab_collation=(e,t)=>(i._sqlite3_vtab_collation=h.sqlite3_vtab_collation)(e,t),i._sqlite3_vtab_in=(e,t,n)=>(i._sqlite3_vtab_in=h.sqlite3_vtab_in)(e,t,n),i._sqlite3_vtab_rhs_value=(e,t,n)=>(i._sqlite3_vtab_rhs_value=h.sqlite3_vtab_rhs_value)(e,t,n),i._sqlite3_vtab_distinct=e=>(i._sqlite3_vtab_distinct=h.sqlite3_vtab_distinct)(e),i._sqlite3_keyword_name=(e,t,n)=>(i._sqlite3_keyword_name=h.sqlite3_keyword_name)(e,t,n),i._sqlite3_keyword_count=()=>(i._sqlite3_keyword_count=h.sqlite3_keyword_count)(),i._sqlite3_keyword_check=(e,t)=>(i._sqlite3_keyword_check=h.sqlite3_keyword_check)(e,t),i._sqlite3_complete=e=>(i._sqlite3_complete=h.sqlite3_complete)(e),i._sqlite3_libversion=()=>(i._sqlite3_libversion=h.sqlite3_libversion)(),i._sqlite3_libversion_number=()=>(i._sqlite3_libversion_number=h.sqlite3_libversion_number)(),i._sqlite3_shutdown=()=>(i._sqlite3_shutdown=h.sqlite3_shutdown)(),i._sqlite3_last_insert_rowid=e=>(i._sqlite3_last_insert_rowid=h.sqlite3_last_insert_rowid)(e),i._sqlite3_set_last_insert_rowid=(e,t)=>(i._sqlite3_set_last_insert_rowid=h.sqlite3_set_last_insert_rowid)(e,t),i._sqlite3_changes64=e=>(i._sqlite3_changes64=h.sqlite3_changes64)(e),i._sqlite3_changes=e=>(i._sqlite3_changes=h.sqlite3_changes)(e),i._sqlite3_total_changes64=e=>(i._sqlite3_total_changes64=h.sqlite3_total_changes64)(e),i._sqlite3_total_changes=e=>(i._sqlite3_total_changes=h.sqlite3_total_changes)(e),i._sqlite3_txn_state=(e,t)=>(i._sqlite3_txn_state=h.sqlite3_txn_state)(e,t),i._sqlite3_close_v2=e=>(i._sqlite3_close_v2=h.sqlite3_close_v2)(e),i._sqlite3_busy_handler=(e,t,n)=>(i._sqlite3_busy_handler=h.sqlite3_busy_handler)(e,t,n),i._sqlite3_progress_handler=(e,t,n,r)=>(i._sqlite3_progress_handler=h.sqlite3_progress_handler)(e,t,n,r),i._sqlite3_busy_timeout=(e,t)=>(i._sqlite3_busy_timeout=h.sqlite3_busy_timeout)(e,t),i._sqlite3_interrupt=e=>(i._sqlite3_interrupt=h.sqlite3_interrupt)(e),i._sqlite3_is_interrupted=e=>(i._sqlite3_is_interrupted=h.sqlite3_is_interrupted)(e),i._sqlite3_create_function=(e,t,n,r,s,o,p,g)=>(i._sqlite3_create_function=h.sqlite3_create_function)(e,t,n,r,s,o,p,g),i._sqlite3_create_function_v2=(e,t,n,r,s,o,p,g,O)=>(i._sqlite3_create_function_v2=h.sqlite3_create_function_v2)(e,t,n,r,s,o,p,g,O),i._sqlite3_create_window_function=(e,t,n,r,s,o,p,g,O,R)=>(i._sqlite3_create_window_function=h.sqlite3_create_window_function)(e,t,n,r,s,o,p,g,O,R),i._sqlite3_overload_function=(e,t,n)=>(i._sqlite3_overload_function=h.sqlite3_overload_function)(e,t,n),i._sqlite3_trace_v2=(e,t,n,r)=>(i._sqlite3_trace_v2=h.sqlite3_trace_v2)(e,t,n,r),i._sqlite3_commit_hook=(e,t,n)=>(i._sqlite3_commit_hook=h.sqlite3_commit_hook)(e,t,n),i._sqlite3_update_hook=(e,t,n)=>(i._sqlite3_update_hook=h.sqlite3_update_hook)(e,t,n),i._sqlite3_rollback_hook=(e,t,n)=>(i._sqlite3_rollback_hook=h.sqlite3_rollback_hook)(e,t,n),i._sqlite3_preupdate_hook=(e,t,n)=>(i._sqlite3_preupdate_hook=h.sqlite3_preupdate_hook)(e,t,n),i._sqlite3_error_offset=e=>(i._sqlite3_error_offset=h.sqlite3_error_offset)(e),i._sqlite3_errcode=e=>(i._sqlite3_errcode=h.sqlite3_errcode)(e),i._sqlite3_extended_errcode=e=>(i._sqlite3_extended_errcode=h.sqlite3_extended_errcode)(e),i._sqlite3_errstr=e=>(i._sqlite3_errstr=h.sqlite3_errstr)(e),i._sqlite3_limit=(e,t,n)=>(i._sqlite3_limit=h.sqlite3_limit)(e,t,n),i._sqlite3_open=(e,t)=>(i._sqlite3_open=h.sqlite3_open)(e,t),i._sqlite3_open_v2=(e,t,n,r)=>(i._sqlite3_open_v2=h.sqlite3_open_v2)(e,t,n,r),i._sqlite3_create_collation=(e,t,n,r,s)=>(i._sqlite3_create_collation=h.sqlite3_create_collation)(e,t,n,r,s),i._sqlite3_create_collation_v2=(e,t,n,r,s,o)=>(i._sqlite3_create_collation_v2=h.sqlite3_create_collation_v2)(e,t,n,r,s,o),i._sqlite3_collation_needed=(e,t,n)=>(i._sqlite3_collation_needed=h.sqlite3_collation_needed)(e,t,n),i._sqlite3_get_autocommit=e=>(i._sqlite3_get_autocommit=h.sqlite3_get_autocommit)(e),i._sqlite3_table_column_metadata=(e,t,n,r,s,o,p,g,O)=>(i._sqlite3_table_column_metadata=h.sqlite3_table_column_metadata)(e,t,n,r,s,o,p,g,O),i._sqlite3_extended_result_codes=(e,t)=>(i._sqlite3_extended_result_codes=h.sqlite3_extended_result_codes)(e,t),i._sqlite3_uri_key=(e,t)=>(i._sqlite3_uri_key=h.sqlite3_uri_key)(e,t),i._sqlite3_uri_int64=(e,t,n)=>(i._sqlite3_uri_int64=h.sqlite3_uri_int64)(e,t,n),i._sqlite3_db_name=(e,t)=>(i._sqlite3_db_name=h.sqlite3_db_name)(e,t),i._sqlite3_db_filename=(e,t)=>(i._sqlite3_db_filename=h.sqlite3_db_filename)(e,t),i._sqlite3_db_readonly=(e,t)=>(i._sqlite3_db_readonly=h.sqlite3_db_readonly)(e,t),i._sqlite3_compileoption_used=e=>(i._sqlite3_compileoption_used=h.sqlite3_compileoption_used)(e),i._sqlite3_compileoption_get=e=>(i._sqlite3_compileoption_get=h.sqlite3_compileoption_get)(e),i._sqlite3session_diff=(e,t,n,r)=>(i._sqlite3session_diff=h.sqlite3session_diff)(e,t,n,r),i._sqlite3session_attach=(e,t)=>(i._sqlite3session_attach=h.sqlite3session_attach)(e,t),i._sqlite3session_create=(e,t,n)=>(i._sqlite3session_create=h.sqlite3session_create)(e,t,n),i._sqlite3session_delete=e=>(i._sqlite3session_delete=h.sqlite3session_delete)(e),i._sqlite3session_table_filter=(e,t,n)=>(i._sqlite3session_table_filter=h.sqlite3session_table_filter)(e,t,n),i._sqlite3session_changeset=(e,t,n)=>(i._sqlite3session_changeset=h.sqlite3session_changeset)(e,t,n),i._sqlite3session_changeset_strm=(e,t,n)=>(i._sqlite3session_changeset_strm=h.sqlite3session_changeset_strm)(e,t,n),i._sqlite3session_patchset_strm=(e,t,n)=>(i._sqlite3session_patchset_strm=h.sqlite3session_patchset_strm)(e,t,n),i._sqlite3session_patchset=(e,t,n)=>(i._sqlite3session_patchset=h.sqlite3session_patchset)(e,t,n),i._sqlite3session_enable=(e,t)=>(i._sqlite3session_enable=h.sqlite3session_enable)(e,t),i._sqlite3session_indirect=(e,t)=>(i._sqlite3session_indirect=h.sqlite3session_indirect)(e,t),i._sqlite3session_isempty=e=>(i._sqlite3session_isempty=h.sqlite3session_isempty)(e),i._sqlite3session_memory_used=e=>(i._sqlite3session_memory_used=h.sqlite3session_memory_used)(e),i._sqlite3session_object_config=(e,t,n)=>(i._sqlite3session_object_config=h.sqlite3session_object_config)(e,t,n),i._sqlite3session_changeset_size=e=>(i._sqlite3session_changeset_size=h.sqlite3session_changeset_size)(e),i._sqlite3changeset_start=(e,t,n)=>(i._sqlite3changeset_start=h.sqlite3changeset_start)(e,t,n),i._sqlite3changeset_start_v2=(e,t,n,r)=>(i._sqlite3changeset_start_v2=h.sqlite3changeset_start_v2)(e,t,n,r),i._sqlite3changeset_start_strm=(e,t,n)=>(i._sqlite3changeset_start_strm=h.sqlite3changeset_start_strm)(e,t,n),i._sqlite3changeset_start_v2_strm=(e,t,n,r)=>(i._sqlite3changeset_start_v2_strm=h.sqlite3changeset_start_v2_strm)(e,t,n,r),i._sqlite3changeset_next=e=>(i._sqlite3changeset_next=h.sqlite3changeset_next)(e),i._sqlite3changeset_op=(e,t,n,r,s)=>(i._sqlite3changeset_op=h.sqlite3changeset_op)(e,t,n,r,s),i._sqlite3changeset_pk=(e,t,n)=>(i._sqlite3changeset_pk=h.sqlite3changeset_pk)(e,t,n),i._sqlite3changeset_old=(e,t,n)=>(i._sqlite3changeset_old=h.sqlite3changeset_old)(e,t,n),i._sqlite3changeset_new=(e,t,n)=>(i._sqlite3changeset_new=h.sqlite3changeset_new)(e,t,n),i._sqlite3changeset_conflict=(e,t,n)=>(i._sqlite3changeset_conflict=h.sqlite3changeset_conflict)(e,t,n),i._sqlite3changeset_fk_conflicts=(e,t)=>(i._sqlite3changeset_fk_conflicts=h.sqlite3changeset_fk_conflicts)(e,t),i._sqlite3changeset_finalize=e=>(i._sqlite3changeset_finalize=h.sqlite3changeset_finalize)(e),i._sqlite3changeset_invert=(e,t,n,r)=>(i._sqlite3changeset_invert=h.sqlite3changeset_invert)(e,t,n,r),i._sqlite3changeset_invert_strm=(e,t,n,r)=>(i._sqlite3changeset_invert_strm=h.sqlite3changeset_invert_strm)(e,t,n,r),i._sqlite3changeset_apply_v2=(e,t,n,r,s,o,p,g,O)=>(i._sqlite3changeset_apply_v2=h.sqlite3changeset_apply_v2)(e,t,n,r,s,o,p,g,O),i._sqlite3changeset_apply=(e,t,n,r,s,o)=>(i._sqlite3changeset_apply=h.sqlite3changeset_apply)(e,t,n,r,s,o),i._sqlite3changeset_apply_v2_strm=(e,t,n,r,s,o,p,g,O)=>(i._sqlite3changeset_apply_v2_strm=h.sqlite3changeset_apply_v2_strm)(e,t,n,r,s,o,p,g,O),i._sqlite3changeset_apply_strm=(e,t,n,r,s,o)=>(i._sqlite3changeset_apply_strm=h.sqlite3changeset_apply_strm)(e,t,n,r,s,o),i._sqlite3changegroup_new=e=>(i._sqlite3changegroup_new=h.sqlite3changegroup_new)(e),i._sqlite3changegroup_add=(e,t,n)=>(i._sqlite3changegroup_add=h.sqlite3changegroup_add)(e,t,n),i._sqlite3changegroup_output=(e,t,n)=>(i._sqlite3changegroup_output=h.sqlite3changegroup_output)(e,t,n),i._sqlite3changegroup_add_strm=(e,t,n)=>(i._sqlite3changegroup_add_strm=h.sqlite3changegroup_add_strm)(e,t,n),i._sqlite3changegroup_output_strm=(e,t,n)=>(i._sqlite3changegroup_output_strm=h.sqlite3changegroup_output_strm)(e,t,n),i._sqlite3changegroup_delete=e=>(i._sqlite3changegroup_delete=h.sqlite3changegroup_delete)(e),i._sqlite3changeset_concat=(e,t,n,r,s,o)=>(i._sqlite3changeset_concat=h.sqlite3changeset_concat)(e,t,n,r,s,o),i._sqlite3changeset_concat_strm=(e,t,n,r,s,o)=>(i._sqlite3changeset_concat_strm=h.sqlite3changeset_concat_strm)(e,t,n,r,s,o),i._sqlite3session_config=(e,t)=>(i._sqlite3session_config=h.sqlite3session_config)(e,t),i._sqlite3_sourceid=()=>(i._sqlite3_sourceid=h.sqlite3_sourceid)(),i._sqlite3__wasm_pstack_ptr=()=>(i._sqlite3__wasm_pstack_ptr=h.sqlite3__wasm_pstack_ptr)(),i._sqlite3__wasm_pstack_restore=e=>(i._sqlite3__wasm_pstack_restore=h.sqlite3__wasm_pstack_restore)(e),i._sqlite3__wasm_pstack_alloc=e=>(i._sqlite3__wasm_pstack_alloc=h.sqlite3__wasm_pstack_alloc)(e),i._sqlite3__wasm_pstack_remaining=()=>(i._sqlite3__wasm_pstack_remaining=h.sqlite3__wasm_pstack_remaining)(),i._sqlite3__wasm_pstack_quota=()=>(i._sqlite3__wasm_pstack_quota=h.sqlite3__wasm_pstack_quota)(),i._sqlite3__wasm_db_error=(e,t,n)=>(i._sqlite3__wasm_db_error=h.sqlite3__wasm_db_error)(e,t,n),i._sqlite3__wasm_test_struct=e=>(i._sqlite3__wasm_test_struct=h.sqlite3__wasm_test_struct)(e),i._sqlite3__wasm_enum_json=()=>(i._sqlite3__wasm_enum_json=h.sqlite3__wasm_enum_json)(),i._sqlite3__wasm_vfs_unlink=(e,t)=>(i._sqlite3__wasm_vfs_unlink=h.sqlite3__wasm_vfs_unlink)(e,t),i._sqlite3__wasm_db_vfs=(e,t)=>(i._sqlite3__wasm_db_vfs=h.sqlite3__wasm_db_vfs)(e,t),i._sqlite3__wasm_db_reset=e=>(i._sqlite3__wasm_db_reset=h.sqlite3__wasm_db_reset)(e),i._sqlite3__wasm_db_export_chunked=(e,t)=>(i._sqlite3__wasm_db_export_chunked=h.sqlite3__wasm_db_export_chunked)(e,t),i._sqlite3__wasm_db_serialize=(e,t,n,r,s)=>(i._sqlite3__wasm_db_serialize=h.sqlite3__wasm_db_serialize)(e,t,n,r,s),i._sqlite3__wasm_vfs_create_file=(e,t,n,r)=>(i._sqlite3__wasm_vfs_create_file=h.sqlite3__wasm_vfs_create_file)(e,t,n,r),i._sqlite3__wasm_posix_create_file=(e,t,n)=>(i._sqlite3__wasm_posix_create_file=h.sqlite3__wasm_posix_create_file)(e,t,n),i._sqlite3__wasm_kvvfsMakeKeyOnPstack=(e,t)=>(i._sqlite3__wasm_kvvfsMakeKeyOnPstack=h.sqlite3__wasm_kvvfsMakeKeyOnPstack)(e,t),i._sqlite3__wasm_kvvfs_methods=()=>(i._sqlite3__wasm_kvvfs_methods=h.sqlite3__wasm_kvvfs_methods)(),i._sqlite3__wasm_vtab_config=(e,t,n)=>(i._sqlite3__wasm_vtab_config=h.sqlite3__wasm_vtab_config)(e,t,n),i._sqlite3__wasm_db_config_ip=(e,t,n,r)=>(i._sqlite3__wasm_db_config_ip=h.sqlite3__wasm_db_config_ip)(e,t,n,r),i._sqlite3__wasm_db_config_pii=(e,t,n,r,s)=>(i._sqlite3__wasm_db_config_pii=h.sqlite3__wasm_db_config_pii)(e,t,n,r,s),i._sqlite3__wasm_db_config_s=(e,t,n)=>(i._sqlite3__wasm_db_config_s=h.sqlite3__wasm_db_config_s)(e,t,n),i._sqlite3__wasm_config_i=(e,t)=>(i._sqlite3__wasm_config_i=h.sqlite3__wasm_config_i)(e,t),i._sqlite3__wasm_config_ii=(e,t,n)=>(i._sqlite3__wasm_config_ii=h.sqlite3__wasm_config_ii)(e,t,n),i._sqlite3__wasm_config_j=(e,t)=>(i._sqlite3__wasm_config_j=h.sqlite3__wasm_config_j)(e,t),i._sqlite3__wasm_qfmt_token=(e,t)=>(i._sqlite3__wasm_qfmt_token=h.sqlite3__wasm_qfmt_token)(e,t),i._sqlite3__wasm_init_wasmfs=e=>(i._sqlite3__wasm_init_wasmfs=h.sqlite3__wasm_init_wasmfs)(e),i._sqlite3__wasm_test_intptr=e=>(i._sqlite3__wasm_test_intptr=h.sqlite3__wasm_test_intptr)(e),i._sqlite3__wasm_test_voidptr=e=>(i._sqlite3__wasm_test_voidptr=h.sqlite3__wasm_test_voidptr)(e),i._sqlite3__wasm_test_int64_max=()=>(i._sqlite3__wasm_test_int64_max=h.sqlite3__wasm_test_int64_max)(),i._sqlite3__wasm_test_int64_min=()=>(i._sqlite3__wasm_test_int64_min=h.sqlite3__wasm_test_int64_min)(),i._sqlite3__wasm_test_int64_times2=e=>(i._sqlite3__wasm_test_int64_times2=h.sqlite3__wasm_test_int64_times2)(e),i._sqlite3__wasm_test_int64_minmax=(e,t)=>(i._sqlite3__wasm_test_int64_minmax=h.sqlite3__wasm_test_int64_minmax)(e,t),i._sqlite3__wasm_test_int64ptr=e=>(i._sqlite3__wasm_test_int64ptr=h.sqlite3__wasm_test_int64ptr)(e),i._sqlite3__wasm_test_stack_overflow=e=>(i._sqlite3__wasm_test_stack_overflow=h.sqlite3__wasm_test_stack_overflow)(e),i._sqlite3__wasm_test_str_hello=e=>(i._sqlite3__wasm_test_str_hello=h.sqlite3__wasm_test_str_hello)(e),i._sqlite3__wasm_SQLTester_strglob=(e,t)=>(i._sqlite3__wasm_SQLTester_strglob=h.sqlite3__wasm_SQLTester_strglob)(e,t),i._malloc=e=>(i._malloc=h.malloc)(e),i._free=e=>(i._free=h.free)(e),i._realloc=(e,t)=>(i._realloc=h.realloc)(e,t);var St=(e,t)=>(St=h.emscripten_builtin_memalign)(e,t);i.wasmMemory=Te;var Ge,At;Me=function e(){Ge||It(),Ge||(Me=e)};function It(){if(Fe>0||!At&&(At=1,Pt(),Fe>0))return;function e(){Ge||(Ge=1,i.calledRun=1,!_t&&(Lt(),ve(i),i.onRuntimeInitialized?.(),Ct()))}i.setStatus?(i.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>i.setStatus(""),1),e()},1)):e()}if(i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return It(),i.runSQLite3PostLoadInit=function(e){if(globalThis.sqlite3ApiBootstrap=function t(n=globalThis.sqlite3ApiConfig||t.defaultConfig){if(t.sqlite3)return(t.sqlite3.config||console).warn("sqlite3ApiBootstrap() called multiple times.","Config and external initializers are ignored on calls after the first."),t.sqlite3;const r=Object.assign(Object.create(null),{exports:void 0,memory:void 0,bigIntEnabled:typeof i<"u"&&i.HEAPU64?!0:!!globalThis.BigInt64Array,debug:console.debug.bind(console),warn:console.warn.bind(console),error:console.error.bind(console),log:console.log.bind(console),wasmfsOpfsDir:"/opfs",useStdAlloc:!1},n||{});Object.assign(r,{allocExportName:r.useStdAlloc?"malloc":"sqlite3_malloc",deallocExportName:r.useStdAlloc?"free":"sqlite3_free",reallocExportName:r.useStdAlloc?"realloc":"sqlite3_realloc"},r),["exports","memory","wasmfsOpfsDir"].forEach(l=>{typeof r[l]=="function"&&(r[l]=r[l]())}),delete globalThis.sqlite3ApiConfig,delete t.defaultConfig;const s=Object.create(null),o=Object.create(null),p=l=>s.sqlite3_js_rc_str&&s.sqlite3_js_rc_str(l)||"Unknown result code #"+l,g=l=>typeof l=="number"&&l===(l|0);class O extends Error{constructor(..._){let u;if(_.length)if(g(_[0]))if(u=_[0],_.length===1)super(p(_[0]));else{const I=p(u);typeof _[1]=="object"?super(I,_[1]):(_[0]=I+":",super(_.join(" ")))}else _.length===2&&typeof _[1]=="object"?super(..._):super(_.join(" "));this.resultCode=u||s.SQLITE_ERROR,this.name="SQLite3Error"}}O.toss=(...l)=>{throw new O(...l)};const R=O.toss;r.wasmfsOpfsDir&&!/^\/[^/]+$/.test(r.wasmfsOpfsDir)&&R("config.wasmfsOpfsDir must be falsy or in the form '/dir-name'.");const z=l=>typeof l!="bigint"&&l===(l|0)&&l<=2147483647&&l>=-2147483648,W=function l(_){return l._max||(l._max=BigInt("0x7fffffffffffffff"),l._min=~l._max),_>=l._min&&_<=l._max},T=l=>l>=-0x7fffffffn-1n&&l<=0x7fffffffn,A=function l(_){return l._min||(l._min=Number.MIN_SAFE_INTEGER,l._max=Number.MAX_SAFE_INTEGER),_>=l._min&&_<=l._max},D=l=>l&&l.constructor&&z(l.constructor.BYTES_PER_ELEMENT)?l:!1,q=typeof SharedArrayBuffer>"u"?function(){}:SharedArrayBuffer,w=l=>l.buffer instanceof q,x=(l,_,u)=>w(l)?l.slice(_,u):l.subarray(_,u),N=l=>l&&(l instanceof Uint8Array||l instanceof Int8Array||l instanceof ArrayBuffer),P=l=>l&&(l instanceof Uint8Array||l instanceof Int8Array||l instanceof ArrayBuffer),S=l=>N(l)||R("Value is not of a supported TypedArray type."),L=new TextDecoder("utf-8"),$=function(l,_,u){return L.decode(x(l,_,u))},c=function(l){return P(l)?$(l instanceof ArrayBuffer?new Uint8Array(l):l):Array.isArray(l)?l.join(""):(o.isPtr(l)&&(l=o.cstrToJs(l)),l)};class d extends Error{constructor(..._){_.length===2&&typeof _[1]=="object"?super(..._):_.length?super(_.join(" ")):super("Allocation failed."),this.resultCode=s.SQLITE_NOMEM,this.name="WasmAllocError"}}d.toss=(...l)=>{throw new d(...l)},Object.assign(s,{sqlite3_bind_blob:void 0,sqlite3_bind_text:void 0,sqlite3_create_function_v2:(l,_,u,I,U,ee,ne,re,se)=>{},sqlite3_create_function:(l,_,u,I,U,ee,ne,re)=>{},sqlite3_create_window_function:(l,_,u,I,U,ee,ne,re,se,j)=>{},sqlite3_prepare_v3:(l,_,u,I,U,ee)=>{},sqlite3_prepare_v2:(l,_,u,I,U)=>{},sqlite3_exec:(l,_,u,I,U)=>{},sqlite3_randomness:(l,_)=>{}});const y={affirmBindableTypedArray:S,flexibleString:c,bigIntFits32:T,bigIntFits64:W,bigIntFitsDouble:A,isBindableTypedArray:N,isInt32:z,isSQLableTypedArray:P,isTypedArray:D,typedArrayToString:$,isUIThread:()=>globalThis.window===globalThis&&!!globalThis.document,isSharedTypedArray:w,toss:function(...l){throw new Error(l.join(" "))},toss3:R,typedArrayPart:x,affirmDbHeader:function(l){l instanceof ArrayBuffer&&(l=new Uint8Array(l));const _="SQLite format 3";_.length>l.byteLength&&R("Input does not contain an SQLite3 database header.");for(let u=0;u<_.length;++u)_.charCodeAt(u)!==l[u]&&R("Input does not contain an SQLite3 database header.")},affirmIsDb:function(l){l instanceof ArrayBuffer&&(l=new Uint8Array(l));const _=l.byteLength;(_<512||_%512!==0)&&R("Byte array size",_,"is invalid for an SQLite3 db."),y.affirmDbHeader(l)}};Object.assign(o,{ptrSizeof:r.wasmPtrSizeof||4,ptrIR:r.wasmPtrIR||"i32",bigIntEnabled:!!r.bigIntEnabled,exports:r.exports||R("Missing API config.exports (WASM module exports)."),memory:r.memory||r.exports.memory||R("API config object requires a WebAssembly.Memory object","in either config.exports.memory (exported)","or config.memory (imported)."),alloc:void 0,realloc:void 0,dealloc:void 0}),o.allocFromTypedArray=function(l){l instanceof ArrayBuffer&&(l=new Uint8Array(l)),S(l);const _=o.alloc(l.byteLength||1);return o.heapForSize(l.constructor).set(l.byteLength?l:[0],_),_};{const l=r.allocExportName,_=r.deallocExportName,u=r.reallocExportName;for(const I of[l,_,u])o.exports[I]instanceof Function||R("Missing required exports[",I,"] function.");o.alloc=function I(U){return I.impl(U)||d.toss("Failed to allocate",U," bytes.")},o.alloc.impl=o.exports[l],o.realloc=function I(U,ee){const ne=I.impl(U,ee);return ee?ne||d.toss("Failed to reallocate",ee," bytes."):0},o.realloc.impl=o.exports[u],o.dealloc=o.exports[_]}o.compileOptionUsed=function l(_){if(arguments.length){if(Array.isArray(_)){const u={};return _.forEach(I=>{u[I]=s.sqlite3_compileoption_used(I)}),u}else if(typeof _=="object")return Object.keys(_).forEach(u=>{_[u]=s.sqlite3_compileoption_used(u)}),_}else{if(l._result)return l._result;l._opt||(l._rx=/^([^=]+)=(.+)/,l._rxInt=/^-?\d+$/,l._opt=function(ne,re){const se=l._rx.exec(ne);re[0]=se?se[1]:ne,re[1]=se?l._rxInt.test(se[2])?+se[2]:se[2]:!0});const u={},I=[0,0];let U=0,ee;for(;ee=s.sqlite3_compileoption_get(U++);)l._opt(ee,I),u[I[0]]=I[1];return l._result=u}return typeof _=="string"?!!s.sqlite3_compileoption_used(_):!1},o.pstack=Object.assign(Object.create(null),{restore:o.exports.sqlite3__wasm_pstack_restore,alloc:function(l){return typeof l=="string"&&!(l=o.sizeofIR(l))&&d.toss("Invalid value for pstack.alloc(",arguments[0],")"),o.exports.sqlite3__wasm_pstack_alloc(l)||d.toss("Could not allocate",l,"bytes from the pstack.")},allocChunks:function(l,_){typeof _=="string"&&!(_=o.sizeofIR(_))&&d.toss("Invalid size value for allocChunks(",arguments[1],")");const u=o.pstack.alloc(l*_),I=[];let U=0,ee=0;for(;Ul===1?o.pstack.alloc(_?8:o.ptrSizeof):o.pstack.allocChunks(l,_?8:o.ptrSizeof),call:function(l){const _=o.pstack.pointer;try{return l(m)}finally{o.pstack.restore(_)}}}),Object.defineProperties(o.pstack,{pointer:{configurable:!1,iterable:!0,writeable:!1,get:o.exports.sqlite3__wasm_pstack_ptr},quota:{configurable:!1,iterable:!0,writeable:!1,get:o.exports.sqlite3__wasm_pstack_quota},remaining:{configurable:!1,iterable:!0,writeable:!1,get:o.exports.sqlite3__wasm_pstack_remaining}}),s.sqlite3_randomness=(...l)=>{if(l.length===1&&y.isTypedArray(l[0])&&l[0].BYTES_PER_ELEMENT===1){const _=l[0];if(_.byteLength===0)return o.exports.sqlite3_randomness(0,0),_;const u=o.pstack.pointer;try{let I=_.byteLength,U=0;const ee=o.exports.sqlite3_randomness,ne=o.heap8u(),re=I<512?I:512,se=o.pstack.alloc(re);do{const j=I>re?re:I;ee(j,se),_.set(x(ne,se,se+j),U),I-=j,U+=j}while(I>0)}catch(I){console.error("Highly unexpected (and ignored!) exception in sqlite3_randomness():",I)}finally{o.pstack.restore(u)}return _}o.exports.sqlite3_randomness(...l)};let B;if(s.sqlite3_wasmfs_opfs_dir=function(){if(B!==void 0)return B;const l=r.wasmfsOpfsDir;if(!l||!globalThis.FileSystemHandle||!globalThis.FileSystemDirectoryHandle||!globalThis.FileSystemFileHandle)return B="";try{return l&&o.xCallWrapped("sqlite3__wasm_init_wasmfs","i32",["string"],l)===0?B=l:B=""}catch{return B=""}},s.sqlite3_wasmfs_filename_is_persistent=function(l){const _=s.sqlite3_wasmfs_opfs_dir();return _&&l?l.startsWith(_+"/"):!1},s.sqlite3_js_db_uses_vfs=function(l,_,u=0){try{const I=s.sqlite3_vfs_find(_);return I?l?I===s.sqlite3_js_db_vfs(l,u)?I:!1:I===s.sqlite3_vfs_find(0)?I:!1:!1}catch{return!1}},s.sqlite3_js_vfs_list=function(){const l=[];let _=s.sqlite3_vfs_find(0);for(;_;){const u=new s.sqlite3_vfs(_);l.push(o.cstrToJs(u.$zName)),_=u.$pNext,u.dispose()}return l},s.sqlite3_js_db_export=function(l,_=0){l=o.xWrap.testConvertArg("sqlite3*",l),l||R("Invalid sqlite3* argument."),o.bigIntEnabled||R("BigInt64 support is not enabled.");const u=o.scopedAllocPush();let I;try{const U=o.scopedAlloc(8+o.ptrSizeof),ee=U+8,ne=_?o.isPtr(_)?_:o.scopedAllocCString(""+_):0;let re=o.exports.sqlite3__wasm_db_serialize(l,ne,ee,U,0);re&&R("Database serialization failed with code",m.capi.sqlite3_js_rc_str(re)),I=o.peekPtr(ee);const se=o.peek(U,"i64");return re=se?o.heap8u().slice(I,I+Number(se)):new Uint8Array,re}finally{I&&o.exports.sqlite3_free(I),o.scopedAllocPop(u)}},s.sqlite3_js_db_vfs=(l,_=0)=>y.sqlite3__wasm_db_vfs(l,_),s.sqlite3_js_aggregate_context=(l,_)=>s.sqlite3_aggregate_context(l,_)||(_?d.toss("Cannot allocate",_,"bytes for sqlite3_aggregate_context()"):0),s.sqlite3_js_posix_create_file=function(l,_,u){let I;_&&o.isPtr(_)?I=_:_ instanceof ArrayBuffer||_ instanceof Uint8Array?(I=o.allocFromTypedArray(_),(arguments.length<3||!y.isInt32(u)||u<0)&&(u=_.byteLength)):O.toss("Invalid 2nd argument for sqlite3_js_posix_create_file().");try{(!y.isInt32(u)||u<0)&&O.toss("Invalid 3rd argument for sqlite3_js_posix_create_file().");const U=y.sqlite3__wasm_posix_create_file(l,I,u);U&&O.toss("Creation of file failed with sqlite3 result code",s.sqlite3_js_rc_str(U))}finally{o.dealloc(I)}},s.sqlite3_js_vfs_create_file=function(l,_,u,I){r.warn("sqlite3_js_vfs_create_file() is deprecated and","should be avoided because it can lead to C-level crashes.","See its documentation for alternative options.");let U;u?(o.isPtr(u)?U=u:u instanceof ArrayBuffer&&(u=new Uint8Array(u)),u instanceof Uint8Array?(U=o.allocFromTypedArray(u),(arguments.length<4||!y.isInt32(I)||I<0)&&(I=u.byteLength)):O.toss("Invalid 3rd argument type for sqlite3_js_vfs_create_file().")):U=0,(!y.isInt32(I)||I<0)&&(o.dealloc(U),O.toss("Invalid 4th argument for sqlite3_js_vfs_create_file()."));try{const ee=y.sqlite3__wasm_vfs_create_file(l,_,U,I);ee&&O.toss("Creation of file failed with sqlite3 result code",s.sqlite3_js_rc_str(ee))}finally{o.dealloc(U)}},s.sqlite3_js_sql_to_string=l=>{if(typeof l=="string")return l;const _=c(v);return _===v?void 0:_},y.isUIThread()){const l=function(_){const u=Object.create(null);return u.prefix="kvvfs-"+_,u.stores=[],(_==="session"||_==="")&&u.stores.push(globalThis.sessionStorage),(_==="local"||_==="")&&u.stores.push(globalThis.localStorage),u};s.sqlite3_js_kvvfs_clear=function(_=""){let u=0;const I=l(_);return I.stores.forEach(U=>{const ee=[];let ne;for(ne=0;neU.removeItem(re)),u+=ee.length}),u},s.sqlite3_js_kvvfs_size=function(_=""){let u=0;const I=l(_);return I.stores.forEach(U=>{let ee;for(ee=0;eef(l,_,"sqlite3_preupdate_new"),s.sqlite3_preupdate_old_js=(l,_)=>f(l,_,"sqlite3_preupdate_old"),s.sqlite3changeset_new_js=(l,_)=>f(l,_,"sqlite3changeset_new"),s.sqlite3changeset_old_js=(l,_)=>f(l,_,"sqlite3changeset_old");const m={WasmAllocError:d,SQLite3Error:O,capi:s,util:y,wasm:o,config:r,version:Object.create(null),client:void 0,asyncPostInit:async function l(){if(l.isReady instanceof Promise)return l.isReady;let _=t.initializersAsync;delete t.initializersAsync;const u=async()=>(m.__isUnderTest||(delete m.util,delete m.StructBinder),m),I=ee=>{throw r.error("an async sqlite3 initializer failed:",ee),ee};if(!_||!_.length)return l.isReady=u().catch(I);_=_.map(ee=>ee instanceof Function?async ne=>ee(m):ee),_.push(u);let U=Promise.resolve(m);for(;_.length;)U=U.then(_.shift());return l.isReady=U.catch(I)},scriptInfo:void 0};try{t.initializers.forEach(l=>{l(m)})}catch(l){throw console.error("sqlite3 bootstrap initializer threw:",l),l}return delete t.initializers,t.sqlite3=m,m},globalThis.sqlite3ApiBootstrap.initializers=[],globalThis.sqlite3ApiBootstrap.initializersAsync=[],globalThis.sqlite3ApiBootstrap.defaultConfig=Object.create(null),globalThis.sqlite3ApiBootstrap.sqlite3=void 0,globalThis.WhWasmUtilInstaller=function(t){t.bigIntEnabled===void 0&&(t.bigIntEnabled=!!globalThis.BigInt64Array);const n=(...c)=>{throw new Error(c.join(" "))};t.exports||Object.defineProperty(t,"exports",{enumerable:!0,configurable:!0,get:()=>t.instance&&t.instance.exports});const r=t.pointerIR||"i32",s=t.ptrSizeof=r==="i32"?4:r==="i64"?8:n("Unhandled ptrSizeof:",r),o=Object.create(null);o.heapSize=0,o.memory=null,o.freeFuncIndexes=[],o.scopedAlloc=[],o.utf8Decoder=new TextDecoder,o.utf8Encoder=new TextEncoder("utf-8"),t.sizeofIR=c=>{switch(c){case"i8":return 1;case"i16":return 2;case"i32":case"f32":case"float":return 4;case"i64":case"f64":case"double":return 8;case"*":return s;default:return(""+c).endsWith("*")?s:void 0}};const p=function(){if(!o.memory)o.memory=t.memory instanceof WebAssembly.Memory?t.memory:t.exports.memory;else if(o.heapSize===o.memory.buffer.byteLength)return o;const c=o.memory.buffer;return o.HEAP8=new Int8Array(c),o.HEAP8U=new Uint8Array(c),o.HEAP16=new Int16Array(c),o.HEAP16U=new Uint16Array(c),o.HEAP32=new Int32Array(c),o.HEAP32U=new Uint32Array(c),t.bigIntEnabled&&(o.HEAP64=new BigInt64Array(c),o.HEAP64U=new BigUint64Array(c)),o.HEAP32F=new Float32Array(c),o.HEAP64F=new Float64Array(c),o.heapSize=c.byteLength,o};t.heap8=()=>p().HEAP8,t.heap8u=()=>p().HEAP8U,t.heap16=()=>p().HEAP16,t.heap16u=()=>p().HEAP16U,t.heap32=()=>p().HEAP32,t.heap32u=()=>p().HEAP32U,t.heapForSize=function(c,d=!0){const y=o.memory&&o.heapSize===o.memory.buffer.byteLength?o:p();switch(c){case Int8Array:return y.HEAP8;case Uint8Array:return y.HEAP8U;case Int16Array:return y.HEAP16;case Uint16Array:return y.HEAP16U;case Int32Array:return y.HEAP32;case Uint32Array:return y.HEAP32U;case 8:return d?y.HEAP8U:y.HEAP8;case 16:return d?y.HEAP16U:y.HEAP16;case 32:return d?y.HEAP32U:y.HEAP32;case 64:if(y.HEAP64)return d?y.HEAP64U:y.HEAP64;break;default:if(t.bigIntEnabled){if(c===globalThis.BigUint64Array)return y.HEAP64U;if(c===globalThis.BigInt64Array)return y.HEAP64;break}}n("Invalid heapForSize() size: expecting 8, 16, 32,","or (if BigInt is enabled) 64.")},t.functionTable=function(){return t.exports.__indirect_function_table},t.functionEntry=function(c){const d=t.functionTable();return c>7)},rxJSig:/^(\w)\((\w*)\)$/,sigParams:function(m){const l=c._.rxJSig.exec(m);return l?l[2]:m.substr(1)},letterType:m=>c._.sigTypes[m]||n("Invalid signature letter:",m),pushSigType:(m,l)=>m.push(c._.typeCodes[c._.letterType(l)])}),typeof d=="string"){const m=y;y=d,d=m}const B=c._.sigParams(y),f=[1,96];c._.uleb128Encode(f,"push",B.length);for(const m of B)c._.pushSigType(f,m);return y[0]==="v"?f.push(0):(f.push(1),c._.pushSigType(f,y[0])),c._.uleb128Encode(f,"unshift",f.length),f.unshift(0,97,115,109,1,0,0,0,1),f.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0),new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array(f)),{e:{f:d}}).exports.f};const g=function(d,y,B){if(B&&!o.scopedAlloc.length&&n("No scopedAllocPush() scope is active."),typeof d=="string"){const _=y;y=d,d=_}(typeof y!="string"||!(d instanceof Function))&&n("Invalid arguments: expecting (function,signature) or (signature,function).");const f=t.functionTable(),m=f.length;let l;for(;o.freeFuncIndexes.length&&(l=o.freeFuncIndexes.pop(),f.get(l));){l=null;continue}l||(l=m,f.grow(1));try{return f.set(l,d),B&&o.scopedAlloc[o.scopedAlloc.length-1].push(l),l}catch(_){if(!(_ instanceof TypeError))throw l===m&&o.freeFuncIndexes.push(m),_}try{const _=t.jsFuncToWasm(d,y);f.set(l,_),B&&o.scopedAlloc[o.scopedAlloc.length-1].push(l)}catch(_){throw l===m&&o.freeFuncIndexes.push(m),_}return l};t.installFunction=(c,d)=>g(c,d,!1),t.scopedInstallFunction=(c,d)=>g(c,d,!0),t.uninstallFunction=function(c){if(!c&&c!==0)return;const d=o.freeFuncIndexes,y=t.functionTable();d.push(c);const B=y.get(c);return y.set(c,null),B},t.peek=function(d,y="i8"){y.endsWith("*")&&(y=r);const B=o.memory&&o.heapSize===o.memory.buffer.byteLength?o:p(),f=Array.isArray(d)?[]:void 0;let m;do{switch(f&&(d=arguments[0].shift()),y){case"i1":case"i8":m=B.HEAP8[d>>0];break;case"i16":m=B.HEAP16[d>>1];break;case"i32":m=B.HEAP32[d>>2];break;case"float":case"f32":m=B.HEAP32F[d>>2];break;case"double":case"f64":m=Number(B.HEAP64F[d>>3]);break;case"i64":if(t.bigIntEnabled){m=BigInt(B.HEAP64[d>>3]);break}default:n("Invalid type for peek():",y)}f&&f.push(m)}while(f&&arguments[0].length);return f||m},t.poke=function(c,d,y="i8"){y.endsWith("*")&&(y=r);const B=o.memory&&o.heapSize===o.memory.buffer.byteLength?o:p();for(const f of Array.isArray(c)?c:[c])switch(y){case"i1":case"i8":B.HEAP8[f>>0]=d;continue;case"i16":B.HEAP16[f>>1]=d;continue;case"i32":B.HEAP32[f>>2]=d;continue;case"float":case"f32":B.HEAP32F[f>>2]=d;continue;case"double":case"f64":B.HEAP64F[f>>3]=d;continue;case"i64":if(B.HEAP64){B.HEAP64[f>>3]=BigInt(d);continue}default:n("Invalid type for poke(): "+y)}return this},t.peekPtr=(...c)=>t.peek(c.length===1?c[0]:c,r),t.pokePtr=(c,d=0)=>t.poke(c,d,r),t.peek8=(...c)=>t.peek(c.length===1?c[0]:c,"i8"),t.poke8=(c,d)=>t.poke(c,d,"i8"),t.peek16=(...c)=>t.peek(c.length===1?c[0]:c,"i16"),t.poke16=(c,d)=>t.poke(c,d,"i16"),t.peek32=(...c)=>t.peek(c.length===1?c[0]:c,"i32"),t.poke32=(c,d)=>t.poke(c,d,"i32"),t.peek64=(...c)=>t.peek(c.length===1?c[0]:c,"i64"),t.poke64=(c,d)=>t.poke(c,d,"i64"),t.peek32f=(...c)=>t.peek(c.length===1?c[0]:c,"f32"),t.poke32f=(c,d)=>t.poke(c,d,"f32"),t.peek64f=(...c)=>t.peek(c.length===1?c[0]:c,"f64"),t.poke64f=(c,d)=>t.poke(c,d,"f64"),t.getMemValue=t.peek,t.getPtrValue=t.peekPtr,t.setMemValue=t.poke,t.setPtrValue=t.pokePtr,t.isPtr32=c=>typeof c=="number"&&c===(c|0)&&c>=0,t.isPtr=t.isPtr32,t.cstrlen=function(c){if(!c||!t.isPtr(c))return null;const d=p().HEAP8U;let y=c;for(;d[y]!==0;++y);return y-c};const O=typeof SharedArrayBuffer>"u"?function(){}:SharedArrayBuffer,R=function(c,d,y){return o.utf8Decoder.decode(c.buffer instanceof O?c.slice(d,y):c.subarray(d,y))};t.cstrToJs=function(c){const d=t.cstrlen(c);return d?R(p().HEAP8U,c,c+d):d===null?d:""},t.jstrlen=function(c){if(typeof c!="string")return null;const d=c.length;let y=0;for(let B=0;B=55296&&f<=57343&&(f=65536+((f&1023)<<10)|c.charCodeAt(++B)&1023),f<=127?++y:f<=2047?y+=2:f<=65535?y+=3:y+=4}return y},t.jstrcpy=function(c,d,y=0,B=-1,f=!0){if((!d||!(d instanceof Int8Array)&&!(d instanceof Uint8Array))&&n("jstrcpy() target must be an Int8Array or Uint8Array."),B<0&&(B=d.length-y),!(B>0)||!(y>=0))return 0;let m=0,l=c.length;const _=y,u=y+B-(f?1:0);for(;m=55296&&I<=57343&&(I=65536+((I&1023)<<10)|c.charCodeAt(++m)&1023),I<=127){if(y>=u)break;d[y++]=I}else if(I<=2047){if(y+1>=u)break;d[y++]=192|I>>6,d[y++]=128|I&63}else if(I<=65535){if(y+2>=u)break;d[y++]=224|I>>12,d[y++]=128|I>>6&63,d[y++]=128|I&63}else{if(y+3>=u)break;d[y++]=240|I>>18,d[y++]=128|I>>12&63,d[y++]=128|I>>6&63,d[y++]=128|I&63}}return f&&(d[y++]=0),y-_},t.cstrncpy=function(c,d,y){if((!c||!d)&&n("cstrncpy() does not accept NULL strings."),y<0)y=t.cstrlen(strPtr)+1;else if(!(y>0))return 0;const B=t.heap8u();let f=0,m;for(;fo.utf8Encoder.encode(d?c+"\0":c);const z=(c,d)=>{(!(c.alloc instanceof Function)||!(c.dealloc instanceof Function))&&n("Object is missing alloc() and/or dealloc() function(s)","required by",d+"().")},W=function(c,d,y,B){if(z(t,B),typeof c!="string")return null;{const f=o.utf8Encoder.encode(c),m=y(f.length+1),l=p().HEAP8U;return l.set(f,m),l[m+f.length]=0,d?[m,f.length]:m}};t.allocCString=(c,d=!1)=>W(c,d,t.alloc,"allocCString()"),t.scopedAllocPush=function(){z(t,"scopedAllocPush");const c=[];return o.scopedAlloc.push(c),c},t.scopedAllocPop=function(c){z(t,"scopedAllocPop");const d=arguments.length?o.scopedAlloc.indexOf(c):o.scopedAlloc.length-1;d<0&&n("Invalid state object for scopedAllocPop()."),arguments.length===0&&(c=o.scopedAlloc[d]),o.scopedAlloc.splice(d,1);for(let y;y=c.pop();)t.functionEntry(y)?t.uninstallFunction(y):t.dealloc(y)},t.scopedAlloc=function(c){o.scopedAlloc.length||n("No scopedAllocPush() scope is active.");const d=t.alloc(c);return o.scopedAlloc[o.scopedAlloc.length-1].push(d),d},Object.defineProperty(t.scopedAlloc,"level",{configurable:!1,enumerable:!1,get:()=>o.scopedAlloc.length,set:()=>n("The 'active' property is read-only.")}),t.scopedAllocCString=(c,d=!1)=>W(c,d,t.scopedAlloc,"scopedAllocCString()");const T=function(c,d){const y=t[c?"scopedAlloc":"alloc"]((d.length+1)*t.ptrSizeof);let B=0;return d.forEach(f=>{t.pokePtr(y+t.ptrSizeof*B++,t[c?"scopedAllocCString":"allocCString"](""+f))}),t.pokePtr(y+t.ptrSizeof*B,0),y};t.scopedAllocMainArgv=c=>T(!0,c),t.allocMainArgv=c=>T(!1,c),t.cArgvToJs=(c,d)=>{const y=[];for(let B=0;BA(c,d,"alloc"),t.scopedAllocPtr=(c=1,d=!0)=>A(c,d,"scopedAlloc"),t.xGet=function(c){return t.exports[c]||n("Cannot find exported symbol:",c)};const D=(c,d)=>n(c+"() requires",d,"argument(s).");t.xCall=function(c,...d){const y=c instanceof Function?c:t.xGet(c);return y instanceof Function||n("Exported symbol",c,"is not a function."),y.length!==d.length&&D(y===c?y.name:c,y.length),arguments.length===2&&Array.isArray(arguments[1])?y.apply(null,arguments[1]):y.apply(null,d)},o.xWrap=Object.create(null),o.xWrap.convert=Object.create(null),o.xWrap.convert.arg=new Map,o.xWrap.convert.result=new Map;const q=o.xWrap.convert.arg,w=o.xWrap.convert.result;t.bigIntEnabled&&q.set("i64",c=>BigInt(c));const x=r==="i32"?c=>c|0:c=>BigInt(c)|BigInt(0);q.set("i32",x).set("i16",c=>(c|0)&65535).set("i8",c=>(c|0)&255).set("f32",c=>Number(c).valueOf()).set("float",q.get("f32")).set("f64",q.get("f32")).set("double",q.get("f64")).set("int",q.get("i32")).set("null",c=>c).set(null,q.get("null")).set("**",x).set("*",x),w.set("*",x).set("pointer",x).set("number",c=>Number(c)).set("void",c=>{}).set("null",c=>c).set(null,w.get("null"));{const c=["i8","i16","i32","int","f32","float","f64","double"];t.bigIntEnabled&&c.push("i64");const d=q.get(r);for(const y of c)q.set(y+"*",d),w.set(y+"*",d),w.set(y,q.get(y)||n("Missing arg converter:",y))}const N=function(c){return typeof c=="string"?t.scopedAllocCString(c):c?x(c):null};q.set("string",N).set("utf8",N).set("pointer",N),w.set("string",c=>t.cstrToJs(c)).set("utf8",w.get("string")).set("string:dealloc",c=>{try{return c?t.cstrToJs(c):null}finally{t.dealloc(c)}}).set("utf8:dealloc",w.get("string:dealloc")).set("json",c=>JSON.parse(t.cstrToJs(c))).set("json:dealloc",c=>{try{return c?JSON.parse(t.cstrToJs(c)):null}finally{t.dealloc(c)}});const P=class{constructor(c){this.name=c.name||"unnamed adapter"}convertArg(c,d,y){n("AbstractArgAdapter must be subclassed.")}};q.FuncPtrAdapter=class Ae extends P{constructor(d){super(d),q.FuncPtrAdapter.warnOnUse&&console.warn("xArg.FuncPtrAdapter is an internal-only API","and is not intended to be invoked from","client-level code. Invoked with:",d),this.name=d.name||"unnamed",this.signature=d.signature,d.contextKey instanceof Function&&(this.contextKey=d.contextKey,d.bindScope||(d.bindScope="context")),this.bindScope=d.bindScope||n("FuncPtrAdapter options requires a bindScope (explicit or implied)."),Ae.bindScopes.indexOf(d.bindScope)<0&&n("Invalid options.bindScope ("+d.bindMod+") for FuncPtrAdapter. Expecting one of: ("+Ae.bindScopes.join(", ")+")"),this.isTransient=this.bindScope==="transient",this.isContext=this.bindScope==="context",this.isPermanent=this.bindScope==="permanent",this.singleton=this.bindScope==="singleton"?[]:void 0,this.callProxy=d.callProxy instanceof Function?d.callProxy:void 0}contextKey(d,y){return this}contextMap(d){const y=this.__cmap||(this.__cmap=new Map);let B=y.get(d);return B===void 0&&y.set(d,B=[]),B}convertArg(d,y,B){let f=this.singleton;if(!f&&this.isContext&&(f=this.contextMap(this.contextKey(y,B))),f&&f[0]===d)return f[1];if(d instanceof Function){this.callProxy&&(d=this.callProxy(d));const m=g(d,this.signature,this.isTransient);if(Ae.debugFuncInstall&&Ae.debugOut("FuncPtrAdapter installed",this,this.contextKey(y,B),"@"+m,d),f){if(f[1]){Ae.debugFuncInstall&&Ae.debugOut("FuncPtrAdapter uninstalling",this,this.contextKey(y,B),"@"+f[1],d);try{o.scopedAlloc[o.scopedAlloc.length-1].push(f[1])}catch{}}f[0]=d,f[1]=m}return m}else if(t.isPtr(d)||d===null||d===void 0){if(f&&f[1]&&f[1]!==d){Ae.debugFuncInstall&&Ae.debugOut("FuncPtrAdapter uninstalling",this,this.contextKey(y,B),"@"+f[1],d);try{o.scopedAlloc[o.scopedAlloc.length-1].push(f[1])}catch{}f[0]=f[1]=d|0}return d||0}else throw new TypeError("Invalid FuncPtrAdapter argument type. Expecting a function pointer or a "+(this.name?this.name+" ":"")+"function matching signature "+this.signature+".")}},q.FuncPtrAdapter.warnOnUse=!1,q.FuncPtrAdapter.debugFuncInstall=!1,q.FuncPtrAdapter.debugOut=console.debug.bind(console),q.FuncPtrAdapter.bindScopes=["transient","context","singleton","permanent"];const S=c=>q.get(c)||n("Argument adapter not found:",c),L=c=>w.get(c)||n("Result adapter not found:",c);o.xWrap.convertArg=(c,...d)=>S(c)(...d),o.xWrap.convertArgNoCheck=(c,...d)=>q.get(c)(...d),o.xWrap.convertResult=(c,d)=>c===null?d:c?L(c)(d):void 0,o.xWrap.convertResultNoCheck=(c,d)=>c===null?d:c?w.get(c)(d):void 0,t.xWrap=function(c,d,...y){arguments.length===3&&Array.isArray(arguments[2])&&(y=arguments[2]),t.isPtr(c)&&(c=t.functionEntry(c)||n("Function pointer not found in WASM function table."));const B=c instanceof Function,f=B?c:t.xGet(c);if(B&&(c=f.name||"unnamed function"),y.length!==f.length&&D(c,f.length),d===null&&f.length===0)return f;d!=null&&L(d);for(const l of y)l instanceof P?q.set(l,(..._)=>l.convertArg(..._)):S(l);const m=o.xWrap;return f.length===0?(...l)=>l.length?D(c,f.length):m.convertResult(d,f.call(null)):function(...l){l.length!==f.length&&D(c,f.length);const _=t.scopedAllocPush();try{let u=0;for(;ufetch(t.uri,{credentials:"same-origin"}),r=this,s=function(p){if(t.wasmUtilTarget){const g=(...R)=>{throw new Error(R.join(" "))},O=t.wasmUtilTarget;if(O.module=p.module,O.instance=p.instance,O.instance.exports.memory||(O.memory=t.imports&&t.imports.env&&t.imports.env.memory||g("Missing 'memory' object!")),!O.alloc&&p.instance.exports.malloc){const R=p.instance.exports;O.alloc=function(z){return R.malloc(z)||g("Allocation of",z,"bytes failed.")},O.dealloc=function(z){R.free(z)}}r(O)}return t.onload&&t.onload(p,t),p};return WebAssembly.instantiateStreaming?function(){return WebAssembly.instantiateStreaming(n(),t.imports||{}).then(s)}:function(){return n().then(g=>g.arrayBuffer()).then(g=>WebAssembly.instantiate(g,t.imports||{})).then(s)}}).bind(globalThis.WhWasmUtilInstaller),globalThis.Jaccwabyt=function t(n){const r=(...F)=>{throw new Error(F.join(" "))};!(n.heap instanceof WebAssembly.Memory)&&!(n.heap instanceof Function)&&r("config.heap must be WebAssembly.Memory instance or a function."),["alloc","dealloc"].forEach(function(F){n[F]instanceof Function||r("Config option '"+F+"' must be a function.")});const s=t,o=n.heap instanceof Function?n.heap:()=>new Uint8Array(n.heap.buffer),p=n.alloc,g=n.dealloc,O=n.log||console.log.bind(console),R=n.memberPrefix||"",z=n.memberSuffix||"",W=n.bigIntEnabled===void 0?!!globalThis.BigInt64Array:!!n.bigIntEnabled,T=globalThis.BigInt,A=globalThis.BigInt64Array,D=n.ptrSizeof||4,q=n.ptrIR||"i32";s.debugFlags||(s.__makeDebugFlags=function(F=null){F&&F.__flags&&(F=F.__flags);const V=function K(X){return arguments.length===0?K.__flags:(X<0?(delete K.__flags.getter,delete K.__flags.setter,delete K.__flags.alloc,delete K.__flags.dealloc):(K.__flags.getter=(1&X)!==0,K.__flags.setter=(2&X)!==0,K.__flags.alloc=(4&X)!==0,K.__flags.dealloc=(8&X)!==0),K._flags)};return Object.defineProperty(V,"__flags",{iterable:!1,writable:!1,value:Object.create(F)}),F||V(0),V},s.debugFlags=s.__makeDebugFlags());const w=(function(){const F=new ArrayBuffer(2);return new DataView(F).setInt16(0,256,!0),new Int16Array(F)[0]===256})(),x=F=>F[1]==="(",N=F=>F==="P",P=F=>x(F)?"p":F[0],S=function(F){switch(P(F)){case"c":case"C":return"i8";case"i":return"i32";case"p":case"P":case"s":return q;case"j":return"i64";case"f":return"float";case"d":return"double"}r("Unhandled signature IR:",F)},L=A?()=>!0:()=>r("BigInt64Array is not available."),$=function(F){switch(P(F)){case"p":case"P":case"s":{switch(D){case 4:return"getInt32";case 8:return L()&&"getBigInt64"}break}case"i":return"getInt32";case"c":return"getInt8";case"C":return"getUint8";case"j":return L()&&"getBigInt64";case"f":return"getFloat32";case"d":return"getFloat64"}r("Unhandled DataView getter for signature:",F)},c=function(F){switch(P(F)){case"p":case"P":case"s":{switch(D){case 4:return"setInt32";case 8:return L()&&"setBigInt64"}break}case"i":return"setInt32";case"c":return"setInt8";case"C":return"setUint8";case"j":return L()&&"setBigInt64";case"f":return"setFloat32";case"d":return"setFloat64"}r("Unhandled DataView setter for signature:",F)},d=function(F){switch(P(F)){case"i":case"f":case"c":case"C":case"d":return Number;case"j":return L()&&T;case"p":case"P":case"s":switch(D){case 4:return Number;case 8:return L()&&T}break}r("Unhandled DataView set wrapper for signature:",F)},y=(F,V)=>F+"::"+V,B=function(F,V){return()=>r(y(F,V),"is read-only.")},f=new WeakMap,m="(pointer-is-external)",l=function(F,V,K){if(K||(K=f.get(V)),K){if(f.delete(V),Array.isArray(V.ondispose)){let X;for(;X=V.ondispose.shift();)try{X instanceof Function?X.call(V):X instanceof te?X.dispose():typeof X=="number"&&g(X)}catch(ae){console.warn("ondispose() for",F.structName,"@",K,"threw. NOT propagating it.",ae)}}else if(V.ondispose instanceof Function)try{V.ondispose()}catch(X){console.warn("ondispose() for",F.structName,"@",K,"threw. NOT propagating it.",X)}delete V.ondispose,F.debugFlags.__flags.dealloc&&O("debug.dealloc:",V[m]?"EXTERNAL":"",F.structName,"instance:",F.structInfo.sizeof,"bytes @"+K),V[m]||g(K)}},_=F=>({configurable:!1,writable:!1,iterable:!1,value:F}),u=function(F,V,K){let X=!K;K?Object.defineProperty(V,m,_(K)):(K=p(F.structInfo.sizeof),K||r("Allocation of",F.structName,"structure failed."));try{F.debugFlags.__flags.alloc&&O("debug.alloc:",X?"":"EXTERNAL",F.structName,"instance:",F.structInfo.sizeof,"bytes @"+K),X&&o().fill(0,K,K+F.structInfo.sizeof),f.set(V,K)}catch(ae){throw l(F,V,K),ae}},I=function(){const F=this.pointer;return F?new Uint8Array(o().slice(F,F+this.structInfo.sizeof)):null},ee=_(F=>R+F+z),ne=function(F,V,K=!0){let X=F.members[V];if(!X&&(R||z)){for(const ae of Object.values(F.members))if(ae.key===V){X=ae;break}!X&&K&&r(y(F.name,V),"is not a mapped struct member.")}return X},re=function F(V,K,X=!1){F._||(F._=de=>de.replace(/[^vipPsjrdcC]/g,"").replace(/[pPscC]/g,"i"));const ae=ne(V.structInfo,K,!0);return X?F._(ae.signature):ae.signature},se={configurable:!1,enumerable:!1,get:function(){return f.get(this)},set:()=>r("Cannot assign the 'pointer' property of a struct.")},j=_(function(){const F=[];for(const V of Object.keys(this.structInfo.members))F.push(this.memberKey(V));return F}),b=new TextDecoder("utf-8"),k=new TextEncoder,Q=typeof SharedArrayBuffer>"u"?function(){}:SharedArrayBuffer,H=function(F,V,K){return b.decode(F.buffer instanceof Q?F.slice(V,K):F.subarray(V,K))},Z=function(F,V,K=!1){const X=ne(F.structInfo,V,K);return X&&X.signature.length===1&&X.signature[0]==="s"?X:!1},E=function(F){F.signature!=="s"&&r("Invalid member type signature for C-string value:",JSON.stringify(F))},C=function(V,K){const X=ne(V.structInfo,K,!0);E(X);const ae=V[X.key];if(!ae)return null;let de=ae;const ue=o();for(;ue[de]!==0;++de);return ae===de?"":H(ue,ae,de)},M=function(F,...V){F.ondispose?Array.isArray(F.ondispose)||(F.ondispose=[F.ondispose]):F.ondispose=[],F.ondispose.push(...V)},J=function(F){const V=k.encode(F),K=p(V.length+1);K||r("Allocation error while duplicating string:",F);const X=o();return X.set(V,K),X[K+V.length]=0,K},G=function(F,V,K){const X=ne(F.structInfo,V,!0);E(X);const ae=J(K);return F[X.key]=ae,M(F,ae),F},te=function(V,K){arguments[2]!==_&&r("Do not call the StructType constructor","from client-level code."),Object.defineProperties(this,{structName:_(V),structInfo:_(K)})};te.prototype=Object.create(null,{dispose:_(function(){l(this.constructor,this)}),lookupMember:_(function(F,V=!0){return ne(this.structInfo,F,V)}),memberToJsString:_(function(F){return C(this,F)}),memberIsString:_(function(F,V=!0){return Z(this,F,V)}),memberKey:ee,memberKeys:j,memberSignature:_(function(F,V=!1){return re(this,F,V)}),memoryDump:_(I),pointer:se,setMemberCString:_(function(F,V){return G(this,F,V)})}),Object.assign(te.prototype,{addOnDispose:function(...F){return M(this,...F),this}}),Object.defineProperties(te,{allocCString:_(J),isA:_(F=>F instanceof te),hasExternalPointer:_(F=>F instanceof te&&!!F[m]),memberKey:ee});const oe=F=>Number.isFinite(F)||F instanceof(T||Number),Y=function F(V,K,X){if(!F._){F._={getters:{},setters:{},sw:{}};const me=["i","c","C","p","P","s","f","d","v()"];W&&me.push("j"),me.forEach(function(we){F._.getters[we]=$(we),F._.setters[we]=c(we),F._.sw[we]=d(we)});const $n=/^[ipPsjfdcC]$/,Kn=/^[vipPsjfdcC]\([ipPsjfdcC]*\)$/;F.sigCheck=function(we,Jn,kt,it){Object.prototype.hasOwnProperty.call(we,kt)&&r(we.structName,"already has a property named",kt+"."),$n.test(it)||Kn.test(it)||r("Malformed signature for",y(we.structName,Jn)+":",it)}}const ae=V.memberKey(K);F.sigCheck(V.prototype,K,ae,X.signature),X.key=ae,X.name=K;const de=P(X.signature),ue=y(V.prototype.structName,ae),fe=V.prototype.debugFlags.__flags,Re=Object.create(null);Re.configurable=!1,Re.enumerable=!1,Re.get=function(){fe.getter&&O("debug.getter:",F._.getters[de],"for",S(de),ue,"@",this.pointer,"+",X.offset,"sz",X.sizeof);let me=new DataView(o().buffer,this.pointer+X.offset,X.sizeof)[F._.getters[de]](0,w);return fe.getter&&O("debug.getter:",ue,"result =",me),me},X.readOnly?Re.set=B(V.prototype.structName,ae):Re.set=function(me){if(fe.setter&&O("debug.setter:",F._.setters[de],"for",S(de),ue,"@",this.pointer,"+",X.offset,"sz",X.sizeof,me),this.pointer||r("Cannot set struct property on disposed instance."),me===null)me=0;else for(;!oe(me);){if(N(X.signature)&&me instanceof te){me=me.pointer||0,fe.setter&&O("debug.setter:",ue,"resolved to",me);break}r("Invalid value for pointer-type",ue+".")}new DataView(o().buffer,this.pointer+X.offset,X.sizeof)[F._.setters[de]](0,F._.sw[de](me),w)},Object.defineProperty(V.prototype,ae,Re)},pe=function F(V,K){arguments.length===1?(K=V,V=K.name):K.name||(K.name=V),V||r("Struct name is required.");let X=!1;Object.keys(K.members).forEach(ue=>{const fe=K.members[ue];fe.sizeof?fe.sizeof===1?fe.signature==="c"||fe.signature==="C"||r("Unexpected sizeof==1 member",y(K.name,ue),"with signature",fe.signature):(fe.sizeof%4!==0&&(console.warn("Invalid struct member description =",fe,"from",K),r(V,"member",ue,"sizeof is not aligned. sizeof="+fe.sizeof)),fe.offset%4!==0&&(console.warn("Invalid struct member description =",fe,"from",K),r(V,"member",ue,"offset is not aligned. offset="+fe.offset))):r(V,"member",ue,"is missing sizeof."),(!X||X.offsetue instanceof de),memberKey:ee,memberKeys:j,methodInfoForKey:_(function(ue){}),structInfo:_(K),structName:_(V)}),de.prototype=new te(V,K,_),Object.defineProperties(de.prototype,{debugFlags:ae,constructor:_(de)}),Object.keys(K.members).forEach(ue=>Y(de,ue,K.members[ue])),de};return pe.StructType=te,pe.config=n,pe.allocCString=J,pe.debugFlags||(pe.debugFlags=s.__makeDebugFlags(s.debugFlags)),pe},globalThis.sqlite3ApiBootstrap.initializers.push(function(t){const n=(...q)=>{throw new Error(q.join(" "))};t.SQLite3Error.toss;const r=t.capi,s=t.wasm,o=t.util;if(globalThis.WhWasmUtilInstaller(s),delete globalThis.WhWasmUtilInstaller,s.bindingSignatures=[["sqlite3_aggregate_context","void*","sqlite3_context*","int"],["sqlite3_bind_double","int","sqlite3_stmt*","int","f64"],["sqlite3_bind_int","int","sqlite3_stmt*","int","int"],["sqlite3_bind_null",void 0,"sqlite3_stmt*","int"],["sqlite3_bind_parameter_count","int","sqlite3_stmt*"],["sqlite3_bind_parameter_index","int","sqlite3_stmt*","string"],["sqlite3_bind_parameter_name","string","sqlite3_stmt*","int"],["sqlite3_bind_pointer","int","sqlite3_stmt*","int","*","string:static","*"],["sqlite3_busy_handler","int",["sqlite3*",new s.xWrap.FuncPtrAdapter({signature:"i(pi)",contextKey:(q,w)=>q[0]}),"*"]],["sqlite3_busy_timeout","int","sqlite3*","int"],["sqlite3_changes","int","sqlite3*"],["sqlite3_clear_bindings","int","sqlite3_stmt*"],["sqlite3_collation_needed","int","sqlite3*","*","*"],["sqlite3_column_blob","*","sqlite3_stmt*","int"],["sqlite3_column_bytes","int","sqlite3_stmt*","int"],["sqlite3_column_count","int","sqlite3_stmt*"],["sqlite3_column_decltype","string","sqlite3_stmt*","int"],["sqlite3_column_double","f64","sqlite3_stmt*","int"],["sqlite3_column_int","int","sqlite3_stmt*","int"],["sqlite3_column_name","string","sqlite3_stmt*","int"],["sqlite3_column_text","string","sqlite3_stmt*","int"],["sqlite3_column_type","int","sqlite3_stmt*","int"],["sqlite3_column_value","sqlite3_value*","sqlite3_stmt*","int"],["sqlite3_commit_hook","void*",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"sqlite3_commit_hook",signature:"i(p)",contextKey:q=>q[0]}),"*"]],["sqlite3_compileoption_get","string","int"],["sqlite3_compileoption_used","int","string"],["sqlite3_complete","int","string:flexible"],["sqlite3_context_db_handle","sqlite3*","sqlite3_context*"],["sqlite3_data_count","int","sqlite3_stmt*"],["sqlite3_db_filename","string","sqlite3*","string"],["sqlite3_db_handle","sqlite3*","sqlite3_stmt*"],["sqlite3_db_name","string","sqlite3*","int"],["sqlite3_db_readonly","int","sqlite3*","string"],["sqlite3_db_status","int","sqlite3*","int","*","*","int"],["sqlite3_errcode","int","sqlite3*"],["sqlite3_errmsg","string","sqlite3*"],["sqlite3_error_offset","int","sqlite3*"],["sqlite3_errstr","string","int"],["sqlite3_exec","int",["sqlite3*","string:flexible",new s.xWrap.FuncPtrAdapter({signature:"i(pipp)",bindScope:"transient",callProxy:q=>{let w;return(x,N,P,S)=>{try{const L=s.cArgvToJs(N,P);return w||(w=s.cArgvToJs(N,S)),q(L,w)|0}catch(L){return L.resultCode||r.SQLITE_ERROR}}}}),"*","**"]],["sqlite3_expanded_sql","string","sqlite3_stmt*"],["sqlite3_extended_errcode","int","sqlite3*"],["sqlite3_extended_result_codes","int","sqlite3*","int"],["sqlite3_file_control","int","sqlite3*","string","int","*"],["sqlite3_finalize","int","sqlite3_stmt*"],["sqlite3_free",void 0,"*"],["sqlite3_get_autocommit","int","sqlite3*"],["sqlite3_get_auxdata","*","sqlite3_context*","int"],["sqlite3_initialize",void 0],["sqlite3_interrupt",void 0,"sqlite3*"],["sqlite3_is_interrupted","int","sqlite3*"],["sqlite3_keyword_count","int"],["sqlite3_keyword_name","int",["int","**","*"]],["sqlite3_keyword_check","int",["string","int"]],["sqlite3_libversion","string"],["sqlite3_libversion_number","int"],["sqlite3_limit","int",["sqlite3*","int","int"]],["sqlite3_malloc","*","int"],["sqlite3_open","int","string","*"],["sqlite3_open_v2","int","string","*","int","string"],["sqlite3_realloc","*","*","int"],["sqlite3_reset","int","sqlite3_stmt*"],["sqlite3_result_blob",void 0,"sqlite3_context*","*","int","*"],["sqlite3_result_double",void 0,"sqlite3_context*","f64"],["sqlite3_result_error",void 0,"sqlite3_context*","string","int"],["sqlite3_result_error_code",void 0,"sqlite3_context*","int"],["sqlite3_result_error_nomem",void 0,"sqlite3_context*"],["sqlite3_result_error_toobig",void 0,"sqlite3_context*"],["sqlite3_result_int",void 0,"sqlite3_context*","int"],["sqlite3_result_null",void 0,"sqlite3_context*"],["sqlite3_result_pointer",void 0,"sqlite3_context*","*","string:static","*"],["sqlite3_result_subtype",void 0,"sqlite3_value*","int"],["sqlite3_result_text",void 0,"sqlite3_context*","string","int","*"],["sqlite3_result_zeroblob",void 0,"sqlite3_context*","int"],["sqlite3_rollback_hook","void*",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"sqlite3_rollback_hook",signature:"v(p)",contextKey:q=>q[0]}),"*"]],["sqlite3_set_auxdata",void 0,["sqlite3_context*","int","*","*"]],["sqlite3_shutdown",void 0],["sqlite3_sourceid","string"],["sqlite3_sql","string","sqlite3_stmt*"],["sqlite3_status","int","int","*","*","int"],["sqlite3_step","int","sqlite3_stmt*"],["sqlite3_stmt_busy","int","sqlite3_stmt*"],["sqlite3_stmt_readonly","int","sqlite3_stmt*"],["sqlite3_stmt_status","int","sqlite3_stmt*","int","int"],["sqlite3_strglob","int","string","string"],["sqlite3_stricmp","int","string","string"],["sqlite3_strlike","int","string","string","int"],["sqlite3_strnicmp","int","string","string","int"],["sqlite3_table_column_metadata","int","sqlite3*","string","string","string","**","**","*","*","*"],["sqlite3_total_changes","int","sqlite3*"],["sqlite3_trace_v2","int",["sqlite3*","int",new s.xWrap.FuncPtrAdapter({name:"sqlite3_trace_v2::callback",signature:"i(ippp)",contextKey:(q,w)=>q[0]}),"*"]],["sqlite3_txn_state","int",["sqlite3*","string"]],["sqlite3_uri_boolean","int","sqlite3_filename","string","int"],["sqlite3_uri_key","string","sqlite3_filename","int"],["sqlite3_uri_parameter","string","sqlite3_filename","string"],["sqlite3_user_data","void*","sqlite3_context*"],["sqlite3_value_blob","*","sqlite3_value*"],["sqlite3_value_bytes","int","sqlite3_value*"],["sqlite3_value_double","f64","sqlite3_value*"],["sqlite3_value_dup","sqlite3_value*","sqlite3_value*"],["sqlite3_value_free",void 0,"sqlite3_value*"],["sqlite3_value_frombind","int","sqlite3_value*"],["sqlite3_value_int","int","sqlite3_value*"],["sqlite3_value_nochange","int","sqlite3_value*"],["sqlite3_value_numeric_type","int","sqlite3_value*"],["sqlite3_value_pointer","*","sqlite3_value*","string:static"],["sqlite3_value_subtype","int","sqlite3_value*"],["sqlite3_value_text","string","sqlite3_value*"],["sqlite3_value_type","int","sqlite3_value*"],["sqlite3_vfs_find","*","string"],["sqlite3_vfs_register","int","sqlite3_vfs*","int"],["sqlite3_vfs_unregister","int","sqlite3_vfs*"]],s.exports.sqlite3_progress_handler&&s.bindingSignatures.push(["sqlite3_progress_handler",void 0,["sqlite3*","int",new s.xWrap.FuncPtrAdapter({name:"xProgressHandler",signature:"i(p)",bindScope:"context",contextKey:(q,w)=>q[0]}),"*"]]),s.exports.sqlite3_stmt_explain&&s.bindingSignatures.push(["sqlite3_stmt_explain","int","sqlite3_stmt*","int"],["sqlite3_stmt_isexplain","int","sqlite3_stmt*"]),s.exports.sqlite3_set_authorizer&&s.bindingSignatures.push(["sqlite3_set_authorizer","int",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"sqlite3_set_authorizer::xAuth",signature:"i(pissss)",contextKey:(q,w)=>q[0],callProxy:q=>(w,x,N,P,S,L)=>{try{return N=N&&s.cstrToJs(N),P=P&&s.cstrToJs(P),S=S&&s.cstrToJs(S),L=L&&s.cstrToJs(L),q(w,x,N,P,S,L)||0}catch($){return $.resultCode||r.SQLITE_ERROR}}}),"*"]]),s.bindingSignatures.int64=[["sqlite3_bind_int64","int",["sqlite3_stmt*","int","i64"]],["sqlite3_changes64","i64",["sqlite3*"]],["sqlite3_column_int64","i64",["sqlite3_stmt*","int"]],["sqlite3_deserialize","int","sqlite3*","string","*","i64","i64","int"],["sqlite3_last_insert_rowid","i64",["sqlite3*"]],["sqlite3_malloc64","*","i64"],["sqlite3_msize","i64","*"],["sqlite3_overload_function","int",["sqlite3*","string","int"]],["sqlite3_realloc64","*","*","i64"],["sqlite3_result_int64",void 0,"*","i64"],["sqlite3_result_zeroblob64","int","*","i64"],["sqlite3_serialize","*","sqlite3*","string","*","int"],["sqlite3_set_last_insert_rowid",void 0,["sqlite3*","i64"]],["sqlite3_status64","int","int","*","*","int"],["sqlite3_total_changes64","i64",["sqlite3*"]],["sqlite3_update_hook","*",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"sqlite3_update_hook",signature:"v(iippj)",contextKey:q=>q[0],callProxy:q=>(w,x,N,P,S)=>{q(w,x,s.cstrToJs(N),s.cstrToJs(P),S)}}),"*"]],["sqlite3_uri_int64","i64",["sqlite3_filename","string","i64"]],["sqlite3_value_int64","i64","sqlite3_value*"]],s.bigIntEnabled&&s.exports.sqlite3_declare_vtab&&s.bindingSignatures.int64.push(["sqlite3_create_module","int",["sqlite3*","string","sqlite3_module*","*"]],["sqlite3_create_module_v2","int",["sqlite3*","string","sqlite3_module*","*","*"]],["sqlite3_declare_vtab","int",["sqlite3*","string:flexible"]],["sqlite3_drop_modules","int",["sqlite3*","**"]],["sqlite3_vtab_collation","string","sqlite3_index_info*","int"],["sqlite3_vtab_distinct","int","sqlite3_index_info*"],["sqlite3_vtab_in","int","sqlite3_index_info*","int","int"],["sqlite3_vtab_in_first","int","sqlite3_value*","**"],["sqlite3_vtab_in_next","int","sqlite3_value*","**"],["sqlite3_vtab_nochange","int","sqlite3_context*"],["sqlite3_vtab_on_conflict","int","sqlite3*"],["sqlite3_vtab_rhs_value","int","sqlite3_index_info*","int","**"]),s.bigIntEnabled&&s.exports.sqlite3_preupdate_hook&&s.bindingSignatures.int64.push(["sqlite3_preupdate_blobwrite","int","sqlite3*"],["sqlite3_preupdate_count","int","sqlite3*"],["sqlite3_preupdate_depth","int","sqlite3*"],["sqlite3_preupdate_hook","*",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"sqlite3_preupdate_hook",signature:"v(ppippjj)",contextKey:q=>q[0],callProxy:q=>(w,x,N,P,S,L,$)=>{q(w,x,N,s.cstrToJs(P),s.cstrToJs(S),L,$)}}),"*"]],["sqlite3_preupdate_new","int",["sqlite3*","int","**"]],["sqlite3_preupdate_old","int",["sqlite3*","int","**"]]),s.bigIntEnabled&&s.exports.sqlite3changegroup_add&&s.exports.sqlite3session_create&&s.exports.sqlite3_preupdate_hook){const q={signature:"i(ps)",callProxy:w=>(x,N)=>{try{return w(x,s.cstrToJs(N))|0}catch(P){return P.resultCode||r.SQLITE_ERROR}}};s.bindingSignatures.int64.push(["sqlite3changegroup_add","int",["sqlite3_changegroup*","int","void*"]],["sqlite3changegroup_add_strm","int",["sqlite3_changegroup*",new s.xWrap.FuncPtrAdapter({name:"xInput",signature:"i(ppp)",bindScope:"transient"}),"void*"]],["sqlite3changegroup_delete",void 0,["sqlite3_changegroup*"]],["sqlite3changegroup_new","int",["**"]],["sqlite3changegroup_output","int",["sqlite3_changegroup*","int*","**"]],["sqlite3changegroup_output_strm","int",["sqlite3_changegroup*",new s.xWrap.FuncPtrAdapter({name:"xOutput",signature:"i(ppi)",bindScope:"transient"}),"void*"]],["sqlite3changeset_apply","int",["sqlite3*","int","void*",new s.xWrap.FuncPtrAdapter({name:"xFilter",bindScope:"transient",...q}),new s.xWrap.FuncPtrAdapter({name:"xConflict",signature:"i(pip)",bindScope:"transient"}),"void*"]],["sqlite3changeset_apply_strm","int",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"xInput",signature:"i(ppp)",bindScope:"transient"}),"void*",new s.xWrap.FuncPtrAdapter({name:"xFilter",bindScope:"transient",...q}),new s.xWrap.FuncPtrAdapter({name:"xConflict",signature:"i(pip)",bindScope:"transient"}),"void*"]],["sqlite3changeset_apply_v2","int",["sqlite3*","int","void*",new s.xWrap.FuncPtrAdapter({name:"xFilter",bindScope:"transient",...q}),new s.xWrap.FuncPtrAdapter({name:"xConflict",signature:"i(pip)",bindScope:"transient"}),"void*","**","int*","int"]],["sqlite3changeset_apply_v2_strm","int",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"xInput",signature:"i(ppp)",bindScope:"transient"}),"void*",new s.xWrap.FuncPtrAdapter({name:"xFilter",bindScope:"transient",...q}),new s.xWrap.FuncPtrAdapter({name:"xConflict",signature:"i(pip)",bindScope:"transient"}),"void*","**","int*","int"]],["sqlite3changeset_concat","int",["int","void*","int","void*","int*","**"]],["sqlite3changeset_concat_strm","int",[new s.xWrap.FuncPtrAdapter({name:"xInputA",signature:"i(ppp)",bindScope:"transient"}),"void*",new s.xWrap.FuncPtrAdapter({name:"xInputB",signature:"i(ppp)",bindScope:"transient"}),"void*",new s.xWrap.FuncPtrAdapter({name:"xOutput",signature:"i(ppi)",bindScope:"transient"}),"void*"]],["sqlite3changeset_conflict","int",["sqlite3_changeset_iter*","int","**"]],["sqlite3changeset_finalize","int",["sqlite3_changeset_iter*"]],["sqlite3changeset_fk_conflicts","int",["sqlite3_changeset_iter*","int*"]],["sqlite3changeset_invert","int",["int","void*","int*","**"]],["sqlite3changeset_invert_strm","int",[new s.xWrap.FuncPtrAdapter({name:"xInput",signature:"i(ppp)",bindScope:"transient"}),"void*",new s.xWrap.FuncPtrAdapter({name:"xOutput",signature:"i(ppi)",bindScope:"transient"}),"void*"]],["sqlite3changeset_new","int",["sqlite3_changeset_iter*","int","**"]],["sqlite3changeset_next","int",["sqlite3_changeset_iter*"]],["sqlite3changeset_old","int",["sqlite3_changeset_iter*","int","**"]],["sqlite3changeset_op","int",["sqlite3_changeset_iter*","**","int*","int*","int*"]],["sqlite3changeset_pk","int",["sqlite3_changeset_iter*","**","int*"]],["sqlite3changeset_start","int",["**","int","*"]],["sqlite3changeset_start_strm","int",["**",new s.xWrap.FuncPtrAdapter({name:"xInput",signature:"i(ppp)",bindScope:"transient"}),"void*"]],["sqlite3changeset_start_v2","int",["**","int","*","int"]],["sqlite3changeset_start_v2_strm","int",["**",new s.xWrap.FuncPtrAdapter({name:"xInput",signature:"i(ppp)",bindScope:"transient"}),"void*","int"]],["sqlite3session_attach","int",["sqlite3_session*","string"]],["sqlite3session_changeset","int",["sqlite3_session*","int*","**"]],["sqlite3session_changeset_size","i64",["sqlite3_session*"]],["sqlite3session_changeset_strm","int",["sqlite3_session*",new s.xWrap.FuncPtrAdapter({name:"xOutput",signature:"i(ppp)",bindScope:"transient"}),"void*"]],["sqlite3session_config","int",["int","void*"]],["sqlite3session_create","int",["sqlite3*","string","**"]],["sqlite3session_diff","int",["sqlite3_session*","string","string","**"]],["sqlite3session_enable","int",["sqlite3_session*","int"]],["sqlite3session_indirect","int",["sqlite3_session*","int"]],["sqlite3session_isempty","int",["sqlite3_session*"]],["sqlite3session_memory_used","i64",["sqlite3_session*"]],["sqlite3session_object_config","int",["sqlite3_session*","int","void*"]],["sqlite3session_patchset","int",["sqlite3_session*","*","**"]],["sqlite3session_patchset_strm","int",["sqlite3_session*",new s.xWrap.FuncPtrAdapter({name:"xOutput",signature:"i(ppp)",bindScope:"transient"}),"void*"]],["sqlite3session_table_filter",void 0,["sqlite3_session*",new s.xWrap.FuncPtrAdapter({name:"xFilter",...q,contextKey:(w,x)=>w[0]}),"*"]])}s.bindingSignatures.wasmInternal=[["sqlite3__wasm_db_reset","int","sqlite3*"],["sqlite3__wasm_db_vfs","sqlite3_vfs*","sqlite3*","string"],["sqlite3__wasm_vfs_create_file","int","sqlite3_vfs*","string","*","int"],["sqlite3__wasm_posix_create_file","int","string","*","int"],["sqlite3__wasm_vfs_unlink","int","sqlite3_vfs*","string"],["sqlite3__wasm_qfmt_token","string:dealloc","string","int"]],t.StructBinder=globalThis.Jaccwabyt({heap:s.heap8u,alloc:s.alloc,dealloc:s.dealloc,bigIntEnabled:s.bigIntEnabled,memberPrefix:"$"}),delete globalThis.Jaccwabyt;{const q=s.xWrap.argAdapter("string");s.xWrap.argAdapter("string:flexible",S=>q(o.flexibleString(S))),s.xWrap.argAdapter("string:static",(function(S){return s.isPtr(S)?S:(S=""+S,this[S]||(this[S]=s.allocCString(S)))}).bind(Object.create(null)));const w=s.xWrap.argAdapter("*"),x=function(){};s.xWrap.argAdapter("sqlite3_filename",w)("sqlite3_context*",w)("sqlite3_value*",w)("void*",w)("sqlite3_changegroup*",w)("sqlite3_changeset_iter*",w)("sqlite3_session*",w)("sqlite3_stmt*",S=>w(S instanceof(t?.oo1?.Stmt||x)?S.pointer:S))("sqlite3*",S=>w(S instanceof(t?.oo1?.DB||x)?S.pointer:S))("sqlite3_vfs*",S=>typeof S=="string"?r.sqlite3_vfs_find(S)||t.SQLite3Error.toss(r.SQLITE_NOTFOUND,"Unknown sqlite3_vfs name:",S):w(S instanceof(r.sqlite3_vfs||x)?S.pointer:S)),s.exports.sqlite3_declare_vtab&&s.xWrap.argAdapter("sqlite3_index_info*",S=>w(S instanceof(r.sqlite3_index_info||x)?S.pointer:S))("sqlite3_module*",S=>w(S instanceof(r.sqlite3_module||x)?S.pointer:S));const N=s.xWrap.resultAdapter("*");s.xWrap.resultAdapter("sqlite3*",N)("sqlite3_context*",N)("sqlite3_stmt*",N)("sqlite3_value*",N)("sqlite3_vfs*",N)("void*",N),s.exports.sqlite3_step.length===0&&(s.xWrap.doArgcCheck=!1,t.config.warn("Disabling sqlite3.wasm.xWrap.doArgcCheck due to environmental quirks."));for(const S of s.bindingSignatures)r[S[0]]=s.xWrap.apply(null,S);for(const S of s.bindingSignatures.wasmInternal)o[S[0]]=s.xWrap.apply(null,S);const P=function(S){return()=>n(S+"() is unavailable due to lack","of BigInt support in this build.")};for(const S of s.bindingSignatures.int64)r[S[0]]=s.bigIntEnabled?s.xWrap.apply(null,S):P(S[0]);if(delete s.bindingSignatures,s.exports.sqlite3__wasm_db_error){const S=s.xWrap("sqlite3__wasm_db_error","int","sqlite3*","int","string");o.sqlite3__wasm_db_error=function(L,$,c){return $ instanceof t.WasmAllocError?($=r.SQLITE_NOMEM,c=0):$ instanceof Error&&(c=c||""+$,$=$.resultCode||r.SQLITE_ERROR),L?S(L,$,c):$}}else o.sqlite3__wasm_db_error=function(S,L,$){return console.warn("sqlite3__wasm_db_error() is not exported.",arguments),L}}{const q=s.xCall("sqlite3__wasm_enum_json");q||n("Maintenance required: increase sqlite3__wasm_enum_json()'s","static buffer size!"),s.ctype=JSON.parse(s.cstrToJs(q));const w=["access","authorizer","blobFinalizers","changeset","config","dataTypes","dbConfig","dbStatus","encodings","fcntl","flock","ioCap","limits","openFlags","prepareFlags","resultCodes","sqlite3Status","stmtStatus","syncFlags","trace","txnState","udfFlags","version"];s.bigIntEnabled&&w.push("serialize","session","vtab");for(const P of w)for(const S of Object.entries(s.ctype[P]))r[S[0]]=S[1];s.functionEntry(r.SQLITE_WASM_DEALLOC)||n("Internal error: cannot resolve exported function","entry SQLITE_WASM_DEALLOC (=="+r.SQLITE_WASM_DEALLOC+").");const x=Object.create(null);for(const P of["resultCodes"])for(const S of Object.entries(s.ctype[P]))x[S[1]]=S[0];r.sqlite3_js_rc_str=P=>x[P];const N=Object.assign(Object.create(null),{WasmTestStruct:!0,sqlite3_kvvfs_methods:!o.isUIThread(),sqlite3_index_info:!s.bigIntEnabled,sqlite3_index_constraint:!s.bigIntEnabled,sqlite3_index_orderby:!s.bigIntEnabled,sqlite3_index_constraint_usage:!s.bigIntEnabled});for(const P of s.ctype.structs)N[P.name]||(r[P.name]=t.StructBinder(P));if(r.sqlite3_index_info){for(const P of["sqlite3_index_constraint","sqlite3_index_orderby","sqlite3_index_constraint_usage"])r.sqlite3_index_info[P]=r[P],delete r[P];r.sqlite3_vtab_config=s.xWrap("sqlite3__wasm_vtab_config","int",["sqlite3*","int","int"])}}const p=(q,w,x)=>o.sqlite3__wasm_db_error(q,r.SQLITE_MISUSE,w+"() requires "+x+" argument"+(x===1?"":"s")+"."),g=q=>o.sqlite3__wasm_db_error(q,r.SQLITE_FORMAT,"SQLITE_UTF8 is the only supported encoding."),O=q=>s.xWrap.argAdapter("sqlite3*")(q),R=q=>s.isPtr(q)?s.cstrToJs(q):q,z=(function(q,w){q=O(q);let x=this.dbMap.get(q);if(w)!x&&w>0&&this.dbMap.set(q,x=Object.create(null));else return this.dbMap.delete(q),x;return x}).bind(Object.assign(Object.create(null),{dbMap:new Map}));z.addCollation=function(q,w){const x=z(q,1);x.collation||(x.collation=new Set),x.collation.add(R(w).toLowerCase())},z._addUDF=function(q,w,x,N){w=R(w).toLowerCase();let P=N.get(w);P||N.set(w,P=new Set),P.add(x<0?-1:x)},z.addFunction=function(q,w,x){const N=z(q,1);N.udf||(N.udf=new Map),this._addUDF(q,w,x,N.udf)},s.exports.sqlite3_create_window_function&&(z.addWindowFunc=function(q,w,x){const N=z(q,1);N.wudf||(N.wudf=new Map),this._addUDF(q,w,x,N.wudf)}),z.cleanup=function(q){q=O(q);const w=[q];for(const P of["sqlite3_busy_handler","sqlite3_commit_hook","sqlite3_preupdate_hook","sqlite3_progress_handler","sqlite3_rollback_hook","sqlite3_set_authorizer","sqlite3_trace_v2","sqlite3_update_hook"]){const S=s.exports[P];if(S){w.length=S.length;try{r[P](...w)}catch(L){t.config.warn("close-time call of",P+"(",w,") threw:",L)}}}const x=z(q,0);if(!x)return;if(x.collation){for(const P of x.collation)try{r.sqlite3_create_collation_v2(q,P,r.SQLITE_UTF8,0,0,0)}catch{}delete x.collation}let N;for(N=0;N<2;++N){const P=N?x.wudf:x.udf;if(!P)continue;const S=N?r.sqlite3_create_window_function:r.sqlite3_create_function_v2;for(const L of P){const $=L[0],c=L[1],d=[q,$,0,r.SQLITE_UTF8,0,0,0,0,0];N&&d.push(0);for(const y of c)try{d[2]=y,S.apply(null,d)}catch{}c.clear()}P.clear()}delete x.udf,delete x.wudf};{const q=s.xWrap("sqlite3_close_v2","int","sqlite3*");r.sqlite3_close_v2=function(w){if(arguments.length!==1)return p(w,"sqlite3_close_v2",1);if(w)try{z.cleanup(w)}catch{}return q(w)}}if(r.sqlite3session_create){const q=s.xWrap("sqlite3session_delete",void 0,["sqlite3_session*"]);r.sqlite3session_delete=function(w){if(arguments.length!==1)return p(pDb,"sqlite3session_delete",1);w&&r.sqlite3session_table_filter(w,0,0),q(w)}}{const q=(x,N)=>"argv["+N+"]:"+x[0]+":"+s.cstrToJs(x[1]).toLowerCase(),w=s.xWrap("sqlite3_create_collation_v2","int",["sqlite3*","string","int","*",new s.xWrap.FuncPtrAdapter({name:"xCompare",signature:"i(pipip)",contextKey:q}),new s.xWrap.FuncPtrAdapter({name:"xDestroy",signature:"v(p)",contextKey:q})]);r.sqlite3_create_collation_v2=function(x,N,P,S,L,$){if(arguments.length!==6)return p(x,"sqlite3_create_collation_v2",6);if((P&15)===0)P|=r.SQLITE_UTF8;else if(r.SQLITE_UTF8!==(P&15))return g(x);try{const c=w(x,N,P,S,L,$);return c===0&&L instanceof Function&&z.addCollation(x,N),c}catch(c){return o.sqlite3__wasm_db_error(x,c)}},r.sqlite3_create_collation=(x,N,P,S,L)=>arguments.length===5?r.sqlite3_create_collation_v2(x,N,P,S,L,0):p(x,"sqlite3_create_collation",5)}{const q=function(P,S){return P[0]+":"+(P[2]<0?-1:P[2])+":"+S+":"+s.cstrToJs(P[1]).toLowerCase()},w=Object.assign(Object.create(null),{xInverseAndStep:{signature:"v(pip)",contextKey:q,callProxy:P=>(S,L,$)=>{try{P(S,...r.sqlite3_values_to_js(L,$))}catch(c){r.sqlite3_result_error_js(S,c)}}},xFinalAndValue:{signature:"v(p)",contextKey:q,callProxy:P=>S=>{try{r.sqlite3_result_js(S,P(S))}catch(L){r.sqlite3_result_error_js(S,L)}}},xFunc:{signature:"v(pip)",contextKey:q,callProxy:P=>(S,L,$)=>{try{r.sqlite3_result_js(S,P(S,...r.sqlite3_values_to_js(L,$)))}catch(c){r.sqlite3_result_error_js(S,c)}}},xDestroy:{signature:"v(p)",contextKey:q,callProxy:P=>S=>{try{P(S)}catch(L){console.error("UDF xDestroy method threw:",L)}}}}),x=s.xWrap("sqlite3_create_function_v2","int",["sqlite3*","string","int","int","*",new s.xWrap.FuncPtrAdapter({name:"xFunc",...w.xFunc}),new s.xWrap.FuncPtrAdapter({name:"xStep",...w.xInverseAndStep}),new s.xWrap.FuncPtrAdapter({name:"xFinal",...w.xFinalAndValue}),new s.xWrap.FuncPtrAdapter({name:"xDestroy",...w.xDestroy})]),N=s.exports.sqlite3_create_window_function?s.xWrap("sqlite3_create_window_function","int",["sqlite3*","string","int","int","*",new s.xWrap.FuncPtrAdapter({name:"xStep",...w.xInverseAndStep}),new s.xWrap.FuncPtrAdapter({name:"xFinal",...w.xFinalAndValue}),new s.xWrap.FuncPtrAdapter({name:"xValue",...w.xFinalAndValue}),new s.xWrap.FuncPtrAdapter({name:"xInverse",...w.xInverseAndStep}),new s.xWrap.FuncPtrAdapter({name:"xDestroy",...w.xDestroy})]):void 0;r.sqlite3_create_function_v2=function P(S,L,$,c,d,y,B,f,m){if(P.length!==arguments.length)return p(S,"sqlite3_create_function_v2",P.length);if((c&15)===0)c|=r.SQLITE_UTF8;else if(r.SQLITE_UTF8!==(c&15))return g(S);try{const l=x(S,L,$,c,d,y,B,f,m);return l===0&&(y instanceof Function||B instanceof Function||f instanceof Function||m instanceof Function)&&z.addFunction(S,L,$),l}catch(l){return console.error("sqlite3_create_function_v2() setup threw:",l),o.sqlite3__wasm_db_error(S,l,"Creation of UDF threw: "+l)}},r.sqlite3_create_function=function P(S,L,$,c,d,y,B,f){return P.length===arguments.length?r.sqlite3_create_function_v2(S,L,$,c,d,y,B,f,0):p(S,"sqlite3_create_function",P.length)},N?r.sqlite3_create_window_function=function P(S,L,$,c,d,y,B,f,m,l){if(P.length!==arguments.length)return p(S,"sqlite3_create_window_function",P.length);if((c&15)===0)c|=r.SQLITE_UTF8;else if(r.SQLITE_UTF8!==(c&15))return g(S);try{const _=N(S,L,$,c,d,y,B,f,m,l);return _===0&&(y instanceof Function||B instanceof Function||f instanceof Function||m instanceof Function||l instanceof Function)&&z.addWindowFunc(S,L,$),_}catch(_){return console.error("sqlite3_create_window_function() setup threw:",_),o.sqlite3__wasm_db_error(S,_,"Creation of UDF threw: "+_)}}:delete r.sqlite3_create_window_function,r.sqlite3_create_function_v2.udfSetResult=r.sqlite3_create_function.udfSetResult=r.sqlite3_result_js,r.sqlite3_create_window_function&&(r.sqlite3_create_window_function.udfSetResult=r.sqlite3_result_js),r.sqlite3_create_function_v2.udfConvertArgs=r.sqlite3_create_function.udfConvertArgs=r.sqlite3_values_to_js,r.sqlite3_create_window_function&&(r.sqlite3_create_window_function.udfConvertArgs=r.sqlite3_values_to_js),r.sqlite3_create_function_v2.udfSetError=r.sqlite3_create_function.udfSetError=r.sqlite3_result_error_js,r.sqlite3_create_window_function&&(r.sqlite3_create_window_function.udfSetError=r.sqlite3_result_error_js)}{const q=(x,N)=>(typeof x=="string"?N=-1:o.isSQLableTypedArray(x)?(N=x.byteLength,x=o.typedArrayToString(x instanceof ArrayBuffer?new Uint8Array(x):x)):Array.isArray(x)&&(x=x.join(""),N=-1),[x,N]),w={basic:s.xWrap("sqlite3_prepare_v3","int",["sqlite3*","string","int","int","**","**"]),full:s.xWrap("sqlite3_prepare_v3","int",["sqlite3*","*","int","int","**","**"])};r.sqlite3_prepare_v3=function x(N,P,S,L,$,c){if(x.length!==arguments.length)return p(N,"sqlite3_prepare_v3",x.length);const[d,y]=q(P,S);switch(typeof d){case"string":return w.basic(N,d,y,L,$,null);case"number":return w.full(N,d,y,L,$,c);default:return o.sqlite3__wasm_db_error(N,r.SQLITE_MISUSE,"Invalid SQL argument type for sqlite3_prepare_v2/v3().")}},r.sqlite3_prepare_v2=function x(N,P,S,L,$){return x.length===arguments.length?r.sqlite3_prepare_v3(N,P,S,0,L,$):p(N,"sqlite3_prepare_v2",x.length)}}{const q=s.xWrap("sqlite3_bind_text","int",["sqlite3_stmt*","int","string","int","*"]),w=s.xWrap("sqlite3_bind_blob","int",["sqlite3_stmt*","int","*","int","*"]);r.sqlite3_bind_text=function x(N,P,S,L,$){if(x.length!==arguments.length)return p(r.sqlite3_db_handle(N),"sqlite3_bind_text",x.length);if(s.isPtr(S)||S===null)return q(N,P,S,L,$);S instanceof ArrayBuffer?S=new Uint8Array(S):Array.isArray(pMem)&&(S=pMem.join(""));let c,d;try{if(o.isSQLableTypedArray(S))c=s.allocFromTypedArray(S),d=S.byteLength;else if(typeof S=="string")[c,d]=s.allocCString(S);else return o.sqlite3__wasm_db_error(r.sqlite3_db_handle(N),r.SQLITE_MISUSE,"Invalid 3rd argument type for sqlite3_bind_text().");return q(N,P,c,d,r.SQLITE_WASM_DEALLOC)}catch(y){return s.dealloc(c),o.sqlite3__wasm_db_error(r.sqlite3_db_handle(N),y)}},r.sqlite3_bind_blob=function x(N,P,S,L,$){if(x.length!==arguments.length)return p(r.sqlite3_db_handle(N),"sqlite3_bind_blob",x.length);if(s.isPtr(S)||S===null)return w(N,P,S,L,$);S instanceof ArrayBuffer?S=new Uint8Array(S):Array.isArray(S)&&(S=S.join(""));let c,d;try{if(o.isBindableTypedArray(S))c=s.allocFromTypedArray(S),d=L>=0?L:S.byteLength;else if(typeof S=="string")[c,d]=s.allocCString(S);else return o.sqlite3__wasm_db_error(r.sqlite3_db_handle(N),r.SQLITE_MISUSE,"Invalid 3rd argument type for sqlite3_bind_blob().");return w(N,P,c,d,r.SQLITE_WASM_DEALLOC)}catch(y){return s.dealloc(c),o.sqlite3__wasm_db_error(r.sqlite3_db_handle(N),y)}}}r.sqlite3_config=function(q,...w){if(arguments.length<2)return r.SQLITE_MISUSE;switch(q){case r.SQLITE_CONFIG_COVERING_INDEX_SCAN:case r.SQLITE_CONFIG_MEMSTATUS:case r.SQLITE_CONFIG_SMALL_MALLOC:case r.SQLITE_CONFIG_SORTERREF_SIZE:case r.SQLITE_CONFIG_STMTJRNL_SPILL:case r.SQLITE_CONFIG_URI:return s.exports.sqlite3__wasm_config_i(q,w[0]);case r.SQLITE_CONFIG_LOOKASIDE:return s.exports.sqlite3__wasm_config_ii(q,w[0],w[1]);case r.SQLITE_CONFIG_MEMDB_MAXSIZE:return s.exports.sqlite3__wasm_config_j(q,w[0]);case r.SQLITE_CONFIG_GETMALLOC:case r.SQLITE_CONFIG_GETMUTEX:case r.SQLITE_CONFIG_GETPCACHE2:case r.SQLITE_CONFIG_GETPCACHE:case r.SQLITE_CONFIG_HEAP:case r.SQLITE_CONFIG_LOG:case r.SQLITE_CONFIG_MALLOC:case r.SQLITE_CONFIG_MMAP_SIZE:case r.SQLITE_CONFIG_MULTITHREAD:case r.SQLITE_CONFIG_MUTEX:case r.SQLITE_CONFIG_PAGECACHE:case r.SQLITE_CONFIG_PCACHE2:case r.SQLITE_CONFIG_PCACHE:case r.SQLITE_CONFIG_PCACHE_HDRSZ:case r.SQLITE_CONFIG_PMASZ:case r.SQLITE_CONFIG_SERIALIZED:case r.SQLITE_CONFIG_SINGLETHREAD:case r.SQLITE_CONFIG_SQLLOG:case r.SQLITE_CONFIG_WIN32_HEAPSIZE:default:return r.SQLITE_NOTFOUND}};{const q=new Set;r.sqlite3_auto_extension=function(w){if(w instanceof Function)w=s.installFunction("i(ppp)",w);else if(arguments.length!==1||!s.isPtr(w))return r.SQLITE_MISUSE;const x=s.exports.sqlite3_auto_extension(w);return w!==arguments[0]&&(x===0?q.add(w):s.uninstallFunction(w)),x},r.sqlite3_cancel_auto_extension=function(w){return!w||arguments.length!==1||!s.isPtr(w)?0:s.exports.sqlite3_cancel_auto_extension(w)},r.sqlite3_reset_auto_extension=function(){s.exports.sqlite3_reset_auto_extension();for(const w of q)s.uninstallFunction(w);q.clear()}}const W=r.sqlite3_vfs_find("kvvfs");if(W)if(o.isUIThread()){const q=new r.sqlite3_kvvfs_methods(s.exports.sqlite3__wasm_kvvfs_methods());delete r.sqlite3_kvvfs_methods;const w=s.exports.sqlite3__wasm_kvvfsMakeKeyOnPstack,x=s.pstack,N=S=>s.peek(S)===115?sessionStorage:localStorage,P={xRead:(S,L,$,c)=>{const d=x.pointer,y=s.scopedAllocPush();try{const B=w(S,L);if(!B)return-3;const f=s.cstrToJs(B),m=N(S).getItem(f);if(!m)return-1;const l=m.length;if(c<=0)return l;if(c===1)return s.poke($,0),l;const _=s.scopedAllocCString(m);return c>l+1&&(c=l+1),s.heap8u().copyWithin($,_,_+c-1),s.poke($+c-1,0),c-1}catch(B){return console.error("kvstorageRead()",B),-2}finally{x.restore(d),s.scopedAllocPop(y)}},xWrite:(S,L,$)=>{const c=x.pointer;try{const d=w(S,L);if(!d)return 1;const y=s.cstrToJs(d);return N(S).setItem(y,s.cstrToJs($)),0}catch(d){return console.error("kvstorageWrite()",d),r.SQLITE_IOERR}finally{x.restore(c)}},xDelete:(S,L)=>{const $=x.pointer;try{const c=w(S,L);return c?(N(S).removeItem(s.cstrToJs(c)),0):1}catch(c){return console.error("kvstorageDelete()",c),r.SQLITE_IOERR}finally{x.restore($)}}};for(const S of Object.keys(P))q[q.memberKey(S)]=s.installFunction(q.memberSignature(S),P[S])}else r.sqlite3_vfs_unregister(W);s.xWrap.FuncPtrAdapter.warnOnUse=!0;const T=t.StructBinder,A=function q(w,x,N,P=q.installMethodArgcCheck){if(w instanceof T.StructType?!(N instanceof Function)&&!s.isPtr(N)&&n("Usage error: expecting a Function or WASM pointer to one."):n("Usage error: target object is-not-a StructType."),arguments.length===1)return(c,d)=>q(w,c,d,P);q.argcProxy||(q.argcProxy=function(c,d,y,B){return function(...f){return y.length!==arguments.length&&n("Argument mismatch for",c.structInfo.name+"::"+d+": Native signature is:",B),y.apply(this,f)}},q.removeFuncList=function(){this.ondispose.__removeFuncList&&(this.ondispose.__removeFuncList.forEach((c,d)=>{if(typeof c=="number")try{s.uninstallFunction(c)}catch{}}),delete this.ondispose.__removeFuncList)});const S=w.memberSignature(x);S.length<2&&n("Member",x,"does not have a function pointer signature:",S);const L=w.memberKey(x),$=P&&!s.isPtr(N)?q.argcProxy(w,L,N,S):N;if(s.isPtr($))$&&!s.functionEntry($)&&n("Pointer",$,"is not a WASM function table entry."),w[L]=$;else{const c=s.installFunction($,w.memberSignature(x,!0));w[L]=c,(!w.ondispose||!w.ondispose.__removeFuncList)&&(w.addOnDispose("ondispose.__removeFuncList handler",q.removeFuncList),w.ondispose.__removeFuncList=[]),w.ondispose.__removeFuncList.push(L,c)}return(c,d)=>q(w,c,d,P)};A.installMethodArgcCheck=!1;const D=function(q,w,x=A.installMethodArgcCheck){const N=new Map;for(const P of Object.keys(w)){const S=w[P],L=N.get(S);if(L){const $=q.memberKey(P);q[$]=q[q.memberKey(L)]}else A(q,P,S,x),N.set(S,P)}return q};T.StructType.prototype.installMethod=function(w,x,N=A.installMethodArgcCheck){return arguments.length<3&&w&&typeof w=="object"?D(this,...arguments):A(this,...arguments)},T.StructType.prototype.installMethods=function(q,w=A.installMethodArgcCheck){return D(this,q,w)}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){t.version={libVersion:"3.50.4",libVersionNumber:3050004,sourceId:"2025-07-30 19:33:53 4d8adfb30e03f9cf27f800a2c1ba3c48fb4ca1b08b0f5ed59a4d5ecbf45e20a3",downloadVersion:3500400}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){const n=(...f)=>{throw new t.SQLite3Error(...f)},r=t.capi,s=t.wasm,o=t.util,p=new WeakMap,g=new WeakMap,O=(f,m,l)=>{const _=Object.getOwnPropertyDescriptor(f,m);return _?_.value:l},R=function(f,m){return m&&(f instanceof A&&(f=f.pointer),n(m,"sqlite3 result code",m+":",f?r.sqlite3_errmsg(f):r.sqlite3_errstr(m))),arguments[0]},z=s.installFunction("i(ippp)",(function(f,m,l,_){r.SQLITE_TRACE_STMT===f&&console.log("SQL TRACE #"+ ++this.counter+" via sqlite3@"+m+":",s.cstrToJs(_))}).bind({counter:0})),W=Object.create(null),T=function f(...m){if(!f._name2vfs){f._name2vfs=Object.create(null);const j=typeof importScripts=="function"?b=>n("The VFS for",b,"is only available in the main window thread."):!1;f._name2vfs[":localStorage:"]={vfs:"kvvfs",filename:j||(()=>"local")},f._name2vfs[":sessionStorage:"]={vfs:"kvvfs",filename:j||(()=>"session")}}const l=f.normalizeArgs(...m);let _=l.filename,u=l.vfs,I=l.flags;(typeof _!="string"&&typeof _!="number"||typeof I!="string"||u&&typeof u!="string"&&typeof u!="number")&&(t.config.error("Invalid DB ctor args",l,arguments),n("Invalid arguments for DB constructor."));let U=typeof _=="number"?s.cstrToJs(_):_;const ee=f._name2vfs[U];ee&&(u=ee.vfs,_=U=ee.filename(U));let ne,re=0;I.indexOf("c")>=0&&(re|=r.SQLITE_OPEN_CREATE|r.SQLITE_OPEN_READWRITE),I.indexOf("w")>=0&&(re|=r.SQLITE_OPEN_READWRITE),re===0&&(re|=r.SQLITE_OPEN_READONLY),re|=r.SQLITE_OPEN_EXRESCODE;const se=s.pstack.pointer;try{const j=s.pstack.allocPtr();let b=r.sqlite3_open_v2(_,j,re,u||0);ne=s.peekPtr(j),R(ne,b),r.sqlite3_extended_result_codes(ne,1),I.indexOf("t")>=0&&r.sqlite3_trace_v2(ne,r.SQLITE_TRACE_STMT,z,ne)}catch(j){throw ne&&r.sqlite3_close_v2(ne),j}finally{s.pstack.restore(se)}this.filename=U,p.set(this,ne),g.set(this,Object.create(null));try{const j=r.sqlite3_js_db_vfs(ne)||n("Internal error: cannot get VFS for new db handle."),b=W[j];b&&(b instanceof Function?b(this,t):R(ne,r.sqlite3_exec(ne,b,0,0,0)))}catch(j){throw this.close(),j}};T.setVfsPostOpenCallback=function(f,m){m instanceof Function||n("dbCtorHelper.setVfsPostOpenCallback() should not be used with a non-function argument.",arguments),W[f]=m},T.normalizeArgs=function(f=":memory:",m="c",l=null){const _={};return arguments.length===1&&arguments[0]&&typeof arguments[0]=="object"?(Object.assign(_,arguments[0]),_.flags===void 0&&(_.flags="c"),_.vfs===void 0&&(_.vfs=null),_.filename===void 0&&(_.filename=":memory:")):(_.filename=f,_.flags=m,_.vfs=l),_};const A=function(...f){T.apply(this,f)};A.dbCtorHelper=T;const D={null:1,number:2,string:3,boolean:4,blob:5};D.undefined==D.null,s.bigIntEnabled&&(D.bigint=D.number);const q=function(){D!==arguments[2]&&n(r.SQLITE_MISUSE,"Do not call the Stmt constructor directly. Use DB.prepare()."),this.db=arguments[0],p.set(this,arguments[1]),this.parameterCount=r.sqlite3_bind_parameter_count(this.pointer)},w=function(f){return f.pointer||n("DB has been closed."),f},x=function(f,m){return(m!==(m|0)||m<0||m>=f.columnCount)&&n("Column index",m,"is out of range."),f},N=function(f,m){const l=Object.create(null);switch(l.opt=Object.create(null),m.length){case 1:typeof m[0]=="string"||o.isSQLableTypedArray(m[0])||Array.isArray(m[0])?l.sql=m[0]:m[0]&&typeof m[0]=="object"&&(l.opt=m[0],l.sql=l.opt.sql);break;case 2:l.sql=m[0],l.opt=m[1];break;default:n("Invalid argument count for exec().")}l.sql=o.flexibleString(l.sql),typeof l.sql!="string"&&n("Missing SQL argument or unsupported SQL value type.");const _=l.opt;switch(_.returnValue){case"resultRows":_.resultRows||(_.resultRows=[]),l.returnVal=()=>_.resultRows;break;case"saveSql":_.saveSql||(_.saveSql=[]),l.returnVal=()=>_.saveSql;break;case void 0:case"this":l.returnVal=()=>f;break;default:n("Invalid returnValue value:",_.returnValue)}if(!_.callback&&!_.returnValue&&_.rowMode!==void 0&&(_.resultRows||(_.resultRows=[]),l.returnVal=()=>_.resultRows),_.callback||_.resultRows)switch(_.rowMode===void 0?"array":_.rowMode){case"object":l.cbArg=(u,I)=>{I.columnNames||(I.columnNames=u.getColumnNames([]));const U=u.get([]),ee=Object.create(null);for(const ne in I.columnNames)ee[I.columnNames[ne]]=U[ne];return ee};break;case"array":l.cbArg=u=>u.get([]);break;case"stmt":Array.isArray(_.resultRows)&&n("exec(): invalid rowMode for a resultRows array: must","be one of 'array', 'object',","a result column number, or column name reference."),l.cbArg=u=>u;break;default:if(o.isInt32(_.rowMode)){l.cbArg=u=>u.get(_.rowMode);break}else if(typeof _.rowMode=="string"&&_.rowMode.length>1&&_.rowMode[0]==="$"){const u=_.rowMode.substr(1);l.cbArg=I=>{const U=I.get(Object.create(null))[u];return U===void 0?n(r.SQLITE_NOTFOUND,"exec(): unknown result column:",u):U};break}n("Invalid rowMode:",_.rowMode)}return l},P=(f,m,l,..._)=>{const u=f.prepare(m);try{const I=u.bind(l).step()?u.get(..._):void 0;return u.reset(),I}finally{u.finalize()}},S=(f,m,l,_)=>f.exec({sql:m,bind:l,rowMode:_,returnValue:"resultRows"});A.checkRc=(f,m)=>R(f,m),A.prototype={isOpen:function(){return!!this.pointer},affirmOpen:function(){return w(this)},close:function(){if(this.pointer){if(this.onclose&&this.onclose.before instanceof Function)try{this.onclose.before(this)}catch{}const f=this.pointer;if(Object.keys(g.get(this)).forEach((m,l)=>{if(l&&l.pointer)try{l.finalize()}catch{}}),p.delete(this),g.delete(this),r.sqlite3_close_v2(f),this.onclose&&this.onclose.after instanceof Function)try{this.onclose.after(this)}catch{}delete this.filename}},changes:function(f=!1,m=!1){const l=w(this).pointer;return f?m?r.sqlite3_total_changes64(l):r.sqlite3_total_changes(l):m?r.sqlite3_changes64(l):r.sqlite3_changes(l)},dbFilename:function(f="main"){return r.sqlite3_db_filename(w(this).pointer,f)},dbName:function(f=0){return r.sqlite3_db_name(w(this).pointer,f)},dbVfsName:function(f=0){let m;const l=r.sqlite3_js_db_vfs(w(this).pointer,f);if(l){const _=new r.sqlite3_vfs(l);try{m=s.cstrToJs(_.$zName)}finally{_.dispose()}}return m},prepare:function(f){w(this);const m=s.pstack.pointer;let l,_;try{l=s.pstack.alloc(8),A.checkRc(this,r.sqlite3_prepare_v2(this.pointer,f,-1,l,null)),_=s.peekPtr(l)}finally{s.pstack.restore(m)}_||n("Cannot prepare empty SQL.");const u=new q(this,_,D);return g.get(this)[_]=u,u},exec:function(){w(this);const f=N(this,arguments);if(!f.sql)return n("exec() requires an SQL string.");const m=f.opt,l=m.callback,_=Array.isArray(m.resultRows)?m.resultRows:void 0;let u,I=m.bind,U=!!(f.cbArg||m.columnNames||_);const ee=s.scopedAllocPush(),ne=Array.isArray(m.saveSql)?m.saveSql:void 0;try{const re=o.isSQLableTypedArray(f.sql);let se=re?f.sql.byteLength:s.jstrlen(f.sql);const j=s.scopedAlloc(2*s.ptrSizeof+(se+1)),b=j+s.ptrSizeof;let k=b+s.ptrSizeof;const Q=k+se;for(re?s.heap8().set(f.sql,k):s.jstrcpy(f.sql,s.heap8(),k,se,!1),s.poke(k+se,0);k&&s.peek(k,"i8");){s.pokePtr([j,b],0),A.checkRc(this,r.sqlite3_prepare_v3(this.pointer,k,se,0,j,b));const H=s.peekPtr(j);if(k=s.peekPtr(b),se=Q-k,!!H){if(ne&&ne.push(r.sqlite3_sql(H).trim()),u=new q(this,H,D),I&&u.parameterCount&&(u.bind(I),I=null),U&&u.columnCount){let Z=Array.isArray(m.columnNames)?0:1;if(U=!1,f.cbArg||_){const E=Object.create(null);for(;u.step();u._lockedByExec=!1){Z++===0&&u.getColumnNames(E.columnNames=m.columnNames||[]),u._lockedByExec=!0;const C=f.cbArg(u,E);if(_&&_.push(C),l&&l.call(m,C,u)===!1)break}u._lockedByExec=!1}Z===0&&u.getColumnNames(m.columnNames)}else u.step();u.reset().finalize(),u=null}}}finally{s.scopedAllocPop(ee),u&&(delete u._lockedByExec,u.finalize())}return f.returnVal()},createFunction:function(m,l,_){const u=E=>E instanceof Function;switch(arguments.length){case 1:_=m,m=_.name,l=_.xFunc||0;break;case 2:u(l)||(_=l,l=_.xFunc||0);break}_||(_={}),typeof m!="string"&&n("Invalid arguments: missing function name.");let I=_.xStep||0,U=_.xFinal||0;const ee=_.xValue||0,ne=_.xInverse||0;let re;u(l)?(re=!1,(u(I)||u(U))&&n("Ambiguous arguments: scalar or aggregate?"),I=U=null):u(I)?(u(U)||n("Missing xFinal() callback for aggregate or window UDF."),l=null):u(U)?n("Missing xStep() callback for aggregate or window UDF."):n("Missing function-type properties."),re===!1?(u(ee)||u(ne))&&n("xValue and xInverse are not permitted for non-window UDFs."):u(ee)?(u(ne)||n("xInverse must be provided if xValue is."),re=!0):u(ne)&&n("xValue must be provided if xInverse is.");const se=_.pApp;se!=null&&(typeof se!="number"||!o.isInt32(se))&&n("Invalid value for pApp property. Must be a legal WASM pointer value.");const j=_.xDestroy||0;j&&!u(j)&&n("xDestroy property must be a function.");let b=0;O(_,"deterministic")&&(b|=r.SQLITE_DETERMINISTIC),O(_,"directOnly")&&(b|=r.SQLITE_DIRECTONLY),O(_,"innocuous")&&(b|=r.SQLITE_INNOCUOUS),m=m.toLowerCase();const k=l||I,Q=O(_,"arity"),H=typeof Q=="number"?Q:k.length?k.length-1:0;let Z;return re?Z=r.sqlite3_create_window_function(this.pointer,m,H,r.SQLITE_UTF8|b,se||0,I,U,ee,ne,j):Z=r.sqlite3_create_function_v2(this.pointer,m,H,r.SQLITE_UTF8|b,se||0,l,I,U,j),A.checkRc(this,Z),this},selectValue:function(f,m,l){return P(this,f,m,0,l)},selectValues:function(f,m,l){const _=this.prepare(f),u=[];try{for(_.bind(m);_.step();)u.push(_.get(0,l));_.reset()}finally{_.finalize()}return u},selectArray:function(f,m){return P(this,f,m,[])},selectObject:function(f,m){return P(this,f,m,{})},selectArrays:function(f,m){return S(this,f,m,"array")},selectObjects:function(f,m){return S(this,f,m,"object")},openStatementCount:function(){return this.pointer?Object.keys(g.get(this)).length:0},transaction:function(f){let m="BEGIN";arguments.length>1&&(/[^a-zA-Z]/.test(arguments[0])&&n(r.SQLITE_MISUSE,"Invalid argument for BEGIN qualifier."),m+=" "+arguments[0],f=arguments[1]),w(this).exec(m);try{const l=f(this);return this.exec("COMMIT"),l}catch(l){throw this.exec("ROLLBACK"),l}},savepoint:function(f){w(this).exec("SAVEPOINT oo1");try{const m=f(this);return this.exec("RELEASE oo1"),m}catch(m){throw this.exec("ROLLBACK to SAVEPOINT oo1; RELEASE SAVEPOINT oo1"),m}},checkRc:function(f){return R(this,f)}};const L=function(f){return f.pointer||n("Stmt has been closed."),f},$=function(f){let m=D[f==null?"null":typeof f];switch(m){case D.boolean:case D.null:case D.number:case D.string:return m;case D.bigint:if(s.bigIntEnabled)return m;default:return o.isBindableTypedArray(f)?D.blob:void 0}},c=function(f){return $(f)||n("Unsupported bind() argument type:",typeof f)},d=function(f,m){const l=typeof m=="number"?m:r.sqlite3_bind_parameter_index(f.pointer,m);return l===0||!o.isInt32(l)?n("Invalid bind() parameter name: "+m):(l<1||l>f.parameterCount)&&n("Bind index",m,"is out of range."),l},y=function(f,m){return f._lockedByExec&&n("Operation is illegal when statement is locked:",m),f},B=function f(m,l,_,u){y(L(m),"bind()"),f._||(f._tooBigInt=U=>n("BigInt value is too big to store without precision loss:",U),f._={string:function(U,ee,ne,re){const[se,j]=s.allocCString(ne,!0);return(re?r.sqlite3_bind_blob:r.sqlite3_bind_text)(U.pointer,ee,se,j,r.SQLITE_WASM_DEALLOC)}}),c(u),l=d(m,l);let I=0;switch(u==null?D.null:_){case D.null:I=r.sqlite3_bind_null(m.pointer,l);break;case D.string:I=f._.string(m,l,u,!1);break;case D.number:{let U;o.isInt32(u)?U=r.sqlite3_bind_int:typeof u=="bigint"?o.bigIntFits64(u)?s.bigIntEnabled?U=r.sqlite3_bind_int64:o.bigIntFitsDouble(u)?(u=Number(u),U=r.sqlite3_bind_double):f._tooBigInt(u):f._tooBigInt(u):(u=Number(u),s.bigIntEnabled&&Number.isInteger(u)?U=r.sqlite3_bind_int64:U=r.sqlite3_bind_double),I=U(m.pointer,l,u);break}case D.boolean:I=r.sqlite3_bind_int(m.pointer,l,u?1:0);break;case D.blob:{if(typeof u=="string"){I=f._.string(m,l,u,!0);break}else u instanceof ArrayBuffer?u=new Uint8Array(u):o.isBindableTypedArray(u)||n("Binding a value as a blob requires","that it be a string, Uint8Array, Int8Array, or ArrayBuffer.");const U=s.alloc(u.byteLength||1);s.heap8().set(u.byteLength?u:[0],U),I=r.sqlite3_bind_blob(m.pointer,l,U,u.byteLength,r.SQLITE_WASM_DEALLOC);break}default:t.config.warn("Unsupported bind() argument type:",u),n("Unsupported bind() argument type: "+typeof u)}return I&&A.checkRc(m.db.pointer,I),m._mayGet=!1,m};q.prototype={finalize:function(){if(this.pointer){y(this,"finalize()");const f=r.sqlite3_finalize(this.pointer);return delete g.get(this.db)[this.pointer],p.delete(this),delete this._mayGet,delete this.parameterCount,delete this._lockedByExec,delete this.db,f}},clearBindings:function(){return y(L(this),"clearBindings()"),r.sqlite3_clear_bindings(this.pointer),this._mayGet=!1,this},reset:function(f){y(this,"reset()"),f&&this.clearBindings();const m=r.sqlite3_reset(L(this).pointer);return this._mayGet=!1,R(this.db,m),this},bind:function(){L(this);let f,m;switch(arguments.length){case 1:f=1,m=arguments[0];break;case 2:f=arguments[0],m=arguments[1];break;default:n("Invalid bind() arguments.")}return m===void 0?this:(this.parameterCount||n("This statement has no bindable parameters."),this._mayGet=!1,m===null?B(this,f,D.null,m):Array.isArray(m)?(arguments.length!==1&&n("When binding an array, an index argument is not permitted."),m.forEach((l,_)=>B(this,_+1,c(l),l)),this):(m instanceof ArrayBuffer&&(m=new Uint8Array(m)),typeof m=="object"&&!o.isBindableTypedArray(m)?(arguments.length!==1&&n("When binding an object, an index argument is not permitted."),Object.keys(m).forEach(l=>B(this,l,c(m[l]),m[l])),this):B(this,f,c(m),m)))},bindAsBlob:function(f,m){L(this),arguments.length===1&&(m=f,f=1);const l=c(m);return D.string!==l&&D.blob!==l&&D.null!==l&&n("Invalid value type for bindAsBlob()"),B(this,f,D.blob,m)},step:function(){y(this,"step()");const f=r.sqlite3_step(L(this).pointer);switch(f){case r.SQLITE_DONE:return this._mayGet=!1;case r.SQLITE_ROW:return this._mayGet=!0;default:this._mayGet=!1,t.config.warn("sqlite3_step() rc=",f,r.sqlite3_js_rc_str(f),"SQL =",r.sqlite3_sql(this.pointer)),A.checkRc(this.db.pointer,f)}},stepReset:function(){return this.step(),this.reset()},stepFinalize:function(){try{const f=this.step();return this.reset(),f}finally{try{this.finalize()}catch{}}},get:function(f,m){if(L(this)._mayGet||n("Stmt.step() has not (recently) returned true."),Array.isArray(f)){let l=0;const _=this.columnCount;for(;l<_;)f[l]=this.get(l++);return f}else if(f&&typeof f=="object"){let l=0;const _=this.columnCount;for(;l<_;)f[r.sqlite3_column_name(this.pointer,l)]=this.get(l++);return f}switch(x(this,f),m===void 0?r.sqlite3_column_type(this.pointer,f):m){case r.SQLITE_NULL:return null;case r.SQLITE_INTEGER:if(s.bigIntEnabled){const l=r.sqlite3_column_int64(this.pointer,f);return l>=Number.MIN_SAFE_INTEGER&&l<=Number.MAX_SAFE_INTEGER?Number(l).valueOf():l}else{const l=r.sqlite3_column_double(this.pointer,f);return(l>Number.MAX_SAFE_INTEGER||ln("The pointer property is read-only.")};Object.defineProperty(q.prototype,"pointer",f),Object.defineProperty(A.prototype,"pointer",f)}if(Object.defineProperty(q.prototype,"columnCount",{enumerable:!1,get:function(){return r.sqlite3_column_count(this.pointer)},set:()=>n("The columnCount property is read-only.")}),t.oo1={DB:A,Stmt:q},o.isUIThread()){t.oo1.JsStorageDb=function(m="session"){const l=T.normalizeArgs(...arguments);m=l.filename,m!=="session"&&m!=="local"&&n("JsStorageDb db name must be one of 'session' or 'local'."),l.vfs="kvvfs",T.call(this,l)};const f=t.oo1.JsStorageDb;f.prototype=Object.create(A.prototype),f.clearStorage=r.sqlite3_js_kvvfs_clear,f.prototype.clearStorage=function(){return f.clearStorage(w(this).filename)},f.storageSize=r.sqlite3_js_kvvfs_size,f.prototype.storageSize=function(){return f.storageSize(w(this).filename)}}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){const n=t.util;t.initWorker1API=(function(){const r=(...T)=>{throw new Error(T.join(" "))};globalThis.WorkerGlobalScope instanceof Function||r("initWorker1API() must be run from a Worker thread.");const s=this.sqlite3||r("Missing this.sqlite3 object."),o=s.oo1.DB,p=function(T){let A=g.idMap.get(T);return A||(A="db#"+ ++g.idSeq+"@"+T.pointer,g.idMap.set(T,A),A)},g={dbList:[],idSeq:0,idMap:new WeakMap,xfer:[],open:function(T){const A=new o(T);return this.dbs[p(A)]=A,this.dbList.indexOf(A)<0&&this.dbList.push(A),A},close:function(T,A){if(T){delete this.dbs[p(T)];const D=T.filename,q=n.sqlite3__wasm_db_vfs(T.pointer,0);T.close();const w=this.dbList.indexOf(T);w>=0&&this.dbList.splice(w,1),A&&D&&q&&n.sqlite3__wasm_vfs_unlink(q,D)}},post:function(T,A){A&&A.length?(globalThis.postMessage(T,Array.from(A)),A.length=0):globalThis.postMessage(T)},dbs:Object.create(null),getDb:function(T,A=!0){return this.dbs[T]||(A?r("Unknown (or closed) DB ID:",T):void 0)}},O=function(T=g.dbList[0]){return T&&T.pointer?T:r("DB is not opened.")},R=function(T,A=!0){const D=g.getDb(T.dbId,!1)||g.dbList[0];return A?O(D):D},z=function(){return g.dbList[0]&&p(g.dbList[0])},W={open:function(T){const A=Object.create(null),D=T.args||Object.create(null);D.simulateError&&r("Throwing because of simulateError flag.");const q=Object.create(null);A.vfs=D.vfs,A.filename=D.filename||"";const w=g.open(A);return q.filename=w.filename,q.persistent=!!s.capi.sqlite3_js_db_uses_vfs(w.pointer,"opfs"),q.dbId=p(w),q.vfs=w.dbVfsName(),q},close:function(T){const A=R(T,!1),D={filename:A&&A.filename};if(A){const q=T.args&&typeof T.args=="object"?!!T.args.unlink:!1;g.close(A,q)}return D},exec:function(T){const A=typeof T.args=="string"?{sql:T.args}:T.args||Object.create(null);A.rowMode==="stmt"?r("Invalid rowMode for 'exec': stmt mode","does not work in the Worker API."):A.sql||r("'exec' requires input SQL.");const D=R(T);(A.callback||Array.isArray(A.resultRows))&&(D._blobXfer=g.xfer);const q=A.callback;let w=0;const x=!!A.columnNames;typeof q=="string"&&(x||(A.columnNames=[]),A.callback=function(N,P){g.post({type:q,columnNames:A.columnNames,rowNumber:++w,row:N},g.xfer)});try{const N=A.countChanges?D.changes(!0,A.countChanges===64):void 0;D.exec(A),N!==void 0&&(A.changeCount=D.changes(!0,A.countChanges===64)-N);const P=A.lastInsertRowId?s.capi.sqlite3_last_insert_rowid(D):void 0;P!==void 0&&(A.lastInsertRowId=P),A.callback instanceof Function&&(A.callback=q,g.post({type:q,columnNames:A.columnNames,rowNumber:null,row:void 0}))}finally{delete D._blobXfer,A.callback&&(A.callback=q)}return A},"config-get":function(){const T=Object.create(null),A=s.config;return["bigIntEnabled"].forEach(function(D){Object.getOwnPropertyDescriptor(A,D)&&(T[D]=A[D])}),T.version=s.version,T.vfsList=s.capi.sqlite3_js_vfs_list(),T},export:function(T){const A=R(T),D={byteArray:s.capi.sqlite3_js_db_export(A.pointer),filename:A.filename,mimetype:"application/x-sqlite3"};return g.xfer.push(D.byteArray.buffer),D},toss:function(T){r("Testing worker exception")}};globalThis.onmessage=async function(T){T=T.data;let A,D=T.dbId,q=T.type;const w=performance.now();try{W.hasOwnProperty(q)&&W[q]instanceof Function?A=await W[q](T):r("Unknown db worker message type:",T.type)}catch(x){q="error",A={operation:T.type,message:x.message,errorClass:x.name,input:T},x.stack&&(A.stack=typeof x.stack=="string"?x.stack.split(/\n\s*/):x.stack)}D||(D=A.dbId||z()),g.post({type:q,dbId:D,messageId:T.messageId,workerReceivedTime:w,workerRespondTime:performance.now(),departureTime:T.departureTime,result:A},g.xfer)},globalThis.postMessage({type:"sqlite3-api",result:"worker1-ready"})}).bind({sqlite3:t})}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){const n=t.wasm,r=t.capi,s=t.util.toss3,o=Object.create(null);t.vfs=o,r.sqlite3_vfs.prototype.registerVfs=function(p=!1){this instanceof t.capi.sqlite3_vfs||s("Expecting a sqlite3_vfs-type argument.");const g=r.sqlite3_vfs_register(this,p?1:0);return g&&s("sqlite3_vfs_register(",this,") failed with rc",g),this.pointer!==r.sqlite3_vfs_find(this.$zName)&&s("BUG: sqlite3_vfs_find(vfs.$zName) failed for just-installed VFS",this),this},o.installVfs=function(p){let g=0;const O=["io","vfs"];for(const R of O){const z=p[R];z&&(++g,z.struct.installMethods(z.methods,!!z.applyArgcCheck),R==="vfs"&&(!z.struct.$zName&&typeof z.name=="string"&&z.struct.addOnDispose(z.struct.$zName=n.allocCString(z.name)),z.struct.registerVfs(!!z.asDefault)))}return g||s("Misuse: installVfs() options object requires at least","one of:",O),this}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){if(!t.wasm.exports.sqlite3_declare_vtab)return;const n=t.wasm,r=t.capi,s=t.util.toss3,o=Object.create(null);t.vtab=o;const p=r.sqlite3_index_info;p.prototype.nthConstraint=function(R,z=!1){if(R<0||R>=this.$nConstraint)return!1;const W=this.$aConstraint+p.sqlite3_index_constraint.structInfo.sizeof*R;return z?W:new p.sqlite3_index_constraint(W)},p.prototype.nthConstraintUsage=function(R,z=!1){if(R<0||R>=this.$nConstraint)return!1;const W=this.$aConstraintUsage+p.sqlite3_index_constraint_usage.structInfo.sizeof*R;return z?W:new p.sqlite3_index_constraint_usage(W)},p.prototype.nthOrderBy=function(R,z=!1){if(R<0||R>=this.$nOrderBy)return!1;const W=this.$aOrderBy+p.sqlite3_index_orderby.structInfo.sizeof*R;return z?W:new p.sqlite3_index_orderby(W)};const g=function(R,z){return(function(W,T=!1){if(arguments.length===0&&(W=new z),W instanceof z)return this.set(W.pointer,W),W;n.isPtr(W)||t.SQLite3Error.toss("Invalid argument to",R+"()");let A=this.get(W);return T&&this.delete(W),A}).bind(new Map)},O=function(R,z){const W=g(R,z);return Object.assign(Object.create(null),{StructType:z,create:T=>{const A=W();return n.pokePtr(T,A.pointer),A},get:T=>W(T),unget:T=>W(T,!0),dispose:T=>{const A=W(T,!0);A&&A.dispose()}})};o.xVtab=O("xVtab",r.sqlite3_vtab),o.xCursor=O("xCursor",r.sqlite3_vtab_cursor),o.xIndexInfo=R=>new r.sqlite3_index_info(R),o.xError=function R(z,W,T){if(R.errorReporter instanceof Function)try{R.errorReporter("sqlite3_module::"+z+"(): "+W.message)}catch{}let A;return W instanceof t.WasmAllocError?A=r.SQLITE_NOMEM:arguments.length>2?A=T:W instanceof t.SQLite3Error&&(A=W.resultCode),A||r.SQLITE_ERROR},o.xError.errorReporter=console.error.bind(console),o.xRowid=(R,z)=>n.poke(R,z,"i64"),o.setupModule=function(R){let z=!1;const W=this instanceof r.sqlite3_module?this:R.struct||(z=new r.sqlite3_module);try{const T=R.methods||s("Missing 'methods' object.");for(const A of Object.entries({xConnect:"xCreate",xDisconnect:"xDestroy"})){const D=A[0],q=A[1];T[D]===!0?T[D]=T[q]:T[q]===!0&&(T[q]=T[D])}if(R.catchExceptions){const A=function(w,x){return["xConnect","xCreate"].indexOf(w)>=0?function(N,P,S,L,$,c){try{return x(...arguments)||0}catch(d){return d instanceof t.WasmAllocError||(n.dealloc(n.peekPtr(c)),n.pokePtr(c,n.allocCString(d.message))),o.xError(w,d)}}:function(...N){try{return x(...N)||0}catch(P){return o.xError(w,P)}}},D=["xCreate","xConnect","xBestIndex","xDisconnect","xDestroy","xOpen","xClose","xFilter","xNext","xEof","xColumn","xRowid","xUpdate","xBegin","xSync","xCommit","xRollback","xFindFunction","xRename","xSavepoint","xRelease","xRollbackTo","xShadowName"],q=Object.create(null);for(const w of D){const x=T[w];if(x instanceof Function)w==="xConnect"&&T.xCreate===x?q[w]=T.xCreate:w==="xCreate"&&T.xConnect===x?q[w]=T.xConnect:q[w]=A(w,x);else continue}W.installMethods(q,!1)}else W.installMethods(T,!!R.applyArgcCheck);if(W.$iVersion===0){let A;typeof R.iVersion=="number"?A=R.iVersion:W.$xShadowName?A=3:W.$xSavePoint||W.$xRelease||W.$xRollbackTo?A=2:A=1,W.$iVersion=A}}catch(T){throw z&&z.dispose(),T}return W},r.sqlite3_module.prototype.setupModule=function(R){return o.setupModule.call(this,R)}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){const n=function r(s){if(!globalThis.SharedArrayBuffer||!globalThis.Atomics)return Promise.reject(new Error("Cannot install OPFS: Missing SharedArrayBuffer and/or Atomics. The server must emit the COOP/COEP response headers to enable those. See https://sqlite.org/wasm/doc/trunk/persistence.md#coop-coep"));if(typeof WorkerGlobalScope>"u")return Promise.reject(new Error("The OPFS sqlite3_vfs cannot run in the main thread because it requires Atomics.wait()."));if(!globalThis.FileSystemHandle||!globalThis.FileSystemDirectoryHandle||!globalThis.FileSystemFileHandle||!globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle||!navigator?.storage?.getDirectory)return Promise.reject(new Error("Missing required OPFS APIs."));(!s||typeof s!="object")&&(s=Object.create(null));const o=new URL(globalThis.location.href).searchParams;return o.has("opfs-disable")?Promise.resolve(t):(s.verbose===void 0&&(s.verbose=o.has("opfs-verbose")?+o.get("opfs-verbose")||2:1),s.sanityChecks===void 0&&(s.sanityChecks=o.has("opfs-sanity-check")),s.proxyUri===void 0&&(s.proxyUri=r.defaultProxyUri),typeof s.proxyUri=="function"&&(s.proxyUri=s.proxyUri()),new Promise(function(g,O){const R=[t.config.error,t.config.warn,t.config.log],z=(E,...C)=>{s.verbose>E&&R[E]("OPFS syncer:",...C)},W=(...E)=>z(2,...E),T=(...E)=>z(1,...E),A=(...E)=>z(0,...E),D=t.util.toss,q=t.capi,w=t.util,x=t.wasm,N=q.sqlite3_vfs,P=q.sqlite3_file,S=q.sqlite3_io_methods,L=Object.create(null),$=()=>globalThis.FileSystemHandle&&globalThis.FileSystemDirectoryHandle&&globalThis.FileSystemFileHandle&&globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle&&navigator?.storage?.getDirectory;L.metrics={dump:function(){let E,C=0,M=0,J=0;for(E in u.opIds){const G=I[E];C+=G.count,M+=G.time,J+=G.wait,G.avgTime=G.count&&G.time?G.time/G.count:0,G.avgWait=G.count&&G.wait?G.wait/G.count:0}t.config.log(globalThis.location.href,"metrics for",globalThis.location.href,":",I,` +Total of`,C,"op(s) for",M,"ms (incl. "+J+" ms of waiting on the async side)"),t.config.log("Serialization metrics:",I.s11n),m.postMessage({type:"opfs-async-metrics"})},reset:function(){let E;const C=J=>J.count=J.time=J.wait=0;for(E in u.opIds)C(I[E]=Object.create(null));let M=I.s11n=Object.create(null);M=M.serialize=Object.create(null),M.count=M.time=0,M=I.s11n.deserialize=Object.create(null),M.count=M.time=0}};const c=new S,d=new N().addOnDispose(()=>c.dispose());let y;const B=E=>(y=!0,d.dispose(),O(E)),f=()=>(y=!1,g(t)),m=new Worker(new URL("/assets/sqlite3-opfs-async-proxy-B_ImRJXp.js",import.meta.url));setTimeout(()=>{y===void 0&&B(new Error("Timeout while waiting for OPFS async proxy worker."))},4e3),m._originalOnError=m.onerror,m.onerror=function(E){A("Error initializing OPFS asyncer:",E),B(new Error("Loading OPFS async Worker failed for unknown reasons."))};const l=q.sqlite3_vfs_find(null),_=l?new N(l):null;c.$iVersion=1,d.$iVersion=2,d.$szOsFile=q.sqlite3_file.structInfo.sizeof,d.$mxPathname=1024,d.$zName=x.allocCString("opfs"),d.$xDlOpen=d.$xDlError=d.$xDlSym=d.$xDlClose=null,d.addOnDispose("$zName",d.$zName,"cleanup default VFS wrapper",()=>_?_.dispose():null);const u=Object.create(null);u.verbose=s.verbose,u.littleEndian=(()=>{const E=new ArrayBuffer(2);return new DataView(E).setInt16(0,256,!0),new Int16Array(E)[0]===256})(),u.asyncIdleWaitTime=150,u.asyncS11nExceptions=1,u.fileBufferSize=1024*64,u.sabS11nOffset=u.fileBufferSize,u.sabS11nSize=d.$mxPathname*2,u.sabIO=new SharedArrayBuffer(u.fileBufferSize+u.sabS11nSize),u.opIds=Object.create(null);const I=Object.create(null);{let E=0;u.opIds.whichOp=E++,u.opIds.rc=E++,u.opIds.xAccess=E++,u.opIds.xClose=E++,u.opIds.xDelete=E++,u.opIds.xDeleteNoWait=E++,u.opIds.xFileSize=E++,u.opIds.xLock=E++,u.opIds.xOpen=E++,u.opIds.xRead=E++,u.opIds.xSleep=E++,u.opIds.xSync=E++,u.opIds.xTruncate=E++,u.opIds.xUnlock=E++,u.opIds.xWrite=E++,u.opIds.mkdir=E++,u.opIds["opfs-async-metrics"]=E++,u.opIds["opfs-async-shutdown"]=E++,u.opIds.retry=E++,u.sabOP=new SharedArrayBuffer(E*4),L.metrics.reset()}u.sq3Codes=Object.create(null),["SQLITE_ACCESS_EXISTS","SQLITE_ACCESS_READWRITE","SQLITE_BUSY","SQLITE_CANTOPEN","SQLITE_ERROR","SQLITE_IOERR","SQLITE_IOERR_ACCESS","SQLITE_IOERR_CLOSE","SQLITE_IOERR_DELETE","SQLITE_IOERR_FSYNC","SQLITE_IOERR_LOCK","SQLITE_IOERR_READ","SQLITE_IOERR_SHORT_READ","SQLITE_IOERR_TRUNCATE","SQLITE_IOERR_UNLOCK","SQLITE_IOERR_WRITE","SQLITE_LOCK_EXCLUSIVE","SQLITE_LOCK_NONE","SQLITE_LOCK_PENDING","SQLITE_LOCK_RESERVED","SQLITE_LOCK_SHARED","SQLITE_LOCKED","SQLITE_MISUSE","SQLITE_NOTFOUND","SQLITE_OPEN_CREATE","SQLITE_OPEN_DELETEONCLOSE","SQLITE_OPEN_MAIN_DB","SQLITE_OPEN_READONLY"].forEach(E=>{(u.sq3Codes[E]=q[E])===void 0&&D("Maintenance required: not found:",E)}),u.opfsFlags=Object.assign(Object.create(null),{OPFS_UNLOCK_ASAP:1,OPFS_UNLINK_BEFORE_OPEN:2,defaultUnlockAsap:!1});const U=(E,...C)=>{const M=u.opIds[E]||D("Invalid op ID:",E);u.s11n.serialize(...C),Atomics.store(u.sabOPView,u.opIds.rc,-1),Atomics.store(u.sabOPView,u.opIds.whichOp,M),Atomics.notify(u.sabOPView,u.opIds.whichOp);const J=performance.now();for(;Atomics.wait(u.sabOPView,u.opIds.rc,-1)!=="not-equal";);const G=Atomics.load(u.sabOPView,u.opIds.rc);if(I[E].wait+=performance.now()-J,G&&u.asyncS11nExceptions){const te=u.s11n.deserialize();te&&A(E+"() async error:",...te)}return G};L.debug={asyncShutdown:()=>{T("Shutting down OPFS async listener. The OPFS VFS will no longer work."),U("opfs-async-shutdown")},asyncRestart:()=>{T("Attempting to restart OPFS VFS async listener. Might work, might not."),m.postMessage({type:"opfs-async-restart"})}};const ee=()=>{if(u.s11n)return u.s11n;const E=new TextDecoder,C=new TextEncoder("utf-8"),M=new Uint8Array(u.sabIO,u.sabS11nOffset,u.sabS11nSize),J=new DataView(u.sabIO,u.sabS11nOffset,u.sabS11nSize);u.s11n=Object.create(null);const G=Object.create(null);G.number={id:1,size:8,getter:"getFloat64",setter:"setFloat64"},G.bigint={id:2,size:8,getter:"getBigInt64",setter:"setBigInt64"},G.boolean={id:3,size:4,getter:"getInt32",setter:"setInt32"},G.string={id:4};const te=Y=>G[typeof Y]||D("Maintenance required: this value type cannot be serialized.",Y),oe=Y=>{switch(Y){case G.number.id:return G.number;case G.bigint.id:return G.bigint;case G.boolean.id:return G.boolean;case G.string.id:return G.string;default:D("Invalid type ID:",Y)}};return u.s11n.deserialize=function(Y=!1){++I.s11n.deserialize.count;const pe=performance.now(),F=M[0],V=F?[]:null;if(F){const K=[];let X=1,ae,de,ue;for(ae=0;ae{se.start=performance.now(),se.op=E,++I[E].count},b=()=>I[se.op].time+=performance.now()-se.start,k={xCheckReservedLock:function(E,C){return x.poke(C,0,"i32"),0},xClose:function(E){j("xClose");let C=0;const M=re[E];return M&&(delete re[E],C=U("xClose",E),M.sq3File&&M.sq3File.dispose()),b(),C},xDeviceCharacteristics:function(E){return q.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN},xFileControl:function(E,C,M){return q.SQLITE_NOTFOUND},xFileSize:function(E,C){j("xFileSize");let M=U("xFileSize",E);if(M==0)try{const J=u.s11n.deserialize()[0];x.poke(C,J,"i64")}catch(J){A("Unexpected error reading xFileSize() result:",J),M=u.sq3Codes.SQLITE_IOERR}return b(),M},xLock:function(E,C){j("xLock");const M=re[E];let J=0;return M.lockType?M.lockType=C:(J=U("xLock",E,C),J===0&&(M.lockType=C)),b(),J},xRead:function(E,C,M,J){j("xRead");const G=re[E];let te;try{te=U("xRead",E,M,Number(J)),(te===0||q.SQLITE_IOERR_SHORT_READ===te)&&x.heap8u().set(G.sabView.subarray(0,M),C)}catch(oe){A("xRead(",arguments,") failed:",oe,G),te=q.SQLITE_IOERR_READ}return b(),te},xSync:function(E,C){j("xSync"),++I.xSync.count;const M=U("xSync",E,C);return b(),M},xTruncate:function(E,C){j("xTruncate");const M=U("xTruncate",E,Number(C));return b(),M},xUnlock:function(E,C){j("xUnlock");const M=re[E];let J=0;return q.SQLITE_LOCK_NONE===C&&M.lockType&&(J=U("xUnlock",E,C)),J===0&&(M.lockType=C),b(),J},xWrite:function(E,C,M,J){j("xWrite");const G=re[E];let te;try{G.sabView.set(x.heap8u().subarray(C,C+M)),te=U("xWrite",E,M,Number(J))}catch(oe){A("xWrite(",arguments,") failed:",oe,G),te=q.SQLITE_IOERR_WRITE}return b(),te}},Q={xAccess:function(E,C,M,J){j("xAccess");const G=U("xAccess",x.cstrToJs(C));return x.poke(J,G?0:1,"i32"),b(),0},xCurrentTime:function(E,C){return x.poke(C,24405875e-1+new Date().getTime()/864e5,"double"),0},xCurrentTimeInt64:function(E,C){return x.poke(C,24405875e-1*864e5+new Date().getTime(),"i64"),0},xDelete:function(E,C,M){j("xDelete");const J=U("xDelete",x.cstrToJs(C),M,!1);return b(),J},xFullPathname:function(E,C,M,J){return x.cstrncpy(J,C,M)!!J):M},L.getDirForFilename=async function(C,M=!1){const J=L.getResolvedPath(C,!0),G=J.pop();let te=L.rootDirectory;for(const oe of J)oe&&(te=await te.getDirectoryHandle(oe,{create:!!M}));return[te,G]},L.mkdir=async function(E){try{return await L.getDirForFilename(E+"/filepart",!0),!0}catch{return!1}},L.entryExists=async function(E){try{const[C,M]=await L.getDirForFilename(E);return await C.getFileHandle(M),!0}catch{return!1}},L.randomFilename=ne,L.treeList=async function(){const E=async function M(J,G){G.name=J.name,G.dirs=[],G.files=[];for await(const te of J.values())if(te.kind==="directory"){const oe=Object.create(null);G.dirs.push(oe),await M(te,oe)}else G.files.push(te.name)},C=Object.create(null);return await E(L.rootDirectory,C),C},L.rmfr=async function(){const E=L.rootDirectory,C={recurse:!0};for await(const M of E.values())E.removeEntry(M.name,C)},L.unlink=async function(E,C=!1,M=!1){try{const[J,G]=await L.getDirForFilename(E,!1);return await J.removeEntry(G,{recursive:C}),!0}catch(J){if(M)throw new Error("unlink(",arguments[0],") failed: "+J.message,{cause:J});return!1}},L.traverse=async function(E){const C={recursive:!0,directory:L.rootDirectory};typeof E=="function"&&(E={callback:E}),E=Object.assign(C,E||{}),async function J(G,te){for await(const oe of G.values()){if(E.callback(oe,G,te)===!1)return!1;if(E.recursive&&oe.kind==="directory"&&await J(oe,te+1)===!1)break}}(E.directory,0)};const H=async function(E,C){const[M,J]=await L.getDirForFilename(E,!0);let te=await(await M.getFileHandle(J,{create:!0})).createSyncAccessHandle(),oe=0,Y,pe=!1;try{for(te.truncate(0);(Y=await C())!==void 0;)Y instanceof ArrayBuffer&&(Y=new Uint8Array(Y)),oe===0&&Y.byteLength>=15&&(w.affirmDbHeader(Y),pe=!0),te.write(Y,{at:oe}),oe+=Y.byteLength;if((oe<512||oe%512!==0)&&D("Input size",oe,"is not correct for an SQLite database."),!pe){const F=new Uint8Array(20);te.read(F,{at:0}),w.affirmDbHeader(F)}return te.write(new Uint8Array([1,1]),{at:18}),oe}catch(F){throw await te.close(),te=void 0,await M.removeEntry(J).catch(()=>{}),F}finally{te&&await te.close()}};if(L.importDb=async function(E,C){if(C instanceof Function)return H(E,C);C instanceof ArrayBuffer&&(C=new Uint8Array(C)),w.affirmIsDb(C);const M=C.byteLength,[J,G]=await L.getDirForFilename(E,!0);let te,oe=0;try{return te=await(await J.getFileHandle(G,{create:!0})).createSyncAccessHandle(),te.truncate(0),oe=te.write(C,{at:0}),oe!=M&&D("Expected to write "+M+" bytes but wrote "+oe+"."),te.write(new Uint8Array([1,1]),{at:18}),oe}catch(Y){throw te&&(await te.close(),te=void 0),await J.removeEntry(G).catch(()=>{}),Y}finally{te&&await te.close()}},t.oo1){const E=function(...C){const M=t.oo1.DB.dbCtorHelper.normalizeArgs(...C);M.vfs=d.$zName,t.oo1.DB.dbCtorHelper.call(this,M)};E.prototype=Object.create(t.oo1.DB.prototype),t.oo1.OpfsDb=E,E.importDb=L.importDb,t.oo1.DB.dbCtorHelper.setVfsPostOpenCallback(d.pointer,function(C,M){M.capi.sqlite3_busy_timeout(C,1e4)})}const Z=function(){const E=x.scopedAllocPush(),C=new P;try{const M=C.pointer,J=q.SQLITE_OPEN_CREATE|q.SQLITE_OPEN_READWRITE|q.SQLITE_OPEN_MAIN_DB,G=x.scopedAlloc(8),te="/sanity/check/file"+ne(8),oe=x.scopedAllocCString(te);let Y;if(u.s11n.serialize("This is ä string."),Y=u.s11n.deserialize(),W("deserialize() says:",Y),Y[0]!=="This is ä string."&&D("String d13n error."),Q.xAccess(d.pointer,oe,0,G),Y=x.peek(G,"i32"),W("xAccess(",te,") exists ?=",Y),Y=Q.xOpen(d.pointer,oe,M,J,G),W("open rc =",Y,"state.sabOPView[xOpen] =",u.sabOPView[u.opIds.xOpen]),Y!==0){A("open failed with code",Y);return}Q.xAccess(d.pointer,oe,0,G),Y=x.peek(G,"i32"),Y||D("xAccess() failed to detect file."),Y=k.xSync(C.pointer,0),Y&&D("sync failed w/ rc",Y),Y=k.xTruncate(C.pointer,1024),Y&&D("truncate failed w/ rc",Y),x.poke(G,0,"i64"),Y=k.xFileSize(C.pointer,G),Y&&D("xFileSize failed w/ rc",Y),W("xFileSize says:",x.peek(G,"i64")),Y=k.xWrite(C.pointer,oe,10,1),Y&&D("xWrite() failed!");const pe=x.scopedAlloc(16);Y=k.xRead(C.pointer,pe,6,2),x.poke(pe+6,0);let F=x.cstrToJs(pe);W("xRead() got:",F),F!=="sanity"&&D("Unexpected xRead() value."),Q.xSleep&&(W("xSleep()ing before close()ing..."),Q.xSleep(d.pointer,2e3),W("waking up from xSleep()")),Y=k.xClose(M),W("xClose rc =",Y,"sabOPView =",u.sabOPView),W("Deleting file:",te),Q.xDelete(d.pointer,oe,4660),Q.xAccess(d.pointer,oe,0,G),Y=x.peek(G,"i32"),Y&&D("Expecting 0 from xAccess(",te,") after xDelete()."),T("End of OPFS sanity checks.")}finally{C.dispose(),x.scopedAllocPop(E)}};m.onmessage=function({data:E}){switch(E.type){case"opfs-unavailable":B(new Error(E.payload.join(" ")));break;case"opfs-async-loaded":m.postMessage({type:"opfs-async-init",args:u});break;case"opfs-async-inited":{if(y===!0)break;try{t.vfs.installVfs({io:{struct:c,methods:k},vfs:{struct:d,methods:Q}}),u.sabOPView=new Int32Array(u.sabOP),u.sabFileBufView=new Uint8Array(u.sabIO,0,u.fileBufferSize),u.sabS11nView=new Uint8Array(u.sabIO,u.sabS11nOffset,u.sabS11nSize),ee(),s.sanityChecks&&(T("Running sanity checks because of opfs-sanity-check URL arg..."),Z()),$()?navigator.storage.getDirectory().then(C=>{m.onerror=m._originalOnError,delete m._originalOnError,t.opfs=L,L.rootDirectory=C,W("End of OPFS sqlite3_vfs setup.",d),f()}).catch(B):f()}catch(C){A(C),B(C)}break}default:{const C="Unexpected message from the OPFS async worker: "+JSON.stringify(E);A(C),B(new Error(C));break}}}}))};n.defaultProxyUri="sqlite3-opfs-async-proxy.js",globalThis.sqlite3ApiBootstrap.initializersAsync.push(async r=>{try{let s=n.defaultProxyUri;return r.scriptInfo.sqlite3Dir&&(n.defaultProxyUri=r.scriptInfo.sqlite3Dir+s),n().catch(o=>{r.config.warn("Ignoring inability to install OPFS sqlite3_vfs:",o.message)})}catch(s){return r.config.error("installOpfsVfs() exception:",s),Promise.reject(s)}})}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){const n=t.util.toss,r=t.util.toss3,s=Object.create(null),o=t.capi,p=t.util,g=t.wasm,O=4096,R=512,z=4,W=8,T=R+z,A=R,D=T,q=O,w=o.SQLITE_OPEN_MAIN_DB|o.SQLITE_OPEN_MAIN_JOURNAL|o.SQLITE_OPEN_SUPER_JOURNAL|o.SQLITE_OPEN_WAL,x=o.SQLITE_OPEN_MEMORY,N=".opaque",P=()=>Math.random().toString(36).slice(2),S=new TextDecoder,L=new TextEncoder,$=Object.assign(Object.create(null),{name:"opfs-sahpool",directory:void 0,initialCapacity:6,clearOnInit:!1,verbosity:2,forceReinitIfPreviouslyFailed:!1}),c=[t.config.error,t.config.warn,t.config.log];t.config.log;const d=t.config.warn;t.config.error;const y=new Map,B=j=>y.get(j),f=(j,b)=>{b?y.set(j,b):y.delete(j)},m=new Map,l=j=>m.get(j),_=(j,b)=>{b?m.set(j,b):m.delete(j)},u={xCheckReservedLock:function(j,b){const k=l(j);return k.log("xCheckReservedLock"),k.storeErr(),g.poke32(b,1),0},xClose:function(j){const b=l(j);b.storeErr();const k=b.getOFileForS3File(j);if(k)try{b.log(`xClose ${k.path}`),b.mapS3FileToOFile(j,!1),k.sah.flush(),k.flags&o.SQLITE_OPEN_DELETEONCLOSE&&b.deletePath(k.path)}catch(Q){return b.storeErr(Q,o.SQLITE_IOERR)}return 0},xDeviceCharacteristics:function(j){return o.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN},xFileControl:function(j,b,k){return o.SQLITE_NOTFOUND},xFileSize:function(j,b){const k=l(j);k.log("xFileSize");const H=k.getOFileForS3File(j).sah.getSize()-q;return g.poke64(b,BigInt(H)),0},xLock:function(j,b){const k=l(j);k.log(`xLock ${b}`),k.storeErr();const Q=k.getOFileForS3File(j);return Q.lockType=b,0},xRead:function(j,b,k,Q){const H=l(j);H.storeErr();const Z=H.getOFileForS3File(j);H.log(`xRead ${Z.path} ${k} @ ${Q}`);try{const E=Z.sah.read(g.heap8u().subarray(b,b+k),{at:q+Number(Q)});return Eb&&g.poke8(k+b-1,0)}catch{return o.SQLITE_NOMEM}finally{g.scopedAllocPop(Z)}}return H?H.sqlite3Rc||o.SQLITE_IOERR:0},xOpen:function(b,k,Q,H,Z){const E=B(b);try{H&=~x,E.log(`xOpen ${g.cstrToJs(k)} ${H}`);const C=k&&g.peek8(k)?E.getPath(k):P();let M=E.getSAHForPath(C);!M&&H&o.SQLITE_OPEN_CREATE&&(E.getFileCount()f(b.pointer,0)),Q&&(b.$xRandomness=Q.$xRandomness,b.$xSleep=Q.$xSleep,Q.dispose()),!b.$xRandomness&&!U.xRandomness&&(U.xRandomness=function(H,Z,E){const C=g.heap8u();let M=0;for(;M0),t.vfs.installVfs({vfs:{struct:b,methods:U}}),b};class ne{vfsDir;#e;#o;#a;#r=new Map;#t=new Map;#s=new Set;#l=new Map;#n=new Uint8Array(T);#c;#i;#u;constructor(b=Object.create(null)){this.#u=b.verbosity??$.verbosity,this.vfsName=b.name||$.name,this.#i=ee(this.vfsName),f(this.#i.pointer,this),this.vfsDir=b.directory||"."+this.vfsName,this.#c=new DataView(this.#n.buffer,this.#n.byteOffset),this.isReady=this.reset(!!(b.clearOnInit??$.clearOnInit)).then(()=>{if(this.$error)throw this.$error;return this.getCapacity()?Promise.resolve(void 0):this.addCapacity(b.initialCapacity||$.initialCapacity)})}#_(b,...k){this.#u>b&&c[b](this.vfsName+":",...k)}log(...b){this.#_(2,...b)}warn(...b){this.#_(1,...b)}error(...b){this.#_(0,...b)}getVfs(){return this.#i}getCapacity(){return this.#r.size}getFileCount(){return this.#t.size}getFileNames(){const b=[];for(const k of this.#t.keys())b.push(k);return b}async addCapacity(b){for(let k=0;k{try{const Z=await H.createSyncAccessHandle();if(this.#r.set(Z,Q),b)Z.truncate(q),this.setAssociatedPath(Z,"",0);else{const E=this.getAssociatedPath(Z);E?this.#t.set(E,Z):this.#s.add(Z)}}catch(Z){throw this.storeErr(Z),this.releaseAccessHandles(),Z}}))}getAssociatedPath(b){b.read(this.#n,{at:0});const k=this.#c.getUint32(A);if(this.#n[0]&&(k&o.SQLITE_OPEN_DELETEONCLOSE||(k&w)===0))return d(`Removing file with unexpected flags ${k.toString(16)}`,this.#n),this.setAssociatedPath(b,"",0),"";const Q=new Uint32Array(W/4);b.read(Q,{at:D});const H=this.computeDigest(this.#n,k);if(Q.every((Z,E)=>Z===H[E])){const Z=this.#n.findIndex(E=>E===0);return Z===0&&b.truncate(q),Z?S.decode(this.#n.subarray(0,Z)):""}else return d("Disassociating file with bad digest."),this.setAssociatedPath(b,"",0),""}setAssociatedPath(b,k,Q){const H=L.encodeInto(k,this.#n);R<=H.written+1&&n("Path too long:",k),k&&Q&&(Q|=x),this.#n.fill(0,H.written,R),this.#c.setUint32(A,Q);const Z=this.computeDigest(this.#n,Q);b.write(this.#n,{at:0}),b.write(Z,{at:D}),b.flush(),k?(this.#t.set(k,b),this.#s.delete(b)):(b.truncate(q),this.#s.add(b))}computeDigest(b,k){if(k&x){let Q=3735928559,H=1103547991;for(const Z of b)Q=Math.imul(Q^Z,2654435761),H=Math.imul(H^Z,104729);return new Uint32Array([Q>>>0,H>>>0])}else return new Uint32Array([0,0])}async reset(b){await this.isReady;let k=await navigator.storage.getDirectory(),Q;for(const H of this.vfsDir.split("/"))H&&(Q=k,k=await k.getDirectoryHandle(H,{create:!0}));return this.#e=k,this.#a=Q,this.#o=await this.#e.getDirectoryHandle(N,{create:!0}),this.releaseAccessHandles(),this.acquireAccessHandles(b)}getPath(b){return g.isPtr(b)&&(b=g.cstrToJs(b)),(b instanceof URL?b:new URL(b,"file://localhost/")).pathname}deletePath(b){const k=this.#t.get(b);return k&&(this.#t.delete(b),this.setAssociatedPath(k,"",0)),!!k}storeErr(b,k){return b&&(b.sqlite3Rc=k||o.SQLITE_IOERR,this.error(b)),this.$error=b,k}popErr(){const b=this.$error;return this.$error=void 0,b}nextAvailableSAH(){const[b]=this.#s.keys();return b}getOFileForS3File(b){return this.#l.get(b)}mapS3FileToOFile(b,k){k?(this.#l.set(b,k),_(b,this)):(this.#l.delete(b),_(b,!1))}hasFilename(b){return this.#t.has(b)}getSAHForPath(b){return this.#t.get(b)}async removeVfs(){if(!this.#i.pointer||!this.#o)return!1;o.sqlite3_vfs_unregister(this.#i.pointer),this.#i.dispose(),delete s[this.vfsName];try{this.releaseAccessHandles(),await this.#e.removeEntry(N,{recursive:!0}),this.#o=void 0,await this.#a.removeEntry(this.#e.name,{recursive:!0}),this.#e=this.#a=void 0}catch(b){t.config.error(this.vfsName,"removeVfs() failed with no recovery strategy:",b)}return!0}pauseVfs(){return this.#l.size>0&&t.SQLite3Error.toss(o.SQLITE_MISUSE,"Cannot pause VFS",this.vfsName,"because it has opened files."),this.#r.size>0&&(o.sqlite3_vfs_unregister(this.vfsName),this.releaseAccessHandles()),this}isPaused(){return this.#r.size===0}async unpauseVfs(){return this.#r.size===0?this.acquireAccessHandles(!1).then(()=>o.sqlite3_vfs_register(this.#i,0),this):this}exportFile(b){const k=this.#t.get(b)||n("File not found:",b),Q=k.getSize()-q,H=new Uint8Array(Q>0?Q:0);if(Q>0){const Z=k.read(H,{at:q});Z!=Q&&n("Expected to read "+Q+" bytes but read "+Z+".")}return H}async importDbChunked(b,k){const Q=this.#t.get(b)||this.nextAvailableSAH()||n("No available handles to import to.");Q.truncate(0);let H=0,Z,E=!1;try{for(;(Z=await k())!==void 0;)Z instanceof ArrayBuffer&&(Z=new Uint8Array(Z)),H===0&&Z.byteLength>=15&&(p.affirmDbHeader(Z),E=!0),Q.write(Z,{at:q+H}),H+=Z.byteLength;if((H<512||H%512!==0)&&n("Input size",H,"is not correct for an SQLite database."),!E){const C=new Uint8Array(20);Q.read(C,{at:0}),p.affirmDbHeader(C)}Q.write(new Uint8Array([1,1]),{at:q+18})}catch(C){throw this.setAssociatedPath(Q,"",0),C}return this.setAssociatedPath(Q,b,o.SQLITE_OPEN_MAIN_DB),H}importDb(b,k){if(k instanceof ArrayBuffer)k=new Uint8Array(k);else if(k instanceof Function)return this.importDbChunked(b,k);const Q=this.#t.get(b)||this.nextAvailableSAH()||n("No available handles to import to."),H=k.byteLength;(H<512||H%512!=0)&&n("Byte array size is invalid for an SQLite db.");const Z="SQLite format 3";for(let C=0;Cthis)}isPaused(){return this.#e.isPaused()}}const se=async()=>{const j=await navigator.storage.getDirectory(),b=".opfs-sahpool-sync-check-"+P(),H=(await(await j.getFileHandle(b,{create:!0})).createSyncAccessHandle()).close();return await H,await j.removeEntry(b),H?.then&&n("The local OPFS API is too old for opfs-sahpool:","it has an async FileSystemSyncAccessHandle.close() method."),!0};t.installOpfsSAHPoolVfs=async function(j=Object.create(null)){j=Object.assign(Object.create(null),$,j||{});const b=j.name;if(j.$testThrowPhase1)throw j.$testThrowPhase1;if(s[b])try{return await s[b]}catch(k){if(j.forceReinitIfPreviouslyFailed)delete s[b];else throw k}return!globalThis.FileSystemHandle||!globalThis.FileSystemDirectoryHandle||!globalThis.FileSystemFileHandle||!globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle||!navigator?.storage?.getDirectory?s[b]=Promise.reject(new Error("Missing required OPFS APIs.")):s[b]=se().then(async function(){if(j.$testThrowPhase2)throw j.$testThrowPhase2;const k=new ne(j);return k.isReady.then(async()=>{const Q=new re(k);if(t.oo1){const H=t.oo1,Z=k.getVfs(),E=function(...C){const M=H.DB.dbCtorHelper.normalizeArgs(...C);M.vfs=Z.$zName,H.DB.dbCtorHelper.call(this,M)};E.prototype=Object.create(H.DB.prototype),Q.OpfsSAHPoolDb=E}return k.log("VFS initialized."),Q}).catch(async Q=>{throw await k.removeVfs().catch(()=>{}),Q})}).catch(k=>s[b]=Promise.reject(k))}}),typeof i<"u"){const t=Object.assign(Object.create(null),{exports:typeof h>"u"?i.asm:h,memory:i.wasmMemory},globalThis.sqlite3ApiConfig||{});globalThis.sqlite3ApiConfig=t;let n;try{n=globalThis.sqlite3ApiBootstrap()}catch(r){throw console.error("sqlite3ApiBootstrap() error:",r),r}finally{delete globalThis.sqlite3ApiBootstrap,delete globalThis.sqlite3ApiConfig}i.sqlite3=n}else console.warn("This is not running in an Emscripten module context, so","globalThis.sqlite3ApiBootstrap() is _not_ being called due to lack","of config info for the WASM environment.","It must be called manually.")},be=$e,be}})();const Xn=(function(){const Ie=ot;if(!Ie)throw new Error("Expecting globalThis.sqlite3InitModule to be defined by the Emscripten build.");const qe=globalThis.sqlite3InitModuleState=Object.assign(Object.create(null),{moduleScript:globalThis?.document?.currentScript,isWorker:typeof WorkerGlobalScope<"u",location:globalThis.location,urlParams:globalThis?.location?.href?new URL(globalThis.location.href).searchParams:new URLSearchParams});if(qe.debugModule=qe.urlParams.has("sqlite3.debugModule")?(...be)=>console.warn("sqlite3.debugModule:",...be):()=>{},qe.urlParams.has("sqlite3.dir"))qe.sqlite3Dir=qe.urlParams.get("sqlite3.dir")+"/";else if(qe.moduleScript){const be=qe.moduleScript.src.split("/");be.pop(),qe.sqlite3Dir=be.join("/")+"/"}if(globalThis.sqlite3InitModule=function be(...i){return Ie(...i).then(ve=>{ve.runSQLite3PostLoadInit(ve);const Ee=ve.sqlite3;Ee.scriptInfo=qe,be.__isUnderTest&&(Ee.__isUnderTest=!0);const $e=Ee.asyncPostInit;return delete Ee.asyncPostInit,$e()}).catch(ve=>{throw console.error("Exception loading sqlite3 module:",ve),ve})},globalThis.sqlite3InitModule.ready=Ie.ready,globalThis.sqlite3InitModuleState.moduleScript){const be=globalThis.sqlite3InitModuleState;let i=be.moduleScript.src.split("/");i.pop(),be.scriptDir=i.join("/")+"/"}return qe.debugModule("sqlite3InitModuleState =",qe),globalThis.sqlite3InitModule})();ot=Xn;var Yn=ot;Yn().then(Ie=>Ie.initWorker1API()); diff --git a/dist/index.html b/dist/index.html index 33ae18c..cc778e3 100644 --- a/dist/index.html +++ b/dist/index.html @@ -5,8 +5,8 @@ JapLearn — интервальные повторения - - + +
diff --git a/src/db-types.ts b/src/db-types.ts index 24e0e9a..5e02247 100644 --- a/src/db-types.ts +++ b/src/db-types.ts @@ -7,7 +7,7 @@ // т.е. количество дней с 1970-01-01, без времени; // - states.fsrs_memory: сырое INTEGER-значение FSRS (не дата, не трогаем). -import { query } from "./sqlite-api"; +import { query } from "./sqlite-api.ts"; export interface CustomField { id: number; @@ -37,32 +37,145 @@ export interface Word { id: number; key: string; value: string; + /** Сырое значение колонки tags (как лежит в БД). */ tags: string; + /** Распарсенные теги для UI (split по запятой/пробелам/точке с запятой). */ + tagsList: string[]; + /** + * Доп. поля: more хранится как чередование пар через \u001f: + * "fieldId\u001fvalue\u001ffieldId\u001fvalue...". + * Ключ — id из custom_fields, значение — текст. + */ more: Map; group_id: number; } -export async function wordList() { - let rows = await query("SELECT id, key, value, tags, more, group_id FROM words"); - - return rows.map((row: any) => { - let more : string = row.more.split(''); - let dict = new Map(); - for (let i = 0; i < more.length / 2; i++) { - dict.set(more[i * 2], more[i * 2 + 1]); - } - let w = { - id: row.id, - key: row.key, - value: row.value, - tags: row.tags, - more: dict, - group_id: row.group_id, - } - return w; - }) as Word[]; +export interface WordListFilter { + /** Подстрока для поиска по key/value/tags (LIKE %q%, без учёта регистра). */ + search?: string; + /** Фильтр по группе. undefined/null = все группы. */ + groupId?: number | null; + limit?: number; + offset?: number; } +/** Разбирает сырое поле tags в список чипсов. */ +export function parseTags(raw: unknown): string[] { + if (raw == null) return []; + const s = String(raw).trim(); + if (!s) return []; + return s + .split(/[,\s;]+/) + .map((t) => t.trim()) + .filter((t) => t.length > 0); +} + +/** + * Разбирает сырое поле more в Map. + * Формат десктопа: пары через \u001f (Unit Separator): + * "3\u001fчтение\u001f5\u001fпример". Нечисловые ключи игнорируем, + * висячий хвост без пары отбрасываем, пустые значения пропускаем. + */ +export function parseMore(raw: unknown): Map { + const dict = new Map(); + if (raw == null) return dict; + const s = String(raw); + if (!s) return dict; + const parts = s.split(""); + for (let i = 0; i + 1 < parts.length; i += 2) { + const id = Number(parts[i]); + const val = parts[i + 1] ?? ""; + if (!Number.isFinite(id) || !Number.isInteger(id)) continue; + if (!val) continue; + dict.set(id, val); + } + return dict; +} + +function mapRowToWord(row: Record): Word { + const id = Number(row["id"] ?? 0); + const key = String(row["key"] ?? ""); + const value = String(row["value"] ?? ""); + const tagsRaw = row["tags"] == null ? "" : String(row["tags"]); + const group_id = Number(row["group_id"] ?? 1); + return { + id, + key, + value, + tags: tagsRaw, + tagsList: parseTags(tagsRaw), + more: parseMore(row["more"]), + group_id: Number.isFinite(group_id) ? group_id : 1, + }; +} + +function buildWhere(filter: WordListFilter): { clause: string; params: unknown[] } { + const conds: string[] = []; + const params: unknown[] = []; + const search = (filter.search ?? "").trim(); + if (search) { + // Простой LIKE-поиск по трём колонкам. more не трогаем (там id+значения вперемешку). + conds.push("(key LIKE ? ESCAPE '\\' OR value LIKE ? ESCAPE '\\' OR tags LIKE ? ESCAPE '\\')"); + const like = `%${search.replace(/\\/g, "\\\\").replace(/%/g, "\\%").replace(/_/g, "\\_")}%`; + params.push(like, like, like); + } + if (filter.groupId != null) { + conds.push("group_id = ?"); + params.push(filter.groupId); + } + return { clause: conds.length > 0 ? `WHERE ${conds.join(" AND ")}` : "", params }; +} + +/** Сколько всего слов подходит под фильтр (для пагинации/счётчика). */ +export async function countWords(filter: WordListFilter = {}): Promise { + const { clause, params } = buildWhere(filter); + const rows = await query(`SELECT COUNT(*) as cnt FROM words ${clause}`, params as never[]); + const cnt = (rows[0] as Record | undefined)?.["cnt"]; + return typeof cnt === "number" ? cnt : Number(cnt ?? 0); +} + +/** + * Визуализация слов для главной страницы: поиск + фильтр по группе + пагинация. + * Сортировка — по id (порядок добавления), чтобы список был стабильным. + */ +export async function getWords(filter: WordListFilter = {}): Promise { + const { clause, params } = buildWhere(filter); + const limit = Math.max(1, Math.min(filter.limit ?? 50, 500)); + const offset = Math.max(0, filter.offset ?? 0); + const rows = await query( + `SELECT id, key, value, tags, more, group_id FROM words ${clause} ORDER BY id LIMIT ? OFFSET ?`, + [...(params as unknown[]), limit, offset] as never[], + ); + return (rows as Record[]).map(mapRowToWord); +} + +/** + * Легаси-обёртка: все слова без пагинации (для десктоп-совместимости / отладки). + * Для UI используй getWords() + countWords(). + */ +export async function wordList(): Promise { + const rows = await query("SELECT id, key, value, tags, more, group_id FROM words ORDER BY id"); + return (rows as Record[]).map(mapRowToWord); +} + +export async function getWordGroups(): Promise { + const rows = await query("SELECT id, name FROM word_groups ORDER BY id"); + return (rows as Record[]).map((r) => ({ + id: Number(r["id"]), + name: String(r["name"] ?? ""), + })); +} + +export async function getCustomFields(): Promise { + const rows = await query("SELECT id, name, identifier FROM custom_fields ORDER BY id"); + return (rows as Record[]).map((r) => ({ + id: Number(r["id"]), + name: String(r["name"] ?? ""), + identifier: String(r["identifier"] ?? ""), + })); +} + + export interface HistoryEntry { id: number; deck_id: number; diff --git a/src/db-worker.ts b/src/db-worker.ts index b4fb8a8..79380b1 100644 --- a/src/db-worker.ts +++ b/src/db-worker.ts @@ -1,5 +1,5 @@ import sqlite3InitModule from '@sqlite.org/sqlite-wasm'; -import { DB_FILENAME } from './opfs'; +import { DB_FILENAME } from './opfs.ts'; let db: any | null = null; @@ -7,7 +7,6 @@ self.onmessage = async (e) => { const { type, id, sql, params } = e.data; try { - console.log(e.data.type) switch (type) { case 'start': { if (db != null) { @@ -30,14 +29,14 @@ self.onmessage = async (e) => { } case 'query': { if (db === null) throw new Error('БД не инициализирована'); - const result = db.selectObjects(sql, params); + const result = db.selectObjects(sql, params ?? []); self.postMessage({ type: 'success', id, data: result }); break; } case 'command': { if (db === null) throw new Error('БД не инициализирована'); - db.exec(sql, params); + db.exec(sql, params ?? []); self.postMessage({ type: 'success', id, data: null }); break; } @@ -45,11 +44,12 @@ self.onmessage = async (e) => { if (db === null) throw new Error('БД не инициализирована'); db.close(); db = null; + self.postMessage({ type: 'success', id, data: null }); break; } } } catch (err: any) { console.error(err); - self.postMessage({ type: 'error', message: err.message , id}); + self.postMessage({ type: 'error', error: err?.message ?? String(err), id }); } }; \ No newline at end of file diff --git a/src/home-page.ts b/src/home-page.ts index 8b727b6..6834ec7 100644 --- a/src/home-page.ts +++ b/src/home-page.ts @@ -1,8 +1,8 @@ -// Главная страница: статус локальной базы + быстрый переход к синхронизации. -// Никакой БД-логики кроме проверки наличия файла в OPFS. +// Главная страница: статус локальной базы + визуализация слов (getWords). +// Поиск по key/value/tags, фильтр по группе, пагинация «Показать ещё». -import { wordList } from './db-types.ts'; -import { worker } from './main.ts'; +import { countWords, getCustomFields, getWordGroups, getWords } from './db-types.ts'; +import type { CustomField, Word, WordGroup } from './db-types.ts'; import { hasDatabaseFile, readDatabaseFile } from './opfs.ts'; import { looksLikeSQLite } from './zstd.ts'; @@ -10,6 +10,36 @@ export type HomeNav = { goSync: () => void; }; +const PAGE_SIZE = 30; + +function escapeHtml(s: string): string { + return s + .replace(/&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); +} + +function wordCardHtml(w: Word, gname: string | undefined, fmap: Map): string { + const tags = w.tagsList.map((t) => `${escapeHtml(t)}`).join(''); + const mrows = [...w.more.entries()] + .map(([fid, val]) => { + const f = fmap.get(fid); + const label = f ? `${escapeHtml(f.name)} #${fid}` : `Поле #${fid}`; + return `
${label}
${escapeHtml(val)}
`; + }) + .join(''); + const more = mrows + ? `
Дополнительно (${w.more.size})
${mrows}
` + : ''; + return `
+
${escapeHtml(w.key)}
` + + (gname ? `${escapeHtml(gname)}` : '') + + `
${escapeHtml(w.value)}
` + + (tags ? `
${tags}
` : '') + more + `
`; +} + export function renderHomePage(root: HTMLElement, nav: HomeNav): void { root.innerHTML = `
@@ -23,23 +53,150 @@ export function renderHomePage(root: HTMLElement, nav: HomeNav): void {
+
+

📚 Слова

+
+ + +
+

+
База ещё не проверена.
+
+
+
`; const statusEl = root.querySelector('#home-db-status')!; const goSync = root.querySelector('#btn-go-sync')!; const actions = root.querySelector('#home-actions')!; const btnStart = root.querySelector('#btn-start')!; + const searchInput = root.querySelector('#words-search')!; + const groupSelect = root.querySelector('#words-group')!; + const countEl = root.querySelector('#words-count')!; + const wordsStatus = root.querySelector('#words-status')!; + const listEl = root.querySelector('#words-list')!; + const moreBtn = root.querySelector('#words-more')!; goSync.addEventListener('click', () => nav.goSync()); btnStart.addEventListener('click', () => { statusEl.textContent = 'Экран повторений — следующий шаг.'; }); + // --- Состояние списка слов --- + let dbReady = false; + let gnames = new Map(); + let fmap = new Map(); + let total = 0; + let loaded: Word[] = []; + let offset = 0; + let loading = false; + let reqSeq = 0; + let debounce = 0; + + function wordsFilter(): { search: string; groupId: number | null } { + const v = groupSelect.value; + if (v === '') return { search: searchInput.value.trim(), groupId: null }; + const n = Number(v); + return { search: searchInput.value.trim(), groupId: Number.isFinite(n) ? n : null }; + } + + function refreshMoreBtn(): void { + moreBtn.hidden = !(dbReady && loaded.length < total); + if (!moreBtn.hidden) moreBtn.textContent = `Показать ещё (${total - loaded.length} осталось)`; + } + + function fullRender(): void { + listEl.innerHTML = loaded.map((w) => wordCardHtml(w, gnames.get(w.group_id), fmap)).join(''); + countEl.textContent = total > 0 ? `Показано ${loaded.length} из ${total}` : ''; + refreshMoreBtn(); + } + + function setWStatus(msg: string): void { + wordsStatus.textContent = msg; + wordsStatus.hidden = msg === ''; + } + + async function reloadWords(): Promise { + if (!dbReady || loading) return; + loading = true; + const my = ++reqSeq; + const f = wordsFilter(); + moreBtn.disabled = true; + if (loaded.length === 0) setWStatus('Загрузка слов…'); + try { + const [cnt, words] = await Promise.all([ + countWords({ search: f.search, groupId: f.groupId ?? undefined }), + getWords({ search: f.search, groupId: f.groupId ?? undefined, limit: PAGE_SIZE, offset: 0 }), + ]); + if (my !== reqSeq) return; + total = cnt; + loaded = words; + offset = words.length; + fullRender(); + setWStatus(words.length === 0 ? 'По этому запросу слов нет.' : ''); + if (words.length === 0 && total === 0) countEl.textContent = 'Слов в базе пока нет.'; + } catch (err) { + if (my !== reqSeq) return; + setWStatus(`Не удалось загрузить слова: ${err instanceof Error ? err.message : String(err)}`); + } finally { + if (my === reqSeq) { + loading = false; + moreBtn.disabled = false; + refreshMoreBtn(); + } + } + } + + async function loadMore(): Promise { + if (!dbReady || loading || loaded.length >= total) return; + loading = true; + const my = ++reqSeq; + const f = wordsFilter(); + moreBtn.disabled = true; + moreBtn.textContent = 'Загрузка…'; + try { + const words = await getWords({ search: f.search, groupId: f.groupId ?? undefined, limit: PAGE_SIZE, offset }); + if (my !== reqSeq) return; + loaded = loaded.concat(words); + offset += words.length; + listEl.insertAdjacentHTML('beforeend', words.map((w) => wordCardHtml(w, gnames.get(w.group_id), fmap)).join('')); + countEl.textContent = `Показано ${loaded.length} из ${total}`; + refreshMoreBtn(); + } catch (err) { + if (my !== reqSeq) return; + setWStatus(`Не удалось догрузить: ${err instanceof Error ? err.message : String(err)}`); + } finally { + if (my === reqSeq) { + loading = false; + moreBtn.disabled = false; + refreshMoreBtn(); + } + } + } + + searchInput.addEventListener('input', () => { + window.clearTimeout(debounce); + debounce = window.setTimeout(() => void reloadWords(), 300); + }); + searchInput.addEventListener('keydown', (e) => { + if (e.key === 'Enter') { + window.clearTimeout(debounce); + void reloadWords(); + } + }); + groupSelect.addEventListener('change', () => void reloadWords()); + moreBtn.addEventListener('click', () => void loadMore()); + void (async () => { const has = await hasDatabaseFile(); if (!has) { statusEl.textContent = 'Локальной базы нет. Скачай сохранение на странице «Синхронизация».'; actions.hidden = true; + setWStatus('Нет локальной базы — скачай сохранение на странице «Синхронизация».'); + countEl.textContent = ''; return; } try { @@ -49,9 +206,22 @@ export function renderHomePage(root: HTMLElement, nav: HomeNav): void { ? `Локальная база на месте: ${(raw.length / 1024).toFixed(1)} КБ, сигнатура SQLite OK.` : 'Файл в OPFS есть, но это не похоже на SQLite — перекачай сохранение.'; actions.hidden = !ok; - if (ok) { - let list = await wordList(); - console.log(list); + if (!ok) { + setWStatus('Файл в OPFS не похож на SQLite — перекачай сохранение.'); + return; + } + try { + const [gs, fields] = await Promise.all([getWordGroups(), getCustomFields()]); + const groups: WordGroup[] = gs; + gnames = new Map(groups.map((g) => [g.id, g.name])); + fmap = new Map(fields.map((f) => [f.id, f])); + groupSelect.innerHTML = '' + + groups.map((g) => ``).join(''); + dbReady = true; + await reloadWords(); + groupSelect.options[0].textContent = `Все группы (${total})`; + } catch (err) { + setWStatus(`БД есть, но слова не прочитались: ${err instanceof Error ? err.message : String(err)}`); } } catch (err) { statusEl.textContent = `Не удалось прочитать базу: ${err instanceof Error ? err.message : String(err)}`; diff --git a/src/main.ts b/src/main.ts index bbd80a5..315573a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,10 +3,6 @@ import { renderHomePage } from './home-page.ts'; import { renderSyncPage } from './sync-page.ts'; import { initWorker } from './sqlite-api.ts'; -export const worker = new Worker(new URL('./db-worker.ts', import.meta.url), { - type: 'module', -}); - // Каркас приложения: топ-бар + бургер-меню + две страницы (Главная / Синхронизация). type Page = 'home' | 'sync'; diff --git a/src/sqlite-api.ts b/src/sqlite-api.ts index bce10a1..a28cc4e 100644 --- a/src/sqlite-api.ts +++ b/src/sqlite-api.ts @@ -1,4 +1,6 @@ -import { worker } from "./main"; +const worker = new Worker(new URL('./db-worker.ts', import.meta.url), { + type: 'module', +}); let requestId = 0; @@ -14,7 +16,6 @@ export function initWorker(): Promise { initPromise = new Promise((resolve, reject) => { worker.onmessage = (e: MessageEvent) => { - console.log("Handling worker output"); const msg = e.data; if (msg.type === 'ready') { @@ -29,8 +30,7 @@ export function initWorker(): Promise { if (msg.type == "success") { pendingReq.resolve(msg.data); } else { - console.log(msg) - pendingReq.reject(new Error(msg.error || 'Неизвестная ошибка Worker')); + pendingReq.reject(new Error(msg.error ?? msg.message ?? 'Неизвестная ошибка Worker')); } }; @@ -63,12 +63,12 @@ function sendToWorker(type: string, payload?: any): Promise { } export async function query(sql: string, params?: any[]): Promise { - const result = await sendToWorker('query', { sql, params }); + const result = await sendToWorker('query', { sql, params: params ?? [] }); return result; } export async function command(sql: string, params?: any[]): Promise { - await sendToWorker('command', { sql, params }); + await sendToWorker('command', { sql, params: params ?? [] }); } export async function closeDb(): Promise { diff --git a/src/style.css b/src/style.css index 0cee6b3..2260127 100644 --- a/src/style.css +++ b/src/style.css @@ -281,3 +281,152 @@ body.drawer-open { font-size: 0.95rem; word-break: break-word; } + +.status-bar[hidden] { + display: none; +} + +/* --- Список слов (главная) --- */ + +.words-toolbar { + display: flex; + gap: 8px; +} + +.words-search { + flex: 1; + min-width: 0; + padding: 12px; + font-size: 1rem; + border: 2px solid #d9d2f0; + border-radius: 12px; + outline: none; + background: #fff; + color: inherit; +} + +.words-search:focus { + border-color: #7c3aed; +} + +.words-group { + flex: none; + max-width: 42%; + padding: 12px 8px; + font-size: 0.95rem; + font-weight: 600; + color: #4c446b; + border: 2px solid #d9d2f0; + border-radius: 12px; + background: #fff; + outline: none; +} + +.words-group:focus { + border-color: #7c3aed; +} + +.words-list { + display: flex; + flex-direction: column; + gap: 10px; +} + +.word-card { + border: 1px solid #eee9fb; + border-radius: 12px; + padding: 12px; + background: #fbfaff; + display: flex; + flex-direction: column; + gap: 8px; +} + +.word-card-top { + display: flex; + align-items: flex-start; + justify-content: space-between; + gap: 8px; +} + +.word-key { + font-size: 1.2rem; + font-weight: 700; + line-height: 1.3; + word-break: break-word; +} + +.word-value { + font-size: 1rem; + color: #4c446b; + word-break: break-word; +} + +.word-group { + flex: none; + font-size: 0.75rem; + font-weight: 700; + color: #6d28d9; + background: #f1eafe; + border-radius: 999px; + padding: 4px 10px; + white-space: nowrap; +} + +.tag-row { + display: flex; + flex-wrap: wrap; + gap: 6px; +} + +.tag-chip { + font-size: 0.8rem; + font-weight: 600; + color: #5b21b6; + background: #ede9fe; + border-radius: 999px; + padding: 3px 10px; + word-break: break-word; +} + +.word-more { + font-size: 0.9rem; + color: #4c446b; +} + +.word-more summary { + cursor: pointer; + font-weight: 600; + color: #6d28d9; + touch-action: manipulation; +} + +.word-more-list { + margin: 8px 0 0; + display: flex; + flex-direction: column; + gap: 6px; +} + +.word-more-row { + background: #fff; + border: 1px solid #eee9fb; + border-radius: 8px; + padding: 8px 10px; +} + +.word-more-row dt { + font-size: 0.8rem; + font-weight: 700; + color: #6d6390; +} + +.word-more-row dd { + margin: 2px 0 0; + word-break: break-word; +} + +.word-more-id { + font-weight: 400; + opacity: 0.7; +}