UNPKG

@hyrfilm/workhorse

Version:

Transactional task queue for the browser with support for OPFS, localStorage, sessionStorage, in-memory

5 lines 196 kB
(function(){"use strict";var Ke=(()=>{var Ae=self.location.href;return function(qe={}){var be,i=qe,ke,ve,Je=new Promise((e,t)=>{ke=e,ve=t}),Tt=typeof window=="object",Ue=typeof importScripts=="function";typeof process=="object"&&typeof process.versions=="object"&&process.versions.node;const Ft=globalThis.sqlite3InitModuleState||Object.assign(Object.create(null),{debugModule:()=>{}});delete globalThis.sqlite3InitModuleState,Ft.debugModule("globalThis.location =",globalThis.location);var lt=Object.assign({},i),at="./this.program",ye="";function Ot(e){return i.locateFile?i.locateFile(e,ye):ye+e}var Xe,ze;(Tt||Ue)&&(Ue?ye=self.location.href:typeof document<"u"&&document.currentScript&&(ye=document.currentScript.src),Ae&&(ye=Ae),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)}),Xe=e=>fetch(e,{credentials:"same-origin"}).then(t=>t.ok?t.arrayBuffer():Promise.reject(new Error(t.status+" : "+t.url))));var Ye=i.print||console.log.bind(console),Ie=i.printErr||console.error.bind(console);Object.assign(i,lt),lt=null,i.arguments&&i.arguments,i.thisProgram&&(at=i.thisProgram);var We=i.wasmBinary,Te,ct=!1,ge,Pe,Ne,ce,he,Ee;function _t(){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=Ee=new BigInt64Array(e),i.HEAPU64=new BigUint64Array(e)}if(i.wasmMemory)Te=i.wasmMemory;else{var Pt=i.INITIAL_MEMORY||16777216;Te=new WebAssembly.Memory({initial:Pt/65536,maximum:32768})}_t();var ut=[],ft=[],dt=[];function Lt(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)Rt(i.preRun.shift());tt(ut)}function Ct(){!i.noFSInit&&!a.initialized&&a.init(),a.ignorePermissions=!1,tt(ft)}function Dt(){if(i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)Mt(i.postRun.shift());tt(dt)}function Rt(e){ut.unshift(e)}function Nt(e){ft.unshift(e)}function Mt(e){dt.unshift(e)}var Fe=0,Me=null;function Yn(e){return e}function Ze(e){Fe++,i.monitorRunDependencies?.(Fe)}function Qe(e){if(Fe--,i.monitorRunDependencies?.(Fe),Fe==0&&Me){var t=Me;Me=null,t()}}function et(e){i.onAbort?.(e),e="Aborted("+e+")",Ie(e),ct=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw ve(t),t}var jt="data:application/octet-stream;base64,",pt=e=>e.startsWith(jt);function Bt(){if(i.locateFile){var e="sqlite3.wasm";return pt(e)?e:Ot(e)}return new URL(""+new URL("sqlite3-CgX3seBP.wasm",self.location.href).href,self.location.href).href}var He;function ht(e){if(e==He&&We)return new Uint8Array(We);if(ze)return ze(e);throw"both async and sync fetching of the wasm failed"}function Ut(e){return We?Promise.resolve().then(()=>ht(e)):Xe(e).then(t=>new Uint8Array(t),()=>ht(e))}function mt(e,t,n){return Ut(e).then(r=>WebAssembly.instantiate(r,t)).then(n,r=>{Ie(`failed to asynchronously prepare wasm: ${r}`),et(r)})}function zt(e,t,n,r){return!e&&typeof WebAssembly.instantiateStreaming=="function"&&!pt(t)&&typeof fetch=="function"?fetch(t,{credentials:"same-origin"}).then(s=>{var o=WebAssembly.instantiateStreaming(s,n);return o.then(r,function(h){return Ie(`wasm streaming compile failed: ${h}`),Ie("falling back to ArrayBuffer instantiation"),mt(t,n,r)})}):mt(t,n,r)}function Wt(){return{env:xt,wasi_snapshot_preview1:xt}}function Qt(){var e=Wt();function t(r,s){return m=r.exports,Nt(m.__wasm_call_ctors),Qe(),m}Ze();function n(r){t(r.instance)}if(i.instantiateWasm)try{return i.instantiateWasm(e,t)}catch(r){Ie(`Module.instantiateWasm callback failed with error: ${r}`),ve(r)}return He||(He=Bt()),zt(We,He,e,n).catch(ve),{}}var tt=e=>{for(;e.length>0;)e.shift()(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)},Ht=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return e=>crypto.getRandomValues(e);et("initRandomDevice")},gt=e=>(gt=Ht())(e),xe={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=xe.resolve(e).substr(1),t=xe.resolve(t).substr(1);function n(D){for(var U=0;U<D.length&&D[U]==="";U++);for(var Q=D.length-1;Q>=0&&D[Q]==="";Q--);return U>Q?[]:D.slice(U,Q-U+1)}for(var r=n(e.split("/")),s=n(t.split("/")),o=Math.min(r.length,s.length),h=o,g=0;g<o;g++)if(r[g]!==s[g]){h=g;break}for(var O=[],g=h;g<r.length;g++)O.push("..");return O=O.concat(s.slice(h)),O.join("/")}},qt=typeof TextDecoder<"u"?new TextDecoder:void 0,Le=(e,t,n)=>{for(var r=t+n,s=t;e[s]&&!(s>=r);)++s;if(s-t>16&&e.buffer&&qt)return qt.decode(e.subarray(t,s));for(var o="";t<s;){var h=e[t++];if(!(h&128)){o+=String.fromCharCode(h);continue}var g=e[t++]&63;if((h&224)==192){o+=String.fromCharCode((h&31)<<6|g);continue}var O=e[t++]&63;if((h&240)==224?h=(h&15)<<12|g<<6|O:h=(h&7)<<18|g<<12|O<<6|e[t++]&63,h<65536)o+=String.fromCharCode(h);else{var D=h-65536;o+=String.fromCharCode(55296|D>>10,56320|D&1023)}}return o},nt=[],Ve=e=>{for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r<=127?t++:r<=2047?t+=2:r>=55296&&r<=57343?(t+=4,++n):t+=3}return t},rt=(e,t,n,r)=>{if(!(r>0))return 0;for(var s=n,o=n+r-1,h=0;h<e.length;++h){var g=e.charCodeAt(h);if(g>=55296&&g<=57343){var O=e.charCodeAt(++h);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 bt(e,t,n){var r=Ve(e)+1,s=new Array(r),o=rt(e,s,0,s.length);return s.length=o,s}var Vt=()=>{if(!nt.length){var e=null;if(typeof window<"u"&&typeof window.prompt=="function"&&(e=window.prompt("Input: "),e!==null&&(e+=`
`)),!e)return null;nt=bt(e)}return nt.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,h=0;h<r;h++){var g;try{g=e.tty.ops.get_char(e.tty)}catch{throw new a.ErrnoError(29)}if(g===void 0&&o===0)throw new a.ErrnoError(6);if(g==null)break;o++,t[n+h]=g}return o&&(e.node.timestamp=Date.now()),o},write(e,t,n,r,s){if(!e.tty||!e.tty.ops.put_char)throw new a.ErrnoError(60);try{for(var o=0;o<r;o++)e.tty.ops.put_char(e.tty,t[n+o])}catch{throw new a.ErrnoError(29)}return r&&(e.node.timestamp=Date.now()),o}},default_tty_ops:{get_char(e){return Vt()},put_char(e,t){t===null||t===10?(Ye(Le(e.output,0)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(Ye(Le(e.output,0)),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?(Ie(Le(e.output,0)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output&&e.output.length>0&&(Ie(Le(e.output,0)),e.output=[])}}},Gt=(e,t)=>(Pe.fill(0,e,e+t),e),yt=(e,t)=>Math.ceil(e/t)*t,wt=e=>{e=yt(e,65536);var t=St(65536,e);return t?Gt(t,e):0},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<r?2:1.125)>>>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 h=Math.min(e.node.usedBytes-s,r);if(h>8&&o.subarray)t.set(o.subarray(s,s+h),n);else for(var g=0;g<h;g++)t[n+g]=o[s+g];return h},write(e,t,n,r,s,o){if(t.buffer===ge.buffer&&(o=!1),!r)return 0;var h=e.node;if(h.timestamp=Date.now(),t.subarray&&(!h.contents||h.contents.subarray)){if(o)return h.contents=t.subarray(n,n+r),h.usedBytes=r,r;if(h.usedBytes===0&&s===0)return h.contents=t.slice(n,n+r),h.usedBytes=r,r;if(s+r<=h.usedBytes)return h.contents.set(t.subarray(n,n+r),s),r}if(ie.expandFileStorage(h,s+r),h.contents.subarray&&t.subarray)h.contents.set(t.subarray(n,n+r),s);else for(var g=0;g<r;g++)h.contents[s+g]=t[n+g];return h.usedBytes=Math.max(h.usedBytes,s+r),r},llseek(e,t,n){var r=t;if(n===1?r+=e.position:n===2&&a.isFile(e.node.mode)&&(r+=e.node.usedBytes),r<0)throw new a.ErrnoError(28);return r},allocate(e,t,n){ie.expandFileStorage(e.node,t+n),e.node.usedBytes=Math.max(e.node.usedBytes,t+n)},mmap(e,t,n,r,s){if(!a.isFile(e.node.mode))throw new a.ErrnoError(43);var o,h,g=e.node.contents;if(!(s&2)&&g&&g.buffer===ge.buffer)h=!1,o=g.byteOffset;else{if(h=!0,o=wt(t),!o)throw new a.ErrnoError(48);g&&((n>0||n+t<g.length)&&(g.subarray?g=g.subarray(n,n+t):g=Array.prototype.slice.call(g,n,n+t)),ge.set(g,o))}return{ptr:o,allocated:h}},msync(e,t,n,r,s){return ie.stream_ops.write(e,t,0,r,n,!1),0}}},$t=(e,t,n,r)=>{var s=`al ${e}`;Xe(e).then(o=>{t(new Uint8Array(o)),s&&Qe()},o=>{if(n)n();else throw`Loading data file "${e}" failed.`}),s&&Ze()},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,h,g,O,D)=>{var U=t?xe.resolve(_e.join2(e,t)):e;function Q(T){function S(C){D?.(),g||Kt(e,t,C,r,s,O),o?.(),Qe()}Xt(T,U,S,()=>{h?.(),Qe()})||S(T)}Ze(),typeof n=="string"?$t(n,Q,h):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},st=(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,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=xe.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="/",h=0;h<r.length;h++){var g=h===r.length-1;if(g&&t.parent)break;if(s=a.lookupNode(s,r[h]),o=_e.join2(o,r[h]),a.isMountpoint(s)&&(!g||g&&t.follow_mount)&&(s=s.mounted.root),!g||t.follow)for(var O=0;a.isLink(s.mode);){var D=a.readlink(o);o=xe.resolve(_e.dirname(o),D);var U=a.lookupPath(o,{recurse_count:t.recurse_count+1});if(s=U.node,O++>40)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<t.length;r++)n=(n<<5)-n+t.charCodeAt(r)|0;return(e+n>>>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&&Ie(`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(h){return a.syncFSRequests--,t(h)}function o(h){if(h)return o.errored?void 0:(o.errored=!0,s(h));++r>=n.length&&s(null)}n.forEach(h=>{if(!h.type.syncfs)return o(null);h.type.syncfs(h,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 h=a.lookupPath(n,{follow_mount:!1});if(n=h.path,o=h.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(h=>{for(var g=a.nameTable[h];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 h=a.mayCreate(s,o);if(h)throw new a.ErrnoError(h);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<n.length;++s)if(n[s]){r+="/"+n[s];try{a.mkdir(r,t)}catch(o){if(o.errno!=20)throw o}}},mkdev(e,t,n){return typeof n>"u"&&(n=t,t=438),t|=8192,a.mknod(e,t,n)},symlink(e,t){if(!xe.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),h,g,O;if(h=a.lookupPath(e,{parent:!0}),g=h.node,h=a.lookupPath(t,{parent:!0}),O=h.node,!g||!O)throw new a.ErrnoError(44);if(g.mount!==O.mount)throw new a.ErrnoError(75);var D=a.lookupNode(g,s),U=xe.relative(e,r);if(U.charAt(0)!==".")throw new a.ErrnoError(28);if(U=xe.relative(t,n),U.charAt(0)!==".")throw new a.ErrnoError(55);var Q;try{Q=a.lookupNode(O,o)}catch{}if(D!==Q){var T=a.isDir(D.mode),S=a.mayDelete(g,s,T);if(S)throw new a.ErrnoError(S);if(S=Q?a.mayDelete(O,o,T):a.mayCreate(O,o),S)throw new a.ErrnoError(S);if(!g.node_ops.rename)throw new a.ErrnoError(63);if(a.isMountpoint(D)||Q&&a.isMountpoint(Q))throw new a.ErrnoError(10);if(O!==g&&(S=a.nodePermissions(g,"w"),S))throw new a.ErrnoError(S);a.hashRemoveNode(D);try{g.node_ops.rename(D,O,o),D.parent=O}catch(C){throw C}finally{a.hashAddNode(D)}}},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 xe.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=_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 h=a.mayOpen(r,t);if(h)throw new a.ErrnoError(h)}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)&&(a.readFiles||(a.readFiles={}),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 h=e.stream_ops.read(e,t,n,r,s);return o||(e.position+=h),h},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 h=typeof s<"u";if(!h)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 h||(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,h=new Uint8Array(o);return a.read(r,h,0,o,0),t.encoding==="utf8"?n=Le(h,0):t.encoding==="binary"&&(n=h),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(Ve(t)+1),o=rt(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,h,g)=>h}),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=gt(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),h={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>o.path}};return h.parent=h,h}},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="<generic error, no 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;e<a.streams.length;e++){var t=a.streams[e];t&&a.close(t)}},findObject(e,t){var n=a.analyzePath(e,t);return n.exists?n.object:null},analyzePath(e,t){try{var n=a.lookupPath(e,{follow:!t});e=n.path}catch{}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=a.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=_e.basename(e),n=a.lookupPath(e,{follow:!t}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot=n.path==="/"}catch(s){r.error=s.errno}return r},createPath(e,t,n,r){e=typeof e=="string"?e:a.getPath(e);for(var s=t.split("/").reverse();s.length;){var o=s.pop();if(o){var h=_e.join2(e,o);try{a.mkdir(h)}catch{}e=h}}return h},createFile(e,t,n,r,s){var o=_e.join2(typeof e=="string"?e:a.getPath(e),t),h=st(r,s);return a.create(o,h)},createDataFile(e,t,n,r,s,o){var h=t;e&&(e=typeof e=="string"?e:a.getPath(e),h=t?_e.join2(e,t):e);var g=st(r,s),O=a.create(h,g);if(n){if(typeof n=="string"){for(var D=new Array(n.length),U=0,Q=n.length;U<Q;++U)D[U]=n.charCodeAt(U);n=D}a.chmod(O,g|146);var T=a.open(O,577);a.write(T,n,0,n.length,0,o),a.close(T),a.chmod(O,g)}},createDevice(e,t,n,r){var s=_e.join2(typeof e=="string"?e:a.getPath(e),t),o=st(!!n,!!r);a.createDevice.major||(a.createDevice.major=64);var h=a.makedev(a.createDevice.major++,0);return a.registerDevice(h,{open(g){g.seekable=!1},close(g){r?.buffer?.length&&r(10)},read(g,O,D,U,Q){for(var T=0,S=0;S<U;S++){var C;try{C=n()}catch{throw new a.ErrnoError(29)}if(C===void 0&&T===0)throw new a.ErrnoError(6);if(C==null)break;T++,O[D+S]=C}return T&&(g.node.timestamp=Date.now()),T},write(g,O,D,U,Q){for(var T=0;T<U;T++)try{r(O[D+T])}catch{throw new a.ErrnoError(29)}return U&&(g.node.timestamp=Date.now()),T}}),a.mkdev(s,o,h)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(typeof XMLHttpRequest<"u")throw new Error("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");try{e.contents=ze(e.url),e.usedBytes=e.contents.length}catch{throw new a.ErrnoError(29)}},createLazyFile(e,t,n,r,s){class o{constructor(){this.lengthKnown=!1,this.chunks=[]}get(S){if(!(S>this.length-1||S<0)){var C=S%this.chunkSize,q=S/this.chunkSize|0;return this.getter(q)[C]}}setDataGetter(S){this.getter=S}cacheLength(){var S=new XMLHttpRequest;if(S.open("HEAD",n,!1),S.send(null),!(S.status>=200&&S.status<300||S.status===304))throw new Error("Couldn't load "+n+". Status: "+S.status);var C=Number(S.getResponseHeader("Content-length")),q,w=(q=S.getResponseHeader("Accept-Ranges"))&&q==="bytes",E=(q=S.getResponseHeader("Content-Encoding"))&&q==="gzip",R=1024*1024;w||(R=C);var L=(P,K)=>{if(P>K)throw new Error("invalid range ("+P+", "+K+") or no bytes requested!");if(K>C-1)throw new Error("only "+C+" bytes available! programmer error!");var c=new XMLHttpRequest;if(c.open("GET",n,!1),C!==R&&c.setRequestHeader("Range","bytes="+P+"-"+K),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||[]):bt(c.responseText||"")},x=this;x.setDataGetter(P=>{var K=P*R,c=(P+1)*R-1;if(c=Math.min(c,C-1),typeof x.chunks[P]>"u"&&(x.chunks[P]=L(K,c)),typeof x.chunks[P]>"u")throw new Error("doXHR failed!");return x.chunks[P]}),(E||!C)&&(R=C=1,C=this.getter(0).length,R=C,Ye("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=C,this._chunkSize=R,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 h=new o,g={isDevice:!1,contents:h}}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 D={},U=Object.keys(O.stream_ops);U.forEach(T=>{var S=O.stream_ops[T];D[T]=(...C)=>(a.forceLoadFile(O),S(...C))});function Q(T,S,C,q,w){var E=T.node.contents;if(w>=E.length)return 0;var R=Math.min(E.length-w,q);if(E.slice)for(var L=0;L<R;L++)S[C+L]=E[w+L];else for(var L=0;L<R;L++)S[C+L]=E.get(w+L);return R}return D.read=(T,S,C,q,w)=>(a.forceLoadFile(O),Q(T,S,C,q,w)),D.mmap=(T,S,C,q,w)=>{a.forceLoadFile(O);var E=wt(S);if(!E)throw new a.ErrnoError(48);return Q(T,ge,E,S,C),{ptr:E,allocated:!0}},O.stream_ops=D,O}},en=(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,Ee[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(),h=r.ctime.getTime();return Ee[n+40>>3]=BigInt(Math.floor(s/1e3)),he[n+48>>2]=s%1e3*1e3*1e3,Ee[n+56>>3]=BigInt(Math.floor(o/1e3)),he[n+64>>2]=o%1e3*1e3*1e3,Ee[n+72>>3]=BigInt(Math.floor(h/1e3)),he[n+80>>2]=h%1e3*1e3*1e3,Ee[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=en(e);return t}};function tn(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 nn(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 h="";return n&4&&(h+="r"),n&2&&(h+="w"),n&1&&(h+="x"),h&&a.nodePermissions(o,h)?-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 Ge(){var e=ce[+le.varargs>>2];return le.varargs+=4,e}var Ce=Ge;function on(e,t,n){le.varargs=n;try{var r=le.getStreamFromFD(e);switch(t){case 0:{var s=Ge();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=Ge();return r.flags|=s,0}case 12:{var s=Ce(),h=0;return Ne[s+h>>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=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 an=9007199254740992,cn=-9007199254740992,je=e=>e<cn||e>an?NaN:Number(e);function _n(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)=>rt(e,Pe,t,n);function un(e,t){try{if(t===0)return-28;var n=a.cwd(),r=Ve(n)+1;return t<r?-68:(De(n,e,t),r)}catch(s){if(typeof a>"u"||s.name!=="ErrnoError")throw s;return-s.errno}}function fn(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 h=0;h<32;h++)ge[o+h+17]=s.c_cc[h]||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],D=ce[o+8>>2],U=ce[o+12>>2],Q=[],h=0;h<32;h++)Q.push(ge[o+h+17]);return r.tty.ops.ioctl_tcsets(r.tty,t,{c_iflag:g,c_oflag:O,c_cflag:D,c_lflag:U,c_cc:Q})}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(S){if(typeof a>"u"||S.name!=="ErrnoError")throw S;return-S.errno}}function dn(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 pn(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 hn(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(h){if(typeof a>"u"||h.name!=="ErrnoError")throw h;return-h.errno}}function mn(e,t,n,r){le.varargs=r;try{t=le.getStr(t),t=le.calculateAt(e,t);var s=r?Ge():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=le.getStr(t),t=le.calculateAt(e,t),r<=0)return-28;var s=a.readlink(t),o=Math.min(r,Ve(s)),h=ge[n+o];return De(s,n,r+1),ge[n+o]=h,o}catch(g){if(typeof a>"u"||g.name!=="ErrnoError")throw g;return-g.errno}}function qn(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 bn(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 yn(e,t,n){try{return t=le.getStr(t),t=le.calculateAt(e,t),n===0?a.unlink(t):n===512?a.rmdir(t):et("Invalid flags passed to unlinkat"),0}catch(r){if(typeof a>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}var vt=e=>he[e>>2]+ce[e+4>>2]*4294967296;function wn(e,t,n,r){try{t=le.getStr(t),t=le.calculateAt(e,t,!0);var s=Date.now(),o,h;if(!n)o=s,h=s;else{var g=vt(n),O=ce[n+8>>2];O==1073741823?o=s:O==1073741822?o=-1:o=g*1e3+O/1e6,n+=16,g=vt(n),O=ce[n+8>>2],O==1073741823?h=s:O==1073741822?h=-1:h=g*1e3+O/1e6}return(h!=-1||o!=-1)&&a.utime(t,o,h),0}catch(D){if(typeof a>"u"||D.name!=="ErrnoError")throw D;return-D.errno}}var vn=1,En=()=>vn,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=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=In(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(),h=s.getTimezoneOffset(),g=(o!=h&&n.getTimezoneOffset()==Math.min(h,o))|0;ce[t+32>>2]=g}function Tn(e,t,n,r,s,o,h){s=je(s);try{if(isNaN(s))return 61;var g=le.getStreamFromFD(r),O=a.mmap(g,e,s,t,n),D=O.ptr;return ce[o>>2]=O.allocated,he[h>>2]=D,0}catch(U){if(typeof a>"u"||U.name!=="ErrnoError")throw U;return-U.errno}}function Fn(e,t,n,r,s,o){o=je(o);try{var h=le.getStreamFromFD(s);n&2&&le.doMsync(e,h,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),h=new Date(s,6,1),g=o.getTimezoneOffset(),O=h.getTimezoneOffset(),D=Math.max(g,O);he[e>>2]=D*60,ce[t>>2]=+(g!=O);var U=S=>{var C=S>=0?"-":"+",q=Math.abs(S),w=String(Math.floor(q/60)).padStart(2,"0"),E=String(q%60).padStart(2,"0");return`UTC${C}${w}${E}`},Q=U(g),T=U(O);O<g?(De(Q,n,17),De(T,r,17)):(De(Q,r,17),De(T,n,17))},Pn=()=>Date.now(),Et;Et=()=>performance.now();var Ln=()=>2147483648,Cn=e=>{var t=Te.buffer,n=(e-t.byteLength+65535)/65536;try{return Te.grow(n),_t(),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,yt(Math.max(e,s),65536)),h=Cn(o);if(h)return!0}return!1},it={},Rn=()=>at||"./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 it)it[n]===void 0?delete t[n]:t[n]=it[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<e.length;++n)ge[t++]=e.charCodeAt(n);ge[t]=0},Mn=(e,t)=>{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),h=o.tty?2:a.isDir(o.mode)?3:a.isLink(o.mode)?7:4;return ge[t]=h,Ne[t+2>>1]=s,Ee[t+8>>3]=BigInt(n),Ee[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<n;o++){var h=he[t>>2],g=he[t+4>>2];t+=8;var O=a.read(e,ge,h,g,r);if(O<0)return-1;if(s+=O,O<g)break}return s};function Wn(e,t,n,r){try{var s=le.getStreamFromFD(e),o=zn(s,t,n);return he[r>>2]=o,0}catch(h){if(typeof a>"u"||h.name!=="ErrnoError")throw h;return h.errno}}function Qn(e,t,n,r){t=je(t);try{if(isNaN(t))return 61;var s=le.getStreamFromFD(e);return a.llseek(s,t,n),Ee[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<n;o++){var h=he[t>>2],g=he[t+4>>2];t+=8;var O=a.write(e,ge,h,g,r);if(O<0)return-1;if(s+=O,O<g)break}return s};function Gn(e,t,n,r){try{var s=le.getStreamFromFD(e),o=Vn(s,t,n);return he[r>>2]=o,0}catch(h){if(typeof a>"u"||h.name!=="ErrnoError")throw h;return h.errno}}a.createPreloadedFile=Yt,a.staticInit();var xt={__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:En,_localtime_js:kn,_mmap_js:Tn,_munmap_js:Fn,_tzset_js:On,emscripten_date_now:Pn,emscripten_get_now:Et,emscripten_resize_heap:Dn,environ_get:Mn,environ_sizes_get:jn,fd_close:Bn,fd_fdstat_get:Un,fd_read:Wn,fd_seek:Qn,fd_sync:Hn,fd_write:Gn,memory:Te},m=Qt();i._sqlite3_status64=(e,t,n,r)=>(i._sqlite3_status64=m.sqlite3_status64)(e,t,n,r),i._sqlite3_status=(e,t,n,r)=>(i._sqlite3_status=m.sqlite3_status)(e,t,n,r),i._sqlite3_db_status=(e,t,n,r,s)=>(i._sqlite3_db_status=m.sqlite3_db_status)(e,t,n,r,s),i._sqlite3_msize=e=>(i._sqlite3_msize=m.sqlite3_msize)(e),i._sqlite3_vfs_find=e=>(i._sqlite3_vfs_find=m.sqlite3_vfs_find)(e),i._sqlite3_initialize=()=>(i._sqlite3_initialize=m.sqlite3_initialize)(),i._sqlite3_malloc=e=>(i._sqlite3_malloc=m.sqlite3_malloc)(e),i._sqlite3_free=e=>(i._sqlite3_free=m.sqlite3_free)(e),i._sqlite3_vfs_register=(e,t)=>(i._sqlite3_vfs_register=m.sqlite3_vfs_register)(e,t),i._sqlite3_vfs_unregister=e=>(i._sqlite3_vfs_unregister=m.sqlite3_vfs_unregister)(e),i._sqlite3_malloc64=e=>(i._sqlite3_malloc64=m.sqlite3_malloc64)(e),i._sqlite3_realloc=(e,t)=>(i._sqlite3_realloc=m.sqlite3_realloc)(e,t),i._sqlite3_realloc64=(e,t)=>(i._sqlite3_realloc64=m.sqlite3_realloc64)(e,t),i._sqlite3_value_text=e=>(i._sqlite3_value_text=m.sqlite3_value_text)(e),i._sqlite3_randomness=(e,t)=>(i._sqlite3_randomness=m.sqlite3_randomness)(e,t),i._sqlite3_stricmp=(e,t)=>(i._sqlite3_stricmp=m.sqlite3_stricmp)(e,t),i._sqlite3_strnicmp=(e,t,n)=>(i._sqlite3_strnicmp=m.sqlite3_strnicmp)(e,t,n),i._sqlite3_uri_parameter=(e,t)=>(i._sqlite3_uri_parameter=m.sqlite3_uri_parameter)(e,t),i._sqlite3_uri_boolean=(e,t,n)=>(i._sqlite3_uri_boolean=m.sqlite3_uri_boolean)(e,t,n),i._sqlite3_serialize=(e,t,n,r)=>(i._sqlite3_serialize=m.sqlite3_serialize)(e,t,n,r),i._sqlite3_prepare_v2=(e,t,n,r,s)=>(i._sqlite3_prepare_v2=m.sqlite3_prepare_v2)(e,t,n,r,s),i._sqlite3_step=e=>(i._sqlite3_step=m.sqlite3_step)(e),i._sqlite3_column_int64=(e,t)=>(i._sqlite3_column_int64=m.sqlite3_column_int64)(e,t),i._sqlite3_reset=e=>(i._sqlite3_reset=m.sqlite3_reset)(e),i._sqlite3_exec=(e,t,n,r,s)=>(i._sqlite3_exec=m.sqlite3_exec)(e,t,n,r,s),i._sqlite3_column_int=(e,t)=>(i._sqlite3_column_int=m.sqlite3_column_int)(e,t),i._sqlite3_finalize=e=>(i._sqlite3_finalize=m.sqlite3_finalize)(e),i._sqlite3_file_control=(e,t,n,r)=>(i._sqlite3_file_control=m.sqlite3_file_control)(e,t,n,r),i._sqlite3_column_name=(e,t)=>(i._sqlite3_column_name=m.sqlite3_column_name)(e,t),i._sqlite3_column_text=(e,t)=>(i._sqlite3_column_text=m.sqlite3_column_text)(e,t),i._sqlite3_column_type=(e,t)=>(i._sqlite3_column_type=m.sqlite3_column_type)(e,t),i._sqlite3_errmsg=e=>(i._sqlite3_errmsg=m.sqlite3_errmsg)(e),i._sqlite3_deserialize=(e,t,n,r,s,o)=>(i._sqlite3_deserialize=m.sqlite3_deserialize)(e,t,n,r,s,o),i._sqlite3_clear_bindings=e=>(i._sqlite3_clear_bindings=m.sqlite3_clear_bindings)(e),i._sqlite3_value_blob=e=>(i._sqlite3_value_blob=m.sqlite3_value_blob)(e),i._sqlite3_value_bytes=e=>(i._sqlite3_value_bytes=m.sqlite3_value_bytes)(e),i._sqlite3_value_double=e=>(i._sqlite3_value_double=m.sqlite3_value_double)(e),i._sqlite3_value_int=e=>(i._sqlite3_value_int=m.sqlite3_value_int)(e),i._sqlite3_value_int64=e=>(i._sqlite3_value_int64=m.sqlite3_value_int64)(e),i._sqlite3_value_subtype=e=>(i._sqlite3_value_subtype=m.sqlite3_value_subtype)(e),i._sqlite3_value_pointer=(e,t)=>(i._sqlite3_value_pointer=m.sqlite3_value_pointer)(e,t),i._sqlite3_value_type=e=>(i._sqlite3_value_type=m.sqlite3_value_type)(e),i._sqlite3_value_nochange=e=>(i._sqlite3_value_nochange=m.sqlite3_value_nochange)(e),i._sqlite3_value_frombind=e=>(i._sqlite3_value_frombind=m.sqlite3_value_frombind)(e),i._sqlite3_value_dup=e=>(i._sqlite3_value_dup=m.sqlite3_value_dup)(e),i._sqlite3_value_free=e=>(i._sqlite3_value_free=m.sqlite3_value_free)(e),i._sqlite3_result_blob=(e,t,n,r)=>(i._sqlite3_result_blob=m.sqlite3_result_blob)(e,t,n,r),i._sqlite3_result_error_toobig=e=>(i._sqlite3_result_error_toobig=m.sqlite3_result_error_toobig)(e),i._sqlite3_result_error_nomem=e=>(i._sqlite3_result_error_nomem=m.sqlite3_result_error_nomem)(e),i._sqlite3_result_double=(e,t)=>(i._sqlite3_result_double=m.sqlite3_result_double)(e,t),i._sqlite3_result_error=(e,t,n)=>(i._sqlite3_result_error=m.sqlite3_result_error)(e,t,n),i._sqlite3_result_int=(e,t)=>(i._sqlite3_result_int=m.sqlite3_result_int)(e,t),i._sqlite3_result_int64=(e,t)=>(i._sqlite3_result_int64=m.sqlite3_result_int64)(e,t),i._sqlite3_result_null=e=>(i._sqlite3_result_null=m.sqlite3_result_null)(e),i._sqlite3_result_pointer=(e,t,n,r)=>(i._sqlite3_result_pointer=m.sqlite3_result_pointer)(e,t,n,r),i._sqlite3_result_subtype=(e,t)=>(i._sqlite3_result_subtype=m.sqlite3_result_subtype)(e,t),i._sqlite3_result_text=(e,t,n,r)=>(i._sqlite3_result_text=m.sqlite3_result_text)(e,t,n,r),i._sqlite3_result_zeroblob=(e,t)=>(i._sqlite3_result_zeroblob=m.sqlite3_result_zeroblob)(e,t),i._sqlite3_result_zeroblob64=(e,t)=>(i._sqlite3_result_zeroblob64=m.sqlite3_result_zeroblob64)(e,t),i._sqlite3_result_error_code=(e,t)=>(i._sqlite3_result_error_code=m.sqlite3_result_error_code)(e,t),i._sqlite3_user_data=e=>(i._sqlite3_user_data=m.sqlite3_user_data)(e),i._sqlite3_context_db_handle=e=>(i._sqlite3_context_db_handle=m.sqlite3_context_db_handle)(e),i._sqlite3_vtab_nochange=e=>(i._sqlite3_vtab_nochange=m.sqlite3_vtab_nochange)(e),i._sqlite3_vtab_in_first=(e,t)=>(i._sqlite3_vtab_in_first=m.sqlite3_vtab_in_first)(e,t),i._sqlite3_vtab_in_next=(e,t)=>(i._sqlite3_vtab_in_next=m.sqlite3_vtab_in_next)(e,t),i._sqlite3_aggregate_context=(e,t)=>(i._sqlite3_aggregate_context=m.sqlite3_aggregate_context)(e,t),i._sqlite3_get_auxdata=(e,t)=>(i._sqlite3_get_auxdata=m.sqlite3_get_auxdata)(e,t),i._sqlite3_set_auxdata=(e,t,n,r)=>(i._sqlite3_set_auxdata=m.sqlite3_set_auxdata)(e,t,n,r),i._sqlite3_column_count=e=>(i._sqlite3_column_count=m.sqlite3_column_count)(e),i._sqlite3_data_count=e=>(i._sqlite3_data_count=m.sqlite3_data_count)(e),i._sqlite3_column_blob=(e,t)=>(i._sqlite3_column_blob=m.sqlite3_column_blob)(e,t),i._sqlite3_column_bytes=(e,t)=>(i._sqlite3_column_bytes=m.sqlite3_column_bytes)(e,t),i._sqlite3_column_double=(e,t)=>(i._sqlite3_column_double=m.sqlite3_column_double)(e,t),i._sqlite3_column_value=(e,t)=>(i._sqlite3_column_value=m.sqlite3_column_value)(e,t),i._sqlite3_column_decltype=(e,t)=>(i._sqlite3_column_decltype=m.sqlite3_column_decltype)(e,t),i._sqlite3_bind_blob=(e,t,n,r,s)=>(i._sqlite3_bind_blob=m.sqlite3_bind_blob)(e,t,n,r,s),i._sqlite3_bind_double=(e,t,n)=>(i._sqlite3_bind_double=m.sqlite3_bind_double)(e,t,n),i._sqlite3_bind_int=(e,t,n)=>(i._sqlite3_bind_int=m.sqlite3_bind_int)(e,t,n),i._sqlite3_bind_int64=(e,t,n)=>(i._sqlite3_bind_int64=m.sqlite3_bind_int64)(e,t,n),i._sqlite3_bind_null=(e,t)=>(i._sqlite3_bind_null=m.sqlite3_bind_null)(e,t),i._sqlite3_bind_pointer=(e,t,n,r,s)=>(i._sqlite3_bind_pointer=m.sqlite3_bind_pointer)(e,t,n,r,s),i._sqlite3_bind_text=(e,t,n,r,s)=>(i._sqlite3_bind_text=m.sqlite3_bind_text)(e,t,n,r,s),i._sqlite3_bind_parameter_count=e=>(i._sqlite3_bind_parameter_count=m.sqlite3_bind_parameter_count)(e),i._sqlite3_bind_parameter_name=(e,t)=>(i._sqlite3_bind_parameter_name=m.sqlite3_bind_parameter_name)(e,t),i._sqlite3_bind_parameter_index=(e,t)=>(i._sqlite3_bind_parameter_index=m.sqlite3_bind_parameter_index)(e,t),i._sqlite3_db_handle=e=>(i._sqlite3_db_handle=m.sqlite3_db_handle)(e),i._sqlite3_stmt_readonly=e=>(i._sqlite3_stmt_readonly=m.sqlite3_stmt_readonly)(e),i._sqlite3_stmt_isexplain=e=>(i._sqlite3_stmt_isexplain=m.sqlite3_stmt_isexplain)(e),i._sqlite3_stmt_explain=(e,t)=>(i._sqlite3_stmt_explain=m.sqlite3_stmt_explain)(e,t),i._sqlite3_stmt_busy=e=>(i._sqlite3_stmt_busy=m.sqlite3_stmt_busy)(e),i._sqlite3_stmt_status=(e,t,n)=>(i._sqlite3_stmt_status=m.sqlite3_stmt_status)(e,t,n),i._sqlite3_sql=e=>(i._sqlite3_sql=m.sqlite3_sql)(e),i._sqlite3_expanded_sql=e=>(i._sqlite3_expanded_sql=m.sqlite3_expanded_sql)(e),i._sqlite3_preupdate_old=(e,t,n)=>(i._sqlite3_preupdate_old=m.sqlite3_preupdate_old)(e,t,n),i._sqlite3_preupdate_count=e=>(i._sqlite3_preupdate_count=m.sqlite3_preupdate_count)(e),i._sqlite3_preupdate_depth=e=>(i._sqlite3_preupdate_depth=m.sqlite3_preupdate_depth)(e),i._sqlite3_preupdate_blobwrite=e=>(i._sqlite3_preupdate_blobwrite=m.sqlite3_preupdate_blobwrite)(e),i._sqlite3_preupdate_new=(e,t,n)=>(i._sqlite3_preupdate_new=m.sqlite3_preupdate_new)(e,t,n),i._sqlite3_value_numeric_type=e=>(i._sqlite3_value_numeric_type=m.sqlite3_value_numeric_type)(e),i._sqlite3_set_authorizer=(e,t,n)=>(i._sqlite3_set_authorizer=m.sqlite3_set_authorizer)(e,t,n),i._sqlite3_strglob=(e,t)=>(i._sqlite3_strglob=m.sqlite3_strglob)(e,t),i._sqlite3_strlike=(e,t,n)=>(i._sqlite3_strlike=m.sqlite3_strlike)(e,t,n),i._sqlite3_auto_extension=e=>(i._sqlite3_auto_extension=m.sqlite3_auto_extension)(e),i._sqlite3_cancel_auto_extension=e=>(i._sqlite3_cancel_auto_extension=m.sqlite3_cancel_auto_extension)(e),i._sqlite3_reset_auto_extension=()=>(i._sqlite3_reset_auto_extension=m.sqlite3_reset_auto_extension)(),i._sqlite3_prepare_v3=(e,t,n,r,s,o)=>(i._sqlite3_prepare_v3=m.sqlite3_prepare_v3)(e,t,n,r,s,o),i._sqlite3_create_module=(e,t,n,r)=>(i._sqlite3_create_module=m.sqlite3_create_module)(e,t,n,r),i._sqlite3_create_module_v2=(e,t,n,r,s)=>(i._sqlite3_create_module_v2=m.sqlite3_create_module_v2)(e,t,n,r,s),i._sqlite3_drop_modules=(e,t)=>(i._sqlite3_drop_modules=m.sqlite3_drop_modules)(e,t),i._sqlite3_declare_vtab=(e,t)=>(i._sqlite3_declare_vtab=m.sqlite3_declare_vtab)(e,t),i._sqlite3_vtab_on_conflict=e=>(i._sqlite3_vtab_on_conflict=m.sqlite3_vtab_on_conflict)(e),i._sqlite3_vtab_collation=(e,t)=>(i._sqlite3_vtab_collation=m.sqlite3_vtab_collation)(e,t),i._sqlite3_vtab_in=(e,t,n)=>(i._sqlite3_vtab_in=m.sqlite3_vtab_in)(e,t,n),i._sqlite3_vtab_rhs_value=(e,t,n)=>(i._sqlite3_vtab_rhs_value=m.sqlite3_vtab_rhs_value)(e,t,n),i._sqlite3_vtab_distinct=e=>(i._sqlite3_vtab_distinct=m.sqlite3_vtab_distinct)(e),i._sqlite3_keyword_name=(e,t,n)=>(i._sqlite3_keyword_name=m.sqlite3_keyword_name)(e,t,n),i._sqlite3_keyword_count=()=>(i._sqlite3_keyword_count=m.sqlite3_keyword_count)(),i._sqlite3_keyword_check=(e,t)=>(i._sqlite3_keyword_check=m.sqlite3_keyword_check)(e,t),i._sqlite3_complete=e=>(i._sqlite3_complete=m.sqlite3_complete)(e),i._sqlite3_libversion=()=>(i._sqlite3_libversion=m.sqlite3_libversion)(),i._sqlite3_libversion_number=()=>(i._sqlite3_libversion_number=m.sqlite3_libversion_number)(),i._sqlite3_shutdown=()=>(i._sqlite3_shutdown=m.sqlite3_shutdown)(),i._sqlite3_last_insert_rowid=e=>(i._sqlite3_last_insert_rowid=m.sqlite3_last_insert_rowid)(e),i._sqlite3_set_last_insert_rowid=(e,t)=>(i._sqlite3_set_last_insert_rowid=m.sqlite3_set_last_insert_rowid)(e,t),i._sqlite3_changes64=e=>(i._sqlite3_changes64=m.sqlite3_changes64)(e),i._sqlite3_changes=e=>(i._sqlite3_changes=m.sqlite3_changes)(e),i._sqlite3_total_changes64=e=>(i._sqlite3_total_changes64=m.sqlite3_total_changes64)(e),i._sqlite3_total_changes=e=>(i._sqlite3_total_changes=m.sqlite3_total_changes)(e),i._sqlite3_txn_state=(e,t)=>(i._sqlite3_txn_state=m.sqlite3_txn_state)(e,t),i._sqlite3_close_v2=e=>(i._sqlite3_close_v2=m.sqlite3_close_v2)(e),i._sqlite3_busy_handler=(e,t,n)=>(i._sqlite3_busy_handler=m.sqlite3_busy_handler)(e,t,n),i._sqlite3_progress_handler=(e,t,n,r)=>(i._sqlite3_progress_handler=m.sqlite3_progress_handler)(e,t,n,r),i._sqlite3_busy_timeout=(e,t)=>(i._sqlite3_busy_timeout=m.sqlite3_busy_timeout)(e,t),i._sqlite3_interrupt=e=>(i._sqlite3_interrupt=m.sqlite3_interrupt)(e),i._sqlite3_is_interrupted=e=>(i._sqlite3_is_interrupted=m.sqlite3_is_interrupted)(e),i._sqlite3_create_function=(e,t,n,r,s,o,h,g)=>(i._sqlite3_create_function=m.sqlite3_create_function)(e,t,n,r,s,o,h,g),i._sqlite3_create_function_v2=(e,t,n,r,s,o,h,g,O)=>(i._sqlite3_create_function_v2=m.sqlite3_create_function_v2)(e,t,n,r,s,o,h,g,O),i._sqlite3_create_window_function=(e,t,n,r,s,o,h,g,O,D)=>(i._sqlite3_create_window_function=m.sqlite3_create_window_function)(e,t,n,r,s,o,h,g,O,D),i._sqlite3_overload_function=(e,t,n)=>(i._sqlite3_overload_function=m.sqlite3_overload_function)(e,t,n),i._sqlite3_trace_v2=(e,t,n,r)=>(i._sqlite3_trace_v2=m.sqlite3_trace_v2)(e,t,n,r),i._sqlite3_commit_hook=(e,t,n)=>(i._sqlite3_commit_hook=m.sqlite3_commit_hook)(e,t,n),i._sqlite3_update_hook=(e,t,n)=>(i._sqlite3_update_hook=m.sqlite3_update_hook)(e,t,n),i._sqlite3_rollback_hook=(e,t,n)=>(i._sqlite3_rollback_hook=m.sqlite3_rollback_hook)(e,t,n),i._sqlite3_preupdate_hook=(e,t,n)=>(i._sqlite3_preupdate_hook=m.sqlite3_preupdate_hook)(e,t,n),i._sqlite3_error_offset=e=>(i._sqlite3_error_offset=m.sqlite3_error_offset)(e),i._sqlite3_errcode=e=>(i._sqlite3_errcode=m.sqlite3_errcode)(e),i._sqlite3_extended_errcode=e=>(i._sqlite3_extended_errcode=m.sqlite3_extended_errcode)(e),i._sqlite3_errstr=e=>(i._sqlite3_errstr=m.sqlite3_errstr)(e),i._sqlite3_limit=(e,t,n)=>(i._sqlite3_limit=m.sqlite3_limit)(e,t,n),i._sqlite3_open=(e,t)=>(i._sqlite3_open=m.sqlite3_open)(e,t),i._sqlite3_open_v2=(e,t,n,r)=>(i._sqlite3_open_v2=m.sqlite3_open_v2)(e,t,n,r),i._sqlite3_create_collation=(e,t,n,r,s)=>(i._sqlite3_create_collation=m.sqlite3_create_collation)(e,t,n,r,s),i._sqlite3_create_collation_v2=(e,t,n,r,s,o)=>(i._sqlite3_create_collation_v2=m.sqlite3_create_collation_v2)(e,t,n,r,s,o),i._sqlite3_collation_needed=(e,t,n)=>(i._sqlite3_collation_needed=m.sqlite3_collation_needed)(e,t,n),i._sqlite3_get_autocommit=e=>(i._sqlite3_get_autocommit=m.sqlite3_get_autocommit)(e),i._sqlite3_table_column_metadata=(e,t,n,r,s,o,h,g,O)=>(i._sqlite3_table_column_metadata=m.sqlite3_table_column_metadata)(e,t,n,r,s,o,h,g,O),i._sqlite3_extended_result_codes=(e,t)=>(i._sqlite3_extended_result_codes=m.sqlite3_extended_result_codes)(e,t),i._sqlite3_uri_key=(e,t)=>(i._sqlite3_uri_key=m.sqlite3_uri_key)(e,t),i._sqlite3_uri_int64=(e,t,n)=>(i._sqlite3_uri_int64=m.sqlite3_uri_int64)(e,t,n),i._sqlite3_db_name=(e,t)=>(i._sqlite3_db_name=m.sqlite3_db_name)(e,t),i._sqlite3_db_filename=(e,t)=>(i._sqlite3_db_filename=m.sqlite3_db_filename)(e,t),i._sqlite3_db_readonly=(e,t)=>(i._sqlite3_db_readonly=m.sqlite3_db_readonly)(e,t),i._sqlite3_compileoption_used=e=>(i._sqlite3_compileoption_used=m.sqlite3_compileoption_used)(e),i._sqlite3_compileoption_get=e=>(i._sqlite3_compileoption_get=m.sqlite3_compileoption_get)(e),i._sqlite3session_diff=(e,t,n,r)=>(i._sqlite3session_diff=m.sqlite3session_diff)(e,t,n,r),i._sqlite3session_attach=(e,t)=>(i._sqlite3session_attach=m.sqlite3session_attach)(e,t),i._sqlite3session_create=(e,t,n)=>(i._sqlite3session_create=m.sqlite3session_create)(e,t,n),i._sqlite3session_delete=e=>(i._sqlite3session_delete=m.sqlite3session_delete)(e),i._sqlite3session_table_filter=(e,t,n)=>(i._sqlite3session_table_filter=m.sqlite3session_table_filter)(e,t,n),i._sqlite3session_changeset=(e,t,n)=>(i._sqlite3session_changeset=m.sqlite3session_changeset)(e,t,n),i._sqlite3session_changeset_strm=(e,t,n)=>(i._sqlite3session_changeset_strm=m.sqlite3session_changeset_strm)(e,t,n),i._sqlite3session_patchset_strm=(e,t,n)=>(i._sqlite3session_patchset_strm=m.sqlite3session_patchset_strm)(e,t,n),i._sqlite3session_patchset=(e,t,n)=>(i._sqlite3session_patchset=m.sqlite3session_patchset)(e,t,n),i._sqlite3session_enable=(e,t)=>(i._sqlite3session_enable=m.sqlite3session_enable)(e,t),i._sqlite3session_indirect=(e,t)=>(i._sqlite3session_indirect=m.sqlite3session_indirect)(e,t),i._sqlite3session_isempty=e=>(i._sqlite3session_isempty=m.sqlite3session_isempty)(e),i._sqlite3session_memory_used=e=>(i._sqlite3session_memory_used=m.sqlite3session_memory_used)(e),i._sqlite3session_object_config=(e,t,n)=>(i._sqlite3session_object_config=m.sqlite3session_object_config)(e,t,n),i._sqlite3session_changeset_size=e=>(i._sqlite3session_changeset_size=m.sqlite3session_changeset_size)(e),i._sqlite3changeset_start=(e,t,n)=>(i._sqlite3changeset_start=m.sqlite3changeset_start)(e,t,n),i._sqlite3changeset_start_v2=(e,t,n,r)=>(i._sqlite3changeset_start_v2=m.sqlite3changeset_start_v2)(e,t,n,r),i._sqlite3changeset_start_strm=(e,t,n)=>(i._sqlite3changeset_start_strm=m.sqlite3changeset_start_strm)(e,t,n),i._sqlite3changeset_start_v2_strm=(e,t,n,r)=>(i._sqlite3changeset_start_v2_strm=m.sqlite3changeset_start_v2_strm)(e,t,n,r),i._sqlite3changeset_next=e=>(i._sqlite3changeset_next=m.sqlite3changeset_next)(e),i._sqlite3changeset_op=(e,t,n,r,s)=>(i._sqlite3changeset_op=m.sqlite3changeset_op)(e,t,n,r,s),i._sqlite3changeset_pk=(e,t,n)=>(i._sqlite3changeset_pk=m.sqlite3changeset_pk)(e,t,n),i._sqlite3changeset_old=(e,t,n)=>(i._sqlite3changeset_old=m.sqlite3changeset_old)(e,t,n),i._sqlite3changeset_new=(e,t,n)=>(i._sqlite3changeset_new=m.sqlite3changeset_new)(e,t,n),i._sqlite3changeset_conflict=(e,t,n)=>(i._sqlite3changeset_conflict=m.sqlite3changeset_conflict)(e,t,n),i._sqlite3changeset_fk_conflicts=(e,t)=>(i._sqlite3changeset_fk_conflicts=m.sqlite3changeset_fk_conflicts)(e,t),i._sqlite3changeset_finalize=e=>(i._sqlite3changeset_finalize=m.sqlite3changeset_finalize)(e),i._sqlite3changeset_invert=(e,t,n,r)=>(i._sqlite3changeset_invert=m.sqlite3changeset_invert)(e,t,n,r),i._sqlite3changeset_invert_strm=(e,t,n,r)=>(i._sqlite3changeset_invert_strm=m.sqlite3changeset_invert_strm)(e,t,n,r),i._sqlite3changeset_apply_v2=(e,t,n,r,s,o,h,g,O)=>(i._sqlite3changeset_apply_v2=m.sqlite3changeset_apply_v2)(e,t,n,r,s,o,h,g,O),i._sqlite3changeset_apply=(e,t,n,r,s,o)=>(i._sqlite3changeset_apply=m.sqlite3changeset_apply)(e,t,n,r,s,o),i._sqlite3changeset_apply_v2_strm=(e,t,n,r,s,o,h,g,O)=>(i._sqlite3changeset_apply_v2_strm=m.sqlite3changeset_apply_v2_strm)(e,t,n,r,s,o,h,g,O),i._sqlite3changeset_apply_strm=(e,t,n,r,s,o)=>(i._sqlite3changeset_apply_strm=m.sqlite3changeset_apply_strm)(e,t,n,r,s,o),i._sqlite3changegroup_new=e=>(i._sqlite3changegroup_new=m.sqlite3changegroup_new)(e),i._sqlite3changegroup_add=(e,t,n)=>(i._sqlite3changegroup_add=m.sqlite3changegroup_add)(e,t,n),i._sqlite3changegroup_output=(e,t,n)=>(i._sqlite3changegroup_output=m.sqlite3changegroup_output)(e,t,n),i._sqlite3changegroup_add_strm=(e,t,n)=>(i._sqlite3changegroup_add_strm=m.sqlite3changegroup_add_strm)(e,t,n),i._sqlite3changegroup_output_strm=(e,t,n)=>(i._sqlite3changegroup_output_strm=m.sqlite3changegroup_output_strm)(e,t,n),i._sqlite3changegroup_delete=e=>(i._sqlite3changegroup_delete=m.sqlite3changegroup_delete)(e),i._sqlite3changeset_concat=(e,t,n,r,s,o)=>(i._sqlite3changeset_concat=m.sqlite3changeset_concat)(e,t,n,r,s,o),i._sqlite3changeset_concat_strm=(e,t,n,r,s,o)=>(i._sqlite3changeset_concat_strm=m.sqlite3changeset_concat_strm)(e,t,n,r,s,o),i._sqlite3session_config=(e,t)=>(i._sqlite3session_config=m.sqlite3session_config)(e,t),i._sqlite3_sourceid=()=>(i._sqlite3_sourceid=m.sqlite3_sourceid)(),i._sqlite3__wasm_pstack_ptr=()=>(i._sqlite3__wasm_pstack_ptr=m.sqlite3__wasm_pstack_ptr)(),i._sqlite3__wasm_pstack_restore=e=>(i._sqlite3__wasm_pstack_restore=m.sqlite3__wasm_pstack_restore)(e),i._sqlite3__wasm_pstack_alloc=e=>(i._sqlite3__wasm_pstack_alloc=m.sqlite3__wasm_pstack_alloc)(e),i._sqlite3__wasm_pstack_remaining=()=>(i._sqlite3__wasm_pstack_remaining=m.sqlite3__wasm_pstack_remaining)(),i._sqlite3__wasm_pstack_quota=()=>(i._sqlite3__wasm_pstack_quota=m.sqlite3__wasm_pstack_quota)(),i._sqlite3__wasm_db_error=(e,t,n)=>(i._sqlite3__wasm_db_error=m.sqlite3__wasm_db_error)(e,t,n),i._sqlite3__wasm_test_struct=e=>(i._sqlite3__wasm_test_struct=m.sqlite3__wasm_test_struct)(e),i._sqlite3__wasm_enum_json=()=>(i._sqlite3__wasm_enum_json=m.sqlite3__wasm_enum_json)(),i._sqlite3__wasm_vfs_unlink=(e,t)=>(i._sqlite3__wasm_vfs_unlink=m.sqlite3__wasm_vfs_unlink)(e,t),i._sqlite3__wasm_db_vfs=(e,t)=>(i._sqlite3__wasm_db_vfs=m.sqlite3__wasm_db_vfs)(e,t),i._sqlite3__wasm_db_reset=e=>(i._sqlite3__wasm_db_reset=m.sqlite3__wasm_db_reset)(e),i._sqlite3__wasm_db_export_chunked=(e,t)=>(i._sqlite3__wasm_db_export_chunked=m.sqlite3__wasm_db_export_chunked)(e,t),i._sqlite3__wasm_db_serialize=(e,t,n,r,s)=>(i._sqlite3__wasm_db_serialize=m.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=m.sqlite3__wasm_vfs_create_file)(e,t,n,r),i._sqlite3__wasm_posix_create_file=(e,t,n)=>(i._sqlite3__wasm_posix_create_file=m.sqlite3__wasm_posix_create_file)(e,t,n),i._sqlite3__wasm_kvvfsMakeKeyOnPstack=(e,t)=>(i._sqlite3__wasm_kvvfsMakeKeyOnPstack=m.sqlite3__wasm_kvvfsMakeKeyOnPstack)(e,t),i._sqlite3__wasm_kvvfs_methods=()=>(i._sqlite3__wasm_kvvfs_methods=m.sqlite3__wasm_kvvfs_methods)(),i._sqlite3__wasm_vtab_config=(e,t,n)=>(i._sqlite3__wasm_vtab_config=m.sqlite3__wasm_vtab_config)(e,t,n),i._sqlite3__wasm_db_config_ip=(e,t,n,r)=>(i._sqlite3__wasm_db_config_ip=m.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=m.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=m.sqlite3__wasm_db_config_s)(e,t,n),i._sqlite3__wasm_config_i=(e,t)=>(i._sqlite3__wasm_config_i=m.sqlite3__wasm_config_i)(e,t),i._sqlite3__wasm_config_ii=(e,t,n)=>(i._sqlite3__wasm_config_ii=m.sqlite3__wasm_config_ii)(e,t,n),i._sqlite3__wasm_config_j=(e,t)=>(i._sqlite3__wasm_config_j=m.sqlite3__wasm_config_j)(e,t),i._sqlite3__wasm_qfmt_token=(e,t)=>(i._sqlite3__wasm_qfmt_token=m.sqlite3__wasm_qfmt_token)(e,t),i._sqlite3__wasm_init_wasmfs=e=>(i._sqlite3__wasm_init_wasmfs=m.sqlite3__wasm_init_wasmfs)(e),i._sqlite3__wasm_test_intptr=e=>(i._sqlite3__wasm_test_intptr=m.sqlite3__wasm_test_intptr)(e),i._sqlite3__wasm_test_voidptr=e=>(i._sqlite3__wasm_test_voidptr=m.sqlite3__wasm_test_voidptr)(e),i._sqlite3__wasm_test_int64_max=()=>(i._sqlite3__wasm_test_int64_max=m.sqlite3__wasm_test_int64_max)(),i._sqlite3__wasm_test_int64_min=()=>(i._sqlite3__wasm_test_int64_min=m.sqlite3__wasm_test_int64_min)(),i._sqlite3__wasm_test_int64_times2=e=>(i._sqlite3__wasm_test_int64_times2=m.sqlite3__wasm_test_int64_times2)(e),i._sqlite3__wasm_test_int64_minmax=(e,t)=>(i._sqlite3__wasm_test_int64_minmax=m.sqlite3__wasm_test_int64_minmax)(e,t),i._sqlite3__wasm_test_int64ptr=e=>(i._sqlite3__wasm_test_int64ptr=m.sqlite3__wasm_test_int64ptr)(e),i._sqlite3__wasm_test_stack_overflow=e=>(i._sqlite3__wasm_test_stack_overflow=m.sqlite3__wasm_test_stack_overflow)(e),i._sqlite3__wasm_test_str_hello=e=>(i._sqlite3__wasm_test_str_hello=m.sqlite3__wasm_test_str_hello)(e),i._sqlite3__wasm_SQLTester_strglob=(e,t)=>(i._sqlite3__wasm_SQLTester_strglob=m.sqlite3__wasm_SQLTester_strglob)(e,t),i._malloc=e=>(i._malloc=m.malloc)(e),i._free=e=>(i._free=m.free)(e),i._realloc=(e,t)=>(i._realloc=m.realloc)(e,t);var St=(e,t)=>(St=m.emscripten_builtin_memalign)(e,t);i.wasmMemory=Te;var $e;Me=function e(){$e||At(),$e||(Me=e)};function At(){if(Fe>0||(Lt(),Fe>0))return;function e(){$e||($e=!0,i.calledRun=!0,!ct&&(Ct(),ke(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 At(),i.postRun||(i.postRun=[]),i.postRun.push(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 e<"u"&&e.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),h=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(h(_[0]));else{const k=h(u);typeof _[1]=="object"?super(k,_[1]):(_[0]=k+":",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 D=O.toss;r.wasmfsOpfsDir&&!/^\/[^/]+$/.test(r.wasmfsOpfsDir)&&D("config.wasmfsOpfsDir must be falsy or in the form '/dir-name'.");const U=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,S=function l(_){return l._min||(l._min=Number.MIN_SAFE_INTEGER,l._max=Number.MAX_SAFE_INTEGER),_>=l._min&&_<=l._max},C=l=>l&&l.constructor&&U(l.constructor.BYTES_PER_ELEMENT)?l:!1,q=typeof SharedArrayBuffer>"u"?function(){}:SharedArrayBuffer,w=l=>l.buffer instanceof q,E=(l,_,u)=>w(l)?l.slice(_,u):l.subarray(_,u),R=l=>l&&(l instanceof Uint8Array||l instanceof Int8Array||l instanceof ArrayBuffer),L=l=>l&&(l instanceof Uint8Array||l instanceof Int8Array||l instanceof ArrayBuffer),x=l=>R(l)||D("Value is not of a supported TypedArray type."),P=new TextDecoder("utf-8"),K=function(l,_,u){return P.decode(E(l,_,u))},c=function(l){return L(l)?K(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,k,z,Z,ne,se,M)=>{},sqlite3_create_function:(l,_,u,k,z,Z,ne,se)=>{},sqlite3_create_window_function:(l,_,u,k,z,Z,ne,se,M,b)=>{},sqlite3_prepare_v3:(l,_,u,k,z,Z)=>{},sqlite3_prepare_v2:(l,_,u,k,z)=>{},sqlite3_exec:(l,_,u,k,z)=>{},sqlite3_randomness:(l,_)=>{}});const y={affirmBindableTypedArray:x,flexibleString:c,bigIntFits32:T,bigIntFits64:Q,bigIntFitsDouble:S,isBindableTypedArray:R,isInt32:U,isSQLableTypedArray:L,isTypedArray:C,typedArrayToString:K,isUIThread:()=>globalThis.window===globalThis&&!!globalThis.document,isSharedTypedArray:w,toss:function(...l){throw new Error(l.join(" "))},toss3:D,typedArrayPart:E,affirmDbHeader:function(l){l instanceof ArrayBuffer&&(l=new Uint8Array(l));const _="SQLite format 3";_.length>l.byteLength&&D("Input does not contain an SQLite3 database header.");for(let u=0;u<_.length;++u)_.charCodeAt(u)!==l[u]&&D("Input does not contain an SQLite3 database header.")},affirmIsDb:function(l){l instanceof ArrayBuffer&&(l=new Uint8Array(l));const _=l.byteLength;(_<512||_%512!==0)&&D("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||D("Missing API config.exports (WASM module exports)."),memory:r.memory||r.exports.memory||D("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)),x(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 k of[l,_,u])o.exports[k]instanceof Function||D("Missing required exports[",k,"] function.");o.alloc=function k(z){return k.impl(z)||d.toss("Failed to allocate",z," bytes.")},o.alloc.impl=o.exports[l],o.realloc=function k(z,Z){const ne=k.impl(z,Z);return Z?ne||d.toss("Failed to reallocate",Z," 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(k=>{u[k]=s.sqlite3_compileoption_used(k)}),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 M=l._rx.exec(ne);se[0]=M?M[1]:ne,se[1]=M?l._rxInt.test(M[2])?+M[2]:M[2]:!0});const u={},k=[0,0];let z=0,Z;for(;Z=s.sqlite3_compileoption_get(z++);)l._opt(Z,k),u[k[0]]=k[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*_),k=[];let z=0,Z=0;for(;z<l;++z,Z+=_)k.push(u+Z);return k},allocPtr:(l=1,_=!0)=>l===1?o.pstack.alloc(_?8:o.ptrSizeof):o.pstack.allocChunks(l,_?8:o.ptrSizeof),call:function(l){const _=o.pstack.pointer;try{return l(p)}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 k=_.byteLength,z=0;const Z=o.exports.sqlite3_randomness,ne=o.heap8u(),se=k<512?k:512,M=o.pstack.alloc(se);do{const b=k>se?se:k;Z(b,M),_.set(E(ne,M,M+b),z),k-=b,z+=b}while(k>0)}catch(k){console.error("Highly unexpected (and ignored!) exception in sqlite3_randomness():",k)}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 k=s.sqlite3_vfs_find(_);return k?l?k===s.sqlite3_js_db_vfs(l,u)?k:!1:k===s.sqlite3_vfs_find(0)?k:!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||D("Invalid sqlite3* argument."),o.bigIntEnabled||D("BigInt64 support is not enabled.");const u=o.scopedAllocPush();let k;try{const z=o.scopedAlloc(8+o.ptrSizeof),Z=z+8,ne=_?o.isPtr(_)?_:o.scopedAllocCString(""+_):0;let se=o.exports.sqlite3__wasm_db_serialize(l,ne,Z,z,0);se&&D("Database serialization failed with code",p.capi.sqlite3_js_rc_str(se)),k=o.peekPtr(Z);const M=o.peek(z,"i64");return se=M?o.heap8u().slice(k,k+Number(M)):new Uint8Array,se}finally{k&&o.exports.sqlite3_free(k),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 k;_&&o.isPtr(_)?k=_:_ instanceof ArrayBuffer||_ instanceof Uint8Array?(k=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 z=y.sqlite3__wasm_posix_create_file(l,k,u);z&&O.toss("Creation of file failed with sqlite3 result code",s.sqlite3_js_rc_str(z))}finally{o.dealloc(k)}},s.sqlite3_js_vfs_create_file=function(l,_,u,k){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 z;u?(o.isPtr(u)?z=u:u instanceof ArrayBuffer&&(u=new Uint8Array(u)),u instanceof Uint8Array?(z=o.allocFromTypedArray(u),(arguments.length<4||!y.isInt32(k)||k<0)&&(k=u.byteLength)):O.toss("Invalid 3rd argument type for sqlite3_js_vfs_create_file().")):z=0,(!y.isInt32(k)||k<0)&&(o.dealloc(z),O.toss("Invalid 4th argument for sqlite3_js_vfs_create_file()."));try{const Z=y.sqlite3__wasm_vfs_create_file(l,_,z,k);Z&&O.toss("Creation of file failed with sqlite3 result code",s.sqlite3_js_rc_str(Z))}finally{o.dealloc(z)}},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 k=l(_);return k.stores.forEach(z=>{const Z=[];let ne;for(ne=0;ne<z.length;++ne){const se=z.key(ne);se.startsWith(k.prefix)&&Z.push(se)}Z.forEach(se=>z.removeItem(se)),u+=Z.length}),u},s.sqlite3_js_kvvfs_size=function(_=""){let u=0;const k=l(_);return k.stores.forEach(z=>{let Z;for(Z=0;Z<z.length;++Z){const ne=z.key(Z);ne.startsWith(k.prefix)&&(u+=ne.length,u+=z.getItem(ne).length)}}),u*2}}s.sqlite3_db_config=function(l,_,...u){switch(this.s||(this.s=o.xWrap("sqlite3__wasm_db_config_s","int",["sqlite3*","int","string:static"]),this.pii=o.xWrap("sqlite3__wasm_db_config_pii","int",["sqlite3*","int","*","int","int"]),this.ip=o.xWrap("sqlite3__wasm_db_config_ip","int",["sqlite3*","int","int","*"])),_){case s.SQLITE_DBCONFIG_ENABLE_FKEY:case s.SQLITE_DBCONFIG_ENABLE_TRIGGER:case s.SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER:case s.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION:case s.SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE:case s.SQLITE_DBCONFIG_ENABLE_QPSG:case s.SQLITE_DBCONFIG_TRIGGER_EQP:case s.SQLITE_DBCONFIG_RESET_DATABASE:case s.SQLITE_DBCONFIG_DEFENSIVE:case s.SQLITE_DBCONFIG_WRITABLE_SCHEMA:case s.SQLITE_DBCONFIG_LEGACY_ALTER_TABLE:case s.SQLITE_DBCONFIG_DQS_DML:case s.SQLITE_DBCONFIG_DQS_DDL:case s.SQLITE_DBCONFIG_ENABLE_VIEW:case s.SQLITE_DBCONFIG_LEGACY_FILE_FORMAT:case s.SQLITE_DBCONFIG_TRUSTED_SCHEMA:case s.SQLITE_DBCONFIG_STMT_SCANSTATUS:case s.SQLITE_DBCONFIG_REVERSE_SCANORDER:return this.ip(l,_,u[0],u[1]||0);case s.SQLITE_DBCONFIG_LOOKASIDE:return this.pii(l,_,u[0],u[1],u[2]);case s.SQLITE_DBCONFIG_MAINDBNAME:return this.s(l,_,u[0]);default:return s.SQLITE_MISUSE}}.bind(Object.create(null)),s.sqlite3_value_to_js=function(l,_=!0){let u;const k=s.sqlite3_value_type(l);switch(k){case s.SQLITE_INTEGER:o.bigIntEnabled?(u=s.sqlite3_value_int64(l),y.bigIntFitsDouble(u)&&(u=Number(u))):u=s.sqlite3_value_double(l);break;case s.SQLITE_FLOAT:u=s.sqlite3_value_double(l);break;case s.SQLITE_TEXT:u=s.sqlite3_value_text(l);break;case s.SQLITE_BLOB:{const z=s.sqlite3_value_bytes(l),Z=s.sqlite3_value_blob(l);z&&!Z&&p.WasmAllocError.toss("Cannot allocate memory for blob argument of",z,"byte(s)"),u=z?o.heap8u().slice(Z,Z+Number(z)):null;break}case s.SQLITE_NULL:u=null;break;default:_&&D(s.SQLITE_MISMATCH,"Unhandled sqlite3_value_type():",k),u=void 0}return u},s.sqlite3_values_to_js=function(l,_,u=!0){let k;const z=[];for(k=0;k<l;++k)z.push(s.sqlite3_value_to_js(o.peekPtr(_+o.ptrSizeof*k),u));return z},s.sqlite3_result_error_js=function(l,_){_ instanceof d?s.sqlite3_result_error_nomem(l):s.sqlite3_result_error(l,""+_,-1)},s.sqlite3_result_js=function(l,_){if(_ instanceof Error){s.sqlite3_result_error_js(l,_);return}try{switch(typeof _){case"undefined":break;case"boolean":s.sqlite3_result_int(l,_?1:0);break;case"bigint":y.bigIntFits32(_)?s.sqlite3_result_int(l,Number(_)):y.bigIntFitsDouble(_)?s.sqlite3_result_double(l,Number(_)):o.bigIntEnabled?y.bigIntFits64(_)?s.sqlite3_result_int64(l,_):D("BigInt value",_.toString(),"is too BigInt for int64."):D("BigInt value",_.toString(),"is too BigInt.");break;case"number":{let u;y.isInt32(_)?u=s.sqlite3_result_int:o.bigIntEnabled&&Number.isInteger(_)&&y.bigIntFits64(BigInt(_))?u=s.sqlite3_result_int64:u=s.sqlite3_result_double,u(l,_);break}case"string":{const[u,k]=o.allocCString(_,!0);s.sqlite3_result_text(l,u,k,s.SQLITE_WASM_DEALLOC);break}case"object":if(_===null){s.sqlite3_result_null(l);break}else if(y.isBindableTypedArray(_)){const u=o.allocFromTypedArray(_);s.sqlite3_result_blob(l,u,_.byteLength,s.SQLITE_WASM_DEALLOC);break}default:D("Don't not how to handle this UDF result value:",typeof _,_)}}catch(u){s.sqlite3_result_error_js(l,u)}},s.sqlite3_column_js=function(l,_,u=!0){const k=s.sqlite3_column_value(l,_);return k===0?void 0:s.sqlite3_value_to_js(k,u)};const f=function(l,_,u){u=s[u],this.ptr?o.pokePtr(this.ptr,0):this.ptr=o.allocPtr();const k=u(l,_,this.ptr);if(k)return O.toss(k,arguments[2]+"() failed with code "+k);const z=o.peekPtr(this.ptr);return z?s.sqlite3_value_to_js(z,!0):void 0}.bind(Object.create(null));s.sqlite3_preupdate_new_js=(l,_)=>f(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 p={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()=>(p.__isUnderTest||(delete p.util,delete p.StructBinder),p),k=Z=>{throw r.error("an async sqlite3 initializer failed:",Z),Z};if(!_||!_.length)return l.isReady=u().catch(k);_=_.map(Z=>Z instanceof Function?async ne=>Z(p):Z),_.push(u);let z=Promise.resolve(p);for(;_.length;)z=z.then(_.shift());return l.isReady=z.catch(k)},scriptInfo:void 0};try{t.initializers.forEach(l=>{l(p)})}catch(l){throw console.error("sqlite3 bootstrap initializer threw:",l),l}return delete t.initializers,t.sqlite3=p,p},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 h=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=()=>h().HEAP8,t.heap8u=()=>h().HEAP8U,t.heap16=()=>h().HEAP16,t.heap16u=()=>h().HEAP16U,t.heap32=()=>h().HEAP32,t.heap32u=()=>h().HEAP32U,t.heapForSize=function(c,d=!0){const y=o.memory&&o.heapSize===o.memory.buffer.byteLength?o:h();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<d.length?d.get(c):void 0},t.jsFuncToWasm=function c(d,y){if(c._||(c._={sigTypes:Object.assign(Object.create(null),{i:"i32",p:"i32",P:"i32",s:"i32",j:"i64",f:"f32",d:"f64"}),typeCodes:Object.assign(Object.create(null),{f64:124,f32:125,i64:126,i32:127}),uleb128Encode:function(p,l,_){_<128?p[l](_):p[l](_%128|128,_>>7)},rxJSig:/^(\w)\((\w*)\)$/,sigParams:function(p){const l=c._.rxJSig.exec(p);return l?l[2]:p.substr(1)},letterType:p=>c._.sigTypes[p]||n("Invalid signature letter:",p),pushSigType:(p,l)=>p.push(c._.typeCodes[c._.letterType(l)])}),typeof d=="string"){const p=y;y=d,d=p}const B=c._.sigParams(y),f=[1,96];c._.uleb128Encode(f,"push",B.length);for(const p of B)c._.pushSigType(f,p);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(),p=f.length;let l;for(;o.freeFuncIndexes.length&&(l=o.freeFuncIndexes.pop(),f.get(l));){l=null;continue}l||(l=p,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===p&&o.freeFuncIndexes.push(p),_}try{const _=t.jsFuncToWasm(d,y);f.set(l,_),B&&o.scopedAlloc[o.scopedAlloc.length-1].push(l)}catch(_){throw l===p&&o.freeFuncIndexes.push(p),_}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:h(),f=Array.isArray(d)?[]:void 0;let p;do{switch(f&&(d=arguments[0].shift()),y){case"i1":case"i8":p=B.HEAP8[d>>0];break;case"i16":p=B.HEAP16[d>>1];break;case"i32":p=B.HEAP32[d>>2];break;case"float":case"f32":p=B.HEAP32F[d>>2];break;case"double":case"f64":p=Number(B.HEAP64F[d>>3]);break;case"i64":if(t.bigIntEnabled){p=BigInt(B.HEAP64[d>>3]);break}default:n("Invalid type for peek():",y)}f&&f.push(p)}while(f&&arguments[0].length);return f||p},t.poke=function(c,d,y="i8"){y.endsWith("*")&&(y=r);const B=o.memory&&o.heapSize===o.memory.buffer.byteLength?o:h();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=h().HEAP8U;let y=c;for(;d[y]!==0;++y);return y-c};const O=typeof SharedArrayBuffer>"u"?function(){}:SharedArrayBuffer,D=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?D(h().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<d;++B){let f=c.charCodeAt(B);f>=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 p=0,l=c.length;const _=y,u=y+B-(f?1:0);for(;p<l&&y<u;++p){let k=c.charCodeAt(p);if(k>=55296&&k<=57343&&(k=65536+((k&1023)<<10)|c.charCodeAt(++p)&1023),k<=127){if(y>=u)break;d[y++]=k}else if(k<=2047){if(y+1>=u)break;d[y++]=192|k>>6,d[y++]=128|k&63}else if(k<=65535){if(y+2>=u)break;d[y++]=224|k>>12,d[y++]=128|k>>6&63,d[y++]=128|k&63}else{if(y+3>=u)break;d[y++]=240|k>>18,d[y++]=128|k>>12&63,d[y++]=128|k>>6&63,d[y++]=128|k&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,p;for(;f<y&&(p=B[d+f]);++f)B[c+f]=p;return f<y&&(B[c+f++]=0),f},t.jstrToUintArray=(c,d=!1)=>o.utf8Encoder.encode(d?c+"\0":c);const U=(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(U(t,B),typeof c!="string")return null;{const f=o.utf8Encoder.encode(c),p=y(f.length+1),l=h().HEAP8U;return l.set(f,p),l[p+f.length]=0,d?[p,f.length]:p}};t.allocCString=(c,d=!1)=>Q(c,d,t.alloc,"allocCString()"),t.scopedAllocPush=function(){U(t,"scopedAllocPush");const c=[];return o.scopedAlloc.push(c),c},t.scopedAllocPop=function(c){U(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;B<c;++B){const f=t.peekPtr(d+t.ptrSizeof*B);y.push(f?t.cstrToJs(f):null)}return y},t.scopedAllocCall=function(c){t.scopedAllocPush();try{return c()}finally{t.scopedAllocPop()}};const S=function(c,d,y){U(t,y);const B=d?"i64":r;let f=t[y](c*(d?8:s));if(t.poke(f,0,B),c===1)return f;const p=[f];for(let l=1;l<c;++l)f+=d?8:s,p[l]=f,t.poke(f,0,B);return p};t.allocPtr=(c=1,d=!0)=>S(c,d,"alloc"),t.scopedAllocPtr=(c=1,d=!0)=>S(c,d,"scopedAlloc"),t.xGet=function(c){return t.exports[c]||n("Cannot find exported symbol:",c)};const C=(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&&C(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 E=r==="i32"?c=>c|0:c=>BigInt(c)|BigInt(0);q.set("i32",E).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("**",E).set("*",E),w.set("*",E).set("pointer",E).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 R=function(c){return typeof c=="string"?t.scopedAllocCString(c):c?E(c):null};q.set("string",R).set("utf8",R).set("pointer",R),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 L=class{constructor(c){this.name=c.name||"unnamed adapter"}convertArg(c,d,y){n("AbstractArgAdapter must be subclassed.")}};q.FuncPtrAdapter=class Se extends L{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)."),Se.bindScopes.indexOf(d.bindScope)<0&&n("Invalid options.bindScope ("+d.bindMod+") for FuncPtrAdapter. Expecting one of: ("+Se.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 p=g(d,this.signature,this.isTransient);if(Se.debugFuncInstall&&Se.debugOut("FuncPtrAdapter installed",this,this.contextKey(y,B),"@"+p,d),f){if(f[1]){Se.debugFuncInstall&&Se.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]=p}return p}else if(t.isPtr(d)||d===null||d===void 0){if(f&&f[1]&&f[1]!==d){Se.debugFuncInstall&&Se.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 x=c=>q.get(c)||n("Argument adapter not found:",c),P=c=>w.get(c)||n("Result adapter not found:",c);o.xWrap.convertArg=(c,...d)=>x(c)(...d),o.xWrap.convertArgNoCheck=(c,...d)=>q.get(c)(...d),o.xWrap.convertResult=(c,d)=>c===null?d:c?P(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&&C(c,f.length),d===null&&f.length===0)return f;d!=null&&P(d);for(const l of y)l instanceof L?q.set(l,(..._)=>l.convertArg(..._)):x(l);const p=o.xWrap;return f.length===0?(...l)=>l.length?C(c,f.length):p.convertResult(d,f.call(null)):function(...l){l.length!==f.length&&C(c,f.length);const _=t.scopedAllocPush();try{let u=0;for(;u<l.length;++u)l[u]=p.convertArgNoCheck(y[u],l[u],l,u);return p.convertResultNoCheck(d,f.apply(null,l))}finally{t.scopedAllocPop(_)}}};const K=function(c,d,y,B,f,p){if(typeof y=="string"){if(d===1)return p.get(y);if(d===2){if(B)B instanceof Function||n(f,"requires a function argument.");else return delete p.get(y),c;return p.set(y,B),c}}n("Invalid arguments to",f)};return t.xWrap.resultAdapter=function c(d,y){return K(c,arguments.length,d,y,"resultAdapter()",w)},t.xWrap.argAdapter=function c(d,y){return K(c,arguments.length,d,y,"argAdapter()",q)},t.xWrap.FuncPtrAdapter=q.FuncPtrAdapter,t.xCallWrapped=function(c,d,y,...B){return Array.isArray(arguments[3])&&(B=arguments[3]),t.xWrap(c,d,y||[]).apply(null,B||[])},t.xWrap.testConvertArg=o.xWrap.convertArg,t.xWrap.testConvertResult=o.xWrap.convertResult,t},globalThis.WhWasmUtilInstaller.yawl=function(t){const n=()=>fetch(t.uri,{credentials:"same-origin"}),r=this,s=function(h){if(t.wasmUtilTarget){const g=(...D)=>{throw new Error(D.join(" "))},O=t.wasmUtilTarget;if(O.module=h.module,O.instance=h.instance,O.instance.exports.memory||(O.memory=t.imports&&t.imports.env&&t.imports.env.memory||g("Missing 'memory' object!")),!O.alloc&&h.instance.exports.malloc){const D=h.instance.exports;O.alloc=function(U){return D.malloc(U)||g("Allocation of",U,"bytes failed.")},O.dealloc=function(U){D.free(U)}}r(O)}return t.onload&&t.onload(h,t),h};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),h=n.alloc,g=n.dealloc,O=n.log||console.log.bind(console),D=n.memberPrefix||"",U=n.memberSuffix||"",Q=n.bigIntEnabled===void 0?!!globalThis.BigInt64Array:!!n.bigIntEnabled,T=globalThis.BigInt,S=globalThis.BigInt64Array,C=n.ptrSizeof||4,q=n.ptrIR||"i32";s.debugFlags||(s.__makeDebugFlags=function(F=null){F&&F.__flags&&(F=F.__flags);const V=function $(X){return arguments.length===0?$.__flags:(X<0?(delete $.__flags.getter,delete $.__flags.setter,delete $.__flags.alloc,delete $.__flags.dealloc):($.__flags.getter=(1&X)!==0,$.__flags.setter=(2&X)!==0,$.__flags.alloc=(4&X)!==0,$.__flags.dealloc=(8&X)!==0),$._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}(),E=F=>F[1]==="(",R=F=>F==="P",L=F=>E(F)?"p":F[0],x=function(F){switch(L(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)},P=S?()=>!0:()=>r("BigInt64Array is not available."),K=function(F){switch(L(F)){case"p":case"P":case"s":{switch(C){case 4:return"getInt32";case 8:return P()&&"getBigInt64"}break}case"i":return"getInt32";case"c":return"getInt8";case"C":return"getUint8";case"j":return P()&&"getBigInt64";case"f":return"getFloat32";case"d":return"getFloat64"}r("Unhandled DataView getter for signature:",F)},c=function(F){switch(L(F)){case"p":case"P":case"s":{switch(C){case 4:return"setInt32";case 8:return P()&&"setBigInt64"}break}case"i":return"setInt32";case"c":return"setInt8";case"C":return"setUint8";case"j":return P()&&"setBigInt64";case"f":return"setFloat32";case"d":return"setFloat64"}r("Unhandled DataView setter for signature:",F)},d=function(F){switch(L(F)){case"i":case"f":case"c":case"C":case"d":return Number;case"j":return P()&&T;case"p":case"P":case"s":switch(C){case 4:return Number;case 8:return P()&&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,p="(pointer-is-external)",l=function(F,V,$){if($||($=f.get(V)),$){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,"@",$,"threw. NOT propagating it.",ae)}}else if(V.ondispose instanceof Function)try{V.ondispose()}catch(X){console.warn("ondispose() for",F.structName,"@",$,"threw. NOT propagating it.",X)}delete V.ondispose,F.debugFlags.__flags.dealloc&&O("debug.dealloc:",V[p]?"EXTERNAL":"",F.structName,"instance:",F.structInfo.sizeof,"bytes @"+$),V[p]||g($)}},_=F=>({configurable:!1,writable:!1,iterable:!1,value:F}),u=function(F,V,$){let X=!$;$?Object.defineProperty(V,p,_($)):($=h(F.structInfo.sizeof),$||r("Allocation of",F.structName,"structure failed."));try{F.debugFlags.__flags.alloc&&O("debug.alloc:",X?"":"EXTERNAL",F.structName,"instance:",F.structInfo.sizeof,"bytes @"+$),X&&o().fill(0,$,$+F.structInfo.sizeof),f.set(V,$)}catch(ae){throw l(F,V,$),ae}},k=function(){const F=this.pointer;return F?new Uint8Array(o().slice(F,F+this.structInfo.sizeof)):null},Z=_(F=>D+F+U),ne=function(F,V,$=!0){let X=F.members[V];if(!X&&(D||U)){for(const ae of Object.values(F.members))if(ae.key===V){X=ae;break}!X&&$&&r(y(F.name,V),"is not a mapped struct member.")}return X},se=function F(V,$,X=!1){F._||(F._=de=>de.replace(/[^vipPsjrdcC]/g,"").replace(/[pPscC]/g,"i"));const ae=ne(V.structInfo,$,!0);return X?F._(ae.signature):ae.signature},M={configurable:!1,enumerable:!1,get:function(){return f.get(this)},set:()=>r("Cannot assign the 'pointer' property of a struct.")},b=_(function(){const F=[];for(const V of Object.keys(this.structInfo.members))F.push(this.memberKey(V));return F}),I=new TextDecoder("utf-8"),j=new TextEncoder,H=typeof SharedArrayBuffer>"u"?function(){}:SharedArrayBuffer,ee=function(F,V,$){return I.decode(F.buffer instanceof H?F.slice(V,$):F.subarray(V,$))},re=function(F,V,$=!1){const X=ne(F.structInfo,V,$);return X&&X.signature.length===1&&X.signature[0]==="s"?X:!1},A=function(F){F.signature!=="s"&&r("Invalid member type signature for C-string value:",JSON.stringify(F))},N=function(V,$){const X=ne(V.structInfo,$,!0);A(X);const ae=V[X.key];if(!ae)return null;let de=ae;const ue=o();for(;ue[de]!==0;++de);return ae===de?"":ee(ue,ae,de)},W=function(F,...V){F.ondispose?Array.isArray(F.ondispose)||(F.ondispose=[F.ondispose]):F.ondispose=[],F.ondispose.push(...V)},J=function(F){const V=j.encode(F),$=h(V.length+1);$||r("Allocation error while duplicating string:",F);const X=o();return X.set(V,$),X[$+V.length]=0,$},G=function(F,V,$){const X=ne(F.structInfo,V,!0);A(X);const ae=J($);return F[X.key]=ae,W(F,ae),F},te=function(V,$){arguments[2]!==_&&r("Do not call the StructType constructor","from client-level code."),Object.defineProperties(this,{structName:_(V),structInfo:_($)})};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 N(this,F)}),memberIsString:_(function(F,V=!0){return re(this,F,V)}),memberKey:Z,memberKeys:b,memberSignature:_(function(F,V=!1){return se(this,F,V)}),memoryDump:_(k),pointer:M,setMemberCString:_(function(F,V){return G(this,F,V)})}),Object.assign(te.prototype,{addOnDispose:function(...F){return W(this,...F),this}}),Object.defineProperties(te,{allocCString:_(J),isA:_(F=>F instanceof te),hasExternalPointer:_(F=>F instanceof te&&!!F[p]),memberKey:Z});const oe=F=>Number.isFinite(F)||F instanceof(T||Number),Y=function F(V,$,X){if(!F._){F._={getters:{},setters:{},sw:{}};const me=["i","c","C","p","P","s","f","d","v()"];Q&&me.push("j"),me.forEach(function(we){F._.getters[we]=K(we),F._.setters[we]=c(we),F._.sw[we]=d(we)});const $n=/^[ipPsjfdcC]$/,Kn=/^[vipPsjfdcC]\([ipPsjfdcC]*\)$/;F.sigCheck=function(we,Jn,It,ot){Object.prototype.hasOwnProperty.call(we,It)&&r(we.structName,"already has a property named",It+"."),$n.test(ot)||Kn.test(ot)||r("Malformed signature for",y(we.structName,Jn)+":",ot)}}const ae=V.memberKey($);F.sigCheck(V.prototype,$,ae,X.signature),X.key=ae,X.name=$;const de=L(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",x(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",x(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(R(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,$){arguments.length===1?($=V,V=$.name):$.name||($.name=V),V||r("Struct name is required.");let X=!1;Object.keys($.members).forEach(ue=>{const fe=$.members[ue];fe.sizeof?fe.sizeof===1?fe.signature==="c"||fe.signature==="C"||r("Unexpected sizeof==1 member",y($.name,ue),"with signature",fe.signature):(fe.sizeof%4!==0&&(console.warn("Invalid struct member description =",fe,"from",$),r(V,"member",ue,"sizeof is not aligned. sizeof="+fe.sizeof)),fe.offset%4!==0&&(console.warn("Invalid struct member description =",fe,"from",$),r(V,"member",ue,"offset is not aligned. offset="+fe.offset))):r(V,"member",ue,"is missing sizeof."),(!X||X.offset<fe.offset)&&(X=fe)}),X?$.sizeof<X.offset+X.sizeof&&r("Invalid struct config:",V,"max member offset ("+X.offset+") ","extends past end of struct (sizeof="+$.sizeof+")."):r("No member property descriptions found.");const ae=_(s.__makeDebugFlags(F.debugFlags)),de=function ue(fe){this instanceof ue?arguments.length?((fe!==(fe|0)||fe<=0)&&r("Invalid pointer value for",V,"constructor."),u(ue,this,fe)):u(ue,this):r("The",V,"constructor may only be called via 'new'.")};return Object.defineProperties(de,{debugFlags:ae,isA:_(ue=>ue instanceof de),memberKey:Z,memberKeys:b,methodInfoForKey:_(function(ue){}),structInfo:_($),structName:_(V)}),de.prototype=new te(V,$,_),Object.defineProperties(de.prototype,{debugFlags:ae,constructor:_(de)}),Object.keys($.members).forEach(ue=>Y(de,ue,$.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(E,R,L,x)=>{try{const P=s.cArgvToJs(R,L);return w||(w=s.cArgvToJs(R,x)),q(P,w)|0}catch(P){return P.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","*",new s.xWrap.FuncPtrAdapter({name:"xDestroyAuxData",signature:"v(*)",contextKey:(q,w)=>q[0]})]],["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,E,R,L,x,P)=>{try{return R=R&&s.cstrToJs(R),L=L&&s.cstrToJs(L),x=x&&s.cstrToJs(x),P=P&&s.cstrToJs(P),q(w,E,R,L,x,P)||0}catch(K){return K.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,E,R,L,x)=>{q(w,E,s.cstrToJs(R),s.cstrToJs(L),x)}}),"*"]],["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,E,R,L,x,P,K)=>{q(w,E,R,s.cstrToJs(L),s.cstrToJs(x),P,K)}}),"*"]],["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=>(E,R)=>{try{return w(E,s.cstrToJs(R))|0}catch(L){return L.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,E)=>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",x=>q(o.flexibleString(x))),s.xWrap.argAdapter("string:static",function(x){return s.isPtr(x)?x:(x=""+x,this[x]||(this[x]=s.allocCString(x)))}.bind(Object.create(null)));const w=s.xWrap.argAdapter("*"),E=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*",x=>w(x instanceof(t?.oo1?.Stmt||E)?x.pointer:x))("sqlite3*",x=>w(x instanceof(t?.oo1?.DB||E)?x.pointer:x))("sqlite3_vfs*",x=>typeof x=="string"?r.sqlite3_vfs_find(x)||t.SQLite3Error.toss(r.SQLITE_NOTFOUND,"Unknown sqlite3_vfs name:",x):w(x instanceof(r.sqlite3_vfs||E)?x.pointer:x)),s.exports.sqlite3_declare_vtab&&s.xWrap.argAdapter("sqlite3_index_info*",x=>w(x instanceof(r.sqlite3_index_info||E)?x.pointer:x))("sqlite3_module*",x=>w(x instanceof(r.sqlite3_module||E)?x.pointer:x));const R=s.xWrap.resultAdapter("*");s.xWrap.resultAdapter("sqlite3*",R)("sqlite3_context*",R)("sqlite3_stmt*",R)("sqlite3_value*",R)("sqlite3_vfs*",R)("void*",R),s.exports.sqlite3_step.length===0&&(s.xWrap.doArgcCheck=!1,t.config.warn("Disabling sqlite3.wasm.xWrap.doArgcCheck due to environmental quirks."));for(const x of s.bindingSignatures)r[x[0]]=s.xWrap.apply(null,x);for(const x of s.bindingSignatures.wasmInternal)o[x[0]]=s.xWrap.apply(null,x);const L=function(x){return()=>n(x+"() is unavailable due to lack","of BigInt support in this build.")};for(const x of s.bindingSignatures.int64)r[x[0]]=s.bigIntEnabled?s.xWrap.apply(null,x):L(x[0]);if(delete s.bindingSignatures,s.exports.sqlite3__wasm_db_error){const x=s.xWrap("sqlite3__wasm_db_error","int","sqlite3*","int","string");o.sqlite3__wasm_db_error=function(P,K,c){return K instanceof t.WasmAllocError?(K=r.SQLITE_NOMEM,c=0):K instanceof Error&&(c=c||""+K,K=K.resultCode||r.SQLITE_ERROR),P?x(P,K,c):K}}else o.sqlite3__wasm_db_error=function(x,P,K){return console.warn("sqlite3__wasm_db_error() is not exported.",arguments),P}}{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 L of w)for(const x of Object.entries(s.ctype[L]))r[x[0]]=x[1];s.functionEntry(r.SQLITE_WASM_DEALLOC)||n("Internal error: cannot resolve exported function","entry SQLITE_WASM_DEALLOC (=="+r.SQLITE_WASM_DEALLOC+").");const E=Object.create(null);for(const L of["resultCodes"])for(const x of Object.entries(s.ctype[L]))E[x[1]]=x[0];r.sqlite3_js_rc_str=L=>E[L];const R=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 L of s.ctype.structs)R[L.name]||(r[L.name]=t.StructBinder(L));if(r.sqlite3_index_info){for(const L of["sqlite3_index_constraint","sqlite3_index_orderby","sqlite3_index_constraint_usage"])r.sqlite3_index_info[L]=r[L],delete r[L];r.sqlite3_vtab_config=s.xWrap("sqlite3__wasm_vtab_config","int",["sqlite3*","int","int"])}}const h=(q,w,E)=>o.sqlite3__wasm_db_error(q,r.SQLITE_MISUSE,w+"() requires "+E+" argument"+(E===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),D=q=>s.isPtr(q)?s.cstrToJs(q):q,U=function(q,w){q=O(q);let E=this.dbMap.get(q);if(w)!E&&w>0&&this.dbMap.set(q,E=Object.create(null));else return this.dbMap.delete(q),E;return E}.bind(Object.assign(Object.create(null),{dbMap:new Map}));U.addCollation=function(q,w){const E=U(q,1);E.collation||(E.collation=new Set),E.collation.add(D(w).toLowerCase())},U._addUDF=function(q,w,E,R){w=D(w).toLowerCase();let L=R.get(w);L||R.set(w,L=new Set),L.add(E<0?-1:E)},U.addFunction=function(q,w,E){const R=U(q,1);R.udf||(R.udf=new Map),this._addUDF(q,w,E,R.udf)},s.exports.sqlite3_create_window_function&&(U.addWindowFunc=function(q,w,E){const R=U(q,1);R.wudf||(R.wudf=new Map),this._addUDF(q,w,E,R.wudf)}),U.cleanup=function(q){q=O(q);const w=[q];for(const L 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 x=s.exports[L];if(x){w.length=x.length;try{r[L](...w)}catch(P){t.config.warn("close-time call of",L+"(",w,") threw:",P)}}}const E=U(q,0);if(!E)return;if(E.collation){for(const L of E.collation)try{r.sqlite3_create_collation_v2(q,L,r.SQLITE_UTF8,0,0,0)}catch{}delete E.collation}let R;for(R=0;R<2;++R){const L=R?E.wudf:E.udf;if(!L)continue;const x=R?r.sqlite3_create_window_function:r.sqlite3_create_function_v2;for(const P of L){const K=P[0],c=P[1],d=[q,K,0,r.SQLITE_UTF8,0,0,0,0,0];R&&d.push(0);for(const y of c)try{d[2]=y,x.apply(null,d)}catch{}c.clear()}L.clear()}delete E.udf,delete E.wudf};{const q=s.xWrap("sqlite3_close_v2","int","sqlite3*");r.sqlite3_close_v2=function(w){if(arguments.length!==1)return h(w,"sqlite3_close_v2",1);if(w)try{U.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 h(pDb,"sqlite3session_delete",1);w&&r.sqlite3session_table_filter(w,0,0),q(w)}}{const q=(E,R)=>"argv["+R+"]:"+E[0]+":"+s.cstrToJs(E[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(E,R,L,x,P,K){if(arguments.length!==6)return h(E,"sqlite3_create_collation_v2",6);if((L&15)===0)L|=r.SQLITE_UTF8;else if(r.SQLITE_UTF8!==(L&15))return g(E);try{const c=w(E,R,L,x,P,K);return c===0&&P instanceof Function&&U.addCollation(E,R),c}catch(c){return o.sqlite3__wasm_db_error(E,c)}},r.sqlite3_create_collation=(E,R,L,x,P)=>arguments.length===5?r.sqlite3_create_collation_v2(E,R,L,x,P,0):h(E,"sqlite3_create_collation",5)}{const q=function(L,x){return L[0]+":"+(L[2]<0?-1:L[2])+":"+x+":"+s.cstrToJs(L[1]).toLowerCase()},w=Object.assign(Object.create(null),{xInverseAndStep:{signature:"v(pip)",contextKey:q,callProxy:L=>(x,P,K)=>{try{L(x,...r.sqlite3_values_to_js(P,K))}catch(c){r.sqlite3_result_error_js(x,c)}}},xFinalAndValue:{signature:"v(p)",contextKey:q,callProxy:L=>x=>{try{r.sqlite3_result_js(x,L(x))}catch(P){r.sqlite3_result_error_js(x,P)}}},xFunc:{signature:"v(pip)",contextKey:q,callProxy:L=>(x,P,K)=>{try{r.sqlite3_result_js(x,L(x,...r.sqlite3_values_to_js(P,K)))}catch(c){r.sqlite3_result_error_js(x,c)}}},xDestroy:{signature:"v(p)",contextKey:q,callProxy:L=>x=>{try{L(x)}catch(P){console.error("UDF xDestroy method threw:",P)}}}}),E=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})]),R=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 L(x,P,K,c,d,y,B,f,p){if(L.length!==arguments.length)return h(x,"sqlite3_create_function_v2",L.length);if((c&15)===0)c|=r.SQLITE_UTF8;else if(r.SQLITE_UTF8!==(c&15))return g(x);try{const l=E(x,P,K,c,d,y,B,f,p);return l===0&&(y instanceof Function||B instanceof Function||f instanceof Function||p instanceof Function)&&U.addFunction(x,P,K),l}catch(l){return console.error("sqlite3_create_function_v2() setup threw:",l),o.sqlite3__wasm_db_error(x,l,"Creation of UDF threw: "+l)}},r.sqlite3_create_function=function L(x,P,K,c,d,y,B,f){return L.length===arguments.length?r.sqlite3_create_function_v2(x,P,K,c,d,y,B,f,0):h(x,"sqlite3_create_function",L.length)},R?r.sqlite3_create_window_function=function L(x,P,K,c,d,y,B,f,p,l){if(L.length!==arguments.length)return h(x,"sqlite3_create_window_function",L.length);if((c&15)===0)c|=r.SQLITE_UTF8;else if(r.SQLITE_UTF8!==(c&15))return g(x);try{const _=R(x,P,K,c,d,y,B,f,p,l);return _===0&&(y instanceof Function||B instanceof Function||f instanceof Function||p instanceof Function||l instanceof Function)&&U.addWindowFunc(x,P,K),_}catch(_){return console.error("sqlite3_create_window_function() setup threw:",_),o.sqlite3__wasm_db_error(x,_,"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=(E,R)=>(typeof E=="string"?R=-1:o.isSQLableTypedArray(E)?(R=E.byteLength,E=o.typedArrayToString(E instanceof ArrayBuffer?new Uint8Array(E):E)):Array.isArray(E)&&(E=E.join(""),R=-1),[E,R]),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 E(R,L,x,P,K,c){if(E.length!==arguments.length)return h(R,"sqlite3_prepare_v3",E.length);const[d,y]=q(L,x);switch(typeof d){case"string":return w.basic(R,d,y,P,K,null);case"number":return w.full(R,d,y,P,K,c);default:return o.sqlite3__wasm_db_error(R,r.SQLITE_MISUSE,"Invalid SQL argument type for sqlite3_prepare_v2/v3().")}},r.sqlite3_prepare_v2=function E(R,L,x,P,K){return E.length===arguments.length?r.sqlite3_prepare_v3(R,L,x,0,P,K):h(R,"sqlite3_prepare_v2",E.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 E(R,L,x,P,K){if(E.length!==arguments.length)return h(r.sqlite3_db_handle(R),"sqlite3_bind_text",E.length);if(s.isPtr(x)||x===null)return q(R,L,x,P,K);x instanceof ArrayBuffer?x=new Uint8Array(x):Array.isArray(pMem)&&(x=pMem.join(""));let c,d;try{if(o.isSQLableTypedArray(x))c=s.allocFromTypedArray(x),d=x.byteLength;else if(typeof x=="string")[c,d]=s.allocCString(x);else return o.sqlite3__wasm_db_error(r.sqlite3_db_handle(R),r.SQLITE_MISUSE,"Invalid 3rd argument type for sqlite3_bind_text().");return q(R,L,c,d,r.SQLITE_WASM_DEALLOC)}catch(y){return s.dealloc(c),o.sqlite3__wasm_db_error(r.sqlite3_db_handle(R),y)}},r.sqlite3_bind_blob=function E(R,L,x,P,K){if(E.length!==arguments.length)return h(r.sqlite3_db_handle(R),"sqlite3_bind_blob",E.length);if(s.isPtr(x)||x===null)return w(R,L,x,P,K);x instanceof ArrayBuffer?x=new Uint8Array(x):Array.isArray(x)&&(x=x.join(""));let c,d;try{if(o.isBindableTypedArray(x))c=s.allocFromTypedArray(x),d=P>=0?P:x.byteLength;else if(typeof x=="string")[c,d]=s.allocCString(x);else return o.sqlite3__wasm_db_error(r.sqlite3_db_handle(R),r.SQLITE_MISUSE,"Invalid 3rd argument type for sqlite3_bind_blob().");return w(R,L,c,d,r.SQLITE_WASM_DEALLOC)}catch(y){return s.dealloc(c),o.sqlite3__wasm_db_error(r.sqlite3_db_handle(R),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 E=s.exports.sqlite3_auto_extension(w);return w!==arguments[0]&&(E===0?q.add(w):s.uninstallFunction(w)),E},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,E=s.pstack,R=x=>s.peek(x)===115?sessionStorage:localStorage,L={xRead:(x,P,K,c)=>{const d=E.pointer,y=s.scopedAllocPush();try{const B=w(x,P);if(!B)return-3;const f=s.cstrToJs(B),p=R(x).getItem(f);if(!p)return-1;const l=p.length;if(c<=0)return l;if(c===1)return s.poke(K,0),l;const _=s.scopedAllocCString(p);return c>l+1&&(c=l+1),s.heap8u().copyWithin(K,_,_+c-1),s.poke(K+c-1,0),c-1}catch(B){return console.error("kvstorageRead()",B),-2}finally{E.restore(d),s.scopedAllocPop(y)}},xWrite:(x,P,K)=>{const c=E.pointer;try{const d=w(x,P);if(!d)return 1;const y=s.cstrToJs(d);return R(x).setItem(y,s.cstrToJs(K)),0}catch(d){return console.error("kvstorageWrite()",d),r.SQLITE_IOERR}finally{E.restore(c)}},xDelete:(x,P)=>{const K=E.pointer;try{const c=w(x,P);return c?(R(x).removeItem(s.cstrToJs(c)),0):1}catch(c){return console.error("kvstorageDelete()",c),r.SQLITE_IOERR}finally{E.restore(K)}}};for(const x of Object.keys(L))q[q.memberKey(x)]=s.installFunction(q.memberSignature(x),L[x])}else r.sqlite3_vfs_unregister(Q);s.xWrap.FuncPtrAdapter.warnOnUse=!0;const T=t.StructBinder,S=function q(w,E,R,L=q.installMethodArgcCheck){if(w instanceof T.StructType?!(R instanceof Function)&&!s.isPtr(R)&&n("Usage errror: 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,L);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 x=w.memberSignature(E);x.length<2&&n("Member",E,"does not have a function pointer signature:",x);const P=w.memberKey(E),K=L&&!s.isPtr(R)?q.argcProxy(w,P,R,x):R;if(s.isPtr(K))K&&!s.functionEntry(K)&&n("Pointer",K,"is not a WASM function table entry."),w[P]=K;else{const c=s.installFunction(K,w.memberSignature(E,!0));w[P]=c,(!w.ondispose||!w.ondispose.__removeFuncList)&&(w.addOnDispose("ondispose.__removeFuncList handler",q.removeFuncList),w.ondispose.__removeFuncList=[]),w.ondispose.__removeFuncList.push(P,c)}return(c,d)=>q(w,c,d,L)};S.installMethodArgcCheck=!1;const C=function(q,w,E=S.installMethodArgcCheck){const R=new Map;for(const L of Object.keys(w)){const x=w[L],P=R.get(x);if(P){const K=q.memberKey(L);q[K]=q[q.memberKey(P)]}else S(q,L,x,E),R.set(x,L)}return q};T.StructType.prototype.installMethod=function(w,E,R=S.installMethodArgcCheck){return arguments.length<3&&w&&typeof w=="object"?C(this,...arguments):S(this,...arguments)},T.StructType.prototype.installMethods=function(q,w=S.installMethodArgcCheck){return C(this,q,w)}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){t.version={libVersion:"3.47.1",libVersionNumber:3047001,sourceId:"2024-11-25 12:07:48 b95d11e958643b969c47a8e5857f3793b9e69700b8f1469371386369a26e577e",downloadVersion:3470100}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(t){const n=(...f)=>{throw new t.SQLite3Error(...f)},r=t.capi,s=t.wasm,o=t.util,h=new WeakMap,g=new WeakMap,O=(f,p,l)=>{const _=Object.getOwnPropertyDescriptor(f,p);return _?_.value:l},D=function(f,p){return p&&(f instanceof S&&(f=f.pointer),n(p,"sqlite3 result code",p+":",f?r.sqlite3_errmsg(f):r.sqlite3_errstr(p))),arguments[0]},U=s.installFunction("i(ippp)",function(f,p,l,_){r.SQLITE_TRACE_STMT===f&&console.log("SQL TRACE #"+ ++this.counter+" via sqlite3@"+p+":",s.cstrToJs(_))}.bind({counter:0})),Q=Object.create(null),T=function f(...p){if(!f._name2vfs){f._name2vfs=Object.create(null);const b=typeof importScripts=="function"?I=>n("The VFS for",I,"is only available in the main window thread."):!1;f._name2vfs[":localStorage:"]={vfs:"kvvfs",filename:b||(()=>"local")},f._name2vfs[":sessionStorage:"]={vfs:"kvvfs",filename:b||(()=>"session")}}const l=f.normalizeArgs(...p);let _=l.filename,u=l.vfs,k=l.flags;(typeof _!="string"&&typeof _!="number"||typeof k!="string"||u&&typeof u!="string"&&typeof u!="number")&&(t.config.error("Invalid DB ctor args",l,arguments),n("Invalid arguments for DB constructor."));let z=typeof _=="number"?s.cstrToJs(_):_;const Z=f._name2vfs[z];Z&&(u=Z.vfs,_=z=Z.filename(z));let ne,se=0;k.indexOf("c")>=0&&(se|=r.SQLITE_OPEN_CREATE|r.SQLITE_OPEN_READWRITE),k.indexOf("w")>=0&&(se|=r.SQLITE_OPEN_READWRITE),se===0&&(se|=r.SQLITE_OPEN_READONLY),se|=r.SQLITE_OPEN_EXRESCODE;const M=s.pstack.pointer;try{const b=s.pstack.allocPtr();let I=r.sqlite3_open_v2(_,b,se,u||0);ne=s.peekPtr(b),D(ne,I),r.sqlite3_extended_result_codes(ne,1),k.indexOf("t")>=0&&r.sqlite3_trace_v2(ne,r.SQLITE_TRACE_STMT,U,ne)}catch(b){throw ne&&r.sqlite3_close_v2(ne),b}finally{s.pstack.restore(M)}this.filename=z,h.set(this,ne),g.set(this,Object.create(null));try{const b=r.sqlite3_js_db_vfs(ne)||n("Internal error: cannot get VFS for new db handle."),I=Q[b];I&&(I instanceof Function?I(this,t):D(ne,r.sqlite3_exec(ne,I,0,0,0)))}catch(b){throw this.close(),b}};T.setVfsPostOpenCallback=function(f,p){p instanceof Function||n("dbCtorHelper.setVfsPostOpenCallback() should not be used with a non-function argument.",arguments),Q[f]=p},T.normalizeArgs=function(f=":memory:",p="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=p,_.vfs=l),_};const S=function(...f){T.apply(this,f)};S.dbCtorHelper=T;const C={null:1,number:2,string:3,boolean:4,blob:5};C.undefined==C.null,s.bigIntEnabled&&(C.bigint=C.number);const q=function(){C!==arguments[2]&&n(r.SQLITE_MISUSE,"Do not call the Stmt constructor directly. Use DB.prepare()."),this.db=arguments[0],h.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},E=function(f,p){return(p!==(p|0)||p<0||p>=f.columnCount)&&n("Column index",p,"is out of range."),f},R=function(f,p){const l=Object.create(null);switch(l.opt=Object.create(null),p.length){case 1:typeof p[0]=="string"||o.isSQLableTypedArray(p[0])||Array.isArray(p[0])?l.sql=p[0]:p[0]&&typeof p[0]=="object"&&(l.opt=p[0],l.sql=l.opt.sql);break;case 2:l.sql=p[0],l.opt=p[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,k)=>{k.columnNames||(k.columnNames=u.getColumnNames([]));const z=u.get([]),Z=Object.create(null);for(const ne in k.columnNames)Z[k.columnNames[ne]]=z[ne];return Z};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=k=>{const z=k.get(Object.create(null))[u];return z===void 0?n(r.SQLITE_NOTFOUND,"exec(): unknown result column:",u):z};break}n("Invalid rowMode:",_.rowMode)}return l},L=(f,p,l,..._)=>{const u=f.prepare(p);try{const k=u.bind(l).step()?u.get(..._):void 0;return u.reset(),k}finally{u.finalize()}},x=(f,p,l,_)=>f.exec({sql:p,bind:l,rowMode:_,returnValue:"resultRows"});S.checkRc=(f,p)=>D(f,p),S.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((p,l)=>{if(l&&l.pointer)try{l.finalize()}catch{}}),h.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,p=!1){const l=w(this).pointer;return f?p?r.sqlite3_total_changes64(l):r.sqlite3_total_changes(l):p?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 p;const l=r.sqlite3_js_db_vfs(w(this).pointer,f);if(l){const _=new r.sqlite3_vfs(l);try{p=s.cstrToJs(_.$zName)}finally{_.dispose()}}return p},prepare:function(f){w(this);const p=s.pstack.pointer;let l,_;try{l=s.pstack.alloc(8),S.checkRc(this,r.sqlite3_prepare_v2(this.pointer,f,-1,l,null)),_=s.peekPtr(l)}finally{s.pstack.restore(p)}_||n("Cannot prepare empty SQL.");const u=new q(this,_,C);return g.get(this)[_]=u,u},exec:function(){w(this);const f=R(this,arguments);if(!f.sql)return n("exec() requires an SQL string.");const p=f.opt,l=p.callback,_=Array.isArray(p.resultRows)?p.resultRows:void 0;let u,k=p.bind,z=!!(f.cbArg||p.columnNames||_);const Z=s.scopedAllocPush(),ne=Array.isArray(p.saveSql)?p.saveSql:void 0;try{const se=o.isSQLableTypedArray(f.sql);let M=se?f.sql.byteLength:s.jstrlen(f.sql);const b=s.scopedAlloc(2*s.ptrSizeof+(M+1)),I=b+s.ptrSizeof;let j=I+s.ptrSizeof;const H=j+M;for(se?s.heap8().set(f.sql,j):s.jstrcpy(f.sql,s.heap8(),j,M,!1),s.poke(j+M,0);j&&s.peek(j,"i8");){s.pokePtr([b,I],0),S.checkRc(this,r.sqlite3_prepare_v3(this.pointer,j,M,0,b,I));const ee=s.peekPtr(b);if(j=s.peekPtr(I),M=H-j,!!ee){if(ne&&ne.push(r.sqlite3_sql(ee).trim()),u=new q(this,ee,C),k&&u.parameterCount&&(u.bind(k),k=null),z&&u.columnCount){let re=Array.isArray(p.columnNames)?0:1;if(z=!1,f.cbArg||_){const A=Object.create(null);for(;u.step();u._lockedByExec=!1){re++===0&&u.getColumnNames(A.columnNames=p.columnNames||[]),u._lockedByExec=!0;const N=f.cbArg(u,A);if(_&&_.push(N),l&&l.call(p,N,u)===!1)break}u._lockedByExec=!1}re===0&&u.getColumnNames(p.columnNames)}else u.step();u.reset().finalize(),u=null}}}finally{s.scopedAllocPop(Z),u&&(delete u._lockedByExec,u.finalize())}return f.returnVal()},createFunction:function(p,l,_){const u=A=>A instanceof Function;switch(arguments.length){case 1:_=p,p=_.name,l=_.xFunc||0;break;case 2:u(l)||(_=l,l=_.xFunc||0);break}_||(_={}),typeof p!="string"&&n("Invalid arguments: missing function name.");let k=_.xStep||0,z=_.xFinal||0;const Z=_.xValue||0,ne=_.xInverse||0;let se;u(l)?(se=!1,(u(k)||u(z))&&n("Ambiguous arguments: scalar or aggregate?"),k=z=null):u(k)?(u(z)||n("Missing xFinal() callback for aggregate or window UDF."),l=null):u(z)?n("Missing xStep() callback for aggregate or window UDF."):n("Missing function-type properties."),se===!1?(u(Z)||u(ne))&&n("xValue and xInverse are not permitted for non-window UDFs."):u(Z)?(u(ne)||n("xInverse must be provided if xValue is."),se=!0):u(ne)&&n("xValue must be provided if xInverse is.");const M=_.pApp;M!=null&&(typeof M!="number"||!o.isInt32(M))&&n("Invalid value for pApp property. Must be a legal WASM pointer value.");const b=_.xDestroy||0;b&&!u(b)&&n("xDestroy property must be a function.");let I=0;O(_,"deterministic")&&(I|=r.SQLITE_DETERMINISTIC),O(_,"directOnly")&&(I|=r.SQLITE_DIRECTONLY),O(_,"innocuous")&&(I|=r.SQLITE_INNOCUOUS),p=p.toLowerCase();const j=l||k,H=O(_,"arity"),ee=typeof H=="number"?H:j.length?j.length-1:0;let re;return se?re=r.sqlite3_create_window_function(this.pointer,p,ee,r.SQLITE_UTF8|I,M||0,k,z,Z,ne,b):re=r.sqlite3_create_function_v2(this.pointer,p,ee,r.SQLITE_UTF8|I,M||0,l,k,z,b),S.checkRc(this,re),this},selectValue:function(f,p,l){return L(this,f,p,0,l)},selectValues:function(f,p,l){const _=this.prepare(f),u=[];try{for(_.bind(p);_.step();)u.push(_.get(0,l));_.reset()}finally{_.finalize()}return u},selectArray:function(f,p){return L(this,f,p,[])},selectObject:function(f,p){return L(this,f,p,{})},selectArrays:function(f,p){return x(this,f,p,"array")},selectObjects:function(f,p){return x(this,f,p,"object")},openStatementCount:function(){return this.pointer?Object.keys(g.get(this)).length:0},transaction:function(f){let p="BEGIN";arguments.length>1&&(/[^a-zA-Z]/.test(arguments[0])&&n(r.SQLITE_MISUSE,"Invalid argument for BEGIN qualifier."),p+=" "+arguments[0],f=arguments[1]),w(this).exec(p);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 p=f(this);return this.exec("RELEASE oo1"),p}catch(p){throw this.exec("ROLLBACK to SAVEPOINT oo1; RELEASE SAVEPOINT oo1"),p}},checkRc:function(f){return D(this,f)}};const P=function(f){return f.pointer||n("Stmt has been closed."),f},K=function(f){let p=C[f==null?"null":typeof f];switch(p){case C.boolean:case C.null:case C.number:case C.string:return p;case C.bigint:if(s.bigIntEnabled)return p;default:return o.isBindableTypedArray(f)?C.blob:void 0}},c=function(f){return K(f)||n("Unsupported bind() argument type:",typeof f)},d=function(f,p){const l=typeof p=="number"?p:r.sqlite3_bind_parameter_index(f.pointer,p);return l===0||!o.isInt32(l)?n("Invalid bind() parameter name: "+p):(l<1||l>f.parameterCount)&&n("Bind index",p,"is out of range."),l},y=function(f,p){return f._lockedByExec&&n("Operation is illegal when statement is locked:",p),f},B=function f(p,l,_,u){y(P(p),"bind()"),f._||(f._tooBigInt=z=>n("BigInt value is too big to store without precision loss:",z),f._={string:function(z,Z,ne,se){const[M,b]=s.allocCString(ne,!0);return(se?r.sqlite3_bind_blob:r.sqlite3_bind_text)(z.pointer,Z,M,b,r.SQLITE_WASM_DEALLOC)}}),c(u),l=d(p,l);let k=0;switch(u==null?C.null:_){case C.null:k=r.sqlite3_bind_null(p.pointer,l);break;case C.string:k=f._.string(p,l,u,!1);break;case C.number:{let z;o.isInt32(u)?z=r.sqlite3_bind_int:typeof u=="bigint"?o.bigIntFits64(u)?s.bigIntEnabled?z=r.sqlite3_bind_int64:o.bigIntFitsDouble(u)?(u=Number(u),z=r.sqlite3_bind_double):f._tooBigInt(u):f._tooBigInt(u):(u=Number(u),s.bigIntEnabled&&Number.isInteger(u)?z=r.sqlite3_bind_int64:z=r.sqlite3_bind_double),k=z(p.pointer,l,u);break}case C.boolean:k=r.sqlite3_bind_int(p.pointer,l,u?1:0);break;case C.blob:{if(typeof u=="string"){k=f._.string(p,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 z=s.alloc(u.byteLength||1);s.heap8().set(u.byteLength?u:[0],z),k=r.sqlite3_bind_blob(p.pointer,l,z,u.byteLength,r.SQLITE_WASM_DEALLOC);break}default:t.config.warn("Unsupported bind() argument type:",u),n("Unsupported bind() argument type: "+typeof u)}return k&&S.checkRc(p.db.pointer,k),p._mayGet=!1,p};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],h.delete(this),delete this._mayGet,delete this.parameterCount,delete this._lockedByExec,delete this.db,f}},clearBindings:function(){return y(P(this),"clearBindings()"),r.sqlite3_clear_bindings(this.pointer),this._mayGet=!1,this},reset:function(f){y(this,"reset()"),f&&this.clearBindings();const p=r.sqlite3_reset(P(this).pointer);return this._mayGet=!1,D(this.db,p),this},bind:function(){P(this);let f,p;switch(arguments.length){case 1:f=1,p=arguments[0];break;case 2:f=arguments[0],p=arguments[1];break;default:n("Invalid bind() arguments.")}return p===void 0?this:(this.parameterCount||n("This statement has no bindable parameters."),this._mayGet=!1,p===null?B(this,f,C.null,p):Array.isArray(p)?(arguments.length!==1&&n("When binding an array, an index argument is not permitted."),p.forEach((l,_)=>B(this,_+1,c(l),l)),this):(p instanceof ArrayBuffer&&(p=new Uint8Array(p)),typeof p=="object"&&!o.isBindableTypedArray(p)?(arguments.length!==1&&n("When binding an object, an index argument is not permitted."),Object.keys(p).forEach(l=>B(this,l,c(p[l]),p[l])),this):B(this,f,c(p),p)))},bindAsBlob:function(f,p){P(this),arguments.length===1&&(p=f,f=1);const l=c(p);return C.string!==l&&C.blob!==l&&C.null!==l&&n("Invalid value type for bindAsBlob()"),B(this,f,C.blob,p)},step:function(){y(this,"step()");const f=r.sqlite3_step(P(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)),S.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,p){if(P(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(E(this,f),p===void 0?r.sqlite3_column_type(this.pointer,f):p){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||l<Number.MIN_SAFE_INTEGER)&&n("Integer is out of range for JS integer range: "+l),o.isInt32(l)?l|0:l}case r.SQLITE_FLOAT:return r.sqlite3_column_double(this.pointer,f);case r.SQLITE_TEXT:return r.sqlite3_column_text(this.pointer,f);case r.SQLITE_BLOB:{const l=r.sqlite3_column_bytes(this.pointer,f),_=r.sqlite3_column_blob(this.pointer,f),u=new Uint8Array(l);return l&&u.set(s.heap8u().slice(_,_+l),0),l&&this.db._blobXfer instanceof Array&&this.db._blobXfer.push(u.buffer),u}default:n("Don't know how to translate","type of result column #"+f+".")}n("Not reached.")},getInt:function(f){return this.get(f,r.SQLITE_INTEGER)},getFloat:function(f){return this.get(f,r.SQLITE_FLOAT)},getString:function(f){return this.get(f,r.SQLITE_TEXT)},getBlob:function(f){return this.get(f,r.SQLITE_BLOB)},getJSON:function(f){const p=this.get(f,r.SQLITE_STRING);return p===null?p:JSON.parse(p)},getColumnName:function(f){return r.sqlite3_column_name(E(P(this),f).pointer,f)},getColumnNames:function(f=[]){E(P(this),0);const p=this.columnCount;for(let l=0;l<p;++l)f.push(r.sqlite3_column_name(this.pointer,l));return f},getParamIndex:function(f){return P(this).parameterCount?r.sqlite3_bind_parameter_index(this.pointer,f):void 0},getParamName:function(f){return P(this).parameterCount?r.sqlite3_bind_parameter_name(this.pointer,f):void 0},isBusy:function(){return r.sqlite3_stmt_busy(P(this))!==0},isReadOnly:function(){return r.sqlite3_stmt_readonly(P(this))!==0}};{const f={enumerable:!0,get:function(){return h.get(this)},set:()=>n("The pointer property is read-only.")};Object.defineProperty(q.prototype,"pointer",f),Object.defineProperty(S.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:S,Stmt:q},o.isUIThread()){t.oo1.JsStorageDb=function(p="session"){const l=T.normalizeArgs(...arguments);p=l.filename,p!=="session"&&p!=="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(S.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,h=function(T){let S=g.idMap.get(T);return S||(S="db#"+ ++g.idSeq+"@"+T.pointer,g.idMap.set(T,S),S)},g={dbList:[],idSeq:0,idMap:new WeakMap,xfer:[],open:function(T){const S=new o(T);return this.dbs[h(S)]=S,this.dbList.indexOf(S)<0&&this.dbList.push(S),S},close:function(T,S){if(T){delete this.dbs[h(T)];const C=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),S&&C&&q&&n.sqlite3__wasm_vfs_unlink(q,C)}},post:function(T,S){S&&S.length?(globalThis.postMessage(T,Array.from(S)),S.length=0):globalThis.postMessage(T)},dbs:Object.create(null),getDb:function(T,S=!0){return this.dbs[T]||(S?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.")},D=function(T,S=!0){const C=g.getDb(T.dbId,!1)||g.dbList[0];return S?O(C):C},U=function(){return g.dbList[0]&&h(g.dbList[0])},Q={open:function(T){const S=Object.create(null),C=T.args||Object.create(null);C.simulateError&&r("Throwing because of simulateError flag.");const q=Object.create(null);S.vfs=C.vfs,S.filename=C.filename||"";const w=g.open(S);return q.filename=w.filename,q.persistent=!!s.capi.sqlite3_js_db_uses_vfs(w.pointer,"opfs"),q.dbId=h(w),q.vfs=w.dbVfsName(),q},close:function(T){const S=D(T,!1),C={filename:S&&S.filename};if(S){const q=T.args&&typeof T.args=="object"?!!T.args.unlink:!1;g.close(S,q)}return C},exec:function(T){const S=typeof T.args=="string"?{sql:T.args}:T.args||Object.create(null);S.rowMode==="stmt"?r("Invalid rowMode for 'exec': stmt mode","does not work in the Worker API."):S.sql||r("'exec' requires input SQL.");const C=D(T);(S.callback||Array.isArray(S.resultRows))&&(C._blobXfer=g.xfer);const q=S.callback;let w=0;const E=!!S.columnNames;typeof q=="string"&&(E||(S.columnNames=[]),S.callback=function(R,L){g.post({type:q,columnNames:S.columnNames,rowNumber:++w,row:R},g.xfer)});try{const R=S.countChanges?C.changes(!0,S.countChanges===64):void 0;C.exec(S),R!==void 0&&(S.changeCount=C.changes(!0,S.countChanges===64)-R),S.callback instanceof Function&&(S.callback=q,g.post({type:q,columnNames:S.columnNames,rowNumber:null,row:void 0}))}finally{delete C._blobXfer,S.callback&&(S.callback=q)}return S},"config-get":function(){const T=Object.create(null),S=s.config;return["bigIntEnabled"].forEach(function(C){Object.getOwnPropertyDescriptor(S,C)&&(T[C]=S[C])}),T.version=s.version,T.vfsList=s.capi.sqlite3_js_vfs_list(),T},export:function(T){const S=D(T),C={byteArray:s.capi.sqlite3_js_db_export(S.pointer),filename:S.filename,mimetype:"application/x-sqlite3"};return g.xfer.push(C.byteArray.buffer),C},toss:function(T){r("Testing worker exception")}};globalThis.onmessage=async function(T){T=T.data;let S,C=T.dbId,q=T.type;const w=performance.now();try{Q.hasOwnProperty(q)&&Q[q]instanceof Function?S=await Q[q](T):r("Unknown db worker message type:",T.type)}catch(E){q="error",S={operation:T.type,message:E.message,errorClass:E.name,input:T},E.stack&&(S.stack=typeof E.stack=="string"?E.stack.split(/\n\s*/):E.stack)}C||(C=S.dbId||U()),g.post({type:q,dbId:C,messageId:T.messageId,workerReceivedTime:w,workerRespondTime:performance.now(),departureTime:T.departureTime,result:S},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(h=!1){this instanceof t.capi.sqlite3_vfs||s("Expecting a sqlite3_vfs-type argument.");const g=r.sqlite3_vfs_register(this,h?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(h){let g=0;const O=["io","vfs"];for(const D of O){const U=h[D];U&&(++g,U.struct.installMethods(U.methods,!!U.applyArgcCheck),D==="vfs"&&(!U.struct.$zName&&typeof U.name=="string"&&U.struct.addOnDispose(U.struct.$zName=n.allocCString(U.name)),U.struct.registerVfs(!!U.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 h=r.sqlite3_index_info;h.prototype.nthConstraint=function(D,U=!1){if(D<0||D>=this.$nConstraint)return!1;const Q=this.$aConstraint+h.sqlite3_index_constraint.structInfo.sizeof*D;return U?Q:new h.sqlite3_index_constraint(Q)},h.prototype.nthConstraintUsage=function(D,U=!1){if(D<0||D>=this.$nConstraint)return!1;const Q=this.$aConstraintUsage+h.sqlite3_index_constraint_usage.structInfo.sizeof*D;return U?Q:new h.sqlite3_index_constraint_usage(Q)},h.prototype.nthOrderBy=function(D,U=!1){if(D<0||D>=this.$nOrderBy)return!1;const Q=this.$aOrderBy+h.sqlite3_index_orderby.structInfo.sizeof*D;return U?Q:new h.sqlite3_index_orderby(Q)};const g=function(D,U){return function(Q,T=!1){if(arguments.length===0&&(Q=new U),Q instanceof U)return this.set(Q.pointer,Q),Q;n.isPtr(Q)||t.SQLite3Error.toss("Invalid argument to",D+"()");let S=this.get(Q);return T&&this.delete(Q),S}.bind(new Map)},O=function(D,U){const Q=g(D,U);return Object.assign(Object.create(null),{StructType:U,create:T=>{const S=Q();return n.pokePtr(T,S.pointer),S},get:T=>Q(T),unget:T=>Q(T,!0),dispose:T=>{const S=Q(T,!0);S&&S.dispose()}})};o.xVtab=O("xVtab",r.sqlite3_vtab),o.xCursor=O("xCursor",r.sqlite3_vtab_cursor),o.xIndexInfo=D=>new r.sqlite3_index_info(D),o.xError=function D(U,Q,T){if(D.errorReporter instanceof Function)try{D.errorReporter("sqlite3_module::"+U+"(): "+Q.message)}catch{}let S;return Q instanceof t.WasmAllocError?S=r.SQLITE_NOMEM:arguments.length>2?S=T:Q instanceof t.SQLite3Error&&(S=Q.resultCode),S||r.SQLITE_ERROR},o.xError.errorReporter=console.error.bind(console),o.xRowid=(D,U)=>n.poke(D,U,"i64"),o.setupModule=function(D){let U=!1;const Q=this instanceof r.sqlite3_module?this:D.struct||(U=new r.sqlite3_module);try{const T=D.methods||s("Missing 'methods' object.");for(const S of Object.entries({xConnect:"xCreate",xDisconnect:"xDestroy"})){const C=S[0],q=S[1];T[C]===!0?T[C]=T[q]:T[q]===!0&&(T[q]=T[C])}if(D.catchExceptions){const S=function(w,E){return["xConnect","xCreate"].indexOf(w)>=0?function(R,L,x,P,K,c){try{return E(...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(...R){try{return E(...R)||0}catch(L){return o.xError(w,L)}}},C=["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 C){const E=T[w];if(E instanceof Function)w==="xConnect"&&T.xCreate===E?q[w]=T.xCreate:w==="xCreate"&&T.xConnect===E?q[w]=T.xConnect:q[w]=S(w,E);else continue}Q.installMethods(q,!1)}else Q.installMethods(T,!!D.applyArgcCheck);if(Q.$iVersion===0){let S;typeof D.iVersion=="number"?S=D.iVersion:Q.$xShadowName?S=3:Q.$xSavePoint||Q.$xRelease||Q.$xRollbackTo?S=2:S=1,Q.$iVersion=S}}catch(T){throw U&&U.dispose(),T}return Q},r.sqlite3_module.prototype.setupModule=function(D){return o.setupModule.call(this,D)}}),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 D=[t.config.error,t.config.warn,t.config.log],U=(A,...N)=>{s.verbose>A&&D[A]("OPFS syncer:",...N)},Q=(...A)=>U(2,...A),T=(...A)=>U(1,...A),S=(...A)=>U(0,...A),C=t.util.toss,q=t.capi,w=t.util,E=t.wasm,R=q.sqlite3_vfs,L=q.sqlite3_file,x=q.sqlite3_io_methods,P=Object.create(null),K=()=>globalThis.FileSystemHandle&&globalThis.FileSystemDirectoryHandle&&globalThis.FileSystemFileHandle&&globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle&&navigator?.storage?.getDirectory;P.metrics={dump:function(){let A,N=0,W=0,J=0;for(A in u.opIds){const G=k[A];N+=G.count,W+=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,":",k,`
Total of`,N,"op(s) for",W,"ms (incl. "+J+" ms of waiting on the async side)"),t.config.log("Serialization metrics:",k.s11n),p.postMessage({type:"opfs-async-metrics"})},reset:function(){let A;const N=J=>J.count=J.time=J.wait=0;for(A in u.opIds)N(k[A]=Object.create(null));let W=k.s11n=Object.create(null);W=W.serialize=Object.create(null),W.count=W.time=0,W=k.s11n.deserialize=Object.create(null),W.count=W.time=0}};const c=new x,d=new R().addOnDispose(()=>c.dispose());let y;const B=A=>(y=!0,d.dispose(),O(A)),f=()=>(y=!1,g(t)),p=new Worker(new URL(""+new URL("sqlite3-opfs-async-proxy-C_otN2ZJ.js",self.location.href).href,self.location.href));setTimeout(()=>{y===void 0&&B(new Error("Timeout while waiting for OPFS async proxy worker."))},4e3),p._originalOnError=p.onerror,p.onerror=function(A){S("Error initializing OPFS asyncer:",A),B(new Error("Loading OPFS async Worker failed for unknown reasons."))};const l=q.sqlite3_vfs_find(null),_=l?new R(l):null;c.$iVersion=1,d.$iVersion=2,d.$szOsFile=q.sqlite3_file.structInfo.sizeof,d.$mxPathname=1024,d.$zName=E.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 A=new ArrayBuffer(2);return new DataView(A).setInt16(0,256,!0),new Int16Array(A)[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 k=Object.create(null);{let A=0;u.opIds.whichOp=A++,u.opIds.rc=A++,u.opIds.xAccess=A++,u.opIds.xClose=A++,u.opIds.xDelete=A++,u.opIds.xDeleteNoWait=A++,u.opIds.xFileSize=A++,u.opIds.xLock=A++,u.opIds.xOpen=A++,u.opIds.xRead=A++,u.opIds.xSleep=A++,u.opIds.xSync=A++,u.opIds.xTruncate=A++,u.opIds.xUnlock=A++,u.opIds.xWrite=A++,u.opIds.mkdir=A++,u.opIds["opfs-async-metrics"]=A++,u.opIds["opfs-async-shutdown"]=A++,u.opIds.retry=A++,u.sabOP=new SharedArrayBuffer(A*4),P.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(A=>{(u.sq3Codes[A]=q[A])===void 0&&C("Maintenance required: not found:",A)}),u.opfsFlags=Object.assign(Object.create(null),{OPFS_UNLOCK_ASAP:1,OPFS_UNLINK_BEFORE_OPEN:2,defaultUnlockAsap:!1});const z=(A,...N)=>{const W=u.opIds[A]||C("Invalid op ID:",A);u.s11n.serialize(...N),Atomics.store(u.sabOPView,u.opIds.rc,-1),Atomics.store(u.sabOPView,u.opIds.whichOp,W),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(k[A].wait+=performance.now()-J,G&&u.asyncS11nExceptions){const te=u.s11n.deserialize();te&&S(A+"() async error:",...te)}return G};P.debug={asyncShutdown:()=>{T("Shutting down OPFS async listener. The OPFS VFS will no longer work."),z("opfs-async-shutdown")},asyncRestart:()=>{T("Attempting to restart OPFS VFS async listener. Might work, might not."),p.postMessage({type:"opfs-async-restart"})}};const Z=()=>{if(u.s11n)return u.s11n;const A=new TextDecoder,N=new TextEncoder("utf-8"),W=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]||C("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:C("Invalid type ID:",Y)}};return u.s11n.deserialize=function(Y=!1){++k.s11n.deserialize.count;const pe=performance.now(),F=W[0],V=F?[]:null;if(F){const $=[];let X=1,ae,de,ue;for(ae=0;ae<F;++ae,++X)$.push(oe(W[X]));for(ae=0;ae<F;++ae){const fe=$[ae];fe.getter?(ue=J[fe.getter](X,u.littleEndian),X+=fe.size):(de=J.getInt32(X,u.littleEndian),X+=4,ue=A.decode(W.slice(X,X+de)),X+=de),V.push(ue)}}return Y&&(W[0]=0),k.s11n.deserialize.time+=performance.now()-pe,V},u.s11n.serialize=function(...Y){const pe=performance.now();if(++k.s11n.serialize.count,Y.length){const F=[];let V=0,$=1;for(W[0]=Y.length&255;V<Y.length;++V,++$)F.push(te(Y[V])),W[$]=F[V].id;for(V=0;V<Y.length;++V){const X=F[V];if(X.setter)J[X.setter]($,Y[V],u.littleEndian),$+=X.size;else{const ae=N.encode(Y[V]);J.setInt32($,ae.byteLength,u.littleEndian),$+=4,W.set(ae,$),$+=ae.byteLength}}}else W[0]=0;k.s11n.serialize.time+=performance.now()-pe},u.s11n},ne=function A(N=16){A._chars||(A._chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012346789",A._n=A._chars.length);const W=[];let J=0;for(;J<N;++J){const G=Math.random()*(A._n*64)%A._n|0;W[J]=A._chars[G]}return W.join("")},se=Object.create(null),M=Object.create(null);M.op=void 0,M.start=void 0;const b=A=>{M.start=performance.now(),M.op=A,++k[A].count},I=()=>k[M.op].time+=performance.now()-M.start,j={xCheckReservedLock:function(A,N){return E.poke(N,0,"i32"),0},xClose:function(A){b("xClose");let N=0;const W=se[A];return W&&(delete se[A],N=z("xClose",A),W.sq3File&&W.sq3File.dispose()),I(),N},xDeviceCharacteristics:function(A){return q.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN},xFileControl:function(A,N,W){return q.SQLITE_NOTFOUND},xFileSize:function(A,N){b("xFileSize");let W=z("xFileSize",A);if(W==0)try{const J=u.s11n.deserialize()[0];E.poke(N,J,"i64")}catch(J){S("Unexpected error reading xFileSize() result:",J),W=u.sq3Codes.SQLITE_IOERR}return I(),W},xLock:function(A,N){b("xLock");const W=se[A];let J=0;return W.lockType?W.lockType=N:(J=z("xLock",A,N),J===0&&(W.lockType=N)),I(),J},xRead:function(A,N,W,J){b("xRead");const G=se[A];let te;try{te=z("xRead",A,W,Number(J)),(te===0||q.SQLITE_IOERR_SHORT_READ===te)&&E.heap8u().set(G.sabView.subarray(0,W),N)}catch(oe){S("xRead(",arguments,") failed:",oe,G),te=q.SQLITE_IOERR_READ}return I(),te},xSync:function(A,N){b("xSync"),++k.xSync.count;const W=z("xSync",A,N);return I(),W},xTruncate:function(A,N){b("xTruncate");const W=z("xTruncate",A,Number(N));return I(),W},xUnlock:function(A,N){b("xUnlock");const W=se[A];let J=0;return q.SQLITE_LOCK_NONE===N&&W.lockType&&(J=z("xUnlock",A,N)),J===0&&(W.lockType=N),I(),J},xWrite:function(A,N,W,J){b("xWrite");const G=se[A];let te;try{G.sabView.set(E.heap8u().subarray(N,N+W)),te=z("xWrite",A,W,Number(J))}catch(oe){S("xWrite(",arguments,") failed:",oe,G),te=q.SQLITE_IOERR_WRITE}return I(),te}},H={xAccess:function(A,N,W,J){b("xAccess");const G=z("xAccess",E.cstrToJs(N));return E.poke(J,G?0:1,"i32"),I(),0},xCurrentTime:function(A,N){return E.poke(N,24405875e-1+new Date().getTime()/864e5,"double"),0},xCurrentTimeInt64:function(A,N){return E.poke(N,24405875e-1*864e5+new Date().getTime(),"i64"),0},xDelete:function(A,N,W){b("xDelete");const J=z("xDelete",E.cstrToJs(N),W,!1);return I(),J},xFullPathname:function(A,N,W,J){return E.cstrncpy(J,N,W)<W?0:q.SQLITE_CANTOPEN},xGetLastError:function(A,N,W){return T("OPFS xGetLastError() has nothing sensible to return."),0},xOpen:function(N,W,J,G,te){b("xOpen");let oe=0;W===0?W=ne():E.isPtr(W)&&(q.sqlite3_uri_boolean(W,"opfs-unlock-asap",0)&&(oe|=u.opfsFlags.OPFS_UNLOCK_ASAP),q.sqlite3_uri_boolean(W,"delete-before-open",0)&&(oe|=u.opfsFlags.OPFS_UNLINK_BEFORE_OPEN),W=E.cstrToJs(W));const Y=Object.create(null);Y.fid=J,Y.filename=W,Y.sab=new SharedArrayBuffer(u.fileBufferSize),Y.flags=G,Y.readOnly=!(t.SQLITE_OPEN_CREATE&G)&&!!(G&q.SQLITE_OPEN_READONLY);const pe=z("xOpen",J,W,G,oe);return pe||(Y.readOnly&&E.poke(te,q.SQLITE_OPEN_READONLY,"i32"),se[J]=Y,Y.sabView=u.sabFileBufView,Y.sq3File=new L(J),Y.sq3File.$pMethods=c.pointer,Y.lockType=q.SQLITE_LOCK_NONE),I(),pe}};_&&(d.$xRandomness=_.$xRandomness,d.$xSleep=_.$xSleep),d.$xRandomness||(H.xRandomness=function(A,N,W){const J=E.heap8u();let G=0;for(;G<N;++G)J[W+G]=Math.random()*255e3&255;return G}),d.$xSleep||(H.xSleep=function(A,N){return Atomics.wait(u.sabOPView,u.opIds.xSleep,0,N),0}),P.getResolvedPath=function(A,N){const W=new URL(A,"file://irrelevant").pathname;return N?W.split("/").filter(J=>!!J):W},P.getDirForFilename=async function(N,W=!1){const J=P.getResolvedPath(N,!0),G=J.pop();let te=P.rootDirectory;for(const oe of J)oe&&(te=await te.getDirectoryHandle(oe,{create:!!W}));return[te,G]},P.mkdir=async function(A){try{return await P.getDirForFilename(A+"/filepart",!0),!0}catch{return!1}},P.entryExists=async function(A){try{const[N,W]=await P.getDirForFilename(A);return await N.getFileHandle(W),!0}catch{return!1}},P.randomFilename=ne,P.treeList=async function(){const A=async function W(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 W(te,oe)}else G.files.push(te.name)},N=Object.create(null);return await A(P.rootDirectory,N),N},P.rmfr=async function(){const A=P.rootDirectory,N={recurse:!0};for await(const W of A.values())A.removeEntry(W.name,N)},P.unlink=async function(A,N=!1,W=!1){try{const[J,G]=await P.getDirForFilename(A,!1);return await J.removeEntry(G,{recursive:N}),!0}catch(J){if(W)throw new Error("unlink(",arguments[0],") failed: "+J.message,{cause:J});return!1}},P.traverse=async function(A){const N={recursive:!0,directory:P.rootDirectory};typeof A=="function"&&(A={callback:A}),A=Object.assign(N,A||{}),async function J(G,te){for await(const oe of G.values()){if(A.callback(oe,G,te)===!1)return!1;if(A.recursive&&oe.kind==="directory"&&await J(oe,te+1)===!1)break}}(A.directory,0)};const ee=async function(A,N){const[W,J]=await P.getDirForFilename(A,!0);let te=await(await W.getFileHandle(J,{create:!0})).createSyncAccessHandle(),oe=0,Y,pe=!1;try{for(te.truncate(0);(Y=await N())!==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)&&C("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 W.removeEntry(J).catch(()=>{}),F}finally{te&&await te.close()}};if(P.importDb=async function(A,N){if(N instanceof Function)return ee(A,N);N instanceof ArrayBuffer&&(N=new Uint8Array(N)),w.affirmIsDb(N);const W=N.byteLength,[J,G]=await P.getDirForFilename(A,!0);let te,oe=0;try{return te=await(await J.getFileHandle(G,{create:!0})).createSyncAccessHandle(),te.truncate(0),oe=te.write(N,{at:0}),oe!=W&&C("Expected to write "+W+" 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 A=function(...N){const W=t.oo1.DB.dbCtorHelper.normalizeArgs(...N);W.vfs=d.$zName,t.oo1.DB.dbCtorHelper.call(this,W)};A.prototype=Object.create(t.oo1.DB.prototype),t.oo1.OpfsDb=A,A.importDb=P.importDb,t.oo1.DB.dbCtorHelper.setVfsPostOpenCallback(d.pointer,function(N,W){W.capi.sqlite3_busy_timeout(N,1e4)})}const re=function(){const A=E.scopedAllocPush(),N=new L;try{const W=N.pointer,J=q.SQLITE_OPEN_CREATE|q.SQLITE_OPEN_READWRITE|q.SQLITE_OPEN_MAIN_DB,G=E.scopedAlloc(8),te="/sanity/check/file"+ne(8),oe=E.scopedAllocCString(te);let Y;if(u.s11n.serialize("This is ä string."),Y=u.s11n.deserialize(),Q("deserialize() says:",Y),Y[0]!=="This is ä string."&&C("String d13n error."),H.xAccess(d.pointer,oe,0,G),Y=E.peek(G,"i32"),Q("xAccess(",te,") exists ?=",Y),Y=H.xOpen(d.pointer,oe,W,J,G),Q("open rc =",Y,"state.sabOPView[xOpen] =",u.sabOPView[u.opIds.xOpen]),Y!==0){S("open failed with code",Y);return}H.xAccess(d.pointer,oe,0,G),Y=E.peek(G,"i32"),Y||C("xAccess() failed to detect file."),Y=j.xSync(N.pointer,0),Y&&C("sync failed w/ rc",Y),Y=j.xTruncate(N.pointer,1024),Y&&C("truncate failed w/ rc",Y),E.poke(G,0,"i64"),Y=j.xFileSize(N.pointer,G),Y&&C("xFileSize failed w/ rc",Y),Q("xFileSize says:",E.peek(G,"i64")),Y=j.xWrite(N.pointer,oe,10,1),Y&&C("xWrite() failed!");const pe=E.scopedAlloc(16);Y=j.xRead(N.pointer,pe,6,2),E.poke(pe+6,0);let F=E.cstrToJs(pe);Q("xRead() got:",F),F!=="sanity"&&C("Unexpected xRead() value."),H.xSleep&&(Q("xSleep()ing before close()ing..."),H.xSleep(d.pointer,2e3),Q("waking up from xSleep()")),Y=j.xClose(W),Q("xClose rc =",Y,"sabOPView =",u.sabOPView),Q("Deleting file:",te),H.xDelete(d.pointer,oe,4660),H.xAccess(d.pointer,oe,0,G),Y=E.peek(G,"i32"),Y&&C("Expecting 0 from xAccess(",te,") after xDelete()."),T("End of OPFS sanity checks.")}finally{N.dispose(),E.scopedAllocPop(A)}};p.onmessage=function({data:A}){switch(A.type){case"opfs-unavailable":B(new Error(A.payload.join(" ")));break;case"opfs-async-loaded":p.postMessage({type:"opfs-async-init",args:u});break;case"opfs-async-inited":{if(y===!0)break;try{t.vfs.installVfs({io:{struct:c,methods:j},vfs:{struct:d,methods:H}}),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),Z(),s.sanityChecks&&(T("Running sanity checks because of opfs-sanity-check URL arg..."),re()),K()?navigator.storage.getDirectory().then(N=>{p.onerror=p._originalOnError,delete p._originalOnError,t.opfs=P,P.rootDirectory=N,Q("End of OPFS sqlite3_vfs setup.",d),f()}).catch(B):f()}catch(N){S(N),B(N)}break}default:{const N="Unexpected message from the OPFS async worker: "+JSON.stringify(A);S(N),B(new Error(N));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,h=t.util,g=t.wasm,O=4096,D=512,U=4,Q=8,T=D+U,S=D,C=T,q=O,w=o.SQLITE_OPEN_MAIN_DB|o.SQLITE_OPEN_MAIN_JOURNAL|o.SQLITE_OPEN_SUPER_JOURNAL|o.SQLITE_OPEN_WAL,E=".opaque",R=()=>Math.random().toString(36).slice(2),L=new TextDecoder,x=new TextEncoder,P=Object.assign(Object.create(null),{name:"opfs-sahpool",directory:void 0,initialCapacity:6,clearOnInit:!1,verbosity:2,forceReinitIfPreviouslyFailed:!1}),K=[t.config.error,t.config.warn,t.config.log];t.config.log;const c=t.config.warn;t.config.error;const d=new Map,y=M=>d.get(M),B=(M,b)=>{b?d.set(M,b):d.delete(M)},f=new Map,p=M=>f.get(M),l=(M,b)=>{b?f.set(M,b):f.delete(M)},_={xCheckReservedLock:function(M,b){const I=p(M);return I.log("xCheckReservedLock"),I.storeErr(),g.poke32(b,1),0},xClose:function(M){const b=p(M);b.storeErr();const I=b.getOFileForS3File(M);if(I)try{b.log(`xClose ${I.path}`),b.mapS3FileToOFile(M,!1),I.sah.flush(),I.flags&o.SQLITE_OPEN_DELETEONCLOSE&&b.deletePath(I.path)}catch(j){return b.storeErr(j,o.SQLITE_IOERR)}return 0},xDeviceCharacteristics:function(M){return o.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN},xFileControl:function(M,b,I){return o.SQLITE_NOTFOUND},xFileSize:function(M,b){const I=p(M);I.log("xFileSize");const H=I.getOFileForS3File(M).sah.getSize()-q;return g.poke64(b,BigInt(H)),0},xLock:function(M,b){const I=p(M);I.log(`xLock ${b}`),I.storeErr();const j=I.getOFileForS3File(M);return j.lockType=b,0},xRead:function(M,b,I,j){const H=p(M);H.storeErr();const ee=H.getOFileForS3File(M);H.log(`xRead ${ee.path} ${I} @ ${j}`);try{const re=ee.sah.read(g.heap8u().subarray(b,b+I),{at:q+Number(j)});return re<I?(g.heap8u().fill(0,b+re,b+I),o.SQLITE_IOERR_SHORT_READ):0}catch(re){return H.storeErr(re,o.SQLITE_IOERR)}},xSectorSize:function(M){return O},xSync:function(M,b){const I=p(M);I.log(`xSync ${b}`),I.storeErr();const j=I.getOFileForS3File(M);try{return j.sah.flush(),0}catch(H){return I.storeErr(H,o.SQLITE_IOERR)}},xTruncate:function(M,b){const I=p(M);I.log(`xTruncate ${b}`),I.storeErr();const j=I.getOFileForS3File(M);try{return j.sah.truncate(q+Number(b)),0}catch(H){return I.storeErr(H,o.SQLITE_IOERR)}},xUnlock:function(M,b){const I=p(M);I.log("xUnlock");const j=I.getOFileForS3File(M);return j.lockType=b,0},xWrite:function(M,b,I,j){const H=p(M);H.storeErr();const ee=H.getOFileForS3File(M);H.log(`xWrite ${ee.path} ${I} ${j}`);try{const re=ee.sah.write(g.heap8u().subarray(b,b+I),{at:q+Number(j)});return I===re?0:n("Unknown write() failure.")}catch(re){return H.storeErr(re,o.SQLITE_IOERR)}}},u=new o.sqlite3_io_methods;u.$iVersion=1,t.vfs.installVfs({io:{struct:u,methods:_}});const k={xAccess:function(M,b,I,j){const H=y(M);H.storeErr();try{const ee=H.getPath(b);g.poke32(j,H.hasFilename(ee)?1:0)}catch{g.poke32(j,0)}return 0},xCurrentTime:function(M,b){return g.poke(b,24405875e-1+new Date().getTime()/864e5,"double"),0},xCurrentTimeInt64:function(M,b){return g.poke(b,24405875e-1*864e5+new Date().getTime(),"i64"),0},xDelete:function(M,b,I){const j=y(M);j.log(`xDelete ${g.cstrToJs(b)}`),j.storeErr();try{return j.deletePath(j.getPath(b)),0}catch(H){return j.storeErr(H),o.SQLITE_IOERR_DELETE}},xFullPathname:function(M,b,I,j){return g.cstrncpy(j,b,I)<I?0:o.SQLITE_CANTOPEN},xGetLastError:function(M,b,I){const j=y(M),H=j.popErr();if(j.log(`xGetLastError ${b} e =`,H),H){const ee=g.scopedAllocPush();try{const[re,A]=g.scopedAllocCString(H.message,!0);g.cstrncpy(I,re,b),A>b&&g.poke8(I+b-1,0)}catch{return o.SQLITE_NOMEM}finally{g.scopedAllocPop(ee)}}return H?H.sqlite3Rc||o.SQLITE_IOERR:0},xOpen:function(b,I,j,H,ee){const re=y(b);try{re.log(`xOpen ${g.cstrToJs(I)} ${H}`);const A=I&&g.peek8(I)?re.getPath(I):R();let N=re.getSAHForPath(A);!N&&H&o.SQLITE_OPEN_CREATE&&(re.getFileCount()<re.getCapacity()?(N=re.nextAvailableSAH(),re.setAssociatedPath(N,A,H)):n("SAH pool is full. Cannot create file",A)),N||n("file not found:",A);const W={path:A,flags:H,sah:N};re.mapS3FileToOFile(j,W),W.lockType=o.SQLITE_LOCK_NONE;const J=new o.sqlite3_file(j);return J.$pMethods=u.pointer,J.dispose(),g.poke32(ee,H),0}catch(A){return re.storeErr(A),o.SQLITE_CANTOPEN}}},z=function(M){t.capi.sqlite3_vfs_find(M)&&r("VFS name is already registered:",M);const b=new o.sqlite3_vfs,I=o.sqlite3_vfs_find(null),j=I?new o.sqlite3_vfs(I):null;return b.$iVersion=2,b.$szOsFile=o.sqlite3_file.structInfo.sizeof,b.$mxPathname=D,b.addOnDispose(b.$zName=g.allocCString(M),()=>B(b.pointer,0)),j&&(b.$xRandomness=j.$xRandomness,b.$xSleep=j.$xSleep,j.dispose()),!b.$xRandomness&&!k.xRandomness&&(k.xRandomness=function(H,ee,re){const A=g.heap8u();let N=0;for(;N<ee;++N)A[re+N]=Math.random()*255e3&255;return N}),!b.$xSleep&&!k.xSleep&&(k.xSleep=(H,ee)=>0),t.vfs.installVfs({vfs:{struct:b,methods:k}}),b};class Z{vfsDir;#e;#i;#l;#r=new Map;#t=new Map;#s=new Set;#a=new Map;#n=new Uint8Array(T);#c;#o;#u;constructor(b=Object.create(null)){this.#u=b.verbosity??P.verbosity,this.vfsName=b.name||P.name,this.#o=z(this.vfsName),B(this.#o.pointer,this),this.vfsDir=b.directory||"."+this.vfsName,this.#c=new DataView(this.#n.buffer,this.#n.byteOffset),this.isReady=this.reset(!!(b.clearOnInit??P.clearOnInit)).then(()=>{if(this.$error)throw this.$error;return this.getCapacity()?Promise.resolve(void 0):this.addCapacity(b.initialCapacity||P.initialCapacity)})}#_(b,...I){this.#u>b&&K[b](this.vfsName+":",...I)}log(...b){this.#_(2,...b)}warn(...b){this.#_(1,...b)}error(...b){this.#_(0,...b)}getVfs(){return this.#o}getCapacity(){return this.#r.size}getFileCount(){return this.#t.size}getFileNames(){const b=[],I=this.#t.keys();for(const j of I)b.push(j);return b}async addCapacity(b){for(let I=0;I<b;++I){const j=R(),ee=await(await this.#i.getFileHandle(j,{create:!0})).createSyncAccessHandle();this.#r.set(ee,j),this.setAssociatedPath(ee,"",0)}return this.getCapacity()}async reduceCapacity(b){let I=0;for(const j of Array.from(this.#s)){if(I===b||this.getFileCount()===this.getCapacity())break;const H=this.#r.get(j);j.close(),await this.#i.removeEntry(H),this.#r.delete(j),this.#s.delete(j),++I}return I}releaseAccessHandles(){for(const b of this.#r.keys())b.close();this.#r.clear(),this.#t.clear(),this.#s.clear()}async acquireAccessHandles(b){const I=[];for await(const[j,H]of this.#i)H.kind==="file"&&I.push([j,H]);return Promise.all(I.map(async([j,H])=>{try{const ee=await H.createSyncAccessHandle();if(this.#r.set(ee,j),b)ee.truncate(q),this.setAssociatedPath(ee,"",0);else{const re=this.getAssociatedPath(ee);re?this.#t.set(re,ee):this.#s.add(ee)}}catch(ee){throw this.storeErr(ee),this.releaseAccessHandles(),ee}}))}getAssociatedPath(b){b.read(this.#n,{at:0});const I=this.#c.getUint32(S);if(this.#n[0]&&(I&o.SQLITE_OPEN_DELETEONCLOSE||(I&w)===0))return c(`Removing file with unexpected flags ${I.toString(16)}`,this.#n),this.setAssociatedPath(b,"",0),"";const j=new Uint32Array(Q/4);b.read(j,{at:C});const H=this.computeDigest(this.#n);if(j.every((ee,re)=>ee===H[re])){const ee=this.#n.findIndex(re=>re===0);return ee===0&&b.truncate(q),ee?L.decode(this.#n.subarray(0,ee)):""}else return c("Disassociating file with bad digest."),this.setAssociatedPath(b,"",0),""}setAssociatedPath(b,I,j){const H=x.encodeInto(I,this.#n);D<=H.written+1&&n("Path too long:",I),this.#n.fill(0,H.written,D),this.#c.setUint32(S,j);const ee=this.computeDigest(this.#n);b.write(this.#n,{at:0}),b.write(ee,{at:C}),b.flush(),I?(this.#t.set(I,b),this.#s.delete(b)):(b.truncate(q),this.#s.add(b))}computeDigest(b){let I=3735928559,j=1103547991;for(const H of b)I=31*I+H*307,j=31*j+H*307;return new Uint32Array([I>>>0,j>>>0])}async reset(b){await this.isReady;let I=await navigator.storage.getDirectory(),j;for(const H of this.vfsDir.split("/"))H&&(j=I,I=await I.getDirectoryHandle(H,{create:!0}));return this.#e=I,this.#l=j,this.#i=await this.#e.getDirectoryHandle(E,{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 I=this.#t.get(b);return I&&(this.#t.delete(b),this.setAssociatedPath(I,"",0)),!!I}storeErr(b,I){return b&&(b.sqlite3Rc=I||o.SQLITE_IOERR,this.error(b)),this.$error=b,I}popErr(){const b=this.$error;return this.$error=void 0,b}nextAvailableSAH(){const[b]=this.#s.keys();return b}getOFileForS3File(b){return this.#a.get(b)}mapS3FileToOFile(b,I){I?(this.#a.set(b,I),l(b,this)):(this.#a.delete(b),l(b,!1))}hasFilename(b){return this.#t.has(b)}getSAHForPath(b){return this.#t.get(b)}async removeVfs(){if(!this.#o.pointer||!this.#i)return!1;o.sqlite3_vfs_unregister(this.#o.pointer),this.#o.dispose(),delete s[this.vfsName];try{this.releaseAccessHandles(),await this.#e.removeEntry(E,{recursive:!0}),this.#i=void 0,await this.#l.removeEntry(this.#e.name,{recursive:!0}),this.#e=this.#l=void 0}catch(b){t.config.error(this.vfsName,"removeVfs() failed:",b)}return!0}exportFile(b){const I=this.#t.get(b)||n("File not found:",b),j=I.getSize()-q,H=new Uint8Array(j>0?j:0);if(j>0){const ee=I.read(H,{at:q});ee!=j&&n("Expected to read "+j+" bytes but read "+ee+".")}return H}async importDbChunked(b,I){const j=this.#t.get(b)||this.nextAvailableSAH()||n("No available handles to import to.");j.truncate(0);let H=0,ee,re=!1;try{for(;(ee=await I())!==void 0;)ee instanceof ArrayBuffer&&(ee=new Uint8Array(ee)),H===0&&ee.byteLength>=15&&(h.affirmDbHeader(ee),re=!0),j.write(ee,{at:q+H}),H+=ee.byteLength;if((H<512||H%512!==0)&&n("Input size",H,"is not correct for an SQLite database."),!re){const A=new Uint8Array(20);j.read(A,{at:0}),h.affirmDbHeader(A)}j.write(new Uint8Array([1,1]),{at:q+18})}catch(A){throw this.setAssociatedPath(j,"",0),A}return this.setAssociatedPath(j,b,o.SQLITE_OPEN_MAIN_DB),H}importDb(b,I){if(I instanceof ArrayBuffer)I=new Uint8Array(I);else if(I instanceof Function)return this.importDbChunked(b,I);const j=this.#t.get(b)||this.nextAvailableSAH()||n("No available handles to import to."),H=I.byteLength;(H<512||H%512!=0)&&n("Byte array size is invalid for an SQLite db.");const ee="SQLite format 3";for(let A=0;A<ee.length;++A)ee.charCodeAt(A)!==I[A]&&n("Input does not contain an SQLite database header.");const re=j.write(I,{at:q});return re!=H?(this.setAssociatedPath(j,"",0),n("Expected to write "+H+" bytes but wrote "+re+".")):(j.write(new Uint8Array([1,1]),{at:q+18}),this.setAssociatedPath(j,b,o.SQLITE_OPEN_MAIN_DB)),re}}class ne{#e;constructor(b){this.#e=b,this.vfsName=b.vfsName}async addCapacity(b){return this.#e.addCapacity(b)}async reduceCapacity(b){return this.#e.reduceCapacity(b)}getCapacity(){return this.#e.getCapacity(this.#e)}getFileCount(){return this.#e.getFileCount()}getFileNames(){return this.#e.getFileNames()}async reserveMinimumCapacity(b){const I=this.#e.getCapacity();return I<b?this.#e.addCapacity(b-I):I}exportFile(b){return this.#e.exportFile(b)}importDb(b,I){return this.#e.importDb(b,I)}async wipeFiles(){return this.#e.reset(!0)}unlink(b){return this.#e.deletePath(b)}async removeVfs(){return this.#e.removeVfs()}}const se=async()=>{const M=await navigator.storage.getDirectory(),b=".opfs-sahpool-sync-check-"+R(),H=(await(await M.getFileHandle(b,{create:!0})).createSyncAccessHandle()).close();return await H,await M.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(M=Object.create(null)){M=Object.assign(Object.create(null),P,M||{});const b=M.name;if(M.$testThrowPhase1)throw M.$testThrowPhase1;if(s[b])try{return await s[b]}catch(I){if(M.forceReinitIfPreviouslyFailed)delete s[b];else throw I}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(M.$testThrowPhase2)throw M.$testThrowPhase2;const I=new Z(M);return I.isReady.then(async()=>{const j=new ne(I);if(t.oo1){const H=t.oo1,ee=I.getVfs(),re=function(...A){const N=H.DB.dbCtorHelper.normalizeArgs(...A);N.vfs=ee.$zName,H.DB.dbCtorHelper.call(this,N)};re.prototype=Object.create(H.DB.prototype),j.OpfsSAHPoolDb=re}return I.log("VFS initialized."),j}).catch(async j=>{throw await I.removeVfs().catch(()=>{}),j})}).catch(I=>s[b]=Promise.reject(I))}}),typeof e<"u"){const t=Object.assign(Object.create(null),{exports:typeof m>"u"?e.asm:m,memory:e.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}e.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=Je,be}})();Ke=function(){const Ae=Ke;if(!Ae)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 Ae(...i).then(ke=>{const ve=ke.sqlite3;ve.scriptInfo=qe,be.__isUnderTest&&(ve.__isUnderTest=!0);const Je=ve.asyncPostInit;return delete ve.asyncPostInit,Je()}).catch(ke=>{throw console.error("Exception loading sqlite3 module:",ke),ke})},globalThis.sqlite3InitModule.ready=Ae.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}();var kt=Ke;kt().then(Ae=>Ae.initWorker1API())})();
//# sourceMappingURL=sqlite3-worker1-bundler-friendly-CvUdoCBR.js.map