@knockdata/objectexplorer 0.4.2 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- let e=null,t=null,n=null,r=0;const i=new Map;function a(t){e=t}async function o(e,t={}){let n=t.readOnly!==!1;await s();let r=await u(e),i=await l({type:`load`,path:`/db-${Date.now()}-${Math.random().toString(36).slice(2)}.db`,buffer:r,readOnly:n});return{query:(e,t)=>l({type:`query`,db:i,sql:e,params:t??[]}),exec:e=>l({type:`exec`,db:i,sql:e}),run:(e,t)=>l({type:`run`,db:i,sql:e,params:t??[]}),close:()=>l({type:`close`,db:i})}}function s(){if(n===null)if(e)n=l({type:`init`,wasmBinary:e});else throw Error(`sqlite wasm not loaded: call setWasmBinary(bytes) with wasm/sqlite.wasm`);return n}function c(){return t===null&&(t=new Worker(new URL(``+new URL(`wasm-worker.js`,import.meta.url).href,``+import.meta.url),{type:`module`}),t.onmessage=({data:e})=>{let t=i.get(e.id);t&&(i.delete(e.id),e.type===`result`?t.resolve(e.value):t.reject(Error(e.message)))},t.onerror=e=>{for(let t of i.values())t.reject(Error(e.message||`sqlite worker failed to load`));i.clear()}),t}function l(e){r+=1;let t=r;return c().postMessage({...e,id:t}),new Promise((e,n)=>{i.set(t,{resolve:e,reject:n})})}async function u(e){return e instanceof ArrayBuffer?e:e.arrayBuffer?await e.arrayBuffer():e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}export{a as n,o as t};
1
+ let e=null,t=null,n=null,r=0;const i=new Map;function a(t){e=t}async function o(e,t={}){let n=t.readOnly!==!1;await s();let r=await u(e),i=await l({type:`load`,path:`/db-${Date.now()}-${Math.random().toString(36).slice(2)}.db`,buffer:r,readOnly:n});return{query:(e,t)=>l({type:`query`,db:i,sql:e,params:t??[]}),exec:e=>l({type:`exec`,db:i,sql:e}),run:(e,t)=>l({type:`run`,db:i,sql:e,params:t??[]}),close:()=>l({type:`close`,db:i})}}function s(){if(n===null){if(e)n=l({type:`init`,wasmBinary:e});else throw Error(`sqlite wasm not loaded: call setWasmBinary(bytes) with wasm/sqlite.wasm`)}return n}function c(){return t===null&&(t=new Worker(new URL(``+new URL(`wasm-worker.js`,import.meta.url).href,``+import.meta.url),{type:`module`}),t.onmessage=({data:e})=>{let t=i.get(e.id);t&&(i.delete(e.id),e.type===`result`?t.resolve(e.value):t.reject(Error(e.message)))},t.onerror=e=>{for(let t of i.values())t.reject(Error(e.message||`sqlite worker failed to load`));i.clear()}),t}function l(e){r+=1;let t=r;return c().postMessage({...e,id:t}),new Promise((e,n)=>{i.set(t,{resolve:e,reject:n})})}async function u(e){return e instanceof ArrayBuffer?e:e.arrayBuffer?await e.arrayBuffer():e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}export{a as n,o as t};
@@ -1,2 +1,2 @@
1
- import{t as e}from"./entries.js";async function t(e={}){var t=e,n=!!globalThis.window,r=!!globalThis.WorkerGlobalScope,i=globalThis.process?.versions?.node&&globalThis.process?.type!=`renderer`;if(i){let{createRequire:e}=await import(`node:module`);var a=e(import.meta.url)}var o=`./this.program`,s=import.meta.url,c=``;function l(e){return t.locateFile?t.locateFile(e,c):c+e}var u,d;if(i){var f=a("node:fs");s.startsWith(`file:`)&&(c=a("node:path").dirname(a("node:url").fileURLToPath(s))+`/`),d=e=>(e=te(e)?new URL(e):e,f.readFileSync(e)),u=async(e,t=!0)=>(e=te(e)?new URL(e):e,f.readFileSync(e,t?void 0:`utf8`)),process.argv.length>1&&(o=process.argv[1].replace(/\\/g,`/`)),process.argv.slice(2)}else if(n||r){try{c=new URL(`.`,s).href}catch{}r&&(d=e=>{var t=new XMLHttpRequest;return t.open(`GET`,e,!1),t.responseType=`arraybuffer`,t.send(null),new Uint8Array(t.response)}),u=async e=>{var t=await fetch(e,{credentials:`same-origin`});if(t.ok)return t.arrayBuffer();throw Error(t.status+` : `+t.url)}}var p=console.log.bind(console),m=console.error.bind(console),ee,h=!1,te=e=>e.startsWith(`file://`),ne=!1;function re(){return Q.buffer}function g(){if(!v?.buffer?.resizable){var e=re();v=new Int8Array(e),K=new Int16Array(e),t.HEAPU8=O=new Uint8Array(e),z=new Int32Array(e),B=new Uint32Array(e),V=new BigInt64Array(e)}}function ie(){var e=t.preRun;e&&(typeof e==`function`&&(e=[e]),_e.push(...e)),he(_e)}function ae(){ne=!0,!t.noFSInit&&!L.initialized&&L.init(),D.init(),$.__wasm_call_ctors(),L.ignorePermissions=!1}function oe(){var e=t.postRun;e&&(typeof e==`function`&&(e=[e]),ge.push(...e)),he(ge)}function _(e){throw t.onAbort?.(e),e=`Aborted(${e})`,m(e),h=!0,e+=`. Build with -sASSERTIONS for more info.`,ne&&At(),new WebAssembly.RuntimeError(e)}var se;function ce(){return t.locateFile?l(`duckdb.wasm`):`duckdb.wasm`}function le(e){if(d)return d(e);throw`both async and sync fetching of the wasm failed`}async function ue(e){if(!ee)try{var t=await u(e);return new Uint8Array(t)}catch{}return le(e)}async function de(e,t){try{var n=await ue(e);return await WebAssembly.instantiate(n,t)}catch(e){m(`failed to asynchronously prepare wasm: ${e}`),_(e)}}async function fe(e,t,n){if(!e&&!i)try{var r=fetch(t,{credentials:`same-origin`});return await WebAssembly.instantiateStreaming(r,n)}catch(e){m(`wasm streaming compile failed: ${e}`),m(`falling back to ArrayBuffer instantiation`)}return de(t,n)}function pe(){return{env:Mt,wasi_snapshot_preview1:Mt}}async function me(){function e(e){return $=e.exports,$=Nt($),jt($),g(),$}function n(t){return e(t.instance)}var r=pe(),i=t.instantiateWasm;return i?new Promise(t=>{i(r,n=>t(e(n)))}):(se??=ce(),n(await fe(ee,se,r)))}var v,he=e=>{for(;e.length>0;)e.shift()(t)},ge=[],_e=[],y={isAbs:e=>e.charAt(0)===`/`,splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];i===`.`?e.splice(r,1):i===`..`?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n;n--)e.unshift(`..`);return e},normalize:e=>{var t=y.isAbs(e),n=e.slice(-1)===`/`;return e=y.normalizeArray(e.split(`/`).filter(e=>!!e),!t).join(`/`),!e&&!t&&(e=`.`),e&&n&&(e+=`/`),(t?`/`:``)+e},dirname:e=>{var t=y.splitPath(e),n=t[0],r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,-1),n+r)},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>y.normalize(e.join(`/`)),join2:(e,t)=>y.normalize(e+`/`+t)},ve=()=>{if(i){var e=a("node:crypto");return t=>(e.randomFillSync(t),0)}return e=>(crypto.getRandomValues(e),0)},b=e=>(b=ve())(e),x={resolve:(...e)=>{for(var t=``,n=!1,r=e.length-1;r>=-1&&!n;r--){var i=r>=0?e[r]:L.cwd();if(typeof i!=`string`)throw TypeError(`Arguments to path.resolve must be strings`);if(!i)return``;t=i+`/`+t,n=y.isAbs(i)}return t=y.normalizeArray(t.split(`/`).filter(e=>!!e),!n).join(`/`),(n?`/`:``)+t||`.`},relative:(e,t)=>{e=x.resolve(e).slice(1),t=x.resolve(t).slice(1);function n(e){for(var t=0;t<e.length&&e[t]===``;t++);for(var n=e.length-1;n>=0&&e[n]===``;n--);return t>n?[]:e.slice(t,n-t+1)}for(var r=n(e.split(`/`)),i=n(t.split(`/`)),a=Math.min(r.length,i.length),o=a,s=0;s<a;s++)if(r[s]!==i[s]){o=s;break}for(var c=[],s=o;s<r.length;s++)c.push(`..`);return c=c.concat(i.slice(o)),c.join(`/`)}},S=globalThis.TextDecoder&&new TextDecoder,ye=(e,t,n,r)=>{var i=t+n;if(r)return i;for(;e[t]&&!(t>=i);)++t;return t},C=(e,t=0,n,r)=>{t>>>=0;var i=ye(e,t,n,r);if(i-t>16&&e.buffer&&S)return S.decode(e.subarray(t,i));for(var a=``;t<i;){var o=e[t++];if(!(o&128)){a+=String.fromCharCode(o);continue}var s=e[t++]&63;if((o&224)==192){a+=String.fromCharCode((o&31)<<6|s);continue}var c=e[t++]&63;if(o=(o&240)==224?(o&15)<<12|s<<6|c:(o&7)<<18|s<<12|c<<6|e[t++]&63,o<65536)a+=String.fromCharCode(o);else{var l=o-65536;a+=String.fromCharCode(55296|l>>10,56320|l&1023)}}return a},w=[],T=e=>{for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r<=127?t++:r<=2047?t+=2:r>=55296&&r<=57343?(t+=4,++n):t+=3}return t},be=(e,t,n,r)=>{if(n>>>=0,!(r>0))return 0;for(var i=n,a=n+r-1,o=0;o<e.length;++o){var s=e.codePointAt(o);if(s<=127){if(n>=a)break;t[n++>>>0]=s}else if(s<=2047){if(n+1>=a)break;t[n++>>>0]=192|s>>6,t[n++>>>0]=128|s&63}else if(s<=65535){if(n+2>=a)break;t[n++>>>0]=224|s>>12,t[n++>>>0]=128|s>>6&63,t[n++>>>0]=128|s&63}else{if(n+3>=a)break;t[n++>>>0]=240|s>>18,t[n++>>>0]=128|s>>12&63,t[n++>>>0]=128|s>>6&63,t[n++>>>0]=128|s&63,o++}}return t[n>>>0]=0,n-i},E=(e,t,n)=>{var r=n>0?n:T(e)+1,i=Array(r),a=be(e,i,0,i.length);return t&&(i.length=a),i},xe=()=>{if(!w.length){var e=null;if(i){var t=256,n=Buffer.alloc(t),r=0,a=process.stdin.fd;try{r=f.readSync(a,n,0,t)}catch(e){if(e.toString().includes(`EOF`))r=0;else throw e}r>0&&(e=n.slice(0,r).toString(`utf-8`))}else globalThis.window?.prompt&&(e=window.prompt(`Input: `),e!==null&&(e+=`
2
- `));if(!e)return null;w=E(e,!0)}return w.shift()},D={ttys:[],init(){},shutdown(){},register(e,t){D.ttys[e]={input:[],output:[],ops:t},L.registerDevice(e,D.stream_ops)},stream_ops:{open(e){var t=D.ttys[e.node.rdev];if(!t)throw new L.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,n,r,i){if(!e.tty||!e.tty.ops.get_char)throw new L.ErrnoError(60);for(var a=0,o=0;o<r;o++){var s;try{s=e.tty.ops.get_char(e.tty)}catch{throw new L.ErrnoError(29)}if(s===void 0&&a===0)throw new L.ErrnoError(6);if(s==null)break;a++,t[n+o]=s}return a&&(e.node.atime=Date.now()),a},write(e,t,n,r,i){if(!e.tty||!e.tty.ops.put_char)throw new L.ErrnoError(60);try{for(var a=0;a<r;a++)e.tty.ops.put_char(e.tty,t[n+a])}catch{throw new L.ErrnoError(29)}return r&&(e.node.mtime=e.node.ctime=Date.now()),a}},default_tty_ops:{get_char(e){return xe()},put_char(e,t){t===null||t===10?(p(C(e.output)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output?.length>0&&(p(C(e.output)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,t,n){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,t){t===null||t===10?(m(C(e.output)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output?.length>0&&(m(C(e.output)),e.output=[])}}},O,Se=(e,t)=>O.fill(0,e,e+t),Ce=(e,t)=>Math.ceil(e/t)*t,k=e=>{e=Ce(e,65536);var t=kt(65536,e);return t&&Se(t,e),t},A={ops_table:null,mount(e){return A.createNode(null,`/`,16895,0)},createNode(e,t,n,r){if(L.isBlkdev(n)||L.isFIFO(n))throw new L.ErrnoError(63);A.ops_table||={dir:{node:{getattr:A.node_ops.getattr,setattr:A.node_ops.setattr,lookup:A.node_ops.lookup,mknod:A.node_ops.mknod,rename:A.node_ops.rename,unlink:A.node_ops.unlink,rmdir:A.node_ops.rmdir,readdir:A.node_ops.readdir,symlink:A.node_ops.symlink},stream:{llseek:A.stream_ops.llseek}},file:{node:{getattr:A.node_ops.getattr,setattr:A.node_ops.setattr},stream:{llseek:A.stream_ops.llseek,read:A.stream_ops.read,write:A.stream_ops.write,mmap:A.stream_ops.mmap,msync:A.stream_ops.msync}},link:{node:{getattr:A.node_ops.getattr,setattr:A.node_ops.setattr,readlink:A.node_ops.readlink},stream:{}},chrdev:{node:{getattr:A.node_ops.getattr,setattr:A.node_ops.setattr},stream:L.chrdev_stream_ops}};var i=L.createNode(e,t,n,r);return L.isDir(i.mode)?(i.node_ops=A.ops_table.dir.node,i.stream_ops=A.ops_table.dir.stream,i.contents={}):L.isFile(i.mode)?(i.node_ops=A.ops_table.file.node,i.stream_ops=A.ops_table.file.stream,i.usedBytes=0,i.contents=A.emptyFileContents??=new Uint8Array):L.isLink(i.mode)?(i.node_ops=A.ops_table.link.node,i.stream_ops=A.ops_table.link.stream):L.isChrdev(i.mode)&&(i.node_ops=A.ops_table.chrdev.node,i.stream_ops=A.ops_table.chrdev.stream),i.atime=i.mtime=i.ctime=Date.now(),e&&(e.contents[t]=i,e.atime=e.mtime=e.ctime=i.atime),i},getFileDataAsTypedArray(e){return e.contents.subarray(0,e.usedBytes)},expandFileStorage(e,t){var n=e.contents.length;if(!(n>=t)){t=Math.max(t,n*(n<1048576?2:1.125)>>>0),n&&(t=Math.max(t,256));var r=A.getFileDataAsTypedArray(e);e.contents=new Uint8Array(t),e.contents.set(r)}},resizeFileStorage(e,t){if(e.usedBytes!=t){var n=e.contents;e.contents=new Uint8Array(t),e.contents.set(n.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=L.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,t.size=L.isDir(e.mode)?4096:L.isFile(e.mode)?e.usedBytes:L.isLink(e.mode)?e.link.length:0,t.atime=new Date(e.atime),t.mtime=new Date(e.mtime),t.ctime=new Date(e.ctime),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){for(let n of[`mode`,`atime`,`mtime`,`ctime`])t[n]!=null&&(e[n]=t[n]);t.size!==void 0&&A.resizeFileStorage(e,t.size)},lookup(e,t){throw A.doesNotExistError||(A.doesNotExistError=new L.ErrnoError(44),A.doesNotExistError.stack=`<generic error, no stack>`),A.doesNotExistError},mknod(e,t,n,r){return A.createNode(e,t,n,r)},rename(e,t,n){var r;try{r=L.lookupNode(t,n)}catch{}if(r){if(L.isDir(e.mode))for(var i in r.contents)throw new L.ErrnoError(55);L.hashRemoveNode(r)}delete e.parent.contents[e.name],t.contents[n]=e,e.name=n,t.ctime=t.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,t){delete e.contents[t],e.ctime=e.mtime=Date.now()},rmdir(e,t){for(var n in L.lookupNode(e,t).contents)throw new L.ErrnoError(55);delete e.contents[t],e.ctime=e.mtime=Date.now()},readdir(e){return[`.`,`..`,...Object.keys(e.contents)]},symlink(e,t,n){var r=A.createNode(e,t,41471,0);return r.link=n,r},readlink(e){if(!L.isLink(e.mode))throw new L.ErrnoError(28);return e.link}},stream_ops:{read(e,t,n,r,i){var a=e.node.contents;if(i>=e.node.usedBytes)return 0;var o=Math.min(e.node.usedBytes-i,r);return t.set(a.subarray(i,i+o),n),o},write(e,t,n,r,i,a){if(t.buffer===v.buffer&&(a=!1),!r)return 0;var o=e.node;return o.mtime=o.ctime=Date.now(),a?(o.contents=t.subarray(n,n+r),o.usedBytes=r):o.usedBytes===0&&i===0?(o.contents=t.slice(n,n+r),o.usedBytes=r):(A.expandFileStorage(o,i+r),o.contents.set(t.subarray(n,n+r),i),o.usedBytes=Math.max(o.usedBytes,i+r)),r},llseek(e,t,n){var r=t;if(n===1?r+=e.position:n===2&&L.isFile(e.node.mode)&&(r+=e.node.usedBytes),r<0)throw new L.ErrnoError(28);return r},mmap(e,t,n,r,i){if(!L.isFile(e.node.mode))throw new L.ErrnoError(43);var a,o,s=e.node.contents;if(!(i&2)&&s.buffer===v.buffer)o=!1,a=s.byteOffset;else{if(o=!0,a=k(t),!a)throw new L.ErrnoError(48);s&&((n>0||n+t<s.length)&&(s=s.subarray?s.subarray(n,n+t):Array.prototype.slice.call(s,n,n+t)),v.set(s,a>>>0))}return{ptr:a,allocated:o}},msync(e,t,n,r,i){return A.stream_ops.write(e,t,0,r,n,!1),0}}},we=e=>{if(typeof e!=`string`)return e;var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(t===void 0)throw Error(`Unknown file open mode: ${e}`);return t},j=e=>(typeof e==`string`&&(e=E(e,!0)),e.subarray||(e=new Uint8Array(e)),e),M=(e,t)=>{var n=0;return e&&(n|=365),t&&(n|=146),n},Te=async e=>{var t=await u(e);return new Uint8Array(t)},Ee=(...e)=>L.createDataFile(...e),De=e=>e,N=null,Oe=async()=>N,P=0,F=null,ke=e=>{P--,t.monitorRunDependencies?.(P),P||F()},Ae=e=>{P||(N=new Promise(e=>F=e)),P++,t.monitorRunDependencies?.(P)},je=[],Me=async(e,t)=>{typeof Browser<`u`&&Browser.init();for(var n of je)if(n.canHandle(t))return n.handle(e,t);return e},I=async(e,t,n,r,i,a,o,s)=>{var c=t?x.resolve(y.join2(e,t)):e,l=De(`cp ${c}`);Ae(l);try{var u=n;typeof n==`string`&&(u=await Te(n)),u=await Me(u,c),s?.(),a||Ee(e,t,u,r,i,o)}finally{ke(l)}},Ne=(e,t,n,r,i,a,o,s,c,l)=>{I(e,t,n,r,i,s,c,l).then(a).catch(o)},L={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)}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,t,n,r){e||=this,this.parent=e,this.mount=e.mount,this.id=L.nextInode++,this.name=t,this.mode=n,this.rdev=r,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 L.isDir(this.mode)}get isDevice(){return L.isChrdev(this.mode)}addListener(e,t=!1){var n={cb:e,exclusive:t},r=this.listeners??=new Set;return r.add(n),{listeners:r,entry:n}}notifyListeners(e){if(this.listeners){var t;for(var n of this.listeners)n.exclusive?(t||=[]).push(n):n.cb(e);if(t){var r=(this.exclTurn||0)%t.length;this.exclTurn=r+1,t[r].cb(e)}}}},lookupPath(e,t={}){if(!e)throw new L.ErrnoError(44);t.follow_mount??=!0,y.isAbs(e)||(e=L.cwd()+`/`+e);linkloop:for(var n=0;n<40;n++){for(var r=e.split(`/`).filter(e=>!!e),i=L.root,a=`/`,o=0;o<r.length;o++){var s=o===r.length-1;if(s&&t.parent)break;if(r[o]!==`.`){if(r[o]===`..`){if(a=y.dirname(a),L.isRoot(i)){e=a+`/`+r.slice(o+1).join(`/`),n--;continue linkloop}i=i.parent;continue}a=y.join2(a,r[o]);try{i=L.lookupNode(i,r[o])}catch(e){if(e?.errno===44&&s&&t.noent_okay)return{path:a};throw e}if(L.isMountpoint(i)&&(!s||t.follow_mount)&&(i=i.mounted.root),L.isLink(i.mode)&&(!s||t.follow)){if(!i.node_ops.readlink)throw new L.ErrnoError(52);var c=i.node_ops.readlink(i);y.isAbs(c)||(c=y.dirname(a)+`/`+c),e=c+`/`+r.slice(o+1).join(`/`);continue linkloop}}}return{path:a,node:i}}throw new L.ErrnoError(32)},getPath(e){for(var t;;){if(L.isRoot(e)){var n=e.mount.mountpoint;return t?n[n.length-1]===`/`?n+t:`${n}/${t}`:n}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var n=0,r=0;r<t.length;r++)n=(n<<5)-n+t.charCodeAt(r)|0;return(e+n>>>0)%L.nameTable.length},hashAddNode(e){var t=L.hashName(e.parent.id,e.name);e.name_next=L.nameTable[t],L.nameTable[t]=e},hashRemoveNode(e){var t=L.hashName(e.parent.id,e.name);if(L.nameTable[t]===e)L.nameTable[t]=e.name_next;else for(var n=L.nameTable[t];n;){if(n.name_next===e){n.name_next=e.name_next;break}n=n.name_next}},lookupNode(e,t){var n=L.mayLookup(e);if(n)throw new L.ErrnoError(n);for(var r=L.hashName(e.id,t),i=L.nameTable[r];i;i=i.name_next){var a=i.name;if(i.parent.id===e.id&&a===t)return i}return L.lookup(e,t)},createNode(e,t,n,r){var i=new L.FSNode(e,t,n,r);return L.hashAddNode(i),i},destroyNode(e){L.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)==32768},isDir(e){return(e&61440)==16384},isLink(e){return(e&61440)==40960},isChrdev(e){return(e&61440)==8192},isBlkdev(e){return(e&61440)==24576},isFIFO(e){return(e&61440)==4096},isSocket(e){return(e&49152)==49152},flagsToPermissionString(e){var t=[`r`,`w`,`rw`][e&3];return e&512&&(t+=`w`),t},nodePermissions(e,t){return L.ignorePermissions?0:t.includes(`r`)&&!(e.mode&292)||t.includes(`w`)&&!(e.mode&146)||t.includes(`x`)&&!(e.mode&73)?2:0},mayLookup(e){return L.isDir(e.mode)?L.nodePermissions(e,`x`)||(e.node_ops.lookup?0:2):54},mayCreate(e,t){if(!L.isDir(e.mode))return 54;try{return L.lookupNode(e,t),20}catch{}return L.nodePermissions(e,`wx`)},mayDelete(e,t,n){var r;try{r=L.lookupNode(e,t)}catch(e){return e.errno}var i=L.nodePermissions(e,`wx`);if(i)return i;if(n){if(!L.isDir(r.mode))return 54;if(L.isRoot(r)||L.getPath(r)===L.cwd())return 10}else if(L.isDir(r.mode))return 31;return 0},mayOpen(e,t){if(!e)return 44;if(L.isLink(e.mode))return 32;var n=L.flagsToPermissionString(t);return L.isDir(e.mode)&&(n!==`r`||t&576)?31:L.nodePermissions(e,n)},checkOpExists(e,t){if(!e)throw new L.ErrnoError(t);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=L.MAX_OPEN_FDS;e++)if(!L.streams[e])return e;throw new L.ErrnoError(33)},getStreamChecked(e){var t=L.getStream(e);if(!t)throw new L.ErrnoError(8);return t},getStream:e=>L.streams[e],createStream(e,t=-1){return e=Object.assign(new L.FSStream,e),t==-1&&(t=L.nextfd()),e.fd=t,L.streams[t]=e,e},closeStream(e){L.streams[e]=null},dupStream(e,t=-1){var n=L.createStream(e,t);return n.stream_ops?.dup?.(n),n},doSetAttr(e,t,n){var r=e?.stream_ops.setattr,i=r?e:t;r??=t.node_ops.setattr,L.checkOpExists(r,63);try{r(i,n)}catch(e){throw e instanceof RangeError?new L.ErrnoError(22):e}},chrdev_stream_ops:{open(e){e.stream_ops=L.getDevice(e.node.rdev).stream_ops,e.stream_ops.open?.(e)},llseek(){throw new L.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,t)=>e<<8|t,registerDevice(e,t){L.devices[e]={stream_ops:t}},getDevice:e=>L.devices[e],getMounts(e){for(var t=[],n=[e];n.length;){var r=n.pop();t.push(r),n.push(...r.mounts)}return t},syncfs(e,t){typeof e==`function`&&(t=e,e=!1),L.syncFSRequests++,L.syncFSRequests>1&&m(`warning: ${L.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var n=L.getMounts(L.root.mount),r=0;function i(e){return L.syncFSRequests--,t(e)}function a(e){if(e)return a.errored?void 0:(a.errored=!0,i(e));++r>=n.length&&i(null)}for(var o of n)o.type.syncfs?o.type.syncfs(o,e,a):a(null)},mount(e,t,n){var r=n===`/`,i=!n,a;if(r&&L.root)throw new L.ErrnoError(10);if(!r&&!i){var o=L.lookupPath(n,{follow_mount:!1});if(n=o.path,a=o.node,L.isMountpoint(a))throw new L.ErrnoError(10);if(!L.isDir(a.mode))throw new L.ErrnoError(54)}var s={type:e,opts:t,mountpoint:n,mounts:[]},c=e.mount(s);return c.mount=s,s.root=c,r?L.root=c:a&&(a.mounted=s,a.mount&&a.mount.mounts.push(s)),c},unmount(e){var t=L.lookupPath(e,{follow_mount:!1});if(!L.isMountpoint(t.node))throw new L.ErrnoError(28);var n=t.node,r=n.mounted,i=L.getMounts(r);for(var[a,o]of Object.entries(L.nameTable))for(;o;){var s=o.name_next;i.includes(o.mount)&&L.destroyNode(o),o=s}n.mounted=null;var c=n.mount.mounts.indexOf(r);n.mount.mounts.splice(c,1)},lookup(e,t){return e.node_ops.lookup(e,t)},mknod(e,t,n){var r=L.lookupPath(e,{parent:!0}).node,i=y.basename(e);if(!i)throw new L.ErrnoError(28);if(i===`.`||i===`..`)throw new L.ErrnoError(20);var a=L.mayCreate(r,i);if(a)throw new L.ErrnoError(a);if(!r.node_ops.mknod)throw new L.ErrnoError(63);return r.node_ops.mknod(r,i,t,n)},statfs(e){return L.statfsNode(L.lookupPath(e,{follow:!0}).node)},statfsStream(e){return L.statfsNode(e.node)},statfsNode(e){var t={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:L.nextInode,ffree:L.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(t,e.node_ops.statfs(e.mount.opts.root)),t},create(e,t=438){return t&=4095,t|=32768,L.mknod(e,t,0)},mkdir(e,t=511){return t&=1023,t|=16384,L.mknod(e,t,0)},mkdirTree(e,t){var n=e.split(`/`),r=``;for(var i of n)if(i){(r||y.isAbs(e))&&(r+=`/`),r+=i;try{L.mkdir(r,t)}catch(e){if(e.errno!=20)throw e}}},mkdev(e,t,n){return n===void 0&&(n=t,t=438),t|=8192,L.mknod(e,t,n)},symlink(e,t){if(!x.resolve(e))throw new L.ErrnoError(44);var n=L.lookupPath(t,{parent:!0}).node;if(!n)throw new L.ErrnoError(44);var r=y.basename(t),i=L.mayCreate(n,r);if(i)throw new L.ErrnoError(i);if(!n.node_ops.symlink)throw new L.ErrnoError(63);return n.node_ops.symlink(n,r,e)},link(e,t,n){var r=L.lookupPath(t,{parent:!0}).node;if(!r)throw new L.ErrnoError(44);var i=y.basename(t),a=L.mayCreate(r,i);if(a)throw new L.ErrnoError(a);if(!r.node_ops.link)throw new L.ErrnoError(34);return r.node_ops.link(r,i,e,n)},rename(e,t){var n=y.dirname(e),r=y.dirname(t),i=y.basename(e),a=y.basename(t),o=L.lookupPath(e,{parent:!0}),s=o.node,c;if(o=L.lookupPath(t,{parent:!0}),c=o.node,!s||!c)throw new L.ErrnoError(44);if(s.mount!==c.mount)throw new L.ErrnoError(75);var l=L.lookupNode(s,i),u=x.relative(e,r);if(u.charAt(0)!==`.`)throw new L.ErrnoError(28);if(u=x.relative(t,n),u.charAt(0)!==`.`)throw new L.ErrnoError(55);var d;try{d=L.lookupNode(c,a)}catch{}if(l!==d){var f=L.isDir(l.mode),p=L.mayDelete(s,i,f);if(p||(p=d?L.mayDelete(c,a,f):L.mayCreate(c,a),p))throw new L.ErrnoError(p);if(!s.node_ops.rename)throw new L.ErrnoError(63);if(L.isMountpoint(l)||d&&L.isMountpoint(d))throw new L.ErrnoError(10);if(c!==s&&(p=L.nodePermissions(s,`w`),p))throw new L.ErrnoError(p);L.hashRemoveNode(l);try{s.node_ops.rename(l,c,a),l.parent=c}catch(e){throw e}finally{L.hashAddNode(l)}}},rmdir(e){var t=L.lookupPath(e,{parent:!0}).node,n=y.basename(e),r=L.lookupNode(t,n),i=L.mayDelete(t,n,!0);if(i)throw new L.ErrnoError(i);if(!t.node_ops.rmdir)throw new L.ErrnoError(63);if(L.isMountpoint(r))throw new L.ErrnoError(10);t.node_ops.rmdir(t,n),L.destroyNode(r)},readdir(e){var t=L.lookupPath(e,{follow:!0}).node;return L.checkOpExists(t.node_ops.readdir,54)(t)},unlink(e){var t=L.lookupPath(e,{parent:!0}).node;if(!t)throw new L.ErrnoError(44);var n=y.basename(e),r=L.lookupNode(t,n),i=L.mayDelete(t,n,!1);if(i)throw new L.ErrnoError(i);if(!t.node_ops.unlink)throw new L.ErrnoError(63);if(L.isMountpoint(r))throw new L.ErrnoError(10);t.node_ops.unlink(t,n),L.destroyNode(r)},readlink(e){var t=L.lookupPath(e).node;if(!t)throw new L.ErrnoError(44);if(!t.node_ops.readlink)throw new L.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,t){var n=L.lookupPath(e,{follow:!t}).node;return L.checkOpExists(n.node_ops.getattr,63)(n)},fstat(e){var t=L.getStreamChecked(e),n=t.node,r=t.stream_ops.getattr,i=r?t:n;return r??=n.node_ops.getattr,L.checkOpExists(r,63),r(i)},lstat(e){return L.stat(e,!0)},doChmod(e,t,n,r){L.doSetAttr(e,t,{mode:n&4095|t.mode&-4096,ctime:Date.now(),dontFollow:r})},chmod(e,t,n){var r=typeof e==`string`?L.lookupPath(e,{follow:!n}).node:e;L.doChmod(null,r,t,n)},lchmod(e,t){L.chmod(e,t,!0)},fchmod(e,t){var n=L.getStreamChecked(e);L.doChmod(n,n.node,t,!1)},doChown(e,t,n){L.doSetAttr(e,t,{timestamp:Date.now(),dontFollow:n})},chown(e,t,n,r){var i=typeof e==`string`?L.lookupPath(e,{follow:!r}).node:e;L.doChown(null,i,r)},lchown(e,t,n){L.chown(e,t,n,!0)},fchown(e,t,n){var r=L.getStreamChecked(e);L.doChown(r,r.node,!1)},doTruncate(e,t,n){if(L.isDir(t.mode))throw new L.ErrnoError(31);if(!L.isFile(t.mode))throw new L.ErrnoError(28);var r=L.nodePermissions(t,`w`);if(r)throw new L.ErrnoError(r);L.doSetAttr(e,t,{size:n,timestamp:Date.now()})},truncate(e,t){if(t<0)throw new L.ErrnoError(28);var n=typeof e==`string`?L.lookupPath(e,{follow:!0}).node:e;L.doTruncate(null,n,t)},ftruncate(e,t){var n=L.getStreamChecked(e);if(t<0||!(n.flags&2097155))throw new L.ErrnoError(28);L.doTruncate(n,n.node,t)},utime(e,t,n,r){var i=L.lookupPath(e,{follow:!r});L.doSetAttr(null,i.node,{atime:t,mtime:n,dontFollow:r})},open(e,t,n=438){if(e===``)throw new L.ErrnoError(44);t=we(t),n=t&64?n&4095|32768:0;var r,i;if(typeof e==`object`)r=e;else{i=e.endsWith(`/`);var a=L.lookupPath(e,{follow:!(t&131072),noent_okay:!0});r=a.node,e=a.path}var o=!1;if(t&64)if(r){if(t&128)throw new L.ErrnoError(20)}else if(i)throw new L.ErrnoError(31);else r=L.mknod(e,n|511,0),o=!0;if(!r)throw new L.ErrnoError(44);if(L.isChrdev(r.mode)&&(t&=-513),t&65536&&!L.isDir(r.mode))throw new L.ErrnoError(54);if(!o){var s=L.mayOpen(r,t);if(s)throw new L.ErrnoError(s)}t&512&&!o&&L.truncate(r,0),t&=-131713;var c=L.createStream({node:r,path:L.getPath(r),flags:t,seekable:!0,position:0,stream_ops:r.stream_ops,ungotten:[],error:!1});return c.stream_ops.open&&c.stream_ops.open(c),o&&L.chmod(r,n&511),c},close(e){if(L.isClosed(e))throw new L.ErrnoError(8);e.getdents&&=null,e.node?.notifyListeners(32);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{L.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,t,n){if(L.isClosed(e))throw new L.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new L.ErrnoError(70);if(n!=0&&n!=1&&n!=2)throw new L.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,n),e.ungotten=[],e.position},read(e,t,n,r,i){if(r<0||i<0)throw new L.ErrnoError(28);if(L.isClosed(e)||(e.flags&2097155)==1)throw new L.ErrnoError(8);if(L.isDir(e.node.mode))throw new L.ErrnoError(31);if(!e.stream_ops.read)throw new L.ErrnoError(28);var a=i!==void 0;if(!a)i=e.position;else if(!e.seekable)throw new L.ErrnoError(70);var o=e.stream_ops.read(e,t,n,r,i);return a||(e.position+=o),o},write(e,t,n,r,i,a){if(r<0||i<0)throw new L.ErrnoError(28);if(L.isClosed(e)||!(e.flags&2097155))throw new L.ErrnoError(8);if(L.isDir(e.node.mode))throw new L.ErrnoError(31);if(!e.stream_ops.write)throw new L.ErrnoError(28);e.seekable&&e.flags&1024&&L.llseek(e,0,2);var o=i!==void 0;if(!o)i=e.position;else if(!e.seekable)throw new L.ErrnoError(70);var s=e.stream_ops.write(e,t,n,r,i,a);return o||(e.position+=s),s},mmap(e,t,n,r,i){if(r&2&&!(i&2)&&(e.flags&2097155)!=2||(e.flags&2097155)==1)throw new L.ErrnoError(2);if(!e.stream_ops.mmap)throw new L.ErrnoError(43);if(!t)throw new L.ErrnoError(28);return e.stream_ops.mmap(e,t,n,r,i)},msync(e,t,n,r,i){return e.stream_ops.msync?e.stream_ops.msync(e,t,n,r,i):0},ioctl(e,t,n){if(!e.stream_ops.ioctl)throw new L.ErrnoError(59);return e.stream_ops.ioctl(e,t,n)},readFile(e,t={}){t.flags=t.flags??0,t.encoding=t.encoding??`binary`,t.encoding!==`utf8`&&t.encoding!==`binary`&&_(`Invalid encoding type "${t.encoding}"`);var n=L.open(e,t.flags),r=L.stat(e).size,i=new Uint8Array(r);return L.read(n,i,0,r,0),t.encoding===`utf8`&&(i=C(i)),L.close(n),i},writeFile(e,t,n={}){n.flags=n.flags??577;var r=L.open(e,n.flags,n.mode);t=j(t),L.write(r,t,0,t.byteLength,void 0,n.canOwn),L.close(r)},cwd:()=>L.currentPath,chdir(e){var t=L.lookupPath(e,{follow:!0});if(t.node===null)throw new L.ErrnoError(44);if(!L.isDir(t.node.mode))throw new L.ErrnoError(54);var n=L.nodePermissions(t.node,`x`);if(n)throw new L.ErrnoError(n);L.currentPath=t.path},createDefaultDirectories(){L.mkdir(`/tmp`),L.mkdir(`/home`),L.mkdir(`/home/web_user`)},createDefaultDevices(){L.mkdir(`/dev`),L.registerDevice(L.makedev(1,3),{read:()=>0,write:(e,t,n,r,i)=>r,llseek:()=>0}),L.mkdev(`/dev/null`,L.makedev(1,3)),D.register(L.makedev(5,0),D.default_tty_ops),D.register(L.makedev(6,0),D.default_tty1_ops),L.mkdev(`/dev/tty`,L.makedev(5,0)),L.mkdev(`/dev/tty1`,L.makedev(6,0));var e=new Uint8Array(1024),t=0,n=()=>(t===0&&(b(e),t=e.byteLength),e[--t]);L.createDevice(`/dev`,`random`,n),L.createDevice(`/dev`,`urandom`,n),L.mkdir(`/dev/shm`),L.mkdir(`/dev/shm/tmp`)},createSpecialDirectories(){L.mkdir(`/proc`);var e=L.mkdir(`/proc/self`);L.mkdir(`/proc/self/fd`),L.mount({mount(){var t=L.createNode(e,`fd`,16895,73);return t.stream_ops={llseek:A.stream_ops.llseek},t.node_ops={lookup(e,t){var n=+t,r=L.getStreamChecked(n),i={parent:null,mount:{mountpoint:`fake`},node_ops:{readlink:()=>r.path},id:n+1};return i.parent=i,i},readdir(){return Array.from(L.streams.entries()).filter(([e,t])=>t).map(([e,t])=>e.toString())}},t}},{},`/proc/self/fd`)},createStandardStreams(e,t,n){e?L.createDevice(`/dev`,`stdin`,e):L.symlink(`/dev/tty`,`/dev/stdin`),t?L.createDevice(`/dev`,`stdout`,null,t):L.symlink(`/dev/tty`,`/dev/stdout`),n?L.createDevice(`/dev`,`stderr`,null,n):L.symlink(`/dev/tty1`,`/dev/stderr`),L.open(`/dev/stdin`,0),L.open(`/dev/stdout`,1),L.open(`/dev/stderr`,1)},staticInit(){L.nameTable=Array(4096),L.mount(A,{},`/`),L.createDefaultDirectories(),L.createDefaultDevices(),L.createSpecialDirectories(),L.filesystems={MEMFS:A}},init(e,n,r){L.initialized=!0,e??=t.stdin,n??=t.stdout,r??=t.stderr,L.createStandardStreams(e,n,r)},quit(){L.initialized=!1;for(var e of L.streams)e&&L.close(e)},findObject(e,t){var n=L.analyzePath(e,t);return n.exists?n.object:null},analyzePath(e,t){try{var n=L.lookupPath(e,{follow:!t});e=n.path}catch{}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=L.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=y.basename(e),n=L.lookupPath(e,{follow:!t}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot=n.path===`/`}catch(e){r.error=e.errno}return r},createPath(e,t,n,r){e=typeof e==`string`?e:L.getPath(e);for(var i=t.split(`/`).reverse();i.length;){var a=i.pop();if(a){var o=y.join2(e,a);try{L.mkdir(o)}catch(e){if(e.errno!=20)throw e}e=o}}return o},createFile(e,t,n,r,i){var a=y.join2(typeof e==`string`?e:L.getPath(e),t),o=M(r,i);return L.create(a,o)},createDataFile(e,t,n,r,i,a){var o=t;e&&(e=typeof e==`string`?e:L.getPath(e),o=t?y.join2(e,t):e);var s=M(r,i),c=L.create(o,s);if(n){n=j(n),L.chmod(c,s|146);var l=L.open(c,577);L.write(l,n,0,n.length,0,a),L.close(l),L.chmod(c,s)}},createDevice(e,t,n,r){var i=y.join2(typeof e==`string`?e:L.getPath(e),t),a=M(!!n,!!r);L.createDevice.major??=64;var o=L.makedev(L.createDevice.major++,0);return L.registerDevice(o,{open(e){e.seekable=!1},close(e){r?.buffer?.length&&r(10)},read(e,t,r,i,a){for(var o=0,s=0;s<i;s++){var c;try{c=n()}catch{throw new L.ErrnoError(29)}if(c===void 0&&o===0)throw new L.ErrnoError(6);if(c==null)break;o++,t[r+s]=c}return o&&(e.node.atime=Date.now()),o},write(e,t,n,i,a){for(var o=0;o<i;o++)try{r(t[n+o])}catch{throw new L.ErrnoError(29)}return i&&(e.node.mtime=e.node.ctime=Date.now()),o}}),L.mkdev(i,a,o)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(globalThis.XMLHttpRequest)_(`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=d(e.url)}catch{throw new L.ErrnoError(29)}},createLazyFile(e,t,n,i,a){class o{lengthKnown=!1;chunks=[];get(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,n=e/this.chunkSize|0;return this.getter(n)[t]}}setDataGetter(e){this.getter=e}cacheLength(){var e=new XMLHttpRequest;e.open(`HEAD`,n,!1),e.send(null),e.status>=200&&e.status<300||e.status===304||_(`Couldn't load ${n}. Status: ${e.status}`);var t=Number(e.getResponseHeader(`Content-length`)),r,i=(r=e.getResponseHeader(`Accept-Ranges`))&&r===`bytes`,a=(r=e.getResponseHeader(`Content-Encoding`))&&r===`gzip`,o=1048576;i||(o=t);var s=(e,r)=>{e>r&&_(`invalid range (${e}, ${r}) or no bytes requested!`),r>t-1&&_(`only ${t} bytes available! programmer error!`);var i=new XMLHttpRequest;return i.open(`GET`,n,!1),t!==o&&i.setRequestHeader(`Range`,`bytes=${e}-${r}`),i.responseType=`arraybuffer`,i.overrideMimeType&&i.overrideMimeType(`text/plain; charset=x-user-defined`),i.send(null),i.status>=200&&i.status<300||i.status===304||_(`Couldn't load ${n}. Status: ${i.status}`),i.response===void 0?E(i.responseText??``,!0):new Uint8Array(i.response||[])},c=this;c.setDataGetter(e=>{var n=e*o,r=(e+1)*o-1;return r=Math.min(r,t-1),c.chunks[e]===void 0&&(c.chunks[e]=s(n,r)),c.chunks[e]===void 0&&_(`doXHR failed!`),c.chunks[e]}),(a||!t)&&(o=t=1,t=this.getter(0).length,o=t,p(`LazyFiles on gzip forces download of the whole file when length is accessed`)),this._length=t,this._chunkSize=o,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(globalThis.XMLHttpRequest){r||_(`Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc`);var s={isDevice:!1,contents:new o}}else var s={isDevice:!1,url:n};var c=L.createFile(e,t,s,i,a);s.contents?c.contents=s.contents:s.url&&(c.contents=null,c.url=s.url),Object.defineProperties(c,{usedBytes:{get:function(){return this.contents.length}}});var l={};for(let[e,t]of Object.entries(c.stream_ops))l[e]=(...e)=>(L.forceLoadFile(c),t(...e));function u(e,t,n,r,i){var a=e.node.contents;if(i>=a.length)return 0;var o=Math.min(a.length-i,r);if(a.slice)for(var s=0;s<o;s++)t[n+s]=a[i+s];else for(var s=0;s<o;s++)t[n+s]=a.get(i+s);return o}return l.read=(e,t,n,r,i)=>(L.forceLoadFile(c),u(e,t,n,r,i)),l.mmap=(e,t,n,r,i)=>{L.forceLoadFile(c);var a=k(t);if(!a)throw new L.ErrnoError(48);return u(e,v,a,t,n),{ptr:a,allocated:!0}},c.stream_ops=l,c}},R=(e,t,n)=>(e>>>=0,e?C(O,e,t,n):``),z,B,V,H={currentUmask:18,calculateAt(e,t,n){if(y.isAbs(t))return t;var r=e===-100?L.cwd():H.getStreamFromFD(e).path;if(t.length==0){if(!n)throw new L.ErrnoError(44);return r}return r+`/`+t},writeStat(e,t){B[e>>>2>>>0]=t.dev,B[e+4>>>2>>>0]=t.mode,B[e+8>>>2>>>0]=t.nlink,B[e+12>>>2>>>0]=t.uid,B[e+16>>>2>>>0]=t.gid,B[e+20>>>2>>>0]=t.rdev,V[e+24>>>3>>>0]=BigInt(t.size),z[e+32>>>2>>>0]=4096,z[e+36>>>2>>>0]=t.blocks;var n=t.atime.getTime(),r=t.mtime.getTime(),i=t.ctime.getTime();return V[e+40>>>3>>>0]=BigInt(Math.floor(n/1e3)),B[e+48>>>2>>>0]=n%1e3*1e3*1e3,V[e+56>>>3>>>0]=BigInt(Math.floor(r/1e3)),B[e+64>>>2>>>0]=r%1e3*1e3*1e3,V[e+72>>>3>>>0]=BigInt(Math.floor(i/1e3)),B[e+80>>>2>>>0]=i%1e3*1e3*1e3,V[e+88>>>3>>>0]=BigInt(t.ino),0},writeStatFs(e,t){B[e+4>>>2>>>0]=t.bsize,B[e+60>>>2>>>0]=t.bsize,V[e+8>>>3>>>0]=BigInt(t.blocks),V[e+16>>>3>>>0]=BigInt(t.bfree),V[e+24>>>3>>>0]=BigInt(t.bavail),V[e+32>>>3>>>0]=BigInt(t.files),V[e+40>>>3>>>0]=BigInt(t.ffree),B[e+48>>>2>>>0]=t.fsid,B[e+64>>>2>>>0]=t.flags,B[e+56>>>2>>>0]=t.namelen},doMsync(e,t,n,r,i){if(!L.isFile(t.node.mode))throw new L.ErrnoError(43);if(r&2)return 0;var a=O.subarray(e>>>0,e+n>>>0);L.msync(t,a,i,n,r)},getStreamFromFD(e){return L.getStreamChecked(e)},varargs:void 0,getStr(e){return R(e)}},Pe=9007199254740992,Fe=-9007199254740992,U=e=>e<Fe||e>Pe?NaN:Number(e);function Ie(e,t,n,r){t>>>=0;try{if(t=H.getStr(t),t=H.calculateAt(e,t),n&-8)return-28;var i=L.lookupPath(t,{follow:!0}).node;if(!i)return-44;var a=``;return n&4&&(a+=`r`),n&2&&(a+=`w`),n&1&&(a+=`x`),a&&L.nodePermissions(i,a)?-2:0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}var W=()=>{var e=z[H.varargs>>>2>>>0];return H.varargs+=4,e},G=W,K;function Le(e,t,n){n>>>=0,H.varargs=n;try{var r=H.getStreamFromFD(e);switch(t){case 0:var i=W();if(i<0)return-28;for(;L.streams[i];)i++;return L.dupStream(r,i).fd;case 1:case 2:return 0;case 3:return r.flags;case 4:var i=W(),a=289792;return r.flags=r.flags&~a|i&a,0;case 12:var i=G(),o=0;return K[i+o>>>1>>>0]=2,0;case 13:case 14:return 0}return-28}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Re(e,t){t>>>=0;try{return H.writeStat(t,L.fstat(e))}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function ze(e,t){t=U(t);try{return isNaN(t)?-22:(L.ftruncate(e,t),0)}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}var q=(e,t,n)=>be(e,O,t,n);function Be(e,t){e>>>=0,t>>>=0;try{if(t===0)return-28;var n=L.cwd(),r=T(n)+1;return t<r?-68:(q(n,e,t),r)}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Ve(e,t,n){t>>>=0,n>>>=0;try{var r=H.getStreamFromFD(e);r.getdents||=L.readdir(r.path);for(var i=280,a=0,o=L.llseek(r,0,1),s=Math.floor(o/i),c=Math.min(r.getdents.length,s+Math.floor(n/i)),l=s;l<c;l++){var u,d,f=r.getdents[l];if(f===`.`)u=r.node.id,d=4;else if(f===`..`)u=L.lookupPath(r.path,{parent:!0}).node.id,d=4;else{var p;try{p=L.lookupNode(r.node,f)}catch(e){if(e?.errno===28)continue;throw e}u=p.id,d=L.isChrdev(p.mode)?2:L.isDir(p.mode)?4:L.isLink(p.mode)?10:8}V[t+a>>>3>>>0]=BigInt(u),V[t+a+8>>>3>>>0]=BigInt((l+1)*i),K[t+a+16>>>1>>>0]=280,v[t+a+18>>>0]=d,q(f,t+a+19,256),a+=i}return L.llseek(r,l*i,0),a}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function He(e,t,n){n>>>=0,H.varargs=n;try{var r=H.getStreamFromFD(e);switch(t){case 21509:return r.tty?0:-59;case 21505:if(!r.tty)return-59;if(r.tty.ops.ioctl_tcgets){var i=r.tty.ops.ioctl_tcgets(r),a=G();z[a>>>2>>>0]=i.c_iflag||0,z[a+4>>>2>>>0]=i.c_oflag||0,z[a+8>>>2>>>0]=i.c_cflag||0,z[a+12>>>2>>>0]=i.c_lflag||0;for(var o=0;o<32;o++)v[a+o+17>>>0]=i.c_cc[o]||0;return 0}return 0;case 21510:case 21511:case 21512:return r.tty?0:-59;case 21506:case 21507:case 21508:if(!r.tty)return-59;if(r.tty.ops.ioctl_tcsets){for(var a=G(),s=z[a>>>2>>>0],c=z[a+4>>>2>>>0],l=z[a+8>>>2>>>0],u=z[a+12>>>2>>>0],d=[],o=0;o<32;o++)d.push(v[a+o+17>>>0]);return r.tty.ops.ioctl_tcsets(r.tty,t,{c_iflag:s,c_oflag:c,c_cflag:l,c_lflag:u,c_cc:d})}return 0;case 21519:if(!r.tty)return-59;var a=G();return z[a>>>2>>>0]=0,0;case 21520:return r.tty?-28:-59;case 21537:case 21531:var a=G();return L.ioctl(r,t,a);case 21523:if(!r.tty)return-59;if(r.tty.ops.ioctl_tiocgwinsz){var f=r.tty.ops.ioctl_tiocgwinsz(r.tty),a=G();K[a>>>1>>>0]=f[0],K[a+2>>>1>>>0]=f[1]}return 0;case 21524:return r.tty?0:-59;case 21515:return r.tty?0:-59;default:return-28}}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Ue(e,t){e>>>=0,t>>>=0;try{return e=H.getStr(e),H.writeStat(t,L.lstat(e))}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function We(e,t,n){t>>>=0;try{return t=H.getStr(t),t=H.calculateAt(e,t),n&=~H.currentUmask,L.mkdir(t,n,0),0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Ge(e,t,n,r){t>>>=0,n>>>=0;try{t=H.getStr(t);var i=r&256,a=r&4096;return r&=-6401,t=H.calculateAt(e,t,a),H.writeStat(n,i?L.lstat(t):L.stat(t))}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Ke(e,t,n,r){t>>>=0,r>>>=0,H.varargs=r;try{t=H.getStr(t),t=H.calculateAt(e,t);var i=r?W():0;return n&64&&(i&=~H.currentUmask),L.open(t,n,i).fd}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function qe(e,t,n,r){t>>>=0,n>>>=0,r>>>=0;try{if(t=H.getStr(t),t=H.calculateAt(e,t),r<=0)return-28;var i=L.readlink(t),a=Math.min(r,T(i)),o=v[n+a>>>0];return q(i,n,r+1),v[n+a>>>0]=o,a}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Je(e,t,n,r){t>>>=0,r>>>=0;try{return t=H.getStr(t),r=H.getStr(r),t=H.calculateAt(e,t),r=H.calculateAt(n,r),L.rename(t,r),0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Ye(e){e>>>=0;try{return e=H.getStr(e),L.rmdir(e),0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Xe(e,t){e>>>=0,t>>>=0;try{return e=H.getStr(e),H.writeStat(t,L.stat(e))}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Ze(e,t,n){e>>>=0,t>>>=0,n>>>=0;try{return H.writeStatFs(n,L.statfs(H.getStr(e))),0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Qe(e,t,n){t>>>=0;try{if(t=H.getStr(t),t=H.calculateAt(e,t),!n)L.unlink(t);else if(n===512)L.rmdir(t);else return-28;return 0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}var $e=()=>_(``),et=e=>e%4==0&&(e%100!=0||e%400==0),tt=[0,31,60,91,121,152,182,213,244,274,305,335],nt=[0,31,59,90,120,151,181,212,243,273,304,334],rt=e=>(et(e.getFullYear())?tt:nt)[e.getMonth()]+e.getDate()-1;function it(e,t){e=U(e),t>>>=0;var n=new Date(e*1e3);if(isNaN(n.getTime()))return 1;z[t>>>2>>>0]=n.getSeconds(),z[t+4>>>2>>>0]=n.getMinutes(),z[t+8>>>2>>>0]=n.getHours(),z[t+12>>>2>>>0]=n.getDate(),z[t+16>>>2>>>0]=n.getMonth(),z[t+20>>>2>>>0]=n.getFullYear()-1900,z[t+24>>>2>>>0]=n.getDay();var r=rt(n)|0;z[t+28>>>2>>>0]=r,z[t+36>>>2>>>0]=-(n.getTimezoneOffset()*60);var i=new Date(n.getFullYear(),0,1),a=new Date(n.getFullYear(),6,1).getTimezoneOffset(),o=i.getTimezoneOffset(),s=(a!=o&&n.getTimezoneOffset()==Math.min(o,a))|0;return z[t+32>>>2>>>0]=s,0}function at(e,t,n,r,i,a){e>>>=0,t>>>=0,a=U(a);try{var o=H.getStreamFromFD(i);n&2&&H.doMsync(e,o,t,r,a)}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}var ot=function(e,t,n,r){e>>>=0,t>>>=0,n>>>=0,r>>>=0;var i=new Date().getFullYear(),a=new Date(i,0,1),o=new Date(i,6,1),s=a.getTimezoneOffset(),c=o.getTimezoneOffset(),l=Math.max(s,c);B[e>>>2>>>0]=l*60,z[t>>>2>>>0]=Number(s!=c);var u=e=>{var t=e>=0?`-`:`+`,n=Math.abs(e);return`UTC${t}${String(Math.floor(n/60)).padStart(2,`0`)}${String(n%60).padStart(2,`0`)}`},d=u(s),f=u(c);c<s?(q(d,n,17),q(f,r,17)):(q(d,r,17),q(f,n,17))},J=()=>performance.now(),st=()=>Date.now(),ct=1,lt=e=>e>=0&&e<=3;function ut(e,t,n){if(t=U(t),n>>>=0,!lt(e))return 28;var r;if(e===0)r=st();else if(ct)r=J();else return 52;var i=Math.round(r*1e3*1e3);return V[n>>>3>>>0]=BigInt(i),0}var dt=()=>4294901760;function ft(){return dt()}var pt=e=>{var t=(e-Q.buffer.byteLength+65535)/65536|0;try{return Q.grow(t),g(),1}catch{}};function mt(e){e>>>=0;var t=O.length,n=dt();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),pt(Math.min(n,Ce(Math.max(e,i),65536))))return!0}return!1}var Y={},ht=()=>o,X=()=>{if(!X.strings){var e={USER:`web_user`,LOGNAME:`web_user`,PATH:`/`,PWD:`/`,HOME:`/home/web_user`,LANG:(globalThis.navigator?.language??`C`).replace(`-`,`_`)+`.UTF-8`,_:ht()};for(var t in Y)Y[t]===void 0?delete e[t]:e[t]=Y[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);X.strings=n}return X.strings};function gt(e,t){e>>>=0,t>>>=0;var n=0,r=0;for(var i of X()){var a=t+n;B[e+r>>>2>>>0]=a,n+=q(i,a,1/0)+1,r+=4}return 0}function _t(e,t){e>>>=0,t>>>=0;var n=X();B[e>>>2>>>0]=n.length;var r=0;for(var i of n)r+=T(i)+1;return B[t>>>2>>>0]=r,0}function vt(e){try{var t=H.getStreamFromFD(e);return L.close(t),0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}function yt(e,t){t>>>=0;try{var n=0,r=0,i=0,a=H.getStreamFromFD(e),o=a.tty?2:L.isDir(a.mode)?3:L.isLink(a.mode)?7:4;return v[t>>>0]=o,K[t+2>>>1>>>0]=i,V[t+8>>>3>>>0]=BigInt(n),V[t+16>>>3>>>0]=BigInt(r),0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}var bt=(e,t,n,r)=>{for(var i=0,a=0;a<n;a++){var o=B[t>>>2>>>0],s=B[t+4>>>2>>>0];t+=8;try{var c=L.read(e,v,o,s,r)}catch(e){if(i>0&&e instanceof L.ErrnoError&&(e.errno==6||e.errno==6))break;throw e}if(c<0)return-1;if(i+=c,c<s)break;r!==void 0&&(r+=c)}return i};function xt(e,t,n,r,i){t>>>=0,n>>>=0,r=U(r),i>>>=0;try{if(isNaN(r))return 22;var a=bt(H.getStreamFromFD(e),t,n,r);return B[i>>>2>>>0]=a,0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}var St=(e,t,n,r)=>{if(n==1)return L.write(e,v,B[t>>>2>>>0],B[t+4>>>2>>>0],r);for(var i=0,a=0,o=t;a<n;a++,o+=8)i+=B[o+4>>>2>>>0];for(var s=new Uint8Array(i),c=0,a=0;a<n;a++,t+=8){var l=B[t>>>2>>>0],u=B[t+4>>>2>>>0];s.set(O.subarray(l>>>0,l+u>>>0),c),c+=u}return L.write(e,s,0,i,r)};function Ct(e,t,n,r,i){t>>>=0,n>>>=0,r=U(r),i>>>=0;try{if(isNaN(r))return 22;var a=St(H.getStreamFromFD(e),t,n,r);return B[i>>>2>>>0]=a,0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}function wt(e,t,n,r){t>>>=0,n>>>=0,r>>>=0;try{var i=bt(H.getStreamFromFD(e),t,n);return B[r>>>2>>>0]=i,0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}function Tt(e,t,n,r){t=U(t),r>>>=0;try{if(isNaN(t))return 22;var i=H.getStreamFromFD(e);return L.llseek(i,t,n),V[r>>>3>>>0]=BigInt(i.position),i.getdents&&t===0&&n===0&&(i.getdents=null),0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}function Et(e){try{var t=H.getStreamFromFD(e);return t.stream_ops?.fsync?.(t)}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}function Dt(e,t,n,r){t>>>=0,n>>>=0,r>>>=0;try{var i=St(H.getStreamFromFD(e),t,n);return B[r>>>2>>>0]=i,0}catch(e){if(L===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}function Ot(e,t){return e>>>=0,t>>>=0,b(O.subarray(e>>>0,e+t>>>0))}L.createPreloadedFile=Ne,L.preloadFile=I,L.staticInit(),t.noExitRuntime&&t.noExitRuntime,t.print&&(p=t.print),t.printErr&&(m=t.printErr),t.arguments&&t.arguments,t.thisProgram&&(o=t.thisProgram);var Z=t.preInit;if(Z)for(typeof Z==`function`&&(t.preInit=Z=[Z]);Z.length>0;)Z.shift()();t.UTF8ToString=R,t.stringToUTF8=q,t.lengthBytesUTF8=T,t.FS=L;var kt,At,Q;function jt(e){t._shim_open=e.shim_open,t._malloc=e.malloc,t._free=e.free,t._shim_close=e.shim_close,t._shim_query=e.shim_query,t._shim_error=e.shim_error,t._shim_destroy_result=e.shim_destroy_result,t._shim_columns=e.shim_columns,t._shim_rows=e.shim_rows,t._shim_column_name=e.shim_column_name,t._shim_column_type=e.shim_column_type,t._shim_is_null=e.shim_is_null,t._shim_value_double=e.shim_value_double,t._shim_value_int64=e.shim_value_int64,t._shim_value_boolean=e.shim_value_boolean,t._shim_value_varchar=e.shim_value_varchar,t._shim_free=e.shim_free,kt=e.emscripten_builtin_memalign,At=e.__trap,e._emscripten_stack_alloc,Q=e.memory,e.__indirect_function_table}var Mt={__syscall_faccessat:Ie,__syscall_fcntl64:Le,__syscall_fstat64:Re,__syscall_ftruncate64:ze,__syscall_getcwd:Be,__syscall_getdents64:Ve,__syscall_ioctl:He,__syscall_lstat64:Ue,__syscall_mkdirat:We,__syscall_newfstatat:Ge,__syscall_openat:Ke,__syscall_readlinkat:qe,__syscall_renameat:Je,__syscall_rmdir:Ye,__syscall_stat64:Xe,__syscall_statfs64:Ze,__syscall_unlinkat:Qe,_abort_js:$e,_localtime_js:it,_munmap_js:at,_tzset_js:ot,clock_time_get:ut,emscripten_get_heap_max:ft,emscripten_get_now:J,emscripten_resize_heap:mt,environ_get:gt,environ_sizes_get:_t,fd_close:vt,fd_fdstat_get:yt,fd_pread:xt,fd_pwrite:Ct,fd_read:wt,fd_seek:Tt,fd_sync:Et,fd_write:Dt,random_get:Ot};function Nt(e){e=Object.assign({},e);var t=e=>t=>e(t)>>>0;return e.malloc=t(e.malloc),e.emscripten_builtin_memalign=(e=>(t,n)=>e(t,n)>>>0)(e.emscripten_builtin_memalign),e._emscripten_stack_alloc=t(e._emscripten_stack_alloc),e}async function Pt(){ie(),P&&await Oe();var e=t.setStatus;e&&(e(`Running...`),await new Promise(e=>setTimeout(e,1)),setTimeout(e,1,``)),!h&&(ae(),t.onRuntimeInitialized?.(),oe())}var $=await me();return await Pt(),t}const n=new Set([2,3,4,5,6,7,8,9]),r=new Set([10,11]);function i(e){return{load:i,open:a,close:o,query:s};function t(t){let n=e.lengthBytesUTF8(t)+1,r=e._malloc(n);return e.stringToUTF8(t,r,n),r}function i(t,n){return e.FS.writeFile(t,new Uint8Array(n)),t}function a(n){let r=t(n),i=e._shim_open(r);if(e._free(r),i)return i;throw Error(`duckdb open failed: ${n}`)}function o(t){return e._shim_close(t),null}function s(n,r){let i=t(r),a=e._shim_query(n,i);e._free(i);let o=e._shim_error(a);if(o){let t=e.UTF8ToString(o);throw e._shim_destroy_result(a),Error(`duckdb query: ${t}`)}try{return c(a)}finally{e._shim_destroy_result(a)}}function c(t){let n=e._shim_columns(t),r=e._shim_rows(t),i=[],a=[];for(let r=0;r<n;r++)i.push(e.UTF8ToString(e._shim_column_name(t,r))),a.push(e._shim_column_type(t,r));let o=[];for(let e=0;e<r;e++){let r={};for(let o=0;o<n;o++)r[i[o]]=l(t,o,e,a[o]);o.push(r)}return o}function l(t,i,a,o){if(e._shim_is_null(t,i,a))return null;if(o===1)return e._shim_value_boolean(t,i,a)===1;if(n.has(o))return Number(e._shim_value_int64(t,i,a));if(r.has(o))return e._shim_value_double(t,i,a);{let n=e._shim_value_varchar(t,i,a),r=e.UTF8ToString(n);return e._shim_free(n),r}}}let a=null,o=null,s=0;const c=new WeakMap;function l(e){a=e}async function u(t){let n=await d(),r=await f(n,t),i=n.open(r),a=async e=>n.query(i,e);return{query:a,exec:e=>n.query(i,e),run:e=>n.query(i,e),close:()=>n.close(i),...e(a)}}async function d(){if(o===null)if(a)o=i(await t({wasmBinary:a}));else throw Error(`duckdb wasm not loaded: call setWasmBinary(bytes) with wasm/duckdb.wasm`);return o}async function f(e,t){if(c.has(t))return c.get(t);{s+=1;let n=`db-${s}.duckdb`,r=e.load(n,await p(t));return c.set(t,r),r}}async function p(e){return e instanceof ArrayBuffer?e:e.arrayBuffer?await e.arrayBuffer():e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}export{l as n,u as t};
1
+ async function e(e={}){var t=e,n=!!globalThis.window,r=!!globalThis.WorkerGlobalScope,i=globalThis.process?.versions?.node&&globalThis.process?.type!=`renderer`;if(i){let{createRequire:e}=await import(`node:module`);var a=e(import.meta.url)}var o=`./this.program`,s=(e,t)=>{throw t},c=import.meta.url,l=``;function u(e){return t.locateFile?t.locateFile(e,l):l+e}var d,f;if(i){var p=a("node:fs");c.startsWith(`file:`)&&(l=a("node:path").dirname(a("node:url").fileURLToPath(c))+`/`),f=e=>(e=ee(e)?new URL(e):e,p.readFileSync(e)),d=async(e,t=!0)=>(e=ee(e)?new URL(e):e,p.readFileSync(e,t?void 0:`utf8`)),process.argv.length>1&&(o=process.argv[1].replace(/\\/g,`/`)),process.argv.slice(2),s=(e,t)=>{throw process.exitCode=e,t}}else if(n||r){try{l=new URL(`.`,c).href}catch{}r&&(f=e=>{var t=new XMLHttpRequest;return t.open(`GET`,e,!1),t.responseType=`arraybuffer`,t.send(null),new Uint8Array(t.response)}),d=async e=>{var t=await fetch(e,{credentials:`same-origin`});if(t.ok)return t.arrayBuffer();throw Error(t.status+` : `+t.url)}}var m=console.log.bind(console),h=console.error.bind(console),g,_=!1,ee=e=>e.startsWith(`file://`),te=!1;function ne(){return Z.buffer}function re(){if(!b?.buffer?.resizable){var e=ne();b=new Int8Array(e),K=new Int16Array(e),t.HEAPU8=A=new Uint8Array(e),z=new Int32Array(e),B=new Uint32Array(e),V=new BigInt64Array(e)}}function ie(){var e=t.preRun;e&&(typeof e==`function`&&(e=[e]),_e.push(...e)),he(_e)}function ae(){te=!0,!t.noFSInit&&!R.initialized&&R.init(),k.init(),$.__wasm_call_ctors(),R.ignorePermissions=!1}function oe(){var e=t.postRun;e&&(typeof e==`function`&&(e=[e]),ge.push(...e)),he(ge)}function v(e){throw t.onAbort?.(e),e=`Aborted(${e})`,h(e),_=!0,e+=`. Build with -sASSERTIONS for more info.`,te&&zt(),new WebAssembly.RuntimeError(e)}var y;function se(){return t.locateFile?u(`duckdb.wasm`):`duckdb.wasm`}function ce(e){if(f)return f(e);throw`both async and sync fetching of the wasm failed`}async function le(e){if(!g)try{var t=await d(e);return new Uint8Array(t)}catch{}return ce(e)}async function ue(e,t){try{var n=await le(e);return await WebAssembly.instantiate(n,t)}catch(e){h(`failed to asynchronously prepare wasm: ${e}`),v(e)}}async function de(e,t,n){if(!e&&!i)try{var r=fetch(t,{credentials:`same-origin`});return await WebAssembly.instantiateStreaming(r,n)}catch(e){h(`wasm streaming compile failed: ${e}`),h(`falling back to ArrayBuffer instantiation`)}return ue(t,n)}function fe(){return{env:Q,wasi_snapshot_preview1:Q}}async function pe(){function e(e){return $=e.exports,$=Vt($),Bt($),re(),$}function n(t){return e(t.instance)}var r=fe(),i=t.instantiateWasm;return i?new Promise(t=>{i(r,n=>t(e(n)))}):(y??=se(),n(await de(g,y,r)))}class me{name=`ExitStatus`;constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var b,he=e=>{for(;e.length>0;)e.shift()(t)},ge=[],_e=[],ve=!0,x={isAbs:e=>e.charAt(0)===`/`,splitPath:e=>/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(e).slice(1),normalizeArray:(e,t)=>{for(var n=0,r=e.length-1;r>=0;r--){var i=e[r];i===`.`?e.splice(r,1):i===`..`?(e.splice(r,1),n++):n&&(e.splice(r,1),n--)}if(t)for(;n;n--)e.unshift(`..`);return e},normalize:e=>{var t=x.isAbs(e),n=e.slice(-1)===`/`;return e=x.normalizeArray(e.split(`/`).filter(e=>!!e),!t).join(`/`),!e&&!t&&(e=`.`),e&&n&&(e+=`/`),(t?`/`:``)+e},dirname:e=>{var t=x.splitPath(e),n=t[0],r=t[1];return!n&&!r?`.`:(r&&=r.slice(0,-1),n+r)},basename:e=>e&&e.match(/([^\/]+|\/)\/*$/)[1],join:(...e)=>x.normalize(e.join(`/`)),join2:(e,t)=>x.normalize(e+`/`+t)},ye=()=>{if(i){var e=a("node:crypto");return t=>(e.randomFillSync(t),0)}return e=>(crypto.getRandomValues(e),0)},S=e=>(S=ye())(e),C={resolve:(...e)=>{for(var t=``,n=!1,r=e.length-1;r>=-1&&!n;r--){var i=r>=0?e[r]:R.cwd();if(typeof i!=`string`)throw TypeError(`Arguments to path.resolve must be strings`);if(!i)return``;t=i+`/`+t,n=x.isAbs(i)}return t=x.normalizeArray(t.split(`/`).filter(e=>!!e),!n).join(`/`),(n?`/`:``)+t||`.`},relative:(e,t)=>{e=C.resolve(e).slice(1),t=C.resolve(t).slice(1);function n(e){for(var t=0;t<e.length&&e[t]===``;t++);for(var n=e.length-1;n>=0&&e[n]===``;n--);return t>n?[]:e.slice(t,n-t+1)}for(var r=n(e.split(`/`)),i=n(t.split(`/`)),a=Math.min(r.length,i.length),o=a,s=0;s<a;s++)if(r[s]!==i[s]){o=s;break}for(var c=[],s=o;s<r.length;s++)c.push(`..`);return c=c.concat(i.slice(o)),c.join(`/`)}},be=globalThis.TextDecoder&&new TextDecoder,xe=(e,t,n,r)=>{var i=t+n;if(r)return i;for(;e[t]&&!(t>=i);)++t;return t},w=(e,t=0,n,r)=>{t>>>=0;var i=xe(e,t,n,r);if(i-t>16&&e.buffer&&be)return be.decode(e.subarray(t,i));for(var a=``;t<i;){var o=e[t++];if(!(o&128)){a+=String.fromCharCode(o);continue}var s=e[t++]&63;if((o&224)==192){a+=String.fromCharCode((o&31)<<6|s);continue}var c=e[t++]&63;if(o=(o&240)==224?(o&15)<<12|s<<6|c:(o&7)<<18|s<<12|c<<6|e[t++]&63,o<65536)a+=String.fromCharCode(o);else{var l=o-65536;a+=String.fromCharCode(55296|l>>10,56320|l&1023)}}return a},T=[],E=e=>{for(var t=0,n=0;n<e.length;++n){var r=e.charCodeAt(n);r<=127?t++:r<=2047?t+=2:r>=55296&&r<=57343?(t+=4,++n):t+=3}return t},D=(e,t,n,r)=>{if(n>>>=0,!(r>0))return 0;for(var i=n,a=n+r-1,o=0;o<e.length;++o){var s=e.codePointAt(o);if(s<=127){if(n>=a)break;t[n++>>>0]=s}else if(s<=2047){if(n+1>=a)break;t[n++>>>0]=192|s>>6,t[n++>>>0]=128|s&63}else if(s<=65535){if(n+2>=a)break;t[n++>>>0]=224|s>>12,t[n++>>>0]=128|s>>6&63,t[n++>>>0]=128|s&63}else{if(n+3>=a)break;t[n++>>>0]=240|s>>18,t[n++>>>0]=128|s>>12&63,t[n++>>>0]=128|s>>6&63,t[n++>>>0]=128|s&63,o++}}return t[n>>>0]=0,n-i},O=(e,t,n)=>{var r=n>0?n:E(e)+1,i=Array(r),a=D(e,i,0,i.length);return t&&(i.length=a),i},Se=()=>{if(!T.length){var e=null;if(i){var t=256,n=Buffer.alloc(t),r=0,a=process.stdin.fd;try{r=p.readSync(a,n,0,t)}catch(e){if(e.toString().includes(`EOF`))r=0;else throw e}r>0&&(e=n.slice(0,r).toString(`utf-8`))}else globalThis.window?.prompt&&(e=window.prompt(`Input: `),e!==null&&(e+=`
2
+ `));if(!e)return null;T=O(e,!0)}return T.shift()},k={ttys:[],init(){},shutdown(){},register(e,t){k.ttys[e]={input:[],output:[],ops:t},R.registerDevice(e,k.stream_ops)},stream_ops:{open(e){var t=k.ttys[e.node.rdev];if(!t)throw new R.ErrnoError(43);e.tty=t,e.seekable=!1},close(e){e.tty.ops.fsync(e.tty)},fsync(e){e.tty.ops.fsync(e.tty)},read(e,t,n,r,i){if(!e.tty||!e.tty.ops.get_char)throw new R.ErrnoError(60);for(var a=0,o=0;o<r;o++){var s;try{s=e.tty.ops.get_char(e.tty)}catch{throw new R.ErrnoError(29)}if(s===void 0&&!a)throw new R.ErrnoError(6);if(s==null)break;a++,t[n+o]=s}return a&&(e.node.atime=Date.now()),a},write(e,t,n,r,i){if(!e.tty||!e.tty.ops.put_char)throw new R.ErrnoError(60);try{for(var a=0;a<r;a++)e.tty.ops.put_char(e.tty,t[n+a])}catch{throw new R.ErrnoError(29)}return r&&(e.node.mtime=e.node.ctime=Date.now()),a}},default_tty_ops:{get_char(e){return Se()},put_char(e,t){t===null||t===10?(m(w(e.output)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output?.length>0&&(m(w(e.output)),e.output=[])},ioctl_tcgets(e){return{c_iflag:25856,c_oflag:5,c_cflag:191,c_lflag:35387,c_cc:[3,28,127,21,4,0,1,0,17,19,26,0,18,15,23,22,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]}},ioctl_tcsets(e,t,n){return 0},ioctl_tiocgwinsz(e){return[24,80]}},default_tty1_ops:{put_char(e,t){t===null||t===10?(h(w(e.output)),e.output=[]):t!=0&&e.output.push(t)},fsync(e){e.output?.length>0&&(h(w(e.output)),e.output=[])}}},A,Ce=(e,t)=>A.fill(0,e,e+t),j=(e,t)=>Math.ceil(e/t)*t,M=e=>{e=j(e,65536);var t=Rt(65536,e);return t&&Ce(t,e),t},N={ops_table:null,mount(e){return N.createNode(null,`/`,16895,0)},createNode(e,t,n,r){if(R.isBlkdev(n)||R.isFIFO(n))throw new R.ErrnoError(63);N.ops_table||={dir:{node:{getattr:N.node_ops.getattr,setattr:N.node_ops.setattr,lookup:N.node_ops.lookup,mknod:N.node_ops.mknod,rename:N.node_ops.rename,unlink:N.node_ops.unlink,rmdir:N.node_ops.rmdir,readdir:N.node_ops.readdir,symlink:N.node_ops.symlink},stream:{llseek:N.stream_ops.llseek}},file:{node:{getattr:N.node_ops.getattr,setattr:N.node_ops.setattr},stream:{llseek:N.stream_ops.llseek,read:N.stream_ops.read,write:N.stream_ops.write,mmap:N.stream_ops.mmap,msync:N.stream_ops.msync}},link:{node:{getattr:N.node_ops.getattr,setattr:N.node_ops.setattr,readlink:N.node_ops.readlink},stream:{}},chrdev:{node:{getattr:N.node_ops.getattr,setattr:N.node_ops.setattr},stream:R.chrdev_stream_ops}};var i=R.createNode(e,t,n,r);return R.isDir(i.mode)?(i.node_ops=N.ops_table.dir.node,i.stream_ops=N.ops_table.dir.stream,i.contents={}):R.isFile(i.mode)?(i.node_ops=N.ops_table.file.node,i.stream_ops=N.ops_table.file.stream,i.usedBytes=0,i.contents=N.emptyFileContents??=new Uint8Array):R.isLink(i.mode)?(i.node_ops=N.ops_table.link.node,i.stream_ops=N.ops_table.link.stream):R.isChrdev(i.mode)&&(i.node_ops=N.ops_table.chrdev.node,i.stream_ops=N.ops_table.chrdev.stream),i.atime=i.mtime=i.ctime=Date.now(),e&&(e.contents[t]=i,e.atime=e.mtime=e.ctime=i.atime),i},getFileDataAsTypedArray(e){return e.contents.subarray(0,e.usedBytes)},expandFileStorage(e,t){var n=e.contents.length;if(!(n>=t)){t=Math.max(t,n*(n<1048576?2:1.125)>>>0),n&&(t=Math.max(t,256));var r=N.getFileDataAsTypedArray(e);e.contents=new Uint8Array(t),e.contents.set(r)}},resizeFileStorage(e,t){if(e.usedBytes!=t){var n=e.contents;e.contents=new Uint8Array(t),e.contents.set(n.subarray(0,Math.min(t,e.usedBytes))),e.usedBytes=t}},node_ops:{getattr(e){var t={};return t.dev=R.isChrdev(e.mode)?e.id:1,t.ino=e.id,t.mode=e.mode,t.nlink=1,t.uid=0,t.gid=0,t.rdev=e.rdev,t.size=R.isDir(e.mode)?4096:R.isFile(e.mode)?e.usedBytes:R.isLink(e.mode)?e.link.length:0,t.atime=new Date(e.atime),t.mtime=new Date(e.mtime),t.ctime=new Date(e.ctime),t.blksize=4096,t.blocks=Math.ceil(t.size/t.blksize),t},setattr(e,t){for(let n of[`mode`,`atime`,`mtime`,`ctime`])t[n]!=null&&(e[n]=t[n]);t.size!==void 0&&N.resizeFileStorage(e,t.size)},lookup(e,t){throw N.doesNotExistError||(N.doesNotExistError=new R.ErrnoError(44),N.doesNotExistError.stack=`<generic error, no stack>`),N.doesNotExistError},mknod(e,t,n,r){return N.createNode(e,t,n,r)},rename(e,t,n){var r;try{r=R.lookupNode(t,n)}catch{}if(r){if(R.isDir(e.mode))for(var i in r.contents)throw new R.ErrnoError(55);R.hashRemoveNode(r)}delete e.parent.contents[e.name],t.contents[n]=e,e.name=n,t.ctime=t.mtime=e.parent.ctime=e.parent.mtime=Date.now()},unlink(e,t){delete e.contents[t],e.ctime=e.mtime=Date.now()},rmdir(e,t){for(var n in R.lookupNode(e,t).contents)throw new R.ErrnoError(55);delete e.contents[t],e.ctime=e.mtime=Date.now()},readdir(e){return[`.`,`..`,...Object.keys(e.contents)]},symlink(e,t,n){var r=N.createNode(e,t,41471,0);return r.link=n,r},readlink(e){if(!R.isLink(e.mode))throw new R.ErrnoError(28);return e.link}},stream_ops:{read(e,t,n,r,i){var a=e.node.contents;if(i>=e.node.usedBytes)return 0;var o=Math.min(e.node.usedBytes-i,r);return t.set(a.subarray(i,i+o),n),o},write(e,t,n,r,i,a){if(t.buffer===b.buffer&&(a=!1),!r)return 0;var o=e.node;return o.mtime=o.ctime=Date.now(),a?(o.contents=t.subarray(n,n+r),o.usedBytes=r):!o.usedBytes&&!i?(o.contents=t.slice(n,n+r),o.usedBytes=r):(N.expandFileStorage(o,i+r),o.contents.set(t.subarray(n,n+r),i),o.usedBytes=Math.max(o.usedBytes,i+r)),r},llseek(e,t,n){var r=t;if(n===1?r+=e.position:n===2&&R.isFile(e.node.mode)&&(r+=e.node.usedBytes),r<0)throw new R.ErrnoError(28);return r},mmap(e,t,n,r,i){if(!R.isFile(e.node.mode))throw new R.ErrnoError(43);var a,o,s=e.node.contents;if(!(i&2)&&s.buffer===b.buffer)o=!1,a=s.byteOffset;else{if(o=!0,a=M(t),!a)throw new R.ErrnoError(48);s&&((n>0||n+t<s.length)&&(s=s.subarray?s.subarray(n,n+t):Array.prototype.slice.call(s,n,n+t)),b.set(s,a>>>0))}return{ptr:a,allocated:o}},msync(e,t,n,r,i){return N.stream_ops.write(e,t,0,r,n,!1),0}}},we=e=>{if(typeof e!=`string`)return e;var t={r:0,"r+":2,w:577,"w+":578,a:1089,"a+":1090}[e];if(t===void 0)throw Error(`Unknown file open mode: ${e}`);return t},P=e=>(typeof e==`string`&&(e=O(e,!0)),e.subarray||(e=new Uint8Array(e)),e),F=(e,t)=>{var n=0;return e&&(n|=365),t&&(n|=146),n},Te=async e=>{var t=await d(e);return new Uint8Array(t)},Ee=(...e)=>R.createDataFile(...e),De=e=>e,Oe=null,ke=async()=>Oe,I=0,Ae=null,je=e=>{I--,t.monitorRunDependencies?.(I),I||Ae()},Me=e=>{I||(Oe=new Promise(e=>Ae=e)),I++,t.monitorRunDependencies?.(I)},Ne=[],Pe=async(e,t)=>{typeof Browser<`u`&&Browser.init();for(var n of Ne)if(n.canHandle(t))return n.handle(e,t);return e},L=async(e,t,n,r,i,a,o,s)=>{var c=t?C.resolve(x.join2(e,t)):e,l=De(`cp ${c}`);Me(l);try{var u=n;typeof n==`string`&&(u=await Te(n)),u=await Pe(u,c),s?.(),a||Ee(e,t,u,r,i,o)}finally{je(l)}},Fe=(e,t,n,r,i,a,o,s,c,l)=>{L(e,t,n,r,i,s,c,l).then(a).catch(o)},R={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)}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,t,n,r){e||=this,this.parent=e,this.mount=e.mount,this.id=R.nextInode++,this.name=t,this.mode=n,this.rdev=r,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 R.isDir(this.mode)}get isDevice(){return R.isChrdev(this.mode)}addListener(e,t=!1){var n={cb:e,exclusive:t},r=this.listeners??=new Set;return r.add(n),{listeners:r,entry:n}}notifyListeners(e){if(this.listeners){var t;for(var n of this.listeners)n.exclusive?(t||=[]).push(n):n.cb(e);if(t){var r=(this.exclTurn||0)%t.length;this.exclTurn=r+1,t[r].cb(e)}}}},lookupPath(e,t={}){if(!e)throw new R.ErrnoError(44);t.follow_mount??=!0,x.isAbs(e)||(e=R.cwd()+`/`+e);linkloop:for(var n=0;n<40;n++){for(var r=e.split(`/`).filter(e=>!!e),i=R.root,a=`/`,o=0;o<r.length;o++){var s=o===r.length-1;if(s&&t.parent)break;if(r[o]!==`.`){if(r[o]===`..`){if(a=x.dirname(a),R.isRoot(i)){e=a+`/`+r.slice(o+1).join(`/`),n--;continue linkloop}i=i.parent;continue}a=x.join2(a,r[o]);try{i=R.lookupNode(i,r[o])}catch(e){if(e?.errno===44&&s&&t.noent_okay)return{path:a};throw e}if(R.isMountpoint(i)&&(!s||t.follow_mount)&&(i=i.mounted.root),R.isLink(i.mode)&&(!s||t.follow)){if(!i.node_ops.readlink)throw new R.ErrnoError(52);var c=i.node_ops.readlink(i);x.isAbs(c)||(c=x.dirname(a)+`/`+c),e=c+`/`+r.slice(o+1).join(`/`);continue linkloop}}}return{path:a,node:i}}throw new R.ErrnoError(32)},getPath(e){for(var t;;){if(R.isRoot(e)){var n=e.mount.mountpoint;return t?n[n.length-1]===`/`?n+t:`${n}/${t}`:n}t=t?`${e.name}/${t}`:e.name,e=e.parent}},hashName(e,t){for(var n=0,r=0;r<t.length;r++)n=(n<<5)-n+t.charCodeAt(r)|0;return(e+n>>>0)%R.nameTable.length},hashAddNode(e){var t=R.hashName(e.parent.id,e.name);e.name_next=R.nameTable[t],R.nameTable[t]=e},hashRemoveNode(e){var t=R.hashName(e.parent.id,e.name);if(R.nameTable[t]===e)R.nameTable[t]=e.name_next;else for(var n=R.nameTable[t];n;){if(n.name_next===e){n.name_next=e.name_next;break}n=n.name_next}},lookupNode(e,t){var n=R.mayLookup(e);if(n)throw new R.ErrnoError(n);for(var r=R.hashName(e.id,t),i=R.nameTable[r];i;i=i.name_next){var a=i.name;if(i.parent.id===e.id&&a===t)return i}return R.lookup(e,t)},createNode(e,t,n,r){var i=new R.FSNode(e,t,n,r);return R.hashAddNode(i),i},destroyNode(e){R.hashRemoveNode(e)},isRoot(e){return e===e.parent},isMountpoint(e){return!!e.mounted},isFile(e){return(e&61440)==32768},isDir(e){return(e&61440)==16384},isLink(e){return(e&61440)==40960},isChrdev(e){return(e&61440)==8192},isBlkdev(e){return(e&61440)==24576},isFIFO(e){return(e&61440)==4096},isSocket(e){return(e&49152)==49152},flagsToPermissionString(e){var t=[`r`,`w`,`rw`][e&3];return e&512&&(t+=`w`),t},nodePermissions(e,t){return R.ignorePermissions?0:t.includes(`r`)&&!(e.mode&292)||t.includes(`w`)&&!(e.mode&146)||t.includes(`x`)&&!(e.mode&73)?2:0},mayLookup(e){return R.isDir(e.mode)?R.nodePermissions(e,`x`)||(e.node_ops.lookup?0:2):54},mayCreate(e,t){if(!R.isDir(e.mode))return 54;try{return R.lookupNode(e,t),20}catch{}return R.nodePermissions(e,`wx`)},mayDelete(e,t,n){var r;try{r=R.lookupNode(e,t)}catch(e){return e.errno}var i=R.nodePermissions(e,`wx`);if(i)return i;if(n){if(!R.isDir(r.mode))return 54;if(R.isRoot(r)||R.getPath(r)===R.cwd())return 10}else if(R.isDir(r.mode))return 31;return 0},mayOpen(e,t){if(!e)return 44;if(R.isLink(e.mode))return 32;var n=R.flagsToPermissionString(t);return R.isDir(e.mode)&&(n!==`r`||t&576)?31:R.nodePermissions(e,n)},checkOpExists(e,t){if(!e)throw new R.ErrnoError(t);return e},MAX_OPEN_FDS:4096,nextfd(){for(var e=0;e<=R.MAX_OPEN_FDS;e++)if(!R.streams[e])return e;throw new R.ErrnoError(33)},getStreamChecked(e){var t=R.getStream(e);if(!t)throw new R.ErrnoError(8);return t},getStream:e=>R.streams[e],createStream(e,t=-1){return e=Object.assign(new R.FSStream,e),t==-1&&(t=R.nextfd()),e.fd=t,R.streams[t]=e,e},closeStream(e){R.streams[e]=null},dupStream(e,t=-1){var n=R.createStream(e,t);return n.stream_ops?.dup?.(n),n},doSetAttr(e,t,n){var r=e?.stream_ops.setattr,i=r?e:t;r??=t.node_ops.setattr,R.checkOpExists(r,63);try{r(i,n)}catch(e){throw e instanceof RangeError?new R.ErrnoError(22):e}},chrdev_stream_ops:{open(e){e.stream_ops=R.getDevice(e.node.rdev).stream_ops,e.stream_ops.open?.(e)},llseek(){throw new R.ErrnoError(70)}},major:e=>e>>8,minor:e=>e&255,makedev:(e,t)=>e<<8|t,registerDevice(e,t){R.devices[e]={stream_ops:t}},getDevice:e=>R.devices[e],getMounts(e){for(var t=[],n=[e];n.length;){var r=n.pop();t.push(r),n.push(...r.mounts)}return t},syncfs(e,t){typeof e==`function`&&(t=e,e=!1),R.syncFSRequests++,R.syncFSRequests>1&&h(`warning: ${R.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);var n=R.getMounts(R.root.mount),r=0;function i(e){return R.syncFSRequests--,t(e)}function a(e){if(e)return a.errored?void 0:(a.errored=!0,i(e));++r>=n.length&&i(null)}for(var o of n)o.type.syncfs?o.type.syncfs(o,e,a):a(null)},mount(e,t,n){var r=n===`/`,i=!n,a;if(r&&R.root)throw new R.ErrnoError(10);if(!r&&!i){var o=R.lookupPath(n,{follow_mount:!1});if(n=o.path,a=o.node,R.isMountpoint(a))throw new R.ErrnoError(10);if(!R.isDir(a.mode))throw new R.ErrnoError(54)}var s={type:e,opts:t,mountpoint:n,mounts:[]},c=e.mount(s);return c.mount=s,s.root=c,r?R.root=c:a&&(a.mounted=s,a.mount&&a.mount.mounts.push(s)),c},unmount(e){var t=R.lookupPath(e,{follow_mount:!1});if(!R.isMountpoint(t.node))throw new R.ErrnoError(28);var n=t.node,r=n.mounted,i=R.getMounts(r);for(var[a,o]of Object.entries(R.nameTable))for(;o;){var s=o.name_next;i.includes(o.mount)&&R.destroyNode(o),o=s}n.mounted=null;var c=n.mount.mounts.indexOf(r);n.mount.mounts.splice(c,1)},lookup(e,t){return e.node_ops.lookup(e,t)},mknod(e,t,n){var r=R.lookupPath(e,{parent:!0}).node,i=x.basename(e);if(!i)throw new R.ErrnoError(28);if(i===`.`||i===`..`)throw new R.ErrnoError(20);var a=R.mayCreate(r,i);if(a)throw new R.ErrnoError(a);if(!r.node_ops.mknod)throw new R.ErrnoError(63);return r.node_ops.mknod(r,i,t,n)},statfs(e){return R.statfsNode(R.lookupPath(e,{follow:!0}).node)},statfsStream(e){return R.statfsNode(e.node)},statfsNode(e){var t={bsize:4096,frsize:4096,blocks:1e6,bfree:5e5,bavail:5e5,files:R.nextInode,ffree:R.nextInode-1,fsid:42,flags:2,namelen:255};return e.node_ops.statfs&&Object.assign(t,e.node_ops.statfs(e.mount.opts.root)),t},create(e,t=438){return t&=4095,t|=32768,R.mknod(e,t,0)},mkdir(e,t=511){return t&=1023,t|=16384,R.mknod(e,t,0)},mkdirTree(e,t){var n=e.split(`/`),r=``;for(var i of n)if(i){(r||x.isAbs(e))&&(r+=`/`),r+=i;try{R.mkdir(r,t)}catch(e){if(e.errno!=20)throw e}}},mkdev(e,t,n){return n===void 0&&(n=t,t=438),t|=8192,R.mknod(e,t,n)},symlink(e,t){if(!C.resolve(e))throw new R.ErrnoError(44);var n=R.lookupPath(t,{parent:!0}).node;if(!n)throw new R.ErrnoError(44);var r=x.basename(t),i=R.mayCreate(n,r);if(i)throw new R.ErrnoError(i);if(!n.node_ops.symlink)throw new R.ErrnoError(63);return n.node_ops.symlink(n,r,e)},link(e,t,n){var r=R.lookupPath(t,{parent:!0}).node;if(!r)throw new R.ErrnoError(44);var i=x.basename(t),a=R.mayCreate(r,i);if(a)throw new R.ErrnoError(a);if(!r.node_ops.link)throw new R.ErrnoError(34);return r.node_ops.link(r,i,e,n)},rename(e,t){var n=x.dirname(e),r=x.dirname(t),i=x.basename(e),a=x.basename(t),o=R.lookupPath(e,{parent:!0}),s=o.node,c;if(o=R.lookupPath(t,{parent:!0}),c=o.node,!s||!c)throw new R.ErrnoError(44);if(s.mount!==c.mount)throw new R.ErrnoError(75);var l=R.lookupNode(s,i),u=C.relative(e,r);if(u.charAt(0)!==`.`)throw new R.ErrnoError(28);if(u=C.relative(t,n),u.charAt(0)!==`.`)throw new R.ErrnoError(55);var d;try{d=R.lookupNode(c,a)}catch{}if(l!==d){var f=R.isDir(l.mode),p=R.mayDelete(s,i,f);if(p||(p=d?R.mayDelete(c,a,f):R.mayCreate(c,a),p))throw new R.ErrnoError(p);if(!s.node_ops.rename)throw new R.ErrnoError(63);if(R.isMountpoint(l)||d&&R.isMountpoint(d))throw new R.ErrnoError(10);if(c!==s&&(p=R.nodePermissions(s,`w`),p))throw new R.ErrnoError(p);R.hashRemoveNode(l);try{s.node_ops.rename(l,c,a),l.parent=c}catch(e){throw e}finally{R.hashAddNode(l)}}},rmdir(e){var t=R.lookupPath(e,{parent:!0}).node,n=x.basename(e),r=R.lookupNode(t,n),i=R.mayDelete(t,n,!0);if(i)throw new R.ErrnoError(i);if(!t.node_ops.rmdir)throw new R.ErrnoError(63);if(R.isMountpoint(r))throw new R.ErrnoError(10);t.node_ops.rmdir(t,n),R.destroyNode(r)},readdir(e){var t=R.lookupPath(e,{follow:!0}).node;return R.checkOpExists(t.node_ops.readdir,54)(t)},unlink(e){var t=R.lookupPath(e,{parent:!0}).node;if(!t)throw new R.ErrnoError(44);var n=x.basename(e),r=R.lookupNode(t,n),i=R.mayDelete(t,n,!1);if(i)throw new R.ErrnoError(i);if(!t.node_ops.unlink)throw new R.ErrnoError(63);if(R.isMountpoint(r))throw new R.ErrnoError(10);t.node_ops.unlink(t,n),R.destroyNode(r)},readlink(e){var t=R.lookupPath(e).node;if(!t)throw new R.ErrnoError(44);if(!t.node_ops.readlink)throw new R.ErrnoError(28);return t.node_ops.readlink(t)},stat(e,t){var n=R.lookupPath(e,{follow:!t}).node;return R.checkOpExists(n.node_ops.getattr,63)(n)},fstat(e){var t=R.getStreamChecked(e),n=t.node,r=t.stream_ops.getattr,i=r?t:n;return r??=n.node_ops.getattr,R.checkOpExists(r,63),r(i)},lstat(e){return R.stat(e,!0)},doChmod(e,t,n,r){R.doSetAttr(e,t,{mode:n&4095|t.mode&-4096,ctime:Date.now(),dontFollow:r})},chmod(e,t,n){var r=typeof e==`string`?R.lookupPath(e,{follow:!n}).node:e;R.doChmod(null,r,t,n)},lchmod(e,t){R.chmod(e,t,!0)},fchmod(e,t){var n=R.getStreamChecked(e);R.doChmod(n,n.node,t,!1)},doChown(e,t,n){R.doSetAttr(e,t,{timestamp:Date.now(),dontFollow:n})},chown(e,t,n,r){var i=typeof e==`string`?R.lookupPath(e,{follow:!r}).node:e;R.doChown(null,i,r)},lchown(e,t,n){R.chown(e,t,n,!0)},fchown(e,t,n){var r=R.getStreamChecked(e);R.doChown(r,r.node,!1)},doTruncate(e,t,n){if(R.isDir(t.mode))throw new R.ErrnoError(31);if(!R.isFile(t.mode))throw new R.ErrnoError(28);var r=R.nodePermissions(t,`w`);if(r)throw new R.ErrnoError(r);R.doSetAttr(e,t,{size:n,timestamp:Date.now()})},truncate(e,t){if(t<0)throw new R.ErrnoError(28);var n=typeof e==`string`?R.lookupPath(e,{follow:!0}).node:e;R.doTruncate(null,n,t)},ftruncate(e,t){var n=R.getStreamChecked(e);if(t<0||!(n.flags&2097155))throw new R.ErrnoError(28);R.doTruncate(n,n.node,t)},utime(e,t,n,r){var i=R.lookupPath(e,{follow:!r});R.doSetAttr(null,i.node,{atime:t,mtime:n,dontFollow:r})},open(e,t,n=438){if(e===``)throw new R.ErrnoError(44);t=we(t),n=t&64?n&4095|32768:0;var r,i;if(typeof e==`object`)r=e;else{i=e.endsWith(`/`);var a=R.lookupPath(e,{follow:!(t&131072),noent_okay:!0});r=a.node,e=a.path}var o=!1;if(t&64){if(r){if(t&128)throw new R.ErrnoError(20)}else if(i)throw new R.ErrnoError(31);else r=R.mknod(e,n|511,0),o=!0}if(!r)throw new R.ErrnoError(44);if(R.isChrdev(r.mode)&&(t&=-513),t&65536&&!R.isDir(r.mode))throw new R.ErrnoError(54);if(!o){var s=R.mayOpen(r,t);if(s)throw new R.ErrnoError(s)}t&512&&!o&&R.truncate(r,0),t&=-131713;var c=R.createStream({node:r,path:R.getPath(r),flags:t,seekable:!0,position:0,stream_ops:r.stream_ops,ungotten:[],error:!1});return c.stream_ops.open&&c.stream_ops.open(c),o&&R.chmod(r,n&511),c},close(e){if(R.isClosed(e))throw new R.ErrnoError(8);e.getdents&&=null,e.node?.notifyListeners(32);try{e.stream_ops.close&&e.stream_ops.close(e)}catch(e){throw e}finally{R.closeStream(e.fd)}e.fd=null},isClosed(e){return e.fd===null},llseek(e,t,n){if(R.isClosed(e))throw new R.ErrnoError(8);if(!e.seekable||!e.stream_ops.llseek)throw new R.ErrnoError(70);if(n!=0&&n!=1&&n!=2)throw new R.ErrnoError(28);return e.position=e.stream_ops.llseek(e,t,n),e.ungotten=[],e.position},read(e,t,n,r,i){if(r<0||i<0)throw new R.ErrnoError(28);if(R.isClosed(e)||(e.flags&2097155)==1)throw new R.ErrnoError(8);if(R.isDir(e.node.mode))throw new R.ErrnoError(31);if(!e.stream_ops.read)throw new R.ErrnoError(28);var a=i!==void 0;if(!a)i=e.position;else if(!e.seekable)throw new R.ErrnoError(70);var o=e.stream_ops.read(e,t,n,r,i);return a||(e.position+=o),o},write(e,t,n,r,i,a){if(r<0||i<0)throw new R.ErrnoError(28);if(R.isClosed(e)||!(e.flags&2097155))throw new R.ErrnoError(8);if(R.isDir(e.node.mode))throw new R.ErrnoError(31);if(!e.stream_ops.write)throw new R.ErrnoError(28);e.seekable&&e.flags&1024&&R.llseek(e,0,2);var o=i!==void 0;if(!o)i=e.position;else if(!e.seekable)throw new R.ErrnoError(70);var s=e.stream_ops.write(e,t,n,r,i,a);return o||(e.position+=s),s},mmap(e,t,n,r,i){if(r&2&&!(i&2)&&(e.flags&2097155)!=2||(e.flags&2097155)==1)throw new R.ErrnoError(2);if(!e.stream_ops.mmap)throw new R.ErrnoError(43);if(!t)throw new R.ErrnoError(28);return e.stream_ops.mmap(e,t,n,r,i)},msync(e,t,n,r,i){return e.stream_ops.msync?e.stream_ops.msync(e,t,n,r,i):0},ioctl(e,t,n){if(!e.stream_ops.ioctl)throw new R.ErrnoError(59);return e.stream_ops.ioctl(e,t,n)},readFile(e,t={}){t.flags=t.flags??0,t.encoding=t.encoding??`binary`,t.encoding!==`utf8`&&t.encoding!==`binary`&&v(`Invalid encoding type "${t.encoding}"`);var n=R.open(e,t.flags),r=R.stat(e).size,i=new Uint8Array(r);return R.read(n,i,0,r,0),t.encoding===`utf8`&&(i=w(i)),R.close(n),i},writeFile(e,t,n={}){n.flags=n.flags??577;var r=R.open(e,n.flags,n.mode);t=P(t),R.write(r,t,0,t.byteLength,void 0,n.canOwn),R.close(r)},cwd:()=>R.currentPath,chdir(e){var t=R.lookupPath(e,{follow:!0});if(t.node===null)throw new R.ErrnoError(44);if(!R.isDir(t.node.mode))throw new R.ErrnoError(54);var n=R.nodePermissions(t.node,`x`);if(n)throw new R.ErrnoError(n);R.currentPath=t.path},createDefaultDirectories(){R.mkdir(`/tmp`),R.mkdir(`/home`),R.mkdir(`/home/web_user`)},createDefaultDevices(){R.mkdir(`/dev`),R.registerDevice(R.makedev(1,3),{read:()=>0,write:(e,t,n,r,i)=>r,llseek:()=>0}),R.mkdev(`/dev/null`,R.makedev(1,3)),k.register(R.makedev(5,0),k.default_tty_ops),k.register(R.makedev(6,0),k.default_tty1_ops),R.mkdev(`/dev/tty`,R.makedev(5,0)),R.mkdev(`/dev/tty1`,R.makedev(6,0));var e=new Uint8Array(1024),t=0,n=()=>(t||=(S(e),e.byteLength),e[--t]);R.createDevice(`/dev`,`random`,n),R.createDevice(`/dev`,`urandom`,n),R.mkdir(`/dev/shm`),R.mkdir(`/dev/shm/tmp`)},createSpecialDirectories(){R.mkdir(`/proc`);var e=R.mkdir(`/proc/self`);R.mkdir(`/proc/self/fd`),R.mount({mount(){var t=R.createNode(e,`fd`,16895,73);return t.stream_ops={llseek:N.stream_ops.llseek},t.node_ops={lookup(e,t){var n=+t,r=R.getStreamChecked(n),i={parent:null,mount:{mountpoint:`fake`},node_ops:{readlink:()=>r.path},id:n+1};return i.parent=i,i},readdir(){return Array.from(R.streams.entries()).filter(([e,t])=>t).map(([e,t])=>e.toString())}},t}},{},`/proc/self/fd`)},createStandardStreams(e,t,n){e?R.createDevice(`/dev`,`stdin`,e):R.symlink(`/dev/tty`,`/dev/stdin`),t?R.createDevice(`/dev`,`stdout`,null,t):R.symlink(`/dev/tty`,`/dev/stdout`),n?R.createDevice(`/dev`,`stderr`,null,n):R.symlink(`/dev/tty1`,`/dev/stderr`),R.open(`/dev/stdin`,0),R.open(`/dev/stdout`,1),R.open(`/dev/stderr`,1)},staticInit(){R.nameTable=Array(4096),R.mount(N,{},`/`),R.createDefaultDirectories(),R.createDefaultDevices(),R.createSpecialDirectories(),R.filesystems={MEMFS:N}},init(e,n,r){R.initialized=!0,e??=t.stdin,n??=t.stdout,r??=t.stderr,R.createStandardStreams(e,n,r)},quit(){R.initialized=!1;for(var e of R.streams)e&&R.close(e)},findObject(e,t){var n=R.analyzePath(e,t);return n.exists?n.object:null},analyzePath(e,t){try{var n=R.lookupPath(e,{follow:!t});e=n.path}catch{}var r={isRoot:!1,exists:!1,error:0,name:null,path:null,object:null,parentExists:!1,parentPath:null,parentObject:null};try{var n=R.lookupPath(e,{parent:!0});r.parentExists=!0,r.parentPath=n.path,r.parentObject=n.node,r.name=x.basename(e),n=R.lookupPath(e,{follow:!t}),r.exists=!0,r.path=n.path,r.object=n.node,r.name=n.node.name,r.isRoot=n.path===`/`}catch(e){r.error=e.errno}return r},createPath(e,t,n,r){e=typeof e==`string`?e:R.getPath(e);for(var i=t.split(`/`).reverse();i.length;){var a=i.pop();if(a){var o=x.join2(e,a);try{R.mkdir(o)}catch(e){if(e.errno!=20)throw e}e=o}}return o},createFile(e,t,n,r,i){var a=x.join2(typeof e==`string`?e:R.getPath(e),t),o=F(r,i);return R.create(a,o)},createDataFile(e,t,n,r,i,a){var o=t;e&&(e=typeof e==`string`?e:R.getPath(e),o=t?x.join2(e,t):e);var s=F(r,i),c=R.create(o,s);if(n){n=P(n),R.chmod(c,s|146);var l=R.open(c,577);R.write(l,n,0,n.length,0,a),R.close(l),R.chmod(c,s)}},createDevice(e,t,n,r){var i=x.join2(typeof e==`string`?e:R.getPath(e),t),a=F(!!n,!!r);R.createDevice.major??=64;var o=R.makedev(R.createDevice.major++,0);return R.registerDevice(o,{open(e){e.seekable=!1},close(e){r?.buffer?.length&&r(10)},read(e,t,r,i,a){for(var o=0,s=0;s<i;s++){var c;try{c=n()}catch{throw new R.ErrnoError(29)}if(c===void 0&&!o)throw new R.ErrnoError(6);if(c==null)break;o++,t[r+s]=c}return o&&(e.node.atime=Date.now()),o},write(e,t,n,i,a){for(var o=0;o<i;o++)try{r(t[n+o])}catch{throw new R.ErrnoError(29)}return i&&(e.node.mtime=e.node.ctime=Date.now()),o}}),R.mkdev(i,a,o)},forceLoadFile(e){if(e.isDevice||e.isFolder||e.link||e.contents)return!0;if(globalThis.XMLHttpRequest)v(`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=f(e.url)}catch{throw new R.ErrnoError(29)}},createLazyFile(e,t,n,i,a){class o{lengthKnown=!1;chunks=[];get(e){if(!(e>this.length-1||e<0)){var t=e%this.chunkSize,n=e/this.chunkSize|0;return this.getter(n)[t]}}setDataGetter(e){this.getter=e}cacheLength(){var e=new XMLHttpRequest;e.open(`HEAD`,n,!1),e.send(null),e.status>=200&&e.status<300||e.status===304||v(`Couldn't load ${n}. Status: ${e.status}`);var t=Number(e.getResponseHeader(`Content-length`)),r,i=(r=e.getResponseHeader(`Accept-Ranges`))&&r===`bytes`,a=(r=e.getResponseHeader(`Content-Encoding`))&&r===`gzip`,o=1048576;i||(o=t);var s=(e,r)=>{e>r&&v(`invalid range (${e}, ${r}) or no bytes requested!`),r>t-1&&v(`only ${t} bytes available! programmer error!`);var i=new XMLHttpRequest;return i.open(`GET`,n,!1),t!==o&&i.setRequestHeader(`Range`,`bytes=${e}-${r}`),i.responseType=`arraybuffer`,i.overrideMimeType&&i.overrideMimeType(`text/plain; charset=x-user-defined`),i.send(null),i.status>=200&&i.status<300||i.status===304||v(`Couldn't load ${n}. Status: ${i.status}`),i.response===void 0?O(i.responseText??``,!0):new Uint8Array(i.response||[])},c=this;c.setDataGetter(e=>{var n=e*o,r=(e+1)*o-1;return r=Math.min(r,t-1),c.chunks[e]===void 0&&(c.chunks[e]=s(n,r)),c.chunks[e]===void 0&&v(`doXHR failed!`),c.chunks[e]}),(a||!t)&&(o=t=1,t=this.getter(0).length,o=t,m(`LazyFiles on gzip forces download of the whole file when length is accessed`)),this._length=t,this._chunkSize=o,this.lengthKnown=!0}get length(){return this.lengthKnown||this.cacheLength(),this._length}get chunkSize(){return this.lengthKnown||this.cacheLength(),this._chunkSize}}if(globalThis.XMLHttpRequest){r||v(`Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc`);var s={isDevice:!1,contents:new o}}else var s={isDevice:!1,url:n};var c=R.createFile(e,t,s,i,a);s.contents?c.contents=s.contents:s.url&&(c.contents=null,c.url=s.url),Object.defineProperties(c,{usedBytes:{get:function(){return this.contents.length}}});var l={};for(let[e,t]of Object.entries(c.stream_ops))l[e]=(...e)=>(R.forceLoadFile(c),t(...e));function u(e,t,n,r,i){var a=e.node.contents;if(i>=a.length)return 0;var o=Math.min(a.length-i,r);if(a.slice)for(var s=0;s<o;s++)t[n+s]=a[i+s];else for(var s=0;s<o;s++)t[n+s]=a.get(i+s);return o}return l.read=(e,t,n,r,i)=>(R.forceLoadFile(c),u(e,t,n,r,i)),l.mmap=(e,t,n,r,i)=>{R.forceLoadFile(c);var a=M(t);if(!a)throw new R.ErrnoError(48);return u(e,b,a,t,n),{ptr:a,allocated:!0}},c.stream_ops=l,c}},Ie=(e,t,n)=>(e>>>=0,e?w(A,e,t,n):``),z,B,V,H={currentUmask:18,calculateAt(e,t,n){if(x.isAbs(t))return t;var r=e===-100?R.cwd():H.getStreamFromFD(e).path;if(t.length==0){if(!n)throw new R.ErrnoError(44);return r}return r+`/`+t},writeStat(e,t){B[e>>>2>>>0]=t.dev,B[e+4>>>2>>>0]=t.mode,B[e+8>>>2>>>0]=t.nlink,B[e+12>>>2>>>0]=t.uid,B[e+16>>>2>>>0]=t.gid,B[e+20>>>2>>>0]=t.rdev,V[e+24>>>3>>>0]=BigInt(t.size),z[e+32>>>2>>>0]=4096,z[e+36>>>2>>>0]=t.blocks;var n=t.atime.getTime(),r=t.mtime.getTime(),i=t.ctime.getTime();return V[e+40>>>3>>>0]=BigInt(Math.floor(n/1e3)),B[e+48>>>2>>>0]=n%1e3*1e3*1e3,V[e+56>>>3>>>0]=BigInt(Math.floor(r/1e3)),B[e+64>>>2>>>0]=r%1e3*1e3*1e3,V[e+72>>>3>>>0]=BigInt(Math.floor(i/1e3)),B[e+80>>>2>>>0]=i%1e3*1e3*1e3,V[e+88>>>3>>>0]=BigInt(t.ino),0},writeStatFs(e,t){B[e+4>>>2>>>0]=t.bsize,B[e+60>>>2>>>0]=t.bsize,V[e+8>>>3>>>0]=BigInt(t.blocks),V[e+16>>>3>>>0]=BigInt(t.bfree),V[e+24>>>3>>>0]=BigInt(t.bavail),V[e+32>>>3>>>0]=BigInt(t.files),V[e+40>>>3>>>0]=BigInt(t.ffree),B[e+48>>>2>>>0]=t.fsid,B[e+64>>>2>>>0]=t.flags,B[e+56>>>2>>>0]=t.namelen},doMsync(e,t,n,r,i){if(!R.isFile(t.node.mode))throw new R.ErrnoError(43);if(r&2)return 0;var a=A.subarray(e>>>0,e+n>>>0);R.msync(t,a,i,n,r)},getStreamFromFD(e){return R.getStreamChecked(e)},varargs:void 0,getStr(e){return Ie(e)}},Le=9007199254740992,Re=-9007199254740992,U=e=>e<Re||e>Le?NaN:Number(e);function ze(e,t,n,r){t>>>=0;try{if(t=H.getStr(t),t=H.calculateAt(e,t),n&-8)return-28;var i=R.lookupPath(t,{follow:!0}).node;if(!i)return-44;var a=``;return n&4&&(a+=`r`),n&2&&(a+=`w`),n&1&&(a+=`x`),a&&R.nodePermissions(i,a)?-2:0}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}var W=()=>{var e=z[H.varargs>>>2>>>0];return H.varargs+=4,e},G=W,K;function Be(e,t,n){n>>>=0,H.varargs=n;try{var r=H.getStreamFromFD(e);switch(t){case 0:var i=W();if(i<0)return-28;for(;R.streams[i];)i++;return R.dupStream(r,i).fd;case 1:case 2:return 0;case 3:return r.flags;case 4:var i=W(),a=289792;return r.flags=r.flags&~a|i&a,0;case 12:var i=G(),o=0;return K[i+o>>>1>>>0]=2,0;case 13:case 14:return 0}return-28}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Ve(e,t){t>>>=0;try{return H.writeStat(t,R.fstat(e))}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function He(e,t){t=U(t);try{return isNaN(t)?-22:(R.ftruncate(e,t),0)}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}var q=(e,t,n)=>D(e,A,t,n);function Ue(e,t){e>>>=0,t>>>=0;try{if(!t)return-28;var n=R.cwd(),r=E(n)+1;return t<r?-68:(q(n,e,t),r)}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function We(e,t,n){t>>>=0,n>>>=0;try{var r=H.getStreamFromFD(e);r.getdents||=R.readdir(r.path);for(var i=280,a=0,o=R.llseek(r,0,1),s=Math.floor(o/i),c=Math.min(r.getdents.length,s+Math.floor(n/i)),l=s;l<c;l++){var u,d,f=r.getdents[l];if(f===`.`)u=r.node.id,d=4;else if(f===`..`)u=R.lookupPath(r.path,{parent:!0}).node.id,d=4;else{var p;try{p=R.lookupNode(r.node,f)}catch(e){if(e?.errno===28)continue;throw e}u=p.id,d=R.isChrdev(p.mode)?2:R.isDir(p.mode)?4:R.isLink(p.mode)?10:8}V[t+a>>>3>>>0]=BigInt(u),V[t+a+8>>>3>>>0]=BigInt((l+1)*i),K[t+a+16>>>1>>>0]=280,b[t+a+18>>>0]=d,q(f,t+a+19,256),a+=i}return R.llseek(r,l*i,0),a}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Ge(e,t,n){n>>>=0,H.varargs=n;try{var r=H.getStreamFromFD(e);switch(t){case 21509:return r.tty?0:-59;case 21505:if(!r.tty)return-59;if(r.tty.ops.ioctl_tcgets){var i=r.tty.ops.ioctl_tcgets(r),a=G();z[a>>>2>>>0]=i.c_iflag||0,z[a+4>>>2>>>0]=i.c_oflag||0,z[a+8>>>2>>>0]=i.c_cflag||0,z[a+12>>>2>>>0]=i.c_lflag||0;for(var o=0;o<32;o++)b[a+o+17>>>0]=i.c_cc[o]||0;return 0}return 0;case 21510:case 21511:case 21512:return r.tty?0:-59;case 21506:case 21507:case 21508:if(!r.tty)return-59;if(r.tty.ops.ioctl_tcsets){for(var a=G(),s=z[a>>>2>>>0],c=z[a+4>>>2>>>0],l=z[a+8>>>2>>>0],u=z[a+12>>>2>>>0],d=[],o=0;o<32;o++)d.push(b[a+o+17>>>0]);return r.tty.ops.ioctl_tcsets(r.tty,t,{c_iflag:s,c_oflag:c,c_cflag:l,c_lflag:u,c_cc:d})}return 0;case 21519:if(!r.tty)return-59;var a=G();return z[a>>>2>>>0]=0,0;case 21520:return r.tty?-28:-59;case 21537:case 21531:var a=G();return R.ioctl(r,t,a);case 21523:if(!r.tty)return-59;if(r.tty.ops.ioctl_tiocgwinsz){var f=r.tty.ops.ioctl_tiocgwinsz(r.tty),a=G();K[a>>>1>>>0]=f[0],K[a+2>>>1>>>0]=f[1]}return 0;case 21524:return r.tty?0:-59;case 21515:return r.tty?0:-59;default:return-28}}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Ke(e,t){e>>>=0,t>>>=0;try{return e=H.getStr(e),H.writeStat(t,R.lstat(e))}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function qe(e,t,n){t>>>=0;try{return t=H.getStr(t),t=H.calculateAt(e,t),n&=~H.currentUmask,R.mkdir(t,n,0),0}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Je(e,t,n,r){t>>>=0,n>>>=0;try{t=H.getStr(t);var i=r&256,a=r&4096;return r&=-6401,t=H.calculateAt(e,t,a),H.writeStat(n,i?R.lstat(t):R.stat(t))}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Ye(e,t,n,r){t>>>=0,r>>>=0,H.varargs=r;try{t=H.getStr(t),t=H.calculateAt(e,t);var i=r?W():0;return n&64&&(i&=~H.currentUmask),R.open(t,n,i).fd}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Xe(e,t,n,r){t>>>=0,n>>>=0,r>>>=0;try{if(t=H.getStr(t),t=H.calculateAt(e,t),r<=0)return-28;var i=R.readlink(t),a=Math.min(r,E(i)),o=b[n+a>>>0];return q(i,n,r+1),b[n+a>>>0]=o,a}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Ze(e,t,n,r){t>>>=0,r>>>=0;try{return t=H.getStr(t),r=H.getStr(r),t=H.calculateAt(e,t),r=H.calculateAt(n,r),R.rename(t,r),0}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function Qe(e){e>>>=0;try{return e=H.getStr(e),R.rmdir(e),0}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function $e(e,t){e>>>=0,t>>>=0;try{return e=H.getStr(e),H.writeStat(t,R.stat(e))}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function et(e,t,n){e>>>=0,t>>>=0,n>>>=0;try{return H.writeStatFs(n,R.statfs(H.getStr(e))),0}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function tt(e,t,n){t>>>=0;try{if(t=H.getStr(t),t=H.calculateAt(e,t),!n)R.unlink(t);else if(n===512)R.rmdir(t);else return-28;return 0}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}var nt=()=>v(``),rt=e=>e%4==0&&(e%100!=0||e%400==0),it=[0,31,60,91,121,152,182,213,244,274,305,335],at=[0,31,59,90,120,151,181,212,243,273,304,334],ot=e=>(rt(e.getFullYear())?it:at)[e.getMonth()]+e.getDate()-1;function st(e,t){e=U(e),t>>>=0;var n=new Date(e*1e3);if(isNaN(n.getTime()))return 1;z[t>>>2>>>0]=n.getSeconds(),z[t+4>>>2>>>0]=n.getMinutes(),z[t+8>>>2>>>0]=n.getHours(),z[t+12>>>2>>>0]=n.getDate(),z[t+16>>>2>>>0]=n.getMonth(),z[t+20>>>2>>>0]=n.getFullYear()-1900,z[t+24>>>2>>>0]=n.getDay();var r=ot(n)|0;z[t+28>>>2>>>0]=r,z[t+36>>>2>>>0]=-(n.getTimezoneOffset()*60);var i=new Date(n.getFullYear(),0,1),a=new Date(n.getFullYear(),6,1).getTimezoneOffset(),o=i.getTimezoneOffset(),s=(a!=o&&n.getTimezoneOffset()==Math.min(o,a))|0;return z[t+32>>>2>>>0]=s,0}function ct(e,t,n,r,i,a,o){e>>>=0,i=U(i),a>>>=0,o>>>=0;try{var s=H.getStreamFromFD(r),c=R.mmap(s,e,i,t,n),l=c.ptr;return z[a>>>2>>>0]=c.allocated,B[o>>>2>>>0]=l,0}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}function lt(e,t,n,r,i,a){e>>>=0,t>>>=0,a=U(a);try{var o=H.getStreamFromFD(i);n&2&&H.doMsync(e,o,t,r,a)}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return-e.errno}}var ut=function(e,t,n,r){e>>>=0,t>>>=0,n>>>=0,r>>>=0;var i=new Date().getFullYear(),a=new Date(i,0,1),o=new Date(i,6,1),s=a.getTimezoneOffset(),c=o.getTimezoneOffset(),l=Math.max(s,c);B[e>>>2>>>0]=l*60,z[t>>>2>>>0]=Number(s!=c);var u=e=>{var t=e>=0?`-`:`+`,n=Math.abs(e);return`UTC${t}${String(Math.floor(n/60)).padStart(2,`0`)}${String(n%60).padStart(2,`0`)}`},d=u(s),f=u(c);c<s?(q(d,n,17),q(f,r,17)):(q(d,r,17),q(f,n,17))},dt=()=>performance.now(),ft=()=>Date.now(),pt=1,mt=e=>e>=0&&e<=3;function ht(e,t,n){if(t=U(t),n>>>=0,!mt(e))return 28;var r;if(e===0)r=ft();else if(pt)r=dt();else return 52;var i=Math.round(r*1e3*1e3);return V[n>>>3>>>0]=BigInt(i),0}var gt=()=>4294901760;function _t(){return gt()}var vt=e=>{var t=(e-Z.buffer.byteLength+65535)/65536|0;try{return Z.grow(t),re(),1}catch{}};function yt(e){e>>>=0;var t=A.length,n=gt();if(e>n)return!1;for(var r=1;r<=4;r*=2){var i=t*(1+.2/r);if(i=Math.min(i,e+100663296),vt(Math.min(n,j(Math.max(e,i),65536))))return!0}return!1}var J={},bt=()=>o,Y=()=>{if(!Y.strings){var e={USER:`web_user`,LOGNAME:`web_user`,PATH:`/`,PWD:`/`,HOME:`/home/web_user`,LANG:(globalThis.navigator?.language??`C`).replace(`-`,`_`)+`.UTF-8`,_:bt()};for(var t in J)J[t]===void 0?delete e[t]:e[t]=J[t];var n=[];for(var t in e)n.push(`${t}=${e[t]}`);Y.strings=n}return Y.strings};function xt(e,t){e>>>=0,t>>>=0;var n=0,r=0;for(var i of Y()){var a=t+n;B[e+r>>>2>>>0]=a,n+=q(i,a,1/0)+1,r+=4}return 0}function St(e,t){e>>>=0,t>>>=0;var n=Y();B[e>>>2>>>0]=n.length;var r=0;for(var i of n)r+=E(i)+1;return B[t>>>2>>>0]=r,0}var Ct=0,wt=()=>ve||Ct>0,Tt=e=>{wt()||(t.onExit?.(e),_=!0),s(e,new me(e))},Et=(e,t)=>{Tt(e)};function Dt(e){try{var t=H.getStreamFromFD(e);return R.close(t),0}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}function Ot(e,t){t>>>=0;try{var n=0,r=0,i=0,a=H.getStreamFromFD(e),o=a.tty?2:R.isDir(a.mode)?3:R.isLink(a.mode)?7:4;return b[t>>>0]=o,K[t+2>>>1>>>0]=i,V[t+8>>>3>>>0]=BigInt(n),V[t+16>>>3>>>0]=BigInt(r),0}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}var kt=(e,t,n,r)=>{for(var i=0,a=0;a<n;a++){var o=B[t>>>2>>>0],s=B[t+4>>>2>>>0];t+=8;try{var c=R.read(e,b,o,s,r)}catch(e){if(i>0&&e instanceof R.ErrnoError&&(e.errno==6||e.errno==6))break;throw e}if(c<0)return-1;if(i+=c,c<s)break;r!==void 0&&(r+=c)}return i};function At(e,t,n,r,i){t>>>=0,n>>>=0,r=U(r),i>>>=0;try{if(isNaN(r))return 22;var a=kt(H.getStreamFromFD(e),t,n,r);return B[i>>>2>>>0]=a,0}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}var jt=(e,t,n,r)=>{if(n==1)return R.write(e,b,B[t>>>2>>>0],B[t+4>>>2>>>0],r);for(var i=0,a=0,o=t;a<n;a++,o+=8)i+=B[o+4>>>2>>>0];for(var s=new Uint8Array(i),c=0,a=0;a<n;a++,t+=8){var l=B[t>>>2>>>0],u=B[t+4>>>2>>>0];s.set(A.subarray(l>>>0,l+u>>>0),c),c+=u}return R.write(e,s,0,i,r)};function Mt(e,t,n,r,i){t>>>=0,n>>>=0,r=U(r),i>>>=0;try{if(isNaN(r))return 22;var a=jt(H.getStreamFromFD(e),t,n,r);return B[i>>>2>>>0]=a,0}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}function Nt(e,t,n,r){t>>>=0,n>>>=0,r>>>=0;try{var i=kt(H.getStreamFromFD(e),t,n);return B[r>>>2>>>0]=i,0}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}function Pt(e,t,n,r){t=U(t),r>>>=0;try{if(isNaN(t))return 22;var i=H.getStreamFromFD(e);return R.llseek(i,t,n),V[r>>>3>>>0]=BigInt(i.position),i.getdents&&!t&&n===0&&(i.getdents=null),0}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}function Ft(e){try{var t=H.getStreamFromFD(e);return t.stream_ops?.fsync?.(t)}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}function It(e,t,n,r){t>>>=0,n>>>=0,r>>>=0;try{var i=jt(H.getStreamFromFD(e),t,n);return B[r>>>2>>>0]=i,0}catch(e){if(R===void 0||e.name!==`ErrnoError`)throw e;return e.errno}}function Lt(e,t){return e>>>=0,t>>>=0,S(A.subarray(e>>>0,e+t>>>0))}R.createPreloadedFile=Fe,R.preloadFile=L,R.staticInit(),t.noExitRuntime&&(ve=t.noExitRuntime),t.print&&(m=t.print),t.printErr&&(h=t.printErr),t.arguments&&t.arguments,t.thisProgram&&(o=t.thisProgram);var X=t.preInit;if(X)for(typeof X==`function`&&(t.preInit=X=[X]);X.length>0;)X.shift()();t.UTF8ToString=Ie,t.stringToUTF8=q,t.lengthBytesUTF8=E,t.FS=R;var Rt,zt,Z;function Bt(e){t._shim_open=e.shim_open,t._malloc=e.malloc,t._free=e.free,t._shim_close=e.shim_close,t._shim_query=e.shim_query,t._shim_error=e.shim_error,t._shim_destroy_result=e.shim_destroy_result,t._shim_columns=e.shim_columns,t._shim_rows=e.shim_rows,t._shim_column_name=e.shim_column_name,t._shim_column_type=e.shim_column_type,t._shim_is_null=e.shim_is_null,t._shim_value_double=e.shim_value_double,t._shim_value_int64=e.shim_value_int64,t._shim_value_boolean=e.shim_value_boolean,t._shim_value_varchar=e.shim_value_varchar,t._shim_free=e.shim_free,Rt=e.emscripten_builtin_memalign,zt=e.__trap,e._emscripten_stack_alloc,Z=e.memory,e.__indirect_function_table}var Q={__syscall_faccessat:ze,__syscall_fcntl64:Be,__syscall_fstat64:Ve,__syscall_ftruncate64:He,__syscall_getcwd:Ue,__syscall_getdents64:We,__syscall_ioctl:Ge,__syscall_lstat64:Ke,__syscall_mkdirat:qe,__syscall_newfstatat:Je,__syscall_openat:Ye,__syscall_readlinkat:Xe,__syscall_renameat:Ze,__syscall_rmdir:Qe,__syscall_stat64:$e,__syscall_statfs64:et,__syscall_unlinkat:tt,_abort_js:nt,_localtime_js:st,_mmap_js:ct,_munmap_js:lt,_tzset_js:ut,clock_time_get:ht,emscripten_date_now:ft,emscripten_get_heap_max:_t,emscripten_get_now:dt,emscripten_resize_heap:yt,environ_get:xt,environ_sizes_get:St,exit:Et,fd_close:Dt,fd_fdstat_get:Ot,fd_pread:At,fd_pwrite:Mt,fd_read:Nt,fd_seek:Pt,fd_sync:Ft,fd_write:It,random_get:Lt};function Vt(e){e=Object.assign({},e);var t=e=>t=>e(t)>>>0;return e.malloc=t(e.malloc),e.emscripten_builtin_memalign=(e=>(t,n)=>e(t,n)>>>0)(e.emscripten_builtin_memalign),e._emscripten_stack_alloc=t(e._emscripten_stack_alloc),e}async function Ht(){ie(),I&&await ke();var e=t.setStatus;e&&(e(`Running...`),await new Promise(e=>setTimeout(e,1)),setTimeout(e,1,``)),!_&&(ae(),t.onRuntimeInitialized?.(),oe())}var $=await pe();return await Ht(),t}const t=new Set([2,3,4,5,6,7,8,9]),n=new Set([10,11]);function r(e){return{load:i,open:a,close:o,query:s};function r(t){let n=e.lengthBytesUTF8(t)+1,r=e._malloc(n);return e.stringToUTF8(t,r,n),r}function i(t,n){return e.FS.writeFile(t,new Uint8Array(n)),t}function a(t,n=!0){let i=r(t),a=e._shim_open(i,+!!n);if(e._free(i),a)return a;throw Error(`duckdb open failed: ${t}`)}function o(t){return e._shim_close(t),null}function s(t,n){let i=r(n),a=e._shim_query(t,i);e._free(i);let o=e._shim_error(a);if(o){let t=e.UTF8ToString(o);throw e._shim_destroy_result(a),Error(`duckdb query: ${t}`)}try{return c(a)}finally{e._shim_destroy_result(a)}}function c(t){let n=e._shim_columns(t),r=e._shim_rows(t),i=[],a=[];for(let r=0;r<n;r++)i.push(e.UTF8ToString(e._shim_column_name(t,r))),a.push(e._shim_column_type(t,r));let o=[];for(let e=0;e<r;e++){let r={};for(let o=0;o<n;o++)r[i[o]]=l(t,o,e,a[o]);o.push(r)}return o}function l(r,i,a,o){if(e._shim_is_null(r,i,a))return null;if(o===1)return e._shim_value_boolean(r,i,a)===1;if(t.has(o))return Number(e._shim_value_int64(r,i,a));if(n.has(o))return e._shim_value_double(r,i,a);{let t=e._shim_value_varchar(r,i,a),n=e.UTF8ToString(t);return e._shim_free(t),n}}}let i=null,a=null,o=0;const s=new WeakMap;function c(e){i=e}async function l(e,t={}){let n=await u(),r=e===`:memory:`,i=r?`:memory:`:await d(n,e),a=n.open(i,t.readOnly??!r);return{query:async e=>n.query(a,e),exec:e=>n.query(a,e),run:e=>n.query(a,e),load:async(e,t)=>n.load(e,await f(t)),close:()=>n.close(a)}}async function u(){if(a===null){if(i)a=r(await e({instantiateWasm(e,t){return WebAssembly.instantiate(i,e).then(e=>t(e.instance,e.module)),{}}}));else throw Error(`duckdb wasm not loaded: call setWasmBinary(bytes) with wasm/duckdb.wasm`)}return a}async function d(e,t){if(s.has(t))return s.get(t);{o+=1;let n=`db-${o}.duckdb`,r=e.load(n,await f(t));return s.set(t,r),r}}async function f(e){return e instanceof ArrayBuffer?e:e.arrayBuffer?await e.arrayBuffer():e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}export{c as n,l as t};
@@ -1 +1 @@
1
- const e=typeof process<`u`&&process.versions!=null&&process.versions.node!=null;async function t(t){if(e){let e=(await import(`./node.js`)).default;return await e(t)}{let e=(await import(`./browser-2.js`)).default;return await e(t)}}export{t as default};
1
+ const e=typeof process<`u`&&process.versions!=null&&process.versions.node!=null;async function t(t,n={}){if(e){let e=(await import(`./node.js`)).default;return await e(t,n)}{let e=(await import(`./browser-2.js`)).default;return await e(t,n)}}export{t as default};
@@ -1 +1 @@
1
- import{n as e}from"./browser.js";const t=`wasm`,n=new URL(`../duckdb/duckdb.wasm`,self.location.href).href;let r=null;function i(){return r===null&&(r=a().then(e)),r}async function a(){let e=await o(),t=await s(e,`wasm`);return t||(t=await(await fetch(n)).arrayBuffer(),await c(e,`wasm`,t)),t}async function o(){return new Promise((e,n)=>{let r=indexedDB.open(`duckdb-cache`,1);r.onupgradeneeded=e=>e.target.result.createObjectStore(t),r.onsuccess=t=>e(t.target.result),r.onerror=n})}async function s(e,n){return new Promise(r=>{let i=e.transaction(t).objectStore(t).get(n);i.onsuccess=e=>r(e.target.result),i.onerror=()=>r(null)})}async function c(e,n,r){return new Promise((i,a)=>{let o=e.transaction(t,`readwrite`);o.objectStore(t).put(r,n),o.oncomplete=i,o.onerror=a})}export{i as default};
1
+ import{n as e}from"./browser.js";const t=`wasm`,n=new URL(`../duckdb/duckdb.wasm`,self.location.href).href;let r=null;function i(){return a().then(e)}function a(){return r===null&&(r=o()),r}async function o(){let e=await c(),t=await l(e,`wasm`);if(!s(t)){let r=await fetch(n);if(t=await r.arrayBuffer(),s(t))await u(e,`wasm`,t);else throw Error(`${n} did not answer with wasm (${r.status})`)}return t}function s(e){if(e&&e.byteLength>4){let t=new Uint8Array(e,0,4);return t[0]===0&&t[1]===97&&t[2]===115&&t[3]===109}return!1}async function c(){return new Promise((e,n)=>{let r=indexedDB.open(`duckdb-cache`,1);r.onupgradeneeded=e=>e.target.result.createObjectStore(t),r.onsuccess=t=>e(t.target.result),r.onerror=n})}async function l(e,n){return new Promise(r=>{let i=e.transaction(t).objectStore(t).get(n);i.onsuccess=e=>r(e.target.result),i.onerror=()=>r(null)})}async function u(e,n,r){return new Promise((i,a)=>{let o=e.transaction(t,`readwrite`);o.objectStore(t).put(r,n),o.oncomplete=i,o.onerror=a})}export{i as default};