@duckdb/duckdb-wasm 1.27.1-dev120.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 gp=Object.create;var gs=Object.defineProperty;var wp=Object.getOwnPropertyDescriptor;var vp=Object.getOwnPropertyNames;var Sp=Object.getPrototypeOf,Ip=Object.prototype.hasOwnProperty;var ya=(r,t)=>{if(t=Symbol[r])return t;throw Error("Symbol."+r+" is not defined")};var Ap=(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 Qr=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),tn=(r,t)=>{for(var e in t)gs(r,e,{get:t[e],enumerable:!0})},tu=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of vp(t))!Ip.call(r,i)&&i!==e&&gs(r,i,{get:()=>t[i],enumerable:!(n=wp(t,i))||n.enumerable});return r};var eu=(r,t,e)=>(e=r!=null?gp(Sp(r)):{},tu(t||!r||!r.__esModule?gs(e,"default",{value:r,enumerable:!0}):e,r)),Bp=r=>tu(gs({},"__esModule",{value:!0}),r);var Tp=function(r,t){this[0]=r,this[1]=t};var en=r=>{var t=r[ya("asyncIterator")],e=!1,n,i={};return t==null?(t=r[ya("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 Tp(new Promise(c=>{var d=t[s](o);if(!(d instanceof Object))throw TypeError("Object expected");c(d)}),1)}}),i[ya("iterator")]=()=>i,n("next"),"throw"in t?n("throw"):i.throw=s=>{throw s},"return"in t&&n("return"),i};var Hd=Qr(()=>{});var zd=Qr(()=>{});var Wd=Qr(()=>{});var jd=Qr(()=>{});var $d=Qr(()=>{});var Xd=Qr((Gd,_c)=>{"use strict";var Yd=(()=>{var r=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(r=r||__filename),function(t={}){function e(){return Rt.buffer!=ir.buffer&&sr(),ir}function n(){return Rt.buffer!=ir.buffer&&sr(),Ic}function i(){return Rt.buffer!=ir.buffer&&sr(),Ac}function s(){return Rt.buffer!=ir.buffer&&sr(),Bc}function o(){return Rt.buffer!=ir.buffer&&sr(),Tc}function c(){return Rt.buffer!=ir.buffer&&sr(),Fc}function d(){return Rt.buffer!=ir.buffer&&sr(),xc}var u=t,m,g;u.ready=new Promise((a,l)=>{m=a,g=l});var S=Object.assign({},u),A=[],Q="./this.program",gt=(a,l)=>{throw l},xt=typeof window=="object",wt=typeof importScripts=="function",mt=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",T=u.ENVIRONMENT_IS_PTHREAD||!1,kt="";function wn(a){return u.locateFile?u.locateFile(a,kt):kt+a}var qn,Zn,Fr,tt;if(mt){var Ot=Hd(),$t=zd();wt?kt=$t.dirname(kt)+"/":kt=__dirname+"/",qn=(l,f)=>(l=Vc(l)?new URL(l):$t.normalize(l),Ot.readFileSync(l,f?void 0:"utf8")),Fr=l=>{var f=qn(l,!0);return f.buffer||(f=new Uint8Array(f)),f},Zn=(l,f,h,_=!0)=>{l=Vc(l)?new URL(l):$t.normalize(l),Ot.readFile(l,_?void 0:"utf8",(b,y)=>{b?h(b):f(_?y.buffer:y)})},!u.thisProgram&&process.argv.length>1&&(Q=process.argv[1].replace(/\\/g,"/")),A=process.argv.slice(2),gt=(l,f)=>{throw process.exitCode=l,f},u.inspect=()=>"[Emscripten Module object]";let a;try{a=Wd()}catch(l){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),l}global.Worker=a.Worker}else(xt||wt)&&(wt?kt=self.location.href:typeof document<"u"&&document.currentScript&&(kt=document.currentScript.src),r&&(kt=r),kt.indexOf("blob:")!==0?kt=kt.substr(0,kt.replace(/[?#].*/,"").lastIndexOf("/")+1):kt="",mt||(qn=a=>{var l=new XMLHttpRequest;return l.open("GET",a,!1),l.send(null),l.responseText},wt&&(Fr=a=>{var l=new XMLHttpRequest;return l.open("GET",a,!1),l.responseType="arraybuffer",l.send(null),new Uint8Array(l.response)}),Zn=(a,l,f)=>{var h=new XMLHttpRequest;h.open("GET",a,!0),h.responseType="arraybuffer",h.onload=()=>{if(h.status==200||h.status==0&&h.response){l(h.response);return}f()},h.onerror=f,h.send(null)}),tt=a=>document.title=a);mt&&typeof performance>"u"&&(global.performance=jd().performance);var Yt=console.log.bind(console),Nt=console.error.bind(console);mt&&(Yt=(...a)=>Ot.writeSync(1,a.join(" ")+"\n"),Nt=(...a)=>Ot.writeSync(2,a.join(" ")+"\n"));var Lt=u.print||Yt,X=u.printErr||Nt;Object.assign(u,S),S=null,u.arguments&&(A=u.arguments),u.thisProgram&&(Q=u.thisProgram),u.quit&&(gt=u.quit);var Ct;u.wasmBinary&&(Ct=u.wasmBinary);var Kr=u.noExitRuntime||!0;typeof WebAssembly!="object"&&Zr("no native wasm support detected");var Rt,Sc,es=!1,Jr;function rs(a,l){a||Zr(l)}var ir,Ic,Ac,Bc,Tc,Fc,of,xc;function sr(){var a=Rt.buffer;u.HEAP8=ir=new Int8Array(a),u.HEAP16=Ac=new Int16Array(a),u.HEAPU8=Ic=new Uint8Array(a),u.HEAPU16=Bc=new Uint16Array(a),u.HEAP32=Tc=new Int32Array(a),u.HEAPU32=Fc=new Uint32Array(a),u.HEAPF32=of=new Float32Array(a),u.HEAPF64=xc=new Float64Array(a)}var ns=u.INITIAL_MEMORY||16777216;if(rs(ns>=65536,"INITIAL_MEMORY should be larger than STACK_SIZE, was "+ns+"! (STACK_SIZE=65536)"),T)Rt=u.wasmMemory;else if(u.wasmMemory)Rt=u.wasmMemory;else if(Rt=new WebAssembly.Memory({initial:ns/65536,maximum:65536,shared:!0}),!(Rt.buffer instanceof SharedArrayBuffer))throw X("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),mt&&X("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)"),Error("bad memory");sr(),ns=Rt.buffer.byteLength;var Dc,Ec=[],Oc=[],af=[],Rc=[],Mc=!1,Uc=0;function is(){return Kr||Uc>0}function cf(){if(u.preRun)for(typeof u.preRun=="function"&&(u.preRun=[u.preRun]);u.preRun.length;)Nc(u.preRun.shift());ss(Ec)}function kc(){Mc=!0,!T&&ss(Oc)}function lf(){T||ss(af)}function uf(){if(!T){if(u.postRun)for(typeof u.postRun=="function"&&(u.postRun=[u.postRun]);u.postRun.length;)ff(u.postRun.shift());ss(Rc)}}function Nc(a){Ec.unshift(a)}function df(a){Oc.unshift(a)}function ff(a){Rc.unshift(a)}var qr=0,ta=null,Qn=null;function Lc(a){qr++,u.monitorRunDependencies&&u.monitorRunDependencies(qr)}function Cc(a){if(qr--,u.monitorRunDependencies&&u.monitorRunDependencies(qr),qr==0&&(ta!==null&&(clearInterval(ta),ta=null),Qn)){var l=Qn;Qn=null,l()}}function Zr(a){u.onAbort&&u.onAbort(a),a="Aborted("+a+")",X(a),es=!0,Jr=1,a+=". Build with -sASSERTIONS for more info.",Mc&&Xl();var l=new WebAssembly.RuntimeError(a);throw g(l),l}var hf="data:application/octet-stream;base64,";function Pc(a){return a.startsWith(hf)}function Vc(a){return a.startsWith("file://")}var vn;vn="./duckdb-coi.wasm",Pc(vn)||(vn=wn(vn));function Hc(a){if(a==vn&&Ct)return new Uint8Array(Ct);if(Fr)return Fr(a);throw"both async and sync fetching of the wasm failed"}function pf(a){return!Ct&&(xt||wt)&&typeof fetch=="function"?fetch(a,{credentials:"same-origin"}).then(l=>{if(!l.ok)throw"failed to load wasm binary file at '"+a+"'";return l.arrayBuffer()}).catch(()=>Hc(a)):Promise.resolve().then(()=>Hc(a))}function zc(a,l,f){return pf(a).then(h=>WebAssembly.instantiate(h,l)).then(h=>h).then(f,h=>{X("failed to asynchronously prepare wasm: ".concat(h)),Zr(h)})}function mf(a,l,f,h){return!a&&typeof WebAssembly.instantiateStreaming=="function"&&!Pc(l)&&!mt&&typeof fetch=="function"?fetch(l,{credentials:"same-origin"}).then(_=>{var b=WebAssembly.instantiateStreaming(_,f);return b.then(h,function(y){return X("wasm streaming compile failed: ".concat(y)),X("falling back to ArrayBuffer instantiation"),zc(l,f,h)})}):zc(l,f,h)}function _f(){var a={a:wh};function l(h,_){var b=h.exports;return b=fp(b),B=b,Sf(B.db),Dc=B.sa,df(B.qa),Sc=_,Cc("wasm-instantiate"),b}Lc("wasm-instantiate");function f(h){l(h.instance,h.module)}if(u.instantiateWasm)try{return u.instantiateWasm(a,l)}catch(h){X("Module.instantiateWasm callback failed with error: ".concat(h)),g(h)}return mf(Ct,vn,a,f).catch(g),{}}var me,Sn;function ea(a){this.name="ExitStatus",this.message="Program terminated with exit(".concat(a,")"),this.status=a}var ra=a=>{a.terminate(),a.onmessage=l=>{}},yf=a=>{var l=C.pthreads[a];delete C.pthreads[a],ra(l),pa(a),C.runningWorkers.splice(C.runningWorkers.indexOf(l),1),l.pthread_ptr=0},bf=a=>{var l=C.pthreads[a];l.postMessage({cmd:"cancel"})},Wc=a=>{var l=C.pthreads[a];rs(l),C.returnWorkerToPool(l)},jc=(a,l)=>(n().fill(0,a,a+l),a),$c=a=>{var l=C.getNewWorker();if(!l)return 6;C.runningWorkers.push(l),C.pthreads[a.pthread_ptr]=l,l.pthread_ptr=a.pthread_ptr;var f={cmd:"run",start_routine:a.startRoutine,arg:a.arg,pthread_ptr:a.pthread_ptr};return mt&&l.unref(),l.postMessage(f,a.transferList),0},Yc=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Gc=(a,l,f)=>{l>>>=0;for(var h=l+f,_=l;a[_]&&!(_>=h);)++_;if(_-l>16&&a.buffer&&Yc)return Yc.decode(a.buffer instanceof SharedArrayBuffer?a.slice(l,_):a.subarray(l,_));for(var b="";l<_;){var y=a[l++];if(!(y&128)){b+=String.fromCharCode(y);continue}var w=a[l++]&63;if((y&224)==192){b+=String.fromCharCode((y&31)<<6|w);continue}var F=a[l++]&63;if((y&240)==224?y=(y&15)<<12|w<<6|F:y=(y&7)<<18|w<<12|F<<6|a[l++]&63,y<65536)b+=String.fromCharCode(y);else{var et=y-65536;b+=String.fromCharCode(55296|et>>10,56320|et&1023)}}return b},In=(a,l)=>(a>>>=0,a?Gc(n(),a,l):""),xr={varargs:void 0,get(){var a=o()[xr.varargs>>>2>>>0];return xr.varargs+=4,a},getp(){return xr.get()},getStr(a){var l=In(a);return l}};function Xc(a){if(T)return Z(0,1,a);Jr=a,is()||(C.terminateAllThreads(),u.onExit&&u.onExit(a),es=!0),gt(a,new ea(a))}var Kc=(a,l)=>{if(Jr=a,T)throw Jc(a),"unwind";Xc(a)},na=Kc,ia=a=>{if(a instanceof ea||a=="unwind")return Jr;gt(1,a)},C={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init(){T?C.initWorker():C.initMainThread()},initMainThread(){for(var a=4;a--;)C.allocateUnusedWorker();Nc(()=>{Lc("loading-workers"),C.loadWasmModuleToAllWorkers(()=>Cc("loading-workers"))})},initWorker(){Kr=!1},setExitStatus:a=>{Jr=a},terminateAllThreads__deps:["$terminateWorker"],terminateAllThreads:()=>{for(var a of C.runningWorkers)ra(a);for(var a of C.unusedWorkers)ra(a);C.unusedWorkers=[],C.runningWorkers=[],C.pthreads=[]},returnWorkerToPool:a=>{var l=a.pthread_ptr;delete C.pthreads[l],C.unusedWorkers.push(a),C.runningWorkers.splice(C.runningWorkers.indexOf(a),1),a.pthread_ptr=0,pa(l)},receiveObjectTransfer(a){},threadInitTLS(){C.tlsInitFunctions.forEach(a=>a())},loadWasmModuleToWorker:a=>new Promise(l=>{a.onmessage=b=>{var y=b.data,w=y.cmd;if(y.targetThread&&y.targetThread!=hs()){var F=C.pthreads[y.targetThread];F?F.postMessage(y,y.transferList):X('Internal error! Worker sent a message "'.concat(w,'" to target pthread ').concat(y.targetThread,", but that thread no longer exists!"));return}w==="checkMailbox"?us():w==="spawnThread"?$c(y):w==="cleanupThread"?Wc(y.thread):w==="killThread"?yf(y.thread):w==="cancelThread"?bf(y.thread):w==="loaded"?(a.loaded=!0,mt&&!a.pthread_ptr&&a.unref(),l(a)):w==="alert"?alert("Thread ".concat(y.threadId,": ").concat(y.text)):y.target==="setimmediate"?a.postMessage(y):w==="callHandler"?u[y.handler](...y.args):w&&X("worker sent an unknown command ".concat(w))},a.onerror=b=>{var y="worker sent an error!";throw X("".concat(y," ").concat(b.filename,":").concat(b.lineno,": ").concat(b.message)),b},mt&&(a.on("message",b=>a.onmessage({data:b})),a.on("error",b=>a.onerror(b)));var f=[],h=["onExit","onAbort","print","printErr"];for(var _ of h)u.hasOwnProperty(_)&&f.push(_);a.postMessage({cmd:"load",handlers:f,urlOrBlob:u.mainScriptUrlOrBlob||r,wasmMemory:Rt,wasmModule:Sc})}),loadWasmModuleToAllWorkers(a){if(T)return a();Promise.all(C.unusedWorkers.map(C.loadWasmModuleToWorker)).then(a)},allocateUnusedWorker(){var a,l=wn("duckdb_wasm.worker.js");a=new Worker(l),C.unusedWorkers.push(a)},getNewWorker(){return C.unusedWorkers.length==0&&(C.allocateUnusedWorker(),C.loadWasmModuleToWorker(C.unusedWorkers[0])),C.unusedWorkers.pop()}};u.PThread=C;var ss=a=>{for(;a.length>0;)a.shift()(u)},gf=()=>{var a=hs(),l=o()[a+52>>>2>>>0],f=o()[a+56>>>2>>>0],h=l-f;Kl(l,h),ri(l)};u.establishStackSpace=gf;function Jc(a){if(T)return Z(1,0,a);na(a)}var os=[],wf=a=>{var l=os[a];return l||(a>=os.length&&(os.length=a+1),os[a]=l=Dc.get(a)),l},vf=(a,l)=>{var f=wf(a)(l);function h(_){is()?C.setExitStatus(_):ma(_)}h(f)};u.invokeEntryPoint=vf;var Sf=a=>{C.tlsInitFunctions.push(a)},as=(a,l)=>l+2097152>>>0<4194305-!!a?(a>>>0)+l*4294967296:NaN;function If(a){a>>>=0,$l(a,!wt,1,!xt,65536,!1),C.threadInitTLS()}function Af(a){a>>>=0,T?postMessage({cmd:"cleanupThread",thread:a}):Wc(a)}function qc(a,l,f,h){return T?Z(2,1,a,l,f,h):Zc(a,l,f,h)}function Zc(a,l,f,h){if(a>>>=0,l>>>=0,f>>>=0,h>>>=0,typeof SharedArrayBuffer>"u")return X("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var _=[],b=0;if(T&&(_.length===0||b))return qc(a,l,f,h);if(b)return b;var y={startRoutine:f,pthread_ptr:a,arg:h,transferList:_};return T?(y.cmd="spawnThread",postMessage(y,_),0):$c(y)}function Qc(a,l,f,h,_){if(T)return Z(3,1,a,l,f,h,_);l>>>=0,f>>>=0,h>>>=0,_>>>=0;for(var b=0,y=l?o()[l>>>2>>>0]:0,w=l?o()[l+4>>>2>>>0]:0,F=f?o()[f>>>2>>>0]:0,et=f?o()[f+4>>>2>>>0]:0,it=h?o()[h>>>2>>>0]:0,Zt=h?o()[h+4>>>2>>>0]:0,at=0,ze=0,It=0,Qt=0,Ae=0,or=0,v=(l?o()[l>>>2>>>0]:0)|(f?o()[f>>>2>>>0]:0)|(h?o()[h>>>2>>>0]:0),O=(l?o()[l+4>>>2>>>0]:0)|(f?o()[f+4>>>2>>>0]:0)|(h?o()[h+4>>>2>>>0]:0),ut=function(_p,yp,bp,Ql){return _p<32?yp&Ql:bp&Ql},ct=0;ct<a;ct++){var Gt=1<<ct%32;if(ut(ct,v,O,Gt)){var ii=xr.getStreamFromFD(ct),bs=xr.DEFAULT_POLLMASK;if(ii.stream_ops.poll){var Zl=-1;if(_){var pp=l?o()[_>>>2>>>0]:0,mp=l?o()[_+8>>>2>>>0]:0;Zl=(pp+mp/1e6)*1e3}bs=ii.stream_ops.poll(ii,Zl)}bs&1&&ut(ct,y,w,Gt)&&(ct<32?at=at|Gt:ze=ze|Gt,b++),bs&4&&ut(ct,F,et,Gt)&&(ct<32?It=It|Gt:Qt=Qt|Gt,b++),bs&2&&ut(ct,it,Zt,Gt)&&(ct<32?Ae=Ae|Gt:or=or|Gt,b++)}}return l&&(o()[l>>>2>>>0]=at,o()[l+4>>>2>>>0]=ze),f&&(o()[f>>>2>>>0]=It,o()[f+4>>>2>>>0]=Qt),h&&(o()[h>>>2>>>0]=Ae,o()[h+4>>>2>>>0]=or),b}function tl(){Zr("missing function: $SOCKFS")}tl.stub=!0;function sa(){Zr("missing function: $FS")}sa.stub=!0;var ti=a=>{var l=tl.getSocket(a);if(!l)throw new sa.ErrnoError(8);return l},oa=a=>(a&255)+"."+(a>>8&255)+"."+(a>>16&255)+"."+(a>>24&255),el=a=>{var l="",f=0,h=0,_=0,b=0,y=0,w=0,F=[a[0]&65535,a[0]>>16,a[1]&65535,a[1]>>16,a[2]&65535,a[2]>>16,a[3]&65535,a[3]>>16],et=!0,it="";for(w=0;w<5;w++)if(F[w]!==0){et=!1;break}if(et){if(it=oa(F[6]|F[7]<<16),F[5]===-1)return l="::ffff:",l+=it,l;if(F[5]===0)return l="::",it==="0.0.0.0"&&(it=""),it==="0.0.0.1"&&(it="1"),l+=it,l}for(f=0;f<8;f++)F[f]===0&&(f-_>1&&(y=0),_=f,y++),y>h&&(h=y,b=f-h+1);for(f=0;f<8;f++){if(h>1&&F[f]===0&&f>=b&&f<b+h){f===b&&(l+=":",b===0&&(l+=":"));continue}l+=Number(ha(F[f]&65535)).toString(16),l+=f<7?":":""}return l},rl=(a,l)=>{var f=i()[a>>>1>>>0],h=ha(s()[a+2>>>1>>>0]),_;switch(f){case 2:if(l!==16)return{errno:28};_=o()[a+4>>>2>>>0],_=oa(_);break;case 10:if(l!==28)return{errno:28};_=[o()[a+8>>>2>>>0],o()[a+12>>>2>>>0],o()[a+16>>>2>>>0],o()[a+20>>>2>>>0]],_=el(_);break;default:return{errno:5}}return{family:f,addr:_,port:h}},cs=a=>{for(var l=a.split("."),f=0;f<4;f++){var h=Number(l[f]);if(isNaN(h))return null;l[f]=h}return(l[0]|l[1]<<8|l[2]<<16|l[3]<<24)>>>0},ls=a=>parseInt(a),aa=a=>{var l,f,h,_,b=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i,y=[];if(!b.test(a))return null;if(a==="::")return[0,0,0,0,0,0,0,0];for(a.startsWith("::")?a=a.replace("::","Z:"):a=a.replace("::",":Z:"),a.indexOf(".")>0?(a=a.replace(new RegExp("[.]","g"),":"),l=a.split(":"),l[l.length-4]=ls(l[l.length-4])+ls(l[l.length-3])*256,l[l.length-3]=ls(l[l.length-2])+ls(l[l.length-1])*256,l=l.slice(0,l.length-2)):l=a.split(":"),h=0,_=0,f=0;f<l.length;f++)if(typeof l[f]=="string")if(l[f]==="Z"){for(_=0;_<8-l.length+1;_++)y[f+_]=0;h=_-1}else y[f+h]=ms(parseInt(l[f],16));else y[f+h]=l[f];return[y[1]<<16|y[0],y[3]<<16|y[2],y[5]<<16|y[4],y[7]<<16|y[6]]},_e={address_map:{id:1,addrs:{},names:{}},lookup_name(a){var l=cs(a);if(l!==null||(l=aa(a),l!==null))return a;var f;if(_e.address_map.addrs[a])f=_e.address_map.addrs[a];else{var h=_e.address_map.id++;rs(h<65535,"exceeded max address mappings of 65535"),f="172.29."+(h&255)+"."+(h&65280),_e.address_map.names[f]=a,_e.address_map.addrs[a]=f}return f},lookup_addr(a){return _e.address_map.names[a]?_e.address_map.names[a]:null}},nl=(a,l,f)=>{if(f&&a===0)return null;var h=rl(a,l);if(h.errno)throw new sa.ErrnoError(h.errno);return h.addr=_e.lookup_addr(h.addr)||h.addr,h};function il(a,l,f,h,_,b){if(T)return Z(4,1,a,l,f,h,_,b);l>>>=0,f>>>=0;var y=ti(a),w=nl(l,f);return y.sock_ops.bind(y,w.addr,w.port),0}function sl(a,l,f,h,_,b){if(T)return Z(5,1,a,l,f,h,_,b);l>>>=0,f>>>=0;var y=ti(a),w=nl(l,f);return y.sock_ops.connect(y,w.addr,w.port),0}function ol(a,l,f,h){if(T)return Z(6,1,a,l,f,h);l>>>=0}function al(a,l,f){return T?Z(7,1,a,l,f):(f>>>=0,xr.varargs=f,0)}function cl(a,l){if(T)return Z(8,1,a,l);l>>>=0}function ll(a,l,f){if(T)return Z(9,1,a,l,f);var h=as(l,f)}var ul=(a,l,f,h)=>{if(f>>>=0,!(h>0))return 0;for(var _=f,b=f+h-1,y=0;y<a.length;++y){var w=a.charCodeAt(y);if(w>=55296&&w<=57343){var F=a.charCodeAt(++y);w=65536+((w&1023)<<10)|F&1023}if(w<=127){if(f>=b)break;l[f++>>>0]=w}else if(w<=2047){if(f+1>=b)break;l[f++>>>0]=192|w>>6,l[f++>>>0]=128|w&63}else if(w<=65535){if(f+2>=b)break;l[f++>>>0]=224|w>>12,l[f++>>>0]=128|w>>6&63,l[f++>>>0]=128|w&63}else{if(f+3>=b)break;l[f++>>>0]=240|w>>18,l[f++>>>0]=128|w>>12&63,l[f++>>>0]=128|w>>6&63,l[f++>>>0]=128|w&63}}return l[f>>>0]=0,f-_},ca=(a,l,f)=>ul(a,n(),l,f);function dl(a,l,f){if(T)return Z(10,1,a,l,f);l>>>=0,f>>>=0}var la=(a,l,f,h,_)=>{switch(l){case 2:f=cs(f),jc(a,16),_&&(o()[_>>>2>>>0]=16),i()[a>>>1>>>0]=l,o()[a+4>>>2>>>0]=f,i()[a+2>>>1>>>0]=ms(h);break;case 10:f=aa(f),jc(a,28),_&&(o()[_>>>2>>>0]=28),o()[a>>>2>>>0]=l,o()[a+8>>>2>>>0]=f[0],o()[a+12>>>2>>>0]=f[1],o()[a+16>>>2>>>0]=f[2],o()[a+20>>>2>>>0]=f[3],i()[a+2>>>1>>>0]=ms(h);break;default:return 5}return 0};function fl(a,l,f,h,_,b){if(T)return Z(11,1,a,l,f,h,_,b);l>>>=0,f>>>=0;var y=ti(a);if(!y.daddr)return-53;var w=la(l,y.family,_e.lookup_name(y.daddr),y.dport,f);return 0}function hl(a,l,f,h,_,b){if(T)return Z(12,1,a,l,f,h,_,b);h>>>=0,_>>>=0;var y=ti(a);return l===1&&f===4?(o()[h>>>2>>>0]=y.error,o()[_>>>2>>>0]=4,y.error=null,0):-50}function pl(a,l,f){return T?Z(13,1,a,l,f):(f>>>=0,xr.varargs=f,0)}function ml(a,l){if(T)return Z(14,1,a,l);a>>>=0,l>>>=0}function _l(a,l,f){if(T)return Z(15,1,a,l,f);l>>>=0}function yl(a,l,f,h){if(T)return Z(16,1,a,l,f,h);l>>>=0,f>>>=0}function bl(a,l,f,h){if(T)return Z(17,1,a,l,f,h);l>>>=0,h>>>=0,xr.varargs=h}function gl(a,l,f,h,_,b){if(T)return Z(18,1,a,l,f,h,_,b);l>>>=0,f>>>=0,_>>>=0,b>>>=0;var y=ti(a),w=y.sock_ops.recvmsg(y,f);if(!w)return 0;if(_)var F=la(_,y.family,_e.lookup_name(w.addr),w.port,b);return n().set(w.buffer,l>>>0),w.buffer.byteLength}function wl(a,l,f,h){if(T)return Z(19,1,a,l,f,h);l>>>=0,h>>>=0}function vl(a){if(T)return Z(20,1,a);a>>>=0}function Sl(a,l,f,h,_,b){if(T)return Z(21,1,a,l,f,h,_,b);l>>>=0,f>>>=0,_>>>=0,b>>>=0}function Il(a,l,f){if(T)return Z(22,1,a,l,f)}function Al(a,l){if(T)return Z(23,1,a,l);a>>>=0,l>>>=0}function Bl(a,l,f){if(T)return Z(24,1,a,l,f);l>>>=0}var Bf=!0,Tf=()=>Bf,Ff=()=>{if(!is())try{T?ma(Jr):na(Jr)}catch(a){ia(a)}},xf=a=>{if(!es)try{a(),Ff()}catch(l){ia(l)}};function ua(a){if(a>>>=0,typeof Atomics.waitAsync=="function"){var l=Atomics.waitAsync(o(),a>>2,a);l.value.then(us);var f=a+128;Atomics.store(o(),f>>2,1)}}u.__emscripten_thread_mailbox_await=ua;var us=()=>{var a=hs();a&&(ua(a),xf(()=>Gl()))};u.checkMailbox=us;var Df=function(a,l,f){if(a>>>=0,l>>>=0,f>>>=0,a==l)setTimeout(()=>us());else if(T)postMessage({targetThread:a,cmd:"checkMailbox"});else{var h=C.pthreads[a];if(!h)return;h.postMessage({cmd:"checkMailbox"})}},Ef=a=>{var l=_s(),f=a();return ri(l),f},Z=function(a,l){var f=arguments.length-2,h=arguments;return Ef(()=>{for(var _=f,b=ni(_*8),y=b>>3,w=0;w<f;w++){var F=h[2+w];d()[y+w>>>0]=F}return Yl(a,_,b,l)})},da=[];function Of(a,l,f,h){l>>>=0,h>>>=0,da.length=f;for(var _=h>>3,b=0;b<f;b++)da[b]=d()[_+b>>>0];var y=gh[a];C.currentProxiedOperationCallerThread=l;var w=y.apply(null,da);return C.currentProxiedOperationCallerThread=0,w}function Rf(a){a>>>=0,mt&&C.pthreads[a].ref()}var Mf=()=>{Zr("")};function Uf(a,l){return globalThis.DUCKDB_RUNTIME.createDirectory(u,a,l)}function kf(a,l){return globalThis.DUCKDB_RUNTIME.checkDirectory(u,a,l)}function Nf(a,l){return globalThis.DUCKDB_RUNTIME.listDirectoryEntries(u,a,l)}function Lf(a,l){return globalThis.DUCKDB_RUNTIME.removeDirectory(u,a,l)}function Cf(a){return globalThis.DUCKDB_RUNTIME.closeFile(u,a)}function Pf(a,l){return globalThis.DUCKDB_RUNTIME.checkFile(u,a,l)}function Vf(a){return globalThis.DUCKDB_RUNTIME.getLastFileModificationTime(u,a)}function Hf(a,l,f,h){return globalThis.DUCKDB_RUNTIME.moveFile(u,a,l,f,h)}function zf(a,l){return globalThis.DUCKDB_RUNTIME.openFile(u,a,l)}function Wf(a,l,f,h){return globalThis.DUCKDB_RUNTIME.readFile(u,a,l,f,h)}function jf(a,l){return globalThis.DUCKDB_RUNTIME.truncateFile(u,a,l)}function $f(a,l,f,h){return globalThis.DUCKDB_RUNTIME.writeFile(u,a,l,f,h)}function Yf(a){return globalThis.DUCKDB_RUNTIME.getDefaultDataProtocol(a)}function Gf(a,l){return globalThis.DUCKDB_RUNTIME.glob(u,a,l)}function Xf(a){return globalThis.DUCKDB_RUNTIME.testPlatformFeature(u,a)}function Kf(a,l,f,h,_,b){return globalThis.DUCKDB_RUNTIME.callScalarUDF(u,a,l,f,h,_,b)}var ds=a=>{ds.shown||(ds.shown={}),ds.shown[a]||(ds.shown[a]=1,mt&&(a="warning: "+a),X(a))},Jf=()=>{},qf=()=>Date.now(),Zf=()=>{Uc+=1},Qf=()=>{throw Zf(),"unwind"},Tl=()=>4294901760;function th(){return Tl()}var Fl;Fl=()=>performance.timeOrigin+performance.now();var eh=()=>mt?$d().cpus().length:navigator.hardwareConcurrency,rh=a=>{var l=Rt.buffer,f=(a-l.byteLength+65535)/65536;try{return Rt.grow(f),sr(),1}catch(h){}};function nh(a){a>>>=0;var l=n().length;if(a<=l)return!1;var f=Tl();if(a>f)return!1;for(var h=(F,et)=>F+(et-F%et)%et,_=1;_<=4;_*=2){var b=l*(1+.2/_);b=Math.min(b,a+100663296);var y=Math.min(f,h(Math.max(a,b),65536)),w=rh(y);if(w)return!0}return!1}var fa={},ih=()=>Q||"./this.program",ei=()=>{if(!ei.strings){var a=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",l={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:a,_:ih()};for(var f in fa)fa[f]===void 0?delete l[f]:l[f]=fa[f];var h=[];for(var f in l)h.push("".concat(f,"=").concat(l[f]));ei.strings=h}return ei.strings},sh=(a,l)=>{for(var f=0;f<a.length;++f)e()[l++>>>0>>>0]=a.charCodeAt(f);e()[l>>>0>>>0]=0},xl=function(a,l){if(T)return Z(25,1,a,l);a>>>=0,l>>>=0;var f=0;return ei().forEach((h,_)=>{var b=l+f;c()[a+_*4>>>2>>>0]=b,sh(h,b),f+=h.length+1}),0},Dl=function(a,l){if(T)return Z(26,1,a,l);a>>>=0,l>>>=0;var f=ei();c()[a>>>2>>>0]=f.length;var h=0;return f.forEach(_=>h+=_.length+1),c()[l>>>2>>>0]=h,0};function El(a){return T?Z(27,1,a):52}function Ol(a,l){if(T)return Z(28,1,a,l);l>>>=0;var f=0,h=0,_=0;{var b=2;a==0?f=2:(a==1||a==2)&&(f=64),_=1}return e()[l>>>0>>>0]=b,i()[l+2>>>1>>>0]=_,Sn=[f>>>0,(me=f,+Math.abs(me)>=1?me>0?+Math.floor(me/4294967296)>>>0:~~+Math.ceil((me-+(~~me>>>0))/4294967296)>>>0:0)],o()[l+8>>>2>>>0]=Sn[0],o()[l+12>>>2>>>0]=Sn[1],Sn=[h>>>0,(me=h,+Math.abs(me)>=1?me>0?+Math.floor(me/4294967296)>>>0:~~+Math.ceil((me-+(~~me>>>0))/4294967296)>>>0:0)],o()[l+16>>>2>>>0]=Sn[0],o()[l+20>>>2>>>0]=Sn[1],0}function Rl(a,l,f,h,_,b){if(T)return Z(29,1,a,l,f,h,_,b);l>>>=0,f>>>=0;var y=as(h,_);return b>>>=0,52}function Ml(a,l,f,h,_,b){if(T)return Z(30,1,a,l,f,h,_,b);l>>>=0,f>>>=0;var y=as(h,_);return b>>>=0,52}function Ul(a,l,f,h){return T?Z(31,1,a,l,f,h):(l>>>=0,f>>>=0,h>>>=0,52)}function kl(a,l,f,h,_){if(T)return Z(32,1,a,l,f,h,_);var b=as(l,f);return _>>>=0,70}function Nl(a){return T?Z(33,1,a):52}var oh=[null,[],[]],ah=(a,l)=>{var f=oh[a];l===0||l===10?((a===1?Lt:X)(Gc(f,0)),f.length=0):f.push(l)};function Ll(a,l,f,h){if(T)return Z(34,1,a,l,f,h);l>>>=0,f>>>=0,h>>>=0;for(var _=0,b=0;b<f;b++){var y=c()[l>>>2>>>0],w=c()[l+4>>>2>>>0];l+=8;for(var F=0;F<w;F++)ah(a,n()[y+F>>>0]);_+=w}return c()[h>>>2>>>0]=_,0}function Cl(a,l,f,h){if(T)return Z(35,1,a,l,f,h);a>>>=0,l>>>=0,f>>>=0,h>>>=0;var _=0,b=0,y=0,w=0,F=0,et=0,it;function Zt(at,ze,It,Qt,Ae,or){var v,O,ut,ct;return O=at===10?28:16,Ae=at===10?el(Ae):oa(Ae),v=_a(O),ct=la(v,at,Ae,or),rs(!ct),ut=_a(32),o()[ut+4>>>2>>>0]=at,o()[ut+8>>>2>>>0]=ze,o()[ut+12>>>2>>>0]=It,c()[ut+24>>>2>>>0]=Qt,c()[ut+20>>>2>>>0]=v,at===10?o()[ut+16>>>2>>>0]=28:o()[ut+16>>>2>>>0]=16,o()[ut+28>>>2>>>0]=0,ut}if(f&&(y=o()[f>>>2>>>0],w=o()[f+4>>>2>>>0],F=o()[f+8>>>2>>>0],et=o()[f+12>>>2>>>0]),F&&!et&&(et=F===2?17:6),!F&&et&&(F=et===17?2:1),et===0&&(et=6),F===0&&(F=1),!a&&!l)return-2;if(y&-1088||f!==0&&o()[f>>>2>>>0]&2&&!a)return-1;if(y&32)return-2;if(F!==0&&F!==1&&F!==2)return-7;if(w!==0&&w!==2&&w!==10)return-6;if(l&&(l=In(l),b=parseInt(l,10),isNaN(b)))return y&1024?-2:-8;if(!a)return w===0&&(w=2),y&1||(w===2?_=ps(2130706433):_=[0,0,0,1]),it=Zt(w,F,et,null,_,b),c()[h>>>2>>>0]=it,0;if(a=In(a),_=cs(a),_!==null)if(w===0||w===2)w=2;else if(w===10&&y&8)_=[0,0,ps(65535),_],w=10;else return-2;else if(_=aa(a),_!==null)if(w===0||w===10)w=10;else return-2;return _!=null?(it=Zt(w,F,et,a,_,b),c()[h>>>2>>>0]=it,0):y&4?-2:(a=_e.lookup_name(a),_=cs(a),w===0?w=2:w===10&&(_=[0,0,ps(65535),_]),it=Zt(w,F,et,null,_,b),c()[h>>>2>>>0]=it,0)}var ch=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return h=>(h.set(crypto.getRandomValues(new Uint8Array(h.byteLength))),h);if(mt)try{var a=Ap("crypto"),l=a.randomFillSync;if(l)return h=>a.randomFillSync(h);var f=a.randomBytes;return h=>(h.set(f(h.byteLength)),h)}catch(h){}Zr("initRandomDevice")},Pl=a=>(Pl=ch())(a);function lh(a,l){return a>>>=0,l>>>=0,Pl(n().subarray(a>>>0,a+l>>>0)),0}function uh(a,l,f,h,_,b,y){a>>>=0,f>>>=0,_>>>=0;var w=rl(a,l);if(w.errno)return-6;var F=w.port,et=w.addr,it=!1;if(f&&h){var Zt;if(y&1||!(Zt=_e.lookup_addr(et))){if(y&8)return-2}else et=Zt;var at=ca(et,f,h);at+1>=h&&(it=!0)}if(_&&b){F=""+F;var at=ca(F,_,b);at+1>=b&&(it=!0)}return it?-12:0}var fs=a=>a%4===0&&(a%100!==0||a%400===0),dh=(a,l)=>{for(var f=0,h=0;h<=l;f+=a[h++]);return f},Vl=[31,29,31,30,31,30,31,31,30,31,30,31],Hl=[31,28,31,30,31,30,31,31,30,31,30,31],fh=(a,l)=>{for(var f=new Date(a.getTime());l>0;){var h=fs(f.getFullYear()),_=f.getMonth(),b=(h?Vl:Hl)[_];if(l>b-f.getDate())l-=b-f.getDate()+1,f.setDate(1),_<11?f.setMonth(_+1):(f.setMonth(0),f.setFullYear(f.getFullYear()+1));else return f.setDate(f.getDate()+l),f}return f},zl=a=>{for(var l=0,f=0;f<a.length;++f){var h=a.charCodeAt(f);h<=127?l++:h<=2047?l+=2:h>=55296&&h<=57343?(l+=4,++f):l+=3}return l};function hh(a,l,f){var h=f>0?f:zl(a)+1,_=new Array(h),b=ul(a,_,0,_.length);return l&&(_.length=b),_}var Wl=(a,l)=>{e().set(a,l>>>0)};function ph(a,l,f,h){a>>>=0,l>>>=0,f>>>=0,h>>>=0;var _=c()[h+40>>>2>>>0],b={tm_sec:o()[h>>>2>>>0],tm_min:o()[h+4>>>2>>>0],tm_hour:o()[h+8>>>2>>>0],tm_mday:o()[h+12>>>2>>>0],tm_mon:o()[h+16>>>2>>>0],tm_year:o()[h+20>>>2>>>0],tm_wday:o()[h+24>>>2>>>0],tm_yday:o()[h+28>>>2>>>0],tm_isdst:o()[h+32>>>2>>>0],tm_gmtoff:o()[h+36>>>2>>>0],tm_zone:_?In(_):""},y=In(f),w={"%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 F in w)y=y.replace(new RegExp(F,"g"),w[F]);var et=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],it=["January","February","March","April","May","June","July","August","September","October","November","December"];function Zt(v,O,ut){for(var ct=typeof v=="number"?v.toString():v||"";ct.length<O;)ct=ut[0]+ct;return ct}function at(v,O){return Zt(v,O,"0")}function ze(v,O){function ut(Gt){return Gt<0?-1:Gt>0?1:0}var ct;return(ct=ut(v.getFullYear()-O.getFullYear()))===0&&(ct=ut(v.getMonth()-O.getMonth()))===0&&(ct=ut(v.getDate()-O.getDate())),ct}function It(v){switch(v.getDay()){case 0:return new Date(v.getFullYear()-1,11,29);case 1:return v;case 2:return new Date(v.getFullYear(),0,3);case 3:return new Date(v.getFullYear(),0,2);case 4:return new Date(v.getFullYear(),0,1);case 5:return new Date(v.getFullYear()-1,11,31);case 6:return new Date(v.getFullYear()-1,11,30)}}function Qt(v){var O=fh(new Date(v.tm_year+1900,0,1),v.tm_yday),ut=new Date(O.getFullYear(),0,4),ct=new Date(O.getFullYear()+1,0,4),Gt=It(ut),ii=It(ct);return ze(Gt,O)<=0?ze(ii,O)<=0?O.getFullYear()+1:O.getFullYear():O.getFullYear()-1}var Ae={"%a":v=>et[v.tm_wday].substring(0,3),"%A":v=>et[v.tm_wday],"%b":v=>it[v.tm_mon].substring(0,3),"%B":v=>it[v.tm_mon],"%C":v=>{var O=v.tm_year+1900;return at(O/100|0,2)},"%d":v=>at(v.tm_mday,2),"%e":v=>Zt(v.tm_mday,2," "),"%g":v=>Qt(v).toString().substring(2),"%G":v=>Qt(v),"%H":v=>at(v.tm_hour,2),"%I":v=>{var O=v.tm_hour;return O==0?O=12:O>12&&(O-=12),at(O,2)},"%j":v=>at(v.tm_mday+dh(fs(v.tm_year+1900)?Vl:Hl,v.tm_mon-1),3),"%m":v=>at(v.tm_mon+1,2),"%M":v=>at(v.tm_min,2),"%n":()=>"\n","%p":v=>v.tm_hour>=0&&v.tm_hour<12?"AM":"PM","%S":v=>at(v.tm_sec,2),"%t":()=>" ","%u":v=>v.tm_wday||7,"%U":v=>{var O=v.tm_yday+7-v.tm_wday;return at(Math.floor(O/7),2)},"%V":v=>{var O=Math.floor((v.tm_yday+7-(v.tm_wday+6)%7)/7);if((v.tm_wday+371-v.tm_yday-2)%7<=2&&O++,O){if(O==53){var ct=(v.tm_wday+371-v.tm_yday)%7;ct!=4&&(ct!=3||!fs(v.tm_year))&&(O=1)}}else{O=52;var ut=(v.tm_wday+7-v.tm_yday-1)%7;(ut==4||ut==5&&fs(v.tm_year%400-1))&&O++}return at(O,2)},"%w":v=>v.tm_wday,"%W":v=>{var O=v.tm_yday+7-(v.tm_wday+6)%7;return at(Math.floor(O/7),2)},"%y":v=>(v.tm_year+1900).toString().substring(2),"%Y":v=>v.tm_year+1900,"%z":v=>{var O=v.tm_gmtoff,ut=O>=0;return O=Math.abs(O)/60,O=O/60*100+O%60,(ut?"+":"-")+("0000"+O).slice(-4)},"%Z":v=>v.tm_zone,"%%":()=>"%"};y=y.replace(/%%/g,"\0\0");for(var F in Ae)y.includes(F)&&(y=y.replace(new RegExp(F,"g"),Ae[F](b)));y=y.replace(/\0\0/g,"%");var or=hh(y,!1);return or.length>l?0:(Wl(or,a),or.length-1)}function mh(a,l,f,h,_){return a>>>=0,l>>>=0,f>>>=0,h>>>=0,_>>>=0,ph(a,l,f,h)}var _h=a=>{var l=u["_"+a];return l},yh=a=>{var l=zl(a)+1,f=ni(l);return ca(a,f,l),f},bh=(a,l,f,h,_)=>{var b={string:It=>{var Qt=0;return It!=null&&It!==0&&(Qt=yh(It)),Qt},array:It=>{var Qt=ni(It.length);return Wl(It,Qt),Qt}};function y(It){return l==="string"?In(It):l==="boolean"?!!It:It}var w=_h(a),F=[],et=0;if(h)for(var it=0;it<h.length;it++){var Zt=b[f[it]];Zt?(et===0&&(et=_s()),F[it]=Zt(h[it])):F[it]=h[it]}var at=w.apply(null,F);function ze(It){return et!==0&&ri(et),y(It)}return at=ze(at),at};C.init();var gh=[Xc,Jc,qc,Qc,il,sl,ol,al,cl,ll,dl,fl,hl,pl,ml,_l,yl,bl,gl,wl,vl,Sl,Il,Al,Bl,xl,Dl,El,Ol,Rl,Ml,Ul,kl,Nl,Ll,Cl],wh={E:If,s:Af,ga:Zc,$:Qc,ea:il,ca:sl,X:ol,b:al,W:cl,x:ll,R:dl,Z:fl,_:hl,q:pl,T:ml,S:_l,U:yl,r:bl,aa:gl,P:wl,k:vl,ba:Sl,n:Il,V:Al,l:Bl,oa:Tf,da:Df,M:Of,v:ua,u:Rf,e:Mf,H:Uf,I:kf,F:Nf,G:Lf,j:Cf,C:Pf,w:Vf,D:Hf,K:zf,f:Wf,J:jf,g:$f,L:Yf,B:Gf,i:Xf,N:Kf,m:Jf,pa:qf,t:Qf,ha:th,c:Fl,ia:eh,na:nh,ka:xl,la:Dl,fa:na,d:El,ma:Ol,z:Rl,y:Ml,p:Ul,A:kl,Q:Nl,h:Ll,o:Cl,O:lh,Y:uh,a:Rt||u.wasmMemory,ja:mh},B=_f(),vh=()=>(vh=B.qa)(),jl=u._main=(a,l)=>(jl=u._main=B.ra)(a,l),Sh=u._duckdb_web_fs_glob_add_path=a=>(Sh=u._duckdb_web_fs_glob_add_path=B.ta)(a),Ih=u._duckdb_web_clear_response=()=>(Ih=u._duckdb_web_clear_response=B.ua)(),Ah=u._duckdb_web_fail_with=a=>(Ah=u._duckdb_web_fail_with=B.va)(a),Bh=u._duckdb_web_reset=a=>(Bh=u._duckdb_web_reset=B.wa)(a),Th=u._duckdb_web_connect=()=>(Th=u._duckdb_web_connect=B.xa)(),Fh=u._duckdb_web_disconnect=a=>(Fh=u._duckdb_web_disconnect=B.ya)(a),xh=u._duckdb_web_flush_files=()=>(xh=u._duckdb_web_flush_files=B.za)(),Dh=u._duckdb_web_flush_file=a=>(Dh=u._duckdb_web_flush_file=B.Aa)(a),Eh=u._duckdb_web_open=(a,l)=>(Eh=u._duckdb_web_open=B.Ba)(a,l),Oh=u._duckdb_web_get_global_file_info=(a,l)=>(Oh=u._duckdb_web_get_global_file_info=B.Ca)(a,l),Rh=u._duckdb_web_collect_file_stats=(a,l,f)=>(Rh=u._duckdb_web_collect_file_stats=B.Da)(a,l,f),Mh=u._duckdb_web_export_file_stats=(a,l)=>(Mh=u._duckdb_web_export_file_stats=B.Ea)(a,l),Uh=u._duckdb_web_fs_drop_file=(a,l)=>(Uh=u._duckdb_web_fs_drop_file=B.Fa)(a,l),kh=u._duckdb_web_fs_drop_files=a=>(kh=u._duckdb_web_fs_drop_files=B.Ga)(a),Nh=u._duckdb_web_fs_glob_file_infos=(a,l)=>(Nh=u._duckdb_web_fs_glob_file_infos=B.Ha)(a,l),Lh=u._duckdb_web_fs_get_file_info_by_id=(a,l,f)=>(Lh=u._duckdb_web_fs_get_file_info_by_id=B.Ia)(a,l,f),Ch=u._duckdb_web_fs_get_file_info_by_name=(a,l,f)=>(Ch=u._duckdb_web_fs_get_file_info_by_name=B.Ja)(a,l,f),Ph=u._duckdb_web_fs_register_file_url=(a,l,f,h,_)=>(Ph=u._duckdb_web_fs_register_file_url=B.Ka)(a,l,f,h,_),Vh=u._duckdb_web_fs_register_file_buffer=(a,l,f,h)=>(Vh=u._duckdb_web_fs_register_file_buffer=B.La)(a,l,f,h),Hh=u._duckdb_web_copy_file_to_buffer=(a,l)=>(Hh=u._duckdb_web_copy_file_to_buffer=B.Ma)(a,l),zh=u._duckdb_web_copy_file_to_path=(a,l,f)=>(zh=u._duckdb_web_copy_file_to_path=B.Na)(a,l,f),Wh=u._duckdb_web_get_version=a=>(Wh=u._duckdb_web_get_version=B.Oa)(a),jh=u._duckdb_web_get_feature_flags=()=>(jh=u._duckdb_web_get_feature_flags=B.Pa)(),$h=u._duckdb_web_tokenize=(a,l)=>($h=u._duckdb_web_tokenize=B.Qa)(a,l),Yh=u._duckdb_web_udf_scalar_create=(a,l,f)=>(Yh=u._duckdb_web_udf_scalar_create=B.Ra)(a,l,f),Gh=u._duckdb_web_prepared_create=(a,l,f)=>(Gh=u._duckdb_web_prepared_create=B.Sa)(a,l,f),Xh=u._duckdb_web_prepared_close=(a,l,f)=>(Xh=u._duckdb_web_prepared_close=B.Ta)(a,l,f),Kh=u._duckdb_web_prepared_run=(a,l,f,h)=>(Kh=u._duckdb_web_prepared_run=B.Ua)(a,l,f,h),Jh=u._duckdb_web_prepared_send=(a,l,f,h)=>(Jh=u._duckdb_web_prepared_send=B.Va)(a,l,f,h),qh=u._duckdb_web_query_run=(a,l,f)=>(qh=u._duckdb_web_query_run=B.Wa)(a,l,f),Zh=u._duckdb_web_pending_query_start=(a,l,f)=>(Zh=u._duckdb_web_pending_query_start=B.Xa)(a,l,f),Qh=u._duckdb_web_pending_query_poll=(a,l,f)=>(Qh=u._duckdb_web_pending_query_poll=B.Ya)(a,l,f),tp=u._duckdb_web_pending_query_cancel=(a,l)=>(tp=u._duckdb_web_pending_query_cancel=B.Za)(a,l),ep=u._duckdb_web_query_fetch_results=(a,l)=>(ep=u._duckdb_web_query_fetch_results=B._a)(a,l),rp=u._duckdb_web_get_tablenames=(a,l,f)=>(rp=u._duckdb_web_get_tablenames=B.$a)(a,l,f),np=u._duckdb_web_insert_arrow_from_ipc_stream=(a,l,f,h,_)=>(np=u._duckdb_web_insert_arrow_from_ipc_stream=B.ab)(a,l,f,h,_),ip=u._duckdb_web_insert_csv_from_path=(a,l,f,h)=>(ip=u._duckdb_web_insert_csv_from_path=B.bb)(a,l,f,h),sp=u._duckdb_web_insert_json_from_path=(a,l,f,h)=>(sp=u._duckdb_web_insert_json_from_path=B.cb)(a,l,f,h),op=u.__emscripten_tls_init=()=>(op=u.__emscripten_tls_init=B.db)(),hs=u._pthread_self=()=>(hs=u._pthread_self=B.eb)(),ap=()=>(ap=B.__errno_location)(),$l=u.__emscripten_thread_init=(a,l,f,h,_,b)=>($l=u.__emscripten_thread_init=B.fb)(a,l,f,h,_,b),cp=u.__emscripten_thread_crashed=()=>(cp=u.__emscripten_thread_crashed=B.gb)(),ps=a=>(ps=B.hb)(a),ms=a=>(ms=B.ib)(a),lp=()=>(lp=B.emscripten_main_runtime_thread_id)(),up=()=>(up=B.emscripten_main_thread_process_queued_calls)(),ha=a=>(ha=B.jb)(a),Yl=(a,l,f,h)=>(Yl=B.kb)(a,l,f,h),pa=a=>(pa=B.lb)(a),ma=u.__emscripten_thread_exit=a=>(ma=u.__emscripten_thread_exit=B.mb)(a),Gl=u.__emscripten_check_mailbox=()=>(Gl=u.__emscripten_check_mailbox=B.nb)(),_a=u._malloc=a=>(_a=u._malloc=B.ob)(a),dp=u._free=a=>(dp=u._free=B.pb)(a),Xl=()=>(Xl=B.qb)(),Kl=(a,l)=>(Kl=B.rb)(a,l),_s=()=>(_s=B.sb)(),ri=a=>(ri=B.tb)(a),ni=a=>(ni=B.ub)(a);function fp(a){a=Object.assign({},a);var l=h=>()=>h()>>>0,f=h=>_=>h(_)>>>0;return a.eb=l(a.eb),a.__errno_location=l(a.__errno_location),a.ob=f(a.ob),a.sb=l(a.sb),a.ub=f(a.ub),a}u.keepRuntimeAlive=is,u.wasmMemory=Rt,u.stackAlloc=ni,u.stackSave=_s,u.stackRestore=ri,u.ccall=bh,u.ExitStatus=ea,u.PThread=C;var ys;Qn=function a(){ys||Jl(),ys||(Qn=a)};function hp(){var a=jl,l=0,f=0;try{var h=a(l,f);return Kc(h,!0),h}catch(_){return ia(_)}}function Jl(){if(qr>0)return;if(T){m(u),kc(),startWorker(u);return}if(cf(),qr>0)return;function a(){ys||(ys=!0,u.calledRun=!0,!es&&(kc(),lf(),m(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),ql&&hp(),uf()))}u.setStatus?(u.setStatus("Running..."),setTimeout(function(){setTimeout(function(){u.setStatus("")},1),a()},1)):a()}if(u.preInit)for(typeof u.preInit=="function"&&(u.preInit=[u.preInit]);u.preInit.length>0;)u.preInit.pop()();var ql=!0;return u.noInitialRun&&(ql=!1),Jl(),t.ready}})();typeof Gd=="object"&&typeof _c=="object"?_c.exports=Yd:typeof define=="function"&&define.amd&&define([],()=>Yd)});var tf=Qr((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,c=this.blocks;i<o;){if(this.hashed&&(this.hashed=!1,c[0]=this.block,c[16]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=c[11]=c[12]=c[13]=c[14]=c[15]=0),t)for(s=this.start;i<o&&s<64;++i)c[s>>2]|=r[i]<<SHIFT[s++&3];else for(s=this.start;i<o&&s<64;++i)n=r.charCodeAt(i),n<128?c[s>>2]|=n<<SHIFT[s++&3]:n<2048?(c[s>>2]|=(192|n>>6)<<SHIFT[s++&3],c[s>>2]|=(128|n&63)<<SHIFT[s++&3]):n<55296||n>=57344?(c[s>>2]|=(224|n>>12)<<SHIFT[s++&3],c[s>>2]|=(128|n>>6&63)<<SHIFT[s++&3],c[s>>2]|=(128|n&63)<<SHIFT[s++&3]):(n=65536+((n&1023)<<10|r.charCodeAt(++i)&1023),c[s>>2]|=(240|n>>18)<<SHIFT[s++&3],c[s>>2]|=(128|n>>12&63)<<SHIFT[s++&3],c[s>>2]|=(128|n>>6&63)<<SHIFT[s++&3],c[s>>2]|=(128|n&63)<<SHIFT[s++&3]);this.lastByteIndex=s,this.bytes+=s-this.start,s>=64?(this.block=c[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,c=this.h7,d=this.blocks,u,m,g,S,A,Q,gt,xt,wt,mt,T;for(u=16;u<64;++u)A=d[u-15],m=(A>>>7|A<<25)^(A>>>18|A<<14)^A>>>3,A=d[u-2],g=(A>>>17|A<<15)^(A>>>19|A<<13)^A>>>10,d[u]=d[u-16]+m+d[u-7]+g<<0;for(T=t&e,u=0;u<64;u+=4)this.first?(this.is224?(xt=300032,A=d[0]-1413257819,c=A-150054599<<0,n=A+24177077<<0):(xt=704751109,A=d[0]-210244248,c=A-1521486534<<0,n=A+143694565<<0),this.first=!1):(m=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),g=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),xt=r&t,S=xt^r&e^T,gt=i&s^~i&o,A=c+g+gt+K[u]+d[u],Q=m+S,c=n+A<<0,n=A+Q<<0),m=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),g=(c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7),wt=n&r,S=wt^n&t^xt,gt=c&i^~c&s,A=o+g+gt+K[u+1]+d[u+1],Q=m+S,o=e+A<<0,e=A+Q<<0,m=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),g=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),mt=e&n,S=mt^e&r^wt,gt=o&c^~o&i,A=s+g+gt+K[u+2]+d[u+2],Q=m+S,s=t+A<<0,t=A+Q<<0,m=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),g=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),T=t&e,S=T^t&n^mt,gt=s&o^~s&c,A=i+g+gt+K[u+3]+d[u+3],Q=m+S,i=r+A<<0,r=A+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+c<<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,c=this.h7,d=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||(d+=HEX_CHARS[c>>28&15]+HEX_CHARS[c>>24&15]+HEX_CHARS[c>>20&15]+HEX_CHARS[c>>16&15]+HEX_CHARS[c>>12&15]+HEX_CHARS[c>>8&15]+HEX_CHARS[c>>4&15]+HEX_CHARS[c&15]),d},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,c=this.h7,d=[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||d.push(c>>24&255,c>>16&255,c>>8&255,c&255),d},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,c=0,d;for(n=0;n<o;++n)d=r.charCodeAt(n),d<128?s[c++]=d:d<2048?(s[c++]=192|d>>6,s[c++]=128|d&63):d<55296||d>=57344?(s[c++]=224|d>>12,s[c++]=128|d>>6&63,s[c++]=128|d&63):(d=65536+((d&1023)<<10|r.charCodeAt(++n)&1023),s[c++]=240|d>>18,s[c++]=128|d>>12&63,s[c++]=128|d>>6&63,s[c++]=128|d&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 u=[],m=[];for(n=0;n<64;++n){var g=r[n]||0;u[n]=92^g,m[n]=54^g}Sha256.call(this,t,e),this.update(m),this.oKeyPad=u,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 my={};tn(my,{registerWorker:()=>sf});function nu(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 I(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 c(m){try{u(n.next(m))}catch(g){o(g)}}function d(m){try{u(n.throw(m))}catch(g){o(g)}}function u(m){m.done?s(m.value):i(m.value).then(c,d)}u((n=n.apply(r,t||[])).next())})}function ru(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 P(r){return this instanceof P?(this.v=r,this):new P(r)}function ae(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(S){n[S]&&(i[S]=function(A){return new Promise(function(Q,gt){s.push([S,A,Q,gt])>1||c(S,A)})})}function c(S,A){try{d(n[S](A))}catch(Q){g(s[0][3],Q)}}function d(S){S.value instanceof P?Promise.resolve(S.value.v).then(u,m):g(s[0][2],S)}function u(S){c("next",S)}function m(S){c("throw",S)}function g(S,A){S(A),s.shift(),s.length&&c(s[0][0],s[0][1])}}function An(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:P(r[i](o)),done:!1}:s?s(o):o}:s}}function Be(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 ru=="function"?ru(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(c,d){o=r[s](o),i(c,d,o.done,o.value)})}}function i(s,o,c,d){Promise.resolve(d).then(function(u){s({value:u,done:c})},o)}}var Ia={};tn(Ia,{compareArrayLike:()=>Sa,joinUint8Arrays:()=>ce,memcpy:()=>Bn,rebaseValueOffsets:()=>ai,toArrayBufferView:()=>$,toArrayBufferViewAsyncIterator:()=>xe,toArrayBufferViewIterator:()=>We,toBigInt64Array:()=>Mp,toBigUint64Array:()=>Np,toFloat32Array:()=>Lp,toFloat32ArrayAsyncIterator:()=>Qp,toFloat32ArrayIterator:()=>$p,toFloat64Array:()=>Cp,toFloat64ArrayAsyncIterator:()=>tm,toFloat64ArrayIterator:()=>Yp,toInt16Array:()=>Rp,toInt16ArrayAsyncIterator:()=>Kp,toInt16ArrayIterator:()=>Hp,toInt32Array:()=>rn,toInt32ArrayAsyncIterator:()=>Jp,toInt32ArrayIterator:()=>zp,toInt8Array:()=>Op,toInt8ArrayAsyncIterator:()=>Xp,toInt8ArrayIterator:()=>Vp,toUint16Array:()=>Up,toUint16ArrayAsyncIterator:()=>qp,toUint16ArrayIterator:()=>Wp,toUint32Array:()=>kp,toUint32ArrayAsyncIterator:()=>Zp,toUint32ArrayIterator:()=>jp,toUint8Array:()=>N,toUint8ArrayAsyncIterator:()=>va,toUint8ArrayIterator:()=>wa,toUint8ClampedArray:()=>Pp,toUint8ClampedArrayAsyncIterator:()=>em,toUint8ClampedArrayIterator:()=>Gp});var Fp=new TextDecoder("utf-8"),si=r=>Fp.decode(r),xp=new TextEncoder,Dr=r=>xp.encode(r);var Dp=r=>typeof r=="number",iu=r=>typeof r=="boolean",Dt=r=>typeof r=="function",Xt=r=>r!=null&&Object(r)===r,Te=r=>Xt(r)&&Dt(r.then);var Fe=r=>Xt(r)&&Dt(r[Symbol.iterator]),ye=r=>Xt(r)&&Dt(r[Symbol.asyncIterator]),ws=r=>Xt(r)&&Xt(r.schema);var vs=r=>Xt(r)&&"done"in r&&"value"in r;var Ss=r=>Xt(r)&&Dt(r.stat)&&Dp(r.fd);var Is=r=>Xt(r)&&oi(r.body),As=r=>"_getDOMStream"in r&&"_getNodeStream"in r,su=r=>Xt(r)&&Dt(r.abort)&&Dt(r.getWriter)&&!As(r),oi=r=>Xt(r)&&Dt(r.cancel)&&Dt(r.getReader)&&!As(r),ou=r=>Xt(r)&&Dt(r.end)&&Dt(r.write)&&iu(r.writable)&&!As(r),Bs=r=>Xt(r)&&Dt(r.read)&&Dt(r.pipe)&&iu(r.readable)&&!As(r),au=r=>Xt(r)&&Dt(r.clear)&&Dt(r.bytes)&&Dt(r.position)&&Dt(r.setPosition)&&Dt(r.capacity)&&Dt(r.getBufferIdentifier)&&Dt(r.createLong);var ga=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Ep(r){let t=r[0]?[r[0]]:[],e,n,i,s;for(let o,c,d=0,u=0,m=r.length;++d<m;){if(o=t[u],c=r[d],!o||!c||o.buffer!==c.buffer||c.byteOffset<o.byteOffset){c&&(t[++u]=c);continue}if({byteOffset:e,byteLength:i}=o,{byteOffset:n,byteLength:s}=c,e+i<n||n+s<e){c&&(t[++u]=c);continue}t[u]=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 ce(r,t){let e=Ep(r),n=e.reduce((m,g)=>m+g.byteLength,0),i,s,o,c=0,d=-1,u=Math.min(t||Number.POSITIVE_INFINITY,n);for(let m=e.length;++d<m;){if(i=e[d],s=i.subarray(0,Math.min(i.length,u-c)),u<=c+s.length){s.length<i.length?e[d]=i.subarray(s.length):s.length===i.length&&d++,o?Bn(o,s,c):o=s;break}Bn(o||(o=new Uint8Array(u)),s,c),c+=s.length}return[o||new Uint8Array(0),e.slice(d),n-(o?o.byteLength:0)]}function $(r,t){let e=vs(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=Dr(e)),e instanceof ArrayBuffer?new r(e):e instanceof ga?new r(e):au(e)?$(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 Op=r=>$(Int8Array,r),Rp=r=>$(Int16Array,r),rn=r=>$(Int32Array,r),Mp=r=>$(BigInt64Array,r),N=r=>$(Uint8Array,r),Up=r=>$(Uint16Array,r),kp=r=>$(Uint32Array,r),Np=r=>$(BigUint64Array,r),Lp=r=>$(Float32Array,r),Cp=r=>$(Float64Array,r),Pp=r=>$(Uint8ClampedArray,r),ba=r=>(r.next(),r);function*We(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof ga?e(t):Fe(t)?t:e(t);return yield*en(ba(function*(i){let s=null;do s=i.next(yield $(r,s));while(!s.done)}(n[Symbol.iterator]()))),new r}var Vp=r=>We(Int8Array,r),Hp=r=>We(Int16Array,r),zp=r=>We(Int32Array,r),wa=r=>We(Uint8Array,r),Wp=r=>We(Uint16Array,r),jp=r=>We(Uint32Array,r),$p=r=>We(Float32Array,r),Yp=r=>We(Float64Array,r),Gp=r=>We(Uint8ClampedArray,r);function xe(r,t){return ae(this,arguments,function*(){if(Te(t))return yield P(yield P(yield*en(An(Be(xe(r,yield P(t)))))));let n=function(o){return ae(this,arguments,function*(){yield yield P(yield P(o))})},i=function(o){return ae(this,arguments,function*(){yield P(yield*en(An(Be(ba(function*(c){let d=null;do d=c.next(yield d==null?void 0:d.value);while(!d.done)}(o[Symbol.iterator]()))))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof ga?n(t):Fe(t)?i(t):ye(t)?t:n(t);return yield P(yield*en(An(Be(ba(function(o){return ae(this,arguments,function*(){let c=null;do c=yield P(o.next(yield yield P($(r,c))));while(!c.done)})}(s[Symbol.asyncIterator]())))))),yield P(new r)})}var Xp=r=>xe(Int8Array,r),Kp=r=>xe(Int16Array,r),Jp=r=>xe(Int32Array,r),va=r=>xe(Uint8Array,r),qp=r=>xe(Uint16Array,r),Zp=r=>xe(Uint32Array,r),Qp=r=>xe(Float32Array,r),tm=r=>xe(Float64Array,r),em=r=>xe(Uint8ClampedArray,r);function ai(r,t,e){if(r!==0){e=e.slice(0,t+1);for(let n=-1;++n<=t;)e[n]+=r}return e}function Sa(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 Pt={fromIterable(r){return Ts(rm(r))},fromAsyncIterable(r){return Ts(nm(r))},fromDOMStream(r){return Ts(im(r))},fromNodeStream(r){return Ts(sm(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')}},Ts=r=>(r.next(),r);function*rm(r){let t,e=!1,n=[],i,s,o,c=0;function d(){return s==="peek"?ce(n,o)[0]:([i,n,c]=ce(n,o),i)}({cmd:s,size:o}=yield null);let u=wa(r)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-c)?u.next():u.next(o-c),!t&&i.byteLength>0&&(n.push(i),c+=i.byteLength),t||o<=c)do({cmd:s,size:o}=yield d());while(o<c);while(!t)}catch(m){(e=!0)&&typeof u.throw=="function"&&u.throw(m)}finally{e===!1&&typeof u.return=="function"&&u.return(null)}return null}function nm(r){return ae(this,arguments,function*(){let e,n=!1,i=[],s,o,c,d=0;function u(){return o==="peek"?ce(i,c)[0]:([s,i,d]=ce(i,c),s)}({cmd:o,size:c}=yield yield P(null));let m=va(r)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(c-d)?yield P(m.next()):yield P(m.next(c-d)),!e&&s.byteLength>0&&(i.push(s),d+=s.byteLength),e||c<=d)do({cmd:o,size:c}=yield yield P(u()));while(c<d);while(!e)}catch(g){(n=!0)&&typeof m.throw=="function"&&(yield P(m.throw(g)))}finally{n===!1&&typeof m.return=="function"&&(yield P(m.return(new Uint8Array(0))))}return yield P(null)})}function im(r){return ae(this,arguments,function*(){let e=!1,n=!1,i=[],s,o,c,d=0;function u(){return o==="peek"?ce(i,c)[0]:([s,i,d]=ce(i,c),s)}({cmd:o,size:c}=yield yield P(null));let m=new Ba(r);try{do if({done:e,value:s}=Number.isNaN(c-d)?yield P(m.read()):yield P(m.read(c-d)),!e&&s.byteLength>0&&(i.push(N(s)),d+=s.byteLength),e||c<=d)do({cmd:o,size:c}=yield yield P(u()));while(c<d);while(!e)}catch(g){(n=!0)&&(yield P(m.cancel(g)))}finally{n===!1?yield P(m.cancel()):r.locked&&m.releaseLock()}return yield P(null)})}var Ba=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 I(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 I(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=N(e)),e})}},Aa=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function sm(r){return ae(this,arguments,function*(){let e=[],n="error",i=!1,s=null,o,c,d=0,u=[],m;function g(){return o==="peek"?ce(u,c)[0]:([m,u,d]=ce(u,c),m)}if({cmd:o,size:c}=yield yield P(null),r.isTTY)return yield yield P(new Uint8Array(0)),yield P(null);try{e[0]=Aa(r,"end"),e[1]=Aa(r,"error");do{if(e[2]=Aa(r,"readable"),[n,s]=yield P(Promise.race(e.map(A=>A[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(c-d)?(m=N(r.read(c-d)),m.byteLength<c-d&&(m=N(r.read()))):m=N(r.read()),m.byteLength>0&&(u.push(m),d+=m.byteLength)),i||c<=d)do({cmd:o,size:c}=yield yield P(g()));while(c<d)}while(!i)}finally{yield P(S(e,n==="error"?s:null))}return yield P(null);function S(A,Q){return m=u=null,new Promise((gt,xt)=>{for(let[wt,mt]of A)r.off(wt,mt);try{let wt=r.destroy;wt&&wt.call(r,Q),Q=void 0}catch(wt){Q=wt||Q}finally{Q!=null?xt(Q):gt()}})}})}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 vt;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(vt||(vt={}));var _t;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(_t||(_t={}));var Vt;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(Vt||(Vt={}));var J;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(J||(J={}));var Kt;(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"})(Kt||(Kt={}));var rt;(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"})(rt||(rt={}));var p;(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"})(p||(p={}));var be;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(be||(be={}));var za={};tn(za,{clampIndex:()=>Km,clampRange:()=>di,createElementComparator:()=>Rr});function je(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=>je(t)),"]"):"[".concat(r,"]"):ArrayBuffer.isView(r)?"[".concat(r,"]"):JSON.stringify(r,(t,e)=>typeof e=="bigint"?"".concat(e):e)}var Fa={};tn(Fa,{BN:()=>li,bigNumToBigInt:()=>uu,bigNumToString:()=>xn,isArrowBigNumSymbol:()=>cu});var cu=Symbol.for("isArrowBigNum");function De(r,...t){return t.length===0?Object.setPrototypeOf($(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}De.prototype[cu]=!0;De.prototype.toJSON=function(){return'"'.concat(xn(this),'"')};De.prototype.valueOf=function(){return lu(this)};De.prototype.toString=function(){return xn(this)};De.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return lu(this);case"string":return xn(this);case"default":return uu(this)}return xn(this)};function Tn(...r){return De.apply(this,r)}function Fn(...r){return De.apply(this,r)}function ci(...r){return De.apply(this,r)}Object.setPrototypeOf(Tn.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Fn.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(ci.prototype,Object.create(Uint32Array.prototype));Object.assign(Tn.prototype,De.prototype,{constructor:Tn,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Fn.prototype,De.prototype,{constructor:Fn,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(ci.prototype,De.prototype,{constructor:ci,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function lu(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),c=BigInt(o?1:0),d=BigInt(0);if(o){for(let u of s)c+=~u*(BigInt(1)<<BigInt(32)*d++);c*=BigInt(-1)}else for(let u of s)c+=u*(BigInt(1)<<BigInt(32)*d++);return c}var xn=r=>{if(r.byteLength===8){let s=new r.BigIntArray(r.buffer,r.byteOffset,1);return"".concat(s[0])}if(!r.signed)return Ta(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Ta(r);t=t.slice();let n=1;for(let s=0;s<t.length;s++){let o=t[s],c=~o+n;t[s]=c,n&=o===0?1:0}let i=Ta(t);return"-".concat(i)},uu=r=>r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:xn(r);function Ta(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 li=class r{static new(t,e){switch(e){case!0:return new Tn(t);case!1:return new Fn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Tn(t)}return t.byteLength===16?new ci(t):new Fn(t)}static signed(t){return new Tn(t)}static unsigned(t){return new Fn(t)}static decimal(t){return new ci(t)}constructor(t,e){return r.new(t,e)}};function te(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 du,fu,hu,pu,mu,_u,yu,bu,gu,wu,vu,Su,Iu,Au,Bu,Tu,Fu,xu,Du,D=class r{static isNull(t){return(t==null?void 0:t.typeId)===p.Null}static isInt(t){return(t==null?void 0:t.typeId)===p.Int}static isFloat(t){return(t==null?void 0:t.typeId)===p.Float}static isBinary(t){return(t==null?void 0:t.typeId)===p.Binary}static isUtf8(t){return(t==null?void 0:t.typeId)===p.Utf8}static isBool(t){return(t==null?void 0:t.typeId)===p.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===p.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===p.Date}static isTime(t){return(t==null?void 0:t.typeId)===p.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===p.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===p.Interval}static isList(t){return(t==null?void 0:t.typeId)===p.List}static isStruct(t){return(t==null?void 0:t.typeId)===p.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===p.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===p.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===p.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===p.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===p.Dictionary}static isDenseUnion(t){return r.isUnion(t)&&t.mode===vt.Dense}static isSparseUnion(t){return r.isUnion(t)&&t.mode===vt.Sparse}get typeId(){return p.NONE}};du=Symbol.toStringTag;D[du]=(r=>(r.children=null,r.ArrayType=Array,r[Symbol.toStringTag]="DataType"))(D.prototype);var Jt=class extends D{toString(){return"Null"}get typeId(){return p.Null}};fu=Symbol.toStringTag;Jt[fu]=(r=>r[Symbol.toStringTag]="Null")(Jt.prototype);var Bt=class extends D{constructor(t,e){super(),this.isSigned=t,this.bitWidth=e}get typeId(){return p.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)}};hu=Symbol.toStringTag;Bt[hu]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(Bt.prototype);var Fs=class extends Bt{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},xs=class extends Bt{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},$e=class extends Bt{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Ds=class extends Bt{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Es=class extends Bt{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Os=class extends Bt{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Rs=class extends Bt{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Ms=class extends Bt{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Fs.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(xs.prototype,"ArrayType",{value:Int16Array});Object.defineProperty($e.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Ds.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Es.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Os.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Rs.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Ms.prototype,"ArrayType",{value:BigUint64Array});var ee=class extends D{constructor(t){super(),this.precision=t}get typeId(){return p.Float}get ArrayType(){switch(this.precision){case _t.HALF:return Uint16Array;case _t.SINGLE:return Float32Array;case _t.DOUBLE:return Float64Array}throw new Error("Unrecognized ".concat(this[Symbol.toStringTag]," type"))}toString(){return"Float".concat(this.precision<<5||16)}};pu=Symbol.toStringTag;ee[pu]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(ee.prototype);var Us=class extends ee{constructor(){super(_t.HALF)}},ks=class extends ee{constructor(){super(_t.SINGLE)}},Ns=class extends ee{constructor(){super(_t.DOUBLE)}};Object.defineProperty(Us.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ks.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Ns.prototype,"ArrayType",{value:Float64Array});var ar=class extends D{constructor(){super()}get typeId(){return p.Binary}toString(){return"Binary"}};mu=Symbol.toStringTag;ar[mu]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(ar.prototype);var cr=class extends D{constructor(){super()}get typeId(){return p.Utf8}toString(){return"Utf8"}};_u=Symbol.toStringTag;cr[_u]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(cr.prototype);var lr=class extends D{constructor(){super()}get typeId(){return p.Bool}toString(){return"Bool"}};yu=Symbol.toStringTag;lr[yu]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(lr.prototype);var ur=class extends D{constructor(t,e,n=128){super(),this.scale=t,this.precision=e,this.bitWidth=n}get typeId(){return p.Decimal}toString(){return"Decimal[".concat(this.precision,"e").concat(this.scale>0?"+":"").concat(this.scale,"]")}};bu=Symbol.toStringTag;ur[bu]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(ur.prototype);var dr=class extends D{constructor(t){super(),this.unit=t}get typeId(){return p.Date}toString(){return"Date".concat((this.unit+1)*32,"<").concat(Vt[this.unit],">")}};gu=Symbol.toStringTag;dr[gu]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Date"))(dr.prototype);var Ee=class extends D{constructor(t,e){super(),this.unit=t,this.bitWidth=e}get typeId(){return p.Time}toString(){return"Time".concat(this.bitWidth,"<").concat(J[this.unit],">")}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error("Unrecognized ".concat(this[Symbol.toStringTag]," type"))}};wu=Symbol.toStringTag;Ee[wu]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(Ee.prototype);var fr=class extends D{constructor(t,e){super(),this.unit=t,this.timezone=e}get typeId(){return p.Timestamp}toString(){return"Timestamp<".concat(J[this.unit]).concat(this.timezone?", ".concat(this.timezone):"",">")}};vu=Symbol.toStringTag;fr[vu]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Timestamp"))(fr.prototype);var hr=class extends D{constructor(t){super(),this.unit=t}get typeId(){return p.Interval}toString(){return"Interval<".concat(Kt[this.unit],">")}};Su=Symbol.toStringTag;hr[Su]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(hr.prototype);var Oe=class extends D{constructor(t){super(),this.children=[t]}get typeId(){return p.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}};Iu=Symbol.toStringTag;Oe[Iu]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(Oe.prototype);var ft=class extends D{constructor(t){super(),this.children=t}get typeId(){return p.Struct}toString(){return"Struct<{".concat(this.children.map(t=>"".concat(t.name,":").concat(t.type)).join(", "),"}>")}};Au=Symbol.toStringTag;ft[Au]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(ft.prototype);var Re=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 p.Union}toString(){return"".concat(this[Symbol.toStringTag],"<").concat(this.children.map(t=>"".concat(t.type)).join(" | "),">")}};Bu=Symbol.toStringTag;Re[Bu]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(Re.prototype);var pr=class extends D{constructor(t){super(),this.byteWidth=t}get typeId(){return p.FixedSizeBinary}toString(){return"FixedSizeBinary[".concat(this.byteWidth,"]")}};Tu=Symbol.toStringTag;pr[Tu]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(pr.prototype);var Me=class extends D{constructor(t,e){super(),this.listSize=t,this.children=[e]}get typeId(){return p.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,">")}};Fu=Symbol.toStringTag;Me[Fu]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Me.prototype);var Ue=class extends D{constructor(t,e=!1){super(),this.children=[t],this.keysSorted=e}get typeId(){return p.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(", "),"}>")}};xu=Symbol.toStringTag;Ue[xu]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(Ue.prototype);var om=(r=>()=>++r)(-1),le=class extends D{constructor(t,e,n,i){super(),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?om():te(n)}get typeId(){return p.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,">")}};Du=Symbol.toStringTag;le[Du]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(le.prototype);function ue(r){let t=r;switch(r.typeId){case p.Decimal:return r.bitWidth/32;case p.Timestamp:return 2;case p.Date:return 1+t.unit;case p.Interval:return 1+t.unit;case p.FixedSizeList:return t.listSize;case p.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 am(this,t,e)}getVisitFnByTypeId(t,e=!0){return Dn(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 am(r,t,e=!0){return typeof t=="number"?Dn(r,t,e):typeof t=="string"&&t in p?Dn(r,p[t],e):t&&t instanceof D?Dn(r,Eu(t),e):t!=null&&t.type&&t.type instanceof D?Dn(r,Eu(t.type),e):Dn(r,p.NONE,e)}function Dn(r,t,e=!0){let n=null;switch(t){case p.Null:n=r.visitNull;break;case p.Bool:n=r.visitBool;break;case p.Int:n=r.visitInt;break;case p.Int8:n=r.visitInt8||r.visitInt;break;case p.Int16:n=r.visitInt16||r.visitInt;break;case p.Int32:n=r.visitInt32||r.visitInt;break;case p.Int64:n=r.visitInt64||r.visitInt;break;case p.Uint8:n=r.visitUint8||r.visitInt;break;case p.Uint16:n=r.visitUint16||r.visitInt;break;case p.Uint32:n=r.visitUint32||r.visitInt;break;case p.Uint64:n=r.visitUint64||r.visitInt;break;case p.Float:n=r.visitFloat;break;case p.Float16:n=r.visitFloat16||r.visitFloat;break;case p.Float32:n=r.visitFloat32||r.visitFloat;break;case p.Float64:n=r.visitFloat64||r.visitFloat;break;case p.Utf8:n=r.visitUtf8;break;case p.Binary:n=r.visitBinary;break;case p.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case p.Date:n=r.visitDate;break;case p.DateDay:n=r.visitDateDay||r.visitDate;break;case p.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case p.Timestamp:n=r.visitTimestamp;break;case p.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case p.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case p.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case p.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case p.Time:n=r.visitTime;break;case p.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case p.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case p.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case p.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case p.Decimal:n=r.visitDecimal;break;case p.List:n=r.visitList;break;case p.Struct:n=r.visitStruct;break;case p.Union:n=r.visitUnion;break;case p.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case p.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case p.Dictionary:n=r.visitDictionary;break;case p.Interval:n=r.visitInterval;break;case p.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case p.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case p.FixedSizeList:n=r.visitFixedSizeList;break;case p.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error("Unrecognized type '".concat(p[t],"'"))}function Eu(r){switch(r.typeId){case p.Null:return p.Null;case p.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?p.Int8:p.Uint8;case 16:return e?p.Int16:p.Uint16;case 32:return e?p.Int32:p.Uint32;case 64:return e?p.Int64:p.Uint64}return p.Int}case p.Float:switch(r.precision){case _t.HALF:return p.Float16;case _t.SINGLE:return p.Float32;case _t.DOUBLE:return p.Float64}return p.Float;case p.Binary:return p.Binary;case p.Utf8:return p.Utf8;case p.Bool:return p.Bool;case p.Decimal:return p.Decimal;case p.Time:switch(r.unit){case J.SECOND:return p.TimeSecond;case J.MILLISECOND:return p.TimeMillisecond;case J.MICROSECOND:return p.TimeMicrosecond;case J.NANOSECOND:return p.TimeNanosecond}return p.Time;case p.Timestamp:switch(r.unit){case J.SECOND:return p.TimestampSecond;case J.MILLISECOND:return p.TimestampMillisecond;case J.MICROSECOND:return p.TimestampMicrosecond;case J.NANOSECOND:return p.TimestampNanosecond}return p.Timestamp;case p.Date:switch(r.unit){case Vt.DAY:return p.DateDay;case Vt.MILLISECOND:return p.DateMillisecond}return p.Date;case p.Interval:switch(r.unit){case Kt.DAY_TIME:return p.IntervalDayTime;case Kt.YEAR_MONTH:return p.IntervalYearMonth}return p.Interval;case p.Map:return p.Map;case p.List:return p.List;case p.Struct:return p.Struct;case p.Union:switch(r.mode){case vt.Dense:return p.DenseUnion;case vt.Sparse:return p.SparseUnion}return p.Union;case p.FixedSizeBinary:return p.FixedSizeBinary;case p.FixedSizeList:return p.FixedSizeList;case p.Dictionary:return p.Dictionary}throw new Error("Unrecognized type '".concat(p[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 xa={};tn(xa,{float64ToUint16:()=>ui,uint16ToFloat64:()=>Ls});var Ou=new Float64Array(1),En=new Uint32Array(Ou.buffer);function Ls(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 ui(r){if(r!==r)return 32256;Ou[0]=r;let t=(En[1]&2147483648)>>16&65535,e=En[1]&2146435072,n=0;return e>=1089470464?En[0]>0?e=31744:(e=(e&2080374784)>>16,n=(En[1]&1048575)>>10):e<=1056964608?(n=1048576+(En[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(En[1]&1048575)+512>>10),t|e|n&65535}var L=class extends E{};function j(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var cm=(r,t,e)=>{r[t]=Math.trunc(e/864e5)},Da=(r,t,e)=>{r[t]=Math.trunc(e%4294967296),r[t+1]=Math.trunc(e/4294967296)},lm=(r,t,e)=>{r[t]=Math.trunc(e*1e3%4294967296),r[t+1]=Math.trunc(e*1e3/4294967296)},um=(r,t,e)=>{r[t]=Math.trunc(e*1e6%4294967296),r[t+1]=Math.trunc(e*1e6/4294967296)},Ru=(r,t,e,n)=>{if(e+1<t.length){let{[e]:i,[e+1]:s}=t;r.set(n.subarray(0,s-i),i)}},dm=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},mr=({values:r},t,e)=>{r[t]=e},Ea=({values:r},t,e)=>{r[t]=e},Mu=({values:r},t,e)=>{r[t]=ui(e)},fm=(r,t,e)=>{switch(r.type.precision){case _t.HALF:return Mu(r,t,e);case _t.SINGLE:case _t.DOUBLE:return Ea(r,t,e)}},Cs=({values:r},t,e)=>{cm(r,t,e.valueOf())},Ps=({values:r},t,e)=>{Da(r,t*2,e.valueOf())},Oa=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},hm=({values:r,valueOffsets:t},e,n)=>Ru(r,t,e,n),pm=({values:r,valueOffsets:t},e,n)=>{Ru(r,t,e,Dr(n))},Ra=(r,t,e)=>{r.type.unit===Vt.DAY?Cs(r,t,e):Ps(r,t,e)},Vs=({values:r},t,e)=>Da(r,t*2,e/1e3),Hs=({values:r},t,e)=>Da(r,t*2,e),zs=({values:r},t,e)=>lm(r,t*2,e),Ws=({values:r},t,e)=>um(r,t*2,e),Ma=(r,t,e)=>{switch(r.type.unit){case J.SECOND:return Vs(r,t,e);case J.MILLISECOND:return Hs(r,t,e);case J.MICROSECOND:return zs(r,t,e);case J.NANOSECOND:return Ws(r,t,e)}},js=({values:r},t,e)=>{r[t]=e},$s=({values:r},t,e)=>{r[t]=e},Ys=({values:r},t,e)=>{r[t]=e},Gs=({values:r},t,e)=>{r[t]=e},Ua=(r,t,e)=>{switch(r.type.unit){case J.SECOND:return js(r,t,e);case J.MILLISECOND:return $s(r,t,e);case J.MICROSECOND:return Ys(r,t,e);case J.NANOSECOND:return Gs(r,t,e)}},ka=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},mm=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,s=Ht.getVisitFn(n);if(Array.isArray(e))for(let o=-1,c=i[t],d=i[t+1];c<d;)s(n,c++,e[++o]);else for(let o=-1,c=i[t],d=i[t+1];c<d;)s(n,c++,e.get(++o))},_m=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,s=Ht.getVisitFn(n),{[t]:o,[t+1]:c}=i,d=e instanceof Map?e.entries():Object.entries(e);for(let u of d)if(s(n,o,u),++o>=c)break},ym=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),bm=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),gm=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),wm=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),vm=(r,t,e)=>{let n=r.type.children.map(s=>Ht.getVisitFn(s.type)),i=e instanceof Map?gm(t,e):e instanceof q?bm(t,e):Array.isArray(e)?ym(t,e):wm(t,e);r.type.children.forEach((s,o)=>i(n[o],r.children[o],s,o))},Sm=(r,t,e)=>{r.type.mode===vt.Dense?Uu(r,t,e):ku(r,t,e)},Uu=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Ht.visit(i,r.valueOffsets[t],e)},ku=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Ht.visit(i,t,e)},Im=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},Na=(r,t,e)=>{r.type.unit===Kt.DAY_TIME?Xs(r,t,e):Ks(r,t,e)},Xs=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},Ks=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},Am=(r,t,e)=>{let{stride:n}=r,i=r.children[0],s=Ht.getVisitFn(i);if(Array.isArray(e))for(let o=-1,c=t*n;++o<n;)s(i,c+o,e[o]);else for(let o=-1,c=t*n;++o<n;)s(i,c+o,e.get(o))};L.prototype.visitBool=j(dm);L.prototype.visitInt=j(mr);L.prototype.visitInt8=j(mr);L.prototype.visitInt16=j(mr);L.prototype.visitInt32=j(mr);L.prototype.visitInt64=j(mr);L.prototype.visitUint8=j(mr);L.prototype.visitUint16=j(mr);L.prototype.visitUint32=j(mr);L.prototype.visitUint64=j(mr);L.prototype.visitFloat=j(fm);L.prototype.visitFloat16=j(Mu);L.prototype.visitFloat32=j(Ea);L.prototype.visitFloat64=j(Ea);L.prototype.visitUtf8=j(pm);L.prototype.visitBinary=j(hm);L.prototype.visitFixedSizeBinary=j(Oa);L.prototype.visitDate=j(Ra);L.prototype.visitDateDay=j(Cs);L.prototype.visitDateMillisecond=j(Ps);L.prototype.visitTimestamp=j(Ma);L.prototype.visitTimestampSecond=j(Vs);L.prototype.visitTimestampMillisecond=j(Hs);L.prototype.visitTimestampMicrosecond=j(zs);L.prototype.visitTimestampNanosecond=j(Ws);L.prototype.visitTime=j(Ua);L.prototype.visitTimeSecond=j(js);L.prototype.visitTimeMillisecond=j($s);L.prototype.visitTimeMicrosecond=j(Ys);L.prototype.visitTimeNanosecond=j(Gs);L.prototype.visitDecimal=j(ka);L.prototype.visitList=j(mm);L.prototype.visitStruct=j(vm);L.prototype.visitUnion=j(Sm);L.prototype.visitDenseUnion=j(Uu);L.prototype.visitSparseUnion=j(ku);L.prototype.visitDictionary=j(Im);L.prototype.visitInterval=j(Na);L.prototype.visitIntervalDayTime=j(Xs);L.prototype.visitIntervalYearMonth=j(Ks);L.prototype.visitFixedSizeList=j(Am);L.prototype.visitMap=j(_m);var Ht=new L;var ke=Symbol.for("parent"),On=Symbol.for("rowIndex"),Er=class{constructor(t,e){return this[ke]=t,this[On]=e,new Proxy(this,new Ca)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[On],e=this[ke],n=e.type.children,i={};for(let s=-1,o=n.length;++s<o;)i[n[s].name]=Ft.visit(e.children[s],t);return i}toString(){return"{".concat([...this].map(([t,e])=>"".concat(je(t),": ").concat(je(e))).join(", "),"}")}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new La(this[ke],this[On])}},La=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,Ft.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Er.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[ke]:{writable:!0,enumerable:!1,configurable:!1,value:null},[On]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var Ca=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[ke].type.children.map(e=>e.name)}has(t,e){return t[ke].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[ke].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[ke].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=Ft.visit(t[ke].children[n],t[On]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[ke].type.children.findIndex(s=>s.name===e);return i!==-1?(Ht.visit(t[ke].children[i],t[On],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 H(r){return(t,e)=>t.getValid(e)?r(t,e):null}var Bm=(r,t)=>864e5*r[t],Pa=(r,t)=>4294967296*r[t+1]+(r[t]>>>0),Tm=(r,t)=>4294967296*(r[t+1]/1e3)+(r[t]>>>0)/1e3,Fm=(r,t)=>4294967296*(r[t+1]/1e6)+(r[t]>>>0)/1e6,Nu=r=>new Date(r),xm=(r,t)=>Nu(Bm(r,t)),Dm=(r,t)=>Nu(Pa(r,t)),Em=(r,t)=>null,Lu=(r,t,e)=>{if(e+1>=t.length)return null;let n=t[e],i=t[e+1];return r.subarray(n,i)},Om=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},Cu=({values:r},t)=>xm(r,t),Pu=({values:r},t)=>Dm(r,t*2),Or=({stride:r,values:t},e)=>t[r*e],Rm=({stride:r,values:t},e)=>Ls(t[r*e]),Vu=({values:r},t)=>r[t],Mm=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),Um=({values:r,valueOffsets:t},e)=>Lu(r,t,e),km=({values:r,valueOffsets:t},e)=>{let n=Lu(r,t,e);return n!==null?si(n):null},Nm=({values:r},t)=>r[t],Lm=({type:r,values:t},e)=>r.precision!==_t.HALF?t[e]:Ls(t[e]),Cm=(r,t)=>r.type.unit===Vt.DAY?Cu(r,t):Pu(r,t),Hu=({values:r},t)=>1e3*Pa(r,t*2),zu=({values:r},t)=>Pa(r,t*2),Wu=({values:r},t)=>Tm(r,t*2),ju=({values:r},t)=>Fm(r,t*2),Pm=(r,t)=>{switch(r.type.unit){case J.SECOND:return Hu(r,t);case J.MILLISECOND:return zu(r,t);case J.MICROSECOND:return Wu(r,t);case J.NANOSECOND:return ju(r,t)}},$u=({values:r},t)=>r[t],Yu=({values:r},t)=>r[t],Gu=({values:r},t)=>r[t],Xu=({values:r},t)=>r[t],Vm=(r,t)=>{switch(r.type.unit){case J.SECOND:return $u(r,t);case J.MILLISECOND:return Yu(r,t);case J.MICROSECOND:return Gu(r,t);case J.NANOSECOND:return Xu(r,t)}},Hm=({values:r,stride:t},e)=>li.decimal(r.subarray(t*e,t*(e+1))),zm=(r,t)=>{let{valueOffsets:e,stride:n,children:i}=r,{[t*n]:s,[t*n+1]:o}=e,d=i[0].slice(s,o-s);return new q([d])},Wm=(r,t)=>{let{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:s}=e,o=n[0];return new Ye(o.slice(i,s-i))},jm=(r,t)=>new Er(r,t),$m=(r,t)=>r.type.mode===vt.Dense?Ku(r,t):Ju(r,t),Ku=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return Ft.visit(n,r.valueOffsets[t])},Ju=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return Ft.visit(n,t)},Ym=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},Gm=(r,t)=>r.type.unit===Kt.DAY_TIME?qu(r,t):Zu(r,t),qu=({values:r},t)=>r.subarray(2*t,2*(t+1)),Zu=({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},Xm=(r,t)=>{let{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new q([s])};R.prototype.visitNull=H(Em);R.prototype.visitBool=H(Om);R.prototype.visitInt=H(Nm);R.prototype.visitInt8=H(Or);R.prototype.visitInt16=H(Or);R.prototype.visitInt32=H(Or);R.prototype.visitInt64=H(Vu);R.prototype.visitUint8=H(Or);R.prototype.visitUint16=H(Or);R.prototype.visitUint32=H(Or);R.prototype.visitUint64=H(Vu);R.prototype.visitFloat=H(Lm);R.prototype.visitFloat16=H(Rm);R.prototype.visitFloat32=H(Or);R.prototype.visitFloat64=H(Or);R.prototype.visitUtf8=H(km);R.prototype.visitBinary=H(Um);R.prototype.visitFixedSizeBinary=H(Mm);R.prototype.visitDate=H(Cm);R.prototype.visitDateDay=H(Cu);R.prototype.visitDateMillisecond=H(Pu);R.prototype.visitTimestamp=H(Pm);R.prototype.visitTimestampSecond=H(Hu);R.prototype.visitTimestampMillisecond=H(zu);R.prototype.visitTimestampMicrosecond=H(Wu);R.prototype.visitTimestampNanosecond=H(ju);R.prototype.visitTime=H(Vm);R.prototype.visitTimeSecond=H($u);R.prototype.visitTimeMillisecond=H(Yu);R.prototype.visitTimeMicrosecond=H(Gu);R.prototype.visitTimeNanosecond=H(Xu);R.prototype.visitDecimal=H(Hm);R.prototype.visitList=H(zm);R.prototype.visitStruct=H(jm);R.prototype.visitUnion=H($m);R.prototype.visitDenseUnion=H(Ku);R.prototype.visitSparseUnion=H(Ju);R.prototype.visitDictionary=H(Ym);R.prototype.visitInterval=H(Gm);R.prototype.visitIntervalDayTime=H(qu);R.prototype.visitIntervalYearMonth=H(Zu);R.prototype.visitFixedSizeList=H(Xm);R.prototype.visitMap=H(Wm);var Ft=new R;var ge=Symbol.for("keys"),Rn=Symbol.for("vals"),Ye=class{constructor(t){return this[ge]=new q([t.children[0]]).memoize(),this[Rn]=t.children[1],new Proxy(this,new Ha)}[Symbol.iterator](){return new Va(this[ge],this[Rn])}get size(){return this[ge].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[ge],e=this[Rn],n={};for(let i=-1,s=t.length;++i<s;)n[t.get(i)]=Ft.visit(e,i);return n}toString(){return"{".concat([...this].map(([t,e])=>"".concat(je(t),": ").concat(je(e))).join(", "),"}")}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},Va=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),Ft.visit(this.vals,t)]})}},Ha=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[ge].toArray().map(String)}has(t,e){return t[ge].includes(e)}getOwnPropertyDescriptor(t,e){if(t[ge].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[ge].indexOf(e);if(n!==-1){let i=Ft.visit(Reflect.get(t,Rn),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[ge].indexOf(e);return i!==-1?(Ht.visit(Reflect.get(t,Rn),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(Ye.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[ge]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Rn]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function Km(r,t,e){let n=r.length,i=t>-1?t:n+t%n;return e?e(r,i):i}var Qu;function di(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&&(Qu=s,s=o,o=Qu),o>i&&(o=i),n?n(r,s,o):[s,o]}var td=r=>r!==r;function Rr(r){if(typeof r!=="object"||r===null)return td(r)?td: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?Sa(r,e):!1:r instanceof Map?qm(r):Array.isArray(r)?Jm(r):r instanceof q?Zm(r):Qm(r,!0)}function Jm(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Rr(r[e]);return Js(t)}function qm(r){let t=-1,e=[];for(let n of r.values())e[++t]=Rr(n);return Js(e)}function Zm(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Rr(r.get(e));return Js(t)}function Qm(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]=Rr(r[e[i]]);return Js(n,e)}function Js(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return t_(r,e);case Map:return ed(r,e,e.keys());case Ye:case Er:case Object:case void 0:return ed(r,e,t||Object.keys(e))}return e instanceof q?e_(r,e):!1}}function t_(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 e_(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 ed(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,c=r.length,d=s.next(),u=n.next(),m=i.next();for(;o<c&&!u.done&&!m.done&&!d.done&&!(u.value!==m.value||!r[o](d.value));++o,u=n.next(),m=i.next(),d=s.next());return o===c&&u.done&&m.done&&d.done?!0:(n.return&&n.return(),i.return&&i.return(),s.return&&s.return(),!1)}var Wa={};tn(Wa,{BitIterator:()=>nn,getBit:()=>rd,getBool:()=>Zs,packBools:()=>sn,popcnt_array:()=>nd,popcnt_bit_range:()=>fi,popcnt_uint32:()=>qs,setBool:()=>r_,truncateBitmap:()=>Mn});function Zs(r,t,e,n){return(e&1<<n)!==0}function rd(r,t,e,n){return(e&1<<n)>>n}function r_(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function Mn(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):sn(new nn(e,r,t,null,Zs)).subarray(0,n)),i}return e}function sn(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 nn=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 fi(r,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(let o of new nn(r,t,e-t,r,rd))s+=o;return s}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return fi(r,t,i)+fi(r,n,e)+nd(r,i>>3,n-i>>3)}function nd(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+=qs(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=qs(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=qs(s.getUint8(i)),i+=1;return n}function qs(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 n_=-1,lt=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,c)=>o+c.byteLength,t)}get nullCount(){let t=this._nullCount,e;return t<=n_&&(e=this.nullBitmap)&&(this._nullCount=t=this.length-fi(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,i,s,o=[],c){this.type=t,this.children=o,this.dictionary=c,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 d;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=ue(t),s&&((d=s[0])&&(this.valueOffsets=d),(d=s[1])&&(this.values=d),(d=s[2])&&(this.nullBitmap=d),(d=s[3])&&(this.typeIds=d))),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:d}=this._changeLengthAndBackfillNullBitmap(this.length);Object.assign(this,{nullBitmap:d,_nullCount:0})}let{nullBitmap:n,offset:i}=this,s=i+t>>3,o=(i+t)%8,c=n[s]>>o&1;return e?c===0&&(n[s]|=1<<o,this._nullCount=this.nullCount+1):c===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,c=i===16?n:1,d=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,o,d,s.length===0||this.valueOffsets?s:this._sliceChildren(s,c*t,c*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===p.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(Mn(this.offset,e,this.nullBitmap),0);let s=this.buffers;return s[be.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[be.TYPE])&&(o[be.TYPE]=s.subarray(t,t+e)),(s=o[be.OFFSET])&&(o[be.OFFSET]=s.subarray(t,t+e+1))||(s=o[be.DATA])&&(o[be.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};lt.prototype.children=Object.freeze([]);var ja=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 lt(e,n,i,0)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new lt(e,n,o,c,[void 0,s,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new lt(e,n,o,c,[void 0,s,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new lt(e,n,o,c,[void 0,s,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.data),s=N(t.nullBitmap),o=rn(t.valueOffsets),{["length"]:c=o.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new lt(e,n,c,d,[o,i,s])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.data),s=N(t.nullBitmap),o=rn(t.valueOffsets),{["length"]:c=o.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new lt(e,n,c,d,[o,i,s])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/ue(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new lt(e,n,o,c,[void 0,s,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/ue(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new lt(e,n,o,c,[void 0,s,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/ue(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new lt(e,n,o,c,[void 0,s,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/ue(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new lt(e,n,o,c,[void 0,s,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/ue(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new lt(e,n,o,c,[void 0,s,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,s=N(t.nullBitmap),o=rn(t.valueOffsets),{["length"]:c=o.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new lt(e,n,c,d,[o,void 0,s],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=N(t.nullBitmap),{length:o=i.reduce((d,{length:u})=>Math.max(d,u),0),nullCount:c=t.nullBitmap?-1:0}=t;return new lt(e,n,o,c,[void 0,void 0,s],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=N(t.nullBitmap),o=$(e.ArrayType,t.typeIds),{["length"]:c=o.length,["nullCount"]:d=t.nullBitmap?-1:0}=t;if(D.isSparseUnion(e))return new lt(e,n,c,d,[void 0,void 0,s,o],i);let u=rn(t.valueOffsets);return new lt(e,n,c,d,[u,void 0,s,o],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.indices.ArrayType,t.data),{["dictionary"]:o=new q([new r().visit({type:e.dictionary})])}=t,{["length"]:c=s.length,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new lt(e,n,c,d,[void 0,s,i],[],o)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/ue(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new lt(e,n,o,c,[void 0,s,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new r().visit({type:e.valueType})}=t,s=N(t.nullBitmap),{["length"]:o=i.length/ue(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new lt(e,n,o,c,[void 0,void 0,s],[i])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new r().visit({type:e.childType})}=t,s=N(t.nullBitmap),o=rn(t.valueOffsets),{["length"]:c=o.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new lt(e,n,c,d,[o,void 0,s],[i])}};function V(r){return new ja().visit(r)}var hi=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 Qs(r){return r.reduce((t,e)=>t+e.nullCount,0)}function to(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function eo(r,t,e,n){let i=[];for(let s=-1,o=r.length;++s<o;){let c=r[s],d=t[s],{length:u}=c;if(d>=n)break;if(e>=d+u)continue;if(d>=e&&d+u<=n){i.push(c);continue}let m=Math.max(0,e-d),g=Math.min(n-d,u);i.push(c.slice(m,g-m))}return i.length===0&&i.push(r[0].slice(0,0)),i}function $a(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 pi(r,t){return r.getValid(t)}function Mr(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return $a(n,this._offsets,e,t)}}function ro(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=$a(s,this._offsets,n,e);return t=void 0,o}}function no(r){let t;function e(n,i,s){let o=s,c=0,d=0;for(let u=i-1,m=n.length;++u<m;){let g=n[u];if(~(c=r(g,t,o)))return d+c;o=0,d+=g.length}return-1}return function(n,i){t=n;let s=this.data,o=typeof i!="number"?e(s,0,0):$a(s,this._offsets,i,e);return t=void 0,o}}var M=class extends E{};function i_(r,t){return t===null&&r.length>0?0:-1}function s_(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new nn(e,r.offset+(t||0),r.length,e,Zs)){if(!i)return n;++n}return-1}function Y(r,t,e){if(t===void 0)return-1;if(t===null)return s_(r,e);let n=Ft.getVisitFn(r),i=Rr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}function id(r,t,e){let n=Ft.getVisitFn(r),i=Rr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}M.prototype.visitNull=i_;M.prototype.visitBool=Y;M.prototype.visitInt=Y;M.prototype.visitInt8=Y;M.prototype.visitInt16=Y;M.prototype.visitInt32=Y;M.prototype.visitInt64=Y;M.prototype.visitUint8=Y;M.prototype.visitUint16=Y;M.prototype.visitUint32=Y;M.prototype.visitUint64=Y;M.prototype.visitFloat=Y;M.prototype.visitFloat16=Y;M.prototype.visitFloat32=Y;M.prototype.visitFloat64=Y;M.prototype.visitUtf8=Y;M.prototype.visitBinary=Y;M.prototype.visitFixedSizeBinary=Y;M.prototype.visitDate=Y;M.prototype.visitDateDay=Y;M.prototype.visitDateMillisecond=Y;M.prototype.visitTimestamp=Y;M.prototype.visitTimestampSecond=Y;M.prototype.visitTimestampMillisecond=Y;M.prototype.visitTimestampMicrosecond=Y;M.prototype.visitTimestampNanosecond=Y;M.prototype.visitTime=Y;M.prototype.visitTimeSecond=Y;M.prototype.visitTimeMillisecond=Y;M.prototype.visitTimeMicrosecond=Y;M.prototype.visitTimeNanosecond=Y;M.prototype.visitDecimal=Y;M.prototype.visitList=Y;M.prototype.visitStruct=Y;M.prototype.visitUnion=Y;M.prototype.visitDenseUnion=id;M.prototype.visitSparseUnion=id;M.prototype.visitDictionary=Y;M.prototype.visitInterval=Y;M.prototype.visitIntervalDayTime=Y;M.prototype.visitIntervalYearMonth=Y;M.prototype.visitFixedSizeList=Y;M.prototype.visitMap=Y;var on=new M;var U=class extends E{};function z(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(t.typeId===p.Timestamp||t instanceof Bt&&t.bitWidth!==64||t instanceof Ee&&t.bitWidth!==64||t instanceof ee&&t.precision!==_t.HALF))return new hi(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new hi(r.data.length,n=>{let s=r.data[n].length,o=r.slice(e,e+s);return e+=s,new Ya(o)})}var Ya=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=z;U.prototype.visitBool=z;U.prototype.visitInt=z;U.prototype.visitInt8=z;U.prototype.visitInt16=z;U.prototype.visitInt32=z;U.prototype.visitInt64=z;U.prototype.visitUint8=z;U.prototype.visitUint16=z;U.prototype.visitUint32=z;U.prototype.visitUint64=z;U.prototype.visitFloat=z;U.prototype.visitFloat16=z;U.prototype.visitFloat32=z;U.prototype.visitFloat64=z;U.prototype.visitUtf8=z;U.prototype.visitBinary=z;U.prototype.visitFixedSizeBinary=z;U.prototype.visitDate=z;U.prototype.visitDateDay=z;U.prototype.visitDateMillisecond=z;U.prototype.visitTimestamp=z;U.prototype.visitTimestampSecond=z;U.prototype.visitTimestampMillisecond=z;U.prototype.visitTimestampMicrosecond=z;U.prototype.visitTimestampNanosecond=z;U.prototype.visitTime=z;U.prototype.visitTimeSecond=z;U.prototype.visitTimeMillisecond=z;U.prototype.visitTimeMicrosecond=z;U.prototype.visitTimeNanosecond=z;U.prototype.visitDecimal=z;U.prototype.visitList=z;U.prototype.visitStruct=z;U.prototype.visitUnion=z;U.prototype.visitDenseUnion=z;U.prototype.visitSparseUnion=z;U.prototype.visitDictionary=z;U.prototype.visitInterval=z;U.prototype.visitIntervalDayTime=z;U.prototype.visitIntervalYearMonth=z;U.prototype.visitFixedSizeList=z;U.prototype.visitMap=z;var Un=new U;var o_=(r,t)=>r+t,Ge=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===J.SECOND?4:8}visitInterval(t,e){return(t.type.unit+1)*4}visitStruct(t,e){return t.children.reduce((n,i)=>n+de.visit(i,e),0)}visitFixedSizeBinary(t,e){return t.type.byteWidth}visitMap(t,e){return 8+t.children.reduce((n,i)=>n+de.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)}},a_=({valueOffsets:r},t)=>8+(r[t+1]-r[t]),c_=({valueOffsets:r},t)=>8+(r[t+1]-r[t]),l_=({valueOffsets:r,stride:t,children:e},n)=>{let i=e[0],{[n*t]:s}=r,{[n*t+1]:o}=r,c=de.getVisitFn(i.type),d=i.slice(s,o-s),u=8;for(let m=-1,g=o-s;++m<g;)u+=c(d,m);return u},u_=({stride:r,children:t},e)=>{let n=t[0],i=n.slice(e*r,r),s=de.getVisitFn(n.type),o=0;for(let c=-1,d=i.length;++c<d;)o+=s(i,c);return o},d_=(r,t)=>r.type.mode===vt.Dense?sd(r,t):od(r,t),sd=({type:r,children:t,typeIds:e,valueOffsets:n},i)=>{let s=r.typeIdToChildIndex[e[i]];return 8+de.visit(t[s],n[i])},od=({children:r},t)=>4+de.visitMany(r,r.map(()=>t)).reduce(o_,0);Ge.prototype.visitUtf8=a_;Ge.prototype.visitBinary=c_;Ge.prototype.visitList=l_;Ge.prototype.visitFixedSizeList=u_;Ge.prototype.visitUnion=d_;Ge.prototype.visitDenseUnion=sd;Ge.prototype.visitSparseUnion=od;var de=new Ge;var ad,cd={},ld={},q=class r{constructor(t){var e,n,i;let s=t[0]instanceof r?t.flatMap(c=>c.data):t;if(s.length===0||s.some(c=>!(c instanceof lt)))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:c,set:d,indexOf:u,byteLength:m}=cd[o.typeId],g=s[0];this.isValid=S=>pi(g,S),this.get=S=>c(g,S),this.set=(S,A)=>d(g,S,A),this.indexOf=S=>u(g,S),this.getByteLength=S=>m(g,S),this._offsets=[0,g.length];break}default:Object.setPrototypeOf(this,ld[o.typeId]),this._offsets=to(s);break}this.data=s,this.type=o,this.stride=ue(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=Qs(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(p[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 Un.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(di(this,t,e,({data:n,_offsets:i},s,o)=>eo(n,i,s,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:i,ArrayType:s}=this;switch(t.typeId){case p.Int:case p.Float:case p.Decimal:case p.Time:case p.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:c,length:d})=>(o.array.set(c.subarray(0,d*i),o.offset),o.offset+=d*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 io(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new r(e)}return new io(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}};ad=Symbol.toStringTag;q[ad]=(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(p).map(e=>p[e]).filter(e=>typeof e=="number"&&e!==p.NONE);for(let e of t){let n=Ft.getVisitFnByTypeId(e),i=Ht.getVisitFnByTypeId(e),s=on.getVisitFnByTypeId(e),o=de.getVisitFnByTypeId(e);cd[e]={get:n,set:i,indexOf:s,byteLength:o},ld[e]=Object.create(r,{isValid:{value:Mr(pi)},get:{value:Mr(Ft.getVisitFnByTypeId(e))},set:{value:ro(Ht.getVisitFnByTypeId(e))},indexOf:{value:no(on.getVisitFnByTypeId(e))},getByteLength:{value:Mr(de.getVisitFnByTypeId(e))}})}return"Vector"})(q.prototype);var io=class r extends q{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 c=s[o];if(c!==void 0)return c;let d=e.call(this,o);return s[o]=d,d}}),Object.defineProperty(this,"set",{value(o,c){n.call(this,o,c),s[o]=c}}),Object.defineProperty(this,"slice",{value:(o,c)=>new r(i.call(this,o,c))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new q(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function ud(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(f_(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 f_(r){return typeof r!="bigint"?je(r):"".concat(je(r),"n")}var Ga=(r,t)=>(Math.ceil(r)*t+63&-64||64)/t,h_=(r,t=0)=>r.length>=t?r.subarray(0,t):Bn(new r.constructor(t),r,0),Ur=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?Ga(n*1,this.BYTES_PER_ELEMENT):Ga(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Ga(t*this.stride,this.BYTES_PER_ELEMENT);let e=h_(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)}};Ur.prototype.offset=0;var _r=class extends Ur{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}},kn=class extends _r{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()}},Nn=class extends _r{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 yt=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=ue(t),this._nulls=new kn,e&&e.length>0&&(this._isValid=ud(e))}toVector(){return new q([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((c,d)=>c+d.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:c,_typeIds:d,_offsets:u,_values:m,_nulls:g}=this;(e=d==null?void 0:d.flush(o))?i=u==null?void 0:u.flush(o):(i=u==null?void 0:u.flush(o))?t=m==null?void 0:m.flush(u.last()):t=m==null?void 0:m.flush(o),c>0&&(n=g==null?void 0:g.flush(o));let S=this.children.map(A=>A.flush());return this.clear(),V({type:s,length:o,nullCount:c,children:S,child:S[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}};yt.prototype.length=1;yt.prototype.stride=1;yt.prototype.children=null;yt.prototype.finished=!1;yt.prototype.nullValues=null;yt.prototype._isValid=()=>!0;var Ut=class extends yt{constructor(t){super(t),this._values=new _r(new this.ArrayType(0),this.stride)}setValue(t,e){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}},Xe=class extends yt{constructor(t){super(t),this._pendingLength=0,this._offsets=new Nn}setValue(t,e){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=e instanceof Ye?e[ge].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 an=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 Ke=new Int32Array(2),so=new Float32Array(Ke.buffer),oo=new Float64Array(Ke.buffer),Ln=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var mi;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(mi||(mi={}));var fe=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 Ke[0]=this.readInt32(t),so[0]}readFloat64(t){return Ke[Ln?0:1]=this.readInt32(t),Ke[Ln?1:0]=this.readInt32(t+4),oo[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){so[0]=e,this.writeInt32(t,Ke[0])}writeFloat64(t,e){oo[0]=e,this.writeInt32(t,Ke[Ln?0:1]),this.writeInt32(t+4,Ke[Ln?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===mi.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 cn=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=fe.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=fe.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,c=this.space;t:for(e=0;e<this.vtables.length;e++){let d=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(d)){for(let u=2;u<s;u+=2)if(this.bb.readInt16(c+u)!=this.bb.readInt16(d+u))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 Et=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 kr;(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"})(kr||(kr={}));var Nr;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(Nr||(Nr={}));var _i;(function(r){r[r.DenseArray=0]="DenseArray"})(_i||(_i={}));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 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 Je=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 Le).__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):_i.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,_i.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};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 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 bi=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 gi;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(gi||(gi={}));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 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):gi.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,gi.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return r.startDate(t),r.addUnit(t,e),r.endDate(t)}};var qe=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 Cr;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(Cr||(Cr={}));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 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 Vr=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 wi;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(wi||(wi={}));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 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):wi.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,wi.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return r.startFloatingPoint(t),r.addPrecision(t,e),r.endFloatingPoint(t)}};var vi;(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"})(vi||(vi={}));var zr=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):vi.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,vi.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return r.startInterval(t),r.addUnit(t,e),r.endInterval(t)}};var Si=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 Wr=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 Ii=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 Ai=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 yr=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):Cr.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,Cr.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 br=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):Cr.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,Cr.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 Bi;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(Bi||(Bi={}));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 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):Bi.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,Bi.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 Ti=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 bt;(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"})(bt||(bt={}));var jt=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):bt.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 Je).__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 Et).__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,bt.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 re=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):Nr.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new jt).__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 Et).__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,Nr.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 he=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):kr.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new re).__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 an).__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 an).__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 Et).__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,kr.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 st=class r{constructor(t=[],e,n){this.fields=t||[],this.metadata=e||new Map,n||(n=Xa(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=co(co(new Map,this.metadata),e.metadata),s=e.fields.filter(c=>{let d=n.findIndex(u=>u.name===c.name);return~d?(n[d]=c.clone({metadata:co(co(new Map,n[d].metadata),c.metadata)}))&&!1:!0}),o=Xa(s,new Map);return new r([...n,...s],i,new Map([...this.dictionaries,...o]))}};st.prototype.fields=null;st.prototype.metadata=null;st.prototype.dictionaries=null;var G=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)}};G.prototype.type=null;G.prototype.name=null;G.prototype.nullable=null;G.prototype.metadata=null;function co(r,t){return new Map([...r||new Map,...t||new Map])}function Xa(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&&Xa(s.children,t)}return t}var p_=cn,m_=fe,gr=class{static decode(t){t=new m_(N(t));let e=he.getRootAsFooter(t),n=st.decode(e.schema());return new Ka(n,e)}static encode(t){let e=new p_,n=st.encode(e,t.schema);he.startRecordBatchesVector(e,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())wr.encode(e,o);let i=e.endVector();he.startDictionariesVector(e,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())wr.encode(e,o);let s=e.endVector();return he.startFooter(e),he.addSchema(e,n),he.addVersion(e,Mt.V4),he.addRecordBatches(e,i),he.addDictionaries(e,s),he.finishFooterBuffer(e,he.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 Ka=class extends gr{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 wr.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return wr.decode(e)}return null}},wr=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 an.createBlock(t,i,n,s)}constructor(t,e,n){this.metaDataLength=t,this.offset=te(n),this.bodyLength=te(e)}};var ht=Object.freeze({done:!0,value:void 0}),Fi=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},ln=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())}},lo=class extends ln{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return I(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(ht);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return Pt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Pt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return I(this,void 0,void 0,function*(){return yield this.abort(t),ht})}return(t){return I(this,void 0,void 0,function*(){return yield this.close(),ht})}read(t){return I(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return I(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(ht)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var Ze=class extends lo{write(t){if((t=N(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?si(this.toUint8Array(!0)):this.toUint8Array(!1).then(si)}toUint8Array(t=!1){return t?ce(this._values)[0]:(()=>I(this,void 0,void 0,function*(){var e,n,i,s;let o=[],c=0;try{for(var d=!0,u=Be(this),m;m=yield u.next(),e=m.done,!e;d=!0){s=m.value,d=!1;let g=s;o.push(g),c+=g.byteLength}}catch(g){n={error:g}}finally{try{!d&&!e&&(i=u.return)&&(yield i.call(u))}finally{if(n)throw n.error}}return ce(o,c)[0]}))()}},Qe=class{constructor(t){t&&(this.source=new Ja(Pt.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)}},ve=class r{constructor(t){t instanceof r?this.source=t.source:t instanceof Ze?this.source=new vr(Pt.fromAsyncIterable(t)):Bs(t)?this.source=new vr(Pt.fromNodeStream(t)):oi(t)?this.source=new vr(Pt.fromDOMStream(t)):Is(t)?this.source=new vr(Pt.fromDOMStream(t.body)):Fe(t)?this.source=new vr(Pt.fromIterable(t)):Te(t)?this.source=new vr(Pt.fromAsyncIterable(t)):ye(t)&&(this.source=new vr(Pt.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)}},Ja=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)||ht)}return(t){return Object.create(this.source.return&&this.source.return(t)||ht)}},vr=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return I(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return I(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return I(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,e="read"){return I(this,void 0,void 0,function*(){return yield this.source.next({cmd:e,size:t})})}throw(t){return I(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||ht;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return I(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||ht;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var xi=class extends Qe{constructor(t,e){super(),this.position=0,this.buffer=N(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}}},jr=class extends ve{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=(()=>I(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return I(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 I(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 I(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,c=0,d=Math.min(n,s+Math.min(n-s,t)),u=new Uint8Array(Math.max(0,(this.position=d)-s));for(;(s+=c)<d&&(o+=c)<u.byteLength;)({bytesRead:c}=yield e.read(u,o,u.byteLength-o,s));return u}return null})}readAt(t,e){return I(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 I(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return I(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return I(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var Za={};tn(Za,{BaseInt64:()=>Di,Int128:()=>Ei,Int64:()=>Sr,Uint64:()=>St});function Cn(r){return r<0&&(r=4294967295+r+1),"0x".concat(r.toString(16))}var Pn=8,qa=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Di=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(Cn(this.buffer[1])," ").concat(Cn(this.buffer[0]))}},St=class r extends Di{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=Pn<n-s?Pn:n-s,c=new r(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),d=new r(new Uint32Array([qa[o],0]));i.times(d),i.plus(c),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)}},Sr=class r extends Di{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 c=Pn<i-o?Pn:i-o,d=new r(new Uint32Array([Number.parseInt(t.slice(o,o+c),10),0])),u=new r(new Uint32Array([qa[c],0]));s.times(u),s.plus(d),o+=c}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)}},Ei=class r{constructor(t){this.buffer=t}high(){return new Sr(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Sr(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 St(new Uint32Array([this.buffer[3],0])),n=new St(new Uint32Array([this.buffer[2],0])),i=new St(new Uint32Array([this.buffer[1],0])),s=new St(new Uint32Array([this.buffer[0],0])),o=new St(new Uint32Array([t.buffer[3],0])),c=new St(new Uint32Array([t.buffer[2],0])),d=new St(new Uint32Array([t.buffer[1],0])),u=new St(new Uint32Array([t.buffer[0],0])),m=St.multiply(s,u);this.buffer[0]=m.low();let g=new St(new Uint32Array([m.high(),0]));return m=St.multiply(i,u),g.plus(m),m=St.multiply(s,d),g.plus(m),this.buffer[1]=g.low(),this.buffer[3]=g.lessThan(m)?1:0,this.buffer[2]=g.high(),new St(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(St.multiply(n,u)).plus(St.multiply(i,d)).plus(St.multiply(s,c)),this.buffer[3]+=St.multiply(e,u).plus(St.multiply(n,d)).plus(St.multiply(i,c)).plus(St.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(Cn(this.buffer[3])," ").concat(Cn(this.buffer[2])," ").concat(Cn(this.buffer[1])," ").concat(Cn(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 c=Pn<i-o?Pn:i-o,d=new r(new Uint32Array([Number.parseInt(t.slice(o,o+c),10),0,0,0])),u=new r(new Uint32Array([qa[c],0,0,0]));s.times(u),s.plus(d),o+=c}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 Oi=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 G?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return V({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({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 V({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 V({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({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 V({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t){return t.mode===vt.Sparse?this.visitSparseUnion(t):this.visitDenseUnion(t)}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({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 V({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 V({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 V({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({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 V({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)}},uo=class extends Oi{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):sn(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return $(Uint8Array,$(Int32Array,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return $(Uint8Array,$(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:n}=this;return D.isTimestamp(t)?$(Uint8Array,Sr.convertArray(n[e])):(D.isInt(t)||D.isTime(t))&&t.bitWidth===64?$(Uint8Array,Sr.convertArray(n[e])):D.isDate(t)&&t.unit===Vt.MILLISECOND?$(Uint8Array,Sr.convertArray(n[e])):D.isDecimal(t)?$(Uint8Array,Ei.convertArray(n[e])):D.isBinary(t)||D.isFixedSizeBinary(t)?__(n[e]):D.isBool(t)?sn(n[e]):D.isUtf8(t)?Dr(n[e].join("")):$(Uint8Array,$(t.ArrayType,n[e].map(i=>+i)))}};function __(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 Vn=class extends Xe{constructor(t){super(t),this._values=new Ur(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,N(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,s=0;for(let[o,c]of t)if(c===void 0)n.set(o,0);else{let d=c.length;i.set(c,s),n.set(o,d),s+=d}}};var fo=class extends yt{constructor(t){super(t),this._values=new kn}setValue(t,e){this._values.set(t,+e)}};var un=class extends Ut{};un.prototype._setValue=Ra;var Ri=class extends un{};Ri.prototype._setValue=Cs;var Mi=class extends un{};Mi.prototype._setValue=Ps;var Ui=class extends Ut{};Ui.prototype._setValue=ka;var ho=class extends yt{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new le(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=dn({type:this.type.indices,nullValues:e}),this.dictionary=dn({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 ki=class extends Ut{};ki.prototype._setValue=Oa;var po=class extends yt{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 Me(this.type.listSize,new G(e,t.type,!0)),n}};var fn=class extends Ut{setValue(t,e){this._values.set(t,e)}},mo=class extends fn{setValue(t,e){super.setValue(t,ui(e))}},_o=class extends fn{},yo=class extends fn{};var hn=class extends Ut{};hn.prototype._setValue=Na;var Ni=class extends hn{};Ni.prototype._setValue=Xs;var Li=class extends hn{};Li.prototype._setValue=Ks;var Se=class extends Ut{setValue(t,e){this._values.set(t,e)}},bo=class extends Se{},go=class extends Se{},wo=class extends Se{},vo=class extends Se{},So=class extends Se{},Io=class extends Se{},Ao=class extends Se{},Bo=class extends Se{};var To=class extends Xe{constructor(t){super(t),this._offsets=new Nn}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 Oe(new G(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,c=o.length,d=e.set(i,c).buffer[i];for(let u=-1;++u<c;)n.set(d+u,o[u])}}};var Fo=class extends Xe{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 Ue(new G(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]:c}=e.set(i,s.size).buffer;for(let d of s.entries())if(n.set(o,d),++o>=c)break}}};var xo=class extends yt{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var Do=class extends yt{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 ft([...this.type.children,new G(e,t.type,!0)]),n}};var Ir=class extends Ut{};Ir.prototype._setValue=Ma;var Ci=class extends Ir{};Ci.prototype._setValue=Vs;var Pi=class extends Ir{};Pi.prototype._setValue=Hs;var Vi=class extends Ir{};Vi.prototype._setValue=zs;var Hi=class extends Ir{};Hi.prototype._setValue=Ws;var Ar=class extends Ut{};Ar.prototype._setValue=Ua;var zi=class extends Ar{};zi.prototype._setValue=js;var Wi=class extends Ar{};Wi.prototype._setValue=$s;var ji=class extends Ar{};ji.prototype._setValue=Ys;var $i=class extends Ar{};$i.prototype._setValue=Gs;var Hn=class extends yt{constructor(t){super(t),this._typeIds=new _r(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,c=[...i,new G(e,t.type)];return this.type=new Re(s,[...o,n],c),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.")}},Eo=class extends Hn{},Oo=class extends Hn{constructor(t){super(t),this._offsets=new _r(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 Yi=class extends Xe{constructor(t){super(t),this._values=new Ur(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,Dr(e))}_flushPending(t,e){}};Yi.prototype._flushPending=Vn.prototype._flushPending;var Qa=class extends E{visitNull(){return xo}visitBool(){return fo}visitInt(){return Se}visitInt8(){return bo}visitInt16(){return go}visitInt32(){return wo}visitInt64(){return vo}visitUint8(){return So}visitUint16(){return Io}visitUint32(){return Ao}visitUint64(){return Bo}visitFloat(){return fn}visitFloat16(){return mo}visitFloat32(){return _o}visitFloat64(){return yo}visitUtf8(){return Yi}visitBinary(){return Vn}visitFixedSizeBinary(){return ki}visitDate(){return un}visitDateDay(){return Ri}visitDateMillisecond(){return Mi}visitTimestamp(){return Ir}visitTimestampSecond(){return Ci}visitTimestampMillisecond(){return Pi}visitTimestampMicrosecond(){return Vi}visitTimestampNanosecond(){return Hi}visitTime(){return Ar}visitTimeSecond(){return zi}visitTimeMillisecond(){return Wi}visitTimeMicrosecond(){return ji}visitTimeNanosecond(){return $i}visitDecimal(){return Ui}visitList(){return To}visitStruct(){return Do}visitUnion(){return Hn}visitDenseUnion(){return Oo}visitSparseUnion(){return Eo}visitDictionary(){return ho}visitInterval(){return hn}visitIntervalDayTime(){return Ni}visitIntervalYearMonth(){return Li}visitFixedSizeList(){return po}visitMap(){return Fo}},dd=new Qa;var k=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 ne(r,t){return t instanceof r.constructor}function Gi(r,t){return r===t||ne(r,t)}function Br(r,t){return r===t||ne(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function Ro(r,t){return r===t||ne(r,t)&&r.precision===t.precision}function y_(r,t){return r===t||ne(r,t)&&r.byteWidth===t.byteWidth}function tc(r,t){return r===t||ne(r,t)&&r.unit===t.unit}function Xi(r,t){return r===t||ne(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function Ki(r,t){return r===t||ne(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function b_(r,t){return r===t||ne(r,t)&&r.children.length===t.children.length&&tr.compareManyFields(r.children,t.children)}function g_(r,t){return r===t||ne(r,t)&&r.children.length===t.children.length&&tr.compareManyFields(r.children,t.children)}function ec(r,t){return r===t||ne(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&tr.compareManyFields(r.children,t.children)}function w_(r,t){return r===t||ne(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&tr.visit(r.indices,t.indices)&&tr.visit(r.dictionary,t.dictionary)}function rc(r,t){return r===t||ne(r,t)&&r.unit===t.unit}function v_(r,t){return r===t||ne(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&tr.compareManyFields(r.children,t.children)}function S_(r,t){return r===t||ne(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&tr.compareManyFields(r.children,t.children)}k.prototype.visitNull=Gi;k.prototype.visitBool=Gi;k.prototype.visitInt=Br;k.prototype.visitInt8=Br;k.prototype.visitInt16=Br;k.prototype.visitInt32=Br;k.prototype.visitInt64=Br;k.prototype.visitUint8=Br;k.prototype.visitUint16=Br;k.prototype.visitUint32=Br;k.prototype.visitUint64=Br;k.prototype.visitFloat=Ro;k.prototype.visitFloat16=Ro;k.prototype.visitFloat32=Ro;k.prototype.visitFloat64=Ro;k.prototype.visitUtf8=Gi;k.prototype.visitBinary=Gi;k.prototype.visitFixedSizeBinary=y_;k.prototype.visitDate=tc;k.prototype.visitDateDay=tc;k.prototype.visitDateMillisecond=tc;k.prototype.visitTimestamp=Xi;k.prototype.visitTimestampSecond=Xi;k.prototype.visitTimestampMillisecond=Xi;k.prototype.visitTimestampMicrosecond=Xi;k.prototype.visitTimestampNanosecond=Xi;k.prototype.visitTime=Ki;k.prototype.visitTimeSecond=Ki;k.prototype.visitTimeMillisecond=Ki;k.prototype.visitTimeMicrosecond=Ki;k.prototype.visitTimeNanosecond=Ki;k.prototype.visitDecimal=Gi;k.prototype.visitList=b_;k.prototype.visitStruct=g_;k.prototype.visitUnion=ec;k.prototype.visitDenseUnion=ec;k.prototype.visitSparseUnion=ec;k.prototype.visitDictionary=w_;k.prototype.visitInterval=rc;k.prototype.visitIntervalDayTime=rc;k.prototype.visitIntervalYearMonth=rc;k.prototype.visitFixedSizeList=v_;k.prototype.visitMap=S_;var tr=new k;function pn(r,t){return tr.compareSchemas(r,t)}function fd(r,t){return tr.compareFields(r,t)}function hd(r,t){return tr.visit(r,t)}function dn(r){let t=r.type,e=new(dd.getVisitFn(t)())(r);if(t.children&&t.children.length>0){let n=r.children||[],i={nullValues:r.nullValues},s=Array.isArray(n)?(o,c)=>n[c]||i:({name:o})=>n[o]||i;for(let[o,c]of t.children.entries()){let{type:d}=c,u=s(c,o);e.children.push(dn(Object.assign(Object.assign({},u),{type:d})))}}return e}function Mo(r,t){return I_(r,t.map(e=>e.data.concat()))}function I_(r,t){let e=[...r.fields],n=[],i={numBatches:t.reduce((g,S)=>Math.max(g,S.length),0)},s=0,o=0,c=-1,d=t.length,u,m=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,c=-1;++c<d;)m[c]=u=t[c].shift(),o=Math.min(o,u?u.length:o);Number.isFinite(o)&&(m=A_(e,o,m,t,i),o>0&&(n[s++]=V({type:new ft(e),length:o,nullCount:0,children:m.slice()})))}return[r=r.assign(e),n.map(g=>new At(r,g))]}function A_(r,t,e,n,i){var s;let o=(t+63&-64)>>3;for(let c=-1,d=n.length;++c<d;){let u=e[c],m=u==null?void 0:u.length;if(m>=t)m===t?e[c]=u:(e[c]=u.slice(0,t),i.numBatches=Math.max(i.numBatches,n[c].unshift(u.slice(t,m-t))));else{let g=r[c];r[c]=g.clone({nullable:!0}),e[c]=(s=u==null?void 0:u._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:V({type:g.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var pd,qt=class r{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new st([]),this._offsets=[0],this;let i,s;t[0]instanceof st&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());let o=d=>{if(d){if(d instanceof At)return[d];if(d instanceof r)return d.batches;if(d instanceof lt){if(d.type instanceof ft)return[new At(new st(d.type.children),d)]}else{if(Array.isArray(d))return d.flatMap(u=>o(u));if(typeof d[Symbol.iterator]=="function")return[...d].flatMap(u=>o(u));if(typeof d=="object"){let u=Object.keys(d),m=u.map(A=>new q([d[A]])),g=new st(u.map((A,Q)=>new G(String(A),m[Q].type))),[,S]=Mo(g,m);return S.length===0?[new At(d)]:S}}}return[]},c=t.flatMap(d=>o(d));if(i=(n=i!=null?i:(e=c[0])===null||e===void 0?void 0:e.schema)!==null&&n!==void 0?n:new st([]),!(i instanceof st))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let d of c){if(!(d instanceof At))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!pn(i,d.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=c,this._offsets=s!=null?s:to(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=Qs(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?Un.visit(new q(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 At(e,i)))}slice(t,e){let n=this.schema;[t,e]=di({length:this.numRows},t,e);let i=eo(this.data,this._offsets,t,e);return new r(n,i.map(s=>new At(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=V({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new q(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 q([V({type:new Jt,length:this.numRows})]));let s=n.fields.slice(),o=s[t].clone({type:e.type}),c=this.schema.fields.map((d,u)=>this.getChildAt(u));[s[t],c[t]]=[o,e],[n,i]=Mo(n,c)}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((c,d,u)=>{let[m,g]=c,S=e.findIndex(A=>A.name===d.name);return~S?g[S]=u:m.push(u),c},[[],[]]),s=this.schema.assign(t.schema),o=[...e.map((c,d)=>[d,i[d]]).map(([c,d])=>d===void 0?this.getChildAt(c):t.getChildAt(d)),...n.map(c=>t.getChildAt(c))].filter(Boolean);return new r(...Mo(s,o))}};pd=Symbol.toStringTag;qt[pd]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=Mr(pi),r.get=Mr(Ft.getVisitFn(p.Struct)),r.set=ro(Ht.getVisitFn(p.Struct)),r.indexOf=no(on.getVisitFn(p.Struct)),r.getByteLength=Mr(de.getVisitFn(p.Struct)),"Table"))(qt.prototype);var _d,At=class r{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof st))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=V({nullCount:0,type:new ft(this.schema.fields),children:this.schema.fields.map(e=>V({type:e.type,nullCount:0}))})]=t,!(this.data instanceof lt))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=md(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:n,children:i,length:s}=Object.keys(e).reduce((d,u,m)=>(d.children[m]=e[u],d.length=Math.max(d.length,e[u].length),d.fields[m]=G.new({name:u,type:e[u].type,nullable:!0}),d),{length:0,fields:new Array,children:new Array}),o=new st(n),c=V({type:new ft(n),length:s,children:i,nullCount:0});[this.schema,this.data]=md(o,c.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=yd(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 Ft.visit(this.data,t)}set(t,e){return Ht.visit(this.data,t,e)}indexOf(t,e){return on.visit(this.data,t,e)}getByteLength(t){return de.visit(this.data,t)}[Symbol.iterator](){return Un.visit(new q([this.data]))}toArray(){return[...this]}concat(...t){return new qt(this.schema,[this,...t])}slice(t,e){let[n]=new q([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 q([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 q([V({type:new Jt,length:this.numRows})]));let s=n.fields.slice(),o=i.children.slice(),c=s[t].clone({type:e.type});[s[t],o[t]]=[c,e.data[0]],n=new st(s,new Map(this.schema.metadata)),i=V({type:new ft(s),children:o})}return new r(n,i)}select(t){let e=this.schema.select(t),n=new ft(e.fields),i=[];for(let s of t){let o=this.schema.fields.findIndex(c=>c.name===s);~o&&(i[o]=this.data.children[o])}return new r(e,V({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=V({type:new ft(e.fields),length:this.numRows,children:n});return new r(e,i)}};_d=Symbol.toStringTag;At[_d]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(At.prototype);function md(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[c,d]of r.fields.entries()){let u=t[c];(!u||u.length!==e)&&(i[c]=d.clone({nullable:!0}),s[c]=(n=u==null?void 0:u._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:V({type:d.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(i),V({type:new ft(i),length:e,children:s})]}function yd(r,t,e=new Map){for(let n=-1,i=r.length;++n<i;){let o=r[n].type,c=t[n];if(D.isDictionary(o)){if(!e.has(o.id))c.dictionary&&e.set(o.id,c.dictionary);else if(e.get(o.id)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&yd(o.children,c.children,e)}return e}var mn=class extends At{constructor(t){let e=t.fields.map(i=>V({type:i.type})),n=V({type:new ft(t.fields),nullCount:0,children:e});super(t,n)}};var Ji;(function(r){r[r.BUFFER=0]="BUFFER"})(Ji||(Ji={}));var qi;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(qi||(qi={}));var Uo=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):qi.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Ji.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,qi.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,Ji.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 zn=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 Wn=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 pe=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 Wn).__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 zn).__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 Uo).__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 Tr=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 pe).__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 jn;(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"})(jn||(jn={}));var Pe=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):kr.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):jn.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 Et).__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,kr.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,jn.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 nc=class extends E{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return Ii.startNull(e),Ii.endNull(e)}visitInt(t,e){return Le.startInt(e),Le.addBitWidth(e,t.bitWidth),Le.addIsSigned(e,t.isSigned),Le.endInt(e)}visitFloat(t,e){return Hr.startFloatingPoint(e),Hr.addPrecision(e,t.precision),Hr.endFloatingPoint(e)}visitBinary(t,e){return yi.startBinary(e),yi.endBinary(e)}visitBool(t,e){return bi.startBool(e),bi.endBool(e)}visitUtf8(t,e){return Ti.startUtf8(e),Ti.endUtf8(e)}visitDecimal(t,e){return qe.startDecimal(e),qe.addScale(e,t.scale),qe.addPrecision(e,t.precision),qe.addBitWidth(e,t.bitWidth),qe.endDecimal(e)}visitDate(t,e){return Lr.startDate(e),Lr.addUnit(e,t.unit),Lr.endDate(e)}visitTime(t,e){return yr.startTime(e),yr.addUnit(e,t.unit),yr.addBitWidth(e,t.bitWidth),yr.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return br.startTimestamp(e),br.addUnit(e,t.unit),n!==void 0&&br.addTimezone(e,n),br.endTimestamp(e)}visitInterval(t,e){return zr.startInterval(e),zr.addUnit(e,t.unit),zr.endInterval(e)}visitList(t,e){return Si.startList(e),Si.endList(e)}visitStruct(t,e){return Ai.startStruct_(e),Ai.endStruct_(e)}visitUnion(t,e){Ce.startTypeIdsVector(e,t.typeIds.length);let n=Ce.createTypeIdsVector(e,t.typeIds);return Ce.startUnion(e),Ce.addMode(e,t.mode),Ce.addTypeIds(e,n),Ce.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return Je.startDictionaryEncoding(e),Je.addId(e,BigInt(t.id)),Je.addIsOrdered(e,t.isOrdered),n!==void 0&&Je.addIndexType(e,n),Je.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return Pr.startFixedSizeBinary(e),Pr.addByteWidth(e,t.byteWidth),Pr.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Vr.startFixedSizeList(e),Vr.addListSize(e,t.listSize),Vr.endFixedSizeList(e)}visitMap(t,e){return Wr.startMap(e),Wr.addKeysSorted(e,t.keysSorted),Wr.endMap(e)}},ko=new nc;function vd(r,t=new Map){return new st(T_(r,t),No(r.customMetadata),t)}function ic(r){return new zt(r.count,Id(r.columns),Ad(r.columns))}function Sd(r){return new se(ic(r.data),r.id,r.isDelta)}function T_(r,t){return(r.fields||[]).filter(Boolean).map(e=>G.fromJSON(e,t))}function bd(r,t){return(r.children||[]).filter(Boolean).map(e=>G.fromJSON(e,t))}function Id(r){return(r||[]).reduce((t,e)=>[...t,new Ve(e.count,F_(e.VALIDITY)),...Id(e.children)],[])}function Ad(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new ie(t.length,i.VALIDITY.length)),i.TYPE&&t.push(new ie(t.length,i.TYPE.length)),i.OFFSET&&t.push(new ie(t.length,i.OFFSET.length)),i.DATA&&t.push(new ie(t.length,i.DATA.length)),t=Ad(i.children,t)}return t}function F_(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function Bd(r,t){let e,n,i,s,o,c;return!t||!(s=r.dictionary)?(o=wd(r,bd(r,t)),i=new G(r.name,o,r.nullable,No(r.customMetadata))):t.has(e=s.id)?(n=(n=s.indexType)?gd(n):new $e,c=new le(t.get(e),n,e,s.isOrdered),i=new G(r.name,c,r.nullable,No(r.customMetadata))):(n=(n=s.indexType)?gd(n):new $e,t.set(e,o=wd(r,bd(r,t))),c=new le(o,n,e,s.isOrdered),i=new G(r.name,c,r.nullable,No(r.customMetadata))),i||null}function No(r){return new Map(Object.entries(r||{}))}function gd(r){return new Bt(r.isSigned,r.bitWidth)}function wd(r,t){let e=r.type.name;switch(e){case"NONE":return new Jt;case"null":return new Jt;case"binary":return new ar;case"utf8":return new cr;case"bool":return new lr;case"list":return new Oe((t||[])[0]);case"struct":return new ft(t||[]);case"struct_":return new ft(t||[])}switch(e){case"int":{let n=r.type;return new Bt(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new ee(_t[n.precision])}case"decimal":{let n=r.type;return new ur(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new dr(Vt[n.unit])}case"time":{let n=r.type;return new Ee(J[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new fr(J[n.unit],n.timezone)}case"interval":{let n=r.type;return new hr(Kt[n.unit])}case"union":{let n=r.type;return new Re(vt[n.mode],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new pr(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Me(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new Ue((t||[])[0],n.keysSorted)}}throw new Error('Unrecognized type: "'.concat(e,'"'))}var x_=cn,D_=fe,oe=class r{static fromJSON(t,e){let n=new r(0,Mt.V4,e);return n._createHeader=E_(t,e),n}static decode(t){t=new D_(N(t));let e=Pe.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),s=e.headerType(),o=new r(n,i,s);return o._createHeader=O_(e,s),o}static encode(t){let e=new x_,n=-1;return t.isSchema()?n=st.encode(e,t.header()):t.isRecordBatch()?n=zt.encode(e,t.header()):t.isDictionaryBatch()&&(n=se.encode(e,t.header())),Pe.startMessage(e),Pe.addVersion(e,Mt.V4),Pe.addHeader(e,n),Pe.addHeaderType(e,t.headerType),Pe.addBodyLength(e,BigInt(t.bodyLength)),Pe.finishMessageBuffer(e,Pe.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof st)return new r(0,Mt.V4,rt.Schema,t);if(t instanceof zt)return new r(e,Mt.V4,rt.RecordBatch,t);if(t instanceof se)return new r(e,Mt.V4,rt.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===rt.Schema}isRecordBatch(){return this.headerType===rt.RecordBatch}isDictionaryBatch(){return this.headerType===rt.DictionaryBatch}constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=te(t)}},zt=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=te(t)}},se=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=te(e)}},ie=class{constructor(t,e){this.offset=te(t),this.length=te(e)}},Ve=class{constructor(t,e){this.length=te(t),this.nullCount=te(e)}};function E_(r,t){return()=>{switch(t){case rt.Schema:return st.fromJSON(r);case rt.RecordBatch:return zt.fromJSON(r);case rt.DictionaryBatch:return se.fromJSON(r)}throw new Error("Unrecognized Message type: { name: ".concat(rt[t],", type: ").concat(t," }"))}}function O_(r,t){return()=>{switch(t){case rt.Schema:return st.decode(r.header(new re));case rt.RecordBatch:return zt.decode(r.header(new pe),r.version());case rt.DictionaryBatch:return se.decode(r.header(new Tr),r.version())}throw new Error("Unrecognized Message type: { name: ".concat(rt[t],", type: ").concat(t," }"))}}G.encode=z_;G.decode=V_;G.fromJSON=Bd;st.encode=H_;st.decode=R_;st.fromJSON=vd;zt.encode=W_;zt.decode=M_;zt.fromJSON=ic;se.encode=j_;se.decode=U_;se.fromJSON=Sd;Ve.encode=$_;Ve.decode=N_;ie.encode=Y_;ie.decode=k_;function R_(r,t=new Map){let e=P_(r,t);return new st(e,Lo(r),t)}function M_(r,t=Mt.V4){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new zt(r.length(),L_(r),C_(r,t))}function U_(r,t=Mt.V4){return new se(zt.decode(r.data(),t),r.id(),r.isDelta())}function k_(r){return new ie(r.offset(),r.length())}function N_(r){return new Ve(r.length(),r.nullCount())}function L_(r){let t=[];for(let e,n=-1,i=-1,s=r.nodesLength();++n<s;)(e=r.nodes(n))&&(t[++i]=Ve.decode(e));return t}function C_(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]=ie.decode(n));return e}function P_(r,t){let e=[];for(let n,i=-1,s=-1,o=r.fieldsLength();++i<o;)(n=r.fields(i))&&(e[++s]=G.decode(n,t));return e}function Td(r,t){let e=[];for(let n,i=-1,s=-1,o=r.childrenLength();++i<o;)(n=r.children(i))&&(e[++s]=G.decode(n,t));return e}function V_(r,t){let e,n,i,s,o,c;return!t||!(c=r.dictionary())?(i=xd(r,Td(r,t)),n=new G(r.name(),i,r.nullable(),Lo(r))):t.has(e=te(c.id()))?(s=(s=c.indexType())?Fd(s):new $e,o=new le(t.get(e),s,e,c.isOrdered()),n=new G(r.name(),o,r.nullable(),Lo(r))):(s=(s=c.indexType())?Fd(s):new $e,t.set(e,i=xd(r,Td(r,t))),o=new le(i,s,e,c.isOrdered()),n=new G(r.name(),o,r.nullable(),Lo(r))),n||null}function Lo(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 Fd(r){return new Bt(r.isSigned(),r.bitWidth())}function xd(r,t){let e=r.typeType();switch(e){case bt.NONE:return new Jt;case bt.Null:return new Jt;case bt.Binary:return new ar;case bt.Utf8:return new cr;case bt.Bool:return new lr;case bt.List:return new Oe((t||[])[0]);case bt.Struct_:return new ft(t||[])}switch(e){case bt.Int:{let n=r.type(new Le);return new Bt(n.isSigned(),n.bitWidth())}case bt.FloatingPoint:{let n=r.type(new Hr);return new ee(n.precision())}case bt.Decimal:{let n=r.type(new qe);return new ur(n.scale(),n.precision(),n.bitWidth())}case bt.Date:{let n=r.type(new Lr);return new dr(n.unit())}case bt.Time:{let n=r.type(new yr);return new Ee(n.unit(),n.bitWidth())}case bt.Timestamp:{let n=r.type(new br);return new fr(n.unit(),n.timezone())}case bt.Interval:{let n=r.type(new zr);return new hr(n.unit())}case bt.Union:{let n=r.type(new Ce);return new Re(n.mode(),n.typeIdsArray()||[],t||[])}case bt.FixedSizeBinary:{let n=r.type(new Pr);return new pr(n.byteWidth())}case bt.FixedSizeList:{let n=r.type(new Vr);return new Me(n.listSize(),(t||[])[0])}case bt.Map:{let n=r.type(new Wr);return new Ue((t||[])[0],n.keysSorted())}}throw new Error('Unrecognized type: "'.concat(bt[e],'" (').concat(e,")"))}function H_(r,t){let e=t.fields.map(s=>G.encode(r,s));re.startFieldsVector(r,e.length);let n=re.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?re.createCustomMetadataVector(r,[...t.metadata].map(([s,o])=>{let c=r.createString("".concat(s)),d=r.createString("".concat(o));return Et.startKeyValue(r),Et.addKey(r,c),Et.addValue(r,d),Et.endKeyValue(r)})):-1;return re.startSchema(r),re.addFields(r,n),re.addEndianness(r,G_?Nr.Little:Nr.Big),i!==-1&&re.addCustomMetadata(r,i),re.endSchema(r)}function z_(r,t){let e=-1,n=-1,i=-1,s=t.type,o=t.typeId;D.isDictionary(s)?(o=s.dictionary.typeId,i=ko.visit(s,r),n=ko.visit(s.dictionary,r)):n=ko.visit(s,r);let c=(s.children||[]).map(m=>G.encode(r,m)),d=jt.createChildrenVector(r,c),u=t.metadata&&t.metadata.size>0?jt.createCustomMetadataVector(r,[...t.metadata].map(([m,g])=>{let S=r.createString("".concat(m)),A=r.createString("".concat(g));return Et.startKeyValue(r),Et.addKey(r,S),Et.addValue(r,A),Et.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),jt.startField(r),jt.addType(r,n),jt.addTypeType(r,o),jt.addChildren(r,d),jt.addNullable(r,!!t.nullable),e!==-1&&jt.addName(r,e),i!==-1&&jt.addDictionary(r,i),u!==-1&&jt.addCustomMetadata(r,u),jt.endField(r)}function W_(r,t){let e=t.nodes||[],n=t.buffers||[];pe.startNodesVector(r,e.length);for(let o of e.slice().reverse())Ve.encode(r,o);let i=r.endVector();pe.startBuffersVector(r,n.length);for(let o of n.slice().reverse())ie.encode(r,o);let s=r.endVector();return pe.startRecordBatch(r),pe.addLength(r,BigInt(t.length)),pe.addNodes(r,i),pe.addBuffers(r,s),pe.endRecordBatch(r)}function j_(r,t){let e=zt.encode(r,t.data);return Tr.startDictionaryBatch(r),Tr.addId(r,BigInt(t.id)),Tr.addIsDelta(r,t.isDelta),Tr.addData(r,e),Tr.endDictionaryBatch(r)}function $_(r,t){return Wn.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function Y_(r,t){return zn.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var G_=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var oc=r=>"Expected ".concat(rt[r]," Message in stream, but was null or length 0."),ac=r=>"Header pointer of flatbuffer-encoded ".concat(rt[r]," Message is null or length 0."),Dd=(r,t)=>"Expected to read ".concat(r," metadata bytes, but only read ").concat(t,"."),Ed=(r,t)=>"Expected to read ".concat(r," bytes for message body, but only read ").concat(t,"."),$n=class{constructor(t){this.source=t instanceof Qe?t:new Qe(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?ht:t.value===-1&&(t=this.readMetadataLength()).done?ht:(t=this.readMetadata(t.value)).done?ht: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(oc(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=N(this.source.read(t));if(e.byteLength<t)throw new Error(Ed(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=rt.Schema,n=this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(ac(e));return i}readMetadataLength(){let t=this.source.read(Co),e=t&&new fe(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 ht;if(e.byteLength<t)throw new Error(Dd(t,e.byteLength));return{done:!1,value:oe.decode(e)}}},Zi=class{constructor(t,e){this.source=t instanceof ve?t:Ss(t)?new jr(t,e):new ve(t)}[Symbol.asyncIterator](){return this}next(){return I(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?ht:t.value===-1&&(t=yield this.readMetadataLength()).done?ht:(t=yield this.readMetadata(t.value)).done?ht:t})}throw(t){return I(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return I(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return I(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(oc(t));return e.value})}readMessageBody(t){return I(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=N(yield this.source.read(t));if(e.byteLength<t)throw new Error(Ed(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(t=!1){return I(this,void 0,void 0,function*(){let e=rt.Schema,n=yield this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(ac(e));return i})}readMetadataLength(){return I(this,void 0,void 0,function*(){let t=yield this.source.read(Co),e=t&&new fe(t),n=(e==null?void 0:e.readInt32(0))||0;return{done:n===0,value:n}})}readMetadata(t){return I(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return ht;if(e.byteLength<t)throw new Error(Dd(t,e.byteLength));return{done:!1,value:oe.decode(e)}})}},Qi=class extends $n{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Fi?t:new Fi(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:oe.fromJSON(t.schema,rt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:oe.fromJSON(e,rt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:oe.fromJSON(e,rt.RecordBatch)}}return this._body=[],ht}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(oc(t));return e.value}readSchema(){let t=rt.Schema,e=this.readMessage(t),n=e==null?void 0:e.header();if(!e||!n)throw new Error(ac(t));return n}},Co=4,sc="ARROW1",Yn=new Uint8Array(sc.length);for(let r=0;r<sc.length;r+=1)Yn[r]=sc.codePointAt(r);function Po(r,t=0){for(let e=-1,n=Yn.length;++e<n;)if(Yn[e]!==r[t+e])return!1;return!0}var Gn=Yn.length,cc=Gn+Co,Od=Gn*2+Co;var Wt=class r extends ln{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 Te(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 Pt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Pt.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:ws(t)?K_(t):Ss(t)?Z_(t):Te(t)?(()=>I(this,void 0,void 0,function*(){return yield r.from(yield t)}))():Is(t)||oi(t)||Bs(t)||ye(t)?q_(new ve(t)):J_(new Qe(t))}static readAll(t){return t instanceof r?t.isSync()?Rd(t):Md(t):ws(t)||ArrayBuffer.isView(t)||Fe(t)||vs(t)?Rd(t):Md(t)}},er=class extends Wt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return ae(this,arguments,function*(){yield P(yield*en(An(Be(this[Symbol.iterator]()))))})}},$r=class extends Wt{constructor(t){super(t),this._impl=t}readAll(){var t,e,n,i;return I(this,void 0,void 0,function*(){let s=new Array;try{for(var o=!0,c=Be(this),d;d=yield c.next(),t=d.done,!t;o=!0){i=d.value,o=!1;let u=i;s.push(u)}}catch(u){e={error:u}}finally{try{!o&&!t&&(n=c.return)&&(yield n.call(c))}finally{if(e)throw e.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Yr=class extends er{constructor(t){super(t),this._impl=t}},ts=class extends $r{constructor(t){super(t),this._impl=t}},Vo=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=V({type:new ft(this.schema.fields),length:t.length,children:n});return new At(this.schema,i)}_loadDictionaryBatch(t,e){let{id:n,isDelta:i}=t,{dictionaries:s,schema:o}=this,c=s.get(n);if(i||!c){let d=o.dictionaries.get(n),u=this._loadVectors(t.data,e,[d]);return(c&&i?c.concat(new q(u)):new q(u)).memoize()}return c.memoize()}_loadVectors(t,e,n){return new Oi(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}},Xn=class extends Vo{constructor(t,e){super(e),this._reader=ws(t)?new Qi(this._handle=t):new $n(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=Ud(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):ht}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):ht}next(){if(this.closed)return ht;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 mn(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Kn=class extends Vo{constructor(t,e){super(e),this._reader=new Zi(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return I(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 I(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Ud(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return I(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):ht})}return(t){return I(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):ht})}next(){return I(this,void 0,void 0,function*(){if(this.closed)return ht;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 mn(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return I(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Ho=class extends Xn{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 xi?t:new xi(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(rt.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(rt.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){let s=i.header(),o=this._reader.readMessageBody(i.bodyLength),c=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,c)}}}_readFooter(){let{_handle:t}=this,e=t.size-cc,n=t.readInt32(e),i=t.readAt(e-n,n);return gr.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}},lc=class extends Kn{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 jr?t:new jr(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return I(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 I(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(rt.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 I(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(rt.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){let s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength),c=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,c)}}})}_readFooter(){return I(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-cc,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return gr.decode(i)})}_readNextMessageAndValidate(t){return I(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})}},uc=class extends Xn{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new uo(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}};function Ud(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*Rd(r){let t=Wt.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Md(r){return ae(this,arguments,function*(){let e=yield P(Wt.from(r));try{if(!(yield P(e.open({autoDestroy:!1}))).closed)do yield yield P(e);while(!(yield P(e.reset().open())).closed)}finally{yield P(e.cancel())}})}function K_(r){return new er(new uc(r))}function J_(r){let t=r.peek(Gn+7&-8);return t&&t.byteLength>=4?Po(t)?new Yr(new Ho(r.read())):new er(new Xn(r)):new er(new Xn(function*(){}()))}function q_(r){return I(this,void 0,void 0,function*(){let t=yield r.peek(Gn+7&-8);return t&&t.byteLength>=4?Po(t)?new Yr(new Ho(yield r.read())):new $r(new Kn(r)):new $r(new Kn(function(){return ae(this,arguments,function*(){})}()))})}function Z_(r){return I(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new jr(r,t);return t>=Od&&Po(yield e.readAt(0,Gn+7&-8))?new ts(new lc(e)):new $r(new Kn(e))})}var Tt=class r extends E{static assemble(...t){let e=i=>i.flatMap(s=>Array.isArray(s)?e(s):s instanceof At?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 q)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)||He.call(this,i<=0?new Uint8Array(0):Mn(t.offset,n,t.nullBitmap)),this.nodes.push(new Ve(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 He(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new ie(this._byteLength,t)),this._byteLength+=t,this}function Q_(r){let{type:t,length:e,typeIds:n,valueOffsets:i}=r;if(He.call(this,n),t.mode===vt.Sparse)return dc.call(this,r);if(t.mode===vt.Dense){if(r.offset<=0)return He.call(this,i),dc.call(this,r);{let s=n.reduce((m,g)=>Math.max(m,g),n[0]),o=new Int32Array(s+1),c=new Int32Array(s+1).fill(-1),d=new Int32Array(e),u=ai(-i[0],e,i);for(let m,g,S=-1;++S<e;)(g=c[m=n[S]])===-1&&(g=c[m]=u[m]),d[S]=u[S]-g,++o[m];He.call(this,d);for(let m,g=-1,S=t.children.length;++g<S;)if(m=r.children[g]){let A=t.typeIds[g],Q=Math.min(e,o[A]);this.visit(m.slice(c[A],Q))}}}return this}function ty(r){let t;return r.nullCount>=r.length?He.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?He.call(this,Mn(r.offset,r.length,t)):He.call(this,sn(r.values))}function Gr(r){return He.call(this,r.values.subarray(0,r.length*r.stride))}function kd(r){let{length:t,values:e,valueOffsets:n}=r,i=n[0],s=n[t],o=Math.min(s-i,e.byteLength-i);return He.call(this,ai(-n[0],t,n)),He.call(this,e.subarray(i,i+o)),this}function fc(r){let{length:t,valueOffsets:e}=r;return e&&He.call(this,ai(e[0],t,e)),this.visit(r.children[0])}function dc(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}Tt.prototype.visitBool=ty;Tt.prototype.visitInt=Gr;Tt.prototype.visitFloat=Gr;Tt.prototype.visitUtf8=kd;Tt.prototype.visitBinary=kd;Tt.prototype.visitFixedSizeBinary=Gr;Tt.prototype.visitDate=Gr;Tt.prototype.visitTimestamp=Gr;Tt.prototype.visitTime=Gr;Tt.prototype.visitDecimal=Gr;Tt.prototype.visitList=fc;Tt.prototype.visitStruct=dc;Tt.prototype.visitUnion=Q_;Tt.prototype.visitInterval=Gr;Tt.prototype.visitFixedSizeList=fc;Tt.prototype.visitMap=fc;var _n=class extends ln{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 Ze,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Xt(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 Te(t)?t.then(e=>this.writeAll(e)):ye(t)?pc(this,t):hc(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 Ze?this._sink=t:(this._sink=new Ze,t&&su(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&ou(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||!pn(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 qt&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof At&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!pn(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof At?t instanceof mn||this._writeRecordBatch(t):t instanceof qt?this.writeAll(t.batches):Fe(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=oe.encode(t),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,c=s+o+n&~n,d=c-s-o;return t.headerType===rt.RecordBatch?this._recordBatchBlocks.push(new wr(c,t.bodyLength,this._position)):t.headerType===rt.DictionaryBatch&&this._dictionaryBlocks.push(new wr(c,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(c-o)),s>0&&this._write(i),this._writePadding(d)}_write(t){if(this._started){let e=N(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(oe.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Yn)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:s}=Tt.assemble(t),o=new zt(t.numRows,n,i),c=oe.from(o,e);return this._writeDictionaries(t)._writeMessage(c)._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:c}=Tt.assemble(new q([t])),d=new zt(t.length,s,o),u=new se(d,e,n),m=oe.from(u,i);return this._writeMessage(m)._writeBodyBuffers(c)}_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}},yn=class r extends _n{static writeAll(t,e){let n=new r(e);return Te(t)?t.then(i=>n.writeAll(i)):ye(t)?pc(n,t):hc(n,t)}},bn=class r extends _n{static writeAll(t){let e=new r;return Te(t)?t.then(n=>e.writeAll(n)):ye(t)?pc(e,t):hc(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let e=gr.encode(new gr(t,Mt.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function hc(r,t){let e=t;t instanceof qt&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function pc(r,t){var e,n,i,s,o,c,d;return I(this,void 0,void 0,function*(){try{for(e=!0,n=Be(t);i=yield n.next(),s=i.done,!s;e=!0){d=i.value,e=!1;let u=d;r.write(u)}}catch(u){o={error:u}}finally{try{!e&&!s&&(c=n.return)&&(yield c.call(n))}finally{if(o)throw o.error}}return r.finish()})}function Nd(r,t){if(ye(r))return ry(r,t);if(Fe(r))return ey(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function ey(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,c){let d,u=null,m=o.desiredSize||null;for(;!(u=c.next(n?m:null)).done;)if(ArrayBuffer.isView(u.value)&&(d=N(u.value))&&(m!=null&&n&&(m=m-d.byteLength+1),u.value=d),o.enqueue(u.value),m!=null&&--m<=0)return;o.close()}}function ry(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 I(this,void 0,void 0,function*(){yield s(o,e||(e=r[Symbol.asyncIterator]()))})},pull(o){return I(this,void 0,void 0,function*(){e?yield s(o,e):o.close()})},cancel(){return I(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,c){return I(this,void 0,void 0,function*(){let d,u=null,m=o.desiredSize||null;for(;!(u=yield c.next(n?m:null)).done;)if(ArrayBuffer.isView(u.value)&&(d=N(u.value))&&(m!=null&&n&&(m=m-d.byteLength+1),u.value=d),o.enqueue(u.value),m!=null&&--m<=0)return;o.close()})}}function Pd(r){return new mc(r)}var mc=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,s=nu(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=dn(s),this._getSize=i!=="bytes"?Ld:Cd;let{["highWaterMark"]:o=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},e),{["highWaterMark"]:c=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:d=>{this._maybeFlush(this._builder,this._controller=d)},start:d=>{this._maybeFlush(this._builder,this._controller=d)}},{highWaterMark:o,size:i!=="bytes"?Ld:Cd}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:c,size:d=>this._writeValueAndReturnChunkSize(d)})}_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)}},Ld=r=>{var t;return(t=r==null?void 0:r.length)!==null&&t!==void 0?t:0},Cd=r=>{var t;return(t=r==null?void 0:r.byteLength)!==null&&t!==void 0?t:0};function zo(r,t){let e=new Ze,n=null,i=new ReadableStream({cancel(){return I(this,void 0,void 0,function*(){yield e.close()})},start(c){return I(this,void 0,void 0,function*(){yield o(c,n||(n=yield s()))})},pull(c){return I(this,void 0,void 0,function*(){n?yield o(c,n):c.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:i};function s(){return I(this,void 0,void 0,function*(){return yield(yield Wt.from(e)).open(t)})}function o(c,d){return I(this,void 0,void 0,function*(){let u=c.desiredSize,m=null;for(;!(m=yield d.next()).done;)if(c.enqueue(m.value),u!=null&&--u<=0)return;c.close()})}}function Wo(r,t){let e=new this(r),n=new ve(e),i=new ReadableStream({cancel(){return I(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return I(this,void 0,void 0,function*(){yield s(o)})},start(o){return I(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 I(this,void 0,void 0,function*(){let c=null,d=o.desiredSize;for(;c=yield n.read(d||null);)if(o.enqueue(c),d!=null&&(d-=c.byteLength)<=0)return;o.close()})}}function jo(r,t="stream"){return(t==="stream"?yn:bn).writeAll(r).toUint8Array(!0)}var oy=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Fa),Za),Wa),xa),Ia),za),{compareSchemas:pn,compareFields:fd,compareTypes:hd});Pt.toDOMStream=Nd;yt.throughDOM=Pd;Wt.throughDOM=zo;Yr.throughDOM=zo;er.throughDOM=zo;_n.throughDOM=Wo;bn.throughDOM=Wo;yn.throughDOM=Wo;function Jn(r){switch(r.typeId){case p.Binary:return{sqlType:"binary"};case p.Bool:return{sqlType:"bool"};case p.Date:return{sqlType:"date"};case p.DateDay:return{sqlType:"date32[d]"};case p.DateMillisecond:return{sqlType:"date64[ms]"};case p.Decimal:{let t=r;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case p.Float:return{sqlType:"float"};case p.Float16:return{sqlType:"float16"};case p.Float32:return{sqlType:"float32"};case p.Float64:return{sqlType:"float64"};case p.Int:return{sqlType:"int32"};case p.Int16:return{sqlType:"int16"};case p.Int32:return{sqlType:"int32"};case p.Int64:return{sqlType:"int64"};case p.Uint16:return{sqlType:"uint16"};case p.Uint32:return{sqlType:"uint32"};case p.Uint64:return{sqlType:"uint64"};case p.Uint8:return{sqlType:"uint8"};case p.IntervalDayTime:return{sqlType:"interval[dt]"};case p.IntervalYearMonth:return{sqlType:"interval[m]"};case p.List:return{sqlType:"list",valueType:Jn(r.valueType)};case p.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:r.byteWidth};case p.Null:return{sqlType:"null"};case p.Utf8:return{sqlType:"utf8"};case p.Struct:return{sqlType:"struct",fields:r.children.map(e=>$o(e.name,e.type))};case p.Map:{let t=r;return{sqlType:"map",keyType:Jn(t.keyType),valueType:Jn(t.valueType)}}case p.Time:return{sqlType:"time[s]"};case p.TimeMicrosecond:return{sqlType:"time[us]"};case p.TimeMillisecond:return{sqlType:"time[ms]"};case p.TimeNanosecond:return{sqlType:"time[ns]"};case p.TimeSecond:return{sqlType:"time[s]"};case p.Timestamp:return{sqlType:"timestamp",timezone:r.timezone||void 0};case p.TimestampSecond:return{sqlType:"timestamp[s]",timezone:r.timezone||void 0};case p.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:r.timezone||void 0};case p.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:r.timezone||void 0};case p.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:r.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(r.toString()))}function $o(r,t){let e=Jn(t);return e.name=r,e}var Yo=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 Qd=eu(Xd());var Go=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=Wt.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new qt(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(c){console.log(c),o(c)}});let n=new Xo(this._bindings,this._conn,e),i=Wt.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 yc(this._bindings,this._conn,e)}createScalarFunction(t,e,n){this._bindings.createScalarFunction(this._conn,t,e,n)}insertArrowTable(t,e){let n=jo(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)}},Xo=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}},yc=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=Wt.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new qt(n)}send(...t){let e=this.bindings.sendPrepared(this.connectionId,this.statementId,t),n=new Xo(this.bindings,this.connectionId,e),i=Wt.from(n);return console.assert(i.isSync()),console.assert(i.isStream()),i}};var qd=new TextEncoder,Kd=new TextDecoder("utf-8");function bc(r,t,e){let n=qd.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 wc(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 gc(r,t,e,n){let i=r.HEAPU8.subarray(t,t+n*wc(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 Jd(r,t,e){let n=r.HEAPU8.subarray(t,t+e);return new Uint8Array(n.buffer,n.byteOffset,e)}function Ko(r,t,e){let n=r.HEAPU8.subarray(t,t+e*8);return new Float64Array(n.buffer,n.byteOffset,e)}function Zd(r,t,e,n,i,s,o,c){try{let d=r._udfFunctions.get(n);if(!d){bc(t,e,"Unknown UDF with id: "+n);return}let u=Kd.decode(t.HEAPU8.subarray(i,i+s)),m=JSON.parse(u),g=Ko(t,o,c/8),S=tt=>{var $t;let Ot=null;switch(tt.validityBuffer!==void 0&&(Ot=Jd(t,g[tt.validityBuffer],m.rows)),tt.physicalType){case"VARCHAR":{if(tt.dataBuffer===null||tt.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for VARCHAR argument");if(tt.lengthBuffer===null||tt.lengthBuffer===void 0)throw new Error("malformed data view, expected data length buffer for VARCHAR argument");let Yt=gc(t,g[tt.dataBuffer],tt.physicalType,m.rows),Nt=[],Lt=Ko(t,g[tt.lengthBuffer],m.rows);for(let X=0;X<m.rows;++X){if(Ot!=null&&!Ot[X]){Nt.push(null);continue}let Ct=t.HEAPU8.subarray(Yt[X],Yt[X]+Lt[X]),Kr=Kd.decode(Ct);Nt.push(Kr)}return X=>Nt[X]}case"STRUCT":{let Yt={},Nt=[];for(let Lt=0;Lt<((($t=tt.children)==null?void 0:$t.length)||0);++Lt){let X=tt.children[Lt],Ct=S(X);Nt.push(Kr=>{Yt[X.name]=Ct(Kr)})}return Ot!=null?Lt=>{if(!Ot[Lt])return null;for(let X of Nt)X(Lt);return Yt}:Lt=>{for(let X of Nt)X(Lt);return Yt}}default:{if(tt.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for argument of type: "+tt.physicalType);let Yt=gc(t,g[tt.dataBuffer],tt.physicalType,m.rows);return Ot!=null?Nt=>Ot[Nt]?Yt[Nt]:null:Nt=>Yt[Nt]}}},A=[];for(let tt=0;tt<m.args.length;++tt)A.push(S(m.args[tt]));let Q=m.rows*wc(m.ret.physicalType),gt=t._malloc(Q),xt=gc(t,gt,m.ret.physicalType,m.rows),wt=t._malloc(m.rows),mt=Jd(t,wt,m.rows);if(xt.length==0||mt.length==0){bc(t,e,"Can't create physical arrays for result");return}let T=xt;m.ret.physicalType=="VARCHAR"&&(T=new Array(m.rows));let kt=[];for(let tt=0;tt<m.args.length;++tt)kt.push(null);for(let tt=0;tt<m.rows;++tt){for(let $t=0;$t<m.args.length;++$t)kt[$t]=A[$t](tt);let Ot=d.func(...kt);T[tt]=Ot,mt[tt]=Ot==null?0:1}let wn=0;switch(m.ret.physicalType){case"VARCHAR":{let tt=new Array(0);wn=t._malloc(m.rows*wc("DOUBLE"));let Ot=Ko(t,wn,m.rows),$t=0;for(let X=0;X<m.rows;++X){let Ct=qd.encode(T[X]||"");tt.push(Ct),Ot[X]=Ct.length,$t+=Ct.length}let Yt=t._malloc($t),Nt=t.HEAPU8.subarray(Yt,Yt+$t),Lt=0;for(let X=0;X<m.rows;++X){xt[X]=Lt;let Ct=tt[X];Nt.subarray(Lt,Lt+Ct.length).set(Ct),Lt+=Ct.length}}}let qn=3*8,Zn=t._malloc(qn),Fr=Ko(t,Zn,3);Fr[0]=gt,Fr[1]=wt,Fr[2]=wn,t.HEAPF64[(e>>3)+0]=0,t.HEAPF64[(e>>3)+1]=Zn,t.HEAPF64[(e>>3)+2]=0}catch(d){bc(t,e,d.toString())}}function cy(){let r=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),r.decode(t))}var ly=cy();function Ie(r,t){console.error("FAIL WITH: ".concat(t)),r.ccall("duckdb_web_fail_with",null,["string"],[t])}function gn(r,t,e){let n=r.HEAPU8.subarray(t,t+e),i=new Uint8Array(new ArrayBuffer(n.byteLength));return i.set(n),i}function W(r,t,e){return ly(r.HEAPU8.subarray(t,t+e))}function ot(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],c=r.HEAPF64[(s>>3)+1],d=r.HEAPF64[(s>>3)+2];return r.stackRestore(i),[o,c,d]}function pt(r){r.ccall("duckdb_web_clear_response",null,[],[])}var Jo=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 uy=new TextEncoder;var qo=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]=ot(this.mod,"duckdb_web_open",["string"],[JSON.stringify(t)]);if(e!==0)throw new Error(W(this.mod,n,i));pt(this.mod)}reset(){let[t,e,n]=ot(this.mod,"duckdb_web_reset",[],[]);if(t!==0)throw new Error(W(this.mod,e,n));pt(this.mod)}getVersion(){let[t,e,n]=ot(this.mod,"duckdb_web_get_version",[],[]);if(t!==0)throw new Error(W(this.mod,e,n));let i=W(this.mod,e,n);return pt(this.mod),i}getFeatureFlags(){return this.mod.ccall("duckdb_web_get_feature_flags","number",[],[])}tokenize(t){let[e,n,i]=ot(this.mod,"duckdb_web_tokenize",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));let s=W(this.mod,n,i);return pt(this.mod),JSON.parse(s)}connect(){let t=this.mod.ccall("duckdb_web_connect","number",[],[]);return new Go(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]=ot(this.mod,"duckdb_web_query_run",["number","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));let o=gn(this.mod,i,s);return pt(this.mod),o}startPendingQuery(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_pending_query_start",["number","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));if(i==0)return null;let o=gn(this.mod,i,s);return pt(this.mod),o}pollPendingQuery(t){let[e,n,i]=ot(this.mod,"duckdb_web_pending_query_poll",["number"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));if(n==0)return null;let s=gn(this.mod,n,i);return pt(this.mod),s}cancelPendingQuery(t){return this.mod.ccall("duckdb_web_pending_query_cancel","boolean",["number"],[t])}fetchQueryResults(t){let[e,n,i]=ot(this.mod,"duckdb_web_query_fetch_results",["number"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));let s=gn(this.mod,n,i);return pt(this.mod),s}getTableNames(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_get_tablenames",["number","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));let o=W(this.mod,i,s);return pt(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[c,d,u]=ot(this.mod,"duckdb_web_udf_scalar_create",["number","string"],[t,JSON.stringify(s)]);if(c!==0)throw new Error(W(this.mod,d,u));if(pt(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]=ot(this.mod,"duckdb_web_prepared_create",["number","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));return pt(this.mod),i}closePrepared(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_prepared_close",["number","number"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));pt(this.mod)}runPrepared(t,e,n){let[i,s,o]=ot(this.mod,"duckdb_web_prepared_run",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(W(this.mod,s,o));let c=gn(this.mod,s,o);return pt(this.mod),c}sendPrepared(t,e,n){let[i,s,o]=ot(this.mod,"duckdb_web_prepared_send",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(W(this.mod,s,o));let c=gn(this.mod,s,o);return pt(this.mod),c}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):"",[c,d,u]=ot(this.mod,"duckdb_web_insert_arrow_from_ipc_stream",["number","number","number","string"],[t,i,e.length,o]);if(c!==0)throw new Error(W(this.mod,d,u))}insertCSVFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let u in n.columns)n.columnsFlat.push($o(u,n.columns[u]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,c,d]=ot(this.mod,"duckdb_web_insert_csv_from_path",["number","string","string"],[t,e,s]);if(o!==0)throw new Error(W(this.mod,c,d))}insertJSONFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let u in n.columns)n.columnsFlat.push($o(u,n.columns[u]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,c,d]=ot(this.mod,"duckdb_web_insert_json_from_path",["number","string","string"],[t,e,s]);if(o!==0)throw new Error(W(this.mod,c,d))}globFiles(t){let[e,n,i]=ot(this.mod,"duckdb_web_fs_glob_file_infos",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));let s=W(this.mod,n,i);pt(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,c]=ot(this.mod,"duckdb_web_fs_register_file_url",["string","string"],[t,e,n,i]);if(s!==0)throw new Error(W(this.mod,o,c));pt(this.mod)}registerFileText(t,e){let n=uy.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,c]=ot(this.mod,"duckdb_web_fs_register_file_buffer",["string","number","number"],[t,n,e.length]);if(s!==0)throw new Error(W(this.mod,o,c));pt(this.mod)}registerFileHandle(t,e,n,i){let[s,o,c]=ot(this.mod,"duckdb_web_fs_register_file_url",["string","string","number","boolean"],[t,t,n,i]);if(s!==0)throw new Error(W(this.mod,o,c));if(pt(this.mod),globalThis.DUCKDB_RUNTIME._files=(globalThis.DUCKDB_RUNTIME._files||new Map).set(t,e),this.pthread){for(let d of this.pthread.runningWorkers)d.postMessage({cmd:"registerFileHandle",fileName:t,fileHandle:e});for(let d of this.pthread.unusedWorkers)d.postMessage({cmd:"dropFileHandle",fileName:t})}}dropFile(t){let[e,n,i]=ot(this.mod,"duckdb_web_fs_drop_file",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));pt(this.mod)}dropFiles(){let[t,e,n]=ot(this.mod,"duckdb_web_fs_drop_files",[],[]);if(t!==0)throw new Error(W(this.mod,e,n));pt(this.mod)}flushFiles(){this.mod.ccall("duckdb_web_flush_files",null,[],[])}copyFileToPath(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_copy_file_to_path",["string","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));pt(this.mod)}copyFileToBuffer(t){let[e,n,i]=ot(this.mod,"duckdb_web_copy_file_to_buffer",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));let s=this.mod.HEAPU8.subarray(n,n+i),o=new Uint8Array(s.length);return o.set(s),pt(this.mod),o}collectFileStatistics(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_collect_file_stats",["string","boolean"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s))}exportFileStatistics(t){let[e,n,i]=ot(this.mod,"duckdb_web_export_file_stats",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));return new Jo(this.mod.HEAPU8.subarray(n,n+i))}};var Zo=class extends qo{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 gt;let c=new Request(this.mainModuleURL),d=await fetch(c),u=d.headers.get("content-length"),m=u&&parseInt(u,10)||0,g=new Date,S={startedAt:g,updatedAt:g,bytesTotal:m||0,bytesLoaded:0},A={transform(xt,wt){S.bytesLoaded+=xt.byteLength;let mt=new Date;if(mt.getTime()-S.updatedAt.getTime()<20){S.updatedAt=mt,wt.enqueue(xt);return}for(let T of i)T(S);wt.enqueue(xt)}},Q=new TransformStream(A);return new Response((gt=d.body)==null?void 0:gt.pipeThrough(Q),d)})();WebAssembly.instantiateStreaming(o,e).then(c=>{n(c.instance,c.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,c=new Date,d={startedAt:c,updatedAt:c,bytesTotal:0,bytesLoaded:0};s.open("GET",o),s.responseType="arraybuffer",s.onerror=u=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to load WASM: "+u}),new Error(u.toString())},s.onprogress=u=>{d.bytesTotal=u.total,d.bytesLoaded=u.loaded;let m=new Date;if(m.getTime()-d.updatedAt.getTime()<20){d.updatedAt=m;return}for(let g of i)g(d)},s.onload=()=>{WebAssembly.instantiate(s.response,e).then(u=>{n(u.instance,u.module)}).catch(u=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to instantiate WASM: "+u}),new Error(u)})},s.send()}else console.warn("instantiating with manual fetch since streaming instantiation and xhrs are unavailable"),(async()=>{let o=new Request(this.mainModuleURL),d=await(await fetch(o)).arrayBuffer();WebAssembly.instantiate(d,e).then(u=>{n(u.instance,u.module)})})();return[]}};var Qo=class extends Zo{constructor(t,e,n,i=null){super(t,e,n,i)}instantiateImpl(t){return(0,Qd.default)({...t,instantiateWasm:this.instantiateWasm.bind(this),locateFile:this.locateFile.bind(this)})}};var Xr=eu(tf()),ef=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 dy(r,t,e){var s,o,c,d;let n=rf(t),i=n.path;return nf(r)&&(i="/".concat(n.bucket).concat(i)),{url:i,query:"",host:ef(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:(c=r==null?void 0:r.secretAccessKey)!=null?c:"",sessionToken:(d=r==null?void 0:r.sessionToken)!=null?d:"",dateNow:new Date().toISOString().replace(/-/g,"").split("T")[0],datetimeNow:new Date().toISOString().replace(/-/g,"").replace(/:/g,"").split(".")[0]+"Z"}}function fy(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 hy(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"+fy(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,Xr.sha256)(s),c="AWS4-HMAC-SHA256\n"+r.datetimeNow+"\n"+r.dateNow+"/"+r.region+"/"+r.service+"/aws4_request\n"+o,d="AWS4"+r.secretAccessKey,u=Xr.sha256.hmac.arrayBuffer(d,r.dateNow),m=Xr.sha256.hmac.arrayBuffer(u,r.region),g=Xr.sha256.hmac.arrayBuffer(m,r.service),S=Xr.sha256.hmac.arrayBuffer(g,"aws4_request"),A=Xr.sha256.hmac(S,c);return n.set("Authorization","AWS4-HMAC-SHA256 Credential="+r.accessKeyId+"/"+r.dateNow+"/"+r.region+"/"+r.service+"/aws4_request, SignedHeaders="+i+", Signature="+A),n}var py=function(r,t,e,n=null,i=null){let s=dy(r,t,e),o={contentType:n,contentHash:i?Xr.sha256.hex(i):null};return hy(s,o)};function rr(r,t,e,n,i=null,s=null){(t!=null&&t.accessKeyId||t!=null&&t.sessionToken)&&(py(t,e,n,i,s).forEach((c,d)=>{r.setRequestHeader(d,c)}),i&&r.setRequestHeader("content-type",i))}function rf(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 nf(r){var t;return!!((t=r==null?void 0:r.endpoint)!=null&&t.startsWith("http"))}function nr(r,t){let e=rf(t);return nf(r)?"".concat(r==null?void 0:r.endpoint,"/").concat(e.bucket)+e.path:"https://"+ef(r,t,e.bucket)+e.path}var nt={_files:new Map,_fileInfoCache:new Map,_udfFunctions:new Map,_globalFileInfo:null,getFileInfo(r,t){try{let e=nt._fileInfoCache.get(t),[n,i,s]=ot(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=W(r,i,s);pt(r);let c=JSON.parse(o);if(c==null)return null;let d={...c,blob:null};return nt._fileInfoCache.set(t,d),d}catch(e){return console.log(e),null}},getGlobalFileInfo(r){var t;try{let[e,n,i]=ot(r,"duckdb_web_get_global_file_info",["number"],[((t=nt._globalFileInfo)==null?void 0:t.cacheEpoch)||0]);if(e!==0)return null;if(i===0)return nt._globalFileInfo;let s=W(r,n,i);pt(r);let o=JSON.parse(s);return o==null?null:(nt._globalFileInfo={...o,blob:null},nt._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{nt._fileInfoCache.delete(t);let i=nt.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 c=new XMLHttpRequest;if(i.dataProtocol==5?(c.open("HEAD",nr(i.s3Config,i.dataUrl),!1),rr(c,i.s3Config,i.dataUrl,"HEAD")):c.open("HEAD",i.dataUrl,!1),c.send(null),c.status!=200&&c.status!=404)throw new Error("Opening file ".concat(i.fileName," failed: Unexpected return status from server (").concat(c.status,")"));if(c.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 d=r._malloc(1),u=new Uint8Array;r.HEAPU8.set(u,d);let m=r._malloc(2*8);return r.HEAPF64[(m>>3)+0]=1,r.HEAPF64[(m>>3)+1]=d,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 c=new XMLHttpRequest;if(i.dataProtocol==5?(c.open("HEAD",nr(i.s3Config,i.dataUrl),!1),rr(c,i.s3Config,i.dataUrl,"HEAD")):c.open("HEAD",i.dataUrl,!1),c.setRequestHeader("Range","bytes=0-"),c.send(null),s=c.getResponseHeader("Content-Length"),s!==null&&c.status==206){let d=r._malloc(16);return r.HEAPF64[(d>>3)+0]=+s,r.HEAPF64[(d>>3)+1]=0,d}}catch(c){o=c,console.warn("HEAD request with range header failed: ".concat(c))}if(i.allowFullHttpReads){if(s!==null&&+s>1){let d=new XMLHttpRequest;i.dataProtocol==5?(d.open("GET",nr(i.s3Config,i.dataUrl),!1),rr(d,i.s3Config,i.dataUrl,"GET")):d.open("GET",i.dataUrl,!1),d.setRequestHeader("Range","bytes=0-0"),d.send(null);let u=d.getResponseHeader("Content-Length");if(d.status==206&&u!==null&&+u==1){let m=r._malloc(16);return r.HEAPF64[(m>>3)+0]=+s,r.HEAPF64[(m>>3)+1]=0,m}if(d.status==200&&u!==null&&+u==+s){console.warn("fall back to full HTTP read for: ".concat(i.dataUrl));let m=r._malloc(d.response.byteLength),g=new Uint8Array(d.response,0,d.response.byteLength);r.HEAPU8.set(g,m);let S=r._malloc(2*8);return r.HEAPF64[(S>>3)+0]=d.response.byteLength,r.HEAPF64[(S>>3)+1]=m,S}}console.warn("falling back to full HTTP read for: ".concat(i.dataUrl));let c=new XMLHttpRequest;if(i.dataProtocol==5?(c.open("GET",nr(i.s3Config,i.dataUrl),!1),rr(c,i.s3Config,i.dataUrl,"GET")):c.open("GET",i.dataUrl,!1),c.responseType="arraybuffer",c.send(null),c.status==200){let d=r._malloc(c.response.byteLength),u=new Uint8Array(c.response,0,c.response.byteLength);r.HEAPU8.set(u,d);let m=r._malloc(2*8);return r.HEAPF64[(m>>3)+0]=c.response.byteLength,r.HEAPF64[(m>>3)+1]=d,m}}if(o!=null)throw new Error("Reading file ".concat(i.fileName," failed with error: ").concat(o));return 0}case 2:{let s=(n=nt._files)==null?void 0:n.get(i.fileName);if(s){let d=r._malloc(16);return r.HEAPF64[(d>>3)+0]=s.size,r.HEAPF64[(d>>3)+1]=0,d}console.warn("Buffering missing file: ".concat(i.fileName));let o=r._malloc(2*8),c=r._malloc(1);return r.HEAPF64[(o>>3)+0]=1,r.HEAPF64[(o>>3)+1]=c,o}}}catch(i){console.error(i.toString()),Ie(r,i.toString())}return 0},glob:(r,t,e)=>{var n;try{let i=W(r,t,e);if(i.startsWith("http")||i.startsWith("s3://")){let s=new XMLHttpRequest;if(i.startsWith("s3://")){let o=nt.getGlobalFileInfo(r);s.open("HEAD",nr(o==null?void 0:o.s3Config,i),!1),rr(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=nt.getGlobalFileInfo(r))!=null&&n.allowFullHttpReads)){Ie(r,"HEAD request failed: ".concat(i,", with full http reads are disabled"));return}let o=new XMLHttpRequest;if(i.startsWith("s3://")){let d=nt.getGlobalFileInfo(r);o.open("GET",nr(d==null?void 0:d.s3Config,i),!1),rr(o,d==null?void 0:d.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){Ie(r,"HEAD and GET requests failed: ".concat(i));return}let c=o.getResponseHeader("Content-Length");c&&+c>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),Ie(r,i.toString()),0}},checkFile:(r,t,e)=>{try{let n=W(r,t,e);if(n.startsWith("http")||n.startsWith("s3://")){let i=new XMLHttpRequest;if(n.startsWith("s3://")){let s=nt.getGlobalFileInfo(r);i.open("HEAD",nr(s==null?void 0:s.s3Config,n),!1),rr(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=nt.getFileInfo(r,t);switch(nt._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=nt._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=nt.getFileInfo(r,t);switch(n==null?void 0:n.dataProtocol){case 4:Ie(r,"Cannot truncate a http file");return;case 5:Ie(r,"Cannot truncate an s3 file");return;case 0:case 1:case 2:Ie(r,"truncateFile not implemented");return;case 3:{let s=(i=nt._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 c=nt.getFileInfo(r,t);switch(c==null?void 0:c.dataProtocol){case 4:case 5:{if(!c.dataUrl)throw new Error("Missing data URL for file ".concat(t));try{let d=new XMLHttpRequest;if(c.dataProtocol==5?(d.open("GET",nr(c==null?void 0:c.s3Config,c.dataUrl),!1),rr(d,c==null?void 0:c.s3Config,c.dataUrl,"GET")):d.open("GET",c.dataUrl,!1),d.responseType="arraybuffer",d.setRequestHeader("Range","bytes=".concat(i,"-").concat(i+n-1)),d.send(null),d.status==206||d.status==200&&n==d.response.byteLength&&i==0){let u=new Uint8Array(d.response,0,Math.min(d.response.byteLength,n));return r.HEAPU8.set(u,e),u.byteLength}else if(d.status==200){console.warn("Range request for ".concat(c.dataUrl," did not return a partial response: ").concat(d.status,' "').concat(d.statusText,'"'));let u=new Uint8Array(d.response,i,Math.min(d.response.byteLength-i,n));return r.HEAPU8.set(u,e),u.byteLength}else throw new Error("Range request for ".concat(c.dataUrl," did returned non-success status: ").concat(d.status,' "').concat(d.statusText,'"'))}catch(d){throw console.log(d),new Error("Range request for ".concat(c.dataUrl," failed with error: ").concat(d,'"'))}}case 2:{let d=(s=nt._files)==null?void 0:s.get(c.fileName);if(!d)throw new Error("No HTML5 file registered with name: ".concat(c.fileName));let u=d.slice(i,i+n),m=new Uint8Array(new FileReaderSync().readAsArrayBuffer(u));return r.HEAPU8.set(m,e),m.byteLength}case 3:{let d=(o=nt._files)==null?void 0:o.get(c.fileName);if(!d)throw new Error("No OPFS access handle registered with name: ".concat(c.fileName));let u=r.HEAPU8.subarray(e,e+n);return d.read(u,{at:i})}}return 0}catch(c){return console.log(c),Ie(r,c.toString()),0}},writeFile:(r,t,e,n,i)=>{var o;let s=nt.getFileInfo(r,t);switch(s==null?void 0:s.dataProtocol){case 4:return Ie(r,"Cannot write to HTTP file"),0;case 5:{let c=r.HEAPU8.subarray(e,e+n),d=new XMLHttpRequest;return d.open("PUT",nr(s==null?void 0:s.s3Config,s.dataUrl),!1),rr(d,s==null?void 0:s.s3Config,s.dataUrl,"PUT","",c),d.send(c),d.status!==200?(Ie(r,"Failed writing file: HTTP "+d.status),0):n}case 2:return Ie(r,"cannot write using the html5 file reader api"),0;case 3:{let c=(o=nt._files)==null?void 0:o.get(s.fileName);if(!c)throw new Error("No OPFS access handle registered with name: ".concat(s.fileName));let d=r.HEAPU8.subarray(e,e+n);return c.write(d,{at:i})}}return 0},getLastFileModificationTime:(r,t)=>{var n;let e=nt.getFileInfo(r,t);switch(e==null?void 0:e.dataProtocol){case 2:{if(!((n=nt._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=W(r,t,e);return console.log("checkDirectory: ".concat(n)),!1},createDirectory:(r,t,e)=>{let n=W(r,t,e);console.log("createDirectory: ".concat(n))},removeDirectory:(r,t,e)=>{let n=W(r,t,e);console.log("removeDirectory: ".concat(n))},listDirectoryEntries:(r,t,e)=>{let n=W(r,t,e);return console.log("listDirectoryEntries: ".concat(n)),!1},moveFile:(r,t,e,n,i)=>{var d,u;let s=W(r,t,e),o=W(r,n,i),c=(d=nt._files)==null?void 0:d.get(s);c!==void 0&&(nt._files.delete(c),nt._files.set(o,c));for(let[m,g]of((u=nt._fileInfoCache)==null?void 0:u.entries())||[])if(g.dataUrl==s){nt._fileInfoCache.delete(m);break}return!0},removeFile:(r,t,e)=>{},callScalarUDF:(r,t,e,n,i,s,o)=>{Zd(nt,r,t,e,n,i,s,o)}};var vc=class extends Yo{postMessage(t,e){globalThis.postMessage(t,e)}async instantiate(t,e,n){return await new Qo(this,nt,t,e).instantiate(n)}};function sf(){let r=new vc;globalThis.onmessage=async t=>{await r.onMessage(t.data)}}sf();return Bp(my);})();
|
|
1
|
+
"use strict";var duckdb=(()=>{var bp=Object.create;var bs=Object.defineProperty;var gp=Object.getOwnPropertyDescriptor;var wp=Object.getOwnPropertyNames;var vp=Object.getPrototypeOf,Sp=Object.prototype.hasOwnProperty;var _a=(r,t)=>{if(t=Symbol[r])return t;throw Error("Symbol."+r+" is not defined")};var Ip=(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 Zr=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Qr=(r,t)=>{for(var e in t)bs(r,e,{get:t[e],enumerable:!0})},Ql=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of wp(t))!Sp.call(r,i)&&i!==e&&bs(r,i,{get:()=>t[i],enumerable:!(n=gp(t,i))||n.enumerable});return r};var tu=(r,t,e)=>(e=r!=null?bp(vp(r)):{},Ql(t||!r||!r.__esModule?bs(e,"default",{value:r,enumerable:!0}):e,r)),Ap=r=>Ql(bs({},"__esModule",{value:!0}),r);var Bp=function(r,t){this[0]=r,this[1]=t};var tn=r=>{var t=r[_a("asyncIterator")],e=!1,n,i={};return t==null?(t=r[_a("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 Bp(new Promise(c=>{var d=t[s](o);if(!(d instanceof Object))throw TypeError("Object expected");c(d)}),1)}}),i[_a("iterator")]=()=>i,n("next"),"throw"in t?n("throw"):i.throw=s=>{throw s},"return"in t&&n("return"),i};var Vd=Zr(()=>{});var Hd=Zr(()=>{});var zd=Zr(()=>{});var Wd=Zr(()=>{});var jd=Zr(()=>{});var Gd=Zr((Yd,mc)=>{"use strict";var $d=(()=>{var r=typeof document<"u"&&document.currentScript?document.currentScript.src:void 0;return typeof __filename<"u"&&(r=r||__filename),function(t={}){function e(){return St.buffer!=ir.buffer&&sr(),ir}function n(){return St.buffer!=ir.buffer&&sr(),Sc}function i(){return St.buffer!=ir.buffer&&sr(),Ic}function s(){return St.buffer!=ir.buffer&&sr(),Ac}function o(){return St.buffer!=ir.buffer&&sr(),Bc}function c(){return St.buffer!=ir.buffer&&sr(),Tc}function d(){return St.buffer!=ir.buffer&&sr(),Fc}var u=t,m,g;u.ready=new Promise((a,l)=>{m=a,g=l});var S=Object.assign({},u),B=[],Q="./this.program",wt=(a,l)=>{throw l},Et=typeof window=="object",vt=typeof importScripts=="function",_t=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",T=u.ENVIRONMENT_IS_PTHREAD||!1,kt="";function gn(a){return u.locateFile?u.locateFile(a,kt):kt+a}var Jn,qn,Fr;if(_t){var q=Vd(),Nt=Hd();vt?kt=Nt.dirname(kt)+"/":kt=__dirname+"/",Jn=(l,f)=>(l=Cc(l)?new URL(l):Nt.normalize(l),q.readFileSync(l,f?void 0:"utf8")),Fr=l=>{var f=Jn(l,!0);return f.buffer||(f=new Uint8Array(f)),f},qn=(l,f,h,_=!0)=>{l=Cc(l)?new URL(l):Nt.normalize(l),q.readFile(l,_?void 0:"utf8",(b,y)=>{b?h(b):f(_?y.buffer:y)})},!u.thisProgram&&process.argv.length>1&&(Q=process.argv[1].replace(/\\/g,"/")),B=process.argv.slice(2),wt=(l,f)=>{throw process.exitCode=l,f},u.inspect=()=>"[Emscripten Module object]";let a;try{a=zd()}catch(l){throw console.error('The "worker_threads" module is not supported in this node.js build - perhaps a newer version is needed?'),l}global.Worker=a.Worker}else(Et||vt)&&(vt?kt=self.location.href:typeof document<"u"&&document.currentScript&&(kt=document.currentScript.src),r&&(kt=r),kt.indexOf("blob:")!==0?kt=kt.substr(0,kt.replace(/[?#].*/,"").lastIndexOf("/")+1):kt="",_t||(Jn=a=>{var l=new XMLHttpRequest;return l.open("GET",a,!1),l.send(null),l.responseText},vt&&(Fr=a=>{var l=new XMLHttpRequest;return l.open("GET",a,!1),l.responseType="arraybuffer",l.send(null),new Uint8Array(l.response)}),qn=(a,l,f)=>{var h=new XMLHttpRequest;h.open("GET",a,!0),h.responseType="arraybuffer",h.onload=()=>{if(h.status==200||h.status==0&&h.response){l(h.response);return}f()},h.onerror=f,h.send(null)}));_t&&typeof performance>"u"&&(global.performance=Wd().performance);var Jt=console.log.bind(console),jt=console.error.bind(console);_t&&(Jt=(...a)=>q.writeSync(1,a.join(" ")+"\n"),jt=(...a)=>q.writeSync(2,a.join(" ")+"\n"));var zt=u.print||Jt,at=u.printErr||jt;Object.assign(u,S),S=null,u.arguments&&(B=u.arguments),u.thisProgram&&(Q=u.thisProgram),u.quit&&(wt=u.quit);var nt;u.wasmBinary&&(nt=u.wasmBinary);var qt=u.noExitRuntime||!0;typeof WebAssembly!="object"&&qr("no native wasm support detected");var St,vc,ts=!1,Kr;function es(a,l){a||qr(l)}var ir,Sc,Ic,Ac,Bc,Tc,sf,Fc;function sr(){var a=St.buffer;u.HEAP8=ir=new Int8Array(a),u.HEAP16=Ic=new Int16Array(a),u.HEAPU8=Sc=new Uint8Array(a),u.HEAPU16=Ac=new Uint16Array(a),u.HEAP32=Bc=new Int32Array(a),u.HEAPU32=Tc=new Uint32Array(a),u.HEAPF32=sf=new Float32Array(a),u.HEAPF64=Fc=new Float64Array(a)}var rs=u.INITIAL_MEMORY||16777216;if(es(rs>=65536,"INITIAL_MEMORY should be larger than STACK_SIZE, was "+rs+"! (STACK_SIZE=65536)"),T)St=u.wasmMemory;else if(u.wasmMemory)St=u.wasmMemory;else if(St=new WebAssembly.Memory({initial:rs/65536,maximum:65536,shared:!0}),!(St.buffer instanceof SharedArrayBuffer))throw at("requested a shared WebAssembly.Memory but the returned buffer is not a SharedArrayBuffer, indicating that while the browser has SharedArrayBuffer it does not have WebAssembly threads support - you may need to set a flag"),_t&&at("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)"),Error("bad memory");sr(),rs=St.buffer.byteLength;var xc=[],Dc=[],of=[],Ec=[],Oc=!1,Rc=0;function ns(){return qt||Rc>0}function af(){if(u.preRun)for(typeof u.preRun=="function"&&(u.preRun=[u.preRun]);u.preRun.length;)Uc(u.preRun.shift());is(xc)}function Mc(){Oc=!0,!T&&is(Dc)}function cf(){T||is(of)}function lf(){if(!T){if(u.postRun)for(typeof u.postRun=="function"&&(u.postRun=[u.postRun]);u.postRun.length;)df(u.postRun.shift());is(Ec)}}function Uc(a){xc.unshift(a)}function uf(a){Dc.unshift(a)}function df(a){Ec.unshift(a)}var Jr=0,Qo=null,Zn=null;function kc(a){Jr++,u.monitorRunDependencies&&u.monitorRunDependencies(Jr)}function Nc(a){if(Jr--,u.monitorRunDependencies&&u.monitorRunDependencies(Jr),Jr==0&&(Qo!==null&&(clearInterval(Qo),Qo=null),Zn)){var l=Zn;Zn=null,l()}}function qr(a){u.onAbort&&u.onAbort(a),a="Aborted("+a+")",at(a),ts=!0,Kr=1,a+=". Build with -sASSERTIONS for more info.",Oc&&Gl();var l=new WebAssembly.RuntimeError(a);throw g(l),l}var ff="data:application/octet-stream;base64,";function Lc(a){return a.startsWith(ff)}function Cc(a){return a.startsWith("file://")}var wn;wn="./duckdb-coi.wasm",Lc(wn)||(wn=gn(wn));function Pc(a){if(a==wn&&nt)return new Uint8Array(nt);if(Fr)return Fr(a);throw"both async and sync fetching of the wasm failed"}function hf(a){return!nt&&(Et||vt)&&typeof fetch=="function"?fetch(a,{credentials:"same-origin"}).then(l=>{if(!l.ok)throw"failed to load wasm binary file at '"+a+"'";return l.arrayBuffer()}).catch(()=>Pc(a)):Promise.resolve().then(()=>Pc(a))}function Vc(a,l,f){return hf(a).then(h=>WebAssembly.instantiate(h,l)).then(h=>h).then(f,h=>{at("failed to asynchronously prepare wasm: ".concat(h)),qr(h)})}function pf(a,l,f,h){return!a&&typeof WebAssembly.instantiateStreaming=="function"&&!Lc(l)&&!_t&&typeof fetch=="function"?fetch(l,{credentials:"same-origin"}).then(_=>{var b=WebAssembly.instantiateStreaming(_,f);return b.then(h,function(y){return at("wasm streaming compile failed: ".concat(y)),at("falling back to ArrayBuffer instantiation"),Vc(l,f,h)})}):Vc(l,f,h)}function mf(){var a={a:gh};function l(h,_){return A=h.exports,A=dp(A),vf(A.db),Kc=A.sa,uf(A.qa),vc=_,Nc("wasm-instantiate"),A}kc("wasm-instantiate");function f(h){l(h.instance,h.module)}if(u.instantiateWasm)try{return u.instantiateWasm(a,l)}catch(h){at("Module.instantiateWasm callback failed with error: ".concat(h)),g(h)}return pf(nt,wn,a,f).catch(g),{}}var me,vn;function ta(a){this.name="ExitStatus",this.message="Program terminated with exit(".concat(a,")"),this.status=a}var ea=a=>{a.terminate(),a.onmessage=l=>{}},_f=a=>{var l=C.pthreads[a];delete C.pthreads[a],ea(l),ha(a),C.runningWorkers.splice(C.runningWorkers.indexOf(l),1),l.pthread_ptr=0},yf=a=>{var l=C.pthreads[a];l.postMessage({cmd:"cancel"})},Hc=a=>{var l=C.pthreads[a];es(l),C.returnWorkerToPool(l)},zc=(a,l)=>(n().fill(0,a,a+l),a),Wc=a=>{var l=C.getNewWorker();if(!l)return 6;C.runningWorkers.push(l),C.pthreads[a.pthread_ptr]=l,l.pthread_ptr=a.pthread_ptr;var f={cmd:"run",start_routine:a.startRoutine,arg:a.arg,pthread_ptr:a.pthread_ptr};return _t&&l.unref(),l.postMessage(f,a.transferList),0},jc=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,$c=(a,l,f)=>{l>>>=0;for(var h=l+f,_=l;a[_]&&!(_>=h);)++_;if(_-l>16&&a.buffer&&jc)return jc.decode(a.buffer instanceof SharedArrayBuffer?a.slice(l,_):a.subarray(l,_));for(var b="";l<_;){var y=a[l++];if(!(y&128)){b+=String.fromCharCode(y);continue}var w=a[l++]&63;if((y&224)==192){b+=String.fromCharCode((y&31)<<6|w);continue}var F=a[l++]&63;if((y&240)==224?y=(y&15)<<12|w<<6|F:y=(y&7)<<18|w<<12|F<<6|a[l++]&63,y<65536)b+=String.fromCharCode(y);else{var tt=y-65536;b+=String.fromCharCode(55296|tt>>10,56320|tt&1023)}}return b},Sn=(a,l)=>(a>>>=0,a?$c(n(),a,l):""),xr={varargs:void 0,get(){var a=o()[+xr.varargs>>>2>>>0];return xr.varargs+=4,a},getp(){return xr.get()},getStr(a){var l=Sn(a);return l}};function Yc(a){if(T)return Z(0,1,a);Kr=a,ns()||(C.terminateAllThreads(),u.onExit&&u.onExit(a),ts=!0),wt(a,new ta(a))}var Gc=(a,l)=>{if(Kr=a,T)throw Xc(a),"unwind";Yc(a)},ra=Gc,na=a=>{if(a instanceof ta||a=="unwind")return Kr;wt(1,a)},C={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init(){T?C.initWorker():C.initMainThread()},initMainThread(){for(var a=4;a--;)C.allocateUnusedWorker();Uc(()=>{kc("loading-workers"),C.loadWasmModuleToAllWorkers(()=>Nc("loading-workers"))})},initWorker(){qt=!1},setExitStatus:a=>{Kr=a},terminateAllThreads__deps:["$terminateWorker"],terminateAllThreads:()=>{for(var a of C.runningWorkers)ea(a);for(var a of C.unusedWorkers)ea(a);C.unusedWorkers=[],C.runningWorkers=[],C.pthreads=[]},returnWorkerToPool:a=>{var l=a.pthread_ptr;delete C.pthreads[l],C.unusedWorkers.push(a),C.runningWorkers.splice(C.runningWorkers.indexOf(a),1),a.pthread_ptr=0,ha(l)},receiveObjectTransfer(a){},threadInitTLS(){C.tlsInitFunctions.forEach(a=>a())},loadWasmModuleToWorker:a=>new Promise(l=>{a.onmessage=b=>{var y=b.data,w=y.cmd;if(y.targetThread&&y.targetThread!=fs()){var F=C.pthreads[y.targetThread];F?F.postMessage(y,y.transferList):at('Internal error! Worker sent a message "'.concat(w,'" to target pthread ').concat(y.targetThread,", but that thread no longer exists!"));return}w==="checkMailbox"?ls():w==="spawnThread"?Wc(y):w==="cleanupThread"?Hc(y.thread):w==="killThread"?_f(y.thread):w==="cancelThread"?yf(y.thread):w==="loaded"?(a.loaded=!0,_t&&!a.pthread_ptr&&a.unref(),l(a)):w==="alert"?alert("Thread ".concat(y.threadId,": ").concat(y.text)):y.target==="setimmediate"?a.postMessage(y):w==="callHandler"?u[y.handler](...y.args):w&&at("worker sent an unknown command ".concat(w))},a.onerror=b=>{var y="worker sent an error!";throw at("".concat(y," ").concat(b.filename,":").concat(b.lineno,": ").concat(b.message)),b},_t&&(a.on("message",b=>a.onmessage({data:b})),a.on("error",b=>a.onerror(b)));var f=[],h=["onExit","onAbort","print","printErr"];for(var _ of h)u.hasOwnProperty(_)&&f.push(_);a.postMessage({cmd:"load",handlers:f,urlOrBlob:u.mainScriptUrlOrBlob||r,wasmMemory:St,wasmModule:vc})}),loadWasmModuleToAllWorkers(a){if(T)return a();Promise.all(C.unusedWorkers.map(C.loadWasmModuleToWorker)).then(a)},allocateUnusedWorker(){var a,l=gn("duckdb_wasm.worker.js");a=new Worker(l),C.unusedWorkers.push(a)},getNewWorker(){return C.unusedWorkers.length==0&&(C.allocateUnusedWorker(),C.loadWasmModuleToWorker(C.unusedWorkers[0])),C.unusedWorkers.pop()}};u.PThread=C;var is=a=>{for(;a.length>0;)a.shift()(u)},bf=()=>{var a=fs(),l=c()[a+52>>>2>>>0],f=c()[a+56>>>2>>>0],h=l-f;Xl(l,h),ei(l)};u.establishStackSpace=bf;function Xc(a){if(T)return Z(1,0,a);ra(a)}var ss=[],Kc,gf=a=>{var l=ss[a];return l||(a>=ss.length&&(ss.length=a+1),ss[a]=l=Kc.get(a)),l},wf=(a,l)=>{var f=gf(a)(l);function h(_){ns()?C.setExitStatus(_):pa(_)}h(f)};u.invokeEntryPoint=wf;var vf=a=>{C.tlsInitFunctions.push(a)},os=(a,l)=>l+2097152>>>0<4194305-!!a?(a>>>0)+l*4294967296:NaN;function Sf(a){a>>>=0,jl(a,!vt,1,!Et,65536,!1),C.threadInitTLS()}function If(a){a>>>=0,T?postMessage({cmd:"cleanupThread",thread:a}):Hc(a)}function Jc(a,l,f,h){return T?Z(2,1,a,l,f,h):qc(a,l,f,h)}function qc(a,l,f,h){if(a>>>=0,l>>>=0,f>>>=0,h>>>=0,typeof SharedArrayBuffer>"u")return at("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var _=[],b=0;if(T&&(_.length===0||b))return Jc(a,l,f,h);if(b)return b;var y={startRoutine:f,pthread_ptr:a,arg:h,transferList:_};return T?(y.cmd="spawnThread",postMessage(y,_),0):Wc(y)}function Zc(a,l,f,h,_){if(T)return Z(3,1,a,l,f,h,_);l>>>=0,f>>>=0,h>>>=0,_>>>=0;for(var b=0,y=l?o()[l>>>2>>>0]:0,w=l?o()[l+4>>>2>>>0]:0,F=f?o()[f>>>2>>>0]:0,tt=f?o()[f+4>>>2>>>0]:0,it=h?o()[h>>>2>>>0]:0,Zt=h?o()[h+4>>>2>>>0]:0,ct=0,ze=0,Bt=0,Qt=0,Ae=0,or=0,v=(l?o()[l>>>2>>>0]:0)|(f?o()[f>>>2>>>0]:0)|(h?o()[h>>>2>>>0]:0),O=(l?o()[l+4>>>2>>>0]:0)|(f?o()[f+4>>>2>>>0]:0)|(h?o()[h+4>>>2>>>0]:0),dt=function(mp,_p,yp,Zl){return mp<32?_p&Zl:yp&Zl},lt=0;lt<a;lt++){var $t=1<<lt%32;if(dt(lt,v,O,$t)){var ni=xr.getStreamFromFD(lt),ys=xr.DEFAULT_POLLMASK;if(ni.stream_ops.poll){var ql=-1;if(_){var hp=l?o()[_>>>2>>>0]:0,pp=l?o()[_+8>>>2>>>0]:0;ql=(hp+pp/1e6)*1e3}ys=ni.stream_ops.poll(ni,ql)}ys&1&&dt(lt,y,w,$t)&&(lt<32?ct=ct|$t:ze=ze|$t,b++),ys&4&&dt(lt,F,tt,$t)&&(lt<32?Bt=Bt|$t:Qt=Qt|$t,b++),ys&2&&dt(lt,it,Zt,$t)&&(lt<32?Ae=Ae|$t:or=or|$t,b++)}}return l&&(o()[l>>>2>>>0]=ct,o()[l+4>>>2>>>0]=ze),f&&(o()[f>>>2>>>0]=Bt,o()[f+4>>>2>>>0]=Qt),h&&(o()[h>>>2>>>0]=Ae,o()[h+4>>>2>>>0]=or),b}function Qc(){qr("missing function: $SOCKFS")}Qc.stub=!0;function ia(){qr("missing function: $FS")}ia.stub=!0;var Qn=a=>{var l=Qc.getSocket(a);if(!l)throw new ia.ErrnoError(8);return l},sa=a=>(a&255)+"."+(a>>8&255)+"."+(a>>16&255)+"."+(a>>24&255),tl=a=>{var l="",f=0,h=0,_=0,b=0,y=0,w=0,F=[a[0]&65535,a[0]>>16,a[1]&65535,a[1]>>16,a[2]&65535,a[2]>>16,a[3]&65535,a[3]>>16],tt=!0,it="";for(w=0;w<5;w++)if(F[w]!==0){tt=!1;break}if(tt){if(it=sa(F[6]|F[7]<<16),F[5]===-1)return l="::ffff:",l+=it,l;if(F[5]===0)return l="::",it==="0.0.0.0"&&(it=""),it==="0.0.0.1"&&(it="1"),l+=it,l}for(f=0;f<8;f++)F[f]===0&&(f-_>1&&(y=0),_=f,y++),y>h&&(h=y,b=f-h+1);for(f=0;f<8;f++){if(h>1&&F[f]===0&&f>=b&&f<b+h){f===b&&(l+=":",b===0&&(l+=":"));continue}l+=Number(fa(F[f]&65535)).toString(16),l+=f<7?":":""}return l},el=(a,l)=>{var f=i()[a>>>1>>>0],h=fa(s()[a+2>>>1>>>0]),_;switch(f){case 2:if(l!==16)return{errno:28};_=o()[a+4>>>2>>>0],_=sa(_);break;case 10:if(l!==28)return{errno:28};_=[o()[a+8>>>2>>>0],o()[a+12>>>2>>>0],o()[a+16>>>2>>>0],o()[a+20>>>2>>>0]],_=tl(_);break;default:return{errno:5}}return{family:f,addr:_,port:h}},as=a=>{for(var l=a.split("."),f=0;f<4;f++){var h=Number(l[f]);if(isNaN(h))return null;l[f]=h}return(l[0]|l[1]<<8|l[2]<<16|l[3]<<24)>>>0},cs=a=>parseInt(a),oa=a=>{var l,f,h,_,b=/^((?=.*::)(?!.*::.+::)(::)?([\dA-F]{1,4}:(:|\b)|){5}|([\dA-F]{1,4}:){6})((([\dA-F]{1,4}((?!\3)::|:\b|$))|(?!\2\3)){2}|(((2[0-4]|1\d|[1-9])?\d|25[0-5])\.?\b){4})$/i,y=[];if(!b.test(a))return null;if(a==="::")return[0,0,0,0,0,0,0,0];for(a.startsWith("::")?a=a.replace("::","Z:"):a=a.replace("::",":Z:"),a.indexOf(".")>0?(a=a.replace(new RegExp("[.]","g"),":"),l=a.split(":"),l[l.length-4]=cs(l[l.length-4])+cs(l[l.length-3])*256,l[l.length-3]=cs(l[l.length-2])+cs(l[l.length-1])*256,l=l.slice(0,l.length-2)):l=a.split(":"),h=0,_=0,f=0;f<l.length;f++)if(typeof l[f]=="string")if(l[f]==="Z"){for(_=0;_<8-l.length+1;_++)y[f+_]=0;h=_-1}else y[f+h]=ps(parseInt(l[f],16));else y[f+h]=l[f];return[y[1]<<16|y[0],y[3]<<16|y[2],y[5]<<16|y[4],y[7]<<16|y[6]]},_e={address_map:{id:1,addrs:{},names:{}},lookup_name(a){var l=as(a);if(l!==null||(l=oa(a),l!==null))return a;var f;if(_e.address_map.addrs[a])f=_e.address_map.addrs[a];else{var h=_e.address_map.id++;es(h<65535,"exceeded max address mappings of 65535"),f="172.29."+(h&255)+"."+(h&65280),_e.address_map.names[f]=a,_e.address_map.addrs[a]=f}return f},lookup_addr(a){return _e.address_map.names[a]?_e.address_map.names[a]:null}},rl=(a,l,f)=>{if(f&&a===0)return null;var h=el(a,l);if(h.errno)throw new ia.ErrnoError(h.errno);return h.addr=_e.lookup_addr(h.addr)||h.addr,h};function nl(a,l,f,h,_,b){if(T)return Z(4,1,a,l,f,h,_,b);l>>>=0,f>>>=0;var y=Qn(a),w=rl(l,f);return y.sock_ops.bind(y,w.addr,w.port),0}function il(a,l,f,h,_,b){if(T)return Z(5,1,a,l,f,h,_,b);l>>>=0,f>>>=0;var y=Qn(a),w=rl(l,f);return y.sock_ops.connect(y,w.addr,w.port),0}function sl(a,l,f,h){if(T)return Z(6,1,a,l,f,h);l>>>=0}function ol(a,l,f){return T?Z(7,1,a,l,f):(f>>>=0,xr.varargs=f,0)}function al(a,l){if(T)return Z(8,1,a,l);l>>>=0}function cl(a,l,f){if(T)return Z(9,1,a,l,f);var h=os(l,f)}var ll=(a,l,f,h)=>{if(f>>>=0,!(h>0))return 0;for(var _=f,b=f+h-1,y=0;y<a.length;++y){var w=a.charCodeAt(y);if(w>=55296&&w<=57343){var F=a.charCodeAt(++y);w=65536+((w&1023)<<10)|F&1023}if(w<=127){if(f>=b)break;l[f++>>>0]=w}else if(w<=2047){if(f+1>=b)break;l[f++>>>0]=192|w>>6,l[f++>>>0]=128|w&63}else if(w<=65535){if(f+2>=b)break;l[f++>>>0]=224|w>>12,l[f++>>>0]=128|w>>6&63,l[f++>>>0]=128|w&63}else{if(f+3>=b)break;l[f++>>>0]=240|w>>18,l[f++>>>0]=128|w>>12&63,l[f++>>>0]=128|w>>6&63,l[f++>>>0]=128|w&63}}return l[f>>>0]=0,f-_},aa=(a,l,f)=>ll(a,n(),l,f);function ul(a,l,f){if(T)return Z(10,1,a,l,f);l>>>=0,f>>>=0}var ca=(a,l,f,h,_)=>{switch(l){case 2:f=as(f),zc(a,16),_&&(o()[_>>>2>>>0]=16),i()[a>>>1>>>0]=l,o()[a+4>>>2>>>0]=f,i()[a+2>>>1>>>0]=ps(h);break;case 10:f=oa(f),zc(a,28),_&&(o()[_>>>2>>>0]=28),o()[a>>>2>>>0]=l,o()[a+8>>>2>>>0]=f[0],o()[a+12>>>2>>>0]=f[1],o()[a+16>>>2>>>0]=f[2],o()[a+20>>>2>>>0]=f[3],i()[a+2>>>1>>>0]=ps(h);break;default:return 5}return 0};function dl(a,l,f,h,_,b){if(T)return Z(11,1,a,l,f,h,_,b);l>>>=0,f>>>=0;var y=Qn(a);if(!y.daddr)return-53;var w=ca(l,y.family,_e.lookup_name(y.daddr),y.dport,f);return 0}function fl(a,l,f,h,_,b){if(T)return Z(12,1,a,l,f,h,_,b);h>>>=0,_>>>=0;var y=Qn(a);return l===1&&f===4?(o()[h>>>2>>>0]=y.error,o()[_>>>2>>>0]=4,y.error=null,0):-50}function hl(a,l,f){return T?Z(13,1,a,l,f):(f>>>=0,xr.varargs=f,0)}function pl(a,l){if(T)return Z(14,1,a,l);a>>>=0,l>>>=0}function ml(a,l,f){if(T)return Z(15,1,a,l,f);l>>>=0}function _l(a,l,f,h){if(T)return Z(16,1,a,l,f,h);l>>>=0,f>>>=0}function yl(a,l,f,h){if(T)return Z(17,1,a,l,f,h);l>>>=0,h>>>=0,xr.varargs=h}function bl(a,l,f,h,_,b){if(T)return Z(18,1,a,l,f,h,_,b);l>>>=0,f>>>=0,_>>>=0,b>>>=0;var y=Qn(a),w=y.sock_ops.recvmsg(y,f);if(!w)return 0;if(_)var F=ca(_,y.family,_e.lookup_name(w.addr),w.port,b);return n().set(w.buffer,l>>>0),w.buffer.byteLength}function gl(a,l,f,h){if(T)return Z(19,1,a,l,f,h);l>>>=0,h>>>=0}function wl(a){if(T)return Z(20,1,a);a>>>=0}function vl(a,l,f,h,_,b){if(T)return Z(21,1,a,l,f,h,_,b);l>>>=0,f>>>=0,_>>>=0,b>>>=0}function Sl(a,l,f){if(T)return Z(22,1,a,l,f)}function Il(a,l){if(T)return Z(23,1,a,l);a>>>=0,l>>>=0}function Al(a,l,f){if(T)return Z(24,1,a,l,f);l>>>=0}var Af=!0,Bf=()=>Af,Tf=()=>{if(!ns())try{T?pa(Kr):ra(Kr)}catch(a){na(a)}},Ff=a=>{if(!ts)try{a(),Tf()}catch(l){na(l)}};function la(a){if(a>>>=0,typeof Atomics.waitAsync=="function"){var l=Atomics.waitAsync(o(),a>>>2,a);l.value.then(ls);var f=a+128;Atomics.store(o(),f>>>2,1)}}u.__emscripten_thread_mailbox_await=la;var ls=()=>{var a=fs();a&&(la(a),Ff(()=>Yl()))};u.checkMailbox=ls;var xf=function(a,l,f){if(a>>>=0,l>>>=0,f>>>=0,a==l)setTimeout(()=>ls());else if(T)postMessage({targetThread:a,cmd:"checkMailbox"});else{var h=C.pthreads[a];if(!h)return;h.postMessage({cmd:"checkMailbox"})}},Df=a=>{var l=ms(),f=a();return ei(l),f},Z=function(a,l){var f=arguments.length-2,h=arguments;return Df(()=>{for(var _=f,b=ri(_*8),y=b>>>3,w=0;w<f;w++){var F=h[2+w];d()[y+w>>>0]=F}return $l(a,_,b,l)})},ua=[];function Ef(a,l,f,h){l>>>=0,h>>>=0,ua.length=f;for(var _=h>>>3,b=0;b<f;b++)ua[b]=d()[_+b>>>0];var y=bh[a];C.currentProxiedOperationCallerThread=l;var w=y.apply(null,ua);return C.currentProxiedOperationCallerThread=0,w}function Of(a){a>>>=0,_t&&C.pthreads[a].ref()}var Rf=()=>{qr("")};function Mf(a,l){return globalThis.DUCKDB_RUNTIME.createDirectory(u,a,l)}function Uf(a,l){return globalThis.DUCKDB_RUNTIME.checkDirectory(u,a,l)}function kf(a,l){return globalThis.DUCKDB_RUNTIME.listDirectoryEntries(u,a,l)}function Nf(a,l){return globalThis.DUCKDB_RUNTIME.removeDirectory(u,a,l)}function Lf(a){return globalThis.DUCKDB_RUNTIME.closeFile(u,a)}function Cf(a,l){return globalThis.DUCKDB_RUNTIME.checkFile(u,a,l)}function Pf(a){return globalThis.DUCKDB_RUNTIME.getLastFileModificationTime(u,a)}function Vf(a,l,f,h){return globalThis.DUCKDB_RUNTIME.moveFile(u,a,l,f,h)}function Hf(a,l){return globalThis.DUCKDB_RUNTIME.openFile(u,a,l)}function zf(a,l,f,h){return globalThis.DUCKDB_RUNTIME.readFile(u,a,l,f,h)}function Wf(a,l){return globalThis.DUCKDB_RUNTIME.truncateFile(u,a,l)}function jf(a,l,f,h){return globalThis.DUCKDB_RUNTIME.writeFile(u,a,l,f,h)}function $f(a){return globalThis.DUCKDB_RUNTIME.getDefaultDataProtocol(a)}function Yf(a,l){return globalThis.DUCKDB_RUNTIME.glob(u,a,l)}function Gf(a){return globalThis.DUCKDB_RUNTIME.testPlatformFeature(u,a)}function Xf(a,l,f,h,_,b){return globalThis.DUCKDB_RUNTIME.callScalarUDF(u,a,l,f,h,_,b)}var us=a=>{us.shown||(us.shown={}),us.shown[a]||(us.shown[a]=1,_t&&(a="warning: "+a),at(a))},Kf=()=>{},Jf=()=>Date.now(),qf=()=>{Rc+=1},Zf=()=>{throw qf(),"unwind"},Bl=()=>4294901760;function Qf(){return Bl()}var Tl;Tl=()=>performance.timeOrigin+performance.now();var th=()=>_t?jd().cpus().length:navigator.hardwareConcurrency,eh=a=>{var l=St.buffer,f=(a-l.byteLength+65535)/65536;try{return St.grow(f),sr(),1}catch(h){}};function rh(a){a>>>=0;var l=n().length;if(a<=l)return!1;var f=Bl();if(a>f)return!1;for(var h=(F,tt)=>F+(tt-F%tt)%tt,_=1;_<=4;_*=2){var b=l*(1+.2/_);b=Math.min(b,a+100663296);var y=Math.min(f,h(Math.max(a,b),65536)),w=eh(y);if(w)return!0}return!1}var da={},nh=()=>Q||"./this.program",ti=()=>{if(!ti.strings){var a=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",l={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:a,_:nh()};for(var f in da)da[f]===void 0?delete l[f]:l[f]=da[f];var h=[];for(var f in l)h.push("".concat(f,"=").concat(l[f]));ti.strings=h}return ti.strings},ih=(a,l)=>{for(var f=0;f<a.length;++f)e()[l++>>>0>>>0]=a.charCodeAt(f);e()[l>>>0>>>0]=0},Fl=function(a,l){if(T)return Z(25,1,a,l);a>>>=0,l>>>=0;var f=0;return ti().forEach((h,_)=>{var b=l+f;c()[a+_*4>>>2>>>0]=b,ih(h,b),f+=h.length+1}),0},xl=function(a,l){if(T)return Z(26,1,a,l);a>>>=0,l>>>=0;var f=ti();c()[a>>>2>>>0]=f.length;var h=0;return f.forEach(_=>h+=_.length+1),c()[l>>>2>>>0]=h,0};function Dl(a){return T?Z(27,1,a):52}function El(a,l){if(T)return Z(28,1,a,l);l>>>=0;var f=0,h=0,_=0;{var b=2;a==0?f=2:(a==1||a==2)&&(f=64),_=1}return e()[l>>>0>>>0]=b,i()[l+2>>>1>>>0]=_,vn=[f>>>0,(me=f,+Math.abs(me)>=1?me>0?+Math.floor(me/4294967296)>>>0:~~+Math.ceil((me-+(~~me>>>0))/4294967296)>>>0:0)],o()[l+8>>>2>>>0]=vn[0],o()[l+12>>>2>>>0]=vn[1],vn=[h>>>0,(me=h,+Math.abs(me)>=1?me>0?+Math.floor(me/4294967296)>>>0:~~+Math.ceil((me-+(~~me>>>0))/4294967296)>>>0:0)],o()[l+16>>>2>>>0]=vn[0],o()[l+20>>>2>>>0]=vn[1],0}function Ol(a,l,f,h,_,b){if(T)return Z(29,1,a,l,f,h,_,b);l>>>=0,f>>>=0;var y=os(h,_);return b>>>=0,52}function Rl(a,l,f,h,_,b){if(T)return Z(30,1,a,l,f,h,_,b);l>>>=0,f>>>=0;var y=os(h,_);return b>>>=0,52}function Ml(a,l,f,h){return T?Z(31,1,a,l,f,h):(l>>>=0,f>>>=0,h>>>=0,52)}function Ul(a,l,f,h,_){if(T)return Z(32,1,a,l,f,h,_);var b=os(l,f);return _>>>=0,70}function kl(a){return T?Z(33,1,a):52}var sh=[null,[],[]],oh=(a,l)=>{var f=sh[a];l===0||l===10?((a===1?zt:at)($c(f,0)),f.length=0):f.push(l)};function Nl(a,l,f,h){if(T)return Z(34,1,a,l,f,h);l>>>=0,f>>>=0,h>>>=0;for(var _=0,b=0;b<f;b++){var y=c()[l>>>2>>>0],w=c()[l+4>>>2>>>0];l+=8;for(var F=0;F<w;F++)oh(a,n()[y+F>>>0]);_+=w}return c()[h>>>2>>>0]=_,0}function Ll(a,l,f,h){if(T)return Z(35,1,a,l,f,h);a>>>=0,l>>>=0,f>>>=0,h>>>=0;var _=0,b=0,y=0,w=0,F=0,tt=0,it;function Zt(ct,ze,Bt,Qt,Ae,or){var v,O,dt,lt;return O=ct===10?28:16,Ae=ct===10?tl(Ae):sa(Ae),v=ma(O),lt=ca(v,ct,Ae,or),es(!lt),dt=ma(32),o()[dt+4>>>2>>>0]=ct,o()[dt+8>>>2>>>0]=ze,o()[dt+12>>>2>>>0]=Bt,c()[dt+24>>>2>>>0]=Qt,c()[dt+20>>>2>>>0]=v,ct===10?o()[dt+16>>>2>>>0]=28:o()[dt+16>>>2>>>0]=16,o()[dt+28>>>2>>>0]=0,dt}if(f&&(y=o()[f>>>2>>>0],w=o()[f+4>>>2>>>0],F=o()[f+8>>>2>>>0],tt=o()[f+12>>>2>>>0]),F&&!tt&&(tt=F===2?17:6),!F&&tt&&(F=tt===17?2:1),tt===0&&(tt=6),F===0&&(F=1),!a&&!l)return-2;if(y&-1088||f!==0&&o()[f>>>2>>>0]&2&&!a)return-1;if(y&32)return-2;if(F!==0&&F!==1&&F!==2)return-7;if(w!==0&&w!==2&&w!==10)return-6;if(l&&(l=Sn(l),b=parseInt(l,10),isNaN(b)))return y&1024?-2:-8;if(!a)return w===0&&(w=2),y&1||(w===2?_=hs(2130706433):_=[0,0,0,1]),it=Zt(w,F,tt,null,_,b),c()[h>>>2>>>0]=it,0;if(a=Sn(a),_=as(a),_!==null)if(w===0||w===2)w=2;else if(w===10&&y&8)_=[0,0,hs(65535),_],w=10;else return-2;else if(_=oa(a),_!==null)if(w===0||w===10)w=10;else return-2;return _!=null?(it=Zt(w,F,tt,a,_,b),c()[h>>>2>>>0]=it,0):y&4?-2:(a=_e.lookup_name(a),_=as(a),w===0?w=2:w===10&&(_=[0,0,hs(65535),_]),it=Zt(w,F,tt,null,_,b),c()[h>>>2>>>0]=it,0)}var ah=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return h=>(h.set(crypto.getRandomValues(new Uint8Array(h.byteLength))),h);if(_t)try{var a=Ip("crypto"),l=a.randomFillSync;if(l)return h=>a.randomFillSync(h);var f=a.randomBytes;return h=>(h.set(f(h.byteLength)),h)}catch(h){}qr("initRandomDevice")},Cl=a=>(Cl=ah())(a);function ch(a,l){return a>>>=0,l>>>=0,Cl(n().subarray(a>>>0,a+l>>>0)),0}function lh(a,l,f,h,_,b,y){a>>>=0,f>>>=0,_>>>=0;var w=el(a,l);if(w.errno)return-6;var F=w.port,tt=w.addr,it=!1;if(f&&h){var Zt;if(y&1||!(Zt=_e.lookup_addr(tt))){if(y&8)return-2}else tt=Zt;var ct=aa(tt,f,h);ct+1>=h&&(it=!0)}if(_&&b){F=""+F;var ct=aa(F,_,b);ct+1>=b&&(it=!0)}return it?-12:0}var ds=a=>a%4===0&&(a%100!==0||a%400===0),uh=(a,l)=>{for(var f=0,h=0;h<=l;f+=a[h++]);return f},Pl=[31,29,31,30,31,30,31,31,30,31,30,31],Vl=[31,28,31,30,31,30,31,31,30,31,30,31],dh=(a,l)=>{for(var f=new Date(a.getTime());l>0;){var h=ds(f.getFullYear()),_=f.getMonth(),b=(h?Pl:Vl)[_];if(l>b-f.getDate())l-=b-f.getDate()+1,f.setDate(1),_<11?f.setMonth(_+1):(f.setMonth(0),f.setFullYear(f.getFullYear()+1));else return f.setDate(f.getDate()+l),f}return f},Hl=a=>{for(var l=0,f=0;f<a.length;++f){var h=a.charCodeAt(f);h<=127?l++:h<=2047?l+=2:h>=55296&&h<=57343?(l+=4,++f):l+=3}return l};function fh(a,l,f){var h=f>0?f:Hl(a)+1,_=new Array(h),b=ll(a,_,0,_.length);return l&&(_.length=b),_}var zl=(a,l)=>{e().set(a,l>>>0)};function hh(a,l,f,h){a>>>=0,l>>>=0,f>>>=0,h>>>=0;var _=c()[h+40>>>2>>>0],b={tm_sec:o()[h>>>2>>>0],tm_min:o()[h+4>>>2>>>0],tm_hour:o()[h+8>>>2>>>0],tm_mday:o()[h+12>>>2>>>0],tm_mon:o()[h+16>>>2>>>0],tm_year:o()[h+20>>>2>>>0],tm_wday:o()[h+24>>>2>>>0],tm_yday:o()[h+28>>>2>>>0],tm_isdst:o()[h+32>>>2>>>0],tm_gmtoff:o()[h+36>>>2>>>0],tm_zone:_?Sn(_):""},y=Sn(f),w={"%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 F in w)y=y.replace(new RegExp(F,"g"),w[F]);var tt=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],it=["January","February","March","April","May","June","July","August","September","October","November","December"];function Zt(v,O,dt){for(var lt=typeof v=="number"?v.toString():v||"";lt.length<O;)lt=dt[0]+lt;return lt}function ct(v,O){return Zt(v,O,"0")}function ze(v,O){function dt($t){return $t<0?-1:$t>0?1:0}var lt;return(lt=dt(v.getFullYear()-O.getFullYear()))===0&&(lt=dt(v.getMonth()-O.getMonth()))===0&&(lt=dt(v.getDate()-O.getDate())),lt}function Bt(v){switch(v.getDay()){case 0:return new Date(v.getFullYear()-1,11,29);case 1:return v;case 2:return new Date(v.getFullYear(),0,3);case 3:return new Date(v.getFullYear(),0,2);case 4:return new Date(v.getFullYear(),0,1);case 5:return new Date(v.getFullYear()-1,11,31);case 6:return new Date(v.getFullYear()-1,11,30)}}function Qt(v){var O=dh(new Date(v.tm_year+1900,0,1),v.tm_yday),dt=new Date(O.getFullYear(),0,4),lt=new Date(O.getFullYear()+1,0,4),$t=Bt(dt),ni=Bt(lt);return ze($t,O)<=0?ze(ni,O)<=0?O.getFullYear()+1:O.getFullYear():O.getFullYear()-1}var Ae={"%a":v=>tt[v.tm_wday].substring(0,3),"%A":v=>tt[v.tm_wday],"%b":v=>it[v.tm_mon].substring(0,3),"%B":v=>it[v.tm_mon],"%C":v=>{var O=v.tm_year+1900;return ct(O/100|0,2)},"%d":v=>ct(v.tm_mday,2),"%e":v=>Zt(v.tm_mday,2," "),"%g":v=>Qt(v).toString().substring(2),"%G":v=>Qt(v),"%H":v=>ct(v.tm_hour,2),"%I":v=>{var O=v.tm_hour;return O==0?O=12:O>12&&(O-=12),ct(O,2)},"%j":v=>ct(v.tm_mday+uh(ds(v.tm_year+1900)?Pl:Vl,v.tm_mon-1),3),"%m":v=>ct(v.tm_mon+1,2),"%M":v=>ct(v.tm_min,2),"%n":()=>"\n","%p":v=>v.tm_hour>=0&&v.tm_hour<12?"AM":"PM","%S":v=>ct(v.tm_sec,2),"%t":()=>" ","%u":v=>v.tm_wday||7,"%U":v=>{var O=v.tm_yday+7-v.tm_wday;return ct(Math.floor(O/7),2)},"%V":v=>{var O=Math.floor((v.tm_yday+7-(v.tm_wday+6)%7)/7);if((v.tm_wday+371-v.tm_yday-2)%7<=2&&O++,O){if(O==53){var lt=(v.tm_wday+371-v.tm_yday)%7;lt!=4&&(lt!=3||!ds(v.tm_year))&&(O=1)}}else{O=52;var dt=(v.tm_wday+7-v.tm_yday-1)%7;(dt==4||dt==5&&ds(v.tm_year%400-1))&&O++}return ct(O,2)},"%w":v=>v.tm_wday,"%W":v=>{var O=v.tm_yday+7-(v.tm_wday+6)%7;return ct(Math.floor(O/7),2)},"%y":v=>(v.tm_year+1900).toString().substring(2),"%Y":v=>v.tm_year+1900,"%z":v=>{var O=v.tm_gmtoff,dt=O>=0;return O=Math.abs(O)/60,O=O/60*100+O%60,(dt?"+":"-")+("0000"+O).slice(-4)},"%Z":v=>v.tm_zone,"%%":()=>"%"};y=y.replace(/%%/g,"\0\0");for(var F in Ae)y.includes(F)&&(y=y.replace(new RegExp(F,"g"),Ae[F](b)));y=y.replace(/\0\0/g,"%");var or=fh(y,!1);return or.length>l?0:(zl(or,a),or.length-1)}function ph(a,l,f,h,_){return a>>>=0,l>>>=0,f>>>=0,h>>>=0,_>>>=0,hh(a,l,f,h)}var mh=a=>{var l=u["_"+a];return l},_h=a=>{var l=Hl(a)+1,f=ri(l);return aa(a,f,l),f},yh=(a,l,f,h,_)=>{var b={string:Bt=>{var Qt=0;return Bt!=null&&Bt!==0&&(Qt=_h(Bt)),Qt},array:Bt=>{var Qt=ri(Bt.length);return zl(Bt,Qt),Qt}};function y(Bt){return l==="string"?Sn(Bt):l==="boolean"?!!Bt:Bt}var w=mh(a),F=[],tt=0;if(h)for(var it=0;it<h.length;it++){var Zt=b[f[it]];Zt?(tt===0&&(tt=ms()),F[it]=Zt(h[it])):F[it]=h[it]}var ct=w.apply(null,F);function ze(Bt){return tt!==0&&ei(tt),y(Bt)}return ct=ze(ct),ct};C.init();var bh=[Yc,Xc,Jc,Zc,nl,il,sl,ol,al,cl,ul,dl,fl,hl,pl,ml,_l,yl,bl,gl,wl,vl,Sl,Il,Al,Fl,xl,Dl,El,Ol,Rl,Ml,Ul,kl,Nl,Ll],gh={E:Sf,s:If,ga:qc,$:Zc,ea:nl,ca:il,X:sl,b:ol,W:al,x:cl,R:ul,Z:dl,_:fl,q:hl,T:pl,S:ml,U:_l,r:yl,aa:bl,P:gl,k:wl,ba:vl,n:Sl,V:Il,l:Al,oa:Bf,da:xf,M:Ef,v:la,u:Of,e:Rf,H:Mf,I:Uf,F:kf,G:Nf,j:Lf,C:Cf,w:Pf,D:Vf,K:Hf,f:zf,J:Wf,g:jf,L:$f,B:Yf,i:Gf,N:Xf,m:Kf,pa:Jf,t:Zf,ha:Qf,c:Tl,ia:th,na:rh,ka:Fl,la:xl,fa:ra,d:Dl,ma:El,z:Ol,y:Rl,p:Ml,A:Ul,Q:kl,h:Nl,o:Ll,O:ch,Y:lh,a:St||u.wasmMemory,ja:ph},A=mf(),wh=()=>(wh=A.qa)(),Wl=u._main=(a,l)=>(Wl=u._main=A.ra)(a,l),vh=u._duckdb_web_fs_glob_add_path=a=>(vh=u._duckdb_web_fs_glob_add_path=A.ta)(a),Sh=u._duckdb_web_clear_response=()=>(Sh=u._duckdb_web_clear_response=A.ua)(),Ih=u._duckdb_web_fail_with=a=>(Ih=u._duckdb_web_fail_with=A.va)(a),Ah=u._duckdb_web_reset=a=>(Ah=u._duckdb_web_reset=A.wa)(a),Bh=u._duckdb_web_connect=()=>(Bh=u._duckdb_web_connect=A.xa)(),Th=u._duckdb_web_disconnect=a=>(Th=u._duckdb_web_disconnect=A.ya)(a),Fh=u._duckdb_web_flush_files=()=>(Fh=u._duckdb_web_flush_files=A.za)(),xh=u._duckdb_web_flush_file=a=>(xh=u._duckdb_web_flush_file=A.Aa)(a),Dh=u._duckdb_web_open=(a,l)=>(Dh=u._duckdb_web_open=A.Ba)(a,l),Eh=u._duckdb_web_get_global_file_info=(a,l)=>(Eh=u._duckdb_web_get_global_file_info=A.Ca)(a,l),Oh=u._duckdb_web_collect_file_stats=(a,l,f)=>(Oh=u._duckdb_web_collect_file_stats=A.Da)(a,l,f),Rh=u._duckdb_web_export_file_stats=(a,l)=>(Rh=u._duckdb_web_export_file_stats=A.Ea)(a,l),Mh=u._duckdb_web_fs_drop_file=(a,l)=>(Mh=u._duckdb_web_fs_drop_file=A.Fa)(a,l),Uh=u._duckdb_web_fs_drop_files=a=>(Uh=u._duckdb_web_fs_drop_files=A.Ga)(a),kh=u._duckdb_web_fs_glob_file_infos=(a,l)=>(kh=u._duckdb_web_fs_glob_file_infos=A.Ha)(a,l),Nh=u._duckdb_web_fs_get_file_info_by_id=(a,l,f)=>(Nh=u._duckdb_web_fs_get_file_info_by_id=A.Ia)(a,l,f),Lh=u._duckdb_web_fs_get_file_info_by_name=(a,l,f)=>(Lh=u._duckdb_web_fs_get_file_info_by_name=A.Ja)(a,l,f),Ch=u._duckdb_web_fs_register_file_url=(a,l,f,h,_)=>(Ch=u._duckdb_web_fs_register_file_url=A.Ka)(a,l,f,h,_),Ph=u._duckdb_web_fs_register_file_buffer=(a,l,f,h)=>(Ph=u._duckdb_web_fs_register_file_buffer=A.La)(a,l,f,h),Vh=u._duckdb_web_copy_file_to_buffer=(a,l)=>(Vh=u._duckdb_web_copy_file_to_buffer=A.Ma)(a,l),Hh=u._duckdb_web_copy_file_to_path=(a,l,f)=>(Hh=u._duckdb_web_copy_file_to_path=A.Na)(a,l,f),zh=u._duckdb_web_get_version=a=>(zh=u._duckdb_web_get_version=A.Oa)(a),Wh=u._duckdb_web_get_feature_flags=()=>(Wh=u._duckdb_web_get_feature_flags=A.Pa)(),jh=u._duckdb_web_tokenize=(a,l)=>(jh=u._duckdb_web_tokenize=A.Qa)(a,l),$h=u._duckdb_web_udf_scalar_create=(a,l,f)=>($h=u._duckdb_web_udf_scalar_create=A.Ra)(a,l,f),Yh=u._duckdb_web_prepared_create=(a,l,f)=>(Yh=u._duckdb_web_prepared_create=A.Sa)(a,l,f),Gh=u._duckdb_web_prepared_close=(a,l,f)=>(Gh=u._duckdb_web_prepared_close=A.Ta)(a,l,f),Xh=u._duckdb_web_prepared_run=(a,l,f,h)=>(Xh=u._duckdb_web_prepared_run=A.Ua)(a,l,f,h),Kh=u._duckdb_web_prepared_send=(a,l,f,h)=>(Kh=u._duckdb_web_prepared_send=A.Va)(a,l,f,h),Jh=u._duckdb_web_query_run=(a,l,f)=>(Jh=u._duckdb_web_query_run=A.Wa)(a,l,f),qh=u._duckdb_web_pending_query_start=(a,l,f)=>(qh=u._duckdb_web_pending_query_start=A.Xa)(a,l,f),Zh=u._duckdb_web_pending_query_poll=(a,l,f)=>(Zh=u._duckdb_web_pending_query_poll=A.Ya)(a,l,f),Qh=u._duckdb_web_pending_query_cancel=(a,l)=>(Qh=u._duckdb_web_pending_query_cancel=A.Za)(a,l),tp=u._duckdb_web_query_fetch_results=(a,l)=>(tp=u._duckdb_web_query_fetch_results=A._a)(a,l),ep=u._duckdb_web_get_tablenames=(a,l,f)=>(ep=u._duckdb_web_get_tablenames=A.$a)(a,l,f),rp=u._duckdb_web_insert_arrow_from_ipc_stream=(a,l,f,h,_)=>(rp=u._duckdb_web_insert_arrow_from_ipc_stream=A.ab)(a,l,f,h,_),np=u._duckdb_web_insert_csv_from_path=(a,l,f,h)=>(np=u._duckdb_web_insert_csv_from_path=A.bb)(a,l,f,h),ip=u._duckdb_web_insert_json_from_path=(a,l,f,h)=>(ip=u._duckdb_web_insert_json_from_path=A.cb)(a,l,f,h),sp=u.__emscripten_tls_init=()=>(sp=u.__emscripten_tls_init=A.db)(),fs=u._pthread_self=()=>(fs=u._pthread_self=A.eb)(),op=()=>(op=A.__errno_location)(),jl=u.__emscripten_thread_init=(a,l,f,h,_,b)=>(jl=u.__emscripten_thread_init=A.fb)(a,l,f,h,_,b),ap=u.__emscripten_thread_crashed=()=>(ap=u.__emscripten_thread_crashed=A.gb)(),hs=a=>(hs=A.hb)(a),ps=a=>(ps=A.ib)(a),cp=()=>(cp=A.emscripten_main_runtime_thread_id)(),lp=()=>(lp=A.emscripten_main_thread_process_queued_calls)(),fa=a=>(fa=A.jb)(a),$l=(a,l,f,h)=>($l=A.kb)(a,l,f,h),ha=a=>(ha=A.lb)(a),pa=u.__emscripten_thread_exit=a=>(pa=u.__emscripten_thread_exit=A.mb)(a),Yl=u.__emscripten_check_mailbox=()=>(Yl=u.__emscripten_check_mailbox=A.nb)(),ma=u._malloc=a=>(ma=u._malloc=A.ob)(a),up=u._free=a=>(up=u._free=A.pb)(a),Gl=()=>(Gl=A.qb)(),Xl=(a,l)=>(Xl=A.rb)(a,l),ms=()=>(ms=A.sb)(),ei=a=>(ei=A.tb)(a),ri=a=>(ri=A.ub)(a);function dp(a){a=Object.assign({},a);var l=h=>()=>h()>>>0,f=h=>_=>h(_)>>>0;return a.eb=l(a.eb),a.__errno_location=l(a.__errno_location),a.ob=f(a.ob),a.sb=l(a.sb),a.ub=f(a.ub),a}u.keepRuntimeAlive=ns,u.wasmMemory=St,u.stackAlloc=ri,u.stackSave=ms,u.stackRestore=ei,u.ccall=yh,u.ExitStatus=ta,u.PThread=C;var _s;Zn=function a(){_s||Kl(),_s||(Zn=a)};function fp(){var a=Wl,l=0,f=0;try{var h=a(l,f);return Gc(h,!0),h}catch(_){return na(_)}}function Kl(){if(Jr>0)return;if(T){m(u),Mc(),startWorker(u);return}if(af(),Jr>0)return;function a(){_s||(_s=!0,u.calledRun=!0,!ts&&(Mc(),cf(),m(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),Jl&&fp(),lf()))}u.setStatus?(u.setStatus("Running..."),setTimeout(function(){setTimeout(function(){u.setStatus("")},1),a()},1)):a()}if(u.preInit)for(typeof u.preInit=="function"&&(u.preInit=[u.preInit]);u.preInit.length>0;)u.preInit.pop()();var Jl=!0;return u.noInitialRun&&(Jl=!1),Kl(),t.ready}})();typeof Yd=="object"&&typeof mc=="object"?mc.exports=$d:typeof define=="function"&&define.amd&&define([],()=>$d)});var Qd=Zr((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,c=this.blocks;i<o;){if(this.hashed&&(this.hashed=!1,c[0]=this.block,c[16]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=c[11]=c[12]=c[13]=c[14]=c[15]=0),t)for(s=this.start;i<o&&s<64;++i)c[s>>2]|=r[i]<<SHIFT[s++&3];else for(s=this.start;i<o&&s<64;++i)n=r.charCodeAt(i),n<128?c[s>>2]|=n<<SHIFT[s++&3]:n<2048?(c[s>>2]|=(192|n>>6)<<SHIFT[s++&3],c[s>>2]|=(128|n&63)<<SHIFT[s++&3]):n<55296||n>=57344?(c[s>>2]|=(224|n>>12)<<SHIFT[s++&3],c[s>>2]|=(128|n>>6&63)<<SHIFT[s++&3],c[s>>2]|=(128|n&63)<<SHIFT[s++&3]):(n=65536+((n&1023)<<10|r.charCodeAt(++i)&1023),c[s>>2]|=(240|n>>18)<<SHIFT[s++&3],c[s>>2]|=(128|n>>12&63)<<SHIFT[s++&3],c[s>>2]|=(128|n>>6&63)<<SHIFT[s++&3],c[s>>2]|=(128|n&63)<<SHIFT[s++&3]);this.lastByteIndex=s,this.bytes+=s-this.start,s>=64?(this.block=c[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,c=this.h7,d=this.blocks,u,m,g,S,B,Q,wt,Et,vt,_t,T;for(u=16;u<64;++u)B=d[u-15],m=(B>>>7|B<<25)^(B>>>18|B<<14)^B>>>3,B=d[u-2],g=(B>>>17|B<<15)^(B>>>19|B<<13)^B>>>10,d[u]=d[u-16]+m+d[u-7]+g<<0;for(T=t&e,u=0;u<64;u+=4)this.first?(this.is224?(Et=300032,B=d[0]-1413257819,c=B-150054599<<0,n=B+24177077<<0):(Et=704751109,B=d[0]-210244248,c=B-1521486534<<0,n=B+143694565<<0),this.first=!1):(m=(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10),g=(i>>>6|i<<26)^(i>>>11|i<<21)^(i>>>25|i<<7),Et=r&t,S=Et^r&e^T,wt=i&s^~i&o,B=c+g+wt+K[u]+d[u],Q=m+S,c=n+B<<0,n=B+Q<<0),m=(n>>>2|n<<30)^(n>>>13|n<<19)^(n>>>22|n<<10),g=(c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7),vt=n&r,S=vt^n&t^Et,wt=c&i^~c&s,B=o+g+wt+K[u+1]+d[u+1],Q=m+S,o=e+B<<0,e=B+Q<<0,m=(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10),g=(o>>>6|o<<26)^(o>>>11|o<<21)^(o>>>25|o<<7),_t=e&n,S=_t^e&r^vt,wt=o&c^~o&i,B=s+g+wt+K[u+2]+d[u+2],Q=m+S,s=t+B<<0,t=B+Q<<0,m=(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10),g=(s>>>6|s<<26)^(s>>>11|s<<21)^(s>>>25|s<<7),T=t&e,S=T^t&n^_t,wt=s&o^~s&c,B=i+g+wt+K[u+3]+d[u+3],Q=m+S,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+c<<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,c=this.h7,d=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||(d+=HEX_CHARS[c>>28&15]+HEX_CHARS[c>>24&15]+HEX_CHARS[c>>20&15]+HEX_CHARS[c>>16&15]+HEX_CHARS[c>>12&15]+HEX_CHARS[c>>8&15]+HEX_CHARS[c>>4&15]+HEX_CHARS[c&15]),d},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,c=this.h7,d=[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||d.push(c>>24&255,c>>16&255,c>>8&255,c&255),d},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,c=0,d;for(n=0;n<o;++n)d=r.charCodeAt(n),d<128?s[c++]=d:d<2048?(s[c++]=192|d>>6,s[c++]=128|d&63):d<55296||d>=57344?(s[c++]=224|d>>12,s[c++]=128|d>>6&63,s[c++]=128|d&63):(d=65536+((d&1023)<<10|r.charCodeAt(++n)&1023),s[c++]=240|d>>18,s[c++]=128|d>>12&63,s[c++]=128|d>>6&63,s[c++]=128|d&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 u=[],m=[];for(n=0;n<64;++n){var g=r[n]||0;u[n]=92^g,m[n]=54^g}Sha256.call(this,t,e),this.update(m),this.oKeyPad=u,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 py={};Qr(py,{registerWorker:()=>nf});function ru(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 I(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 c(m){try{u(n.next(m))}catch(g){o(g)}}function d(m){try{u(n.throw(m))}catch(g){o(g)}}function u(m){m.done?s(m.value):i(m.value).then(c,d)}u((n=n.apply(r,t||[])).next())})}function eu(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 P(r){return this instanceof P?(this.v=r,this):new P(r)}function ae(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(S){n[S]&&(i[S]=function(B){return new Promise(function(Q,wt){s.push([S,B,Q,wt])>1||c(S,B)})})}function c(S,B){try{d(n[S](B))}catch(Q){g(s[0][3],Q)}}function d(S){S.value instanceof P?Promise.resolve(S.value.v).then(u,m):g(s[0][2],S)}function u(S){c("next",S)}function m(S){c("throw",S)}function g(S,B){S(B),s.shift(),s.length&&c(s[0][0],s[0][1])}}function In(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:P(r[i](o)),done:!1}:s?s(o):o}:s}}function Be(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 eu=="function"?eu(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(c,d){o=r[s](o),i(c,d,o.done,o.value)})}}function i(s,o,c,d){Promise.resolve(d).then(function(u){s({value:u,done:c})},o)}}var Sa={};Qr(Sa,{compareArrayLike:()=>va,joinUint8Arrays:()=>ce,memcpy:()=>An,rebaseValueOffsets:()=>oi,toArrayBufferView:()=>$,toArrayBufferViewAsyncIterator:()=>xe,toArrayBufferViewIterator:()=>We,toBigInt64Array:()=>Rp,toBigUint64Array:()=>kp,toFloat32Array:()=>Np,toFloat32ArrayAsyncIterator:()=>Zp,toFloat32ArrayIterator:()=>jp,toFloat64Array:()=>Lp,toFloat64ArrayAsyncIterator:()=>Qp,toFloat64ArrayIterator:()=>$p,toInt16Array:()=>Op,toInt16ArrayAsyncIterator:()=>Xp,toInt16ArrayIterator:()=>Vp,toInt32Array:()=>en,toInt32ArrayAsyncIterator:()=>Kp,toInt32ArrayIterator:()=>Hp,toInt8Array:()=>Ep,toInt8ArrayAsyncIterator:()=>Gp,toInt8ArrayIterator:()=>Pp,toUint16Array:()=>Mp,toUint16ArrayAsyncIterator:()=>Jp,toUint16ArrayIterator:()=>zp,toUint32Array:()=>Up,toUint32ArrayAsyncIterator:()=>qp,toUint32ArrayIterator:()=>Wp,toUint8Array:()=>N,toUint8ArrayAsyncIterator:()=>wa,toUint8ArrayIterator:()=>ga,toUint8ClampedArray:()=>Cp,toUint8ClampedArrayAsyncIterator:()=>tm,toUint8ClampedArrayIterator:()=>Yp});var Tp=new TextDecoder("utf-8"),ii=r=>Tp.decode(r),Fp=new TextEncoder,Dr=r=>Fp.encode(r);var xp=r=>typeof r=="number",nu=r=>typeof r=="boolean",Ot=r=>typeof r=="function",Yt=r=>r!=null&&Object(r)===r,Te=r=>Yt(r)&&Ot(r.then);var Fe=r=>Yt(r)&&Ot(r[Symbol.iterator]),ye=r=>Yt(r)&&Ot(r[Symbol.asyncIterator]),gs=r=>Yt(r)&&Yt(r.schema);var ws=r=>Yt(r)&&"done"in r&&"value"in r;var vs=r=>Yt(r)&&Ot(r.stat)&&xp(r.fd);var Ss=r=>Yt(r)&&si(r.body),Is=r=>"_getDOMStream"in r&&"_getNodeStream"in r,iu=r=>Yt(r)&&Ot(r.abort)&&Ot(r.getWriter)&&!Is(r),si=r=>Yt(r)&&Ot(r.cancel)&&Ot(r.getReader)&&!Is(r),su=r=>Yt(r)&&Ot(r.end)&&Ot(r.write)&&nu(r.writable)&&!Is(r),As=r=>Yt(r)&&Ot(r.read)&&Ot(r.pipe)&&nu(r.readable)&&!Is(r),ou=r=>Yt(r)&&Ot(r.clear)&&Ot(r.bytes)&&Ot(r.position)&&Ot(r.setPosition)&&Ot(r.capacity)&&Ot(r.getBufferIdentifier)&&Ot(r.createLong);var ba=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Dp(r){let t=r[0]?[r[0]]:[],e,n,i,s;for(let o,c,d=0,u=0,m=r.length;++d<m;){if(o=t[u],c=r[d],!o||!c||o.buffer!==c.buffer||c.byteOffset<o.byteOffset){c&&(t[++u]=c);continue}if({byteOffset:e,byteLength:i}=o,{byteOffset:n,byteLength:s}=c,e+i<n||n+s<e){c&&(t[++u]=c);continue}t[u]=new Uint8Array(o.buffer,e,n-e+s)}return t}function An(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 ce(r,t){let e=Dp(r),n=e.reduce((m,g)=>m+g.byteLength,0),i,s,o,c=0,d=-1,u=Math.min(t||Number.POSITIVE_INFINITY,n);for(let m=e.length;++d<m;){if(i=e[d],s=i.subarray(0,Math.min(i.length,u-c)),u<=c+s.length){s.length<i.length?e[d]=i.subarray(s.length):s.length===i.length&&d++,o?An(o,s,c):o=s;break}An(o||(o=new Uint8Array(u)),s,c),c+=s.length}return[o||new Uint8Array(0),e.slice(d),n-(o?o.byteLength:0)]}function $(r,t){let e=ws(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=Dr(e)),e instanceof ArrayBuffer?new r(e):e instanceof ba?new r(e):ou(e)?$(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 Ep=r=>$(Int8Array,r),Op=r=>$(Int16Array,r),en=r=>$(Int32Array,r),Rp=r=>$(BigInt64Array,r),N=r=>$(Uint8Array,r),Mp=r=>$(Uint16Array,r),Up=r=>$(Uint32Array,r),kp=r=>$(BigUint64Array,r),Np=r=>$(Float32Array,r),Lp=r=>$(Float64Array,r),Cp=r=>$(Uint8ClampedArray,r),ya=r=>(r.next(),r);function*We(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof ba?e(t):Fe(t)?t:e(t);return yield*tn(ya(function*(i){let s=null;do s=i.next(yield $(r,s));while(!s.done)}(n[Symbol.iterator]()))),new r}var Pp=r=>We(Int8Array,r),Vp=r=>We(Int16Array,r),Hp=r=>We(Int32Array,r),ga=r=>We(Uint8Array,r),zp=r=>We(Uint16Array,r),Wp=r=>We(Uint32Array,r),jp=r=>We(Float32Array,r),$p=r=>We(Float64Array,r),Yp=r=>We(Uint8ClampedArray,r);function xe(r,t){return ae(this,arguments,function*(){if(Te(t))return yield P(yield P(yield*tn(In(Be(xe(r,yield P(t)))))));let n=function(o){return ae(this,arguments,function*(){yield yield P(yield P(o))})},i=function(o){return ae(this,arguments,function*(){yield P(yield*tn(In(Be(ya(function*(c){let d=null;do d=c.next(yield d==null?void 0:d.value);while(!d.done)}(o[Symbol.iterator]()))))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof ba?n(t):Fe(t)?i(t):ye(t)?t:n(t);return yield P(yield*tn(In(Be(ya(function(o){return ae(this,arguments,function*(){let c=null;do c=yield P(o.next(yield yield P($(r,c))));while(!c.done)})}(s[Symbol.asyncIterator]())))))),yield P(new r)})}var Gp=r=>xe(Int8Array,r),Xp=r=>xe(Int16Array,r),Kp=r=>xe(Int32Array,r),wa=r=>xe(Uint8Array,r),Jp=r=>xe(Uint16Array,r),qp=r=>xe(Uint32Array,r),Zp=r=>xe(Float32Array,r),Qp=r=>xe(Float64Array,r),tm=r=>xe(Uint8ClampedArray,r);function oi(r,t,e){if(r!==0){e=e.slice(0,t+1);for(let n=-1;++n<=t;)e[n]+=r}return e}function va(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 Lt={fromIterable(r){return Bs(em(r))},fromAsyncIterable(r){return Bs(rm(r))},fromDOMStream(r){return Bs(nm(r))},fromNodeStream(r){return Bs(im(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')}},Bs=r=>(r.next(),r);function*em(r){let t,e=!1,n=[],i,s,o,c=0;function d(){return s==="peek"?ce(n,o)[0]:([i,n,c]=ce(n,o),i)}({cmd:s,size:o}=yield null);let u=ga(r)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-c)?u.next():u.next(o-c),!t&&i.byteLength>0&&(n.push(i),c+=i.byteLength),t||o<=c)do({cmd:s,size:o}=yield d());while(o<c);while(!t)}catch(m){(e=!0)&&typeof u.throw=="function"&&u.throw(m)}finally{e===!1&&typeof u.return=="function"&&u.return(null)}return null}function rm(r){return ae(this,arguments,function*(){let e,n=!1,i=[],s,o,c,d=0;function u(){return o==="peek"?ce(i,c)[0]:([s,i,d]=ce(i,c),s)}({cmd:o,size:c}=yield yield P(null));let m=wa(r)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(c-d)?yield P(m.next()):yield P(m.next(c-d)),!e&&s.byteLength>0&&(i.push(s),d+=s.byteLength),e||c<=d)do({cmd:o,size:c}=yield yield P(u()));while(c<d);while(!e)}catch(g){(n=!0)&&typeof m.throw=="function"&&(yield P(m.throw(g)))}finally{n===!1&&typeof m.return=="function"&&(yield P(m.return(new Uint8Array(0))))}return yield P(null)})}function nm(r){return ae(this,arguments,function*(){let e=!1,n=!1,i=[],s,o,c,d=0;function u(){return o==="peek"?ce(i,c)[0]:([s,i,d]=ce(i,c),s)}({cmd:o,size:c}=yield yield P(null));let m=new Aa(r);try{do if({done:e,value:s}=Number.isNaN(c-d)?yield P(m.read()):yield P(m.read(c-d)),!e&&s.byteLength>0&&(i.push(N(s)),d+=s.byteLength),e||c<=d)do({cmd:o,size:c}=yield yield P(u()));while(c<d);while(!e)}catch(g){(n=!0)&&(yield P(m.cancel(g)))}finally{n===!1?yield P(m.cancel()):r.locked&&m.releaseLock()}return yield P(null)})}var Aa=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 I(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 I(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=N(e)),e})}},Ia=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function im(r){return ae(this,arguments,function*(){let e=[],n="error",i=!1,s=null,o,c,d=0,u=[],m;function g(){return o==="peek"?ce(u,c)[0]:([m,u,d]=ce(u,c),m)}if({cmd:o,size:c}=yield yield P(null),r.isTTY)return yield yield P(new Uint8Array(0)),yield P(null);try{e[0]=Ia(r,"end"),e[1]=Ia(r,"error");do{if(e[2]=Ia(r,"readable"),[n,s]=yield P(Promise.race(e.map(B=>B[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(c-d)?(m=N(r.read(c-d)),m.byteLength<c-d&&(m=N(r.read()))):m=N(r.read()),m.byteLength>0&&(u.push(m),d+=m.byteLength)),i||c<=d)do({cmd:o,size:c}=yield yield P(g()));while(c<d)}while(!i)}finally{yield P(S(e,n==="error"?s:null))}return yield P(null);function S(B,Q){return m=u=null,new Promise((wt,Et)=>{for(let[vt,_t]of B)r.off(vt,_t);try{let vt=r.destroy;vt&&vt.call(r,Q),Q=void 0}catch(vt){Q=vt||Q}finally{Q!=null?Et(Q):wt()}})}})}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 It;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(It||(It={}));var yt;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(yt||(yt={}));var Ct;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(Ct||(Ct={}));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 Gt;(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"})(Gt||(Gt={}));var et;(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"})(et||(et={}));var p;(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"})(p||(p={}));var be;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(be||(be={}));var Ha={};Qr(Ha,{clampIndex:()=>Xm,clampRange:()=>ui,createElementComparator:()=>Rr});function je(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=>je(t)),"]"):"[".concat(r,"]"):ArrayBuffer.isView(r)?"[".concat(r,"]"):JSON.stringify(r,(t,e)=>typeof e=="bigint"?"".concat(e):e)}var Ta={};Qr(Ta,{BN:()=>ci,bigNumToBigInt:()=>lu,bigNumToString:()=>Fn,isArrowBigNumSymbol:()=>au});var au=Symbol.for("isArrowBigNum");function De(r,...t){return t.length===0?Object.setPrototypeOf($(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}De.prototype[au]=!0;De.prototype.toJSON=function(){return'"'.concat(Fn(this),'"')};De.prototype.valueOf=function(){return cu(this)};De.prototype.toString=function(){return Fn(this)};De.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return cu(this);case"string":return Fn(this);case"default":return lu(this)}return Fn(this)};function Bn(...r){return De.apply(this,r)}function Tn(...r){return De.apply(this,r)}function ai(...r){return De.apply(this,r)}Object.setPrototypeOf(Bn.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Tn.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(ai.prototype,Object.create(Uint32Array.prototype));Object.assign(Bn.prototype,De.prototype,{constructor:Bn,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Tn.prototype,De.prototype,{constructor:Tn,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(ai.prototype,De.prototype,{constructor:ai,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function cu(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),c=BigInt(o?1:0),d=BigInt(0);if(o){for(let u of s)c+=~u*(BigInt(1)<<BigInt(32)*d++);c*=BigInt(-1)}else for(let u of s)c+=u*(BigInt(1)<<BigInt(32)*d++);return c}var Fn=r=>{if(r.byteLength===8){let s=new r.BigIntArray(r.buffer,r.byteOffset,1);return"".concat(s[0])}if(!r.signed)return Ba(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Ba(r);t=t.slice();let n=1;for(let s=0;s<t.length;s++){let o=t[s],c=~o+n;t[s]=c,n&=o===0?1:0}let i=Ba(t);return"-".concat(i)},lu=r=>r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:Fn(r);function Ba(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 ci=class r{static new(t,e){switch(e){case!0:return new Bn(t);case!1:return new Tn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Bn(t)}return t.byteLength===16?new ai(t):new Tn(t)}static signed(t){return new Bn(t)}static unsigned(t){return new Tn(t)}static decimal(t){return new ai(t)}constructor(t,e){return r.new(t,e)}};function te(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 uu,du,fu,hu,pu,mu,_u,yu,bu,gu,wu,vu,Su,Iu,Au,Bu,Tu,Fu,xu,D=class r{static isNull(t){return(t==null?void 0:t.typeId)===p.Null}static isInt(t){return(t==null?void 0:t.typeId)===p.Int}static isFloat(t){return(t==null?void 0:t.typeId)===p.Float}static isBinary(t){return(t==null?void 0:t.typeId)===p.Binary}static isUtf8(t){return(t==null?void 0:t.typeId)===p.Utf8}static isBool(t){return(t==null?void 0:t.typeId)===p.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===p.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===p.Date}static isTime(t){return(t==null?void 0:t.typeId)===p.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===p.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===p.Interval}static isList(t){return(t==null?void 0:t.typeId)===p.List}static isStruct(t){return(t==null?void 0:t.typeId)===p.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===p.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===p.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===p.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===p.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===p.Dictionary}static isDenseUnion(t){return r.isUnion(t)&&t.mode===It.Dense}static isSparseUnion(t){return r.isUnion(t)&&t.mode===It.Sparse}get typeId(){return p.NONE}};uu=Symbol.toStringTag;D[uu]=(r=>(r.children=null,r.ArrayType=Array,r[Symbol.toStringTag]="DataType"))(D.prototype);var Xt=class extends D{toString(){return"Null"}get typeId(){return p.Null}};du=Symbol.toStringTag;Xt[du]=(r=>r[Symbol.toStringTag]="Null")(Xt.prototype);var Ft=class extends D{constructor(t,e){super(),this.isSigned=t,this.bitWidth=e}get typeId(){return p.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)}};fu=Symbol.toStringTag;Ft[fu]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(Ft.prototype);var Ts=class extends Ft{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Fs=class extends Ft{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},$e=class extends Ft{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},xs=class extends Ft{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Ds=class extends Ft{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Es=class extends Ft{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Os=class extends Ft{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Rs=class extends Ft{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Ts.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Fs.prototype,"ArrayType",{value:Int16Array});Object.defineProperty($e.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(xs.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Ds.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Es.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Os.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Rs.prototype,"ArrayType",{value:BigUint64Array});var ee=class extends D{constructor(t){super(),this.precision=t}get typeId(){return p.Float}get ArrayType(){switch(this.precision){case yt.HALF:return Uint16Array;case yt.SINGLE:return Float32Array;case yt.DOUBLE:return Float64Array}throw new Error("Unrecognized ".concat(this[Symbol.toStringTag]," type"))}toString(){return"Float".concat(this.precision<<5||16)}};hu=Symbol.toStringTag;ee[hu]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(ee.prototype);var Ms=class extends ee{constructor(){super(yt.HALF)}},Us=class extends ee{constructor(){super(yt.SINGLE)}},ks=class extends ee{constructor(){super(yt.DOUBLE)}};Object.defineProperty(Ms.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Us.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(ks.prototype,"ArrayType",{value:Float64Array});var ar=class extends D{constructor(){super()}get typeId(){return p.Binary}toString(){return"Binary"}};pu=Symbol.toStringTag;ar[pu]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(ar.prototype);var cr=class extends D{constructor(){super()}get typeId(){return p.Utf8}toString(){return"Utf8"}};mu=Symbol.toStringTag;cr[mu]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(cr.prototype);var lr=class extends D{constructor(){super()}get typeId(){return p.Bool}toString(){return"Bool"}};_u=Symbol.toStringTag;lr[_u]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(lr.prototype);var ur=class extends D{constructor(t,e,n=128){super(),this.scale=t,this.precision=e,this.bitWidth=n}get typeId(){return p.Decimal}toString(){return"Decimal[".concat(this.precision,"e").concat(this.scale>0?"+":"").concat(this.scale,"]")}};yu=Symbol.toStringTag;ur[yu]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(ur.prototype);var dr=class extends D{constructor(t){super(),this.unit=t}get typeId(){return p.Date}toString(){return"Date".concat((this.unit+1)*32,"<").concat(Ct[this.unit],">")}};bu=Symbol.toStringTag;dr[bu]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Date"))(dr.prototype);var Ee=class extends D{constructor(t,e){super(),this.unit=t,this.bitWidth=e}get typeId(){return p.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"))}};gu=Symbol.toStringTag;Ee[gu]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(Ee.prototype);var fr=class extends D{constructor(t,e){super(),this.unit=t,this.timezone=e}get typeId(){return p.Timestamp}toString(){return"Timestamp<".concat(X[this.unit]).concat(this.timezone?", ".concat(this.timezone):"",">")}};wu=Symbol.toStringTag;fr[wu]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Timestamp"))(fr.prototype);var hr=class extends D{constructor(t){super(),this.unit=t}get typeId(){return p.Interval}toString(){return"Interval<".concat(Gt[this.unit],">")}};vu=Symbol.toStringTag;hr[vu]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(hr.prototype);var Oe=class extends D{constructor(t){super(),this.children=[t]}get typeId(){return p.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}};Su=Symbol.toStringTag;Oe[Su]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(Oe.prototype);var ht=class extends D{constructor(t){super(),this.children=t}get typeId(){return p.Struct}toString(){return"Struct<{".concat(this.children.map(t=>"".concat(t.name,":").concat(t.type)).join(", "),"}>")}};Iu=Symbol.toStringTag;ht[Iu]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(ht.prototype);var Re=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 p.Union}toString(){return"".concat(this[Symbol.toStringTag],"<").concat(this.children.map(t=>"".concat(t.type)).join(" | "),">")}};Au=Symbol.toStringTag;Re[Au]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(Re.prototype);var pr=class extends D{constructor(t){super(),this.byteWidth=t}get typeId(){return p.FixedSizeBinary}toString(){return"FixedSizeBinary[".concat(this.byteWidth,"]")}};Bu=Symbol.toStringTag;pr[Bu]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(pr.prototype);var Me=class extends D{constructor(t,e){super(),this.listSize=t,this.children=[e]}get typeId(){return p.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,">")}};Tu=Symbol.toStringTag;Me[Tu]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Me.prototype);var Ue=class extends D{constructor(t,e=!1){super(),this.children=[t],this.keysSorted=e}get typeId(){return p.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(", "),"}>")}};Fu=Symbol.toStringTag;Ue[Fu]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(Ue.prototype);var sm=(r=>()=>++r)(-1),le=class extends D{constructor(t,e,n,i){super(),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?sm():te(n)}get typeId(){return p.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,">")}};xu=Symbol.toStringTag;le[xu]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(le.prototype);function ue(r){let t=r;switch(r.typeId){case p.Decimal:return r.bitWidth/32;case p.Timestamp:return 2;case p.Date:return 1+t.unit;case p.Interval:return 1+t.unit;case p.FixedSizeList:return t.listSize;case p.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 om(this,t,e)}getVisitFnByTypeId(t,e=!0){return xn(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 om(r,t,e=!0){return typeof t=="number"?xn(r,t,e):typeof t=="string"&&t in p?xn(r,p[t],e):t&&t instanceof D?xn(r,Du(t),e):t!=null&&t.type&&t.type instanceof D?xn(r,Du(t.type),e):xn(r,p.NONE,e)}function xn(r,t,e=!0){let n=null;switch(t){case p.Null:n=r.visitNull;break;case p.Bool:n=r.visitBool;break;case p.Int:n=r.visitInt;break;case p.Int8:n=r.visitInt8||r.visitInt;break;case p.Int16:n=r.visitInt16||r.visitInt;break;case p.Int32:n=r.visitInt32||r.visitInt;break;case p.Int64:n=r.visitInt64||r.visitInt;break;case p.Uint8:n=r.visitUint8||r.visitInt;break;case p.Uint16:n=r.visitUint16||r.visitInt;break;case p.Uint32:n=r.visitUint32||r.visitInt;break;case p.Uint64:n=r.visitUint64||r.visitInt;break;case p.Float:n=r.visitFloat;break;case p.Float16:n=r.visitFloat16||r.visitFloat;break;case p.Float32:n=r.visitFloat32||r.visitFloat;break;case p.Float64:n=r.visitFloat64||r.visitFloat;break;case p.Utf8:n=r.visitUtf8;break;case p.Binary:n=r.visitBinary;break;case p.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case p.Date:n=r.visitDate;break;case p.DateDay:n=r.visitDateDay||r.visitDate;break;case p.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case p.Timestamp:n=r.visitTimestamp;break;case p.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case p.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case p.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case p.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case p.Time:n=r.visitTime;break;case p.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case p.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case p.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case p.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case p.Decimal:n=r.visitDecimal;break;case p.List:n=r.visitList;break;case p.Struct:n=r.visitStruct;break;case p.Union:n=r.visitUnion;break;case p.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case p.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case p.Dictionary:n=r.visitDictionary;break;case p.Interval:n=r.visitInterval;break;case p.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case p.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case p.FixedSizeList:n=r.visitFixedSizeList;break;case p.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error("Unrecognized type '".concat(p[t],"'"))}function Du(r){switch(r.typeId){case p.Null:return p.Null;case p.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?p.Int8:p.Uint8;case 16:return e?p.Int16:p.Uint16;case 32:return e?p.Int32:p.Uint32;case 64:return e?p.Int64:p.Uint64}return p.Int}case p.Float:switch(r.precision){case yt.HALF:return p.Float16;case yt.SINGLE:return p.Float32;case yt.DOUBLE:return p.Float64}return p.Float;case p.Binary:return p.Binary;case p.Utf8:return p.Utf8;case p.Bool:return p.Bool;case p.Decimal:return p.Decimal;case p.Time:switch(r.unit){case X.SECOND:return p.TimeSecond;case X.MILLISECOND:return p.TimeMillisecond;case X.MICROSECOND:return p.TimeMicrosecond;case X.NANOSECOND:return p.TimeNanosecond}return p.Time;case p.Timestamp:switch(r.unit){case X.SECOND:return p.TimestampSecond;case X.MILLISECOND:return p.TimestampMillisecond;case X.MICROSECOND:return p.TimestampMicrosecond;case X.NANOSECOND:return p.TimestampNanosecond}return p.Timestamp;case p.Date:switch(r.unit){case Ct.DAY:return p.DateDay;case Ct.MILLISECOND:return p.DateMillisecond}return p.Date;case p.Interval:switch(r.unit){case Gt.DAY_TIME:return p.IntervalDayTime;case Gt.YEAR_MONTH:return p.IntervalYearMonth}return p.Interval;case p.Map:return p.Map;case p.List:return p.List;case p.Struct:return p.Struct;case p.Union:switch(r.mode){case It.Dense:return p.DenseUnion;case It.Sparse:return p.SparseUnion}return p.Union;case p.FixedSizeBinary:return p.FixedSizeBinary;case p.FixedSizeList:return p.FixedSizeList;case p.Dictionary:return p.Dictionary}throw new Error("Unrecognized type '".concat(p[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 Fa={};Qr(Fa,{float64ToUint16:()=>li,uint16ToFloat64:()=>Ns});var Eu=new Float64Array(1),Dn=new Uint32Array(Eu.buffer);function Ns(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 li(r){if(r!==r)return 32256;Eu[0]=r;let t=(Dn[1]&2147483648)>>16&65535,e=Dn[1]&2146435072,n=0;return e>=1089470464?Dn[0]>0?e=31744:(e=(e&2080374784)>>16,n=(Dn[1]&1048575)>>10):e<=1056964608?(n=1048576+(Dn[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(Dn[1]&1048575)+512>>10),t|e|n&65535}var L=class extends E{};function j(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var am=(r,t,e)=>{r[t]=Math.trunc(e/864e5)},xa=(r,t,e)=>{r[t]=Math.trunc(e%4294967296),r[t+1]=Math.trunc(e/4294967296)},cm=(r,t,e)=>{r[t]=Math.trunc(e*1e3%4294967296),r[t+1]=Math.trunc(e*1e3/4294967296)},lm=(r,t,e)=>{r[t]=Math.trunc(e*1e6%4294967296),r[t+1]=Math.trunc(e*1e6/4294967296)},Ou=(r,t,e,n)=>{if(e+1<t.length){let{[e]:i,[e+1]:s}=t;r.set(n.subarray(0,s-i),i)}},um=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},mr=({values:r},t,e)=>{r[t]=e},Da=({values:r},t,e)=>{r[t]=e},Ru=({values:r},t,e)=>{r[t]=li(e)},dm=(r,t,e)=>{switch(r.type.precision){case yt.HALF:return Ru(r,t,e);case yt.SINGLE:case yt.DOUBLE:return Da(r,t,e)}},Ls=({values:r},t,e)=>{am(r,t,e.valueOf())},Cs=({values:r},t,e)=>{xa(r,t*2,e.valueOf())},Ea=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},fm=({values:r,valueOffsets:t},e,n)=>Ou(r,t,e,n),hm=({values:r,valueOffsets:t},e,n)=>{Ou(r,t,e,Dr(n))},Oa=(r,t,e)=>{r.type.unit===Ct.DAY?Ls(r,t,e):Cs(r,t,e)},Ps=({values:r},t,e)=>xa(r,t*2,e/1e3),Vs=({values:r},t,e)=>xa(r,t*2,e),Hs=({values:r},t,e)=>cm(r,t*2,e),zs=({values:r},t,e)=>lm(r,t*2,e),Ra=(r,t,e)=>{switch(r.type.unit){case X.SECOND:return Ps(r,t,e);case X.MILLISECOND:return Vs(r,t,e);case X.MICROSECOND:return Hs(r,t,e);case X.NANOSECOND:return zs(r,t,e)}},Ws=({values:r},t,e)=>{r[t]=e},js=({values:r},t,e)=>{r[t]=e},$s=({values:r},t,e)=>{r[t]=e},Ys=({values:r},t,e)=>{r[t]=e},Ma=(r,t,e)=>{switch(r.type.unit){case X.SECOND:return Ws(r,t,e);case X.MILLISECOND:return js(r,t,e);case X.MICROSECOND:return $s(r,t,e);case X.NANOSECOND:return Ys(r,t,e)}},Ua=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},pm=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,s=Pt.getVisitFn(n);if(Array.isArray(e))for(let o=-1,c=i[t],d=i[t+1];c<d;)s(n,c++,e[++o]);else for(let o=-1,c=i[t],d=i[t+1];c<d;)s(n,c++,e.get(++o))},mm=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,s=Pt.getVisitFn(n),{[t]:o,[t+1]:c}=i,d=e instanceof Map?e.entries():Object.entries(e);for(let u of d)if(s(n,o,u),++o>=c)break},_m=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),ym=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),bm=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),gm=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),wm=(r,t,e)=>{let n=r.type.children.map(s=>Pt.getVisitFn(s.type)),i=e instanceof Map?bm(t,e):e instanceof J?ym(t,e):Array.isArray(e)?_m(t,e):gm(t,e);r.type.children.forEach((s,o)=>i(n[o],r.children[o],s,o))},vm=(r,t,e)=>{r.type.mode===It.Dense?Mu(r,t,e):Uu(r,t,e)},Mu=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Pt.visit(i,r.valueOffsets[t],e)},Uu=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Pt.visit(i,t,e)},Sm=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},ka=(r,t,e)=>{r.type.unit===Gt.DAY_TIME?Gs(r,t,e):Xs(r,t,e)},Gs=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},Xs=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},Im=(r,t,e)=>{let{stride:n}=r,i=r.children[0],s=Pt.getVisitFn(i);if(Array.isArray(e))for(let o=-1,c=t*n;++o<n;)s(i,c+o,e[o]);else for(let o=-1,c=t*n;++o<n;)s(i,c+o,e.get(o))};L.prototype.visitBool=j(um);L.prototype.visitInt=j(mr);L.prototype.visitInt8=j(mr);L.prototype.visitInt16=j(mr);L.prototype.visitInt32=j(mr);L.prototype.visitInt64=j(mr);L.prototype.visitUint8=j(mr);L.prototype.visitUint16=j(mr);L.prototype.visitUint32=j(mr);L.prototype.visitUint64=j(mr);L.prototype.visitFloat=j(dm);L.prototype.visitFloat16=j(Ru);L.prototype.visitFloat32=j(Da);L.prototype.visitFloat64=j(Da);L.prototype.visitUtf8=j(hm);L.prototype.visitBinary=j(fm);L.prototype.visitFixedSizeBinary=j(Ea);L.prototype.visitDate=j(Oa);L.prototype.visitDateDay=j(Ls);L.prototype.visitDateMillisecond=j(Cs);L.prototype.visitTimestamp=j(Ra);L.prototype.visitTimestampSecond=j(Ps);L.prototype.visitTimestampMillisecond=j(Vs);L.prototype.visitTimestampMicrosecond=j(Hs);L.prototype.visitTimestampNanosecond=j(zs);L.prototype.visitTime=j(Ma);L.prototype.visitTimeSecond=j(Ws);L.prototype.visitTimeMillisecond=j(js);L.prototype.visitTimeMicrosecond=j($s);L.prototype.visitTimeNanosecond=j(Ys);L.prototype.visitDecimal=j(Ua);L.prototype.visitList=j(pm);L.prototype.visitStruct=j(wm);L.prototype.visitUnion=j(vm);L.prototype.visitDenseUnion=j(Mu);L.prototype.visitSparseUnion=j(Uu);L.prototype.visitDictionary=j(Sm);L.prototype.visitInterval=j(ka);L.prototype.visitIntervalDayTime=j(Gs);L.prototype.visitIntervalYearMonth=j(Xs);L.prototype.visitFixedSizeList=j(Im);L.prototype.visitMap=j(mm);var Pt=new L;var ke=Symbol.for("parent"),En=Symbol.for("rowIndex"),Er=class{constructor(t,e){return this[ke]=t,this[En]=e,new Proxy(this,new La)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[En],e=this[ke],n=e.type.children,i={};for(let s=-1,o=n.length;++s<o;)i[n[s].name]=Dt.visit(e.children[s],t);return i}toString(){return"{".concat([...this].map(([t,e])=>"".concat(je(t),": ").concat(je(e))).join(", "),"}")}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Na(this[ke],this[En])}},Na=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,Dt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Er.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[ke]:{writable:!0,enumerable:!1,configurable:!1,value:null},[En]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var La=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[ke].type.children.map(e=>e.name)}has(t,e){return t[ke].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[ke].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[ke].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=Dt.visit(t[ke].children[n],t[En]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[ke].type.children.findIndex(s=>s.name===e);return i!==-1?(Pt.visit(t[ke].children[i],t[En],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 H(r){return(t,e)=>t.getValid(e)?r(t,e):null}var Am=(r,t)=>864e5*r[t],Ca=(r,t)=>4294967296*r[t+1]+(r[t]>>>0),Bm=(r,t)=>4294967296*(r[t+1]/1e3)+(r[t]>>>0)/1e3,Tm=(r,t)=>4294967296*(r[t+1]/1e6)+(r[t]>>>0)/1e6,ku=r=>new Date(r),Fm=(r,t)=>ku(Am(r,t)),xm=(r,t)=>ku(Ca(r,t)),Dm=(r,t)=>null,Nu=(r,t,e)=>{if(e+1>=t.length)return null;let n=t[e],i=t[e+1];return r.subarray(n,i)},Em=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},Lu=({values:r},t)=>Fm(r,t),Cu=({values:r},t)=>xm(r,t*2),Or=({stride:r,values:t},e)=>t[r*e],Om=({stride:r,values:t},e)=>Ns(t[r*e]),Pu=({values:r},t)=>r[t],Rm=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),Mm=({values:r,valueOffsets:t},e)=>Nu(r,t,e),Um=({values:r,valueOffsets:t},e)=>{let n=Nu(r,t,e);return n!==null?ii(n):null},km=({values:r},t)=>r[t],Nm=({type:r,values:t},e)=>r.precision!==yt.HALF?t[e]:Ns(t[e]),Lm=(r,t)=>r.type.unit===Ct.DAY?Lu(r,t):Cu(r,t),Vu=({values:r},t)=>1e3*Ca(r,t*2),Hu=({values:r},t)=>Ca(r,t*2),zu=({values:r},t)=>Bm(r,t*2),Wu=({values:r},t)=>Tm(r,t*2),Cm=(r,t)=>{switch(r.type.unit){case X.SECOND:return Vu(r,t);case X.MILLISECOND:return Hu(r,t);case X.MICROSECOND:return zu(r,t);case X.NANOSECOND:return Wu(r,t)}},ju=({values:r},t)=>r[t],$u=({values:r},t)=>r[t],Yu=({values:r},t)=>r[t],Gu=({values:r},t)=>r[t],Pm=(r,t)=>{switch(r.type.unit){case X.SECOND:return ju(r,t);case X.MILLISECOND:return $u(r,t);case X.MICROSECOND:return Yu(r,t);case X.NANOSECOND:return Gu(r,t)}},Vm=({values:r,stride:t},e)=>ci.decimal(r.subarray(t*e,t*(e+1))),Hm=(r,t)=>{let{valueOffsets:e,stride:n,children:i}=r,{[t*n]:s,[t*n+1]:o}=e,d=i[0].slice(s,o-s);return new J([d])},zm=(r,t)=>{let{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:s}=e,o=n[0];return new Ye(o.slice(i,s-i))},Wm=(r,t)=>new Er(r,t),jm=(r,t)=>r.type.mode===It.Dense?Xu(r,t):Ku(r,t),Xu=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return Dt.visit(n,r.valueOffsets[t])},Ku=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return Dt.visit(n,t)},$m=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},Ym=(r,t)=>r.type.unit===Gt.DAY_TIME?Ju(r,t):qu(r,t),Ju=({values:r},t)=>r.subarray(2*t,2*(t+1)),qu=({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},Gm=(r,t)=>{let{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new J([s])};R.prototype.visitNull=H(Dm);R.prototype.visitBool=H(Em);R.prototype.visitInt=H(km);R.prototype.visitInt8=H(Or);R.prototype.visitInt16=H(Or);R.prototype.visitInt32=H(Or);R.prototype.visitInt64=H(Pu);R.prototype.visitUint8=H(Or);R.prototype.visitUint16=H(Or);R.prototype.visitUint32=H(Or);R.prototype.visitUint64=H(Pu);R.prototype.visitFloat=H(Nm);R.prototype.visitFloat16=H(Om);R.prototype.visitFloat32=H(Or);R.prototype.visitFloat64=H(Or);R.prototype.visitUtf8=H(Um);R.prototype.visitBinary=H(Mm);R.prototype.visitFixedSizeBinary=H(Rm);R.prototype.visitDate=H(Lm);R.prototype.visitDateDay=H(Lu);R.prototype.visitDateMillisecond=H(Cu);R.prototype.visitTimestamp=H(Cm);R.prototype.visitTimestampSecond=H(Vu);R.prototype.visitTimestampMillisecond=H(Hu);R.prototype.visitTimestampMicrosecond=H(zu);R.prototype.visitTimestampNanosecond=H(Wu);R.prototype.visitTime=H(Pm);R.prototype.visitTimeSecond=H(ju);R.prototype.visitTimeMillisecond=H($u);R.prototype.visitTimeMicrosecond=H(Yu);R.prototype.visitTimeNanosecond=H(Gu);R.prototype.visitDecimal=H(Vm);R.prototype.visitList=H(Hm);R.prototype.visitStruct=H(Wm);R.prototype.visitUnion=H(jm);R.prototype.visitDenseUnion=H(Xu);R.prototype.visitSparseUnion=H(Ku);R.prototype.visitDictionary=H($m);R.prototype.visitInterval=H(Ym);R.prototype.visitIntervalDayTime=H(Ju);R.prototype.visitIntervalYearMonth=H(qu);R.prototype.visitFixedSizeList=H(Gm);R.prototype.visitMap=H(zm);var Dt=new R;var ge=Symbol.for("keys"),On=Symbol.for("vals"),Ye=class{constructor(t){return this[ge]=new J([t.children[0]]).memoize(),this[On]=t.children[1],new Proxy(this,new Va)}[Symbol.iterator](){return new Pa(this[ge],this[On])}get size(){return this[ge].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[ge],e=this[On],n={};for(let i=-1,s=t.length;++i<s;)n[t.get(i)]=Dt.visit(e,i);return n}toString(){return"{".concat([...this].map(([t,e])=>"".concat(je(t),": ").concat(je(e))).join(", "),"}")}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},Pa=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),Dt.visit(this.vals,t)]})}},Va=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[ge].toArray().map(String)}has(t,e){return t[ge].includes(e)}getOwnPropertyDescriptor(t,e){if(t[ge].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[ge].indexOf(e);if(n!==-1){let i=Dt.visit(Reflect.get(t,On),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[ge].indexOf(e);return i!==-1?(Pt.visit(Reflect.get(t,On),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(Ye.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[ge]:{writable:!0,enumerable:!1,configurable:!1,value:null},[On]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function Xm(r,t,e){let n=r.length,i=t>-1?t:n+t%n;return e?e(r,i):i}var Zu;function ui(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&&(Zu=s,s=o,o=Zu),o>i&&(o=i),n?n(r,s,o):[s,o]}var Qu=r=>r!==r;function Rr(r){if(typeof r!=="object"||r===null)return Qu(r)?Qu: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?va(r,e):!1:r instanceof Map?Jm(r):Array.isArray(r)?Km(r):r instanceof J?qm(r):Zm(r,!0)}function Km(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Rr(r[e]);return Ks(t)}function Jm(r){let t=-1,e=[];for(let n of r.values())e[++t]=Rr(n);return Ks(e)}function qm(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Rr(r.get(e));return Ks(t)}function Zm(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]=Rr(r[e[i]]);return Ks(n,e)}function Ks(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return Qm(r,e);case Map:return td(r,e,e.keys());case Ye:case Er:case Object:case void 0:return td(r,e,t||Object.keys(e))}return e instanceof J?t_(r,e):!1}}function Qm(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 t_(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 td(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,c=r.length,d=s.next(),u=n.next(),m=i.next();for(;o<c&&!u.done&&!m.done&&!d.done&&!(u.value!==m.value||!r[o](d.value));++o,u=n.next(),m=i.next(),d=s.next());return o===c&&u.done&&m.done&&d.done?!0:(n.return&&n.return(),i.return&&i.return(),s.return&&s.return(),!1)}var za={};Qr(za,{BitIterator:()=>rn,getBit:()=>ed,getBool:()=>qs,packBools:()=>nn,popcnt_array:()=>rd,popcnt_bit_range:()=>di,popcnt_uint32:()=>Js,setBool:()=>e_,truncateBitmap:()=>Rn});function qs(r,t,e,n){return(e&1<<n)!==0}function ed(r,t,e,n){return(e&1<<n)>>n}function e_(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function Rn(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):nn(new rn(e,r,t,null,qs)).subarray(0,n)),i}return e}function nn(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 rn=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 di(r,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(let o of new rn(r,t,e-t,r,ed))s+=o;return s}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return di(r,t,i)+di(r,n,e)+rd(r,i>>3,n-i>>3)}function rd(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+=Js(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=Js(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=Js(s.getUint8(i)),i+=1;return n}function Js(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 r_=-1,ut=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,c)=>o+c.byteLength,t)}get nullCount(){let t=this._nullCount,e;return t<=r_&&(e=this.nullBitmap)&&(this._nullCount=t=this.length-di(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,i,s,o=[],c){this.type=t,this.children=o,this.dictionary=c,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 d;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=ue(t),s&&((d=s[0])&&(this.valueOffsets=d),(d=s[1])&&(this.values=d),(d=s[2])&&(this.nullBitmap=d),(d=s[3])&&(this.typeIds=d))),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:d}=this._changeLengthAndBackfillNullBitmap(this.length);Object.assign(this,{nullBitmap:d,_nullCount:0})}let{nullBitmap:n,offset:i}=this,s=i+t>>3,o=(i+t)%8,c=n[s]>>o&1;return e?c===0&&(n[s]|=1<<o,this._nullCount=this.nullCount+1):c===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,c=i===16?n:1,d=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,o,d,s.length===0||this.valueOffsets?s:this._sliceChildren(s,c*t,c*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===p.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(Rn(this.offset,e,this.nullBitmap),0);let s=this.buffers;return s[be.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[be.TYPE])&&(o[be.TYPE]=s.subarray(t,t+e)),(s=o[be.OFFSET])&&(o[be.OFFSET]=s.subarray(t,t+e+1))||(s=o[be.DATA])&&(o[be.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};ut.prototype.children=Object.freeze([]);var Wa=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 ut(e,n,i,0)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(e,n,o,c,[void 0,s,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(e,n,o,c,[void 0,s,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(e,n,o,c,[void 0,s,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.data),s=N(t.nullBitmap),o=en(t.valueOffsets),{["length"]:c=o.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new ut(e,n,c,d,[o,i,s])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.data),s=N(t.nullBitmap),o=en(t.valueOffsets),{["length"]:c=o.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new ut(e,n,c,d,[o,i,s])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/ue(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(e,n,o,c,[void 0,s,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/ue(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(e,n,o,c,[void 0,s,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/ue(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(e,n,o,c,[void 0,s,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/ue(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(e,n,o,c,[void 0,s,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/ue(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(e,n,o,c,[void 0,s,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,s=N(t.nullBitmap),o=en(t.valueOffsets),{["length"]:c=o.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new ut(e,n,c,d,[o,void 0,s],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=N(t.nullBitmap),{length:o=i.reduce((d,{length:u})=>Math.max(d,u),0),nullCount:c=t.nullBitmap?-1:0}=t;return new ut(e,n,o,c,[void 0,void 0,s],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=N(t.nullBitmap),o=$(e.ArrayType,t.typeIds),{["length"]:c=o.length,["nullCount"]:d=t.nullBitmap?-1:0}=t;if(D.isSparseUnion(e))return new ut(e,n,c,d,[void 0,void 0,s,o],i);let u=en(t.valueOffsets);return new ut(e,n,c,d,[u,void 0,s,o],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.indices.ArrayType,t.data),{["dictionary"]:o=new J([new r().visit({type:e.dictionary})])}=t,{["length"]:c=s.length,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new ut(e,n,c,d,[void 0,s,i],[],o)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=N(t.nullBitmap),s=$(e.ArrayType,t.data),{["length"]:o=s.length/ue(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(e,n,o,c,[void 0,s,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new r().visit({type:e.valueType})}=t,s=N(t.nullBitmap),{["length"]:o=i.length/ue(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(e,n,o,c,[void 0,void 0,s],[i])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new r().visit({type:e.childType})}=t,s=N(t.nullBitmap),o=en(t.valueOffsets),{["length"]:c=o.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new ut(e,n,c,d,[o,void 0,s],[i])}};function V(r){return new Wa().visit(r)}var fi=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 Zs(r){return r.reduce((t,e)=>t+e.nullCount,0)}function Qs(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function to(r,t,e,n){let i=[];for(let s=-1,o=r.length;++s<o;){let c=r[s],d=t[s],{length:u}=c;if(d>=n)break;if(e>=d+u)continue;if(d>=e&&d+u<=n){i.push(c);continue}let m=Math.max(0,e-d),g=Math.min(n-d,u);i.push(c.slice(m,g-m))}return i.length===0&&i.push(r[0].slice(0,0)),i}function ja(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 hi(r,t){return r.getValid(t)}function Mr(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return ja(n,this._offsets,e,t)}}function eo(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=ja(s,this._offsets,n,e);return t=void 0,o}}function ro(r){let t;function e(n,i,s){let o=s,c=0,d=0;for(let u=i-1,m=n.length;++u<m;){let g=n[u];if(~(c=r(g,t,o)))return d+c;o=0,d+=g.length}return-1}return function(n,i){t=n;let s=this.data,o=typeof i!="number"?e(s,0,0):ja(s,this._offsets,i,e);return t=void 0,o}}var M=class extends E{};function n_(r,t){return t===null&&r.length>0?0:-1}function i_(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new rn(e,r.offset+(t||0),r.length,e,qs)){if(!i)return n;++n}return-1}function Y(r,t,e){if(t===void 0)return-1;if(t===null)return i_(r,e);let n=Dt.getVisitFn(r),i=Rr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}function nd(r,t,e){let n=Dt.getVisitFn(r),i=Rr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}M.prototype.visitNull=n_;M.prototype.visitBool=Y;M.prototype.visitInt=Y;M.prototype.visitInt8=Y;M.prototype.visitInt16=Y;M.prototype.visitInt32=Y;M.prototype.visitInt64=Y;M.prototype.visitUint8=Y;M.prototype.visitUint16=Y;M.prototype.visitUint32=Y;M.prototype.visitUint64=Y;M.prototype.visitFloat=Y;M.prototype.visitFloat16=Y;M.prototype.visitFloat32=Y;M.prototype.visitFloat64=Y;M.prototype.visitUtf8=Y;M.prototype.visitBinary=Y;M.prototype.visitFixedSizeBinary=Y;M.prototype.visitDate=Y;M.prototype.visitDateDay=Y;M.prototype.visitDateMillisecond=Y;M.prototype.visitTimestamp=Y;M.prototype.visitTimestampSecond=Y;M.prototype.visitTimestampMillisecond=Y;M.prototype.visitTimestampMicrosecond=Y;M.prototype.visitTimestampNanosecond=Y;M.prototype.visitTime=Y;M.prototype.visitTimeSecond=Y;M.prototype.visitTimeMillisecond=Y;M.prototype.visitTimeMicrosecond=Y;M.prototype.visitTimeNanosecond=Y;M.prototype.visitDecimal=Y;M.prototype.visitList=Y;M.prototype.visitStruct=Y;M.prototype.visitUnion=Y;M.prototype.visitDenseUnion=nd;M.prototype.visitSparseUnion=nd;M.prototype.visitDictionary=Y;M.prototype.visitInterval=Y;M.prototype.visitIntervalDayTime=Y;M.prototype.visitIntervalYearMonth=Y;M.prototype.visitFixedSizeList=Y;M.prototype.visitMap=Y;var sn=new M;var U=class extends E{};function z(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(t.typeId===p.Timestamp||t instanceof Ft&&t.bitWidth!==64||t instanceof Ee&&t.bitWidth!==64||t instanceof ee&&t.precision!==yt.HALF))return new fi(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new fi(r.data.length,n=>{let s=r.data[n].length,o=r.slice(e,e+s);return e+=s,new $a(o)})}var $a=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=z;U.prototype.visitBool=z;U.prototype.visitInt=z;U.prototype.visitInt8=z;U.prototype.visitInt16=z;U.prototype.visitInt32=z;U.prototype.visitInt64=z;U.prototype.visitUint8=z;U.prototype.visitUint16=z;U.prototype.visitUint32=z;U.prototype.visitUint64=z;U.prototype.visitFloat=z;U.prototype.visitFloat16=z;U.prototype.visitFloat32=z;U.prototype.visitFloat64=z;U.prototype.visitUtf8=z;U.prototype.visitBinary=z;U.prototype.visitFixedSizeBinary=z;U.prototype.visitDate=z;U.prototype.visitDateDay=z;U.prototype.visitDateMillisecond=z;U.prototype.visitTimestamp=z;U.prototype.visitTimestampSecond=z;U.prototype.visitTimestampMillisecond=z;U.prototype.visitTimestampMicrosecond=z;U.prototype.visitTimestampNanosecond=z;U.prototype.visitTime=z;U.prototype.visitTimeSecond=z;U.prototype.visitTimeMillisecond=z;U.prototype.visitTimeMicrosecond=z;U.prototype.visitTimeNanosecond=z;U.prototype.visitDecimal=z;U.prototype.visitList=z;U.prototype.visitStruct=z;U.prototype.visitUnion=z;U.prototype.visitDenseUnion=z;U.prototype.visitSparseUnion=z;U.prototype.visitDictionary=z;U.prototype.visitInterval=z;U.prototype.visitIntervalDayTime=z;U.prototype.visitIntervalYearMonth=z;U.prototype.visitFixedSizeList=z;U.prototype.visitMap=z;var Mn=new U;var s_=(r,t)=>r+t,Ge=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+de.visit(i,e),0)}visitFixedSizeBinary(t,e){return t.type.byteWidth}visitMap(t,e){return 8+t.children.reduce((n,i)=>n+de.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)}},o_=({valueOffsets:r},t)=>8+(r[t+1]-r[t]),a_=({valueOffsets:r},t)=>8+(r[t+1]-r[t]),c_=({valueOffsets:r,stride:t,children:e},n)=>{let i=e[0],{[n*t]:s}=r,{[n*t+1]:o}=r,c=de.getVisitFn(i.type),d=i.slice(s,o-s),u=8;for(let m=-1,g=o-s;++m<g;)u+=c(d,m);return u},l_=({stride:r,children:t},e)=>{let n=t[0],i=n.slice(e*r,r),s=de.getVisitFn(n.type),o=0;for(let c=-1,d=i.length;++c<d;)o+=s(i,c);return o},u_=(r,t)=>r.type.mode===It.Dense?id(r,t):sd(r,t),id=({type:r,children:t,typeIds:e,valueOffsets:n},i)=>{let s=r.typeIdToChildIndex[e[i]];return 8+de.visit(t[s],n[i])},sd=({children:r},t)=>4+de.visitMany(r,r.map(()=>t)).reduce(s_,0);Ge.prototype.visitUtf8=o_;Ge.prototype.visitBinary=a_;Ge.prototype.visitList=c_;Ge.prototype.visitFixedSizeList=l_;Ge.prototype.visitUnion=u_;Ge.prototype.visitDenseUnion=id;Ge.prototype.visitSparseUnion=sd;var de=new Ge;var od,ad={},cd={},J=class r{constructor(t){var e,n,i;let s=t[0]instanceof r?t.flatMap(c=>c.data):t;if(s.length===0||s.some(c=>!(c instanceof ut)))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:c,set:d,indexOf:u,byteLength:m}=ad[o.typeId],g=s[0];this.isValid=S=>hi(g,S),this.get=S=>c(g,S),this.set=(S,B)=>d(g,S,B),this.indexOf=S=>u(g,S),this.getByteLength=S=>m(g,S),this._offsets=[0,g.length];break}default:Object.setPrototypeOf(this,cd[o.typeId]),this._offsets=Qs(s);break}this.data=s,this.type=o,this.stride=ue(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=Zs(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(p[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 Mn.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(ui(this,t,e,({data:n,_offsets:i},s,o)=>to(n,i,s,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:i,ArrayType:s}=this;switch(t.typeId){case p.Int:case p.Float:case p.Decimal:case p.Time:case p.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:c,length:d})=>(o.array.set(c.subarray(0,d*i),o.offset),o.offset+=d*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 no(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new r(e)}return new no(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}};od=Symbol.toStringTag;J[od]=(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(p).map(e=>p[e]).filter(e=>typeof e=="number"&&e!==p.NONE);for(let e of t){let n=Dt.getVisitFnByTypeId(e),i=Pt.getVisitFnByTypeId(e),s=sn.getVisitFnByTypeId(e),o=de.getVisitFnByTypeId(e);ad[e]={get:n,set:i,indexOf:s,byteLength:o},cd[e]=Object.create(r,{isValid:{value:Mr(hi)},get:{value:Mr(Dt.getVisitFnByTypeId(e))},set:{value:eo(Pt.getVisitFnByTypeId(e))},indexOf:{value:ro(sn.getVisitFnByTypeId(e))},getByteLength:{value:Mr(de.getVisitFnByTypeId(e))}})}return"Vector"})(J.prototype);var no=class r extends J{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 c=s[o];if(c!==void 0)return c;let d=e.call(this,o);return s[o]=d,d}}),Object.defineProperty(this,"set",{value(o,c){n.call(this,o,c),s[o]=c}}),Object.defineProperty(this,"slice",{value:(o,c)=>new r(i.call(this,o,c))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new J(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function ld(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(d_(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 d_(r){return typeof r!="bigint"?je(r):"".concat(je(r),"n")}var Ya=(r,t)=>(Math.ceil(r)*t+63&-64||64)/t,f_=(r,t=0)=>r.length>=t?r.subarray(0,t):An(new r.constructor(t),r,0),Ur=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?Ya(n*1,this.BYTES_PER_ELEMENT):Ya(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Ya(t*this.stride,this.BYTES_PER_ELEMENT);let e=f_(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this._resize(0),this}_resize(t){return this.buffer=An(new this.ArrayType(t),this.buffer)}};Ur.prototype.offset=0;var _r=class extends Ur{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}},Un=class extends _r{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()}},kn=class extends _r{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 bt=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=ue(t),this._nulls=new Un,e&&e.length>0&&(this._isValid=ld(e))}toVector(){return new J([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((c,d)=>c+d.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:c,_typeIds:d,_offsets:u,_values:m,_nulls:g}=this;(e=d==null?void 0:d.flush(o))?i=u==null?void 0:u.flush(o):(i=u==null?void 0:u.flush(o))?t=m==null?void 0:m.flush(u.last()):t=m==null?void 0:m.flush(o),c>0&&(n=g==null?void 0:g.flush(o));let S=this.children.map(B=>B.flush());return this.clear(),V({type:s,length:o,nullCount:c,children:S,child:S[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}};bt.prototype.length=1;bt.prototype.stride=1;bt.prototype.children=null;bt.prototype.finished=!1;bt.prototype.nullValues=null;bt.prototype._isValid=()=>!0;var Ut=class extends bt{constructor(t){super(t),this._values=new _r(new this.ArrayType(0),this.stride)}setValue(t,e){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}},Xe=class extends bt{constructor(t){super(t),this._pendingLength=0,this._offsets=new kn}setValue(t,e){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=e instanceof Ye?e[ge].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 on=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 Ke=new Int32Array(2),io=new Float32Array(Ke.buffer),so=new Float64Array(Ke.buffer),Nn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var pi;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(pi||(pi={}));var fe=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 Ke[0]=this.readInt32(t),io[0]}readFloat64(t){return Ke[Nn?0:1]=this.readInt32(t),Ke[Nn?1:0]=this.readInt32(t+4),so[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){io[0]=e,this.writeInt32(t,Ke[0])}writeFloat64(t,e){so[0]=e,this.writeInt32(t,Ke[Nn?0:1]),this.writeInt32(t+4,Ke[Nn?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===pi.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 an=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=fe.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=fe.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,c=this.space;t:for(e=0;e<this.vtables.length;e++){let d=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(d)){for(let u=2;u<s;u+=2)if(this.bb.readInt16(c+u)!=this.bb.readInt16(d+u))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 Rt=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 kr;(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"})(kr||(kr={}));var Nr;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(Nr||(Nr={}));var mi;(function(r){r[r.DenseArray=0]="DenseArray"})(mi||(mi={}));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 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 Je=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 Le).__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):mi.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,mi.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var _i=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 yi=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 bi;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(bi||(bi={}));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 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):bi.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,bi.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return r.startDate(t),r.addUnit(t,e),r.endDate(t)}};var qe=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 Cr;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(Cr||(Cr={}));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 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 Vr=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 gi;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(gi||(gi={}));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 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):gi.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,gi.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return r.startFloatingPoint(t),r.addPrecision(t,e),r.endFloatingPoint(t)}};var wi;(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"})(wi||(wi={}));var zr=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):wi.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,wi.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return r.startInterval(t),r.addUnit(t,e),r.endInterval(t)}};var vi=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 Wr=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 Si=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 Ii=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 yr=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):Cr.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,Cr.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 br=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):Cr.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,Cr.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 Ai;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(Ai||(Ai={}));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 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):Ai.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,Ai.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 Bi=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 gt;(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"})(gt||(gt={}));var Wt=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):gt.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 Je).__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 Rt).__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,gt.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 re=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):Nr.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new Wt).__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 Rt).__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,Nr.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 he=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):kr.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new re).__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 on).__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 on).__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 Rt).__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,kr.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 st=class r{constructor(t=[],e,n){this.fields=t||[],this.metadata=e||new Map,n||(n=Ga(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=ao(ao(new Map,this.metadata),e.metadata),s=e.fields.filter(c=>{let d=n.findIndex(u=>u.name===c.name);return~d?(n[d]=c.clone({metadata:ao(ao(new Map,n[d].metadata),c.metadata)}))&&!1:!0}),o=Ga(s,new Map);return new r([...n,...s],i,new Map([...this.dictionaries,...o]))}};st.prototype.fields=null;st.prototype.metadata=null;st.prototype.dictionaries=null;var G=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)}};G.prototype.type=null;G.prototype.name=null;G.prototype.nullable=null;G.prototype.metadata=null;function ao(r,t){return new Map([...r||new Map,...t||new Map])}function Ga(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&&Ga(s.children,t)}return t}var h_=an,p_=fe,gr=class{static decode(t){t=new p_(N(t));let e=he.getRootAsFooter(t),n=st.decode(e.schema());return new Xa(n,e)}static encode(t){let e=new h_,n=st.encode(e,t.schema);he.startRecordBatchesVector(e,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())wr.encode(e,o);let i=e.endVector();he.startDictionariesVector(e,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())wr.encode(e,o);let s=e.endVector();return he.startFooter(e),he.addSchema(e,n),he.addVersion(e,Mt.V4),he.addRecordBatches(e,i),he.addDictionaries(e,s),he.finishFooterBuffer(e,he.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 Xa=class extends gr{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 wr.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return wr.decode(e)}return null}},wr=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 on.createBlock(t,i,n,s)}constructor(t,e,n){this.metaDataLength=t,this.offset=te(n),this.bodyLength=te(e)}};var pt=Object.freeze({done:!0,value:void 0}),Ti=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},cn=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())}},co=class extends cn{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return I(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(pt);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return Lt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Lt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return I(this,void 0,void 0,function*(){return yield this.abort(t),pt})}return(t){return I(this,void 0,void 0,function*(){return yield this.close(),pt})}read(t){return I(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return I(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(pt)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var Ze=class extends co{write(t){if((t=N(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?ii(this.toUint8Array(!0)):this.toUint8Array(!1).then(ii)}toUint8Array(t=!1){return t?ce(this._values)[0]:(()=>I(this,void 0,void 0,function*(){var e,n,i,s;let o=[],c=0;try{for(var d=!0,u=Be(this),m;m=yield u.next(),e=m.done,!e;d=!0){s=m.value,d=!1;let g=s;o.push(g),c+=g.byteLength}}catch(g){n={error:g}}finally{try{!d&&!e&&(i=u.return)&&(yield i.call(u))}finally{if(n)throw n.error}}return ce(o,c)[0]}))()}},Qe=class{constructor(t){t&&(this.source=new Ka(Lt.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)}},ve=class r{constructor(t){t instanceof r?this.source=t.source:t instanceof Ze?this.source=new vr(Lt.fromAsyncIterable(t)):As(t)?this.source=new vr(Lt.fromNodeStream(t)):si(t)?this.source=new vr(Lt.fromDOMStream(t)):Ss(t)?this.source=new vr(Lt.fromDOMStream(t.body)):Fe(t)?this.source=new vr(Lt.fromIterable(t)):Te(t)?this.source=new vr(Lt.fromAsyncIterable(t)):ye(t)&&(this.source=new vr(Lt.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)}},Ka=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)||pt)}return(t){return Object.create(this.source.return&&this.source.return(t)||pt)}},vr=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return I(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return I(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return I(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,e="read"){return I(this,void 0,void 0,function*(){return yield this.source.next({cmd:e,size:t})})}throw(t){return I(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||pt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return I(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||pt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var Fi=class extends Qe{constructor(t,e){super(),this.position=0,this.buffer=N(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}}},jr=class extends ve{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=(()=>I(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return I(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 I(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 I(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,c=0,d=Math.min(n,s+Math.min(n-s,t)),u=new Uint8Array(Math.max(0,(this.position=d)-s));for(;(s+=c)<d&&(o+=c)<u.byteLength;)({bytesRead:c}=yield e.read(u,o,u.byteLength-o,s));return u}return null})}readAt(t,e){return I(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 I(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return I(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return I(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var qa={};Qr(qa,{BaseInt64:()=>xi,Int128:()=>Di,Int64:()=>Sr,Uint64:()=>At});function Ln(r){return r<0&&(r=4294967295+r+1),"0x".concat(r.toString(16))}var Cn=8,Ja=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],xi=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(Ln(this.buffer[1])," ").concat(Ln(this.buffer[0]))}},At=class r extends xi{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=Cn<n-s?Cn:n-s,c=new r(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),d=new r(new Uint32Array([Ja[o],0]));i.times(d),i.plus(c),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)}},Sr=class r extends xi{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 c=Cn<i-o?Cn:i-o,d=new r(new Uint32Array([Number.parseInt(t.slice(o,o+c),10),0])),u=new r(new Uint32Array([Ja[c],0]));s.times(u),s.plus(d),o+=c}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)}},Di=class r{constructor(t){this.buffer=t}high(){return new Sr(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Sr(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 At(new Uint32Array([this.buffer[3],0])),n=new At(new Uint32Array([this.buffer[2],0])),i=new At(new Uint32Array([this.buffer[1],0])),s=new At(new Uint32Array([this.buffer[0],0])),o=new At(new Uint32Array([t.buffer[3],0])),c=new At(new Uint32Array([t.buffer[2],0])),d=new At(new Uint32Array([t.buffer[1],0])),u=new At(new Uint32Array([t.buffer[0],0])),m=At.multiply(s,u);this.buffer[0]=m.low();let g=new At(new Uint32Array([m.high(),0]));return m=At.multiply(i,u),g.plus(m),m=At.multiply(s,d),g.plus(m),this.buffer[1]=g.low(),this.buffer[3]=g.lessThan(m)?1:0,this.buffer[2]=g.high(),new At(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(At.multiply(n,u)).plus(At.multiply(i,d)).plus(At.multiply(s,c)),this.buffer[3]+=At.multiply(e,u).plus(At.multiply(n,d)).plus(At.multiply(i,c)).plus(At.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(Ln(this.buffer[3])," ").concat(Ln(this.buffer[2])," ").concat(Ln(this.buffer[1])," ").concat(Ln(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 c=Cn<i-o?Cn:i-o,d=new r(new Uint32Array([Number.parseInt(t.slice(o,o+c),10),0,0,0])),u=new r(new Uint32Array([Ja[c],0,0,0]));s.times(u),s.plus(d),o+=c}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 Ei=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 G?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return V({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({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 V({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 V({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({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 V({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t){return t.mode===It.Sparse?this.visitSparseUnion(t):this.visitDenseUnion(t)}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({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 V({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 V({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 V({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return V({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 V({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)}},lo=class extends Ei{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):nn(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return $(Uint8Array,$(Int32Array,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return $(Uint8Array,$(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:n}=this;return D.isTimestamp(t)?$(Uint8Array,Sr.convertArray(n[e])):(D.isInt(t)||D.isTime(t))&&t.bitWidth===64?$(Uint8Array,Sr.convertArray(n[e])):D.isDate(t)&&t.unit===Ct.MILLISECOND?$(Uint8Array,Sr.convertArray(n[e])):D.isDecimal(t)?$(Uint8Array,Di.convertArray(n[e])):D.isBinary(t)||D.isFixedSizeBinary(t)?m_(n[e]):D.isBool(t)?nn(n[e]):D.isUtf8(t)?Dr(n[e].join("")):$(Uint8Array,$(t.ArrayType,n[e].map(i=>+i)))}};function m_(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 Pn=class extends Xe{constructor(t){super(t),this._values=new Ur(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,N(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,s=0;for(let[o,c]of t)if(c===void 0)n.set(o,0);else{let d=c.length;i.set(c,s),n.set(o,d),s+=d}}};var uo=class extends bt{constructor(t){super(t),this._values=new Un}setValue(t,e){this._values.set(t,+e)}};var ln=class extends Ut{};ln.prototype._setValue=Oa;var Oi=class extends ln{};Oi.prototype._setValue=Ls;var Ri=class extends ln{};Ri.prototype._setValue=Cs;var Mi=class extends Ut{};Mi.prototype._setValue=Ua;var fo=class extends bt{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new le(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=un({type:this.type.indices,nullValues:e}),this.dictionary=un({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 Ui=class extends Ut{};Ui.prototype._setValue=Ea;var ho=class extends bt{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 Me(this.type.listSize,new G(e,t.type,!0)),n}};var dn=class extends Ut{setValue(t,e){this._values.set(t,e)}},po=class extends dn{setValue(t,e){super.setValue(t,li(e))}},mo=class extends dn{},_o=class extends dn{};var fn=class extends Ut{};fn.prototype._setValue=ka;var ki=class extends fn{};ki.prototype._setValue=Gs;var Ni=class extends fn{};Ni.prototype._setValue=Xs;var Se=class extends Ut{setValue(t,e){this._values.set(t,e)}},yo=class extends Se{},bo=class extends Se{},go=class extends Se{},wo=class extends Se{},vo=class extends Se{},So=class extends Se{},Io=class extends Se{},Ao=class extends Se{};var Bo=class extends Xe{constructor(t){super(t),this._offsets=new kn}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 Oe(new G(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,c=o.length,d=e.set(i,c).buffer[i];for(let u=-1;++u<c;)n.set(d+u,o[u])}}};var To=class extends Xe{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 Ue(new G(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]:c}=e.set(i,s.size).buffer;for(let d of s.entries())if(n.set(o,d),++o>=c)break}}};var Fo=class extends bt{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var xo=class extends bt{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 ht([...this.type.children,new G(e,t.type,!0)]),n}};var Ir=class extends Ut{};Ir.prototype._setValue=Ra;var Li=class extends Ir{};Li.prototype._setValue=Ps;var Ci=class extends Ir{};Ci.prototype._setValue=Vs;var Pi=class extends Ir{};Pi.prototype._setValue=Hs;var Vi=class extends Ir{};Vi.prototype._setValue=zs;var Ar=class extends Ut{};Ar.prototype._setValue=Ma;var Hi=class extends Ar{};Hi.prototype._setValue=Ws;var zi=class extends Ar{};zi.prototype._setValue=js;var Wi=class extends Ar{};Wi.prototype._setValue=$s;var ji=class extends Ar{};ji.prototype._setValue=Ys;var Vn=class extends bt{constructor(t){super(t),this._typeIds=new _r(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,c=[...i,new G(e,t.type)];return this.type=new Re(s,[...o,n],c),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.")}},Do=class extends Vn{},Eo=class extends Vn{constructor(t){super(t),this._offsets=new _r(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 $i=class extends Xe{constructor(t){super(t),this._values=new Ur(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,Dr(e))}_flushPending(t,e){}};$i.prototype._flushPending=Pn.prototype._flushPending;var Za=class extends E{visitNull(){return Fo}visitBool(){return uo}visitInt(){return Se}visitInt8(){return yo}visitInt16(){return bo}visitInt32(){return go}visitInt64(){return wo}visitUint8(){return vo}visitUint16(){return So}visitUint32(){return Io}visitUint64(){return Ao}visitFloat(){return dn}visitFloat16(){return po}visitFloat32(){return mo}visitFloat64(){return _o}visitUtf8(){return $i}visitBinary(){return Pn}visitFixedSizeBinary(){return Ui}visitDate(){return ln}visitDateDay(){return Oi}visitDateMillisecond(){return Ri}visitTimestamp(){return Ir}visitTimestampSecond(){return Li}visitTimestampMillisecond(){return Ci}visitTimestampMicrosecond(){return Pi}visitTimestampNanosecond(){return Vi}visitTime(){return Ar}visitTimeSecond(){return Hi}visitTimeMillisecond(){return zi}visitTimeMicrosecond(){return Wi}visitTimeNanosecond(){return ji}visitDecimal(){return Mi}visitList(){return Bo}visitStruct(){return xo}visitUnion(){return Vn}visitDenseUnion(){return Eo}visitSparseUnion(){return Do}visitDictionary(){return fo}visitInterval(){return fn}visitIntervalDayTime(){return ki}visitIntervalYearMonth(){return Ni}visitFixedSizeList(){return ho}visitMap(){return To}},ud=new Za;var k=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 ne(r,t){return t instanceof r.constructor}function Yi(r,t){return r===t||ne(r,t)}function Br(r,t){return r===t||ne(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function Oo(r,t){return r===t||ne(r,t)&&r.precision===t.precision}function __(r,t){return r===t||ne(r,t)&&r.byteWidth===t.byteWidth}function Qa(r,t){return r===t||ne(r,t)&&r.unit===t.unit}function Gi(r,t){return r===t||ne(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function Xi(r,t){return r===t||ne(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function y_(r,t){return r===t||ne(r,t)&&r.children.length===t.children.length&&tr.compareManyFields(r.children,t.children)}function b_(r,t){return r===t||ne(r,t)&&r.children.length===t.children.length&&tr.compareManyFields(r.children,t.children)}function tc(r,t){return r===t||ne(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&tr.compareManyFields(r.children,t.children)}function g_(r,t){return r===t||ne(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&tr.visit(r.indices,t.indices)&&tr.visit(r.dictionary,t.dictionary)}function ec(r,t){return r===t||ne(r,t)&&r.unit===t.unit}function w_(r,t){return r===t||ne(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&tr.compareManyFields(r.children,t.children)}function v_(r,t){return r===t||ne(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&tr.compareManyFields(r.children,t.children)}k.prototype.visitNull=Yi;k.prototype.visitBool=Yi;k.prototype.visitInt=Br;k.prototype.visitInt8=Br;k.prototype.visitInt16=Br;k.prototype.visitInt32=Br;k.prototype.visitInt64=Br;k.prototype.visitUint8=Br;k.prototype.visitUint16=Br;k.prototype.visitUint32=Br;k.prototype.visitUint64=Br;k.prototype.visitFloat=Oo;k.prototype.visitFloat16=Oo;k.prototype.visitFloat32=Oo;k.prototype.visitFloat64=Oo;k.prototype.visitUtf8=Yi;k.prototype.visitBinary=Yi;k.prototype.visitFixedSizeBinary=__;k.prototype.visitDate=Qa;k.prototype.visitDateDay=Qa;k.prototype.visitDateMillisecond=Qa;k.prototype.visitTimestamp=Gi;k.prototype.visitTimestampSecond=Gi;k.prototype.visitTimestampMillisecond=Gi;k.prototype.visitTimestampMicrosecond=Gi;k.prototype.visitTimestampNanosecond=Gi;k.prototype.visitTime=Xi;k.prototype.visitTimeSecond=Xi;k.prototype.visitTimeMillisecond=Xi;k.prototype.visitTimeMicrosecond=Xi;k.prototype.visitTimeNanosecond=Xi;k.prototype.visitDecimal=Yi;k.prototype.visitList=y_;k.prototype.visitStruct=b_;k.prototype.visitUnion=tc;k.prototype.visitDenseUnion=tc;k.prototype.visitSparseUnion=tc;k.prototype.visitDictionary=g_;k.prototype.visitInterval=ec;k.prototype.visitIntervalDayTime=ec;k.prototype.visitIntervalYearMonth=ec;k.prototype.visitFixedSizeList=w_;k.prototype.visitMap=v_;var tr=new k;function hn(r,t){return tr.compareSchemas(r,t)}function dd(r,t){return tr.compareFields(r,t)}function fd(r,t){return tr.visit(r,t)}function un(r){let t=r.type,e=new(ud.getVisitFn(t)())(r);if(t.children&&t.children.length>0){let n=r.children||[],i={nullValues:r.nullValues},s=Array.isArray(n)?(o,c)=>n[c]||i:({name:o})=>n[o]||i;for(let[o,c]of t.children.entries()){let{type:d}=c,u=s(c,o);e.children.push(un(Object.assign(Object.assign({},u),{type:d})))}}return e}function Ro(r,t){return S_(r,t.map(e=>e.data.concat()))}function S_(r,t){let e=[...r.fields],n=[],i={numBatches:t.reduce((g,S)=>Math.max(g,S.length),0)},s=0,o=0,c=-1,d=t.length,u,m=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,c=-1;++c<d;)m[c]=u=t[c].shift(),o=Math.min(o,u?u.length:o);Number.isFinite(o)&&(m=I_(e,o,m,t,i),o>0&&(n[s++]=V({type:new ht(e),length:o,nullCount:0,children:m.slice()})))}return[r=r.assign(e),n.map(g=>new Tt(r,g))]}function I_(r,t,e,n,i){var s;let o=(t+63&-64)>>3;for(let c=-1,d=n.length;++c<d;){let u=e[c],m=u==null?void 0:u.length;if(m>=t)m===t?e[c]=u:(e[c]=u.slice(0,t),i.numBatches=Math.max(i.numBatches,n[c].unshift(u.slice(t,m-t))));else{let g=r[c];r[c]=g.clone({nullable:!0}),e[c]=(s=u==null?void 0:u._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:V({type:g.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var hd,Kt=class r{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new st([]),this._offsets=[0],this;let i,s;t[0]instanceof st&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());let o=d=>{if(d){if(d instanceof Tt)return[d];if(d instanceof r)return d.batches;if(d instanceof ut){if(d.type instanceof ht)return[new Tt(new st(d.type.children),d)]}else{if(Array.isArray(d))return d.flatMap(u=>o(u));if(typeof d[Symbol.iterator]=="function")return[...d].flatMap(u=>o(u));if(typeof d=="object"){let u=Object.keys(d),m=u.map(B=>new J([d[B]])),g=new st(u.map((B,Q)=>new G(String(B),m[Q].type))),[,S]=Ro(g,m);return S.length===0?[new Tt(d)]:S}}}return[]},c=t.flatMap(d=>o(d));if(i=(n=i!=null?i:(e=c[0])===null||e===void 0?void 0:e.schema)!==null&&n!==void 0?n:new st([]),!(i instanceof st))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let d of c){if(!(d instanceof Tt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!hn(i,d.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=c,this._offsets=s!=null?s:Qs(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=Zs(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?Mn.visit(new J(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 Tt(e,i)))}slice(t,e){let n=this.schema;[t,e]=ui({length:this.numRows},t,e);let i=to(this.data,this._offsets,t,e);return new r(n,i.map(s=>new Tt(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=V({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new J(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 J([V({type:new Xt,length:this.numRows})]));let s=n.fields.slice(),o=s[t].clone({type:e.type}),c=this.schema.fields.map((d,u)=>this.getChildAt(u));[s[t],c[t]]=[o,e],[n,i]=Ro(n,c)}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((c,d,u)=>{let[m,g]=c,S=e.findIndex(B=>B.name===d.name);return~S?g[S]=u:m.push(u),c},[[],[]]),s=this.schema.assign(t.schema),o=[...e.map((c,d)=>[d,i[d]]).map(([c,d])=>d===void 0?this.getChildAt(c):t.getChildAt(d)),...n.map(c=>t.getChildAt(c))].filter(Boolean);return new r(...Ro(s,o))}};hd=Symbol.toStringTag;Kt[hd]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=Mr(hi),r.get=Mr(Dt.getVisitFn(p.Struct)),r.set=eo(Pt.getVisitFn(p.Struct)),r.indexOf=ro(sn.getVisitFn(p.Struct)),r.getByteLength=Mr(de.getVisitFn(p.Struct)),"Table"))(Kt.prototype);var md,Tt=class r{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof st))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=V({nullCount:0,type:new ht(this.schema.fields),children:this.schema.fields.map(e=>V({type:e.type,nullCount:0}))})]=t,!(this.data instanceof ut))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=pd(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:n,children:i,length:s}=Object.keys(e).reduce((d,u,m)=>(d.children[m]=e[u],d.length=Math.max(d.length,e[u].length),d.fields[m]=G.new({name:u,type:e[u].type,nullable:!0}),d),{length:0,fields:new Array,children:new Array}),o=new st(n),c=V({type:new ht(n),length:s,children:i,nullCount:0});[this.schema,this.data]=pd(o,c.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=_d(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 Dt.visit(this.data,t)}set(t,e){return Pt.visit(this.data,t,e)}indexOf(t,e){return sn.visit(this.data,t,e)}getByteLength(t){return de.visit(this.data,t)}[Symbol.iterator](){return Mn.visit(new J([this.data]))}toArray(){return[...this]}concat(...t){return new Kt(this.schema,[this,...t])}slice(t,e){let[n]=new J([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 J([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 J([V({type:new Xt,length:this.numRows})]));let s=n.fields.slice(),o=i.children.slice(),c=s[t].clone({type:e.type});[s[t],o[t]]=[c,e.data[0]],n=new st(s,new Map(this.schema.metadata)),i=V({type:new ht(s),children:o})}return new r(n,i)}select(t){let e=this.schema.select(t),n=new ht(e.fields),i=[];for(let s of t){let o=this.schema.fields.findIndex(c=>c.name===s);~o&&(i[o]=this.data.children[o])}return new r(e,V({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=V({type:new ht(e.fields),length:this.numRows,children:n});return new r(e,i)}};md=Symbol.toStringTag;Tt[md]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Tt.prototype);function pd(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[c,d]of r.fields.entries()){let u=t[c];(!u||u.length!==e)&&(i[c]=d.clone({nullable:!0}),s[c]=(n=u==null?void 0:u._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:V({type:d.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(i),V({type:new ht(i),length:e,children:s})]}function _d(r,t,e=new Map){for(let n=-1,i=r.length;++n<i;){let o=r[n].type,c=t[n];if(D.isDictionary(o)){if(!e.has(o.id))c.dictionary&&e.set(o.id,c.dictionary);else if(e.get(o.id)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&_d(o.children,c.children,e)}return e}var pn=class extends Tt{constructor(t){let e=t.fields.map(i=>V({type:i.type})),n=V({type:new ht(t.fields),nullCount:0,children:e});super(t,n)}};var Ki;(function(r){r[r.BUFFER=0]="BUFFER"})(Ki||(Ki={}));var Ji;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(Ji||(Ji={}));var Mo=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):Ji.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Ki.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,Ji.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,Ki.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 Hn=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 zn=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 pe=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 zn).__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 Hn).__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 Mo).__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 Tr=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 pe).__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 Wn;(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"})(Wn||(Wn={}));var Pe=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):kr.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Wn.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 Rt).__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,kr.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,Wn.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 rc=class extends E{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return Si.startNull(e),Si.endNull(e)}visitInt(t,e){return Le.startInt(e),Le.addBitWidth(e,t.bitWidth),Le.addIsSigned(e,t.isSigned),Le.endInt(e)}visitFloat(t,e){return Hr.startFloatingPoint(e),Hr.addPrecision(e,t.precision),Hr.endFloatingPoint(e)}visitBinary(t,e){return _i.startBinary(e),_i.endBinary(e)}visitBool(t,e){return yi.startBool(e),yi.endBool(e)}visitUtf8(t,e){return Bi.startUtf8(e),Bi.endUtf8(e)}visitDecimal(t,e){return qe.startDecimal(e),qe.addScale(e,t.scale),qe.addPrecision(e,t.precision),qe.addBitWidth(e,t.bitWidth),qe.endDecimal(e)}visitDate(t,e){return Lr.startDate(e),Lr.addUnit(e,t.unit),Lr.endDate(e)}visitTime(t,e){return yr.startTime(e),yr.addUnit(e,t.unit),yr.addBitWidth(e,t.bitWidth),yr.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return br.startTimestamp(e),br.addUnit(e,t.unit),n!==void 0&&br.addTimezone(e,n),br.endTimestamp(e)}visitInterval(t,e){return zr.startInterval(e),zr.addUnit(e,t.unit),zr.endInterval(e)}visitList(t,e){return vi.startList(e),vi.endList(e)}visitStruct(t,e){return Ii.startStruct_(e),Ii.endStruct_(e)}visitUnion(t,e){Ce.startTypeIdsVector(e,t.typeIds.length);let n=Ce.createTypeIdsVector(e,t.typeIds);return Ce.startUnion(e),Ce.addMode(e,t.mode),Ce.addTypeIds(e,n),Ce.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return Je.startDictionaryEncoding(e),Je.addId(e,BigInt(t.id)),Je.addIsOrdered(e,t.isOrdered),n!==void 0&&Je.addIndexType(e,n),Je.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return Pr.startFixedSizeBinary(e),Pr.addByteWidth(e,t.byteWidth),Pr.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Vr.startFixedSizeList(e),Vr.addListSize(e,t.listSize),Vr.endFixedSizeList(e)}visitMap(t,e){return Wr.startMap(e),Wr.addKeysSorted(e,t.keysSorted),Wr.endMap(e)}},Uo=new rc;function wd(r,t=new Map){return new st(B_(r,t),ko(r.customMetadata),t)}function nc(r){return new Vt(r.count,Sd(r.columns),Id(r.columns))}function vd(r){return new se(nc(r.data),r.id,r.isDelta)}function B_(r,t){return(r.fields||[]).filter(Boolean).map(e=>G.fromJSON(e,t))}function yd(r,t){return(r.children||[]).filter(Boolean).map(e=>G.fromJSON(e,t))}function Sd(r){return(r||[]).reduce((t,e)=>[...t,new Ve(e.count,T_(e.VALIDITY)),...Sd(e.children)],[])}function Id(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new ie(t.length,i.VALIDITY.length)),i.TYPE&&t.push(new ie(t.length,i.TYPE.length)),i.OFFSET&&t.push(new ie(t.length,i.OFFSET.length)),i.DATA&&t.push(new ie(t.length,i.DATA.length)),t=Id(i.children,t)}return t}function T_(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function Ad(r,t){let e,n,i,s,o,c;return!t||!(s=r.dictionary)?(o=gd(r,yd(r,t)),i=new G(r.name,o,r.nullable,ko(r.customMetadata))):t.has(e=s.id)?(n=(n=s.indexType)?bd(n):new $e,c=new le(t.get(e),n,e,s.isOrdered),i=new G(r.name,c,r.nullable,ko(r.customMetadata))):(n=(n=s.indexType)?bd(n):new $e,t.set(e,o=gd(r,yd(r,t))),c=new le(o,n,e,s.isOrdered),i=new G(r.name,c,r.nullable,ko(r.customMetadata))),i||null}function ko(r){return new Map(Object.entries(r||{}))}function bd(r){return new Ft(r.isSigned,r.bitWidth)}function gd(r,t){let e=r.type.name;switch(e){case"NONE":return new Xt;case"null":return new Xt;case"binary":return new ar;case"utf8":return new cr;case"bool":return new lr;case"list":return new Oe((t||[])[0]);case"struct":return new ht(t||[]);case"struct_":return new ht(t||[])}switch(e){case"int":{let n=r.type;return new Ft(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new ee(yt[n.precision])}case"decimal":{let n=r.type;return new ur(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new dr(Ct[n.unit])}case"time":{let n=r.type;return new Ee(X[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new fr(X[n.unit],n.timezone)}case"interval":{let n=r.type;return new hr(Gt[n.unit])}case"union":{let n=r.type;return new Re(It[n.mode],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new pr(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Me(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new Ue((t||[])[0],n.keysSorted)}}throw new Error('Unrecognized type: "'.concat(e,'"'))}var F_=an,x_=fe,oe=class r{static fromJSON(t,e){let n=new r(0,Mt.V4,e);return n._createHeader=D_(t,e),n}static decode(t){t=new x_(N(t));let e=Pe.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),s=e.headerType(),o=new r(n,i,s);return o._createHeader=E_(e,s),o}static encode(t){let e=new F_,n=-1;return t.isSchema()?n=st.encode(e,t.header()):t.isRecordBatch()?n=Vt.encode(e,t.header()):t.isDictionaryBatch()&&(n=se.encode(e,t.header())),Pe.startMessage(e),Pe.addVersion(e,Mt.V4),Pe.addHeader(e,n),Pe.addHeaderType(e,t.headerType),Pe.addBodyLength(e,BigInt(t.bodyLength)),Pe.finishMessageBuffer(e,Pe.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof st)return new r(0,Mt.V4,et.Schema,t);if(t instanceof Vt)return new r(e,Mt.V4,et.RecordBatch,t);if(t instanceof se)return new r(e,Mt.V4,et.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===et.Schema}isRecordBatch(){return this.headerType===et.RecordBatch}isDictionaryBatch(){return this.headerType===et.DictionaryBatch}constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=te(t)}},Vt=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=te(t)}},se=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=te(e)}},ie=class{constructor(t,e){this.offset=te(t),this.length=te(e)}},Ve=class{constructor(t,e){this.length=te(t),this.nullCount=te(e)}};function D_(r,t){return()=>{switch(t){case et.Schema:return st.fromJSON(r);case et.RecordBatch:return Vt.fromJSON(r);case et.DictionaryBatch:return se.fromJSON(r)}throw new Error("Unrecognized Message type: { name: ".concat(et[t],", type: ").concat(t," }"))}}function E_(r,t){return()=>{switch(t){case et.Schema:return st.decode(r.header(new re));case et.RecordBatch:return Vt.decode(r.header(new pe),r.version());case et.DictionaryBatch:return se.decode(r.header(new Tr),r.version())}throw new Error("Unrecognized Message type: { name: ".concat(et[t],", type: ").concat(t," }"))}}G.encode=H_;G.decode=P_;G.fromJSON=Ad;st.encode=V_;st.decode=O_;st.fromJSON=wd;Vt.encode=z_;Vt.decode=R_;Vt.fromJSON=nc;se.encode=W_;se.decode=M_;se.fromJSON=vd;Ve.encode=j_;Ve.decode=k_;ie.encode=$_;ie.decode=U_;function O_(r,t=new Map){let e=C_(r,t);return new st(e,No(r),t)}function R_(r,t=Mt.V4){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new Vt(r.length(),N_(r),L_(r,t))}function M_(r,t=Mt.V4){return new se(Vt.decode(r.data(),t),r.id(),r.isDelta())}function U_(r){return new ie(r.offset(),r.length())}function k_(r){return new Ve(r.length(),r.nullCount())}function N_(r){let t=[];for(let e,n=-1,i=-1,s=r.nodesLength();++n<s;)(e=r.nodes(n))&&(t[++i]=Ve.decode(e));return t}function L_(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]=ie.decode(n));return e}function C_(r,t){let e=[];for(let n,i=-1,s=-1,o=r.fieldsLength();++i<o;)(n=r.fields(i))&&(e[++s]=G.decode(n,t));return e}function Bd(r,t){let e=[];for(let n,i=-1,s=-1,o=r.childrenLength();++i<o;)(n=r.children(i))&&(e[++s]=G.decode(n,t));return e}function P_(r,t){let e,n,i,s,o,c;return!t||!(c=r.dictionary())?(i=Fd(r,Bd(r,t)),n=new G(r.name(),i,r.nullable(),No(r))):t.has(e=te(c.id()))?(s=(s=c.indexType())?Td(s):new $e,o=new le(t.get(e),s,e,c.isOrdered()),n=new G(r.name(),o,r.nullable(),No(r))):(s=(s=c.indexType())?Td(s):new $e,t.set(e,i=Fd(r,Bd(r,t))),o=new le(i,s,e,c.isOrdered()),n=new G(r.name(),o,r.nullable(),No(r))),n||null}function No(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 Td(r){return new Ft(r.isSigned(),r.bitWidth())}function Fd(r,t){let e=r.typeType();switch(e){case gt.NONE:return new Xt;case gt.Null:return new Xt;case gt.Binary:return new ar;case gt.Utf8:return new cr;case gt.Bool:return new lr;case gt.List:return new Oe((t||[])[0]);case gt.Struct_:return new ht(t||[])}switch(e){case gt.Int:{let n=r.type(new Le);return new Ft(n.isSigned(),n.bitWidth())}case gt.FloatingPoint:{let n=r.type(new Hr);return new ee(n.precision())}case gt.Decimal:{let n=r.type(new qe);return new ur(n.scale(),n.precision(),n.bitWidth())}case gt.Date:{let n=r.type(new Lr);return new dr(n.unit())}case gt.Time:{let n=r.type(new yr);return new Ee(n.unit(),n.bitWidth())}case gt.Timestamp:{let n=r.type(new br);return new fr(n.unit(),n.timezone())}case gt.Interval:{let n=r.type(new zr);return new hr(n.unit())}case gt.Union:{let n=r.type(new Ce);return new Re(n.mode(),n.typeIdsArray()||[],t||[])}case gt.FixedSizeBinary:{let n=r.type(new Pr);return new pr(n.byteWidth())}case gt.FixedSizeList:{let n=r.type(new Vr);return new Me(n.listSize(),(t||[])[0])}case gt.Map:{let n=r.type(new Wr);return new Ue((t||[])[0],n.keysSorted())}}throw new Error('Unrecognized type: "'.concat(gt[e],'" (').concat(e,")"))}function V_(r,t){let e=t.fields.map(s=>G.encode(r,s));re.startFieldsVector(r,e.length);let n=re.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?re.createCustomMetadataVector(r,[...t.metadata].map(([s,o])=>{let c=r.createString("".concat(s)),d=r.createString("".concat(o));return Rt.startKeyValue(r),Rt.addKey(r,c),Rt.addValue(r,d),Rt.endKeyValue(r)})):-1;return re.startSchema(r),re.addFields(r,n),re.addEndianness(r,Y_?Nr.Little:Nr.Big),i!==-1&&re.addCustomMetadata(r,i),re.endSchema(r)}function H_(r,t){let e=-1,n=-1,i=-1,s=t.type,o=t.typeId;D.isDictionary(s)?(o=s.dictionary.typeId,i=Uo.visit(s,r),n=Uo.visit(s.dictionary,r)):n=Uo.visit(s,r);let c=(s.children||[]).map(m=>G.encode(r,m)),d=Wt.createChildrenVector(r,c),u=t.metadata&&t.metadata.size>0?Wt.createCustomMetadataVector(r,[...t.metadata].map(([m,g])=>{let S=r.createString("".concat(m)),B=r.createString("".concat(g));return Rt.startKeyValue(r),Rt.addKey(r,S),Rt.addValue(r,B),Rt.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),Wt.startField(r),Wt.addType(r,n),Wt.addTypeType(r,o),Wt.addChildren(r,d),Wt.addNullable(r,!!t.nullable),e!==-1&&Wt.addName(r,e),i!==-1&&Wt.addDictionary(r,i),u!==-1&&Wt.addCustomMetadata(r,u),Wt.endField(r)}function z_(r,t){let e=t.nodes||[],n=t.buffers||[];pe.startNodesVector(r,e.length);for(let o of e.slice().reverse())Ve.encode(r,o);let i=r.endVector();pe.startBuffersVector(r,n.length);for(let o of n.slice().reverse())ie.encode(r,o);let s=r.endVector();return pe.startRecordBatch(r),pe.addLength(r,BigInt(t.length)),pe.addNodes(r,i),pe.addBuffers(r,s),pe.endRecordBatch(r)}function W_(r,t){let e=Vt.encode(r,t.data);return Tr.startDictionaryBatch(r),Tr.addId(r,BigInt(t.id)),Tr.addIsDelta(r,t.isDelta),Tr.addData(r,e),Tr.endDictionaryBatch(r)}function j_(r,t){return zn.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function $_(r,t){return Hn.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var Y_=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var sc=r=>"Expected ".concat(et[r]," Message in stream, but was null or length 0."),oc=r=>"Header pointer of flatbuffer-encoded ".concat(et[r]," Message is null or length 0."),xd=(r,t)=>"Expected to read ".concat(r," metadata bytes, but only read ").concat(t,"."),Dd=(r,t)=>"Expected to read ".concat(r," bytes for message body, but only read ").concat(t,"."),jn=class{constructor(t){this.source=t instanceof Qe?t:new Qe(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?pt:t.value===-1&&(t=this.readMetadataLength()).done?pt:(t=this.readMetadata(t.value)).done?pt: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(sc(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=N(this.source.read(t));if(e.byteLength<t)throw new Error(Dd(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=et.Schema,n=this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(oc(e));return i}readMetadataLength(){let t=this.source.read(Lo),e=t&&new fe(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 pt;if(e.byteLength<t)throw new Error(xd(t,e.byteLength));return{done:!1,value:oe.decode(e)}}},qi=class{constructor(t,e){this.source=t instanceof ve?t:vs(t)?new jr(t,e):new ve(t)}[Symbol.asyncIterator](){return this}next(){return I(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?pt:t.value===-1&&(t=yield this.readMetadataLength()).done?pt:(t=yield this.readMetadata(t.value)).done?pt:t})}throw(t){return I(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return I(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return I(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(sc(t));return e.value})}readMessageBody(t){return I(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=N(yield this.source.read(t));if(e.byteLength<t)throw new Error(Dd(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(t=!1){return I(this,void 0,void 0,function*(){let e=et.Schema,n=yield this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(oc(e));return i})}readMetadataLength(){return I(this,void 0,void 0,function*(){let t=yield this.source.read(Lo),e=t&&new fe(t),n=(e==null?void 0:e.readInt32(0))||0;return{done:n===0,value:n}})}readMetadata(t){return I(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return pt;if(e.byteLength<t)throw new Error(xd(t,e.byteLength));return{done:!1,value:oe.decode(e)}})}},Zi=class extends jn{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Ti?t:new Ti(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:oe.fromJSON(t.schema,et.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:oe.fromJSON(e,et.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:oe.fromJSON(e,et.RecordBatch)}}return this._body=[],pt}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(sc(t));return e.value}readSchema(){let t=et.Schema,e=this.readMessage(t),n=e==null?void 0:e.header();if(!e||!n)throw new Error(oc(t));return n}},Lo=4,ic="ARROW1",$n=new Uint8Array(ic.length);for(let r=0;r<ic.length;r+=1)$n[r]=ic.codePointAt(r);function Co(r,t=0){for(let e=-1,n=$n.length;++e<n;)if($n[e]!==r[t+e])return!1;return!0}var Yn=$n.length,ac=Yn+Lo,Ed=Yn*2+Lo;var Ht=class r extends cn{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 Te(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 Lt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Lt.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:gs(t)?X_(t):vs(t)?q_(t):Te(t)?(()=>I(this,void 0,void 0,function*(){return yield r.from(yield t)}))():Ss(t)||si(t)||As(t)||ye(t)?J_(new ve(t)):K_(new Qe(t))}static readAll(t){return t instanceof r?t.isSync()?Od(t):Rd(t):gs(t)||ArrayBuffer.isView(t)||Fe(t)||ws(t)?Od(t):Rd(t)}},er=class extends Ht{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return ae(this,arguments,function*(){yield P(yield*tn(In(Be(this[Symbol.iterator]()))))})}},$r=class extends Ht{constructor(t){super(t),this._impl=t}readAll(){var t,e,n,i;return I(this,void 0,void 0,function*(){let s=new Array;try{for(var o=!0,c=Be(this),d;d=yield c.next(),t=d.done,!t;o=!0){i=d.value,o=!1;let u=i;s.push(u)}}catch(u){e={error:u}}finally{try{!o&&!t&&(n=c.return)&&(yield n.call(c))}finally{if(e)throw e.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Yr=class extends er{constructor(t){super(t),this._impl=t}},Qi=class extends $r{constructor(t){super(t),this._impl=t}},Po=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=V({type:new ht(this.schema.fields),length:t.length,children:n});return new Tt(this.schema,i)}_loadDictionaryBatch(t,e){let{id:n,isDelta:i}=t,{dictionaries:s,schema:o}=this,c=s.get(n);if(i||!c){let d=o.dictionaries.get(n),u=this._loadVectors(t.data,e,[d]);return(c&&i?c.concat(new J(u)):new J(u)).memoize()}return c.memoize()}_loadVectors(t,e,n){return new Ei(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}},Gn=class extends Po{constructor(t,e){super(e),this._reader=gs(t)?new Zi(this._handle=t):new jn(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=Md(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):pt}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):pt}next(){if(this.closed)return pt;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 pn(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Xn=class extends Po{constructor(t,e){super(e),this._reader=new qi(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return I(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 I(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Md(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return I(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):pt})}return(t){return I(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):pt})}next(){return I(this,void 0,void 0,function*(){if(this.closed)return pt;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 pn(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return I(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Vo=class extends Gn{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 Fi?t:new Fi(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(et.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(et.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){let s=i.header(),o=this._reader.readMessageBody(i.bodyLength),c=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,c)}}}_readFooter(){let{_handle:t}=this,e=t.size-ac,n=t.readInt32(e),i=t.readAt(e-n,n);return gr.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}},cc=class extends Xn{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 jr?t:new jr(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return I(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 I(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(et.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 I(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(et.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){let s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength),c=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,c)}}})}_readFooter(){return I(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-ac,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return gr.decode(i)})}_readNextMessageAndValidate(t){return I(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})}},lc=class extends Gn{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new lo(e,t.nodes,t.buffers,this.dictionaries).visitMany(n)}};function Md(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*Od(r){let t=Ht.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Rd(r){return ae(this,arguments,function*(){let e=yield P(Ht.from(r));try{if(!(yield P(e.open({autoDestroy:!1}))).closed)do yield yield P(e);while(!(yield P(e.reset().open())).closed)}finally{yield P(e.cancel())}})}function X_(r){return new er(new lc(r))}function K_(r){let t=r.peek(Yn+7&-8);return t&&t.byteLength>=4?Co(t)?new Yr(new Vo(r.read())):new er(new Gn(r)):new er(new Gn(function*(){}()))}function J_(r){return I(this,void 0,void 0,function*(){let t=yield r.peek(Yn+7&-8);return t&&t.byteLength>=4?Co(t)?new Yr(new Vo(yield r.read())):new $r(new Xn(r)):new $r(new Xn(function(){return ae(this,arguments,function*(){})}()))})}function q_(r){return I(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new jr(r,t);return t>=Ed&&Co(yield e.readAt(0,Yn+7&-8))?new Qi(new cc(e)):new $r(new Xn(e))})}var xt=class r extends E{static assemble(...t){let e=i=>i.flatMap(s=>Array.isArray(s)?e(s):s instanceof Tt?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 J)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)||He.call(this,i<=0?new Uint8Array(0):Rn(t.offset,n,t.nullBitmap)),this.nodes.push(new Ve(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 He(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new ie(this._byteLength,t)),this._byteLength+=t,this}function Z_(r){let{type:t,length:e,typeIds:n,valueOffsets:i}=r;if(He.call(this,n),t.mode===It.Sparse)return uc.call(this,r);if(t.mode===It.Dense){if(r.offset<=0)return He.call(this,i),uc.call(this,r);{let s=n.reduce((m,g)=>Math.max(m,g),n[0]),o=new Int32Array(s+1),c=new Int32Array(s+1).fill(-1),d=new Int32Array(e),u=oi(-i[0],e,i);for(let m,g,S=-1;++S<e;)(g=c[m=n[S]])===-1&&(g=c[m]=u[m]),d[S]=u[S]-g,++o[m];He.call(this,d);for(let m,g=-1,S=t.children.length;++g<S;)if(m=r.children[g]){let B=t.typeIds[g],Q=Math.min(e,o[B]);this.visit(m.slice(c[B],Q))}}}return this}function Q_(r){let t;return r.nullCount>=r.length?He.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?He.call(this,Rn(r.offset,r.length,t)):He.call(this,nn(r.values))}function Gr(r){return He.call(this,r.values.subarray(0,r.length*r.stride))}function Ud(r){let{length:t,values:e,valueOffsets:n}=r,i=n[0],s=n[t],o=Math.min(s-i,e.byteLength-i);return He.call(this,oi(-n[0],t,n)),He.call(this,e.subarray(i,i+o)),this}function dc(r){let{length:t,valueOffsets:e}=r;return e&&He.call(this,oi(e[0],t,e)),this.visit(r.children[0])}function uc(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}xt.prototype.visitBool=Q_;xt.prototype.visitInt=Gr;xt.prototype.visitFloat=Gr;xt.prototype.visitUtf8=Ud;xt.prototype.visitBinary=Ud;xt.prototype.visitFixedSizeBinary=Gr;xt.prototype.visitDate=Gr;xt.prototype.visitTimestamp=Gr;xt.prototype.visitTime=Gr;xt.prototype.visitDecimal=Gr;xt.prototype.visitList=dc;xt.prototype.visitStruct=uc;xt.prototype.visitUnion=Z_;xt.prototype.visitInterval=Gr;xt.prototype.visitFixedSizeList=dc;xt.prototype.visitMap=dc;var mn=class extends cn{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 Ze,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Yt(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 Te(t)?t.then(e=>this.writeAll(e)):ye(t)?hc(this,t):fc(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 Ze?this._sink=t:(this._sink=new Ze,t&&iu(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&su(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||!hn(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 Kt&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof Tt&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!hn(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof Tt?t instanceof pn||this._writeRecordBatch(t):t instanceof Kt?this.writeAll(t.batches):Fe(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=oe.encode(t),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,c=s+o+n&~n,d=c-s-o;return t.headerType===et.RecordBatch?this._recordBatchBlocks.push(new wr(c,t.bodyLength,this._position)):t.headerType===et.DictionaryBatch&&this._dictionaryBlocks.push(new wr(c,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(c-o)),s>0&&this._write(i),this._writePadding(d)}_write(t){if(this._started){let e=N(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(oe.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write($n)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:s}=xt.assemble(t),o=new Vt(t.numRows,n,i),c=oe.from(o,e);return this._writeDictionaries(t)._writeMessage(c)._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:c}=xt.assemble(new J([t])),d=new Vt(t.length,s,o),u=new se(d,e,n),m=oe.from(u,i);return this._writeMessage(m)._writeBodyBuffers(c)}_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}},_n=class r extends mn{static writeAll(t,e){let n=new r(e);return Te(t)?t.then(i=>n.writeAll(i)):ye(t)?hc(n,t):fc(n,t)}},yn=class r extends mn{static writeAll(t){let e=new r;return Te(t)?t.then(n=>e.writeAll(n)):ye(t)?hc(e,t):fc(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let e=gr.encode(new gr(t,Mt.V4,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function fc(r,t){let e=t;t instanceof Kt&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function hc(r,t){var e,n,i,s,o,c,d;return I(this,void 0,void 0,function*(){try{for(e=!0,n=Be(t);i=yield n.next(),s=i.done,!s;e=!0){d=i.value,e=!1;let u=d;r.write(u)}}catch(u){o={error:u}}finally{try{!e&&!s&&(c=n.return)&&(yield c.call(n))}finally{if(o)throw o.error}}return r.finish()})}function kd(r,t){if(ye(r))return ey(r,t);if(Fe(r))return ty(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function ty(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,c){let d,u=null,m=o.desiredSize||null;for(;!(u=c.next(n?m:null)).done;)if(ArrayBuffer.isView(u.value)&&(d=N(u.value))&&(m!=null&&n&&(m=m-d.byteLength+1),u.value=d),o.enqueue(u.value),m!=null&&--m<=0)return;o.close()}}function ey(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 I(this,void 0,void 0,function*(){yield s(o,e||(e=r[Symbol.asyncIterator]()))})},pull(o){return I(this,void 0,void 0,function*(){e?yield s(o,e):o.close()})},cancel(){return I(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,c){return I(this,void 0,void 0,function*(){let d,u=null,m=o.desiredSize||null;for(;!(u=yield c.next(n?m:null)).done;)if(ArrayBuffer.isView(u.value)&&(d=N(u.value))&&(m!=null&&n&&(m=m-d.byteLength+1),u.value=d),o.enqueue(u.value),m!=null&&--m<=0)return;o.close()})}}function Cd(r){return new pc(r)}var pc=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,s=ru(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=un(s),this._getSize=i!=="bytes"?Nd:Ld;let{["highWaterMark"]:o=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},e),{["highWaterMark"]:c=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:d=>{this._maybeFlush(this._builder,this._controller=d)},start:d=>{this._maybeFlush(this._builder,this._controller=d)}},{highWaterMark:o,size:i!=="bytes"?Nd:Ld}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:c,size:d=>this._writeValueAndReturnChunkSize(d)})}_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)}},Nd=r=>{var t;return(t=r==null?void 0:r.length)!==null&&t!==void 0?t:0},Ld=r=>{var t;return(t=r==null?void 0:r.byteLength)!==null&&t!==void 0?t:0};function Ho(r,t){let e=new Ze,n=null,i=new ReadableStream({cancel(){return I(this,void 0,void 0,function*(){yield e.close()})},start(c){return I(this,void 0,void 0,function*(){yield o(c,n||(n=yield s()))})},pull(c){return I(this,void 0,void 0,function*(){n?yield o(c,n):c.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:i};function s(){return I(this,void 0,void 0,function*(){return yield(yield Ht.from(e)).open(t)})}function o(c,d){return I(this,void 0,void 0,function*(){let u=c.desiredSize,m=null;for(;!(m=yield d.next()).done;)if(c.enqueue(m.value),u!=null&&--u<=0)return;c.close()})}}function zo(r,t){let e=new this(r),n=new ve(e),i=new ReadableStream({cancel(){return I(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return I(this,void 0,void 0,function*(){yield s(o)})},start(o){return I(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 I(this,void 0,void 0,function*(){let c=null,d=o.desiredSize;for(;c=yield n.read(d||null);)if(o.enqueue(c),d!=null&&(d-=c.byteLength)<=0)return;o.close()})}}function Wo(r,t="stream"){return(t==="stream"?_n:yn).writeAll(r).toUint8Array(!0)}var sy=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Ta),qa),za),Fa),Sa),Ha),{compareSchemas:hn,compareFields:dd,compareTypes:fd});Lt.toDOMStream=kd;bt.throughDOM=Cd;Ht.throughDOM=Ho;Yr.throughDOM=Ho;er.throughDOM=Ho;mn.throughDOM=zo;yn.throughDOM=zo;_n.throughDOM=zo;function Kn(r){switch(r.typeId){case p.Binary:return{sqlType:"binary"};case p.Bool:return{sqlType:"bool"};case p.Date:return{sqlType:"date"};case p.DateDay:return{sqlType:"date32[d]"};case p.DateMillisecond:return{sqlType:"date64[ms]"};case p.Decimal:{let t=r;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case p.Float:return{sqlType:"float"};case p.Float16:return{sqlType:"float16"};case p.Float32:return{sqlType:"float32"};case p.Float64:return{sqlType:"float64"};case p.Int:return{sqlType:"int32"};case p.Int16:return{sqlType:"int16"};case p.Int32:return{sqlType:"int32"};case p.Int64:return{sqlType:"int64"};case p.Uint16:return{sqlType:"uint16"};case p.Uint32:return{sqlType:"uint32"};case p.Uint64:return{sqlType:"uint64"};case p.Uint8:return{sqlType:"uint8"};case p.IntervalDayTime:return{sqlType:"interval[dt]"};case p.IntervalYearMonth:return{sqlType:"interval[m]"};case p.List:return{sqlType:"list",valueType:Kn(r.valueType)};case p.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:r.byteWidth};case p.Null:return{sqlType:"null"};case p.Utf8:return{sqlType:"utf8"};case p.Struct:return{sqlType:"struct",fields:r.children.map(e=>jo(e.name,e.type))};case p.Map:{let t=r;return{sqlType:"map",keyType:Kn(t.keyType),valueType:Kn(t.valueType)}}case p.Time:return{sqlType:"time[s]"};case p.TimeMicrosecond:return{sqlType:"time[us]"};case p.TimeMillisecond:return{sqlType:"time[ms]"};case p.TimeNanosecond:return{sqlType:"time[ns]"};case p.TimeSecond:return{sqlType:"time[s]"};case p.Timestamp:return{sqlType:"timestamp",timezone:r.timezone||void 0};case p.TimestampSecond:return{sqlType:"timestamp[s]",timezone:r.timezone||void 0};case p.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:r.timezone||void 0};case p.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:r.timezone||void 0};case p.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:r.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(r.toString()))}function jo(r,t){let e=Kn(t);return e.name=r,e}var $o=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 Zd=tu(Gd());var Yo=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=Ht.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new Kt(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(c){console.log(c),o(c)}});let n=new Go(this._bindings,this._conn,e),i=Ht.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 _c(this._bindings,this._conn,e)}createScalarFunction(t,e,n){this._bindings.createScalarFunction(this._conn,t,e,n)}insertArrowTable(t,e){let n=Wo(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)}},Go=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}},_c=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=Ht.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new Kt(n)}send(...t){let e=this.bindings.sendPrepared(this.connectionId,this.statementId,t),n=new Go(this.bindings,this.connectionId,e),i=Ht.from(n);return console.assert(i.isSync()),console.assert(i.isStream()),i}};var Jd=new TextEncoder,Xd=new TextDecoder("utf-8");function yc(r,t,e){let n=Jd.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 gc(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 bc(r,t,e,n){let i=r.HEAPU8.subarray(t,t+n*gc(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 Kd(r,t,e){let n=r.HEAPU8.subarray(t,t+e);return new Uint8Array(n.buffer,n.byteOffset,e)}function Xo(r,t,e){let n=r.HEAPU8.subarray(t,t+e*8);return new Float64Array(n.buffer,n.byteOffset,e)}function qd(r,t,e,n,i,s,o,c){try{let d=r._udfFunctions.get(n);if(!d){yc(t,e,"Unknown UDF with id: "+n);return}let u=Xd.decode(t.HEAPU8.subarray(i,i+s)),m=JSON.parse(u),g=Xo(t,o,c/8),S=q=>{var Jt;let Nt=null;switch(q.validityBuffer!==void 0&&(Nt=Kd(t,g[q.validityBuffer],m.rows)),q.physicalType){case"VARCHAR":{if(q.dataBuffer===null||q.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for VARCHAR argument");if(q.lengthBuffer===null||q.lengthBuffer===void 0)throw new Error("malformed data view, expected data length buffer for VARCHAR argument");let jt=bc(t,g[q.dataBuffer],q.physicalType,m.rows),zt=[],at=Xo(t,g[q.lengthBuffer],m.rows);for(let nt=0;nt<m.rows;++nt){if(Nt!=null&&!Nt[nt]){zt.push(null);continue}let qt=t.HEAPU8.subarray(jt[nt],jt[nt]+at[nt]),St=Xd.decode(qt);zt.push(St)}return nt=>zt[nt]}case"STRUCT":{let jt={},zt=[];for(let at=0;at<(((Jt=q.children)==null?void 0:Jt.length)||0);++at){let nt=q.children[at],qt=S(nt);zt.push(St=>{jt[nt.name]=qt(St)})}return Nt!=null?at=>{if(!Nt[at])return null;for(let nt of zt)nt(at);return jt}:at=>{for(let nt of zt)nt(at);return jt}}default:{if(q.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for argument of type: "+q.physicalType);let jt=bc(t,g[q.dataBuffer],q.physicalType,m.rows);return Nt!=null?zt=>Nt[zt]?jt[zt]:null:zt=>jt[zt]}}},B=[];for(let q=0;q<m.args.length;++q)B.push(S(m.args[q]));let Q=m.rows*gc(m.ret.physicalType),wt=t._malloc(Q),Et=bc(t,wt,m.ret.physicalType,m.rows),vt=t._malloc(m.rows),_t=Kd(t,vt,m.rows);if(Et.length==0||_t.length==0){yc(t,e,"Can't create physical arrays for result");return}let T=Et;m.ret.physicalType=="VARCHAR"&&(T=new Array(m.rows));let kt=[];for(let q=0;q<m.args.length;++q)kt.push(null);for(let q=0;q<m.rows;++q){for(let Jt=0;Jt<m.args.length;++Jt)kt[Jt]=B[Jt](q);let Nt=d.func(...kt);T[q]=Nt,_t[q]=Nt==null?0:1}let gn=0;switch(m.ret.physicalType){case"VARCHAR":{let q=new Array(0);gn=t._malloc(m.rows*gc("DOUBLE"));let Nt=Xo(t,gn,m.rows),Jt=0;for(let nt=0;nt<m.rows;++nt){let qt=Jd.encode(T[nt]||"");q.push(qt),Nt[nt]=qt.length,Jt+=qt.length}let jt=t._malloc(Jt),zt=t.HEAPU8.subarray(jt,jt+Jt),at=0;for(let nt=0;nt<m.rows;++nt){Et[nt]=at;let qt=q[nt];zt.subarray(at,at+qt.length).set(qt),at+=qt.length}}}let Jn=3*8,qn=t._malloc(Jn),Fr=Xo(t,qn,3);Fr[0]=wt,Fr[1]=vt,Fr[2]=gn,t.HEAPF64[(e>>3)+0]=0,t.HEAPF64[(e>>3)+1]=qn,t.HEAPF64[(e>>3)+2]=0}catch(d){yc(t,e,d.toString())}}function ay(){let r=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),r.decode(t))}var cy=ay();function Ie(r,t){console.error("FAIL WITH: ".concat(t)),r.ccall("duckdb_web_fail_with",null,["string"],[t])}function bn(r,t,e){let n=r.HEAPU8.subarray(t,t+e),i=new Uint8Array(new ArrayBuffer(n.byteLength));return i.set(n),i}function W(r,t,e){return cy(r.HEAPU8.subarray(t,t+e))}function ot(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],c=r.HEAPF64[(s>>3)+1],d=r.HEAPF64[(s>>3)+2];return r.stackRestore(i),[o,c,d]}function mt(r){r.ccall("duckdb_web_clear_response",null,[],[])}var Ko=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 ly=new TextEncoder;var Jo=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]=ot(this.mod,"duckdb_web_open",["string"],[JSON.stringify(t)]);if(e!==0)throw new Error(W(this.mod,n,i));mt(this.mod)}reset(){let[t,e,n]=ot(this.mod,"duckdb_web_reset",[],[]);if(t!==0)throw new Error(W(this.mod,e,n));mt(this.mod)}getVersion(){let[t,e,n]=ot(this.mod,"duckdb_web_get_version",[],[]);if(t!==0)throw new Error(W(this.mod,e,n));let i=W(this.mod,e,n);return mt(this.mod),i}getFeatureFlags(){return this.mod.ccall("duckdb_web_get_feature_flags","number",[],[])}tokenize(t){let[e,n,i]=ot(this.mod,"duckdb_web_tokenize",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));let s=W(this.mod,n,i);return mt(this.mod),JSON.parse(s)}connect(){let t=this.mod.ccall("duckdb_web_connect","number",[],[]);return new Yo(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]=ot(this.mod,"duckdb_web_query_run",["number","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));let o=bn(this.mod,i,s);return mt(this.mod),o}startPendingQuery(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_pending_query_start",["number","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));if(i==0)return null;let o=bn(this.mod,i,s);return mt(this.mod),o}pollPendingQuery(t){let[e,n,i]=ot(this.mod,"duckdb_web_pending_query_poll",["number"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));if(n==0)return null;let s=bn(this.mod,n,i);return mt(this.mod),s}cancelPendingQuery(t){return this.mod.ccall("duckdb_web_pending_query_cancel","boolean",["number"],[t])}fetchQueryResults(t){let[e,n,i]=ot(this.mod,"duckdb_web_query_fetch_results",["number"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));let s=bn(this.mod,n,i);return mt(this.mod),s}getTableNames(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_get_tablenames",["number","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));let o=W(this.mod,i,s);return mt(this.mod),JSON.parse(o)}createScalarFunction(t,e,n,i){let s={functionId:this._nextUDFId,name:e,returnType:Kn(n)},o={functionId:s.functionId,connectionId:t,name:e,returnType:n,func:i};this._nextUDFId+=1;let[c,d,u]=ot(this.mod,"duckdb_web_udf_scalar_create",["number","string"],[t,JSON.stringify(s)]);if(c!==0)throw new Error(W(this.mod,d,u));if(mt(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]=ot(this.mod,"duckdb_web_prepared_create",["number","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));return mt(this.mod),i}closePrepared(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_prepared_close",["number","number"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));mt(this.mod)}runPrepared(t,e,n){let[i,s,o]=ot(this.mod,"duckdb_web_prepared_run",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(W(this.mod,s,o));let c=bn(this.mod,s,o);return mt(this.mod),c}sendPrepared(t,e,n){let[i,s,o]=ot(this.mod,"duckdb_web_prepared_send",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(W(this.mod,s,o));let c=bn(this.mod,s,o);return mt(this.mod),c}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):"",[c,d,u]=ot(this.mod,"duckdb_web_insert_arrow_from_ipc_stream",["number","number","number","string"],[t,i,e.length,o]);if(c!==0)throw new Error(W(this.mod,d,u))}insertCSVFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let u in n.columns)n.columnsFlat.push(jo(u,n.columns[u]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,c,d]=ot(this.mod,"duckdb_web_insert_csv_from_path",["number","string","string"],[t,e,s]);if(o!==0)throw new Error(W(this.mod,c,d))}insertJSONFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let u in n.columns)n.columnsFlat.push(jo(u,n.columns[u]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[o,c,d]=ot(this.mod,"duckdb_web_insert_json_from_path",["number","string","string"],[t,e,s]);if(o!==0)throw new Error(W(this.mod,c,d))}globFiles(t){let[e,n,i]=ot(this.mod,"duckdb_web_fs_glob_file_infos",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));let s=W(this.mod,n,i);mt(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,c]=ot(this.mod,"duckdb_web_fs_register_file_url",["string","string"],[t,e,n,i]);if(s!==0)throw new Error(W(this.mod,o,c));mt(this.mod)}registerFileText(t,e){let n=ly.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,c]=ot(this.mod,"duckdb_web_fs_register_file_buffer",["string","number","number"],[t,n,e.length]);if(s!==0)throw new Error(W(this.mod,o,c));mt(this.mod)}registerFileHandle(t,e,n,i){let[s,o,c]=ot(this.mod,"duckdb_web_fs_register_file_url",["string","string","number","boolean"],[t,t,n,i]);if(s!==0)throw new Error(W(this.mod,o,c));if(mt(this.mod),globalThis.DUCKDB_RUNTIME._files=(globalThis.DUCKDB_RUNTIME._files||new Map).set(t,e),this.pthread){for(let d of this.pthread.runningWorkers)d.postMessage({cmd:"registerFileHandle",fileName:t,fileHandle:e});for(let d of this.pthread.unusedWorkers)d.postMessage({cmd:"dropFileHandle",fileName:t})}}dropFile(t){let[e,n,i]=ot(this.mod,"duckdb_web_fs_drop_file",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));mt(this.mod)}dropFiles(){let[t,e,n]=ot(this.mod,"duckdb_web_fs_drop_files",[],[]);if(t!==0)throw new Error(W(this.mod,e,n));mt(this.mod)}flushFiles(){this.mod.ccall("duckdb_web_flush_files",null,[],[])}copyFileToPath(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_copy_file_to_path",["string","string"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s));mt(this.mod)}copyFileToBuffer(t){let[e,n,i]=ot(this.mod,"duckdb_web_copy_file_to_buffer",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));let s=this.mod.HEAPU8.subarray(n,n+i),o=new Uint8Array(s.length);return o.set(s),mt(this.mod),o}collectFileStatistics(t,e){let[n,i,s]=ot(this.mod,"duckdb_web_collect_file_stats",["string","boolean"],[t,e]);if(n!==0)throw new Error(W(this.mod,i,s))}exportFileStatistics(t){let[e,n,i]=ot(this.mod,"duckdb_web_export_file_stats",["string"],[t]);if(e!==0)throw new Error(W(this.mod,n,i));return new Ko(this.mod.HEAPU8.subarray(n,n+i))}};var qo=class extends Jo{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 wt;let c=new Request(this.mainModuleURL),d=await fetch(c),u=d.headers.get("content-length"),m=u&&parseInt(u,10)||0,g=new Date,S={startedAt:g,updatedAt:g,bytesTotal:m||0,bytesLoaded:0},B={transform(Et,vt){S.bytesLoaded+=Et.byteLength;let _t=new Date;if(_t.getTime()-S.updatedAt.getTime()<20){S.updatedAt=_t,vt.enqueue(Et);return}for(let T of i)T(S);vt.enqueue(Et)}},Q=new TransformStream(B);return new Response((wt=d.body)==null?void 0:wt.pipeThrough(Q),d)})();WebAssembly.instantiateStreaming(o,e).then(c=>{n(c.instance,c.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,c=new Date,d={startedAt:c,updatedAt:c,bytesTotal:0,bytesLoaded:0};s.open("GET",o),s.responseType="arraybuffer",s.onerror=u=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to load WASM: "+u}),new Error(u.toString())},s.onprogress=u=>{d.bytesTotal=u.total,d.bytesLoaded=u.loaded;let m=new Date;if(m.getTime()-d.updatedAt.getTime()<20){d.updatedAt=m;return}for(let g of i)g(d)},s.onload=()=>{WebAssembly.instantiate(s.response,e).then(u=>{n(u.instance,u.module)}).catch(u=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to instantiate WASM: "+u}),new Error(u)})},s.send()}else console.warn("instantiating with manual fetch since streaming instantiation and xhrs are unavailable"),(async()=>{let o=new Request(this.mainModuleURL),d=await(await fetch(o)).arrayBuffer();WebAssembly.instantiate(d,e).then(u=>{n(u.instance,u.module)})})();return[]}};var Zo=class extends qo{constructor(t,e,n,i=null){super(t,e,n,i)}instantiateImpl(t){return(0,Zd.default)({...t,instantiateWasm:this.instantiateWasm.bind(this),locateFile:this.locateFile.bind(this)})}};var Xr=tu(Qd()),tf=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 uy(r,t,e){var s,o,c,d;let n=ef(t),i=n.path;return rf(r)&&(i="/".concat(n.bucket).concat(i)),{url:i,query:"",host:tf(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:(c=r==null?void 0:r.secretAccessKey)!=null?c:"",sessionToken:(d=r==null?void 0:r.sessionToken)!=null?d:"",dateNow:new Date().toISOString().replace(/-/g,"").split("T")[0],datetimeNow:new Date().toISOString().replace(/-/g,"").replace(/:/g,"").split(".")[0]+"Z"}}function dy(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 fy(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"+dy(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,Xr.sha256)(s),c="AWS4-HMAC-SHA256\n"+r.datetimeNow+"\n"+r.dateNow+"/"+r.region+"/"+r.service+"/aws4_request\n"+o,d="AWS4"+r.secretAccessKey,u=Xr.sha256.hmac.arrayBuffer(d,r.dateNow),m=Xr.sha256.hmac.arrayBuffer(u,r.region),g=Xr.sha256.hmac.arrayBuffer(m,r.service),S=Xr.sha256.hmac.arrayBuffer(g,"aws4_request"),B=Xr.sha256.hmac(S,c);return n.set("Authorization","AWS4-HMAC-SHA256 Credential="+r.accessKeyId+"/"+r.dateNow+"/"+r.region+"/"+r.service+"/aws4_request, SignedHeaders="+i+", Signature="+B),n}var hy=function(r,t,e,n=null,i=null){let s=uy(r,t,e),o={contentType:n,contentHash:i?Xr.sha256.hex(i):null};return fy(s,o)};function rr(r,t,e,n,i=null,s=null){(t!=null&&t.accessKeyId||t!=null&&t.sessionToken)&&(hy(t,e,n,i,s).forEach((c,d)=>{r.setRequestHeader(d,c)}),i&&r.setRequestHeader("content-type",i))}function ef(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 rf(r){var t;return!!((t=r==null?void 0:r.endpoint)!=null&&t.startsWith("http"))}function nr(r,t){let e=ef(t);return rf(r)?"".concat(r==null?void 0:r.endpoint,"/").concat(e.bucket)+e.path:"https://"+tf(r,t,e.bucket)+e.path}var rt={_files:new Map,_fileInfoCache:new Map,_udfFunctions:new Map,_globalFileInfo:null,getFileInfo(r,t){try{let e=rt._fileInfoCache.get(t),[n,i,s]=ot(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=W(r,i,s);mt(r);let c=JSON.parse(o);if(c==null)return null;let d={...c,blob:null};return rt._fileInfoCache.set(t,d),d}catch(e){return console.log(e),null}},getGlobalFileInfo(r){var t;try{let[e,n,i]=ot(r,"duckdb_web_get_global_file_info",["number"],[((t=rt._globalFileInfo)==null?void 0:t.cacheEpoch)||0]);if(e!==0)return null;if(i===0)return rt._globalFileInfo;let s=W(r,n,i);mt(r);let o=JSON.parse(s);return o==null?null:(rt._globalFileInfo={...o,blob:null},rt._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{rt._fileInfoCache.delete(t);let i=rt.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 c=new XMLHttpRequest;if(i.dataProtocol==5?(c.open("HEAD",nr(i.s3Config,i.dataUrl),!1),rr(c,i.s3Config,i.dataUrl,"HEAD")):c.open("HEAD",i.dataUrl,!1),c.send(null),c.status!=200&&c.status!=404)throw new Error("Opening file ".concat(i.fileName," failed: Unexpected return status from server (").concat(c.status,")"));if(c.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 d=r._malloc(1),u=new Uint8Array;r.HEAPU8.set(u,d);let m=r._malloc(2*8);return r.HEAPF64[(m>>3)+0]=1,r.HEAPF64[(m>>3)+1]=d,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 c=new XMLHttpRequest;if(i.dataProtocol==5?(c.open("HEAD",nr(i.s3Config,i.dataUrl),!1),rr(c,i.s3Config,i.dataUrl,"HEAD")):c.open("HEAD",i.dataUrl,!1),c.setRequestHeader("Range","bytes=0-"),c.send(null),s=c.getResponseHeader("Content-Length"),s!==null&&c.status==206){let d=r._malloc(16);return r.HEAPF64[(d>>3)+0]=+s,r.HEAPF64[(d>>3)+1]=0,d}}catch(c){o=c,console.warn("HEAD request with range header failed: ".concat(c))}if(i.allowFullHttpReads){if(s!==null&&+s>1){let d=new XMLHttpRequest;i.dataProtocol==5?(d.open("GET",nr(i.s3Config,i.dataUrl),!1),rr(d,i.s3Config,i.dataUrl,"GET")):d.open("GET",i.dataUrl,!1),d.setRequestHeader("Range","bytes=0-0"),d.send(null);let u=d.getResponseHeader("Content-Length");if(d.status==206&&u!==null&&+u==1){let m=r._malloc(16);return r.HEAPF64[(m>>3)+0]=+s,r.HEAPF64[(m>>3)+1]=0,m}if(d.status==200&&u!==null&&+u==+s){console.warn("fall back to full HTTP read for: ".concat(i.dataUrl));let m=r._malloc(d.response.byteLength),g=new Uint8Array(d.response,0,d.response.byteLength);r.HEAPU8.set(g,m);let S=r._malloc(2*8);return r.HEAPF64[(S>>3)+0]=d.response.byteLength,r.HEAPF64[(S>>3)+1]=m,S}}console.warn("falling back to full HTTP read for: ".concat(i.dataUrl));let c=new XMLHttpRequest;if(i.dataProtocol==5?(c.open("GET",nr(i.s3Config,i.dataUrl),!1),rr(c,i.s3Config,i.dataUrl,"GET")):c.open("GET",i.dataUrl,!1),c.responseType="arraybuffer",c.send(null),c.status==200){let d=r._malloc(c.response.byteLength),u=new Uint8Array(c.response,0,c.response.byteLength);r.HEAPU8.set(u,d);let m=r._malloc(2*8);return r.HEAPF64[(m>>3)+0]=c.response.byteLength,r.HEAPF64[(m>>3)+1]=d,m}}if(o!=null)throw new Error("Reading file ".concat(i.fileName," failed with error: ").concat(o));return 0}case 2:{let s=(n=rt._files)==null?void 0:n.get(i.fileName);if(s){let d=r._malloc(16);return r.HEAPF64[(d>>3)+0]=s.size,r.HEAPF64[(d>>3)+1]=0,d}console.warn("Buffering missing file: ".concat(i.fileName));let o=r._malloc(2*8),c=r._malloc(1);return r.HEAPF64[(o>>3)+0]=1,r.HEAPF64[(o>>3)+1]=c,o}}}catch(i){console.error(i.toString()),Ie(r,i.toString())}return 0},glob:(r,t,e)=>{var n;try{let i=W(r,t,e);if(i.startsWith("http")||i.startsWith("s3://")){let s=new XMLHttpRequest;if(i.startsWith("s3://")){let o=rt.getGlobalFileInfo(r);s.open("HEAD",nr(o==null?void 0:o.s3Config,i),!1),rr(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=rt.getGlobalFileInfo(r))!=null&&n.allowFullHttpReads)){Ie(r,"HEAD request failed: ".concat(i,", with full http reads are disabled"));return}let o=new XMLHttpRequest;if(i.startsWith("s3://")){let d=rt.getGlobalFileInfo(r);o.open("GET",nr(d==null?void 0:d.s3Config,i),!1),rr(o,d==null?void 0:d.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){Ie(r,"HEAD and GET requests failed: ".concat(i));return}let c=o.getResponseHeader("Content-Length");c&&+c>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),Ie(r,i.toString()),0}},checkFile:(r,t,e)=>{try{let n=W(r,t,e);if(n.startsWith("http")||n.startsWith("s3://")){let i=new XMLHttpRequest;if(n.startsWith("s3://")){let s=rt.getGlobalFileInfo(r);i.open("HEAD",nr(s==null?void 0:s.s3Config,n),!1),rr(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=rt.getFileInfo(r,t);switch(rt._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=rt._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=rt.getFileInfo(r,t);switch(n==null?void 0:n.dataProtocol){case 4:Ie(r,"Cannot truncate a http file");return;case 5:Ie(r,"Cannot truncate an s3 file");return;case 0:case 1:case 2:Ie(r,"truncateFile not implemented");return;case 3:{let s=(i=rt._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 c=rt.getFileInfo(r,t);switch(c==null?void 0:c.dataProtocol){case 4:case 5:{if(!c.dataUrl)throw new Error("Missing data URL for file ".concat(t));try{let d=new XMLHttpRequest;if(c.dataProtocol==5?(d.open("GET",nr(c==null?void 0:c.s3Config,c.dataUrl),!1),rr(d,c==null?void 0:c.s3Config,c.dataUrl,"GET")):d.open("GET",c.dataUrl,!1),d.responseType="arraybuffer",d.setRequestHeader("Range","bytes=".concat(i,"-").concat(i+n-1)),d.send(null),d.status==206||d.status==200&&n==d.response.byteLength&&i==0){let u=new Uint8Array(d.response,0,Math.min(d.response.byteLength,n));return r.HEAPU8.set(u,e),u.byteLength}else if(d.status==200){console.warn("Range request for ".concat(c.dataUrl," did not return a partial response: ").concat(d.status,' "').concat(d.statusText,'"'));let u=new Uint8Array(d.response,i,Math.min(d.response.byteLength-i,n));return r.HEAPU8.set(u,e),u.byteLength}else throw new Error("Range request for ".concat(c.dataUrl," did returned non-success status: ").concat(d.status,' "').concat(d.statusText,'"'))}catch(d){throw console.log(d),new Error("Range request for ".concat(c.dataUrl," failed with error: ").concat(d,'"'))}}case 2:{let d=(s=rt._files)==null?void 0:s.get(c.fileName);if(!d)throw new Error("No HTML5 file registered with name: ".concat(c.fileName));let u=d.slice(i,i+n),m=new Uint8Array(new FileReaderSync().readAsArrayBuffer(u));return r.HEAPU8.set(m,e),m.byteLength}case 3:{let d=(o=rt._files)==null?void 0:o.get(c.fileName);if(!d)throw new Error("No OPFS access handle registered with name: ".concat(c.fileName));let u=r.HEAPU8.subarray(e,e+n);return d.read(u,{at:i})}}return 0}catch(c){return console.log(c),Ie(r,c.toString()),0}},writeFile:(r,t,e,n,i)=>{var o;let s=rt.getFileInfo(r,t);switch(s==null?void 0:s.dataProtocol){case 4:return Ie(r,"Cannot write to HTTP file"),0;case 5:{let c=r.HEAPU8.subarray(e,e+n),d=new XMLHttpRequest;return d.open("PUT",nr(s==null?void 0:s.s3Config,s.dataUrl),!1),rr(d,s==null?void 0:s.s3Config,s.dataUrl,"PUT","",c),d.send(c),d.status!==200?(Ie(r,"Failed writing file: HTTP "+d.status),0):n}case 2:return Ie(r,"cannot write using the html5 file reader api"),0;case 3:{let c=(o=rt._files)==null?void 0:o.get(s.fileName);if(!c)throw new Error("No OPFS access handle registered with name: ".concat(s.fileName));let d=r.HEAPU8.subarray(e,e+n);return c.write(d,{at:i})}}return 0},getLastFileModificationTime:(r,t)=>{var n;let e=rt.getFileInfo(r,t);switch(e==null?void 0:e.dataProtocol){case 2:{if(!((n=rt._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=W(r,t,e);return console.log("checkDirectory: ".concat(n)),!1},createDirectory:(r,t,e)=>{let n=W(r,t,e);console.log("createDirectory: ".concat(n))},removeDirectory:(r,t,e)=>{let n=W(r,t,e);console.log("removeDirectory: ".concat(n))},listDirectoryEntries:(r,t,e)=>{let n=W(r,t,e);return console.log("listDirectoryEntries: ".concat(n)),!1},moveFile:(r,t,e,n,i)=>{var d,u;let s=W(r,t,e),o=W(r,n,i),c=(d=rt._files)==null?void 0:d.get(s);c!==void 0&&(rt._files.delete(c),rt._files.set(o,c));for(let[m,g]of((u=rt._fileInfoCache)==null?void 0:u.entries())||[])if(g.dataUrl==s){rt._fileInfoCache.delete(m);break}return!0},removeFile:(r,t,e)=>{},callScalarUDF:(r,t,e,n,i,s,o)=>{qd(rt,r,t,e,n,i,s,o)}};var wc=class extends $o{postMessage(t,e){globalThis.postMessage(t,e)}async instantiate(t,e,n){return await new Zo(this,rt,t,e).instantiate(n)}};function nf(){let r=new wc;globalThis.onmessage=async t=>{await r.onMessage(t.data)}}nf();return Ap(py);})();
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
js-sha256/src/sha256.js:
|