@duckdb/duckdb-wasm 1.27.1-dev119.0 → 1.27.1-dev123.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 +3 -3
- package/dist/duckdb-browser-blocking.mjs +1 -1
- package/dist/duckdb-browser-blocking.mjs.map +3 -3
- 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-eh.worker.js +1 -1
- package/dist/duckdb-browser-eh.worker.js.map +3 -3
- package/dist/duckdb-browser-mvp.worker.js +1 -1
- package/dist/duckdb-browser-mvp.worker.js.map +3 -3
- package/dist/duckdb-browser.cjs +1 -1
- package/dist/duckdb-browser.cjs.map +1 -1
- package/dist/duckdb-browser.mjs +1 -1
- package/dist/duckdb-browser.mjs.map +1 -1
- package/dist/duckdb-coi.wasm +0 -0
- package/dist/duckdb-eh.wasm +0 -0
- package/dist/duckdb-mvp.wasm +0 -0
- package/dist/duckdb-node-blocking.cjs +4 -4
- package/dist/duckdb-node-blocking.cjs.map +3 -3
- package/dist/duckdb-node-eh.worker.cjs +4 -4
- package/dist/duckdb-node-eh.worker.cjs.map +3 -3
- package/dist/duckdb-node-mvp.worker.cjs +3 -3
- package/dist/duckdb-node-mvp.worker.cjs.map +3 -3
- package/dist/duckdb-node.cjs +1 -1
- package/dist/duckdb-node.cjs.map +1 -1
- package/dist/tests-browser.js +15 -21
- package/dist/tests-browser.js.map +2 -2
- package/dist/tests-node.cjs +15 -21
- package/dist/tests-node.cjs.map +3 -3
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var duckdb=(()=>{var mh=Object.create;var rs=Object.defineProperty;var yh=Object.getOwnPropertyDescriptor;var _h=Object.getOwnPropertyNames;var bh=Object.getPrototypeOf,gh=Object.prototype.hasOwnProperty;var Ko=(r,t)=>{if(t=Symbol[r])return t;throw Error("Symbol."+r+" is not defined")};var wh=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var ns=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Gr=(r,t)=>{for(var e in t)rs(r,e,{get:t[e],enumerable:!0})},Oc=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of _h(t))!gh.call(r,i)&&i!==e&&rs(r,i,{get:()=>t[i],enumerable:!(n=yh(t,i))||n.enumerable});return r};var Rc=(r,t,e)=>(e=r!=null?mh(bh(r)):{},Oc(t||!r||!r.__esModule?rs(e,"default",{value:r,enumerable:!0}):e,r)),vh=r=>Oc(rs({},"__esModule",{value:!0}),r);var Sh=function(r,t){this[0]=r,this[1]=t};var Kr=r=>{var t=r[Ko("asyncIterator")],e=!1,n,i={};return t==null?(t=r[Ko("iterator")](),n=s=>i[s]=o=>t[s](o)):(t=t.call(r),n=s=>i[s]=o=>{if(e){if(e=!1,s==="throw")throw o;return o}return e=!0,{done:!1,value:new Sh(new Promise(a=>{var l=t[s](o);if(!(l instanceof Object))throw TypeError("Object expected");a(l)}),1)}}),i[Ko("iterator")]=()=>i,n("next"),"throw"in t?n("throw"):i.throw=s=>{throw s},"return"in t&&n("return"),i};var bu=ns(()=>{});var gu=ns(()=>{});var Su=ns((vu,Ga)=>{"use strict";var wu=(()=>{var r=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(r=r||__filename),function(t={}){var e=t,n,i;e.ready=new Promise((c,u)=>{n=c,i=u});var s=Object.assign({},e),o=[],a="./this.program",l=(c,u)=>{throw u},f=typeof window=="object",m=typeof importScripts=="function",_=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",g="";function B(c){return e.locateFile?e.locateFile(c,g):g+c}var q,St,Bt,Dt;if(_){var Yt=bu(),Xt=gu();m?g=Xt.dirname(g)+"/":g=__dirname+"/",q=(c,u)=>(c=oc(c)?new URL(c):Xt.normalize(c),Yt.readFileSync(c,u?void 0:"utf8")),Bt=c=>{var u=q(c,!0);return u.buffer||(u=new Uint8Array(u)),u},St=(c,u,d,p=!0)=>{c=oc(c)?new URL(c):Xt.normalize(c),Yt.readFile(c,p?void 0:"utf8",(y,v)=>{y?d(y):u(p?v.buffer:v)})},!e.thisProgram&&process.argv.length>1&&(a=process.argv[1].replace(/\\/g,"/")),o=process.argv.slice(2),l=(c,u)=>{throw process.exitCode=c,u},e.inspect=()=>"[Emscripten Module object]"}else(f||m)&&(m?g=self.location.href:typeof document<"u"&&document.currentScript&&(g=document.currentScript.src),r&&(g=r),g.indexOf("blob:")!==0?g=g.substr(0,g.replace(/[?#].*/,"").lastIndexOf("/")+1):g="",q=c=>{var u=new XMLHttpRequest;return u.open("GET",c,!1),u.send(null),u.responseText},m&&(Bt=c=>{var u=new XMLHttpRequest;return u.open("GET",c,!1),u.responseType="arraybuffer",u.send(null),new Uint8Array(u.response)}),St=(c,u,d)=>{var p=new XMLHttpRequest;p.open("GET",c,!0),p.responseType="arraybuffer",p.onload=()=>{if(p.status==200||p.status==0&&p.response){u(p.response);return}d()},p.onerror=d,p.send(null)},Dt=c=>document.title=c);var Wn=e.print||console.log.bind(console),Pe=e.printErr||console.error.bind(console);Object.assign(e,s),s=null,e.arguments&&(o=e.arguments),e.thisProgram&&(a=e.thisProgram),e.quit&&(l=e.quit);var $r;e.wasmBinary&&($r=e.wasmBinary);var $i=e.noExitRuntime||!0;typeof WebAssembly!="object"&&Xr("no native wasm support detected");var Ir,J=!1,Et;function Gt(c,u){c||Xr(u)}var Ot,yt,gt,at,I,Rt,Mu,Uu;function tc(){var c=Ir.buffer;e.HEAP8=Ot=new Int8Array(c),e.HEAP16=gt=new Int16Array(c),e.HEAPU8=yt=new Uint8Array(c),e.HEAPU16=at=new Uint16Array(c),e.HEAP32=I=new Int32Array(c),e.HEAPU32=Rt=new Uint32Array(c),e.HEAPF32=Mu=new Float32Array(c),e.HEAPF64=Uu=new Float64Array(c)}var Nu,ec=[],rc=[],Lu=[],nc=[],ic=!1,ku=0;function Cu(){return $i||ku>0}function Pu(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)ju(e.preRun.shift());Yi(ec)}function Vu(){ic=!0,Yi(rc)}function Hu(){Yi(Lu)}function zu(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)$u(e.postRun.shift());Yi(nc)}function ju(c){ec.unshift(c)}function Wu(c){rc.unshift(c)}function $u(c){nc.unshift(c)}var Yr=0,Co=null,$n=null;function Yu(c){Yr++,e.monitorRunDependencies&&e.monitorRunDependencies(Yr)}function Xu(c){if(Yr--,e.monitorRunDependencies&&e.monitorRunDependencies(Yr),Yr==0&&(Co!==null&&(clearInterval(Co),Co=null),$n)){var u=$n;$n=null,u()}}function Xr(c){e.onAbort&&e.onAbort(c),c="Aborted("+c+")",Pe(c),J=!0,Et=1,c+=". Build with -sASSERTIONS for more info.",ic&&Ac();var u=new WebAssembly.RuntimeError(c);throw i(u),u}var Gu="data:application/octet-stream;base64,";function sc(c){return c.startsWith(Gu)}function oc(c){return c.startsWith("file://")}var pn;pn="./duckdb-eh.wasm",sc(pn)||(pn=B(pn));function ac(c){if(c==pn&&$r)return new Uint8Array($r);if(Bt)return Bt(c);throw"both async and sync fetching of the wasm failed"}function Ku(c){return!$r&&(f||m)&&typeof fetch=="function"?fetch(c,{credentials:"same-origin"}).then(u=>{if(!u.ok)throw"failed to load wasm binary file at '"+c+"'";return u.arrayBuffer()}).catch(()=>ac(c)):Promise.resolve().then(()=>ac(c))}function cc(c,u,d){return Ku(c).then(p=>WebAssembly.instantiate(p,u)).then(p=>p).then(d,p=>{Pe("failed to asynchronously prepare wasm: ".concat(p)),Xr(p)})}function Ju(c,u,d,p){return!c&&typeof WebAssembly.instantiateStreaming=="function"&&!sc(u)&&!_&&typeof fetch=="function"?fetch(u,{credentials:"same-origin"}).then(y=>{var v=WebAssembly.instantiateStreaming(y,d);return v.then(p,function(w){return Pe("wasm streaming compile failed: ".concat(w)),Pe("falling back to ArrayBuffer instantiation"),cc(u,d,p)})}):cc(u,d,p)}function qu(){var c={a:wf};function u(p,y){var v=p.exports;return v=ch(v),A=v,Ir=A.fa,tc(),Nu=A.ia,Wu(A.ga),Xu("wasm-instantiate"),v}Yu("wasm-instantiate");function d(p){u(p.instance)}if(e.instantiateWasm)try{return e.instantiateWasm(c,u)}catch(p){Pe("Module.instantiateWasm callback failed with error: ".concat(p)),i(p)}return Ju($r,pn,c,d).catch(i),{}}var fe,mn;function lc(c){this.name="ExitStatus",this.message="Program terminated with exit(".concat(c,")"),this.status=c}var Yi=c=>{for(;c.length>0;)c.shift()(e)},uc=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,dc=(c,u,d)=>{u>>>=0;for(var p=u+d,y=u;c[y]&&!(y>=p);)++y;if(y-u>16&&c.buffer&&uc)return uc.decode(c.subarray(u,y));for(var v="";u<y;){var w=c[u++];if(!(w&128)){v+=String.fromCharCode(w);continue}var S=c[u++]&63;if((w&224)==192){v+=String.fromCharCode((w&31)<<6|S);continue}var x=c[u++]&63;if((w&240)==224?w=(w&15)<<12|S<<6|x:w=(w&7)<<18|S<<12|x<<6|c[u++]&63,w<65536)v+=String.fromCharCode(w);else{var Z=w-65536;v+=String.fromCharCode(55296|Z>>10,56320|Z&1023)}}return v},yn=(c,u)=>(c>>>=0,c?dc(yt,c,u):""),Fr={varargs:void 0,get(){var c=I[Fr.varargs>>>2>>>0];return Fr.varargs+=4,c},getp(){return Fr.get()},getStr(c){var u=yn(c);return u}},Xi=(c,u)=>u+2097152>>>0<4194305-!!c?(c>>>0)+u*4294967296:NaN;function Zu(c,u,d,p,y){u>>>=0,d>>>=0,p>>>=0,y>>>=0;for(var v=0,w=u?I[u>>>2>>>0]:0,S=u?I[u+4>>>2>>>0]:0,x=d?I[d>>>2>>>0]:0,Z=d?I[d+4>>>2>>>0]:0,et=p?I[p>>>2>>>0]:0,Kt=p?I[p+4>>>2>>>0]:0,it=0,Ve=0,wt=0,Jt=0,ve=0,rr=0,b=(u?I[u>>>2>>>0]:0)|(d?I[d>>>2>>>0]:0)|(p?I[p>>>2>>>0]:0),O=(u?I[u+4>>>2>>>0]:0)|(d?I[d+4>>>2>>>0]:0)|(p?I[p+4>>>2>>>0]:0),ct=function(fh,hh,ph,Ec){return fh<32?hh&Ec:ph&Ec},st=0;st<c;st++){var Ht=1<<st%32;if(ct(st,b,O,Ht)){var Gn=Fr.getStreamFromFD(st),es=Fr.DEFAULT_POLLMASK;if(Gn.stream_ops.poll){var Dc=-1;if(y){var uh=u?I[y>>>2>>>0]:0,dh=u?I[y+8>>>2>>>0]:0;Dc=(uh+dh/1e6)*1e3}es=Gn.stream_ops.poll(Gn,Dc)}es&1&&ct(st,w,S,Ht)&&(st<32?it=it|Ht:Ve=Ve|Ht,v++),es&4&&ct(st,x,Z,Ht)&&(st<32?wt=wt|Ht:Jt=Jt|Ht,v++),es&2&&ct(st,et,Kt,Ht)&&(st<32?ve=ve|Ht:rr=rr|Ht,v++)}}return u&&(I[u>>>2>>>0]=it,I[u+4>>>2>>>0]=Ve),d&&(I[d>>>2>>>0]=wt,I[d+4>>>2>>>0]=Jt),p&&(I[p>>>2>>>0]=ve,I[p+4>>>2>>>0]=rr),v}function fc(){Xr("missing function: $SOCKFS")}fc.stub=!0;function Po(){Xr("missing function: $FS")}Po.stub=!0;var Yn=c=>{var u=fc.getSocket(c);if(!u)throw new Po.ErrnoError(8);return u},Vo=c=>(c&255)+"."+(c>>8&255)+"."+(c>>16&255)+"."+(c>>24&255),hc=c=>{var u="",d=0,p=0,y=0,v=0,w=0,S=0,x=[c[0]&65535,c[0]>>16,c[1]&65535,c[1]>>16,c[2]&65535,c[2]>>16,c[3]&65535,c[3]>>16],Z=!0,et="";for(S=0;S<5;S++)if(x[S]!==0){Z=!1;break}if(Z){if(et=Vo(x[6]|x[7]<<16),x[5]===-1)return u="::ffff:",u+=et,u;if(x[5]===0)return u="::",et==="0.0.0.0"&&(et=""),et==="0.0.0.1"&&(et="1"),u+=et,u}for(d=0;d<8;d++)x[d]===0&&(d-y>1&&(w=0),y=d,w++),w>p&&(p=w,v=d-p+1);for(d=0;d<8;d++){if(p>1&&x[d]===0&&d>=v&&d<v+p){d===v&&(u+=":",v===0&&(u+=":"));continue}u+=Number($o(x[d]&65535)).toString(16),u+=d<7?":":""}return u},pc=(c,u)=>{var d=gt[c>>>1>>>0],p=$o(at[c+2>>>1>>>0]),y;switch(d){case 2:if(u!==16)return{errno:28};y=I[c+4>>>2>>>0],y=Vo(y);break;case 10:if(u!==28)return{errno:28};y=[I[c+8>>>2>>>0],I[c+12>>>2>>>0],I[c+16>>>2>>>0],I[c+20>>>2>>>0]],y=hc(y);break;default:return{errno:5}}return{family:d,addr:y,port:p}},Gi=c=>{for(var u=c.split("."),d=0;d<4;d++){var p=Number(u[d]);if(isNaN(p))return null;u[d]=p}return(u[0]|u[1]<<8|u[2]<<16|u[3]<<24)>>>0},Ki=c=>parseInt(c),Ho=c=>{var u,d,p,y,v=/^((?=.*::)(?!.*::.+::)(::)?([\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,w=[];if(!v.test(c))return null;if(c==="::")return[0,0,0,0,0,0,0,0];for(c.startsWith("::")?c=c.replace("::","Z:"):c=c.replace("::",":Z:"),c.indexOf(".")>0?(c=c.replace(new RegExp("[.]","g"),":"),u=c.split(":"),u[u.length-4]=Ki(u[u.length-4])+Ki(u[u.length-3])*256,u[u.length-3]=Ki(u[u.length-2])+Ki(u[u.length-1])*256,u=u.slice(0,u.length-2)):u=c.split(":"),p=0,y=0,d=0;d<u.length;d++)if(typeof u[d]=="string")if(u[d]==="Z"){for(y=0;y<8-u.length+1;y++)w[d+y]=0;p=y-1}else w[d+p]=Zi(parseInt(u[d],16));else w[d+p]=u[d];return[w[1]<<16|w[0],w[3]<<16|w[2],w[5]<<16|w[4],w[7]<<16|w[6]]},he={address_map:{id:1,addrs:{},names:{}},lookup_name(c){var u=Gi(c);if(u!==null||(u=Ho(c),u!==null))return c;var d;if(he.address_map.addrs[c])d=he.address_map.addrs[c];else{var p=he.address_map.id++;Gt(p<65535,"exceeded max address mappings of 65535"),d="172.29."+(p&255)+"."+(p&65280),he.address_map.names[d]=c,he.address_map.addrs[c]=d}return d},lookup_addr(c){return he.address_map.names[c]?he.address_map.names[c]:null}},mc=(c,u,d)=>{if(d&&c===0)return null;var p=pc(c,u);if(p.errno)throw new Po.ErrnoError(p.errno);return p.addr=he.lookup_addr(p.addr)||p.addr,p};function Qu(c,u,d,p,y,v){u>>>=0,d>>>=0;var w=Yn(c),S=mc(u,d);return w.sock_ops.bind(w,S.addr,S.port),0}function td(c,u,d,p,y,v){u>>>=0,d>>>=0;var w=Yn(c),S=mc(u,d);return w.sock_ops.connect(w,S.addr,S.port),0}function ed(c,u,d,p){u>>>=0}function rd(c,u,d){return d>>>=0,Fr.varargs=d,0}function nd(c,u){u>>>=0}function id(c,u,d){var p=Xi(u,d)}var yc=(c,u,d,p)=>{if(d>>>=0,!(p>0))return 0;for(var y=d,v=d+p-1,w=0;w<c.length;++w){var S=c.charCodeAt(w);if(S>=55296&&S<=57343){var x=c.charCodeAt(++w);S=65536+((S&1023)<<10)|x&1023}if(S<=127){if(d>=v)break;u[d++>>>0]=S}else if(S<=2047){if(d+1>=v)break;u[d++>>>0]=192|S>>6,u[d++>>>0]=128|S&63}else if(S<=65535){if(d+2>=v)break;u[d++>>>0]=224|S>>12,u[d++>>>0]=128|S>>6&63,u[d++>>>0]=128|S&63}else{if(d+3>=v)break;u[d++>>>0]=240|S>>18,u[d++>>>0]=128|S>>12&63,u[d++>>>0]=128|S>>6&63,u[d++>>>0]=128|S&63}}return u[d>>>0]=0,d-y},zo=(c,u,d)=>yc(c,yt,u,d);function sd(c,u,d){u>>>=0,d>>>=0}var _c=(c,u)=>(yt.fill(0,c,c+u),c),jo=(c,u,d,p,y)=>{switch(u){case 2:d=Gi(d),_c(c,16),y&&(I[y>>>2>>>0]=16),gt[c>>>1>>>0]=u,I[c+4>>>2>>>0]=d,gt[c+2>>>1>>>0]=Zi(p);break;case 10:d=Ho(d),_c(c,28),y&&(I[y>>>2>>>0]=28),I[c>>>2>>>0]=u,I[c+8>>>2>>>0]=d[0],I[c+12>>>2>>>0]=d[1],I[c+16>>>2>>>0]=d[2],I[c+20>>>2>>>0]=d[3],gt[c+2>>>1>>>0]=Zi(p);break;default:return 5}return 0};function od(c,u,d,p,y,v){u>>>=0,d>>>=0;var w=Yn(c);if(!w.daddr)return-53;var S=jo(u,w.family,he.lookup_name(w.daddr),w.dport,d);return 0}function ad(c,u,d,p,y,v){p>>>=0,y>>>=0;var w=Yn(c);return u===1&&d===4?(I[p>>>2>>>0]=w.error,I[y>>>2>>>0]=4,w.error=null,0):-50}function cd(c,u,d){return d>>>=0,Fr.varargs=d,0}function ld(c,u){c>>>=0,u>>>=0}function ud(c,u,d){u>>>=0}function dd(c,u,d,p){u>>>=0,d>>>=0}function fd(c,u,d,p){u>>>=0,p>>>=0,Fr.varargs=p}function hd(c,u,d,p,y,v){u>>>=0,d>>>=0,y>>>=0,v>>>=0;var w=Yn(c),S=w.sock_ops.recvmsg(w,d);if(!S)return 0;if(y)var x=jo(y,w.family,he.lookup_name(S.addr),S.port,v);return yt.set(S.buffer,u>>>0),S.buffer.byteLength}function pd(c,u,d,p){u>>>=0,p>>>=0}function md(c){c>>>=0}function yd(c,u,d,p,y,v){u>>>=0,d>>>=0,y>>>=0,v>>>=0}var _d=(c,u,d)=>{};function bd(c,u){c>>>=0,u>>>=0}function gd(c,u,d){u>>>=0}var wd=!0,vd=()=>wd,Sd=()=>{Xr("")};function Id(c,u){return globalThis.DUCKDB_RUNTIME.createDirectory(e,c,u)}function Fd(c,u){return globalThis.DUCKDB_RUNTIME.checkDirectory(e,c,u)}function Bd(c,u){return globalThis.DUCKDB_RUNTIME.listDirectoryEntries(e,c,u)}function Ad(c,u){return globalThis.DUCKDB_RUNTIME.removeDirectory(e,c,u)}function Td(c){return globalThis.DUCKDB_RUNTIME.closeFile(e,c)}function xd(c,u){return globalThis.DUCKDB_RUNTIME.checkFile(e,c,u)}function Dd(c){return globalThis.DUCKDB_RUNTIME.getLastFileModificationTime(e,c)}function Ed(c,u,d,p){return globalThis.DUCKDB_RUNTIME.moveFile(e,c,u,d,p)}function Od(c,u){return globalThis.DUCKDB_RUNTIME.openFile(e,c,u)}function Rd(c,u,d,p){return globalThis.DUCKDB_RUNTIME.readFile(e,c,u,d,p)}function Md(c,u){return globalThis.DUCKDB_RUNTIME.truncateFile(e,c,u)}function Ud(c,u,d,p){return globalThis.DUCKDB_RUNTIME.writeFile(e,c,u,d,p)}function Nd(c){return globalThis.DUCKDB_RUNTIME.getDefaultDataProtocol(c)}function Ld(c,u){return globalThis.DUCKDB_RUNTIME.glob(e,c,u)}function kd(c){return globalThis.DUCKDB_RUNTIME.testPlatformFeature(e,c)}function Cd(c,u,d,p,y,v){return globalThis.DUCKDB_RUNTIME.callScalarUDF(e,c,u,d,p,y,v)}var Pd=()=>Date.now(),bc=()=>4294901760;function Vd(){return bc()}var gc;gc=()=>performance.now();function Hd(c,u,d){return c>>>=0,u>>>=0,d>>>=0,yt.copyWithin(c>>>0,u>>>0,u+d>>>0)}var zd=c=>{var u=Ir.buffer,d=(c-u.byteLength+65535)/65536;try{return Ir.grow(d),tc(),1}catch(p){}};function jd(c){c>>>=0;var u=yt.length,d=bc();if(c>d)return!1;for(var p=(x,Z)=>x+(Z-x%Z)%Z,y=1;y<=4;y*=2){var v=u*(1+.2/y);v=Math.min(v,c+100663296);var w=Math.min(d,p(Math.max(c,v),65536)),S=zd(w);if(S)return!0}return!1}var Wo={},Wd=()=>a||"./this.program",Xn=()=>{if(!Xn.strings){var c=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",u={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:c,_:Wd()};for(var d in Wo)Wo[d]===void 0?delete u[d]:u[d]=Wo[d];var p=[];for(var d in u)p.push("".concat(d,"=").concat(u[d]));Xn.strings=p}return Xn.strings},$d=(c,u)=>{for(var d=0;d<c.length;++d)Ot[u++>>>0>>>0]=c.charCodeAt(d);Ot[u>>>0>>>0]=0},Yd=function(c,u){c>>>=0,u>>>=0;var d=0;return Xn().forEach((p,y)=>{var v=u+d;Rt[c+y*4>>>2>>>0]=v,$d(p,v),d+=p.length+1}),0},Xd=function(c,u){c>>>=0,u>>>=0;var d=Xn();Rt[c>>>2>>>0]=d.length;var p=0;return d.forEach(y=>p+=y.length+1),Rt[u>>>2>>>0]=p,0},Gd=c=>52;function Kd(c,u){u>>>=0;var d=0,p=0,y=0;{var v=2;c==0?d=2:(c==1||c==2)&&(d=64),y=1}return Ot[u>>>0>>>0]=v,gt[u+2>>>1>>>0]=y,mn=[d>>>0,(fe=d,+Math.abs(fe)>=1?fe>0?+Math.floor(fe/4294967296)>>>0:~~+Math.ceil((fe-+(~~fe>>>0))/4294967296)>>>0:0)],I[u+8>>>2>>>0]=mn[0],I[u+12>>>2>>>0]=mn[1],mn=[p>>>0,(fe=p,+Math.abs(fe)>=1?fe>0?+Math.floor(fe/4294967296)>>>0:~~+Math.ceil((fe-+(~~fe>>>0))/4294967296)>>>0:0)],I[u+16>>>2>>>0]=mn[0],I[u+20>>>2>>>0]=mn[1],0}function Jd(c,u,d,p,y,v){u>>>=0,d>>>=0;var w=Xi(p,y);return v>>>=0,52}function qd(c,u,d,p,y,v){u>>>=0,d>>>=0;var w=Xi(p,y);return v>>>=0,52}function Zd(c,u,d,p){return u>>>=0,d>>>=0,p>>>=0,52}function Qd(c,u,d,p,y){var v=Xi(u,d);return y>>>=0,70}var tf=c=>52,ef=[null,[],[]],rf=(c,u)=>{var d=ef[c];u===0||u===10?((c===1?Wn:Pe)(dc(d,0)),d.length=0):d.push(u)};function nf(c,u,d,p){u>>>=0,d>>>=0,p>>>=0;for(var y=0,v=0;v<d;v++){var w=Rt[u>>>2>>>0],S=Rt[u+4>>>2>>>0];u+=8;for(var x=0;x<S;x++)rf(c,yt[w+x>>>0]);y+=S}return Rt[p>>>2>>>0]=y,0}function sf(c,u,d,p){c>>>=0,u>>>=0,d>>>=0,p>>>=0;var y=0,v=0,w=0,S=0,x=0,Z=0,et;function Kt(it,Ve,wt,Jt,ve,rr){var b,O,ct,st;return O=it===10?28:16,ve=it===10?hc(ve):Vo(ve),b=Yo(O),st=jo(b,it,ve,rr),Gt(!st),ct=Yo(32),I[ct+4>>>2>>>0]=it,I[ct+8>>>2>>>0]=Ve,I[ct+12>>>2>>>0]=wt,Rt[ct+24>>>2>>>0]=Jt,Rt[ct+20>>>2>>>0]=b,it===10?I[ct+16>>>2>>>0]=28:I[ct+16>>>2>>>0]=16,I[ct+28>>>2>>>0]=0,ct}if(d&&(w=I[d>>>2>>>0],S=I[d+4>>>2>>>0],x=I[d+8>>>2>>>0],Z=I[d+12>>>2>>>0]),x&&!Z&&(Z=x===2?17:6),!x&&Z&&(x=Z===17?2:1),Z===0&&(Z=6),x===0&&(x=1),!c&&!u)return-2;if(w&-1088||d!==0&&I[d>>>2>>>0]&2&&!c)return-1;if(w&32)return-2;if(x!==0&&x!==1&&x!==2)return-7;if(S!==0&&S!==2&&S!==10)return-6;if(u&&(u=yn(u),v=parseInt(u,10),isNaN(v)))return w&1024?-2:-8;if(!c)return S===0&&(S=2),w&1||(S===2?y=qi(2130706433):y=[0,0,0,1]),et=Kt(S,x,Z,null,y,v),Rt[p>>>2>>>0]=et,0;if(c=yn(c),y=Gi(c),y!==null)if(S===0||S===2)S=2;else if(S===10&&w&8)y=[0,0,qi(65535),y],S=10;else return-2;else if(y=Ho(c),y!==null)if(S===0||S===10)S=10;else return-2;return y!=null?(et=Kt(S,x,Z,c,y,v),Rt[p>>>2>>>0]=et,0):w&4?-2:(c=he.lookup_name(c),y=Gi(c),S===0?S=2:S===10&&(y=[0,0,qi(65535),y]),et=Kt(S,x,Z,null,y,v),Rt[p>>>2>>>0]=et,0)}var of=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return p=>crypto.getRandomValues(p);if(_)try{var c=wh("crypto"),u=c.randomFillSync;if(u)return p=>c.randomFillSync(p);var d=c.randomBytes;return p=>(p.set(d(p.byteLength)),p)}catch(p){}Xr("initRandomDevice")},wc=c=>(wc=of())(c);function af(c,u){return c>>>=0,u>>>=0,wc(yt.subarray(c>>>0,c+u>>>0)),0}function cf(c,u,d,p,y,v,w){c>>>=0,d>>>=0,y>>>=0;var S=pc(c,u);if(S.errno)return-6;var x=S.port,Z=S.addr,et=!1;if(d&&p){var Kt;if(w&1||!(Kt=he.lookup_addr(Z))){if(w&8)return-2}else Z=Kt;var it=zo(Z,d,p);it+1>=p&&(et=!0)}if(y&&v){x=""+x;var it=zo(x,y,v);it+1>=v&&(et=!0)}return et?-12:0}var Ji=c=>c%4===0&&(c%100!==0||c%400===0),lf=(c,u)=>{for(var d=0,p=0;p<=u;d+=c[p++]);return d},vc=[31,29,31,30,31,30,31,31,30,31,30,31],Sc=[31,28,31,30,31,30,31,31,30,31,30,31],uf=(c,u)=>{for(var d=new Date(c.getTime());u>0;){var p=Ji(d.getFullYear()),y=d.getMonth(),v=(p?vc:Sc)[y];if(u>v-d.getDate())u-=v-d.getDate()+1,d.setDate(1),y<11?d.setMonth(y+1):(d.setMonth(0),d.setFullYear(d.getFullYear()+1));else return d.setDate(d.getDate()+u),d}return d},Ic=c=>{for(var u=0,d=0;d<c.length;++d){var p=c.charCodeAt(d);p<=127?u++:p<=2047?u+=2:p>=55296&&p<=57343?(u+=4,++d):u+=3}return u};function df(c,u,d){var p=d>0?d:Ic(c)+1,y=new Array(p),v=yc(c,y,0,y.length);return u&&(y.length=v),y}var Fc=(c,u)=>{Ot.set(c,u>>>0)};function ff(c,u,d,p){c>>>=0,u>>>=0,d>>>=0,p>>>=0;var y=Rt[p+40>>>2>>>0],v={tm_sec:I[p>>>2>>>0],tm_min:I[p+4>>>2>>>0],tm_hour:I[p+8>>>2>>>0],tm_mday:I[p+12>>>2>>>0],tm_mon:I[p+16>>>2>>>0],tm_year:I[p+20>>>2>>>0],tm_wday:I[p+24>>>2>>>0],tm_yday:I[p+28>>>2>>>0],tm_isdst:I[p+32>>>2>>>0],tm_gmtoff:I[p+36>>>2>>>0],tm_zone:y?yn(y):""},w=yn(d),S={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var x in S)w=w.replace(new RegExp(x,"g"),S[x]);var Z=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],et=["January","February","March","April","May","June","July","August","September","October","November","December"];function Kt(b,O,ct){for(var st=typeof b=="number"?b.toString():b||"";st.length<O;)st=ct[0]+st;return st}function it(b,O){return Kt(b,O,"0")}function Ve(b,O){function ct(Ht){return Ht<0?-1:Ht>0?1:0}var st;return(st=ct(b.getFullYear()-O.getFullYear()))===0&&(st=ct(b.getMonth()-O.getMonth()))===0&&(st=ct(b.getDate()-O.getDate())),st}function wt(b){switch(b.getDay()){case 0:return new Date(b.getFullYear()-1,11,29);case 1:return b;case 2:return new Date(b.getFullYear(),0,3);case 3:return new Date(b.getFullYear(),0,2);case 4:return new Date(b.getFullYear(),0,1);case 5:return new Date(b.getFullYear()-1,11,31);case 6:return new Date(b.getFullYear()-1,11,30)}}function Jt(b){var O=uf(new Date(b.tm_year+1900,0,1),b.tm_yday),ct=new Date(O.getFullYear(),0,4),st=new Date(O.getFullYear()+1,0,4),Ht=wt(ct),Gn=wt(st);return Ve(Ht,O)<=0?Ve(Gn,O)<=0?O.getFullYear()+1:O.getFullYear():O.getFullYear()-1}var ve={"%a":b=>Z[b.tm_wday].substring(0,3),"%A":b=>Z[b.tm_wday],"%b":b=>et[b.tm_mon].substring(0,3),"%B":b=>et[b.tm_mon],"%C":b=>{var O=b.tm_year+1900;return it(O/100|0,2)},"%d":b=>it(b.tm_mday,2),"%e":b=>Kt(b.tm_mday,2," "),"%g":b=>Jt(b).toString().substring(2),"%G":b=>Jt(b),"%H":b=>it(b.tm_hour,2),"%I":b=>{var O=b.tm_hour;return O==0?O=12:O>12&&(O-=12),it(O,2)},"%j":b=>it(b.tm_mday+lf(Ji(b.tm_year+1900)?vc:Sc,b.tm_mon-1),3),"%m":b=>it(b.tm_mon+1,2),"%M":b=>it(b.tm_min,2),"%n":()=>"\n","%p":b=>b.tm_hour>=0&&b.tm_hour<12?"AM":"PM","%S":b=>it(b.tm_sec,2),"%t":()=>" ","%u":b=>b.tm_wday||7,"%U":b=>{var O=b.tm_yday+7-b.tm_wday;return it(Math.floor(O/7),2)},"%V":b=>{var O=Math.floor((b.tm_yday+7-(b.tm_wday+6)%7)/7);if((b.tm_wday+371-b.tm_yday-2)%7<=2&&O++,O){if(O==53){var st=(b.tm_wday+371-b.tm_yday)%7;st!=4&&(st!=3||!Ji(b.tm_year))&&(O=1)}}else{O=52;var ct=(b.tm_wday+7-b.tm_yday-1)%7;(ct==4||ct==5&&Ji(b.tm_year%400-1))&&O++}return it(O,2)},"%w":b=>b.tm_wday,"%W":b=>{var O=b.tm_yday+7-(b.tm_wday+6)%7;return it(Math.floor(O/7),2)},"%y":b=>(b.tm_year+1900).toString().substring(2),"%Y":b=>b.tm_year+1900,"%z":b=>{var O=b.tm_gmtoff,ct=O>=0;return O=Math.abs(O)/60,O=O/60*100+O%60,(ct?"+":"-")+("0000"+O).slice(-4)},"%Z":b=>b.tm_zone,"%%":()=>"%"};w=w.replace(/%%/g,"\0\0");for(var x in ve)w.includes(x)&&(w=w.replace(new RegExp(x,"g"),ve[x](v)));w=w.replace(/\0\0/g,"%");var rr=df(w,!1);return rr.length>u?0:(Fc(rr,c),rr.length-1)}function hf(c,u,d,p,y){return c>>>=0,u>>>=0,d>>>=0,p>>>=0,y>>>=0,ff(c,u,d,p)}var pf=c=>{Et=c,Cu()||(e.onExit&&e.onExit(c),J=!0),l(c,new lc(c))},mf=(c,u)=>{Et=c,pf(c)},yf=c=>{if(c instanceof lc||c=="unwind")return Et;l(1,c)},_f=c=>{var u=e["_"+c];return u},bf=c=>{var u=Ic(c)+1,d=Qi(u);return zo(c,d,u),d},gf=(c,u,d,p,y)=>{var v={string:wt=>{var Jt=0;return wt!=null&&wt!==0&&(Jt=bf(wt)),Jt},array:wt=>{var Jt=Qi(wt.length);return Fc(wt,Jt),Jt}};function w(wt){return u==="string"?yn(wt):u==="boolean"?!!wt:wt}var S=_f(c),x=[],Z=0;if(p)for(var et=0;et<p.length;et++){var Kt=v[d[et]];Kt?(Z===0&&(Z=Xo()),x[et]=Kt(p[et])):x[et]=p[et]}var it=S.apply(null,x);function Ve(wt){return Z!==0&&Go(Z),w(wt)}return it=Ve(it),it},wf={Z:Zu,ba:Qu,aa:td,V:ed,a:rd,U:nd,v:id,P:sd,X:od,Y:ad,o:cd,R:ld,Q:ud,S:dd,p:fd,_:hd,N:pd,j:md,$:yd,l:_d,T:bd,k:gd,q:vd,d:Sd,F:Id,G:Fd,D:Bd,E:Ad,h:Td,A:xd,u:Dd,B:Ed,I:Od,e:Rd,H:Md,i:Ud,J:Nd,z:Ld,g:kd,L:Cd,r:Pd,s:Vd,c:gc,da:Hd,ea:jd,C:Yd,K:Xd,b:Gd,ca:Kd,x:Jd,w:qd,n:Zd,y:Qd,O:tf,f:nf,m:sf,M:af,W:cf,t:hf},A=qu(),vf=()=>(vf=A.ga)(),Bc=e._main=(c,u)=>(Bc=e._main=A.ha)(c,u),Sf=e._duckdb_web_fs_glob_add_path=c=>(Sf=e._duckdb_web_fs_glob_add_path=A.ja)(c),If=e._duckdb_web_clear_response=()=>(If=e._duckdb_web_clear_response=A.ka)(),Ff=e._duckdb_web_fail_with=c=>(Ff=e._duckdb_web_fail_with=A.la)(c),Bf=e._duckdb_web_reset=c=>(Bf=e._duckdb_web_reset=A.ma)(c),Af=e._duckdb_web_connect=()=>(Af=e._duckdb_web_connect=A.na)(),Tf=e._duckdb_web_disconnect=c=>(Tf=e._duckdb_web_disconnect=A.oa)(c),xf=e._duckdb_web_flush_files=()=>(xf=e._duckdb_web_flush_files=A.pa)(),Df=e._duckdb_web_flush_file=c=>(Df=e._duckdb_web_flush_file=A.qa)(c),Ef=e._duckdb_web_open=(c,u)=>(Ef=e._duckdb_web_open=A.ra)(c,u),Of=e._duckdb_web_get_global_file_info=(c,u)=>(Of=e._duckdb_web_get_global_file_info=A.sa)(c,u),Rf=e._duckdb_web_collect_file_stats=(c,u,d)=>(Rf=e._duckdb_web_collect_file_stats=A.ta)(c,u,d),Mf=e._duckdb_web_export_file_stats=(c,u)=>(Mf=e._duckdb_web_export_file_stats=A.ua)(c,u),Uf=e._duckdb_web_fs_drop_file=(c,u)=>(Uf=e._duckdb_web_fs_drop_file=A.va)(c,u),Nf=e._duckdb_web_fs_drop_files=c=>(Nf=e._duckdb_web_fs_drop_files=A.wa)(c),Lf=e._duckdb_web_fs_glob_file_infos=(c,u)=>(Lf=e._duckdb_web_fs_glob_file_infos=A.xa)(c,u),kf=e._duckdb_web_fs_get_file_info_by_id=(c,u,d)=>(kf=e._duckdb_web_fs_get_file_info_by_id=A.ya)(c,u,d),Cf=e._duckdb_web_fs_get_file_info_by_name=(c,u,d)=>(Cf=e._duckdb_web_fs_get_file_info_by_name=A.za)(c,u,d),Pf=e._duckdb_web_fs_register_file_url=(c,u,d,p,y)=>(Pf=e._duckdb_web_fs_register_file_url=A.Aa)(c,u,d,p,y),Vf=e._duckdb_web_fs_register_file_buffer=(c,u,d,p)=>(Vf=e._duckdb_web_fs_register_file_buffer=A.Ba)(c,u,d,p),Hf=e._duckdb_web_copy_file_to_buffer=(c,u)=>(Hf=e._duckdb_web_copy_file_to_buffer=A.Ca)(c,u),zf=e._duckdb_web_copy_file_to_path=(c,u,d)=>(zf=e._duckdb_web_copy_file_to_path=A.Da)(c,u,d),jf=e._duckdb_web_get_version=c=>(jf=e._duckdb_web_get_version=A.Ea)(c),Wf=e._duckdb_web_get_feature_flags=()=>(Wf=e._duckdb_web_get_feature_flags=A.Fa)(),$f=e._duckdb_web_tokenize=(c,u)=>($f=e._duckdb_web_tokenize=A.Ga)(c,u),Yf=e._duckdb_web_udf_scalar_create=(c,u,d)=>(Yf=e._duckdb_web_udf_scalar_create=A.Ha)(c,u,d),Xf=e._duckdb_web_prepared_create=(c,u,d)=>(Xf=e._duckdb_web_prepared_create=A.Ia)(c,u,d),Gf=e._duckdb_web_prepared_close=(c,u,d)=>(Gf=e._duckdb_web_prepared_close=A.Ja)(c,u,d),Kf=e._duckdb_web_prepared_run=(c,u,d,p)=>(Kf=e._duckdb_web_prepared_run=A.Ka)(c,u,d,p),Jf=e._duckdb_web_prepared_send=(c,u,d,p)=>(Jf=e._duckdb_web_prepared_send=A.La)(c,u,d,p),qf=e._duckdb_web_query_run=(c,u,d)=>(qf=e._duckdb_web_query_run=A.Ma)(c,u,d),Zf=e._duckdb_web_pending_query_start=(c,u,d)=>(Zf=e._duckdb_web_pending_query_start=A.Na)(c,u,d),Qf=e._duckdb_web_pending_query_poll=(c,u,d)=>(Qf=e._duckdb_web_pending_query_poll=A.Oa)(c,u,d),th=e._duckdb_web_pending_query_cancel=(c,u)=>(th=e._duckdb_web_pending_query_cancel=A.Pa)(c,u),eh=e._duckdb_web_query_fetch_results=(c,u)=>(eh=e._duckdb_web_query_fetch_results=A.Qa)(c,u),rh=e._duckdb_web_get_tablenames=(c,u,d)=>(rh=e._duckdb_web_get_tablenames=A.Ra)(c,u,d),nh=e._duckdb_web_insert_arrow_from_ipc_stream=(c,u,d,p,y)=>(nh=e._duckdb_web_insert_arrow_from_ipc_stream=A.Sa)(c,u,d,p,y),ih=e._duckdb_web_insert_csv_from_path=(c,u,d,p)=>(ih=e._duckdb_web_insert_csv_from_path=A.Ta)(c,u,d,p),sh=e._duckdb_web_insert_json_from_path=(c,u,d,p)=>(sh=e._duckdb_web_insert_json_from_path=A.Ua)(c,u,d,p),oh=()=>(oh=A.__errno_location)(),qi=c=>(qi=A.Va)(c),Zi=c=>(Zi=A.Wa)(c),$o=c=>($o=A.Xa)(c),Yo=e._malloc=c=>(Yo=e._malloc=A.Ya)(c),ah=e._free=c=>(ah=e._free=A.Za)(c),Ac=()=>(Ac=A._a)(),Xo=()=>(Xo=A.$a)(),Go=c=>(Go=A.ab)(c),Qi=c=>(Qi=A.bb)(c);function ch(c){c=Object.assign({},c);var u=p=>()=>p()>>>0,d=p=>y=>p(y)>>>0;return c.__errno_location=u(c.__errno_location),c.Ya=d(c.Ya),c.$a=u(c.$a),c.bb=d(c.bb),c}e.stackAlloc=Qi,e.stackSave=Xo,e.stackRestore=Go,e.ccall=gf;var ts;$n=function c(){ts||Tc(),ts||($n=c)};function lh(){var c=Bc,u=0,d=0;try{var p=c(u,d);return mf(p,!0),p}catch(y){return yf(y)}}function Tc(){if(Yr>0||(Pu(),Yr>0))return;function c(){ts||(ts=!0,e.calledRun=!0,!J&&(Vu(),Hu(),n(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),xc&&lh(),zu()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),c()},1)):c()}if(e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();var xc=!0;return e.noInitialRun&&(xc=!1),Tc(),t.ready}})();typeof vu=="object"&&typeof Ga=="object"?Ga.exports=wu:typeof define=="function"&&define.amd&&define([],()=>wu)});var xu=ns((exports,module)=>{(function(){"use strict";var ERROR="input is invalid type",WINDOW=typeof window=="object",root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&typeof self=="object",NODE_JS=!root.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&typeof module=="object"&&module.exports,AMD=typeof define=="function"&&define.amd,ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[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],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];(root.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(r){return Object.prototype.toString.call(r)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(r){return typeof r=="object"&&r.buffer&&r.buffer.constructor===ArrayBuffer});var createOutputMethod=function(r,t){return function(e){return new Sha256(t,!0).update(e)[r]()}},createMethod=function(r){var t=createOutputMethod("hex",r);NODE_JS&&(t=nodeWrap(t,r)),t.create=function(){return new Sha256(r)},t.update=function(i){return t.create().update(i)};for(var e=0;e<OUTPUT_TYPES.length;++e){var n=OUTPUT_TYPES[e];t[n]=createOutputMethod(n,r)}return t},nodeWrap=function(method,is224){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),algorithm=is224?"sha224":"sha256",nodeMethod=function(r){if(typeof r=="string")return crypto.createHash(algorithm).update(r,"utf8").digest("hex");if(r==null)throw new Error(ERROR);return r.constructor===ArrayBuffer&&(r=new Uint8Array(r)),Array.isArray(r)||ArrayBuffer.isView(r)||r.constructor===Buffer?crypto.createHash(algorithm).update(new Buffer(r)).digest("hex"):method(r)};return nodeMethod},createHmacOutputMethod=function(r,t){return function(e,n){return new HmacSha256(e,t,!0).update(n)[r]()}},createHmacMethod=function(r){var t=createHmacOutputMethod("hex",r);t.create=function(i){return new HmacSha256(i,r)},t.update=function(i,s){return t.create(i).update(s)};for(var e=0;e<OUTPUT_TYPES.length;++e){var n=OUTPUT_TYPES[e];t[n]=createHmacOutputMethod(n,r)}return t};function Sha256(r,t){t?(blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r?(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=r}Sha256.prototype.update=function(r){if(!this.finalized){var t,e=typeof r;if(e!=="string"){if(e==="object"){if(r===null)throw new Error(ERROR);if(ARRAY_BUFFER&&r.constructor===ArrayBuffer)r=new Uint8Array(r);else if(!Array.isArray(r)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(r)))throw new Error(ERROR)}else throw new Error(ERROR);t=!0}for(var n,i=0,s,o=r.length,a=this.blocks;i<o;){if(this.hashed&&(this.hashed=!1,a[0]=this.block,a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),t)for(s=this.start;i<o&&s<64;++i)a[s>>2]|=r[i]<<SHIFT[s++&3];else for(s=this.start;i<o&&s<64;++i)n=r.charCodeAt(i),n<128?a[s>>2]|=n<<SHIFT[s++&3]:n<2048?(a[s>>2]|=(192|n>>6)<<SHIFT[s++&3],a[s>>2]|=(128|n&63)<<SHIFT[s++&3]):n<55296||n>=57344?(a[s>>2]|=(224|n>>12)<<SHIFT[s++&3],a[s>>2]|=(128|n>>6&63)<<SHIFT[s++&3],a[s>>2]|=(128|n&63)<<SHIFT[s++&3]):(n=65536+((n&1023)<<10|r.charCodeAt(++i)&1023),a[s>>2]|=(240|n>>18)<<SHIFT[s++&3],a[s>>2]|=(128|n>>12&63)<<SHIFT[s++&3],a[s>>2]|=(128|n>>6&63)<<SHIFT[s++&3],a[s>>2]|=(128|n&63)<<SHIFT[s++&3]);this.lastByteIndex=s,this.bytes+=s-this.start,s>=64?(this.block=a[16],this.start=s-64,this.hash(),this.hashed=!0):this.start=s}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var r=this.blocks,t=this.lastByteIndex;r[16]=this.block,r[t>>2]|=EXTRA[t&3],this.block=r[16],t>=56&&(this.hashed||this.hash(),r[0]=this.block,r[16]=r[1]=r[2]=r[3]=r[4]=r[5]=r[6]=r[7]=r[8]=r[9]=r[10]=r[11]=r[12]=r[13]=r[14]=r[15]=0),r[14]=this.hBytes<<3|this.bytes>>>29,r[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var r=this.h0,t=this.h1,e=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,a=this.h7,l=this.blocks,f,m,_,g,B,q,St,Bt,Dt,Yt,Xt;for(f=16;f<64;++f)B=l[f-15],m=(B>>>7|B<<25)^(B>>>18|B<<14)^B>>>3,B=l[f-2],_=(B>>>17|B<<15)^(B>>>19|B<<13)^B>>>10,l[f]=l[f-16]+m+l[f-7]+_<<0;for(Xt=t&e,f=0;f<64;f+=4)this.first?(this.is224?(Bt=300032,B=l[0]-1413257819,a=B-150054599<<0,n=B+24177077<<0):(Bt=704751109,B=l[0]-210244248,a=B-1521486534<<0,n=B+143694565<<0),this.first=!1):(m=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),_=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),Bt=r&t,g=Bt^r&e^Xt,St=i&s^~i&o,B=a+_+St+K[f]+l[f],q=m+g,a=n+B<<0,n=B+q<<0),m=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),_=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),Dt=n&r,g=Dt^n&t^Bt,St=a&i^~a&s,B=o+_+St+K[f+1]+l[f+1],q=m+g,o=e+B<<0,e=B+q<<0,m=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),_=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),Yt=e&n,g=Yt^e&r^Dt,St=o&a^~o&i,B=s+_+St+K[f+2]+l[f+2],q=m+g,s=t+B<<0,t=B+q<<0,m=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),_=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),Xt=t&e,g=Xt^t&n^Yt,St=s&o^~s&a,B=i+_+St+K[f+3]+l[f+3],q=m+g,i=r+B<<0,r=B+q<<0;this.h0=this.h0+r<<0,this.h1=this.h1+t<<0,this.h2=this.h2+e<<0,this.h3=this.h3+n<<0,this.h4=this.h4+i<<0,this.h5=this.h5+s<<0,this.h6=this.h6+o<<0,this.h7=this.h7+a<<0},Sha256.prototype.hex=function(){this.finalize();var r=this.h0,t=this.h1,e=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,a=this.h7,l=HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[r&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[e&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[i&15]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[s&15]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[o&15];return this.is224||(l+=HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[a&15]),l},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var r=this.h0,t=this.h1,e=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,a=this.h7,l=[r>>24&255,r>>16&255,r>>8&255,r&255,t>>24&255,t>>16&255,t>>8&255,t&255,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24&255,n>>16&255,n>>8&255,n&255,i>>24&255,i>>16&255,i>>8&255,i&255,s>>24&255,s>>16&255,s>>8&255,s&255,o>>24&255,o>>16&255,o>>8&255,o&255];return this.is224||l.push(a>>24&255,a>>16&255,a>>8&255,a&255),l},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var r=new ArrayBuffer(this.is224?28:32),t=new DataView(r);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),r};function HmacSha256(r,t,e){var n,i=typeof r;if(i==="string"){var s=[],o=r.length,a=0,l;for(n=0;n<o;++n)l=r.charCodeAt(n),l<128?s[a++]=l:l<2048?(s[a++]=192|l>>6,s[a++]=128|l&63):l<55296||l>=57344?(s[a++]=224|l>>12,s[a++]=128|l>>6&63,s[a++]=128|l&63):(l=65536+((l&1023)<<10|r.charCodeAt(++n)&1023),s[a++]=240|l>>18,s[a++]=128|l>>12&63,s[a++]=128|l>>6&63,s[a++]=128|l&63);r=s}else if(i==="object"){if(r===null)throw new Error(ERROR);if(ARRAY_BUFFER&&r.constructor===ArrayBuffer)r=new Uint8Array(r);else if(!Array.isArray(r)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(r)))throw new Error(ERROR)}else throw new Error(ERROR);r.length>64&&(r=new Sha256(t,!0).update(r).array());var f=[],m=[];for(n=0;n<64;++n){var _=r[n]||0;f[n]=92^_,m[n]=54^_}Sha256.call(this,t,e),this.update(m),this.oKeyPad=f,this.inner=!0,this.sharedMemory=e}HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var r=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(r),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&define(function(){return exports}))})()});var dy={};Gr(dy,{registerWorker:()=>Ru});function Uc(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e}function F(r,t,e,n){function i(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(m){try{f(n.next(m))}catch(_){o(_)}}function l(m){try{f(n.throw(m))}catch(_){o(_)}}function f(m){m.done?s(m.value):i(m.value).then(a,l)}f((n=n.apply(r,t||[])).next())})}function Mc(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function C(r){return this instanceof C?(this.v=r,this):new C(r)}function ie(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(g){n[g]&&(i[g]=function(B){return new Promise(function(q,St){s.push([g,B,q,St])>1||a(g,B)})})}function a(g,B){try{l(n[g](B))}catch(q){_(s[0][3],q)}}function l(g){g.value instanceof C?Promise.resolve(g.value.v).then(f,m):_(s[0][2],g)}function f(g){a("next",g)}function m(g){a("throw",g)}function _(g,B){g(B),s.shift(),s.length&&a(s[0][0],s[0][1])}}function _n(r){var t,e;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,s){t[i]=r[i]?function(o){return(e=!e)?{value:C(r[i](o)),done:!1}:s?s(o):o}:s}}function Se(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof Mc=="function"?Mc(r):r[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(s){e[s]=r[s]&&function(o){return new Promise(function(a,l){o=r[s](o),i(a,l,o.done,o.value)})}}function i(s,o,a,l){Promise.resolve(l).then(function(f){s({value:f,done:a})},o)}}var ea={};Gr(ea,{compareArrayLike:()=>ta,joinUint8Arrays:()=>se,memcpy:()=>bn,rebaseValueOffsets:()=>qn,toArrayBufferView:()=>W,toArrayBufferViewAsyncIterator:()=>Be,toArrayBufferViewIterator:()=>He,toBigInt64Array:()=>Dh,toBigUint64Array:()=>Rh,toFloat32Array:()=>Mh,toFloat32ArrayAsyncIterator:()=>Kh,toFloat32ArrayIterator:()=>Hh,toFloat64Array:()=>Uh,toFloat64ArrayAsyncIterator:()=>Jh,toFloat64ArrayIterator:()=>zh,toInt16Array:()=>xh,toInt16ArrayAsyncIterator:()=>$h,toInt16ArrayIterator:()=>kh,toInt32Array:()=>Jr,toInt32ArrayAsyncIterator:()=>Yh,toInt32ArrayIterator:()=>Ch,toInt8Array:()=>Th,toInt8ArrayAsyncIterator:()=>Wh,toInt8ArrayIterator:()=>Lh,toUint16Array:()=>Eh,toUint16ArrayAsyncIterator:()=>Xh,toUint16ArrayIterator:()=>Ph,toUint32Array:()=>Oh,toUint32ArrayAsyncIterator:()=>Gh,toUint32ArrayIterator:()=>Vh,toUint8Array:()=>L,toUint8ArrayAsyncIterator:()=>Qo,toUint8ArrayIterator:()=>Zo,toUint8ClampedArray:()=>Nh,toUint8ClampedArrayAsyncIterator:()=>qh,toUint8ClampedArrayIterator:()=>jh});var Ih=new TextDecoder("utf-8"),Kn=r=>Ih.decode(r),Fh=new TextEncoder,Br=r=>Fh.encode(r);var Bh=r=>typeof r=="number",Nc=r=>typeof r=="boolean",Tt=r=>typeof r=="function",zt=r=>r!=null&&Object(r)===r,Ie=r=>zt(r)&&Tt(r.then);var Fe=r=>zt(r)&&Tt(r[Symbol.iterator]),pe=r=>zt(r)&&Tt(r[Symbol.asyncIterator]),is=r=>zt(r)&&zt(r.schema);var ss=r=>zt(r)&&"done"in r&&"value"in r;var os=r=>zt(r)&&Tt(r.stat)&&Bh(r.fd);var as=r=>zt(r)&&Jn(r.body),cs=r=>"_getDOMStream"in r&&"_getNodeStream"in r,Lc=r=>zt(r)&&Tt(r.abort)&&Tt(r.getWriter)&&!cs(r),Jn=r=>zt(r)&&Tt(r.cancel)&&Tt(r.getReader)&&!cs(r),kc=r=>zt(r)&&Tt(r.end)&&Tt(r.write)&&Nc(r.writable)&&!cs(r),ls=r=>zt(r)&&Tt(r.read)&&Tt(r.pipe)&&Nc(r.readable)&&!cs(r),Cc=r=>zt(r)&&Tt(r.clear)&&Tt(r.bytes)&&Tt(r.position)&&Tt(r.setPosition)&&Tt(r.capacity)&&Tt(r.getBufferIdentifier)&&Tt(r.createLong);var qo=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Ah(r){let t=r[0]?[r[0]]:[],e,n,i,s;for(let o,a,l=0,f=0,m=r.length;++l<m;){if(o=t[f],a=r[l],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++f]=a);continue}if({byteOffset:e,byteLength:i}=o,{byteOffset:n,byteLength:s}=a,e+i<n||n+s<e){a&&(t[++f]=a);continue}t[f]=new Uint8Array(o.buffer,e,n-e+s)}return t}function bn(r,t,e=0,n=t.byteLength){let i=r.byteLength,s=new Uint8Array(r.buffer,r.byteOffset,i),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return s.set(o,e),r}function se(r,t){let e=Ah(r),n=e.reduce((m,_)=>m+_.byteLength,0),i,s,o,a=0,l=-1,f=Math.min(t||Number.POSITIVE_INFINITY,n);for(let m=e.length;++l<m;){if(i=e[l],s=i.subarray(0,Math.min(i.length,f-a)),f<=a+s.length){s.length<i.length?e[l]=i.subarray(s.length):s.length===i.length&&l++,o?bn(o,s,a):o=s;break}bn(o||(o=new Uint8Array(f)),s,a),a+=s.length}return[o||new Uint8Array(0),e.slice(l),n-(o?o.byteLength:0)]}function W(r,t){let e=ss(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=Br(e)),e instanceof ArrayBuffer?new r(e):e instanceof qo?new r(e):Cc(e)?W(r,e.bytes()):ArrayBuffer.isView(e)?e.byteLength<=0?new r(0):new r(e.buffer,e.byteOffset,e.byteLength/r.BYTES_PER_ELEMENT):r.from(e)):new r(0)}var Th=r=>W(Int8Array,r),xh=r=>W(Int16Array,r),Jr=r=>W(Int32Array,r),Dh=r=>W(BigInt64Array,r),L=r=>W(Uint8Array,r),Eh=r=>W(Uint16Array,r),Oh=r=>W(Uint32Array,r),Rh=r=>W(BigUint64Array,r),Mh=r=>W(Float32Array,r),Uh=r=>W(Float64Array,r),Nh=r=>W(Uint8ClampedArray,r),Jo=r=>(r.next(),r);function*He(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof qo?e(t):Fe(t)?t:e(t);return yield*Kr(Jo(function*(i){let s=null;do s=i.next(yield W(r,s));while(!s.done)}(n[Symbol.iterator]()))),new r}var Lh=r=>He(Int8Array,r),kh=r=>He(Int16Array,r),Ch=r=>He(Int32Array,r),Zo=r=>He(Uint8Array,r),Ph=r=>He(Uint16Array,r),Vh=r=>He(Uint32Array,r),Hh=r=>He(Float32Array,r),zh=r=>He(Float64Array,r),jh=r=>He(Uint8ClampedArray,r);function Be(r,t){return ie(this,arguments,function*(){if(Ie(t))return yield C(yield C(yield*Kr(_n(Se(Be(r,yield C(t)))))));let n=function(o){return ie(this,arguments,function*(){yield yield C(yield C(o))})},i=function(o){return ie(this,arguments,function*(){yield C(yield*Kr(_n(Se(Jo(function*(a){let l=null;do l=a.next(yield l==null?void 0:l.value);while(!l.done)}(o[Symbol.iterator]()))))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof qo?n(t):Fe(t)?i(t):pe(t)?t:n(t);return yield C(yield*Kr(_n(Se(Jo(function(o){return ie(this,arguments,function*(){let a=null;do a=yield C(o.next(yield yield C(W(r,a))));while(!a.done)})}(s[Symbol.asyncIterator]())))))),yield C(new r)})}var Wh=r=>Be(Int8Array,r),$h=r=>Be(Int16Array,r),Yh=r=>Be(Int32Array,r),Qo=r=>Be(Uint8Array,r),Xh=r=>Be(Uint16Array,r),Gh=r=>Be(Uint32Array,r),Kh=r=>Be(Float32Array,r),Jh=r=>Be(Float64Array,r),qh=r=>Be(Uint8ClampedArray,r);function qn(r,t,e){if(r!==0){e=e.slice(0,t+1);for(let n=-1;++n<=t;)e[n]+=r}return e}function ta(r,t){let e=0,n=r.length;if(n!==t.length)return!1;if(n>0)do if(r[e]!==t[e])return!1;while(++e<n);return!0}var Nt={fromIterable(r){return us(Zh(r))},fromAsyncIterable(r){return us(Qh(r))},fromDOMStream(r){return us(tp(r))},fromNodeStream(r){return us(ep(r))},toDOMStream(r,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(r,t){throw new Error('"toNodeStream" not available in this environment')}},us=r=>(r.next(),r);function*Zh(r){let t,e=!1,n=[],i,s,o,a=0;function l(){return s==="peek"?se(n,o)[0]:([i,n,a]=se(n,o),i)}({cmd:s,size:o}=yield null);let f=Zo(r)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-a)?f.next():f.next(o-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield l());while(o<a);while(!t)}catch(m){(e=!0)&&typeof f.throw=="function"&&f.throw(m)}finally{e===!1&&typeof f.return=="function"&&f.return(null)}return null}function Qh(r){return ie(this,arguments,function*(){let e,n=!1,i=[],s,o,a,l=0;function f(){return o==="peek"?se(i,a)[0]:([s,i,l]=se(i,a),s)}({cmd:o,size:a}=yield yield C(null));let m=Qo(r)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(a-l)?yield C(m.next()):yield C(m.next(a-l)),!e&&s.byteLength>0&&(i.push(s),l+=s.byteLength),e||a<=l)do({cmd:o,size:a}=yield yield C(f()));while(a<l);while(!e)}catch(_){(n=!0)&&typeof m.throw=="function"&&(yield C(m.throw(_)))}finally{n===!1&&typeof m.return=="function"&&(yield C(m.return(new Uint8Array(0))))}return yield C(null)})}function tp(r){return ie(this,arguments,function*(){let e=!1,n=!1,i=[],s,o,a,l=0;function f(){return o==="peek"?se(i,a)[0]:([s,i,l]=se(i,a),s)}({cmd:o,size:a}=yield yield C(null));let m=new na(r);try{do if({done:e,value:s}=Number.isNaN(a-l)?yield C(m.read()):yield C(m.read(a-l)),!e&&s.byteLength>0&&(i.push(L(s)),l+=s.byteLength),e||a<=l)do({cmd:o,size:a}=yield yield C(f()));while(a<l);while(!e)}catch(_){(n=!0)&&(yield C(m.cancel(_)))}finally{n===!1?yield C(m.cancel()):r.locked&&m.releaseLock()}return yield C(null)})}var na=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return F(this,void 0,void 0,function*(){let{reader:e,source:n}=this;e&&(yield e.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return F(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let e=yield this.reader.read();return!e.done&&(e.value=L(e)),e})}},ra=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function ep(r){return ie(this,arguments,function*(){let e=[],n="error",i=!1,s=null,o,a,l=0,f=[],m;function _(){return o==="peek"?se(f,a)[0]:([m,f,l]=se(f,a),m)}if({cmd:o,size:a}=yield yield C(null),r.isTTY)return yield yield C(new Uint8Array(0)),yield C(null);try{e[0]=ra(r,"end"),e[1]=ra(r,"error");do{if(e[2]=ra(r,"readable"),[n,s]=yield C(Promise.race(e.map(B=>B[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-l)?(m=L(r.read(a-l)),m.byteLength<a-l&&(m=L(r.read()))):m=L(r.read()),m.byteLength>0&&(f.push(m),l+=m.byteLength)),i||a<=l)do({cmd:o,size:a}=yield yield C(_()));while(a<l)}while(!i)}finally{yield C(g(e,n==="error"?s:null))}return yield C(null);function g(B,q){return m=f=null,new Promise((St,Bt)=>{for(let[Dt,Yt]of B)r.off(Dt,Yt);try{let Dt=r.destroy;Dt&&Dt.call(r,q),q=void 0}catch(Dt){q=Dt||q}finally{q!=null?Bt(q):St()}})}})}var Mt;(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(Mt||(Mt={}));var _t;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(_t||(_t={}));var ht;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(ht||(ht={}));var Lt;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(Lt||(Lt={}));var X;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(X||(X={}));var jt;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(jt||(jt={}));var Q;(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(Q||(Q={}));var h;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth"})(h||(h={}));var me;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(me||(me={}));var wa={};Gr(wa,{clampIndex:()=>$p,clampRange:()=>ei,createElementComparator:()=>xr});function ze(r){if(r===null)return"null";if(r===void 0)return"undefined";switch(typeof r){case"number":return"".concat(r);case"bigint":return"".concat(r);case"string":return'"'.concat(r,'"')}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?"[".concat([...r].map(t=>ze(t)),"]"):"[".concat(r,"]"):ArrayBuffer.isView(r)?"[".concat(r,"]"):JSON.stringify(r,(t,e)=>typeof e=="bigint"?"".concat(e):e)}var sa={};Gr(sa,{BN:()=>Qn,bigNumToBigInt:()=>Hc,bigNumToString:()=>vn,isArrowBigNumSymbol:()=>Pc});var Pc=Symbol.for("isArrowBigNum");function Ae(r,...t){return t.length===0?Object.setPrototypeOf(W(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}Ae.prototype[Pc]=!0;Ae.prototype.toJSON=function(){return'"'.concat(vn(this),'"')};Ae.prototype.valueOf=function(){return Vc(this)};Ae.prototype.toString=function(){return vn(this)};Ae.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Vc(this);case"string":return vn(this);case"default":return Hc(this)}return vn(this)};function gn(...r){return Ae.apply(this,r)}function wn(...r){return Ae.apply(this,r)}function Zn(...r){return Ae.apply(this,r)}Object.setPrototypeOf(gn.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(wn.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Zn.prototype,Object.create(Uint32Array.prototype));Object.assign(gn.prototype,Ae.prototype,{constructor:gn,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(wn.prototype,Ae.prototype,{constructor:wn,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Zn.prototype,Ae.prototype,{constructor:Zn,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function Vc(r){let{buffer:t,byteOffset:e,length:n,signed:i}=r,s=new BigUint64Array(t,e,n),o=i&&s.at(-1)&BigInt(1)<<BigInt(63),a=BigInt(o?1:0),l=BigInt(0);if(o){for(let f of s)a+=~f*(BigInt(1)<<BigInt(32)*l++);a*=BigInt(-1)}else for(let f of s)a+=f*(BigInt(1)<<BigInt(32)*l++);return a}var vn=r=>{if(r.byteLength===8){let s=new r.BigIntArray(r.buffer,r.byteOffset,1);return"".concat(s[0])}if(!r.signed)return ia(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return ia(r);t=t.slice();let n=1;for(let s=0;s<t.length;s++){let o=t[s],a=~o+n;t[s]=a,n&=o===0?1:0}let i=ia(t);return"-".concat(i)},Hc=r=>r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:vn(r);function ia(r){let t="",e=new Uint32Array(2),n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),s=-1,o=n.length-1;do{for(e[0]=n[s=0];s<o;)n[s++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+n[s];n[s]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t="".concat(e[0]).concat(t)}while(i[0]||i[1]||i[2]||i[3]);return t!=null?t:"0"}var Qn=class r{static new(t,e){switch(e){case!0:return new gn(t);case!1:return new wn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new gn(t)}return t.byteLength===16?new Zn(t):new wn(t)}static signed(t){return new gn(t)}static unsigned(t){return new wn(t)}static decimal(t){return new Zn(t)}constructor(t,e){return r.new(t,e)}};function qt(r){if(typeof r=="bigint"&&(r<Number.MIN_SAFE_INTEGER||r>Number.MAX_SAFE_INTEGER))throw new TypeError("".concat(r," is not safe to convert to a number."));return Number(r)}var zc,jc,Wc,$c,Yc,Xc,Gc,Kc,Jc,qc,Zc,Qc,tl,el,rl,nl,il,sl,ol,D=class r{static isNull(t){return(t==null?void 0:t.typeId)===h.Null}static isInt(t){return(t==null?void 0:t.typeId)===h.Int}static isFloat(t){return(t==null?void 0:t.typeId)===h.Float}static isBinary(t){return(t==null?void 0:t.typeId)===h.Binary}static isUtf8(t){return(t==null?void 0:t.typeId)===h.Utf8}static isBool(t){return(t==null?void 0:t.typeId)===h.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===h.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===h.Date}static isTime(t){return(t==null?void 0:t.typeId)===h.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===h.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===h.Interval}static isList(t){return(t==null?void 0:t.typeId)===h.List}static isStruct(t){return(t==null?void 0:t.typeId)===h.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===h.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===h.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===h.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===h.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===h.Dictionary}static isDenseUnion(t){return r.isUnion(t)&&t.mode===_t.Dense}static isSparseUnion(t){return r.isUnion(t)&&t.mode===_t.Sparse}get typeId(){return h.NONE}};zc=Symbol.toStringTag;D[zc]=(r=>(r.children=null,r.ArrayType=Array,r[Symbol.toStringTag]="DataType"))(D.prototype);var Wt=class extends D{toString(){return"Null"}get typeId(){return h.Null}};jc=Symbol.toStringTag;Wt[jc]=(r=>r[Symbol.toStringTag]="Null")(Wt.prototype);var It=class extends D{constructor(t,e){super(),this.isSigned=t,this.bitWidth=e}get typeId(){return h.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error("Unrecognized ".concat(this[Symbol.toStringTag]," type"))}toString(){return"".concat(this.isSigned?"I":"Ui","nt").concat(this.bitWidth)}};Wc=Symbol.toStringTag;It[Wc]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(It.prototype);var ds=class extends It{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},fs=class extends It{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},je=class extends It{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},hs=class extends It{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},ps=class extends It{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},ms=class extends It{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},ys=class extends It{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},_s=class extends It{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(ds.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(fs.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(je.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(hs.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(ps.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(ms.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ys.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(_s.prototype,"ArrayType",{value:BigUint64Array});var Zt=class extends D{constructor(t){super(),this.precision=t}get typeId(){return h.Float}get ArrayType(){switch(this.precision){case ht.HALF:return Uint16Array;case ht.SINGLE:return Float32Array;case ht.DOUBLE:return Float64Array}throw new Error("Unrecognized ".concat(this[Symbol.toStringTag]," type"))}toString(){return"Float".concat(this.precision<<5||16)}};$c=Symbol.toStringTag;Zt[$c]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(Zt.prototype);var bs=class extends Zt{constructor(){super(ht.HALF)}},gs=class extends Zt{constructor(){super(ht.SINGLE)}},ws=class extends Zt{constructor(){super(ht.DOUBLE)}};Object.defineProperty(bs.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(gs.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(ws.prototype,"ArrayType",{value:Float64Array});var nr=class extends D{constructor(){super()}get typeId(){return h.Binary}toString(){return"Binary"}};Yc=Symbol.toStringTag;nr[Yc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(nr.prototype);var ir=class extends D{constructor(){super()}get typeId(){return h.Utf8}toString(){return"Utf8"}};Xc=Symbol.toStringTag;ir[Xc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(ir.prototype);var sr=class extends D{constructor(){super()}get typeId(){return h.Bool}toString(){return"Bool"}};Gc=Symbol.toStringTag;sr[Gc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(sr.prototype);var or=class extends D{constructor(t,e,n=128){super(),this.scale=t,this.precision=e,this.bitWidth=n}get typeId(){return h.Decimal}toString(){return"Decimal[".concat(this.precision,"e").concat(this.scale>0?"+":"").concat(this.scale,"]")}};Kc=Symbol.toStringTag;or[Kc]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(or.prototype);var ar=class extends D{constructor(t){super(),this.unit=t}get typeId(){return h.Date}toString(){return"Date".concat((this.unit+1)*32,"<").concat(Lt[this.unit],">")}};Jc=Symbol.toStringTag;ar[Jc]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Date"))(ar.prototype);var Te=class extends D{constructor(t,e){super(),this.unit=t,this.bitWidth=e}get typeId(){return h.Time}toString(){return"Time".concat(this.bitWidth,"<").concat(X[this.unit],">")}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error("Unrecognized ".concat(this[Symbol.toStringTag]," type"))}};qc=Symbol.toStringTag;Te[qc]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(Te.prototype);var cr=class extends D{constructor(t,e){super(),this.unit=t,this.timezone=e}get typeId(){return h.Timestamp}toString(){return"Timestamp<".concat(X[this.unit]).concat(this.timezone?", ".concat(this.timezone):"",">")}};Zc=Symbol.toStringTag;cr[Zc]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Timestamp"))(cr.prototype);var lr=class extends D{constructor(t){super(),this.unit=t}get typeId(){return h.Interval}toString(){return"Interval<".concat(jt[this.unit],">")}};Qc=Symbol.toStringTag;lr[Qc]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(lr.prototype);var xe=class extends D{constructor(t){super(),this.children=[t]}get typeId(){return h.List}toString(){return"List<".concat(this.valueType,">")}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};tl=Symbol.toStringTag;xe[tl]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(xe.prototype);var ut=class extends D{constructor(t){super(),this.children=t}get typeId(){return h.Struct}toString(){return"Struct<{".concat(this.children.map(t=>"".concat(t.name,":").concat(t.type)).join(", "),"}>")}};el=Symbol.toStringTag;ut[el]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(ut.prototype);var De=class extends D{constructor(t,e,n){super(),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}get typeId(){return h.Union}toString(){return"".concat(this[Symbol.toStringTag],"<").concat(this.children.map(t=>"".concat(t.type)).join(" | "),">")}};rl=Symbol.toStringTag;De[rl]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(De.prototype);var ur=class extends D{constructor(t){super(),this.byteWidth=t}get typeId(){return h.FixedSizeBinary}toString(){return"FixedSizeBinary[".concat(this.byteWidth,"]")}};nl=Symbol.toStringTag;ur[nl]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(ur.prototype);var Ee=class extends D{constructor(t,e){super(),this.listSize=t,this.children=[e]}get typeId(){return h.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">")}};il=Symbol.toStringTag;Ee[il]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Ee.prototype);var Oe=class extends D{constructor(t,e=!1){super(),this.children=[t],this.keysSorted=e}get typeId(){return h.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return"Map<{".concat(this.children[0].type.children.map(t=>"".concat(t.name,":").concat(t.type)).join(", "),"}>")}};sl=Symbol.toStringTag;Oe[sl]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(Oe.prototype);var rp=(r=>()=>++r)(-1),oe=class extends D{constructor(t,e,n,i){super(),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?rp():qt(n)}get typeId(){return h.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return"Dictionary<".concat(this.indices,", ").concat(this.dictionary,">")}};ol=Symbol.toStringTag;oe[ol]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(oe.prototype);function ae(r){let t=r;switch(r.typeId){case h.Decimal:return r.bitWidth/32;case h.Timestamp:return 2;case h.Date:return 1+t.unit;case h.Interval:return 1+t.unit;case h.FixedSizeList:return t.listSize;case h.FixedSizeBinary:return t.byteWidth;default:return 1}}var E=class{visitMany(t,...e){return t.map((n,i)=>this.visit(n,...e.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return np(this,t,e)}getVisitFnByTypeId(t,e=!0){return Sn(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitBinary(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}};function np(r,t,e=!0){return typeof t=="number"?Sn(r,t,e):typeof t=="string"&&t in h?Sn(r,h[t],e):t&&t instanceof D?Sn(r,al(t),e):t!=null&&t.type&&t.type instanceof D?Sn(r,al(t.type),e):Sn(r,h.NONE,e)}function Sn(r,t,e=!0){let n=null;switch(t){case h.Null:n=r.visitNull;break;case h.Bool:n=r.visitBool;break;case h.Int:n=r.visitInt;break;case h.Int8:n=r.visitInt8||r.visitInt;break;case h.Int16:n=r.visitInt16||r.visitInt;break;case h.Int32:n=r.visitInt32||r.visitInt;break;case h.Int64:n=r.visitInt64||r.visitInt;break;case h.Uint8:n=r.visitUint8||r.visitInt;break;case h.Uint16:n=r.visitUint16||r.visitInt;break;case h.Uint32:n=r.visitUint32||r.visitInt;break;case h.Uint64:n=r.visitUint64||r.visitInt;break;case h.Float:n=r.visitFloat;break;case h.Float16:n=r.visitFloat16||r.visitFloat;break;case h.Float32:n=r.visitFloat32||r.visitFloat;break;case h.Float64:n=r.visitFloat64||r.visitFloat;break;case h.Utf8:n=r.visitUtf8;break;case h.Binary:n=r.visitBinary;break;case h.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case h.Date:n=r.visitDate;break;case h.DateDay:n=r.visitDateDay||r.visitDate;break;case h.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case h.Timestamp:n=r.visitTimestamp;break;case h.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case h.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case h.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case h.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case h.Time:n=r.visitTime;break;case h.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case h.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case h.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case h.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case h.Decimal:n=r.visitDecimal;break;case h.List:n=r.visitList;break;case h.Struct:n=r.visitStruct;break;case h.Union:n=r.visitUnion;break;case h.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case h.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case h.Dictionary:n=r.visitDictionary;break;case h.Interval:n=r.visitInterval;break;case h.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case h.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case h.FixedSizeList:n=r.visitFixedSizeList;break;case h.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error("Unrecognized type '".concat(h[t],"'"))}function al(r){switch(r.typeId){case h.Null:return h.Null;case h.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?h.Int8:h.Uint8;case 16:return e?h.Int16:h.Uint16;case 32:return e?h.Int32:h.Uint32;case 64:return e?h.Int64:h.Uint64}return h.Int}case h.Float:switch(r.precision){case ht.HALF:return h.Float16;case ht.SINGLE:return h.Float32;case ht.DOUBLE:return h.Float64}return h.Float;case h.Binary:return h.Binary;case h.Utf8:return h.Utf8;case h.Bool:return h.Bool;case h.Decimal:return h.Decimal;case h.Time:switch(r.unit){case X.SECOND:return h.TimeSecond;case X.MILLISECOND:return h.TimeMillisecond;case X.MICROSECOND:return h.TimeMicrosecond;case X.NANOSECOND:return h.TimeNanosecond}return h.Time;case h.Timestamp:switch(r.unit){case X.SECOND:return h.TimestampSecond;case X.MILLISECOND:return h.TimestampMillisecond;case X.MICROSECOND:return h.TimestampMicrosecond;case X.NANOSECOND:return h.TimestampNanosecond}return h.Timestamp;case h.Date:switch(r.unit){case Lt.DAY:return h.DateDay;case Lt.MILLISECOND:return h.DateMillisecond}return h.Date;case h.Interval:switch(r.unit){case jt.DAY_TIME:return h.IntervalDayTime;case jt.YEAR_MONTH:return h.IntervalYearMonth}return h.Interval;case h.Map:return h.Map;case h.List:return h.List;case h.Struct:return h.Struct;case h.Union:switch(r.mode){case _t.Dense:return h.DenseUnion;case _t.Sparse:return h.SparseUnion}return h.Union;case h.FixedSizeBinary:return h.FixedSizeBinary;case h.FixedSizeList:return h.FixedSizeList;case h.Dictionary:return h.Dictionary}throw new Error("Unrecognized type '".concat(h[r.typeId],"'"))}E.prototype.visitInt8=null;E.prototype.visitInt16=null;E.prototype.visitInt32=null;E.prototype.visitInt64=null;E.prototype.visitUint8=null;E.prototype.visitUint16=null;E.prototype.visitUint32=null;E.prototype.visitUint64=null;E.prototype.visitFloat16=null;E.prototype.visitFloat32=null;E.prototype.visitFloat64=null;E.prototype.visitDateDay=null;E.prototype.visitDateMillisecond=null;E.prototype.visitTimestampSecond=null;E.prototype.visitTimestampMillisecond=null;E.prototype.visitTimestampMicrosecond=null;E.prototype.visitTimestampNanosecond=null;E.prototype.visitTimeSecond=null;E.prototype.visitTimeMillisecond=null;E.prototype.visitTimeMicrosecond=null;E.prototype.visitTimeNanosecond=null;E.prototype.visitDenseUnion=null;E.prototype.visitSparseUnion=null;E.prototype.visitIntervalDayTime=null;E.prototype.visitIntervalYearMonth=null;var oa={};Gr(oa,{float64ToUint16:()=>ti,uint16ToFloat64:()=>vs});var cl=new Float64Array(1),In=new Uint32Array(cl.buffer);function vs(r){let t=(r&31744)>>10,e=(r&1023)/1024,n=Math.pow(-1,(r&32768)>>15);switch(t){case 31:return n*(e?Number.NaN:1/0);case 0:return n*(e?6103515625e-14*e:0)}return n*Math.pow(2,t-15)*(1+e)}function ti(r){if(r!==r)return 32256;cl[0]=r;let t=(In[1]&2147483648)>>16&65535,e=In[1]&2146435072,n=0;return e>=1089470464?In[0]>0?e=31744:(e=(e&2080374784)>>16,n=(In[1]&1048575)>>10):e<=1056964608?(n=1048576+(In[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(In[1]&1048575)+512>>10),t|e|n&65535}var k=class extends E{};function j(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var ip=(r,t,e)=>{r[t]=Math.trunc(e/864e5)},aa=(r,t,e)=>{r[t]=Math.trunc(e%4294967296),r[t+1]=Math.trunc(e/4294967296)},sp=(r,t,e)=>{r[t]=Math.trunc(e*1e3%4294967296),r[t+1]=Math.trunc(e*1e3/4294967296)},op=(r,t,e)=>{r[t]=Math.trunc(e*1e6%4294967296),r[t+1]=Math.trunc(e*1e6/4294967296)},ll=(r,t,e,n)=>{if(e+1<t.length){let{[e]:i,[e+1]:s}=t;r.set(n.subarray(0,s-i),i)}},ap=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},dr=({values:r},t,e)=>{r[t]=e},ca=({values:r},t,e)=>{r[t]=e},ul=({values:r},t,e)=>{r[t]=ti(e)},cp=(r,t,e)=>{switch(r.type.precision){case ht.HALF:return ul(r,t,e);case ht.SINGLE:case ht.DOUBLE:return ca(r,t,e)}},Ss=({values:r},t,e)=>{ip(r,t,e.valueOf())},Is=({values:r},t,e)=>{aa(r,t*2,e.valueOf())},la=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},lp=({values:r,valueOffsets:t},e,n)=>ll(r,t,e,n),up=({values:r,valueOffsets:t},e,n)=>{ll(r,t,e,Br(n))},ua=(r,t,e)=>{r.type.unit===Lt.DAY?Ss(r,t,e):Is(r,t,e)},Fs=({values:r},t,e)=>aa(r,t*2,e/1e3),Bs=({values:r},t,e)=>aa(r,t*2,e),As=({values:r},t,e)=>sp(r,t*2,e),Ts=({values:r},t,e)=>op(r,t*2,e),da=(r,t,e)=>{switch(r.type.unit){case X.SECOND:return Fs(r,t,e);case X.MILLISECOND:return Bs(r,t,e);case X.MICROSECOND:return As(r,t,e);case X.NANOSECOND:return Ts(r,t,e)}},xs=({values:r},t,e)=>{r[t]=e},Ds=({values:r},t,e)=>{r[t]=e},Es=({values:r},t,e)=>{r[t]=e},Os=({values:r},t,e)=>{r[t]=e},fa=(r,t,e)=>{switch(r.type.unit){case X.SECOND:return xs(r,t,e);case X.MILLISECOND:return Ds(r,t,e);case X.MICROSECOND:return Es(r,t,e);case X.NANOSECOND:return Os(r,t,e)}},ha=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},dp=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,s=kt.getVisitFn(n);if(Array.isArray(e))for(let o=-1,a=i[t],l=i[t+1];a<l;)s(n,a++,e[++o]);else for(let o=-1,a=i[t],l=i[t+1];a<l;)s(n,a++,e.get(++o))},fp=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,s=kt.getVisitFn(n),{[t]:o,[t+1]:a}=i,l=e instanceof Map?e.entries():Object.entries(e);for(let f of l)if(s(n,o,f),++o>=a)break},hp=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),pp=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),mp=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),yp=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),_p=(r,t,e)=>{let n=r.type.children.map(s=>kt.getVisitFn(s.type)),i=e instanceof Map?mp(t,e):e instanceof G?pp(t,e):Array.isArray(e)?hp(t,e):yp(t,e);r.type.children.forEach((s,o)=>i(n[o],r.children[o],s,o))},bp=(r,t,e)=>{r.type.mode===_t.Dense?dl(r,t,e):fl(r,t,e)},dl=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];kt.visit(i,r.valueOffsets[t],e)},fl=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];kt.visit(i,t,e)},gp=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},pa=(r,t,e)=>{r.type.unit===jt.DAY_TIME?Rs(r,t,e):Ms(r,t,e)},Rs=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},Ms=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},wp=(r,t,e)=>{let{stride:n}=r,i=r.children[0],s=kt.getVisitFn(i);if(Array.isArray(e))for(let o=-1,a=t*n;++o<n;)s(i,a+o,e[o]);else for(let o=-1,a=t*n;++o<n;)s(i,a+o,e.get(o))};k.prototype.visitBool=j(ap);k.prototype.visitInt=j(dr);k.prototype.visitInt8=j(dr);k.prototype.visitInt16=j(dr);k.prototype.visitInt32=j(dr);k.prototype.visitInt64=j(dr);k.prototype.visitUint8=j(dr);k.prototype.visitUint16=j(dr);k.prototype.visitUint32=j(dr);k.prototype.visitUint64=j(dr);k.prototype.visitFloat=j(cp);k.prototype.visitFloat16=j(ul);k.prototype.visitFloat32=j(ca);k.prototype.visitFloat64=j(ca);k.prototype.visitUtf8=j(up);k.prototype.visitBinary=j(lp);k.prototype.visitFixedSizeBinary=j(la);k.prototype.visitDate=j(ua);k.prototype.visitDateDay=j(Ss);k.prototype.visitDateMillisecond=j(Is);k.prototype.visitTimestamp=j(da);k.prototype.visitTimestampSecond=j(Fs);k.prototype.visitTimestampMillisecond=j(Bs);k.prototype.visitTimestampMicrosecond=j(As);k.prototype.visitTimestampNanosecond=j(Ts);k.prototype.visitTime=j(fa);k.prototype.visitTimeSecond=j(xs);k.prototype.visitTimeMillisecond=j(Ds);k.prototype.visitTimeMicrosecond=j(Es);k.prototype.visitTimeNanosecond=j(Os);k.prototype.visitDecimal=j(ha);k.prototype.visitList=j(dp);k.prototype.visitStruct=j(_p);k.prototype.visitUnion=j(bp);k.prototype.visitDenseUnion=j(dl);k.prototype.visitSparseUnion=j(fl);k.prototype.visitDictionary=j(gp);k.prototype.visitInterval=j(pa);k.prototype.visitIntervalDayTime=j(Rs);k.prototype.visitIntervalYearMonth=j(Ms);k.prototype.visitFixedSizeList=j(wp);k.prototype.visitMap=j(fp);var kt=new k;var Re=Symbol.for("parent"),Fn=Symbol.for("rowIndex"),Ar=class{constructor(t,e){return this[Re]=t,this[Fn]=e,new Proxy(this,new ya)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Fn],e=this[Re],n=e.type.children,i={};for(let s=-1,o=n.length;++s<o;)i[n[s].name]=At.visit(e.children[s],t);return i}toString(){return"{".concat([...this].map(([t,e])=>"".concat(ze(t),": ").concat(ze(e))).join(", "),"}")}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new ma(this[Re],this[Fn])}},ma=class{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,At.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Ar.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Re]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Fn]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var ya=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Re].type.children.map(e=>e.name)}has(t,e){return t[Re].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[Re].type.children.findIndex(n=>n.name===e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[Re].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=At.visit(t[Re].children[n],t[Fn]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[Re].type.children.findIndex(s=>s.name===e);return i!==-1?(kt.visit(t[Re].children[i],t[Fn],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}};var R=class extends E{};function V(r){return(t,e)=>t.getValid(e)?r(t,e):null}var vp=(r,t)=>864e5*r[t],_a=(r,t)=>4294967296*r[t+1]+(r[t]>>>0),Sp=(r,t)=>4294967296*(r[t+1]/1e3)+(r[t]>>>0)/1e3,Ip=(r,t)=>4294967296*(r[t+1]/1e6)+(r[t]>>>0)/1e6,hl=r=>new Date(r),Fp=(r,t)=>hl(vp(r,t)),Bp=(r,t)=>hl(_a(r,t)),Ap=(r,t)=>null,pl=(r,t,e)=>{if(e+1>=t.length)return null;let n=t[e],i=t[e+1];return r.subarray(n,i)},Tp=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},ml=({values:r},t)=>Fp(r,t),yl=({values:r},t)=>Bp(r,t*2),Tr=({stride:r,values:t},e)=>t[r*e],xp=({stride:r,values:t},e)=>vs(t[r*e]),_l=({values:r},t)=>r[t],Dp=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),Ep=({values:r,valueOffsets:t},e)=>pl(r,t,e),Op=({values:r,valueOffsets:t},e)=>{let n=pl(r,t,e);return n!==null?Kn(n):null},Rp=({values:r},t)=>r[t],Mp=({type:r,values:t},e)=>r.precision!==ht.HALF?t[e]:vs(t[e]),Up=(r,t)=>r.type.unit===Lt.DAY?ml(r,t):yl(r,t),bl=({values:r},t)=>1e3*_a(r,t*2),gl=({values:r},t)=>_a(r,t*2),wl=({values:r},t)=>Sp(r,t*2),vl=({values:r},t)=>Ip(r,t*2),Np=(r,t)=>{switch(r.type.unit){case X.SECOND:return bl(r,t);case X.MILLISECOND:return gl(r,t);case X.MICROSECOND:return wl(r,t);case X.NANOSECOND:return vl(r,t)}},Sl=({values:r},t)=>r[t],Il=({values:r},t)=>r[t],Fl=({values:r},t)=>r[t],Bl=({values:r},t)=>r[t],Lp=(r,t)=>{switch(r.type.unit){case X.SECOND:return Sl(r,t);case X.MILLISECOND:return Il(r,t);case X.MICROSECOND:return Fl(r,t);case X.NANOSECOND:return Bl(r,t)}},kp=({values:r,stride:t},e)=>Qn.decimal(r.subarray(t*e,t*(e+1))),Cp=(r,t)=>{let{valueOffsets:e,stride:n,children:i}=r,{[t*n]:s,[t*n+1]:o}=e,l=i[0].slice(s,o-s);return new G([l])},Pp=(r,t)=>{let{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:s}=e,o=n[0];return new We(o.slice(i,s-i))},Vp=(r,t)=>new Ar(r,t),Hp=(r,t)=>r.type.mode===_t.Dense?Al(r,t):Tl(r,t),Al=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return At.visit(n,r.valueOffsets[t])},Tl=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return At.visit(n,t)},zp=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},jp=(r,t)=>r.type.unit===jt.DAY_TIME?xl(r,t):Dl(r,t),xl=({values:r},t)=>r.subarray(2*t,2*(t+1)),Dl=({values:r},t)=>{let e=r[t],n=new Int32Array(2);return n[0]=Math.trunc(e/12),n[1]=Math.trunc(e%12),n},Wp=(r,t)=>{let{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new G([s])};R.prototype.visitNull=V(Ap);R.prototype.visitBool=V(Tp);R.prototype.visitInt=V(Rp);R.prototype.visitInt8=V(Tr);R.prototype.visitInt16=V(Tr);R.prototype.visitInt32=V(Tr);R.prototype.visitInt64=V(_l);R.prototype.visitUint8=V(Tr);R.prototype.visitUint16=V(Tr);R.prototype.visitUint32=V(Tr);R.prototype.visitUint64=V(_l);R.prototype.visitFloat=V(Mp);R.prototype.visitFloat16=V(xp);R.prototype.visitFloat32=V(Tr);R.prototype.visitFloat64=V(Tr);R.prototype.visitUtf8=V(Op);R.prototype.visitBinary=V(Ep);R.prototype.visitFixedSizeBinary=V(Dp);R.prototype.visitDate=V(Up);R.prototype.visitDateDay=V(ml);R.prototype.visitDateMillisecond=V(yl);R.prototype.visitTimestamp=V(Np);R.prototype.visitTimestampSecond=V(bl);R.prototype.visitTimestampMillisecond=V(gl);R.prototype.visitTimestampMicrosecond=V(wl);R.prototype.visitTimestampNanosecond=V(vl);R.prototype.visitTime=V(Lp);R.prototype.visitTimeSecond=V(Sl);R.prototype.visitTimeMillisecond=V(Il);R.prototype.visitTimeMicrosecond=V(Fl);R.prototype.visitTimeNanosecond=V(Bl);R.prototype.visitDecimal=V(kp);R.prototype.visitList=V(Cp);R.prototype.visitStruct=V(Vp);R.prototype.visitUnion=V(Hp);R.prototype.visitDenseUnion=V(Al);R.prototype.visitSparseUnion=V(Tl);R.prototype.visitDictionary=V(zp);R.prototype.visitInterval=V(jp);R.prototype.visitIntervalDayTime=V(xl);R.prototype.visitIntervalYearMonth=V(Dl);R.prototype.visitFixedSizeList=V(Wp);R.prototype.visitMap=V(Pp);var At=new R;var ye=Symbol.for("keys"),Bn=Symbol.for("vals"),We=class{constructor(t){return this[ye]=new G([t.children[0]]).memoize(),this[Bn]=t.children[1],new Proxy(this,new ga)}[Symbol.iterator](){return new ba(this[ye],this[Bn])}get size(){return this[ye].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[ye],e=this[Bn],n={};for(let i=-1,s=t.length;++i<s;)n[t.get(i)]=At.visit(e,i);return n}toString(){return"{".concat([...this].map(([t,e])=>"".concat(ze(t),": ").concat(ze(e))).join(", "),"}")}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},ba=class{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),At.visit(this.vals,t)]})}},ga=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[ye].toArray().map(String)}has(t,e){return t[ye].includes(e)}getOwnPropertyDescriptor(t,e){if(t[ye].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[ye].indexOf(e);if(n!==-1){let i=At.visit(Reflect.get(t,Bn),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[ye].indexOf(e);return i!==-1?(kt.visit(Reflect.get(t,Bn),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(We.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[ye]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Bn]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function $p(r,t,e){let n=r.length,i=t>-1?t:n+t%n;return e?e(r,i):i}var El;function ei(r,t,e,n){let{length:i=0}=r,s=typeof t!="number"?0:t,o=typeof e!="number"?i:e;return s<0&&(s=(s%i+i)%i),o<0&&(o=(o%i+i)%i),o<s&&(El=s,s=o,o=El),o>i&&(o=i),n?n(r,s,o):[s,o]}var Ol=r=>r!==r;function xr(r){if(typeof r!=="object"||r===null)return Ol(r)?Ol:e=>e===r;if(r instanceof Date){let e=r.valueOf();return n=>n instanceof Date?n.valueOf()===e:!1}return ArrayBuffer.isView(r)?e=>e?ta(r,e):!1:r instanceof Map?Xp(r):Array.isArray(r)?Yp(r):r instanceof G?Gp(r):Kp(r,!0)}function Yp(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=xr(r[e]);return Us(t)}function Xp(r){let t=-1,e=[];for(let n of r.values())e[++t]=xr(n);return Us(e)}function Gp(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=xr(r.get(e));return Us(t)}function Kp(r,t=!1){let e=Object.keys(r);if(!t&&e.length===0)return()=>!1;let n=[];for(let i=-1,s=e.length;++i<s;)n[i]=xr(r[e[i]]);return Us(n,e)}function Us(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return Jp(r,e);case Map:return Rl(r,e,e.keys());case We:case Ar:case Object:case void 0:return Rl(r,e,t||Object.keys(e))}return e instanceof G?qp(r,e):!1}}function Jp(r,t){let e=r.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!r[n](t[n]))return!1;return!0}function qp(r,t){let e=r.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!r[n](t.get(n)))return!1;return!0}function Rl(r,t,e){let n=e[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),s=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,a=r.length,l=s.next(),f=n.next(),m=i.next();for(;o<a&&!f.done&&!m.done&&!l.done&&!(f.value!==m.value||!r[o](l.value));++o,f=n.next(),m=i.next(),l=s.next());return o===a&&f.done&&m.done&&l.done?!0:(n.return&&n.return(),i.return&&i.return(),s.return&&s.return(),!1)}var va={};Gr(va,{BitIterator:()=>qr,getBit:()=>Ml,getBool:()=>Ls,packBools:()=>Zr,popcnt_array:()=>Ul,popcnt_bit_range:()=>ri,popcnt_uint32:()=>Ns,setBool:()=>Zp,truncateBitmap:()=>An});function Ls(r,t,e,n){return(e&1<<n)!==0}function Ml(r,t,e,n){return(e&1<<n)>>n}function Zp(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function An(r,t,e){let n=e.byteLength+7&-8;if(r>0||e.byteLength<n){let i=new Uint8Array(n);return i.set(r%8===0?e.subarray(r>>3):Zr(new qr(e,r,t,null,Ls)).subarray(0,n)),i}return e}function Zr(r){let t=[],e=0,n=0,i=0;for(let o of r)o&&(i|=1<<n),++n===8&&(t[e++]=i,i=n=0);(e===0||n>0)&&(t[e++]=i);let s=new Uint8Array(t.length+7&-8);return s.set(t),s}var qr=class{constructor(t,e,n,i,s){this.bytes=t,this.length=n,this.context=i,this.get=s,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function ri(r,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(let o of new qr(r,t,e-t,r,Ml))s+=o;return s}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return ri(r,t,i)+ri(r,n,e)+Ul(r,i>>3,n-i>>3)}function Ul(r,t,e){let n=0,i=Math.trunc(t),s=new DataView(r.buffer,r.byteOffset,r.byteLength),o=e===void 0?r.byteLength:i+e;for(;o-i>=4;)n+=Ns(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=Ns(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=Ns(s.getUint8(i)),i+=1;return n}function Ns(r){let t=Math.trunc(r);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var Qp=-1,ot=class r{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get byteLength(){let t=0,{valueOffsets:e,values:n,nullBitmap:i,typeIds:s}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){let t=this._nullCount,e;return t<=Qp&&(e=this.nullBitmap)&&(this._nullCount=t=this.length-ri(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,i,s,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let l;s instanceof r?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=ae(t),s&&((l=s[0])&&(this.valueOffsets=l),(l=s[1])&&(this.values=l),(l=s[2])&&(this.nullBitmap=l),(l=s[3])&&(this.typeIds=l))),this.nullable=this._nullCount!==0&&this.nullBitmap&&this.nullBitmap.byteLength>0}getValid(t){if(this.nullable&&this.nullCount>0){let e=this.offset+t;return(this.nullBitmap[e>>3]&1<<e%8)!==0}return!0}setValid(t,e){if(!this.nullable)return e;if(!this.nullBitmap||this.nullBitmap.byteLength<=t>>3){let{nullBitmap:l}=this._changeLengthAndBackfillNullBitmap(this.length);Object.assign(this,{nullBitmap:l,_nullCount:0})}let{nullBitmap:n,offset:i}=this,s=i+t>>3,o=(i+t)%8,a=n[s]>>o&1;return e?a===0&&(n[s]|=1<<o,this._nullCount=this.nullCount+1):a===1&&(n[s]&=~(1<<o),this._nullCount=this.nullCount-1),e}clone(t=this.type,e=this.offset,n=this.length,i=this._nullCount,s=this,o=this.children){return new r(t,e,n,i,s,o,this.dictionary)}slice(t,e){let{stride:n,typeId:i,children:s}=this,o=+(this._nullCount===0)-1,a=i===16?n:1,l=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,o,l,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===h.Null)return this.clone(this.type,0,t,0);let{length:e,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);i[e>>3]=(1<<e-(e&-8))-1,n>0&&i.set(An(this.offset,e,this.nullBitmap),0);let s=this.buffers;return s[me.VALIDITY]=i,this.clone(this.type,0,t,n+(t-e),s)}_sliceBuffers(t,e,n,i){let s,{buffers:o}=this;return(s=o[me.TYPE])&&(o[me.TYPE]=s.subarray(t,t+e)),(s=o[me.OFFSET])&&(o[me.OFFSET]=s.subarray(t,t+e+1))||(s=o[me.DATA])&&(o[me.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};ot.prototype.children=Object.freeze([]);var Sa=class r extends E{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:n=0,["length"]:i=0}=t;return new ot(e,n,i,0)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,s,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,s,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,s,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.data),s=L(t.nullBitmap),o=Jr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new ot(e,n,a,l,[o,i,s])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.data),s=L(t.nullBitmap),o=Jr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new ot(e,n,a,l,[o,i,s])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/ae(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,s,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/ae(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,s,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/ae(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,s,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/ae(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,s,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/ae(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,s,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,s=L(t.nullBitmap),o=Jr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new ot(e,n,a,l,[o,void 0,s],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=L(t.nullBitmap),{length:o=i.reduce((l,{length:f})=>Math.max(l,f),0),nullCount:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,void 0,s],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=L(t.nullBitmap),o=W(e.ArrayType,t.typeIds),{["length"]:a=o.length,["nullCount"]:l=t.nullBitmap?-1:0}=t;if(D.isSparseUnion(e))return new ot(e,n,a,l,[void 0,void 0,s,o],i);let f=Jr(t.valueOffsets);return new ot(e,n,a,l,[f,void 0,s,o],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.nullBitmap),s=W(e.indices.ArrayType,t.data),{["dictionary"]:o=new G([new r().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new ot(e,n,a,l,[void 0,s,i],[],o)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/ae(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,s,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new r().visit({type:e.valueType})}=t,s=L(t.nullBitmap),{["length"]:o=i.length/ae(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,void 0,s],[i])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new r().visit({type:e.childType})}=t,s=L(t.nullBitmap),o=Jr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new ot(e,n,a,l,[o,void 0,s],[i])}};function P(r){return new Sa().visit(r)}var ni=class{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function ks(r){return r.reduce((t,e)=>t+e.nullCount,0)}function Cs(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function Ps(r,t,e,n){let i=[];for(let s=-1,o=r.length;++s<o;){let a=r[s],l=t[s],{length:f}=a;if(l>=n)break;if(e>=l+f)continue;if(l>=e&&l+f<=n){i.push(a);continue}let m=Math.max(0,e-l),_=Math.min(n-l,f);i.push(a.slice(m,_-m))}return i.length===0&&i.push(r[0].slice(0,0)),i}function Ia(r,t,e,n){let i=0,s=0,o=t.length-1;do{if(i>=o-1)return e<t[o]?n(r,i,e-t[i]):null;s=i+Math.trunc((o-i)*.5),e<t[s]?o=s:i=s}while(i<o)}function ii(r,t){return r.getValid(t)}function Dr(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return Ia(n,this._offsets,e,t)}}function Vs(r){let t;function e(n,i,s){return r(n[i],s,t)}return function(n,i){let s=this.data;t=i;let o=Ia(s,this._offsets,n,e);return t=void 0,o}}function Hs(r){let t;function e(n,i,s){let o=s,a=0,l=0;for(let f=i-1,m=n.length;++f<m;){let _=n[f];if(~(a=r(_,t,o)))return l+a;o=0,l+=_.length}return-1}return function(n,i){t=n;let s=this.data,o=typeof i!="number"?e(s,0,0):Ia(s,this._offsets,i,e);return t=void 0,o}}var M=class extends E{};function tm(r,t){return t===null&&r.length>0?0:-1}function em(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new qr(e,r.offset+(t||0),r.length,e,Ls)){if(!i)return n;++n}return-1}function $(r,t,e){if(t===void 0)return-1;if(t===null)return em(r,e);let n=At.getVisitFn(r),i=xr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}function Nl(r,t,e){let n=At.getVisitFn(r),i=xr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}M.prototype.visitNull=tm;M.prototype.visitBool=$;M.prototype.visitInt=$;M.prototype.visitInt8=$;M.prototype.visitInt16=$;M.prototype.visitInt32=$;M.prototype.visitInt64=$;M.prototype.visitUint8=$;M.prototype.visitUint16=$;M.prototype.visitUint32=$;M.prototype.visitUint64=$;M.prototype.visitFloat=$;M.prototype.visitFloat16=$;M.prototype.visitFloat32=$;M.prototype.visitFloat64=$;M.prototype.visitUtf8=$;M.prototype.visitBinary=$;M.prototype.visitFixedSizeBinary=$;M.prototype.visitDate=$;M.prototype.visitDateDay=$;M.prototype.visitDateMillisecond=$;M.prototype.visitTimestamp=$;M.prototype.visitTimestampSecond=$;M.prototype.visitTimestampMillisecond=$;M.prototype.visitTimestampMicrosecond=$;M.prototype.visitTimestampNanosecond=$;M.prototype.visitTime=$;M.prototype.visitTimeSecond=$;M.prototype.visitTimeMillisecond=$;M.prototype.visitTimeMicrosecond=$;M.prototype.visitTimeNanosecond=$;M.prototype.visitDecimal=$;M.prototype.visitList=$;M.prototype.visitStruct=$;M.prototype.visitUnion=$;M.prototype.visitDenseUnion=Nl;M.prototype.visitSparseUnion=Nl;M.prototype.visitDictionary=$;M.prototype.visitInterval=$;M.prototype.visitIntervalDayTime=$;M.prototype.visitIntervalYearMonth=$;M.prototype.visitFixedSizeList=$;M.prototype.visitMap=$;var Qr=new M;var U=class extends E{};function H(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(t.typeId===h.Timestamp||t instanceof It&&t.bitWidth!==64||t instanceof Te&&t.bitWidth!==64||t instanceof Zt&&t.precision!==ht.HALF))return new ni(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new ni(r.data.length,n=>{let s=r.data[n].length,o=r.slice(e,e+s);return e+=s,new Fa(o)})}var Fa=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};U.prototype.visitNull=H;U.prototype.visitBool=H;U.prototype.visitInt=H;U.prototype.visitInt8=H;U.prototype.visitInt16=H;U.prototype.visitInt32=H;U.prototype.visitInt64=H;U.prototype.visitUint8=H;U.prototype.visitUint16=H;U.prototype.visitUint32=H;U.prototype.visitUint64=H;U.prototype.visitFloat=H;U.prototype.visitFloat16=H;U.prototype.visitFloat32=H;U.prototype.visitFloat64=H;U.prototype.visitUtf8=H;U.prototype.visitBinary=H;U.prototype.visitFixedSizeBinary=H;U.prototype.visitDate=H;U.prototype.visitDateDay=H;U.prototype.visitDateMillisecond=H;U.prototype.visitTimestamp=H;U.prototype.visitTimestampSecond=H;U.prototype.visitTimestampMillisecond=H;U.prototype.visitTimestampMicrosecond=H;U.prototype.visitTimestampNanosecond=H;U.prototype.visitTime=H;U.prototype.visitTimeSecond=H;U.prototype.visitTimeMillisecond=H;U.prototype.visitTimeMicrosecond=H;U.prototype.visitTimeNanosecond=H;U.prototype.visitDecimal=H;U.prototype.visitList=H;U.prototype.visitStruct=H;U.prototype.visitUnion=H;U.prototype.visitDenseUnion=H;U.prototype.visitSparseUnion=H;U.prototype.visitDictionary=H;U.prototype.visitInterval=H;U.prototype.visitIntervalDayTime=H;U.prototype.visitIntervalYearMonth=H;U.prototype.visitFixedSizeList=H;U.prototype.visitMap=H;var Tn=new U;var rm=(r,t)=>r+t,$e=class extends E{visitNull(t,e){return 0}visitInt(t,e){return t.type.bitWidth/8}visitFloat(t,e){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,e){return 1/8}visitDecimal(t,e){return t.type.bitWidth/8}visitDate(t,e){return(t.type.unit+1)*4}visitTime(t,e){return t.type.bitWidth/8}visitTimestamp(t,e){return t.type.unit===X.SECOND?4:8}visitInterval(t,e){return(t.type.unit+1)*4}visitStruct(t,e){return t.children.reduce((n,i)=>n+ce.visit(i,e),0)}visitFixedSizeBinary(t,e){return t.type.byteWidth}visitMap(t,e){return 8+t.children.reduce((n,i)=>n+ce.visit(i,e),0)}visitDictionary(t,e){var n;return t.type.indices.bitWidth/8+(((n=t.dictionary)===null||n===void 0?void 0:n.getByteLength(t.values[e]))||0)}},nm=({valueOffsets:r},t)=>8+(r[t+1]-r[t]),im=({valueOffsets:r},t)=>8+(r[t+1]-r[t]),sm=({valueOffsets:r,stride:t,children:e},n)=>{let i=e[0],{[n*t]:s}=r,{[n*t+1]:o}=r,a=ce.getVisitFn(i.type),l=i.slice(s,o-s),f=8;for(let m=-1,_=o-s;++m<_;)f+=a(l,m);return f},om=({stride:r,children:t},e)=>{let n=t[0],i=n.slice(e*r,r),s=ce.getVisitFn(n.type),o=0;for(let a=-1,l=i.length;++a<l;)o+=s(i,a);return o},am=(r,t)=>r.type.mode===_t.Dense?Ll(r,t):kl(r,t),Ll=({type:r,children:t,typeIds:e,valueOffsets:n},i)=>{let s=r.typeIdToChildIndex[e[i]];return 8+ce.visit(t[s],n[i])},kl=({children:r},t)=>4+ce.visitMany(r,r.map(()=>t)).reduce(rm,0);$e.prototype.visitUtf8=nm;$e.prototype.visitBinary=im;$e.prototype.visitList=sm;$e.prototype.visitFixedSizeList=om;$e.prototype.visitUnion=am;$e.prototype.visitDenseUnion=Ll;$e.prototype.visitSparseUnion=kl;var ce=new $e;var Cl,Pl={},Vl={},G=class r{constructor(t){var e,n,i;let s=t[0]instanceof r?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof ot)))throw new TypeError("Vector constructor expects an Array of Data instances.");let o=(e=s[0])===null||e===void 0?void 0:e.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:l,indexOf:f,byteLength:m}=Pl[o.typeId],_=s[0];this.isValid=g=>ii(_,g),this.get=g=>a(_,g),this.set=(g,B)=>l(_,g,B),this.indexOf=g=>f(_,g),this.getByteLength=g=>m(_,g),this._offsets=[0,_.length];break}default:Object.setPrototypeOf(this,Vl[o.typeId]),this._offsets=Cs(s);break}this.data=s,this.type=o,this.stride=ae(o),this.numChildren=(i=(n=o.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this._byteLength===-1&&(this._byteLength=this.data.reduce((t,e)=>t+e.byteLength,0)),this._byteLength}get nullCount(){return this._nullCount===-1&&(this._nullCount=ks(this.data)),this._nullCount}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return"".concat(this.VectorName,"<").concat(this.type[Symbol.toStringTag],">")}get VectorName(){return"".concat(h[this.type.typeId],"Vector")}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>0}getByteLength(t){return 0}[Symbol.iterator](){return Tn.visit(this)}concat(...t){return new r(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new r(ei(this,t,e,({data:n,_offsets:i},s,o)=>Ps(n,i,s,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:i,ArrayType:s}=this;switch(t.typeId){case h.Int:case h.Float:case h.Decimal:case h.Time:case h.Timestamp:switch(e.length){case 0:return new s;case 1:return e[0].values.subarray(0,n*i);default:return e.reduce((o,{values:a,length:l})=>(o.array.set(a.subarray(0,l*i),o.offset),o.offset+=l*i,o),{array:new s(n*i),offset:0}).array}}return[...this]}toString(){return"[".concat([...this].join(","),"]")}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new r(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return D.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(D.isDictionary(this.type)){let t=new zs(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new r(e)}return new zs(this)}unmemoize(){if(D.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new r(e)}return this}};Cl=Symbol.toStringTag;G[Cl]=(r=>{r.type=D.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._nullCount=-1,r._byteLength=-1,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;let t=Object.keys(h).map(e=>h[e]).filter(e=>typeof e=="number"&&e!==h.NONE);for(let e of t){let n=At.getVisitFnByTypeId(e),i=kt.getVisitFnByTypeId(e),s=Qr.getVisitFnByTypeId(e),o=ce.getVisitFnByTypeId(e);Pl[e]={get:n,set:i,indexOf:s,byteLength:o},Vl[e]=Object.create(r,{isValid:{value:Dr(ii)},get:{value:Dr(At.getVisitFnByTypeId(e))},set:{value:Vs(kt.getVisitFnByTypeId(e))},indexOf:{value:Hs(Qr.getVisitFnByTypeId(e))},getByteLength:{value:Dr(ce.getVisitFnByTypeId(e))}})}return"Vector"})(G.prototype);var zs=class r extends G{constructor(t){super(t.data);let e=this.get,n=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){let a=s[o];if(a!==void 0)return a;let l=e.call(this,o);return s[o]=l,l}}),Object.defineProperty(this,"set",{value(o,a){n.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new r(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new G(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function Hl(r){if(!r||r.length<=0)return function(i){return!0};let t="",e=r.filter(n=>n===n);return e.length>0&&(t="\n switch (x) {".concat(e.map(n=>"\n case ".concat(cm(n),":")).join(""),"\n return false;\n }")),r.length!==e.length&&(t="if (x !== x) return false;\n".concat(t)),new Function("x","".concat(t,"\nreturn true;"))}function cm(r){return typeof r!="bigint"?ze(r):"".concat(ze(r),"n")}var Ba=(r,t)=>(Math.ceil(r)*t+63&-64||64)/t,lm=(r,t=0)=>r.length>=t?r.subarray(0,t):bn(new r.constructor(t),r,0),Er=class{constructor(t,e=1){this.buffer=t,this.stride=e,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t.constructor,this._resize(this.length=Math.ceil(t.length/e))}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,e){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let e=this.stride,n=this.length*e,i=this.buffer.length;n>=i&&this._resize(i===0?Ba(n*1,this.BYTES_PER_ELEMENT):Ba(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Ba(t*this.stride,this.BYTES_PER_ELEMENT);let e=lm(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=bn(new this.ArrayType(t),this.buffer)}};Er.prototype.offset=0;var fr=class extends Er{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,e){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=e,this}},xn=class extends fr{constructor(t=new Uint8Array(0)){super(t,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,e){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,s=t%8,o=n[i]>>s&1;return e?o===0&&(n[i]|=1<<s,++this.numValid):o===1&&(n[i]&=~(1<<s),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},Dn=class extends fr{constructor(t=new Int32Array(1)){super(t,1)}append(t){return this.set(this.length-1,t)}set(t,e){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&i.fill(i[n],n,t),i[t]=i[t-1]+e,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,0),super.flush(t+1)}};var pt=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:e}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=e,this.stride=ae(t),this._nulls=new xn,e&&e.length>0&&(this._isValid=Hl(e))}toVector(){return new G([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:e,_values:n,_nulls:i,_typeIds:s,children:o}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),o.reduce((a,l)=>a+l.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((e,n)=>e+n.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,e){return this.setValid(t,this.isValid(e))&&this.setValue(t,e),this}setValue(t,e){this._setValue(this,t,e)}setValid(t,e){return this.length=this._nulls.set(t,+e).length,e}addChild(t,e="".concat(this.numChildren)){throw new Error('Cannot append children to non-nested type "'.concat(this.type,'"'))}getChildAt(t){return this.children[t]||null}flush(){let t,e,n,i,{type:s,length:o,nullCount:a,_typeIds:l,_offsets:f,_values:m,_nulls:_}=this;(e=l==null?void 0:l.flush(o))?i=f==null?void 0:f.flush(o):(i=f==null?void 0:f.flush(o))?t=m==null?void 0:m.flush(f.last()):t=m==null?void 0:m.flush(o),a>0&&(n=_==null?void 0:_.flush(o));let g=this.children.map(B=>B.flush());return this.clear(),P({type:s,length:o,nullCount:a,children:g,child:g[0],data:t,typeIds:e,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,e,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(e=this._values)===null||e===void 0||e.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let s of this.children)s.clear();return this}};pt.prototype.length=1;pt.prototype.stride=1;pt.prototype.children=null;pt.prototype.finished=!1;pt.prototype.nullValues=null;pt.prototype._isValid=()=>!0;var Ut=class extends pt{constructor(t){super(t),this._values=new fr(new this.ArrayType(0),this.stride)}setValue(t,e){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}},Ye=class extends pt{constructor(t){super(t),this._pendingLength=0,this._offsets=new Dn}setValue(t,e){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=e instanceof We?e[ye].length:e.length,n.set(t,e)}setValid(t,e){return super.setValid(t,e)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,e=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,e),this}};var tn=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,e,n,i){return t.prep(8,24),t.writeInt64(BigInt(i!=null?i:0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(e!=null?e:0)),t.offset()}};var Xe=new Int32Array(2),js=new Float32Array(Xe.buffer),Ws=new Float64Array(Xe.buffer),En=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var si;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(si||(si={}));var le=class r{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new r(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return Xe[0]=this.readInt32(t),js[0]}readFloat64(t){return Xe[En?0:1]=this.readInt32(t),Xe[En?1:0]=this.readInt32(t+4),Ws[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}writeUint64(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}writeFloat32(t,e){js[0]=e,this.writeInt32(t,Xe[0])}writeFloat64(t,e){Ws[0]=e,this.writeInt32(t,Xe[En?0:1]),this.writeInt32(t+4,Xe[En?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t}__offset(t,e){let n=t-this.readInt32(t);return e<this.readInt16(n)?this.readInt16(n+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);let n=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+n);return e===si.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0}createScalarList(t,e){let n=[];for(let i=0;i<e;++i){let s=t(i);s!==null&&n.push(s)}return n}createObjList(t,e){let n=[];for(let i=0;i<e;++i){let s=t(i);s!==null&&n.push(s.unpack())}return n}};var en=class r{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let e;t?e=t:e=1024,this.bb=le.allocate(e),this.space=e}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);let n=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<n+t+e;){let i=this.bb.capacity();this.bb=r.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(n)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,n){(this.force_defaults||e!=n)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,n){(this.force_defaults||e!=n)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,n){(this.force_defaults||e!=n)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,n){(this.force_defaults||e!==n)&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,n){(this.force_defaults||e!=n)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,n){e!=n&&(this.nested(e),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=e<<1,i=le.allocate(n);return i.setPosition(n-e),i.bytes().set(t.bytes(),n-e),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);let n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);let i=2;this.addInt16(t-this.object_start);let s=(n+i)*2;this.addInt16(s);let o=0,a=this.space;t:for(e=0;e<this.vtables.length;e++){let l=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(l)){for(let f=2;f<s;f+=2)if(this.bb.readInt16(a+f)!=this.bb.readInt16(l+f))continue t;o=this.vtables[e];break}}return o?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,o-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,n){let i=n?4:0;if(e){let s=e;if(this.prep(this.minalign,4+4+i),s.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let o=4-1;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(e<this.bb.readInt16(i)&&this.bb.readInt16(i+e)!=0))throw new TypeError("FlatBuffers: field "+e+" must be set")}startVector(t,e,n){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(n,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(t==null)return 0;let e;t instanceof Uint8Array?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);for(let n=0,i=this.space,s=this.bb.bytes();n<e.length;n++)s[i++]=e[n];return this.endVector()}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let e=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)e.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var xt=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKeyValue(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}key(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,n){return r.startKeyValue(t),r.addKey(t,e),r.addValue(t,n),r.endKeyValue(t)}};var Or;(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(Or||(Or={}));var Rr;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(Rr||(Rr={}));var oi;(function(r){r[r.DenseArray=0]="DenseArray"})(oi||(oi={}));var Ue=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInt(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,e){t.addFieldInt32(0,e,0)}static addIsSigned(t,e){t.addFieldInt8(1,+e,0)}static endInt(t){return t.endObject()}static createInt(t,e,n){return r.startInt(t),r.addBitWidth(t,e),r.addIsSigned(t,n),r.endInt(t)}};var Ge=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryEncoding(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new Ue).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):oi.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addIndexType(t,e){t.addFieldOffset(1,e,0)}static addIsOrdered(t,e){t.addFieldInt8(2,+e,0)}static addDictionaryKind(t,e){t.addFieldInt16(3,e,oi.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var ai=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBinary(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return r.startBinary(t),r.endBinary(t)}};var ci=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBool(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return r.startBool(t),r.endBool(t)}};var li;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(li||(li={}));var Mr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDate(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):li.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,li.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return r.startDate(t),r.addUnit(t,e),r.endDate(t)}};var Ke=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDecimal(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static addBitWidth(t,e){t.addFieldInt32(2,e,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,e,n,i){return r.startDecimal(t),r.addPrecision(t,e),r.addScale(t,n),r.addBitWidth(t,i),r.endDecimal(t)}};var Ur;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(Ur||(Ur={}));var Nr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeBinary(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return r.startFixedSizeBinary(t),r.addByteWidth(t,e),r.endFixedSizeBinary(t)}};var Lr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeList(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return r.startFixedSizeList(t),r.addListSize(t,e),r.endFixedSizeList(t)}};var ui;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(ui||(ui={}));var kr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFloatingPoint(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ui.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,ui.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return r.startFloatingPoint(t),r.addPrecision(t,e),r.endFloatingPoint(t)}};var di;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(di||(di={}));var Cr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInterval(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):di.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,di.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return r.startInterval(t),r.addUnit(t,e),r.endInterval(t)}};var fi=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsList(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return r.startList(t),r.endList(t)}};var Pr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMap(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return r.startMap(t),r.addKeysSorted(t,e),r.endMap(t)}};var hi=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNull(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return r.startNull(t),r.endNull(t)}};var pi=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsStruct_(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return r.startStruct_(t),r.endStruct_(t)}};var hr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTime(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ur.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,Ur.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return r.startTime(t),r.addUnit(t,e),r.addBitWidth(t,n),r.endTime(t)}};var pr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTimestamp(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ur.SECOND}timezone(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,Ur.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return r.startTimestamp(t),r.addUnit(t,e),r.addTimezone(t,n),r.endTimestamp(t)}};var mi;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(mi||(mi={}));var Ne=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUnion(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):mi.Sparse}typeIds(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,mi.Sparse)}static addTypeIds(t,e){t.addFieldOffset(1,e,0)}static createTypeIdsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addInt32(e[n]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,n){return r.startUnion(t),r.addMode(t,e),r.addTypeIds(t,n),r.endUnion(t)}};var yi=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return r.startUtf8(t),r.endUtf8(t)}};var mt;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.RunEndEncoded=22]="RunEndEncoded"})(mt||(mt={}));var Vt=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):mt.NONE}type(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){let e=this.bb.__offset(this.bb_pos,12);return e?(t||new Ge).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){let n=this.bb.__offset(this.bb_pos,14);return n?(e||new r).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,16);return n?(e||new xt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,mt.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}};var Qt=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Rr.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new Vt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new xt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,Rr.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,n,i,s){return r.startSchema(t),r.addEndianness(t,e),r.addFields(t,n),r.addCustomMetadata(t,i),r.addFeatures(t,s),r.endSchema(t)}};var ue=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Or.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new Qt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new tn).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){let n=this.bb.__offset(this.bb_pos,10);return n?(e||new tn).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new xt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,Or.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}};var rt=class r{constructor(t=[],e,n){this.fields=t||[],this.metadata=e||new Map,n||(n=Aa(t)),this.dictionaries=n}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return"Schema<{ ".concat(this.fields.map((t,e)=>"".concat(e,": ").concat(t)).join(", ")," }>")}select(t){let e=new Set(t),n=this.fields.filter(i=>e.has(i.name));return new r(n,this.metadata)}selectAt(t){let e=t.map(n=>this.fields[n]).filter(Boolean);return new r(e,this.metadata)}assign(...t){let e=t[0]instanceof r?t[0]:Array.isArray(t[0])?new r(t[0]):new r(t),n=[...this.fields],i=Ys(Ys(new Map,this.metadata),e.metadata),s=e.fields.filter(a=>{let l=n.findIndex(f=>f.name===a.name);return~l?(n[l]=a.clone({metadata:Ys(Ys(new Map,n[l].metadata),a.metadata)}))&&!1:!0}),o=Aa(s,new Map);return new r([...n,...s],i,new Map([...this.dictionaries,...o]))}};rt.prototype.fields=null;rt.prototype.metadata=null;rt.prototype.dictionaries=null;var Y=class r{static new(...t){let[e,n,i,s]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),s===void 0&&(s=t[0].metadata)),new r("".concat(e),n,i,s)}constructor(t,e,n=!1,i){this.name=t,this.type=e,this.nullable=n,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return"".concat(this.name,": ").concat(this.type)}clone(...t){let[e,n,i,s]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,n=this.type,i=this.nullable,s=this.metadata]=t:{name:e=this.name,type:n=this.type,nullable:i=this.nullable,metadata:s=this.metadata}=t[0],r.new(e,n,i,s)}};Y.prototype.type=null;Y.prototype.name=null;Y.prototype.nullable=null;Y.prototype.metadata=null;function Ys(r,t){return new Map([...r||new Map,...t||new Map])}function Aa(r,t=new Map){for(let e=-1,n=r.length;++e<n;){let s=r[e].type;if(D.isDictionary(s)){if(!t.has(s.id))t.set(s.id,s.dictionary);else if(t.get(s.id)!==s.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}s.children&&s.children.length>0&&Aa(s.children,t)}return t}var um=en,dm=le,mr=class{static decode(t){t=new dm(L(t));let e=ue.getRootAsFooter(t),n=rt.decode(e.schema());return new Ta(n,e)}static encode(t){let e=new um,n=rt.encode(e,t.schema);ue.startRecordBatchesVector(e,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())yr.encode(e,o);let i=e.endVector();ue.startDictionariesVector(e,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())yr.encode(e,o);let s=e.endVector();return ue.startFooter(e),ue.addSchema(e,n),ue.addVersion(e,Mt.V4),ue.addRecordBatches(e,i),ue.addDictionaries(e,s),ue.finishFooterBuffer(e,ue.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=Mt.V4,n,i){this.schema=t,this.version=e,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,e=-1,n=this.numRecordBatches;++e<n;)(t=this.getRecordBatch(e))&&(yield t)}*dictionaryBatches(){for(let t,e=-1,n=this.numDictionaries;++e<n;)(t=this.getDictionaryBatch(e))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var Ta=class extends mr{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,e){super(t,e.version()),this._footer=e}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let e=this._footer.recordBatches(t);if(e)return yr.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return yr.decode(e)}return null}},yr=class r{static decode(t){return new r(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){let{metaDataLength:n}=e,i=BigInt(e.offset),s=BigInt(e.bodyLength);return tn.createBlock(t,i,n,s)}constructor(t,e,n){this.metaDataLength=t,this.offset=qt(n),this.bodyLength=qt(e)}};var dt=Object.freeze({done:!0,value:void 0}),_i=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},rn=class{tee(){return this._getDOMStream().tee()}pipe(t,e){return this._getNodeStream().pipe(t,e)}pipeTo(t,e){return this._getDOMStream().pipeTo(t,e)}pipeThrough(t,e){return this._getDOMStream().pipeThrough(t,e)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},Xs=class extends rn{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return F(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(dt);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return Nt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Nt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return F(this,void 0,void 0,function*(){return yield this.abort(t),dt})}return(t){return F(this,void 0,void 0,function*(){return yield this.close(),dt})}read(t){return F(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return F(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((e,n)=>{this.resolvers.push({resolve:e,reject:n})}):Promise.resolve(dt)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var Je=class extends Xs{write(t){if((t=L(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Kn(this.toUint8Array(!0)):this.toUint8Array(!1).then(Kn)}toUint8Array(t=!1){return t?se(this._values)[0]:(()=>F(this,void 0,void 0,function*(){var e,n,i,s;let o=[],a=0;try{for(var l=!0,f=Se(this),m;m=yield f.next(),e=m.done,!e;l=!0){s=m.value,l=!1;let _=s;o.push(_),a+=_.byteLength}}catch(_){n={error:_}}finally{try{!l&&!e&&(i=f.return)&&(yield i.call(f))}finally{if(n)throw n.error}}return se(o,a)[0]}))()}},qe=class{constructor(t){t&&(this.source=new xa(Nt.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},be=class r{constructor(t){t instanceof r?this.source=t.source:t instanceof Je?this.source=new _r(Nt.fromAsyncIterable(t)):ls(t)?this.source=new _r(Nt.fromNodeStream(t)):Jn(t)?this.source=new _r(Nt.fromDOMStream(t)):as(t)?this.source=new _r(Nt.fromDOMStream(t.body)):Fe(t)?this.source=new _r(Nt.fromIterable(t)):Ie(t)?this.source=new _r(Nt.fromAsyncIterable(t)):pe(t)&&(this.source=new _r(Nt.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},xa=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||dt)}return(t){return Object.create(this.source.return&&this.source.return(t)||dt)}},_r=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return F(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return F(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return F(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,e="read"){return F(this,void 0,void 0,function*(){return yield this.source.next({cmd:e,size:t})})}throw(t){return F(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||dt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return F(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||dt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var bi=class extends qe{constructor(t,e){super(),this.position=0,this.buffer=L(t),this.size=e===void 0?this.buffer.byteLength:e}readInt32(t){let{buffer:e,byteOffset:n}=this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:e,size:n,position:i}=this;return e&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),e.subarray(i,this.position)):null}readAt(t,e){let n=this.buffer,i=Math.min(this.size,t+e);return n?n.subarray(t,i):new Uint8Array(e)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Vr=class extends be{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=(()=>F(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return F(this,void 0,void 0,function*(){let{buffer:e,byteOffset:n}=yield this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)})}seek(t){return F(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return F(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:e,size:n,position:i}=this;if(e&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let s=i,o=0,a=0,l=Math.min(n,s+Math.min(n-s,t)),f=new Uint8Array(Math.max(0,(this.position=l)-s));for(;(s+=a)<l&&(o+=a)<f.byteLength;)({bytesRead:a}=yield e.read(f,o,f.byteLength-o,s));return f}return null})}readAt(t,e){return F(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+e<i){let s=Math.min(i,t+e),o=new Uint8Array(s-t);return(yield n.read(o,0,e,t)).buffer}return new Uint8Array(e)})}close(){return F(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return F(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return F(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var Ea={};Gr(Ea,{BaseInt64:()=>gi,Int128:()=>wi,Int64:()=>br,Uint64:()=>bt});function On(r){return r<0&&(r=4294967295+r+1),"0x".concat(r.toString(16))}var Rn=8,Da=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],gi=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let e=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=e[3]*n[3];this.buffer[0]=i&65535;let s=i>>>16;return i=e[2]*n[3],s+=i,i=e[3]*n[2]>>>0,s+=i,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0<i?65536:0,this.buffer[1]+=s>>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}_plus(t){let e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return"".concat(On(this.buffer[1])," ").concat(On(this.buffer[0]))}},bt=class r extends gi{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return r.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return r.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.length,i=new r(e);for(let s=0;s<n;){let o=Rn<n-s?Rn:n-s,a=new r(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),l=new r(new Uint32Array([Da[o],0]));i.times(l),i.plus(a),s+=o}return i}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)r.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new r(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new r(new Uint32Array(t.buffer)).plus(e)}},br=class r extends gi{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let e=this.buffer[1]<<0,n=t.buffer[1]<<0;return e<n||e===n&&this.buffer[0]<t.buffer[0]}static from(t,e=new Uint32Array(2)){return r.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return r.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,s=new r(e);for(let o=n?1:0;o<i;){let a=Rn<i-o?Rn:i-o,l=new r(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),f=new r(new Uint32Array([Da[a],0]));s.times(f),s.plus(l),o+=a}return n?s.negate():s}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)r.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new r(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new r(new Uint32Array(t.buffer)).plus(e)}},wi=class r{constructor(t){this.buffer=t}high(){return new br(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new br(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let e=new bt(new Uint32Array([this.buffer[3],0])),n=new bt(new Uint32Array([this.buffer[2],0])),i=new bt(new Uint32Array([this.buffer[1],0])),s=new bt(new Uint32Array([this.buffer[0],0])),o=new bt(new Uint32Array([t.buffer[3],0])),a=new bt(new Uint32Array([t.buffer[2],0])),l=new bt(new Uint32Array([t.buffer[1],0])),f=new bt(new Uint32Array([t.buffer[0],0])),m=bt.multiply(s,f);this.buffer[0]=m.low();let _=new bt(new Uint32Array([m.high(),0]));return m=bt.multiply(i,f),_.plus(m),m=bt.multiply(s,l),_.plus(m),this.buffer[1]=_.low(),this.buffer[3]=_.lessThan(m)?1:0,this.buffer[2]=_.high(),new bt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(bt.multiply(n,f)).plus(bt.multiply(i,l)).plus(bt.multiply(s,a)),this.buffer[3]+=bt.multiply(e,f).plus(bt.multiply(n,l)).plus(bt.multiply(i,a)).plus(bt.multiply(s,o)).low(),this}plus(t){let e=new Uint32Array(4);return e[3]=this.buffer[3]+t.buffer[3]>>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]<this.buffer[0]>>>0&&++e[1],e[1]<this.buffer[1]>>>0&&++e[2],e[2]<this.buffer[2]>>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return"".concat(On(this.buffer[3])," ").concat(On(this.buffer[2])," ").concat(On(this.buffer[1])," ").concat(On(this.buffer[0]))}static multiply(t,e){return new r(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new r(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return r.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return r.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,s=new r(e);for(let o=n?1:0;o<i;){let a=Rn<i-o?Rn:i-o,l=new r(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),f=new r(new Uint32Array([Da[a],0,0,0]));s.times(f),s.plus(l),o+=a}return n?s.negate():s}static convertArray(t){let e=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)r.from(t[n],new Uint32Array(e.buffer,e.byteOffset+4*4*n,4));return e}};var vi=class extends E{constructor(t,e,n,i){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=i}visit(t){return super.visit(t instanceof Y?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return P({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t){return t.mode===_t.Sparse?this.visitSparseUnion(t):this.visitDenseUnion(t)}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,e,n=this.nextBufferRange()){return e>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+e)}readDictionary(t){return this.dictionaries.get(t.id)}},Gs=class extends vi{constructor(t,e,n,i){super(new Uint8Array(0),e,n,i),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):Zr(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return W(Uint8Array,W(Int32Array,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return W(Uint8Array,W(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:n}=this;return D.isTimestamp(t)?W(Uint8Array,br.convertArray(n[e])):(D.isInt(t)||D.isTime(t))&&t.bitWidth===64?W(Uint8Array,br.convertArray(n[e])):D.isDate(t)&&t.unit===Lt.MILLISECOND?W(Uint8Array,br.convertArray(n[e])):D.isDecimal(t)?W(Uint8Array,wi.convertArray(n[e])):D.isBinary(t)||D.isFixedSizeBinary(t)?fm(n[e]):D.isBool(t)?Zr(n[e]):D.isUtf8(t)?Br(n[e].join("")):W(Uint8Array,W(t.ArrayType,n[e].map(i=>+i)))}};function fm(r){let t=r.join(""),e=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)e[n>>1]=Number.parseInt(t.slice(n,n+2),16);return e}var Mn=class extends Ye{constructor(t){super(t),this._values=new Er(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,L(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,s=0;for(let[o,a]of t)if(a===void 0)n.set(o,0);else{let l=a.length;i.set(a,s),n.set(o,l),s+=l}}};var Ks=class extends pt{constructor(t){super(t),this._values=new xn}setValue(t,e){this._values.set(t,+e)}};var nn=class extends Ut{};nn.prototype._setValue=ua;var Si=class extends nn{};Si.prototype._setValue=Ss;var Ii=class extends nn{};Ii.prototype._setValue=Is;var Fi=class extends Ut{};Fi.prototype._setValue=ha;var Js=class extends pt{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new oe(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=sn({type:this.type.indices,nullValues:e}),this.dictionary=sn({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,e){let n=this.indices;return e=n.setValid(t,e),this.length=n.length,e}setValue(t,e){let n=this._keysToIndices,i=this.valueToKey(e),s=n[i];return s===void 0&&(n[i]=s=this._dictionaryOffset+this.dictionary.append(e).length-1),this.indices.setValue(t,s)}flush(){let t=this.type,e=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=e?e.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:"".concat(t)}};var Bi=class extends Ut{};Bi.prototype._setValue=la;var qs=class extends pt{setValue(t,e){let[n]=this.children,i=t*this.stride;for(let s=-1,o=e.length;++s<o;)n.set(i+s,e[s])}addChild(t,e="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new Ee(this.type.listSize,new Y(e,t.type,!0)),n}};var on=class extends Ut{setValue(t,e){this._values.set(t,e)}},Zs=class extends on{setValue(t,e){super.setValue(t,ti(e))}},Qs=class extends on{},to=class extends on{};var an=class extends Ut{};an.prototype._setValue=pa;var Ai=class extends an{};Ai.prototype._setValue=Rs;var Ti=class extends an{};Ti.prototype._setValue=Ms;var ge=class extends Ut{setValue(t,e){this._values.set(t,e)}},eo=class extends ge{},ro=class extends ge{},no=class extends ge{},io=class extends ge{},so=class extends ge{},oo=class extends ge{},ao=class extends ge{},co=class extends ge{};var lo=class extends Ye{constructor(t){super(t),this._offsets=new Dn}addChild(t,e="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new xe(new Y(e,t.type,!0)),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,s]of t)if(typeof s>"u")e.set(i,0);else{let o=s,a=o.length,l=e.set(i,a).buffer[i];for(let f=-1;++f<a;)n.set(l+f,o[f])}}};var uo=class extends Ye{set(t,e){return super.set(t,e)}setValue(t,e){let n=e instanceof Map?e:new Map(Object.entries(e)),i=this._pending||(this._pending=new Map),s=i.get(t);s&&(this._pendingLength-=s.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,e="".concat(this.numChildren)){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Oe(new Y(e,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,s]of t)if(s===void 0)e.set(i,0);else{let{[i]:o,[i+1]:a}=e.set(i,s.size).buffer;for(let l of s.entries())if(n.set(o,l),++o>=a)break}}};var fo=class extends pt{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var ho=class extends pt{setValue(t,e){let{children:n,type:i}=this;switch(Array.isArray(e)||e.constructor){case!0:return i.children.forEach((s,o)=>n[o].set(t,e[o]));case Map:return i.children.forEach((s,o)=>n[o].set(t,e.get(s.name)));default:return i.children.forEach((s,o)=>n[o].set(t,e[s.name]))}}setValid(t,e){return super.setValid(t,e)||this.children.forEach(n=>n.setValid(t,e)),e}addChild(t,e="".concat(this.numChildren)){let n=this.children.push(t);return this.type=new ut([...this.type.children,new Y(e,t.type,!0)]),n}};var gr=class extends Ut{};gr.prototype._setValue=da;var xi=class extends gr{};xi.prototype._setValue=Fs;var Di=class extends gr{};Di.prototype._setValue=Bs;var Ei=class extends gr{};Ei.prototype._setValue=As;var Oi=class extends gr{};Oi.prototype._setValue=Ts;var wr=class extends Ut{};wr.prototype._setValue=fa;var Ri=class extends wr{};Ri.prototype._setValue=xs;var Mi=class extends wr{};Mi.prototype._setValue=Ds;var Ui=class extends wr{};Ui.prototype._setValue=Es;var Ni=class extends wr{};Ni.prototype._setValue=Os;var Un=class extends pt{constructor(t){super(t),this._typeIds=new fr(new Int8Array(0),1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,e){return this.set(this.length,t,e)}set(t,e,n){return n===void 0&&(n=this._valueToChildTypeId(this,e,t)),this.setValid(t,this.isValid(e))&&this.setValue(t,e,n),this}setValue(t,e,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],s=this.children[i];s==null||s.set(t,e)}addChild(t,e="".concat(this.children.length)){let n=this.children.push(t),{type:{children:i,mode:s,typeIds:o}}=this,a=[...i,new Y(e,t.type)];return this.type=new De(s,[...o,n],a),n}_valueToChildTypeId(t,e,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},po=class extends Un{},mo=class extends Un{constructor(t){super(t),this._offsets=new fr(new Int32Array(0))}setValue(t,e,n){let i=this._typeIds.set(t,n).buffer[t],s=this.getChildAt(this.type.typeIdToChildIndex[i]),o=this._offsets.set(t,s.length).buffer[t];s==null||s.set(o,e)}};var Li=class extends Ye{constructor(t){super(t),this._values=new Er(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,Br(e))}_flushPending(t,e){}};Li.prototype._flushPending=Mn.prototype._flushPending;var Oa=class extends E{visitNull(){return fo}visitBool(){return Ks}visitInt(){return ge}visitInt8(){return eo}visitInt16(){return ro}visitInt32(){return no}visitInt64(){return io}visitUint8(){return so}visitUint16(){return oo}visitUint32(){return ao}visitUint64(){return co}visitFloat(){return on}visitFloat16(){return Zs}visitFloat32(){return Qs}visitFloat64(){return to}visitUtf8(){return Li}visitBinary(){return Mn}visitFixedSizeBinary(){return Bi}visitDate(){return nn}visitDateDay(){return Si}visitDateMillisecond(){return Ii}visitTimestamp(){return gr}visitTimestampSecond(){return xi}visitTimestampMillisecond(){return Di}visitTimestampMicrosecond(){return Ei}visitTimestampNanosecond(){return Oi}visitTime(){return wr}visitTimeSecond(){return Ri}visitTimeMillisecond(){return Mi}visitTimeMicrosecond(){return Ui}visitTimeNanosecond(){return Ni}visitDecimal(){return Fi}visitList(){return lo}visitStruct(){return ho}visitUnion(){return Un}visitDenseUnion(){return mo}visitSparseUnion(){return po}visitDictionary(){return Js}visitInterval(){return an}visitIntervalDayTime(){return Ai}visitIntervalYearMonth(){return Ti}visitFixedSizeList(){return qs}visitMap(){return uo}},zl=new Oa;var N=class extends E{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((n,i)=>this.compareFields(n,e[i]))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}};function te(r,t){return t instanceof r.constructor}function ki(r,t){return r===t||te(r,t)}function vr(r,t){return r===t||te(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function yo(r,t){return r===t||te(r,t)&&r.precision===t.precision}function hm(r,t){return r===t||te(r,t)&&r.byteWidth===t.byteWidth}function Ra(r,t){return r===t||te(r,t)&&r.unit===t.unit}function Ci(r,t){return r===t||te(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function Pi(r,t){return r===t||te(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function pm(r,t){return r===t||te(r,t)&&r.children.length===t.children.length&&Ze.compareManyFields(r.children,t.children)}function mm(r,t){return r===t||te(r,t)&&r.children.length===t.children.length&&Ze.compareManyFields(r.children,t.children)}function Ma(r,t){return r===t||te(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&Ze.compareManyFields(r.children,t.children)}function ym(r,t){return r===t||te(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&Ze.visit(r.indices,t.indices)&&Ze.visit(r.dictionary,t.dictionary)}function Ua(r,t){return r===t||te(r,t)&&r.unit===t.unit}function _m(r,t){return r===t||te(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&Ze.compareManyFields(r.children,t.children)}function bm(r,t){return r===t||te(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&Ze.compareManyFields(r.children,t.children)}N.prototype.visitNull=ki;N.prototype.visitBool=ki;N.prototype.visitInt=vr;N.prototype.visitInt8=vr;N.prototype.visitInt16=vr;N.prototype.visitInt32=vr;N.prototype.visitInt64=vr;N.prototype.visitUint8=vr;N.prototype.visitUint16=vr;N.prototype.visitUint32=vr;N.prototype.visitUint64=vr;N.prototype.visitFloat=yo;N.prototype.visitFloat16=yo;N.prototype.visitFloat32=yo;N.prototype.visitFloat64=yo;N.prototype.visitUtf8=ki;N.prototype.visitBinary=ki;N.prototype.visitFixedSizeBinary=hm;N.prototype.visitDate=Ra;N.prototype.visitDateDay=Ra;N.prototype.visitDateMillisecond=Ra;N.prototype.visitTimestamp=Ci;N.prototype.visitTimestampSecond=Ci;N.prototype.visitTimestampMillisecond=Ci;N.prototype.visitTimestampMicrosecond=Ci;N.prototype.visitTimestampNanosecond=Ci;N.prototype.visitTime=Pi;N.prototype.visitTimeSecond=Pi;N.prototype.visitTimeMillisecond=Pi;N.prototype.visitTimeMicrosecond=Pi;N.prototype.visitTimeNanosecond=Pi;N.prototype.visitDecimal=ki;N.prototype.visitList=pm;N.prototype.visitStruct=mm;N.prototype.visitUnion=Ma;N.prototype.visitDenseUnion=Ma;N.prototype.visitSparseUnion=Ma;N.prototype.visitDictionary=ym;N.prototype.visitInterval=Ua;N.prototype.visitIntervalDayTime=Ua;N.prototype.visitIntervalYearMonth=Ua;N.prototype.visitFixedSizeList=_m;N.prototype.visitMap=bm;var Ze=new N;function cn(r,t){return Ze.compareSchemas(r,t)}function jl(r,t){return Ze.compareFields(r,t)}function Wl(r,t){return Ze.visit(r,t)}function sn(r){let t=r.type,e=new(zl.getVisitFn(t)())(r);if(t.children&&t.children.length>0){let n=r.children||[],i={nullValues:r.nullValues},s=Array.isArray(n)?(o,a)=>n[a]||i:({name:o})=>n[o]||i;for(let[o,a]of t.children.entries()){let{type:l}=a,f=s(a,o);e.children.push(sn(Object.assign(Object.assign({},f),{type:l})))}}return e}function _o(r,t){return gm(r,t.map(e=>e.data.concat()))}function gm(r,t){let e=[...r.fields],n=[],i={numBatches:t.reduce((_,g)=>Math.max(_,g.length),0)},s=0,o=0,a=-1,l=t.length,f,m=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<l;)m[a]=f=t[a].shift(),o=Math.min(o,f?f.length:o);Number.isFinite(o)&&(m=wm(e,o,m,t,i),o>0&&(n[s++]=P({type:new ut(e),length:o,nullCount:0,children:m.slice()})))}return[r=r.assign(e),n.map(_=>new vt(r,_))]}function wm(r,t,e,n,i){var s;let o=(t+63&-64)>>3;for(let a=-1,l=n.length;++a<l;){let f=e[a],m=f==null?void 0:f.length;if(m>=t)m===t?e[a]=f:(e[a]=f.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(f.slice(t,m-t))));else{let _=r[a];r[a]=_.clone({nullable:!0}),e[a]=(s=f==null?void 0:f._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:P({type:_.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var $l,$t=class r{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new rt([]),this._offsets=[0],this;let i,s;t[0]instanceof rt&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());let o=l=>{if(l){if(l instanceof vt)return[l];if(l instanceof r)return l.batches;if(l instanceof ot){if(l.type instanceof ut)return[new vt(new rt(l.type.children),l)]}else{if(Array.isArray(l))return l.flatMap(f=>o(f));if(typeof l[Symbol.iterator]=="function")return[...l].flatMap(f=>o(f));if(typeof l=="object"){let f=Object.keys(l),m=f.map(B=>new G([l[B]])),_=new rt(f.map((B,q)=>new Y(String(B),m[q].type))),[,g]=_o(_,m);return g.length===0?[new vt(l)]:g}}}return[]},a=t.flatMap(l=>o(l));if(i=(n=i!=null?i:(e=a[0])===null||e===void 0?void 0:e.schema)!==null&&n!==void 0?n:new rt([]),!(i instanceof rt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let l of a){if(!(l instanceof vt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!cn(i,l.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=s!=null?s:Cs(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,e)=>t+e.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=ks(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}getByteLength(t){return 0}[Symbol.iterator](){return this.batches.length>0?Tn.visit(new G(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return"[\n ".concat(this.toArray().join(",\n "),"\n]")}concat(...t){let e=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new r(e,n.map(i=>new vt(e,i)))}slice(t,e){let n=this.schema;[t,e]=ei({length:this.numRows},t,e);let i=Ps(this.data,this._offsets,t,e);return new r(n,i.map(s=>new vt(n,s)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let e=this.data.map(n=>n.children[t]);if(e.length===0){let{type:n}=this.schema.fields[t],i=P({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new G(e)}return null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),e)}setChildAt(t,e){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new G([P({type:new Wt,length:this.numRows})]));let s=n.fields.slice(),o=s[t].clone({type:e.type}),a=this.schema.fields.map((l,f)=>this.getChildAt(f));[s[t],a[t]]=[o,e],[n,i]=_o(n,a)}return new r(n,i)}select(t){let e=this.schema.fields.reduce((n,i,s)=>n.set(i.name,s),new Map);return this.selectAt(t.map(n=>e.get(n)).filter(n=>n>-1))}selectAt(t){let e=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new r(e,n)}assign(t){let e=this.schema.fields,[n,i]=t.schema.fields.reduce((a,l,f)=>{let[m,_]=a,g=e.findIndex(B=>B.name===l.name);return~g?_[g]=f:m.push(f),a},[[],[]]),s=this.schema.assign(t.schema),o=[...e.map((a,l)=>[l,i[l]]).map(([a,l])=>l===void 0?this.getChildAt(a):t.getChildAt(l)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new r(..._o(s,o))}};$l=Symbol.toStringTag;$t[$l]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=Dr(ii),r.get=Dr(At.getVisitFn(h.Struct)),r.set=Vs(kt.getVisitFn(h.Struct)),r.indexOf=Hs(Qr.getVisitFn(h.Struct)),r.getByteLength=Dr(ce.getVisitFn(h.Struct)),"Table"))($t.prototype);var Xl,vt=class r{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof rt))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=P({nullCount:0,type:new ut(this.schema.fields),children:this.schema.fields.map(e=>P({type:e.type,nullCount:0}))})]=t,!(this.data instanceof ot))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Yl(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:n,children:i,length:s}=Object.keys(e).reduce((l,f,m)=>(l.children[m]=e[f],l.length=Math.max(l.length,e[f].length),l.fields[m]=Y.new({name:f,type:e[f].type,nullable:!0}),l),{length:0,fields:new Array,children:new Array}),o=new rt(n),a=P({type:new ut(n),length:s,children:i,nullCount:0});[this.schema,this.data]=Yl(o,a.children,s);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=Gl(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return At.visit(this.data,t)}set(t,e){return kt.visit(this.data,t,e)}indexOf(t,e){return Qr.visit(this.data,t,e)}getByteLength(t){return ce.visit(this.data,t)}[Symbol.iterator](){return Tn.visit(new G([this.data]))}toArray(){return[...this]}concat(...t){return new $t(this.schema,[this,...t])}slice(t,e){let[n]=new G([this.data]).slice(t,e).data;return new r(this.schema,n)}getChild(t){var e;return this.getChildAt((e=this.schema.fields)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new G([this.data.children[t]]):null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),e)}setChildAt(t,e){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){e||(e=new G([P({type:new Wt,length:this.numRows})]));let s=n.fields.slice(),o=i.children.slice(),a=s[t].clone({type:e.type});[s[t],o[t]]=[a,e.data[0]],n=new rt(s,new Map(this.schema.metadata)),i=P({type:new ut(s),children:o})}return new r(n,i)}select(t){let e=this.schema.select(t),n=new ut(e.fields),i=[];for(let s of t){let o=this.schema.fields.findIndex(a=>a.name===s);~o&&(i[o]=this.data.children[o])}return new r(e,P({type:n,length:this.numRows,children:i}))}selectAt(t){let e=this.schema.selectAt(t),n=t.map(s=>this.data.children[s]).filter(Boolean),i=P({type:new ut(e.fields),length:this.numRows,children:n});return new r(e,i)}};Xl=Symbol.toStringTag;vt[Xl]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(vt.prototype);function Yl(r,t,e=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...r.fields],s=[...t],o=(e+63&-64)>>3;for(let[a,l]of r.fields.entries()){let f=t[a];(!f||f.length!==e)&&(i[a]=l.clone({nullable:!0}),s[a]=(n=f==null?void 0:f._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:P({type:l.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(i),P({type:new ut(i),length:e,children:s})]}function Gl(r,t,e=new Map){for(let n=-1,i=r.length;++n<i;){let o=r[n].type,a=t[n];if(D.isDictionary(o)){if(!e.has(o.id))a.dictionary&&e.set(o.id,a.dictionary);else if(e.get(o.id)!==a.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&Gl(o.children,a.children,e)}return e}var ln=class extends vt{constructor(t){let e=t.fields.map(i=>P({type:i.type})),n=P({type:new ut(t.fields),nullCount:0,children:e});super(t,n)}};var Vi;(function(r){r[r.BUFFER=0]="BUFFER"})(Vi||(Vi={}));var Hi;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(Hi||(Hi={}));var bo=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBodyCompression(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Hi.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Vi.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,Hi.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,Vi.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return r.startBodyCompression(t),r.addCodec(t,e),r.addMethod(t,n),r.endBodyCompression(t)}};var Nn=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,e,n){return t.prep(8,16),t.writeInt64(BigInt(n!=null?n:0)),t.writeInt64(BigInt(e!=null?e:0)),t.offset()}};var Ln=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,e,n){return t.prep(8,16),t.writeInt64(BigInt(n!=null?n:0)),t.writeInt64(BigInt(e!=null?e:0)),t.offset()}};var de=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsRecordBatch(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new Ln).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new Nn).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let e=this.bb.__offset(this.bb_pos,10);return e?(t||new bo).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addNodes(t,e){t.addFieldOffset(1,e,0)}static startNodesVector(t,e){t.startVector(16,e,8)}static addBuffers(t,e){t.addFieldOffset(2,e,0)}static startBuffersVector(t,e){t.startVector(16,e,8)}static addCompression(t,e){t.addFieldOffset(3,e,0)}static endRecordBatch(t){return t.endObject()}};var Sr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryBatch(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new de).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addData(t,e){t.addFieldOffset(1,e,0)}static addIsDelta(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryBatch(t){return t.endObject()}};var kn;(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(kn||(kn={}));var Le=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Or.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):kn.NONE}header(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new xt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,Or.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,kn.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,BigInt("0"))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,n,i,s,o){return r.startMessage(t),r.addVersion(t,e),r.addHeaderType(t,n),r.addHeader(t,i),r.addBodyLength(t,s),r.addCustomMetadata(t,o),r.endMessage(t)}};var Na=class extends E{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return hi.startNull(e),hi.endNull(e)}visitInt(t,e){return Ue.startInt(e),Ue.addBitWidth(e,t.bitWidth),Ue.addIsSigned(e,t.isSigned),Ue.endInt(e)}visitFloat(t,e){return kr.startFloatingPoint(e),kr.addPrecision(e,t.precision),kr.endFloatingPoint(e)}visitBinary(t,e){return ai.startBinary(e),ai.endBinary(e)}visitBool(t,e){return ci.startBool(e),ci.endBool(e)}visitUtf8(t,e){return yi.startUtf8(e),yi.endUtf8(e)}visitDecimal(t,e){return Ke.startDecimal(e),Ke.addScale(e,t.scale),Ke.addPrecision(e,t.precision),Ke.addBitWidth(e,t.bitWidth),Ke.endDecimal(e)}visitDate(t,e){return Mr.startDate(e),Mr.addUnit(e,t.unit),Mr.endDate(e)}visitTime(t,e){return hr.startTime(e),hr.addUnit(e,t.unit),hr.addBitWidth(e,t.bitWidth),hr.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return pr.startTimestamp(e),pr.addUnit(e,t.unit),n!==void 0&&pr.addTimezone(e,n),pr.endTimestamp(e)}visitInterval(t,e){return Cr.startInterval(e),Cr.addUnit(e,t.unit),Cr.endInterval(e)}visitList(t,e){return fi.startList(e),fi.endList(e)}visitStruct(t,e){return pi.startStruct_(e),pi.endStruct_(e)}visitUnion(t,e){Ne.startTypeIdsVector(e,t.typeIds.length);let n=Ne.createTypeIdsVector(e,t.typeIds);return Ne.startUnion(e),Ne.addMode(e,t.mode),Ne.addTypeIds(e,n),Ne.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return Ge.startDictionaryEncoding(e),Ge.addId(e,BigInt(t.id)),Ge.addIsOrdered(e,t.isOrdered),n!==void 0&&Ge.addIndexType(e,n),Ge.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return Nr.startFixedSizeBinary(e),Nr.addByteWidth(e,t.byteWidth),Nr.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Lr.startFixedSizeList(e),Lr.addListSize(e,t.listSize),Lr.endFixedSizeList(e)}visitMap(t,e){return Pr.startMap(e),Pr.addKeysSorted(e,t.keysSorted),Pr.endMap(e)}},go=new Na;function Zl(r,t=new Map){return new rt(Sm(r,t),wo(r.customMetadata),t)}function La(r){return new Ct(r.count,tu(r.columns),eu(r.columns))}function Ql(r){return new re(La(r.data),r.id,r.isDelta)}function Sm(r,t){return(r.fields||[]).filter(Boolean).map(e=>Y.fromJSON(e,t))}function Kl(r,t){return(r.children||[]).filter(Boolean).map(e=>Y.fromJSON(e,t))}function tu(r){return(r||[]).reduce((t,e)=>[...t,new ke(e.count,Im(e.VALIDITY)),...tu(e.children)],[])}function eu(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new ee(t.length,i.VALIDITY.length)),i.TYPE&&t.push(new ee(t.length,i.TYPE.length)),i.OFFSET&&t.push(new ee(t.length,i.OFFSET.length)),i.DATA&&t.push(new ee(t.length,i.DATA.length)),t=eu(i.children,t)}return t}function Im(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function ru(r,t){let e,n,i,s,o,a;return!t||!(s=r.dictionary)?(o=ql(r,Kl(r,t)),i=new Y(r.name,o,r.nullable,wo(r.customMetadata))):t.has(e=s.id)?(n=(n=s.indexType)?Jl(n):new je,a=new oe(t.get(e),n,e,s.isOrdered),i=new Y(r.name,a,r.nullable,wo(r.customMetadata))):(n=(n=s.indexType)?Jl(n):new je,t.set(e,o=ql(r,Kl(r,t))),a=new oe(o,n,e,s.isOrdered),i=new Y(r.name,a,r.nullable,wo(r.customMetadata))),i||null}function wo(r){return new Map(Object.entries(r||{}))}function Jl(r){return new It(r.isSigned,r.bitWidth)}function ql(r,t){let e=r.type.name;switch(e){case"NONE":return new Wt;case"null":return new Wt;case"binary":return new nr;case"utf8":return new ir;case"bool":return new sr;case"list":return new xe((t||[])[0]);case"struct":return new ut(t||[]);case"struct_":return new ut(t||[])}switch(e){case"int":{let n=r.type;return new It(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new Zt(ht[n.precision])}case"decimal":{let n=r.type;return new or(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new ar(Lt[n.unit])}case"time":{let n=r.type;return new Te(X[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new cr(X[n.unit],n.timezone)}case"interval":{let n=r.type;return new lr(jt[n.unit])}case"union":{let n=r.type;return new De(_t[n.mode],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new ur(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Ee(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new Oe((t||[])[0],n.keysSorted)}}throw new Error('Unrecognized type: "'.concat(e,'"'))}var Fm=en,Bm=le,ne=class r{static fromJSON(t,e){let n=new r(0,Mt.V4,e);return n._createHeader=Am(t,e),n}static decode(t){t=new Bm(L(t));let e=Le.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),s=e.headerType(),o=new r(n,i,s);return o._createHeader=Tm(e,s),o}static encode(t){let e=new Fm,n=-1;return t.isSchema()?n=rt.encode(e,t.header()):t.isRecordBatch()?n=Ct.encode(e,t.header()):t.isDictionaryBatch()&&(n=re.encode(e,t.header())),Le.startMessage(e),Le.addVersion(e,Mt.V4),Le.addHeader(e,n),Le.addHeaderType(e,t.headerType),Le.addBodyLength(e,BigInt(t.bodyLength)),Le.finishMessageBuffer(e,Le.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof rt)return new r(0,Mt.V4,Q.Schema,t);if(t instanceof Ct)return new r(e,Mt.V4,Q.RecordBatch,t);if(t instanceof re)return new r(e,Mt.V4,Q.DictionaryBatch,t);throw new Error("Unrecognized Message header: ".concat(t))}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Q.Schema}isRecordBatch(){return this.headerType===Q.RecordBatch}isDictionaryBatch(){return this.headerType===Q.DictionaryBatch}constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=qt(t)}},Ct=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,e,n){this._nodes=e,this._buffers=n,this._length=qt(t)}},re=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,n=!1){this._data=t,this._isDelta=n,this._id=qt(e)}},ee=class{constructor(t,e){this.offset=qt(t),this.length=qt(e)}},ke=class{constructor(t,e){this.length=qt(t),this.nullCount=qt(e)}};function Am(r,t){return()=>{switch(t){case Q.Schema:return rt.fromJSON(r);case Q.RecordBatch:return Ct.fromJSON(r);case Q.DictionaryBatch:return re.fromJSON(r)}throw new Error("Unrecognized Message type: { name: ".concat(Q[t],", type: ").concat(t," }"))}}function Tm(r,t){return()=>{switch(t){case Q.Schema:return rt.decode(r.header(new Qt));case Q.RecordBatch:return Ct.decode(r.header(new de),r.version());case Q.DictionaryBatch:return re.decode(r.header(new Sr),r.version())}throw new Error("Unrecognized Message type: { name: ".concat(Q[t],", type: ").concat(t," }"))}}Y.encode=Cm;Y.decode=Lm;Y.fromJSON=ru;rt.encode=km;rt.decode=xm;rt.fromJSON=Zl;Ct.encode=Pm;Ct.decode=Dm;Ct.fromJSON=La;re.encode=Vm;re.decode=Em;re.fromJSON=Ql;ke.encode=Hm;ke.decode=Rm;ee.encode=zm;ee.decode=Om;function xm(r,t=new Map){let e=Nm(r,t);return new rt(e,vo(r),t)}function Dm(r,t=Mt.V4){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new Ct(r.length(),Mm(r),Um(r,t))}function Em(r,t=Mt.V4){return new re(Ct.decode(r.data(),t),r.id(),r.isDelta())}function Om(r){return new ee(r.offset(),r.length())}function Rm(r){return new ke(r.length(),r.nullCount())}function Mm(r){let t=[];for(let e,n=-1,i=-1,s=r.nodesLength();++n<s;)(e=r.nodes(n))&&(t[++i]=ke.decode(e));return t}function Um(r,t){let e=[];for(let n,i=-1,s=-1,o=r.buffersLength();++i<o;)(n=r.buffers(i))&&(t<Mt.V4&&(n.bb_pos+=8*(i+1)),e[++s]=ee.decode(n));return e}function Nm(r,t){let e=[];for(let n,i=-1,s=-1,o=r.fieldsLength();++i<o;)(n=r.fields(i))&&(e[++s]=Y.decode(n,t));return e}function nu(r,t){let e=[];for(let n,i=-1,s=-1,o=r.childrenLength();++i<o;)(n=r.children(i))&&(e[++s]=Y.decode(n,t));return e}function Lm(r,t){let e,n,i,s,o,a;return!t||!(a=r.dictionary())?(i=su(r,nu(r,t)),n=new Y(r.name(),i,r.nullable(),vo(r))):t.has(e=qt(a.id()))?(s=(s=a.indexType())?iu(s):new je,o=new oe(t.get(e),s,e,a.isOrdered()),n=new Y(r.name(),o,r.nullable(),vo(r))):(s=(s=a.indexType())?iu(s):new je,t.set(e,i=su(r,nu(r,t))),o=new oe(i,s,e,a.isOrdered()),n=new Y(r.name(),o,r.nullable(),vo(r))),n||null}function vo(r){let t=new Map;if(r)for(let e,n,i=-1,s=Math.trunc(r.customMetadataLength());++i<s;)(e=r.customMetadata(i))&&(n=e.key())!=null&&t.set(n,e.value());return t}function iu(r){return new It(r.isSigned(),r.bitWidth())}function su(r,t){let e=r.typeType();switch(e){case mt.NONE:return new Wt;case mt.Null:return new Wt;case mt.Binary:return new nr;case mt.Utf8:return new ir;case mt.Bool:return new sr;case mt.List:return new xe((t||[])[0]);case mt.Struct_:return new ut(t||[])}switch(e){case mt.Int:{let n=r.type(new Ue);return new It(n.isSigned(),n.bitWidth())}case mt.FloatingPoint:{let n=r.type(new kr);return new Zt(n.precision())}case mt.Decimal:{let n=r.type(new Ke);return new or(n.scale(),n.precision(),n.bitWidth())}case mt.Date:{let n=r.type(new Mr);return new ar(n.unit())}case mt.Time:{let n=r.type(new hr);return new Te(n.unit(),n.bitWidth())}case mt.Timestamp:{let n=r.type(new pr);return new cr(n.unit(),n.timezone())}case mt.Interval:{let n=r.type(new Cr);return new lr(n.unit())}case mt.Union:{let n=r.type(new Ne);return new De(n.mode(),n.typeIdsArray()||[],t||[])}case mt.FixedSizeBinary:{let n=r.type(new Nr);return new ur(n.byteWidth())}case mt.FixedSizeList:{let n=r.type(new Lr);return new Ee(n.listSize(),(t||[])[0])}case mt.Map:{let n=r.type(new Pr);return new Oe((t||[])[0],n.keysSorted())}}throw new Error('Unrecognized type: "'.concat(mt[e],'" (').concat(e,")"))}function km(r,t){let e=t.fields.map(s=>Y.encode(r,s));Qt.startFieldsVector(r,e.length);let n=Qt.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?Qt.createCustomMetadataVector(r,[...t.metadata].map(([s,o])=>{let a=r.createString("".concat(s)),l=r.createString("".concat(o));return xt.startKeyValue(r),xt.addKey(r,a),xt.addValue(r,l),xt.endKeyValue(r)})):-1;return Qt.startSchema(r),Qt.addFields(r,n),Qt.addEndianness(r,jm?Rr.Little:Rr.Big),i!==-1&&Qt.addCustomMetadata(r,i),Qt.endSchema(r)}function Cm(r,t){let e=-1,n=-1,i=-1,s=t.type,o=t.typeId;D.isDictionary(s)?(o=s.dictionary.typeId,i=go.visit(s,r),n=go.visit(s.dictionary,r)):n=go.visit(s,r);let a=(s.children||[]).map(m=>Y.encode(r,m)),l=Vt.createChildrenVector(r,a),f=t.metadata&&t.metadata.size>0?Vt.createCustomMetadataVector(r,[...t.metadata].map(([m,_])=>{let g=r.createString("".concat(m)),B=r.createString("".concat(_));return xt.startKeyValue(r),xt.addKey(r,g),xt.addValue(r,B),xt.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),Vt.startField(r),Vt.addType(r,n),Vt.addTypeType(r,o),Vt.addChildren(r,l),Vt.addNullable(r,!!t.nullable),e!==-1&&Vt.addName(r,e),i!==-1&&Vt.addDictionary(r,i),f!==-1&&Vt.addCustomMetadata(r,f),Vt.endField(r)}function Pm(r,t){let e=t.nodes||[],n=t.buffers||[];de.startNodesVector(r,e.length);for(let o of e.slice().reverse())ke.encode(r,o);let i=r.endVector();de.startBuffersVector(r,n.length);for(let o of n.slice().reverse())ee.encode(r,o);let s=r.endVector();return de.startRecordBatch(r),de.addLength(r,BigInt(t.length)),de.addNodes(r,i),de.addBuffers(r,s),de.endRecordBatch(r)}function Vm(r,t){let e=Ct.encode(r,t.data);return Sr.startDictionaryBatch(r),Sr.addId(r,BigInt(t.id)),Sr.addIsDelta(r,t.isDelta),Sr.addData(r,e),Sr.endDictionaryBatch(r)}function Hm(r,t){return Ln.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function zm(r,t){return Nn.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var jm=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var Ca=r=>"Expected ".concat(Q[r]," Message in stream, but was null or length 0."),Pa=r=>"Header pointer of flatbuffer-encoded ".concat(Q[r]," Message is null or length 0."),ou=(r,t)=>"Expected to read ".concat(r," metadata bytes, but only read ").concat(t,"."),au=(r,t)=>"Expected to read ".concat(r," bytes for message body, but only read ").concat(t,"."),Cn=class{constructor(t){this.source=t instanceof qe?t:new qe(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?dt:t.value===-1&&(t=this.readMetadataLength()).done?dt:(t=this.readMetadata(t.value)).done?dt:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Ca(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=L(this.source.read(t));if(e.byteLength<t)throw new Error(au(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=Q.Schema,n=this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(Pa(e));return i}readMetadataLength(){let t=this.source.read(So),e=t&&new le(t),n=(e==null?void 0:e.readInt32(0))||0;return{done:n===0,value:n}}readMetadata(t){let e=this.source.read(t);if(!e)return dt;if(e.byteLength<t)throw new Error(ou(t,e.byteLength));return{done:!1,value:ne.decode(e)}}},zi=class{constructor(t,e){this.source=t instanceof be?t:os(t)?new Vr(t,e):new be(t)}[Symbol.asyncIterator](){return this}next(){return F(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?dt:t.value===-1&&(t=yield this.readMetadataLength()).done?dt:(t=yield this.readMetadata(t.value)).done?dt:t})}throw(t){return F(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return F(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return F(this,void 0,void 0,function*(){let e;if((e=yield this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Ca(t));return e.value})}readMessageBody(t){return F(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=L(yield this.source.read(t));if(e.byteLength<t)throw new Error(au(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(t=!1){return F(this,void 0,void 0,function*(){let e=Q.Schema,n=yield this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(Pa(e));return i})}readMetadataLength(){return F(this,void 0,void 0,function*(){let t=yield this.source.read(So),e=t&&new le(t),n=(e==null?void 0:e.readInt32(0))||0;return{done:n===0,value:n}})}readMetadata(t){return F(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return dt;if(e.byteLength<t)throw new Error(ou(t,e.byteLength));return{done:!1,value:ne.decode(e)}})}},ji=class extends Cn{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof _i?t:new _i(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:ne.fromJSON(t.schema,Q.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:ne.fromJSON(e,Q.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:ne.fromJSON(e,Q.RecordBatch)}}return this._body=[],dt}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((i,s)=>[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE&&[s.TYPE]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...e(s.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Ca(t));return e.value}readSchema(){let t=Q.Schema,e=this.readMessage(t),n=e==null?void 0:e.header();if(!e||!n)throw new Error(Pa(t));return n}},So=4,ka="ARROW1",Pn=new Uint8Array(ka.length);for(let r=0;r<ka.length;r+=1)Pn[r]=ka.codePointAt(r);function Io(r,t=0){for(let e=-1,n=Pn.length;++e<n;)if(Pn[e]!==r[t+e])return!1;return!0}var Vn=Pn.length,Va=Vn+So,cu=Vn*2+So;var Pt=class r extends rn{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let e=this._impl.open(t);return Ie(e)?e.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Nt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Nt.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof r?t:is(t)?$m(t):os(t)?Gm(t):Ie(t)?(()=>F(this,void 0,void 0,function*(){return yield r.from(yield t)}))():as(t)||Jn(t)||ls(t)||pe(t)?Xm(new be(t)):Ym(new qe(t))}static readAll(t){return t instanceof r?t.isSync()?lu(t):uu(t):is(t)||ArrayBuffer.isView(t)||Fe(t)||ss(t)?lu(t):uu(t)}},Qe=class extends Pt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return ie(this,arguments,function*(){yield C(yield*Kr(_n(Se(this[Symbol.iterator]()))))})}},Hr=class extends Pt{constructor(t){super(t),this._impl=t}readAll(){var t,e,n,i;return F(this,void 0,void 0,function*(){let s=new Array;try{for(var o=!0,a=Se(this),l;l=yield a.next(),t=l.done,!t;o=!0){i=l.value,o=!1;let f=i;s.push(f)}}catch(f){e={error:f}}finally{try{!o&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(e)throw e.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},zr=class extends Qe{constructor(t){super(t),this._impl=t}},Wi=class extends Hr{constructor(t){super(t),this._impl=t}},Fo=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){let n=this._loadVectors(t,e,this.schema.fields),i=P({type:new ut(this.schema.fields),length:t.length,children:n});return new vt(this.schema,i)}_loadDictionaryBatch(t,e){let{id:n,isDelta:i}=t,{dictionaries:s,schema:o}=this,a=s.get(n);if(i||!a){let l=o.dictionaries.get(n),f=this._loadVectors(t.data,e,[l]);return(a&&i?a.concat(new G(f)):new G(f)).memoize()}return a.memoize()}_loadVectors(t,e,n){return new vi(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}},Hn=class extends Fo{constructor(t,e){super(e),this._reader=is(t)?new ji(this._handle=t):new Cn(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=du(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):dt}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):dt}next(){if(this.closed)return dt;let t,{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new ln(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},zn=class extends Fo{constructor(t,e){super(e),this._reader=new zi(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return F(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return F(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=du(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return F(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):dt})}return(t){return F(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):dt})}next(){return F(this,void 0,void 0,function*(){if(this.closed)return dt;let t,{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new ln(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return F(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Bo=class extends Hn{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,e){super(t instanceof bi?t:new bi(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(Q.RecordBatch);if(i!=null&&i.isRecordBatch()){let s=i.header(),o=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(t){var e;let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(Q.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){let s=i.header(),o=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}}_readFooter(){let{_handle:t}=this,e=t.size-Va,n=t.readInt32(e),i=t.readAt(e-n,n);return mr.decode(i)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},Ha=class extends zn{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...e){let n=typeof e[0]!="number"?e.shift():void 0,i=e[0]instanceof Map?e.shift():void 0;super(t instanceof Vr?t:new Vr(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return F(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){var e;return F(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(Q.RecordBatch);if(i!=null&&i.isRecordBatch()){let s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){var e;return F(this,void 0,void 0,function*(){let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(Q.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){let s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}})}_readFooter(){return F(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-Va,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return mr.decode(i)})}_readNextMessageAndValidate(t){return F(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null})}},za=class extends Hn{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new Gs(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}};function du(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*lu(r){let t=Pt.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function uu(r){return ie(this,arguments,function*(){let e=yield C(Pt.from(r));try{if(!(yield C(e.open({autoDestroy:!1}))).closed)do yield yield C(e);while(!(yield C(e.reset().open())).closed)}finally{yield C(e.cancel())}})}function $m(r){return new Qe(new za(r))}function Ym(r){let t=r.peek(Vn+7&-8);return t&&t.byteLength>=4?Io(t)?new zr(new Bo(r.read())):new Qe(new Hn(r)):new Qe(new Hn(function*(){}()))}function Xm(r){return F(this,void 0,void 0,function*(){let t=yield r.peek(Vn+7&-8);return t&&t.byteLength>=4?Io(t)?new zr(new Bo(yield r.read())):new Hr(new zn(r)):new Hr(new zn(function(){return ie(this,arguments,function*(){})}()))})}function Gm(r){return F(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new Vr(r,t);return t>=cu&&Io(yield e.readAt(0,Vn+7&-8))?new Wi(new Ha(e)):new Hr(new zn(e))})}var Ft=class r extends E{static assemble(...t){let e=i=>i.flatMap(s=>Array.isArray(s)?e(s):s instanceof vt?s.data.children:s.data),n=new r;return n.visitMany(e(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof G)return this.visitMany(t.data),this;let{type:e}=t;if(!D.isDictionary(e)){let{length:n,nullCount:i}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");D.isNull(e)||Ce.call(this,i<=0?new Uint8Array(0):An(t.offset,n,t.nullBitmap)),this.nodes.push(new ke(n,i))}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function Ce(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new ee(this._byteLength,t)),this._byteLength+=t,this}function Km(r){let{type:t,length:e,typeIds:n,valueOffsets:i}=r;if(Ce.call(this,n),t.mode===_t.Sparse)return ja.call(this,r);if(t.mode===_t.Dense){if(r.offset<=0)return Ce.call(this,i),ja.call(this,r);{let s=n.reduce((m,_)=>Math.max(m,_),n[0]),o=new Int32Array(s+1),a=new Int32Array(s+1).fill(-1),l=new Int32Array(e),f=qn(-i[0],e,i);for(let m,_,g=-1;++g<e;)(_=a[m=n[g]])===-1&&(_=a[m]=f[m]),l[g]=f[g]-_,++o[m];Ce.call(this,l);for(let m,_=-1,g=t.children.length;++_<g;)if(m=r.children[_]){let B=t.typeIds[_],q=Math.min(e,o[B]);this.visit(m.slice(a[B],q))}}}return this}function Jm(r){let t;return r.nullCount>=r.length?Ce.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?Ce.call(this,An(r.offset,r.length,t)):Ce.call(this,Zr(r.values))}function jr(r){return Ce.call(this,r.values.subarray(0,r.length*r.stride))}function fu(r){let{length:t,values:e,valueOffsets:n}=r,i=n[0],s=n[t],o=Math.min(s-i,e.byteLength-i);return Ce.call(this,qn(-n[0],t,n)),Ce.call(this,e.subarray(i,i+o)),this}function Wa(r){let{length:t,valueOffsets:e}=r;return e&&Ce.call(this,qn(e[0],t,e)),this.visit(r.children[0])}function ja(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}Ft.prototype.visitBool=Jm;Ft.prototype.visitInt=jr;Ft.prototype.visitFloat=jr;Ft.prototype.visitUtf8=fu;Ft.prototype.visitBinary=fu;Ft.prototype.visitFixedSizeBinary=jr;Ft.prototype.visitDate=jr;Ft.prototype.visitTimestamp=jr;Ft.prototype.visitTime=jr;Ft.prototype.visitDecimal=jr;Ft.prototype.visitList=Wa;Ft.prototype.visitStruct=ja;Ft.prototype.visitUnion=Km;Ft.prototype.visitInterval=jr;Ft.prototype.visitFixedSizeList=Wa;Ft.prototype.visitMap=Wa;var un=class extends rn{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new Je,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,zt(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Ie(t)?t.then(e=>this.writeAll(e)):pe(t)?Ya(this,t):$a(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){return t===this._sink||t instanceof Je?this._sink=t:(this._sink=new Je,t&&Lc(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&kc(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!e||!cn(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof $t&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof vt&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!cn(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof vt?t instanceof ln||this._writeRecordBatch(t):t instanceof $t?this.writeAll(t.batches):Fe(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=ne.encode(t),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+n&~n,l=a-s-o;return t.headerType===Q.RecordBatch?this._recordBatchBlocks.push(new yr(a,t.bodyLength,this._position)):t.headerType===Q.DictionaryBatch&&this._dictionaryBlocks.push(new yr(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),s>0&&this._write(i),this._writePadding(l)}_write(t){if(this._started){let e=L(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(ne.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Pn)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:s}=Ft.assemble(t),o=new Ct(t.numRows,n,i),a=ne.from(o,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(t,e,n=!1){this._dictionaryDeltaOffsets.set(e,t.length+(this._dictionaryDeltaOffsets.get(e)||0));let{byteLength:i,nodes:s,bufferRegions:o,buffers:a}=Ft.assemble(new G([t])),l=new Ct(t.length,s,o),f=new re(l,e,n),m=ne.from(f,i);return this._writeMessage(m)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,n,i;for(let s=-1,o=t.length;++s<o;)(e=t[s])&&(n=e.byteLength)>0&&(this._write(e),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){for(let[e,n]of t.dictionaries){let i=this._dictionaryDeltaOffsets.get(e)||0;if(i===0||(n=n==null?void 0:n.slice(i)).length>0)for(let s of n.data)this._writeDictionaryBatch(s,e,i>0),i+=s.length}return this}},dn=class r extends un{static writeAll(t,e){let n=new r(e);return Ie(t)?t.then(i=>n.writeAll(i)):pe(t)?Ya(n,t):$a(n,t)}},fn=class r extends un{static writeAll(t){let e=new r;return Ie(t)?t.then(n=>e.writeAll(n)):pe(t)?Ya(e,t):$a(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let e=mr.encode(new mr(t,Mt.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function $a(r,t){let e=t;t instanceof $t&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function Ya(r,t){var e,n,i,s,o,a,l;return F(this,void 0,void 0,function*(){try{for(e=!0,n=Se(t);i=yield n.next(),s=i.done,!s;e=!0){l=i.value,e=!1;let f=l;r.write(f)}}catch(f){o={error:f}}finally{try{!e&&!s&&(a=n.return)&&(yield a.call(n))}finally{if(o)throw o.error}}return r.finish()})}function hu(r,t){if(pe(r))return Zm(r,t);if(Fe(r))return qm(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function qm(r,t){let e=null,n=(t==null?void 0:t.type)==="bytes"||!1,i=(t==null?void 0:t.highWaterMark)||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){s(o,e||(e=r[Symbol.iterator]()))},pull(o){e?s(o,e):o.close()},cancel(){(e!=null&&e.return&&e.return()||!0)&&(e=null)}}),Object.assign({highWaterMark:n?i:void 0},t));function s(o,a){let l,f=null,m=o.desiredSize||null;for(;!(f=a.next(n?m:null)).done;)if(ArrayBuffer.isView(f.value)&&(l=L(f.value))&&(m!=null&&n&&(m=m-l.byteLength+1),f.value=l),o.enqueue(f.value),m!=null&&--m<=0)return;o.close()}}function Zm(r,t){let e=null,n=(t==null?void 0:t.type)==="bytes"||!1,i=(t==null?void 0:t.highWaterMark)||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){return F(this,void 0,void 0,function*(){yield s(o,e||(e=r[Symbol.asyncIterator]()))})},pull(o){return F(this,void 0,void 0,function*(){e?yield s(o,e):o.close()})},cancel(){return F(this,void 0,void 0,function*(){(e!=null&&e.return&&(yield e.return())||!0)&&(e=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function s(o,a){return F(this,void 0,void 0,function*(){let l,f=null,m=o.desiredSize||null;for(;!(f=yield a.next(n?m:null)).done;)if(ArrayBuffer.isView(f.value)&&(l=L(f.value))&&(m!=null&&n&&(m=m-l.byteLength+1),f.value=l),o.enqueue(f.value),m!=null&&--m<=0)return;o.close()})}}function yu(r){return new Xa(r)}var Xa=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,s=Uc(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=sn(s),this._getSize=i!=="bytes"?pu:mu;let{["highWaterMark"]:o=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},e),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:l=>{this._maybeFlush(this._builder,this._controller=l)},start:l=>{this._maybeFlush(this._builder,this._controller=l)}},{highWaterMark:o,size:i!=="bytes"?pu:mu}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:l=>this._writeValueAndReturnChunkSize(l)})}_writeValueAndReturnChunkSize(t){let e=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-e}_maybeFlush(t,e){e!=null&&(this._bufferedSize>=e.desiredSize&&++this._numChunks&&this._enqueue(e,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(e,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(e,null)))}_enqueue(t,e){this._bufferedSize=0,this._controller=null,e==null?t.close():t.enqueue(e)}},pu=r=>{var t;return(t=r==null?void 0:r.length)!==null&&t!==void 0?t:0},mu=r=>{var t;return(t=r==null?void 0:r.byteLength)!==null&&t!==void 0?t:0};function Ao(r,t){let e=new Je,n=null,i=new ReadableStream({cancel(){return F(this,void 0,void 0,function*(){yield e.close()})},start(a){return F(this,void 0,void 0,function*(){yield o(a,n||(n=yield s()))})},pull(a){return F(this,void 0,void 0,function*(){n?yield o(a,n):a.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:i};function s(){return F(this,void 0,void 0,function*(){return yield(yield Pt.from(e)).open(t)})}function o(a,l){return F(this,void 0,void 0,function*(){let f=a.desiredSize,m=null;for(;!(m=yield l.next()).done;)if(a.enqueue(m.value),f!=null&&--f<=0)return;a.close()})}}function To(r,t){let e=new this(r),n=new be(e),i=new ReadableStream({cancel(){return F(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return F(this,void 0,void 0,function*(){yield s(o)})},start(o){return F(this,void 0,void 0,function*(){yield s(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(e,r),readable:i};function s(o){return F(this,void 0,void 0,function*(){let a=null,l=o.desiredSize;for(;a=yield n.read(l||null);)if(o.enqueue(a),l!=null&&(l-=a.byteLength)<=0)return;o.close()})}}function xo(r,t="stream"){return(t==="stream"?dn:fn).writeAll(r).toUint8Array(!0)}var ry=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},sa),Ea),va),oa),ea),wa),{compareSchemas:cn,compareFields:jl,compareTypes:Wl});Nt.toDOMStream=hu;pt.throughDOM=yu;Pt.throughDOM=Ao;zr.throughDOM=Ao;Qe.throughDOM=Ao;un.throughDOM=To;fn.throughDOM=To;dn.throughDOM=To;function jn(r){switch(r.typeId){case h.Binary:return{sqlType:"binary"};case h.Bool:return{sqlType:"bool"};case h.Date:return{sqlType:"date"};case h.DateDay:return{sqlType:"date32[d]"};case h.DateMillisecond:return{sqlType:"date64[ms]"};case h.Decimal:{let t=r;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case h.Float:return{sqlType:"float"};case h.Float16:return{sqlType:"float16"};case h.Float32:return{sqlType:"float32"};case h.Float64:return{sqlType:"float64"};case h.Int:return{sqlType:"int32"};case h.Int16:return{sqlType:"int16"};case h.Int32:return{sqlType:"int32"};case h.Int64:return{sqlType:"int64"};case h.Uint16:return{sqlType:"uint16"};case h.Uint32:return{sqlType:"uint32"};case h.Uint64:return{sqlType:"uint64"};case h.Uint8:return{sqlType:"uint8"};case h.IntervalDayTime:return{sqlType:"interval[dt]"};case h.IntervalYearMonth:return{sqlType:"interval[m]"};case h.List:return{sqlType:"list",valueType:jn(r.valueType)};case h.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:r.byteWidth};case h.Null:return{sqlType:"null"};case h.Utf8:return{sqlType:"utf8"};case h.Struct:return{sqlType:"struct",fields:r.children.map(e=>Do(e.name,e.type))};case h.Map:{let t=r;return{sqlType:"map",keyType:jn(t.keyType),valueType:jn(t.valueType)}}case h.Time:return{sqlType:"time[s]"};case h.TimeMicrosecond:return{sqlType:"time[us]"};case h.TimeMillisecond:return{sqlType:"time[ms]"};case h.TimeNanosecond:return{sqlType:"time[ns]"};case h.TimeSecond:return{sqlType:"time[s]"};case h.Timestamp:return{sqlType:"timestamp",timezone:r.timezone||void 0};case h.TimestampSecond:return{sqlType:"timestamp[s]",timezone:r.timezone||void 0};case h.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:r.timezone||void 0};case h.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:r.timezone||void 0};case h.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:r.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(r.toString()))}function Do(r,t){let e=jn(t);return e.name=r,e}var Eo=class{constructor(){this._bindings=null;this._nextMessageId=0}log(t){this.postMessage({messageId:this._nextMessageId++,requestId:0,type:"LOG",data:t},[])}sendOK(t){this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"OK",data:null},[])}failWith(t,e){let n={name:e.name,message:e.message,stack:e.stack||void 0};this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"ERROR",data:n},[])}async onMessage(t){switch(t.type){case"PING":this.sendOK(t);return;case"INSTANTIATE":this._bindings!=null&&this.failWith(t,new Error("duckdb already initialized"));try{this._bindings=await this.instantiate(t.data[0],t.data[1],e=>{this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"INSTANTIATE_PROGRESS",data:e},[])}),this.sendOK(t)}catch(e){console.log(e),this._bindings=null,this.failWith(t,e)}return;default:break}if(!this._bindings)return this.failWith(t,new Error("duckdb is not initialized"));try{switch(t.type){case"GET_VERSION":this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"VERSION_STRING",data:this._bindings.getVersion()},[]);break;case"GET_FEATURE_FLAGS":this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FEATURE_FLAGS",data:this._bindings.getFeatureFlags()},[]);break;case"RESET":this._bindings.reset(),this.sendOK(t);break;case"OPEN":this._bindings.open(t.data),this.sendOK(t);break;case"DROP_FILE":this._bindings.dropFile(t.data),this.sendOK(t);break;case"DROP_FILES":this._bindings.dropFiles(),this.sendOK(t);break;case"FLUSH_FILES":this._bindings.flushFiles(),this.sendOK(t);break;case"CONNECT":{let e=this._bindings.connect();this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"CONNECTION_INFO",data:e.useUnsafe((n,i)=>i)},[]);break}case"DISCONNECT":this._bindings.disconnect(t.data),this.sendOK(t);break;case"CREATE_PREPARED":{let e=this._bindings.createPrepared(t.data[0],t.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"PREPARED_STATEMENT_ID",data:e},[]);break}case"CLOSE_PREPARED":{this._bindings.closePrepared(t.data[0],t.data[1]),this.sendOK(t);break}case"RUN_PREPARED":{let e=this._bindings.runPrepared(t.data[0],t.data[1],t.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT",data:e},[e.buffer]);break}case"RUN_QUERY":{let e=this._bindings.runQuery(t.data[0],t.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT",data:e},[e.buffer]);break}case"SEND_PREPARED":{let e=this._bindings.sendPrepared(t.data[0],t.data[1],t.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_HEADER",data:e},[e.buffer]);break}case"START_PENDING_QUERY":{let e=this._bindings.startPendingQuery(t.data[0],t.data[1]),n=[];e&&n.push(e.buffer),this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_HEADER_OR_NULL",data:e},n);break}case"POLL_PENDING_QUERY":{let e=this._bindings.pollPendingQuery(t.data),n=[];e&&n.push(e.buffer),this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_HEADER_OR_NULL",data:e},n);break}case"CANCEL_PENDING_QUERY":{let e=this._bindings.cancelPendingQuery(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"SUCCESS",data:e},[]);break}case"FETCH_QUERY_RESULTS":{let e=this._bindings.fetchQueryResults(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_CHUNK",data:e},[e.buffer]);break}case"GET_TABLE_NAMES":{let e=this._bindings.getTableNames(t.data[0],t.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"TABLE_NAMES",data:e},[]);break}case"GLOB_FILE_INFOS":{let e=this._bindings.globFiles(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FILE_INFOS",data:e},[]);break}case"REGISTER_FILE_URL":this._bindings.registerFileURL(t.data[0],t.data[1],t.data[2],t.data[3]),this.sendOK(t);break;case"REGISTER_FILE_BUFFER":this._bindings.registerFileBuffer(t.data[0],t.data[1]),this.sendOK(t);break;case"REGISTER_FILE_HANDLE":this._bindings.registerFileHandle(t.data[0],t.data[1],t.data[2],t.data[3]),this.sendOK(t);break;case"COPY_FILE_TO_PATH":this._bindings.copyFileToPath(t.data[0],t.data[1]),this.sendOK(t);break;case"COPY_FILE_TO_BUFFER":{let e=this._bindings.copyFileToBuffer(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FILE_BUFFER",data:e},[]);break}case"COLLECT_FILE_STATISTICS":this._bindings.collectFileStatistics(t.data[0],t.data[1]),this.sendOK(t);break;case"EXPORT_FILE_STATISTICS":{this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FILE_STATISTICS",data:this._bindings.exportFileStatistics(t.data)},[]);break}case"INSERT_ARROW_FROM_IPC_STREAM":{this._bindings.insertArrowFromIPCStream(t.data[0],t.data[1],t.data[2]),this.sendOK(t);break}case"IMPORT_CSV_FROM_PATH":{this._bindings.insertCSVFromPath(t.data[0],t.data[1],t.data[2]),this.sendOK(t);break}case"IMPORT_JSON_FROM_PATH":{this._bindings.insertJSONFromPath(t.data[0],t.data[1],t.data[2]),this.sendOK(t);break}case"TOKENIZE":{let e=this._bindings.tokenize(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"SCRIPT_TOKENS",data:e},[]);break}}}catch(e){return console.log(e),this.failWith(t,e)}}};var Tu=Rc(Su());var Oo=class{constructor(t,e){this._bindings=t,this._conn=e}close(){this._bindings.disconnect(this._conn)}useUnsafe(t){return t(this._bindings,this._conn)}query(t){let e=this._bindings.runQuery(this._conn,t),n=Pt.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new $t(n)}async send(t){let e=this._bindings.startPendingQuery(this._conn,t);for(;e==null;)e=await new Promise((s,o)=>{try{s(this._bindings.pollPendingQuery(this._conn))}catch(a){console.log(a),o(a)}});let n=new Ro(this._bindings,this._conn,e),i=Pt.from(n);return console.assert(i.isSync()),console.assert(i.isStream()),i}cancelSent(){return this._bindings.cancelPendingQuery(this._conn)}getTableNames(t){return this._bindings.getTableNames(this._conn,t)}prepare(t){let e=this._bindings.createPrepared(this._conn,t);return new Ka(this._bindings,this._conn,e)}createScalarFunction(t,e,n){this._bindings.createScalarFunction(this._conn,t,e,n)}insertArrowTable(t,e){let n=xo(t,"stream");this.insertArrowFromIPCStream(n,e)}insertArrowFromIPCStream(t,e){this._bindings.insertArrowFromIPCStream(this._conn,t,e)}insertCSVFromPath(t,e){this._bindings.insertCSVFromPath(this._conn,t,e)}insertJSONFromPath(t,e){this._bindings.insertJSONFromPath(this._conn,t,e)}},Ro=class{constructor(t,e,n){this.bindings=t;this.conn=e;this.header=n;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=this.bindings.fetchQueryResults(this.conn);return this._depleted=t.length==0,{done:this._depleted,value:t}}[Symbol.iterator](){return this}},Ka=class{constructor(t,e,n){this.bindings=t,this.connectionId=e,this.statementId=n}close(){this.bindings.closePrepared(this.connectionId,this.statementId)}query(...t){let e=this.bindings.runPrepared(this.connectionId,this.statementId,t),n=Pt.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new $t(n)}send(...t){let e=this.bindings.sendPrepared(this.connectionId,this.statementId,t),n=new Ro(this.bindings,this.connectionId,e),i=Pt.from(n);return console.assert(i.isSync()),console.assert(i.isStream()),i}};var Bu=new TextEncoder,Iu=new TextDecoder("utf-8");function Ja(r,t,e){let n=Bu.encode(e),i=r._malloc(n.byteLength),s=r.HEAPU8.subarray(i,i+n.byteLength);s.set(n),r.HEAPF64[(t>>3)+0]=1,r.HEAPF64[(t>>3)+1]=i,r.HEAPF64[(t>>3)+2]=s.byteLength}function Za(r){switch(r){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 qa(r,t,e,n){let i=r.HEAPU8.subarray(t,t+n*Za(e));switch(e){case"UINT8":return new Uint8Array(i.buffer,i.byteOffset,n);case"INT8":return new Int8Array(i.buffer,i.byteOffset,n);case"INT32":return new Int32Array(i.buffer,i.byteOffset,n);case"FLOAT":return new Float32Array(i.buffer,i.byteOffset,n);case"DOUBLE":return new Float64Array(i.buffer,i.byteOffset,n);case"VARCHAR":return new Float64Array(i.buffer,i.byteOffset,n);default:return new Array(0)}}function Fu(r,t,e){let n=r.HEAPU8.subarray(t,t+e);return new Uint8Array(n.buffer,n.byteOffset,e)}function Mo(r,t,e){let n=r.HEAPU8.subarray(t,t+e*8);return new Float64Array(n.buffer,n.byteOffset,e)}function Au(r,t,e,n,i,s,o,a){try{let l=r._udfFunctions.get(n);if(!l){Ja(t,e,"Unknown UDF with id: "+n);return}let f=Iu.decode(t.HEAPU8.subarray(i,i+s)),m=JSON.parse(f),_=Mo(t,o,a/8),g=J=>{var Gt;let Et=null;switch(J.validityBuffer!==void 0&&(Et=Fu(t,_[J.validityBuffer],m.rows)),J.physicalType){case"VARCHAR":{if(J.dataBuffer===null||J.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for VARCHAR argument");if(J.lengthBuffer===null||J.lengthBuffer===void 0)throw new Error("malformed data view, expected data length buffer for VARCHAR argument");let Ot=qa(t,_[J.dataBuffer],J.physicalType,m.rows),yt=[],gt=Mo(t,_[J.lengthBuffer],m.rows);for(let at=0;at<m.rows;++at){if(Et!=null&&!Et[at]){yt.push(null);continue}let I=t.HEAPU8.subarray(Ot[at],Ot[at]+gt[at]),Rt=Iu.decode(I);yt.push(Rt)}return at=>yt[at]}case"STRUCT":{let Ot={},yt=[];for(let gt=0;gt<(((Gt=J.children)==null?void 0:Gt.length)||0);++gt){let at=J.children[gt],I=g(at);yt.push(Rt=>{Ot[at.name]=I(Rt)})}return Et!=null?gt=>{if(!Et[gt])return null;for(let at of yt)at(gt);return Ot}:gt=>{for(let at of yt)at(gt);return Ot}}default:{if(J.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for argument of type: "+J.physicalType);let Ot=qa(t,_[J.dataBuffer],J.physicalType,m.rows);return Et!=null?yt=>Et[yt]?Ot[yt]:null:yt=>Ot[yt]}}},B=[];for(let J=0;J<m.args.length;++J)B.push(g(m.args[J]));let q=m.rows*Za(m.ret.physicalType),St=t._malloc(q),Bt=qa(t,St,m.ret.physicalType,m.rows),Dt=t._malloc(m.rows),Yt=Fu(t,Dt,m.rows);if(Bt.length==0||Yt.length==0){Ja(t,e,"Can't create physical arrays for result");return}let Xt=Bt;m.ret.physicalType=="VARCHAR"&&(Xt=new Array(m.rows));let Wn=[];for(let J=0;J<m.args.length;++J)Wn.push(null);for(let J=0;J<m.rows;++J){for(let Gt=0;Gt<m.args.length;++Gt)Wn[Gt]=B[Gt](J);let Et=l.func(...Wn);Xt[J]=Et,Yt[J]=Et==null?0:1}let Pe=0;switch(m.ret.physicalType){case"VARCHAR":{let J=new Array(0);Pe=t._malloc(m.rows*Za("DOUBLE"));let Et=Mo(t,Pe,m.rows),Gt=0;for(let at=0;at<m.rows;++at){let I=Bu.encode(Xt[at]||"");J.push(I),Et[at]=I.length,Gt+=I.length}let Ot=t._malloc(Gt),yt=t.HEAPU8.subarray(Ot,Ot+Gt),gt=0;for(let at=0;at<m.rows;++at){Bt[at]=gt;let I=J[at];yt.subarray(gt,gt+I.length).set(I),gt+=I.length}}}let $r=3*8,$i=t._malloc($r),Ir=Mo(t,$i,3);Ir[0]=St,Ir[1]=Dt,Ir[2]=Pe,t.HEAPF64[(e>>3)+0]=0,t.HEAPF64[(e>>3)+1]=$i,t.HEAPF64[(e>>3)+2]=0}catch(l){Ja(t,e,l.toString())}}function iy(){let r=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),r.decode(t))}var sy=iy();function we(r,t){console.error("FAIL WITH: ".concat(t)),r.ccall("duckdb_web_fail_with",null,["string"],[t])}function hn(r,t,e){let n=r.HEAPU8.subarray(t,t+e),i=new Uint8Array(new ArrayBuffer(n.byteLength));return i.set(n),i}function z(r,t,e){return sy(r.HEAPU8.subarray(t,t+e))}function nt(r,t,e,n){let i=r.stackSave(),s=r.stackAlloc(3*8);e.unshift("number"),n.unshift(s),r.ccall(t,null,e,n);let o=r.HEAPF64[(s>>3)+0],a=r.HEAPF64[(s>>3)+1],l=r.HEAPF64[(s>>3)+2];return r.stackRestore(i),[o,a,l]}function ft(r){r.ccall("duckdb_web_clear_response",null,[],[])}var Uo=class{constructor(t){let e=new Float64Array(t.buffer,t.byteOffset,t.byteLength/8),n=new Uint8Array(new ArrayBuffer(t.byteLength));n.set(t.subarray(7*8)),this.totalFileReadsCold=e[0],this.totalFileReadsAhead=e[1],this.totalFileReadsCached=e[2],this.totalFileWrites=e[3],this.totalPageAccesses=e[4],this.totalPageLoads=e[5],this.blockSize=e[6],this.blockStats=n}getBlockStats(t,e){return e=e||{file_reads_cold:0,file_reads_ahead:0,file_reads_cached:0,file_writes:0,page_accesses:0,page_loads:0},e.file_writes=this.blockStats[t*3+0]&15,e.file_reads_cold=this.blockStats[t*3+0]>>4,e.file_reads_ahead=this.blockStats[t*3+1]&15,e.file_reads_cached=this.blockStats[t*3+1]>>4,e.page_accesses=this.blockStats[t*3+1]&15,e.page_loads=this.blockStats[t*3+1]>>4,e}};var oy=new TextEncoder;var No=class{constructor(t,e){this._instance=null;this._initPromise=null;this._initPromiseResolver=()=>{};this.onInstantiationProgress=[];this._logger=t,this._runtime=e,this._nextUDFId=1}get logger(){return this._logger}get mod(){return this._instance}get pthread(){return this.mod.PThread||null}async instantiate(t=e=>{}){return this._instance!=null?this:(this._initPromise!=null&&(this.onInstantiationProgress.push(t),await this._initPromise),this._initPromise=new Promise(e=>{this._initPromiseResolver=e}),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(e=>e!=t),this)}open(t){let[e,n,i]=nt(this.mod,"duckdb_web_open",["string"],[JSON.stringify(t)]);if(e!==0)throw new Error(z(this.mod,n,i));ft(this.mod)}reset(){let[t,e,n]=nt(this.mod,"duckdb_web_reset",[],[]);if(t!==0)throw new Error(z(this.mod,e,n));ft(this.mod)}getVersion(){let[t,e,n]=nt(this.mod,"duckdb_web_get_version",[],[]);if(t!==0)throw new Error(z(this.mod,e,n));let i=z(this.mod,e,n);return ft(this.mod),i}getFeatureFlags(){return this.mod.ccall("duckdb_web_get_feature_flags","number",[],[])}tokenize(t){let[e,n,i]=nt(this.mod,"duckdb_web_tokenize",["string"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));let s=z(this.mod,n,i);return ft(this.mod),JSON.parse(s)}connect(){let t=this.mod.ccall("duckdb_web_connect","number",[],[]);return new Oo(this,t)}disconnect(t){if(this.mod.ccall("duckdb_web_disconnect",null,["number"],[t]),this.pthread)for(let e of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])e.postMessage({cmd:"dropUDFFunctions",connectionId:t})}runQuery(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_query_run",["number","string"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s));let o=hn(this.mod,i,s);return ft(this.mod),o}startPendingQuery(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_pending_query_start",["number","string"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s));if(i==0)return null;let o=hn(this.mod,i,s);return ft(this.mod),o}pollPendingQuery(t){let[e,n,i]=nt(this.mod,"duckdb_web_pending_query_poll",["number"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));if(n==0)return null;let s=hn(this.mod,n,i);return ft(this.mod),s}cancelPendingQuery(t){return this.mod.ccall("duckdb_web_pending_query_cancel","boolean",["number"],[t])}fetchQueryResults(t){let[e,n,i]=nt(this.mod,"duckdb_web_query_fetch_results",["number"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));let s=hn(this.mod,n,i);return ft(this.mod),s}getTableNames(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_get_tablenames",["number","string"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s));let o=z(this.mod,i,s);return ft(this.mod),JSON.parse(o)}createScalarFunction(t,e,n,i){let s={functionId:this._nextUDFId,name:e,returnType:jn(n)},o={functionId:s.functionId,connectionId:t,name:e,returnType:n,func:i};this._nextUDFId+=1;let[a,l,f]=nt(this.mod,"duckdb_web_udf_scalar_create",["number","string"],[t,JSON.stringify(s)]);if(a!==0)throw new Error(z(this.mod,l,f));if(ft(this.mod),globalThis.DUCKDB_RUNTIME._udfFunctions=(globalThis.DUCKDB_RUNTIME._udfFunctions||new Map).set(o.functionId,o),this.pthread)for(let m of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])m.postMessage({cmd:"registerUDFFunction",udf:o})}createPrepared(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_prepared_create",["number","string"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s));return ft(this.mod),i}closePrepared(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_prepared_close",["number","number"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s));ft(this.mod)}runPrepared(t,e,n){let[i,s,o]=nt(this.mod,"duckdb_web_prepared_run",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(z(this.mod,s,o));let a=hn(this.mod,s,o);return ft(this.mod),a}sendPrepared(t,e,n){let[i,s,o]=nt(this.mod,"duckdb_web_prepared_send",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(z(this.mod,s,o));let a=hn(this.mod,s,o);return ft(this.mod),a}insertArrowFromIPCStream(t,e,n){if(e.length==0)return;let i=this.mod._malloc(e.length);this.mod.HEAPU8.subarray(i,i+e.length).set(e);let o=n?JSON.stringify(n):"",[a,l,f]=nt(this.mod,"duckdb_web_insert_arrow_from_ipc_stream",["number","number","number","string"],[t,i,e.length,o]);if(a!==0)throw new Error(z(this.mod,l,f))}insertCSVFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let f in n.columns)n.columnsFlat.push(Do(f,n.columns[f]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,a,l]=nt(this.mod,"duckdb_web_insert_csv_from_path",["number","string","string"],[t,e,s]);if(o!==0)throw new Error(z(this.mod,a,l))}insertJSONFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let f in n.columns)n.columnsFlat.push(Do(f,n.columns[f]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,a,l]=nt(this.mod,"duckdb_web_insert_json_from_path",["number","string","string"],[t,e,s]);if(o!==0)throw new Error(z(this.mod,a,l))}globFiles(t){let[e,n,i]=nt(this.mod,"duckdb_web_fs_glob_file_infos",["string"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));let s=z(this.mod,n,i);ft(this.mod);let o=JSON.parse(s);return o==null?[]:o}registerFileURL(t,e,n,i=!1){e===void 0&&(e=t);let[s,o,a]=nt(this.mod,"duckdb_web_fs_register_file_url",["string","string"],[t,e,n,i]);if(s!==0)throw new Error(z(this.mod,o,a));ft(this.mod)}registerFileText(t,e){let n=oy.encode(e);this.registerFileBuffer(t,n)}registerFileBuffer(t,e){let n=this.mod._malloc(e.length);this.mod.HEAPU8.subarray(n,n+e.length).set(e);let[s,o,a]=nt(this.mod,"duckdb_web_fs_register_file_buffer",["string","number","number"],[t,n,e.length]);if(s!==0)throw new Error(z(this.mod,o,a));ft(this.mod)}registerFileHandle(t,e,n,i){let[s,o,a]=nt(this.mod,"duckdb_web_fs_register_file_url",["string","string","number","boolean"],[t,t,n,i]);if(s!==0)throw new Error(z(this.mod,o,a));if(ft(this.mod),globalThis.DUCKDB_RUNTIME._files=(globalThis.DUCKDB_RUNTIME._files||new Map).set(t,e),this.pthread){for(let l of this.pthread.runningWorkers)l.postMessage({cmd:"registerFileHandle",fileName:t,fileHandle:e});for(let l of this.pthread.unusedWorkers)l.postMessage({cmd:"dropFileHandle",fileName:t})}}dropFile(t){let[e,n,i]=nt(this.mod,"duckdb_web_fs_drop_file",["string"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));ft(this.mod)}dropFiles(){let[t,e,n]=nt(this.mod,"duckdb_web_fs_drop_files",[],[]);if(t!==0)throw new Error(z(this.mod,e,n));ft(this.mod)}flushFiles(){this.mod.ccall("duckdb_web_flush_files",null,[],[])}copyFileToPath(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_copy_file_to_path",["string","string"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s));ft(this.mod)}copyFileToBuffer(t){let[e,n,i]=nt(this.mod,"duckdb_web_copy_file_to_buffer",["string"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));let s=this.mod.HEAPU8.subarray(n,n+i),o=new Uint8Array(s.length);return o.set(s),ft(this.mod),o}collectFileStatistics(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_collect_file_stats",["string","boolean"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s))}exportFileStatistics(t){let[e,n,i]=nt(this.mod,"duckdb_web_export_file_stats",["string"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));return new Uo(this.mod.HEAPU8.subarray(n,n+i))}};var Lo=class extends No{constructor(e,n,i,s){super(e,n);this.mainModuleURL=i,this.pthreadWorkerURL=s}locateFile(e,n){if(e.endsWith(".wasm"))return this.mainModuleURL;if(e.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(n," path=").concat(e))}instantiateWasm(e,n){globalThis.DUCKDB_RUNTIME=this._runtime;let i=this.onInstantiationProgress;if(WebAssembly.instantiateStreaming)if(typeof TransformStream=="function"){let o=(async()=>{var St;let a=new Request(this.mainModuleURL),l=await fetch(a),f=l.headers.get("content-length"),m=f&&parseInt(f,10)||0,_=new Date,g={startedAt:_,updatedAt:_,bytesTotal:m||0,bytesLoaded:0},B={transform(Bt,Dt){g.bytesLoaded+=Bt.byteLength;let Yt=new Date;if(Yt.getTime()-g.updatedAt.getTime()<20){g.updatedAt=Yt,Dt.enqueue(Bt);return}for(let Xt of i)Xt(g);Dt.enqueue(Bt)}},q=new TransformStream(B);return new Response((St=l.body)==null?void 0:St.pipeThrough(q),l)})();WebAssembly.instantiateStreaming(o,e).then(a=>{n(a.instance,a.module)})}else{console.warn("instantiating without progress handler since transform streams are unavailable");let s=new Request(this.mainModuleURL);WebAssembly.instantiateStreaming(fetch(s),e).then(o=>{n(o.instance,o.module)})}else if(typeof XMLHttpRequest=="function"){let s=new XMLHttpRequest,o=this.mainModuleURL,a=new Date,l={startedAt:a,updatedAt:a,bytesTotal:0,bytesLoaded:0};s.open("GET",o),s.responseType="arraybuffer",s.onerror=f=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to load WASM: "+f}),new Error(f.toString())},s.onprogress=f=>{l.bytesTotal=f.total,l.bytesLoaded=f.loaded;let m=new Date;if(m.getTime()-l.updatedAt.getTime()<20){l.updatedAt=m;return}for(let _ of i)_(l)},s.onload=()=>{WebAssembly.instantiate(s.response,e).then(f=>{n(f.instance,f.module)}).catch(f=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to instantiate WASM: "+f}),new Error(f)})},s.send()}else console.warn("instantiating with manual fetch since streaming instantiation and xhrs are unavailable"),(async()=>{let o=new Request(this.mainModuleURL),l=await(await fetch(o)).arrayBuffer();WebAssembly.instantiate(l,e).then(f=>{n(f.instance,f.module)})})();return[]}};var ko=class extends Lo{constructor(t,e,n,i=null){super(t,e,n,i)}instantiateImpl(t){return(0,Tu.default)({...t,instantiateWasm:this.instantiateWasm.bind(this),locateFile:this.locateFile.bind(this)})}};var Wr=Rc(xu()),Du=function(r,t,e){var n;if((n=r==null?void 0:r.endpoint)!=null&&n.startsWith("http")){let i="".concat(r==null?void 0:r.endpoint),s=i.indexOf("://")+3;return i.substring(s)}else return r!=null&&r.endpoint?"".concat(e,".").concat(r==null?void 0:r.endpoint):"".concat(e,".s3.amazonaws.com")};function ay(r,t,e){var s,o,a,l;let n=Eu(t),i=n.path;return Ou(r)&&(i="/".concat(n.bucket).concat(i)),{url:i,query:"",host:Du(r,t,n.bucket),region:(s=r==null?void 0:r.region)!=null?s:"",service:"s3",method:e,accessKeyId:(o=r==null?void 0:r.accessKeyId)!=null?o:"",secretAccessKey:(a=r==null?void 0:r.secretAccessKey)!=null?a:"",sessionToken:(l=r==null?void 0:r.sessionToken)!=null?l:"",dateNow:new Date().toISOString().replace(/-/g,"").split("T")[0],datetimeNow:new Date().toISOString().replace(/-/g,"").replace(/:/g,"").split(".")[0]+"Z"}}function cy(r,t=!1){let e="0123456789ABCDEF",n="";for(let i=0;i<r.length;i++){let s=r[i];s>="A"&&s<="Z"||s>="a"&&s<="z"||s>="0"&&s<="9"||s=="_"||s=="-"||s=="~"||s=="."?n+=s:s=="/"?t?n+="%2F":n+=s:(n+="%",n+=e[s.charCodeAt(0)>>4],n+=e[s.charCodeAt(0)&15])}return n}function ly(r,t=null){var q;let e=(q=t==null?void 0:t.contentHash)!=null?q:"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",n=new Map;n.set("x-amz-date",r.datetimeNow),n.set("x-amz-content-sha256",e),r.sessionToken&&n.set("x-amz-security-token",r.sessionToken);let i="";t!=null&&t.contentType&&(i+="content-type;"),i+="host;x-amz-content-sha256;x-amz-date",r.sessionToken&&(i+=";x-amz-security-token");let s=r.method+"\n"+cy(r.url)+"\n"+r.query;t!=null&&t.contentType&&(s+="\ncontent-type:"+(t==null?void 0:t.contentType)),s+="\nhost:"+r.host+"\nx-amz-content-sha256:"+e+"\nx-amz-date:"+r.datetimeNow,r.sessionToken&&r.sessionToken.length>0&&(s+="\nx-amz-security-token:"+r.sessionToken),s+="\n\n"+i+"\n"+e;let o=(0,Wr.sha256)(s),a="AWS4-HMAC-SHA256\n"+r.datetimeNow+"\n"+r.dateNow+"/"+r.region+"/"+r.service+"/aws4_request\n"+o,l="AWS4"+r.secretAccessKey,f=Wr.sha256.hmac.arrayBuffer(l,r.dateNow),m=Wr.sha256.hmac.arrayBuffer(f,r.region),_=Wr.sha256.hmac.arrayBuffer(m,r.service),g=Wr.sha256.hmac.arrayBuffer(_,"aws4_request"),B=Wr.sha256.hmac(g,a);return n.set("Authorization","AWS4-HMAC-SHA256 Credential="+r.accessKeyId+"/"+r.dateNow+"/"+r.region+"/"+r.service+"/aws4_request, SignedHeaders="+i+", Signature="+B),n}var uy=function(r,t,e,n=null,i=null){let s=ay(r,t,e),o={contentType:n,contentHash:i?Wr.sha256.hex(i):null};return ly(s,o)};function tr(r,t,e,n,i=null,s=null){(t!=null&&t.accessKeyId||t!=null&&t.sessionToken)&&(uy(t,e,n,i,s).forEach((a,l)=>{r.setRequestHeader(l,a)}),i&&r.setRequestHeader("content-type",i))}function Eu(r){if(r.indexOf("s3://")!=0)throw new Error("URL needs to start with s3://");let t=r.indexOf("/",5);if(t==-1)throw new Error("URL needs to contain a '/' after the host");let e=r.substring(5,t);if(!e)throw new Error("URL needs to contain a bucket name");let n=r.substring(t);if(!n)throw new Error("URL needs to contain key");return{bucket:e,path:n}}function Ou(r){var t;return!!((t=r==null?void 0:r.endpoint)!=null&&t.startsWith("http"))}function er(r,t){let e=Eu(t);return Ou(r)?"".concat(r==null?void 0:r.endpoint,"/").concat(e.bucket)+e.path:"https://"+Du(r,t,e.bucket)+e.path}var tt={_files:new Map,_fileInfoCache:new Map,_udfFunctions:new Map,_globalFileInfo:null,getFileInfo(r,t){try{let e=tt._fileInfoCache.get(t),[n,i,s]=nt(r,"duckdb_web_fs_get_file_info_by_id",["number","number"],[t,(e==null?void 0:e.cacheEpoch)||0]);if(n!==0)return null;if(s===0)return e;let o=z(r,i,s);ft(r);let a=JSON.parse(o);if(a==null)return null;let l={...a,blob:null};return tt._fileInfoCache.set(t,l),l}catch(e){return console.log(e),null}},getGlobalFileInfo(r){var t;try{let[e,n,i]=nt(r,"duckdb_web_get_global_file_info",["number"],[((t=tt._globalFileInfo)==null?void 0:t.cacheEpoch)||0]);if(e!==0)return null;if(i===0)return tt._globalFileInfo;let s=z(r,n,i);ft(r);let o=JSON.parse(s);return o==null?null:(tt._globalFileInfo={...o,blob:null},tt._globalFileInfo)}catch(e){return console.log(e),null}},testPlatformFeature:(r,t)=>{switch(t){case 1:return typeof BigInt64Array<"u";default:return console.warn("test for unknown feature: ".concat(t)),!1}},getDefaultDataProtocol(r){return 2},openFile:(r,t,e)=>{var n;try{tt._fileInfoCache.delete(t);let i=tt.getFileInfo(r,t);switch(i==null?void 0:i.dataProtocol){case 4:case 5:{if(e&1&&e&2)throw new Error("Opening file ".concat(i.fileName," failed: cannot open file with both read and write flags set"));if(e&32)throw new Error("Opening file ".concat(i.fileName," failed: appending to HTTP/S3 files is not supported"));if(e&2){let a=new XMLHttpRequest;if(i.dataProtocol==5?(a.open("HEAD",er(i.s3Config,i.dataUrl),!1),tr(a,i.s3Config,i.dataUrl,"HEAD")):a.open("HEAD",i.dataUrl,!1),a.send(null),a.status!=200&&a.status!=404)throw new Error("Opening file ".concat(i.fileName," failed: Unexpected return status from server (").concat(a.status,")"));if(a.status==404&&!(e&8||e&16))throw new Error("Opening file ".concat(i.fileName," failed: Cannot write to non-existent file without FILE_FLAGS_FILE_CREATE or FILE_FLAGS_FILE_CREATE_NEW flag."));let l=r._malloc(1),f=new Uint8Array;r.HEAPU8.set(f,l);let m=r._malloc(2*8);return r.HEAPF64[(m>>3)+0]=1,r.HEAPF64[(m>>3)+1]=l,m}else if(e!=1)throw new Error("Opening file ".concat(i.fileName," failed: unsupported file flags: ").concat(e));let s=null,o=null;try{let a=new XMLHttpRequest;if(i.dataProtocol==5?(a.open("HEAD",er(i.s3Config,i.dataUrl),!1),tr(a,i.s3Config,i.dataUrl,"HEAD")):a.open("HEAD",i.dataUrl,!1),a.setRequestHeader("Range","bytes=0-"),a.send(null),s=a.getResponseHeader("Content-Length"),s!==null&&a.status==206){let l=r._malloc(16);return r.HEAPF64[(l>>3)+0]=+s,r.HEAPF64[(l>>3)+1]=0,l}}catch(a){o=a,console.warn("HEAD request with range header failed: ".concat(a))}if(i.allowFullHttpReads){if(s!==null&&+s>1){let l=new XMLHttpRequest;i.dataProtocol==5?(l.open("GET",er(i.s3Config,i.dataUrl),!1),tr(l,i.s3Config,i.dataUrl,"GET")):l.open("GET",i.dataUrl,!1),l.setRequestHeader("Range","bytes=0-0"),l.send(null);let f=l.getResponseHeader("Content-Length");if(l.status==206&&f!==null&&+f==1){let m=r._malloc(16);return r.HEAPF64[(m>>3)+0]=+s,r.HEAPF64[(m>>3)+1]=0,m}if(l.status==200&&f!==null&&+f==+s){console.warn("fall back to full HTTP read for: ".concat(i.dataUrl));let m=r._malloc(l.response.byteLength),_=new Uint8Array(l.response,0,l.response.byteLength);r.HEAPU8.set(_,m);let g=r._malloc(2*8);return r.HEAPF64[(g>>3)+0]=l.response.byteLength,r.HEAPF64[(g>>3)+1]=m,g}}console.warn("falling back to full HTTP read for: ".concat(i.dataUrl));let a=new XMLHttpRequest;if(i.dataProtocol==5?(a.open("GET",er(i.s3Config,i.dataUrl),!1),tr(a,i.s3Config,i.dataUrl,"GET")):a.open("GET",i.dataUrl,!1),a.responseType="arraybuffer",a.send(null),a.status==200){let l=r._malloc(a.response.byteLength),f=new Uint8Array(a.response,0,a.response.byteLength);r.HEAPU8.set(f,l);let m=r._malloc(2*8);return r.HEAPF64[(m>>3)+0]=a.response.byteLength,r.HEAPF64[(m>>3)+1]=l,m}}if(o!=null)throw new Error("Reading file ".concat(i.fileName," failed with error: ").concat(o));return 0}case 2:{let s=(n=tt._files)==null?void 0:n.get(i.fileName);if(s){let l=r._malloc(16);return r.HEAPF64[(l>>3)+0]=s.size,r.HEAPF64[(l>>3)+1]=0,l}console.warn("Buffering missing file: ".concat(i.fileName));let o=r._malloc(2*8),a=r._malloc(1);return r.HEAPF64[(o>>3)+0]=1,r.HEAPF64[(o>>3)+1]=a,o}}}catch(i){console.error(i.toString()),we(r,i.toString())}return 0},glob:(r,t,e)=>{var n;try{let i=z(r,t,e);if(i.startsWith("http")||i.startsWith("s3://")){let s=new XMLHttpRequest;if(i.startsWith("s3://")){let o=tt.getGlobalFileInfo(r);s.open("HEAD",er(o==null?void 0:o.s3Config,i),!1),tr(s,o==null?void 0:o.s3Config,i,"HEAD")}else s.open("HEAD",i,!1);if(s.send(null),s.status!=200&&s.status!==206){if(!((n=tt.getGlobalFileInfo(r))!=null&&n.allowFullHttpReads)){we(r,"HEAD request failed: ".concat(i,", with full http reads are disabled"));return}let o=new XMLHttpRequest;if(i.startsWith("s3://")){let l=tt.getGlobalFileInfo(r);o.open("GET",er(l==null?void 0:l.s3Config,i),!1),tr(o,l==null?void 0:l.s3Config,i,"HEAD")}else o.open("GET",i,!1);if(o.setRequestHeader("Range","bytes=0-0"),o.send(null),o.status!=200&&o.status!==206){we(r,"HEAD and GET requests failed: ".concat(i));return}let a=o.getResponseHeader("Content-Length");a&&+a>1&&console.warn("Range request for ".concat(i," did not return a partial response: ").concat(o.status,' "').concat(o.statusText,'"'))}r.ccall("duckdb_web_fs_glob_add_path",null,["string"],[i])}}catch(i){return console.log(i),we(r,i.toString()),0}},checkFile:(r,t,e)=>{try{let n=z(r,t,e);if(n.startsWith("http")||n.startsWith("s3://")){let i=new XMLHttpRequest;if(n.startsWith("s3://")){let s=tt.getGlobalFileInfo(r);i.open("HEAD",er(s==null?void 0:s.s3Config,n),!1),tr(i,s==null?void 0:s.s3Config,n,"HEAD")}else i.open("HEAD",n,!1);return i.send(null),i.status==206||i.status==200}}catch(n){return console.log(n),!1}return!1},syncFile:(r,t)=>{},closeFile:(r,t)=>{var n;let e=tt.getFileInfo(r,t);switch(tt._fileInfoCache.delete(t),e==null?void 0:e.dataProtocol){case 0:case 4:case 5:break;case 1:case 2:return;case 3:{let i=(n=tt._files)==null?void 0:n.get(e.fileName);if(!i)throw new Error("No OPFS access handle registered with name: ".concat(e.fileName));return i.flush()}}},truncateFile:(r,t,e)=>{var i;let n=tt.getFileInfo(r,t);switch(n==null?void 0:n.dataProtocol){case 4:we(r,"Cannot truncate a http file");return;case 5:we(r,"Cannot truncate an s3 file");return;case 0:case 1:case 2:we(r,"truncateFile not implemented");return;case 3:{let s=(i=tt._files)==null?void 0:i.get(n.fileName);if(!s)throw new Error("No OPFS access handle registered with name: ".concat(n.fileName));return s.truncate(e)}}return 0},readFile(r,t,e,n,i){var s,o;if(n==0)return 0;try{let a=tt.getFileInfo(r,t);switch(a==null?void 0:a.dataProtocol){case 4:case 5:{if(!a.dataUrl)throw new Error("Missing data URL for file ".concat(t));try{let l=new XMLHttpRequest;if(a.dataProtocol==5?(l.open("GET",er(a==null?void 0:a.s3Config,a.dataUrl),!1),tr(l,a==null?void 0:a.s3Config,a.dataUrl,"GET")):l.open("GET",a.dataUrl,!1),l.responseType="arraybuffer",l.setRequestHeader("Range","bytes=".concat(i,"-").concat(i+n-1)),l.send(null),l.status==206||l.status==200&&n==l.response.byteLength&&i==0){let f=new Uint8Array(l.response,0,Math.min(l.response.byteLength,n));return r.HEAPU8.set(f,e),f.byteLength}else if(l.status==200){console.warn("Range request for ".concat(a.dataUrl," did not return a partial response: ").concat(l.status,' "').concat(l.statusText,'"'));let f=new Uint8Array(l.response,i,Math.min(l.response.byteLength-i,n));return r.HEAPU8.set(f,e),f.byteLength}else throw new Error("Range request for ".concat(a.dataUrl," did returned non-success status: ").concat(l.status,' "').concat(l.statusText,'"'))}catch(l){throw console.log(l),new Error("Range request for ".concat(a.dataUrl," failed with error: ").concat(l,'"'))}}case 2:{let l=(s=tt._files)==null?void 0:s.get(a.fileName);if(!l)throw new Error("No HTML5 file registered with name: ".concat(a.fileName));let f=l.slice(i,i+n),m=new Uint8Array(new FileReaderSync().readAsArrayBuffer(f));return r.HEAPU8.set(m,e),m.byteLength}case 3:{let l=(o=tt._files)==null?void 0:o.get(a.fileName);if(!l)throw new Error("No OPFS access handle registered with name: ".concat(a.fileName));let f=r.HEAPU8.subarray(e,e+n);return l.read(f,{at:i})}}return 0}catch(a){return console.log(a),we(r,a.toString()),0}},writeFile:(r,t,e,n,i)=>{var o;let s=tt.getFileInfo(r,t);switch(s==null?void 0:s.dataProtocol){case 4:return we(r,"Cannot write to HTTP file"),0;case 5:{let a=r.HEAPU8.subarray(e,e+n),l=new XMLHttpRequest;return l.open("PUT",er(s==null?void 0:s.s3Config,s.dataUrl),!1),tr(l,s==null?void 0:s.s3Config,s.dataUrl,"PUT","",a),l.send(a),l.status!==200?(we(r,"Failed writing file: HTTP "+l.status),0):n}case 2:return we(r,"cannot write using the html5 file reader api"),0;case 3:{let a=(o=tt._files)==null?void 0:o.get(s.fileName);if(!a)throw new Error("No OPFS access handle registered with name: ".concat(s.fileName));let l=r.HEAPU8.subarray(e,e+n);return a.write(l,{at:i})}}return 0},getLastFileModificationTime:(r,t)=>{var n;let e=tt.getFileInfo(r,t);switch(e==null?void 0:e.dataProtocol){case 2:{if(!((n=tt._files)==null?void 0:n.get(e.fileName)))throw Error("No handle available for file: ".concat(e.fileName));return 0}case 4:case 5:return new Date().getTime()}return 0},checkDirectory:(r,t,e)=>{let n=z(r,t,e);return console.log("checkDirectory: ".concat(n)),!1},createDirectory:(r,t,e)=>{let n=z(r,t,e);console.log("createDirectory: ".concat(n))},removeDirectory:(r,t,e)=>{let n=z(r,t,e);console.log("removeDirectory: ".concat(n))},listDirectoryEntries:(r,t,e)=>{let n=z(r,t,e);return console.log("listDirectoryEntries: ".concat(n)),!1},moveFile:(r,t,e,n,i)=>{var l,f;let s=z(r,t,e),o=z(r,n,i),a=(l=tt._files)==null?void 0:l.get(s);a!==void 0&&(tt._files.delete(a),tt._files.set(o,a));for(let[m,_]of((f=tt._fileInfoCache)==null?void 0:f.entries())||[])if(_.dataUrl==s){tt._fileInfoCache.delete(m);break}return!0},removeFile:(r,t,e)=>{},callScalarUDF:(r,t,e,n,i,s,o)=>{Au(tt,r,t,e,n,i,s,o)}};var Qa=class extends Eo{postMessage(t,e){globalThis.postMessage(t,e)}async instantiate(t,e,n){return await new ko(this,tt,t,e).instantiate(n)}};function Ru(){let r=new Qa;globalThis.onmessage=async t=>{await r.onMessage(t.data)}}Ru();return vh(dy);})();
|
|
1
|
+
"use strict";var duckdb=(()=>{var hh=Object.create;var es=Object.defineProperty;var ph=Object.getOwnPropertyDescriptor;var mh=Object.getOwnPropertyNames;var yh=Object.getPrototypeOf,_h=Object.prototype.hasOwnProperty;var Ko=(r,t)=>{if(t=Symbol[r])return t;throw Error("Symbol."+r+" is not defined")};var bh=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var rs=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Gr=(r,t)=>{for(var e in t)es(r,e,{get:t[e],enumerable:!0})},Oc=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of mh(t))!_h.call(r,i)&&i!==e&&es(r,i,{get:()=>t[i],enumerable:!(n=ph(t,i))||n.enumerable});return r};var Rc=(r,t,e)=>(e=r!=null?hh(yh(r)):{},Oc(t||!r||!r.__esModule?es(e,"default",{value:r,enumerable:!0}):e,r)),gh=r=>Oc(es({},"__esModule",{value:!0}),r);var wh=function(r,t){this[0]=r,this[1]=t};var Kr=r=>{var t=r[Ko("asyncIterator")],e=!1,n,i={};return t==null?(t=r[Ko("iterator")](),n=s=>i[s]=o=>t[s](o)):(t=t.call(r),n=s=>i[s]=o=>{if(e){if(e=!1,s==="throw")throw o;return o}return e=!0,{done:!1,value:new wh(new Promise(a=>{var l=t[s](o);if(!(l instanceof Object))throw TypeError("Object expected");a(l)}),1)}}),i[Ko("iterator")]=()=>i,n("next"),"throw"in t?n("throw"):i.throw=s=>{throw s},"return"in t&&n("return"),i};var bu=rs(()=>{});var gu=rs(()=>{});var Su=rs((vu,Ga)=>{"use strict";var wu=(()=>{var r=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(r=r||__filename),function(t={}){var e=t,n,i;e.ready=new Promise((c,u)=>{n=c,i=u});var s=Object.assign({},e),o=[],a="./this.program",l=(c,u)=>{throw u},f=typeof window=="object",m=typeof importScripts=="function",_=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",w="";function B(c){return e.locateFile?e.locateFile(c,w):w+c}var q,vt,Bt;if(_){var Tt=bu(),Ht=gu();m?w=Ht.dirname(w)+"/":w=__dirname+"/",q=(c,u)=>(c=oc(c)?new URL(c):Ht.normalize(c),Tt.readFileSync(c,u?void 0:"utf8")),Bt=c=>{var u=q(c,!0);return u.buffer||(u=new Uint8Array(u)),u},vt=(c,u,d,p=!0)=>{c=oc(c)?new URL(c):Ht.normalize(c),Tt.readFile(c,p?void 0:"utf8",(y,I)=>{y?d(y):u(p?I.buffer:I)})},!e.thisProgram&&process.argv.length>1&&(a=process.argv[1].replace(/\\/g,"/")),o=process.argv.slice(2),l=(c,u)=>{throw process.exitCode=c,u},e.inspect=()=>"[Emscripten Module object]"}else(f||m)&&(m?w=self.location.href:typeof document<"u"&&document.currentScript&&(w=document.currentScript.src),r&&(w=r),w.indexOf("blob:")!==0?w=w.substr(0,w.replace(/[?#].*/,"").lastIndexOf("/")+1):w="",q=c=>{var u=new XMLHttpRequest;return u.open("GET",c,!1),u.send(null),u.responseText},m&&(Bt=c=>{var u=new XMLHttpRequest;return u.open("GET",c,!1),u.responseType="arraybuffer",u.send(null),new Uint8Array(u.response)}),vt=(c,u,d)=>{var p=new XMLHttpRequest;p.open("GET",c,!0),p.responseType="arraybuffer",p.onload=()=>{if(p.status==200||p.status==0&&p.response){u(p.response);return}d()},p.onerror=d,p.send(null)});var ue=e.print||console.log.bind(console),Ce=e.printErr||console.error.bind(console);Object.assign(e,s),s=null,e.arguments&&(o=e.arguments),e.thisProgram&&(a=e.thisProgram),e.quit&&(l=e.quit);var er;e.wasmBinary&&(er=e.wasmBinary);var ko=e.noExitRuntime||!0;typeof WebAssembly!="object"&&Xr("no native wasm support detected");var Wr,$r=!1,J;function Pt(c,u){c||Xr(u)}var Mt,bt,St,Et,g,ft,pn,Mu;function tc(){var c=Wr.buffer;e.HEAP8=Mt=new Int8Array(c),e.HEAP16=St=new Int16Array(c),e.HEAPU8=bt=new Uint8Array(c),e.HEAPU16=Et=new Uint16Array(c),e.HEAP32=g=new Int32Array(c),e.HEAPU32=ft=new Uint32Array(c),e.HEAPF32=pn=new Float32Array(c),e.HEAPF64=Mu=new Float64Array(c)}var ec=[],rc=[],Uu=[],nc=[],ic=!1,Nu=0;function Lu(){return ko||Nu>0}function ku(){if(e.preRun)for(typeof e.preRun=="function"&&(e.preRun=[e.preRun]);e.preRun.length;)Hu(e.preRun.shift());$i(ec)}function Cu(){ic=!0,$i(rc)}function Pu(){$i(Uu)}function Vu(){if(e.postRun)for(typeof e.postRun=="function"&&(e.postRun=[e.postRun]);e.postRun.length;)ju(e.postRun.shift());$i(nc)}function Hu(c){ec.unshift(c)}function zu(c){rc.unshift(c)}function ju(c){nc.unshift(c)}var Yr=0,Co=null,$n=null;function Wu(c){Yr++,e.monitorRunDependencies&&e.monitorRunDependencies(Yr)}function $u(c){if(Yr--,e.monitorRunDependencies&&e.monitorRunDependencies(Yr),Yr==0&&(Co!==null&&(clearInterval(Co),Co=null),$n)){var u=$n;$n=null,u()}}function Xr(c){e.onAbort&&e.onAbort(c),c="Aborted("+c+")",Ce(c),$r=!0,J=1,c+=". Build with -sASSERTIONS for more info.",ic&&Ac();var u=new WebAssembly.RuntimeError(c);throw i(u),u}var Yu="data:application/octet-stream;base64,";function sc(c){return c.startsWith(Yu)}function oc(c){return c.startsWith("file://")}var mn;mn="./duckdb-eh.wasm",sc(mn)||(mn=B(mn));function ac(c){if(c==mn&&er)return new Uint8Array(er);if(Bt)return Bt(c);throw"both async and sync fetching of the wasm failed"}function Xu(c){return!er&&(f||m)&&typeof fetch=="function"?fetch(c,{credentials:"same-origin"}).then(u=>{if(!u.ok)throw"failed to load wasm binary file at '"+c+"'";return u.arrayBuffer()}).catch(()=>ac(c)):Promise.resolve().then(()=>ac(c))}function cc(c,u,d){return Xu(c).then(p=>WebAssembly.instantiate(p,u)).then(p=>p).then(d,p=>{Ce("failed to asynchronously prepare wasm: ".concat(p)),Xr(p)})}function Gu(c,u,d,p){return!c&&typeof WebAssembly.instantiateStreaming=="function"&&!sc(u)&&!_&&typeof fetch=="function"?fetch(u,{credentials:"same-origin"}).then(y=>{var I=WebAssembly.instantiateStreaming(y,d);return I.then(p,function(v){return Ce("wasm streaming compile failed: ".concat(v)),Ce("falling back to ArrayBuffer instantiation"),cc(u,d,p)})}):cc(u,d,p)}function Ku(){var c={a:bf};function u(p,y){return A=p.exports,A=oh(A),Wr=A.fa,tc(),zu(A.ga),$u("wasm-instantiate"),A}Wu("wasm-instantiate");function d(p){u(p.instance)}if(e.instantiateWasm)try{return e.instantiateWasm(c,u)}catch(p){Ce("Module.instantiateWasm callback failed with error: ".concat(p)),i(p)}return Gu(er,mn,c,d).catch(i),{}}var de,yn;function lc(c){this.name="ExitStatus",this.message="Program terminated with exit(".concat(c,")"),this.status=c}var $i=c=>{for(;c.length>0;)c.shift()(e)},uc=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,dc=(c,u,d)=>{u>>>=0;for(var p=u+d,y=u;c[y]&&!(y>=p);)++y;if(y-u>16&&c.buffer&&uc)return uc.decode(c.subarray(u,y));for(var I="";u<y;){var v=c[u++];if(!(v&128)){I+=String.fromCharCode(v);continue}var S=c[u++]&63;if((v&224)==192){I+=String.fromCharCode((v&31)<<6|S);continue}var x=c[u++]&63;if((v&240)==224?v=(v&15)<<12|S<<6|x:v=(v&7)<<18|S<<12|x<<6|c[u++]&63,v<65536)I+=String.fromCharCode(v);else{var Z=v-65536;I+=String.fromCharCode(55296|Z>>10,56320|Z&1023)}}return I},_n=(c,u)=>(c>>>=0,c?dc(bt,c,u):""),Ir={varargs:void 0,get(){var c=g[+Ir.varargs>>>2>>>0];return Ir.varargs+=4,c},getp(){return Ir.get()},getStr(c){var u=_n(c);return u}},Yi=(c,u)=>u+2097152>>>0<4194305-!!c?(c>>>0)+u*4294967296:NaN;function Ju(c,u,d,p,y){u>>>=0,d>>>=0,p>>>=0,y>>>=0;for(var I=0,v=u?g[u>>>2>>>0]:0,S=u?g[u+4>>>2>>>0]:0,x=d?g[d>>>2>>>0]:0,Z=d?g[d+4>>>2>>>0]:0,et=p?g[p>>>2>>>0]:0,Xt=p?g[p+4>>>2>>>0]:0,it=0,Pe=0,gt=0,Gt=0,we=0,rr=0,b=(u?g[u>>>2>>>0]:0)|(d?g[d>>>2>>>0]:0)|(p?g[p>>>2>>>0]:0),O=(u?g[u+4>>>2>>>0]:0)|(d?g[d+4>>>2>>>0]:0)|(p?g[p+4>>>2>>>0]:0),at=function(uh,dh,fh,Ec){return uh<32?dh&Ec:fh&Ec},st=0;st<c;st++){var zt=1<<st%32;if(at(st,b,O,zt)){var Gn=Ir.getStreamFromFD(st),ts=Ir.DEFAULT_POLLMASK;if(Gn.stream_ops.poll){var Dc=-1;if(y){var ch=u?g[y>>>2>>>0]:0,lh=u?g[y+8>>>2>>>0]:0;Dc=(ch+lh/1e6)*1e3}ts=Gn.stream_ops.poll(Gn,Dc)}ts&1&&at(st,v,S,zt)&&(st<32?it=it|zt:Pe=Pe|zt,I++),ts&4&&at(st,x,Z,zt)&&(st<32?gt=gt|zt:Gt=Gt|zt,I++),ts&2&&at(st,et,Xt,zt)&&(st<32?we=we|zt:rr=rr|zt,I++)}}return u&&(g[u>>>2>>>0]=it,g[u+4>>>2>>>0]=Pe),d&&(g[d>>>2>>>0]=gt,g[d+4>>>2>>>0]=Gt),p&&(g[p>>>2>>>0]=we,g[p+4>>>2>>>0]=rr),I}function fc(){Xr("missing function: $SOCKFS")}fc.stub=!0;function Po(){Xr("missing function: $FS")}Po.stub=!0;var Yn=c=>{var u=fc.getSocket(c);if(!u)throw new Po.ErrnoError(8);return u},Vo=c=>(c&255)+"."+(c>>8&255)+"."+(c>>16&255)+"."+(c>>24&255),hc=c=>{var u="",d=0,p=0,y=0,I=0,v=0,S=0,x=[c[0]&65535,c[0]>>16,c[1]&65535,c[1]>>16,c[2]&65535,c[2]>>16,c[3]&65535,c[3]>>16],Z=!0,et="";for(S=0;S<5;S++)if(x[S]!==0){Z=!1;break}if(Z){if(et=Vo(x[6]|x[7]<<16),x[5]===-1)return u="::ffff:",u+=et,u;if(x[5]===0)return u="::",et==="0.0.0.0"&&(et=""),et==="0.0.0.1"&&(et="1"),u+=et,u}for(d=0;d<8;d++)x[d]===0&&(d-y>1&&(v=0),y=d,v++),v>p&&(p=v,I=d-p+1);for(d=0;d<8;d++){if(p>1&&x[d]===0&&d>=I&&d<I+p){d===I&&(u+=":",I===0&&(u+=":"));continue}u+=Number($o(x[d]&65535)).toString(16),u+=d<7?":":""}return u},pc=(c,u)=>{var d=St[c>>>1>>>0],p=$o(Et[c+2>>>1>>>0]),y;switch(d){case 2:if(u!==16)return{errno:28};y=g[c+4>>>2>>>0],y=Vo(y);break;case 10:if(u!==28)return{errno:28};y=[g[c+8>>>2>>>0],g[c+12>>>2>>>0],g[c+16>>>2>>>0],g[c+20>>>2>>>0]],y=hc(y);break;default:return{errno:5}}return{family:d,addr:y,port:p}},Xi=c=>{for(var u=c.split("."),d=0;d<4;d++){var p=Number(u[d]);if(isNaN(p))return null;u[d]=p}return(u[0]|u[1]<<8|u[2]<<16|u[3]<<24)>>>0},Gi=c=>parseInt(c),Ho=c=>{var u,d,p,y,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,v=[];if(!I.test(c))return null;if(c==="::")return[0,0,0,0,0,0,0,0];for(c.startsWith("::")?c=c.replace("::","Z:"):c=c.replace("::",":Z:"),c.indexOf(".")>0?(c=c.replace(new RegExp("[.]","g"),":"),u=c.split(":"),u[u.length-4]=Gi(u[u.length-4])+Gi(u[u.length-3])*256,u[u.length-3]=Gi(u[u.length-2])+Gi(u[u.length-1])*256,u=u.slice(0,u.length-2)):u=c.split(":"),p=0,y=0,d=0;d<u.length;d++)if(typeof u[d]=="string")if(u[d]==="Z"){for(y=0;y<8-u.length+1;y++)v[d+y]=0;p=y-1}else v[d+p]=qi(parseInt(u[d],16));else v[d+p]=u[d];return[v[1]<<16|v[0],v[3]<<16|v[2],v[5]<<16|v[4],v[7]<<16|v[6]]},fe={address_map:{id:1,addrs:{},names:{}},lookup_name(c){var u=Xi(c);if(u!==null||(u=Ho(c),u!==null))return c;var d;if(fe.address_map.addrs[c])d=fe.address_map.addrs[c];else{var p=fe.address_map.id++;Pt(p<65535,"exceeded max address mappings of 65535"),d="172.29."+(p&255)+"."+(p&65280),fe.address_map.names[d]=c,fe.address_map.addrs[c]=d}return d},lookup_addr(c){return fe.address_map.names[c]?fe.address_map.names[c]:null}},mc=(c,u,d)=>{if(d&&c===0)return null;var p=pc(c,u);if(p.errno)throw new Po.ErrnoError(p.errno);return p.addr=fe.lookup_addr(p.addr)||p.addr,p};function qu(c,u,d,p,y,I){u>>>=0,d>>>=0;var v=Yn(c),S=mc(u,d);return v.sock_ops.bind(v,S.addr,S.port),0}function Zu(c,u,d,p,y,I){u>>>=0,d>>>=0;var v=Yn(c),S=mc(u,d);return v.sock_ops.connect(v,S.addr,S.port),0}function Qu(c,u,d,p){u>>>=0}function td(c,u,d){return d>>>=0,Ir.varargs=d,0}function ed(c,u){u>>>=0}function rd(c,u,d){var p=Yi(u,d)}var yc=(c,u,d,p)=>{if(d>>>=0,!(p>0))return 0;for(var y=d,I=d+p-1,v=0;v<c.length;++v){var S=c.charCodeAt(v);if(S>=55296&&S<=57343){var x=c.charCodeAt(++v);S=65536+((S&1023)<<10)|x&1023}if(S<=127){if(d>=I)break;u[d++>>>0]=S}else if(S<=2047){if(d+1>=I)break;u[d++>>>0]=192|S>>6,u[d++>>>0]=128|S&63}else if(S<=65535){if(d+2>=I)break;u[d++>>>0]=224|S>>12,u[d++>>>0]=128|S>>6&63,u[d++>>>0]=128|S&63}else{if(d+3>=I)break;u[d++>>>0]=240|S>>18,u[d++>>>0]=128|S>>12&63,u[d++>>>0]=128|S>>6&63,u[d++>>>0]=128|S&63}}return u[d>>>0]=0,d-y},zo=(c,u,d)=>yc(c,bt,u,d);function nd(c,u,d){u>>>=0,d>>>=0}var _c=(c,u)=>(bt.fill(0,c,c+u),c),jo=(c,u,d,p,y)=>{switch(u){case 2:d=Xi(d),_c(c,16),y&&(g[y>>>2>>>0]=16),St[c>>>1>>>0]=u,g[c+4>>>2>>>0]=d,St[c+2>>>1>>>0]=qi(p);break;case 10:d=Ho(d),_c(c,28),y&&(g[y>>>2>>>0]=28),g[c>>>2>>>0]=u,g[c+8>>>2>>>0]=d[0],g[c+12>>>2>>>0]=d[1],g[c+16>>>2>>>0]=d[2],g[c+20>>>2>>>0]=d[3],St[c+2>>>1>>>0]=qi(p);break;default:return 5}return 0};function id(c,u,d,p,y,I){u>>>=0,d>>>=0;var v=Yn(c);if(!v.daddr)return-53;var S=jo(u,v.family,fe.lookup_name(v.daddr),v.dport,d);return 0}function sd(c,u,d,p,y,I){p>>>=0,y>>>=0;var v=Yn(c);return u===1&&d===4?(g[p>>>2>>>0]=v.error,g[y>>>2>>>0]=4,v.error=null,0):-50}function od(c,u,d){return d>>>=0,Ir.varargs=d,0}function ad(c,u){c>>>=0,u>>>=0}function cd(c,u,d){u>>>=0}function ld(c,u,d,p){u>>>=0,d>>>=0}function ud(c,u,d,p){u>>>=0,p>>>=0,Ir.varargs=p}function dd(c,u,d,p,y,I){u>>>=0,d>>>=0,y>>>=0,I>>>=0;var v=Yn(c),S=v.sock_ops.recvmsg(v,d);if(!S)return 0;if(y)var x=jo(y,v.family,fe.lookup_name(S.addr),S.port,I);return bt.set(S.buffer,u>>>0),S.buffer.byteLength}function fd(c,u,d,p){u>>>=0,p>>>=0}function hd(c){c>>>=0}function pd(c,u,d,p,y,I){u>>>=0,d>>>=0,y>>>=0,I>>>=0}var md=(c,u,d)=>{};function yd(c,u){c>>>=0,u>>>=0}function _d(c,u,d){u>>>=0}var bd=!0,gd=()=>bd,wd=()=>{Xr("")};function vd(c,u){return globalThis.DUCKDB_RUNTIME.createDirectory(e,c,u)}function Sd(c,u){return globalThis.DUCKDB_RUNTIME.checkDirectory(e,c,u)}function Id(c,u){return globalThis.DUCKDB_RUNTIME.listDirectoryEntries(e,c,u)}function Fd(c,u){return globalThis.DUCKDB_RUNTIME.removeDirectory(e,c,u)}function Bd(c){return globalThis.DUCKDB_RUNTIME.closeFile(e,c)}function Ad(c,u){return globalThis.DUCKDB_RUNTIME.checkFile(e,c,u)}function Td(c){return globalThis.DUCKDB_RUNTIME.getLastFileModificationTime(e,c)}function xd(c,u,d,p){return globalThis.DUCKDB_RUNTIME.moveFile(e,c,u,d,p)}function Dd(c,u){return globalThis.DUCKDB_RUNTIME.openFile(e,c,u)}function Ed(c,u,d,p){return globalThis.DUCKDB_RUNTIME.readFile(e,c,u,d,p)}function Od(c,u){return globalThis.DUCKDB_RUNTIME.truncateFile(e,c,u)}function Rd(c,u,d,p){return globalThis.DUCKDB_RUNTIME.writeFile(e,c,u,d,p)}function Md(c){return globalThis.DUCKDB_RUNTIME.getDefaultDataProtocol(c)}function Ud(c,u){return globalThis.DUCKDB_RUNTIME.glob(e,c,u)}function Nd(c){return globalThis.DUCKDB_RUNTIME.testPlatformFeature(e,c)}function Ld(c,u,d,p,y,I){return globalThis.DUCKDB_RUNTIME.callScalarUDF(e,c,u,d,p,y,I)}var kd=()=>Date.now(),bc=()=>4294901760;function Cd(){return bc()}var gc;gc=()=>performance.now();function Pd(c,u,d){return c>>>=0,u>>>=0,d>>>=0,bt.copyWithin(c>>>0,u>>>0,u+d>>>0)}var Vd=c=>{var u=Wr.buffer,d=(c-u.byteLength+65535)/65536;try{return Wr.grow(d),tc(),1}catch(p){}};function Hd(c){c>>>=0;var u=bt.length,d=bc();if(c>d)return!1;for(var p=(x,Z)=>x+(Z-x%Z)%Z,y=1;y<=4;y*=2){var I=u*(1+.2/y);I=Math.min(I,c+100663296);var v=Math.min(d,p(Math.max(c,I),65536)),S=Vd(v);if(S)return!0}return!1}var Wo={},zd=()=>a||"./this.program",Xn=()=>{if(!Xn.strings){var c=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",u={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:c,_:zd()};for(var d in Wo)Wo[d]===void 0?delete u[d]:u[d]=Wo[d];var p=[];for(var d in u)p.push("".concat(d,"=").concat(u[d]));Xn.strings=p}return Xn.strings},jd=(c,u)=>{for(var d=0;d<c.length;++d)Mt[u++>>>0>>>0]=c.charCodeAt(d);Mt[u>>>0>>>0]=0},Wd=function(c,u){c>>>=0,u>>>=0;var d=0;return Xn().forEach((p,y)=>{var I=u+d;ft[c+y*4>>>2>>>0]=I,jd(p,I),d+=p.length+1}),0},$d=function(c,u){c>>>=0,u>>>=0;var d=Xn();ft[c>>>2>>>0]=d.length;var p=0;return d.forEach(y=>p+=y.length+1),ft[u>>>2>>>0]=p,0},Yd=c=>52;function Xd(c,u){u>>>=0;var d=0,p=0,y=0;{var I=2;c==0?d=2:(c==1||c==2)&&(d=64),y=1}return Mt[u>>>0>>>0]=I,St[u+2>>>1>>>0]=y,yn=[d>>>0,(de=d,+Math.abs(de)>=1?de>0?+Math.floor(de/4294967296)>>>0:~~+Math.ceil((de-+(~~de>>>0))/4294967296)>>>0:0)],g[u+8>>>2>>>0]=yn[0],g[u+12>>>2>>>0]=yn[1],yn=[p>>>0,(de=p,+Math.abs(de)>=1?de>0?+Math.floor(de/4294967296)>>>0:~~+Math.ceil((de-+(~~de>>>0))/4294967296)>>>0:0)],g[u+16>>>2>>>0]=yn[0],g[u+20>>>2>>>0]=yn[1],0}function Gd(c,u,d,p,y,I){u>>>=0,d>>>=0;var v=Yi(p,y);return I>>>=0,52}function Kd(c,u,d,p,y,I){u>>>=0,d>>>=0;var v=Yi(p,y);return I>>>=0,52}function Jd(c,u,d,p){return u>>>=0,d>>>=0,p>>>=0,52}function qd(c,u,d,p,y){var I=Yi(u,d);return y>>>=0,70}var Zd=c=>52,Qd=[null,[],[]],tf=(c,u)=>{var d=Qd[c];u===0||u===10?((c===1?ue:Ce)(dc(d,0)),d.length=0):d.push(u)};function ef(c,u,d,p){u>>>=0,d>>>=0,p>>>=0;for(var y=0,I=0;I<d;I++){var v=ft[u>>>2>>>0],S=ft[u+4>>>2>>>0];u+=8;for(var x=0;x<S;x++)tf(c,bt[v+x>>>0]);y+=S}return ft[p>>>2>>>0]=y,0}function rf(c,u,d,p){c>>>=0,u>>>=0,d>>>=0,p>>>=0;var y=0,I=0,v=0,S=0,x=0,Z=0,et;function Xt(it,Pe,gt,Gt,we,rr){var b,O,at,st;return O=it===10?28:16,we=it===10?hc(we):Vo(we),b=Yo(O),st=jo(b,it,we,rr),Pt(!st),at=Yo(32),g[at+4>>>2>>>0]=it,g[at+8>>>2>>>0]=Pe,g[at+12>>>2>>>0]=gt,ft[at+24>>>2>>>0]=Gt,ft[at+20>>>2>>>0]=b,it===10?g[at+16>>>2>>>0]=28:g[at+16>>>2>>>0]=16,g[at+28>>>2>>>0]=0,at}if(d&&(v=g[d>>>2>>>0],S=g[d+4>>>2>>>0],x=g[d+8>>>2>>>0],Z=g[d+12>>>2>>>0]),x&&!Z&&(Z=x===2?17:6),!x&&Z&&(x=Z===17?2:1),Z===0&&(Z=6),x===0&&(x=1),!c&&!u)return-2;if(v&-1088||d!==0&&g[d>>>2>>>0]&2&&!c)return-1;if(v&32)return-2;if(x!==0&&x!==1&&x!==2)return-7;if(S!==0&&S!==2&&S!==10)return-6;if(u&&(u=_n(u),I=parseInt(u,10),isNaN(I)))return v&1024?-2:-8;if(!c)return S===0&&(S=2),v&1||(S===2?y=Ji(2130706433):y=[0,0,0,1]),et=Xt(S,x,Z,null,y,I),ft[p>>>2>>>0]=et,0;if(c=_n(c),y=Xi(c),y!==null)if(S===0||S===2)S=2;else if(S===10&&v&8)y=[0,0,Ji(65535),y],S=10;else return-2;else if(y=Ho(c),y!==null)if(S===0||S===10)S=10;else return-2;return y!=null?(et=Xt(S,x,Z,c,y,I),ft[p>>>2>>>0]=et,0):v&4?-2:(c=fe.lookup_name(c),y=Xi(c),S===0?S=2:S===10&&(y=[0,0,Ji(65535),y]),et=Xt(S,x,Z,null,y,I),ft[p>>>2>>>0]=et,0)}var nf=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return p=>crypto.getRandomValues(p);if(_)try{var c=bh("crypto"),u=c.randomFillSync;if(u)return p=>c.randomFillSync(p);var d=c.randomBytes;return p=>(p.set(d(p.byteLength)),p)}catch(p){}Xr("initRandomDevice")},wc=c=>(wc=nf())(c);function sf(c,u){return c>>>=0,u>>>=0,wc(bt.subarray(c>>>0,c+u>>>0)),0}function of(c,u,d,p,y,I,v){c>>>=0,d>>>=0,y>>>=0;var S=pc(c,u);if(S.errno)return-6;var x=S.port,Z=S.addr,et=!1;if(d&&p){var Xt;if(v&1||!(Xt=fe.lookup_addr(Z))){if(v&8)return-2}else Z=Xt;var it=zo(Z,d,p);it+1>=p&&(et=!0)}if(y&&I){x=""+x;var it=zo(x,y,I);it+1>=I&&(et=!0)}return et?-12:0}var Ki=c=>c%4===0&&(c%100!==0||c%400===0),af=(c,u)=>{for(var d=0,p=0;p<=u;d+=c[p++]);return d},vc=[31,29,31,30,31,30,31,31,30,31,30,31],Sc=[31,28,31,30,31,30,31,31,30,31,30,31],cf=(c,u)=>{for(var d=new Date(c.getTime());u>0;){var p=Ki(d.getFullYear()),y=d.getMonth(),I=(p?vc:Sc)[y];if(u>I-d.getDate())u-=I-d.getDate()+1,d.setDate(1),y<11?d.setMonth(y+1):(d.setMonth(0),d.setFullYear(d.getFullYear()+1));else return d.setDate(d.getDate()+u),d}return d},Ic=c=>{for(var u=0,d=0;d<c.length;++d){var p=c.charCodeAt(d);p<=127?u++:p<=2047?u+=2:p>=55296&&p<=57343?(u+=4,++d):u+=3}return u};function lf(c,u,d){var p=d>0?d:Ic(c)+1,y=new Array(p),I=yc(c,y,0,y.length);return u&&(y.length=I),y}var Fc=(c,u)=>{Mt.set(c,u>>>0)};function uf(c,u,d,p){c>>>=0,u>>>=0,d>>>=0,p>>>=0;var y=ft[p+40>>>2>>>0],I={tm_sec:g[p>>>2>>>0],tm_min:g[p+4>>>2>>>0],tm_hour:g[p+8>>>2>>>0],tm_mday:g[p+12>>>2>>>0],tm_mon:g[p+16>>>2>>>0],tm_year:g[p+20>>>2>>>0],tm_wday:g[p+24>>>2>>>0],tm_yday:g[p+28>>>2>>>0],tm_isdst:g[p+32>>>2>>>0],tm_gmtoff:g[p+36>>>2>>>0],tm_zone:y?_n(y):""},v=_n(d),S={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var x in S)v=v.replace(new RegExp(x,"g"),S[x]);var Z=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],et=["January","February","March","April","May","June","July","August","September","October","November","December"];function Xt(b,O,at){for(var st=typeof b=="number"?b.toString():b||"";st.length<O;)st=at[0]+st;return st}function it(b,O){return Xt(b,O,"0")}function Pe(b,O){function at(zt){return zt<0?-1:zt>0?1:0}var st;return(st=at(b.getFullYear()-O.getFullYear()))===0&&(st=at(b.getMonth()-O.getMonth()))===0&&(st=at(b.getDate()-O.getDate())),st}function gt(b){switch(b.getDay()){case 0:return new Date(b.getFullYear()-1,11,29);case 1:return b;case 2:return new Date(b.getFullYear(),0,3);case 3:return new Date(b.getFullYear(),0,2);case 4:return new Date(b.getFullYear(),0,1);case 5:return new Date(b.getFullYear()-1,11,31);case 6:return new Date(b.getFullYear()-1,11,30)}}function Gt(b){var O=cf(new Date(b.tm_year+1900,0,1),b.tm_yday),at=new Date(O.getFullYear(),0,4),st=new Date(O.getFullYear()+1,0,4),zt=gt(at),Gn=gt(st);return Pe(zt,O)<=0?Pe(Gn,O)<=0?O.getFullYear()+1:O.getFullYear():O.getFullYear()-1}var we={"%a":b=>Z[b.tm_wday].substring(0,3),"%A":b=>Z[b.tm_wday],"%b":b=>et[b.tm_mon].substring(0,3),"%B":b=>et[b.tm_mon],"%C":b=>{var O=b.tm_year+1900;return it(O/100|0,2)},"%d":b=>it(b.tm_mday,2),"%e":b=>Xt(b.tm_mday,2," "),"%g":b=>Gt(b).toString().substring(2),"%G":b=>Gt(b),"%H":b=>it(b.tm_hour,2),"%I":b=>{var O=b.tm_hour;return O==0?O=12:O>12&&(O-=12),it(O,2)},"%j":b=>it(b.tm_mday+af(Ki(b.tm_year+1900)?vc:Sc,b.tm_mon-1),3),"%m":b=>it(b.tm_mon+1,2),"%M":b=>it(b.tm_min,2),"%n":()=>"\n","%p":b=>b.tm_hour>=0&&b.tm_hour<12?"AM":"PM","%S":b=>it(b.tm_sec,2),"%t":()=>" ","%u":b=>b.tm_wday||7,"%U":b=>{var O=b.tm_yday+7-b.tm_wday;return it(Math.floor(O/7),2)},"%V":b=>{var O=Math.floor((b.tm_yday+7-(b.tm_wday+6)%7)/7);if((b.tm_wday+371-b.tm_yday-2)%7<=2&&O++,O){if(O==53){var st=(b.tm_wday+371-b.tm_yday)%7;st!=4&&(st!=3||!Ki(b.tm_year))&&(O=1)}}else{O=52;var at=(b.tm_wday+7-b.tm_yday-1)%7;(at==4||at==5&&Ki(b.tm_year%400-1))&&O++}return it(O,2)},"%w":b=>b.tm_wday,"%W":b=>{var O=b.tm_yday+7-(b.tm_wday+6)%7;return it(Math.floor(O/7),2)},"%y":b=>(b.tm_year+1900).toString().substring(2),"%Y":b=>b.tm_year+1900,"%z":b=>{var O=b.tm_gmtoff,at=O>=0;return O=Math.abs(O)/60,O=O/60*100+O%60,(at?"+":"-")+("0000"+O).slice(-4)},"%Z":b=>b.tm_zone,"%%":()=>"%"};v=v.replace(/%%/g,"\0\0");for(var x in we)v.includes(x)&&(v=v.replace(new RegExp(x,"g"),we[x](I)));v=v.replace(/\0\0/g,"%");var rr=lf(v,!1);return rr.length>u?0:(Fc(rr,c),rr.length-1)}function df(c,u,d,p,y){return c>>>=0,u>>>=0,d>>>=0,p>>>=0,y>>>=0,uf(c,u,d,p)}var ff=c=>{J=c,Lu()||(e.onExit&&e.onExit(c),$r=!0),l(c,new lc(c))},hf=(c,u)=>{J=c,ff(c)},pf=c=>{if(c instanceof lc||c=="unwind")return J;l(1,c)},mf=c=>{var u=e["_"+c];return u},yf=c=>{var u=Ic(c)+1,d=Zi(u);return zo(c,d,u),d},_f=(c,u,d,p,y)=>{var I={string:gt=>{var Gt=0;return gt!=null&>!==0&&(Gt=yf(gt)),Gt},array:gt=>{var Gt=Zi(gt.length);return Fc(gt,Gt),Gt}};function v(gt){return u==="string"?_n(gt):u==="boolean"?!!gt:gt}var S=mf(c),x=[],Z=0;if(p)for(var et=0;et<p.length;et++){var Xt=I[d[et]];Xt?(Z===0&&(Z=Xo()),x[et]=Xt(p[et])):x[et]=p[et]}var it=S.apply(null,x);function Pe(gt){return Z!==0&&Go(Z),v(gt)}return it=Pe(it),it},bf={Z:Ju,ba:qu,aa:Zu,V:Qu,a:td,U:ed,v:rd,P:nd,X:id,Y:sd,o:od,R:ad,Q:cd,S:ld,p:ud,_:dd,N:fd,j:hd,$:pd,l:md,T:yd,k:_d,q:gd,d:wd,F:vd,G:Sd,D:Id,E:Fd,h:Bd,A:Ad,u:Td,B:xd,I:Dd,e:Ed,H:Od,i:Rd,J:Md,z:Ud,g:Nd,L:Ld,r:kd,s:Cd,c:gc,da:Pd,ea:Hd,C:Wd,K:$d,b:Yd,ca:Xd,x:Gd,w:Kd,n:Jd,y:qd,O:Zd,f:ef,m:rf,M:sf,W:of,t:df},A=Ku(),gf=()=>(gf=A.ga)(),Bc=e._main=(c,u)=>(Bc=e._main=A.ha)(c,u),wf=e._duckdb_web_fs_glob_add_path=c=>(wf=e._duckdb_web_fs_glob_add_path=A.ja)(c),vf=e._duckdb_web_clear_response=()=>(vf=e._duckdb_web_clear_response=A.ka)(),Sf=e._duckdb_web_fail_with=c=>(Sf=e._duckdb_web_fail_with=A.la)(c),If=e._duckdb_web_reset=c=>(If=e._duckdb_web_reset=A.ma)(c),Ff=e._duckdb_web_connect=()=>(Ff=e._duckdb_web_connect=A.na)(),Bf=e._duckdb_web_disconnect=c=>(Bf=e._duckdb_web_disconnect=A.oa)(c),Af=e._duckdb_web_flush_files=()=>(Af=e._duckdb_web_flush_files=A.pa)(),Tf=e._duckdb_web_flush_file=c=>(Tf=e._duckdb_web_flush_file=A.qa)(c),xf=e._duckdb_web_open=(c,u)=>(xf=e._duckdb_web_open=A.ra)(c,u),Df=e._duckdb_web_get_global_file_info=(c,u)=>(Df=e._duckdb_web_get_global_file_info=A.sa)(c,u),Ef=e._duckdb_web_collect_file_stats=(c,u,d)=>(Ef=e._duckdb_web_collect_file_stats=A.ta)(c,u,d),Of=e._duckdb_web_export_file_stats=(c,u)=>(Of=e._duckdb_web_export_file_stats=A.ua)(c,u),Rf=e._duckdb_web_fs_drop_file=(c,u)=>(Rf=e._duckdb_web_fs_drop_file=A.va)(c,u),Mf=e._duckdb_web_fs_drop_files=c=>(Mf=e._duckdb_web_fs_drop_files=A.wa)(c),Uf=e._duckdb_web_fs_glob_file_infos=(c,u)=>(Uf=e._duckdb_web_fs_glob_file_infos=A.xa)(c,u),Nf=e._duckdb_web_fs_get_file_info_by_id=(c,u,d)=>(Nf=e._duckdb_web_fs_get_file_info_by_id=A.ya)(c,u,d),Lf=e._duckdb_web_fs_get_file_info_by_name=(c,u,d)=>(Lf=e._duckdb_web_fs_get_file_info_by_name=A.za)(c,u,d),kf=e._duckdb_web_fs_register_file_url=(c,u,d,p,y)=>(kf=e._duckdb_web_fs_register_file_url=A.Aa)(c,u,d,p,y),Cf=e._duckdb_web_fs_register_file_buffer=(c,u,d,p)=>(Cf=e._duckdb_web_fs_register_file_buffer=A.Ba)(c,u,d,p),Pf=e._duckdb_web_copy_file_to_buffer=(c,u)=>(Pf=e._duckdb_web_copy_file_to_buffer=A.Ca)(c,u),Vf=e._duckdb_web_copy_file_to_path=(c,u,d)=>(Vf=e._duckdb_web_copy_file_to_path=A.Da)(c,u,d),Hf=e._duckdb_web_get_version=c=>(Hf=e._duckdb_web_get_version=A.Ea)(c),zf=e._duckdb_web_get_feature_flags=()=>(zf=e._duckdb_web_get_feature_flags=A.Fa)(),jf=e._duckdb_web_tokenize=(c,u)=>(jf=e._duckdb_web_tokenize=A.Ga)(c,u),Wf=e._duckdb_web_udf_scalar_create=(c,u,d)=>(Wf=e._duckdb_web_udf_scalar_create=A.Ha)(c,u,d),$f=e._duckdb_web_prepared_create=(c,u,d)=>($f=e._duckdb_web_prepared_create=A.Ia)(c,u,d),Yf=e._duckdb_web_prepared_close=(c,u,d)=>(Yf=e._duckdb_web_prepared_close=A.Ja)(c,u,d),Xf=e._duckdb_web_prepared_run=(c,u,d,p)=>(Xf=e._duckdb_web_prepared_run=A.Ka)(c,u,d,p),Gf=e._duckdb_web_prepared_send=(c,u,d,p)=>(Gf=e._duckdb_web_prepared_send=A.La)(c,u,d,p),Kf=e._duckdb_web_query_run=(c,u,d)=>(Kf=e._duckdb_web_query_run=A.Ma)(c,u,d),Jf=e._duckdb_web_pending_query_start=(c,u,d)=>(Jf=e._duckdb_web_pending_query_start=A.Na)(c,u,d),qf=e._duckdb_web_pending_query_poll=(c,u,d)=>(qf=e._duckdb_web_pending_query_poll=A.Oa)(c,u,d),Zf=e._duckdb_web_pending_query_cancel=(c,u)=>(Zf=e._duckdb_web_pending_query_cancel=A.Pa)(c,u),Qf=e._duckdb_web_query_fetch_results=(c,u)=>(Qf=e._duckdb_web_query_fetch_results=A.Qa)(c,u),th=e._duckdb_web_get_tablenames=(c,u,d)=>(th=e._duckdb_web_get_tablenames=A.Ra)(c,u,d),eh=e._duckdb_web_insert_arrow_from_ipc_stream=(c,u,d,p,y)=>(eh=e._duckdb_web_insert_arrow_from_ipc_stream=A.Sa)(c,u,d,p,y),rh=e._duckdb_web_insert_csv_from_path=(c,u,d,p)=>(rh=e._duckdb_web_insert_csv_from_path=A.Ta)(c,u,d,p),nh=e._duckdb_web_insert_json_from_path=(c,u,d,p)=>(nh=e._duckdb_web_insert_json_from_path=A.Ua)(c,u,d,p),ih=()=>(ih=A.__errno_location)(),Ji=c=>(Ji=A.Va)(c),qi=c=>(qi=A.Wa)(c),$o=c=>($o=A.Xa)(c),Yo=e._malloc=c=>(Yo=e._malloc=A.Ya)(c),sh=e._free=c=>(sh=e._free=A.Za)(c),Ac=()=>(Ac=A._a)(),Xo=()=>(Xo=A.$a)(),Go=c=>(Go=A.ab)(c),Zi=c=>(Zi=A.bb)(c);function oh(c){c=Object.assign({},c);var u=p=>()=>p()>>>0,d=p=>y=>p(y)>>>0;return c.__errno_location=u(c.__errno_location),c.Ya=d(c.Ya),c.$a=u(c.$a),c.bb=d(c.bb),c}e.stackAlloc=Zi,e.stackSave=Xo,e.stackRestore=Go,e.ccall=_f;var Qi;$n=function c(){Qi||Tc(),Qi||($n=c)};function ah(){var c=Bc,u=0,d=0;try{var p=c(u,d);return hf(p,!0),p}catch(y){return pf(y)}}function Tc(){if(Yr>0||(ku(),Yr>0))return;function c(){Qi||(Qi=!0,e.calledRun=!0,!$r&&(Cu(),Pu(),n(e),e.onRuntimeInitialized&&e.onRuntimeInitialized(),xc&&ah(),Vu()))}e.setStatus?(e.setStatus("Running..."),setTimeout(function(){setTimeout(function(){e.setStatus("")},1),c()},1)):c()}if(e.preInit)for(typeof e.preInit=="function"&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();var xc=!0;return e.noInitialRun&&(xc=!1),Tc(),t.ready}})();typeof vu=="object"&&typeof Ga=="object"?Ga.exports=wu:typeof define=="function"&&define.amd&&define([],()=>wu)});var xu=rs((exports,module)=>{(function(){"use strict";var ERROR="input is invalid type",WINDOW=typeof window=="object",root=WINDOW?window:{};root.JS_SHA256_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&typeof self=="object",NODE_JS=!root.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_SHA256_NO_COMMON_JS&&typeof module=="object"&&module.exports,AMD=typeof define=="function"&&define.amd,ARRAY_BUFFER=!root.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],K=[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],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[];(root.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(r){return Object.prototype.toString.call(r)==="[object Array]"}),ARRAY_BUFFER&&(root.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(r){return typeof r=="object"&&r.buffer&&r.buffer.constructor===ArrayBuffer});var createOutputMethod=function(r,t){return function(e){return new Sha256(t,!0).update(e)[r]()}},createMethod=function(r){var t=createOutputMethod("hex",r);NODE_JS&&(t=nodeWrap(t,r)),t.create=function(){return new Sha256(r)},t.update=function(i){return t.create().update(i)};for(var e=0;e<OUTPUT_TYPES.length;++e){var n=OUTPUT_TYPES[e];t[n]=createOutputMethod(n,r)}return t},nodeWrap=function(method,is224){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),algorithm=is224?"sha224":"sha256",nodeMethod=function(r){if(typeof r=="string")return crypto.createHash(algorithm).update(r,"utf8").digest("hex");if(r==null)throw new Error(ERROR);return r.constructor===ArrayBuffer&&(r=new Uint8Array(r)),Array.isArray(r)||ArrayBuffer.isView(r)||r.constructor===Buffer?crypto.createHash(algorithm).update(new Buffer(r)).digest("hex"):method(r)};return nodeMethod},createHmacOutputMethod=function(r,t){return function(e,n){return new HmacSha256(e,t,!0).update(n)[r]()}},createHmacMethod=function(r){var t=createHmacOutputMethod("hex",r);t.create=function(i){return new HmacSha256(i,r)},t.update=function(i,s){return t.create(i).update(s)};for(var e=0;e<OUTPUT_TYPES.length;++e){var n=OUTPUT_TYPES[e];t[n]=createHmacOutputMethod(n,r)}return t};function Sha256(r,t){t?(blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r?(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=r}Sha256.prototype.update=function(r){if(!this.finalized){var t,e=typeof r;if(e!=="string"){if(e==="object"){if(r===null)throw new Error(ERROR);if(ARRAY_BUFFER&&r.constructor===ArrayBuffer)r=new Uint8Array(r);else if(!Array.isArray(r)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(r)))throw new Error(ERROR)}else throw new Error(ERROR);t=!0}for(var n,i=0,s,o=r.length,a=this.blocks;i<o;){if(this.hashed&&(this.hashed=!1,a[0]=this.block,a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),t)for(s=this.start;i<o&&s<64;++i)a[s>>2]|=r[i]<<SHIFT[s++&3];else for(s=this.start;i<o&&s<64;++i)n=r.charCodeAt(i),n<128?a[s>>2]|=n<<SHIFT[s++&3]:n<2048?(a[s>>2]|=(192|n>>6)<<SHIFT[s++&3],a[s>>2]|=(128|n&63)<<SHIFT[s++&3]):n<55296||n>=57344?(a[s>>2]|=(224|n>>12)<<SHIFT[s++&3],a[s>>2]|=(128|n>>6&63)<<SHIFT[s++&3],a[s>>2]|=(128|n&63)<<SHIFT[s++&3]):(n=65536+((n&1023)<<10|r.charCodeAt(++i)&1023),a[s>>2]|=(240|n>>18)<<SHIFT[s++&3],a[s>>2]|=(128|n>>12&63)<<SHIFT[s++&3],a[s>>2]|=(128|n>>6&63)<<SHIFT[s++&3],a[s>>2]|=(128|n&63)<<SHIFT[s++&3]);this.lastByteIndex=s,this.bytes+=s-this.start,s>=64?(this.block=a[16],this.start=s-64,this.hash(),this.hashed=!0):this.start=s}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha256.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var r=this.blocks,t=this.lastByteIndex;r[16]=this.block,r[t>>2]|=EXTRA[t&3],this.block=r[16],t>=56&&(this.hashed||this.hash(),r[0]=this.block,r[16]=r[1]=r[2]=r[3]=r[4]=r[5]=r[6]=r[7]=r[8]=r[9]=r[10]=r[11]=r[12]=r[13]=r[14]=r[15]=0),r[14]=this.hBytes<<3|this.bytes>>>29,r[15]=this.bytes<<3,this.hash()}},Sha256.prototype.hash=function(){var r=this.h0,t=this.h1,e=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,a=this.h7,l=this.blocks,f,m,_,w,B,q,vt,Bt,Tt,Ht,ue;for(f=16;f<64;++f)B=l[f-15],m=(B>>>7|B<<25)^(B>>>18|B<<14)^B>>>3,B=l[f-2],_=(B>>>17|B<<15)^(B>>>19|B<<13)^B>>>10,l[f]=l[f-16]+m+l[f-7]+_<<0;for(ue=t&e,f=0;f<64;f+=4)this.first?(this.is224?(Bt=300032,B=l[0]-1413257819,a=B-150054599<<0,n=B+24177077<<0):(Bt=704751109,B=l[0]-210244248,a=B-1521486534<<0,n=B+143694565<<0),this.first=!1):(m=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),_=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),Bt=r&t,w=Bt^r&e^ue,vt=i&s^~i&o,B=a+_+vt+K[f]+l[f],q=m+w,a=n+B<<0,n=B+q<<0),m=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),_=(a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7),Tt=n&r,w=Tt^n&t^Bt,vt=a&i^~a&s,B=o+_+vt+K[f+1]+l[f+1],q=m+w,o=e+B<<0,e=B+q<<0,m=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),_=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),Ht=e&n,w=Ht^e&r^Tt,vt=o&a^~o&i,B=s+_+vt+K[f+2]+l[f+2],q=m+w,s=t+B<<0,t=B+q<<0,m=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),_=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),ue=t&e,w=ue^t&n^Ht,vt=s&o^~s&a,B=i+_+vt+K[f+3]+l[f+3],q=m+w,i=r+B<<0,r=B+q<<0;this.h0=this.h0+r<<0,this.h1=this.h1+t<<0,this.h2=this.h2+e<<0,this.h3=this.h3+n<<0,this.h4=this.h4+i<<0,this.h5=this.h5+s<<0,this.h6=this.h6+o<<0,this.h7=this.h7+a<<0},Sha256.prototype.hex=function(){this.finalize();var r=this.h0,t=this.h1,e=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,a=this.h7,l=HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[r&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[t&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[e&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[n&15]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[i&15]+HEX_CHARS[s>>28&15]+HEX_CHARS[s>>24&15]+HEX_CHARS[s>>20&15]+HEX_CHARS[s>>16&15]+HEX_CHARS[s>>12&15]+HEX_CHARS[s>>8&15]+HEX_CHARS[s>>4&15]+HEX_CHARS[s&15]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[o&15];return this.is224||(l+=HEX_CHARS[a>>28&15]+HEX_CHARS[a>>24&15]+HEX_CHARS[a>>20&15]+HEX_CHARS[a>>16&15]+HEX_CHARS[a>>12&15]+HEX_CHARS[a>>8&15]+HEX_CHARS[a>>4&15]+HEX_CHARS[a&15]),l},Sha256.prototype.toString=Sha256.prototype.hex,Sha256.prototype.digest=function(){this.finalize();var r=this.h0,t=this.h1,e=this.h2,n=this.h3,i=this.h4,s=this.h5,o=this.h6,a=this.h7,l=[r>>24&255,r>>16&255,r>>8&255,r&255,t>>24&255,t>>16&255,t>>8&255,t&255,e>>24&255,e>>16&255,e>>8&255,e&255,n>>24&255,n>>16&255,n>>8&255,n&255,i>>24&255,i>>16&255,i>>8&255,i&255,s>>24&255,s>>16&255,s>>8&255,s&255,o>>24&255,o>>16&255,o>>8&255,o&255];return this.is224||l.push(a>>24&255,a>>16&255,a>>8&255,a&255),l},Sha256.prototype.array=Sha256.prototype.digest,Sha256.prototype.arrayBuffer=function(){this.finalize();var r=new ArrayBuffer(this.is224?28:32),t=new DataView(r);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),this.is224||t.setUint32(28,this.h7),r};function HmacSha256(r,t,e){var n,i=typeof r;if(i==="string"){var s=[],o=r.length,a=0,l;for(n=0;n<o;++n)l=r.charCodeAt(n),l<128?s[a++]=l:l<2048?(s[a++]=192|l>>6,s[a++]=128|l&63):l<55296||l>=57344?(s[a++]=224|l>>12,s[a++]=128|l>>6&63,s[a++]=128|l&63):(l=65536+((l&1023)<<10|r.charCodeAt(++n)&1023),s[a++]=240|l>>18,s[a++]=128|l>>12&63,s[a++]=128|l>>6&63,s[a++]=128|l&63);r=s}else if(i==="object"){if(r===null)throw new Error(ERROR);if(ARRAY_BUFFER&&r.constructor===ArrayBuffer)r=new Uint8Array(r);else if(!Array.isArray(r)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(r)))throw new Error(ERROR)}else throw new Error(ERROR);r.length>64&&(r=new Sha256(t,!0).update(r).array());var f=[],m=[];for(n=0;n<64;++n){var _=r[n]||0;f[n]=92^_,m[n]=54^_}Sha256.call(this,t,e),this.update(m),this.oKeyPad=f,this.inner=!0,this.sharedMemory=e}HmacSha256.prototype=new Sha256,HmacSha256.prototype.finalize=function(){if(Sha256.prototype.finalize.call(this),this.inner){this.inner=!1;var r=this.array();Sha256.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(r),Sha256.prototype.finalize.call(this)}};var exports=createMethod();exports.sha256=exports,exports.sha224=createMethod(!0),exports.sha256.hmac=createHmacMethod(),exports.sha224.hmac=createHmacMethod(!0),COMMON_JS?module.exports=exports:(root.sha256=exports.sha256,root.sha224=exports.sha224,AMD&&define(function(){return exports}))})()});var ly={};Gr(ly,{registerWorker:()=>Ru});function Uc(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e}function F(r,t,e,n){function i(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(m){try{f(n.next(m))}catch(_){o(_)}}function l(m){try{f(n.throw(m))}catch(_){o(_)}}function f(m){m.done?s(m.value):i(m.value).then(a,l)}f((n=n.apply(r,t||[])).next())})}function Mc(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function C(r){return this instanceof C?(this.v=r,this):new C(r)}function re(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(w){n[w]&&(i[w]=function(B){return new Promise(function(q,vt){s.push([w,B,q,vt])>1||a(w,B)})})}function a(w,B){try{l(n[w](B))}catch(q){_(s[0][3],q)}}function l(w){w.value instanceof C?Promise.resolve(w.value.v).then(f,m):_(s[0][2],w)}function f(w){a("next",w)}function m(w){a("throw",w)}function _(w,B){w(B),s.shift(),s.length&&a(s[0][0],s[0][1])}}function bn(r){var t,e;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,s){t[i]=r[i]?function(o){return(e=!e)?{value:C(r[i](o)),done:!1}:s?s(o):o}:s}}function ve(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof Mc=="function"?Mc(r):r[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(s){e[s]=r[s]&&function(o){return new Promise(function(a,l){o=r[s](o),i(a,l,o.done,o.value)})}}function i(s,o,a,l){Promise.resolve(l).then(function(f){s({value:f,done:a})},o)}}var ea={};Gr(ea,{compareArrayLike:()=>ta,joinUint8Arrays:()=>ne,memcpy:()=>gn,rebaseValueOffsets:()=>qn,toArrayBufferView:()=>W,toArrayBufferViewAsyncIterator:()=>Fe,toArrayBufferViewIterator:()=>Ve,toBigInt64Array:()=>Th,toBigUint64Array:()=>Eh,toFloat32Array:()=>Oh,toFloat32ArrayAsyncIterator:()=>Xh,toFloat32ArrayIterator:()=>Ph,toFloat64Array:()=>Rh,toFloat64ArrayAsyncIterator:()=>Gh,toFloat64ArrayIterator:()=>Vh,toInt16Array:()=>Ah,toInt16ArrayAsyncIterator:()=>jh,toInt16ArrayIterator:()=>Nh,toInt32Array:()=>Jr,toInt32ArrayAsyncIterator:()=>Wh,toInt32ArrayIterator:()=>Lh,toInt8Array:()=>Bh,toInt8ArrayAsyncIterator:()=>zh,toInt8ArrayIterator:()=>Uh,toUint16Array:()=>xh,toUint16ArrayAsyncIterator:()=>$h,toUint16ArrayIterator:()=>kh,toUint32Array:()=>Dh,toUint32ArrayAsyncIterator:()=>Yh,toUint32ArrayIterator:()=>Ch,toUint8Array:()=>L,toUint8ArrayAsyncIterator:()=>Qo,toUint8ArrayIterator:()=>Zo,toUint8ClampedArray:()=>Mh,toUint8ClampedArrayAsyncIterator:()=>Kh,toUint8ClampedArrayIterator:()=>Hh});var vh=new TextDecoder("utf-8"),Kn=r=>vh.decode(r),Sh=new TextEncoder,Fr=r=>Sh.encode(r);var Ih=r=>typeof r=="number",Nc=r=>typeof r=="boolean",xt=r=>typeof r=="function",jt=r=>r!=null&&Object(r)===r,Se=r=>jt(r)&&xt(r.then);var Ie=r=>jt(r)&&xt(r[Symbol.iterator]),he=r=>jt(r)&&xt(r[Symbol.asyncIterator]),ns=r=>jt(r)&&jt(r.schema);var is=r=>jt(r)&&"done"in r&&"value"in r;var ss=r=>jt(r)&&xt(r.stat)&&Ih(r.fd);var os=r=>jt(r)&&Jn(r.body),as=r=>"_getDOMStream"in r&&"_getNodeStream"in r,Lc=r=>jt(r)&&xt(r.abort)&&xt(r.getWriter)&&!as(r),Jn=r=>jt(r)&&xt(r.cancel)&&xt(r.getReader)&&!as(r),kc=r=>jt(r)&&xt(r.end)&&xt(r.write)&&Nc(r.writable)&&!as(r),cs=r=>jt(r)&&xt(r.read)&&xt(r.pipe)&&Nc(r.readable)&&!as(r),Cc=r=>jt(r)&&xt(r.clear)&&xt(r.bytes)&&xt(r.position)&&xt(r.setPosition)&&xt(r.capacity)&&xt(r.getBufferIdentifier)&&xt(r.createLong);var qo=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Fh(r){let t=r[0]?[r[0]]:[],e,n,i,s;for(let o,a,l=0,f=0,m=r.length;++l<m;){if(o=t[f],a=r[l],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++f]=a);continue}if({byteOffset:e,byteLength:i}=o,{byteOffset:n,byteLength:s}=a,e+i<n||n+s<e){a&&(t[++f]=a);continue}t[f]=new Uint8Array(o.buffer,e,n-e+s)}return t}function gn(r,t,e=0,n=t.byteLength){let i=r.byteLength,s=new Uint8Array(r.buffer,r.byteOffset,i),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return s.set(o,e),r}function ne(r,t){let e=Fh(r),n=e.reduce((m,_)=>m+_.byteLength,0),i,s,o,a=0,l=-1,f=Math.min(t||Number.POSITIVE_INFINITY,n);for(let m=e.length;++l<m;){if(i=e[l],s=i.subarray(0,Math.min(i.length,f-a)),f<=a+s.length){s.length<i.length?e[l]=i.subarray(s.length):s.length===i.length&&l++,o?gn(o,s,a):o=s;break}gn(o||(o=new Uint8Array(f)),s,a),a+=s.length}return[o||new Uint8Array(0),e.slice(l),n-(o?o.byteLength:0)]}function W(r,t){let e=is(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=Fr(e)),e instanceof ArrayBuffer?new r(e):e instanceof qo?new r(e):Cc(e)?W(r,e.bytes()):ArrayBuffer.isView(e)?e.byteLength<=0?new r(0):new r(e.buffer,e.byteOffset,e.byteLength/r.BYTES_PER_ELEMENT):r.from(e)):new r(0)}var Bh=r=>W(Int8Array,r),Ah=r=>W(Int16Array,r),Jr=r=>W(Int32Array,r),Th=r=>W(BigInt64Array,r),L=r=>W(Uint8Array,r),xh=r=>W(Uint16Array,r),Dh=r=>W(Uint32Array,r),Eh=r=>W(BigUint64Array,r),Oh=r=>W(Float32Array,r),Rh=r=>W(Float64Array,r),Mh=r=>W(Uint8ClampedArray,r),Jo=r=>(r.next(),r);function*Ve(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof qo?e(t):Ie(t)?t:e(t);return yield*Kr(Jo(function*(i){let s=null;do s=i.next(yield W(r,s));while(!s.done)}(n[Symbol.iterator]()))),new r}var Uh=r=>Ve(Int8Array,r),Nh=r=>Ve(Int16Array,r),Lh=r=>Ve(Int32Array,r),Zo=r=>Ve(Uint8Array,r),kh=r=>Ve(Uint16Array,r),Ch=r=>Ve(Uint32Array,r),Ph=r=>Ve(Float32Array,r),Vh=r=>Ve(Float64Array,r),Hh=r=>Ve(Uint8ClampedArray,r);function Fe(r,t){return re(this,arguments,function*(){if(Se(t))return yield C(yield C(yield*Kr(bn(ve(Fe(r,yield C(t)))))));let n=function(o){return re(this,arguments,function*(){yield yield C(yield C(o))})},i=function(o){return re(this,arguments,function*(){yield C(yield*Kr(bn(ve(Jo(function*(a){let l=null;do l=a.next(yield l==null?void 0:l.value);while(!l.done)}(o[Symbol.iterator]()))))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof qo?n(t):Ie(t)?i(t):he(t)?t:n(t);return yield C(yield*Kr(bn(ve(Jo(function(o){return re(this,arguments,function*(){let a=null;do a=yield C(o.next(yield yield C(W(r,a))));while(!a.done)})}(s[Symbol.asyncIterator]())))))),yield C(new r)})}var zh=r=>Fe(Int8Array,r),jh=r=>Fe(Int16Array,r),Wh=r=>Fe(Int32Array,r),Qo=r=>Fe(Uint8Array,r),$h=r=>Fe(Uint16Array,r),Yh=r=>Fe(Uint32Array,r),Xh=r=>Fe(Float32Array,r),Gh=r=>Fe(Float64Array,r),Kh=r=>Fe(Uint8ClampedArray,r);function qn(r,t,e){if(r!==0){e=e.slice(0,t+1);for(let n=-1;++n<=t;)e[n]+=r}return e}function ta(r,t){let e=0,n=r.length;if(n!==t.length)return!1;if(n>0)do if(r[e]!==t[e])return!1;while(++e<n);return!0}var Ut={fromIterable(r){return ls(Jh(r))},fromAsyncIterable(r){return ls(qh(r))},fromDOMStream(r){return ls(Zh(r))},fromNodeStream(r){return ls(Qh(r))},toDOMStream(r,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(r,t){throw new Error('"toNodeStream" not available in this environment')}},ls=r=>(r.next(),r);function*Jh(r){let t,e=!1,n=[],i,s,o,a=0;function l(){return s==="peek"?ne(n,o)[0]:([i,n,a]=ne(n,o),i)}({cmd:s,size:o}=yield null);let f=Zo(r)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-a)?f.next():f.next(o-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield l());while(o<a);while(!t)}catch(m){(e=!0)&&typeof f.throw=="function"&&f.throw(m)}finally{e===!1&&typeof f.return=="function"&&f.return(null)}return null}function qh(r){return re(this,arguments,function*(){let e,n=!1,i=[],s,o,a,l=0;function f(){return o==="peek"?ne(i,a)[0]:([s,i,l]=ne(i,a),s)}({cmd:o,size:a}=yield yield C(null));let m=Qo(r)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(a-l)?yield C(m.next()):yield C(m.next(a-l)),!e&&s.byteLength>0&&(i.push(s),l+=s.byteLength),e||a<=l)do({cmd:o,size:a}=yield yield C(f()));while(a<l);while(!e)}catch(_){(n=!0)&&typeof m.throw=="function"&&(yield C(m.throw(_)))}finally{n===!1&&typeof m.return=="function"&&(yield C(m.return(new Uint8Array(0))))}return yield C(null)})}function Zh(r){return re(this,arguments,function*(){let e=!1,n=!1,i=[],s,o,a,l=0;function f(){return o==="peek"?ne(i,a)[0]:([s,i,l]=ne(i,a),s)}({cmd:o,size:a}=yield yield C(null));let m=new na(r);try{do if({done:e,value:s}=Number.isNaN(a-l)?yield C(m.read()):yield C(m.read(a-l)),!e&&s.byteLength>0&&(i.push(L(s)),l+=s.byteLength),e||a<=l)do({cmd:o,size:a}=yield yield C(f()));while(a<l);while(!e)}catch(_){(n=!0)&&(yield C(m.cancel(_)))}finally{n===!1?yield C(m.cancel()):r.locked&&m.releaseLock()}return yield C(null)})}var na=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return F(this,void 0,void 0,function*(){let{reader:e,source:n}=this;e&&(yield e.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return F(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let e=yield this.reader.read();return!e.done&&(e.value=L(e)),e})}},ra=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function Qh(r){return re(this,arguments,function*(){let e=[],n="error",i=!1,s=null,o,a,l=0,f=[],m;function _(){return o==="peek"?ne(f,a)[0]:([m,f,l]=ne(f,a),m)}if({cmd:o,size:a}=yield yield C(null),r.isTTY)return yield yield C(new Uint8Array(0)),yield C(null);try{e[0]=ra(r,"end"),e[1]=ra(r,"error");do{if(e[2]=ra(r,"readable"),[n,s]=yield C(Promise.race(e.map(B=>B[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-l)?(m=L(r.read(a-l)),m.byteLength<a-l&&(m=L(r.read()))):m=L(r.read()),m.byteLength>0&&(f.push(m),l+=m.byteLength)),i||a<=l)do({cmd:o,size:a}=yield yield C(_()));while(a<l)}while(!i)}finally{yield C(w(e,n==="error"?s:null))}return yield C(null);function w(B,q){return m=f=null,new Promise((vt,Bt)=>{for(let[Tt,Ht]of B)r.off(Tt,Ht);try{let Tt=r.destroy;Tt&&Tt.call(r,q),q=void 0}catch(Tt){q=Tt||q}finally{q!=null?Bt(q):vt()}})}})}var Ot;(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(Ot||(Ot={}));var yt;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(yt||(yt={}));var ht;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(ht||(ht={}));var Nt;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(Nt||(Nt={}));var X;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(X||(X={}));var Wt;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Wt||(Wt={}));var Q;(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(Q||(Q={}));var h;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth"})(h||(h={}));var pe;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(pe||(pe={}));var wa={};Gr(wa,{clampIndex:()=>jp,clampRange:()=>ei,createElementComparator:()=>Tr});function He(r){if(r===null)return"null";if(r===void 0)return"undefined";switch(typeof r){case"number":return"".concat(r);case"bigint":return"".concat(r);case"string":return'"'.concat(r,'"')}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?"[".concat([...r].map(t=>He(t)),"]"):"[".concat(r,"]"):ArrayBuffer.isView(r)?"[".concat(r,"]"):JSON.stringify(r,(t,e)=>typeof e=="bigint"?"".concat(e):e)}var sa={};Gr(sa,{BN:()=>Qn,bigNumToBigInt:()=>Hc,bigNumToString:()=>Sn,isArrowBigNumSymbol:()=>Pc});var Pc=Symbol.for("isArrowBigNum");function Be(r,...t){return t.length===0?Object.setPrototypeOf(W(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}Be.prototype[Pc]=!0;Be.prototype.toJSON=function(){return'"'.concat(Sn(this),'"')};Be.prototype.valueOf=function(){return Vc(this)};Be.prototype.toString=function(){return Sn(this)};Be.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Vc(this);case"string":return Sn(this);case"default":return Hc(this)}return Sn(this)};function wn(...r){return Be.apply(this,r)}function vn(...r){return Be.apply(this,r)}function Zn(...r){return Be.apply(this,r)}Object.setPrototypeOf(wn.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(vn.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Zn.prototype,Object.create(Uint32Array.prototype));Object.assign(wn.prototype,Be.prototype,{constructor:wn,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(vn.prototype,Be.prototype,{constructor:vn,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Zn.prototype,Be.prototype,{constructor:Zn,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function Vc(r){let{buffer:t,byteOffset:e,length:n,signed:i}=r,s=new BigUint64Array(t,e,n),o=i&&s.at(-1)&BigInt(1)<<BigInt(63),a=BigInt(o?1:0),l=BigInt(0);if(o){for(let f of s)a+=~f*(BigInt(1)<<BigInt(32)*l++);a*=BigInt(-1)}else for(let f of s)a+=f*(BigInt(1)<<BigInt(32)*l++);return a}var Sn=r=>{if(r.byteLength===8){let s=new r.BigIntArray(r.buffer,r.byteOffset,1);return"".concat(s[0])}if(!r.signed)return ia(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return ia(r);t=t.slice();let n=1;for(let s=0;s<t.length;s++){let o=t[s],a=~o+n;t[s]=a,n&=o===0?1:0}let i=ia(t);return"-".concat(i)},Hc=r=>r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:Sn(r);function ia(r){let t="",e=new Uint32Array(2),n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),s=-1,o=n.length-1;do{for(e[0]=n[s=0];s<o;)n[s++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+n[s];n[s]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t="".concat(e[0]).concat(t)}while(i[0]||i[1]||i[2]||i[3]);return t!=null?t:"0"}var Qn=class r{static new(t,e){switch(e){case!0:return new wn(t);case!1:return new vn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new wn(t)}return t.byteLength===16?new Zn(t):new vn(t)}static signed(t){return new wn(t)}static unsigned(t){return new vn(t)}static decimal(t){return new Zn(t)}constructor(t,e){return r.new(t,e)}};function Kt(r){if(typeof r=="bigint"&&(r<Number.MIN_SAFE_INTEGER||r>Number.MAX_SAFE_INTEGER))throw new TypeError("".concat(r," is not safe to convert to a number."));return Number(r)}var zc,jc,Wc,$c,Yc,Xc,Gc,Kc,Jc,qc,Zc,Qc,tl,el,rl,nl,il,sl,ol,D=class r{static isNull(t){return(t==null?void 0:t.typeId)===h.Null}static isInt(t){return(t==null?void 0:t.typeId)===h.Int}static isFloat(t){return(t==null?void 0:t.typeId)===h.Float}static isBinary(t){return(t==null?void 0:t.typeId)===h.Binary}static isUtf8(t){return(t==null?void 0:t.typeId)===h.Utf8}static isBool(t){return(t==null?void 0:t.typeId)===h.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===h.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===h.Date}static isTime(t){return(t==null?void 0:t.typeId)===h.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===h.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===h.Interval}static isList(t){return(t==null?void 0:t.typeId)===h.List}static isStruct(t){return(t==null?void 0:t.typeId)===h.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===h.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===h.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===h.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===h.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===h.Dictionary}static isDenseUnion(t){return r.isUnion(t)&&t.mode===yt.Dense}static isSparseUnion(t){return r.isUnion(t)&&t.mode===yt.Sparse}get typeId(){return h.NONE}};zc=Symbol.toStringTag;D[zc]=(r=>(r.children=null,r.ArrayType=Array,r[Symbol.toStringTag]="DataType"))(D.prototype);var $t=class extends D{toString(){return"Null"}get typeId(){return h.Null}};jc=Symbol.toStringTag;$t[jc]=(r=>r[Symbol.toStringTag]="Null")($t.prototype);var It=class extends D{constructor(t,e){super(),this.isSigned=t,this.bitWidth=e}get typeId(){return h.Int}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error("Unrecognized ".concat(this[Symbol.toStringTag]," type"))}toString(){return"".concat(this.isSigned?"I":"Ui","nt").concat(this.bitWidth)}};Wc=Symbol.toStringTag;It[Wc]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(It.prototype);var us=class extends It{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},ds=class extends It{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},ze=class extends It{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},fs=class extends It{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},hs=class extends It{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},ps=class extends It{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},ms=class extends It{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},ys=class extends It{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(us.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(ds.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(ze.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(fs.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(hs.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(ps.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ms.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(ys.prototype,"ArrayType",{value:BigUint64Array});var Jt=class extends D{constructor(t){super(),this.precision=t}get typeId(){return h.Float}get ArrayType(){switch(this.precision){case ht.HALF:return Uint16Array;case ht.SINGLE:return Float32Array;case ht.DOUBLE:return Float64Array}throw new Error("Unrecognized ".concat(this[Symbol.toStringTag]," type"))}toString(){return"Float".concat(this.precision<<5||16)}};$c=Symbol.toStringTag;Jt[$c]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(Jt.prototype);var _s=class extends Jt{constructor(){super(ht.HALF)}},bs=class extends Jt{constructor(){super(ht.SINGLE)}},gs=class extends Jt{constructor(){super(ht.DOUBLE)}};Object.defineProperty(_s.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(bs.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(gs.prototype,"ArrayType",{value:Float64Array});var nr=class extends D{constructor(){super()}get typeId(){return h.Binary}toString(){return"Binary"}};Yc=Symbol.toStringTag;nr[Yc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(nr.prototype);var ir=class extends D{constructor(){super()}get typeId(){return h.Utf8}toString(){return"Utf8"}};Xc=Symbol.toStringTag;ir[Xc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(ir.prototype);var sr=class extends D{constructor(){super()}get typeId(){return h.Bool}toString(){return"Bool"}};Gc=Symbol.toStringTag;sr[Gc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(sr.prototype);var or=class extends D{constructor(t,e,n=128){super(),this.scale=t,this.precision=e,this.bitWidth=n}get typeId(){return h.Decimal}toString(){return"Decimal[".concat(this.precision,"e").concat(this.scale>0?"+":"").concat(this.scale,"]")}};Kc=Symbol.toStringTag;or[Kc]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(or.prototype);var ar=class extends D{constructor(t){super(),this.unit=t}get typeId(){return h.Date}toString(){return"Date".concat((this.unit+1)*32,"<").concat(Nt[this.unit],">")}};Jc=Symbol.toStringTag;ar[Jc]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Date"))(ar.prototype);var Ae=class extends D{constructor(t,e){super(),this.unit=t,this.bitWidth=e}get typeId(){return h.Time}toString(){return"Time".concat(this.bitWidth,"<").concat(X[this.unit],">")}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error("Unrecognized ".concat(this[Symbol.toStringTag]," type"))}};qc=Symbol.toStringTag;Ae[qc]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(Ae.prototype);var cr=class extends D{constructor(t,e){super(),this.unit=t,this.timezone=e}get typeId(){return h.Timestamp}toString(){return"Timestamp<".concat(X[this.unit]).concat(this.timezone?", ".concat(this.timezone):"",">")}};Zc=Symbol.toStringTag;cr[Zc]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Timestamp"))(cr.prototype);var lr=class extends D{constructor(t){super(),this.unit=t}get typeId(){return h.Interval}toString(){return"Interval<".concat(Wt[this.unit],">")}};Qc=Symbol.toStringTag;lr[Qc]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(lr.prototype);var Te=class extends D{constructor(t){super(),this.children=[t]}get typeId(){return h.List}toString(){return"List<".concat(this.valueType,">")}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};tl=Symbol.toStringTag;Te[tl]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(Te.prototype);var lt=class extends D{constructor(t){super(),this.children=t}get typeId(){return h.Struct}toString(){return"Struct<{".concat(this.children.map(t=>"".concat(t.name,":").concat(t.type)).join(", "),"}>")}};el=Symbol.toStringTag;lt[el]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(lt.prototype);var xe=class extends D{constructor(t,e,n){super(),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}get typeId(){return h.Union}toString(){return"".concat(this[Symbol.toStringTag],"<").concat(this.children.map(t=>"".concat(t.type)).join(" | "),">")}};rl=Symbol.toStringTag;xe[rl]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(xe.prototype);var ur=class extends D{constructor(t){super(),this.byteWidth=t}get typeId(){return h.FixedSizeBinary}toString(){return"FixedSizeBinary[".concat(this.byteWidth,"]")}};nl=Symbol.toStringTag;ur[nl]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(ur.prototype);var De=class extends D{constructor(t,e){super(),this.listSize=t,this.children=[e]}get typeId(){return h.FixedSizeList}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">")}};il=Symbol.toStringTag;De[il]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(De.prototype);var Ee=class extends D{constructor(t,e=!1){super(),this.children=[t],this.keysSorted=e}get typeId(){return h.Map}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return"Map<{".concat(this.children[0].type.children.map(t=>"".concat(t.name,":").concat(t.type)).join(", "),"}>")}};sl=Symbol.toStringTag;Ee[sl]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(Ee.prototype);var tp=(r=>()=>++r)(-1),ie=class extends D{constructor(t,e,n,i){super(),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?tp():Kt(n)}get typeId(){return h.Dictionary}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return"Dictionary<".concat(this.indices,", ").concat(this.dictionary,">")}};ol=Symbol.toStringTag;ie[ol]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(ie.prototype);function se(r){let t=r;switch(r.typeId){case h.Decimal:return r.bitWidth/32;case h.Timestamp:return 2;case h.Date:return 1+t.unit;case h.Interval:return 1+t.unit;case h.FixedSizeList:return t.listSize;case h.FixedSizeBinary:return t.byteWidth;default:return 1}}var E=class{visitMany(t,...e){return t.map((n,i)=>this.visit(n,...e.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return ep(this,t,e)}getVisitFnByTypeId(t,e=!0){return In(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitBinary(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}};function ep(r,t,e=!0){return typeof t=="number"?In(r,t,e):typeof t=="string"&&t in h?In(r,h[t],e):t&&t instanceof D?In(r,al(t),e):t!=null&&t.type&&t.type instanceof D?In(r,al(t.type),e):In(r,h.NONE,e)}function In(r,t,e=!0){let n=null;switch(t){case h.Null:n=r.visitNull;break;case h.Bool:n=r.visitBool;break;case h.Int:n=r.visitInt;break;case h.Int8:n=r.visitInt8||r.visitInt;break;case h.Int16:n=r.visitInt16||r.visitInt;break;case h.Int32:n=r.visitInt32||r.visitInt;break;case h.Int64:n=r.visitInt64||r.visitInt;break;case h.Uint8:n=r.visitUint8||r.visitInt;break;case h.Uint16:n=r.visitUint16||r.visitInt;break;case h.Uint32:n=r.visitUint32||r.visitInt;break;case h.Uint64:n=r.visitUint64||r.visitInt;break;case h.Float:n=r.visitFloat;break;case h.Float16:n=r.visitFloat16||r.visitFloat;break;case h.Float32:n=r.visitFloat32||r.visitFloat;break;case h.Float64:n=r.visitFloat64||r.visitFloat;break;case h.Utf8:n=r.visitUtf8;break;case h.Binary:n=r.visitBinary;break;case h.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case h.Date:n=r.visitDate;break;case h.DateDay:n=r.visitDateDay||r.visitDate;break;case h.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case h.Timestamp:n=r.visitTimestamp;break;case h.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case h.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case h.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case h.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case h.Time:n=r.visitTime;break;case h.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case h.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case h.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case h.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case h.Decimal:n=r.visitDecimal;break;case h.List:n=r.visitList;break;case h.Struct:n=r.visitStruct;break;case h.Union:n=r.visitUnion;break;case h.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case h.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case h.Dictionary:n=r.visitDictionary;break;case h.Interval:n=r.visitInterval;break;case h.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case h.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case h.FixedSizeList:n=r.visitFixedSizeList;break;case h.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error("Unrecognized type '".concat(h[t],"'"))}function al(r){switch(r.typeId){case h.Null:return h.Null;case h.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?h.Int8:h.Uint8;case 16:return e?h.Int16:h.Uint16;case 32:return e?h.Int32:h.Uint32;case 64:return e?h.Int64:h.Uint64}return h.Int}case h.Float:switch(r.precision){case ht.HALF:return h.Float16;case ht.SINGLE:return h.Float32;case ht.DOUBLE:return h.Float64}return h.Float;case h.Binary:return h.Binary;case h.Utf8:return h.Utf8;case h.Bool:return h.Bool;case h.Decimal:return h.Decimal;case h.Time:switch(r.unit){case X.SECOND:return h.TimeSecond;case X.MILLISECOND:return h.TimeMillisecond;case X.MICROSECOND:return h.TimeMicrosecond;case X.NANOSECOND:return h.TimeNanosecond}return h.Time;case h.Timestamp:switch(r.unit){case X.SECOND:return h.TimestampSecond;case X.MILLISECOND:return h.TimestampMillisecond;case X.MICROSECOND:return h.TimestampMicrosecond;case X.NANOSECOND:return h.TimestampNanosecond}return h.Timestamp;case h.Date:switch(r.unit){case Nt.DAY:return h.DateDay;case Nt.MILLISECOND:return h.DateMillisecond}return h.Date;case h.Interval:switch(r.unit){case Wt.DAY_TIME:return h.IntervalDayTime;case Wt.YEAR_MONTH:return h.IntervalYearMonth}return h.Interval;case h.Map:return h.Map;case h.List:return h.List;case h.Struct:return h.Struct;case h.Union:switch(r.mode){case yt.Dense:return h.DenseUnion;case yt.Sparse:return h.SparseUnion}return h.Union;case h.FixedSizeBinary:return h.FixedSizeBinary;case h.FixedSizeList:return h.FixedSizeList;case h.Dictionary:return h.Dictionary}throw new Error("Unrecognized type '".concat(h[r.typeId],"'"))}E.prototype.visitInt8=null;E.prototype.visitInt16=null;E.prototype.visitInt32=null;E.prototype.visitInt64=null;E.prototype.visitUint8=null;E.prototype.visitUint16=null;E.prototype.visitUint32=null;E.prototype.visitUint64=null;E.prototype.visitFloat16=null;E.prototype.visitFloat32=null;E.prototype.visitFloat64=null;E.prototype.visitDateDay=null;E.prototype.visitDateMillisecond=null;E.prototype.visitTimestampSecond=null;E.prototype.visitTimestampMillisecond=null;E.prototype.visitTimestampMicrosecond=null;E.prototype.visitTimestampNanosecond=null;E.prototype.visitTimeSecond=null;E.prototype.visitTimeMillisecond=null;E.prototype.visitTimeMicrosecond=null;E.prototype.visitTimeNanosecond=null;E.prototype.visitDenseUnion=null;E.prototype.visitSparseUnion=null;E.prototype.visitIntervalDayTime=null;E.prototype.visitIntervalYearMonth=null;var oa={};Gr(oa,{float64ToUint16:()=>ti,uint16ToFloat64:()=>ws});var cl=new Float64Array(1),Fn=new Uint32Array(cl.buffer);function ws(r){let t=(r&31744)>>10,e=(r&1023)/1024,n=Math.pow(-1,(r&32768)>>15);switch(t){case 31:return n*(e?Number.NaN:1/0);case 0:return n*(e?6103515625e-14*e:0)}return n*Math.pow(2,t-15)*(1+e)}function ti(r){if(r!==r)return 32256;cl[0]=r;let t=(Fn[1]&2147483648)>>16&65535,e=Fn[1]&2146435072,n=0;return e>=1089470464?Fn[0]>0?e=31744:(e=(e&2080374784)>>16,n=(Fn[1]&1048575)>>10):e<=1056964608?(n=1048576+(Fn[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(Fn[1]&1048575)+512>>10),t|e|n&65535}var k=class extends E{};function j(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var rp=(r,t,e)=>{r[t]=Math.trunc(e/864e5)},aa=(r,t,e)=>{r[t]=Math.trunc(e%4294967296),r[t+1]=Math.trunc(e/4294967296)},np=(r,t,e)=>{r[t]=Math.trunc(e*1e3%4294967296),r[t+1]=Math.trunc(e*1e3/4294967296)},ip=(r,t,e)=>{r[t]=Math.trunc(e*1e6%4294967296),r[t+1]=Math.trunc(e*1e6/4294967296)},ll=(r,t,e,n)=>{if(e+1<t.length){let{[e]:i,[e+1]:s}=t;r.set(n.subarray(0,s-i),i)}},sp=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},dr=({values:r},t,e)=>{r[t]=e},ca=({values:r},t,e)=>{r[t]=e},ul=({values:r},t,e)=>{r[t]=ti(e)},op=(r,t,e)=>{switch(r.type.precision){case ht.HALF:return ul(r,t,e);case ht.SINGLE:case ht.DOUBLE:return ca(r,t,e)}},vs=({values:r},t,e)=>{rp(r,t,e.valueOf())},Ss=({values:r},t,e)=>{aa(r,t*2,e.valueOf())},la=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},ap=({values:r,valueOffsets:t},e,n)=>ll(r,t,e,n),cp=({values:r,valueOffsets:t},e,n)=>{ll(r,t,e,Fr(n))},ua=(r,t,e)=>{r.type.unit===Nt.DAY?vs(r,t,e):Ss(r,t,e)},Is=({values:r},t,e)=>aa(r,t*2,e/1e3),Fs=({values:r},t,e)=>aa(r,t*2,e),Bs=({values:r},t,e)=>np(r,t*2,e),As=({values:r},t,e)=>ip(r,t*2,e),da=(r,t,e)=>{switch(r.type.unit){case X.SECOND:return Is(r,t,e);case X.MILLISECOND:return Fs(r,t,e);case X.MICROSECOND:return Bs(r,t,e);case X.NANOSECOND:return As(r,t,e)}},Ts=({values:r},t,e)=>{r[t]=e},xs=({values:r},t,e)=>{r[t]=e},Ds=({values:r},t,e)=>{r[t]=e},Es=({values:r},t,e)=>{r[t]=e},fa=(r,t,e)=>{switch(r.type.unit){case X.SECOND:return Ts(r,t,e);case X.MILLISECOND:return xs(r,t,e);case X.MICROSECOND:return Ds(r,t,e);case X.NANOSECOND:return Es(r,t,e)}},ha=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},lp=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,s=Lt.getVisitFn(n);if(Array.isArray(e))for(let o=-1,a=i[t],l=i[t+1];a<l;)s(n,a++,e[++o]);else for(let o=-1,a=i[t],l=i[t+1];a<l;)s(n,a++,e.get(++o))},up=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,s=Lt.getVisitFn(n),{[t]:o,[t+1]:a}=i,l=e instanceof Map?e.entries():Object.entries(e);for(let f of l)if(s(n,o,f),++o>=a)break},dp=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),fp=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),hp=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),pp=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),mp=(r,t,e)=>{let n=r.type.children.map(s=>Lt.getVisitFn(s.type)),i=e instanceof Map?hp(t,e):e instanceof G?fp(t,e):Array.isArray(e)?dp(t,e):pp(t,e);r.type.children.forEach((s,o)=>i(n[o],r.children[o],s,o))},yp=(r,t,e)=>{r.type.mode===yt.Dense?dl(r,t,e):fl(r,t,e)},dl=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Lt.visit(i,r.valueOffsets[t],e)},fl=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Lt.visit(i,t,e)},_p=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},pa=(r,t,e)=>{r.type.unit===Wt.DAY_TIME?Os(r,t,e):Rs(r,t,e)},Os=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},Rs=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},bp=(r,t,e)=>{let{stride:n}=r,i=r.children[0],s=Lt.getVisitFn(i);if(Array.isArray(e))for(let o=-1,a=t*n;++o<n;)s(i,a+o,e[o]);else for(let o=-1,a=t*n;++o<n;)s(i,a+o,e.get(o))};k.prototype.visitBool=j(sp);k.prototype.visitInt=j(dr);k.prototype.visitInt8=j(dr);k.prototype.visitInt16=j(dr);k.prototype.visitInt32=j(dr);k.prototype.visitInt64=j(dr);k.prototype.visitUint8=j(dr);k.prototype.visitUint16=j(dr);k.prototype.visitUint32=j(dr);k.prototype.visitUint64=j(dr);k.prototype.visitFloat=j(op);k.prototype.visitFloat16=j(ul);k.prototype.visitFloat32=j(ca);k.prototype.visitFloat64=j(ca);k.prototype.visitUtf8=j(cp);k.prototype.visitBinary=j(ap);k.prototype.visitFixedSizeBinary=j(la);k.prototype.visitDate=j(ua);k.prototype.visitDateDay=j(vs);k.prototype.visitDateMillisecond=j(Ss);k.prototype.visitTimestamp=j(da);k.prototype.visitTimestampSecond=j(Is);k.prototype.visitTimestampMillisecond=j(Fs);k.prototype.visitTimestampMicrosecond=j(Bs);k.prototype.visitTimestampNanosecond=j(As);k.prototype.visitTime=j(fa);k.prototype.visitTimeSecond=j(Ts);k.prototype.visitTimeMillisecond=j(xs);k.prototype.visitTimeMicrosecond=j(Ds);k.prototype.visitTimeNanosecond=j(Es);k.prototype.visitDecimal=j(ha);k.prototype.visitList=j(lp);k.prototype.visitStruct=j(mp);k.prototype.visitUnion=j(yp);k.prototype.visitDenseUnion=j(dl);k.prototype.visitSparseUnion=j(fl);k.prototype.visitDictionary=j(_p);k.prototype.visitInterval=j(pa);k.prototype.visitIntervalDayTime=j(Os);k.prototype.visitIntervalYearMonth=j(Rs);k.prototype.visitFixedSizeList=j(bp);k.prototype.visitMap=j(up);var Lt=new k;var Oe=Symbol.for("parent"),Bn=Symbol.for("rowIndex"),Br=class{constructor(t,e){return this[Oe]=t,this[Bn]=e,new Proxy(this,new ya)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Bn],e=this[Oe],n=e.type.children,i={};for(let s=-1,o=n.length;++s<o;)i[n[s].name]=At.visit(e.children[s],t);return i}toString(){return"{".concat([...this].map(([t,e])=>"".concat(He(t),": ").concat(He(e))).join(", "),"}")}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new ma(this[Oe],this[Bn])}},ma=class{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,At.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Br.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Oe]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Bn]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var ya=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Oe].type.children.map(e=>e.name)}has(t,e){return t[Oe].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[Oe].type.children.findIndex(n=>n.name===e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[Oe].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=At.visit(t[Oe].children[n],t[Bn]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[Oe].type.children.findIndex(s=>s.name===e);return i!==-1?(Lt.visit(t[Oe].children[i],t[Bn],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}};var R=class extends E{};function V(r){return(t,e)=>t.getValid(e)?r(t,e):null}var gp=(r,t)=>864e5*r[t],_a=(r,t)=>4294967296*r[t+1]+(r[t]>>>0),wp=(r,t)=>4294967296*(r[t+1]/1e3)+(r[t]>>>0)/1e3,vp=(r,t)=>4294967296*(r[t+1]/1e6)+(r[t]>>>0)/1e6,hl=r=>new Date(r),Sp=(r,t)=>hl(gp(r,t)),Ip=(r,t)=>hl(_a(r,t)),Fp=(r,t)=>null,pl=(r,t,e)=>{if(e+1>=t.length)return null;let n=t[e],i=t[e+1];return r.subarray(n,i)},Bp=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},ml=({values:r},t)=>Sp(r,t),yl=({values:r},t)=>Ip(r,t*2),Ar=({stride:r,values:t},e)=>t[r*e],Ap=({stride:r,values:t},e)=>ws(t[r*e]),_l=({values:r},t)=>r[t],Tp=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),xp=({values:r,valueOffsets:t},e)=>pl(r,t,e),Dp=({values:r,valueOffsets:t},e)=>{let n=pl(r,t,e);return n!==null?Kn(n):null},Ep=({values:r},t)=>r[t],Op=({type:r,values:t},e)=>r.precision!==ht.HALF?t[e]:ws(t[e]),Rp=(r,t)=>r.type.unit===Nt.DAY?ml(r,t):yl(r,t),bl=({values:r},t)=>1e3*_a(r,t*2),gl=({values:r},t)=>_a(r,t*2),wl=({values:r},t)=>wp(r,t*2),vl=({values:r},t)=>vp(r,t*2),Mp=(r,t)=>{switch(r.type.unit){case X.SECOND:return bl(r,t);case X.MILLISECOND:return gl(r,t);case X.MICROSECOND:return wl(r,t);case X.NANOSECOND:return vl(r,t)}},Sl=({values:r},t)=>r[t],Il=({values:r},t)=>r[t],Fl=({values:r},t)=>r[t],Bl=({values:r},t)=>r[t],Up=(r,t)=>{switch(r.type.unit){case X.SECOND:return Sl(r,t);case X.MILLISECOND:return Il(r,t);case X.MICROSECOND:return Fl(r,t);case X.NANOSECOND:return Bl(r,t)}},Np=({values:r,stride:t},e)=>Qn.decimal(r.subarray(t*e,t*(e+1))),Lp=(r,t)=>{let{valueOffsets:e,stride:n,children:i}=r,{[t*n]:s,[t*n+1]:o}=e,l=i[0].slice(s,o-s);return new G([l])},kp=(r,t)=>{let{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:s}=e,o=n[0];return new je(o.slice(i,s-i))},Cp=(r,t)=>new Br(r,t),Pp=(r,t)=>r.type.mode===yt.Dense?Al(r,t):Tl(r,t),Al=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return At.visit(n,r.valueOffsets[t])},Tl=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return At.visit(n,t)},Vp=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},Hp=(r,t)=>r.type.unit===Wt.DAY_TIME?xl(r,t):Dl(r,t),xl=({values:r},t)=>r.subarray(2*t,2*(t+1)),Dl=({values:r},t)=>{let e=r[t],n=new Int32Array(2);return n[0]=Math.trunc(e/12),n[1]=Math.trunc(e%12),n},zp=(r,t)=>{let{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new G([s])};R.prototype.visitNull=V(Fp);R.prototype.visitBool=V(Bp);R.prototype.visitInt=V(Ep);R.prototype.visitInt8=V(Ar);R.prototype.visitInt16=V(Ar);R.prototype.visitInt32=V(Ar);R.prototype.visitInt64=V(_l);R.prototype.visitUint8=V(Ar);R.prototype.visitUint16=V(Ar);R.prototype.visitUint32=V(Ar);R.prototype.visitUint64=V(_l);R.prototype.visitFloat=V(Op);R.prototype.visitFloat16=V(Ap);R.prototype.visitFloat32=V(Ar);R.prototype.visitFloat64=V(Ar);R.prototype.visitUtf8=V(Dp);R.prototype.visitBinary=V(xp);R.prototype.visitFixedSizeBinary=V(Tp);R.prototype.visitDate=V(Rp);R.prototype.visitDateDay=V(ml);R.prototype.visitDateMillisecond=V(yl);R.prototype.visitTimestamp=V(Mp);R.prototype.visitTimestampSecond=V(bl);R.prototype.visitTimestampMillisecond=V(gl);R.prototype.visitTimestampMicrosecond=V(wl);R.prototype.visitTimestampNanosecond=V(vl);R.prototype.visitTime=V(Up);R.prototype.visitTimeSecond=V(Sl);R.prototype.visitTimeMillisecond=V(Il);R.prototype.visitTimeMicrosecond=V(Fl);R.prototype.visitTimeNanosecond=V(Bl);R.prototype.visitDecimal=V(Np);R.prototype.visitList=V(Lp);R.prototype.visitStruct=V(Cp);R.prototype.visitUnion=V(Pp);R.prototype.visitDenseUnion=V(Al);R.prototype.visitSparseUnion=V(Tl);R.prototype.visitDictionary=V(Vp);R.prototype.visitInterval=V(Hp);R.prototype.visitIntervalDayTime=V(xl);R.prototype.visitIntervalYearMonth=V(Dl);R.prototype.visitFixedSizeList=V(zp);R.prototype.visitMap=V(kp);var At=new R;var me=Symbol.for("keys"),An=Symbol.for("vals"),je=class{constructor(t){return this[me]=new G([t.children[0]]).memoize(),this[An]=t.children[1],new Proxy(this,new ga)}[Symbol.iterator](){return new ba(this[me],this[An])}get size(){return this[me].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[me],e=this[An],n={};for(let i=-1,s=t.length;++i<s;)n[t.get(i)]=At.visit(e,i);return n}toString(){return"{".concat([...this].map(([t,e])=>"".concat(He(t),": ").concat(He(e))).join(", "),"}")}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},ba=class{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),At.visit(this.vals,t)]})}},ga=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[me].toArray().map(String)}has(t,e){return t[me].includes(e)}getOwnPropertyDescriptor(t,e){if(t[me].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[me].indexOf(e);if(n!==-1){let i=At.visit(Reflect.get(t,An),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[me].indexOf(e);return i!==-1?(Lt.visit(Reflect.get(t,An),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(je.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[me]:{writable:!0,enumerable:!1,configurable:!1,value:null},[An]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function jp(r,t,e){let n=r.length,i=t>-1?t:n+t%n;return e?e(r,i):i}var El;function ei(r,t,e,n){let{length:i=0}=r,s=typeof t!="number"?0:t,o=typeof e!="number"?i:e;return s<0&&(s=(s%i+i)%i),o<0&&(o=(o%i+i)%i),o<s&&(El=s,s=o,o=El),o>i&&(o=i),n?n(r,s,o):[s,o]}var Ol=r=>r!==r;function Tr(r){if(typeof r!=="object"||r===null)return Ol(r)?Ol:e=>e===r;if(r instanceof Date){let e=r.valueOf();return n=>n instanceof Date?n.valueOf()===e:!1}return ArrayBuffer.isView(r)?e=>e?ta(r,e):!1:r instanceof Map?$p(r):Array.isArray(r)?Wp(r):r instanceof G?Yp(r):Xp(r,!0)}function Wp(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Tr(r[e]);return Ms(t)}function $p(r){let t=-1,e=[];for(let n of r.values())e[++t]=Tr(n);return Ms(e)}function Yp(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Tr(r.get(e));return Ms(t)}function Xp(r,t=!1){let e=Object.keys(r);if(!t&&e.length===0)return()=>!1;let n=[];for(let i=-1,s=e.length;++i<s;)n[i]=Tr(r[e[i]]);return Ms(n,e)}function Ms(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return Gp(r,e);case Map:return Rl(r,e,e.keys());case je:case Br:case Object:case void 0:return Rl(r,e,t||Object.keys(e))}return e instanceof G?Kp(r,e):!1}}function Gp(r,t){let e=r.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!r[n](t[n]))return!1;return!0}function Kp(r,t){let e=r.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!r[n](t.get(n)))return!1;return!0}function Rl(r,t,e){let n=e[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),s=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,a=r.length,l=s.next(),f=n.next(),m=i.next();for(;o<a&&!f.done&&!m.done&&!l.done&&!(f.value!==m.value||!r[o](l.value));++o,f=n.next(),m=i.next(),l=s.next());return o===a&&f.done&&m.done&&l.done?!0:(n.return&&n.return(),i.return&&i.return(),s.return&&s.return(),!1)}var va={};Gr(va,{BitIterator:()=>qr,getBit:()=>Ml,getBool:()=>Ns,packBools:()=>Zr,popcnt_array:()=>Ul,popcnt_bit_range:()=>ri,popcnt_uint32:()=>Us,setBool:()=>Jp,truncateBitmap:()=>Tn});function Ns(r,t,e,n){return(e&1<<n)!==0}function Ml(r,t,e,n){return(e&1<<n)>>n}function Jp(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function Tn(r,t,e){let n=e.byteLength+7&-8;if(r>0||e.byteLength<n){let i=new Uint8Array(n);return i.set(r%8===0?e.subarray(r>>3):Zr(new qr(e,r,t,null,Ns)).subarray(0,n)),i}return e}function Zr(r){let t=[],e=0,n=0,i=0;for(let o of r)o&&(i|=1<<n),++n===8&&(t[e++]=i,i=n=0);(e===0||n>0)&&(t[e++]=i);let s=new Uint8Array(t.length+7&-8);return s.set(t),s}var qr=class{constructor(t,e,n,i,s){this.bytes=t,this.length=n,this.context=i,this.get=s,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function ri(r,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(let o of new qr(r,t,e-t,r,Ml))s+=o;return s}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return ri(r,t,i)+ri(r,n,e)+Ul(r,i>>3,n-i>>3)}function Ul(r,t,e){let n=0,i=Math.trunc(t),s=new DataView(r.buffer,r.byteOffset,r.byteLength),o=e===void 0?r.byteLength:i+e;for(;o-i>=4;)n+=Us(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=Us(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=Us(s.getUint8(i)),i+=1;return n}function Us(r){let t=Math.trunc(r);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var qp=-1,ot=class r{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get byteLength(){let t=0,{valueOffsets:e,values:n,nullBitmap:i,typeIds:s}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){let t=this._nullCount,e;return t<=qp&&(e=this.nullBitmap)&&(this._nullCount=t=this.length-ri(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,i,s,o=[],a){this.type=t,this.children=o,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let l;s instanceof r?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=se(t),s&&((l=s[0])&&(this.valueOffsets=l),(l=s[1])&&(this.values=l),(l=s[2])&&(this.nullBitmap=l),(l=s[3])&&(this.typeIds=l))),this.nullable=this._nullCount!==0&&this.nullBitmap&&this.nullBitmap.byteLength>0}getValid(t){if(this.nullable&&this.nullCount>0){let e=this.offset+t;return(this.nullBitmap[e>>3]&1<<e%8)!==0}return!0}setValid(t,e){if(!this.nullable)return e;if(!this.nullBitmap||this.nullBitmap.byteLength<=t>>3){let{nullBitmap:l}=this._changeLengthAndBackfillNullBitmap(this.length);Object.assign(this,{nullBitmap:l,_nullCount:0})}let{nullBitmap:n,offset:i}=this,s=i+t>>3,o=(i+t)%8,a=n[s]>>o&1;return e?a===0&&(n[s]|=1<<o,this._nullCount=this.nullCount+1):a===1&&(n[s]&=~(1<<o),this._nullCount=this.nullCount-1),e}clone(t=this.type,e=this.offset,n=this.length,i=this._nullCount,s=this,o=this.children){return new r(t,e,n,i,s,o,this.dictionary)}slice(t,e){let{stride:n,typeId:i,children:s}=this,o=+(this._nullCount===0)-1,a=i===16?n:1,l=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,o,l,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===h.Null)return this.clone(this.type,0,t,0);let{length:e,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);i[e>>3]=(1<<e-(e&-8))-1,n>0&&i.set(Tn(this.offset,e,this.nullBitmap),0);let s=this.buffers;return s[pe.VALIDITY]=i,this.clone(this.type,0,t,n+(t-e),s)}_sliceBuffers(t,e,n,i){let s,{buffers:o}=this;return(s=o[pe.TYPE])&&(o[pe.TYPE]=s.subarray(t,t+e)),(s=o[pe.OFFSET])&&(o[pe.OFFSET]=s.subarray(t,t+e+1))||(s=o[pe.DATA])&&(o[pe.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};ot.prototype.children=Object.freeze([]);var Sa=class r extends E{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:n=0,["length"]:i=0}=t;return new ot(e,n,i,0)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,s,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,s,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,s,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.data),s=L(t.nullBitmap),o=Jr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new ot(e,n,a,l,[o,i,s])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.data),s=L(t.nullBitmap),o=Jr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new ot(e,n,a,l,[o,i,s])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,s,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,s,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,s,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,s,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,s,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,s=L(t.nullBitmap),o=Jr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new ot(e,n,a,l,[o,void 0,s],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=L(t.nullBitmap),{length:o=i.reduce((l,{length:f})=>Math.max(l,f),0),nullCount:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,void 0,s],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=L(t.nullBitmap),o=W(e.ArrayType,t.typeIds),{["length"]:a=o.length,["nullCount"]:l=t.nullBitmap?-1:0}=t;if(D.isSparseUnion(e))return new ot(e,n,a,l,[void 0,void 0,s,o],i);let f=Jr(t.valueOffsets);return new ot(e,n,a,l,[f,void 0,s,o],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.nullBitmap),s=W(e.indices.ArrayType,t.data),{["dictionary"]:o=new G([new r().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new ot(e,n,a,l,[void 0,s,i],[],o)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=L(t.nullBitmap),s=W(e.ArrayType,t.data),{["length"]:o=s.length/se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,s,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new r().visit({type:e.valueType})}=t,s=L(t.nullBitmap),{["length"]:o=i.length/se(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ot(e,n,o,a,[void 0,void 0,s],[i])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new r().visit({type:e.childType})}=t,s=L(t.nullBitmap),o=Jr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new ot(e,n,a,l,[o,void 0,s],[i])}};function P(r){return new Sa().visit(r)}var ni=class{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function Ls(r){return r.reduce((t,e)=>t+e.nullCount,0)}function ks(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function Cs(r,t,e,n){let i=[];for(let s=-1,o=r.length;++s<o;){let a=r[s],l=t[s],{length:f}=a;if(l>=n)break;if(e>=l+f)continue;if(l>=e&&l+f<=n){i.push(a);continue}let m=Math.max(0,e-l),_=Math.min(n-l,f);i.push(a.slice(m,_-m))}return i.length===0&&i.push(r[0].slice(0,0)),i}function Ia(r,t,e,n){let i=0,s=0,o=t.length-1;do{if(i>=o-1)return e<t[o]?n(r,i,e-t[i]):null;s=i+Math.trunc((o-i)*.5),e<t[s]?o=s:i=s}while(i<o)}function ii(r,t){return r.getValid(t)}function xr(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return Ia(n,this._offsets,e,t)}}function Ps(r){let t;function e(n,i,s){return r(n[i],s,t)}return function(n,i){let s=this.data;t=i;let o=Ia(s,this._offsets,n,e);return t=void 0,o}}function Vs(r){let t;function e(n,i,s){let o=s,a=0,l=0;for(let f=i-1,m=n.length;++f<m;){let _=n[f];if(~(a=r(_,t,o)))return l+a;o=0,l+=_.length}return-1}return function(n,i){t=n;let s=this.data,o=typeof i!="number"?e(s,0,0):Ia(s,this._offsets,i,e);return t=void 0,o}}var M=class extends E{};function Zp(r,t){return t===null&&r.length>0?0:-1}function Qp(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new qr(e,r.offset+(t||0),r.length,e,Ns)){if(!i)return n;++n}return-1}function $(r,t,e){if(t===void 0)return-1;if(t===null)return Qp(r,e);let n=At.getVisitFn(r),i=Tr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}function Nl(r,t,e){let n=At.getVisitFn(r),i=Tr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}M.prototype.visitNull=Zp;M.prototype.visitBool=$;M.prototype.visitInt=$;M.prototype.visitInt8=$;M.prototype.visitInt16=$;M.prototype.visitInt32=$;M.prototype.visitInt64=$;M.prototype.visitUint8=$;M.prototype.visitUint16=$;M.prototype.visitUint32=$;M.prototype.visitUint64=$;M.prototype.visitFloat=$;M.prototype.visitFloat16=$;M.prototype.visitFloat32=$;M.prototype.visitFloat64=$;M.prototype.visitUtf8=$;M.prototype.visitBinary=$;M.prototype.visitFixedSizeBinary=$;M.prototype.visitDate=$;M.prototype.visitDateDay=$;M.prototype.visitDateMillisecond=$;M.prototype.visitTimestamp=$;M.prototype.visitTimestampSecond=$;M.prototype.visitTimestampMillisecond=$;M.prototype.visitTimestampMicrosecond=$;M.prototype.visitTimestampNanosecond=$;M.prototype.visitTime=$;M.prototype.visitTimeSecond=$;M.prototype.visitTimeMillisecond=$;M.prototype.visitTimeMicrosecond=$;M.prototype.visitTimeNanosecond=$;M.prototype.visitDecimal=$;M.prototype.visitList=$;M.prototype.visitStruct=$;M.prototype.visitUnion=$;M.prototype.visitDenseUnion=Nl;M.prototype.visitSparseUnion=Nl;M.prototype.visitDictionary=$;M.prototype.visitInterval=$;M.prototype.visitIntervalDayTime=$;M.prototype.visitIntervalYearMonth=$;M.prototype.visitFixedSizeList=$;M.prototype.visitMap=$;var Qr=new M;var U=class extends E{};function H(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(t.typeId===h.Timestamp||t instanceof It&&t.bitWidth!==64||t instanceof Ae&&t.bitWidth!==64||t instanceof Jt&&t.precision!==ht.HALF))return new ni(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new ni(r.data.length,n=>{let s=r.data[n].length,o=r.slice(e,e+s);return e+=s,new Fa(o)})}var Fa=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};U.prototype.visitNull=H;U.prototype.visitBool=H;U.prototype.visitInt=H;U.prototype.visitInt8=H;U.prototype.visitInt16=H;U.prototype.visitInt32=H;U.prototype.visitInt64=H;U.prototype.visitUint8=H;U.prototype.visitUint16=H;U.prototype.visitUint32=H;U.prototype.visitUint64=H;U.prototype.visitFloat=H;U.prototype.visitFloat16=H;U.prototype.visitFloat32=H;U.prototype.visitFloat64=H;U.prototype.visitUtf8=H;U.prototype.visitBinary=H;U.prototype.visitFixedSizeBinary=H;U.prototype.visitDate=H;U.prototype.visitDateDay=H;U.prototype.visitDateMillisecond=H;U.prototype.visitTimestamp=H;U.prototype.visitTimestampSecond=H;U.prototype.visitTimestampMillisecond=H;U.prototype.visitTimestampMicrosecond=H;U.prototype.visitTimestampNanosecond=H;U.prototype.visitTime=H;U.prototype.visitTimeSecond=H;U.prototype.visitTimeMillisecond=H;U.prototype.visitTimeMicrosecond=H;U.prototype.visitTimeNanosecond=H;U.prototype.visitDecimal=H;U.prototype.visitList=H;U.prototype.visitStruct=H;U.prototype.visitUnion=H;U.prototype.visitDenseUnion=H;U.prototype.visitSparseUnion=H;U.prototype.visitDictionary=H;U.prototype.visitInterval=H;U.prototype.visitIntervalDayTime=H;U.prototype.visitIntervalYearMonth=H;U.prototype.visitFixedSizeList=H;U.prototype.visitMap=H;var xn=new U;var tm=(r,t)=>r+t,We=class extends E{visitNull(t,e){return 0}visitInt(t,e){return t.type.bitWidth/8}visitFloat(t,e){return t.type.ArrayType.BYTES_PER_ELEMENT}visitBool(t,e){return 1/8}visitDecimal(t,e){return t.type.bitWidth/8}visitDate(t,e){return(t.type.unit+1)*4}visitTime(t,e){return t.type.bitWidth/8}visitTimestamp(t,e){return t.type.unit===X.SECOND?4:8}visitInterval(t,e){return(t.type.unit+1)*4}visitStruct(t,e){return t.children.reduce((n,i)=>n+oe.visit(i,e),0)}visitFixedSizeBinary(t,e){return t.type.byteWidth}visitMap(t,e){return 8+t.children.reduce((n,i)=>n+oe.visit(i,e),0)}visitDictionary(t,e){var n;return t.type.indices.bitWidth/8+(((n=t.dictionary)===null||n===void 0?void 0:n.getByteLength(t.values[e]))||0)}},em=({valueOffsets:r},t)=>8+(r[t+1]-r[t]),rm=({valueOffsets:r},t)=>8+(r[t+1]-r[t]),nm=({valueOffsets:r,stride:t,children:e},n)=>{let i=e[0],{[n*t]:s}=r,{[n*t+1]:o}=r,a=oe.getVisitFn(i.type),l=i.slice(s,o-s),f=8;for(let m=-1,_=o-s;++m<_;)f+=a(l,m);return f},im=({stride:r,children:t},e)=>{let n=t[0],i=n.slice(e*r,r),s=oe.getVisitFn(n.type),o=0;for(let a=-1,l=i.length;++a<l;)o+=s(i,a);return o},sm=(r,t)=>r.type.mode===yt.Dense?Ll(r,t):kl(r,t),Ll=({type:r,children:t,typeIds:e,valueOffsets:n},i)=>{let s=r.typeIdToChildIndex[e[i]];return 8+oe.visit(t[s],n[i])},kl=({children:r},t)=>4+oe.visitMany(r,r.map(()=>t)).reduce(tm,0);We.prototype.visitUtf8=em;We.prototype.visitBinary=rm;We.prototype.visitList=nm;We.prototype.visitFixedSizeList=im;We.prototype.visitUnion=sm;We.prototype.visitDenseUnion=Ll;We.prototype.visitSparseUnion=kl;var oe=new We;var Cl,Pl={},Vl={},G=class r{constructor(t){var e,n,i;let s=t[0]instanceof r?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof ot)))throw new TypeError("Vector constructor expects an Array of Data instances.");let o=(e=s[0])===null||e===void 0?void 0:e.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:l,indexOf:f,byteLength:m}=Pl[o.typeId],_=s[0];this.isValid=w=>ii(_,w),this.get=w=>a(_,w),this.set=(w,B)=>l(_,w,B),this.indexOf=w=>f(_,w),this.getByteLength=w=>m(_,w),this._offsets=[0,_.length];break}default:Object.setPrototypeOf(this,Vl[o.typeId]),this._offsets=ks(s);break}this.data=s,this.type=o,this.stride=se(o),this.numChildren=(i=(n=o.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this._byteLength===-1&&(this._byteLength=this.data.reduce((t,e)=>t+e.byteLength,0)),this._byteLength}get nullCount(){return this._nullCount===-1&&(this._nullCount=Ls(this.data)),this._nullCount}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return"".concat(this.VectorName,"<").concat(this.type[Symbol.toStringTag],">")}get VectorName(){return"".concat(h[this.type.typeId],"Vector")}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>0}getByteLength(t){return 0}[Symbol.iterator](){return xn.visit(this)}concat(...t){return new r(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new r(ei(this,t,e,({data:n,_offsets:i},s,o)=>Cs(n,i,s,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:i,ArrayType:s}=this;switch(t.typeId){case h.Int:case h.Float:case h.Decimal:case h.Time:case h.Timestamp:switch(e.length){case 0:return new s;case 1:return e[0].values.subarray(0,n*i);default:return e.reduce((o,{values:a,length:l})=>(o.array.set(a.subarray(0,l*i),o.offset),o.offset+=l*i,o),{array:new s(n*i),offset:0}).array}}return[...this]}toString(){return"[".concat([...this].join(","),"]")}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new r(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return D.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(D.isDictionary(this.type)){let t=new Hs(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new r(e)}return new Hs(this)}unmemoize(){if(D.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new r(e)}return this}};Cl=Symbol.toStringTag;G[Cl]=(r=>{r.type=D.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._nullCount=-1,r._byteLength=-1,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;let t=Object.keys(h).map(e=>h[e]).filter(e=>typeof e=="number"&&e!==h.NONE);for(let e of t){let n=At.getVisitFnByTypeId(e),i=Lt.getVisitFnByTypeId(e),s=Qr.getVisitFnByTypeId(e),o=oe.getVisitFnByTypeId(e);Pl[e]={get:n,set:i,indexOf:s,byteLength:o},Vl[e]=Object.create(r,{isValid:{value:xr(ii)},get:{value:xr(At.getVisitFnByTypeId(e))},set:{value:Ps(Lt.getVisitFnByTypeId(e))},indexOf:{value:Vs(Qr.getVisitFnByTypeId(e))},getByteLength:{value:xr(oe.getVisitFnByTypeId(e))}})}return"Vector"})(G.prototype);var Hs=class r extends G{constructor(t){super(t.data);let e=this.get,n=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){let a=s[o];if(a!==void 0)return a;let l=e.call(this,o);return s[o]=l,l}}),Object.defineProperty(this,"set",{value(o,a){n.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new r(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new G(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function Hl(r){if(!r||r.length<=0)return function(i){return!0};let t="",e=r.filter(n=>n===n);return e.length>0&&(t="\n switch (x) {".concat(e.map(n=>"\n case ".concat(om(n),":")).join(""),"\n return false;\n }")),r.length!==e.length&&(t="if (x !== x) return false;\n".concat(t)),new Function("x","".concat(t,"\nreturn true;"))}function om(r){return typeof r!="bigint"?He(r):"".concat(He(r),"n")}var Ba=(r,t)=>(Math.ceil(r)*t+63&-64||64)/t,am=(r,t=0)=>r.length>=t?r.subarray(0,t):gn(new r.constructor(t),r,0),Dr=class{constructor(t,e=1){this.buffer=t,this.stride=e,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t.constructor,this._resize(this.length=Math.ceil(t.length/e))}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,e){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let e=this.stride,n=this.length*e,i=this.buffer.length;n>=i&&this._resize(i===0?Ba(n*1,this.BYTES_PER_ELEMENT):Ba(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Ba(t*this.stride,this.BYTES_PER_ELEMENT);let e=am(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=gn(new this.ArrayType(t),this.buffer)}};Dr.prototype.offset=0;var fr=class extends Dr{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,e){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=e,this}},Dn=class extends fr{constructor(t=new Uint8Array(0)){super(t,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,e){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,s=t%8,o=n[i]>>s&1;return e?o===0&&(n[i]|=1<<s,++this.numValid):o===1&&(n[i]&=~(1<<s),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},En=class extends fr{constructor(t=new Int32Array(1)){super(t,1)}append(t){return this.set(this.length-1,t)}set(t,e){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&i.fill(i[n],n,t),i[t]=i[t-1]+e,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,0),super.flush(t+1)}};var pt=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:e}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=e,this.stride=se(t),this._nulls=new Dn,e&&e.length>0&&(this._isValid=Hl(e))}toVector(){return new G([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:e,_values:n,_nulls:i,_typeIds:s,children:o}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),o.reduce((a,l)=>a+l.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((e,n)=>e+n.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,e){return this.setValid(t,this.isValid(e))&&this.setValue(t,e),this}setValue(t,e){this._setValue(this,t,e)}setValid(t,e){return this.length=this._nulls.set(t,+e).length,e}addChild(t,e="".concat(this.numChildren)){throw new Error('Cannot append children to non-nested type "'.concat(this.type,'"'))}getChildAt(t){return this.children[t]||null}flush(){let t,e,n,i,{type:s,length:o,nullCount:a,_typeIds:l,_offsets:f,_values:m,_nulls:_}=this;(e=l==null?void 0:l.flush(o))?i=f==null?void 0:f.flush(o):(i=f==null?void 0:f.flush(o))?t=m==null?void 0:m.flush(f.last()):t=m==null?void 0:m.flush(o),a>0&&(n=_==null?void 0:_.flush(o));let w=this.children.map(B=>B.flush());return this.clear(),P({type:s,length:o,nullCount:a,children:w,child:w[0],data:t,typeIds:e,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,e,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(e=this._values)===null||e===void 0||e.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let s of this.children)s.clear();return this}};pt.prototype.length=1;pt.prototype.stride=1;pt.prototype.children=null;pt.prototype.finished=!1;pt.prototype.nullValues=null;pt.prototype._isValid=()=>!0;var Rt=class extends pt{constructor(t){super(t),this._values=new fr(new this.ArrayType(0),this.stride)}setValue(t,e){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}},$e=class extends pt{constructor(t){super(t),this._pendingLength=0,this._offsets=new En}setValue(t,e){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=e instanceof je?e[me].length:e.length,n.set(t,e)}setValid(t,e){return super.setValid(t,e)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,e=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,e),this}};var tn=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,e,n,i){return t.prep(8,24),t.writeInt64(BigInt(i!=null?i:0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(e!=null?e:0)),t.offset()}};var Ye=new Int32Array(2),zs=new Float32Array(Ye.buffer),js=new Float64Array(Ye.buffer),On=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var si;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(si||(si={}));var ae=class r{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new r(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return Ye[0]=this.readInt32(t),zs[0]}readFloat64(t){return Ye[On?0:1]=this.readInt32(t),Ye[On?1:0]=this.readInt32(t+4),js[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}writeUint64(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}writeFloat32(t,e){zs[0]=e,this.writeInt32(t,Ye[0])}writeFloat64(t,e){js[0]=e,this.writeInt32(t,Ye[On?0:1]),this.writeInt32(t+4,Ye[On?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t}__offset(t,e){let n=t-this.readInt32(t);return e<this.readInt16(n)?this.readInt16(n+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);let n=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+n);return e===si.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0}createScalarList(t,e){let n=[];for(let i=0;i<e;++i){let s=t(i);s!==null&&n.push(s)}return n}createObjList(t,e){let n=[];for(let i=0;i<e;++i){let s=t(i);s!==null&&n.push(s.unpack())}return n}};var en=class r{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let e;t?e=t:e=1024,this.bb=ae.allocate(e),this.space=e}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);let n=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<n+t+e;){let i=this.bb.capacity();this.bb=r.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(n)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,n){(this.force_defaults||e!=n)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,n){(this.force_defaults||e!=n)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,n){(this.force_defaults||e!=n)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,n){(this.force_defaults||e!==n)&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,n){(this.force_defaults||e!=n)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,n){e!=n&&(this.nested(e),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=e<<1,i=ae.allocate(n);return i.setPosition(n-e),i.bytes().set(t.bytes(),n-e),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);let n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);let i=2;this.addInt16(t-this.object_start);let s=(n+i)*2;this.addInt16(s);let o=0,a=this.space;t:for(e=0;e<this.vtables.length;e++){let l=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(l)){for(let f=2;f<s;f+=2)if(this.bb.readInt16(a+f)!=this.bb.readInt16(l+f))continue t;o=this.vtables[e];break}}return o?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,o-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,n){let i=n?4:0;if(e){let s=e;if(this.prep(this.minalign,4+4+i),s.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let o=4-1;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(e<this.bb.readInt16(i)&&this.bb.readInt16(i+e)!=0))throw new TypeError("FlatBuffers: field "+e+" must be set")}startVector(t,e,n){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(n,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(t==null)return 0;let e;t instanceof Uint8Array?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);for(let n=0,i=this.space,s=this.bb.bytes();n<e.length;n++)s[i++]=e[n];return this.endVector()}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let e=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)e.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var Dt=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKeyValue(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}key(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,n){return r.startKeyValue(t),r.addKey(t,e),r.addValue(t,n),r.endKeyValue(t)}};var Er;(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(Er||(Er={}));var Or;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(Or||(Or={}));var oi;(function(r){r[r.DenseArray=0]="DenseArray"})(oi||(oi={}));var Me=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInt(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,e){t.addFieldInt32(0,e,0)}static addIsSigned(t,e){t.addFieldInt8(1,+e,0)}static endInt(t){return t.endObject()}static createInt(t,e,n){return r.startInt(t),r.addBitWidth(t,e),r.addIsSigned(t,n),r.endInt(t)}};var Xe=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryEncoding(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new Me).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):oi.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addIndexType(t,e){t.addFieldOffset(1,e,0)}static addIsOrdered(t,e){t.addFieldInt8(2,+e,0)}static addDictionaryKind(t,e){t.addFieldInt16(3,e,oi.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var ai=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBinary(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return r.startBinary(t),r.endBinary(t)}};var ci=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBool(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return r.startBool(t),r.endBool(t)}};var li;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(li||(li={}));var Rr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDate(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):li.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,li.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return r.startDate(t),r.addUnit(t,e),r.endDate(t)}};var Ge=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDecimal(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static addBitWidth(t,e){t.addFieldInt32(2,e,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,e,n,i){return r.startDecimal(t),r.addPrecision(t,e),r.addScale(t,n),r.addBitWidth(t,i),r.endDecimal(t)}};var Mr;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(Mr||(Mr={}));var Ur=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeBinary(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return r.startFixedSizeBinary(t),r.addByteWidth(t,e),r.endFixedSizeBinary(t)}};var Nr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeList(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return r.startFixedSizeList(t),r.addListSize(t,e),r.endFixedSizeList(t)}};var ui;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(ui||(ui={}));var Lr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFloatingPoint(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):ui.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,ui.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return r.startFloatingPoint(t),r.addPrecision(t,e),r.endFloatingPoint(t)}};var di;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(di||(di={}));var kr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInterval(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):di.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,di.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return r.startInterval(t),r.addUnit(t,e),r.endInterval(t)}};var fi=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsList(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return r.startList(t),r.endList(t)}};var Cr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMap(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return r.startMap(t),r.addKeysSorted(t,e),r.endMap(t)}};var hi=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNull(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return r.startNull(t),r.endNull(t)}};var pi=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsStruct_(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return r.startStruct_(t),r.endStruct_(t)}};var hr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTime(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Mr.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,Mr.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return r.startTime(t),r.addUnit(t,e),r.addBitWidth(t,n),r.endTime(t)}};var pr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTimestamp(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Mr.SECOND}timezone(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,Mr.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return r.startTimestamp(t),r.addUnit(t,e),r.addTimezone(t,n),r.endTimestamp(t)}};var mi;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(mi||(mi={}));var Ue=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUnion(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):mi.Sparse}typeIds(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,mi.Sparse)}static addTypeIds(t,e){t.addFieldOffset(1,e,0)}static createTypeIdsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addInt32(e[n]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,n){return r.startUnion(t),r.addMode(t,e),r.addTypeIds(t,n),r.endUnion(t)}};var yi=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return r.startUtf8(t),r.endUtf8(t)}};var mt;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.RunEndEncoded=22]="RunEndEncoded"})(mt||(mt={}));var Vt=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):mt.NONE}type(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){let e=this.bb.__offset(this.bb_pos,12);return e?(t||new Xe).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){let n=this.bb.__offset(this.bb_pos,14);return n?(e||new r).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,16);return n?(e||new Dt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,mt.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}};var qt=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Or.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new Vt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new Dt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,Or.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,n,i,s){return r.startSchema(t),r.addEndianness(t,e),r.addFields(t,n),r.addCustomMetadata(t,i),r.addFeatures(t,s),r.endSchema(t)}};var ce=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Er.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new qt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new tn).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){let n=this.bb.__offset(this.bb_pos,10);return n?(e||new tn).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new Dt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,Er.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}};var rt=class r{constructor(t=[],e,n){this.fields=t||[],this.metadata=e||new Map,n||(n=Aa(t)),this.dictionaries=n}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return"Schema<{ ".concat(this.fields.map((t,e)=>"".concat(e,": ").concat(t)).join(", ")," }>")}select(t){let e=new Set(t),n=this.fields.filter(i=>e.has(i.name));return new r(n,this.metadata)}selectAt(t){let e=t.map(n=>this.fields[n]).filter(Boolean);return new r(e,this.metadata)}assign(...t){let e=t[0]instanceof r?t[0]:Array.isArray(t[0])?new r(t[0]):new r(t),n=[...this.fields],i=$s($s(new Map,this.metadata),e.metadata),s=e.fields.filter(a=>{let l=n.findIndex(f=>f.name===a.name);return~l?(n[l]=a.clone({metadata:$s($s(new Map,n[l].metadata),a.metadata)}))&&!1:!0}),o=Aa(s,new Map);return new r([...n,...s],i,new Map([...this.dictionaries,...o]))}};rt.prototype.fields=null;rt.prototype.metadata=null;rt.prototype.dictionaries=null;var Y=class r{static new(...t){let[e,n,i,s]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),s===void 0&&(s=t[0].metadata)),new r("".concat(e),n,i,s)}constructor(t,e,n=!1,i){this.name=t,this.type=e,this.nullable=n,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return"".concat(this.name,": ").concat(this.type)}clone(...t){let[e,n,i,s]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,n=this.type,i=this.nullable,s=this.metadata]=t:{name:e=this.name,type:n=this.type,nullable:i=this.nullable,metadata:s=this.metadata}=t[0],r.new(e,n,i,s)}};Y.prototype.type=null;Y.prototype.name=null;Y.prototype.nullable=null;Y.prototype.metadata=null;function $s(r,t){return new Map([...r||new Map,...t||new Map])}function Aa(r,t=new Map){for(let e=-1,n=r.length;++e<n;){let s=r[e].type;if(D.isDictionary(s)){if(!t.has(s.id))t.set(s.id,s.dictionary);else if(t.get(s.id)!==s.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}s.children&&s.children.length>0&&Aa(s.children,t)}return t}var cm=en,lm=ae,mr=class{static decode(t){t=new lm(L(t));let e=ce.getRootAsFooter(t),n=rt.decode(e.schema());return new Ta(n,e)}static encode(t){let e=new cm,n=rt.encode(e,t.schema);ce.startRecordBatchesVector(e,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())yr.encode(e,o);let i=e.endVector();ce.startDictionariesVector(e,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())yr.encode(e,o);let s=e.endVector();return ce.startFooter(e),ce.addSchema(e,n),ce.addVersion(e,Ot.V4),ce.addRecordBatches(e,i),ce.addDictionaries(e,s),ce.finishFooterBuffer(e,ce.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=Ot.V4,n,i){this.schema=t,this.version=e,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,e=-1,n=this.numRecordBatches;++e<n;)(t=this.getRecordBatch(e))&&(yield t)}*dictionaryBatches(){for(let t,e=-1,n=this.numDictionaries;++e<n;)(t=this.getDictionaryBatch(e))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var Ta=class extends mr{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,e){super(t,e.version()),this._footer=e}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let e=this._footer.recordBatches(t);if(e)return yr.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return yr.decode(e)}return null}},yr=class r{static decode(t){return new r(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){let{metaDataLength:n}=e,i=BigInt(e.offset),s=BigInt(e.bodyLength);return tn.createBlock(t,i,n,s)}constructor(t,e,n){this.metaDataLength=t,this.offset=Kt(n),this.bodyLength=Kt(e)}};var ut=Object.freeze({done:!0,value:void 0}),_i=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},rn=class{tee(){return this._getDOMStream().tee()}pipe(t,e){return this._getNodeStream().pipe(t,e)}pipeTo(t,e){return this._getDOMStream().pipeTo(t,e)}pipeThrough(t,e){return this._getDOMStream().pipeThrough(t,e)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},Ys=class extends rn{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return F(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(ut);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return Ut.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Ut.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return F(this,void 0,void 0,function*(){return yield this.abort(t),ut})}return(t){return F(this,void 0,void 0,function*(){return yield this.close(),ut})}read(t){return F(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return F(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((e,n)=>{this.resolvers.push({resolve:e,reject:n})}):Promise.resolve(ut)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var Ke=class extends Ys{write(t){if((t=L(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Kn(this.toUint8Array(!0)):this.toUint8Array(!1).then(Kn)}toUint8Array(t=!1){return t?ne(this._values)[0]:(()=>F(this,void 0,void 0,function*(){var e,n,i,s;let o=[],a=0;try{for(var l=!0,f=ve(this),m;m=yield f.next(),e=m.done,!e;l=!0){s=m.value,l=!1;let _=s;o.push(_),a+=_.byteLength}}catch(_){n={error:_}}finally{try{!l&&!e&&(i=f.return)&&(yield i.call(f))}finally{if(n)throw n.error}}return ne(o,a)[0]}))()}},Je=class{constructor(t){t&&(this.source=new xa(Ut.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},_e=class r{constructor(t){t instanceof r?this.source=t.source:t instanceof Ke?this.source=new _r(Ut.fromAsyncIterable(t)):cs(t)?this.source=new _r(Ut.fromNodeStream(t)):Jn(t)?this.source=new _r(Ut.fromDOMStream(t)):os(t)?this.source=new _r(Ut.fromDOMStream(t.body)):Ie(t)?this.source=new _r(Ut.fromIterable(t)):Se(t)?this.source=new _r(Ut.fromAsyncIterable(t)):he(t)&&(this.source=new _r(Ut.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}},xa=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||ut)}return(t){return Object.create(this.source.return&&this.source.return(t)||ut)}},_r=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return F(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return F(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return F(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,e="read"){return F(this,void 0,void 0,function*(){return yield this.source.next({cmd:e,size:t})})}throw(t){return F(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||ut;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return F(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||ut;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var bi=class extends Je{constructor(t,e){super(),this.position=0,this.buffer=L(t),this.size=e===void 0?this.buffer.byteLength:e}readInt32(t){let{buffer:e,byteOffset:n}=this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:e,size:n,position:i}=this;return e&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),e.subarray(i,this.position)):null}readAt(t,e){let n=this.buffer,i=Math.min(this.size,t+e);return n?n.subarray(t,i):new Uint8Array(e)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Pr=class extends _e{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=(()=>F(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return F(this,void 0,void 0,function*(){let{buffer:e,byteOffset:n}=yield this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)})}seek(t){return F(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return F(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:e,size:n,position:i}=this;if(e&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let s=i,o=0,a=0,l=Math.min(n,s+Math.min(n-s,t)),f=new Uint8Array(Math.max(0,(this.position=l)-s));for(;(s+=a)<l&&(o+=a)<f.byteLength;)({bytesRead:a}=yield e.read(f,o,f.byteLength-o,s));return f}return null})}readAt(t,e){return F(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+e<i){let s=Math.min(i,t+e),o=new Uint8Array(s-t);return(yield n.read(o,0,e,t)).buffer}return new Uint8Array(e)})}close(){return F(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return F(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return F(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var Ea={};Gr(Ea,{BaseInt64:()=>gi,Int128:()=>wi,Int64:()=>br,Uint64:()=>_t});function Rn(r){return r<0&&(r=4294967295+r+1),"0x".concat(r.toString(16))}var Mn=8,Da=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],gi=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let e=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=e[3]*n[3];this.buffer[0]=i&65535;let s=i>>>16;return i=e[2]*n[3],s+=i,i=e[3]*n[2]>>>0,s+=i,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0<i?65536:0,this.buffer[1]+=s>>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}_plus(t){let e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return"".concat(Rn(this.buffer[1])," ").concat(Rn(this.buffer[0]))}},_t=class r extends gi{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return r.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return r.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.length,i=new r(e);for(let s=0;s<n;){let o=Mn<n-s?Mn:n-s,a=new r(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),l=new r(new Uint32Array([Da[o],0]));i.times(l),i.plus(a),s+=o}return i}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)r.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new r(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new r(new Uint32Array(t.buffer)).plus(e)}},br=class r extends gi{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let e=this.buffer[1]<<0,n=t.buffer[1]<<0;return e<n||e===n&&this.buffer[0]<t.buffer[0]}static from(t,e=new Uint32Array(2)){return r.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return r.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,s=new r(e);for(let o=n?1:0;o<i;){let a=Mn<i-o?Mn:i-o,l=new r(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),f=new r(new Uint32Array([Da[a],0]));s.times(f),s.plus(l),o+=a}return n?s.negate():s}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)r.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new r(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new r(new Uint32Array(t.buffer)).plus(e)}},wi=class r{constructor(t){this.buffer=t}high(){return new br(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new br(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let e=new _t(new Uint32Array([this.buffer[3],0])),n=new _t(new Uint32Array([this.buffer[2],0])),i=new _t(new Uint32Array([this.buffer[1],0])),s=new _t(new Uint32Array([this.buffer[0],0])),o=new _t(new Uint32Array([t.buffer[3],0])),a=new _t(new Uint32Array([t.buffer[2],0])),l=new _t(new Uint32Array([t.buffer[1],0])),f=new _t(new Uint32Array([t.buffer[0],0])),m=_t.multiply(s,f);this.buffer[0]=m.low();let _=new _t(new Uint32Array([m.high(),0]));return m=_t.multiply(i,f),_.plus(m),m=_t.multiply(s,l),_.plus(m),this.buffer[1]=_.low(),this.buffer[3]=_.lessThan(m)?1:0,this.buffer[2]=_.high(),new _t(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(_t.multiply(n,f)).plus(_t.multiply(i,l)).plus(_t.multiply(s,a)),this.buffer[3]+=_t.multiply(e,f).plus(_t.multiply(n,l)).plus(_t.multiply(i,a)).plus(_t.multiply(s,o)).low(),this}plus(t){let e=new Uint32Array(4);return e[3]=this.buffer[3]+t.buffer[3]>>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]<this.buffer[0]>>>0&&++e[1],e[1]<this.buffer[1]>>>0&&++e[2],e[2]<this.buffer[2]>>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return"".concat(Rn(this.buffer[3])," ").concat(Rn(this.buffer[2])," ").concat(Rn(this.buffer[1])," ").concat(Rn(this.buffer[0]))}static multiply(t,e){return new r(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new r(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return r.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return r.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,s=new r(e);for(let o=n?1:0;o<i;){let a=Mn<i-o?Mn:i-o,l=new r(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),f=new r(new Uint32Array([Da[a],0,0,0]));s.times(f),s.plus(l),o+=a}return n?s.negate():s}static convertArray(t){let e=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)r.from(t[n],new Uint32Array(e.buffer,e.byteOffset+4*4*n,4));return e}};var vi=class extends E{constructor(t,e,n,i){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=i}visit(t){return super.visit(t instanceof Y?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return P({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t){return t.mode===yt.Sparse?this.visitSparseUnion(t):this.visitDenseUnion(t)}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:e,nullCount:n}=this.nextFieldNode()){return P({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,e,n=this.nextBufferRange()){return e>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+e)}readDictionary(t){return this.dictionaries.get(t.id)}},Xs=class extends vi{constructor(t,e,n,i){super(new Uint8Array(0),e,n,i),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):Zr(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return W(Uint8Array,W(Int32Array,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return W(Uint8Array,W(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:n}=this;return D.isTimestamp(t)?W(Uint8Array,br.convertArray(n[e])):(D.isInt(t)||D.isTime(t))&&t.bitWidth===64?W(Uint8Array,br.convertArray(n[e])):D.isDate(t)&&t.unit===Nt.MILLISECOND?W(Uint8Array,br.convertArray(n[e])):D.isDecimal(t)?W(Uint8Array,wi.convertArray(n[e])):D.isBinary(t)||D.isFixedSizeBinary(t)?um(n[e]):D.isBool(t)?Zr(n[e]):D.isUtf8(t)?Fr(n[e].join("")):W(Uint8Array,W(t.ArrayType,n[e].map(i=>+i)))}};function um(r){let t=r.join(""),e=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)e[n>>1]=Number.parseInt(t.slice(n,n+2),16);return e}var Un=class extends $e{constructor(t){super(t),this._values=new Dr(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,L(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,s=0;for(let[o,a]of t)if(a===void 0)n.set(o,0);else{let l=a.length;i.set(a,s),n.set(o,l),s+=l}}};var Gs=class extends pt{constructor(t){super(t),this._values=new Dn}setValue(t,e){this._values.set(t,+e)}};var nn=class extends Rt{};nn.prototype._setValue=ua;var Si=class extends nn{};Si.prototype._setValue=vs;var Ii=class extends nn{};Ii.prototype._setValue=Ss;var Fi=class extends Rt{};Fi.prototype._setValue=ha;var Ks=class extends pt{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new ie(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=sn({type:this.type.indices,nullValues:e}),this.dictionary=sn({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,e){let n=this.indices;return e=n.setValid(t,e),this.length=n.length,e}setValue(t,e){let n=this._keysToIndices,i=this.valueToKey(e),s=n[i];return s===void 0&&(n[i]=s=this._dictionaryOffset+this.dictionary.append(e).length-1),this.indices.setValue(t,s)}flush(){let t=this.type,e=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=e?e.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:"".concat(t)}};var Bi=class extends Rt{};Bi.prototype._setValue=la;var Js=class extends pt{setValue(t,e){let[n]=this.children,i=t*this.stride;for(let s=-1,o=e.length;++s<o;)n.set(i+s,e[s])}addChild(t,e="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new De(this.type.listSize,new Y(e,t.type,!0)),n}};var on=class extends Rt{setValue(t,e){this._values.set(t,e)}},qs=class extends on{setValue(t,e){super.setValue(t,ti(e))}},Zs=class extends on{},Qs=class extends on{};var an=class extends Rt{};an.prototype._setValue=pa;var Ai=class extends an{};Ai.prototype._setValue=Os;var Ti=class extends an{};Ti.prototype._setValue=Rs;var be=class extends Rt{setValue(t,e){this._values.set(t,e)}},to=class extends be{},eo=class extends be{},ro=class extends be{},no=class extends be{},io=class extends be{},so=class extends be{},oo=class extends be{},ao=class extends be{};var co=class extends $e{constructor(t){super(t),this._offsets=new En}addChild(t,e="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Te(new Y(e,t.type,!0)),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,s]of t)if(typeof s>"u")e.set(i,0);else{let o=s,a=o.length,l=e.set(i,a).buffer[i];for(let f=-1;++f<a;)n.set(l+f,o[f])}}};var lo=class extends $e{set(t,e){return super.set(t,e)}setValue(t,e){let n=e instanceof Map?e:new Map(Object.entries(e)),i=this._pending||(this._pending=new Map),s=i.get(t);s&&(this._pendingLength-=s.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,e="".concat(this.numChildren)){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Ee(new Y(e,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,s]of t)if(s===void 0)e.set(i,0);else{let{[i]:o,[i+1]:a}=e.set(i,s.size).buffer;for(let l of s.entries())if(n.set(o,l),++o>=a)break}}};var uo=class extends pt{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var fo=class extends pt{setValue(t,e){let{children:n,type:i}=this;switch(Array.isArray(e)||e.constructor){case!0:return i.children.forEach((s,o)=>n[o].set(t,e[o]));case Map:return i.children.forEach((s,o)=>n[o].set(t,e.get(s.name)));default:return i.children.forEach((s,o)=>n[o].set(t,e[s.name]))}}setValid(t,e){return super.setValid(t,e)||this.children.forEach(n=>n.setValid(t,e)),e}addChild(t,e="".concat(this.numChildren)){let n=this.children.push(t);return this.type=new lt([...this.type.children,new Y(e,t.type,!0)]),n}};var gr=class extends Rt{};gr.prototype._setValue=da;var xi=class extends gr{};xi.prototype._setValue=Is;var Di=class extends gr{};Di.prototype._setValue=Fs;var Ei=class extends gr{};Ei.prototype._setValue=Bs;var Oi=class extends gr{};Oi.prototype._setValue=As;var wr=class extends Rt{};wr.prototype._setValue=fa;var Ri=class extends wr{};Ri.prototype._setValue=Ts;var Mi=class extends wr{};Mi.prototype._setValue=xs;var Ui=class extends wr{};Ui.prototype._setValue=Ds;var Ni=class extends wr{};Ni.prototype._setValue=Es;var Nn=class extends pt{constructor(t){super(t),this._typeIds=new fr(new Int8Array(0),1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,e){return this.set(this.length,t,e)}set(t,e,n){return n===void 0&&(n=this._valueToChildTypeId(this,e,t)),this.setValid(t,this.isValid(e))&&this.setValue(t,e,n),this}setValue(t,e,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],s=this.children[i];s==null||s.set(t,e)}addChild(t,e="".concat(this.children.length)){let n=this.children.push(t),{type:{children:i,mode:s,typeIds:o}}=this,a=[...i,new Y(e,t.type)];return this.type=new xe(s,[...o,n],a),n}_valueToChildTypeId(t,e,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},ho=class extends Nn{},po=class extends Nn{constructor(t){super(t),this._offsets=new fr(new Int32Array(0))}setValue(t,e,n){let i=this._typeIds.set(t,n).buffer[t],s=this.getChildAt(this.type.typeIdToChildIndex[i]),o=this._offsets.set(t,s.length).buffer[t];s==null||s.set(o,e)}};var Li=class extends $e{constructor(t){super(t),this._values=new Dr(new Uint8Array(0))}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,Fr(e))}_flushPending(t,e){}};Li.prototype._flushPending=Un.prototype._flushPending;var Oa=class extends E{visitNull(){return uo}visitBool(){return Gs}visitInt(){return be}visitInt8(){return to}visitInt16(){return eo}visitInt32(){return ro}visitInt64(){return no}visitUint8(){return io}visitUint16(){return so}visitUint32(){return oo}visitUint64(){return ao}visitFloat(){return on}visitFloat16(){return qs}visitFloat32(){return Zs}visitFloat64(){return Qs}visitUtf8(){return Li}visitBinary(){return Un}visitFixedSizeBinary(){return Bi}visitDate(){return nn}visitDateDay(){return Si}visitDateMillisecond(){return Ii}visitTimestamp(){return gr}visitTimestampSecond(){return xi}visitTimestampMillisecond(){return Di}visitTimestampMicrosecond(){return Ei}visitTimestampNanosecond(){return Oi}visitTime(){return wr}visitTimeSecond(){return Ri}visitTimeMillisecond(){return Mi}visitTimeMicrosecond(){return Ui}visitTimeNanosecond(){return Ni}visitDecimal(){return Fi}visitList(){return co}visitStruct(){return fo}visitUnion(){return Nn}visitDenseUnion(){return po}visitSparseUnion(){return ho}visitDictionary(){return Ks}visitInterval(){return an}visitIntervalDayTime(){return Ai}visitIntervalYearMonth(){return Ti}visitFixedSizeList(){return Js}visitMap(){return lo}},zl=new Oa;var N=class extends E{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((n,i)=>this.compareFields(n,e[i]))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}};function Zt(r,t){return t instanceof r.constructor}function ki(r,t){return r===t||Zt(r,t)}function vr(r,t){return r===t||Zt(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function mo(r,t){return r===t||Zt(r,t)&&r.precision===t.precision}function dm(r,t){return r===t||Zt(r,t)&&r.byteWidth===t.byteWidth}function Ra(r,t){return r===t||Zt(r,t)&&r.unit===t.unit}function Ci(r,t){return r===t||Zt(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function Pi(r,t){return r===t||Zt(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function fm(r,t){return r===t||Zt(r,t)&&r.children.length===t.children.length&&qe.compareManyFields(r.children,t.children)}function hm(r,t){return r===t||Zt(r,t)&&r.children.length===t.children.length&&qe.compareManyFields(r.children,t.children)}function Ma(r,t){return r===t||Zt(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&qe.compareManyFields(r.children,t.children)}function pm(r,t){return r===t||Zt(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&qe.visit(r.indices,t.indices)&&qe.visit(r.dictionary,t.dictionary)}function Ua(r,t){return r===t||Zt(r,t)&&r.unit===t.unit}function mm(r,t){return r===t||Zt(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&qe.compareManyFields(r.children,t.children)}function ym(r,t){return r===t||Zt(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&qe.compareManyFields(r.children,t.children)}N.prototype.visitNull=ki;N.prototype.visitBool=ki;N.prototype.visitInt=vr;N.prototype.visitInt8=vr;N.prototype.visitInt16=vr;N.prototype.visitInt32=vr;N.prototype.visitInt64=vr;N.prototype.visitUint8=vr;N.prototype.visitUint16=vr;N.prototype.visitUint32=vr;N.prototype.visitUint64=vr;N.prototype.visitFloat=mo;N.prototype.visitFloat16=mo;N.prototype.visitFloat32=mo;N.prototype.visitFloat64=mo;N.prototype.visitUtf8=ki;N.prototype.visitBinary=ki;N.prototype.visitFixedSizeBinary=dm;N.prototype.visitDate=Ra;N.prototype.visitDateDay=Ra;N.prototype.visitDateMillisecond=Ra;N.prototype.visitTimestamp=Ci;N.prototype.visitTimestampSecond=Ci;N.prototype.visitTimestampMillisecond=Ci;N.prototype.visitTimestampMicrosecond=Ci;N.prototype.visitTimestampNanosecond=Ci;N.prototype.visitTime=Pi;N.prototype.visitTimeSecond=Pi;N.prototype.visitTimeMillisecond=Pi;N.prototype.visitTimeMicrosecond=Pi;N.prototype.visitTimeNanosecond=Pi;N.prototype.visitDecimal=ki;N.prototype.visitList=fm;N.prototype.visitStruct=hm;N.prototype.visitUnion=Ma;N.prototype.visitDenseUnion=Ma;N.prototype.visitSparseUnion=Ma;N.prototype.visitDictionary=pm;N.prototype.visitInterval=Ua;N.prototype.visitIntervalDayTime=Ua;N.prototype.visitIntervalYearMonth=Ua;N.prototype.visitFixedSizeList=mm;N.prototype.visitMap=ym;var qe=new N;function cn(r,t){return qe.compareSchemas(r,t)}function jl(r,t){return qe.compareFields(r,t)}function Wl(r,t){return qe.visit(r,t)}function sn(r){let t=r.type,e=new(zl.getVisitFn(t)())(r);if(t.children&&t.children.length>0){let n=r.children||[],i={nullValues:r.nullValues},s=Array.isArray(n)?(o,a)=>n[a]||i:({name:o})=>n[o]||i;for(let[o,a]of t.children.entries()){let{type:l}=a,f=s(a,o);e.children.push(sn(Object.assign(Object.assign({},f),{type:l})))}}return e}function yo(r,t){return _m(r,t.map(e=>e.data.concat()))}function _m(r,t){let e=[...r.fields],n=[],i={numBatches:t.reduce((_,w)=>Math.max(_,w.length),0)},s=0,o=0,a=-1,l=t.length,f,m=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<l;)m[a]=f=t[a].shift(),o=Math.min(o,f?f.length:o);Number.isFinite(o)&&(m=bm(e,o,m,t,i),o>0&&(n[s++]=P({type:new lt(e),length:o,nullCount:0,children:m.slice()})))}return[r=r.assign(e),n.map(_=>new wt(r,_))]}function bm(r,t,e,n,i){var s;let o=(t+63&-64)>>3;for(let a=-1,l=n.length;++a<l;){let f=e[a],m=f==null?void 0:f.length;if(m>=t)m===t?e[a]=f:(e[a]=f.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(f.slice(t,m-t))));else{let _=r[a];r[a]=_.clone({nullable:!0}),e[a]=(s=f==null?void 0:f._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:P({type:_.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var $l,Yt=class r{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new rt([]),this._offsets=[0],this;let i,s;t[0]instanceof rt&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());let o=l=>{if(l){if(l instanceof wt)return[l];if(l instanceof r)return l.batches;if(l instanceof ot){if(l.type instanceof lt)return[new wt(new rt(l.type.children),l)]}else{if(Array.isArray(l))return l.flatMap(f=>o(f));if(typeof l[Symbol.iterator]=="function")return[...l].flatMap(f=>o(f));if(typeof l=="object"){let f=Object.keys(l),m=f.map(B=>new G([l[B]])),_=new rt(f.map((B,q)=>new Y(String(B),m[q].type))),[,w]=yo(_,m);return w.length===0?[new wt(l)]:w}}}return[]},a=t.flatMap(l=>o(l));if(i=(n=i!=null?i:(e=a[0])===null||e===void 0?void 0:e.schema)!==null&&n!==void 0?n:new rt([]),!(i instanceof rt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let l of a){if(!(l instanceof wt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!cn(i,l.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=s!=null?s:ks(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,e)=>t+e.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=Ls(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}getByteLength(t){return 0}[Symbol.iterator](){return this.batches.length>0?xn.visit(new G(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return"[\n ".concat(this.toArray().join(",\n "),"\n]")}concat(...t){let e=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new r(e,n.map(i=>new wt(e,i)))}slice(t,e){let n=this.schema;[t,e]=ei({length:this.numRows},t,e);let i=Cs(this.data,this._offsets,t,e);return new r(n,i.map(s=>new wt(n,s)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let e=this.data.map(n=>n.children[t]);if(e.length===0){let{type:n}=this.schema.fields[t],i=P({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new G(e)}return null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),e)}setChildAt(t,e){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new G([P({type:new $t,length:this.numRows})]));let s=n.fields.slice(),o=s[t].clone({type:e.type}),a=this.schema.fields.map((l,f)=>this.getChildAt(f));[s[t],a[t]]=[o,e],[n,i]=yo(n,a)}return new r(n,i)}select(t){let e=this.schema.fields.reduce((n,i,s)=>n.set(i.name,s),new Map);return this.selectAt(t.map(n=>e.get(n)).filter(n=>n>-1))}selectAt(t){let e=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new r(e,n)}assign(t){let e=this.schema.fields,[n,i]=t.schema.fields.reduce((a,l,f)=>{let[m,_]=a,w=e.findIndex(B=>B.name===l.name);return~w?_[w]=f:m.push(f),a},[[],[]]),s=this.schema.assign(t.schema),o=[...e.map((a,l)=>[l,i[l]]).map(([a,l])=>l===void 0?this.getChildAt(a):t.getChildAt(l)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new r(...yo(s,o))}};$l=Symbol.toStringTag;Yt[$l]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=xr(ii),r.get=xr(At.getVisitFn(h.Struct)),r.set=Ps(Lt.getVisitFn(h.Struct)),r.indexOf=Vs(Qr.getVisitFn(h.Struct)),r.getByteLength=xr(oe.getVisitFn(h.Struct)),"Table"))(Yt.prototype);var Xl,wt=class r{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof rt))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=P({nullCount:0,type:new lt(this.schema.fields),children:this.schema.fields.map(e=>P({type:e.type,nullCount:0}))})]=t,!(this.data instanceof ot))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Yl(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:n,children:i,length:s}=Object.keys(e).reduce((l,f,m)=>(l.children[m]=e[f],l.length=Math.max(l.length,e[f].length),l.fields[m]=Y.new({name:f,type:e[f].type,nullable:!0}),l),{length:0,fields:new Array,children:new Array}),o=new rt(n),a=P({type:new lt(n),length:s,children:i,nullCount:0});[this.schema,this.data]=Yl(o,a.children,s);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=Gl(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return At.visit(this.data,t)}set(t,e){return Lt.visit(this.data,t,e)}indexOf(t,e){return Qr.visit(this.data,t,e)}getByteLength(t){return oe.visit(this.data,t)}[Symbol.iterator](){return xn.visit(new G([this.data]))}toArray(){return[...this]}concat(...t){return new Yt(this.schema,[this,...t])}slice(t,e){let[n]=new G([this.data]).slice(t,e).data;return new r(this.schema,n)}getChild(t){var e;return this.getChildAt((e=this.schema.fields)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new G([this.data.children[t]]):null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),e)}setChildAt(t,e){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){e||(e=new G([P({type:new $t,length:this.numRows})]));let s=n.fields.slice(),o=i.children.slice(),a=s[t].clone({type:e.type});[s[t],o[t]]=[a,e.data[0]],n=new rt(s,new Map(this.schema.metadata)),i=P({type:new lt(s),children:o})}return new r(n,i)}select(t){let e=this.schema.select(t),n=new lt(e.fields),i=[];for(let s of t){let o=this.schema.fields.findIndex(a=>a.name===s);~o&&(i[o]=this.data.children[o])}return new r(e,P({type:n,length:this.numRows,children:i}))}selectAt(t){let e=this.schema.selectAt(t),n=t.map(s=>this.data.children[s]).filter(Boolean),i=P({type:new lt(e.fields),length:this.numRows,children:n});return new r(e,i)}};Xl=Symbol.toStringTag;wt[Xl]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(wt.prototype);function Yl(r,t,e=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...r.fields],s=[...t],o=(e+63&-64)>>3;for(let[a,l]of r.fields.entries()){let f=t[a];(!f||f.length!==e)&&(i[a]=l.clone({nullable:!0}),s[a]=(n=f==null?void 0:f._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:P({type:l.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(i),P({type:new lt(i),length:e,children:s})]}function Gl(r,t,e=new Map){for(let n=-1,i=r.length;++n<i;){let o=r[n].type,a=t[n];if(D.isDictionary(o)){if(!e.has(o.id))a.dictionary&&e.set(o.id,a.dictionary);else if(e.get(o.id)!==a.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&Gl(o.children,a.children,e)}return e}var ln=class extends wt{constructor(t){let e=t.fields.map(i=>P({type:i.type})),n=P({type:new lt(t.fields),nullCount:0,children:e});super(t,n)}};var Vi;(function(r){r[r.BUFFER=0]="BUFFER"})(Vi||(Vi={}));var Hi;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(Hi||(Hi={}));var _o=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBodyCompression(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Hi.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Vi.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,Hi.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,Vi.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return r.startBodyCompression(t),r.addCodec(t,e),r.addMethod(t,n),r.endBodyCompression(t)}};var Ln=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,e,n){return t.prep(8,16),t.writeInt64(BigInt(n!=null?n:0)),t.writeInt64(BigInt(e!=null?e:0)),t.offset()}};var kn=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,e,n){return t.prep(8,16),t.writeInt64(BigInt(n!=null?n:0)),t.writeInt64(BigInt(e!=null?e:0)),t.offset()}};var le=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsRecordBatch(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new kn).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new Ln).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let e=this.bb.__offset(this.bb_pos,10);return e?(t||new _o).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addNodes(t,e){t.addFieldOffset(1,e,0)}static startNodesVector(t,e){t.startVector(16,e,8)}static addBuffers(t,e){t.addFieldOffset(2,e,0)}static startBuffersVector(t,e){t.startVector(16,e,8)}static addCompression(t,e){t.addFieldOffset(3,e,0)}static endRecordBatch(t){return t.endObject()}};var Sr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryBatch(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new le).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addData(t,e){t.addFieldOffset(1,e,0)}static addIsDelta(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryBatch(t){return t.endObject()}};var Cn;(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(Cn||(Cn={}));var Ne=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Er.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Cn.NONE}header(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new Dt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,Er.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,Cn.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,BigInt("0"))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,n,i,s,o){return r.startMessage(t),r.addVersion(t,e),r.addHeaderType(t,n),r.addHeader(t,i),r.addBodyLength(t,s),r.addCustomMetadata(t,o),r.endMessage(t)}};var Na=class extends E{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return hi.startNull(e),hi.endNull(e)}visitInt(t,e){return Me.startInt(e),Me.addBitWidth(e,t.bitWidth),Me.addIsSigned(e,t.isSigned),Me.endInt(e)}visitFloat(t,e){return Lr.startFloatingPoint(e),Lr.addPrecision(e,t.precision),Lr.endFloatingPoint(e)}visitBinary(t,e){return ai.startBinary(e),ai.endBinary(e)}visitBool(t,e){return ci.startBool(e),ci.endBool(e)}visitUtf8(t,e){return yi.startUtf8(e),yi.endUtf8(e)}visitDecimal(t,e){return Ge.startDecimal(e),Ge.addScale(e,t.scale),Ge.addPrecision(e,t.precision),Ge.addBitWidth(e,t.bitWidth),Ge.endDecimal(e)}visitDate(t,e){return Rr.startDate(e),Rr.addUnit(e,t.unit),Rr.endDate(e)}visitTime(t,e){return hr.startTime(e),hr.addUnit(e,t.unit),hr.addBitWidth(e,t.bitWidth),hr.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return pr.startTimestamp(e),pr.addUnit(e,t.unit),n!==void 0&&pr.addTimezone(e,n),pr.endTimestamp(e)}visitInterval(t,e){return kr.startInterval(e),kr.addUnit(e,t.unit),kr.endInterval(e)}visitList(t,e){return fi.startList(e),fi.endList(e)}visitStruct(t,e){return pi.startStruct_(e),pi.endStruct_(e)}visitUnion(t,e){Ue.startTypeIdsVector(e,t.typeIds.length);let n=Ue.createTypeIdsVector(e,t.typeIds);return Ue.startUnion(e),Ue.addMode(e,t.mode),Ue.addTypeIds(e,n),Ue.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return Xe.startDictionaryEncoding(e),Xe.addId(e,BigInt(t.id)),Xe.addIsOrdered(e,t.isOrdered),n!==void 0&&Xe.addIndexType(e,n),Xe.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return Ur.startFixedSizeBinary(e),Ur.addByteWidth(e,t.byteWidth),Ur.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Nr.startFixedSizeList(e),Nr.addListSize(e,t.listSize),Nr.endFixedSizeList(e)}visitMap(t,e){return Cr.startMap(e),Cr.addKeysSorted(e,t.keysSorted),Cr.endMap(e)}},bo=new Na;function Zl(r,t=new Map){return new rt(wm(r,t),go(r.customMetadata),t)}function La(r){return new kt(r.count,tu(r.columns),eu(r.columns))}function Ql(r){return new te(La(r.data),r.id,r.isDelta)}function wm(r,t){return(r.fields||[]).filter(Boolean).map(e=>Y.fromJSON(e,t))}function Kl(r,t){return(r.children||[]).filter(Boolean).map(e=>Y.fromJSON(e,t))}function tu(r){return(r||[]).reduce((t,e)=>[...t,new Le(e.count,vm(e.VALIDITY)),...tu(e.children)],[])}function eu(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new Qt(t.length,i.VALIDITY.length)),i.TYPE&&t.push(new Qt(t.length,i.TYPE.length)),i.OFFSET&&t.push(new Qt(t.length,i.OFFSET.length)),i.DATA&&t.push(new Qt(t.length,i.DATA.length)),t=eu(i.children,t)}return t}function vm(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function ru(r,t){let e,n,i,s,o,a;return!t||!(s=r.dictionary)?(o=ql(r,Kl(r,t)),i=new Y(r.name,o,r.nullable,go(r.customMetadata))):t.has(e=s.id)?(n=(n=s.indexType)?Jl(n):new ze,a=new ie(t.get(e),n,e,s.isOrdered),i=new Y(r.name,a,r.nullable,go(r.customMetadata))):(n=(n=s.indexType)?Jl(n):new ze,t.set(e,o=ql(r,Kl(r,t))),a=new ie(o,n,e,s.isOrdered),i=new Y(r.name,a,r.nullable,go(r.customMetadata))),i||null}function go(r){return new Map(Object.entries(r||{}))}function Jl(r){return new It(r.isSigned,r.bitWidth)}function ql(r,t){let e=r.type.name;switch(e){case"NONE":return new $t;case"null":return new $t;case"binary":return new nr;case"utf8":return new ir;case"bool":return new sr;case"list":return new Te((t||[])[0]);case"struct":return new lt(t||[]);case"struct_":return new lt(t||[])}switch(e){case"int":{let n=r.type;return new It(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new Jt(ht[n.precision])}case"decimal":{let n=r.type;return new or(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new ar(Nt[n.unit])}case"time":{let n=r.type;return new Ae(X[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new cr(X[n.unit],n.timezone)}case"interval":{let n=r.type;return new lr(Wt[n.unit])}case"union":{let n=r.type;return new xe(yt[n.mode],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new ur(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new De(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new Ee((t||[])[0],n.keysSorted)}}throw new Error('Unrecognized type: "'.concat(e,'"'))}var Sm=en,Im=ae,ee=class r{static fromJSON(t,e){let n=new r(0,Ot.V4,e);return n._createHeader=Fm(t,e),n}static decode(t){t=new Im(L(t));let e=Ne.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),s=e.headerType(),o=new r(n,i,s);return o._createHeader=Bm(e,s),o}static encode(t){let e=new Sm,n=-1;return t.isSchema()?n=rt.encode(e,t.header()):t.isRecordBatch()?n=kt.encode(e,t.header()):t.isDictionaryBatch()&&(n=te.encode(e,t.header())),Ne.startMessage(e),Ne.addVersion(e,Ot.V4),Ne.addHeader(e,n),Ne.addHeaderType(e,t.headerType),Ne.addBodyLength(e,BigInt(t.bodyLength)),Ne.finishMessageBuffer(e,Ne.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof rt)return new r(0,Ot.V4,Q.Schema,t);if(t instanceof kt)return new r(e,Ot.V4,Q.RecordBatch,t);if(t instanceof te)return new r(e,Ot.V4,Q.DictionaryBatch,t);throw new Error("Unrecognized Message header: ".concat(t))}get type(){return this.headerType}get version(){return this._version}get headerType(){return this._headerType}get bodyLength(){return this._bodyLength}header(){return this._createHeader()}isSchema(){return this.headerType===Q.Schema}isRecordBatch(){return this.headerType===Q.RecordBatch}isDictionaryBatch(){return this.headerType===Q.DictionaryBatch}constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=Kt(t)}},kt=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,e,n){this._nodes=e,this._buffers=n,this._length=Kt(t)}},te=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,n=!1){this._data=t,this._isDelta=n,this._id=Kt(e)}},Qt=class{constructor(t,e){this.offset=Kt(t),this.length=Kt(e)}},Le=class{constructor(t,e){this.length=Kt(t),this.nullCount=Kt(e)}};function Fm(r,t){return()=>{switch(t){case Q.Schema:return rt.fromJSON(r);case Q.RecordBatch:return kt.fromJSON(r);case Q.DictionaryBatch:return te.fromJSON(r)}throw new Error("Unrecognized Message type: { name: ".concat(Q[t],", type: ").concat(t," }"))}}function Bm(r,t){return()=>{switch(t){case Q.Schema:return rt.decode(r.header(new qt));case Q.RecordBatch:return kt.decode(r.header(new le),r.version());case Q.DictionaryBatch:return te.decode(r.header(new Sr),r.version())}throw new Error("Unrecognized Message type: { name: ".concat(Q[t],", type: ").concat(t," }"))}}Y.encode=Lm;Y.decode=Um;Y.fromJSON=ru;rt.encode=Nm;rt.decode=Am;rt.fromJSON=Zl;kt.encode=km;kt.decode=Tm;kt.fromJSON=La;te.encode=Cm;te.decode=xm;te.fromJSON=Ql;Le.encode=Pm;Le.decode=Em;Qt.encode=Vm;Qt.decode=Dm;function Am(r,t=new Map){let e=Mm(r,t);return new rt(e,wo(r),t)}function Tm(r,t=Ot.V4){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new kt(r.length(),Om(r),Rm(r,t))}function xm(r,t=Ot.V4){return new te(kt.decode(r.data(),t),r.id(),r.isDelta())}function Dm(r){return new Qt(r.offset(),r.length())}function Em(r){return new Le(r.length(),r.nullCount())}function Om(r){let t=[];for(let e,n=-1,i=-1,s=r.nodesLength();++n<s;)(e=r.nodes(n))&&(t[++i]=Le.decode(e));return t}function Rm(r,t){let e=[];for(let n,i=-1,s=-1,o=r.buffersLength();++i<o;)(n=r.buffers(i))&&(t<Ot.V4&&(n.bb_pos+=8*(i+1)),e[++s]=Qt.decode(n));return e}function Mm(r,t){let e=[];for(let n,i=-1,s=-1,o=r.fieldsLength();++i<o;)(n=r.fields(i))&&(e[++s]=Y.decode(n,t));return e}function nu(r,t){let e=[];for(let n,i=-1,s=-1,o=r.childrenLength();++i<o;)(n=r.children(i))&&(e[++s]=Y.decode(n,t));return e}function Um(r,t){let e,n,i,s,o,a;return!t||!(a=r.dictionary())?(i=su(r,nu(r,t)),n=new Y(r.name(),i,r.nullable(),wo(r))):t.has(e=Kt(a.id()))?(s=(s=a.indexType())?iu(s):new ze,o=new ie(t.get(e),s,e,a.isOrdered()),n=new Y(r.name(),o,r.nullable(),wo(r))):(s=(s=a.indexType())?iu(s):new ze,t.set(e,i=su(r,nu(r,t))),o=new ie(i,s,e,a.isOrdered()),n=new Y(r.name(),o,r.nullable(),wo(r))),n||null}function wo(r){let t=new Map;if(r)for(let e,n,i=-1,s=Math.trunc(r.customMetadataLength());++i<s;)(e=r.customMetadata(i))&&(n=e.key())!=null&&t.set(n,e.value());return t}function iu(r){return new It(r.isSigned(),r.bitWidth())}function su(r,t){let e=r.typeType();switch(e){case mt.NONE:return new $t;case mt.Null:return new $t;case mt.Binary:return new nr;case mt.Utf8:return new ir;case mt.Bool:return new sr;case mt.List:return new Te((t||[])[0]);case mt.Struct_:return new lt(t||[])}switch(e){case mt.Int:{let n=r.type(new Me);return new It(n.isSigned(),n.bitWidth())}case mt.FloatingPoint:{let n=r.type(new Lr);return new Jt(n.precision())}case mt.Decimal:{let n=r.type(new Ge);return new or(n.scale(),n.precision(),n.bitWidth())}case mt.Date:{let n=r.type(new Rr);return new ar(n.unit())}case mt.Time:{let n=r.type(new hr);return new Ae(n.unit(),n.bitWidth())}case mt.Timestamp:{let n=r.type(new pr);return new cr(n.unit(),n.timezone())}case mt.Interval:{let n=r.type(new kr);return new lr(n.unit())}case mt.Union:{let n=r.type(new Ue);return new xe(n.mode(),n.typeIdsArray()||[],t||[])}case mt.FixedSizeBinary:{let n=r.type(new Ur);return new ur(n.byteWidth())}case mt.FixedSizeList:{let n=r.type(new Nr);return new De(n.listSize(),(t||[])[0])}case mt.Map:{let n=r.type(new Cr);return new Ee((t||[])[0],n.keysSorted())}}throw new Error('Unrecognized type: "'.concat(mt[e],'" (').concat(e,")"))}function Nm(r,t){let e=t.fields.map(s=>Y.encode(r,s));qt.startFieldsVector(r,e.length);let n=qt.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?qt.createCustomMetadataVector(r,[...t.metadata].map(([s,o])=>{let a=r.createString("".concat(s)),l=r.createString("".concat(o));return Dt.startKeyValue(r),Dt.addKey(r,a),Dt.addValue(r,l),Dt.endKeyValue(r)})):-1;return qt.startSchema(r),qt.addFields(r,n),qt.addEndianness(r,Hm?Or.Little:Or.Big),i!==-1&&qt.addCustomMetadata(r,i),qt.endSchema(r)}function Lm(r,t){let e=-1,n=-1,i=-1,s=t.type,o=t.typeId;D.isDictionary(s)?(o=s.dictionary.typeId,i=bo.visit(s,r),n=bo.visit(s.dictionary,r)):n=bo.visit(s,r);let a=(s.children||[]).map(m=>Y.encode(r,m)),l=Vt.createChildrenVector(r,a),f=t.metadata&&t.metadata.size>0?Vt.createCustomMetadataVector(r,[...t.metadata].map(([m,_])=>{let w=r.createString("".concat(m)),B=r.createString("".concat(_));return Dt.startKeyValue(r),Dt.addKey(r,w),Dt.addValue(r,B),Dt.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),Vt.startField(r),Vt.addType(r,n),Vt.addTypeType(r,o),Vt.addChildren(r,l),Vt.addNullable(r,!!t.nullable),e!==-1&&Vt.addName(r,e),i!==-1&&Vt.addDictionary(r,i),f!==-1&&Vt.addCustomMetadata(r,f),Vt.endField(r)}function km(r,t){let e=t.nodes||[],n=t.buffers||[];le.startNodesVector(r,e.length);for(let o of e.slice().reverse())Le.encode(r,o);let i=r.endVector();le.startBuffersVector(r,n.length);for(let o of n.slice().reverse())Qt.encode(r,o);let s=r.endVector();return le.startRecordBatch(r),le.addLength(r,BigInt(t.length)),le.addNodes(r,i),le.addBuffers(r,s),le.endRecordBatch(r)}function Cm(r,t){let e=kt.encode(r,t.data);return Sr.startDictionaryBatch(r),Sr.addId(r,BigInt(t.id)),Sr.addIsDelta(r,t.isDelta),Sr.addData(r,e),Sr.endDictionaryBatch(r)}function Pm(r,t){return kn.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function Vm(r,t){return Ln.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var Hm=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var Ca=r=>"Expected ".concat(Q[r]," Message in stream, but was null or length 0."),Pa=r=>"Header pointer of flatbuffer-encoded ".concat(Q[r]," Message is null or length 0."),ou=(r,t)=>"Expected to read ".concat(r," metadata bytes, but only read ").concat(t,"."),au=(r,t)=>"Expected to read ".concat(r," bytes for message body, but only read ").concat(t,"."),Pn=class{constructor(t){this.source=t instanceof Je?t:new Je(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?ut:t.value===-1&&(t=this.readMetadataLength()).done?ut:(t=this.readMetadata(t.value)).done?ut:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Ca(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=L(this.source.read(t));if(e.byteLength<t)throw new Error(au(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=Q.Schema,n=this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(Pa(e));return i}readMetadataLength(){let t=this.source.read(vo),e=t&&new ae(t),n=(e==null?void 0:e.readInt32(0))||0;return{done:n===0,value:n}}readMetadata(t){let e=this.source.read(t);if(!e)return ut;if(e.byteLength<t)throw new Error(ou(t,e.byteLength));return{done:!1,value:ee.decode(e)}}},zi=class{constructor(t,e){this.source=t instanceof _e?t:ss(t)?new Pr(t,e):new _e(t)}[Symbol.asyncIterator](){return this}next(){return F(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?ut:t.value===-1&&(t=yield this.readMetadataLength()).done?ut:(t=yield this.readMetadata(t.value)).done?ut:t})}throw(t){return F(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return F(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return F(this,void 0,void 0,function*(){let e;if((e=yield this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Ca(t));return e.value})}readMessageBody(t){return F(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=L(yield this.source.read(t));if(e.byteLength<t)throw new Error(au(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(t=!1){return F(this,void 0,void 0,function*(){let e=Q.Schema,n=yield this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(Pa(e));return i})}readMetadataLength(){return F(this,void 0,void 0,function*(){let t=yield this.source.read(vo),e=t&&new ae(t),n=(e==null?void 0:e.readInt32(0))||0;return{done:n===0,value:n}})}readMetadata(t){return F(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return ut;if(e.byteLength<t)throw new Error(ou(t,e.byteLength));return{done:!1,value:ee.decode(e)}})}},ji=class extends Pn{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof _i?t:new _i(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:ee.fromJSON(t.schema,Q.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:ee.fromJSON(e,Q.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:ee.fromJSON(e,Q.RecordBatch)}}return this._body=[],ut}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((i,s)=>[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE&&[s.TYPE]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...e(s.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Ca(t));return e.value}readSchema(){let t=Q.Schema,e=this.readMessage(t),n=e==null?void 0:e.header();if(!e||!n)throw new Error(Pa(t));return n}},vo=4,ka="ARROW1",Vn=new Uint8Array(ka.length);for(let r=0;r<ka.length;r+=1)Vn[r]=ka.codePointAt(r);function So(r,t=0){for(let e=-1,n=Vn.length;++e<n;)if(Vn[e]!==r[t+e])return!1;return!0}var Hn=Vn.length,Va=Hn+vo,cu=Hn*2+vo;var Ct=class r extends rn{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let e=this._impl.open(t);return Se(e)?e.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Ut.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Ut.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof r?t:ns(t)?jm(t):ss(t)?Ym(t):Se(t)?(()=>F(this,void 0,void 0,function*(){return yield r.from(yield t)}))():os(t)||Jn(t)||cs(t)||he(t)?$m(new _e(t)):Wm(new Je(t))}static readAll(t){return t instanceof r?t.isSync()?lu(t):uu(t):ns(t)||ArrayBuffer.isView(t)||Ie(t)||is(t)?lu(t):uu(t)}},Ze=class extends Ct{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return re(this,arguments,function*(){yield C(yield*Kr(bn(ve(this[Symbol.iterator]()))))})}},Vr=class extends Ct{constructor(t){super(t),this._impl=t}readAll(){var t,e,n,i;return F(this,void 0,void 0,function*(){let s=new Array;try{for(var o=!0,a=ve(this),l;l=yield a.next(),t=l.done,!t;o=!0){i=l.value,o=!1;let f=i;s.push(f)}}catch(f){e={error:f}}finally{try{!o&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(e)throw e.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Hr=class extends Ze{constructor(t){super(t),this._impl=t}},Wi=class extends Vr{constructor(t){super(t),this._impl=t}},Io=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){let n=this._loadVectors(t,e,this.schema.fields),i=P({type:new lt(this.schema.fields),length:t.length,children:n});return new wt(this.schema,i)}_loadDictionaryBatch(t,e){let{id:n,isDelta:i}=t,{dictionaries:s,schema:o}=this,a=s.get(n);if(i||!a){let l=o.dictionaries.get(n),f=this._loadVectors(t.data,e,[l]);return(a&&i?a.concat(new G(f)):new G(f)).memoize()}return a.memoize()}_loadVectors(t,e,n){return new vi(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}},zn=class extends Io{constructor(t,e){super(e),this._reader=ns(t)?new ji(this._handle=t):new Pn(this._handle=t)}isSync(){return!0}isStream(){return!0}[Symbol.iterator](){return this}cancel(){!this.closed&&(this.closed=!0)&&(this.reset()._reader.return(),this._reader=null,this.dictionaries=null)}open(t){return this.closed||(this.autoDestroy=du(this,t),this.schema||(this.schema=this._reader.readSchema())||this.cancel()),this}throw(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.throw(t):ut}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):ut}next(){if(this.closed)return ut;let t,{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new ln(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},jn=class extends Io{constructor(t,e){super(e),this._reader=new zi(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return F(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return F(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=du(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return F(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):ut})}return(t){return F(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):ut})}next(){return F(this,void 0,void 0,function*(){if(this.closed)return ut;let t,{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new ln(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return F(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Fo=class extends zn{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,e){super(t instanceof bi?t:new bi(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(Q.RecordBatch);if(i!=null&&i.isRecordBatch()){let s=i.header(),o=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(t){var e;let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(Q.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){let s=i.header(),o=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}}_readFooter(){let{_handle:t}=this,e=t.size-Va,n=t.readInt32(e),i=t.readAt(e-n,n);return mr.decode(i)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},Ha=class extends jn{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...e){let n=typeof e[0]!="number"?e.shift():void 0,i=e[0]instanceof Map?e.shift():void 0;super(t instanceof Pr?t:new Pr(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return F(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){var e;return F(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(Q.RecordBatch);if(i!=null&&i.isRecordBatch()){let s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){var e;return F(this,void 0,void 0,function*(){let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(Q.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){let s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}})}_readFooter(){return F(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-Va,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return mr.decode(i)})}_readNextMessageAndValidate(t){return F(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null})}},za=class extends zn{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new Xs(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}};function du(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*lu(r){let t=Ct.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function uu(r){return re(this,arguments,function*(){let e=yield C(Ct.from(r));try{if(!(yield C(e.open({autoDestroy:!1}))).closed)do yield yield C(e);while(!(yield C(e.reset().open())).closed)}finally{yield C(e.cancel())}})}function jm(r){return new Ze(new za(r))}function Wm(r){let t=r.peek(Hn+7&-8);return t&&t.byteLength>=4?So(t)?new Hr(new Fo(r.read())):new Ze(new zn(r)):new Ze(new zn(function*(){}()))}function $m(r){return F(this,void 0,void 0,function*(){let t=yield r.peek(Hn+7&-8);return t&&t.byteLength>=4?So(t)?new Hr(new Fo(yield r.read())):new Vr(new jn(r)):new Vr(new jn(function(){return re(this,arguments,function*(){})}()))})}function Ym(r){return F(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new Pr(r,t);return t>=cu&&So(yield e.readAt(0,Hn+7&-8))?new Wi(new Ha(e)):new Vr(new jn(e))})}var Ft=class r extends E{static assemble(...t){let e=i=>i.flatMap(s=>Array.isArray(s)?e(s):s instanceof wt?s.data.children:s.data),n=new r;return n.visitMany(e(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof G)return this.visitMany(t.data),this;let{type:e}=t;if(!D.isDictionary(e)){let{length:n,nullCount:i}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");D.isNull(e)||ke.call(this,i<=0?new Uint8Array(0):Tn(t.offset,n,t.nullBitmap)),this.nodes.push(new Le(n,i))}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function ke(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new Qt(this._byteLength,t)),this._byteLength+=t,this}function Xm(r){let{type:t,length:e,typeIds:n,valueOffsets:i}=r;if(ke.call(this,n),t.mode===yt.Sparse)return ja.call(this,r);if(t.mode===yt.Dense){if(r.offset<=0)return ke.call(this,i),ja.call(this,r);{let s=n.reduce((m,_)=>Math.max(m,_),n[0]),o=new Int32Array(s+1),a=new Int32Array(s+1).fill(-1),l=new Int32Array(e),f=qn(-i[0],e,i);for(let m,_,w=-1;++w<e;)(_=a[m=n[w]])===-1&&(_=a[m]=f[m]),l[w]=f[w]-_,++o[m];ke.call(this,l);for(let m,_=-1,w=t.children.length;++_<w;)if(m=r.children[_]){let B=t.typeIds[_],q=Math.min(e,o[B]);this.visit(m.slice(a[B],q))}}}return this}function Gm(r){let t;return r.nullCount>=r.length?ke.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?ke.call(this,Tn(r.offset,r.length,t)):ke.call(this,Zr(r.values))}function zr(r){return ke.call(this,r.values.subarray(0,r.length*r.stride))}function fu(r){let{length:t,values:e,valueOffsets:n}=r,i=n[0],s=n[t],o=Math.min(s-i,e.byteLength-i);return ke.call(this,qn(-n[0],t,n)),ke.call(this,e.subarray(i,i+o)),this}function Wa(r){let{length:t,valueOffsets:e}=r;return e&&ke.call(this,qn(e[0],t,e)),this.visit(r.children[0])}function ja(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}Ft.prototype.visitBool=Gm;Ft.prototype.visitInt=zr;Ft.prototype.visitFloat=zr;Ft.prototype.visitUtf8=fu;Ft.prototype.visitBinary=fu;Ft.prototype.visitFixedSizeBinary=zr;Ft.prototype.visitDate=zr;Ft.prototype.visitTimestamp=zr;Ft.prototype.visitTime=zr;Ft.prototype.visitDecimal=zr;Ft.prototype.visitList=Wa;Ft.prototype.visitStruct=ja;Ft.prototype.visitUnion=Xm;Ft.prototype.visitInterval=zr;Ft.prototype.visitFixedSizeList=Wa;Ft.prototype.visitMap=Wa;var un=class extends rn{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new Ke,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,jt(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Se(t)?t.then(e=>this.writeAll(e)):he(t)?Ya(this,t):$a(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){return t===this._sink||t instanceof Ke?this._sink=t:(this._sink=new Ke,t&&Lc(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&kc(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!e||!cn(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof Yt&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof wt&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!cn(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof wt?t instanceof ln||this._writeRecordBatch(t):t instanceof Yt?this.writeAll(t.batches):Ie(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=ee.encode(t),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+n&~n,l=a-s-o;return t.headerType===Q.RecordBatch?this._recordBatchBlocks.push(new yr(a,t.bodyLength,this._position)):t.headerType===Q.DictionaryBatch&&this._dictionaryBlocks.push(new yr(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),s>0&&this._write(i),this._writePadding(l)}_write(t){if(this._started){let e=L(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(ee.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Vn)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:s}=Ft.assemble(t),o=new kt(t.numRows,n,i),a=ee.from(o,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(t,e,n=!1){this._dictionaryDeltaOffsets.set(e,t.length+(this._dictionaryDeltaOffsets.get(e)||0));let{byteLength:i,nodes:s,bufferRegions:o,buffers:a}=Ft.assemble(new G([t])),l=new kt(t.length,s,o),f=new te(l,e,n),m=ee.from(f,i);return this._writeMessage(m)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,n,i;for(let s=-1,o=t.length;++s<o;)(e=t[s])&&(n=e.byteLength)>0&&(this._write(e),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){for(let[e,n]of t.dictionaries){let i=this._dictionaryDeltaOffsets.get(e)||0;if(i===0||(n=n==null?void 0:n.slice(i)).length>0)for(let s of n.data)this._writeDictionaryBatch(s,e,i>0),i+=s.length}return this}},dn=class r extends un{static writeAll(t,e){let n=new r(e);return Se(t)?t.then(i=>n.writeAll(i)):he(t)?Ya(n,t):$a(n,t)}},fn=class r extends un{static writeAll(t){let e=new r;return Se(t)?t.then(n=>e.writeAll(n)):he(t)?Ya(e,t):$a(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let e=mr.encode(new mr(t,Ot.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function $a(r,t){let e=t;t instanceof Yt&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function Ya(r,t){var e,n,i,s,o,a,l;return F(this,void 0,void 0,function*(){try{for(e=!0,n=ve(t);i=yield n.next(),s=i.done,!s;e=!0){l=i.value,e=!1;let f=l;r.write(f)}}catch(f){o={error:f}}finally{try{!e&&!s&&(a=n.return)&&(yield a.call(n))}finally{if(o)throw o.error}}return r.finish()})}function hu(r,t){if(he(r))return Jm(r,t);if(Ie(r))return Km(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function Km(r,t){let e=null,n=(t==null?void 0:t.type)==="bytes"||!1,i=(t==null?void 0:t.highWaterMark)||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){s(o,e||(e=r[Symbol.iterator]()))},pull(o){e?s(o,e):o.close()},cancel(){(e!=null&&e.return&&e.return()||!0)&&(e=null)}}),Object.assign({highWaterMark:n?i:void 0},t));function s(o,a){let l,f=null,m=o.desiredSize||null;for(;!(f=a.next(n?m:null)).done;)if(ArrayBuffer.isView(f.value)&&(l=L(f.value))&&(m!=null&&n&&(m=m-l.byteLength+1),f.value=l),o.enqueue(f.value),m!=null&&--m<=0)return;o.close()}}function Jm(r,t){let e=null,n=(t==null?void 0:t.type)==="bytes"||!1,i=(t==null?void 0:t.highWaterMark)||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(o){return F(this,void 0,void 0,function*(){yield s(o,e||(e=r[Symbol.asyncIterator]()))})},pull(o){return F(this,void 0,void 0,function*(){e?yield s(o,e):o.close()})},cancel(){return F(this,void 0,void 0,function*(){(e!=null&&e.return&&(yield e.return())||!0)&&(e=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function s(o,a){return F(this,void 0,void 0,function*(){let l,f=null,m=o.desiredSize||null;for(;!(f=yield a.next(n?m:null)).done;)if(ArrayBuffer.isView(f.value)&&(l=L(f.value))&&(m!=null&&n&&(m=m-l.byteLength+1),f.value=l),o.enqueue(f.value),m!=null&&--m<=0)return;o.close()})}}function yu(r){return new Xa(r)}var Xa=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,s=Uc(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=sn(s),this._getSize=i!=="bytes"?pu:mu;let{["highWaterMark"]:o=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},e),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:l=>{this._maybeFlush(this._builder,this._controller=l)},start:l=>{this._maybeFlush(this._builder,this._controller=l)}},{highWaterMark:o,size:i!=="bytes"?pu:mu}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:l=>this._writeValueAndReturnChunkSize(l)})}_writeValueAndReturnChunkSize(t){let e=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-e}_maybeFlush(t,e){e!=null&&(this._bufferedSize>=e.desiredSize&&++this._numChunks&&this._enqueue(e,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(e,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(e,null)))}_enqueue(t,e){this._bufferedSize=0,this._controller=null,e==null?t.close():t.enqueue(e)}},pu=r=>{var t;return(t=r==null?void 0:r.length)!==null&&t!==void 0?t:0},mu=r=>{var t;return(t=r==null?void 0:r.byteLength)!==null&&t!==void 0?t:0};function Bo(r,t){let e=new Ke,n=null,i=new ReadableStream({cancel(){return F(this,void 0,void 0,function*(){yield e.close()})},start(a){return F(this,void 0,void 0,function*(){yield o(a,n||(n=yield s()))})},pull(a){return F(this,void 0,void 0,function*(){n?yield o(a,n):a.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:i};function s(){return F(this,void 0,void 0,function*(){return yield(yield Ct.from(e)).open(t)})}function o(a,l){return F(this,void 0,void 0,function*(){let f=a.desiredSize,m=null;for(;!(m=yield l.next()).done;)if(a.enqueue(m.value),f!=null&&--f<=0)return;a.close()})}}function Ao(r,t){let e=new this(r),n=new _e(e),i=new ReadableStream({cancel(){return F(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return F(this,void 0,void 0,function*(){yield s(o)})},start(o){return F(this,void 0,void 0,function*(){yield s(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(e,r),readable:i};function s(o){return F(this,void 0,void 0,function*(){let a=null,l=o.desiredSize;for(;a=yield n.read(l||null);)if(o.enqueue(a),l!=null&&(l-=a.byteLength)<=0)return;o.close()})}}function To(r,t="stream"){return(t==="stream"?dn:fn).writeAll(r).toUint8Array(!0)}var ty=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},sa),Ea),va),oa),ea),wa),{compareSchemas:cn,compareFields:jl,compareTypes:Wl});Ut.toDOMStream=hu;pt.throughDOM=yu;Ct.throughDOM=Bo;Hr.throughDOM=Bo;Ze.throughDOM=Bo;un.throughDOM=Ao;fn.throughDOM=Ao;dn.throughDOM=Ao;function Wn(r){switch(r.typeId){case h.Binary:return{sqlType:"binary"};case h.Bool:return{sqlType:"bool"};case h.Date:return{sqlType:"date"};case h.DateDay:return{sqlType:"date32[d]"};case h.DateMillisecond:return{sqlType:"date64[ms]"};case h.Decimal:{let t=r;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case h.Float:return{sqlType:"float"};case h.Float16:return{sqlType:"float16"};case h.Float32:return{sqlType:"float32"};case h.Float64:return{sqlType:"float64"};case h.Int:return{sqlType:"int32"};case h.Int16:return{sqlType:"int16"};case h.Int32:return{sqlType:"int32"};case h.Int64:return{sqlType:"int64"};case h.Uint16:return{sqlType:"uint16"};case h.Uint32:return{sqlType:"uint32"};case h.Uint64:return{sqlType:"uint64"};case h.Uint8:return{sqlType:"uint8"};case h.IntervalDayTime:return{sqlType:"interval[dt]"};case h.IntervalYearMonth:return{sqlType:"interval[m]"};case h.List:return{sqlType:"list",valueType:Wn(r.valueType)};case h.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:r.byteWidth};case h.Null:return{sqlType:"null"};case h.Utf8:return{sqlType:"utf8"};case h.Struct:return{sqlType:"struct",fields:r.children.map(e=>xo(e.name,e.type))};case h.Map:{let t=r;return{sqlType:"map",keyType:Wn(t.keyType),valueType:Wn(t.valueType)}}case h.Time:return{sqlType:"time[s]"};case h.TimeMicrosecond:return{sqlType:"time[us]"};case h.TimeMillisecond:return{sqlType:"time[ms]"};case h.TimeNanosecond:return{sqlType:"time[ns]"};case h.TimeSecond:return{sqlType:"time[s]"};case h.Timestamp:return{sqlType:"timestamp",timezone:r.timezone||void 0};case h.TimestampSecond:return{sqlType:"timestamp[s]",timezone:r.timezone||void 0};case h.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:r.timezone||void 0};case h.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:r.timezone||void 0};case h.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:r.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(r.toString()))}function xo(r,t){let e=Wn(t);return e.name=r,e}var Do=class{constructor(){this._bindings=null;this._nextMessageId=0}log(t){this.postMessage({messageId:this._nextMessageId++,requestId:0,type:"LOG",data:t},[])}sendOK(t){this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"OK",data:null},[])}failWith(t,e){let n={name:e.name,message:e.message,stack:e.stack||void 0};this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"ERROR",data:n},[])}async onMessage(t){switch(t.type){case"PING":this.sendOK(t);return;case"INSTANTIATE":this._bindings!=null&&this.failWith(t,new Error("duckdb already initialized"));try{this._bindings=await this.instantiate(t.data[0],t.data[1],e=>{this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"INSTANTIATE_PROGRESS",data:e},[])}),this.sendOK(t)}catch(e){console.log(e),this._bindings=null,this.failWith(t,e)}return;default:break}if(!this._bindings)return this.failWith(t,new Error("duckdb is not initialized"));try{switch(t.type){case"GET_VERSION":this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"VERSION_STRING",data:this._bindings.getVersion()},[]);break;case"GET_FEATURE_FLAGS":this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FEATURE_FLAGS",data:this._bindings.getFeatureFlags()},[]);break;case"RESET":this._bindings.reset(),this.sendOK(t);break;case"OPEN":this._bindings.open(t.data),this.sendOK(t);break;case"DROP_FILE":this._bindings.dropFile(t.data),this.sendOK(t);break;case"DROP_FILES":this._bindings.dropFiles(),this.sendOK(t);break;case"FLUSH_FILES":this._bindings.flushFiles(),this.sendOK(t);break;case"CONNECT":{let e=this._bindings.connect();this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"CONNECTION_INFO",data:e.useUnsafe((n,i)=>i)},[]);break}case"DISCONNECT":this._bindings.disconnect(t.data),this.sendOK(t);break;case"CREATE_PREPARED":{let e=this._bindings.createPrepared(t.data[0],t.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"PREPARED_STATEMENT_ID",data:e},[]);break}case"CLOSE_PREPARED":{this._bindings.closePrepared(t.data[0],t.data[1]),this.sendOK(t);break}case"RUN_PREPARED":{let e=this._bindings.runPrepared(t.data[0],t.data[1],t.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT",data:e},[e.buffer]);break}case"RUN_QUERY":{let e=this._bindings.runQuery(t.data[0],t.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT",data:e},[e.buffer]);break}case"SEND_PREPARED":{let e=this._bindings.sendPrepared(t.data[0],t.data[1],t.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_HEADER",data:e},[e.buffer]);break}case"START_PENDING_QUERY":{let e=this._bindings.startPendingQuery(t.data[0],t.data[1]),n=[];e&&n.push(e.buffer),this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_HEADER_OR_NULL",data:e},n);break}case"POLL_PENDING_QUERY":{let e=this._bindings.pollPendingQuery(t.data),n=[];e&&n.push(e.buffer),this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_HEADER_OR_NULL",data:e},n);break}case"CANCEL_PENDING_QUERY":{let e=this._bindings.cancelPendingQuery(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"SUCCESS",data:e},[]);break}case"FETCH_QUERY_RESULTS":{let e=this._bindings.fetchQueryResults(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_CHUNK",data:e},[e.buffer]);break}case"GET_TABLE_NAMES":{let e=this._bindings.getTableNames(t.data[0],t.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"TABLE_NAMES",data:e},[]);break}case"GLOB_FILE_INFOS":{let e=this._bindings.globFiles(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FILE_INFOS",data:e},[]);break}case"REGISTER_FILE_URL":this._bindings.registerFileURL(t.data[0],t.data[1],t.data[2],t.data[3]),this.sendOK(t);break;case"REGISTER_FILE_BUFFER":this._bindings.registerFileBuffer(t.data[0],t.data[1]),this.sendOK(t);break;case"REGISTER_FILE_HANDLE":this._bindings.registerFileHandle(t.data[0],t.data[1],t.data[2],t.data[3]),this.sendOK(t);break;case"COPY_FILE_TO_PATH":this._bindings.copyFileToPath(t.data[0],t.data[1]),this.sendOK(t);break;case"COPY_FILE_TO_BUFFER":{let e=this._bindings.copyFileToBuffer(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FILE_BUFFER",data:e},[]);break}case"COLLECT_FILE_STATISTICS":this._bindings.collectFileStatistics(t.data[0],t.data[1]),this.sendOK(t);break;case"EXPORT_FILE_STATISTICS":{this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"FILE_STATISTICS",data:this._bindings.exportFileStatistics(t.data)},[]);break}case"INSERT_ARROW_FROM_IPC_STREAM":{this._bindings.insertArrowFromIPCStream(t.data[0],t.data[1],t.data[2]),this.sendOK(t);break}case"IMPORT_CSV_FROM_PATH":{this._bindings.insertCSVFromPath(t.data[0],t.data[1],t.data[2]),this.sendOK(t);break}case"IMPORT_JSON_FROM_PATH":{this._bindings.insertJSONFromPath(t.data[0],t.data[1],t.data[2]),this.sendOK(t);break}case"TOKENIZE":{let e=this._bindings.tokenize(t.data);this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"SCRIPT_TOKENS",data:e},[]);break}}}catch(e){return console.log(e),this.failWith(t,e)}}};var Tu=Rc(Su());var Eo=class{constructor(t,e){this._bindings=t,this._conn=e}close(){this._bindings.disconnect(this._conn)}useUnsafe(t){return t(this._bindings,this._conn)}query(t){let e=this._bindings.runQuery(this._conn,t),n=Ct.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new Yt(n)}async send(t){let e=this._bindings.startPendingQuery(this._conn,t);for(;e==null;)e=await new Promise((s,o)=>{try{s(this._bindings.pollPendingQuery(this._conn))}catch(a){console.log(a),o(a)}});let n=new Oo(this._bindings,this._conn,e),i=Ct.from(n);return console.assert(i.isSync()),console.assert(i.isStream()),i}cancelSent(){return this._bindings.cancelPendingQuery(this._conn)}getTableNames(t){return this._bindings.getTableNames(this._conn,t)}prepare(t){let e=this._bindings.createPrepared(this._conn,t);return new Ka(this._bindings,this._conn,e)}createScalarFunction(t,e,n){this._bindings.createScalarFunction(this._conn,t,e,n)}insertArrowTable(t,e){let n=To(t,"stream");this.insertArrowFromIPCStream(n,e)}insertArrowFromIPCStream(t,e){this._bindings.insertArrowFromIPCStream(this._conn,t,e)}insertCSVFromPath(t,e){this._bindings.insertCSVFromPath(this._conn,t,e)}insertJSONFromPath(t,e){this._bindings.insertJSONFromPath(this._conn,t,e)}},Oo=class{constructor(t,e,n){this.bindings=t;this.conn=e;this.header=n;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=this.bindings.fetchQueryResults(this.conn);return this._depleted=t.length==0,{done:this._depleted,value:t}}[Symbol.iterator](){return this}},Ka=class{constructor(t,e,n){this.bindings=t,this.connectionId=e,this.statementId=n}close(){this.bindings.closePrepared(this.connectionId,this.statementId)}query(...t){let e=this.bindings.runPrepared(this.connectionId,this.statementId,t),n=Ct.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new Yt(n)}send(...t){let e=this.bindings.sendPrepared(this.connectionId,this.statementId,t),n=new Oo(this.bindings,this.connectionId,e),i=Ct.from(n);return console.assert(i.isSync()),console.assert(i.isStream()),i}};var Bu=new TextEncoder,Iu=new TextDecoder("utf-8");function Ja(r,t,e){let n=Bu.encode(e),i=r._malloc(n.byteLength),s=r.HEAPU8.subarray(i,i+n.byteLength);s.set(n),r.HEAPF64[(t>>3)+0]=1,r.HEAPF64[(t>>3)+1]=i,r.HEAPF64[(t>>3)+2]=s.byteLength}function Za(r){switch(r){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 qa(r,t,e,n){let i=r.HEAPU8.subarray(t,t+n*Za(e));switch(e){case"UINT8":return new Uint8Array(i.buffer,i.byteOffset,n);case"INT8":return new Int8Array(i.buffer,i.byteOffset,n);case"INT32":return new Int32Array(i.buffer,i.byteOffset,n);case"FLOAT":return new Float32Array(i.buffer,i.byteOffset,n);case"DOUBLE":return new Float64Array(i.buffer,i.byteOffset,n);case"VARCHAR":return new Float64Array(i.buffer,i.byteOffset,n);default:return new Array(0)}}function Fu(r,t,e){let n=r.HEAPU8.subarray(t,t+e);return new Uint8Array(n.buffer,n.byteOffset,e)}function Ro(r,t,e){let n=r.HEAPU8.subarray(t,t+e*8);return new Float64Array(n.buffer,n.byteOffset,e)}function Au(r,t,e,n,i,s,o,a){try{let l=r._udfFunctions.get(n);if(!l){Ja(t,e,"Unknown UDF with id: "+n);return}let f=Iu.decode(t.HEAPU8.subarray(i,i+s)),m=JSON.parse(f),_=Ro(t,o,a/8),w=J=>{var Mt;let Pt=null;switch(J.validityBuffer!==void 0&&(Pt=Fu(t,_[J.validityBuffer],m.rows)),J.physicalType){case"VARCHAR":{if(J.dataBuffer===null||J.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for VARCHAR argument");if(J.lengthBuffer===null||J.lengthBuffer===void 0)throw new Error("malformed data view, expected data length buffer for VARCHAR argument");let bt=qa(t,_[J.dataBuffer],J.physicalType,m.rows),St=[],Et=Ro(t,_[J.lengthBuffer],m.rows);for(let g=0;g<m.rows;++g){if(Pt!=null&&!Pt[g]){St.push(null);continue}let ft=t.HEAPU8.subarray(bt[g],bt[g]+Et[g]),pn=Iu.decode(ft);St.push(pn)}return g=>St[g]}case"STRUCT":{let bt={},St=[];for(let Et=0;Et<(((Mt=J.children)==null?void 0:Mt.length)||0);++Et){let g=J.children[Et],ft=w(g);St.push(pn=>{bt[g.name]=ft(pn)})}return Pt!=null?Et=>{if(!Pt[Et])return null;for(let g of St)g(Et);return bt}:Et=>{for(let g of St)g(Et);return bt}}default:{if(J.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for argument of type: "+J.physicalType);let bt=qa(t,_[J.dataBuffer],J.physicalType,m.rows);return Pt!=null?St=>Pt[St]?bt[St]:null:St=>bt[St]}}},B=[];for(let J=0;J<m.args.length;++J)B.push(w(m.args[J]));let q=m.rows*Za(m.ret.physicalType),vt=t._malloc(q),Bt=qa(t,vt,m.ret.physicalType,m.rows),Tt=t._malloc(m.rows),Ht=Fu(t,Tt,m.rows);if(Bt.length==0||Ht.length==0){Ja(t,e,"Can't create physical arrays for result");return}let ue=Bt;m.ret.physicalType=="VARCHAR"&&(ue=new Array(m.rows));let Ce=[];for(let J=0;J<m.args.length;++J)Ce.push(null);for(let J=0;J<m.rows;++J){for(let Mt=0;Mt<m.args.length;++Mt)Ce[Mt]=B[Mt](J);let Pt=l.func(...Ce);ue[J]=Pt,Ht[J]=Pt==null?0:1}let er=0;switch(m.ret.physicalType){case"VARCHAR":{let J=new Array(0);er=t._malloc(m.rows*Za("DOUBLE"));let Pt=Ro(t,er,m.rows),Mt=0;for(let g=0;g<m.rows;++g){let ft=Bu.encode(ue[g]||"");J.push(ft),Pt[g]=ft.length,Mt+=ft.length}let bt=t._malloc(Mt),St=t.HEAPU8.subarray(bt,bt+Mt),Et=0;for(let g=0;g<m.rows;++g){Bt[g]=Et;let ft=J[g];St.subarray(Et,Et+ft.length).set(ft),Et+=ft.length}}}let ko=3*8,Wr=t._malloc(ko),$r=Ro(t,Wr,3);$r[0]=vt,$r[1]=Tt,$r[2]=er,t.HEAPF64[(e>>3)+0]=0,t.HEAPF64[(e>>3)+1]=Wr,t.HEAPF64[(e>>3)+2]=0}catch(l){Ja(t,e,l.toString())}}function ry(){let r=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),r.decode(t))}var ny=ry();function ge(r,t){console.error("FAIL WITH: ".concat(t)),r.ccall("duckdb_web_fail_with",null,["string"],[t])}function hn(r,t,e){let n=r.HEAPU8.subarray(t,t+e),i=new Uint8Array(new ArrayBuffer(n.byteLength));return i.set(n),i}function z(r,t,e){return ny(r.HEAPU8.subarray(t,t+e))}function nt(r,t,e,n){let i=r.stackSave(),s=r.stackAlloc(3*8);e.unshift("number"),n.unshift(s),r.ccall(t,null,e,n);let o=r.HEAPF64[(s>>3)+0],a=r.HEAPF64[(s>>3)+1],l=r.HEAPF64[(s>>3)+2];return r.stackRestore(i),[o,a,l]}function dt(r){r.ccall("duckdb_web_clear_response",null,[],[])}var Mo=class{constructor(t){let e=new Float64Array(t.buffer,t.byteOffset,t.byteLength/8),n=new Uint8Array(new ArrayBuffer(t.byteLength));n.set(t.subarray(7*8)),this.totalFileReadsCold=e[0],this.totalFileReadsAhead=e[1],this.totalFileReadsCached=e[2],this.totalFileWrites=e[3],this.totalPageAccesses=e[4],this.totalPageLoads=e[5],this.blockSize=e[6],this.blockStats=n}getBlockStats(t,e){return e=e||{file_reads_cold:0,file_reads_ahead:0,file_reads_cached:0,file_writes:0,page_accesses:0,page_loads:0},e.file_writes=this.blockStats[t*3+0]&15,e.file_reads_cold=this.blockStats[t*3+0]>>4,e.file_reads_ahead=this.blockStats[t*3+1]&15,e.file_reads_cached=this.blockStats[t*3+1]>>4,e.page_accesses=this.blockStats[t*3+1]&15,e.page_loads=this.blockStats[t*3+1]>>4,e}};var iy=new TextEncoder;var Uo=class{constructor(t,e){this._instance=null;this._initPromise=null;this._initPromiseResolver=()=>{};this.onInstantiationProgress=[];this._logger=t,this._runtime=e,this._nextUDFId=1}get logger(){return this._logger}get mod(){return this._instance}get pthread(){return this.mod.PThread||null}async instantiate(t=e=>{}){return this._instance!=null?this:(this._initPromise!=null&&(this.onInstantiationProgress.push(t),await this._initPromise),this._initPromise=new Promise(e=>{this._initPromiseResolver=e}),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(e=>e!=t),this)}open(t){let[e,n,i]=nt(this.mod,"duckdb_web_open",["string"],[JSON.stringify(t)]);if(e!==0)throw new Error(z(this.mod,n,i));dt(this.mod)}reset(){let[t,e,n]=nt(this.mod,"duckdb_web_reset",[],[]);if(t!==0)throw new Error(z(this.mod,e,n));dt(this.mod)}getVersion(){let[t,e,n]=nt(this.mod,"duckdb_web_get_version",[],[]);if(t!==0)throw new Error(z(this.mod,e,n));let i=z(this.mod,e,n);return dt(this.mod),i}getFeatureFlags(){return this.mod.ccall("duckdb_web_get_feature_flags","number",[],[])}tokenize(t){let[e,n,i]=nt(this.mod,"duckdb_web_tokenize",["string"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));let s=z(this.mod,n,i);return dt(this.mod),JSON.parse(s)}connect(){let t=this.mod.ccall("duckdb_web_connect","number",[],[]);return new Eo(this,t)}disconnect(t){if(this.mod.ccall("duckdb_web_disconnect",null,["number"],[t]),this.pthread)for(let e of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])e.postMessage({cmd:"dropUDFFunctions",connectionId:t})}runQuery(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_query_run",["number","string"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s));let o=hn(this.mod,i,s);return dt(this.mod),o}startPendingQuery(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_pending_query_start",["number","string"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s));if(i==0)return null;let o=hn(this.mod,i,s);return dt(this.mod),o}pollPendingQuery(t){let[e,n,i]=nt(this.mod,"duckdb_web_pending_query_poll",["number"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));if(n==0)return null;let s=hn(this.mod,n,i);return dt(this.mod),s}cancelPendingQuery(t){return this.mod.ccall("duckdb_web_pending_query_cancel","boolean",["number"],[t])}fetchQueryResults(t){let[e,n,i]=nt(this.mod,"duckdb_web_query_fetch_results",["number"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));let s=hn(this.mod,n,i);return dt(this.mod),s}getTableNames(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_get_tablenames",["number","string"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s));let o=z(this.mod,i,s);return dt(this.mod),JSON.parse(o)}createScalarFunction(t,e,n,i){let s={functionId:this._nextUDFId,name:e,returnType:Wn(n)},o={functionId:s.functionId,connectionId:t,name:e,returnType:n,func:i};this._nextUDFId+=1;let[a,l,f]=nt(this.mod,"duckdb_web_udf_scalar_create",["number","string"],[t,JSON.stringify(s)]);if(a!==0)throw new Error(z(this.mod,l,f));if(dt(this.mod),globalThis.DUCKDB_RUNTIME._udfFunctions=(globalThis.DUCKDB_RUNTIME._udfFunctions||new Map).set(o.functionId,o),this.pthread)for(let m of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])m.postMessage({cmd:"registerUDFFunction",udf:o})}createPrepared(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_prepared_create",["number","string"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s));return dt(this.mod),i}closePrepared(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_prepared_close",["number","number"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s));dt(this.mod)}runPrepared(t,e,n){let[i,s,o]=nt(this.mod,"duckdb_web_prepared_run",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(z(this.mod,s,o));let a=hn(this.mod,s,o);return dt(this.mod),a}sendPrepared(t,e,n){let[i,s,o]=nt(this.mod,"duckdb_web_prepared_send",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(z(this.mod,s,o));let a=hn(this.mod,s,o);return dt(this.mod),a}insertArrowFromIPCStream(t,e,n){if(e.length==0)return;let i=this.mod._malloc(e.length);this.mod.HEAPU8.subarray(i,i+e.length).set(e);let o=n?JSON.stringify(n):"",[a,l,f]=nt(this.mod,"duckdb_web_insert_arrow_from_ipc_stream",["number","number","number","string"],[t,i,e.length,o]);if(a!==0)throw new Error(z(this.mod,l,f))}insertCSVFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let f in n.columns)n.columnsFlat.push(xo(f,n.columns[f]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,a,l]=nt(this.mod,"duckdb_web_insert_csv_from_path",["number","string","string"],[t,e,s]);if(o!==0)throw new Error(z(this.mod,a,l))}insertJSONFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let f in n.columns)n.columnsFlat.push(xo(f,n.columns[f]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,a,l]=nt(this.mod,"duckdb_web_insert_json_from_path",["number","string","string"],[t,e,s]);if(o!==0)throw new Error(z(this.mod,a,l))}globFiles(t){let[e,n,i]=nt(this.mod,"duckdb_web_fs_glob_file_infos",["string"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));let s=z(this.mod,n,i);dt(this.mod);let o=JSON.parse(s);return o==null?[]:o}registerFileURL(t,e,n,i=!1){e===void 0&&(e=t);let[s,o,a]=nt(this.mod,"duckdb_web_fs_register_file_url",["string","string"],[t,e,n,i]);if(s!==0)throw new Error(z(this.mod,o,a));dt(this.mod)}registerFileText(t,e){let n=iy.encode(e);this.registerFileBuffer(t,n)}registerFileBuffer(t,e){let n=this.mod._malloc(e.length);this.mod.HEAPU8.subarray(n,n+e.length).set(e);let[s,o,a]=nt(this.mod,"duckdb_web_fs_register_file_buffer",["string","number","number"],[t,n,e.length]);if(s!==0)throw new Error(z(this.mod,o,a));dt(this.mod)}registerFileHandle(t,e,n,i){let[s,o,a]=nt(this.mod,"duckdb_web_fs_register_file_url",["string","string","number","boolean"],[t,t,n,i]);if(s!==0)throw new Error(z(this.mod,o,a));if(dt(this.mod),globalThis.DUCKDB_RUNTIME._files=(globalThis.DUCKDB_RUNTIME._files||new Map).set(t,e),this.pthread){for(let l of this.pthread.runningWorkers)l.postMessage({cmd:"registerFileHandle",fileName:t,fileHandle:e});for(let l of this.pthread.unusedWorkers)l.postMessage({cmd:"dropFileHandle",fileName:t})}}dropFile(t){let[e,n,i]=nt(this.mod,"duckdb_web_fs_drop_file",["string"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));dt(this.mod)}dropFiles(){let[t,e,n]=nt(this.mod,"duckdb_web_fs_drop_files",[],[]);if(t!==0)throw new Error(z(this.mod,e,n));dt(this.mod)}flushFiles(){this.mod.ccall("duckdb_web_flush_files",null,[],[])}copyFileToPath(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_copy_file_to_path",["string","string"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s));dt(this.mod)}copyFileToBuffer(t){let[e,n,i]=nt(this.mod,"duckdb_web_copy_file_to_buffer",["string"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));let s=this.mod.HEAPU8.subarray(n,n+i),o=new Uint8Array(s.length);return o.set(s),dt(this.mod),o}collectFileStatistics(t,e){let[n,i,s]=nt(this.mod,"duckdb_web_collect_file_stats",["string","boolean"],[t,e]);if(n!==0)throw new Error(z(this.mod,i,s))}exportFileStatistics(t){let[e,n,i]=nt(this.mod,"duckdb_web_export_file_stats",["string"],[t]);if(e!==0)throw new Error(z(this.mod,n,i));return new Mo(this.mod.HEAPU8.subarray(n,n+i))}};var No=class extends Uo{constructor(e,n,i,s){super(e,n);this.mainModuleURL=i,this.pthreadWorkerURL=s}locateFile(e,n){if(e.endsWith(".wasm"))return this.mainModuleURL;if(e.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(n," path=").concat(e))}instantiateWasm(e,n){globalThis.DUCKDB_RUNTIME=this._runtime;let i=this.onInstantiationProgress;if(WebAssembly.instantiateStreaming)if(typeof TransformStream=="function"){let o=(async()=>{var vt;let a=new Request(this.mainModuleURL),l=await fetch(a),f=l.headers.get("content-length"),m=f&&parseInt(f,10)||0,_=new Date,w={startedAt:_,updatedAt:_,bytesTotal:m||0,bytesLoaded:0},B={transform(Bt,Tt){w.bytesLoaded+=Bt.byteLength;let Ht=new Date;if(Ht.getTime()-w.updatedAt.getTime()<20){w.updatedAt=Ht,Tt.enqueue(Bt);return}for(let ue of i)ue(w);Tt.enqueue(Bt)}},q=new TransformStream(B);return new Response((vt=l.body)==null?void 0:vt.pipeThrough(q),l)})();WebAssembly.instantiateStreaming(o,e).then(a=>{n(a.instance,a.module)})}else{console.warn("instantiating without progress handler since transform streams are unavailable");let s=new Request(this.mainModuleURL);WebAssembly.instantiateStreaming(fetch(s),e).then(o=>{n(o.instance,o.module)})}else if(typeof XMLHttpRequest=="function"){let s=new XMLHttpRequest,o=this.mainModuleURL,a=new Date,l={startedAt:a,updatedAt:a,bytesTotal:0,bytesLoaded:0};s.open("GET",o),s.responseType="arraybuffer",s.onerror=f=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to load WASM: "+f}),new Error(f.toString())},s.onprogress=f=>{l.bytesTotal=f.total,l.bytesLoaded=f.loaded;let m=new Date;if(m.getTime()-l.updatedAt.getTime()<20){l.updatedAt=m;return}for(let _ of i)_(l)},s.onload=()=>{WebAssembly.instantiate(s.response,e).then(f=>{n(f.instance,f.module)}).catch(f=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to instantiate WASM: "+f}),new Error(f)})},s.send()}else console.warn("instantiating with manual fetch since streaming instantiation and xhrs are unavailable"),(async()=>{let o=new Request(this.mainModuleURL),l=await(await fetch(o)).arrayBuffer();WebAssembly.instantiate(l,e).then(f=>{n(f.instance,f.module)})})();return[]}};var Lo=class extends No{constructor(t,e,n,i=null){super(t,e,n,i)}instantiateImpl(t){return(0,Tu.default)({...t,instantiateWasm:this.instantiateWasm.bind(this),locateFile:this.locateFile.bind(this)})}};var jr=Rc(xu()),Du=function(r,t,e){var n;if((n=r==null?void 0:r.endpoint)!=null&&n.startsWith("http")){let i="".concat(r==null?void 0:r.endpoint),s=i.indexOf("://")+3;return i.substring(s)}else return r!=null&&r.endpoint?"".concat(e,".").concat(r==null?void 0:r.endpoint):"".concat(e,".s3.amazonaws.com")};function sy(r,t,e){var s,o,a,l;let n=Eu(t),i=n.path;return Ou(r)&&(i="/".concat(n.bucket).concat(i)),{url:i,query:"",host:Du(r,t,n.bucket),region:(s=r==null?void 0:r.region)!=null?s:"",service:"s3",method:e,accessKeyId:(o=r==null?void 0:r.accessKeyId)!=null?o:"",secretAccessKey:(a=r==null?void 0:r.secretAccessKey)!=null?a:"",sessionToken:(l=r==null?void 0:r.sessionToken)!=null?l:"",dateNow:new Date().toISOString().replace(/-/g,"").split("T")[0],datetimeNow:new Date().toISOString().replace(/-/g,"").replace(/:/g,"").split(".")[0]+"Z"}}function oy(r,t=!1){let e="0123456789ABCDEF",n="";for(let i=0;i<r.length;i++){let s=r[i];s>="A"&&s<="Z"||s>="a"&&s<="z"||s>="0"&&s<="9"||s=="_"||s=="-"||s=="~"||s=="."?n+=s:s=="/"?t?n+="%2F":n+=s:(n+="%",n+=e[s.charCodeAt(0)>>4],n+=e[s.charCodeAt(0)&15])}return n}function ay(r,t=null){var q;let e=(q=t==null?void 0:t.contentHash)!=null?q:"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",n=new Map;n.set("x-amz-date",r.datetimeNow),n.set("x-amz-content-sha256",e),r.sessionToken&&n.set("x-amz-security-token",r.sessionToken);let i="";t!=null&&t.contentType&&(i+="content-type;"),i+="host;x-amz-content-sha256;x-amz-date",r.sessionToken&&(i+=";x-amz-security-token");let s=r.method+"\n"+oy(r.url)+"\n"+r.query;t!=null&&t.contentType&&(s+="\ncontent-type:"+(t==null?void 0:t.contentType)),s+="\nhost:"+r.host+"\nx-amz-content-sha256:"+e+"\nx-amz-date:"+r.datetimeNow,r.sessionToken&&r.sessionToken.length>0&&(s+="\nx-amz-security-token:"+r.sessionToken),s+="\n\n"+i+"\n"+e;let o=(0,jr.sha256)(s),a="AWS4-HMAC-SHA256\n"+r.datetimeNow+"\n"+r.dateNow+"/"+r.region+"/"+r.service+"/aws4_request\n"+o,l="AWS4"+r.secretAccessKey,f=jr.sha256.hmac.arrayBuffer(l,r.dateNow),m=jr.sha256.hmac.arrayBuffer(f,r.region),_=jr.sha256.hmac.arrayBuffer(m,r.service),w=jr.sha256.hmac.arrayBuffer(_,"aws4_request"),B=jr.sha256.hmac(w,a);return n.set("Authorization","AWS4-HMAC-SHA256 Credential="+r.accessKeyId+"/"+r.dateNow+"/"+r.region+"/"+r.service+"/aws4_request, SignedHeaders="+i+", Signature="+B),n}var cy=function(r,t,e,n=null,i=null){let s=sy(r,t,e),o={contentType:n,contentHash:i?jr.sha256.hex(i):null};return ay(s,o)};function Qe(r,t,e,n,i=null,s=null){(t!=null&&t.accessKeyId||t!=null&&t.sessionToken)&&(cy(t,e,n,i,s).forEach((a,l)=>{r.setRequestHeader(l,a)}),i&&r.setRequestHeader("content-type",i))}function Eu(r){if(r.indexOf("s3://")!=0)throw new Error("URL needs to start with s3://");let t=r.indexOf("/",5);if(t==-1)throw new Error("URL needs to contain a '/' after the host");let e=r.substring(5,t);if(!e)throw new Error("URL needs to contain a bucket name");let n=r.substring(t);if(!n)throw new Error("URL needs to contain key");return{bucket:e,path:n}}function Ou(r){var t;return!!((t=r==null?void 0:r.endpoint)!=null&&t.startsWith("http"))}function tr(r,t){let e=Eu(t);return Ou(r)?"".concat(r==null?void 0:r.endpoint,"/").concat(e.bucket)+e.path:"https://"+Du(r,t,e.bucket)+e.path}var tt={_files:new Map,_fileInfoCache:new Map,_udfFunctions:new Map,_globalFileInfo:null,getFileInfo(r,t){try{let e=tt._fileInfoCache.get(t),[n,i,s]=nt(r,"duckdb_web_fs_get_file_info_by_id",["number","number"],[t,(e==null?void 0:e.cacheEpoch)||0]);if(n!==0)return null;if(s===0)return e;let o=z(r,i,s);dt(r);let a=JSON.parse(o);if(a==null)return null;let l={...a,blob:null};return tt._fileInfoCache.set(t,l),l}catch(e){return console.log(e),null}},getGlobalFileInfo(r){var t;try{let[e,n,i]=nt(r,"duckdb_web_get_global_file_info",["number"],[((t=tt._globalFileInfo)==null?void 0:t.cacheEpoch)||0]);if(e!==0)return null;if(i===0)return tt._globalFileInfo;let s=z(r,n,i);dt(r);let o=JSON.parse(s);return o==null?null:(tt._globalFileInfo={...o,blob:null},tt._globalFileInfo)}catch(e){return console.log(e),null}},testPlatformFeature:(r,t)=>{switch(t){case 1:return typeof BigInt64Array<"u";default:return console.warn("test for unknown feature: ".concat(t)),!1}},getDefaultDataProtocol(r){return 2},openFile:(r,t,e)=>{var n;try{tt._fileInfoCache.delete(t);let i=tt.getFileInfo(r,t);switch(i==null?void 0:i.dataProtocol){case 4:case 5:{if(e&1&&e&2)throw new Error("Opening file ".concat(i.fileName," failed: cannot open file with both read and write flags set"));if(e&32)throw new Error("Opening file ".concat(i.fileName," failed: appending to HTTP/S3 files is not supported"));if(e&2){let a=new XMLHttpRequest;if(i.dataProtocol==5?(a.open("HEAD",tr(i.s3Config,i.dataUrl),!1),Qe(a,i.s3Config,i.dataUrl,"HEAD")):a.open("HEAD",i.dataUrl,!1),a.send(null),a.status!=200&&a.status!=404)throw new Error("Opening file ".concat(i.fileName," failed: Unexpected return status from server (").concat(a.status,")"));if(a.status==404&&!(e&8||e&16))throw new Error("Opening file ".concat(i.fileName," failed: Cannot write to non-existent file without FILE_FLAGS_FILE_CREATE or FILE_FLAGS_FILE_CREATE_NEW flag."));let l=r._malloc(1),f=new Uint8Array;r.HEAPU8.set(f,l);let m=r._malloc(2*8);return r.HEAPF64[(m>>3)+0]=1,r.HEAPF64[(m>>3)+1]=l,m}else if(e!=1)throw new Error("Opening file ".concat(i.fileName," failed: unsupported file flags: ").concat(e));let s=null,o=null;try{let a=new XMLHttpRequest;if(i.dataProtocol==5?(a.open("HEAD",tr(i.s3Config,i.dataUrl),!1),Qe(a,i.s3Config,i.dataUrl,"HEAD")):a.open("HEAD",i.dataUrl,!1),a.setRequestHeader("Range","bytes=0-"),a.send(null),s=a.getResponseHeader("Content-Length"),s!==null&&a.status==206){let l=r._malloc(16);return r.HEAPF64[(l>>3)+0]=+s,r.HEAPF64[(l>>3)+1]=0,l}}catch(a){o=a,console.warn("HEAD request with range header failed: ".concat(a))}if(i.allowFullHttpReads){if(s!==null&&+s>1){let l=new XMLHttpRequest;i.dataProtocol==5?(l.open("GET",tr(i.s3Config,i.dataUrl),!1),Qe(l,i.s3Config,i.dataUrl,"GET")):l.open("GET",i.dataUrl,!1),l.setRequestHeader("Range","bytes=0-0"),l.send(null);let f=l.getResponseHeader("Content-Length");if(l.status==206&&f!==null&&+f==1){let m=r._malloc(16);return r.HEAPF64[(m>>3)+0]=+s,r.HEAPF64[(m>>3)+1]=0,m}if(l.status==200&&f!==null&&+f==+s){console.warn("fall back to full HTTP read for: ".concat(i.dataUrl));let m=r._malloc(l.response.byteLength),_=new Uint8Array(l.response,0,l.response.byteLength);r.HEAPU8.set(_,m);let w=r._malloc(2*8);return r.HEAPF64[(w>>3)+0]=l.response.byteLength,r.HEAPF64[(w>>3)+1]=m,w}}console.warn("falling back to full HTTP read for: ".concat(i.dataUrl));let a=new XMLHttpRequest;if(i.dataProtocol==5?(a.open("GET",tr(i.s3Config,i.dataUrl),!1),Qe(a,i.s3Config,i.dataUrl,"GET")):a.open("GET",i.dataUrl,!1),a.responseType="arraybuffer",a.send(null),a.status==200){let l=r._malloc(a.response.byteLength),f=new Uint8Array(a.response,0,a.response.byteLength);r.HEAPU8.set(f,l);let m=r._malloc(2*8);return r.HEAPF64[(m>>3)+0]=a.response.byteLength,r.HEAPF64[(m>>3)+1]=l,m}}if(o!=null)throw new Error("Reading file ".concat(i.fileName," failed with error: ").concat(o));return 0}case 2:{let s=(n=tt._files)==null?void 0:n.get(i.fileName);if(s){let l=r._malloc(16);return r.HEAPF64[(l>>3)+0]=s.size,r.HEAPF64[(l>>3)+1]=0,l}console.warn("Buffering missing file: ".concat(i.fileName));let o=r._malloc(2*8),a=r._malloc(1);return r.HEAPF64[(o>>3)+0]=1,r.HEAPF64[(o>>3)+1]=a,o}}}catch(i){console.error(i.toString()),ge(r,i.toString())}return 0},glob:(r,t,e)=>{var n;try{let i=z(r,t,e);if(i.startsWith("http")||i.startsWith("s3://")){let s=new XMLHttpRequest;if(i.startsWith("s3://")){let o=tt.getGlobalFileInfo(r);s.open("HEAD",tr(o==null?void 0:o.s3Config,i),!1),Qe(s,o==null?void 0:o.s3Config,i,"HEAD")}else s.open("HEAD",i,!1);if(s.send(null),s.status!=200&&s.status!==206){if(!((n=tt.getGlobalFileInfo(r))!=null&&n.allowFullHttpReads)){ge(r,"HEAD request failed: ".concat(i,", with full http reads are disabled"));return}let o=new XMLHttpRequest;if(i.startsWith("s3://")){let l=tt.getGlobalFileInfo(r);o.open("GET",tr(l==null?void 0:l.s3Config,i),!1),Qe(o,l==null?void 0:l.s3Config,i,"HEAD")}else o.open("GET",i,!1);if(o.setRequestHeader("Range","bytes=0-0"),o.send(null),o.status!=200&&o.status!==206){ge(r,"HEAD and GET requests failed: ".concat(i));return}let a=o.getResponseHeader("Content-Length");a&&+a>1&&console.warn("Range request for ".concat(i," did not return a partial response: ").concat(o.status,' "').concat(o.statusText,'"'))}r.ccall("duckdb_web_fs_glob_add_path",null,["string"],[i])}}catch(i){return console.log(i),ge(r,i.toString()),0}},checkFile:(r,t,e)=>{try{let n=z(r,t,e);if(n.startsWith("http")||n.startsWith("s3://")){let i=new XMLHttpRequest;if(n.startsWith("s3://")){let s=tt.getGlobalFileInfo(r);i.open("HEAD",tr(s==null?void 0:s.s3Config,n),!1),Qe(i,s==null?void 0:s.s3Config,n,"HEAD")}else i.open("HEAD",n,!1);return i.send(null),i.status==206||i.status==200}}catch(n){return console.log(n),!1}return!1},syncFile:(r,t)=>{},closeFile:(r,t)=>{var n;let e=tt.getFileInfo(r,t);switch(tt._fileInfoCache.delete(t),e==null?void 0:e.dataProtocol){case 0:case 4:case 5:break;case 1:case 2:return;case 3:{let i=(n=tt._files)==null?void 0:n.get(e.fileName);if(!i)throw new Error("No OPFS access handle registered with name: ".concat(e.fileName));return i.flush()}}},truncateFile:(r,t,e)=>{var i;let n=tt.getFileInfo(r,t);switch(n==null?void 0:n.dataProtocol){case 4:ge(r,"Cannot truncate a http file");return;case 5:ge(r,"Cannot truncate an s3 file");return;case 0:case 1:case 2:ge(r,"truncateFile not implemented");return;case 3:{let s=(i=tt._files)==null?void 0:i.get(n.fileName);if(!s)throw new Error("No OPFS access handle registered with name: ".concat(n.fileName));return s.truncate(e)}}return 0},readFile(r,t,e,n,i){var s,o;if(n==0)return 0;try{let a=tt.getFileInfo(r,t);switch(a==null?void 0:a.dataProtocol){case 4:case 5:{if(!a.dataUrl)throw new Error("Missing data URL for file ".concat(t));try{let l=new XMLHttpRequest;if(a.dataProtocol==5?(l.open("GET",tr(a==null?void 0:a.s3Config,a.dataUrl),!1),Qe(l,a==null?void 0:a.s3Config,a.dataUrl,"GET")):l.open("GET",a.dataUrl,!1),l.responseType="arraybuffer",l.setRequestHeader("Range","bytes=".concat(i,"-").concat(i+n-1)),l.send(null),l.status==206||l.status==200&&n==l.response.byteLength&&i==0){let f=new Uint8Array(l.response,0,Math.min(l.response.byteLength,n));return r.HEAPU8.set(f,e),f.byteLength}else if(l.status==200){console.warn("Range request for ".concat(a.dataUrl," did not return a partial response: ").concat(l.status,' "').concat(l.statusText,'"'));let f=new Uint8Array(l.response,i,Math.min(l.response.byteLength-i,n));return r.HEAPU8.set(f,e),f.byteLength}else throw new Error("Range request for ".concat(a.dataUrl," did returned non-success status: ").concat(l.status,' "').concat(l.statusText,'"'))}catch(l){throw console.log(l),new Error("Range request for ".concat(a.dataUrl," failed with error: ").concat(l,'"'))}}case 2:{let l=(s=tt._files)==null?void 0:s.get(a.fileName);if(!l)throw new Error("No HTML5 file registered with name: ".concat(a.fileName));let f=l.slice(i,i+n),m=new Uint8Array(new FileReaderSync().readAsArrayBuffer(f));return r.HEAPU8.set(m,e),m.byteLength}case 3:{let l=(o=tt._files)==null?void 0:o.get(a.fileName);if(!l)throw new Error("No OPFS access handle registered with name: ".concat(a.fileName));let f=r.HEAPU8.subarray(e,e+n);return l.read(f,{at:i})}}return 0}catch(a){return console.log(a),ge(r,a.toString()),0}},writeFile:(r,t,e,n,i)=>{var o;let s=tt.getFileInfo(r,t);switch(s==null?void 0:s.dataProtocol){case 4:return ge(r,"Cannot write to HTTP file"),0;case 5:{let a=r.HEAPU8.subarray(e,e+n),l=new XMLHttpRequest;return l.open("PUT",tr(s==null?void 0:s.s3Config,s.dataUrl),!1),Qe(l,s==null?void 0:s.s3Config,s.dataUrl,"PUT","",a),l.send(a),l.status!==200?(ge(r,"Failed writing file: HTTP "+l.status),0):n}case 2:return ge(r,"cannot write using the html5 file reader api"),0;case 3:{let a=(o=tt._files)==null?void 0:o.get(s.fileName);if(!a)throw new Error("No OPFS access handle registered with name: ".concat(s.fileName));let l=r.HEAPU8.subarray(e,e+n);return a.write(l,{at:i})}}return 0},getLastFileModificationTime:(r,t)=>{var n;let e=tt.getFileInfo(r,t);switch(e==null?void 0:e.dataProtocol){case 2:{if(!((n=tt._files)==null?void 0:n.get(e.fileName)))throw Error("No handle available for file: ".concat(e.fileName));return 0}case 4:case 5:return new Date().getTime()}return 0},checkDirectory:(r,t,e)=>{let n=z(r,t,e);return console.log("checkDirectory: ".concat(n)),!1},createDirectory:(r,t,e)=>{let n=z(r,t,e);console.log("createDirectory: ".concat(n))},removeDirectory:(r,t,e)=>{let n=z(r,t,e);console.log("removeDirectory: ".concat(n))},listDirectoryEntries:(r,t,e)=>{let n=z(r,t,e);return console.log("listDirectoryEntries: ".concat(n)),!1},moveFile:(r,t,e,n,i)=>{var l,f;let s=z(r,t,e),o=z(r,n,i),a=(l=tt._files)==null?void 0:l.get(s);a!==void 0&&(tt._files.delete(a),tt._files.set(o,a));for(let[m,_]of((f=tt._fileInfoCache)==null?void 0:f.entries())||[])if(_.dataUrl==s){tt._fileInfoCache.delete(m);break}return!0},removeFile:(r,t,e)=>{},callScalarUDF:(r,t,e,n,i,s,o)=>{Au(tt,r,t,e,n,i,s,o)}};var Qa=class extends Do{postMessage(t,e){globalThis.postMessage(t,e)}async instantiate(t,e,n){return await new Lo(this,tt,t,e).instantiate(n)}};function Ru(){let r=new Qa;globalThis.onmessage=async t=>{await r.onMessage(t.data)}}Ru();return gh(ly);})();
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
js-sha256/src/sha256.js:
|