@run-trace/duckdb-wasm 0.4.0 → 0.5.0
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.
- package/dist/duckdb-browser-blocking.cjs +1 -1
- package/dist/duckdb-browser-blocking.cjs.map +4 -4
- package/dist/duckdb-browser-blocking.mjs +1 -1
- package/dist/duckdb-browser-blocking.mjs.map +4 -4
- package/dist/duckdb-browser-coi.pthread.worker.js +1 -1
- package/dist/duckdb-browser-coi.pthread.worker.js.map +3 -3
- package/dist/duckdb-browser-coi.worker.js +1 -1
- package/dist/duckdb-browser-coi.worker.js.map +3 -3
- package/dist/duckdb-browser.cjs +1 -1
- package/dist/duckdb-browser.cjs.map +3 -3
- package/dist/duckdb-browser.mjs +1 -1
- package/dist/duckdb-browser.mjs.map +3 -3
- package/dist/duckdb-coi.wasm +0 -0
- package/dist/duckdb-eh.wasm +0 -0
- package/dist/duckdb-node-blocking.cjs +2 -2
- package/dist/duckdb-node-blocking.cjs.map +4 -4
- package/dist/duckdb-node-eh.worker.cjs +2 -2
- package/dist/duckdb-node-eh.worker.cjs.map +4 -4
- package/dist/duckdb-node.cjs +1 -1
- package/dist/duckdb-node.cjs.map +3 -3
- package/dist/types/src/platform.d.ts +1 -1
- package/package.json +2 -7
- package/dist/duckdb-browser-eh.worker.js +0 -14
- package/dist/duckdb-browser-eh.worker.js.map +0 -7
- package/dist/duckdb-browser-mvp.worker.js +0 -14
- package/dist/duckdb-mvp.wasm +0 -0
- package/dist/duckdb-node-mvp.worker.cjs +0 -51
- package/dist/duckdb-node-mvp.worker.cjs.map +0 -7
- package/dist/types/src/bindings/bindings_browser_mvp.d.ts +0 -11
- package/dist/types/src/bindings/bindings_node_mvp.d.ts +0 -12
- package/dist/types/src/targets/duckdb-browser-mvp.worker.d.ts +0 -2
- package/dist/types/src/targets/duckdb-node-mvp.worker.d.ts +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var W_=Object.create;var hn=Object.defineProperty;var q_=Object.getOwnPropertyDescriptor;var K_=Object.getOwnPropertyNames;var G_=Object.getPrototypeOf,$_=Object.prototype.hasOwnProperty;var X_=(w,d,b)=>d in w?hn(w,d,{enumerable:!0,configurable:!0,writable:!0,value:b}):w[d]=b;var bt=(w=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(w,{get:(d,b)=>(typeof require<"u"?require:d)[b]}):w)(function(w){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+w+'" is not supported')});var pr=(w,d)=>()=>(d||w((d={exports:{}}).exports,d),d.exports);var V_=(w,d,b,g)=>{if(d&&typeof d=="object"||typeof d=="function")for(let l of K_(d))!$_.call(w,l)&&l!==b&&hn(w,l,{get:()=>d[l],enumerable:!(g=q_(d,l))||g.enumerable});return w};var vn=(w,d,b)=>(b=w!=null?W_(G_(w)):{},V_(d||!w||!w.__esModule?hn(b,"default",{value:w,enumerable:!0}):b,w));var mt=(w,d,b)=>(X_(w,typeof d!="symbol"?d+"":d,b),b);var ba=pr(()=>{});var ma=pr(()=>{});var ga=pr((Jd,St)=>{(function(){"use strict";var w="input is invalid type",d=typeof window=="object",b=d?window:{};b.JS_SHA256_NO_WINDOW&&(d=!1);var g=!d&&typeof self=="object",l=!b.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node&&process.type!="renderer";l?b=global:g&&(b=self);var E=!b.JS_SHA256_NO_COMMON_JS&&typeof St=="object"&&St.exports,T=typeof define=="function"&&define.amd,S=!b.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",A="0123456789abcdef".split(""),M=[-2147483648,8388608,32768,128],O=[24,16,8,0],Q=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],ie=["hex","array","digest","arrayBuffer"],V=[];(b.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}),S&&(b.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(x){return typeof x=="object"&&x.buffer&&x.buffer.constructor===ArrayBuffer});var je=function(x,G){return function(z){return new we(G,!0).update(z)[x]()}},oe=function(x){var G=je("hex",x);l&&(G=Se(G,x)),G.create=function(){return new we(x)},G.update=function(X){return G.create().update(X)};for(var z=0;z<ie.length;++z){var N=ie[z];G[N]=je(N,x)}return G},Se=function(x,G){var z=ba(),N=ma().Buffer,X=G?"sha224":"sha256",q;N.from&&!b.JS_SHA256_NO_BUFFER_FROM?q=N.from:q=function(H){return new N(H)};var Y=function(H){if(typeof H=="string")return z.createHash(X).update(H,"utf8").digest("hex");if(H==null)throw new Error(w);return H.constructor===ArrayBuffer&&(H=new Uint8Array(H)),Array.isArray(H)||ArrayBuffer.isView(H)||H.constructor===N?z.createHash(X).update(q(H)).digest("hex"):x(H)};return Y},De=function(x,G){return function(z,N){return new Ie(z,G,!0).update(N)[x]()}},ye=function(x){var G=De("hex",x);G.create=function(X){return new Ie(X,x)},G.update=function(X,q){return G.create(X).update(q)};for(var z=0;z<ie.length;++z){var N=ie[z];G[N]=De(N,x)}return G};function we(x,G){G?(V[0]=V[16]=V[1]=V[2]=V[3]=V[4]=V[5]=V[6]=V[7]=V[8]=V[9]=V[10]=V[11]=V[12]=V[13]=V[14]=V[15]=0,this.blocks=V):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],x?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=x}we.prototype.update=function(x){if(!this.finalized){var G,z=typeof x;if(z!=="string"){if(z==="object"){if(x===null)throw new Error(w);if(S&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!S||!ArrayBuffer.isView(x)))throw new Error(w)}else throw new Error(w);G=!0}for(var N,X=0,q,Y=x.length,H=this.blocks;X<Y;){if(this.hashed&&(this.hashed=!1,H[0]=this.block,this.block=H[16]=H[1]=H[2]=H[3]=H[4]=H[5]=H[6]=H[7]=H[8]=H[9]=H[10]=H[11]=H[12]=H[13]=H[14]=H[15]=0),G)for(q=this.start;X<Y&&q<64;++X)H[q>>>2]|=x[X]<<O[q++&3];else for(q=this.start;X<Y&&q<64;++X)N=x.charCodeAt(X),N<128?H[q>>>2]|=N<<O[q++&3]:N<2048?(H[q>>>2]|=(192|N>>>6)<<O[q++&3],H[q>>>2]|=(128|N&63)<<O[q++&3]):N<55296||N>=57344?(H[q>>>2]|=(224|N>>>12)<<O[q++&3],H[q>>>2]|=(128|N>>>6&63)<<O[q++&3],H[q>>>2]|=(128|N&63)<<O[q++&3]):(N=65536+((N&1023)<<10|x.charCodeAt(++X)&1023),H[q>>>2]|=(240|N>>>18)<<O[q++&3],H[q>>>2]|=(128|N>>>12&63)<<O[q++&3],H[q>>>2]|=(128|N>>>6&63)<<O[q++&3],H[q>>>2]|=(128|N&63)<<O[q++&3]);this.lastByteIndex=q,this.bytes+=q-this.start,q>=64?(this.block=H[16],this.start=q-64,this.hash(),this.hashed=!0):this.start=q}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},we.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var x=this.blocks,G=this.lastByteIndex;x[16]=this.block,x[G>>>2]|=M[G&3],this.block=x[16],G>=56&&(this.hashed||this.hash(),x[0]=this.block,x[16]=x[1]=x[2]=x[3]=x[4]=x[5]=x[6]=x[7]=x[8]=x[9]=x[10]=x[11]=x[12]=x[13]=x[14]=x[15]=0),x[14]=this.hBytes<<3|this.bytes>>>29,x[15]=this.bytes<<3,this.hash()}},we.prototype.hash=function(){var x=this.h0,G=this.h1,z=this.h2,N=this.h3,X=this.h4,q=this.h5,Y=this.h6,H=this.h7,J=this.blocks,ne,F,ae,Ke,ve,We,Me,Xe,ur,lr,yr;for(ne=16;ne<64;++ne)ve=J[ne-15],F=(ve>>>7|ve<<25)^(ve>>>18|ve<<14)^ve>>>3,ve=J[ne-2],ae=(ve>>>17|ve<<15)^(ve>>>19|ve<<13)^ve>>>10,J[ne]=J[ne-16]+F+J[ne-7]+ae<<0;for(yr=G&z,ne=0;ne<64;ne+=4)this.first?(this.is224?(Xe=300032,ve=J[0]-1413257819,H=ve-150054599<<0,N=ve+24177077<<0):(Xe=704751109,ve=J[0]-210244248,H=ve-1521486534<<0,N=ve+143694565<<0),this.first=!1):(F=(x>>>2|x<<30)^(x>>>13|x<<19)^(x>>>22|x<<10),ae=(X>>>6|X<<26)^(X>>>11|X<<21)^(X>>>25|X<<7),Xe=x&G,Ke=Xe^x&z^yr,Me=X&q^~X&Y,ve=H+ae+Me+Q[ne]+J[ne],We=F+Ke,H=N+ve<<0,N=ve+We<<0),F=(N>>>2|N<<30)^(N>>>13|N<<19)^(N>>>22|N<<10),ae=(H>>>6|H<<26)^(H>>>11|H<<21)^(H>>>25|H<<7),ur=N&x,Ke=ur^N&G^Xe,Me=H&X^~H&q,ve=Y+ae+Me+Q[ne+1]+J[ne+1],We=F+Ke,Y=z+ve<<0,z=ve+We<<0,F=(z>>>2|z<<30)^(z>>>13|z<<19)^(z>>>22|z<<10),ae=(Y>>>6|Y<<26)^(Y>>>11|Y<<21)^(Y>>>25|Y<<7),lr=z&N,Ke=lr^z&x^ur,Me=Y&H^~Y&X,ve=q+ae+Me+Q[ne+2]+J[ne+2],We=F+Ke,q=G+ve<<0,G=ve+We<<0,F=(G>>>2|G<<30)^(G>>>13|G<<19)^(G>>>22|G<<10),ae=(q>>>6|q<<26)^(q>>>11|q<<21)^(q>>>25|q<<7),yr=G&z,Ke=yr^G&N^lr,Me=q&Y^~q&H,ve=X+ae+Me+Q[ne+3]+J[ne+3],We=F+Ke,X=x+ve<<0,x=ve+We<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+x<<0,this.h1=this.h1+G<<0,this.h2=this.h2+z<<0,this.h3=this.h3+N<<0,this.h4=this.h4+X<<0,this.h5=this.h5+q<<0,this.h6=this.h6+Y<<0,this.h7=this.h7+H<<0},we.prototype.hex=function(){this.finalize();var x=this.h0,G=this.h1,z=this.h2,N=this.h3,X=this.h4,q=this.h5,Y=this.h6,H=this.h7,J=A[x>>>28&15]+A[x>>>24&15]+A[x>>>20&15]+A[x>>>16&15]+A[x>>>12&15]+A[x>>>8&15]+A[x>>>4&15]+A[x&15]+A[G>>>28&15]+A[G>>>24&15]+A[G>>>20&15]+A[G>>>16&15]+A[G>>>12&15]+A[G>>>8&15]+A[G>>>4&15]+A[G&15]+A[z>>>28&15]+A[z>>>24&15]+A[z>>>20&15]+A[z>>>16&15]+A[z>>>12&15]+A[z>>>8&15]+A[z>>>4&15]+A[z&15]+A[N>>>28&15]+A[N>>>24&15]+A[N>>>20&15]+A[N>>>16&15]+A[N>>>12&15]+A[N>>>8&15]+A[N>>>4&15]+A[N&15]+A[X>>>28&15]+A[X>>>24&15]+A[X>>>20&15]+A[X>>>16&15]+A[X>>>12&15]+A[X>>>8&15]+A[X>>>4&15]+A[X&15]+A[q>>>28&15]+A[q>>>24&15]+A[q>>>20&15]+A[q>>>16&15]+A[q>>>12&15]+A[q>>>8&15]+A[q>>>4&15]+A[q&15]+A[Y>>>28&15]+A[Y>>>24&15]+A[Y>>>20&15]+A[Y>>>16&15]+A[Y>>>12&15]+A[Y>>>8&15]+A[Y>>>4&15]+A[Y&15];return this.is224||(J+=A[H>>>28&15]+A[H>>>24&15]+A[H>>>20&15]+A[H>>>16&15]+A[H>>>12&15]+A[H>>>8&15]+A[H>>>4&15]+A[H&15]),J},we.prototype.toString=we.prototype.hex,we.prototype.digest=function(){this.finalize();var x=this.h0,G=this.h1,z=this.h2,N=this.h3,X=this.h4,q=this.h5,Y=this.h6,H=this.h7,J=[x>>>24&255,x>>>16&255,x>>>8&255,x&255,G>>>24&255,G>>>16&255,G>>>8&255,G&255,z>>>24&255,z>>>16&255,z>>>8&255,z&255,N>>>24&255,N>>>16&255,N>>>8&255,N&255,X>>>24&255,X>>>16&255,X>>>8&255,X&255,q>>>24&255,q>>>16&255,q>>>8&255,q&255,Y>>>24&255,Y>>>16&255,Y>>>8&255,Y&255];return this.is224||J.push(H>>>24&255,H>>>16&255,H>>>8&255,H&255),J},we.prototype.array=we.prototype.digest,we.prototype.arrayBuffer=function(){this.finalize();var x=new ArrayBuffer(this.is224?28:32),G=new DataView(x);return G.setUint32(0,this.h0),G.setUint32(4,this.h1),G.setUint32(8,this.h2),G.setUint32(12,this.h3),G.setUint32(16,this.h4),G.setUint32(20,this.h5),G.setUint32(24,this.h6),this.is224||G.setUint32(28,this.h7),x};function Ie(x,G,z){var N,X=typeof x;if(X==="string"){var q=[],Y=x.length,H=0,J;for(N=0;N<Y;++N)J=x.charCodeAt(N),J<128?q[H++]=J:J<2048?(q[H++]=192|J>>>6,q[H++]=128|J&63):J<55296||J>=57344?(q[H++]=224|J>>>12,q[H++]=128|J>>>6&63,q[H++]=128|J&63):(J=65536+((J&1023)<<10|x.charCodeAt(++N)&1023),q[H++]=240|J>>>18,q[H++]=128|J>>>12&63,q[H++]=128|J>>>6&63,q[H++]=128|J&63);x=q}else if(X==="object"){if(x===null)throw new Error(w);if(S&&x.constructor===ArrayBuffer)x=new Uint8Array(x);else if(!Array.isArray(x)&&(!S||!ArrayBuffer.isView(x)))throw new Error(w)}else throw new Error(w);x.length>64&&(x=new we(G,!0).update(x).array());var ne=[],F=[];for(N=0;N<64;++N){var ae=x[N]||0;ne[N]=92^ae,F[N]=54^ae}we.call(this,G,z),this.update(F),this.oKeyPad=ne,this.inner=!0,this.sharedMemory=z}Ie.prototype=new we,Ie.prototype.finalize=function(){if(we.prototype.finalize.call(this),this.inner){this.inner=!1;var x=this.array();we.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(x),we.prototype.finalize.call(this)}};var Fe=oe();Fe.sha256=Fe,Fe.sha224=oe(!0),Fe.sha256.hmac=ye(),Fe.sha224.hmac=ye(!0),E?St.exports=Fe:(b.sha256=Fe.sha256,b.sha224=Fe.sha224,T&&define(function(){return Fe}))})()});var Dn=pr(()=>{});var Rn=pr(()=>{});var Da=pr((Aa,Ft)=>{"use strict";var Cn=(()=>{var d;var w=typeof document<"u"?(d=document.currentScript)==null?void 0:d.src:void 0;return typeof __filename<"u"&&(w=w||__filename),async function(b={}){var g,l=b,E,T,S=new Promise((e,r)=>{E=e,T=r}),A=typeof window=="object",M=typeof WorkerGlobalScope<"u",O=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer",Q=Object.assign({},l),ie=[],V="./this.program",je=(e,r)=>{throw r},oe="";function Se(e){return l.locateFile?l.locateFile(e,oe):oe+e}var De,ye;if(O){var we=Dn(),Ie=Rn();oe=__dirname+"/",ye=e=>{e=Me(e)?new URL(e):e;var r=we.readFileSync(e);return r},De=async(e,r=!0)=>{e=Me(e)?new URL(e):e;var t=we.readFileSync(e,r?void 0:"utf8");return t},!l.thisProgram&&process.argv.length>1&&(V=process.argv[1].replace(/\\/g,"/")),ie=process.argv.slice(2),je=(e,r)=>{throw process.exitCode=e,r}}else(A||M)&&(M?oe=self.location.href:typeof document<"u"&&document.currentScript&&(oe=document.currentScript.src),w&&(oe=w),oe.startsWith("blob:")?oe="":oe=oe.slice(0,oe.replace(/[?#].*/,"").lastIndexOf("/")+1),M&&(ye=e=>{var r=new XMLHttpRequest;return r.open("GET",e,!1),r.responseType="arraybuffer",r.send(null),new Uint8Array(r.response)}),De=async e=>{var r=await fetch(e,{credentials:"same-origin"});if(r.ok)return r.arrayBuffer();throw new Error(r.status+" : "+r.url)});var Fe=l.print||console.log.bind(console),x=l.printErr||console.error.bind(console);Object.assign(l,Q),Q=null,l.arguments&&(ie=l.arguments),l.thisProgram&&(V=l.thisProgram);var G=l.wasmBinary,z,N=!1,X;function q(e,r){e||Re(r)}var Y,H,J,ne,F,ae,Ke,ve,We=!1,Me=e=>e.startsWith("file://");function Xe(){var e=z.buffer;l.HEAP8=Y=new Int8Array(e),l.HEAP16=J=new Int16Array(e),l.HEAPU8=H=new Uint8Array(e),l.HEAPU16=ne=new Uint16Array(e),l.HEAP32=F=new Int32Array(e),l.HEAPU32=ae=new Uint32Array(e),l.HEAPF32=Ke=new Float32Array(e),l.HEAPF64=ve=new Float64Array(e)}function ur(){if(l.preRun)for(typeof l.preRun=="function"&&(l.preRun=[l.preRun]);l.preRun.length;)Xt(l.preRun.shift());Rr(Sr)}function lr(){We=!0,ee.vh()}function yr(){}function It(){if(l.postRun)for(typeof l.postRun=="function"&&(l.postRun=[l.postRun]);l.postRun.length;)$t(l.postRun.shift());Rr(Cr)}var Be=0,Ve=null;function Bt(e){var r;Be++,(r=l.monitorRunDependencies)==null||r.call(l,Be)}function Nt(e){var t;if(Be--,(t=l.monitorRunDependencies)==null||t.call(l,Be),Be==0&&Ve){var r=Ve;Ve=null,r()}}function Re(e){var t;(t=l.onAbort)==null||t.call(l,e),e="Aborted("+e+")",x(e),N=!0,e+=". Build with -sASSERTIONS for more info.";var r=new WebAssembly.RuntimeError(e);throw T(r),r}var Je;function Pt(){return Se("./duckdb-mvp.wasm")}function Mt(e){if(e==Je&&G)return new Uint8Array(G);if(ye)return ye(e);throw"both async and sync fetching of the wasm failed"}async function Lt(e){if(!G)try{var r=await De(e);return new Uint8Array(r)}catch(t){}return Mt(e)}async function Ot(e,r){try{var t=await Lt(e),i=await WebAssembly.instantiate(t,r);return i}catch(n){x("failed to asynchronously prepare wasm: ".concat(n)),Re(n)}}async function Wt(e,r,t){if(!e&&typeof WebAssembly.instantiateStreaming=="function"&&!O)try{var i=fetch(r,{credentials:"same-origin"}),n=await WebAssembly.instantiateStreaming(i,t);return n}catch(a){x("wasm streaming compile failed: ".concat(a)),x("falling back to ArrayBuffer instantiation")}return Ot(r,t)}function qt(){return{a:Gn}}async function Kt(){function e(a,s){return ee=a.exports,ee=L_(ee),z=ee.uh,Xe(),fn=ee.xh,Nt("wasm-instantiate"),ee}Bt("wasm-instantiate");function r(a){return e(a.instance)}var t=qt();if(l.instantiateWasm)return new Promise((a,s)=>{l.instantiateWasm(t,(o,c)=>{e(o,c),a(o.exports)})});Je!=null||(Je=Pt());try{var i=await Wt(G,Je,t),n=r(i);return n}catch(a){return T(a),Promise.reject(a)}}var _e,xe,Gt={10165216:(e,r,t,i)=>{var n=me(e);if(typeof XMLHttpRequest>"u")return 0;let a=new XMLHttpRequest;a.open(me(i),n,!1),a.responseType="arraybuffer";for(var s=0,_=r;s<_*2;){var o=F[t/4+s>>>0],c=F[t/4+s+1>>>0];try{var u=encodeURI(me(o));u==="Host"&&(u="X-Host-Override"),u==="User-Agent"&&(u="X-user-agent"),u==="Authorization"?a.setRequestHeader(u,me(c)):a.setRequestHeader(u,encodeURI(me(c)))}catch(re){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",re)}s+=2}try{a.send(null)}catch(re){return 0}if(a.status>=400)return 0;for(var f=a.response,_=f.byteLength,m=B(_+4),k=new Uint8Array(f),D=0;D<_;D++)l.HEAPU8[D+m+4]=k[D];var R=new Uint8Array(4);return R[0]=_%256,_-=R[0],_/=256,R[1]=_%256,_-=R[1],_/=256,R[2]=_%256,_-=R[2],_/=256,R[3]=_%256,_-=R[3],_/=256,l.HEAPU8.set(R,m),m},10166623:(e,r,t,i,n,a)=>{var s=me(e);if(typeof XMLHttpRequest>"u")return 0;let o=new XMLHttpRequest;o.open(me(i),s,!1),o.responseType="arraybuffer";for(var c=0,R=r;c<R*2;){var u=F[t/4+c>>>0],f=F[t/4+c+1>>>0];try{var _=encodeURI(me(u));_==="Host"&&(_="X-Host-Override"),_==="User-Agent"&&(_="X-user-agent"),_==="Authorization"?o.setRequestHeader(_,me(f)):o.setRequestHeader(_,encodeURI(me(f)))}catch(Ce){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Ce)}c+=2}try{for(var m=new Uint8Array(a),k=0;k<a;k++)m[k]=l.HEAPU8[k+n];o.send(m)}catch(Ce){return 0}if(o.status>=400)return 0;for(var D=Uint8Array.from(Array.from(o.getResponseHeader("Etag")).map(Ce=>Ce.charCodeAt(0))),R=D.byteLength,re=B(R+4),de=new Uint8Array(D),k=0;k<R;k++)l.HEAPU8[k+re+4]=de[k];var ce=new Uint8Array(4);return ce[0]=R%256,R-=ce[0],R/=256,ce[1]=R%256,R-=ce[1],R/=256,ce[2]=R%256,R-=ce[2],R/=256,ce[3]=R%256,R-=ce[3],R/=256,l.HEAPU8.set(ce,re),re},10168243:(e,r,t,i)=>{var n=me(e);if(typeof XMLHttpRequest>"u")return 0;let a=new XMLHttpRequest;a.open(me(i),n,!1),a.responseType="arraybuffer";for(var s=0,_=r;s<_*2;){var o=F[t/4+s>>>0],c=F[t/4+s+1>>>0];console.log("HEAD",me(o),me(c));try{var u=encodeURI(me(o));u==="Host"&&(u="X-Host-Override"),u==="User-Agent"&&(u="X-user-agent"),u==="Authorization"?a.setRequestHeader(u,me(c)):a.setRequestHeader(u,encodeURI(me(c)))}catch(ce){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",ce)}s+=2}try{a.send(null)}catch(ce){return 0}if(a.status>=400)return 0;for(var f=a.response,_=f.byteLength,m=B(_+8),k=new Uint8Array(f),D=0;D<_;D++)l.HEAPU8[D+m+8]=k[D];var R=new Uint8Array(4);R[0]=_%256,_-=R[0],_/=256,R[1]=_%256,_-=R[1],_/=256,R[2]=_%256,_-=R[2],_/=256,R[3]=_%256,_-=R[3],_/=256,l.HEAPU8.set(R,m+4);var re=Uint8Array.from(Array.from(a.getAllResponseHeaders()).map(ce=>ce.charCodeAt(0)));_=re.byteLength;for(var de=B(_+8),D=0;D<_;D++)l.HEAPU8[D+de+8]=re[D];return R=new Uint8Array(4),R[0]=_%256,_-=R[0],_/=256,R[1]=_%256,_-=R[1],_/=256,R[2]=_%256,_-=R[2],_/=256,R[3]=_%256,_-=R[3],_/=256,l.HEAPU8.set(R,de+4),_=de,R=new Uint8Array(4),R[0]=_%256,_-=R[0],_/=256,R[1]=_%256,_-=R[1],_/=256,R[2]=_%256,_-=R[2],_/=256,R[3]=_%256,_-=R[3],_/=256,l.HEAPU8.set(R,m),m},10170588:(e,r,t,i)=>{var n=me(e);if(typeof XMLHttpRequest>"u")return 0;let a=new XMLHttpRequest;a.open(me(i),n,!1),a.responseType="arraybuffer";for(var s=0,_=r;s<_*2;){var o=F[t/4+s>>>0],c=F[t/4+s+1>>>0];try{var u=encodeURI(me(o));u==="Host"&&(u="X-Host-Override"),u==="User-Agent"&&(u="X-user-agent"),u==="Authorization"?a.setRequestHeader(u,me(c)):a.setRequestHeader(u,encodeURI(me(c)))}catch(re){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",re)}s+=2}try{a.send(null)}catch(re){return 0}if(a.status>=400)return 0;for(var f=a.response,_=f.byteLength,m=B(_+4),k=new Uint8Array(f),D=0;D<_;D++)l.HEAPU8[D+m+4]=k[D];var R=new Uint8Array(4);return R[0]=_%256,_-=R[0],_/=256,R[1]=_%256,_-=R[1],_/=256,R[2]=_%256,_-=R[2],_/=256,R[3]=_%256,_-=R[3],_/=256,l.HEAPU8.set(R,m),m},10171995:(e,r,t,i,n,a)=>{var s=me(e);if(typeof XMLHttpRequest>"u")return 0;let o=new XMLHttpRequest;o.open(me(i),s,!1),o.responseType="arraybuffer";for(var c=0,R=r;c<R*2;){var u=F[t/4+c>>>0],f=F[t/4+c+1>>>0];try{var _=encodeURI(me(u));_==="Host"&&(_="X-Host-Override"),_==="User-Agent"&&(_="X-user-agent"),_==="Authorization"?o.setRequestHeader(_,me(f)):o.setRequestHeader(_,encodeURI(me(f)))}catch(Ce){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Ce)}c+=2}try{for(var m=new Uint8Array(a),k=0;k<a;k++)m[k]=l.HEAPU8[k+n];o.send(m)}catch(Ce){return 0}if(o.status>=400)return 0;for(var D=o.response,R=D.byteLength,re=B(R+4),de=new Uint8Array(D),k=0;k<R;k++)l.HEAPU8[k+re+4]=de[k];var ce=new Uint8Array(4);return ce[0]=R%256,R-=ce[0],R/=256,ce[1]=R%256,R-=ce[1],R/=256,ce[2]=R%256,R-=ce[2],R/=256,ce[3]=R%256,R-=ce[3],R/=256,l.HEAPU8.set(ce,re),re}};class Dr{constructor(r){mt(this,"name","ExitStatus");this.message="Program terminated with exit(".concat(r,")"),this.status=r}}var Rr=e=>{for(;e.length>0;)e.shift()(l)},Cr=[],$t=e=>Cr.unshift(e),Sr=[],Xt=e=>Sr.unshift(e),Vt=l.noExitRuntime||!0,p=e=>Ae(e),v=()=>Te(),Ne=[],sr=0,Ye=(e,r)=>r+2097152>>>0<4194305-!!e?(e>>>0)+r*4294967296:NaN;function Wr(e){e>>>=0;var r=new He(e);return r.get_caught()||(r.set_caught(!0),sr--),r.set_rethrown(!1),Ne.push(r),___cxa_increment_exception_refcount(e),___cxa_get_exception_ptr(e)}function br(){if(!Ne.length)return 0;var e=Ne[Ne.length-1];return ___cxa_increment_exception_refcount(e.excPtr),e.excPtr}var Le=0,Fr=()=>{_setThrew(0,0);var e=Ne.pop();___cxa_decrement_exception_refcount(e.excPtr),Le=0};class He{constructor(r){this.excPtr=r,this.ptr=r-24}set_type(r){ae[this.ptr+4>>>2>>>0]=r}get_type(){return ae[this.ptr+4>>>2>>>0]}set_destructor(r){ae[this.ptr+8>>>2>>>0]=r}get_destructor(){return ae[this.ptr+8>>>2>>>0]}set_caught(r){r=r?1:0,Y[this.ptr+12>>>0]=r}get_caught(){return Y[this.ptr+12>>>0]!=0}set_rethrown(r){r=r?1:0,Y[this.ptr+13>>>0]=r}get_rethrown(){return Y[this.ptr+13>>>0]!=0}init(r,t){this.set_adjusted_ptr(0),this.set_type(r),this.set_destructor(t)}set_adjusted_ptr(r){ae[this.ptr+16>>>2>>>0]=r}get_adjusted_ptr(){return ae[this.ptr+16>>>2>>>0]}}function qr(e){throw e>>>=0,Le||(Le=e),Le}var Oe=e=>le(e),mr=e=>{var r=Le;if(!r)return Oe(0),0;var t=new He(r);t.set_adjusted_ptr(r);var i=t.get_type();if(!i)return Oe(0),r;for(var n of e){if(n===0||n===i)break;var a=t.ptr+16;if(___cxa_can_catch(n,i,a))return Oe(n),r}return Oe(i),r};function Jt(){return mr([])}function Yt(e){return e>>>=0,mr([e])}function Qt(e,r){return e>>>=0,r>>>=0,mr([e,r])}function Kr(e,r,t){return e>>>=0,r>>>=0,t>>>=0,mr([e,r,t])}var Ur=()=>{var e=Ne.pop();e||Re("no exception to throw");var r=e.excPtr;throw e.get_rethrown()||(Ne.push(e),e.set_rethrown(!0),e.set_caught(!1),sr++),Le=r,Le};function be(e){if(e>>>=0,!!e){var r=new He(e);Ne.push(r),r.set_rethrown(!0),Ur()}}function xr(e,r,t){e>>>=0,r>>>=0,t>>>=0;var i=new He(e);throw i.init(r,t),Le=e,sr++,Le}var zt=()=>sr;function Gr(){Re("missing function: $SOCKFS")}Gr.stub=!0;function Hr(){Re("missing function: $FS")}Hr.stub=!0;var nr=e=>{var r=Gr.getSocket(e);if(!r)throw new Hr.ErrnoError(8);return r},Ir=e=>(e&255)+"."+(e>>8&255)+"."+(e>>16&255)+"."+(e>>24&255),Qe=e=>{var r="",t=0,i=0,n=0,a=0,s=0,o=0,c=[e[0]&65535,e[0]>>16,e[1]&65535,e[1]>>16,e[2]&65535,e[2]>>16,e[3]&65535,e[3]>>16],u=!0,f="";for(o=0;o<5;o++)if(c[o]!==0){u=!1;break}if(u){if(f=Ir(c[6]|c[7]<<16),c[5]===-1)return r="::ffff:",r+=f,r;if(c[5]===0)return r="::",f==="0.0.0.0"&&(f=""),f==="0.0.0.1"&&(f="1"),r+=f,r}for(t=0;t<8;t++)c[t]===0&&(t-n>1&&(s=0),n=t,s++),s>i&&(i=s,a=t-i+1);for(t=0;t<8;t++){if(i>1&&c[t]===0&&t>=a&&t<a+i){t===a&&(r+=":",a===0&&(r+=":"));continue}r+=Number(_ntohs(c[t]&65535)).toString(16),r+=t<7?":":""}return r},$r=(e,r)=>{var t=J[e>>>1>>>0],i=_ntohs(ne[e+2>>>1>>>0]),n;switch(t){case 2:if(r!==16)return{errno:28};n=F[e+4>>>2>>>0],n=Ir(n);break;case 10:if(r!==28)return{errno:28};n=[F[e+8>>>2>>>0],F[e+12>>>2>>>0],F[e+16>>>2>>>0],F[e+20>>>2>>>0]],n=Qe(n);break;default:return{errno:5}}return{family:t,addr:n,port:i}},gr=e=>{for(var r=e.split("."),t=0;t<4;t++){var i=Number(r[t]);if(isNaN(i))return null;r[t]=i}return(r[0]|r[1]<<8|r[2]<<16|r[3]<<24)>>>0},fr=e=>parseInt(e),or=e=>{var r,t,i,n,a=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i,s=[];if(!a.test(e))return null;if(e==="::")return[0,0,0,0,0,0,0,0];for(e.startsWith("::")?e=e.replace("::","Z:"):e=e.replace("::",":Z:"),e.indexOf(".")>0?(e=e.replace(new RegExp("[.]","g"),":"),r=e.split(":"),r[r.length-4]=fr(r[r.length-4])+fr(r[r.length-3])*256,r[r.length-3]=fr(r[r.length-2])+fr(r[r.length-1])*256,r=r.slice(0,r.length-2)):r=e.split(":"),i=0,n=0,t=0;t<r.length;t++)if(typeof r[t]=="string")if(r[t]==="Z"){for(n=0;n<8-r.length+1;n++)s[t+n]=0;i=n-1}else s[t+i]=_htons(parseInt(r[t],16));else s[t+i]=r[t];return[s[1]<<16|s[0],s[3]<<16|s[2],s[5]<<16|s[4],s[7]<<16|s[6]]},Pe={address_map:{id:1,addrs:{},names:{}},lookup_name(e){var r=gr(e);if(r!==null||(r=or(e),r!==null))return e;var t;if(Pe.address_map.addrs[e])t=Pe.address_map.addrs[e];else{var i=Pe.address_map.id++;q(i<65535,"exceeded max address mappings of 65535"),t="172.29."+(i&255)+"."+(i&65280),Pe.address_map.names[t]=e,Pe.address_map.addrs[e]=t}return t},lookup_addr(e){return Pe.address_map.names[e]?Pe.address_map.names[e]:null}},Xr=(e,r)=>{var t=$r(e,r);if(t.errno)throw new Hr.ErrnoError(t.errno);return t.addr=Pe.lookup_addr(t.addr)||t.addr,t};function Zt(e,r,t,i,n,a){r>>>=0,t>>>=0;var s=nr(e),o=Xr(r,t);return s.sock_ops.bind(s,o.addr,o.port),0}function ei(e,r,t,i,n,a){r>>>=0,t>>>=0;var s=nr(e),o=Xr(r,t);return s.sock_ops.connect(s,o.addr,o.port),0}var ri=(e,r,t)=>{};function ti(e,r,t,i){r>>>=0}var Vr=typeof TextDecoder<"u"?new TextDecoder:void 0,Jr=(e,r=0,t=NaN)=>{r>>>=0;for(var i=r+t,n=r;e[n]&&!(n>=i);)++n;if(n-r>16&&e.buffer&&Vr)return Vr.decode(e.subarray(r,n));for(var a="";r<n;){var s=e[r++];if(!(s&128)){a+=String.fromCharCode(s);continue}var o=e[r++]&63;if((s&224)==192){a+=String.fromCharCode((s&31)<<6|o);continue}var c=e[r++]&63;if((s&240)==224?s=(s&15)<<12|o<<6|c:s=(s&7)<<18|o<<12|c<<6|e[r++]&63,s<65536)a+=String.fromCharCode(s);else{var u=s-65536;a+=String.fromCharCode(55296|u>>10,56320|u&1023)}}return a},me=(e,r)=>(e>>>=0,e?Jr(H,e,r):""),Br={varargs:void 0,getStr(e){var r=me(e);return r}};function ii(e,r,t){return t>>>=0,Br.varargs=t,0}function ni(e,r){r>>>=0}function ai(e,r,t){var i=Ye(r,t)}var Yr=e=>{for(var r=0,t=0;t<e.length;++t){var i=e.charCodeAt(t);i<=127?r++:i<=2047?r+=2:i>=55296&&i<=57343?(r+=4,++t):r+=3}return r};l.lengthBytesUTF8=Yr;var si=(e,r,t,i)=>{if(t>>>=0,!(i>0))return 0;for(var n=t,a=t+i-1,s=0;s<e.length;++s){var o=e.charCodeAt(s);if(o>=55296&&o<=57343){var c=e.charCodeAt(++s);o=65536+((o&1023)<<10)|c&1023}if(o<=127){if(t>=a)break;r[t++>>>0]=o}else if(o<=2047){if(t+1>=a)break;r[t++>>>0]=192|o>>6,r[t++>>>0]=128|o&63}else if(o<=65535){if(t+2>=a)break;r[t++>>>0]=224|o>>12,r[t++>>>0]=128|o>>6&63,r[t++>>>0]=128|o&63}else{if(t+3>=a)break;r[t++>>>0]=240|o>>18,r[t++>>>0]=128|o>>12&63,r[t++>>>0]=128|o>>6&63,r[t++>>>0]=128|o&63}}return r[t>>>0]=0,t-n},rr=(e,r,t)=>si(e,H,r,t);l.stringToUTF8=rr;function oi(e,r){e>>>=0,r>>>=0}function ci(e,r,t){r>>>=0,t>>>=0}var Qr=(e,r)=>{H.fill(0,e,e+r)},_r=(e,r,t,i,n)=>{switch(r){case 2:t=gr(t),Qr(e,16),n&&(F[n>>>2>>>0]=16),J[e>>>1>>>0]=r,F[e+4>>>2>>>0]=t,J[e+2>>>1>>>0]=_htons(i);break;case 10:t=or(t),Qr(e,28),n&&(F[n>>>2>>>0]=28),F[e>>>2>>>0]=r,F[e+8>>>2>>>0]=t[0],F[e+12>>>2>>>0]=t[1],F[e+16>>>2>>>0]=t[2],F[e+20>>>2>>>0]=t[3],J[e+2>>>1>>>0]=_htons(i);break;default:return 5}return 0};function zr(e,r,t,i,n,a){r>>>=0,t>>>=0;var s=nr(e);if(!s.daddr)return-53;var o=_r(r,s.family,Pe.lookup_name(s.daddr),s.dport,t);return 0}function Zr(e,r,t,i,n,a){r>>>=0,t>>>=0;var s=nr(e),o=_r(r,s.family,Pe.lookup_name(s.saddr||"0.0.0.0"),s.sport,t);return 0}function et(e,r,t,i,n,a){i>>>=0,n>>>=0;var s=nr(e);return r===1&&t===4?(F[i>>>2>>>0]=s.error,F[n>>>2>>>0]=4,s.error=null,0):-50}function rt(e,r,t){return t>>>=0,Br.varargs=t,0}function ui(e,r){e>>>=0,r>>>=0}function li(e,r,t){r>>>=0}function fi(e,r,t,i){r>>>=0,t>>>=0}function _i(e,r,t,i){r>>>=0,i>>>=0,Br.varargs=i}function di(e,r,t){e>>>=0}function hi(e,r,t,i){r>>>=0,t>>>=0,i>>>=0}function vi(e,r,t,i,n,a){r>>>=0,t>>>=0,n>>>=0,a>>>=0;var s=nr(e),o=s.sock_ops.recvmsg(s,t);if(!o)return 0;if(n)var c=_r(n,s.family,Pe.lookup_name(o.addr),o.port,a);return H.set(o.buffer,r>>>0),o.buffer.byteLength}function pi(e,r,t,i){r>>>=0,i>>>=0}function tt(e){e>>>=0}function it(e,r,t,i,n,a){r>>>=0,t>>>=0,n>>>=0,a>>>=0}var wi=(e,r,t)=>{};function yi(e,r){e>>>=0,r>>>=0}function bi(e,r,t){e>>>=0,r>>>=0,t>>>=0}function mi(e,r,t){r>>>=0}var gi=()=>Re(""),ji=()=>{throw 1/0};function nt(){Re("missing function: _emval_call_method")}nt.stub=!0;function at(){Re("missing function: _emval_decref")}at.stub=!0;function st(){Re("missing function: _emval_get_global")}st.stub=!0;function ot(){Re("missing function: _emval_get_method_caller")}ot.stub=!0;function ct(){Re("missing function: _emval_run_destructors")}ct.stub=!0;var ki=e=>e%4===0&&(e%100!==0||e%400===0),Ti=[0,31,60,91,121,152,182,213,244,274,305,335],Ei=[0,31,59,90,120,151,181,212,243,273,304,334],Ai=e=>{var r=ki(e.getFullYear()),t=r?Ti:Ei,i=t[e.getMonth()]+e.getDate()-1;return i};function Di(e,r,t){var i=Ye(e,r);t>>>=0;var n=new Date(i*1e3);F[t>>>2>>>0]=n.getSeconds(),F[t+4>>>2>>>0]=n.getMinutes(),F[t+8>>>2>>>0]=n.getHours(),F[t+12>>>2>>>0]=n.getDate(),F[t+16>>>2>>>0]=n.getMonth(),F[t+20>>>2>>>0]=n.getFullYear()-1900,F[t+24>>>2>>>0]=n.getDay();var a=Ai(n)|0;F[t+28>>>2>>>0]=a,F[t+36>>>2>>>0]=-(n.getTimezoneOffset()*60);var s=new Date(n.getFullYear(),0,1),o=new Date(n.getFullYear(),6,1).getTimezoneOffset(),c=s.getTimezoneOffset(),u=(o!=c&&n.getTimezoneOffset()==Math.min(c,o))|0;F[t+32>>>2>>>0]=u}function Ri(e,r,t,i,n,a,s,o){e>>>=0;var c=Ye(n,a);return s>>>=0,o>>>=0,-52}function Ci(e,r,t,i,n,a,s){e>>>=0,r>>>=0;var o=Ye(a,s)}var Si=function(e,r,t,i){e>>>=0,r>>>=0,t>>>=0,i>>>=0;var n=new Date().getFullYear(),a=new Date(n,0,1),s=new Date(n,6,1),o=a.getTimezoneOffset(),c=s.getTimezoneOffset(),u=Math.max(o,c);ae[e>>>2>>>0]=u*60,F[r>>>2>>>0]=+(o!=c);var f=k=>{var D=k>=0?"-":"+",R=Math.abs(k),re=String(Math.floor(R/60)).padStart(2,"0"),de=String(R%60).padStart(2,"0");return"UTC".concat(D).concat(re).concat(de)},_=f(o),m=f(c);c<o?(rr(_,t,17),rr(m,i,17)):(rr(_,i,17),rr(m,t,17))},jr=()=>performance.now(),ut=()=>Date.now(),Fi=1,Ui=e=>e>=0&&e<=3;function lt(e,r,t,i){var n=Ye(r,t);if(i>>>=0,!Ui(e))return 28;var a;if(e===0)a=ut();else if(Fi)a=jr();else return 52;var s=Math.round(a*1e3*1e3);return xe=[s>>>0,(_e=s,+Math.abs(_e)>=1?_e>0?+Math.floor(_e/4294967296)>>>0:~~+Math.ceil((_e-+(~~_e>>>0))/4294967296)>>>0:0)],F[i>>>2>>>0]=xe[0],F[i+4>>>2>>>0]=xe[1],0}function xi(e,r){return e>>>=0,globalThis.DUCKDB_RUNTIME.createDirectory(l,e,r)}function Hi(e,r){return e>>>=0,globalThis.DUCKDB_RUNTIME.checkDirectory(l,e,r)}function Ii(e,r){return e>>>=0,globalThis.DUCKDB_RUNTIME.listDirectoryEntries(l,e,r)}function Bi(e,r){return e>>>=0,globalThis.DUCKDB_RUNTIME.removeDirectory(l,e,r)}function Nr(e){return globalThis.DUCKDB_RUNTIME.closeFile(l,e)}function Ni(e,r){return e>>>=0,globalThis.DUCKDB_RUNTIME.dropFile(l,e,r)}function dr(e,r){return e>>>=0,globalThis.DUCKDB_RUNTIME.checkFile(l,e,r)}function Pi(e,r,t,i){return e>>>=0,t>>>=0,globalThis.DUCKDB_RUNTIME.moveFile(l,e,r,t,i)}function Mi(e,r){return globalThis.DUCKDB_RUNTIME.openFile(l,e,r)}function Li(e,r,t,i){return r>>>=0,globalThis.DUCKDB_RUNTIME.readFile(l,e,r,t,i)}function Oi(e,r){return globalThis.DUCKDB_RUNTIME.truncateFile(l,e,r)}function Wi(e,r,t,i){return r>>>=0,globalThis.DUCKDB_RUNTIME.writeFile(l,e,r,t,i)}function qi(e){return globalThis.DUCKDB_RUNTIME.getDefaultDataProtocol(e)}function ft(e,r){return e>>>=0,globalThis.DUCKDB_RUNTIME.glob(l,e,r)}function Ki(e){return globalThis.DUCKDB_RUNTIME.testPlatformFeature(l,e)}function Gi(e,r,t,i,n,a){return e>>>=0,t>>>=0,n>>>=0,globalThis.DUCKDB_RUNTIME.callScalarUDF(l,e,r,t,i,n,a)}var Pr=[],$i=(e,r)=>{Pr.length=0;for(var t;t=H[e++>>>0];){var i=t!=105;i&=t!=112,r+=i&&r%8?4:0,Pr.push(t==112?ae[r>>>2>>>0]:t==105?F[r>>>2>>>0]:ve[r>>>3>>>0]),r+=i?8:4}return Pr},Xi=(e,r,t)=>{var i=$i(r,t);return Gt[e](...i)};function Vi(e,r,t){return e>>>=0,r>>>=0,t>>>=0,Xi(e,r,t)}var _t=()=>4294901760;function Ji(){return _t()}var Yi=(e,r)=>Math.ceil(e/r)*r,Qi=e=>{var r=z.buffer,t=(e-r.byteLength+65535)/65536|0;try{return z.grow(t),Xe(),1}catch(i){}};function zi(e){e>>>=0;var r=H.length,t=_t();if(e>t)return!1;for(var i=1;i<=4;i*=2){var n=r*(1+.2/i);n=Math.min(n,e+100663296);var a=Math.min(t,Yi(Math.max(e,n),65536)),s=Qi(a);if(s)return!0}return!1}var Mr={},Zi=()=>V||"./this.program",hr=()=>{if(!hr.strings){var e=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",r={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:e,_:Zi()};for(var t in Mr)Mr[t]===void 0?delete r[t]:r[t]=Mr[t];var i=[];for(var t in r)i.push("".concat(t,"=").concat(r[t]));hr.strings=i}return hr.strings},dt=(e,r)=>{for(var t=0;t<e.length;++t)Y[r++>>>0]=e.charCodeAt(t);Y[r>>>0]=0},en=function(e,r){e>>>=0,r>>>=0;var t=0;return hr().forEach((i,n)=>{var a=r+t;ae[e+n*4>>>2>>>0]=a,dt(i,a),t+=i.length+1}),0},rn=function(e,r){e>>>=0,r>>>=0;var t=hr();ae[e>>>2>>>0]=t.length;var i=0;return t.forEach(n=>i+=n.length+1),ae[r>>>2>>>0]=i,0},tn=0,nn=()=>Vt||tn>0,kr=e=>{var r;X=e,nn()||((r=l.onExit)==null||r.call(l,e),N=!0),je(e,new Dr(e))},ht=(e,r)=>{X=e,kr(e)},vt=ht,pt=e=>52;function an(e,r){r>>>=0;var t=0,i=0,n=0;{var a=2;e==0?t=2:(e==1||e==2)&&(t=64),n=1}return Y[r>>>0]=a,J[r+2>>>1>>>0]=n,xe=[t>>>0,(_e=t,+Math.abs(_e)>=1?_e>0?+Math.floor(_e/4294967296)>>>0:~~+Math.ceil((_e-+(~~_e>>>0))/4294967296)>>>0:0)],F[r+8>>>2>>>0]=xe[0],F[r+12>>>2>>>0]=xe[1],xe=[i>>>0,(_e=i,+Math.abs(_e)>=1?_e>0?+Math.floor(_e/4294967296)>>>0:~~+Math.ceil((_e-+(~~_e>>>0))/4294967296)>>>0:0)],F[r+16>>>2>>>0]=xe[0],F[r+20>>>2>>>0]=xe[1],0}function sn(e,r,t,i,n,a){r>>>=0,t>>>=0;var s=Ye(i,n);return a>>>=0,52}function on(e,r,t,i,n,a){r>>>=0,t>>>=0;var s=Ye(i,n);return a>>>=0,52}function cn(e,r,t,i){return r>>>=0,t>>>=0,i>>>=0,52}function Z(e,r,t,i,n){var a=Ye(r,t);return n>>>=0,70}var un=e=>52,Fn=[null,[],[]],Un=(e,r)=>{var t=Fn[e];r===0||r===10?((e===1?Fe:x)(Jr(t)),t.length=0):t.push(r)};function xn(e,r,t,i){r>>>=0,t>>>=0,i>>>=0;for(var n=0,a=0;a<t;a++){var s=ae[r>>>2>>>0],o=ae[r+4>>>2>>>0];r+=8;for(var c=0;c<o;c++)Un(e,H[s+c>>>0]);n+=o}return ae[i>>>2>>>0]=n,0}function Hn(e,r,t,i){e>>>=0,r>>>=0,t>>>=0,i>>>=0;var n=0,a=0,s=0,o=0,c=0,u=0,f;function _(m,k,D,R,re,de){var ce,Ce,Ue,tr;return Ce=m===10?28:16,re=m===10?Qe(re):Ir(re),ce=B(Ce),tr=_r(ce,m,re,de),q(!tr),Ue=B(32),F[Ue+4>>>2>>>0]=m,F[Ue+8>>>2>>>0]=k,F[Ue+12>>>2>>>0]=D,ae[Ue+24>>>2>>>0]=R,ae[Ue+20>>>2>>>0]=ce,m===10?F[Ue+16>>>2>>>0]=28:F[Ue+16>>>2>>>0]=16,F[Ue+28>>>2>>>0]=0,Ue}if(t&&(s=F[t>>>2>>>0],o=F[t+4>>>2>>>0],c=F[t+8>>>2>>>0],u=F[t+12>>>2>>>0]),c&&!u&&(u=c===2?17:6),!c&&u&&(c=u===17?2:1),u===0&&(u=6),c===0&&(c=1),!e&&!r)return-2;if(s&-1088||t!==0&&F[t>>>2>>>0]&2&&!e)return-1;if(s&32)return-2;if(c!==0&&c!==1&&c!==2)return-7;if(o!==0&&o!==2&&o!==10)return-6;if(r&&(r=me(r),a=parseInt(r,10),isNaN(a)))return s&1024?-2:-8;if(!e)return o===0&&(o=2),s&1||(o===2?n=_htonl(2130706433):n=[0,0,0,_htonl(1)]),f=_(o,c,u,null,n,a),ae[i>>>2>>>0]=f,0;if(e=me(e),n=gr(e),n!==null)if(o===0||o===2)o=2;else if(o===10&&s&8)n=[0,0,_htonl(65535),n],o=10;else return-2;else if(n=or(e),n!==null)if(o===0||o===10)o=10;else return-2;return n!=null?(f=_(o,c,u,e,n,a),ae[i>>>2>>>0]=f,0):s&4?-2:(e=Pe.lookup_name(e),n=gr(e),o===0?o=2:o===10&&(n=[0,0,_htonl(65535),n]),f=_(o,c,u,null,n,a),ae[i>>>2>>>0]=f,0)}function In(e,r,t,i,n,a,s){e>>>=0,t>>>=0,n>>>=0;var o=$r(e,r);if(o.errno)return-6;var c=o.port,u=o.addr,f=!1;if(t&&i){var _;if(s&1||!(_=Pe.lookup_addr(u))){if(s&8)return-2}else u=_;var m=rr(u,t,i);m+1>=i&&(f=!0)}if(n&&a){c=""+c;var m=rr(c,n,a);m+1>=a&&(f=!0)}return f?-12:0}function Bn(e){return e>>>=0,e}var Nn=()=>{if(O){var e=["crypto"].map(bt).pop();return r=>e.randomFillSync(r)}return r=>crypto.getRandomValues(r)},ln=e=>{(ln=Nn())(e)};function Pn(e,r){return e>>>=0,r>>>=0,ln(H.subarray(e>>>0,e+r>>>0)),0}var Mn=e=>{if(e instanceof Dr||e=="unwind")return X;je(1,e)},Lr=[],fn,K=e=>{var r=Lr[e];return r||(e>=Lr.length&&(Lr.length=e+1),Lr[e]=r=fn.get(e)),r},Ln=e=>{var r=l["_"+e];return r},On=(e,r)=>{Y.set(e,r>>>0)},Or=e=>qe(e);l.stackAlloc=Or;var Wn=e=>{var r=Yr(e)+1,t=Or(r);return rr(e,t,r),t},qn=(e,r,t,i,n)=>{var a={string:D=>{var R=0;return D!=null&&D!==0&&(R=Wn(D)),R},array:D=>{var R=Or(D.length);return On(D,R),R}};function s(D){return r==="string"?me(D):r==="boolean"?!!D:D}var o=Ln(e),c=[],u=0;if(i)for(var f=0;f<i.length;f++){var _=a[t[f]];_?(u===0&&(u=v()),c[f]=_(i[f])):c[f]=i[f]}var m=o(...c);function k(D){return u!==0&&p(u),s(D)}return m=k(m),m},Kn=e=>W(),Gn={q:Wr,Sb:br,u:Fr,a:Jt,k:Yt,B:Qt,ka:Kr,Ma:Ur,Hb:be,s:xr,K:zt,c:qr,fb:Zt,kb:ei,Kg:ri,mh:ti,aa:ii,lh:ni,Zb:ai,nh:oi,gh:ci,eb:zr,db:Zr,ib:et,xa:rt,ih:ui,hh:li,jh:fi,Ka:_i,jb:di,dh:hi,gb:vi,eh:pi,Za:tt,hb:it,Ja:wi,kh:yi,oh:bi,_a:mi,sh:gi,Lg:ji,Hg:nt,Fg:at,Jg:st,Ig:ot,Gg:ct,cc:Di,Pc:Ri,Qc:Ci,hd:Si,og:lt,Xg:xi,Yg:Hi,Vg:Ii,Wg:Bi,Wa:Nr,$g:Ni,Tg:dr,Ug:Pi,_g:Mi,sa:Li,Zg:Oi,Xa:Wi,ah:qi,Sg:ft,Va:Ki,bh:Gi,oa:Vi,Ua:ut,lb:Ji,Ca:jr,th:zi,Md:en,Xd:rn,Y:vt,la:pt,mf:an,$b:sn,_b:on,Na:cn,Cg:Z,fh:un,ya:xn,Ia:Hn,Ha:In,P:bo,I:Xs,ea:to,D:Rs,Ga:Ps,_:Os,Ta:yo,ma:cs,Pa:Ro,ga:Ks,ba:Js,Qa:ko,T:Ys,pc:Wf,jc:Vf,Hf:Cc,qb:I_,Ic:kf,Pd:bl,hc:Yf,ic:Jf,V:Is,Oa:os,ta:wo,qc:Of,If:Rc,p:hs,E:xs,ph:co,rh:ao,S:zs,fa:Cs,wa:so,R:Us,qh:oo,$a:no,Z:io,d:yt,N:eo,G:ro,Ya:lo,C:Ms,pa:fo,ja:_o,xc:Hf,Da:uo,na:ho,b:ts,Ba:Ao,xd:Bl,Ue:vu,g:is,ab:Qs,Aa:Co,za:So,j:ss,La:gs,Qg:To,ia:Do,o:ns,bb:Gs,v:ps,w:fs,H:Ds,Q:As,X:_s,ha:ws,r:ds,A:ks,Og:Fo,U:Ns,x:Bs,tb:U_,Nd:gl,wd:Nl,Ge:Cu,ud:Ml,yd:Il,Id:El,Ud:hl,vd:Pl,vb:S_,ce:al,Hd:Al,zd:Hl,Yd:fl,He:Ru,Vd:dl,_d:ul,Ld:jl,Te:pu,qf:$c,Lf:Ec,te:Wu,we:Mu,fd:Zl,Ag:No,of:Vc,Mf:Tc,Gf:Sc,nf:Jc,Ae:Iu,zg:Po,td:Ll,sd:Ol,ke:Qu,qg:Xo,rf:Gc,ze:Bu,re:Ku,fe:tl,rd:Wl,qd:ql,ld:Vl,Rc:pf,Re:yu,Jd:Tl,Wd:_l,Vf:vc,pg:Vo,kg:zo,Ef:Uc,Uf:pc,sb:x_,Ib:y_,Fb:m_,Wc:ff,Qb:l_,Tb:c_,Pb:f_,ng:Jo,wf:Lc,vf:Oc,Ke:Eu,se:qu,pb:B_,tc:Pf,Kb:p_,vg:Wo,ub:F_,ue:Ou,lg:Qo,Tf:wc,Wf:hc,Pe:mu,De:Uu,Jc:jf,kd:Jl,Gb:b_,Jb:w_,Nf:kc,$c:sf,hg:rc,Oe:gu,Mc:bf,yc:xf,Ne:ju,Le:Tu,uc:Nf,vc:Bf,rc:Lf,Rf:bc,bg:oc,ve:Lu,lc:$f,dd:rf,Df:xc,Je:Au,xf:Mc,Ve:du,We:_u,wg:Oo,tg:Ko,Qf:mc,Eg:Ho,Qe:bu,lf:Yc,Ed:Cl,wc:If,Ye:lu,zc:Uf,Gd:Dl,Xe:fu,Bd:Ul,Bc:Sf,Ec:Df,Tc:hf,kf:Qc,df:iu,Sd:pl,Td:vl,Fc:Af,$e:ou,xe:Pu,hf:Zc,Jf:Dc,Bf:Ic,Xb:n_,Ac:Ff,Yb:i_,cf:nu,Ad:xl,Cc:Cf,yf:Pc,Oc:wf,Db:j_,le:Yu,Xc:lf,zb:A_,mb:M_,Qd:yl,Eb:g_,nb:P_,sg:Go,ad:af,mc:Gf,ob:N_,bd:nf,gc:Qf,Gc:Ef,Yc:uf,sc:Mf,l:Ge,Ng:Uo,Rg:mo,Sa:go,h:rs,F:Es,Ea:Vs,J:Ws,ua:po,Ra:jo,Mg:xo,W:Ts,M:$s,va:vo,e:$e,ra:ls,cb:qs,f:as,Pg:Eo,i:us,m:js,n:ms,y:vs,t:Ss,O:Hs,L:ys,$:Fs,Fa:Ls,ca:Zs,qa:bs,fg:ic,jf:zc,pf:Xc,Hc:Tf,Nc:yf,me:Ju,zf:Nc,Be:Hu,Ie:Du,sf:Kc,Zc:cf,af:su,he:el,Vb:s_,ug:qo,Af:Bc,Cd:Fl,Nb:d_,dc:e_,ec:Zf,_c:of,gd:zl,qe:Gu,Kd:kl,Sc:vf,Zd:ll,be:sl,Cb:k_,gg:tc,yg:Mo,da:hu,rb:H_,Pf:gc,tf:qc,uf:Wc,Dc:Rf,bc:r_,ae:ol,ef:tu,ne:Vu,ge:rl,Rd:wl,ie:Zu,Ob:__,_f:lc,Vc:_f,Uc:df,Dd:Sl,ag:cc,wb:C_,cg:sc,od:Gl,xg:Lo,Kc:gf,Yf:_c,Bg:Bo,ig:ec,ed:ef,Kf:Ac,pe:$u,oe:Xu,Rb:u_,Ub:o_,id:Ql,eg:nc,Mb:h_,$d:cl,md:Xl,pd:Kl,bf:au,Dg:Io,je:zu,Fd:Rl,jd:Yl,Zf:fc,$f:uc,Bb:T_,nd:$l,Ab:E_,rg:$o,jg:Zo,Xf:dc,Me:ku,mg:Yo,Fe:Su,Ee:Fu,ye:Nu,yb:D_,xb:R_,Lb:v_,de:nl,Sf:yc,kc:Xf,oc:qf,dg:ac,Od:ml,Wb:a_,Se:wu,_e:cu,ee:il,nc:Kf,Of:jc,Ze:uu,Ff:Fc,ac:t_,cd:tf,Cf:Hc,Ce:xu,fc:zf,Lc:mf,gf:eu,ff:ru,z:Bn,ch:Pn},ee=await Kt(),$n=l._main=ee.wh,Ua=l._duckdb_web_fs_glob_add_path=ee.yh,xa=l._duckdb_web_clear_response=ee.zh,Ha=l._duckdb_web_fail_with=ee.Ah,Ia=l._duckdb_web_reset=ee.Bh,Ba=l._duckdb_web_connect=ee.Ch,Na=l._duckdb_web_disconnect=ee.Dh,Pa=l._duckdb_web_flush_files=ee.Eh,Ma=l._duckdb_web_flush_file=ee.Fh,La=l._duckdb_web_open=ee.Gh,Oa=l._duckdb_web_get_global_file_info=ee.Hh,Wa=l._duckdb_web_collect_file_stats=ee.Ih,qa=l._duckdb_web_export_file_stats=ee.Jh,Ka=l._duckdb_web_fs_drop_file=ee.Kh,Ga=l._duckdb_web_fs_drop_files=ee.Lh,$a=l._duckdb_web_fs_glob_file_infos=ee.Mh,Xa=l._duckdb_web_fs_get_file_info_by_id=ee.Nh,Va=l._duckdb_web_fs_get_file_info_by_name=ee.Oh,Ja=l._duckdb_web_fs_register_file_url=ee.Ph,Ya=l._duckdb_web_fs_register_file_buffer=ee.Qh,Qa=l._duckdb_web_copy_file_to_buffer=ee.Rh,za=l._duckdb_web_copy_file_to_path=ee.Sh,ar=l._duckdb_web_get_version=ee.Th,Za=l._duckdb_web_get_feature_flags=ee.Uh,es=l._duckdb_web_tokenize=ee.Vh,Xn=l._duckdb_web_tokenize_buffer=ee.Wh,Vn=l._duckdb_web_udf_scalar_create=ee.Xh,Jn=l._duckdb_web_prepared_create=ee.Yh,Yn=l._duckdb_web_prepared_create_buffer=ee.Zh,Qn=l._duckdb_web_prepared_close=ee._h,zn=l._duckdb_web_prepared_run=ee.$h,Zn=l._duckdb_web_prepared_send=ee.ai,wt=l._duckdb_web_query_run=ee.bi,h=l._duckdb_web_query_run_buffer=ee.ci,y=l._duckdb_web_pending_query_start=ee.di,j=l._duckdb_web_pending_query_start_buffer=ee.ei,C=l._duckdb_web_pending_query_poll=ee.fi,U=l._duckdb_web_pending_query_cancel=ee.gi,I=l._duckdb_web_query_fetch_results=ee.hi,P=l._duckdb_web_get_tablenames=ee.ii,L=l._duckdb_web_get_tablenames_buffer=ee.ji,$=l._duckdb_web_insert_arrow_from_ipc_stream=ee.ki,te=l._duckdb_web_insert_csv_from_path=ee.li,ue=l._duckdb_web_insert_json_from_path=ee.mi,B=l._malloc=ee.qi,pe=l._free=ee.ri,ge=l._calloc=ee.si,le=ee.ui,W=ee.vi,Ae=ee.wi,qe=ee.xi,Te=ee.yi;function Ge(e){var r=v();try{K(e)()}catch(t){if(p(r),t!==t+0)throw t;_setThrew(1,0)}}function $e(e,r,t){var i=v();try{K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function yt(e,r){var t=v();try{return K(e)(r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function rs(e,r){var t=v();try{K(e)(r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function ts(e,r,t){var i=v();try{return K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function is(e,r,t,i){var n=v();try{return K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function ns(e,r,t,i,n,a){var s=v();try{return K(e)(r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function as(e,r,t,i){var n=v();try{K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function ss(e,r,t,i,n){var a=v();try{return K(e)(r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function os(e,r,t,i){var n=v();try{return K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function cs(e,r,t,i){var n=v();try{return K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function us(e,r,t,i,n){var a=v();try{K(e)(r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function ls(e,r,t,i){var n=v();try{K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function fs(e,r,t,i,n,a,s,o){var c=v();try{return K(e)(r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function _s(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return K(e)(r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function ds(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{return K(e)(r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function hs(e){var r=v();try{return K(e)()}catch(t){if(p(r),t!==t+0)throw t;_setThrew(1,0)}}function vs(e,r,t,i,n,a,s,o){var c=v();try{K(e)(r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function ps(e,r,t,i,n,a,s){var o=v();try{return K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function ws(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return K(e)(r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function ys(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{K(e)(r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function bs(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R){var re=v();try{K(e)(r,t,i,n,a,s,o,c,u,f,_,m,k,D,R)}catch(de){if(p(re),de!==de+0)throw de;_setThrew(1,0)}}function ms(e,r,t,i,n,a,s){var o=v();try{K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function gs(e,r,t,i,n,a){var s=v();try{return K(e)(r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function js(e,r,t,i,n,a){var s=v();try{K(e)(r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function ks(e,r,t,i,n,a,s,o,c,u,f,_,m,k){var D=v();try{return K(e)(r,t,i,n,a,s,o,c,u,f,_,m,k)}catch(R){if(p(D),R!==R+0)throw R;_setThrew(1,0)}}function Ts(e,r,t){var i=v();try{K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function Es(e,r,t){var i=v();try{K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function As(e,r,t,i,n,a,s,o,c,u){var f=v();try{return K(e)(r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Ds(e,r,t,i,n,a,s,o,c){var u=v();try{return K(e)(r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Rs(e,r){var t=v();try{return K(e)(r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function Cs(e,r,t,i,n){var a=v();try{return K(e)(r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Ss(e,r,t,i,n,a,s,o,c){var u=v();try{K(e)(r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Fs(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{K(e)(r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function Us(e,r){var t=v();try{return K(e)(r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function xs(e,r){var t=v();try{return K(e)(r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function Hs(e,r,t,i,n,a,s,o,c,u){var f=v();try{K(e)(r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Is(e,r){var t=v();try{return K(e)(r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function Bs(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re,de){var ce=v();try{return K(e)(r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re,de)}catch(Ce){if(p(ce),Ce!==Ce+0)throw Ce;_setThrew(1,0)}}function Ns(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re){var de=v();try{return K(e)(r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re)}catch(ce){if(p(de),ce!==ce+0)throw ce;_setThrew(1,0)}}function Ps(e,r,t,i){var n=v();try{return K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function Ms(e,r,t,i,n){var a=v();try{return K(e)(r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Ls(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{K(e)(r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function Os(e,r,t){var i=v();try{return K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function Ws(e,r,t,i){var n=v();try{K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function qs(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{K(e)(r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Ks(e,r,t,i,n){var a=v();try{return K(e)(r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Gs(e,r,t,i,n,a,s){var o=v();try{return K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function $s(e,r,t,i){var n=v();try{K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function Xs(e,r){var t=v();try{return K(e)(r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function Vs(e,r,t,i,n,a,s){var o=v();try{K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Js(e,r,t,i,n,a){var s=v();try{return K(e)(r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Ys(e,r,t,i,n,a,s){var o=v();try{return K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Qs(e,r,t,i,n){var a=v();try{return K(e)(r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function zs(e,r,t,i){var n=v();try{return K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function Zs(e,r,t,i,n,a,s,o,c,u,f,_,m,k){var D=v();try{K(e)(r,t,i,n,a,s,o,c,u,f,_,m,k)}catch(R){if(p(D),R!==R+0)throw R;_setThrew(1,0)}}function eo(e,r,t){var i=v();try{return K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function ro(e,r,t,i){var n=v();try{return K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function to(e,r){var t=v();try{return K(e)(r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function io(e,r,t,i){var n=v();try{return K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function no(e,r,t){var i=v();try{return K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function ao(e,r,t){var i=v();try{return K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function so(e,r,t,i,n,a){var s=v();try{return K(e)(r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function oo(e,r,t){var i=v();try{return K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function co(e,r,t){var i=v();try{return K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function uo(e,r,t){var i=v();try{return K(e)(r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function lo(e,r,t,i){var n=v();try{return K(e)(r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function fo(e,r,t,i,n,a){var s=v();try{return K(e)(r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function _o(e,r,t,i,n,a,s){var o=v();try{return K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function ho(e,r,t,i,n){var a=v();try{return K(e)(r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function vo(e,r,t,i,n){var a=v();try{K(e)(r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function po(e,r,t,i,n){var a=v();try{K(e)(r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function wo(e,r,t,i,n){var a=v();try{return K(e)(r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function yo(e,r,t,i,n,a,s){var o=v();try{return K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function bo(e){var r=v();try{return K(e)()}catch(t){if(p(r),t!==t+0)throw t;_setThrew(1,0)}}function mo(e,r,t,i,n,a,s){var o=v();try{K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function go(e,r,t,i,n,a,s,o){var c=v();try{K(e)(r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function jo(e,r,t,i,n,a,s){var o=v();try{K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function ko(e,r,t,i,n,a){var s=v();try{return K(e)(r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function To(e,r,t,i,n,a,s){var o=v();try{return K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Eo(e,r,t,i,n,a){var s=v();try{K(e)(r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Ao(e,r,t,i,n,a,s){var o=v();try{return K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Do(e,r,t,i,n,a,s,o){var c=v();try{return K(e)(r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Ro(e,r,t,i,n,a,s,o,c,u){var f=v();try{return K(e)(r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Co(e,r,t,i,n,a,s,o,c){var u=v();try{return K(e)(r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function So(e,r,t,i,n,a,s){var o=v();try{return K(e)(r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Fo(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R){var re=v();try{return K(e)(r,t,i,n,a,s,o,c,u,f,_,m,k,D,R)}catch(de){if(p(re),de!==de+0)throw de;_setThrew(1,0)}}function Uo(e,r,t,i,n,a){var s=v();try{K(e)(r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function xo(e,r,t,i,n,a,s,o){var c=v();try{K(e)(r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Ho(e,r,t,i,n){var a=v();try{return dynCall_jiiii(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Io(e,r,t,i,n,a,s){var o=v();try{dynCall_viijj(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Bo(e,r,t,i,n,a,s){var o=v();try{dynCall_viijii(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function No(e,r,t,i,n,a,s){var o=v();try{return dynCall_iiiiij(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Po(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iiiiijj(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Mo(e,r,t,i,n,a){var s=v();try{dynCall_viiij(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Lo(e,r,t,i,n){var a=v();try{dynCall_viij(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Oo(e,r){var t=v();try{return dynCall_ji(e,r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function Wo(e,r,t,i){var n=v();try{return dynCall_iij(e,r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function qo(e,r,t,i,n,a,s){var o=v();try{dynCall_viiiij(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Ko(e,r,t){var i=v();try{return dynCall_jii(e,r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function Go(e,r,t){var i=v();try{return dynCall_jj(e,r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function $o(e,r,t,i){var n=v();try{dynCall_vij(e,r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function Xo(e,r,t,i,n,a){var s=v();try{return dynCall_iiiij(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Vo(e,r,t,i,n){var a=v();try{return dynCall_iiij(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Jo(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_iiijij(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Yo(e,r,t,i,n,a,s,o){var c=v();try{dynCall_vijiiii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Qo(e,r,t,i,n){var a=v();try{return dynCall_iiji(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function zo(e,r,t,i,n,a){var s=v();try{return dynCall_iiiji(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Zo(e,r,t,i,n){var a=v();try{dynCall_viji(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function ec(e,r,t,i,n,a,s,o){var c=v();try{dynCall_viijiii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function rc(e,r,t,i,n,a){var s=v();try{return dynCall_iijj(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function tc(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{dynCall_viiiijjjii(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function ic(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viiiiiiij(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function nc(e,r,t,i,n,a,s,o){var c=v();try{dynCall_viijij(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function ac(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_vijijj(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function sc(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viiijjjj(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function oc(e,r,t,i){var n=v();try{return dynCall_iji(e,r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function cc(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viiijjj(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function uc(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viijjji(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function lc(e,r,t,i,n,a,s,o){var c=v();try{dynCall_viiijj(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function fc(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viijjj(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function _c(e,r,t,i,n,a){var s=v();try{dynCall_viiji(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function dc(e,r,t,i,n,a){var s=v();try{dynCall_vijii(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function hc(e,r,t,i,n,a,s){var o=v();try{return dynCall_iijiii(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function vc(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iiiijjj(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function pc(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_iiijiii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function wc(e,r,t,i,n,a){var s=v();try{return dynCall_iijii(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function yc(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_vijiiji(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function bc(e,r,t){var i=v();try{return dynCall_ij(e,r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function mc(e,r,t,i){var n=v();try{return dynCall_jiii(e,r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function gc(e,r,t,i,n,a,s){var o=v();try{dynCall_viiiji(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function jc(e,r,t,i,n,a,s,o){var c=v();try{dynCall_vijjj(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function kc(e,r,t,i,n,a,s){var o=v();try{return dynCall_iijij(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Tc(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iiiiijii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Ec(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iiiiiijii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Ac(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viijiiiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Dc(e,r,t,i,n,a){var s=v();try{return dynCall_jiiji(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Rc(e,r,t,i,n,a){var s=v();try{return dynCall_fiiji(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Cc(e,r,t,i,n,a){var s=v();try{return dynCall_diiji(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Sc(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iiiiijiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Fc(e,r,t){var i=v();try{dynCall_vj(e,r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function Uc(e,r,t,i,n,a,s){var o=v();try{return dynCall_iiijii(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function xc(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_ijjiii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Hc(e,r,t,i,n,a,s){var o=v();try{dynCall_vjiiii(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Ic(e,r,t,i,n,a,s){var o=v();try{return dynCall_jiijii(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Bc(e,r,t,i,n,a,s,o){var c=v();try{dynCall_viiiiji(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Nc(e,r,t,i,n,a,s,o){var c=v();try{dynCall_viiiiij(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Pc(e,r,t,i){var n=v();try{return dynCall_jij(e,r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function Mc(e){var r=v();try{return dynCall_j(e)}catch(t){if(p(r),t!==t+0)throw t;_setThrew(1,0)}}function Lc(e,r,t,i,n,a,s){var o=v();try{return dynCall_iiijj(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Oc(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_iiijji(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Wc(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viiijiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function qc(e,r,t,i,n,a,s,o){var c=v();try{dynCall_viiijii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Kc(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_viiiiijiii(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Gc(e,r,t,i,n,a,s){var o=v();try{return dynCall_iiiiji(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function $c(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iiiiiiji(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Xc(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viiiiiij(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Vc(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_iiiiiji(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Jc(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iiiiijiiii(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Yc(e,r,t,i,n,a,s){var o=v();try{return dynCall_jiiiiii(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Qc(e,r,t,i,n,a){var s=v();try{return dynCall_jiiij(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function zc(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{dynCall_viiiiiiijij(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function Zc(e,r,t,i,n){var a=v();try{return dynCall_jiij(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function eu(e,r,t,i,n,a,s){var o=v();try{dynCall_vjjii(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function ru(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_vjjijij(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function tu(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{dynCall_viiijiijij(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function iu(e,r,t,i,n,a,s){var o=v();try{return dynCall_jiiiji(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function nu(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_jiijiij(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function au(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viijijj(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function su(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_viiiiijij(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function ou(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_jiiijij(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function cu(e,r,t,i,n,a,s){var o=v();try{dynCall_vijji(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function uu(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_vijjji(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function lu(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_jiiiiiji(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function fu(e,r,t,i,n,a,s){var o=v();try{return dynCall_jiiiij(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function _u(e,r){var t=v();try{return dynCall_jf(e,r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function du(e,r){var t=v();try{return dynCall_jd(e,r)}catch(i){if(p(t),i!==i+0)throw i;_setThrew(1,0)}}function hu(e,r,t,i,n,a,s){var o=v();try{dynCall_viiijd(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function vu(e,r,t,i,n,a){var s=v();try{return dynCall_iiifj(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function pu(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_iiiiiij(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function wu(e,r,t,i,n,a){var s=v();try{dynCall_vijj(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function yu(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_iiiijj(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function bu(e,r,t,i,n,a){var s=v();try{return dynCall_jiiiii(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function mu(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_iijiiii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function gu(e,r,t,i,n,a,s){var o=v();try{return dynCall_iijji(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function ju(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iijjiiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function ku(e,r,t,i,n,a,s){var o=v();try{dynCall_vijiii(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Tu(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iijjiiiii(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Eu(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iiijjiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Au(e,r,t,i,n,a,s){var o=v();try{return dynCall_ijjj(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Du(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viiiiijii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Ru(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re,de,ce,Ce,Ue,tr){var dn=v();try{return dynCall_iiiiiiiijjjjjjii(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re,de,ce,Ce,Ue,tr)}catch(vr){if(p(dn),vr!==vr+0)throw vr;_setThrew(1,0)}}function Cu(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_iiiiiiiiiij(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function Su(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_vijiiiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Fu(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_vijiiiiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Uu(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iijiiiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function xu(e,r,t,i,n,a,s,o){var c=v();try{dynCall_vjiiij(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Hu(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viiiiiji(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Iu(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_iiiiijiiiii(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function Bu(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_iiiijii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Nu(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_vijiiiiiii(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Pu(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_jiiijj(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Mu(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iiiiiijji(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Lu(e,r,t,i,n){var a=v();try{return dynCall_ijii(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Ou(e,r,t,i,n){var a=v();try{return dynCall_iijf(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Wu(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re){var de=v();try{return dynCall_iiiiiijiijjji(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re)}catch(ce){if(p(de),ce!==ce+0)throw ce;_setThrew(1,0)}}function qu(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{return dynCall_iiijjijiii(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function Ku(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iiiijiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Gu(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viiiijij(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function $u(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_viijiiiiii(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Xu(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viijiiij(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Vu(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viiijiijj(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function Ju(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{dynCall_viiiiiijjj(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function Yu(e,r,t,i,n,a,s){var o=v();try{return dynCall_jijij(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Qu(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iiiiijjj(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function zu(e,r,t,i,n,a,s,o){var c=v();try{dynCall_viijji(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Zu(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_viiijijj(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function el(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{dynCall_viiiiijjij(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function rl(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viiijij(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function tl(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iiiijiiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function il(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_vijjiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function nl(e,r,t,i,n,a,s,o){var c=v();try{dynCall_vijiij(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function al(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iiiiiiiij(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function sl(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viiiijjij(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function ol(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{dynCall_viiijiiijii(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function cl(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viijijiiii(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function ul(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iiiiiiiji(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function ll(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_viiiijjii(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function fl(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_iiiiiiiijj(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function _l(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iiiijjiii(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function dl(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iiiiiiij(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function hl(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{return dynCall_iiiiiiiiijii(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function vl(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_jiiijiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function pl(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_jiiijii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function wl(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viiijiji(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function yl(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_jijjj(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function bl(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_dijjj(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function ml(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_vijijjd(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function gl(e,r,t,i,n,a,s,o,c,u,f,_,m,k){var D=v();try{return dynCall_iiiiiiiiiiiji(e,r,t,i,n,a,s,o,c,u,f,_,m,k)}catch(R){if(p(D),R!==R+0)throw R;_setThrew(1,0)}}function jl(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_iiiiiiijji(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function kl(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viiiijj(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Tl(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iiiijji(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function El(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_iiiiiiiiiji(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function Al(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iiiiiiiiji(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Dl(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_jiiiiijji(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Rl(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viijjii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Cl(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_jiiiiiii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Sl(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_viiijjiii(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Fl(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viiiijii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Ul(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_jiiiiji(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function xl(e,r,t,i,n,a,s){var o=v();try{return dynCall_jiijj(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Hl(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{return dynCall_iiiiiiiijiii(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function Il(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iiiiiiiiij(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Bl(e,r,t,i,n,a){var s=v();try{return dynCall_iiidj(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Nl(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R){var re=v();try{return dynCall_iiiiiiiiiiijiii(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R)}catch(de){if(p(re),de!==de+0)throw de;_setThrew(1,0)}}function Pl(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re,de,ce){var Ce=v();try{return dynCall_iiiiiiiiijiiiiiiii(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re,de,ce)}catch(Ue){if(p(Ce),Ue!==Ue+0)throw Ue;_setThrew(1,0)}}function Ml(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{return dynCall_iiiiiiiiiiji(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function Ll(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iiiiijjii(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Ol(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_iiiiijjij(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function Wl(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_iiiijiiiij(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function ql(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iiiijiiij(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function Kl(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D){var R=v();try{dynCall_viijijijiji(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D)}catch(re){if(p(R),re!==re+0)throw re;_setThrew(1,0)}}function Gl(e,r,t,i,n,a,s,o,c,u,f,_,m,k){var D=v();try{dynCall_viiijjjjii(e,r,t,i,n,a,s,o,c,u,f,_,m,k)}catch(R){if(p(D),R!==R+0)throw R;_setThrew(1,0)}}function $l(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viijjjji(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function Xl(e,r,t,i,n,a,s,o,c,u,f,_,m,k){var D=v();try{dynCall_viijijijij(e,r,t,i,n,a,s,o,c,u,f,_,m,k)}catch(R){if(p(D),R!==R+0)throw R;_setThrew(1,0)}}function Vl(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D){var R=v();try{return dynCall_iiiijiijjiii(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D)}catch(re){if(p(R),re!==re+0)throw re;_setThrew(1,0)}}function Jl(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_iijiiiiiij(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function Yl(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viijjiiij(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function Ql(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viijiijji(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function zl(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D){var R=v();try{dynCall_viiiijiijjii(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D)}catch(re){if(p(R),re!==re+0)throw re;_setThrew(1,0)}}function Zl(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re,de,ce,Ce){var Ue=v();try{return dynCall_iiiiiijjiiiiiiiji(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re,de,ce,Ce)}catch(tr){if(p(Ue),tr!==tr+0)throw tr;_setThrew(1,0)}}function ef(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viijiiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function rf(e,r,t,i,n,a){var s=v();try{return dynCall_ijji(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function tf(e,r,t,i,n){var a=v();try{dynCall_vjii(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function nf(e,r,t,i,n){var a=v();try{return dynCall_jjj(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function af(e,r,t,i){var n=v();try{return dynCall_jji(e,r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function sf(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_iijiji(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function of(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D){var R=v();try{dynCall_viiiijiiiiiiii(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D)}catch(re){if(p(R),re!==re+0)throw re;_setThrew(1,0)}}function cf(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viiiiijiiii(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function uf(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_jjjij(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function lf(e,r,t,i,n,a){var s=v();try{return dynCall_jijj(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function ff(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iiijiiiji(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function _f(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viiijji(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function df(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viiijjii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function hf(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_jiiiijji(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function vf(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viiiijji(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function pf(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iiiijij(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function wf(e,r,t,i,n){var a=v();try{return dynCall_jiji(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function yf(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viiiiiijij(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function bf(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_iijjii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function mf(e,r,t,i,n){var a=v();try{dynCall_vjj(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function gf(e,r,t,i,n,a){var s=v();try{dynCall_viijd(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function jf(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iijiiiiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function kf(e,r,t,i){var n=v();try{return dynCall_dij(e,r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function Tf(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viiiiiiji(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Ef(e,r,t,i,n,a,s){var o=v();try{return dynCall_jjjii(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Af(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{return dynCall_jiiijiijiii(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function Df(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_jiiiijiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Rf(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viiijiiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Cf(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_jiijjiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Sf(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_jiiiijii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Ff(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_jiijiiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Uf(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_jiiiiijiiii(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function xf(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iijjiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Hf(e,r,t,i,n){var a=v();try{return dynCall_iidj(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function If(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_jiiiiiiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Bf(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iijjjii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Nf(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iijjji(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Pf(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iiijjj(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Mf(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_jjjji(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Lf(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iijjjj(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function Of(e,r,t,i,n,a,s){var o=v();try{return dynCall_fiiiij(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Wf(e,r,t,i,n,a,s){var o=v();try{return dynCall_diiiij(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function qf(e,r,t,i,n,a,s,o){var c=v();try{dynCall_vijiji(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function Kf(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_vijjij(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function Gf(e,r,t,i,n,a){var s=v();try{return dynCall_jjij(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function $f(e,r,t,i,n,a){var s=v();try{return dynCall_ijij(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Xf(e,r,t,i,n,a,s){var o=v();try{dynCall_vijij(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function Vf(e,r,t,i,n){var a=v();try{return dynCall_diij(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function Jf(e,r,t,i,n,a){var s=v();try{return dynCall_djij(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Yf(e,r,t){var i=v();try{return dynCall_dj(e,r,t)}catch(n){if(p(i),n!==n+0)throw n;_setThrew(1,0)}}function Qf(e,r,t,i,n,a){var s=v();try{return dynCall_jjjd(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function zf(e,r,t,i,n,a){var s=v();try{dynCall_vjij(e,r,t,i,n,a)}catch(o){if(p(s),o!==o+0)throw o;_setThrew(1,0)}}function Zf(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viiiijiiiii(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function e_(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_viiiijiiii(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function r_(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viiijiiiji(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function t_(e,r,t,i){var n=v();try{dynCall_vji(e,r,t,i)}catch(a){if(p(n),a!==a+0)throw a;_setThrew(1,0)}}function i_(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_jiijiiiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function n_(e,r,t,i,n,a,s,o){var c=v();try{return dynCall_jiijiii(e,r,t,i,n,a,s,o)}catch(u){if(p(c),u!==u+0)throw u;_setThrew(1,0)}}function a_(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_vijijjji(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function s_(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{dynCall_viiiiijjji(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function o_(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_viijiijj(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function c_(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_iiijiij(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function u_(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viijiij(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function l_(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_iiijiiijj(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function f_(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iiijiijj(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function __(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{dynCall_viiijijjj(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function d_(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_viiiijiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function h_(e,r,t,i,n,a,s,o,c){var u=v();try{dynCall_viijiji(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function v_(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_vijiiiiji(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function p_(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iiijjji(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function w_(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iijiijj(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function y_(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{return dynCall_iiijiiiijj(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function b_(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{return dynCall_iijiiijj(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function m_(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iiijiiij(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function g_(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_jijjjj(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function j_(e,r,t,i,n,a,s){var o=v();try{return dynCall_jijiii(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function k_(e,r,t,i,n,a,s,o,c,u,f){var _=v();try{dynCall_viiiijjj(e,r,t,i,n,a,s,o,c,u,f)}catch(m){if(p(_),m!==m+0)throw m;_setThrew(1,0)}}function T_(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viijjjiii(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function E_(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{dynCall_viijjjjii(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function A_(e,r,t,i,n,a,s){var o=v();try{return dynCall_jijji(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function D_(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_vijiiiiiiii(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function R_(e,r,t,i,n,a,s,o,c,u){var f=v();try{dynCall_vijiiiij(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function C_(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{dynCall_viiijjjiii(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function S_(e,r,t,i,n,a,s,o,c,u,f,_,m,k){var D=v();try{return dynCall_iiiiiiiiijji(e,r,t,i,n,a,s,o,c,u,f,_,m,k)}catch(R){if(p(D),R!==R+0)throw R;_setThrew(1,0)}}function F_(e,r,t,i,n){var a=v();try{return dynCall_iijd(e,r,t,i,n)}catch(s){if(p(a),s!==s+0)throw s;_setThrew(1,0)}}function U_(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re,de,ce,Ce,Ue,tr){var dn=v();try{return dynCall_iiiiiiiiiiiijjidjii(e,r,t,i,n,a,s,o,c,u,f,_,m,k,D,R,re,de,ce,Ce,Ue,tr)}catch(vr){if(p(dn),vr!==vr+0)throw vr;_setThrew(1,0)}}function x_(e,r,t,i,n,a,s,o,c,u){var f=v();try{return dynCall_iiijiiiii(e,r,t,i,n,a,s,o,c,u)}catch(_){if(p(f),_!==_+0)throw _;_setThrew(1,0)}}function H_(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{dynCall_viiijdjji(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function I_(e,r,t,i,n,a,s){var o=v();try{return dynCall_diijj(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function B_(e,r,t,i,n,a,s,o,c,u,f,_){var m=v();try{return dynCall_iiijjijj(e,r,t,i,n,a,s,o,c,u,f,_)}catch(k){if(p(m),k!==k+0)throw k;_setThrew(1,0)}}function N_(e,r,t,i,n,a,s){var o=v();try{return dynCall_jjiji(e,r,t,i,n,a,s)}catch(c){if(p(o),c!==c+0)throw c;_setThrew(1,0)}}function P_(e,r,t,i,n,a,s,o,c,u,f,_,m){var k=v();try{return dynCall_jijjjjjd(e,r,t,i,n,a,s,o,c,u,f,_,m)}catch(D){if(p(k),D!==D+0)throw D;_setThrew(1,0)}}function M_(e,r,t,i,n,a,s,o,c){var u=v();try{return dynCall_jijjiii(e,r,t,i,n,a,s,o,c)}catch(f){if(p(u),f!==f+0)throw f;_setThrew(1,0)}}function L_(e){e=Object.assign({},e);var r=n=>a=>n(a)>>>0,t=n=>(a,s)=>n(a,s)>>>0,i=n=>()=>n()>>>0;return e.qi=r(e.qi),e.si=t(e.si),e.xi=r(e.xi),e.yi=i(e.yi),e.Ci=r(e.Ci),e}l.stackSave=v,l.stackRestore=p,l.stackAlloc=Or,l.getTempRet0=Kn,l.setTempRet0=Oe,l.ccall=qn;function O_(){var e=$n,r=0,t=0;try{var i=e(r,t);return ht(i,!0),i}catch(n){return Mn(n)}}function _n(){if(Be>0){Ve=_n;return}if(ur(),Be>0){Ve=_n;return}function e(){var t;if(l.calledRun=!0,!N){lr(),E(l),(t=l.onRuntimeInitialized)==null||t.call(l);var r=l.noInitialRun;r||O_(),It()}}l.setStatus?(l.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>l.setStatus(""),1),e()},1)):e()}if(l.preInit)for(typeof l.preInit=="function"&&(l.preInit=[l.preInit]);l.preInit.length>0;)l.preInit.pop()();return _n(),g=S,g}})();typeof Aa=="object"&&typeof Ft=="object"?(Ft.exports=Cn,Ft.exports.default=Cn):typeof define=="function"&&define.amd&&define([],()=>Cn)});var Sa=pr((Ca,xt)=>{"use strict";var Sn=(()=>{var d;var w=typeof document<"u"?(d=document.currentScript)==null?void 0:d.src:void 0;return typeof __filename<"u"&&(w=w||__filename),async function(b={}){var g,l=b,E,T,S=new Promise((h,y)=>{E=h,T=y}),A=typeof window=="object",M=typeof WorkerGlobalScope<"u",O=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer",Q=Object.assign({},l),ie=[],V="./this.program",je=(h,y)=>{throw y},oe="";function Se(h){return l.locateFile?l.locateFile(h,oe):oe+h}var De,ye;if(O){var we=Dn(),Ie=Rn();oe=__dirname+"/",ye=h=>{h=Me(h)?new URL(h):h;var y=we.readFileSync(h);return y},De=async(h,y=!0)=>{h=Me(h)?new URL(h):h;var j=we.readFileSync(h,y?void 0:"utf8");return j},!l.thisProgram&&process.argv.length>1&&(V=process.argv[1].replace(/\\/g,"/")),ie=process.argv.slice(2),je=(h,y)=>{throw process.exitCode=h,y}}else(A||M)&&(M?oe=self.location.href:typeof document<"u"&&document.currentScript&&(oe=document.currentScript.src),w&&(oe=w),oe.startsWith("blob:")?oe="":oe=oe.slice(0,oe.replace(/[?#].*/,"").lastIndexOf("/")+1),M&&(ye=h=>{var y=new XMLHttpRequest;return y.open("GET",h,!1),y.responseType="arraybuffer",y.send(null),new Uint8Array(y.response)}),De=async h=>{var y=await fetch(h,{credentials:"same-origin"});if(y.ok)return y.arrayBuffer();throw new Error(y.status+" : "+y.url)});var Fe=l.print||console.log.bind(console),x=l.printErr||console.error.bind(console);Object.assign(l,Q),Q=null,l.arguments&&(ie=l.arguments),l.thisProgram&&(V=l.thisProgram);var G=l.wasmBinary,z,N=!1,X;function q(h,y){h||Re(y)}var Y,H,J,ne,F,ae,Ke,ve,We=!1,Me=h=>h.startsWith("file://");function Xe(){var h=z.buffer;l.HEAP8=Y=new Int8Array(h),l.HEAP16=J=new Int16Array(h),l.HEAPU8=H=new Uint8Array(h),l.HEAPU16=ne=new Uint16Array(h),l.HEAP32=F=new Int32Array(h),l.HEAPU32=ae=new Uint32Array(h),l.HEAPF32=Ke=new Float32Array(h),l.HEAPF64=ve=new Float64Array(h)}function ur(){if(l.preRun)for(typeof l.preRun=="function"&&(l.preRun=[l.preRun]);l.preRun.length;)Xt(l.preRun.shift());Rr(Sr)}function lr(){We=!0,Z.ua()}function yr(){}function It(){if(l.postRun)for(typeof l.postRun=="function"&&(l.postRun=[l.postRun]);l.postRun.length;)$t(l.postRun.shift());Rr(Cr)}var Be=0,Ve=null;function Bt(h){var y;Be++,(y=l.monitorRunDependencies)==null||y.call(l,Be)}function Nt(h){var j;if(Be--,(j=l.monitorRunDependencies)==null||j.call(l,Be),Be==0&&Ve){var y=Ve;Ve=null,y()}}function Re(h){var j;(j=l.onAbort)==null||j.call(l,h),h="Aborted("+h+")",x(h),N=!0,h+=". Build with -sASSERTIONS for more info.",We&&___trap();var y=new WebAssembly.RuntimeError(h);throw T(y),y}var Je;function Pt(){return Se("./duckdb-eh.wasm")}function Mt(h){if(h==Je&&G)return new Uint8Array(G);if(ye)return ye(h);throw"both async and sync fetching of the wasm failed"}async function Lt(h){if(!G)try{var y=await De(h);return new Uint8Array(y)}catch(j){}return Mt(h)}async function Ot(h,y){try{var j=await Lt(h),C=await WebAssembly.instantiate(j,y);return C}catch(U){x("failed to asynchronously prepare wasm: ".concat(U)),Re(U)}}async function Wt(h,y,j){if(!h&&typeof WebAssembly.instantiateStreaming=="function"&&!O)try{var C=fetch(y,{credentials:"same-origin"}),U=await WebAssembly.instantiateStreaming(C,j);return U}catch(I){x("wasm streaming compile failed: ".concat(I)),x("falling back to ArrayBuffer instantiation")}return Ot(y,j)}function qt(){return{a:cn}}async function Kt(){function h(I,P){return Z=I.exports,Z=zn(Z),z=Z.ta,Xe(),Nt("wasm-instantiate"),Z}Bt("wasm-instantiate");function y(I){return h(I.instance)}var j=qt();if(l.instantiateWasm)return new Promise((I,P)=>{l.instantiateWasm(j,(L,$)=>{h(L,$),I(L.exports)})});Je!=null||(Je=Pt());try{var C=await Wt(G,Je,j),U=y(C);return U}catch(I){return T(I),Promise.reject(I)}}var _e,xe,Gt={10168112:(h,y,j,C)=>{var U=be(h);if(typeof XMLHttpRequest>"u")return 0;let I=new XMLHttpRequest;I.open(be(C),U,!1),I.responseType="arraybuffer";for(var P=0,B=y;P<B*2;){var L=F[j/4+P>>>0],$=F[j/4+P+1>>>0];try{var te=encodeURI(be(L));te==="Host"&&(te="X-Host-Override"),te==="User-Agent"&&(te="X-user-agent"),te==="Authorization"?I.setRequestHeader(te,be($)):I.setRequestHeader(te,encodeURI(be($)))}catch(Ae){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Ae)}P+=2}try{I.send(null)}catch(Ae){return 0}if(I.status>=400)return 0;for(var ue=I.response,B=ue.byteLength,pe=ar(B+4),ge=new Uint8Array(ue),le=0;le<B;le++)l.HEAPU8[le+pe+4]=ge[le];var W=new Uint8Array(4);return W[0]=B%256,B-=W[0],B/=256,W[1]=B%256,B-=W[1],B/=256,W[2]=B%256,B-=W[2],B/=256,W[3]=B%256,B-=W[3],B/=256,l.HEAPU8.set(W,pe),pe},10169519:(h,y,j,C,U,I)=>{var P=be(h);if(typeof XMLHttpRequest>"u")return 0;let L=new XMLHttpRequest;L.open(be(C),P,!1),L.responseType="arraybuffer";for(var $=0,W=y;$<W*2;){var te=F[j/4+$>>>0],ue=F[j/4+$+1>>>0];try{var B=encodeURI(be(te));B==="Host"&&(B="X-Host-Override"),B==="User-Agent"&&(B="X-user-agent"),B==="Authorization"?L.setRequestHeader(B,be(ue)):L.setRequestHeader(B,encodeURI(be(ue)))}catch(Ge){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Ge)}$+=2}try{for(var pe=new Uint8Array(I),ge=0;ge<I;ge++)pe[ge]=l.HEAPU8[ge+U];L.send(pe)}catch(Ge){return 0}if(L.status>=400)return 0;for(var le=Uint8Array.from(Array.from(L.getResponseHeader("Etag")).map(Ge=>Ge.charCodeAt(0))),W=le.byteLength,Ae=ar(W+4),qe=new Uint8Array(le),ge=0;ge<W;ge++)l.HEAPU8[ge+Ae+4]=qe[ge];var Te=new Uint8Array(4);return Te[0]=W%256,W-=Te[0],W/=256,Te[1]=W%256,W-=Te[1],W/=256,Te[2]=W%256,W-=Te[2],W/=256,Te[3]=W%256,W-=Te[3],W/=256,l.HEAPU8.set(Te,Ae),Ae},10171139:(h,y,j,C)=>{var U=be(h);if(typeof XMLHttpRequest>"u")return 0;let I=new XMLHttpRequest;I.open(be(C),U,!1),I.responseType="arraybuffer";for(var P=0,B=y;P<B*2;){var L=F[j/4+P>>>0],$=F[j/4+P+1>>>0];console.log("HEAD",be(L),be($));try{var te=encodeURI(be(L));te==="Host"&&(te="X-Host-Override"),te==="User-Agent"&&(te="X-user-agent"),te==="Authorization"?I.setRequestHeader(te,be($)):I.setRequestHeader(te,encodeURI(be($)))}catch(Te){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Te)}P+=2}try{I.send(null)}catch(Te){return 0}if(I.status>=400)return 0;for(var ue=I.response,B=ue.byteLength,pe=ar(B+8),ge=new Uint8Array(ue),le=0;le<B;le++)l.HEAPU8[le+pe+8]=ge[le];var W=new Uint8Array(4);W[0]=B%256,B-=W[0],B/=256,W[1]=B%256,B-=W[1],B/=256,W[2]=B%256,B-=W[2],B/=256,W[3]=B%256,B-=W[3],B/=256,l.HEAPU8.set(W,pe+4);var Ae=Uint8Array.from(Array.from(I.getAllResponseHeaders()).map(Te=>Te.charCodeAt(0)));B=Ae.byteLength;for(var qe=ar(B+8),le=0;le<B;le++)l.HEAPU8[le+qe+8]=Ae[le];return W=new Uint8Array(4),W[0]=B%256,B-=W[0],B/=256,W[1]=B%256,B-=W[1],B/=256,W[2]=B%256,B-=W[2],B/=256,W[3]=B%256,B-=W[3],B/=256,l.HEAPU8.set(W,qe+4),B=qe,W=new Uint8Array(4),W[0]=B%256,B-=W[0],B/=256,W[1]=B%256,B-=W[1],B/=256,W[2]=B%256,B-=W[2],B/=256,W[3]=B%256,B-=W[3],B/=256,l.HEAPU8.set(W,pe),pe},10173484:(h,y,j,C)=>{var U=be(h);if(typeof XMLHttpRequest>"u")return 0;let I=new XMLHttpRequest;I.open(be(C),U,!1),I.responseType="arraybuffer";for(var P=0,B=y;P<B*2;){var L=F[j/4+P>>>0],$=F[j/4+P+1>>>0];try{var te=encodeURI(be(L));te==="Host"&&(te="X-Host-Override"),te==="User-Agent"&&(te="X-user-agent"),te==="Authorization"?I.setRequestHeader(te,be($)):I.setRequestHeader(te,encodeURI(be($)))}catch(Ae){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Ae)}P+=2}try{I.send(null)}catch(Ae){return 0}if(I.status>=400)return 0;for(var ue=I.response,B=ue.byteLength,pe=ar(B+4),ge=new Uint8Array(ue),le=0;le<B;le++)l.HEAPU8[le+pe+4]=ge[le];var W=new Uint8Array(4);return W[0]=B%256,B-=W[0],B/=256,W[1]=B%256,B-=W[1],B/=256,W[2]=B%256,B-=W[2],B/=256,W[3]=B%256,B-=W[3],B/=256,l.HEAPU8.set(W,pe),pe},10174891:(h,y,j,C,U,I)=>{var P=be(h);if(typeof XMLHttpRequest>"u")return 0;let L=new XMLHttpRequest;L.open(be(C),P,!1),L.responseType="arraybuffer";for(var $=0,W=y;$<W*2;){var te=F[j/4+$>>>0],ue=F[j/4+$+1>>>0];try{var B=encodeURI(be(te));B==="Host"&&(B="X-Host-Override"),B==="User-Agent"&&(B="X-user-agent"),B==="Authorization"?L.setRequestHeader(B,be(ue)):L.setRequestHeader(B,encodeURI(be(ue)))}catch(Ge){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Ge)}$+=2}try{for(var pe=new Uint8Array(I),ge=0;ge<I;ge++)pe[ge]=l.HEAPU8[ge+U];L.send(pe)}catch(Ge){return 0}if(L.status>=400)return 0;for(var le=L.response,W=le.byteLength,Ae=ar(W+4),qe=new Uint8Array(le),ge=0;ge<W;ge++)l.HEAPU8[ge+Ae+4]=qe[ge];var Te=new Uint8Array(4);return Te[0]=W%256,W-=Te[0],W/=256,Te[1]=W%256,W-=Te[1],W/=256,Te[2]=W%256,W-=Te[2],W/=256,Te[3]=W%256,W-=Te[3],W/=256,l.HEAPU8.set(Te,Ae),Ae}};class Dr{constructor(y){mt(this,"name","ExitStatus");this.message="Program terminated with exit(".concat(y,")"),this.status=y}}var Rr=h=>{for(;h.length>0;)h.shift()(l)},Cr=[],$t=h=>Cr.unshift(h),Sr=[],Xt=h=>Sr.unshift(h),Vt=l.noExitRuntime||!0;function p(){Re("missing function: $SOCKFS")}p.stub=!0;function v(){Re("missing function: $FS")}v.stub=!0;var Ne=h=>{var y=p.getSocket(h);if(!y)throw new v.ErrnoError(8);return y},sr=h=>(h&255)+"."+(h>>8&255)+"."+(h>>16&255)+"."+(h>>24&255),Ye=h=>{var y="",j=0,C=0,U=0,I=0,P=0,L=0,$=[h[0]&65535,h[0]>>16,h[1]&65535,h[1]>>16,h[2]&65535,h[2]>>16,h[3]&65535,h[3]>>16],te=!0,ue="";for(L=0;L<5;L++)if($[L]!==0){te=!1;break}if(te){if(ue=sr($[6]|$[7]<<16),$[5]===-1)return y="::ffff:",y+=ue,y;if($[5]===0)return y="::",ue==="0.0.0.0"&&(ue=""),ue==="0.0.0.1"&&(ue="1"),y+=ue,y}for(j=0;j<8;j++)$[j]===0&&(j-U>1&&(P=0),U=j,P++),P>C&&(C=P,I=j-C+1);for(j=0;j<8;j++){if(C>1&&$[j]===0&&j>=I&&j<I+C){j===I&&(y+=":",I===0&&(y+=":"));continue}y+=Number(_ntohs($[j]&65535)).toString(16),y+=j<7?":":""}return y},Wr=(h,y)=>{var j=J[h>>>1>>>0],C=_ntohs(ne[h+2>>>1>>>0]),U;switch(j){case 2:if(y!==16)return{errno:28};U=F[h+4>>>2>>>0],U=sr(U);break;case 10:if(y!==28)return{errno:28};U=[F[h+8>>>2>>>0],F[h+12>>>2>>>0],F[h+16>>>2>>>0],F[h+20>>>2>>>0]],U=Ye(U);break;default:return{errno:5}}return{family:j,addr:U,port:C}},br=h=>{for(var y=h.split("."),j=0;j<4;j++){var C=Number(y[j]);if(isNaN(C))return null;y[j]=C}return(y[0]|y[1]<<8|y[2]<<16|y[3]<<24)>>>0},Le=h=>parseInt(h),Fr=h=>{var y,j,C,U,I=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i,P=[];if(!I.test(h))return null;if(h==="::")return[0,0,0,0,0,0,0,0];for(h.startsWith("::")?h=h.replace("::","Z:"):h=h.replace("::",":Z:"),h.indexOf(".")>0?(h=h.replace(new RegExp("[.]","g"),":"),y=h.split(":"),y[y.length-4]=Le(y[y.length-4])+Le(y[y.length-3])*256,y[y.length-3]=Le(y[y.length-2])+Le(y[y.length-1])*256,y=y.slice(0,y.length-2)):y=h.split(":"),C=0,U=0,j=0;j<y.length;j++)if(typeof y[j]=="string")if(y[j]==="Z"){for(U=0;U<8-y.length+1;U++)P[j+U]=0;C=U-1}else P[j+C]=_htons(parseInt(y[j],16));else P[j+C]=y[j];return[P[1]<<16|P[0],P[3]<<16|P[2],P[5]<<16|P[4],P[7]<<16|P[6]]},He={address_map:{id:1,addrs:{},names:{}},lookup_name(h){var y=br(h);if(y!==null||(y=Fr(h),y!==null))return h;var j;if(He.address_map.addrs[h])j=He.address_map.addrs[h];else{var C=He.address_map.id++;q(C<65535,"exceeded max address mappings of 65535"),j="172.29."+(C&255)+"."+(C&65280),He.address_map.names[j]=h,He.address_map.addrs[h]=j}return j},lookup_addr(h){return He.address_map.names[h]?He.address_map.names[h]:null}},qr=(h,y)=>{var j=Wr(h,y);if(j.errno)throw new v.ErrnoError(j.errno);return j.addr=He.lookup_addr(j.addr)||j.addr,j},Oe=(h,y)=>y+2097152>>>0<4194305-!!h?(h>>>0)+y*4294967296:NaN;function mr(h,y,j,C,U,I){y>>>=0,j>>>=0;var P=Ne(h),L=qr(y,j);return P.sock_ops.bind(P,L.addr,L.port),0}function Jt(h,y,j,C,U,I){y>>>=0,j>>>=0;var P=Ne(h),L=qr(y,j);return P.sock_ops.connect(P,L.addr,L.port),0}var Yt=(h,y,j)=>{};function Qt(h,y,j,C){y>>>=0}var Kr=typeof TextDecoder<"u"?new TextDecoder:void 0,Ur=(h,y=0,j=NaN)=>{y>>>=0;for(var C=y+j,U=y;h[U]&&!(U>=C);)++U;if(U-y>16&&h.buffer&&Kr)return Kr.decode(h.subarray(y,U));for(var I="";y<U;){var P=h[y++];if(!(P&128)){I+=String.fromCharCode(P);continue}var L=h[y++]&63;if((P&224)==192){I+=String.fromCharCode((P&31)<<6|L);continue}var $=h[y++]&63;if((P&240)==224?P=(P&15)<<12|L<<6|$:P=(P&7)<<18|L<<12|$<<6|h[y++]&63,P<65536)I+=String.fromCharCode(P);else{var te=P-65536;I+=String.fromCharCode(55296|te>>10,56320|te&1023)}}return I},be=(h,y)=>(h>>>=0,h?Ur(H,h,y):""),xr={varargs:void 0,getStr(h){var y=be(h);return y}};function zt(h,y,j){return j>>>=0,xr.varargs=j,0}function Gr(h,y){y>>>=0}function Hr(h,y,j){var C=Oe(y,j)}var nr=h=>{for(var y=0,j=0;j<h.length;++j){var C=h.charCodeAt(j);C<=127?y++:C<=2047?y+=2:C>=55296&&C<=57343?(y+=4,++j):y+=3}return y};l.lengthBytesUTF8=nr;var Ir=(h,y,j,C)=>{if(j>>>=0,!(C>0))return 0;for(var U=j,I=j+C-1,P=0;P<h.length;++P){var L=h.charCodeAt(P);if(L>=55296&&L<=57343){var $=h.charCodeAt(++P);L=65536+((L&1023)<<10)|$&1023}if(L<=127){if(j>=I)break;y[j++>>>0]=L}else if(L<=2047){if(j+1>=I)break;y[j++>>>0]=192|L>>6,y[j++>>>0]=128|L&63}else if(L<=65535){if(j+2>=I)break;y[j++>>>0]=224|L>>12,y[j++>>>0]=128|L>>6&63,y[j++>>>0]=128|L&63}else{if(j+3>=I)break;y[j++>>>0]=240|L>>18,y[j++>>>0]=128|L>>12&63,y[j++>>>0]=128|L>>6&63,y[j++>>>0]=128|L&63}}return y[j>>>0]=0,j-U},Qe=(h,y,j)=>Ir(h,H,y,j);l.stringToUTF8=Qe;function $r(h,y){h>>>=0,y>>>=0}function gr(h,y,j){y>>>=0,j>>>=0}var fr=(h,y)=>{H.fill(0,h,h+y)},or=(h,y,j,C,U)=>{switch(y){case 2:j=br(j),fr(h,16),U&&(F[U>>>2>>>0]=16),J[h>>>1>>>0]=y,F[h+4>>>2>>>0]=j,J[h+2>>>1>>>0]=_htons(C);break;case 10:j=Fr(j),fr(h,28),U&&(F[U>>>2>>>0]=28),F[h>>>2>>>0]=y,F[h+8>>>2>>>0]=j[0],F[h+12>>>2>>>0]=j[1],F[h+16>>>2>>>0]=j[2],F[h+20>>>2>>>0]=j[3],J[h+2>>>1>>>0]=_htons(C);break;default:return 5}return 0};function Pe(h,y,j,C,U,I){y>>>=0,j>>>=0;var P=Ne(h);if(!P.daddr)return-53;var L=or(y,P.family,He.lookup_name(P.daddr),P.dport,j);return 0}function Xr(h,y,j,C,U,I){y>>>=0,j>>>=0;var P=Ne(h),L=or(y,P.family,He.lookup_name(P.saddr||"0.0.0.0"),P.sport,j);return 0}function Zt(h,y,j,C,U,I){C>>>=0,U>>>=0;var P=Ne(h);return y===1&&j===4?(F[C>>>2>>>0]=P.error,F[U>>>2>>>0]=4,P.error=null,0):-50}function ei(h,y,j){return j>>>=0,xr.varargs=j,0}function ri(h,y){h>>>=0,y>>>=0}function ti(h,y,j){y>>>=0}function Vr(h,y,j,C){y>>>=0,j>>>=0}function Jr(h,y,j,C){y>>>=0,C>>>=0,xr.varargs=C}function me(h,y,j){h>>>=0}function Br(h,y,j,C){y>>>=0,j>>>=0,C>>>=0}function ii(h,y,j,C,U,I){y>>>=0,j>>>=0,U>>>=0,I>>>=0;var P=Ne(h),L=P.sock_ops.recvmsg(P,j);if(!L)return 0;if(U)var $=or(U,P.family,He.lookup_name(L.addr),L.port,I);return H.set(L.buffer,y>>>0),L.buffer.byteLength}function ni(h,y,j,C){y>>>=0,C>>>=0}function ai(h){h>>>=0}function Yr(h,y,j,C,U,I){y>>>=0,j>>>=0,U>>>=0,I>>>=0}var si=(h,y,j)=>{};function rr(h,y){h>>>=0,y>>>=0}function oi(h,y,j){h>>>=0,y>>>=0,j>>>=0}function ci(h,y,j){y>>>=0}var Qr=()=>Re("");function _r(){Re("missing function: _emval_call_method")}_r.stub=!0;function zr(){Re("missing function: _emval_decref")}zr.stub=!0;function Zr(){Re("missing function: _emval_get_global")}Zr.stub=!0;function et(){Re("missing function: _emval_get_method_caller")}et.stub=!0;function rt(){Re("missing function: _emval_run_destructors")}rt.stub=!0;var ui=h=>h%4===0&&(h%100!==0||h%400===0),li=[0,31,60,91,121,152,182,213,244,274,305,335],fi=[0,31,59,90,120,151,181,212,243,273,304,334],_i=h=>{var y=ui(h.getFullYear()),j=y?li:fi,C=j[h.getMonth()]+h.getDate()-1;return C};function di(h,y,j){var C=Oe(h,y);j>>>=0;var U=new Date(C*1e3);F[j>>>2>>>0]=U.getSeconds(),F[j+4>>>2>>>0]=U.getMinutes(),F[j+8>>>2>>>0]=U.getHours(),F[j+12>>>2>>>0]=U.getDate(),F[j+16>>>2>>>0]=U.getMonth(),F[j+20>>>2>>>0]=U.getFullYear()-1900,F[j+24>>>2>>>0]=U.getDay();var I=_i(U)|0;F[j+28>>>2>>>0]=I,F[j+36>>>2>>>0]=-(U.getTimezoneOffset()*60);var P=new Date(U.getFullYear(),0,1),L=new Date(U.getFullYear(),6,1).getTimezoneOffset(),$=P.getTimezoneOffset(),te=(L!=$&&U.getTimezoneOffset()==Math.min($,L))|0;F[j+32>>>2>>>0]=te}function hi(h,y,j,C,U,I,P,L){h>>>=0;var $=Oe(U,I);return P>>>=0,L>>>=0,-52}function vi(h,y,j,C,U,I,P){h>>>=0,y>>>=0;var L=Oe(I,P)}var pi=function(h,y,j,C){h>>>=0,y>>>=0,j>>>=0,C>>>=0;var U=new Date().getFullYear(),I=new Date(U,0,1),P=new Date(U,6,1),L=I.getTimezoneOffset(),$=P.getTimezoneOffset(),te=Math.max(L,$);ae[h>>>2>>>0]=te*60,F[y>>>2>>>0]=+(L!=$);var ue=ge=>{var le=ge>=0?"-":"+",W=Math.abs(ge),Ae=String(Math.floor(W/60)).padStart(2,"0"),qe=String(W%60).padStart(2,"0");return"UTC".concat(le).concat(Ae).concat(qe)},B=ue(L),pe=ue($);$<L?(Qe(B,j,17),Qe(pe,C,17)):(Qe(B,C,17),Qe(pe,j,17))},tt=()=>performance.now(),it=()=>Date.now(),wi=1,yi=h=>h>=0&&h<=3;function bi(h,y,j,C){var U=Oe(y,j);if(C>>>=0,!yi(h))return 28;var I;if(h===0)I=it();else if(wi)I=tt();else return 52;var P=Math.round(I*1e3*1e3);return xe=[P>>>0,(_e=P,+Math.abs(_e)>=1?_e>0?+Math.floor(_e/4294967296)>>>0:~~+Math.ceil((_e-+(~~_e>>>0))/4294967296)>>>0:0)],F[C>>>2>>>0]=xe[0],F[C+4>>>2>>>0]=xe[1],0}function mi(h,y){return h>>>=0,globalThis.DUCKDB_RUNTIME.createDirectory(l,h,y)}function gi(h,y){return h>>>=0,globalThis.DUCKDB_RUNTIME.checkDirectory(l,h,y)}function ji(h,y){return h>>>=0,globalThis.DUCKDB_RUNTIME.listDirectoryEntries(l,h,y)}function nt(h,y){return h>>>=0,globalThis.DUCKDB_RUNTIME.removeDirectory(l,h,y)}function at(h){return globalThis.DUCKDB_RUNTIME.closeFile(l,h)}function st(h,y){return h>>>=0,globalThis.DUCKDB_RUNTIME.dropFile(l,h,y)}function ot(h,y){return h>>>=0,globalThis.DUCKDB_RUNTIME.checkFile(l,h,y)}function ct(h,y,j,C){return h>>>=0,j>>>=0,globalThis.DUCKDB_RUNTIME.moveFile(l,h,y,j,C)}function ki(h,y){return globalThis.DUCKDB_RUNTIME.openFile(l,h,y)}function Ti(h,y,j,C){return y>>>=0,globalThis.DUCKDB_RUNTIME.readFile(l,h,y,j,C)}function Ei(h,y){return globalThis.DUCKDB_RUNTIME.truncateFile(l,h,y)}function Ai(h,y,j,C){return y>>>=0,globalThis.DUCKDB_RUNTIME.writeFile(l,h,y,j,C)}function Di(h){return globalThis.DUCKDB_RUNTIME.getDefaultDataProtocol(h)}function Ri(h,y){return h>>>=0,globalThis.DUCKDB_RUNTIME.glob(l,h,y)}function Ci(h){return globalThis.DUCKDB_RUNTIME.testPlatformFeature(l,h)}function Si(h,y,j,C,U,I){return h>>>=0,j>>>=0,U>>>=0,globalThis.DUCKDB_RUNTIME.callScalarUDF(l,h,y,j,C,U,I)}var jr=[],ut=(h,y)=>{jr.length=0;for(var j;j=H[h++>>>0];){var C=j!=105;C&=j!=112,y+=C&&y%8?4:0,jr.push(j==112?ae[y>>>2>>>0]:j==105?F[y>>>2>>>0]:ve[y>>>3>>>0]),y+=C?8:4}return jr},Fi=(h,y,j)=>{var C=ut(y,j);return Gt[h](...C)};function Ui(h,y,j){return h>>>=0,y>>>=0,j>>>=0,Fi(h,y,j)}var lt=()=>4294901760;function xi(){return lt()}var Hi=(h,y)=>Math.ceil(h/y)*y,Ii=h=>{var y=z.buffer,j=(h-y.byteLength+65535)/65536|0;try{return z.grow(j),Xe(),1}catch(C){}};function Bi(h){h>>>=0;var y=H.length,j=lt();if(h>j)return!1;for(var C=1;C<=4;C*=2){var U=y*(1+.2/C);U=Math.min(U,h+100663296);var I=Math.min(j,Hi(Math.max(h,U),65536)),P=Ii(I);if(P)return!0}return!1}var Nr={},Ni=()=>V||"./this.program",dr=()=>{if(!dr.strings){var h=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",y={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:h,_:Ni()};for(var j in Nr)Nr[j]===void 0?delete y[j]:y[j]=Nr[j];var C=[];for(var j in y)C.push("".concat(j,"=").concat(y[j]));dr.strings=C}return dr.strings},Pi=(h,y)=>{for(var j=0;j<h.length;++j)Y[y++>>>0]=h.charCodeAt(j);Y[y>>>0]=0},Mi=function(h,y){h>>>=0,y>>>=0;var j=0;return dr().forEach((C,U)=>{var I=y+j;ae[h+U*4>>>2>>>0]=I,Pi(C,I),j+=C.length+1}),0},Li=function(h,y){h>>>=0,y>>>=0;var j=dr();ae[h>>>2>>>0]=j.length;var C=0;return j.forEach(U=>C+=U.length+1),ae[y>>>2>>>0]=C,0},Oi=0,Wi=()=>Vt||Oi>0,qi=h=>{var y;X=h,Wi()||((y=l.onExit)==null||y.call(l,h),N=!0),je(h,new Dr(h))},ft=(h,y)=>{X=h,qi(h)},Ki=ft,Gi=h=>52;function Pr(h,y){y>>>=0;var j=0,C=0,U=0;{var I=2;h==0?j=2:(h==1||h==2)&&(j=64),U=1}return Y[y>>>0]=I,J[y+2>>>1>>>0]=U,xe=[j>>>0,(_e=j,+Math.abs(_e)>=1?_e>0?+Math.floor(_e/4294967296)>>>0:~~+Math.ceil((_e-+(~~_e>>>0))/4294967296)>>>0:0)],F[y+8>>>2>>>0]=xe[0],F[y+12>>>2>>>0]=xe[1],xe=[C>>>0,(_e=C,+Math.abs(_e)>=1?_e>0?+Math.floor(_e/4294967296)>>>0:~~+Math.ceil((_e-+(~~_e>>>0))/4294967296)>>>0:0)],F[y+16>>>2>>>0]=xe[0],F[y+20>>>2>>>0]=xe[1],0}function $i(h,y,j,C,U,I){y>>>=0,j>>>=0;var P=Oe(C,U);return I>>>=0,52}function Xi(h,y,j,C,U,I){y>>>=0,j>>>=0;var P=Oe(C,U);return I>>>=0,52}function Vi(h,y,j,C){return y>>>=0,j>>>=0,C>>>=0,52}function _t(h,y,j,C,U){var I=Oe(y,j);return U>>>=0,70}var Ji=h=>52,Yi=[null,[],[]],Qi=(h,y)=>{var j=Yi[h];y===0||y===10?((h===1?Fe:x)(Ur(j)),j.length=0):j.push(y)};function zi(h,y,j,C){y>>>=0,j>>>=0,C>>>=0;for(var U=0,I=0;I<j;I++){var P=ae[y>>>2>>>0],L=ae[y+4>>>2>>>0];y+=8;for(var $=0;$<L;$++)Qi(h,H[P+$>>>0]);U+=L}return ae[C>>>2>>>0]=U,0}function Mr(h,y,j,C){h>>>=0,y>>>=0,j>>>=0,C>>>=0;var U=0,I=0,P=0,L=0,$=0,te=0,ue;function B(pe,ge,le,W,Ae,qe){var Te,Ge,$e,yt;return Ge=pe===10?28:16,Ae=pe===10?Ye(Ae):sr(Ae),Te=ar(Ge),yt=or(Te,pe,Ae,qe),q(!yt),$e=ar(32),F[$e+4>>>2>>>0]=pe,F[$e+8>>>2>>>0]=ge,F[$e+12>>>2>>>0]=le,ae[$e+24>>>2>>>0]=W,ae[$e+20>>>2>>>0]=Te,pe===10?F[$e+16>>>2>>>0]=28:F[$e+16>>>2>>>0]=16,F[$e+28>>>2>>>0]=0,$e}if(j&&(P=F[j>>>2>>>0],L=F[j+4>>>2>>>0],$=F[j+8>>>2>>>0],te=F[j+12>>>2>>>0]),$&&!te&&(te=$===2?17:6),!$&&te&&($=te===17?2:1),te===0&&(te=6),$===0&&($=1),!h&&!y)return-2;if(P&-1088||j!==0&&F[j>>>2>>>0]&2&&!h)return-1;if(P&32)return-2;if($!==0&&$!==1&&$!==2)return-7;if(L!==0&&L!==2&&L!==10)return-6;if(y&&(y=be(y),I=parseInt(y,10),isNaN(I)))return P&1024?-2:-8;if(!h)return L===0&&(L=2),P&1||(L===2?U=_htonl(2130706433):U=[0,0,0,_htonl(1)]),ue=B(L,$,te,null,U,I),ae[C>>>2>>>0]=ue,0;if(h=be(h),U=br(h),U!==null)if(L===0||L===2)L=2;else if(L===10&&P&8)U=[0,0,_htonl(65535),U],L=10;else return-2;else if(U=Fr(h),U!==null)if(L===0||L===10)L=10;else return-2;return U!=null?(ue=B(L,$,te,h,U,I),ae[C>>>2>>>0]=ue,0):P&4?-2:(h=He.lookup_name(h),U=br(h),L===0?L=2:L===10&&(U=[0,0,_htonl(65535),U]),ue=B(L,$,te,null,U,I),ae[C>>>2>>>0]=ue,0)}function Zi(h,y,j,C,U,I,P){h>>>=0,j>>>=0,U>>>=0;var L=Wr(h,y);if(L.errno)return-6;var $=L.port,te=L.addr,ue=!1;if(j&&C){var B;if(P&1||!(B=He.lookup_addr(te))){if(P&8)return-2}else te=B;var pe=Qe(te,j,C);pe+1>=C&&(ue=!0)}if(U&&I){$=""+$;var pe=Qe($,U,I);pe+1>=I&&(ue=!0)}return ue?-12:0}var hr=()=>{if(O){var h=["crypto"].map(bt).pop();return y=>h.randomFillSync(y)}return y=>crypto.getRandomValues(y)},dt=h=>{(dt=hr())(h)};function en(h,y){return h>>>=0,y>>>=0,dt(H.subarray(h>>>0,h+y>>>0)),0}var rn=h=>{if(h instanceof Dr||h=="unwind")return X;je(1,h)},tn=h=>{var y=l["_"+h];return y},nn=(h,y)=>{Y.set(h,y>>>0)},kr=h=>Yn(h);l.stackAlloc=kr;var ht=h=>{var y=nr(h)+1,j=kr(y);return Qe(h,j,y),j},vt=()=>Qn(),pt=h=>Jn(h),an=(h,y,j,C,U)=>{var I={string:le=>{var W=0;return le!=null&&le!==0&&(W=ht(le)),W},array:le=>{var W=kr(le.length);return nn(le,W),W}};function P(le){return y==="string"?be(le):y==="boolean"?!!le:le}var L=tn(h),$=[],te=0;if(C)for(var ue=0;ue<C.length;ue++){var B=I[j[ue]];B?(te===0&&(te=vt()),$[ue]=B(C[ue])):$[ue]=C[ue]}var pe=L(...$);function ge(le){return te!==0&&pt(te),P(le)}return pe=ge(pe),pe},sn=h=>Vn(),on=h=>Xn(h),cn={ja:mr,oa:Jt,I:Yt,ea:Qt,b:zt,da:Gr,w:Hr,fa:$r,_:gr,ia:Pe,ha:Xr,ma:Zt,h:ei,aa:ri,$:ti,ba:Vr,t:Jr,na:me,X:Br,ka:ii,Y:ni,o:ai,la:Yr,s:si,ca:rr,ga:oi,p:ci,ra:Qr,F:_r,i:zr,H:Zr,G:et,E:rt,z:di,A:hi,B:vi,qa:pi,C:bi,O:mi,Q:gi,M:ji,N:nt,m:at,T:st,K:ot,L:ct,S:ki,f:Ti,R:Ei,n:Ai,U:Di,J:Ri,l:Ci,V:Si,e:Ui,k:it,pa:xi,c:tt,sa:Bi,u:Mi,v:Li,a:Ki,d:Gi,P:Pr,y:$i,x:Xi,j:Vi,D:_t,Z:Ji,g:zi,r:Mr,q:Zi,W:en},Z=await Kt(),un=l._main=Z.va,Fn=l._duckdb_web_fs_glob_add_path=Z.xa,Un=l._duckdb_web_clear_response=Z.ya,xn=l._duckdb_web_fail_with=Z.za,Hn=l._duckdb_web_reset=Z.Aa,In=l._duckdb_web_connect=Z.Ba,Bn=l._duckdb_web_disconnect=Z.Ca,Nn=l._duckdb_web_flush_files=Z.Da,ln=l._duckdb_web_flush_file=Z.Ea,Pn=l._duckdb_web_open=Z.Fa,Mn=l._duckdb_web_get_global_file_info=Z.Ga,Lr=l._duckdb_web_collect_file_stats=Z.Ha,fn=l._duckdb_web_export_file_stats=Z.Ia,K=l._duckdb_web_fs_drop_file=Z.Ja,Ln=l._duckdb_web_fs_drop_files=Z.Ka,On=l._duckdb_web_fs_glob_file_infos=Z.La,Or=l._duckdb_web_fs_get_file_info_by_id=Z.Ma,Wn=l._duckdb_web_fs_get_file_info_by_name=Z.Na,qn=l._duckdb_web_fs_register_file_url=Z.Oa,Kn=l._duckdb_web_fs_register_file_buffer=Z.Pa,Gn=l._duckdb_web_copy_file_to_buffer=Z.Qa,ee=l._duckdb_web_copy_file_to_path=Z.Ra,$n=l._duckdb_web_get_version=Z.Sa,Ua=l._duckdb_web_get_feature_flags=Z.Ta,xa=l._duckdb_web_tokenize=Z.Ua,Ha=l._duckdb_web_tokenize_buffer=Z.Va,Ia=l._duckdb_web_udf_scalar_create=Z.Wa,Ba=l._duckdb_web_prepared_create=Z.Xa,Na=l._duckdb_web_prepared_create_buffer=Z.Ya,Pa=l._duckdb_web_prepared_close=Z.Za,Ma=l._duckdb_web_prepared_run=Z._a,La=l._duckdb_web_prepared_send=Z.$a,Oa=l._duckdb_web_query_run=Z.ab,Wa=l._duckdb_web_query_run_buffer=Z.bb,qa=l._duckdb_web_pending_query_start=Z.cb,Ka=l._duckdb_web_pending_query_start_buffer=Z.db,Ga=l._duckdb_web_pending_query_poll=Z.eb,$a=l._duckdb_web_pending_query_cancel=Z.fb,Xa=l._duckdb_web_query_fetch_results=Z.gb,Va=l._duckdb_web_get_tablenames=Z.hb,Ja=l._duckdb_web_get_tablenames_buffer=Z.ib,Ya=l._duckdb_web_insert_arrow_from_ipc_stream=Z.jb,Qa=l._duckdb_web_insert_csv_from_path=Z.kb,za=l._duckdb_web_insert_json_from_path=Z.lb,ar=l._malloc=Z.pb,Za=l._free=Z.qb,es=l._calloc=Z.rb,Xn=Z.tb,Vn=Z.ub,Jn=Z.vb,Yn=Z.wb,Qn=Z.xb;function zn(h){h=Object.assign({},h);var y=U=>I=>U(I)>>>0,j=U=>(I,P)=>U(I,P)>>>0,C=U=>()=>U()>>>0;return h.pb=y(h.pb),h.rb=j(h.rb),h.wb=y(h.wb),h.xb=C(h.xb),h}l.stackSave=vt,l.stackRestore=pt,l.stackAlloc=kr,l.getTempRet0=sn,l.setTempRet0=on,l.ccall=an;function Zn(){var h=un,y=0,j=0;try{var C=h(y,j);return ft(C,!0),C}catch(U){return rn(U)}}function wt(){if(Be>0){Ve=wt;return}if(ur(),Be>0){Ve=wt;return}function h(){var j;if(l.calledRun=!0,!N){lr(),E(l),(j=l.onRuntimeInitialized)==null||j.call(l);var y=l.noInitialRun;y||Zn(),It()}}l.setStatus?(l.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>l.setStatus(""),1),h()},1)):h()}if(l.preInit)for(typeof l.preInit=="function"&&(l.preInit=[l.preInit]);l.preInit.length>0;)l.preInit.pop()();return wt(),g=S,g}})();typeof Ca=="object"&&typeof xt=="object"?(xt.exports=Sn,xt.exports.default=Sn):typeof define=="function"&&define.amd&&define([],()=>Sn)});import*as ir from"apache-arrow";var gt=class{constructor(d,b){this._bindings=d,this._conn=b}close(){this._bindings.disconnect(this._conn)}useUnsafe(d){return d(this._bindings,this._conn)}query(d){let b=this._bindings.runQuery(this._conn,d),g=ir.RecordBatchReader.from(b);return console.assert(g.isSync()),console.assert(g.isFile()),new ir.Table(g)}async send(d,b=!1){let g=this._bindings.startPendingQuery(this._conn,d,b);for(;g==null;)g=await new Promise((T,S)=>{try{T(this._bindings.pollPendingQuery(this._conn))}catch(A){console.log(A),A.message.includes("worker is not set!")?S(new Error("Worker has been terminated")):S(A)}});let l=new jt(this._bindings,this._conn,g),E=ir.RecordBatchReader.from(l);return console.assert(E.isSync()),console.assert(E.isStream()),E}cancelSent(){return this._bindings.cancelPendingQuery(this._conn)}getTableNames(d){return this._bindings.getTableNames(this._conn,d)}prepare(d){let b=this._bindings.createPrepared(this._conn,d);return new pn(this._bindings,this._conn,b)}createScalarFunction(d,b,g){this._bindings.createScalarFunction(this._conn,d,b,g)}insertArrowTable(d,b){let g=ir.tableToIPC(d,"stream");this.insertArrowFromIPCStream(g,b)}insertArrowFromIPCStream(d,b){this._bindings.insertArrowFromIPCStream(this._conn,d,b)}insertCSVFromPath(d,b){this._bindings.insertCSVFromPath(this._conn,d,b)}insertJSONFromPath(d,b){this._bindings.insertJSONFromPath(this._conn,d,b)}},jt=class{constructor(d,b,g){this.bindings=d;this.conn=b;this.header=g;this._first=!0,this._depleted=!1}next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let d=null;do d=this.bindings.fetchQueryResults(this.conn);while(d==null);return this._depleted=d.length==0,{done:this._depleted,value:d}}[Symbol.iterator](){return this}},pn=class{constructor(d,b,g){this.bindings=d,this.connectionId=b,this.statementId=g}close(){this.bindings.closePrepared(this.connectionId,this.statementId)}query(...d){let b=this.bindings.runPrepared(this.connectionId,this.statementId,d),g=ir.RecordBatchReader.from(b);return console.assert(g.isSync()),console.assert(g.isFile()),new ir.Table(g)}send(...d){let b=this.bindings.sendPrepared(this.connectionId,this.statementId,d),g=new jt(this.bindings,this.connectionId,b),l=ir.RecordBatchReader.from(g);return console.assert(l.isSync()),console.assert(l.isStream()),l}};var ea=(g=>(g[g.SUCCESS=0]="SUCCESS",g[g.MAX_ARROW_ERROR=255]="MAX_ARROW_ERROR",g[g.DUCKDB_WASM_RETRY=256]="DUCKDB_WASM_RETRY",g))(ea||{});function ra(w){return w<=255}function ta(w){return w===256}var aa=new TextEncoder,ia=new TextDecoder("utf-8");function wn(w,d,b){let g=aa.encode(b),l=w._malloc(g.byteLength),E=w.HEAPU8.subarray(l,l+g.byteLength);E.set(g),w.HEAPF64[(d>>3)+0]=1,w.HEAPF64[(d>>3)+1]=l,w.HEAPF64[(d>>3)+2]=E.byteLength}function bn(w){switch(w){case"UINT8":case"INT8":return 1;case"INT32":case"FLOAT":return 4;case"INT64":case"UINT64":case"DOUBLE":case"VARCHAR":return 8;default:return 0}}function yn(w,d,b,g){let l=w.HEAPU8.subarray(d,d+g*bn(b));switch(b){case"UINT8":return new Uint8Array(l.buffer,l.byteOffset,g);case"INT8":return new Int8Array(l.buffer,l.byteOffset,g);case"INT32":return new Int32Array(l.buffer,l.byteOffset,g);case"FLOAT":return new Float32Array(l.buffer,l.byteOffset,g);case"DOUBLE":return new Float64Array(l.buffer,l.byteOffset,g);case"VARCHAR":return new Float64Array(l.buffer,l.byteOffset,g);default:return new Array(0)}}function na(w,d,b){let g=w.HEAPU8.subarray(d,d+b);return new Uint8Array(g.buffer,g.byteOffset,b)}function kt(w,d,b){let g=w.HEAPU8.subarray(d,d+b*8);return new Float64Array(g.buffer,g.byteOffset,b)}function Tt(w,d,b,g,l,E,T,S){try{let A=w._udfFunctions.get(g);if(!A){wn(d,b,"Unknown UDF with id: "+g);return}let M=ia.decode(d.HEAPU8.subarray(l,l+E)),O=JSON.parse(M),Q=kt(d,T,S/8),ie=N=>{var q;let X=null;switch(N.validityBuffer!==void 0&&(X=na(d,Q[N.validityBuffer],O.rows)),N.physicalType){case"VARCHAR":{if(N.dataBuffer===null||N.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for VARCHAR argument");if(N.lengthBuffer===null||N.lengthBuffer===void 0)throw new Error("malformed data view, expected data length buffer for VARCHAR argument");let Y=yn(d,Q[N.dataBuffer],N.physicalType,O.rows),H=[],J=kt(d,Q[N.lengthBuffer],O.rows);for(let ne=0;ne<O.rows;++ne){if(X!=null&&!X[ne]){H.push(null);continue}let F=d.HEAPU8.subarray(Y[ne],Y[ne]+J[ne]),ae=ia.decode(F);H.push(ae)}return ne=>H[ne]}case"STRUCT":{let Y={},H=[];for(let J=0;J<(((q=N.children)==null?void 0:q.length)||0);++J){let ne=N.children[J],F=ie(ne);H.push(ae=>{Y[ne.name]=F(ae)})}return X!=null?J=>{if(!X[J])return null;for(let ne of H)ne(J);return Y}:J=>{for(let ne of H)ne(J);return Y}}default:{if(N.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for argument of type: "+N.physicalType);let Y=yn(d,Q[N.dataBuffer],N.physicalType,O.rows);return X!=null?H=>X[H]?Y[H]:null:H=>Y[H]}}},V=[];for(let N=0;N<O.args.length;++N)V.push(ie(O.args[N]));let je=O.rows*bn(O.ret.physicalType),oe=d._malloc(je),Se=yn(d,oe,O.ret.physicalType,O.rows),De=d._malloc(O.rows),ye=na(d,De,O.rows);if(Se.length==0||ye.length==0){wn(d,b,"Can't create physical arrays for result");return}let we=Se;O.ret.physicalType=="VARCHAR"&&(we=new Array(O.rows));let Ie=[];for(let N=0;N<O.args.length;++N)Ie.push(null);for(let N=0;N<O.rows;++N){for(let q=0;q<O.args.length;++q)Ie[q]=V[q](N);let X=A.func(...Ie);we[N]=X,ye[N]=X==null?0:1}let Fe=0;switch(O.ret.physicalType){case"VARCHAR":{let N=new Array(0);Fe=d._malloc(O.rows*bn("DOUBLE"));let X=kt(d,Fe,O.rows),q=0;for(let ne=0;ne<O.rows;++ne){let F=aa.encode(we[ne]||"");N.push(F),X[ne]=F.length,q+=F.length}let Y=d._malloc(q),H=d.HEAPU8.subarray(Y,Y+q),J=0;for(let ne=0;ne<O.rows;++ne){Se[ne]=J;let F=N[ne];H.subarray(J,J+F.length).set(F),J+=F.length}}}let x=3*8,G=d._malloc(x),z=kt(d,G,3);z[0]=oe,z[1]=De,z[2]=Fe,d.HEAPF64[(b>>3)+0]=0,d.HEAPF64[(b>>3)+1]=G,d.HEAPF64[(b>>3)+2]=0}catch(A){wn(d,b,A.toString())}}function J_(){let w=new TextDecoder;return d=>(typeof SharedArrayBuffer<"u"&&d.buffer instanceof SharedArrayBuffer&&(d=new Uint8Array(d)),w.decode(d))}var Y_=J_();function ze(w,d){console.error("FAIL WITH: ".concat(d)),w.ccall("duckdb_web_fail_with",null,["string"],[d])}function wr(w,d,b){let g=new Uint8Array(w.HEAPU8.buffer,d>>>0,b),l=new Uint8Array(new ArrayBuffer(g.byteLength));return l.set(g),l}function fe(w,d,b){return Y_(new Uint8Array(w.HEAPU8.buffer,d>>>0,b))}var Et=(T=>(T[T.BUFFER=0]="BUFFER",T[T.NODE_FS=1]="NODE_FS",T[T.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",T[T.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",T[T.HTTP=4]="HTTP",T[T.S3=5]="S3",T))(Et||{}),oa=(Q=>(Q[Q.FILE_FLAGS_READ=1]="FILE_FLAGS_READ",Q[Q.FILE_FLAGS_WRITE=2]="FILE_FLAGS_WRITE",Q[Q.FILE_FLAGS_DIRECT_IO=4]="FILE_FLAGS_DIRECT_IO",Q[Q.FILE_FLAGS_FILE_CREATE=8]="FILE_FLAGS_FILE_CREATE",Q[Q.FILE_FLAGS_FILE_CREATE_NEW=16]="FILE_FLAGS_FILE_CREATE_NEW",Q[Q.FILE_FLAGS_APPEND=32]="FILE_FLAGS_APPEND",Q[Q.FILE_FLAGS_PRIVATE=64]="FILE_FLAGS_PRIVATE",Q[Q.FILE_FLAGS_NULL_IF_NOT_EXISTS=128]="FILE_FLAGS_NULL_IF_NOT_EXISTS",Q[Q.FILE_FLAGS_PARALLEL_ACCESS=256]="FILE_FLAGS_PARALLEL_ACCESS",Q[Q.FILE_FLAGS_EXCLUSIVE_CREATE=512]="FILE_FLAGS_EXCLUSIVE_CREATE",Q[Q.FILE_FLAGS_NULL_IF_EXISTS=1024]="FILE_FLAGS_NULL_IF_EXISTS",Q))(oa||{});function ke(w,d,b,g){let l=w.stackSave(),E=w.stackAlloc(3*8);b.unshift("number"),g.unshift(E),w.ccall(d,null,b,g);let T=w.HEAPF64[(E>>3)+0],S=w.HEAPF64[(E>>3)+1],A=w.HEAPF64[(E>>3)+2];return w.stackRestore(l),[T,S,A]}function Ee(w){w.ccall("duckdb_web_clear_response",null,[],[])}var ca={_udfFunctions:new Map,testPlatformFeature:(w,d)=>!1,getDefaultDataProtocol:w=>0,openFile:(w,d,b)=>{},syncFile:(w,d)=>{},closeFile:(w,d)=>{},dropFile:(w,d,b)=>{},getLastFileModificationTime:(w,d)=>0,progressUpdate:(w,d,b)=>{},truncateFile:(w,d,b)=>{},readFile:(w,d,b,g,l)=>0,writeFile:(w,d,b,g,l)=>0,removeDirectory:(w,d,b)=>{},checkDirectory:(w,d,b)=>!1,createDirectory:(w,d,b)=>{},listDirectoryEntries:(w,d,b)=>!1,glob:(w,d,b)=>{},moveFile:(w,d,b,g,l)=>{},checkFile:(w,d,b)=>!1,removeFile:(w,d,b)=>{},callScalarUDF:(w,d,b,g,l,E,T)=>{Tt(ca,w,d,b,g,l,E,T)}};var At=class{constructor(d){let b=new Float64Array(d.buffer,d.byteOffset,d.byteLength/8),g=new Uint8Array(new ArrayBuffer(d.byteLength));g.set(d.subarray(7*8)),this.totalFileReadsCold=b[0],this.totalFileReadsAhead=b[1],this.totalFileReadsCached=b[2],this.totalFileWrites=b[3],this.totalPageAccesses=b[4],this.totalPageLoads=b[5],this.blockSize=b[6],this.blockStats=g}getBlockStats(d,b){return b=b||{file_reads_cold:0,file_reads_ahead:0,file_reads_cached:0,file_writes:0,page_accesses:0,page_loads:0},b.file_writes=this.blockStats[d*3+0]&15,b.file_reads_cold=this.blockStats[d*3+0]>>4,b.file_reads_ahead=this.blockStats[d*3+1]&15,b.file_reads_cached=this.blockStats[d*3+1]>>4,b.page_accesses=this.blockStats[d*3+1]&15,b.page_loads=this.blockStats[d*3+1]>>4,b}};import*as he from"apache-arrow";function Tr(w){switch(w.typeId){case he.Type.Binary:return{sqlType:"binary"};case he.Type.Bool:return{sqlType:"bool"};case he.Type.Date:return{sqlType:"date"};case he.Type.DateDay:return{sqlType:"date32[d]"};case he.Type.DateMillisecond:return{sqlType:"date64[ms]"};case he.Type.Decimal:{let d=w;return{sqlType:"decimal",precision:d.precision,scale:d.scale}}case he.Type.Float:return{sqlType:"float"};case he.Type.Float16:return{sqlType:"float16"};case he.Type.Float32:return{sqlType:"float32"};case he.Type.Float64:return{sqlType:"float64"};case he.Type.Int:return{sqlType:"int32"};case he.Type.Int16:return{sqlType:"int16"};case he.Type.Int32:return{sqlType:"int32"};case he.Type.Int64:return{sqlType:"int64"};case he.Type.Uint16:return{sqlType:"uint16"};case he.Type.Uint32:return{sqlType:"uint32"};case he.Type.Uint64:return{sqlType:"uint64"};case he.Type.Uint8:return{sqlType:"uint8"};case he.Type.IntervalDayTime:return{sqlType:"interval[dt]"};case he.Type.IntervalYearMonth:return{sqlType:"interval[m]"};case he.Type.List:return{sqlType:"list",valueType:Tr(w.valueType)};case he.Type.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:w.byteWidth};case he.Type.Null:return{sqlType:"null"};case he.Type.Utf8:return{sqlType:"utf8"};case he.Type.Struct:return{sqlType:"struct",fields:w.children.map(b=>Dt(b.name,b.type))};case he.Type.Map:{let d=w;return{sqlType:"map",keyType:Tr(d.keyType),valueType:Tr(d.valueType)}}case he.Type.Time:return{sqlType:"time[s]"};case he.Type.TimeMicrosecond:return{sqlType:"time[us]"};case he.Type.TimeMillisecond:return{sqlType:"time[ms]"};case he.Type.TimeNanosecond:return{sqlType:"time[ns]"};case he.Type.TimeSecond:return{sqlType:"time[s]"};case he.Type.Timestamp:return{sqlType:"timestamp",timezone:w.timezone||void 0};case he.Type.TimestampSecond:return{sqlType:"timestamp[s]",timezone:w.timezone||void 0};case he.Type.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:w.timezone||void 0};case he.Type.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:w.timezone||void 0};case he.Type.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:w.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(w.toString()))}function Dt(w,d){let b=Tr(d);return b.name=w,b}var Er=new TextEncoder,Q_=(T=>(T[T.WASM_EXCEPTIONS=1]="WASM_EXCEPTIONS",T[T.WASM_THREADS=2]="WASM_THREADS",T[T.WASM_SIMD=4]="WASM_SIMD",T[T.WASM_BULK_MEMORY=8]="WASM_BULK_MEMORY",T[T.EMIT_BIGINT=16]="EMIT_BIGINT",T[T.WASMFS=32]="WASMFS",T))(Q_||{}),Rt=class{constructor(d,b){this._instance=null;this._initPromise=null;this._initPromiseResolver=()=>{};this.onInstantiationProgress=[];this._logger=d,this._runtime=b,this._nextUDFId=1}get logger(){return this._logger}get mod(){return this._instance}get pthread(){return this.mod.PThread||null}async instantiate(d=b=>{}){return this._instance!=null?this:(this._initPromise!=null&&(this.onInstantiationProgress.push(d),await this._initPromise),this._initPromise=new Promise(b=>{this._initPromiseResolver=b}),this.onInstantiationProgress=[d],this._instance=await this.instantiateImpl({print:console.log.bind(console),printErr:console.log.bind(console),onRuntimeInitialized:this._initPromiseResolver}),await this._initPromise,this._initPromise=null,this.onInstantiationProgress=this.onInstantiationProgress.filter(b=>b!=d),globalThis.DUCKDB_BINDINGS=this,this)}open(d){let[b,g,l]=ke(this.mod,"duckdb_web_open",["string"],[JSON.stringify(d)]);if(b!==0)throw new Error(fe(this.mod,g,l));Ee(this.mod)}reset(){let[d,b,g]=ke(this.mod,"duckdb_web_reset",[],[]);if(d!==0)throw new Error(fe(this.mod,b,g));Ee(this.mod)}getVersion(){let[d,b,g]=ke(this.mod,"duckdb_web_get_version",[],[]);if(d!==0)throw new Error(fe(this.mod,b,g));let l=fe(this.mod,b,g);return Ee(this.mod),l}getFeatureFlags(){return this.mod.ccall("duckdb_web_get_feature_flags","number",[],[])}tokenize(d){let b=Er.encode(d),g=this.mod._malloc(b.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,g,b.length).set(b);let[E,T,S]=ke(this.mod,"duckdb_web_tokenize_buffer",["number","number"],[g,b.length]);if(this.mod._free(g),E!==0)throw new Error(fe(this.mod,T,S));let A=fe(this.mod,T,S);return Ee(this.mod),JSON.parse(A)}connect(){let d=this.mod.ccall("duckdb_web_connect","number",[],[]);return new gt(this,d)}disconnect(d){if(this.mod.ccall("duckdb_web_disconnect",null,["number"],[d]),this.pthread)for(let b of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])b.postMessage({cmd:"dropUDFFunctions",connectionId:d})}runQuery(d,b){let g=Er.encode(b),l=this.mod._malloc(g.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,l,g.length).set(g);let[T,S,A]=ke(this.mod,"duckdb_web_query_run_buffer",["number","number","number"],[d,l,g.length]);if(this.mod._free(l),T!==0)throw new Error(fe(this.mod,S,A));let M=wr(this.mod,S,A);return Ee(this.mod),M}startPendingQuery(d,b,g=!1){let l=Er.encode(b),E=this.mod._malloc(l.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,E,l.length).set(l);let[S,A,M]=ke(this.mod,"duckdb_web_pending_query_start_buffer",["number","number","number","boolean"],[d,E,l.length,g]);if(this.mod._free(E),S!==0)throw new Error(fe(this.mod,A,M));if(A==0)return null;let O=wr(this.mod,A,M);return Ee(this.mod),O}pollPendingQuery(d){let[b,g,l]=ke(this.mod,"duckdb_web_pending_query_poll",["number"],[d]);if(b!==0)throw new Error(fe(this.mod,g,l));if(g==0)return null;let E=wr(this.mod,g,l);return Ee(this.mod),E}cancelPendingQuery(d){return this.mod.ccall("duckdb_web_pending_query_cancel","boolean",["number"],[d])}fetchQueryResults(d){let[b,g,l]=ke(this.mod,"duckdb_web_query_fetch_results",["number"],[d]);if(ta(b))return Ee(this.mod),null;if(!ra(b))throw new Error("Unexpected StatusCode from duckdb_web_query_fetch_results ("+b+") and with self reported error as"+fe(this.mod,g,l));if(b!==0)throw new Error(fe(this.mod,g,l));let E=wr(this.mod,g,l);return Ee(this.mod),E}getTableNames(d,b){let g=Er.encode(b),l=this.mod._malloc(g.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,l,g.length).set(g);let[T,S,A]=ke(this.mod,"duckdb_web_get_tablenames_buffer",["number","number","number"],[d,l,g.length]);if(this.mod._free(l),T!==0)throw new Error(fe(this.mod,S,A));let M=fe(this.mod,S,A);return Ee(this.mod),JSON.parse(M)}createScalarFunction(d,b,g,l){let E={functionId:this._nextUDFId,name:b,returnType:Tr(g)},T={functionId:E.functionId,connectionId:d,name:b,returnType:g,func:l};this._nextUDFId+=1;let[S,A,M]=ke(this.mod,"duckdb_web_udf_scalar_create",["number","string"],[d,JSON.stringify(E)]);if(S!==0)throw new Error(fe(this.mod,A,M));if(Ee(this.mod),globalThis.DUCKDB_RUNTIME._udfFunctions=(globalThis.DUCKDB_RUNTIME._udfFunctions||new Map).set(T.functionId,T),this.pthread)for(let O of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])O.postMessage({cmd:"registerUDFFunction",udf:T})}createPrepared(d,b){let g=Er.encode(b),l=this.mod._malloc(g.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,l,g.length).set(g);let[T,S,A]=ke(this.mod,"duckdb_web_prepared_create_buffer",["number","number","number"],[d,l,g.length]);if(this.mod._free(l),T!==0)throw new Error(fe(this.mod,S,A));return Ee(this.mod),S}closePrepared(d,b){let[g,l,E]=ke(this.mod,"duckdb_web_prepared_close",["number","number"],[d,b]);if(g!==0)throw new Error(fe(this.mod,l,E));Ee(this.mod)}runPrepared(d,b,g){let[l,E,T]=ke(this.mod,"duckdb_web_prepared_run",["number","number","string"],[d,b,JSON.stringify(g)]);if(l!==0)throw new Error(fe(this.mod,E,T));let S=wr(this.mod,E,T);return Ee(this.mod),S}sendPrepared(d,b,g){let[l,E,T]=ke(this.mod,"duckdb_web_prepared_send",["number","number","string"],[d,b,JSON.stringify(g)]);if(l!==0)throw new Error(fe(this.mod,E,T));let S=wr(this.mod,E,T);return Ee(this.mod),S}insertArrowFromIPCStream(d,b,g){if(b.length==0)return;let l=this.mod._malloc(b.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,l,b.length).set(b);let T=g?JSON.stringify(g):"",[S,A,M]=ke(this.mod,"duckdb_web_insert_arrow_from_ipc_stream",["number","number","number","string"],[d,l,b.length,T]);if(this.mod._free(l),S!==0)throw new Error(fe(this.mod,A,M))}insertCSVFromPath(d,b,g){if(g.columns!==void 0){g.columnsFlat=[];for(let M in g.columns)g.columnsFlat.push(Dt(M,g.columns[M]))}let l={...g};l.columns=l.columnsFlat,delete l.columnsFlat;let E=JSON.stringify(l),[T,S,A]=ke(this.mod,"duckdb_web_insert_csv_from_path",["number","string","string"],[d,b,E]);if(T!==0)throw new Error(fe(this.mod,S,A))}insertJSONFromPath(d,b,g){if(g.columns!==void 0){g.columnsFlat=[];for(let M in g.columns)g.columnsFlat.push(Dt(M,g.columns[M]))}let l={...g};l.columns=l.columnsFlat,delete l.columnsFlat;let E=JSON.stringify(l),[T,S,A]=ke(this.mod,"duckdb_web_insert_json_from_path",["number","string","string"],[d,b,E]);if(T!==0)throw new Error(fe(this.mod,S,A))}globFiles(d){let[b,g,l]=ke(this.mod,"duckdb_web_fs_glob_file_infos",["string"],[d]);if(b!==0)throw new Error(fe(this.mod,g,l));let E=fe(this.mod,g,l);Ee(this.mod);let T=JSON.parse(E);return T==null?[]:T}registerFileURL(d,b,g,l=!1){b===void 0&&(b=d);let[E,T,S]=ke(this.mod,"duckdb_web_fs_register_file_url",["string","string"],[d,b,g,l]);if(E!==0)throw new Error(fe(this.mod,T,S));Ee(this.mod)}registerFileText(d,b){let g=Er.encode(b);this.registerFileBuffer(d,g)}registerFileBuffer(d,b){let g=this.mod._malloc(b.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,g,b.length).set(b);let[E,T,S]=ke(this.mod,"duckdb_web_fs_register_file_buffer",["string","number","number"],[d,g,b.length]);if(E!==0)throw new Error(fe(this.mod,T,S));Ee(this.mod)}async prepareFileHandle(d,b){if(b===3&&this._runtime.prepareFileHandles){let g=await this._runtime.prepareFileHandles([d],3);for(let l of g){let{handle:E,path:T,fromCached:S}=l;!S&&E.getSize()&&await this.registerFileHandleAsync(T,E,3,!0)}return}throw new Error("prepareFileHandle: unsupported protocol ".concat(b))}async prepareDBFileHandle(d,b){if(b===3&&this._runtime.prepareDBFileHandle){let g=await this._runtime.prepareDBFileHandle(d,3);for(let l of g){let{handle:E,path:T,fromCached:S}=l;!S&&E.getSize()&&await this.registerFileHandleAsync(T,E,3,!0)}return}throw new Error("prepareDBFileHandle: unsupported protocol ".concat(b))}async prepareFileHandleAsync(d,b,g,l){if(g===3&&!(b instanceof FileSystemSyncAccessHandle)){if(b instanceof FileSystemFileHandle){let E=b;try{b=await E.createSyncAccessHandle()}catch(T){throw new Error(T.message+":"+d)}}else if(d!=null)try{b=await(await(await navigator.storage.getDirectory()).getFileHandle(d)).createSyncAccessHandle()}catch(E){throw new Error(E.message+":"+d)}}return b}async registerFileHandleAsync(d,b,g,l){let E=await this.prepareFileHandleAsync(d,b,g,l);this.registerFileHandle(d,E,g,l)}registerFileHandle(d,b,g,l){var A;let[E,T,S]=ke(this.mod,"duckdb_web_fs_register_file_url",["string","string","number","boolean"],[d,d,g,l]);if(E!==0)throw new Error(fe(this.mod,T,S));if(Ee(this.mod),globalThis.DUCKDB_RUNTIME._files=(globalThis.DUCKDB_RUNTIME._files||new Map).set(d,b),(A=globalThis.DUCKDB_RUNTIME._preparedHandles)!=null&&A[d]&&delete globalThis.DUCKDB_RUNTIME._preparedHandles[d],this.pthread){for(let M of this.pthread.runningWorkers)M.postMessage({cmd:"registerFileHandle",fileName:d,fileHandle:b});for(let M of this.pthread.unusedWorkers)M.postMessage({cmd:"dropFileHandle",fileName:d})}}dropFile(d){let[b,g,l]=ke(this.mod,"duckdb_web_fs_drop_file",["string"],[d]);if(b!==0)throw new Error(fe(this.mod,g,l));Ee(this.mod)}dropFiles(d){let b=[],g=-1;try{for(let S of d!=null?d:[])if(S!=null&&S.length>0){let A=this.mod.lengthBytesUTF8(S)+1,M=this.mod._malloc(A);if(!M)throw new Error("Failed to allocate memory for string: ".concat(S));this.mod.stringToUTF8(S,M,A),b.push(M)}if(g=this.mod._malloc(b.length*4),!g)throw new Error("Failed to allocate memory for pointers array");for(let S=0;S<b.length;S++)this.mod.HEAP32[(g>>2)+S]=b[S];let[l,E,T]=ke(this.mod,"duckdb_web_fs_drop_files",["number","number"],[g,b.length]);if(l!==0)throw new Error(fe(this.mod,E,T));Ee(this.mod)}finally{for(let l of b)this.mod._free(l);g>0&&this.mod._free(g)}}flushFiles(){this.mod.ccall("duckdb_web_flush_files",null,[],[])}copyFileToPath(d,b){let[g,l,E]=ke(this.mod,"duckdb_web_copy_file_to_path",["string","string"],[d,b]);if(g!==0)throw new Error(fe(this.mod,l,E));Ee(this.mod)}copyFileToBuffer(d){let[b,g,l]=ke(this.mod,"duckdb_web_copy_file_to_buffer",["string"],[d]);if(b!==0)throw new Error(fe(this.mod,g,l));let E=new Uint8Array(this.mod.HEAPU8.buffer,g>>>0,l),T=new Uint8Array(E.length);return T.set(E),Ee(this.mod),T}async registerOPFSFileName(d){if(d.startsWith("opfs://"))return this.prepareFileHandle(d,3);throw new Error("Not an OPFS file name: "+d)}collectFileStatistics(d,b){let[g,l,E]=ke(this.mod,"duckdb_web_collect_file_stats",["string","boolean"],[d,b]);if(g!==0)throw new Error(fe(this.mod,l,E))}exportFileStatistics(d){let[b,g,l]=ke(this.mod,"duckdb_web_export_file_stats",["string"],[d]);if(b!==0)throw new Error(fe(this.mod,g,l));return new At(new Uint8Array(this.mod.HEAPU8.buffer,g>>>0,l))}};var z_=(l=>(l[l.UNDEFINED=0]="UNDEFINED",l[l.AUTOMATIC=1]="AUTOMATIC",l[l.READ_ONLY=2]="READ_ONLY",l[l.READ_WRITE=3]="READ_WRITE",l))(z_||{});var Z_=(b=>(b.ROW_ARRAY="row-array",b.COLUMN_OBJECT="column-object",b))(Z_||{});var ed=(T=>(T[T.IDENTIFIER=0]="IDENTIFIER",T[T.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",T[T.STRING_CONSTANT=2]="STRING_CONSTANT",T[T.OPERATOR=3]="OPERATOR",T[T.KEYWORD=4]="KEYWORD",T[T.COMMENT=5]="COMMENT",T))(ed||{});var rd=(E=>(E[E.NONE=0]="NONE",E[E.DEBUG=1]="DEBUG",E[E.INFO=2]="INFO",E[E.WARNING=3]="WARNING",E[E.ERROR=4]="ERROR",E))(rd||{}),td=(T=>(T[T.NONE=0]="NONE",T[T.CONNECT=1]="CONNECT",T[T.DISCONNECT=2]="DISCONNECT",T[T.OPEN=3]="OPEN",T[T.QUERY=4]="QUERY",T[T.INSTANTIATE=5]="INSTANTIATE",T))(td||{}),id=(T=>(T[T.NONE=0]="NONE",T[T.OK=1]="OK",T[T.ERROR=2]="ERROR",T[T.START=3]="START",T[T.RUN=4]="RUN",T[T.CAPTURE=5]="CAPTURE",T))(id||{}),nd=(E=>(E[E.NONE=0]="NONE",E[E.WEB_WORKER=1]="WEB_WORKER",E[E.NODE_WORKER=2]="NODE_WORKER",E[E.BINDINGS=3]="BINDINGS",E[E.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",E))(nd||{}),ua=class{log(d){}},la=class{constructor(d=2){this.level=d}log(d){d.level>=this.level&&console.log(d)}};function Rd(w){switch(w){case 0:return"NONE";case 1:return"DEBUG";case 2:return"INFO";case 3:return"WARNING";case 4:return"ERROR";default:return"?"}}function Cd(w){switch(w){case 0:return"NONE";case 1:return"OK";case 2:return"ERROR";case 3:return"START";case 4:return"RUN";case 5:return"CAPTURE";default:return"?"}}function Sd(w){switch(w){case 1:return"CONNECT";case 2:return"DISCONNECT";case 5:return"INSTANTIATE";case 3:return"OPEN";case 4:return"QUERY";default:return"?"}}function Fd(w){switch(w){case 0:return"NONE";case 1:return"WEB WORKER";case 2:return"NODE WORKER";case 3:return"DUCKDB BINDINGS";case 4:return"DUCKDB";default:return"?"}}var fa=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),_a=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11]));var da=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]));var ha=()=>(async w=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(w)}catch(d){return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]));var Ct={name:"@run-trace/duckdb-wasm",version:"0.3.1",description:"DuckDB powered by WebAssembly \u2014 Trace fork with bundled extensions",license:"MIT",repository:{type:"git",url:"https://github.com/trace-github/duckdb-wasm.git"},keywords:["sql","duckdb","relational","database","data","query","wasm","analytics","olap","arrow","parquet","json","csv"],dependencies:{"apache-arrow":"^17.0.0",qs:"^6.14.1"},devDependencies:{"@types/emscripten":"^1.39.10","@types/jasmine":"^5.1.13","@typescript-eslint/eslint-plugin":"^6.21.0","@typescript-eslint/parser":"^6.21.0",esbuild:"^0.20.2",eslint:"^8.57.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.37.5","fast-glob":"^3.3.2",jasmine:"^5.13.0","jasmine-core":"^5.1.2","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.11.1",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-coverage":"^2.2.1","karma-firefox-launcher":"^2.1.3","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-sourcemap-loader":"^0.4.0","karma-spec-reporter":"^0.0.36","make-dir":"^4.0.0",nyc:"^15.1.0",prettier:"^3.2.5",puppeteer:"^22.8.0",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.28.15",typescript:"^5.3.3","wasm-feature-detect":"^1.6.1","web-worker":"^1.2.0"},scripts:{"build:debug":"node bundle.mjs debug && tsc --emitDeclarationOnly","build:release":"node bundle.mjs release && tsc --emitDeclarationOnly",docs:"typedoc",format:'prettier --write "**/*.+(js|ts)"',report:"node ./coverage.mjs","test:node":"node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:debug":"node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:coverage":"nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:firefox":"karma start ./karma/tests-firefox.cjs","test:chrome":"karma start ./karma/tests-chrome.cjs","test:chrome:eh":"karma start ./karma/tests-chrome-eh.cjs","test:chrome:coverage":"karma start ./karma/tests-chrome-coverage.cjs","test:browser":"karma start ./karma/tests-all.cjs","test:browser:debug":"karma start ./karma/tests-debug.cjs",test:"npm run test:chrome && npm run test:node","test:coverage":"npm run test:chrome:coverage && npm run test:node:coverage && npm run report",lint:"eslint src test"},files:["dist","!dist/tests-*","!dist/duckdb-browser-mvp.worker.js.map","!dist/types/test"],main:"dist/duckdb-browser.cjs",module:"dist/duckdb-browser.mjs",types:"dist/duckdb-browser.d.ts",jsdelivr:"dist/duckdb-browser.cjs",unpkg:"dist/duckdb-browser.mjs",sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-mvp.wasm":"./dist/duckdb-mvp.wasm","./dist/duckdb-eh.wasm":"./dist/duckdb-eh.wasm","./dist/duckdb-coi.wasm":"./dist/duckdb-coi.wasm","./dist/duckdb-browser":"./dist/duckdb-browser.mjs","./dist/duckdb-browser.cjs":"./dist/duckdb-browser.cjs","./dist/duckdb-browser.mjs":"./dist/duckdb-browser.mjs","./dist/duckdb-browser-coi.pthread.worker.js":"./dist/duckdb-browser-coi.pthread.worker.js","./dist/duckdb-browser-coi.worker.js":"./dist/duckdb-browser-coi.worker.js","./dist/duckdb-browser-eh.worker.js":"./dist/duckdb-browser-eh.worker.js","./dist/duckdb-browser-mvp.worker.js":"./dist/duckdb-browser-mvp.worker.js","./dist/duckdb-node":"./dist/duckdb-node.cjs","./dist/duckdb-node.cjs":"./dist/duckdb-node.cjs","./dist/duckdb-node-blocking":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-blocking.cjs":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-eh.worker.cjs":"./dist/duckdb-node-eh.worker.cjs","./dist/duckdb-node-mvp.worker.cjs":"./dist/duckdb-node-mvp.worker.cjs","./blocking":{node:{types:"./dist/duckdb-node-blocking.d.ts",require:"./dist/duckdb-node-blocking.cjs",import:"./dist/duckdb-node-blocking.cjs"},types:"./dist/duckdb-node-blocking.d.ts",import:"./dist/duckdb-node-blocking.mjs",require:"./dist/duckdb-node-blocking.cjs"},".":{browser:{types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"},node:{types:"./dist/duckdb-node.d.ts",import:"./dist/duckdb-node.cjs",require:"./dist/duckdb-node.cjs"},types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"}}};var va=Ct.name,pa=Ct.version,mn=Ct.version.split("."),Id=mn[0],Bd=mn[1],Nd=mn[2];var wa=()=>typeof navigator>"u",ya=()=>wa()?"node":navigator.userAgent,Ld=()=>ya().includes("Firefox"),Od=()=>/^((?!chrome|android).)*safari/i.test(ya());function Wd(){let w="https://cdn.jsdelivr.net/npm/".concat(va,"@").concat(pa,"/dist/");return{mvp:{mainModule:"".concat(w,"duckdb-mvp.wasm"),mainWorker:"".concat(w,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(w,"duckdb-eh.wasm"),mainWorker:"".concat(w,"duckdb-browser-eh.worker.js")}}}var gn=null,jn=null,kn=null,Tn=null,En=null;async function An(){return gn==null&&(gn=typeof BigInt64Array<"u"),jn==null&&(jn=await _a()),kn==null&&(kn=await ha()),Tn==null&&(Tn=await da()),En==null&&(En=await fa()),{bigInt64Array:gn,crossOriginIsolated:wa()||globalThis.crossOriginIsolated||!1,wasmExceptions:jn,wasmSIMD:Tn,wasmThreads:kn,wasmBulkMemory:En}}async function qd(w){let d=await An();if(d.wasmExceptions){if(d.wasmSIMD&&d.wasmThreads&&d.crossOriginIsolated&&w.coi)return{mainModule:w.coi.mainModule,mainWorker:w.coi.mainWorker,pthreadWorker:w.coi.pthreadWorker};if(w.eh)return{mainModule:w.eh.mainModule,mainWorker:w.eh.mainWorker,pthreadWorker:null}}return{mainModule:w.mvp.mainModule,mainWorker:w.mvp.mainWorker,pthreadWorker:null}}var cr=vn(ga()),ja=function(w,d,b){var g;return(g=w==null?void 0:w.endpoint)!=null&&g.startsWith("http")?new URL(w.endpoint).host:w!=null&&w.endpoint?"".concat(b,".").concat(w==null?void 0:w.endpoint):"".concat(b,".s3.amazonaws.com")};function od(w,d,b){var E,T,S,A;let g=ka(d),l=g.path;if(Ta(w)){let M="";if(w!=null&&w.endpoint){let O=new URL(w.endpoint);O.pathname!=="/"&&(M=O.pathname)}l="".concat(M,"/").concat(g.bucket).concat(l)}return{url:l,query:"",host:ja(w,d,g.bucket),region:(E=w==null?void 0:w.region)!=null?E:"",service:"s3",method:b,accessKeyId:(T=w==null?void 0:w.accessKeyId)!=null?T:"",secretAccessKey:(S=w==null?void 0:w.secretAccessKey)!=null?S:"",sessionToken:(A=w==null?void 0:w.sessionToken)!=null?A:"",dateNow:new Date().toISOString().replace(/-/g,"").split("T")[0],datetimeNow:new Date().toISOString().replace(/-/g,"").replace(/:/g,"").split(".")[0]+"Z"}}function cd(w,d=!1){let b="0123456789ABCDEF",g="";for(let l=0;l<w.length;l++){let E=w[l];E>="A"&&E<="Z"||E>="a"&&E<="z"||E>="0"&&E<="9"||E=="_"||E=="-"||E=="~"||E=="."?g+=E:E=="/"?d?g+="%2F":g+=E:(g+="%",g+=b[E.charCodeAt(0)>>4],g+=b[E.charCodeAt(0)&15])}return g}function ud(w,d=null){var je;let b=(je=d==null?void 0:d.contentHash)!=null?je:"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",g=new Map;g.set("x-amz-date",w.datetimeNow),g.set("x-amz-content-sha256",b),w.sessionToken&&g.set("x-amz-security-token",w.sessionToken);let l="";d!=null&&d.contentType&&(l+="content-type;"),l+="host;x-amz-content-sha256;x-amz-date",w.sessionToken&&(l+=";x-amz-security-token");let E=w.method+"\n"+cd(w.url)+"\n"+w.query;d!=null&&d.contentType&&(E+="\ncontent-type:"+(d==null?void 0:d.contentType)),E+="\nhost:"+w.host+"\nx-amz-content-sha256:"+b+"\nx-amz-date:"+w.datetimeNow,w.sessionToken&&w.sessionToken.length>0&&(E+="\nx-amz-security-token:"+w.sessionToken),E+="\n\n"+l+"\n"+b;let T=(0,cr.sha256)(E),S="AWS4-HMAC-SHA256\n"+w.datetimeNow+"\n"+w.dateNow+"/"+w.region+"/"+w.service+"/aws4_request\n"+T,A="AWS4"+w.secretAccessKey,M=cr.sha256.hmac.arrayBuffer(A,w.dateNow),O=cr.sha256.hmac.arrayBuffer(M,w.region),Q=cr.sha256.hmac.arrayBuffer(O,w.service),ie=cr.sha256.hmac.arrayBuffer(Q,"aws4_request"),V=cr.sha256.hmac(ie,S);return g.set("Authorization","AWS4-HMAC-SHA256 Credential="+w.accessKeyId+"/"+w.dateNow+"/"+w.region+"/"+w.service+"/aws4_request, SignedHeaders="+l+", Signature="+V),g}var ld=function(w,d,b,g=null,l=null){let E=od(w,d,b),T={contentType:g,contentHash:l?cr.sha256.hex(l):null};return ud(E,T)};function Ze(w,d,b,g,l=null,E=null){(d!=null&&d.accessKeyId||d!=null&&d.sessionToken)&&(ld(d,b,g,l,E).forEach((S,A)=>{w.setRequestHeader(A,S)}),l&&w.setRequestHeader("content-type",l))}function ka(w){if(w.indexOf("s3://")!=0)throw new Error("URL needs to start with s3://");let d=w.indexOf("/",5);if(d==-1)throw new Error("URL needs to contain a '/' after the host");let b=w.substring(5,d);if(!b)throw new Error("URL needs to contain a bucket name");let g=w.substring(d);if(!g)throw new Error("URL needs to contain key");return{bucket:b,path:g}}function Ta(w){var d;return!!((d=w==null?void 0:w.endpoint)!=null&&d.startsWith("http"))}function er(w,d){let b=ka(d);return Ta(w)?"".concat(w==null?void 0:w.endpoint,"/").concat(b.bucket)+b.path:"https://"+ja(w,d,b.bucket)+b.path}var fd=7,Ea=/\/|\\/,se={_files:new Map,_fileInfoCache:new Map,_udfFunctions:new Map,_globalFileInfo:null,_preparedHandles:{},_opfsRoot:null,getFileInfo(w,d){try{let b=se._fileInfoCache.get(d),[g,l,E]=ke(w,"duckdb_web_fs_get_file_info_by_id",["number","number"],[d,(b==null?void 0:b.cacheEpoch)||0]);if(g!==0)return null;if(E===0)return b;let T=fe(w,l,E);Ee(w);try{let S=JSON.parse(T);if(S==null)return null;let A={...S,blob:null};return se._fileInfoCache.set(d,A),!se._files.has(A.fileName)&&se._preparedHandles[A.fileName]&&(se._files.set(A.fileName,se._preparedHandles[A.fileName]),delete se._preparedHandles[A.fileName]),A}catch(S){return console.warn(S),null}}catch(b){return console.log(b),null}},getGlobalFileInfo(w){var d;try{let[b,g,l]=ke(w,"duckdb_web_get_global_file_info",["number"],[((d=se._globalFileInfo)==null?void 0:d.cacheEpoch)||0]);if(b!==0)return null;if(l===0)return se._globalFileInfo;let E=fe(w,g,l);Ee(w);let T=JSON.parse(E);return T==null?null:(se._globalFileInfo={...T,blob:null},se._globalFileInfo)}catch(b){return console.log(b),null}},async assignOPFSRoot(){se._opfsRoot||(se._opfsRoot=await navigator.storage.getDirectory())},async prepareFileHandles(w,d){if(d===3){await se.assignOPFSRoot();let b=async l=>{if(se._files.has(l))return{path:l,handle:se._files.get(l),fromCached:!0};let T=se._opfsRoot,S=l.slice(fd),A=S;if(Ea.test(S)){let O=S.split(Ea);if(O.length===0)throw new Error("Invalid path ".concat(S));if(A=O[O.length-1],!A)throw new Error("Invalid path ".concat(S,". File Not Found."));O.pop();for(let Q of O)T=await T.getDirectoryHandle(Q,{create:!0})}let M=await T.getFileHandle(A,{create:!1}).catch(O=>{if((O==null?void 0:O.name)==="NotFoundError")return console.debug("File ".concat(l," does not exists yet, creating...")),T.getFileHandle(A,{create:!0});throw O});try{let O=await M.createSyncAccessHandle();return se._preparedHandles[l]=O,{path:l,handle:O,fromCached:!1}}catch(O){throw new Error(O.message+":"+name)}},g=[];for(let l of w){let E=await b(l);g.push(E)}return g}throw new Error("Unsupported protocol ".concat(d," for paths ").concat(w," with protocol ").concat(d))},async prepareDBFileHandle(w,d){if(d===3&&this.prepareFileHandles){let b=[w,"".concat(w,".wal")];return this.prepareFileHandles(b,d)}throw new Error("Unsupported protocol ".concat(d," for path ").concat(w," with protocol ").concat(d))},testPlatformFeature:(w,d)=>{switch(d){case 1:return typeof BigInt64Array<"u";default:return console.warn("test for unknown feature: ".concat(d)),!1}},getDefaultDataProtocol(w){return 2},openFile:(w,d,b)=>{var g,l,E,T,S,A;try{se._fileInfoCache.delete(d);let M=se.getFileInfo(w,d);switch(M==null?void 0:M.dataProtocol){case 4:case 5:{if(b&1&&b&2)throw new Error("Opening file ".concat(M.fileName," failed: cannot open file with both read and write flags set"));if(b&32)throw new Error("Opening file ".concat(M.fileName," failed: appending to HTTP/S3 files is not supported"));if(b&2){let ie=new XMLHttpRequest;if(M.dataProtocol==5?(ie.open("HEAD",er(M.s3Config,M.dataUrl),!1),Ze(ie,M.s3Config,M.dataUrl,"HEAD")):ie.open("HEAD",M.dataUrl,!1),ie.send(null),ie.status!=200&&ie.status!=404)throw new Error("Opening file ".concat(M.fileName," failed: Unexpected return status from server (").concat(ie.status,")"));if(ie.status==404&&!(b&8||b&16))throw new Error("Opening file ".concat(M.fileName," failed: Cannot write to non-existent file without FILE_FLAGS_FILE_CREATE or FILE_FLAGS_FILE_CREATE_NEW flag."));let V=w._malloc(1),je=new Uint8Array;w.HEAPU8.set(je,V);let oe=w._malloc(3*8);return w.HEAPF64[(oe>>3)+0]=1,w.HEAPF64[(oe>>3)+1]=V,w.HEAPF64[(oe>>3)+2]=new Date().getTime()/1e3,oe}else if(!(b&1))throw new Error("Opening file ".concat(M.fileName," failed: unsupported file flags: ").concat(b));let O=null,Q=null;if(!M.forceFullHttpReads&&(M.reliableHeadRequests||!M.allowFullHttpReads))try{let ie=new XMLHttpRequest;M.dataProtocol==5?(ie.open("HEAD",er(M.s3Config,M.dataUrl),!1),Ze(ie,M.s3Config,M.dataUrl,"HEAD")):ie.open("HEAD",M.dataUrl,!1),ie.setRequestHeader("Range","bytes=0-"),ie.send(null),O=null;try{O=ie.getResponseHeader("Content-Length")}catch(V){console.warn("Failed to get Content-Length on request")}if(O!==null&&ie.status==206){let V=w._malloc(24);w.HEAPF64[(V>>3)+0]=+O,w.HEAPF64[(V>>3)+1]=0;let je=0;try{je=new Date((g=ie.getResponseHeader("Last-Modified"))!=null?g:"").getTime()/1e3}catch(oe){console.warn("Failed to get Last-Modified on request")}return w.HEAPF64[(V>>3)+2]=+je,V}}catch(ie){Q=ie,console.warn("HEAD request with range header failed: ".concat(ie))}if(M.allowFullHttpReads){if(!M.forceFullHttpReads){let V=new XMLHttpRequest;M.dataProtocol==5?(V.open("GET",er(M.s3Config,M.dataUrl),!1),Ze(V,M.s3Config,M.dataUrl,"GET")):V.open("GET",M.dataUrl,!1),V.responseType="arraybuffer",V.setRequestHeader("Range","bytes=0-0"),V.send(null);let je=null;try{je=V.getResponseHeader("Content-Length")}catch(ye){console.warn("Failed to get Content-Length on request")}let oe=je==null?void 0:je.split("/")[1],Se=je,De=null;if(oe!==void 0)De=oe;else if(!M.reliableHeadRequests){let ye=new XMLHttpRequest;M.dataProtocol==5?(ye.open("HEAD",er(M.s3Config,M.dataUrl),!1),Ze(ye,M.s3Config,M.dataUrl,"HEAD")):ye.open("HEAD",M.dataUrl,!1),ye.setRequestHeader("Range","bytes=0-"),ye.send(null),O=null;try{O=ye.getResponseHeader("Content-Length")}catch(we){console.warn("Failed to get Content-Length on request")}O!==null&&+O>1&&(De=O)}if(V.status==206&&Se!==null&&+Se==1&&De!==null){let ye=w._malloc(24);w.HEAPF64[(ye>>3)+0]=+De,w.HEAPF64[(ye>>3)+1]=0;let we=0;try{we=new Date((l=V.getResponseHeader("Last-Modified"))!=null?l:"").getTime()/1e3}catch(Ie){console.warn("Failed to get Last-Modified on request")}return w.HEAPF64[(ye>>3)+2]=+we,ye}if(V.status==200&&Se!==null&&O!==null&&+Se==+O){console.warn("fall back to full HTTP read for: ".concat(M.dataUrl));let ye=w._malloc(V.response.byteLength),we=new Uint8Array(V.response,0,V.response.byteLength);w.HEAPU8.set(we,ye);let Ie=w._malloc(3*8);w.HEAPF64[(Ie>>3)+0]=V.response.byteLength,w.HEAPF64[(Ie>>3)+1]=ye;let Fe=0;try{Fe=new Date((E=V.getResponseHeader("Last-Modified"))!=null?E:"").getTime()/1e3}catch(x){console.warn("Failed to get Last-Modified on request")}return w.HEAPF64[(Ie>>3)+2]=+Fe,Ie}console.warn("falling back to full HTTP read for: ".concat(M.dataUrl))}let ie=new XMLHttpRequest;if(M.dataProtocol==5?(ie.open("GET",er(M.s3Config,M.dataUrl),!1),Ze(ie,M.s3Config,M.dataUrl,"GET")):ie.open("GET",M.dataUrl,!1),ie.responseType="arraybuffer",ie.send(null),ie.status==200){let V=w._malloc(ie.response.byteLength),je=new Uint8Array(ie.response,0,ie.response.byteLength);w.HEAPU8.set(je,V);let oe=w._malloc(3*8);w.HEAPF64[(oe>>3)+0]=ie.response.byteLength,w.HEAPF64[(oe>>3)+1]=V;let Se=0;try{Se=new Date((T=ie.getResponseHeader("Last-Modified"))!=null?T:"").getTime()/1e3}catch(De){console.warn("Failed to get Last-Modified on request")}return w.HEAPF64[(oe>>3)+2]=+Se,oe}}if(Q!=null)throw new Error("Reading file ".concat(M.fileName," failed with error: ").concat(Q));return 0}case 2:{let O=(S=se._files)==null?void 0:S.get(M.fileName);if(O){let V=w._malloc(24);return w.HEAPF64[(V>>3)+0]=O.size,w.HEAPF64[(V>>3)+1]=0,w.HEAPF64[(V>>3)+2]=0,V}if(b&128)return 0;console.warn("Buffering missing file: ".concat(M.fileName));let Q=w._malloc(3*8),ie=w._malloc(1);return w.HEAPF64[(Q>>3)+0]=1,w.HEAPF64[(Q>>3)+1]=ie,w.HEAPF64[(Q>>3)+2]=0,Q}case 3:{let O=(A=se._files)==null?void 0:A.get(M.fileName);if(!O)throw new Error("No OPFS access handle registered with name: ".concat(M.fileName));b&16&&O.truncate(0);let Q=w._malloc(3*8),ie=O.getSize();return w.HEAPF64[(Q>>3)+0]=ie,w.HEAPF64[(Q>>3)+1]=0,w.HEAPF64[(Q>>3)+2]=0,Q}}}catch(M){console.error(M.toString()),ze(w,M.toString())}return 0},glob:(w,d,b)=>{var g;try{let l=fe(w,d,b);if(l.startsWith("http")||l.startsWith("s3://")){let E=new XMLHttpRequest;if(l.startsWith("s3://")){let T=se.getGlobalFileInfo(w);E.open("HEAD",er(T==null?void 0:T.s3Config,l),!1),Ze(E,T==null?void 0:T.s3Config,l,"HEAD")}else E.open("HEAD",l,!1);if(E.send(null),E.status!=200&&E.status!==206){if(!((g=se.getGlobalFileInfo(w))!=null&&g.allowFullHttpReads))return console.log("HEAD request failed: ".concat(l,", with full http reads are disabled")),0;let T=new XMLHttpRequest;if(l.startsWith("s3://")){let A=se.getGlobalFileInfo(w);T.open("GET",er(A==null?void 0:A.s3Config,l),!1),Ze(T,A==null?void 0:A.s3Config,l,"HEAD")}else T.open("GET",l,!1);if(T.setRequestHeader("Range","bytes=0-0"),T.send(null),T.status!=200&&T.status!==206)return console.log("HEAD and GET requests failed: ".concat(l)),0;let S=null;try{S=T.getResponseHeader("Content-Length")}catch(A){console.warn("Failed to get Content-Length on request")}S&&+S>1&&console.warn("Range request for ".concat(l," did not return a partial response: ").concat(T.status,' "').concat(T.statusText,'"'))}w.ccall("duckdb_web_fs_glob_add_path",null,["string"],[l])}else for(let[E]of se._files.entries()||[])E.startsWith(l)&&w.ccall("duckdb_web_fs_glob_add_path",null,["string"],[E])}catch(l){return console.log(l),ze(w,l.toString()),0}},checkFile:(w,d,b)=>{try{let g=fe(w,d,b);if(g.startsWith("http")||g.startsWith("s3://")){let l=new XMLHttpRequest;if(g.startsWith("s3://")){let E=se.getGlobalFileInfo(w);l.open("HEAD",er(E==null?void 0:E.s3Config,g),!1),Ze(l,E==null?void 0:E.s3Config,g,"HEAD")}else l.open("HEAD",g,!1);return l.send(null),l.status==206||l.status==200}else return se._files.has(g)}catch(g){return console.log(g),!1}return!1},syncFile:(w,d)=>{},closeFile:(w,d)=>{var g;let b=se.getFileInfo(w,d);se._fileInfoCache.delete(d);try{switch(b==null?void 0:b.dataProtocol){case 0:case 4:case 5:break;case 1:case 2:return;case 3:{let l=(g=se._files)==null?void 0:g.get(b.fileName);if(!l)throw new Error("No OPFS access handle registered with name: ".concat(b.fileName));return l.flush()}}}catch(l){console.log(l),ze(w,l.toString())}},dropFile:(w,d,b)=>{var E;let g=fe(w,d,b),l=(E=se._files)==null?void 0:E.get(g);if(l){if(se._files.delete(g),l instanceof FileSystemSyncAccessHandle)try{l.flush(),l.close()}catch(T){throw new Error("Cannot drop file with name: ".concat(g))}l instanceof Blob}},truncateFile:(w,d,b)=>{var l;let g=se.getFileInfo(w,d);switch(g==null?void 0:g.dataProtocol){case 4:ze(w,"Cannot truncate a http file");return;case 5:ze(w,"Cannot truncate an s3 file");return;case 0:case 1:case 2:ze(w,"truncateFile not implemented");return;case 3:{let E=(l=se._files)==null?void 0:l.get(g.fileName);if(!E)throw new Error("No OPFS access handle registered with name: ".concat(g.fileName));return E.truncate(b)}}return 0},readFile(w,d,b,g,l){var E;if(g==0)return 0;try{let T=se.getFileInfo(w,d);switch(T==null?void 0:T.dataProtocol){case 4:case 5:{if(!T.dataUrl)throw new Error("Missing data URL for file ".concat(d));try{let S=new XMLHttpRequest;if(T.dataProtocol==5?(S.open("GET",er(T==null?void 0:T.s3Config,T.dataUrl),!1),Ze(S,T==null?void 0:T.s3Config,T.dataUrl,"GET")):S.open("GET",T.dataUrl,!1),S.responseType="arraybuffer",S.setRequestHeader("Range","bytes=".concat(l,"-").concat(l+g-1)),S.send(null),S.status==206||S.status==200&&g==S.response.byteLength&&l==0){let A=new Uint8Array(S.response,0,Math.min(S.response.byteLength,g));return w.HEAPU8.set(A,b),A.byteLength}else if(S.status==200){console.warn("Range request for ".concat(T.dataUrl," did not return a partial response: ").concat(S.status,' "').concat(S.statusText,'"'));let A=new Uint8Array(S.response,l,Math.min(S.response.byteLength-l,g));return w.HEAPU8.set(A,b),A.byteLength}else throw new Error("Range request for ".concat(T.dataUrl," did returned non-success status: ").concat(S.status,' "').concat(S.statusText,'"'))}catch(S){throw console.log(S),new Error("Range request for ".concat(T.dataUrl," failed with error: ").concat(S,'"'))}}case 2:{let S=(E=se._files)==null?void 0:E.get(T.fileName);if(!S)throw new Error("No HTML5 file registered with name: ".concat(T.fileName));let A=S.slice(l,l+g),M=new Uint8Array(new FileReaderSync().readAsArrayBuffer(A));return w.HEAPU8.set(M,b),M.byteLength}case 3:{let S=se._files.get(T.fileName);if(!S)throw new Error("No OPFS access handle registered with name: ".concat(T.fileName));let A=w.HEAPU8.subarray(b,b+g);return S.read(A,{at:l})}}return 0}catch(T){return console.log(T),ze(w,T.toString()),0}},writeFile:(w,d,b,g,l)=>{var T;let E=se.getFileInfo(w,d);switch(E==null?void 0:E.dataProtocol){case 4:return ze(w,"Cannot write to HTTP file"),0;case 5:{let S=w.HEAPU8.subarray(b,b+g),A=new XMLHttpRequest;return A.open("PUT",er(E==null?void 0:E.s3Config,E.dataUrl),!1),Ze(A,E==null?void 0:E.s3Config,E.dataUrl,"PUT","",S),A.send(S),A.status!==200?(ze(w,"Failed writing file: HTTP "+A.status),0):g}case 2:return ze(w,"cannot write using the html5 file reader api"),0;case 3:{let S=(T=se._files)==null?void 0:T.get(E.fileName);if(!S)throw new Error("No OPFS access handle registered with name: ".concat(E.fileName));let A=w.HEAPU8.subarray(b,b+g);return S.write(A,{at:l})}}return 0},getLastFileModificationTime:(w,d)=>{var g;let b=se.getFileInfo(w,d);switch(b==null?void 0:b.dataProtocol){case 2:{if(!((g=se._files)==null?void 0:g.get(b.fileName)))throw Error("No handle available for file: ".concat(b.fileName));return 0}case 4:case 5:return new Date().getTime()/1e3}return 0},progressUpdate:(w,d,b)=>{postMessage&&postMessage({requestId:0,type:"PROGRESS_UPDATE",data:{status:w?"completed":"in-progress",percentage:d,repetitions:b}})},checkDirectory:(w,d,b)=>{let g=fe(w,d,b);return console.log("checkDirectory: ".concat(g)),!1},createDirectory:(w,d,b)=>{let g=fe(w,d,b);console.log("createDirectory: ".concat(g))},removeDirectory:(w,d,b)=>{let g=fe(w,d,b);console.log("removeDirectory: ".concat(g))},listDirectoryEntries:(w,d,b)=>{let g=fe(w,d,b);return console.log("listDirectoryEntries: ".concat(g)),!1},moveFile:(w,d,b,g,l)=>{var A,M;let E=fe(w,d,b),T=fe(w,g,l),S=(A=se._files)==null?void 0:A.get(E);S!==void 0&&(se._files.delete(S),se._files.set(T,S));for(let[O,Q]of((M=se._fileInfoCache)==null?void 0:M.entries())||[])if(Q.dataUrl==E){se._fileInfoCache.delete(O);break}return!0},removeFile:(w,d,b)=>{},callScalarUDF:(w,d,b,g,l,E,T)=>{Tt(se,w,d,b,g,l,E,T)}};var Ra=vn(Da());var Ar=class extends Rt{constructor(d,b,g,l){super(d,b),this.mainModuleURL=g,this.pthreadWorkerURL=l}locateFile(d,b){if(d.endsWith(".wasm"))return this.mainModuleURL;if(d.endsWith(".worker.js")){if(!this.pthreadWorkerURL)throw new Error("Missing DuckDB worker URL!");return this.pthreadWorkerURL}throw new Error("WASM instantiation requested unexpected file: prefix=".concat(b," path=").concat(d))}instantiateWasm(d,b){globalThis.DUCKDB_RUNTIME=this._runtime;let g=this.onInstantiationProgress;if(WebAssembly.instantiateStreaming)if(typeof TransformStream=="function"){let E=(async()=>{var je;let T=new Request(this.mainModuleURL),S=await fetch(T),A=S.headers.get("content-length"),M=A&&parseInt(A,10)||0,O=new Date,Q={startedAt:O,updatedAt:O,bytesTotal:M||0,bytesLoaded:0},ie={transform(oe,Se){Q.bytesLoaded+=oe.byteLength;let De=new Date;if(De.getTime()-Q.updatedAt.getTime()<20){Q.updatedAt=De,Se.enqueue(oe);return}for(let ye of g)ye(Q);Se.enqueue(oe)}},V=new TransformStream(ie);return new Response((je=S.body)==null?void 0:je.pipeThrough(V),S)})();WebAssembly.instantiateStreaming(E,d).then(T=>{b(T.instance,T.module)})}else{console.warn("instantiating without progress handler since transform streams are unavailable");let l=new Request(this.mainModuleURL);WebAssembly.instantiateStreaming(fetch(l),d).then(E=>{b(E.instance,E.module)})}else if(typeof XMLHttpRequest=="function"){let l=new XMLHttpRequest,E=this.mainModuleURL,T=new Date,S={startedAt:T,updatedAt:T,bytesTotal:0,bytesLoaded:0};l.open("GET",E),l.responseType="arraybuffer",l.onerror=A=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to load WASM: "+A}),new Error(A.toString())},l.onprogress=A=>{S.bytesTotal=A.total,S.bytesLoaded=A.loaded;let M=new Date;if(M.getTime()-S.updatedAt.getTime()<20){S.updatedAt=M;return}for(let O of g)O(S)},l.onload=()=>{WebAssembly.instantiate(l.response,d).then(A=>{b(A.instance,A.module)}).catch(A=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to instantiate WASM: "+A}),new Error(A)})},l.send()}else console.warn("instantiating with manual fetch since streaming instantiation and xhrs are unavailable"),(async()=>{let E=new Request(this.mainModuleURL),S=await(await fetch(E)).arrayBuffer();WebAssembly.instantiate(S,d).then(A=>{b(A.instance,A.module)})})();return[]}};var Ut=class extends Ar{constructor(d,b,g,l=null){super(d,b,g,l)}instantiateImpl(d){return(0,Ra.default)({...d,instantiateWasm:this.instantiateWasm.bind(this),locateFile:this.locateFile.bind(this)})}};var Fa=vn(Sa());var Ht=class extends Ar{constructor(d,b,g,l=null){super(d,b,g,l)}instantiateImpl(d){return(0,Fa.default)({...d,instantiateWasm:this.instantiateWasm.bind(this),locateFile:this.locateFile.bind(this)})}};async function mh(w,d,b){return(await An()).wasmExceptions&&w.eh?new Ht(d,b,w.eh.mainModule):new Ut(d,b,w.mvp.mainModule)}export{se as BROWSER_RUNTIME,la as ConsoleLogger,ca as DEFAULT_RUNTIME,z_ as DuckDBAccessMode,Rt as DuckDBBindingsBase,gt as DuckDBConnection,Et as DuckDBDataProtocol,Q_ as DuckDBFeature,oa as FileFlags,At as FileStatistics,ra as IsArrowBuffer,ta as IsDuckDBWasmRetry,Z_ as JSONTableShape,id as LogEvent,rd as LogLevel,nd as LogOrigin,td as LogTopic,va as PACKAGE_NAME,pa as PACKAGE_VERSION,Id as PACKAGE_VERSION_MAJOR,Bd as PACKAGE_VERSION_MINOR,Nd as PACKAGE_VERSION_PATCH,pn as PreparedStatement,jt as ResultStreamIterator,ea as StatusCode,ed as TokenType,ua as VoidLogger,ke as callSRet,wr as copyBuffer,mh as createDuckDB,Y_ as decodeText,Ee as dropResponseBuffers,ze as failWith,Wd as getJsDelivrBundles,Cd as getLogEventLabel,Rd as getLogLevelLabel,Fd as getLogOriginLabel,Sd as getLogTopicLabel,An as getPlatformFeatures,Ld as isFirefox,wa as isNode,Od as isSafari,fe as readString,qd as selectBundle};
|
|
1
|
+
var Hs=Object.create;var ir=Object.defineProperty;var Ns=Object.getOwnPropertyDescriptor;var Ps=Object.getOwnPropertyNames;var Cs=Object.getPrototypeOf,Ls=Object.prototype.hasOwnProperty;var Os=(s,t,a)=>t in s?ir(s,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):s[t]=a;var Gr=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(t,a)=>(typeof require<"u"?require:t)[a]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var Re=(s,t)=>()=>(t||s((t={exports:{}}).exports,t),t.exports);var Ms=(s,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let e of Ps(t))!Ls.call(s,e)&&e!==a&&ir(s,e,{get:()=>t[e],enumerable:!(i=Ns(t,e))||i.enumerable});return s};var $r=(s,t,a)=>(a=s!=null?Hs(Cs(s)):{},Ms(t||!s||!s.__esModule?ir(a,"default",{value:s,enumerable:!0}):a,s));var Kr=(s,t,a)=>(Os(s,typeof t!="symbol"?t+"":t,a),a);var ft=Re(()=>{});var _t=Re(()=>{});var ht=Re((Ho,Je)=>{(function(){"use strict";var s="input is invalid type",t=typeof window=="object",a=t?window:{};a.JS_SHA256_NO_WINDOW&&(t=!1);var i=!t&&typeof self=="object",e=!a.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node&&process.type!="renderer";e?a=global:i&&(a=self);var c=!a.JS_SHA256_NO_COMMON_JS&&typeof Je=="object"&&Je.exports,l=typeof define=="function"&&define.amd,f=!a.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),E=[-2147483648,8388608,32768,128],D=[24,16,8,0],U=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],P=["hex","array","digest","arrayBuffer"],T=[];(a.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(p){return Object.prototype.toString.call(p)==="[object Array]"}),f&&(a.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(p){return typeof p=="object"&&p.buffer&&p.buffer.constructor===ArrayBuffer});var Z=function(p,F){return function(x){return new X(F,!0).update(x)[p]()}},G=function(p){var F=Z("hex",p);e&&(F=te(F,p)),F.create=function(){return new X(p)},F.update=function(R){return F.create().update(R)};for(var x=0;x<P.length;++x){var v=P[x];F[v]=Z(v,p)}return F},te=function(p,F){var x=ft(),v=_t().Buffer,R=F?"sha224":"sha256",A;v.from&&!a.JS_SHA256_NO_BUFFER_FROM?A=v.from:A=function(w){return new v(w)};var H=function(w){if(typeof w=="string")return x.createHash(R).update(w,"utf8").digest("hex");if(w==null)throw new Error(s);return w.constructor===ArrayBuffer&&(w=new Uint8Array(w)),Array.isArray(w)||ArrayBuffer.isView(w)||w.constructor===v?x.createHash(R).update(A(w)).digest("hex"):p(w)};return H},ne=function(p,F){return function(x,v){return new oe(x,F,!0).update(v)[p]()}},Y=function(p){var F=ne("hex",p);F.create=function(R){return new oe(R,p)},F.update=function(R,A){return F.create(R).update(A)};for(var x=0;x<P.length;++x){var v=P[x];F[v]=ne(v,p)}return F};function X(p,F){F?(T[0]=T[16]=T[1]=T[2]=T[3]=T[4]=T[5]=T[6]=T[7]=T[8]=T[9]=T[10]=T[11]=T[12]=T[13]=T[14]=T[15]=0,this.blocks=T):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],p?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=p}X.prototype.update=function(p){if(!this.finalized){var F,x=typeof p;if(x!=="string"){if(x==="object"){if(p===null)throw new Error(s);if(f&&p.constructor===ArrayBuffer)p=new Uint8Array(p);else if(!Array.isArray(p)&&(!f||!ArrayBuffer.isView(p)))throw new Error(s)}else throw new Error(s);F=!0}for(var v,R=0,A,H=p.length,w=this.blocks;R<H;){if(this.hashed&&(this.hashed=!1,w[0]=this.block,this.block=w[16]=w[1]=w[2]=w[3]=w[4]=w[5]=w[6]=w[7]=w[8]=w[9]=w[10]=w[11]=w[12]=w[13]=w[14]=w[15]=0),F)for(A=this.start;R<H&&A<64;++R)w[A>>>2]|=p[R]<<D[A++&3];else for(A=this.start;R<H&&A<64;++R)v=p.charCodeAt(R),v<128?w[A>>>2]|=v<<D[A++&3]:v<2048?(w[A>>>2]|=(192|v>>>6)<<D[A++&3],w[A>>>2]|=(128|v&63)<<D[A++&3]):v<55296||v>=57344?(w[A>>>2]|=(224|v>>>12)<<D[A++&3],w[A>>>2]|=(128|v>>>6&63)<<D[A++&3],w[A>>>2]|=(128|v&63)<<D[A++&3]):(v=65536+((v&1023)<<10|p.charCodeAt(++R)&1023),w[A>>>2]|=(240|v>>>18)<<D[A++&3],w[A>>>2]|=(128|v>>>12&63)<<D[A++&3],w[A>>>2]|=(128|v>>>6&63)<<D[A++&3],w[A>>>2]|=(128|v&63)<<D[A++&3]);this.lastByteIndex=A,this.bytes+=A-this.start,A>=64?(this.block=w[16],this.start=A-64,this.hash(),this.hashed=!0):this.start=A}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},X.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var p=this.blocks,F=this.lastByteIndex;p[16]=this.block,p[F>>>2]|=E[F&3],this.block=p[16],F>=56&&(this.hashed||this.hash(),p[0]=this.block,p[16]=p[1]=p[2]=p[3]=p[4]=p[5]=p[6]=p[7]=p[8]=p[9]=p[10]=p[11]=p[12]=p[13]=p[14]=p[15]=0),p[14]=this.hBytes<<3|this.bytes>>>29,p[15]=this.bytes<<3,this.hash()}},X.prototype.hash=function(){var p=this.h0,F=this.h1,x=this.h2,v=this.h3,R=this.h4,A=this.h5,H=this.h6,w=this.h7,B=this.blocks,C,S,$,he,K,ce,ue,ve,xe,Be,Ie;for(C=16;C<64;++C)K=B[C-15],S=(K>>>7|K<<25)^(K>>>18|K<<14)^K>>>3,K=B[C-2],$=(K>>>17|K<<15)^(K>>>19|K<<13)^K>>>10,B[C]=B[C-16]+S+B[C-7]+$<<0;for(Ie=F&x,C=0;C<64;C+=4)this.first?(this.is224?(ve=300032,K=B[0]-1413257819,w=K-150054599<<0,v=K+24177077<<0):(ve=704751109,K=B[0]-210244248,w=K-1521486534<<0,v=K+143694565<<0),this.first=!1):(S=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),$=(R>>>6|R<<26)^(R>>>11|R<<21)^(R>>>25|R<<7),ve=p&F,he=ve^p&x^Ie,ue=R&A^~R&H,K=w+$+ue+U[C]+B[C],ce=S+he,w=v+K<<0,v=K+ce<<0),S=(v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10),$=(w>>>6|w<<26)^(w>>>11|w<<21)^(w>>>25|w<<7),xe=v&p,he=xe^v&F^ve,ue=w&R^~w&A,K=H+$+ue+U[C+1]+B[C+1],ce=S+he,H=x+K<<0,x=K+ce<<0,S=(x>>>2|x<<30)^(x>>>13|x<<19)^(x>>>22|x<<10),$=(H>>>6|H<<26)^(H>>>11|H<<21)^(H>>>25|H<<7),Be=x&v,he=Be^x&p^xe,ue=H&w^~H&R,K=A+$+ue+U[C+2]+B[C+2],ce=S+he,A=F+K<<0,F=K+ce<<0,S=(F>>>2|F<<30)^(F>>>13|F<<19)^(F>>>22|F<<10),$=(A>>>6|A<<26)^(A>>>11|A<<21)^(A>>>25|A<<7),Ie=F&x,he=Ie^F&v^Be,ue=A&H^~A&w,K=R+$+ue+U[C+3]+B[C+3],ce=S+he,R=p+K<<0,p=K+ce<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+p<<0,this.h1=this.h1+F<<0,this.h2=this.h2+x<<0,this.h3=this.h3+v<<0,this.h4=this.h4+R<<0,this.h5=this.h5+A<<0,this.h6=this.h6+H<<0,this.h7=this.h7+w<<0},X.prototype.hex=function(){this.finalize();var p=this.h0,F=this.h1,x=this.h2,v=this.h3,R=this.h4,A=this.h5,H=this.h6,w=this.h7,B=u[p>>>28&15]+u[p>>>24&15]+u[p>>>20&15]+u[p>>>16&15]+u[p>>>12&15]+u[p>>>8&15]+u[p>>>4&15]+u[p&15]+u[F>>>28&15]+u[F>>>24&15]+u[F>>>20&15]+u[F>>>16&15]+u[F>>>12&15]+u[F>>>8&15]+u[F>>>4&15]+u[F&15]+u[x>>>28&15]+u[x>>>24&15]+u[x>>>20&15]+u[x>>>16&15]+u[x>>>12&15]+u[x>>>8&15]+u[x>>>4&15]+u[x&15]+u[v>>>28&15]+u[v>>>24&15]+u[v>>>20&15]+u[v>>>16&15]+u[v>>>12&15]+u[v>>>8&15]+u[v>>>4&15]+u[v&15]+u[R>>>28&15]+u[R>>>24&15]+u[R>>>20&15]+u[R>>>16&15]+u[R>>>12&15]+u[R>>>8&15]+u[R>>>4&15]+u[R&15]+u[A>>>28&15]+u[A>>>24&15]+u[A>>>20&15]+u[A>>>16&15]+u[A>>>12&15]+u[A>>>8&15]+u[A>>>4&15]+u[A&15]+u[H>>>28&15]+u[H>>>24&15]+u[H>>>20&15]+u[H>>>16&15]+u[H>>>12&15]+u[H>>>8&15]+u[H>>>4&15]+u[H&15];return this.is224||(B+=u[w>>>28&15]+u[w>>>24&15]+u[w>>>20&15]+u[w>>>16&15]+u[w>>>12&15]+u[w>>>8&15]+u[w>>>4&15]+u[w&15]),B},X.prototype.toString=X.prototype.hex,X.prototype.digest=function(){this.finalize();var p=this.h0,F=this.h1,x=this.h2,v=this.h3,R=this.h4,A=this.h5,H=this.h6,w=this.h7,B=[p>>>24&255,p>>>16&255,p>>>8&255,p&255,F>>>24&255,F>>>16&255,F>>>8&255,F&255,x>>>24&255,x>>>16&255,x>>>8&255,x&255,v>>>24&255,v>>>16&255,v>>>8&255,v&255,R>>>24&255,R>>>16&255,R>>>8&255,R&255,A>>>24&255,A>>>16&255,A>>>8&255,A&255,H>>>24&255,H>>>16&255,H>>>8&255,H&255];return this.is224||B.push(w>>>24&255,w>>>16&255,w>>>8&255,w&255),B},X.prototype.array=X.prototype.digest,X.prototype.arrayBuffer=function(){this.finalize();var p=new ArrayBuffer(this.is224?28:32),F=new DataView(p);return F.setUint32(0,this.h0),F.setUint32(4,this.h1),F.setUint32(8,this.h2),F.setUint32(12,this.h3),F.setUint32(16,this.h4),F.setUint32(20,this.h5),F.setUint32(24,this.h6),this.is224||F.setUint32(28,this.h7),p};function oe(p,F,x){var v,R=typeof p;if(R==="string"){var A=[],H=p.length,w=0,B;for(v=0;v<H;++v)B=p.charCodeAt(v),B<128?A[w++]=B:B<2048?(A[w++]=192|B>>>6,A[w++]=128|B&63):B<55296||B>=57344?(A[w++]=224|B>>>12,A[w++]=128|B>>>6&63,A[w++]=128|B&63):(B=65536+((B&1023)<<10|p.charCodeAt(++v)&1023),A[w++]=240|B>>>18,A[w++]=128|B>>>12&63,A[w++]=128|B>>>6&63,A[w++]=128|B&63);p=A}else if(R==="object"){if(p===null)throw new Error(s);if(f&&p.constructor===ArrayBuffer)p=new Uint8Array(p);else if(!Array.isArray(p)&&(!f||!ArrayBuffer.isView(p)))throw new Error(s)}else throw new Error(s);p.length>64&&(p=new X(F,!0).update(p).array());var C=[],S=[];for(v=0;v<64;++v){var $=p[v]||0;C[v]=92^$,S[v]=54^$}X.call(this,F,x),this.update(S),this.oKeyPad=C,this.inner=!0,this.sharedMemory=x}oe.prototype=new X,oe.prototype.finalize=function(){if(X.prototype.finalize.call(this),this.inner){this.inner=!1;var p=this.array();X.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(p),X.prototype.finalize.call(this)}};var se=G();se.sha256=se,se.sha224=G(!0),se.sha256.hmac=Y(),se.sha224.hmac=Y(!0),c?Je.exports=se:(a.sha256=se.sha256,a.sha224=se.sha224,l&&define(function(){return se}))})()});var yt=Re(()=>{});var wt=Re(()=>{});var Et=Re((vt,Qe)=>{"use strict";var gr=(()=>{var t;var s=typeof document<"u"?(t=document.currentScript)==null?void 0:t.src:void 0;return typeof __filename<"u"&&(s=s||__filename),async function(a={}){var i,e=a,c,l,f=new Promise((r,n)=>{c=r,l=n}),u=typeof window=="object",E=typeof WorkerGlobalScope<"u",D=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer",U=Object.assign({},e),P=[],T="./this.program",Z=(r,n)=>{throw n},G="";function te(r){return e.locateFile?e.locateFile(r,G):G+r}var ne,Y;if(D){var X=yt(),oe=wt();G=__dirname+"/",Y=r=>{r=ue(r)?new URL(r):r;var n=X.readFileSync(r);return n},ne=async(r,n=!0)=>{r=ue(r)?new URL(r):r;var o=X.readFileSync(r,n?void 0:"utf8");return o},!e.thisProgram&&process.argv.length>1&&(T=process.argv[1].replace(/\\/g,"/")),P=process.argv.slice(2),Z=(r,n)=>{throw process.exitCode=r,n}}else(u||E)&&(E?G=self.location.href:typeof document<"u"&&document.currentScript&&(G=document.currentScript.src),s&&(G=s),G.startsWith("blob:")?G="":G=G.slice(0,G.replace(/[?#].*/,"").lastIndexOf("/")+1),E&&(Y=r=>{var n=new XMLHttpRequest;return n.open("GET",r,!1),n.responseType="arraybuffer",n.send(null),new Uint8Array(n.response)}),ne=async r=>{var n=await fetch(r,{credentials:"same-origin"});if(n.ok)return n.arrayBuffer();throw new Error(n.status+" : "+n.url)});var se=e.print||console.log.bind(console),p=e.printErr||console.error.bind(console);Object.assign(e,U),U=null,e.arguments&&(P=e.arguments),e.thisProgram&&(T=e.thisProgram);var F=e.wasmBinary,x,v=!1,R;function A(r,n){r||be(n)}var H,w,B,C,S,$,he,K,ce=!1,ue=r=>r.startsWith("file://");function ve(){var r=x.buffer;e.HEAP8=H=new Int8Array(r),e.HEAP16=B=new Int16Array(r),e.HEAPU8=w=new Uint8Array(r),e.HEAPU16=C=new Uint16Array(r),e.HEAP32=S=new Int32Array(r),e.HEAPU32=$=new Uint32Array(r),e.HEAPF32=he=new Float32Array(r),e.HEAPF64=K=new Float64Array(r)}function xe(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)Pt(e.preRun.shift());wr(Er)}function Be(){ce=!0,I.wa()}function Ie(){}function Dt(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)Nt(e.postRun.shift());wr(vr)}var Fe=0,He=null;function St(r){var n;Fe++,(n=e.monitorRunDependencies)==null||n.call(e,Fe)}function Ft(r){var o;if(Fe--,(o=e.monitorRunDependencies)==null||o.call(e,Fe),Fe==0&&He){var n=He;He=null,n()}}function be(r){var o;(o=e.onAbort)==null||o.call(e,r),r="Aborted("+r+")",p(r),v=!0,r+=". Build with -sASSERTIONS for more info.",ce&&___trap();var n=new WebAssembly.RuntimeError(r);throw l(n),n}var Ne;function kt(){return te("./duckdb-eh.wasm")}function Rt(r){if(r==Ne&&F)return new Uint8Array(F);if(Y)return Y(r);throw"both async and sync fetching of the wasm failed"}async function Tt(r){if(!F)try{var n=await ne(r);return new Uint8Array(n)}catch(o){}return Rt(r)}async function Ut(r,n){try{var o=await Tt(r),d=await WebAssembly.instantiate(o,n);return d}catch(_){p("failed to asynchronously prepare wasm: ".concat(_)),be(_)}}async function xt(r,n,o){if(!r&&typeof WebAssembly.instantiateStreaming=="function"&&!D)try{var d=fetch(n,{credentials:"same-origin"}),_=await WebAssembly.instantiateStreaming(d,o);return _}catch(b){p("wasm streaming compile failed: ".concat(b)),p("falling back to ArrayBuffer instantiation")}return Ut(n,o)}function Bt(){return{a:Ss}}async function It(){function r(b,y){return I=b.exports,I=Bs(I),x=I.va,ve(),Ft("wasm-instantiate"),I}St("wasm-instantiate");function n(b){return r(b.instance)}var o=Bt();if(e.instantiateWasm)return new Promise((b,y)=>{e.instantiateWasm(o,(g,k)=>{r(g,k),b(g.exports)})});Ne!=null||(Ne=kt());try{var d=await xt(F,Ne,o),_=n(d);return _}catch(b){return l(b),Promise.reject(b)}}var ae,ye,Ht={10215180:(r,n,o,d)=>{var _=J(r);if(typeof XMLHttpRequest>"u")return 0;let b=new XMLHttpRequest;b.open(J(d),_,!1),b.responseType="arraybuffer";for(var y=0,h=n;y<h*2;){var g=S[o/4+y>>>0],k=S[o/4+y+1>>>0];try{var N=encodeURI(J(g));N==="Host"&&(N="X-Host-Override"),N==="User-Agent"||(N==="Authorization"?b.setRequestHeader(N,J(k)):b.setRequestHeader(N,encodeURI(J(k))))}catch(z){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",z)}y+=2}try{b.send(null)}catch(z){return 0}if(b.status>=400)return 0;for(var W=b.response,h=W.byteLength,j=we(h+8),V=new Uint8Array(W),O=0;O<h;O++)e.HEAPU8[O+j+8]=V[O];var m=new Uint8Array(4);m[0]=h%256,h-=m[0],h/=256,m[1]=h%256,h-=m[1],h/=256,m[2]=h%256,h-=m[2],h/=256,m[3]=h%256,h-=m[3],h/=256,e.HEAPU8.set(m,j+4);var re=Uint8Array.from(Array.from(b.getAllResponseHeaders()).map(z=>z.charCodeAt(0)));h=re.byteLength;for(var ie=we(h+8),O=0;O<h;O++)e.HEAPU8[O+ie+8]=re[O];return m=new Uint8Array(4),m[0]=h%256,h-=m[0],h/=256,m[1]=h%256,h-=m[1],h/=256,m[2]=h%256,h-=m[2],h/=256,m[3]=h%256,h-=m[3],h/=256,e.HEAPU8.set(m,ie+4),h=ie,m=new Uint8Array(4),m[0]=h%256,h-=m[0],h/=256,m[1]=h%256,h-=m[1],h/=256,m[2]=h%256,h-=m[2],h/=256,m[3]=h%256,h-=m[3],h/=256,e.HEAPU8.set(m,j),j},10217452:(r,n,o,d,_,b)=>{var y=J(r);if(typeof XMLHttpRequest>"u")return 0;let g=new XMLHttpRequest;g.open(J(d),y,!1),g.responseType="arraybuffer";for(var k=0,m=n;k<m*2;){var N=S[o/4+k>>>0],W=S[o/4+k+1>>>0];try{var h=encodeURI(J(N));h==="Host"&&(h="X-Host-Override"),h==="User-Agent"||(h==="Authorization"?g.setRequestHeader(h,J(W)):g.setRequestHeader(h,encodeURI(J(W))))}catch(pe){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",pe)}k+=2}try{for(var j=new Uint8Array(b),V=0;V<b;V++)j[V]=e.HEAPU8[V+_];g.send(j)}catch(pe){return 0}if(g.status>=400)return 0;for(var O=Uint8Array.from(Array.from(g.getResponseHeader("Etag")).map(pe=>pe.charCodeAt(0))),m=O.byteLength,re=we(m+4),ie=new Uint8Array(O),V=0;V<m;V++)e.HEAPU8[V+re+4]=ie[V];var z=new Uint8Array(4);return z[0]=m%256,m-=z[0],m/=256,z[1]=m%256,m-=z[1],m/=256,z[2]=m%256,m-=z[2],m/=256,z[3]=m%256,m-=z[3],m/=256,e.HEAPU8.set(z,re),re},10219060:(r,n,o,d)=>{var _=J(r);if(typeof XMLHttpRequest>"u")return 0;let b=new XMLHttpRequest;b.open(J(d),_,!1),b.responseType="arraybuffer";for(var y=0,h=n;y<h*2;){var g=S[o/4+y>>>0],k=S[o/4+y+1>>>0];console.log("HEAD",J(g),J(k));try{var N=encodeURI(J(g));N==="Host"&&(N="X-Host-Override"),N==="User-Agent"||(N==="Authorization"?b.setRequestHeader(N,J(k)):b.setRequestHeader(N,encodeURI(J(k))))}catch(z){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",z)}y+=2}try{b.send(null)}catch(z){return 0}if(b.status>=400)return 0;for(var W=b.response,h=W.byteLength,j=we(h+8),V=new Uint8Array(W),O=0;O<h;O++)e.HEAPU8[O+j+8]=V[O];var m=new Uint8Array(4);m[0]=h%256,h-=m[0],h/=256,m[1]=h%256,h-=m[1],h/=256,m[2]=h%256,h-=m[2],h/=256,m[3]=h%256,h-=m[3],h/=256,e.HEAPU8.set(m,j+4);var re=Uint8Array.from(Array.from(b.getAllResponseHeaders()).map(z=>z.charCodeAt(0)));h=re.byteLength;for(var ie=we(h+8),O=0;O<h;O++)e.HEAPU8[O+ie+8]=re[O];return m=new Uint8Array(4),m[0]=h%256,h-=m[0],h/=256,m[1]=h%256,h-=m[1],h/=256,m[2]=h%256,h-=m[2],h/=256,m[3]=h%256,h-=m[3],h/=256,e.HEAPU8.set(m,ie+4),h=ie,m=new Uint8Array(4),m[0]=h%256,h-=m[0],h/=256,m[1]=h%256,h-=m[1],h/=256,m[2]=h%256,h-=m[2],h/=256,m[3]=h%256,h-=m[3],h/=256,e.HEAPU8.set(m,j),j},10221393:(r,n,o,d)=>{var _=J(r);if(typeof XMLHttpRequest>"u")return 0;let b=new XMLHttpRequest;b.open(J(d),_,!1),b.responseType="arraybuffer";for(var y=0,h=n;y<h*2;){var g=S[o/4+y>>>0],k=S[o/4+y+1>>>0];try{var N=encodeURI(J(g));N==="Host"&&(N="X-Host-Override"),N==="User-Agent"||(N==="Authorization"?b.setRequestHeader(N,J(k)):b.setRequestHeader(N,encodeURI(J(k))))}catch(re){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",re)}y+=2}try{b.send(null)}catch(re){return 0}if(b.status>=400)return 0;for(var W=b.response,h=W.byteLength,j=we(h+4),V=new Uint8Array(W),O=0;O<h;O++)e.HEAPU8[O+j+4]=V[O];var m=new Uint8Array(4);return m[0]=h%256,h-=m[0],h/=256,m[1]=h%256,h-=m[1],h/=256,m[2]=h%256,h-=m[2],h/=256,m[3]=h%256,h-=m[3],h/=256,e.HEAPU8.set(m,j),j},10222788:(r,n,o,d,_,b)=>{var y=J(r);if(typeof XMLHttpRequest>"u")return 0;let g=new XMLHttpRequest;g.open(J(d),y,!1),g.responseType="arraybuffer";for(var k=0,m=n;k<m*2;){var N=S[o/4+k>>>0],W=S[o/4+k+1>>>0];try{var h=encodeURI(J(N));h==="Host"&&(h="X-Host-Override"),h==="User-Agent"||(h==="Authorization"?g.setRequestHeader(h,J(W)):g.setRequestHeader(h,encodeURI(J(W))))}catch(pe){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",pe)}k+=2}try{for(var j=new Uint8Array(b),V=0;V<b;V++)j[V]=e.HEAPU8[V+_];g.send(j)}catch(pe){return 0}if(g.status>=400)return 0;for(var O=g.response,m=O.byteLength,re=we(m+4),ie=new Uint8Array(O),V=0;V<m;V++)e.HEAPU8[V+re+4]=ie[V];var z=new Uint8Array(4);return z[0]=m%256,m-=z[0],m/=256,z[1]=m%256,m-=z[1],m/=256,z[2]=m%256,m-=z[2],m/=256,z[3]=m%256,m-=z[3],m/=256,e.HEAPU8.set(z,re),re}};class yr{constructor(n){Kr(this,"name","ExitStatus");this.message="Program terminated with exit(".concat(n,")"),this.status=n}}var wr=r=>{for(;r.length>0;)r.shift()(e)},vr=[],Nt=r=>vr.unshift(r),Er=[],Pt=r=>Er.unshift(r),Ct=e.noExitRuntime||!0;function Ar(){be("missing function: $SOCKFS")}Ar.stub=!0;function er(){be("missing function: $FS")}er.stub=!0;var Ee=r=>{var n=Ar.getSocket(r);if(!n)throw new er.ErrnoError(8);return n},Le=r=>{for(var n=r.split("."),o=0;o<4;o++){var d=Number(n[o]);if(isNaN(d))return null;n[o]=d}return(n[0]|n[1]<<8|n[2]<<16|n[3]<<24)>>>0},Oe=r=>parseInt(r),rr=r=>{var n,o,d,_,b=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i,y=[];if(!b.test(r))return null;if(r==="::")return[0,0,0,0,0,0,0,0];for(r.startsWith("::")?r=r.replace("::","Z:"):r=r.replace("::",":Z:"),r.indexOf(".")>0?(r=r.replace(new RegExp("[.]","g"),":"),n=r.split(":"),n[n.length-4]=Oe(n[n.length-4])+Oe(n[n.length-3])*256,n[n.length-3]=Oe(n[n.length-2])+Oe(n[n.length-1])*256,n=n.slice(0,n.length-2)):n=r.split(":"),d=0,_=0,o=0;o<n.length;o++)if(typeof n[o]=="string")if(n[o]==="Z"){for(_=0;_<8-n.length+1;_++)y[o+_]=0;d=_-1}else y[o+d]=_htons(parseInt(n[o],16));else y[o+d]=n[o];return[y[1]<<16|y[0],y[3]<<16|y[2],y[5]<<16|y[4],y[7]<<16|y[6]]},Dr=(r,n)=>{w.fill(0,r,r+n)},Pe=(r,n,o,d,_)=>{switch(n){case 2:o=Le(o),Dr(r,16),_&&(S[_>>>2>>>0]=16),B[r>>>1>>>0]=n,S[r+4>>>2>>>0]=o,B[r+2>>>1>>>0]=_htons(d);break;case 10:o=rr(o),Dr(r,28),_&&(S[_>>>2>>>0]=28),S[r>>>2>>>0]=n,S[r+8>>>2>>>0]=o[0],S[r+12>>>2>>>0]=o[1],S[r+16>>>2>>>0]=o[2],S[r+20>>>2>>>0]=o[3],B[r+2>>>1>>>0]=_htons(d);break;default:return 5}return 0},le={address_map:{id:1,addrs:{},names:{}},lookup_name(r){var n=Le(r);if(n!==null||(n=rr(r),n!==null))return r;var o;if(le.address_map.addrs[r])o=le.address_map.addrs[r];else{var d=le.address_map.id++;A(d<65535,"exceeded max address mappings of 65535"),o="172.29."+(d&255)+"."+(d&65280),le.address_map.names[o]=r,le.address_map.addrs[r]=o}return o},lookup_addr(r){return le.address_map.names[r]?le.address_map.names[r]:null}},Ae=(r,n)=>n+2097152>>>0<4194305-!!r?(r>>>0)+n*4294967296:NaN;function Lt(r,n,o,d,_,b){n>>>=0,o>>>=0;var y=Ee(r),g=y.sock_ops.accept(y);if(n)var k=Pe(n,g.family,le.lookup_name(g.daddr),g.dport,o);return g.stream.fd}var tr=r=>(r&255)+"."+(r>>8&255)+"."+(r>>16&255)+"."+(r>>24&255),Sr=r=>{var n="",o=0,d=0,_=0,b=0,y=0,g=0,k=[r[0]&65535,r[0]>>16,r[1]&65535,r[1]>>16,r[2]&65535,r[2]>>16,r[3]&65535,r[3]>>16],N=!0,W="";for(g=0;g<5;g++)if(k[g]!==0){N=!1;break}if(N){if(W=tr(k[6]|k[7]<<16),k[5]===-1)return n="::ffff:",n+=W,n;if(k[5]===0)return n="::",W==="0.0.0.0"&&(W=""),W==="0.0.0.1"&&(W="1"),n+=W,n}for(o=0;o<8;o++)k[o]===0&&(o-_>1&&(y=0),_=o,y++),y>d&&(d=y,b=o-d+1);for(o=0;o<8;o++){if(d>1&&k[o]===0&&o>=b&&o<b+d){o===b&&(n+=":",b===0&&(n+=":"));continue}n+=Number(_ntohs(k[o]&65535)).toString(16),n+=o<7?":":""}return n},Fr=(r,n)=>{var o=B[r>>>1>>>0],d=_ntohs(C[r+2>>>1>>>0]),_;switch(o){case 2:if(n!==16)return{errno:28};_=S[r+4>>>2>>>0],_=tr(_);break;case 10:if(n!==28)return{errno:28};_=[S[r+8>>>2>>>0],S[r+12>>>2>>>0],S[r+16>>>2>>>0],S[r+20>>>2>>>0]],_=Sr(_);break;default:return{errno:5}}return{family:o,addr:_,port:d}},kr=(r,n)=>{var o=Fr(r,n);if(o.errno)throw new er.ErrnoError(o.errno);return o.addr=le.lookup_addr(o.addr)||o.addr,o};function Ot(r,n,o,d,_,b){n>>>=0,o>>>=0;var y=Ee(r),g=kr(n,o);return y.sock_ops.bind(y,g.addr,g.port),0}function Mt(r,n,o,d,_,b){n>>>=0,o>>>=0;var y=Ee(r),g=kr(n,o);return y.sock_ops.connect(y,g.addr,g.port),0}var Wt=(r,n,o)=>{};function qt(r,n,o,d){n>>>=0}var Rr=typeof TextDecoder<"u"?new TextDecoder:void 0,Tr=(r,n=0,o=NaN)=>{n>>>=0;for(var d=n+o,_=n;r[_]&&!(_>=d);)++_;if(_-n>16&&r.buffer&&Rr)return Rr.decode(r.subarray(n,_));for(var b="";n<_;){var y=r[n++];if(!(y&128)){b+=String.fromCharCode(y);continue}var g=r[n++]&63;if((y&224)==192){b+=String.fromCharCode((y&31)<<6|g);continue}var k=r[n++]&63;if((y&240)==224?y=(y&15)<<12|g<<6|k:y=(y&7)<<18|g<<12|k<<6|r[n++]&63,y<65536)b+=String.fromCharCode(y);else{var N=y-65536;b+=String.fromCharCode(55296|N>>10,56320|N&1023)}}return b},J=(r,n)=>(r>>>=0,r?Tr(w,r,n):""),nr={varargs:void 0,getStr(r){var n=J(r);return n}};function jt(r,n,o){return o>>>=0,nr.varargs=o,0}function Gt(r,n){n>>>=0}function $t(r,n,o){var d=Ae(n,o)}var Ur=r=>{for(var n=0,o=0;o<r.length;++o){var d=r.charCodeAt(o);d<=127?n++:d<=2047?n+=2:d>=55296&&d<=57343?(n+=4,++o):n+=3}return n};e.lengthBytesUTF8=Ur;var Kt=(r,n,o,d)=>{if(o>>>=0,!(d>0))return 0;for(var _=o,b=o+d-1,y=0;y<r.length;++y){var g=r.charCodeAt(y);if(g>=55296&&g<=57343){var k=r.charCodeAt(++y);g=65536+((g&1023)<<10)|k&1023}if(g<=127){if(o>=b)break;n[o++>>>0]=g}else if(g<=2047){if(o+1>=b)break;n[o++>>>0]=192|g>>6,n[o++>>>0]=128|g&63}else if(g<=65535){if(o+2>=b)break;n[o++>>>0]=224|g>>12,n[o++>>>0]=128|g>>6&63,n[o++>>>0]=128|g&63}else{if(o+3>=b)break;n[o++>>>0]=240|g>>18,n[o++>>>0]=128|g>>12&63,n[o++>>>0]=128|g>>6&63,n[o++>>>0]=128|g&63}}return n[o>>>0]=0,o-_},De=(r,n,o)=>Kt(r,w,n,o);e.stringToUTF8=De;function zt(r,n){r>>>=0,n>>>=0}function Vt(r,n,o){n>>>=0,o>>>=0}function Xt(r,n,o,d,_,b){n>>>=0,o>>>=0;var y=Ee(r);if(!y.daddr)return-53;var g=Pe(n,y.family,le.lookup_name(y.daddr),y.dport,o);return 0}function Jt(r,n,o,d,_,b){n>>>=0,o>>>=0;var y=Ee(r),g=Pe(n,y.family,le.lookup_name(y.saddr||"0.0.0.0"),y.sport,o);return 0}function Qt(r,n,o,d,_,b){d>>>=0,_>>>=0;var y=Ee(r);return n===1&&o===4?(S[d>>>2>>>0]=y.error,S[_>>>2>>>0]=4,y.error=null,0):-50}function Yt(r,n,o){return o>>>=0,nr.varargs=o,0}var Zt=(r,n)=>{var o=Ee(r);return o.sock_ops.listen(o,n),0};function en(r,n){r>>>=0,n>>>=0}function rn(r,n,o){n>>>=0}function tn(r,n,o,d){n>>>=0,o>>>=0}function nn(r,n,o,d){n>>>=0,d>>>=0,nr.varargs=d}function sn(r,n,o){r>>>=0}function an(r,n,o,d){n>>>=0,o>>>=0,d>>>=0}function on(r,n,o,d,_,b){n>>>=0,o>>>=0,_>>>=0,b>>>=0;var y=Ee(r),g=y.sock_ops.recvmsg(y,o);if(!g)return 0;if(_)var k=Pe(_,y.family,le.lookup_name(g.addr),g.port,b);return w.set(g.buffer,n>>>0),g.buffer.byteLength}function ln(r,n,o,d){n>>>=0,d>>>=0}function cn(r){r>>>=0}function un(r,n,o,d,_,b){n>>>=0,o>>>=0,_>>>=0,b>>>=0}var dn=(r,n,o)=>{};function fn(r,n){r>>>=0,n>>>=0}function _n(r,n,o){r>>>=0,n>>>=0,o>>>=0}function hn(r,n,o){n>>>=0}var bn=()=>be("");function xr(){be("missing function: _emval_call_method")}xr.stub=!0;function Br(){be("missing function: _emval_decref")}Br.stub=!0;function Ir(){be("missing function: _emval_get_global")}Ir.stub=!0;function Hr(){be("missing function: _emval_get_method_caller")}Hr.stub=!0;function Nr(){be("missing function: _emval_run_destructors")}Nr.stub=!0;var pn=r=>r%4===0&&(r%100!==0||r%400===0),mn=[0,31,60,91,121,152,182,213,244,274,305,335],gn=[0,31,59,90,120,151,181,212,243,273,304,334],yn=r=>{var n=pn(r.getFullYear()),o=n?mn:gn,d=o[r.getMonth()]+r.getDate()-1;return d};function wn(r,n,o){var d=Ae(r,n);o>>>=0;var _=new Date(d*1e3);S[o>>>2>>>0]=_.getSeconds(),S[o+4>>>2>>>0]=_.getMinutes(),S[o+8>>>2>>>0]=_.getHours(),S[o+12>>>2>>>0]=_.getDate(),S[o+16>>>2>>>0]=_.getMonth(),S[o+20>>>2>>>0]=_.getFullYear()-1900,S[o+24>>>2>>>0]=_.getDay();var b=yn(_)|0;S[o+28>>>2>>>0]=b,S[o+36>>>2>>>0]=-(_.getTimezoneOffset()*60);var y=new Date(_.getFullYear(),0,1),g=new Date(_.getFullYear(),6,1).getTimezoneOffset(),k=y.getTimezoneOffset(),N=(g!=k&&_.getTimezoneOffset()==Math.min(k,g))|0;S[o+32>>>2>>>0]=N}function vn(r,n,o,d,_,b,y,g){r>>>=0;var k=Ae(_,b);return y>>>=0,g>>>=0,-52}function En(r,n,o,d,_,b,y){r>>>=0,n>>>=0;var g=Ae(b,y)}var An=function(r,n,o,d){r>>>=0,n>>>=0,o>>>=0,d>>>=0;var _=new Date().getFullYear(),b=new Date(_,0,1),y=new Date(_,6,1),g=b.getTimezoneOffset(),k=y.getTimezoneOffset(),N=Math.max(g,k);$[r>>>2>>>0]=N*60,S[n>>>2>>>0]=+(g!=k);var W=V=>{var O=V>=0?"-":"+",m=Math.abs(V),re=String(Math.floor(m/60)).padStart(2,"0"),ie=String(m%60).padStart(2,"0");return"UTC".concat(O).concat(re).concat(ie)},h=W(g),j=W(k);k<g?(De(h,o,17),De(j,d,17)):(De(h,d,17),De(j,o,17))},Pr=()=>performance.now(),Cr=()=>Date.now(),Dn=1,Sn=r=>r>=0&&r<=3;function Fn(r,n,o,d){var _=Ae(n,o);if(d>>>=0,!Sn(r))return 28;var b;if(r===0)b=Cr();else if(Dn)b=Pr();else return 52;var y=Math.round(b*1e3*1e3);return ye=[y>>>0,(ae=y,+Math.abs(ae)>=1?ae>0?+Math.floor(ae/4294967296)>>>0:~~+Math.ceil((ae-+(~~ae>>>0))/4294967296)>>>0:0)],S[d>>>2>>>0]=ye[0],S[d+4>>>2>>>0]=ye[1],0}function kn(r,n){return r>>>=0,globalThis.DUCKDB_RUNTIME.createDirectory(e,r,n)}function Rn(r,n){return r>>>=0,globalThis.DUCKDB_RUNTIME.checkDirectory(e,r,n)}function Tn(r,n){return r>>>=0,globalThis.DUCKDB_RUNTIME.listDirectoryEntries(e,r,n)}function Un(r,n){return r>>>=0,globalThis.DUCKDB_RUNTIME.removeDirectory(e,r,n)}function xn(r){return globalThis.DUCKDB_RUNTIME.closeFile(e,r)}function Bn(r,n){return r>>>=0,globalThis.DUCKDB_RUNTIME.dropFile(e,r,n)}function In(r,n){return r>>>=0,globalThis.DUCKDB_RUNTIME.checkFile(e,r,n)}function Hn(r,n,o,d){return r>>>=0,o>>>=0,globalThis.DUCKDB_RUNTIME.moveFile(e,r,n,o,d)}function Nn(r,n){return globalThis.DUCKDB_RUNTIME.openFile(e,r,n)}function Pn(r,n,o,d){return n>>>=0,globalThis.DUCKDB_RUNTIME.readFile(e,r,n,o,d)}function Cn(r,n){return globalThis.DUCKDB_RUNTIME.truncateFile(e,r,n)}function Ln(r,n,o,d){return n>>>=0,globalThis.DUCKDB_RUNTIME.writeFile(e,r,n,o,d)}function On(r){return globalThis.DUCKDB_RUNTIME.getDefaultDataProtocol(r)}function Mn(r,n){return r>>>=0,globalThis.DUCKDB_RUNTIME.glob(e,r,n)}function Wn(r){return globalThis.DUCKDB_RUNTIME.testPlatformFeature(e,r)}function qn(r,n,o,d,_,b){return r>>>=0,o>>>=0,_>>>=0,globalThis.DUCKDB_RUNTIME.callScalarUDF(e,r,n,o,d,_,b)}var sr=[],jn=(r,n)=>{sr.length=0;for(var o;o=w[r++>>>0];){var d=o!=105;d&=o!=112,n+=d&&n%8?4:0,sr.push(o==112?$[n>>>2>>>0]:o==105?S[n>>>2>>>0]:K[n>>>3>>>0]),n+=d?8:4}return sr},Gn=(r,n,o)=>{var d=jn(n,o);return Ht[r](...d)};function $n(r,n,o){return r>>>=0,n>>>=0,o>>>=0,Gn(r,n,o)}var Lr=()=>4294901760;function Kn(){return Lr()}var zn=(r,n)=>Math.ceil(r/n)*n,Vn=r=>{var n=x.buffer,o=(r-n.byteLength+65535)/65536|0;try{return x.grow(o),ve(),1}catch(d){}};function Xn(r){r>>>=0;var n=w.length,o=Lr();if(r>o)return!1;for(var d=1;d<=4;d*=2){var _=n*(1+.2/d);_=Math.min(_,r+100663296);var b=Math.min(o,zn(Math.max(r,_),65536)),y=Vn(b);if(y)return!0}return!1}var ar={},Jn=()=>T||"./this.program",Ce=()=>{if(!Ce.strings){var r=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",n={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:r,_:Jn()};for(var o in ar)ar[o]===void 0?delete n[o]:n[o]=ar[o];var d=[];for(var o in n)d.push("".concat(o,"=").concat(n[o]));Ce.strings=d}return Ce.strings},Qn=(r,n)=>{for(var o=0;o<r.length;++o)H[n++>>>0]=r.charCodeAt(o);H[n>>>0]=0},Yn=function(r,n){r>>>=0,n>>>=0;var o=0;return Ce().forEach((d,_)=>{var b=n+o;$[r+_*4>>>2>>>0]=b,Qn(d,b),o+=d.length+1}),0},Zn=function(r,n){r>>>=0,n>>>=0;var o=Ce();$[r>>>2>>>0]=o.length;var d=0;return o.forEach(_=>d+=_.length+1),$[n>>>2>>>0]=d,0},es=0,rs=()=>Ct||es>0,ts=r=>{var n;R=r,rs()||((n=e.onExit)==null||n.call(e,r),v=!0),Z(r,new yr(r))},Or=(r,n)=>{R=r,ts(r)},ns=Or,ss=r=>52;function as(r,n){n>>>=0;var o=0,d=0,_=0;{var b=2;r==0?o=2:(r==1||r==2)&&(o=64),_=1}return H[n>>>0]=b,B[n+2>>>1>>>0]=_,ye=[o>>>0,(ae=o,+Math.abs(ae)>=1?ae>0?+Math.floor(ae/4294967296)>>>0:~~+Math.ceil((ae-+(~~ae>>>0))/4294967296)>>>0:0)],S[n+8>>>2>>>0]=ye[0],S[n+12>>>2>>>0]=ye[1],ye=[d>>>0,(ae=d,+Math.abs(ae)>=1?ae>0?+Math.floor(ae/4294967296)>>>0:~~+Math.ceil((ae-+(~~ae>>>0))/4294967296)>>>0:0)],S[n+16>>>2>>>0]=ye[0],S[n+20>>>2>>>0]=ye[1],0}function os(r,n,o,d,_,b){n>>>=0,o>>>=0;var y=Ae(d,_);return b>>>=0,52}function is(r,n,o,d,_,b){n>>>=0,o>>>=0;var y=Ae(d,_);return b>>>=0,52}function ls(r,n,o,d){return n>>>=0,o>>>=0,d>>>=0,52}function cs(r,n,o,d,_){var b=Ae(n,o);return _>>>=0,70}var us=r=>52,ds=[null,[],[]],fs=(r,n)=>{var o=ds[r];n===0||n===10?((r===1?se:p)(Tr(o)),o.length=0):o.push(n)};function _s(r,n,o,d){n>>>=0,o>>>=0,d>>>=0;for(var _=0,b=0;b<o;b++){var y=$[n>>>2>>>0],g=$[n+4>>>2>>>0];n+=8;for(var k=0;k<g;k++)fs(r,w[y+k>>>0]);_+=g}return $[d>>>2>>>0]=_,0}function hs(r,n,o,d){r>>>=0,n>>>=0,o>>>=0,d>>>=0;var _=0,b=0,y=0,g=0,k=0,N=0,W;function h(j,V,O,m,re,ie){var z,pe,me,jr;return pe=j===10?28:16,re=j===10?Sr(re):tr(re),z=we(pe),jr=Pe(z,j,re,ie),A(!jr),me=we(32),S[me+4>>>2>>>0]=j,S[me+8>>>2>>>0]=V,S[me+12>>>2>>>0]=O,$[me+24>>>2>>>0]=m,$[me+20>>>2>>>0]=z,j===10?S[me+16>>>2>>>0]=28:S[me+16>>>2>>>0]=16,S[me+28>>>2>>>0]=0,me}if(o&&(y=S[o>>>2>>>0],g=S[o+4>>>2>>>0],k=S[o+8>>>2>>>0],N=S[o+12>>>2>>>0]),k&&!N&&(N=k===2?17:6),!k&&N&&(k=N===17?2:1),N===0&&(N=6),k===0&&(k=1),!r&&!n)return-2;if(y&-1088||o!==0&&S[o>>>2>>>0]&2&&!r)return-1;if(y&32)return-2;if(k!==0&&k!==1&&k!==2)return-7;if(g!==0&&g!==2&&g!==10)return-6;if(n&&(n=J(n),b=parseInt(n,10),isNaN(b)))return y&1024?-2:-8;if(!r)return g===0&&(g=2),y&1||(g===2?_=_htonl(2130706433):_=[0,0,0,_htonl(1)]),W=h(g,k,N,null,_,b),$[d>>>2>>>0]=W,0;if(r=J(r),_=Le(r),_!==null)if(g===0||g===2)g=2;else if(g===10&&y&8)_=[0,0,_htonl(65535),_],g=10;else return-2;else if(_=rr(r),_!==null)if(g===0||g===10)g=10;else return-2;return _!=null?(W=h(g,k,N,r,_,b),$[d>>>2>>>0]=W,0):y&4?-2:(r=le.lookup_name(r),_=Le(r),g===0?g=2:g===10&&(_=[0,0,_htonl(65535),_]),W=h(g,k,N,null,_,b),$[d>>>2>>>0]=W,0)}function bs(r,n,o,d,_,b,y){r>>>=0,o>>>=0,_>>>=0;var g=Fr(r,n);if(g.errno)return-6;var k=g.port,N=g.addr,W=!1;if(o&&d){var h;if(y&1||!(h=le.lookup_addr(N))){if(y&8)return-2}else N=h;var j=De(N,o,d);j+1>=d&&(W=!0)}if(_&&b){k=""+k;var j=De(k,_,b);j+1>=b&&(W=!0)}return W?-12:0}var ps=()=>{if(D){var r=["crypto"].map(Gr).pop();return n=>r.randomFillSync(n)}return n=>crypto.getRandomValues(n)},Mr=r=>{(Mr=ps())(r)};function ms(r,n){return r>>>=0,n>>>=0,Mr(w.subarray(r>>>0,r+n>>>0)),0}var gs=r=>{if(r instanceof yr||r=="unwind")return R;Z(1,r)},ys=r=>{var n=e["_"+r];return n},ws=(r,n)=>{H.set(r,n>>>0)},Me=r=>Us(r);e.stackAlloc=Me;var vs=r=>{var n=Ur(r)+1,o=Me(n);return De(r,o,n),o},Wr=()=>xs(),qr=r=>Ts(r),Es=(r,n,o,d,_)=>{var b={string:O=>{var m=0;return O!=null&&O!==0&&(m=vs(O)),m},array:O=>{var m=Me(O.length);return ws(O,m),m}};function y(O){return n==="string"?J(O):n==="boolean"?!!O:O}var g=ys(r),k=[],N=0;if(d)for(var W=0;W<d.length;W++){var h=b[o[W]];h?(N===0&&(N=Wr()),k[W]=h(d[W])):k[W]=d[W]}var j=g(...k);function V(O){return N!==0&&qr(N),y(O)}return j=V(j),j},As=r=>Rs(),Ds=r=>ks(r),Ss={m:Lt,la:Ot,qa:Mt,K:Wt,ga:qt,b:jt,fa:Gt,x:$t,ha:zt,aa:Vt,ka:Xt,ja:Jt,oa:Qt,j:Yt,J:Zt,ca:en,ba:rn,da:tn,u:nn,pa:sn,Z:an,ma:on,_:ln,r:cn,na:un,t:dn,ea:fn,ia:_n,s:hn,ta:bn,G:xr,k:Br,I:Ir,H:Hr,F:Nr,A:wn,B:vn,C:En,sa:An,D:Fn,Q:kn,S:Rn,O:Tn,P:Un,p:xn,V:Bn,M:In,N:Hn,U:Nn,f:Pn,T:Cn,q:Ln,W:On,L:Mn,o:Wn,X:qn,e:$n,n:Cr,ra:Kn,c:Pr,ua:Xn,v:Yn,w:Zn,a:ns,d:ss,R:as,z:os,y:is,l:ls,E:cs,$:us,h:_s,i:hs,g:bs,Y:ms},I=await It(),Fs=e._main=I.xa,aa=e._duckdb_web_fs_glob_add_path=I.za,oa=e._duckdb_web_clear_response=I.Aa,ia=e._duckdb_web_fail_with=I.Ba,la=e._duckdb_web_reset=I.Ca,ca=e._duckdb_web_connect=I.Da,ua=e._duckdb_web_disconnect=I.Ea,da=e._duckdb_web_flush_files=I.Fa,fa=e._duckdb_web_flush_file=I.Ga,_a=e._duckdb_web_open=I.Ha,ha=e._duckdb_web_get_global_file_info=I.Ia,ba=e._duckdb_web_collect_file_stats=I.Ja,pa=e._duckdb_web_export_file_stats=I.Ka,ma=e._duckdb_web_fs_drop_file=I.La,ga=e._duckdb_web_fs_drop_files=I.Ma,ya=e._duckdb_web_fs_glob_file_infos=I.Na,wa=e._duckdb_web_fs_get_file_info_by_id=I.Oa,va=e._duckdb_web_fs_get_file_info_by_name=I.Pa,Ea=e._duckdb_web_fs_register_file_url=I.Qa,Aa=e._duckdb_web_fs_register_file_buffer=I.Ra,Da=e._duckdb_web_copy_file_to_buffer=I.Sa,Sa=e._duckdb_web_copy_file_to_path=I.Ta,Fa=e._duckdb_web_get_version=I.Ua,ka=e._duckdb_web_get_feature_flags=I.Va,Ra=e._duckdb_web_tokenize=I.Wa,Ta=e._duckdb_web_tokenize_buffer=I.Xa,Ua=e._duckdb_web_udf_scalar_create=I.Ya,xa=e._duckdb_web_prepared_create=I.Za,Ba=e._duckdb_web_prepared_create_buffer=I._a,Ia=e._duckdb_web_prepared_close=I.$a,Ha=e._duckdb_web_prepared_run=I.ab,Na=e._duckdb_web_prepared_send=I.bb,Pa=e._duckdb_web_query_run=I.cb,Ca=e._duckdb_web_query_run_buffer=I.db,La=e._duckdb_web_pending_query_start=I.eb,Oa=e._duckdb_web_pending_query_start_buffer=I.fb,Ma=e._duckdb_web_pending_query_poll=I.gb,Wa=e._duckdb_web_pending_query_cancel=I.hb,qa=e._duckdb_web_query_fetch_results=I.ib,ja=e._duckdb_web_get_tablenames=I.jb,Ga=e._duckdb_web_get_tablenames_buffer=I.kb,$a=e._duckdb_web_insert_arrow_from_ipc_stream=I.lb,Ka=e._duckdb_web_insert_csv_from_path=I.mb,za=e._duckdb_web_insert_json_from_path=I.nb,we=e._malloc=I.rb,Va=e._free=I.sb,Xa=e._calloc=I.tb,ks=I.vb,Rs=I.wb,Ts=I.xb,Us=I.yb,xs=I.zb;function Bs(r){r=Object.assign({},r);var n=_=>b=>_(b)>>>0,o=_=>(b,y)=>_(b,y)>>>0,d=_=>()=>_()>>>0;return r.rb=n(r.rb),r.tb=o(r.tb),r.yb=n(r.yb),r.zb=d(r.zb),r}e.stackSave=Wr,e.stackRestore=qr,e.stackAlloc=Me,e.getTempRet0=As,e.setTempRet0=Ds,e.ccall=Es;function Is(){var r=Fs,n=0,o=0;try{var d=r(n,o);return Or(d,!0),d}catch(_){return gs(_)}}function or(){if(Fe>0){He=or;return}if(xe(),Fe>0){He=or;return}function r(){var o;if(e.calledRun=!0,!v){Be(),c(e),(o=e.onRuntimeInitialized)==null||o.call(e);var n=e.noInitialRun;n||Is(),Dt()}}e.setStatus?(e.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>e.setStatus(""),1),r()},1)):r()}if(e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return or(),i=f,i}})();typeof vt=="object"&&typeof Qe=="object"?(Qe.exports=gr,Qe.exports.default=gr):typeof define=="function"&&define.amd&&define([],()=>gr)});import*as ge from"apache-arrow";var We=class{constructor(t,a){this._bindings=t,this._conn=a}close(){this._bindings.disconnect(this._conn)}useUnsafe(t){return t(this._bindings,this._conn)}query(t){let a=this._bindings.runQuery(this._conn,t),i=ge.RecordBatchReader.from(a);return console.assert(i.isSync()),console.assert(i.isFile()),new ge.Table(i)}async send(t,a=!1){let i=this._bindings.startPendingQuery(this._conn,t,a);for(;i==null;)i=await new Promise((l,f)=>{try{l(this._bindings.pollPendingQuery(this._conn))}catch(u){console.log(u),u.message.includes("worker is not set!")?f(new Error("Worker has been terminated")):f(u)}});let e=new qe(this._bindings,this._conn,i),c=ge.RecordBatchReader.from(e);return console.assert(c.isSync()),console.assert(c.isStream()),c}cancelSent(){return this._bindings.cancelPendingQuery(this._conn)}getTableNames(t){return this._bindings.getTableNames(this._conn,t)}prepare(t){let a=this._bindings.createPrepared(this._conn,t);return new lr(this._bindings,this._conn,a)}createScalarFunction(t,a,i){this._bindings.createScalarFunction(this._conn,t,a,i)}insertArrowTable(t,a){let i=ge.tableToIPC(t,"stream");this.insertArrowFromIPCStream(i,a)}insertArrowFromIPCStream(t,a){this._bindings.insertArrowFromIPCStream(this._conn,t,a)}insertCSVFromPath(t,a){this._bindings.insertCSVFromPath(this._conn,t,a)}insertJSONFromPath(t,a){this._bindings.insertJSONFromPath(this._conn,t,a)}},qe=class{constructor(t,a,i){this.bindings=t;this.conn=a;this.header=i;this._first=!0,this._depleted=!1}next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let t=null;do t=this.bindings.fetchQueryResults(this.conn);while(t==null);return this._depleted=t.length==0,{done:this._depleted,value:t}}[Symbol.iterator](){return this}},lr=class{constructor(t,a,i){this.bindings=t,this.connectionId=a,this.statementId=i}close(){this.bindings.closePrepared(this.connectionId,this.statementId)}query(...t){let a=this.bindings.runPrepared(this.connectionId,this.statementId,t),i=ge.RecordBatchReader.from(a);return console.assert(i.isSync()),console.assert(i.isFile()),new ge.Table(i)}send(...t){let a=this.bindings.sendPrepared(this.connectionId,this.statementId,t),i=new qe(this.bindings,this.connectionId,a),e=ge.RecordBatchReader.from(i);return console.assert(e.isSync()),console.assert(e.isStream()),e}};var zr=(i=>(i[i.SUCCESS=0]="SUCCESS",i[i.MAX_ARROW_ERROR=255]="MAX_ARROW_ERROR",i[i.DUCKDB_WASM_RETRY=256]="DUCKDB_WASM_RETRY",i))(zr||{});function Vr(s){return s<=255}function Xr(s){return s===256}var Yr=new TextEncoder,Jr=new TextDecoder("utf-8");function cr(s,t,a){let i=Yr.encode(a),e=s._malloc(i.byteLength),c=s.HEAPU8.subarray(e,e+i.byteLength);c.set(i),s.HEAPF64[(t>>3)+0]=1,s.HEAPF64[(t>>3)+1]=e,s.HEAPF64[(t>>3)+2]=c.byteLength}function dr(s){switch(s){case"UINT8":case"INT8":return 1;case"INT32":case"FLOAT":return 4;case"INT64":case"UINT64":case"DOUBLE":case"VARCHAR":return 8;default:return 0}}function ur(s,t,a,i){let e=s.HEAPU8.subarray(t,t+i*dr(a));switch(a){case"UINT8":return new Uint8Array(e.buffer,e.byteOffset,i);case"INT8":return new Int8Array(e.buffer,e.byteOffset,i);case"INT32":return new Int32Array(e.buffer,e.byteOffset,i);case"FLOAT":return new Float32Array(e.buffer,e.byteOffset,i);case"DOUBLE":return new Float64Array(e.buffer,e.byteOffset,i);case"VARCHAR":return new Float64Array(e.buffer,e.byteOffset,i);default:return new Array(0)}}function Qr(s,t,a){let i=s.HEAPU8.subarray(t,t+a);return new Uint8Array(i.buffer,i.byteOffset,a)}function je(s,t,a){let i=s.HEAPU8.subarray(t,t+a*8);return new Float64Array(i.buffer,i.byteOffset,a)}function Ge(s,t,a,i,e,c,l,f){try{let u=s._udfFunctions.get(i);if(!u){cr(t,a,"Unknown UDF with id: "+i);return}let E=Jr.decode(t.HEAPU8.subarray(e,e+c)),D=JSON.parse(E),U=je(t,l,f/8),P=v=>{var A;let R=null;switch(v.validityBuffer!==void 0&&(R=Qr(t,U[v.validityBuffer],D.rows)),v.physicalType){case"VARCHAR":{if(v.dataBuffer===null||v.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for VARCHAR argument");if(v.lengthBuffer===null||v.lengthBuffer===void 0)throw new Error("malformed data view, expected data length buffer for VARCHAR argument");let H=ur(t,U[v.dataBuffer],v.physicalType,D.rows),w=[],B=je(t,U[v.lengthBuffer],D.rows);for(let C=0;C<D.rows;++C){if(R!=null&&!R[C]){w.push(null);continue}let S=t.HEAPU8.subarray(H[C],H[C]+B[C]),$=Jr.decode(S);w.push($)}return C=>w[C]}case"STRUCT":{let H={},w=[];for(let B=0;B<(((A=v.children)==null?void 0:A.length)||0);++B){let C=v.children[B],S=P(C);w.push($=>{H[C.name]=S($)})}return R!=null?B=>{if(!R[B])return null;for(let C of w)C(B);return H}:B=>{for(let C of w)C(B);return H}}default:{if(v.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for argument of type: "+v.physicalType);let H=ur(t,U[v.dataBuffer],v.physicalType,D.rows);return R!=null?w=>R[w]?H[w]:null:w=>H[w]}}},T=[];for(let v=0;v<D.args.length;++v)T.push(P(D.args[v]));let Z=D.rows*dr(D.ret.physicalType),G=t._malloc(Z),te=ur(t,G,D.ret.physicalType,D.rows),ne=t._malloc(D.rows),Y=Qr(t,ne,D.rows);if(te.length==0||Y.length==0){cr(t,a,"Can't create physical arrays for result");return}let X=te;D.ret.physicalType=="VARCHAR"&&(X=new Array(D.rows));let oe=[];for(let v=0;v<D.args.length;++v)oe.push(null);for(let v=0;v<D.rows;++v){for(let A=0;A<D.args.length;++A)oe[A]=T[A](v);let R=u.func(...oe);X[v]=R,Y[v]=R==null?0:1}let se=0;switch(D.ret.physicalType){case"VARCHAR":{let v=new Array(0);se=t._malloc(D.rows*dr("DOUBLE"));let R=je(t,se,D.rows),A=0;for(let C=0;C<D.rows;++C){let S=Yr.encode(X[C]||"");v.push(S),R[C]=S.length,A+=S.length}let H=t._malloc(A),w=t.HEAPU8.subarray(H,H+A),B=0;for(let C=0;C<D.rows;++C){te[C]=B;let S=v[C];w.subarray(B,B+S.length).set(S),B+=S.length}}}let p=3*8,F=t._malloc(p),x=je(t,F,3);x[0]=G,x[1]=ne,x[2]=se,t.HEAPF64[(a>>3)+0]=0,t.HEAPF64[(a>>3)+1]=F,t.HEAPF64[(a>>3)+2]=0}catch(u){cr(t,a,u.toString())}}function Ws(){let s=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),s.decode(t))}var qs=Ws();function de(s,t){console.error("FAIL WITH: ".concat(t)),s.ccall("duckdb_web_fail_with",null,["string"],[t])}function ke(s,t,a){let i=new Uint8Array(s.HEAPU8.buffer,t>>>0,a),e=new Uint8Array(new ArrayBuffer(i.byteLength));return e.set(i),e}function M(s,t,a){return qs(new Uint8Array(s.HEAPU8.buffer,t>>>0,a))}var $e=(l=>(l[l.BUFFER=0]="BUFFER",l[l.NODE_FS=1]="NODE_FS",l[l.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",l[l.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",l[l.HTTP=4]="HTTP",l[l.S3=5]="S3",l))($e||{}),et=(U=>(U[U.FILE_FLAGS_READ=1]="FILE_FLAGS_READ",U[U.FILE_FLAGS_WRITE=2]="FILE_FLAGS_WRITE",U[U.FILE_FLAGS_DIRECT_IO=4]="FILE_FLAGS_DIRECT_IO",U[U.FILE_FLAGS_FILE_CREATE=8]="FILE_FLAGS_FILE_CREATE",U[U.FILE_FLAGS_FILE_CREATE_NEW=16]="FILE_FLAGS_FILE_CREATE_NEW",U[U.FILE_FLAGS_APPEND=32]="FILE_FLAGS_APPEND",U[U.FILE_FLAGS_PRIVATE=64]="FILE_FLAGS_PRIVATE",U[U.FILE_FLAGS_NULL_IF_NOT_EXISTS=128]="FILE_FLAGS_NULL_IF_NOT_EXISTS",U[U.FILE_FLAGS_PARALLEL_ACCESS=256]="FILE_FLAGS_PARALLEL_ACCESS",U[U.FILE_FLAGS_EXCLUSIVE_CREATE=512]="FILE_FLAGS_EXCLUSIVE_CREATE",U[U.FILE_FLAGS_NULL_IF_EXISTS=1024]="FILE_FLAGS_NULL_IF_EXISTS",U))(et||{});function Q(s,t,a,i){let e=s.stackSave(),c=s.stackAlloc(3*8);a.unshift("number"),i.unshift(c),s.ccall(t,null,a,i);let l=s.HEAPF64[(c>>3)+0],f=s.HEAPF64[(c>>3)+1],u=s.HEAPF64[(c>>3)+2];return s.stackRestore(e),[l,f,u]}function ee(s){s.ccall("duckdb_web_clear_response",null,[],[])}var rt={_udfFunctions:new Map,testPlatformFeature:(s,t)=>!1,getDefaultDataProtocol:s=>0,openFile:(s,t,a)=>{},syncFile:(s,t)=>{},closeFile:(s,t)=>{},dropFile:(s,t,a)=>{},getLastFileModificationTime:(s,t)=>0,progressUpdate:(s,t,a)=>{},truncateFile:(s,t,a)=>{},readFile:(s,t,a,i,e)=>0,writeFile:(s,t,a,i,e)=>0,removeDirectory:(s,t,a)=>{},checkDirectory:(s,t,a)=>!1,createDirectory:(s,t,a)=>{},listDirectoryEntries:(s,t,a)=>!1,glob:(s,t,a)=>{},moveFile:(s,t,a,i,e)=>{},checkFile:(s,t,a)=>!1,removeFile:(s,t,a)=>{},callScalarUDF:(s,t,a,i,e,c,l)=>{Ge(rt,s,t,a,i,e,c,l)}};var Ke=class{constructor(t){let a=new Float64Array(t.buffer,t.byteOffset,t.byteLength/8),i=new Uint8Array(new ArrayBuffer(t.byteLength));i.set(t.subarray(7*8)),this.totalFileReadsCold=a[0],this.totalFileReadsAhead=a[1],this.totalFileReadsCached=a[2],this.totalFileWrites=a[3],this.totalPageAccesses=a[4],this.totalPageLoads=a[5],this.blockSize=a[6],this.blockStats=i}getBlockStats(t,a){return a=a||{file_reads_cold:0,file_reads_ahead:0,file_reads_cached:0,file_writes:0,page_accesses:0,page_loads:0},a.file_writes=this.blockStats[t*3+0]&15,a.file_reads_cold=this.blockStats[t*3+0]>>4,a.file_reads_ahead=this.blockStats[t*3+1]&15,a.file_reads_cached=this.blockStats[t*3+1]>>4,a.page_accesses=this.blockStats[t*3+1]&15,a.page_loads=this.blockStats[t*3+1]>>4,a}};import*as q from"apache-arrow";function Te(s){switch(s.typeId){case q.Type.Binary:return{sqlType:"binary"};case q.Type.Bool:return{sqlType:"bool"};case q.Type.Date:return{sqlType:"date"};case q.Type.DateDay:return{sqlType:"date32[d]"};case q.Type.DateMillisecond:return{sqlType:"date64[ms]"};case q.Type.Decimal:{let t=s;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case q.Type.Float:return{sqlType:"float"};case q.Type.Float16:return{sqlType:"float16"};case q.Type.Float32:return{sqlType:"float32"};case q.Type.Float64:return{sqlType:"float64"};case q.Type.Int:return{sqlType:"int32"};case q.Type.Int16:return{sqlType:"int16"};case q.Type.Int32:return{sqlType:"int32"};case q.Type.Int64:return{sqlType:"int64"};case q.Type.Uint16:return{sqlType:"uint16"};case q.Type.Uint32:return{sqlType:"uint32"};case q.Type.Uint64:return{sqlType:"uint64"};case q.Type.Uint8:return{sqlType:"uint8"};case q.Type.IntervalDayTime:return{sqlType:"interval[dt]"};case q.Type.IntervalYearMonth:return{sqlType:"interval[m]"};case q.Type.List:return{sqlType:"list",valueType:Te(s.valueType)};case q.Type.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:s.byteWidth};case q.Type.Null:return{sqlType:"null"};case q.Type.Utf8:return{sqlType:"utf8"};case q.Type.Struct:return{sqlType:"struct",fields:s.children.map(a=>ze(a.name,a.type))};case q.Type.Map:{let t=s;return{sqlType:"map",keyType:Te(t.keyType),valueType:Te(t.valueType)}}case q.Type.Time:return{sqlType:"time[s]"};case q.Type.TimeMicrosecond:return{sqlType:"time[us]"};case q.Type.TimeMillisecond:return{sqlType:"time[ms]"};case q.Type.TimeNanosecond:return{sqlType:"time[ns]"};case q.Type.TimeSecond:return{sqlType:"time[s]"};case q.Type.Timestamp:return{sqlType:"timestamp",timezone:s.timezone||void 0};case q.Type.TimestampSecond:return{sqlType:"timestamp[s]",timezone:s.timezone||void 0};case q.Type.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:s.timezone||void 0};case q.Type.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:s.timezone||void 0};case q.Type.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:s.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(s.toString()))}function ze(s,t){let a=Te(t);return a.name=s,a}var Ue=new TextEncoder,js=(l=>(l[l.WASM_EXCEPTIONS=1]="WASM_EXCEPTIONS",l[l.WASM_THREADS=2]="WASM_THREADS",l[l.WASM_SIMD=4]="WASM_SIMD",l[l.WASM_BULK_MEMORY=8]="WASM_BULK_MEMORY",l[l.EMIT_BIGINT=16]="EMIT_BIGINT",l[l.WASMFS=32]="WASMFS",l))(js||{}),Ve=class{constructor(t,a){this._instance=null;this._initPromise=null;this._initPromiseResolver=()=>{};this.onInstantiationProgress=[];this._logger=t,this._runtime=a,this._nextUDFId=1}get logger(){return this._logger}get mod(){return this._instance}get pthread(){return this.mod.PThread||null}async instantiate(t=a=>{}){return this._instance!=null?this:(this._initPromise!=null&&(this.onInstantiationProgress.push(t),await this._initPromise),this._initPromise=new Promise(a=>{this._initPromiseResolver=a}),this.onInstantiationProgress=[t],this._instance=await this.instantiateImpl({print:console.log.bind(console),printErr:console.log.bind(console),onRuntimeInitialized:this._initPromiseResolver}),await this._initPromise,this._initPromise=null,this.onInstantiationProgress=this.onInstantiationProgress.filter(a=>a!=t),globalThis.DUCKDB_BINDINGS=this,this)}open(t){let[a,i,e]=Q(this.mod,"duckdb_web_open",["string"],[JSON.stringify(t)]);if(a!==0)throw new Error(M(this.mod,i,e));ee(this.mod)}reset(){let[t,a,i]=Q(this.mod,"duckdb_web_reset",[],[]);if(t!==0)throw new Error(M(this.mod,a,i));ee(this.mod)}getVersion(){let[t,a,i]=Q(this.mod,"duckdb_web_get_version",[],[]);if(t!==0)throw new Error(M(this.mod,a,i));let e=M(this.mod,a,i);return ee(this.mod),e}getFeatureFlags(){return this.mod.ccall("duckdb_web_get_feature_flags","number",[],[])}tokenize(t){let a=Ue.encode(t),i=this.mod._malloc(a.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,i,a.length).set(a);let[c,l,f]=Q(this.mod,"duckdb_web_tokenize_buffer",["number","number"],[i,a.length]);if(this.mod._free(i),c!==0)throw new Error(M(this.mod,l,f));let u=M(this.mod,l,f);return ee(this.mod),JSON.parse(u)}connect(){let t=this.mod.ccall("duckdb_web_connect","number",[],[]);return new We(this,t)}disconnect(t){if(this.mod.ccall("duckdb_web_disconnect",null,["number"],[t]),this.pthread)for(let a of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])a.postMessage({cmd:"dropUDFFunctions",connectionId:t})}runQuery(t,a){let i=Ue.encode(a),e=this.mod._malloc(i.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,e,i.length).set(i);let[l,f,u]=Q(this.mod,"duckdb_web_query_run_buffer",["number","number","number"],[t,e,i.length]);if(this.mod._free(e),l!==0)throw new Error(M(this.mod,f,u));let E=ke(this.mod,f,u);return ee(this.mod),E}startPendingQuery(t,a,i=!1){let e=Ue.encode(a),c=this.mod._malloc(e.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,c,e.length).set(e);let[f,u,E]=Q(this.mod,"duckdb_web_pending_query_start_buffer",["number","number","number","boolean"],[t,c,e.length,i]);if(this.mod._free(c),f!==0)throw new Error(M(this.mod,u,E));if(u==0)return null;let D=ke(this.mod,u,E);return ee(this.mod),D}pollPendingQuery(t){let[a,i,e]=Q(this.mod,"duckdb_web_pending_query_poll",["number"],[t]);if(a!==0)throw new Error(M(this.mod,i,e));if(i==0)return null;let c=ke(this.mod,i,e);return ee(this.mod),c}cancelPendingQuery(t){return this.mod.ccall("duckdb_web_pending_query_cancel","boolean",["number"],[t])}fetchQueryResults(t){let[a,i,e]=Q(this.mod,"duckdb_web_query_fetch_results",["number"],[t]);if(Xr(a))return ee(this.mod),null;if(!Vr(a))throw new Error("Unexpected StatusCode from duckdb_web_query_fetch_results ("+a+") and with self reported error as"+M(this.mod,i,e));if(a!==0)throw new Error(M(this.mod,i,e));let c=ke(this.mod,i,e);return ee(this.mod),c}getTableNames(t,a){let i=Ue.encode(a),e=this.mod._malloc(i.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,e,i.length).set(i);let[l,f,u]=Q(this.mod,"duckdb_web_get_tablenames_buffer",["number","number","number"],[t,e,i.length]);if(this.mod._free(e),l!==0)throw new Error(M(this.mod,f,u));let E=M(this.mod,f,u);return ee(this.mod),JSON.parse(E)}createScalarFunction(t,a,i,e){let c={functionId:this._nextUDFId,name:a,returnType:Te(i)},l={functionId:c.functionId,connectionId:t,name:a,returnType:i,func:e};this._nextUDFId+=1;let[f,u,E]=Q(this.mod,"duckdb_web_udf_scalar_create",["number","string"],[t,JSON.stringify(c)]);if(f!==0)throw new Error(M(this.mod,u,E));if(ee(this.mod),globalThis.DUCKDB_RUNTIME._udfFunctions=(globalThis.DUCKDB_RUNTIME._udfFunctions||new Map).set(l.functionId,l),this.pthread)for(let D of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])D.postMessage({cmd:"registerUDFFunction",udf:l})}createPrepared(t,a){let i=Ue.encode(a),e=this.mod._malloc(i.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,e,i.length).set(i);let[l,f,u]=Q(this.mod,"duckdb_web_prepared_create_buffer",["number","number","number"],[t,e,i.length]);if(this.mod._free(e),l!==0)throw new Error(M(this.mod,f,u));return ee(this.mod),f}closePrepared(t,a){let[i,e,c]=Q(this.mod,"duckdb_web_prepared_close",["number","number"],[t,a]);if(i!==0)throw new Error(M(this.mod,e,c));ee(this.mod)}runPrepared(t,a,i){let[e,c,l]=Q(this.mod,"duckdb_web_prepared_run",["number","number","string"],[t,a,JSON.stringify(i)]);if(e!==0)throw new Error(M(this.mod,c,l));let f=ke(this.mod,c,l);return ee(this.mod),f}sendPrepared(t,a,i){let[e,c,l]=Q(this.mod,"duckdb_web_prepared_send",["number","number","string"],[t,a,JSON.stringify(i)]);if(e!==0)throw new Error(M(this.mod,c,l));let f=ke(this.mod,c,l);return ee(this.mod),f}insertArrowFromIPCStream(t,a,i){if(a.length==0)return;let e=this.mod._malloc(a.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,e,a.length).set(a);let l=i?JSON.stringify(i):"",[f,u,E]=Q(this.mod,"duckdb_web_insert_arrow_from_ipc_stream",["number","number","number","string"],[t,e,a.length,l]);if(this.mod._free(e),f!==0)throw new Error(M(this.mod,u,E))}insertCSVFromPath(t,a,i){if(i.columns!==void 0){i.columnsFlat=[];for(let E in i.columns)i.columnsFlat.push(ze(E,i.columns[E]))}let e={...i};e.columns=e.columnsFlat,delete e.columnsFlat;let c=JSON.stringify(e),[l,f,u]=Q(this.mod,"duckdb_web_insert_csv_from_path",["number","string","string"],[t,a,c]);if(l!==0)throw new Error(M(this.mod,f,u))}insertJSONFromPath(t,a,i){if(i.columns!==void 0){i.columnsFlat=[];for(let E in i.columns)i.columnsFlat.push(ze(E,i.columns[E]))}let e={...i};e.columns=e.columnsFlat,delete e.columnsFlat;let c=JSON.stringify(e),[l,f,u]=Q(this.mod,"duckdb_web_insert_json_from_path",["number","string","string"],[t,a,c]);if(l!==0)throw new Error(M(this.mod,f,u))}globFiles(t){let[a,i,e]=Q(this.mod,"duckdb_web_fs_glob_file_infos",["string"],[t]);if(a!==0)throw new Error(M(this.mod,i,e));let c=M(this.mod,i,e);ee(this.mod);let l=JSON.parse(c);return l==null?[]:l}registerFileURL(t,a,i,e=!1){a===void 0&&(a=t);let[c,l,f]=Q(this.mod,"duckdb_web_fs_register_file_url",["string","string"],[t,a,i,e]);if(c!==0)throw new Error(M(this.mod,l,f));ee(this.mod)}registerFileText(t,a){let i=Ue.encode(a);this.registerFileBuffer(t,i)}registerFileBuffer(t,a){let i=this.mod._malloc(a.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,i,a.length).set(a);let[c,l,f]=Q(this.mod,"duckdb_web_fs_register_file_buffer",["string","number","number"],[t,i,a.length]);if(c!==0)throw new Error(M(this.mod,l,f));ee(this.mod)}async prepareFileHandle(t,a){if(a===3&&this._runtime.prepareFileHandles){let i=await this._runtime.prepareFileHandles([t],3);for(let e of i){let{handle:c,path:l,fromCached:f}=e;!f&&c.getSize()&&await this.registerFileHandleAsync(l,c,3,!0)}return}throw new Error("prepareFileHandle: unsupported protocol ".concat(a))}async prepareDBFileHandle(t,a){if(a===3&&this._runtime.prepareDBFileHandle){let i=await this._runtime.prepareDBFileHandle(t,3);for(let e of i){let{handle:c,path:l,fromCached:f}=e;!f&&c.getSize()&&await this.registerFileHandleAsync(l,c,3,!0)}return}throw new Error("prepareDBFileHandle: unsupported protocol ".concat(a))}async prepareFileHandleAsync(t,a,i,e){if(i===3&&!(a instanceof FileSystemSyncAccessHandle)){if(a instanceof FileSystemFileHandle){let c=a;try{a=await c.createSyncAccessHandle()}catch(l){throw new Error(l.message+":"+t)}}else if(t!=null)try{a=await(await(await navigator.storage.getDirectory()).getFileHandle(t)).createSyncAccessHandle()}catch(c){throw new Error(c.message+":"+t)}}return a}async registerFileHandleAsync(t,a,i,e){let c=await this.prepareFileHandleAsync(t,a,i,e);this.registerFileHandle(t,c,i,e)}registerFileHandle(t,a,i,e){var u;let[c,l,f]=Q(this.mod,"duckdb_web_fs_register_file_url",["string","string","number","boolean"],[t,t,i,e]);if(c!==0)throw new Error(M(this.mod,l,f));if(ee(this.mod),globalThis.DUCKDB_RUNTIME._files=(globalThis.DUCKDB_RUNTIME._files||new Map).set(t,a),(u=globalThis.DUCKDB_RUNTIME._preparedHandles)!=null&&u[t]&&delete globalThis.DUCKDB_RUNTIME._preparedHandles[t],this.pthread){for(let E of this.pthread.runningWorkers)E.postMessage({cmd:"registerFileHandle",fileName:t,fileHandle:a});for(let E of this.pthread.unusedWorkers)E.postMessage({cmd:"dropFileHandle",fileName:t})}}dropFile(t){let[a,i,e]=Q(this.mod,"duckdb_web_fs_drop_file",["string"],[t]);if(a!==0)throw new Error(M(this.mod,i,e));ee(this.mod)}dropFiles(t){let a=[],i=-1;try{for(let f of t!=null?t:[])if(f!=null&&f.length>0){let u=this.mod.lengthBytesUTF8(f)+1,E=this.mod._malloc(u);if(!E)throw new Error("Failed to allocate memory for string: ".concat(f));this.mod.stringToUTF8(f,E,u),a.push(E)}if(i=this.mod._malloc(a.length*4),!i)throw new Error("Failed to allocate memory for pointers array");for(let f=0;f<a.length;f++)this.mod.HEAP32[(i>>2)+f]=a[f];let[e,c,l]=Q(this.mod,"duckdb_web_fs_drop_files",["number","number"],[i,a.length]);if(e!==0)throw new Error(M(this.mod,c,l));ee(this.mod)}finally{for(let e of a)this.mod._free(e);i>0&&this.mod._free(i)}}flushFiles(){this.mod.ccall("duckdb_web_flush_files",null,[],[])}copyFileToPath(t,a){let[i,e,c]=Q(this.mod,"duckdb_web_copy_file_to_path",["string","string"],[t,a]);if(i!==0)throw new Error(M(this.mod,e,c));ee(this.mod)}copyFileToBuffer(t){let[a,i,e]=Q(this.mod,"duckdb_web_copy_file_to_buffer",["string"],[t]);if(a!==0)throw new Error(M(this.mod,i,e));let c=new Uint8Array(this.mod.HEAPU8.buffer,i>>>0,e),l=new Uint8Array(c.length);return l.set(c),ee(this.mod),l}async registerOPFSFileName(t){if(t.startsWith("opfs://"))return this.prepareFileHandle(t,3);throw new Error("Not an OPFS file name: "+t)}collectFileStatistics(t,a){let[i,e,c]=Q(this.mod,"duckdb_web_collect_file_stats",["string","boolean"],[t,a]);if(i!==0)throw new Error(M(this.mod,e,c))}exportFileStatistics(t){let[a,i,e]=Q(this.mod,"duckdb_web_export_file_stats",["string"],[t]);if(a!==0)throw new Error(M(this.mod,i,e));return new Ke(new Uint8Array(this.mod.HEAPU8.buffer,i>>>0,e))}};var Gs=(e=>(e[e.UNDEFINED=0]="UNDEFINED",e[e.AUTOMATIC=1]="AUTOMATIC",e[e.READ_ONLY=2]="READ_ONLY",e[e.READ_WRITE=3]="READ_WRITE",e))(Gs||{});var $s=(a=>(a.ROW_ARRAY="row-array",a.COLUMN_OBJECT="column-object",a))($s||{});var Ks=(l=>(l[l.IDENTIFIER=0]="IDENTIFIER",l[l.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",l[l.STRING_CONSTANT=2]="STRING_CONSTANT",l[l.OPERATOR=3]="OPERATOR",l[l.KEYWORD=4]="KEYWORD",l[l.COMMENT=5]="COMMENT",l))(Ks||{});var zs=(c=>(c[c.NONE=0]="NONE",c[c.DEBUG=1]="DEBUG",c[c.INFO=2]="INFO",c[c.WARNING=3]="WARNING",c[c.ERROR=4]="ERROR",c))(zs||{}),Vs=(l=>(l[l.NONE=0]="NONE",l[l.CONNECT=1]="CONNECT",l[l.DISCONNECT=2]="DISCONNECT",l[l.OPEN=3]="OPEN",l[l.QUERY=4]="QUERY",l[l.INSTANTIATE=5]="INSTANTIATE",l))(Vs||{}),Xs=(l=>(l[l.NONE=0]="NONE",l[l.OK=1]="OK",l[l.ERROR=2]="ERROR",l[l.START=3]="START",l[l.RUN=4]="RUN",l[l.CAPTURE=5]="CAPTURE",l))(Xs||{}),Js=(c=>(c[c.NONE=0]="NONE",c[c.WEB_WORKER=1]="WEB_WORKER",c[c.NODE_WORKER=2]="NODE_WORKER",c[c.BINDINGS=3]="BINDINGS",c[c.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",c))(Js||{}),tt=class{log(t){}},nt=class{constructor(t=2){this.level=t}log(t){t.level>=this.level&&console.log(t)}};function _o(s){switch(s){case 0:return"NONE";case 1:return"DEBUG";case 2:return"INFO";case 3:return"WARNING";case 4:return"ERROR";default:return"?"}}function ho(s){switch(s){case 0:return"NONE";case 1:return"OK";case 2:return"ERROR";case 3:return"START";case 4:return"RUN";case 5:return"CAPTURE";default:return"?"}}function bo(s){switch(s){case 1:return"CONNECT";case 2:return"DISCONNECT";case 5:return"INSTANTIATE";case 3:return"OPEN";case 4:return"QUERY";default:return"?"}}function po(s){switch(s){case 0:return"NONE";case 1:return"WEB WORKER";case 2:return"NODE WORKER";case 3:return"DUCKDB BINDINGS";case 4:return"DUCKDB";default:return"?"}}var st=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),at=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11]));var ot=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]));var it=()=>(async s=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(s)}catch(t){return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11]));var Xe={name:"@run-trace/duckdb-wasm",version:"0.5.0",description:"DuckDB powered by WebAssembly \u2014 Trace fork with bundled extensions",license:"MIT",repository:{type:"git",url:"https://github.com/trace-github/duckdb-wasm.git"},keywords:["sql","duckdb","relational","database","data","query","wasm","analytics","olap","arrow","parquet","json","csv"],dependencies:{"apache-arrow":"^17.0.0",qs:"^6.14.1"},devDependencies:{"@types/emscripten":"^1.39.10","@types/jasmine":"^5.1.13","@typescript-eslint/eslint-plugin":"^6.21.0","@typescript-eslint/parser":"^6.21.0",esbuild:"^0.20.2",eslint:"^8.57.0","eslint-plugin-jasmine":"^4.1.3","eslint-plugin-react":"^7.37.5","fast-glob":"^3.3.2",jasmine:"^5.13.0","jasmine-core":"^5.1.2","jasmine-spec-reporter":"^7.0.0","js-sha256":"^0.11.1",karma:"^6.4.2","karma-chrome-launcher":"^3.2.0","karma-coverage":"^2.2.1","karma-firefox-launcher":"^2.1.3","karma-jasmine":"^5.1.0","karma-jasmine-html-reporter":"^2.1.0","karma-sourcemap-loader":"^0.4.0","karma-spec-reporter":"^0.0.36","make-dir":"^4.0.0",nyc:"^15.1.0",prettier:"^3.2.5",puppeteer:"^22.8.0",rimraf:"^5.0.5",s3rver:"^3.7.1",typedoc:"^0.28.15",typescript:"^5.3.3","wasm-feature-detect":"^1.6.1","web-worker":"^1.2.0"},scripts:{"build:debug":"node bundle.mjs debug && tsc --emitDeclarationOnly","build:release":"node bundle.mjs release && tsc --emitDeclarationOnly",docs:"typedoc",format:'prettier --write "**/*.+(js|ts)"',report:"node ./coverage.mjs","test:node":"node --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:debug":"node --inspect-brk --enable-source-maps ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:node:coverage":"nyc -r json --report-dir ./coverage/node node ../../node_modules/jasmine/bin/jasmine ./dist/tests-node.cjs","test:firefox":"karma start ./karma/tests-firefox.cjs","test:chrome":"karma start ./karma/tests-chrome.cjs","test:chrome:eh":"karma start ./karma/tests-chrome-eh.cjs","test:chrome:coverage":"karma start ./karma/tests-chrome-coverage.cjs","test:browser":"karma start ./karma/tests-all.cjs","test:browser:debug":"karma start ./karma/tests-debug.cjs",test:"npm run test:chrome && npm run test:node","test:coverage":"npm run test:chrome:coverage && npm run test:node:coverage && npm run report",lint:"eslint src test"},files:["dist","!dist/tests-*","!dist/types/test"],main:"dist/duckdb-browser.cjs",module:"dist/duckdb-browser.mjs",types:"dist/duckdb-browser.d.ts",jsdelivr:"dist/duckdb-browser.cjs",unpkg:"dist/duckdb-browser.mjs",sideEffects:!1,browser:{fs:!1,path:!1,perf_hooks:!1,os:!1,worker_threads:!1},exports:{"./dist/duckdb-eh.wasm":"./dist/duckdb-eh.wasm","./dist/duckdb-coi.wasm":"./dist/duckdb-coi.wasm","./dist/duckdb-browser":"./dist/duckdb-browser.mjs","./dist/duckdb-browser.cjs":"./dist/duckdb-browser.cjs","./dist/duckdb-browser.mjs":"./dist/duckdb-browser.mjs","./dist/duckdb-browser-coi.pthread.worker.js":"./dist/duckdb-browser-coi.pthread.worker.js","./dist/duckdb-browser-coi.worker.js":"./dist/duckdb-browser-coi.worker.js","./dist/duckdb-node":"./dist/duckdb-node.cjs","./dist/duckdb-node.cjs":"./dist/duckdb-node.cjs","./dist/duckdb-node-blocking":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-blocking.cjs":"./dist/duckdb-node-blocking.cjs","./dist/duckdb-node-eh.worker.cjs":"./dist/duckdb-node-eh.worker.cjs","./blocking":{node:{types:"./dist/duckdb-node-blocking.d.ts",require:"./dist/duckdb-node-blocking.cjs",import:"./dist/duckdb-node-blocking.cjs"},types:"./dist/duckdb-node-blocking.d.ts",import:"./dist/duckdb-node-blocking.mjs",require:"./dist/duckdb-node-blocking.cjs"},".":{browser:{types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"},node:{types:"./dist/duckdb-node.d.ts",import:"./dist/duckdb-node.cjs",require:"./dist/duckdb-node.cjs"},types:"./dist/duckdb-browser.d.ts",import:"./dist/duckdb-browser.mjs",require:"./dist/duckdb-browser.cjs"}}};var lt=Xe.name,ct=Xe.version,fr=Xe.version.split("."),wo=fr[0],vo=fr[1],Eo=fr[2];var ut=()=>typeof navigator>"u",dt=()=>ut()?"node":navigator.userAgent,So=()=>dt().includes("Firefox"),Fo=()=>/^((?!chrome|android).)*safari/i.test(dt());function ko(){let s="https://cdn.jsdelivr.net/npm/".concat(lt,"@").concat(ct,"/dist/");return{eh:{mainModule:"".concat(s,"duckdb-eh.wasm"),mainWorker:"".concat(s,"duckdb-browser-eh.worker.js")},coi:{mainModule:"".concat(s,"duckdb-coi.wasm"),mainWorker:"".concat(s,"duckdb-browser-coi.worker.js"),pthreadWorker:"".concat(s,"duckdb-browser-coi.pthread.worker.js")}}}var _r=null,hr=null,br=null,pr=null,mr=null;async function Zs(){return _r==null&&(_r=typeof BigInt64Array<"u"),hr==null&&(hr=await at()),br==null&&(br=await it()),pr==null&&(pr=await ot()),mr==null&&(mr=await st()),{bigInt64Array:_r,crossOriginIsolated:ut()||globalThis.crossOriginIsolated||!1,wasmExceptions:hr,wasmSIMD:pr,wasmThreads:br,wasmBulkMemory:mr}}async function Ro(s){var i;let t=await Zs();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&s.coi)return{mainModule:s.coi.mainModule,mainWorker:s.coi.mainWorker,pthreadWorker:s.coi.pthreadWorker};if(s.eh)return{mainModule:s.eh.mainModule,mainWorker:s.eh.mainWorker,pthreadWorker:null}}let a=(i=s.mvp)!=null?i:s.eh;if(!a)throw new Error("No suitable DuckDB bundle found for this platform");return{mainModule:a.mainModule,mainWorker:a.mainWorker,pthreadWorker:null}}var Se=$r(ht()),bt=function(s,t,a){var i;return(i=s==null?void 0:s.endpoint)!=null&&i.startsWith("http")?new URL(s.endpoint).host:s!=null&&s.endpoint?"".concat(a,".").concat(s==null?void 0:s.endpoint):"".concat(a,".s3.amazonaws.com")};function ea(s,t,a){var c,l,f,u;let i=pt(t),e=i.path;if(mt(s)){let E="";if(s!=null&&s.endpoint){let D=new URL(s.endpoint);D.pathname!=="/"&&(E=D.pathname)}e="".concat(E,"/").concat(i.bucket).concat(e)}return{url:e,query:"",host:bt(s,t,i.bucket),region:(c=s==null?void 0:s.region)!=null?c:"",service:"s3",method:a,accessKeyId:(l=s==null?void 0:s.accessKeyId)!=null?l:"",secretAccessKey:(f=s==null?void 0:s.secretAccessKey)!=null?f:"",sessionToken:(u=s==null?void 0:s.sessionToken)!=null?u:"",dateNow:new Date().toISOString().replace(/-/g,"").split("T")[0],datetimeNow:new Date().toISOString().replace(/-/g,"").replace(/:/g,"").split(".")[0]+"Z"}}function ra(s,t=!1){let a="0123456789ABCDEF",i="";for(let e=0;e<s.length;e++){let c=s[e];c>="A"&&c<="Z"||c>="a"&&c<="z"||c>="0"&&c<="9"||c=="_"||c=="-"||c=="~"||c=="."?i+=c:c=="/"?t?i+="%2F":i+=c:(i+="%",i+=a[c.charCodeAt(0)>>4],i+=a[c.charCodeAt(0)&15])}return i}function ta(s,t=null){var Z;let a=(Z=t==null?void 0:t.contentHash)!=null?Z:"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",i=new Map;i.set("x-amz-date",s.datetimeNow),i.set("x-amz-content-sha256",a),s.sessionToken&&i.set("x-amz-security-token",s.sessionToken);let e="";t!=null&&t.contentType&&(e+="content-type;"),e+="host;x-amz-content-sha256;x-amz-date",s.sessionToken&&(e+=";x-amz-security-token");let c=s.method+"\n"+ra(s.url)+"\n"+s.query;t!=null&&t.contentType&&(c+="\ncontent-type:"+(t==null?void 0:t.contentType)),c+="\nhost:"+s.host+"\nx-amz-content-sha256:"+a+"\nx-amz-date:"+s.datetimeNow,s.sessionToken&&s.sessionToken.length>0&&(c+="\nx-amz-security-token:"+s.sessionToken),c+="\n\n"+e+"\n"+a;let l=(0,Se.sha256)(c),f="AWS4-HMAC-SHA256\n"+s.datetimeNow+"\n"+s.dateNow+"/"+s.region+"/"+s.service+"/aws4_request\n"+l,u="AWS4"+s.secretAccessKey,E=Se.sha256.hmac.arrayBuffer(u,s.dateNow),D=Se.sha256.hmac.arrayBuffer(E,s.region),U=Se.sha256.hmac.arrayBuffer(D,s.service),P=Se.sha256.hmac.arrayBuffer(U,"aws4_request"),T=Se.sha256.hmac(P,f);return i.set("Authorization","AWS4-HMAC-SHA256 Credential="+s.accessKeyId+"/"+s.dateNow+"/"+s.region+"/"+s.service+"/aws4_request, SignedHeaders="+e+", Signature="+T),i}var na=function(s,t,a,i=null,e=null){let c=ea(s,t,a),l={contentType:i,contentHash:e?Se.sha256.hex(e):null};return ta(c,l)};function fe(s,t,a,i,e=null,c=null){(t!=null&&t.accessKeyId||t!=null&&t.sessionToken)&&(na(t,a,i,e,c).forEach((f,u)=>{s.setRequestHeader(u,f)}),e&&s.setRequestHeader("content-type",e))}function pt(s){if(s.indexOf("s3://")!=0)throw new Error("URL needs to start with s3://");let t=s.indexOf("/",5);if(t==-1)throw new Error("URL needs to contain a '/' after the host");let a=s.substring(5,t);if(!a)throw new Error("URL needs to contain a bucket name");let i=s.substring(t);if(!i)throw new Error("URL needs to contain key");return{bucket:a,path:i}}function mt(s){var t;return!!((t=s==null?void 0:s.endpoint)!=null&&t.startsWith("http"))}function _e(s,t){let a=pt(t);return mt(s)?"".concat(s==null?void 0:s.endpoint,"/").concat(a.bucket)+a.path:"https://"+bt(s,t,a.bucket)+a.path}var sa=7,gt=/\/|\\/,L={_files:new Map,_fileInfoCache:new Map,_udfFunctions:new Map,_globalFileInfo:null,_preparedHandles:{},_opfsRoot:null,getFileInfo(s,t){try{let a=L._fileInfoCache.get(t),[i,e,c]=Q(s,"duckdb_web_fs_get_file_info_by_id",["number","number"],[t,(a==null?void 0:a.cacheEpoch)||0]);if(i!==0)return null;if(c===0)return a;let l=M(s,e,c);ee(s);try{let f=JSON.parse(l);if(f==null)return null;let u={...f,blob:null};return L._fileInfoCache.set(t,u),!L._files.has(u.fileName)&&L._preparedHandles[u.fileName]&&(L._files.set(u.fileName,L._preparedHandles[u.fileName]),delete L._preparedHandles[u.fileName]),u}catch(f){return console.warn(f),null}}catch(a){return console.log(a),null}},getGlobalFileInfo(s){var t;try{let[a,i,e]=Q(s,"duckdb_web_get_global_file_info",["number"],[((t=L._globalFileInfo)==null?void 0:t.cacheEpoch)||0]);if(a!==0)return null;if(e===0)return L._globalFileInfo;let c=M(s,i,e);ee(s);let l=JSON.parse(c);return l==null?null:(L._globalFileInfo={...l,blob:null},L._globalFileInfo)}catch(a){return console.log(a),null}},async assignOPFSRoot(){L._opfsRoot||(L._opfsRoot=await navigator.storage.getDirectory())},async prepareFileHandles(s,t){if(t===3){await L.assignOPFSRoot();let a=async e=>{if(L._files.has(e))return{path:e,handle:L._files.get(e),fromCached:!0};let l=L._opfsRoot,f=e.slice(sa),u=f;if(gt.test(f)){let D=f.split(gt);if(D.length===0)throw new Error("Invalid path ".concat(f));if(u=D[D.length-1],!u)throw new Error("Invalid path ".concat(f,". File Not Found."));D.pop();for(let U of D)l=await l.getDirectoryHandle(U,{create:!0})}let E=await l.getFileHandle(u,{create:!1}).catch(D=>{if((D==null?void 0:D.name)==="NotFoundError")return console.debug("File ".concat(e," does not exists yet, creating...")),l.getFileHandle(u,{create:!0});throw D});try{let D=await E.createSyncAccessHandle();return L._preparedHandles[e]=D,{path:e,handle:D,fromCached:!1}}catch(D){throw new Error(D.message+":"+name)}},i=[];for(let e of s){let c=await a(e);i.push(c)}return i}throw new Error("Unsupported protocol ".concat(t," for paths ").concat(s," with protocol ").concat(t))},async prepareDBFileHandle(s,t){if(t===3&&this.prepareFileHandles){let a=[s,"".concat(s,".wal")];return this.prepareFileHandles(a,t)}throw new Error("Unsupported protocol ".concat(t," for path ").concat(s," with protocol ").concat(t))},testPlatformFeature:(s,t)=>{switch(t){case 1:return typeof BigInt64Array<"u";default:return console.warn("test for unknown feature: ".concat(t)),!1}},getDefaultDataProtocol(s){return 2},openFile:(s,t,a)=>{var i,e,c,l,f,u;try{L._fileInfoCache.delete(t);let E=L.getFileInfo(s,t);switch(E==null?void 0:E.dataProtocol){case 4:case 5:{if(a&1&&a&2)throw new Error("Opening file ".concat(E.fileName," failed: cannot open file with both read and write flags set"));if(a&32)throw new Error("Opening file ".concat(E.fileName," failed: appending to HTTP/S3 files is not supported"));if(a&2){let P=new XMLHttpRequest;if(E.dataProtocol==5?(P.open("HEAD",_e(E.s3Config,E.dataUrl),!1),fe(P,E.s3Config,E.dataUrl,"HEAD")):P.open("HEAD",E.dataUrl,!1),P.send(null),P.status!=200&&P.status!=404)throw new Error("Opening file ".concat(E.fileName," failed: Unexpected return status from server (").concat(P.status,")"));if(P.status==404&&!(a&8||a&16))throw new Error("Opening file ".concat(E.fileName," failed: Cannot write to non-existent file without FILE_FLAGS_FILE_CREATE or FILE_FLAGS_FILE_CREATE_NEW flag."));let T=s._malloc(1),Z=new Uint8Array;s.HEAPU8.set(Z,T);let G=s._malloc(3*8);return s.HEAPF64[(G>>3)+0]=1,s.HEAPF64[(G>>3)+1]=T,s.HEAPF64[(G>>3)+2]=new Date().getTime()/1e3,G}else if(!(a&1))throw new Error("Opening file ".concat(E.fileName," failed: unsupported file flags: ").concat(a));let D=null,U=null;if(!E.forceFullHttpReads&&(E.reliableHeadRequests||!E.allowFullHttpReads))try{let P=new XMLHttpRequest;E.dataProtocol==5?(P.open("HEAD",_e(E.s3Config,E.dataUrl),!1),fe(P,E.s3Config,E.dataUrl,"HEAD")):P.open("HEAD",E.dataUrl,!1),P.setRequestHeader("Range","bytes=0-"),P.send(null),D=null;try{D=P.getResponseHeader("Content-Length")}catch(T){console.warn("Failed to get Content-Length on request")}if(D!==null&&P.status==206){let T=s._malloc(24);s.HEAPF64[(T>>3)+0]=+D,s.HEAPF64[(T>>3)+1]=0;let Z=0;try{Z=new Date((i=P.getResponseHeader("Last-Modified"))!=null?i:"").getTime()/1e3}catch(G){console.warn("Failed to get Last-Modified on request")}return s.HEAPF64[(T>>3)+2]=+Z,T}}catch(P){U=P,console.warn("HEAD request with range header failed: ".concat(P))}if(E.allowFullHttpReads){if(!E.forceFullHttpReads){let T=new XMLHttpRequest;E.dataProtocol==5?(T.open("GET",_e(E.s3Config,E.dataUrl),!1),fe(T,E.s3Config,E.dataUrl,"GET")):T.open("GET",E.dataUrl,!1),T.responseType="arraybuffer",T.setRequestHeader("Range","bytes=0-0"),T.send(null);let Z=null;try{Z=T.getResponseHeader("Content-Length")}catch(Y){console.warn("Failed to get Content-Length on request")}let G=Z==null?void 0:Z.split("/")[1],te=Z,ne=null;if(G!==void 0)ne=G;else if(!E.reliableHeadRequests){let Y=new XMLHttpRequest;E.dataProtocol==5?(Y.open("HEAD",_e(E.s3Config,E.dataUrl),!1),fe(Y,E.s3Config,E.dataUrl,"HEAD")):Y.open("HEAD",E.dataUrl,!1),Y.setRequestHeader("Range","bytes=0-"),Y.send(null),D=null;try{D=Y.getResponseHeader("Content-Length")}catch(X){console.warn("Failed to get Content-Length on request")}D!==null&&+D>1&&(ne=D)}if(T.status==206&&te!==null&&+te==1&&ne!==null){let Y=s._malloc(24);s.HEAPF64[(Y>>3)+0]=+ne,s.HEAPF64[(Y>>3)+1]=0;let X=0;try{X=new Date((e=T.getResponseHeader("Last-Modified"))!=null?e:"").getTime()/1e3}catch(oe){console.warn("Failed to get Last-Modified on request")}return s.HEAPF64[(Y>>3)+2]=+X,Y}if(T.status==200&&te!==null&&D!==null&&+te==+D){console.warn("fall back to full HTTP read for: ".concat(E.dataUrl));let Y=s._malloc(T.response.byteLength),X=new Uint8Array(T.response,0,T.response.byteLength);s.HEAPU8.set(X,Y);let oe=s._malloc(3*8);s.HEAPF64[(oe>>3)+0]=T.response.byteLength,s.HEAPF64[(oe>>3)+1]=Y;let se=0;try{se=new Date((c=T.getResponseHeader("Last-Modified"))!=null?c:"").getTime()/1e3}catch(p){console.warn("Failed to get Last-Modified on request")}return s.HEAPF64[(oe>>3)+2]=+se,oe}console.warn("falling back to full HTTP read for: ".concat(E.dataUrl))}let P=new XMLHttpRequest;if(E.dataProtocol==5?(P.open("GET",_e(E.s3Config,E.dataUrl),!1),fe(P,E.s3Config,E.dataUrl,"GET")):P.open("GET",E.dataUrl,!1),P.responseType="arraybuffer",P.send(null),P.status==200){let T=s._malloc(P.response.byteLength),Z=new Uint8Array(P.response,0,P.response.byteLength);s.HEAPU8.set(Z,T);let G=s._malloc(3*8);s.HEAPF64[(G>>3)+0]=P.response.byteLength,s.HEAPF64[(G>>3)+1]=T;let te=0;try{te=new Date((l=P.getResponseHeader("Last-Modified"))!=null?l:"").getTime()/1e3}catch(ne){console.warn("Failed to get Last-Modified on request")}return s.HEAPF64[(G>>3)+2]=+te,G}}if(U!=null)throw new Error("Reading file ".concat(E.fileName," failed with error: ").concat(U));return 0}case 2:{let D=(f=L._files)==null?void 0:f.get(E.fileName);if(D){let T=s._malloc(24);return s.HEAPF64[(T>>3)+0]=D.size,s.HEAPF64[(T>>3)+1]=0,s.HEAPF64[(T>>3)+2]=0,T}if(a&128)return 0;console.warn("Buffering missing file: ".concat(E.fileName));let U=s._malloc(3*8),P=s._malloc(1);return s.HEAPF64[(U>>3)+0]=1,s.HEAPF64[(U>>3)+1]=P,s.HEAPF64[(U>>3)+2]=0,U}case 3:{let D=(u=L._files)==null?void 0:u.get(E.fileName);if(!D)throw new Error("No OPFS access handle registered with name: ".concat(E.fileName));a&16&&D.truncate(0);let U=s._malloc(3*8),P=D.getSize();return s.HEAPF64[(U>>3)+0]=P,s.HEAPF64[(U>>3)+1]=0,s.HEAPF64[(U>>3)+2]=0,U}}}catch(E){console.error(E.toString()),de(s,E.toString())}return 0},glob:(s,t,a)=>{var i;try{let e=M(s,t,a);if(e.startsWith("http")||e.startsWith("s3://")){let c=new XMLHttpRequest;if(e.startsWith("s3://")){let l=L.getGlobalFileInfo(s);c.open("HEAD",_e(l==null?void 0:l.s3Config,e),!1),fe(c,l==null?void 0:l.s3Config,e,"HEAD")}else c.open("HEAD",e,!1);if(c.send(null),c.status!=200&&c.status!==206){if(!((i=L.getGlobalFileInfo(s))!=null&&i.allowFullHttpReads))return console.log("HEAD request failed: ".concat(e,", with full http reads are disabled")),0;let l=new XMLHttpRequest;if(e.startsWith("s3://")){let u=L.getGlobalFileInfo(s);l.open("GET",_e(u==null?void 0:u.s3Config,e),!1),fe(l,u==null?void 0:u.s3Config,e,"HEAD")}else l.open("GET",e,!1);if(l.setRequestHeader("Range","bytes=0-0"),l.send(null),l.status!=200&&l.status!==206)return console.log("HEAD and GET requests failed: ".concat(e)),0;let f=null;try{f=l.getResponseHeader("Content-Length")}catch(u){console.warn("Failed to get Content-Length on request")}f&&+f>1&&console.warn("Range request for ".concat(e," did not return a partial response: ").concat(l.status,' "').concat(l.statusText,'"'))}s.ccall("duckdb_web_fs_glob_add_path",null,["string"],[e])}else for(let[c]of L._files.entries()||[])c.startsWith(e)&&s.ccall("duckdb_web_fs_glob_add_path",null,["string"],[c])}catch(e){return console.log(e),de(s,e.toString()),0}},checkFile:(s,t,a)=>{try{let i=M(s,t,a);if(i.startsWith("http")||i.startsWith("s3://")){let e=new XMLHttpRequest;if(i.startsWith("s3://")){let c=L.getGlobalFileInfo(s);e.open("HEAD",_e(c==null?void 0:c.s3Config,i),!1),fe(e,c==null?void 0:c.s3Config,i,"HEAD")}else e.open("HEAD",i,!1);return e.send(null),e.status==206||e.status==200}else return L._files.has(i)}catch(i){return console.log(i),!1}return!1},syncFile:(s,t)=>{},closeFile:(s,t)=>{var i;let a=L.getFileInfo(s,t);L._fileInfoCache.delete(t);try{switch(a==null?void 0:a.dataProtocol){case 0:case 4:case 5:break;case 1:case 2:return;case 3:{let e=(i=L._files)==null?void 0:i.get(a.fileName);if(!e)throw new Error("No OPFS access handle registered with name: ".concat(a.fileName));return e.flush()}}}catch(e){console.log(e),de(s,e.toString())}},dropFile:(s,t,a)=>{var c;let i=M(s,t,a),e=(c=L._files)==null?void 0:c.get(i);if(e){if(L._files.delete(i),e instanceof FileSystemSyncAccessHandle)try{e.flush(),e.close()}catch(l){throw new Error("Cannot drop file with name: ".concat(i))}e instanceof Blob}},truncateFile:(s,t,a)=>{var e;let i=L.getFileInfo(s,t);switch(i==null?void 0:i.dataProtocol){case 4:de(s,"Cannot truncate a http file");return;case 5:de(s,"Cannot truncate an s3 file");return;case 0:case 1:case 2:de(s,"truncateFile not implemented");return;case 3:{let c=(e=L._files)==null?void 0:e.get(i.fileName);if(!c)throw new Error("No OPFS access handle registered with name: ".concat(i.fileName));return c.truncate(a)}}return 0},readFile(s,t,a,i,e){var c;if(i==0)return 0;try{let l=L.getFileInfo(s,t);switch(l==null?void 0:l.dataProtocol){case 4:case 5:{if(!l.dataUrl)throw new Error("Missing data URL for file ".concat(t));try{let f=new XMLHttpRequest;if(l.dataProtocol==5?(f.open("GET",_e(l==null?void 0:l.s3Config,l.dataUrl),!1),fe(f,l==null?void 0:l.s3Config,l.dataUrl,"GET")):f.open("GET",l.dataUrl,!1),f.responseType="arraybuffer",f.setRequestHeader("Range","bytes=".concat(e,"-").concat(e+i-1)),f.send(null),f.status==206||f.status==200&&i==f.response.byteLength&&e==0){let u=new Uint8Array(f.response,0,Math.min(f.response.byteLength,i));return s.HEAPU8.set(u,a),u.byteLength}else if(f.status==200){console.warn("Range request for ".concat(l.dataUrl," did not return a partial response: ").concat(f.status,' "').concat(f.statusText,'"'));let u=new Uint8Array(f.response,e,Math.min(f.response.byteLength-e,i));return s.HEAPU8.set(u,a),u.byteLength}else throw new Error("Range request for ".concat(l.dataUrl," did returned non-success status: ").concat(f.status,' "').concat(f.statusText,'"'))}catch(f){throw console.log(f),new Error("Range request for ".concat(l.dataUrl," failed with error: ").concat(f,'"'))}}case 2:{let f=(c=L._files)==null?void 0:c.get(l.fileName);if(!f)throw new Error("No HTML5 file registered with name: ".concat(l.fileName));let u=f.slice(e,e+i),E=new Uint8Array(new FileReaderSync().readAsArrayBuffer(u));return s.HEAPU8.set(E,a),E.byteLength}case 3:{let f=L._files.get(l.fileName);if(!f)throw new Error("No OPFS access handle registered with name: ".concat(l.fileName));let u=s.HEAPU8.subarray(a,a+i);return f.read(u,{at:e})}}return 0}catch(l){return console.log(l),de(s,l.toString()),0}},writeFile:(s,t,a,i,e)=>{var l;let c=L.getFileInfo(s,t);switch(c==null?void 0:c.dataProtocol){case 4:return de(s,"Cannot write to HTTP file"),0;case 5:{let f=s.HEAPU8.subarray(a,a+i),u=new XMLHttpRequest;return u.open("PUT",_e(c==null?void 0:c.s3Config,c.dataUrl),!1),fe(u,c==null?void 0:c.s3Config,c.dataUrl,"PUT","",f),u.send(f),u.status!==200?(de(s,"Failed writing file: HTTP "+u.status),0):i}case 2:return de(s,"cannot write using the html5 file reader api"),0;case 3:{let f=(l=L._files)==null?void 0:l.get(c.fileName);if(!f)throw new Error("No OPFS access handle registered with name: ".concat(c.fileName));let u=s.HEAPU8.subarray(a,a+i);return f.write(u,{at:e})}}return 0},getLastFileModificationTime:(s,t)=>{var i;let a=L.getFileInfo(s,t);switch(a==null?void 0:a.dataProtocol){case 2:{if(!((i=L._files)==null?void 0:i.get(a.fileName)))throw Error("No handle available for file: ".concat(a.fileName));return 0}case 4:case 5:return new Date().getTime()/1e3}return 0},progressUpdate:(s,t,a)=>{postMessage&&postMessage({requestId:0,type:"PROGRESS_UPDATE",data:{status:s?"completed":"in-progress",percentage:t,repetitions:a}})},checkDirectory:(s,t,a)=>{let i=M(s,t,a);return console.log("checkDirectory: ".concat(i)),!1},createDirectory:(s,t,a)=>{let i=M(s,t,a);console.log("createDirectory: ".concat(i))},removeDirectory:(s,t,a)=>{let i=M(s,t,a);console.log("removeDirectory: ".concat(i))},listDirectoryEntries:(s,t,a)=>{let i=M(s,t,a);return console.log("listDirectoryEntries: ".concat(i)),!1},moveFile:(s,t,a,i,e)=>{var u,E;let c=M(s,t,a),l=M(s,i,e),f=(u=L._files)==null?void 0:u.get(c);f!==void 0&&(L._files.delete(f),L._files.set(l,f));for(let[D,U]of((E=L._fileInfoCache)==null?void 0:E.entries())||[])if(U.dataUrl==c){L._fileInfoCache.delete(D);break}return!0},removeFile:(s,t,a)=>{},callScalarUDF:(s,t,a,i,e,c,l)=>{Ge(L,s,t,a,i,e,c,l)}};var At=$r(Et());var Ye=class extends Ve{constructor(t,a,i,e){super(t,a),this.mainModuleURL=i,this.pthreadWorkerURL=e}locateFile(t,a){if(t.endsWith(".wasm"))return this.mainModuleURL;if(t.endsWith(".worker.js")){if(!this.pthreadWorkerURL)throw new Error("Missing DuckDB worker URL!");return this.pthreadWorkerURL}throw new Error("WASM instantiation requested unexpected file: prefix=".concat(a," path=").concat(t))}instantiateWasm(t,a){globalThis.DUCKDB_RUNTIME=this._runtime;let i=this.onInstantiationProgress;if(WebAssembly.instantiateStreaming)if(typeof TransformStream=="function"){let c=(async()=>{var Z;let l=new Request(this.mainModuleURL),f=await fetch(l),u=f.headers.get("content-length"),E=u&&parseInt(u,10)||0,D=new Date,U={startedAt:D,updatedAt:D,bytesTotal:E||0,bytesLoaded:0},P={transform(G,te){U.bytesLoaded+=G.byteLength;let ne=new Date;if(ne.getTime()-U.updatedAt.getTime()<20){U.updatedAt=ne,te.enqueue(G);return}for(let Y of i)Y(U);te.enqueue(G)}},T=new TransformStream(P);return new Response((Z=f.body)==null?void 0:Z.pipeThrough(T),f)})();WebAssembly.instantiateStreaming(c,t).then(l=>{a(l.instance,l.module)})}else{console.warn("instantiating without progress handler since transform streams are unavailable");let e=new Request(this.mainModuleURL);WebAssembly.instantiateStreaming(fetch(e),t).then(c=>{a(c.instance,c.module)})}else if(typeof XMLHttpRequest=="function"){let e=new XMLHttpRequest,c=this.mainModuleURL,l=new Date,f={startedAt:l,updatedAt:l,bytesTotal:0,bytesLoaded:0};e.open("GET",c),e.responseType="arraybuffer",e.onerror=u=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to load WASM: "+u}),new Error(u.toString())},e.onprogress=u=>{f.bytesTotal=u.total,f.bytesLoaded=u.loaded;let E=new Date;if(E.getTime()-f.updatedAt.getTime()<20){f.updatedAt=E;return}for(let D of i)D(f)},e.onload=()=>{WebAssembly.instantiate(e.response,t).then(u=>{a(u.instance,u.module)}).catch(u=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to instantiate WASM: "+u}),new Error(u)})},e.send()}else console.warn("instantiating with manual fetch since streaming instantiation and xhrs are unavailable"),(async()=>{let c=new Request(this.mainModuleURL),f=await(await fetch(c)).arrayBuffer();WebAssembly.instantiate(f,t).then(u=>{a(u.instance,u.module)})})();return[]}};var Ze=class extends Ye{constructor(t,a,i,e=null){super(t,a,i,e)}instantiateImpl(t){return(0,At.default)({...t,instantiateWasm:this.instantiateWasm.bind(this),locateFile:this.locateFile.bind(this)})}};async function Zo(s,t,a){var e;let i=(e=s.eh)!=null?e:s.mvp;if(!i)throw new Error("No suitable DuckDB bundle found");return new Ze(t,a,i.mainModule)}export{L as BROWSER_RUNTIME,nt as ConsoleLogger,rt as DEFAULT_RUNTIME,Gs as DuckDBAccessMode,Ve as DuckDBBindingsBase,We as DuckDBConnection,$e as DuckDBDataProtocol,js as DuckDBFeature,et as FileFlags,Ke as FileStatistics,Vr as IsArrowBuffer,Xr as IsDuckDBWasmRetry,$s as JSONTableShape,Xs as LogEvent,zs as LogLevel,Js as LogOrigin,Vs as LogTopic,lt as PACKAGE_NAME,ct as PACKAGE_VERSION,wo as PACKAGE_VERSION_MAJOR,vo as PACKAGE_VERSION_MINOR,Eo as PACKAGE_VERSION_PATCH,lr as PreparedStatement,qe as ResultStreamIterator,zr as StatusCode,Ks as TokenType,tt as VoidLogger,Q as callSRet,ke as copyBuffer,Zo as createDuckDB,qs as decodeText,ee as dropResponseBuffers,de as failWith,ko as getJsDelivrBundles,ho as getLogEventLabel,_o as getLogLevelLabel,po as getLogOriginLabel,bo as getLogTopicLabel,Zs as getPlatformFeatures,So as isFirefox,ut as isNode,Fo as isSafari,M as readString,Ro as selectBundle};
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
js-sha256/src/sha256.js:
|