PageSourceSearch

https://writizzy.com/_nuxt/T2L9HmWL.js

js writizzy.com collected 2026-10-03 19:50:05 UTC 214,269 bytes, 3 lines download raw bytes

1import"./fbR8JyA_.js";globalThis.sqlite3Worker1Promiser=function je(fe=je.defaultConfig){if(arguments.length===1&&typeof arguments[0]=="function"){const de=fe;fe=Object.assign(Object.create(null),je.defaultConfig),fe.onready=de}else fe=Object.assign(Object.create(null),je.defaultConfig,fe);const f=Object.create(null),Oe=function(){},Qe=fe.onerror||Oe,Fe=fe.debug||Oe,He=fe.generateMessageId?void 0:Object.create(null),ct=fe.generateMessageId||function(de){return de.type+"#"+(He[de.type]=(He[de.type]||0)+1)},mt=(...de)=>{throw new Error(de.join(" "))};fe.worker||(fe.worker=je.defaultConfig.worker),typeof fe.worker=="function"&&(fe.worker=fe.worker());let Ge,Xe;return fe.worker.onmessage=function(de){de=de.data,Fe("worker1.onmessage",de);let Ie=f[de.messageId];if(!Ie){if(de&&de.type==="sqlite3-api"&&de.result==="worker1-ready"){fe.onready&&fe.onready(Xe);return}if(Ie=f[de.type],Ie&&Ie.onrow){Ie.onrow(de);return}fe.onunhandled?fe.onunhandled(arguments[0]):Qe("sqlite3Worker1Promiser() unhandled worker message:",de);return}switch(delete f[de.messageId],de.type){case"error":Ie.reject(de);return;case"open":Ge||(Ge=de.dbId);break;case"close":de.dbId===Ge&&(Ge=void 0);break}try{Ie.resolve(de)}catch(ze){Ie.reject(ze)}},Xe=function(){let de;arguments.length===1?de=arguments[0]:arguments.length===2?(de=Object.create(null),de.type=arguments[0],de.args=arguments[1],de.dbId=de.args.dbId):mt("Invalid arguments for sqlite3Worker1Promiser()-created factory."),!de.dbId&&de.type!=="open"&&(de.dbId=Ge),de.messageId=ct(de),de.departureTime=performance.now();const Ie=Object.create(null);Ie.message=de;let ze;de.type==="exec"&&de.args&&(typeof de.args.callback=="function"?(ze=de.messageId+":row",Ie.onrow=de.args.callback,de.args.callback=ze,f[ze]=Ie):typeof de.args.callback=="string"&&mt("exec callback may not be a string when using the Promise interface."));let it=new Promise(function(gt,bt){Ie.resolve=gt,Ie.reject=bt,f[de.messageId]=Ie,Fe("Posting",de.type,"message to Worker dbId="+(Ge||"default")+":",de),fe.worker.postMessage(de)});return ze&&(it=it.finally(()=>delete f[ze])),it}};globalThis.sqlite3Worker1Promiser.defaultConfig={worker:function(){return new Worker(new URL(""+new URL("sqlite3-worker1-DD6_Km2m.js",import.meta.url).href,import.meta.url),{type:"module"})},onerror:(...je)=>{}};globalThis.sqlite3Worker1Promiser.v2=(function je(fe=je.defaultConfig){let f;typeof fe=="function"?(f=fe,fe={}):typeof fe?.onready=="function"&&(f=fe.onready,delete fe.onready);const Oe=Object.create(null);fe=Object.assign(fe||Object.create(null),{onready:async function(Fe){try{f&&await f(Fe),Oe.resolve(Fe)}catch(He){Oe.reject(He)}}});const Qe=new Promise(function(Fe,He){Oe.resolve=Fe,Oe.reject=He});try{this.original(fe)}catch(Fe){Oe.reject(Fe)}return Qe}).bind({original:sqlite3Worker1Promiser});globalThis.sqlite3Worker1Promiser.v2.defaultConfig=globalThis.sqlite3Worker1Promiser.defaultConfig;var br=sqlite3Worker1Promiser.v2;delete globalThis.sqlite3Worker1Promiser;async function Ot(je={}){var fe,f=je,Oe=!!globalThis.window,Qe=!!globalThis.WorkerGlobalScope;globalThis.process?.versions?.node&&globalThis.process?.type;var Fe="./this.program",He=import.meta.url,ct="";function mt(e){return f.locateFile?f.locateFile(e,ct):ct+e}var Ge,Xe;if(Oe||Qe){try{ct=new URL(".",He).href}catch{}Qe&&(Xe=e=>{var n=new XMLHttpRequest;return n.open("GET",e,!1),n.responseType="arraybuffer",n.send(null),new Uint8Array(n.response)}),Ge=async e=>{var n=await fetch(e,{credentials:"same-origin"});if(n.ok)return n.arrayBuffer();throw new Error(n.status+" : "+n.url)}}var de=(()=>{}).bind(console),Ie=(()=>{}).bind(console),ze,it=!1,gt,bt,xt=!1;function Pt(){var e=Ke.buffer;Be=new Int8Array(e),ut=new Int16Array(e),Ye=new Uint8Array(e),ve=new Int32Array(e),Ae=new Uint32Array(e),Ce=new BigInt64Array(e),new BigUint64Array(e)}function Zt(){if(f.wasmMemory)Ke=f.wasmMemory;else{var e=f.INITIAL_MEMORY||8388608;Ke=new WebAssembly.Memory({initial:e/65536,maximum:32768})}Pt()}function en(){if(f.preRun)for(typeof f.preRun=="function"&&(f.preRun=[f.preRun]);f.preRun.length;)fn(f.preRun.shift());Ft(Ct)}function tn(){xt=!0,!f.noFSInit&&!a.initialized&&a.init(),lt.__wasm_call_ctors(),a.ignorePermissions=!1}function nn(){if(f.postRun)for(typeof f.postRun=="function"&&(f.postRun=[f.postRun]);f.postRun.length;)_n(f.postRun.shift());Ft(Lt)}function $e(e){f.onAbort?.(e),e=`Aborted(${e})`,Ie(e),it=!0,e+=". Build with -sASSERTIONS for more info.";var n=new WebAssembly.RuntimeError(e);throw bt?.(n),n}var wt;function rn(){return f.locateFile?mt("sqlite3.wasm"):new URL(""+new URL("sqlite3.BVKGSWc-.wasm",import.meta.url).href,import.meta.url).href}function sn(e){if(e==wt&&ze)return new Uint8Array(ze);if(Xe)return Xe(e);throw"both async and sync fetching of the wasm failed"}async function on(e){if(!ze)try{var n=await Ge(e);return new Uint8Array(n)}catch{}return sn(e)}async function ln(e,n){try{var l=await on(e);return await WebAssembly.instantiate(l,n)}catch(i){Ie(`failed to asynchronously prepare wasm: ${i}`),$e(i)}}async function an(e,n,l){if(!e)try{var i=fetch(n,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(i,l)}catch(t){Ie(`wasm streaming compile failed: ${t}`),Ie("falling back to ArrayBuffer instantiation")}return ln(n,l)}function cn(){return{env:Kt,wasi_snapshot_preview1:Kt}}async function un(){function e(i,t){return lt=i.exports,pr(lt),lt}function n(i){return e(i.instance)}var l=cn();return f.instantiateWasm?new Promise((i,t)=>{f.instantiateWasm(l,(r,s)=>{i(e(r))})}):(wt??=rn(),n(await an(ze,wt,l)))}var ut,ve,Ce,Be,Ae,Ye,Ft=e=>{for(;e.length>0;)e.shift()(f)},Lt=[],_n=e=>Lt.push(e),Ct=[],fn=e=>Ct.push(e),Ke,Se={isAbs:e=>e.charAt(0)==="/",splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,n)=>{for(var l=0,i=e.length-1;i>=0;i--){var t=e[i];t==="."?e.splice(i,1):t===".."?(e.splice(i,1),l++):l&&(e.splice(i,1),l--)}if(n)for(;l;l--)e.unshift("..");return e},normalize:e=>{var n=Se.isAbs(e),l=e.slice(-1)==="/";return e=Se.normalizeArray(e.split("/").filter(i=>!!i),!n).join("/"),!e&&!n&&(e="."),e&&l&&(e+="/"),(n?"/":"")+e},dirname:e=>{var n=Se.splitPath(e),l=n[0],i=n[1];return!l&&!i?".":(i&&(i=i.slice(0,-1)),l+i)},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>
1Se.normalize(e.join("/")),join2:(e,n)=>Se.normalize(e+"/"+n)},dn=()=>e=>(crypto.getRandomValues(e),0),Nt=e=>(Nt=dn())(e),st={resolve:(...e)=>{for(var n="",l=!1,i=e.length-1;i>=-1&&!l;i--){var t=i>=0?e[i]:a.cwd();if(typeof t!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!t)return"";n=t+"/"+n,l=Se.isAbs(t)}return n=Se.normalizeArray(n.split("/").filter(r=>!!r),!l).join("/"),(l?"/":"")+n||"."},relative:(e,n)=>{e=st.resolve(e).slice(1),n=st.resolve(n).slice(1);function l(b){for(var z=0;z<b.length&&b[z]==="";z++);for(var I=b.length-1;I>=0&&b[I]==="";I--);return z>I?[]:b.slice(z,I-z+1)}for(var i=l(e.split("/")),t=l(n.split("/")),r=Math.min(i.length,t.length),s=r,_=0;_<r;_++)if(i[_]!==t[_]){s=_;break}for(var c=[],_=s;_<i.length;_++)c.push("..");return c=c.concat(t.slice(s)),c.join("/")}},Rt=new TextDecoder,Dt=(e,n,l,i)=>{for(var t=n+l;e[n]&&!(n>=t);)++n;return n},_t=(e,n=0,l,i)=>{var t=Dt(e,n,l);return Rt.decode(e.buffer?e.subarray(n,t):new Uint8Array(e.slice(n,t)))},Et=[],yt=e=>{for(var n=0,l=0;l<e.length;++l){var i=e.charCodeAt(l);i<=127?n++:i<=2047?n+=2:i>=55296&&i<=57343?(n+=4,++l):n+=3}return n},jt=(e,n,l,i)=>{if(!(i>0))return 0;for(var t=l,r=l+i-1,s=0;s<e.length;++s){var _=e.codePointAt(s);if(_<=127){if(l>=r)break;n[l++]=_}
vendor: 21,803 bytes, lines 1-2
1else if(_<=2047){if(l+1>=r)break;n[l++]=192|_>>6,n[l++]=128|_&63}else if(_<=65535){if(l+2>=r)break;n[l++]=224|_>>12,n[l++]=128|_>>6&63,n[l++]=128|_&63}else{if(l+3>=r)break;n[l++]=240|_>>18,n[l++]=128|_>>12&63,n[l++]=128|_>>6&63,n[l++]=128|_&63,s++}}return n[l]=0,l-t},At=(e,n,l)=>{var i=yt(e)+1,t=new Array(i),r=jt(e,t,0,t.length);return t.length=r,t},pn=()=>{if(!Et.length){var e=null;if(globalThis.window?.prompt&&(e=window.prompt("Input: "),e!==null&&(e+=`
2`)),!e)return null;Et=At(e)}return Et.shift()},Ze={ttys:[],init(){},shutdown(){},register(e,n){Ze.ttys[e]={input:[],output:[],ops:n},a.registerDevice(e,Ze.stream_ops)},stream_ops:{open(e){var n=Ze.ttys[e.node.rdev];if(!n)throw new a.ErrnoError(43);e.tty=n,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,n,l,i,t){if(!e.tty||!e.tty.ops.get_char)throw new a.ErrnoError(60);for(var r=0,s=0;s<i;s++){var _;try{_=e.tty.ops.get_char(e.tty)}catch{throw new a.ErrnoError(29)}if(_===void 0&&r===0)throw new a.ErrnoError(6);if(_==null)break;r++,n[l+s]=_}return r&&(e.node.atime=Date.now()),r},write(e,n,l,i,t){if(!e.tty||!e.tty.ops.put_char)throw new a.ErrnoError(60);try{for(var r=0;r<i;r++)e.tty.ops.put_char(e.tty,n[l+r])}catch{throw new a.ErrnoError(29)}return i&&(e.node.mtime=e.node.ctime=Date.now()),r}},default_tty_ops:{get_char(e){return pn()},put_char(e,n){n===null||n===10?(de(_t(e.output)),e.output=[]):n!=0&&e.output.push(n)},fsync(e){e.output?.length>0&&(de(_t(e.output)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,n,l){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,n){n===null||n===10?(Ie(_t(e.output)),e.output=[]):n!=0&&e.output.push(n)},fsync(e){e.output?.length>0&&(Ie(_t(e.output)),e.output=[])}}},hn=(e,n)=>Ye.fill(0,e,e+n),zt=(e,n)=>Math.ceil(e/n)*n,Mt=e=>{e=zt(e,65536);var n=$t(65536,e);return n&&hn(n,e),n},he={ops_table:null,mount(e){return he.createNode(null,"/",16895,0)},createNode(e,n,l,i){if(a.isBlkdev(l)||a.isFIFO(l))throw new a.ErrnoError(63);he.ops_table||={dir:{node:{getattr:he.node_ops.getattr,setattr:he.node_ops.setattr,lookup:he.node_ops.lookup,mknod:he.node_ops.mknod,rename:he.node_ops.rename,unlink:he.node_ops.unlink,rmdir:he.node_ops.rmdir,readdir:he.node_ops.readdir,symlink:he.node_ops.symlink},stream:{llseek:he.stream_ops.llseek}},file:{node:{getattr:he.node_ops.getattr,setattr:he.node_ops.setattr},stream:{llseek:he.stream_ops.llseek,read:he.stream_ops.read,write:he.stream_ops.write,mmap:he.stream_ops.mmap,msync:he.stream_ops.msync}},link:{node:{getattr:he.node_ops.getattr,setattr:he.node_ops.setattr,readlink:he.node_ops.readlink},stream:{}},chrdev:{node:{getattr:he.node_ops.getattr,setattr:he.node_ops.setattr},stream:a.chrdev_stream_ops}};var t=a.createNode(e,n,l,i);return a.isDir(t.mode)?(t.node_ops=he.ops_table.dir.node,t.stream_ops=he.ops_table.dir.stream,t.contents={}):a.isFile(t.mode)?(t.node_ops=he.ops_table.file.node,t.stream_ops=he.ops_table.file.stream,t.usedBytes=0,t.contents=he.emptyFileContents??=new Uint8Array(0)):a.isLink(t.mode)?(t.node_ops=he.ops_table.link.node,t.stream_ops=he.ops_table.link.stream):a.isChrdev(t.mode)&&(t.node_ops=he.ops_table.chrdev.node,t.stream_ops=he.ops_table.chrdev.stream),t.atime=t.mtime=t.ctime=Date.now(),e&&(e.contents[n]=t,e.atime=e.mtime=e.ctime=t.atime),t},getFileDataAsTypedArray(e){return e.contents.subarray(0,e.usedBytes)},expandFileStorage(e,n){var l=e.contents.length;if(!(l>=n)){n=Math.max(n,l*(l<1024*1024?2:1.125)>>>0),l&&(n=Math.max(n,256));var i=he.getFileDataAsTypedArray(e);e.contents=new Uint8Array(n),e.contents.set(i)}},resizeFileStorage(e,n){if(e.usedBytes!=n){var l=e.contents;e.contents=new Uint8Array(n),e.contents.set(l.subarray(0,Math.min(n,e.usedBytes))),e.usedBytes=n}},node_ops:{getattr(e){var n={};return n.dev=a.isChrdev(e.mode)?e.id:1,n.ino=e.id,n.mode=e.mode,n.nlink=1,n.uid=0,n.gid=0,n.rdev=e.rdev,a.isDir(e.mode)?n.size=4096:a.isFile(e.mode)?n.size=e.usedBytes:a.isLink(e.mode)?n.size=e.link.length:n.size=0,n.atime=new Date(e.atime),n.mtime=new Date(e.mtime),n.ctime=new Date(e.ctime),n.blksize=4096,n.blocks=Math.ceil(n.size/n.blksize),n},setattr(e,n){for(const l of["mode","atime","mtime","ctime"])n[l]!=null&&(e[l]=n[l]);n.size!==void 0&&he.resizeFileStorage(e,n.size)},lookup(e,n){throw he.doesNotExistError||(he.doesNotExistError=new a.ErrnoError(44),he.doesNotExistError.stack="<generic error, no stack>"),he.doesNotExistError},mknod(e,n,l,i){return he.createNode(e,n,l,i)},rename(e,n,l){var i;try{i=a.lookupNode(n,l)}catch{}if(i){if(a.isDir(e.mode))for(var t in i.contents)throw new a.ErrnoError(55);a.hashRemoveNode(i)}delete e.parent.contents[e.name],n.contents[l]=e,e.name=l,n.ctime=n.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,n){delete e.contents[n],e.ctime=e.mtime=Date.now()},rmdir(e,n){for(var l in a.lookupNode(e,n).contents)throw new a.ErrnoError(55);delete e.contents[n],e.ctime=e.mtime=Date.now()},readdir(e){return[".","..",...Object.keys(e.contents)]},symlink(e,n,l){var i=he.createNode(e,n,41471,0);return i.link=l,i},readlink(e){if(!a.isLink(e.mode))throw new a.ErrnoError(28);return e.link}},stream_ops:{read(e,n,l,i,t){var r=e.node.contents;if(t>=e.node.usedBytes)return 0;var s=Math.min(e.node.usedBytes-t,i);return n.set(r.subarray(t,t+s),l),s},write(e,n,l,i,t,r){if(n.buffer===Be.buffer&&(r=!1),!i)return 0;var s=e.node;return s.mtime=s.ctime=Date.now(),r?(s.contents=n.subarray(l,l+i),s.usedBytes=i):s.usedBytes===0&&t===0?(s.contents=n.slice(l,l+i),s.usedBytes=i):(he.expandFileStorage(s,t+i),s.contents.set(n.subarray(l,l+i),t),s.usedBytes=Math.max(s.usedBytes,t+i)),i},llseek(e,n,l){var i=n;if(l===1?i+=e.position:l===2&&a.isFile(e.node.mode)&&(i+=e.node.usedBytes),i<0)throw new a.ErrnoError(28);return i},mmap(e,n,l,i,t){if(!a.isFile(e.node.mode))throw new a.ErrnoError(43);var r,s,_=e.node.contents;if(!(t&2)&&_.buffer===Be.buffer)s=!1,r=_.byteOffset;else{if(s=!0,r=Mt(n),!r)throw new a.ErrnoError(48);_&&((l>0||l+n<_.length)&&(_.subarray?_=_.subarray(l,l+n):_=Array.prototype.slice.call(_,l,l+n)),Be.set(_,r))}return{ptr:r,allocated:s}},msync(e,n,l,i,t){return he.stream_ops.write(e,n,0,i,l,!1),0}}},mn=e=>{if(typeof e!="string")return e;var n={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(typeof n>"u")throw new Error(`Unknown file open mode: ${e}`);return n},Bt=e=>(typeof e=="string"&&(e=At(e)),e.subarray||(e=new Uint8Array(e)),e),It=(e,n)=>{var l=0;return e&&(l|=365),n&&(l|=146),l},gn=async e=>{var n=await Ge(e);return new Uint8Array(n)},bn=(...e)=>a.createDataFile(...e),et=0,ft=null,yn=e=>{if(et--,f.monitorRunDependencies?.(et),et==0&&ft){var n=ft;ft=null,n()}},qn=e=>{et++,f.monitorRunDependencies?.(et)},Wt=[],vn=async(e,n)=>{typeof Browser<"u"&&Browser.init();for(var l of Wt)if(l.canHandle(n))return l.handle(e,n);return e},Ut=async(e,n,l,i,t,r,s,_)=>{var c=n?st.resolve(Se.join2(e,n)):e;qn();try{var b=l;typeof l=="string"&&(b=await gn(l)),b=await vn(b,c),_?.(),r||bn(e,n,b,i,t,s)}finally{yn()}},Sn=(e,n,l,i,t,r,s,_,c,b)=>{Ut(e,n,l,i,t,_,c,b).then(r).catch(s)},a={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:"/",initialized:!1,ignorePermissions:!0,filesystems:null,syncFSRequests:0,ErrnoError:class{name="ErrnoError";constructor(e){this.errno=e}},FSStream:class{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{node_ops={};stream_ops={};readMode=365;writeMode=146;mounted=null;constructor(e,n,l,i){e||(e=this),this.parent=e,this.mount=e.mount,this.id=a.nextInode++,this.name=n,this.mode=l,this.rdev=i,this.atime=this.mtime=this.ctime=Date.now()}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,n={}){if(!e)throw new a.ErrnoError(44);n.follow_mount??=!0,Se.isAbs(e)||(e=a.cwd()+"/"+e);e:for(var l=0;l<40;l++){for(var i=e.split("/").filter(b=>!!b),t=a.root,r="/",s=0;s<i.length;s++){var _=s===i.length-1;if(_&&n.parent)break;if(i[s]!=="."){if(i[s]===".."){if(r=Se.dirname(r),a.isRoot(t)){e=r+"/"+i.slice(s+1).join("/"),l--;continue e}else t=t.parent;continue}r=Se.join2(r,i[s]);try{t=a.lookupNode(t,i[s])}catch(b){if(b?.errno===44&&_&&n.noent_okay)return{path:r};throw b}if(a.isMountpoint(t)&&(!_||n.follow_mount)&&(t=t.mounted.root),a.isLink(t.mode)&&(!_||n.follow)){if(!t.node_ops.readlink)throw new a.ErrnoError(52);var c=t.node_ops.readlink(t);Se.isAbs(c)||(c=Se.dirname(r)+"/"+c),e=c+"/"+i.slice(s+1).join("/");continue e}}}return{path:r,node:t}}throw new a.ErrnoError(32)},getPath(e){for(var n;;){if(a.isRoot(e)){var l=e.mount.mountpoint;return n?l[l.length-1]!=="/"?`${l}/${n}`:l+n:l}n=n?`${e.name}/${n}`:e.name,e=e.parent}},hashName(e,n){for(var l=0,i=0;i<n.length;i++)l=(l<<5)-l+n.charCodeAt(i)|0;return(e+l>>>0)%a.nameTable.length},hashAddNode(e){var n=a.hashName(e.parent.id,e.name);e.name_next=a.nameTable[n],a.nameTable[n]=e},hashRemoveNode(e){var n=a.hashName(e.parent.id,e.name);if(a.nameTable[n]===e)a.nameTable[n]=e.name_next;else for(var l=a.nameTable[n];l;){if(l.name_next===e){l.name_next=e.name_next;break}l=l.name_next}},lookupNode(e,n){var l=a.mayLookup(e);if(l)throw new a.ErrnoError(l);for(var i=a.hashName(e.id,n),t=a.nameTable[i];t;t=t.name_next){var r=t.name;if(t.parent.id===e.id&&r===n)return t}return a.lookup(e,n)},createNode(e,n,l,i){var t=new a.FSNode(e,n,l,i);return a.hashAddNode(t),t},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 n=["r","w","rw"][e&3];return e&512&&(n+="w"),n},nodePermissions(e,n){return a.ignorePermissions?0:n.includes("r")&&!(e.mode&292)||n.includes("w")&&!(e.mode&146)||n.includes("x")&&!(e.mode&73)?2:0},mayLookup(e){if(!a.isDir(e.mode))return 54;var n=a.nodePermissions(e,"x");return n||(e.node_ops.lookup?0:2)},mayCreate(e,n){if(!a.isDir(e.mode))return 54;try{return a.lookupNode(e,n),20}catch{}return a.nodePermissions(e,"wx")},mayDelete(e,n,l){var i;try{i=a.lookupNode(e,n)}catch(r){return r.errno}var t=a.nodePermissions(e,"wx");if(t)return t;if(l){if(!a.isDir(i.mode))return 54;if(a.isRoot(i)||a.getPath(i)===a.cwd())return 10}else if(a.isDir(i.mode))return 31;return 0},mayOpen(e,n){if(!e)return 44;if(a.isLink(e.mode))return 32;var l=a.flagsToPermissionString(n);return a.isDir(e.mode)&&(l!=="r"||n&576)?31:a.nodePermissions(e,l)},checkOpExists(e,n){if(!e)throw new a.ErrnoError(n);return e},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 n=a.getStream(e);if(!n)throw new a.ErrnoError(8);return n},getStream:e=>a.streams[e],createStream(e,n=-1){return e=Object.assign(new a.FSStream,e),n==-1&&(n=a.nextfd()),e.fd=n,a.streams[n]=e,e},closeStream(e){a.streams[e]=null},dupStream(e,n=-1){var l=a.createStream(e,n);return l.stream_ops?.dup?.(l),l},doSetAttr(e,n,l){var i=e?.stream_ops.setattr,t=i?e:n;i??=n.node_ops.setattr,a.checkOpExists(i,63),i(t,l)},chrdev_stream_ops:{open(e){e.stream_ops=a.getDevice(e.node.rdev).stream_ops,e.stream_ops.open?.(e)},llseek(){throw new a.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,n)=>e<<8|n,registerDevice(e,n){a.devices[e]={stream_ops:n}},getDevice:e=>a.devices[e],getMounts(e){for(var n=[],l=[e];l.length;){var i=l.pop();n.push(i),l.push(...i.mounts)}return n},syncfs(e,n){typeof e=="function"&&(n=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 l=a.getMounts(a.root.mount),i=0;function t(_){return a.syncFSRequests--,n(_)}function r(_){if(_)return r.errored?void 0:(r.errored=!0,t(_));++i>=l.length&&t(null)}for(var s of l)s.type.syncfs?s.type.syncfs(s,e,r):r(null)},mount(e,n,l){var i=l==="/",t=!l,r;if(i&&a.root)throw new a.ErrnoError(10);if(!i&&!t){var s=a.lookupPath(l,{follow_mount:!1});if(l=s.path,r=s.node,a.isMountpoint(r))throw new a.ErrnoError(10);if(!a.isDir(r.mode))throw new a.ErrnoError(54)}var _={type:e,opts:n,mountpoint:l,mounts:[]},c=e.mount(_);return c.mount=_,_.root=c,i?a.root=c:r&&(r.mounted=_,r.mount&&r.mount.mounts.push(_)),c},unmount(e){var n=a.lookupPath(e,{follow_mount:!1});if(!a.isMountpoint(n.node))throw new a.ErrnoError(28);var l=n.node,i=l.mounted,t=a.getMounts(i);for(var[r,s]of Object.entries(a.nameTable))for(;s;){var _=s.name_next;t.includes(s.mount)&&a.destroyNode(s),s=_}l.mounted=null;var c=l.mount.mounts.indexOf(i);l.mount.mounts.splice(c,1)},lookup(e,n){return e.node_ops.lookup(e,n)},mknod(e,n,l){var i=a.lookupPath(e,{parent:!0}).node,t=Se.basename(e);if(!t)throw new a.ErrnoError(28);if(t==="."||t==="..")throw new a.ErrnoError(20);var r=a.mayCreate(i,t);if(r)throw new a.ErrnoError(r);if(!i.node_ops.mknod)throw new a.ErrnoError(63);return i.node_ops.mknod(i,t,n,l)},statfs(e){return a.statfsNode(a.lookupPath(e,{follow:!0}).node)},statfsStream(e){return a.statfsNode(e.node)},statfsNode(e){var n={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:a.nextInode,ffree:a.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(n,e.node_ops.statfs(e.mount.opts.root)),n},create(e,n=438){return n&=4095,n|=32768,a.mknod(e,n,0)},mkdir(e,n=511){return n&=1023,n|=16384,a.mknod(e,n,0)},mkdirTree(e,n){var l=e.split("/"),i="";for(var t of l)if(t){(i||Se.isAbs(e))&&(i+="/"),i+=t;try{a.mkdir(i,n)}catch(r){if(r.errno!=20)throw r}}},mkdev(e,n,l){return typeof l>"u"&&(l=n,n=438),n|=8192,a.mknod(e,n,l)},symlink(e,n){if(!st.resolve(e))throw new a.ErrnoError(44);var l=a.lookupPath(n,{parent:!0}).node;if(!l)throw new a.ErrnoError(44);var i=Se.basename(n),t=a.mayCreate(l,i);if(t)throw new a.ErrnoError(t);if(!l.node_ops.symlink)throw new a.ErrnoError(63);return l.node_ops.symlink(l,i,e)},rename(e,n){var l=Se.dirname(e),i=Se.dirname(n),t=Se.basename(e),r=Se.basename(n),s=a.lookupPath(e,{parent:!0}),_=s.node,c;if(s=a.lookupPath(n,{parent:!0}),c=s.node,!_||!c)throw new a.ErrnoError(44);if(_.mount!==c.mount)throw new a.ErrnoError(75);var b=a.lookupNode(_,t),z=st.relative(e,i);if(z.charAt(0)!==".")throw new a.ErrnoError(28);if(z=st.relative(n,l),z.charAt(0)!==".")throw new a.ErrnoError(55);var I;try{I=a.lookupNode(c,r)}catch{}if(b!==I){var q=a.isDir(b.mode),w=a.mayDelete(_,t,q);if(w)throw new a.ErrnoError(w);if(w=I?a.mayDelete(c,r,q):a.mayCreate(c,r),w)throw new a.ErrnoError(w);if(!_.node_ops.rename)throw new a.ErrnoError(63);if(a.isMountpoint(b)||I&&a.isMountpoint(I))throw new a.ErrnoError(10);if(c!==_&&(w=a.nodePermissions(_,"w"),w))throw new a.ErrnoError(w);a.hashRemoveNode(b);try{_.node_ops.rename(b,c,r),b.parent=c}catch(x){throw x}finally{a.hashAddNode(b)}}},rmdir(e){var n=a.lookupPath(e,{parent:!0}).node,l=Se.basename(e),i=a.lookupNode(n,l),t=a.mayDelete(n,l,!0);if(t)throw new a.ErrnoError(t);if(!n.node_ops.rmdir)throw new a.ErrnoError(63);if(a.isMountpoint(i))throw new a.ErrnoError(10);n.node_ops.rmdir(n,l),a.destroyNode(i)},readdir(e){var n=a.lookupPath(e,{follow:!0}).node;return a.checkOpExists(n.node_ops.readdir,54)(n)},unlink(e){var n=a.lookupPath(e,{parent:!0}).node;if(!n)throw new a.ErrnoError(44);var l=Se.basename(e),i=a.lookupNode(n,l),t=a.mayDelete(n,l,!1);if(t)throw new a.ErrnoError(t);if(!n.node_ops.unlink)throw new a.ErrnoError(63);if(a.isMountpoint(i))throw new a.ErrnoError(10);n.node_ops.unlink(n,l),a.destroyNode(i)},readlink(e){var n=a.lookupPath(e).node;if(!n)throw new a.ErrnoError(44);if(!n.node_ops.readlink)throw new a.ErrnoError(28);return n.node_ops.readlink(n)},stat(e,n){var l=a.lookupPath(e,{follow:!n}).node;return a.checkOpExists(l.node_ops.getattr,63)(l)},fstat(e){var n=a.getStreamChecked(e),l=n.node,i=n.stream_ops.getattr,t=i?n:l;return i??=l.node_ops.getattr,a.checkOpExists(i,63),i(t)},lstat(e){return a.stat(e,!0)},doChmod(e,n,l,i){a.doSetAttr(e,n,{mode:l&4095|n.mode&-4096,ctime:Date.now(),dontFollow:i})},chmod(e,n,l){var i;typeof e=="string"?i=a.lookupPath(e,{follow:!l}).node:i=e,a.doChmod(null,i,n,l)},lchmod(e,n){a.chmod(e,n,!0)},fchmod(e,n){var l=a.getStreamChecked(e);a.doChmod(l,l.node,n,!1)},doChown(e,n,l){a.doSetAttr(e,n,{timestamp:Date.now(),dontFollow:l})},chown(e,n,l,i){var t;typeof e=="string"?t=a.lookupPath(e,{follow:!i}).node:t=e,a.doChown(null,t,i)},lchown(e,n,l){a.chown(e,n,l,!0)},fchown(e,n,l){var i=a.getStreamChecked(e);a.doChown(i,i.node,!1)},doTruncate(e,n,l){if(a.isDir(n.mode))throw new a.ErrnoError(31);if(!a.isFile(n.mode))throw new a.ErrnoError(28);var i=a.nodePermissions(n,"w");if(i)throw new a.ErrnoError(i);a.doSetAttr(e,n,{size:l,timestamp:Date.now()})},truncate(e,n){if(n<0)throw new a.ErrnoError(28);var l;typeof e=="string"?l=a.lookupPath(e,{follow:!0}).node:l=e,a.doTruncate(null,l,n)},ftruncate(e,n){var l=a.getStreamChecked(e);if(n<0||(l.flags&2097155)===0)throw new a.ErrnoError(28);a.doTruncate(l,l.node,n)},utime(e,n,l){var i=a.lookupPath(e,{follow:!0}).node;a.checkOpExists(i.node_ops.setattr,63)(i,{atime:n,mtime:l})},open(e,n,l=438){if(e==="")throw new a.ErrnoError(44);n=mn(n),n&64?l=l&4095|32768:l=0;var i,t;if(typeof e=="object")i=e;else{t=e.endsWith("/");var r=a.lookupPath(e,{follow:!(n&131072),noent_okay:!0});i=r.node,e=r.path}var s=!1;if(n&64)if(i){if(n&128)throw new a.ErrnoError(20)}else{if(t)throw new a.ErrnoError(31);i=a.mknod(e,l|511,0),s=!0}if(!i)throw new a.ErrnoError(44);if(a.isChrdev(i.mode)&&(n&=-513),n&65536&&!a.isDir(i.mode))throw new a.ErrnoError(54);if(!s){var _=a.mayOpen(i,n);if(_)throw new a.ErrnoError(_)}n&512&&!s&&a.truncate(i,0),n&=-131713;var c=a.createStream({node:i,path:a.getPath(i),flags:n,seekable:!0,position:0,stream_ops:i.stream_ops,ungotten:[],error:!1});return c.stream_ops.open&&c.stream_ops.open(c),s&&a.chmod(i,l&511),c},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(n){throw n}finally{a.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,n,l){if(a.isClosed(e))throw new a.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new a.ErrnoError(70);if(l!=0&&l!=1&&l!=2)throw new a.ErrnoError(28);return e.position=e.stream_ops.llseek(e,n,l),e.ungotten=[],e.position},read(e,n,l,i,t){if(i<0||t<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 r=typeof t<"u";if(!r)t=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var s=e.stream_ops.read(e,n,l,i,t);return r||(e.position+=s),s},write(e,n,l,i,t,r){if(i<0||t<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 s=typeof t<"u";if(!s)t=e.position;else if(!e.seekable)throw new a.ErrnoError(70);var _=e.stream_ops.write(e,n,l,i,t,r);return s||(e.position+=_),_},mmap(e,n,l,i,t){if((i&2)!==0&&(t&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(!n)throw new a.ErrnoError(28);return e.stream_ops.mmap(e,n,l,i,t)},msync(e,n,l,i,t){return e.stream_ops.msync?e.stream_ops.msync(e,n,l,i,t):0},ioctl(e,n,l){if(!e.stream_ops.ioctl)throw new a.ErrnoError(59);return e.stream_ops.ioctl(e,n,l)},readFile(e,n={}){n.flags=n.flags||0,n.encoding=n.encoding||"binary",n.encoding!=="utf8"&&n.encoding!=="binary"&&$e(`Invalid encoding type "${n.encoding}"`);var l=a.open(e,n.flags),i=a.stat(e).size,t=new Uint8Array(i);return a.read(l,t,0,i,0),n.encoding==="utf8"&&(t=_t(t)),a.close(l),t},writeFile(e,n,l={}){l.flags=l.flags||577;var i=a.open(e,l.flags,l.mode);n=Bt(n),a.write(i,n,0,n.byteLength,void 0,l.canOwn),a.close(i)},cwd:()=>a.currentPath,chdir(e){var n=a.lookupPath(e,{follow:!0});if(n.node===null)throw new a.ErrnoError(44);if(!a.isDir(n.node.mode))throw new a.ErrnoError(54);var l=a.nodePermissions(n.node,"x");if(l)throw new a.ErrnoError(l);a.currentPath=n.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:(i,t,r,s,_)=>s,llseek:()=>0}),a.mkdev("/dev/null",a.makedev(1,3)),Ze.register(a.makedev(5,0),Ze.default_tty_ops),Ze.register(a.makedev(6,0),Ze.default_tty1_ops),a.mkdev("/dev/tty",a.makedev(5,0)),a.mkdev("/dev/tty1",a.makedev(6,0));var e=new Uint8Array(1024),n=0,l=()=>(n===0&&(Nt(e),n=e.byteLength),e[--n]);a.createDevice("/dev","random",l),a.createDevice("/dev","urandom",l),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 n=a.createNode(e,"fd",16895,73);return n.stream_ops={llseek:he.stream_ops.llseek},n.node_ops={lookup(l,i){var t=+i,r=a.getStreamChecked(t),s={parent:null,mount:{mountpoint:"fake"},node_ops:{readlink:()=>r.path},id:t+1};return s.parent=s,s}
2,readdir(){return Array.from(a.streams.entries()).filter(([l,i])=>i).map(([l,i])=>l.toString())}},n}},{},"/proc/self/fd")},createStandardStreams(e,n,l){e?a.createDevice("/dev","stdin",e):a.symlink("/dev/tty","/dev/stdin"),n?a.createDevice("/dev","stdout",null,n):a.symlink("/dev/tty","/dev/stdout"),l?a.createDevice("/dev","stderr",null,l):a.symlink("/dev/tty1","/dev/stderr"),a.open("/dev/stdin",0),a.open("/dev/stdout",1),a.open("/dev/stderr",1)},staticInit(){a.nameTable=new Array(4096),a.mount(he,{},"/"),a.createDefaultDirectories(),a.createDefaultDevices(),a.createSpecialDirectories(),a.filesystems={MEMFS:he}},init(e,n,l){a.initialized=!0,e??=f.stdin,n??=f.stdout,l??=f.stderr,a.createStandardStreams(e,n,l)},quit(){a.initialized=!1;for(var e of a.streams)e&&a.close(e)},findObject(e,n){var l=a.analyzePath(e,n);return l.exists?l.object:null},analyzePath(e,n){try{var l=a.lookupPath(e,{follow:!n});e=l.path}catch{}var i={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var l=a.lookupPath(e,{parent:!0});i.parentExists=!0,i.parentPath=l.path,i.parentObject=l.node,i.name=Se.basename(e),l=a.lookupPath(e,{follow:!n}),i.exists=!0,i.path=l.path,i.object=l.node,i.name=l.node.name,i.isRoot=l.path==="/"}catch(t){i.error=t.errno}return i},createPath(e,n,l,i){e=typeof e=="string"?e:a.getPath(e);for(var t=n.split("/").reverse();t.length;){var r=t.pop();if(r){var s=Se.join2(e,r);try{a.mkdir(s)}catch(_){if(_.errno!=20)throw _}e=s}}return s},createFile(e,n,l,i,t){var r=Se.join2(typeof e=="string"?e:a.getPath(e),n),s=It(i,t);return a.create(r,s)},createDataFile(e,n,l,i,t,r){var s=n;e&&(e=typeof e=="string"?e:a.getPath(e),s=n?Se.join2(e,n):e);var _=It(i,t),c=a.create(s,_);if(l){l=Bt(l),a.chmod(c,_|146);var b=a.open(c,577);a.write(b,l,0,l.length,0,r),a.close(b),a.chmod(c,_)}},createDevice(e,n,l,i){var t=Se.join2(typeof e=="string"?e:a.getPath(e),n),r=It(!!l,!!i);a.createDevice.major??=64;var s=a.makedev(a.createDevice.major++,0);return a.registerDevice(s,{open(_){_.seekable=!1},close(_){i?.buffer?.length&&i(10)},read(_,c,b,z,I){for(var q=0,w=0;w<z;w++){var x;try{x=l()}catch{throw new a.ErrnoError(29)}if(x===void 0&&q===0)throw new a.ErrnoError(6);if(x==null)break;q++,c[b+w]=x}return q&&(_.node.atime=Date.now()),q},write(_,c,b,z,I){for(var q=0;q<z;q++)try{i(c[b+q])}catch{throw new a.ErrnoError(29)}return z&&(_.node.mtime=_.node.ctime=Date.now()),q}}),a.mkdev(t,r,s)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(globalThis.XMLHttpRequest)$e("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.");else try{e.contents=Xe(e.url)}catch{throw new a.ErrnoError(29)}},createLazyFile(e,n,l,i,t){class r{lengthKnown=!1;chunks=[];get(I){if(!(I>this.length-1||I<0)){var q=I%this.chunkSize,w=I/this.chunkSize|0;return this.getter(w)[q]}}setDataGetter(I){this.getter=I}cacheLength(){var I=new XMLHttpRequest;I.open("HEAD",l,!1),I.send(null),I.status>=200&&I.status<300||I.status===304||$e("Couldn't load "+l+". Status: "+I.status);var q=Number(I.getResponseHeader("Content-length")),w,x=(w=I.getResponseHeader("Accept-Ranges"))&&w==="bytes",L=(w=I.getResponseHeader("Content-Encoding"))&&w==="gzip",H=1024*1024;x||(H=q);var g=(D,U)=>{D>U&&$e("invalid range ("+D+", "+U+") or no bytes requested!"),U>q-1&&$e("only "+q+" bytes available! programmer error!");var A=new XMLHttpRequest;return A.open("GET",l,!1),q!==H&&A.setRequestHeader("Range","bytes="+D+"-"+U),A.responseType="arraybuffer",A.overrideMimeType&&A.overrideMimeType("text/plain; charset=x-user-defined"),A.send(null),A.status>=200&&A.status<300||A.status===304||$e("Couldn't load "+l+". Status: "+A.status),A.response!==void 0?new Uint8Array(A.response||[]):At(A.responseText||"")},h=this;h.setDataGetter(D=>{var U=D*H,A=(D+1)*H-1;return A=Math.min(A,q-1),typeof h.chunks[D]>"u"&&(h.chunks[D]=g(U,A)),typeof h.chunks[D]>"u"&&$e("doXHR failed!"),h.chunks[D]}),(L||!q)&&(H=q=1,q=this.getter(0).length,H=q,de("LazyFiles on gzip forces download of the whole file when length is accessed")),this._length=q,this._chunkSize=H,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(globalThis.XMLHttpRequest){Qe||$e("Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc");var s={isDevice:!1,contents:new r}}else var s={isDevice:!1,url:l};var _=a.createFile(e,n,s,i,t);s.contents?_.contents=s.contents:s.url&&(_.contents=null,_.url=s.url),Object.defineProperties(_,{usedBytes:{get:function(){return this.contents.length}}});var c={};for(const[z,I]of Object.entries(_.stream_ops))c[z]=(...q)=>(a.forceLoadFile(_),I(...q));function b(z,I,q,w,x){var L=z.node.contents;if(x>=L.length)return 0;var H=Math.min(L.length-x,w);if(L.slice)for(var g=0;g<H;g++)I[q+g]=L[x+g];else for(var g=0;g<H;g++)I[q+g]=L.get(x+g);return H}return c.read=(z,I,q,w,x)=>(a.forceLoadFile(_),b(z,I,q,w,x)),c.mmap=(z,I,q,w,x)=>{a.forceLoadFile(_);var L=Mt(I);if(!L)throw new a.ErrnoError(48);return b(z,Be,L,I,q),{ptr:L,allocated:!0}},_.stream_ops=c,_}},wn=(e,n,l)=>{if(!e)return"";var i=Dt(Ye,e,n);return Rt.decode(Ye.subarray(e,i))},ge={calculateAt(e,n,l){if(Se.isAbs(n))return n;var i;if(e===-100?i=a.cwd():i=ge.getStreamFromFD(e).path,n.length==0){if(!l)throw new a.ErrnoError(44);return i}return i+"/"+n},writeStat(e,n){Ae[e>>2]=n.dev,Ae[e+4>>2]=n.mode,Ae[e+8>>2]=n.nlink,Ae[e+12>>2]=n.uid,Ae[e+16>>2]=n.gid,Ae[e+20>>2]=n.rdev,Ce[e+24>>3]=BigInt(n.size),ve[e+32>>2]=4096,ve[e+36>>2]=n.blocks;var l=n.atime.getTime(),i=n.mtime.getTime(),t=n.ctime.getTime();return Ce[e+40>>3]=BigInt(Math.floor(l/1e3)),Ae[e+48>>2]=l%1e3*1e3*1e3,Ce[e+56>>3]=BigInt(Math.floor(i/1e3)),Ae[e+64>>2]=i%1e3*1e3*1e3,Ce[e+72>>3]=BigInt(Math.floor(t/1e3)),Ae[e+80>>2]=t%1e3*1e3*1e3,Ce[e+88>>3]=BigInt(n.ino),0},writeStatFs(e,n){Ae[e+4>>2]=n.bsize,Ae[e+60>>2]=n.bsize,Ce[e+8>>3]=BigInt(n.blocks),Ce[e+16>>3]=BigInt(n.bfree),Ce[e+24>>3]=BigInt(n.bavail),Ce[e+32>>3]=BigInt(n.files),Ce[e+40>>3]=BigInt(n.ffree),Ae[e+48>>2]=n.fsid,Ae[e+64>>2]=n.flags,Ae[e+56>>2]=n.namelen},doMsync(e,n,l,i,t){if(!a.isFile(n.node.mode))throw new a.ErrnoError(43);if(i&2)return 0;var r=Ye.slice(e,e+l);a.msync(n,r,t,l,i)},getStreamFromFD(e){return a.getStreamChecked(e)},varargs:void 0,getStr(e){return wn(e)}};
2function En(e,n){try{return e=ge.getStr(e),a.chmod(e,n),0}catch(l){if(typeof a>"u"||l.name!=="ErrnoError")throw l;return-l.errno}}function An(e,n,l,i){try{if(n=ge.getStr(n),n=ge.calculateAt(e,n),l&-8)return-28;var t=a.lookupPath(n,{follow:!0}).node;if(!t)return-44;var r="";return l&4&&(r+="r"),l&2&&(r+="w"),l&1&&(r+="x"),r&&a.nodePermissions(t,r)?-2:0}catch(s){if(typeof a>"u"||s.name!=="ErrnoError")throw s;return-s.errno}}function In(e,n){try{return a.fchmod(e,n),0}catch(l){if(typeof a>"u"||l.name!=="ErrnoError")throw l;return-l.errno}}function kn(e,n,l){try{return a.fchown(e,n,l),0}catch(i){if(typeof a>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}var qt=()=>{var e=ve[+ge.varargs>>2];return ge.varargs+=4,e},ot=qt;function Tn(e,n,l){ge.varargs=l;try{var i=ge.getStreamFromFD(e);switch(n){case 0:var t=qt();if(t<0)return-28;for(;a.streams[t];)t++;return a.dupStream(i,t).fd;case 1:case 2:return 0;case 3:return i.flags;case 4:var t=qt();return i.flags|=t,0;case 12:var t=ot(),r=0;return ut[t+r>>1]=2,0;case 13:case 14:return 0}return-28}catch(s){if(typeof a>"u"||s.name!=="ErrnoError")throw s;return-s.errno}}function On(e,n){try{return ge.writeStat(n,a.fstat(e))}catch(l){if(typeof a>"u"||l.name!=="ErrnoError")throw l;return-l.errno}}var xn=9007199254740992,Pn=-9007199254740992,dt=e=>e<Pn||e>xn?NaN:Number(e);function Fn(e,n){n=dt(n);try{return isNaN(n)?-61:(a.ftruncate(e,n),0)}catch(l){if(typeof a>"u"||l.name!=="ErrnoError")throw l;return-l.errno}}var tt=(e,n,l)=>jt(e,Ye,n,l);function Ln(e,n){try{if(n===0)return-28;var l=a.cwd(),i=yt(l)+1;return n<i?-68:(tt(l,e,n),i)}catch(t){if(typeof a>"u"||t.name!=="ErrnoError")throw t;return-t.errno}}function Cn(e,n,l){ge.varargs=l;try{var i=ge.getStreamFromFD(e);switch(n){case 21509:return i.tty?0:-59;case 21505:if(!i.tty)return-59;
2if(i.tty.ops.ioctl_tcgets){var t=i.tty.ops.ioctl_tcgets(i),I=ot();ve[I>>2]=t.c_iflag||0,ve[I+4>>2]=t.c_oflag||0,ve[I+8>>2]=t.c_cflag||0,ve[I+12>>2]=t.c_lflag||0;for(var r=0;r<32;r++)Be[I+r+17]=t.c_cc[r]||0;return 0}return 0;case 21510:case 21511:case 21512:return i.tty?0:-59;case 21506:case 21507:case 21508:if(!i.tty)return-59;if(i.tty.ops.ioctl_tcsets){for(var I=ot(),s=ve[I>>2],_=ve[I+4>>2],c=ve[I+8>>2],b=ve[I+12>>2],z=[],r=0;r<32;r++)z.push(Be[I+r+17]);return i.tty.ops.ioctl_tcsets(i.tty,n,{c_iflag:s,c_oflag:_,c_cflag:c,c_lflag:b,c_cc:z})}return 0;case 21519:if(!i.tty)return-59;var I=ot();return ve[I>>2]=0,0;case 21520:return i.tty?-28:-59;case 21537:case 21531:var I=ot();return a.ioctl(i,n,I);case 21523:if(!i.tty)return-59;if(i.tty.ops.ioctl_tiocgwinsz){var q=i.tty.ops.ioctl_tiocgwinsz(i.tty),I=ot();ut[I>>1]=q[0],ut[I+2>>1]=q[1]}return 0;case 21524:return i.tty?0:-59;case 21515:return i.tty?0:-59;default:return-28}}catch(w){if(typeof a>"u"||w.name!=="ErrnoError")throw w;return-w.errno}}function Nn(e,n){try{return e=ge.getStr(e),ge.writeStat(n,a.lstat(e))}catch(l){if(typeof a>"u"||l.name!=="ErrnoError")throw l;return-l.errno}}function Rn(e,n,l){try{return n=ge.getStr(n),n=ge.calculateAt(e,n),a.mkdir(n,l,0),0}catch(i){if(typeof a>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}function Dn(e,n,l,i){try{n=ge.getStr(n);var t=i&256,r=i&4096;return i=i&-6401,n=ge.calculateAt(e,n,r),ge.writeStat(l,t?a.lstat(n):a.stat(n))}catch(s){if(typeof a>"u"||s.name!=="ErrnoError")throw s;return-s.errno}}function jn(e,n,l,i){ge.varargs=i;try{n=ge.getStr(n),n=ge.calculateAt(e,n);var t=i?qt():0;return a.open(n,l,t).fd}catch(r){if(typeof a>"u"||r.name!=="ErrnoError")throw r;return-r.errno}}function zn(e,n,l,i){try{if(n=ge.getStr(n),n=ge.calculateAt(e,n),i<=0)return-28;var t=a.readlink(n),r=Math.min(i,yt(t)),s=Be[l+r];return tt(t,l,i+1),Be[l+r]=s,r}catch(_){if(typeof a>"u"||_.name!=="ErrnoError")throw _;return-_.errno}}function Mn(e){try{return e=ge.getStr(e),a.rmdir(e),0}catch(n){if(typeof a>"u"||n.name!=="ErrnoError")throw n;return-n.errno}}function Bn(e,n){try{return e=ge.getStr(e),ge.writeStat(n,a.stat(e))}catch(l){if(typeof a>"u"||l.name!=="ErrnoError")throw l;return-l.errno}}function Wn(e,n,l){try{if(n=ge.getStr(n),n=ge.calculateAt(e,n),!l)a.unlink(n);else if(l===512)a.rmdir(n);else return-28;return 0}catch(i){if(typeof a>"u"||i.name!=="ErrnoError")throw i;return-i.errno}}var Qt=e=>Ae[e>>2]+ve[e+4>>2]*4294967296;function Un(e,n,l,i){try{n=ge.getStr(n),n=ge.calculateAt(e,n,!0);var t=Date.now(),r,s;if(!l)r=t,s=t;else{var _=Qt(l),c=ve[l+8>>2];c==1073741823?r=t:c==1073741822?r=null:r=_*1e3+c/(1e3*1e3),l+=16,_=Qt(l),c=ve[l+8>>2],c==1073741823?s=t:c==1073741822?s=null:s=_*1e3+c/(1e3*1e3)}return(s??r)!==null&&a.utime(n,r,s),0}catch(b){if(typeof a>"u"||b.name!=="ErrnoError")throw b;return-b.errno}}var Qn=e=>e%4===0&&(e%100!==0||e%400===0),Hn=[0,31,60,91,121,152,182,213,244,274,305,335],Vn=[0,31,59,90,120,151,181,212,243,273,304,334],Gn=e=>(Qn(e.getFullYear())?Hn:Vn)[e.getMonth()]+e.getDate()-1;function $n(e,n){e=dt(e);var l=new Date(e*1e3);ve[n>>2]=l.getSeconds(),ve[n+4>>2]=l.getMinutes(),ve[n+8>>2]=l.getHours(),ve[n+12>>2]=l.getDate(),ve[n+16>>2]=l.getMonth(),ve[n+20>>2]=l.getFullYear()-1900,ve[n+24>>2]=l.getDay();var i=Gn(l)|0;ve[n+28>>2]=i,ve[n+36>>2]=-(l.getTimezoneOffset()*60);var t=new Date(l.getFullYear(),0,1),r=new Date(l.getFullYear(),6,1).getTimezoneOffset(),s=t.getTimezoneOffset(),_=(r!=s&&l.getTimezoneOffset()==Math.min(s,r))|0;ve[n+32>>2]=_}function Kn(e,n,l,i,t,r,s){t=dt(t);try{var _=ge.getStreamFromFD(i),c=a.mmap(_,e,t,n,l),b=c.ptr;return ve[r>>2]=c.allocated,Ae[s>>2]=b,0}catch(z){if(typeof a>"u"||z.name!=="ErrnoError")throw z;return-z.errno}}function Jn(e,n,l,i,t,r){r=dt(r);try{var s=ge.getStreamFromFD(t);l&2&&ge.doMsync(e,s,n,i,r)}catch(_){if(typeof a>"u"||_.name!=="ErrnoError")throw _;return-_.errno}}var Xn=(e,n,l,i)=>{var t=new Date().getFullYear(),r=new Date(t,0,1),s=new Date(t,6,1),_=r.getTimezoneOffset(),c=s.getTimezoneOffset(),b=Math.max(_,c);Ae[e>>2]=b*60,ve[n>>2]=+(_!=c);var z=w=>{var x=w>=0?"-":"+",L=Math.abs(w);return`UTC${x}${String(Math.floor(L/60)).padStart(2,"0")}${String(L%60).padStart(2,"0")}`},I=z(_),q=z(c);c<_?(tt(I,l,17),tt(q,i,17)):(tt(I,i,17),tt(q,l,17))},Ht=()=>performance.now(),Vt=()=>Date.now(),Yn=e=>e>=0&&e<=3;function Zn(e,n,l){if(!Yn(e))return 28;var i;e===0?i=Vt():i=Ht();var t=Math.round(i*1e3*1e3);return Ce[l>>3]=BigInt(t),0}var Gt=()=>2147483648,er=()=>Gt(),tr=e=>{var n=(e-Ke.buffer.byteLength+65535)/65536|0;try{return Ke.grow(n),Pt(),1}catch{}},nr=e=>{var n=Ye.length;e>>>=0;var l=Gt();if(e>l)return!1;for(var i=1;i<=4;i*=2){var t=n*(1+.2/i);if(t=Math.min(t,e+100663296),tr(Math.min(l,zt(Math.max(e,t),65536))))return!0}return!1},kt={},rr=()=>Fe||"./this.program",pt=()=>{if(!pt.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:(globalThis.navigator?.language??"C").replace("-","_")+".UTF-8",_:rr()};for(var n in kt)kt[n]===void 0?delete e[n]:e[n]=kt[n];var l=[];for(var n in e)l.push(`${n}=${e[n]}`);pt.strings=l}return pt.strings},ir=(e,n)=>{var l=0,i=0;for(var t of pt()){var r=n+l;Ae[e+i>>2]=r,l+=tt(t,r,1/0)+1,i+=4}return 0},sr=(e,n)=>{var l=pt();Ae[e>>2]=l.length;var i=0;for(var t of l)i+=yt(t)+1;return Ae[n>>2]=i,0};function or(e){try{var n=ge.getStreamFromFD(e);return a.close(n),0}catch(l){if(typeof a>"u"||l.name!=="ErrnoError")throw l;return l.errno}}function lr(e,n){try{var l=0,i=0,t=0,r=ge.getStreamFromFD(e),s=r.tty?2
2:a.isDir(r.mode)?3:a.isLink(r.mode)?7:4;return Be[n]=s,ut[n+2>>1]=t,Ce[n+8>>3]=BigInt(l),Ce[n+16>>3]=BigInt(i),0}catch(_){if(typeof a>"u"||_.name!=="ErrnoError")throw _;return _.errno}}var ar=(e,n,l,i)=>{for(var t=0,r=0;r<l;r++){var s=Ae[n>>2],_=Ae[n+4>>2];n+=8;var c=a.read(e,Be,s,_,i);if(c<0)return-1;if(t+=c,c<_)break}return t};function cr(e,n,l,i){try{var t=ar(ge.getStreamFromFD(e),n,l);return Ae[i>>2]=t,0}catch(r){if(typeof a>"u"||r.name!=="ErrnoError")throw r;return r.errno}}function ur(e,n,l,i){n=dt(n);try{if(isNaN(n))return 61;var t=ge.getStreamFromFD(e);return a.llseek(t,n,l),Ce[i>>3]=BigInt(t.position),t.getdents&&n===0&&l===0&&(t.getdents=null),0}catch(r){if(typeof a>"u"||r.name!=="ErrnoError")throw r;return r.errno}}function _r(e){try{var n=ge.getStreamFromFD(e);return n.stream_ops?.fsync?.(n)}catch(l){if(typeof a>"u"||l.name!=="ErrnoError")throw l;return l.errno}}var fr=(e,n,l,i)=>{for(var t=0,r=0;r<l;r++){var s=Ae[n>>2],_=Ae[n+4>>2];n+=8;var c=a.write(e,Be,s,_,i);if(c<0)return-1;if(t+=c,c<_)break}return t};function dr(e,n,l,i){try{var t=fr(ge.getStreamFromFD(e),n,l);return Ae[i>>2]=t,0}catch(r){if(typeof a>"u"||r.name!=="ErrnoError")throw r;return r.errno}}if(a.createPreloadedFile=Sn,a.preloadFile=Ut,a.staticInit(),Zt(),f.noExitRuntime&&f.noExitRuntime,f.preloadPlugins&&(Wt=f.preloadPlugins),f.print&&(de=f.print),f.printErr&&(Ie=f.printErr),f.wasmBinary&&(ze=f.wasmBinary),f.arguments&&f.arguments,f.thisProgram&&(Fe=f.thisProgram),f.preInit)for(typeof f.preInit=="function"&&(f.preInit=[f.preInit]);f.preInit.length>0;)f.preInit.shift()();f.wasmMemory=Ke;var $t;function pr(e){f._sqlite3_status64=e.sqlite3_status64,f._sqlite3_status=e.sqlite3_status,f._sqlite3_db_status64=e.sqlite3_db_status64,f._sqlite3_msize=e.sqlite3_msize,f._sqlite3_db_status=e.sqlite3_db_status,f._sqlite3_vfs_find=e.sqlite3_vfs_find,f._sqlite3_initialize=e.sqlite3_initialize,f._sqlite3_malloc=e.sqlite3_malloc,f._sqlite3_free=e.sqlite3_free,f._sqlite3_vfs_register=e.sqlite3_vfs_register,f._sqlite3_vfs_unregister=e.sqlite3_vfs_unregister,f._sqlite3_malloc64=e.sqlite3_malloc64,f._sqlite3_realloc=e.sqlite3_realloc,f._sqlite3_realloc64=e.sqlite3_realloc64,f._sqlite3_value_text=e.sqlite3_value_text,f._sqlite3_randomness=e.sqlite3_randomness,f._sqlite3_stricmp=e.sqlite3_stricmp,f._sqlite3_strnicmp=e.sqlite3_strnicmp,f._sqlite3_uri_parameter=e.sqlite3_uri_parameter,f._sqlite3_uri_boolean=e.sqlite3_uri_boolean,f._sqlite3_serialize=e.sqlite3_serialize,f._sqlite3_prepare_v2=e.sqlite3_prepare_v2,f._sqlite3_step=e.sqlite3_step,f._sqlite3_column_int64=e.sqlite3_column_int64,f._sqlite3_reset=e.sqlite3_reset,f._sqlite3_exec=e.sqlite3_exec,f._sqlite3_column_int=e.sqlite3_column_int,f._sqlite3_finalize=e.sqlite3_finalize,f._sqlite3_file_control=e.sqlite3_file_control,f._sqlite3_column_name=e.sqlite3_column_name,f._sqlite3_column_text=e.sqlite3_column_text,f._sqlite3_column_type=e.sqlite3_column_type,f._sqlite3_errmsg=e.sqlite3_errmsg,f._sqlite3_deserialize=e.sqlite3_deserialize,f._sqlite3_clear_bindings=e.sqlite3_clear_bindings,f._sqlite3_value_blob=e.sqlite3_value_blob,f._sqlite3_value_bytes=e.sqlite3_value_bytes,f._sqlite3_value_double=e.sqlite3_value_double,f._sqlite3_value_int=e.sqlite3_value_int,f._sqlite3_value_int64=e.sqlite3_value_int64,f._sqlite3_value_subtype=e.sqlite3_value_subtype,f._sqlite3_value_pointer=e.sqlite3_value_pointer,f._sqlite3_value_type=e.sqlite3_value_type,f._sqlite3_value_nochange=e.sqlite3_value_nochange,f._sqlite3_value_frombind=e.sqlite3_value_frombind,f._sqlite3_value_dup=e.sqlite3_value_dup,f._sqlite3_value_free=e.sqlite3_value_free,f._sqlite3_result_blob=e.sqlite3_result_blob,f._sqlite3_result_error_toobig=e.sqlite3_result_error_toobig,f._sqlite3_result_error_nomem=e.sqlite3_result_error_nomem,f._sqlite3_result_double=e.sqlite3_result_double,f._sqlite3_result_error=e.sqlite3_result_error,f._sqlite3_result_int=e.sqlite3_result_int,f._sqlite3_result_int64=e.sqlite3_result_int64,f._sqlite3_result_null=e.sqlite3_result_null,f._sqlite3_result_pointer=e.sqlite3_result_pointer,f._sqlite3_result_subtype=e.sqlite3_result_subtype,f._sqlite3_result_text=e.sqlite3_result_text,f._sqlite3_result_zeroblob=e.sqlite3_result_zeroblob,f._sqlite3_result_zeroblob64=e.sqlite3_result_zeroblob64,f._sqlite3_result_error_code=e.sqlite3_result_error_code,f._sqlite3_user_data=e.sqlite3_user_data,f._sqlite3_context_db_handle=e.sqlite3_context_db_handle,f._sqlite3_vtab_nochange=e.sqlite3_vtab_nochange,f._sqlite3_vtab_in_first=e.sqlite3_vtab_in_first,f._sqlite3_vtab_in_next=e.sqlite3_vtab_in_next,f._sqlite3_aggregate_context=e.sqlite3_aggregate_context,f._sqlite3_get_auxdata=e.sqlite3_get_auxdata,f._sqlite3_set_auxdata=e.sqlite3_set_auxdata,f._sqlite3_column_count=e.sqlite3_column_count,f._sqlite3_data_count=e.sqlite3_data_count,f._sqlite3_column_blob=e.sqlite3_column_blob,f._sqlite3_column_bytes=e.sqlite3_column_bytes,f._sqlite3_column_double=e.sqlite3_column_double,f._sqlite3_column_value=e.sqlite3_column_value,f._sqlite3_column_decltype=e.sqlite3_column_decltype,f._sqlite3_column_database_name=e.sqlite3_column_database_name,f._sqlite3_column_table_name=e.sqlite3_column_table_name,f._sqlite3_column_origin_name=e.sqlite3_column_origin_name,f._sqlite3_bind_blob=e.sqlite3_bind_blob,f._sqlite3_bind_double=e.sqlite3_bind_double,f._sqlite3_bind_int=e.sqlite3_bind_int,f._sqlite3_bind_int64=e.sqlite3_bind_int64,f._sqlite3_bind_null=e.sqlite3_bind_null,f._sqlite3_bind_pointer=e.sqlite3_bind_pointer,f._sqlite3_bind_text=e.sqlite3_bind_text,f._sqlite3_bind_zeroblob=e.sqlite3_bind_zeroblob,f._sqlite3_bind_parameter_count=e.sqlite3_bind_parameter_count,f._sqlite3_bind_parameter_name=e.sqlite3_bind_parameter_name,f._sqlite3_bind_parameter_index=e.sqlite3_bind_parameter_index,f._sqlite3_db_handle=e.sqlite3_db_handle,f._sqlite3_stmt_readonly=e.sqlite3_stmt_readonly,f._sqlite3_stmt_isexplain=e.sqlite3_stmt_isexplain,f._sqlite3_stmt_explain=e.sqlite3_stmt_explain,f._sqlite3_stmt_busy=e.sqlite3_stmt_busy,f._sqlite3_next_stmt=e.sqlite3_next_stmt,f._sqlite3_stmt_status=e.sqlite3_stmt_status,f._sqlite3_sql=e.sqlite3_sql,f._sqlite3_expanded_sql=e.sqlite3_expanded_sql,f._sqlite3_preupdate_old=e.sqlite3_preupdate_old,f._sqlite3_preupdate_count=e.sqlite3_preupdate_count,f._sqlite3_preupdate_depth=e.sqlite3_preupdate_depth,f._sqlite3_preupdate_blobwrite=e.sqlite3_preupdate_blobwrite,f._sqlite3_preupdate_new=e.sqlite3_preupdate_new,f._sqlite3_value_numeric_type=e.sqlite3_value_numeric_type,f._sqlite3_set_authorizer=e.sqlite3_set_authorizer,f._sqlite3_strglob=e.sqlite3_strglob,f._sqlite3_strlike=e.sqlite3_strlike,f._sqlite3_auto_extension=e.sqlite3_auto_extension,f._sqlite3_cancel_auto_extension=e.sqlite3_cancel_auto_extension,f._sqlite3_reset_auto_extension=e.sqlite3_reset_auto_extension,f._sqlite3_prepare_v3=e.sqlite3_prepare_v3,f._sqlite3_create_module=e.sqlite3_create_module,f._sqlite3_create_module_v2=e.sqlite3_create_module_v2,f._sqlite3_drop_modules=e.sqlite3_drop_modules,f._sqlite3_declare_vtab=e.sqlite3_declare_vtab,f._sqlite3_vtab_on_conflict=e.sqlite3_vtab_on_conflict,f._sqlite3_vtab_collation=e.sqlite3_vtab_collation,f._sqlite3_vtab_in=e.sqlite3_vtab_in,f._sqlite3_vtab_rhs_value=e.sqlite3_vtab_rhs_value,f._sqlite3_vtab_distinct=e.sqlite3_vtab_distinct,f._sqlite3_keyword_name=e.sqlite3_keyword_name,f._sqlite3_keyword_count=e.sqlite3_keyword_count,f._sqlite3_keyword_check=e.sqlite3_keyword_check,f._sqlite3_complete=e.sqlite3_complete,f._sqlite3_libversion=e.sqlite3_libversion,f._sqlite3_libversion_number=e.sqlite3_libversion_number,f._sqlite3_shutdown=e.sqlite3_shutdown,f._sqlite3_last_insert_rowid=e.sqlite3_last_insert_rowid,f._sqlite3_set_last_insert_rowid=e.sqlite3_set_last_insert_rowid,f._sqlite3_changes64=e.sqlite3_changes64,f._sqlite3_changes=e.sqlite3_changes,f._sqlite3_total_changes64=e.sqlite3_total_changes64,f._sqlite3_total_changes=e.sqlite3_total_changes,f._sqlite3_txn_state=e.sqlite3_txn_state,f._sqlite3_close_v2=e.sqlite3_close_v2,f._sqlite3_busy_handler=e.sqlite3_busy_handler,f._sqlite3_progress_handler=e.sqlite3_progress_handler,f._sqlite3_busy_timeout=e.sqlite3_busy_timeout,f._sqlite3_interrupt=e.sqlite3_interrupt,f._sqlite3_is_interrupted=e.sqlite3_is_interrupted,f._sqlite3_create_function=e.sqlite3_create_function,f._sqlite3_create_function_v2=e.sqlite3_create_function_v2,f._sqlite3_create_window_function=e.sqlite3_create_window_function,f._sqlite3_overload_function=e.sqlite3_overload_function,f._sqlite3_trace_v2=e.sqlite3_trace_v2,f._sqlite3_commit_hook=e.sqlite3_commit_hook,f._sqlite3_update_hook=e.sqlite3_update_hook,f._sqlite3_rollback_hook=e.sqlite3_rollback_hook,f._sqlite3_preupdate_hook=e.sqlite3_preupdate_hook,f._sqlite3_set_errmsg=e.sqlite3_set_errmsg,f._sqlite3_error_offset=e.sqlite3_error_offset,f._sqlite3_errcode=e.sqlite3_errcode,f._sqlite3_extended_errcode=e.sqlite3_extended_errcode,f._sqlite3_errstr=e.sqlite3_errstr,f._sqlite3_limit=e.sqlite3_limit,f._sqlite3_open=e.sqlite3_open,f._sqlite3_open_v2=e.sqlite3_open_v2,f._sqlite3_create_collation=e.sqlite3_create_collation,f._sqlite3_create_collation_v2=e.sqlite3_create_collation_v2,f._sqlite3_collation_needed=e.sqlite3_collation_needed,f._sqlite3_get_autocommit=e.sqlite3_get_autocommit,f._sqlite3_table_column_metadata=e.sqlite3_table_column_metadata,f._sqlite3_extended_result_co
2des=e.sqlite3_extended_result_codes,f._sqlite3_uri_key=e.sqlite3_uri_key,f._sqlite3_uri_int64=e.sqlite3_uri_int64,f._sqlite3_db_name=e.sqlite3_db_name,f._sqlite3_db_filename=e.sqlite3_db_filename,f._sqlite3_db_readonly=e.sqlite3_db_readonly,f._sqlite3_compileoption_used=e.sqlite3_compileoption_used,f._sqlite3_compileoption_get=e.sqlite3_compileoption_get,f._sqlite3session_diff=e.sqlite3session_diff,f._sqlite3session_attach=e.sqlite3session_attach,f._sqlite3session_create=e.sqlite3session_create,f._sqlite3session_delete=e.sqlite3session_delete,f._sqlite3session_table_filter=e.sqlite3session_table_filter,f._sqlite3session_changeset=e.sqlite3session_changeset,f._sqlite3session_changeset_strm=e.sqlite3session_changeset_strm,f._sqlite3session_patchset_strm=e.sqlite3session_patchset_strm,f._sqlite3session_patchset=e.sqlite3session_patchset,f._sqlite3session_enable=e.sqlite3session_enable,f._sqlite3session_indirect=e.sqlite3session_indirect,f._sqlite3session_isempty=e.sqlite3session_isempty,f._sqlite3session_memory_used=e.sqlite3session_memory_used,f._sqlite3session_object_config=e.sqlite3session_object_config,f._sqlite3session_changeset_size=e.sqlite3session_changeset_size,f._sqlite3changeset_start=e.sqlite3changeset_start,f._sqlite3changeset_start_v2=e.sqlite3changeset_start_v2,f._sqlite3changeset_start_strm=e.sqlite3changeset_start_strm,f._sqlite3changeset_start_v2_strm=e.sqlite3changeset_start_v2_strm,f._sqlite3changeset_next=e.sqlite3changeset_next,f._sqlite3changeset_op=e.sqlite3changeset_op,f._sqlite3changeset_pk=e.sqlite3changeset_pk,f._sqlite3changeset_old=e.sqlite3changeset_old,f._sqlite3changeset_new=e.sqlite3changeset_new,f._sqlite3changeset_conflict=e.sqlite3changeset_conflict,f._sqlite3changeset_fk_conflicts=e.sqlite3changeset_fk_conflicts,f._sqlite3changeset_finalize=e.sqlite3changeset_finalize,f._sqlite3changeset_invert=e.sqlite3changeset_invert,f._sqlite3changeset_invert_strm=e.sqlite3changeset_invert_strm,f._sqlite3changeset_apply_v2=e.sqlite3changeset_apply_v2,f._sqlite3changeset_apply_v3=e.sqlite3changeset_apply_v3,f._sqlite3changeset_apply=e.sqlite3changeset_apply,f._sqlite3changeset_apply_v3_strm=e.sqlite3changeset_apply_v3_strm,f._sqlite3changeset_apply_v2_strm=e.sqlite3changeset_apply_v2_strm,f._sqlite3changeset_apply_strm=e.sqlite3changeset_apply_strm,f._sqlite3changegroup_new=e.sqlite3changegroup_new,f._sqlite3changegroup_add=e.sqlite3changegroup_add,f._sqlite3changegroup_output=e.sqlite3changegroup_output,f._sqlite3changegroup_add_strm=e.sqlite3changegroup_add_strm,f._sqlite3changegroup_output_strm=e.sqlite3changegroup_output_strm,f._sqlite3changegroup_delete=e.sqlite3changegroup_delete,f._sqlite3changeset_concat=e.sqlite3changeset_concat,f._sqlite3changeset_concat_strm=e.sqlite3changeset_concat_strm,f._sqlite3session_config=e.sqlite3session_config,f._sqlite3_sourceid=e.sqlite3_sourceid,f._sqlite3__wasm_pstack_ptr=e.sqlite3__wasm_pstack_ptr,f._sqlite3__wasm_pstack_restore=e.sqlite3__wasm_pstack_restore,f._sqlite3__wasm_pstack_alloc=e.sqlite3__wasm_pstack_alloc,f._sqlite3__wasm_pstack_remaining=e.sqlite3__wasm_pstack_remaining,f._sqlite3__wasm_pstack_quota=e.sqlite3__wasm_pstack_quota,f._sqlite3__wasm_test_struct=e.sqlite3__wasm_test_struct,f._sqlite3__wasm_enum_json=e.sqlite3__wasm_enum_json,f._sqlite3__wasm_vfs_unlink=e.sqlite3__wasm_vfs_unlink,f._sqlite3__wasm_db_vfs=e.sqlite3__wasm_db_vfs,f._sqlite3__wasm_db_reset=e.sqlite3__wasm_db_reset,f._sqlite3__wasm_db_export_chunked=e.sqlite3__wasm_db_export_chunked,f._sqlite3__wasm_db_serialize=e.sqlite3__wasm_db_serialize,f._sqlite3__wasm_vfs_create_file=e.sqlite3__wasm_vfs_create_file,f._sqlite3__wasm_posix_create_file=e.sqlite3__wasm_posix_create_file,f._sqlite3__wasm_kvvfsMakeKey=e.sqlite3__wasm_kvvfsMakeKey,f._sqlite3__wasm_kvvfs_methods=e.sqlite3__wasm_kvvfs_methods,f._sqlite3__wasm_vtab_config=e.sqlite3__wasm_vtab_config,f._sqlite3__wasm_db_config_ip=e.sqlite3__wasm_db_config_ip,f._sqlite3__wasm_db_config_pii=e.sqlite3__wasm_db_config_pii,f._sqlite3__wasm_db_config_s=e.sqlite3__wasm_db_config_s,f._sqlite3__wasm_config_i=e.sqlite3__wasm_config_i,f._sqlite3__wasm_config_ii=e.sqlite3__wasm_config_ii,f._sqlite3__wasm_config_j=e.sqlite3__wasm_config_j,f._sqlite3__wasm_qfmt_token=e.sqlite3__wasm_qfmt_token,f._sqlite3__wasm_kvvfs_decode=e.sqlite3__wasm_kvvfs_decode,f._sqlite3__wasm_kvvfs_encode=e.sqlite3__wasm_kvvfs_encode,f._sqlite3__wasm_init_wasmfs=e.sqlite3__wasm_init_wasmfs,f._sqlite3__wasm_test_intptr=e.sqlite3__wasm_test_intptr,f._sqlite3__wasm_test_voidptr=e.sqlite3__wasm_test_voidptr,f._sqlite3__wasm_test_int64_max=e.sqlite3__wasm_test_int64_max,f._sqlite3__wasm_test_int64_min=e.sqlite3__wasm_test_int64_min,f._sqlite3__wasm_test_int64_times2=e.sqlite3__wasm_test_int64_times2,f._sqlite3__wasm_test_int64_minmax=e.sqlite3__wasm_test_int64_minmax,f._sqlite3__wasm_test_int64ptr=e.sqlite3__wasm_test_int64ptr,f._sqlite3__wasm_test_stack_overflow=e.sqlite3__wasm_test_stack_overflow,f._sqlite3__wasm_test_str_hello=e.sqlite3__wasm_test_str_hello,f._sqlite3__wasm_SQLTester_strglob=e.sqlite3__wasm_SQLTester_strglob,f._malloc=e.malloc,f._free=e.free,f._realloc=e.realloc,$t=e.emscripten_builtin_memalign,e._emscripten_stack_restore,e._emscripten_stack_alloc,e.emscripten_stack_get_current,e.__indirect_function_table}var Kt={__syscall_chmod:En,__syscall_faccessat:An,__syscall_fchmod:In,__syscall_fchown32:kn,__syscall_fcntl64:Tn,__syscall_fstat64:On,__syscall_ftruncate64:Fn,__syscall_getcwd:Ln,__syscall_ioctl:Cn,__syscall_lstat64:Nn,__syscall_mkdirat:Rn,__syscall_newfstatat:Dn,__syscall_open
2at:jn,__syscall_readlinkat:zn,__syscall_rmdir:Mn,__syscall_stat64:Bn,__syscall_unlinkat:Wn,__syscall_utimensat:Un,_localtime_js:$n,_mmap_js:Kn,_munmap_js:Jn,_tzset_js:Xn,clock_time_get:Zn,emscripten_date_now:Vt,emscripten_get_heap_max:er,emscripten_get_now:Ht,emscripten_resize_heap:nr,environ_get:ir,environ_sizes_get:sr,fd_close:or,fd_fdstat_get:lr,fd_read:cr,fd_seek:ur,fd_sync:_r,fd_write:dr,memory:Ke};function Tt(){if(et>0){ft=Tt;return}if(en(),et>0){ft=Tt;return}function e(){f.calledRun=!0,!it&&(tn(),gt?.(f),f.onRuntimeInitialized?.(),nn())}f.setStatus?(f.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>f.setStatus(""),1),e()},1)):e()}var lt=await un();return Tt(),f.runSQLite3PostLoadInit=async function(e,n,l){delete n.runSQLite3PostLoadInit,globalThis.sqlite3ApiBootstrap=async function i(t=globalThis.sqlite3ApiConfig||i.defaultConfig){if(i.sqlite3)return(i.sqlite3.config||console).warn("sqlite3ApiBootstrap() called multiple times.","Config and external initializers are ignored on calls after the first."),i.sqlite3;const r=(...d)=>Object.assign(Object.create(null),...d),s=r({exports:void 0,memory:void 0,bigIntEnabled:!!globalThis.BigInt64Array,debug:(()=>{}).bind(console),warn:(()=>{}).bind(console),error:(()=>{}).bind(console),log:(()=>{}).bind(console),wasmfsOpfsDir:"/opfs",useStdAlloc:!1},t);Object.assign(s,{allocExportName:s.useStdAlloc?"malloc":"sqlite3_malloc",deallocExportName:s.useStdAlloc?"free":"sqlite3_free",reallocExportName:s.useStdAlloc?"realloc":"sqlite3_realloc"}),["exports","memory","functionTable","wasmfsOpfsDir"].forEach(d=>{typeof s[d]=="function"&&(s[d]=s[d]())});const _=r(),c=r(),b=d=>_.sqlite3_js_rc_str&&_.sqlite3_js_rc_str(d)||"Unknown result code #"+d,z=d=>typeof d=="number"&&d===(d|0)&&d<=2147483647&&d>=-2147483648;class I extends Error{constructor(...y){let F;if(y.length)if(z(y[0]))if(F=y[0],y.length===1)super(b(y[0]));else{const W=b(F);typeof y[1]=="object"?super(W,y[1]):(y[0]=W+":",super(y.join(" ")))}else y.length===2&&typeof y[1]=="object"?super(...y):super(y.join(" "));this.resultCode=F||_.SQLITE_ERROR,this.name="SQLite3Error"}}I.toss=(...d)=>{throw new I(...d)};const q=I.toss;s.wasmfsOpfsDir&&!/^\/[^/]+$/.test(s.wasmfsOpfsDir)&&q("config.wasmfsOpfsDir must be falsy or in the form '/dir-name'.");const w=function d(y){return d._max||(d._max=BigInt("0x7fffffffffffffff"),d._min=~d._max),y>=d._min&&y<=d._max},x=d=>d>=-2147483647n-1n&&d<=2147483647n,L=function d(y){return d._min||(d._min=Number.MIN_SAFE_INTEGER,d._max=Number.MAX_SAFE_INTEGER),y>=d._min&&y<=d._max},H=d=>d&&d.constructor&&z(d.constructor.BYTES_PER_ELEMENT)?d:!1,g=d=>d&&(d instanceof Uint8Array||d instanceof Int8Array||d instanceof ArrayBuffer),h=d=>d&&(d instanceof Uint8Array||d instanceof Int8Array||d instanceof ArrayBuffer),D=d=>g(d)||q("Value is not of a supported TypedArray type."),U=function(d){return h(d)?c.typedArrayToString(d instanceof ArrayBuffer?new Uint8Array(d):d,0,d.length):Array.isArray(d)?d.join(""):(c.isPtr(d)&&(d=c.cstrToJs(d)),d)};class A extends Error{constructor(...y){y.length===2&&typeof y[1]=="object"?super(...y):y.length?super(y.join(" ")):super("Allocation failed."),this.resultCode=_.SQLITE_NOMEM,this.name="WasmAllocError"}}A.toss=(...d)=>{throw new A(...d)},Object.assign(_,{sqlite3_bind_blob:void 0,sqlite3_bind_text:void 0,sqlite3_create_function_v2:(d,y,F,W,P,X,ee,Z,ne)=>{},sqlite3_create_function:(d,y,F,W,P,X,ee,Z)=>{},sqlite3_create_window_function:(d,y,F,W,P,X,ee,Z,ne,E)=>{},sqlite3_prepare_v3:(d,y,F,W,P,X)=>{},sqlite3_prepare_v2:(d,y,F,W,P)=>{},sqlite3_exec:(d,y,F,W,P)=>{},sqlite3_randomness:(d,y)=>{}});const N={affirmBindableTypedArray:D,flexibleString:U,bigIntFits32:x,bigIntFits64:w,bigIntFitsDouble:L,isBindableTypedArray:g,isInt32:z,isSQLableTypedArray:h,isTypedArray:H,isUIThread:()=>globalThis.window===globalThis&&!!globalThis.document,toss:function(...d){throw new Error(d.join(" "))},toss3:q,typedArrayPart:c.typedArrayPart,nu:r,assert:function(d,y){d||N.toss("Assertion failed:",y)},affirmDbHeader:function(d){d instanceof ArrayBuffer&&(d=new Uint8Array(d));const y="SQLite format 3";15>d.byteLength&&q("Input does not contain an SQLite3 database header.");for(let F=0;F<15;++F)y.charCodeAt(F)!==d[F]&&q("Input does not contain an SQLite3 database header.")},affirmIsDb:function(d){d instanceof ArrayBuffer&&(d=new Uint8Array(d));const y=d.byteLength;
2(y<512||y%512!==0)&&q("Byte array size",y,"is invalid for an SQLite3 db."),N.affirmDbHeader(d)}};Object.assign(c,{exports:s.exports||q("Missing API config.exports (WASM module exports)."),memory:s.memory||s.exports.memory||q("API config object requires a WebAssembly.Memory object","in either config.exports.memory (exported)","or config.memory (imported)."),pointerSize:typeof s.exports.sqlite3_libversion()=="number"?4:8,bigIntEnabled:!!s.bigIntEnabled,functionTable:s.functionTable,alloc:void 0,realloc:void 0,dealloc:void 0}),c.allocFromTypedArray=function(d){d instanceof ArrayBuffer&&(d=new Uint8Array(d)),D(d);const y=c.alloc(d.byteLength||1);return c.heapForSize(d.constructor).set(d.byteLength?d:[0],Number(y)),y};{const d=s.allocExportName,y=s.deallocExportName,F=s.reallocExportName;for(const W of[d,y,F])c.exports[W]instanceof Function||q("Missing required exports[",W,"] function.");c.alloc=function W(P){return W.impl(P)||A.toss("Failed to allocate",P," bytes.")},c.alloc.impl=c.exports[d],c.realloc=function W(P,X){const ee=W.impl(c.ptr.coerce(P),X);return X?ee||A.toss("Failed to reallocate",X," bytes."):c.ptr.null},c.realloc.impl=c.exports[F],c.dealloc=function W(P){W.impl(c.ptr.coerce(P))},c.dealloc.impl=c.exports[y]}c.compileOptionUsed=function d(y){if(arguments.length){if(Array.isArray(y)){const F=r();return y.forEach(W=>{F[W]=_.sqlite3_compileoption_used(W)}),F}else if(typeof y=="object")return Object.keys(y).forEach(F=>{y[F]=_.sqlite3_compileoption_used(F)}),y}else{if(d._result)return d._result;
2d._opt||(d._rx=/^([^=]+)=(.+)/,d._rxInt=/^-?\d+$/,d._opt=function(ee,Z){const ne=d._rx.exec(ee);Z[0]=ne?ne[1]:ee,Z[1]=ne?d._rxInt.test(ne[2])?+ne[2]:ne[2]:!0});const F=r(),W=[0,0];let P=0,X;for(;X=_.sqlite3_compileoption_get(P++);)d._opt(X,W),F[W[0]]=W[1];return d._result=F}return typeof y=="string"?!!_.sqlite3_compileoption_used(y):!1},c.pstack=r({restore:c.exports.sqlite3__wasm_pstack_restore,alloc:function(d){return typeof d=="string"&&!(d=c.sizeofIR(d))&&A.toss("Invalid value for pstack.alloc(",arguments[0],")"),c.exports.sqlite3__wasm_pstack_alloc(d)||A.toss("Could not allocate",d,"bytes from the pstack.")},allocChunks:function(d,y){typeof y=="string"&&!(y=c.sizeofIR(y))&&A.toss("Invalid size value for allocChunks(",arguments[1],")");const F=c.pstack.alloc(d*y),W=[F];let P=1,X=y;for(;P<d;++P,X+=y)W.push(c.ptr.add(F,X));return W},allocPtr:(d=1,y=!0)=>d===1?c.pstack.alloc(y?8:c.ptr.size):c.pstack.allocChunks(d,y?8:c.ptr.size),call:function(d){const y=c.pstack.pointer;try{return d(K)}finally{c.pstack.restore(y)}}}),Object.defineProperties(c.pstack,{pointer:{configurable:!1,iterable:!0,writeable:!1,get:c.exports.sqlite3__wasm_pstack_ptr},quota:{configurable:!1,iterable:!0,writeable:!1,get:c.exports.sqlite3__wasm_pstack_quota},remaining:{configurable:!1,iterable:!0,writeable:!1,get:c.exports.sqlite3__wasm_pstack_remaining}}),_.sqlite3_randomness=(...d)=>{if(d.length===1&&N.isTypedArray(d[0])&&d[0].BYTES_PER_ELEMENT===1){const y=d[0];if(y.byteLength===0)return c.exports.sqlite3_randomness(0,c.ptr.null),y;const F=c.pstack.pointer;try{let W=y.byteLength,P=0;const X=c.exports.sqlite3_randomness,ee=c.heap8u(),Z=W<512?W:512,ne=c.pstack.alloc(Z);do{const E=W>Z?Z:W;X(E,ne),y.set(c.typedArrayPart(ee,ne,c.ptr.add(ne,E)),P),W-=E,P+=E}while(W>0)}catch(W){s.error("Highly unexpected (and ignored!) exception in sqlite3_randomness():",W)}finally{c.pstack.restore(F)}return y}c.exports.sqlite3_randomness(...d)},_.sqlite3_wasmfs_opfs_dir=(function(){if(this.dir!==void 0)return this.dir;const d=s.wasmfsOpfsDir;if(!d||!globalThis.FileSystemHandle||!globalThis.FileSystemDirectoryHandle||!globalThis.FileSystemFileHandle||!c.exports.sqlite3__wasm_init_wasmfs)return this.dir="";try{return d&&c.xCallWrapped("sqlite3__wasm_init_wasmfs","i32",["string"],d)===0?this.dir=d:this.dir=""}catch{return this.dir=""}}).bind(r()),_.sqlite3_wasmfs_filename_is_persistent=function(d){const y=_.sqlite3_wasmfs_opfs_dir();return y&&d?d.startsWith(y+"/"):!1},_.sqlite3_js_db_uses_vfs=function(d,y,F=0){try{const W=_.sqlite3_vfs_find(y);return W?d?W===_.sqlite3_js_db_vfs(d,F)?W:!1:W===_.sqlite3_vfs_find(0)?W:!1:!1}catch{return!1}},_.sqlite3_js_vfs_list=function(){const d=[];let y=_.sqlite3_vfs_find(c.ptr.null);for(;y;){const F=new _.sqlite3_vfs(y);d.push(c.cstrToJs(F.$zName)),y=F.$pNext,F.dispose()}return d},_.sqlite3_js_db_export=function(d,y=0){d=c.xWrap.testConvertArg("sqlite3*",d),d||q("Invalid sqlite3* argument."),c.bigIntEnabled||q("BigInt support is not enabled.");const F=c.scopedAllocPush();let W;try{const P=c.scopedAlloc(8+c.ptr.size),X=c.ptr.add(P,8),ee=y?c.isPtr(y)?y:c.scopedAllocCString(""+y):c.ptr.null;let Z=c.exports.sqlite3__wasm_db_serialize(d,ee,X,P,0);Z&&q("Database serialization failed with code",K.capi.sqlite3_js_rc_str(Z)
2),W=c.peekPtr(X);const ne=c.peek(P,"i64");return Z=ne?c.heap8u().slice(Number(W),Number(W)+Number(ne)):new Uint8Array,Z}finally{W&&c.exports.sqlite3_free(W),c.scopedAllocPop(F)}},_.sqlite3_js_db_vfs=(d,y=c.ptr.null)=>N.sqlite3__wasm_db_vfs(d,y),_.sqlite3_js_aggregate_context=(d,y)=>_.sqlite3_aggregate_context(d,y)||(y?A.toss("Cannot allocate",y,"bytes for sqlite3_aggregate_context()"):0),_.sqlite3_js_posix_create_file=function(d,y,F){let W;y&&c.isPtr(y)?W=y:y instanceof ArrayBuffer||y instanceof Uint8Array?(W=c.allocFromTypedArray(y),(arguments.length<3||!N.isInt32(F)||F<0)&&(F=y.byteLength)):I.toss("Invalid 2nd argument for sqlite3_js_posix_create_file().");try{(!N.isInt32(F)||F<0)&&I.toss("Invalid 3rd argument for sqlite3_js_posix_create_file().");const P=N.sqlite3__wasm_posix_create_file(d,W,F);P&&I.toss("Creation of file failed with sqlite3 result code",_.sqlite3_js_rc_str(P))}finally{W&&W!==y&&c.dealloc(W)}},_.sqlite3_js_vfs_create_file=function(d,y,F,W){s.warn("sqlite3_js_vfs_create_file() is deprecated and","should be avoided because it can lead to C-level crashes.","See its documentation for alternatives.");let P;F?c.isPtr(F)?P=F:(F instanceof ArrayBuffer&&(F=new Uint8Array(F)),F instanceof Uint8Array?(P=c.allocFromTypedArray(F),(arguments.length<4||!N.isInt32(W)||W<0)&&(W=F.byteLength)):I.toss("Invalid 3rd argument type for sqlite3_js_vfs_create_file().")):P=0,(!N.isInt32(W)||W<0)&&(P&&P!==F&&c.dealloc(P),I.toss("Invalid 4th argument for sqlite3_js_vfs_create_file()."));try{const X=N.sqlite3__wasm_vfs_create_file(d,y,P,W);X&&I.toss("Creation of file failed with sqlite3 result code",_.sqlite3_js_rc_str(X))}finally{P&&P!==F&&c.dealloc(P)}},_.sqlite3_js_sql_to_string=d=>{if(typeof d=="string")return d;const y=U(v);return y===v?void 0:y},_.sqlite3_db_config=(function(d,y,...F){switch(y){case _.SQLITE_DBCONFIG_ENABLE_FKEY:case _.SQLITE_DBCONFIG_ENABLE_TRIGGER:case _.SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER:case _.SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION:case _.SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE:case _.SQLITE_DBCONFIG_ENABLE_QPSG:case _.SQLITE_DBCONFIG_TRIGGER_EQP:case _.SQLITE_DBCONFIG_RESET_DATABASE:case _.SQLITE_DBCONFIG_DEFENSIVE:case _.SQLITE_DBCONFIG_WRITABLE_SCHEMA:case _.SQLITE_DBCONFIG_LEGACY_ALTER_TABLE:case _.SQLITE_DBCONFIG_DQS_DML:case _.SQLITE_DBCONFIG_DQS_DDL:case _.SQLITE_DBCONFIG_ENABLE_VIEW:case _.SQLITE_DBCONFIG_LEGACY_FILE_FORMAT:case _.SQLITE_DBCONFIG_TRUSTED_SCHEMA:case _.SQLITE_DBCONFIG_STMT_SCANSTATUS:case _.SQLITE_DBCONFIG_REVERSE_SCANORDER:case _.SQLITE_DBCONFIG_ENABLE_ATTACH_CREATE:case _.SQLITE_DBCONFIG_ENABLE_ATTACH_WRITE:case _.SQLITE_DBCONFIG_ENABLE_COMMENTS:case _.SQLITE_DBCONFIG_FP_DIGITS:return this.ip||(this.ip=c.xWrap("sqlite3__wasm_db_config_ip","int",["sqlite3*","int","int","*"])),this.ip(d,y,F[0],F[1]||0);case _.SQLITE_DBCONFIG_LOOKASIDE:return this.pii||(this.pii=c.xWrap("sqlite3__wasm_db_config_pii","int",["sqlite3*","int","*","int","int"])),this.pii(d,y,F[0],F[1],F[2]);case _.SQLITE_DBCONFIG_MAINDBNAME:return this.s||(this.s=c.xWrap("sqlite3__wasm_db_config_s","int",["sqlite3*","int","string:static"])),this.s(d,y,F[0]);default:return _.SQLITE_MISUSE}}).bind(r()),_.sqlite3_value_to_js=function(d,y=!0){let F;const W=_.sqlite3_value_type(d);switch(W){case _.SQLITE_INTEGER:c.bigIntEnabled?(F=_.sqlite3_value_int64(d),N.bigIntFitsDouble(F)&&(F=Number(F))):F=_.sqlite3_value_double(d);break;case _.SQLITE_FLOAT:F=_.sqlite3_value_double(d);break;case _.SQLITE_TEXT:F=_.sqlite3_value_text(d);break;case _.SQLITE_BLOB:{const P=_.sqlite3_value_bytes(d),X=_.sqlite3_value_blob(d);P&&!X&&K.WasmAllocError.toss("Cannot allocate memory for blob argument of",P,"byte(s)"),F=P?c.heap8u().slice(Number(X),Number(X)+Number(P)):null;break}case _.SQLITE_NULL:F=null;break;default:y&&q(_.SQLITE_MISMATCH,"Unhandled sqlite3_value_type():",W),F=void 0}return F},_.sqlite3_values_to_js=function(d,y,F=!0){let W;const P=[];for(W=0;W<d;++W)P.push(_.sqlite3_value_to_js(c.peekPtr(c.ptr.add(y,c.ptr.size*W)),F));return P},_.sqlite3_result_error_js=function(d,y){y instanceof A?_.sqlite3_result_error_nomem(d):_.sqlite3_result_error(d,""+y,-1)}
2,_.sqlite3_result_js=function(d,y){if(y instanceof Error){_.sqlite3_result_error_js(d,y);return}try{switch(typeof y){case"undefined":break;case"boolean":_.sqlite3_result_int(d,y?1:0);break;case"bigint":N.bigIntFits32(y)?_.sqlite3_result_int(d,Number(y)):N.bigIntFitsDouble(y)?_.sqlite3_result_double(d,Number(y)):c.bigIntEnabled?N.bigIntFits64(y)?_.sqlite3_result_int64(d,y):q("BigInt value",y.toString(),"is too BigInt for int64."):q("BigInt value",y.toString(),"is too BigInt.");break;case"number":{let F;N.isInt32(y)?F=_.sqlite3_result_int:c.bigIntEnabled&&Number.isInteger(y)&&N.bigIntFits64(BigInt(y))?F=_.sqlite3_result_int64:F=_.sqlite3_result_double,F(d,y);break}case"string":{const[F,W]=c.allocCString(y,!0);_.sqlite3_result_text(d,F,W,_.SQLITE_WASM_DEALLOC);break}case"object":if(y===null){_.sqlite3_result_null(d);break}else if(N.isBindableTypedArray(y)){const F=c.allocFromTypedArray(y);_.sqlite3_result_blob(d,F,y.byteLength,_.SQLITE_WASM_DEALLOC);break}default:q("Don't not how to handle this UDF result value:",typeof y,y)}}catch(F){_.sqlite3_result_error_js(d,F)}},_.sqlite3_column_js=function(d,y,F=!0){const W=_.sqlite3_column_value(d,y);return W===0?void 0:_.sqlite3_value_to_js(W,F)};{const d=(function(y,F,W){W=_[W],this.ptr?c.pokePtr(this.ptr,0):this.ptr=c.allocPtr();const P=W(y,F,this.ptr);if(P)return I.toss(P,arguments[2]+"() failed with code "+P);const X=c.peekPtr(this.ptr);return X?_.sqlite3_value_to_js(X,!0):void 0}).bind(r());_.sqlite3_preupdate_new_js=(y,F)=>d(y,F,"sqlite3_preupdate_new"),_.sqlite3_preupdate_old_js=(y,F)=>d(y,F,"sqlite3_preupdate_old"),_.sqlite3changeset_new_js=(y,F)=>d(y,F,"sqlite3changeset_new"),_.sqlite3changeset_old_js=(y,F)=>d(y,F,"sqlite3changeset_old")}_.sqlite3_js_retry_busy=function(d,y,F){for(let W=1;W<=d;++W)try{F&&W>1&&F(W);const P=y();if(_.SQLITE_BUSY===P){if(W===d)throw new I(P,["sqlite3_js_retry_busy() max retry attempts (",d,") reached."].join(""));continue}return P}catch(P){if(W<d&&P instanceof I&&P.resultCode===_.SQLITE_BUSY)continue;throw P}};const K={WasmAllocError:A,SQLite3Error:I,capi:_,util:N,wasm:c,config:s,version:r(),client:void 0,asyncPostInit:(async function d(){if(d.isReady instanceof Promise)return d.isReady;let y=this.initializersAsync;delete this.initializersAsync;const F=async()=>(K.__isUnderTest||(delete K.util,delete K.StructBinder,delete K.opfs),K),W=X=>{throw s.error("an async sqlite3 initializer failed:",X),X};if(!y||!y.length)return d.isReady=F().catch(W);y=y.map(X=>X instanceof Function?async ee=>X(K):X),y.push(F);let P=Promise.resolve(K);for(;y.length;)P=P.then(y.shift());return d.isReady=P.catch(W)}).bind(i),scriptInfo:void 0};typeof l<"u"&&(K.__isUnderTest=!!l);try{i.initializers.forEach(d=>{d(K)})}catch(d){throw d}if(delete i.initializers,i.sqlite3=K,typeof e<"u"&&(e.debugModule("sqlite3ApiBootstrap() complete",K),K.scriptInfo=e),K.__isUnderTest){typeof n<"u"&&(K.config.emscripten=n);const d=K.scriptInfo?.instantiateWasm;d&&(K.wasm.module=d.module,K.wasm.instance=d.instance,K.wasm.imports=d.imports)}return delete globalThis.sqlite3ApiConfig,delete globalThis.sqlite3ApiBootstrap,delete i.defaultConfig,K.asyncPostInit().then(d=>(typeof e<"u"&&e.debugModule("sqlite3.asyncPostInit() complete",d),delete d.asyncPostInit,delete d.scriptInfo,delete d.emscripten,d))},globalThis.sqlite3ApiBootstrap.initializers=[],globalThis.sqlite3ApiBootstrap.initializersAsync=[],globalThis.sqlite3ApiBootstrap.defaultConfig=Object.create(null),globalThis.sqlite3ApiBootstrap.sqlite3=void 0,globalThis.sqlite3ApiBootstrap.initializers.push(function(i){i.version={libVersion:"3.53.0",libVersionNumber:3053e3,sourceId:"2026-04-09 11:41:38 4525003a53a7fc63ca75c59b22c79608659ca12f0131f52c18637f829977f20b",downloadVersion:353e4,scm:{"sha3-256":"4525003a53a7fc63ca75c59b22c79608659ca12f0131f52c18637f829977f20b",branch:"trunk",tags:"release major-release version-3.53.0",datetime:"2026-04-09T11:41:38.498Z"}}}),globalThis.WhWasmUtilInstaller=function(t){t.bigIntEnabled===void 0&&(t.bigIntEnabled=!!globalThis.BigInt64Array);const r=(...o)=>{throw new Error(o.join(" "))};if(!t.pointerSize&&!t.pointerIR&&t.alloc&&t.dealloc){const o=t.alloc(1);t.pointerSize=typeof o=="bigint"?8:4,t.dealloc(o)}t.pointerSize&&!t.pointerIR&&(t.pointerIR=t.pointerSize===4?"i32":"i64");const s=t.pointerIR??="i32",_=t.pointerSize??=s==="i32"?4:s==="i64"?8:0;delete t.pointerSize,delete t.pointerIR,s!=="i32"&&s!=="i64"?r("Invalid pointerIR:",s):_!==8&&_!==4&&r("Invalid pointerSize:",_);const c=t.bigIntEnabled?o=>BigInt(o||0):o=>r("BigInt support is disabled in this build."),z=_===4?o=>Number(o||0):c,I=z(0),q=function(...o){let u=z(0);for(const p of o)u+=z(p);return u};{const o=Object.create(null);Object.defineProperty(t,"ptr",{enumerable:!0,get:()=>o,set:()=>r("The ptr property is read-only.")}),(function u(p,S){return Object.defineProperty(o,p,{enumerable:!0,get:()=>S,set:()=>r("ptr["+p+"] is read-only.")}),u})("null",I)("size",_)("ir",s)("coerce",z)("add",q)("addn",s===4?q:(...u)=>Number(q(...u)))}t.exports||Object.defineProperty(t,"exports",{enumerable:!0,configurable:!0,get:()=>t.instance?.exports});const w=Object.create(null);w.heapSize=0,w.memory=null,w.freeFuncIndexes=[],w.scopedAlloc=[],w.scopedAlloc.pushPtr=o=>(w.scopedAlloc[w.scopedAlloc.length-1].push(o),o),w.utf8Decoder=new TextDecoder,w.utf8Encoder=new TextEncoder("utf-8"),t.sizeofIR=o=>{switch(o){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 _;default:return(""+o).endsWith("*")?_:void 0}};const x=function(){if(!w.memory)w.memory=t.memory instanceof WebAssembly.Memory?t.memory:t.exports.memory;else if(w.heapSize===w.memory.buffer.byteLength)return w;const o=w.memory.buffer;return w.HEAP8=new Int8Array(o),w.HEAP8U=new Uint8Array(o),w.HEAP16=new Int16Array(o),w.HEAP16U=new Uint16Array(o),w.HEAP32=new Int32Array(o),w.HEAP32U=new Uint32Array(o),w.HEAP32F=new Float32Array(o),w.HEAP64F=new Float64Array(o),t.bigIntEnabled&&(typeof BigInt64Array<"u"?(w.HEAP64=new BigInt64Array(o),w.HEAP64U=new BigUint64Array(o)):r("BigInt support is enabled, but the BigInt64Array type is missing.")),w.heapSize=o.byteLength,w};t.heap8=()=>x().HEAP8,t.heap8u=()=>x().HEAP8U,t.heap16=()=>x().HEAP16,t.heap16u=()=>x().HEAP16U,t.heap32=()=>x().HEAP32,t.heap32u=()=>x().HEAP32U,t.heapForSize=function(o,u=!0){const p=w.memory&&w.heapSize===w.memory.buffer.byteLength?w:x();switch(o){case Int8Array:return p.HEAP8;case Uint8Array:return p.HEAP8U;case Int16Array:return p.HEAP16;case Uint16Array:return p.HEAP16U;case Int32Array:return p.HEAP32;case Uint32Array:return p.HEAP32U;case 8:return u?p.HEAP8U:p.HEAP8;case 16:return u?p.HEAP16U:p.HEAP16;case 32:return u?p.HEAP32U:p.HEAP32;case 64:if(p.HEAP64)return u?p.HEAP64U:p.HEAP64;break;default:if(t.bigIntEnabled){if(o===globalThis.BigUint64Array)return p.HEAP64U;if(o===globalThis.BigInt64Array)return p.HEAP64;break}}r("Invalid heapForSize() size: expecting 8, 16, 32,","or (if BigInt is enabled) 64.")};const L=t.functionTable;delete t.functionTable,t.functionTable=L?()=>L:()=>t.exports.__indirect_function_table,t.functionEntry=function(o){const u=t.functionTable();return o<u.length?u.get(z(o)):void 0},t.jsFuncToWasm=function o(u,p){if(o._||(o._={sigTypes:Object.assign(Object.create(null),{i:"i32",p:s,P:s,s,j:"i64",f:"f32",d:"f64"}),typeCodes:Object.assign(Object.create(null),{f64:124,f32:125,i64:126,i32:127}),uleb128Encode:(R,m,C)=>{C<128?R[m](C):R[m](C%128|128,C>>7)}
2,rxJSig:/^(\w)\((\w*)\)$/,sigParams:R=>{const m=o._.rxJSig.exec(R);return m?m[2]:R.substr(1)},letterType:R=>o._.sigTypes[R]||r("Invalid signature letter:",R),pushSigType:(R,m)=>R.push(o._.typeCodes[o._.letterType(m)])}),typeof u=="string"){const R=p;p=u,u=R}const S=o._,M=S.sigParams(p),V=[1,96];S.uleb128Encode(V,"push",M.length);for(const R of M)S.pushSigType(V,R);return p[0]==="v"?V.push(0):(V.push(1),S.pushSigType(V,p[0])),S.uleb128Encode(V,"unshift",V.length),V.unshift(0,97,115,109,1,0,0,0,1),V.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(V)),{e:{f:u}}).exports.f};const H=function(u,p,S){if(S&&!w.scopedAlloc.length&&r("No scopedAllocPush() scope is active."),typeof u=="string"){const m=p;p=u,u=m}(typeof p!="string"||!(u instanceof Function))&&r("Invalid arguments: expecting (function,signature) or (signature,function).");const M=t.functionTable(),V=z(M.length);let R;for(;(R=w.freeFuncIndexes.pop())&&M.get(R);){R=null;continue}R||(R=z(V),M.grow(z(1)));try{return M.set(R,u),S&&w.scopedAlloc.pushPtr(R),R}catch(m){if(!(m instanceof TypeError))throw R===V&&w.freeFuncIndexes.push(V),m}try{const m=t.jsFuncToWasm(u,p);M.set(R,m),S&&w.scopedAlloc.pushPtr(R)}catch(m){throw R===V&&w.freeFuncIndexes.push(V),m}return R};t.installFunction=(o,u)=>H(o,u,!1),t.scopedInstallFunction=(o,u)=>H(o,u,!0),t.uninstallFunction=function(o){if(!o&&I!==o)return;const u=t.functionTable();w.freeFuncIndexes.push(o);const p=u.get(o);return u.set(o,null),p},t.peek=function(u,p="i8"){p.endsWith("*")&&(p=s);const S=w.memory&&w.heapSize===w.memory.buffer.byteLength?w:x(),M=Array.isArray(u)?[]:void 0;let V;do{switch(M&&(u=arguments[0].shift()),p){case"i1":case"i8":V=S.HEAP8[Number(u)>>0];break;case"i16":V=S.HEAP16[Number(u)>>1];break;case"i32":V=S.HEAP32[Number(u)>>2];break;case"float":case"f32":V=S.HEAP32F[Number(u)>>2];break;case"double":case"f64":V=Number(S.HEAP64F[Number(u)>>3]);break;case"i64":if(S.HEAP64){V=c(S.HEAP64[Number(u)>>3]);break}default:r("Invalid type for peek():",p)}M&&M.push(V)}while(M&&arguments[0].length);return M||V},t.poke=function(o,u,p="i8"){p.endsWith("*")&&(p=s);const S=w.memory&&w.heapSize===w.memory.buffer.byteLength?w:x();for(const M of Array.isArray(o)?o:[o])switch(p){case"i1":case"i8":S.HEAP8[Number(M)>>0]=u;continue;case"i16":S.HEAP16[Number(M)>>1]=u;continue;case"i32":S.HEAP32[Number(M)>>2]=u;continue;case"float":case"f32":S.HEAP32F[Number(M)>>2]=u;continue;case"double":case"f64":S.HEAP64F[Number(M)>>3]=u;continue;case"i64":if(S.HEAP64){S.HEAP64[Number(M)>>3]=c(u);continue}default:r("Invalid type for poke(): "+p)}return this},t.peekPtr=(...o)=>t.peek(o.length===1?o[0]:o,s),t.pokePtr=(o,u=0)=>t.poke(o,u,s),t.peek8=(...o)=>t.peek(o.length===1?o[0]:o,"i8"),t.poke8=(o,u)=>t.poke(o,u,"i8"),t.peek16=(...o)=>t.peek(o.length===1?o[0]:o,"i16"),t.poke16=(o,u)=>t.poke(o,u,"i16"),t.peek32=(...o)=>t.peek(o.length===1?o[0]:o,"i32"),t.poke32=(o,u)=>t.poke(o,u,"i32"),t.peek64=(...o)=>t.peek(o.length===1?o[0]:o,"i64"),t.poke64=(o,u)=>t.poke(o,u,"i64"),t.peek32f=(...o)=>t.peek(o.length===1?o[0]:o,"f32"),t.poke32f=(o,u)=>t.poke(o,u,"f32"),t.peek64f=(...o)=>t.peek(o.length===1?o[0]:o,"f64"),t.poke64f=(o,u)=>t.poke(o,u,"f64"),t.getMemValue=t.peek,t.getPtrValue=t.peekPtr,t.setMemValue=t.poke,t.setPtrValue=t.pokePtr,t.isPtr32=o=>typeof o=="number"&&o>=0&&o===(o|0),t.isPtr64=o=>typeof o=="bigint"?o>=0:t.isPtr32(o),t.isPtr=_===4?t.isPtr32:t.isPtr64,t.cstrlen=function(o){if(!o||!t.isPtr(o))return null;o=Number(o);const u=x().HEAP8U;let p=o;for(;u[p]!==0;++p);return p-o};const g=typeof SharedArrayBuffer>"u"?function(){}:SharedArrayBuffer,h=o=>o.buffer instanceof g;t.isSharedTypedArray=h;const D=(o,u,p)=>(_===8&&(typeof u=="bigint"&&(u=Number(u)),typeof p=="bigint"&&(p=Number(p))),h(o)?o.slice(u,p):o.subarray(u,p));t.typedArrayPart=D;const U=(o,u,p)=>w.utf8Decoder.decode(D(o,u,p));t.typedArrayToString=U,t.cstrToJs=function(o){const u=t.cstrlen(o);return u?U(x().HEAP8U,Number(o),Number(o)+u):u===null?u:""},t.jstrlen=function(o){if(typeof o!="string")return null;const u=o.length;let p=0;for(let S=0;S<u;
2++S){let M=o.charCodeAt(S);M>=55296&&M<=57343&&(M=65536+((M&1023)<<10)|o.charCodeAt(++S)&1023),M<=127?++p:M<=2047?p+=2:M<=65535?p+=3:p+=4}return p},t.jstrcpy=function(o,u,p=0,S=-1,M=!0){if((!u||!(u instanceof Int8Array)&&!(u instanceof Uint8Array))&&r("jstrcpy() target must be an Int8Array or Uint8Array."),S=Number(S),p=Number(p),S<0&&(S=u.length-p),!(S>0)||!(p>=0))return 0;let V=0,R=o.length;const m=p,C=p+S-(M?1:0);for(;V<R&&p<C;++V){let B=o.charCodeAt(V);if(B>=55296&&B<=57343&&(B=65536+((B&1023)<<10)|o.charCodeAt(++V)&1023),B<=127){if(p>=C)break;u[p++]=B}else if(B<=2047){if(p+1>=C)break;u[p++]=192|B>>6,u[p++]=128|B&63}else if(B<=65535){if(p+2>=C)break;u[p++]=224|B>>12,u[p++]=128|B>>6&63,u[p++]=128|B&63}else{if(p+3>=C)break;u[p++]=240|B>>18,u[p++]=128|B>>12&63,u[p++]=128|B>>6&63,u[p++]=128|B&63}}return M&&(u[p++]=0),p-m},t.cstrncpy=function(o,u,p){if((!o||!u)&&r("cstrncpy() does not accept NULL strings."),p<0)p=t.cstrlen(strPtr)+1;else if(!(p>0))return 0;const S=t.heap8u();let M=0,V;const R=Number(o),m=Number(u);for(;M<p&&(V=S[m+M]);++M)S[R+M]=V;return M<p&&(S[R+M++]=0),M},t.jstrToUintArray=(o,u=!1)=>w.utf8Encoder.encode(u?o+"\0":o);const A=(o,u)=>{(!(o.alloc instanceof Function)||!(o.dealloc instanceof Function))&&r("Object is missing alloc() and/or dealloc() function(s)","required by",u+"().")},N=function(o,u,p,S){if(A(t,S),typeof o!="string")return null;const M=w.utf8Encoder.encode(o),V=p(M.length+1);let R=V;try{const m=x().HEAP8U;return m.set(M,Number(V)),m[q(V,M.length)]=0,R=I,u?[V,M.length]:V}finally{R&&t.dealloc(R)}};t.allocCString=(o,u=!1)=>N(o,u,t.alloc,"allocCString()"),t.scopedAllocPush=function(){A(t,"scopedAllocPush");const o=[];return w.scopedAlloc.push(o),o},t.scopedAllocPop=function(o){A(t,"scopedAllocPop");const u=arguments.length?w.scopedAlloc.indexOf(o):w.scopedAlloc.length-1;u<0&&r("Invalid state object for scopedAllocPop()."),arguments.length===0&&(o=w.scopedAlloc[u]),w.scopedAlloc.splice(u,1);for(let p;p=o.pop();)t.functionEntry(p)?t.uninstallFunction(p):t.dealloc(p)},t.scopedAlloc=function(o){w.scopedAlloc.length||r("No scopedAllocPush() scope is active.");const u=z(t.alloc(o));return w.scopedAlloc.pushPtr(u)},Object.defineProperty(t.scopedAlloc,"level",{configurable:!1,enumerable:!1,get:()=>w.scopedAlloc.length,set:()=>r("The 'active' property is read-only.")}),t.scopedAllocCString=(o,u=!1)=>N(o,u,t.scopedAlloc,"scopedAllocCString()");const K=function(o,u){const p=t[o?"scopedAlloc":"alloc"]((u.length+1)*t.ptr.size);let S=0;return u.forEach(M=>{t.pokePtr(q(p,t.ptr.size*S++),t[o?"scopedAllocCString":"allocCString"](""+M))}),t.pokePtr(q(p,t.ptr.size*S),0),p};t.scopedAllocMainArgv=o=>K(!0,o),t.allocMainArgv=o=>K(!1,o),t.cArgvToJs=(o,u)=>{const p=[];for(let S=0;S<o;++S){const M=t.peekPtr(q(u,t.ptr.size*S));p.push(M?t.cstrToJs(M):null)}return p},t.scopedAllocCall=function(o){t.scopedAllocPush();try{return o()}finally{t.scopedAllocPop()}};const d=function(o,u,p){A(t,p);const S=u?"i64":s;let M=t[p](o*(u?8:_));if(t.poke(M,0,S),o===1)return M;const V=[M];for(let R=1;R<o;++R)M=q(M,u?8:_),V[R]=M,t.poke(M,0,S);return V};t.allocPtr=(o=1,u=!0)=>d(o,u,"alloc"),t.scopedAllocPtr=(o=1,u=!0)=>d(o,u,"scopedAlloc"),t.xGet=function(o){return t.exports[o]||r("Cannot find exported symbol:",o)};const y=(o,u)=>r(o+"() requires",u,"argument(s).");t.xCall=function(o,...u){const p=o instanceof Function?o:t.xGet(o);return p instanceof Function||r("Exported symbol",o,"is not a function."),p.length!==u.length&&y(p===o?p.name:o,p.length),arguments.length===2&&Array.isArray(arguments[1])?p.apply(null,arguments[1]):p.apply(null,u)},w.xWrap=Object.create(null),w.xWrap.convert=Object.create(null),w.xWrap.convert.arg=new Map,w.xWrap.convert.result=new Map;const F=w.xWrap.convert.arg,W=w.xWrap.convert.result,P=z;F.set("i64",c).set("i32",o=>o|0).set("i16",o=>(o|0)&65535).set("i8",o=>(o|0)&255).set("f32",o=>Number(o).valueOf()).set("float",F.get("f32")).set("f64",F.get("f32")).set("double",F.get("f64")).set("int",F.get("i32")).set("null",o=>o).set(null,F.get("null")).set("**",P).set("*",P),W.set("*",P).set("pointer",P).set("number",o=>Number(o)).set("void",o=>{}).set(void 0,W.get("void")).set("null",o=>o).set(null,W.get("null"));for(const o of["i8","i16","i32","i64","int","f32","float","f64","double"])F.set(o+"*",P),W.set(o+"*",P),W.set(o,F.get(o)||r("Maintenance required: missing arg converter for",o));const X=o=>
2typeof o=="string"?t.scopedAllocCString(o):z(o);F.set("string",X).set("utf8",X),W.set("string",o=>t.cstrToJs(o)).set("utf8",W.get("string")).set("string:dealloc",o=>{try{return o?t.cstrToJs(o):null}finally{t.dealloc(o)}}).set("utf8:dealloc",W.get("string:dealloc")).set("json",o=>JSON.parse(t.cstrToJs(o))).set("json:dealloc",o=>{try{return o?JSON.parse(t.cstrToJs(o)):null}finally{t.dealloc(o)}});const ee=class{constructor(o){this.name=o.name||"unnamed adapter"}convertArg(o,u,p){r("AbstractArgAdapter must be subclassed.")}};F.FuncPtrAdapter=class Je extends ee{constructor(u){super(u),F.FuncPtrAdapter.warnOnUse,this.name=u.name||"unnamed",this.signature=u.signature,u.contextKey instanceof Function&&(this.contextKey=u.contextKey,u.bindScope||(u.bindScope="context")),this.bindScope=u.bindScope||r("FuncPtrAdapter options requires a bindScope (explicit or implied)."),Je.bindScopes.indexOf(u.bindScope)<0&&r("Invalid options.bindScope ("+u.bindMod+") for FuncPtrAdapter. Expecting one of: ("+Je.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=u.callProxy instanceof Function?u.callProxy:void 0}contextKey(u,p){return this}contextMap(u){const p=this.__cmap||(this.__cmap=new Map);let S=p.get(u);return S===void 0&&p.set(u,S=[]),S}convertArg(u,p,S){let M=this.singleton;if(!M&&this.isContext&&(M=this.contextMap(this.contextKey(p,S))),M&&M.length===2&&M[0]===u)return M[1];if(u instanceof Function){this.callProxy&&(u=this.callProxy(u));const V=H(u,this.signature,this.isTransient);if(Je.debugFuncInstall&&Je.debugOut("FuncPtrAdapter installed",this,this.contextKey(p,S),"@"+V,u),M){if(M[1]){Je.debugFuncInstall&&Je.debugOut("FuncPtrAdapter uninstalling",this,this.contextKey(p,S),"@"+M[1],u);try{w.scopedAlloc.pushPtr(M[1])}catch{}}M[0]=arguments[0]||I,M[1]=V}return V}else if(t.isPtr(u)||u===null||u===void 0){if(M&&M[1]&&M[1]!==u){Je.debugFuncInstall&&Je.debugOut("FuncPtrAdapter uninstalling",this,this.contextKey(p,S),"@"+M[1],u);try{w.scopedAlloc.pushPtr(M[1])}catch{}M[0]=M[1]=u||I}return u||I}else throw new TypeError("Invalid FuncPtrAdapter argument type. Expecting a function pointer or a "+(this.name?this.name+" ":"")+"function matching signature "+this.signature+".")}},F.FuncPtrAdapter.warnOnUse=!1,F.FuncPtrAdapter.debugFuncInstall=!1,F.FuncPtrAdapter.debugOut=(()=>{}).bind(console),F.FuncPtrAdapter.bindScopes=["transient","context","singleton","permanent"];const Z=o=>F.get(o)||r("Argument adapter not found:",o),ne=o=>W.get(o)||r("Result adapter not found:",o);w.xWrap.convertArg=(o,...u)=>Z(o)(...u),w.xWrap.convertArgNoCheck=(o,...u)=>F.get(o)(...u),w.xWrap.convertResult=(o,u)=>o===null?u:o?ne(o)(u):void 0,w.xWrap.convertResultNoCheck=(o,u)=>o===null?u:o?W.get(o)(u):void 0,t.xWrap=function o(u,p,...S){arguments.length===3&&Array.isArray(arguments[2])&&(S=arguments[2]),t.isPtr(u)&&(u=t.functionEntry(u)||r("Function pointer not found in WASM function table."));const M=u instanceof Function,V=M?u:t.xGet(u);if(M&&(u=V.name||"unnamed function"),S.length!==V.length&&y(u,V.length),V.length===0&&(p===null||p==="null"))return V;ne(p);for(const m of S)m instanceof ee?F.set(m,(...C)=>m.convertArg(...C)):Z(m);const R=w.xWrap;return V.length===0?(...m)=>m.length?y(u,V.length):R.convertResult(p,V.call(null)):function(...m){m.length!==V.length&&y(u,V.length);const C=t.scopedAllocPush();try{let B=0;for(o.debug;B<m.length;++B)m[B]=R.convertArgNoCheck(S[B],m[B],m,B);return o.debug,R.convertResultNoCheck(p,V.apply(null,m))}finally{t.scopedAllocPop(C)}}};const E=function(o,u,p,S,M,V){if(typeof p=="string"){if(u===1)return V.get(p);if(u===2){if(S)S instanceof Function||r(M,"requires a function argument.");else return V.delete(p),o;return V.set(p,S),o}}r("Invalid arguments to",M)};return t.xWrap.resultAdapter=function o(u,p){return E(o,arguments.length,u,p,"resultAdapter()",W)},t.xWrap.argAdapter=function o(u,p){return E(o,arguments.length,u,p,"argAdapter()",F)},t.xWrap.FuncPtrAdapter=F.FuncPtrAdapter,t.xCallWrapped=function(o,u,p,...S){return Array.isArray(arguments[3])&&(S=arguments[3]),t.xWrap(o,u,p||[]).apply(null,S||[])}
2,t.xWrap.testConvertArg=w.xWrap.convertArg,t.xWrap.testConvertResult=w.xWrap.convertResult,t},globalThis.WhWasmUtilInstaller.yawl=(function(t){const r=()=>fetch(t.uri,{credentials:"same-origin"}),s=this,_=function(c){if(t.wasmUtilTarget){const b=(...I)=>{throw new Error(I.join(" "))},z=t.wasmUtilTarget;if(z.module=c.module,z.instance=c.instance,z.instance.exports.memory||(z.memory=t?.imports?.env?.memory||b("Missing 'memory' object!")),!z.alloc&&c.instance.exports.malloc){const I=c.instance.exports;z.alloc=function(q){return I.malloc(q)||b("Allocation of",q,"bytes failed.")},z.dealloc=function(q){q&&I.free(q)}}s(z)}return c.config=t,t.onload&&t.onload(c),c};return WebAssembly.instantiateStreaming?()=>WebAssembly.instantiateStreaming(r(),t.imports||{}).then(_):()=>r().then(c=>c.arrayBuffer()).then(c=>WebAssembly.instantiate(c,t.imports||{})).then(_)}).bind(globalThis.WhWasmUtilInstaller),globalThis.Jaccwabyt=function i(t){const r=(...T)=>{throw new Error(T.join(" "))};{let T=t.heap;T instanceof WebAssembly.Memory?T=(function(){return new Uint8Array(this.buffer)}).bind(T):T instanceof Function||r("config.heap must be WebAssembly.Memory instance or","a function which returns one."),t.heap=T}["alloc","dealloc"].forEach(function(T){t[T]instanceof Function||r("Config option '"+T+"' must be a function.")});const s=i,_=t.heap,c=t.alloc,b=t.dealloc;t.realloc;const z=t.log||(()=>{}).bind(console),I=t.memberPrefix||"",q=t.memberSuffix||"",w=globalThis.BigInt,x=globalThis.BigInt64Array,L=t.bigIntEnabled??!!x;let H;const g=t.pointerSize||t.ptrSize||(typeof(H=c(1))=="bigint"?8:4),h=t.pointerIR||t.ptrIR||(g===4?"i32":"i64");H&&(b(H),H=void 0),g!==4&&g!==8&&r("Invalid pointer size:",g),h!=="i32"&&h!=="i64"&&r("Invalid pointer representation:",h);const D=L&&w?T=>w(T||0):T=>r("BigInt support is disabled in this build."),U=h=="i32"?Number:D,A=U(0),N=function(...T){let Q=A;for(let J=0;J<T.length;++J)Q+=U(T[J]);return Q},K=function(...T){return N(this.pointer,...T)};s.debugFlags||(s.__makeDebugFlags=function(T=null){T&&T.__flags&&(T=T.__flags);const Q=function J(re){return arguments.length===0?J.__flags:(re<0?(delete J.__flags.getter,delete J.__flags.setter,delete J.__flags.alloc,delete J.__flags.dealloc):(J.__flags.getter=(1&re)!==0,J.__flags.setter=(2&re)!==0,J.__flags.alloc=(4&re)!==0,J.__flags.dealloc=(8&re)!==0),J._flags)};return Object.defineProperty(Q,"__flags",{iterable:!1,writable:!1,value:Object.create(T)}),T||Q(0),Q},s.debugFlags=s.__makeDebugFlags());const d=!0,y=T=>T[1]==="(",F=T=>T==="p"||T==="P"||T==="s",W=T=>T==="P",P=T=>T?y(T)?"p":T[0]:void 0,X=function(T){switch(P(T)){case"c":case"C":return"i8";case"i":return"i32";case"p":case"P":case"s":return h;case"j":return"i64";case"f":return"float";case"d":return"double"}r("Unhandled signature IR:",T)},ee=function(T){switch(P(T)){case"c":case"C":return 1;case"i":return 4;case"p":case"P":case"s":return g;case"j":return 8;case"f":return 4;case"d":return 8}r("Unhandled signature sizeof:",T)},Z=x?()=>!0:()=>r("BigInt64Array is not available."),ne=function(T){switch(P(T)){case"p":case"P":case"s":switch(g){case 4:return"getInt32";case 8:return Z()&&"getBigInt64"}break;case"i":return"getInt32";case"c":return"getInt8";case"C":return"getUint8";case"j":return Z()&&"getBigInt64";case"f":return"getFloat32";case"d":return"getFloat64"}r("Unhandled DataView getter for signature:",T)},E=function(T){switch(P(T)){case"p":case"P":case"s":switch(g){case 4:return"setInt32";case 8:return Z()&&"setBigInt64"}break;case"i":return"setInt32";case"c":return"setInt8";case"C":return"setUint8";case"j":return Z()&&"setBigInt64";case"f":return"setFloat32";case"d":return"setFloat64"}r("Unhandled DataView setter for signature:",T)},o=function(T){switch(P(T)){case"i":case"f":case"c":case"C":case"d":return Number;case"j":return D;case"p":case"P":case"s":switch(g){case 4:return Number;case 8:return D}break}r("Unhandled DataView set wrapper for signature:",T)},u=(T,Q)=>T+"::"+Q,p=function(T,Q){return()=>r(u(T,Q),"is read-only.")},S=function T(Q,J=!0){let re=T.map.get(Q);return!re&&J&&T.map.set(Q,re=T.create(Q)),re};S.map=new WeakMap,S.create=T=>Object.assign(Object.create(null),{o:T,p:void 0,ownsPointer:!1,zod:!1,xb:0});const M=T=>S.map.delete(T),V=T=>typeof T=="number"&&T===(T|0)&&T>=0,m=g===4?V:T=>typeof T=="bigint"&&T>=0||V(T),C=T=>m(T)&&T>0,B=function(T,Q,J){const re=S(Q,!1);if(re&&(M(Q),!(!J&&!(J=re.p)))){if(Array.isArray(Q.ondispose)){let ce;for(;ce=Q.ondispose.pop();)try{ce instanceof Function?ce.call(Q):ce instanceof Re?ce.dispose():m(ce)&&b(ce)}catch{}}else if(Q.ondispose instanceof Function)try{Q.ondispose()}catch{}delete Q.ondispose,T.debugFlags.__flags.dealloc&&z("debug.dealloc:",re.ownsPointer?"":"EXTERNAL",T.structName,"instance:",T.structInfo.sizeof,"bytes @"+J),re.ownsPointer&&((re.zod||T.structInfo.zeroOnDispose)&&_().fill(0,Number(J),Number(J)+T.structInfo.sizeof+re.xb),b(J))}},Y=()=>({configurable:!1,writable:!1,iterable:!1}),te=T=>({...Y(),value:T}),le=function(Q,J,re){let ce;const Ee=qe=>{C(qe)||r("Invalid pointer value",arguments[0],"for",Q.structName,"constructor.")};arguments.length>=3?re&&typeof re=="object"?(ce=re,re=ce?.wrap):(Ee(re),ce={wrap:re}):ce={};const xe=!re;let Ne=0,De=!1;if(re)Ee(re),De=!!ce?.takeOwnership;else{const qe=ce?.extraBytes??0;(qe<0||qe!==(qe|0))&&r("Invalid extraBytes value:",ce?.extraBytes),Ne=Q.structInfo.sizeof+qe,re=c(Ne)||r("Allocation of",Q.structName,"structure failed."),De=!0}try{ce?.debugFlags&&J.debugFlags(ce.debugFlags),Q.debugFlags.__flags.alloc&&z("debug.alloc:",xe?"":"EXTERNAL",Q.structName,"instance:",Q.structInfo.sizeof,"bytes @"+re),xe&&_().fill(0,Number(re),Number(re)+Ne);const qe=S(J);qe.p=re,qe.ownsPointer=De,qe.xb=Ne?Ne-Q.structInfo.sizeof:0,qe.zod=!!ce?.zeroOnDispose,ce?.ondispose&&ce.ondispose!==re&&J.addOnDispose(ce.ondispose)}catch(qe){throw B(Q,J,re),qe}},ae=function T(Q){return T.rxSig1??=/^[ipPsjfdcC]$/,T.rxSig2??=/^[vipPsjfdcC]\([ipPsjfdcC]*\)$/,T.rxSig1.test(Q)||T.rxSig2.test(Q)},ye=(function(T){let Q=this.get(T);return Q||(Q=[Object.create(null),Object.create(null),Object.create(null)],this.set(T,Q)),Q}).bind(new WeakMap),ke=function(T,Q,J,re){const ce=ye(T)[Q];return arguments.length===3?ce[J]:re?ce[J]=re:delete ce[J]},We=function(T,...Q){return ke(this,0,T,...Q)},nt=function(T,Q){ae(Q)&&r(T,"(",Q,") collides with a data type signature.")},O=function(T,...Q){return nt("Setter adaptor",T),ke(this,1,T,...Q)},j=function(T,...Q){return nt("Struct adaptor",T),ke(this,2,T,...Q)},G=function(T,Q){const J=typeof Q=="string"?ke(T,2,Q):Q;return typeof J!="object"&&r("Invalid struct mapping object. Arg =",Q,JSON.stringify(J)),J},ie=te(T=>I+T+q),oe=function(T,Q,J=!0){let re=T.members[Q];if(!re&&(I||q)){for(const ce of Object.values(T.members))if(ce.ke
2y===Q){re=ce;break}!re&&J&&r(u(T.name||T.structName,Q),"is not a mapped struct member.")}return re},ue=function T(Q,J,re=!1){T._||(T._=Ee=>Ee.replace(/[^vipPsjrdcC]/g,"").replace(/[pPscC]/g,"i"));const ce=oe(Q.structInfo,J,!0);return re?T._(ce.signature):ce.signature},se=te(function(){const T=[];for(const Q of Object.keys(this.structInfo.members))T.push(this.memberKey(Q));return T}),pe=new TextDecoder("utf-8"),be=new TextEncoder,we=typeof SharedArrayBuffer>"u"?function(){}:SharedArrayBuffer,me=function(T,Q,J){return g===8&&(Q=Number(Q),J=Number(J)),pe.decode(T.buffer instanceof we?T.slice(Q,J):T.subarray(Q,J))},Le=function(T,Q,J=!1){const re=oe(T.structInfo,Q,J);return re&&re.signature.length===1&&re.signature[0]==="s"?re:!1},Ue=function(T){T.signature!=="s"&&r("Invalid member type signature for C-string value:",JSON.stringify(T))},at=function(Q,J){const re=oe(Q.structInfo,J,!0);Ue(re);const ce=Q[re.key];if(!ce)return null;let Ee=ce;const xe=_();for(;xe[Ee]!==0;++Ee);return ce===Ee?"":me(xe,ce,Ee)},Ve=function(T,...Q){T.ondispose?Array.isArray(T.ondispose)||(T.ondispose=[T.ondispose]):T.ondispose=[],T.ondispose.push(...Q)},rt=function(T){const Q=be.encode(T),J=c(Q.length+1);J||r("Allocation error while duplicating string:",T);const re=_();return re.set(Q,Number(J)),re[N(J,Q.length)]=0,J},ht=function(T,Q,J){const re=oe(T.structInfo,Q,!0);Ue(re);const ce=rt(J);return T[re.key]=ce,Ve(T,ce),T},Re=function(Q,J){arguments[2]!==te&&r("Do not call the StructType constructor","from client-level code."),Object.defineProperties(this,{structName:te(Q),structInfo:te(J)})};Re.prototype=Object.create(null,{dispose:te(function(){B(this.constructor,this)}),lookupMember:te(function(T,Q=!0){return oe(this.structInfo,T,Q)}),memberToJsString:te(function(T){return at(this,T)}),memberIsString:te(function(T,Q=!0){return Le(this,T,Q)}),memberKey:ie,memberKeys:se,memberSignature:te(function(T,Q=!1){return ue(this,T,Q)}),memoryDump:te(function(){const T=this.pointer;return T?new Uint8Array(_().slice(Number(T),Number(T)+this.structInfo.sizeof)):null}),extraBytes:{configurable:!1,enumerable:!1,get:function(){return S(this,!1)?.xb??0}},zeroOnDispose:{configurable:!1,enumerable:!1,get:function(){return S(this,!1)?.zod??!!this.structInfo.zeroOnDispose}},pointer:{configurable:!1,enumerable:!1,get:function(){return S(this,!1)?.p},set:()=>r("Cannot assign the 'pointer' property of a struct.")},setMemberCString:te(function(T,Q){return ht(this,T,Q)})}),Object.assign(Re.prototype,{addOnDispose:function(...T){return Ve(this,...T),this}}),Object.defineProperties(Re,{allocCString:te(rt),isA:te(T=>T instanceof Re),hasExternalPointer:te(T=>{const Q=S(T,!1);return!!(Q?.p&&!Q?.ownsPointer)}),memberKey:ie});const vt=function(T){return T.get||(T.adaptGet?Me.adaptGet(T.adaptGet):void 0)},Jt=function(T){return T.set||(T.adaptSet?Me.adaptSet(T.adaptSet):void 0)},hr=function T(Q,J,re){const ce=T.innerStructs??=new Map,Ee=Q.memberKey(J);re.signature!==void 0&&r("'signature' cannot be used on an embedded struct (",Q.structName,".",Ee,")."),Jt(re)&&r("'set' and 'adaptSet' are not permitted for nested struct members."),re.structName??=Q.structName+"::"+J,re.key=Ee,re.name=J,re.constructor=this.call(this,re.structName,re);const xe=vt(re),Ne=Object.assign(Object.create(null),{configurable:!1,enumerable:!1,set:p(Q.structName,Ee),get:function(){const De=this.debugFlags.__flags,qe=this.pointer,Pe=qe+"."+Ee;let _e=ce.get(Pe);return De.getter&&z("debug.getter: k =",Pe),_e||(_e=new re.constructor(N(qe,re.offset)),ce.set(Pe,_e),this.addOnDispose(()=>_e.dispose()),_e.addOnDispose(()=>ce.delete(Pe))),xe&&(_e=xe.apply(this,[_e,Ee])),De.getter&&z("debug.getter: result =",_e),_e}});Object.defineProperty(Q.prototype,Ee,Ne)},mr=function T(Q,J,re){if(re=G(this,re),re.members)return hr.call(this,Q,J,re);if(!T.cache){T.cache={getters:{},setters:{},sw:{}};const Pe=["i","c","C","p","P","s","f","d","v()"];L&&Pe.push("j"),Pe.forEach(function(_e){T.cache.getters[_e]=ne(_e),T.cache.setters[_e]=E(_e),T.cache.sw[_e]=o(_e)}),T.sigCheck=function(_e,Te,St,Yt){Object.prototype.hasOwnProperty.call(_e,St)&&r(_e.structName,"already has a property named",St+"."),ae(Yt)||r("Malformed signature for",u(_e.structName,Te)+":",Yt)}}const ce=Q.memberKey(J);T.sigCheck(Q.prototype,J,ce,re.signature),re.key=ce,re.name=J;const Ee=P(re.signature),xe=u(Q.structName,ce),Ne=Q.debugFlags.__flags,De=vt(re),qe=Object.create(null);if(qe.configurable=!1,qe.enumerable=!1,qe.get=function(){Ne.getter&&z("debug.getter:",T.cache.getters[Ee],"for",X(Ee),xe,"@",this.pointer,"+",re.offset,"sz",re.sizeof);let Pe=new DataView(_().buffer,Number(this.pointer)+re.offset,re.sizeof)[T.cache.getters[Ee]](0,d);return De&&(Pe=De.apply(this,[ce,Pe])),Ne.getter&&z("debug.getter:",xe,"result =",Pe),Pe},re.readOnly)qe.set=p(Q.prototype.structName,ce);else{const Pe=Jt(re);qe.set=function(_e){Ne.setter&&z("debug.setter:",T.cache.setters[Ee],"for",X(Ee),xe,"@",this.pointer,"+",re.offset,"sz",re.sizeof,_e),this.pointer||r("Cannot set native property on a disposed",this.structName,"instance."),Pe&&(_e=Pe.apply(this,[ce,_e])),_e==null?_e=A:F(re.signature)&&!m(_e)&&(W(re.signature)&&_e instanceof Re?(_e=_e.pointer||A,Ne.setter&&z("debug.setter:",xe,"resolved to",_e)):r("Invalid value for pointer-type",xe+".")),new DataView(_().buffer,Number(this.pointer)+re.offset,re.sizeof)[T.cache.setters[Ee]](0,T.cache.sw[Ee](_e),d)}}Object.defineProperty(Q.prototype,ce,qe)},Xt=function T(Q,J,re=Object.create(null)){const ce=function _e(Te){this instanceof _e||r("The",Q,"constructor may only be called via 'new'."),le(_e,this,...arguments)},Ee=this,xe=_e=>typeof _e=="string"&&ae(_e)?{signature:_e}:G(Ee,_e);arguments.length===1?(J=xe(Q),Q=J.structName||J.name):arguments.length===2?(J=xe(J),J.name??=Q):J=xe(J),Q??=J.structName,Q??=re.structName,Q||r("One of 'name' or 'structName' are required."),J.adapt&&(Object.keys(J.adapt.struct||{}
2).forEach(_e=>{j.call(T,_e,J.adapt.struct[_e])}),Object.keys(J.adapt.set||{}).forEach(_e=>{O.call(T,_e,J.adapt.set[_e])}),Object.keys(J.adapt.get||{}).forEach(_e=>{We.call(T,_e,J.adapt.get[_e])})),!J.members&&!J.sizeof&&(J.sizeof=ee(J.signature));const Ne=te(s.__makeDebugFlags(Me.debugFlags));Object.defineProperties(ce,{debugFlags:Ne,isA:te(_e=>_e instanceof ce),memberKey:ie,memberKeys:se,structInfo:te(J),structName:te(Q),ptrAdd:te(N)}),ce.prototype=new Re(Q,J,te),Object.defineProperties(ce.prototype,{debugFlags:Ne,constructor:te(ce),ptrAdd:te(K)});let De=!1,qe=0;const Pe=!!J.autoCalcSizeOffset;return Pe||J.sizeof||r(Q,"description is missing its sizeof property."),J.offset??=0,Object.keys(J.members||{}).forEach(_e=>{let Te=xe(J.members[_e]);!Te.members&&!Te.sizeof&&(Te.sizeof=ee(Te.signature),Te.sizeof||r(u(Q,_e),"is missing a sizeof property.",Te)),Te.offset===void 0&&(Pe?Te.offset=qe:r(u(Q,_e),"is missing its offset.",JSON.stringify(Te))),J.members[_e]=Te,(!De||De.offset<Te.offset)&&(De=Te);const St=!!Te.autoCalc;Pe&&(Te.autoCalcSizeOffset=!0),mr.call(Ee,ce,_e,Te),St?Te.autoCalcSizeOffset=!0:delete Te.autoCalcSizeOffset,qe+=Te.sizeof}),De||r("No member property descriptions found."),J.sizeof||(J.sizeof=qe),J.sizeof===1?J.signature==="c"||J.signature==="C"||r("Unexpected sizeof==1 member",u(Q,k),"with signature",J.signature):(J.sizeof%4!==0&&r(Q,"sizeof is not aligned. sizeof="+J.sizeof),J.offset%4!==0&&r(Q,"offset is not aligned. offset="+J.offset)),J.sizeof<qe&&r("Mismatch in the calculated vs. the provided sizeof/offset info.","Expected sizeof",qe,"but got",J.sizeof,"for",J),delete J.autoCalcSizeOffset,ce},Me=function T(Q,J){return arguments.length==1?Xt.call(T,Q):Xt.call(T,Q,J)};return Me.StructType=Re,Me.config=t,Me.allocCString=rt,Me.adaptGet=We,Me.adaptSet=O,Me.adaptStruct=j,Me.ptrAdd=N,Me.debugFlags||(Me.debugFlags=s.__makeDebugFlags(s.debugFlags)),Me},globalThis.sqlite3ApiBootstrap.initializers.push(function(i){const t=(...g)=>{throw new Error(g.join(" "))},r=i.capi,s=i.wasm,_=i.util;globalThis.WhWasmUtilInstaller(s),delete globalThis.WhWasmUtilInstaller;const c={core:[["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_bind_zeroblob","int","sqlite3_stmt*","int","int"],["sqlite3_busy_handler","int",["sqlite3*",new s.xWrap.FuncPtrAdapter({signature:"i(pi)",contextKey:(g,h)=>g[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_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:g=>g[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:g=>{let h;return(D,U,A,N)=>{try{const K=s.cArgvToJs(U,A);return h||(h=s.cArgvToJs(U,N)),g(K,h)|0}catch(K){return K.resultCode||r.SQLITE_ERROR}}}}),"*","**"]],["sqlite3_expanded_sql","string","sqlite3_stmt*"],["sqlite3_extended_errcode","int","sqlite3*"],["sqlite3_extended_result_co
2des","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_next_stmt","sqlite3_stmt*",["sqlite3*","sqlite3_stmt*"]],["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:g=>g[0]}),"*"]],["sqlite3_set_auxdata",void 0,["sqlite3_context*","int","*","*"]],["sqlite3_set_errmsg","int","sqlite3*","int","string"],["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:(g,h)=>g[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_type","int","sqlite3_value*"],["sqlite3_vfs_find","*","string"],["sqlite3_vfs_register","int","sqlite3_vfs*","int"],["sqlite3_vfs_unregister","int","sqlite3_vfs*"]],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","
2int","int","*","*","int"],["sqlite3_db_status64","int","sqlite3*","int","*","*","int"],["sqlite3_total_changes64","i64",["sqlite3*"]],["sqlite3_update_hook","*",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"sqlite3_update_hook::callback",signature:"v(pippj)",contextKey:g=>g[0],callProxy:g=>(h,D,U,A,N)=>{g(h,D,s.cstrToJs(U),s.cstrToJs(A),N)}}),"*"]],["sqlite3_uri_int64","i64",["sqlite3_filename","string","i64"]],["sqlite3_value_int64","i64","sqlite3_value*"]],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"]]};if(s.exports.sqlite3_progress_handler&&c.core.push(["sqlite3_progress_handler",void 0,["sqlite3*","int",new s.xWrap.FuncPtrAdapter({name:"xProgressHandler",signature:"i(p)",bindScope:"context",contextKey:(g,h)=>g[0]}),"*"]]),s.exports.sqlite3_stmt_explain&&c.core.push(["sqlite3_stmt_explain","int","sqlite3_stmt*","int"],["sqlite3_stmt_isexplain","int","sqlite3_stmt*"]),s.exports.sqlite3_set_authorizer&&c.core.push(["sqlite3_set_authorizer","int",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"sqlite3_set_authorizer::xAuth",signature:"i(pissss)",contextKey:(g,h)=>g[0],callProxy:g=>(h,D,U,A,N,K)=>{try{return U=U&&s.cstrToJs(U),A=A&&s.cstrToJs(A),N=N&&s.cstrToJs(N),K=K&&s.cstrToJs(K),g(h,D,U,A,N,K)|0}catch(d){return d.resultCode||r.SQLITE_ERROR}}}),"*"]]),s.exports.sqlite3_column_origin_name&&c.core.push(["sqlite3_column_database_name","string","sqlite3_stmt*","int"],["sqlite3_column_origin_name","string","sqlite3_stmt*","int"],["sqlite3_column_table_name","string","sqlite3_stmt*","int"]),s.bigIntEnabled&&s.exports.sqlite3_declare_vtab&&c.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&&c.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:g=>g[0],callProxy:g=>(h,D,U,A,N,K,d)=>{g(h,D,U,s.cstrToJs(A),s.cstrToJs(N),K,d)}}),"*"]],["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 g={signature:"i(ps)",callProxy:h=>(D,U)=>{try{return h(D,s.cstrToJs(U))|0}catch(A){return A.resultCode||r.SQLITE_ERROR}}};c.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",...g}
2),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",...g}),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",...g}),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",...g}),new s.xWrap.FuncPtrAdapter({name:"xConflict",signature:"i(pip)",bindScope:"transient"}),"void*","**","int*","int"]],["sqlite3changeset_apply_v3","int",["sqlite3*","int","void*",new s.xWrap.FuncPtrAdapter({name:"xFilter",signature:"i(pp)",bindScope:"transient"}),new s.xWrap.FuncPtrAdapter({name:"xConflict",signature:"i(pip)",bindScope:"transient"}),"void*","**","int*","int"]],["sqlite3changeset_apply_v3_strm","int",["sqlite3*",new s.xWrap.FuncPtrAdapter({name:"xInput",signature:"i(ppp)",bindScope:"transient"}),"void*",new s.xWrap.FuncPtrAdapter({name:"xFilter",signature:"i(pp)",bindScope:"transient"}),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",...g,contextKey:(h,D)=>h[0]}),"*"]])}i.StructBinder=globalThis.Jaccwabyt({heap:s.heap8u,alloc:s.alloc,dealloc:s.dealloc,bigIntEnabled:s.bigIntEnabled,pointerIR:s.ptr.ir,memberPrefix:"$"}),delete globalThis.Jaccwabyt;{const g=s.xWrap.argAdapter("string");s.xWrap.argAdapter("string:flexible",A=>g(_.flexibleString(A))),s.xWrap.argAdapter("string:static",(function(A){return s.isPtr(A)?A:(A=""+A,this[A]||(this[A]=s.allocCString(A)))}).bind(Object.create(null)));const h=s.xWrap.argAdapter("*"),D=function(){};s.xWrap.argAdapter("sqlite3_filename",h)("sqlite3_context*",h)("sqlite3_value*",h)("void*",h)("sqlite3_changegroup*",h)("sqlite3_changeset_iter*",h)("sqlite3_session*",h)("sqlite3_stmt*",A=>h(A instanceof(i?.oo1?.Stmt||D)?A.pointer:A))("sqlite3*",A=>h(A instanceof(i?.oo1?.DB||D)?A.pointer:A))("sqlite3_vfs*",A=>typeof A=="string"?r.sqlite3_vfs_find(A)||i.SQLite3Error.toss(r.SQLITE_NOTFOUND,"Unknown sqlite3_vfs name:",A):h(A instanceof(r.sqlite3_vfs||D)?A.pointer:A)),s.exports.sqlite3_declare_vtab&&s.xWrap.argAdapter("sqlite3_index_info*",A=>h(A instanceof(r.sqlite3_index_info||D)?A.pointer:A))("sqlite3_module*",A=>h(A instanceof(r.sqlite3_module||D)?A.pointer:A));const U=s.xWrap.resultAdapter("*");s.xWrap.resultAdapter("sqlite3*",U)("sqlite3_context*",U)("sqlite3_stmt*",U)("sqlite3_value*",U)("sqlite3_vfs*",U)("void*",U);for(const A of c.core)r[A[0]]=s.xWrap.apply(null,A);for(const A of c.wasmInternal)_[A[0]]=s.xWrap.apply(null,A);for(const A of c.int64)r[A[0]]=s.bigIntEnabled?s.xWrap.apply(null,A):()=>t(A[0]+"() is unavailable due to lack","of BigInt support in this build.");delete c.core,delete c.int64,delete c.wasmInternal,_.sqlite3__wasm_db_error=function(A,N,K){return A?(N instanceof i.WasmAllocError?(N=r.SQLITE_NOMEM,K=0):N instanceof Error&&(K=K||""+N,N=N.resultCode||r.SQLITE_ERROR),r.sqlite3_set_errmsg(A,N,K)||N):r.SQLITE_MISUSE}}{const g=s.xCall("sqlite3__wasm_enum_json");g||t("Maintenance required: increase sqlite3__wasm_enum_json()'s","static buffer size!"),s.ctype=JSON.parse(s.cstrToJs(g));const h=["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&&h.push("serialize","session","vtab");for(const A of h)for(const N of Object.entries(s.ctype[A]))r[N[0]]=N[1];s.functionEntry(r.SQLITE_WASM_DEALLOC)||t("Internal error: cannot resolve exported function","entry SQLITE_WASM_DEALLOC (=="+r.SQLITE_WASM_DEALLOC+").");const D=Object.create(null);for(const A of Object.entries(s.ctype.resultCodes))D[A[1]]=A[0];r.sqlite3_js_rc_str=A=>D[A];const U=Object.assign(Object.create(null),{WasmTestStruct:!0,sqlite3_index_info:!s.bigIntEnabled,sqlite3_index_constraint:!s.bigIntEnabled,sqlite3_index_orderby:!s.bigIntEnabled,sqlite3_index_constraint_usage:!s.bigIntEnabled});for(const A of s.ctype.structs)U[A.name]||(r[A.name]=i.StructBinder(A));if(r.sqlite3_index_info){for(const A of["sqlite3_index_constraint","sqlite3_index_orderby","sqlite3_index_constraint_usage"])r.sqlite3_index_info[A]=r[A],delete r[A];r.sqlite3_vtab_config=s.xWrap("sqlite3__wasm_vtab_config","int",["sqlite3*","int","int"])}}const b=(g,h,D)=>_.sqlite3__wasm_db_error(g,r.SQLITE_MISUSE,h+"() requires "+D+" argument"+(D===1?"":"s")+"."),z=g=>_.sqlite3__wasm_db_error(g,r.SQLITE_FORMAT,"SQLITE_UTF8 is the only supported encoding."),I=g=>s.xWrap.argAdapter("sqlite3*")(g),q=g=>s.isPtr(g)?s.cstrToJs(g):g,w=(function(g,h){g=I(g);let D=this.dbMap.get(g);if(h)!D&&h>0&&this.dbMap.set(g,D=Object.create(null));else return this.dbMap.delete(g),D;return D}).bind(Object.assign(Object.create(null),{dbMap:new Map}));w.addCollation=function(g,h){const D=w(g,1);D.collation||(D.collation=new Set),D.collation.add(q(h).toLowerCase())},w._addUDF=function(g,h,D,U){h=q(h).toLowerCase();let A=U.get(h);A||U.set(h,A=new Set),A.add(D<0?-1:D)},w.addFunction=function(g,h,D){const U=w(g,1);U.udf||(U.udf=new Map),this._addUDF(g,h,D,U.udf)},s.exports.sqlite3_create_window_function&&(w.addWindowFunc=function(g,h,D){const U=w(g,1);U.wudf||(U.wudf=new Map),this._addUDF(g,h,D,U.wudf)}),w.cleanup=function(g){g=I(g);for(const U of[["sqlite3_busy_handler",3],["sqlite3_commit_hook",3],["sqlite3_preupdate_hook",3],["sqlite3_progress_handler",4],["sqlite3_rollback_hook",3],["sqlite3_set_authorizer",3],["sqlite3_trace_v2",4],["sqlite3_update_hook",3]]){const[A,N]=U;if(!s.exports[A])continue;const K=[g];K.length=N;try{r[A](...K)}catch(d){i.config.warn("close-time call of",A+"(",K,") threw:",d)}}const h=w(g,0);if(!h)return;if(h.collation){for(const U of h.collation)try{r.sqlite3_create_collation_v2(g,U,r.SQLITE_UTF8,0,0,0)}catch{}delete h.collation}let D;for(D=0;D<2;++D){const U=D?h.wudf:h.udf;if(!U)continue;const A=D?r.sqlite3_create_window_function:r.sqlite3_create_function_v2;for(const N of U){const K=N[0],d=N[1],y=[g,K,0,r.SQLITE_UTF8,0,0,0,0,0];D&&y.push(0);for(const F of d)try{y[2]=F,A.apply(null,y)}catch{}d.clear()}U.clear()}delete h.udf,delete h.wudf};{const g=s.xWrap("sqlite3_close_v2","int","sqlite3*");r.sqlite3_close_v2=function(h){if(arguments.length!==1)return b(h,"sqlite3_close_v2",1);if(h)try{w.cleanup(h)}catch{}return g(h)}}if(r.sqlite3session_create){const g=s.xWrap("sqlite3session_delete",void 0,["sqlite3_session*"]);r.sqlite3session_delete=function(h){if(arguments.length!==1)return b(pDb,"sqlite3session_delete",1);h&&r.sqlite3session_table_filter(h,0,0),g(h)}}{const g=(D,U)=>"argv["+U+"]:"+D[0]+":"+s.cstrToJs(D[1]).toLowerCase(),h=s.xWrap("sqlite3_create_collation_v2","int",["sqlite3*","string","int","*",new s.xWrap.FuncPtrAdapter({name:"xCompare",signature:"i(pipip)",contextKey:g}),new s.xWrap.FuncPtrAdapter({name:"xDestroy",signature:"v(p)",contextKey:g})]);r.sqlite3_create_collation_v2=function(D,U,A,N,K,d){if(arguments.length!==6)return b(D,"sqlite3_create_collation_v2",6);if((A&15)===0)A|=r.SQLITE_UTF8;else if(r.SQLITE_UTF8!==(A&15))return z(D);try{const y=h(D,U,A,N,K,d);return y===0&&K instanceof Function&&w.addCollation(D,U),y}catch(y){return _.sqlite3__wasm_db_error(D,y)}},r.sqlite3_create_collation=(D,U,A,N,K)=>arguments.length===5?r.sqlite3_create_collation_v2(D,U,A,N,K,0):b(D,"sqlite3_create_collation",5)}{const g=function(A,N){return A[0]+":"+(A[2]<0?-1:A[2])+":"+N+":"+s.cstrToJs(A[1]).toLowerCase()},h=Object.assign(Object.create(null),{xInverseAndStep:{signature:"v(pip)",contextKey:g,callProxy:A=>(N,K,d)=>
2{try{A(N,...r.sqlite3_values_to_js(K,d))}catch(y){r.sqlite3_result_error_js(N,y)}}},xFinalAndValue:{signature:"v(p)",contextKey:g,callProxy:A=>N=>{try{r.sqlite3_result_js(N,A(N))}catch(K){r.sqlite3_result_error_js(N,K)}}},xFunc:{signature:"v(pip)",contextKey:g,callProxy:A=>(N,K,d)=>{try{r.sqlite3_result_js(N,A(N,...r.sqlite3_values_to_js(K,d)))}catch(y){r.sqlite3_result_error_js(N,y)}}},xDestroy:{signature:"v(p)",contextKey:g,callProxy:A=>N=>{try{A(N)}catch{}}}}),D=s.xWrap("sqlite3_create_function_v2","int",["sqlite3*","string","int","int","*",new s.xWrap.FuncPtrAdapter({name:"xFunc",...h.xFunc}),new s.xWrap.FuncPtrAdapter({name:"xStep",...h.xInverseAndStep}),new s.xWrap.FuncPtrAdapter({name:"xFinal",...h.xFinalAndValue}),new s.xWrap.FuncPtrAdapter({name:"xDestroy",...h.xDestroy})]),U=s.exports.sqlite3_create_window_function?s.xWrap("sqlite3_create_window_function","int",["sqlite3*","string","int","int","*",new s.xWrap.FuncPtrAdapter({name:"xStep",...h.xInverseAndStep}),new s.xWrap.FuncPtrAdapter({name:"xFinal",...h.xFinalAndValue}),new s.xWrap.FuncPtrAdapter({name:"xValue",...h.xFinalAndValue}),new s.xWrap.FuncPtrAdapter({name:"xInverse",...h.xInverseAndStep}),new s.xWrap.FuncPtrAdapter({name:"xDestroy",...h.xDestroy})]):void 0;r.sqlite3_create_function_v2=function A(N,K,d,y,F,W,P,X,ee){if(A.length!==arguments.length)return b(N,"sqlite3_create_function_v2",A.length);if((y&15)===0)y|=r.SQLITE_UTF8;else if(r.SQLITE_UTF8!==(y&15))return z(N);try{const Z=D(N,K,d,y,F,W,P,X,ee);return Z===0&&(W instanceof Function||P instanceof Function||X instanceof Function||ee instanceof Function)&&w.addFunction(N,K,d),Z}catch(Z){return _.sqlite3__wasm_db_error(N,Z,"Creation of UDF threw: "+Z)}},r.sqlite3_create_function=function A(N,K,d,y,F,W,P,X){return A.length===arguments.length?r.sqlite3_create_function_v2(N,K,d,y,F,W,P,X,0):b(N,"sqlite3_create_function",A.length)},U?r.sqlite3_create_window_function=function A(N,K,d,y,F,W,P,X,ee,Z){if(A.length!==arguments.length)return b(N,"sqlite3_create_window_function",A.length);if((y&15)===0)y|=r.SQLITE_UTF8;else if(r.SQLITE_UTF8!==(y&15))return z(N);try{const ne=U(N,K,d,y,F,W,P,X,ee,Z);return ne===0&&(W instanceof Function||P instanceof Function||X instanceof Function||ee instanceof Function||Z instanceof Function)&&w.addWindowFunc(N,K,d),ne}catch(ne){return _.sqlite3__wasm_db_error(N,ne,"Creation of UDF threw: "+ne)}}: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 g=(D,U)=>
2(typeof D=="string"?U=-1:_.isSQLableTypedArray(D)?(U=D.byteLength,D=s.typedArrayToString(D instanceof ArrayBuffer?new Uint8Array(D):D)):Array.isArray(D)&&(D=D.join(""),U=-1),[D,U]),h={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 D(U,A,N,K,d,y){if(D.length!==arguments.length)return b(U,"sqlite3_prepare_v3",D.length);const[F,W]=g(A,Number(N));switch(typeof F){case"string":return h.basic(U,F,W,K,d,null);case typeof s.ptr.null:return h.full(U,s.ptr.coerce(F),W,K,d,y);default:return _.sqlite3__wasm_db_error(U,r.SQLITE_MISUSE,"Invalid SQL argument type for sqlite3_prepare_v2/v3(). typeof="+typeof F)}},r.sqlite3_prepare_v2=function D(U,A,N,K,d){return D.length===arguments.length?r.sqlite3_prepare_v3(U,A,N,0,K,d):b(U,"sqlite3_prepare_v2",D.length)}}{const g=s.xWrap("sqlite3_bind_text","int",["sqlite3_stmt*","int","string","int","*"]),h=s.xWrap("sqlite3_bind_blob","int",["sqlite3_stmt*","int","*","int","*"]);r.sqlite3_bind_text=function D(U,A,N,K,d){if(D.length!==arguments.length)return b(r.sqlite3_db_handle(U),"sqlite3_bind_text",D.length);if(s.isPtr(N)||N===null)return g(U,A,N,K,d);N instanceof ArrayBuffer?N=new Uint8Array(N):Array.isArray(pMem)&&(N=pMem.join(""));let y,F;try{if(_.isSQLableTypedArray(N))y=s.allocFromTypedArray(N),F=N.byteLength;else if(typeof N=="string")[y,F]=s.allocCString(N);else return _.sqlite3__wasm_db_error(r.sqlite3_db_handle(U),r.SQLITE_MISUSE,"Invalid 3rd argument type for sqlite3_bind_text().");return g(U,A,y,F,r.SQLITE_WASM_DEALLOC)}catch(W){return s.dealloc(y),_.sqlite3__wasm_db_error(r.sqlite3_db_handle(U),W)}},r.sqlite3_bind_blob=function D(U,A,N,K,d){if(D.length!==arguments.length)return b(r.sqlite3_db_handle(U),"sqlite3_bind_blob",D.length);if(s.isPtr(N)||N===null)return h(U,A,N,K,d);N instanceof ArrayBuffer?N=new Uint8Array(N):Array.isArray(N)&&(N=N.join(""));let y,F;try{if(_.isBindableTypedArray(N))y=s.allocFromTypedArray(N),F=K>=0?K:N.byteLength;else if(typeof N=="string")[y,F]=s.allocCString(N);else return _.sqlite3__wasm_db_error(r.sqlite3_db_handle(U),r.SQLITE_MISUSE,"Invalid 3rd argument type for sqlite3_bind_blob().");return h(U,A,y,F,r.SQLITE_WASM_DEALLOC)}catch(W){return s.dealloc(y),_.sqlite3__wasm_db_error(r.sqlite3_db_handle(U),W)}}}if(!r.sqlite3_column_text){const g=s.xWrap.argAdapter("sqlite3_stmt*"),h=s.xWrap.argAdapter("int"),D=s.xWrap.argAdapter("sqlite3_value*"),U=(A,N)=>s.typedArrayToString(s.heap8u(),Number(A),Number(A)+N);r.sqlite3_column_text=function(A,N){const K=g(A),d=h(N),y=s.exports.sqlite3_column_text(K,d);return y?U(y,s.exports.sqlite3_column_bytes(K,d)):null},r.sqlite3_value_text=function(A){const N=D(A),K=s.exports.sqlite3_value_text(N);return K?U(K,s.exports.sqlite3_value_bytes(N)):null}}r.sqlite3_config=function(g,...h){if(arguments.length<2)return r.SQLITE_MISUSE;switch(g){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(g,h[0]);case r.SQLITE_CONFIG_LOOKASIDE:return s.exports.sqlite3__wasm_config_ii(g,h[0],h[1]);case r.SQLITE_CONFIG_MEMDB_MAXSIZE:return s.exports.sqlite3__wasm_config_j(g,h[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 g=new Set;r.sqlite3_auto_extension=function(h){if(h instanceof Function)h=s.installFunction("i(ppp)",h);else if(arguments.length!==1||!s.isPtr(h))return r.SQLITE_MISUSE;const D=s.exports.sqlite3_auto_extension(h);return h!==arguments[0]&&(D===0?g.add(h):s.uninstallFunction(h)),D},r.sqlite3_cancel_auto_extension=function(h){return!h||arguments.length!==1||!s.isPtr(h)?0:s.exports.sqlite3_cancel_auto_extension(h)},r.sqlite3_reset_auto_extension=function(){s.exports.sqlite3_reset_auto_extension();for(const h of g)s.uninstallFunction(h);g.clear()}}s.xWrap.FuncPtrAdapter.warnOnUse=!0;const x=i.StructBinder,L=function g(h,D,U,A=g.installMethodArgcCheck){if(h instanceof x.StructType?!(U instanceof Function)&&!s.isPtr(U)&&t("Usage error: expecting a Function or WASM pointer to one."):t("Usage error: target object is-not-a StructType."),arguments.length===1)return(y,F)=>g(h,y,F,A);g.argcProxy||(g.argcProxy=function(y,F,W,P){return function(...X){return W.length!==arguments.length&&t("Argument mismatch for",y.structInfo.name+"::"+F+": Native signature is:",P),W.apply(this,X)}},g.removeFuncList=function(){this.ondispose.__removeFuncList&&(this.ondispose.__removeFuncList.forEach((y,F)=>{if(s.isPtr(y))try{s.uninstallFunction(y)}catch{}}),delete this.ondispose.__removeFuncList)});const N=h.memberSignature(D);N.length<2&&t("Member",D,"does not have a function pointer signature:",N);const K=h.memberKey(D),d=A&&!s.isPtr(U)?g.argcProxy(h,K,U,N):U;if(s.isPtr(d))d&&!s.functionEntry(d)&&t("Pointer",d,"is not a WASM function table entry."),h[K]=d;else{const y=s.installFunction(d,N);h[K]=y,(!h.ondispose||!h.ondispose.__removeFuncList)&&(h.addOnDispose("ondispose.__removeFuncList handler",g.removeFuncList),h.ondispose.__removeFuncList=[]),h.ondispose.__removeFuncList.push(K,y)}return(y,F)=>g(h,y,F,A)};L.installMethodArgcCheck=!1;const H=function(g,h,D=L.installMethodArgcCheck){const U=new Map;for(const A of Object.keys(h)){const N=h[A],K=U.get(N);if(K){const d=g.memberKey(A);g[d]=g[g.memberKey(K)]}else L(g,A,N,D),U.set(N,A)}return g};x.StructType.prototype.installMethod=function(h,D,U=L.installMethodArgcCheck){return arguments.length<3&&h&&typeof h=="object"?H(this,...arguments):L(this,...arguments)},x.StructType.prototype.installMethods=function(g,h=L.installMethodArgcCheck){return H(this,g,h)}}
2),globalThis.sqlite3ApiBootstrap.initializers.push(function(i){const t=(...E)=>{throw new i.SQLite3Error(...E)},r=i.capi,s=i.wasm,_=i.util,c=function(E){return(...o)=>E("sqlite3.oo1:",...o)};i.__isUnderTest?c((()=>{}).bind(console)):c(i.config.debug),i.__isUnderTest?c((()=>{}).bind(console)):c(i.config.warn),i.__isUnderTest?c((()=>{}).bind(console)):c(i.config.error);const b=new WeakMap,z=new Set,I=new WeakMap,q=(E,o,u)=>{const p=Object.getOwnPropertyDescriptor(E,o);return p?p.value:u},w=function(E,o){return o&&(E instanceof g&&(E=E.pointer),t(o,"sqlite3 result code",o+":",E?r.sqlite3_errmsg(E):r.sqlite3_errstr(o))),arguments[0]},x=s.installFunction("i(ippp)",(function(E,o,u,p){r.SQLITE_TRACE_STMT}).bind({counter:0})),L=Object.create(null),H=function E(...o){const u=E.normalizeArgs(...o);let p;if(p=u["sqlite3*"])u["sqlite3*:takeOwnership"]||z.add(this),this.filename=r.sqlite3_db_filename(p,"main");else{let S=u.filename,M=u.vfs,V=u.flags;(typeof S!="string"&&!s.isPtr(S)||typeof V!="string"||M&&typeof M!="string"&&!s.isPtr(M))&&(i.config.error("Invalid DB ctor args",u,arguments),t("Invalid arguments for DB constructor:",arguments,"opts:",u));let R=0;V.indexOf("c")>=0&&(R|=r.SQLITE_OPEN_CREATE|r.SQLITE_OPEN_READWRITE),V.indexOf("w")>=0&&(R|=r.SQLITE_OPEN_READWRITE),R===0&&(R|=r.SQLITE_OPEN_READONLY),R|=r.SQLITE_OPEN_EXRESCODE;const m=s.pstack.pointer;try{const C=s.pstack.allocPtr();let B=r.sqlite3_open_v2(S,C,R,M||s.ptr.null);p=s.peekPtr(C),w(p,B),r.sqlite3_extended_result_codes(p,1),V.indexOf("t")>=0&&r.sqlite3_trace_v2(p,r.SQLITE_TRACE_STMT,x,p)}catch(C){throw p&&r.sqlite3_close_v2(p),C}finally{s.pstack.restore(m)}this.filename=s.isPtr(S)?s.cstrToJs(S):S}if(b.set(this,p),I.set(this,Object.create(null)),!u["sqlite3*"])try{const S=L[r.sqlite3_js_db_vfs(p)||t("Internal error: cannot get VFS for new db handle.")];S&&(S instanceof Function?S(this,i):w(p,r.sqlite3_exec(p,S,0,0,0)))}catch(S){throw this.close(),S}};H.setVfsPostOpenCallback=function(E,o){o instanceof Function||t("dbCtorHelper.setVfsPostOpenCallback() should not be used with a non-function argument.",arguments),L[E]=o},H.normalizeArgs=function(E=":memory:",o="c",u=null){const p={};return arguments.length===1&&arguments[0]&&typeof arguments[0]=="object"?(Object.assign(p,arguments[0]),p.flags===void 0&&(p.flags="c"),p.vfs===void 0&&(p.vfs=null),p.filename===void 0&&(p.filename=":memory:")):(p.filename=E,p.flags=o,p.vfs=u),p};const g=function(...E){H.apply(this,E)};g.dbCtorHelper=H;const h={null:1,number:2,string:3,boolean:4,blob:5};s.bigIntEnabled&&(h.bigint=h.number);const D=function(){h!==arguments[2]&&t(r.SQLITE_MISUSE,"Do not call the Stmt constructor directly. Use DB.prepare()."),this.db=arguments[0],b.set(this,arguments[1]),arguments.length>3&&!arguments[3]&&z.add(this)},U=function(E){return E.pointer||t("DB has been closed."),E},A=function(E,o){return(o!==(o|0)||o<0||o>=E.columnCount)&&t("Column index",o,"is out of range."),E},N=function(E,o){const u=Object.create(null);switch(u.opt=Object.create(null),o.length){case 1:typeof o[0]=="string"||_.isSQLableTypedArray(o[0])||Array.isArray(o[0])?u.sql=o[0]:o[0]&&typeof o[0]=="object"&&(u.opt=o[0],u.sql=u.opt.sql);break;case 2:u.sql=o[0],u.opt=o[1];break;default:t("Invalid argument count for exec().")}u.sql=_.flexibleString(u.sql),typeof u.sql!="string"&&t("Missing SQL argument or unsupported SQL value type.");const p=u.opt;switch(p.returnValue){case"resultRows":p.resultRows||(p.resultRows=[]),u.returnVal=()=>p.resultRows;break;case"saveSql":p.saveSql||(p.saveSql=[]),u.returnVal=()=>p.saveSql;break;case void 0:case"this":u.returnVal=()=>E;break;default:t("Invalid returnValue value:",p.returnValue)}if(!p.callback&&!p.returnValue&&p.rowMode!==void 0&&(p.resultRows||(p.resultRows=[]),u.returnVal=()=>p.resultRows),p.callback||p.resultRows)switch(p.rowMode===void 0?"array":p.rowMode){case"object":u.cbArg=(S,M)=>{M.columnNames||(M.columnNames=S.getColumnNames([]));const V=S.get([]),R=Object.create(null);for(const m in M.columnNames)R[M.columnNames[m]]=V[m];return R};break;case"array":u.cbArg=S=>S.get([]);break;
2case"stmt":Array.isArray(p.resultRows)&&t("exec(): invalid rowMode for a resultRows array: must","be one of 'array', 'object',","a result column number, or column name reference."),u.cbArg=S=>S;break;default:if(_.isInt32(p.rowMode)){u.cbArg=S=>S.get(p.rowMode);break}else if(typeof p.rowMode=="string"&&p.rowMode.length>1&&p.rowMode[0]==="$"){const S=p.rowMode.substr(1);u.cbArg=M=>{const V=M.get(Object.create(null))[S];return V===void 0?t(r.SQLITE_NOTFOUND,"exec(): unknown result column:",S):V};break}t("Invalid rowMode:",p.rowMode)}return u},K=(E,o,u,...p)=>{const S=E.prepare(o);try{const M=S.bind(u).step()?S.get(...p):void 0;return S.reset(),M}finally{S.finalize()}},d=(E,o,u,p)=>E.exec({sql:o,bind:u,rowMode:p,returnValue:"resultRows"});g.checkRc=(E,o)=>w(E,o),g.prototype={isOpen:function(){return!!this.pointer},affirmOpen:function(){return U(this)},close:function(){const E=this.pointer;if(E){if(this.onclose&&this.onclose.before instanceof Function)try{this.onclose.before(this)}catch{}if(Object.keys(I.get(this)).forEach((o,u)=>{if(u&&u.pointer)try{u.finalize()}catch{}}),b.delete(this),I.delete(this),z.delete(this)||r.sqlite3_close_v2(E),this.onclose&&this.onclose.after instanceof Function)try{this.onclose.after(this)}catch{}delete this.filename}},changes:function(E=!1,o=!1){const u=U(this).pointer;return E?o?r.sqlite3_total_changes64(u):r.sqlite3_total_changes(u):o?r.sqlite3_changes64(u):r.sqlite3_changes(u)},dbFilename:function(E="main"){return r.sqlite3_db_filename(U(this).pointer,E)},dbName:function(E=0){return r.sqlite3_db_name(U(this).pointer,E)},dbVfsName:function(E=0){let o;const u=r.sqlite3_js_db_vfs(U(this).pointer,E);if(u){const p=new r.sqlite3_vfs(u);try{o=s.cstrToJs(p.$zName)}finally{p.dispose()}}return o},prepare:function(E){U(this);const o=s.pstack.pointer;let u,p;try{u=s.pstack.alloc(8),g.checkRc(this,r.sqlite3_prepare_v2(this.pointer,E,-1,u,null)),p=s.peekPtr(u)}finally{s.pstack.restore(o)}p||t("Cannot prepare empty SQL.");const S=new D(this,p,h);return I.get(this)[p]=S,S},exec:function(){U(this);const E=N(this,arguments);if(!E.sql)return t("exec() requires an SQL string.");const o=E.opt,u=o.callback,p=Array.isArray(o.resultRows)?o.resultRows:void 0;let S,M=o.bind,V=!!(E.cbArg||o.columnNames||p);const R=s.scopedAllocPush(),m=Array.isArray(o.saveSql)?o.saveSql:void 0;try{const C=_.isSQLableTypedArray(E.sql);let B=C?E.sql.byteLength:s.jstrlen(E.sql);const Y=s.scopedAlloc(2*s.ptr.size+(B+1)),te=s.ptr.add(Y,s.ptr.size);let le=s.ptr.add(te,s.ptr.size);const ae=s.ptr.add(le,B);for(C?s.heap8().set(E.sql,le):s.jstrcpy(E.sql,s.heap8(),le,B,!1),s.poke8(s.ptr.add(le,B),0);le&&s.peek8(le);){s.pokePtr([Y,te],0),g.checkRc(this,r.sqlite3_prepare_v3(this.pointer,le,B,0,Y,te));const ye=s.peekPtr(Y);if(le=s.peekPtr(te),B=Number(s.ptr.add(ae,-le)),!!ye){if(m&&m.push(r.sqlite3_sql(ye).trim()),S=new D(this,ye,h),M&&S.parameterCount&&(S.bind(M),M=null),V&&S.columnCount){let ke=Array.isArray(o.columnNames)?0:1;if(V=!1,E.cbArg||p){const We=Object.create(null);for(;S.step();X.delete(S)){ke++===0&&S.getColumnNames(We.columnNames=o.columnNames||[]),X.add(S);const nt=E.cbArg(S,We);if(p&&p.push(nt),u&&u.call(o,nt,S)===!1)break}X.delete(S)}ke===0&&S.getColumnNames(o.columnNames)}else S.step();S.reset().finalize(),S=null}}}finally{S&&(X.delete(S),S.finalize()),s.scopedAllocPop(R)}return E.returnVal()},createFunction:function(o,u,p){const S=We=>We instanceof Function;switch(arguments.length){case 1:p=o,o=p.name,u=p.xFunc||0;break;case 2:S(u)||(p=u,u=p.xFunc||0);break}p||(p={}),typeof o!="string"&&t("Invalid arguments: missing function name.");let M=p.xStep||0,V=p.xFinal||0;const R=p.xValue||0,m=p.xInverse||0;let C;S(u)?(C=!1,(S(M)||S(V))&&t("Ambiguous arguments: scalar or aggregate?"),M=V=null):S(M)?(S(V)||t("Missing xFinal() callback for aggregate or window UDF."),u=null):S(V)?t("Missing xStep() callback for aggregate or window UDF."):t("Missing function-type properties."),C===!1?(S(R)||S(m))&&t("xValue and xInverse are not permitted for non-window UDFs."):S(R)?(S(m)||t("xInverse must be provided if xValue is."),C=!0):S(m)&&t("xValue must be provided if xInverse is.");const B=p.pApp;B!=null&&!s.isPtr(B)&&t("Invalid value for pApp property. Must be a legal WASM pointer value.");const Y=p.xDestroy||0;Y&&!S(Y)&&t("xDestroy property must be a function.");let te=0;q(p,"deterministic")&&(te|=r.SQLITE_DETERMINISTIC),q(p,"directOnly")&&(te|=r.SQLITE_DIRECTONLY),q(p,"innocuous")&&(te|=r.SQLITE_INNOCUOUS),o=o.toLowerCase();const le=u||M,ae=q(p,"arity"),ye=typeof ae=="number"?ae:le.length?le.length-1:0;let ke;return C?ke=r.sqlite3_create_window_function(this.pointer,o,ye,r.SQLITE_UTF8|te,B||0,M,V,R,m,Y):ke=r.sqlite3_create_function_v2(this.pointer,o,ye,r.SQLITE_UTF8|te,B||0,u,M,V,Y),g.checkRc(this,ke),this},selectValue:function(E,o,u){return K(this,E,o,0,u)},selectValues:function(E,o,u){const p=this.prepare(E),S=[];try{for(p.bind(o);p.step();)S.push(p.get(0,u));p.reset()}finally{p.finalize()}return S},selectArray:function(E,o){return K(this,E,o,[])},selectObject:function(E,o){return K(this,E,o,{})},selectArrays:function(E,o){return d(this,E,o,"array")},selectObjects:function(E,o){return d(this,E,o,"object")},openStatementCount:function(){return this.pointer?Object.keys(I.get(this)).length:0},transaction:function(E){let o="BEGIN";arguments.length>1&&(/[^a-zA-Z]/.test(arguments[0])&&t(r.SQLITE_MISUSE,"Invalid argument for BEGIN qualifier."),o+=" "+arguments[0],E=arguments[1]),U(this).exec(o);try{const u=E(this);return this.exec("COMMIT"),u}catch(u){throw this.exec("ROLLBACK"),u}},savepoint:function(E){U(this).exec("SAVEPOINT oo1");try{const o=E(this);return this.exec("RELEASE oo1"),o}catch(o){throw this.exec("ROLLBACK to SAVEPOINT oo1; RELEASE SAVEPOINT oo1"),o}
2},checkRc:function(E){return w(this,E)}},g.wrapHandle=function(E,o=!1){if(!E||!s.isPtr(E))throw new i.SQLite3Error(r.SQLITE_MISUSE,"Argument must be a WASM sqlite3 pointer");return new g({"sqlite3*":E,"sqlite3*:takeOwnership":!!o})};const y=function(E){return E.pointer||t("Stmt has been closed."),E},F=function(E){let o=h[E==null?"null":typeof E];switch(o){case h.boolean:case h.null:case h.number:case h.string:return o;case h.bigint:return s.bigIntEnabled?o:void 0;default:return _.isBindableTypedArray(E)?h.blob:void 0}},W=function(E){return F(E)||t("Unsupported bind() argument type:",typeof E)},P=function(E,o){const u=typeof o=="number"?o:r.sqlite3_bind_parameter_index(E.pointer,o);return u===0||!_.isInt32(u)?t("Invalid bind() parameter name: "+o):(u<1||u>E.parameterCount)&&t("Bind index",o,"is out of range."),u},X=new Set,ee=new Set,Z=function(E,o){return X.has(E)&&t("Operation is illegal when statement is locked:",o),E},ne=function E(o,u,p,S){Z(y(o),"bind()"),E._||(E._tooBigInt=V=>t("BigInt value is too big to store without precision loss:",V),E._={string:function(V,R,m,C){const[B,Y]=s.allocCString(m,!0);return(C?r.sqlite3_bind_blob:r.sqlite3_bind_text)(V.pointer,R,B,Y,r.SQLITE_WASM_DEALLOC)}}),W(S),u=P(o,u);let M=0;switch(S==null?h.null:p){case h.null:M=r.sqlite3_bind_null(o.pointer,u);break;case h.string:M=E._.string(o,u,S,!1);break;case h.number:{let V;_.isInt32(S)?V=r.sqlite3_bind_int:typeof S=="bigint"?_.bigIntFits64(S)?s.bigIntEnabled?V=r.sqlite3_bind_int64:_.bigIntFitsDouble(S)?(S=Number(S),V=r.sqlite3_bind_double):E._tooBigInt(S):E._tooBigInt(S):(S=Number(S),s.bigIntEnabled&&Number.isInteger(S)?V=r.sqlite3_bind_int64:V=r.sqlite3_bind_double),M=V(o.pointer,u,S);break}case h.boolean:M=r.sqlite3_bind_int(o.pointer,u,S?1:0);break;case h.blob:{if(typeof S=="string"){M=E._.string(o,u,S,!0);break}else S instanceof ArrayBuffer?S=new Uint8Array(S):_.isBindableTypedArray(S)||t("Binding a value as a blob requires","that it be a string, Uint8Array, Int8Array, or ArrayBuffer.");const V=s.alloc(S.byteLength||1);s.heap8().set(S.byteLength?S:[0],Number(V)),M=r.sqlite3_bind_blob(o.pointer,u,V,S.byteLength,r.SQLITE_WASM_DEALLOC);break}default:i.config.warn("Unsupported bind() argument type:",S),t("Unsupported bind() argument type: "+typeof S)}return M&&g.checkRc(o.db.pointer,M),o};D.prototype={finalize:function(){const E=this.pointer;if(E){Z(this,"finalize()");const o=z.delete(this)?0:r.sqlite3_finalize(E);return delete I.get(this.db)[E],b.delete(this),X.delete(this),ee.delete(this),delete this.parameterCount,delete this.db,o}},clearBindings:function(){return Z(y(this),"clearBindings()"),r.sqlite3_clear_bindings(this.pointer),ee.delete(this),this},reset:function(E){Z(this,"reset()"),E&&this.clearBindings();const o=r.sqlite3_reset(y(this).pointer);return ee.delete(this),w(this.db,o),this},bind:function(){y(this);let E,o;switch(arguments.length){case 1:E=1,o=arguments[0];break;case 2:E=arguments[0],o=arguments[1];break;default:t("Invalid bind() arguments.")}return o===void 0?this:(this.parameterCount||t("This statement has no bindable parameters."),ee.delete(this),o===null?ne(this,E,h.null,o):Array.isArray(o)?(arguments.length!==1&&t("When binding an array, an index argument is not permitted."),o.forEach((u,p)=>ne(this,p+1,W(u),u)),this):(o instanceof ArrayBuffer&&(o=new Uint8Array(o)),typeof o=="object"&&!_.isBindableTypedArray(o)?(arguments.length!==1&&t("When binding an object, an index argument is not permitted."),Object.keys(o).forEach(u=>ne(this,u,W(o[u]),o[u])),this):ne(this,E,W(o),o)))},bindAsBlob:function(E,o){y(this),arguments.length===1&&(o=E,E=1);const u=W(o);return h.string!==u&&h.blob!==u&&h.null!==u&&t("Invalid value type for bindAsBlob()"),ne(this,E,h.blob,o)},step:function(){Z(this,"step()");const E=r.sqlite3_step(y(this).pointer);switch(E){case r.SQLITE_DONE:return ee.delete(this),!1;case r.SQLITE_ROW:return ee.add(this),!0;default:ee.delete(this),i.config.warn("sqlite3_step() rc=",E,r.sqlite3_js_rc_str(E),"SQL =",r.sqlite3_sql(this.pointer)),g.checkRc(this.db.pointer,E)}},stepReset:function(){return this.step(),this.reset()},stepFinalize:function(){try{const E=this.step();return this.reset(),E}finally{try{this.finalize()}catch{}}},get:function(E,o){if(ee.has(y(this))||t("Stmt.step() has not (recently) returned true."),Array.isArray(E)){let u=0;const p=this.columnCount;for(;u<p;)E[u]=this.get(u++);return E}else if(E&&typeof E=="object"){let u=0;const p=this.columnCount;for(;u<p;)E[r.sqlite3_column_name(this.pointer,u)]=this.get(u++);return E}switch(A(this,E),o===void 0?r.sqlite3_column_type(this.pointer,E):o){case r.SQLITE_NULL:return null;case r.SQLITE_INTEGER:if(s.bigIntEnabled){const u=r.sqlite3_column_int64(this.pointer,E);return u>
2=Number.MIN_SAFE_INTEGER&&u<=Number.MAX_SAFE_INTEGER?Number(u).valueOf():u}else{const u=r.sqlite3_column_double(this.pointer,E);return(u>Number.MAX_SAFE_INTEGER||u<Number.MIN_SAFE_INTEGER)&&t("Integer is out of range for JS integer range: "+u),_.isInt32(u)?u|0:u}case r.SQLITE_FLOAT:return r.sqlite3_column_double(this.pointer,E);case r.SQLITE_TEXT:return r.sqlite3_column_text(this.pointer,E);case r.SQLITE_BLOB:{const u=r.sqlite3_column_bytes(this.pointer,E),p=r.sqlite3_column_blob(this.pointer,E),S=new Uint8Array(u);return u&&(S.set(s.heap8u().slice(Number(p),Number(p)+u),0),this.db._blobXfer instanceof Array&&this.db._blobXfer.push(S.buffer)),S}default:t("Don't know how to translate","type of result column #"+E+".")}t("Not reached.")},getInt:function(E){return this.get(E,r.SQLITE_INTEGER)},getFloat:function(E){return this.get(E,r.SQLITE_FLOAT)},getString:function(E){return this.get(E,r.SQLITE_TEXT)},getBlob:function(E){return this.get(E,r.SQLITE_BLOB)},getJSON:function(E){const o=this.get(E,r.SQLITE_STRING);return o===null?o:JSON.parse(o)},getColumnName:function(E){return r.sqlite3_column_name(A(y(this),E).pointer,E)},getColumnNames:function(E=[]){A(y(this),0);const o=this.columnCount;for(let u=0;u<o;++u)E.push(r.sqlite3_column_name(this.pointer,u));return E},getParamIndex:function(E){return y(this).parameterCount?r.sqlite3_bind_parameter_index(this.pointer,E):void 0},getParamName:function(E){return y(this).parameterCount?r.sqlite3_bind_parameter_name(this.pointer,E):void 0},isBusy:function(){return r.sqlite3_stmt_busy(y(this))!==0},isReadOnly:function(){return r.sqlite3_stmt_readonly(y(this))!==0}};{const E={enumerable:!0,get:function(){return b.get(this)},set:()=>t("The pointer property is read-only.")};Object.defineProperty(D.prototype,"pointer",E),Object.defineProperty(g.prototype,"pointer",E)}Object.defineProperty(D.prototype,"columnCount",{enumerable:!1,get:function(){return r.sqlite3_column_count(this.pointer)},set:()=>t("The columnCount property is read-only.")}),Object.defineProperty(D.prototype,"parameterCount",{enumerable:!1,get:function(){return r.sqlite3_bind_parameter_count(this.pointer)},set:()=>t("The parameterCount property is read-only.")}),D.wrapHandle=function(E,o,u=!1){if(!(E instanceof g)||!E.pointer)throw new i.SQLite3Error(i.SQLITE_MISUSE,"First argument must be an opened sqlite3.oo1.DB instance");if(!o||!s.isPtr(o))throw new i.SQLite3Error(i.SQLITE_MISUSE,"Second argument must be a WASM sqlite3_stmt pointer");return new D(E,o,h,!!u)},i.oo1={DB:g,Stmt:D}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(i){const t=i.util;i.initWorker1API=(function(){const r=(...x)=>{throw new Error(x.join(" "))};globalThis.WorkerGlobalScope instanceof Function||r("initWorker1API() must be run from a Worker thread.");const s=this.sqlite3||r("Missing this.sqlite3 object."),_=s.oo1.DB,c=function(x){let L=b.idMap.get(x);return L||(L="db#"+ ++b.idSeq+":"+Math.floor(Math.random()*1e8)+":"+Math.floor(Math.random()*1e8),b.idMap.set(x,L),L)},b={dbList:[],idSeq:0,idMap:new WeakMap,xfer:[],open:function(x){const L=new _(x);return this.dbs[c(L)]=L,this.dbList.indexOf(L)<0&&this.dbList.push(L),L},close:function(x,L){if(x){delete this.dbs[c(x)];const H=x.filename,g=t.sqlite3__wasm_db_vfs(x.pointer,0);x.close();const h=this.dbList.indexOf(x);h>=0&&this.dbList.splice(h,1),L&&H&&g&&t.sqlite3__wasm_vfs_unlink(g,H)}},post:function(x,L){L&&L.length?(globalThis.postMessage(x,Array.from(L)),L.length=0):globalThis.postMessage(x)},dbs:Object.create(null),getDb:function(x,L=!0){return this.dbs[x]||(L?r("Unknown (or closed) DB ID:",x):void 0)}},z=function(x=b.dbList[0]){return x&&x.pointer?x:r("DB is not opened.")},I=function(x,L=!0){const H=b.getDb(x.dbId,!1)||b.dbList[0];return L?z(H):H},q=function(){return b.dbList[0]&&c(b.dbList[0])},w={open:function(x){const L=Object.create(null),H=x.args||Object.create(null);H.simulateError&&r("Throwing because of simulateError flag.");const g=Object.create(null);L.vfs=H.vfs,L.filename=H.filename||"";const h=b.open(L);return g.filename=h.filename,g.persistent=!!s.capi.sqlite3_js_db_uses_vfs(h.pointer,"opfs"),g.dbId=c(h),g.vfs=h.dbVfsName(),g},close:function(x){const L=I(x,!1),H={filename:L&&L.filename};if(L){const g=x.args&&typeof x.args=="object"?!!x.args.unlink:!1;b.close(L,g)}return H},exec:function(x){const L=typeof x.args=="string"?{sql:x.args}:x.args||Object.create(null);L.rowMode==="stmt"?r("Invalid rowMode for 'exec': stmt mode","does not work in the Worker API."):L.sql||r("'exec' requires input SQL.");const H=I(x);
2(L.callback||Array.isArray(L.resultRows))&&(H._blobXfer=b.xfer);const g=L.callback;let h=0;const D=!!L.columnNames;typeof g=="string"&&(D||(L.columnNames=[]),L.callback=function(U,A){b.post({type:g,columnNames:L.columnNames,rowNumber:++h,row:U},b.xfer)});try{const U=L.countChanges?H.changes(!0,L.countChanges===64):void 0;H.exec(L),U!==void 0&&(L.changeCount=H.changes(!0,L.countChanges===64)-U);const A=L.lastInsertRowId?s.capi.sqlite3_last_insert_rowid(H):void 0;A!==void 0&&(L.lastInsertRowId=A),L.callback instanceof Function&&(L.callback=g,b.post({type:g,columnNames:L.columnNames,rowNumber:null,row:void 0}))}finally{delete H._blobXfer,L.callback&&(L.callback=g)}return L},"config-get":function(){const x=Object.create(null),L=s.config;return["bigIntEnabled"].forEach(function(H){Object.getOwnPropertyDescriptor(L,H)&&(x[H]=L[H])}),x.version=s.version,x.vfsList=s.capi.sqlite3_js_vfs_list(),x},export:function(x){const L=I(x),H={byteArray:s.capi.sqlite3_js_db_export(L.pointer),filename:L.filename,mimetype:"application/x-sqlite3"};return b.xfer.push(H.byteArray.buffer),H},toss:function(x){r("Testing worker exception")}};globalThis.onmessage=async function(x){x=x.data;let L,H=x.dbId,g=x.type;const h=performance.now();try{w.hasOwnProperty(g)&&w[g]instanceof Function?L=await w[g](x):r("Unknown db worker message type:",x.type)}catch(D){g="error",L={operation:x.type,message:D.message,errorClass:D.name,input:x},D.stack&&(L.stack=typeof D.stack=="string"?D.stack.split(/\n\s*/):D.stack)}H||(H=L.dbId||q()),b.post({type:g,dbId:H,messageId:x.messageId,workerReceivedTime:h,workerRespondTime:performance.now(),departureTime:x.departureTime,result:L},b.xfer)},globalThis.postMessage({type:"sqlite3-api",result:"worker1-ready"})}).bind({sqlite3:i})}),globalThis.sqlite3ApiBootstrap.initializers.push(function(i){const t=i.wasm,r=i.capi,s=i.util.toss3,_=Object.create(null);i.vfs=_,r.sqlite3_vfs.prototype.registerVfs=function(c=!1){this instanceof i.capi.sqlite3_vfs||s("Expecting a sqlite3_vfs-type argument.");const b=r.sqlite3_vfs_register(this,c?1:0);return b&&s("sqlite3_vfs_register(",this,") failed with rc",b),this.pointer!==r.sqlite3_vfs_find(this.$zName)&&s("BUG: sqlite3_vfs_find(vfs.$zName) failed for just-installed VFS",this),this},_.installVfs=function(c){let b=0;const z=["io","vfs"];for(const I of z){const q=c[I];q&&(++b,q.struct.installMethods(q.methods,!!q.applyArgcCheck),I==="vfs"&&(!q.struct.$zName&&typeof q.name=="string"&&q.struct.addOnDispose(q.struct.$zName=t.allocCString(q.name)),q.struct.registerVfs(!!q.asDefault)))}return b||s("Misuse: installVfs() options object requires at least","one of:",z),this}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(i){if(!i.wasm.exports.sqlite3_declare_vtab)return;const t=i.wasm,r=i.capi,s=i.util.toss3,_=Object.create(null);i.vtab=_;const c=r.sqlite3_index_info;c.prototype.nthConstraint=function(I,q=!1){if(I<0||I>=this.$nConstraint)return!1;const w=t.ptr.add(this.$aConstraint,c.sqlite3_index_constraint.structInfo.sizeof*I);return q?w:new c.sqlite3_index_constraint(w)},c.prototype.nthConstraintUsage=function(I,q=!1){if(I<0||I>=this.$nConstraint)return!1;const w=t.ptr.add(this.$aConstraintUsage,c.sqlite3_index_constraint_usage.structInfo.sizeof*I);return q?w:new c.sqlite3_index_constraint_usage(w)},c.prototype.nthOrderBy=function(I,q=!1){if(I<0||I>=this.$nOrderBy)return!1;const w=t.ptr.add(this.$aOrderBy,c.sqlite3_index_orderby.structInfo.sizeof*I);return q?w:new c.sqlite3_index_orderby(w)};const b=function(I,q){return(function(w,x=!1){if(arguments.length===0&&(w=new q),w instanceof q)return this.set(w.pointer,w),w;t.isPtr(w)||i.SQLite3Error.toss("Invalid argument to",I+"()");let L=this.get(w);return x&&this.delete(w),L}).bind(new Map)},z=function(I,q){const w=b(I,q);return Object.assign(Object.create(null),{StructType:q,create:x=>{const L=w();return t.pokePtr(x,L.pointer),L},get:x=>w(x),unget:x=>w(x,!0),dispose:x=>w(x,!0)?.dispose?.()})};_.xVtab=z("xVtab",r.sqlite3_vtab),_.xCursor=z("xCursor",r.sqlite3_vtab_cursor),_.xIndexInfo=I=>new r.sqlite3_index_info(I),_.xError=function I(q,w,x){if(I.errorReporter instanceof Function)try{I.errorReporter("sqlite3_module::"+q+"(): "+w.message)}catch{}let L;return w instanceof i.WasmAllocError?L=r.SQLITE_NOMEM:arguments.length>2?L=x:w instanceof i.SQLite3Error&&(L=w.resultCode),L||r.SQLITE_ERROR},_.xError.errorReporter=i.config.error.bind(i.config),_.xRowid=(I,q)=>t.poke(I,q,"i64"),_.setupModule=function(I){let q=!1;const w=this instanceof r.sqlite3_module?this:I.struct||(q=new r.sqlite3_module);try{const x=I.methods||s("Missing 'methods' object.");for(const L of Object.entries({xConnect:"xCreate",xDisconnect:"xDestroy"})){const H=L[0],g=L[1];x[H]===!0?x[H]=x[g]:x[g]===!0&&(x[g]=x[H])}if(I.catchExceptions){const L=function(h,D){return["xConnect","xCreate"].indexOf(h)>=0?function(U,A,N,K,d,y){try{return D(...arguments)||0}catch(F){return F instanceof i.WasmAllocError||(t.dealloc(t.peekPtr(y)),t.pokePtr(y,t.allocCString(F.message))),_.xError(h,F)}}:function(...U){try{return D(...U)||0}catch(A){return _.xError(h,A)}}},H=["xCreate","xConnect","xBestIndex","xDisconnect","xDestroy","xOpen","xClose","xFilter","xNext","xEof","xColumn","xRowid","xUpdate","xBegin","xSync","xCommit","xRollback","xFindFunction","xRename","xSavepoint","xRelease","xRollbackTo","xShadowName"],g=Object.create(null);for(const h of H){const D=x[h];if(D instanceof Function)h==="xConnect"&&x.xCreate===D?g[h]=x.xCreate:h==="xCreate"&&x.xConnect===D?g[h]=x.xConnect:g[h]=L(h,D);else continue}w.installMethods(g,!1)}else w.installMethods(x,!!I.applyArgcCheck);if(w.$iVersion===0){let L;typeof I.iVersion=="number"?L=I.iVersion:w.$xIntegrity?L=4:w.$xShadowName?L=3:w.$xSavePoint||w.$xRelease||w.$xRollbackTo?L=2:L=1,w.$iVersion=L}}catch(x){throw q&&q.dispose(),x}return w},r.sqlite3_module.prototype.setupModule=function(I){return _.setupModule.call(this,I)}}
2),globalThis.sqlite3ApiBootstrap.initializers.push(function(i){if(i.config.disable?.vfs?.kvvfs)return;const t=i.capi,r=t.sqlite3_kvvfs_methods,s=t.KVVfsFile,_=i.capi.sqlite3_vfs_find("kvvfs");if(delete t.sqlite3_kvvfs_methods,delete t.KVVfsFile,!_)return;const c=i.util,b=i.wasm,z=c.toss3,I=new r(b.exports.sqlite3__wasm_kvvfs_methods());c.assert(32<=I.$nKeySize,"unexpected kvvfsMethods.$nKeySize: "+I.$nKeySize);const q=Object.assign(Object.create(null),{rxJournalSuffix:/-journal$/,zKeyJrnl:b.allocCString("jrnl"),zKeySz:b.allocCString("sz"),keySize:I.$nKeySize,buffer:Object.assign(Object.create(null),{n:I.$nBufferSize,pool:Object.create(null)})});q.memBuffer=(O=0)=>q.buffer.pool[O]??=b.alloc(q.buffer.n),q.memBufferFree=O=>{const j=q.buffer.pool[O];j&&(b.dealloc(j),delete q.buffer.pool[O])};const w=()=>{},x=i.__isUnderTest?(...O)=>i.config.debug?.("kvvfs:",...O):w,L=(...O)=>i.config.warn?.("kvvfs:",...O),H=(...O)=>i.config.error?.("kvvfs:",...O);class g{#e=Object.create(null);#i=null;#s=0;constructor(){this.clear()}#t(){return this.#i??=Object.keys(this.#e)}key(j){return j<0||j>=this.#s?null:this.#t()[j]}getItem(j){return this.#e[j]??null}setItem(j,G){j in this.#e||(++this.#s,this.#i=null),this.#e[j]=""+G}removeItem(j){j in this.#e&&(delete this.#e[j],--this.#s,this.#i=null)}clear(){this.#e=Object.create(null),this.#i=null,this.#s=0}get length(){return this.#s}}const h=O=>O==="local"||O==="session",D=O=>h(O)?"kvvfs-"+O+"-":"",U=function(O,j=!1){if(h(O))return;const G=new Blob([O]).size;G||z(t.SQLITE_MISUSE,"Empty name is not permitted.");let $=q.keySize-1;q.rxJournalSuffix.test(O)?j||z(t.SQLITE_MISUSE,"Storage names may not have a '-journal' suffix."):["-wal","-shm"].filter(oe=>O.endsWith(oe)).length?z(t.SQLITE_MISUSE,"Storage names may not have a -wal or -shm suffix."):$-=8,G>$&&z(t.SQLITE_RANGE,"Storage name is too long. Limit =",$);let ie;for(ie=0;ie<G;++ie){const oe=O.codePointAt(ie);oe<32&&z(t.SQLITE_RANGE,"Illegal character ("+oe+"d) in storage name:",O)}},A=(O,j=void 0)=>Object.assign(Object.create(null),{jzClass:O,refc:1,deleteAtRefc0:!1,storage:j||new g,keyPrefix:D(O),files:[],listeners:void 0}),N=i.kvvfs=Object.create(null);i.__isUnderTest&&(N.log=Object.assign(Object.create(null),{xOpen:!1,xClose:!1,xWrite:!1,xRead:!1,xSync:!1,xAccess:!1,xFileControl:!1,xRcrdRead:!1,xRcrdWrite:!1,xRcrdDelete:!1}));const K=function(O){const j=q.rxJournalSuffix.test(O.jzClass)?O.jzClass.replace(q.rxJournalSuffix,""):O.jzClass+"-journal";N?.log?.xClose&&x("cleaning up storage handles [",O.jzClass,j,"]",O),delete q.storagePool[O.jzClass],delete q.storagePool[j],i.__isUnderTest||(delete O.storage,delete O.refc)},d=O=>q.storagePool[O.jzClass]=q.storagePool[O.jzClass+"-journal"]=O,y=".";q.storagePool=Object.assign(Object.create(null),{[y]:A(y)}),globalThis.Storage&&(globalThis.localStorage instanceof globalThis.Storage&&(q.storagePool.local=A("local",globalThis.localStorage)),globalThis.sessionStorage instanceof globalThis.Storage&&(q.storagePool.session=A("session",globalThis.sessionStorage))),q.builtinStorageNames=Object.keys(q.storagePool);const F=O=>q.builtinStorageNames.indexOf(O)>-1;for(const O of Object.keys(q.storagePool)){const j=q.storagePool[O];q.storagePool[O+"-journal"]=j}q.setError=(O=void 0,j=t.SQLITE_ERROR)=>O?(q.lastError=O,O.resultCode|0||j):(delete q.lastError,0),q.popError=()=>{const O=q.lastError;return delete q.lastError,O};const W=O=>{L("kvvfs.listener handler threw:",O)},P=b.exports.sqlite3__wasm_kvvfs_decode,X=b.exports.sqlite3__wasm_kvvfs_encode,ee=async function(O,j,...G){try{j.keyPrefix&&G[0]&&(G[0]=G[0].replace(j.keyPrefix,""));let $,ie,oe,ue;for(const se of j.listeners){const pe=Object.create(null);pe.storageName=j.jzClass,pe.type=O,se.decodePages;const be=se.events[O];if(be){if(!se.includeJournal&&G[0]==="jrnl")continue;if(O==="write"&&se.decodePages&&+G[0]>0){if(pe.data=[G[0]],ue?.[G[0]]){pe.data[1]=ue[G[0]];continue}$??=new TextEncoder("utf-8"),ie??=q.memBuffer(10),oe??=q.memBuffer(11);const we=$.encode(G[1]),me=b.heap8u();me.set(we,Number(ie)),me[b.ptr.addn(ie,we.length)]=0;const Le=P(ie,oe,q.buffer.n);if(Le>0)ue??=Object.create(null),ue[G[0]]=pe.data[1]=me.slice(Number(oe),b.ptr.addn(oe,Le));else continue}else pe.data=G.length?G.length===1?G[0]:G:void 0;
2try{be(pe)?.catch?.(W)}catch(we){L("notifyListeners [",j.jzClass,"]",O,we)}}}}catch($){W($)}},Z=O=>typeof O=="string"?q.storagePool[O]:q.storagePool[b.cstrToJs(O)],ne=b.exports.sqlite3__wasm_kvvfsMakeKey,E=(O,j,G)=>j&&O.keyPrefix?ne(j,G):G,o=(O,j,G)=>b.cstrToJs(E(O,j,G)),u=O=>+O.storage.getItem(O.keyPrefix+"sz"),p=new Map,S={vfs:Object.create(null),ioDb:Object.create(null),ioJrnl:Object.create(null)},M=new t.sqlite3_vfs(I.$pVfs),V=new t.sqlite3_io_methods(I.$pIoDb),R=new t.sqlite3_io_methods(I.$pIoJrnl),m=Object.create(null),C=Object.assign(Object.create(null),{pFileHandles:p,cache:q,storageForZClass:Z,KVVfsStorage:g,disablePageSizeChange:!0});N.log&&(N.internal=C);const B={recordHandler:{xRcrdRead:(O,j,G,$)=>{try{const ie=b.cstrToJs(O),oe=Z(ie);if(!oe)return-1;const ue=o(oe,O,j);N?.log?.xRcrdRead&&L("xRcrdRead",ie,ue,$,oe);const se=oe.storage.getItem(ue);if(se===null)return-1;const pe=se.length;if($<=0)return pe;if($===1)return b.poke(G,0),pe;$+1<pe&&z(t.SQLITE_RANGE,"xRcrdRead()",ie,ue,"input buffer is too small: need",pe,"but have",$);const be=q.memBuffer(0),we=b.heap8();let me;for(me=0;me<pe;++me)we[b.ptr.add(be,me)]=se.codePointAt(me)&255;return we.copyWithin(Number(G),Number(be),b.ptr.addn(be,me)),we[b.ptr.add(G,pe)]=0,$}catch(ie){return H("kvrecordRead()",ie),q.setError(ie),-2}},xRcrdWrite:(O,j,G)=>{try{const $=Z(O),ie=o($,O,j),oe=b.cstrToJs(G);return N?.log?.xRcrdWrite&&L("xRcrdWrite",ie,$),$.storage.setItem(ie,oe),$.listeners&&ee("write",$,ie,oe),0}catch($){return H("kvrecordWrite()",$),q.setError($,t.SQLITE_IOERR)}},xRcrdDelete:(O,j)=>{try{const G=Z(O),$=o(G,O,j);return N?.log?.xRcrdDelete&&L("xRcrdDelete",$,G),G.storage.removeItem($),G.listeners&&ee("delete",G,$),0}catch(G){return H("kvrecordDelete()",G),q.setError(G,t.SQLITE_IOERR)}}},vfs:{xOpen:function(O,j,G,$,ie){q.popError();let oe;try{j||(oe=b.allocCString(""+G+"."+(Math.random()*1e5|0)),j=oe);const ue=b.cstrToJs(j);N?.log?.xOpen&&x("xOpen",ue,"flags =",$),U(ue,!0),$&(t.SQLITE_OPEN_MAIN_DB|t.SQLITE_OPEN_TEMP_DB|t.SQLITE_OPEN_TRANSIENT_DB)&&q.rxJournalSuffix.test(ue)&&z(t.SQLITE_ERROR,"DB files may not have a '-journal' suffix.");let se=Z(ue);!se&&!($&t.SQLITE_OPEN_CREATE)&&z(t.SQLITE_ERROR,"Storage not found:",ue);const pe=S.vfs.xOpen(O,j,G,$,ie);if(pe)return pe;let be=!!(t.SQLITE_OPEN_DELETEONCLOSE&$);b.isPtr(arguments[1])&&t.sqlite3_uri_boolean(j,"delete-on-close",0)&&(be=!0);const we=new s(G);if(c.assert(we.$zClass,"Missing f.$zClass"),we.addOnDispose(oe),oe=void 0,se)++se.refc,se.files.push(we),b.poke32(ie,$);else{b.poke32(ie,$|t.SQLITE_OPEN_CREATE),c.assert(!we.$isJournal,"Opening a journal before its db? "+ue);const me=ue.replace(q.rxJournalSuffix,"");se=A(me),d(se),se.files.push(we),se.deleteAtRefc0=be,N?.log?.xOpen&&x("xOpen installed storage handle [",me,me+"-journal","]",se)}return p.set(G,{store:se,file:we,jzClass:ue}),se.listeners&&ee("open",se,se.files.length),0}catch(ue){return L("xOpen:",ue),q.setError(ue)}finally{oe&&b.dealloc(oe)}},xDelete:function(O,j,G){q.popError();try{const $=b.cstrToJs(j);return q.rxJournalSuffix.test($)&&m.xRcrdDelete(j,q.zKeyJrnl),0}catch($){return L("xDelete",$),q.setError($)}},xAccess:function(O,j,G,$){q.popError();try{const ie=Z(j),oe=ie?.jzClass||b.cstrToJs(j);if(N?.log?.xAccess&&x("xAccess",oe,"flags =",G,"*pResOut =",b.peek32($),"store =",ie),!ie)try{U(oe)}catch{return b.poke32($,0),0}if(ie){const ue=ie.keyPrefix+(q.rxJournalSuffix.test(oe)?"jrnl":"1"),se=ie.storage.getItem(ue)?0:1;b.poke32($,se)}else b.poke32($,0);return 0}catch(ie){return H("xAccess",ie),q.setError(ie)}},xRandomness:function(O,j,G){const $=b.heap8u();let ie=0;const oe=Number(G);for(;ie<j;++ie)$[oe+ie]=Math.random()*255e3&255;return j},xGetLastError:function(O,j,G){const $=q.popError();if(x("xGetLastError",$),$){const ie=b.scopedAllocPush();try{const[oe,ue]=b.scopedAllocCString($.message,!0);return b.cstrncpy(G,oe,j),ue>j&&b.poke8(b.ptr.add(G,j,-1),0),x("set xGetLastError",$.message),$.resultCode|0||t.SQLITE_IOERR}catch{return t.SQLITE_NOMEM}finally{b.scopedAllocPop(ie)}}return 0}},ioDb:{xClose:function(O){q.popError();try{const j=p.get(O);if(N?.log?.xClose&&x("xClose",O,j),j){p.delete(O);const G=j.store;G.files=G.files.filter($=>$!==j.file),--G.refc<=0&&G.deleteAtRefc0&&K(G),S.ioDb.xClose(O),j.file.dispose(),G.listeners&&ee("close",G,G.files.length)}return 0}catch(j){return H("xClose",j),q.setError(j)}},xFileControl:function(O,j,G){q.popError();try{const $=p.get(O);if(c.assert($,"Missing KVVfsFile handle"),N?.log?.xFileControl&&x("xFileControl",$,"op =",j),j===t.SQLITE_FCNTL_PRAGMA&&C.disablePageSizeChange){const oe=b.peekPtr(b.ptr.add(G,b.ptr.size));if(b.cstrToJs(oe)==="page_size"){N?.log?.xFileControl&&x("xFileControl pragma",b.cstrToJs(oe));const ue=b.peekPtr(b.ptr.add(G,2*b.ptr.size));if(ue)return N?.log?.xFileControl&&L("xFileControl pragma",$,"NOT setting page size to",b.cstrToJs(ue)),$.file.$szPage=-1,0;if($.file.$szPage>0)return N?.log?.xFileControl&&L("xFileControl",$,"getting page size",$.file.$szPage),b.pokePtr(G,b.allocCString(""+$.file.$szPage)),0}}const ie=S.ioDb.xFileControl(O,j,G);return ie==0&&t.SQLITE_FCNTL_SYNC===j&&$.store.listeners&&ee("sync",$.store,!1),ie}catch($){return H("xFileControl",$),q.setError($)}},xSync:function(O,j){q.popError();try{const G=p.get(O);N?.log?.xSync&&x("xSync",G),c.assert(G,"Missing KVVfsFile handle");const $=S.ioDb.xSync(O,j);return $==0&&G.store.listeners&&ee("sync",G.store,!0),$}catch(G){return H("xSync",G),q.setError(G)}}},ioJrnl:{xClose:!0}};try{c.assert(q.buffer.n>1024*129,"Heap buffer is not large enough");for(const O of Object.entries(B.recordHandler)){const j=O[0],G=O[1];m[j]=G,I[I.memberKey(j)]=b.installFunction(I.memberSignature(j),G)}for(const O of Object.entries(B.vfs)){const j=O[0],G=O[1],$=M.memberKey(j),ie=M.structInfo.members[j]||c.toss("Missing pVfs.structInfo[",j,"]");
2S.vfs[j]=b.functionEntry(M[$]),M[$]=b.installFunction(ie.signature,G)}for(const O of Object.entries(B.ioDb)){const j=O[0],G=O[1],$=V.memberKey(j);S.ioDb[j]=b.functionEntry(V[$])||c.toss("Missing native pIoDb[",$,"]"),V[$]=b.installFunction(V.memberSignature(j),G)}for(const O of Object.entries(B.ioJrnl)){const j=O[0],G=O[1],$=R.memberKey(j);S.ioJrnl[j]=b.functionEntry(R[$])||c.toss("Missing native pIoJrnl[",$,"]"),G===!0?R[$]=V[$]||c.toss("Missing copied pIoDb[",$,"]"):R[$]=b.installFunction(R.memberSignature(j),G)}}finally{I.dispose(),M.dispose(),V.dispose(),R.dispose()}const Y=function O(j){if(j==="")return O("local")+O("session");const G=Z(j);if(!G)return 0;G.files.length&&(globalThis.localStorage===G.storage||globalThis.sessionStorage===G.storage||z(t.SQLITE_ACCESS,"Cannot clear in-use database storage."));const $=G.storage,ie=[];let oe,ue=$.length;for(oe=0;oe<ue;++oe){const se=$.key(oe);(!G.keyPrefix||se.startsWith(G.keyPrefix))&&ie.push(se)}return ie.forEach(se=>$.removeItem(se)),ie.length},te=function O(j){if(j==="")return O("local")+O("session");const G=Z(j);if(!G)return 0;const $=G.storage;let ie,oe=0;for(ie=0;ie<$.length;++ie){const ue=$.key(ie);(!G.keyPrefix||ue.startsWith(G.keyPrefix))&&(oe+=ue.length,oe+=$.getItem(ue).length)}return oe*2},le=function(...j){let G;j.length===1&&typeof j[0]=="object"?G=j[0]:j.length&&(G=Object.assign(Object.create(null),{name:j[0]}));const $=G?Z(G.name):null;$||z(t.SQLITE_NOTFOUND,"There is no kvvfs storage named",G?.name);const ie=$.storage,oe=Object.assign(Object.create(null),{name:$.jzClass,timestamp:Date.now(),pages:[]}),ue=Object.create(null),se=$.keyPrefix,pe=se?/^kvvfs-[^-]+-(\w+)/:void 0;let be=0,we=ie.length;for(;be<we;++be){const me=ie.key(be);if(!se||me.startsWith(se)){let Le=(se?pe.exec(me):void 0)?.[1]??me;switch(Le){case"jrnl":G.includeJournal&&(oe.journal=ie.getItem(me));break;case"sz":oe.size=+ie.getItem(me);break;default:if(Le=+Le,(!c.isInt32(Le)||Le<=0)&&z(t.SQLITE_RANGE,"Malformed kvvfs key: "+me),G.decodePages){const Ue=ie.getItem(me),at=Ue.length,Ve=q.memBuffer(0),rt=q.memBuffer(1),ht=b.heap8u();let Re=0;for(;Re<at;++Re)ht[b.ptr.add(Ve,Re)]=Ue.codePointAt(Re)&255;ht[b.ptr.add(Ve,Re)]=0;const vt=P(Ve,rt,q.buffer.n);ue[Le]=ht.slice(Number(rt),b.ptr.addn(rt,vt))}else ue[Le]=ie.getItem(me);break}}}return G.decodePages&&q.memBufferFree(1),Object.keys(ue).map(me=>+me).sort().forEach(me=>oe.pages.push(ue[me])),oe},ae=function(O,j=!1){!O?.timestamp||!O.name||O.size===void 0||!Array.isArray(O.pages)?z(t.SQLITE_MISUSE,"Malformed export object."):(!O.size||O.size!==(O.size|0)||O.size>=2147483647)&&z(t.SQLITE_RANGE,"Invalid db size: "+O.size),U(O.name);let G=Z(O.name);const $=!G;G?(j?!G.files||!G.jzClass?z(t.SQLITE_ERROR,"Internal storage object",O.name,"seems to be malformed."):G.files.length&&z(t.SQLITE_IOERR_ACCESS,"Cannot import db storage while it is in use."):z(t.SQLITE_ACCESS,"Storage '"+O.name+"' already exists and","overwrite was not specified."),Y(O.name)):G=A(O.name);const ie=D(O.name);let oe;try{const ue=G.storage;ue.setItem(ie+"sz",O.size),O.journal&&ue.setItem(ie+"jrnl",O.journal),O.pages[0]instanceof Uint8Array?O.pages.forEach((se,pe)=>{const be=se.length;oe??=q.memBuffer(1);const we=q.memBuffer(0),me=b.heap8u();me.set(se,Number(we)),me[b.ptr.addn(we,be)]=0;const Le=X(we,be,oe);c.assert(Le<q.buffer.n,"Impossibly long output - possibly smashed the heap"),c.assert(b.peek8(b.ptr.add(oe,Le))===0,"Expecting NUL-terminated encoded output");const Ue=b.cstrToJs(oe);ue.setItem(ie+(pe+1),Ue)}):O.pages[0]&&O.pages.forEach((se,pe)=>ue.setItem(ie+(pe+1),se)),$&&d(G)}catch{if(!$)try{Y(O.name)}catch{}}finally{oe&&q.memBufferFree(1)}return this},ye=function(O){let j=Z(O);if(j){++j.refc;return}U(O),d(A(O))},ke=function(O){const j=Z(O);return!j||h(j.jzClass)||F(j.jzClass)||q.rxJournalSuffix.test(O)?!1:j.refc>j.files.length||j.files.length===0?(--j.refc<=0&&K(j),!0):!1},We=function(O){(!O||typeof O!="object")&&z(t.SQLITE_MISUSE,"Expecting a listener object.");let j=Z(O.storage);j||(O.storage&&O.reserve?(ye(O.storage),j=Z(O.storage),c.assert(j,"Unexpectedly cannot fetch reserved storage "+O.storage)):z(t.SQLITE_NOTFOUND,"No such storage:",O.storage)),O.events&&(j.listeners??=[]).push(O)},nt=function(O){const j=Z(O?.storage);if(j?.listeners&&O.events){const G=j.listeners.length;j.listeners=j.listeners.filter(ie=>ie!==O);const $=G>j.listeners.length;return j.listeners.length||(j.listeners=void 0),$}return!1};if(i.kvvfs.reserve=ye,i.kvvfs.import=ae,i.kvvfs.export=le,i.kvvfs.unlink=ke,i.
2kvvfs.listen=We,i.kvvfs.unlisten=nt,i.kvvfs.exists=O=>!!Z(O),i.kvvfs.estimateSize=te,i.kvvfs.clear=Y,globalThis.Storage&&(t.sqlite3_js_kvvfs_size=(O="")=>te(O),t.sqlite3_js_kvvfs_clear=(O="")=>Y(O)),i.oo1?.DB){const O=i.oo1.DB;i.oo1.JsStorageDb=function(G=i.oo1.JsStorageDb.defaultStorageName){const $=O.dbCtorHelper.normalizeArgs(...arguments);switch($.vfs="kvvfs",$.filename){case":sessionStorage:":$.filename="session";break;case":localStorage:":$.filename="local";break}const ie=/(file:(\/\/)?)([^?]+)/.exec($.filename);U(ie?ie[3]:$.filename),O.dbCtorHelper.call(this,$)},i.oo1.JsStorageDb.defaultStorageName=q.storagePool.session?"session":y;const j=i.oo1.JsStorageDb;j.prototype=Object.create(O.prototype),j.clearStorage=Y,j.prototype.clearStorage=function(){return j.clearStorage(this.affirmOpen().dbFilename(),!0)},j.storageSize=te,j.prototype.storageSize=function(){return j.storageSize(this.affirmOpen().dbFilename(),!0)}}if(i.__isUnderTest&&i.vtab){const O=Object.assign(Object.create(null),{rowid:{type:"INTEGER"},name:{type:"TEXT"},nRef:{type:"INTEGER"},nOpen:{type:"INTEGER"},isTransient:{type:"INTEGER"},dbSize:{type:"INTEGER"}});Object.keys(O).forEach((ue,se)=>O[ue].colId=se);const j=i.vtab,G=Object.assign(Object.create(null),{row:function(){return q.storagePool[this.names[this.rowid]]}});Object.assign(Object.create(G),{rowid:0,names:Object.keys(q.storagePool).filter(ue=>!q.rxJournalSuffix.test(ue))});const $=function(ue,se){const pe=ue instanceof t.sqlite3_vtab_cursor?ue:j.xCursor.get(ue);return(se||!pe.vTabState)&&(pe.vTabState=Object.assign(Object.create(G),{rowid:0,names:Object.keys(q.storagePool).filter(be=>!q.rxJournalSuffix.test(be))})),pe.vTabState},ie=()=>{},oe=function ue(){return ue.mod??=new i.capi.sqlite3_module().setupModule({catchExceptions:!0,methods:{xConnect:function(se,pe,be,we,me,Le){try{const Ue=[];Object.keys(O).forEach(Ve=>{Ue.push(Ve+" "+O[Ve].type)});const at=t.sqlite3_declare_vtab(se,"CREATE TABLE ignored("+Ue.join(",")+")");if(at===0){const Ve=j.xVtab.create(me);c.assert(Ve===j.xVtab.get(b.peekPtr(me)),"output pointer check failed")}return at}catch(Ue){return j.xError("xConnect",Ue,t.SQLITE_ERROR)}},xCreate:b.ptr.null,xDisconnect:function(se){return j.xVtab.dispose(se),0},xOpen:function(se,pe){return j.xCursor.create(pe),0},xClose:function(se){const pe=j.xCursor.unget(se);return delete pe.vTabState,pe.dispose(),0},xNext:function(se){const pe=j.xCursor.get(se);return++$(pe).rowid,0},xColumn:function(se,pe,be){const we=$(se),me=we.row();switch(c.assert(me,"Unexpected xColumn call"),be){case O.rowid.colId:t.sqlite3_result_int(pe,we.rowid);break;case O.name.colId:t.sqlite3_result_text(pe,me.jzClass,-1,t.SQLITE_TRANSIENT);break;case O.nRef.colId:t.sqlite3_result_int(pe,me.refc);break;case O.nOpen.colId:t.sqlite3_result_int(pe,me.files.length);break;case O.isTransient.colId:t.sqlite3_result_int(pe,!!me.deleteAtRefc0);break;case O.dbSize.colId:t.sqlite3_result_int(pe,u(me));break;default:return t.sqlite3_result_error(pe,"Invalid column id: "+be),t.SQLITE_RANGE}return 0},xRowid:function(se,pe){const be=$(se);return j.xRowid(pe,be.rowid),0},xEof:function(se){const pe=$(se);return ie("xEof?="+!pe.row(),...arguments),!pe.row()},xFilter:function(se,pe,be,we,me){return $(se,!0),0},xBestIndex:function(se,pe){const be=new t.sqlite3_index_info(pe);return be.$estimatedRows=q.storagePool.size,be.$estimatedCost=1,be.dispose(),0}}})};i.kvvfs.create_module=function(ue,se="sqlite_kvvfs"){return t.sqlite3_create_module(ue,se,oe(),b.ptr.null)}}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(i){if(i.config.disable?.vfs?.opfs&&i.config.disable.vfs["opfs-vfs"])return;const t=i.util.toss;i.capi;const r=i.util;i.wasm;const s=i.opfs=Object.create(null);s.thisThreadHasOPFS=()=>globalThis.FileSystemHandle&&globalThis.FileSystemDirectoryHandle&&globalThis.FileSystemFileHandle&&globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle&&navigator?.storage?.getDirectory,s.getRootDir=async function c(){return c.promise??=navigator.storage.getDirectory().then(b=>(s.rootDirectory=b,b)).catch(b=>{throw delete c.promise,b})},s.getResolvedPath=function(c,b){const z=new URL(c,"file://irrelevant").pathname;return b?z.split("/").filter(I=>!!I):z},s.getDirForFilename=async function(b,z=!1){const I=s.getResolvedPath(b,!0),q=I.pop();let w=await s.getRootDir();for(const x of I)x&&(w=await w.getDirectoryHandle(x,{create:!!z}));return[w,q]},s.mkdir=async function(c){try{return await s.getDirForFilename(c+"/filepart",!0),!0}catch{return!1}},s.entryExists=async function(c){try{const[b,z]=await s.getDirForFilename(c);return await b.getFileHandle(z),!0}catch{return!1}},s.randomFilename=function c(b=16){c._chars||(c._chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012346789",c._n=c._chars.length);const z=[];let I=0;for(;I<b;++I){const q=Math.random()*(c._n*64)%c._n|0;z[I]=c._chars[q]}return z.join("")},s.treeList=async function(){const c=async function z(I,q){q.name=I.name,q.dirs=[],q.files=[];for await(const w of I.values())if(w.kind==="directory"){const x=Object.create(null);q.dirs.push(x),await z(w,x)}else q.files.push(w.name)},b=Object.create(null);return await c(await s.getRootDir(),b),b},s.rmfr=async function(){const c=await s.getRootDir(),b={recurse:!0};for await(const z of c.values())c.removeEntry(z.name,b)},s.unlink=async function(c,b=!1,z=!1){try{const[I,q]=await s.getDirForFilename(c,!1);return await I.removeEntry(q,{recursive:b}),!0}
2catch(I){if(z)throw new Error("unlink(",arguments[0],") failed: "+I.message,{cause:I});return!1}},s.traverse=async function(c){const b={recursive:!0,directory:await s.getRootDir()};typeof c=="function"&&(c={callback:c}),c=Object.assign(b,c||{}),(async function z(I,q){for await(const w of I.values()){if(c.callback(w,I,q)===!1)return!1;if(c.recursive&&w.kind==="directory"&&await z(w,q+1)===!1)break}})(c.directory,0)};const _=async function(c,b){const[z,I]=await s.getDirForFilename(c,!0);let q=await(await z.getFileHandle(I,{create:!0})).createSyncAccessHandle(),w=0,x,L=!1;try{for(q.truncate(0);(x=await b())!==void 0;)x instanceof ArrayBuffer&&(x=new Uint8Array(x)),!L&&w===0&&x.byteLength>=15&&(r.affirmDbHeader(x),L=!0),q.write(x,{at:w}),w+=x.byteLength;if((w<512||w%512!==0)&&t("Input size",w,"is not correct for an SQLite database."),!L){const H=new Uint8Array(20);q.read(H,{at:0}),r.affirmDbHeader(H)}return q.write(new Uint8Array([1,1]),{at:18}),w}catch(H){throw await q.close(),q=void 0,await z.removeEntry(I).catch(()=>{}),H}finally{q&&await q.close()}};s.importDb=async function(c,b){if(b instanceof Function)return _(c,b);b instanceof ArrayBuffer&&(b=new Uint8Array(b)),r.affirmIsDb(b);const z=b.byteLength,[I,q]=await s.getDirForFilename(c,!0);let w,x=0;try{return w=await(await I.getFileHandle(q,{create:!0})).createSyncAccessHandle(),w.truncate(0),x=w.write(b,{at:0}),x!=z&&t("Expected to write "+z+" bytes but wrote "+x+"."),w.write(new Uint8Array([1,1]),{at:18}),x}catch(L){throw w&&(await w.close(),w=void 0),await I.removeEntry(q).catch(()=>{}),L}finally{w&&await w.close()}},s.vfsInstallationFeatureCheck=function(c){!globalThis.SharedArrayBuffer||!globalThis.Atomics?t("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"):typeof WorkerGlobalScope>"u"?t("The OPFS sqlite3_vfs cannot run in the main thread","because it requires Atomics.wait()."):!globalThis.FileSystemHandle||!globalThis.FileSystemDirectoryHandle||!globalThis.FileSystemFileHandle?.prototype?.createSyncAccessHandle||!navigator?.storage?.getDirectory?t("Missing required OPFS APIs."):c==="opfs-wl"&&!globalThis.Atomics.waitAsync&&t("The",c,"VFS requires Atomics.waitAsync(), which is not available.")},s.initOptions=function(b,z){const I=new URL(globalThis.location.href).searchParams;if(!I.has(b+"-disable")){try{s.vfsInstallationFeatureCheck(b)}catch{return}return z=r.nu(z),z.vfsName=b,z.verbose??=I.has("opfs-verbose")?+I.get("opfs-verbose"):1,z.sanityChecks??=I.has("opfs-sanity-check"),s.proxyUri||(s.proxyUri="sqlite3-opfs-async-proxy.js",i.scriptInfo?.sqlite3Dir&&(s.proxyUri=i.scriptInfo.sqlite3Dir+s.proxyUri)),z.proxyUri??=s.proxyUri,typeof z.proxyUri=="function"&&(z.proxyUri=z.proxyUri()),s.options=z}},s.createVfsState=function(){const c=r.nu(),b=s.options;c.verbose=b.verbose;const z=[i.config.error,i.config.warn,i.config.log],I=b.vfsName||t("Maintenance required: missing VFS name"),q=(P,...X)=>{c.verbose>P&&z[P](I+":",...X)},w=(...P)=>q(2,...P),x=(...P)=>q(1,...P),L=(...P)=>q(0,...P),H=i.capi,g=i.wasm,h=c.vfs=new H.sqlite3_vfs,D=h.ioMethods=new H.sqlite3_io_methods;D.$iVersion=1,h.$iVersion=2,h.$szOsFile=H.sqlite3_file.structInfo.sizeof,h.$mxPathname=1024,h.$zName=g.allocCString(I),h.addOnDispose("$zName",h.$zName,D),h.metrics=r.nu({counters:r.nu(),dump:function(){let P,X=0,ee=0,Z=0;for(P in c.opIds){const ne=U[P];X+=ne.count,ee+=ne.time,Z+=ne.wait,ne.avgTime=ne.count&&ne.time?ne.time/ne.count:0,ne.avgWait=ne.count&&ne.wait?ne.wait/ne.count:0}i.config.log(globalThis.location.href,"metrics for",globalThis.location.href,":",U,`
3Total of`,X,"op(s) for",ee,"ms (incl. "+Z+" ms of waiting on the async side)"),i.config.log("Serialization metrics:",h.metrics.counters.s11n),h.worker?.postMessage?.({type:"opfs-async-metrics"})},reset:function(){let P;const X=ne=>ne.count=ne.time=ne.wait=0,ee=h.metrics.counters;for(P in c.opIds)X(ee[P]=Object.create(null));let Z=ee.s11n=Object.create(null);Z=Z.serialize=Object.create(null),Z.count=Z.time=0,Z=ee.s11n.deserialize=Object.create(null),Z.count=Z.time=0}}),c.asyncIdleWaitTime=150,c.asyncS11nExceptions=1,c.fileBufferSize=1024*64,c.sabS11nOffset=c.fileBufferSize,c.sabS11nSize=h.$mxPathname*2,c.sabIO=new SharedArrayBuffer(c.fileBufferSize+c.sabS11nSize),c.opIds=Object.create(null);{let P=0;c.opIds.whichOp=P++,c.opIds.rc=P++,c.opIds.xAccess=P++,c.opIds.xClose=P++,c.opIds.xDelete=P++,c.opIds.xDeleteNoWait=P++,c.opIds.xFileSize=P++,c.opIds.xLock=P++,c.opIds.xOpen=P++,c.opIds.xRead=P++,c.opIds.xSleep=P++,c.opIds.xSync=P++,c.opIds.xTruncate=P++,c.opIds.xUnlock=P++,c.opIds.xWrite=P++,c.opIds.mkdir=P++,c.opIds["opfs-async-metrics"]=P++,c.opIds["opfs-async-shutdown"]=P++,c.opIds.retry=P++,c.sabOP=new SharedArrayBuffer(P*4)}c.sq3Codes=Object.create(null);for(const P of["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_P
3ENDING","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","SQLITE_LOCK_NONE","SQLITE_LOCK_SHARED","SQLITE_LOCK_RESERVED","SQLITE_LOCK_PENDING","SQLITE_LOCK_EXCLUSIVE"])c.sq3Codes[P]=H[P]??t("Maintenance required: not found:",P);c.opfsFlags=Object.assign(Object.create(null),{OPFS_UNLOCK_ASAP:1,OPFS_UNLINK_BEFORE_OPEN:2,defaultUnlockAsap:!1}),h.metrics.reset();const U=h.metrics.counters,A=h.opRun=(P,...X)=>{const ee=c.opIds[P]||t(h.vfsName+": Invalid op ID:",P);c.s11n.serialize(...X),Atomics.store(c.sabOPView,c.opIds.rc,-1),Atomics.store(c.sabOPView,c.opIds.whichOp,ee),Atomics.notify(c.sabOPView,c.opIds.whichOp);const Z=performance.now();for(;Atomics.wait(c.sabOPView,c.opIds.rc,-1)!=="not-equal";);const ne=Atomics.load(c.sabOPView,c.opIds.rc);if(U[P].wait+=performance.now()-Z,ne&&c.asyncS11nExceptions){const E=c.s11n.deserialize();E&&L(P+"() async error:",...E)}return ne},N=Object.create(null);N.op=void 0,N.start=void 0;const K=h.mTimeStart=P=>{N.start=performance.now(),N.op=P,++U[P].count},d=h.mTimeEnd=()=>U[N.op].time+=performance.now()-N.start,y=h.__openFiles=Object.create(null);h.ioSyncWrappers=r.nu({xCheckReservedLock:function(P,X){return g.poke(X,0,"i32"),0},xClose:function(P){K("xClose");let X=0;const ee=y[P];return ee&&(delete y[P],X=A("xClose",P),ee.sq3File&&ee.sq3File.dispose()),d(),X},xDeviceCharacteristics:function(P){return H.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN},xFileControl:function(P,X,ee){return H.SQLITE_NOTFOUND},xFileSize:function(P,X){K("xFileSize");let ee=A("xFileSize",P);if(ee==0)try{const Z=c.s11n.deserialize()[0];g.poke(X,Z,"i64")}catch(Z){L("Unexpected error reading xFileSize() result:",Z),ee=c.sq3Codes.SQLITE_IOERR}return d(),ee},xRead:function(P,X,ee,Z){K("xRead");const ne=y[P];let E;try{E=A("xRead",P,ee,Number(Z)),(E===0||H.SQLITE_IOERR_SHORT_READ===E)&&g.heap8u().set(ne.sabView.subarray(0,ee),Number(X))}catch(o){L("xRead(",arguments,") failed:",o,ne),E=H.SQLITE_IOERR_READ}return d(),E},xSync:function(P,X){K("xSync");const ee=A("xSync",P,X);return d(),ee},xTruncate:function(P,X){K("xTruncate");const ee=A("xTruncate",P,Number(X));return d(),ee},xWrite:function(P,X,ee,Z){K("xWrite");const ne=y[P];let E;try{ne.sabView.set(g.heap8u().subarray(Number(X),Number(X)+ee)),E=A("xWrite",P,ee,Number(Z))}catch(o){L("xWrite(",arguments,") failed:",o,ne),E=H.SQLITE_IOERR_WRITE}return d(),E}}),h.vfsSyncWrappers={xAccess:function(P,X,ee,Z){K("xAccess");const ne=A("xAccess",g.cstrToJs(X));return g.poke(Z,ne?0:1,"i32"),d(),0},xCurrentTime:function(P,X){return g.poke(X,24405875e-1+new Date().getTime()/864e5,"double"),0},xCurrentTimeInt64:function(P,X){return g.poke(X,24405875e-1*864e5+new Date().getTime(),"i64"),0},xDelete:function(P,X,ee){K("xDelete");const Z=A("xDelete",g.cstrToJs(X),ee,!1);return d(),Z},xFullPathname:function(P,X,ee,Z){return g.cstrncpy(Z,X,ee)<ee?0:H.SQLITE_CANTOPEN},xGetLastError:function(P,X,ee){return i.config.warn("OPFS xGetLastError() has nothing sensible to return."),0},xOpen:function(X,ee,Z,ne,E){K("xOpen");let o=0,u,p;if(!ee)u=s.randomFilename(),ee=p=g.allocCString(u);else if(g.isPtr(ee))H.sqlite3_uri_boolean(ee,"opfs-unlock-asap",0)&&(o|=c.opfsFlags.OPFS_UNLOCK_ASAP),H.sqlite3_uri_boolean(ee,"delete-before-open",0)&&(o|=c.opfsFlags.OPFS_UNLINK_BEFORE_OPEN),u=g.cstrToJs(ee);else return i.config.error("Impossible zName value in xOpen?",ee),H.SQLITE_CANTOPEN;const S=r.nu({fid:Z,filename:u,sab:new SharedArrayBuffer(c.fileBufferSize),flags:ne,readOnly:!(H.SQLITE_OPEN_CREATE&ne)&&!!(ne&H.SQLITE_OPEN_READONLY)}),M=A("xOpen",Z,u,ne,o);return M?p&&g.dealloc(p):(S.readOnly&&g.poke(E,H.SQLITE_OPEN_READONLY,"i32"),y[Z]=S,S.sabView=c.sabFileBufView,S.sq3File=new H.sqlite3_file(Z),p&&S.sq3File.addOnDispose(p),S.sq3File.$pMethods=D.pointer,S.lockType=H.SQLITE_LOCK_NONE),d(),M}};const F=H.sqlite3_vfs_find(null);if(F){const P=new H.sqlite3_vfs(F);h.$xRandomness=P.$xRandomness,h.$xSleep=P.$xSleep,P.dispose()}h.$xRandomness||(h.vfsSyncWrappers.xRandomness=function(P,X,ee){const Z=g.heap8u();let ne=0;const E=Number(ee);for(;ne<X;++ne)Z[E+ne]=Math.random()*255e3&255;return ne}),h.$xSleep||(h.vfsSyncWrappers.xSleep=function(P,X){return K("xSleep"),Atomics.wait(c.sabOPView,c.opIds.xSleep,0,X),d(),0});const W=function(){if(c.s11n)return c.s11n;const P=new TextDecoder,X=new TextEncoder("utf-8"),ee=new Uint8Array(c.sabIO,c.sabS11nOffset,c.sabS11nSize),Z=new DataView(c.sabIO,c.sabS11nOffset,c.sabS11nSize);c.s11n=Object.create(null);const ne=Object.create(null);ne.number={id:1,size:8,getter:"getFloat64",setter:"setFloat64"},ne.bigint={id:2,size:8,getter:"getBigInt64",setter:"setBigInt64"},ne.boolean={id:3,size:4,getter:"getInt32",setter:"setInt32"},ne.string={id:4};const E=u=>ne[typeof u]||t("Maintenance required: this value type cannot be serialized.",u),o=u=>{switch(u){case ne.number.id:return ne.number;case ne.bigint.id:return ne.bigint;case ne.boolean.id:return ne.boolean;case ne.string.id:return ne.string;default:t("Invalid type ID:",u)}};return c.s11n.deserialize=function(u=!1){performance.now();const p=ee[0],S=p?[]:null;if(p){const M=[];let V=1,R,m,C;for(R=0;R<p;++R,++V)M.push(o(ee[V]));for(R=0;R<p;++R){const B=M[R];B.getter?(C=Z[B.getter](V,c.littleEndian),V+=B.size):(m=Z.getInt32(V,c.littleEndian),V+=4,C=P.decode(ee.slice(V,V+m)),V+=m),S.push(C)}}return u&&(ee[0]=0),S},c.s11n.serialize=function(...u){if(performance.now(),u.length){const p=[];let S=0,M=1;for(ee[0]=u.length&255;S<u.length;++S,++M)p.push(E(u[S])),ee[M]=p[S].id;for(S=0;S<u.length;++S){const V=p[S];if(V.setter)Z[V.setter](M,u[S],c.littleEndian),M+=V.size;else{const R=X.encode(u[S]);Z.setInt32(M,R.byteLength,c.littleEndian),M+=4,ee.set(R,M),M+=R.byteLength}}}else ee[0]=0},c.s11n};return h.initS11n=W,h.bindVfs=function(P,X){return Object.assign(h.ioSyncWrappers,P),new Promise(function(ee,Z){let ne;const E=R=>(ne=!0,h.dispose(),Z(R)),o=()=>{try{X(i,h)}catch(R){return E(R)}return ne=!1,ee(i)},u=s.options;u.proxyUri+(u.proxyUri.indexOf("?")<0?"?":"&")+I;const p=new URL(""+new URL("sqlite3-opfs-async-proxy.D_xnb1D8.js",import.meta.url).href,import.meta.url);p.searchParams.set("vfs",I);const S=h.worker=new Worker(p.toString());let M=setTimeout(()=>{ne===void 0&&E(new Error("Timeout while waiting for OPFS async proxy worker."))},4e3);S._originalOnError=S.onerror,S.onerror=function(R){L("Error initializing OPFS asyncer:",R),E(new Error("Loading OPFS async Worker failed for unknown reasons."))},h.opRun;const V=function(){const R=g.scopedAllocPush(),m=new H.sqlite3_file;try{const C=m.pointer,B=H.SQLITE_OPEN_CREATE|H.SQLITE_OPEN_READWRITE|H.SQLITE_OPEN_MAIN_DB,Y=g.scopedAlloc(8),te="/sanity/check/file"+randomFilename(8),le=g.scopedAllocCString(te);let ae;if(c.s11n.serialize("This is ä string."),ae=c.s11n.deserialize(),w("deserialize() says:",ae),ae[0]!=="This is ä string."&&t("String d13n error."),h.vfsSyncWrappers.xAccess(h.pointer,le,0,Y),ae=g.peek(Y,"i32"),w("xAccess(",te,") exists ?=",ae),ae=h.vfsSyncWrappers.xOpen(h.pointer,le,C,B,Y),w("open rc =",ae,"state.sabOPView[xOpen] =",c.sabOPView[c.opIds.xOpen]),ae!==0){L("open failed with code",ae);return}h.vfsSyncWrappers.xAccess(h.pointer,le,0,Y),ae=g.peek(Y,"i32"),ae||t("xAccess() failed to detect file."),ae=h.ioSyncWrappers.xSync(m.pointer,0),ae&&t("sync failed w/ rc",ae),ae=h.ioSyncWrappers.xTruncate(m.pointer,1024),ae&&t("truncate failed w/ rc",ae),g.poke(Y,0,"i64"),ae=h.ioSyncWrappers.xFileSize(m.pointer,Y),ae&&t("xFileSize failed w/ rc",ae),w("xFileSize says:",g.peek(Y,"i64")),ae=h.ioSyncWrappers.xWrite(m.pointer,le,10,1),ae&&t("xWrite() failed!");const ye=g.scopedAlloc(16);ae=h.ioSyncWrappers.xRead(m.pointer,ye,6,2),g.poke(ye+6,0);let ke=g.cstrToJs(ye);w("xRead() got:",ke),ke!=="sanity"&&t("Unexpected xRead() value."),h.vfsSyncWrappers.xSleep&&(w("xSleep()ing before close()ing..."),h.vfsSyncWrappers.xSleep(h.pointer,2e3),w("waking up from xSleep()")),ae=h.ioSyncWrappers.xClose(C),w("xClose rc =",ae,"sabOPView =",c.sabOPView),w("Deleting file:",te),h.vfsSyncWrappers.xDelete(h.pointer,le,4660),h.vfsSyncWrappers.xAccess(h.pointer,le,0,Y),ae=g.peek(Y,"i32"),ae&&t("Expecting 0 from xAccess(",te,") after xDelete()."),x("End of OPFS sanity checks.")}finally{m.dispose(),g.scopedAllocPop(R)}};S.onmessage=function({data:R}){switch(R.type){case"opfs-unavailable":E(new Error(R.payload.join(" ")));break;case"opfs-async-loaded":delete c.vfs,S.postMessage({type:"opfs-async-init",args:r.nu(c)});break;case"opfs-async-inited":if(ne===!0)break;
3clearTimeout(M),M=null;try{i.vfs.installVfs({io:{struct:h.ioMethods,methods:h.ioSyncWrappers},vfs:{struct:h,methods:h.vfsSyncWrappers}}),c.sabOPView=new Int32Array(c.sabOP),c.sabFileBufView=new Uint8Array(c.sabIO,0,c.fileBufferSize),c.sabS11nView=new Uint8Array(c.sabIO,c.sabS11nOffset,c.sabS11nSize),h.initS11n(),delete h.initS11n,u.sanityChecks&&(x("Running sanity checks because of opfs-sanity-check URL arg..."),V()),s.thisThreadHasOPFS()?s.getRootDir().then(m=>{S.onerror=S._originalOnError,delete S._originalOnError,w("End of OPFS sqlite3_vfs setup.",h),o()}).catch(E):o()}catch(m){L(m),E(m)}break;case"debug":x("debug message from worker:",R);break;default:{const m="Unexpected message from the OPFS async worker: "+JSON.stringify(R);L(m),E(new Error(m));break}}}})},c}}),globalThis.sqlite3ApiBootstrap.initializers.push(function(i){if(!i.opfs||i.config.disable?.vfs?.opfs)return;const t=i.util,r=i.opfs||i.util.toss("Missing sqlite3.opfs"),s=async function(_){if(_=r.initOptions("opfs",_),!_)return i;const c=i.capi,b=r.createVfsState().vfs,z=b.metrics.counters,I=b.mTimeStart,q=b.mTimeEnd,w=b.opRun,x=b.__openFiles;return b.bindVfs(t.nu({xLock:function(L,H){I("xLock"),++z.xLock.count;const g=x[L];let h=0;return g.lockType?g.lockType=H:(h=w("xLock",L,H),h===0&&(g.lockType=H)),q(),h},xUnlock:function(L,H){I("xUnlock"),++z.xUnlock.count;const g=x[L];let h=0;return c.SQLITE_LOCK_NONE===H&&g.lockType&&(h=w("xUnlock",L,H)),h===0&&(g.lockType=H),q(),h}}),function(L,H){if(L.oo1){const g=function(...h){const D=L.oo1.DB.dbCtorHelper.normalizeArgs(...h);D.vfs=H.$zName,L.oo1.DB.dbCtorHelper.call(this,D)};g.prototype=Object.create(L.oo1.DB.prototype),L.oo1.OpfsDb=g,g.importDb=r.importDb,L.oo1.DB.dbCtorHelper.setVfsPostOpenCallback(b.pointer,function(h,D){D.capi.sqlite3_busy_timeout(h,1e4)})}})};globalThis.sqlite3ApiBootstrap.initializersAsync.push(async _=>s().catch(c=>{_.config.warn("Ignoring inability to install 'opfs' sqlite3_vfs:",c)}))}),globalThis.sqlite3ApiBootstrap.initializers.push(function(i){if(i.config.disable?.vfs?.["opfs-sahpool"])return;const t=i.util.toss,r=i.util.toss3,s=Object.create(null),_=i.capi,c=i.util,b=i.wasm,z=4096,I=512,q=4,w=8,x=I+q,L=I,H=x,g=z,h=_.SQLITE_OPEN_MAIN_DB|_.SQLITE_OPEN_MAIN_JOURNAL|_.SQLITE_OPEN_SUPER_JOURNAL|_.SQLITE_OPEN_WAL,D=_.SQLITE_OPEN_MEMORY,U=".opaque",A=()=>Math.random().toString(36).slice(2),N=new TextDecoder,K=new TextEncoder,d=Object.assign(Object.create(null),{name:"opfs-sahpool",directory:void 0,initialCapacity:6,clearOnInit:!1,verbosity:2,forceReinitIfPreviouslyFailed:!1}),y=[i.config.error,i.config.warn,i.config.log];i.config.log;const F=i.config.warn;i.config.error;const W=new Map,P=R=>W.get(R),X=(R,m)=>{m?W.set(R,m):W.delete(R)},ee=new Map,Z=R=>ee.get(R),ne=(R,m)=>{m?ee.set(R,m):ee.delete(R)},E={xCheckReservedLock:function(R,m){const C=Z(R);return C.log("xCheckReservedLock"),C.storeErr(),b.poke32(m,1),0},xClose:function(R){const m=Z(R);m.storeErr();const C=m.getOFileForS3File(R);if(C)try{m.log(`xClose ${C.path}`),m.mapS3FileToOFile(R,!1),C.sah.flush(),C.flags&_.SQLITE_OPEN_DELETEONCLOSE&&m.deletePath(C.path)}catch(B){return m.storeErr(B,_.SQLITE_IOERR)}return 0},xDeviceCharacteristics:function(R){return _.SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN},xFileControl:function(R,m,C){return _.SQLITE_NOTFOUND},xFileSize:function(R,m){const C=Z(R);C.log("xFileSize");const B=C.getOFileForS3File(R).sah.getSize()-g;return b.poke64(m,BigInt(B)),0},xLock:function(R,m){const C=Z(R);C.log(`xLock ${m}`),C.storeErr();const B=C.getOFileForS3File(R);return B.lockType=m,0},xRead:function(R,m,C,B){const Y=Z(R);Y.storeErr();const te=Y.getOFileForS3File(R);Y.log(`xRead ${te.path} ${C} @ ${B}`);try{const le=te.sah.read(b.heap8u().subarray(Number(m),Number(m)+C),{at:g+Number(B)});return le<C?(b.heap8u().fill(0,Number(m)+le,Number(m)+C),_.SQLITE_IOERR_SHORT_READ):0}catch(le){return Y.storeErr(le,_.SQLITE_IOERR)}},xSectorSize:function(R){return z},xSync:function(R,m){const C=Z(R);C.log(`xSync ${m}`),C.storeErr();const B=C.getOFileForS3File(R);try{return B.sah.flush(),0}catch(Y){return C.storeErr(Y,_.SQLITE_IOERR)}},xTruncate:function(R,m){const C=Z(R);C.log(`xTruncate ${m}`),C.storeErr();const B=C.getOFileForS3File(R);try{return B.sah.truncate(g+Number(m)),0}catch(Y){return C.storeErr(Y,_.SQLITE_IOERR)}},xUnlock:function(R,m){const C=Z(R);C.log("xUnlock");const B=C.getOFileForS3File(R);return B.lockType=m,0},xWrite:function(R,m,C,B){const Y=Z(R);Y.storeErr();const te=Y.getOFileForS3File(R);Y.log(`xWrite ${te.path} ${C} ${B}`);
3try{return C===te.sah.write(b.heap8u().subarray(Number(m),Number(m)+C),{at:g+Number(B)})?0:t("Unknown write() failure.")}catch(le){return Y.storeErr(le,_.SQLITE_IOERR)}}},o=new _.sqlite3_io_methods;o.$iVersion=1,i.vfs.installVfs({io:{struct:o,methods:E}});const u={xAccess:function(R,m,C,B){const Y=P(R);Y.storeErr();try{const te=Y.getPath(m);b.poke32(B,Y.hasFilename(te)?1:0)}catch{b.poke32(B,0)}return 0},xCurrentTime:function(R,m){return b.poke(m,24405875e-1+new Date().getTime()/864e5,"double"),0},xCurrentTimeInt64:function(R,m){return b.poke(m,24405875e-1*864e5+new Date().getTime(),"i64"),0},xDelete:function(R,m,C){const B=P(R);B.log(`xDelete ${b.cstrToJs(m)}`),B.storeErr();try{return B.deletePath(B.getPath(m)),0}catch(Y){return B.storeErr(Y),_.SQLITE_IOERR_DELETE}},xFullPathname:function(R,m,C,B){return b.cstrncpy(B,m,C)<C?0:_.SQLITE_CANTOPEN},xGetLastError:function(R,m,C){const B=P(R),Y=B.popErr();if(B.log(`xGetLastError ${m} e =`,Y),Y){const te=b.scopedAllocPush();try{const[le,ae]=b.scopedAllocCString(Y.message,!0);b.cstrncpy(C,le,m),ae>m&&b.poke8(b.ptr.add(C,m,-1),0)}catch{return _.SQLITE_NOMEM}finally{b.scopedAllocPop(te)}}return Y?Y.sqlite3Rc||_.SQLITE_IOERR:0},xOpen:function(m,C,B,Y,te){const le=P(m);try{Y&=~D,le.log(`xOpen ${b.cstrToJs(C)} ${Y}`);const ae=C&&b.peek8(C)?le.getPath(C):A();let ye=le.getSAHForPath(ae);!ye&&Y&_.SQLITE_OPEN_CREATE&&(le.getFileCount()<le.getCapacity()?(ye=le.nextAvailableSAH(),le.setAssociatedPath(ye,ae,Y)):t("SAH pool is full. Cannot create file",ae)),ye||t("file not found:",ae);const ke={path:ae,flags:Y,sah:ye};le.mapS3FileToOFile(B,ke),ke.lockType=_.SQLITE_LOCK_NONE;const We=new _.sqlite3_file(B);return We.$pMethods=o.pointer,We.dispose(),b.poke32(te,Y),0}catch(ae){return le.storeErr(ae),_.SQLITE_CANTOPEN}}},p=function(R){i.capi.sqlite3_vfs_find(R)&&r("VFS name is already registered:",R);const m=new _.sqlite3_vfs,C=_.sqlite3_vfs_find(null),B=C?new _.sqlite3_vfs(C):null;return m.$iVersion=2,m.$szOsFile=_.sqlite3_file.structInfo.sizeof,m.$mxPathname=I,m.addOnDispose(m.$zName=b.allocCString(R),()=>X(m.pointer,0)),B&&(m.$xRandomness=B.$xRandomness,m.$xSleep=B.$xSleep,B.dispose()),!m.$xRandomness&&!u.xRandomness&&(u.xRandomness=function(Y,te,le){const ae=b.heap8u();let ye=0;const ke=Number(le);for(;ye<te;++ye)ae[ke+ye]=Math.random()*255e3&255;return ye}),!m.$xSleep&&!u.xSleep&&(u.xSleep=(Y,te)=>0),i.vfs.installVfs({vfs:{struct:m,methods:u}}),m};class S{vfsDir;#e;#i;#s;#t=new Map;#n=new Map;#o=new Set;#a=new Map;#r=new Uint8Array(x);#c;#l;#_;constructor(m=Object.create(null)){this.#_=m.verbosity??d.verbosity,this.vfsName=m.name||d.name,this.#l=p(this.vfsName),X(this.#l.pointer,this),this.vfsDir=m.directory||"."+this.vfsName,this.#c=new DataView(this.#r.buffer,this.#r.byteOffset),this.isReady=this.reset(!!(m.clearOnInit??d.clearOnInit)).then(()=>{if(this.$error)throw this.$error;return this.getCapacity()?Promise.resolve(void 0):this.addCapacity(m.initialCapacity||d.initialCapacity)})}#u(m,...C){this.#_>m&&y[m](this.vfsName+":",...C)}log(...m){this.#u(2,...m)}warn(...m){this.#u(1,...m)}error(...m){this.#u(0,...m)}getVfs(){return this.#l}getCapacity(){return this.#t.size}getFileCount(){return this.#n.size}getFileNames(){const m=[];for(const C of this.#n.keys())m.push(C);return m}async addCapacity(m){for(let C=0;C<m;++C){const B=A(),Y=await(await this.#i.getFileHandle(B,{create:!0})).createSyncAccessHandle();this.#t.set(Y,B),this.setAssociatedPath(Y,"",0)}return this.getCapacity()}async reduceCapacity(m){let C=0;for(const B of Array.from(this.#o)){if(C===m||this.getFileCount()===this.getCapacity())break;const Y=this.#t.get(B);B.close(),await this.#i.removeEntry(Y),this.#t.delete(B),this.#o.delete(B),++C}return C}releaseAccessHandles(){for(const m of this.#t.keys())m.close();this.#t.clear(),this.#n.clear(),this.#o.clear()}async acquireAccessHandles(m=!1){const C=[];for await(const[B,Y]of this.#i)Y.kind==="file"&&C.push([B,Y]);return Promise.all(C.map(async([B,Y])=>{try{const te=await Y.createSyncAccessHandle();if(this.#t.set(te,B),m)te.truncate(g),this.setAssociatedPath(te,"",0);else{const le=this.getAssociatedPath(te);le?this.#n.set(le,te):this.#o.add(te)}}catch(te){throw this.storeErr(te),this.releaseAccessHandles(),te}}))}getAssociatedPath(m){m.read(this.#r,{at:0});const C=this.#c.getUint32(L);if(this.#r[0]&&(C&_.SQLITE_OPEN_DELETEONCLOSE||(C&h)===0))return F(`Removing file with unexpected flags ${C.toString(16)}`,this.#r),this.setAssociatedPath(m,"",0),"";const B=new Uint32Array(w/4);m.read(B,{at:H});const Y=this.computeDigest(this.#r,C);if(B.every((te,le)=>te===Y[le])){const te=this.#r.findIndex(le=>le===0);return te===0&&m.truncate(g),te?N.decode(this.#r.subarray(0,te)):""}else return F("Disassociating file with bad digest."),this.setAssociatedPath(m,"",0),""}setAssociatedPath(m,C,B){const Y=K.encodeInto(C,this.#r);I<=Y.written+1&&t("Path too long:",C),C&&B&&(B|=D),this.#r.fill(0,Y.written,I),this.#c.setUint32(L,B);const te=this.computeDigest(this.#r,B);m.write(this.#r,{at:0}),m.write(te,{at:H}),m.flush(),C?(this.#n.set(C,m),this.#o.delete(m)):(m.truncate(g),this.#o.add(m))}computeDigest(m,C){if(C&D){let B=3735928559,Y=1103547991;for(const te of m)B=Math.imul(B^te,2654435761),Y=Math.imul(Y^te,104729);return new Uint32Array([B>>>0,Y>>>0])}else return new Uint32Array([0,0])}async reset(m){await this.isReady;let C=await navigator.storage.getDirectory(),B;for(const Y of this.vfsDir.split("/"))Y&&(B=C,C=await C.getDirectoryHandle(Y,{create:!0}));return this.#e=C,this.#s=B,this.#i=await this.#e.getDirectoryHandle(U,{create:!0}),this.releaseAccessHandles(),this.acquireAccessHandles(m)}getPath(m){return b.isPtr(m)&&(m=b.cstrToJs(m)),(m instanceof URL?m:new URL(m,"file://localhost/")).pathname}deletePath(m){const C=this.#n.get(m);return C&&(this.#n.delete(m),this.setAssociatedPath(C,"",0)),!!C}storeErr(m,C){return m&&(m.sqlite3Rc=C||_.SQLITE_IOERR,this.error(m)),this.$error=m,C}popErr(){const m=this.$error;return this.$error=void 0,m}nextAvailableSAH(){const[m]=this.#o.keys();return m}getOFileForS3File(m){return this.#a.get(m)}mapS3FileToOFile(m,C){C?(this.#a.set(m,C),ne(m,this)):(this.#a.delete(m),ne(m,!1))}hasFilename(m){return this.#n.has(m)}getSAHForPath(m){return this.#n.get(m)}async removeVfs(){if(!this.#l.pointer||!this.#i)return!1;
3_.sqlite3_vfs_unregister(this.#l.pointer),this.#l.dispose(),delete s[this.vfsName];try{this.releaseAccessHandles(),await this.#e.removeEntry(U,{recursive:!0}),this.#i=void 0,await this.#s.removeEntry(this.#e.name,{recursive:!0}),this.#e=this.#s=void 0}catch(m){i.config.error(this.vfsName,"removeVfs() failed with no recovery strategy:",m)}return!0}pauseVfs(){return this.#a.size>0&&i.SQLite3Error.toss(_.SQLITE_MISUSE,"Cannot pause VFS",this.vfsName,"because it has opened files."),this.#t.size>0&&(_.sqlite3_vfs_unregister(this.vfsName),this.releaseAccessHandles()),this}isPaused(){return this.#t.size===0}async unpauseVfs(){return this.#t.size===0?this.acquireAccessHandles(!1).then(()=>_.sqlite3_vfs_register(this.#l,0),this):this}exportFile(m){const C=this.#n.get(m)||t("File not found:",m),B=C.getSize()-g,Y=new Uint8Array(B>0?B:0);if(B>0){const te=C.read(Y,{at:g});te!=B&&t("Expected to read "+B+" bytes but read "+te+".")}return Y}async importDbChunked(m,C){const B=this.#n.get(m)||this.nextAvailableSAH()||t("No available handles to import to.");B.truncate(0);let Y=0,te,le=!1;try{for(;(te=await C())!==void 0;)te instanceof ArrayBuffer&&(te=new Uint8Array(te)),!le&&Y===0&&te.byteLength>=15&&(c.affirmDbHeader(te),le=!0),B.write(te,{at:g+Y}),Y+=te.byteLength;if((Y<512||Y%512!==0)&&t("Input size",Y,"is not correct for an SQLite database."),!le){const ae=new Uint8Array(20);B.read(ae,{at:0}),c.affirmDbHeader(ae)}B.write(new Uint8Array([1,1]),{at:g+18})}catch(ae){throw this.setAssociatedPath(B,"",0),ae}return this.setAssociatedPath(B,m,_.SQLITE_OPEN_MAIN_DB),Y}importDb(m,C){if(C instanceof ArrayBuffer)C=new Uint8Array(C);else if(C instanceof Function)return this.importDbChunked(m,C);const B=this.#n.get(m)||this.nextAvailableSAH()||t("No available handles to import to."),Y=C.byteLength;(Y<512||Y%512!=0)&&t("Byte array size is invalid for an SQLite db.");const te="SQLite format 3";for(let ae=0;ae<15;++ae)te.charCodeAt(ae)!==C[ae]&&t("Input does not contain an SQLite database header.");const le=B.write(C,{at:g});return le!=Y?(this.setAssociatedPath(B,"",0),t("Expected to write "+Y+" bytes but wrote "+le+".")):(B.write(new Uint8Array([1,1]),{at:g+18}),this.setAssociatedPath(B,m,_.SQLITE_OPEN_MAIN_DB)),le}}class M{#e;constructor(m){this.#e=m,this.vfsName=m.vfsName}async addCapacity(m){return this.#e.addCapacity(m)}async reduceCapacity(m){return this.#e.reduceCapacity(m)}getCapacity(){return this.#e.getCapacity(this.#e)}getFileCount(){return this.#e.getFileCount()}getFileNames(){return this.#e.getFileNames()}async reserveMinimumCapacity(m){const C=this.#e.getCapacity();return C<m?this.#e.addCapacity(m-C):C}exportFile(m){return this.#e.exportFile(m)}importDb(m,C){return this.#e.importDb(m,C)}async wipeFiles(){return this.#e.reset(!0)}unlink(m){return this.#e.deletePath(m)}async removeVfs(){return this.#e.removeVfs()}pauseVfs(){return this.#e.pauseVfs(),this}async unpauseVfs(){return this.#e.unpauseVfs().then(()=>this)}isPaused(){return this.#e.isPaused()}}const V=async()=>{const R=await navigator.storage.getDirectory(),m=".opfs-sahpool-sync-check-"+A(),C=(await(await R.getFileHandle(m,{create:!0})).createSyncAccessHandle()).close();return await C,await R.removeEntry(m),C?.then&&t("The local OPFS API is too old for opfs-sahpool:","it has an async FileSystemSyncAccessHandle.close() method."),!0};i.installOpfsSAHPoolVfs=async function(R=Object.create(null)){R=Object.assign(Object.create(null),d,R||{});const m=R.name;if(R.$testThrowPhase1)throw R.$testThrowPhase1;if(s[m])try{return await s[m]}catch(C){if(R.forceReinitIfPreviouslyFailed)delete s[m];else throw C}return!globalThis.FileSystemHandle||!globalThis.FileSystemDirectoryHandle||!globalThis.FileSystemFileHandle||!globalThis.FileSystemFileHandle.prototype.createSyncAccessHandle||!navigator?.storage?.getDirectory?s[m]=Promise.reject(new Error("Missing required OPFS APIs.")):s[m]=V().then(async function(){if(R.$testThrowPhase2)throw R.$testThrowPhase2;const C=new S(R);return C.isReady.then(async()=>{const B=new M(C);if(i.oo1){const Y=i.oo1,te=C.getVfs(),le=function(...ae){const ye=Y.DB.dbCtorHelper.normalizeArgs(...ae);ye.vfs=te.$zName,Y.DB.dbCtorHelper.call(this,ye)};le.prototype=Object.create(Y.DB.prototype),B.OpfsSAHPoolDb=le}return C.log("VFS initialized."),B}).catch(async B=>{throw await C.removeVfs().catch(()=>{}),B})}).catch(C=>s[m]=Promise.reject(C))}}
3),globalThis.sqlite3ApiBootstrap.initializers.push(function(i){if(!i.opfs||i.config.disable?.vfs?.["opfs-wl"])return;const t=i.util;i.util.toss;const r=i.opfs,s="opfs-wl",_=async function(c){if(c=r.initOptions(s,c),!c)return i;i.capi;const b=r.createVfsState().vfs;b.metrics.counters;const z=b.mTimeStart,I=b.mTimeEnd,q=b.opRun,w=b.__openFiles;return b.bindVfs(t.nu({xLock:function(x,L){z("xLock");const H=w[x],g=q("xLock",x,L);return g||(H.lockType=L),I(),g},xUnlock:function(x,L){z("xUnlock");const H=w[x],g=q("xUnlock",x,L);return g||(H.lockType=L),I(),g}}),function(x,L){if(x.oo1){const H=function(...g){const h=x.oo1.DB.dbCtorHelper.normalizeArgs(...g);h.vfs=L.$zName,x.oo1.DB.dbCtorHelper.call(this,h)};H.prototype=Object.create(x.oo1.DB.prototype),x.oo1.OpfsWlDb=H,H.importDb=r.importDb}})};globalThis.sqlite3ApiBootstrap.initializersAsync.push(async c=>_().catch(b=>{c.config.warn("Ignoring inability to install the",s,"sqlite3_vfs:",b)}))});try{const i=Object.assign(Object.create(null),{memory:typeof Ke<"u"?Ke:n.wasmMemory,exports:typeof lt<"u"?lt:Object.prototype.hasOwnProperty.call(n,"wasmExports")?n.wasmExports:n.asm},globalThis.sqlite3ApiBootstrap.defaultConfig,globalThis.sqlite3ApiConfig||{});e.debugModule("Bootstrapping lib config",i);const t=globalThis.sqlite3ApiBootstrap(i);return delete globalThis.sqlite3ApiBootstrap,t}catch(i){throw i}},xt?fe=f:fe=new Promise((e,n)=>{gt=e,bt=n}),fe}Ot=(function(){const je=Ot;if(!je)throw new Error("Expecting sqlite3InitModule to be defined by the Emscripten build.");const fe=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,wasmFilename:"sqlite3.wasm"});if(fe.debugModule=fe.urlParams.has("sqlite3.debugModule")?(...Oe)=>{}:()=>{},fe.urlParams.has("sqlite3.dir"))fe.sqlite3Dir=fe.urlParams.get("sqlite3.dir")+"/";else if(fe.moduleScript){const Oe=fe.moduleScript.src.split("/");Oe.pop(),fe.sqlite3Dir=Oe.join("/")+"/"}const f=globalThis.sqlite3InitModule=function Oe(...Qe){return fe.emscriptenLocateFile=Qe[0]?.locateFile,fe.emscriptenInstantiateWasm=Qe[0]?.instantiateWasm,je(...Qe).then(Fe=>{fe.debugModule("sqlite3InitModule() sIMS =",fe),fe.debugModule("sqlite3InitModule() EmscriptenModule =",Fe);const He=Fe.runSQLite3PostLoadInit(fe,Fe,!!Oe.__isUnderTest);return fe.debugModule("sqlite3InitModule() sqlite3 =",He),He}).catch(Fe=>{throw Fe})};if(f.ready=je.ready,fe.moduleScript){let Oe=fe.moduleScript.src.split("/");Oe.pop(),fe.scriptDir=Oe.join("/")+"/"}return fe.debugModule("extern-post-js.c-pp.js sqlite3InitModuleState =",fe),f})();var yr=Ot;export{yr as default,br as sqlite3Worker1Promiser};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.