@loaders.gl/arrow 4.2.0-alpha.5 → 4.2.0-alpha.6

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/dist.min.js CHANGED
@@ -4,20 +4,20 @@
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 af=Object.create;var qi=Object.defineProperty;var cf=Object.getOwnPropertyDescriptor;var lf=Object.getOwnPropertyNames;var uf=Object.getPrototypeOf,ff=Object.prototype.hasOwnProperty;var hf=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Sr=(r,t)=>{for(var e in t)qi(r,e,{get:t[e],enumerable:!0})},Qi=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of lf(t))!ff.call(r,i)&&i!==e&&qi(r,i,{get:()=>t[i],enumerable:!(n=cf(t,i))||n.enumerable});return r},ts=(r,t,e)=>(Qi(r,t,"default"),e&&Qi(e,t,"default")),df=(r,t,e)=>(e=r!=null?af(uf(r)):{},Qi(t||!r||!r.__esModule?qi(e,"default",{value:r,enumerable:!0}):e,r)),pf=r=>Qi(qi({},"__esModule",{value:!0}),r);var gc=hf((wm,yc)=>{yc.exports=globalThis.loaders});var Xi={};Sr(Xi,{ArrowLoader:()=>Au,ArrowWorkerLoader:()=>$n,ArrowWriter:()=>Tu,GeoArrowLoader:()=>Cu,GeoArrowWorkerLoader:()=>Ru,TriangulationWorker:()=>Ho,VECTOR_TYPES:()=>dn,convertArrowToGeoJSONTable:()=>Po,deserializeArrowField:()=>mn,deserializeArrowMetadata:()=>Mo,deserializeArrowSchema:()=>Bu,deserializeArrowType:()=>Ka,getArrowType:()=>Su,getBinaryGeometriesFromArrow:()=>Pu,getBinaryGeometryTemplate:()=>Yi,getMeanCentersFromBinaryGeometries:()=>rc,getTriangleIndices:()=>nc,hardClone:()=>Ki,parseGeoArrowOnWorker:()=>of,parseGeometryFromArrow:()=>ko,serializeArrowField:()=>pn,serializeArrowMetadata:()=>Fo,serializeArrowSchema:()=>Gn,serializeArrowType:()=>Ya,triangulateOnWorker:()=>sf,updateBoundsFromGeoArrowSamples:()=>Vo});ts(Xi,df(gc(),1));var es=class{constructor(t,e){if(this.length=0,this.rows=null,this.cursor=0,this._headers=[],this.options=e,this.schema=t,!Array.isArray(t)){this._headers=[];for(let n in t)this._headers[t[n].index]=t[n].name}}rowCount(){return this.length}addArrayRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.shape="array-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}addObjectRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.shape="object-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}getBatch(){let t=this.rows;return t?(t=t.slice(0,this.length),this.rows=null,{shape:this.shape||"array-row-table",batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}):null}};function bc(r,t){if(!r)throw new Error("null row");let e={};if(t)for(let n=0;n<t.length;n++)e[t[n]]=r[n];else for(let n=0;n<r.length;n++){let i=`column-${n}`;e[i]=r[n]}return e}function wc(r,t){if(!r)throw new Error("null row");if(t){let e=new Array(t.length);for(let n=0;n<t.length;n++)e[n]=r[t[n]];return e}return Object.values(r)}function _c(r){let t=[];for(let e=0;e<r.length;e++){let n=`column-${e}`;t.push(n)}return t}function vc(r){return Object.keys(r)}var Ic=100,rs=class{constructor(t,e){if(this.length=0,this.objectRows=null,this.arrayRows=null,this.cursor=0,this._headers=null,this.options=e,this.schema=t,t){this._headers=[];for(let n in t)this._headers[t[n].index]=t[n].name}}rowCount(){return this.length}addArrayRow(t,e){switch(Number.isFinite(e)&&(this.cursor=e),this._headers||(this._headers=_c(t)),this.options.shape){case"object-row-table":let n=bc(t,this._headers);this.addObjectRow(n,e);break;case"array-row-table":this.arrayRows=this.arrayRows||new Array(Ic),this.arrayRows[this.length]=t,this.length++;break}}addObjectRow(t,e){switch(Number.isFinite(e)&&(this.cursor=e),this._headers||(this._headers=vc(t)),this.options.shape){case"array-row-table":let n=wc(t,this._headers);this.addArrayRow(n,e);break;case"object-row-table":this.objectRows=this.objectRows||new Array(Ic),this.objectRows[this.length]=t,this.length++;break}}getBatch(){let t=this.arrayRows||this.objectRows;return t?(t=t.slice(0,this.length),this.arrayRows=null,this.objectRows=null,{shape:this.options.shape,batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}):null}};var Cr=class{constructor(t,e){this.length=0,this.allocated=0,this.columns={},this.schema=t,this._reallocateColumns()}rowCount(){return this.length}addArrayRow(t){this._reallocateColumns();let e=0;for(let n in this.columns)this.columns[n][this.length]=t[e++];this.length++}addObjectRow(t){this._reallocateColumns();for(let e in t)this.columns[e][this.length]=t[e];this.length++}getBatch(){this._pruneColumns();let t=Array.isArray(this.schema)?this.columns:{};if(!Array.isArray(this.schema))for(let n in this.schema){let i=this.schema[n];t[i.name]=this.columns[i.index]}return this.columns={},{shape:"columnar-table",batchType:"data",data:t,schema:this.schema,length:this.length}}_reallocateColumns(){if(!(this.length<this.allocated)){this.allocated=this.allocated>0?this.allocated*=2:100,this.columns={};for(let t in this.schema){let e=this.schema[t],n=e.type||Float32Array,i=this.columns[e.index];if(i&&ArrayBuffer.isView(i)){let s=new n(this.allocated);s.set(i),this.columns[e.index]=s}else i?(i.length=this.allocated,this.columns[e.index]=i):this.columns[e.index]=new n(this.allocated)}}}_pruneColumns(){for(let[t,e]of Object.entries(this.columns))this.columns[t]=e.slice(0,this.length)}};var mf={shape:void 0,batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0},yf="TableBatchBuilder",Br=class{constructor(t,e){this.aggregator=null,this.batchCount=0,this.bytesUsed=0,this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),this.totalLength=0,this.totalBytes=0,this.rowBytes=0,this.schema=t,this.options={...mf,...e}}limitReached(){return!!(Boolean(this.options?.limit)&&this.totalLength>=this.options.limit||Boolean(this.options?._limitMB)&&this.totalBytes/1e6>=this.options._limitMB)}addRow(t){this.limitReached()||(this.totalLength++,this.rowBytes=this.rowBytes||this._estimateRowMB(t),this.totalBytes+=this.rowBytes,Array.isArray(t)?this.addArrayRow(t):this.addObjectRow(t))}addArrayRow(t){if(!this.aggregator){let e=this._getTableBatchType();this.aggregator=new e(this.schema,this.options)}this.aggregator.addArrayRow(t)}addObjectRow(t){if(!this.aggregator){let e=this._getTableBatchType();this.aggregator=new e(this.schema,this.options)}this.aggregator.addObjectRow(t)}chunkComplete(t){t instanceof ArrayBuffer&&(this.bytesUsed+=t.byteLength),typeof t=="string"&&(this.bytesUsed+=t.length),this.isChunkComplete=!0}getFullBatch(t){return this._isFull()?this._getBatch(t):null}getFinalBatch(t){return this._getBatch(t)}_estimateRowMB(t){return Array.isArray(t)?t.length*8:Object.keys(t).length*8}_isFull(){if(!this.aggregator||this.aggregator.rowCount()===0)return!1;if(this.options.batchSize==="auto"){if(!this.isChunkComplete)return!1}else if(this.options.batchSize>this.aggregator.rowCount())return!1;return this.options.batchDebounceMs>Date.now()-this.lastBatchEmittedMs?!1:(this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),!0)}_getBatch(t){if(!this.aggregator)return null;t?.bytesUsed&&(this.bytesUsed=t.bytesUsed);let e=this.aggregator.getBatch();return e.count=this.batchCount,e.bytesUsed=this.bytesUsed,Object.assign(e,t),this.batchCount++,this.aggregator=null,e}_getTableBatchType(){switch(this.options.shape){case"array-row-table":case"object-row-table":return rs;case"columnar-table":return Cr;case"arrow-table":if(!Br.ArrowBatch)throw new Error(yf);return Br.ArrowBatch;default:return es}}};function ns(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 xc(r,t,e){switch(r.shape){case"array-row-table":let n=gf(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 s=r.data,o=s.schema.fields.findIndex(a=>a.name===e);return s.getChildAt(o)?.get(t);default:throw new Error("todo")}}function gf(r,t){let e=r.schema?.fields.findIndex(n=>n.name===t);if(e===void 0)throw new Error(t);return e}function Sc(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,u]of Object.entries(r.data))c[l]=u[t];return c}case"arrow-table":let i=r.data,s=e||{},o=i.get(t),a=i.schema;for(let c=0;c<a.fields.length;c++)s[a.fields[c].name]=o?.[a.fields[c].name];return s;default:throw new Error("shape")}}function Bc(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 u of Object.values(r.data))c[l]=u[t],l++;return c}case"arrow-table":let i=r.data,s=e||[],o=i.get(t),a=i.schema;for(let c=0;c<a.fields.length;c++)s[c]=o?.[a.fields[c].name];return s;default:throw new Error("shape")}}function is(r,t="float32"){return r instanceof Date?"date-millisecond":r instanceof Number?t:typeof r=="string"?"utf8":(r===null||r==="undefined","null")}function Ac(r){let t=bf(r);return t!=="null"?{type:t,nullable:!1}:r.length>0?(t=is(r[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function bf(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 Tc(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 Dc(r){switch(r.shape){case"array-row-table":case"object-row-table":return _f(r.data);case"columnar-table":return wf(r.data);case"arrow-table":default:throw new Error("Deduce schema")}}function wf(r){let t=[];for(let[e,n]of Object.entries(r)){let i=vf(n,e);t.push(i)}return{fields:t,metadata:{}}}function _f(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(If(i,n));return{fields:t,metadata:{}}}function vf(r,t){if(ArrayBuffer.isView(r)){let e=Ac(r);return{name:t,type:e.type||"null",nullable:e.nullable}}if(Array.isArray(r)&&r.length>0){let e=r[0],n=is(e);return{name:t,type:n,nullable:!0}}throw new Error("empty table")}function If(r,t){let e=is(r);return{name:t,type:e,nullable:!0}}function Oc(r,t){let e=Tc(r.type,r.nullable);return new e(t)}function ss(r,t){switch(t){case"object-row-table":return Af(r);case"array-row-table":return Bf(r);case"columnar-table":return Sf(r);case"arrow-table":return xf(r);default:throw new Error(t)}}function xf(r){let t=globalThis.__loaders?._makeArrowTable;if(!t)throw new Error("");return t(r)}function Sf(r){let t=r.schema||Dc(r),e=r.schema?.fields||[];if(r.shape==="columnar-table")return{...r,schema:t};let n=ns(r),i={};for(let s of e){let o=Oc(s,n);i[s.name]=o;for(let a=0;a<n;a++)o[a]=xc(r,a,s.name)}return{shape:"columnar-table",schema:t,data:i}}function Bf(r){if(r.shape==="array-row-table")return r;let t=ns(r),e=new Array(t);for(let n=0;n<t;n++)e[n]=Bc(r,n);return{shape:"array-row-table",schema:r.schema,data:e}}function Af(r){if(r.shape==="object-row-table")return r;let t=ns(r),e=new Array(t);for(let n=0;n<t;n++)e[n]=Sc(r,n);return{shape:"object-row-table",schema:r.schema,data:e}}function Mc(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 y(r,t,e,n){function i(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(u){try{l(n.next(u))}catch(h){o(h)}}function c(u){try{l(n.throw(u))}catch(h){o(h)}}function l(u){u.done?s(u.value):i(u.value).then(a,c)}l((n=n.apply(r,t||[])).next())})}function Fc(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 U(r){return this instanceof U?(this.v=r,this):new U(r)}function oe(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(d){n[d]&&(i[d]=function(b){return new Promise(function(M,z){s.push([d,b,M,z])>1||a(d,b)})})}function a(d,b){try{c(n[d](b))}catch(M){h(s[0][3],M)}}function c(d){d.value instanceof U?Promise.resolve(d.value.v).then(l,u):h(s[0][2],d)}function l(d){a("next",d)}function u(d){a("throw",d)}function h(d,b){d(b),s.shift(),s.length&&a(s[0][0],s[0][1])}}function bn(r){var t,e;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,s){t[i]=r[i]?function(o){return(e=!e)?{value:U(r[i](o)),done:!1}:s?s(o):o}:s}}function Te(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 Fc=="function"?Fc(r):r[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(s){e[s]=r[s]&&function(o){return new Promise(function(a,c){o=r[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(l){s({value:l,done:a})},o)}}var Qo={};Sr(Qo,{compareArrayLike:()=>Xo,joinUint8Arrays:()=>ce,memcpy:()=>Qn,rebaseValueOffsets:()=>ds,toArrayBufferView:()=>C,toArrayBufferViewAsyncIterator:()=>Oe,toArrayBufferViewIterator:()=>Ve,toBigInt64Array:()=>hs,toBigUint64Array:()=>Ef,toFloat32Array:()=>Rf,toFloat32ArrayAsyncIterator:()=>Qf,toFloat32ArrayIterator:()=>Gf,toFloat64Array:()=>Cf,toFloat64ArrayAsyncIterator:()=>qf,toFloat64ArrayIterator:()=>$f,toInt16Array:()=>Lf,toInt16ArrayAsyncIterator:()=>Kf,toInt16ArrayIterator:()=>Vf,toInt32Array:()=>Pr,toInt32ArrayAsyncIterator:()=>Zf,toInt32ArrayIterator:()=>jf,toInt8Array:()=>Mf,toInt8ArrayAsyncIterator:()=>Yf,toInt8ArrayIterator:()=>kf,toUint16Array:()=>Nf,toUint16ArrayAsyncIterator:()=>Jf,toUint16ArrayIterator:()=>zf,toUint32Array:()=>Uf,toUint32ArrayAsyncIterator:()=>Xf,toUint32ArrayIterator:()=>Wf,toUint8Array:()=>T,toUint8ArrayAsyncIterator:()=>Jo,toUint8ArrayIterator:()=>Zo,toUint8ClampedArray:()=>Pf,toUint8ClampedArrayAsyncIterator:()=>th,toUint8ClampedArrayIterator:()=>Hf});var Tf=new TextDecoder("utf-8"),Jn=r=>Tf.decode(r),Df=new TextEncoder,ke=r=>Df.encode(r);var Of=r=>typeof r=="number",Lc=r=>typeof r=="boolean",wt=r=>typeof r=="function",Rt=r=>r!=null&&Object(r)===r,ae=r=>Rt(r)&&wt(r.then);var De=r=>Rt(r)&&wt(r[Symbol.iterator]),de=r=>Rt(r)&&wt(r[Symbol.asyncIterator]),os=r=>Rt(r)&&Rt(r.schema);var as=r=>Rt(r)&&"done"in r&&"value"in r;var cs=r=>Rt(r)&&wt(r.stat)&&Of(r.fd);var ls=r=>Rt(r)&&Xn(r.body),us=r=>"_getDOMStream"in r&&"_getNodeStream"in r,Nc=r=>Rt(r)&&wt(r.abort)&&wt(r.getWriter)&&!us(r),Xn=r=>Rt(r)&&wt(r.cancel)&&wt(r.getReader)&&!us(r),Uc=r=>Rt(r)&&wt(r.end)&&wt(r.write)&&Lc(r.writable)&&!us(r),fs=r=>Rt(r)&&wt(r.read)&&wt(r.pipe)&&Lc(r.readable)&&!us(r),Ec=r=>Rt(r)&&wt(r.clear)&&wt(r.bytes)&&wt(r.position)&&wt(r.setPosition)&&wt(r.capacity)&&wt(r.getBufferIdentifier)&&wt(r.createLong);var Ko=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Ff(r){let t=r[0]?[r[0]]:[],e,n,i,s;for(let o,a,c=0,l=0,u=r.length;++c<u;){if(o=t[l],a=r[c],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:e,byteLength:i}=o,{byteOffset:n,byteLength:s}=a,e+i<n||n+s<e){a&&(t[++l]=a);continue}t[l]=new Uint8Array(o.buffer,e,n-e+s)}return t}function Qn(r,t,e=0,n=t.byteLength){let i=r.byteLength,s=new Uint8Array(r.buffer,r.byteOffset,i),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return s.set(o,e),r}function ce(r,t){let e=Ff(r),n=e.reduce((u,h)=>u+h.byteLength,0),i,s,o,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let u=e.length;++c<u;){if(i=e[c],s=i.subarray(0,Math.min(i.length,l-a)),l<=a+s.length){s.length<i.length?e[c]=i.subarray(s.length):s.length===i.length&&c++,o?Qn(o,s,a):o=s;break}Qn(o||(o=new Uint8Array(l)),s,a),a+=s.length}return[o||new Uint8Array(0),e.slice(c),n-(o?o.byteLength:0)]}function C(r,t){let e=as(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=ke(e)),e instanceof ArrayBuffer?new r(e):e instanceof Ko?new r(e):Ec(e)?C(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 Mf=r=>C(Int8Array,r),Lf=r=>C(Int16Array,r),Pr=r=>C(Int32Array,r),hs=r=>C(BigInt64Array,r),T=r=>C(Uint8Array,r),Nf=r=>C(Uint16Array,r),Uf=r=>C(Uint32Array,r),Ef=r=>C(BigUint64Array,r),Rf=r=>C(Float32Array,r),Cf=r=>C(Float64Array,r),Pf=r=>C(Uint8ClampedArray,r),Yo=r=>(r.next(),r);function*Ve(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Ko?e(t):De(t)?t:e(t);return yield*Yo(function*(i){let s=null;do s=i.next(yield C(r,s));while(!s.done)}(n[Symbol.iterator]())),new r}var kf=r=>Ve(Int8Array,r),Vf=r=>Ve(Int16Array,r),jf=r=>Ve(Int32Array,r),Zo=r=>Ve(Uint8Array,r),zf=r=>Ve(Uint16Array,r),Wf=r=>Ve(Uint32Array,r),Gf=r=>Ve(Float32Array,r),$f=r=>Ve(Float64Array,r),Hf=r=>Ve(Uint8ClampedArray,r);function Oe(r,t){return oe(this,arguments,function*(){if(ae(t))return yield U(yield U(yield*bn(Te(Oe(r,yield U(t))))));let n=function(o){return oe(this,arguments,function*(){yield yield U(yield U(o))})},i=function(o){return oe(this,arguments,function*(){yield U(yield*bn(Te(Yo(function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)}(o[Symbol.iterator]())))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Ko?n(t):De(t)?i(t):de(t)?t:n(t);return yield U(yield*bn(Te(Yo(function(o){return oe(this,arguments,function*(){let a=null;do a=yield U(o.next(yield yield U(C(r,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield U(new r)})}var Yf=r=>Oe(Int8Array,r),Kf=r=>Oe(Int16Array,r),Zf=r=>Oe(Int32Array,r),Jo=r=>Oe(Uint8Array,r),Jf=r=>Oe(Uint16Array,r),Xf=r=>Oe(Uint32Array,r),Qf=r=>Oe(Float32Array,r),qf=r=>Oe(Float64Array,r),th=r=>Oe(Uint8ClampedArray,r);function ds(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 Xo(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 ps(eh(r))},fromAsyncIterable(r){return ps(rh(r))},fromDOMStream(r){return ps(nh(r))},fromNodeStream(r){return ps(ih(r))},toDOMStream(r,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(r,t){throw new Error('"toNodeStream" not available in this environment')}},ps=r=>(r.next(),r);function*eh(r){let t,e=!1,n=[],i,s,o,a=0;function c(){return s==="peek"?ce(n,o)[0]:([i,n,a]=ce(n,o),i)}({cmd:s,size:o}=(yield(()=>null)())||{cmd:"read",size:0});let l=Zo(r)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-a)?l.next():l.next(o-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield c());while(o<a);while(!t)}catch(u){(e=!0)&&typeof l.throw=="function"&&l.throw(u)}finally{e===!1&&typeof l.return=="function"&&l.return(null)}return null}function rh(r){return oe(this,arguments,function*(){let e,n=!1,i=[],s,o,a,c=0;function l(){return o==="peek"?ce(i,a)[0]:([s,i,c]=ce(i,a),s)}({cmd:o,size:a}=(yield yield U((()=>null)()))||{cmd:"read",size:0});let u=Jo(r)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(a-c)?yield U(u.next()):yield U(u.next(a-c)),!e&&s.byteLength>0&&(i.push(s),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield U(l()));while(a<c);while(!e)}catch(h){(n=!0)&&typeof u.throw=="function"&&(yield U(u.throw(h)))}finally{n===!1&&typeof u.return=="function"&&(yield U(u.return(new Uint8Array(0))))}return yield U(null)})}function nh(r){return oe(this,arguments,function*(){let e=!1,n=!1,i=[],s,o,a,c=0;function l(){return o==="peek"?ce(i,a)[0]:([s,i,c]=ce(i,a),s)}({cmd:o,size:a}=(yield yield U((()=>null)()))||{cmd:"read",size:0});let u=new ta(r);try{do if({done:e,value:s}=Number.isNaN(a-c)?yield U(u.read()):yield U(u.read(a-c)),!e&&s.byteLength>0&&(i.push(T(s)),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield U(l()));while(a<c);while(!e)}catch(h){(n=!0)&&(yield U(u.cancel(h)))}finally{n===!1?yield U(u.cancel()):r.locked&&u.releaseLock()}return yield U(null)})}var ta=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 y(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 y(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=T(e)),e})}},qo=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function ih(r){return oe(this,arguments,function*(){let e=[],n="error",i=!1,s=null,o,a,c=0,l=[],u;function h(){return o==="peek"?ce(l,a)[0]:([u,l,c]=ce(l,a),u)}if({cmd:o,size:a}=(yield yield U((()=>null)()))||{cmd:"read",size:0},r.isTTY)return yield yield U(new Uint8Array(0)),yield U(null);try{e[0]=qo(r,"end"),e[1]=qo(r,"error");do{if(e[2]=qo(r,"readable"),[n,s]=yield U(Promise.race(e.map(b=>b[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(u=T(r.read(a-c)),u.byteLength<a-c&&(u=T(r.read()))):u=T(r.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:o,size:a}=yield yield U(h()));while(a<c)}while(!i)}finally{yield U(d(e,n==="error"?s:null))}return yield U(null);function d(b,M){return u=l=null,new Promise((z,X)=>{for(let[st,gn]of b)r.off(st,gn);try{let st=r.destroy;st&&st.call(r,M),M=void 0}catch(st){M=st||M}finally{M!=null?X(M):z()}})}})}var $;(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"})($||($={}));var K;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(K||(K={}));var j;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(j||(j={}));var et;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(et||(et={}));var p;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(p||(p={}));var nt;(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"})(nt||(nt={}));var je=new Int32Array(2),ms=new Float32Array(je.buffer),ys=new Float64Array(je.buffer),wn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var qn;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(qn||(qn={}));var Ct=class{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new Ct(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 je[0]=this.readInt32(t),ms[0]}readFloat64(t){return je[wn?0:1]=this.readInt32(t),je[wn?1:0]=this.readInt32(t+4),ys[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){ms[0]=e,this.writeInt32(t,je[0])}writeFloat64(t,e){ys[0]=e,this.writeInt32(t,je[wn?0:1]),this.writeInt32(t+4,je[wn?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===qn.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0}createScalarList(t,e){let n=[];for(let i=0;i<e;++i){let s=t(i);s!==null&&n.push(s)}return n}createObjList(t,e){let n=[];for(let i=0;i<e;++i){let s=t(i);s!==null&&n.push(s.unpack())}return n}};var cr=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=Ct.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=cr.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=Ct.allocate(n);return i.setPosition(n-e),i.bytes().set(t.bytes(),n-e),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);let n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);let i=2;this.addInt16(t-this.object_start);let s=(n+i)*2;this.addInt16(s);let o=0,a=this.space;t:for(e=0;e<this.vtables.length;e++){let c=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(c)){for(let l=2;l<s;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;o=this.vtables[e];break}}return o?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,o-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,n){let i=n?4:0;if(e){let s=e;if(this.prep(this.minalign,4+4+i),s.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let o=4-1;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(e<this.bb.readInt16(i)&&this.bb.readInt16(i+e)!=0))throw new TypeError("FlatBuffers: field "+e+" must be set")}startVector(t,e,n){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(n,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(t==null)return 0;let e;t instanceof Uint8Array?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);for(let n=0,i=this.space,s=this.bb.bytes();n<e.length;n++)s[i++]=e[n];return this.endVector()}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let e=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)e.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var ti;(function(r){r[r.BUFFER=0]="BUFFER"})(ti||(ti={}));var ei;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(ei||(ei={}));var Me=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 Me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new Me).__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):ei.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):ti.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,ei.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,ti.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return Me.startBodyCompression(t),Me.addCodec(t,e),Me.addMethod(t,n),Me.endBodyCompression(t)}};var _n=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 vn=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 Ft=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 Ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new Ft).__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 vn).__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 _n).__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 Me).__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 me=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 me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new me).__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 Ft).__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 Ar;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(Ar||(Ar={}));var ri;(function(r){r[r.DenseArray=0]="DenseArray"})(ri||(ri={}));var _t=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 _t).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new _t).__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 _t.startInt(t),_t.addBitWidth(t,e),_t.addIsSigned(t,n),_t.endInt(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 getRootAsDictionaryEncoding(t,e){return(e||new le).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new le).__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 _t).__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):ri.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,ri.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var Q=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 Q).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new Q).__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 Q.startKeyValue(t),Q.addKey(t,e),Q.addValue(t,n),Q.endKeyValue(t)}};var ze=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 ze).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new ze).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return ze.startBinary(t),ze.endBinary(t)}};var We=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 We).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new We).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return We.startBool(t),We.endBool(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 getRootAsDate(t,e){return(e||new Gt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new Gt).__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):et.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,et.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return Gt.startDate(t),Gt.addUnit(t,e),Gt.endDate(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 getRootAsDecimal(t,e){return(e||new vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new vt).__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 vt.startDecimal(t),vt.addPrecision(t,e),vt.addScale(t,n),vt.addBitWidth(t,i),vt.endDecimal(t)}};var $t=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 $t).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+4),(e||new $t).__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):p.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,p.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return $t.startDuration(t),$t.addUnit(t,e),$t.endDuration(t)}};var Ht=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 Ht).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new Ht).__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 Ht.startFixedSizeBinary(t),Ht.addByteWidth(t,e),Ht.endFixedSizeBinary(t)}};var Yt=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 Yt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new Yt).__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 Yt.startFixedSizeList(t),Yt.addListSize(t,e),Yt.endFixedSizeList(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 getRootAsFloatingPoint(t,e){return(e||new Kt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new Kt).__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):j.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,j.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return Kt.startFloatingPoint(t),Kt.addPrecision(t,e),Kt.endFloatingPoint(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 getRootAsInterval(t,e){return(e||new Zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new Zt).__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):nt.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,nt.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return Zt.startInterval(t),Zt.addUnit(t,e),Zt.endInterval(t)}};var Ge=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 Ge).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+4),(e||new Ge).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return Ge.startLargeBinary(t),Ge.endLargeBinary(t)}};var $e=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 $e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+4),(e||new $e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return $e.startLargeUtf8(t),$e.endLargeUtf8(t)}};var He=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 He).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new He).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return He.startList(t),He.endList(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 getRootAsMap(t,e){return(e||new Jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new Jt).__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 Jt.startMap(t),Jt.addKeysSorted(t,e),Jt.endMap(t)}};var Ye=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 Ye).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new Ye).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return Ye.startNull(t),Ye.endNull(t)}};var Ke=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 Ke).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new Ke).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return Ke.startStruct_(t),Ke.endStruct_(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 getRootAsTime(t,e){return(e||new Mt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new Mt).__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):p.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,p.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return Mt.startTime(t),Mt.addUnit(t,e),Mt.addBitWidth(t,n),Mt.endTime(t)}};var Lt=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 Lt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new Lt).__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):p.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,p.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return Lt.startTimestamp(t),Lt.addUnit(t,e),Lt.addTimezone(t,n),Lt.endTimestamp(t)}};var It=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 It).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new It).__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):K.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,K.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 It.startUnion(t),It.addMode(t,e),It.addTypeIds(t,n),It.endUnion(t)}};var Ze=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 Ze).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new Ze).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return Ze.startUtf8(t),Ze.endUtf8(t)}};var Z;(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"})(Z||(Z={}));var dt=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 dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new dt).__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):Z.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 le).__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 dt).__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 Q).__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,Z.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 ot=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 ot).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new ot).__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):Ar.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new dt).__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 Q).__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,Ar.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,n,i,s){return ot.startSchema(t),ot.addEndianness(t,e),ot.addFields(t,n),ot.addCustomMetadata(t,i),ot.addFeatures(t,s),ot.endSchema(t)}};var P;(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"})(P||(P={}));var f;(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"})(f||(f={}));var lt;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(lt||(lt={}));var wa={};Sr(wa,{clampIndex:()=>$h,clampRange:()=>si,createElementComparator:()=>Fr});var ea={};Sr(ea,{valueToString:()=>Le});function Le(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=>Le(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}var na={};Sr(na,{BN:()=>kr,bigNumToBigInt:()=>Pc,bigNumToString:()=>Sn,isArrowBigNumSymbol:()=>Rc});var Rc=Symbol.for("isArrowBigNum");function Ne(r,...t){return t.length===0?Object.setPrototypeOf(C(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}Ne.prototype[Rc]=!0;Ne.prototype.toJSON=function(){return`"${Sn(this)}"`};Ne.prototype.valueOf=function(){return Cc(this)};Ne.prototype.toString=function(){return Sn(this)};Ne.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Cc(this);case"string":return Sn(this);case"default":return Pc(this)}return Sn(this)};function In(...r){return Ne.apply(this,r)}function xn(...r){return Ne.apply(this,r)}function ni(...r){return Ne.apply(this,r)}Object.setPrototypeOf(In.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(xn.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(ni.prototype,Object.create(Uint32Array.prototype));Object.assign(In.prototype,Ne.prototype,{constructor:In,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(xn.prototype,Ne.prototype,{constructor:xn,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(ni.prototype,Ne.prototype,{constructor:ni,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function Cc(r){let{buffer:t,byteOffset:e,length:n,signed:i}=r,s=new BigUint64Array(t,e,n),o=i&&s.at(-1)&BigInt(1)<<BigInt(63),a=BigInt(o?1:0),c=BigInt(0);if(o){for(let l of s)a+=~l*(BigInt(1)<<BigInt(32)*c++);a*=BigInt(-1)}else for(let l of s)a+=l*(BigInt(1)<<BigInt(32)*c++);return a}var Sn=r=>{if(r.byteLength===8)return`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`;if(!r.signed)return ra(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return ra(r);t=t.slice();let n=1;for(let s=0;s<t.length;s++){let o=t[s],a=~o+n;t[s]=a,n&=o===0?1:0}return`-${ra(t)}`},Pc=r=>r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:Sn(r);function ra(r){let t="",e=new Uint32Array(2),n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),s=-1,o=n.length-1;do{for(e[0]=n[s=0];s<o;)n[s++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+n[s];n[s]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t=`${e[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var kr=class{static new(t,e){switch(e){case!0:return new In(t);case!1:return new xn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new In(t)}return t.byteLength===16?new ni(t):new xn(t)}static signed(t){return new In(t)}static unsigned(t){return new xn(t)}static decimal(t){return new ni(t)}constructor(t,e){return kr.new(t,e)}};function at(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)}var kc,Vc,jc,zc,Wc,Gc,$c,Hc,Yc,Kc,Zc,Jc,Xc,Qc,qc,tl,el,rl,nl,il,sl,ol,m=class{static isNull(t){return t?.typeId===f.Null}static isInt(t){return t?.typeId===f.Int}static isFloat(t){return t?.typeId===f.Float}static isBinary(t){return t?.typeId===f.Binary}static isLargeBinary(t){return t?.typeId===f.LargeBinary}static isUtf8(t){return t?.typeId===f.Utf8}static isLargeUtf8(t){return t?.typeId===f.LargeUtf8}static isBool(t){return t?.typeId===f.Bool}static isDecimal(t){return t?.typeId===f.Decimal}static isDate(t){return t?.typeId===f.Date}static isTime(t){return t?.typeId===f.Time}static isTimestamp(t){return t?.typeId===f.Timestamp}static isInterval(t){return t?.typeId===f.Interval}static isDuration(t){return t?.typeId===f.Duration}static isList(t){return t?.typeId===f.List}static isStruct(t){return t?.typeId===f.Struct}static isUnion(t){return t?.typeId===f.Union}static isFixedSizeBinary(t){return t?.typeId===f.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===f.FixedSizeList}static isMap(t){return t?.typeId===f.Map}static isDictionary(t){return t?.typeId===f.Dictionary}static isDenseUnion(t){return m.isUnion(t)&&t.mode===K.Dense}static isSparseUnion(t){return m.isUnion(t)&&t.mode===K.Sparse}constructor(t){this.typeId=t}};kc=Symbol.toStringTag;m[kc]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(m.prototype);var ut=class extends m{constructor(){super(f.Null)}toString(){return"Null"}};Vc=Symbol.toStringTag;ut[Vc]=(r=>r[Symbol.toStringTag]="Null")(ut.prototype);var it=class extends m{constructor(t,e){super(f.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}`}};jc=Symbol.toStringTag;it[jc]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(it.prototype);var ye=class extends it{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},ge=class extends it{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},pt=class extends it{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},be=class extends it{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},we=class extends it{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},_e=class extends it{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},ve=class extends it{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Je=class extends it{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(ye.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(ge.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(pt.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(be.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(we.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(_e.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ve.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Je.prototype,"ArrayType",{value:BigUint64Array});var At=class extends m{constructor(t){super(f.Float),this.precision=t}get ArrayType(){switch(this.precision){case j.HALF:return Uint16Array;case j.SINGLE:return Float32Array;case j.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};zc=Symbol.toStringTag;At[zc]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(At.prototype);var Tr=class extends At{constructor(){super(j.HALF)}},Xt=class extends At{constructor(){super(j.SINGLE)}},Qt=class extends At{constructor(){super(j.DOUBLE)}};Object.defineProperty(Tr.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Xt.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Qt.prototype,"ArrayType",{value:Float64Array});var ue=class extends m{constructor(){super(f.Binary)}toString(){return"Binary"}};Wc=Symbol.toStringTag;ue[Wc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(ue.prototype);var Xe=class extends m{constructor(){super(f.LargeBinary)}toString(){return"LargeBinary"}};Gc=Symbol.toStringTag;Xe[Gc]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(Xe.prototype);var Pt=class extends m{constructor(){super(f.Utf8)}toString(){return"Utf8"}};$c=Symbol.toStringTag;Pt[$c]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Pt.prototype);var Qe=class extends m{constructor(){super(f.LargeUtf8)}toString(){return"LargeUtf8"}};Hc=Symbol.toStringTag;Qe[Hc]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Qe.prototype);var kt=class extends m{constructor(){super(f.Bool)}toString(){return"Bool"}};Yc=Symbol.toStringTag;kt[Yc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(kt.prototype);var fe=class extends m{constructor(t,e,n=128){super(f.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};Kc=Symbol.toStringTag;fe[Kc]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(fe.prototype);var qt=class extends m{constructor(t){super(f.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${et[this.unit]}>`}};Zc=Symbol.toStringTag;qt[Zc]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Date"))(qt.prototype);var Vr=class extends qt{constructor(){super(et.DAY)}},lr=class extends qt{constructor(){super(et.MILLISECOND)}},xt=class extends m{constructor(t,e){super(f.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${p[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};Jc=Symbol.toStringTag;xt[Jc]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(xt.prototype);var jr=class extends xt{constructor(){super(p.SECOND,32)}},zr=class extends xt{constructor(){super(p.MILLISECOND,32)}},Wr=class extends xt{constructor(){super(p.MICROSECOND,64)}},Gr=class extends xt{constructor(){super(p.NANOSECOND,64)}},Nt=class extends m{constructor(t,e){super(f.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${p[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};Xc=Symbol.toStringTag;Nt[Xc]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Timestamp"))(Nt.prototype);var $r=class extends Nt{constructor(t){super(p.SECOND,t)}},Hr=class extends Nt{constructor(t){super(p.MILLISECOND,t)}},Yr=class extends Nt{constructor(t){super(p.MICROSECOND,t)}},Kr=class extends Nt{constructor(t){super(p.NANOSECOND,t)}},te=class extends m{constructor(t){super(f.Interval),this.unit=t}toString(){return`Interval<${nt[this.unit]}>`}};Qc=Symbol.toStringTag;te[Qc]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(te.prototype);var Zr=class extends te{constructor(){super(nt.DAY_TIME)}},Jr=class extends te{constructor(){super(nt.YEAR_MONTH)}},qe=class extends m{constructor(t){super(f.Duration),this.unit=t}toString(){return`Duration<${p[this.unit]}>`}};qc=Symbol.toStringTag;qe[qc]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(qe.prototype);var Tt=class extends m{constructor(t){super(f.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};tl=Symbol.toStringTag;Tt[tl]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(Tt.prototype);var V=class extends m{constructor(t){super(f.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};el=Symbol.toStringTag;V[el]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(V.prototype);var Ie=class extends m{constructor(t,e,n){super(f.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};rl=Symbol.toStringTag;Ie[rl]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(Ie.prototype);var tr=class extends m{constructor(t){super(f.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};nl=Symbol.toStringTag;tr[nl]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(tr.prototype);var Vt=class extends m{constructor(t,e){super(f.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}>`}};il=Symbol.toStringTag;Vt[il]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Vt.prototype);var jt=class extends m{constructor(t,e=!1){var n,i,s;if(super(f.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){let o=(i=t?.type)===null||i===void 0?void 0:i.children[0];o&&(o.name="key");let a=(s=t?.type)===null||s===void 0?void 0:s.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(", ")}}>`}};sl=Symbol.toStringTag;jt[sl]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(jt.prototype);var sh=(r=>()=>++r)(-1),Ut=class extends m{constructor(t,e,n,i){super(f.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?sh():at(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}>`}};ol=Symbol.toStringTag;Ut[ol]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Ut.prototype);function he(r){let t=r;switch(r.typeId){case f.Decimal:return r.bitWidth/32;case f.Timestamp:return 2;case f.Date:return 1+t.unit;case f.Interval:return 1+t.unit;case f.FixedSizeList:return t.listSize;case f.FixedSizeBinary:return t.byteWidth;default:return 1}}var v=class{visitMany(t,...e){return t.map((n,i)=>this.visit(n,...e.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return oh(this,t,e)}getVisitFnByTypeId(t,e=!0){return Bn(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 oh(r,t,e=!0){return typeof t=="number"?Bn(r,t,e):typeof t=="string"&&t in f?Bn(r,f[t],e):t&&t instanceof m?Bn(r,cl(t),e):t?.type&&t.type instanceof m?Bn(r,cl(t.type),e):Bn(r,f.NONE,e)}function Bn(r,t,e=!0){let n=null;switch(t){case f.Null:n=r.visitNull;break;case f.Bool:n=r.visitBool;break;case f.Int:n=r.visitInt;break;case f.Int8:n=r.visitInt8||r.visitInt;break;case f.Int16:n=r.visitInt16||r.visitInt;break;case f.Int32:n=r.visitInt32||r.visitInt;break;case f.Int64:n=r.visitInt64||r.visitInt;break;case f.Uint8:n=r.visitUint8||r.visitInt;break;case f.Uint16:n=r.visitUint16||r.visitInt;break;case f.Uint32:n=r.visitUint32||r.visitInt;break;case f.Uint64:n=r.visitUint64||r.visitInt;break;case f.Float:n=r.visitFloat;break;case f.Float16:n=r.visitFloat16||r.visitFloat;break;case f.Float32:n=r.visitFloat32||r.visitFloat;break;case f.Float64:n=r.visitFloat64||r.visitFloat;break;case f.Utf8:n=r.visitUtf8;break;case f.LargeUtf8:n=r.visitLargeUtf8;break;case f.Binary:n=r.visitBinary;break;case f.LargeBinary:n=r.visitLargeBinary;break;case f.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case f.Date:n=r.visitDate;break;case f.DateDay:n=r.visitDateDay||r.visitDate;break;case f.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case f.Timestamp:n=r.visitTimestamp;break;case f.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case f.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case f.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case f.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case f.Time:n=r.visitTime;break;case f.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case f.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case f.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case f.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case f.Decimal:n=r.visitDecimal;break;case f.List:n=r.visitList;break;case f.Struct:n=r.visitStruct;break;case f.Union:n=r.visitUnion;break;case f.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case f.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case f.Dictionary:n=r.visitDictionary;break;case f.Interval:n=r.visitInterval;break;case f.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case f.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case f.Duration:n=r.visitDuration;break;case f.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case f.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case f.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case f.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case f.FixedSizeList:n=r.visitFixedSizeList;break;case f.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${f[t]}'`)}function cl(r){switch(r.typeId){case f.Null:return f.Null;case f.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?f.Int8:f.Uint8;case 16:return e?f.Int16:f.Uint16;case 32:return e?f.Int32:f.Uint32;case 64:return e?f.Int64:f.Uint64}return f.Int}case f.Float:switch(r.precision){case j.HALF:return f.Float16;case j.SINGLE:return f.Float32;case j.DOUBLE:return f.Float64}return f.Float;case f.Binary:return f.Binary;case f.LargeBinary:return f.LargeBinary;case f.Utf8:return f.Utf8;case f.LargeUtf8:return f.LargeUtf8;case f.Bool:return f.Bool;case f.Decimal:return f.Decimal;case f.Time:switch(r.unit){case p.SECOND:return f.TimeSecond;case p.MILLISECOND:return f.TimeMillisecond;case p.MICROSECOND:return f.TimeMicrosecond;case p.NANOSECOND:return f.TimeNanosecond}return f.Time;case f.Timestamp:switch(r.unit){case p.SECOND:return f.TimestampSecond;case p.MILLISECOND:return f.TimestampMillisecond;case p.MICROSECOND:return f.TimestampMicrosecond;case p.NANOSECOND:return f.TimestampNanosecond}return f.Timestamp;case f.Date:switch(r.unit){case et.DAY:return f.DateDay;case et.MILLISECOND:return f.DateMillisecond}return f.Date;case f.Interval:switch(r.unit){case nt.DAY_TIME:return f.IntervalDayTime;case nt.YEAR_MONTH:return f.IntervalYearMonth}return f.Interval;case f.Duration:switch(r.unit){case p.SECOND:return f.DurationSecond;case p.MILLISECOND:return f.DurationMillisecond;case p.MICROSECOND:return f.DurationMicrosecond;case p.NANOSECOND:return f.DurationNanosecond}return f.Duration;case f.Map:return f.Map;case f.List:return f.List;case f.Struct:return f.Struct;case f.Union:switch(r.mode){case K.Dense:return f.DenseUnion;case K.Sparse:return f.SparseUnion}return f.Union;case f.FixedSizeBinary:return f.FixedSizeBinary;case f.FixedSizeList:return f.FixedSizeList;case f.Dictionary:return f.Dictionary}throw new Error(`Unrecognized type '${f[r.typeId]}'`)}v.prototype.visitInt8=null;v.prototype.visitInt16=null;v.prototype.visitInt32=null;v.prototype.visitInt64=null;v.prototype.visitUint8=null;v.prototype.visitUint16=null;v.prototype.visitUint32=null;v.prototype.visitUint64=null;v.prototype.visitFloat16=null;v.prototype.visitFloat32=null;v.prototype.visitFloat64=null;v.prototype.visitDateDay=null;v.prototype.visitDateMillisecond=null;v.prototype.visitTimestampSecond=null;v.prototype.visitTimestampMillisecond=null;v.prototype.visitTimestampMicrosecond=null;v.prototype.visitTimestampNanosecond=null;v.prototype.visitTimeSecond=null;v.prototype.visitTimeMillisecond=null;v.prototype.visitTimeMicrosecond=null;v.prototype.visitTimeNanosecond=null;v.prototype.visitDenseUnion=null;v.prototype.visitSparseUnion=null;v.prototype.visitIntervalDayTime=null;v.prototype.visitIntervalYearMonth=null;v.prototype.visitDuration=null;v.prototype.visitDurationSecond=null;v.prototype.visitDurationMillisecond=null;v.prototype.visitDurationMicrosecond=null;v.prototype.visitDurationNanosecond=null;var ia={};Sr(ia,{float64ToUint16:()=>ii,uint16ToFloat64:()=>bs});var ll=new Float64Array(1),An=new Uint32Array(ll.buffer);function bs(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 ii(r){if(r!==r)return 32256;ll[0]=r;let t=(An[1]&2147483648)>>16&65535,e=An[1]&2146435072,n=0;return e>=1089470464?An[0]>0?e=31744:(e=(e&2080374784)>>16,n=(An[1]&1048575)>>10):e<=1056964608?(n=1048576+(An[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(An[1]&1048575)+512>>10),t|e|n&65535}var A=class extends v{};function L(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var ah=(r,t,e)=>{r[t]=Math.trunc(e/864e5)},sa=(r,t,e)=>{r[t]=Math.trunc(e%4294967296),r[t+1]=Math.trunc(e/4294967296)},ch=(r,t,e)=>{r[t]=Math.trunc(e*1e3%4294967296),r[t+1]=Math.trunc(e*1e3/4294967296)},lh=(r,t,e)=>{r[t]=Math.trunc(e*1e6%4294967296),r[t+1]=Math.trunc(e*1e6/4294967296)},ul=(r,t,e,n)=>{if(e+1<t.length){let i=at(t[e]),s=at(t[e+1]);r.set(n.subarray(0,s-i),i)}},uh=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},ur=({values:r},t,e)=>{r[t]=e},oa=({values:r},t,e)=>{r[t]=e},fl=({values:r},t,e)=>{r[t]=ii(e)},fh=(r,t,e)=>{switch(r.type.precision){case j.HALF:return fl(r,t,e);case j.SINGLE:case j.DOUBLE:return oa(r,t,e)}},ws=({values:r},t,e)=>{ah(r,t,e.valueOf())},_s=({values:r},t,e)=>{sa(r,t*2,e.valueOf())},aa=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},hl=({values:r,valueOffsets:t},e,n)=>ul(r,t,e,n),dl=({values:r,valueOffsets:t},e,n)=>ul(r,t,e,ke(n)),ca=(r,t,e)=>{r.type.unit===et.DAY?ws(r,t,e):_s(r,t,e)},vs=({values:r},t,e)=>sa(r,t*2,e/1e3),Is=({values:r},t,e)=>sa(r,t*2,e),xs=({values:r},t,e)=>ch(r,t*2,e),Ss=({values:r},t,e)=>lh(r,t*2,e),la=(r,t,e)=>{switch(r.type.unit){case p.SECOND:return vs(r,t,e);case p.MILLISECOND:return Is(r,t,e);case p.MICROSECOND:return xs(r,t,e);case p.NANOSECOND:return Ss(r,t,e)}},Bs=({values:r},t,e)=>{r[t]=e},As=({values:r},t,e)=>{r[t]=e},Ts=({values:r},t,e)=>{r[t]=e},Ds=({values:r},t,e)=>{r[t]=e},ua=(r,t,e)=>{switch(r.type.unit){case p.SECOND:return Bs(r,t,e);case p.MILLISECOND:return As(r,t,e);case p.MICROSECOND:return Ts(r,t,e);case p.NANOSECOND:return Ds(r,t,e)}},fa=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},hh=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,s=Dt.getVisitFn(n);if(Array.isArray(e))for(let o=-1,a=i[t],c=i[t+1];a<c;)s(n,a++,e[++o]);else for(let o=-1,a=i[t],c=i[t+1];a<c;)s(n,a++,e.get(++o))},dh=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,s=Dt.getVisitFn(n),{[t]:o,[t+1]:a}=i,c=e instanceof Map?e.entries():Object.entries(e);for(let l of c)if(s(n,o,l),++o>=a)break},ph=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),mh=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),yh=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),gh=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),bh=(r,t,e)=>{let n=r.type.children.map(s=>Dt.getVisitFn(s.type)),i=e instanceof Map?yh(t,e):e instanceof g?mh(t,e):Array.isArray(e)?ph(t,e):gh(t,e);r.type.children.forEach((s,o)=>i(n[o],r.children[o],s,o))},wh=(r,t,e)=>{r.type.mode===K.Dense?pl(r,t,e):ml(r,t,e)},pl=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Dt.visit(i,r.valueOffsets[t],e)},ml=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Dt.visit(i,t,e)},_h=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},ha=(r,t,e)=>{r.type.unit===nt.DAY_TIME?Os(r,t,e):Fs(r,t,e)},Os=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},Fs=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},Ms=({values:r},t,e)=>{r[t]=e},Ls=({values:r},t,e)=>{r[t]=e},Ns=({values:r},t,e)=>{r[t]=e},Us=({values:r},t,e)=>{r[t]=e},da=(r,t,e)=>{switch(r.type.unit){case p.SECOND:return Ms(r,t,e);case p.MILLISECOND:return Ls(r,t,e);case p.MICROSECOND:return Ns(r,t,e);case p.NANOSECOND:return Us(r,t,e)}},vh=(r,t,e)=>{let{stride:n}=r,i=r.children[0],s=Dt.getVisitFn(i);if(Array.isArray(e))for(let o=-1,a=t*n;++o<n;)s(i,a+o,e[o]);else for(let o=-1,a=t*n;++o<n;)s(i,a+o,e.get(o))};A.prototype.visitBool=L(uh);A.prototype.visitInt=L(ur);A.prototype.visitInt8=L(ur);A.prototype.visitInt16=L(ur);A.prototype.visitInt32=L(ur);A.prototype.visitInt64=L(ur);A.prototype.visitUint8=L(ur);A.prototype.visitUint16=L(ur);A.prototype.visitUint32=L(ur);A.prototype.visitUint64=L(ur);A.prototype.visitFloat=L(fh);A.prototype.visitFloat16=L(fl);A.prototype.visitFloat32=L(oa);A.prototype.visitFloat64=L(oa);A.prototype.visitUtf8=L(dl);A.prototype.visitLargeUtf8=L(dl);A.prototype.visitBinary=L(hl);A.prototype.visitLargeBinary=L(hl);A.prototype.visitFixedSizeBinary=L(aa);A.prototype.visitDate=L(ca);A.prototype.visitDateDay=L(ws);A.prototype.visitDateMillisecond=L(_s);A.prototype.visitTimestamp=L(la);A.prototype.visitTimestampSecond=L(vs);A.prototype.visitTimestampMillisecond=L(Is);A.prototype.visitTimestampMicrosecond=L(xs);A.prototype.visitTimestampNanosecond=L(Ss);A.prototype.visitTime=L(ua);A.prototype.visitTimeSecond=L(Bs);A.prototype.visitTimeMillisecond=L(As);A.prototype.visitTimeMicrosecond=L(Ts);A.prototype.visitTimeNanosecond=L(Ds);A.prototype.visitDecimal=L(fa);A.prototype.visitList=L(hh);A.prototype.visitStruct=L(bh);A.prototype.visitUnion=L(wh);A.prototype.visitDenseUnion=L(pl);A.prototype.visitSparseUnion=L(ml);A.prototype.visitDictionary=L(_h);A.prototype.visitInterval=L(ha);A.prototype.visitIntervalDayTime=L(Os);A.prototype.visitIntervalYearMonth=L(Fs);A.prototype.visitDuration=L(da);A.prototype.visitDurationSecond=L(Ms);A.prototype.visitDurationMillisecond=L(Ls);A.prototype.visitDurationMicrosecond=L(Ns);A.prototype.visitDurationNanosecond=L(Us);A.prototype.visitFixedSizeList=L(vh);A.prototype.visitMap=L(dh);var Dt=new A;var Ue=Symbol.for("parent"),Tn=Symbol.for("rowIndex"),Dr=class{constructor(t,e){return this[Ue]=t,this[Tn]=e,new Proxy(this,new ma)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Tn],e=this[Ue],n=e.type.children,i={};for(let s=-1,o=n.length;++s<o;)i[n[s].name]=mt.visit(e.children[s],t);return i}toString(){return`{${[...this].map(([t,e])=>`${Le(t)}: ${Le(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new pa(this[Ue],this[Tn])}},pa=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,mt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Dr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Ue]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Tn]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var ma=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Ue].type.children.map(e=>e.name)}has(t,e){return t[Ue].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[Ue].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[Ue].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=mt.visit(t[Ue].children[n],t[Tn]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[Ue].type.children.findIndex(s=>s.name===e);return i!==-1?(Dt.visit(t[Ue].children[i],t[Tn],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}};var I=class extends v{};function O(r){return(t,e)=>t.getValid(e)?r(t,e):null}var Ih=(r,t)=>864e5*r[t],ya=(r,t)=>4294967296*r[t+1]+(r[t]>>>0),xh=(r,t)=>4294967296*(r[t+1]/1e3)+(r[t]>>>0)/1e3,Sh=(r,t)=>4294967296*(r[t+1]/1e6)+(r[t]>>>0)/1e6,yl=r=>new Date(r),Bh=(r,t)=>yl(Ih(r,t)),Ah=(r,t)=>yl(ya(r,t)),Th=(r,t)=>null,gl=(r,t,e)=>{if(e+1>=t.length)return null;let n=at(t[e]),i=at(t[e+1]);return r.subarray(n,i)},Dh=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},bl=({values:r},t)=>Bh(r,t),wl=({values:r},t)=>Ah(r,t*2),Or=({stride:r,values:t},e)=>t[r*e],Oh=({stride:r,values:t},e)=>bs(t[r*e]),_l=({values:r},t)=>r[t],Fh=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),vl=({values:r,valueOffsets:t},e)=>gl(r,t,e),Il=({values:r,valueOffsets:t},e)=>{let n=gl(r,t,e);return n!==null?Jn(n):null},Mh=({values:r},t)=>r[t],Lh=({type:r,values:t},e)=>r.precision!==j.HALF?t[e]:bs(t[e]),Nh=(r,t)=>r.type.unit===et.DAY?bl(r,t):wl(r,t),xl=({values:r},t)=>1e3*ya(r,t*2),Sl=({values:r},t)=>ya(r,t*2),Bl=({values:r},t)=>xh(r,t*2),Al=({values:r},t)=>Sh(r,t*2),Uh=(r,t)=>{switch(r.type.unit){case p.SECOND:return xl(r,t);case p.MILLISECOND:return Sl(r,t);case p.MICROSECOND:return Bl(r,t);case p.NANOSECOND:return Al(r,t)}},Tl=({values:r},t)=>r[t],Dl=({values:r},t)=>r[t],Ol=({values:r},t)=>r[t],Fl=({values:r},t)=>r[t],Eh=(r,t)=>{switch(r.type.unit){case p.SECOND:return Tl(r,t);case p.MILLISECOND:return Dl(r,t);case p.MICROSECOND:return Ol(r,t);case p.NANOSECOND:return Fl(r,t)}},Rh=({values:r,stride:t},e)=>kr.decimal(r.subarray(t*e,t*(e+1))),Ch=(r,t)=>{let{valueOffsets:e,stride:n,children:i}=r,{[t*n]:s,[t*n+1]:o}=e,c=i[0].slice(s,o-s);return new g([c])},Ph=(r,t)=>{let{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:s}=e,o=n[0];return new er(o.slice(i,s-i))},kh=(r,t)=>new Dr(r,t),Vh=(r,t)=>r.type.mode===K.Dense?Ml(r,t):Ll(r,t),Ml=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return mt.visit(n,r.valueOffsets[t])},Ll=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return mt.visit(n,t)},jh=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},zh=(r,t)=>r.type.unit===nt.DAY_TIME?Nl(r,t):Ul(r,t),Nl=({values:r},t)=>r.subarray(2*t,2*(t+1)),Ul=({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},El=({values:r},t)=>r[t],Rl=({values:r},t)=>r[t],Cl=({values:r},t)=>r[t],Pl=({values:r},t)=>r[t],Wh=(r,t)=>{switch(r.type.unit){case p.SECOND:return El(r,t);case p.MILLISECOND:return Rl(r,t);case p.MICROSECOND:return Cl(r,t);case p.NANOSECOND:return Pl(r,t)}},Gh=(r,t)=>{let{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new g([s])};I.prototype.visitNull=O(Th);I.prototype.visitBool=O(Dh);I.prototype.visitInt=O(Mh);I.prototype.visitInt8=O(Or);I.prototype.visitInt16=O(Or);I.prototype.visitInt32=O(Or);I.prototype.visitInt64=O(_l);I.prototype.visitUint8=O(Or);I.prototype.visitUint16=O(Or);I.prototype.visitUint32=O(Or);I.prototype.visitUint64=O(_l);I.prototype.visitFloat=O(Lh);I.prototype.visitFloat16=O(Oh);I.prototype.visitFloat32=O(Or);I.prototype.visitFloat64=O(Or);I.prototype.visitUtf8=O(Il);I.prototype.visitLargeUtf8=O(Il);I.prototype.visitBinary=O(vl);I.prototype.visitLargeBinary=O(vl);I.prototype.visitFixedSizeBinary=O(Fh);I.prototype.visitDate=O(Nh);I.prototype.visitDateDay=O(bl);I.prototype.visitDateMillisecond=O(wl);I.prototype.visitTimestamp=O(Uh);I.prototype.visitTimestampSecond=O(xl);I.prototype.visitTimestampMillisecond=O(Sl);I.prototype.visitTimestampMicrosecond=O(Bl);I.prototype.visitTimestampNanosecond=O(Al);I.prototype.visitTime=O(Eh);I.prototype.visitTimeSecond=O(Tl);I.prototype.visitTimeMillisecond=O(Dl);I.prototype.visitTimeMicrosecond=O(Ol);I.prototype.visitTimeNanosecond=O(Fl);I.prototype.visitDecimal=O(Rh);I.prototype.visitList=O(Ch);I.prototype.visitStruct=O(kh);I.prototype.visitUnion=O(Vh);I.prototype.visitDenseUnion=O(Ml);I.prototype.visitSparseUnion=O(Ll);I.prototype.visitDictionary=O(jh);I.prototype.visitInterval=O(zh);I.prototype.visitIntervalDayTime=O(Nl);I.prototype.visitIntervalYearMonth=O(Ul);I.prototype.visitDuration=O(Wh);I.prototype.visitDurationSecond=O(El);I.prototype.visitDurationMillisecond=O(Rl);I.prototype.visitDurationMicrosecond=O(Cl);I.prototype.visitDurationNanosecond=O(Pl);I.prototype.visitFixedSizeList=O(Gh);I.prototype.visitMap=O(Ph);var mt=new I;var xe=Symbol.for("keys"),Dn=Symbol.for("vals"),er=class{constructor(t){return this[xe]=new g([t.children[0]]).memoize(),this[Dn]=t.children[1],new Proxy(this,new ba)}[Symbol.iterator](){return new ga(this[xe],this[Dn])}get size(){return this[xe].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[xe],e=this[Dn],n={};for(let i=-1,s=t.length;++i<s;)n[t.get(i)]=mt.visit(e,i);return n}toString(){return`{${[...this].map(([t,e])=>`${Le(t)}: ${Le(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},ga=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),mt.visit(this.vals,t)]})}},ba=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[xe].toArray().map(String)}has(t,e){return t[xe].includes(e)}getOwnPropertyDescriptor(t,e){if(t[xe].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[xe].indexOf(e);if(n!==-1){let i=mt.visit(Reflect.get(t,Dn),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[xe].indexOf(e);return i!==-1?(Dt.visit(Reflect.get(t,Dn),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(er.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[xe]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Dn]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function $h(r,t,e){let n=r.length,i=t>-1?t:n+t%n;return e?e(r,i):i}var kl;function si(r,t,e,n){let{length:i=0}=r,s=typeof t!="number"?0:t,o=typeof e!="number"?i:e;return s<0&&(s=(s%i+i)%i),o<0&&(o=(o%i+i)%i),o<s&&(kl=s,s=o,o=kl),o>i&&(o=i),n?n(r,s,o):[s,o]}var Vl=r=>r!==r;function Fr(r){if(typeof r!=="object"||r===null)return Vl(r)?Vl: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?Xo(r,e):!1:r instanceof Map?Yh(r):Array.isArray(r)?Hh(r):r instanceof g?Kh(r):Zh(r,!0)}function Hh(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Fr(r[e]);return Es(t)}function Yh(r){let t=-1,e=[];for(let n of r.values())e[++t]=Fr(n);return Es(e)}function Kh(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Fr(r.get(e));return Es(t)}function Zh(r,t=!1){let e=Object.keys(r);if(!t&&e.length===0)return()=>!1;let n=[];for(let i=-1,s=e.length;++i<s;)n[i]=Fr(r[e[i]]);return Es(n,e)}function Es(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return Jh(r,e);case Map:return jl(r,e,e.keys());case er:case Dr:case Object:case void 0:return jl(r,e,t||Object.keys(e))}return e instanceof g?Xh(r,e):!1}}function Jh(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 Xh(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 jl(r,t,e){let n=e[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),s=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,a=r.length,c=s.next(),l=n.next(),u=i.next();for(;o<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!r[o](c.value));++o,l=n.next(),u=i.next(),c=s.next());return o===a&&l.done&&u.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),s.return&&s.return(),!1)}var _a={};Sr(_a,{BitIterator:()=>Xr,getBit:()=>zl,getBool:()=>Cs,packBools:()=>qr,popcnt_array:()=>Wl,popcnt_bit_range:()=>oi,popcnt_uint32:()=>Rs,setBool:()=>Qh,truncateBitmap:()=>Qr});function Cs(r,t,e,n){return(e&1<<n)!==0}function zl(r,t,e,n){return(e&1<<n)>>n}function Qh(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function Qr(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):qr(new Xr(e,r,t,null,Cs)).subarray(0,n)),i}return e}function qr(r){let t=[],e=0,n=0,i=0;for(let o of r)o&&(i|=1<<n),++n===8&&(t[e++]=i,i=n=0);(e===0||n>0)&&(t[e++]=i);let s=new Uint8Array(t.length+7&-8);return s.set(t),s}var Xr=class{constructor(t,e,n,i,s){this.bytes=t,this.length=n,this.context=i,this.get=s,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function oi(r,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(let o of new Xr(r,t,e-t,r,zl))s+=o;return s}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return oi(r,t,i)+oi(r,n,e)+Wl(r,i>>3,n-i>>3)}function Wl(r,t,e){let n=0,i=Math.trunc(t),s=new DataView(r.buffer,r.byteOffset,r.byteLength),o=e===void 0?r.byteLength:i+e;for(;o-i>=4;)n+=Rs(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=Rs(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=Rs(s.getUint8(i)),i+=1;return n}function Rs(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 qh=-1,R=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 m.isSparseUnion(t)?this.children.some(e=>e.nullable):m.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:e,values:n,nullBitmap:i,typeIds:s}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(m.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,e;return t<=qh&&(e=this.nullBitmap)&&(this._nullCount=t=this.length-oi(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,i,s,o=[],a){this.type=t,this.children=o,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;s instanceof R?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=he(t),s&&((c=s[0])&&(this.valueOffsets=c),(c=s[1])&&(this.values=c),(c=s[2])&&(this.nullBitmap=c),(c=s[3])&&(this.typeIds=c)))}getValid(t){let{type:e}=this;if(m.isUnion(e)){let n=e,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],s=n.mode===K.Dense?this.valueOffsets[t]:t;return i.getValid(s)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,e){let n,{type:i}=this;if(m.isUnion(i)){let s=i,o=this.children[s.typeIdToChildIndex[this.typeIds[t]]],a=s.mode===K.Dense?this.valueOffsets[t]:t;n=o.getValid(a),o.setValid(a,e)}else{let{nullBitmap:s}=this,{offset:o,length:a}=this,c=o+t,l=1<<c%8,u=c>>3;(!s||s.byteLength<=u)&&(s=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0&&s.set(Qr(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:s,_nullCount:-1}));let h=s[u];n=(h&l)!==0,e?s[u]=h|l:s[u]=h&~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,s=this,o=this.children){return new R(t,e,n,i,s,o,this.dictionary)}slice(t,e){let{stride:n,typeId:i,children:s}=this,o=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,o,c,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===f.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(Qr(this.offset,e,this.nullBitmap),0);let s=this.buffers;return s[lt.VALIDITY]=i,this.clone(this.type,0,t,n+(t-e),s)}_sliceBuffers(t,e,n,i){let s,{buffers:o}=this;return(s=o[lt.TYPE])&&(o[lt.TYPE]=s.subarray(t,t+e)),(s=o[lt.OFFSET])&&(o[lt.OFFSET]=s.subarray(t,t+e+1))||(s=o[lt.DATA])&&(o[lt.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};R.prototype.children=Object.freeze([]);var tn=class extends v{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:n=0,["length"]:i=0}=t;return new R(e,n,i,i)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.data),s=T(t.nullBitmap),o=Pr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,i,s])}visitLargeUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.data),s=T(t.nullBitmap),o=hs(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,i,s])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.data),s=T(t.nullBitmap),o=Pr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,i,s])}visitLargeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.data),s=T(t.nullBitmap),o=hs(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,i,s])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,s=T(t.nullBitmap),o=Pr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,void 0,s],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=T(t.nullBitmap),{length:o=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,void 0,s],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=C(e.ArrayType,t.typeIds),{["length"]:o=s.length,["nullCount"]:a=-1}=t;if(m.isSparseUnion(e))return new R(e,n,o,a,[void 0,void 0,void 0,s],i);let c=Pr(t.valueOffsets);return new R(e,n,o,a,[c,void 0,void 0,s],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.indices.ArrayType,t.data),{["dictionary"]:o=new g([new tn().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[void 0,s,i],[],o)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitDuration(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new tn().visit({type:e.valueType})}=t,s=T(t.nullBitmap),{["length"]:o=i.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,void 0,s],[i])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new tn().visit({type:e.childType})}=t,s=T(t.nullBitmap),o=Pr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,void 0,s],[i])}},td=new tn;function w(r){return td.visit(r)}var ai=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 Gl(r){return r.some(t=>t.nullable)}function Ps(r){return r.reduce((t,e)=>t+e.nullCount,0)}function ks(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function Vs(r,t,e,n){let i=[];for(let s=-1,o=r.length;++s<o;){let a=r[s],c=t[s],{length:l}=a;if(c>=n)break;if(e>=c+l)continue;if(c>=e&&c+l<=n){i.push(a);continue}let u=Math.max(0,e-c),h=Math.min(n-c,l);i.push(a.slice(u,h-u))}return i.length===0&&i.push(r[0].slice(0,0)),i}function va(r,t,e,n){let i=0,s=0,o=t.length-1;do{if(i>=o-1)return e<t[o]?n(r,i,e-t[i]):null;s=i+Math.trunc((o-i)*.5),e<t[s]?o=s:i=s}while(i<o)}function ci(r,t){return r.getValid(t)}function On(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return va(n,this._offsets,e,t)}}function js(r){let t;function e(n,i,s){return r(n[i],s,t)}return function(n,i){let s=this.data;t=i;let o=va(s,this._offsets,n,e);return t=void 0,o}}function zs(r){let t;function e(n,i,s){let o=s,a=0,c=0;for(let l=i-1,u=n.length;++l<u;){let h=n[l];if(~(a=r(h,t,o)))return c+a;o=0,c+=h.length}return-1}return function(n,i){t=n;let s=this.data,o=typeof i!="number"?e(s,0,0):va(s,this._offsets,i,e);return t=void 0,o}}var x=class extends v{};function ed(r,t){return t===null&&r.length>0?0:-1}function rd(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new Xr(e,r.offset+(t||0),r.length,e,Cs)){if(!i)return n;++n}return-1}function N(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case f.Union:break;case f.Dictionary:break;default:return rd(r,e)}let n=mt.getVisitFn(r),i=Fr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}function $l(r,t,e){let n=mt.getVisitFn(r),i=Fr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}x.prototype.visitNull=ed;x.prototype.visitBool=N;x.prototype.visitInt=N;x.prototype.visitInt8=N;x.prototype.visitInt16=N;x.prototype.visitInt32=N;x.prototype.visitInt64=N;x.prototype.visitUint8=N;x.prototype.visitUint16=N;x.prototype.visitUint32=N;x.prototype.visitUint64=N;x.prototype.visitFloat=N;x.prototype.visitFloat16=N;x.prototype.visitFloat32=N;x.prototype.visitFloat64=N;x.prototype.visitUtf8=N;x.prototype.visitLargeUtf8=N;x.prototype.visitBinary=N;x.prototype.visitLargeBinary=N;x.prototype.visitFixedSizeBinary=N;x.prototype.visitDate=N;x.prototype.visitDateDay=N;x.prototype.visitDateMillisecond=N;x.prototype.visitTimestamp=N;x.prototype.visitTimestampSecond=N;x.prototype.visitTimestampMillisecond=N;x.prototype.visitTimestampMicrosecond=N;x.prototype.visitTimestampNanosecond=N;x.prototype.visitTime=N;x.prototype.visitTimeSecond=N;x.prototype.visitTimeMillisecond=N;x.prototype.visitTimeMicrosecond=N;x.prototype.visitTimeNanosecond=N;x.prototype.visitDecimal=N;x.prototype.visitList=N;x.prototype.visitStruct=N;x.prototype.visitUnion=N;x.prototype.visitDenseUnion=$l;x.prototype.visitSparseUnion=$l;x.prototype.visitDictionary=N;x.prototype.visitInterval=N;x.prototype.visitIntervalDayTime=N;x.prototype.visitIntervalYearMonth=N;x.prototype.visitDuration=N;x.prototype.visitDurationSecond=N;x.prototype.visitDurationMillisecond=N;x.prototype.visitDurationMicrosecond=N;x.prototype.visitDurationNanosecond=N;x.prototype.visitFixedSizeList=N;x.prototype.visitMap=N;var en=new x;var S=class extends v{};function F(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(t.typeId===f.Timestamp||t instanceof it&&t.bitWidth!==64||t instanceof xt&&t.bitWidth!==64||t instanceof At&&t.precision!==j.HALF))return new ai(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new ai(r.data.length,n=>{let s=r.data[n].length,o=r.slice(e,e+s);return e+=s,new Ia(o)})}var Ia=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}};S.prototype.visitNull=F;S.prototype.visitBool=F;S.prototype.visitInt=F;S.prototype.visitInt8=F;S.prototype.visitInt16=F;S.prototype.visitInt32=F;S.prototype.visitInt64=F;S.prototype.visitUint8=F;S.prototype.visitUint16=F;S.prototype.visitUint32=F;S.prototype.visitUint64=F;S.prototype.visitFloat=F;S.prototype.visitFloat16=F;S.prototype.visitFloat32=F;S.prototype.visitFloat64=F;S.prototype.visitUtf8=F;S.prototype.visitLargeUtf8=F;S.prototype.visitBinary=F;S.prototype.visitLargeBinary=F;S.prototype.visitFixedSizeBinary=F;S.prototype.visitDate=F;S.prototype.visitDateDay=F;S.prototype.visitDateMillisecond=F;S.prototype.visitTimestamp=F;S.prototype.visitTimestampSecond=F;S.prototype.visitTimestampMillisecond=F;S.prototype.visitTimestampMicrosecond=F;S.prototype.visitTimestampNanosecond=F;S.prototype.visitTime=F;S.prototype.visitTimeSecond=F;S.prototype.visitTimeMillisecond=F;S.prototype.visitTimeMicrosecond=F;S.prototype.visitTimeNanosecond=F;S.prototype.visitDecimal=F;S.prototype.visitList=F;S.prototype.visitStruct=F;S.prototype.visitUnion=F;S.prototype.visitDenseUnion=F;S.prototype.visitSparseUnion=F;S.prototype.visitDictionary=F;S.prototype.visitInterval=F;S.prototype.visitIntervalDayTime=F;S.prototype.visitIntervalYearMonth=F;S.prototype.visitDuration=F;S.prototype.visitDurationSecond=F;S.prototype.visitDurationMillisecond=F;S.prototype.visitDurationMicrosecond=F;S.prototype.visitDurationNanosecond=F;S.prototype.visitFixedSizeList=F;S.prototype.visitMap=F;var Fn=new S;var Hl,Yl={},Kl={},g=class{constructor(t){var e,n,i;let s=t[0]instanceof g?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof R)))throw new TypeError("Vector constructor expects an Array of Data instances.");let o=(e=s[0])===null||e===void 0?void 0:e.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=Yl[o.typeId],u=s[0];this.isValid=h=>ci(u,h),this.get=h=>a(u,h),this.set=(h,d)=>c(u,h,d),this.indexOf=h=>l(u,h),this._offsets=[0,u.length];break}default:Object.setPrototypeOf(this,Kl[o.typeId]),this._offsets=ks(s);break}this.data=s,this.type=o,this.stride=he(o),this.numChildren=(i=(n=o.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return Gl(this.data)}get nullCount(){return Ps(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${f[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return Fn.visit(this)}concat(...t){return new g(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new g(si(this,t,e,({data:n,_offsets:i},s,o)=>Vs(n,i,s,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:i,ArrayType:s}=this;switch(t.typeId){case f.Int:case f.Float:case f.Decimal:case f.Time:case f.Timestamp:switch(e.length){case 0:return new s;case 1:return e[0].values.subarray(0,n*i);default:return e.reduce((o,{values:a,length:c})=>(o.array.set(a.subarray(0,c*i),o.offset),o.offset+=c*i,o),{array:new s(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 g(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return m.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(m.isDictionary(this.type)){let t=new Mn(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new g(e)}return new Mn(this)}unmemoize(){if(m.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 g(e)}return this}};Hl=Symbol.toStringTag;g[Hl]=(r=>{r.type=m.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(f).map(e=>f[e]).filter(e=>typeof e=="number"&&e!==f.NONE);for(let e of t){let n=mt.getVisitFnByTypeId(e),i=Dt.getVisitFnByTypeId(e),s=en.getVisitFnByTypeId(e);Yl[e]={get:n,set:i,indexOf:s},Kl[e]=Object.create(r,{isValid:{value:On(ci)},get:{value:On(mt.getVisitFnByTypeId(e))},set:{value:js(Dt.getVisitFnByTypeId(e))},indexOf:{value:zs(en.getVisitFnByTypeId(e))}})}return"Vector"})(g.prototype);var Mn=class extends g{constructor(t){super(t.data);let e=this.get,n=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){let a=s[o];if(a!==void 0)return a;let c=e.call(this,o);return s[o]=c,c}}),Object.defineProperty(this,"set",{value(o,a){n.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new Mn(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new g(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function Mr(r){if(r){if(r instanceof R)return new g([r]);if(r instanceof g)return new g(r.data);if(r.type instanceof m)return new g([w(r)]);if(Array.isArray(r))return new g(r.flatMap(t=>nd(t)));if(ArrayBuffer.isView(r)){r instanceof DataView&&(r=new Uint8Array(r.buffer));let t={offset:0,length:r.length,nullCount:0,data:r};if(r instanceof Int8Array)return new g([w(Object.assign(Object.assign({},t),{type:new ye}))]);if(r instanceof Int16Array)return new g([w(Object.assign(Object.assign({},t),{type:new ge}))]);if(r instanceof Int32Array)return new g([w(Object.assign(Object.assign({},t),{type:new pt}))]);if(r instanceof BigInt64Array)return new g([w(Object.assign(Object.assign({},t),{type:new be}))]);if(r instanceof Uint8Array||r instanceof Uint8ClampedArray)return new g([w(Object.assign(Object.assign({},t),{type:new we}))]);if(r instanceof Uint16Array)return new g([w(Object.assign(Object.assign({},t),{type:new _e}))]);if(r instanceof Uint32Array)return new g([w(Object.assign(Object.assign({},t),{type:new ve}))]);if(r instanceof BigUint64Array)return new g([w(Object.assign(Object.assign({},t),{type:new Je}))]);if(r instanceof Float32Array)return new g([w(Object.assign(Object.assign({},t),{type:new Xt}))]);if(r instanceof Float64Array)return new g([w(Object.assign(Object.assign({},t),{type:new Qt}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function nd(r){return r instanceof R?[r]:r instanceof g?r.data:Mr(r).data}function Zl(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 uf=Object.create;var Xn=Object.defineProperty;var ff=Object.getOwnPropertyDescriptor;var hf=Object.getOwnPropertyNames;var df=Object.getPrototypeOf,pf=Object.prototype.hasOwnProperty;var mf=(r,t,e)=>t in r?Xn(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var yf=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),xr=(r,t)=>{for(var e in t)Xn(r,e,{get:t[e],enumerable:!0})},ts=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of hf(t))!pf.call(r,i)&&i!==e&&Xn(r,i,{get:()=>t[i],enumerable:!(n=ff(t,i))||n.enumerable});return r},es=(r,t,e)=>(ts(r,t,"default"),e&&ts(e,t,"default")),gf=(r,t,e)=>(e=r!=null?uf(df(r)):{},ts(t||!r||!r.__esModule?Xn(e,"default",{value:r,enumerable:!0}):e,r)),bf=r=>ts(Xn({},"__esModule",{value:!0}),r);var rs=(r,t,e)=>(mf(r,typeof t!="symbol"?t+"":t,e),e);var _c=yf((xm,wc)=>{wc.exports=globalThis.loaders});var qi={};xr(qi,{ArrowLoader:()=>Ou,ArrowWorkerLoader:()=>$n,ArrowWriter:()=>Fu,GeoArrowLoader:()=>Vu,GeoArrowWorkerLoader:()=>ku,TriangulationWorker:()=>Zo,VECTOR_TYPES:()=>fn,convertArrowToGeoJSONTable:()=>jo,deserializeArrowField:()=>dn,deserializeArrowMetadata:()=>Uo,deserializeArrowSchema:()=>Du,deserializeArrowType:()=>Xa,getArrowType:()=>Tu,getBinaryGeometriesFromArrow:()=>ju,getBinaryGeometryTemplate:()=>Zi,getMeanCentersFromBinaryGeometries:()=>sc,getTriangleIndices:()=>oc,hardClone:()=>Ji,parseGeoArrowOnWorker:()=>lf,parseGeometryFromArrow:()=>zo,serializeArrowField:()=>hn,serializeArrowMetadata:()=>No,serializeArrowSchema:()=>Gn,serializeArrowType:()=>Ja,triangulateOnWorker:()=>cf,updateBoundsFromGeoArrowSamples:()=>Wo});es(qi,gf(_c(),1));var ns=class{schema;options;shape;length=0;rows=null;cursor=0;_headers=[];constructor(t,e){if(this.options=e,this.schema=t,!Array.isArray(t)){this._headers=[];for(let n in t)this._headers[t[n].index]=t[n].name}}rowCount(){return this.length}addArrayRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.shape="array-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}addObjectRow(t,e){Number.isFinite(e)&&(this.cursor=e),this.shape="object-row-table",this.rows=this.rows||new Array(100),this.rows[this.length]=t,this.length++}getBatch(){let t=this.rows;return t?(t=t.slice(0,this.length),this.rows=null,{shape:this.shape||"array-row-table",batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}):null}};function vc(r,t){if(!r)throw new Error("null row");let e={};if(t)for(let n=0;n<t.length;n++)e[t[n]]=r[n];else for(let n=0;n<r.length;n++){let i=`column-${n}`;e[i]=r[n]}return e}function Ic(r,t){if(!r)throw new Error("null row");if(t){let e=new Array(t.length);for(let n=0;n<t.length;n++)e[n]=r[t[n]];return e}return Object.values(r)}function xc(r){let t=[];for(let e=0;e<r.length;e++){let n=`column-${e}`;t.push(n)}return t}function Sc(r){return Object.keys(r)}var Bc=100,is=class{schema;options;length=0;objectRows=null;arrayRows=null;cursor=0;_headers=null;constructor(t,e){if(this.options=e,this.schema=t,t){this._headers=[];for(let n in t)this._headers[t[n].index]=t[n].name}}rowCount(){return this.length}addArrayRow(t,e){switch(Number.isFinite(e)&&(this.cursor=e),this._headers||=xc(t),this.options.shape){case"object-row-table":let n=vc(t,this._headers);this.addObjectRow(n,e);break;case"array-row-table":this.arrayRows=this.arrayRows||new Array(Bc),this.arrayRows[this.length]=t,this.length++;break}}addObjectRow(t,e){switch(Number.isFinite(e)&&(this.cursor=e),this._headers||=Sc(t),this.options.shape){case"array-row-table":let n=Ic(t,this._headers);this.addArrayRow(n,e);break;case"object-row-table":this.objectRows=this.objectRows||new Array(Bc),this.objectRows[this.length]=t,this.length++;break}}getBatch(){let t=this.arrayRows||this.objectRows;return t?(t=t.slice(0,this.length),this.arrayRows=null,this.objectRows=null,{shape:this.options.shape,batchType:"data",data:t,length:this.length,schema:this.schema,cursor:this.cursor}):null}};var Er=class{schema;length=0;allocated=0;columns={};constructor(t,e){this.schema=t,this._reallocateColumns()}rowCount(){return this.length}addArrayRow(t){this._reallocateColumns();let e=0;for(let n in this.columns)this.columns[n][this.length]=t[e++];this.length++}addObjectRow(t){this._reallocateColumns();for(let e in t)this.columns[e][this.length]=t[e];this.length++}getBatch(){this._pruneColumns();let t=Array.isArray(this.schema)?this.columns:{};if(!Array.isArray(this.schema))for(let n in this.schema){let i=this.schema[n];t[i.name]=this.columns[i.index]}return this.columns={},{shape:"columnar-table",batchType:"data",data:t,schema:this.schema,length:this.length}}_reallocateColumns(){if(!(this.length<this.allocated)){this.allocated=this.allocated>0?this.allocated*=2:100,this.columns={};for(let t in this.schema){let e=this.schema[t],n=e.type||Float32Array,i=this.columns[e.index];if(i&&ArrayBuffer.isView(i)){let s=new n(this.allocated);s.set(i),this.columns[e.index]=s}else i?(i.length=this.allocated,this.columns[e.index]=i):this.columns[e.index]=new n(this.allocated)}}}_pruneColumns(){for(let[t,e]of Object.entries(this.columns))this.columns[t]=e.slice(0,this.length)}};var wf={shape:void 0,batchSize:"auto",batchDebounceMs:0,limit:0,_limitMB:0},_f="TableBatchBuilder",ss=class{schema;options;aggregator=null;batchCount=0;bytesUsed=0;isChunkComplete=!1;lastBatchEmittedMs=Date.now();totalLength=0;totalBytes=0;rowBytes=0;constructor(t,e){this.schema=t,this.options={...wf,...e}}limitReached(){return!!(Boolean(this.options?.limit)&&this.totalLength>=this.options.limit||Boolean(this.options?._limitMB)&&this.totalBytes/1e6>=this.options._limitMB)}addRow(t){this.limitReached()||(this.totalLength++,this.rowBytes=this.rowBytes||this._estimateRowMB(t),this.totalBytes+=this.rowBytes,Array.isArray(t)?this.addArrayRow(t):this.addObjectRow(t))}addArrayRow(t){if(!this.aggregator){let e=this._getTableBatchType();this.aggregator=new e(this.schema,this.options)}this.aggregator.addArrayRow(t)}addObjectRow(t){if(!this.aggregator){let e=this._getTableBatchType();this.aggregator=new e(this.schema,this.options)}this.aggregator.addObjectRow(t)}chunkComplete(t){t instanceof ArrayBuffer&&(this.bytesUsed+=t.byteLength),typeof t=="string"&&(this.bytesUsed+=t.length),this.isChunkComplete=!0}getFullBatch(t){return this._isFull()?this._getBatch(t):null}getFinalBatch(t){return this._getBatch(t)}_estimateRowMB(t){return Array.isArray(t)?t.length*8:Object.keys(t).length*8}_isFull(){if(!this.aggregator||this.aggregator.rowCount()===0)return!1;if(this.options.batchSize==="auto"){if(!this.isChunkComplete)return!1}else if(this.options.batchSize>this.aggregator.rowCount())return!1;return this.options.batchDebounceMs>Date.now()-this.lastBatchEmittedMs?!1:(this.isChunkComplete=!1,this.lastBatchEmittedMs=Date.now(),!0)}_getBatch(t){if(!this.aggregator)return null;t?.bytesUsed&&(this.bytesUsed=t.bytesUsed);let e=this.aggregator.getBatch();return e.count=this.batchCount,e.bytesUsed=this.bytesUsed,Object.assign(e,t),this.batchCount++,this.aggregator=null,e}_getTableBatchType(){switch(this.options.shape){case"array-row-table":case"object-row-table":return is;case"columnar-table":return Er;case"arrow-table":if(!ss.ArrowBatch)throw new Error(_f);return ss.ArrowBatch;default:return ns}}},gn=ss;rs(gn,"ArrowBatch");function os(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 Ac(r,t,e){switch(r.shape){case"array-row-table":let n=vf(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 s=r.data,o=s.schema.fields.findIndex(a=>a.name===e);return s.getChildAt(o)?.get(t);default:throw new Error("todo")}}function vf(r,t){let e=r.schema?.fields.findIndex(n=>n.name===t);if(e===void 0)throw new Error(t);return e}function Tc(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,u]of Object.entries(r.data))c[l]=u[t];return c}case"arrow-table":let i=r.data,s=e||{},o=i.get(t),a=i.schema;for(let c=0;c<a.fields.length;c++)s[a.fields[c].name]=o?.[a.fields[c].name];return s;default:throw new Error("shape")}}function Dc(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 u of Object.values(r.data))c[l]=u[t],l++;return c}case"arrow-table":let i=r.data,s=e||[],o=i.get(t),a=i.schema;for(let c=0;c<a.fields.length;c++)s[c]=o?.[a.fields[c].name];return s;default:throw new Error("shape")}}function as(r,t="float32"){return r instanceof Date?"date-millisecond":r instanceof Number?t:typeof r=="string"?"utf8":(r===null||r==="undefined","null")}function Oc(r){let t=If(r);return t!=="null"?{type:t,nullable:!1}:r.length>0?(t=as(r[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function If(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 Fc(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 Mc(r){switch(r.shape){case"array-row-table":case"object-row-table":return Sf(r.data);case"columnar-table":return xf(r.data);case"arrow-table":default:throw new Error("Deduce schema")}}function xf(r){let t=[];for(let[e,n]of Object.entries(r)){let i=Bf(n,e);t.push(i)}return{fields:t,metadata:{}}}function Sf(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(Af(i,n));return{fields:t,metadata:{}}}function Bf(r,t){if(ArrayBuffer.isView(r)){let e=Oc(r);return{name:t,type:e.type||"null",nullable:e.nullable}}if(Array.isArray(r)&&r.length>0){let e=r[0],n=as(e);return{name:t,type:n,nullable:!0}}throw new Error("empty table")}function Af(r,t){let e=as(r);return{name:t,type:e,nullable:!0}}function Lc(r,t){let e=Fc(r.type,r.nullable);return new e(t)}function cs(r,t){switch(t){case"object-row-table":return Ff(r);case"array-row-table":return Of(r);case"columnar-table":return Df(r);case"arrow-table":return Tf(r);default:throw new Error(t)}}function Tf(r){let t=globalThis.__loaders?._makeArrowTable;if(!t)throw new Error("");return t(r)}function Df(r){let t=r.schema||Mc(r),e=r.schema?.fields||[];if(r.shape==="columnar-table")return{...r,schema:t};let n=os(r),i={};for(let s of e){let o=Lc(s,n);i[s.name]=o;for(let a=0;a<n;a++)o[a]=Ac(r,a,s.name)}return{shape:"columnar-table",schema:t,data:i}}function Of(r){if(r.shape==="array-row-table")return r;let t=os(r),e=new Array(t);for(let n=0;n<t;n++)e[n]=Dc(r,n);return{shape:"array-row-table",schema:r.schema,data:e}}function Ff(r){if(r.shape==="object-row-table")return r;let t=os(r),e=new Array(t);for(let n=0;n<t;n++)e[n]=Tc(r,n);return{shape:"object-row-table",schema:r.schema,data:e}}function Uc(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 y(r,t,e,n){function i(s){return s instanceof e?s:new e(function(o){o(s)})}return new(e||(e=Promise))(function(s,o){function a(u){try{l(n.next(u))}catch(h){o(h)}}function c(u){try{l(n.throw(u))}catch(h){o(h)}}function l(u){u.done?s(u.value):i(u.value).then(a,c)}l((n=n.apply(r,t||[])).next())})}function Nc(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 U(r){return this instanceof U?(this.v=r,this):new U(r)}function oe(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),i,s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(d){n[d]&&(i[d]=function(b){return new Promise(function(M,z){s.push([d,b,M,z])>1||a(d,b)})})}function a(d,b){try{c(n[d](b))}catch(M){h(s[0][3],M)}}function c(d){d.value instanceof U?Promise.resolve(d.value.v).then(l,u):h(s[0][2],d)}function l(d){a("next",d)}function u(d){a("throw",d)}function h(d,b){d(b),s.shift(),s.length&&a(s[0][0],s[0][1])}}function bn(r){var t,e;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,s){t[i]=r[i]?function(o){return(e=!e)?{value:U(r[i](o)),done:!1}:s?s(o):o}:s}}function Te(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 Nc=="function"?Nc(r):r[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(s){e[s]=r[s]&&function(o){return new Promise(function(a,c){o=r[s](o),i(a,c,o.done,o.value)})}}function i(s,o,a,c){Promise.resolve(c).then(function(l){s({value:l,done:a})},o)}}var ea={};xr(ea,{compareArrayLike:()=>ta,joinUint8Arrays:()=>ce,memcpy:()=>ti,rebaseValueOffsets:()=>ys,toArrayBufferView:()=>C,toArrayBufferViewAsyncIterator:()=>Oe,toArrayBufferViewIterator:()=>ke,toBigInt64Array:()=>ms,toBigUint64Array:()=>kf,toFloat32Array:()=>Vf,toFloat32ArrayAsyncIterator:()=>rh,toFloat32ArrayIterator:()=>Kf,toFloat64Array:()=>jf,toFloat64ArrayAsyncIterator:()=>nh,toFloat64ArrayIterator:()=>Zf,toInt16Array:()=>Rf,toInt16ArrayAsyncIterator:()=>Qf,toInt16ArrayIterator:()=>Gf,toInt32Array:()=>Rr,toInt32ArrayAsyncIterator:()=>qf,toInt32ArrayIterator:()=>$f,toInt8Array:()=>Ef,toInt8ArrayAsyncIterator:()=>Xf,toInt8ArrayIterator:()=>Wf,toUint16Array:()=>Cf,toUint16ArrayAsyncIterator:()=>th,toUint16ArrayIterator:()=>Hf,toUint32Array:()=>Pf,toUint32ArrayAsyncIterator:()=>eh,toUint32ArrayIterator:()=>Yf,toUint8Array:()=>T,toUint8ArrayAsyncIterator:()=>qo,toUint8ArrayIterator:()=>Qo,toUint8ClampedArray:()=>zf,toUint8ClampedArrayAsyncIterator:()=>ih,toUint8ClampedArrayIterator:()=>Jf});var Mf=new TextDecoder("utf-8"),Qn=r=>Mf.decode(r),Lf=new TextEncoder,Pe=r=>Lf.encode(r);var Nf=r=>typeof r=="number",Ec=r=>typeof r=="boolean",wt=r=>typeof r=="function",Rt=r=>r!=null&&Object(r)===r,ae=r=>Rt(r)&&wt(r.then);var De=r=>Rt(r)&&wt(r[Symbol.iterator]),de=r=>Rt(r)&&wt(r[Symbol.asyncIterator]),ls=r=>Rt(r)&&Rt(r.schema);var us=r=>Rt(r)&&"done"in r&&"value"in r;var fs=r=>Rt(r)&&wt(r.stat)&&Nf(r.fd);var hs=r=>Rt(r)&&qn(r.body),ds=r=>"_getDOMStream"in r&&"_getNodeStream"in r,Rc=r=>Rt(r)&&wt(r.abort)&&wt(r.getWriter)&&!ds(r),qn=r=>Rt(r)&&wt(r.cancel)&&wt(r.getReader)&&!ds(r),Cc=r=>Rt(r)&&wt(r.end)&&wt(r.write)&&Ec(r.writable)&&!ds(r),ps=r=>Rt(r)&&wt(r.read)&&wt(r.pipe)&&Ec(r.readable)&&!ds(r),Pc=r=>Rt(r)&&wt(r.clear)&&wt(r.bytes)&&wt(r.position)&&wt(r.setPosition)&&wt(r.capacity)&&wt(r.getBufferIdentifier)&&wt(r.createLong);var Xo=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Uf(r){let t=r[0]?[r[0]]:[],e,n,i,s;for(let o,a,c=0,l=0,u=r.length;++c<u;){if(o=t[l],a=r[c],!o||!a||o.buffer!==a.buffer||a.byteOffset<o.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:e,byteLength:i}=o,{byteOffset:n,byteLength:s}=a,e+i<n||n+s<e){a&&(t[++l]=a);continue}t[l]=new Uint8Array(o.buffer,e,n-e+s)}return t}function ti(r,t,e=0,n=t.byteLength){let i=r.byteLength,s=new Uint8Array(r.buffer,r.byteOffset,i),o=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return s.set(o,e),r}function ce(r,t){let e=Uf(r),n=e.reduce((u,h)=>u+h.byteLength,0),i,s,o,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let u=e.length;++c<u;){if(i=e[c],s=i.subarray(0,Math.min(i.length,l-a)),l<=a+s.length){s.length<i.length?e[c]=i.subarray(s.length):s.length===i.length&&c++,o?ti(o,s,a):o=s;break}ti(o||(o=new Uint8Array(l)),s,a),a+=s.length}return[o||new Uint8Array(0),e.slice(c),n-(o?o.byteLength:0)]}function C(r,t){let e=us(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=Pe(e)),e instanceof ArrayBuffer?new r(e):e instanceof Xo?new r(e):Pc(e)?C(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 Ef=r=>C(Int8Array,r),Rf=r=>C(Int16Array,r),Rr=r=>C(Int32Array,r),ms=r=>C(BigInt64Array,r),T=r=>C(Uint8Array,r),Cf=r=>C(Uint16Array,r),Pf=r=>C(Uint32Array,r),kf=r=>C(BigUint64Array,r),Vf=r=>C(Float32Array,r),jf=r=>C(Float64Array,r),zf=r=>C(Uint8ClampedArray,r),Jo=r=>(r.next(),r);function*ke(r,t){let e=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Xo?e(t):De(t)?t:e(t);return yield*Jo(function*(i){let s=null;do s=i.next(yield C(r,s));while(!s.done)}(n[Symbol.iterator]())),new r}var Wf=r=>ke(Int8Array,r),Gf=r=>ke(Int16Array,r),$f=r=>ke(Int32Array,r),Qo=r=>ke(Uint8Array,r),Hf=r=>ke(Uint16Array,r),Yf=r=>ke(Uint32Array,r),Kf=r=>ke(Float32Array,r),Zf=r=>ke(Float64Array,r),Jf=r=>ke(Uint8ClampedArray,r);function Oe(r,t){return oe(this,arguments,function*(){if(ae(t))return yield U(yield U(yield*bn(Te(Oe(r,yield U(t))))));let n=function(o){return oe(this,arguments,function*(){yield yield U(yield U(o))})},i=function(o){return oe(this,arguments,function*(){yield U(yield*bn(Te(Jo(function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)}(o[Symbol.iterator]())))))})},s=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof Xo?n(t):De(t)?i(t):de(t)?t:n(t);return yield U(yield*bn(Te(Jo(function(o){return oe(this,arguments,function*(){let a=null;do a=yield U(o.next(yield yield U(C(r,a))));while(!a.done)})}(s[Symbol.asyncIterator]()))))),yield U(new r)})}var Xf=r=>Oe(Int8Array,r),Qf=r=>Oe(Int16Array,r),qf=r=>Oe(Int32Array,r),qo=r=>Oe(Uint8Array,r),th=r=>Oe(Uint16Array,r),eh=r=>Oe(Uint32Array,r),rh=r=>Oe(Float32Array,r),nh=r=>Oe(Float64Array,r),ih=r=>Oe(Uint8ClampedArray,r);function ys(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 ta(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 gs(sh(r))},fromAsyncIterable(r){return gs(oh(r))},fromDOMStream(r){return gs(ah(r))},fromNodeStream(r){return gs(ch(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')}},gs=r=>(r.next(),r);function*sh(r){let t,e=!1,n=[],i,s,o,a=0;function c(){return s==="peek"?ce(n,o)[0]:([i,n,a]=ce(n,o),i)}({cmd:s,size:o}=(yield(()=>null)())||{cmd:"read",size:0});let l=Qo(r)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(o-a)?l.next():l.next(o-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||o<=a)do({cmd:s,size:o}=yield c());while(o<a);while(!t)}catch(u){(e=!0)&&typeof l.throw=="function"&&l.throw(u)}finally{e===!1&&typeof l.return=="function"&&l.return(null)}return null}function oh(r){return oe(this,arguments,function*(){let e,n=!1,i=[],s,o,a,c=0;function l(){return o==="peek"?ce(i,a)[0]:([s,i,c]=ce(i,a),s)}({cmd:o,size:a}=(yield yield U((()=>null)()))||{cmd:"read",size:0});let u=qo(r)[Symbol.asyncIterator]();try{do if({done:e,value:s}=Number.isNaN(a-c)?yield U(u.next()):yield U(u.next(a-c)),!e&&s.byteLength>0&&(i.push(s),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield U(l()));while(a<c);while(!e)}catch(h){(n=!0)&&typeof u.throw=="function"&&(yield U(u.throw(h)))}finally{n===!1&&typeof u.return=="function"&&(yield U(u.return(new Uint8Array(0))))}return yield U(null)})}function ah(r){return oe(this,arguments,function*(){let e=!1,n=!1,i=[],s,o,a,c=0;function l(){return o==="peek"?ce(i,a)[0]:([s,i,c]=ce(i,a),s)}({cmd:o,size:a}=(yield yield U((()=>null)()))||{cmd:"read",size:0});let u=new na(r);try{do if({done:e,value:s}=Number.isNaN(a-c)?yield U(u.read()):yield U(u.read(a-c)),!e&&s.byteLength>0&&(i.push(T(s)),c+=s.byteLength),e||a<=c)do({cmd:o,size:a}=yield yield U(l()));while(a<c);while(!e)}catch(h){(n=!0)&&(yield U(u.cancel(h)))}finally{n===!1?yield U(u.cancel()):r.locked&&u.releaseLock()}return yield U(null)})}var na=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 y(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 y(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=T(e)),e})}},ra=(r,t)=>{let e=i=>n([t,i]),n;return[t,e,new Promise(i=>(n=i)&&r.once(t,e))]};function ch(r){return oe(this,arguments,function*(){let e=[],n="error",i=!1,s=null,o,a,c=0,l=[],u;function h(){return o==="peek"?ce(l,a)[0]:([u,l,c]=ce(l,a),u)}if({cmd:o,size:a}=(yield yield U((()=>null)()))||{cmd:"read",size:0},r.isTTY)return yield yield U(new Uint8Array(0)),yield U(null);try{e[0]=ra(r,"end"),e[1]=ra(r,"error");do{if(e[2]=ra(r,"readable"),[n,s]=yield U(Promise.race(e.map(b=>b[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(u=T(r.read(a-c)),u.byteLength<a-c&&(u=T(r.read()))):u=T(r.read()),u.byteLength>0&&(l.push(u),c+=u.byteLength)),i||a<=c)do({cmd:o,size:a}=yield yield U(h()));while(a<c)}while(!i)}finally{yield U(d(e,n==="error"?s:null))}return yield U(null);function d(b,M){return u=l=null,new Promise((z,X)=>{for(let[st,yn]of b)r.off(st,yn);try{let st=r.destroy;st&&st.call(r,M),M=void 0}catch(st){M=st||M}finally{M!=null?X(M):z()}})}})}var $;(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"})($||($={}));var K;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(K||(K={}));var j;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(j||(j={}));var et;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(et||(et={}));var p;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(p||(p={}));var nt;(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"})(nt||(nt={}));var Ve=new Int32Array(2),bs=new Float32Array(Ve.buffer),ws=new Float64Array(Ve.buffer),wn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var ei;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(ei||(ei={}));var Ct=class{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new Ct(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 Ve[0]=this.readInt32(t),bs[0]}readFloat64(t){return Ve[wn?0:1]=this.readInt32(t),Ve[wn?1:0]=this.readInt32(t+4),ws[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){bs[0]=e,this.writeInt32(t,Ve[0])}writeFloat64(t,e){ws[0]=e,this.writeInt32(t,Ve[wn?0:1]),this.writeInt32(t+4,Ve[wn?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===ei.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,e){return typeof t=="string"?this.__string(e):this.__union(t,e)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let e=0;e<4;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+4+e))return!1;return!0}createScalarList(t,e){let n=[];for(let i=0;i<e;++i){let s=t(i);s!==null&&n.push(s)}return n}createObjList(t,e){let n=[];for(let i=0;i<e;++i){let s=t(i);s!==null&&n.push(s.unpack())}return n}};var ar=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=Ct.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=ar.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=Ct.allocate(n);return i.setPosition(n-e),i.bytes().set(t.bytes(),n-e),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let e=0;e<t;e++)this.vtable[e]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);let n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);let i=2;this.addInt16(t-this.object_start);let s=(n+i)*2;this.addInt16(s);let o=0,a=this.space;t:for(e=0;e<this.vtables.length;e++){let c=this.bb.capacity()-this.vtables[e];if(s==this.bb.readInt16(c)){for(let l=2;l<s;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;o=this.vtables[e];break}}return o?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,o-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,n){let i=n?4:0;if(e){let s=e;if(this.prep(this.minalign,4+4+i),s.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let o=4-1;o>=0;o--)this.writeInt8(s.charCodeAt(o))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(e<this.bb.readInt16(i)&&this.bb.readInt16(i+e)!=0))throw new TypeError("FlatBuffers: field "+e+" must be set")}startVector(t,e,n){this.notNested(),this.vector_num_elems=e,this.prep(4,t*e),this.prep(n,t*e)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(t==null)return 0;let e;t instanceof Uint8Array?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length);for(let n=0,i=this.space,s=this.bb.bytes();n<e.length;n++)s[i++]=e[n];return this.endVector()}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let e=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)e.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return e}createStructOffsetList(t,e){return e(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}};var ri;(function(r){r[r.BUFFER=0]="BUFFER"})(ri||(ri={}));var ni;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(ni||(ni={}));var Me=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 Me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+4),(e||new Me).__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):ni.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):ri.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,ni.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,ri.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return Me.startBodyCompression(t),Me.addCodec(t,e),Me.addMethod(t,n),Me.endBodyCompression(t)}};var _n=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 vn=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 Ft=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 Ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+4),(e||new Ft).__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 vn).__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 _n).__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 Me).__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 me=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 me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+4),(e||new me).__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 Ft).__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 Sr;(function(r){r[r.Little=0]="Little",r[r.Big=1]="Big"})(Sr||(Sr={}));var ii;(function(r){r[r.DenseArray=0]="DenseArray"})(ii||(ii={}));var _t=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 _t).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+4),(e||new _t).__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 _t.startInt(t),_t.addBitWidth(t,e),_t.addIsSigned(t,n),_t.endInt(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 getRootAsDictionaryEncoding(t,e){return(e||new le).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+4),(e||new le).__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 _t).__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):ii.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,ii.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}};var Q=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 Q).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+4),(e||new Q).__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 Q.startKeyValue(t),Q.addKey(t,e),Q.addValue(t,n),Q.endKeyValue(t)}};var je=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 je).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+4),(e||new je).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return je.startBinary(t),je.endBinary(t)}};var ze=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 ze).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+4),(e||new ze).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return ze.startBool(t),ze.endBool(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 getRootAsDate(t,e){return(e||new Gt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+4),(e||new Gt).__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):et.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,et.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return Gt.startDate(t),Gt.addUnit(t,e),Gt.endDate(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 getRootAsDecimal(t,e){return(e||new vt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+4),(e||new vt).__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 vt.startDecimal(t),vt.addPrecision(t,e),vt.addScale(t,n),vt.addBitWidth(t,i),vt.endDecimal(t)}};var $t=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 $t).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+4),(e||new $t).__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):p.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,p.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return $t.startDuration(t),$t.addUnit(t,e),$t.endDuration(t)}};var Ht=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 Ht).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+4),(e||new Ht).__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 Ht.startFixedSizeBinary(t),Ht.addByteWidth(t,e),Ht.endFixedSizeBinary(t)}};var Yt=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 Yt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+4),(e||new Yt).__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 Yt.startFixedSizeList(t),Yt.addListSize(t,e),Yt.endFixedSizeList(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 getRootAsFloatingPoint(t,e){return(e||new Kt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+4),(e||new Kt).__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):j.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,j.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return Kt.startFloatingPoint(t),Kt.addPrecision(t,e),Kt.endFloatingPoint(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 getRootAsInterval(t,e){return(e||new Zt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+4),(e||new Zt).__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):nt.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,nt.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return Zt.startInterval(t),Zt.addUnit(t,e),Zt.endInterval(t)}};var We=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 We).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+4),(e||new We).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return We.startLargeBinary(t),We.endLargeBinary(t)}};var Ge=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 Ge).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+4),(e||new Ge).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return Ge.startLargeUtf8(t),Ge.endLargeUtf8(t)}};var $e=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 $e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+4),(e||new $e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return $e.startList(t),$e.endList(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 getRootAsMap(t,e){return(e||new Jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+4),(e||new Jt).__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 Jt.startMap(t),Jt.addKeysSorted(t,e),Jt.endMap(t)}};var He=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 He).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+4),(e||new He).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return He.startNull(t),He.endNull(t)}};var Ye=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 Ye).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+4),(e||new Ye).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return Ye.startStruct_(t),Ye.endStruct_(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 getRootAsTime(t,e){return(e||new Mt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+4),(e||new Mt).__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):p.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,p.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return Mt.startTime(t),Mt.addUnit(t,e),Mt.addBitWidth(t,n),Mt.endTime(t)}};var Lt=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 Lt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+4),(e||new Lt).__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):p.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,p.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return Lt.startTimestamp(t),Lt.addUnit(t,e),Lt.addTimezone(t,n),Lt.endTimestamp(t)}};var It=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 It).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+4),(e||new It).__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):K.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,K.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 It.startUnion(t),It.addMode(t,e),It.addTypeIds(t,n),It.endUnion(t)}};var Ke=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 Ke).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+4),(e||new Ke).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return Ke.startUtf8(t),Ke.endUtf8(t)}};var Z;(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"})(Z||(Z={}));var dt=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 dt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+4),(e||new dt).__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):Z.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 le).__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 dt).__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 Q).__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,Z.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 ot=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 ot).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+4),(e||new ot).__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):Sr.Little}fields(t,e){let n=this.bb.__offset(this.bb_pos,6);return n?(e||new dt).__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 Q).__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,Sr.Little)}static addFields(t,e){t.addFieldOffset(1,e,0)}static createFieldsVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startFieldsVector(t,e){t.startVector(4,e,4)}static addCustomMetadata(t,e){t.addFieldOffset(2,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static addFeatures(t,e){t.addFieldOffset(3,e,0)}static createFeaturesVector(t,e){t.startVector(8,e.length,8);for(let n=e.length-1;n>=0;n--)t.addInt64(e[n]);return t.endVector()}static startFeaturesVector(t,e){t.startVector(8,e,8)}static endSchema(t){return t.endObject()}static finishSchemaBuffer(t,e){t.finish(e)}static finishSizePrefixedSchemaBuffer(t,e){t.finish(e,void 0,!0)}static createSchema(t,e,n,i,s){return ot.startSchema(t),ot.addEndianness(t,e),ot.addFields(t,n),ot.addCustomMetadata(t,i),ot.addFeatures(t,s),ot.endSchema(t)}};var P;(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"})(P||(P={}));var f;(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"})(f||(f={}));var lt;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(lt||(lt={}));var Ia={};xr(Ia,{clampIndex:()=>Zh,clampRange:()=>ai,createElementComparator:()=>Dr});var ia={};xr(ia,{valueToString:()=>Le});function Le(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=>Le(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}var oa={};xr(oa,{BN:()=>Cr,bigNumToBigInt:()=>jc,bigNumToString:()=>Sn,isArrowBigNumSymbol:()=>kc});var kc=Symbol.for("isArrowBigNum");function Ne(r,...t){return t.length===0?Object.setPrototypeOf(C(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}Ne.prototype[kc]=!0;Ne.prototype.toJSON=function(){return`"${Sn(this)}"`};Ne.prototype.valueOf=function(){return Vc(this)};Ne.prototype.toString=function(){return Sn(this)};Ne.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Vc(this);case"string":return Sn(this);case"default":return jc(this)}return Sn(this)};function In(...r){return Ne.apply(this,r)}function xn(...r){return Ne.apply(this,r)}function si(...r){return Ne.apply(this,r)}Object.setPrototypeOf(In.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(xn.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(si.prototype,Object.create(Uint32Array.prototype));Object.assign(In.prototype,Ne.prototype,{constructor:In,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(xn.prototype,Ne.prototype,{constructor:xn,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(si.prototype,Ne.prototype,{constructor:si,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});function Vc(r){let{buffer:t,byteOffset:e,length:n,signed:i}=r,s=new BigUint64Array(t,e,n),o=i&&s.at(-1)&BigInt(1)<<BigInt(63),a=BigInt(o?1:0),c=BigInt(0);if(o){for(let l of s)a+=~l*(BigInt(1)<<BigInt(32)*c++);a*=BigInt(-1)}else for(let l of s)a+=l*(BigInt(1)<<BigInt(32)*c++);return a}var Sn=r=>{if(r.byteLength===8)return`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`;if(!r.signed)return sa(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return sa(r);t=t.slice();let n=1;for(let s=0;s<t.length;s++){let o=t[s],a=~o+n;t[s]=a,n&=o===0?1:0}return`-${sa(t)}`},jc=r=>r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:Sn(r);function sa(r){let t="",e=new Uint32Array(2),n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),s=-1,o=n.length-1;do{for(e[0]=n[s=0];s<o;)n[s++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+n[s];n[s]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t=`${e[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var Cr=class{static new(t,e){switch(e){case!0:return new In(t);case!1:return new xn(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new In(t)}return t.byteLength===16?new si(t):new xn(t)}static signed(t){return new In(t)}static unsigned(t){return new xn(t)}static decimal(t){return new si(t)}constructor(t,e){return Cr.new(t,e)}};function at(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)}var zc,Wc,Gc,$c,Hc,Yc,Kc,Zc,Jc,Xc,Qc,qc,tl,el,rl,nl,il,sl,ol,al,cl,ll,m=class{static isNull(t){return t?.typeId===f.Null}static isInt(t){return t?.typeId===f.Int}static isFloat(t){return t?.typeId===f.Float}static isBinary(t){return t?.typeId===f.Binary}static isLargeBinary(t){return t?.typeId===f.LargeBinary}static isUtf8(t){return t?.typeId===f.Utf8}static isLargeUtf8(t){return t?.typeId===f.LargeUtf8}static isBool(t){return t?.typeId===f.Bool}static isDecimal(t){return t?.typeId===f.Decimal}static isDate(t){return t?.typeId===f.Date}static isTime(t){return t?.typeId===f.Time}static isTimestamp(t){return t?.typeId===f.Timestamp}static isInterval(t){return t?.typeId===f.Interval}static isDuration(t){return t?.typeId===f.Duration}static isList(t){return t?.typeId===f.List}static isStruct(t){return t?.typeId===f.Struct}static isUnion(t){return t?.typeId===f.Union}static isFixedSizeBinary(t){return t?.typeId===f.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===f.FixedSizeList}static isMap(t){return t?.typeId===f.Map}static isDictionary(t){return t?.typeId===f.Dictionary}static isDenseUnion(t){return m.isUnion(t)&&t.mode===K.Dense}static isSparseUnion(t){return m.isUnion(t)&&t.mode===K.Sparse}constructor(t){this.typeId=t}};zc=Symbol.toStringTag;m[zc]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(m.prototype);var ut=class extends m{constructor(){super(f.Null)}toString(){return"Null"}};Wc=Symbol.toStringTag;ut[Wc]=(r=>r[Symbol.toStringTag]="Null")(ut.prototype);var it=class extends m{constructor(t,e){super(f.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}`}};Gc=Symbol.toStringTag;it[Gc]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(it.prototype);var ye=class extends it{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},ge=class extends it{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},pt=class extends it{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},be=class extends it{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},we=class extends it{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},_e=class extends it{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},ve=class extends it{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},Ze=class extends it{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(ye.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(ge.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(pt.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(be.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(we.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(_e.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(ve.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(Ze.prototype,"ArrayType",{value:BigUint64Array});var At=class extends m{constructor(t){super(f.Float),this.precision=t}get ArrayType(){switch(this.precision){case j.HALF:return Uint16Array;case j.SINGLE:return Float32Array;case j.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};$c=Symbol.toStringTag;At[$c]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(At.prototype);var Br=class extends At{constructor(){super(j.HALF)}},Xt=class extends At{constructor(){super(j.SINGLE)}},Qt=class extends At{constructor(){super(j.DOUBLE)}};Object.defineProperty(Br.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Xt.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(Qt.prototype,"ArrayType",{value:Float64Array});var ue=class extends m{constructor(){super(f.Binary)}toString(){return"Binary"}};Hc=Symbol.toStringTag;ue[Hc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(ue.prototype);var Je=class extends m{constructor(){super(f.LargeBinary)}toString(){return"LargeBinary"}};Yc=Symbol.toStringTag;Je[Yc]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(Je.prototype);var Pt=class extends m{constructor(){super(f.Utf8)}toString(){return"Utf8"}};Kc=Symbol.toStringTag;Pt[Kc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Pt.prototype);var Xe=class extends m{constructor(){super(f.LargeUtf8)}toString(){return"LargeUtf8"}};Zc=Symbol.toStringTag;Xe[Zc]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Xe.prototype);var kt=class extends m{constructor(){super(f.Bool)}toString(){return"Bool"}};Jc=Symbol.toStringTag;kt[Jc]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(kt.prototype);var fe=class extends m{constructor(t,e,n=128){super(f.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};Xc=Symbol.toStringTag;fe[Xc]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(fe.prototype);var qt=class extends m{constructor(t){super(f.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${et[this.unit]}>`}};Qc=Symbol.toStringTag;qt[Qc]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Date"))(qt.prototype);var Pr=class extends qt{constructor(){super(et.DAY)}},cr=class extends qt{constructor(){super(et.MILLISECOND)}},xt=class extends m{constructor(t,e){super(f.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${p[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};qc=Symbol.toStringTag;xt[qc]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(xt.prototype);var kr=class extends xt{constructor(){super(p.SECOND,32)}},Vr=class extends xt{constructor(){super(p.MILLISECOND,32)}},jr=class extends xt{constructor(){super(p.MICROSECOND,64)}},zr=class extends xt{constructor(){super(p.NANOSECOND,64)}},Nt=class extends m{constructor(t,e){super(f.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${p[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};tl=Symbol.toStringTag;Nt[tl]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Timestamp"))(Nt.prototype);var Wr=class extends Nt{constructor(t){super(p.SECOND,t)}},Gr=class extends Nt{constructor(t){super(p.MILLISECOND,t)}},$r=class extends Nt{constructor(t){super(p.MICROSECOND,t)}},Hr=class extends Nt{constructor(t){super(p.NANOSECOND,t)}},te=class extends m{constructor(t){super(f.Interval),this.unit=t}toString(){return`Interval<${nt[this.unit]}>`}};el=Symbol.toStringTag;te[el]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(te.prototype);var Yr=class extends te{constructor(){super(nt.DAY_TIME)}},Kr=class extends te{constructor(){super(nt.YEAR_MONTH)}},Qe=class extends m{constructor(t){super(f.Duration),this.unit=t}toString(){return`Duration<${p[this.unit]}>`}};rl=Symbol.toStringTag;Qe[rl]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(Qe.prototype);var Tt=class extends m{constructor(t){super(f.List),this.children=[t]}toString(){return`List<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};nl=Symbol.toStringTag;Tt[nl]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(Tt.prototype);var V=class extends m{constructor(t){super(f.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};il=Symbol.toStringTag;V[il]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(V.prototype);var Ie=class extends m{constructor(t,e,n){super(f.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((i,s,o)=>(i[s]=o)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};sl=Symbol.toStringTag;Ie[sl]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(Ie.prototype);var qe=class extends m{constructor(t){super(f.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};ol=Symbol.toStringTag;qe[ol]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(qe.prototype);var Vt=class extends m{constructor(t,e){super(f.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}>`}};al=Symbol.toStringTag;Vt[al]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(Vt.prototype);var jt=class extends m{constructor(t,e=!1){var n,i,s;if(super(f.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){let o=(i=t?.type)===null||i===void 0?void 0:i.children[0];o&&(o.name="key");let a=(s=t?.type)===null||s===void 0?void 0:s.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(", ")}}>`}};cl=Symbol.toStringTag;jt[cl]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(jt.prototype);var lh=(r=>()=>++r)(-1),Ut=class extends m{constructor(t,e,n,i){super(f.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?lh():at(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}>`}};ll=Symbol.toStringTag;Ut[ll]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Ut.prototype);function he(r){let t=r;switch(r.typeId){case f.Decimal:return r.bitWidth/32;case f.Timestamp:return 2;case f.Date:return 1+t.unit;case f.Interval:return 1+t.unit;case f.FixedSizeList:return t.listSize;case f.FixedSizeBinary:return t.byteWidth;default:return 1}}var v=class{visitMany(t,...e){return t.map((n,i)=>this.visit(n,...e.map(s=>s[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return uh(this,t,e)}getVisitFnByTypeId(t,e=!0){return Bn(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 uh(r,t,e=!0){return typeof t=="number"?Bn(r,t,e):typeof t=="string"&&t in f?Bn(r,f[t],e):t&&t instanceof m?Bn(r,fl(t),e):t?.type&&t.type instanceof m?Bn(r,fl(t.type),e):Bn(r,f.NONE,e)}function Bn(r,t,e=!0){let n=null;switch(t){case f.Null:n=r.visitNull;break;case f.Bool:n=r.visitBool;break;case f.Int:n=r.visitInt;break;case f.Int8:n=r.visitInt8||r.visitInt;break;case f.Int16:n=r.visitInt16||r.visitInt;break;case f.Int32:n=r.visitInt32||r.visitInt;break;case f.Int64:n=r.visitInt64||r.visitInt;break;case f.Uint8:n=r.visitUint8||r.visitInt;break;case f.Uint16:n=r.visitUint16||r.visitInt;break;case f.Uint32:n=r.visitUint32||r.visitInt;break;case f.Uint64:n=r.visitUint64||r.visitInt;break;case f.Float:n=r.visitFloat;break;case f.Float16:n=r.visitFloat16||r.visitFloat;break;case f.Float32:n=r.visitFloat32||r.visitFloat;break;case f.Float64:n=r.visitFloat64||r.visitFloat;break;case f.Utf8:n=r.visitUtf8;break;case f.LargeUtf8:n=r.visitLargeUtf8;break;case f.Binary:n=r.visitBinary;break;case f.LargeBinary:n=r.visitLargeBinary;break;case f.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case f.Date:n=r.visitDate;break;case f.DateDay:n=r.visitDateDay||r.visitDate;break;case f.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case f.Timestamp:n=r.visitTimestamp;break;case f.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case f.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case f.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case f.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case f.Time:n=r.visitTime;break;case f.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case f.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case f.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case f.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case f.Decimal:n=r.visitDecimal;break;case f.List:n=r.visitList;break;case f.Struct:n=r.visitStruct;break;case f.Union:n=r.visitUnion;break;case f.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case f.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case f.Dictionary:n=r.visitDictionary;break;case f.Interval:n=r.visitInterval;break;case f.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case f.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case f.Duration:n=r.visitDuration;break;case f.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case f.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case f.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case f.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case f.FixedSizeList:n=r.visitFixedSizeList;break;case f.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${f[t]}'`)}function fl(r){switch(r.typeId){case f.Null:return f.Null;case f.Int:{let{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?f.Int8:f.Uint8;case 16:return e?f.Int16:f.Uint16;case 32:return e?f.Int32:f.Uint32;case 64:return e?f.Int64:f.Uint64}return f.Int}case f.Float:switch(r.precision){case j.HALF:return f.Float16;case j.SINGLE:return f.Float32;case j.DOUBLE:return f.Float64}return f.Float;case f.Binary:return f.Binary;case f.LargeBinary:return f.LargeBinary;case f.Utf8:return f.Utf8;case f.LargeUtf8:return f.LargeUtf8;case f.Bool:return f.Bool;case f.Decimal:return f.Decimal;case f.Time:switch(r.unit){case p.SECOND:return f.TimeSecond;case p.MILLISECOND:return f.TimeMillisecond;case p.MICROSECOND:return f.TimeMicrosecond;case p.NANOSECOND:return f.TimeNanosecond}return f.Time;case f.Timestamp:switch(r.unit){case p.SECOND:return f.TimestampSecond;case p.MILLISECOND:return f.TimestampMillisecond;case p.MICROSECOND:return f.TimestampMicrosecond;case p.NANOSECOND:return f.TimestampNanosecond}return f.Timestamp;case f.Date:switch(r.unit){case et.DAY:return f.DateDay;case et.MILLISECOND:return f.DateMillisecond}return f.Date;case f.Interval:switch(r.unit){case nt.DAY_TIME:return f.IntervalDayTime;case nt.YEAR_MONTH:return f.IntervalYearMonth}return f.Interval;case f.Duration:switch(r.unit){case p.SECOND:return f.DurationSecond;case p.MILLISECOND:return f.DurationMillisecond;case p.MICROSECOND:return f.DurationMicrosecond;case p.NANOSECOND:return f.DurationNanosecond}return f.Duration;case f.Map:return f.Map;case f.List:return f.List;case f.Struct:return f.Struct;case f.Union:switch(r.mode){case K.Dense:return f.DenseUnion;case K.Sparse:return f.SparseUnion}return f.Union;case f.FixedSizeBinary:return f.FixedSizeBinary;case f.FixedSizeList:return f.FixedSizeList;case f.Dictionary:return f.Dictionary}throw new Error(`Unrecognized type '${f[r.typeId]}'`)}v.prototype.visitInt8=null;v.prototype.visitInt16=null;v.prototype.visitInt32=null;v.prototype.visitInt64=null;v.prototype.visitUint8=null;v.prototype.visitUint16=null;v.prototype.visitUint32=null;v.prototype.visitUint64=null;v.prototype.visitFloat16=null;v.prototype.visitFloat32=null;v.prototype.visitFloat64=null;v.prototype.visitDateDay=null;v.prototype.visitDateMillisecond=null;v.prototype.visitTimestampSecond=null;v.prototype.visitTimestampMillisecond=null;v.prototype.visitTimestampMicrosecond=null;v.prototype.visitTimestampNanosecond=null;v.prototype.visitTimeSecond=null;v.prototype.visitTimeMillisecond=null;v.prototype.visitTimeMicrosecond=null;v.prototype.visitTimeNanosecond=null;v.prototype.visitDenseUnion=null;v.prototype.visitSparseUnion=null;v.prototype.visitIntervalDayTime=null;v.prototype.visitIntervalYearMonth=null;v.prototype.visitDuration=null;v.prototype.visitDurationSecond=null;v.prototype.visitDurationMillisecond=null;v.prototype.visitDurationMicrosecond=null;v.prototype.visitDurationNanosecond=null;var aa={};xr(aa,{float64ToUint16:()=>oi,uint16ToFloat64:()=>vs});var hl=new Float64Array(1),An=new Uint32Array(hl.buffer);function vs(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 oi(r){if(r!==r)return 32256;hl[0]=r;let t=(An[1]&2147483648)>>16&65535,e=An[1]&2146435072,n=0;return e>=1089470464?An[0]>0?e=31744:(e=(e&2080374784)>>16,n=(An[1]&1048575)>>10):e<=1056964608?(n=1048576+(An[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(An[1]&1048575)+512>>10),t|e|n&65535}var A=class extends v{};function L(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}var fh=(r,t,e)=>{r[t]=Math.trunc(e/864e5)},ca=(r,t,e)=>{r[t]=Math.trunc(e%4294967296),r[t+1]=Math.trunc(e/4294967296)},hh=(r,t,e)=>{r[t]=Math.trunc(e*1e3%4294967296),r[t+1]=Math.trunc(e*1e3/4294967296)},dh=(r,t,e)=>{r[t]=Math.trunc(e*1e6%4294967296),r[t+1]=Math.trunc(e*1e6/4294967296)},dl=(r,t,e,n)=>{if(e+1<t.length){let i=at(t[e]),s=at(t[e+1]);r.set(n.subarray(0,s-i),i)}},ph=({offset:r,values:t},e,n)=>{let i=r+e;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},lr=({values:r},t,e)=>{r[t]=e},la=({values:r},t,e)=>{r[t]=e},pl=({values:r},t,e)=>{r[t]=oi(e)},mh=(r,t,e)=>{switch(r.type.precision){case j.HALF:return pl(r,t,e);case j.SINGLE:case j.DOUBLE:return la(r,t,e)}},Is=({values:r},t,e)=>{fh(r,t,e.valueOf())},xs=({values:r},t,e)=>{ca(r,t*2,e.valueOf())},ua=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},ml=({values:r,valueOffsets:t},e,n)=>dl(r,t,e,n),yl=({values:r,valueOffsets:t},e,n)=>dl(r,t,e,Pe(n)),fa=(r,t,e)=>{r.type.unit===et.DAY?Is(r,t,e):xs(r,t,e)},Ss=({values:r},t,e)=>ca(r,t*2,e/1e3),Bs=({values:r},t,e)=>ca(r,t*2,e),As=({values:r},t,e)=>hh(r,t*2,e),Ts=({values:r},t,e)=>dh(r,t*2,e),ha=(r,t,e)=>{switch(r.type.unit){case p.SECOND:return Ss(r,t,e);case p.MILLISECOND:return Bs(r,t,e);case p.MICROSECOND:return As(r,t,e);case p.NANOSECOND:return Ts(r,t,e)}},Ds=({values:r},t,e)=>{r[t]=e},Os=({values:r},t,e)=>{r[t]=e},Fs=({values:r},t,e)=>{r[t]=e},Ms=({values:r},t,e)=>{r[t]=e},da=(r,t,e)=>{switch(r.type.unit){case p.SECOND:return Ds(r,t,e);case p.MILLISECOND:return Os(r,t,e);case p.MICROSECOND:return Fs(r,t,e);case p.NANOSECOND:return Ms(r,t,e)}},pa=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},yh=(r,t,e)=>{let n=r.children[0],i=r.valueOffsets,s=Dt.getVisitFn(n);if(Array.isArray(e))for(let o=-1,a=i[t],c=i[t+1];a<c;)s(n,a++,e[++o]);else for(let o=-1,a=i[t],c=i[t+1];a<c;)s(n,a++,e.get(++o))},gh=(r,t,e)=>{let n=r.children[0],{valueOffsets:i}=r,s=Dt.getVisitFn(n),{[t]:o,[t+1]:a}=i,c=e instanceof Map?e.entries():Object.entries(e);for(let l of c)if(s(n,o,l),++o>=a)break},bh=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[s]),wh=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(s)),_h=(r,t)=>(e,n,i,s)=>n&&e(n,r,t.get(i.name)),vh=(r,t)=>(e,n,i,s)=>n&&e(n,r,t[i.name]),Ih=(r,t,e)=>{let n=r.type.children.map(s=>Dt.getVisitFn(s.type)),i=e instanceof Map?_h(t,e):e instanceof g?wh(t,e):Array.isArray(e)?bh(t,e):vh(t,e);r.type.children.forEach((s,o)=>i(n[o],r.children[o],s,o))},xh=(r,t,e)=>{r.type.mode===K.Dense?gl(r,t,e):bl(r,t,e)},gl=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Dt.visit(i,r.valueOffsets[t],e)},bl=(r,t,e)=>{let n=r.type.typeIdToChildIndex[r.typeIds[t]],i=r.children[n];Dt.visit(i,t,e)},Sh=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},ma=(r,t,e)=>{r.type.unit===nt.DAY_TIME?Ls(r,t,e):Ns(r,t,e)},Ls=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},Ns=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},Us=({values:r},t,e)=>{r[t]=e},Es=({values:r},t,e)=>{r[t]=e},Rs=({values:r},t,e)=>{r[t]=e},Cs=({values:r},t,e)=>{r[t]=e},ya=(r,t,e)=>{switch(r.type.unit){case p.SECOND:return Us(r,t,e);case p.MILLISECOND:return Es(r,t,e);case p.MICROSECOND:return Rs(r,t,e);case p.NANOSECOND:return Cs(r,t,e)}},Bh=(r,t,e)=>{let{stride:n}=r,i=r.children[0],s=Dt.getVisitFn(i);if(Array.isArray(e))for(let o=-1,a=t*n;++o<n;)s(i,a+o,e[o]);else for(let o=-1,a=t*n;++o<n;)s(i,a+o,e.get(o))};A.prototype.visitBool=L(ph);A.prototype.visitInt=L(lr);A.prototype.visitInt8=L(lr);A.prototype.visitInt16=L(lr);A.prototype.visitInt32=L(lr);A.prototype.visitInt64=L(lr);A.prototype.visitUint8=L(lr);A.prototype.visitUint16=L(lr);A.prototype.visitUint32=L(lr);A.prototype.visitUint64=L(lr);A.prototype.visitFloat=L(mh);A.prototype.visitFloat16=L(pl);A.prototype.visitFloat32=L(la);A.prototype.visitFloat64=L(la);A.prototype.visitUtf8=L(yl);A.prototype.visitLargeUtf8=L(yl);A.prototype.visitBinary=L(ml);A.prototype.visitLargeBinary=L(ml);A.prototype.visitFixedSizeBinary=L(ua);A.prototype.visitDate=L(fa);A.prototype.visitDateDay=L(Is);A.prototype.visitDateMillisecond=L(xs);A.prototype.visitTimestamp=L(ha);A.prototype.visitTimestampSecond=L(Ss);A.prototype.visitTimestampMillisecond=L(Bs);A.prototype.visitTimestampMicrosecond=L(As);A.prototype.visitTimestampNanosecond=L(Ts);A.prototype.visitTime=L(da);A.prototype.visitTimeSecond=L(Ds);A.prototype.visitTimeMillisecond=L(Os);A.prototype.visitTimeMicrosecond=L(Fs);A.prototype.visitTimeNanosecond=L(Ms);A.prototype.visitDecimal=L(pa);A.prototype.visitList=L(yh);A.prototype.visitStruct=L(Ih);A.prototype.visitUnion=L(xh);A.prototype.visitDenseUnion=L(gl);A.prototype.visitSparseUnion=L(bl);A.prototype.visitDictionary=L(Sh);A.prototype.visitInterval=L(ma);A.prototype.visitIntervalDayTime=L(Ls);A.prototype.visitIntervalYearMonth=L(Ns);A.prototype.visitDuration=L(ya);A.prototype.visitDurationSecond=L(Us);A.prototype.visitDurationMillisecond=L(Es);A.prototype.visitDurationMicrosecond=L(Rs);A.prototype.visitDurationNanosecond=L(Cs);A.prototype.visitFixedSizeList=L(Bh);A.prototype.visitMap=L(gh);var Dt=new A;var Ue=Symbol.for("parent"),Tn=Symbol.for("rowIndex"),Ar=class{constructor(t,e){return this[Ue]=t,this[Tn]=e,new Proxy(this,new ba)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Tn],e=this[Ue],n=e.type.children,i={};for(let s=-1,o=n.length;++s<o;)i[n[s].name]=mt.visit(e.children[s],t);return i}toString(){return`{${[...this].map(([t,e])=>`${Le(t)}: ${Le(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new ga(this[Ue],this[Tn])}},ga=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,mt.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(Ar.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Ue]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Tn]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});var ba=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Ue].type.children.map(e=>e.name)}has(t,e){return t[Ue].type.children.findIndex(n=>n.name===e)!==-1}getOwnPropertyDescriptor(t,e){if(t[Ue].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[Ue].type.children.findIndex(i=>i.name===e);if(n!==-1){let i=mt.visit(t[Ue].children[n],t[Tn]);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[Ue].type.children.findIndex(s=>s.name===e);return i!==-1?(Dt.visit(t[Ue].children[i],t[Tn],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}};var I=class extends v{};function O(r){return(t,e)=>t.getValid(e)?r(t,e):null}var Ah=(r,t)=>864e5*r[t],wa=(r,t)=>4294967296*r[t+1]+(r[t]>>>0),Th=(r,t)=>4294967296*(r[t+1]/1e3)+(r[t]>>>0)/1e3,Dh=(r,t)=>4294967296*(r[t+1]/1e6)+(r[t]>>>0)/1e6,wl=r=>new Date(r),Oh=(r,t)=>wl(Ah(r,t)),Fh=(r,t)=>wl(wa(r,t)),Mh=(r,t)=>null,_l=(r,t,e)=>{if(e+1>=t.length)return null;let n=at(t[e]),i=at(t[e+1]);return r.subarray(n,i)},Lh=({offset:r,values:t},e)=>{let n=r+e;return(t[n>>3]&1<<n%8)!==0},vl=({values:r},t)=>Oh(r,t),Il=({values:r},t)=>Fh(r,t*2),Tr=({stride:r,values:t},e)=>t[r*e],Nh=({stride:r,values:t},e)=>vs(t[r*e]),xl=({values:r},t)=>r[t],Uh=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),Sl=({values:r,valueOffsets:t},e)=>_l(r,t,e),Bl=({values:r,valueOffsets:t},e)=>{let n=_l(r,t,e);return n!==null?Qn(n):null},Eh=({values:r},t)=>r[t],Rh=({type:r,values:t},e)=>r.precision!==j.HALF?t[e]:vs(t[e]),Ch=(r,t)=>r.type.unit===et.DAY?vl(r,t):Il(r,t),Al=({values:r},t)=>1e3*wa(r,t*2),Tl=({values:r},t)=>wa(r,t*2),Dl=({values:r},t)=>Th(r,t*2),Ol=({values:r},t)=>Dh(r,t*2),Ph=(r,t)=>{switch(r.type.unit){case p.SECOND:return Al(r,t);case p.MILLISECOND:return Tl(r,t);case p.MICROSECOND:return Dl(r,t);case p.NANOSECOND:return Ol(r,t)}},Fl=({values:r},t)=>r[t],Ml=({values:r},t)=>r[t],Ll=({values:r},t)=>r[t],Nl=({values:r},t)=>r[t],kh=(r,t)=>{switch(r.type.unit){case p.SECOND:return Fl(r,t);case p.MILLISECOND:return Ml(r,t);case p.MICROSECOND:return Ll(r,t);case p.NANOSECOND:return Nl(r,t)}},Vh=({values:r,stride:t},e)=>Cr.decimal(r.subarray(t*e,t*(e+1))),jh=(r,t)=>{let{valueOffsets:e,stride:n,children:i}=r,{[t*n]:s,[t*n+1]:o}=e,c=i[0].slice(s,o-s);return new g([c])},zh=(r,t)=>{let{valueOffsets:e,children:n}=r,{[t]:i,[t+1]:s}=e,o=n[0];return new tr(o.slice(i,s-i))},Wh=(r,t)=>new Ar(r,t),Gh=(r,t)=>r.type.mode===K.Dense?Ul(r,t):El(r,t),Ul=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return mt.visit(n,r.valueOffsets[t])},El=(r,t)=>{let e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return mt.visit(n,t)},$h=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},Hh=(r,t)=>r.type.unit===nt.DAY_TIME?Rl(r,t):Cl(r,t),Rl=({values:r},t)=>r.subarray(2*t,2*(t+1)),Cl=({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},Pl=({values:r},t)=>r[t],kl=({values:r},t)=>r[t],Vl=({values:r},t)=>r[t],jl=({values:r},t)=>r[t],Yh=(r,t)=>{switch(r.type.unit){case p.SECOND:return Pl(r,t);case p.MILLISECOND:return kl(r,t);case p.MICROSECOND:return Vl(r,t);case p.NANOSECOND:return jl(r,t)}},Kh=(r,t)=>{let{stride:e,children:n}=r,s=n[0].slice(t*e,e);return new g([s])};I.prototype.visitNull=O(Mh);I.prototype.visitBool=O(Lh);I.prototype.visitInt=O(Eh);I.prototype.visitInt8=O(Tr);I.prototype.visitInt16=O(Tr);I.prototype.visitInt32=O(Tr);I.prototype.visitInt64=O(xl);I.prototype.visitUint8=O(Tr);I.prototype.visitUint16=O(Tr);I.prototype.visitUint32=O(Tr);I.prototype.visitUint64=O(xl);I.prototype.visitFloat=O(Rh);I.prototype.visitFloat16=O(Nh);I.prototype.visitFloat32=O(Tr);I.prototype.visitFloat64=O(Tr);I.prototype.visitUtf8=O(Bl);I.prototype.visitLargeUtf8=O(Bl);I.prototype.visitBinary=O(Sl);I.prototype.visitLargeBinary=O(Sl);I.prototype.visitFixedSizeBinary=O(Uh);I.prototype.visitDate=O(Ch);I.prototype.visitDateDay=O(vl);I.prototype.visitDateMillisecond=O(Il);I.prototype.visitTimestamp=O(Ph);I.prototype.visitTimestampSecond=O(Al);I.prototype.visitTimestampMillisecond=O(Tl);I.prototype.visitTimestampMicrosecond=O(Dl);I.prototype.visitTimestampNanosecond=O(Ol);I.prototype.visitTime=O(kh);I.prototype.visitTimeSecond=O(Fl);I.prototype.visitTimeMillisecond=O(Ml);I.prototype.visitTimeMicrosecond=O(Ll);I.prototype.visitTimeNanosecond=O(Nl);I.prototype.visitDecimal=O(Vh);I.prototype.visitList=O(jh);I.prototype.visitStruct=O(Wh);I.prototype.visitUnion=O(Gh);I.prototype.visitDenseUnion=O(Ul);I.prototype.visitSparseUnion=O(El);I.prototype.visitDictionary=O($h);I.prototype.visitInterval=O(Hh);I.prototype.visitIntervalDayTime=O(Rl);I.prototype.visitIntervalYearMonth=O(Cl);I.prototype.visitDuration=O(Yh);I.prototype.visitDurationSecond=O(Pl);I.prototype.visitDurationMillisecond=O(kl);I.prototype.visitDurationMicrosecond=O(Vl);I.prototype.visitDurationNanosecond=O(jl);I.prototype.visitFixedSizeList=O(Kh);I.prototype.visitMap=O(zh);var mt=new I;var xe=Symbol.for("keys"),Dn=Symbol.for("vals"),tr=class{constructor(t){return this[xe]=new g([t.children[0]]).memoize(),this[Dn]=t.children[1],new Proxy(this,new va)}[Symbol.iterator](){return new _a(this[xe],this[Dn])}get size(){return this[xe].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[xe],e=this[Dn],n={};for(let i=-1,s=t.length;++i<s;)n[t.get(i)]=mt.visit(e,i);return n}toString(){return`{${[...this].map(([t,e])=>`${Le(t)}: ${Le(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},_a=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),mt.visit(this.vals,t)]})}},va=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[xe].toArray().map(String)}has(t,e){return t[xe].includes(e)}getOwnPropertyDescriptor(t,e){if(t[xe].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];let n=t[xe].indexOf(e);if(n!==-1){let i=mt.visit(Reflect.get(t,Dn),n);return Reflect.set(t,e,i),i}}set(t,e,n){let i=t[xe].indexOf(e);return i!==-1?(Dt.visit(Reflect.get(t,Dn),i,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}};Object.defineProperties(tr.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[xe]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Dn]:{writable:!0,enumerable:!1,configurable:!1,value:null}});function Zh(r,t,e){let n=r.length,i=t>-1?t:n+t%n;return e?e(r,i):i}var zl;function ai(r,t,e,n){let{length:i=0}=r,s=typeof t!="number"?0:t,o=typeof e!="number"?i:e;return s<0&&(s=(s%i+i)%i),o<0&&(o=(o%i+i)%i),o<s&&(zl=s,s=o,o=zl),o>i&&(o=i),n?n(r,s,o):[s,o]}var Wl=r=>r!==r;function Dr(r){if(typeof r!=="object"||r===null)return Wl(r)?Wl: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?ta(r,e):!1:r instanceof Map?Xh(r):Array.isArray(r)?Jh(r):r instanceof g?Qh(r):qh(r,!0)}function Jh(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Dr(r[e]);return Ps(t)}function Xh(r){let t=-1,e=[];for(let n of r.values())e[++t]=Dr(n);return Ps(e)}function Qh(r){let t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Dr(r.get(e));return Ps(t)}function qh(r,t=!1){let e=Object.keys(r);if(!t&&e.length===0)return()=>!1;let n=[];for(let i=-1,s=e.length;++i<s;)n[i]=Dr(r[e[i]]);return Ps(n,e)}function Ps(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return td(r,e);case Map:return Gl(r,e,e.keys());case tr:case Ar:case Object:case void 0:return Gl(r,e,t||Object.keys(e))}return e instanceof g?ed(r,e):!1}}function td(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 ed(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 Gl(r,t,e){let n=e[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),s=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),o=0,a=r.length,c=s.next(),l=n.next(),u=i.next();for(;o<a&&!l.done&&!u.done&&!c.done&&!(l.value!==u.value||!r[o](c.value));++o,l=n.next(),u=i.next(),c=s.next());return o===a&&l.done&&u.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),s.return&&s.return(),!1)}var xa={};xr(xa,{BitIterator:()=>Zr,getBit:()=>$l,getBool:()=>Vs,packBools:()=>Xr,popcnt_array:()=>Hl,popcnt_bit_range:()=>ci,popcnt_uint32:()=>ks,setBool:()=>rd,truncateBitmap:()=>Jr});function Vs(r,t,e,n){return(e&1<<n)!==0}function $l(r,t,e,n){return(e&1<<n)>>n}function rd(r,t,e){return e?!!(r[t>>3]|=1<<t%8)||!0:!(r[t>>3]&=~(1<<t%8))&&!1}function Jr(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):Xr(new Zr(e,r,t,null,Vs)).subarray(0,n)),i}return e}function Xr(r){let t=[],e=0,n=0,i=0;for(let o of r)o&&(i|=1<<n),++n===8&&(t[e++]=i,i=n=0);(e===0||n>0)&&(t[e++]=i);let s=new Uint8Array(t.length+7&-8);return s.set(t),s}var Zr=class{constructor(t,e,n,i,s){this.bytes=t,this.length=n,this.context=i,this.get=s,this.bit=e%8,this.byteIndex=e>>3,this.byte=t[this.byteIndex++],this.index=0}next(){return this.index<this.length?(this.bit===8&&(this.bit=0,this.byte=this.bytes[this.byteIndex++]),{value:this.get(this.context,this.index++,this.byte,this.bit++)}):{done:!0,value:null}}[Symbol.iterator](){return this}};function ci(r,t,e){if(e-t<=0)return 0;if(e-t<8){let s=0;for(let o of new Zr(r,t,e-t,r,$l))s+=o;return s}let n=e>>3<<3,i=t+(t%8===0?0:8-t%8);return ci(r,t,i)+ci(r,n,e)+Hl(r,i>>3,n-i>>3)}function Hl(r,t,e){let n=0,i=Math.trunc(t),s=new DataView(r.buffer,r.byteOffset,r.byteLength),o=e===void 0?r.byteLength:i+e;for(;o-i>=4;)n+=ks(s.getUint32(i)),i+=4;for(;o-i>=2;)n+=ks(s.getUint16(i)),i+=2;for(;o-i>=1;)n+=ks(s.getUint8(i)),i+=1;return n}function ks(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 nd=-1,R=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 m.isSparseUnion(t)?this.children.some(e=>e.nullable):m.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:e,values:n,nullBitmap:i,typeIds:s}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),this.children.reduce((o,a)=>o+a.byteLength,t)}get nullCount(){if(m.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,e;return t<=nd&&(e=this.nullBitmap)&&(this._nullCount=t=this.length-ci(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,i,s,o=[],a){this.type=t,this.children=o,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;s instanceof R?(this.stride=s.stride,this.values=s.values,this.typeIds=s.typeIds,this.nullBitmap=s.nullBitmap,this.valueOffsets=s.valueOffsets):(this.stride=he(t),s&&((c=s[0])&&(this.valueOffsets=c),(c=s[1])&&(this.values=c),(c=s[2])&&(this.nullBitmap=c),(c=s[3])&&(this.typeIds=c)))}getValid(t){let{type:e}=this;if(m.isUnion(e)){let n=e,i=this.children[n.typeIdToChildIndex[this.typeIds[t]]],s=n.mode===K.Dense?this.valueOffsets[t]:t;return i.getValid(s)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,e){let n,{type:i}=this;if(m.isUnion(i)){let s=i,o=this.children[s.typeIdToChildIndex[this.typeIds[t]]],a=s.mode===K.Dense?this.valueOffsets[t]:t;n=o.getValid(a),o.setValid(a,e)}else{let{nullBitmap:s}=this,{offset:o,length:a}=this,c=o+t,l=1<<c%8,u=c>>3;(!s||s.byteLength<=u)&&(s=new Uint8Array((o+a+63&-64)>>3).fill(255),this.nullCount>0&&s.set(Jr(o,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:s,_nullCount:-1}));let h=s[u];n=(h&l)!==0,e?s[u]=h|l:s[u]=h&~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,s=this,o=this.children){return new R(t,e,n,i,s,o,this.dictionary)}slice(t,e){let{stride:n,typeId:i,children:s}=this,o=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,e,n,i);return this.clone(this.type,this.offset+t,e,o,c,s.length===0||this.valueOffsets?s:this._sliceChildren(s,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===f.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(Jr(this.offset,e,this.nullBitmap),0);let s=this.buffers;return s[lt.VALIDITY]=i,this.clone(this.type,0,t,n+(t-e),s)}_sliceBuffers(t,e,n,i){let s,{buffers:o}=this;return(s=o[lt.TYPE])&&(o[lt.TYPE]=s.subarray(t,t+e)),(s=o[lt.OFFSET])&&(o[lt.OFFSET]=s.subarray(t,t+e+1))||(s=o[lt.DATA])&&(o[lt.DATA]=i===6?s:s.subarray(n*t,n*(t+e))),o}_sliceChildren(t,e,n){return t.map(i=>i.slice(e,n))}};R.prototype.children=Object.freeze([]);var Qr=class extends v{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:e,["offset"]:n=0,["length"]:i=0}=t;return new R(e,n,i,i)}visitBool(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitInt(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitFloat(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.data),s=T(t.nullBitmap),o=Rr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,i,s])}visitLargeUtf8(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.data),s=T(t.nullBitmap),o=ms(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,i,s])}visitBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.data),s=T(t.nullBitmap),o=Rr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,i,s])}visitLargeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.data),s=T(t.nullBitmap),o=ms(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,i,s])}visitFixedSizeBinary(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitDate(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitTimestamp(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitTime(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitDecimal(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitList(t){let{["type"]:e,["offset"]:n=0,["child"]:i}=t,s=T(t.nullBitmap),o=Rr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,void 0,s],[i])}visitStruct(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=T(t.nullBitmap),{length:o=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,void 0,s],i)}visitUnion(t){let{["type"]:e,["offset"]:n=0,["children"]:i=[]}=t,s=C(e.ArrayType,t.typeIds),{["length"]:o=s.length,["nullCount"]:a=-1}=t;if(m.isSparseUnion(e))return new R(e,n,o,a,[void 0,void 0,void 0,s],i);let c=Rr(t.valueOffsets);return new R(e,n,o,a,[c,void 0,void 0,s],i)}visitDictionary(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.indices.ArrayType,t.data),{["dictionary"]:o=new g([new Qr().visit({type:e.dictionary})])}=t,{["length"]:a=s.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[void 0,s,i],[],o)}visitInterval(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitDuration(t){let{["type"]:e,["offset"]:n=0}=t,i=T(t.nullBitmap),s=C(e.ArrayType,t.data),{["length"]:o=s.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,s,i])}visitFixedSizeList(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new Qr().visit({type:e.valueType})}=t,s=T(t.nullBitmap),{["length"]:o=i.length/he(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new R(e,n,o,a,[void 0,void 0,s],[i])}visitMap(t){let{["type"]:e,["offset"]:n=0,["child"]:i=new Qr().visit({type:e.childType})}=t,s=T(t.nullBitmap),o=Rr(t.valueOffsets),{["length"]:a=o.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new R(e,n,a,c,[o,void 0,s],[i])}},id=new Qr;function w(r){return id.visit(r)}var li=class{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}};function Yl(r){return r.some(t=>t.nullable)}function js(r){return r.reduce((t,e)=>t+e.nullCount,0)}function zs(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function Ws(r,t,e,n){let i=[];for(let s=-1,o=r.length;++s<o;){let a=r[s],c=t[s],{length:l}=a;if(c>=n)break;if(e>=c+l)continue;if(c>=e&&c+l<=n){i.push(a);continue}let u=Math.max(0,e-c),h=Math.min(n-c,l);i.push(a.slice(u,h-u))}return i.length===0&&i.push(r[0].slice(0,0)),i}function Sa(r,t,e,n){let i=0,s=0,o=t.length-1;do{if(i>=o-1)return e<t[o]?n(r,i,e-t[i]):null;s=i+Math.trunc((o-i)*.5),e<t[s]?o=s:i=s}while(i<o)}function ui(r,t){return r.getValid(t)}function On(r){function t(e,n,i){return r(e[n],i)}return function(e){let n=this.data;return Sa(n,this._offsets,e,t)}}function Gs(r){let t;function e(n,i,s){return r(n[i],s,t)}return function(n,i){let s=this.data;t=i;let o=Sa(s,this._offsets,n,e);return t=void 0,o}}function $s(r){let t;function e(n,i,s){let o=s,a=0,c=0;for(let l=i-1,u=n.length;++l<u;){let h=n[l];if(~(a=r(h,t,o)))return c+a;o=0,c+=h.length}return-1}return function(n,i){t=n;let s=this.data,o=typeof i!="number"?e(s,0,0):Sa(s,this._offsets,i,e);return t=void 0,o}}var x=class extends v{};function sd(r,t){return t===null&&r.length>0?0:-1}function od(r,t){let{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(let i of new Zr(e,r.offset+(t||0),r.length,e,Vs)){if(!i)return n;++n}return-1}function N(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case f.Union:break;case f.Dictionary:break;default:return od(r,e)}let n=mt.getVisitFn(r),i=Dr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}function Kl(r,t,e){let n=mt.getVisitFn(r),i=Dr(t);for(let s=(e||0)-1,o=r.length;++s<o;)if(i(n(r,s)))return s;return-1}x.prototype.visitNull=sd;x.prototype.visitBool=N;x.prototype.visitInt=N;x.prototype.visitInt8=N;x.prototype.visitInt16=N;x.prototype.visitInt32=N;x.prototype.visitInt64=N;x.prototype.visitUint8=N;x.prototype.visitUint16=N;x.prototype.visitUint32=N;x.prototype.visitUint64=N;x.prototype.visitFloat=N;x.prototype.visitFloat16=N;x.prototype.visitFloat32=N;x.prototype.visitFloat64=N;x.prototype.visitUtf8=N;x.prototype.visitLargeUtf8=N;x.prototype.visitBinary=N;x.prototype.visitLargeBinary=N;x.prototype.visitFixedSizeBinary=N;x.prototype.visitDate=N;x.prototype.visitDateDay=N;x.prototype.visitDateMillisecond=N;x.prototype.visitTimestamp=N;x.prototype.visitTimestampSecond=N;x.prototype.visitTimestampMillisecond=N;x.prototype.visitTimestampMicrosecond=N;x.prototype.visitTimestampNanosecond=N;x.prototype.visitTime=N;x.prototype.visitTimeSecond=N;x.prototype.visitTimeMillisecond=N;x.prototype.visitTimeMicrosecond=N;x.prototype.visitTimeNanosecond=N;x.prototype.visitDecimal=N;x.prototype.visitList=N;x.prototype.visitStruct=N;x.prototype.visitUnion=N;x.prototype.visitDenseUnion=Kl;x.prototype.visitSparseUnion=Kl;x.prototype.visitDictionary=N;x.prototype.visitInterval=N;x.prototype.visitIntervalDayTime=N;x.prototype.visitIntervalYearMonth=N;x.prototype.visitDuration=N;x.prototype.visitDurationSecond=N;x.prototype.visitDurationMillisecond=N;x.prototype.visitDurationMicrosecond=N;x.prototype.visitDurationNanosecond=N;x.prototype.visitFixedSizeList=N;x.prototype.visitMap=N;var qr=new x;var S=class extends v{};function F(r){let{type:t}=r;if(r.nullCount===0&&r.stride===1&&(t.typeId===f.Timestamp||t instanceof it&&t.bitWidth!==64||t instanceof xt&&t.bitWidth!==64||t instanceof At&&t.precision!==j.HALF))return new li(r.data.length,n=>{let i=r.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let e=0;return new li(r.data.length,n=>{let s=r.data[n].length,o=r.slice(e,e+s);return e+=s,new Ba(o)})}var Ba=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}};S.prototype.visitNull=F;S.prototype.visitBool=F;S.prototype.visitInt=F;S.prototype.visitInt8=F;S.prototype.visitInt16=F;S.prototype.visitInt32=F;S.prototype.visitInt64=F;S.prototype.visitUint8=F;S.prototype.visitUint16=F;S.prototype.visitUint32=F;S.prototype.visitUint64=F;S.prototype.visitFloat=F;S.prototype.visitFloat16=F;S.prototype.visitFloat32=F;S.prototype.visitFloat64=F;S.prototype.visitUtf8=F;S.prototype.visitLargeUtf8=F;S.prototype.visitBinary=F;S.prototype.visitLargeBinary=F;S.prototype.visitFixedSizeBinary=F;S.prototype.visitDate=F;S.prototype.visitDateDay=F;S.prototype.visitDateMillisecond=F;S.prototype.visitTimestamp=F;S.prototype.visitTimestampSecond=F;S.prototype.visitTimestampMillisecond=F;S.prototype.visitTimestampMicrosecond=F;S.prototype.visitTimestampNanosecond=F;S.prototype.visitTime=F;S.prototype.visitTimeSecond=F;S.prototype.visitTimeMillisecond=F;S.prototype.visitTimeMicrosecond=F;S.prototype.visitTimeNanosecond=F;S.prototype.visitDecimal=F;S.prototype.visitList=F;S.prototype.visitStruct=F;S.prototype.visitUnion=F;S.prototype.visitDenseUnion=F;S.prototype.visitSparseUnion=F;S.prototype.visitDictionary=F;S.prototype.visitInterval=F;S.prototype.visitIntervalDayTime=F;S.prototype.visitIntervalYearMonth=F;S.prototype.visitDuration=F;S.prototype.visitDurationSecond=F;S.prototype.visitDurationMillisecond=F;S.prototype.visitDurationMicrosecond=F;S.prototype.visitDurationNanosecond=F;S.prototype.visitFixedSizeList=F;S.prototype.visitMap=F;var Fn=new S;var Zl,Jl={},Xl={},g=class{constructor(t){var e,n,i;let s=t[0]instanceof g?t.flatMap(a=>a.data):t;if(s.length===0||s.some(a=>!(a instanceof R)))throw new TypeError("Vector constructor expects an Array of Data instances.");let o=(e=s[0])===null||e===void 0?void 0:e.type;switch(s.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=Jl[o.typeId],u=s[0];this.isValid=h=>ui(u,h),this.get=h=>a(u,h),this.set=(h,d)=>c(u,h,d),this.indexOf=h=>l(u,h),this._offsets=[0,u.length];break}default:Object.setPrototypeOf(this,Xl[o.typeId]),this._offsets=zs(s);break}this.data=s,this.type=o,this.stride=he(o),this.numChildren=(i=(n=o.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return Yl(this.data)}get nullCount(){return js(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${f[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return Fn.visit(this)}concat(...t){return new g(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new g(ai(this,t,e,({data:n,_offsets:i},s,o)=>Ws(n,i,s,o)))}toJSON(){return[...this]}toArray(){let{type:t,data:e,length:n,stride:i,ArrayType:s}=this;switch(t.typeId){case f.Int:case f.Float:case f.Decimal:case f.Time:case f.Timestamp:switch(e.length){case 0:return new s;case 1:return e[0].values.subarray(0,n*i);default:return e.reduce((o,{values:a,length:c})=>(o.array.set(a.subarray(0,c*i),o.offset),o.offset+=c*i,o),{array:new s(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 g(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return m.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(m.isDictionary(this.type)){let t=new Mn(this.data[0].dictionary),e=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new g(e)}return new Mn(this)}unmemoize(){if(m.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 g(e)}return this}};Zl=Symbol.toStringTag;g[Zl]=(r=>{r.type=m.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(f).map(e=>f[e]).filter(e=>typeof e=="number"&&e!==f.NONE);for(let e of t){let n=mt.getVisitFnByTypeId(e),i=Dt.getVisitFnByTypeId(e),s=qr.getVisitFnByTypeId(e);Jl[e]={get:n,set:i,indexOf:s},Xl[e]=Object.create(r,{isValid:{value:On(ui)},get:{value:On(mt.getVisitFnByTypeId(e))},set:{value:Gs(Dt.getVisitFnByTypeId(e))},indexOf:{value:$s(qr.getVisitFnByTypeId(e))}})}return"Vector"})(g.prototype);var Mn=class extends g{constructor(t){super(t.data);let e=this.get,n=this.set,i=this.slice,s=new Array(this.length);Object.defineProperty(this,"get",{value(o){let a=s[o];if(a!==void 0)return a;let c=e.call(this,o);return s[o]=c,c}}),Object.defineProperty(this,"set",{value(o,a){n.call(this,o,a),s[o]=a}}),Object.defineProperty(this,"slice",{value:(o,a)=>new Mn(i.call(this,o,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new g(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}};function Or(r){if(r){if(r instanceof R)return new g([r]);if(r instanceof g)return new g(r.data);if(r.type instanceof m)return new g([w(r)]);if(Array.isArray(r))return new g(r.flatMap(t=>ad(t)));if(ArrayBuffer.isView(r)){r instanceof DataView&&(r=new Uint8Array(r.buffer));let t={offset:0,length:r.length,nullCount:0,data:r};if(r instanceof Int8Array)return new g([w(Object.assign(Object.assign({},t),{type:new ye}))]);if(r instanceof Int16Array)return new g([w(Object.assign(Object.assign({},t),{type:new ge}))]);if(r instanceof Int32Array)return new g([w(Object.assign(Object.assign({},t),{type:new pt}))]);if(r instanceof BigInt64Array)return new g([w(Object.assign(Object.assign({},t),{type:new be}))]);if(r instanceof Uint8Array||r instanceof Uint8ClampedArray)return new g([w(Object.assign(Object.assign({},t),{type:new we}))]);if(r instanceof Uint16Array)return new g([w(Object.assign(Object.assign({},t),{type:new _e}))]);if(r instanceof Uint32Array)return new g([w(Object.assign(Object.assign({},t),{type:new ve}))]);if(r instanceof BigUint64Array)return new g([w(Object.assign(Object.assign({},t),{type:new Ze}))]);if(r instanceof Float32Array)return new g([w(Object.assign(Object.assign({},t),{type:new Xt}))]);if(r instanceof Float64Array)return new g([w(Object.assign(Object.assign({},t),{type:new Qt}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function ad(r){return r instanceof R?[r]:r instanceof g?r.data:Or(r).data}function Ql(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
- case ${id(n)}:`).join("")}
9
+ case ${cd(n)}:`).join("")}
10
10
  return false;
11
11
  }`),r.length!==e.length&&(t=`if (x !== x) return false;
12
12
  ${t}`),new Function("x",`${t}
13
- return true;`)}function id(r){return typeof r!="bigint"?Le(r):`${Le(r)}n`}function xa(r,t){let e=Math.ceil(r)*t-1;return(e-e%64+64||64)/t}function Jl(r,t=0){return r.length>=t?r.subarray(0,t):Qn(new r.constructor(t),r,0)}var Ee=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?xa(n*1,this.BYTES_PER_ELEMENT):xa(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=xa(t*this.stride,this.BYTES_PER_ELEMENT);let e=Jl(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=Jl(this.buffer,t)}},fr=class extends Ee{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}},Ln=class extends fr{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,e){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,s=t%8,o=n[i]>>s&1;return e?o===0&&(n[i]|=1<<s,++this.numValid):o===1&&(n[i]&=~(1<<s),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},Nn=class extends fr{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 rt=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=he(t),this._nulls=new Ln,e&&e.length>0&&(this._isValid=Zl(e))}toVector(){return new g([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:e,_values:n,_nulls:i,_typeIds:s,children:o}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),o.reduce((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:s,length:o,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:h}=this;(e=c?.flush(o))?i=l?.flush(o):(i=l?.flush(o))?t=u?.flush(l.last()):t=u?.flush(o),a>0&&(n=h?.flush(o));let d=this.children.map(b=>b.flush());return this.clear(),w({type:s,length:o,nullCount:a,children:d,child:d[0],data:t,typeIds:e,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,e,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(e=this._values)===null||e===void 0||e.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let s of this.children)s.clear();return this}};rt.prototype.length=1;rt.prototype.stride=1;rt.prototype.children=null;rt.prototype.finished=!1;rt.prototype.nullValues=null;rt.prototype._isValid=()=>!0;var yt=class extends rt{constructor(t){super(t),this._values=new fr(this.ArrayType,0,this.stride)}setValue(t,e){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}},ee=class extends rt{constructor(t){super(t),this._pendingLength=0,this._offsets=new Nn(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 er?e[xe].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 rn=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 Et=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 Et).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new Et).__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):$.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new ot).__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 rn).__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 rn).__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 Q).__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,$.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 E=class{constructor(t=[],e,n,i=$.V5){this.fields=t||[],this.metadata=e||new Map,n||(n=Sa(t)),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 E(n,this.metadata)}selectAt(t){let e=t.map(n=>this.fields[n]).filter(Boolean);return new E(e,this.metadata)}assign(...t){let e=t[0]instanceof E?t[0]:Array.isArray(t[0])?new E(t[0]):new E(t),n=[...this.fields],i=Ws(Ws(new Map,this.metadata),e.metadata),s=e.fields.filter(a=>{let c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:Ws(Ws(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),o=Sa(s,new Map);return new E([...n,...s],i,new Map([...this.dictionaries,...o]))}};E.prototype.fields=null;E.prototype.metadata=null;E.prototype.dictionaries=null;var D=class{static new(...t){let[e,n,i,s]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),s===void 0&&(s=t[0].metadata)),new D(`${e}`,n,i,s)}constructor(t,e,n=!1,i){this.name=t,this.type=e,this.nullable=n,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,n,i,s]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,n=this.type,i=this.nullable,s=this.metadata]=t:{name:e=this.name,type:n=this.type,nullable:i=this.nullable,metadata:s=this.metadata}=t[0],D.new(e,n,i,s)}};D.prototype.type=null;D.prototype.name=null;D.prototype.nullable=null;D.prototype.metadata=null;function Ws(r,t){return new Map([...r||new Map,...t||new Map])}function Sa(r,t=new Map){for(let e=-1,n=r.length;++e<n;){let s=r[e].type;if(m.isDictionary(s)){if(!t.has(s.id))t.set(s.id,s.dictionary);else if(t.get(s.id)!==s.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}s.children&&s.children.length>0&&Sa(s.children,t)}return t}var sd=cr,od=Ct,hr=class{static decode(t){t=new od(T(t));let e=Et.getRootAsFooter(t),n=E.decode(e.schema(),new Map,e.version());return new Ba(n,e)}static encode(t){let e=new sd,n=E.encode(e,t.schema);Et.startRecordBatchesVector(e,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())Re.encode(e,o);let i=e.endVector();Et.startDictionariesVector(e,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())Re.encode(e,o);let s=e.endVector();return Et.startFooter(e),Et.addSchema(e,n),Et.addVersion(e,$.V5),Et.addRecordBatches(e,i),Et.addDictionaries(e,s),Et.finishFooterBuffer(e,Et.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=$.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 Ba=class extends hr{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 Re.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return Re.decode(e)}return null}},Re=class{static decode(t){return new Re(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){let{metaDataLength:n}=e,i=BigInt(e.offset),s=BigInt(e.bodyLength);return rn.createBlock(t,i,n,s)}constructor(t,e,n){this.metaDataLength=t,this.offset=at(n),this.bodyLength=at(e)}};var q=Object.freeze({done:!0,value:void 0}),li=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},nn=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())}},Gs=class extends nn{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return y(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(q);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 y(this,void 0,void 0,function*(){return yield this.abort(t),q})}return(t){return y(this,void 0,void 0,function*(){return yield this.close(),q})}read(t){return y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return y(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((e,n)=>{this.resolvers.push({resolve:e,reject:n})}):Promise.resolve(q)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var rr=class extends Gs{write(t){if((t=T(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Jn(this.toUint8Array(!0)):this.toUint8Array(!1).then(Jn)}toUint8Array(t=!1){return t?ce(this._values)[0]:(()=>y(this,void 0,void 0,function*(){var e,n,i,s;let o=[],a=0;try{for(var c=!0,l=Te(this),u;u=yield l.next(),e=u.done,!e;c=!0){s=u.value,c=!1;let h=s;o.push(h),a+=h.byteLength}}catch(h){n={error:h}}finally{try{!c&&!e&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return ce(o,a)[0]}))()}},nr=class{constructor(t){t&&(this.source=new Aa(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)}},re=class{constructor(t){t instanceof re?this.source=t.source:t instanceof rr?this.source=new dr(Bt.fromAsyncIterable(t)):fs(t)?this.source=new dr(Bt.fromNodeStream(t)):Xn(t)?this.source=new dr(Bt.fromDOMStream(t)):ls(t)?this.source=new dr(Bt.fromDOMStream(t.body)):De(t)?this.source=new dr(Bt.fromIterable(t)):ae(t)?this.source=new dr(Bt.fromAsyncIterable(t)):de(t)&&(this.source=new dr(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)}},Aa=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)||q)}return(t){return Object.create(this.source.return&&this.source.return(t)||q)}},dr=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return y(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return y(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,e="read"){return y(this,void 0,void 0,function*(){return yield this.source.next({cmd:e,size:t})})}throw(t){return y(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||q;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return y(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||q;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var ui=class extends nr{constructor(t,e){super(),this.position=0,this.buffer=T(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}}},Lr=class extends re{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=(()=>y(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return y(this,void 0,void 0,function*(){let{buffer:e,byteOffset:n}=yield this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)})}seek(t){return y(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:e,size:n,position:i}=this;if(e&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let s=i,o=0,a=0,c=Math.min(n,s+Math.min(n-s,t)),l=new Uint8Array(Math.max(0,(this.position=c)-s));for(;(s+=a)<c&&(o+=a)<l.byteLength;)({bytesRead:a}=yield e.read(l,o,l.byteLength-o,s));return l}return null})}readAt(t,e){return y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+e<i){let s=Math.min(i,t+e),o=new Uint8Array(s-t);return(yield n.read(o,0,e,t)).buffer}return new Uint8Array(e)})}close(){return y(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var Da={};Sr(Da,{BaseInt64:()=>fi,Int128:()=>ne,Int64:()=>St,Uint64:()=>G});function Un(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}var En=8,Ta=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],fi=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let e=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=e[3]*n[3];this.buffer[0]=i&65535;let s=i>>>16;return i=e[2]*n[3],s+=i,i=e[3]*n[2]>>>0,s+=i,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0<i?65536:0,this.buffer[1]+=s>>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}_plus(t){let e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${Un(this.buffer[1])} ${Un(this.buffer[0])}`}},G=class extends fi{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return G.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return G.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.length,i=new G(e);for(let s=0;s<n;){let o=En<n-s?En:n-s,a=new G(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),c=new G(new Uint32Array([Ta[o],0]));i.times(c),i.plus(a),s+=o}return i}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)G.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new G(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new G(new Uint32Array(t.buffer)).plus(e)}},St=class extends fi{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 St.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return St.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,s=new St(e);for(let o=n?1:0;o<i;){let a=En<i-o?En:i-o,c=new St(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),l=new St(new Uint32Array([Ta[a],0]));s.times(l),s.plus(c),o+=a}return n?s.negate():s}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)St.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new St(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new St(new Uint32Array(t.buffer)).plus(e)}},ne=class{constructor(t){this.buffer=t}high(){return new St(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new St(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 G(new Uint32Array([this.buffer[3],0])),n=new G(new Uint32Array([this.buffer[2],0])),i=new G(new Uint32Array([this.buffer[1],0])),s=new G(new Uint32Array([this.buffer[0],0])),o=new G(new Uint32Array([t.buffer[3],0])),a=new G(new Uint32Array([t.buffer[2],0])),c=new G(new Uint32Array([t.buffer[1],0])),l=new G(new Uint32Array([t.buffer[0],0])),u=G.multiply(s,l);this.buffer[0]=u.low();let h=new G(new Uint32Array([u.high(),0]));return u=G.multiply(i,l),h.plus(u),u=G.multiply(s,c),h.plus(u),this.buffer[1]=h.low(),this.buffer[3]=h.lessThan(u)?1:0,this.buffer[2]=h.high(),new G(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(G.multiply(n,l)).plus(G.multiply(i,c)).plus(G.multiply(s,a)),this.buffer[3]+=G.multiply(e,l).plus(G.multiply(n,c)).plus(G.multiply(i,a)).plus(G.multiply(s,o)).low(),this}plus(t){let e=new Uint32Array(4);return e[3]=this.buffer[3]+t.buffer[3]>>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]<this.buffer[0]>>>0&&++e[1],e[1]<this.buffer[1]>>>0&&++e[2],e[2]<this.buffer[2]>>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${Un(this.buffer[3])} ${Un(this.buffer[2])} ${Un(this.buffer[1])} ${Un(this.buffer[0])}`}static multiply(t,e){return new ne(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new ne(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return ne.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return ne.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,s=new ne(e);for(let o=n?1:0;o<i;){let a=En<i-o?En:i-o,c=new ne(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),l=new ne(new Uint32Array([Ta[a],0,0,0]));s.times(l),s.plus(c),o+=a}return n?s.negate():s}static convertArray(t){let e=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)ne.from(t[n],new Uint32Array(e.buffer,e.byteOffset+4*4*n,4));return e}};var hi=class extends v{constructor(t,e,n,i,s=$.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=i,this.metadataVersion=s}visit(t){return super.visit(t instanceof D?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return w({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({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 w({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 w({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 w({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 w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({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 w({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<$.V5&&this.readNullBitmap(t,n),t.mode===K.Sparse?this.visitSparseUnion(t,{length:e,nullCount:n}):this.visitDenseUnion(t,{length:e,nullCount:n})}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({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 w({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({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 w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({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 w({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)}},$s=class extends hi{constructor(t,e,n,i,s){super(new Uint8Array(0),e,n,i,s),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):qr(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return C(Uint8Array,C(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return C(Uint8Array,C(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:n}=this;return m.isTimestamp(t)?C(Uint8Array,St.convertArray(n[e])):(m.isInt(t)||m.isTime(t))&&t.bitWidth===64||m.isDuration(t)?C(Uint8Array,St.convertArray(n[e])):m.isDate(t)&&t.unit===et.MILLISECOND?C(Uint8Array,St.convertArray(n[e])):m.isDecimal(t)?C(Uint8Array,ne.convertArray(n[e])):m.isBinary(t)||m.isLargeBinary(t)||m.isFixedSizeBinary(t)?ad(n[e]):m.isBool(t)?qr(n[e]):m.isUtf8(t)||m.isLargeUtf8(t)?ke(n[e].join("")):C(Uint8Array,C(t.ArrayType,n[e].map(i=>+i)))}};function ad(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 Rn=class extends ee{constructor(t){super(t),this._values=new Ee(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,T(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,s=0;for(let[o,a]of t)if(a===void 0)n.set(o,0);else{let c=a.length;i.set(a,s),n.set(o,c),s+=c}}};var Cn=class extends ee{constructor(t){super(t),this._values=new Ee(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,T(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,s=0;for(let[o,a]of t)if(a===void 0)n.set(o,BigInt(0));else{let c=a.length;i.set(a,s),n.set(o,BigInt(c)),s+=c}}};var Hs=class extends rt{constructor(t){super(t),this._values=new Ln}setValue(t,e){this._values.set(t,+e)}};var sn=class extends yt{};sn.prototype._setValue=ca;var di=class extends sn{};di.prototype._setValue=ws;var pi=class extends sn{};pi.prototype._setValue=_s;var mi=class extends yt{};mi.prototype._setValue=fa;var Ys=class extends rt{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new Ut(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=pr({type:this.type.indices,nullValues:e}),this.dictionary=pr({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,e){let n=this.indices;return e=n.setValid(t,e),this.length=n.length,e}setValue(t,e){let n=this._keysToIndices,i=this.valueToKey(e),s=n[i];return s===void 0&&(n[i]=s=this._dictionaryOffset+this.dictionary.append(e).length-1),this.indices.setValue(t,s)}flush(){let t=this.type,e=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=e?e.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var yi=class extends yt{};yi.prototype._setValue=aa;var Ks=class extends rt{setValue(t,e){let[n]=this.children,i=t*this.stride;for(let s=-1,o=e.length;++s<o;)n.set(i+s,e[s])}addChild(t,e="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new Vt(this.type.listSize,new D(e,t.type,!0)),n}};var on=class extends yt{setValue(t,e){this._values.set(t,e)}},Zs=class extends on{setValue(t,e){super.setValue(t,ii(e))}},Js=class extends on{},Xs=class extends on{};var an=class extends yt{};an.prototype._setValue=ha;var gi=class extends an{};gi.prototype._setValue=Os;var bi=class extends an{};bi.prototype._setValue=Fs;var mr=class extends yt{};mr.prototype._setValue=da;var wi=class extends mr{};wi.prototype._setValue=Ms;var _i=class extends mr{};_i.prototype._setValue=Ls;var vi=class extends mr{};vi.prototype._setValue=Ns;var Ii=class extends mr{};Ii.prototype._setValue=Us;var Se=class extends yt{setValue(t,e){this._values.set(t,e)}},Qs=class extends Se{},qs=class extends Se{},to=class extends Se{},eo=class extends Se{},ro=class extends Se{},no=class extends Se{},io=class extends Se{},so=class extends Se{};var oo=class extends ee{constructor(t){super(t),this._offsets=new Nn(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 Tt(new D(e,t.type,!0)),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,s]of t)if(typeof s>"u")e.set(i,0);else{let o=s,a=o.length,c=e.set(i,a).buffer[i];for(let l=-1;++l<a;)n.set(c+l,o[l])}}};var ao=class extends ee{set(t,e){return super.set(t,e)}setValue(t,e){let n=e instanceof Map?e:new Map(Object.entries(e)),i=this._pending||(this._pending=new Map),s=i.get(t);s&&(this._pendingLength-=s.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,e=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new jt(new D(e,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,s]of t)if(s===void 0)e.set(i,0);else{let{[i]:o,[i+1]:a}=e.set(i,s.size).buffer;for(let c of s.entries())if(n.set(o,c),++o>=a)break}}};var co=class extends rt{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var lo=class extends rt{setValue(t,e){let{children:n,type:i}=this;switch(Array.isArray(e)||e.constructor){case!0:return i.children.forEach((s,o)=>n[o].set(t,e[o]));case Map:return i.children.forEach((s,o)=>n[o].set(t,e.get(s.name)));default:return i.children.forEach((s,o)=>n[o].set(t,e[s.name]))}}setValid(t,e){return super.setValid(t,e)||this.children.forEach(n=>n.setValid(t,e)),e}addChild(t,e=`${this.numChildren}`){let n=this.children.push(t);return this.type=new V([...this.type.children,new D(e,t.type,!0)]),n}};var yr=class extends yt{};yr.prototype._setValue=la;var xi=class extends yr{};xi.prototype._setValue=vs;var Si=class extends yr{};Si.prototype._setValue=Is;var Bi=class extends yr{};Bi.prototype._setValue=xs;var Ai=class extends yr{};Ai.prototype._setValue=Ss;var gr=class extends yt{};gr.prototype._setValue=ua;var Ti=class extends gr{};Ti.prototype._setValue=Bs;var Di=class extends gr{};Di.prototype._setValue=As;var Oi=class extends gr{};Oi.prototype._setValue=Ts;var Fi=class extends gr{};Fi.prototype._setValue=Ds;var Pn=class extends rt{constructor(t){super(t),this._typeIds=new fr(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,e){return this.set(this.length,t,e)}set(t,e,n){return n===void 0&&(n=this._valueToChildTypeId(this,e,t)),this.setValue(t,e,n),this}setValue(t,e,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],s=this.children[i];s?.set(t,e)}addChild(t,e=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:s,typeIds:o}}=this,a=[...i,new D(e,t.type)];return this.type=new Ie(s,[...o,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.")}},uo=class extends Pn{},fo=class extends Pn{constructor(t){super(t),this._offsets=new fr(Int32Array)}setValue(t,e,n){let i=this._typeIds.set(t,n).buffer[t],s=this.getChildAt(this.type.typeIdToChildIndex[i]),o=this._offsets.set(t,s.length).buffer[t];s?.set(o,e)}};var Mi=class extends ee{constructor(t){super(t),this._values=new Ee(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,ke(e))}_flushPending(t,e){}};Mi.prototype._flushPending=Rn.prototype._flushPending;var Li=class extends ee{constructor(t){super(t),this._values=new Ee(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,ke(e))}_flushPending(t,e){}};Li.prototype._flushPending=Cn.prototype._flushPending;var Oa=class extends v{visitNull(){return co}visitBool(){return Hs}visitInt(){return Se}visitInt8(){return Qs}visitInt16(){return qs}visitInt32(){return to}visitInt64(){return eo}visitUint8(){return ro}visitUint16(){return no}visitUint32(){return io}visitUint64(){return so}visitFloat(){return on}visitFloat16(){return Zs}visitFloat32(){return Js}visitFloat64(){return Xs}visitUtf8(){return Mi}visitLargeUtf8(){return Li}visitBinary(){return Rn}visitLargeBinary(){return Cn}visitFixedSizeBinary(){return yi}visitDate(){return sn}visitDateDay(){return di}visitDateMillisecond(){return pi}visitTimestamp(){return yr}visitTimestampSecond(){return xi}visitTimestampMillisecond(){return Si}visitTimestampMicrosecond(){return Bi}visitTimestampNanosecond(){return Ai}visitTime(){return gr}visitTimeSecond(){return Ti}visitTimeMillisecond(){return Di}visitTimeMicrosecond(){return Oi}visitTimeNanosecond(){return Fi}visitDecimal(){return mi}visitList(){return oo}visitStruct(){return lo}visitUnion(){return Pn}visitDenseUnion(){return fo}visitSparseUnion(){return uo}visitDictionary(){return Ys}visitInterval(){return an}visitIntervalDayTime(){return gi}visitIntervalYearMonth(){return bi}visitDuration(){return mr}visitDurationSecond(){return wi}visitDurationMillisecond(){return _i}visitDurationMicrosecond(){return vi}visitDurationNanosecond(){return Ii}visitFixedSizeList(){return Ks}visitMap(){return ao}},Xl=new Oa;var B=class extends v{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 zt(r,t){return t instanceof r.constructor}function cn(r,t){return r===t||zt(r,t)}function br(r,t){return r===t||zt(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function ho(r,t){return r===t||zt(r,t)&&r.precision===t.precision}function cd(r,t){return r===t||zt(r,t)&&r.byteWidth===t.byteWidth}function Fa(r,t){return r===t||zt(r,t)&&r.unit===t.unit}function Ni(r,t){return r===t||zt(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function Ui(r,t){return r===t||zt(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function ld(r,t){return r===t||zt(r,t)&&r.children.length===t.children.length&&ir.compareManyFields(r.children,t.children)}function ud(r,t){return r===t||zt(r,t)&&r.children.length===t.children.length&&ir.compareManyFields(r.children,t.children)}function Ma(r,t){return r===t||zt(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&ir.compareManyFields(r.children,t.children)}function fd(r,t){return r===t||zt(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&ir.visit(r.indices,t.indices)&&ir.visit(r.dictionary,t.dictionary)}function La(r,t){return r===t||zt(r,t)&&r.unit===t.unit}function Ei(r,t){return r===t||zt(r,t)&&r.unit===t.unit}function hd(r,t){return r===t||zt(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&ir.compareManyFields(r.children,t.children)}function dd(r,t){return r===t||zt(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&ir.compareManyFields(r.children,t.children)}B.prototype.visitNull=cn;B.prototype.visitBool=cn;B.prototype.visitInt=br;B.prototype.visitInt8=br;B.prototype.visitInt16=br;B.prototype.visitInt32=br;B.prototype.visitInt64=br;B.prototype.visitUint8=br;B.prototype.visitUint16=br;B.prototype.visitUint32=br;B.prototype.visitUint64=br;B.prototype.visitFloat=ho;B.prototype.visitFloat16=ho;B.prototype.visitFloat32=ho;B.prototype.visitFloat64=ho;B.prototype.visitUtf8=cn;B.prototype.visitLargeUtf8=cn;B.prototype.visitBinary=cn;B.prototype.visitLargeBinary=cn;B.prototype.visitFixedSizeBinary=cd;B.prototype.visitDate=Fa;B.prototype.visitDateDay=Fa;B.prototype.visitDateMillisecond=Fa;B.prototype.visitTimestamp=Ni;B.prototype.visitTimestampSecond=Ni;B.prototype.visitTimestampMillisecond=Ni;B.prototype.visitTimestampMicrosecond=Ni;B.prototype.visitTimestampNanosecond=Ni;B.prototype.visitTime=Ui;B.prototype.visitTimeSecond=Ui;B.prototype.visitTimeMillisecond=Ui;B.prototype.visitTimeMicrosecond=Ui;B.prototype.visitTimeNanosecond=Ui;B.prototype.visitDecimal=cn;B.prototype.visitList=ld;B.prototype.visitStruct=ud;B.prototype.visitUnion=Ma;B.prototype.visitDenseUnion=Ma;B.prototype.visitSparseUnion=Ma;B.prototype.visitDictionary=fd;B.prototype.visitInterval=La;B.prototype.visitIntervalDayTime=La;B.prototype.visitIntervalYearMonth=La;B.prototype.visitDuration=Ei;B.prototype.visitDurationSecond=Ei;B.prototype.visitDurationMillisecond=Ei;B.prototype.visitDurationMicrosecond=Ei;B.prototype.visitDurationNanosecond=Ei;B.prototype.visitFixedSizeList=hd;B.prototype.visitMap=dd;var ir=new B;function ln(r,t){return ir.compareSchemas(r,t)}function Ql(r,t){return ir.compareFields(r,t)}function po(r,t){return ir.visit(r,t)}function pr(r){let t=r.type,e=new(Xl.getVisitFn(t)())(r);if(t.children&&t.children.length>0){let n=r.children||[],i={nullValues:r.nullValues},s=Array.isArray(n)?(o,a)=>n[a]||i:({name:o})=>n[o]||i;for(let[o,a]of t.children.entries()){let{type:c}=a,l=s(a,o);e.children.push(pr(Object.assign(Object.assign({},l),{type:c})))}}return e}function Ri(r,t){if(r instanceof R||r instanceof g||r.type instanceof m||ArrayBuffer.isView(r))return Mr(r);let e={type:t??mo(r),nullValues:[null]},n=[...Na(e)(r)],i=n.length===1?n[0]:n.reduce((s,o)=>s.concat(o));return m.isDictionary(i.type)?i.memoize():i}function mo(r){if(r.length===0)return new ut;let t=0,e=0,n=0,i=0,s=0,o=0,a=0,c=0;for(let l of r){if(l==null){++t;continue}switch(typeof l){case"bigint":++o;continue;case"boolean":++a;continue;case"number":++i;continue;case"string":++s;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 Qt;if(s+t===r.length)return new Ut(new Pt,new pt);if(o+t===r.length)return new be;if(a+t===r.length)return new kt;if(c+t===r.length)return new lr;if(e+t===r.length){let l=r,u=mo(l[l.findIndex(h=>h!=null)]);if(l.every(h=>h==null||po(u,mo(h))))return new Tt(new D("",u,!0))}else if(n+t===r.length){let l=new Map;for(let u of r)for(let h of Object.keys(u))!l.has(h)&&u[h]!=null&&l.set(h,new D(h,mo([u[h]]),!0));return new V([...l.values()])}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}function Na(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 s=0,o=pr(r);for(let a of i)o.append(a)[n]>=e&&++s&&(yield o.toVector());(o.finish().length>0||s===0)&&(yield o.toVector())}}function yo(r,t){return pd(r,t.map(e=>e.data.concat()))}function pd(r,t){let e=[...r.fields],n=[],i={numBatches:t.reduce((h,d)=>Math.max(h,d.length),0)},s=0,o=0,a=-1,c=t.length,l,u=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),o=Math.min(o,l?l.length:o);Number.isFinite(o)&&(u=md(e,o,u,t,i),o>0&&(n[s++]=w({type:new V(e),length:o,nullCount:0,children:u.slice()})))}return[r=r.assign(e),n.map(h=>new Y(r,h))]}function md(r,t,e,n,i){var s;let o=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let l=e[a],u=l?.length;if(u>=t)u===t?e[a]=l:(e[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(l.slice(t,u-t))));else{let h=r[a];r[a]=h.clone({nullable:!0}),e[a]=(s=l?._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:w({type:h.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var ql,J=class{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new E([]),this._offsets=[0],this;let i,s;t[0]instanceof E&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());let o=c=>{if(c){if(c instanceof Y)return[c];if(c instanceof J)return c.batches;if(c instanceof R){if(c.type instanceof V)return[new Y(new E(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>o(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>o(l));if(typeof c=="object"){let l=Object.keys(c),u=l.map(b=>new g([c[b]])),h=i??new E(l.map((b,M)=>new D(String(b),u[M].type,u[M].nullable))),[,d]=yo(h,u);return d.length===0?[new Y(c)]:d}}}return[]},a=t.flatMap(c=>o(c));if(i=(n=i??((e=a[0])===null||e===void 0?void 0:e.schema))!==null&&n!==void 0?n:new E([]),!(i instanceof E))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof Y))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!ln(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=s??ks(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=Ps(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?Fn.visit(new g(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
13
+ return true;`)}function cd(r){return typeof r!="bigint"?Le(r):`${Le(r)}n`}function Aa(r,t){let e=Math.ceil(r)*t-1;return(e-e%64+64||64)/t}function ql(r,t=0){return r.length>=t?r.subarray(0,t):ti(new r.constructor(t),r,0)}var Ee=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?Aa(n*1,this.BYTES_PER_ELEMENT):Aa(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=Aa(t*this.stride,this.BYTES_PER_ELEMENT);let e=ql(this.buffer,t);return this.clear(),e}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=ql(this.buffer,t)}},ur=class extends Ee{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}},Ln=class extends ur{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,e){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,s=t%8,o=n[i]>>s&1;return e?o===0&&(n[i]|=1<<s,++this.numValid):o===1&&(n[i]&=~(1<<s),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},Nn=class extends ur{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,e){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&n>=0&&i.fill(i[n],n,t),i[t]=i[t-1]+e,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}};var rt=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=he(t),this._nulls=new Ln,e&&e.length>0&&(this._isValid=Ql(e))}toVector(){return new g([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:e,_values:n,_nulls:i,_typeIds:s,children:o}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),s&&(t+=s.byteLength),o.reduce((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:s,length:o,nullCount:a,_typeIds:c,_offsets:l,_values:u,_nulls:h}=this;(e=c?.flush(o))?i=l?.flush(o):(i=l?.flush(o))?t=u?.flush(l.last()):t=u?.flush(o),a>0&&(n=h?.flush(o));let d=this.children.map(b=>b.flush());return this.clear(),w({type:s,length:o,nullCount:a,children:d,child:d[0],data:t,typeIds:e,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,e,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(e=this._values)===null||e===void 0||e.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let s of this.children)s.clear();return this}};rt.prototype.length=1;rt.prototype.stride=1;rt.prototype.children=null;rt.prototype.finished=!1;rt.prototype.nullValues=null;rt.prototype._isValid=()=>!0;var yt=class extends rt{constructor(t){super(t),this._values=new ur(this.ArrayType,0,this.stride)}setValue(t,e){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,e)}},ee=class extends rt{constructor(t){super(t),this._pendingLength=0,this._offsets=new Nn(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 tr?e[xe].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 tn=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 Et=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 Et).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+4),(e||new Et).__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):$.V1}schema(t){let e=this.bb.__offset(this.bb_pos,6);return e?(t||new ot).__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 tn).__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 tn).__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 Q).__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,$.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 E=class{constructor(t=[],e,n,i=$.V5){this.fields=t||[],this.metadata=e||new Map,n||(n=Ta(t)),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 E(n,this.metadata)}selectAt(t){let e=t.map(n=>this.fields[n]).filter(Boolean);return new E(e,this.metadata)}assign(...t){let e=t[0]instanceof E?t[0]:Array.isArray(t[0])?new E(t[0]):new E(t),n=[...this.fields],i=Hs(Hs(new Map,this.metadata),e.metadata),s=e.fields.filter(a=>{let c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:Hs(Hs(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),o=Ta(s,new Map);return new E([...n,...s],i,new Map([...this.dictionaries,...o]))}};E.prototype.fields=null;E.prototype.metadata=null;E.prototype.dictionaries=null;var D=class{static new(...t){let[e,n,i,s]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),s===void 0&&(s=t[0].metadata)),new D(`${e}`,n,i,s)}constructor(t,e,n=!1,i){this.name=t,this.type=e,this.nullable=n,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,n,i,s]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,n=this.type,i=this.nullable,s=this.metadata]=t:{name:e=this.name,type:n=this.type,nullable:i=this.nullable,metadata:s=this.metadata}=t[0],D.new(e,n,i,s)}};D.prototype.type=null;D.prototype.name=null;D.prototype.nullable=null;D.prototype.metadata=null;function Hs(r,t){return new Map([...r||new Map,...t||new Map])}function Ta(r,t=new Map){for(let e=-1,n=r.length;++e<n;){let s=r[e].type;if(m.isDictionary(s)){if(!t.has(s.id))t.set(s.id,s.dictionary);else if(t.get(s.id)!==s.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}s.children&&s.children.length>0&&Ta(s.children,t)}return t}var ld=ar,ud=Ct,fr=class{static decode(t){t=new ud(T(t));let e=Et.getRootAsFooter(t),n=E.decode(e.schema(),new Map,e.version());return new Da(n,e)}static encode(t){let e=new ld,n=E.encode(e,t.schema);Et.startRecordBatchesVector(e,t.numRecordBatches);for(let o of[...t.recordBatches()].slice().reverse())Re.encode(e,o);let i=e.endVector();Et.startDictionariesVector(e,t.numDictionaries);for(let o of[...t.dictionaryBatches()].slice().reverse())Re.encode(e,o);let s=e.endVector();return Et.startFooter(e),Et.addSchema(e,n),Et.addVersion(e,$.V5),Et.addRecordBatches(e,i),Et.addDictionaries(e,s),Et.finishFooterBuffer(e,Et.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=$.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 Da=class extends fr{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 Re.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let e=this._footer.dictionaries(t);if(e)return Re.decode(e)}return null}},Re=class{static decode(t){return new Re(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){let{metaDataLength:n}=e,i=BigInt(e.offset),s=BigInt(e.bodyLength);return tn.createBlock(t,i,n,s)}constructor(t,e,n){this.metaDataLength=t,this.offset=at(n),this.bodyLength=at(e)}};var q=Object.freeze({done:!0,value:void 0}),fi=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},en=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())}},Ys=class extends en{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return y(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(q);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 y(this,void 0,void 0,function*(){return yield this.abort(t),q})}return(t){return y(this,void 0,void 0,function*(){return yield this.close(),q})}read(t){return y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return y(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((e,n)=>{this.resolvers.push({resolve:e,reject:n})}):Promise.resolve(q)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}};var er=class extends Ys{write(t){if((t=T(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Qn(this.toUint8Array(!0)):this.toUint8Array(!1).then(Qn)}toUint8Array(t=!1){return t?ce(this._values)[0]:(()=>y(this,void 0,void 0,function*(){var e,n,i,s;let o=[],a=0;try{for(var c=!0,l=Te(this),u;u=yield l.next(),e=u.done,!e;c=!0){s=u.value,c=!1;let h=s;o.push(h),a+=h.byteLength}}catch(h){n={error:h}}finally{try{!c&&!e&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return ce(o,a)[0]}))()}},rr=class{constructor(t){t&&(this.source=new Oa(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)}},re=class{constructor(t){t instanceof re?this.source=t.source:t instanceof er?this.source=new hr(Bt.fromAsyncIterable(t)):ps(t)?this.source=new hr(Bt.fromNodeStream(t)):qn(t)?this.source=new hr(Bt.fromDOMStream(t)):hs(t)?this.source=new hr(Bt.fromDOMStream(t.body)):De(t)?this.source=new hr(Bt.fromIterable(t)):ae(t)?this.source=new hr(Bt.fromAsyncIterable(t)):de(t)&&(this.source=new hr(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)}},Oa=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)||q)}return(t){return Object.create(this.source.return&&this.source.return(t)||q)}},hr=class{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return y(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return y(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t,e="read"){return y(this,void 0,void 0,function*(){return yield this.source.next({cmd:e,size:t})})}throw(t){return y(this,void 0,void 0,function*(){let e=this.source.throw&&(yield this.source.throw(t))||q;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return y(this,void 0,void 0,function*(){let e=this.source.return&&(yield this.source.return(t))||q;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}};var hi=class extends rr{constructor(t,e){super(),this.position=0,this.buffer=T(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}}},Fr=class extends re{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=(()=>y(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending}))()}readInt32(t){return y(this,void 0,void 0,function*(){let{buffer:e,byteOffset:n}=yield this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)})}seek(t){return y(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:e,size:n,position:i}=this;if(e&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let s=i,o=0,a=0,c=Math.min(n,s+Math.min(n-s,t)),l=new Uint8Array(Math.max(0,(this.position=c)-s));for(;(s+=a)<c&&(o+=a)<l.byteLength;)({bytesRead:a}=yield e.read(l,o,l.byteLength-o,s));return l}return null})}readAt(t,e){return y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+e<i){let s=Math.min(i,t+e),o=new Uint8Array(s-t);return(yield n.read(o,0,e,t)).buffer}return new Uint8Array(e)})}close(){return y(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}};var Ma={};xr(Ma,{BaseInt64:()=>di,Int128:()=>ne,Int64:()=>St,Uint64:()=>G});function Un(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}var En=8,Fa=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],di=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let e=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=e[3]*n[3];this.buffer[0]=i&65535;let s=i>>>16;return i=e[2]*n[3],s+=i,i=e[3]*n[2]>>>0,s+=i,this.buffer[0]+=s<<16,this.buffer[1]=s>>>0<i?65536:0,this.buffer[1]+=s>>>16,this.buffer[1]+=e[1]*n[3]+e[2]*n[2]+e[3]*n[1],this.buffer[1]+=e[0]*n[3]+e[1]*n[2]+e[2]*n[1]+e[3]*n[0]<<16,this}_plus(t){let e=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],e<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=e}lessThan(t){return this.buffer[1]<t.buffer[1]||this.buffer[1]===t.buffer[1]&&this.buffer[0]<t.buffer[0]}equals(t){return this.buffer[1]===t.buffer[1]&&this.buffer[0]==t.buffer[0]}greaterThan(t){return t.lessThan(this)}hex(){return`${Un(this.buffer[1])} ${Un(this.buffer[0])}`}},G=class extends di{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return G.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return G.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.length,i=new G(e);for(let s=0;s<n;){let o=En<n-s?En:n-s,a=new G(new Uint32Array([Number.parseInt(t.slice(s,s+o),10),0])),c=new G(new Uint32Array([Fa[o],0]));i.times(c),i.plus(a),s+=o}return i}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)G.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new G(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new G(new Uint32Array(t.buffer)).plus(e)}},St=class extends di{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let e=this.buffer[1]<<0,n=t.buffer[1]<<0;return e<n||e===n&&this.buffer[0]<t.buffer[0]}static from(t,e=new Uint32Array(2)){return St.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return St.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,s=new St(e);for(let o=n?1:0;o<i;){let a=En<i-o?En:i-o,c=new St(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0])),l=new St(new Uint32Array([Fa[a],0]));s.times(l),s.plus(c),o+=a}return n?s.negate():s}static convertArray(t){let e=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)St.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new St(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new St(new Uint32Array(t.buffer)).plus(e)}},ne=class{constructor(t){this.buffer=t}high(){return new St(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new St(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 G(new Uint32Array([this.buffer[3],0])),n=new G(new Uint32Array([this.buffer[2],0])),i=new G(new Uint32Array([this.buffer[1],0])),s=new G(new Uint32Array([this.buffer[0],0])),o=new G(new Uint32Array([t.buffer[3],0])),a=new G(new Uint32Array([t.buffer[2],0])),c=new G(new Uint32Array([t.buffer[1],0])),l=new G(new Uint32Array([t.buffer[0],0])),u=G.multiply(s,l);this.buffer[0]=u.low();let h=new G(new Uint32Array([u.high(),0]));return u=G.multiply(i,l),h.plus(u),u=G.multiply(s,c),h.plus(u),this.buffer[1]=h.low(),this.buffer[3]=h.lessThan(u)?1:0,this.buffer[2]=h.high(),new G(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(G.multiply(n,l)).plus(G.multiply(i,c)).plus(G.multiply(s,a)),this.buffer[3]+=G.multiply(e,l).plus(G.multiply(n,c)).plus(G.multiply(i,a)).plus(G.multiply(s,o)).low(),this}plus(t){let e=new Uint32Array(4);return e[3]=this.buffer[3]+t.buffer[3]>>>0,e[2]=this.buffer[2]+t.buffer[2]>>>0,e[1]=this.buffer[1]+t.buffer[1]>>>0,e[0]=this.buffer[0]+t.buffer[0]>>>0,e[0]<this.buffer[0]>>>0&&++e[1],e[1]<this.buffer[1]>>>0&&++e[2],e[2]<this.buffer[2]>>>0&&++e[3],this.buffer[3]=e[3],this.buffer[2]=e[2],this.buffer[1]=e[1],this.buffer[0]=e[0],this}hex(){return`${Un(this.buffer[3])} ${Un(this.buffer[2])} ${Un(this.buffer[1])} ${Un(this.buffer[0])}`}static multiply(t,e){return new ne(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new ne(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return ne.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return ne.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,s=new ne(e);for(let o=n?1:0;o<i;){let a=En<i-o?En:i-o,c=new ne(new Uint32Array([Number.parseInt(t.slice(o,o+a),10),0,0,0])),l=new ne(new Uint32Array([Fa[a],0,0,0]));s.times(l),s.plus(c),o+=a}return n?s.negate():s}static convertArray(t){let e=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)ne.from(t[n],new Uint32Array(e.buffer,e.byteOffset+4*4*n,4));return e}};var pi=class extends v{constructor(t,e,n,i,s=$.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=i,this.metadataVersion=s}visit(t){return super.visit(t instanceof D?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return w({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({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 w({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 w({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 w({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 w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({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 w({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<$.V5&&this.readNullBitmap(t,n),t.mode===K.Sparse?this.visitSparseUnion(t,{length:e,nullCount:n}):this.visitDenseUnion(t,{length:e,nullCount:n})}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({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 w({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({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 w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return w({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 w({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)}},Ks=class extends pi{constructor(t,e,n,i,s){super(new Uint8Array(0),e,n,i,s),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):Xr(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return C(Uint8Array,C(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return C(Uint8Array,C(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){let{sources:n}=this;return m.isTimestamp(t)?C(Uint8Array,St.convertArray(n[e])):(m.isInt(t)||m.isTime(t))&&t.bitWidth===64||m.isDuration(t)?C(Uint8Array,St.convertArray(n[e])):m.isDate(t)&&t.unit===et.MILLISECOND?C(Uint8Array,St.convertArray(n[e])):m.isDecimal(t)?C(Uint8Array,ne.convertArray(n[e])):m.isBinary(t)||m.isLargeBinary(t)||m.isFixedSizeBinary(t)?fd(n[e]):m.isBool(t)?Xr(n[e]):m.isUtf8(t)||m.isLargeUtf8(t)?Pe(n[e].join("")):C(Uint8Array,C(t.ArrayType,n[e].map(i=>+i)))}};function fd(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 Rn=class extends ee{constructor(t){super(t),this._values=new Ee(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,T(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,s=0;for(let[o,a]of t)if(a===void 0)n.set(o,0);else{let c=a.length;i.set(a,s),n.set(o,c),s+=c}}};var Cn=class extends ee{constructor(t){super(t),this._values=new Ee(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,T(e))}_flushPending(t,e){let n=this._offsets,i=this._values.reserve(e).buffer,s=0;for(let[o,a]of t)if(a===void 0)n.set(o,BigInt(0));else{let c=a.length;i.set(a,s),n.set(o,BigInt(c)),s+=c}}};var Zs=class extends rt{constructor(t){super(t),this._values=new Ln}setValue(t,e){this._values.set(t,+e)}};var rn=class extends yt{};rn.prototype._setValue=fa;var mi=class extends rn{};mi.prototype._setValue=Is;var yi=class extends rn{};yi.prototype._setValue=xs;var gi=class extends yt{};gi.prototype._setValue=pa;var Js=class extends rt{constructor({type:t,nullValues:e,dictionaryHashFunction:n}){super({type:new Ut(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=dr({type:this.type.indices,nullValues:e}),this.dictionary=dr({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,e){let n=this.indices;return e=n.setValid(t,e),this.length=n.length,e}setValue(t,e){let n=this._keysToIndices,i=this.valueToKey(e),s=n[i];return s===void 0&&(n[i]=s=this._dictionaryOffset+this.dictionary.append(e).length-1),this.indices.setValue(t,s)}flush(){let t=this.type,e=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=e?e.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}};var bi=class extends yt{};bi.prototype._setValue=ua;var Xs=class extends rt{setValue(t,e){let[n]=this.children,i=t*this.stride;for(let s=-1,o=e.length;++s<o;)n.set(i+s,e[s])}addChild(t,e="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new Vt(this.type.listSize,new D(e,t.type,!0)),n}};var nn=class extends yt{setValue(t,e){this._values.set(t,e)}},Qs=class extends nn{setValue(t,e){super.setValue(t,oi(e))}},qs=class extends nn{},to=class extends nn{};var sn=class extends yt{};sn.prototype._setValue=ma;var wi=class extends sn{};wi.prototype._setValue=Ls;var _i=class extends sn{};_i.prototype._setValue=Ns;var pr=class extends yt{};pr.prototype._setValue=ya;var vi=class extends pr{};vi.prototype._setValue=Us;var Ii=class extends pr{};Ii.prototype._setValue=Es;var xi=class extends pr{};xi.prototype._setValue=Rs;var Si=class extends pr{};Si.prototype._setValue=Cs;var Se=class extends yt{setValue(t,e){this._values.set(t,e)}},eo=class extends Se{},ro=class extends Se{},no=class extends Se{},io=class extends Se{},so=class extends Se{},oo=class extends Se{},ao=class extends Se{},co=class extends Se{};var lo=class extends ee{constructor(t){super(t),this._offsets=new Nn(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 Tt(new D(e,t.type,!0)),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,s]of t)if(typeof s>"u")e.set(i,0);else{let o=s,a=o.length,c=e.set(i,a).buffer[i];for(let l=-1;++l<a;)n.set(c+l,o[l])}}};var uo=class extends ee{set(t,e){return super.set(t,e)}setValue(t,e){let n=e instanceof Map?e:new Map(Object.entries(e)),i=this._pending||(this._pending=new Map),s=i.get(t);s&&(this._pendingLength-=s.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,e=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new jt(new D(e,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let e=this._offsets,[n]=this.children;for(let[i,s]of t)if(s===void 0)e.set(i,0);else{let{[i]:o,[i+1]:a}=e.set(i,s.size).buffer;for(let c of s.entries())if(n.set(o,c),++o>=a)break}}};var fo=class extends rt{setValue(t,e){}setValid(t,e){return this.length=Math.max(t+1,this.length),e}};var ho=class extends rt{setValue(t,e){let{children:n,type:i}=this;switch(Array.isArray(e)||e.constructor){case!0:return i.children.forEach((s,o)=>n[o].set(t,e[o]));case Map:return i.children.forEach((s,o)=>n[o].set(t,e.get(s.name)));default:return i.children.forEach((s,o)=>n[o].set(t,e[s.name]))}}setValid(t,e){return super.setValid(t,e)||this.children.forEach(n=>n.setValid(t,e)),e}addChild(t,e=`${this.numChildren}`){let n=this.children.push(t);return this.type=new V([...this.type.children,new D(e,t.type,!0)]),n}};var mr=class extends yt{};mr.prototype._setValue=ha;var Bi=class extends mr{};Bi.prototype._setValue=Ss;var Ai=class extends mr{};Ai.prototype._setValue=Bs;var Ti=class extends mr{};Ti.prototype._setValue=As;var Di=class extends mr{};Di.prototype._setValue=Ts;var yr=class extends yt{};yr.prototype._setValue=da;var Oi=class extends yr{};Oi.prototype._setValue=Ds;var Fi=class extends yr{};Fi.prototype._setValue=Os;var Mi=class extends yr{};Mi.prototype._setValue=Fs;var Li=class extends yr{};Li.prototype._setValue=Ms;var Pn=class extends rt{constructor(t){super(t),this._typeIds=new ur(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,e){return this.set(this.length,t,e)}set(t,e,n){return n===void 0&&(n=this._valueToChildTypeId(this,e,t)),this.setValue(t,e,n),this}setValue(t,e,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],s=this.children[i];s?.set(t,e)}addChild(t,e=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:s,typeIds:o}}=this,a=[...i,new D(e,t.type)];return this.type=new Ie(s,[...o,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.")}},po=class extends Pn{},mo=class extends Pn{constructor(t){super(t),this._offsets=new ur(Int32Array)}setValue(t,e,n){let i=this._typeIds.set(t,n).buffer[t],s=this.getChildAt(this.type.typeIdToChildIndex[i]),o=this._offsets.set(t,s.length).buffer[t];s?.set(o,e)}};var Ni=class extends ee{constructor(t){super(t),this._values=new Ee(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,Pe(e))}_flushPending(t,e){}};Ni.prototype._flushPending=Rn.prototype._flushPending;var Ui=class extends ee{constructor(t){super(t),this._values=new Ee(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,Pe(e))}_flushPending(t,e){}};Ui.prototype._flushPending=Cn.prototype._flushPending;var La=class extends v{visitNull(){return fo}visitBool(){return Zs}visitInt(){return Se}visitInt8(){return eo}visitInt16(){return ro}visitInt32(){return no}visitInt64(){return io}visitUint8(){return so}visitUint16(){return oo}visitUint32(){return ao}visitUint64(){return co}visitFloat(){return nn}visitFloat16(){return Qs}visitFloat32(){return qs}visitFloat64(){return to}visitUtf8(){return Ni}visitLargeUtf8(){return Ui}visitBinary(){return Rn}visitLargeBinary(){return Cn}visitFixedSizeBinary(){return bi}visitDate(){return rn}visitDateDay(){return mi}visitDateMillisecond(){return yi}visitTimestamp(){return mr}visitTimestampSecond(){return Bi}visitTimestampMillisecond(){return Ai}visitTimestampMicrosecond(){return Ti}visitTimestampNanosecond(){return Di}visitTime(){return yr}visitTimeSecond(){return Oi}visitTimeMillisecond(){return Fi}visitTimeMicrosecond(){return Mi}visitTimeNanosecond(){return Li}visitDecimal(){return gi}visitList(){return lo}visitStruct(){return ho}visitUnion(){return Pn}visitDenseUnion(){return mo}visitSparseUnion(){return po}visitDictionary(){return Js}visitInterval(){return sn}visitIntervalDayTime(){return wi}visitIntervalYearMonth(){return _i}visitDuration(){return pr}visitDurationSecond(){return vi}visitDurationMillisecond(){return Ii}visitDurationMicrosecond(){return xi}visitDurationNanosecond(){return Si}visitFixedSizeList(){return Xs}visitMap(){return uo}},tu=new La;var B=class extends v{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 zt(r,t){return t instanceof r.constructor}function on(r,t){return r===t||zt(r,t)}function gr(r,t){return r===t||zt(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function yo(r,t){return r===t||zt(r,t)&&r.precision===t.precision}function hd(r,t){return r===t||zt(r,t)&&r.byteWidth===t.byteWidth}function Na(r,t){return r===t||zt(r,t)&&r.unit===t.unit}function Ei(r,t){return r===t||zt(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function Ri(r,t){return r===t||zt(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function dd(r,t){return r===t||zt(r,t)&&r.children.length===t.children.length&&nr.compareManyFields(r.children,t.children)}function pd(r,t){return r===t||zt(r,t)&&r.children.length===t.children.length&&nr.compareManyFields(r.children,t.children)}function Ua(r,t){return r===t||zt(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&nr.compareManyFields(r.children,t.children)}function md(r,t){return r===t||zt(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&nr.visit(r.indices,t.indices)&&nr.visit(r.dictionary,t.dictionary)}function Ea(r,t){return r===t||zt(r,t)&&r.unit===t.unit}function Ci(r,t){return r===t||zt(r,t)&&r.unit===t.unit}function yd(r,t){return r===t||zt(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&nr.compareManyFields(r.children,t.children)}function gd(r,t){return r===t||zt(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&nr.compareManyFields(r.children,t.children)}B.prototype.visitNull=on;B.prototype.visitBool=on;B.prototype.visitInt=gr;B.prototype.visitInt8=gr;B.prototype.visitInt16=gr;B.prototype.visitInt32=gr;B.prototype.visitInt64=gr;B.prototype.visitUint8=gr;B.prototype.visitUint16=gr;B.prototype.visitUint32=gr;B.prototype.visitUint64=gr;B.prototype.visitFloat=yo;B.prototype.visitFloat16=yo;B.prototype.visitFloat32=yo;B.prototype.visitFloat64=yo;B.prototype.visitUtf8=on;B.prototype.visitLargeUtf8=on;B.prototype.visitBinary=on;B.prototype.visitLargeBinary=on;B.prototype.visitFixedSizeBinary=hd;B.prototype.visitDate=Na;B.prototype.visitDateDay=Na;B.prototype.visitDateMillisecond=Na;B.prototype.visitTimestamp=Ei;B.prototype.visitTimestampSecond=Ei;B.prototype.visitTimestampMillisecond=Ei;B.prototype.visitTimestampMicrosecond=Ei;B.prototype.visitTimestampNanosecond=Ei;B.prototype.visitTime=Ri;B.prototype.visitTimeSecond=Ri;B.prototype.visitTimeMillisecond=Ri;B.prototype.visitTimeMicrosecond=Ri;B.prototype.visitTimeNanosecond=Ri;B.prototype.visitDecimal=on;B.prototype.visitList=dd;B.prototype.visitStruct=pd;B.prototype.visitUnion=Ua;B.prototype.visitDenseUnion=Ua;B.prototype.visitSparseUnion=Ua;B.prototype.visitDictionary=md;B.prototype.visitInterval=Ea;B.prototype.visitIntervalDayTime=Ea;B.prototype.visitIntervalYearMonth=Ea;B.prototype.visitDuration=Ci;B.prototype.visitDurationSecond=Ci;B.prototype.visitDurationMillisecond=Ci;B.prototype.visitDurationMicrosecond=Ci;B.prototype.visitDurationNanosecond=Ci;B.prototype.visitFixedSizeList=yd;B.prototype.visitMap=gd;var nr=new B;function an(r,t){return nr.compareSchemas(r,t)}function eu(r,t){return nr.compareFields(r,t)}function go(r,t){return nr.visit(r,t)}function dr(r){let t=r.type,e=new(tu.getVisitFn(t)())(r);if(t.children&&t.children.length>0){let n=r.children||[],i={nullValues:r.nullValues},s=Array.isArray(n)?(o,a)=>n[a]||i:({name:o})=>n[o]||i;for(let[o,a]of t.children.entries()){let{type:c}=a,l=s(a,o);e.children.push(dr(Object.assign(Object.assign({},l),{type:c})))}}return e}function Pi(r,t){if(r instanceof R||r instanceof g||r.type instanceof m||ArrayBuffer.isView(r))return Or(r);let e={type:t??bo(r),nullValues:[null]},n=[...Ra(e)(r)],i=n.length===1?n[0]:n.reduce((s,o)=>s.concat(o));return m.isDictionary(i.type)?i.memoize():i}function bo(r){if(r.length===0)return new ut;let t=0,e=0,n=0,i=0,s=0,o=0,a=0,c=0;for(let l of r){if(l==null){++t;continue}switch(typeof l){case"bigint":++o;continue;case"boolean":++a;continue;case"number":++i;continue;case"string":++s;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 Qt;if(s+t===r.length)return new Ut(new Pt,new pt);if(o+t===r.length)return new be;if(a+t===r.length)return new kt;if(c+t===r.length)return new cr;if(e+t===r.length){let l=r,u=bo(l[l.findIndex(h=>h!=null)]);if(l.every(h=>h==null||go(u,bo(h))))return new Tt(new D("",u,!0))}else if(n+t===r.length){let l=new Map;for(let u of r)for(let h of Object.keys(u))!l.has(h)&&u[h]!=null&&l.set(h,new D(h,bo([u[h]]),!0));return new V([...l.values()])}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}function Ra(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 s=0,o=dr(r);for(let a of i)o.append(a)[n]>=e&&++s&&(yield o.toVector());(o.finish().length>0||s===0)&&(yield o.toVector())}}function wo(r,t){return bd(r,t.map(e=>e.data.concat()))}function bd(r,t){let e=[...r.fields],n=[],i={numBatches:t.reduce((h,d)=>Math.max(h,d.length),0)},s=0,o=0,a=-1,c=t.length,l,u=[];for(;i.numBatches-- >0;){for(o=Number.POSITIVE_INFINITY,a=-1;++a<c;)u[a]=l=t[a].shift(),o=Math.min(o,l?l.length:o);Number.isFinite(o)&&(u=wd(e,o,u,t,i),o>0&&(n[s++]=w({type:new V(e),length:o,nullCount:0,children:u.slice()})))}return[r=r.assign(e),n.map(h=>new Y(r,h))]}function wd(r,t,e,n,i){var s;let o=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let l=e[a],u=l?.length;if(u>=t)u===t?e[a]=l:(e[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(l.slice(t,u-t))));else{let h=r[a];r[a]=h.clone({nullable:!0}),e[a]=(s=l?._changeLengthAndBackfillNullBitmap(t))!==null&&s!==void 0?s:w({type:h.type,length:t,nullCount:t,nullBitmap:new Uint8Array(o)})}}return e}var ru,J=class{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new E([]),this._offsets=[0],this;let i,s;t[0]instanceof E&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(s=t.pop());let o=c=>{if(c){if(c instanceof Y)return[c];if(c instanceof J)return c.batches;if(c instanceof R){if(c.type instanceof V)return[new Y(new E(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>o(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>o(l));if(typeof c=="object"){let l=Object.keys(c),u=l.map(b=>new g([c[b]])),h=i??new E(l.map((b,M)=>new D(String(b),u[M].type,u[M].nullable))),[,d]=wo(h,u);return d.length===0?[new Y(c)]:d}}}return[]},a=t.flatMap(c=>o(c));if(i=(n=i??((e=a[0])===null||e===void 0?void 0:e.schema))!==null&&n!==void 0?n:new E([]),!(i instanceof E))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof Y))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!an(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=s??zs(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=js(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?Fn.visit(new g(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 J(e,n.map(i=>new Y(e,i)))}slice(t,e){let n=this.schema;[t,e]=si({length:this.numRows},t,e);let i=Vs(this.data,this._offsets,t,e);return new J(n,i.map(s=>new Y(n,s)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let e=this.data.map(n=>n.children[t]);if(e.length===0){let{type:n}=this.schema.fields[t],i=w({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new g(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 g([w({type:new ut,length:this.numRows})]));let s=n.fields.slice(),o=s[t].clone({type:e.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[s[t],a[t]]=[o,e],[n,i]=yo(n,a)}return new J(n,i)}select(t){let e=this.schema.fields.reduce((n,i,s)=>n.set(i.name,s),new Map);return this.selectAt(t.map(n=>e.get(n)).filter(n=>n>-1))}selectAt(t){let e=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new J(e,n)}assign(t){let e=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[u,h]=a,d=e.findIndex(b=>b.name===c.name);return~d?h[d]=l:u.push(l),a},[[],[]]),s=this.schema.assign(t.schema),o=[...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 J(...yo(s,o))}};ql=Symbol.toStringTag;J[ql]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=On(ci),r.get=On(mt.getVisitFn(f.Struct)),r.set=js(Dt.getVisitFn(f.Struct)),r.indexOf=zs(en.getVisitFn(f.Struct)),"Table"))(J.prototype);var eu,Y=class{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof E))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=w({nullCount:0,type:new V(this.schema.fields),children:this.schema.fields.map(e=>w({type:e.type,nullCount:0}))})]=t,!(this.data instanceof R))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=tu(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:n,children:i,length:s}=Object.keys(e).reduce((c,l,u)=>(c.children[u]=e[l],c.length=Math.max(c.length,e[l].length),c.fields[u]=D.new({name:l,type:e[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new E(n),a=w({type:new V(n),length:s,children:i,nullCount:0});[this.schema,this.data]=tu(o,a.children,s);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=ru(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return mt.visit(this.data,t)}set(t,e){return Dt.visit(this.data,t,e)}indexOf(t,e){return en.visit(this.data,t,e)}[Symbol.iterator](){return Fn.visit(new g([this.data]))}toArray(){return[...this]}concat(...t){return new J(this.schema,[this,...t])}slice(t,e){let[n]=new g([this.data]).slice(t,e).data;return new Y(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 g([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 g([w({type:new ut,length:this.numRows})]));let s=n.fields.slice(),o=i.children.slice(),a=s[t].clone({type:e.type});[s[t],o[t]]=[a,e.data[0]],n=new E(s,new Map(this.schema.metadata)),i=w({type:new V(s),children:o})}return new Y(n,i)}select(t){let e=this.schema.select(t),n=new V(e.fields),i=[];for(let s of t){let o=this.schema.fields.findIndex(a=>a.name===s);~o&&(i[o]=this.data.children[o])}return new Y(e,w({type:n,length:this.numRows,children:i}))}selectAt(t){let e=this.schema.selectAt(t),n=t.map(s=>this.data.children[s]).filter(Boolean),i=w({type:new V(e.fields),length:this.numRows,children:n});return new Y(e,i)}};eu=Symbol.toStringTag;Y[eu]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Y.prototype);function tu(r,t,e=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...r.fields],s=[...t],o=(e+63&-64)>>3;for(let[a,c]of r.fields.entries()){let l=t[a];(!l||l.length!==e)&&(i[a]=c.clone({nullable:!0}),s[a]=(n=l?._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:w({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(i),w({type:new V(i),length:e,children:s})]}function ru(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 s=-1,o=r.length;++s<o;){let{type:a}=r[s],c=t[s];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])ru(a.children,l?.children,e);if(m.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 un=class extends Y{constructor(t){let e=t.fields.map(i=>w({type:i.type})),n=w({type:new V(t.fields),nullCount:0,children:e});super(t,n)}};var ft=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 ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new ft).__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):$.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):P.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 Q).__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,$.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,P.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,BigInt("0"))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,n,i,s,o){return ft.startMessage(t),ft.addVersion(t,e),ft.addHeaderType(t,n),ft.addHeader(t,i),ft.addBodyLength(t,s),ft.addCustomMetadata(t,o),ft.endMessage(t)}};var Ua=class extends v{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return Ye.startNull(e),Ye.endNull(e)}visitInt(t,e){return _t.startInt(e),_t.addBitWidth(e,t.bitWidth),_t.addIsSigned(e,t.isSigned),_t.endInt(e)}visitFloat(t,e){return Kt.startFloatingPoint(e),Kt.addPrecision(e,t.precision),Kt.endFloatingPoint(e)}visitBinary(t,e){return ze.startBinary(e),ze.endBinary(e)}visitLargeBinary(t,e){return Ge.startLargeBinary(e),Ge.endLargeBinary(e)}visitBool(t,e){return We.startBool(e),We.endBool(e)}visitUtf8(t,e){return Ze.startUtf8(e),Ze.endUtf8(e)}visitLargeUtf8(t,e){return $e.startLargeUtf8(e),$e.endLargeUtf8(e)}visitDecimal(t,e){return vt.startDecimal(e),vt.addScale(e,t.scale),vt.addPrecision(e,t.precision),vt.addBitWidth(e,t.bitWidth),vt.endDecimal(e)}visitDate(t,e){return Gt.startDate(e),Gt.addUnit(e,t.unit),Gt.endDate(e)}visitTime(t,e){return Mt.startTime(e),Mt.addUnit(e,t.unit),Mt.addBitWidth(e,t.bitWidth),Mt.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return Lt.startTimestamp(e),Lt.addUnit(e,t.unit),n!==void 0&&Lt.addTimezone(e,n),Lt.endTimestamp(e)}visitInterval(t,e){return Zt.startInterval(e),Zt.addUnit(e,t.unit),Zt.endInterval(e)}visitDuration(t,e){return $t.startDuration(e),$t.addUnit(e,t.unit),$t.endDuration(e)}visitList(t,e){return He.startList(e),He.endList(e)}visitStruct(t,e){return Ke.startStruct_(e),Ke.endStruct_(e)}visitUnion(t,e){It.startTypeIdsVector(e,t.typeIds.length);let n=It.createTypeIdsVector(e,t.typeIds);return It.startUnion(e),It.addMode(e,t.mode),It.addTypeIds(e,n),It.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return le.startDictionaryEncoding(e),le.addId(e,BigInt(t.id)),le.addIsOrdered(e,t.isOrdered),n!==void 0&&le.addIndexType(e,n),le.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return Ht.startFixedSizeBinary(e),Ht.addByteWidth(e,t.byteWidth),Ht.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Yt.startFixedSizeList(e),Yt.addListSize(e,t.listSize),Yt.endFixedSizeList(e)}visitMap(t,e){return Jt.startMap(e),Jt.addKeysSorted(e,t.keysSorted),Jt.endMap(e)}},go=new Ua;function ou(r,t=new Map){return new E(yd(r,t),bo(r.metadata),t)}function Ea(r){return new Ot(r.count,cu(r.columns),lu(r.columns))}function au(r){return new se(Ea(r.data),r.id,r.isDelta)}function yd(r,t){return(r.fields||[]).filter(Boolean).map(e=>D.fromJSON(e,t))}function nu(r,t){return(r.children||[]).filter(Boolean).map(e=>D.fromJSON(e,t))}function cu(r){return(r||[]).reduce((t,e)=>[...t,new Be(e.count,gd(e.VALIDITY)),...cu(e.children)],[])}function lu(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new ie(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new ie(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new ie(t.length,i.OFFSET.length)),i.DATA&&t.push(new ie(t.length,i.DATA.length)),t=lu(i.children,t)}return t}function gd(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function uu(r,t){let e,n,i,s,o,a;return!t||!(s=r.dictionary)?(o=su(r,nu(r,t)),i=new D(r.name,o,r.nullable,bo(r.metadata))):t.has(e=s.id)?(n=(n=s.indexType)?iu(n):new pt,a=new Ut(t.get(e),n,e,s.isOrdered),i=new D(r.name,a,r.nullable,bo(r.metadata))):(n=(n=s.indexType)?iu(n):new pt,t.set(e,o=su(r,nu(r,t))),a=new Ut(o,n,e,s.isOrdered),i=new D(r.name,a,r.nullable,bo(r.metadata))),i||null}function bo(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function iu(r){return new it(r.isSigned,r.bitWidth)}function su(r,t){let e=r.type.name;switch(e){case"NONE":return new ut;case"null":return new ut;case"binary":return new ue;case"largebinary":return new Xe;case"utf8":return new Pt;case"largeutf8":return new Qe;case"bool":return new kt;case"list":return new Tt((t||[])[0]);case"struct":return new V(t||[]);case"struct_":return new V(t||[])}switch(e){case"int":{let n=r.type;return new it(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new At(j[n.precision])}case"decimal":{let n=r.type;return new fe(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new qt(et[n.unit])}case"time":{let n=r.type;return new xt(p[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new Nt(p[n.unit],n.timezone)}case"interval":{let n=r.type;return new te(nt[n.unit])}case"duration":{let n=r.type;return new qe(p[n.unit])}case"union":{let n=r.type,[i,...s]=(n.mode+"").toLowerCase(),o=i.toUpperCase()+s.join("");return new Ie(K[o],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new tr(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Vt(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new jt((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var bd=cr,wd=Ct,gt=class{static fromJSON(t,e){let n=new gt(0,$.V5,e);return n._createHeader=_d(t,e),n}static decode(t){t=new wd(T(t));let e=ft.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),s=e.headerType(),o=new gt(n,i,s);return o._createHeader=vd(e,s),o}static encode(t){let e=new bd,n=-1;return t.isSchema()?n=E.encode(e,t.header()):t.isRecordBatch()?n=Ot.encode(e,t.header()):t.isDictionaryBatch()&&(n=se.encode(e,t.header())),ft.startMessage(e),ft.addVersion(e,$.V5),ft.addHeader(e,n),ft.addHeaderType(e,t.headerType),ft.addBodyLength(e,BigInt(t.bodyLength)),ft.finishMessageBuffer(e,ft.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof E)return new gt(0,$.V5,P.Schema,t);if(t instanceof Ot)return new gt(e,$.V5,P.RecordBatch,t);if(t instanceof se)return new gt(e,$.V5,P.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===P.Schema}isRecordBatch(){return this.headerType===P.RecordBatch}isDictionaryBatch(){return this.headerType===P.DictionaryBatch}constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=at(t)}},Ot=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=at(t)}},se=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,n=!1){this._data=t,this._isDelta=n,this._id=at(e)}},ie=class{constructor(t,e){this.offset=at(t),this.length=at(e)}},Be=class{constructor(t,e){this.length=at(t),this.nullCount=at(e)}};function _d(r,t){return()=>{switch(t){case P.Schema:return E.fromJSON(r);case P.RecordBatch:return Ot.fromJSON(r);case P.DictionaryBatch:return se.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${P[t]}, type: ${t} }`)}}function vd(r,t){return()=>{switch(t){case P.Schema:return E.decode(r.header(new ot),new Map,r.version());case P.RecordBatch:return Ot.decode(r.header(new Ft),r.version());case P.DictionaryBatch:return se.decode(r.header(new me),r.version())}throw new Error(`Unrecognized Message type: { name: ${P[t]}, type: ${t} }`)}}D.encode=Ld;D.decode=Fd;D.fromJSON=uu;E.encode=Md;E.decode=Id;E.fromJSON=ou;Ot.encode=Nd;Ot.decode=xd;Ot.fromJSON=Ea;se.encode=Ud;se.decode=Sd;se.fromJSON=au;Be.encode=Ed;Be.decode=Ad;ie.encode=Rd;ie.decode=Bd;function Id(r,t=new Map,e=$.V5){let n=Od(r,t);return new E(n,wo(r),t,e)}function xd(r,t=$.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new Ot(r.length(),Td(r),Dd(r,t))}function Sd(r,t=$.V5){return new se(Ot.decode(r.data(),t),r.id(),r.isDelta())}function Bd(r){return new ie(r.offset(),r.length())}function Ad(r){return new Be(r.length(),r.nullCount())}function Td(r){let t=[];for(let e,n=-1,i=-1,s=r.nodesLength();++n<s;)(e=r.nodes(n))&&(t[++i]=Be.decode(e));return t}function Dd(r,t){let e=[];for(let n,i=-1,s=-1,o=r.buffersLength();++i<o;)(n=r.buffers(i))&&(t<$.V4&&(n.bb_pos+=8*(i+1)),e[++s]=ie.decode(n));return e}function Od(r,t){let e=[];for(let n,i=-1,s=-1,o=r.fieldsLength();++i<o;)(n=r.fields(i))&&(e[++s]=D.decode(n,t));return e}function fu(r,t){let e=[];for(let n,i=-1,s=-1,o=r.childrenLength();++i<o;)(n=r.children(i))&&(e[++s]=D.decode(n,t));return e}function Fd(r,t){let e,n,i,s,o,a;return!t||!(a=r.dictionary())?(i=du(r,fu(r,t)),n=new D(r.name(),i,r.nullable(),wo(r))):t.has(e=at(a.id()))?(s=(s=a.indexType())?hu(s):new pt,o=new Ut(t.get(e),s,e,a.isOrdered()),n=new D(r.name(),o,r.nullable(),wo(r))):(s=(s=a.indexType())?hu(s):new pt,t.set(e,i=du(r,fu(r,t))),o=new Ut(i,s,e,a.isOrdered()),n=new D(r.name(),o,r.nullable(),wo(r))),n||null}function wo(r){let t=new Map;if(r)for(let e,n,i=-1,s=Math.trunc(r.customMetadataLength());++i<s;)(e=r.customMetadata(i))&&(n=e.key())!=null&&t.set(n,e.value());return t}function hu(r){return new it(r.isSigned(),r.bitWidth())}function du(r,t){let e=r.typeType();switch(e){case Z.NONE:return new ut;case Z.Null:return new ut;case Z.Binary:return new ue;case Z.LargeBinary:return new Xe;case Z.Utf8:return new Pt;case Z.LargeUtf8:return new Qe;case Z.Bool:return new kt;case Z.List:return new Tt((t||[])[0]);case Z.Struct_:return new V(t||[])}switch(e){case Z.Int:{let n=r.type(new _t);return new it(n.isSigned(),n.bitWidth())}case Z.FloatingPoint:{let n=r.type(new Kt);return new At(n.precision())}case Z.Decimal:{let n=r.type(new vt);return new fe(n.scale(),n.precision(),n.bitWidth())}case Z.Date:{let n=r.type(new Gt);return new qt(n.unit())}case Z.Time:{let n=r.type(new Mt);return new xt(n.unit(),n.bitWidth())}case Z.Timestamp:{let n=r.type(new Lt);return new Nt(n.unit(),n.timezone())}case Z.Interval:{let n=r.type(new Zt);return new te(n.unit())}case Z.Duration:{let n=r.type(new $t);return new qe(n.unit())}case Z.Union:{let n=r.type(new It);return new Ie(n.mode(),n.typeIdsArray()||[],t||[])}case Z.FixedSizeBinary:{let n=r.type(new Ht);return new tr(n.byteWidth())}case Z.FixedSizeList:{let n=r.type(new Yt);return new Vt(n.listSize(),(t||[])[0])}case Z.Map:{let n=r.type(new Jt);return new jt((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${Z[e]}" (${e})`)}function Md(r,t){let e=t.fields.map(s=>D.encode(r,s));ot.startFieldsVector(r,e.length);let n=ot.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?ot.createCustomMetadataVector(r,[...t.metadata].map(([s,o])=>{let a=r.createString(`${s}`),c=r.createString(`${o}`);return Q.startKeyValue(r),Q.addKey(r,a),Q.addValue(r,c),Q.endKeyValue(r)})):-1;return ot.startSchema(r),ot.addFields(r,n),ot.addEndianness(r,Cd?Ar.Little:Ar.Big),i!==-1&&ot.addCustomMetadata(r,i),ot.endSchema(r)}function Ld(r,t){let e=-1,n=-1,i=-1,s=t.type,o=t.typeId;m.isDictionary(s)?(o=s.dictionary.typeId,i=go.visit(s,r),n=go.visit(s.dictionary,r)):n=go.visit(s,r);let a=(s.children||[]).map(u=>D.encode(r,u)),c=dt.createChildrenVector(r,a),l=t.metadata&&t.metadata.size>0?dt.createCustomMetadataVector(r,[...t.metadata].map(([u,h])=>{let d=r.createString(`${u}`),b=r.createString(`${h}`);return Q.startKeyValue(r),Q.addKey(r,d),Q.addValue(r,b),Q.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),dt.startField(r),dt.addType(r,n),dt.addTypeType(r,o),dt.addChildren(r,c),dt.addNullable(r,!!t.nullable),e!==-1&&dt.addName(r,e),i!==-1&&dt.addDictionary(r,i),l!==-1&&dt.addCustomMetadata(r,l),dt.endField(r)}function Nd(r,t){let e=t.nodes||[],n=t.buffers||[];Ft.startNodesVector(r,e.length);for(let o of e.slice().reverse())Be.encode(r,o);let i=r.endVector();Ft.startBuffersVector(r,n.length);for(let o of n.slice().reverse())ie.encode(r,o);let s=r.endVector();return Ft.startRecordBatch(r),Ft.addLength(r,BigInt(t.length)),Ft.addNodes(r,i),Ft.addBuffers(r,s),Ft.endRecordBatch(r)}function Ud(r,t){let e=Ot.encode(r,t.data);return me.startDictionaryBatch(r),me.addId(r,BigInt(t.id)),me.addIsDelta(r,t.isDelta),me.addData(r,e),me.endDictionaryBatch(r)}function Ed(r,t){return vn.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function Rd(r,t){return _n.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var Cd=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var Ca=r=>`Expected ${P[r]} Message in stream, but was null or length 0.`,Pa=r=>`Header pointer of flatbuffer-encoded ${P[r]} Message is null or length 0.`,pu=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,mu=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`,kn=class{constructor(t){this.source=t instanceof nr?t:new nr(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?q:t.value===-1&&(t=this.readMetadataLength()).done?q:(t=this.readMetadata(t.value)).done?q: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(Ca(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=T(this.source.read(t));if(e.byteLength<t)throw new Error(mu(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=P.Schema,n=this.readMessage(e),i=n?.header();if(t&&!i)throw new Error(Pa(e));return i}readMetadataLength(){let t=this.source.read(_o),e=t&&new Ct(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let e=this.source.read(t);if(!e)return q;if(e.byteLength<t)throw new Error(pu(t,e.byteLength));return{done:!1,value:gt.decode(e)}}},Ci=class{constructor(t,e){this.source=t instanceof re?t:cs(t)?new Lr(t,e):new re(t)}[Symbol.asyncIterator](){return this}next(){return y(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?q:t.value===-1&&(t=yield this.readMetadataLength()).done?q:(t=yield this.readMetadata(t.value)).done?q:t})}throw(t){return y(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return y(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return y(this,void 0,void 0,function*(){let e;if((e=yield this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Ca(t));return e.value})}readMessageBody(t){return y(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=T(yield this.source.read(t));if(e.byteLength<t)throw new Error(mu(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(t=!1){return y(this,void 0,void 0,function*(){let e=P.Schema,n=yield this.readMessage(e),i=n?.header();if(t&&!i)throw new Error(Pa(e));return i})}readMetadataLength(){return y(this,void 0,void 0,function*(){let t=yield this.source.read(_o),e=t&&new Ct(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return y(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return q;if(e.byteLength<t)throw new Error(pu(t,e.byteLength));return{done:!1,value:gt.decode(e)}})}},Pi=class extends kn{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof li?t:new li(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:gt.fromJSON(t.schema,P.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:gt.fromJSON(e,P.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:gt.fromJSON(e,P.RecordBatch)}}return this._body=[],q}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((i,s)=>[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE_ID&&[s.TYPE_ID]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...e(s.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Ca(t));return e.value}readSchema(){let t=P.Schema,e=this.readMessage(t),n=e?.header();if(!e||!n)throw new Error(Pa(t));return n}},_o=4,Ra="ARROW1",Vn=new Uint8Array(Ra.length);for(let r=0;r<Ra.length;r+=1)Vn[r]=Ra.codePointAt(r);function vo(r,t=0){for(let e=-1,n=Vn.length;++e<n;)if(Vn[e]!==r[t+e])return!1;return!0}var jn=Vn.length,ka=jn+_o,yu=jn*2+_o;var bt=class extends nn{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 ae(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 bt?t:os(t)?kd(t):cs(t)?zd(t):ae(t)?(()=>y(this,void 0,void 0,function*(){return yield bt.from(yield t)}))():ls(t)||Xn(t)||fs(t)||de(t)?jd(new re(t)):Vd(new nr(t))}static readAll(t){return t instanceof bt?t.isSync()?gu(t):bu(t):os(t)||ArrayBuffer.isView(t)||De(t)||as(t)?gu(t):bu(t)}},sr=class extends bt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return oe(this,arguments,function*(){yield U(yield*bn(Te(this[Symbol.iterator]())))})}},Nr=class extends bt{constructor(t){super(t),this._impl=t}readAll(){var t,e,n,i;return y(this,void 0,void 0,function*(){let s=new Array;try{for(var o=!0,a=Te(this),c;c=yield a.next(),t=c.done,!t;o=!0){i=c.value,o=!1;let l=i;s.push(l)}}catch(l){e={error:l}}finally{try{!o&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(e)throw e.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Ur=class extends sr{constructor(t){super(t),this._impl=t}},ki=class extends Nr{constructor(t){super(t),this._impl=t}},Io=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=w({type:new V(this.schema.fields),length:t.length,children:n});return new Y(this.schema,i)}_loadDictionaryBatch(t,e){let{id:n,isDelta:i}=t,{dictionaries:s,schema:o}=this,a=s.get(n);if(i||!a){let c=o.dictionaries.get(n),l=this._loadVectors(t.data,e,[c]);return(a&&i?a.concat(new g(l)):new g(l)).memoize()}return a.memoize()}_loadVectors(t,e,n){return new hi(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},zn=class extends Io{constructor(t,e){super(e),this._reader=os(t)?new Pi(this._handle=t):new kn(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=wu(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):q}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):q}next(){if(this.closed)return q;let t,{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new un(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Wn=class extends Io{constructor(t,e){super(e),this._reader=new Ci(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return y(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return y(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=wu(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):q})}return(t){return y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):q})}next(){return y(this,void 0,void 0,function*(){if(this.closed)return q;let t,{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new un(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return y(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},xo=class extends zn{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 ui?t:new ui(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(P.RecordBatch);if(i?.isRecordBatch()){let s=i.header(),o=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(t){var e;let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(P.DictionaryBatch);if(i?.isDictionaryBatch()){let s=i.header(),o=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}}_readFooter(){let{_handle:t}=this,e=t.size-ka,n=t.readInt32(e),i=t.readAt(e-n,n);return hr.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}},Va=class extends Wn{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 Lr?t:new Lr(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return y(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){var e;return y(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(P.RecordBatch);if(i?.isRecordBatch()){let s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){var e;return y(this,void 0,void 0,function*(){let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(P.DictionaryBatch);if(i?.isDictionaryBatch()){let s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}})}_readFooter(){return y(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-ka,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return hr.decode(i)})}_readNextMessageAndValidate(t){return y(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})}},ja=class extends zn{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new $s(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function wu(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*gu(r){let t=bt.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function bu(r){return oe(this,arguments,function*(){let e=yield U(bt.from(r));try{if(!(yield U(e.open({autoDestroy:!1}))).closed)do yield yield U(e);while(!(yield U(e.reset().open())).closed)}finally{yield U(e.cancel())}})}function kd(r){return new sr(new ja(r))}function Vd(r){let t=r.peek(jn+7&-8);return t&&t.byteLength>=4?vo(t)?new Ur(new xo(r.read())):new sr(new zn(r)):new sr(new zn(function*(){}()))}function jd(r){return y(this,void 0,void 0,function*(){let t=yield r.peek(jn+7&-8);return t&&t.byteLength>=4?vo(t)?new Ur(new xo(yield r.read())):new Nr(new Wn(r)):new Nr(new Wn(function(){return oe(this,arguments,function*(){})}()))})}function zd(r){return y(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new Lr(r,t);return t>=yu&&vo(yield e.readAt(0,jn+7&-8))?new ki(new Va(e)):new Nr(new Wn(e))})}var tt=class extends v{static assemble(...t){let e=i=>i.flatMap(s=>Array.isArray(s)?e(s):s instanceof Y?s.data.children:s.data),n=new tt;return n.visitMany(e(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof g)return this.visitMany(t.data),this;let{type:e}=t;if(!m.isDictionary(e)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(m.isUnion(e))this.nodes.push(new Be(n,0));else{let{nullCount:i}=t;m.isNull(e)||Ce.call(this,i<=0?new Uint8Array(0):Qr(t.offset,n,t.nullBitmap)),this.nodes.push(new Be(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 Ce(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new ie(this._byteLength,t)),this._byteLength+=t,this}function Wd(r){var t;let{type:e,length:n,typeIds:i,valueOffsets:s}=r;if(Ce.call(this,i),e.mode===K.Sparse)return za.call(this,r);if(e.mode===K.Dense){if(r.offset<=0)return Ce.call(this,s),za.call(this,r);{let o=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,u,h=-1;++h<n;)(l=i[h])!==void 0&&((u=a[l])===void 0&&(u=a[l]=s[h]),o[h]=s[h]-u,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);Ce.call(this,o),this.visitMany(r.children.map((l,u)=>{let h=e.typeIds[u],d=a[h],b=c[h];return l.slice(d,Math.min(n,b))}))}}return this}function Gd(r){let t;return r.nullCount>=r.length?Ce.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?Ce.call(this,Qr(r.offset,r.length,t)):Ce.call(this,qr(r.values))}function wr(r){return Ce.call(this,r.values.subarray(0,r.length*r.stride))}function So(r){let{length:t,values:e,valueOffsets:n}=r,i=at(n[0]),s=at(n[t]),o=Math.min(s-i,e.byteLength-i);return Ce.call(this,ds(-i,t+1,n)),Ce.call(this,e.subarray(i,i+o)),this}function Wa(r){let{length:t,valueOffsets:e}=r;if(e){let{[0]:n,[t]:i}=e;return Ce.call(this,ds(-n,t+1,e)),this.visit(r.children[0].slice(n,i-n))}return this.visit(r.children[0])}function za(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}tt.prototype.visitBool=Gd;tt.prototype.visitInt=wr;tt.prototype.visitFloat=wr;tt.prototype.visitUtf8=So;tt.prototype.visitLargeUtf8=So;tt.prototype.visitBinary=So;tt.prototype.visitLargeBinary=So;tt.prototype.visitFixedSizeBinary=wr;tt.prototype.visitDate=wr;tt.prototype.visitTimestamp=wr;tt.prototype.visitTime=wr;tt.prototype.visitDecimal=wr;tt.prototype.visitList=Wa;tt.prototype.visitStruct=za;tt.prototype.visitUnion=Wd;tt.prototype.visitInterval=wr;tt.prototype.visitDuration=wr;tt.prototype.visitFixedSizeList=Wa;tt.prototype.visitMap=Wa;var fn=class extends nn{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 rr,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Rt(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 ae(t)?t.then(e=>this.writeAll(e)):de(t)?$a(this,t):Ga(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 rr?this._sink=t:(this._sink=new rr,t&&Nc(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Uc(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!e||!ln(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 J&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof Y&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!ln(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof Y?t instanceof un||this._writeRecordBatch(t):t instanceof J?this.writeAll(t.batches):De(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=gt.encode(t),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+n&~n,c=a-s-o;return t.headerType===P.RecordBatch?this._recordBatchBlocks.push(new Re(a,t.bodyLength,this._position)):t.headerType===P.DictionaryBatch&&this._dictionaryBlocks.push(new Re(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),s>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let e=T(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(gt.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Vn)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:s}=tt.assemble(t),o=new Ot(t.numRows,n,i),a=gt.from(o,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(t,e,n=!1){this._dictionaryDeltaOffsets.set(e,t.length+(this._dictionaryDeltaOffsets.get(e)||0));let{byteLength:i,nodes:s,bufferRegions:o,buffers:a}=tt.assemble(new g([t])),c=new Ot(t.length,s,o),l=new se(c,e,n),u=gt.from(l,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,n,i;for(let s=-1,o=t.length;++s<o;)(e=t[s])&&(n=e.byteLength)>0&&(this._write(e),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){for(let[e,n]of t.dictionaries){let i=this._dictionaryDeltaOffsets.get(e)||0;if(i===0||(n=n?.slice(i)).length>0)for(let s of n.data)this._writeDictionaryBatch(s,e,i>0),i+=s.length}return this}},_r=class extends fn{static writeAll(t,e){let n=new _r(e);return ae(t)?t.then(i=>n.writeAll(i)):de(t)?$a(n,t):Ga(n,t)}},vr=class extends fn{static writeAll(t){let e=new vr;return ae(t)?t.then(n=>e.writeAll(n)):de(t)?$a(e,t):Ga(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let e=hr.encode(new hr(t,$.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function Ga(r,t){let e=t;t instanceof J&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function $a(r,t){var e,n,i,s,o,a,c;return y(this,void 0,void 0,function*(){try{for(e=!0,n=Te(t);i=yield n.next(),s=i.done,!s;e=!0){c=i.value,e=!1;let l=c;r.write(l)}}catch(l){o={error:l}}finally{try{!e&&!s&&(a=n.return)&&(yield a.call(n))}finally{if(o)throw o.error}}return r.finish()})}function _u(r,t){if(de(r))return Hd(r,t);if(De(r))return $d(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function $d(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(o){s(o,e||(e=r[Symbol.iterator]()))},pull(o){e?s(o,e):o.close()},cancel(){(e?.return&&e.return()||!0)&&(e=null)}}),Object.assign({highWaterMark:n?i:void 0},t));function s(o,a){let c,l=null,u=o.desiredSize||null;for(;!(l=a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=T(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),o.enqueue(l.value),u!=null&&--u<=0)return;o.close()}}function Hd(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(o){return y(this,void 0,void 0,function*(){yield s(o,e||(e=r[Symbol.asyncIterator]()))})},pull(o){return y(this,void 0,void 0,function*(){e?yield s(o,e):o.close()})},cancel(){return y(this,void 0,void 0,function*(){(e?.return&&(yield e.return())||!0)&&(e=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function s(o,a){return y(this,void 0,void 0,function*(){let c,l=null,u=o.desiredSize||null;for(;!(l=yield a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=T(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),o.enqueue(l.value),u!=null&&--u<=0)return;o.close()})}}function xu(r){return new Ha(r)}var Ha=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,s=Mc(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=pr(s),this._getSize=i!=="bytes"?vu:Iu;let{["highWaterMark"]:o=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:o,size:i!=="bytes"?vu:Iu}),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)}},vu=r=>{var t;return(t=r?.length)!==null&&t!==void 0?t:0},Iu=r=>{var t;return(t=r?.byteLength)!==null&&t!==void 0?t:0};function Bo(r,t){let e=new rr,n=null,i=new ReadableStream({cancel(){return y(this,void 0,void 0,function*(){yield e.close()})},start(a){return y(this,void 0,void 0,function*(){yield o(a,n||(n=yield s()))})},pull(a){return y(this,void 0,void 0,function*(){n?yield o(a,n):a.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:i};function s(){return y(this,void 0,void 0,function*(){return yield(yield bt.from(e)).open(t)})}function o(a,c){return y(this,void 0,void 0,function*(){let l=a.desiredSize,u=null;for(;!(u=yield c.next()).done;)if(a.enqueue(u.value),l!=null&&--l<=0)return;a.close()})}}function Ao(r,t){let e=new this(r),n=new re(e),i=new ReadableStream({cancel(){return y(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return y(this,void 0,void 0,function*(){yield s(o)})},start(o){return y(this,void 0,void 0,function*(){yield s(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(e,r),readable:i};function s(o){return y(this,void 0,void 0,function*(){let a=null,c=o.desiredSize;for(;a=yield n.read(c||null);)if(o.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;o.close()})}}function Vi(r){let t=bt.from(r);return ae(t)?t.then(e=>Vi(e)):t.isAsync()?t.readAll().then(e=>new J(e)):new J(t.readAll())}function To(r,t="stream"){return(t==="stream"?_r:vr).writeAll(r).toUint8Array(!0)}var np=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},na),Da),_a),ia),Qo),wa),ea),{compareSchemas:ln,compareFields:Ql,compareTypes:po});Bt.toDOMStream=_u;rt.throughDOM=xu;bt.throughDOM=Bo;Ur.throughDOM=Bo;sr.throughDOM=Bo;fn.throughDOM=Ao;vr.throughDOM=Ao;_r.throughDOM=Ao;var Do=class extends Cr{constructor(t,e){super(t,e),this.arrowSchema=null}getBatch(){let t=super.getBatch();if(t){this.arrowSchema=this.arrowSchema||ip(t.schema);let e=sp(this.arrowSchema,t.data),n=new Y(this.arrowSchema,w({type:new V(this.arrowSchema.fields),children:e.map(({data:i})=>i[0])}));return{shape:"arrow-table",batchType:"data",data:new J([n]),length:t.length}}return null}};function ip(r){let t=[];for(let e in r){let n=r[e];if(n.type===Float32Array){let i=new Map,s=new D(n.name,new Xt,n.nullable,i);t.push(s)}}if(t.length===0)throw new Error("No arrow convertible fields");return new E(t)}function sp(r,t){let e=[];for(let n of r.fields){let i=t[n.name];if(i instanceof Float32Array){let s=Mr(i);e.push(s)}}if(r.fields.length!==e.length)throw new Error("Some columns not arrow convertible");return e}function Su(r){switch(r.constructor){case Int8Array:return new ye;case Uint8Array:return new we;case Int16Array:return new ge;case Uint16Array:return new _e;case Int32Array:return new pt;case Uint32Array:return new ve;case Float32Array:return new Xt;case Float64Array:return new Qt;default:throw new Error("array type not supported")}}var dn;(function(r){r[r.FLOAT=0]="FLOAT",r[r.DATE=1]="DATE"})(dn||(dn={}));function Oo(r){let t=r.data,e={};for(let n of t.schema.fields){let s=t.getChild(n.name)?.toArray();e[n.name]=s}return{shape:"columnar-table",schema:r.schema,data:e}}function Gn(r){return{fields:r.fields.map(t=>pn(t)),metadata:Fo(r.metadata)}}function Bu(r){return new E(r.fields.map(t=>mn(t)),Mo(r.metadata))}function Fo(r){return Object.fromEntries(r)}function Mo(r){return r?new Map(Object.entries(r)):new Map}function pn(r){return{name:r.name,type:Ya(r.type),nullable:r.nullable,metadata:Fo(r.metadata)}}function mn(r){return new D(r.name,Ka(r.type),r.nullable,Mo(r.metadata))}function Ya(r){switch(r.constructor){case ut:return"null";case ue:return"binary";case kt:return"bool";case it:let t=r;return`${t.isSigned?"u":""}int${t.bitWidth}`;case ye:return"int8";case ge:return"int16";case pt:return"int32";case be:return"int64";case we:return"uint8";case _e:return"uint16";case ve:return"uint32";case Je:return"uint64";case At:switch(r.precision){case j.HALF:return"float16";case j.SINGLE:return"float32";case j.DOUBLE:return"float64";default:return"float16"}case Tr:return"float16";case Xt:return"float32";case Qt:return"float64";case Pt:return"utf8";case fe:let n=r;return{type:"decimal",bitWidth:n.bitWidth,precision:n.precision,scale:n.scale};case qt:return r.unit===et.DAY?"date-day":"date-millisecond";case Vr:return"date-day";case lr:return"date-millisecond";case xt:switch(r.unit){case p.SECOND:return"time-second";case p.MILLISECOND:return"time-millisecond";case p.MICROSECOND:return"time-microsecond";case p.NANOSECOND:return"time-nanosecond";default:return"time-second"}case zr:return"time-millisecond";case jr:return"time-second";case Wr:return"time-microsecond";case Gr:return"time-nanosecond";case Nt:switch(r.unit){case p.SECOND:return"timestamp-second";case p.MILLISECOND:return"timestamp-millisecond";case p.MICROSECOND:return"timestamp-microsecond";case p.NANOSECOND:return"timestamp-nanosecond";default:return"timestamp-second"}case $r:return"timestamp-second";case Hr:return"timestamp-millisecond";case Yr:return"timestamp-microsecond";case Kr:return"timestamp-nanosecond";case te:switch(r.unit){case nt.DAY_TIME:return"interval-daytime";case nt.YEAR_MONTH:return"interval-yearmonth";default:return"interval-daytime"}case Zr:return"interval-daytime";case Jr:return"interval-yearmonth";case jt:let c=r;return{type:"map",keysSorted:c.keysSorted,children:c.children.map(b=>pn(b))};case Tt:let u=r.valueField;return{type:"list",children:[pn(u)]};case Vt:let h=r;return{type:"fixed-size-list",listSize:h.listSize,children:[pn(h.children[0])]};case V:return{type:"struct",children:r.children.map(b=>pn(b))};default:throw new Error(`arrow type not supported: ${r.constructor.name}`)}}function Ka(r){if(typeof r=="object")switch(r.type){case"decimal":return new fe(r.precision,r.scale,r.bitWidth);case"map":let t=r.children.map(i=>mn(i));return new jt(t,r.keysSorted);case"list":let e=mn(r.children[0]);return new Tt(e);case"fixed-size-list":let n=mn(r.children[0]);return new Vt(r.listSize,n);case"struct":return t=r.children.map(i=>mn(i)),new V(t);default:throw new Error("array type not supported")}switch(r){case"null":return new ut;case"binary":return new ue;case"bool":return new kt;case"int8":return new ye;case"int16":return new ge;case"int32":return new pt;case"int64":return new be;case"uint8":return new we;case"uint16":return new _e;case"uint32":return new ve;case"uint64":return new Je;case"float16":return new Tr;case"float32":return new Xt;case"float64":return new Qt;case"utf8":return new Pt;case"date-day":return new Vr;case"date-millisecond":return new lr;case"time-second":return new jr;case"time-millisecond":return new zr;case"time-microsecond":return new Wr;case"time-nanosecond":return new Gr;case"timestamp-second":return new $r;case"timestamp-millisecond":return new Hr;case"timestamp-microsecond":return new Yr;case"timestamp-nanosecond":return new Kr;case"interval-daytime":return new Zr;case"interval-yearmonth":return new Jr;default:throw new Error("array type not supported")}}function ji(r,t){let e=Vi([new Uint8Array(r)]),n={shape:"arrow-table",schema:Gn(e.schema),data:e},i=t?.shape||"arrow-table";switch(i){case"arrow-table":return n;case"columnar-table":return Oo(n);case"object-row-table":let s=Oo(n);return ss(s,"object-row-table");case"array-row-table":return s=Oo(n),ss(s,"array-row-table");default:throw new Error(i)}}function Lo(r,t){async function*e(){let n=bt.readAll(r);for await(let i of n){for await(let s 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 J([s]),length:s.data.length};break}}return e()}var op="4.2.0-alpha.4",$n={name:"Apache Arrow",id:"arrow",module:"arrow",version:op,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"}}},Au={...$n,parse:async(r,t)=>ji(r,t?.arrow),parseSync:(r,t)=>ji(r,t?.arrow),parseInBatches:Lo};function Za(r){let t={};for(let i of r){let s=ap(i.array,i.type);t[i.name]=s}let e=new J(t);return To(e)}function ap(r,t){switch(t){case dn.DATE:return Ri(r);case dn.FLOAT:default:return Ri(r)}}var cp="4.2.0-alpha.4",Tu={name:"Apache Arrow",id:"arrow",module:"arrow",version:cp,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 Za(t)},encodeSync(r,t){return Za(r)}};var lp=["geoarrow.multipolygon","geoarrow.polygon","geoarrow.multilinestring","geoarrow.linestring","geoarrow.multipoint","geoarrow.point","geoarrow.wkb","geoarrow.wkt"],up="ARROW:extension:name",fp="ARROW:extension:metadata";function Ja(r){let t={};for(let e of r.fields){let n=hp(e);n&&(t[e.name]=n)}return t}function hp(r){let t=null,e=r.metadata?.[up];e&&(e=e.toLowerCase(),e==="wkb"&&(e="geoarrow.wkb"),e==="wkt"&&(e="geoarrow.wkt"),lp.includes(e)?(t=t||{},t.encoding=e):console.warn(`Invalid GeoArrow encoding: ${e}`));let n=r.metadata?.[fp];if(n)try{t=JSON.parse(n)}catch(i){console.warn("Failed to parse GeoArrow metadata",i)}return t||null}function Er(r){return Er=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Er(r)}function Xa(r,t){if(Er(r)!=="object"||r===null)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var n=e.call(r,t||"default");if(Er(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}function Qa(r){var t=Xa(r,"string");return Er(t)==="symbol"?t:String(t)}function Ae(r,t,e){return t=Qa(t),t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}var zi={x:0,y:1,z:2};function No(r,t={}){let{start:e=0,end:n=r.length,plane:i="xy"}=t,s=t.size||2,o=0,a=zi[i[0]],c=zi[i[1]];for(let l=e,u=n-s;l<n;l+=s)o+=(r[l+a]-r[u+a])*(r[l+c]+r[u+c]),u=l;return o/2}function tc(r,t,e=2,n,i="xy"){let s=t&&t.length,o=s?t[0]*e:r.length,a=Ou(r,0,o,e,!0,n&&n[0],i),c=[];if(!a||a.next===a.prev)return c;let l,u,h,d,b,M,z;if(s&&(a=wp(r,t,a,e,n,i)),r.length>80*e){d=u=r[0],b=h=r[1];for(let X=e;X<o;X+=e)M=r[X],z=r[X+1],M<d&&(d=M),z<b&&(b=z),M>u&&(u=M),z>h&&(h=z);l=Math.max(u-d,h-b),l=l!==0?32767/l:0}return Wi(a,c,e,d,b,l,0),c}function Ou(r,t,e,n,i,s,o){let a,c;s===void 0&&(s=No(r,{start:t,end:e,size:n,plane:o}));let l=zi[o[0]],u=zi[o[1]];if(i===s<0)for(a=t;a<e;a+=n)c=Du(a,r[a+l],r[a+u],c);else for(a=e-n;a>=t;a-=n)c=Du(a,r[a+l],r[a+u],c);return c&&Ro(c,c.next)&&($i(c),c=c.next),c}function yn(r,t){if(!r)return r;t||(t=r);let e=r,n;do if(n=!1,!e.steiner&&(Ro(e,e.next)||ct(e.prev,e,e.next)===0)){if($i(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function Wi(r,t,e,n,i,s,o){if(!r)return;!o&&s&&Sp(r,n,i,s);let a=r,c,l;for(;r.prev!==r.next;){if(c=r.prev,l=r.next,s?yp(r,n,i,s):mp(r)){t.push(c.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),$i(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=gp(yn(r),t,e),Wi(r,t,e,n,i,s,2)):o===2&&bp(r,t,e,n,i,s):Wi(yn(r),t,e,n,i,s,1);break}}}function mp(r){let t=r.prev,e=r,n=r.next;if(ct(t,e,n)>=0)return!1;let i=t.x,s=e.x,o=n.x,a=t.y,c=e.y,l=n.y,u=i<s?i<o?i:o:s<o?s:o,h=a<c?a<l?a:l:c<l?c:l,d=i>s?i>o?i:o:s>o?s:o,b=a>c?a>l?a:l:c>l?c:l,M=n.next;for(;M!==t;){if(M.x>=u&&M.x<=d&&M.y>=h&&M.y<=b&&Hn(i,a,s,c,o,l,M.x,M.y)&&ct(M.prev,M,M.next)>=0)return!1;M=M.next}return!0}function yp(r,t,e,n){let i=r.prev,s=r,o=r.next;if(ct(i,s,o)>=0)return!1;let a=i.x,c=s.x,l=o.x,u=i.y,h=s.y,d=o.y,b=a<c?a<l?a:l:c<l?c:l,M=u<h?u<d?u:d:h<d?h:d,z=a>c?a>l?a:l:c>l?c:l,X=u>h?u>d?u:d:h>d?h:d,st=qa(b,M,t,e,n),gn=qa(z,X,t,e,n),W=r.prevZ,k=r.nextZ;for(;W&&W.z>=st&&k&&k.z<=gn;){if(W.x>=b&&W.x<=z&&W.y>=M&&W.y<=X&&W!==i&&W!==o&&Hn(a,u,c,h,l,d,W.x,W.y)&&ct(W.prev,W,W.next)>=0||(W=W.prevZ,k.x>=b&&k.x<=z&&k.y>=M&&k.y<=X&&k!==i&&k!==o&&Hn(a,u,c,h,l,d,k.x,k.y)&&ct(k.prev,k,k.next)>=0))return!1;k=k.nextZ}for(;W&&W.z>=st;){if(W.x>=b&&W.x<=z&&W.y>=M&&W.y<=X&&W!==i&&W!==o&&Hn(a,u,c,h,l,d,W.x,W.y)&&ct(W.prev,W,W.next)>=0)return!1;W=W.prevZ}for(;k&&k.z<=gn;){if(k.x>=b&&k.x<=z&&k.y>=M&&k.y<=X&&k!==i&&k!==o&&Hn(a,u,c,h,l,d,k.x,k.y)&&ct(k.prev,k,k.next)>=0)return!1;k=k.nextZ}return!0}function gp(r,t,e){let n=r;do{let i=n.prev,s=n.next.next;!Ro(i,s)&&Fu(i,n,n.next,s)&&Gi(i,s)&&Gi(s,i)&&(t.push(i.i/e|0),t.push(n.i/e|0),t.push(s.i/e|0),$i(n),$i(n.next),n=r=s),n=n.next}while(n!==r);return yn(n)}function bp(r,t,e,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Tp(o,a)){let c=Mu(o,a);o=yn(o,o.next),c=yn(c,c.next),Wi(o,t,e,n,i,s,0),Wi(c,t,e,n,i,s,0);return}a=a.next}o=o.next}while(o!==r)}function wp(r,t,e,n,i,s){let o=[],a,c,l,u,h;for(a=0,c=t.length;a<c;a++)l=t[a]*n,u=a<c-1?t[a+1]*n:r.length,h=Ou(r,l,u,n,!1,i&&i[a+1],s),h===h.next&&(h.steiner=!0),o.push(Ap(h));for(o.sort(_p),a=0;a<o.length;a++)e=vp(o[a],e);return e}function _p(r,t){return r.x-t.x}function vp(r,t){let e=Ip(r,t);if(!e)return t;let n=Mu(e,r);return yn(n,n.next),yn(e,e.next)}function Ip(r,t){let e=t,n=r.x,i=r.y,s=-1/0,o;do{if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){let d=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=n&&d>s&&(s=d,o=e.x<e.next.x?e:e.next,d===n))return o}e=e.next}while(e!==t);if(!o)return null;let a=o,c=o.x,l=o.y,u=1/0,h;e=o;do n>=e.x&&e.x>=c&&n!==e.x&&Hn(i<l?n:s,i,c,l,i<l?s:n,i,e.x,e.y)&&(h=Math.abs(i-e.y)/(n-e.x),Gi(e,r)&&(h<u||h===u&&(e.x>o.x||e.x===o.x&&xp(o,e)))&&(o=e,u=h)),e=e.next;while(e!==a);return o}function xp(r,t){return ct(r.prev,r,t.prev)<0&&ct(t.next,r,r.next)<0}function Sp(r,t,e,n){let i=r;do i.z===0&&(i.z=qa(i.x,i.y,t,e,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,Bp(i)}function Bp(r){let t,e,n=1,i,s,o,a,c,l;do{for(s=r,r=null,l=null,i=0;s;){for(i++,a=s,o=0,e=0;e<n&&(o++,a=a.nextZ,!!a);e++);for(c=n;o>0||c>0&&a;)o!==0&&(c===0||!a||s.z<=a.z)?(t=s,s=s.nextZ,o--):(t=a,a=a.nextZ,c--),l?l.nextZ=t:r=t,t.prevZ=l,l=t;s=a}l.nextZ=null,n*=2}while(i>1);return r}function qa(r,t,e,n,i){return r=(r-e)*i|0,t=(t-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function Ap(r){let t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Hn(r,t,e,n,i,s,o,a){return(i-o)*(t-a)>=(r-o)*(s-a)&&(r-o)*(n-a)>=(e-o)*(t-a)&&(e-o)*(s-a)>=(i-o)*(n-a)}function Tp(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!Dp(r,t)&&(Gi(r,t)&&Gi(t,r)&&Op(r,t)&&(ct(r.prev,r,t.prev)||ct(r,t.prev,t))||Ro(r,t)&&ct(r.prev,r,r.next)>0&&ct(t.prev,t,t.next)>0)}function ct(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Ro(r,t){return r.x===t.x&&r.y===t.y}function Fu(r,t,e,n){let i=Eo(ct(r,t,e)),s=Eo(ct(r,t,n)),o=Eo(ct(e,n,r)),a=Eo(ct(e,n,t));return!!(i!==s&&o!==a||i===0&&Uo(r,e,t)||s===0&&Uo(r,n,t)||o===0&&Uo(e,r,n)||a===0&&Uo(e,t,n))}function Uo(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Eo(r){return r>0?1:r<0?-1:0}function Dp(r,t){let e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Fu(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Gi(r,t){return ct(r.prev,r,r.next)<0?ct(r,t,r.next)>=0&&ct(r,r.prev,t)>=0:ct(r,t,r.prev)<0||ct(r,r.next,t)<0}function Op(r,t){let e=r,n=!1,i=(r.x+t.x)/2,s=(r.y+t.y)/2;do e.y>s!=e.next.y>s&&e.next.y!==e.y&&i<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==r);return n}function Mu(r,t){let e=new Hi(r.i,r.x,r.y),n=new Hi(t.i,t.x,t.y),i=r.next,s=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,n.next=e,e.prev=n,s.next=n,n.prev=s,n}function Du(r,t,e,n){let i=new Hi(r,t,e);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function $i(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}var Hi=class{constructor(t,e,n){Ae(this,"i",void 0),Ae(this,"x",void 0),Ae(this,"y",void 0),Ae(this,"prev",null),Ae(this,"next",null),Ae(this,"z",0),Ae(this,"prevZ",null),Ae(this,"nextZ",null),Ae(this,"steiner",!1),this.i=t,this.x=e,this.y=n}};function Yn(r,t,e){switch(r.type){case"Point":return Ep(r,t,e);case"LineString":return Up(r,t,e);case"Polygon":return Uu(r,t,e);default:let n=r;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function Uu(r,t=-1/0,e=1/0){let{positions:n}=r,i=r.polygonIndices.value.filter(c=>c>=t&&c<=e),s=r.primitivePolygonIndices.value.filter(c=>c>=t&&c<=e);if(!(i.length>2)){let c=[];for(let l=0;l<s.length-1;l++){let u=s[l],h=s[l+1],d=Co(n,u,h);c.push(d)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<i.length-1;c++){let l=i[c],u=i[c+1],h=Uu(r,l,u).coordinates;a.push(h)}return{type:"MultiPolygon",coordinates:a}}function Up(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:Co(n,i[0],i[1])};let o=[];for(let a=0;a<i.length-1;a++){let c=Co(n,i[a],i[a+1]);o.push(c)}return{type:"MultiLineString",coordinates:o}}function Ep(r,t,e){let{positions:n}=r,i=Co(n,t,e);return i.length>1?{type:"MultiPoint",coordinates:i}:{type:"Point",coordinates:i[0]}}function Co(r,t,e){t=t||0,e=e||r.value.length/r.size;let n=[];for(let i=t;i<e;i++){let s=Array();for(let o=i*r.size;o<(i+1)*r.size;o++)s.push(Number(r.value[o]));n.push(s)}return n}function Po(r){let t=r.data,e=Gn(t.schema),n=Ja(e),i=n.geometry.encoding,s=[],o=t.schema.fields.map(l=>l.name).filter(l=>!(l in n)),a=t.select(o),c=t.getChild("geometry");for(let l=0;l<t.numRows;l++){let u=c?.get(l),h=ko(u,i);if(h){let d=a.get(l)?.toJSON()||{};s.push({type:"Feature",geometry:h,properties:d})}}return{shape:"geojson-table",type:"FeatureCollection",schema:r.schema,features:s}}function ec(r,t){let e=ji(r,{shape:"arrow-table"});switch(t?.shape){case"geojson-table":return Po(e);default:return e}}function Eu(r){return Lo(r)}var Ru={...$n,options:{arrow:{shape:"arrow-table"}}},Cu={...$n,options:{arrow:{shape:"arrow-table"}},parse:async(r,t)=>ec(r,t?.arrow),parseSync:(r,t)=>ec(r,t?.arrow),parseInBatches:Eu};function Vo(r,t,e,n=100){let i=r.length/t,s=Math.max(Math.floor(i/n),1),o=[...e];for(let a=0;a<i;a+=s){let c=r[a*t],l=r[a*t+1];c<o[0]&&(o[0]=c),l<o[1]&&(o[1]=l),c>o[2]&&(o[2]=c),l>o[3]&&(o[3]=l)}return o}var Kn;(function(r){r.points="points",r.lines="lines",r.polygons="polygons"})(Kn||(Kn={}));function Yi(){return{globalFeatureIds:{value:new Uint32Array(0),size:1},positions:{value:new Float32Array(0),size:2},properties:[],numericProps:{},featureIds:{value:new Uint32Array(0),size:1}}}function Pu(r,t,e){let n={polygon:t==="geoarrow.multipolygon"||t==="geoarrow.polygon",point:t==="geoarrow.multipoint"||t==="geoarrow.point",line:t==="geoarrow.multilinestring"||t==="geoarrow.linestring"},i=e?.chunkIndex!==void 0&&e?.chunkIndex>=0?[r.data[e?.chunkIndex]]:r.data,s=[1/0,1/0,-1/0,-1/0],o=e?.chunkOffset||0,a=[];return i.forEach(c=>{let{featureIds:l,flatCoordinateArray:u,nDim:h,geomOffset:d,triangles:b}=Cp(c,t,e),M=new Uint32Array(l.length);for(let X=0;X<l.length;X++)M[X]=l[X]+o;let z={globalFeatureIds:{value:M,size:1},positions:{value:u,size:h},featureIds:{value:l,size:1},properties:[...Array(c.length).keys()].map(X=>({index:X+o}))};o+=c.length,a.push({shape:"binary-feature-collection",points:{type:"Point",...Yi(),...n.point?z:{}},lines:{type:"LineString",...Yi(),...n.line?z:{},pathIndices:{value:n.line?d:new Uint16Array(0),size:1}},polygons:{type:"Polygon",...Yi(),...n.polygon?z:{},polygonIndices:{value:n.polygon?d:new Uint16Array(0),size:1},primitivePolygonIndices:{value:n.polygon?d:new Uint16Array(0),size:1},...b?{triangles:{value:b,size:1}}:{}}}),s=Vo(u,h,s)}),{binaryGeometries:a,bounds:s,featureTypes:n,...e?.calculateMeanCenters?{meanCenters:rc(a)}:{}}}function rc(r){let t=[];return r.forEach(e=>{let n=null;e.points&&e.points.positions.value.length>0?n=Kn.points:e.lines&&e.lines.positions.value.length>0?n=Kn.lines:e.polygons&&e.polygons.positions.value.length>0&&(n=Kn.polygons);let i=n?e[n]:null;if(i&&n!==null){let s=i.featureIds.value,o=i.positions.value,a=i.positions.size,c=i.type==="Polygon"?i.primitivePolygonIndices?.value:void 0;Rp(s,o,a,n,c).forEach(u=>{t.push(u)})}}),t}function Rp(r,t,e,n,i){let s=[],o=t.length,a=0,c=0,l=0;for(;a<o;){let u=r[a/e],h=[0,0],d=0;for(;a<o&&r[c]===u;)n===Kn.polygons&&i?.[l]===c?(a+=e,l++):(h[0]+=t[a],h[1]+=t[a+1],a+=e,d++),c+=1;h[0]/=d,h[1]/=d,s.push(h)}return s}function Cp(r,t,e){switch(t){case"geoarrow.point":case"geoarrow.multipoint":return Vp(r,t);case"geoarrow.linestring":case"geoarrow.multilinestring":return kp(r,t);case"geoarrow.polygon":case"geoarrow.multipolygon":return Pp(r,t,e);default:throw Error("invalid geoarrow encoding")}}function nc(r,t,e,n){try{let i=0,s=[];for(let a=0;a<r.length-1;a++){let c=r[a],l=r[a+1],u=e.subarray(c*n,l*n),h=[];for(;t[i]<l;)t[i]>c&&h.push(t[i]-c),i++;let d=tc(u,h.length>0?h:void 0,n);if(d.length===0)throw Error("earcut failed e.g. invalid polygon");for(let b=0;b<d.length;b++)s.push(d[b]+c)}let o=new Uint32Array(s.length);for(let a=0;a<s.length;a++)o[a]=s[a];return o}catch{return null}}function Pp(r,t,e){let n=t==="geoarrow.multipolygon",i=n?r.children[0]:r,s=i.valueOffsets,o=n?r.valueOffsets.map(st=>s.at(st)||st):r.valueOffsets,a=i.children[0],c=a.children[0],l=c.children[0],u=c.stride,h=a.valueOffsets,d=l.values,b=new Uint16Array(s.length);for(let st=0;st<s.length;st++)b[st]=h[s[st]];let M=d.length/u,z=new Uint32Array(M);for(let st=0;st<o.length-1;st++){let gn=h[o[st]],W=h[o[st+1]];for(let k=gn;k<W;k++)z[k]=st}let X=e?.triangulate?nc(b,h,d,u):null;return{featureIds:z,nDim:u,flatCoordinateArray:d,geomOffset:h,geometryIndicies:b,...e?.triangulate&&X?{triangles:X}:{}}}function kp(r,t){let e=t==="geoarrow.multilinestring",n=e?r.children[0]:r,i=n.children[0],s=i.children[0],o=i.stride,a=n.valueOffsets,c=s.values,l=new Uint16Array(0),u=c.length/o,h=new Uint32Array(u);if(e){let d=r.valueOffsets;for(let b=0;b<d.length-1;b++){let M=a[d[b]],z=a[d[b+1]];for(let X=M;X<z;X++)h[X]=b}}else for(let d=0;d<r.length;d++){let b=a[d],M=a[d+1];for(let z=b;z<M;z++)h[z]=d}return{featureIds:h,flatCoordinateArray:c,nDim:o,geomOffset:a,geometryIndicies:l}}function Vp(r,t){let e=t==="geoarrow.multipoint",n=e?r.children[0]:r,i=n.children[0],s=n.stride,o=i.values,a=new Uint16Array(0),c=new Int32Array(0),l=o.length/s,u=new Uint32Array(l);if(e){let h=r.valueOffsets;for(let d=0;d<h.length-1;d++){let b=h[d],M=h[d+1];for(let z=b;z<M;z++)u[z]=d}}else for(let h=0;h<r.length;h++)u[h]=h;return{featureIds:u,flatCoordinateArray:o,nDim:s,geomOffset:c,geometryIndicies:a}}var jo="4.2.0-alpha.4";var ku=/[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/,Vu=new RegExp("^"+ku.source+"(\\s"+ku.source+"){1,}"),ic=["POINT(","LINESTRING(","POLYGON(","MULTIPOINT(","MULTILINESTRING(","MULTIPOLYGON(","GEOMETRYCOLLECTION("];function ju(r){return ic.some(t=>r.startsWith(t))}function sc(r,t){return jp(r,t)}function jp(r,t){let e=r.split(";"),n=e.pop(),i=(e.shift()||"").split("=").pop(),o=zu({parts:e,_:n,i:0});return t?.wkt?.crs?zp(o,i):o}function zu(r){return Wp(r)||$p(r)||Yp(r)||Gp(r)||Hp(r)||Kp(r)||Zp(r)}function zp(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 Wp(r){if(!ht(/^(POINT(\sz)?)/i,r)||(Wt(r),!ht(/^(\()/,r)))return null;let t=Wu(r);return!t||(Wt(r),!ht(/^(\))/,r))?null:{type:"Point",coordinates:t[0]}}function Gp(r){if(!ht(/^(MULTIPOINT)/i,r))return null;Wt(r);let t=r._?.substring(r._?.indexOf("(")+1,r._.length-1).replace(/\(/g,"").replace(/\)/g,"");r._="MULTIPOINT ("+t+")";let e=zo(r);return e?(Wt(r),{type:"MultiPoint",coordinates:e}):null}function $p(r){if(!ht(/^(LINESTRING(\sz)?)/i,r)||(Wt(r),!ht(/^(\()/,r)))return null;let t=Wu(r);return!t||!ht(/^(\))/,r)?null:{type:"LineString",coordinates:t}}function Hp(r){if(!ht(/^(MULTILINESTRING)/i,r))return null;Wt(r);let t=zo(r);return t?(Wt(r),{type:"MultiLineString",coordinates:t}):null}function Yp(r){if(!ht(/^(POLYGON(\sz)?)/i,r))return null;Wt(r);let t=zo(r);return t?{type:"Polygon",coordinates:t}:null}function Kp(r){if(!ht(/^(MULTIPOLYGON)/i,r))return null;Wt(r);let t=zo(r);return t?{type:"MultiPolygon",coordinates:t}:null}function Zp(r){let t=[],e;if(!ht(/^(GEOMETRYCOLLECTION)/i,r)||(Wt(r),!ht(/^(\()/,r)))return null;for(;e=zu(r);)t.push(e),Wt(r),ht(/^(,)/,r),Wt(r);return ht(/^(\))/,r)?{type:"GeometryCollection",geometries:t}:null}function zo(r){Wt(r);let t=0,e=[],n=[e],i=e,s;for(;s=ht(/^(\()/,r)||ht(/^(\))/,r)||ht(/^(,)/,r)||ht(Vu,r);){if(s==="(")n.push(i),i=[],n[n.length-1].push(i),t++;else if(s===")"){if(i.length===0||(i=n.pop(),!i))return null;if(t--,t===0)break}else if(s===",")i=[],n[n.length-1].push(i);else if(!s.split(/\s/g).some(isNaN))Array.prototype.push.apply(i,s.split(/\s/g).map(parseFloat));else return null;Wt(r)}return t!==0?null:e}function Wu(r){let t=[],e,n;for(;n=ht(Vu,r)||ht(/^(,)/,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))),Wt(r);if(e)t.push(e);else return null;return t.length?t:null}function ht(r,t){let e=t._?.substring(t.i).match(r);return e?(t.i+=e[0].length,e[0]):null}function Wt(r){ht(/^\s*/,r)}var Gu={name:"WKT (Well-Known Text)",id:"wkt",module:"wkt",version:jo,worker:!0,extensions:["wkt"],mimeTypes:["text/plain"],category:"geometry",text:!0,tests:ic,testText:ju,options:{wkt:{shape:"geojson-geometry",crs:!0}}},oc={...Gu,parse:async(r,t)=>sc(new TextDecoder().decode(r),t),parseTextSync:sc};var Ir;(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"})(Ir||(Ir={}));function $u(r){let t=new DataView(r),e=0,n=t.getUint8(e);if(e+=1,n>1)return!1;let i=n===1,s=t.getUint32(e,i);e+=4;let o=s&7;if(o===0||o>7)return!1;let a=s-o;if(a===0||a===1e3||a===2e3||a===3e3)return!0;if(a&536870911)return!1;if(a&536870912){let c=t.getUint32(e,i);if(e+=4,c>1e4)return!1}return!0}function Hu(r,t){let e=Object.assign(t||{},{type:"wkb",geometryType:1,dimensions:2,coordinates:"xy",littleEndian:!0,byteOffset:0});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.type="iso-wkb",e.dimensions=3,e.coordinates="xyz";break;case 2:e.type="iso-wkb",e.dimensions=3,e.coordinates="xym";break;case 3:e.type="iso-wkb",e.dimensions=4,e.coordinates="xyzm";break;default:throw new Error(`WKB: Unsupported iso-wkb type: ${i}`)}let s=n&2147483648,o=n&1073741824,a=n&536870912;return s&&o?(e.type="ewkb",e.dimensions=4,e.coordinates="xyzm"):s?(e.type="ewkb",e.dimensions=3,e.coordinates="xyz"):o&&(e.type="ewkb",e.dimensions=3,e.coordinates="xym"),a&&(e.type="ewkb",e.srid=r.getUint32(e.byteOffset,e.littleEndian),e.byteOffset+=4),e}function ac(r,t){let e=Jp(r,t),n=t?.wkb?.shape||"binary-geometry";switch(n){case"binary-geometry":return e;case"geojson-geometry":return Yn(e);case"geometry":return console.error('WKBLoader: "geometry" shape is deprecated, use "binary-geometry" instead'),Yn(e);default:throw new Error(n)}}function Jp(r,t){let e=new DataView(r),n=Hu(e),{geometryType:i,dimensions:s,littleEndian:o}=n,a=n.byteOffset;switch(i){case Ir.Point:return Yu(e,a,s,o).geometry;case Ir.LineString:return cc(e,a,s,o).geometry;case Ir.Polygon:return Ku(e,a,s,o).geometry;case Ir.MultiPoint:let h=Xp(e,a,s,o);return h.type="Point",h;case Ir.MultiLineString:let d=Qp(e,a,s,o);return d.type="LineString",d;case Ir.MultiPolygon:let b=qp(e,a,s,o);return b.type="Polygon",b;default:throw new Error(`WKB: Unsupported geometry type: ${i}`)}}function Yu(r,t,e,n){let i=new Float64Array(e);for(let s=0;s<e;s++)i[s]=r.getFloat64(t,n),t+=8;return{geometry:{type:"Point",positions:{value:i,size:e}},offset:t}}function cc(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=new Float64Array(i*e);for(let a=0;a<i*e;a++)s[a]=r.getFloat64(t,n),t+=8;let o=[0];return i>0&&o.push(i),{geometry:{type:"LineString",positions:{value:s,size:e},pathIndices:{value:new Uint16Array(o),size:1}},offset:t}}var lc=r=>t=>r+=t;function Ku(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=[];for(let l=0;l<i;l++){let u=cc(r,t,e,n),{positions:h}=u.geometry;t=u.offset,s.push(h.value)}let o=new Float64Array(Wo(s).buffer),a=[0];o.length>0&&a.push(o.length/e);let c=s.map(l=>l.length/e).map(lc(0));return c.unshift(0),{geometry:{type:"Polygon",positions:{value:o,size:e},polygonIndices:{value:new Uint16Array(a),size:1},primitivePolygonIndices:{value:new Uint16Array(c),size:1}},offset:t}}function Xp(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=[];for(let o=0;o<i;o++){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=Yu(r,t,e,a);t=c.offset,s.push(c.geometry)}return tm(s,e)}function Qp(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=[];for(let o=0;o<i;o++){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=cc(r,t,e,a);t=c.offset,s.push(c.geometry)}return em(s,e)}function qp(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=[];for(let o=0;o<i;o++){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=Ku(r,t,e,a);t=c.offset,s.push(c.geometry)}return rm(s,e)}function tm(r,t){let e=r.map(i=>i.positions.value);return{type:"Point",positions:{value:new Float64Array(Wo(e).buffer),size:t}}}function em(r,t){let e=r.map(s=>s.positions.value),n=new Float64Array(Wo(e).buffer),i=e.map(s=>s.length/t).map(lc(0));return i.unshift(0),{type:"LineString",positions:{value:n,size:t},pathIndices:{value:new Uint16Array(i),size:1}}}function rm(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(Wo(e).buffer),s=e.map(a=>a.length/t).map(lc(0));s.unshift(0);let o=[0];for(let a of n)o.push(...a.filter(c=>c>0).map(c=>c+o[o.length-1]));return{type:"Polygon",positions:{value:i,size:t},polygonIndices:{value:new Uint16Array(s),size:1},primitivePolygonIndices:{value:new Uint16Array(o),size:1}}}function Wo(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 s=new Uint8Array(r[i].buffer);t=s.length;for(let o=0;o<t;++o)e[n++]=s[o]}return e}var Zu={name:"WKB",id:"wkb",module:"wkt",version:jo,worker:!0,category:"geometry",extensions:["wkb"],mimeTypes:[],tests:[$u],options:{wkb:{shape:"binary-geometry"}}},uc={...Zu,parse:async r=>ac(r),parseSync:ac};function ko(r,t){if(t=t?.toLowerCase(),!t||!r)return null;let e;switch(t){case"geoarrow.multipolygon":e=sm(r);break;case"geoarrow.polygon":e=om(r);break;case"geoarrow.multipoint":e=am(r);break;case"geoarrow.point":e=cm(r);break;case"geoarrow.multilinestring":e=lm(r);break;case"geoarrow.linestring":e=um(r);break;case"geoarrow.wkb":e=nm(r);break;case"geoarrow.wkt":e=im(r);break;default:throw Error(`GeoArrow encoding not supported ${t}`)}return e}function nm(r){let t=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),e=uc.parseSync?.(t);return Yn(e)}function im(r){let t=r;return oc.parseTextSync?.(t)}function sm(r){let t=[];for(let n=0;n<r.length;n++){let i=r.get(n),s=[];for(let o=0;i&&o<i?.length;o++){let a=i?.get(o),c=[];for(let l=0;a&&l<a.length;l++){let u=a.get(l),h=Array.from(u);c.push(h)}s.push(c)}t.push(s)}return{type:"MultiPolygon",coordinates:t}}function om(r){let t=[];for(let n=0;r&&n<r.length;n++){let i=r.get(n),s=[];for(let o=0;i&&o<i.length;o++){let a=i.get(o),c=Array.from(a);s.push(c)}t.push(s)}return{type:"Polygon",coordinates:t}}function am(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 cm(r){return{type:"Point",coordinates:Array.from(r)}}function lm(r){let t=[];for(let e=0;r&&e<r.length;e++){let n=r.get(e),i=[];for(let s=0;n&&s<n.length;s++){let o=n.get(s);if(o){let a=Array.from(o);i.push(a)}}t.push(i)}return{type:"MultiLineString",coordinates:t}}function um(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 Ki(r,t=!1){if("data"in r)return new g(r.data.map(s=>Ki(s,t)));let e=[];for(let s of r.children)e.push(Ki(s,t));let n;r.dictionary!==void 0&&(n=Ki(r.dictionary,t));let i={[lt.OFFSET]:Go(r.buffers[lt.OFFSET],t),[lt.DATA]:Go(r.buffers[lt.DATA],t),[lt.VALIDITY]:Go(r.buffers[lt.VALIDITY],t),[lt.TYPE]:Go(r.buffers[lt.TYPE],t)};return new R(r.type,r.offset,r.length,r._nullCount,i,e,n)}function fm(r){return!(r.byteOffset===0&&r.byteLength===r.buffer.byteLength)}function Go(r,t){return r===void 0||!t&&!fm(r)?r:r.slice()}var Ju="latest";function hm(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.0-alpha.4"),globalThis._loadersgl_.version}var fc=hm();function or(r,t){if(!r)throw new Error(t||"loaders.gl assertion failed.")}var ar={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},rA=ar.self||ar.window||ar.global||{},nA=ar.window||ar.self||ar.global||{},iA=ar.global||ar.self||ar.window||{},sA=ar.document||{};var xr=typeof process!="object"||String(process)!=="[object process]"||process.browser;var Qu=typeof window<"u"&&typeof window.orientation<"u",Xu=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),oA=Xu&&parseFloat(Xu[1])||0;var Zi=class{constructor(t,e){this.isRunning=!0,this._resolve=()=>{},this._reject=()=>{},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){or(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){or(this.isRunning),this.isRunning=!1,this._reject(t)}};var Zn=class{terminate(){}};var hc=new Map;function qu(r){or(r.source&&!r.url||!r.source&&r.url);let t=hc.get(r.source||r.url);return t||(r.url&&(t=dm(r.url),hc.set(r.url,t)),r.source&&(t=tf(r.source),hc.set(r.source,t))),or(t),t}function dm(r){if(!r.startsWith("http"))return r;let t=pm(r);return tf(t)}function tf(r){let t=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(t)}function pm(r){return`try {
16
+ ]`}concat(...t){let e=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new J(e,n.map(i=>new Y(e,i)))}slice(t,e){let n=this.schema;[t,e]=ai({length:this.numRows},t,e);let i=Ws(this.data,this._offsets,t,e);return new J(n,i.map(s=>new Y(n,s)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let e=this.data.map(n=>n.children[t]);if(e.length===0){let{type:n}=this.schema.fields[t],i=w({type:n,length:0,nullCount:0});e.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new g(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 g([w({type:new ut,length:this.numRows})]));let s=n.fields.slice(),o=s[t].clone({type:e.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[s[t],a[t]]=[o,e],[n,i]=wo(n,a)}return new J(n,i)}select(t){let e=this.schema.fields.reduce((n,i,s)=>n.set(i.name,s),new Map);return this.selectAt(t.map(n=>e.get(n)).filter(n=>n>-1))}selectAt(t){let e=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new J(e,n)}assign(t){let e=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[u,h]=a,d=e.findIndex(b=>b.name===c.name);return~d?h[d]=l:u.push(l),a},[[],[]]),s=this.schema.assign(t.schema),o=[...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 J(...wo(s,o))}};ru=Symbol.toStringTag;J[ru]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=On(ui),r.get=On(mt.getVisitFn(f.Struct)),r.set=Gs(Dt.getVisitFn(f.Struct)),r.indexOf=$s(qr.getVisitFn(f.Struct)),"Table"))(J.prototype);var iu,Y=class{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof E))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=w({nullCount:0,type:new V(this.schema.fields),children:this.schema.fields.map(e=>w({type:e.type,nullCount:0}))})]=t,!(this.data instanceof R))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=nu(this.schema,this.data.children);break}case 1:{let[e]=t,{fields:n,children:i,length:s}=Object.keys(e).reduce((c,l,u)=>(c.children[u]=e[l],c.length=Math.max(c.length,e[l].length),c.fields[u]=D.new({name:l,type:e[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),o=new E(n),a=w({type:new V(n),length:s,children:i,nullCount:0});[this.schema,this.data]=nu(o,a.children,s);break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get dictionaries(){return this._dictionaries||(this._dictionaries=su(this.schema.fields,this.data.children))}get numCols(){return this.schema.fields.length}get numRows(){return this.data.length}get nullCount(){return this.data.nullCount}isValid(t){return this.data.getValid(t)}get(t){return mt.visit(this.data,t)}set(t,e){return Dt.visit(this.data,t,e)}indexOf(t,e){return qr.visit(this.data,t,e)}[Symbol.iterator](){return Fn.visit(new g([this.data]))}toArray(){return[...this]}concat(...t){return new J(this.schema,[this,...t])}slice(t,e){let[n]=new g([this.data]).slice(t,e).data;return new Y(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 g([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 g([w({type:new ut,length:this.numRows})]));let s=n.fields.slice(),o=i.children.slice(),a=s[t].clone({type:e.type});[s[t],o[t]]=[a,e.data[0]],n=new E(s,new Map(this.schema.metadata)),i=w({type:new V(s),children:o})}return new Y(n,i)}select(t){let e=this.schema.select(t),n=new V(e.fields),i=[];for(let s of t){let o=this.schema.fields.findIndex(a=>a.name===s);~o&&(i[o]=this.data.children[o])}return new Y(e,w({type:n,length:this.numRows,children:i}))}selectAt(t){let e=this.schema.selectAt(t),n=t.map(s=>this.data.children[s]).filter(Boolean),i=w({type:new V(e.fields),length:this.numRows,children:n});return new Y(e,i)}};iu=Symbol.toStringTag;Y[iu]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(Y.prototype);function nu(r,t,e=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...r.fields],s=[...t],o=(e+63&-64)>>3;for(let[a,c]of r.fields.entries()){let l=t[a];(!l||l.length!==e)&&(i[a]=c.clone({nullable:!0}),s[a]=(n=l?._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:w({type:c.type,length:e,nullCount:e,nullBitmap:new Uint8Array(o)}))}return[r.assign(i),w({type:new V(i),length:e,children:s})]}function su(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 s=-1,o=r.length;++s<o;){let{type:a}=r[s],c=t[s];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])su(a.children,l?.children,e);if(m.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 cn=class extends Y{constructor(t){let e=t.fields.map(i=>w({type:i.type})),n=w({type:new V(t.fields),nullCount:0,children:e});super(t,n)}};var ft=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 ft).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+4),(e||new ft).__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):$.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):P.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 Q).__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,$.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,P.NONE)}static addHeader(t,e){t.addFieldOffset(2,e,0)}static addBodyLength(t,e){t.addFieldInt64(3,e,BigInt("0"))}static addCustomMetadata(t,e){t.addFieldOffset(4,e,0)}static createCustomMetadataVector(t,e){t.startVector(4,e.length,4);for(let n=e.length-1;n>=0;n--)t.addOffset(e[n]);return t.endVector()}static startCustomMetadataVector(t,e){t.startVector(4,e,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,e){t.finish(e)}static finishSizePrefixedMessageBuffer(t,e){t.finish(e,void 0,!0)}static createMessage(t,e,n,i,s,o){return ft.startMessage(t),ft.addVersion(t,e),ft.addHeaderType(t,n),ft.addHeader(t,i),ft.addBodyLength(t,s),ft.addCustomMetadata(t,o),ft.endMessage(t)}};var Ca=class extends v{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return He.startNull(e),He.endNull(e)}visitInt(t,e){return _t.startInt(e),_t.addBitWidth(e,t.bitWidth),_t.addIsSigned(e,t.isSigned),_t.endInt(e)}visitFloat(t,e){return Kt.startFloatingPoint(e),Kt.addPrecision(e,t.precision),Kt.endFloatingPoint(e)}visitBinary(t,e){return je.startBinary(e),je.endBinary(e)}visitLargeBinary(t,e){return We.startLargeBinary(e),We.endLargeBinary(e)}visitBool(t,e){return ze.startBool(e),ze.endBool(e)}visitUtf8(t,e){return Ke.startUtf8(e),Ke.endUtf8(e)}visitLargeUtf8(t,e){return Ge.startLargeUtf8(e),Ge.endLargeUtf8(e)}visitDecimal(t,e){return vt.startDecimal(e),vt.addScale(e,t.scale),vt.addPrecision(e,t.precision),vt.addBitWidth(e,t.bitWidth),vt.endDecimal(e)}visitDate(t,e){return Gt.startDate(e),Gt.addUnit(e,t.unit),Gt.endDate(e)}visitTime(t,e){return Mt.startTime(e),Mt.addUnit(e,t.unit),Mt.addBitWidth(e,t.bitWidth),Mt.endTime(e)}visitTimestamp(t,e){let n=t.timezone&&e.createString(t.timezone)||void 0;return Lt.startTimestamp(e),Lt.addUnit(e,t.unit),n!==void 0&&Lt.addTimezone(e,n),Lt.endTimestamp(e)}visitInterval(t,e){return Zt.startInterval(e),Zt.addUnit(e,t.unit),Zt.endInterval(e)}visitDuration(t,e){return $t.startDuration(e),$t.addUnit(e,t.unit),$t.endDuration(e)}visitList(t,e){return $e.startList(e),$e.endList(e)}visitStruct(t,e){return Ye.startStruct_(e),Ye.endStruct_(e)}visitUnion(t,e){It.startTypeIdsVector(e,t.typeIds.length);let n=It.createTypeIdsVector(e,t.typeIds);return It.startUnion(e),It.addMode(e,t.mode),It.addTypeIds(e,n),It.endUnion(e)}visitDictionary(t,e){let n=this.visit(t.indices,e);return le.startDictionaryEncoding(e),le.addId(e,BigInt(t.id)),le.addIsOrdered(e,t.isOrdered),n!==void 0&&le.addIndexType(e,n),le.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return Ht.startFixedSizeBinary(e),Ht.addByteWidth(e,t.byteWidth),Ht.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return Yt.startFixedSizeList(e),Yt.addListSize(e,t.listSize),Yt.endFixedSizeList(e)}visitMap(t,e){return Jt.startMap(e),Jt.addKeysSorted(e,t.keysSorted),Jt.endMap(e)}},_o=new Ca;function lu(r,t=new Map){return new E(_d(r,t),vo(r.metadata),t)}function Pa(r){return new Ot(r.count,fu(r.columns),hu(r.columns))}function uu(r){return new se(Pa(r.data),r.id,r.isDelta)}function _d(r,t){return(r.fields||[]).filter(Boolean).map(e=>D.fromJSON(e,t))}function ou(r,t){return(r.children||[]).filter(Boolean).map(e=>D.fromJSON(e,t))}function fu(r){return(r||[]).reduce((t,e)=>[...t,new Be(e.count,vd(e.VALIDITY)),...fu(e.children)],[])}function hu(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){let i=r[e];i.VALIDITY&&t.push(new ie(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new ie(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new ie(t.length,i.OFFSET.length)),i.DATA&&t.push(new ie(t.length,i.DATA.length)),t=hu(i.children,t)}return t}function vd(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function du(r,t){let e,n,i,s,o,a;return!t||!(s=r.dictionary)?(o=cu(r,ou(r,t)),i=new D(r.name,o,r.nullable,vo(r.metadata))):t.has(e=s.id)?(n=(n=s.indexType)?au(n):new pt,a=new Ut(t.get(e),n,e,s.isOrdered),i=new D(r.name,a,r.nullable,vo(r.metadata))):(n=(n=s.indexType)?au(n):new pt,t.set(e,o=cu(r,ou(r,t))),a=new Ut(o,n,e,s.isOrdered),i=new D(r.name,a,r.nullable,vo(r.metadata))),i||null}function vo(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function au(r){return new it(r.isSigned,r.bitWidth)}function cu(r,t){let e=r.type.name;switch(e){case"NONE":return new ut;case"null":return new ut;case"binary":return new ue;case"largebinary":return new Je;case"utf8":return new Pt;case"largeutf8":return new Xe;case"bool":return new kt;case"list":return new Tt((t||[])[0]);case"struct":return new V(t||[]);case"struct_":return new V(t||[])}switch(e){case"int":{let n=r.type;return new it(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=r.type;return new At(j[n.precision])}case"decimal":{let n=r.type;return new fe(n.scale,n.precision,n.bitWidth)}case"date":{let n=r.type;return new qt(et[n.unit])}case"time":{let n=r.type;return new xt(p[n.unit],n.bitWidth)}case"timestamp":{let n=r.type;return new Nt(p[n.unit],n.timezone)}case"interval":{let n=r.type;return new te(nt[n.unit])}case"duration":{let n=r.type;return new Qe(p[n.unit])}case"union":{let n=r.type,[i,...s]=(n.mode+"").toLowerCase(),o=i.toUpperCase()+s.join("");return new Ie(K[o],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=r.type;return new qe(n.byteWidth)}case"fixedsizelist":{let n=r.type;return new Vt(n.listSize,(t||[])[0])}case"map":{let n=r.type;return new jt((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var Id=ar,xd=Ct,gt=class{static fromJSON(t,e){let n=new gt(0,$.V5,e);return n._createHeader=Sd(t,e),n}static decode(t){t=new xd(T(t));let e=ft.getRootAsMessage(t),n=e.bodyLength(),i=e.version(),s=e.headerType(),o=new gt(n,i,s);return o._createHeader=Bd(e,s),o}static encode(t){let e=new Id,n=-1;return t.isSchema()?n=E.encode(e,t.header()):t.isRecordBatch()?n=Ot.encode(e,t.header()):t.isDictionaryBatch()&&(n=se.encode(e,t.header())),ft.startMessage(e),ft.addVersion(e,$.V5),ft.addHeader(e,n),ft.addHeaderType(e,t.headerType),ft.addBodyLength(e,BigInt(t.bodyLength)),ft.finishMessageBuffer(e,ft.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof E)return new gt(0,$.V5,P.Schema,t);if(t instanceof Ot)return new gt(e,$.V5,P.RecordBatch,t);if(t instanceof se)return new gt(e,$.V5,P.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===P.Schema}isRecordBatch(){return this.headerType===P.RecordBatch}isDictionaryBatch(){return this.headerType===P.DictionaryBatch}constructor(t,e,n,i){this._version=e,this._headerType=n,this.body=new Uint8Array(0),i&&(this._createHeader=()=>i),this._bodyLength=at(t)}},Ot=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=at(t)}},se=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,e,n=!1){this._data=t,this._isDelta=n,this._id=at(e)}},ie=class{constructor(t,e){this.offset=at(t),this.length=at(e)}},Be=class{constructor(t,e){this.length=at(t),this.nullCount=at(e)}};function Sd(r,t){return()=>{switch(t){case P.Schema:return E.fromJSON(r);case P.RecordBatch:return Ot.fromJSON(r);case P.DictionaryBatch:return se.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${P[t]}, type: ${t} }`)}}function Bd(r,t){return()=>{switch(t){case P.Schema:return E.decode(r.header(new ot),new Map,r.version());case P.RecordBatch:return Ot.decode(r.header(new Ft),r.version());case P.DictionaryBatch:return se.decode(r.header(new me),r.version())}throw new Error(`Unrecognized Message type: { name: ${P[t]}, type: ${t} }`)}}D.encode=Rd;D.decode=Ud;D.fromJSON=du;E.encode=Ed;E.decode=Ad;E.fromJSON=lu;Ot.encode=Cd;Ot.decode=Td;Ot.fromJSON=Pa;se.encode=Pd;se.decode=Dd;se.fromJSON=uu;Be.encode=kd;Be.decode=Fd;ie.encode=Vd;ie.decode=Od;function Ad(r,t=new Map,e=$.V5){let n=Nd(r,t);return new E(n,Io(r),t,e)}function Td(r,t=$.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new Ot(r.length(),Md(r),Ld(r,t))}function Dd(r,t=$.V5){return new se(Ot.decode(r.data(),t),r.id(),r.isDelta())}function Od(r){return new ie(r.offset(),r.length())}function Fd(r){return new Be(r.length(),r.nullCount())}function Md(r){let t=[];for(let e,n=-1,i=-1,s=r.nodesLength();++n<s;)(e=r.nodes(n))&&(t[++i]=Be.decode(e));return t}function Ld(r,t){let e=[];for(let n,i=-1,s=-1,o=r.buffersLength();++i<o;)(n=r.buffers(i))&&(t<$.V4&&(n.bb_pos+=8*(i+1)),e[++s]=ie.decode(n));return e}function Nd(r,t){let e=[];for(let n,i=-1,s=-1,o=r.fieldsLength();++i<o;)(n=r.fields(i))&&(e[++s]=D.decode(n,t));return e}function pu(r,t){let e=[];for(let n,i=-1,s=-1,o=r.childrenLength();++i<o;)(n=r.children(i))&&(e[++s]=D.decode(n,t));return e}function Ud(r,t){let e,n,i,s,o,a;return!t||!(a=r.dictionary())?(i=yu(r,pu(r,t)),n=new D(r.name(),i,r.nullable(),Io(r))):t.has(e=at(a.id()))?(s=(s=a.indexType())?mu(s):new pt,o=new Ut(t.get(e),s,e,a.isOrdered()),n=new D(r.name(),o,r.nullable(),Io(r))):(s=(s=a.indexType())?mu(s):new pt,t.set(e,i=yu(r,pu(r,t))),o=new Ut(i,s,e,a.isOrdered()),n=new D(r.name(),o,r.nullable(),Io(r))),n||null}function Io(r){let t=new Map;if(r)for(let e,n,i=-1,s=Math.trunc(r.customMetadataLength());++i<s;)(e=r.customMetadata(i))&&(n=e.key())!=null&&t.set(n,e.value());return t}function mu(r){return new it(r.isSigned(),r.bitWidth())}function yu(r,t){let e=r.typeType();switch(e){case Z.NONE:return new ut;case Z.Null:return new ut;case Z.Binary:return new ue;case Z.LargeBinary:return new Je;case Z.Utf8:return new Pt;case Z.LargeUtf8:return new Xe;case Z.Bool:return new kt;case Z.List:return new Tt((t||[])[0]);case Z.Struct_:return new V(t||[])}switch(e){case Z.Int:{let n=r.type(new _t);return new it(n.isSigned(),n.bitWidth())}case Z.FloatingPoint:{let n=r.type(new Kt);return new At(n.precision())}case Z.Decimal:{let n=r.type(new vt);return new fe(n.scale(),n.precision(),n.bitWidth())}case Z.Date:{let n=r.type(new Gt);return new qt(n.unit())}case Z.Time:{let n=r.type(new Mt);return new xt(n.unit(),n.bitWidth())}case Z.Timestamp:{let n=r.type(new Lt);return new Nt(n.unit(),n.timezone())}case Z.Interval:{let n=r.type(new Zt);return new te(n.unit())}case Z.Duration:{let n=r.type(new $t);return new Qe(n.unit())}case Z.Union:{let n=r.type(new It);return new Ie(n.mode(),n.typeIdsArray()||[],t||[])}case Z.FixedSizeBinary:{let n=r.type(new Ht);return new qe(n.byteWidth())}case Z.FixedSizeList:{let n=r.type(new Yt);return new Vt(n.listSize(),(t||[])[0])}case Z.Map:{let n=r.type(new Jt);return new jt((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${Z[e]}" (${e})`)}function Ed(r,t){let e=t.fields.map(s=>D.encode(r,s));ot.startFieldsVector(r,e.length);let n=ot.createFieldsVector(r,e),i=t.metadata&&t.metadata.size>0?ot.createCustomMetadataVector(r,[...t.metadata].map(([s,o])=>{let a=r.createString(`${s}`),c=r.createString(`${o}`);return Q.startKeyValue(r),Q.addKey(r,a),Q.addValue(r,c),Q.endKeyValue(r)})):-1;return ot.startSchema(r),ot.addFields(r,n),ot.addEndianness(r,jd?Sr.Little:Sr.Big),i!==-1&&ot.addCustomMetadata(r,i),ot.endSchema(r)}function Rd(r,t){let e=-1,n=-1,i=-1,s=t.type,o=t.typeId;m.isDictionary(s)?(o=s.dictionary.typeId,i=_o.visit(s,r),n=_o.visit(s.dictionary,r)):n=_o.visit(s,r);let a=(s.children||[]).map(u=>D.encode(r,u)),c=dt.createChildrenVector(r,a),l=t.metadata&&t.metadata.size>0?dt.createCustomMetadataVector(r,[...t.metadata].map(([u,h])=>{let d=r.createString(`${u}`),b=r.createString(`${h}`);return Q.startKeyValue(r),Q.addKey(r,d),Q.addValue(r,b),Q.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),dt.startField(r),dt.addType(r,n),dt.addTypeType(r,o),dt.addChildren(r,c),dt.addNullable(r,!!t.nullable),e!==-1&&dt.addName(r,e),i!==-1&&dt.addDictionary(r,i),l!==-1&&dt.addCustomMetadata(r,l),dt.endField(r)}function Cd(r,t){let e=t.nodes||[],n=t.buffers||[];Ft.startNodesVector(r,e.length);for(let o of e.slice().reverse())Be.encode(r,o);let i=r.endVector();Ft.startBuffersVector(r,n.length);for(let o of n.slice().reverse())ie.encode(r,o);let s=r.endVector();return Ft.startRecordBatch(r),Ft.addLength(r,BigInt(t.length)),Ft.addNodes(r,i),Ft.addBuffers(r,s),Ft.endRecordBatch(r)}function Pd(r,t){let e=Ot.encode(r,t.data);return me.startDictionaryBatch(r),me.addId(r,BigInt(t.id)),me.addIsDelta(r,t.isDelta),me.addData(r,e),me.endDictionaryBatch(r)}function kd(r,t){return vn.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function Vd(r,t){return _n.createBuffer(r,BigInt(t.offset),BigInt(t.length))}var jd=(()=>{let r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})();var Va=r=>`Expected ${P[r]} Message in stream, but was null or length 0.`,ja=r=>`Header pointer of flatbuffer-encoded ${P[r]} Message is null or length 0.`,gu=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,bu=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`,kn=class{constructor(t){this.source=t instanceof rr?t:new rr(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?q:t.value===-1&&(t=this.readMetadataLength()).done?q:(t=this.readMetadata(t.value)).done?q: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(Va(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let e=T(this.source.read(t));if(e.byteLength<t)throw new Error(bu(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){let e=P.Schema,n=this.readMessage(e),i=n?.header();if(t&&!i)throw new Error(ja(e));return i}readMetadataLength(){let t=this.source.read(xo),e=t&&new Ct(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let e=this.source.read(t);if(!e)return q;if(e.byteLength<t)throw new Error(gu(t,e.byteLength));return{done:!1,value:gt.decode(e)}}},ki=class{constructor(t,e){this.source=t instanceof re?t:fs(t)?new Fr(t,e):new re(t)}[Symbol.asyncIterator](){return this}next(){return y(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?q:t.value===-1&&(t=yield this.readMetadataLength()).done?q:(t=yield this.readMetadata(t.value)).done?q:t})}throw(t){return y(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return y(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return y(this,void 0,void 0,function*(){let e;if((e=yield this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Va(t));return e.value})}readMessageBody(t){return y(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let e=T(yield this.source.read(t));if(e.byteLength<t)throw new Error(bu(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(t=!1){return y(this,void 0,void 0,function*(){let e=P.Schema,n=yield this.readMessage(e),i=n?.header();if(t&&!i)throw new Error(ja(e));return i})}readMetadataLength(){return y(this,void 0,void 0,function*(){let t=yield this.source.read(xo),e=t&&new Ct(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return y(this,void 0,void 0,function*(){let e=yield this.source.read(t);if(!e)return q;if(e.byteLength<t)throw new Error(gu(t,e.byteLength));return{done:!1,value:gt.decode(e)}})}},Vi=class extends kn{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof fi?t:new fi(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:gt.fromJSON(t.schema,P.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:gt.fromJSON(e,P.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:gt.fromJSON(e,P.RecordBatch)}}return this._body=[],q}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((i,s)=>[...i,...s.VALIDITY&&[s.VALIDITY]||[],...s.TYPE_ID&&[s.TYPE_ID]||[],...s.OFFSET&&[s.OFFSET]||[],...s.DATA&&[s.DATA]||[],...e(s.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error(Va(t));return e.value}readSchema(){let t=P.Schema,e=this.readMessage(t),n=e?.header();if(!e||!n)throw new Error(ja(t));return n}},xo=4,ka="ARROW1",Vn=new Uint8Array(ka.length);for(let r=0;r<ka.length;r+=1)Vn[r]=ka.codePointAt(r);function So(r,t=0){for(let e=-1,n=Vn.length;++e<n;)if(Vn[e]!==r[t+e])return!1;return!0}var jn=Vn.length,za=jn+xo,wu=jn*2+xo;var bt=class extends en{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 ae(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 bt?t:ls(t)?Wd(t):fs(t)?Hd(t):ae(t)?(()=>y(this,void 0,void 0,function*(){return yield bt.from(yield t)}))():hs(t)||qn(t)||ps(t)||de(t)?$d(new re(t)):Gd(new rr(t))}static readAll(t){return t instanceof bt?t.isSync()?_u(t):vu(t):ls(t)||ArrayBuffer.isView(t)||De(t)||us(t)?_u(t):vu(t)}},ir=class extends bt{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return oe(this,arguments,function*(){yield U(yield*bn(Te(this[Symbol.iterator]())))})}},Mr=class extends bt{constructor(t){super(t),this._impl=t}readAll(){var t,e,n,i;return y(this,void 0,void 0,function*(){let s=new Array;try{for(var o=!0,a=Te(this),c;c=yield a.next(),t=c.done,!t;o=!0){i=c.value,o=!1;let l=i;s.push(l)}}catch(l){e={error:l}}finally{try{!o&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(e)throw e.error}}return s})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Lr=class extends ir{constructor(t){super(t),this._impl=t}},ji=class extends Mr{constructor(t){super(t),this._impl=t}},Bo=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=w({type:new V(this.schema.fields),length:t.length,children:n});return new Y(this.schema,i)}_loadDictionaryBatch(t,e){let{id:n,isDelta:i}=t,{dictionaries:s,schema:o}=this,a=s.get(n);if(i||!a){let c=o.dictionaries.get(n),l=this._loadVectors(t.data,e,[c]);return(a&&i?a.concat(new g(l)):new g(l)).memoize()}return a.memoize()}_loadVectors(t,e,n){return new pi(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}},zn=class extends Bo{constructor(t,e){super(e),this._reader=ls(t)?new Vi(this._handle=t):new kn(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=Iu(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):q}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):q}next(){if(this.closed)return q;let t,{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new cn(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Wn=class extends Bo{constructor(t,e){super(e),this._reader=new ki(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return y(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return y(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Iu(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):q})}return(t){return y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):q})}next(){return y(this,void 0,void 0,function*(){if(this.closed)return q;let t,{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield e.readMessageBody(t.bodyLength),s=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,s)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new cn(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return y(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Ao=class extends zn{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 hi?t:new hi(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(P.RecordBatch);if(i?.isRecordBatch()){let s=i.header(),o=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null}_readDictionaryBatch(t){var e;let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(P.DictionaryBatch);if(i?.isDictionaryBatch()){let s=i.header(),o=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}}_readFooter(){let{_handle:t}=this,e=t.size-za,n=t.readInt32(e),i=t.readAt(e-n,n);return fr.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}},Wa=class extends Wn{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 Fr?t:new Fr(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let e=Object.create(null,{open:{get:()=>super.open}});return y(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){var e;return y(this,void 0,void 0,function*(){if(this.closed)return null;this._footer||(yield this.open());let n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(P.RecordBatch);if(i?.isRecordBatch()){let s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(s,o)}}return null})}_readDictionaryBatch(t){var e;return y(this,void 0,void 0,function*(){let n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(P.DictionaryBatch);if(i?.isDictionaryBatch()){let s=i.header(),o=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(s,o);this.dictionaries.set(s.id,a)}}})}_readFooter(){return y(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let e=t.size-za,n=yield t.readInt32(e),i=yield t.readAt(e-n,n);return fr.decode(i)})}_readNextMessageAndValidate(t){return y(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})}},Ga=class extends zn{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new Ks(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}};function Iu(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*_u(r){let t=bt.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function vu(r){return oe(this,arguments,function*(){let e=yield U(bt.from(r));try{if(!(yield U(e.open({autoDestroy:!1}))).closed)do yield yield U(e);while(!(yield U(e.reset().open())).closed)}finally{yield U(e.cancel())}})}function Wd(r){return new ir(new Ga(r))}function Gd(r){let t=r.peek(jn+7&-8);return t&&t.byteLength>=4?So(t)?new Lr(new Ao(r.read())):new ir(new zn(r)):new ir(new zn(function*(){}()))}function $d(r){return y(this,void 0,void 0,function*(){let t=yield r.peek(jn+7&-8);return t&&t.byteLength>=4?So(t)?new Lr(new Ao(yield r.read())):new Mr(new Wn(r)):new Mr(new Wn(function(){return oe(this,arguments,function*(){})}()))})}function Hd(r){return y(this,void 0,void 0,function*(){let{size:t}=yield r.stat(),e=new Fr(r,t);return t>=wu&&So(yield e.readAt(0,jn+7&-8))?new ji(new Wa(e)):new Mr(new Wn(e))})}var tt=class extends v{static assemble(...t){let e=i=>i.flatMap(s=>Array.isArray(s)?e(s):s instanceof Y?s.data.children:s.data),n=new tt;return n.visitMany(e(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[]}visit(t){if(t instanceof g)return this.visitMany(t.data),this;let{type:e}=t;if(!m.isDictionary(e)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(m.isUnion(e))this.nodes.push(new Be(n,0));else{let{nullCount:i}=t;m.isNull(e)||Ce.call(this,i<=0?new Uint8Array(0):Jr(t.offset,n,t.nullBitmap)),this.nodes.push(new Be(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 Ce(r){let t=r.byteLength+7&-8;return this.buffers.push(r),this.bufferRegions.push(new ie(this._byteLength,t)),this._byteLength+=t,this}function Yd(r){var t;let{type:e,length:n,typeIds:i,valueOffsets:s}=r;if(Ce.call(this,i),e.mode===K.Sparse)return $a.call(this,r);if(e.mode===K.Dense){if(r.offset<=0)return Ce.call(this,s),$a.call(this,r);{let o=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,u,h=-1;++h<n;)(l=i[h])!==void 0&&((u=a[l])===void 0&&(u=a[l]=s[h]),o[h]=s[h]-u,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);Ce.call(this,o),this.visitMany(r.children.map((l,u)=>{let h=e.typeIds[u],d=a[h],b=c[h];return l.slice(d,Math.min(n,b))}))}}return this}function Kd(r){let t;return r.nullCount>=r.length?Ce.call(this,new Uint8Array(0)):(t=r.values)instanceof Uint8Array?Ce.call(this,Jr(r.offset,r.length,t)):Ce.call(this,Xr(r.values))}function br(r){return Ce.call(this,r.values.subarray(0,r.length*r.stride))}function To(r){let{length:t,values:e,valueOffsets:n}=r,i=at(n[0]),s=at(n[t]),o=Math.min(s-i,e.byteLength-i);return Ce.call(this,ys(-i,t+1,n)),Ce.call(this,e.subarray(i,i+o)),this}function Ha(r){let{length:t,valueOffsets:e}=r;if(e){let{[0]:n,[t]:i}=e;return Ce.call(this,ys(-n,t+1,e)),this.visit(r.children[0].slice(n,i-n))}return this.visit(r.children[0])}function $a(r){return this.visitMany(r.type.children.map((t,e)=>r.children[e]).filter(Boolean))[0]}tt.prototype.visitBool=Kd;tt.prototype.visitInt=br;tt.prototype.visitFloat=br;tt.prototype.visitUtf8=To;tt.prototype.visitLargeUtf8=To;tt.prototype.visitBinary=To;tt.prototype.visitLargeBinary=To;tt.prototype.visitFixedSizeBinary=br;tt.prototype.visitDate=br;tt.prototype.visitTimestamp=br;tt.prototype.visitTime=br;tt.prototype.visitDecimal=br;tt.prototype.visitList=Ha;tt.prototype.visitStruct=$a;tt.prototype.visitUnion=Yd;tt.prototype.visitInterval=br;tt.prototype.visitDuration=br;tt.prototype.visitFixedSizeList=Ha;tt.prototype.visitMap=Ha;var ln=class extends en{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 er,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,Rt(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 ae(t)?t.then(e=>this.writeAll(e)):de(t)?Ka(this,t):Ya(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 er?this._sink=t:(this._sink=new er,t&&Rc(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&Cc(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._dictionaryDeltaOffsets=new Map,(!e||!an(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 J&&!(e=t.schema))return this.finish()&&void 0;if(t instanceof Y&&!(e=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(e&&!an(e,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,e)}t instanceof Y?t instanceof cn||this._writeRecordBatch(t):t instanceof J?this.writeAll(t.batches):De(t)&&this.writeAll(t)}_writeMessage(t,e=8){let n=e-1,i=gt.encode(t),s=i.byteLength,o=this._writeLegacyIpcFormat?4:8,a=s+o+n&~n,c=a-s-o;return t.headerType===P.RecordBatch?this._recordBatchBlocks.push(new Re(a,t.bodyLength,this._position)):t.headerType===P.DictionaryBatch&&this._dictionaryBlocks.push(new Re(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-o)),s>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let e=T(t);e&&e.byteLength>0&&(this._sink.write(e),this._position+=e.byteLength)}return this}_writeSchema(t){return this._writeMessage(gt.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Vn)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:e,nodes:n,bufferRegions:i,buffers:s}=tt.assemble(t),o=new Ot(t.numRows,n,i),a=gt.from(o,e);return this._writeDictionaries(t)._writeMessage(a)._writeBodyBuffers(s)}_writeDictionaryBatch(t,e,n=!1){this._dictionaryDeltaOffsets.set(e,t.length+(this._dictionaryDeltaOffsets.get(e)||0));let{byteLength:i,nodes:s,bufferRegions:o,buffers:a}=tt.assemble(new g([t])),c=new Ot(t.length,s,o),l=new se(c,e,n),u=gt.from(l,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let e,n,i;for(let s=-1,o=t.length;++s<o;)(e=t[s])&&(n=e.byteLength)>0&&(this._write(e),(i=(n+7&-8)-n)>0&&this._writePadding(i));return this}_writeDictionaries(t){for(let[e,n]of t.dictionaries){let i=this._dictionaryDeltaOffsets.get(e)||0;if(i===0||(n=n?.slice(i)).length>0)for(let s of n.data)this._writeDictionaryBatch(s,e,i>0),i+=s.length}return this}},wr=class extends ln{static writeAll(t,e){let n=new wr(e);return ae(t)?t.then(i=>n.writeAll(i)):de(t)?Ka(n,t):Ya(n,t)}},_r=class extends ln{static writeAll(t){let e=new _r;return ae(t)?t.then(n=>e.writeAll(n)):de(t)?Ka(e,t):Ya(e,t)}constructor(){super(),this._autoDestroy=!0}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeFooter(t){let e=fr.encode(new fr(t,$.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(e)._write(Int32Array.of(e.byteLength))._writeMagic()}};function Ya(r,t){let e=t;t instanceof J&&(e=t.batches,r.reset(void 0,t.schema));for(let n of e)r.write(n);return r.finish()}function Ka(r,t){var e,n,i,s,o,a,c;return y(this,void 0,void 0,function*(){try{for(e=!0,n=Te(t);i=yield n.next(),s=i.done,!s;e=!0){c=i.value,e=!1;let l=c;r.write(l)}}catch(l){o={error:l}}finally{try{!e&&!s&&(a=n.return)&&(yield a.call(n))}finally{if(o)throw o.error}}return r.finish()})}function xu(r,t){if(de(r))return Jd(r,t);if(De(r))return Zd(r,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function Zd(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(o){s(o,e||(e=r[Symbol.iterator]()))},pull(o){e?s(o,e):o.close()},cancel(){(e?.return&&e.return()||!0)&&(e=null)}}),Object.assign({highWaterMark:n?i:void 0},t));function s(o,a){let c,l=null,u=o.desiredSize||null;for(;!(l=a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=T(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),o.enqueue(l.value),u!=null&&--u<=0)return;o.close()}}function Jd(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(o){return y(this,void 0,void 0,function*(){yield s(o,e||(e=r[Symbol.asyncIterator]()))})},pull(o){return y(this,void 0,void 0,function*(){e?yield s(o,e):o.close()})},cancel(){return y(this,void 0,void 0,function*(){(e?.return&&(yield e.return())||!0)&&(e=null)})}}),Object.assign({highWaterMark:n?i:void 0},t));function s(o,a){return y(this,void 0,void 0,function*(){let c,l=null,u=o.desiredSize||null;for(;!(l=yield a.next(n?u:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=T(l.value))&&(u!=null&&n&&(u=u-c.byteLength+1),l.value=c),o.enqueue(l.value),u!=null&&--u<=0)return;o.close()})}}function Au(r){return new Za(r)}var Za=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:e,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,s=Uc(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=dr(s),this._getSize=i!=="bytes"?Su:Bu;let{["highWaterMark"]:o=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:o,size:i!=="bytes"?Su:Bu}),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)}},Su=r=>{var t;return(t=r?.length)!==null&&t!==void 0?t:0},Bu=r=>{var t;return(t=r?.byteLength)!==null&&t!==void 0?t:0};function Do(r,t){let e=new er,n=null,i=new ReadableStream({cancel(){return y(this,void 0,void 0,function*(){yield e.close()})},start(a){return y(this,void 0,void 0,function*(){yield o(a,n||(n=yield s()))})},pull(a){return y(this,void 0,void 0,function*(){n?yield o(a,n):a.close()})}});return{writable:new WritableStream(e,Object.assign({highWaterMark:Math.pow(2,14)},r)),readable:i};function s(){return y(this,void 0,void 0,function*(){return yield(yield bt.from(e)).open(t)})}function o(a,c){return y(this,void 0,void 0,function*(){let l=a.desiredSize,u=null;for(;!(u=yield c.next()).done;)if(a.enqueue(u.value),l!=null&&--l<=0)return;a.close()})}}function Oo(r,t){let e=new this(r),n=new re(e),i=new ReadableStream({cancel(){return y(this,void 0,void 0,function*(){yield n.cancel()})},pull(o){return y(this,void 0,void 0,function*(){yield s(o)})},start(o){return y(this,void 0,void 0,function*(){yield s(o)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(e,r),readable:i};function s(o){return y(this,void 0,void 0,function*(){let a=null,c=o.desiredSize;for(;a=yield n.read(c||null);)if(o.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;o.close()})}}function zi(r){let t=bt.from(r);return ae(t)?t.then(e=>zi(e)):t.isAsync()?t.readAll().then(e=>new J(e)):new J(t.readAll())}function Fo(r,t="stream"){return(t==="stream"?wr:_r).writeAll(r).toUint8Array(!0)}var ap=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},oa),Ma),xa),aa),ea),Ia),ia),{compareSchemas:an,compareFields:eu,compareTypes:go});Bt.toDOMStream=xu;rt.throughDOM=Au;bt.throughDOM=Do;Lr.throughDOM=Do;ir.throughDOM=Do;ln.throughDOM=Oo;_r.throughDOM=Oo;wr.throughDOM=Oo;var Mo=class extends Er{arrowSchema;constructor(t,e){super(t,e),this.arrowSchema=null}getBatch(){let t=super.getBatch();if(t){this.arrowSchema=this.arrowSchema||cp(t.schema);let e=lp(this.arrowSchema,t.data),n=new Y(this.arrowSchema,w({type:new V(this.arrowSchema.fields),children:e.map(({data:i})=>i[0])}));return{shape:"arrow-table",batchType:"data",data:new J([n]),length:t.length}}return null}};function cp(r){let t=[];for(let e in r){let n=r[e];if(n.type===Float32Array){let i=new Map,s=new D(n.name,new Xt,n.nullable,i);t.push(s)}}if(t.length===0)throw new Error("No arrow convertible fields");return new E(t)}function lp(r,t){let e=[];for(let n of r.fields){let i=t[n.name];if(i instanceof Float32Array){let s=Or(i);e.push(s)}}if(r.fields.length!==e.length)throw new Error("Some columns not arrow convertible");return e}function Tu(r){switch(r.constructor){case Int8Array:return new ye;case Uint8Array:return new we;case Int16Array:return new ge;case Uint16Array:return new _e;case Int32Array:return new pt;case Uint32Array:return new ve;case Float32Array:return new Xt;case Float64Array:return new Qt;default:throw new Error("array type not supported")}}var fn;(function(r){r[r.FLOAT=0]="FLOAT",r[r.DATE=1]="DATE"})(fn||(fn={}));function Lo(r){let t=r.data,e={};for(let n of t.schema.fields){let s=t.getChild(n.name)?.toArray();e[n.name]=s}return{shape:"columnar-table",schema:r.schema,data:e}}function Gn(r){return{fields:r.fields.map(t=>hn(t)),metadata:No(r.metadata)}}function Du(r){return new E(r.fields.map(t=>dn(t)),Uo(r.metadata))}function No(r){return Object.fromEntries(r)}function Uo(r){return r?new Map(Object.entries(r)):new Map}function hn(r){return{name:r.name,type:Ja(r.type),nullable:r.nullable,metadata:No(r.metadata)}}function dn(r){return new D(r.name,Xa(r.type),r.nullable,Uo(r.metadata))}function Ja(r){switch(r.constructor){case ut:return"null";case ue:return"binary";case kt:return"bool";case it:let t=r;return`${t.isSigned?"u":""}int${t.bitWidth}`;case ye:return"int8";case ge:return"int16";case pt:return"int32";case be:return"int64";case we:return"uint8";case _e:return"uint16";case ve:return"uint32";case Ze:return"uint64";case At:switch(r.precision){case j.HALF:return"float16";case j.SINGLE:return"float32";case j.DOUBLE:return"float64";default:return"float16"}case Br:return"float16";case Xt:return"float32";case Qt:return"float64";case Pt:return"utf8";case fe:let n=r;return{type:"decimal",bitWidth:n.bitWidth,precision:n.precision,scale:n.scale};case qt:return r.unit===et.DAY?"date-day":"date-millisecond";case Pr:return"date-day";case cr:return"date-millisecond";case xt:switch(r.unit){case p.SECOND:return"time-second";case p.MILLISECOND:return"time-millisecond";case p.MICROSECOND:return"time-microsecond";case p.NANOSECOND:return"time-nanosecond";default:return"time-second"}case Vr:return"time-millisecond";case kr:return"time-second";case jr:return"time-microsecond";case zr:return"time-nanosecond";case Nt:switch(r.unit){case p.SECOND:return"timestamp-second";case p.MILLISECOND:return"timestamp-millisecond";case p.MICROSECOND:return"timestamp-microsecond";case p.NANOSECOND:return"timestamp-nanosecond";default:return"timestamp-second"}case Wr:return"timestamp-second";case Gr:return"timestamp-millisecond";case $r:return"timestamp-microsecond";case Hr:return"timestamp-nanosecond";case te:switch(r.unit){case nt.DAY_TIME:return"interval-daytime";case nt.YEAR_MONTH:return"interval-yearmonth";default:return"interval-daytime"}case Yr:return"interval-daytime";case Kr:return"interval-yearmonth";case jt:let c=r;return{type:"map",keysSorted:c.keysSorted,children:c.children.map(b=>hn(b))};case Tt:let u=r.valueField;return{type:"list",children:[hn(u)]};case Vt:let h=r;return{type:"fixed-size-list",listSize:h.listSize,children:[hn(h.children[0])]};case V:return{type:"struct",children:r.children.map(b=>hn(b))};default:throw new Error(`arrow type not supported: ${r.constructor.name}`)}}function Xa(r){if(typeof r=="object")switch(r.type){case"decimal":return new fe(r.precision,r.scale,r.bitWidth);case"map":let t=r.children.map(i=>dn(i));return new jt(t,r.keysSorted);case"list":let e=dn(r.children[0]);return new Tt(e);case"fixed-size-list":let n=dn(r.children[0]);return new Vt(r.listSize,n);case"struct":return t=r.children.map(i=>dn(i)),new V(t);default:throw new Error("array type not supported")}switch(r){case"null":return new ut;case"binary":return new ue;case"bool":return new kt;case"int8":return new ye;case"int16":return new ge;case"int32":return new pt;case"int64":return new be;case"uint8":return new we;case"uint16":return new _e;case"uint32":return new ve;case"uint64":return new Ze;case"float16":return new Br;case"float32":return new Xt;case"float64":return new Qt;case"utf8":return new Pt;case"date-day":return new Pr;case"date-millisecond":return new cr;case"time-second":return new kr;case"time-millisecond":return new Vr;case"time-microsecond":return new jr;case"time-nanosecond":return new zr;case"timestamp-second":return new Wr;case"timestamp-millisecond":return new Gr;case"timestamp-microsecond":return new $r;case"timestamp-nanosecond":return new Hr;case"interval-daytime":return new Yr;case"interval-yearmonth":return new Kr;default:throw new Error("array type not supported")}}function Wi(r,t){let e=zi([new Uint8Array(r)]),n={shape:"arrow-table",schema:Gn(e.schema),data:e},i=t?.shape||"arrow-table";switch(i){case"arrow-table":return n;case"columnar-table":return Lo(n);case"object-row-table":let s=Lo(n);return cs(s,"object-row-table");case"array-row-table":return s=Lo(n),cs(s,"array-row-table");default:throw new Error(i)}}function Eo(r,t){async function*e(){let n=bt.readAll(r);for await(let i of n){for await(let s 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 J([s]),length:s.data.length};break}}return e()}var up="4.2.0-alpha.5",$n={name:"Apache Arrow",id:"arrow",module:"arrow",version:up,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"}}},Ou={...$n,parse:async(r,t)=>Wi(r,t?.arrow),parseSync:(r,t)=>Wi(r,t?.arrow),parseInBatches:Eo};function Qa(r){let t={};for(let i of r){let s=fp(i.array,i.type);t[i.name]=s}let e=new J(t);return Fo(e)}function fp(r,t){switch(t){case fn.DATE:return Pi(r);case fn.FLOAT:default:return Pi(r)}}var hp="4.2.0-alpha.5",Fu={name:"Apache Arrow",id:"arrow",module:"arrow",version:hp,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 Qa(t)},encodeSync(r,t){return Qa(r)}};var dp=["geoarrow.multipolygon","geoarrow.polygon","geoarrow.multilinestring","geoarrow.linestring","geoarrow.multipoint","geoarrow.point","geoarrow.wkb","geoarrow.wkt"],pp="ARROW:extension:name",mp="ARROW:extension:metadata";function qa(r){let t={};for(let e of r.fields){let n=yp(e);n&&(t[e.name]=n)}return t}function yp(r){let t=null,e=r.metadata?.[pp];e&&(e=e.toLowerCase(),e==="wkb"&&(e="geoarrow.wkb"),e==="wkt"&&(e="geoarrow.wkt"),dp.includes(e)?(t=t||{},t.encoding=e):console.warn(`Invalid GeoArrow encoding: ${e}`));let n=r.metadata?.[mp];if(n)try{t=JSON.parse(n)}catch(i){console.warn("Failed to parse GeoArrow metadata",i)}return t||null}function Nr(r){return Nr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Nr(r)}function tc(r,t){if(Nr(r)!=="object"||r===null)return r;var e=r[Symbol.toPrimitive];if(e!==void 0){var n=e.call(r,t||"default");if(Nr(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(r)}function ec(r){var t=tc(r,"string");return Nr(t)==="symbol"?t:String(t)}function Ae(r,t,e){return t=ec(t),t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}var Gi={x:0,y:1,z:2};function Ro(r,t={}){let{start:e=0,end:n=r.length,plane:i="xy"}=t,s=t.size||2,o=0,a=Gi[i[0]],c=Gi[i[1]];for(let l=e,u=n-s;l<n;l+=s)o+=(r[l+a]-r[u+a])*(r[l+c]+r[u+c]),u=l;return o/2}function nc(r,t,e=2,n,i="xy"){let s=t&&t.length,o=s?t[0]*e:r.length,a=Lu(r,0,o,e,!0,n&&n[0],i),c=[];if(!a||a.next===a.prev)return c;let l,u,h,d,b,M,z;if(s&&(a=xp(r,t,a,e,n,i)),r.length>80*e){d=u=r[0],b=h=r[1];for(let X=e;X<o;X+=e)M=r[X],z=r[X+1],M<d&&(d=M),z<b&&(b=z),M>u&&(u=M),z>h&&(h=z);l=Math.max(u-d,h-b),l=l!==0?32767/l:0}return $i(a,c,e,d,b,l,0),c}function Lu(r,t,e,n,i,s,o){let a,c;s===void 0&&(s=Ro(r,{start:t,end:e,size:n,plane:o}));let l=Gi[o[0]],u=Gi[o[1]];if(i===s<0)for(a=t;a<e;a+=n)c=Mu(a,r[a+l],r[a+u],c);else for(a=e-n;a>=t;a-=n)c=Mu(a,r[a+l],r[a+u],c);return c&&ko(c,c.next)&&(Yi(c),c=c.next),c}function pn(r,t){if(!r)return r;t||(t=r);let e=r,n;do if(n=!1,!e.steiner&&(ko(e,e.next)||ct(e.prev,e,e.next)===0)){if(Yi(e),e=t=e.prev,e===e.next)break;n=!0}else e=e.next;while(n||e!==t);return t}function $i(r,t,e,n,i,s,o){if(!r)return;!o&&s&&Dp(r,n,i,s);let a=r,c,l;for(;r.prev!==r.next;){if(c=r.prev,l=r.next,s?_p(r,n,i,s):wp(r)){t.push(c.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),Yi(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=vp(pn(r),t,e),$i(r,t,e,n,i,s,2)):o===2&&Ip(r,t,e,n,i,s):$i(pn(r),t,e,n,i,s,1);break}}}function wp(r){let t=r.prev,e=r,n=r.next;if(ct(t,e,n)>=0)return!1;let i=t.x,s=e.x,o=n.x,a=t.y,c=e.y,l=n.y,u=i<s?i<o?i:o:s<o?s:o,h=a<c?a<l?a:l:c<l?c:l,d=i>s?i>o?i:o:s>o?s:o,b=a>c?a>l?a:l:c>l?c:l,M=n.next;for(;M!==t;){if(M.x>=u&&M.x<=d&&M.y>=h&&M.y<=b&&Hn(i,a,s,c,o,l,M.x,M.y)&&ct(M.prev,M,M.next)>=0)return!1;M=M.next}return!0}function _p(r,t,e,n){let i=r.prev,s=r,o=r.next;if(ct(i,s,o)>=0)return!1;let a=i.x,c=s.x,l=o.x,u=i.y,h=s.y,d=o.y,b=a<c?a<l?a:l:c<l?c:l,M=u<h?u<d?u:d:h<d?h:d,z=a>c?a>l?a:l:c>l?c:l,X=u>h?u>d?u:d:h>d?h:d,st=rc(b,M,t,e,n),yn=rc(z,X,t,e,n),W=r.prevZ,k=r.nextZ;for(;W&&W.z>=st&&k&&k.z<=yn;){if(W.x>=b&&W.x<=z&&W.y>=M&&W.y<=X&&W!==i&&W!==o&&Hn(a,u,c,h,l,d,W.x,W.y)&&ct(W.prev,W,W.next)>=0||(W=W.prevZ,k.x>=b&&k.x<=z&&k.y>=M&&k.y<=X&&k!==i&&k!==o&&Hn(a,u,c,h,l,d,k.x,k.y)&&ct(k.prev,k,k.next)>=0))return!1;k=k.nextZ}for(;W&&W.z>=st;){if(W.x>=b&&W.x<=z&&W.y>=M&&W.y<=X&&W!==i&&W!==o&&Hn(a,u,c,h,l,d,W.x,W.y)&&ct(W.prev,W,W.next)>=0)return!1;W=W.prevZ}for(;k&&k.z<=yn;){if(k.x>=b&&k.x<=z&&k.y>=M&&k.y<=X&&k!==i&&k!==o&&Hn(a,u,c,h,l,d,k.x,k.y)&&ct(k.prev,k,k.next)>=0)return!1;k=k.nextZ}return!0}function vp(r,t,e){let n=r;do{let i=n.prev,s=n.next.next;!ko(i,s)&&Nu(i,n,n.next,s)&&Hi(i,s)&&Hi(s,i)&&(t.push(i.i/e|0),t.push(n.i/e|0),t.push(s.i/e|0),Yi(n),Yi(n.next),n=r=s),n=n.next}while(n!==r);return pn(n)}function Ip(r,t,e,n,i,s){let o=r;do{let a=o.next.next;for(;a!==o.prev;){if(o.i!==a.i&&Mp(o,a)){let c=Uu(o,a);o=pn(o,o.next),c=pn(c,c.next),$i(o,t,e,n,i,s,0),$i(c,t,e,n,i,s,0);return}a=a.next}o=o.next}while(o!==r)}function xp(r,t,e,n,i,s){let o=[],a,c,l,u,h;for(a=0,c=t.length;a<c;a++)l=t[a]*n,u=a<c-1?t[a+1]*n:r.length,h=Lu(r,l,u,n,!1,i&&i[a+1],s),h===h.next&&(h.steiner=!0),o.push(Fp(h));for(o.sort(Sp),a=0;a<o.length;a++)e=Bp(o[a],e);return e}function Sp(r,t){return r.x-t.x}function Bp(r,t){let e=Ap(r,t);if(!e)return t;let n=Uu(e,r);return pn(n,n.next),pn(e,e.next)}function Ap(r,t){let e=t,n=r.x,i=r.y,s=-1/0,o;do{if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){let d=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(d<=n&&d>s&&(s=d,o=e.x<e.next.x?e:e.next,d===n))return o}e=e.next}while(e!==t);if(!o)return null;let a=o,c=o.x,l=o.y,u=1/0,h;e=o;do n>=e.x&&e.x>=c&&n!==e.x&&Hn(i<l?n:s,i,c,l,i<l?s:n,i,e.x,e.y)&&(h=Math.abs(i-e.y)/(n-e.x),Hi(e,r)&&(h<u||h===u&&(e.x>o.x||e.x===o.x&&Tp(o,e)))&&(o=e,u=h)),e=e.next;while(e!==a);return o}function Tp(r,t){return ct(r.prev,r,t.prev)<0&&ct(t.next,r,r.next)<0}function Dp(r,t,e,n){let i=r;do i.z===0&&(i.z=rc(i.x,i.y,t,e,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,Op(i)}function Op(r){let t,e,n=1,i,s,o,a,c,l;do{for(s=r,r=null,l=null,i=0;s;){for(i++,a=s,o=0,e=0;e<n&&(o++,a=a.nextZ,!!a);e++);for(c=n;o>0||c>0&&a;)o!==0&&(c===0||!a||s.z<=a.z)?(t=s,s=s.nextZ,o--):(t=a,a=a.nextZ,c--),l?l.nextZ=t:r=t,t.prevZ=l,l=t;s=a}l.nextZ=null,n*=2}while(i>1);return r}function rc(r,t,e,n,i){return r=(r-e)*i|0,t=(t-n)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function Fp(r){let t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function Hn(r,t,e,n,i,s,o,a){return(i-o)*(t-a)>=(r-o)*(s-a)&&(r-o)*(n-a)>=(e-o)*(t-a)&&(e-o)*(s-a)>=(i-o)*(n-a)}function Mp(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!Lp(r,t)&&(Hi(r,t)&&Hi(t,r)&&Np(r,t)&&(ct(r.prev,r,t.prev)||ct(r,t.prev,t))||ko(r,t)&&ct(r.prev,r,r.next)>0&&ct(t.prev,t,t.next)>0)}function ct(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function ko(r,t){return r.x===t.x&&r.y===t.y}function Nu(r,t,e,n){let i=Po(ct(r,t,e)),s=Po(ct(r,t,n)),o=Po(ct(e,n,r)),a=Po(ct(e,n,t));return!!(i!==s&&o!==a||i===0&&Co(r,e,t)||s===0&&Co(r,n,t)||o===0&&Co(e,r,n)||a===0&&Co(e,t,n))}function Co(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Po(r){return r>0?1:r<0?-1:0}function Lp(r,t){let e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Nu(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Hi(r,t){return ct(r.prev,r,r.next)<0?ct(r,t,r.next)>=0&&ct(r,r.prev,t)>=0:ct(r,t,r.prev)<0||ct(r,r.next,t)<0}function Np(r,t){let e=r,n=!1,i=(r.x+t.x)/2,s=(r.y+t.y)/2;do e.y>s!=e.next.y>s&&e.next.y!==e.y&&i<(e.next.x-e.x)*(s-e.y)/(e.next.y-e.y)+e.x&&(n=!n),e=e.next;while(e!==r);return n}function Uu(r,t){let e=new Ki(r.i,r.x,r.y),n=new Ki(t.i,t.x,t.y),i=r.next,s=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,n.next=e,e.prev=n,s.next=n,n.prev=s,n}function Mu(r,t,e,n){let i=new Ki(r,t,e);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function Yi(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}var Ki=class{constructor(t,e,n){Ae(this,"i",void 0),Ae(this,"x",void 0),Ae(this,"y",void 0),Ae(this,"prev",null),Ae(this,"next",null),Ae(this,"z",0),Ae(this,"prevZ",null),Ae(this,"nextZ",null),Ae(this,"steiner",!1),this.i=t,this.x=e,this.y=n}};function Yn(r,t,e){switch(r.type){case"Point":return kp(r,t,e);case"LineString":return Pp(r,t,e);case"Polygon":return Cu(r,t,e);default:let n=r;throw new Error(`Unsupported geometry type: ${n?.type}`)}}function Cu(r,t=-1/0,e=1/0){let{positions:n}=r,i=r.polygonIndices.value.filter(c=>c>=t&&c<=e),s=r.primitivePolygonIndices.value.filter(c=>c>=t&&c<=e);if(!(i.length>2)){let c=[];for(let l=0;l<s.length-1;l++){let u=s[l],h=s[l+1],d=Vo(n,u,h);c.push(d)}return{type:"Polygon",coordinates:c}}let a=[];for(let c=0;c<i.length-1;c++){let l=i[c],u=i[c+1],h=Cu(r,l,u).coordinates;a.push(h)}return{type:"MultiPolygon",coordinates:a}}function Pp(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:Vo(n,i[0],i[1])};let o=[];for(let a=0;a<i.length-1;a++){let c=Vo(n,i[a],i[a+1]);o.push(c)}return{type:"MultiLineString",coordinates:o}}function kp(r,t,e){let{positions:n}=r,i=Vo(n,t,e);return i.length>1?{type:"MultiPoint",coordinates:i}:{type:"Point",coordinates:i[0]}}function Vo(r,t,e){t=t||0,e=e||r.value.length/r.size;let n=[];for(let i=t;i<e;i++){let s=Array();for(let o=i*r.size;o<(i+1)*r.size;o++)s.push(Number(r.value[o]));n.push(s)}return n}function jo(r){let t=r.data,e=Gn(t.schema),n=qa(e),i=n.geometry.encoding,s=[],o=t.schema.fields.map(l=>l.name).filter(l=>!(l in n)),a=t.select(o),c=t.getChild("geometry");for(let l=0;l<t.numRows;l++){let u=c?.get(l),h=zo(u,i);if(h){let d=a.get(l)?.toJSON()||{};s.push({type:"Feature",geometry:h,properties:d})}}return{shape:"geojson-table",type:"FeatureCollection",schema:r.schema,features:s}}function ic(r,t){let e=Wi(r,{shape:"arrow-table"});switch(t?.shape){case"geojson-table":return jo(e);default:return e}}function Pu(r){return Eo(r)}var ku={...$n,options:{arrow:{shape:"arrow-table"}}},Vu={...$n,options:{arrow:{shape:"arrow-table"}},parse:async(r,t)=>ic(r,t?.arrow),parseSync:(r,t)=>ic(r,t?.arrow),parseInBatches:Pu};function Wo(r,t,e,n=100){let i=r.length/t,s=Math.max(Math.floor(i/n),1),o=[...e];for(let a=0;a<i;a+=s){let c=r[a*t],l=r[a*t+1];c<o[0]&&(o[0]=c),l<o[1]&&(o[1]=l),c>o[2]&&(o[2]=c),l>o[3]&&(o[3]=l)}return o}var Kn;(function(r){r.points="points",r.lines="lines",r.polygons="polygons"})(Kn||(Kn={}));function Zi(){return{globalFeatureIds:{value:new Uint32Array(0),size:1},positions:{value:new Float32Array(0),size:2},properties:[],numericProps:{},featureIds:{value:new Uint32Array(0),size:1}}}function ju(r,t,e){let n={polygon:t==="geoarrow.multipolygon"||t==="geoarrow.polygon",point:t==="geoarrow.multipoint"||t==="geoarrow.point",line:t==="geoarrow.multilinestring"||t==="geoarrow.linestring"},i=e?.chunkIndex!==void 0&&e?.chunkIndex>=0?[r.data[e?.chunkIndex]]:r.data,s=[1/0,1/0,-1/0,-1/0],o=e?.chunkOffset||0,a=[];return i.forEach(c=>{let{featureIds:l,flatCoordinateArray:u,nDim:h,geomOffset:d,triangles:b}=jp(c,t,e),M=new Uint32Array(l.length);for(let X=0;X<l.length;X++)M[X]=l[X]+o;let z={globalFeatureIds:{value:M,size:1},positions:{value:u,size:h},featureIds:{value:l,size:1},properties:[...Array(c.length).keys()].map(X=>({index:X+o}))};o+=c.length,a.push({shape:"binary-feature-collection",points:{type:"Point",...Zi(),...n.point?z:{}},lines:{type:"LineString",...Zi(),...n.line?z:{},pathIndices:{value:n.line?d:new Uint16Array(0),size:1}},polygons:{type:"Polygon",...Zi(),...n.polygon?z:{},polygonIndices:{value:n.polygon?d:new Uint16Array(0),size:1},primitivePolygonIndices:{value:n.polygon?d:new Uint16Array(0),size:1},...b?{triangles:{value:b,size:1}}:{}}}),s=Wo(u,h,s)}),{binaryGeometries:a,bounds:s,featureTypes:n,...e?.calculateMeanCenters?{meanCenters:sc(a)}:{}}}function sc(r){let t=[];return r.forEach(e=>{let n=null;e.points&&e.points.positions.value.length>0?n=Kn.points:e.lines&&e.lines.positions.value.length>0?n=Kn.lines:e.polygons&&e.polygons.positions.value.length>0&&(n=Kn.polygons);let i=n?e[n]:null;if(i&&n!==null){let s=i.featureIds.value,o=i.positions.value,a=i.positions.size,c=i.type==="Polygon"?i.primitivePolygonIndices?.value:void 0;Vp(s,o,a,n,c).forEach(u=>{t.push(u)})}}),t}function Vp(r,t,e,n,i){let s=[],o=t.length,a=0,c=0,l=0;for(;a<o;){let u=r[a/e],h=[0,0],d=0;for(;a<o&&r[c]===u;)n===Kn.polygons&&i?.[l]===c?(a+=e,l++):(h[0]+=t[a],h[1]+=t[a+1],a+=e,d++),c+=1;h[0]/=d,h[1]/=d,s.push(h)}return s}function jp(r,t,e){switch(t){case"geoarrow.point":case"geoarrow.multipoint":return Gp(r,t);case"geoarrow.linestring":case"geoarrow.multilinestring":return Wp(r,t);case"geoarrow.polygon":case"geoarrow.multipolygon":return zp(r,t,e);default:throw Error("invalid geoarrow encoding")}}function oc(r,t,e,n){try{let i=0,s=[];for(let a=0;a<r.length-1;a++){let c=r[a],l=r[a+1],u=e.subarray(c*n,l*n),h=[];for(;t[i]<l;)t[i]>c&&h.push(t[i]-c),i++;let d=nc(u,h.length>0?h:void 0,n);if(d.length===0)throw Error("earcut failed e.g. invalid polygon");for(let b=0;b<d.length;b++)s.push(d[b]+c)}let o=new Uint32Array(s.length);for(let a=0;a<s.length;a++)o[a]=s[a];return o}catch{return null}}function zp(r,t,e){let n=t==="geoarrow.multipolygon",i=n?r.children[0]:r,s=i.valueOffsets,o=n?r.valueOffsets.map(st=>s.at(st)||st):r.valueOffsets,a=i.children[0],c=a.children[0],l=c.children[0],u=c.stride,h=a.valueOffsets,d=l.values,b=new Uint16Array(s.length);for(let st=0;st<s.length;st++)b[st]=h[s[st]];let M=d.length/u,z=new Uint32Array(M);for(let st=0;st<o.length-1;st++){let yn=h[o[st]],W=h[o[st+1]];for(let k=yn;k<W;k++)z[k]=st}let X=e?.triangulate?oc(b,h,d,u):null;return{featureIds:z,nDim:u,flatCoordinateArray:d,geomOffset:h,geometryIndicies:b,...e?.triangulate&&X?{triangles:X}:{}}}function Wp(r,t){let e=t==="geoarrow.multilinestring",n=e?r.children[0]:r,i=n.children[0],s=i.children[0],o=i.stride,a=n.valueOffsets,c=s.values,l=new Uint16Array(0),u=c.length/o,h=new Uint32Array(u);if(e){let d=r.valueOffsets;for(let b=0;b<d.length-1;b++){let M=a[d[b]],z=a[d[b+1]];for(let X=M;X<z;X++)h[X]=b}}else for(let d=0;d<r.length;d++){let b=a[d],M=a[d+1];for(let z=b;z<M;z++)h[z]=d}return{featureIds:h,flatCoordinateArray:c,nDim:o,geomOffset:a,geometryIndicies:l}}function Gp(r,t){let e=t==="geoarrow.multipoint",n=e?r.children[0]:r,i=n.children[0],s=n.stride,o=i.values,a=new Uint16Array(0),c=new Int32Array(0),l=o.length/s,u=new Uint32Array(l);if(e){let h=r.valueOffsets;for(let d=0;d<h.length-1;d++){let b=h[d],M=h[d+1];for(let z=b;z<M;z++)u[z]=d}}else for(let h=0;h<r.length;h++)u[h]=h;return{featureIds:u,flatCoordinateArray:o,nDim:s,geomOffset:c,geometryIndicies:a}}var Go="4.2.0-alpha.5";var zu=/[-+]?([0-9]*\.[0-9]+|[0-9]+)([eE][-+]?[0-9]+)?/,Wu=new RegExp("^"+zu.source+"(\\s"+zu.source+"){1,}"),ac=["POINT(","LINESTRING(","POLYGON(","MULTIPOINT(","MULTILINESTRING(","MULTIPOLYGON(","GEOMETRYCOLLECTION("];function Gu(r){return ac.some(t=>r.startsWith(t))}function cc(r,t){return $p(r,t)}function $p(r,t){let e=r.split(";"),n=e.pop(),i=(e.shift()||"").split("=").pop(),o=$u({parts:e,_:n,i:0});return t?.wkt?.crs?Hp(o,i):o}function $u(r){return Yp(r)||Zp(r)||Xp(r)||Kp(r)||Jp(r)||Qp(r)||qp(r)}function Hp(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 Yp(r){if(!ht(/^(POINT(\sz)?)/i,r)||(Wt(r),!ht(/^(\()/,r)))return null;let t=Hu(r);return!t||(Wt(r),!ht(/^(\))/,r))?null:{type:"Point",coordinates:t[0]}}function Kp(r){if(!ht(/^(MULTIPOINT)/i,r))return null;Wt(r);let t=r._?.substring(r._?.indexOf("(")+1,r._.length-1).replace(/\(/g,"").replace(/\)/g,"");r._="MULTIPOINT ("+t+")";let e=$o(r);return e?(Wt(r),{type:"MultiPoint",coordinates:e}):null}function Zp(r){if(!ht(/^(LINESTRING(\sz)?)/i,r)||(Wt(r),!ht(/^(\()/,r)))return null;let t=Hu(r);return!t||!ht(/^(\))/,r)?null:{type:"LineString",coordinates:t}}function Jp(r){if(!ht(/^(MULTILINESTRING)/i,r))return null;Wt(r);let t=$o(r);return t?(Wt(r),{type:"MultiLineString",coordinates:t}):null}function Xp(r){if(!ht(/^(POLYGON(\sz)?)/i,r))return null;Wt(r);let t=$o(r);return t?{type:"Polygon",coordinates:t}:null}function Qp(r){if(!ht(/^(MULTIPOLYGON)/i,r))return null;Wt(r);let t=$o(r);return t?{type:"MultiPolygon",coordinates:t}:null}function qp(r){let t=[],e;if(!ht(/^(GEOMETRYCOLLECTION)/i,r)||(Wt(r),!ht(/^(\()/,r)))return null;for(;e=$u(r);)t.push(e),Wt(r),ht(/^(,)/,r),Wt(r);return ht(/^(\))/,r)?{type:"GeometryCollection",geometries:t}:null}function $o(r){Wt(r);let t=0,e=[],n=[e],i=e,s;for(;s=ht(/^(\()/,r)||ht(/^(\))/,r)||ht(/^(,)/,r)||ht(Wu,r);){if(s==="(")n.push(i),i=[],n[n.length-1].push(i),t++;else if(s===")"){if(i.length===0||(i=n.pop(),!i))return null;if(t--,t===0)break}else if(s===",")i=[],n[n.length-1].push(i);else if(!s.split(/\s/g).some(isNaN))Array.prototype.push.apply(i,s.split(/\s/g).map(parseFloat));else return null;Wt(r)}return t!==0?null:e}function Hu(r){let t=[],e,n;for(;n=ht(Wu,r)||ht(/^(,)/,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))),Wt(r);if(e)t.push(e);else return null;return t.length?t:null}function ht(r,t){let e=t._?.substring(t.i).match(r);return e?(t.i+=e[0].length,e[0]):null}function Wt(r){ht(/^\s*/,r)}var Yu={name:"WKT (Well-Known Text)",id:"wkt",module:"wkt",version:Go,worker:!0,extensions:["wkt"],mimeTypes:["text/plain"],category:"geometry",text:!0,tests:ac,testText:Gu,options:{wkt:{shape:"geojson-geometry",crs:!0}}},lc={...Yu,parse:async(r,t)=>cc(new TextDecoder().decode(r),t),parseTextSync:cc};var vr;(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"})(vr||(vr={}));function Ku(r){let t=new DataView(r),e=0,n=t.getUint8(e);if(e+=1,n>1)return!1;let i=n===1,s=t.getUint32(e,i);e+=4;let o=s&7;if(o===0||o>7)return!1;let a=s-o;if(a===0||a===1e3||a===2e3||a===3e3)return!0;if(a&536870911)return!1;if(a&536870912){let c=t.getUint32(e,i);if(e+=4,c>1e4)return!1}return!0}function Zu(r,t){let e=Object.assign(t||{},{type:"wkb",geometryType:1,dimensions:2,coordinates:"xy",littleEndian:!0,byteOffset:0});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.type="iso-wkb",e.dimensions=3,e.coordinates="xyz";break;case 2:e.type="iso-wkb",e.dimensions=3,e.coordinates="xym";break;case 3:e.type="iso-wkb",e.dimensions=4,e.coordinates="xyzm";break;default:throw new Error(`WKB: Unsupported iso-wkb type: ${i}`)}let s=n&2147483648,o=n&1073741824,a=n&536870912;return s&&o?(e.type="ewkb",e.dimensions=4,e.coordinates="xyzm"):s?(e.type="ewkb",e.dimensions=3,e.coordinates="xyz"):o&&(e.type="ewkb",e.dimensions=3,e.coordinates="xym"),a&&(e.type="ewkb",e.srid=r.getUint32(e.byteOffset,e.littleEndian),e.byteOffset+=4),e}function uc(r,t){let e=tm(r,t),n=t?.wkb?.shape||"binary-geometry";switch(n){case"binary-geometry":return e;case"geojson-geometry":return Yn(e);case"geometry":return console.error('WKBLoader: "geometry" shape is deprecated, use "binary-geometry" instead'),Yn(e);default:throw new Error(n)}}function tm(r,t){let e=new DataView(r),n=Zu(e),{geometryType:i,dimensions:s,littleEndian:o}=n,a=n.byteOffset;switch(i){case vr.Point:return Ju(e,a,s,o).geometry;case vr.LineString:return fc(e,a,s,o).geometry;case vr.Polygon:return Xu(e,a,s,o).geometry;case vr.MultiPoint:let h=em(e,a,s,o);return h.type="Point",h;case vr.MultiLineString:let d=rm(e,a,s,o);return d.type="LineString",d;case vr.MultiPolygon:let b=nm(e,a,s,o);return b.type="Polygon",b;default:throw new Error(`WKB: Unsupported geometry type: ${i}`)}}function Ju(r,t,e,n){let i=new Float64Array(e);for(let s=0;s<e;s++)i[s]=r.getFloat64(t,n),t+=8;return{geometry:{type:"Point",positions:{value:i,size:e}},offset:t}}function fc(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=new Float64Array(i*e);for(let a=0;a<i*e;a++)s[a]=r.getFloat64(t,n),t+=8;let o=[0];return i>0&&o.push(i),{geometry:{type:"LineString",positions:{value:s,size:e},pathIndices:{value:new Uint16Array(o),size:1}},offset:t}}var hc=r=>t=>r+=t;function Xu(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=[];for(let l=0;l<i;l++){let u=fc(r,t,e,n),{positions:h}=u.geometry;t=u.offset,s.push(h.value)}let o=new Float64Array(Ho(s).buffer),a=[0];o.length>0&&a.push(o.length/e);let c=s.map(l=>l.length/e).map(hc(0));return c.unshift(0),{geometry:{type:"Polygon",positions:{value:o,size:e},polygonIndices:{value:new Uint16Array(a),size:1},primitivePolygonIndices:{value:new Uint16Array(c),size:1}},offset:t}}function em(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=[];for(let o=0;o<i;o++){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=Ju(r,t,e,a);t=c.offset,s.push(c.geometry)}return im(s,e)}function rm(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=[];for(let o=0;o<i;o++){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=fc(r,t,e,a);t=c.offset,s.push(c.geometry)}return sm(s,e)}function nm(r,t,e,n){let i=r.getUint32(t,n);t+=4;let s=[];for(let o=0;o<i;o++){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=Xu(r,t,e,a);t=c.offset,s.push(c.geometry)}return om(s,e)}function im(r,t){let e=r.map(i=>i.positions.value);return{type:"Point",positions:{value:new Float64Array(Ho(e).buffer),size:t}}}function sm(r,t){let e=r.map(s=>s.positions.value),n=new Float64Array(Ho(e).buffer),i=e.map(s=>s.length/t).map(hc(0));return i.unshift(0),{type:"LineString",positions:{value:n,size:t},pathIndices:{value:new Uint16Array(i),size:1}}}function om(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(Ho(e).buffer),s=e.map(a=>a.length/t).map(hc(0));s.unshift(0);let o=[0];for(let a of n)o.push(...a.filter(c=>c>0).map(c=>c+o[o.length-1]));return{type:"Polygon",positions:{value:i,size:t},polygonIndices:{value:new Uint32Array(s),size:1},primitivePolygonIndices:{value:new Uint32Array(o),size:1}}}function Ho(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 s=new Uint8Array(r[i].buffer);t=s.length;for(let o=0;o<t;++o)e[n++]=s[o]}return e}var Qu={name:"WKB",id:"wkb",module:"wkt",version:Go,worker:!0,category:"geometry",extensions:["wkb"],mimeTypes:[],tests:[Ku],options:{wkb:{shape:"binary-geometry"}}},dc={...Qu,parse:async r=>uc(r),parseSync:uc};function zo(r,t){if(t=t?.toLowerCase(),!t||!r)return null;let e;switch(t){case"geoarrow.multipolygon":e=lm(r);break;case"geoarrow.polygon":e=um(r);break;case"geoarrow.multipoint":e=fm(r);break;case"geoarrow.point":e=hm(r);break;case"geoarrow.multilinestring":e=dm(r);break;case"geoarrow.linestring":e=pm(r);break;case"geoarrow.wkb":e=am(r);break;case"geoarrow.wkt":e=cm(r);break;default:throw Error(`GeoArrow encoding not supported ${t}`)}return e}function am(r){let t=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength),e=dc.parseSync?.(t);return Yn(e)}function cm(r){let t=r;return lc.parseTextSync?.(t)}function lm(r){let t=[];for(let n=0;n<r.length;n++){let i=r.get(n),s=[];for(let o=0;i&&o<i?.length;o++){let a=i?.get(o),c=[];for(let l=0;a&&l<a.length;l++){let u=a.get(l),h=Array.from(u);c.push(h)}s.push(c)}t.push(s)}return{type:"MultiPolygon",coordinates:t}}function um(r){let t=[];for(let n=0;r&&n<r.length;n++){let i=r.get(n),s=[];for(let o=0;i&&o<i.length;o++){let a=i.get(o),c=Array.from(a);s.push(c)}t.push(s)}return{type:"Polygon",coordinates:t}}function fm(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 hm(r){return{type:"Point",coordinates:Array.from(r)}}function dm(r){let t=[];for(let e=0;r&&e<r.length;e++){let n=r.get(e),i=[];for(let s=0;n&&s<n.length;s++){let o=n.get(s);if(o){let a=Array.from(o);i.push(a)}}t.push(i)}return{type:"MultiLineString",coordinates:t}}function pm(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 Ji(r,t=!1){if("data"in r)return new g(r.data.map(s=>Ji(s,t)));let e=[];for(let s of r.children)e.push(Ji(s,t));let n;r.dictionary!==void 0&&(n=Ji(r.dictionary,t));let i={[lt.OFFSET]:Yo(r.buffers[lt.OFFSET],t),[lt.DATA]:Yo(r.buffers[lt.DATA],t),[lt.VALIDITY]:Yo(r.buffers[lt.VALIDITY],t),[lt.TYPE]:Yo(r.buffers[lt.TYPE],t)};return new R(r.type,r.offset,r.length,r._nullCount,i,e,n)}function mm(r){return!(r.byteOffset===0&&r.byteLength===r.buffer.byteLength)}function Yo(r,t){return r===void 0||!t&&!mm(r)?r:r.slice()}var qu="latest";function ym(){return globalThis._loadersgl_?.version||(globalThis._loadersgl_=globalThis._loadersgl_||{},globalThis._loadersgl_.version="4.2.0-alpha.5"),globalThis._loadersgl_.version}var pc=ym();function sr(r,t){if(!r)throw new Error(t||"loaders.gl assertion failed.")}var or={self:typeof self<"u"&&self,window:typeof window<"u"&&window,global:typeof global<"u"&&global,document:typeof document<"u"&&document},aA=or.self||or.window||or.global||{},cA=or.window||or.self||or.global||{},lA=or.global||or.self||or.window||{},uA=or.document||{};var Ir=typeof process!="object"||String(process)!=="[object process]"||process.browser;var ef=typeof window<"u"&&typeof window.orientation<"u",tf=typeof process<"u"&&process.version&&/v([0-9]*)/.exec(process.version),fA=tf&&parseFloat(tf[1])||0;var Xi=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){sr(this.isRunning),this.isRunning=!1,this._resolve(t)}error(t){sr(this.isRunning),this.isRunning=!1,this._reject(t)}};var Zn=class{terminate(){}};var mc=new Map;function rf(r){sr(r.source&&!r.url||!r.source&&r.url);let t=mc.get(r.source||r.url);return t||(r.url&&(t=gm(r.url),mc.set(r.url,t)),r.source&&(t=nf(r.source),mc.set(r.source,t))),sr(t),t}function gm(r){if(!r.startsWith("http"))return r;let t=bm(r);return nf(t)}function nf(r){let t=new Blob([r],{type:"application/javascript"});return URL.createObjectURL(t)}function bm(r){return`try {
17
17
  importScripts('${r}');
18
18
  } catch (error) {
19
19
  console.error(error);
20
20
  throw error;
21
- }`}function dc(r,t=!0,e){let n=e||new Set;if(r){if(ef(r))n.add(r);else if(ef(r.buffer))n.add(r.buffer);else if(!ArrayBuffer.isView(r)){if(t&&typeof r=="object")for(let i in r)dc(r[i],t,n)}}return e===void 0?Array.from(n):[]}function ef(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 pc(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]=pc(r[e]):typeof t[e]=="function"||t[e]instanceof RegExp?t[e]={}:t[e]=r[e]}),t}var mc=()=>{},Rr=class{static isSupported(){return typeof Worker<"u"&&xr||typeof Zn<"u"&&!xr}constructor(t){this.terminated=!1,this._loadableURL="";let{name:e,source:n,url:i}=t;or(n||i),this.name=e,this.source=n,this.url=i,this.onMessage=mc,this.onError=s=>console.log(s),this.worker=xr?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=mc,this.onError=mc,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,e){e=e||dc(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=qu({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}`;t=new Zn(n,{eval:!1})}else if(this.source)t=new Zn(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 Ji=class{static isSupported(){return Rr.isSupported()}constructor(t){this.name="unnamed",this.maxConcurrency=1,this.maxMobileConcurrency=1,this.onDebug=()=>{},this.reuseWorkers=!0,this.props={},this.jobQueue=[],this.idleQueue=[],this.count=0,this.isDestroyed=!1,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,s,o)=>i.done(o),n=(i,s)=>i.error(s)){let i=new Promise(s=>(this.jobQueue.push({name:t,onMessage:e,onError:n,onStart:s}),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 Zi(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){!xr||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 Rr({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return Qu?this.maxMobileConcurrency:this.maxConcurrency}};var mm={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},Pe=class{static isSupported(){return Rr.isSupported()}static getWorkerFarm(t={}){return Pe._workerFarm=Pe._workerFarm||new Pe({}),Pe._workerFarm.setProps(t),Pe._workerFarm}constructor(t){this.workerPools=new Map,this.props={...mm},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,s=this.workerPools.get(e);return s||(s=new Ji({name:e,source:n,url:i}),s.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,s)),s}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}};function rf(r){let t=r.version!==fc?` (worker-utils@${fc})`:"";return`${r.name}@${r.version}${t}`}function nf(r,t={}){let e=t[r.id]||{},n=xr?`${r.id}-worker.js`:`${r.id}-worker-node.js`,i=e.workerUrl;if(!i&&r.id==="compression"&&(i=t.workerUrl),t._workerType==="test"&&(xr?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=Ju);let o=s?`@${s}`:"";i=`https://unpkg.com/@loaders.gl/${r.module}${o}/dist/${n}`}return or(i),i}async function $o(r,t,e={},n={}){let i=rf(r),s=Pe.getWorkerFarm(e),{source:o}=e,a={name:i,source:o};o||(a.url=nf(r,e));let c=s.getWorkerPool(a),l=e.jobName||r.name,u=await c.startJob(l,ym.bind(null,n)),h=pc(e);return u.postMessage("process",{input:t,options:h}),(await u.result).result}async function ym(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:s,options:o}=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(s,o);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}`)}}var gm="4.2.0-alpha.4",Ho={id:"triangulation",name:"Triangulate",module:"arrow",version:gm,options:{}};function sf(r,t={}){return $o(Ho,{...r,operation:"triangulate"},t)}function of(r,t={}){return $o(Ho,{...r,operation:"parse-geoarrow"},t)}Br.ArrowBatch=Do;return pf(Xi);})();
21
+ }`}function yc(r,t=!0,e){let n=e||new Set;if(r){if(sf(r))n.add(r);else if(sf(r.buffer))n.add(r.buffer);else if(!ArrayBuffer.isView(r)){if(t&&typeof r=="object")for(let i in r)yc(r[i],t,n)}}return e===void 0?Array.from(n):[]}function sf(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 gc(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]=gc(r[e]):typeof t[e]=="function"||t[e]instanceof RegExp?t[e]={}:t[e]=r[e]}),t}var bc=()=>{},Ur=class{name;source;url;terminated=!1;worker;onMessage;onError;_loadableURL="";static isSupported(){return typeof Worker<"u"&&Ir||typeof Zn<"u"&&!Ir}constructor(t){let{name:e,source:n,url:i}=t;sr(n||i),this.name=e,this.source=n,this.url=i,this.onMessage=bc,this.onError=s=>console.log(s),this.worker=Ir?this._createBrowserWorker():this._createNodeWorker()}destroy(){this.onMessage=bc,this.onError=bc,this.worker.terminate(),this.terminated=!0}get isRunning(){return Boolean(this.onMessage)}postMessage(t,e){e=e||yc(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=rf({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}`;t=new Zn(n,{eval:!1})}else if(this.source)t=new Zn(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 Qi=class{name="unnamed";source;url;maxConcurrency=1;maxMobileConcurrency=1;onDebug=()=>{};reuseWorkers=!0;props={};jobQueue=[];idleQueue=[];count=0;isDestroyed=!1;static isSupported(){return Ur.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,s,o)=>i.done(o),n=(i,s)=>i.error(s)){let i=new Promise(s=>(this.jobQueue.push({name:t,onMessage:e,onError:n,onStart:s}),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 Xi(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){!Ir||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 Ur({name:t,source:this.source,url:this.url})}return null}_getMaxConcurrency(){return ef?this.maxMobileConcurrency:this.maxConcurrency}};var wm={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:!0,onDebug:()=>{}},mn=class{props;workerPools=new Map;static isSupported(){return Ur.isSupported()}static getWorkerFarm(t={}){return mn._workerFarm=mn._workerFarm||new mn({}),mn._workerFarm.setProps(t),mn._workerFarm}constructor(t){this.props={...wm},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,s=this.workerPools.get(e);return s||(s=new Qi({name:e,source:n,url:i}),s.setProps(this._getWorkerPoolProps()),this.workerPools.set(e,s)),s}_getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug}}},Jn=mn;rs(Jn,"_workerFarm");function of(r){let t=r.version!==pc?` (worker-utils@${pc})`:"";return`${r.name}@${r.version}${t}`}function af(r,t={}){let e=t[r.id]||{},n=Ir?`${r.id}-worker.js`:`${r.id}-worker-node.js`,i=e.workerUrl;if(!i&&r.id==="compression"&&(i=t.workerUrl),t._workerType==="test"&&(Ir?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=qu);let o=s?`@${s}`:"";i=`https://unpkg.com/@loaders.gl/${r.module}${o}/dist/${n}`}return sr(i),i}async function Ko(r,t,e={},n={}){let i=of(r),s=Jn.getWorkerFarm(e),{source:o}=e,a={name:i,source:o};o||(a.url=af(r,e));let c=s.getWorkerPool(a),l=e.jobName||r.name,u=await c.startJob(l,_m.bind(null,n)),h=gc(e);return u.postMessage("process",{input:t,options:h}),(await u.result).result}async function _m(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:s,options:o}=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(s,o);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}`)}}var vm="4.2.0-alpha.5",Zo={id:"triangulation",name:"Triangulate",module:"arrow",version:vm,options:{}};function cf(r,t={}){return Ko(Zo,{...r,operation:"triangulate"},t)}function lf(r,t={}){return Ko(Zo,{...r,operation:"parse-geoarrow"},t)}gn.ArrowBatch=Mo;return bf(qi);})();
22
22
  return __exports__;
23
23
  });