@loaders.gl/arrow 4.4.0-alpha.12 → 4.4.0-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/arrow-worker.js
CHANGED
|
@@ -12826,7 +12826,7 @@ return true;`);
|
|
|
12826
12826
|
}
|
|
12827
12827
|
|
|
12828
12828
|
// src/exports/arrow-loader.ts
|
|
12829
|
-
var VERSION = true ? "4.4.0-alpha.
|
|
12829
|
+
var VERSION = true ? "4.4.0-alpha.13" : "latest";
|
|
12830
12830
|
var ArrowWorkerLoader = {
|
|
12831
12831
|
dataType: null,
|
|
12832
12832
|
batchType: null,
|
package/dist/arrow-writer.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { encodeArrowSync } from "./lib/encoders/encode-arrow.js";
|
|
3
3
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
4
4
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
5
|
-
const VERSION = typeof "4.4.0-alpha.
|
|
5
|
+
const VERSION = typeof "4.4.0-alpha.13" !== 'undefined' ? "4.4.0-alpha.13" : 'latest';
|
|
6
6
|
/** Apache Arrow writer */
|
|
7
7
|
export const ArrowWriter = {
|
|
8
8
|
name: 'Apache Arrow',
|
package/dist/dist.min.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['loaders'] = factory();
|
|
6
6
|
else root['loaders'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var ku=Object.create;var Wn=Object.defineProperty;var Pu=Object.getOwnPropertyDescriptor;var Vu=Object.getOwnPropertyNames;var ju=Object.getPrototypeOf,zu=Object.prototype.hasOwnProperty;var Wu=(r,t,e)=>t in r?Wn(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var Gu=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),br=(r,t)=>{for(var e in t)Wn(r,e,{get:t[e],enumerable:!0})},Vi=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Vu(t))!zu.call(r,i)&&i!==e&&Wn(r,i,{get:()=>t[i],enumerable:!(n=Pu(t,i))||n.enumerable});return r},ji=(r,t,e)=>(Vi(r,t,"default"),e&&Vi(e,t,"default")),$u=(r,t,e)=>(e=r!=null?ku(ju(r)):{},Vi(t||!r||!r.__esModule?Wn(e,"default",{value:r,enumerable:!0}):e,r)),Yu=r=>Vi(Wn({},"__esModule",{value:!0}),r);var $a=(r,t,e)=>(Wu(r,typeof t!="symbol"?t+"":t,e),e);var Ha=Gu((Bp,Ya)=>{Ya.exports=globalThis.loaders});var Pi={};br(Pi,{ArrowFormat:()=>Ja,ArrowLoader:()=>uu,ArrowWorkerLoader:()=>cn,ArrowWriter:()=>fu,GeoArrowLoader:()=>Uu,GeoArrowWorkerLoader:()=>ps,TriangulationWorker:()=>bs,VECTOR_TYPES:()=>Fr,hardClone:()=>ki,parseGeoArrowOnWorker:()=>Ru,triangulateOnWorker:()=>Eu});ji(Pi,$u(Ha(),1));var Fr;(function(r){r[r.FLOAT=0]="FLOAT",r[r.DATE=1]="DATE"})(Fr||(Fr={}));var Ja={name:"Apache Arrow",id:"arrow",module:"arrow",category:"table",extensions:["arrow","feather"],mimeTypes:["application/vnd.apache.arrow.file","application/vnd.apache.arrow.stream","application/octet-stream"],binary:!0,tests:["ARROW"]};var Hu="4.4.0-alpha.12",cn={dataType:null,batchType:null,name:"Apache Arrow",id:"arrow",module:"arrow",version:Hu,category:"table",extensions:["arrow","feather"],mimeTypes:["application/vnd.apache.arrow.file","application/vnd.apache.arrow.stream","application/octet-stream"],binary:!0,tests:["ARROW"],options:{arrow:{shape:"columnar-table"}}};function Za(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e}function m(r,t,e,n){function i(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function a(f){try{l(n.next(f))}catch(d){s(d)}}function c(f){try{l(n.throw(f))}catch(d){s(d)}}function l(f){f.done?o(f.value):i(f.value).then(a,c)}l((n=n.apply(r,t||[])).next())})}function Ka(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function L(r){return this instanceof L?(this.v=r,this):new L(r)}function qt(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(N){return function(st){return Promise.resolve(st).then(N,d)}}function a(N,st){n[N]&&(i[N]=function(yr){return new Promise(function(ws,gr){o.push([N,yr,ws,gr])>1||c(N,yr)})},st&&(i[N]=st(i[N])))}function c(N,st){try{l(n[N](st))}catch(yr){V(o[0][3],yr)}}function l(N){N.value instanceof L?Promise.resolve(N.value.v).then(f,d):V(o[0][2],N)}function f(N){c("next",N)}function d(N){c("throw",N)}function V(N,st){N(st),o.shift(),o.length&&c(o[0][0],o[0][1])}}function ln(r){var t,e;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,o){t[i]=r[i]?function(s){return(e=!e)?{value:L(r[i](s)),done:!1}:o?o(s):s}:o}}function he(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof Ka=="function"?Ka(r):r[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(o){e[o]=r[o]&&function(s){return new Promise(function(a,c){s=r[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var Bs={};br(Bs,{compareArrayLike:()=>xs,joinUint8Arrays:()=>te,memcpy:()=>Yn,rebaseValueOffsets:()=>Ki,toArrayBufferView:()=>E,toArrayBufferViewAsyncIterator:()=>me,toArrayBufferViewIterator:()=>Ae,toBigInt64Array:()=>Ji,toBigUint64Array:()=>rf,toFloat32Array:()=>nf,toFloat32ArrayAsyncIterator:()=>_f,toFloat32ArrayIterator:()=>df,toFloat64Array:()=>of,toFloat64ArrayAsyncIterator:()=>vf,toFloat64ArrayIterator:()=>hf,toInt16Array:()=>Qu,toInt16ArrayAsyncIterator:()=>yf,toInt16ArrayIterator:()=>cf,toInt32Array:()=>Mr,toInt32ArrayAsyncIterator:()=>gf,toInt32ArrayIterator:()=>lf,toInt8Array:()=>qu,toInt8ArrayAsyncIterator:()=>mf,toInt8ArrayIterator:()=>af,toUint16Array:()=>tf,toUint16ArrayAsyncIterator:()=>bf,toUint16ArrayIterator:()=>uf,toUint32Array:()=>ef,toUint32ArrayAsyncIterator:()=>wf,toUint32ArrayIterator:()=>ff,toUint8Array:()=>B,toUint8ArrayAsyncIterator:()=>Ss,toUint8ArrayIterator:()=>Is,toUint8ClampedArray:()=>sf,toUint8ClampedArrayAsyncIterator:()=>If,toUint8ClampedArrayIterator:()=>pf});var Ju=new TextDecoder("utf-8"),Gn=r=>Ju.decode(r),Ku=new TextEncoder,Be=r=>Ku.encode(r);var Zu=r=>typeof r=="number",Xa=r=>typeof r=="boolean",dt=r=>typeof r=="function",Ot=r=>r!=null&&Object(r)===r,Qt=r=>Ot(r)&&dt(r.then);var pe=r=>Ot(r)&&dt(r[Symbol.iterator]),oe=r=>Ot(r)&&dt(r[Symbol.asyncIterator]),zi=r=>Ot(r)&&Ot(r.schema);var Wi=r=>Ot(r)&&"done"in r&&"value"in r;var Gi=r=>Ot(r)&&dt(r.stat)&&Zu(r.fd);var $i=r=>Ot(r)&&$n(r.body),Yi=r=>"_getDOMStream"in r&&"_getNodeStream"in r,qa=r=>Ot(r)&&dt(r.abort)&&dt(r.getWriter)&&!Yi(r),$n=r=>Ot(r)&&dt(r.cancel)&&dt(r.getReader)&&!Yi(r),Qa=r=>Ot(r)&&dt(r.end)&&dt(r.write)&&Xa(r.writable)&&!Yi(r),Hi=r=>Ot(r)&&dt(r.read)&&dt(r.pipe)&&Xa(r.readable)&&!Yi(r),tc=r=>Ot(r)&&dt(r.clear)&&dt(r.bytes)&&dt(r.position)&&dt(r.setPosition)&&dt(r.capacity)&&dt(r.getBufferIdentifier)&&dt(r.createLong);var vs=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Xu(r){let t=r[0]?[r[0]]:[],e,n,i,o;for(let s,a,c=0,l=0,f=r.length;++c<f;){if(s=t[l],a=r[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:e,byteLength:i}=s,{byteOffset:n,byteLength:o}=a,e+i<n||n+o<e){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,e,n-e+o)}return t}function Yn(r,t,e=0,n=t.byteLength){let i=r.byteLength,o=new Uint8Array(r.buffer,r.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return o.set(s,e),r}function te(r,t){let e=Xu(r),n=e.reduce((f,d)=>f+d.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let f=e.length;++c<f;){if(i=e[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?e[c]=i.subarray(o.length):o.length===i.length&&c++,s?Yn(s,o,a):s=o;break}Yn(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),e.slice(c),n-(s?s.byteLength:0)]}function E(r,t){let e=Wi(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=Be(e)),e instanceof ArrayBuffer?new r(e):e instanceof vs?new r(e):tc(e)?E(r,e.bytes()):ArrayBuffer.isView(e)?e.byteLength<=0?new r(0):new r(e.buffer,e.byteOffset,e.byteLength/r.BYTES_PER_ELEMENT):r.from(e)):new r(0)}var qu=r=>E(Int8Array,r),Qu=r=>E(Int16Array,r),Mr=r=>E(Int32Array,r),Ji=r=>E(BigInt64Array,r),B=r=>E(Uint8Array,r),tf=r=>E(Uint16Array,r),ef=r=>E(Uint32Array,r),rf=r=>E(BigUint64Array,r),nf=r=>E(Float32Array,r),of=r=>E(Float64Array,r),sf=r=>E(Uint8ClampedArray,r),_s=r=>(r.next(),r);function*Ae(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof vs?e(t):pe(t)?t:e(t);return yield*_s(function*(i){let o=null;do o=i.next(yield E(r,o));while(!o.done)}(n[Symbol.iterator]())),new r}var af=r=>Ae(Int8Array,r),cf=r=>Ae(Int16Array,r),lf=r=>Ae(Int32Array,r),Is=r=>Ae(Uint8Array,r),uf=r=>Ae(Uint16Array,r),ff=r=>Ae(Uint32Array,r),df=r=>Ae(Float32Array,r),hf=r=>Ae(Float64Array,r),pf=r=>Ae(Uint8ClampedArray,r);function me(r,t){return qt(this,arguments,function*(){if(Qt(t))return yield L(yield L(yield*ln(he(me(r,yield L(t))))));let n=function(s){return qt(this,arguments,function*(){yield yield L(yield L(s))})},i=function(s){return qt(this,arguments,function*(){yield L(yield*ln(he(_s(function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)}(s[Symbol.iterator]())))))})},o=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof vs?n(t):pe(t)?i(t):oe(t)?t:n(t);return yield L(yield*ln(he(_s(function(s){return qt(this,arguments,function*(){let a=null;do a=yield L(s.next(yield yield L(E(r,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield L(new r)})}var mf=r=>me(Int8Array,r),yf=r=>me(Int16Array,r),gf=r=>me(Int32Array,r),Ss=r=>me(Uint8Array,r),bf=r=>me(Uint16Array,r),wf=r=>me(Uint32Array,r),_f=r=>me(Float32Array,r),vf=r=>me(Float64Array,r),If=r=>me(Uint8ClampedArray,r);function Ki(r,t,e){if(r!==0){e=e.slice(0,t);for(let n=-1,i=e.length;++n<i;)e[n]+=r}return e.subarray(0,t)}function xs(r,t){let e=0,n=r.length;if(n!==t.length)return!1;if(n>0)do if(r[e]!==t[e])return!1;while(++e<n);return!0}var bt={fromIterable(r){return Zi(Sf(r))},fromAsyncIterable(r){return Zi(xf(r))},fromDOMStream(r){return Zi(Bf(r))},fromNodeStream(r){return Zi(Af(r))},toDOMStream(r,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(r,t){throw new Error('"toNodeStream" not available in this environment')}},Zi=r=>(r.next(),r);function*Sf(r){let t,e=!1,n=[],i,o,s,a=0;function c(){return o==="peek"?te(n,s)[0]:([i,n,a]=te(n,s),i)}({cmd:o,size:s}=(yield(()=>null)())||{cmd:"read",size:0});let l=Is(r)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(f){(e=!0)&&typeof l.throw=="function"&&l.throw(f)}finally{e===!1&&typeof l.return=="function"&&l.return(null)}return null}function xf(r){return qt(this,arguments,function*(){let e,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?te(i,a)[0]:([o,i,c]=te(i,a),o)}({cmd:s,size:a}=(yield yield L((()=>null)()))||{cmd:"read",size:0});let f=Ss(r)[Symbol.asyncIterator]();try{do if({done:e,value:o}=Number.isNaN(a-c)?yield L(f.next()):yield L(f.next(a-c)),!e&&o.byteLength>0&&(i.push(o),c+=o.byteLength),e||a<=c)do({cmd:s,size:a}=yield yield L(l()));while(a<c);while(!e)}catch(d){(n=!0)&&typeof f.throw=="function"&&(yield L(f.throw(d)))}finally{n===!1&&typeof f.return=="function"&&(yield L(f.return(new Uint8Array(0))))}return yield L(null)})}function Bf(r){return qt(this,arguments,function*(){let e=!1,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?te(i,a)[0]:([o,i,c]=te(i,a),o)}({cmd:s,size:a}=(yield yield L((()=>null)()))||{cmd:"read",size:0});let f=new Ts(r);try{do if({done:e,value:o}=Number.isNaN(a-c)?yield L(f.read()):yield L(f.read(a-c)),!e&&o.byteLength>0&&(i.push(B(o)),c+=o.byteLength),e||a<=c)do({cmd:s,size:a}=yield yield L(l()));while(a<c);while(!e)}catch(d){(n=!0)&&(yield L(f.cancel(d)))}finally{n===!1?yield L(f.cancel()):r.locked&&f.releaseLock()}return yield L(null)})}var Ts=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return m(this,void 0,void 0,function*(){let{reader:e,source:n}=this;e&&(yield e.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return m(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let e=yield this.reader.read();return!e.done&&(e.value=B(e)),e})}},As=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function Af(r){return qt(this,arguments,function*(){let e=[],n="error",i=!1,o=null,s,a,c=0,l=[],f;function d(){return s==="peek"?te(l,a)[0]:([f,l,c]=te(l,a),f)}if({cmd:s,size:a}=(yield yield L((()=>null)()))||{cmd:"read",size:0},r.isTTY)return yield yield L(new Uint8Array(0)),yield L(null);try{e[0]=As(r,"end"),e[1]=As(r,"error");do{if(e[2]=As(r,"readable"),[n,o]=yield L(Promise.race(e.map(N=>N[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(f=B(r.read(a-c)),f.byteLength<a-c&&(f=B(r.read()))):f=B(r.read()),f.byteLength>0&&(l.push(f),c+=f.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield L(d()));while(a<c)}while(!i)}finally{yield L(V(e,n==="error"?o:null))}return yield L(null);function V(N,st){return f=l=null,new Promise((yr,ws)=>{for(let[gr,Cu]of N)r.off(gr,Cu);try{let gr=r.destroy;gr&&gr.call(r,st),st=void 0}catch(gr){st=gr||st}finally{st!=null?ws(st):yr()}})}})}var z;(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(z||(z={}));var Y;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(Y||(Y={}));var P;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(P||(P={}));var J;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(J||(J={}));var h;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(h||(h={}));var Q;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Q||(Q={}));var Te=new Int32Array(2),Xi=new Float32Array(Te.buffer),qi=new Float64Array(Te.buffer),un=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Hn;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(Hn||(Hn={}));var Ft=class{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new Ft(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 Te[0]=this.readInt32(t),Xi[0]}readFloat64(t){return Te[un?0:1]=this.readInt32(t),Te[un?1:0]=this.readInt32(t+4),qi[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}writeUint64(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}writeFloat32(t,e){Xi[0]=e,this.writeInt32(t,Te[0])}writeFloat64(t,e){qi[0]=e,this.writeInt32(t,Te[un?0:1]),this.writeInt32(t+4,Te[un?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t}__offset(t,e){let n=t-this.readInt32(t);return e<this.readInt16(n)?this.readInt16(n+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);let n=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+n);return e===Hn.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0}createScalarList(t,e){let n=[];for(let i=0;i<e;++i){let o=t(i);o!==null&&n.push(o)}return n}createObjList(t,e){let n=[];for(let i=0;i<e;++i){let o=t(i);o!==null&&n.push(o.unpack())}return n}};var tr=class{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let e;t?e=t:e=1024,this.bb=Ft.allocate(e),this.space=e}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);let n=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<n+t+e;){let i=this.bb.capacity();this.bb=tr.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(n)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,n){(this.force_defaults||e!=n)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,n){(this.force_defaults||e!=n)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,n){(this.force_defaults||e!=n)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,n){(this.force_defaults||e!==n)&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,n){(this.force_defaults||e!=n)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,n){e!=n&&(this.nested(e),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=e<<1,i=Ft.allocate(n);return i.setPosition(n-e),i.bytes().set(t.bytes(),n-e),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);let n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);let i=2;this.addInt16(t-this.object_start);let o=(n+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(e=0;e<this.vtables.length;e++){let c=this.bb.capacity()-this.vtables[e];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[e];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,n){let i=n?4:0;if(e){let o=e;if(this.prep(this.minalign,4+4+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=4-1;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(e<this.bb.readInt16(i)&&this.bb.readInt16(i+e)!=0))throw new TypeError("FlatBuffers: field "+e+" must be set")}startVector(t,e,n){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(n,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(t==null)return 0;let e;return t instanceof Uint8Array?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let e=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)e.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var Jn;(function(r){r[r.BUFFER=0]="BUFFER"})(Jn||(Jn={}));var Kn;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(Kn||(Kn={}));var ge=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBodyCompression(t,e){return(e||new ge).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new ge).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Kn.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Jn.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,Kn.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,Jn.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return ge.startBodyCompression(t),ge.addCodec(t,e),ge.addMethod(t,n),ge.endBodyCompression(t)}};var fn=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,e,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(e??0)),t.offset()}};var dn=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,e,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(e??0)),t.offset()}};var It=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsRecordBatch(t,e){return(e||new It).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new It).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new dn).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new fn).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let e=this.bb.__offset(this.bb_pos,10);return e?(t||new ge).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addNodes(t,e){t.addFieldOffset(1,e,0)}static startNodesVector(t,e){t.startVector(16,e,8)}static addBuffers(t,e){t.addFieldOffset(2,e,0)}static startBuffersVector(t,e){t.startVector(16,e,8)}static addCompression(t,e){t.addFieldOffset(3,e,0)}static endRecordBatch(t){return t.endObject()}};var ae=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryBatch(t,e){return(e||new ae).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new ae).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new It).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addData(t,e){t.addFieldOffset(1,e,0)}static addIsDelta(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryBatch(t){return t.endObject()}};var wr;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(wr||(wr={}));var Zn;(function(r){r[r.DenseArray=0]="DenseArray"})(Zn||(Zn={}));var ht=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInt(t,e){return(e||new ht).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new ht).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,e){t.addFieldInt32(0,e,0)}static addIsSigned(t,e){t.addFieldInt8(1,+e,0)}static endInt(t){return t.endObject()}static createInt(t,e,n){return ht.startInt(t),ht.addBitWidth(t,e),ht.addIsSigned(t,n),ht.endInt(t)}};var ee=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryEncoding(t,e){return(e||new ee).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new ee).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new ht).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):Zn.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addIndexType(t,e){t.addFieldOffset(1,e,0)}static addIsOrdered(t,e){t.addFieldInt8(2,+e,0)}static addDictionaryKind(t,e){t.addFieldInt16(3,e,Zn.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var K=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKeyValue(t,e){return(e||new K).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new K).__init(t.readInt32(t.position())+t.position(),t)}key(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,n){return K.startKeyValue(t),K.addKey(t,e),K.addValue(t,n),K.endKeyValue(t)}};var De=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBinary(t,e){return(e||new De).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new De).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return De.startBinary(t),De.endBinary(t)}};var Oe=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBool(t,e){return(e||new Oe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new Oe).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return Oe.startBool(t),Oe.endBool(t)}};var kt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDate(t,e){return(e||new kt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new kt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):J.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,J.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return kt.startDate(t),kt.addUnit(t,e),kt.endDate(t)}};var pt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDecimal(t,e){return(e||new pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new pt).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static addBitWidth(t,e){t.addFieldInt32(2,e,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,e,n,i){return pt.startDecimal(t),pt.addPrecision(t,e),pt.addScale(t,n),pt.addBitWidth(t,i),pt.endDecimal(t)}};var Pt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDuration(t,e){return(e||new Pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+4),(e||new Pt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):h.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,h.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return Pt.startDuration(t),Pt.addUnit(t,e),Pt.endDuration(t)}};var Vt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeBinary(t,e){return(e||new Vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new Vt).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return Vt.startFixedSizeBinary(t),Vt.addByteWidth(t,e),Vt.endFixedSizeBinary(t)}};var jt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeList(t,e){return(e||new jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new jt).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return jt.startFixedSizeList(t),jt.addListSize(t,e),jt.endFixedSizeList(t)}};var zt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFloatingPoint(t,e){return(e||new zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new zt).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):P.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,P.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return zt.startFloatingPoint(t),zt.addPrecision(t,e),zt.endFloatingPoint(t)}};var Wt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInterval(t,e){return(e||new Wt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new Wt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Q.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Q.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return Wt.startInterval(t),Wt.addUnit(t,e),Wt.endInterval(t)}};var Fe=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeBinary(t,e){return(e||new Fe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+4),(e||new Fe).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return Fe.startLargeBinary(t),Fe.endLargeBinary(t)}};var Me=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeUtf8(t,e){return(e||new Me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+4),(e||new Me).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return Me.startLargeUtf8(t),Me.endLargeUtf8(t)}};var Le=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsList(t,e){return(e||new Le).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new Le).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return Le.startList(t),Le.endList(t)}};var Gt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMap(t,e){return(e||new Gt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new Gt).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return Gt.startMap(t),Gt.addKeysSorted(t,e),Gt.endMap(t)}};var Ne=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNull(t,e){return(e||new Ne).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new Ne).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return Ne.startNull(t),Ne.endNull(t)}};var Ue=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsStruct_(t,e){return(e||new Ue).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new Ue).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return Ue.startStruct_(t),Ue.endStruct_(t)}};var St=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTime(t,e){return(e||new St).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new St).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):h.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,h.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return St.startTime(t),St.addUnit(t,e),St.addBitWidth(t,n),St.endTime(t)}};var xt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTimestamp(t,e){return(e||new xt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new xt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):h.SECOND}timezone(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,h.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return xt.startTimestamp(t),xt.addUnit(t,e),xt.addTimezone(t,n),xt.endTimestamp(t)}};var mt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUnion(t,e){return(e||new mt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new mt).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Y.Sparse}typeIds(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,Y.Sparse)}static addTypeIds(t,e){t.addFieldOffset(1,e,0)}static createTypeIdsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addInt32(e[n]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,n){return mt.startUnion(t),mt.addMode(t,e),mt.addTypeIds(t,n),mt.endUnion(t)}};var Ee=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new Ee).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new Ee).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return Ee.startUtf8(t),Ee.endUtf8(t)}};var H;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.RunEndEncoded=22]="RunEndEncoded"})(H||(H={}));var at=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new at).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new at).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):H.NONE}type(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){let e=this.bb.__offset(this.bb_pos,12);return e?(t||new ee).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){let n=this.bb.__offset(this.bb_pos,14);return n?(e||new at).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,16);return n?(e||new K).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,H.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}};var tt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new tt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new tt).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):wr.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new at).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new K).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,wr.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,n,i,o){return tt.startSchema(t),tt.addEndianness(t,e),tt.addFields(t,n),tt.addCustomMetadata(t,i),tt.addFeatures(t,o),tt.endSchema(t)}};var R;(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(R||(R={}));var u;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth",r[r.DurationSecond=-27]="DurationSecond",r[r.DurationMillisecond=-28]="DurationMillisecond",r[r.DurationMicrosecond=-29]="DurationMicrosecond",r[r.DurationNanosecond=-30]="DurationNanosecond"})(u||(u={}));var rt;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(rt||(rt={}));var Hs={};br(Hs,{clampRange:()=>Qn,createElementComparator:()=>xr,wrapIndex:()=>Gr});var Ds={};br(Ds,{valueToString:()=>be});function be(r){if(r===null)return"null";if(r===void 0)return"undefined";switch(typeof r){case"number":return`${r}`;case"bigint":return`${r}`;case"string":return`"${r}"`}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?`[${[...r].map(t=>be(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}var Ls={};br(Ls,{BN:()=>Lr,bigNumToBigInt:()=>rc,bigNumToNumber:()=>Ms,bigNumToString:()=>mn,isArrowBigNumSymbol:()=>ec});function C(r){if(typeof r=="bigint"&&(r<Number.MIN_SAFE_INTEGER||r>Number.MAX_SAFE_INTEGER))throw new TypeError(`${r} is not safe to convert to a number.`);return Number(r)}function Os(r,t){return C(r/t)+C(r%t)/C(t)}var ec=Symbol.for("isArrowBigNum");function we(r,...t){return t.length===0?Object.setPrototypeOf(E(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}we.prototype[ec]=!0;we.prototype.toJSON=function(){return`"${mn(this)}"`};we.prototype.valueOf=function(r){return Ms(this,r)};we.prototype.toString=function(){return mn(this)};we.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Ms(this);case"string":return mn(this);case"default":return rc(this)}return mn(this)};function hn(...r){return we.apply(this,r)}function pn(...r){return we.apply(this,r)}function Xn(...r){return we.apply(this,r)}Object.setPrototypeOf(hn.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(pn.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Xn.prototype,Object.create(Uint32Array.prototype));Object.assign(hn.prototype,we.prototype,{constructor:hn,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(pn.prototype,we.prototype,{constructor:pn,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Xn.prototype,we.prototype,{constructor:Xn,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var Tf=BigInt(4294967296)*BigInt(4294967296),Df=Tf-BigInt(1);function Ms(r,t){let{buffer:e,byteOffset:n,byteLength:i,signed:o}=r,s=new BigUint64Array(e,n,i/8),a=o&&s.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(a){for(let f of s)c|=(f^Df)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let f of s)c|=f*(BigInt(1)<<BigInt(64*l++));if(typeof t=="number"){let f=BigInt(Math.pow(10,t)),d=c/f,V=c%f;return C(d)+C(V)/C(f)}return C(c)}function mn(r){if(r.byteLength===8)return`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`;if(!r.signed)return Fs(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Fs(r);t=t.slice();let n=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+n;t[o]=a,n&=s===0?1:0}return`-${Fs(t)}`}function rc(r){return r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:mn(r)}function Fs(r){let t="",e=new Uint32Array(2),n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),o=-1,s=n.length-1;do{for(e[0]=n[o=0];o<s;)n[o++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+n[o];n[o]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t=`${e[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var Lr=class{static new(t,e){switch(e){case!0:return new hn(t);case!1:return new pn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new hn(t)}return t.byteLength===16?new Xn(t):new pn(t)}static signed(t){return new hn(t)}static unsigned(t){return new pn(t)}static decimal(t){return new Xn(t)}constructor(t,e){return Lr.new(t,e)}};var nc,ic,oc,sc,ac,cc,lc,uc,fc,dc,hc,pc,mc,yc,gc,bc,wc,_c,vc,Ic,Sc,xc,p=class{static isNull(t){return t?.typeId===u.Null}static isInt(t){return t?.typeId===u.Int}static isFloat(t){return t?.typeId===u.Float}static isBinary(t){return t?.typeId===u.Binary}static isLargeBinary(t){return t?.typeId===u.LargeBinary}static isUtf8(t){return t?.typeId===u.Utf8}static isLargeUtf8(t){return t?.typeId===u.LargeUtf8}static isBool(t){return t?.typeId===u.Bool}static isDecimal(t){return t?.typeId===u.Decimal}static isDate(t){return t?.typeId===u.Date}static isTime(t){return t?.typeId===u.Time}static isTimestamp(t){return t?.typeId===u.Timestamp}static isInterval(t){return t?.typeId===u.Interval}static isDuration(t){return t?.typeId===u.Duration}static isList(t){return t?.typeId===u.List}static isStruct(t){return t?.typeId===u.Struct}static isUnion(t){return t?.typeId===u.Union}static isFixedSizeBinary(t){return t?.typeId===u.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===u.FixedSizeList}static isMap(t){return t?.typeId===u.Map}static isDictionary(t){return t?.typeId===u.Dictionary}static isDenseUnion(t){return p.isUnion(t)&&t.mode===Y.Dense}static isSparseUnion(t){return p.isUnion(t)&&t.mode===Y.Sparse}constructor(t){this.typeId=t}};nc=Symbol.toStringTag;p[nc]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(p.prototype);var nt=class extends p{constructor(){super(u.Null)}toString(){return"Null"}};ic=Symbol.toStringTag;nt[ic]=(r=>r[Symbol.toStringTag]="Null")(nt.prototype);var et=class extends p{constructor(t,e){super(u.Int),this.isSigned=t,this.bitWidth=e}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};oc=Symbol.toStringTag;et[oc]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(et.prototype);var Re=class extends et{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Ce=class extends et{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},yt=class extends et{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},ce=class extends et{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},ke=class extends et{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Pe=class extends et{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Ve=class extends et{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},je=class extends et{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Re.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Ce.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(yt.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(ce.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(ke.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Pe.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Ve.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(je.prototype,"ArrayType",{value:BigUint64Array});var Mt=class extends p{constructor(t){super(u.Float),this.precision=t}get ArrayType(){switch(this.precision){case P.HALF:return Uint16Array;case P.SINGLE:return Float32Array;case P.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};sc=Symbol.toStringTag;Mt[sc]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(Mt.prototype);var _r=class extends Mt{constructor(){super(P.HALF)}},ze=class extends Mt{constructor(){super(P.SINGLE)}},le=class extends Mt{constructor(){super(P.DOUBLE)}};Object.defineProperty(_r.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ze.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(le.prototype,"ArrayType",{value:Float64Array});var re=class extends p{constructor(){super(u.Binary)}toString(){return"Binary"}};ac=Symbol.toStringTag;re[ac]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(re.prototype);var We=class extends p{constructor(){super(u.LargeBinary)}toString(){return"LargeBinary"}};cc=Symbol.toStringTag;We[cc]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(We.prototype);var Lt=class extends p{constructor(){super(u.Utf8)}toString(){return"Utf8"}};lc=Symbol.toStringTag;Lt[lc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Lt.prototype);var Ge=class extends p{constructor(){super(u.LargeUtf8)}toString(){return"LargeUtf8"}};uc=Symbol.toStringTag;Ge[uc]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Ge.prototype);var Nt=class extends p{constructor(){super(u.Bool)}toString(){return"Bool"}};fc=Symbol.toStringTag;Nt[fc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(Nt.prototype);var ne=class extends p{constructor(t,e,n=128){super(u.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};dc=Symbol.toStringTag;ne[dc]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(ne.prototype);var $t=class extends p{constructor(t){super(u.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${J[this.unit]}>`}get ArrayType(){return this.unit===J.DAY?Int32Array:BigInt64Array}};hc=Symbol.toStringTag;$t[hc]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))($t.prototype);var Nr=class extends $t{constructor(){super(J.DAY)}},Ur=class extends $t{constructor(){super(J.MILLISECOND)}},Bt=class extends p{constructor(t,e){super(u.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${h[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};pc=Symbol.toStringTag;Bt[pc]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(Bt.prototype);var Er=class extends Bt{constructor(){super(h.SECOND,32)}},Rr=class extends Bt{constructor(){super(h.MILLISECOND,32)}},Cr=class extends Bt{constructor(){super(h.MICROSECOND,64)}},kr=class extends Bt{constructor(){super(h.NANOSECOND,64)}},At=class extends p{constructor(t,e){super(u.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${h[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};mc=Symbol.toStringTag;At[mc]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(At.prototype);var Pr=class extends At{constructor(t){super(h.SECOND,t)}},er=class extends At{constructor(t){super(h.MILLISECOND,t)}},Vr=class extends At{constructor(t){super(h.MICROSECOND,t)}},jr=class extends At{constructor(t){super(h.NANOSECOND,t)}},Yt=class extends p{constructor(t){super(u.Interval),this.unit=t}toString(){return`Interval<${Q[this.unit]}>`}};yc=Symbol.toStringTag;Yt[yc]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Yt.prototype);var zr=class extends Yt{constructor(){super(Q.DAY_TIME)}},Wr=class extends Yt{constructor(){super(Q.YEAR_MONTH)}},$e=class extends p{constructor(t){super(u.Duration),this.unit=t}toString(){return`Duration<${h[this.unit]}>`}};gc=Symbol.toStringTag;$e[gc]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))($e.prototype);var wt=class extends p{constructor(t){super(u.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}};bc=Symbol.toStringTag;wt[bc]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(wt.prototype);var k=class extends p{constructor(t){super(u.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};wc=Symbol.toStringTag;k[wc]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(k.prototype);var ue=class extends p{constructor(t,e,n){super(u.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};_c=Symbol.toStringTag;ue[_c]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(ue.prototype);var Ye=class extends p{constructor(t){super(u.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};vc=Symbol.toStringTag;Ye[vc]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Ye.prototype);var Ut=class extends p{constructor(t,e){super(u.FixedSizeList),this.listSize=t,this.children=[e]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};Ic=Symbol.toStringTag;Ut[Ic]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Ut.prototype);var Et=class extends p{constructor(t,e=!1){var n,i,o;if(super(u.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.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(", ")}}>`}};Sc=Symbol.toStringTag;Et[Sc]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(Et.prototype);var Of=(r=>()=>++r)(-1),Tt=class extends p{constructor(t,e,n,i){super(u.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?Of():C(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};xc=Symbol.toStringTag;Tt[xc]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Tt.prototype);function ie(r){let t=r;switch(r.typeId){case u.Decimal:return r.bitWidth/32;case u.Interval:return 1+t.unit;case u.FixedSizeList:return t.listSize;case u.FixedSizeBinary:return t.byteWidth;default:return 1}}var w=class{visitMany(t,...e){return t.map((n,i)=>this.visit(n,...e.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return Ff(this,t,e)}getVisitFnByTypeId(t,e=!0){return yn(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitLargeUtf8(t,...e){return null}visitBinary(t,...e){return null}visitLargeBinary(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitDuration(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}};function Ff(r,t,e=!0){return typeof t=="number"?yn(r,t,e):typeof t=="string"&&t in u?yn(r,u[t],e):t&&t instanceof p?yn(r,Ac(t),e):t?.type&&t.type instanceof p?yn(r,Ac(t.type),e):yn(r,u.NONE,e)}function yn(r,t,e=!0){let n=null;switch(t){case u.Null:n=r.visitNull;break;case u.Bool:n=r.visitBool;break;case u.Int:n=r.visitInt;break;case u.Int8:n=r.visitInt8||r.visitInt;break;case u.Int16:n=r.visitInt16||r.visitInt;break;case u.Int32:n=r.visitInt32||r.visitInt;break;case u.Int64:n=r.visitInt64||r.visitInt;break;case u.Uint8:n=r.visitUint8||r.visitInt;break;case u.Uint16:n=r.visitUint16||r.visitInt;break;case u.Uint32:n=r.visitUint32||r.visitInt;break;case u.Uint64:n=r.visitUint64||r.visitInt;break;case u.Float:n=r.visitFloat;break;case u.Float16:n=r.visitFloat16||r.visitFloat;break;case u.Float32:n=r.visitFloat32||r.visitFloat;break;case u.Float64:n=r.visitFloat64||r.visitFloat;break;case u.Utf8:n=r.visitUtf8;break;case u.LargeUtf8:n=r.visitLargeUtf8;break;case u.Binary:n=r.visitBinary;break;case u.LargeBinary:n=r.visitLargeBinary;break;case u.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case u.Date:n=r.visitDate;break;case u.DateDay:n=r.visitDateDay||r.visitDate;break;case u.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case u.Timestamp:n=r.visitTimestamp;break;case u.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case u.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case u.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case u.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case u.Time:n=r.visitTime;break;case u.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case u.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case u.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case u.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case u.Decimal:n=r.visitDecimal;break;case u.List:n=r.visitList;break;case u.Struct:n=r.visitStruct;break;case u.Union:n=r.visitUnion;break;case u.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case u.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case u.Dictionary:n=r.visitDictionary;break;case u.Interval:n=r.visitInterval;break;case u.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case u.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case u.Duration:n=r.visitDuration;break;case u.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case u.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case u.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case u.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case u.FixedSizeList:n=r.visitFixedSizeList;break;case u.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${u[t]}'`)}function Ac(r){switch(r.typeId){case u.Null:return u.Null;case u.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?u.Int8:u.Uint8;case 16:return e?u.Int16:u.Uint16;case 32:return e?u.Int32:u.Uint32;case 64:return e?u.Int64:u.Uint64}return u.Int}case u.Float:switch(r.precision){case P.HALF:return u.Float16;case P.SINGLE:return u.Float32;case P.DOUBLE:return u.Float64}return u.Float;case u.Binary:return u.Binary;case u.LargeBinary:return u.LargeBinary;case u.Utf8:return u.Utf8;case u.LargeUtf8:return u.LargeUtf8;case u.Bool:return u.Bool;case u.Decimal:return u.Decimal;case u.Time:switch(r.unit){case h.SECOND:return u.TimeSecond;case h.MILLISECOND:return u.TimeMillisecond;case h.MICROSECOND:return u.TimeMicrosecond;case h.NANOSECOND:return u.TimeNanosecond}return u.Time;case u.Timestamp:switch(r.unit){case h.SECOND:return u.TimestampSecond;case h.MILLISECOND:return u.TimestampMillisecond;case h.MICROSECOND:return u.TimestampMicrosecond;case h.NANOSECOND:return u.TimestampNanosecond}return u.Timestamp;case u.Date:switch(r.unit){case J.DAY:return u.DateDay;case J.MILLISECOND:return u.DateMillisecond}return u.Date;case u.Interval:switch(r.unit){case Q.DAY_TIME:return u.IntervalDayTime;case Q.YEAR_MONTH:return u.IntervalYearMonth}return u.Interval;case u.Duration:switch(r.unit){case h.SECOND:return u.DurationSecond;case h.MILLISECOND:return u.DurationMillisecond;case h.MICROSECOND:return u.DurationMicrosecond;case h.NANOSECOND:return u.DurationNanosecond}return u.Duration;case u.Map:return u.Map;case u.List:return u.List;case u.Struct:return u.Struct;case u.Union:switch(r.mode){case Y.Dense:return u.DenseUnion;case Y.Sparse:return u.SparseUnion}return u.Union;case u.FixedSizeBinary:return u.FixedSizeBinary;case u.FixedSizeList:return u.FixedSizeList;case u.Dictionary:return u.Dictionary}throw new Error(`Unrecognized type '${u[r.typeId]}'`)}w.prototype.visitInt8=null;w.prototype.visitInt16=null;w.prototype.visitInt32=null;w.prototype.visitInt64=null;w.prototype.visitUint8=null;w.prototype.visitUint16=null;w.prototype.visitUint32=null;w.prototype.visitUint64=null;w.prototype.visitFloat16=null;w.prototype.visitFloat32=null;w.prototype.visitFloat64=null;w.prototype.visitDateDay=null;w.prototype.visitDateMillisecond=null;w.prototype.visitTimestampSecond=null;w.prototype.visitTimestampMillisecond=null;w.prototype.visitTimestampMicrosecond=null;w.prototype.visitTimestampNanosecond=null;w.prototype.visitTimeSecond=null;w.prototype.visitTimeMillisecond=null;w.prototype.visitTimeMicrosecond=null;w.prototype.visitTimeNanosecond=null;w.prototype.visitDenseUnion=null;w.prototype.visitSparseUnion=null;w.prototype.visitIntervalDayTime=null;w.prototype.visitIntervalYearMonth=null;w.prototype.visitDuration=null;w.prototype.visitDurationSecond=null;w.prototype.visitDurationMillisecond=null;w.prototype.visitDurationMicrosecond=null;w.prototype.visitDurationNanosecond=null;var Ns={};br(Ns,{float64ToUint16:()=>qn,uint16ToFloat64:()=>to});var Tc=new Float64Array(1),gn=new Uint32Array(Tc.buffer);function to(r){let t=(r&31744)>>10,e=(r&1023)/1024,n=Math.pow(-1,(r&32768)>>15);switch(t){case 31:return n*(e?Number.NaN:1/0);case 0:return n*(e?6103515625e-14*e:0)}return n*Math.pow(2,t-15)*(1+e)}function qn(r){if(r!==r)return 32256;Tc[0]=r;let t=(gn[1]&2147483648)>>16&65535,e=gn[1]&2146435072,n=0;return e>=1089470464?gn[0]>0?e=31744:(e=(e&2080374784)>>16,n=(gn[1]&1048575)>>10):e<=1056964608?(n=1048576+(gn[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(gn[1]&1048575)+512>>10),t|e|n&65535}var x=class extends w{};function D(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var Mf=(r,t,e)=>{r[t]=Math.floor(e/864e5)},Dc=(r,t,e,n)=>{if(e+1<t.length){let i=C(t[e]),o=C(t[e+1]);r.set(n.subarray(0,o-i),i)}},Lf=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},rr=({values:r},t,e)=>{r[t]=e},Us=({values:r},t,e)=>{r[t]=e},Oc=({values:r},t,e)=>{r[t]=qn(e)},Nf=(r,t,e)=>{switch(r.type.precision){case P.HALF:return Oc(r,t,e);case P.SINGLE:case P.DOUBLE:return Us(r,t,e)}},eo=({values:r},t,e)=>{Mf(r,t,e.valueOf())},ro=({values:r},t,e)=>{r[t]=BigInt(e)},Es=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},Fc=({values:r,valueOffsets:t},e,n)=>Dc(r,t,e,n),Mc=({values:r,valueOffsets:t},e,n)=>Dc(r,t,e,Be(n)),Rs=(r,t,e)=>{r.type.unit===J.DAY?eo(r,t,e):ro(r,t,e)},no=({values:r},t,e)=>{r[t]=BigInt(e/1e3)},io=({values:r},t,e)=>{r[t]=BigInt(e)},oo=({values:r},t,e)=>{r[t]=BigInt(e*1e3)},so=({values:r},t,e)=>{r[t]=BigInt(e*1e6)},Cs=(r,t,e)=>{switch(r.type.unit){case h.SECOND:return no(r,t,e);case h.MILLISECOND:return io(r,t,e);case h.MICROSECOND:return oo(r,t,e);case h.NANOSECOND:return so(r,t,e)}},ao=({values:r},t,e)=>{r[t]=e},co=({values:r},t,e)=>{r[t]=e},lo=({values:r},t,e)=>{r[t]=e},uo=({values:r},t,e)=>{r[t]=e},ks=(r,t,e)=>{switch(r.type.unit){case h.SECOND:return ao(r,t,e);case h.MILLISECOND:return co(r,t,e);case h.MICROSECOND:return lo(r,t,e);case h.NANOSECOND:return uo(r,t,e)}},Ps=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},Uf=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,o=_t.getVisitFn(n);if(Array.isArray(e))for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,e[++s]);else for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,e.get(++s))},Ef=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,o=_t.getVisitFn(n),{[t]:s,[t+1]:a}=i,c=e instanceof Map?e.entries():Object.entries(e);for(let l of c)if(o(n,s,l),++s>=a)break},Rf=(r,t)=>(e,n,i,o)=>n&&e(n,r,t[o]),Cf=(r,t)=>(e,n,i,o)=>n&&e(n,r,t.get(o)),kf=(r,t)=>(e,n,i,o)=>n&&e(n,r,t.get(i.name)),Pf=(r,t)=>(e,n,i,o)=>n&&e(n,r,t[i.name]),Vf=(r,t,e)=>{let n=r.type.children.map(o=>_t.getVisitFn(o.type)),i=e instanceof Map?kf(t,e):e instanceof y?Cf(t,e):Array.isArray(e)?Rf(t,e):Pf(t,e);r.type.children.forEach((o,s)=>i(n[s],r.children[s],o,s))},jf=(r,t,e)=>{r.type.mode===Y.Dense?Lc(r,t,e):Nc(r,t,e)},Lc=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];_t.visit(i,r.valueOffsets[t],e)},Nc=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];_t.visit(i,t,e)},zf=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},Vs=(r,t,e)=>{r.type.unit===Q.DAY_TIME?fo(r,t,e):ho(r,t,e)},fo=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},ho=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},po=({values:r},t,e)=>{r[t]=e},mo=({values:r},t,e)=>{r[t]=e},yo=({values:r},t,e)=>{r[t]=e},go=({values:r},t,e)=>{r[t]=e},js=(r,t,e)=>{switch(r.type.unit){case h.SECOND:return po(r,t,e);case h.MILLISECOND:return mo(r,t,e);case h.MICROSECOND:return yo(r,t,e);case h.NANOSECOND:return go(r,t,e)}},Wf=(r,t,e)=>{let{stride:n}=r,i=r.children[0],o=_t.getVisitFn(i);if(Array.isArray(e))for(let s=-1,a=t*n;++s<n;)o(i,a+s,e[s]);else for(let s=-1,a=t*n;++s<n;)o(i,a+s,e.get(s))};x.prototype.visitBool=D(Lf);x.prototype.visitInt=D(rr);x.prototype.visitInt8=D(rr);x.prototype.visitInt16=D(rr);x.prototype.visitInt32=D(rr);x.prototype.visitInt64=D(rr);x.prototype.visitUint8=D(rr);x.prototype.visitUint16=D(rr);x.prototype.visitUint32=D(rr);x.prototype.visitUint64=D(rr);x.prototype.visitFloat=D(Nf);x.prototype.visitFloat16=D(Oc);x.prototype.visitFloat32=D(Us);x.prototype.visitFloat64=D(Us);x.prototype.visitUtf8=D(Mc);x.prototype.visitLargeUtf8=D(Mc);x.prototype.visitBinary=D(Fc);x.prototype.visitLargeBinary=D(Fc);x.prototype.visitFixedSizeBinary=D(Es);x.prototype.visitDate=D(Rs);x.prototype.visitDateDay=D(eo);x.prototype.visitDateMillisecond=D(ro);x.prototype.visitTimestamp=D(Cs);x.prototype.visitTimestampSecond=D(no);x.prototype.visitTimestampMillisecond=D(io);x.prototype.visitTimestampMicrosecond=D(oo);x.prototype.visitTimestampNanosecond=D(so);x.prototype.visitTime=D(ks);x.prototype.visitTimeSecond=D(ao);x.prototype.visitTimeMillisecond=D(co);x.prototype.visitTimeMicrosecond=D(lo);x.prototype.visitTimeNanosecond=D(uo);x.prototype.visitDecimal=D(Ps);x.prototype.visitList=D(Uf);x.prototype.visitStruct=D(Vf);x.prototype.visitUnion=D(jf);x.prototype.visitDenseUnion=D(Lc);x.prototype.visitSparseUnion=D(Nc);x.prototype.visitDictionary=D(zf);x.prototype.visitInterval=D(Vs);x.prototype.visitIntervalDayTime=D(fo);x.prototype.visitIntervalYearMonth=D(ho);x.prototype.visitDuration=D(js);x.prototype.visitDurationSecond=D(po);x.prototype.visitDurationMillisecond=D(mo);x.prototype.visitDurationMicrosecond=D(yo);x.prototype.visitDurationNanosecond=D(go);x.prototype.visitFixedSizeList=D(Wf);x.prototype.visitMap=D(Ef);var _t=new x;var _e=Symbol.for("parent"),bn=Symbol.for("rowIndex"),vr=class{constructor(t,e){return this[_e]=t,this[bn]=e,new Proxy(this,new Ws)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[bn],e=this[_e],n=e.type.children,i={};for(let o=-1,s=n.length;++o<s;)i[n[o].name]=ct.visit(e.children[o],t);return i}toString(){return`{${[...this].map(([t,e])=>`${be(t)}: ${be(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new zs(this[_e],this[bn])}},zs=class{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,ct.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(vr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[_e]:{writable:!0,enumerable:!1,configurable:!1,value:null},[bn]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var Ws=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[_e].type.children.map(e=>e.name)}has(t,e){return t[_e].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[_e].type.children.findIndex(n=>n.name===e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[_e].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=ct.visit(t[_e].children[n],t[bn]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[_e].type.children.findIndex(o=>o.name===e);return i!==-1?(_t.visit(t[_e].children[i],t[bn],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}};var _=class extends w{};function A(r){return(t,e)=>t.getValid(e)?r(t,e):null}var Gf=(r,t)=>864e5*r[t],$f=(r,t)=>null,Uc=(r,t,e)=>{if(e+1>=t.length)return null;let n=C(t[e]),i=C(t[e+1]);return r.subarray(n,i)},Yf=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},Ec=({values:r},t)=>Gf(r,t),Rc=({values:r},t)=>C(r[t]),Ir=({stride:r,values:t},e)=>t[r*e],Hf=({stride:r,values:t},e)=>to(t[r*e]),Cc=({values:r},t)=>r[t],Jf=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),kc=({values:r,valueOffsets:t},e)=>Uc(r,t,e),Pc=({values:r,valueOffsets:t},e)=>{let n=Uc(r,t,e);return n!==null?Gn(n):null},Kf=({values:r},t)=>r[t],Zf=({type:r,values:t},e)=>r.precision!==P.HALF?t[e]:to(t[e]),Xf=(r,t)=>r.type.unit===J.DAY?Ec(r,t):Rc(r,t),Vc=({values:r},t)=>1e3*C(r[t]),jc=({values:r},t)=>C(r[t]),zc=({values:r},t)=>Os(r[t],BigInt(1e3)),Wc=({values:r},t)=>Os(r[t],BigInt(1e6)),qf=(r,t)=>{switch(r.type.unit){case h.SECOND:return Vc(r,t);case h.MILLISECOND:return jc(r,t);case h.MICROSECOND:return zc(r,t);case h.NANOSECOND:return Wc(r,t)}},Gc=({values:r},t)=>r[t],$c=({values:r},t)=>r[t],Yc=({values:r},t)=>r[t],Hc=({values:r},t)=>r[t],Qf=(r,t)=>{switch(r.type.unit){case h.SECOND:return Gc(r,t);case h.MILLISECOND:return $c(r,t);case h.MICROSECOND:return Yc(r,t);case h.NANOSECOND:return Hc(r,t)}},td=({values:r,stride:t},e)=>Lr.decimal(r.subarray(t*e,t*(e+1))),ed=(r,t)=>{let{valueOffsets:e,stride:n,children:i}=r,{[t*n]:o,[t*n+1]:s}=e,c=i[0].slice(o,s-o);return new y([c])},rd=(r,t)=>{let{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:o}=e,s=n[0];return new He(s.slice(i,o-i))},nd=(r,t)=>new vr(r,t),id=(r,t)=>r.type.mode===Y.Dense?Jc(r,t):Kc(r,t),Jc=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return ct.visit(n,r.valueOffsets[t])},Kc=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return ct.visit(n,t)},od=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},sd=(r,t)=>r.type.unit===Q.DAY_TIME?Zc(r,t):Xc(r,t),Zc=({values:r},t)=>r.subarray(2*t,2*(t+1)),Xc=({values:r},t)=>{let e=r[t],n=new Int32Array(2);return n[0]=Math.trunc(e/12),n[1]=Math.trunc(e%12),n},qc=({values:r},t)=>r[t],Qc=({values:r},t)=>r[t],tl=({values:r},t)=>r[t],el=({values:r},t)=>r[t],ad=(r,t)=>{switch(r.type.unit){case h.SECOND:return qc(r,t);case h.MILLISECOND:return Qc(r,t);case h.MICROSECOND:return tl(r,t);case h.NANOSECOND:return el(r,t)}},cd=(r,t)=>{let{stride:e,children:n}=r,o=n[0].slice(t*e,e);return new y([o])};_.prototype.visitNull=A($f);_.prototype.visitBool=A(Yf);_.prototype.visitInt=A(Kf);_.prototype.visitInt8=A(Ir);_.prototype.visitInt16=A(Ir);_.prototype.visitInt32=A(Ir);_.prototype.visitInt64=A(Cc);_.prototype.visitUint8=A(Ir);_.prototype.visitUint16=A(Ir);_.prototype.visitUint32=A(Ir);_.prototype.visitUint64=A(Cc);_.prototype.visitFloat=A(Zf);_.prototype.visitFloat16=A(Hf);_.prototype.visitFloat32=A(Ir);_.prototype.visitFloat64=A(Ir);_.prototype.visitUtf8=A(Pc);_.prototype.visitLargeUtf8=A(Pc);_.prototype.visitBinary=A(kc);_.prototype.visitLargeBinary=A(kc);_.prototype.visitFixedSizeBinary=A(Jf);_.prototype.visitDate=A(Xf);_.prototype.visitDateDay=A(Ec);_.prototype.visitDateMillisecond=A(Rc);_.prototype.visitTimestamp=A(qf);_.prototype.visitTimestampSecond=A(Vc);_.prototype.visitTimestampMillisecond=A(jc);_.prototype.visitTimestampMicrosecond=A(zc);_.prototype.visitTimestampNanosecond=A(Wc);_.prototype.visitTime=A(Qf);_.prototype.visitTimeSecond=A(Gc);_.prototype.visitTimeMillisecond=A($c);_.prototype.visitTimeMicrosecond=A(Yc);_.prototype.visitTimeNanosecond=A(Hc);_.prototype.visitDecimal=A(td);_.prototype.visitList=A(ed);_.prototype.visitStruct=A(nd);_.prototype.visitUnion=A(id);_.prototype.visitDenseUnion=A(Jc);_.prototype.visitSparseUnion=A(Kc);_.prototype.visitDictionary=A(od);_.prototype.visitInterval=A(sd);_.prototype.visitIntervalDayTime=A(Zc);_.prototype.visitIntervalYearMonth=A(Xc);_.prototype.visitDuration=A(ad);_.prototype.visitDurationSecond=A(qc);_.prototype.visitDurationMillisecond=A(Qc);_.prototype.visitDurationMicrosecond=A(tl);_.prototype.visitDurationNanosecond=A(el);_.prototype.visitFixedSizeList=A(cd);_.prototype.visitMap=A(rd);var ct=new _;var Sr=Symbol.for("keys"),_n=Symbol.for("vals"),wn=Symbol.for("kKeysAsStrings"),Gs=Symbol.for("_kKeysAsStrings"),He=class{constructor(t){return this[Sr]=new y([t.children[0]]).memoize(),this[_n]=t.children[1],new Proxy(this,new Ys)}get[wn](){return this[Gs]||(this[Gs]=Array.from(this[Sr].toArray(),String))}[Symbol.iterator](){return new $s(this[Sr],this[_n])}get size(){return this[Sr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Sr],e=this[_n],n={};for(let i=-1,o=t.length;++i<o;)n[t.get(i)]=ct.visit(e,i);return n}toString(){return`{${[...this].map(([t,e])=>`${be(t)}: ${be(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},$s=class{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),ct.visit(this.vals,t)]})}},Ys=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[wn]}has(t,e){return t[wn].includes(e)}getOwnPropertyDescriptor(t,e){if(t[wn].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[wn].indexOf(e);if(n!==-1){let i=ct.visit(Reflect.get(t,_n),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[wn].indexOf(e);return i!==-1?(_t.visit(Reflect.get(t,_n),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(He.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Sr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[_n]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Gs]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var rl;function Qn(r,t,e,n){let{length:i=0}=r,o=typeof t!="number"?0:t,s=typeof e!="number"?i:e;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(rl=o,o=s,s=rl),s>i&&(s=i),n?n(r,o,s):[o,s]}var Gr=(r,t)=>r<0?t+r:r,nl=r=>r!==r;function xr(r){if(typeof r!=="object"||r===null)return nl(r)?nl:e=>e===r;if(r instanceof Date){let e=r.valueOf();return n=>n instanceof Date?n.valueOf()===e:!1}return ArrayBuffer.isView(r)?e=>e?xs(r,e):!1:r instanceof Map?ud(r):Array.isArray(r)?ld(r):r instanceof y?fd(r):dd(r,!0)}function ld(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=xr(r[e]);return bo(t)}function ud(r){let t=-1,e=[];for(let n of r.values())e[++t]=xr(n);return bo(e)}function fd(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=xr(r.get(e));return bo(t)}function dd(r,t=!1){let e=Object.keys(r);if(!t&&e.length===0)return()=>!1;let n=[];for(let i=-1,o=e.length;++i<o;)n[i]=xr(r[e[i]]);return bo(n,e)}function bo(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return hd(r,e);case Map:return il(r,e,e.keys());case He:case vr:case Object:case void 0:return il(r,e,t||Object.keys(e))}return e instanceof y?pd(r,e):!1}}function hd(r,t){let e=r.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!r[n](t[n]))return!1;return!0}function pd(r,t){let e=r.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!r[n](t.get(n)))return!1;return!0}function il(r,t,e){let n=e[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),o=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),s=0,a=r.length,c=o.next(),l=n.next(),f=i.next();for(;s<a&&!l.done&&!f.done&&!c.done&&!(l.value!==f.value||!r[s](c.value));++s,l=n.next(),f=i.next(),c=o.next());return s===a&&l.done&&f.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),o.return&&o.return(),!1)}var Js={};br(Js,{BitIterator:()=>$r,getBit:()=>ol,getBool:()=>_o,packBools:()=>Hr,popcnt_array:()=>sl,popcnt_bit_range:()=>ti,popcnt_uint32:()=>wo,setBool:()=>md,truncateBitmap:()=>Yr});function _o(r,t,e,n){return(e&1<<n)!==0}function ol(r,t,e,n){return(e&1<<n)>>n}function md(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function Yr(r,t,e){let n=e.byteLength+7&-8;if(r>0||e.byteLength<n){let i=new Uint8Array(n);return i.set(r%8===0?e.subarray(r>>3):Hr(new $r(e,r,t,null,_o)).subarray(0,n)),i}return e}function Hr(r){let t=[],e=0,n=0,i=0;for(let s of r)s&&(i|=1<<n),++n===8&&(t[e++]=i,i=n=0);(e===0||n>0)&&(t[e++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}var $r=class{constructor(t,e,n,i,o){this.bytes=t,this.length=n,this.context=i,this.get=o,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function ti(r,t,e){if(e-t<=0)return 0;if(e-t<8){let o=0;for(let s of new $r(r,t,e-t,r,ol))o+=s;return o}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return ti(r,t,i)+ti(r,n,e)+sl(r,i>>3,n-i>>3)}function sl(r,t,e){let n=0,i=Math.trunc(t),o=new DataView(r.buffer,r.byteOffset,r.byteLength),s=e===void 0?r.byteLength:i+e;for(;s-i>=4;)n+=wo(o.getUint32(i)),i+=4;for(;s-i>=2;)n+=wo(o.getUint16(i)),i+=2;for(;s-i>=1;)n+=wo(o.getUint8(i)),i+=1;return n}function wo(r){let t=Math.trunc(r);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var yd=-1,M=class{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return p.isSparseUnion(t)?this.children.some(e=>e.nullable):p.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:e,values:n,nullBitmap:i,typeIds:o}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(p.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,e;return t<=yd&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-ti(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,i,o,s=[],a){this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;o instanceof M?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets):(this.stride=ie(t),o&&((c=o[0])&&(this.valueOffsets=c),(c=o[1])&&(this.values=c),(c=o[2])&&(this.nullBitmap=c),(c=o[3])&&(this.typeIds=c)))}getValid(t){let{type:e}=this;if(p.isUnion(e)){let n=e,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],o=n.mode===Y.Dense?this.valueOffsets[t]:t;return i.getValid(o)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,e){let n,{type:i}=this;if(p.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===Y.Dense?this.valueOffsets[t]:t;n=s.getValid(a),s.setValid(a,e)}else{let{nullBitmap:o}=this,{offset:s,length:a}=this,c=s+t,l=1<<c%8,f=c>>3;(!o||o.byteLength<=f)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0?(o.set(Yr(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o})):Object.assign(this,{nullBitmap:o,_nullCount:0}));let d=o[f];n=(d&l)!==0,o[f]=e?d|l:d&~l}return n!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,n=this.length,i=this._nullCount,o=this,s=this.children){return new M(t,e,n,i,o,s,this.dictionary)}slice(t,e){let{stride:n,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===u.Null)return this.clone(this.type,0,t,0);let{length:e,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);i[e>>3]=(1<<e-(e&-8))-1,n>0&&i.set(Yr(this.offset,e,this.nullBitmap),0);let o=this.buffers;return o[rt.VALIDITY]=i,this.clone(this.type,0,t,n+(t-e),o)}_sliceBuffers(t,e,n,i){let o,{buffers:s}=this;return(o=s[rt.TYPE])&&(s[rt.TYPE]=o.subarray(t,t+e)),(o=s[rt.OFFSET])&&(s[rt.OFFSET]=o.subarray(t,t+e+1))||(o=s[rt.DATA])&&(s[rt.DATA]=i===6?o:o.subarray(n*t,n*(t+e))),s}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};M.prototype.children=Object.freeze([]);var Jr=class extends w{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:n=0,["length"]:i=0}=t;return new M(e,n,i,i)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.data),o=B(t.nullBitmap),s=Mr(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[s,i,o])}visitLargeUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.data),o=B(t.nullBitmap),s=Ji(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[s,i,o])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.data),o=B(t.nullBitmap),s=Mr(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[s,i,o])}visitLargeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.data),o=B(t.nullBitmap),s=Ji(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,o=B(t.nullBitmap),s=Mr(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,o=B(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,o=E(e.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(p.isSparseUnion(e))return new M(e,n,s,a,[void 0,void 0,void 0,o],i);let c=Mr(t.valueOffsets);return new M(e,n,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.indices.ArrayType,t.data),{["dictionary"]:s=new y([new Jr().visit({type:e.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new Jr().visit({type:e.valueType})}=t,o=B(t.nullBitmap),{["length"]:s=i.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new Jr().visit({type:e.childType})}=t,o=B(t.nullBitmap),s=Mr(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[s,void 0,o],[i])}},gd=new Jr;function b(r){return gd.visit(r)}var ei=class{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function al(r){return r.some(t=>t.nullable)}function vo(r){return r.reduce((t,e)=>t+e.nullCount,0)}function Io(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function So(r,t,e,n){let i=[];for(let o=-1,s=r.length;++o<s;){let a=r[o],c=t[o],{length:l}=a;if(c>=n)break;if(e>=c+l)continue;if(c>=e&&c+l<=n){i.push(a);continue}let f=Math.max(0,e-c),d=Math.min(n-c,l);i.push(a.slice(f,d-f))}return i.length===0&&i.push(r[0].slice(0,0)),i}function Ks(r,t,e,n){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return e<t[s]?n(r,i,e-t[i]):null;o=i+Math.trunc((s-i)*.5),e<t[o]?s=o:i=o}while(i<s)}function ri(r,t){return r.getValid(t)}function vn(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return Ks(n,this._offsets,e,t)}}function xo(r){let t;function e(n,i,o){return r(n[i],o,t)}return function(n,i){let o=this.data;t=i;let s=Ks(o,this._offsets,n,e);return t=void 0,s}}function Bo(r){let t;function e(n,i,o){let s=o,a=0,c=0;for(let l=i-1,f=n.length;++l<f;){let d=n[l];if(~(a=r(d,t,s)))return c+a;s=0,c+=d.length}return-1}return function(n,i){t=n;let o=this.data,s=typeof i!="number"?e(o,0,0):Ks(o,this._offsets,i,e);return t=void 0,s}}var v=class extends w{};function bd(r,t){return t===null&&r.length>0?0:-1}function wd(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new $r(e,r.offset+(t||0),r.length,e,_o)){if(!i)return n;++n}return-1}function F(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case u.Union:break;case u.Dictionary:break;default:return wd(r,e)}let n=ct.getVisitFn(r),i=xr(t);for(let o=(e||0)-1,s=r.length;++o<s;)if(i(n(r,o)))return o;return-1}function cl(r,t,e){let n=ct.getVisitFn(r),i=xr(t);for(let o=(e||0)-1,s=r.length;++o<s;)if(i(n(r,o)))return o;return-1}v.prototype.visitNull=bd;v.prototype.visitBool=F;v.prototype.visitInt=F;v.prototype.visitInt8=F;v.prototype.visitInt16=F;v.prototype.visitInt32=F;v.prototype.visitInt64=F;v.prototype.visitUint8=F;v.prototype.visitUint16=F;v.prototype.visitUint32=F;v.prototype.visitUint64=F;v.prototype.visitFloat=F;v.prototype.visitFloat16=F;v.prototype.visitFloat32=F;v.prototype.visitFloat64=F;v.prototype.visitUtf8=F;v.prototype.visitLargeUtf8=F;v.prototype.visitBinary=F;v.prototype.visitLargeBinary=F;v.prototype.visitFixedSizeBinary=F;v.prototype.visitDate=F;v.prototype.visitDateDay=F;v.prototype.visitDateMillisecond=F;v.prototype.visitTimestamp=F;v.prototype.visitTimestampSecond=F;v.prototype.visitTimestampMillisecond=F;v.prototype.visitTimestampMicrosecond=F;v.prototype.visitTimestampNanosecond=F;v.prototype.visitTime=F;v.prototype.visitTimeSecond=F;v.prototype.visitTimeMillisecond=F;v.prototype.visitTimeMicrosecond=F;v.prototype.visitTimeNanosecond=F;v.prototype.visitDecimal=F;v.prototype.visitList=F;v.prototype.visitStruct=F;v.prototype.visitUnion=F;v.prototype.visitDenseUnion=cl;v.prototype.visitSparseUnion=cl;v.prototype.visitDictionary=F;v.prototype.visitInterval=F;v.prototype.visitIntervalDayTime=F;v.prototype.visitIntervalYearMonth=F;v.prototype.visitDuration=F;v.prototype.visitDurationSecond=F;v.prototype.visitDurationMillisecond=F;v.prototype.visitDurationMicrosecond=F;v.prototype.visitDurationNanosecond=F;v.prototype.visitFixedSizeList=F;v.prototype.visitMap=F;var Kr=new v;var I=class extends w{};function T(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(p.isInt(t)&&t.bitWidth!==64||p.isTime(t)&&t.bitWidth!==64||p.isFloat(t)&&t.precision!==P.HALF))return new ei(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new ei(r.data.length,n=>{let o=r.data[n].length,s=r.slice(e,e+o);return e+=o,new Zs(s)})}var Zs=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};I.prototype.visitNull=T;I.prototype.visitBool=T;I.prototype.visitInt=T;I.prototype.visitInt8=T;I.prototype.visitInt16=T;I.prototype.visitInt32=T;I.prototype.visitInt64=T;I.prototype.visitUint8=T;I.prototype.visitUint16=T;I.prototype.visitUint32=T;I.prototype.visitUint64=T;I.prototype.visitFloat=T;I.prototype.visitFloat16=T;I.prototype.visitFloat32=T;I.prototype.visitFloat64=T;I.prototype.visitUtf8=T;I.prototype.visitLargeUtf8=T;I.prototype.visitBinary=T;I.prototype.visitLargeBinary=T;I.prototype.visitFixedSizeBinary=T;I.prototype.visitDate=T;I.prototype.visitDateDay=T;I.prototype.visitDateMillisecond=T;I.prototype.visitTimestamp=T;I.prototype.visitTimestampSecond=T;I.prototype.visitTimestampMillisecond=T;I.prototype.visitTimestampMicrosecond=T;I.prototype.visitTimestampNanosecond=T;I.prototype.visitTime=T;I.prototype.visitTimeSecond=T;I.prototype.visitTimeMillisecond=T;I.prototype.visitTimeMicrosecond=T;I.prototype.visitTimeNanosecond=T;I.prototype.visitDecimal=T;I.prototype.visitList=T;I.prototype.visitStruct=T;I.prototype.visitUnion=T;I.prototype.visitDenseUnion=T;I.prototype.visitSparseUnion=T;I.prototype.visitDictionary=T;I.prototype.visitInterval=T;I.prototype.visitIntervalDayTime=T;I.prototype.visitIntervalYearMonth=T;I.prototype.visitDuration=T;I.prototype.visitDurationSecond=T;I.prototype.visitDurationMillisecond=T;I.prototype.visitDurationMicrosecond=T;I.prototype.visitDurationNanosecond=T;I.prototype.visitFixedSizeList=T;I.prototype.visitMap=T;var In=new I;var ll,ul={},fl={},y=class{constructor(t){var e,n,i;let o=t[0]instanceof y?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof M)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(e=o[0])===null||e===void 0?void 0:e.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=ul[s.typeId],f=o[0];this.isValid=d=>ri(f,d),this.get=d=>a(f,d),this.set=(d,V)=>c(f,d,V),this.indexOf=d=>l(f,d),this._offsets=[0,f.length];break}default:Object.setPrototypeOf(this,fl[s.typeId]),this._offsets=Io(o);break}this.data=o,this.type=s,this.stride=ie(s),this.numChildren=(i=(n=s.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return al(this.data)}get nullCount(){return vo(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${u[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(Gr(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return In.visit(this)}concat(...t){return new y(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new y(Qn(this,t,e,({data:n,_offsets:i},o,s)=>So(n,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:i,ArrayType:o}=this;switch(t.typeId){case u.Int:case u.Float:case u.Decimal:case u.Time:case u.Timestamp:switch(e.length){case 0:return new o;case 1:return e[0].values.subarray(0,n*i);default:return e.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new y(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return p.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(p.isDictionary(this.type)){let t=new Sn(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new y(e)}return new Sn(this)}unmemoize(){if(p.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new y(e)}return this}};ll=Symbol.toStringTag;y[ll]=(r=>{r.type=p.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;let t=Object.keys(u).map(e=>u[e]).filter(e=>typeof e=="number"&&e!==u.NONE);for(let e of t){let n=ct.getVisitFnByTypeId(e),i=_t.getVisitFnByTypeId(e),o=Kr.getVisitFnByTypeId(e);ul[e]={get:n,set:i,indexOf:o},fl[e]=Object.create(r,{isValid:{value:vn(ri)},get:{value:vn(ct.getVisitFnByTypeId(e))},set:{value:xo(_t.getVisitFnByTypeId(e))},indexOf:{value:Bo(Kr.getVisitFnByTypeId(e))}})}return"Vector"})(y.prototype);var Sn=class extends y{constructor(t){super(t.data);let e=this.get,n=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=e.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){n.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new Sn(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new y(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function xn(r){if(r){if(r instanceof M)return new y([r]);if(r instanceof y)return new y(r.data);if(r.type instanceof p)return new y([b(r)]);if(Array.isArray(r))return new y(r.flatMap(t=>_d(t)));if(ArrayBuffer.isView(r)){r instanceof DataView&&(r=new Uint8Array(r.buffer));let t={offset:0,length:r.length,nullCount:-1,data:r};if(r instanceof Int8Array)return new y([b(Object.assign(Object.assign({},t),{type:new Re}))]);if(r instanceof Int16Array)return new y([b(Object.assign(Object.assign({},t),{type:new Ce}))]);if(r instanceof Int32Array)return new y([b(Object.assign(Object.assign({},t),{type:new yt}))]);if(r instanceof BigInt64Array)return new y([b(Object.assign(Object.assign({},t),{type:new ce}))]);if(r instanceof Uint8Array||r instanceof Uint8ClampedArray)return new y([b(Object.assign(Object.assign({},t),{type:new ke}))]);if(r instanceof Uint16Array)return new y([b(Object.assign(Object.assign({},t),{type:new Pe}))]);if(r instanceof Uint32Array)return new y([b(Object.assign(Object.assign({},t),{type:new Ve}))]);if(r instanceof BigUint64Array)return new y([b(Object.assign(Object.assign({},t),{type:new je}))]);if(r instanceof Float32Array)return new y([b(Object.assign(Object.assign({},t),{type:new ze}))]);if(r instanceof Float64Array)return new y([b(Object.assign(Object.assign({},t),{type:new le}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function _d(r){return r instanceof M?[r]:r instanceof y?r.data:xn(r).data}function dl(r){if(!r||r.length<=0)return function(i){return!0};let t="",e=r.filter(n=>n===n);return e.length>0&&(t=`
|
|
7
|
+
"use strict";var __exports__=(()=>{var ku=Object.create;var Wn=Object.defineProperty;var Pu=Object.getOwnPropertyDescriptor;var Vu=Object.getOwnPropertyNames;var ju=Object.getPrototypeOf,zu=Object.prototype.hasOwnProperty;var Wu=(r,t,e)=>t in r?Wn(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var Gu=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),br=(r,t)=>{for(var e in t)Wn(r,e,{get:t[e],enumerable:!0})},Vi=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Vu(t))!zu.call(r,i)&&i!==e&&Wn(r,i,{get:()=>t[i],enumerable:!(n=Pu(t,i))||n.enumerable});return r},ji=(r,t,e)=>(Vi(r,t,"default"),e&&Vi(e,t,"default")),$u=(r,t,e)=>(e=r!=null?ku(ju(r)):{},Vi(t||!r||!r.__esModule?Wn(e,"default",{value:r,enumerable:!0}):e,r)),Yu=r=>Vi(Wn({},"__esModule",{value:!0}),r);var $a=(r,t,e)=>(Wu(r,typeof t!="symbol"?t+"":t,e),e);var Ha=Gu((Bp,Ya)=>{Ya.exports=globalThis.loaders});var Pi={};br(Pi,{ArrowFormat:()=>Ja,ArrowLoader:()=>uu,ArrowWorkerLoader:()=>cn,ArrowWriter:()=>fu,GeoArrowLoader:()=>Uu,GeoArrowWorkerLoader:()=>ps,TriangulationWorker:()=>bs,VECTOR_TYPES:()=>Fr,hardClone:()=>ki,parseGeoArrowOnWorker:()=>Ru,triangulateOnWorker:()=>Eu});ji(Pi,$u(Ha(),1));var Fr;(function(r){r[r.FLOAT=0]="FLOAT",r[r.DATE=1]="DATE"})(Fr||(Fr={}));var Ja={name:"Apache Arrow",id:"arrow",module:"arrow",category:"table",extensions:["arrow","feather"],mimeTypes:["application/vnd.apache.arrow.file","application/vnd.apache.arrow.stream","application/octet-stream"],binary:!0,tests:["ARROW"]};var Hu="4.4.0-alpha.13",cn={dataType:null,batchType:null,name:"Apache Arrow",id:"arrow",module:"arrow",version:Hu,category:"table",extensions:["arrow","feather"],mimeTypes:["application/vnd.apache.arrow.file","application/vnd.apache.arrow.stream","application/octet-stream"],binary:!0,tests:["ARROW"],options:{arrow:{shape:"columnar-table"}}};function Za(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(e[n[i]]=r[n[i]]);return e}function m(r,t,e,n){function i(o){return o instanceof e?o:new e(function(s){s(o)})}return new(e||(e=Promise))(function(o,s){function a(f){try{l(n.next(f))}catch(d){s(d)}}function c(f){try{l(n.throw(f))}catch(d){s(d)}}function l(f){f.done?o(f.value):i(f.value).then(a,c)}l((n=n.apply(r,t||[])).next())})}function Ka(r){var t=typeof Symbol=="function"&&Symbol.iterator,e=t&&r[t],n=0;if(e)return e.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function L(r){return this instanceof L?(this.v=r,this):new L(r)}function qt(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(N){return function(st){return Promise.resolve(st).then(N,d)}}function a(N,st){n[N]&&(i[N]=function(yr){return new Promise(function(ws,gr){o.push([N,yr,ws,gr])>1||c(N,yr)})},st&&(i[N]=st(i[N])))}function c(N,st){try{l(n[N](st))}catch(yr){V(o[0][3],yr)}}function l(N){N.value instanceof L?Promise.resolve(N.value.v).then(f,d):V(o[0][2],N)}function f(N){c("next",N)}function d(N){c("throw",N)}function V(N,st){N(st),o.shift(),o.length&&c(o[0][0],o[0][1])}}function ln(r){var t,e;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,o){t[i]=r[i]?function(s){return(e=!e)?{value:L(r[i](s)),done:!1}:o?o(s):s}:o}}function he(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=r[Symbol.asyncIterator],e;return t?t.call(r):(r=typeof Ka=="function"?Ka(r):r[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(o){e[o]=r[o]&&function(s){return new Promise(function(a,c){s=r[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var Bs={};br(Bs,{compareArrayLike:()=>xs,joinUint8Arrays:()=>te,memcpy:()=>Yn,rebaseValueOffsets:()=>Ki,toArrayBufferView:()=>E,toArrayBufferViewAsyncIterator:()=>me,toArrayBufferViewIterator:()=>Ae,toBigInt64Array:()=>Ji,toBigUint64Array:()=>rf,toFloat32Array:()=>nf,toFloat32ArrayAsyncIterator:()=>_f,toFloat32ArrayIterator:()=>df,toFloat64Array:()=>of,toFloat64ArrayAsyncIterator:()=>vf,toFloat64ArrayIterator:()=>hf,toInt16Array:()=>Qu,toInt16ArrayAsyncIterator:()=>yf,toInt16ArrayIterator:()=>cf,toInt32Array:()=>Mr,toInt32ArrayAsyncIterator:()=>gf,toInt32ArrayIterator:()=>lf,toInt8Array:()=>qu,toInt8ArrayAsyncIterator:()=>mf,toInt8ArrayIterator:()=>af,toUint16Array:()=>tf,toUint16ArrayAsyncIterator:()=>bf,toUint16ArrayIterator:()=>uf,toUint32Array:()=>ef,toUint32ArrayAsyncIterator:()=>wf,toUint32ArrayIterator:()=>ff,toUint8Array:()=>B,toUint8ArrayAsyncIterator:()=>Ss,toUint8ArrayIterator:()=>Is,toUint8ClampedArray:()=>sf,toUint8ClampedArrayAsyncIterator:()=>If,toUint8ClampedArrayIterator:()=>pf});var Ju=new TextDecoder("utf-8"),Gn=r=>Ju.decode(r),Ku=new TextEncoder,Be=r=>Ku.encode(r);var Zu=r=>typeof r=="number",Xa=r=>typeof r=="boolean",dt=r=>typeof r=="function",Ot=r=>r!=null&&Object(r)===r,Qt=r=>Ot(r)&&dt(r.then);var pe=r=>Ot(r)&&dt(r[Symbol.iterator]),oe=r=>Ot(r)&&dt(r[Symbol.asyncIterator]),zi=r=>Ot(r)&&Ot(r.schema);var Wi=r=>Ot(r)&&"done"in r&&"value"in r;var Gi=r=>Ot(r)&&dt(r.stat)&&Zu(r.fd);var $i=r=>Ot(r)&&$n(r.body),Yi=r=>"_getDOMStream"in r&&"_getNodeStream"in r,qa=r=>Ot(r)&&dt(r.abort)&&dt(r.getWriter)&&!Yi(r),$n=r=>Ot(r)&&dt(r.cancel)&&dt(r.getReader)&&!Yi(r),Qa=r=>Ot(r)&&dt(r.end)&&dt(r.write)&&Xa(r.writable)&&!Yi(r),Hi=r=>Ot(r)&&dt(r.read)&&dt(r.pipe)&&Xa(r.readable)&&!Yi(r),tc=r=>Ot(r)&&dt(r.clear)&&dt(r.bytes)&&dt(r.position)&&dt(r.setPosition)&&dt(r.capacity)&&dt(r.getBufferIdentifier)&&dt(r.createLong);var vs=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Xu(r){let t=r[0]?[r[0]]:[],e,n,i,o;for(let s,a,c=0,l=0,f=r.length;++c<f;){if(s=t[l],a=r[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:e,byteLength:i}=s,{byteOffset:n,byteLength:o}=a,e+i<n||n+o<e){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,e,n-e+o)}return t}function Yn(r,t,e=0,n=t.byteLength){let i=r.byteLength,o=new Uint8Array(r.buffer,r.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return o.set(s,e),r}function te(r,t){let e=Xu(r),n=e.reduce((f,d)=>f+d.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let f=e.length;++c<f;){if(i=e[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?e[c]=i.subarray(o.length):o.length===i.length&&c++,s?Yn(s,o,a):s=o;break}Yn(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),e.slice(c),n-(s?s.byteLength:0)]}function E(r,t){let e=Wi(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=Be(e)),e instanceof ArrayBuffer?new r(e):e instanceof vs?new r(e):tc(e)?E(r,e.bytes()):ArrayBuffer.isView(e)?e.byteLength<=0?new r(0):new r(e.buffer,e.byteOffset,e.byteLength/r.BYTES_PER_ELEMENT):r.from(e)):new r(0)}var qu=r=>E(Int8Array,r),Qu=r=>E(Int16Array,r),Mr=r=>E(Int32Array,r),Ji=r=>E(BigInt64Array,r),B=r=>E(Uint8Array,r),tf=r=>E(Uint16Array,r),ef=r=>E(Uint32Array,r),rf=r=>E(BigUint64Array,r),nf=r=>E(Float32Array,r),of=r=>E(Float64Array,r),sf=r=>E(Uint8ClampedArray,r),_s=r=>(r.next(),r);function*Ae(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof vs?e(t):pe(t)?t:e(t);return yield*_s(function*(i){let o=null;do o=i.next(yield E(r,o));while(!o.done)}(n[Symbol.iterator]())),new r}var af=r=>Ae(Int8Array,r),cf=r=>Ae(Int16Array,r),lf=r=>Ae(Int32Array,r),Is=r=>Ae(Uint8Array,r),uf=r=>Ae(Uint16Array,r),ff=r=>Ae(Uint32Array,r),df=r=>Ae(Float32Array,r),hf=r=>Ae(Float64Array,r),pf=r=>Ae(Uint8ClampedArray,r);function me(r,t){return qt(this,arguments,function*(){if(Qt(t))return yield L(yield L(yield*ln(he(me(r,yield L(t))))));let n=function(s){return qt(this,arguments,function*(){yield yield L(yield L(s))})},i=function(s){return qt(this,arguments,function*(){yield L(yield*ln(he(_s(function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)}(s[Symbol.iterator]())))))})},o=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof vs?n(t):pe(t)?i(t):oe(t)?t:n(t);return yield L(yield*ln(he(_s(function(s){return qt(this,arguments,function*(){let a=null;do a=yield L(s.next(yield yield L(E(r,a))));while(!a.done)})}(o[Symbol.asyncIterator]()))))),yield L(new r)})}var mf=r=>me(Int8Array,r),yf=r=>me(Int16Array,r),gf=r=>me(Int32Array,r),Ss=r=>me(Uint8Array,r),bf=r=>me(Uint16Array,r),wf=r=>me(Uint32Array,r),_f=r=>me(Float32Array,r),vf=r=>me(Float64Array,r),If=r=>me(Uint8ClampedArray,r);function Ki(r,t,e){if(r!==0){e=e.slice(0,t);for(let n=-1,i=e.length;++n<i;)e[n]+=r}return e.subarray(0,t)}function xs(r,t){let e=0,n=r.length;if(n!==t.length)return!1;if(n>0)do if(r[e]!==t[e])return!1;while(++e<n);return!0}var bt={fromIterable(r){return Zi(Sf(r))},fromAsyncIterable(r){return Zi(xf(r))},fromDOMStream(r){return Zi(Bf(r))},fromNodeStream(r){return Zi(Af(r))},toDOMStream(r,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(r,t){throw new Error('"toNodeStream" not available in this environment')}},Zi=r=>(r.next(),r);function*Sf(r){let t,e=!1,n=[],i,o,s,a=0;function c(){return o==="peek"?te(n,s)[0]:([i,n,a]=te(n,s),i)}({cmd:o,size:s}=(yield(()=>null)())||{cmd:"read",size:0});let l=Is(r)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(f){(e=!0)&&typeof l.throw=="function"&&l.throw(f)}finally{e===!1&&typeof l.return=="function"&&l.return(null)}return null}function xf(r){return qt(this,arguments,function*(){let e,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?te(i,a)[0]:([o,i,c]=te(i,a),o)}({cmd:s,size:a}=(yield yield L((()=>null)()))||{cmd:"read",size:0});let f=Ss(r)[Symbol.asyncIterator]();try{do if({done:e,value:o}=Number.isNaN(a-c)?yield L(f.next()):yield L(f.next(a-c)),!e&&o.byteLength>0&&(i.push(o),c+=o.byteLength),e||a<=c)do({cmd:s,size:a}=yield yield L(l()));while(a<c);while(!e)}catch(d){(n=!0)&&typeof f.throw=="function"&&(yield L(f.throw(d)))}finally{n===!1&&typeof f.return=="function"&&(yield L(f.return(new Uint8Array(0))))}return yield L(null)})}function Bf(r){return qt(this,arguments,function*(){let e=!1,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?te(i,a)[0]:([o,i,c]=te(i,a),o)}({cmd:s,size:a}=(yield yield L((()=>null)()))||{cmd:"read",size:0});let f=new Ts(r);try{do if({done:e,value:o}=Number.isNaN(a-c)?yield L(f.read()):yield L(f.read(a-c)),!e&&o.byteLength>0&&(i.push(B(o)),c+=o.byteLength),e||a<=c)do({cmd:s,size:a}=yield yield L(l()));while(a<c);while(!e)}catch(d){(n=!0)&&(yield L(f.cancel(d)))}finally{n===!1?yield L(f.cancel()):r.locked&&f.releaseLock()}return yield L(null)})}var Ts=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return m(this,void 0,void 0,function*(){let{reader:e,source:n}=this;e&&(yield e.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return m(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let e=yield this.reader.read();return!e.done&&(e.value=B(e)),e})}},As=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function Af(r){return qt(this,arguments,function*(){let e=[],n="error",i=!1,o=null,s,a,c=0,l=[],f;function d(){return s==="peek"?te(l,a)[0]:([f,l,c]=te(l,a),f)}if({cmd:s,size:a}=(yield yield L((()=>null)()))||{cmd:"read",size:0},r.isTTY)return yield yield L(new Uint8Array(0)),yield L(null);try{e[0]=As(r,"end"),e[1]=As(r,"error");do{if(e[2]=As(r,"readable"),[n,o]=yield L(Promise.race(e.map(N=>N[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(f=B(r.read(a-c)),f.byteLength<a-c&&(f=B(r.read()))):f=B(r.read()),f.byteLength>0&&(l.push(f),c+=f.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield L(d()));while(a<c)}while(!i)}finally{yield L(V(e,n==="error"?o:null))}return yield L(null);function V(N,st){return f=l=null,new Promise((yr,ws)=>{for(let[gr,Cu]of N)r.off(gr,Cu);try{let gr=r.destroy;gr&&gr.call(r,st),st=void 0}catch(gr){st=gr||st}finally{st!=null?ws(st):yr()}})}})}var z;(function(r){r[r.V1=0]="V1",r[r.V2=1]="V2",r[r.V3=2]="V3",r[r.V4=3]="V4",r[r.V5=4]="V5"})(z||(z={}));var Y;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(Y||(Y={}));var P;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(P||(P={}));var J;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(J||(J={}));var h;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(h||(h={}));var Q;(function(r){r[r.YEAR_MONTH=0]="YEAR_MONTH",r[r.DAY_TIME=1]="DAY_TIME",r[r.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Q||(Q={}));var Te=new Int32Array(2),Xi=new Float32Array(Te.buffer),qi=new Float64Array(Te.buffer),un=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var Hn;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(Hn||(Hn={}));var Ft=class{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new Ft(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 Te[0]=this.readInt32(t),Xi[0]}readFloat64(t){return Te[un?0:1]=this.readInt32(t),Te[un?1:0]=this.readInt32(t+4),qi[0]}writeInt8(t,e){this.bytes_[t]=e}writeUint8(t,e){this.bytes_[t]=e}writeInt16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeUint16(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8}writeInt32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeUint32(t,e){this.bytes_[t]=e,this.bytes_[t+1]=e>>8,this.bytes_[t+2]=e>>16,this.bytes_[t+3]=e>>24}writeInt64(t,e){this.writeInt32(t,Number(BigInt.asIntN(32,e))),this.writeInt32(t+4,Number(BigInt.asIntN(32,e>>BigInt(32))))}writeUint64(t,e){this.writeUint32(t,Number(BigInt.asUintN(32,e))),this.writeUint32(t+4,Number(BigInt.asUintN(32,e>>BigInt(32))))}writeFloat32(t,e){Xi[0]=e,this.writeInt32(t,Te[0])}writeFloat64(t,e){qi[0]=e,this.writeInt32(t,Te[un?0:1]),this.writeInt32(t+4,Te[un?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<4;e++)t+=String.fromCharCode(this.readInt8(this.position_+4+e));return t}__offset(t,e){let n=t-this.readInt32(t);return e<this.readInt16(n)?this.readInt16(n+e):0}__union(t,e){return t.bb_pos=e+this.readInt32(e),t.bb=this,t}__string(t,e){t+=this.readInt32(t);let n=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+n);return e===Hn.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0}createScalarList(t,e){let n=[];for(let i=0;i<e;++i){let o=t(i);o!==null&&n.push(o)}return n}createObjList(t,e){let n=[];for(let i=0;i<e;++i){let o=t(i);o!==null&&n.push(o.unpack())}return n}};var tr=class{constructor(t){this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null,this.text_encoder=new TextEncoder;let e;t?e=t:e=1024,this.bb=Ft.allocate(e),this.space=e}clear(){this.bb.clear(),this.space=this.bb.capacity(),this.minalign=1,this.vtable=null,this.vtable_in_use=0,this.isNested=!1,this.object_start=0,this.vtables=[],this.vector_num_elems=0,this.force_defaults=!1,this.string_maps=null}forceDefaults(t){this.force_defaults=t}dataBuffer(){return this.bb}asUint8Array(){return this.bb.bytes().subarray(this.bb.position(),this.bb.position()+this.offset())}prep(t,e){t>this.minalign&&(this.minalign=t);let n=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<n+t+e;){let i=this.bb.capacity();this.bb=tr.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(n)}pad(t){for(let e=0;e<t;e++)this.bb.writeInt8(--this.space,0)}writeInt8(t){this.bb.writeInt8(this.space-=1,t)}writeInt16(t){this.bb.writeInt16(this.space-=2,t)}writeInt32(t){this.bb.writeInt32(this.space-=4,t)}writeInt64(t){this.bb.writeInt64(this.space-=8,t)}writeFloat32(t){this.bb.writeFloat32(this.space-=4,t)}writeFloat64(t){this.bb.writeFloat64(this.space-=8,t)}addInt8(t){this.prep(1,0),this.writeInt8(t)}addInt16(t){this.prep(2,0),this.writeInt16(t)}addInt32(t){this.prep(4,0),this.writeInt32(t)}addInt64(t){this.prep(8,0),this.writeInt64(t)}addFloat32(t){this.prep(4,0),this.writeFloat32(t)}addFloat64(t){this.prep(8,0),this.writeFloat64(t)}addFieldInt8(t,e,n){(this.force_defaults||e!=n)&&(this.addInt8(e),this.slot(t))}addFieldInt16(t,e,n){(this.force_defaults||e!=n)&&(this.addInt16(e),this.slot(t))}addFieldInt32(t,e,n){(this.force_defaults||e!=n)&&(this.addInt32(e),this.slot(t))}addFieldInt64(t,e,n){(this.force_defaults||e!==n)&&(this.addInt64(e),this.slot(t))}addFieldFloat32(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat32(e),this.slot(t))}addFieldFloat64(t,e,n){(this.force_defaults||e!=n)&&(this.addFloat64(e),this.slot(t))}addFieldOffset(t,e,n){(this.force_defaults||e!=n)&&(this.addOffset(e),this.slot(t))}addFieldStruct(t,e,n){e!=n&&(this.nested(e),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=e<<1,i=Ft.allocate(n);return i.setPosition(n-e),i.bytes().set(t.bytes(),n-e),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);let n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);let i=2;this.addInt16(t-this.object_start);let o=(n+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(e=0;e<this.vtables.length;e++){let c=this.bb.capacity()-this.vtables[e];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[e];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,n){let i=n?4:0;if(e){let o=e;if(this.prep(this.minalign,4+4+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=4-1;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(e<this.bb.readInt16(i)&&this.bb.readInt16(i+e)!=0))throw new TypeError("FlatBuffers: field "+e+" must be set")}startVector(t,e,n){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(n,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(t==null)return 0;let e;return t instanceof Uint8Array?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let e=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)e.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var Jn;(function(r){r[r.BUFFER=0]="BUFFER"})(Jn||(Jn={}));var Kn;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(Kn||(Kn={}));var ge=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBodyCompression(t,e){return(e||new ge).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new ge).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):Kn.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Jn.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,Kn.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,Jn.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return ge.startBodyCompression(t),ge.addCodec(t,e),ge.addMethod(t,n),ge.endBodyCompression(t)}};var fn=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}length(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createBuffer(t,e,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(e??0)),t.offset()}};var dn=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}length(){return this.bb.readInt64(this.bb_pos)}nullCount(){return this.bb.readInt64(this.bb_pos+8)}static sizeOf(){return 16}static createFieldNode(t,e,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(e??0)),t.offset()}};var It=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsRecordBatch(t,e){return(e||new It).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new It).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new dn).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new fn).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let e=this.bb.__offset(this.bb_pos,10);return e?(t||new ge).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}static startRecordBatch(t){t.startObject(4)}static addLength(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addNodes(t,e){t.addFieldOffset(1,e,0)}static startNodesVector(t,e){t.startVector(16,e,8)}static addBuffers(t,e){t.addFieldOffset(2,e,0)}static startBuffersVector(t,e){t.startVector(16,e,8)}static addCompression(t,e){t.addFieldOffset(3,e,0)}static endRecordBatch(t){return t.endObject()}};var ae=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryBatch(t,e){return(e||new ae).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new ae).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new It).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addData(t,e){t.addFieldOffset(1,e,0)}static addIsDelta(t,e){t.addFieldInt8(2,+e,0)}static endDictionaryBatch(t){return t.endObject()}};var wr;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(wr||(wr={}));var Zn;(function(r){r[r.DenseArray=0]="DenseArray"})(Zn||(Zn={}));var ht=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInt(t,e){return(e||new ht).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new ht).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,e){t.addFieldInt32(0,e,0)}static addIsSigned(t,e){t.addFieldInt8(1,+e,0)}static endInt(t){return t.endObject()}static createInt(t,e,n){return ht.startInt(t),ht.addBitWidth(t,e),ht.addIsSigned(t,n),ht.endInt(t)}};var ee=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDictionaryEncoding(t,e){return(e||new ee).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new ee).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new ht).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):Zn.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,e){t.addFieldInt64(0,e,BigInt("0"))}static addIndexType(t,e){t.addFieldOffset(1,e,0)}static addIsOrdered(t,e){t.addFieldInt8(2,+e,0)}static addDictionaryKind(t,e){t.addFieldInt16(3,e,Zn.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var K=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsKeyValue(t,e){return(e||new K).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new K).__init(t.readInt32(t.position())+t.position(),t)}key(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,e){t.addFieldOffset(0,e,0)}static addValue(t,e){t.addFieldOffset(1,e,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,e,n){return K.startKeyValue(t),K.addKey(t,e),K.addValue(t,n),K.endKeyValue(t)}};var De=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBinary(t,e){return(e||new De).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new De).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return De.startBinary(t),De.endBinary(t)}};var Oe=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsBool(t,e){return(e||new Oe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new Oe).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return Oe.startBool(t),Oe.endBool(t)}};var kt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDate(t,e){return(e||new kt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new kt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):J.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,J.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return kt.startDate(t),kt.addUnit(t,e),kt.endDate(t)}};var pt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDecimal(t,e){return(e||new pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new pt).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,e){t.addFieldInt32(0,e,0)}static addScale(t,e){t.addFieldInt32(1,e,0)}static addBitWidth(t,e){t.addFieldInt32(2,e,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,e,n,i){return pt.startDecimal(t),pt.addPrecision(t,e),pt.addScale(t,n),pt.addBitWidth(t,i),pt.endDecimal(t)}};var Pt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsDuration(t,e){return(e||new Pt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+4),(e||new Pt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):h.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,h.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return Pt.startDuration(t),Pt.addUnit(t,e),Pt.endDuration(t)}};var Vt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeBinary(t,e){return(e||new Vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new Vt).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return Vt.startFixedSizeBinary(t),Vt.addByteWidth(t,e),Vt.endFixedSizeBinary(t)}};var jt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFixedSizeList(t,e){return(e||new jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new jt).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return jt.startFixedSizeList(t),jt.addListSize(t,e),jt.endFixedSizeList(t)}};var zt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFloatingPoint(t,e){return(e||new zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new zt).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):P.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,P.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return zt.startFloatingPoint(t),zt.addPrecision(t,e),zt.endFloatingPoint(t)}};var Wt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsInterval(t,e){return(e||new Wt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new Wt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Q.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Q.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return Wt.startInterval(t),Wt.addUnit(t,e),Wt.endInterval(t)}};var Fe=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeBinary(t,e){return(e||new Fe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+4),(e||new Fe).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return Fe.startLargeBinary(t),Fe.endLargeBinary(t)}};var Me=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsLargeUtf8(t,e){return(e||new Me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+4),(e||new Me).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return Me.startLargeUtf8(t),Me.endLargeUtf8(t)}};var Le=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsList(t,e){return(e||new Le).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new Le).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return Le.startList(t),Le.endList(t)}};var Gt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMap(t,e){return(e||new Gt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new Gt).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return Gt.startMap(t),Gt.addKeysSorted(t,e),Gt.endMap(t)}};var Ne=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsNull(t,e){return(e||new Ne).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new Ne).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return Ne.startNull(t),Ne.endNull(t)}};var Ue=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsStruct_(t,e){return(e||new Ue).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new Ue).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return Ue.startStruct_(t),Ue.endStruct_(t)}};var St=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTime(t,e){return(e||new St).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new St).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):h.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,h.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return St.startTime(t),St.addUnit(t,e),St.addBitWidth(t,n),St.endTime(t)}};var xt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsTimestamp(t,e){return(e||new xt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new xt).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):h.SECOND}timezone(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.__string(this.bb_pos+e,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,h.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return xt.startTimestamp(t),xt.addUnit(t,e),xt.addTimezone(t,n),xt.endTimestamp(t)}};var mt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUnion(t,e){return(e||new mt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new mt).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Y.Sparse}typeIds(t){let e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,Y.Sparse)}static addTypeIds(t,e){t.addFieldOffset(1,e,0)}static createTypeIdsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addInt32(e[n]);return t.endVector()}static startTypeIdsVector(t,e){t.startVector(4,e,4)}static endUnion(t){return t.endObject()}static createUnion(t,e,n){return mt.startUnion(t),mt.addMode(t,e),mt.addTypeIds(t,n),mt.endUnion(t)}};var Ee=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsUtf8(t,e){return(e||new Ee).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new Ee).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return Ee.startUtf8(t),Ee.endUtf8(t)}};var H;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.FloatingPoint=3]="FloatingPoint",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct_=13]="Struct_",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.LargeList=21]="LargeList",r[r.RunEndEncoded=22]="RunEndEncoded"})(H||(H={}));var at=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsField(t,e){return(e||new at).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new at).__init(t.readInt32(t.position())+t.position(),t)}name(t){let e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):H.NONE}type(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){let e=this.bb.__offset(this.bb_pos,12);return e?(t||new ee).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){let n=this.bb.__offset(this.bb_pos,14);return n?(e||new at).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,16);return n?(e||new K).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,H.NONE)}static addType(t,e){t.addFieldOffset(3,e,0)}static addDictionary(t,e){t.addFieldOffset(4,e,0)}static addChildren(t,e){t.addFieldOffset(5,e,0)}static createChildrenVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startChildrenVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(6,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endField(t){return t.endObject()}};var tt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsSchema(t,e){return(e||new tt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new tt).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):wr.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new at).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new K).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let e=this.bb.__offset(this.bb_pos,10);return e?this.bb.readInt64(this.bb.__vector(this.bb_pos+e)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,e){t.addFieldInt16(0,e,wr.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,n,i,o){return tt.startSchema(t),tt.addEndianness(t,e),tt.addFields(t,n),tt.addCustomMetadata(t,i),tt.addFeatures(t,o),tt.endSchema(t)}};var R;(function(r){r[r.NONE=0]="NONE",r[r.Schema=1]="Schema",r[r.DictionaryBatch=2]="DictionaryBatch",r[r.RecordBatch=3]="RecordBatch",r[r.Tensor=4]="Tensor",r[r.SparseTensor=5]="SparseTensor"})(R||(R={}));var u;(function(r){r[r.NONE=0]="NONE",r[r.Null=1]="Null",r[r.Int=2]="Int",r[r.Float=3]="Float",r[r.Binary=4]="Binary",r[r.Utf8=5]="Utf8",r[r.Bool=6]="Bool",r[r.Decimal=7]="Decimal",r[r.Date=8]="Date",r[r.Time=9]="Time",r[r.Timestamp=10]="Timestamp",r[r.Interval=11]="Interval",r[r.List=12]="List",r[r.Struct=13]="Struct",r[r.Union=14]="Union",r[r.FixedSizeBinary=15]="FixedSizeBinary",r[r.FixedSizeList=16]="FixedSizeList",r[r.Map=17]="Map",r[r.Duration=18]="Duration",r[r.LargeBinary=19]="LargeBinary",r[r.LargeUtf8=20]="LargeUtf8",r[r.Dictionary=-1]="Dictionary",r[r.Int8=-2]="Int8",r[r.Int16=-3]="Int16",r[r.Int32=-4]="Int32",r[r.Int64=-5]="Int64",r[r.Uint8=-6]="Uint8",r[r.Uint16=-7]="Uint16",r[r.Uint32=-8]="Uint32",r[r.Uint64=-9]="Uint64",r[r.Float16=-10]="Float16",r[r.Float32=-11]="Float32",r[r.Float64=-12]="Float64",r[r.DateDay=-13]="DateDay",r[r.DateMillisecond=-14]="DateMillisecond",r[r.TimestampSecond=-15]="TimestampSecond",r[r.TimestampMillisecond=-16]="TimestampMillisecond",r[r.TimestampMicrosecond=-17]="TimestampMicrosecond",r[r.TimestampNanosecond=-18]="TimestampNanosecond",r[r.TimeSecond=-19]="TimeSecond",r[r.TimeMillisecond=-20]="TimeMillisecond",r[r.TimeMicrosecond=-21]="TimeMicrosecond",r[r.TimeNanosecond=-22]="TimeNanosecond",r[r.DenseUnion=-23]="DenseUnion",r[r.SparseUnion=-24]="SparseUnion",r[r.IntervalDayTime=-25]="IntervalDayTime",r[r.IntervalYearMonth=-26]="IntervalYearMonth",r[r.DurationSecond=-27]="DurationSecond",r[r.DurationMillisecond=-28]="DurationMillisecond",r[r.DurationMicrosecond=-29]="DurationMicrosecond",r[r.DurationNanosecond=-30]="DurationNanosecond"})(u||(u={}));var rt;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(rt||(rt={}));var Hs={};br(Hs,{clampRange:()=>Qn,createElementComparator:()=>xr,wrapIndex:()=>Gr});var Ds={};br(Ds,{valueToString:()=>be});function be(r){if(r===null)return"null";if(r===void 0)return"undefined";switch(typeof r){case"number":return`${r}`;case"bigint":return`${r}`;case"string":return`"${r}"`}return typeof r[Symbol.toPrimitive]=="function"?r[Symbol.toPrimitive]("string"):ArrayBuffer.isView(r)?r instanceof BigInt64Array||r instanceof BigUint64Array?`[${[...r].map(t=>be(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}var Ls={};br(Ls,{BN:()=>Lr,bigNumToBigInt:()=>rc,bigNumToNumber:()=>Ms,bigNumToString:()=>mn,isArrowBigNumSymbol:()=>ec});function C(r){if(typeof r=="bigint"&&(r<Number.MIN_SAFE_INTEGER||r>Number.MAX_SAFE_INTEGER))throw new TypeError(`${r} is not safe to convert to a number.`);return Number(r)}function Os(r,t){return C(r/t)+C(r%t)/C(t)}var ec=Symbol.for("isArrowBigNum");function we(r,...t){return t.length===0?Object.setPrototypeOf(E(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}we.prototype[ec]=!0;we.prototype.toJSON=function(){return`"${mn(this)}"`};we.prototype.valueOf=function(r){return Ms(this,r)};we.prototype.toString=function(){return mn(this)};we.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Ms(this);case"string":return mn(this);case"default":return rc(this)}return mn(this)};function hn(...r){return we.apply(this,r)}function pn(...r){return we.apply(this,r)}function Xn(...r){return we.apply(this,r)}Object.setPrototypeOf(hn.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(pn.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Xn.prototype,Object.create(Uint32Array.prototype));Object.assign(hn.prototype,we.prototype,{constructor:hn,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(pn.prototype,we.prototype,{constructor:pn,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Xn.prototype,we.prototype,{constructor:Xn,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});var Tf=BigInt(4294967296)*BigInt(4294967296),Df=Tf-BigInt(1);function Ms(r,t){let{buffer:e,byteOffset:n,byteLength:i,signed:o}=r,s=new BigUint64Array(e,n,i/8),a=o&&s.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(a){for(let f of s)c|=(f^Df)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let f of s)c|=f*(BigInt(1)<<BigInt(64*l++));if(typeof t=="number"){let f=BigInt(Math.pow(10,t)),d=c/f,V=c%f;return C(d)+C(V)/C(f)}return C(c)}function mn(r){if(r.byteLength===8)return`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`;if(!r.signed)return Fs(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Fs(r);t=t.slice();let n=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+n;t[o]=a,n&=s===0?1:0}return`-${Fs(t)}`}function rc(r){return r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:mn(r)}function Fs(r){let t="",e=new Uint32Array(2),n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),o=-1,s=n.length-1;do{for(e[0]=n[o=0];o<s;)n[o++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+n[o];n[o]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t=`${e[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var Lr=class{static new(t,e){switch(e){case!0:return new hn(t);case!1:return new pn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new hn(t)}return t.byteLength===16?new Xn(t):new pn(t)}static signed(t){return new hn(t)}static unsigned(t){return new pn(t)}static decimal(t){return new Xn(t)}constructor(t,e){return Lr.new(t,e)}};var nc,ic,oc,sc,ac,cc,lc,uc,fc,dc,hc,pc,mc,yc,gc,bc,wc,_c,vc,Ic,Sc,xc,p=class{static isNull(t){return t?.typeId===u.Null}static isInt(t){return t?.typeId===u.Int}static isFloat(t){return t?.typeId===u.Float}static isBinary(t){return t?.typeId===u.Binary}static isLargeBinary(t){return t?.typeId===u.LargeBinary}static isUtf8(t){return t?.typeId===u.Utf8}static isLargeUtf8(t){return t?.typeId===u.LargeUtf8}static isBool(t){return t?.typeId===u.Bool}static isDecimal(t){return t?.typeId===u.Decimal}static isDate(t){return t?.typeId===u.Date}static isTime(t){return t?.typeId===u.Time}static isTimestamp(t){return t?.typeId===u.Timestamp}static isInterval(t){return t?.typeId===u.Interval}static isDuration(t){return t?.typeId===u.Duration}static isList(t){return t?.typeId===u.List}static isStruct(t){return t?.typeId===u.Struct}static isUnion(t){return t?.typeId===u.Union}static isFixedSizeBinary(t){return t?.typeId===u.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===u.FixedSizeList}static isMap(t){return t?.typeId===u.Map}static isDictionary(t){return t?.typeId===u.Dictionary}static isDenseUnion(t){return p.isUnion(t)&&t.mode===Y.Dense}static isSparseUnion(t){return p.isUnion(t)&&t.mode===Y.Sparse}constructor(t){this.typeId=t}};nc=Symbol.toStringTag;p[nc]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(p.prototype);var nt=class extends p{constructor(){super(u.Null)}toString(){return"Null"}};ic=Symbol.toStringTag;nt[ic]=(r=>r[Symbol.toStringTag]="Null")(nt.prototype);var et=class extends p{constructor(t,e){super(u.Int),this.isSigned=t,this.bitWidth=e}get ArrayType(){switch(this.bitWidth){case 8:return this.isSigned?Int8Array:Uint8Array;case 16:return this.isSigned?Int16Array:Uint16Array;case 32:return this.isSigned?Int32Array:Uint32Array;case 64:return this.isSigned?BigInt64Array:BigUint64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}};oc=Symbol.toStringTag;et[oc]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(et.prototype);var Re=class extends et{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Ce=class extends et{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},yt=class extends et{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},ce=class extends et{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},ke=class extends et{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Pe=class extends et{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Ve=class extends et{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},je=class extends et{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(Re.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Ce.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(yt.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(ce.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(ke.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Pe.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Ve.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(je.prototype,"ArrayType",{value:BigUint64Array});var Mt=class extends p{constructor(t){super(u.Float),this.precision=t}get ArrayType(){switch(this.precision){case P.HALF:return Uint16Array;case P.SINGLE:return Float32Array;case P.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};sc=Symbol.toStringTag;Mt[sc]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(Mt.prototype);var _r=class extends Mt{constructor(){super(P.HALF)}},ze=class extends Mt{constructor(){super(P.SINGLE)}},le=class extends Mt{constructor(){super(P.DOUBLE)}};Object.defineProperty(_r.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ze.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(le.prototype,"ArrayType",{value:Float64Array});var re=class extends p{constructor(){super(u.Binary)}toString(){return"Binary"}};ac=Symbol.toStringTag;re[ac]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(re.prototype);var We=class extends p{constructor(){super(u.LargeBinary)}toString(){return"LargeBinary"}};cc=Symbol.toStringTag;We[cc]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(We.prototype);var Lt=class extends p{constructor(){super(u.Utf8)}toString(){return"Utf8"}};lc=Symbol.toStringTag;Lt[lc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Lt.prototype);var Ge=class extends p{constructor(){super(u.LargeUtf8)}toString(){return"LargeUtf8"}};uc=Symbol.toStringTag;Ge[uc]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Ge.prototype);var Nt=class extends p{constructor(){super(u.Bool)}toString(){return"Bool"}};fc=Symbol.toStringTag;Nt[fc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(Nt.prototype);var ne=class extends p{constructor(t,e,n=128){super(u.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};dc=Symbol.toStringTag;ne[dc]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(ne.prototype);var $t=class extends p{constructor(t){super(u.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${J[this.unit]}>`}get ArrayType(){return this.unit===J.DAY?Int32Array:BigInt64Array}};hc=Symbol.toStringTag;$t[hc]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))($t.prototype);var Nr=class extends $t{constructor(){super(J.DAY)}},Ur=class extends $t{constructor(){super(J.MILLISECOND)}},Bt=class extends p{constructor(t,e){super(u.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${h[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};pc=Symbol.toStringTag;Bt[pc]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(Bt.prototype);var Er=class extends Bt{constructor(){super(h.SECOND,32)}},Rr=class extends Bt{constructor(){super(h.MILLISECOND,32)}},Cr=class extends Bt{constructor(){super(h.MICROSECOND,64)}},kr=class extends Bt{constructor(){super(h.NANOSECOND,64)}},At=class extends p{constructor(t,e){super(u.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${h[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};mc=Symbol.toStringTag;At[mc]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(At.prototype);var Pr=class extends At{constructor(t){super(h.SECOND,t)}},er=class extends At{constructor(t){super(h.MILLISECOND,t)}},Vr=class extends At{constructor(t){super(h.MICROSECOND,t)}},jr=class extends At{constructor(t){super(h.NANOSECOND,t)}},Yt=class extends p{constructor(t){super(u.Interval),this.unit=t}toString(){return`Interval<${Q[this.unit]}>`}};yc=Symbol.toStringTag;Yt[yc]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Yt.prototype);var zr=class extends Yt{constructor(){super(Q.DAY_TIME)}},Wr=class extends Yt{constructor(){super(Q.YEAR_MONTH)}},$e=class extends p{constructor(t){super(u.Duration),this.unit=t}toString(){return`Duration<${h[this.unit]}>`}};gc=Symbol.toStringTag;$e[gc]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))($e.prototype);var wt=class extends p{constructor(t){super(u.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}};bc=Symbol.toStringTag;wt[bc]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(wt.prototype);var k=class extends p{constructor(t){super(u.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};wc=Symbol.toStringTag;k[wc]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(k.prototype);var ue=class extends p{constructor(t,e,n){super(u.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};_c=Symbol.toStringTag;ue[_c]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(ue.prototype);var Ye=class extends p{constructor(t){super(u.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};vc=Symbol.toStringTag;Ye[vc]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Ye.prototype);var Ut=class extends p{constructor(t,e){super(u.FixedSizeList),this.listSize=t,this.children=[e]}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}toString(){return`FixedSizeList[${this.listSize}]<${this.valueType}>`}};Ic=Symbol.toStringTag;Ut[Ic]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Ut.prototype);var Et=class extends p{constructor(t,e=!1){var n,i,o;if(super(u.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.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(", ")}}>`}};Sc=Symbol.toStringTag;Et[Sc]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(Et.prototype);var Of=(r=>()=>++r)(-1),Tt=class extends p{constructor(t,e,n,i){super(u.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?Of():C(n)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}};xc=Symbol.toStringTag;Tt[xc]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Tt.prototype);function ie(r){let t=r;switch(r.typeId){case u.Decimal:return r.bitWidth/32;case u.Interval:return 1+t.unit;case u.FixedSizeList:return t.listSize;case u.FixedSizeBinary:return t.byteWidth;default:return 1}}var w=class{visitMany(t,...e){return t.map((n,i)=>this.visit(n,...e.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return Ff(this,t,e)}getVisitFnByTypeId(t,e=!0){return yn(this,t,e)}visitNull(t,...e){return null}visitBool(t,...e){return null}visitInt(t,...e){return null}visitFloat(t,...e){return null}visitUtf8(t,...e){return null}visitLargeUtf8(t,...e){return null}visitBinary(t,...e){return null}visitLargeBinary(t,...e){return null}visitFixedSizeBinary(t,...e){return null}visitDate(t,...e){return null}visitTimestamp(t,...e){return null}visitTime(t,...e){return null}visitDecimal(t,...e){return null}visitList(t,...e){return null}visitStruct(t,...e){return null}visitUnion(t,...e){return null}visitDictionary(t,...e){return null}visitInterval(t,...e){return null}visitDuration(t,...e){return null}visitFixedSizeList(t,...e){return null}visitMap(t,...e){return null}};function Ff(r,t,e=!0){return typeof t=="number"?yn(r,t,e):typeof t=="string"&&t in u?yn(r,u[t],e):t&&t instanceof p?yn(r,Ac(t),e):t?.type&&t.type instanceof p?yn(r,Ac(t.type),e):yn(r,u.NONE,e)}function yn(r,t,e=!0){let n=null;switch(t){case u.Null:n=r.visitNull;break;case u.Bool:n=r.visitBool;break;case u.Int:n=r.visitInt;break;case u.Int8:n=r.visitInt8||r.visitInt;break;case u.Int16:n=r.visitInt16||r.visitInt;break;case u.Int32:n=r.visitInt32||r.visitInt;break;case u.Int64:n=r.visitInt64||r.visitInt;break;case u.Uint8:n=r.visitUint8||r.visitInt;break;case u.Uint16:n=r.visitUint16||r.visitInt;break;case u.Uint32:n=r.visitUint32||r.visitInt;break;case u.Uint64:n=r.visitUint64||r.visitInt;break;case u.Float:n=r.visitFloat;break;case u.Float16:n=r.visitFloat16||r.visitFloat;break;case u.Float32:n=r.visitFloat32||r.visitFloat;break;case u.Float64:n=r.visitFloat64||r.visitFloat;break;case u.Utf8:n=r.visitUtf8;break;case u.LargeUtf8:n=r.visitLargeUtf8;break;case u.Binary:n=r.visitBinary;break;case u.LargeBinary:n=r.visitLargeBinary;break;case u.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case u.Date:n=r.visitDate;break;case u.DateDay:n=r.visitDateDay||r.visitDate;break;case u.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case u.Timestamp:n=r.visitTimestamp;break;case u.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case u.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case u.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case u.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case u.Time:n=r.visitTime;break;case u.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case u.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case u.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case u.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case u.Decimal:n=r.visitDecimal;break;case u.List:n=r.visitList;break;case u.Struct:n=r.visitStruct;break;case u.Union:n=r.visitUnion;break;case u.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case u.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case u.Dictionary:n=r.visitDictionary;break;case u.Interval:n=r.visitInterval;break;case u.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case u.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case u.Duration:n=r.visitDuration;break;case u.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case u.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case u.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case u.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case u.FixedSizeList:n=r.visitFixedSizeList;break;case u.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${u[t]}'`)}function Ac(r){switch(r.typeId){case u.Null:return u.Null;case u.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?u.Int8:u.Uint8;case 16:return e?u.Int16:u.Uint16;case 32:return e?u.Int32:u.Uint32;case 64:return e?u.Int64:u.Uint64}return u.Int}case u.Float:switch(r.precision){case P.HALF:return u.Float16;case P.SINGLE:return u.Float32;case P.DOUBLE:return u.Float64}return u.Float;case u.Binary:return u.Binary;case u.LargeBinary:return u.LargeBinary;case u.Utf8:return u.Utf8;case u.LargeUtf8:return u.LargeUtf8;case u.Bool:return u.Bool;case u.Decimal:return u.Decimal;case u.Time:switch(r.unit){case h.SECOND:return u.TimeSecond;case h.MILLISECOND:return u.TimeMillisecond;case h.MICROSECOND:return u.TimeMicrosecond;case h.NANOSECOND:return u.TimeNanosecond}return u.Time;case u.Timestamp:switch(r.unit){case h.SECOND:return u.TimestampSecond;case h.MILLISECOND:return u.TimestampMillisecond;case h.MICROSECOND:return u.TimestampMicrosecond;case h.NANOSECOND:return u.TimestampNanosecond}return u.Timestamp;case u.Date:switch(r.unit){case J.DAY:return u.DateDay;case J.MILLISECOND:return u.DateMillisecond}return u.Date;case u.Interval:switch(r.unit){case Q.DAY_TIME:return u.IntervalDayTime;case Q.YEAR_MONTH:return u.IntervalYearMonth}return u.Interval;case u.Duration:switch(r.unit){case h.SECOND:return u.DurationSecond;case h.MILLISECOND:return u.DurationMillisecond;case h.MICROSECOND:return u.DurationMicrosecond;case h.NANOSECOND:return u.DurationNanosecond}return u.Duration;case u.Map:return u.Map;case u.List:return u.List;case u.Struct:return u.Struct;case u.Union:switch(r.mode){case Y.Dense:return u.DenseUnion;case Y.Sparse:return u.SparseUnion}return u.Union;case u.FixedSizeBinary:return u.FixedSizeBinary;case u.FixedSizeList:return u.FixedSizeList;case u.Dictionary:return u.Dictionary}throw new Error(`Unrecognized type '${u[r.typeId]}'`)}w.prototype.visitInt8=null;w.prototype.visitInt16=null;w.prototype.visitInt32=null;w.prototype.visitInt64=null;w.prototype.visitUint8=null;w.prototype.visitUint16=null;w.prototype.visitUint32=null;w.prototype.visitUint64=null;w.prototype.visitFloat16=null;w.prototype.visitFloat32=null;w.prototype.visitFloat64=null;w.prototype.visitDateDay=null;w.prototype.visitDateMillisecond=null;w.prototype.visitTimestampSecond=null;w.prototype.visitTimestampMillisecond=null;w.prototype.visitTimestampMicrosecond=null;w.prototype.visitTimestampNanosecond=null;w.prototype.visitTimeSecond=null;w.prototype.visitTimeMillisecond=null;w.prototype.visitTimeMicrosecond=null;w.prototype.visitTimeNanosecond=null;w.prototype.visitDenseUnion=null;w.prototype.visitSparseUnion=null;w.prototype.visitIntervalDayTime=null;w.prototype.visitIntervalYearMonth=null;w.prototype.visitDuration=null;w.prototype.visitDurationSecond=null;w.prototype.visitDurationMillisecond=null;w.prototype.visitDurationMicrosecond=null;w.prototype.visitDurationNanosecond=null;var Ns={};br(Ns,{float64ToUint16:()=>qn,uint16ToFloat64:()=>to});var Tc=new Float64Array(1),gn=new Uint32Array(Tc.buffer);function to(r){let t=(r&31744)>>10,e=(r&1023)/1024,n=Math.pow(-1,(r&32768)>>15);switch(t){case 31:return n*(e?Number.NaN:1/0);case 0:return n*(e?6103515625e-14*e:0)}return n*Math.pow(2,t-15)*(1+e)}function qn(r){if(r!==r)return 32256;Tc[0]=r;let t=(gn[1]&2147483648)>>16&65535,e=gn[1]&2146435072,n=0;return e>=1089470464?gn[0]>0?e=31744:(e=(e&2080374784)>>16,n=(gn[1]&1048575)>>10):e<=1056964608?(n=1048576+(gn[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(gn[1]&1048575)+512>>10),t|e|n&65535}var x=class extends w{};function D(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var Mf=(r,t,e)=>{r[t]=Math.floor(e/864e5)},Dc=(r,t,e,n)=>{if(e+1<t.length){let i=C(t[e]),o=C(t[e+1]);r.set(n.subarray(0,o-i),i)}},Lf=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},rr=({values:r},t,e)=>{r[t]=e},Us=({values:r},t,e)=>{r[t]=e},Oc=({values:r},t,e)=>{r[t]=qn(e)},Nf=(r,t,e)=>{switch(r.type.precision){case P.HALF:return Oc(r,t,e);case P.SINGLE:case P.DOUBLE:return Us(r,t,e)}},eo=({values:r},t,e)=>{Mf(r,t,e.valueOf())},ro=({values:r},t,e)=>{r[t]=BigInt(e)},Es=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},Fc=({values:r,valueOffsets:t},e,n)=>Dc(r,t,e,n),Mc=({values:r,valueOffsets:t},e,n)=>Dc(r,t,e,Be(n)),Rs=(r,t,e)=>{r.type.unit===J.DAY?eo(r,t,e):ro(r,t,e)},no=({values:r},t,e)=>{r[t]=BigInt(e/1e3)},io=({values:r},t,e)=>{r[t]=BigInt(e)},oo=({values:r},t,e)=>{r[t]=BigInt(e*1e3)},so=({values:r},t,e)=>{r[t]=BigInt(e*1e6)},Cs=(r,t,e)=>{switch(r.type.unit){case h.SECOND:return no(r,t,e);case h.MILLISECOND:return io(r,t,e);case h.MICROSECOND:return oo(r,t,e);case h.NANOSECOND:return so(r,t,e)}},ao=({values:r},t,e)=>{r[t]=e},co=({values:r},t,e)=>{r[t]=e},lo=({values:r},t,e)=>{r[t]=e},uo=({values:r},t,e)=>{r[t]=e},ks=(r,t,e)=>{switch(r.type.unit){case h.SECOND:return ao(r,t,e);case h.MILLISECOND:return co(r,t,e);case h.MICROSECOND:return lo(r,t,e);case h.NANOSECOND:return uo(r,t,e)}},Ps=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},Uf=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,o=_t.getVisitFn(n);if(Array.isArray(e))for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,e[++s]);else for(let s=-1,a=i[t],c=i[t+1];a<c;)o(n,a++,e.get(++s))},Ef=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,o=_t.getVisitFn(n),{[t]:s,[t+1]:a}=i,c=e instanceof Map?e.entries():Object.entries(e);for(let l of c)if(o(n,s,l),++s>=a)break},Rf=(r,t)=>(e,n,i,o)=>n&&e(n,r,t[o]),Cf=(r,t)=>(e,n,i,o)=>n&&e(n,r,t.get(o)),kf=(r,t)=>(e,n,i,o)=>n&&e(n,r,t.get(i.name)),Pf=(r,t)=>(e,n,i,o)=>n&&e(n,r,t[i.name]),Vf=(r,t,e)=>{let n=r.type.children.map(o=>_t.getVisitFn(o.type)),i=e instanceof Map?kf(t,e):e instanceof y?Cf(t,e):Array.isArray(e)?Rf(t,e):Pf(t,e);r.type.children.forEach((o,s)=>i(n[s],r.children[s],o,s))},jf=(r,t,e)=>{r.type.mode===Y.Dense?Lc(r,t,e):Nc(r,t,e)},Lc=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];_t.visit(i,r.valueOffsets[t],e)},Nc=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];_t.visit(i,t,e)},zf=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},Vs=(r,t,e)=>{r.type.unit===Q.DAY_TIME?fo(r,t,e):ho(r,t,e)},fo=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},ho=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},po=({values:r},t,e)=>{r[t]=e},mo=({values:r},t,e)=>{r[t]=e},yo=({values:r},t,e)=>{r[t]=e},go=({values:r},t,e)=>{r[t]=e},js=(r,t,e)=>{switch(r.type.unit){case h.SECOND:return po(r,t,e);case h.MILLISECOND:return mo(r,t,e);case h.MICROSECOND:return yo(r,t,e);case h.NANOSECOND:return go(r,t,e)}},Wf=(r,t,e)=>{let{stride:n}=r,i=r.children[0],o=_t.getVisitFn(i);if(Array.isArray(e))for(let s=-1,a=t*n;++s<n;)o(i,a+s,e[s]);else for(let s=-1,a=t*n;++s<n;)o(i,a+s,e.get(s))};x.prototype.visitBool=D(Lf);x.prototype.visitInt=D(rr);x.prototype.visitInt8=D(rr);x.prototype.visitInt16=D(rr);x.prototype.visitInt32=D(rr);x.prototype.visitInt64=D(rr);x.prototype.visitUint8=D(rr);x.prototype.visitUint16=D(rr);x.prototype.visitUint32=D(rr);x.prototype.visitUint64=D(rr);x.prototype.visitFloat=D(Nf);x.prototype.visitFloat16=D(Oc);x.prototype.visitFloat32=D(Us);x.prototype.visitFloat64=D(Us);x.prototype.visitUtf8=D(Mc);x.prototype.visitLargeUtf8=D(Mc);x.prototype.visitBinary=D(Fc);x.prototype.visitLargeBinary=D(Fc);x.prototype.visitFixedSizeBinary=D(Es);x.prototype.visitDate=D(Rs);x.prototype.visitDateDay=D(eo);x.prototype.visitDateMillisecond=D(ro);x.prototype.visitTimestamp=D(Cs);x.prototype.visitTimestampSecond=D(no);x.prototype.visitTimestampMillisecond=D(io);x.prototype.visitTimestampMicrosecond=D(oo);x.prototype.visitTimestampNanosecond=D(so);x.prototype.visitTime=D(ks);x.prototype.visitTimeSecond=D(ao);x.prototype.visitTimeMillisecond=D(co);x.prototype.visitTimeMicrosecond=D(lo);x.prototype.visitTimeNanosecond=D(uo);x.prototype.visitDecimal=D(Ps);x.prototype.visitList=D(Uf);x.prototype.visitStruct=D(Vf);x.prototype.visitUnion=D(jf);x.prototype.visitDenseUnion=D(Lc);x.prototype.visitSparseUnion=D(Nc);x.prototype.visitDictionary=D(zf);x.prototype.visitInterval=D(Vs);x.prototype.visitIntervalDayTime=D(fo);x.prototype.visitIntervalYearMonth=D(ho);x.prototype.visitDuration=D(js);x.prototype.visitDurationSecond=D(po);x.prototype.visitDurationMillisecond=D(mo);x.prototype.visitDurationMicrosecond=D(yo);x.prototype.visitDurationNanosecond=D(go);x.prototype.visitFixedSizeList=D(Wf);x.prototype.visitMap=D(Ef);var _t=new x;var _e=Symbol.for("parent"),bn=Symbol.for("rowIndex"),vr=class{constructor(t,e){return this[_e]=t,this[bn]=e,new Proxy(this,new Ws)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[bn],e=this[_e],n=e.type.children,i={};for(let o=-1,s=n.length;++o<s;)i[n[o].name]=ct.visit(e.children[o],t);return i}toString(){return`{${[...this].map(([t,e])=>`${be(t)}: ${be(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new zs(this[_e],this[bn])}},zs=class{constructor(t,e){this.childIndex=0,this.children=t.children,this.rowIndex=e,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,ct.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(vr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[_e]:{writable:!0,enumerable:!1,configurable:!1,value:null},[bn]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var Ws=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[_e].type.children.map(e=>e.name)}has(t,e){return t[_e].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[_e].type.children.findIndex(n=>n.name===e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[_e].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=ct.visit(t[_e].children[n],t[bn]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[_e].type.children.findIndex(o=>o.name===e);return i!==-1?(_t.visit(t[_e].children[i],t[bn],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}};var _=class extends w{};function A(r){return(t,e)=>t.getValid(e)?r(t,e):null}var Gf=(r,t)=>864e5*r[t],$f=(r,t)=>null,Uc=(r,t,e)=>{if(e+1>=t.length)return null;let n=C(t[e]),i=C(t[e+1]);return r.subarray(n,i)},Yf=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},Ec=({values:r},t)=>Gf(r,t),Rc=({values:r},t)=>C(r[t]),Ir=({stride:r,values:t},e)=>t[r*e],Hf=({stride:r,values:t},e)=>to(t[r*e]),Cc=({values:r},t)=>r[t],Jf=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),kc=({values:r,valueOffsets:t},e)=>Uc(r,t,e),Pc=({values:r,valueOffsets:t},e)=>{let n=Uc(r,t,e);return n!==null?Gn(n):null},Kf=({values:r},t)=>r[t],Zf=({type:r,values:t},e)=>r.precision!==P.HALF?t[e]:to(t[e]),Xf=(r,t)=>r.type.unit===J.DAY?Ec(r,t):Rc(r,t),Vc=({values:r},t)=>1e3*C(r[t]),jc=({values:r},t)=>C(r[t]),zc=({values:r},t)=>Os(r[t],BigInt(1e3)),Wc=({values:r},t)=>Os(r[t],BigInt(1e6)),qf=(r,t)=>{switch(r.type.unit){case h.SECOND:return Vc(r,t);case h.MILLISECOND:return jc(r,t);case h.MICROSECOND:return zc(r,t);case h.NANOSECOND:return Wc(r,t)}},Gc=({values:r},t)=>r[t],$c=({values:r},t)=>r[t],Yc=({values:r},t)=>r[t],Hc=({values:r},t)=>r[t],Qf=(r,t)=>{switch(r.type.unit){case h.SECOND:return Gc(r,t);case h.MILLISECOND:return $c(r,t);case h.MICROSECOND:return Yc(r,t);case h.NANOSECOND:return Hc(r,t)}},td=({values:r,stride:t},e)=>Lr.decimal(r.subarray(t*e,t*(e+1))),ed=(r,t)=>{let{valueOffsets:e,stride:n,children:i}=r,{[t*n]:o,[t*n+1]:s}=e,c=i[0].slice(o,s-o);return new y([c])},rd=(r,t)=>{let{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:o}=e,s=n[0];return new He(s.slice(i,o-i))},nd=(r,t)=>new vr(r,t),id=(r,t)=>r.type.mode===Y.Dense?Jc(r,t):Kc(r,t),Jc=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return ct.visit(n,r.valueOffsets[t])},Kc=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return ct.visit(n,t)},od=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},sd=(r,t)=>r.type.unit===Q.DAY_TIME?Zc(r,t):Xc(r,t),Zc=({values:r},t)=>r.subarray(2*t,2*(t+1)),Xc=({values:r},t)=>{let e=r[t],n=new Int32Array(2);return n[0]=Math.trunc(e/12),n[1]=Math.trunc(e%12),n},qc=({values:r},t)=>r[t],Qc=({values:r},t)=>r[t],tl=({values:r},t)=>r[t],el=({values:r},t)=>r[t],ad=(r,t)=>{switch(r.type.unit){case h.SECOND:return qc(r,t);case h.MILLISECOND:return Qc(r,t);case h.MICROSECOND:return tl(r,t);case h.NANOSECOND:return el(r,t)}},cd=(r,t)=>{let{stride:e,children:n}=r,o=n[0].slice(t*e,e);return new y([o])};_.prototype.visitNull=A($f);_.prototype.visitBool=A(Yf);_.prototype.visitInt=A(Kf);_.prototype.visitInt8=A(Ir);_.prototype.visitInt16=A(Ir);_.prototype.visitInt32=A(Ir);_.prototype.visitInt64=A(Cc);_.prototype.visitUint8=A(Ir);_.prototype.visitUint16=A(Ir);_.prototype.visitUint32=A(Ir);_.prototype.visitUint64=A(Cc);_.prototype.visitFloat=A(Zf);_.prototype.visitFloat16=A(Hf);_.prototype.visitFloat32=A(Ir);_.prototype.visitFloat64=A(Ir);_.prototype.visitUtf8=A(Pc);_.prototype.visitLargeUtf8=A(Pc);_.prototype.visitBinary=A(kc);_.prototype.visitLargeBinary=A(kc);_.prototype.visitFixedSizeBinary=A(Jf);_.prototype.visitDate=A(Xf);_.prototype.visitDateDay=A(Ec);_.prototype.visitDateMillisecond=A(Rc);_.prototype.visitTimestamp=A(qf);_.prototype.visitTimestampSecond=A(Vc);_.prototype.visitTimestampMillisecond=A(jc);_.prototype.visitTimestampMicrosecond=A(zc);_.prototype.visitTimestampNanosecond=A(Wc);_.prototype.visitTime=A(Qf);_.prototype.visitTimeSecond=A(Gc);_.prototype.visitTimeMillisecond=A($c);_.prototype.visitTimeMicrosecond=A(Yc);_.prototype.visitTimeNanosecond=A(Hc);_.prototype.visitDecimal=A(td);_.prototype.visitList=A(ed);_.prototype.visitStruct=A(nd);_.prototype.visitUnion=A(id);_.prototype.visitDenseUnion=A(Jc);_.prototype.visitSparseUnion=A(Kc);_.prototype.visitDictionary=A(od);_.prototype.visitInterval=A(sd);_.prototype.visitIntervalDayTime=A(Zc);_.prototype.visitIntervalYearMonth=A(Xc);_.prototype.visitDuration=A(ad);_.prototype.visitDurationSecond=A(qc);_.prototype.visitDurationMillisecond=A(Qc);_.prototype.visitDurationMicrosecond=A(tl);_.prototype.visitDurationNanosecond=A(el);_.prototype.visitFixedSizeList=A(cd);_.prototype.visitMap=A(rd);var ct=new _;var Sr=Symbol.for("keys"),_n=Symbol.for("vals"),wn=Symbol.for("kKeysAsStrings"),Gs=Symbol.for("_kKeysAsStrings"),He=class{constructor(t){return this[Sr]=new y([t.children[0]]).memoize(),this[_n]=t.children[1],new Proxy(this,new Ys)}get[wn](){return this[Gs]||(this[Gs]=Array.from(this[Sr].toArray(),String))}[Symbol.iterator](){return new $s(this[Sr],this[_n])}get size(){return this[Sr].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Sr],e=this[_n],n={};for(let i=-1,o=t.length;++i<o;)n[t.get(i)]=ct.visit(e,i);return n}toString(){return`{${[...this].map(([t,e])=>`${be(t)}: ${be(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},$s=class{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),ct.visit(this.vals,t)]})}},Ys=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[wn]}has(t,e){return t[wn].includes(e)}getOwnPropertyDescriptor(t,e){if(t[wn].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[wn].indexOf(e);if(n!==-1){let i=ct.visit(Reflect.get(t,_n),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[wn].indexOf(e);return i!==-1?(_t.visit(Reflect.get(t,_n),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(He.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Sr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[_n]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Gs]:{writable:!0,enumerable:!1,configurable:!1,value:null}});var rl;function Qn(r,t,e,n){let{length:i=0}=r,o=typeof t!="number"?0:t,s=typeof e!="number"?i:e;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(rl=o,o=s,s=rl),s>i&&(s=i),n?n(r,o,s):[o,s]}var Gr=(r,t)=>r<0?t+r:r,nl=r=>r!==r;function xr(r){if(typeof r!=="object"||r===null)return nl(r)?nl:e=>e===r;if(r instanceof Date){let e=r.valueOf();return n=>n instanceof Date?n.valueOf()===e:!1}return ArrayBuffer.isView(r)?e=>e?xs(r,e):!1:r instanceof Map?ud(r):Array.isArray(r)?ld(r):r instanceof y?fd(r):dd(r,!0)}function ld(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=xr(r[e]);return bo(t)}function ud(r){let t=-1,e=[];for(let n of r.values())e[++t]=xr(n);return bo(e)}function fd(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=xr(r.get(e));return bo(t)}function dd(r,t=!1){let e=Object.keys(r);if(!t&&e.length===0)return()=>!1;let n=[];for(let i=-1,o=e.length;++i<o;)n[i]=xr(r[e[i]]);return bo(n,e)}function bo(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return hd(r,e);case Map:return il(r,e,e.keys());case He:case vr:case Object:case void 0:return il(r,e,t||Object.keys(e))}return e instanceof y?pd(r,e):!1}}function hd(r,t){let e=r.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!r[n](t[n]))return!1;return!0}function pd(r,t){let e=r.length;if(t.length!==e)return!1;for(let n=-1;++n<e;)if(!r[n](t.get(n)))return!1;return!0}function il(r,t,e){let n=e[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),o=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),s=0,a=r.length,c=o.next(),l=n.next(),f=i.next();for(;s<a&&!l.done&&!f.done&&!c.done&&!(l.value!==f.value||!r[s](c.value));++s,l=n.next(),f=i.next(),c=o.next());return s===a&&l.done&&f.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),o.return&&o.return(),!1)}var Js={};br(Js,{BitIterator:()=>$r,getBit:()=>ol,getBool:()=>_o,packBools:()=>Hr,popcnt_array:()=>sl,popcnt_bit_range:()=>ti,popcnt_uint32:()=>wo,setBool:()=>md,truncateBitmap:()=>Yr});function _o(r,t,e,n){return(e&1<<n)!==0}function ol(r,t,e,n){return(e&1<<n)>>n}function md(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function Yr(r,t,e){let n=e.byteLength+7&-8;if(r>0||e.byteLength<n){let i=new Uint8Array(n);return i.set(r%8===0?e.subarray(r>>3):Hr(new $r(e,r,t,null,_o)).subarray(0,n)),i}return e}function Hr(r){let t=[],e=0,n=0,i=0;for(let s of r)s&&(i|=1<<n),++n===8&&(t[e++]=i,i=n=0);(e===0||n>0)&&(t[e++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}var $r=class{constructor(t,e,n,i,o){this.bytes=t,this.length=n,this.context=i,this.get=o,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function ti(r,t,e){if(e-t<=0)return 0;if(e-t<8){let o=0;for(let s of new $r(r,t,e-t,r,ol))o+=s;return o}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return ti(r,t,i)+ti(r,n,e)+sl(r,i>>3,n-i>>3)}function sl(r,t,e){let n=0,i=Math.trunc(t),o=new DataView(r.buffer,r.byteOffset,r.byteLength),s=e===void 0?r.byteLength:i+e;for(;s-i>=4;)n+=wo(o.getUint32(i)),i+=4;for(;s-i>=2;)n+=wo(o.getUint16(i)),i+=2;for(;s-i>=1;)n+=wo(o.getUint8(i)),i+=1;return n}function wo(r){let t=Math.trunc(r);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var yd=-1,M=class{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return p.isSparseUnion(t)?this.children.some(e=>e.nullable):p.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:e,values:n,nullBitmap:i,typeIds:o}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(p.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,e;return t<=yd&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-ti(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,i,o,s=[],a){this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let c;o instanceof M?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets):(this.stride=ie(t),o&&((c=o[0])&&(this.valueOffsets=c),(c=o[1])&&(this.values=c),(c=o[2])&&(this.nullBitmap=c),(c=o[3])&&(this.typeIds=c)))}getValid(t){let{type:e}=this;if(p.isUnion(e)){let n=e,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],o=n.mode===Y.Dense?this.valueOffsets[t]:t;return i.getValid(o)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,e){let n,{type:i}=this;if(p.isUnion(i)){let o=i,s=this.children[o.typeIdToChildIndex[this.typeIds[t]]],a=o.mode===Y.Dense?this.valueOffsets[t]:t;n=s.getValid(a),s.setValid(a,e)}else{let{nullBitmap:o}=this,{offset:s,length:a}=this,c=s+t,l=1<<c%8,f=c>>3;(!o||o.byteLength<=f)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0?(o.set(Yr(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o})):Object.assign(this,{nullBitmap:o,_nullCount:0}));let d=o[f];n=(d&l)!==0,o[f]=e?d|l:d&~l}return n!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,n=this.length,i=this._nullCount,o=this,s=this.children){return new M(t,e,n,i,o,s,this.dictionary)}slice(t,e){let{stride:n,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===u.Null)return this.clone(this.type,0,t,0);let{length:e,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);i[e>>3]=(1<<e-(e&-8))-1,n>0&&i.set(Yr(this.offset,e,this.nullBitmap),0);let o=this.buffers;return o[rt.VALIDITY]=i,this.clone(this.type,0,t,n+(t-e),o)}_sliceBuffers(t,e,n,i){let o,{buffers:s}=this;return(o=s[rt.TYPE])&&(s[rt.TYPE]=o.subarray(t,t+e)),(o=s[rt.OFFSET])&&(s[rt.OFFSET]=o.subarray(t,t+e+1))||(o=s[rt.DATA])&&(s[rt.DATA]=i===6?o:o.subarray(n*t,n*(t+e))),s}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};M.prototype.children=Object.freeze([]);var Jr=class extends w{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:n=0,["length"]:i=0}=t;return new M(e,n,i,i)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.data),o=B(t.nullBitmap),s=Mr(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[s,i,o])}visitLargeUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.data),o=B(t.nullBitmap),s=Ji(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[s,i,o])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.data),o=B(t.nullBitmap),s=Mr(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[s,i,o])}visitLargeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.data),o=B(t.nullBitmap),s=Ji(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,o=B(t.nullBitmap),s=Mr(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,o=B(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,o=E(e.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(p.isSparseUnion(e))return new M(e,n,s,a,[void 0,void 0,void 0,o],i);let c=Mr(t.valueOffsets);return new M(e,n,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.indices.ArrayType,t.data),{["dictionary"]:s=new y([new Jr().visit({type:e.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:e,["offset"]:n=0}=t,i=B(t.nullBitmap),o=E(e.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new Jr().visit({type:e.valueType})}=t,o=B(t.nullBitmap),{["length"]:s=i.length/ie(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new M(e,n,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new Jr().visit({type:e.childType})}=t,o=B(t.nullBitmap),s=Mr(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new M(e,n,a,c,[s,void 0,o],[i])}},gd=new Jr;function b(r){return gd.visit(r)}var ei=class{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function al(r){return r.some(t=>t.nullable)}function vo(r){return r.reduce((t,e)=>t+e.nullCount,0)}function Io(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function So(r,t,e,n){let i=[];for(let o=-1,s=r.length;++o<s;){let a=r[o],c=t[o],{length:l}=a;if(c>=n)break;if(e>=c+l)continue;if(c>=e&&c+l<=n){i.push(a);continue}let f=Math.max(0,e-c),d=Math.min(n-c,l);i.push(a.slice(f,d-f))}return i.length===0&&i.push(r[0].slice(0,0)),i}function Ks(r,t,e,n){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return e<t[s]?n(r,i,e-t[i]):null;o=i+Math.trunc((s-i)*.5),e<t[o]?s=o:i=o}while(i<s)}function ri(r,t){return r.getValid(t)}function vn(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return Ks(n,this._offsets,e,t)}}function xo(r){let t;function e(n,i,o){return r(n[i],o,t)}return function(n,i){let o=this.data;t=i;let s=Ks(o,this._offsets,n,e);return t=void 0,s}}function Bo(r){let t;function e(n,i,o){let s=o,a=0,c=0;for(let l=i-1,f=n.length;++l<f;){let d=n[l];if(~(a=r(d,t,s)))return c+a;s=0,c+=d.length}return-1}return function(n,i){t=n;let o=this.data,s=typeof i!="number"?e(o,0,0):Ks(o,this._offsets,i,e);return t=void 0,s}}var v=class extends w{};function bd(r,t){return t===null&&r.length>0?0:-1}function wd(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new $r(e,r.offset+(t||0),r.length,e,_o)){if(!i)return n;++n}return-1}function F(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case u.Union:break;case u.Dictionary:break;default:return wd(r,e)}let n=ct.getVisitFn(r),i=xr(t);for(let o=(e||0)-1,s=r.length;++o<s;)if(i(n(r,o)))return o;return-1}function cl(r,t,e){let n=ct.getVisitFn(r),i=xr(t);for(let o=(e||0)-1,s=r.length;++o<s;)if(i(n(r,o)))return o;return-1}v.prototype.visitNull=bd;v.prototype.visitBool=F;v.prototype.visitInt=F;v.prototype.visitInt8=F;v.prototype.visitInt16=F;v.prototype.visitInt32=F;v.prototype.visitInt64=F;v.prototype.visitUint8=F;v.prototype.visitUint16=F;v.prototype.visitUint32=F;v.prototype.visitUint64=F;v.prototype.visitFloat=F;v.prototype.visitFloat16=F;v.prototype.visitFloat32=F;v.prototype.visitFloat64=F;v.prototype.visitUtf8=F;v.prototype.visitLargeUtf8=F;v.prototype.visitBinary=F;v.prototype.visitLargeBinary=F;v.prototype.visitFixedSizeBinary=F;v.prototype.visitDate=F;v.prototype.visitDateDay=F;v.prototype.visitDateMillisecond=F;v.prototype.visitTimestamp=F;v.prototype.visitTimestampSecond=F;v.prototype.visitTimestampMillisecond=F;v.prototype.visitTimestampMicrosecond=F;v.prototype.visitTimestampNanosecond=F;v.prototype.visitTime=F;v.prototype.visitTimeSecond=F;v.prototype.visitTimeMillisecond=F;v.prototype.visitTimeMicrosecond=F;v.prototype.visitTimeNanosecond=F;v.prototype.visitDecimal=F;v.prototype.visitList=F;v.prototype.visitStruct=F;v.prototype.visitUnion=F;v.prototype.visitDenseUnion=cl;v.prototype.visitSparseUnion=cl;v.prototype.visitDictionary=F;v.prototype.visitInterval=F;v.prototype.visitIntervalDayTime=F;v.prototype.visitIntervalYearMonth=F;v.prototype.visitDuration=F;v.prototype.visitDurationSecond=F;v.prototype.visitDurationMillisecond=F;v.prototype.visitDurationMicrosecond=F;v.prototype.visitDurationNanosecond=F;v.prototype.visitFixedSizeList=F;v.prototype.visitMap=F;var Kr=new v;var I=class extends w{};function T(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(p.isInt(t)&&t.bitWidth!==64||p.isTime(t)&&t.bitWidth!==64||p.isFloat(t)&&t.precision!==P.HALF))return new ei(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new ei(r.data.length,n=>{let o=r.data[n].length,s=r.slice(e,e+o);return e+=o,new Zs(s)})}var Zs=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};I.prototype.visitNull=T;I.prototype.visitBool=T;I.prototype.visitInt=T;I.prototype.visitInt8=T;I.prototype.visitInt16=T;I.prototype.visitInt32=T;I.prototype.visitInt64=T;I.prototype.visitUint8=T;I.prototype.visitUint16=T;I.prototype.visitUint32=T;I.prototype.visitUint64=T;I.prototype.visitFloat=T;I.prototype.visitFloat16=T;I.prototype.visitFloat32=T;I.prototype.visitFloat64=T;I.prototype.visitUtf8=T;I.prototype.visitLargeUtf8=T;I.prototype.visitBinary=T;I.prototype.visitLargeBinary=T;I.prototype.visitFixedSizeBinary=T;I.prototype.visitDate=T;I.prototype.visitDateDay=T;I.prototype.visitDateMillisecond=T;I.prototype.visitTimestamp=T;I.prototype.visitTimestampSecond=T;I.prototype.visitTimestampMillisecond=T;I.prototype.visitTimestampMicrosecond=T;I.prototype.visitTimestampNanosecond=T;I.prototype.visitTime=T;I.prototype.visitTimeSecond=T;I.prototype.visitTimeMillisecond=T;I.prototype.visitTimeMicrosecond=T;I.prototype.visitTimeNanosecond=T;I.prototype.visitDecimal=T;I.prototype.visitList=T;I.prototype.visitStruct=T;I.prototype.visitUnion=T;I.prototype.visitDenseUnion=T;I.prototype.visitSparseUnion=T;I.prototype.visitDictionary=T;I.prototype.visitInterval=T;I.prototype.visitIntervalDayTime=T;I.prototype.visitIntervalYearMonth=T;I.prototype.visitDuration=T;I.prototype.visitDurationSecond=T;I.prototype.visitDurationMillisecond=T;I.prototype.visitDurationMicrosecond=T;I.prototype.visitDurationNanosecond=T;I.prototype.visitFixedSizeList=T;I.prototype.visitMap=T;var In=new I;var ll,ul={},fl={},y=class{constructor(t){var e,n,i;let o=t[0]instanceof y?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof M)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(e=o[0])===null||e===void 0?void 0:e.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=ul[s.typeId],f=o[0];this.isValid=d=>ri(f,d),this.get=d=>a(f,d),this.set=(d,V)=>c(f,d,V),this.indexOf=d=>l(f,d),this._offsets=[0,f.length];break}default:Object.setPrototypeOf(this,fl[s.typeId]),this._offsets=Io(o);break}this.data=o,this.type=s,this.stride=ie(s),this.numChildren=(i=(n=s.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return al(this.data)}get nullCount(){return vo(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${u[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(Gr(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return In.visit(this)}concat(...t){return new y(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new y(Qn(this,t,e,({data:n,_offsets:i},o,s)=>So(n,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:i,ArrayType:o}=this;switch(t.typeId){case u.Int:case u.Float:case u.Decimal:case u.Time:case u.Timestamp:switch(e.length){case 0:return new o;case 1:return e[0].values.subarray(0,n*i);default:return e.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var e;return this.getChildAt((e=this.type.children)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new y(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return p.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(p.isDictionary(this.type)){let t=new Sn(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new y(e)}return new Sn(this)}unmemoize(){if(p.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new y(e)}return this}};ll=Symbol.toStringTag;y[ll]=(r=>{r.type=p.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;let t=Object.keys(u).map(e=>u[e]).filter(e=>typeof e=="number"&&e!==u.NONE);for(let e of t){let n=ct.getVisitFnByTypeId(e),i=_t.getVisitFnByTypeId(e),o=Kr.getVisitFnByTypeId(e);ul[e]={get:n,set:i,indexOf:o},fl[e]=Object.create(r,{isValid:{value:vn(ri)},get:{value:vn(ct.getVisitFnByTypeId(e))},set:{value:xo(_t.getVisitFnByTypeId(e))},indexOf:{value:Bo(Kr.getVisitFnByTypeId(e))}})}return"Vector"})(y.prototype);var Sn=class extends y{constructor(t){super(t.data);let e=this.get,n=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=e.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){n.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new Sn(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new y(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function xn(r){if(r){if(r instanceof M)return new y([r]);if(r instanceof y)return new y(r.data);if(r.type instanceof p)return new y([b(r)]);if(Array.isArray(r))return new y(r.flatMap(t=>_d(t)));if(ArrayBuffer.isView(r)){r instanceof DataView&&(r=new Uint8Array(r.buffer));let t={offset:0,length:r.length,nullCount:-1,data:r};if(r instanceof Int8Array)return new y([b(Object.assign(Object.assign({},t),{type:new Re}))]);if(r instanceof Int16Array)return new y([b(Object.assign(Object.assign({},t),{type:new Ce}))]);if(r instanceof Int32Array)return new y([b(Object.assign(Object.assign({},t),{type:new yt}))]);if(r instanceof BigInt64Array)return new y([b(Object.assign(Object.assign({},t),{type:new ce}))]);if(r instanceof Uint8Array||r instanceof Uint8ClampedArray)return new y([b(Object.assign(Object.assign({},t),{type:new ke}))]);if(r instanceof Uint16Array)return new y([b(Object.assign(Object.assign({},t),{type:new Pe}))]);if(r instanceof Uint32Array)return new y([b(Object.assign(Object.assign({},t),{type:new Ve}))]);if(r instanceof BigUint64Array)return new y([b(Object.assign(Object.assign({},t),{type:new je}))]);if(r instanceof Float32Array)return new y([b(Object.assign(Object.assign({},t),{type:new ze}))]);if(r instanceof Float64Array)return new y([b(Object.assign(Object.assign({},t),{type:new le}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function _d(r){return r instanceof M?[r]:r instanceof y?r.data:xn(r).data}function dl(r){if(!r||r.length<=0)return function(i){return!0};let t="",e=r.filter(n=>n===n);return e.length>0&&(t=`
|
|
8
8
|
switch (x) {${e.map(n=>`
|
|
9
9
|
case ${vd(n)}:`).join("")}
|
|
10
10
|
return false;
|
|
@@ -13,11 +13,11 @@ ${t}`),new Function("x",`${t}
|
|
|
13
13
|
return true;`)}function vd(r){return typeof r!="bigint"?be(r):`${be(r)}n`}function Xs(r,t){let e=Math.ceil(r)*t-1;return(e-e%64+64||64)/t}function hl(r,t=0){return r.length>=t?r.subarray(0,t):Yn(new r.constructor(t),r,0)}var ve=class{constructor(t,e=0,n=1){this.length=Math.ceil(e/n),this.buffer=new t(this.length),this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,e){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let e=this.stride,n=this.length*e,i=this.buffer.length;n>=i&&this._resize(i===0?Xs(n*1,this.BYTES_PER_ELEMENT):Xs(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Xs(t*this.stride,this.BYTES_PER_ELEMENT);let e=hl(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=hl(this.buffer,t)}},nr=class extends ve{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,e){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=e,this}},Bn=class extends nr{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,e){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=n[i]>>o&1;return e?s===0&&(n[i]|=1<<o,++this.numValid):s===1&&(n[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},An=class extends nr{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,e){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&n>=0&&i.fill(i[n],n,t),i[t]=i[t-1]+e,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var q=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:e}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=e,this.stride=ie(t),this._nulls=new Bn,e&&e.length>0&&(this._isValid=dl(e))}toVector(){return new y([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:e,_values:n,_nulls:i,_typeIds:o,children:s}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((e,n)=>e+n.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,e){return this.setValid(t,this.isValid(e))&&this.setValue(t,e),this}setValue(t,e){this._setValue(this,t,e)}setValid(t,e){return this.length=this._nulls.set(t,+e).length,e}addChild(t,e=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,e,n,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:f,_nulls:d}=this;(e=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=f?.flush(l.last()):t=f?.flush(s),a>0&&(n=d?.flush(s));let V=this.children.map(N=>N.flush());return this.clear(),b({type:o,length:s,nullCount:a,children:V,child:V[0],data:t,typeIds:e,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,e,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(e=this._values)===null||e===void 0||e.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};q.prototype.length=1;q.prototype.stride=1;q.prototype.children=null;q.prototype.finished=!1;q.prototype.nullValues=null;q.prototype._isValid=()=>!0;var lt=class extends q{constructor(t){super(t),this._values=new nr(this.ArrayType,0,this.stride)}setValue(t,e){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}},Ht=class extends q{constructor(t){super(t),this._pendingLength=0,this._offsets=new An(t.type)}setValue(t,e){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=e instanceof He?e[Sr].length:e.length,n.set(t,e)}setValid(t,e){return super.setValid(t,e)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,e=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,e),this}};var Zr=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}offset(){return this.bb.readInt64(this.bb_pos)}metaDataLength(){return this.bb.readInt32(this.bb_pos+8)}bodyLength(){return this.bb.readInt64(this.bb_pos+16)}static sizeOf(){return 24}static createBlock(t,e,n,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(e??0)),t.offset()}};var Dt=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsFooter(t,e){return(e||new Dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new Dt).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):z.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new tt).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){let n=this.bb.__offset(this.bb_pos,8);return n?(e||new Zr).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){let n=this.bb.__offset(this.bb_pos,10);return n?(e||new Zr).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new K).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,z.V1)}static addSchema(t,e){t.addFieldOffset(1,e,0)}static addDictionaries(t,e){t.addFieldOffset(2,e,0)}static startDictionariesVector(t,e){t.startVector(24,e,8)}static addRecordBatches(t,e){t.addFieldOffset(3,e,0)}static startRecordBatchesVector(t,e){t.startVector(24,e,8)}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,e){t.finish(e)}static finishSizePrefixedFooterBuffer(t,e){t.finish(e,void 0,!0)}};var U=class{constructor(t=[],e,n,i=z.V5){this.fields=t||[],this.metadata=e||new Map,n||(n=qs(this.fields)),this.dictionaries=n,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,e)=>`${e}: ${t}`).join(", ")} }>`}select(t){let e=new Set(t),n=this.fields.filter(i=>e.has(i.name));return new U(n,this.metadata)}selectAt(t){let e=t.map(n=>this.fields[n]).filter(Boolean);return new U(e,this.metadata)}assign(...t){let e=t[0]instanceof U?t[0]:Array.isArray(t[0])?new U(t[0]):new U(t),n=[...this.fields],i=Ao(Ao(new Map,this.metadata),e.metadata),o=e.fields.filter(a=>{let c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:Ao(Ao(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),s=qs(o,new Map);return new U([...n,...o],i,new Map([...this.dictionaries,...s]))}};U.prototype.fields=null;U.prototype.metadata=null;U.prototype.dictionaries=null;var O=class{static new(...t){let[e,n,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new O(`${e}`,n,i,o)}constructor(t,e,n=!1,i){this.name=t,this.type=e,this.nullable=n,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,n,i,o]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,n=this.type,i=this.nullable,o=this.metadata]=t:{name:e=this.name,type:n=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],O.new(e,n,i,o)}};O.prototype.type=null;O.prototype.name=null;O.prototype.nullable=null;O.prototype.metadata=null;function Ao(r,t){return new Map([...r||new Map,...t||new Map])}function qs(r,t=new Map){for(let e=-1,n=r.length;++e<n;){let o=r[e].type;if(p.isDictionary(o)){if(!t.has(o.id))t.set(o.id,o.dictionary);else if(t.get(o.id)!==o.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&qs(o.children,t)}return t}var Id=tr,Sd=Ft,ir=class{static decode(t){t=new Sd(B(t));let e=Dt.getRootAsFooter(t),n=U.decode(e.schema(),new Map,e.version());return new Qs(n,e)}static encode(t){let e=new Id,n=U.encode(e,t.schema);Dt.startRecordBatchesVector(e,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())Ie.encode(e,s);let i=e.endVector();Dt.startDictionariesVector(e,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())Ie.encode(e,s);let o=e.endVector();return Dt.startFooter(e),Dt.addSchema(e,n),Dt.addVersion(e,z.V5),Dt.addRecordBatches(e,i),Dt.addDictionaries(e,o),Dt.finishFooterBuffer(e,Dt.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=z.V5,n,i){this.schema=t,this.version=e,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,e=-1,n=this.numRecordBatches;++e<n;)(t=this.getRecordBatch(e))&&(yield t)}*dictionaryBatches(){for(let t,e=-1,n=this.numDictionaries;++e<n;)(t=this.getDictionaryBatch(e))&&(yield t)}getRecordBatch(t){return t>=0&&t<this.numRecordBatches&&this._recordBatches[t]||null}getDictionaryBatch(t){return t>=0&&t<this.numDictionaries&&this._dictionaryBatches[t]||null}};var Qs=class extends ir{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,e){super(t,e.version()),this._footer=e}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let e=this._footer.recordBatches(t);if(e)return Ie.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return Ie.decode(e)}return null}},Ie=class{static decode(t){return new Ie(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){let{metaDataLength:n}=e,i=BigInt(e.offset),o=BigInt(e.bodyLength);return Zr.createBlock(t,i,n,o)}constructor(t,e,n){this.metaDataLength=t,this.offset=C(n),this.bodyLength=C(e)}};var Z=Object.freeze({done:!0,value:void 0}),ni=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Xr=class{tee(){return this._getDOMStream().tee()}pipe(t,e){return this._getNodeStream().pipe(t,e)}pipeTo(t,e){return this._getDOMStream().pipeTo(t,e)}pipeThrough(t,e){return this._getDOMStream().pipeThrough(t,e)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},To=class extends Xr{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return m(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(Z);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return bt.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return bt.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return m(this,void 0,void 0,function*(){return yield this.abort(t),Z})}return(t){return m(this,void 0,void 0,function*(){return yield this.close(),Z})}read(t){return m(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return m(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((e,n)=>{this.resolvers.push({resolve:e,reject:n})}):Promise.resolve(Z)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var Je=class extends To{write(t){if((t=B(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Gn(this.toUint8Array(!0)):this.toUint8Array(!1).then(Gn)}toUint8Array(t=!1){return t?te(this._values)[0]:(()=>m(this,void 0,void 0,function*(){var e,n,i,o;let s=[],a=0;try{for(var c=!0,l=he(this),f;f=yield l.next(),e=f.done,!e;c=!0){o=f.value,c=!1;let d=o;s.push(d),a+=d.byteLength}}catch(d){n={error:d}}finally{try{!c&&!e&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return te(s,a)[0]}))()}},Ke=class{constructor(t){t&&(this.source=new ta(bt.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)}},Jt=class{constructor(t){t instanceof Jt?this.source=t.source:t instanceof Je?this.source=new or(bt.fromAsyncIterable(t)):Hi(t)?this.source=new or(bt.fromNodeStream(t)):$n(t)?this.source=new or(bt.fromDOMStream(t)):$i(t)?this.source=new or(bt.fromDOMStream(t.body)):pe(t)?this.source=new or(bt.fromIterable(t)):Qt(t)?this.source=new or(bt.fromAsyncIterable(t)):oe(t)&&(this.source=new or(bt.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)}},ta=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,e="read"){return this.source.next({cmd:e,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||Z)}return(t){return Object.create(this.source.return&&this.source.return(t)||Z)}},or=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return m(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return m(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return m(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return m(this,arguments,void 0,function*(e,n="read"){return yield this.source.next({cmd:n,size:e})})}throw(t){return m(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||Z;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return m(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||Z;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var ii=class extends Ke{constructor(t,e){super(),this.position=0,this.buffer=B(t),this.size=e===void 0?this.buffer.byteLength:e}readInt32(t){let{buffer:e,byteOffset:n}=this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:e,size:n,position:i}=this;return e&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),e.subarray(i,this.position)):null}readAt(t,e){let n=this.buffer,i=Math.min(this.size,t+e);return n?n.subarray(t,i):new Uint8Array(e)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Br=class extends Jt{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=(()=>m(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return m(this,void 0,void 0,function*(){let{buffer:e,byteOffset:n}=yield this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)})}seek(t){return m(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 m(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:e,size:n,position:i}=this;if(e&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(n,o+Math.min(n-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield e.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,e){return m(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+e<i){let o=Math.min(i,t+e),s=new Uint8Array(o-t);return(yield n.read(s,0,e,t)).buffer}return new Uint8Array(e)})}close(){return m(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return m(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return m(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var ra={};br(ra,{BaseInt64:()=>oi,Int128:()=>Kt,Int64:()=>gt,Uint64:()=>j});function Tn(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}var Dn=8,ea=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],oi=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let e=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=e[3]*n[3];this.buffer[0]=i&65535;let o=i>>>16;return i=e[2]*n[3],o+=i,i=e[3]*n[2]>>>0,o+=i,this.buffer[0]+=o<<16,this.buffer[1]=o>>>0<i?65536:0,this.buffer[1]+=o>>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}_plus(t){let e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${Tn(this.buffer[1])} ${Tn(this.buffer[0])}`}},j=class extends oi{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return j.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return j.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.length,i=new j(e);for(let o=0;o<n;){let s=Dn<n-o?Dn:n-o,a=new j(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new j(new Uint32Array([ea[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)j.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new j(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new j(new Uint32Array(t.buffer)).plus(e)}},gt=class extends oi{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let e=this.buffer[1]<<0,n=t.buffer[1]<<0;return e<n||e===n&&this.buffer[0]<t.buffer[0]}static from(t,e=new Uint32Array(2)){return gt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return gt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,o=new gt(e);for(let s=n?1:0;s<i;){let a=Dn<i-s?Dn:i-s,c=new gt(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new gt(new Uint32Array([ea[a],0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)gt.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new gt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new gt(new Uint32Array(t.buffer)).plus(e)}},Kt=class{constructor(t){this.buffer=t}high(){return new gt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new gt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let e=new j(new Uint32Array([this.buffer[3],0])),n=new j(new Uint32Array([this.buffer[2],0])),i=new j(new Uint32Array([this.buffer[1],0])),o=new j(new Uint32Array([this.buffer[0],0])),s=new j(new Uint32Array([t.buffer[3],0])),a=new j(new Uint32Array([t.buffer[2],0])),c=new j(new Uint32Array([t.buffer[1],0])),l=new j(new Uint32Array([t.buffer[0],0])),f=j.multiply(o,l);this.buffer[0]=f.low();let d=new j(new Uint32Array([f.high(),0]));return f=j.multiply(i,l),d.plus(f),f=j.multiply(o,c),d.plus(f),this.buffer[1]=d.low(),this.buffer[3]=d.lessThan(f)?1:0,this.buffer[2]=d.high(),new j(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(j.multiply(n,l)).plus(j.multiply(i,c)).plus(j.multiply(o,a)),this.buffer[3]+=j.multiply(e,l).plus(j.multiply(n,c)).plus(j.multiply(i,a)).plus(j.multiply(o,s)).low(),this}plus(t){let e=new Uint32Array(4);return e[3]=this.buffer[3]+t.buffer[3]>>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]<this.buffer[0]>>>0&&++e[1],e[1]<this.buffer[1]>>>0&&++e[2],e[2]<this.buffer[2]>>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${Tn(this.buffer[3])} ${Tn(this.buffer[2])} ${Tn(this.buffer[1])} ${Tn(this.buffer[0])}`}static multiply(t,e){return new Kt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Kt(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return Kt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return Kt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,o=new Kt(e);for(let s=n?1:0;s<i;){let a=Dn<i-s?Dn:i-s,c=new Kt(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new Kt(new Uint32Array([ea[a],0,0,0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let e=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)Kt.from(t[n],new Uint32Array(e.buffer,e.byteOffset+4*4*n,4));return e}};var si=class extends w{constructor(t,e,n,i,o=z.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=i,this.metadataVersion=o}visit(t){return super.visit(t instanceof O?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return b({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitFixedSizeBinary(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<z.V5&&this.readNullBitmap(t,n),t.mode===Y.Sparse?this.visitSparseUnion(t,{length:e,nullCount:n}):this.visitDenseUnion(t,{length:e,nullCount:n})}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:e,nullCount:n}=this.nextFieldNode()){return b({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}nextFieldNode(){return this.nodes[++this.nodesIndex]}nextBufferRange(){return this.buffers[++this.buffersIndex]}readNullBitmap(t,e,n=this.nextBufferRange()){return e>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,e){return this.readData(t,e)}readTypeIds(t,e){return this.readData(t,e)}readData(t,{length:e,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+e)}readDictionary(t){return this.dictionaries.get(t.id)}},Do=class extends si{constructor(t,e,n,i,o){super(new Uint8Array(0),e,n,i,o),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):Hr(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return E(Uint8Array,E(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return E(Uint8Array,E(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:n}=this;return p.isTimestamp(t)?E(Uint8Array,gt.convertArray(n[e])):(p.isInt(t)||p.isTime(t))&&t.bitWidth===64||p.isDuration(t)?E(Uint8Array,gt.convertArray(n[e])):p.isDate(t)&&t.unit===J.MILLISECOND?E(Uint8Array,gt.convertArray(n[e])):p.isDecimal(t)?E(Uint8Array,Kt.convertArray(n[e])):p.isBinary(t)||p.isLargeBinary(t)||p.isFixedSizeBinary(t)?xd(n[e]):p.isBool(t)?Hr(n[e]):p.isUtf8(t)||p.isLargeUtf8(t)?Be(n[e].join("")):E(Uint8Array,E(t.ArrayType,n[e].map(i=>+i)))}};function xd(r){let t=r.join(""),e=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)e[n>>1]=Number.parseInt(t.slice(n,n+2),16);return e}var On=class extends Ht{constructor(t){super(t),this._values=new ve(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,B(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,0);else{let c=a.length;i.set(a,o),n.set(s,c),o+=c}}};var Fn=class extends Ht{constructor(t){super(t),this._values=new ve(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,B(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,BigInt(0));else{let c=a.length;i.set(a,o),n.set(s,BigInt(c)),o+=c}}};var Oo=class extends q{constructor(t){super(t),this._values=new Bn}setValue(t,e){this._values.set(t,+e)}};var qr=class extends lt{};qr.prototype._setValue=Rs;var ai=class extends qr{};ai.prototype._setValue=eo;var ci=class extends qr{};ci.prototype._setValue=ro;var li=class extends lt{};li.prototype._setValue=Ps;var Fo=class extends q{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new Tt(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=Se({type:this.type.indices,nullValues:e}),this.dictionary=Se({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,e){let n=this.indices;return e=n.setValid(t,e),this.length=n.length,e}setValue(t,e){let n=this._keysToIndices,i=this.valueToKey(e),o=n[i];return o===void 0&&(n[i]=o=this._dictionaryOffset+this.dictionary.append(e).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,e=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=e?e.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var ui=class extends lt{};ui.prototype._setValue=Es;var Mo=class extends q{setValue(t,e){let[n]=this.children,i=t*this.stride;for(let o=-1,s=e.length;++o<s;)n.set(i+o,e[o])}addChild(t,e="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new Ut(this.type.listSize,new O(e,t.type,!0)),n}};var Qr=class extends lt{setValue(t,e){this._values.set(t,e)}},Lo=class extends Qr{setValue(t,e){super.setValue(t,qn(e))}},No=class extends Qr{},Uo=class extends Qr{};var tn=class extends lt{};tn.prototype._setValue=Vs;var fi=class extends tn{};fi.prototype._setValue=fo;var di=class extends tn{};di.prototype._setValue=ho;var sr=class extends lt{};sr.prototype._setValue=js;var hi=class extends sr{};hi.prototype._setValue=po;var pi=class extends sr{};pi.prototype._setValue=mo;var mi=class extends sr{};mi.prototype._setValue=yo;var yi=class extends sr{};yi.prototype._setValue=go;var fe=class extends lt{setValue(t,e){this._values.set(t,e)}},Eo=class extends fe{},Ro=class extends fe{},Co=class extends fe{},ko=class extends fe{},Po=class extends fe{},Vo=class extends fe{},jo=class extends fe{},zo=class extends fe{};var Wo=class extends Ht{constructor(t){super(t),this._offsets=new An(t.type)}addChild(t,e="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new wt(new O(e,t.type,!0)),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,o]of t)if(typeof o>"u")e.set(i,0);else{let s=o,a=s.length,c=e.set(i,a).buffer[i];for(let l=-1;++l<a;)n.set(c+l,s[l])}}};var Go=class extends Ht{set(t,e){return super.set(t,e)}setValue(t,e){let n=e instanceof Map?e:new Map(Object.entries(e)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,e=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Et(new O(e,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,o]of t)if(o===void 0)e.set(i,0);else{let{[i]:s,[i+1]:a}=e.set(i,o.size).buffer;for(let c of o.entries())if(n.set(s,c),++s>=a)break}}};var $o=class extends q{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var Yo=class extends q{setValue(t,e){let{children:n,type:i}=this;switch(Array.isArray(e)||e.constructor){case!0:return i.children.forEach((o,s)=>n[s].set(t,e[s]));case Map:return i.children.forEach((o,s)=>n[s].set(t,e.get(o.name)));default:return i.children.forEach((o,s)=>n[s].set(t,e[o.name]))}}setValid(t,e){return super.setValid(t,e)||this.children.forEach(n=>n.setValid(t,e)),e}addChild(t,e=`${this.numChildren}`){let n=this.children.push(t);return this.type=new k([...this.type.children,new O(e,t.type,!0)]),n}};var ar=class extends lt{};ar.prototype._setValue=Cs;var gi=class extends ar{};gi.prototype._setValue=no;var bi=class extends ar{};bi.prototype._setValue=io;var wi=class extends ar{};wi.prototype._setValue=oo;var _i=class extends ar{};_i.prototype._setValue=so;var cr=class extends lt{};cr.prototype._setValue=ks;var vi=class extends cr{};vi.prototype._setValue=ao;var Ii=class extends cr{};Ii.prototype._setValue=co;var Si=class extends cr{};Si.prototype._setValue=lo;var xi=class extends cr{};xi.prototype._setValue=uo;var Mn=class extends q{constructor(t){super(t),this._typeIds=new nr(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,e){return this.set(this.length,t,e)}set(t,e,n){return n===void 0&&(n=this._valueToChildTypeId(this,e,t)),this.setValue(t,e,n),this}setValue(t,e,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],o=this.children[i];o?.set(t,e)}addChild(t,e=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new O(e,t.type)];return this.type=new ue(o,[...s,n],a),n}_valueToChildTypeId(t,e,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},Ho=class extends Mn{},Jo=class extends Mn{constructor(t){super(t),this._offsets=new nr(Int32Array)}setValue(t,e,n){let i=this._typeIds.set(t,n).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,e)}};var Bi=class extends Ht{constructor(t){super(t),this._values=new ve(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,Be(e))}_flushPending(t,e){}};Bi.prototype._flushPending=On.prototype._flushPending;var Ai=class extends Ht{constructor(t){super(t),this._values=new ve(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,e){return super.setValue(t,Be(e))}_flushPending(t,e){}};Ai.prototype._flushPending=Fn.prototype._flushPending;var na=class extends w{visitNull(){return $o}visitBool(){return Oo}visitInt(){return fe}visitInt8(){return Eo}visitInt16(){return Ro}visitInt32(){return Co}visitInt64(){return ko}visitUint8(){return Po}visitUint16(){return Vo}visitUint32(){return jo}visitUint64(){return zo}visitFloat(){return Qr}visitFloat16(){return Lo}visitFloat32(){return No}visitFloat64(){return Uo}visitUtf8(){return Bi}visitLargeUtf8(){return Ai}visitBinary(){return On}visitLargeBinary(){return Fn}visitFixedSizeBinary(){return ui}visitDate(){return qr}visitDateDay(){return ai}visitDateMillisecond(){return ci}visitTimestamp(){return ar}visitTimestampSecond(){return gi}visitTimestampMillisecond(){return bi}visitTimestampMicrosecond(){return wi}visitTimestampNanosecond(){return _i}visitTime(){return cr}visitTimeSecond(){return vi}visitTimeMillisecond(){return Ii}visitTimeMicrosecond(){return Si}visitTimeNanosecond(){return xi}visitDecimal(){return li}visitList(){return Wo}visitStruct(){return Yo}visitUnion(){return Mn}visitDenseUnion(){return Jo}visitSparseUnion(){return Ho}visitDictionary(){return Fo}visitInterval(){return tn}visitIntervalDayTime(){return fi}visitIntervalYearMonth(){return di}visitDuration(){return sr}visitDurationSecond(){return hi}visitDurationMillisecond(){return pi}visitDurationMicrosecond(){return mi}visitDurationNanosecond(){return yi}visitFixedSizeList(){return Mo}visitMap(){return Go}},pl=new na;var S=class extends w{compareSchemas(t,e){return t===e||e instanceof t.constructor&&this.compareManyFields(t.fields,e.fields)}compareManyFields(t,e){return t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((n,i)=>this.compareFields(n,e[i]))}compareFields(t,e){return t===e||e instanceof t.constructor&&t.name===e.name&&t.nullable===e.nullable&&this.visit(t.type,e.type)}};function Rt(r,t){return t instanceof r.constructor}function en(r,t){return r===t||Rt(r,t)}function lr(r,t){return r===t||Rt(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function Ko(r,t){return r===t||Rt(r,t)&&r.precision===t.precision}function Bd(r,t){return r===t||Rt(r,t)&&r.byteWidth===t.byteWidth}function ia(r,t){return r===t||Rt(r,t)&&r.unit===t.unit}function Ti(r,t){return r===t||Rt(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function Di(r,t){return r===t||Rt(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function Ad(r,t){return r===t||Rt(r,t)&&r.children.length===t.children.length&&Ze.compareManyFields(r.children,t.children)}function Td(r,t){return r===t||Rt(r,t)&&r.children.length===t.children.length&&Ze.compareManyFields(r.children,t.children)}function oa(r,t){return r===t||Rt(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&Ze.compareManyFields(r.children,t.children)}function Dd(r,t){return r===t||Rt(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&Ze.visit(r.indices,t.indices)&&Ze.visit(r.dictionary,t.dictionary)}function sa(r,t){return r===t||Rt(r,t)&&r.unit===t.unit}function Oi(r,t){return r===t||Rt(r,t)&&r.unit===t.unit}function Od(r,t){return r===t||Rt(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&Ze.compareManyFields(r.children,t.children)}function Fd(r,t){return r===t||Rt(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&Ze.compareManyFields(r.children,t.children)}S.prototype.visitNull=en;S.prototype.visitBool=en;S.prototype.visitInt=lr;S.prototype.visitInt8=lr;S.prototype.visitInt16=lr;S.prototype.visitInt32=lr;S.prototype.visitInt64=lr;S.prototype.visitUint8=lr;S.prototype.visitUint16=lr;S.prototype.visitUint32=lr;S.prototype.visitUint64=lr;S.prototype.visitFloat=Ko;S.prototype.visitFloat16=Ko;S.prototype.visitFloat32=Ko;S.prototype.visitFloat64=Ko;S.prototype.visitUtf8=en;S.prototype.visitLargeUtf8=en;S.prototype.visitBinary=en;S.prototype.visitLargeBinary=en;S.prototype.visitFixedSizeBinary=Bd;S.prototype.visitDate=ia;S.prototype.visitDateDay=ia;S.prototype.visitDateMillisecond=ia;S.prototype.visitTimestamp=Ti;S.prototype.visitTimestampSecond=Ti;S.prototype.visitTimestampMillisecond=Ti;S.prototype.visitTimestampMicrosecond=Ti;S.prototype.visitTimestampNanosecond=Ti;S.prototype.visitTime=Di;S.prototype.visitTimeSecond=Di;S.prototype.visitTimeMillisecond=Di;S.prototype.visitTimeMicrosecond=Di;S.prototype.visitTimeNanosecond=Di;S.prototype.visitDecimal=en;S.prototype.visitList=Ad;S.prototype.visitStruct=Td;S.prototype.visitUnion=oa;S.prototype.visitDenseUnion=oa;S.prototype.visitSparseUnion=oa;S.prototype.visitDictionary=Dd;S.prototype.visitInterval=sa;S.prototype.visitIntervalDayTime=sa;S.prototype.visitIntervalYearMonth=sa;S.prototype.visitDuration=Oi;S.prototype.visitDurationSecond=Oi;S.prototype.visitDurationMillisecond=Oi;S.prototype.visitDurationMicrosecond=Oi;S.prototype.visitDurationNanosecond=Oi;S.prototype.visitFixedSizeList=Od;S.prototype.visitMap=Fd;var Ze=new S;function rn(r,t){return Ze.compareSchemas(r,t)}function ml(r,t){return Ze.compareFields(r,t)}function Zo(r,t){return Ze.visit(r,t)}function Se(r){let t=r.type,e=new(pl.getVisitFn(t)())(r);if(t.children&&t.children.length>0){let n=r.children||[],i={nullValues:r.nullValues},o=Array.isArray(n)?(s,a)=>n[a]||i:({name:s})=>n[s]||i;for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);e.children.push(Se(Object.assign(Object.assign({},l),{type:c})))}}return e}function Fi(r,t){if(r instanceof M||r instanceof y||r.type instanceof p||ArrayBuffer.isView(r))return xn(r);let e={type:t??Xo(r),nullValues:[null]},n=[...aa(e)(r)],i=n.length===1?n[0]:n.reduce((o,s)=>o.concat(s));return p.isDictionary(i.type)?i.memoize():i}function Xo(r){if(r.length===0)return new nt;let t=0,e=0,n=0,i=0,o=0,s=0,a=0,c=0;for(let l of r){if(l==null){++t;continue}switch(typeof l){case"bigint":++s;continue;case"boolean":++a;continue;case"number":++i;continue;case"string":++o;continue;case"object":Array.isArray(l)?++e:Object.prototype.toString.call(l)==="[object Date]"?++c:++n;continue}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}if(i+t===r.length)return new le;if(o+t===r.length)return new Tt(new Lt,new yt);if(s+t===r.length)return new ce;if(a+t===r.length)return new Nt;if(c+t===r.length)return new er;if(e+t===r.length){let l=r,f=Xo(l[l.findIndex(d=>d!=null)]);if(l.every(d=>d==null||Zo(f,Xo(d))))return new wt(new O("",f,!0))}else if(n+t===r.length){let l=new Map;for(let f of r)for(let d of Object.keys(f))!l.has(d)&&f[d]!=null&&l.set(d,new O(d,Xo([f[d]]),!0));return new k([...l.values()])}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}function aa(r){let{["queueingStrategy"]:t="count"}=r,{["highWaterMark"]:e=t!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=r,n=t!=="bytes"?"length":"byteLength";return function*(i){let o=0,s=Se(r);for(let a of i)s.append(a)[n]>=e&&++o&&(yield s.toVector());(s.finish().length>0||o===0)&&(yield s.toVector())}}function qo(r,t){return Md(r,t.map(e=>e.data.concat()))}function Md(r,t){let e=[...r.fields],n=[],i={numBatches:t.reduce((d,V)=>Math.max(d,V.length),0)},o=0,s=0,a=-1,c=t.length,l,f=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)f[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(f=Ld(e,s,f,t,i),s>0&&(n[o++]=b({type:new k(e),length:s,nullCount:0,children:f.slice()})))}return[r=r.assign(e),n.map(d=>new G(r,d))]}function Ld(r,t,e,n,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let l=e[a],f=l?.length;if(f>=t)f===t?e[a]=l:(e[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(l.slice(t,f-t))));else{let d=r[a];r[a]=d.clone({nullable:!0}),e[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:b({type:d.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return e}var yl,$=class{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new U([]),this._offsets=[0],this;let i,o;t[0]instanceof U&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof G)return[c];if(c instanceof $)return c.batches;if(c instanceof M){if(c.type instanceof k)return[new G(new U(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>s(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>s(l));if(typeof c=="object"){let l=Object.keys(c),f=l.map(N=>new y([c[N]])),d=i??new U(l.map((N,st)=>new O(String(N),f[st].type,f[st].nullable))),[,V]=qo(d,f);return V.length===0?[new G(c)]:V}}}return[]},a=t.flatMap(c=>s(c));if(i=(n=i??((e=a[0])===null||e===void 0?void 0:e.schema))!==null&&n!==void 0?n:new U([]),!(i instanceof U))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof G))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!rn(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??Io(this.data)}get data(){return this.batches.map(({data:t})=>t)}get numCols(){return this.schema.fields.length}get numRows(){return this.data.reduce((t,e)=>t+e.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=vo(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(Gr(t,this.numRows))}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?In.visit(new y(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
14
14
|
${this.toArray().join(`,
|
|
15
15
|
`)}
|
|
16
|
-
]`}concat(...t){let e=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new $(e,n.map(i=>new G(e,i)))}slice(t,e){let n=this.schema;[t,e]=Qn({length:this.numRows},t,e);let i=So(this.data,this._offsets,t,e);return new $(n,i.map(o=>new G(n,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let e=this.data.map(n=>n.children[t]);if(e.length===0){let{type:n}=this.schema.fields[t],i=b({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new y(e)}return null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),e)}setChildAt(t,e){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new y([b({type:new nt,length:this.numRows})]));let o=n.fields.slice(),s=o[t].clone({type:e.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,e],[n,i]=qo(n,a)}return new $(n,i)}select(t){let e=this.schema.fields.reduce((n,i,o)=>n.set(i.name,o),new Map);return this.selectAt(t.map(n=>e.get(n)).filter(n=>n>-1))}selectAt(t){let e=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new $(e,n)}assign(t){let e=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[f,d]=a,V=e.findIndex(N=>N.name===c.name);return~V?d[V]=l:f.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...e.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new $(...qo(o,s))}};yl=Symbol.toStringTag;$[yl]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=vn(ri),r.get=vn(ct.getVisitFn(u.Struct)),r.set=xo(_t.getVisitFn(u.Struct)),r.indexOf=Bo(Kr.getVisitFn(u.Struct)),"Table"))($.prototype);var bl,G=class{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof U))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=b({nullCount:0,type:new k(this.schema.fields),children:this.schema.fields.map(e=>b({type:e.type,nullCount:0}))})]=t,!(this.data instanceof M))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=gl(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:n,children:i,length:o}=Object.keys(e).reduce((c,l,f)=>(c.children[f]=e[l],c.length=Math.max(c.length,e[l].length),c.fields[f]=O.new({name:l,type:e[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new U(n),a=b({type:new k(n),length:o,children:i,nullCount:0});[this.schema,this.data]=gl(s,a.children,o);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=wl(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 ct.visit(this.data,t)}at(t){return this.get(Gr(t,this.numRows))}set(t,e){return _t.visit(this.data,t,e)}indexOf(t,e){return Kr.visit(this.data,t,e)}[Symbol.iterator](){return In.visit(new y([this.data]))}toArray(){return[...this]}concat(...t){return new $(this.schema,[this,...t])}slice(t,e){let[n]=new y([this.data]).slice(t,e).data;return new G(this.schema,n)}getChild(t){var e;return this.getChildAt((e=this.schema.fields)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new y([this.data.children[t]]):null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),e)}setChildAt(t,e){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){e||(e=new y([b({type:new nt,length:this.numRows})]));let o=n.fields.slice(),s=i.children.slice(),a=o[t].clone({type:e.type});[o[t],s[t]]=[a,e.data[0]],n=new U(o,new Map(this.schema.metadata)),i=b({type:new k(o),children:s})}return new G(n,i)}select(t){let e=this.schema.select(t),n=new k(e.fields),i=[];for(let o of t){let s=this.schema.fields.findIndex(a=>a.name===o);~s&&(i[s]=this.data.children[s])}return new G(e,b({type:n,length:this.numRows,children:i}))}selectAt(t){let e=this.schema.selectAt(t),n=t.map(o=>this.data.children[o]).filter(Boolean),i=b({type:new k(e.fields),length:this.numRows,children:n});return new G(e,i)}};bl=Symbol.toStringTag;G[bl]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(G.prototype);function gl(r,t,e=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...r.fields],o=[...t],s=(e+63&-64)>>3;for(let[a,c]of r.fields.entries()){let l=t[a];(!l||l.length!==e)&&(i[a]=c.clone({nullable:!0}),o[a]=(n=l?._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:b({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(s)}))}return[r.assign(i),b({type:new k(i),length:e,children:o})]}function wl(r,t,e=new Map){var n,i;if(((n=r?.length)!==null&&n!==void 0?n:0)>0&&r?.length===t?.length)for(let o=-1,s=r.length;++o<s;){let{type:a}=r[o],c=t[o];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])wl(a.children,l?.children,e);if(p.isDictionary(a)){let{id:l}=a;if(!e.has(l))c?.dictionary&&e.set(l,c.dictionary);else if(e.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return e}var nn=class extends G{constructor(t){let e=t.fields.map(i=>b({type:i.type})),n=b({type:new k(t.fields),nullCount:0,children:e});super(t,n)}};var it=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new it).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new it).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):z.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):R.NONE}header(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new K).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,z.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,R.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,BigInt("0"))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,n,i,o,s){return it.startMessage(t),it.addVersion(t,e),it.addHeaderType(t,n),it.addHeader(t,i),it.addBodyLength(t,o),it.addCustomMetadata(t,s),it.endMessage(t)}};var ca=class extends w{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return Ne.startNull(e),Ne.endNull(e)}visitInt(t,e){return ht.startInt(e),ht.addBitWidth(e,t.bitWidth),ht.addIsSigned(e,t.isSigned),ht.endInt(e)}visitFloat(t,e){return zt.startFloatingPoint(e),zt.addPrecision(e,t.precision),zt.endFloatingPoint(e)}visitBinary(t,e){return De.startBinary(e),De.endBinary(e)}visitLargeBinary(t,e){return Fe.startLargeBinary(e),Fe.endLargeBinary(e)}visitBool(t,e){return Oe.startBool(e),Oe.endBool(e)}visitUtf8(t,e){return Ee.startUtf8(e),Ee.endUtf8(e)}visitLargeUtf8(t,e){return Me.startLargeUtf8(e),Me.endLargeUtf8(e)}visitDecimal(t,e){return pt.startDecimal(e),pt.addScale(e,t.scale),pt.addPrecision(e,t.precision),pt.addBitWidth(e,t.bitWidth),pt.endDecimal(e)}visitDate(t,e){return kt.startDate(e),kt.addUnit(e,t.unit),kt.endDate(e)}visitTime(t,e){return St.startTime(e),St.addUnit(e,t.unit),St.addBitWidth(e,t.bitWidth),St.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return xt.startTimestamp(e),xt.addUnit(e,t.unit),n!==void 0&&xt.addTimezone(e,n),xt.endTimestamp(e)}visitInterval(t,e){return Wt.startInterval(e),Wt.addUnit(e,t.unit),Wt.endInterval(e)}visitDuration(t,e){return Pt.startDuration(e),Pt.addUnit(e,t.unit),Pt.endDuration(e)}visitList(t,e){return Le.startList(e),Le.endList(e)}visitStruct(t,e){return Ue.startStruct_(e),Ue.endStruct_(e)}visitUnion(t,e){mt.startTypeIdsVector(e,t.typeIds.length);let n=mt.createTypeIdsVector(e,t.typeIds);return mt.startUnion(e),mt.addMode(e,t.mode),mt.addTypeIds(e,n),mt.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return ee.startDictionaryEncoding(e),ee.addId(e,BigInt(t.id)),ee.addIsOrdered(e,t.isOrdered),n!==void 0&&ee.addIndexType(e,n),ee.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return Vt.startFixedSizeBinary(e),Vt.addByteWidth(e,t.byteWidth),Vt.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return jt.startFixedSizeList(e),jt.addListSize(e,t.listSize),jt.endFixedSizeList(e)}visitMap(t,e){return Gt.startMap(e),Gt.addKeysSorted(e,t.keysSorted),Gt.endMap(e)}},Qo=new ca;function Sl(r,t=new Map){return new U(Nd(r,t),ts(r.metadata),t)}function la(r){return new vt(r.count,Bl(r.columns),Al(r.columns))}function xl(r){return new Xt(la(r.data),r.id,r.isDelta)}function Nd(r,t){return(r.fields||[]).filter(Boolean).map(e=>O.fromJSON(e,t))}function _l(r,t){return(r.children||[]).filter(Boolean).map(e=>O.fromJSON(e,t))}function Bl(r){return(r||[]).reduce((t,e)=>[...t,new de(e.count,Ud(e.VALIDITY)),...Bl(e.children)],[])}function Al(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new Zt(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new Zt(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new Zt(t.length,i.OFFSET.length)),i.DATA&&t.push(new Zt(t.length,i.DATA.length)),t=Al(i.children,t)}return t}function Ud(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function Tl(r,t){let e,n,i,o,s,a;return!t||!(o=r.dictionary)?(s=Il(r,_l(r,t)),i=new O(r.name,s,r.nullable,ts(r.metadata))):t.has(e=o.id)?(n=(n=o.indexType)?vl(n):new yt,a=new Tt(t.get(e),n,e,o.isOrdered),i=new O(r.name,a,r.nullable,ts(r.metadata))):(n=(n=o.indexType)?vl(n):new yt,t.set(e,s=Il(r,_l(r,t))),a=new Tt(s,n,e,o.isOrdered),i=new O(r.name,a,r.nullable,ts(r.metadata))),i||null}function ts(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function vl(r){return new et(r.isSigned,r.bitWidth)}function Il(r,t){let e=r.type.name;switch(e){case"NONE":return new nt;case"null":return new nt;case"binary":return new re;case"largebinary":return new We;case"utf8":return new Lt;case"largeutf8":return new Ge;case"bool":return new Nt;case"list":return new wt((t||[])[0]);case"struct":return new k(t||[]);case"struct_":return new k(t||[])}switch(e){case"int":{let n=r.type;return new et(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new Mt(P[n.precision])}case"decimal":{let n=r.type;return new ne(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new $t(J[n.unit])}case"time":{let n=r.type;return new Bt(h[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new At(h[n.unit],n.timezone)}case"interval":{let n=r.type;return new Yt(Q[n.unit])}case"duration":{let n=r.type;return new $e(h[n.unit])}case"union":{let n=r.type,[i,...o]=(n.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new ue(Y[s],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new Ye(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Ut(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new Et((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var Ed=tr,Rd=Ft,ut=class{static fromJSON(t,e){let n=new ut(0,z.V5,e);return n._createHeader=Cd(t,e),n}static decode(t){t=new Rd(B(t));let e=it.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),o=e.headerType(),s=new ut(n,i,o);return s._createHeader=kd(e,o),s}static encode(t){let e=new Ed,n=-1;return t.isSchema()?n=U.encode(e,t.header()):t.isRecordBatch()?n=vt.encode(e,t.header()):t.isDictionaryBatch()&&(n=Xt.encode(e,t.header())),it.startMessage(e),it.addVersion(e,z.V5),it.addHeader(e,n),it.addHeaderType(e,t.headerType),it.addBodyLength(e,BigInt(t.bodyLength)),it.finishMessageBuffer(e,it.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof U)return new ut(0,z.V5,R.Schema,t);if(t instanceof vt)return new ut(e,z.V5,R.RecordBatch,t);if(t instanceof Xt)return new ut(e,z.V5,R.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===R.Schema}isRecordBatch(){return this.headerType===R.RecordBatch}isDictionaryBatch(){return this.headerType===R.DictionaryBatch}constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=C(t)}},vt=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,e,n){this._nodes=e,this._buffers=n,this._length=C(t)}},Xt=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,n=!1){this._data=t,this._isDelta=n,this._id=C(e)}},Zt=class{constructor(t,e){this.offset=C(t),this.length=C(e)}},de=class{constructor(t,e){this.length=C(t),this.nullCount=C(e)}};function Cd(r,t){return()=>{switch(t){case R.Schema:return U.fromJSON(r);case R.RecordBatch:return vt.fromJSON(r);case R.DictionaryBatch:return Xt.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${R[t]}, type: ${t} }`)}}function kd(r,t){return()=>{switch(t){case R.Schema:return U.decode(r.header(new tt),new Map,r.version());case R.RecordBatch:return vt.decode(r.header(new It),r.version());case R.DictionaryBatch:return Xt.decode(r.header(new ae),r.version())}throw new Error(`Unrecognized Message type: { name: ${R[t]}, type: ${t} }`)}}O.encode=Kd;O.decode=Hd;O.fromJSON=Tl;U.encode=Jd;U.decode=Pd;U.fromJSON=Sl;vt.encode=Zd;vt.decode=Vd;vt.fromJSON=la;Xt.encode=Xd;Xt.decode=jd;Xt.fromJSON=xl;de.encode=qd;de.decode=Wd;Zt.encode=Qd;Zt.decode=zd;function Pd(r,t=new Map,e=z.V5){let n=Yd(r,t);return new U(n,es(r),t,e)}function Vd(r,t=z.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new vt(r.length(),Gd(r),$d(r,t))}function jd(r,t=z.V5){return new Xt(vt.decode(r.data(),t),r.id(),r.isDelta())}function zd(r){return new Zt(r.offset(),r.length())}function Wd(r){return new de(r.length(),r.nullCount())}function Gd(r){let t=[];for(let e,n=-1,i=-1,o=r.nodesLength();++n<o;)(e=r.nodes(n))&&(t[++i]=de.decode(e));return t}function $d(r,t){let e=[];for(let n,i=-1,o=-1,s=r.buffersLength();++i<s;)(n=r.buffers(i))&&(t<z.V4&&(n.bb_pos+=8*(i+1)),e[++o]=Zt.decode(n));return e}function Yd(r,t){let e=[];for(let n,i=-1,o=-1,s=r.fieldsLength();++i<s;)(n=r.fields(i))&&(e[++o]=O.decode(n,t));return e}function Dl(r,t){let e=[];for(let n,i=-1,o=-1,s=r.childrenLength();++i<s;)(n=r.children(i))&&(e[++o]=O.decode(n,t));return e}function Hd(r,t){let e,n,i,o,s,a;return!t||!(a=r.dictionary())?(i=Fl(r,Dl(r,t)),n=new O(r.name(),i,r.nullable(),es(r))):t.has(e=C(a.id()))?(o=(o=a.indexType())?Ol(o):new yt,s=new Tt(t.get(e),o,e,a.isOrdered()),n=new O(r.name(),s,r.nullable(),es(r))):(o=(o=a.indexType())?Ol(o):new yt,t.set(e,i=Fl(r,Dl(r,t))),s=new Tt(i,o,e,a.isOrdered()),n=new O(r.name(),s,r.nullable(),es(r))),n||null}function es(r){let t=new Map;if(r)for(let e,n,i=-1,o=Math.trunc(r.customMetadataLength());++i<o;)(e=r.customMetadata(i))&&(n=e.key())!=null&&t.set(n,e.value());return t}function Ol(r){return new et(r.isSigned(),r.bitWidth())}function Fl(r,t){let e=r.typeType();switch(e){case H.NONE:return new nt;case H.Null:return new nt;case H.Binary:return new re;case H.LargeBinary:return new We;case H.Utf8:return new Lt;case H.LargeUtf8:return new Ge;case H.Bool:return new Nt;case H.List:return new wt((t||[])[0]);case H.Struct_:return new k(t||[])}switch(e){case H.Int:{let n=r.type(new ht);return new et(n.isSigned(),n.bitWidth())}case H.FloatingPoint:{let n=r.type(new zt);return new Mt(n.precision())}case H.Decimal:{let n=r.type(new pt);return new ne(n.scale(),n.precision(),n.bitWidth())}case H.Date:{let n=r.type(new kt);return new $t(n.unit())}case H.Time:{let n=r.type(new St);return new Bt(n.unit(),n.bitWidth())}case H.Timestamp:{let n=r.type(new xt);return new At(n.unit(),n.timezone())}case H.Interval:{let n=r.type(new Wt);return new Yt(n.unit())}case H.Duration:{let n=r.type(new Pt);return new $e(n.unit())}case H.Union:{let n=r.type(new mt);return new ue(n.mode(),n.typeIdsArray()||[],t||[])}case H.FixedSizeBinary:{let n=r.type(new Vt);return new Ye(n.byteWidth())}case H.FixedSizeList:{let n=r.type(new jt);return new Ut(n.listSize(),(t||[])[0])}case H.Map:{let n=r.type(new Gt);return new Et((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${H[e]}" (${e})`)}function Jd(r,t){let e=t.fields.map(o=>O.encode(r,o));tt.startFieldsVector(r,e.length);let n=tt.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?tt.createCustomMetadataVector(r,[...t.metadata].map(([o,s])=>{let a=r.createString(`${o}`),c=r.createString(`${s}`);return K.startKeyValue(r),K.addKey(r,a),K.addValue(r,c),K.endKeyValue(r)})):-1;return tt.startSchema(r),tt.addFields(r,n),tt.addEndianness(r,th?wr.Little:wr.Big),i!==-1&&tt.addCustomMetadata(r,i),tt.endSchema(r)}function Kd(r,t){let e=-1,n=-1,i=-1,o=t.type,s=t.typeId;p.isDictionary(o)?(s=o.dictionary.typeId,i=Qo.visit(o,r),n=Qo.visit(o.dictionary,r)):n=Qo.visit(o,r);let a=(o.children||[]).map(f=>O.encode(r,f)),c=at.createChildrenVector(r,a),l=t.metadata&&t.metadata.size>0?at.createCustomMetadataVector(r,[...t.metadata].map(([f,d])=>{let V=r.createString(`${f}`),N=r.createString(`${d}`);return K.startKeyValue(r),K.addKey(r,V),K.addValue(r,N),K.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),at.startField(r),at.addType(r,n),at.addTypeType(r,s),at.addChildren(r,c),at.addNullable(r,!!t.nullable),e!==-1&&at.addName(r,e),i!==-1&&at.addDictionary(r,i),l!==-1&&at.addCustomMetadata(r,l),at.endField(r)}function Zd(r,t){let e=t.nodes||[],n=t.buffers||[];It.startNodesVector(r,e.length);for(let s of e.slice().reverse())de.encode(r,s);let i=r.endVector();It.startBuffersVector(r,n.length);for(let s of n.slice().reverse())Zt.encode(r,s);let o=r.endVector();return It.startRecordBatch(r),It.addLength(r,BigInt(t.length)),It.addNodes(r,i),It.addBuffers(r,o),It.endRecordBatch(r)}function Xd(r,t){let e=vt.encode(r,t.data);return ae.startDictionaryBatch(r),ae.addId(r,BigInt(t.id)),ae.addIsDelta(r,t.isDelta),ae.addData(r,e),ae.endDictionaryBatch(r)}function qd(r,t){return dn.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function Qd(r,t){return fn.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var th=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var fa=r=>`Expected ${R[r]} Message in stream, but was null or length 0.`,da=r=>`Header pointer of flatbuffer-encoded ${R[r]} Message is null or length 0.`,Ml=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,Ll=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`,Ln=class{constructor(t){this.source=t instanceof Ke?t:new Ke(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?Z:t.value===-1&&(t=this.readMetadataLength()).done?Z:(t=this.readMetadata(t.value)).done?Z:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(fa(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=B(this.source.read(t));if(e.byteLength<t)throw new Error(Ll(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=R.Schema,n=this.readMessage(e),i=n?.header();if(t&&!i)throw new Error(da(e));return i}readMetadataLength(){let t=this.source.read(rs),e=t&&new Ft(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let e=this.source.read(t);if(!e)return Z;if(e.byteLength<t)throw new Error(Ml(t,e.byteLength));return{done:!1,value:ut.decode(e)}}},Mi=class{constructor(t,e){this.source=t instanceof Jt?t:Gi(t)?new Br(t,e):new Jt(t)}[Symbol.asyncIterator](){return this}next(){return m(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?Z:t.value===-1&&(t=yield this.readMetadataLength()).done?Z:(t=yield this.readMetadata(t.value)).done?Z:t})}throw(t){return m(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return m(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return m(this,void 0,void 0,function*(){let e;if((e=yield this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(fa(t));return e.value})}readMessageBody(t){return m(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=B(yield this.source.read(t));if(e.byteLength<t)throw new Error(Ll(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(){return m(this,arguments,void 0,function*(t=!1){let e=R.Schema,n=yield this.readMessage(e),i=n?.header();if(t&&!i)throw new Error(da(e));return i})}readMetadataLength(){return m(this,void 0,void 0,function*(){let t=yield this.source.read(rs),e=t&&new Ft(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return m(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return Z;if(e.byteLength<t)throw new Error(Ml(t,e.byteLength));return{done:!1,value:ut.decode(e)}})}},Li=class extends Ln{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof ni?t:new ni(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:ut.fromJSON(t.schema,R.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:ut.fromJSON(e,R.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:ut.fromJSON(e,R.RecordBatch)}}return this._body=[],Z}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...e(o.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(fa(t));return e.value}readSchema(){let t=R.Schema,e=this.readMessage(t),n=e?.header();if(!e||!n)throw new Error(da(t));return n}},rs=4,ua="ARROW1",Nn=new Uint8Array(ua.length);for(let r=0;r<ua.length;r+=1)Nn[r]=ua.codePointAt(r);function ns(r,t=0){for(let e=-1,n=Nn.length;++e<n;)if(Nn[e]!==r[t+e])return!1;return!0}var Un=Nn.length,ha=Un+rs,Nl=Un*2+rs;var ft=class extends Xr{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let e=this._impl.open(t);return Qt(e)?e.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return bt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return bt.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof ft?t:zi(t)?rh(t):Gi(t)?oh(t):Qt(t)?(()=>m(this,void 0,void 0,function*(){return yield ft.from(yield t)}))():$i(t)||$n(t)||Hi(t)||oe(t)?ih(new Jt(t)):nh(new Ke(t))}static readAll(t){return t instanceof ft?t.isSync()?Ul(t):El(t):zi(t)||ArrayBuffer.isView(t)||pe(t)||Wi(t)?Ul(t):El(t)}},Xe=class extends ft{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return qt(this,arguments,function*(){yield L(yield*ln(he(this[Symbol.iterator]())))})}},Ar=class extends ft{constructor(t){super(t),this._impl=t}readAll(){return m(this,void 0,void 0,function*(){var t,e,n,i;let o=new Array;try{for(var s=!0,a=he(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){e={error:l}}finally{try{!s&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(e)throw e.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Tr=class extends Xe{constructor(t){super(t),this._impl=t}},Ni=class extends Ar{constructor(t){super(t),this._impl=t}},is=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){let n=this._loadVectors(t,e,this.schema.fields),i=b({type:new k(this.schema.fields),length:t.length,children:n});return new G(this.schema,i)}_loadDictionaryBatch(t,e){let{id:n,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(n),c=s.dictionaries.get(n),l=this._loadVectors(t.data,e,[c]);return(a&&i?a.concat(new y(l)):new y(l)).memoize()}_loadVectors(t,e,n){return new si(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},En=class extends is{constructor(t,e){super(e),this._reader=zi(t)?new Li(this._handle=t):new Ln(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=Rl(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):Z}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Z}next(){if(this.closed)return Z;let t,{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new nn(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Rn=class extends is{constructor(t,e){super(e),this._reader=new Mi(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return m(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 m(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Rl(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return m(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):Z})}return(t){return m(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Z})}next(){return m(this,void 0,void 0,function*(){if(this.closed)return Z;let t,{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new nn(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return m(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},os=class extends En{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,e){super(t instanceof ii?t:new ii(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(R.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null}_readDictionaryBatch(t){var e;let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(R.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,e=t.size-ha,n=t.readInt32(e),i=t.readAt(e-n,n);return ir.decode(i)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},pa=class extends Rn{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...e){let n=typeof e[0]!="number"?e.shift():void 0,i=e[0]instanceof Map?e.shift():void 0;super(t instanceof Br?t:new Br(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return m(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){return m(this,void 0,void 0,function*(){var e;if(this.closed)return null;this._footer||(yield this.open());let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(R.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null})}_readDictionaryBatch(t){return m(this,void 0,void 0,function*(){var e;let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(R.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}})}_readFooter(){return m(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-ha,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return ir.decode(i)})}_readNextMessageAndValidate(t){return m(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null})}},ma=class extends En{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new Do(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function Rl(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*Ul(r){let t=ft.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function El(r){return qt(this,arguments,function*(){let e=yield L(ft.from(r));try{if(!(yield L(e.open({autoDestroy:!1}))).closed)do yield yield L(e);while(!(yield L(e.reset().open())).closed)}finally{yield L(e.cancel())}})}function rh(r){return new Xe(new ma(r))}function nh(r){let t=r.peek(Un+7&-8);return t&&t.byteLength>=4?ns(t)?new Tr(new os(r.read())):new Xe(new En(r)):new Xe(new En(function*(){}()))}function ih(r){return m(this,void 0,void 0,function*(){let t=yield r.peek(Un+7&-8);return t&&t.byteLength>=4?ns(t)?new Tr(new os(yield r.read())):new Ar(new Rn(r)):new Ar(new Rn(function(){return qt(this,arguments,function*(){})}()))})}function oh(r){return m(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new Br(r,t);return t>=Nl&&ns(yield e.readAt(0,Un+7&-8))?new Ni(new pa(e)):new Ar(new Rn(e))})}var X=class extends w{static assemble(...t){let e=i=>i.flatMap(o=>Array.isArray(o)?e(o):o instanceof G?o.data.children:o.data),n=new X;return n.visitMany(e(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof y)return this.visitMany(t.data),this;let{type:e}=t;if(!p.isDictionary(e)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(p.isUnion(e))this.nodes.push(new de(n,0));else{let{nullCount:i}=t;p.isNull(e)||xe.call(this,i<=0?new Uint8Array(0):Yr(t.offset,n,t.nullBitmap)),this.nodes.push(new de(n,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function xe(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new Zt(this._byteLength,t)),this._byteLength+=t,this}function sh(r){var t;let{type:e,length:n,typeIds:i,valueOffsets:o}=r;if(xe.call(this,i),e.mode===Y.Sparse)return ya.call(this,r);if(e.mode===Y.Dense){if(r.offset<=0)return xe.call(this,o),ya.call(this,r);{let s=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,f,d=-1;++d<n;)(l=i[d])!==void 0&&((f=a[l])===void 0&&(f=a[l]=o[d]),s[d]=o[d]-f,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);xe.call(this,s),this.visitMany(r.children.map((l,f)=>{let d=e.typeIds[f],V=a[d],N=c[d];return l.slice(V,Math.min(n,N))}))}}return this}function ah(r){let t;return r.nullCount>=r.length?xe.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?xe.call(this,Yr(r.offset,r.length,t)):xe.call(this,Hr(r.values))}function ur(r){return xe.call(this,r.values.subarray(0,r.length*r.stride))}function ss(r){let{length:t,values:e,valueOffsets:n}=r,i=C(n[0]),o=C(n[t]),s=Math.min(o-i,e.byteLength-i);return xe.call(this,Ki(-i,t+1,n)),xe.call(this,e.subarray(i,i+s)),this}function ga(r){let{length:t,valueOffsets:e}=r;if(e){let{[0]:n,[t]:i}=e;return xe.call(this,Ki(-n,t+1,e)),this.visit(r.children[0].slice(n,i-n))}return this.visit(r.children[0])}function ya(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}X.prototype.visitBool=ah;X.prototype.visitInt=ur;X.prototype.visitFloat=ur;X.prototype.visitUtf8=ss;X.prototype.visitLargeUtf8=ss;X.prototype.visitBinary=ss;X.prototype.visitLargeBinary=ss;X.prototype.visitFixedSizeBinary=ur;X.prototype.visitDate=ur;X.prototype.visitTimestamp=ur;X.prototype.visitTime=ur;X.prototype.visitDecimal=ur;X.prototype.visitList=ga;X.prototype.visitStruct=ya;X.prototype.visitUnion=sh;X.prototype.visitInterval=ur;X.prototype.visitDuration=ur;X.prototype.visitFixedSizeList=ga;X.prototype.visitMap=ga;var on=class extends Xr{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new Je,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,Ot(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 Qt(t)?t.then(e=>this.writeAll(e)):oe(t)?wa(this,t):ba(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){return t===this._sink||t instanceof Je?this._sink=t:(this._sink=new Je,t&&qa(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Qa(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!e||!rn(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof $&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof G&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!rn(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof G?t instanceof nn||this._writeRecordBatch(t):t instanceof $?this.writeAll(t.batches):pe(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=ut.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+n&~n,c=a-o-s;return t.headerType===R.RecordBatch?this._recordBatchBlocks.push(new Ie(a,t.bodyLength,this._position)):t.headerType===R.DictionaryBatch&&this._dictionaryBlocks.push(new Ie(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let e=B(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(ut.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Nn)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:o}=X.assemble(t),s=new vt(t.numRows,n,i),a=ut.from(s,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(o)}_writeDictionaryBatch(t,e,n=!1){let{byteLength:i,nodes:o,bufferRegions:s,buffers:a}=X.assemble(new y([t])),c=new vt(t.length,o,s),l=new Xt(c,e,n),f=ut.from(l,i);return this._writeMessage(f)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,n,i;for(let o=-1,s=t.length;++o<s;)(e=t[o])&&(n=e.byteLength)>0&&(this._write(e),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){var e,n;for(let[i,o]of t.dictionaries){let s=(e=o?.data)!==null&&e!==void 0?e:[],a=this._seenDictionaries.get(i),c=(n=this._dictionaryDeltaOffsets.get(i))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==s[0])for(let[l,f]of s.entries())this._writeDictionaryBatch(f,i,l>0);else if(c<s.length)for(let l of s.slice(c))this._writeDictionaryBatch(l,i,!0);this._seenDictionaries.set(i,o),this._dictionaryDeltaOffsets.set(i,s.length)}return this}},fr=class extends on{static writeAll(t,e){let n=new fr(e);return Qt(t)?t.then(i=>n.writeAll(i)):oe(t)?wa(n,t):ba(n,t)}},dr=class extends on{static writeAll(t){let e=new dr;return Qt(t)?t.then(n=>e.writeAll(n)):oe(t)?wa(e,t):ba(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,e,n=!1){if(!n&&this._seenDictionaries.has(e))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,e,n)}_writeFooter(t){let e=ir.encode(new ir(t,z.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function ba(r,t){let e=t;t instanceof $&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function wa(r,t){return m(this,void 0,void 0,function*(){var e,n,i,o,s,a,c;try{for(e=!0,n=he(t);i=yield n.next(),o=i.done,!o;e=!0){c=i.value,e=!1;let l=c;r.write(l)}}catch(l){s={error:l}}finally{try{!e&&!o&&(a=n.return)&&(yield a.call(n))}finally{if(s)throw s.error}}return r.finish()})}function Cl(r,t){if(oe(r))return lh(r,t);if(pe(r))return ch(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function ch(r,t){let e=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,e||(e=r[Symbol.iterator]()))},pull(s){e?o(s,e):s.close()},cancel(){(e?.return&&e.return()||!0)&&(e=null)}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){let c,l=null,f=s.desiredSize||null;for(;!(l=a.next(n?f:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=B(l.value))&&(f!=null&&n&&(f=f-c.byteLength+1),l.value=c),s.enqueue(l.value),f!=null&&--f<=0)return;s.close()}}function lh(r,t){let e=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return m(this,void 0,void 0,function*(){yield o(s,e||(e=r[Symbol.asyncIterator]()))})},pull(s){return m(this,void 0,void 0,function*(){e?yield o(s,e):s.close()})},cancel(){return m(this,void 0,void 0,function*(){(e?.return&&(yield e.return())||!0)&&(e=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){return m(this,void 0,void 0,function*(){let c,l=null,f=s.desiredSize||null;for(;!(l=yield a.next(n?f:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=B(l.value))&&(f!=null&&n&&(f=f-c.byteLength+1),l.value=c),s.enqueue(l.value),f!=null&&--f<=0)return;s.close()})}}function Vl(r){return new _a(r)}var _a=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,o=Za(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Se(o),this._getSize=i!=="bytes"?kl:Pl;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},e),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:s,size:i!=="bytes"?kl:Pl}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let e=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-e}_maybeFlush(t,e){e!=null&&(this._bufferedSize>=e.desiredSize&&++this._numChunks&&this._enqueue(e,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(e,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(e,null)))}_enqueue(t,e){this._bufferedSize=0,this._controller=null,e==null?t.close():t.enqueue(e)}},kl=r=>{var t;return(t=r?.length)!==null&&t!==void 0?t:0},Pl=r=>{var t;return(t=r?.byteLength)!==null&&t!==void 0?t:0};function as(r,t){let e=new Je,n=null,i=new ReadableStream({cancel(){return m(this,void 0,void 0,function*(){yield e.close()})},start(a){return m(this,void 0,void 0,function*(){yield s(a,n||(n=yield o()))})},pull(a){return m(this,void 0,void 0,function*(){n?yield s(a,n):a.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:i};function o(){return m(this,void 0,void 0,function*(){return yield(yield ft.from(e)).open(t)})}function s(a,c){return m(this,void 0,void 0,function*(){let l=a.desiredSize,f=null;for(;!(f=yield c.next()).done;)if(a.enqueue(f.value),l!=null&&--l<=0)return;a.close()})}}function cs(r,t){let e=new this(r),n=new Jt(e),i=new ReadableStream({cancel(){return m(this,void 0,void 0,function*(){yield n.cancel()})},pull(s){return m(this,void 0,void 0,function*(){yield o(s)})},start(s){return m(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(e,r),readable:i};function o(s){return m(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield n.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}function Ui(r){let t=ft.from(r);return Qt(t)?t.then(e=>Ui(e)):t.isAsync()?t.readAll().then(e=>new $(e)):new $(t.readAll())}function ls(r,t="stream"){return(t==="stream"?fr:dr).writeAll(r).toUint8Array(!0)}var _h=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Ls),ra),Js),Ns),Bs),Hs),Ds),{compareSchemas:rn,compareFields:ml,compareTypes:Zo});bt.toDOMStream=Cl;q.throughDOM=Vl;ft.throughDOM=as;Tr.throughDOM=as;Xe.throughDOM=as;on.throughDOM=cs;dr.throughDOM=cs;fr.throughDOM=cs;function us(r,t="float32"){return r instanceof Date?"date-millisecond":r instanceof Number?t:typeof r=="string"?"utf8":(r===null||r==="undefined","null")}function jl(r){let t=vh(r);return t!=="null"?{type:t,nullable:!1}:r.length>0?(t=us(r[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function vh(r){switch(r.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function zl(r,t){if(!t)switch(r){case"int8":return Int8Array;case"uint8":return Uint8Array;case"int16":return Int16Array;case"uint16":return Uint16Array;case"int32":return Int32Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;default:break}return Array}function hr(r){return Wl(r)}function fs(r){return Gl(r)}function Wl(r){return{fields:r.fields.map(t=>kn(t)),metadata:va(r.metadata)}}function Gl(r){return new U(r.fields.map(t=>Pn(t)),Ia(r.metadata))}function va(r){return Object.fromEntries(r)}function Ia(r){return r?new Map(Object.entries(r)):new Map}function kn(r){return{name:r.name,type:$l(r.type),nullable:r.nullable,metadata:va(r.metadata)}}function Pn(r){return new O(r.name,Yl(r.type),r.nullable,Ia(r.metadata))}function $l(r){switch(r.constructor){case nt:return"null";case re:return"binary";case Nt:return"bool";case et:let t=r;return`${t.isSigned?"u":""}int${t.bitWidth}`;case Re:return"int8";case Ce:return"int16";case yt:return"int32";case ce:return"int64";case ke:return"uint8";case Pe:return"uint16";case Ve:return"uint32";case je:return"uint64";case Mt:switch(r.precision){case P.HALF:return"float16";case P.SINGLE:return"float32";case P.DOUBLE:return"float64";default:return"float16"}case _r:return"float16";case ze:return"float32";case le:return"float64";case Lt:return"utf8";case ne:let n=r;return{type:"decimal",bitWidth:n.bitWidth,precision:n.precision,scale:n.scale};case $t:return r.unit===J.DAY?"date-day":"date-millisecond";case Nr:return"date-day";case Ur:return"date-millisecond";case Bt:switch(r.unit){case h.SECOND:return"time-second";case h.MILLISECOND:return"time-millisecond";case h.MICROSECOND:return"time-microsecond";case h.NANOSECOND:return"time-nanosecond";default:return"time-second"}case Rr:return"time-millisecond";case Er:return"time-second";case Cr:return"time-microsecond";case kr:return"time-nanosecond";case At:switch(r.unit){case h.SECOND:return"timestamp-second";case h.MILLISECOND:return"timestamp-millisecond";case h.MICROSECOND:return"timestamp-microsecond";case h.NANOSECOND:return"timestamp-nanosecond";default:return"timestamp-second"}case Pr:return"timestamp-second";case er:return"timestamp-millisecond";case Vr:return"timestamp-microsecond";case jr:return"timestamp-nanosecond";case Yt:switch(r.unit){case Q.DAY_TIME:return"interval-daytime";case Q.YEAR_MONTH:return"interval-yearmonth";default:return"interval-daytime"}case zr:return"interval-daytime";case Wr:return"interval-yearmonth";case Et:let c=r;return{type:"map",keysSorted:c.keysSorted,children:c.children.map(N=>kn(N))};case wt:let f=r.valueField;return{type:"list",children:[kn(f)]};case Ut:let d=r;return{type:"fixed-size-list",listSize:d.listSize,children:[kn(d.children[0])]};case k:return{type:"struct",children:r.children.map(N=>kn(N))};default:throw new Error(`arrow type not supported: ${r.constructor.name}`)}}function Yl(r){if(typeof r=="object")switch(r.type){case"decimal":return new ne(r.precision,r.scale,r.bitWidth);case"map":let t=r.children.map(i=>Pn(i));return new Et(t,r.keysSorted);case"list":let e=Pn(r.children[0]);return new wt(e);case"fixed-size-list":let n=Pn(r.children[0]);return new Ut(r.listSize,n);case"struct":return t=r.children.map(i=>Pn(i)),new k(t);default:throw new Error("array type not supported")}switch(r){case"null":return new nt;case"binary":return new re;case"bool":return new Nt;case"int8":return new Re;case"int16":return new Ce;case"int32":return new yt;case"int64":return new ce;case"uint8":return new ke;case"uint16":return new Pe;case"uint32":return new Ve;case"uint64":return new je;case"float16":return new _r;case"float32":return new ze;case"float64":return new le;case"utf8":return new Lt;case"date-day":return new Nr;case"date-millisecond":return new Ur;case"time-second":return new Er;case"time-millisecond":return new Rr;case"time-microsecond":return new Cr;case"time-nanosecond":return new kr;case"timestamp-second":return new Pr;case"timestamp-millisecond":return new er;case"timestamp-microsecond":return new Vr;case"timestamp-nanosecond":return new jr;case"interval-daytime":return new zr;case"interval-yearmonth":return new Wr;default:throw new Error("array type not supported")}}function Hl(r){switch(r.shape){case"array-row-table":case"object-row-table":return Sh(r.data);case"geojson-table":return xh(r.features);case"columnar-table":return Ih(r.data);case"arrow-table":default:throw new Error("Deduce schema")}}function Ih(r){let t=[];for(let[e,n]of Object.entries(r)){let i=Bh(n,e);t.push(i)}return{fields:t,metadata:{}}}function Sh(r){if(!r.length)throw new Error("deduce from empty table");let t=[],e=r[0];for(let[n,i]of Object.entries(e))t.push(Jl(i,n));return{fields:t,metadata:{}}}function xh(r){if(!r.length)throw new Error("deduce from empty table");let t=[],e=r[0].properties||{};for(let[n,i]of Object.entries(e))t.push(Jl(i,n));return{fields:t,metadata:{}}}function Bh(r,t){if(ArrayBuffer.isView(r)){let e=jl(r);return{name:t,type:e.type||"null",nullable:e.nullable}}if(Array.isArray(r)&&r.length>0){let e=r[0],n=us(e);return{name:t,type:n,nullable:!0}}throw new Error("empty table")}function Jl(r,t){let e=us(r);return{name:t,type:e,nullable:!0}}function Dr(r){switch(r.shape){case"array-row-table":case"object-row-table":return r.data.length;case"geojson-table":return r.features.length;case"arrow-table":return r.data.numRows;case"columnar-table":for(let e of Object.values(r.data))return e.length||0;return 0;default:throw new Error("table")}}function xa(r){if(r.schema)return r.schema.fields.length;if(Dr(r)===0)throw new Error("empty table");switch(r.shape){case"array-row-table":return r.data[0].length;case"object-row-table":return Object.keys(r.data[0]).length;case"geojson-table":return Object.keys(r.features[0]).length;case"columnar-table":return Object.keys(r.data).length;case"arrow-table":return r.data.numCols;default:throw new Error("table")}}function Kl(r,t,e){switch(r.shape){case"array-row-table":let n=Ah(r,e);return r.data[t][n];case"object-row-table":return r.data[t][e];case"geojson-table":return r.features[t][e];case"columnar-table":return r.data[e][t];case"arrow-table":let o=r.data,s=o.schema.fields.findIndex(a=>a.name===e);return o.getChildAt(s)?.get(t);default:throw new Error("todo")}}function Ba(r,t,e){switch(r.shape){case"array-row-table":return r.data[t][e];case"object-row-table":let n=Sa(r,e);return r.data[t][n];case"geojson-table":let i=Sa(r,e);return r.features[t][i];case"columnar-table":let o=Sa(r,e);return r.data[o][t];case"arrow-table":return r.data.getChildAt(e)?.get(t);default:throw new Error("todo")}}function Ah(r,t){let e=r.schema?.fields.findIndex(n=>n.name===t);if(e===void 0)throw new Error(t);return e}function Sa(r,t){let e=r.schema?.fields[t]?.name;if(!e)throw new Error(`${t}`);return e}function Zl(r,t,e,n){switch(r.shape){case"object-row-table":return n?Object.fromEntries(Object.entries(r.data[t])):r.data[t];case"array-row-table":if(r.schema){let c=e||{};for(let l=0;l<r.schema.fields.length;l++)c[r.schema.fields[l].name]=r.data[t][l];return c}throw new Error("no schema");case"geojson-table":if(r.schema){let c=e||{};for(let l=0;l<r.schema.fields.length;l++)c[r.schema.fields[l].name]=r.features[t][l];return c}throw new Error("no schema");case"columnar-table":if(r.schema){let c=e||{};for(let l=0;l<r.schema.fields.length;l++)c[r.schema.fields[l].name]=r.data[r.schema.fields[l].name][t];return c}else{let c=e||{};for(let[l,f]of Object.entries(r.data))c[l]=f[t];return c}case"arrow-table":let i=r.data,o=e||{},s=i.get(t),a=i.schema;for(let c=0;c<a.fields.length;c++)o[a.fields[c].name]=s?.[a.fields[c].name];return o;default:throw new Error("shape")}}function Xl(r,t,e,n){switch(r.shape){case"array-row-table":return n?Array.from(r.data[t]):r.data[t];case"object-row-table":if(r.schema){let c=e||[];for(let l=0;l<r.schema.fields.length;l++)c[l]=r.data[t][r.schema.fields[l].name];return c}return Object.values(r.data[t]);case"geojson-table":if(r.schema){let c=e||[];for(let l=0;l<r.schema.fields.length;l++)c[l]=r.features[t][r.schema.fields[l].name];return c}return Object.values(r.features[t]);case"columnar-table":if(r.schema){let c=e||[];for(let l=0;l<r.schema.fields.length;l++)c[l]=r.data[r.schema.fields[l].name][t];return c}else{let c=e||[],l=0;for(let f of Object.values(r.data))c[l]=f[t],l++;return c}case"arrow-table":let i=r.data,o=e||[],s=i.get(t),a=i.schema;for(let c=0;c<a.fields.length;c++)o[c]=s?.[a.fields[c].name];return o;default:throw new Error("shape")}}function ql(r,t){let e=zl(r.type,r.nullable);return new e(t)}function*Ql(r,t){let e=fs(r.schema),n=Dr(r),i=xa(r),o=t?.batchSize||n,s=e?.fields.map(l=>Se(l)),a=new k(e.fields),c=0;for(let l=0;l<n;l++)for(let f=0;f<i;++f){let d=Ba(r,l,f);if(s[f].append(d),c++,c>=o){let N=s.map(yr=>yr.flush()),st=new M(a,0,c,0,void 0,N);yield new G(e,st),c=0}}if(c>0){let l=s.map(d=>d.flush()),f=new M(a,0,c,0,void 0,l);yield new G(e,f),c=0}s.map(l=>l.finish())}function Aa(r,t){switch(r.shape){case"arrow-table":return r.data;case"columnar-table":default:let e=Ql(r,t);return new $(e)}}function Ta(r,t){switch(t){case"arrow-table":return Th(r);case"array-row-table":return Dh(r);case"object-row-table":return Oh(r);case"columnar-table":return Da(r);case"geojson-table":return Fh(r);default:throw new Error(t)}}function Th(r){return{shape:"arrow-table",schema:hr(r.schema),data:r}}function Dh(r){let t=Da(r);return sn(t,"array-row-table")}function Oh(r){let t=Da(r);return sn(t,"object-row-table")}function Da(r){let t={};for(let n of r.schema.fields){let o=r.getChild(n.name)?.toArray();t[n.name]=o}return{shape:"columnar-table",schema:hr(r.schema),data:t}}function Fh(r){let t=hr(r.schema),e=[];for(let n=0;n<r.numRows;n++){let i=r.get(n)?.toJSON()||{};e.push({type:"Feature",geometry:null,properties:i})}return{shape:"geojson-table",type:"FeatureCollection",schema:t,features:e}}function sn(r,t){switch(t){case"object-row-table":return Nh(r);case"array-row-table":return Lh(r);case"columnar-table":return Mh(r);case"arrow-table":return Uh(r);default:throw new Error(t)}}function Mh(r){let t=r.schema||Hl(r),e=r.schema?.fields||[];if(r.shape==="columnar-table")return{...r,schema:t};let n=Dr(r),i={};for(let o of e){let s=ql(o,n);i[o.name]=s;for(let a=0;a<n;a++)s[a]=Kl(r,a,o.name)}return{shape:"columnar-table",schema:t,data:i}}function Lh(r){if(r.shape==="array-row-table")return r;let t=Dr(r),e=new Array(t);for(let n=0;n<t;n++)e[n]=Xl(r,n);return{shape:"array-row-table",schema:r.schema,data:e}}function Nh(r){if(r.shape==="object-row-table")return r;let t=Dr(r),e=new Array(t);for(let n=0;n<t;n++)e[n]=Zl(r,n);return{shape:"object-row-table",schema:r.schema,data:e}}function Uh(r){let t=Aa(r);return{shape:"arrow-table",schema:r.schema,data:t}}var tu=r=>typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer;var eu="beta";function Eh(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.4.0-alpha.12"),globalThis._loadersgl_.version}var Oa=Eh();function qe(r,t){if(!r)throw new Error(t||"loaders.gl assertion failed.")}var Qe={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},wS=Qe.self||Qe.window||Qe.global||{},_S=Qe.window||Qe.self||Qe.global||{},vS=Qe.global||Qe.self||Qe.window||{},IS=Qe.document||{};var pr=typeof process!="object"||String(process)!=="[object process]"||process.browser;var nu=typeof window<"u"&&typeof window.orientation<"u",ru=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),SS=ru&&parseFloat(ru[1])||0;var Ei=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(t,e){this.name=t,this.workerThread=e,this.result=new Promise((n,i)=>{this._resolve=n,this._reject=i})}postMessage(t,e){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:e})}done(t){qe(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){qe(this.isRunning),this.isRunning=!1,this._reject(t)}};var Vn=class{terminate(){}};var Fa=new Map;function iu(r){qe(r.source&&!r.url||!r.source&&r.url);let t=Fa.get(r.source||r.url);return t||(r.url&&(t=Rh(r.url),Fa.set(r.url,t)),r.source&&(t=ou(r.source),Fa.set(r.source,t))),qe(t),t}function Rh(r){if(!r.startsWith("http"))return r;let t=Ch(r);return ou(t)}function ou(r){let t=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(t)}function Ch(r){return`try {
|
|
16
|
+
]`}concat(...t){let e=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new $(e,n.map(i=>new G(e,i)))}slice(t,e){let n=this.schema;[t,e]=Qn({length:this.numRows},t,e);let i=So(this.data,this._offsets,t,e);return new $(n,i.map(o=>new G(n,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let e=this.data.map(n=>n.children[t]);if(e.length===0){let{type:n}=this.schema.fields[t],i=b({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new y(e)}return null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),e)}setChildAt(t,e){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new y([b({type:new nt,length:this.numRows})]));let o=n.fields.slice(),s=o[t].clone({type:e.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,e],[n,i]=qo(n,a)}return new $(n,i)}select(t){let e=this.schema.fields.reduce((n,i,o)=>n.set(i.name,o),new Map);return this.selectAt(t.map(n=>e.get(n)).filter(n=>n>-1))}selectAt(t){let e=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new $(e,n)}assign(t){let e=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[f,d]=a,V=e.findIndex(N=>N.name===c.name);return~V?d[V]=l:f.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...e.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new $(...qo(o,s))}};yl=Symbol.toStringTag;$[yl]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=vn(ri),r.get=vn(ct.getVisitFn(u.Struct)),r.set=xo(_t.getVisitFn(u.Struct)),r.indexOf=Bo(Kr.getVisitFn(u.Struct)),"Table"))($.prototype);var bl,G=class{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof U))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=b({nullCount:0,type:new k(this.schema.fields),children:this.schema.fields.map(e=>b({type:e.type,nullCount:0}))})]=t,!(this.data instanceof M))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=gl(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:n,children:i,length:o}=Object.keys(e).reduce((c,l,f)=>(c.children[f]=e[l],c.length=Math.max(c.length,e[l].length),c.fields[f]=O.new({name:l,type:e[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new U(n),a=b({type:new k(n),length:o,children:i,nullCount:0});[this.schema,this.data]=gl(s,a.children,o);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=wl(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 ct.visit(this.data,t)}at(t){return this.get(Gr(t,this.numRows))}set(t,e){return _t.visit(this.data,t,e)}indexOf(t,e){return Kr.visit(this.data,t,e)}[Symbol.iterator](){return In.visit(new y([this.data]))}toArray(){return[...this]}concat(...t){return new $(this.schema,[this,...t])}slice(t,e){let[n]=new y([this.data]).slice(t,e).data;return new G(this.schema,n)}getChild(t){var e;return this.getChildAt((e=this.schema.fields)===null||e===void 0?void 0:e.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new y([this.data.children[t]]):null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),e)}setChildAt(t,e){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){e||(e=new y([b({type:new nt,length:this.numRows})]));let o=n.fields.slice(),s=i.children.slice(),a=o[t].clone({type:e.type});[o[t],s[t]]=[a,e.data[0]],n=new U(o,new Map(this.schema.metadata)),i=b({type:new k(o),children:s})}return new G(n,i)}select(t){let e=this.schema.select(t),n=new k(e.fields),i=[];for(let o of t){let s=this.schema.fields.findIndex(a=>a.name===o);~s&&(i[s]=this.data.children[s])}return new G(e,b({type:n,length:this.numRows,children:i}))}selectAt(t){let e=this.schema.selectAt(t),n=t.map(o=>this.data.children[o]).filter(Boolean),i=b({type:new k(e.fields),length:this.numRows,children:n});return new G(e,i)}};bl=Symbol.toStringTag;G[bl]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(G.prototype);function gl(r,t,e=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...r.fields],o=[...t],s=(e+63&-64)>>3;for(let[a,c]of r.fields.entries()){let l=t[a];(!l||l.length!==e)&&(i[a]=c.clone({nullable:!0}),o[a]=(n=l?._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:b({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(s)}))}return[r.assign(i),b({type:new k(i),length:e,children:o})]}function wl(r,t,e=new Map){var n,i;if(((n=r?.length)!==null&&n!==void 0?n:0)>0&&r?.length===t?.length)for(let o=-1,s=r.length;++o<s;){let{type:a}=r[o],c=t[o];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])wl(a.children,l?.children,e);if(p.isDictionary(a)){let{id:l}=a;if(!e.has(l))c?.dictionary&&e.set(l,c.dictionary);else if(e.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return e}var nn=class extends G{constructor(t){let e=t.fields.map(i=>b({type:i.type})),n=b({type:new k(t.fields),nullCount:0,children:e});super(t,n)}};var it=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,e){return this.bb_pos=t,this.bb=e,this}static getRootAsMessage(t,e){return(e||new it).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new it).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):z.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):R.NONE}header(t){let e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){let n=this.bb.__offset(this.bb_pos,12);return n?(e||new K).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,z.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,R.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,BigInt("0"))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,n,i,o,s){return it.startMessage(t),it.addVersion(t,e),it.addHeaderType(t,n),it.addHeader(t,i),it.addBodyLength(t,o),it.addCustomMetadata(t,s),it.endMessage(t)}};var ca=class extends w{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return Ne.startNull(e),Ne.endNull(e)}visitInt(t,e){return ht.startInt(e),ht.addBitWidth(e,t.bitWidth),ht.addIsSigned(e,t.isSigned),ht.endInt(e)}visitFloat(t,e){return zt.startFloatingPoint(e),zt.addPrecision(e,t.precision),zt.endFloatingPoint(e)}visitBinary(t,e){return De.startBinary(e),De.endBinary(e)}visitLargeBinary(t,e){return Fe.startLargeBinary(e),Fe.endLargeBinary(e)}visitBool(t,e){return Oe.startBool(e),Oe.endBool(e)}visitUtf8(t,e){return Ee.startUtf8(e),Ee.endUtf8(e)}visitLargeUtf8(t,e){return Me.startLargeUtf8(e),Me.endLargeUtf8(e)}visitDecimal(t,e){return pt.startDecimal(e),pt.addScale(e,t.scale),pt.addPrecision(e,t.precision),pt.addBitWidth(e,t.bitWidth),pt.endDecimal(e)}visitDate(t,e){return kt.startDate(e),kt.addUnit(e,t.unit),kt.endDate(e)}visitTime(t,e){return St.startTime(e),St.addUnit(e,t.unit),St.addBitWidth(e,t.bitWidth),St.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return xt.startTimestamp(e),xt.addUnit(e,t.unit),n!==void 0&&xt.addTimezone(e,n),xt.endTimestamp(e)}visitInterval(t,e){return Wt.startInterval(e),Wt.addUnit(e,t.unit),Wt.endInterval(e)}visitDuration(t,e){return Pt.startDuration(e),Pt.addUnit(e,t.unit),Pt.endDuration(e)}visitList(t,e){return Le.startList(e),Le.endList(e)}visitStruct(t,e){return Ue.startStruct_(e),Ue.endStruct_(e)}visitUnion(t,e){mt.startTypeIdsVector(e,t.typeIds.length);let n=mt.createTypeIdsVector(e,t.typeIds);return mt.startUnion(e),mt.addMode(e,t.mode),mt.addTypeIds(e,n),mt.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return ee.startDictionaryEncoding(e),ee.addId(e,BigInt(t.id)),ee.addIsOrdered(e,t.isOrdered),n!==void 0&&ee.addIndexType(e,n),ee.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return Vt.startFixedSizeBinary(e),Vt.addByteWidth(e,t.byteWidth),Vt.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return jt.startFixedSizeList(e),jt.addListSize(e,t.listSize),jt.endFixedSizeList(e)}visitMap(t,e){return Gt.startMap(e),Gt.addKeysSorted(e,t.keysSorted),Gt.endMap(e)}},Qo=new ca;function Sl(r,t=new Map){return new U(Nd(r,t),ts(r.metadata),t)}function la(r){return new vt(r.count,Bl(r.columns),Al(r.columns))}function xl(r){return new Xt(la(r.data),r.id,r.isDelta)}function Nd(r,t){return(r.fields||[]).filter(Boolean).map(e=>O.fromJSON(e,t))}function _l(r,t){return(r.children||[]).filter(Boolean).map(e=>O.fromJSON(e,t))}function Bl(r){return(r||[]).reduce((t,e)=>[...t,new de(e.count,Ud(e.VALIDITY)),...Bl(e.children)],[])}function Al(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new Zt(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new Zt(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new Zt(t.length,i.OFFSET.length)),i.DATA&&t.push(new Zt(t.length,i.DATA.length)),t=Al(i.children,t)}return t}function Ud(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function Tl(r,t){let e,n,i,o,s,a;return!t||!(o=r.dictionary)?(s=Il(r,_l(r,t)),i=new O(r.name,s,r.nullable,ts(r.metadata))):t.has(e=o.id)?(n=(n=o.indexType)?vl(n):new yt,a=new Tt(t.get(e),n,e,o.isOrdered),i=new O(r.name,a,r.nullable,ts(r.metadata))):(n=(n=o.indexType)?vl(n):new yt,t.set(e,s=Il(r,_l(r,t))),a=new Tt(s,n,e,o.isOrdered),i=new O(r.name,a,r.nullable,ts(r.metadata))),i||null}function ts(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function vl(r){return new et(r.isSigned,r.bitWidth)}function Il(r,t){let e=r.type.name;switch(e){case"NONE":return new nt;case"null":return new nt;case"binary":return new re;case"largebinary":return new We;case"utf8":return new Lt;case"largeutf8":return new Ge;case"bool":return new Nt;case"list":return new wt((t||[])[0]);case"struct":return new k(t||[]);case"struct_":return new k(t||[])}switch(e){case"int":{let n=r.type;return new et(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new Mt(P[n.precision])}case"decimal":{let n=r.type;return new ne(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new $t(J[n.unit])}case"time":{let n=r.type;return new Bt(h[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new At(h[n.unit],n.timezone)}case"interval":{let n=r.type;return new Yt(Q[n.unit])}case"duration":{let n=r.type;return new $e(h[n.unit])}case"union":{let n=r.type,[i,...o]=(n.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new ue(Y[s],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new Ye(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Ut(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new Et((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var Ed=tr,Rd=Ft,ut=class{static fromJSON(t,e){let n=new ut(0,z.V5,e);return n._createHeader=Cd(t,e),n}static decode(t){t=new Rd(B(t));let e=it.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),o=e.headerType(),s=new ut(n,i,o);return s._createHeader=kd(e,o),s}static encode(t){let e=new Ed,n=-1;return t.isSchema()?n=U.encode(e,t.header()):t.isRecordBatch()?n=vt.encode(e,t.header()):t.isDictionaryBatch()&&(n=Xt.encode(e,t.header())),it.startMessage(e),it.addVersion(e,z.V5),it.addHeader(e,n),it.addHeaderType(e,t.headerType),it.addBodyLength(e,BigInt(t.bodyLength)),it.finishMessageBuffer(e,it.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof U)return new ut(0,z.V5,R.Schema,t);if(t instanceof vt)return new ut(e,z.V5,R.RecordBatch,t);if(t instanceof Xt)return new ut(e,z.V5,R.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===R.Schema}isRecordBatch(){return this.headerType===R.RecordBatch}isDictionaryBatch(){return this.headerType===R.DictionaryBatch}constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=C(t)}},vt=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}constructor(t,e,n){this._nodes=e,this._buffers=n,this._length=C(t)}},Xt=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,n=!1){this._data=t,this._isDelta=n,this._id=C(e)}},Zt=class{constructor(t,e){this.offset=C(t),this.length=C(e)}},de=class{constructor(t,e){this.length=C(t),this.nullCount=C(e)}};function Cd(r,t){return()=>{switch(t){case R.Schema:return U.fromJSON(r);case R.RecordBatch:return vt.fromJSON(r);case R.DictionaryBatch:return Xt.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${R[t]}, type: ${t} }`)}}function kd(r,t){return()=>{switch(t){case R.Schema:return U.decode(r.header(new tt),new Map,r.version());case R.RecordBatch:return vt.decode(r.header(new It),r.version());case R.DictionaryBatch:return Xt.decode(r.header(new ae),r.version())}throw new Error(`Unrecognized Message type: { name: ${R[t]}, type: ${t} }`)}}O.encode=Kd;O.decode=Hd;O.fromJSON=Tl;U.encode=Jd;U.decode=Pd;U.fromJSON=Sl;vt.encode=Zd;vt.decode=Vd;vt.fromJSON=la;Xt.encode=Xd;Xt.decode=jd;Xt.fromJSON=xl;de.encode=qd;de.decode=Wd;Zt.encode=Qd;Zt.decode=zd;function Pd(r,t=new Map,e=z.V5){let n=Yd(r,t);return new U(n,es(r),t,e)}function Vd(r,t=z.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new vt(r.length(),Gd(r),$d(r,t))}function jd(r,t=z.V5){return new Xt(vt.decode(r.data(),t),r.id(),r.isDelta())}function zd(r){return new Zt(r.offset(),r.length())}function Wd(r){return new de(r.length(),r.nullCount())}function Gd(r){let t=[];for(let e,n=-1,i=-1,o=r.nodesLength();++n<o;)(e=r.nodes(n))&&(t[++i]=de.decode(e));return t}function $d(r,t){let e=[];for(let n,i=-1,o=-1,s=r.buffersLength();++i<s;)(n=r.buffers(i))&&(t<z.V4&&(n.bb_pos+=8*(i+1)),e[++o]=Zt.decode(n));return e}function Yd(r,t){let e=[];for(let n,i=-1,o=-1,s=r.fieldsLength();++i<s;)(n=r.fields(i))&&(e[++o]=O.decode(n,t));return e}function Dl(r,t){let e=[];for(let n,i=-1,o=-1,s=r.childrenLength();++i<s;)(n=r.children(i))&&(e[++o]=O.decode(n,t));return e}function Hd(r,t){let e,n,i,o,s,a;return!t||!(a=r.dictionary())?(i=Fl(r,Dl(r,t)),n=new O(r.name(),i,r.nullable(),es(r))):t.has(e=C(a.id()))?(o=(o=a.indexType())?Ol(o):new yt,s=new Tt(t.get(e),o,e,a.isOrdered()),n=new O(r.name(),s,r.nullable(),es(r))):(o=(o=a.indexType())?Ol(o):new yt,t.set(e,i=Fl(r,Dl(r,t))),s=new Tt(i,o,e,a.isOrdered()),n=new O(r.name(),s,r.nullable(),es(r))),n||null}function es(r){let t=new Map;if(r)for(let e,n,i=-1,o=Math.trunc(r.customMetadataLength());++i<o;)(e=r.customMetadata(i))&&(n=e.key())!=null&&t.set(n,e.value());return t}function Ol(r){return new et(r.isSigned(),r.bitWidth())}function Fl(r,t){let e=r.typeType();switch(e){case H.NONE:return new nt;case H.Null:return new nt;case H.Binary:return new re;case H.LargeBinary:return new We;case H.Utf8:return new Lt;case H.LargeUtf8:return new Ge;case H.Bool:return new Nt;case H.List:return new wt((t||[])[0]);case H.Struct_:return new k(t||[])}switch(e){case H.Int:{let n=r.type(new ht);return new et(n.isSigned(),n.bitWidth())}case H.FloatingPoint:{let n=r.type(new zt);return new Mt(n.precision())}case H.Decimal:{let n=r.type(new pt);return new ne(n.scale(),n.precision(),n.bitWidth())}case H.Date:{let n=r.type(new kt);return new $t(n.unit())}case H.Time:{let n=r.type(new St);return new Bt(n.unit(),n.bitWidth())}case H.Timestamp:{let n=r.type(new xt);return new At(n.unit(),n.timezone())}case H.Interval:{let n=r.type(new Wt);return new Yt(n.unit())}case H.Duration:{let n=r.type(new Pt);return new $e(n.unit())}case H.Union:{let n=r.type(new mt);return new ue(n.mode(),n.typeIdsArray()||[],t||[])}case H.FixedSizeBinary:{let n=r.type(new Vt);return new Ye(n.byteWidth())}case H.FixedSizeList:{let n=r.type(new jt);return new Ut(n.listSize(),(t||[])[0])}case H.Map:{let n=r.type(new Gt);return new Et((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${H[e]}" (${e})`)}function Jd(r,t){let e=t.fields.map(o=>O.encode(r,o));tt.startFieldsVector(r,e.length);let n=tt.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?tt.createCustomMetadataVector(r,[...t.metadata].map(([o,s])=>{let a=r.createString(`${o}`),c=r.createString(`${s}`);return K.startKeyValue(r),K.addKey(r,a),K.addValue(r,c),K.endKeyValue(r)})):-1;return tt.startSchema(r),tt.addFields(r,n),tt.addEndianness(r,th?wr.Little:wr.Big),i!==-1&&tt.addCustomMetadata(r,i),tt.endSchema(r)}function Kd(r,t){let e=-1,n=-1,i=-1,o=t.type,s=t.typeId;p.isDictionary(o)?(s=o.dictionary.typeId,i=Qo.visit(o,r),n=Qo.visit(o.dictionary,r)):n=Qo.visit(o,r);let a=(o.children||[]).map(f=>O.encode(r,f)),c=at.createChildrenVector(r,a),l=t.metadata&&t.metadata.size>0?at.createCustomMetadataVector(r,[...t.metadata].map(([f,d])=>{let V=r.createString(`${f}`),N=r.createString(`${d}`);return K.startKeyValue(r),K.addKey(r,V),K.addValue(r,N),K.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),at.startField(r),at.addType(r,n),at.addTypeType(r,s),at.addChildren(r,c),at.addNullable(r,!!t.nullable),e!==-1&&at.addName(r,e),i!==-1&&at.addDictionary(r,i),l!==-1&&at.addCustomMetadata(r,l),at.endField(r)}function Zd(r,t){let e=t.nodes||[],n=t.buffers||[];It.startNodesVector(r,e.length);for(let s of e.slice().reverse())de.encode(r,s);let i=r.endVector();It.startBuffersVector(r,n.length);for(let s of n.slice().reverse())Zt.encode(r,s);let o=r.endVector();return It.startRecordBatch(r),It.addLength(r,BigInt(t.length)),It.addNodes(r,i),It.addBuffers(r,o),It.endRecordBatch(r)}function Xd(r,t){let e=vt.encode(r,t.data);return ae.startDictionaryBatch(r),ae.addId(r,BigInt(t.id)),ae.addIsDelta(r,t.isDelta),ae.addData(r,e),ae.endDictionaryBatch(r)}function qd(r,t){return dn.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function Qd(r,t){return fn.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var th=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var fa=r=>`Expected ${R[r]} Message in stream, but was null or length 0.`,da=r=>`Header pointer of flatbuffer-encoded ${R[r]} Message is null or length 0.`,Ml=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,Ll=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`,Ln=class{constructor(t){this.source=t instanceof Ke?t:new Ke(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?Z:t.value===-1&&(t=this.readMetadataLength()).done?Z:(t=this.readMetadata(t.value)).done?Z:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(fa(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=B(this.source.read(t));if(e.byteLength<t)throw new Error(Ll(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=R.Schema,n=this.readMessage(e),i=n?.header();if(t&&!i)throw new Error(da(e));return i}readMetadataLength(){let t=this.source.read(rs),e=t&&new Ft(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let e=this.source.read(t);if(!e)return Z;if(e.byteLength<t)throw new Error(Ml(t,e.byteLength));return{done:!1,value:ut.decode(e)}}},Mi=class{constructor(t,e){this.source=t instanceof Jt?t:Gi(t)?new Br(t,e):new Jt(t)}[Symbol.asyncIterator](){return this}next(){return m(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?Z:t.value===-1&&(t=yield this.readMetadataLength()).done?Z:(t=yield this.readMetadata(t.value)).done?Z:t})}throw(t){return m(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return m(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return m(this,void 0,void 0,function*(){let e;if((e=yield this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(fa(t));return e.value})}readMessageBody(t){return m(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=B(yield this.source.read(t));if(e.byteLength<t)throw new Error(Ll(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(){return m(this,arguments,void 0,function*(t=!1){let e=R.Schema,n=yield this.readMessage(e),i=n?.header();if(t&&!i)throw new Error(da(e));return i})}readMetadataLength(){return m(this,void 0,void 0,function*(){let t=yield this.source.read(rs),e=t&&new Ft(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return m(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return Z;if(e.byteLength<t)throw new Error(Ml(t,e.byteLength));return{done:!1,value:ut.decode(e)}})}},Li=class extends Ln{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof ni?t:new ni(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:ut.fromJSON(t.schema,R.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:ut.fromJSON(e,R.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:ut.fromJSON(e,R.RecordBatch)}}return this._body=[],Z}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...e(o.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(fa(t));return e.value}readSchema(){let t=R.Schema,e=this.readMessage(t),n=e?.header();if(!e||!n)throw new Error(da(t));return n}},rs=4,ua="ARROW1",Nn=new Uint8Array(ua.length);for(let r=0;r<ua.length;r+=1)Nn[r]=ua.codePointAt(r);function ns(r,t=0){for(let e=-1,n=Nn.length;++e<n;)if(Nn[e]!==r[t+e])return!1;return!0}var Un=Nn.length,ha=Un+rs,Nl=Un*2+rs;var ft=class extends Xr{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let e=this._impl.open(t);return Qt(e)?e.then(()=>this):this}readRecordBatch(t){return this._impl.isFile()?this._impl.readRecordBatch(t):null}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}toDOMStream(){return bt.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return bt.toNodeStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this},{objectMode:!0})}static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof ft?t:zi(t)?rh(t):Gi(t)?oh(t):Qt(t)?(()=>m(this,void 0,void 0,function*(){return yield ft.from(yield t)}))():$i(t)||$n(t)||Hi(t)||oe(t)?ih(new Jt(t)):nh(new Ke(t))}static readAll(t){return t instanceof ft?t.isSync()?Ul(t):El(t):zi(t)||ArrayBuffer.isView(t)||pe(t)||Wi(t)?Ul(t):El(t)}},Xe=class extends ft{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return qt(this,arguments,function*(){yield L(yield*ln(he(this[Symbol.iterator]())))})}},Ar=class extends ft{constructor(t){super(t),this._impl=t}readAll(){return m(this,void 0,void 0,function*(){var t,e,n,i;let o=new Array;try{for(var s=!0,a=he(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){e={error:l}}finally{try{!s&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(e)throw e.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Tr=class extends Xe{constructor(t){super(t),this._impl=t}},Ni=class extends Ar{constructor(t){super(t),this._impl=t}},is=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,e){let n=this._loadVectors(t,e,this.schema.fields),i=b({type:new k(this.schema.fields),length:t.length,children:n});return new G(this.schema,i)}_loadDictionaryBatch(t,e){let{id:n,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(n),c=s.dictionaries.get(n),l=this._loadVectors(t.data,e,[c]);return(a&&i?a.concat(new y(l)):new y(l)).memoize()}_loadVectors(t,e,n){return new si(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},En=class extends is{constructor(t,e){super(e),this._reader=zi(t)?new Li(this._handle=t):new Ln(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=Rl(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):Z}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Z}next(){if(this.closed)return Z;let t,{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new nn(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Rn=class extends is{constructor(t,e){super(e),this._reader=new Mi(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return m(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 m(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Rl(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return m(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):Z})}return(t){return m(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Z})}next(){return m(this,void 0,void 0,function*(){if(this.closed)return Z;let t,{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new nn(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return m(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},os=class extends En{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,e){super(t instanceof ii?t:new ii(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let e of this._footer.dictionaryBatches())e&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var e;if(this.closed)return null;this._footer||this.open();let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(R.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null}_readDictionaryBatch(t){var e;let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(R.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,e=t.size-ha,n=t.readInt32(e),i=t.readAt(e-n,n);return ir.decode(i)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},pa=class extends Rn{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,...e){let n=typeof e[0]!="number"?e.shift():void 0,i=e[0]instanceof Map?e.shift():void 0;super(t instanceof Br?t:new Br(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return m(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){return m(this,void 0,void 0,function*(){var e;if(this.closed)return null;this._footer||(yield this.open());let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(R.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s)}}return null})}_readDictionaryBatch(t){return m(this,void 0,void 0,function*(){var e;let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(R.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}})}_readFooter(){return m(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-ha,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return ir.decode(i)})}_readNextMessageAndValidate(t){return m(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null})}},ma=class extends En{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new Do(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function Rl(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*Ul(r){let t=ft.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function El(r){return qt(this,arguments,function*(){let e=yield L(ft.from(r));try{if(!(yield L(e.open({autoDestroy:!1}))).closed)do yield yield L(e);while(!(yield L(e.reset().open())).closed)}finally{yield L(e.cancel())}})}function rh(r){return new Xe(new ma(r))}function nh(r){let t=r.peek(Un+7&-8);return t&&t.byteLength>=4?ns(t)?new Tr(new os(r.read())):new Xe(new En(r)):new Xe(new En(function*(){}()))}function ih(r){return m(this,void 0,void 0,function*(){let t=yield r.peek(Un+7&-8);return t&&t.byteLength>=4?ns(t)?new Tr(new os(yield r.read())):new Ar(new Rn(r)):new Ar(new Rn(function(){return qt(this,arguments,function*(){})}()))})}function oh(r){return m(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new Br(r,t);return t>=Nl&&ns(yield e.readAt(0,Un+7&-8))?new Ni(new pa(e)):new Ar(new Rn(e))})}var X=class extends w{static assemble(...t){let e=i=>i.flatMap(o=>Array.isArray(o)?e(o):o instanceof G?o.data.children:o.data),n=new X;return n.visitMany(e(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof y)return this.visitMany(t.data),this;let{type:e}=t;if(!p.isDictionary(e)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(p.isUnion(e))this.nodes.push(new de(n,0));else{let{nullCount:i}=t;p.isNull(e)||xe.call(this,i<=0?new Uint8Array(0):Yr(t.offset,n,t.nullBitmap)),this.nodes.push(new de(n,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}};function xe(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new Zt(this._byteLength,t)),this._byteLength+=t,this}function sh(r){var t;let{type:e,length:n,typeIds:i,valueOffsets:o}=r;if(xe.call(this,i),e.mode===Y.Sparse)return ya.call(this,r);if(e.mode===Y.Dense){if(r.offset<=0)return xe.call(this,o),ya.call(this,r);{let s=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,f,d=-1;++d<n;)(l=i[d])!==void 0&&((f=a[l])===void 0&&(f=a[l]=o[d]),s[d]=o[d]-f,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);xe.call(this,s),this.visitMany(r.children.map((l,f)=>{let d=e.typeIds[f],V=a[d],N=c[d];return l.slice(V,Math.min(n,N))}))}}return this}function ah(r){let t;return r.nullCount>=r.length?xe.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?xe.call(this,Yr(r.offset,r.length,t)):xe.call(this,Hr(r.values))}function ur(r){return xe.call(this,r.values.subarray(0,r.length*r.stride))}function ss(r){let{length:t,values:e,valueOffsets:n}=r,i=C(n[0]),o=C(n[t]),s=Math.min(o-i,e.byteLength-i);return xe.call(this,Ki(-i,t+1,n)),xe.call(this,e.subarray(i,i+s)),this}function ga(r){let{length:t,valueOffsets:e}=r;if(e){let{[0]:n,[t]:i}=e;return xe.call(this,Ki(-n,t+1,e)),this.visit(r.children[0].slice(n,i-n))}return this.visit(r.children[0])}function ya(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}X.prototype.visitBool=ah;X.prototype.visitInt=ur;X.prototype.visitFloat=ur;X.prototype.visitUtf8=ss;X.prototype.visitLargeUtf8=ss;X.prototype.visitBinary=ss;X.prototype.visitLargeBinary=ss;X.prototype.visitFixedSizeBinary=ur;X.prototype.visitDate=ur;X.prototype.visitTimestamp=ur;X.prototype.visitTime=ur;X.prototype.visitDecimal=ur;X.prototype.visitList=ga;X.prototype.visitStruct=ya;X.prototype.visitUnion=sh;X.prototype.visitInterval=ur;X.prototype.visitDuration=ur;X.prototype.visitFixedSizeList=ga;X.prototype.visitMap=ga;var on=class extends Xr{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,e){throw new Error('"throughDOM" not available in this environment')}constructor(t){super(),this._position=0,this._started=!1,this._sink=new Je,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,Ot(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 Qt(t)?t.then(e=>this.writeAll(e)):oe(t)?wa(this,t):ba(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,e=null){return t===this._sink||t instanceof Je?this._sink=t:(this._sink=new Je,t&&qa(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Qa(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!e||!rn(e,this._schema))&&(e==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=e,this._writeSchema(e))),this}write(t){let e=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof $&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof G&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!rn(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof G?t instanceof nn||this._writeRecordBatch(t):t instanceof $?this.writeAll(t.batches):pe(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=ut.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+n&~n,c=a-o-s;return t.headerType===R.RecordBatch?this._recordBatchBlocks.push(new Ie(a,t.bodyLength,this._position)):t.headerType===R.DictionaryBatch&&this._dictionaryBlocks.push(new Ie(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let e=B(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(ut.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Nn)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:o}=X.assemble(t),s=new vt(t.numRows,n,i),a=ut.from(s,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(o)}_writeDictionaryBatch(t,e,n=!1){let{byteLength:i,nodes:o,bufferRegions:s,buffers:a}=X.assemble(new y([t])),c=new vt(t.length,o,s),l=new Xt(c,e,n),f=ut.from(l,i);return this._writeMessage(f)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,n,i;for(let o=-1,s=t.length;++o<s;)(e=t[o])&&(n=e.byteLength)>0&&(this._write(e),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){var e,n;for(let[i,o]of t.dictionaries){let s=(e=o?.data)!==null&&e!==void 0?e:[],a=this._seenDictionaries.get(i),c=(n=this._dictionaryDeltaOffsets.get(i))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==s[0])for(let[l,f]of s.entries())this._writeDictionaryBatch(f,i,l>0);else if(c<s.length)for(let l of s.slice(c))this._writeDictionaryBatch(l,i,!0);this._seenDictionaries.set(i,o),this._dictionaryDeltaOffsets.set(i,s.length)}return this}},fr=class extends on{static writeAll(t,e){let n=new fr(e);return Qt(t)?t.then(i=>n.writeAll(i)):oe(t)?wa(n,t):ba(n,t)}},dr=class extends on{static writeAll(t){let e=new dr;return Qt(t)?t.then(n=>e.writeAll(n)):oe(t)?wa(e,t):ba(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,e,n=!1){if(!n&&this._seenDictionaries.has(e))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,e,n)}_writeFooter(t){let e=ir.encode(new ir(t,z.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function ba(r,t){let e=t;t instanceof $&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function wa(r,t){return m(this,void 0,void 0,function*(){var e,n,i,o,s,a,c;try{for(e=!0,n=he(t);i=yield n.next(),o=i.done,!o;e=!0){c=i.value,e=!1;let l=c;r.write(l)}}catch(l){s={error:l}}finally{try{!e&&!o&&(a=n.return)&&(yield a.call(n))}finally{if(s)throw s.error}}return r.finish()})}function Cl(r,t){if(oe(r))return lh(r,t);if(pe(r))return ch(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function ch(r,t){let e=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,e||(e=r[Symbol.iterator]()))},pull(s){e?o(s,e):s.close()},cancel(){(e?.return&&e.return()||!0)&&(e=null)}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){let c,l=null,f=s.desiredSize||null;for(;!(l=a.next(n?f:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=B(l.value))&&(f!=null&&n&&(f=f-c.byteLength+1),l.value=c),s.enqueue(l.value),f!=null&&--f<=0)return;s.close()}}function lh(r,t){let e=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return m(this,void 0,void 0,function*(){yield o(s,e||(e=r[Symbol.asyncIterator]()))})},pull(s){return m(this,void 0,void 0,function*(){e?yield o(s,e):s.close()})},cancel(){return m(this,void 0,void 0,function*(){(e?.return&&(yield e.return())||!0)&&(e=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){return m(this,void 0,void 0,function*(){let c,l=null,f=s.desiredSize||null;for(;!(l=yield a.next(n?f:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=B(l.value))&&(f!=null&&n&&(f=f-c.byteLength+1),l.value=c),s.enqueue(l.value),f!=null&&--f<=0)return;s.close()})}}function Vl(r){return new _a(r)}var _a=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,o=Za(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=Se(o),this._getSize=i!=="bytes"?kl:Pl;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},e),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:s,size:i!=="bytes"?kl:Pl}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let e=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-e}_maybeFlush(t,e){e!=null&&(this._bufferedSize>=e.desiredSize&&++this._numChunks&&this._enqueue(e,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(e,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(e,null)))}_enqueue(t,e){this._bufferedSize=0,this._controller=null,e==null?t.close():t.enqueue(e)}},kl=r=>{var t;return(t=r?.length)!==null&&t!==void 0?t:0},Pl=r=>{var t;return(t=r?.byteLength)!==null&&t!==void 0?t:0};function as(r,t){let e=new Je,n=null,i=new ReadableStream({cancel(){return m(this,void 0,void 0,function*(){yield e.close()})},start(a){return m(this,void 0,void 0,function*(){yield s(a,n||(n=yield o()))})},pull(a){return m(this,void 0,void 0,function*(){n?yield s(a,n):a.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:i};function o(){return m(this,void 0,void 0,function*(){return yield(yield ft.from(e)).open(t)})}function s(a,c){return m(this,void 0,void 0,function*(){let l=a.desiredSize,f=null;for(;!(f=yield c.next()).done;)if(a.enqueue(f.value),l!=null&&--l<=0)return;a.close()})}}function cs(r,t){let e=new this(r),n=new Jt(e),i=new ReadableStream({cancel(){return m(this,void 0,void 0,function*(){yield n.cancel()})},pull(s){return m(this,void 0,void 0,function*(){yield o(s)})},start(s){return m(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(e,r),readable:i};function o(s){return m(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield n.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}function Ui(r){let t=ft.from(r);return Qt(t)?t.then(e=>Ui(e)):t.isAsync()?t.readAll().then(e=>new $(e)):new $(t.readAll())}function ls(r,t="stream"){return(t==="stream"?fr:dr).writeAll(r).toUint8Array(!0)}var _h=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Ls),ra),Js),Ns),Bs),Hs),Ds),{compareSchemas:rn,compareFields:ml,compareTypes:Zo});bt.toDOMStream=Cl;q.throughDOM=Vl;ft.throughDOM=as;Tr.throughDOM=as;Xe.throughDOM=as;on.throughDOM=cs;dr.throughDOM=cs;fr.throughDOM=cs;function us(r,t="float32"){return r instanceof Date?"date-millisecond":r instanceof Number?t:typeof r=="string"?"utf8":(r===null||r==="undefined","null")}function jl(r){let t=vh(r);return t!=="null"?{type:t,nullable:!1}:r.length>0?(t=us(r[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function vh(r){switch(r.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}function zl(r,t){if(!t)switch(r){case"int8":return Int8Array;case"uint8":return Uint8Array;case"int16":return Int16Array;case"uint16":return Uint16Array;case"int32":return Int32Array;case"uint32":return Uint32Array;case"float32":return Float32Array;case"float64":return Float64Array;default:break}return Array}function hr(r){return Wl(r)}function fs(r){return Gl(r)}function Wl(r){return{fields:r.fields.map(t=>kn(t)),metadata:va(r.metadata)}}function Gl(r){return new U(r.fields.map(t=>Pn(t)),Ia(r.metadata))}function va(r){return Object.fromEntries(r)}function Ia(r){return r?new Map(Object.entries(r)):new Map}function kn(r){return{name:r.name,type:$l(r.type),nullable:r.nullable,metadata:va(r.metadata)}}function Pn(r){return new O(r.name,Yl(r.type),r.nullable,Ia(r.metadata))}function $l(r){switch(r.constructor){case nt:return"null";case re:return"binary";case Nt:return"bool";case et:let t=r;return`${t.isSigned?"u":""}int${t.bitWidth}`;case Re:return"int8";case Ce:return"int16";case yt:return"int32";case ce:return"int64";case ke:return"uint8";case Pe:return"uint16";case Ve:return"uint32";case je:return"uint64";case Mt:switch(r.precision){case P.HALF:return"float16";case P.SINGLE:return"float32";case P.DOUBLE:return"float64";default:return"float16"}case _r:return"float16";case ze:return"float32";case le:return"float64";case Lt:return"utf8";case ne:let n=r;return{type:"decimal",bitWidth:n.bitWidth,precision:n.precision,scale:n.scale};case $t:return r.unit===J.DAY?"date-day":"date-millisecond";case Nr:return"date-day";case Ur:return"date-millisecond";case Bt:switch(r.unit){case h.SECOND:return"time-second";case h.MILLISECOND:return"time-millisecond";case h.MICROSECOND:return"time-microsecond";case h.NANOSECOND:return"time-nanosecond";default:return"time-second"}case Rr:return"time-millisecond";case Er:return"time-second";case Cr:return"time-microsecond";case kr:return"time-nanosecond";case At:switch(r.unit){case h.SECOND:return"timestamp-second";case h.MILLISECOND:return"timestamp-millisecond";case h.MICROSECOND:return"timestamp-microsecond";case h.NANOSECOND:return"timestamp-nanosecond";default:return"timestamp-second"}case Pr:return"timestamp-second";case er:return"timestamp-millisecond";case Vr:return"timestamp-microsecond";case jr:return"timestamp-nanosecond";case Yt:switch(r.unit){case Q.DAY_TIME:return"interval-daytime";case Q.YEAR_MONTH:return"interval-yearmonth";default:return"interval-daytime"}case zr:return"interval-daytime";case Wr:return"interval-yearmonth";case Et:let c=r;return{type:"map",keysSorted:c.keysSorted,children:c.children.map(N=>kn(N))};case wt:let f=r.valueField;return{type:"list",children:[kn(f)]};case Ut:let d=r;return{type:"fixed-size-list",listSize:d.listSize,children:[kn(d.children[0])]};case k:return{type:"struct",children:r.children.map(N=>kn(N))};default:throw new Error(`arrow type not supported: ${r.constructor.name}`)}}function Yl(r){if(typeof r=="object")switch(r.type){case"decimal":return new ne(r.precision,r.scale,r.bitWidth);case"map":let t=r.children.map(i=>Pn(i));return new Et(t,r.keysSorted);case"list":let e=Pn(r.children[0]);return new wt(e);case"fixed-size-list":let n=Pn(r.children[0]);return new Ut(r.listSize,n);case"struct":return t=r.children.map(i=>Pn(i)),new k(t);default:throw new Error("array type not supported")}switch(r){case"null":return new nt;case"binary":return new re;case"bool":return new Nt;case"int8":return new Re;case"int16":return new Ce;case"int32":return new yt;case"int64":return new ce;case"uint8":return new ke;case"uint16":return new Pe;case"uint32":return new Ve;case"uint64":return new je;case"float16":return new _r;case"float32":return new ze;case"float64":return new le;case"utf8":return new Lt;case"date-day":return new Nr;case"date-millisecond":return new Ur;case"time-second":return new Er;case"time-millisecond":return new Rr;case"time-microsecond":return new Cr;case"time-nanosecond":return new kr;case"timestamp-second":return new Pr;case"timestamp-millisecond":return new er;case"timestamp-microsecond":return new Vr;case"timestamp-nanosecond":return new jr;case"interval-daytime":return new zr;case"interval-yearmonth":return new Wr;default:throw new Error("array type not supported")}}function Hl(r){switch(r.shape){case"array-row-table":case"object-row-table":return Sh(r.data);case"geojson-table":return xh(r.features);case"columnar-table":return Ih(r.data);case"arrow-table":default:throw new Error("Deduce schema")}}function Ih(r){let t=[];for(let[e,n]of Object.entries(r)){let i=Bh(n,e);t.push(i)}return{fields:t,metadata:{}}}function Sh(r){if(!r.length)throw new Error("deduce from empty table");let t=[],e=r[0];for(let[n,i]of Object.entries(e))t.push(Jl(i,n));return{fields:t,metadata:{}}}function xh(r){if(!r.length)throw new Error("deduce from empty table");let t=[],e=r[0].properties||{};for(let[n,i]of Object.entries(e))t.push(Jl(i,n));return{fields:t,metadata:{}}}function Bh(r,t){if(ArrayBuffer.isView(r)){let e=jl(r);return{name:t,type:e.type||"null",nullable:e.nullable}}if(Array.isArray(r)&&r.length>0){let e=r[0],n=us(e);return{name:t,type:n,nullable:!0}}throw new Error("empty table")}function Jl(r,t){let e=us(r);return{name:t,type:e,nullable:!0}}function Dr(r){switch(r.shape){case"array-row-table":case"object-row-table":return r.data.length;case"geojson-table":return r.features.length;case"arrow-table":return r.data.numRows;case"columnar-table":for(let e of Object.values(r.data))return e.length||0;return 0;default:throw new Error("table")}}function xa(r){if(r.schema)return r.schema.fields.length;if(Dr(r)===0)throw new Error("empty table");switch(r.shape){case"array-row-table":return r.data[0].length;case"object-row-table":return Object.keys(r.data[0]).length;case"geojson-table":return Object.keys(r.features[0]).length;case"columnar-table":return Object.keys(r.data).length;case"arrow-table":return r.data.numCols;default:throw new Error("table")}}function Kl(r,t,e){switch(r.shape){case"array-row-table":let n=Ah(r,e);return r.data[t][n];case"object-row-table":return r.data[t][e];case"geojson-table":return r.features[t][e];case"columnar-table":return r.data[e][t];case"arrow-table":let o=r.data,s=o.schema.fields.findIndex(a=>a.name===e);return o.getChildAt(s)?.get(t);default:throw new Error("todo")}}function Ba(r,t,e){switch(r.shape){case"array-row-table":return r.data[t][e];case"object-row-table":let n=Sa(r,e);return r.data[t][n];case"geojson-table":let i=Sa(r,e);return r.features[t][i];case"columnar-table":let o=Sa(r,e);return r.data[o][t];case"arrow-table":return r.data.getChildAt(e)?.get(t);default:throw new Error("todo")}}function Ah(r,t){let e=r.schema?.fields.findIndex(n=>n.name===t);if(e===void 0)throw new Error(t);return e}function Sa(r,t){let e=r.schema?.fields[t]?.name;if(!e)throw new Error(`${t}`);return e}function Zl(r,t,e,n){switch(r.shape){case"object-row-table":return n?Object.fromEntries(Object.entries(r.data[t])):r.data[t];case"array-row-table":if(r.schema){let c=e||{};for(let l=0;l<r.schema.fields.length;l++)c[r.schema.fields[l].name]=r.data[t][l];return c}throw new Error("no schema");case"geojson-table":if(r.schema){let c=e||{};for(let l=0;l<r.schema.fields.length;l++)c[r.schema.fields[l].name]=r.features[t][l];return c}throw new Error("no schema");case"columnar-table":if(r.schema){let c=e||{};for(let l=0;l<r.schema.fields.length;l++)c[r.schema.fields[l].name]=r.data[r.schema.fields[l].name][t];return c}else{let c=e||{};for(let[l,f]of Object.entries(r.data))c[l]=f[t];return c}case"arrow-table":let i=r.data,o=e||{},s=i.get(t),a=i.schema;for(let c=0;c<a.fields.length;c++)o[a.fields[c].name]=s?.[a.fields[c].name];return o;default:throw new Error("shape")}}function Xl(r,t,e,n){switch(r.shape){case"array-row-table":return n?Array.from(r.data[t]):r.data[t];case"object-row-table":if(r.schema){let c=e||[];for(let l=0;l<r.schema.fields.length;l++)c[l]=r.data[t][r.schema.fields[l].name];return c}return Object.values(r.data[t]);case"geojson-table":if(r.schema){let c=e||[];for(let l=0;l<r.schema.fields.length;l++)c[l]=r.features[t][r.schema.fields[l].name];return c}return Object.values(r.features[t]);case"columnar-table":if(r.schema){let c=e||[];for(let l=0;l<r.schema.fields.length;l++)c[l]=r.data[r.schema.fields[l].name][t];return c}else{let c=e||[],l=0;for(let f of Object.values(r.data))c[l]=f[t],l++;return c}case"arrow-table":let i=r.data,o=e||[],s=i.get(t),a=i.schema;for(let c=0;c<a.fields.length;c++)o[c]=s?.[a.fields[c].name];return o;default:throw new Error("shape")}}function ql(r,t){let e=zl(r.type,r.nullable);return new e(t)}function*Ql(r,t){let e=fs(r.schema),n=Dr(r),i=xa(r),o=t?.batchSize||n,s=e?.fields.map(l=>Se(l)),a=new k(e.fields),c=0;for(let l=0;l<n;l++)for(let f=0;f<i;++f){let d=Ba(r,l,f);if(s[f].append(d),c++,c>=o){let N=s.map(yr=>yr.flush()),st=new M(a,0,c,0,void 0,N);yield new G(e,st),c=0}}if(c>0){let l=s.map(d=>d.flush()),f=new M(a,0,c,0,void 0,l);yield new G(e,f),c=0}s.map(l=>l.finish())}function Aa(r,t){switch(r.shape){case"arrow-table":return r.data;case"columnar-table":default:let e=Ql(r,t);return new $(e)}}function Ta(r,t){switch(t){case"arrow-table":return Th(r);case"array-row-table":return Dh(r);case"object-row-table":return Oh(r);case"columnar-table":return Da(r);case"geojson-table":return Fh(r);default:throw new Error(t)}}function Th(r){return{shape:"arrow-table",schema:hr(r.schema),data:r}}function Dh(r){let t=Da(r);return sn(t,"array-row-table")}function Oh(r){let t=Da(r);return sn(t,"object-row-table")}function Da(r){let t={};for(let n of r.schema.fields){let o=r.getChild(n.name)?.toArray();t[n.name]=o}return{shape:"columnar-table",schema:hr(r.schema),data:t}}function Fh(r){let t=hr(r.schema),e=[];for(let n=0;n<r.numRows;n++){let i=r.get(n)?.toJSON()||{};e.push({type:"Feature",geometry:null,properties:i})}return{shape:"geojson-table",type:"FeatureCollection",schema:t,features:e}}function sn(r,t){switch(t){case"object-row-table":return Nh(r);case"array-row-table":return Lh(r);case"columnar-table":return Mh(r);case"arrow-table":return Uh(r);default:throw new Error(t)}}function Mh(r){let t=r.schema||Hl(r),e=r.schema?.fields||[];if(r.shape==="columnar-table")return{...r,schema:t};let n=Dr(r),i={};for(let o of e){let s=ql(o,n);i[o.name]=s;for(let a=0;a<n;a++)s[a]=Kl(r,a,o.name)}return{shape:"columnar-table",schema:t,data:i}}function Lh(r){if(r.shape==="array-row-table")return r;let t=Dr(r),e=new Array(t);for(let n=0;n<t;n++)e[n]=Xl(r,n);return{shape:"array-row-table",schema:r.schema,data:e}}function Nh(r){if(r.shape==="object-row-table")return r;let t=Dr(r),e=new Array(t);for(let n=0;n<t;n++)e[n]=Zl(r,n);return{shape:"object-row-table",schema:r.schema,data:e}}function Uh(r){let t=Aa(r);return{shape:"arrow-table",schema:r.schema,data:t}}var tu=r=>typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer;var eu="beta";function Eh(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.4.0-alpha.13"),globalThis._loadersgl_.version}var Oa=Eh();function qe(r,t){if(!r)throw new Error(t||"loaders.gl assertion failed.")}var Qe={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},wS=Qe.self||Qe.window||Qe.global||{},_S=Qe.window||Qe.self||Qe.global||{},vS=Qe.global||Qe.self||Qe.window||{},IS=Qe.document||{};var pr=typeof process!="object"||String(process)!=="[object process]"||process.browser;var nu=typeof window<"u"&&typeof window.orientation<"u",ru=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),SS=ru&&parseFloat(ru[1])||0;var Ei=class{name;workerThread;isRunning=!0;result;_resolve=()=>{};_reject=()=>{};constructor(t,e){this.name=t,this.workerThread=e,this.result=new Promise((n,i)=>{this._resolve=n,this._reject=i})}postMessage(t,e){this.workerThread.postMessage({source:"loaders.gl",type:t,payload:e})}done(t){qe(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){qe(this.isRunning),this.isRunning=!1,this._reject(t)}};var Vn=class{terminate(){}};var Fa=new Map;function iu(r){qe(r.source&&!r.url||!r.source&&r.url);let t=Fa.get(r.source||r.url);return t||(r.url&&(t=Rh(r.url),Fa.set(r.url,t)),r.source&&(t=ou(r.source),Fa.set(r.source,t))),qe(t),t}function Rh(r){if(!r.startsWith("http"))return r;let t=Ch(r);return ou(t)}function ou(r){let t=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(t)}function Ch(r){return`try {
|
|
17
17
|
importScripts('${r}');
|
|
18
18
|
} catch (error) {
|
|
19
19
|
console.error(error);
|
|
20
20
|
throw error;
|
|
21
|
-
}`}function Ma(r,t=!0,e){let n=e||new Set;if(r){if(su(r))n.add(r);else if(su(r.buffer))n.add(r.buffer);else if(!ArrayBuffer.isView(r)){if(t&&typeof r=="object")for(let i in r)Ma(r[i],t,n)}}return e===void 0?Array.from(n):[]}function su(r){return r?r instanceof ArrayBuffer||typeof MessagePort<"u"&&r instanceof MessagePort||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas:!1}function La(r){if(r===null)return{};let t=Object.assign({},r);return Object.keys(t).forEach(e=>{typeof r[e]=="object"&&!ArrayBuffer.isView(r[e])&&!(r[e]instanceof Array)?t[e]=La(r[e]):typeof t[e]=="function"||t[e]instanceof RegExp?t[e]={}:t[e]=r[e]}),t}var Na=()=>{},Or=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&pr||typeof Vn<"u"&&!pr}constructor(t){let{name:e,source:n,url:i}=t;qe(n||i),this.name=e,this.source=n,this.url=i,this.onMessage=Na,this.onError=o=>console.log(o),this.worker=pr?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=Na,this.onError=Na,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,e){e=e||Ma(t),this.worker.postMessage(t,e)}_getErrorFromErrorEvent(t){let e="Failed to load ";return e+=`worker ${this.name} from ${this.url}. `,t.message&&(e+=`${t.message} in `),t.lineno&&(e+=`:${t.lineno}:${t.colno}`),new Error(e)}_createBrowserWorker(){this._loadableURL=iu({source:this.source,url:this.url});let t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=e=>{e.data?this.onMessage(e.data):this.onError(new Error("No data received"))},t.onerror=e=>{this.onError(this._getErrorFromErrorEvent(e)),this.terminated=!0},t.onmessageerror=e=>console.error(e),t}_createNodeWorker(){let t;if(this.url){let n=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`,i=this.url.endsWith(".ts")||this.url.endsWith(".mjs")?"module":"commonjs";t=new Vn(n,{eval:!1,type:i})}else if(this.source)t=new Vn(this.source,{eval:!0});else throw new Error("no worker");return t.on("message",e=>{this.onMessage(e)}),t.on("error",e=>{this.onError(e)}),t.on("exit",e=>{}),t}};var Ri=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return Or.isSupported()}constructor(t){this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach(t=>t.destroy()),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},t.name!==void 0&&(this.name=t.name),t.maxConcurrency!==void 0&&(this.maxConcurrency=t.maxConcurrency),t.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=t.maxMobileConcurrency),t.reuseWorkers!==void 0&&(this.reuseWorkers=t.reuseWorkers),t.onDebug!==void 0&&(this.onDebug=t.onDebug)}async startJob(t,e=(i,o,s)=>i.done(s),n=(i,o)=>i.error(o)){let i=new Promise(o=>(this.jobQueue.push({name:t,onMessage:e,onError:n,onStart:o}),this));return this._startQueuedJob(),await i}async _startQueuedJob(){if(!this.jobQueue.length)return;let t=this._getAvailableWorker();if(!t)return;let e=this.jobQueue.shift();if(e){this.onDebug({message:"Starting job",name:e.name,workerThread:t,backlog:this.jobQueue.length});let n=new Ei(e.name,t);t.onMessage=i=>e.onMessage(n,i.type,i.payload),t.onError=i=>e.onError(n,i),e.onStart(n);try{await n.result}catch(i){console.error(`Worker exception: ${i}`)}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){!pr||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let t=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Or({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return nu?this.maxMobileConcurrency:this.maxConcurrency}};var kh={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},an=class{props;workerPools=new Map;static isSupported(){return Or.isSupported()}static getWorkerFarm(t={}){return an._workerFarm=an._workerFarm||new an({}),an._workerFarm.setProps(t),an._workerFarm}constructor(t){this.props={...kh},this.setProps(t),this.workerPools=new Map}destroy(){for(let t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props={...this.props,...t};for(let e of this.workerPools.values())e.setProps(this._getWorkerPoolProps())}getWorkerPool(t){let{name:e,source:n,url:i}=t,o=this.workerPools.get(e);return o||(o=new Ri({name:e,source:n,url:i}),o.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,o)),o}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},jn=an;$a(jn,"_workerFarm");function au(r){let t=r.version!==Oa?` (worker-utils@${Oa})`:"";return`${r.name}@${r.version}${t}`}function cu(r,t={}){let e=t[r.id]||{},n=pr?`${r.id}-worker.js`:`${r.id}-worker-node.js`,i=e.workerUrl;if(!i&&r.id==="compression"&&(i=t.workerUrl),(t._workerType||t?.core?._workerType)==="test"&&(pr?i=`modules/${r.module}/dist/${n}`:i=`modules/${r.module}/src/workers/${r.id}-worker-node.ts`),!i){let s=r.version;s==="latest"&&(s=eu);let a=s?`@${s}`:"";i=`https://unpkg.com/@loaders.gl/${r.module}${a}/dist/${n}`}return qe(i),i}async function ds(r,t,e={},n={}){let i=au(r),o=jn.getWorkerFarm(e),{source:s}=e,a={name:i,source:s};s||(a.url=cu(r,e));let c=o.getWorkerPool(a),l=e.jobName||r.name,f=await c.startJob(l,Ph.bind(null,n)),d=La(e);return f.postMessage("process",{input:t,options:d}),(await f.result).result}async function Ph(r,t,e,n){switch(e){case"done":t.done(n);break;case"error":t.error(new Error(n.error));break;case"process":let{id:i,input:o,options:s}=n;try{if(!r.process){t.postMessage("error",{id:i,error:"Worker not set up to process on main thread"});return}let a=await r.process(o,s);t.postMessage("done",{id:i,result:a})}catch(a){let c=a instanceof Error?a.message:"unknown error";t.postMessage("error",{id:i,error:c})}break;default:console.warn(`process-on-worker: unknown message ${e}`)}}async function*Ua(r){for await(let t of r)yield Vh(t)}function Vh(r){if(r instanceof ArrayBuffer)return r;if(ArrayBuffer.isView(r)){let{buffer:t,byteOffset:e,byteLength:n}=r;return lu(t,e,n)}return lu(r)}function lu(r,t=0,e=r.byteLength-t){let n=new Uint8Array(r,t,e),i=new Uint8Array(n.length);return i.set(n),i.buffer}function Ra(r){if(r instanceof ArrayBuffer)return r;if(tu(r))return Ea(r);let{buffer:t,byteOffset:e,byteLength:n}=r;return t instanceof ArrayBuffer&&e===0&&n===t.byteLength?t:Ea(t,e,n)}function Ea(r,t=0,e=r.byteLength-t){let n=new Uint8Array(r,t,e),i=new Uint8Array(n.length);return i.set(n),i.buffer}function Ci(r,t){let e=t?.shape||"arrow-table",n=Ui([new Uint8Array(r)]);return Ta(n,e)}function hs(r,t){async function*e(){let n=ft.readAll(Ua(r));for await(let i of n){for await(let o of i)t?.arrow?.batchDebounceMs!==void 0&&t?.arrow?.batchDebounceMs>0&&await new Promise(a=>setTimeout(a,t.arrow?.batchDebounceMs||0)),yield{shape:"arrow-table",batchType:"data",data:new $([o]),length:o.data.length};break}}return e()}var uu={...cn,parse:async(r,t)=>Ci(r,t?.arrow),parseSync:(r,t)=>Ci(r,t?.arrow),parseInBatches:hs};function Ca(r){let t={};for(let i of r){let o=jh(i.array,i.type);t[i.name]=o}let e=new $(t),n=ls(e);return Ra(n)}function jh(r,t){switch(t){case Fr.DATE:return Fi(r);case Fr.FLOAT:default:return Fi(r)}}var zh="4.4.0-alpha.12",fu={name:"Apache Arrow",id:"arrow",module:"arrow",version:zh,extensions:["arrow","feather"],mimeTypes:["application/vnd.apache.arrow.file","application/vnd.apache.arrow.stream","application/octet-stream"],binary:!0,options:{},encode:async function(t,e){return Ca(t)},encodeSync(r,t){return Ca(r)}};var ps={...cn,options:{arrow:{shape:"arrow-table"}}};function ka(r,t){return r instanceof Map?r.get(t)||null:r[t]||null}var Wh=["geoarrow.multipolygon","geoarrow.polygon","geoarrow.multilinestring","geoarrow.linestring","geoarrow.multipoint","geoarrow.point","geoarrow.wkb","geoarrow.wkt"],Gh="ARROW:extension:name",$h="ARROW:extension:metadata";function Pa(r){let t={};for(let e of r.fields||[]){let n=Yh(e?.metadata||{});n&&(t[e.name]=n)}return t}function Yh(r){let t=null,e=ka(r,Gh);e&&(e=e.toLowerCase(),e==="wkb"&&(e="geoarrow.wkb"),e==="wkt"&&(e="geoarrow.wkt"),Wh.includes(e)?(t||={},t.encoding=e):console.warn(`Invalid GeoArrow encoding: ${e}`));let n=ka(r,$h);if(n)try{t=JSON.parse(n)}catch(i){console.warn("Failed to parse GeoArrow metadata",i)}return t||null}function du(r,t,e){switch(r.type){case"Point":return Jh(r,t,e);case"LineString":return Hh(r,t,e);case"Polygon":return hu(r,t,e);default:let n=r;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function hu(r,t=-1/0,e=1/0){let{positions:n}=r,i=r.polygonIndices.value.filter(c=>c>=t&&c<=e),o=r.primitivePolygonIndices.value.filter(c=>c>=t&&c<=e);if(!(i.length>2)){let c=[];for(let l=0;l<o.length-1;l++){let f=o[l],d=o[l+1],V=ms(n,f,d);c.push(V)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<i.length-1;c++){let l=i[c],f=i[c+1],d=hu(r,l,f).coordinates;a.push(d)}return{type:"MultiPolygon",coordinates:a}}function Hh(r,t=-1/0,e=1/0){let{positions:n}=r,i=r.pathIndices.value.filter(a=>a>=t&&a<=e);if(!(i.length>2))return{type:"LineString",coordinates:ms(n,i[0],i[1])};let s=[];for(let a=0;a<i.length-1;a++){let c=ms(n,i[a],i[a+1]);s.push(c)}return{type:"MultiLineString",coordinates:s}}function Jh(r,t,e){let{positions:n}=r,i=ms(n,t,e);return i.length>1?{type:"MultiPoint",coordinates:i}:{type:"Point",coordinates:i[0]}}function ms(r,t,e){t=t||0,e=e||r.value.length/r.size;let n=[];for(let i=t;i<e;i++){let o=Array();for(let s=i*r.size;s<(i+1)*r.size;s++)o.push(Number(r.value[s]));n.push(o)}return n}function zn(r){let t=0;for(let i=0;i<r.length;++i)t+=r[i].byteLength;let e=new Uint8Array(t),n=0;for(let i=0;i<r.length;++i){let o=new Uint8Array(r[i].buffer);t=o.length;for(let s=0;s<t;++s)e[n++]=o[s]}return e}function pu(r,t){let e=r.map(i=>i.positions.value);return{type:"Point",positions:{value:new Float64Array(zn(e).buffer),size:t}}}function mu(r,t){let e=r.map(o=>o.positions.value),n=new Float64Array(zn(e).buffer),i=e.map(o=>o.length/t).map(gu(0));return i.unshift(0),{type:"LineString",positions:{value:n,size:t},pathIndices:{value:new Uint32Array(i),size:1}}}function yu(r,t){let e=[],n=[];for(let a of r){let{positions:c,primitivePolygonIndices:l}=a;e.push(c.value),n.push(l.value)}let i=new Float64Array(zn(e).buffer),o=e.map(a=>a.length/t).map(gu(0));o.unshift(0);let s=[0];for(let a of n)s.push(...a.filter(c=>c>0).map(c=>c+s[s.length-1]));return{type:"Polygon",positions:{value:i,size:t},polygonIndices:{value:new Uint32Array(o),size:1},primitivePolygonIndices:{value:new Uint32Array(s),size:1}}}var gu=r=>t=>r+=t;var mr;(function(r){r[r.Point=1]="Point",r[r.LineString=2]="LineString",r[r.Polygon=3]="Polygon",r[r.MultiPoint=4]="MultiPoint",r[r.MultiLineString=5]="MultiLineString",r[r.MultiPolygon=6]="MultiPolygon",r[r.GeometryCollection=7]="GeometryCollection"})(mr||(mr={}));var bu=2147483648,wu=1073741824,_u=536870912;var Va=["POINT(","LINESTRING(","POLYGON(","MULTIPOINT(","MULTILINESTRING(","MULTIPOLYGON(","GEOMETRYCOLLECTION("],Kh=new TextEncoder,vu=Va.map(r=>Kh.encode(r));function Zh(r){return Xh(r)!==null}function Xh(r){if(typeof r=="string"){let n=Va.findIndex(i=>r.startsWith(i));return n>=0?n+1:null}let t=new Uint8Array(r),e=vu.findIndex(n=>n.every((i,o)=>i===t[o]));return e>=0?e+1:null}function Iu(r,t){let e=Object.assign(t||{},{type:"wkb",variant:"wkb",geometryType:1,dimensions:2,coordinates:"xy",littleEndian:!0,byteOffset:0});if(Zh(r.buffer))throw new Error("WKB: Cannot parse WKT data");e.littleEndian=r.getUint8(e.byteOffset)===1,e.byteOffset++;let n=r.getUint32(e.byteOffset,e.littleEndian);e.byteOffset+=4,e.geometryType=n&7;let i=(n-e.geometryType)/1e3;switch(i){case 0:break;case 1:e.variant="iso-wkb",e.dimensions=3,e.coordinates="xyz";break;case 2:e.variant="iso-wkb",e.dimensions=3,e.coordinates="xym";break;case 3:e.variant="iso-wkb",e.dimensions=4,e.coordinates="xyzm";break;default:throw new Error(`WKB: Unsupported iso-wkb type: ${i}`)}let o=n&bu,s=n&wu,a=n&_u;return o&&s?(e.variant="ewkb",e.dimensions=4,e.coordinates="xyzm"):o?(e.variant="ewkb",e.dimensions=3,e.coordinates="xyz"):s&&(e.variant="ewkb",e.dimensions=3,e.coordinates="xym"),a&&(e.variant="ewkb",e.srid=r.getUint32(e.byteOffset,e.littleEndian),e.byteOffset+=4),e}function Su(r){let t=new DataView(r),e=Iu(t),{geometryType:n,dimensions:i,littleEndian:o}=e,s=e.byteOffset;switch(n){case mr.Point:return xu(t,s,i,o).geometry;case mr.LineString:return ja(t,s,i,o).geometry;case mr.Polygon:return Bu(t,s,i,o).geometry;case mr.MultiPoint:let f=Qh(t,s,i,o);return f.type="Point",f;case mr.MultiLineString:let d=tp(t,s,i,o);return d.type="LineString",d;case mr.MultiPolygon:let V=ep(t,s,i,o);return V.type="Polygon",V;default:throw new Error(`WKB: Unsupported geometry type: ${n}`)}}function xu(r,t,e,n){let i=new Float64Array(e);for(let o=0;o<e;o++)i[o]=r.getFloat64(t,n),t+=8;return{geometry:{type:"Point",positions:{value:i,size:e}},offset:t}}function ja(r,t,e,n){let i=r.getUint32(t,n);t+=4;let o=new Float64Array(i*e);for(let a=0;a<i*e;a++)o[a]=r.getFloat64(t,n),t+=8;let s=[0];return i>0&&s.push(i),{geometry:{type:"LineString",positions:{value:o,size:e},pathIndices:{value:new Uint32Array(s),size:1}},offset:t}}var qh=r=>t=>r+=t;function Bu(r,t,e,n){let i=r.getUint32(t,n);t+=4;let o=[];for(let l=0;l<i;l++){let f=ja(r,t,e,n),{positions:d}=f.geometry;t=f.offset,o.push(d.value)}let s=new Float64Array(zn(o).buffer),a=[0];s.length>0&&a.push(s.length/e);let c=o.map(l=>l.length/e).map(qh(0));return c.unshift(0),{geometry:{type:"Polygon",positions:{value:s,size:e},polygonIndices:{value:new Uint32Array(a),size:1},primitivePolygonIndices:{value:new Uint32Array(c),size:1}},offset:t}}function Qh(r,t,e,n){let i=r.getUint32(t,n);t+=4;let o=[];for(let s=0;s<i;s++){let a=r.getUint8(t)===1;if(t++,r.getUint32(t,a)%1e3!==1)throw new Error("WKB: Inner geometries of MultiPoint not of type Point");t+=4;let c=xu(r,t,e,a);t=c.offset,o.push(c.geometry)}return pu(o,e)}function tp(r,t,e,n){let i=r.getUint32(t,n);t+=4;let o=[];for(let s=0;s<i;s++){let a=r.getUint8(t)===1;if(t++,r.getUint32(t,a)%1e3!==2)throw new Error("WKB: Inner geometries of MultiLineString not of type LineString");t+=4;let c=ja(r,t,e,a);t=c.offset,o.push(c.geometry)}return mu(o,e)}function ep(r,t,e,n){let i=r.getUint32(t,n);t+=4;let o=[];for(let s=0;s<i;s++){let a=r.getUint8(t)===1;if(t++,r.getUint32(t,a)%1e3!==3)throw new Error("WKB: Inner geometries of MultiPolygon not of type Polygon");t+=4;let c=Bu(r,t,e,a);t=c.offset,o.push(c.geometry)}return yu(o,e)}function Au(r){let t=Su(r);return du(t)}var Tu=/[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/,Du=new RegExp("^"+Tu.source+"(\\s"+Tu.source+"){1,}");function Ou(r,t){let e=r.split(";"),n=e.pop(),i=(e.shift()||"").split("=").pop(),s=Fu({parts:e,_:n,i:0});return t?.wkt?.crs?rp(s,i):s}function Fu(r){return np(r)||op(r)||ap(r)||ip(r)||sp(r)||cp(r)||lp(r)}function rp(r,t){if(r&&t?.match(/\d+/)){let e={type:"name",properties:{name:"urn:ogc:def:crs:EPSG::"+t}};r.crs=e}return r}function np(r){if(!ot(/^(POINT(\sz)?)/i,r)||(Ct(r),!ot(/^(\()/,r)))return null;let t=Mu(r);return!t||(Ct(r),!ot(/^(\))/,r))?null:{type:"Point",coordinates:t[0]}}function ip(r){if(!ot(/^(MULTIPOINT)/i,r))return null;Ct(r);let t=r._?.substring(r._?.indexOf("(")+1,r._.length-1).replace(/\(/g,"").replace(/\)/g,"");r._="MULTIPOINT ("+t+")";let e=ys(r);return e?(Ct(r),{type:"MultiPoint",coordinates:e}):null}function op(r){if(!ot(/^(LINESTRING(\sz)?)/i,r)||(Ct(r),!ot(/^(\()/,r)))return null;let t=Mu(r);return!t||!ot(/^(\))/,r)?null:{type:"LineString",coordinates:t}}function sp(r){if(!ot(/^(MULTILINESTRING)/i,r))return null;Ct(r);let t=ys(r);return t?(Ct(r),{type:"MultiLineString",coordinates:t}):null}function ap(r){if(!ot(/^(POLYGON(\sz)?)/i,r))return null;Ct(r);let t=ys(r);return t?{type:"Polygon",coordinates:t}:null}function cp(r){if(!ot(/^(MULTIPOLYGON)/i,r))return null;Ct(r);let t=ys(r);return t?{type:"MultiPolygon",coordinates:t}:null}function lp(r){let t=[],e;if(!ot(/^(GEOMETRYCOLLECTION)/i,r)||(Ct(r),!ot(/^(\()/,r)))return null;for(;e=Fu(r);)t.push(e),Ct(r),ot(/^(,)/,r),Ct(r);return ot(/^(\))/,r)?{type:"GeometryCollection",geometries:t}:null}function ys(r){Ct(r);let t=0,e=[],n=[e],i=e,o;for(;o=ot(/^(\()/,r)||ot(/^(\))/,r)||ot(/^(,)/,r)||ot(Du,r);){if(o==="(")n.push(i),i=[],n[n.length-1].push(i),t++;else if(o===")"){if(i.length===0||(i=n.pop(),!i))return null;if(t--,t===0)break}else if(o===",")i=[],n[n.length-1].push(i);else if(!o.split(/\s/g).some(isNaN))Array.prototype.push.apply(i,o.split(/\s/g).map(parseFloat));else return null;Ct(r)}return t!==0?null:e}function Mu(r){let t=[],e,n;for(;n=ot(Du,r)||ot(/^(,)/,r);)n===","?(t.push(e),e=[]):n.split(/\s/g).some(isNaN)||(e||(e=[]),Array.prototype.push.apply(e,n.split(/\s/g).map(parseFloat))),Ct(r);if(e)t.push(e);else return null;return t.length?t:null}function ot(r,t){let e=t._?.substring(t.i).match(r);return e?(t.i+=e[0].length,e[0]):null}function Ct(r){ot(/^\s*/,r)}function Lu(r,t){if(t=t?.toLowerCase(),!t||!r)return null;switch(t){case"geoarrow.multipolygon":return dp(r);case"geoarrow.polygon":return hp(r);case"geoarrow.multipoint":return pp(r);case"geoarrow.point":return mp(r);case"geoarrow.multilinestring":return yp(r);case"geoarrow.linestring":return gp(r);case"geoarrow.wkb":return up(r);case"geoarrow.wkt":return fp(r);default:throw Error(`GeoArrow encoding not supported ${t}`)}}function up(r){let t=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength);return Au(t)}function fp(r){return Ou(r)}function dp(r){let t=[];for(let n=0;n<r.length;n++){let i=r.get(n),o=[];for(let s=0;i&&s<i?.length;s++){let a=i?.get(s),c=[];for(let l=0;a&&l<a.length;l++){let f=a.get(l),d=Array.from(f);c.push(d)}o.push(c)}t.push(o)}return{type:"MultiPolygon",coordinates:t}}function hp(r){let t=[];for(let n=0;r&&n<r.length;n++){let i=r.get(n),o=[];for(let s=0;i&&s<i.length;s++){let a=i.get(s),c=Array.from(a);o.push(c)}t.push(o)}return{type:"Polygon",coordinates:t}}function pp(r){let t=[];for(let e=0;r&&e<r.length;e++){let n=r.get(e);if(n){let i=Array.from(n);t.push(i)}}return{type:"MultiPoint",coordinates:t}}function mp(r){return{type:"Point",coordinates:Array.from(r)}}function yp(r){let t=[];for(let e=0;r&&e<r.length;e++){let n=r.get(e),i=[];for(let o=0;n&&o<n.length;o++){let s=n.get(o);if(s){let a=Array.from(s);i.push(a)}}t.push(i)}return{type:"MultiLineString",coordinates:t}}function gp(r){let t=[];for(let e=0;r&&e<r.length;e++){let n=r.get(e);if(n){let i=Array.from(n);t.push(i)}}return{type:"LineString",coordinates:t}}function za(r,t){switch(t){case"arrow-table":return bp(r);case"array-row-table":return wp(r);case"object-row-table":return _p(r);case"columnar-table":return Wa(r);case"geojson-table":return vp(r);default:throw new Error(t)}}function bp(r){return{shape:"arrow-table",schema:hr(r.schema),data:r}}function wp(r){let t=Wa(r);return sn(t,"array-row-table")}function _p(r){let t=Wa(r);return sn(t,"object-row-table")}function Wa(r){let t={};for(let n of r.schema.fields){let o=r.getChild(n.name)?.toArray();t[n.name]=o}return{shape:"columnar-table",schema:hr(r.schema),data:t}}function vp(r){let t=hr(r.schema),e=Pa(t),n=e.geometry.encoding,i=[],o=r.schema.fields.map(c=>c.name).filter(c=>!(c in e)),s=r.select(o),a=r.getChild("geometry");for(let c=0;c<r.numRows;c++){let l=a?.get(c),f=Lu(l,n);if(f){let d=s.get(c)?.toJSON()||{};i.push({type:"Feature",geometry:f,properties:d})}}return{shape:"geojson-table",type:"FeatureCollection",schema:t,features:i}}function Ga(r,t){let e=Ci(r,{shape:"arrow-table"});switch(t?.shape){case"geojson-table":return za(e.data,"geojson-table");default:return e}}function Nu(r){return hs(r)}var Uu={...ps,parse:async(r,t)=>Ga(r,t?.arrow),parseSync:(r,t)=>Ga(r,t?.arrow),parseInBatches:Nu};function ki(r,t=!1){if("data"in r)return new y(r.data.map(o=>ki(o,t)));let e=[];for(let o of r.children)e.push(ki(o,t));let n;r.dictionary!==void 0&&(n=ki(r.dictionary,t));let i={[rt.OFFSET]:gs(r.buffers[rt.OFFSET],t),[rt.DATA]:gs(r.buffers[rt.DATA],t),[rt.VALIDITY]:gs(r.buffers[rt.VALIDITY],t),[rt.TYPE]:gs(r.buffers[rt.TYPE],t)};return new M(r.type,r.offset,r.length,r._nullCount,i,e,n)}function Ip(r){return!(r.byteOffset===0&&r.byteLength===r.buffer.byteLength)}function gs(r,t){return r===void 0||!t&&!Ip(r)?r:r.slice()}var Sp="4.4.0-alpha.12",bs={id:"triangulation",name:"Triangulate",module:"arrow",version:Sp,options:{}};function Eu(r,t={}){return ds(bs,{...r,operation:"triangulate"},t)}function Ru(r,t={}){return ds(bs,{...r,operation:"parse-geoarrow"},t)}return Yu(Pi);})();
|
|
21
|
+
}`}function Ma(r,t=!0,e){let n=e||new Set;if(r){if(su(r))n.add(r);else if(su(r.buffer))n.add(r.buffer);else if(!ArrayBuffer.isView(r)){if(t&&typeof r=="object")for(let i in r)Ma(r[i],t,n)}}return e===void 0?Array.from(n):[]}function su(r){return r?r instanceof ArrayBuffer||typeof MessagePort<"u"&&r instanceof MessagePort||typeof ImageBitmap<"u"&&r instanceof ImageBitmap||typeof OffscreenCanvas<"u"&&r instanceof OffscreenCanvas:!1}function La(r){if(r===null)return{};let t=Object.assign({},r);return Object.keys(t).forEach(e=>{typeof r[e]=="object"&&!ArrayBuffer.isView(r[e])&&!(r[e]instanceof Array)?t[e]=La(r[e]):typeof t[e]=="function"||t[e]instanceof RegExp?t[e]={}:t[e]=r[e]}),t}var Na=()=>{},Or=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&pr||typeof Vn<"u"&&!pr}constructor(t){let{name:e,source:n,url:i}=t;qe(n||i),this.name=e,this.source=n,this.url=i,this.onMessage=Na,this.onError=o=>console.log(o),this.worker=pr?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=Na,this.onError=Na,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,e){e=e||Ma(t),this.worker.postMessage(t,e)}_getErrorFromErrorEvent(t){let e="Failed to load ";return e+=`worker ${this.name} from ${this.url}. `,t.message&&(e+=`${t.message} in `),t.lineno&&(e+=`:${t.lineno}:${t.colno}`),new Error(e)}_createBrowserWorker(){this._loadableURL=iu({source:this.source,url:this.url});let t=new Worker(this._loadableURL,{name:this.name});return t.onmessage=e=>{e.data?this.onMessage(e.data):this.onError(new Error("No data received"))},t.onerror=e=>{this.onError(this._getErrorFromErrorEvent(e)),this.terminated=!0},t.onmessageerror=e=>console.error(e),t}_createNodeWorker(){let t;if(this.url){let n=this.url.includes(":/")||this.url.startsWith("/")?this.url:`./${this.url}`,i=this.url.endsWith(".ts")||this.url.endsWith(".mjs")?"module":"commonjs";t=new Vn(n,{eval:!1,type:i})}else if(this.source)t=new Vn(this.source,{eval:!0});else throw new Error("no worker");return t.on("message",e=>{this.onMessage(e)}),t.on("error",e=>{this.onError(e)}),t.on("exit",e=>{}),t}};var Ri=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return Or.isSupported()}constructor(t){this.source=t.source,this.url=t.url,this.setProps(t)}destroy(){this.idleQueue.forEach(t=>t.destroy()),this.isDestroyed=!0}setProps(t){this.props={...this.props,...t},t.name!==void 0&&(this.name=t.name),t.maxConcurrency!==void 0&&(this.maxConcurrency=t.maxConcurrency),t.maxMobileConcurrency!==void 0&&(this.maxMobileConcurrency=t.maxMobileConcurrency),t.reuseWorkers!==void 0&&(this.reuseWorkers=t.reuseWorkers),t.onDebug!==void 0&&(this.onDebug=t.onDebug)}async startJob(t,e=(i,o,s)=>i.done(s),n=(i,o)=>i.error(o)){let i=new Promise(o=>(this.jobQueue.push({name:t,onMessage:e,onError:n,onStart:o}),this));return this._startQueuedJob(),await i}async _startQueuedJob(){if(!this.jobQueue.length)return;let t=this._getAvailableWorker();if(!t)return;let e=this.jobQueue.shift();if(e){this.onDebug({message:"Starting job",name:e.name,workerThread:t,backlog:this.jobQueue.length});let n=new Ei(e.name,t);t.onMessage=i=>e.onMessage(n,i.type,i.payload),t.onError=i=>e.onError(n,i),e.onStart(n);try{await n.result}catch(i){console.error(`Worker exception: ${i}`)}finally{this.returnWorkerToQueue(t)}}}returnWorkerToQueue(t){!pr||this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency()?(t.destroy(),this.count--):this.idleQueue.push(t),this.isDestroyed||this._startQueuedJob()}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift()||null;if(this.count<this._getMaxConcurrency()){this.count++;let t=`${this.name.toLowerCase()} (#${this.count} of ${this.maxConcurrency})`;return new Or({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return nu?this.maxMobileConcurrency:this.maxConcurrency}};var kh={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},an=class{props;workerPools=new Map;static isSupported(){return Or.isSupported()}static getWorkerFarm(t={}){return an._workerFarm=an._workerFarm||new an({}),an._workerFarm.setProps(t),an._workerFarm}constructor(t){this.props={...kh},this.setProps(t),this.workerPools=new Map}destroy(){for(let t of this.workerPools.values())t.destroy();this.workerPools=new Map}setProps(t){this.props={...this.props,...t};for(let e of this.workerPools.values())e.setProps(this._getWorkerPoolProps())}getWorkerPool(t){let{name:e,source:n,url:i}=t,o=this.workerPools.get(e);return o||(o=new Ri({name:e,source:n,url:i}),o.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,o)),o}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},jn=an;$a(jn,"_workerFarm");function au(r){let t=r.version!==Oa?` (worker-utils@${Oa})`:"";return`${r.name}@${r.version}${t}`}function cu(r,t={}){let e=t[r.id]||{},n=pr?`${r.id}-worker.js`:`${r.id}-worker-node.js`,i=e.workerUrl;if(!i&&r.id==="compression"&&(i=t.workerUrl),(t._workerType||t?.core?._workerType)==="test"&&(pr?i=`modules/${r.module}/dist/${n}`:i=`modules/${r.module}/src/workers/${r.id}-worker-node.ts`),!i){let s=r.version;s==="latest"&&(s=eu);let a=s?`@${s}`:"";i=`https://unpkg.com/@loaders.gl/${r.module}${a}/dist/${n}`}return qe(i),i}async function ds(r,t,e={},n={}){let i=au(r),o=jn.getWorkerFarm(e),{source:s}=e,a={name:i,source:s};s||(a.url=cu(r,e));let c=o.getWorkerPool(a),l=e.jobName||r.name,f=await c.startJob(l,Ph.bind(null,n)),d=La(e);return f.postMessage("process",{input:t,options:d}),(await f.result).result}async function Ph(r,t,e,n){switch(e){case"done":t.done(n);break;case"error":t.error(new Error(n.error));break;case"process":let{id:i,input:o,options:s}=n;try{if(!r.process){t.postMessage("error",{id:i,error:"Worker not set up to process on main thread"});return}let a=await r.process(o,s);t.postMessage("done",{id:i,result:a})}catch(a){let c=a instanceof Error?a.message:"unknown error";t.postMessage("error",{id:i,error:c})}break;default:console.warn(`process-on-worker: unknown message ${e}`)}}async function*Ua(r){for await(let t of r)yield Vh(t)}function Vh(r){if(r instanceof ArrayBuffer)return r;if(ArrayBuffer.isView(r)){let{buffer:t,byteOffset:e,byteLength:n}=r;return lu(t,e,n)}return lu(r)}function lu(r,t=0,e=r.byteLength-t){let n=new Uint8Array(r,t,e),i=new Uint8Array(n.length);return i.set(n),i.buffer}function Ra(r){if(r instanceof ArrayBuffer)return r;if(tu(r))return Ea(r);let{buffer:t,byteOffset:e,byteLength:n}=r;return t instanceof ArrayBuffer&&e===0&&n===t.byteLength?t:Ea(t,e,n)}function Ea(r,t=0,e=r.byteLength-t){let n=new Uint8Array(r,t,e),i=new Uint8Array(n.length);return i.set(n),i.buffer}function Ci(r,t){let e=t?.shape||"arrow-table",n=Ui([new Uint8Array(r)]);return Ta(n,e)}function hs(r,t){async function*e(){let n=ft.readAll(Ua(r));for await(let i of n){for await(let o of i)t?.arrow?.batchDebounceMs!==void 0&&t?.arrow?.batchDebounceMs>0&&await new Promise(a=>setTimeout(a,t.arrow?.batchDebounceMs||0)),yield{shape:"arrow-table",batchType:"data",data:new $([o]),length:o.data.length};break}}return e()}var uu={...cn,parse:async(r,t)=>Ci(r,t?.arrow),parseSync:(r,t)=>Ci(r,t?.arrow),parseInBatches:hs};function Ca(r){let t={};for(let i of r){let o=jh(i.array,i.type);t[i.name]=o}let e=new $(t),n=ls(e);return Ra(n)}function jh(r,t){switch(t){case Fr.DATE:return Fi(r);case Fr.FLOAT:default:return Fi(r)}}var zh="4.4.0-alpha.13",fu={name:"Apache Arrow",id:"arrow",module:"arrow",version:zh,extensions:["arrow","feather"],mimeTypes:["application/vnd.apache.arrow.file","application/vnd.apache.arrow.stream","application/octet-stream"],binary:!0,options:{},encode:async function(t,e){return Ca(t)},encodeSync(r,t){return Ca(r)}};var ps={...cn,options:{arrow:{shape:"arrow-table"}}};function ka(r,t){return r instanceof Map?r.get(t)||null:r[t]||null}var Wh=["geoarrow.multipolygon","geoarrow.polygon","geoarrow.multilinestring","geoarrow.linestring","geoarrow.multipoint","geoarrow.point","geoarrow.wkb","geoarrow.wkt"],Gh="ARROW:extension:name",$h="ARROW:extension:metadata";function Pa(r){let t={};for(let e of r.fields||[]){let n=Yh(e?.metadata||{});n&&(t[e.name]=n)}return t}function Yh(r){let t=null,e=ka(r,Gh);e&&(e=e.toLowerCase(),e==="wkb"&&(e="geoarrow.wkb"),e==="wkt"&&(e="geoarrow.wkt"),Wh.includes(e)?(t||={},t.encoding=e):console.warn(`Invalid GeoArrow encoding: ${e}`));let n=ka(r,$h);if(n)try{t=JSON.parse(n)}catch(i){console.warn("Failed to parse GeoArrow metadata",i)}return t||null}function du(r,t,e){switch(r.type){case"Point":return Jh(r,t,e);case"LineString":return Hh(r,t,e);case"Polygon":return hu(r,t,e);default:let n=r;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function hu(r,t=-1/0,e=1/0){let{positions:n}=r,i=r.polygonIndices.value.filter(c=>c>=t&&c<=e),o=r.primitivePolygonIndices.value.filter(c=>c>=t&&c<=e);if(!(i.length>2)){let c=[];for(let l=0;l<o.length-1;l++){let f=o[l],d=o[l+1],V=ms(n,f,d);c.push(V)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<i.length-1;c++){let l=i[c],f=i[c+1],d=hu(r,l,f).coordinates;a.push(d)}return{type:"MultiPolygon",coordinates:a}}function Hh(r,t=-1/0,e=1/0){let{positions:n}=r,i=r.pathIndices.value.filter(a=>a>=t&&a<=e);if(!(i.length>2))return{type:"LineString",coordinates:ms(n,i[0],i[1])};let s=[];for(let a=0;a<i.length-1;a++){let c=ms(n,i[a],i[a+1]);s.push(c)}return{type:"MultiLineString",coordinates:s}}function Jh(r,t,e){let{positions:n}=r,i=ms(n,t,e);return i.length>1?{type:"MultiPoint",coordinates:i}:{type:"Point",coordinates:i[0]}}function ms(r,t,e){t=t||0,e=e||r.value.length/r.size;let n=[];for(let i=t;i<e;i++){let o=Array();for(let s=i*r.size;s<(i+1)*r.size;s++)o.push(Number(r.value[s]));n.push(o)}return n}function zn(r){let t=0;for(let i=0;i<r.length;++i)t+=r[i].byteLength;let e=new Uint8Array(t),n=0;for(let i=0;i<r.length;++i){let o=new Uint8Array(r[i].buffer);t=o.length;for(let s=0;s<t;++s)e[n++]=o[s]}return e}function pu(r,t){let e=r.map(i=>i.positions.value);return{type:"Point",positions:{value:new Float64Array(zn(e).buffer),size:t}}}function mu(r,t){let e=r.map(o=>o.positions.value),n=new Float64Array(zn(e).buffer),i=e.map(o=>o.length/t).map(gu(0));return i.unshift(0),{type:"LineString",positions:{value:n,size:t},pathIndices:{value:new Uint32Array(i),size:1}}}function yu(r,t){let e=[],n=[];for(let a of r){let{positions:c,primitivePolygonIndices:l}=a;e.push(c.value),n.push(l.value)}let i=new Float64Array(zn(e).buffer),o=e.map(a=>a.length/t).map(gu(0));o.unshift(0);let s=[0];for(let a of n)s.push(...a.filter(c=>c>0).map(c=>c+s[s.length-1]));return{type:"Polygon",positions:{value:i,size:t},polygonIndices:{value:new Uint32Array(o),size:1},primitivePolygonIndices:{value:new Uint32Array(s),size:1}}}var gu=r=>t=>r+=t;var mr;(function(r){r[r.Point=1]="Point",r[r.LineString=2]="LineString",r[r.Polygon=3]="Polygon",r[r.MultiPoint=4]="MultiPoint",r[r.MultiLineString=5]="MultiLineString",r[r.MultiPolygon=6]="MultiPolygon",r[r.GeometryCollection=7]="GeometryCollection"})(mr||(mr={}));var bu=2147483648,wu=1073741824,_u=536870912;var Va=["POINT(","LINESTRING(","POLYGON(","MULTIPOINT(","MULTILINESTRING(","MULTIPOLYGON(","GEOMETRYCOLLECTION("],Kh=new TextEncoder,vu=Va.map(r=>Kh.encode(r));function Zh(r){return Xh(r)!==null}function Xh(r){if(typeof r=="string"){let n=Va.findIndex(i=>r.startsWith(i));return n>=0?n+1:null}let t=new Uint8Array(r),e=vu.findIndex(n=>n.every((i,o)=>i===t[o]));return e>=0?e+1:null}function Iu(r,t){let e=Object.assign(t||{},{type:"wkb",variant:"wkb",geometryType:1,dimensions:2,coordinates:"xy",littleEndian:!0,byteOffset:0});if(Zh(r.buffer))throw new Error("WKB: Cannot parse WKT data");e.littleEndian=r.getUint8(e.byteOffset)===1,e.byteOffset++;let n=r.getUint32(e.byteOffset,e.littleEndian);e.byteOffset+=4,e.geometryType=n&7;let i=(n-e.geometryType)/1e3;switch(i){case 0:break;case 1:e.variant="iso-wkb",e.dimensions=3,e.coordinates="xyz";break;case 2:e.variant="iso-wkb",e.dimensions=3,e.coordinates="xym";break;case 3:e.variant="iso-wkb",e.dimensions=4,e.coordinates="xyzm";break;default:throw new Error(`WKB: Unsupported iso-wkb type: ${i}`)}let o=n&bu,s=n&wu,a=n&_u;return o&&s?(e.variant="ewkb",e.dimensions=4,e.coordinates="xyzm"):o?(e.variant="ewkb",e.dimensions=3,e.coordinates="xyz"):s&&(e.variant="ewkb",e.dimensions=3,e.coordinates="xym"),a&&(e.variant="ewkb",e.srid=r.getUint32(e.byteOffset,e.littleEndian),e.byteOffset+=4),e}function Su(r){let t=new DataView(r),e=Iu(t),{geometryType:n,dimensions:i,littleEndian:o}=e,s=e.byteOffset;switch(n){case mr.Point:return xu(t,s,i,o).geometry;case mr.LineString:return ja(t,s,i,o).geometry;case mr.Polygon:return Bu(t,s,i,o).geometry;case mr.MultiPoint:let f=Qh(t,s,i,o);return f.type="Point",f;case mr.MultiLineString:let d=tp(t,s,i,o);return d.type="LineString",d;case mr.MultiPolygon:let V=ep(t,s,i,o);return V.type="Polygon",V;default:throw new Error(`WKB: Unsupported geometry type: ${n}`)}}function xu(r,t,e,n){let i=new Float64Array(e);for(let o=0;o<e;o++)i[o]=r.getFloat64(t,n),t+=8;return{geometry:{type:"Point",positions:{value:i,size:e}},offset:t}}function ja(r,t,e,n){let i=r.getUint32(t,n);t+=4;let o=new Float64Array(i*e);for(let a=0;a<i*e;a++)o[a]=r.getFloat64(t,n),t+=8;let s=[0];return i>0&&s.push(i),{geometry:{type:"LineString",positions:{value:o,size:e},pathIndices:{value:new Uint32Array(s),size:1}},offset:t}}var qh=r=>t=>r+=t;function Bu(r,t,e,n){let i=r.getUint32(t,n);t+=4;let o=[];for(let l=0;l<i;l++){let f=ja(r,t,e,n),{positions:d}=f.geometry;t=f.offset,o.push(d.value)}let s=new Float64Array(zn(o).buffer),a=[0];s.length>0&&a.push(s.length/e);let c=o.map(l=>l.length/e).map(qh(0));return c.unshift(0),{geometry:{type:"Polygon",positions:{value:s,size:e},polygonIndices:{value:new Uint32Array(a),size:1},primitivePolygonIndices:{value:new Uint32Array(c),size:1}},offset:t}}function Qh(r,t,e,n){let i=r.getUint32(t,n);t+=4;let o=[];for(let s=0;s<i;s++){let a=r.getUint8(t)===1;if(t++,r.getUint32(t,a)%1e3!==1)throw new Error("WKB: Inner geometries of MultiPoint not of type Point");t+=4;let c=xu(r,t,e,a);t=c.offset,o.push(c.geometry)}return pu(o,e)}function tp(r,t,e,n){let i=r.getUint32(t,n);t+=4;let o=[];for(let s=0;s<i;s++){let a=r.getUint8(t)===1;if(t++,r.getUint32(t,a)%1e3!==2)throw new Error("WKB: Inner geometries of MultiLineString not of type LineString");t+=4;let c=ja(r,t,e,a);t=c.offset,o.push(c.geometry)}return mu(o,e)}function ep(r,t,e,n){let i=r.getUint32(t,n);t+=4;let o=[];for(let s=0;s<i;s++){let a=r.getUint8(t)===1;if(t++,r.getUint32(t,a)%1e3!==3)throw new Error("WKB: Inner geometries of MultiPolygon not of type Polygon");t+=4;let c=Bu(r,t,e,a);t=c.offset,o.push(c.geometry)}return yu(o,e)}function Au(r){let t=Su(r);return du(t)}var Tu=/[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/,Du=new RegExp("^"+Tu.source+"(\\s"+Tu.source+"){1,}");function Ou(r,t){let e=r.split(";"),n=e.pop(),i=(e.shift()||"").split("=").pop(),s=Fu({parts:e,_:n,i:0});return t?.wkt?.crs?rp(s,i):s}function Fu(r){return np(r)||op(r)||ap(r)||ip(r)||sp(r)||cp(r)||lp(r)}function rp(r,t){if(r&&t?.match(/\d+/)){let e={type:"name",properties:{name:"urn:ogc:def:crs:EPSG::"+t}};r.crs=e}return r}function np(r){if(!ot(/^(POINT(\sz)?)/i,r)||(Ct(r),!ot(/^(\()/,r)))return null;let t=Mu(r);return!t||(Ct(r),!ot(/^(\))/,r))?null:{type:"Point",coordinates:t[0]}}function ip(r){if(!ot(/^(MULTIPOINT)/i,r))return null;Ct(r);let t=r._?.substring(r._?.indexOf("(")+1,r._.length-1).replace(/\(/g,"").replace(/\)/g,"");r._="MULTIPOINT ("+t+")";let e=ys(r);return e?(Ct(r),{type:"MultiPoint",coordinates:e}):null}function op(r){if(!ot(/^(LINESTRING(\sz)?)/i,r)||(Ct(r),!ot(/^(\()/,r)))return null;let t=Mu(r);return!t||!ot(/^(\))/,r)?null:{type:"LineString",coordinates:t}}function sp(r){if(!ot(/^(MULTILINESTRING)/i,r))return null;Ct(r);let t=ys(r);return t?(Ct(r),{type:"MultiLineString",coordinates:t}):null}function ap(r){if(!ot(/^(POLYGON(\sz)?)/i,r))return null;Ct(r);let t=ys(r);return t?{type:"Polygon",coordinates:t}:null}function cp(r){if(!ot(/^(MULTIPOLYGON)/i,r))return null;Ct(r);let t=ys(r);return t?{type:"MultiPolygon",coordinates:t}:null}function lp(r){let t=[],e;if(!ot(/^(GEOMETRYCOLLECTION)/i,r)||(Ct(r),!ot(/^(\()/,r)))return null;for(;e=Fu(r);)t.push(e),Ct(r),ot(/^(,)/,r),Ct(r);return ot(/^(\))/,r)?{type:"GeometryCollection",geometries:t}:null}function ys(r){Ct(r);let t=0,e=[],n=[e],i=e,o;for(;o=ot(/^(\()/,r)||ot(/^(\))/,r)||ot(/^(,)/,r)||ot(Du,r);){if(o==="(")n.push(i),i=[],n[n.length-1].push(i),t++;else if(o===")"){if(i.length===0||(i=n.pop(),!i))return null;if(t--,t===0)break}else if(o===",")i=[],n[n.length-1].push(i);else if(!o.split(/\s/g).some(isNaN))Array.prototype.push.apply(i,o.split(/\s/g).map(parseFloat));else return null;Ct(r)}return t!==0?null:e}function Mu(r){let t=[],e,n;for(;n=ot(Du,r)||ot(/^(,)/,r);)n===","?(t.push(e),e=[]):n.split(/\s/g).some(isNaN)||(e||(e=[]),Array.prototype.push.apply(e,n.split(/\s/g).map(parseFloat))),Ct(r);if(e)t.push(e);else return null;return t.length?t:null}function ot(r,t){let e=t._?.substring(t.i).match(r);return e?(t.i+=e[0].length,e[0]):null}function Ct(r){ot(/^\s*/,r)}function Lu(r,t){if(t=t?.toLowerCase(),!t||!r)return null;switch(t){case"geoarrow.multipolygon":return dp(r);case"geoarrow.polygon":return hp(r);case"geoarrow.multipoint":return pp(r);case"geoarrow.point":return mp(r);case"geoarrow.multilinestring":return yp(r);case"geoarrow.linestring":return gp(r);case"geoarrow.wkb":return up(r);case"geoarrow.wkt":return fp(r);default:throw Error(`GeoArrow encoding not supported ${t}`)}}function up(r){let t=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength);return Au(t)}function fp(r){return Ou(r)}function dp(r){let t=[];for(let n=0;n<r.length;n++){let i=r.get(n),o=[];for(let s=0;i&&s<i?.length;s++){let a=i?.get(s),c=[];for(let l=0;a&&l<a.length;l++){let f=a.get(l),d=Array.from(f);c.push(d)}o.push(c)}t.push(o)}return{type:"MultiPolygon",coordinates:t}}function hp(r){let t=[];for(let n=0;r&&n<r.length;n++){let i=r.get(n),o=[];for(let s=0;i&&s<i.length;s++){let a=i.get(s),c=Array.from(a);o.push(c)}t.push(o)}return{type:"Polygon",coordinates:t}}function pp(r){let t=[];for(let e=0;r&&e<r.length;e++){let n=r.get(e);if(n){let i=Array.from(n);t.push(i)}}return{type:"MultiPoint",coordinates:t}}function mp(r){return{type:"Point",coordinates:Array.from(r)}}function yp(r){let t=[];for(let e=0;r&&e<r.length;e++){let n=r.get(e),i=[];for(let o=0;n&&o<n.length;o++){let s=n.get(o);if(s){let a=Array.from(s);i.push(a)}}t.push(i)}return{type:"MultiLineString",coordinates:t}}function gp(r){let t=[];for(let e=0;r&&e<r.length;e++){let n=r.get(e);if(n){let i=Array.from(n);t.push(i)}}return{type:"LineString",coordinates:t}}function za(r,t){switch(t){case"arrow-table":return bp(r);case"array-row-table":return wp(r);case"object-row-table":return _p(r);case"columnar-table":return Wa(r);case"geojson-table":return vp(r);default:throw new Error(t)}}function bp(r){return{shape:"arrow-table",schema:hr(r.schema),data:r}}function wp(r){let t=Wa(r);return sn(t,"array-row-table")}function _p(r){let t=Wa(r);return sn(t,"object-row-table")}function Wa(r){let t={};for(let n of r.schema.fields){let o=r.getChild(n.name)?.toArray();t[n.name]=o}return{shape:"columnar-table",schema:hr(r.schema),data:t}}function vp(r){let t=hr(r.schema),e=Pa(t),n=e.geometry.encoding,i=[],o=r.schema.fields.map(c=>c.name).filter(c=>!(c in e)),s=r.select(o),a=r.getChild("geometry");for(let c=0;c<r.numRows;c++){let l=a?.get(c),f=Lu(l,n);if(f){let d=s.get(c)?.toJSON()||{};i.push({type:"Feature",geometry:f,properties:d})}}return{shape:"geojson-table",type:"FeatureCollection",schema:t,features:i}}function Ga(r,t){let e=Ci(r,{shape:"arrow-table"});switch(t?.shape){case"geojson-table":return za(e.data,"geojson-table");default:return e}}function Nu(r){return hs(r)}var Uu={...ps,parse:async(r,t)=>Ga(r,t?.arrow),parseSync:(r,t)=>Ga(r,t?.arrow),parseInBatches:Nu};function ki(r,t=!1){if("data"in r)return new y(r.data.map(o=>ki(o,t)));let e=[];for(let o of r.children)e.push(ki(o,t));let n;r.dictionary!==void 0&&(n=ki(r.dictionary,t));let i={[rt.OFFSET]:gs(r.buffers[rt.OFFSET],t),[rt.DATA]:gs(r.buffers[rt.DATA],t),[rt.VALIDITY]:gs(r.buffers[rt.VALIDITY],t),[rt.TYPE]:gs(r.buffers[rt.TYPE],t)};return new M(r.type,r.offset,r.length,r._nullCount,i,e,n)}function Ip(r){return!(r.byteOffset===0&&r.byteLength===r.buffer.byteLength)}function gs(r,t){return r===void 0||!t&&!Ip(r)?r:r.slice()}var Sp="4.4.0-alpha.13",bs={id:"triangulation",name:"Triangulate",module:"arrow",version:Sp,options:{}};function Eu(r,t={}){return ds(bs,{...r,operation:"triangulate"},t)}function Ru(r,t={}){return ds(bs,{...r,operation:"parse-geoarrow"},t)}return Yu(Pi);})();
|
|
22
22
|
return __exports__;
|
|
23
23
|
});
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// Copyright (c) vis.gl contributors
|
|
4
4
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
5
5
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
6
|
-
const VERSION = typeof "4.4.0-alpha.
|
|
6
|
+
const VERSION = typeof "4.4.0-alpha.13" !== 'undefined' ? "4.4.0-alpha.13" : 'latest';
|
|
7
7
|
/** ArrowJS table loader */
|
|
8
8
|
export const ArrowWorkerLoader = {
|
|
9
9
|
dataType: null,
|
package/dist/geoarrow-writer.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { encodeGeoArrowSync } from "./lib/encoders/encode-geoarrow.js";
|
|
3
3
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
4
4
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
5
|
-
const VERSION = typeof "4.4.0-alpha.
|
|
5
|
+
const VERSION = typeof "4.4.0-alpha.13" !== 'undefined' ? "4.4.0-alpha.13" : 'latest';
|
|
6
6
|
/** Apache Arrow writer */
|
|
7
7
|
export const GeoArrowWriter = {
|
|
8
8
|
name: 'Apache Arrow',
|
package/dist/index.cjs
CHANGED
|
@@ -68,7 +68,7 @@ var ArrowFormat = {
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
// dist/exports/arrow-loader.js
|
|
71
|
-
var VERSION = true ? "4.4.0-alpha.
|
|
71
|
+
var VERSION = true ? "4.4.0-alpha.13" : "latest";
|
|
72
72
|
var ArrowWorkerLoader = {
|
|
73
73
|
dataType: null,
|
|
74
74
|
batchType: null,
|
|
@@ -160,7 +160,7 @@ function createVector(array, type) {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
// dist/arrow-writer.js
|
|
163
|
-
var VERSION2 = true ? "4.4.0-alpha.
|
|
163
|
+
var VERSION2 = true ? "4.4.0-alpha.13" : "latest";
|
|
164
164
|
var ArrowWriter = {
|
|
165
165
|
name: "Apache Arrow",
|
|
166
166
|
id: "arrow",
|
|
@@ -262,7 +262,7 @@ function cloneBuffer(arr, force) {
|
|
|
262
262
|
|
|
263
263
|
// dist/triangulate-on-worker.js
|
|
264
264
|
var import_worker_utils = require("@loaders.gl/worker-utils");
|
|
265
|
-
var VERSION3 = true ? "4.4.0-alpha.
|
|
265
|
+
var VERSION3 = true ? "4.4.0-alpha.13" : "latest";
|
|
266
266
|
var TriangulationWorker = {
|
|
267
267
|
id: "triangulation",
|
|
268
268
|
name: "Triangulate",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { processOnWorker } from '@loaders.gl/worker-utils';
|
|
5
5
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
6
6
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
7
|
-
const VERSION = typeof "4.4.0-alpha.
|
|
7
|
+
const VERSION = typeof "4.4.0-alpha.13" !== 'undefined' ? "4.4.0-alpha.13" : 'latest';
|
|
8
8
|
/**
|
|
9
9
|
* Worker for tessellating geometries. Normally called through triangulateOnWorker
|
|
10
10
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/arrow",
|
|
3
|
-
"version": "4.4.0-alpha.
|
|
3
|
+
"version": "4.4.0-alpha.13",
|
|
4
4
|
"description": "Simple columnar table loader for the Apache Arrow format",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -60,17 +60,17 @@
|
|
|
60
60
|
"build-worker2": "esbuild src/workers/arrow-worker.ts --bundle --outfile=dist/arrow-worker.js --platform=browser --external:{stream}"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@loaders.gl/gis": "4.4.0-alpha.
|
|
64
|
-
"@loaders.gl/loader-utils": "4.4.0-alpha.
|
|
65
|
-
"@loaders.gl/schema": "4.4.0-alpha.
|
|
66
|
-
"@loaders.gl/schema-utils": "4.4.0-alpha.
|
|
67
|
-
"@loaders.gl/wkt": "4.4.0-alpha.
|
|
68
|
-
"@loaders.gl/worker-utils": "4.4.0-alpha.
|
|
63
|
+
"@loaders.gl/gis": "4.4.0-alpha.13",
|
|
64
|
+
"@loaders.gl/loader-utils": "4.4.0-alpha.13",
|
|
65
|
+
"@loaders.gl/schema": "4.4.0-alpha.13",
|
|
66
|
+
"@loaders.gl/schema-utils": "4.4.0-alpha.13",
|
|
67
|
+
"@loaders.gl/wkt": "4.4.0-alpha.13",
|
|
68
|
+
"@loaders.gl/worker-utils": "4.4.0-alpha.13",
|
|
69
69
|
"@math.gl/polygon": "^4.1.0",
|
|
70
70
|
"apache-arrow": ">= 16.1.0"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|
|
73
73
|
"@loaders.gl/core": "4.4.0-alpha.1"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "5145c7b32353d00f414b85773caa9064af412434"
|
|
76
76
|
}
|