@run-trace/duckdb-wasm 0.3.1 → 0.4.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.cjs +1 -1
- package/dist/duckdb-browser.cjs.map +3 -3
- package/dist/duckdb-browser.mjs +1 -1
- package/dist/duckdb-browser.mjs.map +3 -3
- package/dist/duckdb-coi.wasm +0 -0
- package/dist/duckdb-eh.wasm +0 -0
- package/dist/duckdb-mvp.wasm +0 -0
- package/dist/duckdb-node-blocking.cjs +2 -4
- package/dist/duckdb-node-blocking.cjs.map +3 -3
- package/dist/duckdb-node-eh.worker.cjs +2 -4
- package/dist/duckdb-node-eh.worker.cjs.map +3 -3
- package/dist/duckdb-node-mvp.worker.cjs +2 -3
- package/dist/duckdb-node-mvp.worker.cjs.map +3 -3
- package/dist/duckdb-node.cjs +1 -1
- package/dist/duckdb-node.cjs.map +3 -3
- package/dist/types/src/bindings/bindings_base.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var duckdb=(()=>{var Dm=Object.create;var Bs=Object.defineProperty;var Bm=Object.getOwnPropertyDescriptor;var Fm=Object.getOwnPropertyNames;var Am=Object.getPrototypeOf,Tm=Object.prototype.hasOwnProperty;var La=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r);var ka=(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 pr=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),jr=(r,t)=>{for(var e in t)Bs(r,e,{get:t[e],enumerable:!0})},Lu=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Fm(t))!Tm.call(r,i)&&i!==e&&Bs(r,i,{get:()=>t[i],enumerable:!(n=Bm(t,i))||n.enumerable});return r};var ku=(r,t,e)=>(e=r!=null?Dm(Am(r)):{},Lu(t||!r||!r.__esModule?Bs(e,"default",{value:r,enumerable:!0}):e,r)),xm=r=>Lu(Bs({},"__esModule",{value:!0}),r);var Em=function(r,t){this[0]=r,this[1]=t};var un=r=>{var t=r[La("asyncIterator")],e=!1,n,i={};return t==null?(t=r[La("iterator")](),n=s=>i[s]=a=>t[s](a)):(t=t.call(r),n=s=>i[s]=a=>{if(e){if(e=!1,s==="throw")throw a;return a}return e=!0,{done:!1,value:new Em(new Promise(c=>{var d=t[s](a);if(!(d instanceof Object))throw TypeError("Object expected");c(d)}),1)}}),i[La("iterator")]=()=>i,n("next"),"throw"in t?n("throw"):i.throw=s=>{throw s},"return"in t&&n("return"),i};var Nf=pr(()=>{});var Cf=pr(()=>{});var Pf=pr(()=>{});var Hf=pr(()=>{});var Vf=pr(()=>{});var jf=pr((zf,Wc)=>{"use strict";var Wf=(()=>{var t;var r=typeof document<"u"?(t=document.currentScript)==null?void 0:t.src:void 0;return typeof __filename<"u"&&(r||(r=__filename)),function(e={}){function n(){return Ut.buffer!=be.buffer&&fr(),be}function i(){return Ut.buffer!=be.buffer&&fr(),On}function s(){return Ut.buffer!=be.buffer&&fr(),cn}function a(){return Ut.buffer!=be.buffer&&fr(),jc}function c(){return Ut.buffer!=be.buffer&&fr(),$c}function d(){return Ut.buffer!=be.buffer&&fr(),Gc}function h(){return Ut.buffer!=be.buffer&&fr(),Yc}var u=e,I,T,E=new Promise((o,l)=>{I=o,T=l}),ft=Object.assign({},u),At=[],jt="./this.program",Lt=(o,l)=>{throw l},Tt=typeof window=="object",bt=typeof importScripts=="function",xt=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",U=u.ENVIRONMENT_IS_PTHREAD||!1,w="";function M(o){return u.locateFile?u.locateFile(o,w):w+o}var H,D,N;if(xt){var A=Nf(),J=Cf();bt?w=J.dirname(w)+"/":w=__dirname+"/",H=(o,l)=>(o=il(o)?new URL(o):J.normalize(o),A.readFileSync(o,l?void 0:"utf8")),N=o=>{var l=H(o,!0);return l.buffer||(l=new Uint8Array(l)),l},D=(o,l,f,p=!0)=>{o=il(o)?new URL(o):J.normalize(o),A.readFile(o,p?void 0:"utf8",(_,b)=>{_?f(_):l(p?b.buffer:b)})},!u.thisProgram&&process.argv.length>1&&(jt=process.argv[1].replace(/\\/g,"/")),At=process.argv.slice(2),Lt=(o,l)=>{throw process.exitCode=o,l},global.Worker=Pf().Worker}else(Tt||bt)&&(bt?w=self.location.href:typeof document<"u"&&document.currentScript&&(w=document.currentScript.src),r&&(w=r),w.startsWith("blob:")?w="":w=w.substr(0,w.replace(/[?#].*/,"").lastIndexOf("/")+1),xt||(H=o=>{var l=new XMLHttpRequest;return l.open("GET",o,!1),l.send(null),l.responseText},bt&&(N=o=>{var l=new XMLHttpRequest;return l.open("GET",o,!1),l.responseType="arraybuffer",l.send(null),new Uint8Array(l.response)}),D=(o,l,f)=>{var p=new XMLHttpRequest;p.open("GET",o,!0),p.responseType="arraybuffer",p.onload=()=>{if(p.status==200||p.status==0&&p.response){l(p.response);return}f()},p.onerror=f,p.send(null)}));xt&&typeof performance>"u"&&(global.performance=Hf().performance);var B=console.log.bind(console),W=console.error.bind(console);xt&&(B=(...o)=>A.writeSync(1,o.join(" ")+"\n"),W=(...o)=>A.writeSync(2,o.join(" ")+"\n"));var Q=u.print||B,pt=u.printErr||W;Object.assign(u,ft),ft=null,u.arguments&&(At=u.arguments),u.thisProgram&&(jt=u.thisProgram),u.quit&&(Lt=u.quit);var Ht;u.wasmBinary&&(Ht=u.wasmBinary);var Ut,vt,ye=!1,se;function Vr(o,l){o||Re(l)}var be,On,cn,jc,$c,Gc,th,Yc;function fr(){var o=Ut.buffer;u.HEAP8=be=new Int8Array(o),u.HEAP16=cn=new Int16Array(o),u.HEAPU8=On=new Uint8Array(o),u.HEAPU16=jc=new Uint16Array(o),u.HEAP32=$c=new Int32Array(o),u.HEAPU32=Gc=new Uint32Array(o),u.HEAPF32=th=new Float32Array(o),u.HEAPF64=Yc=new Float64Array(o)}var qc=u.INITIAL_MEMORY||16777216;if(U)Ut=u.wasmMemory;else if(u.wasmMemory)Ut=u.wasmMemory;else if(Ut=new WebAssembly.Memory({initial:qc/65536,maximum:65536,shared:!0}),!(Ut.buffer instanceof SharedArrayBuffer))throw pt("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"),xt&&pt("(on node you may need: --experimental-wasm-threads --experimental-wasm-bulk-memory and/or recent version)"),Error("bad memory");fr(),qc=Ut.buffer.byteLength;var Kc=[],Jc=[],eh=[],Xc=[],Zc=!1;function rh(){if(u.preRun)for(typeof u.preRun=="function"&&(u.preRun=[u.preRun]);u.preRun.length;)tl(u.preRun.shift());_s(Kc)}function Qc(){Zc=!0,!U&&_s(Jc)}function nh(){U||_s(eh)}function ih(){if(!U){if(u.postRun)for(typeof u.postRun=="function"&&(u.postRun=[u.postRun]);u.postRun.length;)oh(u.postRun.shift());_s(Xc)}}function tl(o){Kc.unshift(o)}function sh(o){Jc.unshift(o)}function oh(o){Xc.unshift(o)}var ln=0,pa=null,ui=null;function el(o){var l;ln++,(l=u.monitorRunDependencies)==null||l.call(u,ln)}function rl(o){var f;if(ln--,(f=u.monitorRunDependencies)==null||f.call(u,ln),ln==0&&(pa!==null&&(clearInterval(pa),pa=null),ui)){var l=ui;ui=null,l()}}function Re(o){var f;(f=u.onAbort)==null||f.call(u,o),o="Aborted("+o+")",pt(o),ye=!0,se=1,o+=". Build with -sASSERTIONS for more info.",Zc&&___trap();var l=new WebAssembly.RuntimeError(o);throw T(l),l}var ah="data:application/octet-stream;base64,",nl=o=>o.startsWith(ah),il=o=>o.startsWith("file://"),Mn;Mn="./duckdb-coi.wasm",nl(Mn)||(Mn=M(Mn));function sl(o){if(o==Mn&&Ht)return new Uint8Array(Ht);if(N)return N(o);throw"both async and sync fetching of the wasm failed"}function ch(o){return!Ht&&(Tt||bt)&&typeof fetch=="function"?fetch(o,{credentials:"same-origin"}).then(l=>{if(!l.ok)throw"failed to load wasm binary file at '".concat(o,"'");return l.arrayBuffer()}).catch(()=>sl(o)):Promise.resolve().then(()=>sl(o))}function ol(o,l,f){return ch(o).then(p=>WebAssembly.instantiate(p,l)).then(f,p=>{pt("failed to asynchronously prepare wasm: ".concat(p)),Re(p)})}function lh(o,l,f,p){return!o&&typeof WebAssembly.instantiateStreaming=="function"&&!nl(l)&&!xt&&typeof fetch=="function"?fetch(l,{credentials:"same-origin"}).then(_=>{var b=WebAssembly.instantiateStreaming(_,f);return b.then(p,function(y){return pt("wasm streaming compile failed: ".concat(y)),pt("falling back to ArrayBuffer instantiation"),ol(l,f,p)})}):ol(l,f,p)}function uh(){var o={a:Bp};function l(p,_){return R=p.exports,R=vm(R),yh(R.Bb),va=R.La,sh(R.Ja),vt=_,rl("wasm-instantiate"),R}el("wasm-instantiate");function f(p){l(p.instance,p.module)}if(u.instantiateWasm)try{return u.instantiateWasm(o,l)}catch(p){pt("Module.instantiateWasm callback failed with error: ".concat(p)),T(p)}return lh(Ht,Mn,o,f).catch(T),{}}var Qt,Un,al={10173248:(o,l,f,p)=>{var _=gt(o);if(typeof XMLHttpRequest>"u")return 0;let b=new XMLHttpRequest;b.open(gt(p),_,!1),b.responseType="arraybuffer";for(var y=0,v=l;y<v*2;){var g=c()[f/4+y>>>0],x=c()[f/4+y+1>>>0];try{var O=encodeURI(gt(g));O==="Host"&&(O="X-Host-Override"),O==="User-Agent"&&(O="X-user-agent"),O==="Authorization"?b.setRequestHeader(O,gt(x)):b.setRequestHeader(O,encodeURI(gt(x)))}catch(kt){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",kt)}y+=2}try{b.send(null)}catch(kt){return 0}if(b.status>=400)return 0;for(var z=b.response,v=z.byteLength,j=hr(v+4),mt=new Uint8Array(z),it=0;it<v;it++)u.HEAPU8[it+j+4]=mt[it];var F=new Uint8Array(4);return F[0]=v%256,v-=F[0],v/=256,F[1]=v%256,v-=F[1],v/=256,F[2]=v%256,v-=F[2],v/=256,F[3]=v%256,v-=F[3],v/=256,u.HEAPU8.set(F,j),j},10174655:(o,l,f,p,_,b)=>{var y=gt(o);if(typeof XMLHttpRequest>"u")return 0;let g=new XMLHttpRequest;g.open(gt(p),y,!1),g.responseType="arraybuffer";for(var x=0,F=l;x<F*2;){var O=c()[f/4+x>>>0],z=c()[f/4+x+1>>>0];try{var v=encodeURI(gt(O));v==="Host"&&(v="X-Host-Override"),v==="User-Agent"&&(v="X-user-agent"),v==="Authorization"?g.setRequestHeader(v,gt(z)):g.setRequestHeader(v,encodeURI(gt(z)))}catch(V){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",V)}x+=2}try{for(var j=new Uint8Array(b),mt=0;mt<b;mt++)j[mt]=u.HEAPU8[mt+_];g.send(j)}catch(V){return 0}if(g.status>=400)return 0;for(var it=Uint8Array.from(Array.from(g.getResponseHeader("Etag")).map(V=>V.charCodeAt(0))),F=it.byteLength,kt=hr(F+4),ae=new Uint8Array(it),mt=0;mt<F;mt++)u.HEAPU8[mt+kt+4]=ae[mt];var S=new Uint8Array(4);return S[0]=F%256,F-=S[0],F/=256,S[1]=F%256,F-=S[1],F/=256,S[2]=F%256,F-=S[2],F/=256,S[3]=F%256,F-=S[3],F/=256,u.HEAPU8.set(S,kt),kt},10176275:(o,l,f,p)=>{var _=gt(o);if(typeof XMLHttpRequest>"u")return 0;let b=new XMLHttpRequest;b.open(gt(p),_,!1),b.responseType="arraybuffer";for(var y=0,v=l;y<v*2;){var g=c()[f/4+y>>>0],x=c()[f/4+y+1>>>0];console.log("HEAD",gt(g),gt(x));try{var O=encodeURI(gt(g));O==="Host"&&(O="X-Host-Override"),O==="User-Agent"&&(O="X-user-agent"),O==="Authorization"?b.setRequestHeader(O,gt(x)):b.setRequestHeader(O,encodeURI(gt(x)))}catch(S){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",S)}y+=2}try{b.send(null)}catch(S){return 0}if(b.status>=400)return 0;for(var z=b.response,v=z.byteLength,j=hr(v+8),mt=new Uint8Array(z),it=0;it<v;it++)u.HEAPU8[it+j+8]=mt[it];var F=new Uint8Array(4);F[0]=v%256,v-=F[0],v/=256,F[1]=v%256,v-=F[1],v/=256,F[2]=v%256,v-=F[2],v/=256,F[3]=v%256,v-=F[3],v/=256,u.HEAPU8.set(F,j+4);var kt=Uint8Array.from(Array.from(b.getAllResponseHeaders()).map(S=>S.charCodeAt(0)));v=kt.byteLength;for(var ae=hr(v+8),it=0;it<v;it++)u.HEAPU8[it+ae+8]=kt[it];return F=new Uint8Array(4),F[0]=v%256,v-=F[0],v/=256,F[1]=v%256,v-=F[1],v/=256,F[2]=v%256,v-=F[2],v/=256,F[3]=v%256,v-=F[3],v/=256,u.HEAPU8.set(F,ae+4),v=ae,F=new Uint8Array(4),F[0]=v%256,v-=F[0],v/=256,F[1]=v%256,v-=F[1],v/=256,F[2]=v%256,v-=F[2],v/=256,F[3]=v%256,v-=F[3],v/=256,u.HEAPU8.set(F,j),j},10178620:(o,l,f,p)=>{var _=gt(o);if(typeof XMLHttpRequest>"u")return 0;let b=new XMLHttpRequest;b.open(gt(p),_,!1),b.responseType="arraybuffer";for(var y=0,v=l;y<v*2;){var g=c()[f/4+y>>>0],x=c()[f/4+y+1>>>0];try{var O=encodeURI(gt(g));O==="Host"&&(O="X-Host-Override"),O==="User-Agent"&&(O="X-user-agent"),O==="Authorization"?b.setRequestHeader(O,gt(x)):b.setRequestHeader(O,encodeURI(gt(x)))}catch(kt){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",kt)}y+=2}try{b.send(null)}catch(kt){return 0}if(b.status>=400)return 0;for(var z=b.response,v=z.byteLength,j=hr(v+4),mt=new Uint8Array(z),it=0;it<v;it++)u.HEAPU8[it+j+4]=mt[it];var F=new Uint8Array(4);return F[0]=v%256,v-=F[0],v/=256,F[1]=v%256,v-=F[1],v/=256,F[2]=v%256,v-=F[2],v/=256,F[3]=v%256,v-=F[3],v/=256,u.HEAPU8.set(F,j),j},10180027:(o,l,f,p,_,b)=>{var y=gt(o);if(typeof XMLHttpRequest>"u")return 0;let g=new XMLHttpRequest;g.open(gt(p),y,!1),g.responseType="arraybuffer";for(var x=0,F=l;x<F*2;){var O=c()[f/4+x>>>0],z=c()[f/4+x+1>>>0];try{var v=encodeURI(gt(O));v==="Host"&&(v="X-Host-Override"),v==="User-Agent"&&(v="X-user-agent"),v==="Authorization"?g.setRequestHeader(v,gt(z)):g.setRequestHeader(v,encodeURI(gt(z)))}catch(V){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",V)}x+=2}try{for(var j=new Uint8Array(b),mt=0;mt<b;mt++)j[mt]=u.HEAPU8[mt+_];g.send(j)}catch(V){return 0}if(g.status>=400)return 0;for(var it=g.response,F=it.byteLength,kt=hr(F+4),ae=new Uint8Array(it),mt=0;mt<F;mt++)u.HEAPU8[mt+kt+4]=ae[mt];var S=new Uint8Array(4);return S[0]=F%256,F-=S[0],F/=256,S[1]=F%256,F-=S[1],F/=256,S[2]=F%256,F-=S[2],F/=256,S[3]=F%256,F-=S[3],F/=256,u.HEAPU8.set(S,kt),kt}};function ma(o){this.name="ExitStatus",this.message="Program terminated with exit(".concat(o,")"),this.status=o}var _a=o=>{o.terminate(),o.onmessage=l=>{}},dh=o=>{var l=ct.pthreads[o];delete ct.pthreads[o],_a(l),Ua(o),ct.runningWorkers.splice(ct.runningWorkers.indexOf(l),1),l.pthread_ptr=0},fh=o=>{var l=ct.pthreads[o];l.postMessage({cmd:"cancel"})},cl=o=>{var l=ct.pthreads[o];ct.returnWorkerToPool(l)},ll=(o,l)=>(i().fill(0,o,o+l),o),ul=o=>{var l=ct.getNewWorker();if(!l)return 6;ct.runningWorkers.push(l),ct.pthreads[o.pthread_ptr]=l,l.pthread_ptr=o.pthread_ptr;var f={cmd:"run",start_routine:o.startRoutine,arg:o.arg,pthread_ptr:o.pthread_ptr};return xt&&l.unref(),l.postMessage(f,o.transferList),0},ya=0,ps=()=>pl||ya>0,ba=()=>Mu(),ms=o=>Eu(o),hh=o=>{var l=ba(),f=o();return ms(l),f},di=o=>Ou(o);u.stackAlloc=di;var Wr=(o,l)=>l+2097152>>>0<4194305-!!o?(o>>>0)+l*4294967296:NaN,ut=(o,l,f,...p)=>hh(()=>{for(var _=p.length,b=di(_*8),y=b>>>3,g=0;g<p.length;g++){var x=p[g];h()[y+g>>>0]=x}return Bu(o,l,_,b,f)});function dl(o){var l;if(U)return ut(0,0,1,o);se=o,ps()||(ct.terminateAllThreads(),(l=u.onExit)==null||l.call(u,o),ye=!0),Lt(o,new ma(o))}var fl=(o,l)=>{if(se=o,U)throw hl(o),"unwind";dl(o)},ga=fl,wa=o=>{if(o instanceof ma||o=="unwind")return se;Lt(1,o)},ct={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init(){U?ct.initWorker():ct.initMainThread()},initMainThread(){for(var o=4;o--;)ct.allocateUnusedWorker();tl(()=>{el("loading-workers"),ct.loadWasmModuleToAllWorkers(()=>rl("loading-workers"))})},initWorker(){pl=!1},setExitStatus:o=>se=o,terminateAllThreads__deps:["$terminateWorker"],terminateAllThreads:()=>{for(var o of ct.runningWorkers)_a(o);for(var o of ct.unusedWorkers)_a(o);ct.unusedWorkers=[],ct.runningWorkers=[],ct.pthreads=[]},returnWorkerToPool:o=>{var l=o.pthread_ptr;delete ct.pthreads[l],ct.unusedWorkers.push(o),ct.runningWorkers.splice(ct.runningWorkers.indexOf(o),1),o.pthread_ptr=0,Ua(l)},receiveObjectTransfer(o){},threadInitTLS(){ct.tlsInitFunctions.forEach(o=>o())},loadWasmModuleToWorker:o=>new Promise(l=>{o.onmessage=b=>{var y=b.data,g=y.cmd;if(y.targetThread&&y.targetThread!=Ss()){var x=ct.pthreads[y.targetThread];x?x.postMessage(y,y.transferList):pt('Internal error! Worker sent a message "'.concat(g,'" to target pthread ').concat(y.targetThread,", but that thread no longer exists!"));return}g==="checkMailbox"?vs():g==="spawnThread"?ul(y):g==="cleanupThread"?cl(y.thread):g==="killThread"?dh(y.thread):g==="cancelThread"?fh(y.thread):g==="loaded"?(o.loaded=!0,xt&&!o.pthread_ptr&&o.unref(),l(o)):g==="alert"?alert("Thread ".concat(y.threadId,": ").concat(y.text)):y.target==="setimmediate"?o.postMessage(y):g==="callHandler"?u[y.handler](...y.args):g&&pt("worker sent an unknown command ".concat(g))},o.onerror=b=>{var y="worker sent an error!";throw pt("".concat(y," ").concat(b.filename,":").concat(b.lineno,": ").concat(b.message)),b},xt&&(o.on("message",b=>o.onmessage({data:b})),o.on("error",b=>o.onerror(b)));var f=[],p=["onExit","onAbort","print","printErr"];for(var _ of p)u.hasOwnProperty(_)&&f.push(_);o.postMessage({cmd:"load",handlers:f,urlOrBlob:u.mainScriptUrlOrBlob||r,wasmMemory:Ut,wasmModule:vt})}),loadWasmModuleToAllWorkers(o){if(U)return o();Promise.all(ct.unusedWorkers.map(ct.loadWasmModuleToWorker)).then(o)},allocateUnusedWorker(){var o,l=M("duckdb_wasm.worker.js");o=new Worker(l),ct.unusedWorkers.push(o)},getNewWorker(){return ct.unusedWorkers.length==0&&(ct.allocateUnusedWorker(),ct.loadWasmModuleToWorker(ct.unusedWorkers[0])),ct.unusedWorkers.pop()}};u.PThread=ct;var _s=o=>{for(;o.length>0;)o.shift()(u)},ph=()=>{var o=Ss(),l=d()[o+52>>>2>>>0],f=d()[o+56>>>2>>>0],p=l-f;xu(l,p),ms(l)};u.establishStackSpace=ph;function hl(o){if(U)return ut(1,0,0,o);ga(o)}var ys=[],va,mh=o=>{var l=ys[o];return l||(o>=ys.length&&(ys.length=o+1),ys[o]=l=va.get(o)),l},_h=(o,l)=>{ya=0;var f=mh(o)(l);function p(_){ps()?ct.setExitStatus(_):Ra(_)}p(f)};u.invokeEntryPoint=_h;var pl=u.noExitRuntime||!0,yh=o=>ct.tlsInitFunctions.push(o);function bh(o){o>>>=0,Du(o,!bt,1,!Tt,1048576,!1),ct.threadInitTLS()}function gh(o){o>>>=0,U?postMessage({cmd:"cleanupThread",thread:o}):cl(o)}function ml(o,l,f,p){return U?ut(2,0,1,o,l,f,p):_l(o,l,f,p)}function _l(o,l,f,p){if(o>>>=0,l>>>=0,f>>>=0,p>>>=0,typeof SharedArrayBuffer>"u")return pt("Current environment does not support SharedArrayBuffer, pthreads are not available!"),6;var _=[],b=0;if(U&&(_.length===0||b))return ml(o,l,f,p);if(b)return b;var y={startRoutine:f,pthread_ptr:o,arg:p,transferList:_};return U?(y.cmd="spawnThread",postMessage(y,_),0):ul(y)}function yl(){Re("missing function: $SOCKFS")}yl.stub=!0;function Sa(){Re("missing function: $FS")}Sa.stub=!0;var Rn=o=>{var l=yl.getSocket(o);if(!l)throw new Sa.ErrnoError(8);return l},Ia=o=>(o&255)+"."+(o>>8&255)+"."+(o>>16&255)+"."+(o>>24&255),bl=o=>{var l="",f=0,p=0,_=0,b=0,y=0,g=0,x=[o[0]&65535,o[0]>>16,o[1]&65535,o[1]>>16,o[2]&65535,o[2]>>16,o[3]&65535,o[3]>>16],O=!0,z="";for(g=0;g<5;g++)if(x[g]!==0){O=!1;break}if(O){if(z=Ia(x[6]|x[7]<<16),x[5]===-1)return l="::ffff:",l+=z,l;if(x[5]===0)return l="::",z==="0.0.0.0"&&(z=""),z==="0.0.0.1"&&(z="1"),l+=z,l}for(f=0;f<8;f++)x[f]===0&&(f-_>1&&(y=0),_=f,y++),y>p&&(p=y,b=f-p+1);for(f=0;f<8;f++){if(p>1&&x[f]===0&&f>=b&&f<b+p){f===b&&(l+=":",b===0&&(l+=":"));continue}l+=Number(_ntohs(x[f]&65535)).toString(16),l+=f<7?":":""}return l},gl=(o,l)=>{var f=s()[o>>>1>>>0],p=_ntohs(a()[o+2>>>1>>>0]),_;switch(f){case 2:if(l!==16)return{errno:28};_=c()[o+4>>>2>>>0],_=Ia(_);break;case 10:if(l!==28)return{errno:28};_=[c()[o+8>>>2>>>0],c()[o+12>>>2>>>0],c()[o+16>>>2>>>0],c()[o+20>>>2>>>0]],_=bl(_);break;default:return{errno:5}}return{family:f,addr:_,port:p}},bs=o=>{for(var l=o.split("."),f=0;f<4;f++){var p=Number(l[f]);if(isNaN(p))return null;l[f]=p}return(l[0]|l[1]<<8|l[2]<<16|l[3]<<24)>>>0},gs=o=>parseInt(o),Da=o=>{var l,f,p,_,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(o))return null;if(o==="::")return[0,0,0,0,0,0,0,0];for(o.startsWith("::")?o=o.replace("::","Z:"):o=o.replace("::",":Z:"),o.indexOf(".")>0?(o=o.replace(new RegExp("[.]","g"),":"),l=o.split(":"),l[l.length-4]=gs(l[l.length-4])+gs(l[l.length-3])*256,l[l.length-3]=gs(l[l.length-2])+gs(l[l.length-1])*256,l=l.slice(0,l.length-2)):l=o.split(":"),p=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;p=_-1}else y[f+p]=_htons(parseInt(l[f],16));else y[f+p]=l[f];return[y[1]<<16|y[0],y[3]<<16|y[2],y[5]<<16|y[4],y[7]<<16|y[6]]},ge={address_map:{id:1,addrs:{},names:{}},lookup_name(o){var l=bs(o);if(l!==null||(l=Da(o),l!==null))return o;var f;if(ge.address_map.addrs[o])f=ge.address_map.addrs[o];else{var p=ge.address_map.id++;Vr(p<65535,"exceeded max address mappings of 65535"),f="172.29."+(p&255)+"."+(p&65280),ge.address_map.names[f]=o,ge.address_map.addrs[o]=f}return f},lookup_addr(o){return ge.address_map.names[o]?ge.address_map.names[o]:null}},wl=(o,l,f)=>{if(f&&o===0)return null;var p=gl(o,l);if(p.errno)throw new Sa.ErrnoError(p.errno);return p.addr=ge.lookup_addr(p.addr)||p.addr,p};function vl(o,l,f,p,_,b){if(U)return ut(3,0,1,o,l,f,p,_,b);l>>>=0,f>>>=0;var y=Rn(o),g=wl(l,f);return y.sock_ops.bind(y,g.addr,g.port),0}function Sl(o,l,f,p,_,b){if(U)return ut(4,0,1,o,l,f,p,_,b);l>>>=0,f>>>=0;var y=Rn(o),g=wl(l,f);return y.sock_ops.connect(y,g.addr,g.port),0}function Il(o,l,f){if(U)return ut(5,0,1,o,l,f)}function Dl(o,l,f,p){if(U)return ut(6,0,1,o,l,f,p);l>>>=0}var Bl=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0,Fl=(o,l,f)=>{l>>>=0;for(var p=l+f,_=l;o[_]&&!(_>=p);)++_;if(_-l>16&&o.buffer&&Bl)return Bl.decode(o.buffer instanceof SharedArrayBuffer?o.slice(l,_):o.subarray(l,_));for(var b="";l<_;){var y=o[l++];if(!(y&128)){b+=String.fromCharCode(y);continue}var g=o[l++]&63;if((y&224)==192){b+=String.fromCharCode((y&31)<<6|g);continue}var x=o[l++]&63;if((y&240)==224?y=(y&15)<<12|g<<6|x:y=(y&7)<<18|g<<12|x<<6|o[l++]&63,y<65536)b+=String.fromCharCode(y);else{var O=y-65536;b+=String.fromCharCode(55296|O>>10,56320|O&1023)}}return b},gt=(o,l)=>(o>>>=0,o?Fl(i(),o,l):""),Ba={varargs:void 0,getStr(o){var l=gt(o);return l}};function Al(o,l,f){return U?ut(7,0,1,o,l,f):(f>>>=0,Ba.varargs=f,0)}function Tl(o,l){if(U)return ut(8,0,1,o,l);l>>>=0}function xl(o,l,f){if(U)return ut(9,0,1,o,l,f);var p=Wr(l,f)}var Fa=o=>{for(var l=0,f=0;f<o.length;++f){var p=o.charCodeAt(f);p<=127?l++:p<=2047?l+=2:p>=55296&&p<=57343?(l+=4,++f):l+=3}return l};u.lengthBytesUTF8=Fa;var El=(o,l,f,p)=>{if(f>>>=0,!(p>0))return 0;for(var _=f,b=f+p-1,y=0;y<o.length;++y){var g=o.charCodeAt(y);if(g>=55296&&g<=57343){var x=o.charCodeAt(++y);g=65536+((g&1023)<<10)|x&1023}if(g<=127){if(f>=b)break;l[f++>>>0]=g}else if(g<=2047){if(f+1>=b)break;l[f++>>>0]=192|g>>6,l[f++>>>0]=128|g&63}else if(g<=65535){if(f+2>=b)break;l[f++>>>0]=224|g>>12,l[f++>>>0]=128|g>>6&63,l[f++>>>0]=128|g&63}else{if(f+3>=b)break;l[f++>>>0]=240|g>>18,l[f++>>>0]=128|g>>12&63,l[f++>>>0]=128|g>>6&63,l[f++>>>0]=128|g&63}}return l[f>>>0]=0,f-_},zr=(o,l,f)=>El(o,i(),l,f);u.stringToUTF8=zr;function Ol(o,l){if(U)return ut(10,0,1,o,l);o>>>=0,l>>>=0}function Ml(o,l,f){if(U)return ut(11,0,1,o,l,f);l>>>=0,f>>>=0}var ws=(o,l,f,p,_)=>{switch(l){case 2:f=bs(f),ll(o,16),_&&(c()[_>>>2>>>0]=16),s()[o>>>1>>>0]=l,c()[o+4>>>2>>>0]=f,s()[o+2>>>1>>>0]=_htons(p);break;case 10:f=Da(f),ll(o,28),_&&(c()[_>>>2>>>0]=28),c()[o>>>2>>>0]=l,c()[o+8>>>2>>>0]=f[0],c()[o+12>>>2>>>0]=f[1],c()[o+16>>>2>>>0]=f[2],c()[o+20>>>2>>>0]=f[3],s()[o+2>>>1>>>0]=_htons(p);break;default:return 5}return 0};function Ul(o,l,f,p,_,b){if(U)return ut(12,0,1,o,l,f,p,_,b);l>>>=0,f>>>=0;var y=Rn(o);if(!y.daddr)return-53;var g=ws(l,y.family,ge.lookup_name(y.daddr),y.dport,f);return 0}function Rl(o,l,f,p,_,b){if(U)return ut(13,0,1,o,l,f,p,_,b);l>>>=0,f>>>=0;var y=Rn(o),g=ws(l,y.family,ge.lookup_name(y.saddr||"0.0.0.0"),y.sport,f);return 0}function Ll(o,l,f,p,_,b){if(U)return ut(14,0,1,o,l,f,p,_,b);p>>>=0,_>>>=0;var y=Rn(o);return l===1&&f===4?(c()[p>>>2>>>0]=y.error,c()[_>>>2>>>0]=4,y.error=null,0):-50}function kl(o,l,f){return U?ut(15,0,1,o,l,f):(f>>>=0,Ba.varargs=f,0)}function Nl(o,l){if(U)return ut(16,0,1,o,l);o>>>=0,l>>>=0}function Cl(o,l,f){if(U)return ut(17,0,1,o,l,f);l>>>=0}function Pl(o,l,f,p){if(U)return ut(18,0,1,o,l,f,p);l>>>=0,f>>>=0}function Hl(o,l,f,p){if(U)return ut(19,0,1,o,l,f,p);l>>>=0,p>>>=0,Ba.varargs=p}function Vl(o,l,f){if(U)return ut(20,0,1,o,l,f);o>>>=0}function Wl(o,l,f,p){if(U)return ut(21,0,1,o,l,f,p);l>>>=0,f>>>=0,p>>>=0}function zl(o,l,f,p,_,b){if(U)return ut(22,0,1,o,l,f,p,_,b);l>>>=0,f>>>=0,_>>>=0,b>>>=0;var y=Rn(o),g=y.sock_ops.recvmsg(y,f);if(!g)return 0;if(_)var x=ws(_,y.family,ge.lookup_name(g.addr),g.port,b);return i().set(g.buffer,l>>>0),g.buffer.byteLength}function jl(o,l,f,p){if(U)return ut(23,0,1,o,l,f,p);l>>>=0,p>>>=0}function $l(o){if(U)return ut(24,0,1,o);o>>>=0}function Gl(o,l,f,p,_,b){if(U)return ut(25,0,1,o,l,f,p,_,b);l>>>=0,f>>>=0,_>>>=0,b>>>=0}function Yl(o,l,f){if(U)return ut(26,0,1,o,l,f)}function ql(o,l){if(U)return ut(27,0,1,o,l);o>>>=0,l>>>=0}function Kl(o,l,f){if(U)return ut(28,0,1,o,l,f);o>>>=0,l>>>=0,f>>>=0}function Jl(o,l,f){if(U)return ut(29,0,1,o,l,f);l>>>=0}var wh=1,vh=()=>wh,Sh=()=>{if(!ps())try{U?Ra(se):ga(se)}catch(o){wa(o)}},Ih=o=>{if(!ye)try{o(),Sh()}catch(l){wa(l)}};function Aa(o){if(o>>>=0,typeof Atomics.waitAsync=="function"){var l=Atomics.waitAsync(c(),o>>>2,o);l.value.then(vs);var f=o+128;Atomics.store(c(),f>>>2,1)}}u.__emscripten_thread_mailbox_await=Aa;var vs=()=>{var o=Ss();o&&(Aa(o),Ih(Fu))};u.checkMailbox=vs;function Dh(o,l,f){if(o>>>=0,l>>>=0,f>>>=0,o==l)setTimeout(vs);else if(U)postMessage({targetThread:o,cmd:"checkMailbox"});else{var p=ct.pthreads[o];if(!p)return;p.postMessage({cmd:"checkMailbox"})}}var Ta=[];function Bh(o,l,f,p,_){l>>>=0,f>>>=0,_>>>=0,Ta.length=p;for(var b=_>>>3,y=0;y<p;y++)Ta[y]=h()[b+y>>>0];var g=l?al[l]:Dp[o];ct.currentProxiedOperationCallerThread=f;var x=g(...Ta);return ct.currentProxiedOperationCallerThread=0,x}function Fh(o){if(o>>>=0,xt){if(!o)return 1;var l=gt(o);if(!l.length)return 0;var f=["child_process"].map(ka),p=f.spawnSync(l,[],{shell:!0,stdio:"inherit"}),_=(y,g)=>y<<8|g;if(p.status===null){var b=y=>{switch(y){case"SIGHUP":return 1;case"SIGINT":return 2;case"SIGQUIT":return 3;case"SIGFPE":return 8;case"SIGKILL":return 9;case"SIGALRM":return 14;case"SIGTERM":return 15}return 2};return _(0,b(p.signal))}return _(p.status,0)}return o?-52:0}function Ah(o){o>>>=0,xt&&ct.pthreads[o].ref()}function Xl(){Re("missing function: _emval_call_method")}Xl.stub=!0;function Zl(){Re("missing function: _emval_decref")}Zl.stub=!0;function Ql(){Re("missing function: _emval_get_global")}Ql.stub=!0;function tu(){Re("missing function: _emval_get_method_caller")}tu.stub=!0;function eu(){Re("missing function: _emval_run_destructors")}eu.stub=!0;function Th(o,l,f){var p=Wr(o,l);f>>>=0;var _=new Date(p*1e3);c()[f>>>2>>>0]=_.getUTCSeconds(),c()[f+4>>>2>>>0]=_.getUTCMinutes(),c()[f+8>>>2>>>0]=_.getUTCHours(),c()[f+12>>>2>>>0]=_.getUTCDate(),c()[f+16>>>2>>>0]=_.getUTCMonth(),c()[f+20>>>2>>>0]=_.getUTCFullYear()-1900,c()[f+24>>>2>>>0]=_.getUTCDay();var b=Date.UTC(_.getUTCFullYear(),0,1,0,0,0,0),y=(_.getTime()-b)/(1e3*60*60*24)|0;c()[f+28>>>2>>>0]=y}var fi=o=>o%4===0&&(o%100!==0||o%400===0),xh=[0,31,60,91,121,152,182,213,244,274,305,335],Eh=[0,31,59,90,120,151,181,212,243,273,304,334],ru=o=>{var l=fi(o.getFullYear()),f=l?xh:Eh,p=f[o.getMonth()]+o.getDate()-1;return p};function Oh(o,l,f){var p=Wr(o,l);f>>>=0;var _=new Date(p*1e3);c()[f>>>2>>>0]=_.getSeconds(),c()[f+4>>>2>>>0]=_.getMinutes(),c()[f+8>>>2>>>0]=_.getHours(),c()[f+12>>>2>>>0]=_.getDate(),c()[f+16>>>2>>>0]=_.getMonth(),c()[f+20>>>2>>>0]=_.getFullYear()-1900,c()[f+24>>>2>>>0]=_.getDay();var b=ru(_)|0;c()[f+28>>>2>>>0]=b,c()[f+36>>>2>>>0]=-(_.getTimezoneOffset()*60);var y=new Date(_.getFullYear(),0,1),g=new Date(_.getFullYear(),6,1).getTimezoneOffset(),x=y.getTimezoneOffset(),O=(g!=x&&_.getTimezoneOffset()==Math.min(x,g))|0;c()[f+32>>>2>>>0]=O}var xa=o=>Au(o),Mh=function(o){o>>>=0;var l=(()=>{var f=new Date(c()[o+20>>>2>>>0]+1900,c()[o+16>>>2>>>0],c()[o+12>>>2>>>0],c()[o+8>>>2>>>0],c()[o+4>>>2>>>0],c()[o>>>2>>>0],0),p=c()[o+32>>>2>>>0],_=f.getTimezoneOffset(),b=new Date(f.getFullYear(),0,1),y=new Date(f.getFullYear(),6,1).getTimezoneOffset(),g=b.getTimezoneOffset(),x=Math.min(g,y);if(p<0)c()[o+32>>>2>>>0]=+(y!=g&&x==_);else if(p>0!=(x==_)){var O=Math.max(g,y),z=p>0?x:O;f.setTime(f.getTime()+(z-_)*6e4)}c()[o+24>>>2>>>0]=f.getDay();var v=ru(f)|0;c()[o+28>>>2>>>0]=v,c()[o>>>2>>>0]=f.getSeconds(),c()[o+4>>>2>>>0]=f.getMinutes(),c()[o+8>>>2>>>0]=f.getHours(),c()[o+12>>>2>>>0]=f.getDate(),c()[o+16>>>2>>>0]=f.getMonth(),c()[o+20>>>2>>>0]=f.getYear();var j=f.getTime();return isNaN(j)?-1:j/1e3})();return xa((Qt=l,+Math.abs(Qt)>=1?Qt>0?+Math.floor(Qt/4294967296)>>>0:~~+Math.ceil((Qt-+(~~Qt>>>0))/4294967296)>>>0:0)),l>>>0};function nu(o,l,f,p,_,b,y,g){if(U)return ut(30,0,1,o,l,f,p,_,b,y,g);o>>>=0;var x=Wr(_,b);return y>>>=0,g>>>=0,-52}function iu(o,l,f,p,_,b,y){if(U)return ut(31,0,1,o,l,f,p,_,b,y);o>>>=0,l>>>=0;var g=Wr(b,y)}var Uh=function(o,l,f,p){o>>>=0,l>>>=0,f>>>=0,p>>>=0;var _=new Date().getFullYear(),b=new Date(_,0,1),y=new Date(_,6,1),g=b.getTimezoneOffset(),x=y.getTimezoneOffset(),O=Math.max(g,x);d()[o>>>2>>>0]=O*60,c()[l>>>2>>>0]=+(g!=x);var z=mt=>mt.toLocaleTimeString(void 0,{hour12:!1,timeZoneName:"short"}).split(" ")[1],v=z(b),j=z(y);x<g?(zr(v,f,17),zr(j,p,17)):(zr(v,p,17),zr(j,f,17))},Rh=()=>{Re("")};function Lh(o,l){return o>>>=0,globalThis.DUCKDB_RUNTIME.createDirectory(u,o,l)}function kh(o,l){return o>>>=0,globalThis.DUCKDB_RUNTIME.checkDirectory(u,o,l)}function Nh(o,l){return o>>>=0,globalThis.DUCKDB_RUNTIME.listDirectoryEntries(u,o,l)}function Ch(o,l){return o>>>=0,globalThis.DUCKDB_RUNTIME.removeDirectory(u,o,l)}function Ph(o){return globalThis.DUCKDB_RUNTIME.closeFile(u,o)}function Hh(o,l){return o>>>=0,globalThis.DUCKDB_RUNTIME.dropFile(u,o,l)}function Vh(o,l){return o>>>=0,globalThis.DUCKDB_RUNTIME.checkFile(u,o,l)}function Wh(o,l,f,p){return o>>>=0,f>>>=0,globalThis.DUCKDB_RUNTIME.moveFile(u,o,l,f,p)}function zh(o,l){return globalThis.DUCKDB_RUNTIME.openFile(u,o,l)}function jh(o,l,f,p){return l>>>=0,globalThis.DUCKDB_RUNTIME.readFile(u,o,l,f,p)}function $h(o,l){return globalThis.DUCKDB_RUNTIME.truncateFile(u,o,l)}function Gh(o,l,f,p){return l>>>=0,globalThis.DUCKDB_RUNTIME.writeFile(u,o,l,f,p)}function Yh(o){return globalThis.DUCKDB_RUNTIME.getDefaultDataProtocol(o)}function qh(o,l){return o>>>=0,globalThis.DUCKDB_RUNTIME.glob(u,o,l)}function Kh(o){return globalThis.DUCKDB_RUNTIME.testPlatformFeature(u,o)}function Jh(o,l,f,p,_,b){return o>>>=0,f>>>=0,_>>>=0,globalThis.DUCKDB_RUNTIME.callScalarUDF(u,o,l,f,p,_,b)}var Ea=[],Xh=(o,l)=>{Ea.length=0;for(var f;f=i()[o++>>>0];){var p=f!=105;p&=f!=112,l+=p&&l%8?4:0,Ea.push(f==112?d()[l>>>2>>>0]:f==105?c()[l>>>2>>>0]:h()[l>>>3>>>0]),l+=p?8:4}return Ea},Zh=(o,l,f)=>{var p=Xh(l,f);return al[o](...p)};function Qh(o,l,f){return o>>>=0,l>>>=0,f>>>=0,Zh(o,l,f)}var hi=o=>{hi.shown||(hi.shown={}),hi.shown[o]||(hi.shown[o]=1,xt&&(o="warning: "+o),pt(o))},tp=()=>{},ep=()=>Date.now(),rp=()=>{ya+=1},np=()=>{throw rp(),"unwind"},su=()=>4294901760;function ip(){return su()}var ou;ou=()=>performance.timeOrigin+performance.now();var sp=()=>xt?Vf().cpus().length:navigator.hardwareConcurrency,op=o=>{var l=Ut.buffer,f=(o-l.byteLength+65535)/65536;try{return Ut.grow(f),fr(),1}catch(p){}};function ap(o){o>>>=0;var l=i().length;if(o<=l)return!1;var f=su();if(o>f)return!1;for(var p=(x,O)=>x+(O-x%O)%O,_=1;_<=4;_*=2){var b=l*(1+.2/_);b=Math.min(b,o+100663296);var y=Math.min(f,p(Math.max(o,b),65536)),g=op(y);if(g)return!0}return!1}var Oa={},cp=()=>jt||"./this.program",pi=()=>{if(!pi.strings){var o=(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:o,_:cp()};for(var f in Oa)Oa[f]===void 0?delete l[f]:l[f]=Oa[f];var p=[];for(var f in l)p.push("".concat(f,"=").concat(l[f]));pi.strings=p}return pi.strings},lp=(o,l)=>{for(var f=0;f<o.length;++f)n()[l++>>>0]=o.charCodeAt(f);n()[l>>>0]=0},au=function(o,l){if(U)return ut(32,0,1,o,l);o>>>=0,l>>>=0;var f=0;return pi().forEach((p,_)=>{var b=l+f;d()[o+_*4>>>2>>>0]=b,lp(p,b),f+=p.length+1}),0},cu=function(o,l){if(U)return ut(33,0,1,o,l);o>>>=0,l>>>=0;var f=pi();d()[o>>>2>>>0]=f.length;var p=0;return f.forEach(_=>p+=_.length+1),d()[l>>>2>>>0]=p,0};function lu(o){return U?ut(34,0,1,o):52}function uu(o,l){if(U)return ut(35,0,1,o,l);l>>>=0;var f=0,p=0,_=0;{var b=2;o==0?f=2:(o==1||o==2)&&(f=64),_=1}return n()[l>>>0]=b,s()[l+2>>>1>>>0]=_,Un=[f>>>0,(Qt=f,+Math.abs(Qt)>=1?Qt>0?+Math.floor(Qt/4294967296)>>>0:~~+Math.ceil((Qt-+(~~Qt>>>0))/4294967296)>>>0:0)],c()[l+8>>>2>>>0]=Un[0],c()[l+12>>>2>>>0]=Un[1],Un=[p>>>0,(Qt=p,+Math.abs(Qt)>=1?Qt>0?+Math.floor(Qt/4294967296)>>>0:~~+Math.ceil((Qt-+(~~Qt>>>0))/4294967296)>>>0:0)],c()[l+16>>>2>>>0]=Un[0],c()[l+20>>>2>>>0]=Un[1],0}function du(o,l,f,p,_,b){if(U)return ut(36,0,1,o,l,f,p,_,b);l>>>=0,f>>>=0;var y=Wr(p,_);return b>>>=0,52}function fu(o,l,f,p,_,b){if(U)return ut(37,0,1,o,l,f,p,_,b);l>>>=0,f>>>=0;var y=Wr(p,_);return b>>>=0,52}function hu(o,l,f,p){return U?ut(38,0,1,o,l,f,p):(l>>>=0,f>>>=0,p>>>=0,52)}function pu(o,l,f,p,_){if(U)return ut(39,0,1,o,l,f,p,_);var b=Wr(l,f);return _>>>=0,70}function mu(o){return U?ut(40,0,1,o):52}var up=[null,[],[]],dp=(o,l)=>{var f=up[o];l===0||l===10?((o===1?Q:pt)(Fl(f,0)),f.length=0):f.push(l)};function _u(o,l,f,p){if(U)return ut(41,0,1,o,l,f,p);l>>>=0,f>>>=0,p>>>=0;for(var _=0,b=0;b<f;b++){var y=d()[l>>>2>>>0],g=d()[l+4>>>2>>>0];l+=8;for(var x=0;x<g;x++)dp(o,i()[y+x>>>0]);_+=g}return d()[p>>>2>>>0]=_,0}function yu(o,l,f,p){if(U)return ut(42,0,1,o,l,f,p);o>>>=0,l>>>=0,f>>>=0,p>>>=0;var _=0,b=0,y=0,g=0,x=0,O=0,z;function v(j,mt,it,F,kt,ae){var S,V,Wt,te;return V=j===10?28:16,kt=j===10?bl(kt):Ia(kt),S=hr(V),te=ws(S,j,kt,ae),Vr(!te),Wt=hr(32),c()[Wt+4>>>2>>>0]=j,c()[Wt+8>>>2>>>0]=mt,c()[Wt+12>>>2>>>0]=it,d()[Wt+24>>>2>>>0]=F,d()[Wt+20>>>2>>>0]=S,j===10?c()[Wt+16>>>2>>>0]=28:c()[Wt+16>>>2>>>0]=16,c()[Wt+28>>>2>>>0]=0,Wt}if(f&&(y=c()[f>>>2>>>0],g=c()[f+4>>>2>>>0],x=c()[f+8>>>2>>>0],O=c()[f+12>>>2>>>0]),x&&!O&&(O=x===2?17:6),!x&&O&&(x=O===17?2:1),O===0&&(O=6),x===0&&(x=1),!o&&!l)return-2;if(y&-1088||f!==0&&c()[f>>>2>>>0]&2&&!o)return-1;if(y&32)return-2;if(x!==0&&x!==1&&x!==2)return-7;if(g!==0&&g!==2&&g!==10)return-6;if(l&&(l=gt(l),b=parseInt(l,10),isNaN(b)))return y&1024?-2:-8;if(!o)return g===0&&(g=2),y&1||(g===2?_=_htonl(2130706433):_=[0,0,0,1]),z=v(g,x,O,null,_,b),d()[p>>>2>>>0]=z,0;if(o=gt(o),_=bs(o),_!==null)if(g===0||g===2)g=2;else if(g===10&&y&8)_=[0,0,_htonl(65535),_],g=10;else return-2;else if(_=Da(o),_!==null)if(g===0||g===10)g=10;else return-2;return _!=null?(z=v(g,x,O,o,_,b),d()[p>>>2>>>0]=z,0):y&4?-2:(o=ge.lookup_name(o),_=bs(o),g===0?g=2:g===10&&(_=[0,0,_htonl(65535),_]),z=v(g,x,O,null,_,b),d()[p>>>2>>>0]=z,0)}var fp=()=>{if(typeof crypto=="object"&&typeof crypto.getRandomValues=="function")return p=>(p.set(crypto.getRandomValues(new Uint8Array(p.byteLength))),p);if(xt)try{var o=ka("crypto"),l=o.randomFillSync;if(l)return p=>o.randomFillSync(p);var f=o.randomBytes;return p=>(p.set(f(p.byteLength)),p)}catch(p){}Re("initRandomDevice")},bu=o=>(bu=fp())(o);function hp(o,l){return o>>>=0,l>>>=0,bu(i().subarray(o>>>0,o+l>>>0)),0}function pp(o,l,f,p,_,b,y){o>>>=0,f>>>=0,_>>>=0;var g=gl(o,l);if(g.errno)return-6;var x=g.port,O=g.addr,z=!1;if(f&&p){var v;if(y&1||!(v=ge.lookup_addr(O))){if(y&8)return-2}else O=v;var j=zr(O,f,p);j+1>=p&&(z=!0)}if(_&&b){x=""+x;var j=zr(x,_,b);j+1>=b&&(z=!0)}return z?-12:0}var mp=(o,l)=>{for(var f=0,p=0;p<=l;f+=o[p++]);return f},gu=[31,29,31,30,31,30,31,31,30,31,30,31],wu=[31,28,31,30,31,30,31,31,30,31,30,31],_p=(o,l)=>{for(var f=new Date(o.getTime());l>0;){var p=fi(f.getFullYear()),_=f.getMonth(),b=(p?gu:wu)[_];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};function yp(o,l,f){var p=f>0?f:Fa(o)+1,_=new Array(p),b=El(o,_,0,_.length);return l&&(_.length=b),_}var vu=(o,l)=>{n().set(o,l>>>0)};function Su(o,l,f,p){o>>>=0,l>>>=0,f>>>=0,p>>>=0;var _=d()[p+40>>>2>>>0],b={tm_sec:c()[p>>>2>>>0],tm_min:c()[p+4>>>2>>>0],tm_hour:c()[p+8>>>2>>>0],tm_mday:c()[p+12>>>2>>>0],tm_mon:c()[p+16>>>2>>>0],tm_year:c()[p+20>>>2>>>0],tm_wday:c()[p+24>>>2>>>0],tm_yday:c()[p+28>>>2>>>0],tm_isdst:c()[p+32>>>2>>>0],tm_gmtoff:c()[p+36>>>2>>>0],tm_zone:_?gt(_):""},y=gt(f),g={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var x in g)y=y.replace(new RegExp(x,"g"),g[x]);var O=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],z=["January","February","March","April","May","June","July","August","September","October","November","December"];function v(S,V,Wt){for(var te=typeof S=="number"?S.toString():S||"";te.length<V;)te=Wt[0]+te;return te}function j(S,V){return v(S,V,"0")}function mt(S,V){function Wt(Ds){return Ds<0?-1:Ds>0?1:0}var te;return(te=Wt(S.getFullYear()-V.getFullYear()))===0&&(te=Wt(S.getMonth()-V.getMonth()))===0&&(te=Wt(S.getDate()-V.getDate())),te}function it(S){switch(S.getDay()){case 0:return new Date(S.getFullYear()-1,11,29);case 1:return S;case 2:return new Date(S.getFullYear(),0,3);case 3:return new Date(S.getFullYear(),0,2);case 4:return new Date(S.getFullYear(),0,1);case 5:return new Date(S.getFullYear()-1,11,31);case 6:return new Date(S.getFullYear()-1,11,30)}}function F(S){var V=_p(new Date(S.tm_year+1900,0,1),S.tm_yday),Wt=new Date(V.getFullYear(),0,4),te=new Date(V.getFullYear()+1,0,4),Ds=it(Wt),Im=it(te);return mt(Ds,V)<=0?mt(Im,V)<=0?V.getFullYear()+1:V.getFullYear():V.getFullYear()-1}var kt={"%a":S=>O[S.tm_wday].substring(0,3),"%A":S=>O[S.tm_wday],"%b":S=>z[S.tm_mon].substring(0,3),"%B":S=>z[S.tm_mon],"%C":S=>{var V=S.tm_year+1900;return j(V/100|0,2)},"%d":S=>j(S.tm_mday,2),"%e":S=>v(S.tm_mday,2," "),"%g":S=>F(S).toString().substring(2),"%G":F,"%H":S=>j(S.tm_hour,2),"%I":S=>{var V=S.tm_hour;return V==0?V=12:V>12&&(V-=12),j(V,2)},"%j":S=>j(S.tm_mday+mp(fi(S.tm_year+1900)?gu:wu,S.tm_mon-1),3),"%m":S=>j(S.tm_mon+1,2),"%M":S=>j(S.tm_min,2),"%n":()=>"\n","%p":S=>S.tm_hour>=0&&S.tm_hour<12?"AM":"PM","%S":S=>j(S.tm_sec,2),"%t":()=>" ","%u":S=>S.tm_wday||7,"%U":S=>{var V=S.tm_yday+7-S.tm_wday;return j(Math.floor(V/7),2)},"%V":S=>{var V=Math.floor((S.tm_yday+7-(S.tm_wday+6)%7)/7);if((S.tm_wday+371-S.tm_yday-2)%7<=2&&V++,V){if(V==53){var te=(S.tm_wday+371-S.tm_yday)%7;te!=4&&(te!=3||!fi(S.tm_year))&&(V=1)}}else{V=52;var Wt=(S.tm_wday+7-S.tm_yday-1)%7;(Wt==4||Wt==5&&fi(S.tm_year%400-1))&&V++}return j(V,2)},"%w":S=>S.tm_wday,"%W":S=>{var V=S.tm_yday+7-(S.tm_wday+6)%7;return j(Math.floor(V/7),2)},"%y":S=>(S.tm_year+1900).toString().substring(2),"%Y":S=>S.tm_year+1900,"%z":S=>{var V=S.tm_gmtoff,Wt=V>=0;return V=Math.abs(V)/60,V=V/60*100+V%60,(Wt?"+":"-")+("0000"+V).slice(-4)},"%Z":S=>S.tm_zone,"%%":()=>"%"};y=y.replace(/%%/g,"\0\0");for(var x in kt)y.includes(x)&&(y=y.replace(new RegExp(x,"g"),kt[x](b)));y=y.replace(/\0\0/g,"%");var ae=yp(y,!1);return ae.length>l?0:(vu(ae,o),ae.length-1)}function bp(o,l,f,p,_){return o>>>=0,l>>>=0,f>>>=0,p>>>=0,_>>>=0,Su(o,l,f,p)}var gp=o=>{var l=u["_"+o];return l},wp=o=>{var l=Fa(o)+1,f=di(l);return zr(o,f,l),f},vp=(o,l,f,p,_)=>{var b={string:it=>{var F=0;return it!=null&&it!==0&&(F=wp(it)),F},array:it=>{var F=di(it.length);return vu(it,F),F}};function y(it){return l==="string"?gt(it):l==="boolean"?!!it:it}var g=gp(o),x=[],O=0;if(p)for(var z=0;z<p.length;z++){var v=b[f[z]];v?(O===0&&(O=ba()),x[z]=v(p[z])):x[z]=p[z]}var j=g(...x);function mt(it){return O!==0&&ms(O),y(it)}return j=mt(j),j},Ln=(o,l)=>{o<128?l.push(o):l.push(o%128|128,o>>7)},Ma=(o,l)=>{var f=o.slice(0,1),p=o.slice(1),_={i:127,p:127,j:126,f:125,d:124,e:111};l.push(96),Ln(p.length,l);for(var b=0;b<p.length;++b)l.push(_[p[b]]);f=="v"?l.push(0):l.push(1,_[f])},Sp=o=>{var l=[],f=[0,97,115,109,1,0,0,0];l.push(f);var p=[o[0].replace("j","i"),"i",o.slice(1).replace(/j/g,"ii")].join(""),_=[3];Ma(p,_),Ma(o,_),Ma("vi",_);var b=[1];Ln(_.length,b),b.push(..._),l.push(b);var y=[2,15,2,1,101,1,116,1,112,0,0,1,101,1,114,0,2];l.push(y);var g=[3,2,1,0];l.push(g);var x=[7,5,1,1,102,0,1];l.push(x);var O=[];o[0]==="j"?O=[1,1,126]:O.push(0);function z(V){O.push(32),Ln(V,O)}for(var v=1,j=1;j<o.length;j++)o[j]=="j"?(z(v+1),O.push(173,66,32,134),z(v),O.push(172,132),v+=2):(z(v),v++);O.push(32,0,17,1,0),o[0]==="j"&&(O.push(34),Ln(v,O),O.push(66,32,136,167,16,0),z(v),O.push(167)),O.push(11);var mt=[1];Ln(O.length,mt),mt.push(...O);var it=[10];Ln(mt.length,it),it.push(...mt),l.push(it);var F=new Uint8Array([].concat.apply([],l)),kt=new WebAssembly.Module(F),ae=new WebAssembly.Instance(kt,{e:{t:va,r:xa}}),S=ae.exports.f;return S},Ip=o=>Tu();ct.init();var Dp=[dl,hl,ml,vl,Sl,Il,Dl,Al,Tl,xl,Ol,Ml,Ul,Rl,Ll,kl,Nl,Cl,Pl,Hl,Vl,Wl,zl,jl,$l,Gl,Yl,ql,Kl,Jl,nu,iu,au,cu,lu,uu,du,fu,hu,pu,mu,_u,yu],Bp={$:bh,y:gh,Ba:_l,ua:vl,Aa:Sl,R:Il,oa:Dl,e:Al,na:Tl,B:xl,pa:Ol,ia:Ml,ta:Ul,sa:Rl,xa:Ll,m:kl,ka:Nl,ja:Cl,la:Pl,n:Hl,ya:Vl,s:Wl,va:zl,fa:jl,t:$l,wa:Gl,x:Yl,ma:ql,qa:Kl,l:Jl,Ia:vh,za:Dh,ha:Bh,P:Fh,S:Aa,J:Ah,M:Xl,p:Zl,O:Ql,N:tu,L:eu,E:Th,F:Oh,G:Mh,H:nu,I:iu,ra:Uh,b:Rh,Y:Lh,Z:kh,W:Nh,X:Ch,r:Ph,ba:Hh,U:Vh,V:Wh,aa:zh,j:jh,_:$h,k:Gh,ca:Yh,T:qh,q:Kh,da:Jh,h:Qh,u:tp,i:ep,A:np,Ca:ip,f:ou,Da:sp,Ha:ap,Ea:au,Fa:cu,c:ga,g:lu,Ga:uu,D:du,C:fu,z:hu,K:pu,ga:mu,o:_u,w:yu,ea:hp,v:pp,a:Ut||u.wasmMemory,Q:Su,d:bp},R=uh(),Iu=u._main=(o,l)=>(Iu=u._main=R.Ka)(o,l),Fp=u._duckdb_web_fs_glob_add_path=o=>(Fp=u._duckdb_web_fs_glob_add_path=R.Ma)(o),Ap=u._duckdb_web_clear_response=()=>(Ap=u._duckdb_web_clear_response=R.Na)(),Tp=u._duckdb_web_fail_with=o=>(Tp=u._duckdb_web_fail_with=R.Oa)(o),xp=u._duckdb_web_reset=o=>(xp=u._duckdb_web_reset=R.Pa)(o),Ep=u._duckdb_web_connect=()=>(Ep=u._duckdb_web_connect=R.Qa)(),Op=u._duckdb_web_disconnect=o=>(Op=u._duckdb_web_disconnect=R.Ra)(o),Mp=u._duckdb_web_flush_files=()=>(Mp=u._duckdb_web_flush_files=R.Sa)(),Up=u._duckdb_web_flush_file=o=>(Up=u._duckdb_web_flush_file=R.Ta)(o),Rp=u._duckdb_web_open=(o,l)=>(Rp=u._duckdb_web_open=R.Ua)(o,l),Lp=u._duckdb_web_get_global_file_info=(o,l)=>(Lp=u._duckdb_web_get_global_file_info=R.Va)(o,l),kp=u._duckdb_web_collect_file_stats=(o,l,f)=>(kp=u._duckdb_web_collect_file_stats=R.Wa)(o,l,f),Np=u._duckdb_web_export_file_stats=(o,l)=>(Np=u._duckdb_web_export_file_stats=R.Xa)(o,l),Cp=u._duckdb_web_fs_drop_file=(o,l)=>(Cp=u._duckdb_web_fs_drop_file=R.Ya)(o,l),Pp=u._duckdb_web_fs_drop_files=(o,l,f)=>(Pp=u._duckdb_web_fs_drop_files=R.Za)(o,l,f),Hp=u._duckdb_web_fs_glob_file_infos=(o,l)=>(Hp=u._duckdb_web_fs_glob_file_infos=R._a)(o,l),Vp=u._duckdb_web_fs_get_file_info_by_id=(o,l,f)=>(Vp=u._duckdb_web_fs_get_file_info_by_id=R.$a)(o,l,f),Wp=u._duckdb_web_fs_get_file_info_by_name=(o,l,f)=>(Wp=u._duckdb_web_fs_get_file_info_by_name=R.ab)(o,l,f),zp=u._duckdb_web_fs_register_file_url=(o,l,f,p,_)=>(zp=u._duckdb_web_fs_register_file_url=R.bb)(o,l,f,p,_),jp=u._duckdb_web_fs_register_file_buffer=(o,l,f,p)=>(jp=u._duckdb_web_fs_register_file_buffer=R.cb)(o,l,f,p),$p=u._duckdb_web_copy_file_to_buffer=(o,l)=>($p=u._duckdb_web_copy_file_to_buffer=R.db)(o,l),Gp=u._duckdb_web_copy_file_to_path=(o,l,f)=>(Gp=u._duckdb_web_copy_file_to_path=R.eb)(o,l,f),Yp=u._duckdb_web_get_version=o=>(Yp=u._duckdb_web_get_version=R.fb)(o),qp=u._duckdb_web_get_feature_flags=()=>(qp=u._duckdb_web_get_feature_flags=R.gb)(),Kp=u._duckdb_web_tokenize=(o,l)=>(Kp=u._duckdb_web_tokenize=R.hb)(o,l),Jp=u._duckdb_web_tokenize_buffer=(o,l,f)=>(Jp=u._duckdb_web_tokenize_buffer=R.ib)(o,l,f),Xp=u._duckdb_web_udf_scalar_create=(o,l,f)=>(Xp=u._duckdb_web_udf_scalar_create=R.jb)(o,l,f),Zp=u._duckdb_web_prepared_create=(o,l,f)=>(Zp=u._duckdb_web_prepared_create=R.kb)(o,l,f),Qp=u._duckdb_web_prepared_create_buffer=(o,l,f,p)=>(Qp=u._duckdb_web_prepared_create_buffer=R.lb)(o,l,f,p),tm=u._duckdb_web_prepared_close=(o,l,f)=>(tm=u._duckdb_web_prepared_close=R.mb)(o,l,f),em=u._duckdb_web_prepared_run=(o,l,f,p)=>(em=u._duckdb_web_prepared_run=R.nb)(o,l,f,p),rm=u._duckdb_web_prepared_send=(o,l,f,p)=>(rm=u._duckdb_web_prepared_send=R.ob)(o,l,f,p),nm=u._duckdb_web_query_run=(o,l,f)=>(nm=u._duckdb_web_query_run=R.pb)(o,l,f),im=u._duckdb_web_query_run_buffer=(o,l,f,p)=>(im=u._duckdb_web_query_run_buffer=R.qb)(o,l,f,p),sm=u._duckdb_web_pending_query_start=(o,l,f,p)=>(sm=u._duckdb_web_pending_query_start=R.rb)(o,l,f,p),om=u._duckdb_web_pending_query_start_buffer=(o,l,f,p,_)=>(om=u._duckdb_web_pending_query_start_buffer=R.sb)(o,l,f,p,_),am=u._duckdb_web_pending_query_poll=(o,l,f)=>(am=u._duckdb_web_pending_query_poll=R.tb)(o,l,f),cm=u._duckdb_web_pending_query_cancel=(o,l)=>(cm=u._duckdb_web_pending_query_cancel=R.ub)(o,l),lm=u._duckdb_web_query_fetch_results=(o,l)=>(lm=u._duckdb_web_query_fetch_results=R.vb)(o,l),um=u._duckdb_web_get_tablenames=(o,l,f)=>(um=u._duckdb_web_get_tablenames=R.wb)(o,l,f),dm=u._duckdb_web_get_tablenames_buffer=(o,l,f,p)=>(dm=u._duckdb_web_get_tablenames_buffer=R.xb)(o,l,f,p),fm=u._duckdb_web_insert_arrow_from_ipc_stream=(o,l,f,p,_)=>(fm=u._duckdb_web_insert_arrow_from_ipc_stream=R.yb)(o,l,f,p,_),hm=u._duckdb_web_insert_csv_from_path=(o,l,f,p)=>(hm=u._duckdb_web_insert_csv_from_path=R.zb)(o,l,f,p),pm=u._duckdb_web_insert_json_from_path=(o,l,f,p)=>(pm=u._duckdb_web_insert_json_from_path=R.Ab)(o,l,f,p),mm=u.__emscripten_tls_init=()=>(mm=u.__emscripten_tls_init=R.Bb)(),Ss=u._pthread_self=()=>(Ss=u._pthread_self=R.Cb)(),Du=u.__emscripten_thread_init=(o,l,f,p,_,b)=>(Du=u.__emscripten_thread_init=R.Db)(o,l,f,p,_,b),_m=u.__emscripten_thread_crashed=()=>(_m=u.__emscripten_thread_crashed=R.Eb)(),ym=()=>(ym=R.emscripten_main_runtime_thread_id)(),bm=()=>(bm=R.emscripten_main_thread_process_queued_calls)(),Bu=(o,l,f,p,_)=>(Bu=R.Ib)(o,l,f,p,_),Ua=o=>(Ua=R.Jb)(o),Ra=u.__emscripten_thread_exit=o=>(Ra=u.__emscripten_thread_exit=R.Kb)(o),Fu=()=>(Fu=R.Lb)(),hr=u._malloc=o=>(hr=u._malloc=R.Mb)(o),gm=u._free=o=>(gm=u._free=R.Nb)(o),wm=u._calloc=(o,l)=>(wm=u._calloc=R.Ob)(o,l),Au=o=>(Au=R.Qb)(o),Tu=()=>(Tu=R.Rb)(),xu=(o,l)=>(xu=R.Sb)(o,l),Eu=o=>(Eu=R.Tb)(o),Ou=o=>(Ou=R.Ub)(o),Mu=()=>(Mu=R.Vb)();function vm(o){o=Object.assign({},o);var l=p=>()=>p()>>>0,f=p=>_=>p(_)>>>0;return o.Cb=l(o.Cb),o.emscripten_main_runtime_thread_id=l(o.emscripten_main_runtime_thread_id),o.Mb=f(o.Mb),o.Ub=f(o.Ub),o.Vb=l(o.Vb),o}u.wasmMemory=Ut,u.stackSave=ba,u.stackRestore=ms,u.stackAlloc=di,u.getTempRet0=Ip,u.setTempRet0=xa,u.keepRuntimeAlive=ps,u.ccall=vp,u.ExitStatus=ma,u.createDyncallWrapper=Sp,u.PThread=ct;var Is;ui=function o(){Is||Uu(),Is||(ui=o)};function Sm(){var o=Iu,l=0,f=0;try{var p=o(l,f);return fl(p,!0),p}catch(_){return wa(_)}}function Uu(){if(ln>0)return;if(U){I(u),Qc(),startWorker(u);return}if(rh(),ln>0)return;function o(){Is||(Is=!0,u.calledRun=!0,!ye&&(Qc(),nh(),I(u),u.onRuntimeInitialized&&u.onRuntimeInitialized(),Ru&&Sm(),ih()))}u.setStatus?(u.setStatus("Running..."),setTimeout(function(){setTimeout(function(){u.setStatus("")},1),o()},1)):o()}if(u.preInit)for(typeof u.preInit=="function"&&(u.preInit=[u.preInit]);u.preInit.length>0;)u.preInit.pop()();var Ru=!0;return u.noInitialRun&&(Ru=!1),Uu(),E}})();typeof zf=="object"&&typeof Wc=="object"?Wc.exports=Wf:typeof define=="function"&&define.amd&&define([],()=>Wf)});var Gf=pr(()=>{});var Yf=pr(()=>{});var qf=pr((mF,ha)=>{(function(){"use strict";var r="input is invalid type",t=typeof window=="object",e=t?window:{};e.JS_SHA256_NO_WINDOW&&(t=!1);var n=!t&&typeof self=="object",i=!e.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node&&process.type!="renderer";i?e=global:n&&(e=self);var s=!e.JS_SHA256_NO_COMMON_JS&&typeof ha=="object"&&ha.exports,a=typeof define=="function"&&define.amd,c=!e.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",d="0123456789abcdef".split(""),h=[-2147483648,8388608,32768,128],u=[24,16,8,0],I=[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],T=["hex","array","digest","arrayBuffer"],E=[];(e.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(w){return Object.prototype.toString.call(w)==="[object Array]"}),c&&(e.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(w){return typeof w=="object"&&w.buffer&&w.buffer.constructor===ArrayBuffer});var ft=function(w,M){return function(H){return new bt(M,!0).update(H)[w]()}},At=function(w){var M=ft("hex",w);i&&(M=jt(M,w)),M.create=function(){return new bt(w)},M.update=function(N){return M.create().update(N)};for(var H=0;H<T.length;++H){var D=T[H];M[D]=ft(D,w)}return M},jt=function(w,M){var H=Gf(),D=Yf().Buffer,N=M?"sha224":"sha256",A;D.from&&!e.JS_SHA256_NO_BUFFER_FROM?A=D.from:A=function(B){return new D(B)};var J=function(B){if(typeof B=="string")return H.createHash(N).update(B,"utf8").digest("hex");if(B==null)throw new Error(r);return B.constructor===ArrayBuffer&&(B=new Uint8Array(B)),Array.isArray(B)||ArrayBuffer.isView(B)||B.constructor===D?H.createHash(N).update(A(B)).digest("hex"):w(B)};return J},Lt=function(w,M){return function(H,D){return new xt(H,M,!0).update(D)[w]()}},Tt=function(w){var M=Lt("hex",w);M.create=function(N){return new xt(N,w)},M.update=function(N,A){return M.create(N).update(A)};for(var H=0;H<T.length;++H){var D=T[H];M[D]=Lt(D,w)}return M};function bt(w,M){M?(E[0]=E[16]=E[1]=E[2]=E[3]=E[4]=E[5]=E[6]=E[7]=E[8]=E[9]=E[10]=E[11]=E[12]=E[13]=E[14]=E[15]=0,this.blocks=E):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],w?(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=w}bt.prototype.update=function(w){if(!this.finalized){var M,H=typeof w;if(H!=="string"){if(H==="object"){if(w===null)throw new Error(r);if(c&&w.constructor===ArrayBuffer)w=new Uint8Array(w);else if(!Array.isArray(w)&&(!c||!ArrayBuffer.isView(w)))throw new Error(r)}else throw new Error(r);M=!0}for(var D,N=0,A,J=w.length,B=this.blocks;N<J;){if(this.hashed&&(this.hashed=!1,B[0]=this.block,this.block=B[16]=B[1]=B[2]=B[3]=B[4]=B[5]=B[6]=B[7]=B[8]=B[9]=B[10]=B[11]=B[12]=B[13]=B[14]=B[15]=0),M)for(A=this.start;N<J&&A<64;++N)B[A>>>2]|=w[N]<<u[A++&3];else for(A=this.start;N<J&&A<64;++N)D=w.charCodeAt(N),D<128?B[A>>>2]|=D<<u[A++&3]:D<2048?(B[A>>>2]|=(192|D>>>6)<<u[A++&3],B[A>>>2]|=(128|D&63)<<u[A++&3]):D<55296||D>=57344?(B[A>>>2]|=(224|D>>>12)<<u[A++&3],B[A>>>2]|=(128|D>>>6&63)<<u[A++&3],B[A>>>2]|=(128|D&63)<<u[A++&3]):(D=65536+((D&1023)<<10|w.charCodeAt(++N)&1023),B[A>>>2]|=(240|D>>>18)<<u[A++&3],B[A>>>2]|=(128|D>>>12&63)<<u[A++&3],B[A>>>2]|=(128|D>>>6&63)<<u[A++&3],B[A>>>2]|=(128|D&63)<<u[A++&3]);this.lastByteIndex=A,this.bytes+=A-this.start,A>=64?(this.block=B[16],this.start=A-64,this.hash(),this.hashed=!0):this.start=A}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},bt.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var w=this.blocks,M=this.lastByteIndex;w[16]=this.block,w[M>>>2]|=h[M&3],this.block=w[16],M>=56&&(this.hashed||this.hash(),w[0]=this.block,w[16]=w[1]=w[2]=w[3]=w[4]=w[5]=w[6]=w[7]=w[8]=w[9]=w[10]=w[11]=w[12]=w[13]=w[14]=w[15]=0),w[14]=this.hBytes<<3|this.bytes>>>29,w[15]=this.bytes<<3,this.hash()}},bt.prototype.hash=function(){var w=this.h0,M=this.h1,H=this.h2,D=this.h3,N=this.h4,A=this.h5,J=this.h6,B=this.h7,W=this.blocks,Q,pt,Ht,Ut,vt,ye,se,Vr,be,On,cn;for(Q=16;Q<64;++Q)vt=W[Q-15],pt=(vt>>>7|vt<<25)^(vt>>>18|vt<<14)^vt>>>3,vt=W[Q-2],Ht=(vt>>>17|vt<<15)^(vt>>>19|vt<<13)^vt>>>10,W[Q]=W[Q-16]+pt+W[Q-7]+Ht<<0;for(cn=M&H,Q=0;Q<64;Q+=4)this.first?(this.is224?(Vr=300032,vt=W[0]-1413257819,B=vt-150054599<<0,D=vt+24177077<<0):(Vr=704751109,vt=W[0]-210244248,B=vt-1521486534<<0,D=vt+143694565<<0),this.first=!1):(pt=(w>>>2|w<<30)^(w>>>13|w<<19)^(w>>>22|w<<10),Ht=(N>>>6|N<<26)^(N>>>11|N<<21)^(N>>>25|N<<7),Vr=w&M,Ut=Vr^w&H^cn,se=N&A^~N&J,vt=B+Ht+se+I[Q]+W[Q],ye=pt+Ut,B=D+vt<<0,D=vt+ye<<0),pt=(D>>>2|D<<30)^(D>>>13|D<<19)^(D>>>22|D<<10),Ht=(B>>>6|B<<26)^(B>>>11|B<<21)^(B>>>25|B<<7),be=D&w,Ut=be^D&M^Vr,se=B&N^~B&A,vt=J+Ht+se+I[Q+1]+W[Q+1],ye=pt+Ut,J=H+vt<<0,H=vt+ye<<0,pt=(H>>>2|H<<30)^(H>>>13|H<<19)^(H>>>22|H<<10),Ht=(J>>>6|J<<26)^(J>>>11|J<<21)^(J>>>25|J<<7),On=H&D,Ut=On^H&w^be,se=J&B^~J&N,vt=A+Ht+se+I[Q+2]+W[Q+2],ye=pt+Ut,A=M+vt<<0,M=vt+ye<<0,pt=(M>>>2|M<<30)^(M>>>13|M<<19)^(M>>>22|M<<10),Ht=(A>>>6|A<<26)^(A>>>11|A<<21)^(A>>>25|A<<7),cn=M&H,Ut=cn^M&D^On,se=A&J^~A&B,vt=N+Ht+se+I[Q+3]+W[Q+3],ye=pt+Ut,N=w+vt<<0,w=vt+ye<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+w<<0,this.h1=this.h1+M<<0,this.h2=this.h2+H<<0,this.h3=this.h3+D<<0,this.h4=this.h4+N<<0,this.h5=this.h5+A<<0,this.h6=this.h6+J<<0,this.h7=this.h7+B<<0},bt.prototype.hex=function(){this.finalize();var w=this.h0,M=this.h1,H=this.h2,D=this.h3,N=this.h4,A=this.h5,J=this.h6,B=this.h7,W=d[w>>>28&15]+d[w>>>24&15]+d[w>>>20&15]+d[w>>>16&15]+d[w>>>12&15]+d[w>>>8&15]+d[w>>>4&15]+d[w&15]+d[M>>>28&15]+d[M>>>24&15]+d[M>>>20&15]+d[M>>>16&15]+d[M>>>12&15]+d[M>>>8&15]+d[M>>>4&15]+d[M&15]+d[H>>>28&15]+d[H>>>24&15]+d[H>>>20&15]+d[H>>>16&15]+d[H>>>12&15]+d[H>>>8&15]+d[H>>>4&15]+d[H&15]+d[D>>>28&15]+d[D>>>24&15]+d[D>>>20&15]+d[D>>>16&15]+d[D>>>12&15]+d[D>>>8&15]+d[D>>>4&15]+d[D&15]+d[N>>>28&15]+d[N>>>24&15]+d[N>>>20&15]+d[N>>>16&15]+d[N>>>12&15]+d[N>>>8&15]+d[N>>>4&15]+d[N&15]+d[A>>>28&15]+d[A>>>24&15]+d[A>>>20&15]+d[A>>>16&15]+d[A>>>12&15]+d[A>>>8&15]+d[A>>>4&15]+d[A&15]+d[J>>>28&15]+d[J>>>24&15]+d[J>>>20&15]+d[J>>>16&15]+d[J>>>12&15]+d[J>>>8&15]+d[J>>>4&15]+d[J&15];return this.is224||(W+=d[B>>>28&15]+d[B>>>24&15]+d[B>>>20&15]+d[B>>>16&15]+d[B>>>12&15]+d[B>>>8&15]+d[B>>>4&15]+d[B&15]),W},bt.prototype.toString=bt.prototype.hex,bt.prototype.digest=function(){this.finalize();var w=this.h0,M=this.h1,H=this.h2,D=this.h3,N=this.h4,A=this.h5,J=this.h6,B=this.h7,W=[w>>>24&255,w>>>16&255,w>>>8&255,w&255,M>>>24&255,M>>>16&255,M>>>8&255,M&255,H>>>24&255,H>>>16&255,H>>>8&255,H&255,D>>>24&255,D>>>16&255,D>>>8&255,D&255,N>>>24&255,N>>>16&255,N>>>8&255,N&255,A>>>24&255,A>>>16&255,A>>>8&255,A&255,J>>>24&255,J>>>16&255,J>>>8&255,J&255];return this.is224||W.push(B>>>24&255,B>>>16&255,B>>>8&255,B&255),W},bt.prototype.array=bt.prototype.digest,bt.prototype.arrayBuffer=function(){this.finalize();var w=new ArrayBuffer(this.is224?28:32),M=new DataView(w);return M.setUint32(0,this.h0),M.setUint32(4,this.h1),M.setUint32(8,this.h2),M.setUint32(12,this.h3),M.setUint32(16,this.h4),M.setUint32(20,this.h5),M.setUint32(24,this.h6),this.is224||M.setUint32(28,this.h7),w};function xt(w,M,H){var D,N=typeof w;if(N==="string"){var A=[],J=w.length,B=0,W;for(D=0;D<J;++D)W=w.charCodeAt(D),W<128?A[B++]=W:W<2048?(A[B++]=192|W>>>6,A[B++]=128|W&63):W<55296||W>=57344?(A[B++]=224|W>>>12,A[B++]=128|W>>>6&63,A[B++]=128|W&63):(W=65536+((W&1023)<<10|w.charCodeAt(++D)&1023),A[B++]=240|W>>>18,A[B++]=128|W>>>12&63,A[B++]=128|W>>>6&63,A[B++]=128|W&63);w=A}else if(N==="object"){if(w===null)throw new Error(r);if(c&&w.constructor===ArrayBuffer)w=new Uint8Array(w);else if(!Array.isArray(w)&&(!c||!ArrayBuffer.isView(w)))throw new Error(r)}else throw new Error(r);w.length>64&&(w=new bt(M,!0).update(w).array());var Q=[],pt=[];for(D=0;D<64;++D){var Ht=w[D]||0;Q[D]=92^Ht,pt[D]=54^Ht}bt.call(this,M,H),this.update(pt),this.oKeyPad=Q,this.inner=!0,this.sharedMemory=H}xt.prototype=new bt,xt.prototype.finalize=function(){if(bt.prototype.finalize.call(this),this.inner){this.inner=!1;var w=this.array();bt.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(w),bt.prototype.finalize.call(this)}};var U=At();U.sha256=U,U.sha224=At(!0),U.sha256.hmac=Tt(),U.sha224.hmac=Tt(!0),s?ha.exports=U:(e.sha256=U.sha256,e.sha224=U.sha224,a&&define(function(){return U}))})()});var sb={};jr(sb,{registerWorker:()=>Qf});function Cu(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 L(r,t,e,n){function i(s){return s instanceof e?s:new e(function(a){a(s)})}return new(e||(e=Promise))(function(s,a){function c(u){try{h(n.next(u))}catch(I){a(I)}}function d(u){try{h(n.throw(u))}catch(I){a(I)}}function h(u){u.done?s(u.value):i(u.value).then(c,d)}h((n=n.apply(r,t||[])).next())})}function Nu(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 lt(r){return this instanceof lt?(this.v=r,this):new lt(r)}function we(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),i,s=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(T){n[T]&&(i[T]=function(E){return new Promise(function(ft,At){s.push([T,E,ft,At])>1||c(T,E)})})}function c(T,E){try{d(n[T](E))}catch(ft){I(s[0][3],ft)}}function d(T){T.value instanceof lt?Promise.resolve(T.value.v).then(h,u):I(s[0][2],T)}function h(T){c("next",T)}function u(T){c("throw",T)}function I(T,E){T(E),s.shift(),s.length&&c(s[0][0],s[0][1])}}function kn(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(a){return(e=!e)?{value:lt(r[i](a)),done:!1}:s?s(a):a}:s}}function Le(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 Nu=="function"?Nu(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(a){return new Promise(function(c,d){a=r[s](a),i(c,d,a.done,a.value)})}}function i(s,a,c,d){Promise.resolve(d).then(function(h){s({value:h,done:c})},a)}}var Wa={};jr(Wa,{compareArrayLike:()=>Va,joinUint8Arrays:()=>ve,memcpy:()=>yi,rebaseValueOffsets:()=>Us,toArrayBufferView:()=>dt,toArrayBufferViewAsyncIterator:()=>Ce,toArrayBufferViewIterator:()=>rr,toBigInt64Array:()=>Ms,toBigUint64Array:()=>Pm,toFloat32Array:()=>Hm,toFloat32ArrayAsyncIterator:()=>r_,toFloat32ArrayIterator:()=>qm,toFloat64Array:()=>Vm,toFloat64ArrayAsyncIterator:()=>n_,toFloat64ArrayIterator:()=>Km,toInt16Array:()=>km,toInt16ArrayAsyncIterator:()=>Zm,toInt16ArrayIterator:()=>jm,toInt32Array:()=>dn,toInt32ArrayAsyncIterator:()=>Qm,toInt32ArrayIterator:()=>$m,toInt8Array:()=>Lm,toInt8ArrayAsyncIterator:()=>Xm,toInt8ArrayIterator:()=>zm,toUint16Array:()=>Nm,toUint16ArrayAsyncIterator:()=>t_,toUint16ArrayIterator:()=>Gm,toUint32Array:()=>Cm,toUint32ArrayAsyncIterator:()=>e_,toUint32ArrayIterator:()=>Ym,toUint8Array:()=>Z,toUint8ArrayAsyncIterator:()=>Ha,toUint8ArrayIterator:()=>Pa,toUint8ClampedArray:()=>Wm,toUint8ClampedArrayAsyncIterator:()=>i_,toUint8ClampedArrayIterator:()=>Jm});var Om=new TextDecoder("utf-8"),mi=r=>Om.decode(r),Mm=new TextEncoder,er=r=>Mm.encode(r);var Um=r=>typeof r=="number",Pu=r=>typeof r=="boolean",Kt=r=>typeof r=="function",ce=r=>r!=null&&Object(r)===r,ke=r=>ce(r)&&Kt(r.then);var Ne=r=>ce(r)&&Kt(r[Symbol.iterator]),Ae=r=>ce(r)&&Kt(r[Symbol.asyncIterator]),Fs=r=>ce(r)&&ce(r.schema);var As=r=>ce(r)&&"done"in r&&"value"in r;var Ts=r=>ce(r)&&Kt(r.stat)&&Um(r.fd);var xs=r=>ce(r)&&_i(r.body),Es=r=>"_getDOMStream"in r&&"_getNodeStream"in r,Hu=r=>ce(r)&&Kt(r.abort)&&Kt(r.getWriter)&&!Es(r),_i=r=>ce(r)&&Kt(r.cancel)&&Kt(r.getReader)&&!Es(r),Vu=r=>ce(r)&&Kt(r.end)&&Kt(r.write)&&Pu(r.writable)&&!Es(r),Os=r=>ce(r)&&Kt(r.read)&&Kt(r.pipe)&&Pu(r.readable)&&!Es(r),Wu=r=>ce(r)&&Kt(r.clear)&&Kt(r.bytes)&&Kt(r.position)&&Kt(r.setPosition)&&Kt(r.capacity)&&Kt(r.getBufferIdentifier)&&Kt(r.createLong);var Ca=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Rm(r){let t=r[0]?[r[0]]:[],e,n,i,s;for(let a,c,d=0,h=0,u=r.length;++d<u;){if(a=t[h],c=r[d],!a||!c||a.buffer!==c.buffer||c.byteOffset<a.byteOffset){c&&(t[++h]=c);continue}if({byteOffset:e,byteLength:i}=a,{byteOffset:n,byteLength:s}=c,e+i<n||n+s<e){c&&(t[++h]=c);continue}t[h]=new Uint8Array(a.buffer,e,n-e+s)}return t}function yi(r,t,e=0,n=t.byteLength){let i=r.byteLength,s=new Uint8Array(r.buffer,r.byteOffset,i),a=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return s.set(a,e),r}function ve(r,t){let e=Rm(r),n=e.reduce((u,I)=>u+I.byteLength,0),i,s,a,c=0,d=-1,h=Math.min(t||Number.POSITIVE_INFINITY,n);for(let u=e.length;++d<u;){if(i=e[d],s=i.subarray(0,Math.min(i.length,h-c)),h<=c+s.length){s.length<i.length?e[d]=i.subarray(s.length):s.length===i.length&&d++,a?yi(a,s,c):a=s;break}yi(a||(a=new Uint8Array(h)),s,c),c+=s.length}return[a||new Uint8Array(0),e.slice(d),n-(a?a.byteLength:0)]}function dt(r,t){let e=As(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=er(e)),e instanceof ArrayBuffer?new r(e):e instanceof Ca?new r(e):Wu(e)?dt(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 Lm=r=>dt(Int8Array,r),km=r=>dt(Int16Array,r),dn=r=>dt(Int32Array,r),Ms=r=>dt(BigInt64Array,r),Z=r=>dt(Uint8Array,r),Nm=r=>dt(Uint16Array,r),Cm=r=>dt(Uint32Array,r),Pm=r=>dt(BigUint64Array,r),Hm=r=>dt(Float32Array,r),Vm=r=>dt(Float64Array,r),Wm=r=>dt(Uint8ClampedArray,r),Na=r=>(r.next(),r);function*rr(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Ca?e(t):Ne(t)?t:e(t);return yield*un(Na(function*(i){let s=null;do s=i.next(yield dt(r,s));while(!s.done)}(n[Symbol.iterator]()))),new r}var zm=r=>rr(Int8Array,r),jm=r=>rr(Int16Array,r),$m=r=>rr(Int32Array,r),Pa=r=>rr(Uint8Array,r),Gm=r=>rr(Uint16Array,r),Ym=r=>rr(Uint32Array,r),qm=r=>rr(Float32Array,r),Km=r=>rr(Float64Array,r),Jm=r=>rr(Uint8ClampedArray,r);function Ce(r,t){return we(this,arguments,function*(){if(ke(t))return yield lt(yield lt(yield*un(kn(Le(Ce(r,yield lt(t)))))));let n=function(a){return we(this,arguments,function*(){yield yield lt(yield lt(a))})},i=function(a){return we(this,arguments,function*(){yield lt(yield*un(kn(Le(Na(function*(c){let d=null;do d=c.next(yield d==null?void 0:d.value);while(!d.done)}(a[Symbol.iterator]()))))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Ca?n(t):Ne(t)?i(t):Ae(t)?t:n(t);return yield lt(yield*un(kn(Le(Na(function(a){return we(this,arguments,function*(){let c=null;do c=yield lt(a.next(yield yield lt(dt(r,c))));while(!c.done)})}(s[Symbol.asyncIterator]())))))),yield lt(new r)})}var Xm=r=>Ce(Int8Array,r),Zm=r=>Ce(Int16Array,r),Qm=r=>Ce(Int32Array,r),Ha=r=>Ce(Uint8Array,r),t_=r=>Ce(Uint16Array,r),e_=r=>Ce(Uint32Array,r),r_=r=>Ce(Float32Array,r),n_=r=>Ce(Float64Array,r),i_=r=>Ce(Uint8ClampedArray,r);function Us(r,t,e){if(r!==0){e=e.slice(0,t);for(let n=-1,i=e.length;++n<i;)e[n]+=r}return e.subarray(0,t)}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 ee={fromIterable(r){return Rs(s_(r))},fromAsyncIterable(r){return Rs(o_(r))},fromDOMStream(r){return Rs(a_(r))},fromNodeStream(r){return Rs(c_(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')}},Rs=r=>(r.next(),r);function*s_(r){let t,e=!1,n=[],i,s,a,c=0;function d(){return s==="peek"?ve(n,a)[0]:([i,n,c]=ve(n,a),i)}({cmd:s,size:a}=(yield null)||{cmd:"read",size:0});let h=Pa(r)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(a-c)?h.next():h.next(a-c),!t&&i.byteLength>0&&(n.push(i),c+=i.byteLength),t||a<=c)do({cmd:s,size:a}=yield d());while(a<c);while(!t)}catch(u){(e=!0)&&typeof h.throw=="function"&&h.throw(u)}finally{e===!1&&typeof h.return=="function"&&h.return(null)}return null}function o_(r){return we(this,arguments,function*(){let e,n=!1,i=[],s,a,c,d=0;function h(){return a==="peek"?ve(i,c)[0]:([s,i,d]=ve(i,c),s)}({cmd:a,size:c}=(yield yield lt(null))||{cmd:"read",size:0});let u=Ha(r)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(c-d)?yield lt(u.next()):yield lt(u.next(c-d)),!e&&s.byteLength>0&&(i.push(s),d+=s.byteLength),e||c<=d)do({cmd:a,size:c}=yield yield lt(h()));while(c<d);while(!e)}catch(I){(n=!0)&&typeof u.throw=="function"&&(yield lt(u.throw(I)))}finally{n===!1&&typeof u.return=="function"&&(yield lt(u.return(new Uint8Array(0))))}return yield lt(null)})}function a_(r){return we(this,arguments,function*(){let e=!1,n=!1,i=[],s,a,c,d=0;function h(){return a==="peek"?ve(i,c)[0]:([s,i,d]=ve(i,c),s)}({cmd:a,size:c}=(yield yield lt(null))||{cmd:"read",size:0});let u=new ja(r);try{do if({done:e,value:s}=Number.isNaN(c-d)?yield lt(u.read()):yield lt(u.read(c-d)),!e&&s.byteLength>0&&(i.push(Z(s)),d+=s.byteLength),e||c<=d)do({cmd:a,size:c}=yield yield lt(h()));while(c<d);while(!e)}catch(I){(n=!0)&&(yield lt(u.cancel(I)))}finally{n===!1?yield lt(u.cancel()):r.locked&&u.releaseLock()}return yield lt(null)})}var ja=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 L(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 L(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=Z(e)),e})}},za=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function c_(r){return we(this,arguments,function*(){let e=[],n="error",i=!1,s=null,a,c,d=0,h=[],u;function I(){return a==="peek"?ve(h,c)[0]:([u,h,d]=ve(h,c),u)}if({cmd:a,size:c}=(yield yield lt(null))||{cmd:"read",size:0},r.isTTY)return yield yield lt(new Uint8Array(0)),yield lt(null);try{e[0]=za(r,"end"),e[1]=za(r,"error");do{if(e[2]=za(r,"readable"),[n,s]=yield lt(Promise.race(e.map(E=>E[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(c-d)?(u=Z(r.read(c-d)),u.byteLength<c-d&&(u=Z(r.read()))):u=Z(r.read()),u.byteLength>0&&(h.push(u),d+=u.byteLength)),i||c<=d)do({cmd:a,size:c}=yield yield lt(I()));while(c<d)}while(!i)}finally{yield lt(T(e,n==="error"?s:null))}return yield lt(null);function T(E,ft){return u=h=null,new Promise((At,jt)=>{for(let[Lt,Tt]of E)r.off(Lt,Tt);try{let Lt=r.destroy;Lt&&Lt.call(r,ft),ft=void 0}catch(Lt){ft=Lt||ft}finally{ft!=null?jt(ft):At()}})}})}var It;(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"})(It||(It={}));var Ot;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(Ot||(Ot={}));var Et;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(Et||(Et={}));var $t;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})($t||($t={}));var C;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(C||(C={}));var Jt;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Jt||(Jt={}));var nr=new Int32Array(2),Ls=new Float32Array(nr.buffer),ks=new Float64Array(nr.buffer),Nn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var bi;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(bi||(bi={}));var Se=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 nr[0]=this.readInt32(t),Ls[0]}readFloat64(t){return nr[Nn?0:1]=this.readInt32(t),nr[Nn?1:0]=this.readInt32(t+4),ks[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){Ls[0]=e,this.writeInt32(t,nr[0])}writeFloat64(t,e){ks[0]=e,this.writeInt32(t,nr[Nn?0:1]),this.writeInt32(t+4,nr[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===bi.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 fn=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=Se.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=Se.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 a=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 h=2;h<s;h+=2)if(this.bb.readInt16(c+h)!=this.bb.readInt16(d+h))continue t;a=this.vtables[e];break}}return a?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,a-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,8+i),s.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let a=3;a>=0;a--)this.writeInt8(s.charCodeAt(a))}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;return 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),this.bb.bytes().set(e,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),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 gi;(function(r){r[r.BUFFER=0]="BUFFER"})(gi||(gi={}));var wi;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(wi||(wi={}));var Cs=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):wi.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):gi.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,wi.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,gi.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 Cn=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 Pn=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 Ie=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 Pn).__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 Cn).__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 Cs).__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 mr=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 Ie).__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 $r;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})($r||($r={}));var vi;(function(r){r[r.DenseArray=0]="DenseArray"})(vi||(vi={}));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 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 ir=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 He).__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):vi.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,vi.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var Xt=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKeyValue(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}key(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,n){return r.startKeyValue(t),r.addKey(t,e),r.addValue(t,n),r.endKeyValue(t)}};var Si=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 Ii=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 Gr=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):$t.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,$t.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return r.startDate(t),r.addUnit(t,e),r.endDate(t)}};var sr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static 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 Yr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDuration(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(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):C.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,C.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return r.startDuration(t),r.addUnit(t,e),r.endDuration(t)}};var qr=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 Kr=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 Jr=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):Et.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,Et.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return r.startFloatingPoint(t),r.addPrecision(t,e),r.endFloatingPoint(t)}};var Xr=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):Jt.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Jt.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return r.startInterval(t),r.addUnit(t,e),r.endInterval(t)}};var Di=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeBinary(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return r.startLargeBinary(t),r.endLargeBinary(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 getRootAsLargeUtf8(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return r.startLargeUtf8(t),r.endLargeUtf8(t)}};var Fi=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsList(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return r.startList(t),r.endList(t)}};var Zr=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 Ai=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 Ti=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 _r=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):C.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,C.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 yr=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):C.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,C.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 Ve=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):Ot.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,Ot.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 xi=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return r.startUtf8(t),r.endUtf8(t)}};var Mt;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.RunEndEncoded=22]="RunEndEncoded"})(Mt||(Mt={}));var oe=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):Mt.NONE}type(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){let e=this.bb.__offset(this.bb_pos,12);return e?(t||new ir).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){let n=this.bb.__offset(this.bb_pos,14);return n?(e||new r).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,16);return n?(e||new Xt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,Mt.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}};var fe=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):$r.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new oe).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new Xt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,$r.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 _t;(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"})(_t||(_t={}));var m;(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.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",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",r[r.DurationSecond=-27]="DurationSecond",r[r.DurationMillisecond=-28]="DurationMillisecond",r[r.DurationMicrosecond=-29]="DurationMicrosecond",r[r.DurationNanosecond=-30]="DurationNanosecond"})(m||(m={}));var xe;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(xe||(xe={}));var uc={};jr(uc,{clampRange:()=>Ui,createElementComparator:()=>rn,wrapIndex:()=>hn});var $a={};jr($a,{valueToString:()=>We});function We(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=>We(t)),"]"):"[".concat(r,"]"):ArrayBuffer.isView(r)?"[".concat(r,"]"):JSON.stringify(r,(t,e)=>typeof e=="bigint"?"".concat(e):e)}var Ka={};jr(Ka,{BN:()=>Oi,bigNumToBigInt:()=>ju,bigNumToNumber:()=>qa,bigNumToString:()=>Wn,isArrowBigNumSymbol:()=>zu});function wt(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)}function Ga(r,t){return wt(r/t)+wt(r%t)/wt(t)}var zu=Symbol.for("isArrowBigNum");function ze(r,...t){return t.length===0?Object.setPrototypeOf(dt(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}ze.prototype[zu]=!0;ze.prototype.toJSON=function(){return'"'.concat(Wn(this),'"')};ze.prototype.valueOf=function(r){return qa(this,r)};ze.prototype.toString=function(){return Wn(this)};ze.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return qa(this);case"string":return Wn(this);case"default":return ju(this)}return Wn(this)};function Hn(...r){return ze.apply(this,r)}function Vn(...r){return ze.apply(this,r)}function Ei(...r){return ze.apply(this,r)}Object.setPrototypeOf(Hn.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Vn.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Ei.prototype,Object.create(Uint32Array.prototype));Object.assign(Hn.prototype,ze.prototype,{constructor:Hn,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Vn.prototype,ze.prototype,{constructor:Vn,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Ei.prototype,ze.prototype,{constructor:Ei,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var l_=BigInt(4294967296)*BigInt(4294967296),u_=l_-BigInt(1);function qa(r,t){let{buffer:e,byteOffset:n,byteLength:i,signed:s}=r,a=new BigUint64Array(e,n,i/8),c=s&&a.at(-1)&BigInt(1)<<BigInt(63),d=BigInt(0),h=0;if(c){for(let u of a)d|=(u^u_)*(BigInt(1)<<BigInt(64*h++));d*=BigInt(-1),d-=BigInt(1)}else for(let u of a)d|=u*(BigInt(1)<<BigInt(64*h++));if(typeof t=="number"){let u=BigInt(Math.pow(10,t)),I=d/u,T=d%u;return wt(I)+wt(T)/wt(u)}return wt(d)}function Wn(r){if(r.byteLength===8){let s=new r.BigIntArray(r.buffer,r.byteOffset,1);return"".concat(s[0])}if(!r.signed)return Ya(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Ya(r);t=t.slice();let n=1;for(let s=0;s<t.length;s++){let a=t[s],c=~a+n;t[s]=c,n&=a===0?1:0}let i=Ya(t);return"-".concat(i)}function ju(r){return r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:Wn(r)}function Ya(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,a=n.length-1;do{for(e[0]=n[s=0];s<a;)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 Oi=class r{static new(t,e){switch(e){case!0:return new Hn(t);case!1:return new Vn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Hn(t)}return t.byteLength===16?new Ei(t):new Vn(t)}static signed(t){return new Hn(t)}static unsigned(t){return new Vn(t)}static decimal(t){return new Ei(t)}constructor(t,e){return r.new(t,e)}};var $u,Gu,Yu,qu,Ku,Ju,Xu,Zu,Qu,td,ed,rd,nd,id,sd,od,ad,cd,ld,ud,dd,fd,k=class r{static isNull(t){return(t==null?void 0:t.typeId)===m.Null}static isInt(t){return(t==null?void 0:t.typeId)===m.Int}static isFloat(t){return(t==null?void 0:t.typeId)===m.Float}static isBinary(t){return(t==null?void 0:t.typeId)===m.Binary}static isLargeBinary(t){return(t==null?void 0:t.typeId)===m.LargeBinary}static isUtf8(t){return(t==null?void 0:t.typeId)===m.Utf8}static isLargeUtf8(t){return(t==null?void 0:t.typeId)===m.LargeUtf8}static isBool(t){return(t==null?void 0:t.typeId)===m.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===m.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===m.Date}static isTime(t){return(t==null?void 0:t.typeId)===m.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===m.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===m.Interval}static isDuration(t){return(t==null?void 0:t.typeId)===m.Duration}static isList(t){return(t==null?void 0:t.typeId)===m.List}static isStruct(t){return(t==null?void 0:t.typeId)===m.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===m.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===m.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===m.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===m.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===m.Dictionary}static isDenseUnion(t){return r.isUnion(t)&&t.mode===Ot.Dense}static isSparseUnion(t){return r.isUnion(t)&&t.mode===Ot.Sparse}constructor(t){this.typeId=t}};$u=Symbol.toStringTag;k[$u]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(k.prototype);var le=class extends k{constructor(){super(m.Null)}toString(){return"Null"}};Gu=Symbol.toStringTag;le[Gu]=(r=>r[Symbol.toStringTag]="Null")(le.prototype);var Zt=class extends k{constructor(t,e){super(m.Int),this.isSigned=t,this.bitWidth=e}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)}};Yu=Symbol.toStringTag;Zt[Yu]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(Zt.prototype);var Ps=class extends Zt{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Hs=class extends Zt{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},or=class extends Zt{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Vs=class extends Zt{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Ws=class extends Zt{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},zs=class extends Zt{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},js=class extends Zt{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},$s=class extends Zt{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Ps.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Hs.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(or.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Vs.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Ws.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(zs.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(js.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty($s.prototype,"ArrayType",{value:BigUint64Array});var Ee=class extends k{constructor(t){super(m.Float),this.precision=t}get ArrayType(){switch(this.precision){case Et.HALF:return Uint16Array;case Et.SINGLE:return Float32Array;case Et.DOUBLE:return Float64Array}throw new Error("Unrecognized ".concat(this[Symbol.toStringTag]," type"))}toString(){return"Float".concat(this.precision<<5||16)}};qu=Symbol.toStringTag;Ee[qu]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(Ee.prototype);var Gs=class extends Ee{constructor(){super(Et.HALF)}},Ys=class extends Ee{constructor(){super(Et.SINGLE)}},qs=class extends Ee{constructor(){super(Et.DOUBLE)}};Object.defineProperty(Gs.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Ys.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(qs.prototype,"ArrayType",{value:Float64Array});var br=class extends k{constructor(){super(m.Binary)}toString(){return"Binary"}};Ku=Symbol.toStringTag;br[Ku]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(br.prototype);var gr=class extends k{constructor(){super(m.LargeBinary)}toString(){return"LargeBinary"}};Ju=Symbol.toStringTag;gr[Ju]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(gr.prototype);var wr=class extends k{constructor(){super(m.Utf8)}toString(){return"Utf8"}};Xu=Symbol.toStringTag;wr[Xu]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(wr.prototype);var vr=class extends k{constructor(){super(m.LargeUtf8)}toString(){return"LargeUtf8"}};Zu=Symbol.toStringTag;vr[Zu]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(vr.prototype);var Sr=class extends k{constructor(){super(m.Bool)}toString(){return"Bool"}};Qu=Symbol.toStringTag;Sr[Qu]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(Sr.prototype);var Ir=class extends k{constructor(t,e,n=128){super(m.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return"Decimal[".concat(this.precision,"e").concat(this.scale>0?"+":"").concat(this.scale,"]")}};td=Symbol.toStringTag;Ir[td]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(Ir.prototype);var Dr=class extends k{constructor(t){super(m.Date),this.unit=t}toString(){return"Date".concat((this.unit+1)*32,"<").concat($t[this.unit],">")}get ArrayType(){return this.unit===$t.DAY?Int32Array:BigInt64Array}};ed=Symbol.toStringTag;Dr[ed]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))(Dr.prototype);var Br=class extends k{constructor(t,e){super(m.Time),this.unit=t,this.bitWidth=e}toString(){return"Time".concat(this.bitWidth,"<").concat(C[this.unit],">")}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error("Unrecognized ".concat(this[Symbol.toStringTag]," type"))}};rd=Symbol.toStringTag;Br[rd]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(Br.prototype);var Fr=class extends k{constructor(t,e){super(m.Timestamp),this.unit=t,this.timezone=e}toString(){return"Timestamp<".concat(C[this.unit]).concat(this.timezone?", ".concat(this.timezone):"",">")}};nd=Symbol.toStringTag;Fr[nd]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(Fr.prototype);var Ar=class extends k{constructor(t){super(m.Interval),this.unit=t}toString(){return"Interval<".concat(Jt[this.unit],">")}};id=Symbol.toStringTag;Ar[id]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Ar.prototype);var Tr=class extends k{constructor(t){super(m.Duration),this.unit=t}toString(){return"Duration<".concat(C[this.unit],">")}};sd=Symbol.toStringTag;Tr[sd]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(Tr.prototype);var je=class extends k{constructor(t){super(m.List),this.children=[t]}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}};od=Symbol.toStringTag;je[od]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(je.prototype);var Nt=class extends k{constructor(t){super(m.Struct),this.children=t}toString(){return"Struct<{".concat(this.children.map(t=>"".concat(t.name,":").concat(t.type)).join(", "),"}>")}};ad=Symbol.toStringTag;Nt[ad]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(Nt.prototype);var $e=class extends k{constructor(t,e,n){super(m.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((i,s,a)=>(i[s]=a)&&i||i,Object.create(null))}toString(){return"".concat(this[Symbol.toStringTag],"<").concat(this.children.map(t=>"".concat(t.type)).join(" | "),">")}};cd=Symbol.toStringTag;$e[cd]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))($e.prototype);var xr=class extends k{constructor(t){super(m.FixedSizeBinary),this.byteWidth=t}toString(){return"FixedSizeBinary[".concat(this.byteWidth,"]")}};ld=Symbol.toStringTag;xr[ld]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(xr.prototype);var Ge=class extends k{constructor(t,e){super(m.FixedSizeList),this.listSize=t,this.children=[e]}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,">")}};ud=Symbol.toStringTag;Ge[ud]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Ge.prototype);var Ye=class extends k{constructor(t,e=!1){var n,i,s;if(super(m.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t==null?void 0:t.type)===null||n===void 0)&&n.children)){let a=(i=t==null?void 0:t.type)===null||i===void 0?void 0:i.children[0];a&&(a.name="key");let c=(s=t==null?void 0:t.type)===null||s===void 0?void 0:s.children[1];c&&(c.name="value")}}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(", "),"}>")}};dd=Symbol.toStringTag;Ye[dd]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(Ye.prototype);var d_=(r=>()=>++r)(-1),De=class extends k{constructor(t,e,n,i){super(m.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?d_():wt(n)}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,">")}};fd=Symbol.toStringTag;De[fd]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(De.prototype);function Be(r){let t=r;switch(r.typeId){case m.Decimal:return r.bitWidth/32;case m.Interval:return 1+t.unit;case m.FixedSizeList:return t.listSize;case m.FixedSizeBinary:return t.byteWidth;default:return 1}}var $=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 f_(this,t,e)}getVisitFnByTypeId(t,e=!0){return zn(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}visitLargeUtf8(t,...e){return null}visitBinary(t,...e){return null}visitLargeBinary(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}visitDuration(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}};function f_(r,t,e=!0){return typeof t=="number"?zn(r,t,e):typeof t=="string"&&t in m?zn(r,m[t],e):t&&t instanceof k?zn(r,hd(t),e):t!=null&&t.type&&t.type instanceof k?zn(r,hd(t.type),e):zn(r,m.NONE,e)}function zn(r,t,e=!0){let n=null;switch(t){case m.Null:n=r.visitNull;break;case m.Bool:n=r.visitBool;break;case m.Int:n=r.visitInt;break;case m.Int8:n=r.visitInt8||r.visitInt;break;case m.Int16:n=r.visitInt16||r.visitInt;break;case m.Int32:n=r.visitInt32||r.visitInt;break;case m.Int64:n=r.visitInt64||r.visitInt;break;case m.Uint8:n=r.visitUint8||r.visitInt;break;case m.Uint16:n=r.visitUint16||r.visitInt;break;case m.Uint32:n=r.visitUint32||r.visitInt;break;case m.Uint64:n=r.visitUint64||r.visitInt;break;case m.Float:n=r.visitFloat;break;case m.Float16:n=r.visitFloat16||r.visitFloat;break;case m.Float32:n=r.visitFloat32||r.visitFloat;break;case m.Float64:n=r.visitFloat64||r.visitFloat;break;case m.Utf8:n=r.visitUtf8;break;case m.LargeUtf8:n=r.visitLargeUtf8;break;case m.Binary:n=r.visitBinary;break;case m.LargeBinary:n=r.visitLargeBinary;break;case m.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case m.Date:n=r.visitDate;break;case m.DateDay:n=r.visitDateDay||r.visitDate;break;case m.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case m.Timestamp:n=r.visitTimestamp;break;case m.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case m.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case m.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case m.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case m.Time:n=r.visitTime;break;case m.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case m.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case m.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case m.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case m.Decimal:n=r.visitDecimal;break;case m.List:n=r.visitList;break;case m.Struct:n=r.visitStruct;break;case m.Union:n=r.visitUnion;break;case m.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case m.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case m.Dictionary:n=r.visitDictionary;break;case m.Interval:n=r.visitInterval;break;case m.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case m.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case m.Duration:n=r.visitDuration;break;case m.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case m.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case m.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case m.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case m.FixedSizeList:n=r.visitFixedSizeList;break;case m.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error("Unrecognized type '".concat(m[t],"'"))}function hd(r){switch(r.typeId){case m.Null:return m.Null;case m.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?m.Int8:m.Uint8;case 16:return e?m.Int16:m.Uint16;case 32:return e?m.Int32:m.Uint32;case 64:return e?m.Int64:m.Uint64}return m.Int}case m.Float:switch(r.precision){case Et.HALF:return m.Float16;case Et.SINGLE:return m.Float32;case Et.DOUBLE:return m.Float64}return m.Float;case m.Binary:return m.Binary;case m.LargeBinary:return m.LargeBinary;case m.Utf8:return m.Utf8;case m.LargeUtf8:return m.LargeUtf8;case m.Bool:return m.Bool;case m.Decimal:return m.Decimal;case m.Time:switch(r.unit){case C.SECOND:return m.TimeSecond;case C.MILLISECOND:return m.TimeMillisecond;case C.MICROSECOND:return m.TimeMicrosecond;case C.NANOSECOND:return m.TimeNanosecond}return m.Time;case m.Timestamp:switch(r.unit){case C.SECOND:return m.TimestampSecond;case C.MILLISECOND:return m.TimestampMillisecond;case C.MICROSECOND:return m.TimestampMicrosecond;case C.NANOSECOND:return m.TimestampNanosecond}return m.Timestamp;case m.Date:switch(r.unit){case $t.DAY:return m.DateDay;case $t.MILLISECOND:return m.DateMillisecond}return m.Date;case m.Interval:switch(r.unit){case Jt.DAY_TIME:return m.IntervalDayTime;case Jt.YEAR_MONTH:return m.IntervalYearMonth}return m.Interval;case m.Duration:switch(r.unit){case C.SECOND:return m.DurationSecond;case C.MILLISECOND:return m.DurationMillisecond;case C.MICROSECOND:return m.DurationMicrosecond;case C.NANOSECOND:return m.DurationNanosecond}return m.Duration;case m.Map:return m.Map;case m.List:return m.List;case m.Struct:return m.Struct;case m.Union:switch(r.mode){case Ot.Dense:return m.DenseUnion;case Ot.Sparse:return m.SparseUnion}return m.Union;case m.FixedSizeBinary:return m.FixedSizeBinary;case m.FixedSizeList:return m.FixedSizeList;case m.Dictionary:return m.Dictionary}throw new Error("Unrecognized type '".concat(m[r.typeId],"'"))}$.prototype.visitInt8=null;$.prototype.visitInt16=null;$.prototype.visitInt32=null;$.prototype.visitInt64=null;$.prototype.visitUint8=null;$.prototype.visitUint16=null;$.prototype.visitUint32=null;$.prototype.visitUint64=null;$.prototype.visitFloat16=null;$.prototype.visitFloat32=null;$.prototype.visitFloat64=null;$.prototype.visitDateDay=null;$.prototype.visitDateMillisecond=null;$.prototype.visitTimestampSecond=null;$.prototype.visitTimestampMillisecond=null;$.prototype.visitTimestampMicrosecond=null;$.prototype.visitTimestampNanosecond=null;$.prototype.visitTimeSecond=null;$.prototype.visitTimeMillisecond=null;$.prototype.visitTimeMicrosecond=null;$.prototype.visitTimeNanosecond=null;$.prototype.visitDenseUnion=null;$.prototype.visitSparseUnion=null;$.prototype.visitIntervalDayTime=null;$.prototype.visitIntervalYearMonth=null;$.prototype.visitDuration=null;$.prototype.visitDurationSecond=null;$.prototype.visitDurationMillisecond=null;$.prototype.visitDurationMicrosecond=null;$.prototype.visitDurationNanosecond=null;var Ja={};jr(Ja,{float64ToUint16:()=>Mi,uint16ToFloat64:()=>Ks});var pd=new Float64Array(1),jn=new Uint32Array(pd.buffer);function Ks(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 Mi(r){if(r!==r)return 32256;pd[0]=r;let t=(jn[1]&2147483648)>>16&65535,e=jn[1]&2146435072,n=0;return e>=1089470464?jn[0]>0?e=31744:(e=(e&2080374784)>>16,n=(jn[1]&1048575)>>10):e<=1056964608?(n=1048576+(jn[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(jn[1]&1048575)+512>>10),t|e|n&65535}var X=class extends ${};function nt(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var h_=(r,t,e)=>{r[t]=Math.floor(e/864e5)},md=(r,t,e,n)=>{if(e+1<t.length){let i=wt(t[e]),s=wt(t[e+1]);r.set(n.subarray(0,s-i),i)}},p_=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Er=({values:r},t,e)=>{r[t]=e},Xa=({values:r},t,e)=>{r[t]=e},_d=({values:r},t,e)=>{r[t]=Mi(e)},m_=(r,t,e)=>{switch(r.type.precision){case Et.HALF:return _d(r,t,e);case Et.SINGLE:case Et.DOUBLE:return Xa(r,t,e)}},Js=({values:r},t,e)=>{h_(r,t,e.valueOf())},Xs=({values:r},t,e)=>{r[t]=BigInt(e)},Za=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},yd=({values:r,valueOffsets:t},e,n)=>md(r,t,e,n),bd=({values:r,valueOffsets:t},e,n)=>md(r,t,e,er(n)),Qa=(r,t,e)=>{r.type.unit===$t.DAY?Js(r,t,e):Xs(r,t,e)},Zs=({values:r},t,e)=>{r[t]=BigInt(e/1e3)},Qs=({values:r},t,e)=>{r[t]=BigInt(e)},to=({values:r},t,e)=>{r[t]=BigInt(e*1e3)},eo=({values:r},t,e)=>{r[t]=BigInt(e*1e6)},tc=(r,t,e)=>{switch(r.type.unit){case C.SECOND:return Zs(r,t,e);case C.MILLISECOND:return Qs(r,t,e);case C.MICROSECOND:return to(r,t,e);case C.NANOSECOND:return eo(r,t,e)}},ro=({values:r},t,e)=>{r[t]=e},no=({values:r},t,e)=>{r[t]=e},io=({values:r},t,e)=>{r[t]=e},so=({values:r},t,e)=>{r[t]=e},ec=(r,t,e)=>{switch(r.type.unit){case C.SECOND:return ro(r,t,e);case C.MILLISECOND:return no(r,t,e);case C.MICROSECOND:return io(r,t,e);case C.NANOSECOND:return so(r,t,e)}},rc=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},__=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,s=re.getVisitFn(n);if(Array.isArray(e))for(let a=-1,c=i[t],d=i[t+1];c<d;)s(n,c++,e[++a]);else for(let a=-1,c=i[t],d=i[t+1];c<d;)s(n,c++,e.get(++a))},y_=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,s=re.getVisitFn(n),{[t]:a,[t+1]:c}=i,d=e instanceof Map?e.entries():Object.entries(e);for(let h of d)if(s(n,a,h),++a>=c)break},b_=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),g_=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),w_=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),v_=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),S_=(r,t,e)=>{let n=r.type.children.map(s=>re.getVisitFn(s.type)),i=e instanceof Map?w_(t,e):e instanceof yt?g_(t,e):Array.isArray(e)?b_(t,e):v_(t,e);r.type.children.forEach((s,a)=>i(n[a],r.children[a],s,a))},I_=(r,t,e)=>{r.type.mode===Ot.Dense?gd(r,t,e):wd(r,t,e)},gd=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];re.visit(i,r.valueOffsets[t],e)},wd=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];re.visit(i,t,e)},D_=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},nc=(r,t,e)=>{r.type.unit===Jt.DAY_TIME?oo(r,t,e):ao(r,t,e)},oo=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},ao=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},co=({values:r},t,e)=>{r[t]=e},lo=({values:r},t,e)=>{r[t]=e},uo=({values:r},t,e)=>{r[t]=e},fo=({values:r},t,e)=>{r[t]=e},ic=(r,t,e)=>{switch(r.type.unit){case C.SECOND:return co(r,t,e);case C.MILLISECOND:return lo(r,t,e);case C.MICROSECOND:return uo(r,t,e);case C.NANOSECOND:return fo(r,t,e)}},B_=(r,t,e)=>{let{stride:n}=r,i=r.children[0],s=re.getVisitFn(i);if(Array.isArray(e))for(let a=-1,c=t*n;++a<n;)s(i,c+a,e[a]);else for(let a=-1,c=t*n;++a<n;)s(i,c+a,e.get(a))};X.prototype.visitBool=nt(p_);X.prototype.visitInt=nt(Er);X.prototype.visitInt8=nt(Er);X.prototype.visitInt16=nt(Er);X.prototype.visitInt32=nt(Er);X.prototype.visitInt64=nt(Er);X.prototype.visitUint8=nt(Er);X.prototype.visitUint16=nt(Er);X.prototype.visitUint32=nt(Er);X.prototype.visitUint64=nt(Er);X.prototype.visitFloat=nt(m_);X.prototype.visitFloat16=nt(_d);X.prototype.visitFloat32=nt(Xa);X.prototype.visitFloat64=nt(Xa);X.prototype.visitUtf8=nt(bd);X.prototype.visitLargeUtf8=nt(bd);X.prototype.visitBinary=nt(yd);X.prototype.visitLargeBinary=nt(yd);X.prototype.visitFixedSizeBinary=nt(Za);X.prototype.visitDate=nt(Qa);X.prototype.visitDateDay=nt(Js);X.prototype.visitDateMillisecond=nt(Xs);X.prototype.visitTimestamp=nt(tc);X.prototype.visitTimestampSecond=nt(Zs);X.prototype.visitTimestampMillisecond=nt(Qs);X.prototype.visitTimestampMicrosecond=nt(to);X.prototype.visitTimestampNanosecond=nt(eo);X.prototype.visitTime=nt(ec);X.prototype.visitTimeSecond=nt(ro);X.prototype.visitTimeMillisecond=nt(no);X.prototype.visitTimeMicrosecond=nt(io);X.prototype.visitTimeNanosecond=nt(so);X.prototype.visitDecimal=nt(rc);X.prototype.visitList=nt(__);X.prototype.visitStruct=nt(S_);X.prototype.visitUnion=nt(I_);X.prototype.visitDenseUnion=nt(gd);X.prototype.visitSparseUnion=nt(wd);X.prototype.visitDictionary=nt(D_);X.prototype.visitInterval=nt(nc);X.prototype.visitIntervalDayTime=nt(oo);X.prototype.visitIntervalYearMonth=nt(ao);X.prototype.visitDuration=nt(ic);X.prototype.visitDurationSecond=nt(co);X.prototype.visitDurationMillisecond=nt(lo);X.prototype.visitDurationMicrosecond=nt(uo);X.prototype.visitDurationNanosecond=nt(fo);X.prototype.visitFixedSizeList=nt(B_);X.prototype.visitMap=nt(y_);var re=new X;var qe=Symbol.for("parent"),$n=Symbol.for("rowIndex"),Qr=class{constructor(t,e){return this[qe]=t,this[$n]=e,new Proxy(this,new oc)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[$n],e=this[qe],n=e.type.children,i={};for(let s=-1,a=n.length;++s<a;)i[n[s].name]=Yt.visit(e.children[s],t);return i}toString(){return"{".concat([...this].map(([t,e])=>"".concat(We(t),": ").concat(We(e))).join(", "),"}")}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new sc(this[qe],this[$n])}},sc=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,Yt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Qr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[qe]:{writable:!0,enumerable:!1,configurable:!1,value:null},[$n]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var oc=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[qe].type.children.map(e=>e.name)}has(t,e){return t[qe].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[qe].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[qe].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=Yt.visit(t[qe].children[n],t[$n]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[qe].type.children.findIndex(s=>s.name===e);return i!==-1?(re.visit(t[qe].children[i],t[$n],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}};var G=class extends ${};function tt(r){return(t,e)=>t.getValid(e)?r(t,e):null}var F_=(r,t)=>864e5*r[t],A_=(r,t)=>null,vd=(r,t,e)=>{if(e+1>=t.length)return null;let n=wt(t[e]),i=wt(t[e+1]);return r.subarray(n,i)},T_=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},Sd=({values:r},t)=>F_(r,t),Id=({values:r},t)=>wt(r[t]),tn=({stride:r,values:t},e)=>t[r*e],x_=({stride:r,values:t},e)=>Ks(t[r*e]),Dd=({values:r},t)=>r[t],E_=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),Bd=({values:r,valueOffsets:t},e)=>vd(r,t,e),Fd=({values:r,valueOffsets:t},e)=>{let n=vd(r,t,e);return n!==null?mi(n):null},O_=({values:r},t)=>r[t],M_=({type:r,values:t},e)=>r.precision!==Et.HALF?t[e]:Ks(t[e]),U_=(r,t)=>r.type.unit===$t.DAY?Sd(r,t):Id(r,t),Ad=({values:r},t)=>1e3*wt(r[t]),Td=({values:r},t)=>wt(r[t]),xd=({values:r},t)=>Ga(r[t],BigInt(1e3)),Ed=({values:r},t)=>Ga(r[t],BigInt(1e6)),R_=(r,t)=>{switch(r.type.unit){case C.SECOND:return Ad(r,t);case C.MILLISECOND:return Td(r,t);case C.MICROSECOND:return xd(r,t);case C.NANOSECOND:return Ed(r,t)}},Od=({values:r},t)=>r[t],Md=({values:r},t)=>r[t],Ud=({values:r},t)=>r[t],Rd=({values:r},t)=>r[t],L_=(r,t)=>{switch(r.type.unit){case C.SECOND:return Od(r,t);case C.MILLISECOND:return Md(r,t);case C.MICROSECOND:return Ud(r,t);case C.NANOSECOND:return Rd(r,t)}},k_=({values:r,stride:t},e)=>Oi.decimal(r.subarray(t*e,t*(e+1))),N_=(r,t)=>{let{valueOffsets:e,stride:n,children:i}=r,{[t*n]:s,[t*n+1]:a}=e,d=i[0].slice(s,a-s);return new yt([d])},C_=(r,t)=>{let{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:s}=e,a=n[0];return new ar(a.slice(i,s-i))},P_=(r,t)=>new Qr(r,t),H_=(r,t)=>r.type.mode===Ot.Dense?Ld(r,t):kd(r,t),Ld=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return Yt.visit(n,r.valueOffsets[t])},kd=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return Yt.visit(n,t)},V_=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},W_=(r,t)=>r.type.unit===Jt.DAY_TIME?Nd(r,t):Cd(r,t),Nd=({values:r},t)=>r.subarray(2*t,2*(t+1)),Cd=({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},Pd=({values:r},t)=>r[t],Hd=({values:r},t)=>r[t],Vd=({values:r},t)=>r[t],Wd=({values:r},t)=>r[t],z_=(r,t)=>{switch(r.type.unit){case C.SECOND:return Pd(r,t);case C.MILLISECOND:return Hd(r,t);case C.MICROSECOND:return Vd(r,t);case C.NANOSECOND:return Wd(r,t)}},j_=(r,t)=>{let{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new yt([s])};G.prototype.visitNull=tt(A_);G.prototype.visitBool=tt(T_);G.prototype.visitInt=tt(O_);G.prototype.visitInt8=tt(tn);G.prototype.visitInt16=tt(tn);G.prototype.visitInt32=tt(tn);G.prototype.visitInt64=tt(Dd);G.prototype.visitUint8=tt(tn);G.prototype.visitUint16=tt(tn);G.prototype.visitUint32=tt(tn);G.prototype.visitUint64=tt(Dd);G.prototype.visitFloat=tt(M_);G.prototype.visitFloat16=tt(x_);G.prototype.visitFloat32=tt(tn);G.prototype.visitFloat64=tt(tn);G.prototype.visitUtf8=tt(Fd);G.prototype.visitLargeUtf8=tt(Fd);G.prototype.visitBinary=tt(Bd);G.prototype.visitLargeBinary=tt(Bd);G.prototype.visitFixedSizeBinary=tt(E_);G.prototype.visitDate=tt(U_);G.prototype.visitDateDay=tt(Sd);G.prototype.visitDateMillisecond=tt(Id);G.prototype.visitTimestamp=tt(R_);G.prototype.visitTimestampSecond=tt(Ad);G.prototype.visitTimestampMillisecond=tt(Td);G.prototype.visitTimestampMicrosecond=tt(xd);G.prototype.visitTimestampNanosecond=tt(Ed);G.prototype.visitTime=tt(L_);G.prototype.visitTimeSecond=tt(Od);G.prototype.visitTimeMillisecond=tt(Md);G.prototype.visitTimeMicrosecond=tt(Ud);G.prototype.visitTimeNanosecond=tt(Rd);G.prototype.visitDecimal=tt(k_);G.prototype.visitList=tt(N_);G.prototype.visitStruct=tt(P_);G.prototype.visitUnion=tt(H_);G.prototype.visitDenseUnion=tt(Ld);G.prototype.visitSparseUnion=tt(kd);G.prototype.visitDictionary=tt(V_);G.prototype.visitInterval=tt(W_);G.prototype.visitIntervalDayTime=tt(Nd);G.prototype.visitIntervalYearMonth=tt(Cd);G.prototype.visitDuration=tt(z_);G.prototype.visitDurationSecond=tt(Pd);G.prototype.visitDurationMillisecond=tt(Hd);G.prototype.visitDurationMicrosecond=tt(Vd);G.prototype.visitDurationNanosecond=tt(Wd);G.prototype.visitFixedSizeList=tt(j_);G.prototype.visitMap=tt(C_);var Yt=new G;var en=Symbol.for("keys"),Yn=Symbol.for("vals"),Gn=Symbol.for("kKeysAsStrings"),ac=Symbol.for("_kKeysAsStrings"),ar=class{constructor(t){return this[en]=new yt([t.children[0]]).memoize(),this[Yn]=t.children[1],new Proxy(this,new lc)}get[Gn](){return this[ac]||(this[ac]=Array.from(this[en].toArray(),String))}[Symbol.iterator](){return new cc(this[en],this[Yn])}get size(){return this[en].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[en],e=this[Yn],n={};for(let i=-1,s=t.length;++i<s;)n[t.get(i)]=Yt.visit(e,i);return n}toString(){return"{".concat([...this].map(([t,e])=>"".concat(We(t),": ").concat(We(e))).join(", "),"}")}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},cc=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),Yt.visit(this.vals,t)]})}},lc=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Gn]}has(t,e){return t[Gn].includes(e)}getOwnPropertyDescriptor(t,e){if(t[Gn].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[Gn].indexOf(e);if(n!==-1){let i=Yt.visit(Reflect.get(t,Yn),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[Gn].indexOf(e);return i!==-1?(re.visit(Reflect.get(t,Yn),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(ar.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[en]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Yn]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ac]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var zd;function Ui(r,t,e,n){let{length:i=0}=r,s=typeof t!="number"?0:t,a=typeof e!="number"?i:e;return s<0&&(s=(s%i+i)%i),a<0&&(a=(a%i+i)%i),a<s&&(zd=s,s=a,a=zd),a>i&&(a=i),n?n(r,s,a):[s,a]}var hn=(r,t)=>r<0?t+r:r,jd=r=>r!==r;function rn(r){if(typeof r!=="object"||r===null)return jd(r)?jd: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?G_(r):Array.isArray(r)?$_(r):r instanceof yt?Y_(r):q_(r,!0)}function $_(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=rn(r[e]);return ho(t)}function G_(r){let t=-1,e=[];for(let n of r.values())e[++t]=rn(n);return ho(e)}function Y_(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=rn(r.get(e));return ho(t)}function q_(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]=rn(r[e[i]]);return ho(n,e)}function ho(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return K_(r,e);case Map:return $d(r,e,e.keys());case ar:case Qr:case Object:case void 0:return $d(r,e,t||Object.keys(e))}return e instanceof yt?J_(r,e):!1}}function K_(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 J_(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 $d(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](),a=0,c=r.length,d=s.next(),h=n.next(),u=i.next();for(;a<c&&!h.done&&!u.done&&!d.done&&!(h.value!==u.value||!r[a](d.value));++a,h=n.next(),u=i.next(),d=s.next());return a===c&&h.done&&u.done&&d.done?!0:(n.return&&n.return(),i.return&&i.return(),s.return&&s.return(),!1)}var dc={};jr(dc,{BitIterator:()=>pn,getBit:()=>Gd,getBool:()=>mo,packBools:()=>_n,popcnt_array:()=>Yd,popcnt_bit_range:()=>Ri,popcnt_uint32:()=>po,setBool:()=>X_,truncateBitmap:()=>mn});function mo(r,t,e,n){return(e&1<<n)!==0}function Gd(r,t,e,n){return(e&1<<n)>>n}function X_(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):_n(new pn(e,r,t,null,mo)).subarray(0,n)),i}return e}function _n(r){let t=[],e=0,n=0,i=0;for(let a of r)a&&(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 pn=class{constructor(t,e,n,i,s){this.bytes=t,this.length=n,this.context=i,this.get=s,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function Ri(r,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(let a of new pn(r,t,e-t,r,Gd))s+=a;return s}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return Ri(r,t,i)+Ri(r,n,e)+Yd(r,i>>3,n-i>>3)}function Yd(r,t,e){let n=0,i=Math.trunc(t),s=new DataView(r.buffer,r.byteOffset,r.byteLength),a=e===void 0?r.byteLength:i+e;for(;a-i>=4;)n+=po(s.getUint32(i)),i+=4;for(;a-i>=2;)n+=po(s.getUint16(i)),i+=2;for(;a-i>=1;)n+=po(s.getUint8(i)),i+=1;return n}function po(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 Z_=-1,St=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 nullable(){if(this._nullCount!==0){let{type:t}=this;return k.isSparseUnion(t)?this.children.some(e=>e.nullable):k.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}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((a,c)=>a+c.byteLength,t)}get nullCount(){if(k.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,e;return t<=Z_&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-Ri(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,i,s,a=[],c){this.type=t,this.children=a,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=Be(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)))}getValid(t){let{type:e}=this;if(k.isUnion(e)){let n=e,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],s=n.mode===Ot.Dense?this.valueOffsets[t]:t;return i.getValid(s)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,e){let n,{type:i}=this;if(k.isUnion(i)){let s=i,a=this.children[s.typeIdToChildIndex[this.typeIds[t]]],c=s.mode===Ot.Dense?this.valueOffsets[t]:t;n=a.getValid(c),a.setValid(c,e)}else{let{nullBitmap:s}=this,{offset:a,length:c}=this,d=a+t,h=1<<d%8,u=d>>3;(!s||s.byteLength<=u)&&(s=new Uint8Array((a+c+63&-64)>>3).fill(255),this.nullCount>0?(s.set(mn(a,c,this.nullBitmap),0),Object.assign(this,{nullBitmap:s})):Object.assign(this,{nullBitmap:s,_nullCount:0}));let I=s[u];n=(I&h)!==0,s[u]=e?I|h:I&~h}return n!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,n=this.length,i=this._nullCount,s=this,a=this.children){return new r(t,e,n,i,s,a,this.dictionary)}slice(t,e){let{stride:n,typeId:i,children:s}=this,a=+(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,a,d,s.length===0||this.valueOffsets?s:this._sliceChildren(s,c*t,c*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===m.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[xe.VALIDITY]=i,this.clone(this.type,0,t,n+(t-e),s)}_sliceBuffers(t,e,n,i){let s,{buffers:a}=this;return(s=a[xe.TYPE])&&(a[xe.TYPE]=s.subarray(t,t+e)),(s=a[xe.OFFSET])&&(a[xe.OFFSET]=s.subarray(t,t+e+1))||(s=a[xe.DATA])&&(a[xe.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),a}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};St.prototype.children=Object.freeze([]);var fc=class r extends ${visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:n=0,["length"]:i=0}=t;return new St(e,n,i,i)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=Z(t.nullBitmap),s=dt(e.ArrayType,t.data),{["length"]:a=s.length>>3,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new St(e,n,a,c,[void 0,s,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=Z(t.nullBitmap),s=dt(e.ArrayType,t.data),{["length"]:a=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new St(e,n,a,c,[void 0,s,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=Z(t.nullBitmap),s=dt(e.ArrayType,t.data),{["length"]:a=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new St(e,n,a,c,[void 0,s,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=Z(t.data),s=Z(t.nullBitmap),a=dn(t.valueOffsets),{["length"]:c=a.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new St(e,n,c,d,[a,i,s])}visitLargeUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=Z(t.data),s=Z(t.nullBitmap),a=Ms(t.valueOffsets),{["length"]:c=a.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new St(e,n,c,d,[a,i,s])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=Z(t.data),s=Z(t.nullBitmap),a=dn(t.valueOffsets),{["length"]:c=a.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new St(e,n,c,d,[a,i,s])}visitLargeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=Z(t.data),s=Z(t.nullBitmap),a=Ms(t.valueOffsets),{["length"]:c=a.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new St(e,n,c,d,[a,i,s])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=Z(t.nullBitmap),s=dt(e.ArrayType,t.data),{["length"]:a=s.length/Be(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new St(e,n,a,c,[void 0,s,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=Z(t.nullBitmap),s=dt(e.ArrayType,t.data),{["length"]:a=s.length/Be(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new St(e,n,a,c,[void 0,s,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=Z(t.nullBitmap),s=dt(e.ArrayType,t.data),{["length"]:a=s.length/Be(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new St(e,n,a,c,[void 0,s,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=Z(t.nullBitmap),s=dt(e.ArrayType,t.data),{["length"]:a=s.length/Be(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new St(e,n,a,c,[void 0,s,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=Z(t.nullBitmap),s=dt(e.ArrayType,t.data),{["length"]:a=s.length/Be(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new St(e,n,a,c,[void 0,s,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,s=Z(t.nullBitmap),a=dn(t.valueOffsets),{["length"]:c=a.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new St(e,n,c,d,[a,void 0,s],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=Z(t.nullBitmap),{length:a=i.reduce((d,{length:h})=>Math.max(d,h),0),nullCount:c=t.nullBitmap?-1:0}=t;return new St(e,n,a,c,[void 0,void 0,s],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=dt(e.ArrayType,t.typeIds),{["length"]:a=s.length,["nullCount"]:c=-1}=t;if(k.isSparseUnion(e))return new St(e,n,a,c,[void 0,void 0,void 0,s],i);let d=dn(t.valueOffsets);return new St(e,n,a,c,[d,void 0,void 0,s],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=Z(t.nullBitmap),s=dt(e.indices.ArrayType,t.data),{["dictionary"]:a=new yt([new r().visit({type:e.dictionary})])}=t,{["length"]:c=s.length,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new St(e,n,c,d,[void 0,s,i],[],a)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=Z(t.nullBitmap),s=dt(e.ArrayType,t.data),{["length"]:a=s.length/Be(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new St(e,n,a,c,[void 0,s,i])}visitDuration(t){let{["type"]:e,["offset"]:n=0}=t,i=Z(t.nullBitmap),s=dt(e.ArrayType,t.data),{["length"]:a=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new St(e,n,a,c,[void 0,s,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new r().visit({type:e.valueType})}=t,s=Z(t.nullBitmap),{["length"]:a=i.length/Be(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new St(e,n,a,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=Z(t.nullBitmap),a=dn(t.valueOffsets),{["length"]:c=a.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new St(e,n,c,d,[a,void 0,s],[i])}},Q_=new fc;function st(r){return Q_.visit(r)}var Li=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 qd(r){return r.some(t=>t.nullable)}function _o(r){return r.reduce((t,e)=>t+e.nullCount,0)}function yo(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function bo(r,t,e,n){let i=[];for(let s=-1,a=r.length;++s<a;){let c=r[s],d=t[s],{length:h}=c;if(d>=n)break;if(e>=d+h)continue;if(d>=e&&d+h<=n){i.push(c);continue}let u=Math.max(0,e-d),I=Math.min(n-d,h);i.push(c.slice(u,I-u))}return i.length===0&&i.push(r[0].slice(0,0)),i}function hc(r,t,e,n){let i=0,s=0,a=t.length-1;do{if(i>=a-1)return e<t[a]?n(r,i,e-t[i]):null;s=i+Math.trunc((a-i)*.5),e<t[s]?a=s:i=s}while(i<a)}function ki(r,t){return r.getValid(t)}function qn(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return hc(n,this._offsets,e,t)}}function go(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 a=hc(s,this._offsets,n,e);return t=void 0,a}}function wo(r){let t;function e(n,i,s){let a=s,c=0,d=0;for(let h=i-1,u=n.length;++h<u;){let I=n[h];if(~(c=r(I,t,a)))return d+c;a=0,d+=I.length}return-1}return function(n,i){t=n;let s=this.data,a=typeof i!="number"?e(s,0,0):hc(s,this._offsets,i,e);return t=void 0,a}}var Y=class extends ${};function ty(r,t){return t===null&&r.length>0?0:-1}function ey(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new pn(e,r.offset+(t||0),r.length,e,mo)){if(!i)return n;++n}return-1}function ot(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case m.Union:break;case m.Dictionary:break;default:return ey(r,e)}let n=Yt.getVisitFn(r),i=rn(t);for(let s=(e||0)-1,a=r.length;++s<a;)if(i(n(r,s)))return s;return-1}function Kd(r,t,e){let n=Yt.getVisitFn(r),i=rn(t);for(let s=(e||0)-1,a=r.length;++s<a;)if(i(n(r,s)))return s;return-1}Y.prototype.visitNull=ty;Y.prototype.visitBool=ot;Y.prototype.visitInt=ot;Y.prototype.visitInt8=ot;Y.prototype.visitInt16=ot;Y.prototype.visitInt32=ot;Y.prototype.visitInt64=ot;Y.prototype.visitUint8=ot;Y.prototype.visitUint16=ot;Y.prototype.visitUint32=ot;Y.prototype.visitUint64=ot;Y.prototype.visitFloat=ot;Y.prototype.visitFloat16=ot;Y.prototype.visitFloat32=ot;Y.prototype.visitFloat64=ot;Y.prototype.visitUtf8=ot;Y.prototype.visitLargeUtf8=ot;Y.prototype.visitBinary=ot;Y.prototype.visitLargeBinary=ot;Y.prototype.visitFixedSizeBinary=ot;Y.prototype.visitDate=ot;Y.prototype.visitDateDay=ot;Y.prototype.visitDateMillisecond=ot;Y.prototype.visitTimestamp=ot;Y.prototype.visitTimestampSecond=ot;Y.prototype.visitTimestampMillisecond=ot;Y.prototype.visitTimestampMicrosecond=ot;Y.prototype.visitTimestampNanosecond=ot;Y.prototype.visitTime=ot;Y.prototype.visitTimeSecond=ot;Y.prototype.visitTimeMillisecond=ot;Y.prototype.visitTimeMicrosecond=ot;Y.prototype.visitTimeNanosecond=ot;Y.prototype.visitDecimal=ot;Y.prototype.visitList=ot;Y.prototype.visitStruct=ot;Y.prototype.visitUnion=ot;Y.prototype.visitDenseUnion=Kd;Y.prototype.visitSparseUnion=Kd;Y.prototype.visitDictionary=ot;Y.prototype.visitInterval=ot;Y.prototype.visitIntervalDayTime=ot;Y.prototype.visitIntervalYearMonth=ot;Y.prototype.visitDuration=ot;Y.prototype.visitDurationSecond=ot;Y.prototype.visitDurationMillisecond=ot;Y.prototype.visitDurationMicrosecond=ot;Y.prototype.visitDurationNanosecond=ot;Y.prototype.visitFixedSizeList=ot;Y.prototype.visitMap=ot;var yn=new Y;var q=class extends ${};function et(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(k.isInt(t)&&t.bitWidth!==64||k.isTime(t)&&t.bitWidth!==64||k.isFloat(t)&&t.precision!==Et.HALF))return new Li(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new Li(r.data.length,n=>{let s=r.data[n].length,a=r.slice(e,e+s);return e+=s,new pc(a)})}var pc=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}};q.prototype.visitNull=et;q.prototype.visitBool=et;q.prototype.visitInt=et;q.prototype.visitInt8=et;q.prototype.visitInt16=et;q.prototype.visitInt32=et;q.prototype.visitInt64=et;q.prototype.visitUint8=et;q.prototype.visitUint16=et;q.prototype.visitUint32=et;q.prototype.visitUint64=et;q.prototype.visitFloat=et;q.prototype.visitFloat16=et;q.prototype.visitFloat32=et;q.prototype.visitFloat64=et;q.prototype.visitUtf8=et;q.prototype.visitLargeUtf8=et;q.prototype.visitBinary=et;q.prototype.visitLargeBinary=et;q.prototype.visitFixedSizeBinary=et;q.prototype.visitDate=et;q.prototype.visitDateDay=et;q.prototype.visitDateMillisecond=et;q.prototype.visitTimestamp=et;q.prototype.visitTimestampSecond=et;q.prototype.visitTimestampMillisecond=et;q.prototype.visitTimestampMicrosecond=et;q.prototype.visitTimestampNanosecond=et;q.prototype.visitTime=et;q.prototype.visitTimeSecond=et;q.prototype.visitTimeMillisecond=et;q.prototype.visitTimeMicrosecond=et;q.prototype.visitTimeNanosecond=et;q.prototype.visitDecimal=et;q.prototype.visitList=et;q.prototype.visitStruct=et;q.prototype.visitUnion=et;q.prototype.visitDenseUnion=et;q.prototype.visitSparseUnion=et;q.prototype.visitDictionary=et;q.prototype.visitInterval=et;q.prototype.visitIntervalDayTime=et;q.prototype.visitIntervalYearMonth=et;q.prototype.visitDuration=et;q.prototype.visitDurationSecond=et;q.prototype.visitDurationMillisecond=et;q.prototype.visitDurationMicrosecond=et;q.prototype.visitDurationNanosecond=et;q.prototype.visitFixedSizeList=et;q.prototype.visitMap=et;var Kn=new q;var Jd,Xd={},Zd={},yt=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 St)))throw new TypeError("Vector constructor expects an Array of Data instances.");let a=(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:h}=Xd[a.typeId],u=s[0];this.isValid=I=>ki(u,I),this.get=I=>c(u,I),this.set=(I,T)=>d(u,I,T),this.indexOf=I=>h(u,I),this._offsets=[0,u.length];break}default:Object.setPrototypeOf(this,Zd[a.typeId]),this._offsets=yo(s);break}this.data=s,this.type=a,this.stride=Be(a),this.numChildren=(i=(n=a.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.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return qd(this.data)}get nullCount(){return _o(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return"".concat(this.VectorName,"<").concat(this.type[Symbol.toStringTag],">")}get VectorName(){return"".concat(m[this.type.typeId],"Vector")}isValid(t){return!1}get(t){return null}at(t){return this.get(hn(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return Kn.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,a)=>bo(n,i,s,a)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:i,ArrayType:s}=this;switch(t.typeId){case m.Int:case m.Float:case m.Decimal:case m.Time:case m.Timestamp:switch(e.length){case 0:return new s;case 1:return e[0].values.subarray(0,n*i);default:return e.reduce((a,{values:c,length:d})=>(a.array.set(c.subarray(0,d*i),a.offset),a.offset+=d*i,a),{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 k.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(k.isDictionary(this.type)){let t=new vo(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new r(e)}return new vo(this)}unmemoize(){if(k.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}};Jd=Symbol.toStringTag;yt[Jd]=(r=>{r.type=k.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;let t=Object.keys(m).map(e=>m[e]).filter(e=>typeof e=="number"&&e!==m.NONE);for(let e of t){let n=Yt.getVisitFnByTypeId(e),i=re.getVisitFnByTypeId(e),s=yn.getVisitFnByTypeId(e);Xd[e]={get:n,set:i,indexOf:s},Zd[e]=Object.create(r,{isValid:{value:qn(ki)},get:{value:qn(Yt.getVisitFnByTypeId(e))},set:{value:go(re.getVisitFnByTypeId(e))},indexOf:{value:wo(yn.getVisitFnByTypeId(e))}})}return"Vector"})(yt.prototype);var vo=class r extends yt{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(a){let c=s[a];if(c!==void 0)return c;let d=e.call(this,a);return s[a]=d,d}}),Object.defineProperty(this,"set",{value(a,c){n.call(this,a,c),s[a]=c}}),Object.defineProperty(this,"slice",{value:(a,c)=>new r(i.call(this,a,c))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new yt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function Qd(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(ry(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 ry(r){return typeof r!="bigint"?We(r):"".concat(We(r),"n")}function mc(r,t){let e=Math.ceil(r)*t-1;return(e-e%64+64||64)/t}function tf(r,t=0){return r.length>=t?r.subarray(0,t):yi(new r.constructor(t),r,0)}var Ke=class{constructor(t,e=0,n=1){this.length=Math.ceil(e/n),this.buffer=new t(this.length),this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}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?mc(n*1,this.BYTES_PER_ELEMENT):mc(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=mc(t*this.stride,this.BYTES_PER_ELEMENT);let e=tf(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=tf(this.buffer,t)}},Or=class extends Ke{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}},Jn=class extends Or{constructor(){super(Uint8Array,0,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,a=n[i]>>s&1;return e?a===0&&(n[i]|=1<<s,++this.numValid):a===1&&(n[i]&=~(1<<s),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},Xn=class extends Or{constructor(t){super(t.OffsetArrayType,1,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++&&n>=0&&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,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var Pt=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:e}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=e,this.stride=Be(t),this._nulls=new Jn,e&&e.length>0&&(this._isValid=Qd(e))}toVector(){return new yt([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:a}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),a.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:a,nullCount:c,_typeIds:d,_offsets:h,_values:u,_nulls:I}=this;(e=d==null?void 0:d.flush(a))?i=h==null?void 0:h.flush(a):(i=h==null?void 0:h.flush(a))?t=u==null?void 0:u.flush(h.last()):t=u==null?void 0:u.flush(a),c>0&&(n=I==null?void 0:I.flush(a));let T=this.children.map(E=>E.flush());return this.clear(),st({type:s,length:a,nullCount:c,children:T,child:T[0],data:t,typeIds:e,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,e,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(e=this._values)===null||e===void 0||e.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let s of this.children)s.clear();return this}};Pt.prototype.length=1;Pt.prototype.stride=1;Pt.prototype.children=null;Pt.prototype.finished=!1;Pt.prototype.nullValues=null;Pt.prototype._isValid=()=>!0;var qt=class extends Pt{constructor(t){super(t),this._values=new Or(this.ArrayType,0,this.stride)}setValue(t,e){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}},he=class extends Pt{constructor(t){super(t),this._pendingLength=0,this._offsets=new Xn(t.type)}setValue(t,e){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=e instanceof ar?e[en].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 bn=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 Fe=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):It.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new fe).__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 bn).__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 bn).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new Xt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,It.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 Bt=class r{constructor(t=[],e,n,i=It.V5){this.fields=t||[],this.metadata=e||new Map,n||(n=_c(this.fields)),this.dictionaries=n,this.metadataVersion=i}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=So(So(new Map,this.metadata),e.metadata),s=e.fields.filter(c=>{let d=n.findIndex(h=>h.name===c.name);return~d?(n[d]=c.clone({metadata:So(So(new Map,n[d].metadata),c.metadata)}))&&!1:!0}),a=_c(s,new Map);return new r([...n,...s],i,new Map([...this.dictionaries,...a]))}};Bt.prototype.fields=null;Bt.prototype.metadata=null;Bt.prototype.dictionaries=null;var ht=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)}};ht.prototype.type=null;ht.prototype.name=null;ht.prototype.nullable=null;ht.prototype.metadata=null;function So(r,t){return new Map([...r||new Map,...t||new Map])}function _c(r,t=new Map){for(let e=-1,n=r.length;++e<n;){let s=r[e].type;if(k.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&&_c(s.children,t)}return t}var ny=fn,iy=Se,Mr=class{static decode(t){t=new iy(Z(t));let e=Fe.getRootAsFooter(t),n=Bt.decode(e.schema(),new Map,e.version());return new yc(n,e)}static encode(t){let e=new ny,n=Bt.encode(e,t.schema);Fe.startRecordBatchesVector(e,t.numRecordBatches);for(let a of[...t.recordBatches()].slice().reverse())Ur.encode(e,a);let i=e.endVector();Fe.startDictionariesVector(e,t.numDictionaries);for(let a of[...t.dictionaryBatches()].slice().reverse())Ur.encode(e,a);let s=e.endVector();return Fe.startFooter(e),Fe.addSchema(e,n),Fe.addVersion(e,It.V5),Fe.addRecordBatches(e,i),Fe.addDictionaries(e,s),Fe.finishFooterBuffer(e,Fe.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=It.V5,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 yc=class extends Mr{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,e){super(t,e.version()),this._footer=e}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let e=this._footer.recordBatches(t);if(e)return Ur.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return Ur.decode(e)}return null}},Ur=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 bn.createBlock(t,i,n,s)}constructor(t,e,n){this.metaDataLength=t,this.offset=wt(n),this.bodyLength=wt(e)}};var Ct=Object.freeze({done:!0,value:void 0}),Ni=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},gn=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())}},Io=class extends gn{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return L(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(Ct);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return ee.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return ee.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return L(this,void 0,void 0,function*(){return yield this.abort(t),Ct})}return(t){return L(this,void 0,void 0,function*(){return yield this.close(),Ct})}read(t){return L(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return L(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(Ct)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var cr=class extends Io{write(t){if((t=Z(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?mi(this.toUint8Array(!0)):this.toUint8Array(!1).then(mi)}toUint8Array(t=!1){return t?ve(this._values)[0]:L(this,void 0,void 0,function*(){var e,n,i,s;let a=[],c=0;try{for(var d=!0,h=Le(this),u;u=yield h.next(),e=u.done,!e;d=!0){s=u.value,d=!1;let I=s;a.push(I),c+=I.byteLength}}catch(I){n={error:I}}finally{try{!d&&!e&&(i=h.return)&&(yield i.call(h))}finally{if(n)throw n.error}}return ve(a,c)[0]})}},lr=class{constructor(t){t&&(this.source=new bc(ee.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)}},Oe=class r{constructor(t){t instanceof r?this.source=t.source:t instanceof cr?this.source=new Rr(ee.fromAsyncIterable(t)):Os(t)?this.source=new Rr(ee.fromNodeStream(t)):_i(t)?this.source=new Rr(ee.fromDOMStream(t)):xs(t)?this.source=new Rr(ee.fromDOMStream(t.body)):Ne(t)?this.source=new Rr(ee.fromIterable(t)):ke(t)?this.source=new Rr(ee.fromAsyncIterable(t)):Ae(t)&&(this.source=new Rr(ee.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)}},bc=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)||Ct)}return(t){return Object.create(this.source.return&&this.source.return(t)||Ct)}},Rr=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return L(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return L(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return L(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return L(this,arguments,void 0,function*(e,n="read"){return yield this.source.next({cmd:n,size:e})})}throw(t){return L(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||Ct;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return L(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||Ct;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var Ci=class extends lr{constructor(t,e){super(),this.position=0,this.buffer=Z(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}}},nn=class extends Oe{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=L(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return L(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 L(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 L(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,a=0,c=0,d=Math.min(n,s+Math.min(n-s,t)),h=new Uint8Array(Math.max(0,(this.position=d)-s));for(;(s+=c)<d&&(a+=c)<h.byteLength;)({bytesRead:c}=yield e.read(h,a,h.byteLength-a,s));return h}return null})}readAt(t,e){return L(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),a=new Uint8Array(s-t);return(yield n.read(a,0,e,t)).buffer}return new Uint8Array(e)})}close(){return L(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return L(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return L(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var wc={};jr(wc,{BaseInt64:()=>Pi,Int128:()=>Hi,Int64:()=>Lr,Uint64:()=>zt});function Zn(r){return r<0&&(r=4294967295+r+1),"0x".concat(r.toString(16))}var Qn=8,gc=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Pi=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(Zn(this.buffer[1])," ").concat(Zn(this.buffer[0]))}},zt=class r extends Pi{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 a=Qn<n-s?Qn:n-s,c=new r(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),d=new r(new Uint32Array([gc[a],0]));i.times(d),i.plus(c),s+=a}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)}},Lr=class r extends Pi{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 a=n?1:0;a<i;){let c=Qn<i-a?Qn:i-a,d=new r(new Uint32Array([Number.parseInt(t.slice(a,a+c),10),0])),h=new r(new Uint32Array([gc[c],0]));s.times(h),s.plus(d),a+=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)}},Hi=class r{constructor(t){this.buffer=t}high(){return new Lr(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Lr(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 zt(new Uint32Array([this.buffer[3],0])),n=new zt(new Uint32Array([this.buffer[2],0])),i=new zt(new Uint32Array([this.buffer[1],0])),s=new zt(new Uint32Array([this.buffer[0],0])),a=new zt(new Uint32Array([t.buffer[3],0])),c=new zt(new Uint32Array([t.buffer[2],0])),d=new zt(new Uint32Array([t.buffer[1],0])),h=new zt(new Uint32Array([t.buffer[0],0])),u=zt.multiply(s,h);this.buffer[0]=u.low();let I=new zt(new Uint32Array([u.high(),0]));return u=zt.multiply(i,h),I.plus(u),u=zt.multiply(s,d),I.plus(u),this.buffer[1]=I.low(),this.buffer[3]=I.lessThan(u)?1:0,this.buffer[2]=I.high(),new zt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(zt.multiply(n,h)).plus(zt.multiply(i,d)).plus(zt.multiply(s,c)),this.buffer[3]+=zt.multiply(e,h).plus(zt.multiply(n,d)).plus(zt.multiply(i,c)).plus(zt.multiply(s,a)).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(Zn(this.buffer[3])," ").concat(Zn(this.buffer[2])," ").concat(Zn(this.buffer[1])," ").concat(Zn(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 a=n?1:0;a<i;){let c=Qn<i-a?Qn:i-a,d=new r(new Uint32Array([Number.parseInt(t.slice(a,a+c),10),0,0,0])),h=new r(new Uint32Array([gc[c],0,0,0]));s.times(h),s.plus(d),a+=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 Vi=class extends ${constructor(t,e,n,i,s=It.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=i,this.metadataVersion=s}visit(t){return super.visit(t instanceof ht?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return st({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return st({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return st({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return st({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return st({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return st({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 st({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return st({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 st({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return st({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return st({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return st({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return st({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return st({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 st({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<It.V5&&this.readNullBitmap(t,n),t.mode===Ot.Sparse?this.visitSparseUnion(t,{length:e,nullCount:n}):this.visitDenseUnion(t,{length:e,nullCount:n})}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return st({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return st({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return st({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 st({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:e,nullCount:n}=this.nextFieldNode()){return st({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return st({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 st({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)}},Do=class extends Vi{constructor(t,e,n,i,s){super(new Uint8Array(0),e,n,i,s),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):_n(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return dt(Uint8Array,dt(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return dt(Uint8Array,dt(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:n}=this;return k.isTimestamp(t)?dt(Uint8Array,Lr.convertArray(n[e])):(k.isInt(t)||k.isTime(t))&&t.bitWidth===64||k.isDuration(t)?dt(Uint8Array,Lr.convertArray(n[e])):k.isDate(t)&&t.unit===$t.MILLISECOND?dt(Uint8Array,Lr.convertArray(n[e])):k.isDecimal(t)?dt(Uint8Array,Hi.convertArray(n[e])):k.isBinary(t)||k.isLargeBinary(t)||k.isFixedSizeBinary(t)?sy(n[e]):k.isBool(t)?_n(n[e]):k.isUtf8(t)||k.isLargeUtf8(t)?er(n[e].join("")):dt(Uint8Array,dt(t.ArrayType,n[e].map(i=>+i)))}};function sy(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 ti=class extends he{constructor(t){super(t),this._values=new Ke(Uint8Array)}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,Z(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,s=0;for(let[a,c]of t)if(c===void 0)n.set(a,0);else{let d=c.length;i.set(c,s),n.set(a,d),s+=d}}};var ei=class extends he{constructor(t){super(t),this._values=new Ke(Uint8Array)}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,Z(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,s=0;for(let[a,c]of t)if(c===void 0)n.set(a,BigInt(0));else{let d=c.length;i.set(c,s),n.set(a,BigInt(d)),s+=d}}};var Bo=class extends Pt{constructor(t){super(t),this._values=new Jn}setValue(t,e){this._values.set(t,+e)}};var wn=class extends qt{};wn.prototype._setValue=Qa;var Wi=class extends wn{};Wi.prototype._setValue=Js;var zi=class extends wn{};zi.prototype._setValue=Xs;var ji=class extends qt{};ji.prototype._setValue=rc;var Fo=class extends Pt{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new De(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=vn({type:this.type.indices,nullValues:e}),this.dictionary=vn({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 $i=class extends qt{};$i.prototype._setValue=Za;var Ao=class extends Pt{setValue(t,e){let[n]=this.children,i=t*this.stride;for(let s=-1,a=e.length;++s<a;)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 Ge(this.type.listSize,new ht(e,t.type,!0)),n}};var Sn=class extends qt{setValue(t,e){this._values.set(t,e)}},To=class extends Sn{setValue(t,e){super.setValue(t,Mi(e))}},xo=class extends Sn{},Eo=class extends Sn{};var In=class extends qt{};In.prototype._setValue=nc;var Gi=class extends In{};Gi.prototype._setValue=oo;var Yi=class extends In{};Yi.prototype._setValue=ao;var kr=class extends qt{};kr.prototype._setValue=ic;var qi=class extends kr{};qi.prototype._setValue=co;var Ki=class extends kr{};Ki.prototype._setValue=lo;var Ji=class extends kr{};Ji.prototype._setValue=uo;var Xi=class extends kr{};Xi.prototype._setValue=fo;var Me=class extends qt{setValue(t,e){this._values.set(t,e)}},Oo=class extends Me{},Mo=class extends Me{},Uo=class extends Me{},Ro=class extends Me{},Lo=class extends Me{},ko=class extends Me{},No=class extends Me{},Co=class extends Me{};var Po=class extends he{constructor(t){super(t),this._offsets=new Xn(t.type)}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 je(new ht(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 a=s,c=a.length,d=e.set(i,c).buffer[i];for(let h=-1;++h<c;)n.set(d+h,a[h])}}};var Ho=class extends he{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 Ye(new ht(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]:a,[i+1]:c}=e.set(i,s.size).buffer;for(let d of s.entries())if(n.set(a,d),++a>=c)break}}};var Vo=class extends Pt{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var Wo=class extends Pt{setValue(t,e){let{children:n,type:i}=this;switch(Array.isArray(e)||e.constructor){case!0:return i.children.forEach((s,a)=>n[a].set(t,e[a]));case Map:return i.children.forEach((s,a)=>n[a].set(t,e.get(s.name)));default:return i.children.forEach((s,a)=>n[a].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 Nt([...this.type.children,new ht(e,t.type,!0)]),n}};var Nr=class extends qt{};Nr.prototype._setValue=tc;var Zi=class extends Nr{};Zi.prototype._setValue=Zs;var Qi=class extends Nr{};Qi.prototype._setValue=Qs;var ts=class extends Nr{};ts.prototype._setValue=to;var es=class extends Nr{};es.prototype._setValue=eo;var Cr=class extends qt{};Cr.prototype._setValue=ec;var rs=class extends Cr{};rs.prototype._setValue=ro;var ns=class extends Cr{};ns.prototype._setValue=no;var is=class extends Cr{};is.prototype._setValue=io;var ss=class extends Cr{};ss.prototype._setValue=so;var ri=class extends Pt{constructor(t){super(t),this._typeIds=new Or(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.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:a}}=this,c=[...i,new ht(e,t.type)];return this.type=new $e(s,[...a,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.")}},zo=class extends ri{},jo=class extends ri{constructor(t){super(t),this._offsets=new Or(Int32Array)}setValue(t,e,n){let i=this._typeIds.set(t,n).buffer[t],s=this.getChildAt(this.type.typeIdToChildIndex[i]),a=this._offsets.set(t,s.length).buffer[t];s==null||s.set(a,e)}};var os=class extends he{constructor(t){super(t),this._values=new Ke(Uint8Array)}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,er(e))}_flushPending(t,e){}};os.prototype._flushPending=ti.prototype._flushPending;var as=class extends he{constructor(t){super(t),this._values=new Ke(Uint8Array)}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,er(e))}_flushPending(t,e){}};as.prototype._flushPending=ei.prototype._flushPending;var vc=class extends ${visitNull(){return Vo}visitBool(){return Bo}visitInt(){return Me}visitInt8(){return Oo}visitInt16(){return Mo}visitInt32(){return Uo}visitInt64(){return Ro}visitUint8(){return Lo}visitUint16(){return ko}visitUint32(){return No}visitUint64(){return Co}visitFloat(){return Sn}visitFloat16(){return To}visitFloat32(){return xo}visitFloat64(){return Eo}visitUtf8(){return os}visitLargeUtf8(){return as}visitBinary(){return ti}visitLargeBinary(){return ei}visitFixedSizeBinary(){return $i}visitDate(){return wn}visitDateDay(){return Wi}visitDateMillisecond(){return zi}visitTimestamp(){return Nr}visitTimestampSecond(){return Zi}visitTimestampMillisecond(){return Qi}visitTimestampMicrosecond(){return ts}visitTimestampNanosecond(){return es}visitTime(){return Cr}visitTimeSecond(){return rs}visitTimeMillisecond(){return ns}visitTimeMicrosecond(){return is}visitTimeNanosecond(){return ss}visitDecimal(){return ji}visitList(){return Po}visitStruct(){return Wo}visitUnion(){return ri}visitDenseUnion(){return jo}visitSparseUnion(){return zo}visitDictionary(){return Fo}visitInterval(){return In}visitIntervalDayTime(){return Gi}visitIntervalYearMonth(){return Yi}visitDuration(){return kr}visitDurationSecond(){return qi}visitDurationMillisecond(){return Ki}visitDurationMicrosecond(){return Ji}visitDurationNanosecond(){return Xi}visitFixedSizeList(){return Ao}visitMap(){return Ho}},ef=new vc;var K=class extends ${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 ue(r,t){return t instanceof r.constructor}function Dn(r,t){return r===t||ue(r,t)}function Pr(r,t){return r===t||ue(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function $o(r,t){return r===t||ue(r,t)&&r.precision===t.precision}function oy(r,t){return r===t||ue(r,t)&&r.byteWidth===t.byteWidth}function Sc(r,t){return r===t||ue(r,t)&&r.unit===t.unit}function cs(r,t){return r===t||ue(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function ls(r,t){return r===t||ue(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function ay(r,t){return r===t||ue(r,t)&&r.children.length===t.children.length&&ur.compareManyFields(r.children,t.children)}function cy(r,t){return r===t||ue(r,t)&&r.children.length===t.children.length&&ur.compareManyFields(r.children,t.children)}function Ic(r,t){return r===t||ue(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&ur.compareManyFields(r.children,t.children)}function ly(r,t){return r===t||ue(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&ur.visit(r.indices,t.indices)&&ur.visit(r.dictionary,t.dictionary)}function Dc(r,t){return r===t||ue(r,t)&&r.unit===t.unit}function us(r,t){return r===t||ue(r,t)&&r.unit===t.unit}function uy(r,t){return r===t||ue(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&ur.compareManyFields(r.children,t.children)}function dy(r,t){return r===t||ue(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&ur.compareManyFields(r.children,t.children)}K.prototype.visitNull=Dn;K.prototype.visitBool=Dn;K.prototype.visitInt=Pr;K.prototype.visitInt8=Pr;K.prototype.visitInt16=Pr;K.prototype.visitInt32=Pr;K.prototype.visitInt64=Pr;K.prototype.visitUint8=Pr;K.prototype.visitUint16=Pr;K.prototype.visitUint32=Pr;K.prototype.visitUint64=Pr;K.prototype.visitFloat=$o;K.prototype.visitFloat16=$o;K.prototype.visitFloat32=$o;K.prototype.visitFloat64=$o;K.prototype.visitUtf8=Dn;K.prototype.visitLargeUtf8=Dn;K.prototype.visitBinary=Dn;K.prototype.visitLargeBinary=Dn;K.prototype.visitFixedSizeBinary=oy;K.prototype.visitDate=Sc;K.prototype.visitDateDay=Sc;K.prototype.visitDateMillisecond=Sc;K.prototype.visitTimestamp=cs;K.prototype.visitTimestampSecond=cs;K.prototype.visitTimestampMillisecond=cs;K.prototype.visitTimestampMicrosecond=cs;K.prototype.visitTimestampNanosecond=cs;K.prototype.visitTime=ls;K.prototype.visitTimeSecond=ls;K.prototype.visitTimeMillisecond=ls;K.prototype.visitTimeMicrosecond=ls;K.prototype.visitTimeNanosecond=ls;K.prototype.visitDecimal=Dn;K.prototype.visitList=ay;K.prototype.visitStruct=cy;K.prototype.visitUnion=Ic;K.prototype.visitDenseUnion=Ic;K.prototype.visitSparseUnion=Ic;K.prototype.visitDictionary=ly;K.prototype.visitInterval=Dc;K.prototype.visitIntervalDayTime=Dc;K.prototype.visitIntervalYearMonth=Dc;K.prototype.visitDuration=us;K.prototype.visitDurationSecond=us;K.prototype.visitDurationMillisecond=us;K.prototype.visitDurationMicrosecond=us;K.prototype.visitDurationNanosecond=us;K.prototype.visitFixedSizeList=uy;K.prototype.visitMap=dy;var ur=new K;function Bn(r,t){return ur.compareSchemas(r,t)}function rf(r,t){return ur.compareFields(r,t)}function nf(r,t){return ur.visit(r,t)}function vn(r){let t=r.type,e=new(ef.getVisitFn(t)())(r);if(t.children&&t.children.length>0){let n=r.children||[],i={nullValues:r.nullValues},s=Array.isArray(n)?(a,c)=>n[c]||i:({name:a})=>n[a]||i;for(let[a,c]of t.children.entries()){let{type:d}=c,h=s(c,a);e.children.push(vn(Object.assign(Object.assign({},h),{type:d})))}}return e}function Go(r,t){return fy(r,t.map(e=>e.data.concat()))}function fy(r,t){let e=[...r.fields],n=[],i={numBatches:t.reduce((I,T)=>Math.max(I,T.length),0)},s=0,a=0,c=-1,d=t.length,h,u=[];for(;i.numBatches-- >0;){for(a=Number.POSITIVE_INFINITY,c=-1;++c<d;)u[c]=h=t[c].shift(),a=Math.min(a,h?h.length:a);Number.isFinite(a)&&(u=hy(e,a,u,t,i),a>0&&(n[s++]=st({type:new Nt(e),length:a,nullCount:0,children:u.slice()})))}return[r=r.assign(e),n.map(I=>new Gt(r,I))]}function hy(r,t,e,n,i){var s;let a=(t+63&-64)>>3;for(let c=-1,d=n.length;++c<d;){let h=e[c],u=h==null?void 0:h.length;if(u>=t)u===t?e[c]=h:(e[c]=h.slice(0,t),i.numBatches=Math.max(i.numBatches,n[c].unshift(h.slice(t,u-t))));else{let I=r[c];r[c]=I.clone({nullable:!0}),e[c]=(s=h==null?void 0:h._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:st({type:I.type,length:t,nullCount:t,nullBitmap:new Uint8Array(a)})}}return e}var sf,de=class r{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new Bt([]),this._offsets=[0],this;let i,s;t[0]instanceof Bt&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());let a=d=>{if(d){if(d instanceof Gt)return[d];if(d instanceof r)return d.batches;if(d instanceof St){if(d.type instanceof Nt)return[new Gt(new Bt(d.type.children),d)]}else{if(Array.isArray(d))return d.flatMap(h=>a(h));if(typeof d[Symbol.iterator]=="function")return[...d].flatMap(h=>a(h));if(typeof d=="object"){let h=Object.keys(d),u=h.map(E=>new yt([d[E]])),I=i!=null?i:new Bt(h.map((E,ft)=>new ht(String(E),u[ft].type,u[ft].nullable))),[,T]=Go(I,u);return T.length===0?[new Gt(d)]:T}}}return[]},c=t.flatMap(d=>a(d));if(i=(n=i!=null?i:(e=c[0])===null||e===void 0?void 0:e.schema)!==null&&n!==void 0?n:new Bt([]),!(i instanceof Bt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let d of c){if(!(d instanceof Gt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Bn(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:yo(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=_o(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(hn(t,this.numRows))}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?Kn.visit(new yt(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 Gt(e,i)))}slice(t,e){let n=this.schema;[t,e]=Ui({length:this.numRows},t,e);let i=bo(this.data,this._offsets,t,e);return new r(n,i.map(s=>new Gt(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=st({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new yt(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 yt([st({type:new le,length:this.numRows})]));let s=n.fields.slice(),a=s[t].clone({type:e.type}),c=this.schema.fields.map((d,h)=>this.getChildAt(h));[s[t],c[t]]=[a,e],[n,i]=Go(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,h)=>{let[u,I]=c,T=e.findIndex(E=>E.name===d.name);return~T?I[T]=h:u.push(h),c},[[],[]]),s=this.schema.assign(t.schema),a=[...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(...Go(s,a))}};sf=Symbol.toStringTag;de[sf]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=qn(ki),r.get=qn(Yt.getVisitFn(m.Struct)),r.set=go(re.getVisitFn(m.Struct)),r.indexOf=wo(yn.getVisitFn(m.Struct)),"Table"))(de.prototype);var af,Gt=class r{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof Bt))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=st({nullCount:0,type:new Nt(this.schema.fields),children:this.schema.fields.map(e=>st({type:e.type,nullCount:0}))})]=t,!(this.data instanceof St))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=of(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:n,children:i,length:s}=Object.keys(e).reduce((d,h,u)=>(d.children[u]=e[h],d.length=Math.max(d.length,e[h].length),d.fields[u]=ht.new({name:h,type:e[h].type,nullable:!0}),d),{length:0,fields:new Array,children:new Array}),a=new Bt(n),c=st({type:new Nt(n),length:s,children:i,nullCount:0});[this.schema,this.data]=of(a,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=cf(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 Yt.visit(this.data,t)}at(t){return this.get(hn(t,this.numRows))}set(t,e){return re.visit(this.data,t,e)}indexOf(t,e){return yn.visit(this.data,t,e)}[Symbol.iterator](){return Kn.visit(new yt([this.data]))}toArray(){return[...this]}concat(...t){return new de(this.schema,[this,...t])}slice(t,e){let[n]=new yt([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 yt([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 yt([st({type:new le,length:this.numRows})]));let s=n.fields.slice(),a=i.children.slice(),c=s[t].clone({type:e.type});[s[t],a[t]]=[c,e.data[0]],n=new Bt(s,new Map(this.schema.metadata)),i=st({type:new Nt(s),children:a})}return new r(n,i)}select(t){let e=this.schema.select(t),n=new Nt(e.fields),i=[];for(let s of t){let a=this.schema.fields.findIndex(c=>c.name===s);~a&&(i[a]=this.data.children[a])}return new r(e,st({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=st({type:new Nt(e.fields),length:this.numRows,children:n});return new r(e,i)}};af=Symbol.toStringTag;Gt[af]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Gt.prototype);function of(r,t,e=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...r.fields],s=[...t],a=(e+63&-64)>>3;for(let[c,d]of r.fields.entries()){let h=t[c];(!h||h.length!==e)&&(i[c]=d.clone({nullable:!0}),s[c]=(n=h==null?void 0:h._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:st({type:d.type,length:e,nullCount:e,nullBitmap:new Uint8Array(a)}))}return[r.assign(i),st({type:new Nt(i),length:e,children:s})]}function cf(r,t,e=new Map){var n,i;if(((n=r==null?void 0:r.length)!==null&&n!==void 0?n:0)>0&&(r==null?void 0:r.length)===(t==null?void 0:t.length))for(let s=-1,a=r.length;++s<a;){let{type:c}=r[s],d=t[s];for(let h of[d,...((i=d==null?void 0:d.dictionary)===null||i===void 0?void 0:i.data)||[]])cf(c.children,h==null?void 0:h.children,e);if(k.isDictionary(c)){let{id:h}=c;if(!e.has(h))d!=null&&d.dictionary&&e.set(h,d.dictionary);else if(e.get(h)!==d.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return e}var Fn=class extends Gt{constructor(t){let e=t.fields.map(i=>st({type:i.type})),n=st({type:new Nt(t.fields),nullCount:0,children:e});super(t,n)}};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 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):It.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):_t.NONE}header(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new Xt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,It.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,_t.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,a){return r.startMessage(t),r.addVersion(t,e),r.addHeaderType(t,n),r.addHeader(t,i),r.addBodyLength(t,s),r.addCustomMetadata(t,a),r.endMessage(t)}};var Bc=class extends ${visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return Ai.startNull(e),Ai.endNull(e)}visitInt(t,e){return He.startInt(e),He.addBitWidth(e,t.bitWidth),He.addIsSigned(e,t.isSigned),He.endInt(e)}visitFloat(t,e){return Jr.startFloatingPoint(e),Jr.addPrecision(e,t.precision),Jr.endFloatingPoint(e)}visitBinary(t,e){return Si.startBinary(e),Si.endBinary(e)}visitLargeBinary(t,e){return Di.startLargeBinary(e),Di.endLargeBinary(e)}visitBool(t,e){return Ii.startBool(e),Ii.endBool(e)}visitUtf8(t,e){return xi.startUtf8(e),xi.endUtf8(e)}visitLargeUtf8(t,e){return Bi.startLargeUtf8(e),Bi.endLargeUtf8(e)}visitDecimal(t,e){return sr.startDecimal(e),sr.addScale(e,t.scale),sr.addPrecision(e,t.precision),sr.addBitWidth(e,t.bitWidth),sr.endDecimal(e)}visitDate(t,e){return Gr.startDate(e),Gr.addUnit(e,t.unit),Gr.endDate(e)}visitTime(t,e){return _r.startTime(e),_r.addUnit(e,t.unit),_r.addBitWidth(e,t.bitWidth),_r.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return yr.startTimestamp(e),yr.addUnit(e,t.unit),n!==void 0&&yr.addTimezone(e,n),yr.endTimestamp(e)}visitInterval(t,e){return Xr.startInterval(e),Xr.addUnit(e,t.unit),Xr.endInterval(e)}visitDuration(t,e){return Yr.startDuration(e),Yr.addUnit(e,t.unit),Yr.endDuration(e)}visitList(t,e){return Fi.startList(e),Fi.endList(e)}visitStruct(t,e){return Ti.startStruct_(e),Ti.endStruct_(e)}visitUnion(t,e){Ve.startTypeIdsVector(e,t.typeIds.length);let n=Ve.createTypeIdsVector(e,t.typeIds);return Ve.startUnion(e),Ve.addMode(e,t.mode),Ve.addTypeIds(e,n),Ve.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return ir.startDictionaryEncoding(e),ir.addId(e,BigInt(t.id)),ir.addIsOrdered(e,t.isOrdered),n!==void 0&&ir.addIndexType(e,n),ir.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return qr.startFixedSizeBinary(e),qr.addByteWidth(e,t.byteWidth),qr.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Kr.startFixedSizeList(e),Kr.addListSize(e,t.listSize),Kr.endFixedSizeList(e)}visitMap(t,e){return Zr.startMap(e),Zr.addKeysSorted(e,t.keysSorted),Zr.endMap(e)}},Yo=new Bc;function ff(r,t=new Map){return new Bt(my(r,t),qo(r.metadata),t)}function Fc(r){return new ne(r.count,pf(r.columns),mf(r.columns))}function hf(r){return new me(Fc(r.data),r.id,r.isDelta)}function my(r,t){return(r.fields||[]).filter(Boolean).map(e=>ht.fromJSON(e,t))}function lf(r,t){return(r.children||[]).filter(Boolean).map(e=>ht.fromJSON(e,t))}function pf(r){return(r||[]).reduce((t,e)=>[...t,new Ue(e.count,_y(e.VALIDITY)),...pf(e.children)],[])}function mf(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new pe(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new pe(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new pe(t.length,i.OFFSET.length)),i.DATA&&t.push(new pe(t.length,i.DATA.length)),t=mf(i.children,t)}return t}function _y(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function _f(r,t){let e,n,i,s,a,c;return!t||!(s=r.dictionary)?(a=df(r,lf(r,t)),i=new ht(r.name,a,r.nullable,qo(r.metadata))):t.has(e=s.id)?(n=(n=s.indexType)?uf(n):new or,c=new De(t.get(e),n,e,s.isOrdered),i=new ht(r.name,c,r.nullable,qo(r.metadata))):(n=(n=s.indexType)?uf(n):new or,t.set(e,a=df(r,lf(r,t))),c=new De(a,n,e,s.isOrdered),i=new ht(r.name,c,r.nullable,qo(r.metadata))),i||null}function qo(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function uf(r){return new Zt(r.isSigned,r.bitWidth)}function df(r,t){let e=r.type.name;switch(e){case"NONE":return new le;case"null":return new le;case"binary":return new br;case"largebinary":return new gr;case"utf8":return new wr;case"largeutf8":return new vr;case"bool":return new Sr;case"list":return new je((t||[])[0]);case"struct":return new Nt(t||[]);case"struct_":return new Nt(t||[])}switch(e){case"int":{let n=r.type;return new Zt(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new Ee(Et[n.precision])}case"decimal":{let n=r.type;return new Ir(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new Dr($t[n.unit])}case"time":{let n=r.type;return new Br(C[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new Fr(C[n.unit],n.timezone)}case"interval":{let n=r.type;return new Ar(Jt[n.unit])}case"duration":{let n=r.type;return new Tr(C[n.unit])}case"union":{let n=r.type,[i,...s]=(n.mode+"").toLowerCase(),a=i.toUpperCase()+s.join("");return new $e(Ot[a],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new xr(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Ge(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new Ye((t||[])[0],n.keysSorted)}}throw new Error('Unrecognized type: "'.concat(e,'"'))}var yy=fn,by=Se,_e=class r{static fromJSON(t,e){let n=new r(0,It.V5,e);return n._createHeader=gy(t,e),n}static decode(t){t=new by(Z(t));let e=Je.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),s=e.headerType(),a=new r(n,i,s);return a._createHeader=wy(e,s),a}static encode(t){let e=new yy,n=-1;return t.isSchema()?n=Bt.encode(e,t.header()):t.isRecordBatch()?n=ne.encode(e,t.header()):t.isDictionaryBatch()&&(n=me.encode(e,t.header())),Je.startMessage(e),Je.addVersion(e,It.V5),Je.addHeader(e,n),Je.addHeaderType(e,t.headerType),Je.addBodyLength(e,BigInt(t.bodyLength)),Je.finishMessageBuffer(e,Je.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof Bt)return new r(0,It.V5,_t.Schema,t);if(t instanceof ne)return new r(e,It.V5,_t.RecordBatch,t);if(t instanceof me)return new r(e,It.V5,_t.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===_t.Schema}isRecordBatch(){return this.headerType===_t.RecordBatch}isDictionaryBatch(){return this.headerType===_t.DictionaryBatch}constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=wt(t)}},ne=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=wt(t)}},me=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=wt(e)}},pe=class{constructor(t,e){this.offset=wt(t),this.length=wt(e)}},Ue=class{constructor(t,e){this.length=wt(t),this.nullCount=wt(e)}};function gy(r,t){return()=>{switch(t){case _t.Schema:return Bt.fromJSON(r);case _t.RecordBatch:return ne.fromJSON(r);case _t.DictionaryBatch:return me.fromJSON(r)}throw new Error("Unrecognized Message type: { name: ".concat(_t[t],", type: ").concat(t," }"))}}function wy(r,t){return()=>{switch(t){case _t.Schema:return Bt.decode(r.header(new fe),new Map,r.version());case _t.RecordBatch:return ne.decode(r.header(new Ie),r.version());case _t.DictionaryBatch:return me.decode(r.header(new mr),r.version())}throw new Error("Unrecognized Message type: { name: ".concat(_t[t],", type: ").concat(t," }"))}}ht.encode=Oy;ht.decode=xy;ht.fromJSON=_f;Bt.encode=Ey;Bt.decode=vy;Bt.fromJSON=ff;ne.encode=My;ne.decode=Sy;ne.fromJSON=Fc;me.encode=Uy;me.decode=Iy;me.fromJSON=hf;Ue.encode=Ry;Ue.decode=By;pe.encode=Ly;pe.decode=Dy;function vy(r,t=new Map,e=It.V5){let n=Ty(r,t);return new Bt(n,Ko(r),t,e)}function Sy(r,t=It.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new ne(r.length(),Fy(r),Ay(r,t))}function Iy(r,t=It.V5){return new me(ne.decode(r.data(),t),r.id(),r.isDelta())}function Dy(r){return new pe(r.offset(),r.length())}function By(r){return new Ue(r.length(),r.nullCount())}function Fy(r){let t=[];for(let e,n=-1,i=-1,s=r.nodesLength();++n<s;)(e=r.nodes(n))&&(t[++i]=Ue.decode(e));return t}function Ay(r,t){let e=[];for(let n,i=-1,s=-1,a=r.buffersLength();++i<a;)(n=r.buffers(i))&&(t<It.V4&&(n.bb_pos+=8*(i+1)),e[++s]=pe.decode(n));return e}function Ty(r,t){let e=[];for(let n,i=-1,s=-1,a=r.fieldsLength();++i<a;)(n=r.fields(i))&&(e[++s]=ht.decode(n,t));return e}function yf(r,t){let e=[];for(let n,i=-1,s=-1,a=r.childrenLength();++i<a;)(n=r.children(i))&&(e[++s]=ht.decode(n,t));return e}function xy(r,t){let e,n,i,s,a,c;return!t||!(c=r.dictionary())?(i=gf(r,yf(r,t)),n=new ht(r.name(),i,r.nullable(),Ko(r))):t.has(e=wt(c.id()))?(s=(s=c.indexType())?bf(s):new or,a=new De(t.get(e),s,e,c.isOrdered()),n=new ht(r.name(),a,r.nullable(),Ko(r))):(s=(s=c.indexType())?bf(s):new or,t.set(e,i=gf(r,yf(r,t))),a=new De(i,s,e,c.isOrdered()),n=new ht(r.name(),a,r.nullable(),Ko(r))),n||null}function Ko(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 bf(r){return new Zt(r.isSigned(),r.bitWidth())}function gf(r,t){let e=r.typeType();switch(e){case Mt.NONE:return new le;case Mt.Null:return new le;case Mt.Binary:return new br;case Mt.LargeBinary:return new gr;case Mt.Utf8:return new wr;case Mt.LargeUtf8:return new vr;case Mt.Bool:return new Sr;case Mt.List:return new je((t||[])[0]);case Mt.Struct_:return new Nt(t||[])}switch(e){case Mt.Int:{let n=r.type(new He);return new Zt(n.isSigned(),n.bitWidth())}case Mt.FloatingPoint:{let n=r.type(new Jr);return new Ee(n.precision())}case Mt.Decimal:{let n=r.type(new sr);return new Ir(n.scale(),n.precision(),n.bitWidth())}case Mt.Date:{let n=r.type(new Gr);return new Dr(n.unit())}case Mt.Time:{let n=r.type(new _r);return new Br(n.unit(),n.bitWidth())}case Mt.Timestamp:{let n=r.type(new yr);return new Fr(n.unit(),n.timezone())}case Mt.Interval:{let n=r.type(new Xr);return new Ar(n.unit())}case Mt.Duration:{let n=r.type(new Yr);return new Tr(n.unit())}case Mt.Union:{let n=r.type(new Ve);return new $e(n.mode(),n.typeIdsArray()||[],t||[])}case Mt.FixedSizeBinary:{let n=r.type(new qr);return new xr(n.byteWidth())}case Mt.FixedSizeList:{let n=r.type(new Kr);return new Ge(n.listSize(),(t||[])[0])}case Mt.Map:{let n=r.type(new Zr);return new Ye((t||[])[0],n.keysSorted())}}throw new Error('Unrecognized type: "'.concat(Mt[e],'" (').concat(e,")"))}function Ey(r,t){let e=t.fields.map(s=>ht.encode(r,s));fe.startFieldsVector(r,e.length);let n=fe.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?fe.createCustomMetadataVector(r,[...t.metadata].map(([s,a])=>{let c=r.createString("".concat(s)),d=r.createString("".concat(a));return Xt.startKeyValue(r),Xt.addKey(r,c),Xt.addValue(r,d),Xt.endKeyValue(r)})):-1;return fe.startSchema(r),fe.addFields(r,n),fe.addEndianness(r,ky?$r.Little:$r.Big),i!==-1&&fe.addCustomMetadata(r,i),fe.endSchema(r)}function Oy(r,t){let e=-1,n=-1,i=-1,s=t.type,a=t.typeId;k.isDictionary(s)?(a=s.dictionary.typeId,i=Yo.visit(s,r),n=Yo.visit(s.dictionary,r)):n=Yo.visit(s,r);let c=(s.children||[]).map(u=>ht.encode(r,u)),d=oe.createChildrenVector(r,c),h=t.metadata&&t.metadata.size>0?oe.createCustomMetadataVector(r,[...t.metadata].map(([u,I])=>{let T=r.createString("".concat(u)),E=r.createString("".concat(I));return Xt.startKeyValue(r),Xt.addKey(r,T),Xt.addValue(r,E),Xt.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),oe.startField(r),oe.addType(r,n),oe.addTypeType(r,a),oe.addChildren(r,d),oe.addNullable(r,!!t.nullable),e!==-1&&oe.addName(r,e),i!==-1&&oe.addDictionary(r,i),h!==-1&&oe.addCustomMetadata(r,h),oe.endField(r)}function My(r,t){let e=t.nodes||[],n=t.buffers||[];Ie.startNodesVector(r,e.length);for(let a of e.slice().reverse())Ue.encode(r,a);let i=r.endVector();Ie.startBuffersVector(r,n.length);for(let a of n.slice().reverse())pe.encode(r,a);let s=r.endVector();return Ie.startRecordBatch(r),Ie.addLength(r,BigInt(t.length)),Ie.addNodes(r,i),Ie.addBuffers(r,s),Ie.endRecordBatch(r)}function Uy(r,t){let e=ne.encode(r,t.data);return mr.startDictionaryBatch(r),mr.addId(r,BigInt(t.id)),mr.addIsDelta(r,t.isDelta),mr.addData(r,e),mr.endDictionaryBatch(r)}function Ry(r,t){return Pn.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function Ly(r,t){return Cn.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var ky=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var Tc=r=>"Expected ".concat(_t[r]," Message in stream, but was null or length 0."),xc=r=>"Header pointer of flatbuffer-encoded ".concat(_t[r]," Message is null or length 0."),wf=(r,t)=>"Expected to read ".concat(r," metadata bytes, but only read ").concat(t,"."),vf=(r,t)=>"Expected to read ".concat(r," bytes for message body, but only read ").concat(t,"."),ni=class{constructor(t){this.source=t instanceof lr?t:new lr(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?Ct:t.value===-1&&(t=this.readMetadataLength()).done?Ct:(t=this.readMetadata(t.value)).done?Ct: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(Tc(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=Z(this.source.read(t));if(e.byteLength<t)throw new Error(vf(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=_t.Schema,n=this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(xc(e));return i}readMetadataLength(){let t=this.source.read(Jo),e=t&&new Se(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 Ct;if(e.byteLength<t)throw new Error(wf(t,e.byteLength));return{done:!1,value:_e.decode(e)}}},ds=class{constructor(t,e){this.source=t instanceof Oe?t:Ts(t)?new nn(t,e):new Oe(t)}[Symbol.asyncIterator](){return this}next(){return L(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?Ct:t.value===-1&&(t=yield this.readMetadataLength()).done?Ct:(t=yield this.readMetadata(t.value)).done?Ct:t})}throw(t){return L(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return L(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return L(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(Tc(t));return e.value})}readMessageBody(t){return L(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=Z(yield this.source.read(t));if(e.byteLength<t)throw new Error(vf(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(){return L(this,arguments,void 0,function*(t=!1){let e=_t.Schema,n=yield this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(xc(e));return i})}readMetadataLength(){return L(this,void 0,void 0,function*(){let t=yield this.source.read(Jo),e=t&&new Se(t),n=(e==null?void 0:e.readInt32(0))||0;return{done:n===0,value:n}})}readMetadata(t){return L(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return Ct;if(e.byteLength<t)throw new Error(wf(t,e.byteLength));return{done:!1,value:_e.decode(e)}})}},fs=class extends ni{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Ni?t:new Ni(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:_e.fromJSON(t.schema,_t.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:_e.fromJSON(e,_t.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:_e.fromJSON(e,_t.RecordBatch)}}return this._body=[],Ct}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((i,s)=>[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE_ID&&[s.TYPE_ID]||[],...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(Tc(t));return e.value}readSchema(){let t=_t.Schema,e=this.readMessage(t),n=e==null?void 0:e.header();if(!e||!n)throw new Error(xc(t));return n}},Jo=4,Ac="ARROW1",ii=new Uint8Array(Ac.length);for(let r=0;r<Ac.length;r+=1)ii[r]=Ac.codePointAt(r);function Xo(r,t=0){for(let e=-1,n=ii.length;++e<n;)if(ii[e]!==r[t+e])return!1;return!0}var si=ii.length,Ec=si+Jo,Sf=si*2+Jo;var ie=class r extends gn{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 ke(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 ee.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return ee.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:Fs(t)?Cy(t):Ts(t)?Vy(t):ke(t)?L(this,void 0,void 0,function*(){return yield r.from(yield t)}):xs(t)||_i(t)||Os(t)||Ae(t)?Hy(new Oe(t)):Py(new lr(t))}static readAll(t){return t instanceof r?t.isSync()?If(t):Df(t):Fs(t)||ArrayBuffer.isView(t)||Ne(t)||As(t)?If(t):Df(t)}},dr=class extends ie{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return we(this,arguments,function*(){yield lt(yield*un(kn(Le(this[Symbol.iterator]()))))})}},sn=class extends ie{constructor(t){super(t),this._impl=t}readAll(){return L(this,void 0,void 0,function*(){var t,e,n,i;let s=new Array;try{for(var a=!0,c=Le(this),d;d=yield c.next(),t=d.done,!t;a=!0){i=d.value,a=!1;let h=i;s.push(h)}}catch(h){e={error:h}}finally{try{!a&&!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]()}},on=class extends dr{constructor(t){super(t),this._impl=t}},hs=class extends sn{constructor(t){super(t),this._impl=t}},Zo=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=st({type:new Nt(this.schema.fields),length:t.length,children:n});return new Gt(this.schema,i)}_loadDictionaryBatch(t,e){let{id:n,isDelta:i}=t,{dictionaries:s,schema:a}=this,c=s.get(n),d=a.dictionaries.get(n),h=this._loadVectors(t.data,e,[d]);return(c&&i?c.concat(new yt(h)):new yt(h)).memoize()}_loadVectors(t,e,n){return new Vi(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},oi=class extends Zo{constructor(t,e){super(e),this._reader=Fs(t)?new fs(this._handle=t):new ni(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=Bf(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):Ct}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Ct}next(){if(this.closed)return Ct;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 Fn(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},ai=class extends Zo{constructor(t,e){super(e),this._reader=new ds(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return L(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 L(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Bf(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return L(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):Ct})}return(t){return L(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Ct})}next(){return L(this,void 0,void 0,function*(){if(this.closed)return Ct;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 Fn(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return L(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Qo=class extends oi{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 Ci?t:new Ci(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(_t.RecordBatch);if(i!=null&&i.isRecordBatch()){let s=i.header(),a=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,a)}}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(_t.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){let s=i.header(),a=this._reader.readMessageBody(i.bodyLength),c=this._loadDictionaryBatch(s,a);this.dictionaries.set(s.id,c)}}}_readFooter(){let{_handle:t}=this,e=t.size-Ec,n=t.readInt32(e),i=t.readAt(e-n,n);return Mr.decode(i)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},Oc=class extends ai{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 nn?t:new nn(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return L(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){return L(this,void 0,void 0,function*(){var e;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(_t.RecordBatch);if(i!=null&&i.isRecordBatch()){let s=i.header(),a=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,a)}}return null})}_readDictionaryBatch(t){return L(this,void 0,void 0,function*(){var e;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(_t.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){let s=i.header(),a=yield this._reader.readMessageBody(i.bodyLength),c=this._loadDictionaryBatch(s,a);this.dictionaries.set(s.id,c)}}})}_readFooter(){return L(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-Ec,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return Mr.decode(i)})}_readNextMessageAndValidate(t){return L(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})}},Mc=class extends oi{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new Do(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function Bf(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*If(r){let t=ie.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Df(r){return we(this,arguments,function*(){let e=yield lt(ie.from(r));try{if(!(yield lt(e.open({autoDestroy:!1}))).closed)do yield yield lt(e);while(!(yield lt(e.reset().open())).closed)}finally{yield lt(e.cancel())}})}function Cy(r){return new dr(new Mc(r))}function Py(r){let t=r.peek(si+7&-8);return t&&t.byteLength>=4?Xo(t)?new on(new Qo(r.read())):new dr(new oi(r)):new dr(new oi(function*(){}()))}function Hy(r){return L(this,void 0,void 0,function*(){let t=yield r.peek(si+7&-8);return t&&t.byteLength>=4?Xo(t)?new on(new Qo(yield r.read())):new sn(new ai(r)):new sn(new ai(function(){return we(this,arguments,function*(){})}()))})}function Vy(r){return L(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new nn(r,t);return t>=Sf&&Xo(yield e.readAt(0,si+7&-8))?new hs(new Oc(e)):new sn(new ai(e))})}var Vt=class r extends ${static assemble(...t){let e=i=>i.flatMap(s=>Array.isArray(s)?e(s):s instanceof Gt?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 yt)return this.visitMany(t.data),this;let{type:e}=t;if(!k.isDictionary(e)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(k.isUnion(e))this.nodes.push(new Ue(n,0));else{let{nullCount:i}=t;k.isNull(e)||Xe.call(this,i<=0?new Uint8Array(0):mn(t.offset,n,t.nullBitmap)),this.nodes.push(new Ue(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 Xe(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new pe(this._byteLength,t)),this._byteLength+=t,this}function Wy(r){var t;let{type:e,length:n,typeIds:i,valueOffsets:s}=r;if(Xe.call(this,i),e.mode===Ot.Sparse)return Uc.call(this,r);if(e.mode===Ot.Dense){if(r.offset<=0)return Xe.call(this,s),Uc.call(this,r);{let a=new Int32Array(n),c=Object.create(null),d=Object.create(null);for(let h,u,I=-1;++I<n;)(h=i[I])!==void 0&&((u=c[h])===void 0&&(u=c[h]=s[I]),a[I]=s[I]-u,d[h]=((t=d[h])!==null&&t!==void 0?t:0)+1);Xe.call(this,a),this.visitMany(r.children.map((h,u)=>{let I=e.typeIds[u],T=c[I],E=d[I];return h.slice(T,Math.min(n,E))}))}}return this}function zy(r){let t;return r.nullCount>=r.length?Xe.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?Xe.call(this,mn(r.offset,r.length,t)):Xe.call(this,_n(r.values))}function Hr(r){return Xe.call(this,r.values.subarray(0,r.length*r.stride))}function ta(r){let{length:t,values:e,valueOffsets:n}=r,i=wt(n[0]),s=wt(n[t]),a=Math.min(s-i,e.byteLength-i);return Xe.call(this,Us(-i,t+1,n)),Xe.call(this,e.subarray(i,i+a)),this}function Rc(r){let{length:t,valueOffsets:e}=r;if(e){let{[0]:n,[t]:i}=e;return Xe.call(this,Us(-n,t+1,e)),this.visit(r.children[0].slice(n,i-n))}return this.visit(r.children[0])}function Uc(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}Vt.prototype.visitBool=zy;Vt.prototype.visitInt=Hr;Vt.prototype.visitFloat=Hr;Vt.prototype.visitUtf8=ta;Vt.prototype.visitLargeUtf8=ta;Vt.prototype.visitBinary=ta;Vt.prototype.visitLargeBinary=ta;Vt.prototype.visitFixedSizeBinary=Hr;Vt.prototype.visitDate=Hr;Vt.prototype.visitTimestamp=Hr;Vt.prototype.visitTime=Hr;Vt.prototype.visitDecimal=Hr;Vt.prototype.visitList=Rc;Vt.prototype.visitStruct=Uc;Vt.prototype.visitUnion=Wy;Vt.prototype.visitInterval=Hr;Vt.prototype.visitDuration=Hr;Vt.prototype.visitFixedSizeList=Rc;Vt.prototype.visitMap=Rc;var An=class extends gn{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 cr,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,ce(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 ke(t)?t.then(e=>this.writeAll(e)):Ae(t)?kc(this,t):Lc(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 cr?this._sink=t:(this._sink=new cr,t&&Hu(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Vu(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!e||!Bn(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 de&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof Gt&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!Bn(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof Gt?t instanceof Fn||this._writeRecordBatch(t):t instanceof de?this.writeAll(t.batches):Ne(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=_e.encode(t),s=i.byteLength,a=this._writeLegacyIpcFormat?4:8,c=s+a+n&~n,d=c-s-a;return t.headerType===_t.RecordBatch?this._recordBatchBlocks.push(new Ur(c,t.bodyLength,this._position)):t.headerType===_t.DictionaryBatch&&this._dictionaryBlocks.push(new Ur(c,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(c-a)),s>0&&this._write(i),this._writePadding(d)}_write(t){if(this._started){let e=Z(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(_e.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(ii)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:s}=Vt.assemble(t),a=new ne(t.numRows,n,i),c=_e.from(a,e);return this._writeDictionaries(t)._writeMessage(c)._writeBodyBuffers(s)}_writeDictionaryBatch(t,e,n=!1){let{byteLength:i,nodes:s,bufferRegions:a,buffers:c}=Vt.assemble(new yt([t])),d=new ne(t.length,s,a),h=new me(d,e,n),u=_e.from(h,i);return this._writeMessage(u)._writeBodyBuffers(c)}_writeBodyBuffers(t){let e,n,i;for(let s=-1,a=t.length;++s<a;)(e=t[s])&&(n=e.byteLength)>0&&(this._write(e),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){var e,n;for(let[i,s]of t.dictionaries){let a=(e=s==null?void 0:s.data)!==null&&e!==void 0?e:[],c=this._seenDictionaries.get(i),d=(n=this._dictionaryDeltaOffsets.get(i))!==null&&n!==void 0?n:0;if(!c||c.data[0]!==a[0])for(let[h,u]of a.entries())this._writeDictionaryBatch(u,i,h>0);else if(d<a.length)for(let h of a.slice(d))this._writeDictionaryBatch(h,i,!0);this._seenDictionaries.set(i,s),this._dictionaryDeltaOffsets.set(i,a.length)}return this}},Tn=class r extends An{static writeAll(t,e){let n=new r(e);return ke(t)?t.then(i=>n.writeAll(i)):Ae(t)?kc(n,t):Lc(n,t)}},xn=class r extends An{static writeAll(t){let e=new r;return ke(t)?t.then(n=>e.writeAll(n)):Ae(t)?kc(e,t):Lc(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,e,n=!1){if(!n&&this._seenDictionaries.has(e))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,e,n)}_writeFooter(t){let e=Mr.encode(new Mr(t,It.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function Lc(r,t){let e=t;t instanceof de&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function kc(r,t){return L(this,void 0,void 0,function*(){var e,n,i,s,a,c,d;try{for(e=!0,n=Le(t);i=yield n.next(),s=i.done,!s;e=!0){d=i.value,e=!1;let h=d;r.write(h)}}catch(h){a={error:h}}finally{try{!e&&!s&&(c=n.return)&&(yield c.call(n))}finally{if(a)throw a.error}}return r.finish()})}function Ff(r,t){if(Ae(r))return $y(r,t);if(Ne(r))return jy(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function jy(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(a){s(a,e||(e=r[Symbol.iterator]()))},pull(a){e?s(a,e):a.close()},cancel(){(e!=null&&e.return&&e.return()||!0)&&(e=null)}}),Object.assign({highWaterMark:n?i:void 0},t));function s(a,c){let d,h=null,u=a.desiredSize||null;for(;!(h=c.next(n?u:null)).done;)if(ArrayBuffer.isView(h.value)&&(d=Z(h.value))&&(u!=null&&n&&(u=u-d.byteLength+1),h.value=d),a.enqueue(h.value),u!=null&&--u<=0)return;a.close()}}function $y(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(a){return L(this,void 0,void 0,function*(){yield s(a,e||(e=r[Symbol.asyncIterator]()))})},pull(a){return L(this,void 0,void 0,function*(){e?yield s(a,e):a.close()})},cancel(){return L(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(a,c){return L(this,void 0,void 0,function*(){let d,h=null,u=a.desiredSize||null;for(;!(h=yield c.next(n?u:null)).done;)if(ArrayBuffer.isView(h.value)&&(d=Z(h.value))&&(u!=null&&n&&(u=u-d.byteLength+1),h.value=d),a.enqueue(h.value),u!=null&&--u<=0)return;a.close()})}}function xf(r){return new Nc(r)}var Nc=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,s=Cu(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=vn(s),this._getSize=i!=="bytes"?Af:Tf;let{["highWaterMark"]:a=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:a,size:i!=="bytes"?Af:Tf}),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)}},Af=r=>{var t;return(t=r==null?void 0:r.length)!==null&&t!==void 0?t:0},Tf=r=>{var t;return(t=r==null?void 0:r.byteLength)!==null&&t!==void 0?t:0};function ea(r,t){let e=new cr,n=null,i=new ReadableStream({cancel(){return L(this,void 0,void 0,function*(){yield e.close()})},start(c){return L(this,void 0,void 0,function*(){yield a(c,n||(n=yield s()))})},pull(c){return L(this,void 0,void 0,function*(){n?yield a(c,n):c.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:i};function s(){return L(this,void 0,void 0,function*(){return yield(yield ie.from(e)).open(t)})}function a(c,d){return L(this,void 0,void 0,function*(){let h=c.desiredSize,u=null;for(;!(u=yield d.next()).done;)if(c.enqueue(u.value),h!=null&&--h<=0)return;c.close()})}}function ra(r,t){let e=new this(r),n=new Oe(e),i=new ReadableStream({cancel(){return L(this,void 0,void 0,function*(){yield n.cancel()})},pull(a){return L(this,void 0,void 0,function*(){yield s(a)})},start(a){return L(this,void 0,void 0,function*(){yield s(a)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(e,r),readable:i};function s(a){return L(this,void 0,void 0,function*(){let c=null,d=a.desiredSize;for(;c=yield n.read(d||null);)if(a.enqueue(c),d!=null&&(d-=c.byteLength)<=0)return;a.close()})}}function na(r,t="stream"){return(t==="stream"?Tn:xn).writeAll(r).toUint8Array(!0)}var Ky=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Ka),wc),dc),Ja),Wa),uc),$a),{compareSchemas:Bn,compareFields:rf,compareTypes:nf});ee.toDOMStream=Ff;Pt.throughDOM=xf;ie.throughDOM=ea;on.throughDOM=ea;dr.throughDOM=ea;An.throughDOM=ra;xn.throughDOM=ra;Tn.throughDOM=ra;function ci(r){switch(r.typeId){case m.Binary:return{sqlType:"binary"};case m.Bool:return{sqlType:"bool"};case m.Date:return{sqlType:"date"};case m.DateDay:return{sqlType:"date32[d]"};case m.DateMillisecond:return{sqlType:"date64[ms]"};case m.Decimal:{let t=r;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case m.Float:return{sqlType:"float"};case m.Float16:return{sqlType:"float16"};case m.Float32:return{sqlType:"float32"};case m.Float64:return{sqlType:"float64"};case m.Int:return{sqlType:"int32"};case m.Int16:return{sqlType:"int16"};case m.Int32:return{sqlType:"int32"};case m.Int64:return{sqlType:"int64"};case m.Uint16:return{sqlType:"uint16"};case m.Uint32:return{sqlType:"uint32"};case m.Uint64:return{sqlType:"uint64"};case m.Uint8:return{sqlType:"uint8"};case m.IntervalDayTime:return{sqlType:"interval[dt]"};case m.IntervalYearMonth:return{sqlType:"interval[m]"};case m.List:return{sqlType:"list",valueType:ci(r.valueType)};case m.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:r.byteWidth};case m.Null:return{sqlType:"null"};case m.Utf8:return{sqlType:"utf8"};case m.Struct:return{sqlType:"struct",fields:r.children.map(e=>ia(e.name,e.type))};case m.Map:{let t=r;return{sqlType:"map",keyType:ci(t.keyType),valueType:ci(t.valueType)}}case m.Time:return{sqlType:"time[s]"};case m.TimeMicrosecond:return{sqlType:"time[us]"};case m.TimeMillisecond:return{sqlType:"time[ms]"};case m.TimeNanosecond:return{sqlType:"time[ns]"};case m.TimeSecond:return{sqlType:"time[s]"};case m.Timestamp:return{sqlType:"timestamp",timezone:r.timezone||void 0};case m.TimestampSecond:return{sqlType:"timestamp[s]",timezone:r.timezone||void 0};case m.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:r.timezone||void 0};case m.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:r.timezone||void 0};case m.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:r.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(r.toString()))}function ia(r,t){let e=ci(t);return e.name=r,e}var sa=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=ie.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new de(n)}async send(t,e=!1){let n=this._bindings.startPendingQuery(this._conn,t,e);for(;n==null;)n=await new Promise((a,c)=>{try{a(this._bindings.pollPendingQuery(this._conn))}catch(d){console.log(d),d.message.includes("worker is not set!")?c(new Error("Worker has been terminated")):c(d)}});let i=new oa(this._bindings,this._conn,n),s=ie.from(i);return console.assert(s.isSync()),console.assert(s.isStream()),s}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 Cc(this._bindings,this._conn,e)}createScalarFunction(t,e,n){this._bindings.createScalarFunction(this._conn,t,e,n)}insertArrowTable(t,e){let n=na(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)}},oa=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=null;do t=this.bindings.fetchQueryResults(this.conn);while(t==null);return this._depleted=t.length==0,{done:this._depleted,value:t}}[Symbol.iterator](){return this}},Cc=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=ie.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new de(n)}send(...t){let e=this.bindings.sendPrepared(this.connectionId,this.statementId,t),n=new oa(this.bindings,this.connectionId,e),i=ie.from(n);return console.assert(i.isSync()),console.assert(i.isStream()),i}};function Of(r){return r<=255}function Mf(r){return r===256}var Lf=new TextEncoder,Uf=new TextDecoder("utf-8");function Pc(r,t,e){let n=Lf.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 Vc(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 Hc(r,t,e,n){let i=r.HEAPU8.subarray(t,t+n*Vc(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 Rf(r,t,e){let n=r.HEAPU8.subarray(t,t+e);return new Uint8Array(n.buffer,n.byteOffset,e)}function aa(r,t,e){let n=r.HEAPU8.subarray(t,t+e*8);return new Float64Array(n.buffer,n.byteOffset,e)}function kf(r,t,e,n,i,s,a,c){try{let d=r._udfFunctions.get(n);if(!d){Pc(t,e,"Unknown UDF with id: "+n);return}let h=Uf.decode(t.HEAPU8.subarray(i,i+s)),u=JSON.parse(h),I=aa(t,a,c/8),T=D=>{var A;let N=null;switch(D.validityBuffer!==void 0&&(N=Rf(t,I[D.validityBuffer],u.rows)),D.physicalType){case"VARCHAR":{if(D.dataBuffer===null||D.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for VARCHAR argument");if(D.lengthBuffer===null||D.lengthBuffer===void 0)throw new Error("malformed data view, expected data length buffer for VARCHAR argument");let J=Hc(t,I[D.dataBuffer],D.physicalType,u.rows),B=[],W=aa(t,I[D.lengthBuffer],u.rows);for(let Q=0;Q<u.rows;++Q){if(N!=null&&!N[Q]){B.push(null);continue}let pt=t.HEAPU8.subarray(J[Q],J[Q]+W[Q]),Ht=Uf.decode(pt);B.push(Ht)}return Q=>B[Q]}case"STRUCT":{let J={},B=[];for(let W=0;W<(((A=D.children)==null?void 0:A.length)||0);++W){let Q=D.children[W],pt=T(Q);B.push(Ht=>{J[Q.name]=pt(Ht)})}return N!=null?W=>{if(!N[W])return null;for(let Q of B)Q(W);return J}:W=>{for(let Q of B)Q(W);return J}}default:{if(D.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for argument of type: "+D.physicalType);let J=Hc(t,I[D.dataBuffer],D.physicalType,u.rows);return N!=null?B=>N[B]?J[B]:null:B=>J[B]}}},E=[];for(let D=0;D<u.args.length;++D)E.push(T(u.args[D]));let ft=u.rows*Vc(u.ret.physicalType),At=t._malloc(ft),jt=Hc(t,At,u.ret.physicalType,u.rows),Lt=t._malloc(u.rows),Tt=Rf(t,Lt,u.rows);if(jt.length==0||Tt.length==0){Pc(t,e,"Can't create physical arrays for result");return}let bt=jt;u.ret.physicalType=="VARCHAR"&&(bt=new Array(u.rows));let xt=[];for(let D=0;D<u.args.length;++D)xt.push(null);for(let D=0;D<u.rows;++D){for(let A=0;A<u.args.length;++A)xt[A]=E[A](D);let N=d.func(...xt);bt[D]=N,Tt[D]=N==null?0:1}let U=0;switch(u.ret.physicalType){case"VARCHAR":{let D=new Array(0);U=t._malloc(u.rows*Vc("DOUBLE"));let N=aa(t,U,u.rows),A=0;for(let Q=0;Q<u.rows;++Q){let pt=Lf.encode(bt[Q]||"");D.push(pt),N[Q]=pt.length,A+=pt.length}let J=t._malloc(A),B=t.HEAPU8.subarray(J,J+A),W=0;for(let Q=0;Q<u.rows;++Q){jt[Q]=W;let pt=D[Q];B.subarray(W,W+pt.length).set(pt),W+=pt.length}}}let w=3*8,M=t._malloc(w),H=aa(t,M,3);H[0]=At,H[1]=Lt,H[2]=U,t.HEAPF64[(e>>3)+0]=0,t.HEAPF64[(e>>3)+1]=M,t.HEAPF64[(e>>3)+2]=0}catch(d){Pc(t,e,d.toString())}}function Xy(){let r=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),r.decode(t))}var Zy=Xy();function Ze(r,t){console.error("FAIL WITH: ".concat(t)),r.ccall("duckdb_web_fail_with",null,["string"],[t])}function En(r,t,e){let n=r.HEAPU8.subarray(t,t+e),i=new Uint8Array(new ArrayBuffer(n.byteLength));return i.set(n),i}function at(r,t,e){return Zy(r.HEAPU8.subarray(t,t+e))}function Ft(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 a=r.HEAPF64[(s>>3)+0],c=r.HEAPF64[(s>>3)+1],d=r.HEAPF64[(s>>3)+2];return r.stackRestore(i),[a,c,d]}function Rt(r){r.ccall("duckdb_web_clear_response",null,[],[])}var ca=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 li=new TextEncoder;var la=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),globalThis.DUCKDB_BINDINGS=this,this)}open(t){let[e,n,i]=Ft(this.mod,"duckdb_web_open",["string"],[JSON.stringify(t)]);if(e!==0)throw new Error(at(this.mod,n,i));Rt(this.mod)}reset(){let[t,e,n]=Ft(this.mod,"duckdb_web_reset",[],[]);if(t!==0)throw new Error(at(this.mod,e,n));Rt(this.mod)}getVersion(){let[t,e,n]=Ft(this.mod,"duckdb_web_get_version",[],[]);if(t!==0)throw new Error(at(this.mod,e,n));let i=at(this.mod,e,n);return Rt(this.mod),i}getFeatureFlags(){return this.mod.ccall("duckdb_web_get_feature_flags","number",[],[])}tokenize(t){let e=li.encode(t),n=this.mod._malloc(e.length);this.mod.HEAPU8.subarray(n,n+e.length).set(e);let[s,a,c]=Ft(this.mod,"duckdb_web_tokenize_buffer",["number","number"],[n,e.length]);if(this.mod._free(n),s!==0)throw new Error(at(this.mod,a,c));let d=at(this.mod,a,c);return Rt(this.mod),JSON.parse(d)}connect(){let t=this.mod.ccall("duckdb_web_connect","number",[],[]);return new sa(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=li.encode(e),i=this.mod._malloc(n.length);this.mod.HEAPU8.subarray(i,i+n.length).set(n);let[a,c,d]=Ft(this.mod,"duckdb_web_query_run_buffer",["number","number","number"],[t,i,n.length]);if(this.mod._free(i),a!==0)throw new Error(at(this.mod,c,d));let h=En(this.mod,c,d);return Rt(this.mod),h}startPendingQuery(t,e,n=!1){let i=li.encode(e),s=this.mod._malloc(i.length);this.mod.HEAPU8.subarray(s,s+i.length).set(i);let[c,d,h]=Ft(this.mod,"duckdb_web_pending_query_start_buffer",["number","number","number","boolean"],[t,s,i.length,n]);if(this.mod._free(s),c!==0)throw new Error(at(this.mod,d,h));if(d==0)return null;let u=En(this.mod,d,h);return Rt(this.mod),u}pollPendingQuery(t){let[e,n,i]=Ft(this.mod,"duckdb_web_pending_query_poll",["number"],[t]);if(e!==0)throw new Error(at(this.mod,n,i));if(n==0)return null;let s=En(this.mod,n,i);return Rt(this.mod),s}cancelPendingQuery(t){return this.mod.ccall("duckdb_web_pending_query_cancel","boolean",["number"],[t])}fetchQueryResults(t){let[e,n,i]=Ft(this.mod,"duckdb_web_query_fetch_results",["number"],[t]);if(Mf(e))return Rt(this.mod),null;if(!Of(e))throw new Error("Unexpected StatusCode from duckdb_web_query_fetch_results ("+e+") and with self reported error as"+at(this.mod,n,i));if(e!==0)throw new Error(at(this.mod,n,i));let s=En(this.mod,n,i);return Rt(this.mod),s}getTableNames(t,e){let n=li.encode(e),i=this.mod._malloc(n.length);this.mod.HEAPU8.subarray(i,i+n.length).set(n);let[a,c,d]=Ft(this.mod,"duckdb_web_get_tablenames_buffer",["number","number","number"],[t,i,n.length]);if(this.mod._free(i),a!==0)throw new Error(at(this.mod,c,d));let h=at(this.mod,c,d);return Rt(this.mod),JSON.parse(h)}createScalarFunction(t,e,n,i){let s={functionId:this._nextUDFId,name:e,returnType:ci(n)},a={functionId:s.functionId,connectionId:t,name:e,returnType:n,func:i};this._nextUDFId+=1;let[c,d,h]=Ft(this.mod,"duckdb_web_udf_scalar_create",["number","string"],[t,JSON.stringify(s)]);if(c!==0)throw new Error(at(this.mod,d,h));if(Rt(this.mod),globalThis.DUCKDB_RUNTIME._udfFunctions=(globalThis.DUCKDB_RUNTIME._udfFunctions||new Map).set(a.functionId,a),this.pthread)for(let u of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])u.postMessage({cmd:"registerUDFFunction",udf:a})}createPrepared(t,e){let n=li.encode(e),i=this.mod._malloc(n.length);this.mod.HEAPU8.subarray(i,i+n.length).set(n);let[a,c,d]=Ft(this.mod,"duckdb_web_prepared_create_buffer",["number","number","number"],[t,i,n.length]);if(this.mod._free(i),a!==0)throw new Error(at(this.mod,c,d));return Rt(this.mod),c}closePrepared(t,e){let[n,i,s]=Ft(this.mod,"duckdb_web_prepared_close",["number","number"],[t,e]);if(n!==0)throw new Error(at(this.mod,i,s));Rt(this.mod)}runPrepared(t,e,n){let[i,s,a]=Ft(this.mod,"duckdb_web_prepared_run",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(at(this.mod,s,a));let c=En(this.mod,s,a);return Rt(this.mod),c}sendPrepared(t,e,n){let[i,s,a]=Ft(this.mod,"duckdb_web_prepared_send",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(at(this.mod,s,a));let c=En(this.mod,s,a);return Rt(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 a=n?JSON.stringify(n):"",[c,d,h]=Ft(this.mod,"duckdb_web_insert_arrow_from_ipc_stream",["number","number","number","string"],[t,i,e.length,a]);if(this.mod._free(i),c!==0)throw new Error(at(this.mod,d,h))}insertCSVFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let h in n.columns)n.columnsFlat.push(ia(h,n.columns[h]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[a,c,d]=Ft(this.mod,"duckdb_web_insert_csv_from_path",["number","string","string"],[t,e,s]);if(a!==0)throw new Error(at(this.mod,c,d))}insertJSONFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let h in n.columns)n.columnsFlat.push(ia(h,n.columns[h]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[a,c,d]=Ft(this.mod,"duckdb_web_insert_json_from_path",["number","string","string"],[t,e,s]);if(a!==0)throw new Error(at(this.mod,c,d))}globFiles(t){let[e,n,i]=Ft(this.mod,"duckdb_web_fs_glob_file_infos",["string"],[t]);if(e!==0)throw new Error(at(this.mod,n,i));let s=at(this.mod,n,i);Rt(this.mod);let a=JSON.parse(s);return a==null?[]:a}registerFileURL(t,e,n,i=!1){e===void 0&&(e=t);let[s,a,c]=Ft(this.mod,"duckdb_web_fs_register_file_url",["string","string"],[t,e,n,i]);if(s!==0)throw new Error(at(this.mod,a,c));Rt(this.mod)}registerFileText(t,e){let n=li.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,a,c]=Ft(this.mod,"duckdb_web_fs_register_file_buffer",["string","number","number"],[t,n,e.length]);if(s!==0)throw new Error(at(this.mod,a,c));Rt(this.mod)}async prepareFileHandle(t,e){if(e===3&&this._runtime.prepareFileHandles){let n=await this._runtime.prepareFileHandles([t],3);for(let i of n){let{handle:s,path:a,fromCached:c}=i;!c&&await this.registerFileHandleAsync(a,s,3,!0)}return}throw new Error("prepareFileHandle: unsupported protocol ".concat(e))}async prepareDBFileHandle(t,e){if(e===3&&this._runtime.prepareDBFileHandle){let n=await this._runtime.prepareDBFileHandle(t,3);for(let i of n){let{handle:s,path:a,fromCached:c}=i;!c&&await this.registerFileHandleAsync(a,s,3,!0)}return}throw new Error("prepareDBFileHandle: unsupported protocol ".concat(e))}async prepareFileHandleAsync(t,e,n,i){if(n===3&&!(e instanceof FileSystemSyncAccessHandle)){if(e instanceof FileSystemFileHandle){let s=e;try{e=await s.createSyncAccessHandle()}catch(a){throw new Error(a.message+":"+t)}}else if(t!=null)try{e=await(await(await navigator.storage.getDirectory()).getFileHandle(t)).createSyncAccessHandle()}catch(s){throw new Error(s.message+":"+t)}}return e}async registerFileHandleAsync(t,e,n,i){let s=await this.prepareFileHandleAsync(t,e,n,i);this.registerFileHandle(t,s,n,i)}registerFileHandle(t,e,n,i){var d;let[s,a,c]=Ft(this.mod,"duckdb_web_fs_register_file_url",["string","string","number","boolean"],[t,t,n,i]);if(s!==0)throw new Error(at(this.mod,a,c));/*PATCH_C1*/if(t.startsWith("opfs://")){let _alt="opfs:/"+t.slice(7);Ft(this.mod,"duckdb_web_fs_register_file_url",["string","string","number","boolean"],[_alt,_alt,n,i])}if(Rt(this.mod),globalThis.DUCKDB_RUNTIME._files=(globalThis.DUCKDB_RUNTIME._files||new Map).set(t,e),t.startsWith("opfs://")&&globalThis.DUCKDB_RUNTIME._files.set("opfs:/"+t.slice(7),e),(d=globalThis.DUCKDB_RUNTIME._preparedHandles)!=null&&d[t]&&delete globalThis.DUCKDB_RUNTIME._preparedHandles[t],this.pthread){/*PATCH_D*/try{for(let h of this.pthread.runningWorkers)h.postMessage({cmd:"registerFileHandle",fileName:t,fileHandle:e})}catch(_e){};for(let h of this.pthread.unusedWorkers)h.postMessage({cmd:"dropFileHandle",fileName:t})}}dropFile(t){let[e,n,i]=Ft(this.mod,"duckdb_web_fs_drop_file",["string"],[t]);if(e!==0)throw new Error(at(this.mod,n,i));Rt(this.mod)}dropFiles(t){let e=[],n=-1;try{for(let c of t!=null?t:[])if(c!=null&&c.length>0){let d=this.mod.lengthBytesUTF8(c)+1,h=this.mod._malloc(d);if(!h)throw new Error("Failed to allocate memory for string: ".concat(c));this.mod.stringToUTF8(c,h,d),e.push(h)}if(n=this.mod._malloc(e.length*4),!n)throw new Error("Failed to allocate memory for pointers array");for(let c=0;c<e.length;c++)this.mod.HEAP32[(n>>2)+c]=e[c];let[i,s,a]=Ft(this.mod,"duckdb_web_fs_drop_files",["number","number"],[n,e.length]);if(i!==0)throw new Error(at(this.mod,s,a));Rt(this.mod)}finally{for(let i of e)this.mod._free(i);n>0&&this.mod._free(n)}}flushFiles(){this.mod.ccall("duckdb_web_flush_files",null,[],[])}copyFileToPath(t,e){let[n,i,s]=Ft(this.mod,"duckdb_web_copy_file_to_path",["string","string"],[t,e]);if(n!==0)throw new Error(at(this.mod,i,s));Rt(this.mod)}copyFileToBuffer(t){let[e,n,i]=Ft(this.mod,"duckdb_web_copy_file_to_buffer",["string"],[t]);if(e!==0)throw new Error(at(this.mod,n,i));let s=this.mod.HEAPU8.subarray(n,n+i),a=new Uint8Array(s.length);return a.set(s),Rt(this.mod),a}async registerOPFSFileName(t){if(t.startsWith("opfs://"))return this.prepareFileHandle(t,3);throw new Error("Not an OPFS file name: "+t)}collectFileStatistics(t,e){let[n,i,s]=Ft(this.mod,"duckdb_web_collect_file_stats",["string","boolean"],[t,e]);if(n!==0)throw new Error(at(this.mod,i,s))}exportFileStatistics(t){let[e,n,i]=Ft(this.mod,"duckdb_web_export_file_stats",["string"],[t]);if(e!==0)throw new Error(at(this.mod,n,i));return new ca(this.mod.HEAPU8.subarray(n,n+i))}};var ua=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":{let e=t.data.path;e!=null&&e.startsWith("opfs://")&&(await this._bindings.prepareDBFileHandle(e,3),t.data.useDirectIO=!0),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(t.data),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],t.data[2]),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),n=e?[e.buffer]:[];this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_CHUNK",data:e},n);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":await this._bindings.registerFileHandleAsync(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"REGISTER_OPFS_FILE_NAME":await this._bindings.registerOPFSFileName(t.data[0]),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 $f=ku(jf());var da=class extends la{constructor(t,e,n,i){super(t,e),this.mainModuleURL=n,this.pthreadWorkerURL=i}locateFile(t,e){if(t.endsWith(".wasm"))return this.mainModuleURL;if(t.endsWith(".worker.js")){if(!this.pthreadWorkerURL)throw new Error("Missing DuckDB worker URL!");return this.pthreadWorkerURL}throw new Error("WASM instantiation requested unexpected file: prefix=".concat(e," path=").concat(t))}instantiateWasm(t,e){globalThis.DUCKDB_RUNTIME=this._runtime;let n=this.onInstantiationProgress;if(WebAssembly.instantiateStreaming)if(typeof TransformStream=="function"){let s=(async()=>{var ft;let a=new Request(this.mainModuleURL),c=await fetch(a),d=c.headers.get("content-length"),h=d&&parseInt(d,10)||0,u=new Date,I={startedAt:u,updatedAt:u,bytesTotal:h||0,bytesLoaded:0},T={transform(At,jt){I.bytesLoaded+=At.byteLength;let Lt=new Date;if(Lt.getTime()-I.updatedAt.getTime()<20){I.updatedAt=Lt,jt.enqueue(At);return}for(let Tt of n)Tt(I);jt.enqueue(At)}},E=new TransformStream(T);return new Response((ft=c.body)==null?void 0:ft.pipeThrough(E),c)})();WebAssembly.instantiateStreaming(s,t).then(a=>{e(a.instance,a.module)})}else{console.warn("instantiating without progress handler since transform streams are unavailable");let i=new Request(this.mainModuleURL);WebAssembly.instantiateStreaming(fetch(i),t).then(s=>{e(s.instance,s.module)})}else if(typeof XMLHttpRequest=="function"){let i=new XMLHttpRequest,s=this.mainModuleURL,a=new Date,c={startedAt:a,updatedAt:a,bytesTotal:0,bytesLoaded:0};i.open("GET",s),i.responseType="arraybuffer",i.onerror=d=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to load WASM: "+d}),new Error(d.toString())},i.onprogress=d=>{c.bytesTotal=d.total,c.bytesLoaded=d.loaded;let h=new Date;if(h.getTime()-c.updatedAt.getTime()<20){c.updatedAt=h;return}for(let u of n)u(c)},i.onload=()=>{WebAssembly.instantiate(i.response,t).then(d=>{e(d.instance,d.module)}).catch(d=>{throw this.logger.log({timestamp:new Date,level:4,origin:3,topic:5,event:2,value:"Failed to instantiate WASM: "+d}),new Error(d)})},i.send()}else console.warn("instantiating with manual fetch since streaming instantiation and xhrs are unavailable"),(async()=>{let s=new Request(this.mainModuleURL),c=await(await fetch(s)).arrayBuffer();WebAssembly.instantiate(c,t).then(d=>{e(d.instance,d.module)})})();return[]}};var fa=class extends da{constructor(t,e,n,i=null){super(t,e,n,i)}instantiateImpl(t){return(0,$f.default)({...t,instantiateWasm:this.instantiateWasm.bind(this),locateFile:this.locateFile.bind(this)})}};var an=ku(qf()),Kf=function(r,t,e){var n;return(n=r==null?void 0:r.endpoint)!=null&&n.startsWith("http")?new URL(r.endpoint).host:r!=null&&r.endpoint?"".concat(e,".").concat(r==null?void 0:r.endpoint):"".concat(e,".s3.amazonaws.com")};function tb(r,t,e){var s,a,c,d;let n=Jf(t),i=n.path;if(Xf(r)){let h="";if(r!=null&&r.endpoint){let u=new URL(r.endpoint);u.pathname!=="/"&&(h=u.pathname)}i="".concat(h,"/").concat(n.bucket).concat(i)}return{url:i,query:"",host:Kf(r,t,n.bucket),region:(s=r==null?void 0:r.region)!=null?s:"",service:"s3",method:e,accessKeyId:(a=r==null?void 0:r.accessKeyId)!=null?a:"",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 eb(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 rb(r,t=null){var ft;let e=(ft=t==null?void 0:t.contentHash)!=null?ft:"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"+eb(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 a=(0,an.sha256)(s),c="AWS4-HMAC-SHA256\n"+r.datetimeNow+"\n"+r.dateNow+"/"+r.region+"/"+r.service+"/aws4_request\n"+a,d="AWS4"+r.secretAccessKey,h=an.sha256.hmac.arrayBuffer(d,r.dateNow),u=an.sha256.hmac.arrayBuffer(h,r.region),I=an.sha256.hmac.arrayBuffer(u,r.service),T=an.sha256.hmac.arrayBuffer(I,"aws4_request"),E=an.sha256.hmac(T,c);return n.set("Authorization","AWS4-HMAC-SHA256 Credential="+r.accessKeyId+"/"+r.dateNow+"/"+r.region+"/"+r.service+"/aws4_request, SignedHeaders="+i+", Signature="+E),n}var nb=function(r,t,e,n=null,i=null){let s=tb(r,t,e),a={contentType:n,contentHash:i?an.sha256.hex(i):null};return rb(s,a)};function Qe(r,t,e,n,i=null,s=null){(t!=null&&t.accessKeyId||t!=null&&t.sessionToken)&&(nb(t,e,n,i,s).forEach((c,d)=>{r.setRequestHeader(d,c)}),i&&r.setRequestHeader("content-type",i))}function Jf(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 Xf(r){var t;return!!((t=r==null?void 0:r.endpoint)!=null&&t.startsWith("http"))}function tr(r,t){let e=Jf(t);return Xf(r)?"".concat(r==null?void 0:r.endpoint,"/").concat(e.bucket)+e.path:"https://"+Kf(r,t,e.bucket)+e.path}var ib=7,Zf=/\/|\\/,rt={_files:new Map,_fileInfoCache:new Map,_udfFunctions:new Map,_globalFileInfo:null,_preparedHandles:{},_opfsRoot:null,getFileInfo(r,t){try{let e=rt._fileInfoCache.get(t),[n,i,s]=Ft(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 a=at(r,i,s);Rt(r);try{let c=JSON.parse(a);if(c==null)return null;let d={...c,blob:null};return rt._fileInfoCache.set(t,d),!rt._files.has(d.fileName)&&(rt._preparedHandles[d.fileName]?(rt._files.set(d.fileName,rt._preparedHandles[d.fileName]),delete rt._preparedHandles[d.fileName]):d.fileName.startsWith("opfs:/")&&!d.fileName.startsWith("opfs://")&&rt._preparedHandles["opfs://"+d.fileName.slice(6)]&&(rt._files.set(d.fileName,rt._preparedHandles["opfs://"+d.fileName.slice(6)]),delete rt._preparedHandles["opfs://"+d.fileName.slice(6)])),d}catch(c){return console.warn(c),null}}catch(e){return console.log(e),null}},getGlobalFileInfo(r){var t;try{let[e,n,i]=Ft(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=at(r,n,i);Rt(r);let a=JSON.parse(s);return a==null?null:(rt._globalFileInfo={...a,blob:null},rt._globalFileInfo)}catch(e){return console.log(e),null}},async assignOPFSRoot(){rt._opfsRoot||(rt._opfsRoot=await navigator.storage.getDirectory())},async prepareFileHandles(r,t){if(t===3){await rt.assignOPFSRoot();let e=async i=>{if(rt._files.has(i))return{path:i,handle:rt._files.get(i),fromCached:!0};let a=rt._opfsRoot,c=i.slice(ib),d=c;if(Zf.test(c)){let u=c.split(Zf);if(u.length===0)throw new Error("Invalid path ".concat(c));if(d=u[u.length-1],!d)throw new Error("Invalid path ".concat(c,". File Not Found."));u.pop();for(let I of u)a=await a.getDirectoryHandle(I,{create:!0})}let h=await a.getFileHandle(d,{create:!1}).catch(u=>{if((u==null?void 0:u.name)==="NotFoundError")return console.debug("File ".concat(i," does not exists yet, creating...")),a.getFileHandle(d,{create:!0});throw u});try{let u=await h.createSyncAccessHandle();return rt._preparedHandles[i]=u,/*PATCH_A*/i.startsWith("opfs://")&&(rt._preparedHandles["opfs:/"+i.slice(7)]=u),{path:i,handle:u,fromCached:!1}}catch(u){throw new Error(u.message+":"+name)}},n=[];for(let i of r){let s=await e(i);n.push(s)}return n}throw new Error("Unsupported protocol ".concat(t," for paths ").concat(r," with protocol ").concat(t))},async prepareDBFileHandle(r,t){if(t===3&&this.prepareFileHandles){let e=[r,"".concat(r,".wal")];return this.prepareFileHandles(e,t)}throw new Error("Unsupported protocol ".concat(t," for path ").concat(r," with protocol ").concat(t))},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,i,s,a,c,d;try{rt._fileInfoCache.delete(t);let h=rt.getFileInfo(r,t);switch(h==null?void 0:h.dataProtocol){case 4:case 5:{if(e&1&&e&2)throw new Error("Opening file ".concat(h.fileName," failed: cannot open file with both read and write flags set"));if(e&32)throw new Error("Opening file ".concat(h.fileName," failed: appending to HTTP/S3 files is not supported"));if(e&2){let T=new XMLHttpRequest;if(h.dataProtocol==5?(T.open("HEAD",tr(h.s3Config,h.dataUrl),!1),Qe(T,h.s3Config,h.dataUrl,"HEAD")):T.open("HEAD",h.dataUrl,!1),T.send(null),T.status!=200&&T.status!=404)throw new Error("Opening file ".concat(h.fileName," failed: Unexpected return status from server (").concat(T.status,")"));if(T.status==404&&!(e&8||e&16))throw new Error("Opening file ".concat(h.fileName," failed: Cannot write to non-existent file without FILE_FLAGS_FILE_CREATE or FILE_FLAGS_FILE_CREATE_NEW flag."));let E=r._malloc(1),ft=new Uint8Array;r.HEAPU8.set(ft,E);let At=r._malloc(3*8);return r.HEAPF64[(At>>3)+0]=1,r.HEAPF64[(At>>3)+1]=E,r.HEAPF64[(At>>3)+2]=new Date().getTime()/1e3,At}else if(!(e&1))throw new Error("Opening file ".concat(h.fileName," failed: unsupported file flags: ").concat(e));let u=null,I=null;if(!h.forceFullHttpReads&&(h.reliableHeadRequests||!h.allowFullHttpReads))try{let T=new XMLHttpRequest;h.dataProtocol==5?(T.open("HEAD",tr(h.s3Config,h.dataUrl),!1),Qe(T,h.s3Config,h.dataUrl,"HEAD")):T.open("HEAD",h.dataUrl,!1),T.setRequestHeader("Range","bytes=0-"),T.send(null),u=null;try{u=T.getResponseHeader("Content-Length")}catch(E){console.warn("Failed to get Content-Length on request")}if(u!==null&&T.status==206){let E=r._malloc(24);r.HEAPF64[(E>>3)+0]=+u,r.HEAPF64[(E>>3)+1]=0;let ft=0;try{ft=new Date((n=T.getResponseHeader("Last-Modified"))!=null?n:"").getTime()/1e3}catch(At){console.warn("Failed to get Last-Modified on request")}return r.HEAPF64[(E>>3)+2]=+ft,E}}catch(T){I=T,console.warn("HEAD request with range header failed: ".concat(T))}if(h.allowFullHttpReads){if(!h.forceFullHttpReads){let E=new XMLHttpRequest;h.dataProtocol==5?(E.open("GET",tr(h.s3Config,h.dataUrl),!1),Qe(E,h.s3Config,h.dataUrl,"GET")):E.open("GET",h.dataUrl,!1),E.responseType="arraybuffer",E.setRequestHeader("Range","bytes=0-0"),E.send(null);let ft=null;try{ft=E.getResponseHeader("Content-Length")}catch(Tt){console.warn("Failed to get Content-Length on request")}let At=ft==null?void 0:ft.split("/")[1],jt=ft,Lt=null;if(At!==void 0)Lt=At;else if(!h.reliableHeadRequests){let Tt=new XMLHttpRequest;h.dataProtocol==5?(Tt.open("HEAD",tr(h.s3Config,h.dataUrl),!1),Qe(Tt,h.s3Config,h.dataUrl,"HEAD")):Tt.open("HEAD",h.dataUrl,!1),Tt.setRequestHeader("Range","bytes=0-"),Tt.send(null),u=null;try{u=Tt.getResponseHeader("Content-Length")}catch(bt){console.warn("Failed to get Content-Length on request")}u!==null&&+u>1&&(Lt=u)}if(E.status==206&&jt!==null&&+jt==1&&Lt!==null){let Tt=r._malloc(24);r.HEAPF64[(Tt>>3)+0]=+Lt,r.HEAPF64[(Tt>>3)+1]=0;let bt=0;try{bt=new Date((i=E.getResponseHeader("Last-Modified"))!=null?i:"").getTime()/1e3}catch(xt){console.warn("Failed to get Last-Modified on request")}return r.HEAPF64[(Tt>>3)+2]=+bt,Tt}if(E.status==200&&jt!==null&&u!==null&&+jt==+u){console.warn("fall back to full HTTP read for: ".concat(h.dataUrl));let Tt=r._malloc(E.response.byteLength),bt=new Uint8Array(E.response,0,E.response.byteLength);r.HEAPU8.set(bt,Tt);let xt=r._malloc(3*8);r.HEAPF64[(xt>>3)+0]=E.response.byteLength,r.HEAPF64[(xt>>3)+1]=Tt;let U=0;try{U=new Date((s=E.getResponseHeader("Last-Modified"))!=null?s:"").getTime()/1e3}catch(w){console.warn("Failed to get Last-Modified on request")}return r.HEAPF64[(xt>>3)+2]=+U,xt}console.warn("falling back to full HTTP read for: ".concat(h.dataUrl))}let T=new XMLHttpRequest;if(h.dataProtocol==5?(T.open("GET",tr(h.s3Config,h.dataUrl),!1),Qe(T,h.s3Config,h.dataUrl,"GET")):T.open("GET",h.dataUrl,!1),T.responseType="arraybuffer",T.send(null),T.status==200){let E=r._malloc(T.response.byteLength),ft=new Uint8Array(T.response,0,T.response.byteLength);r.HEAPU8.set(ft,E);let At=r._malloc(3*8);r.HEAPF64[(At>>3)+0]=T.response.byteLength,r.HEAPF64[(At>>3)+1]=E;let jt=0;try{jt=new Date((a=T.getResponseHeader("Last-Modified"))!=null?a:"").getTime()/1e3}catch(Lt){console.warn("Failed to get Last-Modified on request")}return r.HEAPF64[(At>>3)+2]=+jt,At}}if(I!=null)throw new Error("Reading file ".concat(h.fileName," failed with error: ").concat(I));return 0}case 2:{let u=(c=rt._files)==null?void 0:c.get(h.fileName);if(u){let E=r._malloc(24);return r.HEAPF64[(E>>3)+0]=u.size,r.HEAPF64[(E>>3)+1]=0,r.HEAPF64[(E>>3)+2]=0,E}if(e&128)return 0;console.warn("Buffering missing file: ".concat(h.fileName));let I=r._malloc(3*8),T=r._malloc(1);return r.HEAPF64[(I>>3)+0]=1,r.HEAPF64[(I>>3)+1]=T,r.HEAPF64[(I>>3)+2]=0,I}case 3:{let u=(d=rt._files)==null?void 0:d.get(h.fileName);if(!u)throw new Error("No OPFS access handle registered with name: ".concat(h.fileName));e&16&&u.truncate(0);let I=r._malloc(3*8),T=u.getSize();return r.HEAPF64[(I>>3)+0]=T,r.HEAPF64[(I>>3)+1]=0,r.HEAPF64[(I>>3)+2]=0,I}}}catch(h){console.error(h.toString()),Ze(r,h.toString())}return 0},glob:(r,t,e)=>{var n;try{let i=at(r,t,e);if(i.startsWith("http")||i.startsWith("s3://")){let s=new XMLHttpRequest;if(i.startsWith("s3://")){let a=rt.getGlobalFileInfo(r);s.open("HEAD",tr(a==null?void 0:a.s3Config,i),!1),Qe(s,a==null?void 0:a.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))return console.log("HEAD request failed: ".concat(i,", with full http reads are disabled")),0;let a=new XMLHttpRequest;if(i.startsWith("s3://")){let d=rt.getGlobalFileInfo(r);a.open("GET",tr(d==null?void 0:d.s3Config,i),!1),Qe(a,d==null?void 0:d.s3Config,i,"HEAD")}else a.open("GET",i,!1);if(a.setRequestHeader("Range","bytes=0-0"),a.send(null),a.status!=200&&a.status!==206)return console.log("HEAD and GET requests failed: ".concat(i)),0;let c=null;try{c=a.getResponseHeader("Content-Length")}catch(d){console.warn("Failed to get Content-Length on request")}c&&+c>1&&console.warn("Range request for ".concat(i," did not return a partial response: ").concat(a.status,' "').concat(a.statusText,'"'))}r.ccall("duckdb_web_fs_glob_add_path",null,["string"],[i])}else for(let[s]of rt._files.entries()||[])s.startsWith(i)&&r.ccall("duckdb_web_fs_glob_add_path",null,["string"],[s])}catch(i){return console.log(i),Ze(r,i.toString()),0}},checkFile:(r,t,e)=>{try{let n=at(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",tr(s==null?void 0:s.s3Config,n),!1),Qe(i,s==null?void 0:s.s3Config,n,"HEAD")}else i.open("HEAD",n,!1);return i.send(null),i.status==206||i.status==200}else return rt._files.has(n)}catch(n){return console.log(n),!1}return!1},syncFile:(r,t)=>{},closeFile:(r,t)=>{var n;let e=rt.getFileInfo(r,t);rt._fileInfoCache.delete(t);try{switch(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()}}}catch(i){console.log(i),Ze(r,i.toString())}},dropFile:(r,t,e)=>{var s;let n=at(r,t,e),i=(s=rt._files)==null?void 0:s.get(n);if(i){if(rt._files.delete(n),i instanceof FileSystemSyncAccessHandle)try{i.flush(),i.close()}catch(a){throw new Error("Cannot drop file with name: ".concat(n))}i instanceof Blob}},truncateFile:(r,t,e)=>{var i;let n=rt.getFileInfo(r,t);switch(n==null?void 0:n.dataProtocol){case 4:Ze(r,"Cannot truncate a http file");return;case 5:Ze(r,"Cannot truncate an s3 file");return;case 0:case 1:case 2:Ze(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;if(n==0)return 0;try{let a=rt.getFileInfo(r,t);switch(a==null?void 0:a.dataProtocol){case 4:case 5:{if(!a.dataUrl)throw new Error("Missing data URL for file ".concat(t));try{let c=new XMLHttpRequest;if(a.dataProtocol==5?(c.open("GET",tr(a==null?void 0:a.s3Config,a.dataUrl),!1),Qe(c,a==null?void 0:a.s3Config,a.dataUrl,"GET")):c.open("GET",a.dataUrl,!1),c.responseType="arraybuffer",c.setRequestHeader("Range","bytes=".concat(i,"-").concat(i+n-1)),c.send(null),c.status==206||c.status==200&&n==c.response.byteLength&&i==0){let d=new Uint8Array(c.response,0,Math.min(c.response.byteLength,n));return r.HEAPU8.set(d,e),d.byteLength}else if(c.status==200){console.warn("Range request for ".concat(a.dataUrl," did not return a partial response: ").concat(c.status,' "').concat(c.statusText,'"'));let d=new Uint8Array(c.response,i,Math.min(c.response.byteLength-i,n));return r.HEAPU8.set(d,e),d.byteLength}else throw new Error("Range request for ".concat(a.dataUrl," did returned non-success status: ").concat(c.status,' "').concat(c.statusText,'"'))}catch(c){throw console.log(c),new Error("Range request for ".concat(a.dataUrl," failed with error: ").concat(c,'"'))}}case 2:{let c=(s=rt._files)==null?void 0:s.get(a.fileName);if(!c)throw new Error("No HTML5 file registered with name: ".concat(a.fileName));let d=c.slice(i,i+n),h=new Uint8Array(new FileReaderSync().readAsArrayBuffer(d));return r.HEAPU8.set(h,e),h.byteLength}case 3:{let c=rt._files.get(a.fileName);if(!c)throw new Error("No OPFS access handle registered with name: ".concat(a.fileName));let d=r.HEAPU8.subarray(e,e+n);return c.read(d,{at:i})}}return 0}catch(a){return console.log(a),Ze(r,a.toString()),0}},writeFile:(r,t,e,n,i)=>{var a;let s=rt.getFileInfo(r,t);switch(s==null?void 0:s.dataProtocol){case 4:return Ze(r,"Cannot write to HTTP file"),0;case 5:{let c=r.HEAPU8.subarray(e,e+n),d=new XMLHttpRequest;return d.open("PUT",tr(s==null?void 0:s.s3Config,s.dataUrl),!1),Qe(d,s==null?void 0:s.s3Config,s.dataUrl,"PUT","",c),d.send(c),d.status!==200?(Ze(r,"Failed writing file: HTTP "+d.status),0):n}case 2:return Ze(r,"cannot write using the html5 file reader api"),0;case 3:{let c=(a=rt._files)==null?void 0:a.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()/1e3}return 0},progressUpdate:(r,t,e)=>{postMessage&&postMessage({requestId:0,type:"PROGRESS_UPDATE",data:{status:r?"completed":"in-progress",percentage:t,repetitions:e}})},checkDirectory:(r,t,e)=>{let n=at(r,t,e);return console.log("checkDirectory: ".concat(n)),!1},createDirectory:(r,t,e)=>{let n=at(r,t,e);console.log("createDirectory: ".concat(n))},removeDirectory:(r,t,e)=>{let n=at(r,t,e);console.log("removeDirectory: ".concat(n))},listDirectoryEntries:(r,t,e)=>{let n=at(r,t,e);return console.log("listDirectoryEntries: ".concat(n)),!1},moveFile:(r,t,e,n,i)=>{var d,h;let s=at(r,t,e),a=at(r,n,i),c=(d=rt._files)==null?void 0:d.get(s);c!==void 0&&(rt._files.delete(c),rt._files.set(a,c));for(let[u,I]of((h=rt._fileInfoCache)==null?void 0:h.entries())||[])if(I.dataUrl==s){rt._fileInfoCache.delete(u);break}return!0},removeFile:(r,t,e)=>{},callScalarUDF:(r,t,e,n,i,s,a)=>{kf(rt,r,t,e,n,i,s,a)}};var zc=class extends ua{postMessage(t,e){globalThis.postMessage(t,e)}async instantiate(t,e,n){return await new fa(this,rt,t,e).instantiate(n)}};function Qf(){let r=new zc;globalThis.onmessage=async t=>{await r.onMessage(t.data)}}Qf();return xm(sb);})();
|
|
1
|
+
"use strict";var duckdb=(()=>{var wm=Object.create;var vi=Object.defineProperty;var vm=Object.getOwnPropertyDescriptor;var Sm=Object.getOwnPropertyNames;var Im=Object.getPrototypeOf,Fm=Object.prototype.hasOwnProperty;var Va=(r,t)=>(t=Symbol[r])?t:Symbol.for("Symbol."+r);var Bm=(r,t,e)=>t in r?vi(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var Wa=(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 Kr=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),qr=(r,t)=>{for(var e in t)vi(r,e,{get:t[e],enumerable:!0})},tu=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Sm(t))!Fm.call(r,i)&&i!==e&&vi(r,i,{get:()=>t[i],enumerable:!(n=vm(t,i))||n.enumerable});return r};var eu=(r,t,e)=>(e=r!=null?wm(Im(r)):{},tu(t||!r||!r.__esModule?vi(e,"default",{value:r,enumerable:!0}):e,r)),Dm=r=>tu(vi({},"__esModule",{value:!0}),r);var Es=(r,t,e)=>(Bm(r,typeof t!="symbol"?t+"":t,e),e);var Am=function(r,t){this[0]=r,this[1]=t};var mn=r=>{var t=r[Va("asyncIterator")],e=!1,n,i={};return t==null?(t=r[Va("iterator")](),n=s=>i[s]=a=>t[s](a)):(t=t.call(r),n=s=>i[s]=a=>{if(e){if(e=!1,s==="throw")throw a;return a}return e=!0,{done:!1,value:new Am(new Promise(l=>{var u=t[s](a);if(!(u instanceof Object))throw TypeError("Object expected");l(u)}),1)}}),i[Va("iterator")]=()=>i,n("next"),"throw"in t?n("throw"):i.throw=s=>{throw s},"return"in t&&n("return"),i};var ql=Kr(()=>{});var ef=Kr(()=>{});var rf=Kr(()=>{});var nf=Kr(()=>{});var df=Kr((uf,ya)=>{"use strict";var _a=(()=>{var t;var r=typeof document<"u"?(t=document.currentScript)==null?void 0:t.src:void 0;return typeof __filename<"u"&&(r=r||__filename),async function(e={}){var Zc;var n,i=e,s,a,l=new Promise((o,c)=>{s=o,a=c}),u=typeof window=="object",f=typeof WorkerGlobalScope<"u",h=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer",w=f&&((Zc=self.name)==null?void 0:Zc.startsWith("em-pthread"));if(h){var A=ql();global.Worker=A.Worker,f=!A.isMainThread,w=f&&A.workerData=="em-pthread"}var E=Object.assign({},i),at=[],wt="./this.program",Vt=(o,c)=>{throw c},mt="";function Ot(o){return i.locateFile?i.locateFile(o,mt):mt+o}var yt,Gt;if(h){var Ct=ef(),S=rf();mt=__dirname+"/",Gt=o=>{o=Jl(o)?new URL(o):o;var c=Ct.readFileSync(o);return c},yt=async(o,c=!0)=>{o=Jl(o)?new URL(o):o;var d=Ct.readFileSync(o,c?void 0:"utf8");return d},!i.thisProgram&&process.argv.length>1&&(wt=process.argv[1].replace(/\\/g,"/")),at=process.argv.slice(2),Vt=(o,c)=>{throw process.exitCode=o,c}}else(u||f)&&(f?mt=self.location.href:typeof document<"u"&&document.currentScript&&(mt=document.currentScript.src),r&&(mt=r),mt.startsWith("blob:")?mt="":mt=mt.slice(0,mt.replace(/[?#].*/,"").lastIndexOf("/")+1),h||(f&&(Gt=o=>{var c=new XMLHttpRequest;return c.open("GET",o,!1),c.responseType="arraybuffer",c.send(null),new Uint8Array(c.response)}),yt=async o=>{var c=await fetch(o,{credentials:"same-origin"});if(c.ok)return c.arrayBuffer();throw new Error(c.status+" : "+c.url)}));var U=console.log.bind(console),V=console.error.bind(console);h&&(U=(...o)=>Ct.writeSync(1,o.join(" ")+"\n"),V=(...o)=>Ct.writeSync(2,o.join(" ")+"\n"));var I=i.print||U,O=i.printErr||V;Object.assign(i,E),E=null,i.arguments&&(at=i.arguments),i.thisProgram&&(wt=i.thisProgram);var B=i.wasmBinary,N,F,H=!1,W;function At(o,c){o||zr(c)}var Ut,Ae,_t,Xe,Te,Wr,hi,Nn,fn=!1,Jl=o=>o.startsWith("file://");function va(){return N.buffer!=Ut.buffer&&xe(),Ut}function Ze(){return N.buffer!=Ut.buffer&&xe(),Ae}function Sa(){return N.buffer!=Ut.buffer&&xe(),_t}function x(){return N.buffer!=Ut.buffer&&xe(),Te}function ge(){return N.buffer!=Ut.buffer&&xe(),Wr}function Ia(){return N.buffer!=Ut.buffer&&xe(),Nn}if(w){let o=function(...m){var _=m.join(" ");if(h){Ct.writeSync(2,_+"\n");return}console.error(_)},c=function(...m){var _=m.join(" ");postMessage({cmd:"alert",text:_,threadId:xs()})},d=function(m){try{var _=m.data,y=_.cmd;if(y==="load"){let b=[];self.onmessage=g=>b.push(g),self.startWorker=g=>{postMessage({cmd:"loaded"});for(let T of b)d(T);self.onmessage=d};for(let g of _.handlers)(!i[g]||i[g].proxy)&&(i[g]=(...T)=>{postMessage({cmd:"callHandler",handler:g,args:T})},g=="print"&&(I=i[g]),g=="printErr"&&(O=i[g]));N=_.wasmMemory,xe(),Xl(_.wasmModule)}else if(y==="run"){Of(_.pthread_ptr),Ca(_.pthread_ptr,0,0,1,0,0),ft.receiveObjectTransfer(_),ft.threadInitTLS(),Ea(_.pthread_ptr),Fa||(Fa=!0);try{Uf(_.start_routine,_.arg)}catch(b){if(b!="unwind")throw b}}else _.target==="setimmediate"||(y==="checkMailbox"?Fa&&Fs():y&&(O("worker: received unknown command ".concat(y)),O(_)))}catch(b){throw Hc(),b}};var sb=o,ob=c,ab=d,Xl;if(h){var Zl=A.parentPort;Zl.on("message",m=>onmessage({data:m})),Object.assign(globalThis,{self:global,postMessage:m=>Zl.postMessage(m)})}var Fa=!1;i.printErr||(O=o),self.alert=c,self.onunhandledrejection=m=>{throw m.reason||m},self.onmessage=d}function xe(){var o=N.buffer;i.HEAP8=Ut=new Int8Array(o),i.HEAP16=_t=new Int16Array(o),i.HEAPU8=Ae=new Uint8Array(o),i.HEAPU16=Xe=new Uint16Array(o),i.HEAP32=Te=new Int32Array(o),i.HEAPU32=Wr=new Uint32Array(o),i.HEAPF32=hi=new Float32Array(o),i.HEAPF64=Nn=new Float64Array(o)}if(w)i.wasmMemory&&(N=i.wasmMemory,xe());else{if(i.wasmMemory)N=i.wasmMemory;else{var vf=i.INITIAL_MEMORY||16777216;N=new WebAssembly.Memory({initial:vf/65536,maximum:65536,shared:!0})}xe()}function Sf(){if(i.preRun)for(typeof i.preRun=="function"&&(i.preRun=[i.preRun]);i.preRun.length;)cc(i.preRun.shift());ac(lc)}function Ql(){if(fn=!0,w)return startWorker(i);M.Ha()}function ib(){}function If(){if(!w){if(i.postRun)for(typeof i.postRun=="function"&&(i.postRun=[i.postRun]);i.postRun.length;)Ef(i.postRun.shift());ac(hc)}}var hn=0,pi=null;function tc(o){var c;hn++,(c=i.monitorRunDependencies)==null||c.call(i,hn)}function ec(o){var d;if(hn--,(d=i.monitorRunDependencies)==null||d.call(i,hn),hn==0&&pi){var c=pi;pi=null,c()}}function zr(o){var d;(d=i.onAbort)==null||d.call(i,o),o="Aborted("+o+")",O(o),H=!0,o+=". Build with -sASSERTIONS for more info.",fn&&___trap();var c=new WebAssembly.RuntimeError(o);throw a(c),c}var mi;function Ff(){return Ot("./duckdb-coi.wasm")}function Bf(o){if(o==mi&&B)return new Uint8Array(B);if(Gt)return Gt(o);throw"both async and sync fetching of the wasm failed"}async function Df(o){if(!B)try{var c=await yt(o);return new Uint8Array(c)}catch(d){}return Bf(o)}async function Af(o,c){try{var d=await Df(o),m=await WebAssembly.instantiate(d,c);return m}catch(_){O("failed to asynchronously prepare wasm: ".concat(_)),zr(_)}}async function Tf(o,c,d){if(!o&&typeof WebAssembly.instantiateStreaming=="function"&&!h)try{var m=fetch(c,{credentials:"same-origin"}),_=await WebAssembly.instantiateStreaming(m,d);return _}catch(y){O("wasm streaming compile failed: ".concat(y)),O("falling back to ArrayBuffer instantiation")}return Af(c,d)}function rc(){return Bp(),{a:Cc}}async function xf(){function o(y,b){return M=y.exports,M=bm(M),Mf(M.zb),pc=M.Ja,F=b,ec("wasm-instantiate"),M}tc("wasm-instantiate");function c(y){return o(y.instance,y.module)}var d=rc();if(i.instantiateWasm)return new Promise((y,b)=>{i.instantiateWasm(d,(g,T)=>{o(g,T),y(g.exports)})});if(w)return new Promise(y=>{Xl=b=>{var g=new WebAssembly.Instance(b,rc());y(o(g,b))}});mi!=null||(mi=Ff());try{var m=await Tf(B,mi,d),_=c(m);return _}catch(y){return a(y),Promise.reject(y)}}var Bt,fr,nc={10184256:(o,c,d,m)=>{var _=ut(o);if(typeof XMLHttpRequest>"u")return 0;let y=new XMLHttpRequest;y.open(ut(m),_,!1),y.responseType="arraybuffer";for(var b=0,v=c;b<v*2;){var g=x()[d/4+b>>>0],T=x()[d/4+b+1>>>0];try{var k=encodeURI(ut(g));k==="Host"&&(k="X-Host-Override"),k==="User-Agent"&&(k="X-user-agent"),k==="Authorization"?y.setRequestHeader(k,ut(T)):y.setRequestHeader(k,encodeURI(ut(T)))}catch(Pt){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Pt)}b+=2}try{y.send(null)}catch(Pt){return 0}if(y.status>=400)return 0;for(var Y=y.response,v=Y.byteLength,ht=mr(v+4),bt=new Uint8Array(Y),st=0;st<v;st++)i.HEAPU8[st+ht+4]=bt[st];var D=new Uint8Array(4);return D[0]=v%256,v-=D[0],v/=256,D[1]=v%256,v-=D[1],v/=256,D[2]=v%256,v-=D[2],v/=256,D[3]=v%256,v-=D[3],v/=256,i.HEAPU8.set(D,ht),ht},10185663:(o,c,d,m,_,y)=>{var b=ut(o);if(typeof XMLHttpRequest>"u")return 0;let g=new XMLHttpRequest;g.open(ut(m),b,!1),g.responseType="arraybuffer";for(var T=0,D=c;T<D*2;){var k=x()[d/4+T>>>0],Y=x()[d/4+T+1>>>0];try{var v=encodeURI(ut(k));v==="Host"&&(v="X-Host-Override"),v==="User-Agent"&&(v="X-user-agent"),v==="Authorization"?g.setRequestHeader(v,ut(Y)):g.setRequestHeader(v,encodeURI(ut(Y)))}catch(Qe){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Qe)}T+=2}try{for(var ht=new Uint8Array(y),bt=0;bt<y;bt++)ht[bt]=i.HEAPU8[bt+_];g.send(ht)}catch(Qe){return 0}if(g.status>=400)return 0;for(var st=Uint8Array.from(Array.from(g.getResponseHeader("Etag")).map(Qe=>Qe.charCodeAt(0))),D=st.byteLength,Pt=mr(D+4),Ee=new Uint8Array(st),bt=0;bt<D;bt++)i.HEAPU8[bt+Pt+4]=Ee[bt];var Tt=new Uint8Array(4);return Tt[0]=D%256,D-=Tt[0],D/=256,Tt[1]=D%256,D-=Tt[1],D/=256,Tt[2]=D%256,D-=Tt[2],D/=256,Tt[3]=D%256,D-=Tt[3],D/=256,i.HEAPU8.set(Tt,Pt),Pt},10187283:(o,c,d,m)=>{var _=ut(o);if(typeof XMLHttpRequest>"u")return 0;let y=new XMLHttpRequest;y.open(ut(m),_,!1),y.responseType="arraybuffer";for(var b=0,v=c;b<v*2;){var g=x()[d/4+b>>>0],T=x()[d/4+b+1>>>0];console.log("HEAD",ut(g),ut(T));try{var k=encodeURI(ut(g));k==="Host"&&(k="X-Host-Override"),k==="User-Agent"&&(k="X-user-agent"),k==="Authorization"?y.setRequestHeader(k,ut(T)):y.setRequestHeader(k,encodeURI(ut(T)))}catch(Tt){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Tt)}b+=2}try{y.send(null)}catch(Tt){return 0}if(y.status>=400)return 0;for(var Y=y.response,v=Y.byteLength,ht=mr(v+8),bt=new Uint8Array(Y),st=0;st<v;st++)i.HEAPU8[st+ht+8]=bt[st];var D=new Uint8Array(4);D[0]=v%256,v-=D[0],v/=256,D[1]=v%256,v-=D[1],v/=256,D[2]=v%256,v-=D[2],v/=256,D[3]=v%256,v-=D[3],v/=256,i.HEAPU8.set(D,ht+4);var Pt=Uint8Array.from(Array.from(y.getAllResponseHeaders()).map(Tt=>Tt.charCodeAt(0)));v=Pt.byteLength;for(var Ee=mr(v+8),st=0;st<v;st++)i.HEAPU8[st+Ee+8]=Pt[st];return D=new Uint8Array(4),D[0]=v%256,v-=D[0],v/=256,D[1]=v%256,v-=D[1],v/=256,D[2]=v%256,v-=D[2],v/=256,D[3]=v%256,v-=D[3],v/=256,i.HEAPU8.set(D,Ee+4),v=Ee,D=new Uint8Array(4),D[0]=v%256,v-=D[0],v/=256,D[1]=v%256,v-=D[1],v/=256,D[2]=v%256,v-=D[2],v/=256,D[3]=v%256,v-=D[3],v/=256,i.HEAPU8.set(D,ht),ht},10189628:(o,c,d,m)=>{var _=ut(o);if(typeof XMLHttpRequest>"u")return 0;let y=new XMLHttpRequest;y.open(ut(m),_,!1),y.responseType="arraybuffer";for(var b=0,v=c;b<v*2;){var g=x()[d/4+b>>>0],T=x()[d/4+b+1>>>0];try{var k=encodeURI(ut(g));k==="Host"&&(k="X-Host-Override"),k==="User-Agent"&&(k="X-user-agent"),k==="Authorization"?y.setRequestHeader(k,ut(T)):y.setRequestHeader(k,encodeURI(ut(T)))}catch(Pt){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Pt)}b+=2}try{y.send(null)}catch(Pt){return 0}if(y.status>=400)return 0;for(var Y=y.response,v=Y.byteLength,ht=mr(v+4),bt=new Uint8Array(Y),st=0;st<v;st++)i.HEAPU8[st+ht+4]=bt[st];var D=new Uint8Array(4);return D[0]=v%256,v-=D[0],v/=256,D[1]=v%256,v-=D[1],v/=256,D[2]=v%256,v-=D[2],v/=256,D[3]=v%256,v-=D[3],v/=256,i.HEAPU8.set(D,ht),ht},10191035:(o,c,d,m,_,y)=>{var b=ut(o);if(typeof XMLHttpRequest>"u")return 0;let g=new XMLHttpRequest;g.open(ut(m),b,!1),g.responseType="arraybuffer";for(var T=0,D=c;T<D*2;){var k=x()[d/4+T>>>0],Y=x()[d/4+T+1>>>0];try{var v=encodeURI(ut(k));v==="Host"&&(v="X-Host-Override"),v==="User-Agent"&&(v="X-user-agent"),v==="Authorization"?g.setRequestHeader(v,ut(Y)):g.setRequestHeader(v,encodeURI(ut(Y)))}catch(Qe){console.warn("Error while performing XMLHttpRequest.setRequestHeader()",Qe)}T+=2}try{for(var ht=new Uint8Array(y),bt=0;bt<y;bt++)ht[bt]=i.HEAPU8[bt+_];g.send(ht)}catch(Qe){return 0}if(g.status>=400)return 0;for(var st=g.response,D=st.byteLength,Pt=mr(D+4),Ee=new Uint8Array(st),bt=0;bt<D;bt++)i.HEAPU8[bt+Pt+4]=Ee[bt];var Tt=new Uint8Array(4);return Tt[0]=D%256,D-=Tt[0],D/=256,Tt[1]=D%256,D-=Tt[1],D/=256,Tt[2]=D%256,D-=Tt[2],D/=256,Tt[3]=D%256,D-=Tt[3],D/=256,i.HEAPU8.set(Tt,Pt),Pt}};class ic{constructor(c){Es(this,"name","ExitStatus");this.message="Program terminated with exit(".concat(c,")"),this.status=c}}var sc=o=>{o.terminate(),o.onmessage=c=>{}},oc=o=>{var c=ft.pthreads[o];ft.returnWorkerToPool(c)},ac=o=>{for(;o.length>0;)o.shift()(i)},lc=[],cc=o=>lc.unshift(o),uc=o=>{var c=ft.getNewWorker();if(!c)return 6;ft.runningWorkers.push(c),ft.pthreads[o.pthread_ptr]=c,c.pthread_ptr=o.pthread_ptr;var d={cmd:"run",start_routine:o.startRoutine,arg:o.arg,pthread_ptr:o.pthread_ptr};return h&&c.unref(),c.postMessage(d,o.transferList),0},vs=0,Ba=()=>xa||vs>0,Ss=()=>Xc(),_i=o=>Yc(o),yi=o=>Jc(o);i.stackAlloc=yi;var jr=(o,c)=>c+2097152>>>0<4194305-!!o?(o>>>0)+c*4294967296:NaN,kn=(o,c,d,...m)=>{for(var _=m.length,y=Ss(),b=yi(_*8),g=b>>>3,T=0;T<m.length;T++){var k=m[T];Ia()[g+T>>>0]=k}var Y=zc(o,c,_,b,d);return _i(y),Y};function Da(o){var c;if(w)return kn(0,0,1,o);W=o,Ba()||(ft.terminateAllThreads(),(c=i.onExit)==null||c.call(i,o),H=!0),Vt(o,new ic(o))}var Aa=o=>{if(o instanceof ic||o=="unwind")return W;Vt(1,o)};function dc(o){if(w)return kn(1,0,0,o);Ta(o)}var fc=(o,c)=>{if(W=o,w)throw dc(o),"unwind";Da(o)},Ta=fc,ft={unusedWorkers:[],runningWorkers:[],tlsInitFunctions:[],pthreads:{},init(){w||ft.initMainThread()},initMainThread(){for(var o=4;o--;)ft.allocateUnusedWorker();cc(()=>{tc("loading-workers"),ft.loadWasmModuleToAllWorkers(()=>ec("loading-workers"))})},terminateAllThreads:()=>{for(var o of ft.runningWorkers)sc(o);for(var o of ft.unusedWorkers)sc(o);ft.unusedWorkers=[],ft.runningWorkers=[],ft.pthreads={}},returnWorkerToPool:o=>{var c=o.pthread_ptr;delete ft.pthreads[c],ft.unusedWorkers.push(o),ft.runningWorkers.splice(ft.runningWorkers.indexOf(o),1),o.pthread_ptr=0,jc(c)},receiveObjectTransfer(o){},threadInitTLS(){ft.tlsInitFunctions.forEach(o=>o())},loadWasmModuleToWorker:o=>new Promise(c=>{o.onmessage=y=>{var b=y.data,g=b.cmd;if(b.targetThread&&b.targetThread!=xs()){var T=ft.pthreads[b.targetThread];T?T.postMessage(b,b.transferList):O('Internal error! Worker sent a message "'.concat(g,'" to target pthread ').concat(b.targetThread,", but that thread no longer exists!"));return}g==="checkMailbox"?Fs():g==="spawnThread"?uc(b):g==="cleanupThread"?oc(b.thread):g==="loaded"?(o.loaded=!0,h&&!o.pthread_ptr&&o.unref(),c(o)):g==="alert"?alert("Thread ".concat(b.threadId,": ").concat(b.text)):b.target==="setimmediate"?o.postMessage(b):g==="callHandler"?i[b.handler](...b.args):g&&O("worker sent an unknown command ".concat(g))},o.onerror=y=>{var b="worker sent an error!";throw O("".concat(b," ").concat(y.filename,":").concat(y.lineno,": ").concat(y.message)),y},h&&(o.on("message",y=>o.onmessage({data:y})),o.on("error",y=>o.onerror(y)));var d=[],m=["onExit","onAbort","print","printErr"];for(var _ of m)i.propertyIsEnumerable(_)&&d.push(_);o.postMessage({cmd:"load",handlers:d,wasmMemory:N,wasmModule:F})}),loadWasmModuleToAllWorkers(o){if(w)return o();Promise.all(ft.unusedWorkers.map(ft.loadWasmModuleToWorker)).then(o)},allocateUnusedWorker(){var o,c={workerData:"em-pthread",name:"em-pthread"},d=r;i.mainScriptUrlOrBlob&&(d=i.mainScriptUrlOrBlob,typeof d!="string"&&(d=URL.createObjectURL(d))),o=new Worker(d,c),ft.unusedWorkers.push(o)},getNewWorker(){return ft.unusedWorkers.length==0&&(ft.allocateUnusedWorker(),ft.loadWasmModuleToWorker(ft.unusedWorkers[0])),ft.unusedWorkers.pop()}},hc=[],Ef=o=>hc.unshift(o),Of=o=>{xe();var c=ge()[o+52>>>2>>>0],d=ge()[o+56>>>2>>>0],m=c-d;qc(c,m),_i(c)},Is=[],pc,mc=o=>{var c=Is[o];return c||(o>=Is.length&&(Is.length=o+1),Is[o]=c=pc.get(o)),c},Uf=(o,c)=>{vs=0,xa=0;var d=mc(o)(c);function m(_){Ba()?W=_:Pa(_)}m(d)},xa=i.noExitRuntime||!0,Mf=o=>ft.tlsInitFunctions.push(o);function Rf(o,c){return o>>>=0,mc(o)(c)}function _c(o,c,d,m){return w?kn(2,0,1,o,c,d,m):yc(o,c,d,m)}var Lf=()=>typeof SharedArrayBuffer<"u";function yc(o,c,d,m){if(o>>>=0,c>>>=0,d>>>=0,m>>>=0,!Lf())return 6;var _=[],y=0;if(w&&(_.length===0||y))return _c(o,c,d,m);if(y)return y;var b={startRoutine:d,pthread_ptr:o,arg:m,transferList:_};return w?(b.cmd="spawnThread",postMessage(b,_),0):uc(b)}var Nf=()=>zr("");function kf(o){o>>>=0,Ca(o,!f,1,!u,1048576,!1),ft.threadInitTLS()}var Cf=()=>{if(!Ba())try{w?Pa(W):Ta(W)}catch(o){Aa(o)}},Pf=o=>{if(!H)try{o(),Cf()}catch(c){Aa(c)}};function Ea(o){if(o>>>=0,typeof Atomics.waitAsync=="function"){var c=Atomics.waitAsync(x(),o>>>2,o);c.value.then(Fs);var d=o+128;Atomics.store(x(),d>>>2,1)}}var Fs=()=>{var o=xs();o&&(Ea(o),Pf($c))};function Hf(o,c){if(o>>>=0,c>>>=0,o==c)setTimeout(Fs);else if(w)postMessage({targetThread:o,cmd:"checkMailbox"});else{var d=ft.pthreads[o];if(!d)return;d.postMessage({cmd:"checkMailbox"})}}var Oa=[];function Vf(o,c,d,m,_){c>>>=0,d>>>=0,_>>>=0,Oa.length=m;for(var y=_>>>3,b=0;b<m;b++)Oa[b]=Ia()[y+b>>>0];var g=c?nc[c]:Fp[o];ft.currentProxiedOperationCallerThread=d;var T=g(...Oa);return ft.currentProxiedOperationCallerThread=0,T}var Wf=()=>{xa=!1,vs=0},bc=typeof TextDecoder<"u"?new TextDecoder:void 0,zf=(o,c=0,d=NaN)=>{c>>>=0;for(var m=c+d,_=c;o[_]&&!(_>=m);)++_;if(_-c>16&&o.buffer&&bc)return bc.decode(o.buffer instanceof ArrayBuffer?o.subarray(c,_):o.slice(c,_));for(var y="";c<_;){var b=o[c++];if(!(b&128)){y+=String.fromCharCode(b);continue}var g=o[c++]&63;if((b&224)==192){y+=String.fromCharCode((b&31)<<6|g);continue}var T=o[c++]&63;if((b&240)==224?b=(b&15)<<12|g<<6|T:b=(b&7)<<18|g<<12|T<<6|o[c++]&63,b<65536)y+=String.fromCharCode(b);else{var k=b-65536;y+=String.fromCharCode(55296|k>>10,56320|k&1023)}}return y},ut=(o,c)=>(o>>>=0,o?zf(Ze(),o,c):"");function jf(o){if(o>>>=0,h){if(!o)return 1;var c=ut(o);if(!c.length)return 0;var d=["child_process"].map(Wa),m=d.spawnSync(c,[],{shell:!0,stdio:"inherit"}),_=(b,g)=>b<<8|g;if(m.status===null){var y=b=>{switch(b){case"SIGHUP":return 1;case"SIGQUIT":return 3;case"SIGFPE":return 8;case"SIGKILL":return 9;case"SIGALRM":return 14;case"SIGTERM":return 15;default:return 2}};return _(0,y(m.signal))}return _(m.status,0)}return o?-52:0}function $f(o){o>>>=0,w?postMessage({cmd:"cleanupThread",thread:o}):oc(o)}function Gf(o){o>>>=0,h&&ft.pthreads[o].ref()}function gc(){zr("missing function: _emval_call_method")}gc.stub=!0;function wc(){zr("missing function: _emval_decref")}wc.stub=!0;function vc(){zr("missing function: _emval_get_global")}vc.stub=!0;function Sc(){zr("missing function: _emval_get_method_caller")}Sc.stub=!0;function Ic(){zr("missing function: _emval_run_destructors")}Ic.stub=!0;function Kf(o,c,d){var m=jr(o,c);d>>>=0;var _=new Date(m*1e3);x()[d>>>2>>>0]=_.getUTCSeconds(),x()[d+4>>>2>>>0]=_.getUTCMinutes(),x()[d+8>>>2>>>0]=_.getUTCHours(),x()[d+12>>>2>>>0]=_.getUTCDate(),x()[d+16>>>2>>>0]=_.getUTCMonth(),x()[d+20>>>2>>>0]=_.getUTCFullYear()-1900,x()[d+24>>>2>>>0]=_.getUTCDay();var y=Date.UTC(_.getUTCFullYear(),0,1,0,0,0,0),b=(_.getTime()-y)/(1e3*60*60*24)|0;x()[d+28>>>2>>>0]=b}var qf=o=>o%4===0&&(o%100!==0||o%400===0),Yf=[0,31,60,91,121,152,182,213,244,274,305,335],Jf=[0,31,59,90,120,151,181,212,243,273,304,334],Fc=o=>{var c=qf(o.getFullYear()),d=c?Yf:Jf,m=d[o.getMonth()]+o.getDate()-1;return m};function Xf(o,c,d){var m=jr(o,c);d>>>=0;var _=new Date(m*1e3);x()[d>>>2>>>0]=_.getSeconds(),x()[d+4>>>2>>>0]=_.getMinutes(),x()[d+8>>>2>>>0]=_.getHours(),x()[d+12>>>2>>>0]=_.getDate(),x()[d+16>>>2>>>0]=_.getMonth(),x()[d+20>>>2>>>0]=_.getFullYear()-1900,x()[d+24>>>2>>>0]=_.getDay();var y=Fc(_)|0;x()[d+28>>>2>>>0]=y,x()[d+36>>>2>>>0]=-(_.getTimezoneOffset()*60);var b=new Date(_.getFullYear(),0,1),g=new Date(_.getFullYear(),6,1).getTimezoneOffset(),T=b.getTimezoneOffset(),k=(g!=T&&_.getTimezoneOffset()==Math.min(T,g))|0;x()[d+32>>>2>>>0]=k}var Ua=o=>Gc(o),Zf=function(o){o>>>=0;var c=(()=>{var d=new Date(x()[o+20>>>2>>>0]+1900,x()[o+16>>>2>>>0],x()[o+12>>>2>>>0],x()[o+8>>>2>>>0],x()[o+4>>>2>>>0],x()[o>>>2>>>0],0),m=x()[o+32>>>2>>>0],_=d.getTimezoneOffset(),y=new Date(d.getFullYear(),0,1),b=new Date(d.getFullYear(),6,1).getTimezoneOffset(),g=y.getTimezoneOffset(),T=Math.min(g,b);if(m<0)x()[o+32>>>2>>>0]=+(b!=g&&T==_);else if(m>0!=(T==_)){var k=Math.max(g,b),Y=m>0?T:k;d.setTime(d.getTime()+(Y-_)*6e4)}x()[o+24>>>2>>>0]=d.getDay();var v=Fc(d)|0;x()[o+28>>>2>>>0]=v,x()[o>>>2>>>0]=d.getSeconds(),x()[o+4>>>2>>>0]=d.getMinutes(),x()[o+8>>>2>>>0]=d.getHours(),x()[o+12>>>2>>>0]=d.getDate(),x()[o+16>>>2>>>0]=d.getMonth(),x()[o+20>>>2>>>0]=d.getYear();var ht=d.getTime();return isNaN(ht)?-1:ht/1e3})();return Ua((Bt=c,+Math.abs(Bt)>=1?Bt>0?+Math.floor(Bt/4294967296)>>>0:~~+Math.ceil((Bt-+(~~Bt>>>0))/4294967296)>>>0:0)),c>>>0},Bc=(o,c,d,m)=>{if(d>>>=0,!(m>0))return 0;for(var _=d,y=d+m-1,b=0;b<o.length;++b){var g=o.charCodeAt(b);if(g>=55296&&g<=57343){var T=o.charCodeAt(++b);g=65536+((g&1023)<<10)|T&1023}if(g<=127){if(d>=y)break;c[d++>>>0]=g}else if(g<=2047){if(d+1>=y)break;c[d++>>>0]=192|g>>6,c[d++>>>0]=128|g&63}else if(g<=65535){if(d+2>=y)break;c[d++>>>0]=224|g>>12,c[d++>>>0]=128|g>>6&63,c[d++>>>0]=128|g&63}else{if(d+3>=y)break;c[d++>>>0]=240|g>>18,c[d++>>>0]=128|g>>12&63,c[d++>>>0]=128|g>>6&63,c[d++>>>0]=128|g&63}}return c[d>>>0]=0,d-_},hr=(o,c,d)=>Bc(o,Ze(),c,d);i.stringToUTF8=hr;var Qf=function(o,c,d,m){o>>>=0,c>>>=0,d>>>=0,m>>>=0;var _=new Date().getFullYear(),y=new Date(_,0,1),b=new Date(_,6,1),g=y.getTimezoneOffset(),T=b.getTimezoneOffset(),k=Math.max(g,T);ge()[o>>>2>>>0]=k*60,x()[c>>>2>>>0]=+(g!=T);var Y=bt=>{var st=bt>=0?"-":"+",D=Math.abs(bt),Pt=String(Math.floor(D/60)).padStart(2,"0"),Ee=String(D%60).padStart(2,"0");return"UTC".concat(st).concat(Pt).concat(Ee)},v=Y(g),ht=Y(T);T<g?(hr(v,d,17),hr(ht,m,17)):(hr(v,m,17),hr(ht,d,17))};function th(o,c){return c>>>=0,Ze().set(bi[o].fileData,c>>>0)}var Ma=[],eh=()=>Ma.length,bi=[],rh=!1,nh=()=>(rh=!0,bi.length);function ih(o,c){c>>>=0;var d=Ma[o].childName,m=Cn(d)+1;hr(d,c,m)}var sh=o=>bi[o].mode;function oh(o){return bi[o].fileData.length}function ah(o,c){c>>>=0;var d=Ma[o].parentPath,m=Cn(d)+1;hr(d,c,m)}var Cn=o=>{for(var c=0,d=0;d<o.length;++d){var m=o.charCodeAt(d);m<=127?c++:m<=2047?c+=2:m>=55296&&m<=57343?(c+=4,++d):c+=3}return c};i.lengthBytesUTF8=Cn;function lh(o,c){c>>>=0;var d=bi[o].pathName,m=Cn(d)+1;hr(d,c,m)}class Bs{constructor(){Es(this,"allocated",[void 0]);Es(this,"freelist",[])}get(c){return this.allocated[c]}has(c){return this.allocated[c]!==void 0}allocate(c){var d=this.freelist.pop()||this.allocated.length;return this.allocated[d]=c,d}free(c){this.allocated[c]=void 0,this.freelist.push(c)}}var $r=new Bs,ee=o=>{Wc(o)};async function ch(o,c,d){o>>>=0,d>>>=0;let m=$r.get(c);try{await m.close()}catch(_){let y=-29;x()[d>>>2>>>0]=y}$r.free(c),ee(o)}var Ds=new Bs,uh=o=>{Ds.free(o)};async function dh(o,c,d){o>>>=0,d>>>=0;let m=$r.get(c);try{await m.flush()}catch(_){let y=-29;x()[d>>>2>>>0]=y}ee(o)}var pr=new Bs,fh=o=>{pr.free(o)},pn=new Bs,hh=o=>{pn.free(o)};async function Dc(o,c,d){let m=pr.get(o),_;try{_=await m.getFileHandle(c,{create:d})}catch(y){return y.name==="NotFoundError"?-20:y.name==="TypeMismatchError"?-31:-29}return pn.allocate(_)}async function Ac(o,c,d){let m=pr.get(o),_;try{_=await m.getDirectoryHandle(c,{create:d})}catch(y){return y.name==="NotFoundError"?-20:y.name==="TypeMismatchError"?-54:-29}return pr.allocate(_)}async function ph(o,c,d,m,_){o>>>=0,d>>>=0,m>>>=0,_>>>=0;let y=ut(d),b=1,g=await Dc(c,y,!1);g==-31&&(b=2,g=await Ac(c,y,!1)),x()[m>>>2>>>0]=b,x()[_>>>2>>>0]=g,ee(o)}async function mh(o,c,d,m){o>>>=0,d>>>=0,m>>>=0;let _=pr.get(c);try{let y=_.entries();for(let b;b=await y.next(),!b.done;){let[g,T]=b.value,k=Ss(),Y=kc(g),v=T.kind=="file"?1:2;__wasmfs_opfs_record_entry(d,Y,v),_i(k)}}catch(y){let b=-29;x()[m>>>2>>>0]=b}ee(o)}async function _h(o,c,d){o>>>=0,d>>>=0;let m=$r.get(c),_;try{_=await m.getSize()}catch(y){_=-29}fr=[_>>>0,(Bt=_,+Math.abs(Bt)>=1?Bt>0?+Math.floor(Bt/4294967296)>>>0:~~+Math.ceil((Bt-+(~~Bt>>>0))/4294967296)>>>0:0)],x()[d>>>2>>>0]=fr[0],x()[d+4>>>2>>>0]=fr[1],ee(o)}var yh=function(o){var c=Ds.get(o).size;return Ua((Bt=c,+Math.abs(Bt)>=1?Bt>0?+Math.floor(Bt/4294967296)>>>0:~~+Math.ceil((Bt-+(~~Bt>>>0))/4294967296)>>>0:0)),c>>>0};async function bh(o,c,d){o>>>=0,d>>>=0;let m=pn.get(c),_;try{_=(await m.getFile()).size}catch(y){_=-29}fr=[_>>>0,(Bt=_,+Math.abs(Bt)>=1?Bt>0?+Math.floor(Bt/4294967296)>>>0:~~+Math.ceil((Bt-+(~~Bt>>>0))/4294967296)>>>0:0)],x()[d>>>2>>>0]=fr[0],x()[d+4>>>2>>>0]=fr[1],ee(o)}async function gh(o){if(o>>>=0,pr.allocated.length==1){let c=await navigator.storage.getDirectory();pr.allocated.push(c)}ee(o)}async function wh(o,c,d,m){o>>>=0,d>>>=0,m>>>=0;let _=ut(d),y=await Ac(c,_,!0);x()[m>>>2>>>0]=y,ee(o)}async function vh(o,c,d,m){o>>>=0,d>>>=0,m>>>=0;let _=ut(d),y=await Dc(c,_,!0);x()[m>>>2>>>0]=y,ee(o)}async function Sh(o,c,d,m,_){o>>>=0,m>>>=0,_>>>=0;let y=ut(m),b=pn.get(c),g=pr.get(d);try{await b.move(g,y)}catch(T){let k=-29;x()[_>>>2>>>0]=k}ee(o)}async function Ih(o,c,d){o>>>=0,d>>>=0;let m=pn.get(c),_;try{let b;var y=FileSystemFileHandle.prototype.createSyncAccessHandle.length;y==0?b=await m.createSyncAccessHandle():b=await m.createSyncAccessHandle({mode:"in-place"}),_=$r.allocate(b)}catch(b){b.name==="InvalidStateError"||b.name==="NoModificationAllowedError"?_=-2:_=-29}x()[d>>>2>>>0]=_,ee(o)}async function Fh(o,c,d){o>>>=0,d>>>=0;let m=pn.get(c),_;try{let y=await m.getFile();_=Ds.allocate(y)}catch(y){y.name==="NotAllowedError"?_=-2:_=-29}x()[d>>>2>>>0]=_,ee(o)}function Bh(o,c,d,m,_){c>>>=0;var y=jr(m,_);let b=$r.get(o),g=Ze().subarray(c>>>0,c+d>>>0);try{return b.read(g,{at:y})}catch(T){return T.name=="TypeError"?-28:-29}}async function Dh(o,c,d,m,_,y,b){o>>>=0,d>>>=0;var g=jr(_,y);b>>>=0;let k=Ds.get(c).slice(g,g+m),Y=0;try{let v=await k.arrayBuffer(),ht=new Uint8Array(v);Ze().set(ht,d>>>0),Y+=ht.length}catch(v){v instanceof RangeError?Y=-21:Y=-29}x()[b>>>2>>>0]=Y,ee(o)}async function Ah(o,c,d,m){o>>>=0,d>>>=0,m>>>=0;let _=ut(d),y=pr.get(c);try{await y.removeEntry(_)}catch(b){let g=-29;x()[m>>>2>>>0]=g}ee(o)}async function Th(o,c,d,m,_){o>>>=0;var y=jr(d,m);_>>>=0;let b=$r.get(c);try{await b.truncate(y)}catch(g){let T=-29;x()[_>>>2>>>0]=T}ee(o)}async function xh(o,c,d,m,_){o>>>=0;var y=jr(d,m);_>>>=0;let b=pn.get(c);try{let g=await b.createWritable({keepExistingData:!0});await g.truncate(y),await g.close()}catch(g){let T=-29;x()[_>>>2>>>0]=T}ee(o)}function Eh(o,c,d,m,_){c>>>=0;var y=jr(m,_);let b=$r.get(o),g=Ze().subarray(c>>>0,c+d>>>0);try{return b.write(g,{at:y})}catch(T){return T.name=="TypeError"?-28:-29}}var Ra=[],Oh=(o,c,d)=>{var m=d>0?d:Cn(o)+1,_=new Array(m),y=Bc(o,_,0,_.length);return c&&(_.length=y),_},Uh=()=>{if(!Ra.length){var o=null;if(h){var c=256,d=Buffer.alloc(c),m=0,_=process.stdin.fd;try{m=Ct.readSync(_,d,0,c)}catch(y){if(y.toString().includes("EOF"))m=0;else throw y}m>0&&(o=d.slice(0,m).toString("utf-8"))}else typeof window<"u"&&typeof window.prompt=="function"&&(o=window.prompt("Input: "),o!==null&&(o+="\n"));if(!o)return null;Ra=Oh(o,!0)}return Ra.shift()},Mh=()=>{var o=Uh();return typeof o=="number"?o:-1},Rh=function(o){o>>>=0;var c=setInterval(()=>{H?clearInterval(c):Vc(o)},50)},Tc=()=>performance.timeOrigin+performance.now(),xc=()=>Date.now(),Lh=1,Nh=o=>o>=0&&o<=3;function kh(o,c,d,m){var _=jr(c,d);if(m>>>=0,!Nh(o))return 28;var y;if(o===0)y=xc();else if(Lh)y=Tc();else return 52;var b=Math.round(y*1e3*1e3);return fr=[b>>>0,(Bt=b,+Math.abs(Bt)>=1?Bt>0?+Math.floor(Bt/4294967296)>>>0:~~+Math.ceil((Bt-+(~~Bt>>>0))/4294967296)>>>0:0)],x()[m>>>2>>>0]=fr[0],x()[m+4>>>2>>>0]=fr[1],0}function Ch(o,c){return o>>>=0,globalThis.DUCKDB_RUNTIME.createDirectory(i,o,c)}function Ph(o,c){return o>>>=0,globalThis.DUCKDB_RUNTIME.checkDirectory(i,o,c)}function Hh(o,c){return o>>>=0,globalThis.DUCKDB_RUNTIME.listDirectoryEntries(i,o,c)}function Vh(o,c){return o>>>=0,globalThis.DUCKDB_RUNTIME.removeDirectory(i,o,c)}function Wh(o){return globalThis.DUCKDB_RUNTIME.closeFile(i,o)}function zh(o,c){return o>>>=0,globalThis.DUCKDB_RUNTIME.dropFile(i,o,c)}function jh(o,c){return o>>>=0,globalThis.DUCKDB_RUNTIME.checkFile(i,o,c)}function $h(o,c,d,m){return o>>>=0,d>>>=0,globalThis.DUCKDB_RUNTIME.moveFile(i,o,c,d,m)}function Gh(o,c){return globalThis.DUCKDB_RUNTIME.openFile(i,o,c)}function Kh(o,c,d,m){return c>>>=0,globalThis.DUCKDB_RUNTIME.readFile(i,o,c,d,m)}function qh(o,c){return globalThis.DUCKDB_RUNTIME.truncateFile(i,o,c)}function Yh(o,c,d,m){return c>>>=0,globalThis.DUCKDB_RUNTIME.writeFile(i,o,c,d,m)}function Jh(o){return globalThis.DUCKDB_RUNTIME.getDefaultDataProtocol(o)}function Xh(o,c){return o>>>=0,globalThis.DUCKDB_RUNTIME.glob(i,o,c)}function Zh(o){return globalThis.DUCKDB_RUNTIME.testPlatformFeature(i,o)}function Qh(o,c,d,m,_,y){return o>>>=0,d>>>=0,_>>>=0,globalThis.DUCKDB_RUNTIME.callScalarUDF(i,o,c,d,m,_,y)}var La=[],tp=(o,c)=>{La.length=0;for(var d;d=Ze()[o++>>>0];){var m=d!=105;m&=d!=112,c+=m&&c%8?4:0,La.push(d==112?ge()[c>>>2>>>0]:d==105?x()[c>>>2>>>0]:Ia()[c>>>3>>>0]),c+=m?8:4}return La},ep=(o,c,d)=>{var m=tp(c,d);return nc[o](...m)};function rp(o,c,d){return o>>>=0,c>>>=0,d>>>=0,ep(o,c,d)}var gi=o=>{gi.shown||(gi.shown={}),gi.shown[o]||(gi.shown[o]=1,h&&(o="warning: "+o),O(o))},np=()=>{};function ip(o){return o>>>=0,O(ut(o))}var sp=()=>{vs+=1},op=()=>{throw sp(),"unwind"},Ec=()=>4294901760;function ap(){return Ec()}var lp=()=>h?nf().cpus().length:navigator.hardwareConcurrency;function cp(o){return o>>>=0,I(ut(o))}var up=(o,c)=>Math.ceil(o/c)*c,dp=o=>{var c=N.buffer,d=(o-c.byteLength+65535)/65536|0;try{return N.grow(d),xe(),1}catch(m){}};function fp(o){o>>>=0;var c=Ze().length;if(o<=c)return!1;var d=Ec();if(o>d)return!1;for(var m=1;m<=4;m*=2){var _=c*(1+.2/m);_=Math.min(_,o+100663296);var y=Math.min(d,up(Math.max(o,_),65536)),b=dp(y);if(b)return!0}return!1}var hp=()=>{throw"unwind"},Na={},pp=()=>wt||"./this.program",wi=()=>{if(!wi.strings){var o=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",c={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:o,_:pp()};for(var d in Na)Na[d]===void 0?delete c[d]:c[d]=Na[d];var m=[];for(var d in c)m.push("".concat(d,"=").concat(c[d]));wi.strings=m}return wi.strings},mp=(o,c)=>{for(var d=0;d<o.length;++d)va()[c++>>>0]=o.charCodeAt(d);va()[c>>>0]=0},Oc=function(o,c){if(w)return kn(3,0,1,o,c);o>>>=0,c>>>=0;var d=0;return wi().forEach((m,_)=>{var y=c+d;ge()[o+_*4>>>2>>>0]=y,mp(m,y),d+=m.length+1}),0},Uc=function(o,c){if(w)return kn(4,0,1,o,c);o>>>=0,c>>>=0;var d=wi();ge()[o>>>2>>>0]=d.length;var m=0;return d.forEach(_=>m+=_.length+1),ge()[c>>>2>>>0]=m,0},As=o=>{for(var c=o.split("."),d=0;d<4;d++){var m=Number(c[d]);if(isNaN(m))return null;c[d]=m}return(c[0]|c[1]<<8|c[2]<<16|c[3]<<24)>>>0},Ts=o=>parseInt(o),ka=o=>{var c,d,m,_,y=/^((?=.*::)(?!.*::.+::)(::)?([\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,b=[];if(!y.test(o))return null;if(o==="::")return[0,0,0,0,0,0,0,0];for(o.startsWith("::")?o=o.replace("::","Z:"):o=o.replace("::",":Z:"),o.indexOf(".")>0?(o=o.replace(new RegExp("[.]","g"),":"),c=o.split(":"),c[c.length-4]=Ts(c[c.length-4])+Ts(c[c.length-3])*256,c[c.length-3]=Ts(c[c.length-2])+Ts(c[c.length-1])*256,c=c.slice(0,c.length-2)):c=o.split(":"),m=0,_=0,d=0;d<c.length;d++)if(typeof c[d]=="string")if(c[d]==="Z"){for(_=0;_<8-c.length+1;_++)b[d+_]=0;m=_-1}else b[d+m]=_htons(parseInt(c[d],16));else b[d+m]=c[d];return[b[1]<<16|b[0],b[3]<<16|b[2],b[5]<<16|b[4],b[7]<<16|b[6]]},Gr={address_map:{id:1,addrs:{},names:{}},lookup_name(o){var c=As(o);if(c!==null||(c=ka(o),c!==null))return o;var d;if(Gr.address_map.addrs[o])d=Gr.address_map.addrs[o];else{var m=Gr.address_map.id++;At(m<65535,"exceeded max address mappings of 65535"),d="172.29."+(m&255)+"."+(m&65280),Gr.address_map.names[d]=o,Gr.address_map.addrs[o]=d}return d},lookup_addr(o){return Gr.address_map.names[o]?Gr.address_map.names[o]:null}},Mc=o=>(o&255)+"."+(o>>8&255)+"."+(o>>16&255)+"."+(o>>24&255),_p=o=>{var c="",d=0,m=0,_=0,y=0,b=0,g=0,T=[o[0]&65535,o[0]>>16,o[1]&65535,o[1]>>16,o[2]&65535,o[2]>>16,o[3]&65535,o[3]>>16],k=!0,Y="";for(g=0;g<5;g++)if(T[g]!==0){k=!1;break}if(k){if(Y=Mc(T[6]|T[7]<<16),T[5]===-1)return c="::ffff:",c+=Y,c;if(T[5]===0)return c="::",Y==="0.0.0.0"&&(Y=""),Y==="0.0.0.1"&&(Y="1"),c+=Y,c}for(d=0;d<8;d++)T[d]===0&&(d-_>1&&(b=0),_=d,b++),b>m&&(m=b,y=d-m+1);for(d=0;d<8;d++){if(m>1&&T[d]===0&&d>=y&&d<y+m){d===y&&(c+=":",y===0&&(c+=":"));continue}c+=Number(_ntohs(T[d]&65535)).toString(16),c+=d<7?":":""}return c},Rc=(o,c)=>{Ze().fill(0,o,o+c)},yp=(o,c,d,m,_)=>{switch(c){case 2:d=As(d),Rc(o,16),_&&(x()[_>>>2>>>0]=16),Sa()[o>>>1>>>0]=c,x()[o+4>>>2>>>0]=d,Sa()[o+2>>>1>>>0]=_htons(m);break;case 10:d=ka(d),Rc(o,28),_&&(x()[_>>>2>>>0]=28),x()[o>>>2>>>0]=c,x()[o+8>>>2>>>0]=d[0],x()[o+12>>>2>>>0]=d[1],x()[o+16>>>2>>>0]=d[2],x()[o+20>>>2>>>0]=d[3],Sa()[o+2>>>1>>>0]=_htons(m);break;default:return 5}return 0};function Lc(o,c,d,m){if(w)return kn(5,0,1,o,c,d,m);o>>>=0,c>>>=0,d>>>=0,m>>>=0;var _=0,y=0,b=0,g=0,T=0,k=0,Y;function v(ht,bt,st,D,Pt,Ee){var Tt,Qe,tr,Qc;return Qe=ht===10?28:16,Pt=ht===10?_p(Pt):Mc(Pt),Tt=mr(Qe),Qc=yp(Tt,ht,Pt,Ee),At(!Qc),tr=mr(32),x()[tr+4>>>2>>>0]=ht,x()[tr+8>>>2>>>0]=bt,x()[tr+12>>>2>>>0]=st,ge()[tr+24>>>2>>>0]=D,ge()[tr+20>>>2>>>0]=Tt,ht===10?x()[tr+16>>>2>>>0]=28:x()[tr+16>>>2>>>0]=16,x()[tr+28>>>2>>>0]=0,tr}if(d&&(b=x()[d>>>2>>>0],g=x()[d+4>>>2>>>0],T=x()[d+8>>>2>>>0],k=x()[d+12>>>2>>>0]),T&&!k&&(k=T===2?17:6),!T&&k&&(T=k===17?2:1),k===0&&(k=6),T===0&&(T=1),!o&&!c)return-2;if(b&-1088||d!==0&&x()[d>>>2>>>0]&2&&!o)return-1;if(b&32)return-2;if(T!==0&&T!==1&&T!==2)return-7;if(g!==0&&g!==2&&g!==10)return-6;if(c&&(c=ut(c),y=parseInt(c,10),isNaN(y)))return b&1024?-2:-8;if(!o)return g===0&&(g=2),b&1||(g===2?_=_htonl(2130706433):_=[0,0,0,_htonl(1)]),Y=v(g,T,k,null,_,y),ge()[m>>>2>>>0]=Y,0;if(o=ut(o),_=As(o),_!==null)if(g===0||g===2)g=2;else if(g===10&&b&8)_=[0,0,_htonl(65535),_],g=10;else return-2;else if(_=ka(o),_!==null)if(g===0||g===10)g=10;else return-2;return _!=null?(Y=v(g,T,k,o,_,y),ge()[m>>>2>>>0]=Y,0):b&4?-2:(o=Gr.lookup_name(o),_=As(o),g===0?g=2:g===10&&(_=[0,0,_htonl(65535),_]),Y=v(g,T,k,null,_,y),ge()[m>>>2>>>0]=Y,0)}var bp=()=>{if(h){var o=["crypto"].map(Wa).pop();return c=>o.randomFillSync(c)}return c=>c.set(crypto.getRandomValues(new Uint8Array(c.byteLength)))},Nc=o=>{(Nc=bp())(o)};function gp(o,c){return o>>>=0,c>>>=0,Nc(Ze().subarray(o>>>0,o+c>>>0)),0}var wp=o=>{var c=i["_"+o];return c},vp=(o,c)=>{va().set(o,c>>>0)},kc=o=>{var c=Cn(o)+1,d=yi(c);return hr(o,d,c),d},Sp=(o,c,d,m,_)=>{var y={string:st=>{var D=0;return st!=null&&st!==0&&(D=kc(st)),D},array:st=>{var D=yi(st.length);return vp(st,D),D}};function b(st){return c==="string"?ut(st):c==="boolean"?!!st:st}var g=wp(o),T=[],k=0;if(m)for(var Y=0;Y<m.length;Y++){var v=y[d[Y]];v?(k===0&&(k=Ss()),T[Y]=v(m[Y])):T[Y]=m[Y]}var ht=g(...T);function bt(st){return k!==0&&_i(k),b(st)}return ht=bt(ht),ht},Ip=o=>Kc();ft.init();var Fp=[Da,dc,_c,Oc,Uc,Lc],Cc;function Bp(){Cc={ka:Rf,pa:yc,q:Nf,ha:kf,Ga:Hf,oa:Vf,n:Wf,G:jf,p:$f,Z:Ea,Q:Gf,D:gc,i:wc,F:vc,E:Sc,C:Ic,y:Kf,z:Xf,A:Zf,qa:Qf,za:th,xa:eh,ya:nh,va:ih,ta:sh,Aa:oh,wa:ah,ua:lh,P:ch,R:uh,O:dh,H:fh,N:hh,V:ph,I:mh,T:_h,w:yh,U:bh,W:gh,L:wh,M:vh,K:Sh,k:Ih,S:Fh,v:Bh,u:Dh,J:Ah,s:Th,r:xh,t:Eh,Da:Mh,X:Rh,B:kh,ca:Ch,da:Ph,aa:Hh,ba:Vh,m:Wh,ga:zh,_:jh,$:$h,fa:Gh,f:Kh,ea:qh,g:Yh,ia:Jh,Y:Xh,l:Zh,ja:Qh,e:rp,o:np,b:xc,h:ip,j:op,Ea:ap,d:Tc,Fa:lp,Ca:cp,x:fp,na:hp,ra:Oc,sa:Uc,c:Ta,ma:Lc,a:N,la:Da,Ba:gp}}var M=await xf(),Pc=i._main=(o,c)=>(Pc=i._main=M.Ia)(o,c),Dp=i._duckdb_web_fs_glob_add_path=o=>(Dp=i._duckdb_web_fs_glob_add_path=M.Ka)(o),Ap=i._duckdb_web_clear_response=()=>(Ap=i._duckdb_web_clear_response=M.La)(),Tp=i._duckdb_web_fail_with=o=>(Tp=i._duckdb_web_fail_with=M.Ma)(o),xp=i._duckdb_web_reset=o=>(xp=i._duckdb_web_reset=M.Na)(o),Ep=i._duckdb_web_connect=()=>(Ep=i._duckdb_web_connect=M.Oa)(),Op=i._duckdb_web_disconnect=o=>(Op=i._duckdb_web_disconnect=M.Pa)(o),Up=i._duckdb_web_flush_files=()=>(Up=i._duckdb_web_flush_files=M.Qa)(),Mp=i._duckdb_web_flush_file=o=>(Mp=i._duckdb_web_flush_file=M.Ra)(o),Rp=i._duckdb_web_open=(o,c)=>(Rp=i._duckdb_web_open=M.Sa)(o,c),Lp=i._duckdb_web_get_global_file_info=(o,c)=>(Lp=i._duckdb_web_get_global_file_info=M.Ta)(o,c),Np=i._duckdb_web_collect_file_stats=(o,c,d)=>(Np=i._duckdb_web_collect_file_stats=M.Ua)(o,c,d),kp=i._duckdb_web_export_file_stats=(o,c)=>(kp=i._duckdb_web_export_file_stats=M.Va)(o,c),Cp=i._duckdb_web_fs_drop_file=(o,c)=>(Cp=i._duckdb_web_fs_drop_file=M.Wa)(o,c),Pp=i._duckdb_web_fs_drop_files=(o,c,d)=>(Pp=i._duckdb_web_fs_drop_files=M.Xa)(o,c,d),Hp=i._duckdb_web_fs_glob_file_infos=(o,c)=>(Hp=i._duckdb_web_fs_glob_file_infos=M.Ya)(o,c),Vp=i._duckdb_web_fs_get_file_info_by_id=(o,c,d)=>(Vp=i._duckdb_web_fs_get_file_info_by_id=M.Za)(o,c,d),Wp=i._duckdb_web_fs_get_file_info_by_name=(o,c,d)=>(Wp=i._duckdb_web_fs_get_file_info_by_name=M._a)(o,c,d),zp=i._duckdb_web_fs_register_file_url=(o,c,d,m,_)=>(zp=i._duckdb_web_fs_register_file_url=M.$a)(o,c,d,m,_),jp=i._duckdb_web_fs_register_file_buffer=(o,c,d,m)=>(jp=i._duckdb_web_fs_register_file_buffer=M.ab)(o,c,d,m),$p=i._duckdb_web_copy_file_to_buffer=(o,c)=>($p=i._duckdb_web_copy_file_to_buffer=M.bb)(o,c),Gp=i._duckdb_web_copy_file_to_path=(o,c,d)=>(Gp=i._duckdb_web_copy_file_to_path=M.cb)(o,c,d),Kp=i._duckdb_web_get_version=o=>(Kp=i._duckdb_web_get_version=M.db)(o),qp=i._duckdb_web_get_feature_flags=()=>(qp=i._duckdb_web_get_feature_flags=M.eb)(),Yp=i._duckdb_web_tokenize=(o,c)=>(Yp=i._duckdb_web_tokenize=M.fb)(o,c),Jp=i._duckdb_web_tokenize_buffer=(o,c,d)=>(Jp=i._duckdb_web_tokenize_buffer=M.gb)(o,c,d),Xp=i._duckdb_web_udf_scalar_create=(o,c,d)=>(Xp=i._duckdb_web_udf_scalar_create=M.hb)(o,c,d),Zp=i._duckdb_web_prepared_create=(o,c,d)=>(Zp=i._duckdb_web_prepared_create=M.ib)(o,c,d),Qp=i._duckdb_web_prepared_create_buffer=(o,c,d,m)=>(Qp=i._duckdb_web_prepared_create_buffer=M.jb)(o,c,d,m),tm=i._duckdb_web_prepared_close=(o,c,d)=>(tm=i._duckdb_web_prepared_close=M.kb)(o,c,d),em=i._duckdb_web_prepared_run=(o,c,d,m)=>(em=i._duckdb_web_prepared_run=M.lb)(o,c,d,m),rm=i._duckdb_web_prepared_send=(o,c,d,m)=>(rm=i._duckdb_web_prepared_send=M.mb)(o,c,d,m),nm=i._duckdb_web_query_run=(o,c,d)=>(nm=i._duckdb_web_query_run=M.nb)(o,c,d),im=i._duckdb_web_query_run_buffer=(o,c,d,m)=>(im=i._duckdb_web_query_run_buffer=M.ob)(o,c,d,m),sm=i._duckdb_web_pending_query_start=(o,c,d,m)=>(sm=i._duckdb_web_pending_query_start=M.pb)(o,c,d,m),om=i._duckdb_web_pending_query_start_buffer=(o,c,d,m,_)=>(om=i._duckdb_web_pending_query_start_buffer=M.qb)(o,c,d,m,_),am=i._duckdb_web_pending_query_poll=(o,c,d)=>(am=i._duckdb_web_pending_query_poll=M.rb)(o,c,d),lm=i._duckdb_web_pending_query_cancel=(o,c)=>(lm=i._duckdb_web_pending_query_cancel=M.sb)(o,c),cm=i._duckdb_web_query_fetch_results=(o,c)=>(cm=i._duckdb_web_query_fetch_results=M.tb)(o,c),um=i._duckdb_web_get_tablenames=(o,c,d)=>(um=i._duckdb_web_get_tablenames=M.ub)(o,c,d),dm=i._duckdb_web_get_tablenames_buffer=(o,c,d,m)=>(dm=i._duckdb_web_get_tablenames_buffer=M.vb)(o,c,d,m),fm=i._duckdb_web_insert_arrow_from_ipc_stream=(o,c,d,m,_)=>(fm=i._duckdb_web_insert_arrow_from_ipc_stream=M.wb)(o,c,d,m,_),hm=i._duckdb_web_insert_csv_from_path=(o,c,d,m)=>(hm=i._duckdb_web_insert_csv_from_path=M.xb)(o,c,d,m),pm=i._duckdb_web_insert_json_from_path=(o,c,d,m)=>(pm=i._duckdb_web_insert_json_from_path=M.yb)(o,c,d,m),mm=()=>(mm=M.zb)(),xs=()=>(xs=M.Ab)(),Ca=(o,c,d,m,_,y)=>(Ca=M.Bb)(o,c,d,m,_,y),Hc=()=>(Hc=M.Cb)(),Vc=o=>(Vc=M.Gb)(o),Wc=o=>(Wc=M.Hb)(o),zc=(o,c,d,m,_)=>(zc=M.Ib)(o,c,d,m,_),jc=o=>(jc=M.Jb)(o),Pa=o=>(Pa=M.Kb)(o),$c=()=>($c=M.Lb)(),mr=i._malloc=o=>(mr=i._malloc=M.Mb)(o),_m=i._free=o=>(_m=i._free=M.Nb)(o),ym=i._calloc=(o,c)=>(ym=i._calloc=M.Ob)(o,c),Gc=o=>(Gc=M.Qb)(o),Kc=()=>(Kc=M.Rb)(),qc=(o,c)=>(qc=M.Sb)(o,c),Yc=o=>(Yc=M.Tb)(o),Jc=o=>(Jc=M.Ub)(o),Xc=()=>(Xc=M.Vb)();function bm(o){o=Object.assign({},o);var c=_=>()=>_()>>>0,d=_=>y=>_(y)>>>0,m=_=>(y,b)=>_(y,b)>>>0;return o.Ab=c(o.Ab),o.Mb=d(o.Mb),o.Ob=m(o.Ob),o.Ub=d(o.Ub),o.Vb=c(o.Vb),o}i.stackSave=Ss,i.stackRestore=_i,i.stackAlloc=yi,i.getTempRet0=Ip,i.setTempRet0=Ua,i.ccall=Sp;function gm(){var o=Pc,c=0,d=0;try{var m=o(c,d);return fc(m,!0),m}catch(_){return Aa(_)}}function Ha(){if(hn>0){pi=Ha;return}if(w){s(i),Ql();return}if(Sf(),hn>0){pi=Ha;return}function o(){var d;if(i.calledRun=!0,!H){Ql(),s(i),(d=i.onRuntimeInitialized)==null||d.call(i);var c=i.noInitialRun;c||gm(),If()}}i.setStatus?(i.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>i.setStatus(""),1),o()},1)):o()}if(i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return Ha(),n=l,n}})();typeof uf=="object"&&typeof ya=="object"?(ya.exports=_a,ya.exports.default=_a):typeof define=="function"&&define.amd&&define([],()=>_a);var sf,of,cf=(of=(sf=globalThis.self)==null?void 0:sf.name)==null?void 0:of.startsWith("em-pthread"),af,lf,Xy=typeof((lf=(af=globalThis.process)==null?void 0:af.versions)==null?void 0:lf.node)=="string";Xy&&(cf=ql().workerData==="em-pthread");cf&&_a()});var hf=Kr(()=>{});var pf=Kr(()=>{});var mf=Kr((mA,wa)=>{(function(){"use strict";var r="input is invalid type",t=typeof window=="object",e=t?window:{};e.JS_SHA256_NO_WINDOW&&(t=!1);var n=!t&&typeof self=="object",i=!e.JS_SHA256_NO_NODE_JS&&typeof process=="object"&&process.versions&&process.versions.node&&process.type!="renderer";i?e=global:n&&(e=self);var s=!e.JS_SHA256_NO_COMMON_JS&&typeof wa=="object"&&wa.exports,a=typeof define=="function"&&define.amd,l=!e.JS_SHA256_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",u="0123456789abcdef".split(""),f=[-2147483648,8388608,32768,128],h=[24,16,8,0],w=[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],A=["hex","array","digest","arrayBuffer"],E=[];(e.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(S){return Object.prototype.toString.call(S)==="[object Array]"}),l&&(e.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(S){return typeof S=="object"&&S.buffer&&S.buffer.constructor===ArrayBuffer});var at=function(S,U){return function(V){return new yt(U,!0).update(V)[S]()}},wt=function(S){var U=at("hex",S);i&&(U=Vt(U,S)),U.create=function(){return new yt(S)},U.update=function(O){return U.create().update(O)};for(var V=0;V<A.length;++V){var I=A[V];U[I]=at(I,S)}return U},Vt=function(S,U){var V=hf(),I=pf().Buffer,O=U?"sha224":"sha256",B;I.from&&!e.JS_SHA256_NO_BUFFER_FROM?B=I.from:B=function(F){return new I(F)};var N=function(F){if(typeof F=="string")return V.createHash(O).update(F,"utf8").digest("hex");if(F==null)throw new Error(r);return F.constructor===ArrayBuffer&&(F=new Uint8Array(F)),Array.isArray(F)||ArrayBuffer.isView(F)||F.constructor===I?V.createHash(O).update(B(F)).digest("hex"):S(F)};return N},mt=function(S,U){return function(V,I){return new Gt(V,U,!0).update(I)[S]()}},Ot=function(S){var U=mt("hex",S);U.create=function(O){return new Gt(O,S)},U.update=function(O,B){return U.create(O).update(B)};for(var V=0;V<A.length;++V){var I=A[V];U[I]=mt(I,S)}return U};function yt(S,U){U?(E[0]=E[16]=E[1]=E[2]=E[3]=E[4]=E[5]=E[6]=E[7]=E[8]=E[9]=E[10]=E[11]=E[12]=E[13]=E[14]=E[15]=0,this.blocks=E):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],S?(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=S}yt.prototype.update=function(S){if(!this.finalized){var U,V=typeof S;if(V!=="string"){if(V==="object"){if(S===null)throw new Error(r);if(l&&S.constructor===ArrayBuffer)S=new Uint8Array(S);else if(!Array.isArray(S)&&(!l||!ArrayBuffer.isView(S)))throw new Error(r)}else throw new Error(r);U=!0}for(var I,O=0,B,N=S.length,F=this.blocks;O<N;){if(this.hashed&&(this.hashed=!1,F[0]=this.block,this.block=F[16]=F[1]=F[2]=F[3]=F[4]=F[5]=F[6]=F[7]=F[8]=F[9]=F[10]=F[11]=F[12]=F[13]=F[14]=F[15]=0),U)for(B=this.start;O<N&&B<64;++O)F[B>>>2]|=S[O]<<h[B++&3];else for(B=this.start;O<N&&B<64;++O)I=S.charCodeAt(O),I<128?F[B>>>2]|=I<<h[B++&3]:I<2048?(F[B>>>2]|=(192|I>>>6)<<h[B++&3],F[B>>>2]|=(128|I&63)<<h[B++&3]):I<55296||I>=57344?(F[B>>>2]|=(224|I>>>12)<<h[B++&3],F[B>>>2]|=(128|I>>>6&63)<<h[B++&3],F[B>>>2]|=(128|I&63)<<h[B++&3]):(I=65536+((I&1023)<<10|S.charCodeAt(++O)&1023),F[B>>>2]|=(240|I>>>18)<<h[B++&3],F[B>>>2]|=(128|I>>>12&63)<<h[B++&3],F[B>>>2]|=(128|I>>>6&63)<<h[B++&3],F[B>>>2]|=(128|I&63)<<h[B++&3]);this.lastByteIndex=B,this.bytes+=B-this.start,B>=64?(this.block=F[16],this.start=B-64,this.hash(),this.hashed=!0):this.start=B}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},yt.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var S=this.blocks,U=this.lastByteIndex;S[16]=this.block,S[U>>>2]|=f[U&3],this.block=S[16],U>=56&&(this.hashed||this.hash(),S[0]=this.block,S[16]=S[1]=S[2]=S[3]=S[4]=S[5]=S[6]=S[7]=S[8]=S[9]=S[10]=S[11]=S[12]=S[13]=S[14]=S[15]=0),S[14]=this.hBytes<<3|this.bytes>>>29,S[15]=this.bytes<<3,this.hash()}},yt.prototype.hash=function(){var S=this.h0,U=this.h1,V=this.h2,I=this.h3,O=this.h4,B=this.h5,N=this.h6,F=this.h7,H=this.blocks,W,At,Ut,Ae,_t,Xe,Te,Wr,hi,Nn,fn;for(W=16;W<64;++W)_t=H[W-15],At=(_t>>>7|_t<<25)^(_t>>>18|_t<<14)^_t>>>3,_t=H[W-2],Ut=(_t>>>17|_t<<15)^(_t>>>19|_t<<13)^_t>>>10,H[W]=H[W-16]+At+H[W-7]+Ut<<0;for(fn=U&V,W=0;W<64;W+=4)this.first?(this.is224?(Wr=300032,_t=H[0]-1413257819,F=_t-150054599<<0,I=_t+24177077<<0):(Wr=704751109,_t=H[0]-210244248,F=_t-1521486534<<0,I=_t+143694565<<0),this.first=!1):(At=(S>>>2|S<<30)^(S>>>13|S<<19)^(S>>>22|S<<10),Ut=(O>>>6|O<<26)^(O>>>11|O<<21)^(O>>>25|O<<7),Wr=S&U,Ae=Wr^S&V^fn,Te=O&B^~O&N,_t=F+Ut+Te+w[W]+H[W],Xe=At+Ae,F=I+_t<<0,I=_t+Xe<<0),At=(I>>>2|I<<30)^(I>>>13|I<<19)^(I>>>22|I<<10),Ut=(F>>>6|F<<26)^(F>>>11|F<<21)^(F>>>25|F<<7),hi=I&S,Ae=hi^I&U^Wr,Te=F&O^~F&B,_t=N+Ut+Te+w[W+1]+H[W+1],Xe=At+Ae,N=V+_t<<0,V=_t+Xe<<0,At=(V>>>2|V<<30)^(V>>>13|V<<19)^(V>>>22|V<<10),Ut=(N>>>6|N<<26)^(N>>>11|N<<21)^(N>>>25|N<<7),Nn=V&I,Ae=Nn^V&S^hi,Te=N&F^~N&O,_t=B+Ut+Te+w[W+2]+H[W+2],Xe=At+Ae,B=U+_t<<0,U=_t+Xe<<0,At=(U>>>2|U<<30)^(U>>>13|U<<19)^(U>>>22|U<<10),Ut=(B>>>6|B<<26)^(B>>>11|B<<21)^(B>>>25|B<<7),fn=U&V,Ae=fn^U&I^Nn,Te=B&N^~B&F,_t=O+Ut+Te+w[W+3]+H[W+3],Xe=At+Ae,O=S+_t<<0,S=_t+Xe<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+S<<0,this.h1=this.h1+U<<0,this.h2=this.h2+V<<0,this.h3=this.h3+I<<0,this.h4=this.h4+O<<0,this.h5=this.h5+B<<0,this.h6=this.h6+N<<0,this.h7=this.h7+F<<0},yt.prototype.hex=function(){this.finalize();var S=this.h0,U=this.h1,V=this.h2,I=this.h3,O=this.h4,B=this.h5,N=this.h6,F=this.h7,H=u[S>>>28&15]+u[S>>>24&15]+u[S>>>20&15]+u[S>>>16&15]+u[S>>>12&15]+u[S>>>8&15]+u[S>>>4&15]+u[S&15]+u[U>>>28&15]+u[U>>>24&15]+u[U>>>20&15]+u[U>>>16&15]+u[U>>>12&15]+u[U>>>8&15]+u[U>>>4&15]+u[U&15]+u[V>>>28&15]+u[V>>>24&15]+u[V>>>20&15]+u[V>>>16&15]+u[V>>>12&15]+u[V>>>8&15]+u[V>>>4&15]+u[V&15]+u[I>>>28&15]+u[I>>>24&15]+u[I>>>20&15]+u[I>>>16&15]+u[I>>>12&15]+u[I>>>8&15]+u[I>>>4&15]+u[I&15]+u[O>>>28&15]+u[O>>>24&15]+u[O>>>20&15]+u[O>>>16&15]+u[O>>>12&15]+u[O>>>8&15]+u[O>>>4&15]+u[O&15]+u[B>>>28&15]+u[B>>>24&15]+u[B>>>20&15]+u[B>>>16&15]+u[B>>>12&15]+u[B>>>8&15]+u[B>>>4&15]+u[B&15]+u[N>>>28&15]+u[N>>>24&15]+u[N>>>20&15]+u[N>>>16&15]+u[N>>>12&15]+u[N>>>8&15]+u[N>>>4&15]+u[N&15];return this.is224||(H+=u[F>>>28&15]+u[F>>>24&15]+u[F>>>20&15]+u[F>>>16&15]+u[F>>>12&15]+u[F>>>8&15]+u[F>>>4&15]+u[F&15]),H},yt.prototype.toString=yt.prototype.hex,yt.prototype.digest=function(){this.finalize();var S=this.h0,U=this.h1,V=this.h2,I=this.h3,O=this.h4,B=this.h5,N=this.h6,F=this.h7,H=[S>>>24&255,S>>>16&255,S>>>8&255,S&255,U>>>24&255,U>>>16&255,U>>>8&255,U&255,V>>>24&255,V>>>16&255,V>>>8&255,V&255,I>>>24&255,I>>>16&255,I>>>8&255,I&255,O>>>24&255,O>>>16&255,O>>>8&255,O&255,B>>>24&255,B>>>16&255,B>>>8&255,B&255,N>>>24&255,N>>>16&255,N>>>8&255,N&255];return this.is224||H.push(F>>>24&255,F>>>16&255,F>>>8&255,F&255),H},yt.prototype.array=yt.prototype.digest,yt.prototype.arrayBuffer=function(){this.finalize();var S=new ArrayBuffer(this.is224?28:32),U=new DataView(S);return U.setUint32(0,this.h0),U.setUint32(4,this.h1),U.setUint32(8,this.h2),U.setUint32(12,this.h3),U.setUint32(16,this.h4),U.setUint32(20,this.h5),U.setUint32(24,this.h6),this.is224||U.setUint32(28,this.h7),S};function Gt(S,U,V){var I,O=typeof S;if(O==="string"){var B=[],N=S.length,F=0,H;for(I=0;I<N;++I)H=S.charCodeAt(I),H<128?B[F++]=H:H<2048?(B[F++]=192|H>>>6,B[F++]=128|H&63):H<55296||H>=57344?(B[F++]=224|H>>>12,B[F++]=128|H>>>6&63,B[F++]=128|H&63):(H=65536+((H&1023)<<10|S.charCodeAt(++I)&1023),B[F++]=240|H>>>18,B[F++]=128|H>>>12&63,B[F++]=128|H>>>6&63,B[F++]=128|H&63);S=B}else if(O==="object"){if(S===null)throw new Error(r);if(l&&S.constructor===ArrayBuffer)S=new Uint8Array(S);else if(!Array.isArray(S)&&(!l||!ArrayBuffer.isView(S)))throw new Error(r)}else throw new Error(r);S.length>64&&(S=new yt(U,!0).update(S).array());var W=[],At=[];for(I=0;I<64;++I){var Ut=S[I]||0;W[I]=92^Ut,At[I]=54^Ut}yt.call(this,U,V),this.update(At),this.oKeyPad=W,this.inner=!0,this.sharedMemory=V}Gt.prototype=new yt,Gt.prototype.finalize=function(){if(yt.prototype.finalize.call(this),this.inner){this.inner=!1;var S=this.array();yt.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(S),yt.prototype.finalize.call(this)}};var Ct=wt();Ct.sha256=Ct,Ct.sha224=wt(!0),Ct.sha256.hmac=Ot(),Ct.sha224.hmac=Ot(!0),s?wa.exports=Ct:(e.sha256=Ct.sha256,e.sha224=Ct.sha224,a&&define(function(){return Ct}))})()});var nb={};qr(nb,{registerWorker:()=>wf});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 R(r,t,e,n){function i(s){return s instanceof e?s:new e(function(a){a(s)})}return new(e||(e=Promise))(function(s,a){function l(h){try{f(n.next(h))}catch(w){a(w)}}function u(h){try{f(n.throw(h))}catch(w){a(w)}}function f(h){h.done?s(h.value):i(h.value).then(l,u)}f((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 it(r){return this instanceof it?(this.v=r,this):new it(r)}function fe(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),i,s=[];return i={},a("next"),a("throw"),a("return"),i[Symbol.asyncIterator]=function(){return this},i;function a(A){n[A]&&(i[A]=function(E){return new Promise(function(at,wt){s.push([A,E,at,wt])>1||l(A,E)})})}function l(A,E){try{u(n[A](E))}catch(at){w(s[0][3],at)}}function u(A){A.value instanceof it?Promise.resolve(A.value.v).then(f,h):w(s[0][2],A)}function f(A){l("next",A)}function h(A){l("throw",A)}function w(A,E){A(E),s.shift(),s.length&&l(s[0][0],s[0][1])}}function Pn(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(a){return(e=!e)?{value:it(r[i](a)),done:!1}:s?s(a):a}:s}}function Oe(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(a){return new Promise(function(l,u){a=r[s](a),i(l,u,a.done,a.value)})}}function i(s,a,l,u){Promise.resolve(u).then(function(f){s({value:f,done:l})},a)}}var qa={};qr(qa,{compareArrayLike:()=>Ka,joinUint8Arrays:()=>he,memcpy:()=>Fi,rebaseValueOffsets:()=>Cs,toArrayBufferView:()=>ot,toArrayBufferViewAsyncIterator:()=>Re,toArrayBufferViewIterator:()=>rr,toBigInt64Array:()=>ks,toBigUint64Array:()=>Nm,toFloat32Array:()=>km,toFloat32ArrayAsyncIterator:()=>Qm,toFloat32ArrayIterator:()=>$m,toFloat64Array:()=>Cm,toFloat64ArrayAsyncIterator:()=>t_,toFloat64ArrayIterator:()=>Gm,toInt16Array:()=>Mm,toInt16ArrayAsyncIterator:()=>Ym,toInt16ArrayIterator:()=>Vm,toInt32Array:()=>_n,toInt32ArrayAsyncIterator:()=>Jm,toInt32ArrayIterator:()=>Wm,toInt8Array:()=>Um,toInt8ArrayAsyncIterator:()=>qm,toInt8ArrayIterator:()=>Hm,toUint16Array:()=>Rm,toUint16ArrayAsyncIterator:()=>Xm,toUint16ArrayIterator:()=>zm,toUint32Array:()=>Lm,toUint32ArrayAsyncIterator:()=>Zm,toUint32ArrayIterator:()=>jm,toUint8Array:()=>J,toUint8ArrayAsyncIterator:()=>Ga,toUint8ArrayIterator:()=>$a,toUint8ClampedArray:()=>Pm,toUint8ClampedArrayAsyncIterator:()=>e_,toUint8ClampedArrayIterator:()=>Km});var Tm=new TextDecoder("utf-8"),Si=r=>Tm.decode(r),xm=new TextEncoder,er=r=>xm.encode(r);var Em=r=>typeof r=="number",iu=r=>typeof r=="boolean",Kt=r=>typeof r=="function",ne=r=>r!=null&&Object(r)===r,Ue=r=>ne(r)&&Kt(r.then);var Me=r=>ne(r)&&Kt(r[Symbol.iterator]),we=r=>ne(r)&&Kt(r[Symbol.asyncIterator]),Os=r=>ne(r)&&ne(r.schema);var Us=r=>ne(r)&&"done"in r&&"value"in r;var Ms=r=>ne(r)&&Kt(r.stat)&&Em(r.fd);var Rs=r=>ne(r)&&Ii(r.body),Ls=r=>"_getDOMStream"in r&&"_getNodeStream"in r,su=r=>ne(r)&&Kt(r.abort)&&Kt(r.getWriter)&&!Ls(r),Ii=r=>ne(r)&&Kt(r.cancel)&&Kt(r.getReader)&&!Ls(r),ou=r=>ne(r)&&Kt(r.end)&&Kt(r.write)&&iu(r.writable)&&!Ls(r),Ns=r=>ne(r)&&Kt(r.read)&&Kt(r.pipe)&&iu(r.readable)&&!Ls(r),au=r=>ne(r)&&Kt(r.clear)&&Kt(r.bytes)&&Kt(r.position)&&Kt(r.setPosition)&&Kt(r.capacity)&&Kt(r.getBufferIdentifier)&&Kt(r.createLong);var ja=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Om(r){let t=r[0]?[r[0]]:[],e,n,i,s;for(let a,l,u=0,f=0,h=r.length;++u<h;){if(a=t[f],l=r[u],!a||!l||a.buffer!==l.buffer||l.byteOffset<a.byteOffset){l&&(t[++f]=l);continue}if({byteOffset:e,byteLength:i}=a,{byteOffset:n,byteLength:s}=l,e+i<n||n+s<e){l&&(t[++f]=l);continue}t[f]=new Uint8Array(a.buffer,e,n-e+s)}return t}function Fi(r,t,e=0,n=t.byteLength){let i=r.byteLength,s=new Uint8Array(r.buffer,r.byteOffset,i),a=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return s.set(a,e),r}function he(r,t){let e=Om(r),n=e.reduce((h,w)=>h+w.byteLength,0),i,s,a,l=0,u=-1,f=Math.min(t||Number.POSITIVE_INFINITY,n);for(let h=e.length;++u<h;){if(i=e[u],s=i.subarray(0,Math.min(i.length,f-l)),f<=l+s.length){s.length<i.length?e[u]=i.subarray(s.length):s.length===i.length&&u++,a?Fi(a,s,l):a=s;break}Fi(a||(a=new Uint8Array(f)),s,l),l+=s.length}return[a||new Uint8Array(0),e.slice(u),n-(a?a.byteLength:0)]}function ot(r,t){let e=Us(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=er(e)),e instanceof ArrayBuffer?new r(e):e instanceof ja?new r(e):au(e)?ot(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 Um=r=>ot(Int8Array,r),Mm=r=>ot(Int16Array,r),_n=r=>ot(Int32Array,r),ks=r=>ot(BigInt64Array,r),J=r=>ot(Uint8Array,r),Rm=r=>ot(Uint16Array,r),Lm=r=>ot(Uint32Array,r),Nm=r=>ot(BigUint64Array,r),km=r=>ot(Float32Array,r),Cm=r=>ot(Float64Array,r),Pm=r=>ot(Uint8ClampedArray,r),za=r=>(r.next(),r);function*rr(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof ja?e(t):Me(t)?t:e(t);return yield*mn(za(function*(i){let s=null;do s=i.next(yield ot(r,s));while(!s.done)}(n[Symbol.iterator]()))),new r}var Hm=r=>rr(Int8Array,r),Vm=r=>rr(Int16Array,r),Wm=r=>rr(Int32Array,r),$a=r=>rr(Uint8Array,r),zm=r=>rr(Uint16Array,r),jm=r=>rr(Uint32Array,r),$m=r=>rr(Float32Array,r),Gm=r=>rr(Float64Array,r),Km=r=>rr(Uint8ClampedArray,r);function Re(r,t){return fe(this,arguments,function*(){if(Ue(t))return yield it(yield it(yield*mn(Pn(Oe(Re(r,yield it(t)))))));let n=function(a){return fe(this,arguments,function*(){yield yield it(yield it(a))})},i=function(a){return fe(this,arguments,function*(){yield it(yield*mn(Pn(Oe(za(function*(l){let u=null;do u=l.next(yield u==null?void 0:u.value);while(!u.done)}(a[Symbol.iterator]()))))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof ja?n(t):Me(t)?i(t):we(t)?t:n(t);return yield it(yield*mn(Pn(Oe(za(function(a){return fe(this,arguments,function*(){let l=null;do l=yield it(a.next(yield yield it(ot(r,l))));while(!l.done)})}(s[Symbol.asyncIterator]())))))),yield it(new r)})}var qm=r=>Re(Int8Array,r),Ym=r=>Re(Int16Array,r),Jm=r=>Re(Int32Array,r),Ga=r=>Re(Uint8Array,r),Xm=r=>Re(Uint16Array,r),Zm=r=>Re(Uint32Array,r),Qm=r=>Re(Float32Array,r),t_=r=>Re(Float64Array,r),e_=r=>Re(Uint8ClampedArray,r);function Cs(r,t,e){if(r!==0){e=e.slice(0,t);for(let n=-1,i=e.length;++n<i;)e[n]+=r}return e.subarray(0,t)}function Ka(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 Xt={fromIterable(r){return Ps(r_(r))},fromAsyncIterable(r){return Ps(n_(r))},fromDOMStream(r){return Ps(i_(r))},fromNodeStream(r){return Ps(s_(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')}},Ps=r=>(r.next(),r);function*r_(r){let t,e=!1,n=[],i,s,a,l=0;function u(){return s==="peek"?he(n,a)[0]:([i,n,l]=he(n,a),i)}({cmd:s,size:a}=(yield null)||{cmd:"read",size:0});let f=$a(r)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(a-l)?f.next():f.next(a-l),!t&&i.byteLength>0&&(n.push(i),l+=i.byteLength),t||a<=l)do({cmd:s,size:a}=yield u());while(a<l);while(!t)}catch(h){(e=!0)&&typeof f.throw=="function"&&f.throw(h)}finally{e===!1&&typeof f.return=="function"&&f.return(null)}return null}function n_(r){return fe(this,arguments,function*(){let e,n=!1,i=[],s,a,l,u=0;function f(){return a==="peek"?he(i,l)[0]:([s,i,u]=he(i,l),s)}({cmd:a,size:l}=(yield yield it(null))||{cmd:"read",size:0});let h=Ga(r)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(l-u)?yield it(h.next()):yield it(h.next(l-u)),!e&&s.byteLength>0&&(i.push(s),u+=s.byteLength),e||l<=u)do({cmd:a,size:l}=yield yield it(f()));while(l<u);while(!e)}catch(w){(n=!0)&&typeof h.throw=="function"&&(yield it(h.throw(w)))}finally{n===!1&&typeof h.return=="function"&&(yield it(h.return(new Uint8Array(0))))}return yield it(null)})}function i_(r){return fe(this,arguments,function*(){let e=!1,n=!1,i=[],s,a,l,u=0;function f(){return a==="peek"?he(i,l)[0]:([s,i,u]=he(i,l),s)}({cmd:a,size:l}=(yield yield it(null))||{cmd:"read",size:0});let h=new Ja(r);try{do if({done:e,value:s}=Number.isNaN(l-u)?yield it(h.read()):yield it(h.read(l-u)),!e&&s.byteLength>0&&(i.push(J(s)),u+=s.byteLength),e||l<=u)do({cmd:a,size:l}=yield yield it(f()));while(l<u);while(!e)}catch(w){(n=!0)&&(yield it(h.cancel(w)))}finally{n===!1?yield it(h.cancel()):r.locked&&h.releaseLock()}return yield it(null)})}var Ja=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 R(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 R(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=J(e)),e})}},Ya=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function s_(r){return fe(this,arguments,function*(){let e=[],n="error",i=!1,s=null,a,l,u=0,f=[],h;function w(){return a==="peek"?he(f,l)[0]:([h,f,u]=he(f,l),h)}if({cmd:a,size:l}=(yield yield it(null))||{cmd:"read",size:0},r.isTTY)return yield yield it(new Uint8Array(0)),yield it(null);try{e[0]=Ya(r,"end"),e[1]=Ya(r,"error");do{if(e[2]=Ya(r,"readable"),[n,s]=yield it(Promise.race(e.map(E=>E[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(l-u)?(h=J(r.read(l-u)),h.byteLength<l-u&&(h=J(r.read()))):h=J(r.read()),h.byteLength>0&&(f.push(h),u+=h.byteLength)),i||l<=u)do({cmd:a,size:l}=yield yield it(w()));while(l<u)}while(!i)}finally{yield it(A(e,n==="error"?s:null))}return yield it(null);function A(E,at){return h=f=null,new Promise((wt,Vt)=>{for(let[mt,Ot]of E)r.off(mt,Ot);try{let mt=r.destroy;mt&&mt.call(r,at),at=void 0}catch(mt){at=mt||at}finally{at!=null?Vt(at):wt()}})}})}var vt;(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"})(vt||(vt={}));var xt;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(xt||(xt={}));var Dt;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(Dt||(Dt={}));var Wt;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(Wt||(Wt={}));var C;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(C||(C={}));var qt;(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"})(qt||(qt={}));var nr=new Int32Array(2),Hs=new Float32Array(nr.buffer),Vs=new Float64Array(nr.buffer),Hn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Bi;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(Bi||(Bi={}));var pe=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 nr[0]=this.readInt32(t),Hs[0]}readFloat64(t){return nr[Hn?0:1]=this.readInt32(t),nr[Hn?1:0]=this.readInt32(t+4),Vs[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){Hs[0]=e,this.writeInt32(t,nr[0])}writeFloat64(t,e){Vs[0]=e,this.writeInt32(t,nr[Hn?0:1]),this.writeInt32(t+4,nr[Hn?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===Bi.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 yn=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=pe.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=pe.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 a=0,l=this.space;t:for(e=0;e<this.vtables.length;e++){let u=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(u)){for(let f=2;f<s;f+=2)if(this.bb.readInt16(l+f)!=this.bb.readInt16(u+f))continue t;a=this.vtables[e];break}}return a?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,a-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,8+i),s.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let a=3;a>=0;a--)this.writeInt8(s.charCodeAt(a))}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;return 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),this.bb.bytes().set(e,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),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 Di;(function(r){r[r.BUFFER=0]="BUFFER"})(Di||(Di={}));var Ai;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(Ai||(Ai={}));var zs=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):Ai.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Di.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,Ai.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,Di.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 Vn=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 me=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 Vn).__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 zs).__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 _r=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 me).__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 Yr;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(Yr||(Yr={}));var Ti;(function(r){r[r.DenseArray=0]="DenseArray"})(Ti||(Ti={}));var Ne=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static 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 ir=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 Ne).__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):Ti.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,Ti.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var Yt=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 xi=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 Ei=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 Jr=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):Wt.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Wt.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return r.startDate(t),r.addUnit(t,e),r.endDate(t)}};var sr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static 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 Xr=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDuration(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(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):C.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,C.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return r.startDuration(t),r.addUnit(t,e),r.endDuration(t)}};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 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 Qr=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 tn=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):Dt.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,Dt.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return r.startFloatingPoint(t),r.addPrecision(t,e),r.endFloatingPoint(t)}};var en=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):qt.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,qt.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return r.startInterval(t),r.addUnit(t,e),r.endInterval(t)}};var Oi=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeBinary(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return r.startLargeBinary(t),r.endLargeBinary(t)}};var Ui=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeUtf8(t,e){return(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+4),(e||new r).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return r.startLargeUtf8(t),r.endLargeUtf8(t)}};var Mi=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 rn=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 Ri=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 Li=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):C.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,C.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):C.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,C.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 ke=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):xt.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,xt.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 Ni=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 Et;(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"})(Et||(Et={}));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 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):Et.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 ir).__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 Yt).__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,Et.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 ae=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):Yr.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new re).__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 Yt).__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,Yr.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 ct;(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"})(ct||(ct={}));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.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",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",r[r.DurationSecond=-27]="DurationSecond",r[r.DurationMillisecond=-28]="DurationMillisecond",r[r.DurationMicrosecond=-29]="DurationMicrosecond",r[r.DurationNanosecond=-30]="DurationNanosecond"})(p||(p={}));var Se;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(Se||(Se={}));var _l={};qr(_l,{clampRange:()=>Hi,createElementComparator:()=>an,wrapIndex:()=>bn});var Xa={};qr(Xa,{valueToString:()=>Ce});function Ce(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=>Ce(t)),"]"):"[".concat(r,"]"):ArrayBuffer.isView(r)?"[".concat(r,"]"):JSON.stringify(r,(t,e)=>typeof e=="bigint"?"".concat(e):e)}var el={};qr(el,{BN:()=>Ci,bigNumToBigInt:()=>cu,bigNumToNumber:()=>tl,bigNumToString:()=>$n,isArrowBigNumSymbol:()=>lu});function pt(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)}function Za(r,t){return pt(r/t)+pt(r%t)/pt(t)}var lu=Symbol.for("isArrowBigNum");function Pe(r,...t){return t.length===0?Object.setPrototypeOf(ot(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}Pe.prototype[lu]=!0;Pe.prototype.toJSON=function(){return'"'.concat($n(this),'"')};Pe.prototype.valueOf=function(r){return tl(this,r)};Pe.prototype.toString=function(){return $n(this)};Pe.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return tl(this);case"string":return $n(this);case"default":return cu(this)}return $n(this)};function zn(...r){return Pe.apply(this,r)}function jn(...r){return Pe.apply(this,r)}function ki(...r){return Pe.apply(this,r)}Object.setPrototypeOf(zn.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(jn.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(ki.prototype,Object.create(Uint32Array.prototype));Object.assign(zn.prototype,Pe.prototype,{constructor:zn,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(jn.prototype,Pe.prototype,{constructor:jn,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(ki.prototype,Pe.prototype,{constructor:ki,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var o_=BigInt(4294967296)*BigInt(4294967296),a_=o_-BigInt(1);function tl(r,t){let{buffer:e,byteOffset:n,byteLength:i,signed:s}=r,a=new BigUint64Array(e,n,i/8),l=s&&a.at(-1)&BigInt(1)<<BigInt(63),u=BigInt(0),f=0;if(l){for(let h of a)u|=(h^a_)*(BigInt(1)<<BigInt(64*f++));u*=BigInt(-1),u-=BigInt(1)}else for(let h of a)u|=h*(BigInt(1)<<BigInt(64*f++));if(typeof t=="number"){let h=BigInt(Math.pow(10,t)),w=u/h,A=u%h;return pt(w)+pt(A)/pt(h)}return pt(u)}function $n(r){if(r.byteLength===8){let s=new r.BigIntArray(r.buffer,r.byteOffset,1);return"".concat(s[0])}if(!r.signed)return Qa(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Qa(r);t=t.slice();let n=1;for(let s=0;s<t.length;s++){let a=t[s],l=~a+n;t[s]=l,n&=a===0?1:0}let i=Qa(t);return"-".concat(i)}function cu(r){return r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:$n(r)}function Qa(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,a=n.length-1;do{for(e[0]=n[s=0];s<a;)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 zn(t);case!1:return new jn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new zn(t)}return t.byteLength===16?new ki(t):new jn(t)}static signed(t){return new zn(t)}static unsigned(t){return new jn(t)}static decimal(t){return new ki(t)}constructor(t,e){return r.new(t,e)}};var uu,du,fu,hu,pu,mu,_u,yu,bu,gu,wu,vu,Su,Iu,Fu,Bu,Du,Au,Tu,xu,Eu,Ou,L=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 isLargeBinary(t){return(t==null?void 0:t.typeId)===p.LargeBinary}static isUtf8(t){return(t==null?void 0:t.typeId)===p.Utf8}static isLargeUtf8(t){return(t==null?void 0:t.typeId)===p.LargeUtf8}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 isDuration(t){return(t==null?void 0:t.typeId)===p.Duration}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===xt.Dense}static isSparseUnion(t){return r.isUnion(t)&&t.mode===xt.Sparse}constructor(t){this.typeId=t}};uu=Symbol.toStringTag;L[uu]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(L.prototype);var ie=class extends L{constructor(){super(p.Null)}toString(){return"Null"}};du=Symbol.toStringTag;ie[du]=(r=>r[Symbol.toStringTag]="Null")(ie.prototype);var Jt=class extends L{constructor(t,e){super(p.Int),this.isSigned=t,this.bitWidth=e}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;Jt[fu]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(Jt.prototype);var js=class extends Jt{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},$s=class extends Jt{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},or=class extends Jt{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Gs=class extends Jt{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Ks=class extends Jt{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},qs=class extends Jt{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Ys=class extends Jt{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Js=class extends Jt{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(js.prototype,"ArrayType",{value:Int8Array});Object.defineProperty($s.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(or.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Gs.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Ks.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(qs.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Ys.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Js.prototype,"ArrayType",{value:BigUint64Array});var Ie=class extends L{constructor(t){super(p.Float),this.precision=t}get ArrayType(){switch(this.precision){case Dt.HALF:return Uint16Array;case Dt.SINGLE:return Float32Array;case Dt.DOUBLE:return Float64Array}throw new Error("Unrecognized ".concat(this[Symbol.toStringTag]," type"))}toString(){return"Float".concat(this.precision<<5||16)}};hu=Symbol.toStringTag;Ie[hu]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(Ie.prototype);var Xs=class extends Ie{constructor(){super(Dt.HALF)}},Zs=class extends Ie{constructor(){super(Dt.SINGLE)}},Qs=class extends Ie{constructor(){super(Dt.DOUBLE)}};Object.defineProperty(Xs.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Zs.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Qs.prototype,"ArrayType",{value:Float64Array});var gr=class extends L{constructor(){super(p.Binary)}toString(){return"Binary"}};pu=Symbol.toStringTag;gr[pu]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(gr.prototype);var wr=class extends L{constructor(){super(p.LargeBinary)}toString(){return"LargeBinary"}};mu=Symbol.toStringTag;wr[mu]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(wr.prototype);var vr=class extends L{constructor(){super(p.Utf8)}toString(){return"Utf8"}};_u=Symbol.toStringTag;vr[_u]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(vr.prototype);var Sr=class extends L{constructor(){super(p.LargeUtf8)}toString(){return"LargeUtf8"}};yu=Symbol.toStringTag;Sr[yu]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Sr.prototype);var Ir=class extends L{constructor(){super(p.Bool)}toString(){return"Bool"}};bu=Symbol.toStringTag;Ir[bu]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(Ir.prototype);var Fr=class extends L{constructor(t,e,n=128){super(p.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return"Decimal[".concat(this.precision,"e").concat(this.scale>0?"+":"").concat(this.scale,"]")}};gu=Symbol.toStringTag;Fr[gu]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(Fr.prototype);var Br=class extends L{constructor(t){super(p.Date),this.unit=t}toString(){return"Date".concat((this.unit+1)*32,"<").concat(Wt[this.unit],">")}get ArrayType(){return this.unit===Wt.DAY?Int32Array:BigInt64Array}};wu=Symbol.toStringTag;Br[wu]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))(Br.prototype);var Dr=class extends L{constructor(t,e){super(p.Time),this.unit=t,this.bitWidth=e}toString(){return"Time".concat(this.bitWidth,"<").concat(C[this.unit],">")}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error("Unrecognized ".concat(this[Symbol.toStringTag]," type"))}};vu=Symbol.toStringTag;Dr[vu]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(Dr.prototype);var Ar=class extends L{constructor(t,e){super(p.Timestamp),this.unit=t,this.timezone=e}toString(){return"Timestamp<".concat(C[this.unit]).concat(this.timezone?", ".concat(this.timezone):"",">")}};Su=Symbol.toStringTag;Ar[Su]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(Ar.prototype);var Tr=class extends L{constructor(t){super(p.Interval),this.unit=t}toString(){return"Interval<".concat(qt[this.unit],">")}};Iu=Symbol.toStringTag;Tr[Iu]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Tr.prototype);var xr=class extends L{constructor(t){super(p.Duration),this.unit=t}toString(){return"Duration<".concat(C[this.unit],">")}};Fu=Symbol.toStringTag;xr[Fu]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(xr.prototype);var He=class extends L{constructor(t){super(p.List),this.children=[t]}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}};Bu=Symbol.toStringTag;He[Bu]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(He.prototype);var Rt=class extends L{constructor(t){super(p.Struct),this.children=t}toString(){return"Struct<{".concat(this.children.map(t=>"".concat(t.name,":").concat(t.type)).join(", "),"}>")}};Du=Symbol.toStringTag;Rt[Du]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(Rt.prototype);var Ve=class extends L{constructor(t,e,n){super(p.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((i,s,a)=>(i[s]=a)&&i||i,Object.create(null))}toString(){return"".concat(this[Symbol.toStringTag],"<").concat(this.children.map(t=>"".concat(t.type)).join(" | "),">")}};Au=Symbol.toStringTag;Ve[Au]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(Ve.prototype);var Er=class extends L{constructor(t){super(p.FixedSizeBinary),this.byteWidth=t}toString(){return"FixedSizeBinary[".concat(this.byteWidth,"]")}};Tu=Symbol.toStringTag;Er[Tu]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Er.prototype);var We=class extends L{constructor(t,e){super(p.FixedSizeList),this.listSize=t,this.children=[e]}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,">")}};xu=Symbol.toStringTag;We[xu]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(We.prototype);var ze=class extends L{constructor(t,e=!1){var n,i,s;if(super(p.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t==null?void 0:t.type)===null||n===void 0)&&n.children)){let a=(i=t==null?void 0:t.type)===null||i===void 0?void 0:i.children[0];a&&(a.name="key");let l=(s=t==null?void 0:t.type)===null||s===void 0?void 0:s.children[1];l&&(l.name="value")}}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(", "),"}>")}};Eu=Symbol.toStringTag;ze[Eu]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(ze.prototype);var l_=(r=>()=>++r)(-1),_e=class extends L{constructor(t,e,n,i){super(p.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?l_():pt(n)}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,">")}};Ou=Symbol.toStringTag;_e[Ou]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(_e.prototype);function ye(r){let t=r;switch(r.typeId){case p.Decimal:return r.bitWidth/32;case p.Interval:return 1+t.unit;case p.FixedSizeList:return t.listSize;case p.FixedSizeBinary:return t.byteWidth;default:return 1}}var z=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 c_(this,t,e)}getVisitFnByTypeId(t,e=!0){return Gn(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}visitLargeUtf8(t,...e){return null}visitBinary(t,...e){return null}visitLargeBinary(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}visitDuration(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}};function c_(r,t,e=!0){return typeof t=="number"?Gn(r,t,e):typeof t=="string"&&t in p?Gn(r,p[t],e):t&&t instanceof L?Gn(r,Uu(t),e):t!=null&&t.type&&t.type instanceof L?Gn(r,Uu(t.type),e):Gn(r,p.NONE,e)}function Gn(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.LargeUtf8:n=r.visitLargeUtf8;break;case p.Binary:n=r.visitBinary;break;case p.LargeBinary:n=r.visitLargeBinary;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.Duration:n=r.visitDuration;break;case p.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case p.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case p.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case p.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;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 Uu(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 Dt.HALF:return p.Float16;case Dt.SINGLE:return p.Float32;case Dt.DOUBLE:return p.Float64}return p.Float;case p.Binary:return p.Binary;case p.LargeBinary:return p.LargeBinary;case p.Utf8:return p.Utf8;case p.LargeUtf8:return p.LargeUtf8;case p.Bool:return p.Bool;case p.Decimal:return p.Decimal;case p.Time:switch(r.unit){case C.SECOND:return p.TimeSecond;case C.MILLISECOND:return p.TimeMillisecond;case C.MICROSECOND:return p.TimeMicrosecond;case C.NANOSECOND:return p.TimeNanosecond}return p.Time;case p.Timestamp:switch(r.unit){case C.SECOND:return p.TimestampSecond;case C.MILLISECOND:return p.TimestampMillisecond;case C.MICROSECOND:return p.TimestampMicrosecond;case C.NANOSECOND:return p.TimestampNanosecond}return p.Timestamp;case p.Date:switch(r.unit){case Wt.DAY:return p.DateDay;case Wt.MILLISECOND:return p.DateMillisecond}return p.Date;case p.Interval:switch(r.unit){case qt.DAY_TIME:return p.IntervalDayTime;case qt.YEAR_MONTH:return p.IntervalYearMonth}return p.Interval;case p.Duration:switch(r.unit){case C.SECOND:return p.DurationSecond;case C.MILLISECOND:return p.DurationMillisecond;case C.MICROSECOND:return p.DurationMicrosecond;case C.NANOSECOND:return p.DurationNanosecond}return p.Duration;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 xt.Dense:return p.DenseUnion;case xt.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],"'"))}z.prototype.visitInt8=null;z.prototype.visitInt16=null;z.prototype.visitInt32=null;z.prototype.visitInt64=null;z.prototype.visitUint8=null;z.prototype.visitUint16=null;z.prototype.visitUint32=null;z.prototype.visitUint64=null;z.prototype.visitFloat16=null;z.prototype.visitFloat32=null;z.prototype.visitFloat64=null;z.prototype.visitDateDay=null;z.prototype.visitDateMillisecond=null;z.prototype.visitTimestampSecond=null;z.prototype.visitTimestampMillisecond=null;z.prototype.visitTimestampMicrosecond=null;z.prototype.visitTimestampNanosecond=null;z.prototype.visitTimeSecond=null;z.prototype.visitTimeMillisecond=null;z.prototype.visitTimeMicrosecond=null;z.prototype.visitTimeNanosecond=null;z.prototype.visitDenseUnion=null;z.prototype.visitSparseUnion=null;z.prototype.visitIntervalDayTime=null;z.prototype.visitIntervalYearMonth=null;z.prototype.visitDuration=null;z.prototype.visitDurationSecond=null;z.prototype.visitDurationMillisecond=null;z.prototype.visitDurationMicrosecond=null;z.prototype.visitDurationNanosecond=null;var rl={};qr(rl,{float64ToUint16:()=>Pi,uint16ToFloat64:()=>to});var Mu=new Float64Array(1),Kn=new Uint32Array(Mu.buffer);function to(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 Pi(r){if(r!==r)return 32256;Mu[0]=r;let t=(Kn[1]&2147483648)>>16&65535,e=Kn[1]&2146435072,n=0;return e>=1089470464?Kn[0]>0?e=31744:(e=(e&2080374784)>>16,n=(Kn[1]&1048575)>>10):e<=1056964608?(n=1048576+(Kn[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(Kn[1]&1048575)+512>>10),t|e|n&65535}var q=class extends z{};function tt(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var u_=(r,t,e)=>{r[t]=Math.floor(e/864e5)},Ru=(r,t,e,n)=>{if(e+1<t.length){let i=pt(t[e]),s=pt(t[e+1]);r.set(n.subarray(0,s-i),i)}},d_=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Or=({values:r},t,e)=>{r[t]=e},nl=({values:r},t,e)=>{r[t]=e},Lu=({values:r},t,e)=>{r[t]=Pi(e)},f_=(r,t,e)=>{switch(r.type.precision){case Dt.HALF:return Lu(r,t,e);case Dt.SINGLE:case Dt.DOUBLE:return nl(r,t,e)}},eo=({values:r},t,e)=>{u_(r,t,e.valueOf())},ro=({values:r},t,e)=>{r[t]=BigInt(e)},il=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},Nu=({values:r,valueOffsets:t},e,n)=>Ru(r,t,e,n),ku=({values:r,valueOffsets:t},e,n)=>Ru(r,t,e,er(n)),sl=(r,t,e)=>{r.type.unit===Wt.DAY?eo(r,t,e):ro(r,t,e)},no=({values:r},t,e)=>{r[t]=BigInt(e/1e3)},io=({values:r},t,e)=>{r[t]=BigInt(e)},so=({values:r},t,e)=>{r[t]=BigInt(e*1e3)},oo=({values:r},t,e)=>{r[t]=BigInt(e*1e6)},ol=(r,t,e)=>{switch(r.type.unit){case C.SECOND:return no(r,t,e);case C.MILLISECOND:return io(r,t,e);case C.MICROSECOND:return so(r,t,e);case C.NANOSECOND:return oo(r,t,e)}},ao=({values:r},t,e)=>{r[t]=e},lo=({values:r},t,e)=>{r[t]=e},co=({values:r},t,e)=>{r[t]=e},uo=({values:r},t,e)=>{r[t]=e},al=(r,t,e)=>{switch(r.type.unit){case C.SECOND:return ao(r,t,e);case C.MILLISECOND:return lo(r,t,e);case C.MICROSECOND:return co(r,t,e);case C.NANOSECOND:return uo(r,t,e)}},ll=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},h_=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,s=Zt.getVisitFn(n);if(Array.isArray(e))for(let a=-1,l=i[t],u=i[t+1];l<u;)s(n,l++,e[++a]);else for(let a=-1,l=i[t],u=i[t+1];l<u;)s(n,l++,e.get(++a))},p_=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,s=Zt.getVisitFn(n),{[t]:a,[t+1]:l}=i,u=e instanceof Map?e.entries():Object.entries(e);for(let f of u)if(s(n,a,f),++a>=l)break},m_=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),__=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),y_=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),b_=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),g_=(r,t,e)=>{let n=r.type.children.map(s=>Zt.getVisitFn(s.type)),i=e instanceof Map?y_(t,e):e instanceof dt?__(t,e):Array.isArray(e)?m_(t,e):b_(t,e);r.type.children.forEach((s,a)=>i(n[a],r.children[a],s,a))},w_=(r,t,e)=>{r.type.mode===xt.Dense?Cu(r,t,e):Pu(r,t,e)},Cu=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Zt.visit(i,r.valueOffsets[t],e)},Pu=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Zt.visit(i,t,e)},v_=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},cl=(r,t,e)=>{r.type.unit===qt.DAY_TIME?fo(r,t,e):ho(r,t,e)},fo=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},ho=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},po=({values:r},t,e)=>{r[t]=e},mo=({values:r},t,e)=>{r[t]=e},_o=({values:r},t,e)=>{r[t]=e},yo=({values:r},t,e)=>{r[t]=e},ul=(r,t,e)=>{switch(r.type.unit){case C.SECOND:return po(r,t,e);case C.MILLISECOND:return mo(r,t,e);case C.MICROSECOND:return _o(r,t,e);case C.NANOSECOND:return yo(r,t,e)}},S_=(r,t,e)=>{let{stride:n}=r,i=r.children[0],s=Zt.getVisitFn(i);if(Array.isArray(e))for(let a=-1,l=t*n;++a<n;)s(i,l+a,e[a]);else for(let a=-1,l=t*n;++a<n;)s(i,l+a,e.get(a))};q.prototype.visitBool=tt(d_);q.prototype.visitInt=tt(Or);q.prototype.visitInt8=tt(Or);q.prototype.visitInt16=tt(Or);q.prototype.visitInt32=tt(Or);q.prototype.visitInt64=tt(Or);q.prototype.visitUint8=tt(Or);q.prototype.visitUint16=tt(Or);q.prototype.visitUint32=tt(Or);q.prototype.visitUint64=tt(Or);q.prototype.visitFloat=tt(f_);q.prototype.visitFloat16=tt(Lu);q.prototype.visitFloat32=tt(nl);q.prototype.visitFloat64=tt(nl);q.prototype.visitUtf8=tt(ku);q.prototype.visitLargeUtf8=tt(ku);q.prototype.visitBinary=tt(Nu);q.prototype.visitLargeBinary=tt(Nu);q.prototype.visitFixedSizeBinary=tt(il);q.prototype.visitDate=tt(sl);q.prototype.visitDateDay=tt(eo);q.prototype.visitDateMillisecond=tt(ro);q.prototype.visitTimestamp=tt(ol);q.prototype.visitTimestampSecond=tt(no);q.prototype.visitTimestampMillisecond=tt(io);q.prototype.visitTimestampMicrosecond=tt(so);q.prototype.visitTimestampNanosecond=tt(oo);q.prototype.visitTime=tt(al);q.prototype.visitTimeSecond=tt(ao);q.prototype.visitTimeMillisecond=tt(lo);q.prototype.visitTimeMicrosecond=tt(co);q.prototype.visitTimeNanosecond=tt(uo);q.prototype.visitDecimal=tt(ll);q.prototype.visitList=tt(h_);q.prototype.visitStruct=tt(g_);q.prototype.visitUnion=tt(w_);q.prototype.visitDenseUnion=tt(Cu);q.prototype.visitSparseUnion=tt(Pu);q.prototype.visitDictionary=tt(v_);q.prototype.visitInterval=tt(cl);q.prototype.visitIntervalDayTime=tt(fo);q.prototype.visitIntervalYearMonth=tt(ho);q.prototype.visitDuration=tt(ul);q.prototype.visitDurationSecond=tt(po);q.prototype.visitDurationMillisecond=tt(mo);q.prototype.visitDurationMicrosecond=tt(_o);q.prototype.visitDurationNanosecond=tt(yo);q.prototype.visitFixedSizeList=tt(S_);q.prototype.visitMap=tt(p_);var Zt=new q;var je=Symbol.for("parent"),qn=Symbol.for("rowIndex"),nn=class{constructor(t,e){return this[je]=t,this[qn]=e,new Proxy(this,new fl)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[qn],e=this[je],n=e.type.children,i={};for(let s=-1,a=n.length;++s<a;)i[n[s].name]=jt.visit(e.children[s],t);return i}toString(){return"{".concat([...this].map(([t,e])=>"".concat(Ce(t),": ").concat(Ce(e))).join(", "),"}")}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new dl(this[je],this[qn])}},dl=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,jt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(nn.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[je]:{writable:!0,enumerable:!1,configurable:!1,value:null},[qn]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var fl=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[je].type.children.map(e=>e.name)}has(t,e){return t[je].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[je].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[je].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=jt.visit(t[je].children[n],t[qn]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[je].type.children.findIndex(s=>s.name===e);return i!==-1?(Zt.visit(t[je].children[i],t[qn],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}};var j=class extends z{};function X(r){return(t,e)=>t.getValid(e)?r(t,e):null}var I_=(r,t)=>864e5*r[t],F_=(r,t)=>null,Hu=(r,t,e)=>{if(e+1>=t.length)return null;let n=pt(t[e]),i=pt(t[e+1]);return r.subarray(n,i)},B_=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},Vu=({values:r},t)=>I_(r,t),Wu=({values:r},t)=>pt(r[t]),sn=({stride:r,values:t},e)=>t[r*e],D_=({stride:r,values:t},e)=>to(t[r*e]),zu=({values:r},t)=>r[t],A_=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),ju=({values:r,valueOffsets:t},e)=>Hu(r,t,e),$u=({values:r,valueOffsets:t},e)=>{let n=Hu(r,t,e);return n!==null?Si(n):null},T_=({values:r},t)=>r[t],x_=({type:r,values:t},e)=>r.precision!==Dt.HALF?t[e]:to(t[e]),E_=(r,t)=>r.type.unit===Wt.DAY?Vu(r,t):Wu(r,t),Gu=({values:r},t)=>1e3*pt(r[t]),Ku=({values:r},t)=>pt(r[t]),qu=({values:r},t)=>Za(r[t],BigInt(1e3)),Yu=({values:r},t)=>Za(r[t],BigInt(1e6)),O_=(r,t)=>{switch(r.type.unit){case C.SECOND:return Gu(r,t);case C.MILLISECOND:return Ku(r,t);case C.MICROSECOND:return qu(r,t);case C.NANOSECOND:return Yu(r,t)}},Ju=({values:r},t)=>r[t],Xu=({values:r},t)=>r[t],Zu=({values:r},t)=>r[t],Qu=({values:r},t)=>r[t],U_=(r,t)=>{switch(r.type.unit){case C.SECOND:return Ju(r,t);case C.MILLISECOND:return Xu(r,t);case C.MICROSECOND:return Zu(r,t);case C.NANOSECOND:return Qu(r,t)}},M_=({values:r,stride:t},e)=>Ci.decimal(r.subarray(t*e,t*(e+1))),R_=(r,t)=>{let{valueOffsets:e,stride:n,children:i}=r,{[t*n]:s,[t*n+1]:a}=e,u=i[0].slice(s,a-s);return new dt([u])},L_=(r,t)=>{let{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:s}=e,a=n[0];return new ar(a.slice(i,s-i))},N_=(r,t)=>new nn(r,t),k_=(r,t)=>r.type.mode===xt.Dense?td(r,t):ed(r,t),td=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return jt.visit(n,r.valueOffsets[t])},ed=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return jt.visit(n,t)},C_=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},P_=(r,t)=>r.type.unit===qt.DAY_TIME?rd(r,t):nd(r,t),rd=({values:r},t)=>r.subarray(2*t,2*(t+1)),nd=({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},id=({values:r},t)=>r[t],sd=({values:r},t)=>r[t],od=({values:r},t)=>r[t],ad=({values:r},t)=>r[t],H_=(r,t)=>{switch(r.type.unit){case C.SECOND:return id(r,t);case C.MILLISECOND:return sd(r,t);case C.MICROSECOND:return od(r,t);case C.NANOSECOND:return ad(r,t)}},V_=(r,t)=>{let{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new dt([s])};j.prototype.visitNull=X(F_);j.prototype.visitBool=X(B_);j.prototype.visitInt=X(T_);j.prototype.visitInt8=X(sn);j.prototype.visitInt16=X(sn);j.prototype.visitInt32=X(sn);j.prototype.visitInt64=X(zu);j.prototype.visitUint8=X(sn);j.prototype.visitUint16=X(sn);j.prototype.visitUint32=X(sn);j.prototype.visitUint64=X(zu);j.prototype.visitFloat=X(x_);j.prototype.visitFloat16=X(D_);j.prototype.visitFloat32=X(sn);j.prototype.visitFloat64=X(sn);j.prototype.visitUtf8=X($u);j.prototype.visitLargeUtf8=X($u);j.prototype.visitBinary=X(ju);j.prototype.visitLargeBinary=X(ju);j.prototype.visitFixedSizeBinary=X(A_);j.prototype.visitDate=X(E_);j.prototype.visitDateDay=X(Vu);j.prototype.visitDateMillisecond=X(Wu);j.prototype.visitTimestamp=X(O_);j.prototype.visitTimestampSecond=X(Gu);j.prototype.visitTimestampMillisecond=X(Ku);j.prototype.visitTimestampMicrosecond=X(qu);j.prototype.visitTimestampNanosecond=X(Yu);j.prototype.visitTime=X(U_);j.prototype.visitTimeSecond=X(Ju);j.prototype.visitTimeMillisecond=X(Xu);j.prototype.visitTimeMicrosecond=X(Zu);j.prototype.visitTimeNanosecond=X(Qu);j.prototype.visitDecimal=X(M_);j.prototype.visitList=X(R_);j.prototype.visitStruct=X(N_);j.prototype.visitUnion=X(k_);j.prototype.visitDenseUnion=X(td);j.prototype.visitSparseUnion=X(ed);j.prototype.visitDictionary=X(C_);j.prototype.visitInterval=X(P_);j.prototype.visitIntervalDayTime=X(rd);j.prototype.visitIntervalYearMonth=X(nd);j.prototype.visitDuration=X(H_);j.prototype.visitDurationSecond=X(id);j.prototype.visitDurationMillisecond=X(sd);j.prototype.visitDurationMicrosecond=X(od);j.prototype.visitDurationNanosecond=X(ad);j.prototype.visitFixedSizeList=X(V_);j.prototype.visitMap=X(L_);var jt=new j;var on=Symbol.for("keys"),Jn=Symbol.for("vals"),Yn=Symbol.for("kKeysAsStrings"),hl=Symbol.for("_kKeysAsStrings"),ar=class{constructor(t){return this[on]=new dt([t.children[0]]).memoize(),this[Jn]=t.children[1],new Proxy(this,new ml)}get[Yn](){return this[hl]||(this[hl]=Array.from(this[on].toArray(),String))}[Symbol.iterator](){return new pl(this[on],this[Jn])}get size(){return this[on].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[on],e=this[Jn],n={};for(let i=-1,s=t.length;++i<s;)n[t.get(i)]=jt.visit(e,i);return n}toString(){return"{".concat([...this].map(([t,e])=>"".concat(Ce(t),": ").concat(Ce(e))).join(", "),"}")}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},pl=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),jt.visit(this.vals,t)]})}},ml=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Yn]}has(t,e){return t[Yn].includes(e)}getOwnPropertyDescriptor(t,e){if(t[Yn].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[Yn].indexOf(e);if(n!==-1){let i=jt.visit(Reflect.get(t,Jn),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[Yn].indexOf(e);return i!==-1?(Zt.visit(Reflect.get(t,Jn),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(ar.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[on]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Jn]:{writable:!0,enumerable:!1,configurable:!1,value:null},[hl]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var ld;function Hi(r,t,e,n){let{length:i=0}=r,s=typeof t!="number"?0:t,a=typeof e!="number"?i:e;return s<0&&(s=(s%i+i)%i),a<0&&(a=(a%i+i)%i),a<s&&(ld=s,s=a,a=ld),a>i&&(a=i),n?n(r,s,a):[s,a]}var bn=(r,t)=>r<0?t+r:r,cd=r=>r!==r;function an(r){if(typeof r!=="object"||r===null)return cd(r)?cd: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?Ka(r,e):!1:r instanceof Map?z_(r):Array.isArray(r)?W_(r):r instanceof dt?j_(r):$_(r,!0)}function W_(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=an(r[e]);return bo(t)}function z_(r){let t=-1,e=[];for(let n of r.values())e[++t]=an(n);return bo(e)}function j_(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=an(r.get(e));return bo(t)}function $_(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]=an(r[e[i]]);return bo(n,e)}function bo(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return G_(r,e);case Map:return ud(r,e,e.keys());case ar:case nn:case Object:case void 0:return ud(r,e,t||Object.keys(e))}return e instanceof dt?K_(r,e):!1}}function G_(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 K_(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 ud(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](),a=0,l=r.length,u=s.next(),f=n.next(),h=i.next();for(;a<l&&!f.done&&!h.done&&!u.done&&!(f.value!==h.value||!r[a](u.value));++a,f=n.next(),h=i.next(),u=s.next());return a===l&&f.done&&h.done&&u.done?!0:(n.return&&n.return(),i.return&&i.return(),s.return&&s.return(),!1)}var yl={};qr(yl,{BitIterator:()=>gn,getBit:()=>dd,getBool:()=>wo,packBools:()=>vn,popcnt_array:()=>fd,popcnt_bit_range:()=>Vi,popcnt_uint32:()=>go,setBool:()=>q_,truncateBitmap:()=>wn});function wo(r,t,e,n){return(e&1<<n)!==0}function dd(r,t,e,n){return(e&1<<n)>>n}function q_(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function wn(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):vn(new gn(e,r,t,null,wo)).subarray(0,n)),i}return e}function vn(r){let t=[],e=0,n=0,i=0;for(let a of r)a&&(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 gn=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 Vi(r,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(let a of new gn(r,t,e-t,r,dd))s+=a;return s}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return Vi(r,t,i)+Vi(r,n,e)+fd(r,i>>3,n-i>>3)}function fd(r,t,e){let n=0,i=Math.trunc(t),s=new DataView(r.buffer,r.byteOffset,r.byteLength),a=e===void 0?r.byteLength:i+e;for(;a-i>=4;)n+=go(s.getUint32(i)),i+=4;for(;a-i>=2;)n+=go(s.getUint16(i)),i+=2;for(;a-i>=1;)n+=go(s.getUint8(i)),i+=1;return n}function go(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 Y_=-1,gt=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 nullable(){if(this._nullCount!==0){let{type:t}=this;return L.isSparseUnion(t)?this.children.some(e=>e.nullable):L.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}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((a,l)=>a+l.byteLength,t)}get nullCount(){if(L.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,e;return t<=Y_&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-Vi(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,i,s,a=[],l){this.type=t,this.children=a,this.dictionary=l,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 u;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=ye(t),s&&((u=s[0])&&(this.valueOffsets=u),(u=s[1])&&(this.values=u),(u=s[2])&&(this.nullBitmap=u),(u=s[3])&&(this.typeIds=u)))}getValid(t){let{type:e}=this;if(L.isUnion(e)){let n=e,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],s=n.mode===xt.Dense?this.valueOffsets[t]:t;return i.getValid(s)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,e){let n,{type:i}=this;if(L.isUnion(i)){let s=i,a=this.children[s.typeIdToChildIndex[this.typeIds[t]]],l=s.mode===xt.Dense?this.valueOffsets[t]:t;n=a.getValid(l),a.setValid(l,e)}else{let{nullBitmap:s}=this,{offset:a,length:l}=this,u=a+t,f=1<<u%8,h=u>>3;(!s||s.byteLength<=h)&&(s=new Uint8Array((a+l+63&-64)>>3).fill(255),this.nullCount>0?(s.set(wn(a,l,this.nullBitmap),0),Object.assign(this,{nullBitmap:s})):Object.assign(this,{nullBitmap:s,_nullCount:0}));let w=s[h];n=(w&f)!==0,s[h]=e?w|f:w&~f}return n!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,n=this.length,i=this._nullCount,s=this,a=this.children){return new r(t,e,n,i,s,a,this.dictionary)}slice(t,e){let{stride:n,typeId:i,children:s}=this,a=+(this._nullCount===0)-1,l=i===16?n:1,u=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,a,u,s.length===0||this.valueOffsets?s:this._sliceChildren(s,l*t,l*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(wn(this.offset,e,this.nullBitmap),0);let s=this.buffers;return s[Se.VALIDITY]=i,this.clone(this.type,0,t,n+(t-e),s)}_sliceBuffers(t,e,n,i){let s,{buffers:a}=this;return(s=a[Se.TYPE])&&(a[Se.TYPE]=s.subarray(t,t+e)),(s=a[Se.OFFSET])&&(a[Se.OFFSET]=s.subarray(t,t+e+1))||(s=a[Se.DATA])&&(a[Se.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),a}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};gt.prototype.children=Object.freeze([]);var bl=class r extends z{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:n=0,["length"]:i=0}=t;return new gt(e,n,i,i)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=J(t.nullBitmap),s=ot(e.ArrayType,t.data),{["length"]:a=s.length>>3,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new gt(e,n,a,l,[void 0,s,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=J(t.nullBitmap),s=ot(e.ArrayType,t.data),{["length"]:a=s.length,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new gt(e,n,a,l,[void 0,s,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=J(t.nullBitmap),s=ot(e.ArrayType,t.data),{["length"]:a=s.length,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new gt(e,n,a,l,[void 0,s,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=J(t.data),s=J(t.nullBitmap),a=_n(t.valueOffsets),{["length"]:l=a.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new gt(e,n,l,u,[a,i,s])}visitLargeUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=J(t.data),s=J(t.nullBitmap),a=ks(t.valueOffsets),{["length"]:l=a.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new gt(e,n,l,u,[a,i,s])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=J(t.data),s=J(t.nullBitmap),a=_n(t.valueOffsets),{["length"]:l=a.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new gt(e,n,l,u,[a,i,s])}visitLargeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=J(t.data),s=J(t.nullBitmap),a=ks(t.valueOffsets),{["length"]:l=a.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new gt(e,n,l,u,[a,i,s])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=J(t.nullBitmap),s=ot(e.ArrayType,t.data),{["length"]:a=s.length/ye(e),["nullCount"]:l=t.nullBitmap?-1:0}=t;return new gt(e,n,a,l,[void 0,s,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=J(t.nullBitmap),s=ot(e.ArrayType,t.data),{["length"]:a=s.length/ye(e),["nullCount"]:l=t.nullBitmap?-1:0}=t;return new gt(e,n,a,l,[void 0,s,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=J(t.nullBitmap),s=ot(e.ArrayType,t.data),{["length"]:a=s.length/ye(e),["nullCount"]:l=t.nullBitmap?-1:0}=t;return new gt(e,n,a,l,[void 0,s,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=J(t.nullBitmap),s=ot(e.ArrayType,t.data),{["length"]:a=s.length/ye(e),["nullCount"]:l=t.nullBitmap?-1:0}=t;return new gt(e,n,a,l,[void 0,s,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=J(t.nullBitmap),s=ot(e.ArrayType,t.data),{["length"]:a=s.length/ye(e),["nullCount"]:l=t.nullBitmap?-1:0}=t;return new gt(e,n,a,l,[void 0,s,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,s=J(t.nullBitmap),a=_n(t.valueOffsets),{["length"]:l=a.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new gt(e,n,l,u,[a,void 0,s],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=J(t.nullBitmap),{length:a=i.reduce((u,{length:f})=>Math.max(u,f),0),nullCount:l=t.nullBitmap?-1:0}=t;return new gt(e,n,a,l,[void 0,void 0,s],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=ot(e.ArrayType,t.typeIds),{["length"]:a=s.length,["nullCount"]:l=-1}=t;if(L.isSparseUnion(e))return new gt(e,n,a,l,[void 0,void 0,void 0,s],i);let u=_n(t.valueOffsets);return new gt(e,n,a,l,[u,void 0,void 0,s],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=J(t.nullBitmap),s=ot(e.indices.ArrayType,t.data),{["dictionary"]:a=new dt([new r().visit({type:e.dictionary})])}=t,{["length"]:l=s.length,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new gt(e,n,l,u,[void 0,s,i],[],a)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=J(t.nullBitmap),s=ot(e.ArrayType,t.data),{["length"]:a=s.length/ye(e),["nullCount"]:l=t.nullBitmap?-1:0}=t;return new gt(e,n,a,l,[void 0,s,i])}visitDuration(t){let{["type"]:e,["offset"]:n=0}=t,i=J(t.nullBitmap),s=ot(e.ArrayType,t.data),{["length"]:a=s.length,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new gt(e,n,a,l,[void 0,s,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new r().visit({type:e.valueType})}=t,s=J(t.nullBitmap),{["length"]:a=i.length/ye(e),["nullCount"]:l=t.nullBitmap?-1:0}=t;return new gt(e,n,a,l,[void 0,void 0,s],[i])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new r().visit({type:e.childType})}=t,s=J(t.nullBitmap),a=_n(t.valueOffsets),{["length"]:l=a.length-1,["nullCount"]:u=t.nullBitmap?-1:0}=t;return new gt(e,n,l,u,[a,void 0,s],[i])}},J_=new bl;function et(r){return J_.visit(r)}var Wi=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 hd(r){return r.some(t=>t.nullable)}function vo(r){return r.reduce((t,e)=>t+e.nullCount,0)}function So(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function Io(r,t,e,n){let i=[];for(let s=-1,a=r.length;++s<a;){let l=r[s],u=t[s],{length:f}=l;if(u>=n)break;if(e>=u+f)continue;if(u>=e&&u+f<=n){i.push(l);continue}let h=Math.max(0,e-u),w=Math.min(n-u,f);i.push(l.slice(h,w-h))}return i.length===0&&i.push(r[0].slice(0,0)),i}function gl(r,t,e,n){let i=0,s=0,a=t.length-1;do{if(i>=a-1)return e<t[a]?n(r,i,e-t[i]):null;s=i+Math.trunc((a-i)*.5),e<t[s]?a=s:i=s}while(i<a)}function zi(r,t){return r.getValid(t)}function Xn(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return gl(n,this._offsets,e,t)}}function Fo(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 a=gl(s,this._offsets,n,e);return t=void 0,a}}function Bo(r){let t;function e(n,i,s){let a=s,l=0,u=0;for(let f=i-1,h=n.length;++f<h;){let w=n[f];if(~(l=r(w,t,a)))return u+l;a=0,u+=w.length}return-1}return function(n,i){t=n;let s=this.data,a=typeof i!="number"?e(s,0,0):gl(s,this._offsets,i,e);return t=void 0,a}}var $=class extends z{};function X_(r,t){return t===null&&r.length>0?0:-1}function Z_(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new gn(e,r.offset+(t||0),r.length,e,wo)){if(!i)return n;++n}return-1}function rt(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case p.Union:break;case p.Dictionary:break;default:return Z_(r,e)}let n=jt.getVisitFn(r),i=an(t);for(let s=(e||0)-1,a=r.length;++s<a;)if(i(n(r,s)))return s;return-1}function pd(r,t,e){let n=jt.getVisitFn(r),i=an(t);for(let s=(e||0)-1,a=r.length;++s<a;)if(i(n(r,s)))return s;return-1}$.prototype.visitNull=X_;$.prototype.visitBool=rt;$.prototype.visitInt=rt;$.prototype.visitInt8=rt;$.prototype.visitInt16=rt;$.prototype.visitInt32=rt;$.prototype.visitInt64=rt;$.prototype.visitUint8=rt;$.prototype.visitUint16=rt;$.prototype.visitUint32=rt;$.prototype.visitUint64=rt;$.prototype.visitFloat=rt;$.prototype.visitFloat16=rt;$.prototype.visitFloat32=rt;$.prototype.visitFloat64=rt;$.prototype.visitUtf8=rt;$.prototype.visitLargeUtf8=rt;$.prototype.visitBinary=rt;$.prototype.visitLargeBinary=rt;$.prototype.visitFixedSizeBinary=rt;$.prototype.visitDate=rt;$.prototype.visitDateDay=rt;$.prototype.visitDateMillisecond=rt;$.prototype.visitTimestamp=rt;$.prototype.visitTimestampSecond=rt;$.prototype.visitTimestampMillisecond=rt;$.prototype.visitTimestampMicrosecond=rt;$.prototype.visitTimestampNanosecond=rt;$.prototype.visitTime=rt;$.prototype.visitTimeSecond=rt;$.prototype.visitTimeMillisecond=rt;$.prototype.visitTimeMicrosecond=rt;$.prototype.visitTimeNanosecond=rt;$.prototype.visitDecimal=rt;$.prototype.visitList=rt;$.prototype.visitStruct=rt;$.prototype.visitUnion=rt;$.prototype.visitDenseUnion=pd;$.prototype.visitSparseUnion=pd;$.prototype.visitDictionary=rt;$.prototype.visitInterval=rt;$.prototype.visitIntervalDayTime=rt;$.prototype.visitIntervalYearMonth=rt;$.prototype.visitDuration=rt;$.prototype.visitDurationSecond=rt;$.prototype.visitDurationMillisecond=rt;$.prototype.visitDurationMicrosecond=rt;$.prototype.visitDurationNanosecond=rt;$.prototype.visitFixedSizeList=rt;$.prototype.visitMap=rt;var Sn=new $;var G=class extends z{};function Z(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(L.isInt(t)&&t.bitWidth!==64||L.isTime(t)&&t.bitWidth!==64||L.isFloat(t)&&t.precision!==Dt.HALF))return new Wi(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new Wi(r.data.length,n=>{let s=r.data[n].length,a=r.slice(e,e+s);return e+=s,new wl(a)})}var wl=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}};G.prototype.visitNull=Z;G.prototype.visitBool=Z;G.prototype.visitInt=Z;G.prototype.visitInt8=Z;G.prototype.visitInt16=Z;G.prototype.visitInt32=Z;G.prototype.visitInt64=Z;G.prototype.visitUint8=Z;G.prototype.visitUint16=Z;G.prototype.visitUint32=Z;G.prototype.visitUint64=Z;G.prototype.visitFloat=Z;G.prototype.visitFloat16=Z;G.prototype.visitFloat32=Z;G.prototype.visitFloat64=Z;G.prototype.visitUtf8=Z;G.prototype.visitLargeUtf8=Z;G.prototype.visitBinary=Z;G.prototype.visitLargeBinary=Z;G.prototype.visitFixedSizeBinary=Z;G.prototype.visitDate=Z;G.prototype.visitDateDay=Z;G.prototype.visitDateMillisecond=Z;G.prototype.visitTimestamp=Z;G.prototype.visitTimestampSecond=Z;G.prototype.visitTimestampMillisecond=Z;G.prototype.visitTimestampMicrosecond=Z;G.prototype.visitTimestampNanosecond=Z;G.prototype.visitTime=Z;G.prototype.visitTimeSecond=Z;G.prototype.visitTimeMillisecond=Z;G.prototype.visitTimeMicrosecond=Z;G.prototype.visitTimeNanosecond=Z;G.prototype.visitDecimal=Z;G.prototype.visitList=Z;G.prototype.visitStruct=Z;G.prototype.visitUnion=Z;G.prototype.visitDenseUnion=Z;G.prototype.visitSparseUnion=Z;G.prototype.visitDictionary=Z;G.prototype.visitInterval=Z;G.prototype.visitIntervalDayTime=Z;G.prototype.visitIntervalYearMonth=Z;G.prototype.visitDuration=Z;G.prototype.visitDurationSecond=Z;G.prototype.visitDurationMillisecond=Z;G.prototype.visitDurationMicrosecond=Z;G.prototype.visitDurationNanosecond=Z;G.prototype.visitFixedSizeList=Z;G.prototype.visitMap=Z;var Zn=new G;var md,_d={},yd={},dt=class r{constructor(t){var e,n,i;let s=t[0]instanceof r?t.flatMap(l=>l.data):t;if(s.length===0||s.some(l=>!(l instanceof gt)))throw new TypeError("Vector constructor expects an Array of Data instances.");let a=(e=s[0])===null||e===void 0?void 0:e.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{let{get:l,set:u,indexOf:f}=_d[a.typeId],h=s[0];this.isValid=w=>zi(h,w),this.get=w=>l(h,w),this.set=(w,A)=>u(h,w,A),this.indexOf=w=>f(h,w),this._offsets=[0,h.length];break}default:Object.setPrototypeOf(this,yd[a.typeId]),this._offsets=So(s);break}this.data=s,this.type=a,this.stride=ye(a),this.numChildren=(i=(n=a.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.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return hd(this.data)}get nullCount(){return vo(this.data)}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}at(t){return this.get(bn(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return Zn.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(Hi(this,t,e,({data:n,_offsets:i},s,a)=>Io(n,i,s,a)))}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((a,{values:l,length:u})=>(a.array.set(l.subarray(0,u*i),a.offset),a.offset+=u*i,a),{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 L.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(L.isDictionary(this.type)){let t=new Do(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new r(e)}return new Do(this)}unmemoize(){if(L.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}};md=Symbol.toStringTag;dt[md]=(r=>{r.type=L.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,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=jt.getVisitFnByTypeId(e),i=Zt.getVisitFnByTypeId(e),s=Sn.getVisitFnByTypeId(e);_d[e]={get:n,set:i,indexOf:s},yd[e]=Object.create(r,{isValid:{value:Xn(zi)},get:{value:Xn(jt.getVisitFnByTypeId(e))},set:{value:Fo(Zt.getVisitFnByTypeId(e))},indexOf:{value:Bo(Sn.getVisitFnByTypeId(e))}})}return"Vector"})(dt.prototype);var Do=class r extends dt{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(a){let l=s[a];if(l!==void 0)return l;let u=e.call(this,a);return s[a]=u,u}}),Object.defineProperty(this,"set",{value(a,l){n.call(this,a,l),s[a]=l}}),Object.defineProperty(this,"slice",{value:(a,l)=>new r(i.call(this,a,l))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new dt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function bd(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(Q_(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 Q_(r){return typeof r!="bigint"?Ce(r):"".concat(Ce(r),"n")}function vl(r,t){let e=Math.ceil(r)*t-1;return(e-e%64+64||64)/t}function gd(r,t=0){return r.length>=t?r.subarray(0,t):Fi(new r.constructor(t),r,0)}var $e=class{constructor(t,e=0,n=1){this.length=Math.ceil(e/n),this.buffer=new t(this.length),this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}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?vl(n*1,this.BYTES_PER_ELEMENT):vl(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=vl(t*this.stride,this.BYTES_PER_ELEMENT);let e=gd(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=gd(this.buffer,t)}},Ur=class extends $e{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}},Qn=class extends Ur{constructor(){super(Uint8Array,0,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,a=n[i]>>s&1;return e?a===0&&(n[i]|=1<<s,++this.numValid):a===1&&(n[i]&=~(1<<s),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},ti=class extends Ur{constructor(t){super(t.OffsetArrayType,1,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++&&n>=0&&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,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var Nt=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=ye(t),this._nulls=new Qn,e&&e.length>0&&(this._isValid=bd(e))}toVector(){return new dt([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:a}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),a.reduce((l,u)=>l+u.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:a,nullCount:l,_typeIds:u,_offsets:f,_values:h,_nulls:w}=this;(e=u==null?void 0:u.flush(a))?i=f==null?void 0:f.flush(a):(i=f==null?void 0:f.flush(a))?t=h==null?void 0:h.flush(f.last()):t=h==null?void 0:h.flush(a),l>0&&(n=w==null?void 0:w.flush(a));let A=this.children.map(E=>E.flush());return this.clear(),et({type:s,length:a,nullCount:l,children:A,child:A[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}};Nt.prototype.length=1;Nt.prototype.stride=1;Nt.prototype.children=null;Nt.prototype.finished=!1;Nt.prototype.nullValues=null;Nt.prototype._isValid=()=>!0;var $t=class extends Nt{constructor(t){super(t),this._values=new Ur(this.ArrayType,0,this.stride)}setValue(t,e){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}},le=class extends Nt{constructor(t){super(t),this._pendingLength=0,this._offsets=new ti(t.type)}setValue(t,e){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=e instanceof ar?e[on].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 In=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 be=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):vt.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new ae).__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 In).__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 In).__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 Yt).__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,vt.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 It=class r{constructor(t=[],e,n,i=vt.V5){this.fields=t||[],this.metadata=e||new Map,n||(n=Sl(this.fields)),this.dictionaries=n,this.metadataVersion=i}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(l=>{let u=n.findIndex(f=>f.name===l.name);return~u?(n[u]=l.clone({metadata:Ao(Ao(new Map,n[u].metadata),l.metadata)}))&&!1:!0}),a=Sl(s,new Map);return new r([...n,...s],i,new Map([...this.dictionaries,...a]))}};It.prototype.fields=null;It.prototype.metadata=null;It.prototype.dictionaries=null;var lt=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)}};lt.prototype.type=null;lt.prototype.name=null;lt.prototype.nullable=null;lt.prototype.metadata=null;function Ao(r,t){return new Map([...r||new Map,...t||new Map])}function Sl(r,t=new Map){for(let e=-1,n=r.length;++e<n;){let s=r[e].type;if(L.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&&Sl(s.children,t)}return t}var ty=yn,ey=pe,Mr=class{static decode(t){t=new ey(J(t));let e=be.getRootAsFooter(t),n=It.decode(e.schema(),new Map,e.version());return new Il(n,e)}static encode(t){let e=new ty,n=It.encode(e,t.schema);be.startRecordBatchesVector(e,t.numRecordBatches);for(let a of[...t.recordBatches()].slice().reverse())Rr.encode(e,a);let i=e.endVector();be.startDictionariesVector(e,t.numDictionaries);for(let a of[...t.dictionaryBatches()].slice().reverse())Rr.encode(e,a);let s=e.endVector();return be.startFooter(e),be.addSchema(e,n),be.addVersion(e,vt.V5),be.addRecordBatches(e,i),be.addDictionaries(e,s),be.finishFooterBuffer(e,be.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=vt.V5,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 Il=class extends Mr{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,e){super(t,e.version()),this._footer=e}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let e=this._footer.recordBatches(t);if(e)return Rr.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return Rr.decode(e)}return null}},Rr=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 In.createBlock(t,i,n,s)}constructor(t,e,n){this.metaDataLength=t,this.offset=pt(n),this.bodyLength=pt(e)}};var Lt=Object.freeze({done:!0,value:void 0}),ji=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Fn=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())}},To=class extends Fn{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return R(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(Lt);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return Xt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Xt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return R(this,void 0,void 0,function*(){return yield this.abort(t),Lt})}return(t){return R(this,void 0,void 0,function*(){return yield this.close(),Lt})}read(t){return R(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return R(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(Lt)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var lr=class extends To{write(t){if((t=J(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?he(this._values)[0]:R(this,void 0,void 0,function*(){var e,n,i,s;let a=[],l=0;try{for(var u=!0,f=Oe(this),h;h=yield f.next(),e=h.done,!e;u=!0){s=h.value,u=!1;let w=s;a.push(w),l+=w.byteLength}}catch(w){n={error:w}}finally{try{!u&&!e&&(i=f.return)&&(yield i.call(f))}finally{if(n)throw n.error}}return he(a,l)[0]})}},cr=class{constructor(t){t&&(this.source=new Fl(Xt.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)}},Fe=class r{constructor(t){t instanceof r?this.source=t.source:t instanceof lr?this.source=new Lr(Xt.fromAsyncIterable(t)):Ns(t)?this.source=new Lr(Xt.fromNodeStream(t)):Ii(t)?this.source=new Lr(Xt.fromDOMStream(t)):Rs(t)?this.source=new Lr(Xt.fromDOMStream(t.body)):Me(t)?this.source=new Lr(Xt.fromIterable(t)):Ue(t)?this.source=new Lr(Xt.fromAsyncIterable(t)):we(t)&&(this.source=new Lr(Xt.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)}},Fl=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)||Lt)}return(t){return Object.create(this.source.return&&this.source.return(t)||Lt)}},Lr=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return R(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return R(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return R(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return R(this,arguments,void 0,function*(e,n="read"){return yield this.source.next({cmd:n,size:e})})}throw(t){return R(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||Lt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return R(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||Lt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var $i=class extends cr{constructor(t,e){super(),this.position=0,this.buffer=J(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}}},ln=class extends Fe{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=R(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return R(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 R(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 R(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,a=0,l=0,u=Math.min(n,s+Math.min(n-s,t)),f=new Uint8Array(Math.max(0,(this.position=u)-s));for(;(s+=l)<u&&(a+=l)<f.byteLength;)({bytesRead:l}=yield e.read(f,a,f.byteLength-a,s));return f}return null})}readAt(t,e){return R(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),a=new Uint8Array(s-t);return(yield n.read(a,0,e,t)).buffer}return new Uint8Array(e)})}close(){return R(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return R(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return R(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var Dl={};qr(Dl,{BaseInt64:()=>Gi,Int128:()=>Ki,Int64:()=>Nr,Uint64:()=>Ht});function ei(r){return r<0&&(r=4294967295+r+1),"0x".concat(r.toString(16))}var ri=8,Bl=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Gi=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let e=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=e[3]*n[3];this.buffer[0]=i&65535;let s=i>>>16;return i=e[2]*n[3],s+=i,i=e[3]*n[2]>>>0,s+=i,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0<i?65536:0,this.buffer[1]+=s>>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}_plus(t){let e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return"".concat(ei(this.buffer[1])," ").concat(ei(this.buffer[0]))}},Ht=class r extends Gi{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return r.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return r.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.length,i=new r(e);for(let s=0;s<n;){let a=ri<n-s?ri:n-s,l=new r(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),u=new r(new Uint32Array([Bl[a],0]));i.times(u),i.plus(l),s+=a}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)}},Nr=class r extends Gi{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let e=this.buffer[1]<<0,n=t.buffer[1]<<0;return e<n||e===n&&this.buffer[0]<t.buffer[0]}static from(t,e=new Uint32Array(2)){return r.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return r.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,s=new r(e);for(let a=n?1:0;a<i;){let l=ri<i-a?ri:i-a,u=new r(new Uint32Array([Number.parseInt(t.slice(a,a+l),10),0])),f=new r(new Uint32Array([Bl[l],0]));s.times(f),s.plus(u),a+=l}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)}},Ki=class r{constructor(t){this.buffer=t}high(){return new Nr(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new Nr(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 Ht(new Uint32Array([this.buffer[3],0])),n=new Ht(new Uint32Array([this.buffer[2],0])),i=new Ht(new Uint32Array([this.buffer[1],0])),s=new Ht(new Uint32Array([this.buffer[0],0])),a=new Ht(new Uint32Array([t.buffer[3],0])),l=new Ht(new Uint32Array([t.buffer[2],0])),u=new Ht(new Uint32Array([t.buffer[1],0])),f=new Ht(new Uint32Array([t.buffer[0],0])),h=Ht.multiply(s,f);this.buffer[0]=h.low();let w=new Ht(new Uint32Array([h.high(),0]));return h=Ht.multiply(i,f),w.plus(h),h=Ht.multiply(s,u),w.plus(h),this.buffer[1]=w.low(),this.buffer[3]=w.lessThan(h)?1:0,this.buffer[2]=w.high(),new Ht(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Ht.multiply(n,f)).plus(Ht.multiply(i,u)).plus(Ht.multiply(s,l)),this.buffer[3]+=Ht.multiply(e,f).plus(Ht.multiply(n,u)).plus(Ht.multiply(i,l)).plus(Ht.multiply(s,a)).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(ei(this.buffer[3])," ").concat(ei(this.buffer[2])," ").concat(ei(this.buffer[1])," ").concat(ei(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 a=n?1:0;a<i;){let l=ri<i-a?ri:i-a,u=new r(new Uint32Array([Number.parseInt(t.slice(a,a+l),10),0,0,0])),f=new r(new Uint32Array([Bl[l],0,0,0]));s.times(f),s.plus(u),a+=l}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 qi=class extends z{constructor(t,e,n,i,s=vt.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=i,this.metadataVersion=s}visit(t){return super.visit(t instanceof lt?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return et({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return et({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return et({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return et({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return et({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return et({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 et({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return et({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 et({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return et({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return et({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return et({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return et({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return et({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 et({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<vt.V5&&this.readNullBitmap(t,n),t.mode===xt.Sparse?this.visitSparseUnion(t,{length:e,nullCount:n}):this.visitDenseUnion(t,{length:e,nullCount:n})}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return et({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return et({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return et({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 et({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:e,nullCount:n}=this.nextFieldNode()){return et({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return et({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 et({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)}},xo=class extends qi{constructor(t,e,n,i,s){super(new Uint8Array(0),e,n,i,s),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):vn(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return ot(Uint8Array,ot(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return ot(Uint8Array,ot(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:n}=this;return L.isTimestamp(t)?ot(Uint8Array,Nr.convertArray(n[e])):(L.isInt(t)||L.isTime(t))&&t.bitWidth===64||L.isDuration(t)?ot(Uint8Array,Nr.convertArray(n[e])):L.isDate(t)&&t.unit===Wt.MILLISECOND?ot(Uint8Array,Nr.convertArray(n[e])):L.isDecimal(t)?ot(Uint8Array,Ki.convertArray(n[e])):L.isBinary(t)||L.isLargeBinary(t)||L.isFixedSizeBinary(t)?ry(n[e]):L.isBool(t)?vn(n[e]):L.isUtf8(t)||L.isLargeUtf8(t)?er(n[e].join("")):ot(Uint8Array,ot(t.ArrayType,n[e].map(i=>+i)))}};function ry(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 ni=class extends le{constructor(t){super(t),this._values=new $e(Uint8Array)}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,J(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,s=0;for(let[a,l]of t)if(l===void 0)n.set(a,0);else{let u=l.length;i.set(l,s),n.set(a,u),s+=u}}};var ii=class extends le{constructor(t){super(t),this._values=new $e(Uint8Array)}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,J(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,s=0;for(let[a,l]of t)if(l===void 0)n.set(a,BigInt(0));else{let u=l.length;i.set(l,s),n.set(a,BigInt(u)),s+=u}}};var Eo=class extends Nt{constructor(t){super(t),this._values=new Qn}setValue(t,e){this._values.set(t,+e)}};var Bn=class extends $t{};Bn.prototype._setValue=sl;var Yi=class extends Bn{};Yi.prototype._setValue=eo;var Ji=class extends Bn{};Ji.prototype._setValue=ro;var Xi=class extends $t{};Xi.prototype._setValue=ll;var Oo=class extends Nt{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new _e(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 Zi=class extends $t{};Zi.prototype._setValue=il;var Uo=class extends Nt{setValue(t,e){let[n]=this.children,i=t*this.stride;for(let s=-1,a=e.length;++s<a;)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 We(this.type.listSize,new lt(e,t.type,!0)),n}};var An=class extends $t{setValue(t,e){this._values.set(t,e)}},Mo=class extends An{setValue(t,e){super.setValue(t,Pi(e))}},Ro=class extends An{},Lo=class extends An{};var Tn=class extends $t{};Tn.prototype._setValue=cl;var Qi=class extends Tn{};Qi.prototype._setValue=fo;var ts=class extends Tn{};ts.prototype._setValue=ho;var kr=class extends $t{};kr.prototype._setValue=ul;var es=class extends kr{};es.prototype._setValue=po;var rs=class extends kr{};rs.prototype._setValue=mo;var ns=class extends kr{};ns.prototype._setValue=_o;var is=class extends kr{};is.prototype._setValue=yo;var Be=class extends $t{setValue(t,e){this._values.set(t,e)}},No=class extends Be{},ko=class extends Be{},Co=class extends Be{},Po=class extends Be{},Ho=class extends Be{},Vo=class extends Be{},Wo=class extends Be{},zo=class extends Be{};var jo=class extends le{constructor(t){super(t),this._offsets=new ti(t.type)}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 He(new lt(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 a=s,l=a.length,u=e.set(i,l).buffer[i];for(let f=-1;++f<l;)n.set(u+f,a[f])}}};var $o=class extends le{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 ze(new lt(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]:a,[i+1]:l}=e.set(i,s.size).buffer;for(let u of s.entries())if(n.set(a,u),++a>=l)break}}};var Go=class extends Nt{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var Ko=class extends Nt{setValue(t,e){let{children:n,type:i}=this;switch(Array.isArray(e)||e.constructor){case!0:return i.children.forEach((s,a)=>n[a].set(t,e[a]));case Map:return i.children.forEach((s,a)=>n[a].set(t,e.get(s.name)));default:return i.children.forEach((s,a)=>n[a].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 Rt([...this.type.children,new lt(e,t.type,!0)]),n}};var Cr=class extends $t{};Cr.prototype._setValue=ol;var ss=class extends Cr{};ss.prototype._setValue=no;var os=class extends Cr{};os.prototype._setValue=io;var as=class extends Cr{};as.prototype._setValue=so;var ls=class extends Cr{};ls.prototype._setValue=oo;var Pr=class extends $t{};Pr.prototype._setValue=al;var cs=class extends Pr{};cs.prototype._setValue=ao;var us=class extends Pr{};us.prototype._setValue=lo;var ds=class extends Pr{};ds.prototype._setValue=co;var fs=class extends Pr{};fs.prototype._setValue=uo;var si=class extends Nt{constructor(t){super(t),this._typeIds=new Ur(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.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:a}}=this,l=[...i,new lt(e,t.type)];return this.type=new Ve(s,[...a,n],l),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.")}},qo=class extends si{},Yo=class extends si{constructor(t){super(t),this._offsets=new Ur(Int32Array)}setValue(t,e,n){let i=this._typeIds.set(t,n).buffer[t],s=this.getChildAt(this.type.typeIdToChildIndex[i]),a=this._offsets.set(t,s.length).buffer[t];s==null||s.set(a,e)}};var hs=class extends le{constructor(t){super(t),this._values=new $e(Uint8Array)}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,er(e))}_flushPending(t,e){}};hs.prototype._flushPending=ni.prototype._flushPending;var ps=class extends le{constructor(t){super(t),this._values=new $e(Uint8Array)}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,er(e))}_flushPending(t,e){}};ps.prototype._flushPending=ii.prototype._flushPending;var Al=class extends z{visitNull(){return Go}visitBool(){return Eo}visitInt(){return Be}visitInt8(){return No}visitInt16(){return ko}visitInt32(){return Co}visitInt64(){return Po}visitUint8(){return Ho}visitUint16(){return Vo}visitUint32(){return Wo}visitUint64(){return zo}visitFloat(){return An}visitFloat16(){return Mo}visitFloat32(){return Ro}visitFloat64(){return Lo}visitUtf8(){return hs}visitLargeUtf8(){return ps}visitBinary(){return ni}visitLargeBinary(){return ii}visitFixedSizeBinary(){return Zi}visitDate(){return Bn}visitDateDay(){return Yi}visitDateMillisecond(){return Ji}visitTimestamp(){return Cr}visitTimestampSecond(){return ss}visitTimestampMillisecond(){return os}visitTimestampMicrosecond(){return as}visitTimestampNanosecond(){return ls}visitTime(){return Pr}visitTimeSecond(){return cs}visitTimeMillisecond(){return us}visitTimeMicrosecond(){return ds}visitTimeNanosecond(){return fs}visitDecimal(){return Xi}visitList(){return jo}visitStruct(){return Ko}visitUnion(){return si}visitDenseUnion(){return Yo}visitSparseUnion(){return qo}visitDictionary(){return Oo}visitInterval(){return Tn}visitIntervalDayTime(){return Qi}visitIntervalYearMonth(){return ts}visitDuration(){return kr}visitDurationSecond(){return es}visitDurationMillisecond(){return rs}visitDurationMicrosecond(){return ns}visitDurationNanosecond(){return is}visitFixedSizeList(){return Uo}visitMap(){return $o}},wd=new Al;var K=class extends z{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 se(r,t){return t instanceof r.constructor}function xn(r,t){return r===t||se(r,t)}function Hr(r,t){return r===t||se(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function Jo(r,t){return r===t||se(r,t)&&r.precision===t.precision}function ny(r,t){return r===t||se(r,t)&&r.byteWidth===t.byteWidth}function Tl(r,t){return r===t||se(r,t)&&r.unit===t.unit}function ms(r,t){return r===t||se(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function _s(r,t){return r===t||se(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function iy(r,t){return r===t||se(r,t)&&r.children.length===t.children.length&&ur.compareManyFields(r.children,t.children)}function sy(r,t){return r===t||se(r,t)&&r.children.length===t.children.length&&ur.compareManyFields(r.children,t.children)}function xl(r,t){return r===t||se(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&ur.compareManyFields(r.children,t.children)}function oy(r,t){return r===t||se(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&ur.visit(r.indices,t.indices)&&ur.visit(r.dictionary,t.dictionary)}function El(r,t){return r===t||se(r,t)&&r.unit===t.unit}function ys(r,t){return r===t||se(r,t)&&r.unit===t.unit}function ay(r,t){return r===t||se(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&ur.compareManyFields(r.children,t.children)}function ly(r,t){return r===t||se(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&ur.compareManyFields(r.children,t.children)}K.prototype.visitNull=xn;K.prototype.visitBool=xn;K.prototype.visitInt=Hr;K.prototype.visitInt8=Hr;K.prototype.visitInt16=Hr;K.prototype.visitInt32=Hr;K.prototype.visitInt64=Hr;K.prototype.visitUint8=Hr;K.prototype.visitUint16=Hr;K.prototype.visitUint32=Hr;K.prototype.visitUint64=Hr;K.prototype.visitFloat=Jo;K.prototype.visitFloat16=Jo;K.prototype.visitFloat32=Jo;K.prototype.visitFloat64=Jo;K.prototype.visitUtf8=xn;K.prototype.visitLargeUtf8=xn;K.prototype.visitBinary=xn;K.prototype.visitLargeBinary=xn;K.prototype.visitFixedSizeBinary=ny;K.prototype.visitDate=Tl;K.prototype.visitDateDay=Tl;K.prototype.visitDateMillisecond=Tl;K.prototype.visitTimestamp=ms;K.prototype.visitTimestampSecond=ms;K.prototype.visitTimestampMillisecond=ms;K.prototype.visitTimestampMicrosecond=ms;K.prototype.visitTimestampNanosecond=ms;K.prototype.visitTime=_s;K.prototype.visitTimeSecond=_s;K.prototype.visitTimeMillisecond=_s;K.prototype.visitTimeMicrosecond=_s;K.prototype.visitTimeNanosecond=_s;K.prototype.visitDecimal=xn;K.prototype.visitList=iy;K.prototype.visitStruct=sy;K.prototype.visitUnion=xl;K.prototype.visitDenseUnion=xl;K.prototype.visitSparseUnion=xl;K.prototype.visitDictionary=oy;K.prototype.visitInterval=El;K.prototype.visitIntervalDayTime=El;K.prototype.visitIntervalYearMonth=El;K.prototype.visitDuration=ys;K.prototype.visitDurationSecond=ys;K.prototype.visitDurationMillisecond=ys;K.prototype.visitDurationMicrosecond=ys;K.prototype.visitDurationNanosecond=ys;K.prototype.visitFixedSizeList=ay;K.prototype.visitMap=ly;var ur=new K;function En(r,t){return ur.compareSchemas(r,t)}function vd(r,t){return ur.compareFields(r,t)}function Sd(r,t){return ur.visit(r,t)}function Dn(r){let t=r.type,e=new(wd.getVisitFn(t)())(r);if(t.children&&t.children.length>0){let n=r.children||[],i={nullValues:r.nullValues},s=Array.isArray(n)?(a,l)=>n[l]||i:({name:a})=>n[a]||i;for(let[a,l]of t.children.entries()){let{type:u}=l,f=s(l,a);e.children.push(Dn(Object.assign(Object.assign({},f),{type:u})))}}return e}function Xo(r,t){return cy(r,t.map(e=>e.data.concat()))}function cy(r,t){let e=[...r.fields],n=[],i={numBatches:t.reduce((w,A)=>Math.max(w,A.length),0)},s=0,a=0,l=-1,u=t.length,f,h=[];for(;i.numBatches-- >0;){for(a=Number.POSITIVE_INFINITY,l=-1;++l<u;)h[l]=f=t[l].shift(),a=Math.min(a,f?f.length:a);Number.isFinite(a)&&(h=uy(e,a,h,t,i),a>0&&(n[s++]=et({type:new Rt(e),length:a,nullCount:0,children:h.slice()})))}return[r=r.assign(e),n.map(w=>new zt(r,w))]}function uy(r,t,e,n,i){var s;let a=(t+63&-64)>>3;for(let l=-1,u=n.length;++l<u;){let f=e[l],h=f==null?void 0:f.length;if(h>=t)h===t?e[l]=f:(e[l]=f.slice(0,t),i.numBatches=Math.max(i.numBatches,n[l].unshift(f.slice(t,h-t))));else{let w=r[l];r[l]=w.clone({nullable:!0}),e[l]=(s=f==null?void 0:f._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:et({type:w.type,length:t,nullCount:t,nullBitmap:new Uint8Array(a)})}}return e}var Id,oe=class r{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new It([]),this._offsets=[0],this;let i,s;t[0]instanceof It&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());let a=u=>{if(u){if(u instanceof zt)return[u];if(u instanceof r)return u.batches;if(u instanceof gt){if(u.type instanceof Rt)return[new zt(new It(u.type.children),u)]}else{if(Array.isArray(u))return u.flatMap(f=>a(f));if(typeof u[Symbol.iterator]=="function")return[...u].flatMap(f=>a(f));if(typeof u=="object"){let f=Object.keys(u),h=f.map(E=>new dt([u[E]])),w=i!=null?i:new It(f.map((E,at)=>new lt(String(E),h[at].type,h[at].nullable))),[,A]=Xo(w,h);return A.length===0?[new zt(u)]:A}}}return[]},l=t.flatMap(u=>a(u));if(i=(n=i!=null?i:(e=l[0])===null||e===void 0?void 0:e.schema)!==null&&n!==void 0?n:new It([]),!(i instanceof It))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let u of l){if(!(u instanceof zt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!En(i,u.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=l,this._offsets=s!=null?s:So(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=vo(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(bn(t,this.numRows))}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?Zn.visit(new dt(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 zt(e,i)))}slice(t,e){let n=this.schema;[t,e]=Hi({length:this.numRows},t,e);let i=Io(this.data,this._offsets,t,e);return new r(n,i.map(s=>new zt(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=et({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new dt(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 dt([et({type:new ie,length:this.numRows})]));let s=n.fields.slice(),a=s[t].clone({type:e.type}),l=this.schema.fields.map((u,f)=>this.getChildAt(f));[s[t],l[t]]=[a,e],[n,i]=Xo(n,l)}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((l,u,f)=>{let[h,w]=l,A=e.findIndex(E=>E.name===u.name);return~A?w[A]=f:h.push(f),l},[[],[]]),s=this.schema.assign(t.schema),a=[...e.map((l,u)=>[u,i[u]]).map(([l,u])=>u===void 0?this.getChildAt(l):t.getChildAt(u)),...n.map(l=>t.getChildAt(l))].filter(Boolean);return new r(...Xo(s,a))}};Id=Symbol.toStringTag;oe[Id]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=Xn(zi),r.get=Xn(jt.getVisitFn(p.Struct)),r.set=Fo(Zt.getVisitFn(p.Struct)),r.indexOf=Bo(Sn.getVisitFn(p.Struct)),"Table"))(oe.prototype);var Bd,zt=class r{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof It))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=et({nullCount:0,type:new Rt(this.schema.fields),children:this.schema.fields.map(e=>et({type:e.type,nullCount:0}))})]=t,!(this.data instanceof gt))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=Fd(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:n,children:i,length:s}=Object.keys(e).reduce((u,f,h)=>(u.children[h]=e[f],u.length=Math.max(u.length,e[f].length),u.fields[h]=lt.new({name:f,type:e[f].type,nullable:!0}),u),{length:0,fields:new Array,children:new Array}),a=new It(n),l=et({type:new Rt(n),length:s,children:i,nullCount:0});[this.schema,this.data]=Fd(a,l.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=Dd(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 jt.visit(this.data,t)}at(t){return this.get(bn(t,this.numRows))}set(t,e){return Zt.visit(this.data,t,e)}indexOf(t,e){return Sn.visit(this.data,t,e)}[Symbol.iterator](){return Zn.visit(new dt([this.data]))}toArray(){return[...this]}concat(...t){return new oe(this.schema,[this,...t])}slice(t,e){let[n]=new dt([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 dt([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 dt([et({type:new ie,length:this.numRows})]));let s=n.fields.slice(),a=i.children.slice(),l=s[t].clone({type:e.type});[s[t],a[t]]=[l,e.data[0]],n=new It(s,new Map(this.schema.metadata)),i=et({type:new Rt(s),children:a})}return new r(n,i)}select(t){let e=this.schema.select(t),n=new Rt(e.fields),i=[];for(let s of t){let a=this.schema.fields.findIndex(l=>l.name===s);~a&&(i[a]=this.data.children[a])}return new r(e,et({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=et({type:new Rt(e.fields),length:this.numRows,children:n});return new r(e,i)}};Bd=Symbol.toStringTag;zt[Bd]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(zt.prototype);function Fd(r,t,e=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...r.fields],s=[...t],a=(e+63&-64)>>3;for(let[l,u]of r.fields.entries()){let f=t[l];(!f||f.length!==e)&&(i[l]=u.clone({nullable:!0}),s[l]=(n=f==null?void 0:f._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:et({type:u.type,length:e,nullCount:e,nullBitmap:new Uint8Array(a)}))}return[r.assign(i),et({type:new Rt(i),length:e,children:s})]}function Dd(r,t,e=new Map){var n,i;if(((n=r==null?void 0:r.length)!==null&&n!==void 0?n:0)>0&&(r==null?void 0:r.length)===(t==null?void 0:t.length))for(let s=-1,a=r.length;++s<a;){let{type:l}=r[s],u=t[s];for(let f of[u,...((i=u==null?void 0:u.dictionary)===null||i===void 0?void 0:i.data)||[]])Dd(l.children,f==null?void 0:f.children,e);if(L.isDictionary(l)){let{id:f}=l;if(!e.has(f))u!=null&&u.dictionary&&e.set(f,u.dictionary);else if(e.get(f)!==u.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return e}var On=class extends zt{constructor(t){let e=t.fields.map(i=>et({type:i.type})),n=et({type:new Rt(t.fields),nullCount:0,children:e});super(t,n)}};var Ge=class r{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static 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):vt.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):ct.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 Yt).__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,vt.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,ct.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,a){return r.startMessage(t),r.addVersion(t,e),r.addHeaderType(t,n),r.addHeader(t,i),r.addBodyLength(t,s),r.addCustomMetadata(t,a),r.endMessage(t)}};var Ol=class extends z{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return Ri.startNull(e),Ri.endNull(e)}visitInt(t,e){return Ne.startInt(e),Ne.addBitWidth(e,t.bitWidth),Ne.addIsSigned(e,t.isSigned),Ne.endInt(e)}visitFloat(t,e){return tn.startFloatingPoint(e),tn.addPrecision(e,t.precision),tn.endFloatingPoint(e)}visitBinary(t,e){return xi.startBinary(e),xi.endBinary(e)}visitLargeBinary(t,e){return Oi.startLargeBinary(e),Oi.endLargeBinary(e)}visitBool(t,e){return Ei.startBool(e),Ei.endBool(e)}visitUtf8(t,e){return Ni.startUtf8(e),Ni.endUtf8(e)}visitLargeUtf8(t,e){return Ui.startLargeUtf8(e),Ui.endLargeUtf8(e)}visitDecimal(t,e){return sr.startDecimal(e),sr.addScale(e,t.scale),sr.addPrecision(e,t.precision),sr.addBitWidth(e,t.bitWidth),sr.endDecimal(e)}visitDate(t,e){return Jr.startDate(e),Jr.addUnit(e,t.unit),Jr.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 en.startInterval(e),en.addUnit(e,t.unit),en.endInterval(e)}visitDuration(t,e){return Xr.startDuration(e),Xr.addUnit(e,t.unit),Xr.endDuration(e)}visitList(t,e){return Mi.startList(e),Mi.endList(e)}visitStruct(t,e){return Li.startStruct_(e),Li.endStruct_(e)}visitUnion(t,e){ke.startTypeIdsVector(e,t.typeIds.length);let n=ke.createTypeIdsVector(e,t.typeIds);return ke.startUnion(e),ke.addMode(e,t.mode),ke.addTypeIds(e,n),ke.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return ir.startDictionaryEncoding(e),ir.addId(e,BigInt(t.id)),ir.addIsOrdered(e,t.isOrdered),n!==void 0&&ir.addIndexType(e,n),ir.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return Zr.startFixedSizeBinary(e),Zr.addByteWidth(e,t.byteWidth),Zr.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Qr.startFixedSizeList(e),Qr.addListSize(e,t.listSize),Qr.endFixedSizeList(e)}visitMap(t,e){return rn.startMap(e),rn.addKeysSorted(e,t.keysSorted),rn.endMap(e)}},Zo=new Ol;function Ed(r,t=new Map){return new It(fy(r,t),Qo(r.metadata),t)}function Ul(r){return new Qt(r.count,Ud(r.columns),Md(r.columns))}function Od(r){return new ue(Ul(r.data),r.id,r.isDelta)}function fy(r,t){return(r.fields||[]).filter(Boolean).map(e=>lt.fromJSON(e,t))}function Ad(r,t){return(r.children||[]).filter(Boolean).map(e=>lt.fromJSON(e,t))}function Ud(r){return(r||[]).reduce((t,e)=>[...t,new De(e.count,hy(e.VALIDITY)),...Ud(e.children)],[])}function Md(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new ce(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new ce(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new ce(t.length,i.OFFSET.length)),i.DATA&&t.push(new ce(t.length,i.DATA.length)),t=Md(i.children,t)}return t}function hy(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function Rd(r,t){let e,n,i,s,a,l;return!t||!(s=r.dictionary)?(a=xd(r,Ad(r,t)),i=new lt(r.name,a,r.nullable,Qo(r.metadata))):t.has(e=s.id)?(n=(n=s.indexType)?Td(n):new or,l=new _e(t.get(e),n,e,s.isOrdered),i=new lt(r.name,l,r.nullable,Qo(r.metadata))):(n=(n=s.indexType)?Td(n):new or,t.set(e,a=xd(r,Ad(r,t))),l=new _e(a,n,e,s.isOrdered),i=new lt(r.name,l,r.nullable,Qo(r.metadata))),i||null}function Qo(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function Td(r){return new Jt(r.isSigned,r.bitWidth)}function xd(r,t){let e=r.type.name;switch(e){case"NONE":return new ie;case"null":return new ie;case"binary":return new gr;case"largebinary":return new wr;case"utf8":return new vr;case"largeutf8":return new Sr;case"bool":return new Ir;case"list":return new He((t||[])[0]);case"struct":return new Rt(t||[]);case"struct_":return new Rt(t||[])}switch(e){case"int":{let n=r.type;return new Jt(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new Ie(Dt[n.precision])}case"decimal":{let n=r.type;return new Fr(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new Br(Wt[n.unit])}case"time":{let n=r.type;return new Dr(C[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new Ar(C[n.unit],n.timezone)}case"interval":{let n=r.type;return new Tr(qt[n.unit])}case"duration":{let n=r.type;return new xr(C[n.unit])}case"union":{let n=r.type,[i,...s]=(n.mode+"").toLowerCase(),a=i.toUpperCase()+s.join("");return new Ve(xt[a],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new Er(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new We(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new ze((t||[])[0],n.keysSorted)}}throw new Error('Unrecognized type: "'.concat(e,'"'))}var py=yn,my=pe,de=class r{static fromJSON(t,e){let n=new r(0,vt.V5,e);return n._createHeader=_y(t,e),n}static decode(t){t=new my(J(t));let e=Ge.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),s=e.headerType(),a=new r(n,i,s);return a._createHeader=yy(e,s),a}static encode(t){let e=new py,n=-1;return t.isSchema()?n=It.encode(e,t.header()):t.isRecordBatch()?n=Qt.encode(e,t.header()):t.isDictionaryBatch()&&(n=ue.encode(e,t.header())),Ge.startMessage(e),Ge.addVersion(e,vt.V5),Ge.addHeader(e,n),Ge.addHeaderType(e,t.headerType),Ge.addBodyLength(e,BigInt(t.bodyLength)),Ge.finishMessageBuffer(e,Ge.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof It)return new r(0,vt.V5,ct.Schema,t);if(t instanceof Qt)return new r(e,vt.V5,ct.RecordBatch,t);if(t instanceof ue)return new r(e,vt.V5,ct.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===ct.Schema}isRecordBatch(){return this.headerType===ct.RecordBatch}isDictionaryBatch(){return this.headerType===ct.DictionaryBatch}constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=pt(t)}},Qt=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=pt(t)}},ue=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=pt(e)}},ce=class{constructor(t,e){this.offset=pt(t),this.length=pt(e)}},De=class{constructor(t,e){this.length=pt(t),this.nullCount=pt(e)}};function _y(r,t){return()=>{switch(t){case ct.Schema:return It.fromJSON(r);case ct.RecordBatch:return Qt.fromJSON(r);case ct.DictionaryBatch:return ue.fromJSON(r)}throw new Error("Unrecognized Message type: { name: ".concat(ct[t],", type: ").concat(t," }"))}}function yy(r,t){return()=>{switch(t){case ct.Schema:return It.decode(r.header(new ae),new Map,r.version());case ct.RecordBatch:return Qt.decode(r.header(new me),r.version());case ct.DictionaryBatch:return ue.decode(r.header(new _r),r.version())}throw new Error("Unrecognized Message type: { name: ".concat(ct[t],", type: ").concat(t," }"))}}lt.encode=Ty;lt.decode=Dy;lt.fromJSON=Rd;It.encode=Ay;It.decode=by;It.fromJSON=Ed;Qt.encode=xy;Qt.decode=gy;Qt.fromJSON=Ul;ue.encode=Ey;ue.decode=wy;ue.fromJSON=Od;De.encode=Oy;De.decode=Sy;ce.encode=Uy;ce.decode=vy;function by(r,t=new Map,e=vt.V5){let n=By(r,t);return new It(n,ta(r),t,e)}function gy(r,t=vt.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new Qt(r.length(),Iy(r),Fy(r,t))}function wy(r,t=vt.V5){return new ue(Qt.decode(r.data(),t),r.id(),r.isDelta())}function vy(r){return new ce(r.offset(),r.length())}function Sy(r){return new De(r.length(),r.nullCount())}function Iy(r){let t=[];for(let e,n=-1,i=-1,s=r.nodesLength();++n<s;)(e=r.nodes(n))&&(t[++i]=De.decode(e));return t}function Fy(r,t){let e=[];for(let n,i=-1,s=-1,a=r.buffersLength();++i<a;)(n=r.buffers(i))&&(t<vt.V4&&(n.bb_pos+=8*(i+1)),e[++s]=ce.decode(n));return e}function By(r,t){let e=[];for(let n,i=-1,s=-1,a=r.fieldsLength();++i<a;)(n=r.fields(i))&&(e[++s]=lt.decode(n,t));return e}function Ld(r,t){let e=[];for(let n,i=-1,s=-1,a=r.childrenLength();++i<a;)(n=r.children(i))&&(e[++s]=lt.decode(n,t));return e}function Dy(r,t){let e,n,i,s,a,l;return!t||!(l=r.dictionary())?(i=kd(r,Ld(r,t)),n=new lt(r.name(),i,r.nullable(),ta(r))):t.has(e=pt(l.id()))?(s=(s=l.indexType())?Nd(s):new or,a=new _e(t.get(e),s,e,l.isOrdered()),n=new lt(r.name(),a,r.nullable(),ta(r))):(s=(s=l.indexType())?Nd(s):new or,t.set(e,i=kd(r,Ld(r,t))),a=new _e(i,s,e,l.isOrdered()),n=new lt(r.name(),a,r.nullable(),ta(r))),n||null}function ta(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 Nd(r){return new Jt(r.isSigned(),r.bitWidth())}function kd(r,t){let e=r.typeType();switch(e){case Et.NONE:return new ie;case Et.Null:return new ie;case Et.Binary:return new gr;case Et.LargeBinary:return new wr;case Et.Utf8:return new vr;case Et.LargeUtf8:return new Sr;case Et.Bool:return new Ir;case Et.List:return new He((t||[])[0]);case Et.Struct_:return new Rt(t||[])}switch(e){case Et.Int:{let n=r.type(new Ne);return new Jt(n.isSigned(),n.bitWidth())}case Et.FloatingPoint:{let n=r.type(new tn);return new Ie(n.precision())}case Et.Decimal:{let n=r.type(new sr);return new Fr(n.scale(),n.precision(),n.bitWidth())}case Et.Date:{let n=r.type(new Jr);return new Br(n.unit())}case Et.Time:{let n=r.type(new yr);return new Dr(n.unit(),n.bitWidth())}case Et.Timestamp:{let n=r.type(new br);return new Ar(n.unit(),n.timezone())}case Et.Interval:{let n=r.type(new en);return new Tr(n.unit())}case Et.Duration:{let n=r.type(new Xr);return new xr(n.unit())}case Et.Union:{let n=r.type(new ke);return new Ve(n.mode(),n.typeIdsArray()||[],t||[])}case Et.FixedSizeBinary:{let n=r.type(new Zr);return new Er(n.byteWidth())}case Et.FixedSizeList:{let n=r.type(new Qr);return new We(n.listSize(),(t||[])[0])}case Et.Map:{let n=r.type(new rn);return new ze((t||[])[0],n.keysSorted())}}throw new Error('Unrecognized type: "'.concat(Et[e],'" (').concat(e,")"))}function Ay(r,t){let e=t.fields.map(s=>lt.encode(r,s));ae.startFieldsVector(r,e.length);let n=ae.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?ae.createCustomMetadataVector(r,[...t.metadata].map(([s,a])=>{let l=r.createString("".concat(s)),u=r.createString("".concat(a));return Yt.startKeyValue(r),Yt.addKey(r,l),Yt.addValue(r,u),Yt.endKeyValue(r)})):-1;return ae.startSchema(r),ae.addFields(r,n),ae.addEndianness(r,My?Yr.Little:Yr.Big),i!==-1&&ae.addCustomMetadata(r,i),ae.endSchema(r)}function Ty(r,t){let e=-1,n=-1,i=-1,s=t.type,a=t.typeId;L.isDictionary(s)?(a=s.dictionary.typeId,i=Zo.visit(s,r),n=Zo.visit(s.dictionary,r)):n=Zo.visit(s,r);let l=(s.children||[]).map(h=>lt.encode(r,h)),u=re.createChildrenVector(r,l),f=t.metadata&&t.metadata.size>0?re.createCustomMetadataVector(r,[...t.metadata].map(([h,w])=>{let A=r.createString("".concat(h)),E=r.createString("".concat(w));return Yt.startKeyValue(r),Yt.addKey(r,A),Yt.addValue(r,E),Yt.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),re.startField(r),re.addType(r,n),re.addTypeType(r,a),re.addChildren(r,u),re.addNullable(r,!!t.nullable),e!==-1&&re.addName(r,e),i!==-1&&re.addDictionary(r,i),f!==-1&&re.addCustomMetadata(r,f),re.endField(r)}function xy(r,t){let e=t.nodes||[],n=t.buffers||[];me.startNodesVector(r,e.length);for(let a of e.slice().reverse())De.encode(r,a);let i=r.endVector();me.startBuffersVector(r,n.length);for(let a of n.slice().reverse())ce.encode(r,a);let s=r.endVector();return me.startRecordBatch(r),me.addLength(r,BigInt(t.length)),me.addNodes(r,i),me.addBuffers(r,s),me.endRecordBatch(r)}function Ey(r,t){let e=Qt.encode(r,t.data);return _r.startDictionaryBatch(r),_r.addId(r,BigInt(t.id)),_r.addIsDelta(r,t.isDelta),_r.addData(r,e),_r.endDictionaryBatch(r)}function Oy(r,t){return Wn.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function Uy(r,t){return Vn.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var My=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var Rl=r=>"Expected ".concat(ct[r]," Message in stream, but was null or length 0."),Ll=r=>"Header pointer of flatbuffer-encoded ".concat(ct[r]," Message is null or length 0."),Cd=(r,t)=>"Expected to read ".concat(r," metadata bytes, but only read ").concat(t,"."),Pd=(r,t)=>"Expected to read ".concat(r," bytes for message body, but only read ").concat(t,"."),oi=class{constructor(t){this.source=t instanceof cr?t:new cr(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?Lt:t.value===-1&&(t=this.readMetadataLength()).done?Lt:(t=this.readMetadata(t.value)).done?Lt: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(Rl(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=J(this.source.read(t));if(e.byteLength<t)throw new Error(Pd(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=ct.Schema,n=this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(Ll(e));return i}readMetadataLength(){let t=this.source.read(ea),e=t&&new pe(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 Lt;if(e.byteLength<t)throw new Error(Cd(t,e.byteLength));return{done:!1,value:de.decode(e)}}},bs=class{constructor(t,e){this.source=t instanceof Fe?t:Ms(t)?new ln(t,e):new Fe(t)}[Symbol.asyncIterator](){return this}next(){return R(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?Lt:t.value===-1&&(t=yield this.readMetadataLength()).done?Lt:(t=yield this.readMetadata(t.value)).done?Lt:t})}throw(t){return R(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return R(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return R(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(Rl(t));return e.value})}readMessageBody(t){return R(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=J(yield this.source.read(t));if(e.byteLength<t)throw new Error(Pd(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(){return R(this,arguments,void 0,function*(t=!1){let e=ct.Schema,n=yield this.readMessage(e),i=n==null?void 0:n.header();if(t&&!i)throw new Error(Ll(e));return i})}readMetadataLength(){return R(this,void 0,void 0,function*(){let t=yield this.source.read(ea),e=t&&new pe(t),n=(e==null?void 0:e.readInt32(0))||0;return{done:n===0,value:n}})}readMetadata(t){return R(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return Lt;if(e.byteLength<t)throw new Error(Cd(t,e.byteLength));return{done:!1,value:de.decode(e)}})}},gs=class extends oi{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof ji?t:new ji(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:de.fromJSON(t.schema,ct.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:de.fromJSON(e,ct.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:de.fromJSON(e,ct.RecordBatch)}}return this._body=[],Lt}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((i,s)=>[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE_ID&&[s.TYPE_ID]||[],...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(Rl(t));return e.value}readSchema(){let t=ct.Schema,e=this.readMessage(t),n=e==null?void 0:e.header();if(!e||!n)throw new Error(Ll(t));return n}},ea=4,Ml="ARROW1",ai=new Uint8Array(Ml.length);for(let r=0;r<Ml.length;r+=1)ai[r]=Ml.codePointAt(r);function ra(r,t=0){for(let e=-1,n=ai.length;++e<n;)if(ai[e]!==r[t+e])return!1;return!0}var li=ai.length,Nl=li+ea,Hd=li*2+ea;var te=class r extends Fn{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 Ue(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 Xt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Xt.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:Os(t)?Ly(t):Ms(t)?Cy(t):Ue(t)?R(this,void 0,void 0,function*(){return yield r.from(yield t)}):Rs(t)||Ii(t)||Ns(t)||we(t)?ky(new Fe(t)):Ny(new cr(t))}static readAll(t){return t instanceof r?t.isSync()?Vd(t):Wd(t):Os(t)||ArrayBuffer.isView(t)||Me(t)||Us(t)?Vd(t):Wd(t)}},dr=class extends te{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return fe(this,arguments,function*(){yield it(yield*mn(Pn(Oe(this[Symbol.iterator]()))))})}},cn=class extends te{constructor(t){super(t),this._impl=t}readAll(){return R(this,void 0,void 0,function*(){var t,e,n,i;let s=new Array;try{for(var a=!0,l=Oe(this),u;u=yield l.next(),t=u.done,!t;a=!0){i=u.value,a=!1;let f=i;s.push(f)}}catch(f){e={error:f}}finally{try{!a&&!t&&(n=l.return)&&(yield n.call(l))}finally{if(e)throw e.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},un=class extends dr{constructor(t){super(t),this._impl=t}},ws=class extends cn{constructor(t){super(t),this._impl=t}},na=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=et({type:new Rt(this.schema.fields),length:t.length,children:n});return new zt(this.schema,i)}_loadDictionaryBatch(t,e){let{id:n,isDelta:i}=t,{dictionaries:s,schema:a}=this,l=s.get(n),u=a.dictionaries.get(n),f=this._loadVectors(t.data,e,[u]);return(l&&i?l.concat(new dt(f)):new dt(f)).memoize()}_loadVectors(t,e,n){return new qi(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},ci=class extends na{constructor(t,e){super(e),this._reader=Os(t)?new gs(this._handle=t):new oi(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=zd(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):Lt}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Lt}next(){if(this.closed)return Lt;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 On(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},ui=class extends na{constructor(t,e){super(e),this._reader=new bs(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return R(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 R(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=zd(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return R(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):Lt})}return(t){return R(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Lt})}next(){return R(this,void 0,void 0,function*(){if(this.closed)return Lt;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 On(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return R(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},ia=class extends ci{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 $i?t:new $i(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(ct.RecordBatch);if(i!=null&&i.isRecordBatch()){let s=i.header(),a=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,a)}}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(ct.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){let s=i.header(),a=this._reader.readMessageBody(i.bodyLength),l=this._loadDictionaryBatch(s,a);this.dictionaries.set(s.id,l)}}}_readFooter(){let{_handle:t}=this,e=t.size-Nl,n=t.readInt32(e),i=t.readAt(e-n,n);return Mr.decode(i)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},kl=class extends ui{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 ln?t:new ln(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return R(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){return R(this,void 0,void 0,function*(){var e;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(ct.RecordBatch);if(i!=null&&i.isRecordBatch()){let s=i.header(),a=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,a)}}return null})}_readDictionaryBatch(t){return R(this,void 0,void 0,function*(){var e;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(ct.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){let s=i.header(),a=yield this._reader.readMessageBody(i.bodyLength),l=this._loadDictionaryBatch(s,a);this.dictionaries.set(s.id,l)}}})}_readFooter(){return R(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-Nl,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return Mr.decode(i)})}_readNextMessageAndValidate(t){return R(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})}},Cl=class extends ci{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new xo(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function zd(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*Vd(r){let t=te.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Wd(r){return fe(this,arguments,function*(){let e=yield it(te.from(r));try{if(!(yield it(e.open({autoDestroy:!1}))).closed)do yield yield it(e);while(!(yield it(e.reset().open())).closed)}finally{yield it(e.cancel())}})}function Ly(r){return new dr(new Cl(r))}function Ny(r){let t=r.peek(li+7&-8);return t&&t.byteLength>=4?ra(t)?new un(new ia(r.read())):new dr(new ci(r)):new dr(new ci(function*(){}()))}function ky(r){return R(this,void 0,void 0,function*(){let t=yield r.peek(li+7&-8);return t&&t.byteLength>=4?ra(t)?new un(new ia(yield r.read())):new cn(new ui(r)):new cn(new ui(function(){return fe(this,arguments,function*(){})}()))})}function Cy(r){return R(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new ln(r,t);return t>=Hd&&ra(yield e.readAt(0,li+7&-8))?new ws(new kl(e)):new cn(new ui(e))})}var kt=class r extends z{static assemble(...t){let e=i=>i.flatMap(s=>Array.isArray(s)?e(s):s instanceof zt?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 dt)return this.visitMany(t.data),this;let{type:e}=t;if(!L.isDictionary(e)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(L.isUnion(e))this.nodes.push(new De(n,0));else{let{nullCount:i}=t;L.isNull(e)||Ke.call(this,i<=0?new Uint8Array(0):wn(t.offset,n,t.nullBitmap)),this.nodes.push(new De(n,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function Ke(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new ce(this._byteLength,t)),this._byteLength+=t,this}function Py(r){var t;let{type:e,length:n,typeIds:i,valueOffsets:s}=r;if(Ke.call(this,i),e.mode===xt.Sparse)return Pl.call(this,r);if(e.mode===xt.Dense){if(r.offset<=0)return Ke.call(this,s),Pl.call(this,r);{let a=new Int32Array(n),l=Object.create(null),u=Object.create(null);for(let f,h,w=-1;++w<n;)(f=i[w])!==void 0&&((h=l[f])===void 0&&(h=l[f]=s[w]),a[w]=s[w]-h,u[f]=((t=u[f])!==null&&t!==void 0?t:0)+1);Ke.call(this,a),this.visitMany(r.children.map((f,h)=>{let w=e.typeIds[h],A=l[w],E=u[w];return f.slice(A,Math.min(n,E))}))}}return this}function Hy(r){let t;return r.nullCount>=r.length?Ke.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?Ke.call(this,wn(r.offset,r.length,t)):Ke.call(this,vn(r.values))}function Vr(r){return Ke.call(this,r.values.subarray(0,r.length*r.stride))}function sa(r){let{length:t,values:e,valueOffsets:n}=r,i=pt(n[0]),s=pt(n[t]),a=Math.min(s-i,e.byteLength-i);return Ke.call(this,Cs(-i,t+1,n)),Ke.call(this,e.subarray(i,i+a)),this}function Hl(r){let{length:t,valueOffsets:e}=r;if(e){let{[0]:n,[t]:i}=e;return Ke.call(this,Cs(-n,t+1,e)),this.visit(r.children[0].slice(n,i-n))}return this.visit(r.children[0])}function Pl(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}kt.prototype.visitBool=Hy;kt.prototype.visitInt=Vr;kt.prototype.visitFloat=Vr;kt.prototype.visitUtf8=sa;kt.prototype.visitLargeUtf8=sa;kt.prototype.visitBinary=sa;kt.prototype.visitLargeBinary=sa;kt.prototype.visitFixedSizeBinary=Vr;kt.prototype.visitDate=Vr;kt.prototype.visitTimestamp=Vr;kt.prototype.visitTime=Vr;kt.prototype.visitDecimal=Vr;kt.prototype.visitList=Hl;kt.prototype.visitStruct=Pl;kt.prototype.visitUnion=Py;kt.prototype.visitInterval=Vr;kt.prototype.visitDuration=Vr;kt.prototype.visitFixedSizeList=Hl;kt.prototype.visitMap=Hl;var Un=class extends Fn{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 lr,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,ne(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 Ue(t)?t.then(e=>this.writeAll(e)):we(t)?Wl(this,t):Vl(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 lr?this._sink=t:(this._sink=new lr,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._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!e||!En(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 oe&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof zt&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!En(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof zt?t instanceof On||this._writeRecordBatch(t):t instanceof oe?this.writeAll(t.batches):Me(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=de.encode(t),s=i.byteLength,a=this._writeLegacyIpcFormat?4:8,l=s+a+n&~n,u=l-s-a;return t.headerType===ct.RecordBatch?this._recordBatchBlocks.push(new Rr(l,t.bodyLength,this._position)):t.headerType===ct.DictionaryBatch&&this._dictionaryBlocks.push(new Rr(l,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(l-a)),s>0&&this._write(i),this._writePadding(u)}_write(t){if(this._started){let e=J(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(de.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(ai)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:s}=kt.assemble(t),a=new Qt(t.numRows,n,i),l=de.from(a,e);return this._writeDictionaries(t)._writeMessage(l)._writeBodyBuffers(s)}_writeDictionaryBatch(t,e,n=!1){let{byteLength:i,nodes:s,bufferRegions:a,buffers:l}=kt.assemble(new dt([t])),u=new Qt(t.length,s,a),f=new ue(u,e,n),h=de.from(f,i);return this._writeMessage(h)._writeBodyBuffers(l)}_writeBodyBuffers(t){let e,n,i;for(let s=-1,a=t.length;++s<a;)(e=t[s])&&(n=e.byteLength)>0&&(this._write(e),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){var e,n;for(let[i,s]of t.dictionaries){let a=(e=s==null?void 0:s.data)!==null&&e!==void 0?e:[],l=this._seenDictionaries.get(i),u=(n=this._dictionaryDeltaOffsets.get(i))!==null&&n!==void 0?n:0;if(!l||l.data[0]!==a[0])for(let[f,h]of a.entries())this._writeDictionaryBatch(h,i,f>0);else if(u<a.length)for(let f of a.slice(u))this._writeDictionaryBatch(f,i,!0);this._seenDictionaries.set(i,s),this._dictionaryDeltaOffsets.set(i,a.length)}return this}},Mn=class r extends Un{static writeAll(t,e){let n=new r(e);return Ue(t)?t.then(i=>n.writeAll(i)):we(t)?Wl(n,t):Vl(n,t)}},Rn=class r extends Un{static writeAll(t){let e=new r;return Ue(t)?t.then(n=>e.writeAll(n)):we(t)?Wl(e,t):Vl(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,e,n=!1){if(!n&&this._seenDictionaries.has(e))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,e,n)}_writeFooter(t){let e=Mr.encode(new Mr(t,vt.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function Vl(r,t){let e=t;t instanceof oe&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function Wl(r,t){return R(this,void 0,void 0,function*(){var e,n,i,s,a,l,u;try{for(e=!0,n=Oe(t);i=yield n.next(),s=i.done,!s;e=!0){u=i.value,e=!1;let f=u;r.write(f)}}catch(f){a={error:f}}finally{try{!e&&!s&&(l=n.return)&&(yield l.call(n))}finally{if(a)throw a.error}}return r.finish()})}function jd(r,t){if(we(r))return Wy(r,t);if(Me(r))return Vy(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function Vy(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(a){s(a,e||(e=r[Symbol.iterator]()))},pull(a){e?s(a,e):a.close()},cancel(){(e!=null&&e.return&&e.return()||!0)&&(e=null)}}),Object.assign({highWaterMark:n?i:void 0},t));function s(a,l){let u,f=null,h=a.desiredSize||null;for(;!(f=l.next(n?h:null)).done;)if(ArrayBuffer.isView(f.value)&&(u=J(f.value))&&(h!=null&&n&&(h=h-u.byteLength+1),f.value=u),a.enqueue(f.value),h!=null&&--h<=0)return;a.close()}}function Wy(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(a){return R(this,void 0,void 0,function*(){yield s(a,e||(e=r[Symbol.asyncIterator]()))})},pull(a){return R(this,void 0,void 0,function*(){e?yield s(a,e):a.close()})},cancel(){return R(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(a,l){return R(this,void 0,void 0,function*(){let u,f=null,h=a.desiredSize||null;for(;!(f=yield l.next(n?h:null)).done;)if(ArrayBuffer.isView(f.value)&&(u=J(f.value))&&(h!=null&&n&&(h=h-u.byteLength+1),f.value=u),a.enqueue(f.value),h!=null&&--h<=0)return;a.close()})}}function Kd(r){return new zl(r)}var zl=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"?$d:Gd;let{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},e),{["highWaterMark"]:l=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:u=>{this._maybeFlush(this._builder,this._controller=u)},start:u=>{this._maybeFlush(this._builder,this._controller=u)}},{highWaterMark:a,size:i!=="bytes"?$d:Gd}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:l,size:u=>this._writeValueAndReturnChunkSize(u)})}_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)}},$d=r=>{var t;return(t=r==null?void 0:r.length)!==null&&t!==void 0?t:0},Gd=r=>{var t;return(t=r==null?void 0:r.byteLength)!==null&&t!==void 0?t:0};function oa(r,t){let e=new lr,n=null,i=new ReadableStream({cancel(){return R(this,void 0,void 0,function*(){yield e.close()})},start(l){return R(this,void 0,void 0,function*(){yield a(l,n||(n=yield s()))})},pull(l){return R(this,void 0,void 0,function*(){n?yield a(l,n):l.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:i};function s(){return R(this,void 0,void 0,function*(){return yield(yield te.from(e)).open(t)})}function a(l,u){return R(this,void 0,void 0,function*(){let f=l.desiredSize,h=null;for(;!(h=yield u.next()).done;)if(l.enqueue(h.value),f!=null&&--f<=0)return;l.close()})}}function aa(r,t){let e=new this(r),n=new Fe(e),i=new ReadableStream({cancel(){return R(this,void 0,void 0,function*(){yield n.cancel()})},pull(a){return R(this,void 0,void 0,function*(){yield s(a)})},start(a){return R(this,void 0,void 0,function*(){yield s(a)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(e,r),readable:i};function s(a){return R(this,void 0,void 0,function*(){let l=null,u=a.desiredSize;for(;l=yield n.read(u||null);)if(a.enqueue(l),u!=null&&(u-=l.byteLength)<=0)return;a.close()})}}function la(r,t="stream"){return(t==="stream"?Mn:Rn).writeAll(r).toUint8Array(!0)}var Gy=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},el),Dl),yl),rl),qa),_l),Xa),{compareSchemas:En,compareFields:vd,compareTypes:Sd});Xt.toDOMStream=jd;Nt.throughDOM=Kd;te.throughDOM=oa;un.throughDOM=oa;dr.throughDOM=oa;Un.throughDOM=aa;Rn.throughDOM=aa;Mn.throughDOM=aa;function di(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:di(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=>ca(e.name,e.type))};case p.Map:{let t=r;return{sqlType:"map",keyType:di(t.keyType),valueType:di(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 ca(r,t){let e=di(t);return e.name=r,e}var ua=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=te.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new oe(n)}async send(t,e=!1){let n=this._bindings.startPendingQuery(this._conn,t,e);for(;n==null;)n=await new Promise((a,l)=>{try{a(this._bindings.pollPendingQuery(this._conn))}catch(u){console.log(u),u.message.includes("worker is not set!")?l(new Error("Worker has been terminated")):l(u)}});let i=new da(this._bindings,this._conn,n),s=te.from(i);return console.assert(s.isSync()),console.assert(s.isStream()),s}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 jl(this._bindings,this._conn,e)}createScalarFunction(t,e,n){this._bindings.createScalarFunction(this._conn,t,e,n)}insertArrowTable(t,e){let n=la(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)}},da=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=null;do t=this.bindings.fetchQueryResults(this.conn);while(t==null);return this._depleted=t.length==0,{done:this._depleted,value:t}}[Symbol.iterator](){return this}},jl=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=te.from(e);return console.assert(n.isSync()),console.assert(n.isFile()),new oe(n)}send(...t){let e=this.bindings.sendPrepared(this.connectionId,this.statementId,t),n=new da(this.bindings,this.connectionId,e),i=te.from(n);return console.assert(i.isSync()),console.assert(i.isStream()),i}};function Yd(r){return r<=255}function Jd(r){return r===256}var Qd=new TextEncoder,Xd=new TextDecoder("utf-8");function $l(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 Kl(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 Gl(r,t,e,n){let i=r.HEAPU8.subarray(t,t+n*Kl(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 Zd(r,t,e){let n=r.HEAPU8.subarray(t,t+e);return new Uint8Array(n.buffer,n.byteOffset,e)}function fa(r,t,e){let n=r.HEAPU8.subarray(t,t+e*8);return new Float64Array(n.buffer,n.byteOffset,e)}function tf(r,t,e,n,i,s,a,l){try{let u=r._udfFunctions.get(n);if(!u){$l(t,e,"Unknown UDF with id: "+n);return}let f=Xd.decode(t.HEAPU8.subarray(i,i+s)),h=JSON.parse(f),w=fa(t,a,l/8),A=I=>{var B;let O=null;switch(I.validityBuffer!==void 0&&(O=Zd(t,w[I.validityBuffer],h.rows)),I.physicalType){case"VARCHAR":{if(I.dataBuffer===null||I.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for VARCHAR argument");if(I.lengthBuffer===null||I.lengthBuffer===void 0)throw new Error("malformed data view, expected data length buffer for VARCHAR argument");let N=Gl(t,w[I.dataBuffer],I.physicalType,h.rows),F=[],H=fa(t,w[I.lengthBuffer],h.rows);for(let W=0;W<h.rows;++W){if(O!=null&&!O[W]){F.push(null);continue}let At=t.HEAPU8.subarray(N[W],N[W]+H[W]),Ut=Xd.decode(At);F.push(Ut)}return W=>F[W]}case"STRUCT":{let N={},F=[];for(let H=0;H<(((B=I.children)==null?void 0:B.length)||0);++H){let W=I.children[H],At=A(W);F.push(Ut=>{N[W.name]=At(Ut)})}return O!=null?H=>{if(!O[H])return null;for(let W of F)W(H);return N}:H=>{for(let W of F)W(H);return N}}default:{if(I.dataBuffer===void 0)throw new Error("malformed data view, expected data buffer for argument of type: "+I.physicalType);let N=Gl(t,w[I.dataBuffer],I.physicalType,h.rows);return O!=null?F=>O[F]?N[F]:null:F=>N[F]}}},E=[];for(let I=0;I<h.args.length;++I)E.push(A(h.args[I]));let at=h.rows*Kl(h.ret.physicalType),wt=t._malloc(at),Vt=Gl(t,wt,h.ret.physicalType,h.rows),mt=t._malloc(h.rows),Ot=Zd(t,mt,h.rows);if(Vt.length==0||Ot.length==0){$l(t,e,"Can't create physical arrays for result");return}let yt=Vt;h.ret.physicalType=="VARCHAR"&&(yt=new Array(h.rows));let Gt=[];for(let I=0;I<h.args.length;++I)Gt.push(null);for(let I=0;I<h.rows;++I){for(let B=0;B<h.args.length;++B)Gt[B]=E[B](I);let O=u.func(...Gt);yt[I]=O,Ot[I]=O==null?0:1}let Ct=0;switch(h.ret.physicalType){case"VARCHAR":{let I=new Array(0);Ct=t._malloc(h.rows*Kl("DOUBLE"));let O=fa(t,Ct,h.rows),B=0;for(let W=0;W<h.rows;++W){let At=Qd.encode(yt[W]||"");I.push(At),O[W]=At.length,B+=At.length}let N=t._malloc(B),F=t.HEAPU8.subarray(N,N+B),H=0;for(let W=0;W<h.rows;++W){Vt[W]=H;let At=I[W];F.subarray(H,H+At.length).set(At),H+=At.length}}}let S=3*8,U=t._malloc(S),V=fa(t,U,3);V[0]=wt,V[1]=mt,V[2]=Ct,t.HEAPF64[(e>>3)+0]=0,t.HEAPF64[(e>>3)+1]=U,t.HEAPF64[(e>>3)+2]=0}catch(u){$l(t,e,u.toString())}}function qy(){let r=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),r.decode(t))}var Yy=qy();function qe(r,t){console.error("FAIL WITH: ".concat(t)),r.ccall("duckdb_web_fail_with",null,["string"],[t])}function Ln(r,t,e){let n=new Uint8Array(r.HEAPU8.buffer,t>>>0,e),i=new Uint8Array(new ArrayBuffer(n.byteLength));return i.set(n),i}function nt(r,t,e){return Yy(new Uint8Array(r.HEAPU8.buffer,t>>>0,e))}function Ft(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 a=r.HEAPF64[(s>>3)+0],l=r.HEAPF64[(s>>3)+1],u=r.HEAPF64[(s>>3)+2];return r.stackRestore(i),[a,l,u]}function Mt(r){r.ccall("duckdb_web_clear_response",null,[],[])}var ha=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 fi=new TextEncoder;var pa=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),globalThis.DUCKDB_BINDINGS=this,this)}open(t){let[e,n,i]=Ft(this.mod,"duckdb_web_open",["string"],[JSON.stringify(t)]);if(e!==0)throw new Error(nt(this.mod,n,i));Mt(this.mod)}reset(){let[t,e,n]=Ft(this.mod,"duckdb_web_reset",[],[]);if(t!==0)throw new Error(nt(this.mod,e,n));Mt(this.mod)}getVersion(){let[t,e,n]=Ft(this.mod,"duckdb_web_get_version",[],[]);if(t!==0)throw new Error(nt(this.mod,e,n));let i=nt(this.mod,e,n);return Mt(this.mod),i}getFeatureFlags(){return this.mod.ccall("duckdb_web_get_feature_flags","number",[],[])}tokenize(t){let e=fi.encode(t),n=this.mod._malloc(e.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,n,e.length).set(e);let[s,a,l]=Ft(this.mod,"duckdb_web_tokenize_buffer",["number","number"],[n,e.length]);if(this.mod._free(n),s!==0)throw new Error(nt(this.mod,a,l));let u=nt(this.mod,a,l);return Mt(this.mod),JSON.parse(u)}connect(){let t=this.mod.ccall("duckdb_web_connect","number",[],[]);return new ua(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=fi.encode(e),i=this.mod._malloc(n.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,i,n.length).set(n);let[a,l,u]=Ft(this.mod,"duckdb_web_query_run_buffer",["number","number","number"],[t,i,n.length]);if(this.mod._free(i),a!==0)throw new Error(nt(this.mod,l,u));let f=Ln(this.mod,l,u);return Mt(this.mod),f}startPendingQuery(t,e,n=!1){let i=fi.encode(e),s=this.mod._malloc(i.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,s,i.length).set(i);let[l,u,f]=Ft(this.mod,"duckdb_web_pending_query_start_buffer",["number","number","number","boolean"],[t,s,i.length,n]);if(this.mod._free(s),l!==0)throw new Error(nt(this.mod,u,f));if(u==0)return null;let h=Ln(this.mod,u,f);return Mt(this.mod),h}pollPendingQuery(t){let[e,n,i]=Ft(this.mod,"duckdb_web_pending_query_poll",["number"],[t]);if(e!==0)throw new Error(nt(this.mod,n,i));if(n==0)return null;let s=Ln(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]=Ft(this.mod,"duckdb_web_query_fetch_results",["number"],[t]);if(Jd(e))return Mt(this.mod),null;if(!Yd(e))throw new Error("Unexpected StatusCode from duckdb_web_query_fetch_results ("+e+") and with self reported error as"+nt(this.mod,n,i));if(e!==0)throw new Error(nt(this.mod,n,i));let s=Ln(this.mod,n,i);return Mt(this.mod),s}getTableNames(t,e){let n=fi.encode(e),i=this.mod._malloc(n.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,i,n.length).set(n);let[a,l,u]=Ft(this.mod,"duckdb_web_get_tablenames_buffer",["number","number","number"],[t,i,n.length]);if(this.mod._free(i),a!==0)throw new Error(nt(this.mod,l,u));let f=nt(this.mod,l,u);return Mt(this.mod),JSON.parse(f)}createScalarFunction(t,e,n,i){let s={functionId:this._nextUDFId,name:e,returnType:di(n)},a={functionId:s.functionId,connectionId:t,name:e,returnType:n,func:i};this._nextUDFId+=1;let[l,u,f]=Ft(this.mod,"duckdb_web_udf_scalar_create",["number","string"],[t,JSON.stringify(s)]);if(l!==0)throw new Error(nt(this.mod,u,f));if(Mt(this.mod),globalThis.DUCKDB_RUNTIME._udfFunctions=(globalThis.DUCKDB_RUNTIME._udfFunctions||new Map).set(a.functionId,a),this.pthread)for(let h of[...this.pthread.runningWorkers,...this.pthread.unusedWorkers])h.postMessage({cmd:"registerUDFFunction",udf:a})}createPrepared(t,e){let n=fi.encode(e),i=this.mod._malloc(n.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,i,n.length).set(n);let[a,l,u]=Ft(this.mod,"duckdb_web_prepared_create_buffer",["number","number","number"],[t,i,n.length]);if(this.mod._free(i),a!==0)throw new Error(nt(this.mod,l,u));return Mt(this.mod),l}closePrepared(t,e){let[n,i,s]=Ft(this.mod,"duckdb_web_prepared_close",["number","number"],[t,e]);if(n!==0)throw new Error(nt(this.mod,i,s));Mt(this.mod)}runPrepared(t,e,n){let[i,s,a]=Ft(this.mod,"duckdb_web_prepared_run",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(nt(this.mod,s,a));let l=Ln(this.mod,s,a);return Mt(this.mod),l}sendPrepared(t,e,n){let[i,s,a]=Ft(this.mod,"duckdb_web_prepared_send",["number","number","string"],[t,e,JSON.stringify(n)]);if(i!==0)throw new Error(nt(this.mod,s,a));let l=Ln(this.mod,s,a);return Mt(this.mod),l}insertArrowFromIPCStream(t,e,n){if(e.length==0)return;let i=this.mod._malloc(e.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,i,e.length).set(e);let a=n?JSON.stringify(n):"",[l,u,f]=Ft(this.mod,"duckdb_web_insert_arrow_from_ipc_stream",["number","number","number","string"],[t,i,e.length,a]);if(this.mod._free(i),l!==0)throw new Error(nt(this.mod,u,f))}insertCSVFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let f in n.columns)n.columnsFlat.push(ca(f,n.columns[f]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[a,l,u]=Ft(this.mod,"duckdb_web_insert_csv_from_path",["number","string","string"],[t,e,s]);if(a!==0)throw new Error(nt(this.mod,l,u))}insertJSONFromPath(t,e,n){if(n.columns!==void 0){n.columnsFlat=[];for(let f in n.columns)n.columnsFlat.push(ca(f,n.columns[f]))}let i={...n};i.columns=i.columnsFlat,delete i.columnsFlat;let s=JSON.stringify(i),[a,l,u]=Ft(this.mod,"duckdb_web_insert_json_from_path",["number","string","string"],[t,e,s]);if(a!==0)throw new Error(nt(this.mod,l,u))}globFiles(t){let[e,n,i]=Ft(this.mod,"duckdb_web_fs_glob_file_infos",["string"],[t]);if(e!==0)throw new Error(nt(this.mod,n,i));let s=nt(this.mod,n,i);Mt(this.mod);let a=JSON.parse(s);return a==null?[]:a}registerFileURL(t,e,n,i=!1){e===void 0&&(e=t);let[s,a,l]=Ft(this.mod,"duckdb_web_fs_register_file_url",["string","string"],[t,e,n,i]);if(s!==0)throw new Error(nt(this.mod,a,l));Mt(this.mod)}registerFileText(t,e){let n=fi.encode(e);this.registerFileBuffer(t,n)}registerFileBuffer(t,e){let n=this.mod._malloc(e.length)>>>0;new Uint8Array(this.mod.HEAPU8.buffer,n,e.length).set(e);let[s,a,l]=Ft(this.mod,"duckdb_web_fs_register_file_buffer",["string","number","number"],[t,n,e.length]);if(s!==0)throw new Error(nt(this.mod,a,l));Mt(this.mod)}async prepareFileHandle(t,e){if(e===3&&this._runtime.prepareFileHandles){let n=await this._runtime.prepareFileHandles([t],3);for(let i of n){let{handle:s,path:a,fromCached:l}=i;!l&&s.getSize()&&await this.registerFileHandleAsync(a,s,3,!0)}return}throw new Error("prepareFileHandle: unsupported protocol ".concat(e))}async prepareDBFileHandle(t,e){if(e===3&&this._runtime.prepareDBFileHandle){let n=await this._runtime.prepareDBFileHandle(t,3);for(let i of n){let{handle:s,path:a,fromCached:l}=i;!l&&s.getSize()&&await this.registerFileHandleAsync(a,s,3,!0)}return}throw new Error("prepareDBFileHandle: unsupported protocol ".concat(e))}async prepareFileHandleAsync(t,e,n,i){if(n===3&&!(e instanceof FileSystemSyncAccessHandle)){if(e instanceof FileSystemFileHandle){let s=e;try{e=await s.createSyncAccessHandle()}catch(a){throw new Error(a.message+":"+t)}}else if(t!=null)try{e=await(await(await navigator.storage.getDirectory()).getFileHandle(t)).createSyncAccessHandle()}catch(s){throw new Error(s.message+":"+t)}}return e}async registerFileHandleAsync(t,e,n,i){let s=await this.prepareFileHandleAsync(t,e,n,i);this.registerFileHandle(t,s,n,i)}registerFileHandle(t,e,n,i){var u;let[s,a,l]=Ft(this.mod,"duckdb_web_fs_register_file_url",["string","string","number","boolean"],[t,t,n,i]);if(s!==0)throw new Error(nt(this.mod,a,l));if(Mt(this.mod),globalThis.DUCKDB_RUNTIME._files=(globalThis.DUCKDB_RUNTIME._files||new Map).set(t,e),(u=globalThis.DUCKDB_RUNTIME._preparedHandles)!=null&&u[t]&&delete globalThis.DUCKDB_RUNTIME._preparedHandles[t],this.pthread){for(let f of this.pthread.runningWorkers)f.postMessage({cmd:"registerFileHandle",fileName:t,fileHandle:e});for(let f of this.pthread.unusedWorkers)f.postMessage({cmd:"dropFileHandle",fileName:t})}}dropFile(t){let[e,n,i]=Ft(this.mod,"duckdb_web_fs_drop_file",["string"],[t]);if(e!==0)throw new Error(nt(this.mod,n,i));Mt(this.mod)}dropFiles(t){let e=[],n=-1;try{for(let l of t!=null?t:[])if(l!=null&&l.length>0){let u=this.mod.lengthBytesUTF8(l)+1,f=this.mod._malloc(u);if(!f)throw new Error("Failed to allocate memory for string: ".concat(l));this.mod.stringToUTF8(l,f,u),e.push(f)}if(n=this.mod._malloc(e.length*4),!n)throw new Error("Failed to allocate memory for pointers array");for(let l=0;l<e.length;l++)this.mod.HEAP32[(n>>2)+l]=e[l];let[i,s,a]=Ft(this.mod,"duckdb_web_fs_drop_files",["number","number"],[n,e.length]);if(i!==0)throw new Error(nt(this.mod,s,a));Mt(this.mod)}finally{for(let i of e)this.mod._free(i);n>0&&this.mod._free(n)}}flushFiles(){this.mod.ccall("duckdb_web_flush_files",null,[],[])}copyFileToPath(t,e){let[n,i,s]=Ft(this.mod,"duckdb_web_copy_file_to_path",["string","string"],[t,e]);if(n!==0)throw new Error(nt(this.mod,i,s));Mt(this.mod)}copyFileToBuffer(t){let[e,n,i]=Ft(this.mod,"duckdb_web_copy_file_to_buffer",["string"],[t]);if(e!==0)throw new Error(nt(this.mod,n,i));let s=new Uint8Array(this.mod.HEAPU8.buffer,n>>>0,i),a=new Uint8Array(s.length);return a.set(s),Mt(this.mod),a}async registerOPFSFileName(t){if(t.startsWith("opfs://"))return this.prepareFileHandle(t,3);throw new Error("Not an OPFS file name: "+t)}collectFileStatistics(t,e){let[n,i,s]=Ft(this.mod,"duckdb_web_collect_file_stats",["string","boolean"],[t,e]);if(n!==0)throw new Error(nt(this.mod,i,s))}exportFileStatistics(t){let[e,n,i]=Ft(this.mod,"duckdb_web_export_file_stats",["string"],[t]);if(e!==0)throw new Error(nt(this.mod,n,i));return new ha(new Uint8Array(this.mod.HEAPU8.buffer,n>>>0,i))}};var ma=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":{let e=t.data.path,n=!!(this._bindings.getFeatureFlags()&32);e!=null&&e.startsWith("opfs://")&&!n&&(await this._bindings.prepareDBFileHandle(e,3),t.data.useDirectIO=!0),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(t.data),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],t.data[2]),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),n=e?[e.buffer]:[];this.postMessage({messageId:this._nextMessageId++,requestId:t.messageId,type:"QUERY_RESULT_CHUNK",data:e},n);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":await this._bindings.registerFileHandleAsync(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"REGISTER_OPFS_FILE_NAME":{!!(this._bindings.getFeatureFlags()&32)||await this._bindings.registerOPFSFileName(t.data[0]),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 ff=eu(df());var ba=class extends pa{constructor(t,e,n,i){super(t,e),this.mainModuleURL=n,this.pthreadWorkerURL=i}locateFile(t,e){if(t.endsWith(".wasm"))return this.mainModuleURL;if(t.endsWith(".worker.js")){if(!this.pthreadWorkerURL)throw new Error("Missing DuckDB worker URL!");return this.pthreadWorkerURL}throw new Error("WASM instantiation requested unexpected file: prefix=".concat(e," path=").concat(t))}instantiateWasm(t,e){globalThis.DUCKDB_RUNTIME=this._runtime;let n=this.onInstantiationProgress;if(WebAssembly.instantiateStreaming)if(typeof TransformStream=="function"){let s=(async()=>{var at;let a=new Request(this.mainModuleURL),l=await fetch(a),u=l.headers.get("content-length"),f=u&&parseInt(u,10)||0,h=new Date,w={startedAt:h,updatedAt:h,bytesTotal:f||0,bytesLoaded:0},A={transform(wt,Vt){w.bytesLoaded+=wt.byteLength;let mt=new Date;if(mt.getTime()-w.updatedAt.getTime()<20){w.updatedAt=mt,Vt.enqueue(wt);return}for(let Ot of n)Ot(w);Vt.enqueue(wt)}},E=new TransformStream(A);return new Response((at=l.body)==null?void 0:at.pipeThrough(E),l)})();WebAssembly.instantiateStreaming(s,t).then(a=>{e(a.instance,a.module)})}else{console.warn("instantiating without progress handler since transform streams are unavailable");let i=new Request(this.mainModuleURL);WebAssembly.instantiateStreaming(fetch(i),t).then(s=>{e(s.instance,s.module)})}else if(typeof XMLHttpRequest=="function"){let i=new XMLHttpRequest,s=this.mainModuleURL,a=new Date,l={startedAt:a,updatedAt:a,bytesTotal:0,bytesLoaded:0};i.open("GET",s),i.responseType="arraybuffer",i.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())},i.onprogress=u=>{l.bytesTotal=u.total,l.bytesLoaded=u.loaded;let f=new Date;if(f.getTime()-l.updatedAt.getTime()<20){l.updatedAt=f;return}for(let h of n)h(l)},i.onload=()=>{WebAssembly.instantiate(i.response,t).then(u=>{e(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)})},i.send()}else console.warn("instantiating with manual fetch since streaming instantiation and xhrs are unavailable"),(async()=>{let s=new Request(this.mainModuleURL),l=await(await fetch(s)).arrayBuffer();WebAssembly.instantiate(l,t).then(u=>{e(u.instance,u.module)})})();return[]}};var ga=class extends ba{constructor(t,e,n,i=null){super(t,e,n,i)}instantiateImpl(t){let e={...t,instantiateWasm:this.instantiateWasm.bind(this),locateFile:this.locateFile.bind(this)};return this.pthreadWorkerURL&&(e.mainScriptUrlOrBlob=this.pthreadWorkerURL),(0,ff.default)(e)}};var dn=eu(mf()),_f=function(r,t,e){var n;return(n=r==null?void 0:r.endpoint)!=null&&n.startsWith("http")?new URL(r.endpoint).host:r!=null&&r.endpoint?"".concat(e,".").concat(r==null?void 0:r.endpoint):"".concat(e,".s3.amazonaws.com")};function Zy(r,t,e){var s,a,l,u;let n=yf(t),i=n.path;if(bf(r)){let f="";if(r!=null&&r.endpoint){let h=new URL(r.endpoint);h.pathname!=="/"&&(f=h.pathname)}i="".concat(f,"/").concat(n.bucket).concat(i)}return{url:i,query:"",host:_f(r,t,n.bucket),region:(s=r==null?void 0:r.region)!=null?s:"",service:"s3",method:e,accessKeyId:(a=r==null?void 0:r.accessKeyId)!=null?a:"",secretAccessKey:(l=r==null?void 0:r.secretAccessKey)!=null?l:"",sessionToken:(u=r==null?void 0:r.sessionToken)!=null?u:"",dateNow:new Date().toISOString().replace(/-/g,"").split("T")[0],datetimeNow:new Date().toISOString().replace(/-/g,"").replace(/:/g,"").split(".")[0]+"Z"}}function Qy(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 tb(r,t=null){var at;let e=(at=t==null?void 0:t.contentHash)!=null?at:"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"+Qy(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 a=(0,dn.sha256)(s),l="AWS4-HMAC-SHA256\n"+r.datetimeNow+"\n"+r.dateNow+"/"+r.region+"/"+r.service+"/aws4_request\n"+a,u="AWS4"+r.secretAccessKey,f=dn.sha256.hmac.arrayBuffer(u,r.dateNow),h=dn.sha256.hmac.arrayBuffer(f,r.region),w=dn.sha256.hmac.arrayBuffer(h,r.service),A=dn.sha256.hmac.arrayBuffer(w,"aws4_request"),E=dn.sha256.hmac(A,l);return n.set("Authorization","AWS4-HMAC-SHA256 Credential="+r.accessKeyId+"/"+r.dateNow+"/"+r.region+"/"+r.service+"/aws4_request, SignedHeaders="+i+", Signature="+E),n}var eb=function(r,t,e,n=null,i=null){let s=Zy(r,t,e),a={contentType:n,contentHash:i?dn.sha256.hex(i):null};return tb(s,a)};function Ye(r,t,e,n,i=null,s=null){(t!=null&&t.accessKeyId||t!=null&&t.sessionToken)&&(eb(t,e,n,i,s).forEach((l,u)=>{r.setRequestHeader(u,l)}),i&&r.setRequestHeader("content-type",i))}function yf(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 bf(r){var t;return!!((t=r==null?void 0:r.endpoint)!=null&&t.startsWith("http"))}function Je(r,t){let e=yf(t);return bf(r)?"".concat(r==null?void 0:r.endpoint,"/").concat(e.bucket)+e.path:"https://"+_f(r,t,e.bucket)+e.path}var rb=7,gf=/\/|\\/,Q={_files:new Map,_fileInfoCache:new Map,_udfFunctions:new Map,_globalFileInfo:null,_preparedHandles:{},_opfsRoot:null,getFileInfo(r,t){try{let e=Q._fileInfoCache.get(t),[n,i,s]=Ft(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 a=nt(r,i,s);Mt(r);try{let l=JSON.parse(a);if(l==null)return null;let u={...l,blob:null};return Q._fileInfoCache.set(t,u),!Q._files.has(u.fileName)&&Q._preparedHandles[u.fileName]&&(Q._files.set(u.fileName,Q._preparedHandles[u.fileName]),delete Q._preparedHandles[u.fileName]),u}catch(l){return console.warn(l),null}}catch(e){return console.log(e),null}},getGlobalFileInfo(r){var t;try{let[e,n,i]=Ft(r,"duckdb_web_get_global_file_info",["number"],[((t=Q._globalFileInfo)==null?void 0:t.cacheEpoch)||0]);if(e!==0)return null;if(i===0)return Q._globalFileInfo;let s=nt(r,n,i);Mt(r);let a=JSON.parse(s);return a==null?null:(Q._globalFileInfo={...a,blob:null},Q._globalFileInfo)}catch(e){return console.log(e),null}},async assignOPFSRoot(){Q._opfsRoot||(Q._opfsRoot=await navigator.storage.getDirectory())},async prepareFileHandles(r,t){if(t===3){await Q.assignOPFSRoot();let e=async i=>{if(Q._files.has(i))return{path:i,handle:Q._files.get(i),fromCached:!0};let a=Q._opfsRoot,l=i.slice(rb),u=l;if(gf.test(l)){let h=l.split(gf);if(h.length===0)throw new Error("Invalid path ".concat(l));if(u=h[h.length-1],!u)throw new Error("Invalid path ".concat(l,". File Not Found."));h.pop();for(let w of h)a=await a.getDirectoryHandle(w,{create:!0})}let f=await a.getFileHandle(u,{create:!1}).catch(h=>{if((h==null?void 0:h.name)==="NotFoundError")return console.debug("File ".concat(i," does not exists yet, creating...")),a.getFileHandle(u,{create:!0});throw h});try{let h=await f.createSyncAccessHandle();return Q._preparedHandles[i]=h,{path:i,handle:h,fromCached:!1}}catch(h){throw new Error(h.message+":"+name)}},n=[];for(let i of r){let s=await e(i);n.push(s)}return n}throw new Error("Unsupported protocol ".concat(t," for paths ").concat(r," with protocol ").concat(t))},async prepareDBFileHandle(r,t){if(t===3&&this.prepareFileHandles){let e=[r,"".concat(r,".wal")];return this.prepareFileHandles(e,t)}throw new Error("Unsupported protocol ".concat(t," for path ").concat(r," with protocol ").concat(t))},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,i,s,a,l,u;try{Q._fileInfoCache.delete(t);let f=Q.getFileInfo(r,t);switch(f==null?void 0:f.dataProtocol){case 4:case 5:{if(e&1&&e&2)throw new Error("Opening file ".concat(f.fileName," failed: cannot open file with both read and write flags set"));if(e&32)throw new Error("Opening file ".concat(f.fileName," failed: appending to HTTP/S3 files is not supported"));if(e&2){let A=new XMLHttpRequest;if(f.dataProtocol==5?(A.open("HEAD",Je(f.s3Config,f.dataUrl),!1),Ye(A,f.s3Config,f.dataUrl,"HEAD")):A.open("HEAD",f.dataUrl,!1),A.send(null),A.status!=200&&A.status!=404)throw new Error("Opening file ".concat(f.fileName," failed: Unexpected return status from server (").concat(A.status,")"));if(A.status==404&&!(e&8||e&16))throw new Error("Opening file ".concat(f.fileName," failed: Cannot write to non-existent file without FILE_FLAGS_FILE_CREATE or FILE_FLAGS_FILE_CREATE_NEW flag."));let E=r._malloc(1),at=new Uint8Array;r.HEAPU8.set(at,E);let wt=r._malloc(3*8);return r.HEAPF64[(wt>>3)+0]=1,r.HEAPF64[(wt>>3)+1]=E,r.HEAPF64[(wt>>3)+2]=new Date().getTime()/1e3,wt}else if(!(e&1))throw new Error("Opening file ".concat(f.fileName," failed: unsupported file flags: ").concat(e));let h=null,w=null;if(!f.forceFullHttpReads&&(f.reliableHeadRequests||!f.allowFullHttpReads))try{let A=new XMLHttpRequest;f.dataProtocol==5?(A.open("HEAD",Je(f.s3Config,f.dataUrl),!1),Ye(A,f.s3Config,f.dataUrl,"HEAD")):A.open("HEAD",f.dataUrl,!1),A.setRequestHeader("Range","bytes=0-"),A.send(null),h=null;try{h=A.getResponseHeader("Content-Length")}catch(E){console.warn("Failed to get Content-Length on request")}if(h!==null&&A.status==206){let E=r._malloc(24);r.HEAPF64[(E>>3)+0]=+h,r.HEAPF64[(E>>3)+1]=0;let at=0;try{at=new Date((n=A.getResponseHeader("Last-Modified"))!=null?n:"").getTime()/1e3}catch(wt){console.warn("Failed to get Last-Modified on request")}return r.HEAPF64[(E>>3)+2]=+at,E}}catch(A){w=A,console.warn("HEAD request with range header failed: ".concat(A))}if(f.allowFullHttpReads){if(!f.forceFullHttpReads){let E=new XMLHttpRequest;f.dataProtocol==5?(E.open("GET",Je(f.s3Config,f.dataUrl),!1),Ye(E,f.s3Config,f.dataUrl,"GET")):E.open("GET",f.dataUrl,!1),E.responseType="arraybuffer",E.setRequestHeader("Range","bytes=0-0"),E.send(null);let at=null;try{at=E.getResponseHeader("Content-Length")}catch(Ot){console.warn("Failed to get Content-Length on request")}let wt=at==null?void 0:at.split("/")[1],Vt=at,mt=null;if(wt!==void 0)mt=wt;else if(!f.reliableHeadRequests){let Ot=new XMLHttpRequest;f.dataProtocol==5?(Ot.open("HEAD",Je(f.s3Config,f.dataUrl),!1),Ye(Ot,f.s3Config,f.dataUrl,"HEAD")):Ot.open("HEAD",f.dataUrl,!1),Ot.setRequestHeader("Range","bytes=0-"),Ot.send(null),h=null;try{h=Ot.getResponseHeader("Content-Length")}catch(yt){console.warn("Failed to get Content-Length on request")}h!==null&&+h>1&&(mt=h)}if(E.status==206&&Vt!==null&&+Vt==1&&mt!==null){let Ot=r._malloc(24);r.HEAPF64[(Ot>>3)+0]=+mt,r.HEAPF64[(Ot>>3)+1]=0;let yt=0;try{yt=new Date((i=E.getResponseHeader("Last-Modified"))!=null?i:"").getTime()/1e3}catch(Gt){console.warn("Failed to get Last-Modified on request")}return r.HEAPF64[(Ot>>3)+2]=+yt,Ot}if(E.status==200&&Vt!==null&&h!==null&&+Vt==+h){console.warn("fall back to full HTTP read for: ".concat(f.dataUrl));let Ot=r._malloc(E.response.byteLength),yt=new Uint8Array(E.response,0,E.response.byteLength);r.HEAPU8.set(yt,Ot);let Gt=r._malloc(3*8);r.HEAPF64[(Gt>>3)+0]=E.response.byteLength,r.HEAPF64[(Gt>>3)+1]=Ot;let Ct=0;try{Ct=new Date((s=E.getResponseHeader("Last-Modified"))!=null?s:"").getTime()/1e3}catch(S){console.warn("Failed to get Last-Modified on request")}return r.HEAPF64[(Gt>>3)+2]=+Ct,Gt}console.warn("falling back to full HTTP read for: ".concat(f.dataUrl))}let A=new XMLHttpRequest;if(f.dataProtocol==5?(A.open("GET",Je(f.s3Config,f.dataUrl),!1),Ye(A,f.s3Config,f.dataUrl,"GET")):A.open("GET",f.dataUrl,!1),A.responseType="arraybuffer",A.send(null),A.status==200){let E=r._malloc(A.response.byteLength),at=new Uint8Array(A.response,0,A.response.byteLength);r.HEAPU8.set(at,E);let wt=r._malloc(3*8);r.HEAPF64[(wt>>3)+0]=A.response.byteLength,r.HEAPF64[(wt>>3)+1]=E;let Vt=0;try{Vt=new Date((a=A.getResponseHeader("Last-Modified"))!=null?a:"").getTime()/1e3}catch(mt){console.warn("Failed to get Last-Modified on request")}return r.HEAPF64[(wt>>3)+2]=+Vt,wt}}if(w!=null)throw new Error("Reading file ".concat(f.fileName," failed with error: ").concat(w));return 0}case 2:{let h=(l=Q._files)==null?void 0:l.get(f.fileName);if(h){let E=r._malloc(24);return r.HEAPF64[(E>>3)+0]=h.size,r.HEAPF64[(E>>3)+1]=0,r.HEAPF64[(E>>3)+2]=0,E}if(e&128)return 0;console.warn("Buffering missing file: ".concat(f.fileName));let w=r._malloc(3*8),A=r._malloc(1);return r.HEAPF64[(w>>3)+0]=1,r.HEAPF64[(w>>3)+1]=A,r.HEAPF64[(w>>3)+2]=0,w}case 3:{let h=(u=Q._files)==null?void 0:u.get(f.fileName);if(!h)throw new Error("No OPFS access handle registered with name: ".concat(f.fileName));e&16&&h.truncate(0);let w=r._malloc(3*8),A=h.getSize();return r.HEAPF64[(w>>3)+0]=A,r.HEAPF64[(w>>3)+1]=0,r.HEAPF64[(w>>3)+2]=0,w}}}catch(f){console.error(f.toString()),qe(r,f.toString())}return 0},glob:(r,t,e)=>{var n;try{let i=nt(r,t,e);if(i.startsWith("http")||i.startsWith("s3://")){let s=new XMLHttpRequest;if(i.startsWith("s3://")){let a=Q.getGlobalFileInfo(r);s.open("HEAD",Je(a==null?void 0:a.s3Config,i),!1),Ye(s,a==null?void 0:a.s3Config,i,"HEAD")}else s.open("HEAD",i,!1);if(s.send(null),s.status!=200&&s.status!==206){if(!((n=Q.getGlobalFileInfo(r))!=null&&n.allowFullHttpReads))return console.log("HEAD request failed: ".concat(i,", with full http reads are disabled")),0;let a=new XMLHttpRequest;if(i.startsWith("s3://")){let u=Q.getGlobalFileInfo(r);a.open("GET",Je(u==null?void 0:u.s3Config,i),!1),Ye(a,u==null?void 0:u.s3Config,i,"HEAD")}else a.open("GET",i,!1);if(a.setRequestHeader("Range","bytes=0-0"),a.send(null),a.status!=200&&a.status!==206)return console.log("HEAD and GET requests failed: ".concat(i)),0;let l=null;try{l=a.getResponseHeader("Content-Length")}catch(u){console.warn("Failed to get Content-Length on request")}l&&+l>1&&console.warn("Range request for ".concat(i," did not return a partial response: ").concat(a.status,' "').concat(a.statusText,'"'))}r.ccall("duckdb_web_fs_glob_add_path",null,["string"],[i])}else for(let[s]of Q._files.entries()||[])s.startsWith(i)&&r.ccall("duckdb_web_fs_glob_add_path",null,["string"],[s])}catch(i){return console.log(i),qe(r,i.toString()),0}},checkFile:(r,t,e)=>{try{let n=nt(r,t,e);if(n.startsWith("http")||n.startsWith("s3://")){let i=new XMLHttpRequest;if(n.startsWith("s3://")){let s=Q.getGlobalFileInfo(r);i.open("HEAD",Je(s==null?void 0:s.s3Config,n),!1),Ye(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}else return Q._files.has(n)}catch(n){return console.log(n),!1}return!1},syncFile:(r,t)=>{},closeFile:(r,t)=>{var n;let e=Q.getFileInfo(r,t);Q._fileInfoCache.delete(t);try{switch(e==null?void 0:e.dataProtocol){case 0:case 4:case 5:break;case 1:case 2:return;case 3:{let i=(n=Q._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()}}}catch(i){console.log(i),qe(r,i.toString())}},dropFile:(r,t,e)=>{var s;let n=nt(r,t,e),i=(s=Q._files)==null?void 0:s.get(n);if(i){if(Q._files.delete(n),i instanceof FileSystemSyncAccessHandle)try{i.flush(),i.close()}catch(a){throw new Error("Cannot drop file with name: ".concat(n))}i instanceof Blob}},truncateFile:(r,t,e)=>{var i;let n=Q.getFileInfo(r,t);switch(n==null?void 0:n.dataProtocol){case 4:qe(r,"Cannot truncate a http file");return;case 5:qe(r,"Cannot truncate an s3 file");return;case 0:case 1:case 2:qe(r,"truncateFile not implemented");return;case 3:{let s=(i=Q._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;if(n==0)return 0;try{let a=Q.getFileInfo(r,t);switch(a==null?void 0:a.dataProtocol){case 4:case 5:{if(!a.dataUrl)throw new Error("Missing data URL for file ".concat(t));try{let l=new XMLHttpRequest;if(a.dataProtocol==5?(l.open("GET",Je(a==null?void 0:a.s3Config,a.dataUrl),!1),Ye(l,a==null?void 0:a.s3Config,a.dataUrl,"GET")):l.open("GET",a.dataUrl,!1),l.responseType="arraybuffer",l.setRequestHeader("Range","bytes=".concat(i,"-").concat(i+n-1)),l.send(null),l.status==206||l.status==200&&n==l.response.byteLength&&i==0){let u=new Uint8Array(l.response,0,Math.min(l.response.byteLength,n));return r.HEAPU8.set(u,e),u.byteLength}else if(l.status==200){console.warn("Range request for ".concat(a.dataUrl," did not return a partial response: ").concat(l.status,' "').concat(l.statusText,'"'));let u=new Uint8Array(l.response,i,Math.min(l.response.byteLength-i,n));return r.HEAPU8.set(u,e),u.byteLength}else throw new Error("Range request for ".concat(a.dataUrl," did returned non-success status: ").concat(l.status,' "').concat(l.statusText,'"'))}catch(l){throw console.log(l),new Error("Range request for ".concat(a.dataUrl," failed with error: ").concat(l,'"'))}}case 2:{let l=(s=Q._files)==null?void 0:s.get(a.fileName);if(!l)throw new Error("No HTML5 file registered with name: ".concat(a.fileName));let u=l.slice(i,i+n),f=new Uint8Array(new FileReaderSync().readAsArrayBuffer(u));return r.HEAPU8.set(f,e),f.byteLength}case 3:{let l=Q._files.get(a.fileName);if(!l)throw new Error("No OPFS access handle registered with name: ".concat(a.fileName));let u=r.HEAPU8.subarray(e,e+n);return l.read(u,{at:i})}}return 0}catch(a){return console.log(a),qe(r,a.toString()),0}},writeFile:(r,t,e,n,i)=>{var a;let s=Q.getFileInfo(r,t);switch(s==null?void 0:s.dataProtocol){case 4:return qe(r,"Cannot write to HTTP file"),0;case 5:{let l=r.HEAPU8.subarray(e,e+n),u=new XMLHttpRequest;return u.open("PUT",Je(s==null?void 0:s.s3Config,s.dataUrl),!1),Ye(u,s==null?void 0:s.s3Config,s.dataUrl,"PUT","",l),u.send(l),u.status!==200?(qe(r,"Failed writing file: HTTP "+u.status),0):n}case 2:return qe(r,"cannot write using the html5 file reader api"),0;case 3:{let l=(a=Q._files)==null?void 0:a.get(s.fileName);if(!l)throw new Error("No OPFS access handle registered with name: ".concat(s.fileName));let u=r.HEAPU8.subarray(e,e+n);return l.write(u,{at:i})}}return 0},getLastFileModificationTime:(r,t)=>{var n;let e=Q.getFileInfo(r,t);switch(e==null?void 0:e.dataProtocol){case 2:{if(!((n=Q._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()/1e3}return 0},progressUpdate:(r,t,e)=>{postMessage&&postMessage({requestId:0,type:"PROGRESS_UPDATE",data:{status:r?"completed":"in-progress",percentage:t,repetitions:e}})},checkDirectory:(r,t,e)=>{let n=nt(r,t,e);return console.log("checkDirectory: ".concat(n)),!1},createDirectory:(r,t,e)=>{let n=nt(r,t,e);console.log("createDirectory: ".concat(n))},removeDirectory:(r,t,e)=>{let n=nt(r,t,e);console.log("removeDirectory: ".concat(n))},listDirectoryEntries:(r,t,e)=>{let n=nt(r,t,e);return console.log("listDirectoryEntries: ".concat(n)),!1},moveFile:(r,t,e,n,i)=>{var u,f;let s=nt(r,t,e),a=nt(r,n,i),l=(u=Q._files)==null?void 0:u.get(s);l!==void 0&&(Q._files.delete(l),Q._files.set(a,l));for(let[h,w]of((f=Q._fileInfoCache)==null?void 0:f.entries())||[])if(w.dataUrl==s){Q._fileInfoCache.delete(h);break}return!0},removeFile:(r,t,e)=>{},callScalarUDF:(r,t,e,n,i,s,a)=>{tf(Q,r,t,e,n,i,s,a)}};var Yl=class extends ma{postMessage(t,e){globalThis.postMessage(t,e)}async instantiate(t,e,n){return await new ga(this,Q,t,e).instantiate(n)}};function wf(){let r=new Yl;globalThis.onmessage=async t=>{await r.onMessage(t.data)}}wf();return Dm(nb);})();
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
js-sha256/src/sha256.js:
|