precision-dashwidgets 0.2.0 → 0.2.1
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.
|
@@ -3207,7 +3207,7 @@ const hu = { class: "data-explorer-wrap" }, pu = { class: "data-explorer-info" }
|
|
|
3207
3207
|
for (const [r, a] of t)
|
|
3208
3208
|
n[r] = a;
|
|
3209
3209
|
return n;
|
|
3210
|
-
}, wu = /* @__PURE__ */ zn(du, [["__scopeId", "data-v-
|
|
3210
|
+
}, wu = /* @__PURE__ */ zn(du, [["__scopeId", "data-v-2908b590"]]), vu = { class: "umap-wrap" }, mu = /* @__PURE__ */ Object.assign({
|
|
3211
3211
|
inheritAttrs: !1
|
|
3212
3212
|
}, {
|
|
3213
3213
|
__name: "Umap",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
SELECT min(${dt(p)}) AS xmin, max(${dt(p)}) AS xmax,
|
|
37
37
|
min(${dt(g)}) AS ymin, max(${dt(g)}) AS ymax
|
|
38
38
|
FROM ${N.value}
|
|
39
|
-
`,S=((O=await E.executeQuery(I,T.value))==null?void 0:O[0])||{xmin:-1,xmax:1,ymin:-1,ymax:1};d.value={schema:[{name:p},{name:g},...m.map(A=>({name:A}))],row_groups:[{columns:[{meta_data:{statistics:{min_value:S.xmin,max_value:S.xmax}}},{meta_data:{statistics:{min_value:S.ymin,max_value:S.ymax}}}]}]}}async function bt(p,g,u){_.value=new Map;const m=["#4269d0","#efb118","#ff725c","#6cc5b0","#3ca951","#ff8ab7","#a463f2","#97bbf5","#9c6b4e","#9498a0"],b=w=>/DOUBLE|HUGEINT|BIGINT|INTEGER|DECIMAL|FLOAT|REAL/i.test(w);for(const w of p){if(w.name===g||w.name===u){_.value.set(w.name,new Map);continue}if(b(w.type))_.value.set(w.name,new Map);else{const I=`SELECT DISTINCT ${dt(w.name)} AS v FROM ${N.value} LIMIT 10000`,S=(await E.executeQuery(I,T.value)).map(A=>A.v).filter(A=>A!=null),O=new Map;S.forEach((A,M)=>O.set(A,Zt(m[M%m.length]))),_.value.set(w.name,O)}}(d.value||(d.value={})).key_value_metadata=Array.from(_.value.keys()).map(w=>{var I;return{key:w,value:JSON.stringify(Array.from(((I=_.value.get(w))==null?void 0:I.keys())??[]))}}),r.value!=="random"&&!_.value.has(r.value)&&(r.value="random")}async function gt(){const{useGetToken:p}=await Promise.resolve().then(()=>Bc);return p()}async function It(p,g){const u=await gt(),m=`${g}/packages/${p}/view?api_key=${u}`,b=await fetch(m);if(!b.ok)throw new Error(`view failed: ${b.status}`);v.value=await b.json()}async function $t(p,g,u){const m=await gt(),b=`${u}/packages/${p}/files/${g}?api_key=${m}`,w=await fetch(b);if(!w.ok)throw new Error(`file url failed: ${w.status}`);return(await w.json()).url}function dt(p){return`"${p.replace(/"/g,'""')}"`}function ht(){o.value=!o.value,l.value++}function Zt(p){try{if(!p||p.length<7)return[1,0,0];const g=parseInt(p.slice(1,3),16)/255,u=parseInt(p.slice(3,5),16)/255,m=parseInt(p.slice(5,7),16)/255;return Number.isNaN(g)||Number.isNaN(u)||Number.isNaN(m)?[1,0,0]:[g,u,m]}catch{return[1,0,0]}}function R(p){y.value=p[1]}async function F(p){return(await E.executeQuery(`PRAGMA table_info(${p});`,T.value)).map(g=>({name:g.name,type:g.type}))}return h.onMounted(async()=>{await B()}),h.onBeforeUnmount(async()=>{T.value&&await E.closeConnection(T.value)}),(p,g)=>(h.openBlock(),h.createElementBlock("div",ep,[(h.openBlock(),h.createBlock(qf,{data:c.value,metaData:d.value,pointCount:n.value,"color-map":y.value,colorMode:r.value,startColor:i.value,endColor:s.value,singleColor:a.value,forceRegenerate:o.value,key:l.value},null,8,["data","metaData","pointCount","color-map","colorMode","startColor","endColor","singleColor","forceRegenerate"])),h.createVNode(tp,{pointCount:n.value,"onUpdate:pointCount":g[0]||(g[0]=u=>n.value=u),colorMode:r.value,"onUpdate:colorMode":g[1]||(g[1]=u=>r.value=u),startColor:i.value,"onUpdate:startColor":g[2]||(g[2]=u=>i.value=u),endColor:s.value,"onUpdate:endColor":g[3]||(g[3]=u=>s.value=u),singleColor:a.value,"onUpdate:singleColor":g[4]||(g[4]=u=>a.value=u),"color-scheme":y.value,"color-map-map":_.value,onRegenerate:ht,onUpdateColorMap:R},null,8,["pointCount","colorMode","startColor","endColor","singleColor","color-scheme","color-map-map"])]))}}),rp=Sn(np,[["__scopeId","data-v-244cd07d"]]),ip="dashboard:globalVars";function La(e=!1){const t=h.inject(ip,null);return!t&&e&&console.warn("[Widget] dashboard:globalVars not provided."),t}const sp={class:"data-explorer-wrap"},ap={class:"data-explorer-info"},op=h.defineComponent({inheritAttrs:!1,__name:"DataExplorer",setup(e){const t=La(),n=h.ref("Data Explorer"),r=h.computed(()=>h.unref(t.s3Url));return h.watchEffect(()=>{}),(i,s)=>{const a=h.resolveComponent("el-icon");return h.openBlock(),h.createElementBlock(h.Fragment,null,[h.renderSlot(i.$slots,"default",{widgetName:n.value},void 0,!0),h.createElementVNode("div",sp,[h.createElementVNode("div",ap,[h.createVNode(h.unref(Pc.ElTooltip),{placement:"top-start"},{content:h.withCtx(()=>[...s[0]||(s[0]=[h.createTextVNode("Type in a query or use the suggested query buttons to run on your csv file",-1)])]),default:h.withCtx(()=>[h.createVNode(a,{color:"#8300BF"},{default:h.withCtx(()=>[h.createVNode(h.unref(jc))]),_:1})]),_:1})]),h.createVNode(h.unref(yu),{srcUrl:r.value},null,8,["srcUrl"])])],64)}}}),xa=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},lp=xa(op,[["__scopeId","data-v-08f7f19e"]]),cp={class:"umap-wrap"},up=xa(Object.assign({inheritAttrs:!1},{__name:"Umap",setup(e){const t=La(),n=h.ref("Data Explorer"),r=h.computed(()=>h.unref(t==null?void 0:t.s3Url));return(i,s)=>(h.openBlock(),h.createElementBlock(h.Fragment,null,[h.renderSlot(i.$slots,"default",{widgetName:n.value},void 0,!0),h.createElementVNode("div",cp,[h.createVNode(h.unref(rp),{srcUrl:r.value},null,8,["srcUrl"])])],64))}}),[["__scopeId","data-v-c778c86e"]]);function Y(e,t,n,r){function i(s){return s instanceof n?s:new n(function(a){a(s)})}return new(n||(n=Promise))(function(s,a){function o(d){try{c(r.next(d))}catch(y){a(y)}}function l(d){try{c(r.throw(d))}catch(y){a(y)}}function c(d){d.done?s(d.value):i(d.value).then(o,l)}c((r=r.apply(e,t||[])).next())})}function Ua(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function W(e){return this instanceof W?(this.v=e,this):new W(e)}function re(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",a),i[Symbol.asyncIterator]=function(){return this},i;function a(v){return function(E){return Promise.resolve(E).then(v,y)}}function o(v,E){r[v]&&(i[v]=function(T){return new Promise(function(N,B){s.push([v,T,N,B])>1||l(v,T)})},E&&(i[v]=E(i[v])))}function l(v,E){try{c(r[v](E))}catch(T){_(s[0][3],T)}}function c(v){v.value instanceof W?Promise.resolve(v.value.v).then(d,y):_(s[0][2],v)}function d(v){l("next",v)}function y(v){l("throw",v)}function _(v,E){v(E),s.shift(),s.length&&l(s[0][0],s[0][1])}}function Sr(e){var t,n;return t={},r("next"),r("throw",function(i){throw i}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(i,s){t[i]=e[i]?function(a){return(n=!n)?{value:W(e[i](a)),done:!1}:s?s(a):a}:s}}function je(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Ua=="function"?Ua(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=e[s]&&function(a){return new Promise(function(o,l){a=e[s](a),i(o,l,a.done,a.value)})}}function i(s,a,o,l){Promise.resolve(l).then(function(c){s({value:c,done:o})},a)}}const hp=new TextDecoder("utf-8"),Pi=e=>hp.decode(e),dp=new TextEncoder,Vi=e=>dp.encode(e),fp=e=>typeof e=="number",Ca=e=>typeof e=="boolean",_t=e=>typeof e=="function",Dt=e=>e!=null&&Object(e)===e,Ye=e=>Dt(e)&&_t(e.then),Ln=e=>Dt(e)&&_t(e[Symbol.iterator]),Ze=e=>Dt(e)&&_t(e[Symbol.asyncIterator]),zi=e=>Dt(e)&&Dt(e.schema),ka=e=>Dt(e)&&"done"in e&&"value"in e,$a=e=>Dt(e)&&_t(e.stat)&&fp(e.fd),Pa=e=>Dt(e)&&ji(e.body),Er=e=>"_getDOMStream"in e&&"_getNodeStream"in e,pp=e=>Dt(e)&&_t(e.abort)&&_t(e.getWriter)&&!Er(e),ji=e=>Dt(e)&&_t(e.cancel)&&_t(e.getReader)&&!Er(e),yp=e=>Dt(e)&&_t(e.end)&&_t(e.write)&&Ca(e.writable)&&!Er(e),Va=e=>Dt(e)&&_t(e.read)&&_t(e.pipe)&&Ca(e.readable)&&!Er(e),mp=e=>Dt(e)&&_t(e.clear)&&_t(e.bytes)&&_t(e.position)&&_t(e.setPosition)&&_t(e.capacity)&&_t(e.getBufferIdentifier)&&_t(e.createLong),Yi=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function bp(e){const t=e[0]?[e[0]]:[];let n,r,i,s;for(let a,o,l=0,c=0,d=e.length;++l<d;){if(a=t[c],o=e[l],!a||!o||a.buffer!==o.buffer||o.byteOffset<a.byteOffset){o&&(t[++c]=o);continue}if({byteOffset:n,byteLength:i}=a,{byteOffset:r,byteLength:s}=o,n+i<r||r+s<n){o&&(t[++c]=o);continue}t[c]=new Uint8Array(a.buffer,n,r-n+s)}return t}function za(e,t,n=0,r=t.byteLength){const i=e.byteLength,s=new Uint8Array(e.buffer,e.byteOffset,i),a=new Uint8Array(t.buffer,t.byteOffset,Math.min(r,i));return s.set(a,n),e}function ie(e,t){const n=bp(e),r=n.reduce((d,y)=>d+y.byteLength,0);let i,s,a,o=0,l=-1;const c=Math.min(t||Number.POSITIVE_INFINITY,r);for(const d=n.length;++l<d;){if(i=n[l],s=i.subarray(0,Math.min(i.length,c-o)),c<=o+s.length){s.length<i.length?n[l]=i.subarray(s.length):s.length===i.length&&l++,a?za(a,s,o):a=s;break}za(a||(a=new Uint8Array(c)),s,o),o+=s.length}return[a||new Uint8Array(0),n.slice(l),r-(a?a.byteLength:0)]}function at(e,t){let n=ka(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n=="string"&&(n=Vi(n)),n instanceof ArrayBuffer?new e(n):n instanceof Yi?new e(n):mp(n)?at(e,n.bytes()):ArrayBuffer.isView(n)?n.byteLength<=0?new e(0):new e(n.buffer,n.byteOffset,n.byteLength/e.BYTES_PER_ELEMENT):e.from(n)):new e(0)}const xn=e=>at(Int32Array,e),ja=e=>at(BigInt64Array,e),H=e=>at(Uint8Array,e),Wi=e=>(e.next(),e);function*gp(e,t){const n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Yi?n(t):Ln(t)?t:n(t);return yield*Wi(function*(i){let s=null;do s=i.next(yield at(e,s));while(!s.done)}(r[Symbol.iterator]())),new e}const _p=e=>gp(Uint8Array,e);function Ya(e,t){return re(this,arguments,function*(){if(Ye(t))return yield W(yield W(yield*Sr(je(Ya(e,yield W(t))))));const n=function(s){return re(this,arguments,function*(){yield yield W(yield W(s))})},r=function(s){return re(this,arguments,function*(){yield W(yield*Sr(je(Wi(function*(a){let o=null;do o=a.next(yield o==null?void 0:o.value);while(!o.done)}(s[Symbol.iterator]())))))})},i=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Yi?n(t):Ln(t)?r(t):Ze(t)?t:n(t);return yield W(yield*Sr(je(Wi(function(s){return re(this,arguments,function*(){let a=null;do a=yield W(s.next(yield yield W(at(e,a))));while(!a.done)})}(i[Symbol.asyncIterator]()))))),yield W(new e)})}const vp=e=>Ya(Uint8Array,e);function Wa(e,t,n){if(e!==0){n=n.slice(0,t);for(let r=-1,i=n.length;++r<i;)n[r]+=e}return n.subarray(0,t)}function wp(e,t){let n=0;const r=e.length;if(r!==t.length)return!1;if(r>0)do if(e[n]!==t[n])return!1;while(++n<r);return!0}const Pt={fromIterable(e){return Tr(Ip(e))},fromAsyncIterable(e){return Tr(Sp(e))},fromDOMStream(e){return Tr(Ep(e))},fromNodeStream(e){return Tr(Ap(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},Tr=e=>(e.next(),e);function*Ip(e){let t,n=!1,r=[],i,s,a,o=0;function l(){return s==="peek"?ie(r,a)[0]:([i,r,o]=ie(r,a),i)}({cmd:s,size:a}=(yield null)||{cmd:"read",size:0});const c=_p(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(a-o)?c.next():c.next(a-o),!t&&i.byteLength>0&&(r.push(i),o+=i.byteLength),t||a<=o)do({cmd:s,size:a}=yield l());while(a<o);while(!t)}catch(d){(n=!0)&&typeof c.throw=="function"&&c.throw(d)}finally{n===!1&&typeof c.return=="function"&&c.return(null)}return null}function Sp(e){return re(this,arguments,function*(){let t,n=!1,r=[],i,s,a,o=0;function l(){return s==="peek"?ie(r,a)[0]:([i,r,o]=ie(r,a),i)}({cmd:s,size:a}=(yield yield W(null))||{cmd:"read",size:0});const c=vp(e)[Symbol.asyncIterator]();try{do if({done:t,value:i}=Number.isNaN(a-o)?yield W(c.next()):yield W(c.next(a-o)),!t&&i.byteLength>0&&(r.push(i),o+=i.byteLength),t||a<=o)do({cmd:s,size:a}=yield yield W(l()));while(a<o);while(!t)}catch(d){(n=!0)&&typeof c.throw=="function"&&(yield W(c.throw(d)))}finally{n===!1&&typeof c.return=="function"&&(yield W(c.return(new Uint8Array(0))))}return yield W(null)})}function Ep(e){return re(this,arguments,function*(){let t=!1,n=!1,r=[],i,s,a,o=0;function l(){return s==="peek"?ie(r,a)[0]:([i,r,o]=ie(r,a),i)}({cmd:s,size:a}=(yield yield W(null))||{cmd:"read",size:0});const c=new Tp(e);try{do if({done:t,value:i}=Number.isNaN(a-o)?yield W(c.read()):yield W(c.read(a-o)),!t&&i.byteLength>0&&(r.push(H(i)),o+=i.byteLength),t||a<=o)do({cmd:s,size:a}=yield yield W(l()));while(a<o);while(!t)}catch(d){(n=!0)&&(yield W(c.cancel(d)))}finally{n===!1?yield W(c.cancel()):e.locked&&c.releaseLock()}return yield W(null)})}class Tp{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 Y(this,void 0,void 0,function*(){const{reader:n,source:r}=this;n&&(yield n.cancel(t).catch(()=>{})),r&&r.locked&&this.releaseLock()})}read(t){return Y(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};const n=yield this.reader.read();return!n.done&&(n.value=H(n)),n})}}const qi=(e,t)=>{const n=i=>r([t,i]);let r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function Ap(e){return re(this,arguments,function*(){const t=[];let n="error",r=!1,i=null,s,a,o=0,l=[],c;function d(){return s==="peek"?ie(l,a)[0]:([c,l,o]=ie(l,a),c)}if({cmd:s,size:a}=(yield yield W(null))||{cmd:"read",size:0},e.isTTY)return yield yield W(new Uint8Array(0)),yield W(null);try{t[0]=qi(e,"end"),t[1]=qi(e,"error");do{if(t[2]=qi(e,"readable"),[n,i]=yield W(Promise.race(t.map(_=>_[2]))),n==="error")break;if((r=n==="end")||(Number.isFinite(a-o)?(c=H(e.read(a-o)),c.byteLength<a-o&&(c=H(e.read()))):c=H(e.read()),c.byteLength>0&&(l.push(c),o+=c.byteLength)),r||a<=o)do({cmd:s,size:a}=yield yield W(d()));while(a<o)}while(!r)}finally{yield W(y(t,n==="error"?i:null))}return yield W(null);function y(_,v){return c=l=null,new Promise((E,T)=>{for(const[N,B]of _)e.off(N,B);try{const N=e.destroy;N&&N.call(e,v),v=void 0}catch(N){v=N||v}finally{v!=null?T(v):E()}})}})}var yt;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(yt||(yt={}));var Et;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(Et||(Et={}));var Tt;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Tt||(Tt={}));var Vt;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Vt||(Vt={}));var k;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(k||(k={}));var se;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(se||(se={}));const Gi=2,ae=4,ge=4,Z=4,Be=new Int32Array(2),qa=new Float32Array(Be.buffer),Ga=new Float64Array(Be.buffer),Ar=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Hi;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(Hi||(Hi={}));let tn=class kc{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new kc(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 Be[0]=this.readInt32(t),qa[0]}readFloat64(t){return Be[Ar?0:1]=this.readInt32(t),Be[Ar?1:0]=this.readInt32(t+4),Ga[0]}writeInt8(t,n){this.bytes_[t]=n}writeUint8(t,n){this.bytes_[t]=n}writeInt16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeUint16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeInt32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeUint32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeInt64(t,n){this.writeInt32(t,Number(BigInt.asIntN(32,n))),this.writeInt32(t+4,Number(BigInt.asIntN(32,n>>BigInt(32))))}writeUint64(t,n){this.writeUint32(t,Number(BigInt.asUintN(32,n))),this.writeUint32(t+4,Number(BigInt.asUintN(32,n>>BigInt(32))))}writeFloat32(t,n){qa[0]=n,this.writeInt32(t,Be[0])}writeFloat64(t,n){Ga[0]=n,this.writeInt32(t,Be[Ar?0:1]),this.writeInt32(t+4,Be[Ar?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+ae+ge)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let n=0;n<ge;n++)t+=String.fromCharCode(this.readInt8(this.position_+ae+n));return t}__offset(t,n){const r=t-this.readInt32(t);return n<this.readInt16(r)?this.readInt16(r+n):0}__union(t,n){return t.bb_pos=n+this.readInt32(n),t.bb=this,t}__string(t,n){t+=this.readInt32(t);const r=this.readInt32(t);t+=ae;const i=this.bytes_.subarray(t,t+r);return n===Hi.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,n){return typeof t=="string"?this.__string(n):this.__union(t,n)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+ae}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=ge)throw new Error("FlatBuffers: file identifier must be length "+ge);for(let n=0;n<ge;n++)if(t.charCodeAt(n)!=this.readInt8(this.position()+ae+n))return!1;return!0}createScalarList(t,n){const r=[];for(let i=0;i<n;++i){const s=t(i);s!==null&&r.push(s)}return r}createObjList(t,n){const r=[];for(let i=0;i<n;++i){const s=t(i);s!==null&&r.push(s.unpack())}return r}},Ha=class $c{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 n;t?n=t:n=1024,this.bb=tn.allocate(n),this.space=n}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,n){t>this.minalign&&(this.minalign=t);const r=~(this.bb.capacity()-this.space+n)+1&t-1;for(;this.space<r+t+n;){const i=this.bb.capacity();this.bb=$c.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(r)}pad(t){for(let n=0;n<t;n++)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,n,r){(this.force_defaults||n!=r)&&(this.addInt8(n),this.slot(t))}addFieldInt16(t,n,r){(this.force_defaults||n!=r)&&(this.addInt16(n),this.slot(t))}addFieldInt32(t,n,r){(this.force_defaults||n!=r)&&(this.addInt32(n),this.slot(t))}addFieldInt64(t,n,r){(this.force_defaults||n!==r)&&(this.addInt64(n),this.slot(t))}addFieldFloat32(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat32(n),this.slot(t))}addFieldFloat64(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat64(n),this.slot(t))}addFieldOffset(t,n,r){(this.force_defaults||n!=r)&&(this.addOffset(n),this.slot(t))}addFieldStruct(t,n,r){n!=r&&(this.nested(n),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){const n=t.capacity();if(n&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const r=n<<1,i=tn.allocate(r);return i.setPosition(r-n),i.bytes().set(t.bytes(),r-n),i}addOffset(t){this.prep(ae,0),this.writeInt32(this.offset()-t+ae)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let n=0;n<t;n++)this.vtable[n]=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);const t=this.offset();let n=this.vtable_in_use-1;for(;n>=0&&this.vtable[n]==0;n--);const r=n+1;for(;n>=0;n--)this.addInt16(this.vtable[n]!=0?t-this.vtable[n]:0);const i=2;this.addInt16(t-this.object_start);const s=(r+i)*Gi;this.addInt16(s);let a=0;const o=this.space;t:for(n=0;n<this.vtables.length;n++){const l=this.bb.capacity()-this.vtables[n];if(s==this.bb.readInt16(l)){for(let c=Gi;c<s;c+=Gi)if(this.bb.readInt16(o+c)!=this.bb.readInt16(l+c))continue t;a=this.vtables[n];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,n,r){const i=r?Z:0;if(n){const s=n;if(this.prep(this.minalign,ae+ge+i),s.length!=ge)throw new TypeError("FlatBuffers: file identifier must be length "+ge);for(let a=ge-1;a>=0;a--)this.writeInt8(s.charCodeAt(a))}this.prep(this.minalign,ae+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,n){this.finish(t,n,!0)}requiredField(t,n){const r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(!(n<this.bb.readInt16(i)&&this.bb.readInt16(i+n)!=0))throw new TypeError("FlatBuffers: field "+n+" must be set")}startVector(t,n,r){this.notNested(),this.vector_num_elems=n,this.prep(ae,t*n),this.prep(r,t*n)}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);const n=this.createString(t);return this.string_maps.set(t,n),n}createString(t){if(t==null)return 0;let n;return t instanceof Uint8Array?n=t:n=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,n.length,1),this.bb.setPosition(this.space-=n.length),this.bb.bytes().set(n,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){const n=[];for(let r=0;r<t.length;++r){const i=t[r];if(i!==null)n.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return n}createStructOffsetList(t,n){return n(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var Nr;(function(e){e[e.BUFFER=0]="BUFFER"})(Nr||(Nr={}));var Br;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(Br||(Br={}));class Re{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBodyCompression(t,n){return(n||new Re).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,n){return t.setPosition(t.position()+Z),(n||new Re).__init(t.readInt32(t.position())+t.position(),t)}codec(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Br.LZ4_FRAME}method(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Nr.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,n){t.addFieldInt8(0,n,Br.LZ4_FRAME)}static addMethod(t,n){t.addFieldInt8(1,n,Nr.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,n,r){return Re.startBodyCompression(t),Re.addCodec(t,n),Re.addMethod(t,r),Re.endBodyCompression(t)}}class Ka{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,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,n,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(n??0)),t.offset()}}let Qa=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(e,t,n){return e.prep(8,16),e.writeInt64(BigInt(n??0)),e.writeInt64(BigInt(t??0)),e.offset()}},_e=class Vs{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsRecordBatch(t,n){return(n||new Vs).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,n){return t.setPosition(t.position()+Z),(n||new Vs).__init(t.readInt32(t.position())+t.position(),t)}length(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,n){const r=this.bb.__offset(this.bb_pos,6);return r?(n||new Qa).__init(this.bb.__vector(this.bb_pos+r)+t*16,this.bb):null}nodesLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,n){const r=this.bb.__offset(this.bb_pos,8);return r?(n||new Ka).__init(this.bb.__vector(this.bb_pos+r)+t*16,this.bb):null}buffersLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){const n=this.bb.__offset(this.bb_pos,10);return n?(t||new Re).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addNodes(t,n){t.addFieldOffset(1,n,0)}static startNodesVector(t,n){t.startVector(16,n,8)}static addBuffers(t,n){t.addFieldOffset(2,n,0)}static startBuffersVector(t,n){t.startVector(16,n,8)}static addCompression(t,n){t.addFieldOffset(3,n,0)}static endRecordBatch(t){return t.endObject()}},en=class zs{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryBatch(t,n){return(n||new zs).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,n){return t.setPosition(t.position()+Z),(n||new zs).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){const n=this.bb.__offset(this.bb_pos,6);return n?(t||new _e).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}isDelta(){const 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,n){t.addFieldInt64(0,n,BigInt("0"))}static addData(t,n){t.addFieldOffset(1,n,0)}static addIsDelta(t,n){t.addFieldInt8(2,+n,0)}static endDictionaryBatch(t){return t.endObject()}};var nn;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(nn||(nn={}));var Rr;(function(e){e[e.DenseArray=0]="DenseArray"})(Rr||(Rr={}));class Ut{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInt(t,n){return(n||new Ut).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,n){return t.setPosition(t.position()+Z),(n||new Ut).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){const 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,n){t.addFieldInt32(0,n,0)}static addIsSigned(t,n){t.addFieldInt8(1,+n,0)}static endInt(t){return t.endObject()}static createInt(t,n,r){return Ut.startInt(t),Ut.addBitWidth(t,n),Ut.addIsSigned(t,r),Ut.endInt(t)}}class ve{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryEncoding(t,n){return(n||new ve).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,n){return t.setPosition(t.position()+Z),(n||new ve).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){const n=this.bb.__offset(this.bb_pos,6);return n?(t||new Ut).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}isOrdered(){const t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):Rr.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addIndexType(t,n){t.addFieldOffset(1,n,0)}static addIsOrdered(t,n){t.addFieldInt8(2,+n,0)}static addDictionaryKind(t,n){t.addFieldInt16(3,n,Rr.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}class vt{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsKeyValue(t,n){return(n||new vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,n){return t.setPosition(t.position()+Z),(n||new vt).__init(t.readInt32(t.position())+t.position(),t)}key(t){const n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}value(t){const n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,n){t.addFieldOffset(0,n,0)}static addValue(t,n){t.addFieldOffset(1,n,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,n,r){return vt.startKeyValue(t),vt.addKey(t,n),vt.addValue(t,r),vt.endKeyValue(t)}}let Xa=class Xn{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBinary(t,n){return(n||new Xn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,n){return t.setPosition(t.position()+Z),(n||new Xn).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return Xn.startBinary(t),Xn.endBinary(t)}},Ja=class Jn{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBool(t,n){return(n||new Jn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,n){return t.setPosition(t.position()+Z),(n||new Jn).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return Jn.startBool(t),Jn.endBool(t)}},Or=class gn{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDate(t,n){return(n||new gn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,n){return t.setPosition(t.position()+Z),(n||new gn).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Vt.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Vt.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,n){return gn.startDate(t),gn.addUnit(t,n),gn.endDate(t)}},rn=class Ue{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDecimal(t,n){return(n||new Ue).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,n){return t.setPosition(t.position()+Z),(n||new Ue).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){const 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,n){t.addFieldInt32(0,n,0)}static addScale(t,n){t.addFieldInt32(1,n,0)}static addBitWidth(t,n){t.addFieldInt32(2,n,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,n,r,i){return Ue.startDecimal(t),Ue.addPrecision(t,n),Ue.addScale(t,r),Ue.addBitWidth(t,i),Ue.endDecimal(t)}},Dr=class _n{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDuration(t,n){return(n||new _n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,n){return t.setPosition(t.position()+Z),(n||new _n).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):k.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,k.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,n){return _n.startDuration(t),_n.addUnit(t,n),_n.endDuration(t)}},Fr=class vn{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFixedSizeBinary(t,n){return(n||new vn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,n){return t.setPosition(t.position()+Z),(n||new vn).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){const 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,n){t.addFieldInt32(0,n,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,n){return vn.startFixedSizeBinary(t),vn.addByteWidth(t,n),vn.endFixedSizeBinary(t)}},Mr=class wn{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFixedSizeList(t,n){return(n||new wn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,n){return t.setPosition(t.position()+Z),(n||new wn).__init(t.readInt32(t.position())+t.position(),t)}listSize(){const 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,n){t.addFieldInt32(0,n,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,n){return wn.startFixedSizeList(t),wn.addListSize(t,n),wn.endFixedSizeList(t)}};class oe{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFloatingPoint(t,n){return(n||new oe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,n){return t.setPosition(t.position()+Z),(n||new oe).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Tt.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,n){t.addFieldInt16(0,n,Tt.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,n){return oe.startFloatingPoint(t),oe.addPrecision(t,n),oe.endFloatingPoint(t)}}class le{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInterval(t,n){return(n||new le).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,n){return t.setPosition(t.position()+Z),(n||new le).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):se.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,se.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,n){return le.startInterval(t),le.addUnit(t,n),le.endInterval(t)}}let Za=class Zn{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsLargeBinary(t,n){return(n||new Zn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,n){return t.setPosition(t.position()+Z),(n||new Zn).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return Zn.startLargeBinary(t),Zn.endLargeBinary(t)}},to=class tr{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsLargeUtf8(t,n){return(n||new tr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,n){return t.setPosition(t.position()+Z),(n||new tr).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return tr.startLargeUtf8(t),tr.endLargeUtf8(t)}},eo=class er{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsList(t,n){return(n||new er).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,n){return t.setPosition(t.position()+Z),(n||new er).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return er.startList(t),er.endList(t)}},Lr=class In{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMap(t,n){return(n||new In).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,n){return t.setPosition(t.position()+Z),(n||new In).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){const 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,n){t.addFieldInt8(0,+n,0)}static endMap(t){return t.endObject()}static createMap(t,n){return In.startMap(t),In.addKeysSorted(t,n),In.endMap(t)}},no=class nr{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsNull(t,n){return(n||new nr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,n){return t.setPosition(t.position()+Z),(n||new nr).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return nr.startNull(t),nr.endNull(t)}};class We{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsStruct_(t,n){return(n||new We).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,n){return t.setPosition(t.position()+Z),(n||new We).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return We.startStruct_(t),We.endStruct_(t)}}class zt{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsTime(t,n){return(n||new zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,n){return t.setPosition(t.position()+Z),(n||new zt).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):k.MILLISECOND}bitWidth(){const 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,n){t.addFieldInt16(0,n,k.MILLISECOND)}static addBitWidth(t,n){t.addFieldInt32(1,n,32)}static endTime(t){return t.endObject()}static createTime(t,n,r){return zt.startTime(t),zt.addUnit(t,n),zt.addBitWidth(t,r),zt.endTime(t)}}class jt{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsTimestamp(t,n){return(n||new jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,n){return t.setPosition(t.position()+Z),(n||new jt).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):k.SECOND}timezone(t){const n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,n){t.addFieldInt16(0,n,k.SECOND)}static addTimezone(t,n){t.addFieldOffset(1,n,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,n,r){return jt.startTimestamp(t),jt.addUnit(t,n),jt.addTimezone(t,r),jt.endTimestamp(t)}}class Ft{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUnion(t,n){return(n||new Ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,n){return t.setPosition(t.position()+Z),(n||new Ft).__init(t.readInt32(t.position())+t.position(),t)}mode(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Et.Sparse}typeIds(t){const n=this.bb.__offset(this.bb_pos,6);return n?this.bb.readInt32(this.bb.__vector(this.bb_pos+n)+t*4):0}typeIdsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){const 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,n){t.addFieldInt16(0,n,Et.Sparse)}static addTypeIds(t,n){t.addFieldOffset(1,n,0)}static createTypeIdsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addInt32(n[r]);return t.endVector()}static startTypeIdsVector(t,n){t.startVector(4,n,4)}static endUnion(t){return t.endObject()}static createUnion(t,n,r){return Ft.startUnion(t),Ft.addMode(t,n),Ft.addTypeIds(t,r),Ft.endUnion(t)}}let ro=class rr{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUtf8(t,n){return(n||new rr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,n){return t.setPosition(t.position()+Z),(n||new rr).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return rr.startUtf8(t),rr.endUtf8(t)}};var lt;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.FloatingPoint=3]="FloatingPoint",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct_=13]="Struct_",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.RunEndEncoded=22]="RunEndEncoded"})(lt||(lt={}));let Yt=class _i{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsField(t,n){return(n||new _i).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,n){return t.setPosition(t.position()+Z),(n||new _i).__init(t.readInt32(t.position())+t.position(),t)}name(t){const n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}nullable(){const t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):lt.NONE}type(t){const n=this.bb.__offset(this.bb_pos,10);return n?this.bb.__union(t,this.bb_pos+n):null}dictionary(t){const n=this.bb.__offset(this.bb_pos,12);return n?(t||new ve).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}children(t,n){const r=this.bb.__offset(this.bb_pos,14);return r?(n||new _i).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}childrenLength(){const t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){const r=this.bb.__offset(this.bb_pos,16);return r?(n||new vt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){const 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,n){t.addFieldOffset(0,n,0)}static addNullable(t,n){t.addFieldInt8(1,+n,0)}static addTypeType(t,n){t.addFieldInt8(2,n,lt.NONE)}static addType(t,n){t.addFieldOffset(3,n,0)}static addDictionary(t,n){t.addFieldOffset(4,n,0)}static addChildren(t,n){t.addFieldOffset(5,n,0)}static createChildrenVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startChildrenVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(6,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endField(t){return t.endObject()}},ce=class Ae{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsSchema(t,n){return(n||new Ae).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+Z),(n||new Ae).__init(t.readInt32(t.position())+t.position(),t)}endianness(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):nn.Little}fields(t,n){const r=this.bb.__offset(this.bb_pos,6);return r?(n||new Yt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}fieldsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){const r=this.bb.__offset(this.bb_pos,8);return r?(n||new vt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){const n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readInt64(this.bb.__vector(this.bb_pos+n)+t*8):BigInt(0)}featuresLength(){const 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,n){t.addFieldInt16(0,n,nn.Little)}static addFields(t,n){t.addFieldOffset(1,n,0)}static createFieldsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startFieldsVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(2,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static addFeatures(t,n){t.addFieldOffset(3,n,0)}static createFeaturesVector(t,n){t.startVector(8,n.length,8);for(let r=n.length-1;r>=0;r--)t.addInt64(n[r]);return t.endVector()}static startFeaturesVector(t,n){t.startVector(8,n,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,n){t.finish(n)}static finishSizePrefixedSchemaBuffer(t,n){t.finish(n,void 0,!0)}static createSchema(t,n,r,i,s){return Ae.startSchema(t),Ae.addEndianness(t,n),Ae.addFields(t,r),Ae.addCustomMetadata(t,i),Ae.addFeatures(t,s),Ae.endSchema(t)}};var X;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(X||(X={}));var f;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(f||(f={}));var we;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(we||(we={}));const Np=void 0;function Un(e){if(e===null)return"null";if(e===Np)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>Un(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}function ot(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function io(e,t){return ot(e/t)+ot(e%t)/ot(t)}const Bp=Symbol.for("isArrowBigNum");function Qt(e,...t){return t.length===0?Object.setPrototypeOf(at(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}Qt.prototype[Bp]=!0,Qt.prototype.toJSON=function(){return`"${kn(this)}"`},Qt.prototype.valueOf=function(e){return so(this,e)},Qt.prototype.toString=function(){return kn(this)},Qt.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return so(this);case"string":return kn(this);case"default":return Dp(this)}return kn(this)};function sn(...e){return Qt.apply(this,e)}function an(...e){return Qt.apply(this,e)}function Cn(...e){return Qt.apply(this,e)}Object.setPrototypeOf(sn.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(an.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(Cn.prototype,Object.create(Uint32Array.prototype)),Object.assign(sn.prototype,Qt.prototype,{constructor:sn,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array}),Object.assign(an.prototype,Qt.prototype,{constructor:an,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array}),Object.assign(Cn.prototype,Qt.prototype,{constructor:Cn,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const Rp=BigInt(4294967296)*BigInt(4294967296),Op=Rp-BigInt(1);function so(e,t){const{buffer:n,byteOffset:r,byteLength:i,signed:s}=e,a=new BigUint64Array(n,r,i/8),o=s&&a.at(-1)&BigInt(1)<<BigInt(63);let l=BigInt(0),c=0;if(o){for(const d of a)l|=(d^Op)*(BigInt(1)<<BigInt(64*c++));l*=BigInt(-1),l-=BigInt(1)}else for(const d of a)l|=d*(BigInt(1)<<BigInt(64*c++));if(typeof t=="number"){const d=BigInt(Math.pow(10,t)),y=l/d,_=l%d;return ot(y)+ot(_)/ot(d)}return ot(l)}function kn(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return Ki(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Ki(e);t=t.slice();let n=1;for(let r=0;r<t.length;r++){const i=t[r],s=~i+n;t[r]=s,n&=i===0?1:0}return`-${Ki(t)}`}function Dp(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:kn(e)}function Ki(e){let t="";const n=new Uint32Array(2);let r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);const i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer);let s=-1;const a=r.length-1;do{for(n[0]=r[s=0];s<a;)r[s++]=n[1]=n[0]/10,n[0]=(n[0]-n[1]*10<<16)+r[s];r[s]=n[1]=n[0]/10,n[0]=n[0]-n[1]*10,t=`${n[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}class Qi{static new(t,n){switch(n){case!0:return new sn(t);case!1:return new an(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new sn(t)}return t.byteLength===16?new Cn(t):new an(t)}static signed(t){return new sn(t)}static unsigned(t){return new an(t)}static decimal(t){return new Cn(t)}constructor(t,n){return Qi.new(t,n)}}var ao,oo,lo,co,uo,ho,fo,po,yo,mo,bo,go,_o,vo,wo,Io,So,Eo,To,Ao,No,Bo;class D{static isNull(t){return(t==null?void 0:t.typeId)===f.Null}static isInt(t){return(t==null?void 0:t.typeId)===f.Int}static isFloat(t){return(t==null?void 0:t.typeId)===f.Float}static isBinary(t){return(t==null?void 0:t.typeId)===f.Binary}static isLargeBinary(t){return(t==null?void 0:t.typeId)===f.LargeBinary}static isUtf8(t){return(t==null?void 0:t.typeId)===f.Utf8}static isLargeUtf8(t){return(t==null?void 0:t.typeId)===f.LargeUtf8}static isBool(t){return(t==null?void 0:t.typeId)===f.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===f.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===f.Date}static isTime(t){return(t==null?void 0:t.typeId)===f.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===f.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===f.Interval}static isDuration(t){return(t==null?void 0:t.typeId)===f.Duration}static isList(t){return(t==null?void 0:t.typeId)===f.List}static isStruct(t){return(t==null?void 0:t.typeId)===f.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===f.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===f.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===f.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===f.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===f.Dictionary}static isDenseUnion(t){return D.isUnion(t)&&t.mode===Et.Dense}static isSparseUnion(t){return D.isUnion(t)&&t.mode===Et.Sparse}constructor(t){this.typeId=t}}ao=Symbol.toStringTag,D[ao]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(D.prototype);class Oe extends D{constructor(){super(f.Null)}toString(){return"Null"}}oo=Symbol.toStringTag,Oe[oo]=(e=>e[Symbol.toStringTag]="Null")(Oe.prototype);class qe extends D{constructor(t,n){super(f.Int),this.isSigned=t,this.bitWidth=n}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 ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}lo=Symbol.toStringTag,qe[lo]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(qe.prototype);class $n extends qe{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty($n.prototype,"ArrayType",{value:Int32Array});class xr extends D{constructor(t){super(f.Float),this.precision=t}get ArrayType(){switch(this.precision){case Tt.HALF:return Uint16Array;case Tt.SINGLE:return Float32Array;case Tt.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}co=Symbol.toStringTag,xr[co]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(xr.prototype);class Ur extends D{constructor(){super(f.Binary)}toString(){return"Binary"}}uo=Symbol.toStringTag,Ur[uo]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Ur.prototype);class Cr extends D{constructor(){super(f.LargeBinary)}toString(){return"LargeBinary"}}ho=Symbol.toStringTag,Cr[ho]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(Cr.prototype);class kr extends D{constructor(){super(f.Utf8)}toString(){return"Utf8"}}fo=Symbol.toStringTag,kr[fo]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(kr.prototype);class $r extends D{constructor(){super(f.LargeUtf8)}toString(){return"LargeUtf8"}}po=Symbol.toStringTag,$r[po]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))($r.prototype);class Pr extends D{constructor(){super(f.Bool)}toString(){return"Bool"}}yo=Symbol.toStringTag,Pr[yo]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Pr.prototype);class Vr extends D{constructor(t,n,r=128){super(f.Decimal),this.scale=t,this.precision=n,this.bitWidth=r}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}mo=Symbol.toStringTag,Vr[mo]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(Vr.prototype);class zr extends D{constructor(t){super(f.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Vt[this.unit]}>`}get ArrayType(){return this.unit===Vt.DAY?Int32Array:BigInt64Array}}bo=Symbol.toStringTag,zr[bo]=(e=>(e.unit=null,e[Symbol.toStringTag]="Date"))(zr.prototype);class jr extends D{constructor(t,n){super(f.Time),this.unit=t,this.bitWidth=n}toString(){return`Time${this.bitWidth}<${k[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}go=Symbol.toStringTag,jr[go]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(jr.prototype);class Yr extends D{constructor(t,n){super(f.Timestamp),this.unit=t,this.timezone=n}toString(){return`Timestamp<${k[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}_o=Symbol.toStringTag,Yr[_o]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Timestamp"))(Yr.prototype);class Wr extends D{constructor(t){super(f.Interval),this.unit=t}toString(){return`Interval<${se[this.unit]}>`}}vo=Symbol.toStringTag,Wr[vo]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(Wr.prototype);class qr extends D{constructor(t){super(f.Duration),this.unit=t}toString(){return`Duration<${k[this.unit]}>`}}wo=Symbol.toStringTag,qr[wo]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(qr.prototype);class Gr extends D{constructor(t){super(f.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}Io=Symbol.toStringTag,Gr[Io]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(Gr.prototype);class At extends D{constructor(t){super(f.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}So=Symbol.toStringTag,At[So]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(At.prototype);class Hr extends D{constructor(t,n,r){super(f.Union),this.mode=t,this.children=r,this.typeIds=n=Int32Array.from(n),this.typeIdToChildIndex=n.reduce((i,s,a)=>(i[s]=a)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}Eo=Symbol.toStringTag,Hr[Eo]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Hr.prototype);class Kr extends D{constructor(t){super(f.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}To=Symbol.toStringTag,Kr[To]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(Kr.prototype);class Qr extends D{constructor(t,n){super(f.FixedSizeList),this.listSize=t,this.children=[n]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}Ao=Symbol.toStringTag,Qr[Ao]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(Qr.prototype);class Xr extends D{constructor(t,n=!1){var r,i,s;if(super(f.Map),this.children=[t],this.keysSorted=n,t&&(t.name="entries",!((r=t==null?void 0:t.type)===null||r===void 0)&&r.children)){const a=(i=t==null?void 0:t.type)===null||i===void 0?void 0:i.children[0];a&&(a.name="key");const o=(s=t==null?void 0:t.type)===null||s===void 0?void 0:s.children[1];o&&(o.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<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}No=Symbol.toStringTag,Xr[No]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Xr.prototype);const Fp=(e=>()=>++e)(-1);class on extends D{constructor(t,n,r,i){super(f.Dictionary),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?Fp():ot(r)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}Bo=Symbol.toStringTag,on[Bo]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(on.prototype);function Ie(e){const t=e;switch(e.typeId){case f.Decimal:return e.bitWidth/32;case f.Interval:return 1+t.unit;case f.FixedSizeList:return t.listSize;case f.FixedSizeBinary:return t.byteWidth;default:return 1}}class q{visitMany(t,...n){return t.map((r,i)=>this.visit(r,...n.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,n=!0){return Mp(this,t,n)}getVisitFnByTypeId(t,n=!0){return ln(this,t,n)}visitNull(t,...n){return null}visitBool(t,...n){return null}visitInt(t,...n){return null}visitFloat(t,...n){return null}visitUtf8(t,...n){return null}visitLargeUtf8(t,...n){return null}visitBinary(t,...n){return null}visitLargeBinary(t,...n){return null}visitFixedSizeBinary(t,...n){return null}visitDate(t,...n){return null}visitTimestamp(t,...n){return null}visitTime(t,...n){return null}visitDecimal(t,...n){return null}visitList(t,...n){return null}visitStruct(t,...n){return null}visitUnion(t,...n){return null}visitDictionary(t,...n){return null}visitInterval(t,...n){return null}visitDuration(t,...n){return null}visitFixedSizeList(t,...n){return null}visitMap(t,...n){return null}}function Mp(e,t,n=!0){return typeof t=="number"?ln(e,t,n):typeof t=="string"&&t in f?ln(e,f[t],n):t&&t instanceof D?ln(e,Ro(t),n):t!=null&&t.type&&t.type instanceof D?ln(e,Ro(t.type),n):ln(e,f.NONE,n)}function ln(e,t,n=!0){let r=null;switch(t){case f.Null:r=e.visitNull;break;case f.Bool:r=e.visitBool;break;case f.Int:r=e.visitInt;break;case f.Int8:r=e.visitInt8||e.visitInt;break;case f.Int16:r=e.visitInt16||e.visitInt;break;case f.Int32:r=e.visitInt32||e.visitInt;break;case f.Int64:r=e.visitInt64||e.visitInt;break;case f.Uint8:r=e.visitUint8||e.visitInt;break;case f.Uint16:r=e.visitUint16||e.visitInt;break;case f.Uint32:r=e.visitUint32||e.visitInt;break;case f.Uint64:r=e.visitUint64||e.visitInt;break;case f.Float:r=e.visitFloat;break;case f.Float16:r=e.visitFloat16||e.visitFloat;break;case f.Float32:r=e.visitFloat32||e.visitFloat;break;case f.Float64:r=e.visitFloat64||e.visitFloat;break;case f.Utf8:r=e.visitUtf8;break;case f.LargeUtf8:r=e.visitLargeUtf8;break;case f.Binary:r=e.visitBinary;break;case f.LargeBinary:r=e.visitLargeBinary;break;case f.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case f.Date:r=e.visitDate;break;case f.DateDay:r=e.visitDateDay||e.visitDate;break;case f.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case f.Timestamp:r=e.visitTimestamp;break;case f.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case f.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case f.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case f.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case f.Time:r=e.visitTime;break;case f.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case f.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case f.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case f.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case f.Decimal:r=e.visitDecimal;break;case f.List:r=e.visitList;break;case f.Struct:r=e.visitStruct;break;case f.Union:r=e.visitUnion;break;case f.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case f.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case f.Dictionary:r=e.visitDictionary;break;case f.Interval:r=e.visitInterval;break;case f.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case f.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case f.Duration:r=e.visitDuration;break;case f.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case f.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case f.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case f.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case f.FixedSizeList:r=e.visitFixedSizeList;break;case f.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${f[t]}'`)}function Ro(e){switch(e.typeId){case f.Null:return f.Null;case f.Int:{const{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?f.Int8:f.Uint8;case 16:return n?f.Int16:f.Uint16;case 32:return n?f.Int32:f.Uint32;case 64:return n?f.Int64:f.Uint64}return f.Int}case f.Float:switch(e.precision){case Tt.HALF:return f.Float16;case Tt.SINGLE:return f.Float32;case Tt.DOUBLE:return f.Float64}return f.Float;case f.Binary:return f.Binary;case f.LargeBinary:return f.LargeBinary;case f.Utf8:return f.Utf8;case f.LargeUtf8:return f.LargeUtf8;case f.Bool:return f.Bool;case f.Decimal:return f.Decimal;case f.Time:switch(e.unit){case k.SECOND:return f.TimeSecond;case k.MILLISECOND:return f.TimeMillisecond;case k.MICROSECOND:return f.TimeMicrosecond;case k.NANOSECOND:return f.TimeNanosecond}return f.Time;case f.Timestamp:switch(e.unit){case k.SECOND:return f.TimestampSecond;case k.MILLISECOND:return f.TimestampMillisecond;case k.MICROSECOND:return f.TimestampMicrosecond;case k.NANOSECOND:return f.TimestampNanosecond}return f.Timestamp;case f.Date:switch(e.unit){case Vt.DAY:return f.DateDay;case Vt.MILLISECOND:return f.DateMillisecond}return f.Date;case f.Interval:switch(e.unit){case se.DAY_TIME:return f.IntervalDayTime;case se.YEAR_MONTH:return f.IntervalYearMonth}return f.Interval;case f.Duration:switch(e.unit){case k.SECOND:return f.DurationSecond;case k.MILLISECOND:return f.DurationMillisecond;case k.MICROSECOND:return f.DurationMicrosecond;case k.NANOSECOND:return f.DurationNanosecond}return f.Duration;case f.Map:return f.Map;case f.List:return f.List;case f.Struct:return f.Struct;case f.Union:switch(e.mode){case Et.Dense:return f.DenseUnion;case Et.Sparse:return f.SparseUnion}return f.Union;case f.FixedSizeBinary:return f.FixedSizeBinary;case f.FixedSizeList:return f.FixedSizeList;case f.Dictionary:return f.Dictionary}throw new Error(`Unrecognized type '${f[e.typeId]}'`)}q.prototype.visitInt8=null,q.prototype.visitInt16=null,q.prototype.visitInt32=null,q.prototype.visitInt64=null,q.prototype.visitUint8=null,q.prototype.visitUint16=null,q.prototype.visitUint32=null,q.prototype.visitUint64=null,q.prototype.visitFloat16=null,q.prototype.visitFloat32=null,q.prototype.visitFloat64=null,q.prototype.visitDateDay=null,q.prototype.visitDateMillisecond=null,q.prototype.visitTimestampSecond=null,q.prototype.visitTimestampMillisecond=null,q.prototype.visitTimestampMicrosecond=null,q.prototype.visitTimestampNanosecond=null,q.prototype.visitTimeSecond=null,q.prototype.visitTimeMillisecond=null,q.prototype.visitTimeMicrosecond=null,q.prototype.visitTimeNanosecond=null,q.prototype.visitDenseUnion=null,q.prototype.visitSparseUnion=null,q.prototype.visitIntervalDayTime=null,q.prototype.visitIntervalYearMonth=null,q.prototype.visitDuration=null,q.prototype.visitDurationSecond=null,q.prototype.visitDurationMillisecond=null,q.prototype.visitDurationMicrosecond=null,q.prototype.visitDurationNanosecond=null;const Oo=new Float64Array(1),cn=new Uint32Array(Oo.buffer);function Do(e){const t=(e&31744)>>10,n=(e&1023)/1024,r=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return r*(n?Number.NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*Math.pow(2,t-15)*(1+n)}function Lp(e){if(e!==e)return 32256;Oo[0]=e;const t=(cn[1]&2147483648)>>16&65535;let n=cn[1]&2146435072,r=0;return n>=1089470464?cn[0]>0?n=31744:(n=(n&2080374784)>>16,r=(cn[1]&1048575)>>10):n<=1056964608?(r=1048576+(cn[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(cn[1]&1048575)+512>>10),t|n|r&65535}class $ extends q{}function z(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}const xp=(e,t,n)=>{e[t]=Math.floor(n/864e5)},Fo=(e,t,n,r)=>{if(n+1<t.length){const i=ot(t[n]),s=ot(t[n+1]);e.set(r.subarray(0,s-i),i)}},Up=({offset:e,values:t},n,r)=>{const i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Se=({values:e},t,n)=>{e[t]=n},Xi=({values:e},t,n)=>{e[t]=n},Mo=({values:e},t,n)=>{e[t]=Lp(n)},Cp=(e,t,n)=>{switch(e.type.precision){case Tt.HALF:return Mo(e,t,n);case Tt.SINGLE:case Tt.DOUBLE:return Xi(e,t,n)}},Lo=({values:e},t,n)=>{xp(e,t,n.valueOf())},xo=({values:e},t,n)=>{e[t]=BigInt(n)},kp=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},Uo=({values:e,valueOffsets:t},n,r)=>Fo(e,t,n,r),Co=({values:e,valueOffsets:t},n,r)=>Fo(e,t,n,Vi(r)),$p=(e,t,n)=>{e.type.unit===Vt.DAY?Lo(e,t,n):xo(e,t,n)},ko=({values:e},t,n)=>{e[t]=BigInt(n/1e3)},$o=({values:e},t,n)=>{e[t]=BigInt(n)},Po=({values:e},t,n)=>{e[t]=BigInt(n*1e3)},Vo=({values:e},t,n)=>{e[t]=BigInt(n*1e6)},Pp=(e,t,n)=>{switch(e.type.unit){case k.SECOND:return ko(e,t,n);case k.MILLISECOND:return $o(e,t,n);case k.MICROSECOND:return Po(e,t,n);case k.NANOSECOND:return Vo(e,t,n)}},zo=({values:e},t,n)=>{e[t]=n},jo=({values:e},t,n)=>{e[t]=n},Yo=({values:e},t,n)=>{e[t]=n},Wo=({values:e},t,n)=>{e[t]=n},Vp=(e,t,n)=>{switch(e.type.unit){case k.SECOND:return zo(e,t,n);case k.MILLISECOND:return jo(e,t,n);case k.MICROSECOND:return Yo(e,t,n);case k.NANOSECOND:return Wo(e,t,n)}},zp=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},jp=(e,t,n)=>{const r=e.children[0],i=e.valueOffsets,s=Wt.getVisitFn(r);if(Array.isArray(n))for(let a=-1,o=i[t],l=i[t+1];o<l;)s(r,o++,n[++a]);else for(let a=-1,o=i[t],l=i[t+1];o<l;)s(r,o++,n.get(++a))},Yp=(e,t,n)=>{const r=e.children[0],{valueOffsets:i}=e,s=Wt.getVisitFn(r);let{[t]:a,[t+1]:o}=i;const l=n instanceof Map?n.entries():Object.entries(n);for(const c of l)if(s(r,a,c),++a>=o)break},Wp=(e,t)=>(n,r,i,s)=>r&&n(r,e,t[s]),qp=(e,t)=>(n,r,i,s)=>r&&n(r,e,t.get(s)),Gp=(e,t)=>(n,r,i,s)=>r&&n(r,e,t.get(i.name)),Hp=(e,t)=>(n,r,i,s)=>r&&n(r,e,t[i.name]),Kp=(e,t,n)=>{const r=e.type.children.map(s=>Wt.getVisitFn(s.type)),i=n instanceof Map?Gp(t,n):n instanceof tt?qp(t,n):Array.isArray(n)?Wp(t,n):Hp(t,n);e.type.children.forEach((s,a)=>i(r[a],e.children[a],s,a))},Qp=(e,t,n)=>{e.type.mode===Et.Dense?qo(e,t,n):Go(e,t,n)},qo=(e,t,n)=>{const r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];Wt.visit(i,e.valueOffsets[t],n)},Go=(e,t,n)=>{const r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];Wt.visit(i,t,n)},Xp=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},Jp=(e,t,n)=>{e.type.unit===se.DAY_TIME?Ho(e,t,n):Ko(e,t,n)},Ho=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},Ko=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},Qo=({values:e},t,n)=>{e[t]=n},Xo=({values:e},t,n)=>{e[t]=n},Jo=({values:e},t,n)=>{e[t]=n},Zo=({values:e},t,n)=>{e[t]=n},Zp=(e,t,n)=>{switch(e.type.unit){case k.SECOND:return Qo(e,t,n);case k.MILLISECOND:return Xo(e,t,n);case k.MICROSECOND:return Jo(e,t,n);case k.NANOSECOND:return Zo(e,t,n)}},ty=(e,t,n)=>{const{stride:r}=e,i=e.children[0],s=Wt.getVisitFn(i);if(Array.isArray(n))for(let a=-1,o=t*r;++a<r;)s(i,o+a,n[a]);else for(let a=-1,o=t*r;++a<r;)s(i,o+a,n.get(a))};$.prototype.visitBool=z(Up),$.prototype.visitInt=z(Se),$.prototype.visitInt8=z(Se),$.prototype.visitInt16=z(Se),$.prototype.visitInt32=z(Se),$.prototype.visitInt64=z(Se),$.prototype.visitUint8=z(Se),$.prototype.visitUint16=z(Se),$.prototype.visitUint32=z(Se),$.prototype.visitUint64=z(Se),$.prototype.visitFloat=z(Cp),$.prototype.visitFloat16=z(Mo),$.prototype.visitFloat32=z(Xi),$.prototype.visitFloat64=z(Xi),$.prototype.visitUtf8=z(Co),$.prototype.visitLargeUtf8=z(Co),$.prototype.visitBinary=z(Uo),$.prototype.visitLargeBinary=z(Uo),$.prototype.visitFixedSizeBinary=z(kp),$.prototype.visitDate=z($p),$.prototype.visitDateDay=z(Lo),$.prototype.visitDateMillisecond=z(xo),$.prototype.visitTimestamp=z(Pp),$.prototype.visitTimestampSecond=z(ko),$.prototype.visitTimestampMillisecond=z($o),$.prototype.visitTimestampMicrosecond=z(Po),$.prototype.visitTimestampNanosecond=z(Vo),$.prototype.visitTime=z(Vp),$.prototype.visitTimeSecond=z(zo),$.prototype.visitTimeMillisecond=z(jo),$.prototype.visitTimeMicrosecond=z(Yo),$.prototype.visitTimeNanosecond=z(Wo),$.prototype.visitDecimal=z(zp),$.prototype.visitList=z(jp),$.prototype.visitStruct=z(Kp),$.prototype.visitUnion=z(Qp),$.prototype.visitDenseUnion=z(qo),$.prototype.visitSparseUnion=z(Go),$.prototype.visitDictionary=z(Xp),$.prototype.visitInterval=z(Jp),$.prototype.visitIntervalDayTime=z(Ho),$.prototype.visitIntervalYearMonth=z(Ko),$.prototype.visitDuration=z(Zp),$.prototype.visitDurationSecond=z(Qo),$.prototype.visitDurationMillisecond=z(Xo),$.prototype.visitDurationMicrosecond=z(Jo),$.prototype.visitDurationNanosecond=z(Zo),$.prototype.visitFixedSizeList=z(ty),$.prototype.visitMap=z(Yp);const Wt=new $,Xt=Symbol.for("parent"),un=Symbol.for("rowIndex");class Ji{constructor(t,n){return this[Xt]=t,this[un]=n,new Proxy(this,new ny)}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[un],n=this[Xt],r=n.type.children,i={};for(let s=-1,a=r.length;++s<a;)i[r[s].name]=Mt.visit(n.children[s],t);return i}toString(){return`{${[...this].map(([t,n])=>`${Un(t)}: ${Un(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new ey(this[Xt],this[un])}}class ey{constructor(t,n){this.childIndex=0,this.children=t.children,this.rowIndex=n,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,Mt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}}Object.defineProperties(Ji.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Xt]:{writable:!0,enumerable:!1,configurable:!1,value:null},[un]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});class ny{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Xt].type.children.map(n=>n.name)}has(t,n){return t[Xt].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[Xt].type.children.findIndex(r=>r.name===n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];const r=t[Xt].type.children.findIndex(i=>i.name===n);if(r!==-1){const i=Mt.visit(t[Xt].children[r],t[un]);return Reflect.set(t,n,i),i}}set(t,n,r){const i=t[Xt].type.children.findIndex(s=>s.name===n);return i!==-1?(Wt.visit(t[Xt].children[i],t[un],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}}class L extends q{}function P(e){return(t,n)=>t.getValid(n)?e(t,n):null}const ry=(e,t)=>864e5*e[t],iy=(e,t)=>null,tl=(e,t,n)=>{if(n+1>=t.length)return null;const r=ot(t[n]),i=ot(t[n+1]);return e.subarray(r,i)},sy=({offset:e,values:t},n)=>{const r=e+n;return(t[r>>3]&1<<r%8)!==0},el=({values:e},t)=>ry(e,t),nl=({values:e},t)=>ot(e[t]),De=({stride:e,values:t},n)=>t[e*n],ay=({stride:e,values:t},n)=>Do(t[e*n]),rl=({values:e},t)=>e[t],oy=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),il=({values:e,valueOffsets:t},n)=>tl(e,t,n),sl=({values:e,valueOffsets:t},n)=>{const r=tl(e,t,n);return r!==null?Pi(r):null},ly=({values:e},t)=>e[t],cy=({type:e,values:t},n)=>e.precision!==Tt.HALF?t[n]:Do(t[n]),uy=(e,t)=>e.type.unit===Vt.DAY?el(e,t):nl(e,t),al=({values:e},t)=>1e3*ot(e[t]),ol=({values:e},t)=>ot(e[t]),ll=({values:e},t)=>io(e[t],BigInt(1e3)),cl=({values:e},t)=>io(e[t],BigInt(1e6)),hy=(e,t)=>{switch(e.type.unit){case k.SECOND:return al(e,t);case k.MILLISECOND:return ol(e,t);case k.MICROSECOND:return ll(e,t);case k.NANOSECOND:return cl(e,t)}},ul=({values:e},t)=>e[t],hl=({values:e},t)=>e[t],dl=({values:e},t)=>e[t],fl=({values:e},t)=>e[t],dy=(e,t)=>{switch(e.type.unit){case k.SECOND:return ul(e,t);case k.MILLISECOND:return hl(e,t);case k.MICROSECOND:return dl(e,t);case k.NANOSECOND:return fl(e,t)}},fy=({values:e,stride:t},n)=>Qi.decimal(e.subarray(t*n,t*(n+1))),py=(e,t)=>{const{valueOffsets:n,stride:r,children:i}=e,{[t*r]:s,[t*r+1]:a}=n,o=i[0].slice(s,a-s);return new tt([o])},yy=(e,t)=>{const{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:s}=n,a=r[0];return new ts(a.slice(i,s-i))},my=(e,t)=>new Ji(e,t),by=(e,t)=>e.type.mode===Et.Dense?pl(e,t):yl(e,t),pl=(e,t)=>{const n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return Mt.visit(r,e.valueOffsets[t])},yl=(e,t)=>{const n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return Mt.visit(r,t)},gy=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},_y=(e,t)=>e.type.unit===se.DAY_TIME?ml(e,t):bl(e,t),ml=({values:e},t)=>e.subarray(2*t,2*(t+1)),bl=({values:e},t)=>{const n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},gl=({values:e},t)=>e[t],_l=({values:e},t)=>e[t],vl=({values:e},t)=>e[t],wl=({values:e},t)=>e[t],vy=(e,t)=>{switch(e.type.unit){case k.SECOND:return gl(e,t);case k.MILLISECOND:return _l(e,t);case k.MICROSECOND:return vl(e,t);case k.NANOSECOND:return wl(e,t)}},wy=(e,t)=>{const{stride:n,children:r}=e,i=r[0].slice(t*n,n);return new tt([i])};L.prototype.visitNull=P(iy),L.prototype.visitBool=P(sy),L.prototype.visitInt=P(ly),L.prototype.visitInt8=P(De),L.prototype.visitInt16=P(De),L.prototype.visitInt32=P(De),L.prototype.visitInt64=P(rl),L.prototype.visitUint8=P(De),L.prototype.visitUint16=P(De),L.prototype.visitUint32=P(De),L.prototype.visitUint64=P(rl),L.prototype.visitFloat=P(cy),L.prototype.visitFloat16=P(ay),L.prototype.visitFloat32=P(De),L.prototype.visitFloat64=P(De),L.prototype.visitUtf8=P(sl),L.prototype.visitLargeUtf8=P(sl),L.prototype.visitBinary=P(il),L.prototype.visitLargeBinary=P(il),L.prototype.visitFixedSizeBinary=P(oy),L.prototype.visitDate=P(uy),L.prototype.visitDateDay=P(el),L.prototype.visitDateMillisecond=P(nl),L.prototype.visitTimestamp=P(hy),L.prototype.visitTimestampSecond=P(al),L.prototype.visitTimestampMillisecond=P(ol),L.prototype.visitTimestampMicrosecond=P(ll),L.prototype.visitTimestampNanosecond=P(cl),L.prototype.visitTime=P(dy),L.prototype.visitTimeSecond=P(ul),L.prototype.visitTimeMillisecond=P(hl),L.prototype.visitTimeMicrosecond=P(dl),L.prototype.visitTimeNanosecond=P(fl),L.prototype.visitDecimal=P(fy),L.prototype.visitList=P(py),L.prototype.visitStruct=P(my),L.prototype.visitUnion=P(by),L.prototype.visitDenseUnion=P(pl),L.prototype.visitSparseUnion=P(yl),L.prototype.visitDictionary=P(gy),L.prototype.visitInterval=P(_y),L.prototype.visitIntervalDayTime=P(ml),L.prototype.visitIntervalYearMonth=P(bl),L.prototype.visitDuration=P(vy),L.prototype.visitDurationSecond=P(gl),L.prototype.visitDurationMillisecond=P(_l),L.prototype.visitDurationMicrosecond=P(vl),L.prototype.visitDurationNanosecond=P(wl),L.prototype.visitFixedSizeList=P(wy),L.prototype.visitMap=P(yy);const Mt=new L,hn=Symbol.for("keys"),dn=Symbol.for("vals"),fn=Symbol.for("kKeysAsStrings"),Zi=Symbol.for("_kKeysAsStrings");class ts{constructor(t){return this[hn]=new tt([t.children[0]]).memoize(),this[dn]=t.children[1],new Proxy(this,new Sy)}get[fn](){return this[Zi]||(this[Zi]=Array.from(this[hn].toArray(),String))}[Symbol.iterator](){return new Iy(this[hn],this[dn])}get size(){return this[hn].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[hn],n=this[dn],r={};for(let i=-1,s=t.length;++i<s;)r[t.get(i)]=Mt.visit(n,i);return r}toString(){return`{${[...this].map(([t,n])=>`${Un(t)}: ${Un(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class Iy{constructor(t,n){this.keys=t,this.vals=n,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){const t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),Mt.visit(this.vals,t)]})}}class Sy{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[fn]}has(t,n){return t[fn].includes(n)}getOwnPropertyDescriptor(t,n){if(t[fn].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];const r=t[fn].indexOf(n);if(r!==-1){const i=Mt.visit(Reflect.get(t,dn),r);return Reflect.set(t,n,i),i}}set(t,n,r){const i=t[fn].indexOf(n);return i!==-1?(Wt.visit(Reflect.get(t,dn),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}}Object.defineProperties(ts.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[hn]:{writable:!0,enumerable:!1,configurable:!1,value:null},[dn]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Zi]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let Il;function Sl(e,t,n,r){const{length:i=0}=e;let s=typeof t!="number"?0:t,a=typeof n!="number"?i:n;return s<0&&(s=(s%i+i)%i),a<0&&(a=(a%i+i)%i),a<s&&(Il=s,s=a,a=Il),a>i&&(a=i),r?r(e,s,a):[s,a]}const es=(e,t)=>e<0?t+e:e,El=e=>e!==e;function pn(e){if(typeof e!="object"||e===null)return El(e)?El:t=>t===e;if(e instanceof Date){const t=e.valueOf();return n=>n instanceof Date?n.valueOf()===t:!1}return ArrayBuffer.isView(e)?t=>t?wp(e,t):!1:e instanceof Map?Ty(e):Array.isArray(e)?Ey(e):e instanceof tt?Ay(e):Ny(e,!0)}function Ey(e){const t=[];for(let n=-1,r=e.length;++n<r;)t[n]=pn(e[n]);return Jr(t)}function Ty(e){let t=-1;const n=[];for(const r of e.values())n[++t]=pn(r);return Jr(n)}function Ay(e){const t=[];for(let n=-1,r=e.length;++n<r;)t[n]=pn(e.get(n));return Jr(t)}function Ny(e,t=!1){const n=Object.keys(e);if(!t&&n.length===0)return()=>!1;const r=[];for(let i=-1,s=n.length;++i<s;)r[i]=pn(e[n[i]]);return Jr(r,n)}function Jr(e,t){return n=>{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return By(e,n);case Map:return Tl(e,n,n.keys());case ts:case Ji:case Object:case void 0:return Tl(e,n,t||Object.keys(n))}return n instanceof tt?Ry(e,n):!1}}function By(e,t){const n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t[r]))return!1;return!0}function Ry(e,t){const n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t.get(r)))return!1;return!0}function Tl(e,t,n){const r=n[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),s=t instanceof Map?t.values():Object.values(t)[Symbol.iterator]();let a=0;const o=e.length;let l=s.next(),c=r.next(),d=i.next();for(;a<o&&!c.done&&!d.done&&!l.done&&!(c.value!==d.value||!e[a](l.value));++a,c=r.next(),d=i.next(),l=s.next());return a===o&&c.done&&d.done&&l.done?!0:(r.return&&r.return(),i.return&&i.return(),s.return&&s.return(),!1)}function Al(e,t,n,r){return(n&1<<r)!==0}function Oy(e,t,n,r){return(n&1<<r)>>r}function Zr(e,t,n){const r=n.byteLength+7&-8;if(e>0||n.byteLength<r){const i=new Uint8Array(r);return i.set(e%8===0?n.subarray(e>>3):ti(new ns(n,e,t,null,Al)).subarray(0,r)),i}return n}function ti(e){const t=[];let n=0,r=0,i=0;for(const a of e)a&&(i|=1<<r),++r===8&&(t[n++]=i,i=r=0);(n===0||r>0)&&(t[n++]=i);const s=new Uint8Array(t.length+7&-8);return s.set(t),s}class ns{constructor(t,n,r,i,s){this.bytes=t,this.length=r,this.context=i,this.get=s,this.bit=n%8,this.byteIndex=n>>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 rs(e,t,n){if(n-t<=0)return 0;if(n-t<8){let s=0;for(const a of new ns(e,t,n-t,e,Oy))s+=a;return s}const r=n>>3<<3,i=t+(t%8===0?0:8-t%8);return rs(e,t,i)+rs(e,r,n)+Dy(e,i>>3,r-i>>3)}function Dy(e,t,n){let r=0,i=Math.trunc(t);const s=new DataView(e.buffer,e.byteOffset,e.byteLength),a=n===void 0?e.byteLength:i+n;for(;a-i>=4;)r+=is(s.getUint32(i)),i+=4;for(;a-i>=2;)r+=is(s.getUint16(i)),i+=2;for(;a-i>=1;)r+=is(s.getUint8(i)),i+=1;return r}function is(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const Fy=-1;class nt{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){const{type:t}=this;return D.isSparseUnion(t)?this.children.some(n=>n.nullable):D.isDenseUnion(t)?this.children.some(n=>n.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0;const{valueOffsets:n,values:r,nullBitmap:i,typeIds:s}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),this.children.reduce((a,o)=>a+o.byteLength,t)}get nullCount(){if(D.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=Fy&&(n=this.nullBitmap)&&(this._nullCount=t=n.length===0?0:this.length-rs(n,this.offset,this.offset+this.length)),t}constructor(t,n,r,i,s,a=[],o){this.type=t,this.children=a,this.dictionary=o,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let l;s instanceof nt?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=Ie(t),s&&((l=s[0])&&(this.valueOffsets=l),(l=s[1])&&(this.values=l),(l=s[2])&&(this.nullBitmap=l),(l=s[3])&&(this.typeIds=l)))}getValid(t){const{type:n}=this;if(D.isUnion(n)){const r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],s=r.mode===Et.Dense?this.valueOffsets[t]:t;return i.getValid(s)}if(this.nullable&&this.nullCount>0){const r=this.offset+t;return(this.nullBitmap[r>>3]&1<<r%8)!==0}return!0}setValid(t,n){let r;const{type:i}=this;if(D.isUnion(i)){const s=i,a=this.children[s.typeIdToChildIndex[this.typeIds[t]]],o=s.mode===Et.Dense?this.valueOffsets[t]:t;r=a.getValid(o),a.setValid(o,n)}else{let{nullBitmap:s}=this;const{offset:a,length:o}=this,l=a+t,c=1<<l%8,d=l>>3;(!s||s.byteLength<=d)&&(s=new Uint8Array((a+o+63&-64)>>3).fill(255),this.nullCount>0?(s.set(Zr(a,o,this.nullBitmap),0),Object.assign(this,{nullBitmap:s})):Object.assign(this,{nullBitmap:s,_nullCount:0}));const y=s[d];r=(y&c)!==0,s[d]=n?y|c:y&~c}return r!==!!n&&(this._nullCount=this.nullCount+(n?-1:1)),n}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,s=this,a=this.children){return new nt(t,n,r,i,s,a,this.dictionary)}slice(t,n){const{stride:r,typeId:i,children:s}=this,a=+(this._nullCount===0)-1,o=i===16?r:1,l=this._sliceBuffers(t,n,r,i);return this.clone(this.type,this.offset+t,n,a,l,s.length===0||this.valueOffsets?s:this._sliceChildren(s,o*t,o*n))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===f.Null)return this.clone(this.type,0,t,0);const{length:n,nullCount:r}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,n>>3);i[n>>3]=(1<<n-(n&-8))-1,r>0&&i.set(Zr(this.offset,n,this.nullBitmap),0);const s=this.buffers;return s[we.VALIDITY]=i,this.clone(this.type,0,t,r+(t-n),s)}_sliceBuffers(t,n,r,i){let s;const{buffers:a}=this;return(s=a[we.TYPE])&&(a[we.TYPE]=s.subarray(t,t+n)),(s=a[we.OFFSET])&&(a[we.OFFSET]=s.subarray(t,t+n+1))||(s=a[we.DATA])&&(a[we.DATA]=i===6?s:s.subarray(r*t,r*(t+n))),a}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}}nt.prototype.children=Object.freeze([]);class Pn extends q{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new nt(n,r,i,i)}visitBool(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.ArrayType,t.data),{["length"]:a=s.length>>3,["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,s,i])}visitInt(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.ArrayType,t.data),{["length"]:a=s.length,["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,s,i])}visitFloat(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.ArrayType,t.data),{["length"]:a=s.length,["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,s,i])}visitUtf8(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.data),s=H(t.nullBitmap),a=xn(t.valueOffsets),{["length"]:o=a.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new nt(n,r,o,l,[a,i,s])}visitLargeUtf8(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.data),s=H(t.nullBitmap),a=ja(t.valueOffsets),{["length"]:o=a.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new nt(n,r,o,l,[a,i,s])}visitBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.data),s=H(t.nullBitmap),a=xn(t.valueOffsets),{["length"]:o=a.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new nt(n,r,o,l,[a,i,s])}visitLargeBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.data),s=H(t.nullBitmap),a=ja(t.valueOffsets),{["length"]:o=a.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new nt(n,r,o,l,[a,i,s])}visitFixedSizeBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.ArrayType,t.data),{["length"]:a=s.length/Ie(n),["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,s,i])}visitDate(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.ArrayType,t.data),{["length"]:a=s.length/Ie(n),["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,s,i])}visitTimestamp(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.ArrayType,t.data),{["length"]:a=s.length/Ie(n),["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,s,i])}visitTime(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.ArrayType,t.data),{["length"]:a=s.length/Ie(n),["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,s,i])}visitDecimal(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.ArrayType,t.data),{["length"]:a=s.length/Ie(n),["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,s,i])}visitList(t){const{["type"]:n,["offset"]:r=0,["child"]:i}=t,s=H(t.nullBitmap),a=xn(t.valueOffsets),{["length"]:o=a.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new nt(n,r,o,l,[a,void 0,s],[i])}visitStruct(t){const{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,s=H(t.nullBitmap),{length:a=i.reduce((l,{length:c})=>Math.max(l,c),0),nullCount:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,void 0,s],i)}visitUnion(t){const{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,s=at(n.ArrayType,t.typeIds),{["length"]:a=s.length,["nullCount"]:o=-1}=t;if(D.isSparseUnion(n))return new nt(n,r,a,o,[void 0,void 0,void 0,s],i);const l=xn(t.valueOffsets);return new nt(n,r,a,o,[l,void 0,void 0,s],i)}visitDictionary(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.indices.ArrayType,t.data),{["dictionary"]:a=new tt([new Pn().visit({type:n.dictionary})])}=t,{["length"]:o=s.length,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new nt(n,r,o,l,[void 0,s,i],[],a)}visitInterval(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.ArrayType,t.data),{["length"]:a=s.length/Ie(n),["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,s,i])}visitDuration(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.ArrayType,t.data),{["length"]:a=s.length,["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,s,i])}visitFixedSizeList(t){const{["type"]:n,["offset"]:r=0,["child"]:i=new Pn().visit({type:n.valueType})}=t,s=H(t.nullBitmap),{["length"]:a=i.length/Ie(n),["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,void 0,s],[i])}visitMap(t){const{["type"]:n,["offset"]:r=0,["child"]:i=new Pn().visit({type:n.childType})}=t,s=H(t.nullBitmap),a=xn(t.valueOffsets),{["length"]:o=a.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new nt(n,r,o,l,[a,void 0,s],[i])}}const My=new Pn;function G(e){return My.visit(e)}class Nl{constructor(t=0,n){this.numChunks=t,this.getChunkIterator=n,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){const 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 Ly(e){return e.some(t=>t.nullable)}function Bl(e){return e.reduce((t,n)=>t+n.nullCount,0)}function Rl(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function Ol(e,t,n,r){const i=[];for(let s=-1,a=e.length;++s<a;){const o=e[s],l=t[s],{length:c}=o;if(l>=r)break;if(n>=l+c)continue;if(l>=n&&l+c<=r){i.push(o);continue}const d=Math.max(0,n-l),y=Math.min(r-l,c);i.push(o.slice(d,y-d))}return i.length===0&&i.push(e[0].slice(0,0)),i}function ss(e,t,n,r){let i=0,s=0,a=t.length-1;do{if(i>=a-1)return n<t[a]?r(e,i,n-t[i]):null;s=i+Math.trunc((a-i)*.5),n<t[s]?a=s:i=s}while(i<a)}function as(e,t){return e.getValid(t)}function ei(e){function t(n,r,i){return e(n[r],i)}return function(n){const r=this.data;return ss(r,this._offsets,n,t)}}function Dl(e){let t;function n(r,i,s){return e(r[i],s,t)}return function(r,i){const s=this.data;t=i;const a=ss(s,this._offsets,r,n);return t=void 0,a}}function Fl(e){let t;function n(r,i,s){let a=s,o=0,l=0;for(let c=i-1,d=r.length;++c<d;){const y=r[c];if(~(o=e(y,t,a)))return l+o;a=0,l+=y.length}return-1}return function(r,i){t=r;const s=this.data,a=typeof i!="number"?n(s,0,0):ss(s,this._offsets,i,n);return t=void 0,a}}class x extends q{}function xy(e,t){return t===null&&e.length>0?0:-1}function Uy(e,t){const{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(const i of new ns(n,e.offset+(t||0),e.length,n,Al)){if(!i)return r;++r}return-1}function j(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case f.Union:break;case f.Dictionary:break;default:return Uy(e,n)}const r=Mt.getVisitFn(e),i=pn(t);for(let s=(n||0)-1,a=e.length;++s<a;)if(i(r(e,s)))return s;return-1}function Ml(e,t,n){const r=Mt.getVisitFn(e),i=pn(t);for(let s=(n||0)-1,a=e.length;++s<a;)if(i(r(e,s)))return s;return-1}x.prototype.visitNull=xy,x.prototype.visitBool=j,x.prototype.visitInt=j,x.prototype.visitInt8=j,x.prototype.visitInt16=j,x.prototype.visitInt32=j,x.prototype.visitInt64=j,x.prototype.visitUint8=j,x.prototype.visitUint16=j,x.prototype.visitUint32=j,x.prototype.visitUint64=j,x.prototype.visitFloat=j,x.prototype.visitFloat16=j,x.prototype.visitFloat32=j,x.prototype.visitFloat64=j,x.prototype.visitUtf8=j,x.prototype.visitLargeUtf8=j,x.prototype.visitBinary=j,x.prototype.visitLargeBinary=j,x.prototype.visitFixedSizeBinary=j,x.prototype.visitDate=j,x.prototype.visitDateDay=j,x.prototype.visitDateMillisecond=j,x.prototype.visitTimestamp=j,x.prototype.visitTimestampSecond=j,x.prototype.visitTimestampMillisecond=j,x.prototype.visitTimestampMicrosecond=j,x.prototype.visitTimestampNanosecond=j,x.prototype.visitTime=j,x.prototype.visitTimeSecond=j,x.prototype.visitTimeMillisecond=j,x.prototype.visitTimeMicrosecond=j,x.prototype.visitTimeNanosecond=j,x.prototype.visitDecimal=j,x.prototype.visitList=j,x.prototype.visitStruct=j,x.prototype.visitUnion=j,x.prototype.visitDenseUnion=Ml,x.prototype.visitSparseUnion=Ml,x.prototype.visitDictionary=j,x.prototype.visitInterval=j,x.prototype.visitIntervalDayTime=j,x.prototype.visitIntervalYearMonth=j,x.prototype.visitDuration=j,x.prototype.visitDurationSecond=j,x.prototype.visitDurationMillisecond=j,x.prototype.visitDurationMicrosecond=j,x.prototype.visitDurationNanosecond=j,x.prototype.visitFixedSizeList=j,x.prototype.visitMap=j;const ni=new x;class U extends q{}function V(e){const{type:t}=e;if(e.nullCount===0&&e.stride===1&&(D.isInt(t)&&t.bitWidth!==64||D.isTime(t)&&t.bitWidth!==64||D.isFloat(t)&&t.precision!==Tt.HALF))return new Nl(e.data.length,r=>{const i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new Nl(e.data.length,r=>{const i=e.data[r].length,s=e.slice(n,n+i);return n+=i,new Cy(s)})}class Cy{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}}U.prototype.visitNull=V,U.prototype.visitBool=V,U.prototype.visitInt=V,U.prototype.visitInt8=V,U.prototype.visitInt16=V,U.prototype.visitInt32=V,U.prototype.visitInt64=V,U.prototype.visitUint8=V,U.prototype.visitUint16=V,U.prototype.visitUint32=V,U.prototype.visitUint64=V,U.prototype.visitFloat=V,U.prototype.visitFloat16=V,U.prototype.visitFloat32=V,U.prototype.visitFloat64=V,U.prototype.visitUtf8=V,U.prototype.visitLargeUtf8=V,U.prototype.visitBinary=V,U.prototype.visitLargeBinary=V,U.prototype.visitFixedSizeBinary=V,U.prototype.visitDate=V,U.prototype.visitDateDay=V,U.prototype.visitDateMillisecond=V,U.prototype.visitTimestamp=V,U.prototype.visitTimestampSecond=V,U.prototype.visitTimestampMillisecond=V,U.prototype.visitTimestampMicrosecond=V,U.prototype.visitTimestampNanosecond=V,U.prototype.visitTime=V,U.prototype.visitTimeSecond=V,U.prototype.visitTimeMillisecond=V,U.prototype.visitTimeMicrosecond=V,U.prototype.visitTimeNanosecond=V,U.prototype.visitDecimal=V,U.prototype.visitList=V,U.prototype.visitStruct=V,U.prototype.visitUnion=V,U.prototype.visitDenseUnion=V,U.prototype.visitSparseUnion=V,U.prototype.visitDictionary=V,U.prototype.visitInterval=V,U.prototype.visitIntervalDayTime=V,U.prototype.visitIntervalYearMonth=V,U.prototype.visitDuration=V,U.prototype.visitDurationSecond=V,U.prototype.visitDurationMillisecond=V,U.prototype.visitDurationMicrosecond=V,U.prototype.visitDurationNanosecond=V,U.prototype.visitFixedSizeList=V,U.prototype.visitMap=V;const os=new U;var Ll;const xl={},Ul={};class tt{constructor(t){var n,r,i;const s=t[0]instanceof tt?t.flatMap(o=>o.data):t;if(s.length===0||s.some(o=>!(o instanceof nt)))throw new TypeError("Vector constructor expects an Array of Data instances.");const a=(n=s[0])===null||n===void 0?void 0:n.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{const{get:o,set:l,indexOf:c}=xl[a.typeId],d=s[0];this.isValid=y=>as(d,y),this.get=y=>o(d,y),this.set=(y,_)=>l(d,y,_),this.indexOf=y=>c(d,y),this._offsets=[0,d.length];break}default:Object.setPrototypeOf(this,Ul[a.typeId]),this._offsets=Rl(s);break}this.data=s,this.type=a,this.stride=Ie(a),this.numChildren=(i=(r=a.children)===null||r===void 0?void 0:r.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,n)=>t+n.byteLength,0)}get nullable(){return Ly(this.data)}get nullCount(){return Bl(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${f[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(es(t,this.length))}set(t,n){}indexOf(t,n){return-1}includes(t,n){return this.indexOf(t,n)>-1}[Symbol.iterator](){return os.visit(this)}concat(...t){return new tt(this.data.concat(t.flatMap(n=>n.data).flat(Number.POSITIVE_INFINITY)))}slice(t,n){return new tt(Sl(this,t,n,({data:r,_offsets:i},s,a)=>Ol(r,i,s,a)))}toJSON(){return[...this]}toArray(){const{type:t,data:n,length:r,stride:i,ArrayType:s}=this;switch(t.typeId){case f.Int:case f.Float:case f.Decimal:case f.Time:case f.Timestamp:switch(n.length){case 0:return new s;case 1:return n[0].values.subarray(0,r*i);default:return n.reduce((a,{values:o,length:l})=>(a.array.set(o.subarray(0,l*i),a.offset),a.offset+=l*i,a),{array:new s(r*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var n;return this.getChildAt((n=this.type.children)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new tt(this.data.map(({children:n})=>n[t])):null}get isMemoized(){return D.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(D.isDictionary(this.type)){const t=new ri(this.data[0].dictionary),n=this.data.map(r=>{const i=r.clone();return i.dictionary=t,i});return new tt(n)}return new ri(this)}unmemoize(){if(D.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),n=this.data.map(r=>{const i=r.clone();return i.dictionary=t,i});return new tt(n)}return this}}Ll=Symbol.toStringTag,tt[Ll]=(e=>{e.type=D.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;const t=Object.keys(f).map(n=>f[n]).filter(n=>typeof n=="number"&&n!==f.NONE);for(const n of t){const r=Mt.getVisitFnByTypeId(n),i=Wt.getVisitFnByTypeId(n),s=ni.getVisitFnByTypeId(n);xl[n]={get:r,set:i,indexOf:s},Ul[n]=Object.create(e,{isValid:{value:ei(as)},get:{value:ei(Mt.getVisitFnByTypeId(n))},set:{value:Dl(Wt.getVisitFnByTypeId(n))},indexOf:{value:Fl(ni.getVisitFnByTypeId(n))}})}return"Vector"})(tt.prototype);class ri extends tt{constructor(t){super(t.data);const n=this.get,r=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(a){const o=s[a];if(o!==void 0)return o;const l=n.call(this,a);return s[a]=l,l}}),Object.defineProperty(this,"set",{value(a,o){r.call(this,a,o),s[a]=o}}),Object.defineProperty(this,"slice",{value:(a,o)=>new ri(i.call(this,a,o))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new tt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class ls{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,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,n,r,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(r),t.writeInt64(BigInt(n??0)),t.offset()}}class Ct{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFooter(t,n){return(n||new Ct).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,n){return t.setPosition(t.position()+Z),(n||new Ct).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):yt.V1}schema(t){const n=this.bb.__offset(this.bb_pos,6);return n?(t||new ce).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}dictionaries(t,n){const r=this.bb.__offset(this.bb_pos,8);return r?(n||new ls).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}dictionariesLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,n){const r=this.bb.__offset(this.bb_pos,10);return r?(n||new ls).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}recordBatchesLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){const r=this.bb.__offset(this.bb_pos,12);return r?(n||new vt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){const 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,n){t.addFieldInt16(0,n,yt.V1)}static addSchema(t,n){t.addFieldOffset(1,n,0)}static addDictionaries(t,n){t.addFieldOffset(2,n,0)}static startDictionariesVector(t,n){t.startVector(24,n,8)}static addRecordBatches(t,n){t.addFieldOffset(3,n,0)}static startRecordBatchesVector(t,n){t.startVector(24,n,8)}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,n){t.finish(n)}static finishSizePrefixedFooterBuffer(t,n){t.finish(n,void 0,!0)}}class et{constructor(t=[],n,r,i=yt.V5){this.fields=t||[],this.metadata=n||new Map,r||(r=cs(this.fields)),this.dictionaries=r,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,n)=>`${n}: ${t}`).join(", ")} }>`}select(t){const n=new Set(t),r=this.fields.filter(i=>n.has(i.name));return new et(r,this.metadata)}selectAt(t){const n=t.map(r=>this.fields[r]).filter(Boolean);return new et(n,this.metadata)}assign(...t){const n=t[0]instanceof et?t[0]:Array.isArray(t[0])?new et(t[0]):new et(t),r=[...this.fields],i=ii(ii(new Map,this.metadata),n.metadata),s=n.fields.filter(o=>{const l=r.findIndex(c=>c.name===o.name);return~l?(r[l]=o.clone({metadata:ii(ii(new Map,r[l].metadata),o.metadata)}))&&!1:!0}),a=cs(s,new Map);return new et([...r,...s],i,new Map([...this.dictionaries,...a]))}}et.prototype.fields=null,et.prototype.metadata=null,et.prototype.dictionaries=null;class ut{static new(...t){let[n,r,i,s]=t;return t[0]&&typeof t[0]=="object"&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),s===void 0&&(s=t[0].metadata)),new ut(`${n}`,r,i,s)}constructor(t,n,r=!1,i){this.name=t,this.type=n,this.nullable=r,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,s]=t;return!t[0]||typeof t[0]!="object"?[n=this.name,r=this.type,i=this.nullable,s=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:s=this.metadata}=t[0],ut.new(n,r,i,s)}}ut.prototype.type=null,ut.prototype.name=null,ut.prototype.nullable=null,ut.prototype.metadata=null;function ii(e,t){return new Map([...e||new Map,...t||new Map])}function cs(e,t=new Map){for(let n=-1,r=e.length;++n<r;){const i=e[n].type;if(D.isDictionary(i)){if(!t.has(i.id))t.set(i.id,i.dictionary);else if(t.get(i.id)!==i.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}i.children&&i.children.length>0&&cs(i.children,t)}return t}var ky=Ha,$y=tn;class Vn{static decode(t){t=new $y(H(t));const n=Ct.getRootAsFooter(t),r=et.decode(n.schema(),new Map,n.version());return new Py(r,n)}static encode(t){const n=new ky,r=et.encode(n,t.schema);Ct.startRecordBatchesVector(n,t.numRecordBatches);for(const a of[...t.recordBatches()].slice().reverse())Fe.encode(n,a);const i=n.endVector();Ct.startDictionariesVector(n,t.numDictionaries);for(const a of[...t.dictionaryBatches()].slice().reverse())Fe.encode(n,a);const s=n.endVector();return Ct.startFooter(n),Ct.addSchema(n,r),Ct.addVersion(n,yt.V5),Ct.addRecordBatches(n,i),Ct.addDictionaries(n,s),Ct.finishFooterBuffer(n,Ct.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=yt.V5,r,i){this.schema=t,this.version=n,r&&(this._recordBatches=r),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,n=-1,r=this.numRecordBatches;++n<r;)(t=this.getRecordBatch(n))&&(yield t)}*dictionaryBatches(){for(let t,n=-1,r=this.numDictionaries;++n<r;)(t=this.getDictionaryBatch(n))&&(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}}class Py extends Vn{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,n){super(t,n.version()),this._footer=n}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){const n=this._footer.recordBatches(t);if(n)return Fe.decode(n)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){const n=this._footer.dictionaries(t);if(n)return Fe.decode(n)}return null}}class Fe{static decode(t){return new Fe(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,n){const{metaDataLength:r}=n,i=BigInt(n.offset),s=BigInt(n.bodyLength);return ls.createBlock(t,i,r,s)}constructor(t,n,r){this.metaDataLength=t,this.offset=ot(r),this.bodyLength=ot(n)}}const wt=Object.freeze({done:!0,value:void 0});class Cl{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class us{tee(){return this._getDOMStream().tee()}pipe(t,n){return this._getNodeStream().pipe(t,n)}pipeTo(t,n){return this._getDOMStream().pipeTo(t,n)}pipeThrough(t,n){return this._getDOMStream().pipeThrough(t,n)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}}class Vy extends us{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return Y(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){const{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(wt);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return Pt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Pt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Y(this,void 0,void 0,function*(){return yield this.abort(t),wt})}return(t){return Y(this,void 0,void 0,function*(){return yield this.close(),wt})}read(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Y(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((n,r)=>{this.resolvers.push({resolve:n,reject:r})}):Promise.resolve(wt)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class si extends Vy{write(t){if((t=H(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Pi(this.toUint8Array(!0)):this.toUint8Array(!1).then(Pi)}toUint8Array(t=!1){return t?ie(this._values)[0]:Y(this,void 0,void 0,function*(){var n,r,i,s;const a=[];let o=0;try{for(var l=!0,c=je(this),d;d=yield c.next(),n=d.done,!n;l=!0){s=d.value,l=!1;const y=s;a.push(y),o+=y.byteLength}}catch(y){r={error:y}}finally{try{!l&&!n&&(i=c.return)&&(yield i.call(c))}finally{if(r)throw r.error}}return ie(a,o)[0]})}}class ai{constructor(t){t&&(this.source=new zy(Pt.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class yn{constructor(t){t instanceof yn?this.source=t.source:t instanceof si?this.source=new Ge(Pt.fromAsyncIterable(t)):Va(t)?this.source=new Ge(Pt.fromNodeStream(t)):ji(t)?this.source=new Ge(Pt.fromDOMStream(t)):Pa(t)?this.source=new Ge(Pt.fromDOMStream(t.body)):Ln(t)?this.source=new Ge(Pt.fromIterable(t)):Ye(t)?this.source=new Ge(Pt.fromAsyncIterable(t)):Ze(t)&&(this.source=new Ge(Pt.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class zy{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,n="read"){return this.source.next({cmd:n,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||wt)}return(t){return Object.create(this.source.return&&this.source.return(t)||wt)}}class Ge{constructor(t){this.source=t,this._closedPromise=new Promise(n=>this._closedPromiseResolve=n)}cancel(t){return Y(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return Y(this,arguments,void 0,function*(n,r="read"){return yield this.source.next({cmd:r,size:n})})}throw(t){return Y(this,void 0,void 0,function*(){const n=this.source.throw&&(yield this.source.throw(t))||wt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}return(t){return Y(this,void 0,void 0,function*(){const n=this.source.return&&(yield this.source.return(t))||wt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}}class kl extends ai{constructor(t,n){super(),this.position=0,this.buffer=H(t),this.size=n===void 0?this.buffer.byteLength:n}readInt32(t){const{buffer:n,byteOffset:r}=this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){const{buffer:n,size:r,position:i}=this;return n&&i<r?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(r,i+Math.min(r-i,t)),n.subarray(i,this.position)):null}readAt(t,n){const r=this.buffer,i=Math.min(this.size,t+n);return r?r.subarray(t,i):new Uint8Array(n)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}}class oi extends yn{constructor(t,n){super(),this.position=0,this._handle=t,typeof n=="number"?this.size=n:this._pending=Y(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return Y(this,void 0,void 0,function*(){const{buffer:n,byteOffset:r}=yield this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)})}seek(t){return Y(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 Y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:n,size:r,position:i}=this;if(n&&i<r){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let s=i,a=0,o=0;const l=Math.min(r,s+Math.min(r-s,t)),c=new Uint8Array(Math.max(0,(this.position=l)-s));for(;(s+=o)<l&&(a+=o)<c.byteLength;)({bytesRead:o}=yield n.read(c,a,c.byteLength-a,s));return c}return null})}readAt(t,n){return Y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:r,size:i}=this;if(r&&t+n<i){const s=Math.min(i,t+n),a=new Uint8Array(s-t);return(yield r.read(a,0,n,t)).buffer}return new Uint8Array(n)})}close(){return Y(this,void 0,void 0,function*(){const t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return Y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return Y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}}const jy=65536;function mn(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}const bn=8,hs=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class $l{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){const n=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),r=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]);let i=n[3]*r[3];this.buffer[0]=i&65535;let s=i>>>16;return i=n[2]*r[3],s+=i,i=n[3]*r[2]>>>0,s+=i,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0<i?jy:0,this.buffer[1]+=s>>>16,this.buffer[1]+=n[1]*r[3]+n[2]*r[2]+n[3]*r[1],this.buffer[1]+=n[0]*r[3]+n[1]*r[2]+n[2]*r[1]+n[3]*r[0]<<16,this}_plus(t){const n=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],n<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=n}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`${mn(this.buffer[1])} ${mn(this.buffer[0])}`}}class rt extends $l{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,n=new Uint32Array(2)){return rt.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return rt.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){const r=t.length,i=new rt(n);for(let s=0;s<r;){const a=bn<r-s?bn:r-s,o=new rt(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new rt(new Uint32Array([hs[a],0]));i.times(l),i.plus(o),s+=a}return i}static convertArray(t){const n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)rt.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new rt(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new rt(new Uint32Array(t.buffer)).plus(n)}}class qt extends $l{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){const n=this.buffer[1]<<0,r=t.buffer[1]<<0;return n<r||n===r&&this.buffer[0]<t.buffer[0]}static from(t,n=new Uint32Array(2)){return qt.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return qt.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){const r=t.startsWith("-"),i=t.length,s=new qt(n);for(let a=r?1:0;a<i;){const o=bn<i-a?bn:i-a,l=new qt(new Uint32Array([Number.parseInt(t.slice(a,a+o),10),0])),c=new qt(new Uint32Array([hs[o],0]));s.times(c),s.plus(l),a+=o}return r?s.negate():s}static convertArray(t){const n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)qt.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new qt(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new qt(new Uint32Array(t.buffer)).plus(n)}}class ue{constructor(t){this.buffer=t}high(){return new qt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new qt(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){const n=new rt(new Uint32Array([this.buffer[3],0])),r=new rt(new Uint32Array([this.buffer[2],0])),i=new rt(new Uint32Array([this.buffer[1],0])),s=new rt(new Uint32Array([this.buffer[0],0])),a=new rt(new Uint32Array([t.buffer[3],0])),o=new rt(new Uint32Array([t.buffer[2],0])),l=new rt(new Uint32Array([t.buffer[1],0])),c=new rt(new Uint32Array([t.buffer[0],0]));let d=rt.multiply(s,c);this.buffer[0]=d.low();const y=new rt(new Uint32Array([d.high(),0]));return d=rt.multiply(i,c),y.plus(d),d=rt.multiply(s,l),y.plus(d),this.buffer[1]=y.low(),this.buffer[3]=y.lessThan(d)?1:0,this.buffer[2]=y.high(),new rt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(rt.multiply(r,c)).plus(rt.multiply(i,l)).plus(rt.multiply(s,o)),this.buffer[3]+=rt.multiply(n,c).plus(rt.multiply(r,l)).plus(rt.multiply(i,o)).plus(rt.multiply(s,a)).low(),this}plus(t){const n=new Uint32Array(4);return n[3]=this.buffer[3]+t.buffer[3]>>>0,n[2]=this.buffer[2]+t.buffer[2]>>>0,n[1]=this.buffer[1]+t.buffer[1]>>>0,n[0]=this.buffer[0]+t.buffer[0]>>>0,n[0]<this.buffer[0]>>>0&&++n[1],n[1]<this.buffer[1]>>>0&&++n[2],n[2]<this.buffer[2]>>>0&&++n[3],this.buffer[3]=n[3],this.buffer[2]=n[2],this.buffer[1]=n[1],this.buffer[0]=n[0],this}hex(){return`${mn(this.buffer[3])} ${mn(this.buffer[2])} ${mn(this.buffer[1])} ${mn(this.buffer[0])}`}static multiply(t,n){return new ue(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new ue(new Uint32Array(t.buffer)).plus(n)}static from(t,n=new Uint32Array(4)){return ue.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return ue.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){const r=t.startsWith("-"),i=t.length,s=new ue(n);for(let a=r?1:0;a<i;){const o=bn<i-a?bn:i-a,l=new ue(new Uint32Array([Number.parseInt(t.slice(a,a+o),10),0,0,0])),c=new ue(new Uint32Array([hs[o],0,0,0]));s.times(c),s.plus(l),a+=o}return r?s.negate():s}static convertArray(t){const n=new Uint32Array(t.length*4);for(let r=-1,i=t.length;++r<i;)ue.from(t[r],new Uint32Array(n.buffer,n.byteOffset+16*r,4));return n}}class Pl extends q{constructor(t,n,r,i,s=yt.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=n,this.buffers=r,this.dictionaries=i,this.metadataVersion=s}visit(t){return super.visit(t instanceof ut?t.type:t)}visitNull(t,{length:n}=this.nextFieldNode()){return G({type:t,length:n})}visitBool(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitInt(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFloat(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDate(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTimestamp(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTime(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDecimal(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitList(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),children:this.visitMany(t.children)})}visitUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return this.metadataVersion<yt.V5&&this.readNullBitmap(t,r),t.mode===Et.Sparse?this.visitSparseUnion(t,{length:n,nullCount:r}):this.visitDenseUnion(t,{length:n,nullCount:r})}visitDenseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDuration(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFixedSizeList(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),child:this.visit(t.children[0])})}visitMap(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,n,r=this.nextBufferRange()){return n>0&&this.readData(t,r)||new Uint8Array(0)}readOffsets(t,n){return this.readData(t,n)}readTypeIds(t,n){return this.readData(t,n)}readData(t,{length:n,offset:r}=this.nextBufferRange()){return this.bytes.subarray(r,r+n)}readDictionary(t){return this.dictionaries.get(t.id)}}class Yy extends Pl{constructor(t,n,r,i,s){super(new Uint8Array(0),n,r,i,s),this.sources=t}readNullBitmap(t,n,{offset:r}=this.nextBufferRange()){return n<=0?new Uint8Array(0):ti(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return at(Uint8Array,at(t.OffsetArrayType,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return at(Uint8Array,at(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){const{sources:r}=this;return D.isTimestamp(t)||(D.isInt(t)||D.isTime(t))&&t.bitWidth===64||D.isDuration(t)||D.isDate(t)&&t.unit===Vt.MILLISECOND?at(Uint8Array,qt.convertArray(r[n])):D.isDecimal(t)?at(Uint8Array,ue.convertArray(r[n])):D.isBinary(t)||D.isLargeBinary(t)||D.isFixedSizeBinary(t)?Wy(r[n]):D.isBool(t)?ti(r[n]):D.isUtf8(t)||D.isLargeUtf8(t)?Vi(r[n].join("")):at(Uint8Array,at(t.ArrayType,r[n].map(i=>+i)))}}function Wy(e){const t=e.join(""),n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r>>1]=Number.parseInt(t.slice(r,r+2),16);return n}class C extends q{compareSchemas(t,n){return t===n||n instanceof t.constructor&&this.compareManyFields(t.fields,n.fields)}compareManyFields(t,n){return t===n||Array.isArray(t)&&Array.isArray(n)&&t.length===n.length&&t.every((r,i)=>this.compareFields(r,n[i]))}compareFields(t,n){return t===n||n instanceof t.constructor&&t.name===n.name&&t.nullable===n.nullable&&this.visit(t.type,n.type)}}function Nt(e,t){return t instanceof e.constructor}function He(e,t){return e===t||Nt(e,t)}function Ee(e,t){return e===t||Nt(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function li(e,t){return e===t||Nt(e,t)&&e.precision===t.precision}function qy(e,t){return e===t||Nt(e,t)&&e.byteWidth===t.byteWidth}function ds(e,t){return e===t||Nt(e,t)&&e.unit===t.unit}function zn(e,t){return e===t||Nt(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function jn(e,t){return e===t||Nt(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function Gy(e,t){return e===t||Nt(e,t)&&e.children.length===t.children.length&&Me.compareManyFields(e.children,t.children)}function Hy(e,t){return e===t||Nt(e,t)&&e.children.length===t.children.length&&Me.compareManyFields(e.children,t.children)}function fs(e,t){return e===t||Nt(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&Me.compareManyFields(e.children,t.children)}function Ky(e,t){return e===t||Nt(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Me.visit(e.indices,t.indices)&&Me.visit(e.dictionary,t.dictionary)}function ps(e,t){return e===t||Nt(e,t)&&e.unit===t.unit}function Yn(e,t){return e===t||Nt(e,t)&&e.unit===t.unit}function Qy(e,t){return e===t||Nt(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Me.compareManyFields(e.children,t.children)}function Xy(e,t){return e===t||Nt(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Me.compareManyFields(e.children,t.children)}C.prototype.visitNull=He,C.prototype.visitBool=He,C.prototype.visitInt=Ee,C.prototype.visitInt8=Ee,C.prototype.visitInt16=Ee,C.prototype.visitInt32=Ee,C.prototype.visitInt64=Ee,C.prototype.visitUint8=Ee,C.prototype.visitUint16=Ee,C.prototype.visitUint32=Ee,C.prototype.visitUint64=Ee,C.prototype.visitFloat=li,C.prototype.visitFloat16=li,C.prototype.visitFloat32=li,C.prototype.visitFloat64=li,C.prototype.visitUtf8=He,C.prototype.visitLargeUtf8=He,C.prototype.visitBinary=He,C.prototype.visitLargeBinary=He,C.prototype.visitFixedSizeBinary=qy,C.prototype.visitDate=ds,C.prototype.visitDateDay=ds,C.prototype.visitDateMillisecond=ds,C.prototype.visitTimestamp=zn,C.prototype.visitTimestampSecond=zn,C.prototype.visitTimestampMillisecond=zn,C.prototype.visitTimestampMicrosecond=zn,C.prototype.visitTimestampNanosecond=zn,C.prototype.visitTime=jn,C.prototype.visitTimeSecond=jn,C.prototype.visitTimeMillisecond=jn,C.prototype.visitTimeMicrosecond=jn,C.prototype.visitTimeNanosecond=jn,C.prototype.visitDecimal=He,C.prototype.visitList=Gy,C.prototype.visitStruct=Hy,C.prototype.visitUnion=fs,C.prototype.visitDenseUnion=fs,C.prototype.visitSparseUnion=fs,C.prototype.visitDictionary=Ky,C.prototype.visitInterval=ps,C.prototype.visitIntervalDayTime=ps,C.prototype.visitIntervalYearMonth=ps,C.prototype.visitDuration=Yn,C.prototype.visitDurationSecond=Yn,C.prototype.visitDurationMillisecond=Yn,C.prototype.visitDurationMicrosecond=Yn,C.prototype.visitDurationNanosecond=Yn,C.prototype.visitFixedSizeList=Qy,C.prototype.visitMap=Xy;const Me=new C;function ys(e,t){return Me.compareSchemas(e,t)}function ms(e,t){return Jy(e,t.map(n=>n.data.concat()))}function Jy(e,t){const n=[...e.fields],r=[],i={numBatches:t.reduce((y,_)=>Math.max(y,_.length),0)};let s=0,a=0,o=-1;const l=t.length;let c,d=[];for(;i.numBatches-- >0;){for(a=Number.POSITIVE_INFINITY,o=-1;++o<l;)d[o]=c=t[o].shift(),a=Math.min(a,c?c.length:a);Number.isFinite(a)&&(d=Zy(n,a,d,t,i),a>0&&(r[s++]=G({type:new At(n),length:a,nullCount:0,children:d.slice()})))}return[e=e.assign(n),r.map(y=>new Lt(e,y))]}function Zy(e,t,n,r,i){var s;const a=(t+63&-64)>>3;for(let o=-1,l=r.length;++o<l;){const c=n[o],d=c==null?void 0:c.length;if(d>=t)d===t?n[o]=c:(n[o]=c.slice(0,t),i.numBatches=Math.max(i.numBatches,r[o].unshift(c.slice(t,d-t))));else{const y=e[o];e[o]=y.clone({nullable:!0}),n[o]=(s=c==null?void 0:c._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:G({type:y.type,length:t,nullCount:t,nullBitmap:new Uint8Array(a)})}}return n}var Vl;class Bt{constructor(...t){var n,r;if(t.length===0)return this.batches=[],this.schema=new et([]),this._offsets=[0],this;let i,s;t[0]instanceof et&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());const a=l=>{if(l){if(l instanceof Lt)return[l];if(l instanceof Bt)return l.batches;if(l instanceof nt){if(l.type instanceof At)return[new Lt(new et(l.type.children),l)]}else{if(Array.isArray(l))return l.flatMap(c=>a(c));if(typeof l[Symbol.iterator]=="function")return[...l].flatMap(c=>a(c));if(typeof l=="object"){const c=Object.keys(l),d=c.map(v=>new tt([l[v]])),y=i??new et(c.map((v,E)=>new ut(String(v),d[E].type,d[E].nullable))),[,_]=ms(y,d);return _.length===0?[new Lt(l)]:_}}}return[]},o=t.flatMap(l=>a(l));if(i=(r=i??((n=o[0])===null||n===void 0?void 0:n.schema))!==null&&r!==void 0?r:new et([]),!(i instanceof et))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const l of o){if(!(l instanceof Lt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!ys(i,l.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=o,this._offsets=s??Rl(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,n)=>t+n.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=Bl(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(es(t,this.numRows))}set(t,n){}indexOf(t,n){return-1}[Symbol.iterator](){return this.batches.length>0?os.visit(new tt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
39
|
+
`,S=((O=await E.executeQuery(I,T.value))==null?void 0:O[0])||{xmin:-1,xmax:1,ymin:-1,ymax:1};d.value={schema:[{name:p},{name:g},...m.map(A=>({name:A}))],row_groups:[{columns:[{meta_data:{statistics:{min_value:S.xmin,max_value:S.xmax}}},{meta_data:{statistics:{min_value:S.ymin,max_value:S.ymax}}}]}]}}async function bt(p,g,u){_.value=new Map;const m=["#4269d0","#efb118","#ff725c","#6cc5b0","#3ca951","#ff8ab7","#a463f2","#97bbf5","#9c6b4e","#9498a0"],b=w=>/DOUBLE|HUGEINT|BIGINT|INTEGER|DECIMAL|FLOAT|REAL/i.test(w);for(const w of p){if(w.name===g||w.name===u){_.value.set(w.name,new Map);continue}if(b(w.type))_.value.set(w.name,new Map);else{const I=`SELECT DISTINCT ${dt(w.name)} AS v FROM ${N.value} LIMIT 10000`,S=(await E.executeQuery(I,T.value)).map(A=>A.v).filter(A=>A!=null),O=new Map;S.forEach((A,M)=>O.set(A,Zt(m[M%m.length]))),_.value.set(w.name,O)}}(d.value||(d.value={})).key_value_metadata=Array.from(_.value.keys()).map(w=>{var I;return{key:w,value:JSON.stringify(Array.from(((I=_.value.get(w))==null?void 0:I.keys())??[]))}}),r.value!=="random"&&!_.value.has(r.value)&&(r.value="random")}async function gt(){const{useGetToken:p}=await Promise.resolve().then(()=>Bc);return p()}async function It(p,g){const u=await gt(),m=`${g}/packages/${p}/view?api_key=${u}`,b=await fetch(m);if(!b.ok)throw new Error(`view failed: ${b.status}`);v.value=await b.json()}async function $t(p,g,u){const m=await gt(),b=`${u}/packages/${p}/files/${g}?api_key=${m}`,w=await fetch(b);if(!w.ok)throw new Error(`file url failed: ${w.status}`);return(await w.json()).url}function dt(p){return`"${p.replace(/"/g,'""')}"`}function ht(){o.value=!o.value,l.value++}function Zt(p){try{if(!p||p.length<7)return[1,0,0];const g=parseInt(p.slice(1,3),16)/255,u=parseInt(p.slice(3,5),16)/255,m=parseInt(p.slice(5,7),16)/255;return Number.isNaN(g)||Number.isNaN(u)||Number.isNaN(m)?[1,0,0]:[g,u,m]}catch{return[1,0,0]}}function R(p){y.value=p[1]}async function F(p){return(await E.executeQuery(`PRAGMA table_info(${p});`,T.value)).map(g=>({name:g.name,type:g.type}))}return h.onMounted(async()=>{await B()}),h.onBeforeUnmount(async()=>{T.value&&await E.closeConnection(T.value)}),(p,g)=>(h.openBlock(),h.createElementBlock("div",ep,[(h.openBlock(),h.createBlock(qf,{data:c.value,metaData:d.value,pointCount:n.value,"color-map":y.value,colorMode:r.value,startColor:i.value,endColor:s.value,singleColor:a.value,forceRegenerate:o.value,key:l.value},null,8,["data","metaData","pointCount","color-map","colorMode","startColor","endColor","singleColor","forceRegenerate"])),h.createVNode(tp,{pointCount:n.value,"onUpdate:pointCount":g[0]||(g[0]=u=>n.value=u),colorMode:r.value,"onUpdate:colorMode":g[1]||(g[1]=u=>r.value=u),startColor:i.value,"onUpdate:startColor":g[2]||(g[2]=u=>i.value=u),endColor:s.value,"onUpdate:endColor":g[3]||(g[3]=u=>s.value=u),singleColor:a.value,"onUpdate:singleColor":g[4]||(g[4]=u=>a.value=u),"color-scheme":y.value,"color-map-map":_.value,onRegenerate:ht,onUpdateColorMap:R},null,8,["pointCount","colorMode","startColor","endColor","singleColor","color-scheme","color-map-map"])]))}}),rp=Sn(np,[["__scopeId","data-v-244cd07d"]]),ip="dashboard:globalVars";function La(e=!1){const t=h.inject(ip,null);return!t&&e&&console.warn("[Widget] dashboard:globalVars not provided."),t}const sp={class:"data-explorer-wrap"},ap={class:"data-explorer-info"},op=h.defineComponent({inheritAttrs:!1,__name:"DataExplorer",setup(e){const t=La(),n=h.ref("Data Explorer"),r=h.computed(()=>h.unref(t.s3Url));return h.watchEffect(()=>{}),(i,s)=>{const a=h.resolveComponent("el-icon");return h.openBlock(),h.createElementBlock(h.Fragment,null,[h.renderSlot(i.$slots,"default",{widgetName:n.value},void 0,!0),h.createElementVNode("div",sp,[h.createElementVNode("div",ap,[h.createVNode(h.unref(Pc.ElTooltip),{placement:"top-start"},{content:h.withCtx(()=>[...s[0]||(s[0]=[h.createTextVNode("Type in a query or use the suggested query buttons to run on your csv file",-1)])]),default:h.withCtx(()=>[h.createVNode(a,{color:"#8300BF"},{default:h.withCtx(()=>[h.createVNode(h.unref(jc))]),_:1})]),_:1})]),h.createVNode(h.unref(yu),{srcUrl:r.value},null,8,["srcUrl"])])],64)}}}),xa=(e,t)=>{const n=e.__vccOpts||e;for(const[r,i]of t)n[r]=i;return n},lp=xa(op,[["__scopeId","data-v-2908b590"]]),cp={class:"umap-wrap"},up=xa(Object.assign({inheritAttrs:!1},{__name:"Umap",setup(e){const t=La(),n=h.ref("Data Explorer"),r=h.computed(()=>h.unref(t==null?void 0:t.s3Url));return(i,s)=>(h.openBlock(),h.createElementBlock(h.Fragment,null,[h.renderSlot(i.$slots,"default",{widgetName:n.value},void 0,!0),h.createElementVNode("div",cp,[h.createVNode(h.unref(rp),{srcUrl:r.value},null,8,["srcUrl"])])],64))}}),[["__scopeId","data-v-c778c86e"]]);function Y(e,t,n,r){function i(s){return s instanceof n?s:new n(function(a){a(s)})}return new(n||(n=Promise))(function(s,a){function o(d){try{c(r.next(d))}catch(y){a(y)}}function l(d){try{c(r.throw(d))}catch(y){a(y)}}function c(d){d.done?s(d.value):i(d.value).then(o,l)}c((r=r.apply(e,t||[])).next())})}function Ua(e){var t=typeof Symbol=="function"&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function W(e){return this instanceof W?(this.v=e,this):new W(e)}function re(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(e,t||[]),i,s=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),o("next"),o("throw"),o("return",a),i[Symbol.asyncIterator]=function(){return this},i;function a(v){return function(E){return Promise.resolve(E).then(v,y)}}function o(v,E){r[v]&&(i[v]=function(T){return new Promise(function(N,B){s.push([v,T,N,B])>1||l(v,T)})},E&&(i[v]=E(i[v])))}function l(v,E){try{c(r[v](E))}catch(T){_(s[0][3],T)}}function c(v){v.value instanceof W?Promise.resolve(v.value.v).then(d,y):_(s[0][2],v)}function d(v){l("next",v)}function y(v){l("throw",v)}function _(v,E){v(E),s.shift(),s.length&&l(s[0][0],s[0][1])}}function Sr(e){var t,n;return t={},r("next"),r("throw",function(i){throw i}),r("return"),t[Symbol.iterator]=function(){return this},t;function r(i,s){t[i]=e[i]?function(a){return(n=!n)?{value:W(e[i](a)),done:!1}:s?s(a):a}:s}}function je(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Ua=="function"?Ua(e):e[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(s){n[s]=e[s]&&function(a){return new Promise(function(o,l){a=e[s](a),i(o,l,a.done,a.value)})}}function i(s,a,o,l){Promise.resolve(l).then(function(c){s({value:c,done:o})},a)}}const hp=new TextDecoder("utf-8"),Pi=e=>hp.decode(e),dp=new TextEncoder,Vi=e=>dp.encode(e),fp=e=>typeof e=="number",Ca=e=>typeof e=="boolean",_t=e=>typeof e=="function",Dt=e=>e!=null&&Object(e)===e,Ye=e=>Dt(e)&&_t(e.then),Ln=e=>Dt(e)&&_t(e[Symbol.iterator]),Ze=e=>Dt(e)&&_t(e[Symbol.asyncIterator]),zi=e=>Dt(e)&&Dt(e.schema),ka=e=>Dt(e)&&"done"in e&&"value"in e,$a=e=>Dt(e)&&_t(e.stat)&&fp(e.fd),Pa=e=>Dt(e)&&ji(e.body),Er=e=>"_getDOMStream"in e&&"_getNodeStream"in e,pp=e=>Dt(e)&&_t(e.abort)&&_t(e.getWriter)&&!Er(e),ji=e=>Dt(e)&&_t(e.cancel)&&_t(e.getReader)&&!Er(e),yp=e=>Dt(e)&&_t(e.end)&&_t(e.write)&&Ca(e.writable)&&!Er(e),Va=e=>Dt(e)&&_t(e.read)&&_t(e.pipe)&&Ca(e.readable)&&!Er(e),mp=e=>Dt(e)&&_t(e.clear)&&_t(e.bytes)&&_t(e.position)&&_t(e.setPosition)&&_t(e.capacity)&&_t(e.getBufferIdentifier)&&_t(e.createLong),Yi=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function bp(e){const t=e[0]?[e[0]]:[];let n,r,i,s;for(let a,o,l=0,c=0,d=e.length;++l<d;){if(a=t[c],o=e[l],!a||!o||a.buffer!==o.buffer||o.byteOffset<a.byteOffset){o&&(t[++c]=o);continue}if({byteOffset:n,byteLength:i}=a,{byteOffset:r,byteLength:s}=o,n+i<r||r+s<n){o&&(t[++c]=o);continue}t[c]=new Uint8Array(a.buffer,n,r-n+s)}return t}function za(e,t,n=0,r=t.byteLength){const i=e.byteLength,s=new Uint8Array(e.buffer,e.byteOffset,i),a=new Uint8Array(t.buffer,t.byteOffset,Math.min(r,i));return s.set(a,n),e}function ie(e,t){const n=bp(e),r=n.reduce((d,y)=>d+y.byteLength,0);let i,s,a,o=0,l=-1;const c=Math.min(t||Number.POSITIVE_INFINITY,r);for(const d=n.length;++l<d;){if(i=n[l],s=i.subarray(0,Math.min(i.length,c-o)),c<=o+s.length){s.length<i.length?n[l]=i.subarray(s.length):s.length===i.length&&l++,a?za(a,s,o):a=s;break}za(a||(a=new Uint8Array(c)),s,o),o+=s.length}return[a||new Uint8Array(0),n.slice(l),r-(a?a.byteLength:0)]}function at(e,t){let n=ka(t)?t.value:t;return n instanceof e?e===Uint8Array?new e(n.buffer,n.byteOffset,n.byteLength):n:n?(typeof n=="string"&&(n=Vi(n)),n instanceof ArrayBuffer?new e(n):n instanceof Yi?new e(n):mp(n)?at(e,n.bytes()):ArrayBuffer.isView(n)?n.byteLength<=0?new e(0):new e(n.buffer,n.byteOffset,n.byteLength/e.BYTES_PER_ELEMENT):e.from(n)):new e(0)}const xn=e=>at(Int32Array,e),ja=e=>at(BigInt64Array,e),H=e=>at(Uint8Array,e),Wi=e=>(e.next(),e);function*gp(e,t){const n=function*(i){yield i},r=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Yi?n(t):Ln(t)?t:n(t);return yield*Wi(function*(i){let s=null;do s=i.next(yield at(e,s));while(!s.done)}(r[Symbol.iterator]())),new e}const _p=e=>gp(Uint8Array,e);function Ya(e,t){return re(this,arguments,function*(){if(Ye(t))return yield W(yield W(yield*Sr(je(Ya(e,yield W(t))))));const n=function(s){return re(this,arguments,function*(){yield yield W(yield W(s))})},r=function(s){return re(this,arguments,function*(){yield W(yield*Sr(je(Wi(function*(a){let o=null;do o=a.next(yield o==null?void 0:o.value);while(!o.done)}(s[Symbol.iterator]())))))})},i=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Yi?n(t):Ln(t)?r(t):Ze(t)?t:n(t);return yield W(yield*Sr(je(Wi(function(s){return re(this,arguments,function*(){let a=null;do a=yield W(s.next(yield yield W(at(e,a))));while(!a.done)})}(i[Symbol.asyncIterator]()))))),yield W(new e)})}const vp=e=>Ya(Uint8Array,e);function Wa(e,t,n){if(e!==0){n=n.slice(0,t);for(let r=-1,i=n.length;++r<i;)n[r]+=e}return n.subarray(0,t)}function wp(e,t){let n=0;const r=e.length;if(r!==t.length)return!1;if(r>0)do if(e[n]!==t[n])return!1;while(++n<r);return!0}const Pt={fromIterable(e){return Tr(Ip(e))},fromAsyncIterable(e){return Tr(Sp(e))},fromDOMStream(e){return Tr(Ep(e))},fromNodeStream(e){return Tr(Ap(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},Tr=e=>(e.next(),e);function*Ip(e){let t,n=!1,r=[],i,s,a,o=0;function l(){return s==="peek"?ie(r,a)[0]:([i,r,o]=ie(r,a),i)}({cmd:s,size:a}=(yield null)||{cmd:"read",size:0});const c=_p(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(a-o)?c.next():c.next(a-o),!t&&i.byteLength>0&&(r.push(i),o+=i.byteLength),t||a<=o)do({cmd:s,size:a}=yield l());while(a<o);while(!t)}catch(d){(n=!0)&&typeof c.throw=="function"&&c.throw(d)}finally{n===!1&&typeof c.return=="function"&&c.return(null)}return null}function Sp(e){return re(this,arguments,function*(){let t,n=!1,r=[],i,s,a,o=0;function l(){return s==="peek"?ie(r,a)[0]:([i,r,o]=ie(r,a),i)}({cmd:s,size:a}=(yield yield W(null))||{cmd:"read",size:0});const c=vp(e)[Symbol.asyncIterator]();try{do if({done:t,value:i}=Number.isNaN(a-o)?yield W(c.next()):yield W(c.next(a-o)),!t&&i.byteLength>0&&(r.push(i),o+=i.byteLength),t||a<=o)do({cmd:s,size:a}=yield yield W(l()));while(a<o);while(!t)}catch(d){(n=!0)&&typeof c.throw=="function"&&(yield W(c.throw(d)))}finally{n===!1&&typeof c.return=="function"&&(yield W(c.return(new Uint8Array(0))))}return yield W(null)})}function Ep(e){return re(this,arguments,function*(){let t=!1,n=!1,r=[],i,s,a,o=0;function l(){return s==="peek"?ie(r,a)[0]:([i,r,o]=ie(r,a),i)}({cmd:s,size:a}=(yield yield W(null))||{cmd:"read",size:0});const c=new Tp(e);try{do if({done:t,value:i}=Number.isNaN(a-o)?yield W(c.read()):yield W(c.read(a-o)),!t&&i.byteLength>0&&(r.push(H(i)),o+=i.byteLength),t||a<=o)do({cmd:s,size:a}=yield yield W(l()));while(a<o);while(!t)}catch(d){(n=!0)&&(yield W(c.cancel(d)))}finally{n===!1?yield W(c.cancel()):e.locked&&c.releaseLock()}return yield W(null)})}class Tp{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 Y(this,void 0,void 0,function*(){const{reader:n,source:r}=this;n&&(yield n.cancel(t).catch(()=>{})),r&&r.locked&&this.releaseLock()})}read(t){return Y(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};const n=yield this.reader.read();return!n.done&&(n.value=H(n)),n})}}const qi=(e,t)=>{const n=i=>r([t,i]);let r;return[t,n,new Promise(i=>(r=i)&&e.once(t,n))]};function Ap(e){return re(this,arguments,function*(){const t=[];let n="error",r=!1,i=null,s,a,o=0,l=[],c;function d(){return s==="peek"?ie(l,a)[0]:([c,l,o]=ie(l,a),c)}if({cmd:s,size:a}=(yield yield W(null))||{cmd:"read",size:0},e.isTTY)return yield yield W(new Uint8Array(0)),yield W(null);try{t[0]=qi(e,"end"),t[1]=qi(e,"error");do{if(t[2]=qi(e,"readable"),[n,i]=yield W(Promise.race(t.map(_=>_[2]))),n==="error")break;if((r=n==="end")||(Number.isFinite(a-o)?(c=H(e.read(a-o)),c.byteLength<a-o&&(c=H(e.read()))):c=H(e.read()),c.byteLength>0&&(l.push(c),o+=c.byteLength)),r||a<=o)do({cmd:s,size:a}=yield yield W(d()));while(a<o)}while(!r)}finally{yield W(y(t,n==="error"?i:null))}return yield W(null);function y(_,v){return c=l=null,new Promise((E,T)=>{for(const[N,B]of _)e.off(N,B);try{const N=e.destroy;N&&N.call(e,v),v=void 0}catch(N){v=N||v}finally{v!=null?T(v):E()}})}})}var yt;(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(yt||(yt={}));var Et;(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(Et||(Et={}));var Tt;(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Tt||(Tt={}));var Vt;(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Vt||(Vt={}));var k;(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(k||(k={}));var se;(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(se||(se={}));const Gi=2,ae=4,ge=4,Z=4,Be=new Int32Array(2),qa=new Float32Array(Be.buffer),Ga=new Float64Array(Be.buffer),Ar=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Hi;(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(Hi||(Hi={}));let tn=class kc{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new kc(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 Be[0]=this.readInt32(t),qa[0]}readFloat64(t){return Be[Ar?0:1]=this.readInt32(t),Be[Ar?1:0]=this.readInt32(t+4),Ga[0]}writeInt8(t,n){this.bytes_[t]=n}writeUint8(t,n){this.bytes_[t]=n}writeInt16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeUint16(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8}writeInt32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeUint32(t,n){this.bytes_[t]=n,this.bytes_[t+1]=n>>8,this.bytes_[t+2]=n>>16,this.bytes_[t+3]=n>>24}writeInt64(t,n){this.writeInt32(t,Number(BigInt.asIntN(32,n))),this.writeInt32(t+4,Number(BigInt.asIntN(32,n>>BigInt(32))))}writeUint64(t,n){this.writeUint32(t,Number(BigInt.asUintN(32,n))),this.writeUint32(t+4,Number(BigInt.asUintN(32,n>>BigInt(32))))}writeFloat32(t,n){qa[0]=n,this.writeInt32(t,Be[0])}writeFloat64(t,n){Ga[0]=n,this.writeInt32(t,Be[Ar?0:1]),this.writeInt32(t+4,Be[Ar?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+ae+ge)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let n=0;n<ge;n++)t+=String.fromCharCode(this.readInt8(this.position_+ae+n));return t}__offset(t,n){const r=t-this.readInt32(t);return n<this.readInt16(r)?this.readInt16(r+n):0}__union(t,n){return t.bb_pos=n+this.readInt32(n),t.bb=this,t}__string(t,n){t+=this.readInt32(t);const r=this.readInt32(t);t+=ae;const i=this.bytes_.subarray(t,t+r);return n===Hi.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,n){return typeof t=="string"?this.__string(n):this.__union(t,n)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+ae}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=ge)throw new Error("FlatBuffers: file identifier must be length "+ge);for(let n=0;n<ge;n++)if(t.charCodeAt(n)!=this.readInt8(this.position()+ae+n))return!1;return!0}createScalarList(t,n){const r=[];for(let i=0;i<n;++i){const s=t(i);s!==null&&r.push(s)}return r}createObjList(t,n){const r=[];for(let i=0;i<n;++i){const s=t(i);s!==null&&r.push(s.unpack())}return r}},Ha=class $c{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 n;t?n=t:n=1024,this.bb=tn.allocate(n),this.space=n}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,n){t>this.minalign&&(this.minalign=t);const r=~(this.bb.capacity()-this.space+n)+1&t-1;for(;this.space<r+t+n;){const i=this.bb.capacity();this.bb=$c.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(r)}pad(t){for(let n=0;n<t;n++)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,n,r){(this.force_defaults||n!=r)&&(this.addInt8(n),this.slot(t))}addFieldInt16(t,n,r){(this.force_defaults||n!=r)&&(this.addInt16(n),this.slot(t))}addFieldInt32(t,n,r){(this.force_defaults||n!=r)&&(this.addInt32(n),this.slot(t))}addFieldInt64(t,n,r){(this.force_defaults||n!==r)&&(this.addInt64(n),this.slot(t))}addFieldFloat32(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat32(n),this.slot(t))}addFieldFloat64(t,n,r){(this.force_defaults||n!=r)&&(this.addFloat64(n),this.slot(t))}addFieldOffset(t,n,r){(this.force_defaults||n!=r)&&(this.addOffset(n),this.slot(t))}addFieldStruct(t,n,r){n!=r&&(this.nested(n),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){const n=t.capacity();if(n&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const r=n<<1,i=tn.allocate(r);return i.setPosition(r-n),i.bytes().set(t.bytes(),r-n),i}addOffset(t){this.prep(ae,0),this.writeInt32(this.offset()-t+ae)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let n=0;n<t;n++)this.vtable[n]=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);const t=this.offset();let n=this.vtable_in_use-1;for(;n>=0&&this.vtable[n]==0;n--);const r=n+1;for(;n>=0;n--)this.addInt16(this.vtable[n]!=0?t-this.vtable[n]:0);const i=2;this.addInt16(t-this.object_start);const s=(r+i)*Gi;this.addInt16(s);let a=0;const o=this.space;t:for(n=0;n<this.vtables.length;n++){const l=this.bb.capacity()-this.vtables[n];if(s==this.bb.readInt16(l)){for(let c=Gi;c<s;c+=Gi)if(this.bb.readInt16(o+c)!=this.bb.readInt16(l+c))continue t;a=this.vtables[n];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,n,r){const i=r?Z:0;if(n){const s=n;if(this.prep(this.minalign,ae+ge+i),s.length!=ge)throw new TypeError("FlatBuffers: file identifier must be length "+ge);for(let a=ge-1;a>=0;a--)this.writeInt8(s.charCodeAt(a))}this.prep(this.minalign,ae+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,n){this.finish(t,n,!0)}requiredField(t,n){const r=this.bb.capacity()-t,i=r-this.bb.readInt32(r);if(!(n<this.bb.readInt16(i)&&this.bb.readInt16(i+n)!=0))throw new TypeError("FlatBuffers: field "+n+" must be set")}startVector(t,n,r){this.notNested(),this.vector_num_elems=n,this.prep(ae,t*n),this.prep(r,t*n)}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);const n=this.createString(t);return this.string_maps.set(t,n),n}createString(t){if(t==null)return 0;let n;return t instanceof Uint8Array?n=t:n=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,n.length,1),this.bb.setPosition(this.space-=n.length),this.bb.bytes().set(n,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){const n=[];for(let r=0;r<t.length;++r){const i=t[r];if(i!==null)n.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return n}createStructOffsetList(t,n){return n(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var Nr;(function(e){e[e.BUFFER=0]="BUFFER"})(Nr||(Nr={}));var Br;(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(Br||(Br={}));class Re{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBodyCompression(t,n){return(n||new Re).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,n){return t.setPosition(t.position()+Z),(n||new Re).__init(t.readInt32(t.position())+t.position(),t)}codec(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Br.LZ4_FRAME}method(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Nr.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,n){t.addFieldInt8(0,n,Br.LZ4_FRAME)}static addMethod(t,n){t.addFieldInt8(1,n,Nr.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,n,r){return Re.startBodyCompression(t),Re.addCodec(t,n),Re.addMethod(t,r),Re.endBodyCompression(t)}}class Ka{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,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,n,r){return t.prep(8,16),t.writeInt64(BigInt(r??0)),t.writeInt64(BigInt(n??0)),t.offset()}}let Qa=class{constructor(){this.bb=null,this.bb_pos=0}__init(e,t){return this.bb_pos=e,this.bb=t,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(e,t,n){return e.prep(8,16),e.writeInt64(BigInt(n??0)),e.writeInt64(BigInt(t??0)),e.offset()}},_e=class Vs{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsRecordBatch(t,n){return(n||new Vs).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,n){return t.setPosition(t.position()+Z),(n||new Vs).__init(t.readInt32(t.position())+t.position(),t)}length(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,n){const r=this.bb.__offset(this.bb_pos,6);return r?(n||new Qa).__init(this.bb.__vector(this.bb_pos+r)+t*16,this.bb):null}nodesLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,n){const r=this.bb.__offset(this.bb_pos,8);return r?(n||new Ka).__init(this.bb.__vector(this.bb_pos+r)+t*16,this.bb):null}buffersLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){const n=this.bb.__offset(this.bb_pos,10);return n?(t||new Re).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addNodes(t,n){t.addFieldOffset(1,n,0)}static startNodesVector(t,n){t.startVector(16,n,8)}static addBuffers(t,n){t.addFieldOffset(2,n,0)}static startBuffersVector(t,n){t.startVector(16,n,8)}static addCompression(t,n){t.addFieldOffset(3,n,0)}static endRecordBatch(t){return t.endObject()}},en=class zs{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryBatch(t,n){return(n||new zs).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,n){return t.setPosition(t.position()+Z),(n||new zs).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){const n=this.bb.__offset(this.bb_pos,6);return n?(t||new _e).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}isDelta(){const 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,n){t.addFieldInt64(0,n,BigInt("0"))}static addData(t,n){t.addFieldOffset(1,n,0)}static addIsDelta(t,n){t.addFieldInt8(2,+n,0)}static endDictionaryBatch(t){return t.endObject()}};var nn;(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(nn||(nn={}));var Rr;(function(e){e[e.DenseArray=0]="DenseArray"})(Rr||(Rr={}));class Ut{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInt(t,n){return(n||new Ut).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,n){return t.setPosition(t.position()+Z),(n||new Ut).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){const 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,n){t.addFieldInt32(0,n,0)}static addIsSigned(t,n){t.addFieldInt8(1,+n,0)}static endInt(t){return t.endObject()}static createInt(t,n,r){return Ut.startInt(t),Ut.addBitWidth(t,n),Ut.addIsSigned(t,r),Ut.endInt(t)}}class ve{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDictionaryEncoding(t,n){return(n||new ve).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,n){return t.setPosition(t.position()+Z),(n||new ve).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){const n=this.bb.__offset(this.bb_pos,6);return n?(t||new Ut).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}isOrdered(){const t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):Rr.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,n){t.addFieldInt64(0,n,BigInt("0"))}static addIndexType(t,n){t.addFieldOffset(1,n,0)}static addIsOrdered(t,n){t.addFieldInt8(2,+n,0)}static addDictionaryKind(t,n){t.addFieldInt16(3,n,Rr.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}class vt{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsKeyValue(t,n){return(n||new vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,n){return t.setPosition(t.position()+Z),(n||new vt).__init(t.readInt32(t.position())+t.position(),t)}key(t){const n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}value(t){const n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,n){t.addFieldOffset(0,n,0)}static addValue(t,n){t.addFieldOffset(1,n,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,n,r){return vt.startKeyValue(t),vt.addKey(t,n),vt.addValue(t,r),vt.endKeyValue(t)}}let Xa=class Xn{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBinary(t,n){return(n||new Xn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,n){return t.setPosition(t.position()+Z),(n||new Xn).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return Xn.startBinary(t),Xn.endBinary(t)}},Ja=class Jn{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsBool(t,n){return(n||new Jn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,n){return t.setPosition(t.position()+Z),(n||new Jn).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return Jn.startBool(t),Jn.endBool(t)}},Or=class gn{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDate(t,n){return(n||new gn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,n){return t.setPosition(t.position()+Z),(n||new gn).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Vt.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,Vt.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,n){return gn.startDate(t),gn.addUnit(t,n),gn.endDate(t)}},rn=class Ue{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDecimal(t,n){return(n||new Ue).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,n){return t.setPosition(t.position()+Z),(n||new Ue).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){const 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,n){t.addFieldInt32(0,n,0)}static addScale(t,n){t.addFieldInt32(1,n,0)}static addBitWidth(t,n){t.addFieldInt32(2,n,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,n,r,i){return Ue.startDecimal(t),Ue.addPrecision(t,n),Ue.addScale(t,r),Ue.addBitWidth(t,i),Ue.endDecimal(t)}},Dr=class _n{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsDuration(t,n){return(n||new _n).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,n){return t.setPosition(t.position()+Z),(n||new _n).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):k.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,k.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,n){return _n.startDuration(t),_n.addUnit(t,n),_n.endDuration(t)}},Fr=class vn{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFixedSizeBinary(t,n){return(n||new vn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,n){return t.setPosition(t.position()+Z),(n||new vn).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){const 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,n){t.addFieldInt32(0,n,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,n){return vn.startFixedSizeBinary(t),vn.addByteWidth(t,n),vn.endFixedSizeBinary(t)}},Mr=class wn{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFixedSizeList(t,n){return(n||new wn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,n){return t.setPosition(t.position()+Z),(n||new wn).__init(t.readInt32(t.position())+t.position(),t)}listSize(){const 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,n){t.addFieldInt32(0,n,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,n){return wn.startFixedSizeList(t),wn.addListSize(t,n),wn.endFixedSizeList(t)}};class oe{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFloatingPoint(t,n){return(n||new oe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,n){return t.setPosition(t.position()+Z),(n||new oe).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Tt.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,n){t.addFieldInt16(0,n,Tt.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,n){return oe.startFloatingPoint(t),oe.addPrecision(t,n),oe.endFloatingPoint(t)}}class le{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsInterval(t,n){return(n||new le).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,n){return t.setPosition(t.position()+Z),(n||new le).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):se.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,n){t.addFieldInt16(0,n,se.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,n){return le.startInterval(t),le.addUnit(t,n),le.endInterval(t)}}let Za=class Zn{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsLargeBinary(t,n){return(n||new Zn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,n){return t.setPosition(t.position()+Z),(n||new Zn).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return Zn.startLargeBinary(t),Zn.endLargeBinary(t)}},to=class tr{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsLargeUtf8(t,n){return(n||new tr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,n){return t.setPosition(t.position()+Z),(n||new tr).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return tr.startLargeUtf8(t),tr.endLargeUtf8(t)}},eo=class er{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsList(t,n){return(n||new er).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,n){return t.setPosition(t.position()+Z),(n||new er).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return er.startList(t),er.endList(t)}},Lr=class In{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMap(t,n){return(n||new In).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,n){return t.setPosition(t.position()+Z),(n||new In).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){const 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,n){t.addFieldInt8(0,+n,0)}static endMap(t){return t.endObject()}static createMap(t,n){return In.startMap(t),In.addKeysSorted(t,n),In.endMap(t)}},no=class nr{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsNull(t,n){return(n||new nr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,n){return t.setPosition(t.position()+Z),(n||new nr).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return nr.startNull(t),nr.endNull(t)}};class We{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsStruct_(t,n){return(n||new We).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,n){return t.setPosition(t.position()+Z),(n||new We).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return We.startStruct_(t),We.endStruct_(t)}}class zt{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsTime(t,n){return(n||new zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,n){return t.setPosition(t.position()+Z),(n||new zt).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):k.MILLISECOND}bitWidth(){const 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,n){t.addFieldInt16(0,n,k.MILLISECOND)}static addBitWidth(t,n){t.addFieldInt32(1,n,32)}static endTime(t){return t.endObject()}static createTime(t,n,r){return zt.startTime(t),zt.addUnit(t,n),zt.addBitWidth(t,r),zt.endTime(t)}}class jt{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsTimestamp(t,n){return(n||new jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,n){return t.setPosition(t.position()+Z),(n||new jt).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):k.SECOND}timezone(t){const n=this.bb.__offset(this.bb_pos,6);return n?this.bb.__string(this.bb_pos+n,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,n){t.addFieldInt16(0,n,k.SECOND)}static addTimezone(t,n){t.addFieldOffset(1,n,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,n,r){return jt.startTimestamp(t),jt.addUnit(t,n),jt.addTimezone(t,r),jt.endTimestamp(t)}}class Ft{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUnion(t,n){return(n||new Ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,n){return t.setPosition(t.position()+Z),(n||new Ft).__init(t.readInt32(t.position())+t.position(),t)}mode(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Et.Sparse}typeIds(t){const n=this.bb.__offset(this.bb_pos,6);return n?this.bb.readInt32(this.bb.__vector(this.bb_pos+n)+t*4):0}typeIdsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){const 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,n){t.addFieldInt16(0,n,Et.Sparse)}static addTypeIds(t,n){t.addFieldOffset(1,n,0)}static createTypeIdsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addInt32(n[r]);return t.endVector()}static startTypeIdsVector(t,n){t.startVector(4,n,4)}static endUnion(t){return t.endObject()}static createUnion(t,n,r){return Ft.startUnion(t),Ft.addMode(t,n),Ft.addTypeIds(t,r),Ft.endUnion(t)}}let ro=class rr{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsUtf8(t,n){return(n||new rr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,n){return t.setPosition(t.position()+Z),(n||new rr).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return rr.startUtf8(t),rr.endUtf8(t)}};var lt;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.FloatingPoint=3]="FloatingPoint",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct_=13]="Struct_",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.RunEndEncoded=22]="RunEndEncoded"})(lt||(lt={}));let Yt=class _i{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsField(t,n){return(n||new _i).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,n){return t.setPosition(t.position()+Z),(n||new _i).__init(t.readInt32(t.position())+t.position(),t)}name(t){const n=this.bb.__offset(this.bb_pos,4);return n?this.bb.__string(this.bb_pos+n,t):null}nullable(){const t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):lt.NONE}type(t){const n=this.bb.__offset(this.bb_pos,10);return n?this.bb.__union(t,this.bb_pos+n):null}dictionary(t){const n=this.bb.__offset(this.bb_pos,12);return n?(t||new ve).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}children(t,n){const r=this.bb.__offset(this.bb_pos,14);return r?(n||new _i).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}childrenLength(){const t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){const r=this.bb.__offset(this.bb_pos,16);return r?(n||new vt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){const 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,n){t.addFieldOffset(0,n,0)}static addNullable(t,n){t.addFieldInt8(1,+n,0)}static addTypeType(t,n){t.addFieldInt8(2,n,lt.NONE)}static addType(t,n){t.addFieldOffset(3,n,0)}static addDictionary(t,n){t.addFieldOffset(4,n,0)}static addChildren(t,n){t.addFieldOffset(5,n,0)}static createChildrenVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startChildrenVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(6,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endField(t){return t.endObject()}},ce=class Ae{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsSchema(t,n){return(n||new Ae).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,n){return t.setPosition(t.position()+Z),(n||new Ae).__init(t.readInt32(t.position())+t.position(),t)}endianness(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):nn.Little}fields(t,n){const r=this.bb.__offset(this.bb_pos,6);return r?(n||new Yt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}fieldsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){const r=this.bb.__offset(this.bb_pos,8);return r?(n||new vt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){const n=this.bb.__offset(this.bb_pos,10);return n?this.bb.readInt64(this.bb.__vector(this.bb_pos+n)+t*8):BigInt(0)}featuresLength(){const 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,n){t.addFieldInt16(0,n,nn.Little)}static addFields(t,n){t.addFieldOffset(1,n,0)}static createFieldsVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startFieldsVector(t,n){t.startVector(4,n,4)}static addCustomMetadata(t,n){t.addFieldOffset(2,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static addFeatures(t,n){t.addFieldOffset(3,n,0)}static createFeaturesVector(t,n){t.startVector(8,n.length,8);for(let r=n.length-1;r>=0;r--)t.addInt64(n[r]);return t.endVector()}static startFeaturesVector(t,n){t.startVector(8,n,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,n){t.finish(n)}static finishSizePrefixedSchemaBuffer(t,n){t.finish(n,void 0,!0)}static createSchema(t,n,r,i,s){return Ae.startSchema(t),Ae.addEndianness(t,n),Ae.addFields(t,r),Ae.addCustomMetadata(t,i),Ae.addFeatures(t,s),Ae.endSchema(t)}};var X;(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(X||(X={}));var f;(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond"})(f||(f={}));var we;(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(we||(we={}));const Np=void 0;function Un(e){if(e===null)return"null";if(e===Np)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>Un(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,n)=>typeof n=="bigint"?`${n}`:n)}function ot(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function io(e,t){return ot(e/t)+ot(e%t)/ot(t)}const Bp=Symbol.for("isArrowBigNum");function Qt(e,...t){return t.length===0?Object.setPrototypeOf(at(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}Qt.prototype[Bp]=!0,Qt.prototype.toJSON=function(){return`"${kn(this)}"`},Qt.prototype.valueOf=function(e){return so(this,e)},Qt.prototype.toString=function(){return kn(this)},Qt.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return so(this);case"string":return kn(this);case"default":return Dp(this)}return kn(this)};function sn(...e){return Qt.apply(this,e)}function an(...e){return Qt.apply(this,e)}function Cn(...e){return Qt.apply(this,e)}Object.setPrototypeOf(sn.prototype,Object.create(Int32Array.prototype)),Object.setPrototypeOf(an.prototype,Object.create(Uint32Array.prototype)),Object.setPrototypeOf(Cn.prototype,Object.create(Uint32Array.prototype)),Object.assign(sn.prototype,Qt.prototype,{constructor:sn,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array}),Object.assign(an.prototype,Qt.prototype,{constructor:an,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array}),Object.assign(Cn.prototype,Qt.prototype,{constructor:Cn,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const Rp=BigInt(4294967296)*BigInt(4294967296),Op=Rp-BigInt(1);function so(e,t){const{buffer:n,byteOffset:r,byteLength:i,signed:s}=e,a=new BigUint64Array(n,r,i/8),o=s&&a.at(-1)&BigInt(1)<<BigInt(63);let l=BigInt(0),c=0;if(o){for(const d of a)l|=(d^Op)*(BigInt(1)<<BigInt(64*c++));l*=BigInt(-1),l-=BigInt(1)}else for(const d of a)l|=d*(BigInt(1)<<BigInt(64*c++));if(typeof t=="number"){const d=BigInt(Math.pow(10,t)),y=l/d,_=l%d;return ot(y)+ot(_)/ot(d)}return ot(l)}function kn(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return Ki(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Ki(e);t=t.slice();let n=1;for(let r=0;r<t.length;r++){const i=t[r],s=~i+n;t[r]=s,n&=i===0?1:0}return`-${Ki(t)}`}function Dp(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:kn(e)}function Ki(e){let t="";const n=new Uint32Array(2);let r=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);const i=new Uint32Array((r=new Uint16Array(r).reverse()).buffer);let s=-1;const a=r.length-1;do{for(n[0]=r[s=0];s<a;)r[s++]=n[1]=n[0]/10,n[0]=(n[0]-n[1]*10<<16)+r[s];r[s]=n[1]=n[0]/10,n[0]=n[0]-n[1]*10,t=`${n[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}class Qi{static new(t,n){switch(n){case!0:return new sn(t);case!1:return new an(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new sn(t)}return t.byteLength===16?new Cn(t):new an(t)}static signed(t){return new sn(t)}static unsigned(t){return new an(t)}static decimal(t){return new Cn(t)}constructor(t,n){return Qi.new(t,n)}}var ao,oo,lo,co,uo,ho,fo,po,yo,mo,bo,go,_o,vo,wo,Io,So,Eo,To,Ao,No,Bo;class D{static isNull(t){return(t==null?void 0:t.typeId)===f.Null}static isInt(t){return(t==null?void 0:t.typeId)===f.Int}static isFloat(t){return(t==null?void 0:t.typeId)===f.Float}static isBinary(t){return(t==null?void 0:t.typeId)===f.Binary}static isLargeBinary(t){return(t==null?void 0:t.typeId)===f.LargeBinary}static isUtf8(t){return(t==null?void 0:t.typeId)===f.Utf8}static isLargeUtf8(t){return(t==null?void 0:t.typeId)===f.LargeUtf8}static isBool(t){return(t==null?void 0:t.typeId)===f.Bool}static isDecimal(t){return(t==null?void 0:t.typeId)===f.Decimal}static isDate(t){return(t==null?void 0:t.typeId)===f.Date}static isTime(t){return(t==null?void 0:t.typeId)===f.Time}static isTimestamp(t){return(t==null?void 0:t.typeId)===f.Timestamp}static isInterval(t){return(t==null?void 0:t.typeId)===f.Interval}static isDuration(t){return(t==null?void 0:t.typeId)===f.Duration}static isList(t){return(t==null?void 0:t.typeId)===f.List}static isStruct(t){return(t==null?void 0:t.typeId)===f.Struct}static isUnion(t){return(t==null?void 0:t.typeId)===f.Union}static isFixedSizeBinary(t){return(t==null?void 0:t.typeId)===f.FixedSizeBinary}static isFixedSizeList(t){return(t==null?void 0:t.typeId)===f.FixedSizeList}static isMap(t){return(t==null?void 0:t.typeId)===f.Map}static isDictionary(t){return(t==null?void 0:t.typeId)===f.Dictionary}static isDenseUnion(t){return D.isUnion(t)&&t.mode===Et.Dense}static isSparseUnion(t){return D.isUnion(t)&&t.mode===Et.Sparse}constructor(t){this.typeId=t}}ao=Symbol.toStringTag,D[ao]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[Symbol.toStringTag]="DataType"))(D.prototype);class Oe extends D{constructor(){super(f.Null)}toString(){return"Null"}}oo=Symbol.toStringTag,Oe[oo]=(e=>e[Symbol.toStringTag]="Null")(Oe.prototype);class qe extends D{constructor(t,n){super(f.Int),this.isSigned=t,this.bitWidth=n}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 ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}lo=Symbol.toStringTag,qe[lo]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(qe.prototype);class $n extends qe{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty($n.prototype,"ArrayType",{value:Int32Array});class xr extends D{constructor(t){super(f.Float),this.precision=t}get ArrayType(){switch(this.precision){case Tt.HALF:return Uint16Array;case Tt.SINGLE:return Float32Array;case Tt.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}co=Symbol.toStringTag,xr[co]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(xr.prototype);class Ur extends D{constructor(){super(f.Binary)}toString(){return"Binary"}}uo=Symbol.toStringTag,Ur[uo]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(Ur.prototype);class Cr extends D{constructor(){super(f.LargeBinary)}toString(){return"LargeBinary"}}ho=Symbol.toStringTag,Cr[ho]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(Cr.prototype);class kr extends D{constructor(){super(f.Utf8)}toString(){return"Utf8"}}fo=Symbol.toStringTag,kr[fo]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(kr.prototype);class $r extends D{constructor(){super(f.LargeUtf8)}toString(){return"LargeUtf8"}}po=Symbol.toStringTag,$r[po]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))($r.prototype);class Pr extends D{constructor(){super(f.Bool)}toString(){return"Bool"}}yo=Symbol.toStringTag,Pr[yo]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Pr.prototype);class Vr extends D{constructor(t,n,r=128){super(f.Decimal),this.scale=t,this.precision=n,this.bitWidth=r}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}mo=Symbol.toStringTag,Vr[mo]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(Vr.prototype);class zr extends D{constructor(t){super(f.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Vt[this.unit]}>`}get ArrayType(){return this.unit===Vt.DAY?Int32Array:BigInt64Array}}bo=Symbol.toStringTag,zr[bo]=(e=>(e.unit=null,e[Symbol.toStringTag]="Date"))(zr.prototype);class jr extends D{constructor(t,n){super(f.Time),this.unit=t,this.bitWidth=n}toString(){return`Time${this.bitWidth}<${k[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}go=Symbol.toStringTag,jr[go]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(jr.prototype);class Yr extends D{constructor(t,n){super(f.Timestamp),this.unit=t,this.timezone=n}toString(){return`Timestamp<${k[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}_o=Symbol.toStringTag,Yr[_o]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Timestamp"))(Yr.prototype);class Wr extends D{constructor(t){super(f.Interval),this.unit=t}toString(){return`Interval<${se[this.unit]}>`}}vo=Symbol.toStringTag,Wr[vo]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(Wr.prototype);class qr extends D{constructor(t){super(f.Duration),this.unit=t}toString(){return`Duration<${k[this.unit]}>`}}wo=Symbol.toStringTag,qr[wo]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(qr.prototype);class Gr extends D{constructor(t){super(f.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}Io=Symbol.toStringTag,Gr[Io]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(Gr.prototype);class At extends D{constructor(t){super(f.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}So=Symbol.toStringTag,At[So]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(At.prototype);class Hr extends D{constructor(t,n,r){super(f.Union),this.mode=t,this.children=r,this.typeIds=n=Int32Array.from(n),this.typeIdToChildIndex=n.reduce((i,s,a)=>(i[s]=a)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}Eo=Symbol.toStringTag,Hr[Eo]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Hr.prototype);class Kr extends D{constructor(t){super(f.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}To=Symbol.toStringTag,Kr[To]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(Kr.prototype);class Qr extends D{constructor(t,n){super(f.FixedSizeList),this.listSize=t,this.children=[n]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}}Ao=Symbol.toStringTag,Qr[Ao]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(Qr.prototype);class Xr extends D{constructor(t,n=!1){var r,i,s;if(super(f.Map),this.children=[t],this.keysSorted=n,t&&(t.name="entries",!((r=t==null?void 0:t.type)===null||r===void 0)&&r.children)){const a=(i=t==null?void 0:t.type)===null||i===void 0?void 0:i.children[0];a&&(a.name="key");const o=(s=t==null?void 0:t.type)===null||s===void 0?void 0:s.children[1];o&&(o.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<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}No=Symbol.toStringTag,Xr[No]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Xr.prototype);const Fp=(e=>()=>++e)(-1);class on extends D{constructor(t,n,r,i){super(f.Dictionary),this.indices=n,this.dictionary=t,this.isOrdered=i||!1,this.id=r==null?Fp():ot(r)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}Bo=Symbol.toStringTag,on[Bo]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(on.prototype);function Ie(e){const t=e;switch(e.typeId){case f.Decimal:return e.bitWidth/32;case f.Interval:return 1+t.unit;case f.FixedSizeList:return t.listSize;case f.FixedSizeBinary:return t.byteWidth;default:return 1}}class q{visitMany(t,...n){return t.map((r,i)=>this.visit(r,...n.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,n=!0){return Mp(this,t,n)}getVisitFnByTypeId(t,n=!0){return ln(this,t,n)}visitNull(t,...n){return null}visitBool(t,...n){return null}visitInt(t,...n){return null}visitFloat(t,...n){return null}visitUtf8(t,...n){return null}visitLargeUtf8(t,...n){return null}visitBinary(t,...n){return null}visitLargeBinary(t,...n){return null}visitFixedSizeBinary(t,...n){return null}visitDate(t,...n){return null}visitTimestamp(t,...n){return null}visitTime(t,...n){return null}visitDecimal(t,...n){return null}visitList(t,...n){return null}visitStruct(t,...n){return null}visitUnion(t,...n){return null}visitDictionary(t,...n){return null}visitInterval(t,...n){return null}visitDuration(t,...n){return null}visitFixedSizeList(t,...n){return null}visitMap(t,...n){return null}}function Mp(e,t,n=!0){return typeof t=="number"?ln(e,t,n):typeof t=="string"&&t in f?ln(e,f[t],n):t&&t instanceof D?ln(e,Ro(t),n):t!=null&&t.type&&t.type instanceof D?ln(e,Ro(t.type),n):ln(e,f.NONE,n)}function ln(e,t,n=!0){let r=null;switch(t){case f.Null:r=e.visitNull;break;case f.Bool:r=e.visitBool;break;case f.Int:r=e.visitInt;break;case f.Int8:r=e.visitInt8||e.visitInt;break;case f.Int16:r=e.visitInt16||e.visitInt;break;case f.Int32:r=e.visitInt32||e.visitInt;break;case f.Int64:r=e.visitInt64||e.visitInt;break;case f.Uint8:r=e.visitUint8||e.visitInt;break;case f.Uint16:r=e.visitUint16||e.visitInt;break;case f.Uint32:r=e.visitUint32||e.visitInt;break;case f.Uint64:r=e.visitUint64||e.visitInt;break;case f.Float:r=e.visitFloat;break;case f.Float16:r=e.visitFloat16||e.visitFloat;break;case f.Float32:r=e.visitFloat32||e.visitFloat;break;case f.Float64:r=e.visitFloat64||e.visitFloat;break;case f.Utf8:r=e.visitUtf8;break;case f.LargeUtf8:r=e.visitLargeUtf8;break;case f.Binary:r=e.visitBinary;break;case f.LargeBinary:r=e.visitLargeBinary;break;case f.FixedSizeBinary:r=e.visitFixedSizeBinary;break;case f.Date:r=e.visitDate;break;case f.DateDay:r=e.visitDateDay||e.visitDate;break;case f.DateMillisecond:r=e.visitDateMillisecond||e.visitDate;break;case f.Timestamp:r=e.visitTimestamp;break;case f.TimestampSecond:r=e.visitTimestampSecond||e.visitTimestamp;break;case f.TimestampMillisecond:r=e.visitTimestampMillisecond||e.visitTimestamp;break;case f.TimestampMicrosecond:r=e.visitTimestampMicrosecond||e.visitTimestamp;break;case f.TimestampNanosecond:r=e.visitTimestampNanosecond||e.visitTimestamp;break;case f.Time:r=e.visitTime;break;case f.TimeSecond:r=e.visitTimeSecond||e.visitTime;break;case f.TimeMillisecond:r=e.visitTimeMillisecond||e.visitTime;break;case f.TimeMicrosecond:r=e.visitTimeMicrosecond||e.visitTime;break;case f.TimeNanosecond:r=e.visitTimeNanosecond||e.visitTime;break;case f.Decimal:r=e.visitDecimal;break;case f.List:r=e.visitList;break;case f.Struct:r=e.visitStruct;break;case f.Union:r=e.visitUnion;break;case f.DenseUnion:r=e.visitDenseUnion||e.visitUnion;break;case f.SparseUnion:r=e.visitSparseUnion||e.visitUnion;break;case f.Dictionary:r=e.visitDictionary;break;case f.Interval:r=e.visitInterval;break;case f.IntervalDayTime:r=e.visitIntervalDayTime||e.visitInterval;break;case f.IntervalYearMonth:r=e.visitIntervalYearMonth||e.visitInterval;break;case f.Duration:r=e.visitDuration;break;case f.DurationSecond:r=e.visitDurationSecond||e.visitDuration;break;case f.DurationMillisecond:r=e.visitDurationMillisecond||e.visitDuration;break;case f.DurationMicrosecond:r=e.visitDurationMicrosecond||e.visitDuration;break;case f.DurationNanosecond:r=e.visitDurationNanosecond||e.visitDuration;break;case f.FixedSizeList:r=e.visitFixedSizeList;break;case f.Map:r=e.visitMap;break}if(typeof r=="function")return r;if(!n)return()=>null;throw new Error(`Unrecognized type '${f[t]}'`)}function Ro(e){switch(e.typeId){case f.Null:return f.Null;case f.Int:{const{bitWidth:t,isSigned:n}=e;switch(t){case 8:return n?f.Int8:f.Uint8;case 16:return n?f.Int16:f.Uint16;case 32:return n?f.Int32:f.Uint32;case 64:return n?f.Int64:f.Uint64}return f.Int}case f.Float:switch(e.precision){case Tt.HALF:return f.Float16;case Tt.SINGLE:return f.Float32;case Tt.DOUBLE:return f.Float64}return f.Float;case f.Binary:return f.Binary;case f.LargeBinary:return f.LargeBinary;case f.Utf8:return f.Utf8;case f.LargeUtf8:return f.LargeUtf8;case f.Bool:return f.Bool;case f.Decimal:return f.Decimal;case f.Time:switch(e.unit){case k.SECOND:return f.TimeSecond;case k.MILLISECOND:return f.TimeMillisecond;case k.MICROSECOND:return f.TimeMicrosecond;case k.NANOSECOND:return f.TimeNanosecond}return f.Time;case f.Timestamp:switch(e.unit){case k.SECOND:return f.TimestampSecond;case k.MILLISECOND:return f.TimestampMillisecond;case k.MICROSECOND:return f.TimestampMicrosecond;case k.NANOSECOND:return f.TimestampNanosecond}return f.Timestamp;case f.Date:switch(e.unit){case Vt.DAY:return f.DateDay;case Vt.MILLISECOND:return f.DateMillisecond}return f.Date;case f.Interval:switch(e.unit){case se.DAY_TIME:return f.IntervalDayTime;case se.YEAR_MONTH:return f.IntervalYearMonth}return f.Interval;case f.Duration:switch(e.unit){case k.SECOND:return f.DurationSecond;case k.MILLISECOND:return f.DurationMillisecond;case k.MICROSECOND:return f.DurationMicrosecond;case k.NANOSECOND:return f.DurationNanosecond}return f.Duration;case f.Map:return f.Map;case f.List:return f.List;case f.Struct:return f.Struct;case f.Union:switch(e.mode){case Et.Dense:return f.DenseUnion;case Et.Sparse:return f.SparseUnion}return f.Union;case f.FixedSizeBinary:return f.FixedSizeBinary;case f.FixedSizeList:return f.FixedSizeList;case f.Dictionary:return f.Dictionary}throw new Error(`Unrecognized type '${f[e.typeId]}'`)}q.prototype.visitInt8=null,q.prototype.visitInt16=null,q.prototype.visitInt32=null,q.prototype.visitInt64=null,q.prototype.visitUint8=null,q.prototype.visitUint16=null,q.prototype.visitUint32=null,q.prototype.visitUint64=null,q.prototype.visitFloat16=null,q.prototype.visitFloat32=null,q.prototype.visitFloat64=null,q.prototype.visitDateDay=null,q.prototype.visitDateMillisecond=null,q.prototype.visitTimestampSecond=null,q.prototype.visitTimestampMillisecond=null,q.prototype.visitTimestampMicrosecond=null,q.prototype.visitTimestampNanosecond=null,q.prototype.visitTimeSecond=null,q.prototype.visitTimeMillisecond=null,q.prototype.visitTimeMicrosecond=null,q.prototype.visitTimeNanosecond=null,q.prototype.visitDenseUnion=null,q.prototype.visitSparseUnion=null,q.prototype.visitIntervalDayTime=null,q.prototype.visitIntervalYearMonth=null,q.prototype.visitDuration=null,q.prototype.visitDurationSecond=null,q.prototype.visitDurationMillisecond=null,q.prototype.visitDurationMicrosecond=null,q.prototype.visitDurationNanosecond=null;const Oo=new Float64Array(1),cn=new Uint32Array(Oo.buffer);function Do(e){const t=(e&31744)>>10,n=(e&1023)/1024,r=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return r*(n?Number.NaN:1/0);case 0:return r*(n?6103515625e-14*n:0)}return r*Math.pow(2,t-15)*(1+n)}function Lp(e){if(e!==e)return 32256;Oo[0]=e;const t=(cn[1]&2147483648)>>16&65535;let n=cn[1]&2146435072,r=0;return n>=1089470464?cn[0]>0?n=31744:(n=(n&2080374784)>>16,r=(cn[1]&1048575)>>10):n<=1056964608?(r=1048576+(cn[1]&1048575),r=1048576+(r<<(n>>20)-998)>>21,n=0):(n=n-1056964608>>10,r=(cn[1]&1048575)+512>>10),t|n|r&65535}class $ extends q{}function z(e){return(t,n,r)=>{if(t.setValid(n,r!=null))return e(t,n,r)}}const xp=(e,t,n)=>{e[t]=Math.floor(n/864e5)},Fo=(e,t,n,r)=>{if(n+1<t.length){const i=ot(t[n]),s=ot(t[n+1]);e.set(r.subarray(0,s-i),i)}},Up=({offset:e,values:t},n,r)=>{const i=e+n;r?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},Se=({values:e},t,n)=>{e[t]=n},Xi=({values:e},t,n)=>{e[t]=n},Mo=({values:e},t,n)=>{e[t]=Lp(n)},Cp=(e,t,n)=>{switch(e.type.precision){case Tt.HALF:return Mo(e,t,n);case Tt.SINGLE:case Tt.DOUBLE:return Xi(e,t,n)}},Lo=({values:e},t,n)=>{xp(e,t,n.valueOf())},xo=({values:e},t,n)=>{e[t]=BigInt(n)},kp=({stride:e,values:t},n,r)=>{t.set(r.subarray(0,e),e*n)},Uo=({values:e,valueOffsets:t},n,r)=>Fo(e,t,n,r),Co=({values:e,valueOffsets:t},n,r)=>Fo(e,t,n,Vi(r)),$p=(e,t,n)=>{e.type.unit===Vt.DAY?Lo(e,t,n):xo(e,t,n)},ko=({values:e},t,n)=>{e[t]=BigInt(n/1e3)},$o=({values:e},t,n)=>{e[t]=BigInt(n)},Po=({values:e},t,n)=>{e[t]=BigInt(n*1e3)},Vo=({values:e},t,n)=>{e[t]=BigInt(n*1e6)},Pp=(e,t,n)=>{switch(e.type.unit){case k.SECOND:return ko(e,t,n);case k.MILLISECOND:return $o(e,t,n);case k.MICROSECOND:return Po(e,t,n);case k.NANOSECOND:return Vo(e,t,n)}},zo=({values:e},t,n)=>{e[t]=n},jo=({values:e},t,n)=>{e[t]=n},Yo=({values:e},t,n)=>{e[t]=n},Wo=({values:e},t,n)=>{e[t]=n},Vp=(e,t,n)=>{switch(e.type.unit){case k.SECOND:return zo(e,t,n);case k.MILLISECOND:return jo(e,t,n);case k.MICROSECOND:return Yo(e,t,n);case k.NANOSECOND:return Wo(e,t,n)}},zp=({values:e,stride:t},n,r)=>{e.set(r.subarray(0,t),t*n)},jp=(e,t,n)=>{const r=e.children[0],i=e.valueOffsets,s=Wt.getVisitFn(r);if(Array.isArray(n))for(let a=-1,o=i[t],l=i[t+1];o<l;)s(r,o++,n[++a]);else for(let a=-1,o=i[t],l=i[t+1];o<l;)s(r,o++,n.get(++a))},Yp=(e,t,n)=>{const r=e.children[0],{valueOffsets:i}=e,s=Wt.getVisitFn(r);let{[t]:a,[t+1]:o}=i;const l=n instanceof Map?n.entries():Object.entries(n);for(const c of l)if(s(r,a,c),++a>=o)break},Wp=(e,t)=>(n,r,i,s)=>r&&n(r,e,t[s]),qp=(e,t)=>(n,r,i,s)=>r&&n(r,e,t.get(s)),Gp=(e,t)=>(n,r,i,s)=>r&&n(r,e,t.get(i.name)),Hp=(e,t)=>(n,r,i,s)=>r&&n(r,e,t[i.name]),Kp=(e,t,n)=>{const r=e.type.children.map(s=>Wt.getVisitFn(s.type)),i=n instanceof Map?Gp(t,n):n instanceof tt?qp(t,n):Array.isArray(n)?Wp(t,n):Hp(t,n);e.type.children.forEach((s,a)=>i(r[a],e.children[a],s,a))},Qp=(e,t,n)=>{e.type.mode===Et.Dense?qo(e,t,n):Go(e,t,n)},qo=(e,t,n)=>{const r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];Wt.visit(i,e.valueOffsets[t],n)},Go=(e,t,n)=>{const r=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[r];Wt.visit(i,t,n)},Xp=(e,t,n)=>{var r;(r=e.dictionary)===null||r===void 0||r.set(e.values[t],n)},Jp=(e,t,n)=>{e.type.unit===se.DAY_TIME?Ho(e,t,n):Ko(e,t,n)},Ho=({values:e},t,n)=>{e.set(n.subarray(0,2),2*t)},Ko=({values:e},t,n)=>{e[t]=n[0]*12+n[1]%12},Qo=({values:e},t,n)=>{e[t]=n},Xo=({values:e},t,n)=>{e[t]=n},Jo=({values:e},t,n)=>{e[t]=n},Zo=({values:e},t,n)=>{e[t]=n},Zp=(e,t,n)=>{switch(e.type.unit){case k.SECOND:return Qo(e,t,n);case k.MILLISECOND:return Xo(e,t,n);case k.MICROSECOND:return Jo(e,t,n);case k.NANOSECOND:return Zo(e,t,n)}},ty=(e,t,n)=>{const{stride:r}=e,i=e.children[0],s=Wt.getVisitFn(i);if(Array.isArray(n))for(let a=-1,o=t*r;++a<r;)s(i,o+a,n[a]);else for(let a=-1,o=t*r;++a<r;)s(i,o+a,n.get(a))};$.prototype.visitBool=z(Up),$.prototype.visitInt=z(Se),$.prototype.visitInt8=z(Se),$.prototype.visitInt16=z(Se),$.prototype.visitInt32=z(Se),$.prototype.visitInt64=z(Se),$.prototype.visitUint8=z(Se),$.prototype.visitUint16=z(Se),$.prototype.visitUint32=z(Se),$.prototype.visitUint64=z(Se),$.prototype.visitFloat=z(Cp),$.prototype.visitFloat16=z(Mo),$.prototype.visitFloat32=z(Xi),$.prototype.visitFloat64=z(Xi),$.prototype.visitUtf8=z(Co),$.prototype.visitLargeUtf8=z(Co),$.prototype.visitBinary=z(Uo),$.prototype.visitLargeBinary=z(Uo),$.prototype.visitFixedSizeBinary=z(kp),$.prototype.visitDate=z($p),$.prototype.visitDateDay=z(Lo),$.prototype.visitDateMillisecond=z(xo),$.prototype.visitTimestamp=z(Pp),$.prototype.visitTimestampSecond=z(ko),$.prototype.visitTimestampMillisecond=z($o),$.prototype.visitTimestampMicrosecond=z(Po),$.prototype.visitTimestampNanosecond=z(Vo),$.prototype.visitTime=z(Vp),$.prototype.visitTimeSecond=z(zo),$.prototype.visitTimeMillisecond=z(jo),$.prototype.visitTimeMicrosecond=z(Yo),$.prototype.visitTimeNanosecond=z(Wo),$.prototype.visitDecimal=z(zp),$.prototype.visitList=z(jp),$.prototype.visitStruct=z(Kp),$.prototype.visitUnion=z(Qp),$.prototype.visitDenseUnion=z(qo),$.prototype.visitSparseUnion=z(Go),$.prototype.visitDictionary=z(Xp),$.prototype.visitInterval=z(Jp),$.prototype.visitIntervalDayTime=z(Ho),$.prototype.visitIntervalYearMonth=z(Ko),$.prototype.visitDuration=z(Zp),$.prototype.visitDurationSecond=z(Qo),$.prototype.visitDurationMillisecond=z(Xo),$.prototype.visitDurationMicrosecond=z(Jo),$.prototype.visitDurationNanosecond=z(Zo),$.prototype.visitFixedSizeList=z(ty),$.prototype.visitMap=z(Yp);const Wt=new $,Xt=Symbol.for("parent"),un=Symbol.for("rowIndex");class Ji{constructor(t,n){return this[Xt]=t,this[un]=n,new Proxy(this,new ny)}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[un],n=this[Xt],r=n.type.children,i={};for(let s=-1,a=r.length;++s<a;)i[r[s].name]=Mt.visit(n.children[s],t);return i}toString(){return`{${[...this].map(([t,n])=>`${Un(t)}: ${Un(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new ey(this[Xt],this[un])}}class ey{constructor(t,n){this.childIndex=0,this.children=t.children,this.rowIndex=n,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){const t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,Mt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}}Object.defineProperties(Ji.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Xt]:{writable:!0,enumerable:!1,configurable:!1,value:null},[un]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});class ny{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Xt].type.children.map(n=>n.name)}has(t,n){return t[Xt].type.children.findIndex(r=>r.name===n)!==-1}getOwnPropertyDescriptor(t,n){if(t[Xt].type.children.findIndex(r=>r.name===n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];const r=t[Xt].type.children.findIndex(i=>i.name===n);if(r!==-1){const i=Mt.visit(t[Xt].children[r],t[un]);return Reflect.set(t,n,i),i}}set(t,n,r){const i=t[Xt].type.children.findIndex(s=>s.name===n);return i!==-1?(Wt.visit(t[Xt].children[i],t[un],r),Reflect.set(t,n,r)):Reflect.has(t,n)||typeof n=="symbol"?Reflect.set(t,n,r):!1}}class L extends q{}function P(e){return(t,n)=>t.getValid(n)?e(t,n):null}const ry=(e,t)=>864e5*e[t],iy=(e,t)=>null,tl=(e,t,n)=>{if(n+1>=t.length)return null;const r=ot(t[n]),i=ot(t[n+1]);return e.subarray(r,i)},sy=({offset:e,values:t},n)=>{const r=e+n;return(t[r>>3]&1<<r%8)!==0},el=({values:e},t)=>ry(e,t),nl=({values:e},t)=>ot(e[t]),De=({stride:e,values:t},n)=>t[e*n],ay=({stride:e,values:t},n)=>Do(t[e*n]),rl=({values:e},t)=>e[t],oy=({stride:e,values:t},n)=>t.subarray(e*n,e*(n+1)),il=({values:e,valueOffsets:t},n)=>tl(e,t,n),sl=({values:e,valueOffsets:t},n)=>{const r=tl(e,t,n);return r!==null?Pi(r):null},ly=({values:e},t)=>e[t],cy=({type:e,values:t},n)=>e.precision!==Tt.HALF?t[n]:Do(t[n]),uy=(e,t)=>e.type.unit===Vt.DAY?el(e,t):nl(e,t),al=({values:e},t)=>1e3*ot(e[t]),ol=({values:e},t)=>ot(e[t]),ll=({values:e},t)=>io(e[t],BigInt(1e3)),cl=({values:e},t)=>io(e[t],BigInt(1e6)),hy=(e,t)=>{switch(e.type.unit){case k.SECOND:return al(e,t);case k.MILLISECOND:return ol(e,t);case k.MICROSECOND:return ll(e,t);case k.NANOSECOND:return cl(e,t)}},ul=({values:e},t)=>e[t],hl=({values:e},t)=>e[t],dl=({values:e},t)=>e[t],fl=({values:e},t)=>e[t],dy=(e,t)=>{switch(e.type.unit){case k.SECOND:return ul(e,t);case k.MILLISECOND:return hl(e,t);case k.MICROSECOND:return dl(e,t);case k.NANOSECOND:return fl(e,t)}},fy=({values:e,stride:t},n)=>Qi.decimal(e.subarray(t*n,t*(n+1))),py=(e,t)=>{const{valueOffsets:n,stride:r,children:i}=e,{[t*r]:s,[t*r+1]:a}=n,o=i[0].slice(s,a-s);return new tt([o])},yy=(e,t)=>{const{valueOffsets:n,children:r}=e,{[t]:i,[t+1]:s}=n,a=r[0];return new ts(a.slice(i,s-i))},my=(e,t)=>new Ji(e,t),by=(e,t)=>e.type.mode===Et.Dense?pl(e,t):yl(e,t),pl=(e,t)=>{const n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return Mt.visit(r,e.valueOffsets[t])},yl=(e,t)=>{const n=e.type.typeIdToChildIndex[e.typeIds[t]],r=e.children[n];return Mt.visit(r,t)},gy=(e,t)=>{var n;return(n=e.dictionary)===null||n===void 0?void 0:n.get(e.values[t])},_y=(e,t)=>e.type.unit===se.DAY_TIME?ml(e,t):bl(e,t),ml=({values:e},t)=>e.subarray(2*t,2*(t+1)),bl=({values:e},t)=>{const n=e[t],r=new Int32Array(2);return r[0]=Math.trunc(n/12),r[1]=Math.trunc(n%12),r},gl=({values:e},t)=>e[t],_l=({values:e},t)=>e[t],vl=({values:e},t)=>e[t],wl=({values:e},t)=>e[t],vy=(e,t)=>{switch(e.type.unit){case k.SECOND:return gl(e,t);case k.MILLISECOND:return _l(e,t);case k.MICROSECOND:return vl(e,t);case k.NANOSECOND:return wl(e,t)}},wy=(e,t)=>{const{stride:n,children:r}=e,i=r[0].slice(t*n,n);return new tt([i])};L.prototype.visitNull=P(iy),L.prototype.visitBool=P(sy),L.prototype.visitInt=P(ly),L.prototype.visitInt8=P(De),L.prototype.visitInt16=P(De),L.prototype.visitInt32=P(De),L.prototype.visitInt64=P(rl),L.prototype.visitUint8=P(De),L.prototype.visitUint16=P(De),L.prototype.visitUint32=P(De),L.prototype.visitUint64=P(rl),L.prototype.visitFloat=P(cy),L.prototype.visitFloat16=P(ay),L.prototype.visitFloat32=P(De),L.prototype.visitFloat64=P(De),L.prototype.visitUtf8=P(sl),L.prototype.visitLargeUtf8=P(sl),L.prototype.visitBinary=P(il),L.prototype.visitLargeBinary=P(il),L.prototype.visitFixedSizeBinary=P(oy),L.prototype.visitDate=P(uy),L.prototype.visitDateDay=P(el),L.prototype.visitDateMillisecond=P(nl),L.prototype.visitTimestamp=P(hy),L.prototype.visitTimestampSecond=P(al),L.prototype.visitTimestampMillisecond=P(ol),L.prototype.visitTimestampMicrosecond=P(ll),L.prototype.visitTimestampNanosecond=P(cl),L.prototype.visitTime=P(dy),L.prototype.visitTimeSecond=P(ul),L.prototype.visitTimeMillisecond=P(hl),L.prototype.visitTimeMicrosecond=P(dl),L.prototype.visitTimeNanosecond=P(fl),L.prototype.visitDecimal=P(fy),L.prototype.visitList=P(py),L.prototype.visitStruct=P(my),L.prototype.visitUnion=P(by),L.prototype.visitDenseUnion=P(pl),L.prototype.visitSparseUnion=P(yl),L.prototype.visitDictionary=P(gy),L.prototype.visitInterval=P(_y),L.prototype.visitIntervalDayTime=P(ml),L.prototype.visitIntervalYearMonth=P(bl),L.prototype.visitDuration=P(vy),L.prototype.visitDurationSecond=P(gl),L.prototype.visitDurationMillisecond=P(_l),L.prototype.visitDurationMicrosecond=P(vl),L.prototype.visitDurationNanosecond=P(wl),L.prototype.visitFixedSizeList=P(wy),L.prototype.visitMap=P(yy);const Mt=new L,hn=Symbol.for("keys"),dn=Symbol.for("vals"),fn=Symbol.for("kKeysAsStrings"),Zi=Symbol.for("_kKeysAsStrings");class ts{constructor(t){return this[hn]=new tt([t.children[0]]).memoize(),this[dn]=t.children[1],new Proxy(this,new Sy)}get[fn](){return this[Zi]||(this[Zi]=Array.from(this[hn].toArray(),String))}[Symbol.iterator](){return new Iy(this[hn],this[dn])}get size(){return this[hn].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[hn],n=this[dn],r={};for(let i=-1,s=t.length;++i<s;)r[t.get(i)]=Mt.visit(n,i);return r}toString(){return`{${[...this].map(([t,n])=>`${Un(t)}: ${Un(n)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class Iy{constructor(t,n){this.keys=t,this.vals=n,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){const t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),Mt.visit(this.vals,t)]})}}class Sy{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[fn]}has(t,n){return t[fn].includes(n)}getOwnPropertyDescriptor(t,n){if(t[fn].indexOf(n)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,n){if(Reflect.has(t,n))return t[n];const r=t[fn].indexOf(n);if(r!==-1){const i=Mt.visit(Reflect.get(t,dn),r);return Reflect.set(t,n,i),i}}set(t,n,r){const i=t[fn].indexOf(n);return i!==-1?(Wt.visit(Reflect.get(t,dn),i,r),Reflect.set(t,n,r)):Reflect.has(t,n)?Reflect.set(t,n,r):!1}}Object.defineProperties(ts.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[hn]:{writable:!0,enumerable:!1,configurable:!1,value:null},[dn]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Zi]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let Il;function Sl(e,t,n,r){const{length:i=0}=e;let s=typeof t!="number"?0:t,a=typeof n!="number"?i:n;return s<0&&(s=(s%i+i)%i),a<0&&(a=(a%i+i)%i),a<s&&(Il=s,s=a,a=Il),a>i&&(a=i),r?r(e,s,a):[s,a]}const es=(e,t)=>e<0?t+e:e,El=e=>e!==e;function pn(e){if(typeof e!="object"||e===null)return El(e)?El:t=>t===e;if(e instanceof Date){const t=e.valueOf();return n=>n instanceof Date?n.valueOf()===t:!1}return ArrayBuffer.isView(e)?t=>t?wp(e,t):!1:e instanceof Map?Ty(e):Array.isArray(e)?Ey(e):e instanceof tt?Ay(e):Ny(e,!0)}function Ey(e){const t=[];for(let n=-1,r=e.length;++n<r;)t[n]=pn(e[n]);return Jr(t)}function Ty(e){let t=-1;const n=[];for(const r of e.values())n[++t]=pn(r);return Jr(n)}function Ay(e){const t=[];for(let n=-1,r=e.length;++n<r;)t[n]=pn(e.get(n));return Jr(t)}function Ny(e,t=!1){const n=Object.keys(e);if(!t&&n.length===0)return()=>!1;const r=[];for(let i=-1,s=n.length;++i<s;)r[i]=pn(e[n[i]]);return Jr(r,n)}function Jr(e,t){return n=>{if(!n||typeof n!="object")return!1;switch(n.constructor){case Array:return By(e,n);case Map:return Tl(e,n,n.keys());case ts:case Ji:case Object:case void 0:return Tl(e,n,t||Object.keys(n))}return n instanceof tt?Ry(e,n):!1}}function By(e,t){const n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t[r]))return!1;return!0}function Ry(e,t){const n=e.length;if(t.length!==n)return!1;for(let r=-1;++r<n;)if(!e[r](t.get(r)))return!1;return!0}function Tl(e,t,n){const r=n[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),s=t instanceof Map?t.values():Object.values(t)[Symbol.iterator]();let a=0;const o=e.length;let l=s.next(),c=r.next(),d=i.next();for(;a<o&&!c.done&&!d.done&&!l.done&&!(c.value!==d.value||!e[a](l.value));++a,c=r.next(),d=i.next(),l=s.next());return a===o&&c.done&&d.done&&l.done?!0:(r.return&&r.return(),i.return&&i.return(),s.return&&s.return(),!1)}function Al(e,t,n,r){return(n&1<<r)!==0}function Oy(e,t,n,r){return(n&1<<r)>>r}function Zr(e,t,n){const r=n.byteLength+7&-8;if(e>0||n.byteLength<r){const i=new Uint8Array(r);return i.set(e%8===0?n.subarray(e>>3):ti(new ns(n,e,t,null,Al)).subarray(0,r)),i}return n}function ti(e){const t=[];let n=0,r=0,i=0;for(const a of e)a&&(i|=1<<r),++r===8&&(t[n++]=i,i=r=0);(n===0||r>0)&&(t[n++]=i);const s=new Uint8Array(t.length+7&-8);return s.set(t),s}class ns{constructor(t,n,r,i,s){this.bytes=t,this.length=r,this.context=i,this.get=s,this.bit=n%8,this.byteIndex=n>>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 rs(e,t,n){if(n-t<=0)return 0;if(n-t<8){let s=0;for(const a of new ns(e,t,n-t,e,Oy))s+=a;return s}const r=n>>3<<3,i=t+(t%8===0?0:8-t%8);return rs(e,t,i)+rs(e,r,n)+Dy(e,i>>3,r-i>>3)}function Dy(e,t,n){let r=0,i=Math.trunc(t);const s=new DataView(e.buffer,e.byteOffset,e.byteLength),a=n===void 0?e.byteLength:i+n;for(;a-i>=4;)r+=is(s.getUint32(i)),i+=4;for(;a-i>=2;)r+=is(s.getUint16(i)),i+=2;for(;a-i>=1;)r+=is(s.getUint8(i)),i+=1;return r}function is(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const Fy=-1;class nt{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){const{type:t}=this;return D.isSparseUnion(t)?this.children.some(n=>n.nullable):D.isDenseUnion(t)?this.children.some(n=>n.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0;const{valueOffsets:n,values:r,nullBitmap:i,typeIds:s}=this;return n&&(t+=n.byteLength),r&&(t+=r.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),this.children.reduce((a,o)=>a+o.byteLength,t)}get nullCount(){if(D.isUnion(this.type))return this.children.reduce((r,i)=>r+i.nullCount,0);let t=this._nullCount,n;return t<=Fy&&(n=this.nullBitmap)&&(this._nullCount=t=n.length===0?0:this.length-rs(n,this.offset,this.offset+this.length)),t}constructor(t,n,r,i,s,a=[],o){this.type=t,this.children=a,this.dictionary=o,this.offset=Math.floor(Math.max(n||0,0)),this.length=Math.floor(Math.max(r||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let l;s instanceof nt?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=Ie(t),s&&((l=s[0])&&(this.valueOffsets=l),(l=s[1])&&(this.values=l),(l=s[2])&&(this.nullBitmap=l),(l=s[3])&&(this.typeIds=l)))}getValid(t){const{type:n}=this;if(D.isUnion(n)){const r=n,i=this.children[r.typeIdToChildIndex[this.typeIds[t]]],s=r.mode===Et.Dense?this.valueOffsets[t]:t;return i.getValid(s)}if(this.nullable&&this.nullCount>0){const r=this.offset+t;return(this.nullBitmap[r>>3]&1<<r%8)!==0}return!0}setValid(t,n){let r;const{type:i}=this;if(D.isUnion(i)){const s=i,a=this.children[s.typeIdToChildIndex[this.typeIds[t]]],o=s.mode===Et.Dense?this.valueOffsets[t]:t;r=a.getValid(o),a.setValid(o,n)}else{let{nullBitmap:s}=this;const{offset:a,length:o}=this,l=a+t,c=1<<l%8,d=l>>3;(!s||s.byteLength<=d)&&(s=new Uint8Array((a+o+63&-64)>>3).fill(255),this.nullCount>0?(s.set(Zr(a,o,this.nullBitmap),0),Object.assign(this,{nullBitmap:s})):Object.assign(this,{nullBitmap:s,_nullCount:0}));const y=s[d];r=(y&c)!==0,s[d]=n?y|c:y&~c}return r!==!!n&&(this._nullCount=this.nullCount+(n?-1:1)),n}clone(t=this.type,n=this.offset,r=this.length,i=this._nullCount,s=this,a=this.children){return new nt(t,n,r,i,s,a,this.dictionary)}slice(t,n){const{stride:r,typeId:i,children:s}=this,a=+(this._nullCount===0)-1,o=i===16?r:1,l=this._sliceBuffers(t,n,r,i);return this.clone(this.type,this.offset+t,n,a,l,s.length===0||this.valueOffsets?s:this._sliceChildren(s,o*t,o*n))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===f.Null)return this.clone(this.type,0,t,0);const{length:n,nullCount:r}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,n>>3);i[n>>3]=(1<<n-(n&-8))-1,r>0&&i.set(Zr(this.offset,n,this.nullBitmap),0);const s=this.buffers;return s[we.VALIDITY]=i,this.clone(this.type,0,t,r+(t-n),s)}_sliceBuffers(t,n,r,i){let s;const{buffers:a}=this;return(s=a[we.TYPE])&&(a[we.TYPE]=s.subarray(t,t+n)),(s=a[we.OFFSET])&&(a[we.OFFSET]=s.subarray(t,t+n+1))||(s=a[we.DATA])&&(a[we.DATA]=i===6?s:s.subarray(r*t,r*(t+n))),a}_sliceChildren(t,n,r){return t.map(i=>i.slice(n,r))}}nt.prototype.children=Object.freeze([]);class Pn extends q{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{["type"]:n,["offset"]:r=0,["length"]:i=0}=t;return new nt(n,r,i,i)}visitBool(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.ArrayType,t.data),{["length"]:a=s.length>>3,["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,s,i])}visitInt(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.ArrayType,t.data),{["length"]:a=s.length,["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,s,i])}visitFloat(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.ArrayType,t.data),{["length"]:a=s.length,["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,s,i])}visitUtf8(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.data),s=H(t.nullBitmap),a=xn(t.valueOffsets),{["length"]:o=a.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new nt(n,r,o,l,[a,i,s])}visitLargeUtf8(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.data),s=H(t.nullBitmap),a=ja(t.valueOffsets),{["length"]:o=a.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new nt(n,r,o,l,[a,i,s])}visitBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.data),s=H(t.nullBitmap),a=xn(t.valueOffsets),{["length"]:o=a.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new nt(n,r,o,l,[a,i,s])}visitLargeBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.data),s=H(t.nullBitmap),a=ja(t.valueOffsets),{["length"]:o=a.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new nt(n,r,o,l,[a,i,s])}visitFixedSizeBinary(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.ArrayType,t.data),{["length"]:a=s.length/Ie(n),["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,s,i])}visitDate(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.ArrayType,t.data),{["length"]:a=s.length/Ie(n),["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,s,i])}visitTimestamp(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.ArrayType,t.data),{["length"]:a=s.length/Ie(n),["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,s,i])}visitTime(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.ArrayType,t.data),{["length"]:a=s.length/Ie(n),["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,s,i])}visitDecimal(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.ArrayType,t.data),{["length"]:a=s.length/Ie(n),["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,s,i])}visitList(t){const{["type"]:n,["offset"]:r=0,["child"]:i}=t,s=H(t.nullBitmap),a=xn(t.valueOffsets),{["length"]:o=a.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new nt(n,r,o,l,[a,void 0,s],[i])}visitStruct(t){const{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,s=H(t.nullBitmap),{length:a=i.reduce((l,{length:c})=>Math.max(l,c),0),nullCount:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,void 0,s],i)}visitUnion(t){const{["type"]:n,["offset"]:r=0,["children"]:i=[]}=t,s=at(n.ArrayType,t.typeIds),{["length"]:a=s.length,["nullCount"]:o=-1}=t;if(D.isSparseUnion(n))return new nt(n,r,a,o,[void 0,void 0,void 0,s],i);const l=xn(t.valueOffsets);return new nt(n,r,a,o,[l,void 0,void 0,s],i)}visitDictionary(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.indices.ArrayType,t.data),{["dictionary"]:a=new tt([new Pn().visit({type:n.dictionary})])}=t,{["length"]:o=s.length,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new nt(n,r,o,l,[void 0,s,i],[],a)}visitInterval(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.ArrayType,t.data),{["length"]:a=s.length/Ie(n),["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,s,i])}visitDuration(t){const{["type"]:n,["offset"]:r=0}=t,i=H(t.nullBitmap),s=at(n.ArrayType,t.data),{["length"]:a=s.length,["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,s,i])}visitFixedSizeList(t){const{["type"]:n,["offset"]:r=0,["child"]:i=new Pn().visit({type:n.valueType})}=t,s=H(t.nullBitmap),{["length"]:a=i.length/Ie(n),["nullCount"]:o=t.nullBitmap?-1:0}=t;return new nt(n,r,a,o,[void 0,void 0,s],[i])}visitMap(t){const{["type"]:n,["offset"]:r=0,["child"]:i=new Pn().visit({type:n.childType})}=t,s=H(t.nullBitmap),a=xn(t.valueOffsets),{["length"]:o=a.length-1,["nullCount"]:l=t.nullBitmap?-1:0}=t;return new nt(n,r,o,l,[a,void 0,s],[i])}}const My=new Pn;function G(e){return My.visit(e)}class Nl{constructor(t=0,n){this.numChunks=t,this.getChunkIterator=n,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){const 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 Ly(e){return e.some(t=>t.nullable)}function Bl(e){return e.reduce((t,n)=>t+n.nullCount,0)}function Rl(e){return e.reduce((t,n,r)=>(t[r+1]=t[r]+n.length,t),new Uint32Array(e.length+1))}function Ol(e,t,n,r){const i=[];for(let s=-1,a=e.length;++s<a;){const o=e[s],l=t[s],{length:c}=o;if(l>=r)break;if(n>=l+c)continue;if(l>=n&&l+c<=r){i.push(o);continue}const d=Math.max(0,n-l),y=Math.min(r-l,c);i.push(o.slice(d,y-d))}return i.length===0&&i.push(e[0].slice(0,0)),i}function ss(e,t,n,r){let i=0,s=0,a=t.length-1;do{if(i>=a-1)return n<t[a]?r(e,i,n-t[i]):null;s=i+Math.trunc((a-i)*.5),n<t[s]?a=s:i=s}while(i<a)}function as(e,t){return e.getValid(t)}function ei(e){function t(n,r,i){return e(n[r],i)}return function(n){const r=this.data;return ss(r,this._offsets,n,t)}}function Dl(e){let t;function n(r,i,s){return e(r[i],s,t)}return function(r,i){const s=this.data;t=i;const a=ss(s,this._offsets,r,n);return t=void 0,a}}function Fl(e){let t;function n(r,i,s){let a=s,o=0,l=0;for(let c=i-1,d=r.length;++c<d;){const y=r[c];if(~(o=e(y,t,a)))return l+o;a=0,l+=y.length}return-1}return function(r,i){t=r;const s=this.data,a=typeof i!="number"?n(s,0,0):ss(s,this._offsets,i,n);return t=void 0,a}}class x extends q{}function xy(e,t){return t===null&&e.length>0?0:-1}function Uy(e,t){const{nullBitmap:n}=e;if(!n||e.nullCount<=0)return-1;let r=0;for(const i of new ns(n,e.offset+(t||0),e.length,n,Al)){if(!i)return r;++r}return-1}function j(e,t,n){if(t===void 0)return-1;if(t===null)switch(e.typeId){case f.Union:break;case f.Dictionary:break;default:return Uy(e,n)}const r=Mt.getVisitFn(e),i=pn(t);for(let s=(n||0)-1,a=e.length;++s<a;)if(i(r(e,s)))return s;return-1}function Ml(e,t,n){const r=Mt.getVisitFn(e),i=pn(t);for(let s=(n||0)-1,a=e.length;++s<a;)if(i(r(e,s)))return s;return-1}x.prototype.visitNull=xy,x.prototype.visitBool=j,x.prototype.visitInt=j,x.prototype.visitInt8=j,x.prototype.visitInt16=j,x.prototype.visitInt32=j,x.prototype.visitInt64=j,x.prototype.visitUint8=j,x.prototype.visitUint16=j,x.prototype.visitUint32=j,x.prototype.visitUint64=j,x.prototype.visitFloat=j,x.prototype.visitFloat16=j,x.prototype.visitFloat32=j,x.prototype.visitFloat64=j,x.prototype.visitUtf8=j,x.prototype.visitLargeUtf8=j,x.prototype.visitBinary=j,x.prototype.visitLargeBinary=j,x.prototype.visitFixedSizeBinary=j,x.prototype.visitDate=j,x.prototype.visitDateDay=j,x.prototype.visitDateMillisecond=j,x.prototype.visitTimestamp=j,x.prototype.visitTimestampSecond=j,x.prototype.visitTimestampMillisecond=j,x.prototype.visitTimestampMicrosecond=j,x.prototype.visitTimestampNanosecond=j,x.prototype.visitTime=j,x.prototype.visitTimeSecond=j,x.prototype.visitTimeMillisecond=j,x.prototype.visitTimeMicrosecond=j,x.prototype.visitTimeNanosecond=j,x.prototype.visitDecimal=j,x.prototype.visitList=j,x.prototype.visitStruct=j,x.prototype.visitUnion=j,x.prototype.visitDenseUnion=Ml,x.prototype.visitSparseUnion=Ml,x.prototype.visitDictionary=j,x.prototype.visitInterval=j,x.prototype.visitIntervalDayTime=j,x.prototype.visitIntervalYearMonth=j,x.prototype.visitDuration=j,x.prototype.visitDurationSecond=j,x.prototype.visitDurationMillisecond=j,x.prototype.visitDurationMicrosecond=j,x.prototype.visitDurationNanosecond=j,x.prototype.visitFixedSizeList=j,x.prototype.visitMap=j;const ni=new x;class U extends q{}function V(e){const{type:t}=e;if(e.nullCount===0&&e.stride===1&&(D.isInt(t)&&t.bitWidth!==64||D.isTime(t)&&t.bitWidth!==64||D.isFloat(t)&&t.precision!==Tt.HALF))return new Nl(e.data.length,r=>{const i=e.data[r];return i.values.subarray(0,i.length)[Symbol.iterator]()});let n=0;return new Nl(e.data.length,r=>{const i=e.data[r].length,s=e.slice(n,n+i);return n+=i,new Cy(s)})}class Cy{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}}U.prototype.visitNull=V,U.prototype.visitBool=V,U.prototype.visitInt=V,U.prototype.visitInt8=V,U.prototype.visitInt16=V,U.prototype.visitInt32=V,U.prototype.visitInt64=V,U.prototype.visitUint8=V,U.prototype.visitUint16=V,U.prototype.visitUint32=V,U.prototype.visitUint64=V,U.prototype.visitFloat=V,U.prototype.visitFloat16=V,U.prototype.visitFloat32=V,U.prototype.visitFloat64=V,U.prototype.visitUtf8=V,U.prototype.visitLargeUtf8=V,U.prototype.visitBinary=V,U.prototype.visitLargeBinary=V,U.prototype.visitFixedSizeBinary=V,U.prototype.visitDate=V,U.prototype.visitDateDay=V,U.prototype.visitDateMillisecond=V,U.prototype.visitTimestamp=V,U.prototype.visitTimestampSecond=V,U.prototype.visitTimestampMillisecond=V,U.prototype.visitTimestampMicrosecond=V,U.prototype.visitTimestampNanosecond=V,U.prototype.visitTime=V,U.prototype.visitTimeSecond=V,U.prototype.visitTimeMillisecond=V,U.prototype.visitTimeMicrosecond=V,U.prototype.visitTimeNanosecond=V,U.prototype.visitDecimal=V,U.prototype.visitList=V,U.prototype.visitStruct=V,U.prototype.visitUnion=V,U.prototype.visitDenseUnion=V,U.prototype.visitSparseUnion=V,U.prototype.visitDictionary=V,U.prototype.visitInterval=V,U.prototype.visitIntervalDayTime=V,U.prototype.visitIntervalYearMonth=V,U.prototype.visitDuration=V,U.prototype.visitDurationSecond=V,U.prototype.visitDurationMillisecond=V,U.prototype.visitDurationMicrosecond=V,U.prototype.visitDurationNanosecond=V,U.prototype.visitFixedSizeList=V,U.prototype.visitMap=V;const os=new U;var Ll;const xl={},Ul={};class tt{constructor(t){var n,r,i;const s=t[0]instanceof tt?t.flatMap(o=>o.data):t;if(s.length===0||s.some(o=>!(o instanceof nt)))throw new TypeError("Vector constructor expects an Array of Data instances.");const a=(n=s[0])===null||n===void 0?void 0:n.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{const{get:o,set:l,indexOf:c}=xl[a.typeId],d=s[0];this.isValid=y=>as(d,y),this.get=y=>o(d,y),this.set=(y,_)=>l(d,y,_),this.indexOf=y=>c(d,y),this._offsets=[0,d.length];break}default:Object.setPrototypeOf(this,Ul[a.typeId]),this._offsets=Rl(s);break}this.data=s,this.type=a,this.stride=Ie(a),this.numChildren=(i=(r=a.children)===null||r===void 0?void 0:r.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,n)=>t+n.byteLength,0)}get nullable(){return Ly(this.data)}get nullCount(){return Bl(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${f[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(es(t,this.length))}set(t,n){}indexOf(t,n){return-1}includes(t,n){return this.indexOf(t,n)>-1}[Symbol.iterator](){return os.visit(this)}concat(...t){return new tt(this.data.concat(t.flatMap(n=>n.data).flat(Number.POSITIVE_INFINITY)))}slice(t,n){return new tt(Sl(this,t,n,({data:r,_offsets:i},s,a)=>Ol(r,i,s,a)))}toJSON(){return[...this]}toArray(){const{type:t,data:n,length:r,stride:i,ArrayType:s}=this;switch(t.typeId){case f.Int:case f.Float:case f.Decimal:case f.Time:case f.Timestamp:switch(n.length){case 0:return new s;case 1:return n[0].values.subarray(0,r*i);default:return n.reduce((a,{values:o,length:l})=>(a.array.set(o.subarray(0,l*i),a.offset),a.offset+=l*i,a),{array:new s(r*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var n;return this.getChildAt((n=this.type.children)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new tt(this.data.map(({children:n})=>n[t])):null}get isMemoized(){return D.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(D.isDictionary(this.type)){const t=new ri(this.data[0].dictionary),n=this.data.map(r=>{const i=r.clone();return i.dictionary=t,i});return new tt(n)}return new ri(this)}unmemoize(){if(D.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),n=this.data.map(r=>{const i=r.clone();return i.dictionary=t,i});return new tt(n)}return this}}Ll=Symbol.toStringTag,tt[Ll]=(e=>{e.type=D.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0;const t=Object.keys(f).map(n=>f[n]).filter(n=>typeof n=="number"&&n!==f.NONE);for(const n of t){const r=Mt.getVisitFnByTypeId(n),i=Wt.getVisitFnByTypeId(n),s=ni.getVisitFnByTypeId(n);xl[n]={get:r,set:i,indexOf:s},Ul[n]=Object.create(e,{isValid:{value:ei(as)},get:{value:ei(Mt.getVisitFnByTypeId(n))},set:{value:Dl(Wt.getVisitFnByTypeId(n))},indexOf:{value:Fl(ni.getVisitFnByTypeId(n))}})}return"Vector"})(tt.prototype);class ri extends tt{constructor(t){super(t.data);const n=this.get,r=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(a){const o=s[a];if(o!==void 0)return o;const l=n.call(this,a);return s[a]=l,l}}),Object.defineProperty(this,"set",{value(a,o){r.call(this,a,o),s[a]=o}}),Object.defineProperty(this,"slice",{value:(a,o)=>new ri(i.call(this,a,o))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new tt(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class ls{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,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,n,r,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(r),t.writeInt64(BigInt(n??0)),t.offset()}}class Ct{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsFooter(t,n){return(n||new Ct).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,n){return t.setPosition(t.position()+Z),(n||new Ct).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):yt.V1}schema(t){const n=this.bb.__offset(this.bb_pos,6);return n?(t||new ce).__init(this.bb.__indirect(this.bb_pos+n),this.bb):null}dictionaries(t,n){const r=this.bb.__offset(this.bb_pos,8);return r?(n||new ls).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}dictionariesLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,n){const r=this.bb.__offset(this.bb_pos,10);return r?(n||new ls).__init(this.bb.__vector(this.bb_pos+r)+t*24,this.bb):null}recordBatchesLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,n){const r=this.bb.__offset(this.bb_pos,12);return r?(n||new vt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){const 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,n){t.addFieldInt16(0,n,yt.V1)}static addSchema(t,n){t.addFieldOffset(1,n,0)}static addDictionaries(t,n){t.addFieldOffset(2,n,0)}static startDictionariesVector(t,n){t.startVector(24,n,8)}static addRecordBatches(t,n){t.addFieldOffset(3,n,0)}static startRecordBatchesVector(t,n){t.startVector(24,n,8)}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,n){t.finish(n)}static finishSizePrefixedFooterBuffer(t,n){t.finish(n,void 0,!0)}}class et{constructor(t=[],n,r,i=yt.V5){this.fields=t||[],this.metadata=n||new Map,r||(r=cs(this.fields)),this.dictionaries=r,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,n)=>`${n}: ${t}`).join(", ")} }>`}select(t){const n=new Set(t),r=this.fields.filter(i=>n.has(i.name));return new et(r,this.metadata)}selectAt(t){const n=t.map(r=>this.fields[r]).filter(Boolean);return new et(n,this.metadata)}assign(...t){const n=t[0]instanceof et?t[0]:Array.isArray(t[0])?new et(t[0]):new et(t),r=[...this.fields],i=ii(ii(new Map,this.metadata),n.metadata),s=n.fields.filter(o=>{const l=r.findIndex(c=>c.name===o.name);return~l?(r[l]=o.clone({metadata:ii(ii(new Map,r[l].metadata),o.metadata)}))&&!1:!0}),a=cs(s,new Map);return new et([...r,...s],i,new Map([...this.dictionaries,...a]))}}et.prototype.fields=null,et.prototype.metadata=null,et.prototype.dictionaries=null;class ut{static new(...t){let[n,r,i,s]=t;return t[0]&&typeof t[0]=="object"&&({name:n}=t[0],r===void 0&&(r=t[0].type),i===void 0&&(i=t[0].nullable),s===void 0&&(s=t[0].metadata)),new ut(`${n}`,r,i,s)}constructor(t,n,r=!1,i){this.name=t,this.type=n,this.nullable=r,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[n,r,i,s]=t;return!t[0]||typeof t[0]!="object"?[n=this.name,r=this.type,i=this.nullable,s=this.metadata]=t:{name:n=this.name,type:r=this.type,nullable:i=this.nullable,metadata:s=this.metadata}=t[0],ut.new(n,r,i,s)}}ut.prototype.type=null,ut.prototype.name=null,ut.prototype.nullable=null,ut.prototype.metadata=null;function ii(e,t){return new Map([...e||new Map,...t||new Map])}function cs(e,t=new Map){for(let n=-1,r=e.length;++n<r;){const i=e[n].type;if(D.isDictionary(i)){if(!t.has(i.id))t.set(i.id,i.dictionary);else if(t.get(i.id)!==i.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}i.children&&i.children.length>0&&cs(i.children,t)}return t}var ky=Ha,$y=tn;class Vn{static decode(t){t=new $y(H(t));const n=Ct.getRootAsFooter(t),r=et.decode(n.schema(),new Map,n.version());return new Py(r,n)}static encode(t){const n=new ky,r=et.encode(n,t.schema);Ct.startRecordBatchesVector(n,t.numRecordBatches);for(const a of[...t.recordBatches()].slice().reverse())Fe.encode(n,a);const i=n.endVector();Ct.startDictionariesVector(n,t.numDictionaries);for(const a of[...t.dictionaryBatches()].slice().reverse())Fe.encode(n,a);const s=n.endVector();return Ct.startFooter(n),Ct.addSchema(n,r),Ct.addVersion(n,yt.V5),Ct.addRecordBatches(n,i),Ct.addDictionaries(n,s),Ct.finishFooterBuffer(n,Ct.endFooter(n)),n.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,n=yt.V5,r,i){this.schema=t,this.version=n,r&&(this._recordBatches=r),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,n=-1,r=this.numRecordBatches;++n<r;)(t=this.getRecordBatch(n))&&(yield t)}*dictionaryBatches(){for(let t,n=-1,r=this.numDictionaries;++n<r;)(t=this.getDictionaryBatch(n))&&(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}}class Py extends Vn{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,n){super(t,n.version()),this._footer=n}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){const n=this._footer.recordBatches(t);if(n)return Fe.decode(n)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){const n=this._footer.dictionaries(t);if(n)return Fe.decode(n)}return null}}class Fe{static decode(t){return new Fe(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,n){const{metaDataLength:r}=n,i=BigInt(n.offset),s=BigInt(n.bodyLength);return ls.createBlock(t,i,r,s)}constructor(t,n,r){this.metaDataLength=t,this.offset=ot(r),this.bodyLength=ot(n)}}const wt=Object.freeze({done:!0,value:void 0});class Cl{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class us{tee(){return this._getDOMStream().tee()}pipe(t,n){return this._getNodeStream().pipe(t,n)}pipeTo(t,n){return this._getDOMStream().pipeTo(t,n)}pipeThrough(t,n){return this._getDOMStream().pipeThrough(t,n)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}}class Vy extends us{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return Y(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){const{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(wt);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return Pt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return Pt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Y(this,void 0,void 0,function*(){return yield this.abort(t),wt})}return(t){return Y(this,void 0,void 0,function*(){return yield this.close(),wt})}read(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Y(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((n,r)=>{this.resolvers.push({resolve:n,reject:r})}):Promise.resolve(wt)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class si extends Vy{write(t){if((t=H(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Pi(this.toUint8Array(!0)):this.toUint8Array(!1).then(Pi)}toUint8Array(t=!1){return t?ie(this._values)[0]:Y(this,void 0,void 0,function*(){var n,r,i,s;const a=[];let o=0;try{for(var l=!0,c=je(this),d;d=yield c.next(),n=d.done,!n;l=!0){s=d.value,l=!1;const y=s;a.push(y),o+=y.byteLength}}catch(y){r={error:y}}finally{try{!l&&!n&&(i=c.return)&&(yield i.call(c))}finally{if(r)throw r.error}}return ie(a,o)[0]})}}class ai{constructor(t){t&&(this.source=new zy(Pt.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class yn{constructor(t){t instanceof yn?this.source=t.source:t instanceof si?this.source=new Ge(Pt.fromAsyncIterable(t)):Va(t)?this.source=new Ge(Pt.fromNodeStream(t)):ji(t)?this.source=new Ge(Pt.fromDOMStream(t)):Pa(t)?this.source=new Ge(Pt.fromDOMStream(t.body)):Ln(t)?this.source=new Ge(Pt.fromIterable(t)):Ye(t)?this.source=new Ge(Pt.fromAsyncIterable(t)):Ze(t)&&(this.source=new Ge(Pt.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class zy{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,n="read"){return this.source.next({cmd:n,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||wt)}return(t){return Object.create(this.source.return&&this.source.return(t)||wt)}}class Ge{constructor(t){this.source=t,this._closedPromise=new Promise(n=>this._closedPromiseResolve=n)}cancel(t){return Y(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return Y(this,arguments,void 0,function*(n,r="read"){return yield this.source.next({cmd:r,size:n})})}throw(t){return Y(this,void 0,void 0,function*(){const n=this.source.throw&&(yield this.source.throw(t))||wt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}return(t){return Y(this,void 0,void 0,function*(){const n=this.source.return&&(yield this.source.return(t))||wt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(n)})}}class kl extends ai{constructor(t,n){super(),this.position=0,this.buffer=H(t),this.size=n===void 0?this.buffer.byteLength:n}readInt32(t){const{buffer:n,byteOffset:r}=this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){const{buffer:n,size:r,position:i}=this;return n&&i<r?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(r,i+Math.min(r-i,t)),n.subarray(i,this.position)):null}readAt(t,n){const r=this.buffer,i=Math.min(this.size,t+n);return r?r.subarray(t,i):new Uint8Array(n)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}}class oi extends yn{constructor(t,n){super(),this.position=0,this._handle=t,typeof n=="number"?this.size=n:this._pending=Y(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return Y(this,void 0,void 0,function*(){const{buffer:n,byteOffset:r}=yield this.readAt(t,4);return new DataView(n,r).getInt32(0,!0)})}seek(t){return Y(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 Y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:n,size:r,position:i}=this;if(n&&i<r){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let s=i,a=0,o=0;const l=Math.min(r,s+Math.min(r-s,t)),c=new Uint8Array(Math.max(0,(this.position=l)-s));for(;(s+=o)<l&&(a+=o)<c.byteLength;)({bytesRead:o}=yield n.read(c,a,c.byteLength-a,s));return c}return null})}readAt(t,n){return Y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:r,size:i}=this;if(r&&t+n<i){const s=Math.min(i,t+n),a=new Uint8Array(s-t);return(yield r.read(a,0,n,t)).buffer}return new Uint8Array(n)})}close(){return Y(this,void 0,void 0,function*(){const t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return Y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return Y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}}const jy=65536;function mn(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}const bn=8,hs=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class $l{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){const n=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),r=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]);let i=n[3]*r[3];this.buffer[0]=i&65535;let s=i>>>16;return i=n[2]*r[3],s+=i,i=n[3]*r[2]>>>0,s+=i,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0<i?jy:0,this.buffer[1]+=s>>>16,this.buffer[1]+=n[1]*r[3]+n[2]*r[2]+n[3]*r[1],this.buffer[1]+=n[0]*r[3]+n[1]*r[2]+n[2]*r[1]+n[3]*r[0]<<16,this}_plus(t){const n=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],n<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=n}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`${mn(this.buffer[1])} ${mn(this.buffer[0])}`}}class rt extends $l{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,n=new Uint32Array(2)){return rt.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return rt.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){const r=t.length,i=new rt(n);for(let s=0;s<r;){const a=bn<r-s?bn:r-s,o=new rt(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new rt(new Uint32Array([hs[a],0]));i.times(l),i.plus(o),s+=a}return i}static convertArray(t){const n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)rt.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new rt(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new rt(new Uint32Array(t.buffer)).plus(n)}}class qt extends $l{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){const n=this.buffer[1]<<0,r=t.buffer[1]<<0;return n<r||n===r&&this.buffer[0]<t.buffer[0]}static from(t,n=new Uint32Array(2)){return qt.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(2)){return qt.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(2)){const r=t.startsWith("-"),i=t.length,s=new qt(n);for(let a=r?1:0;a<i;){const o=bn<i-a?bn:i-a,l=new qt(new Uint32Array([Number.parseInt(t.slice(a,a+o),10),0])),c=new qt(new Uint32Array([hs[o],0]));s.times(c),s.plus(l),a+=o}return r?s.negate():s}static convertArray(t){const n=new Uint32Array(t.length*2);for(let r=-1,i=t.length;++r<i;)qt.from(t[r],new Uint32Array(n.buffer,n.byteOffset+2*r*4,2));return n}static multiply(t,n){return new qt(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new qt(new Uint32Array(t.buffer)).plus(n)}}class ue{constructor(t){this.buffer=t}high(){return new qt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new qt(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){const n=new rt(new Uint32Array([this.buffer[3],0])),r=new rt(new Uint32Array([this.buffer[2],0])),i=new rt(new Uint32Array([this.buffer[1],0])),s=new rt(new Uint32Array([this.buffer[0],0])),a=new rt(new Uint32Array([t.buffer[3],0])),o=new rt(new Uint32Array([t.buffer[2],0])),l=new rt(new Uint32Array([t.buffer[1],0])),c=new rt(new Uint32Array([t.buffer[0],0]));let d=rt.multiply(s,c);this.buffer[0]=d.low();const y=new rt(new Uint32Array([d.high(),0]));return d=rt.multiply(i,c),y.plus(d),d=rt.multiply(s,l),y.plus(d),this.buffer[1]=y.low(),this.buffer[3]=y.lessThan(d)?1:0,this.buffer[2]=y.high(),new rt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(rt.multiply(r,c)).plus(rt.multiply(i,l)).plus(rt.multiply(s,o)),this.buffer[3]+=rt.multiply(n,c).plus(rt.multiply(r,l)).plus(rt.multiply(i,o)).plus(rt.multiply(s,a)).low(),this}plus(t){const n=new Uint32Array(4);return n[3]=this.buffer[3]+t.buffer[3]>>>0,n[2]=this.buffer[2]+t.buffer[2]>>>0,n[1]=this.buffer[1]+t.buffer[1]>>>0,n[0]=this.buffer[0]+t.buffer[0]>>>0,n[0]<this.buffer[0]>>>0&&++n[1],n[1]<this.buffer[1]>>>0&&++n[2],n[2]<this.buffer[2]>>>0&&++n[3],this.buffer[3]=n[3],this.buffer[2]=n[2],this.buffer[1]=n[1],this.buffer[0]=n[0],this}hex(){return`${mn(this.buffer[3])} ${mn(this.buffer[2])} ${mn(this.buffer[1])} ${mn(this.buffer[0])}`}static multiply(t,n){return new ue(new Uint32Array(t.buffer)).times(n)}static add(t,n){return new ue(new Uint32Array(t.buffer)).plus(n)}static from(t,n=new Uint32Array(4)){return ue.fromString(typeof t=="string"?t:t.toString(),n)}static fromNumber(t,n=new Uint32Array(4)){return ue.fromString(t.toString(),n)}static fromString(t,n=new Uint32Array(4)){const r=t.startsWith("-"),i=t.length,s=new ue(n);for(let a=r?1:0;a<i;){const o=bn<i-a?bn:i-a,l=new ue(new Uint32Array([Number.parseInt(t.slice(a,a+o),10),0,0,0])),c=new ue(new Uint32Array([hs[o],0,0,0]));s.times(c),s.plus(l),a+=o}return r?s.negate():s}static convertArray(t){const n=new Uint32Array(t.length*4);for(let r=-1,i=t.length;++r<i;)ue.from(t[r],new Uint32Array(n.buffer,n.byteOffset+16*r,4));return n}}class Pl extends q{constructor(t,n,r,i,s=yt.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=n,this.buffers=r,this.dictionaries=i,this.metadataVersion=s}visit(t){return super.visit(t instanceof ut?t.type:t)}visitNull(t,{length:n}=this.nextFieldNode()){return G({type:t,length:n})}visitBool(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitInt(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFloat(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDate(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTimestamp(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitTime(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDecimal(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitList(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),children:this.visitMany(t.children)})}visitUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return this.metadataVersion<yt.V5&&this.readNullBitmap(t,r),t.mode===Et.Sparse?this.visitSparseUnion(t,{length:n,nullCount:r}):this.visitDenseUnion(t,{length:n,nullCount:r})}visitDenseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitDuration(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),data:this.readData(t)})}visitFixedSizeList(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),child:this.visit(t.children[0])})}visitMap(t,{length:n,nullCount:r}=this.nextFieldNode()){return G({type:t,length:n,nullCount:r,nullBitmap:this.readNullBitmap(t,r),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,n,r=this.nextBufferRange()){return n>0&&this.readData(t,r)||new Uint8Array(0)}readOffsets(t,n){return this.readData(t,n)}readTypeIds(t,n){return this.readData(t,n)}readData(t,{length:n,offset:r}=this.nextBufferRange()){return this.bytes.subarray(r,r+n)}readDictionary(t){return this.dictionaries.get(t.id)}}class Yy extends Pl{constructor(t,n,r,i,s){super(new Uint8Array(0),n,r,i,s),this.sources=t}readNullBitmap(t,n,{offset:r}=this.nextBufferRange()){return n<=0?new Uint8Array(0):ti(this.sources[r])}readOffsets(t,{offset:n}=this.nextBufferRange()){return at(Uint8Array,at(t.OffsetArrayType,this.sources[n]))}readTypeIds(t,{offset:n}=this.nextBufferRange()){return at(Uint8Array,at(t.ArrayType,this.sources[n]))}readData(t,{offset:n}=this.nextBufferRange()){const{sources:r}=this;return D.isTimestamp(t)||(D.isInt(t)||D.isTime(t))&&t.bitWidth===64||D.isDuration(t)||D.isDate(t)&&t.unit===Vt.MILLISECOND?at(Uint8Array,qt.convertArray(r[n])):D.isDecimal(t)?at(Uint8Array,ue.convertArray(r[n])):D.isBinary(t)||D.isLargeBinary(t)||D.isFixedSizeBinary(t)?Wy(r[n]):D.isBool(t)?ti(r[n]):D.isUtf8(t)||D.isLargeUtf8(t)?Vi(r[n].join("")):at(Uint8Array,at(t.ArrayType,r[n].map(i=>+i)))}}function Wy(e){const t=e.join(""),n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r>>1]=Number.parseInt(t.slice(r,r+2),16);return n}class C extends q{compareSchemas(t,n){return t===n||n instanceof t.constructor&&this.compareManyFields(t.fields,n.fields)}compareManyFields(t,n){return t===n||Array.isArray(t)&&Array.isArray(n)&&t.length===n.length&&t.every((r,i)=>this.compareFields(r,n[i]))}compareFields(t,n){return t===n||n instanceof t.constructor&&t.name===n.name&&t.nullable===n.nullable&&this.visit(t.type,n.type)}}function Nt(e,t){return t instanceof e.constructor}function He(e,t){return e===t||Nt(e,t)}function Ee(e,t){return e===t||Nt(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function li(e,t){return e===t||Nt(e,t)&&e.precision===t.precision}function qy(e,t){return e===t||Nt(e,t)&&e.byteWidth===t.byteWidth}function ds(e,t){return e===t||Nt(e,t)&&e.unit===t.unit}function zn(e,t){return e===t||Nt(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function jn(e,t){return e===t||Nt(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function Gy(e,t){return e===t||Nt(e,t)&&e.children.length===t.children.length&&Me.compareManyFields(e.children,t.children)}function Hy(e,t){return e===t||Nt(e,t)&&e.children.length===t.children.length&&Me.compareManyFields(e.children,t.children)}function fs(e,t){return e===t||Nt(e,t)&&e.mode===t.mode&&e.typeIds.every((n,r)=>n===t.typeIds[r])&&Me.compareManyFields(e.children,t.children)}function Ky(e,t){return e===t||Nt(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Me.visit(e.indices,t.indices)&&Me.visit(e.dictionary,t.dictionary)}function ps(e,t){return e===t||Nt(e,t)&&e.unit===t.unit}function Yn(e,t){return e===t||Nt(e,t)&&e.unit===t.unit}function Qy(e,t){return e===t||Nt(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Me.compareManyFields(e.children,t.children)}function Xy(e,t){return e===t||Nt(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Me.compareManyFields(e.children,t.children)}C.prototype.visitNull=He,C.prototype.visitBool=He,C.prototype.visitInt=Ee,C.prototype.visitInt8=Ee,C.prototype.visitInt16=Ee,C.prototype.visitInt32=Ee,C.prototype.visitInt64=Ee,C.prototype.visitUint8=Ee,C.prototype.visitUint16=Ee,C.prototype.visitUint32=Ee,C.prototype.visitUint64=Ee,C.prototype.visitFloat=li,C.prototype.visitFloat16=li,C.prototype.visitFloat32=li,C.prototype.visitFloat64=li,C.prototype.visitUtf8=He,C.prototype.visitLargeUtf8=He,C.prototype.visitBinary=He,C.prototype.visitLargeBinary=He,C.prototype.visitFixedSizeBinary=qy,C.prototype.visitDate=ds,C.prototype.visitDateDay=ds,C.prototype.visitDateMillisecond=ds,C.prototype.visitTimestamp=zn,C.prototype.visitTimestampSecond=zn,C.prototype.visitTimestampMillisecond=zn,C.prototype.visitTimestampMicrosecond=zn,C.prototype.visitTimestampNanosecond=zn,C.prototype.visitTime=jn,C.prototype.visitTimeSecond=jn,C.prototype.visitTimeMillisecond=jn,C.prototype.visitTimeMicrosecond=jn,C.prototype.visitTimeNanosecond=jn,C.prototype.visitDecimal=He,C.prototype.visitList=Gy,C.prototype.visitStruct=Hy,C.prototype.visitUnion=fs,C.prototype.visitDenseUnion=fs,C.prototype.visitSparseUnion=fs,C.prototype.visitDictionary=Ky,C.prototype.visitInterval=ps,C.prototype.visitIntervalDayTime=ps,C.prototype.visitIntervalYearMonth=ps,C.prototype.visitDuration=Yn,C.prototype.visitDurationSecond=Yn,C.prototype.visitDurationMillisecond=Yn,C.prototype.visitDurationMicrosecond=Yn,C.prototype.visitDurationNanosecond=Yn,C.prototype.visitFixedSizeList=Qy,C.prototype.visitMap=Xy;const Me=new C;function ys(e,t){return Me.compareSchemas(e,t)}function ms(e,t){return Jy(e,t.map(n=>n.data.concat()))}function Jy(e,t){const n=[...e.fields],r=[],i={numBatches:t.reduce((y,_)=>Math.max(y,_.length),0)};let s=0,a=0,o=-1;const l=t.length;let c,d=[];for(;i.numBatches-- >0;){for(a=Number.POSITIVE_INFINITY,o=-1;++o<l;)d[o]=c=t[o].shift(),a=Math.min(a,c?c.length:a);Number.isFinite(a)&&(d=Zy(n,a,d,t,i),a>0&&(r[s++]=G({type:new At(n),length:a,nullCount:0,children:d.slice()})))}return[e=e.assign(n),r.map(y=>new Lt(e,y))]}function Zy(e,t,n,r,i){var s;const a=(t+63&-64)>>3;for(let o=-1,l=r.length;++o<l;){const c=n[o],d=c==null?void 0:c.length;if(d>=t)d===t?n[o]=c:(n[o]=c.slice(0,t),i.numBatches=Math.max(i.numBatches,r[o].unshift(c.slice(t,d-t))));else{const y=e[o];e[o]=y.clone({nullable:!0}),n[o]=(s=c==null?void 0:c._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:G({type:y.type,length:t,nullCount:t,nullBitmap:new Uint8Array(a)})}}return n}var Vl;class Bt{constructor(...t){var n,r;if(t.length===0)return this.batches=[],this.schema=new et([]),this._offsets=[0],this;let i,s;t[0]instanceof et&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());const a=l=>{if(l){if(l instanceof Lt)return[l];if(l instanceof Bt)return l.batches;if(l instanceof nt){if(l.type instanceof At)return[new Lt(new et(l.type.children),l)]}else{if(Array.isArray(l))return l.flatMap(c=>a(c));if(typeof l[Symbol.iterator]=="function")return[...l].flatMap(c=>a(c));if(typeof l=="object"){const c=Object.keys(l),d=c.map(v=>new tt([l[v]])),y=i??new et(c.map((v,E)=>new ut(String(v),d[E].type,d[E].nullable))),[,_]=ms(y,d);return _.length===0?[new Lt(l)]:_}}}return[]},o=t.flatMap(l=>a(l));if(i=(r=i??((n=o[0])===null||n===void 0?void 0:n.schema))!==null&&r!==void 0?r:new et([]),!(i instanceof et))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const l of o){if(!(l instanceof Lt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!ys(i,l.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=o,this._offsets=s??Rl(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,n)=>t+n.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=Bl(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(es(t,this.numRows))}set(t,n){}indexOf(t,n){return-1}[Symbol.iterator](){return this.batches.length>0?os.visit(new tt(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
40
40
|
${this.toArray().join(`,
|
|
41
41
|
`)}
|
|
42
42
|
]`}concat(...t){const n=this.schema,r=this.data.concat(t.flatMap(({data:i})=>i));return new Bt(n,r.map(i=>new Lt(n,i)))}slice(t,n){const r=this.schema;[t,n]=Sl({length:this.numRows},t,n);const i=Ol(this.data,this._offsets,t,n);return new Bt(r,i.map(s=>new Lt(r,s)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(n=>n.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){const n=this.data.map(r=>r.children[t]);if(n.length===0){const{type:r}=this.schema.fields[t],i=G({type:r,length:0,nullCount:0});n.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new tt(n)}return null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){n||(n=new tt([G({type:new Oe,length:this.numRows})]));const s=r.fields.slice(),a=s[t].clone({type:n.type}),o=this.schema.fields.map((l,c)=>this.getChildAt(c));[s[t],o[t]]=[a,n],[r,i]=ms(r,o)}return new Bt(r,i)}select(t){const n=this.schema.fields.reduce((r,i,s)=>r.set(i.name,s),new Map);return this.selectAt(t.map(r=>n.get(r)).filter(r=>r>-1))}selectAt(t){const n=this.schema.selectAt(t),r=this.batches.map(i=>i.selectAt(t));return new Bt(n,r)}assign(t){const n=this.schema.fields,[r,i]=t.schema.fields.reduce((o,l,c)=>{const[d,y]=o,_=n.findIndex(v=>v.name===l.name);return~_?y[_]=c:d.push(c),o},[[],[]]),s=this.schema.assign(t.schema),a=[...n.map((o,l)=>[l,i[l]]).map(([o,l])=>l===void 0?this.getChildAt(o):t.getChildAt(l)),...r.map(o=>t.getChildAt(o))].filter(Boolean);return new Bt(...ms(s,a))}}Vl=Symbol.toStringTag,Bt[Vl]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e.isValid=ei(as),e.get=ei(Mt.getVisitFn(f.Struct)),e.set=Dl(Wt.getVisitFn(f.Struct)),e.indexOf=Fl(ni.getVisitFn(f.Struct)),"Table"))(Bt.prototype);var zl;let Lt=class ir{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof et))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=G({nullCount:0,type:new At(this.schema.fields),children:this.schema.fields.map(n=>G({type:n.type,nullCount:0}))})]=t,!(this.data instanceof nt))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=jl(this.schema,this.data.children);break}case 1:{const[n]=t,{fields:r,children:i,length:s}=Object.keys(n).reduce((l,c,d)=>(l.children[d]=n[c],l.length=Math.max(l.length,n[c].length),l.fields[d]=ut.new({name:c,type:n[c].type,nullable:!0}),l),{length:0,fields:new Array,children:new Array}),a=new et(r),o=G({type:new At(r),length:s,children:i,nullCount:0});[this.schema,this.data]=jl(a,o.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=Yl(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 Mt.visit(this.data,t)}at(t){return this.get(es(t,this.numRows))}set(t,n){return Wt.visit(this.data,t,n)}indexOf(t,n){return ni.visit(this.data,t,n)}[Symbol.iterator](){return os.visit(new tt([this.data]))}toArray(){return[...this]}concat(...t){return new Bt(this.schema,[this,...t])}slice(t,n){const[r]=new tt([this.data]).slice(t,n).data;return new ir(this.schema,r)}getChild(t){var n;return this.getChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(r=>r.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new tt([this.data.children[t]]):null}setChild(t,n){var r;return this.setChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(i=>i.name===t),n)}setChildAt(t,n){let r=this.schema,i=this.data;if(t>-1&&t<this.numCols){n||(n=new tt([G({type:new Oe,length:this.numRows})]));const s=r.fields.slice(),a=i.children.slice(),o=s[t].clone({type:n.type});[s[t],a[t]]=[o,n.data[0]],r=new et(s,new Map(this.schema.metadata)),i=G({type:new At(s),children:a})}return new ir(r,i)}select(t){const n=this.schema.select(t),r=new At(n.fields),i=[];for(const s of t){const a=this.schema.fields.findIndex(o=>o.name===s);~a&&(i[a]=this.data.children[a])}return new ir(n,G({type:r,length:this.numRows,children:i}))}selectAt(t){const n=this.schema.selectAt(t),r=t.map(s=>this.data.children[s]).filter(Boolean),i=G({type:new At(n.fields),length:this.numRows,children:r});return new ir(n,i)}};zl=Symbol.toStringTag,Lt[zl]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Lt.prototype);function jl(e,t,n=t.reduce((r,i)=>Math.max(r,i.length),0)){var r;const i=[...e.fields],s=[...t],a=(n+63&-64)>>3;for(const[o,l]of e.fields.entries()){const c=t[o];(!c||c.length!==n)&&(i[o]=l.clone({nullable:!0}),s[o]=(r=c==null?void 0:c._changeLengthAndBackfillNullBitmap(n))!==null&&r!==void 0?r:G({type:l.type,length:n,nullCount:n,nullBitmap:new Uint8Array(a)}))}return[e.assign(i),G({type:new At(i),length:n,children:s})]}function Yl(e,t,n=new Map){var r,i;if(((r=e==null?void 0:e.length)!==null&&r!==void 0?r:0)>0&&(e==null?void 0:e.length)===(t==null?void 0:t.length))for(let s=-1,a=e.length;++s<a;){const{type:o}=e[s],l=t[s];for(const c of[l,...((i=l==null?void 0:l.dictionary)===null||i===void 0?void 0:i.data)||[]])Yl(o.children,c==null?void 0:c.children,n);if(D.isDictionary(o)){const{id:c}=o;if(!n.has(c))l!=null&&l.dictionary&&n.set(c,l.dictionary);else if(n.get(c)!==l.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return n}class bs extends Lt{constructor(t){const n=t.fields.map(i=>G({type:i.type})),r=G({type:new At(t.fields),nullCount:0,children:n});super(t,r)}}let Le=class fe{constructor(){this.bb=null,this.bb_pos=0}__init(t,n){return this.bb_pos=t,this.bb=n,this}static getRootAsMessage(t,n){return(n||new fe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,n){return t.setPosition(t.position()+Z),(n||new fe).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):yt.V1}headerType(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):X.NONE}header(t){const n=this.bb.__offset(this.bb_pos,8);return n?this.bb.__union(t,this.bb_pos+n):null}bodyLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,n){const r=this.bb.__offset(this.bb_pos,12);return r?(n||new vt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+r)+t*4),this.bb):null}customMetadataLength(){const 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,n){t.addFieldInt16(0,n,yt.V1)}static addHeaderType(t,n){t.addFieldInt8(1,n,X.NONE)}static addHeader(t,n){t.addFieldOffset(2,n,0)}static addBodyLength(t,n){t.addFieldInt64(3,n,BigInt("0"))}static addCustomMetadata(t,n){t.addFieldOffset(4,n,0)}static createCustomMetadataVector(t,n){t.startVector(4,n.length,4);for(let r=n.length-1;r>=0;r--)t.addOffset(n[r]);return t.endVector()}static startCustomMetadataVector(t,n){t.startVector(4,n,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,n){t.finish(n)}static finishSizePrefixedMessageBuffer(t,n){t.finish(n,void 0,!0)}static createMessage(t,n,r,i,s,a){return fe.startMessage(t),fe.addVersion(t,n),fe.addHeaderType(t,r),fe.addHeader(t,i),fe.addBodyLength(t,s),fe.addCustomMetadata(t,a),fe.endMessage(t)}};class tm extends q{visit(t,n){return t==null||n==null?void 0:super.visit(t,n)}visitNull(t,n){return no.startNull(n),no.endNull(n)}visitInt(t,n){return Ut.startInt(n),Ut.addBitWidth(n,t.bitWidth),Ut.addIsSigned(n,t.isSigned),Ut.endInt(n)}visitFloat(t,n){return oe.startFloatingPoint(n),oe.addPrecision(n,t.precision),oe.endFloatingPoint(n)}visitBinary(t,n){return Xa.startBinary(n),Xa.endBinary(n)}visitLargeBinary(t,n){return Za.startLargeBinary(n),Za.endLargeBinary(n)}visitBool(t,n){return Ja.startBool(n),Ja.endBool(n)}visitUtf8(t,n){return ro.startUtf8(n),ro.endUtf8(n)}visitLargeUtf8(t,n){return to.startLargeUtf8(n),to.endLargeUtf8(n)}visitDecimal(t,n){return rn.startDecimal(n),rn.addScale(n,t.scale),rn.addPrecision(n,t.precision),rn.addBitWidth(n,t.bitWidth),rn.endDecimal(n)}visitDate(t,n){return Or.startDate(n),Or.addUnit(n,t.unit),Or.endDate(n)}visitTime(t,n){return zt.startTime(n),zt.addUnit(n,t.unit),zt.addBitWidth(n,t.bitWidth),zt.endTime(n)}visitTimestamp(t,n){const r=t.timezone&&n.createString(t.timezone)||void 0;return jt.startTimestamp(n),jt.addUnit(n,t.unit),r!==void 0&&jt.addTimezone(n,r),jt.endTimestamp(n)}visitInterval(t,n){return le.startInterval(n),le.addUnit(n,t.unit),le.endInterval(n)}visitDuration(t,n){return Dr.startDuration(n),Dr.addUnit(n,t.unit),Dr.endDuration(n)}visitList(t,n){return eo.startList(n),eo.endList(n)}visitStruct(t,n){return We.startStruct_(n),We.endStruct_(n)}visitUnion(t,n){Ft.startTypeIdsVector(n,t.typeIds.length);const r=Ft.createTypeIdsVector(n,t.typeIds);return Ft.startUnion(n),Ft.addMode(n,t.mode),Ft.addTypeIds(n,r),Ft.endUnion(n)}visitDictionary(t,n){const r=this.visit(t.indices,n);return ve.startDictionaryEncoding(n),ve.addId(n,BigInt(t.id)),ve.addIsOrdered(n,t.isOrdered),r!==void 0&&ve.addIndexType(n,r),ve.endDictionaryEncoding(n)}visitFixedSizeBinary(t,n){return Fr.startFixedSizeBinary(n),Fr.addByteWidth(n,t.byteWidth),Fr.endFixedSizeBinary(n)}visitFixedSizeList(t,n){return Mr.startFixedSizeList(n),Mr.addListSize(n,t.listSize),Mr.endFixedSizeList(n)}visitMap(t,n){return Lr.startMap(n),Lr.addKeysSorted(n,t.keysSorted),Lr.endMap(n)}}const gs=new tm;function em(e,t=new Map){return new et(rm(e,t),ci(e.metadata),t)}function Wl(e){return new kt(e.count,Gl(e.columns),Hl(e.columns))}function nm(e){return new he(Wl(e.data),e.id,e.isDelta)}function rm(e,t){return(e.fields||[]).filter(Boolean).map(n=>ut.fromJSON(n,t))}function ql(e,t){return(e.children||[]).filter(Boolean).map(n=>ut.fromJSON(n,t))}function Gl(e){return(e||[]).reduce((t,n)=>[...t,new xe(n.count,im(n.VALIDITY)),...Gl(n.children)],[])}function Hl(e,t=[]){for(let n=-1,r=(e||[]).length;++n<r;){const i=e[n];i.VALIDITY&&t.push(new de(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new de(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new de(t.length,i.OFFSET.length)),i.DATA&&t.push(new de(t.length,i.DATA.length)),t=Hl(i.children,t)}return t}function im(e){return(e||[]).reduce((t,n)=>t+ +(n===0),0)}function sm(e,t){let n,r,i,s,a,o;return!t||!(s=e.dictionary)?(a=Ql(e,ql(e,t)),i=new ut(e.name,a,e.nullable,ci(e.metadata))):t.has(n=s.id)?(r=(r=s.indexType)?Kl(r):new $n,o=new on(t.get(n),r,n,s.isOrdered),i=new ut(e.name,o,e.nullable,ci(e.metadata))):(r=(r=s.indexType)?Kl(r):new $n,t.set(n,a=Ql(e,ql(e,t))),o=new on(a,r,n,s.isOrdered),i=new ut(e.name,o,e.nullable,ci(e.metadata))),i||null}function ci(e=[]){return new Map(e.map(({key:t,value:n})=>[t,n]))}function Kl(e){return new qe(e.isSigned,e.bitWidth)}function Ql(e,t){const n=e.type.name;switch(n){case"NONE":return new Oe;case"null":return new Oe;case"binary":return new Ur;case"largebinary":return new Cr;case"utf8":return new kr;case"largeutf8":return new $r;case"bool":return new Pr;case"list":return new Gr((t||[])[0]);case"struct":return new At(t||[]);case"struct_":return new At(t||[])}switch(n){case"int":{const r=e.type;return new qe(r.isSigned,r.bitWidth)}case"floatingpoint":{const r=e.type;return new xr(Tt[r.precision])}case"decimal":{const r=e.type;return new Vr(r.scale,r.precision,r.bitWidth)}case"date":{const r=e.type;return new zr(Vt[r.unit])}case"time":{const r=e.type;return new jr(k[r.unit],r.bitWidth)}case"timestamp":{const r=e.type;return new Yr(k[r.unit],r.timezone)}case"interval":{const r=e.type;return new Wr(se[r.unit])}case"duration":{const r=e.type;return new qr(k[r.unit])}case"union":{const r=e.type,[i,...s]=(r.mode+"").toLowerCase(),a=i.toUpperCase()+s.join("");return new Hr(Et[a],r.typeIds||[],t||[])}case"fixedsizebinary":{const r=e.type;return new Kr(r.byteWidth)}case"fixedsizelist":{const r=e.type;return new Qr(r.listSize,(t||[])[0])}case"map":{const r=e.type;return new Xr((t||[])[0],r.keysSorted)}}throw new Error(`Unrecognized type: "${n}"`)}var am=Ha,om=tn;class Rt{static fromJSON(t,n){const r=new Rt(0,yt.V5,n);return r._createHeader=lm(t,n),r}static decode(t){t=new om(H(t));const n=Le.getRootAsMessage(t),r=n.bodyLength(),i=n.version(),s=n.headerType(),a=new Rt(r,i,s);return a._createHeader=cm(n,s),a}static encode(t){const n=new am;let r=-1;return t.isSchema()?r=et.encode(n,t.header()):t.isRecordBatch()?r=kt.encode(n,t.header()):t.isDictionaryBatch()&&(r=he.encode(n,t.header())),Le.startMessage(n),Le.addVersion(n,yt.V5),Le.addHeader(n,r),Le.addHeaderType(n,t.headerType),Le.addBodyLength(n,BigInt(t.bodyLength)),Le.finishMessageBuffer(n,Le.endMessage(n)),n.asUint8Array()}static from(t,n=0){if(t instanceof et)return new Rt(0,yt.V5,X.Schema,t);if(t instanceof kt)return new Rt(n,yt.V5,X.RecordBatch,t);if(t instanceof he)return new Rt(n,yt.V5,X.DictionaryBatch,t);throw new Error(`Unrecognized Message header: ${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===X.Schema}isRecordBatch(){return this.headerType===X.RecordBatch}isDictionaryBatch(){return this.headerType===X.DictionaryBatch}constructor(t,n,r,i){this._version=n,this._headerType=r,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=ot(t)}}class kt{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,n,r){this._nodes=n,this._buffers=r,this._length=ot(t)}}class he{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,n,r=!1){this._data=t,this._isDelta=r,this._id=ot(n)}}class de{constructor(t,n){this.offset=ot(t),this.length=ot(n)}}class xe{constructor(t,n){this.length=ot(t),this.nullCount=ot(n)}}function lm(e,t){return()=>{switch(t){case X.Schema:return et.fromJSON(e);case X.RecordBatch:return kt.fromJSON(e);case X.DictionaryBatch:return he.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${X[t]}, type: ${t} }`)}}function cm(e,t){return()=>{switch(t){case X.Schema:return et.decode(e.header(new ce),new Map,e.version());case X.RecordBatch:return kt.decode(e.header(new _e),e.version());case X.DictionaryBatch:return he.decode(e.header(new en),e.version())}throw new Error(`Unrecognized Message type: { name: ${X[t]}, type: ${t} }`)}}ut.encode=vm,ut.decode=gm,ut.fromJSON=sm,et.encode=_m,et.decode=um,et.fromJSON=em,kt.encode=wm,kt.decode=hm,kt.fromJSON=Wl,he.encode=Im,he.decode=dm,he.fromJSON=nm,xe.encode=Sm,xe.decode=pm,de.encode=Em,de.decode=fm;function um(e,t=new Map,n=yt.V5){const r=bm(e,t);return new et(r,ui(e),t,n)}function hm(e,t=yt.V5){if(e.compression()!==null)throw new Error("Record batch compression not implemented");return new kt(e.length(),ym(e),mm(e,t))}function dm(e,t=yt.V5){return new he(kt.decode(e.data(),t),e.id(),e.isDelta())}function fm(e){return new de(e.offset(),e.length())}function pm(e){return new xe(e.length(),e.nullCount())}function ym(e){const t=[];for(let n,r=-1,i=-1,s=e.nodesLength();++r<s;)(n=e.nodes(r))&&(t[++i]=xe.decode(n));return t}function mm(e,t){const n=[];for(let r,i=-1,s=-1,a=e.buffersLength();++i<a;)(r=e.buffers(i))&&(t<yt.V4&&(r.bb_pos+=8*(i+1)),n[++s]=de.decode(r));return n}function bm(e,t){const n=[];for(let r,i=-1,s=-1,a=e.fieldsLength();++i<a;)(r=e.fields(i))&&(n[++s]=ut.decode(r,t));return n}function Xl(e,t){const n=[];for(let r,i=-1,s=-1,a=e.childrenLength();++i<a;)(r=e.children(i))&&(n[++s]=ut.decode(r,t));return n}function gm(e,t){let n,r,i,s,a,o;return!t||!(o=e.dictionary())?(i=Zl(e,Xl(e,t)),r=new ut(e.name(),i,e.nullable(),ui(e))):t.has(n=ot(o.id()))?(s=(s=o.indexType())?Jl(s):new $n,a=new on(t.get(n),s,n,o.isOrdered()),r=new ut(e.name(),a,e.nullable(),ui(e))):(s=(s=o.indexType())?Jl(s):new $n,t.set(n,i=Zl(e,Xl(e,t))),a=new on(i,s,n,o.isOrdered()),r=new ut(e.name(),a,e.nullable(),ui(e))),r||null}function ui(e){const t=new Map;if(e)for(let n,r,i=-1,s=Math.trunc(e.customMetadataLength());++i<s;)(n=e.customMetadata(i))&&(r=n.key())!=null&&t.set(r,n.value());return t}function Jl(e){return new qe(e.isSigned(),e.bitWidth())}function Zl(e,t){const n=e.typeType();switch(n){case lt.NONE:return new Oe;case lt.Null:return new Oe;case lt.Binary:return new Ur;case lt.LargeBinary:return new Cr;case lt.Utf8:return new kr;case lt.LargeUtf8:return new $r;case lt.Bool:return new Pr;case lt.List:return new Gr((t||[])[0]);case lt.Struct_:return new At(t||[])}switch(n){case lt.Int:{const r=e.type(new Ut);return new qe(r.isSigned(),r.bitWidth())}case lt.FloatingPoint:{const r=e.type(new oe);return new xr(r.precision())}case lt.Decimal:{const r=e.type(new rn);return new Vr(r.scale(),r.precision(),r.bitWidth())}case lt.Date:{const r=e.type(new Or);return new zr(r.unit())}case lt.Time:{const r=e.type(new zt);return new jr(r.unit(),r.bitWidth())}case lt.Timestamp:{const r=e.type(new jt);return new Yr(r.unit(),r.timezone())}case lt.Interval:{const r=e.type(new le);return new Wr(r.unit())}case lt.Duration:{const r=e.type(new Dr);return new qr(r.unit())}case lt.Union:{const r=e.type(new Ft);return new Hr(r.mode(),r.typeIdsArray()||[],t||[])}case lt.FixedSizeBinary:{const r=e.type(new Fr);return new Kr(r.byteWidth())}case lt.FixedSizeList:{const r=e.type(new Mr);return new Qr(r.listSize(),(t||[])[0])}case lt.Map:{const r=e.type(new Lr);return new Xr((t||[])[0],r.keysSorted())}}throw new Error(`Unrecognized type: "${lt[n]}" (${n})`)}function _m(e,t){const n=t.fields.map(s=>ut.encode(e,s));ce.startFieldsVector(e,n.length);const r=ce.createFieldsVector(e,n),i=t.metadata&&t.metadata.size>0?ce.createCustomMetadataVector(e,[...t.metadata].map(([s,a])=>{const o=e.createString(`${s}`),l=e.createString(`${a}`);return vt.startKeyValue(e),vt.addKey(e,o),vt.addValue(e,l),vt.endKeyValue(e)})):-1;return ce.startSchema(e),ce.addFields(e,r),ce.addEndianness(e,Tm?nn.Little:nn.Big),i!==-1&&ce.addCustomMetadata(e,i),ce.endSchema(e)}function vm(e,t){let n=-1,r=-1,i=-1;const s=t.type;let a=t.typeId;D.isDictionary(s)?(a=s.dictionary.typeId,i=gs.visit(s,e),r=gs.visit(s.dictionary,e)):r=gs.visit(s,e);const o=(s.children||[]).map(d=>ut.encode(e,d)),l=Yt.createChildrenVector(e,o),c=t.metadata&&t.metadata.size>0?Yt.createCustomMetadataVector(e,[...t.metadata].map(([d,y])=>{const _=e.createString(`${d}`),v=e.createString(`${y}`);return vt.startKeyValue(e),vt.addKey(e,_),vt.addValue(e,v),vt.endKeyValue(e)})):-1;return t.name&&(n=e.createString(t.name)),Yt.startField(e),Yt.addType(e,r),Yt.addTypeType(e,a),Yt.addChildren(e,l),Yt.addNullable(e,!!t.nullable),n!==-1&&Yt.addName(e,n),i!==-1&&Yt.addDictionary(e,i),c!==-1&&Yt.addCustomMetadata(e,c),Yt.endField(e)}function wm(e,t){const n=t.nodes||[],r=t.buffers||[];_e.startNodesVector(e,n.length);for(const a of n.slice().reverse())xe.encode(e,a);const i=e.endVector();_e.startBuffersVector(e,r.length);for(const a of r.slice().reverse())de.encode(e,a);const s=e.endVector();return _e.startRecordBatch(e),_e.addLength(e,BigInt(t.length)),_e.addNodes(e,i),_e.addBuffers(e,s),_e.endRecordBatch(e)}function Im(e,t){const n=kt.encode(e,t.data);return en.startDictionaryBatch(e),en.addId(e,BigInt(t.id)),en.addIsDelta(e,t.isDelta),en.addData(e,n),en.endDictionaryBatch(e)}function Sm(e,t){return Qa.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function Em(e,t){return Ka.createBuffer(e,BigInt(t.offset),BigInt(t.length))}const Tm=(()=>{const e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})(),_s=e=>`Expected ${X[e]} Message in stream, but was null or length 0.`,vs=e=>`Header pointer of flatbuffer-encoded ${X[e]} Message is null or length 0.`,tc=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,ec=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`;class nc{constructor(t){this.source=t instanceof ai?t:new ai(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done||t.value===-1&&(t=this.readMetadataLength()).done||(t=this.readMetadata(t.value)).done?wt:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(_s(t));return n.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const n=H(this.source.read(t));if(n.byteLength<t)throw new Error(ec(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()}readSchema(t=!1){const n=X.Schema,r=this.readMessage(n),i=r==null?void 0:r.header();if(t&&!i)throw new Error(vs(n));return i}readMetadataLength(){const t=this.source.read(hi),n=t&&new tn(t),r=(n==null?void 0:n.readInt32(0))||0;return{done:r===0,value:r}}readMetadata(t){const n=this.source.read(t);if(!n)return wt;if(n.byteLength<t)throw new Error(tc(t,n.byteLength));return{done:!1,value:Rt.decode(n)}}}class Am{constructor(t,n){this.source=t instanceof yn?t:$a(t)?new oi(t,n):new yn(t)}[Symbol.asyncIterator](){return this}next(){return Y(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done||t.value===-1&&(t=yield this.readMetadataLength()).done||(t=yield this.readMetadata(t.value)).done?wt:t})}throw(t){return Y(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return Y(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return Y(this,void 0,void 0,function*(){let n;if((n=yield this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(_s(t));return n.value})}readMessageBody(t){return Y(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);const n=H(yield this.source.read(t));if(n.byteLength<t)throw new Error(ec(t,n.byteLength));return n.byteOffset%8===0&&n.byteOffset+n.byteLength<=n.buffer.byteLength?n:n.slice()})}readSchema(){return Y(this,arguments,void 0,function*(t=!1){const n=X.Schema,r=yield this.readMessage(n),i=r==null?void 0:r.header();if(t&&!i)throw new Error(vs(n));return i})}readMetadataLength(){return Y(this,void 0,void 0,function*(){const t=yield this.source.read(hi),n=t&&new tn(t),r=(n==null?void 0:n.readInt32(0))||0;return{done:r===0,value:r}})}readMetadata(t){return Y(this,void 0,void 0,function*(){const n=yield this.source.read(t);if(!n)return wt;if(n.byteLength<t)throw new Error(tc(t,n.byteLength));return{done:!1,value:Rt.decode(n)}})}}class Nm extends nc{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Cl?t:new Cl(t)}next(){const{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Rt.fromJSON(t.schema,X.Schema)};if(this._dictionaryIndex<t.dictionaries.length){const n=t.dictionaries[this._dictionaryIndex++];return this._body=n.data.columns,{done:!1,value:Rt.fromJSON(n,X.DictionaryBatch)}}if(this._batchIndex<t.batches.length){const n=t.batches[this._batchIndex++];return this._body=n.columns,{done:!1,value:Rt.fromJSON(n,X.RecordBatch)}}return this._body=[],wt}readMessageBody(t){return n(this._body);function n(r){return(r||[]).reduce((i,s)=>[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE_ID&&[s.TYPE_ID]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...n(s.children)],[])}}readMessage(t){let n;if((n=this.next()).done)return null;if(t!=null&&n.value.headerType!==t)throw new Error(_s(t));return n.value}readSchema(){const t=X.Schema,n=this.readMessage(t),r=n==null?void 0:n.header();if(!n||!r)throw new Error(vs(t));return r}}const hi=4,ws="ARROW1",Wn=new Uint8Array(ws.length);for(let e=0;e<ws.length;e+=1)Wn[e]=ws.codePointAt(e);function Is(e,t=0){for(let n=-1,r=Wn.length;++n<r;)if(Wn[n]!==e[t+n])return!1;return!0}const qn=Wn.length,rc=qn+hi,Bm=qn*2+hi;class Gt extends us{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){const n=this._impl.open(t);return Ye(n)?n.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return Pt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return Pt.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,n){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof Gt?t:zi(t)?Fm(t):$a(t)?xm(t):Ye(t)?Y(this,void 0,void 0,function*(){return yield Gt.from(yield t)}):Pa(t)||ji(t)||Va(t)||Ze(t)?Lm(new yn(t)):Mm(new ai(t))}static readAll(t){return t instanceof Gt?t.isSync()?lc(t):cc(t):zi(t)||ArrayBuffer.isView(t)||Ln(t)||ka(t)?lc(t):cc(t)}}class di extends Gt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return re(this,arguments,function*(){yield W(yield*Sr(je(this[Symbol.iterator]())))})}}class fi extends Gt{constructor(t){super(t),this._impl=t}readAll(){return Y(this,void 0,void 0,function*(){var t,n,r,i;const s=new Array;try{for(var a=!0,o=je(this),l;l=yield o.next(),t=l.done,!t;a=!0){i=l.value,a=!1;const c=i;s.push(c)}}catch(c){n={error:c}}finally{try{!a&&!t&&(r=o.return)&&(yield r.call(o))}finally{if(n)throw n.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class ic extends di{constructor(t){super(t),this._impl=t}}class Rm extends fi{constructor(t){super(t),this._impl=t}}class sc{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,n){const r=this._loadVectors(t,n,this.schema.fields),i=G({type:new At(this.schema.fields),length:t.length,children:r});return new Lt(this.schema,i)}_loadDictionaryBatch(t,n){const{id:r,isDelta:i}=t,{dictionaries:s,schema:a}=this,o=s.get(r),l=a.dictionaries.get(r),c=this._loadVectors(t.data,n,[l]);return(o&&i?o.concat(new tt(c)):new tt(c)).memoize()}_loadVectors(t,n,r){return new Pl(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}}class pi extends sc{constructor(t,n){super(n),this._reader=zi(t)?new Nm(this._handle=t):new nc(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=oc(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):wt}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):wt}next(){if(this.closed)return wt;let t;const{_reader:n}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const r=t.header(),i=n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const r=t.header(),i=n.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new bs(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class yi extends sc{constructor(t,n){super(n),this._reader=new Am(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Y(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 Y(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=oc(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return Y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):wt})}return(t){return Y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):wt})}next(){return Y(this,void 0,void 0,function*(){if(this.closed)return wt;let t;const{_reader:n}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const r=t.header(),i=yield n.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(r,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const r=t.header(),i=yield n.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(r,i);this.dictionaries.set(r.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new bs(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Y(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}}class ac extends pi{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,n){super(t instanceof kl?t:new kl(t),n)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const n of this._footer.dictionaryBatches())n&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var n;if(this.closed)return null;this._footer||this.open();const r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&this._handle.seek(r.offset)){const i=this._reader.readMessage(X.RecordBatch);if(i!=null&&i.isRecordBatch()){const s=i.header(),a=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,a)}}return null}_readDictionaryBatch(t){var n;const r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&this._handle.seek(r.offset)){const i=this._reader.readMessage(X.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){const s=i.header(),a=this._reader.readMessageBody(i.bodyLength),o=this._loadDictionaryBatch(s,a);this.dictionaries.set(s.id,o)}}}_readFooter(){const{_handle:t}=this,n=t.size-rc,r=t.readInt32(n),i=t.readAt(n-r,r);return Vn.decode(i)}_readNextMessageAndValidate(t){var n;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(this._recordBatchIndex);if(r&&this._handle.seek(r.offset))return this._reader.readMessage(t)}return null}}class Om extends yi{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,...n){const r=typeof n[0]!="number"?n.shift():void 0,i=n[0]instanceof Map?n.shift():void 0;super(t instanceof oi?t:new oi(t,r),i)}isFile(){return!0}isAsync(){return!0}open(t){const n=Object.create(null,{open:{get:()=>super.open}});return Y(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const r of this._footer.dictionaryBatches())r&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield n.open.call(this,t)})}readRecordBatch(t){return Y(this,void 0,void 0,function*(){var n;if(this.closed)return null;this._footer||(yield this.open());const r=(n=this._footer)===null||n===void 0?void 0:n.getRecordBatch(t);if(r&&(yield this._handle.seek(r.offset))){const i=yield this._reader.readMessage(X.RecordBatch);if(i!=null&&i.isRecordBatch()){const s=i.header(),a=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,a)}}return null})}_readDictionaryBatch(t){return Y(this,void 0,void 0,function*(){var n;const r=(n=this._footer)===null||n===void 0?void 0:n.getDictionaryBatch(t);if(r&&(yield this._handle.seek(r.offset))){const i=yield this._reader.readMessage(X.DictionaryBatch);if(i!=null&&i.isDictionaryBatch()){const s=i.header(),a=yield this._reader.readMessageBody(i.bodyLength),o=this._loadDictionaryBatch(s,a);this.dictionaries.set(s.id,o)}}})}_readFooter(){return Y(this,void 0,void 0,function*(){const{_handle:t}=this;t._pending&&(yield t._pending);const n=t.size-rc,r=yield t.readInt32(n),i=yield t.readAt(n-r,r);return Vn.decode(i)})}_readNextMessageAndValidate(t){return Y(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){const n=this._footer.getRecordBatch(this._recordBatchIndex);if(n&&(yield this._handle.seek(n.offset)))return yield this._reader.readMessage(t)}return null})}}class Dm extends pi{constructor(t,n){super(t,n)}_loadVectors(t,n,r){return new Yy(n,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(r)}}function oc(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*lc(e){const t=Gt.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function cc(e){return re(this,arguments,function*(){const t=yield W(Gt.from(e));try{if(!(yield W(t.open({autoDestroy:!1}))).closed)do yield yield W(t);while(!(yield W(t.reset().open())).closed)}finally{yield W(t.cancel())}})}function Fm(e){return new di(new Dm(e))}function Mm(e){const t=e.peek(qn+7&-8);return t&&t.byteLength>=4?Is(t)?new ic(new ac(e.read())):new di(new pi(e)):new di(new pi(function*(){}()))}function Lm(e){return Y(this,void 0,void 0,function*(){const t=yield e.peek(qn+7&-8);return t&&t.byteLength>=4?Is(t)?new ic(new ac(yield e.read())):new fi(new yi(e)):new fi(new yi(function(){return re(this,arguments,function*(){})}()))})}function xm(e){return Y(this,void 0,void 0,function*(){const{size:t}=yield e.stat(),n=new oi(e,t);return t>=Bm&&Is(yield n.readAt(0,qn+7&-8))?new Rm(new Om(n)):new fi(new yi(n))})}class pt extends q{static assemble(...t){const n=i=>i.flatMap(s=>Array.isArray(s)?n(s):s instanceof Lt?s.data.children:s.data),r=new pt;return r.visitMany(n(t)),r}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof tt)return this.visitMany(t.data),this;const{type:n}=t;if(!D.isDictionary(n)){const{length:r}=t;if(r>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(D.isUnion(n))this.nodes.push(new xe(r,0));else{const{nullCount:i}=t;D.isNull(n)||Jt.call(this,i<=0?new Uint8Array(0):Zr(t.offset,r,t.nullBitmap)),this.nodes.push(new xe(r,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 Jt(e){const t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new de(this._byteLength,t)),this._byteLength+=t,this}function Um(e){var t;const{type:n,length:r,typeIds:i,valueOffsets:s}=e;if(Jt.call(this,i),n.mode===Et.Sparse)return Es.call(this,e);if(n.mode===Et.Dense){if(e.offset<=0)return Jt.call(this,s),Es.call(this,e);{const a=new Int32Array(r),o=Object.create(null),l=Object.create(null);for(let c,d,y=-1;++y<r;)(c=i[y])!==void 0&&((d=o[c])===void 0&&(d=o[c]=s[y]),a[y]=s[y]-d,l[c]=((t=l[c])!==null&&t!==void 0?t:0)+1);Jt.call(this,a),this.visitMany(e.children.map((c,d)=>{const y=n.typeIds[d],_=o[y],v=l[y];return c.slice(_,Math.min(r,v))}))}}return this}function Cm(e){let t;return e.nullCount>=e.length?Jt.call(this,new Uint8Array(0)):(t=e.values)instanceof Uint8Array?Jt.call(this,Zr(e.offset,e.length,t)):Jt.call(this,ti(e.values))}function Te(e){return Jt.call(this,e.values.subarray(0,e.length*e.stride))}function mi(e){const{length:t,values:n,valueOffsets:r}=e,i=ot(r[0]),s=ot(r[t]),a=Math.min(s-i,n.byteLength-i);return Jt.call(this,Wa(-i,t+1,r)),Jt.call(this,n.subarray(i,i+a)),this}function Ss(e){const{length:t,valueOffsets:n}=e;if(n){const{[0]:r,[t]:i}=n;return Jt.call(this,Wa(-r,t+1,n)),this.visit(e.children[0].slice(r,i-r))}return this.visit(e.children[0])}function Es(e){return this.visitMany(e.type.children.map((t,n)=>e.children[n]).filter(Boolean))[0]}pt.prototype.visitBool=Cm,pt.prototype.visitInt=Te,pt.prototype.visitFloat=Te,pt.prototype.visitUtf8=mi,pt.prototype.visitLargeUtf8=mi,pt.prototype.visitBinary=mi,pt.prototype.visitLargeBinary=mi,pt.prototype.visitFixedSizeBinary=Te,pt.prototype.visitDate=Te,pt.prototype.visitTimestamp=Te,pt.prototype.visitTime=Te,pt.prototype.visitDecimal=Te,pt.prototype.visitList=Ss,pt.prototype.visitStruct=Es,pt.prototype.visitUnion=Um,pt.prototype.visitInterval=Te,pt.prototype.visitDuration=Te,pt.prototype.visitFixedSizeList=Ss,pt.prototype.visitMap=Ss;class uc extends us{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,n){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new si,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,Dt(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 Ye(t)?t.then(n=>this.writeAll(n)):Ze(t)?Bs(this,t):Ns(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,n=null){return t===this._sink||t instanceof si?this._sink=t:(this._sink=new si,t&&pp(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&yp(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,(!n||!ys(n,this._schema))&&(n==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=n,this._writeSchema(n))),this}write(t){let n=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof Bt&&!(n=t.schema))return this.finish()&&void 0;if(t instanceof Lt&&!(n=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(n&&!ys(n,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,n)}t instanceof Lt?t instanceof bs||this._writeRecordBatch(t):t instanceof Bt?this.writeAll(t.batches):Ln(t)&&this.writeAll(t)}_writeMessage(t,n=8){const r=n-1,i=Rt.encode(t),s=i.byteLength,a=this._writeLegacyIpcFormat?4:8,o=s+a+r&~r,l=o-s-a;return t.headerType===X.RecordBatch?this._recordBatchBlocks.push(new Fe(o,t.bodyLength,this._position)):t.headerType===X.DictionaryBatch&&this._dictionaryBlocks.push(new Fe(o,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(o-a)),s>0&&this._write(i),this._writePadding(l)}_write(t){if(this._started){const n=H(t);n&&n.byteLength>0&&(this._sink.write(n),this._position+=n.byteLength)}return this}_writeSchema(t){return this._writeMessage(Rt.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Wn)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){const{byteLength:n,nodes:r,bufferRegions:i,buffers:s}=pt.assemble(t),a=new kt(t.numRows,r,i),o=Rt.from(a,n);return this._writeDictionaries(t)._writeMessage(o)._writeBodyBuffers(s)}_writeDictionaryBatch(t,n,r=!1){const{byteLength:i,nodes:s,bufferRegions:a,buffers:o}=pt.assemble(new tt([t])),l=new kt(t.length,s,a),c=new he(l,n,r),d=Rt.from(c,i);return this._writeMessage(d)._writeBodyBuffers(o)}_writeBodyBuffers(t){let n,r,i;for(let s=-1,a=t.length;++s<a;)(n=t[s])&&(r=n.byteLength)>0&&(this._write(n),(i=(r+7&-8)-r)>0&&this._writePadding(i));return this}_writeDictionaries(t){var n,r;for(const[i,s]of t.dictionaries){const a=(n=s==null?void 0:s.data)!==null&&n!==void 0?n:[],o=this._seenDictionaries.get(i),l=(r=this._dictionaryDeltaOffsets.get(i))!==null&&r!==void 0?r:0;if(!o||o.data[0]!==a[0])for(const[c,d]of a.entries())this._writeDictionaryBatch(d,i,c>0);else if(l<a.length)for(const c of a.slice(l))this._writeDictionaryBatch(c,i,!0);this._seenDictionaries.set(i,s),this._dictionaryDeltaOffsets.set(i,a.length)}return this}}class Ts extends uc{static writeAll(t,n){const r=new Ts(n);return Ye(t)?t.then(i=>r.writeAll(i)):Ze(t)?Bs(r,t):Ns(r,t)}}class As extends uc{static writeAll(t){const n=new As;return Ye(t)?t.then(r=>n.writeAll(r)):Ze(t)?Bs(n,t):Ns(n,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,n,r=!1){if(!r&&this._seenDictionaries.has(n))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,n,r)}_writeFooter(t){const n=Vn.encode(new Vn(t,yt.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(n)._write(Int32Array.of(n.byteLength))._writeMagic()}}function Ns(e,t){let n=t;t instanceof Bt&&(n=t.batches,e.reset(void 0,t.schema));for(const r of n)e.write(r);return e.finish()}function Bs(e,t){return Y(this,void 0,void 0,function*(){var n,r,i,s,a,o,l;try{for(n=!0,r=je(t);i=yield r.next(),s=i.done,!s;n=!0){l=i.value,n=!1;const c=l;e.write(c)}}catch(c){a={error:c}}finally{try{!n&&!s&&(o=r.return)&&(yield o.call(r))}finally{if(a)throw a.error}}return e.finish()})}function km(e,t="stream"){return(t==="stream"?Ts:As).writeAll(e).toUint8Array(!0)}var $m=Object.create,hc=Object.defineProperty,Pm=Object.getOwnPropertyDescriptor,Vm=Object.getOwnPropertyNames,zm=Object.getPrototypeOf,jm=Object.prototype.hasOwnProperty,Ym=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Wm=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Vm(t))!jm.call(e,i)&&i!==n&&hc(e,i,{get:()=>t[i],enumerable:!(r=Pm(t,i))||r.enumerable});return e},qm=(e,t,n)=>(n=e!=null?$m(zm(e)):{},Wm(!e||!e.__esModule?hc(n,"default",{value:e,enumerable:!0}):n,e)),Gm=Ym((e,t)=>{t.exports=Worker}),dc=(e=>(e[e.UNDEFINED=0]="UNDEFINED",e[e.AUTOMATIC=1]="AUTOMATIC",e[e.READ_ONLY=2]="READ_ONLY",e[e.READ_WRITE=3]="READ_WRITE",e))(dc||{}),fc=(e=>(e[e.IDENTIFIER=0]="IDENTIFIER",e[e.NUMERIC_CONSTANT=1]="NUMERIC_CONSTANT",e[e.STRING_CONSTANT=2]="STRING_CONSTANT",e[e.OPERATOR=3]="OPERATOR",e[e.KEYWORD=4]="KEYWORD",e[e.COMMENT=5]="COMMENT",e))(fc||{}),pc=(e=>(e[e.NONE=0]="NONE",e[e.DEBUG=1]="DEBUG",e[e.INFO=2]="INFO",e[e.WARNING=3]="WARNING",e[e.ERROR=4]="ERROR",e))(pc||{}),yc=(e=>(e[e.NONE=0]="NONE",e[e.CONNECT=1]="CONNECT",e[e.DISCONNECT=2]="DISCONNECT",e[e.OPEN=3]="OPEN",e[e.QUERY=4]="QUERY",e[e.INSTANTIATE=5]="INSTANTIATE",e))(yc||{}),mc=(e=>(e[e.NONE=0]="NONE",e[e.OK=1]="OK",e[e.ERROR=2]="ERROR",e[e.START=3]="START",e[e.RUN=4]="RUN",e[e.CAPTURE=5]="CAPTURE",e))(mc||{}),bc=(e=>(e[e.NONE=0]="NONE",e[e.WEB_WORKER=1]="WEB_WORKER",e[e.NODE_WORKER=2]="NODE_WORKER",e[e.BINDINGS=3]="BINDINGS",e[e.ASYNC_DUCKDB=4]="ASYNC_DUCKDB",e))(bc||{}),Hm=class{log(e){}},Km=class{constructor(e=2){this.level=e}log(e){e.level>=this.level&&console.log(e)}};function Qm(e){switch(e){case 0:return"NONE";case 1:return"DEBUG";case 2:return"INFO";case 3:return"WARNING";case 4:return"ERROR";default:return"?"}}function Xm(e){switch(e){case 0:return"NONE";case 1:return"OK";case 2:return"ERROR";case 3:return"START";case 4:return"RUN";case 5:return"CAPTURE";default:return"?"}}function Jm(e){switch(e){case 1:return"CONNECT";case 2:return"DISCONNECT";case 5:return"INSTANTIATE";case 3:return"OPEN";case 4:return"QUERY";default:return"?"}}function Zm(e){switch(e){case 0:return"NONE";case 1:return"WEB WORKER";case 2:return"NODE WORKER";case 3:return"DUCKDB BINDINGS";case 4:return"DUCKDB";default:return"?"}}var gc=(e=>(e[e.SUCCESS=0]="SUCCESS",e))(gc||{}),_c=class{constructor(e,t){this._bindings=e,this._conn=t}get bindings(){return this._bindings}async close(){return this._bindings.disconnect(this._conn)}useUnsafe(e){return e(this._bindings,this._conn)}async query(e){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let t=await this._bindings.runQuery(this._conn,e),n=Gt.from(t);return console.assert(n.isSync(),"Reader is not sync"),console.assert(n.isFile(),"Reader is not file"),new Bt(n)}async send(e,t=!1){this._bindings.logger.log({timestamp:new Date,level:2,origin:4,topic:4,event:4,value:e});let n=await this._bindings.startPendingQuery(this._conn,e,t);for(;n==null;)n=await this._bindings.pollPendingQuery(this._conn);let r=new Rs(this._bindings,this._conn,n),i=await Gt.from(r);return console.assert(i.isAsync()),console.assert(i.isStream()),i}async cancelSent(){return await this._bindings.cancelPendingQuery(this._conn)}async getTableNames(e){return await this._bindings.getTableNames(this._conn,e)}async prepare(e){let t=await this._bindings.createPrepared(this._conn,e);return new vc(this._bindings,this._conn,t)}async insertArrowTable(e,t){let n=km(e,"stream");await this.insertArrowFromIPCStream(n,t)}async insertArrowFromIPCStream(e,t){await this._bindings.insertArrowFromIPCStream(this._conn,e,t)}async insertCSVFromPath(e,t){await this._bindings.insertCSVFromPath(this._conn,e,t)}async insertJSONFromPath(e,t){await this._bindings.insertJSONFromPath(this._conn,e,t)}},Rs=class{constructor(e,t,n){this.db=e,this.conn=t,this.header=n,this._first=!0,this._depleted=!1,this._inFlight=null}async next(){if(this._first)return this._first=!1,{done:!1,value:this.header};if(this._depleted)return{done:!0,value:null};let e;return this._inFlight!=null?(e=await this._inFlight,this._inFlight=null):e=await this.db.fetchQueryResults(this.conn),this._depleted=e.length==0,this._depleted||(this._inFlight=this.db.fetchQueryResults(this.conn)),{done:this._depleted,value:e}}[Symbol.asyncIterator](){return this}},vc=class{constructor(e,t,n){this.bindings=e,this.connectionId=t,this.statementId=n}async close(){await this.bindings.closePrepared(this.connectionId,this.statementId)}async query(...e){let t=await this.bindings.runPrepared(this.connectionId,this.statementId,e),n=Gt.from(t);return console.assert(n.isSync()),console.assert(n.isFile()),new Bt(n)}async send(...e){let t=await this.bindings.sendPrepared(this.connectionId,this.statementId,e),n=new Rs(this.bindings,this.connectionId,t),r=await Gt.from(n);return console.assert(r.isAsync()),console.assert(r.isStream()),r}},wc=(e=>(e.CANCEL_PENDING_QUERY="CANCEL_PENDING_QUERY",e.CLOSE_PREPARED="CLOSE_PREPARED",e.COLLECT_FILE_STATISTICS="COLLECT_FILE_STATISTICS",e.REGISTER_OPFS_FILE_NAME="REGISTER_OPFS_FILE_NAME",e.CONNECT="CONNECT",e.COPY_FILE_TO_BUFFER="COPY_FILE_TO_BUFFER",e.COPY_FILE_TO_PATH="COPY_FILE_TO_PATH",e.CREATE_PREPARED="CREATE_PREPARED",e.DISCONNECT="DISCONNECT",e.DROP_FILE="DROP_FILE",e.DROP_FILES="DROP_FILES",e.EXPORT_FILE_STATISTICS="EXPORT_FILE_STATISTICS",e.FETCH_QUERY_RESULTS="FETCH_QUERY_RESULTS",e.FLUSH_FILES="FLUSH_FILES",e.GET_FEATURE_FLAGS="GET_FEATURE_FLAGS",e.GET_TABLE_NAMES="GET_TABLE_NAMES",e.GET_VERSION="GET_VERSION",e.GLOB_FILE_INFOS="GLOB_FILE_INFOS",e.INSERT_ARROW_FROM_IPC_STREAM="INSERT_ARROW_FROM_IPC_STREAM",e.INSERT_CSV_FROM_PATH="IMPORT_CSV_FROM_PATH",e.INSERT_JSON_FROM_PATH="IMPORT_JSON_FROM_PATH",e.INSTANTIATE="INSTANTIATE",e.OPEN="OPEN",e.PING="PING",e.POLL_PENDING_QUERY="POLL_PENDING_QUERY",e.REGISTER_FILE_BUFFER="REGISTER_FILE_BUFFER",e.REGISTER_FILE_HANDLE="REGISTER_FILE_HANDLE",e.REGISTER_FILE_URL="REGISTER_FILE_URL",e.RESET="RESET",e.RUN_PREPARED="RUN_PREPARED",e.RUN_QUERY="RUN_QUERY",e.SEND_PREPARED="SEND_PREPARED",e.START_PENDING_QUERY="START_PENDING_QUERY",e.TOKENIZE="TOKENIZE",e))(wc||{}),Ic=(e=>(e.CONNECTION_INFO="CONNECTION_INFO",e.ERROR="ERROR",e.FEATURE_FLAGS="FEATURE_FLAGS",e.FILE_BUFFER="FILE_BUFFER",e.FILE_INFOS="FILE_INFOS",e.FILE_SIZE="FILE_SIZE",e.FILE_STATISTICS="FILE_STATISTICS",e.INSTANTIATE_PROGRESS="INSTANTIATE_PROGRESS",e.LOG="LOG",e.PROGRESS_UPDATE="PROGRESS_UPDATE",e.OK="OK",e.PREPARED_STATEMENT_ID="PREPARED_STATEMENT_ID",e.QUERY_PLAN="QUERY_PLAN",e.QUERY_RESULT="QUERY_RESULT",e.QUERY_RESULT_CHUNK="QUERY_RESULT_CHUNK",e.QUERY_RESULT_HEADER="QUERY_RESULT_HEADER",e.QUERY_RESULT_HEADER_OR_NULL="QUERY_RESULT_HEADER_OR_NULL",e.REGISTERED_FILE="REGISTERED_FILE",e.SCRIPT_TOKENS="SCRIPT_TOKENS",e.SUCCESS="SUCCESS",e.TABLE_NAMES="TABLE_NAMES",e.VERSION_STRING="VERSION_STRING",e))(Ic||{}),K=class{constructor(e,t){this.promiseResolver=()=>{},this.promiseRejecter=()=>{},this.type=e,this.data=t,this.promise=new Promise((n,r)=>{this.promiseResolver=n,this.promiseRejecter=r})}};function bi(e){switch(e.typeId){case f.Binary:return{sqlType:"binary"};case f.Bool:return{sqlType:"bool"};case f.Date:return{sqlType:"date"};case f.DateDay:return{sqlType:"date32[d]"};case f.DateMillisecond:return{sqlType:"date64[ms]"};case f.Decimal:{let t=e;return{sqlType:"decimal",precision:t.precision,scale:t.scale}}case f.Float:return{sqlType:"float"};case f.Float16:return{sqlType:"float16"};case f.Float32:return{sqlType:"float32"};case f.Float64:return{sqlType:"float64"};case f.Int:return{sqlType:"int32"};case f.Int16:return{sqlType:"int16"};case f.Int32:return{sqlType:"int32"};case f.Int64:return{sqlType:"int64"};case f.Uint16:return{sqlType:"uint16"};case f.Uint32:return{sqlType:"uint32"};case f.Uint64:return{sqlType:"uint64"};case f.Uint8:return{sqlType:"uint8"};case f.IntervalDayTime:return{sqlType:"interval[dt]"};case f.IntervalYearMonth:return{sqlType:"interval[m]"};case f.List:return{sqlType:"list",valueType:bi(e.valueType)};case f.FixedSizeBinary:return{sqlType:"fixedsizebinary",byteWidth:e.byteWidth};case f.Null:return{sqlType:"null"};case f.Utf8:return{sqlType:"utf8"};case f.Struct:return{sqlType:"struct",fields:e.children.map(t=>Os(t.name,t.type))};case f.Map:{let t=e;return{sqlType:"map",keyType:bi(t.keyType),valueType:bi(t.valueType)}}case f.Time:return{sqlType:"time[s]"};case f.TimeMicrosecond:return{sqlType:"time[us]"};case f.TimeMillisecond:return{sqlType:"time[ms]"};case f.TimeNanosecond:return{sqlType:"time[ns]"};case f.TimeSecond:return{sqlType:"time[s]"};case f.Timestamp:return{sqlType:"timestamp",timezone:e.timezone||void 0};case f.TimestampSecond:return{sqlType:"timestamp[s]",timezone:e.timezone||void 0};case f.TimestampMicrosecond:return{sqlType:"timestamp[us]",timezone:e.timezone||void 0};case f.TimestampNanosecond:return{sqlType:"timestamp[ns]",timezone:e.timezone||void 0};case f.TimestampMillisecond:return{sqlType:"timestamp[ms]",timezone:e.timezone||void 0}}throw new Error("unsupported arrow type: ".concat(e.toString()))}function Os(e,t){let n=bi(t);return n.name=e,n}var tb=new TextEncoder,eb=class{constructor(e,t=null){this._onInstantiationProgress=[],this._onExecutionProgress=[],this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{},this._nextMessageId=0,this._pendingRequests=new Map,this._logger=e,this._onMessageHandler=this.onMessage.bind(this),this._onErrorHandler=this.onError.bind(this),this._onCloseHandler=this.onClose.bind(this),t!=null&&this.attach(t)}get logger(){return this._logger}attach(e){this._worker=e,this._worker.addEventListener("message",this._onMessageHandler),this._worker.addEventListener("error",this._onErrorHandler),this._worker.addEventListener("close",this._onCloseHandler),this._workerShutdownPromise=new Promise((t,n)=>{this._workerShutdownResolver=t})}detach(){this._worker&&(this._worker.removeEventListener("message",this._onMessageHandler),this._worker.removeEventListener("error",this._onErrorHandler),this._worker.removeEventListener("close",this._onCloseHandler),this._worker=null,this._workerShutdownResolver(null),this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async terminate(){this._worker&&(this._worker.terminate(),this._worker=null,this._workerShutdownPromise=null,this._workerShutdownResolver=()=>{})}async postTask(e,t=[]){if(!this._worker){console.error("cannot send a message since the worker is not set!");return}let n=this._nextMessageId++;return this._pendingRequests.set(n,e),this._worker.postMessage({messageId:n,type:e.type,data:e.data},t),await e.promise}onMessage(e){var t;let n=e.data;switch(n.type){case"PROGRESS_UPDATE":{for(let i of this._onExecutionProgress)i(n.data);return}case"LOG":{this._logger.log(n.data);return}case"INSTANTIATE_PROGRESS":{for(let i of this._onInstantiationProgress)i(n.data);return}}let r=this._pendingRequests.get(n.requestId);if(!r){console.warn("unassociated response: [".concat(n.requestId,", ").concat(n.type.toString(),"]"));return}if(this._pendingRequests.delete(n.requestId),n.type=="ERROR"){let i=new Error(n.data.message);i.name=n.data.name,(t=Object.getOwnPropertyDescriptor(i,"stack"))!=null&&t.writable&&(i.stack=n.data.stack),r.promiseRejecter(i);return}switch(r.type){case"CLOSE_PREPARED":case"COLLECT_FILE_STATISTICS":case"REGISTER_OPFS_FILE_NAME":case"COPY_FILE_TO_PATH":case"DISCONNECT":case"DROP_FILE":case"DROP_FILES":case"FLUSH_FILES":case"INSERT_ARROW_FROM_IPC_STREAM":case"IMPORT_CSV_FROM_PATH":case"IMPORT_JSON_FROM_PATH":case"OPEN":case"PING":case"REGISTER_FILE_BUFFER":case"REGISTER_FILE_HANDLE":case"REGISTER_FILE_URL":case"RESET":if(n.type=="OK"){r.promiseResolver(n.data);return}break;case"INSTANTIATE":if(this._onInstantiationProgress=[],n.type=="OK"){r.promiseResolver(n.data);return}break;case"GLOB_FILE_INFOS":if(n.type=="FILE_INFOS"){r.promiseResolver(n.data);return}break;case"GET_VERSION":if(n.type=="VERSION_STRING"){r.promiseResolver(n.data);return}break;case"GET_FEATURE_FLAGS":if(n.type=="FEATURE_FLAGS"){r.promiseResolver(n.data);return}break;case"GET_TABLE_NAMES":if(n.type=="TABLE_NAMES"){r.promiseResolver(n.data);return}break;case"TOKENIZE":if(n.type=="SCRIPT_TOKENS"){r.promiseResolver(n.data);return}break;case"COPY_FILE_TO_BUFFER":if(n.type=="FILE_BUFFER"){r.promiseResolver(n.data);return}break;case"EXPORT_FILE_STATISTICS":if(n.type=="FILE_STATISTICS"){r.promiseResolver(n.data);return}break;case"CONNECT":if(n.type=="CONNECTION_INFO"){r.promiseResolver(n.data);return}break;case"RUN_PREPARED":case"RUN_QUERY":if(n.type=="QUERY_RESULT"){r.promiseResolver(n.data);return}break;case"SEND_PREPARED":if(n.type=="QUERY_RESULT_HEADER"){r.promiseResolver(n.data);return}break;case"START_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){r.promiseResolver(n.data);return}break;case"POLL_PENDING_QUERY":if(n.type=="QUERY_RESULT_HEADER_OR_NULL"){r.promiseResolver(n.data);return}break;case"CANCEL_PENDING_QUERY":if(this._onInstantiationProgress=[],n.type=="SUCCESS"){r.promiseResolver(n.data);return}break;case"FETCH_QUERY_RESULTS":if(n.type=="QUERY_RESULT_CHUNK"){r.promiseResolver(n.data);return}break;case"CREATE_PREPARED":if(n.type=="PREPARED_STATEMENT_ID"){r.promiseResolver(n.data);return}break}r.promiseRejecter(new Error("unexpected response type: ".concat(n.type.toString())))}onError(e){console.error(e),console.error("error in duckdb worker: ".concat(e.message)),this._pendingRequests.clear()}onClose(){if(this._workerShutdownResolver(null),this._pendingRequests.size!=0){console.warn("worker terminated with ".concat(this._pendingRequests.size," pending requests"));return}this._pendingRequests.clear()}async reset(){let e=new K("RESET",null);return await this.postTask(e)}async ping(){let e=new K("PING",null);await this.postTask(e)}async dropFile(e){let t=new K("DROP_FILE",e);return await this.postTask(t)}async dropFiles(){let e=new K("DROP_FILES",null);return await this.postTask(e)}async flushFiles(){let e=new K("FLUSH_FILES",null);return await this.postTask(e)}async instantiate(e,t=null,n=r=>{}){this._onInstantiationProgress.push(n);let r=new K("INSTANTIATE",[e,t]);return await this.postTask(r)}async getVersion(){let e=new K("GET_VERSION",null);return await this.postTask(e)}async getFeatureFlags(){let e=new K("GET_FEATURE_FLAGS",null);return await this.postTask(e)}async open(e){let t=new K("OPEN",e);await this.postTask(t)}async tokenize(e){let t=new K("TOKENIZE",e);return await this.postTask(t)}async connectInternal(){let e=new K("CONNECT",null);return await this.postTask(e)}async connect(){let e=await this.connectInternal();return new _c(this,e)}async disconnect(e){let t=new K("DISCONNECT",e);await this.postTask(t)}async runQuery(e,t){let n=new K("RUN_QUERY",[e,t]);return await this.postTask(n)}async startPendingQuery(e,t,n=!1){let r=new K("START_PENDING_QUERY",[e,t,n]);return await this.postTask(r)}async pollPendingQuery(e){let t=new K("POLL_PENDING_QUERY",e);return await this.postTask(t)}async cancelPendingQuery(e){let t=new K("CANCEL_PENDING_QUERY",e);return await this.postTask(t)}async fetchQueryResults(e){let t=new K("FETCH_QUERY_RESULTS",e);return await this.postTask(t)}async getTableNames(e,t){let n=new K("GET_TABLE_NAMES",[e,t]);return await this.postTask(n)}async createPrepared(e,t){let n=new K("CREATE_PREPARED",[e,t]);return await this.postTask(n)}async closePrepared(e,t){let n=new K("CLOSE_PREPARED",[e,t]);await this.postTask(n)}async runPrepared(e,t,n){let r=new K("RUN_PREPARED",[e,t,n]);return await this.postTask(r)}async sendPrepared(e,t,n){let r=new K("SEND_PREPARED",[e,t,n]);return await this.postTask(r)}async globFiles(e){let t=new K("GLOB_FILE_INFOS",e);return await this.postTask(t)}async registerFileText(e,t){let n=tb.encode(t);await this.registerFileBuffer(e,n)}async registerFileURL(e,t,n,r){t===void 0&&(t=e);let i=new K("REGISTER_FILE_URL",[e,t,n,r]);await this.postTask(i)}async registerEmptyFileBuffer(e){}async registerFileBuffer(e,t){let n=new K("REGISTER_FILE_BUFFER",[e,t]);await this.postTask(n,[t.buffer])}async registerFileHandle(e,t,n,r){let i=new K("REGISTER_FILE_HANDLE",[e,t,n,r]);await this.postTask(i,[])}async registerOPFSFileName(e){let t=new K("REGISTER_OPFS_FILE_NAME",[e]);await this.postTask(t,[])}async collectFileStatistics(e,t){let n=new K("COLLECT_FILE_STATISTICS",[e,t]);await this.postTask(n,[])}async exportFileStatistics(e){let t=new K("EXPORT_FILE_STATISTICS",e);return await this.postTask(t,[])}async copyFileToBuffer(e){let t=new K("COPY_FILE_TO_BUFFER",e);return await this.postTask(t)}async copyFileToPath(e,t){let n=new K("COPY_FILE_TO_PATH",[e,t]);await this.postTask(n)}async insertArrowFromIPCStream(e,t,n){if(t.length==0)return;let r=new K("INSERT_ARROW_FROM_IPC_STREAM",[e,t,n]);await this.postTask(r,[t.buffer])}async insertCSVFromPath(e,t,n){if(n.columns!==void 0){let i=[];for(let s in n.columns){let a=n.columns[s];i.push(Os(s,a))}n.columnsFlat=i,delete n.columns}let r=new K("IMPORT_CSV_FROM_PATH",[e,t,n]);await this.postTask(r)}async insertJSONFromPath(e,t,n){if(n.columns!==void 0){let i=[];for(let s in n.columns){let a=n.columns[s];i.push(Os(s,a))}n.columnsFlat=i,delete n.columns}let r=new K("IMPORT_JSON_FROM_PATH",[e,t,n]);await this.postTask(r)}};function nb(){let e=new TextDecoder;return t=>(typeof SharedArrayBuffer<"u"&&t.buffer instanceof SharedArrayBuffer&&(t=new Uint8Array(t)),e.decode(t))}nb();var Sc=(e=>(e[e.BUFFER=0]="BUFFER",e[e.NODE_FS=1]="NODE_FS",e[e.BROWSER_FILEREADER=2]="BROWSER_FILEREADER",e[e.BROWSER_FSACCESS=3]="BROWSER_FSACCESS",e[e.HTTP=4]="HTTP",e[e.S3=5]="S3",e))(Sc||{}),rb=class{constructor(){this._bindings=null,this._nextMessageId=0}log(e){this.postMessage({messageId:this._nextMessageId++,requestId:0,type:"LOG",data:e},[])}sendOK(e){this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"OK",data:null},[])}failWith(e,t){let n={name:t.name,message:t.message,stack:t.stack||void 0};this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"ERROR",data:n},[])}async onMessage(e){switch(e.type){case"PING":this.sendOK(e);return;case"INSTANTIATE":this._bindings!=null&&this.failWith(e,new Error("duckdb already initialized"));try{this._bindings=await this.instantiate(e.data[0],e.data[1],t=>{this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"INSTANTIATE_PROGRESS",data:t},[])}),this.sendOK(e)}catch(t){console.log(t),this._bindings=null,this.failWith(e,t)}return}if(!this._bindings)return this.failWith(e,new Error("duckdb is not initialized"));try{switch(e.type){case"GET_VERSION":this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"VERSION_STRING",data:this._bindings.getVersion()},[]);break;case"GET_FEATURE_FLAGS":this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FEATURE_FLAGS",data:this._bindings.getFeatureFlags()},[]);break;case"RESET":this._bindings.reset(),this.sendOK(e);break;case"OPEN":{let t=e.data.path;t!=null&&t.startsWith("opfs://")&&(await this._bindings.prepareDBFileHandle(t,3),e.data.useDirectIO=!0),this._bindings.open(e.data),this.sendOK(e);break}case"DROP_FILE":this._bindings.dropFile(e.data),this.sendOK(e);break;case"DROP_FILES":this._bindings.dropFiles(),this.sendOK(e);break;case"FLUSH_FILES":this._bindings.flushFiles(),this.sendOK(e);break;case"CONNECT":{let t=this._bindings.connect();this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"CONNECTION_INFO",data:t.useUnsafe((n,r)=>r)},[]);break}case"DISCONNECT":this._bindings.disconnect(e.data),this.sendOK(e);break;case"CREATE_PREPARED":{let t=this._bindings.createPrepared(e.data[0],e.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"PREPARED_STATEMENT_ID",data:t},[]);break}case"CLOSE_PREPARED":{this._bindings.closePrepared(e.data[0],e.data[1]),this.sendOK(e);break}case"RUN_PREPARED":{let t=this._bindings.runPrepared(e.data[0],e.data[1],e.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT",data:t},[t.buffer]);break}case"RUN_QUERY":{let t=this._bindings.runQuery(e.data[0],e.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT",data:t},[t.buffer]);break}case"SEND_PREPARED":{let t=this._bindings.sendPrepared(e.data[0],e.data[1],e.data[2]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_HEADER",data:t},[t.buffer]);break}case"START_PENDING_QUERY":{let t=this._bindings.startPendingQuery(e.data[0],e.data[1],e.data[2]),n=[];t&&n.push(t.buffer),this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_HEADER_OR_NULL",data:t},n);break}case"POLL_PENDING_QUERY":{let t=this._bindings.pollPendingQuery(e.data),n=[];t&&n.push(t.buffer),this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_HEADER_OR_NULL",data:t},n);break}case"CANCEL_PENDING_QUERY":{let t=this._bindings.cancelPendingQuery(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"SUCCESS",data:t},[]);break}case"FETCH_QUERY_RESULTS":{let t=this._bindings.fetchQueryResults(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"QUERY_RESULT_CHUNK",data:t},[t.buffer]);break}case"GET_TABLE_NAMES":{let t=this._bindings.getTableNames(e.data[0],e.data[1]);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"TABLE_NAMES",data:t},[]);break}case"GLOB_FILE_INFOS":{let t=this._bindings.globFiles(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FILE_INFOS",data:t},[]);break}case"REGISTER_FILE_URL":this._bindings.registerFileURL(e.data[0],e.data[1],e.data[2],e.data[3]),this.sendOK(e);break;case"REGISTER_FILE_BUFFER":this._bindings.registerFileBuffer(e.data[0],e.data[1]),this.sendOK(e);break;case"REGISTER_FILE_HANDLE":await this._bindings.registerFileHandleAsync(e.data[0],e.data[1],e.data[2],e.data[3]),this.sendOK(e);break;case"COPY_FILE_TO_PATH":this._bindings.copyFileToPath(e.data[0],e.data[1]),this.sendOK(e);break;case"COPY_FILE_TO_BUFFER":{let t=this._bindings.copyFileToBuffer(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FILE_BUFFER",data:t},[]);break}case"COLLECT_FILE_STATISTICS":this._bindings.collectFileStatistics(e.data[0],e.data[1]),this.sendOK(e);break;case"REGISTER_OPFS_FILE_NAME":this._bindings.registerOPFSFileName(e.data[0]),this.sendOK(e);break;case"EXPORT_FILE_STATISTICS":{this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"FILE_STATISTICS",data:this._bindings.exportFileStatistics(e.data)},[]);break}case"INSERT_ARROW_FROM_IPC_STREAM":{this._bindings.insertArrowFromIPCStream(e.data[0],e.data[1],e.data[2]),this.sendOK(e);break}case"IMPORT_CSV_FROM_PATH":{this._bindings.insertCSVFromPath(e.data[0],e.data[1],e.data[2]),this.sendOK(e);break}case"IMPORT_JSON_FROM_PATH":{this._bindings.insertJSONFromPath(e.data[0],e.data[1],e.data[2]),this.sendOK(e);break}case"TOKENIZE":{let t=this._bindings.tokenize(e.data);this.postMessage({messageId:this._nextMessageId++,requestId:e.messageId,type:"SCRIPT_TOKENS",data:t},[]);break}}}catch(t){return console.log(t),this.failWith(e,t)}}},ib=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),sb=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),ab=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),ob=()=>(async e=>{try{return typeof MessageChannel<"u"&&new MessageChannel().port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch{return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),Ds={name:"@duckdb/duckdb-wasm",version:"1.29.1-dev132.0"},Ec=Ds.name,Tc=Ds.version,Fs=Ds.version.split("."),lb=Fs[0],cb=Fs[1],ub=Fs[2],Ms=()=>typeof navigator>"u",Ac=()=>Ms()?"node":navigator.userAgent,hb=()=>Ac().includes("Firefox"),db=()=>/^((?!chrome|android).)*safari/i.test(Ac());function fb(){let e="https://cdn.jsdelivr.net/npm/".concat(Ec,"@").concat(Tc,"/dist/");return{mvp:{mainModule:"".concat(e,"duckdb-mvp.wasm"),mainWorker:"".concat(e,"duckdb-browser-mvp.worker.js")},eh:{mainModule:"".concat(e,"duckdb-eh.wasm"),mainWorker:"".concat(e,"duckdb-browser-eh.worker.js")}}}var Ls=null,xs=null,Us=null,Cs=null,ks=null;async function Nc(){return Ls==null&&(Ls=typeof BigInt64Array<"u"),xs==null&&(xs=await sb()),Us==null&&(Us=await ob()),Cs==null&&(Cs=await ab()),ks==null&&(ks=await ib()),{bigInt64Array:Ls,crossOriginIsolated:Ms()||globalThis.crossOriginIsolated||!1,wasmExceptions:xs,wasmSIMD:Cs,wasmThreads:Us,wasmBulkMemory:ks}}async function pb(e){let t=await Nc();if(t.wasmExceptions){if(t.wasmSIMD&&t.wasmThreads&&t.crossOriginIsolated&&e.coi)return{mainModule:e.coi.mainModule,mainWorker:e.coi.mainWorker,pthreadWorker:e.coi.pthreadWorker};if(e.eh)return{mainModule:e.eh.mainModule,mainWorker:e.eh.mainWorker,pthreadWorker:null}}return{mainModule:e.mvp.mainModule,mainWorker:e.mvp.mainWorker,pthreadWorker:null}}var yb=qm(Gm());async function mb(e){let t=new Request(e),n=await fetch(t),r=URL.createObjectURL(await n.blob());return new yb.default(r)}const bb=Object.freeze(Object.defineProperty({__proto__:null,AsyncDuckDB:eb,AsyncDuckDBConnection:_c,AsyncDuckDBDispatcher:rb,AsyncPreparedStatement:vc,AsyncResultStreamIterator:Rs,ConsoleLogger:Km,DuckDBAccessMode:dc,DuckDBDataProtocol:Sc,LogEvent:mc,LogLevel:pc,LogOrigin:bc,LogTopic:yc,PACKAGE_NAME:Ec,PACKAGE_VERSION:Tc,PACKAGE_VERSION_MAJOR:lb,PACKAGE_VERSION_MINOR:cb,PACKAGE_VERSION_PATCH:ub,StatusCode:gc,TokenType:fc,VoidLogger:Hm,WorkerRequestType:wc,WorkerResponseType:Ic,WorkerTask:K,createWorker:mb,getJsDelivrBundles:fb,getLogEventLabel:Xm,getLogLevelLabel:Qm,getLogOriginLabel:Zm,getLogTopicLabel:Jm,getPlatformFeatures:Nc,isFirefox:hb,isNode:Ms,isSafari:db,selectBundle:pb},Symbol.toStringTag,{value:"Module"}));async function gb(){var r,i,s,a;const e="@aws-amplify/auth";let t;try{t=await import(e)}catch{return{token:null,provider:"none"}}const{fetchAuthSession:n}=t;return{token:((a=(s=(i=(r=await n())==null?void 0:r.tokens)==null?void 0:i.idToken)==null?void 0:s.toString)==null?void 0:a.call(s))??null,provider:"amplify"}}const Bc=Object.freeze(Object.defineProperty({__proto__:null,useGetToken:gb},Symbol.toStringTag,{value:"Module"}));te.DataExplorer=lp,te.UMAP=up,Object.defineProperty(te,Symbol.toStringTag,{value:"Module"})});
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.data-explorer-wrap[data-v-
|
|
1
|
+
.data-explorer-wrap[data-v-2908b590]{overflow:auto;margin:0 10px}.data-explorer-wrap .data-explorer-info[data-v-2908b590]{line-height:20px;position:absolute;right:0;margin-right:30px}[data-v-2908b590] .dashboard-header h1{display:none}.umap-wrap[data-v-c778c86e]{margin:0 10px}.umap-wrap .umap-info[data-v-c778c86e]{line-height:20px;position:absolute;right:0;margin-right:6px}.dashboard-container[data-v-6d7b972b]{display:flex;flex-direction:column;margin:0 auto;padding:20px}.dashboard-header[data-v-6d7b972b]{display:flex;justify-content:space-between;align-items:center;margin-bottom:30px;padding-bottom:15px;border-bottom:2px solid #e0e0e0}.dashboard-header h1[data-v-6d7b972b]{margin:0;color:#333}.status-indicator[data-v-6d7b972b]{padding:8px 16px;border-radius:20px;font-weight:500;color:#fff;background-color:#666}.status-indicator.loading[data-v-6d7b972b]{background-color:#ff9800}.status-indicator.connected[data-v-6d7b972b]{background-color:#14a758}.dashboard-content[data-v-6d7b972b]{display:grid;gap:25px}.config-panel[data-v-6d7b972b],.query-panel[data-v-6d7b972b],.results-panel[data-v-6d7b972b],.error-panel[data-v-6d7b972b]{background:#fff;width:inherit;border:1px solid #ddd;padding:20px;overflow:scroll}.config-panel h3[data-v-6d7b972b],.query-panel h3[data-v-6d7b972b],.results-panel h3[data-v-6d7b972b],.error-panel h3[data-v-6d7b972b]{margin-top:0;color:#333;border-bottom:1px solid #eee;padding-bottom:10px}.query-info[data-v-6d7b972b]{background:#e8f4fd;border:1px solid #bee5eb;border-radius:6px;padding:12px;margin-bottom:15px}.query-info .info-text[data-v-6d7b972b]{color:#0c5460;font-size:14px;font-weight:500}.pagination-wrapper[data-v-6d7b972b]{display:flex;flex-direction:row;justify-content:end}.query-info .info-text code[data-v-6d7b972b]{background:#d1ecf1;color:#0c5460;padding:2px 6px;border-radius:3px;font-family:Courier New,monospace;font-weight:600}.form-group[data-v-6d7b972b]{margin-bottom:15px}.form-group label[data-v-6d7b972b]{display:block;margin-bottom:5px;font-weight:500;color:#555}.url-input[data-v-6d7b972b],.table-input[data-v-6d7b972b],.query-textarea[data-v-6d7b972b],.display-mode[data-v-6d7b972b]{width:calc(100% - 16px);padding:10px;border:1px solid #ddd;border-radius:4px;font-size:14px;margin:8px 0}.query-textarea[data-v-6d7b972b]{font-family:Courier New,monospace;resize:vertical;min-height:100px}.url-input[data-v-6d7b972b]:focus,.table-input[data-v-6d7b972b]:focus,.query-textarea[data-v-6d7b972b]:focus{outline:none;border-color:#2196f3}.load-btn[data-v-6d7b972b],.execute-btn[data-v-6d7b972b],.example-btn[data-v-6d7b972b],.export-btn[data-v-6d7b972b],.clear-error-btn[data-v-6d7b972b],.page-btn[data-v-6d7b972b]{background:#2196f3;color:#fff;border:none;padding:10px 20px;border-radius:4px;cursor:pointer;font-size:14px;transition:background-color .2s}.load-btn[data-v-6d7b972b]:hover,.execute-btn[data-v-6d7b972b]:hover,.export-btn[data-v-6d7b972b]:hover,.clear-error-btn[data-v-6d7b972b]:hover,.page-btn[data-v-6d7b972b]:hover{background:#1976d2}.load-btn[data-v-6d7b972b]:disabled,.execute-btn[data-v-6d7b972b]:disabled,.page-btn[data-v-6d7b972b]:disabled{background:#ccc;cursor:not-allowed}.query-examples[data-v-6d7b972b]{margin-bottom:15px;display:flex;gap:10px;flex-wrap:wrap;align-items:center}.query-examples span[data-v-6d7b972b]{font-weight:500;color:#666}.example-btn[data-v-6d7b972b]{background:#f5f5f5;color:#333;padding:6px 12px;font-size:12px}.example-btn[data-v-6d7b972b]:hover{background:#e0e0e0}.results-controls[data-v-6d7b972b]{display:flex;justify-content:space-between;align-items:center;margin-bottom:15px}.left-controls[data-v-6d7b972b]{display:flex;align-items:center}.right-controls[data-v-6d7b972b]{display:flex;align-items:center;gap:15px}.results-pagination[data-v-6d7b972b]{margin-right:20px}.table-container[data-v-6d7b972b]{overflow-x:auto}.results-table[data-v-6d7b972b]{width:100%;border-collapse:collapse;font-size:13px}.results-table th[data-v-6d7b972b],.results-table td[data-v-6d7b972b]{border:1px solid #ddd;padding:8px;text-align:left}.results-table th[data-v-6d7b972b]{background:#f8f9fa;font-weight:600;position:sticky;top:0}.results-table tbody tr[data-v-6d7b972b]:hover{background:#f5f5f5}.bottom-pagination[data-v-6d7b972b]{display:flex;justify-content:center;align-items:center;padding:20px 0;margin-top:20px;border-top:1px solid #e9ecef}.page-info[data-v-6d7b972b]{font-weight:500;color:#666}.json-container[data-v-6d7b972b]{background:#f8f9fa;border:1px solid #e9ecef;border-radius:4px;padding:15px;max-height:400px;overflow:auto}.json-container pre[data-v-6d7b972b]{margin:0;font-size:12px;white-space:pre-wrap}.error-panel[data-v-6d7b972b]{border-color:#f44336;background:#ffebee}.error-panel h3[data-v-6d7b972b]{color:#d32f2f}.error-panel p[data-v-6d7b972b]{color:#c62828;margin:10px 0}.clear-error-btn[data-v-6d7b972b]{background:#f44336}.clear-error-btn[data-v-6d7b972b]:hover{background:#d32f2f}.app-container[data-v-d6dbc8b5]{color:#000}.scatterplot-container[data-v-2c0af95e]{width:100%;height:100%;min-width:800px;position:relative;background:#f0f0f0}canvas[data-v-2c0af95e]{display:block;cursor:crosshair;width:100%;height:100%}#tooltip[data-v-2c0af95e]{position:absolute;background:#000c;color:#fff;padding:8px 12px;border-radius:4px;font-size:14px;pointer-events:none;opacity:0;transition:opacity .2s;z-index:200;white-space:nowrap}#debug[data-v-2c0af95e]{position:absolute;bottom:20px;right:20px;background:#fffc;padding:10px;border-radius:5px;font-family:monospace}.control-panel[data-v-91c1f44e]{position:absolute;top:20px;left:20px;background:#ffffffd9;padding:15px;border-radius:5px;box-shadow:0 2px 10px #0003;z-index:100;max-width:320px}.color-option[data-v-91c1f44e]{margin-bottom:15px}.legend-item[data-v-91c1f44e]{display:flex;align-items:center;gap:10px;margin:4px 0}.legend-color[data-v-91c1f44e]{width:18px;height:18px;border-radius:3px}.legend-label[data-v-91c1f44e]{font-size:14px}.app-container[data-v-244cd07d]{height:90vh;position:relative}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "precision-dashwidgets",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"main": "./dist/precision-dashwidgets.umd.js",
|
|
6
6
|
"module": "./dist/precision-dashwidgets.es.js",
|
|
7
7
|
"style": "dist/style.css",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"preview": "vite preview"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"pennsieve-visualization": "^0.
|
|
27
|
+
"pennsieve-visualization": "^0.3.0",
|
|
28
28
|
"vue": "^3.5.18"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"vite": "^5.4.11",
|
|
32
31
|
"@vitejs/plugin-vue": "^5.1.4",
|
|
33
32
|
"typescript": "^5.4.0",
|
|
33
|
+
"vite": "^5.4.11",
|
|
34
34
|
"vue-tsc": "^2"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|