apache-arrow
Version:
Apache Arrow columnar in-memory format
111 lines • 175 kB
JavaScript
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory(global.Arrow = global.Arrow || {}));
}(this, (function (exports) {var h;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}var ba=typeof Object.defineProperties=="function"?Object.defineProperty:function(a,b,c){if(a==Array.prototype||a==Object.prototype)return a;a[b]=c.value;return a};
function ca(a){a=["object"==typeof globalThis&&globalThis,a,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof global&&global];for(var b=0;b<a.length;++b){var c=a[b];if(c&&c.Math==Math)return c}throw Error("Cannot find global object");}var da=ca(this);function ea(a,b){if(b)a:{var c=da;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];if(!(e in c))break a;c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&b!=null&&ba(c,a,{configurable:!0,writable:!0,value:b})}}
ea("Symbol",function(a){function b(f){if(this instanceof b)throw new TypeError("Symbol is not a constructor");return new c(d+(f||"")+"_"+e++,f)}function c(f,g){this.Ib=f;ba(this,"description",{configurable:!0,writable:!0,value:g})}if(a)return a;c.prototype.toString=function(){return this.Ib};var d="jscomp_symbol_"+(Math.random()*1E9>>>0)+"_",e=0;return b});
ea("Symbol.iterator",function(a){if(a)return a;a=Symbol("Symbol.iterator");for(var b="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),c=0;c<b.length;c++){var d=da[b[c]];typeof d==="function"&&typeof d.prototype[a]!="function"&&ba(d.prototype,a,{configurable:!0,writable:!0,value:function(){return fa(aa(this))}})}return a});ea("Symbol.asyncIterator",function(a){return a?a:Symbol("Symbol.asyncIterator")});
ea("Symbol.toStringTag",function(a){return a?a:Symbol("Symbol.toStringTag")});function fa(a){a={next:a};a[Symbol.iterator]=function(){return this};return a}function ha(a){function b(d){return a.next(d)}function c(d){return a.throw(d)}return new Promise(function(d,e){function f(g){g.done?d(g.value):Promise.resolve(g.value).then(b,c).then(f,e)}f(a.next())})}function l(a){return ha(a())}
function ia(a){var b=a[Symbol.asyncIterator];if(b!==void 0)a=b.call(a);else{b=ja;var c=typeof Symbol!="undefined"&&Symbol.iterator&&a[Symbol.iterator];if(c)a=c.call(a);else if(typeof a.length=="number")a={next:aa(a)};else throw Error(String(a)+" is not an iterable or ArrayLike");a=new b(a)}return a}
function ja(a){this[Symbol.asyncIterator]=function(){return this};this[Symbol.iterator]=function(){return a};this.next=function(b){return Promise.resolve(a.next(b))};this["throw"]=function(b){return new Promise(function(c,d){var e=a["throw"];e!==void 0?c(e.call(a,b)):(c=a["return"],c!==void 0&&c.call(a),d(new TypeError("no `throw` method")))})};a["return"]!==void 0&&(this["return"]=function(b){return Promise.resolve(a["return"](b))})}function n(a,b){this.action=a;this.value=b}
function ka(a,b,c,d){this.method=a;this.ea=b;this.resolve=c;this.reject=d}function la(a){this.frame=a;this.next=null}function ma(){this.Ma=this.V=null}ma.prototype.first=function(){if(this.V)return this.V.frame;throw Error("no frames in executionQueue");};function na(a){a.V&&(a.V=a.V.next,a.V||(a.Ma=null))}ma.prototype.enqueue=function(a){a=new la(a);this.Ma?this.Ma.next=a:this.V=a;this.Ma=a};
function oa(a){this.Cb=a;this.S=null;this.L=new ma;this[Symbol.asyncIterator]=function(){return this};var b=this;this.Wb=function(c){var d=b.L.first();c.done===!0?(b.S=null,d.method="next",d.ea=c.value):(d.resolve({value:c.value,done:!1}),na(b.L));pa(b)};this.Vb=function(c){qa(b,c)};this.$a=function(c){ra(b,c)}}function ta(a,b,c){return new Promise(function(d,e){var f=a.L.V===null;a.L.enqueue(new ka(b,c,d,e));f&&pa(a)})}oa.prototype.next=function(a){return ta(this,"next",a)};
oa.prototype.return=function(a){return ta(this,"return",new n(0,a))};oa.prototype.throw=function(a){return ta(this,"throw",a)};function pa(a){if(a.L.V!==null)try{if(a.S){if(!a.S)throw Error("no delegate to perform execution");var b=a.L.first();if(b.method in a.S)try{a.S[b.method](b.ea).then(a.Wb,a.Vb).catch(a.$a)}catch(c){qa(a,c)}else a.S=null,pa(a)}else ua(a)}catch(c){ra(a,c)}}
function ua(a){var b=a.L.first();try{var c=a.Cb[b.method](b.ea);if(c.value instanceof n)switch(c.value.action){case 0:Promise.resolve(c.value.value).then(function(d){b.resolve({value:d,done:c.done});na(a.L);pa(a)},function(d){b.reject(d);na(a.L);pa(a)}).catch(a.$a);break;case 1:a.S=ia(c.value.value);b.method="next";b.ea=void 0;pa(a);break;case 2:Promise.resolve(c.value.value).then(function(d){b.method="next";b.ea=d;pa(a)},function(d){b.method="throw";b.ea=d;pa(a)}).catch(a.$a);break;default:throw Error("Unrecognized AsyncGeneratorWrapper$ActionEnum");
}else b.resolve(c),na(a.L),pa(a)}catch(d){b.reject(d),na(a.L),pa(a)}}function qa(a,b){var c=a.L.first();a.S=null;c.method="throw";c.ea=b;pa(a)}function ra(a,b){a.L.V!==null&&(a.L.first().reject(b),na(a.L));a.S&&"return"in a.S&&(a.S["return"](void 0),a.S=null);a.Cb["return"](void 0);pa(a)}const va=new TextDecoder("utf-8"),wa=a=>va.decode(a),xa=new TextEncoder;const q=a=>typeof a==="function",t=a=>a!=null&&Object(a)===a,ya=a=>"_getDOMStream"in a&&"_getNodeStream"in a,za=a=>t(a)&&q(a.cancel)&&q(a.getReader)&&!ya(a),Aa=a=>t(a)&&q(a.read)&&q(a.pipe)&&typeof a.readable==="boolean"&&!ya(a);const Ba=typeof SharedArrayBuffer!=="undefined"?SharedArrayBuffer:ArrayBuffer;function Ca(a){const b=a[0]?[a[0]]:[];let c,d,e,f;for(let g,k,m=0,p=0,r=a.length;++m<r;)g=b[p],k=a[m],!g||!k||g.buffer!==k.buffer||k.byteOffset<g.byteOffset?k&&(b[++p]=k):({byteOffset:c,byteLength:e}=g,{byteOffset:d,byteLength:f}=k,c+e<d||d+f<c?k&&(b[++p]=k):b[p]=new Uint8Array(g.buffer,c,d-c+f));return b}
function Da(a,b,c=0,d=b.byteLength){const e=a.byteLength,f=new Uint8Array(a.buffer,a.byteOffset,e);b=new Uint8Array(b.buffer,b.byteOffset,Math.min(d,e));f.set(b,c);return a}
function Ea(a,b){a=Ca(a);const c=a.reduce((m,p)=>m+p.byteLength,0);let d,e,f=0,g=-1;const k=Math.min(b||Number.POSITIVE_INFINITY,c);for(const m=a.length;++g<m;){b=a[g];d=b.subarray(0,Math.min(b.length,k-f));if(k<=f+d.length){d.length<b.length?a[g]=b.subarray(d.length):d.length===b.length&&g++;e?Da(e,d,f):e=d;break}Da(e||(e=new Uint8Array(k)),d,f);f+=d.length}return[e||new Uint8Array(0),a.slice(g),c-(e?e.byteLength:0)]}
function u(a,b){b=t(b)&&"done"in b&&"value"in b?b.value:b;if(b instanceof a)return a===Uint8Array?new a(b.buffer,b.byteOffset,b.byteLength):b;if(!b)return new a(0);typeof b==="string"&&(b=xa.encode(b));return b instanceof ArrayBuffer||b instanceof Ba?new a(b):t(b)&&q(b.clear)&&q(b.bytes)&&q(b.position)&&q(b.setPosition)&&q(b.capacity)&&q(b.getBufferIdentifier)&&q(b.createLong)?u(a,b.bytes()):ArrayBuffer.isView(b)?b.byteLength<=0?new a(0):new a(b.buffer,b.byteOffset,b.byteLength/a.BYTES_PER_ELEMENT):
a.from(b)}const Fa=a=>u(Uint8Array,a),Ga=a=>{a.next();return a};function*Ha(a,b){function*c(d){yield d}b=typeof b==="string"?c(b):ArrayBuffer.isView(b)?c(b):b instanceof ArrayBuffer?c(b):b instanceof Ba?c(b):t(b)&&q(b[Symbol.iterator])?b:c(b);yield*Ga(function*(d){let e=null;do e=d.next(yield u(a,e));while(!e.done)}(b[Symbol.iterator]()));return new a}
function Ja(a,b){return new oa(function*(){function c(f){return new oa(function*(){yield new n(1,Ga(function*(g){let k=null;do{let m;k=g.next(yield(m=k)==null?void 0:m.value)}while(!k.done)}(f[Symbol.iterator]())))}())}function d(f){return new oa(function*(){yield new n(0,yield new n(2,f))}())}if(t(b)&&q(b.then))return new n(0,yield new n(1,Ja(a,yield new n(2,b))));const e=typeof b==="string"?d(b):ArrayBuffer.isView(b)?d(b):b instanceof ArrayBuffer?d(b):b instanceof Ba?d(b):t(b)&&q(b[Symbol.iterator])?
c(b):t(b)&&q(b[Symbol.asyncIterator])?b:d(b);yield new n(1,Ga(function(f){return new oa(function*(){let g=null;do g=yield new n(2,f.next(yield new n(0,u(a,g))));while(!g.done)}())}(e[Symbol.asyncIterator]())));return new n(0,new a)}())}function Ka(a,b,c){if(a!==0){c=c.slice(0,b);for(let d=-1,e=c.length;++d<e;)c[d]+=a}return c.subarray(0,b)}function La(a,b){let c=0;const d=a.length;if(d!==b.length)return!1;if(d>0){do if(a[c]!==b[c])return!1;while(++c<d)}return!0}var v={};v.compareArrayLike=La;
v.joinUint8Arrays=Ea;v.memcpy=Da;v.rebaseValueOffsets=Ka;v.toArrayBufferView=u;v.toArrayBufferViewAsyncIterator=Ja;v.toArrayBufferViewIterator=Ha;v.toBigInt64Array=a=>u(BigInt64Array,a);v.toBigUint64Array=a=>u(BigUint64Array,a);v.toFloat32Array=a=>u(Float32Array,a);v.toFloat32ArrayAsyncIterator=a=>Ja(Float32Array,a);v.toFloat32ArrayIterator=a=>Ha(Float32Array,a);v.toFloat64Array=a=>u(Float64Array,a);v.toFloat64ArrayAsyncIterator=a=>Ja(Float64Array,a);v.toFloat64ArrayIterator=a=>Ha(Float64Array,a);
v.toInt16Array=a=>u(Int16Array,a);v.toInt16ArrayAsyncIterator=a=>Ja(Int16Array,a);v.toInt16ArrayIterator=a=>Ha(Int16Array,a);v.toInt32Array=a=>u(Int32Array,a);v.toInt32ArrayAsyncIterator=a=>Ja(Int32Array,a);v.toInt32ArrayIterator=a=>Ha(Int32Array,a);v.toInt8Array=a=>u(Int8Array,a);v.toInt8ArrayAsyncIterator=a=>Ja(Int8Array,a);v.toInt8ArrayIterator=a=>Ha(Int8Array,a);v.toUint16Array=a=>u(Uint16Array,a);v.toUint16ArrayAsyncIterator=a=>Ja(Uint16Array,a);v.toUint16ArrayIterator=a=>Ha(Uint16Array,a);
v.toUint32Array=a=>u(Uint32Array,a);v.toUint32ArrayAsyncIterator=a=>Ja(Uint32Array,a);v.toUint32ArrayIterator=a=>Ha(Uint32Array,a);v.toUint8Array=Fa;v.toUint8ArrayAsyncIterator=a=>Ja(Uint8Array,a);v.toUint8ArrayIterator=a=>Ha(Uint8Array,a);v.toUint8ClampedArray=a=>u(Uint8ClampedArray,a);v.toUint8ClampedArrayAsyncIterator=a=>Ja(Uint8ClampedArray,a);v.toUint8ClampedArrayIterator=a=>Ha(Uint8ClampedArray,a);function Ma(){throw Error('"toDOMStream" not available in this environment');}function Na(){throw Error('"toNodeStream" not available in this environment');}const Oa=a=>{a.next();return a};
function*Pa(a){let b,c=!1,d=[],e,f,g,k=0;({O:f,size:g}=(yield null)||{O:"read",size:0});a=Ha(Uint8Array,a)[Symbol.iterator]();try{do if({done:b,value:e}=Number.isNaN(g-k)?a.next():a.next(g-k),!b&&e.byteLength>0&&(d.push(e),k+=e.byteLength),b||g<=k){do{if(f==="peek")var m=Ea(d,g)[0];else[e,d,k]=Ea(d,g),m=e;({O:f,size:g}=yield m)}while(g<k)}while(!b)}catch(p){c=!0,typeof a.throw==="function"&&a.throw(p)}finally{c===!1&&typeof a.return==="function"&&a.return(null)}return null}
function Qa(a){return new oa(function*(){let b,c=!1,d=[],e,f,g,k=0;({O:f,size:g}=(yield new n(0,null))||{O:"read",size:0});const m=Ja(Uint8Array,a)[Symbol.asyncIterator]();try{do if({done:b,value:e}=Number.isNaN(g-k)?yield new n(2,m.next()):yield new n(2,m.next(g-k)),!b&&e.byteLength>0&&(d.push(e),k+=e.byteLength),b||g<=k){do{if(f==="peek")var p=Ea(d,g)[0];else[e,d,k]=Ea(d,g),p=e;({O:f,size:g}=yield new n(0,p))}while(g<k)}while(!b)}catch(r){c=!0,typeof m.throw==="function"&&(yield new n(2,m.throw(r)))}finally{c===
!1&&typeof m.return==="function"&&(yield new n(2,m.return(new Uint8Array(0))))}return new n(0,null)}())}
function Ra(a){return new oa(function*(){let b=!1,c=!1,d=[],e,f,g,k=0;({O:f,size:g}=(yield new n(0,null))||{O:"read",size:0});const m=new Sa(a);try{do if({done:b,value:e}=Number.isNaN(g-k)?yield new n(2,m.read()):yield new n(2,m.read(g-k)),!b&&e.byteLength>0&&(d.push(u(Uint8Array,e)),k+=e.byteLength),b||g<=k){do{if(f==="peek")var p=Ea(d,g)[0];else[e,d,k]=Ea(d,g),p=e;({O:f,size:g}=yield new n(0,p))}while(g<k)}while(!b)}catch(r){c=!0,yield new n(2,m.cancel(r))}finally{c===!1?yield new n(2,m.cancel()):
a.locked&&m.releaseLock()}return new n(0,null)}())}
class Sa{constructor(a){this.source=a;this.W=null;this.W=this.source.getReader();this.W.closed.catch(()=>{})}get closed(){return this.W?this.W.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.W&&this.W.releaseLock();this.W=null}cancel(a){const b=this;return l(function*(){const c=b.W,d=b.source;c&&(yield c.cancel(a).catch(()=>{}));d&&d.locked&&b.releaseLock()})}read(a){const b=this;return l(function*(){if(a===0)return{done:b.W==null,value:new Uint8Array(0)};const c=yield b.W.read();!c.done&&
(c.value=u(Uint8Array,c));return c})}}const Ta=(a,b)=>{const c=e=>d([b,e]);let d;return[b,c,new Promise(e=>(d=e)&&a.once(b,c))]};
function Ua(a){return new oa(function*(){function b(sa,Ia){r=p=null;return new Promise((Nc,rj)=>{for(const [Db,sj]of sa)a.off(Db,sj);try{const Db=a.destroy;Db&&Db.call(a,Ia);Ia=void 0}catch(Db){Ia=Db||Ia}finally{Ia!=null?rj(Ia):Nc()}})}const c=[];let d="error",e=!1,f=null,g,k,m=0,p=[],r;({O:g,size:k}=(yield new n(0,null))||{O:"read",size:0});if(a.isTTY)return yield new n(0,new Uint8Array(0)),new n(0,null);try{c[0]=Ta(a,"end");c[1]=Ta(a,"error");do{c[2]=Ta(a,"readable");[d,f]=yield new n(2,Promise.race(c.map(sa=>
sa[2])));if(d==="error")break;(e=d==="end")||(Number.isFinite(k-m)?(r=Fa(a.read(k-m)),r.byteLength<k-m&&(r=Fa(a.read()))):r=Fa(a.read()),r.byteLength>0&&(p.push(r),m+=r.byteLength));if(e||k<=m){do{if(g==="peek")var U=Ea(p,k)[0];else[r,p,m]=Ea(p,k),U=r;({O:g,size:k}=yield new n(0,U))}while(k<m)}}while(!e)}finally{yield new n(2,b(c,d==="error"?f:null))}return new n(0,null)}())};var w,Va=w||(w={});Va[Va.V1=0]="V1";Va[Va.V2=1]="V2";Va[Va.V3=2]="V3";Va[Va.V4=3]="V4";Va[Va.V5=4]="V5";var x,Wa=x||(x={});Wa[Wa.Sparse=0]="Sparse";Wa[Wa.Dense=1]="Dense";var y,Xa=y||(y={});Xa[Xa.HALF=0]="HALF";Xa[Xa.SINGLE=1]="SINGLE";Xa[Xa.DOUBLE=2]="DOUBLE";var Ya,Za=Ya||(Ya={});Za[Za.DAY=0]="DAY";Za[Za.MILLISECOND=1]="MILLISECOND";var z,$a=z||(z={});$a[$a.SECOND=0]="SECOND";$a[$a.MILLISECOND=1]="MILLISECOND";$a[$a.MICROSECOND=2]="MICROSECOND";$a[$a.NANOSECOND=3]="NANOSECOND";var A,ab=A||(A={});ab[ab.YEAR_MONTH=0]="YEAR_MONTH";ab[ab.DAY_TIME=1]="DAY_TIME";ab[ab.MONTH_DAY_NANO=2]="MONTH_DAY_NANO";const bb=new Int32Array(2);new Float32Array(bb.buffer);new Float64Array(bb.buffer);new Uint16Array((new Uint8Array([1,0])).buffer);var cb,db=cb||(cb={});db[db.UTF8_BYTES=1]="UTF8_BYTES";db[db.UTF16_STRING=2]="UTF16_STRING";function eb(a,b){return(a.l[b]|a.l[b+1]<<8)<<16>>16}function fb(a,b){return BigInt.asIntN(64,BigInt(a.v(b)>>>0)+(BigInt(a.v(b+4)>>>0)<<BigInt(32)))}function B(a,b,c){b-=a.v(b);return c<eb(a,b)?eb(a,b+c):0}function gb(a,b,c){b.h=c+a.v(c);b.g=a;return b}function hb(a,b,c){b+=a.v(b);const d=a.v(b);b+=4;b=a.l.subarray(b,b+d);return c===cb.UTF8_BYTES?b:a.ac.decode(b)}function ib(a,b){return b+a.v(b)}function jb(a,b){return b+a.v(b)+4}function kb(a,b){return a.v(b+a.v(b))}
class lb{constructor(a){this.l=a;this.gb=0;this.ac=new TextDecoder}clear(){this.gb=0}bytes(){return this.l}position(){return this.gb}setPosition(a){this.gb=a}v(a){return this.l[a]|this.l[a+1]<<8|this.l[a+2]<<16|this.l[a+3]<<24}ja(a,b){this.l[a]=b}lb(a,b){this.l[a]=b;this.l[a+1]=b>>8}Y(a,b){this.l[a]=b;this.l[a+1]=b>>8;this.l[a+2]=b>>16;this.l[a+3]=b>>24}aa(a,b){this.Y(a,Number(BigInt.asIntN(32,b)));this.Y(a+4,Number(BigInt.asIntN(32,b>>BigInt(32))))}};function mb(a){return a.g.bytes().subarray(a.g.position(),a.g.position()+a.offset())}function nb(a,b,c){b>a.ua&&(a.ua=b);const d=~(a.g.l.length-a.C+c)+1&b-1;for(;a.C<d+b+c;){const g=a.g.l.length;var e=a,f=a.g;const k=f.l.length;if(k&3221225472)throw Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const m=k<<1,p=new lb(new Uint8Array(m));p.setPosition(m-k);p.bytes().set(f.bytes(),m-k);e.g=p;a.C+=a.g.l.length-g}a.pad(d)}function ob(a,b){nb(a,2,0);a.lb(b)}
function pb(a,b){nb(a,4,0);a.Y(b)}function qb(a,b,c,d){if(a.fa||c!=d)nb(a,1,0),a.ja(c),a.slot(b)}function rb(a,b,c){if(a.fa||b!=c)ob(a,b),a.slot(0)}function sb(a,b,c,d){if(a.fa||c!=d)pb(a,c),a.slot(b)}function tb(a,b,c){var d=BigInt("0");if(a.fa||c!==d)nb(a,8,0),a.aa(c),a.slot(b)}function ub(a,b){nb(a,4,0);a.Y(a.offset()-b+4)}function C(a,b,c){if(a.fa||c!=0)ub(a,c),a.slot(b)}function vb(a){if(a.ta)throw new TypeError("FlatBuffers: object serialization must not be nested.");}
function D(a,b){vb(a);a.X==null&&(a.X=[]);a.kb=b;for(let c=0;c<b;c++)a.X[c]=0;a.ta=!0;a.fb=a.offset()}
function E(a){if(a.X==null||!a.ta)throw Error("FlatBuffers: endObject called without startObject");pb(a,0);const b=a.offset();let c=a.kb-1;for(;c>=0&&a.X[c]==0;c--);for(var d=c+1;c>=0;c--)ob(a,a.X[c]!=0?b-a.X[c]:0);ob(a,b-a.fb);d=(d+2)*2;ob(a,d);let e=0;const f=a.C;c=0;a:for(;c<a.va.length;c++){const g=a.g.l.length-a.va[c];if(d==eb(a.g,g)){for(let k=2;k<d;k+=2)if(eb(a.g,f+k)!=eb(a.g,g+k))continue a;e=a.va[c];break}}e?(a.C=a.g.l.length-b,a.g.Y(a.C,e-b)):(a.va.push(a.offset()),a.g.Y(a.g.l.length-b,
a.offset()-b));a.ta=!1;return b}function wb(a,b,c,d){vb(a);a.jb=c;nb(a,4,b*c);nb(a,d,b*c)}function xb(a){a.Y(a.jb);return a.offset()}function yb(a,b){if(b===null||b===void 0)return 0;b=b instanceof Uint8Array?b:a.bc.encode(b);nb(a,1,0);a.ja(0);wb(a,1,b.length,1);a.g.setPosition(a.C-=b.length);a.g.bytes().set(b,a.C);return xb(a)}
class zb{constructor(){this.ua=1;this.X=null;this.kb=0;this.ta=!1;this.fb=0;this.va=[];this.jb=0;this.fa=!1;this.bc=new TextEncoder;this.g=new lb(new Uint8Array(1024));this.C=1024}clear(){this.g.clear();this.C=this.g.l.length;this.ua=1;this.X=null;this.kb=0;this.ta=!1;this.fb=0;this.va=[];this.jb=0;this.fa=!1}pad(a){for(let b=0;b<a;b++)this.g.ja(--this.C,0)}ja(a){this.g.ja(--this.C,a)}lb(a){this.g.lb(this.C-=2,a)}Y(a){this.g.Y(this.C-=4,a)}aa(a){this.g.aa(this.C-=8,a)}slot(a){this.X!==null&&(this.X[a]=
this.offset())}offset(){return this.g.l.length-this.C}finish(a,b,c){c=c?4:0;if(b){nb(this,this.ua,8+c);if(b.length!=4)throw new TypeError("FlatBuffers: file identifier must be length 4");for(let d=3;d>=0;d--)this.ja(b.charCodeAt(d))}nb(this,this.ua,4+c);ub(this,a);c&&pb(this,this.g.l.length-this.C);this.g.setPosition(this.C)}};var Ab,Bb=Ab||(Ab={});Bb[Bb.BUFFER=0]="BUFFER";var Cb,Eb=Cb||(Cb={});Eb[Eb.LZ4_FRAME=0]="LZ4_FRAME";Eb[Eb.ZSTD=1]="ZSTD";class Fb{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}codec(){const a=B(this.g,this.h,4);return a?this.g.l[this.h+a]<<24>>24:Cb.fc}method(){const a=B(this.g,this.h,6);return a?this.g.l[this.h+a]<<24>>24:Ab.dc}};class Gb{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}offset(){return fb(this.g,this.h)}length(){return fb(this.g,this.h+8)}};class Hb{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}length(){return fb(this.g,this.h)}nullCount(){return fb(this.g,this.h+8)}};function Ib(a){const b=B(a.g,a.h,6);return b?kb(a.g,a.h+b):0}function Jb(a){const b=B(a.g,a.h,8);return b?kb(a.g,a.h+b):0}class Kb{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}length(){const a=B(this.g,this.h,4);return a?fb(this.g,this.h+a):BigInt("0")}N(a,b){const c=B(this.g,this.h,6);return c?(b||new Hb).i(jb(this.g,this.h+c)+a*16,this.g):null}buffers(a,b){const c=B(this.g,this.h,8);return c?(b||new Gb).i(jb(this.g,this.h+c)+a*16,this.g):null}};class Lb{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}id(){const a=B(this.g,this.h,4);return a?fb(this.g,this.h+a):BigInt("0")}data(a){const b=B(this.g,this.h,6);return b?(a||new Kb).i(ib(this.g,this.h+b),this.g):null}Ja(){const a=B(this.g,this.h,8);return a?!!(this.g.l[this.h+a]<<24>>24):!1}};var Mb,Nb=Mb||(Mb={});Nb[Nb.Little=0]="Little";Nb[Nb.Big=1]="Big";var Ob,Pb=Ob||(Ob={});Pb[Pb.DenseArray=0]="DenseArray";class Qb{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}bitWidth(){const a=B(this.g,this.h,4);return a?this.g.v(this.h+a):0}isSigned(){const a=B(this.g,this.h,6);return a?!!(this.g.l[this.h+a]<<24>>24):!1}};function Rb(a){const b=B(a.g,a.h,6);return b?(new Qb).i(ib(a.g,a.h+b),a.g):null}class Sb{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}id(){const a=B(this.g,this.h,4);return a?fb(this.g,this.h+a):BigInt("0")}isOrdered(){const a=B(this.g,this.h,8);return a?!!(this.g.l[this.h+a]<<24>>24):!1}};class Tb{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}key(a){const b=B(this.g,this.h,4);return b?hb(this.g,this.h+b,a):null}value(a){const b=B(this.g,this.h,6);return b?hb(this.g,this.h+b,a):null}};class Ub{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}unit(){const a=B(this.g,this.h,4);return a?eb(this.g,this.h+a):Ya.MILLISECOND}};class Vb{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}precision(){const a=B(this.g,this.h,4);return a?this.g.v(this.h+a):0}scale(){const a=B(this.g,this.h,6);return a?this.g.v(this.h+a):0}bitWidth(){const a=B(this.g,this.h,8);return a?this.g.v(this.h+a):128}};class Wb{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}unit(){const a=B(this.g,this.h,4);return a?eb(this.g,this.h+a):z.MILLISECOND}};class Xb{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}byteWidth(){const a=B(this.g,this.h,4);return a?this.g.v(this.h+a):0}};class Yb{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}listSize(){const a=B(this.g,this.h,4);return a?this.g.v(this.h+a):0}};class Zb{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}precision(){const a=B(this.g,this.h,4);return a?eb(this.g,this.h+a):y.HALF}};class $b{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}unit(){const a=B(this.g,this.h,4);return a?eb(this.g,this.h+a):A.YEAR_MONTH}};class ac{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}keysSorted(){const a=B(this.g,this.h,4);return a?!!(this.g.l[this.h+a]<<24>>24):!1}};class bc{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}unit(){const a=B(this.g,this.h,4);return a?eb(this.g,this.h+a):z.MILLISECOND}bitWidth(){const a=B(this.g,this.h,6);return a?this.g.v(this.h+a):32}};class cc{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}unit(){const a=B(this.g,this.h,4);return a?eb(this.g,this.h+a):z.SECOND}timezone(a){const b=B(this.g,this.h,6);return b?hb(this.g,this.h+b,a):null}};class dc{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}mode(){const a=B(this.g,this.h,4);return a?eb(this.g,this.h+a):x.Sparse}typeIds(a){const b=B(this.g,this.h,6);return b?this.g.v(jb(this.g,this.h+b)+a*4):0}};var F,G=F||(F={});G[G.NONE=0]="NONE";G[G.Null=1]="Null";G[G.Int=2]="Int";G[G.FloatingPoint=3]="FloatingPoint";G[G.Binary=4]="Binary";G[G.Utf8=5]="Utf8";G[G.Bool=6]="Bool";G[G.Decimal=7]="Decimal";G[G.Date=8]="Date";G[G.Time=9]="Time";G[G.Timestamp=10]="Timestamp";G[G.Interval=11]="Interval";G[G.List=12]="List";G[G.Struct_=13]="Struct_";G[G.Union=14]="Union";G[G.FixedSizeBinary=15]="FixedSizeBinary";G[G.FixedSizeList=16]="FixedSizeList";G[G.Map=17]="Map";G[G.Duration=18]="Duration";
G[G.LargeBinary=19]="LargeBinary";G[G.LargeUtf8=20]="LargeUtf8";G[G.LargeList=21]="LargeList";G[G.RunEndEncoded=22]="RunEndEncoded";function ec(a,b){wb(a,4,b.length,4);for(let c=b.length-1;c>=0;c--)ub(a,b[c]);return xb(a)}function fc(a,b){wb(a,4,b.length,4);for(let c=b.length-1;c>=0;c--)ub(a,b[c]);return xb(a)}function hc(a){const b=B(a.g,a.h,14);return b?kb(a.g,a.h+b):0}
class ic{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}name(a){const b=B(this.g,this.h,4);return b?hb(this.g,this.h+b,a):null}nullable(){const a=B(this.g,this.h,6);return a?!!(this.g.l[this.h+a]<<24>>24):!1}type(a){const b=B(this.g,this.h,10);return b?gb(this.g,a,this.h+b):null}dictionary(a){const b=B(this.g,this.h,12);return b?(a||new Sb).i(ib(this.g,this.h+b),this.g):null}children(a,b){const c=B(this.g,this.h,14);return c?(b||new ic).i(ib(this.g,jb(this.g,this.h+c)+a*4),
this.g):null}Ga(a){const b=B(this.g,this.h,16);return b?(new Tb).i(ib(this.g,jb(this.g,this.h+b)+a*4),this.g):null}Ha(){const a=B(this.g,this.h,16);return a?kb(this.g,this.h+a):0}};function jc(a,b){wb(a,4,b.length,4);for(let c=b.length-1;c>=0;c--)ub(a,b[c]);return xb(a)}function kc(a,b){wb(a,4,b.length,4);for(let c=b.length-1;c>=0;c--)ub(a,b[c]);return xb(a)}function lc(a){const b=B(a.g,a.h,6);return b?kb(a.g,a.h+b):0}
class mc{constructor(){this.g=null;this.h=0}i(a,b){this.h=a;this.g=b;return this}fields(a,b){const c=B(this.g,this.h,6);return c?(b||new ic).i(ib(this.g,jb(this.g,this.h+c)+a*4),this.g):null}Ga(a){const b=B(this.g,this.h,8);return b?(new Tb).i(ib(this.g,jb(this.g,this.h+b)+a*4),this.g):null}Ha(){const a=B(this.g,this.h,8);return a?kb(this.g,this.h+a):0}features(a){const b=B(this.g,this.h,10);return b?fb(this.g,jb(this.g,this.h+b)+a*8):BigInt(0)}};var nc,oc=nc||(nc={});oc[oc.Row=0]="Row";oc[oc.Column=1]="Column";var pc,qc=pc||(pc={});qc[qc.NONE=0]="NONE";qc[qc.SparseTensorIndexCOO=1]="SparseTensorIndexCOO";qc[qc.SparseMatrixIndexCSX=2]="SparseMatrixIndexCSX";qc[qc.SparseTensorIndexCSF=3]="SparseTensorIndexCSF";var H,rc=H||(H={});rc[rc.NONE=0]="NONE";rc[rc.Schema=1]="Schema";rc[rc.DictionaryBatch=2]="DictionaryBatch";rc[rc.RecordBatch=3]="RecordBatch";rc[rc.Tensor=4]="Tensor";rc[rc.SparseTensor=5]="SparseTensor";var I,J=I||(I={});J[J.NONE=0]="NONE";J[J.Null=1]="Null";J[J.Int=2]="Int";J[J.Float=3]="Float";J[J.Binary=4]="Binary";J[J.Utf8=5]="Utf8";J[J.Bool=6]="Bool";J[J.Decimal=7]="Decimal";J[J.Date=8]="Date";J[J.Time=9]="Time";J[J.Timestamp=10]="Timestamp";J[J.Interval=11]="Interval";J[J.List=12]="List";J[J.Struct=13]="Struct";J[J.Union=14]="Union";J[J.FixedSizeBinary=15]="FixedSizeBinary";J[J.FixedSizeList=16]="FixedSizeList";J[J.Map=17]="Map";J[J.Duration=18]="Duration";J[J.LargeBinary=19]="LargeBinary";
J[J.LargeUtf8=20]="LargeUtf8";J[J.Dictionary=-1]="Dictionary";J[J.Int8=-2]="Int8";J[J.Int16=-3]="Int16";J[J.Int32=-4]="Int32";J[J.Int64=-5]="Int64";J[J.Uint8=-6]="Uint8";J[J.Uint16=-7]="Uint16";J[J.Uint32=-8]="Uint32";J[J.Uint64=-9]="Uint64";J[J.Float16=-10]="Float16";J[J.Float32=-11]="Float32";J[J.Float64=-12]="Float64";J[J.DateDay=-13]="DateDay";J[J.DateMillisecond=-14]="DateMillisecond";J[J.TimestampSecond=-15]="TimestampSecond";J[J.TimestampMillisecond=-16]="TimestampMillisecond";
J[J.TimestampMicrosecond=-17]="TimestampMicrosecond";J[J.TimestampNanosecond=-18]="TimestampNanosecond";J[J.TimeSecond=-19]="TimeSecond";J[J.TimeMillisecond=-20]="TimeMillisecond";J[J.TimeMicrosecond=-21]="TimeMicrosecond";J[J.TimeNanosecond=-22]="TimeNanosecond";J[J.DenseUnion=-23]="DenseUnion";J[J.SparseUnion=-24]="SparseUnion";J[J.IntervalDayTime=-25]="IntervalDayTime";J[J.IntervalYearMonth=-26]="IntervalYearMonth";J[J.DurationSecond=-27]="DurationSecond";J[J.DurationMillisecond=-28]="DurationMillisecond";
J[J.DurationMicrosecond=-29]="DurationMicrosecond";J[J.DurationNanosecond=-30]="DurationNanosecond";J[J.IntervalMonthDayNano=-31]="IntervalMonthDayNano";var sc,tc=sc||(sc={});tc[tc.OFFSET=0]="OFFSET";tc[tc.DATA=1]="DATA";tc[tc.VALIDITY=2]="VALIDITY";tc[tc.TYPE=3]="TYPE";function uc(a){if(a===null)return"null";if(a===void 0)return"undefined";switch(typeof a){case "number":return`${a}`;case "bigint":return`${a}`;case "string":return`"${a}"`}return typeof a[Symbol.toPrimitive]==="function"?a[Symbol.toPrimitive]("string"):ArrayBuffer.isView(a)?a instanceof BigInt64Array||a instanceof BigUint64Array?`[${[...a].map(b=>uc(b))}]`:`[${a}]`:ArrayBuffer.isView(a)?`[${a}]`:JSON.stringify(a,(b,c)=>typeof c==="bigint"?`${c}`:c)}var vc={};vc.valueToString=uc;function K(a){if(typeof a==="bigint"&&(a<Number.MIN_SAFE_INTEGER||a>Number.MAX_SAFE_INTEGER))throw new TypeError(`${a} is not safe to convert to a number.`);return Number(a)}function wc(a,b){return K(a/b)+K(a%b)/K(b)};const xc=Symbol.for("isArrowBigNum");function yc(a,...b){return b.length===0?Object.setPrototypeOf(u(this.TypedArray,a),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(a,...b),this.constructor.prototype)}yc.prototype[xc]=!0;yc.prototype.toJSON=function(){return`"${zc(this)}"`};yc.prototype.valueOf=function(a){return Ac(this,a)};yc.prototype.toString=function(){return zc(this)};yc.prototype[Symbol.toPrimitive]=function(a="default"){switch(a){case "number":return Ac(this);case "default":return Bc(this)}return zc(this)};
function Cc(...a){return yc.apply(this,a)}function Dc(...a){return yc.apply(this,a)}function Ec(...a){return yc.apply(this,a)}Object.setPrototypeOf(Cc.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Dc.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Ec.prototype,Object.create(Uint32Array.prototype));Object.assign(Cc.prototype,yc.prototype,{constructor:Cc,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});
Object.assign(Dc.prototype,yc.prototype,{constructor:Dc,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Ec.prototype,yc.prototype,{constructor:Ec,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const Fc=BigInt(4294967296)*BigInt(4294967296)-BigInt(1);
function Ac(a,b){const {buffer:c,byteOffset:d,byteLength:e,signed:f}=a,g=new BigUint64Array(c,d,e/8);a=f&&g.at(-1)&BigInt(1)<<BigInt(63);var k=BigInt(0);let m=0;if(a){for(var p of g)k|=(p^Fc)*(BigInt(1)<<BigInt(64*m++));k*=BigInt(-1);k-=BigInt(1)}else for(var r of g)k|=r*(BigInt(1)<<BigInt(64*m++));return typeof b==="number"&&b>0?(r=BigInt("1".padEnd(b+1,"0")),p=a?-(k%r):k%r,k=K(k/r),+`${a&&k===0?"-":""}${k}.${`${p}`.padStart(b,"0")}`):K(k)}
function zc(a){if(a.byteLength===8)return`${(new a.BigIntArray(a.buffer,a.byteOffset,1))[0]}`;if(!a.signed)return Gc(a);let b=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/2);if((new Int16Array([b.at(-1)]))[0]>=0)return Gc(a);b=b.slice();a=1;for(let c=0;c<b.length;c++){const d=b[c];b[c]=~d+a;a&=d===0?1:0}return`-${Gc(b)}`}function Bc(a){return a.byteLength===8?(new a.BigIntArray(a.buffer,a.byteOffset,1))[0]:zc(a)}
function Gc(a){let b="";const c=new Uint32Array(2);a=new Uint16Array(a.buffer,a.byteOffset,a.byteLength/2);const d=new Uint32Array((a=(new Uint16Array(a)).reverse()).buffer);let e;const f=a.length-1;do{for(c[0]=a[e=0];e<f;)a[e++]=c[1]=c[0]/10,c[0]=(c[0]-c[1]*10<<16)+a[e];a[e]=c[1]=c[0]/10;c[0]-=c[1]*10;b=`${c[0]}${b}`}while(d[0]||d[1]||d[2]||d[3]);let g;return(g=b)!=null?g:"0"}
class Hc{static new(a,b){switch(b){case !0:return new Cc(a);case !1:return new Dc(a)}switch(a.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Cc(a)}return a.byteLength===16?new Ec(a):new Dc(a)}static kc(a){return new Cc(a)}constructor(a,b){return Hc.new(a,b)}}var Ic={};Ic.BN=Hc;Ic.bigNumToBigInt=Bc;Ic.bigNumToNumber=Ac;Ic.bigNumToString=zc;Ic.isArrowBigNumSymbol=xc;class L{static isNull(a){return(a==null?void 0:a.typeId)===I.Null}static isInt(a){return(a==null?void 0:a.typeId)===I.Int}static isFloat(a){return(a==null?void 0:a.typeId)===I.Float}static isBinary(a){return(a==null?void 0:a.typeId)===I.Binary}static isLargeBinary(a){return(a==null?void 0:a.typeId)===I.LargeBinary}static isUtf8(a){return(a==null?void 0:a.typeId)===I.Utf8}static isLargeUtf8(a){return(a==null?void 0:a.typeId)===I.LargeUtf8}static isBool(a){return(a==null?void 0:a.typeId)===I.Bool}static isDecimal(a){return(a==
null?void 0:a.typeId)===I.Decimal}static isDate(a){return(a==null?void 0:a.typeId)===I.Date}static isTime(a){return(a==null?void 0:a.typeId)===I.Time}static isTimestamp(a){return(a==null?void 0:a.typeId)===I.Timestamp}static isInterval(a){return(a==null?void 0:a.typeId)===I.Interval}static isDuration(a){return(a==null?void 0:a.typeId)===I.Duration}static isList(a){return(a==null?void 0:a.typeId)===I.List}static isStruct(a){return(a==null?void 0:a.typeId)===I.Struct}static isUnion(a){return(a==null?
void 0:a.typeId)===I.Union}static isFixedSizeBinary(a){return(a==null?void 0:a.typeId)===I.FixedSizeBinary}static isFixedSizeList(a){return(a==null?void 0:a.typeId)===I.FixedSizeList}static isMap(a){return(a==null?void 0:a.typeId)===I.Map}static isDictionary(a){return(a==null?void 0:a.typeId)===I.Dictionary}static isDenseUnion(a){return L.isUnion(a)&&a.mode===x.Dense}static isSparseUnion(a){return L.isUnion(a)&&a.mode===x.Sparse}constructor(a){this.typeId=a}}var Jc=Symbol.toStringTag,Kc,Lc=L.prototype;
Lc.children=null;Lc.ArrayType=Array;Lc.OffsetArrayType=Int32Array;Kc=Lc[Symbol.toStringTag]="DataType";L[Jc]=Kc;class Mc extends L{constructor(){super(I.Null)}toString(){return"Null"}}Mc[Symbol.toStringTag]=Mc.prototype[Symbol.toStringTag]="Null";
class Oc extends L{constructor(a,b){super(I.Int);this.isSigned=a;this.bitWidth=b}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 Error(`Unrecognized ${this[Symbol.toStringTag]} type`);}toString(){return`${this.isSigned?"I":"Ui"}nt${this.bitWidth}`}}var Pc=Symbol.toStringTag,Qc,Rc=Oc.prototype;
Rc.isSigned=null;Rc.bitWidth=null;Qc=Rc[Symbol.toStringTag]="Int";Oc[Pc]=Qc;class Sc extends Oc{constructor(){super(!0,8)}get ArrayType(){return Int8Array}}class Tc extends Oc{constructor(){super(!0,16)}get ArrayType(){return Int16Array}}class Uc extends Oc{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}class Vc extends Oc{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}}class Wc extends Oc{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}}
class Xc extends Oc{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}}class Yc extends Oc{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}}class Zc extends Oc{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}}Object.defineProperty(Sc.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Tc.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Uc.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Vc.prototype,"ArrayType",{value:BigInt64Array});
Object.defineProperty(Wc.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Xc.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Yc.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Zc.prototype,"ArrayType",{value:BigUint64Array});
class $c extends L{constructor(a){super(I.Float);this.precision=a}get ArrayType(){switch(this.precision){case y.HALF:return Uint16Array;case y.SINGLE:return Float32Array;case y.DOUBLE:return Float64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`);}toString(){return`Float${this.precision<<5||16}`}}var ad=Symbol.toStringTag,bd,cd=$c.prototype;cd.precision=null;bd=cd[Symbol.toStringTag]="Float";$c[ad]=bd;class dd extends $c{constructor(){super(y.HALF)}}
class ed extends $c{constructor(){super(y.SINGLE)}}class fd extends $c{constructor(){super(y.DOUBLE)}}Object.defineProperty(dd.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ed.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(fd.prototype,"ArrayType",{value:Float64Array});class gd extends L{constructor(){super(I.Binary)}toString(){return"Binary"}}var hd=Symbol.toStringTag,id,jd=gd.prototype;jd.ArrayType=Uint8Array;id=jd[Symbol.toStringTag]="Binary";gd[hd]=id;
class kd extends L{constructor(){super(I.LargeBinary)}toString(){return"LargeBinary"}}var ld=Symbol.toStringTag,md,nd=kd.prototype;nd.ArrayType=Uint8Array;nd.OffsetArrayType=BigInt64Array;md=nd[Symbol.toStringTag]="LargeBinary";kd[ld]=md;class od extends L{constructor(){super(I.Utf8)}toString(){return"Utf8"}}var pd=Symbol.toStringTag,qd,rd=od.prototype;rd.ArrayType=Uint8Array;qd=rd[Symbol.toStringTag]="Utf8";od[pd]=qd;
class sd extends L{constructor(){super(I.LargeUtf8)}toString(){return"LargeUtf8"}}var td=Symbol.toStringTag,ud,vd=sd.prototype;vd.ArrayType=Uint8Array;vd.OffsetArrayType=BigInt64Array;ud=vd[Symbol.toStringTag]="LargeUtf8";sd[td]=ud;class wd extends L{constructor(){super(I.Bool)}toString(){return"Bool"}}var xd=Symbol.toStringTag,yd,zd=wd.prototype;zd.ArrayType=Uint8Array;yd=zd[Symbol.toStringTag]="Bool";wd[xd]=yd;
class Ad extends L{constructor(a,b,c=128){super(I.Decimal);this.scale=a;this.precision=b;this.bitWidth=c}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}var Bd=Symbol.toStringTag,Cd,Dd=Ad.prototype;Dd.scale=null;Dd.precision=null;Dd.ArrayType=Uint32Array;Cd=Dd[Symbol.toStringTag]="Decimal";Ad[Bd]=Cd;
class Ed extends L{constructor(a){super(I.Date);this.unit=a}toString(){return`Date${(this.unit+1)*32}<${Ya[this.unit]}>`}get ArrayType(){return this.unit===Ya.DAY?Int32Array:BigInt64Array}}var Fd=Symbol.toStringTag,Gd,Hd=Ed.prototype;Hd.unit=null;Gd=Hd[Symbol.toStringTag]="Date";Ed[Fd]=Gd;class Id extends Ed{constructor(){super(Ya.DAY)}}class Jd extends Ed{constructor(){super(Ya.MILLISECOND)}}
class Kd extends L{constructor(a,b){super(I.Time);this.unit=a;this.bitWidth=b}toString(){return`Time${this.bitWidth}<${z[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw Error(`Unrecognized ${this[Symbol.toStringTag]} type`);}}var Ld=Symbol.toStringTag,Md,Nd=Kd.prototype;Nd.unit=null;Nd.bitWidth=null;Md=Nd[Symbol.toStringTag]="Time";Kd[Ld]=Md;class Od extends Kd{constructor(){super(z.SECOND,32)}}
class Pd extends Kd{constructor(){super(z.MILLISECOND,32)}}class Qd extends Kd{constructor(){super(z.MICROSECOND,64)}}class Rd extends Kd{constructor(){super(z.NANOSECOND,64)}}class Sd extends L{constructor(a,b){super(I.Timestamp);this.unit=a;this.timezone=b}toString(){return`Timestamp<${z[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}var Td=Symbol.toStringTag,Ud,Vd=Sd.prototype;Vd.unit=null;Vd.timezone=null;Vd.ArrayType=BigInt64Array;Ud=Vd[Symbol.toStringTag]="Timestamp";Sd[Td]=Ud;
class Wd extends Sd{constructor(a){super(z.SECOND,a)}}class Xd extends Sd{constructor(a){super(z.MILLISECOND,a)}}class Yd extends Sd{constructor(a){super(z.MICROSECOND,a)}}class Zd extends Sd{constructor(a){super(z.NANOSECOND,a)}}class $d extends L{constructor(a){super(I.Interval);this.unit=a}toString(){return`Interval<${A[this.unit]}>`}}var ae=Symbol.toStringTag,be,ce=$d.prototype;ce.unit=null;ce.ArrayType=Int32Array;be=ce[Symbol.toStringTag]="Interval";$d[ae]=be;
class de extends $d{constructor(){super(A.DAY_TIME)}}class ee extends $d{constructor(){super(A.YEAR_MONTH)}}class fe extends $d{constructor(){super(A.MONTH_DAY_NANO)}}class ge extends L{constructor(a){super(I.Duration);this.unit=a}toString(){return`Duration<${z[this.unit]}>`}}var he=Symbol.toStringTag,ie,je=ge.prototype;je.unit=null;je.ArrayType=BigInt64Array;ie=je[Symbol.toStringTag]="Duration";ge[he]=ie;class ke extends ge{constructor(){super(z.SECOND)}}
class le extends ge{constructor(){super(z.MILLISECOND)}}class me extends ge{constructor(){super(z.MICROSECOND)}}class ne extends ge{constructor(){super(z.NANOSECOND)}}class oe extends L{constructor(a){super(I.List);this.children=[a]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}}var pe=Symbol.toStringTag,qe,re=oe.prototype;re.children=null;qe=re[Symbol.toStringTag]="List";
oe[pe]=qe;class se extends L{constructor(a){super(I.Struct);this.children=a}toString(){return`Struct<{${this.children.map(a=>`${a.name}:${a.type}`).join(", ")}}>`}}var te=Symbol.toStringTag,ue,ve=se.prototype;ve.children=null;ue=ve[Symbol.toStringTag]="Struct";se[te]=ue;
class we extends L{constructor(a,b,c){super(I.Union);this.mode=a;this.children=c;this.typeIds=b=Int32Array.from(b);this.typeIdToChildIndex=b.reduce((d,e,f)=>(d[e]=f)&&d||d,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(a=>`${a.type}`).join(" | ")}>`}}var xe=Symbol.toStringTag,ye,ze=we.prototype;ze.mode=null;ze.typeIds=null;ze.children=null;ze.typeIdToChildIndex=null;ze.ArrayType=Int8Array;ye=ze[Symbol.toStringTag]="Union";we[xe]=ye;
class Ae extends we{constructor(a,b){super(x.Dense,a,b)}}class Be extends we{constructor(a,b){super(x.Sparse,a,b)}}class Ce extends L{constructor(a){super(I.FixedSizeBinary);this.byteWidth=a}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}var De=Symbol.toStringTag,Ee,Fe=Ce.prototype;Fe.byteWidth=null;Fe.ArrayType=Uint8Array;Ee=Fe[Symbol.toStringTag]="FixedSizeBinary";Ce[De]=Ee;
class Ge extends L{constructor(a,b){super(I.FixedSizeList);this.listSize=a;this.children=[b]}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}>`}}var He=Symbol.toStringTag,Ie,Je=Ge.prototype;Je.children=null;Je.listSize=null;Ie=Je[Symbol.toStringTag]="FixedSizeList";Ge[He]=Ie;
class Ke extends L{constructor(a,b=!1){super(I.Map);this.children=[a];this.keysSorted=b;if(a){a.name="entries";let c;if(a==null?0:(c=a.type)==null?0:c.children){let d;(b=a==null?void 0:(d=a.type)==null?void 0:d.children[0])&&(b.name="key");let e;(a=a==null?void 0:(e=a.type)==null?void 0:e.children[1])&&(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(a=>
`${a.name}:${a.type}`).join(", ")}}>`}}var Le=Symbol.toStringTag,Me,Ne=Ke.prototype;Ne.children=null;Ne.keysSorted=null;Me=Ne[Symbol.toStringTag]="Map_";Ke[Le]=Me;const Oe=(a=>()=>++a)(-1);
class Pe extends L{constructor(a,b,c,d){super(I.Dictionary);this.indices=b;this.dictionary=a;this.isOrdered=d||!1;this.id=c==null?Oe():K(c)}get children(){return this.dictionary.children}get valueType(){return this.dictionary}get ArrayType(){return this.dictionary.ArrayType}toString(){return`Dictionary<${this.indices}, ${this.dictionary}>`}}var Qe=Symbol.toStringTag,Re,Se=Pe.prototype;Se.id=null;Se.indices=null;Se.isOrdered=null;Se.dictionary=null;Re=Se[Symbol.toStringTag]="Dictionary";Pe[Qe]=Re;
function Te(a){switch(a.typeId){case I.Decimal:return a.bitWidth/32;case I.Interval:return a.unit===A.MONTH_DAY_NANO?4:1+a.unit;case I.FixedSizeList:return a.listSize;case I.FixedSizeBinary:return a.byteWidth;default:return 1}};class Ue{visitMany(a,...b){return a.map((c,d)=>this.visit(c,...b.map(e=>e[d])))}visit(...a){return this.getVisitFn(a[0],!1).apply(this,a)}getVisitFn(a,b=!0){return Ve(this,a,b)}getVisitFnByTypeId(a,b=!0){return We(this,a,b)}visitNull(){return null}visitBool(){return null}visitInt(){return null}visitFloat(){return null}visitUtf8(){return null}visitLargeUtf8(){return null}visitBinary(){return null}visitLargeBinary(){return null}visitFixedSizeBinary(){return null}visitDate(){return null}visitTimestamp(){return null}visitTime(){return null}visitDecimal(){return null}visitList(){return null}visitStruct(){return null}visitUnion(){return null}visitDictionary(){return null}visitInterval(){return null}visitDuration(){return null}visitFixedSizeList(){return null}visitMap(){return null}}
function Ve(a,b,c=!0){return typeof b==="number"?We(a,b,c):typeof b==="string"&&b in I?We(a,I[b],c):b&&b instanceof L?We(a,Xe(b),c):(b==null?0:b.type)&&b.type instanceof L?We(a,Xe(b.type),c):We(a,I.NONE,c)}
function We(a,b,c=!0){let d=null;switch(b){case I.Null:d=a.visitNull;break;case I.Bool:d=a.visitBool;break;case I.Int:d=a.visitInt;break;case I.Int8:d=a.visitInt8||a.visitInt;break;case I.Int16:d=a.visitInt16||a.visitInt;break;case I.Int32:d=a.visitInt32||a.visitInt;break;case I.Int64:d=a.visitInt64||a.visitInt;break;case I.Uint8:d=a.visitUint8||a.visitInt;break;case I.Uint16:d=a.visitUint16||a.visitInt;break;case I.Uint32:d=a.visitUint32||a.visitInt;break;case I.Uint64:d=a.visitUint64||a.visitInt;
break;case I.Float:d=a.visitFloat;break;case I.Float16:d=a.visitFloat16||a.visitFloat;break;case I.Float32:d=a.visitFloat32||a.visitFloat;break;case I.Float64:d=a.visitFloat64||a.visitFloat;break;case I.Utf8:d=a.visitUtf8;break;case I.LargeUtf8:d=a.visitLargeUtf8;break;case I.Binary:d=a.visitBinary;break;case I.LargeBinary:d=a.visitLargeBinary;break;case I.FixedSizeBinary:d=a.visitFixedSizeBinary;break;case I.Date:d=a.visitDate;break;case I.DateDay:d=a.visitDateDay||a.visitDate;break;case I.DateMillisecond:d=
a.visitDateMillisecond||a.visitDate;break;case I.Timestamp:d=a.visitTimestamp;break;case I.TimestampSecond:d=a.visitTimestampSecond||a.visitTimestamp;break;case I.TimestampMillisecond:d=a.visitTimestampMillisecond||a.visitTimestamp;break;case I.TimestampMicrosecond:d=a.visitTimestampMicrosecond||a.visitTimestamp;break;case I.TimestampNanosecond:d=a.visitTimestampNanosecond||a.visitTimestamp;break;case I.Time:d=a.visitTime;break;case I.TimeSecond:d=a.visitTimeSecond||a.visitTime;break;case I.TimeMillisecond:d=
a.visitTimeMillisecond||a.visitTime;break;case I.TimeMicrosecond:d=a.visitTimeMicrosecond||a.visitTime;break;case I.TimeNanosecond:d=a.visitTimeNanosecond||a.visitTime;break;case I.Decimal:d=a.visitDecimal;break;case I.List:d=a.visitList;break;case I.Struct:d=a.visitStruct;break;case I.Union:d=a.visitUnion;break;case I.DenseUnion:d=a.visitDenseUnion||a.visitUnion;break;case I.SparseUnion:d=a.visitSparseUnion||a.visitUnion;break;case I.Dictionary:d=a.visitDictionary;break;case I.Interval:d=a.visitInterval;
break;case I.IntervalDayTime:d=a.visitIntervalDayTime||a.visitInterval;break;case I.IntervalYearMonth:d=a.visitIntervalYearMonth||a.visitInterval;break;case I.IntervalMonthDayNano:d=a.visitIntervalMonthDayNano||a.visitInterval;break;case I.Duration:d=a.visitDuration;break;case I.DurationSecond:d=a.visitDurationSecond||a.visitDuration;break;case I.DurationMillisecond:d=a.visitDurationMillisecond||a.visitDuration;break;case I.DurationMicrosecond:d=a.visitDurationMicrosecond||a.visitDuration;break;case I.DurationNanosecond:d=
a.visitDurationNanosecond||a.visitDuration;break;case I.FixedSizeList:d=a.visitFixedSizeList;break;case I.Map:d=a.visitMap}if(typeof d==="function")return d;if(!c)return()=>null;throw Error(`Unrecognized type '${I[b]}'`);}
function Xe(a){switch(a.typeId){case I.Null:return I.Null;case I.Int:const b=a.isSigned;switch(a.bitWidth){case 8:return b?I.Int8:I.Uint8;case 16:return b?I.Int16:I.Uint16;case 32:return b?I.Int32:I.Uint32;case 64:return b?I.Int64:I.Uint64}return I.Int;case I.Float:switch(a.precision){case y.HALF:return I.Float16;case y.SINGLE:return I.Float32;case y.DOUBLE:return I.Float64}return I.Float;case I.Binary:return I.Binary;case I.LargeBinary:return I.LargeBinary;case I.Utf8:return I.Utf8;case I.LargeUtf8:return I.LargeUtf8;
case I.Bool:return I.Bool;case I.Decimal:return I.Decimal;case I.Time:switch(a.unit){case z.SECOND:return I.TimeSecond;case z.MILLISECOND:return I.TimeMillisecond;case z.MICROSECOND:return I.TimeMicrosecond;case z.NANOSECOND:return I.TimeNanosecond}return I.Time;case I.Timestamp:switch(a.unit){case z.SECOND:return I.TimestampSecond;case z.MILLISECOND:return I.TimestampMillisecond;case z.MICROSECOND:return I.TimestampMicrosecond;case z.NANOSECOND:return I.TimestampNanosecond}return I.Timestamp;case I.Date:switch(a.unit){case Ya.DAY:return I.DateDay;
case Ya.MILLISECOND:return I.DateMillisecond}return I.Date;case I.Interval:switch(a.unit){case A.DAY_TIME:return I.IntervalDayTime;case A.YEAR_MONTH:return I.IntervalYearMonth;case A.MONTH_DAY_NANO:return I.IntervalMonthDayNano}return I.Interval;case I.Duration:switch(a.unit){case z.SECOND:return I.DurationSecond;case z.MILLISECOND:return I.DurationMillisecond;case z.MICROSECOND:return I.DurationMicrosecond;case z.NANOSECOND:return I.DurationNanosecond}return I.Duration;case I.Map:return I.Map;case I.List:return I.List;
case I.Struct:return I.Struct;case I.Union:switch(a.mode){case x.Dense:return I.DenseUnion;case x.Sparse:return I.SparseUnion}return I.Union;case I.FixedSizeBinary:return I.FixedSizeBinary;case I.FixedSizeList:return I.FixedSizeList;case I.Dictionary:return I.Dictionary}throw Error(`Unrecognized type '${I[a.typeId]}'`);}h=Ue.prototype;h.visitInt8=null;h.visitInt16=null;h.visitInt32=null;h.visitInt64=null;h.visitUint8=null;h.visitUint16=null;h.visitUint32=null;h.visitUint64=null;h.visitFloat16=null;
h.visitFloat32=null;h.visitFloat64=null;h.visitDateDay=null;h.visitDateMillisecond=null;h.visitTimestampSecond=null;h.visitTimestampMillisecond=null;h.visitTimestampMicrosecond=null;h.visitTimestampNanosecond=null;h.visitTimeSecond=null;h.visitTimeMillisecond=null;h.visitTimeMicrosecond=null;h.visitTimeNanosecond=null;h.visitDenseUnion=null;h.visitSparseUnion=null;h.visitIntervalDayTime=null;h.visitIntervalYearMonth=null;h.visitIntervalMonthDayNano=null;h.visitDuration=null;
h.visitDurationSecond=null;h.visitDurationMillisecond=null;h.visitDurationMicrosecond=null;h.visitDurationNanosecond=null;const Ye=new Float64Array(1),Ze=new Uint32Array(Ye.buffer);function $e(a){const b=(a&31744)>>10,c=(a&1023)/1024;a=Math.pow(-1,(a&32768)>>15);switch(b){case 31:return a*(c?Number.NaN:1/0);case 0:return a*(c?6.103515625E-5*c:0)}return a*Math.pow(2,b-15)*(1+c)}
function af(a){if(a!==a)return 32256;Ye[0]=a;a=(Ze[1]&2147483648)>>16&65535;let b=Ze[1]&2146435072,c=0;b>=1089470464?Ze[0]>0?b=31744:(b=(b&2080374784)>>16,c=(Ze[1]&1048575)>>10):b<=1056964608?(c=1048576+(Ze[1]&1048575),c=1048576+(c<<(b>>20)-998)>>21,b=0):(b=b-1056964608>>10,c=(Ze[1]&1048575)+512>>10);return a|b|c&65535}var bf={};bf.float64ToUint16=af;bf.uint16ToFloat64=$e;class cf extends Ue{}function M(a){return(b,c,d)=>{if(b.setValid(c,d!=null))return a(b,c,d)}}
const df=(a,b,c,d)=>{if(c+1<b.length){const e=K(b[c]);b=K(b[c+1]);a.set(d.subarray(0,b-e),e)}},ef=({values:a},b,c)=>{a[b]=c},ff=({values:a},b,c)=>{a[b]=c},gf=({values:a},b,c)=>{a[b]=af(c)},hf=({values:a},b,c)=>{a[b]=