@oceanum/datamesh 0.6.3 → 0.7.2
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/index.cjs +5 -5
- package/dist/index.js +2025 -1967
- package/dist/lib/connector.d.ts.map +1 -1
- package/dist/lib/datamodel.d.ts +1 -1
- package/dist/lib/observe.d.ts +2 -1
- package/dist/lib/observe.d.ts.map +1 -1
- package/dist/lib/session.d.ts +3 -0
- package/dist/lib/session.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class Fr extends Error{constructor(t,e={}){super(`Node not found: ${t}`,e),this.name="NodeNotFoundError"}}class bi extends Error{constructor(t){super(`Missing key: ${t}`),this.name="KeyError"}}class $n{#t;constructor(t,e,n){typeof t=="number"?this.#t=new Uint8Array(t):t instanceof ArrayBuffer?this.#t=new Uint8Array(t,e,n):this.#t=new Uint8Array(Array.from(t,s=>s?1:0))}get BYTES_PER_ELEMENT(){return 1}get byteOffset(){return this.#t.byteOffset}get byteLength(){return this.#t.byteLength}get buffer(){return this.#t.buffer}get length(){return this.#t.length}get(t){let e=this.#t[t];return typeof e=="number"?e!==0:e}set(t,e){this.#t[t]=e?1:0}fill(t){this.#t.fill(t?1:0)}*[Symbol.iterator](){for(let t=0;t<this.length;t++)yield this.get(t)}}class ds{_data;chars;#t;constructor(t,e,n,s){if(this.chars=t,this.#t=new TextEncoder,typeof e=="number")this._data=new Uint8Array(e*t);else if(e instanceof ArrayBuffer)s&&(s=s*t),this._data=new Uint8Array(e,n,s);else{let i=Array.from(e);this._data=new Uint8Array(i.length*t);for(let a=0;a<i.length;a++)this.set(a,i[a])}}get BYTES_PER_ELEMENT(){return this.chars}get byteOffset(){return this._data.byteOffset}get byteLength(){return this._data.byteLength}get buffer(){return this._data.buffer}get length(){return this.byteLength/this.BYTES_PER_ELEMENT}get(t){const e=new Uint8Array(this.buffer,this.byteOffset+this.chars*t,this.chars);return new TextDecoder().decode(e).replace(/\x00/g,"")}set(t,e){const n=new Uint8Array(this.buffer,this.byteOffset+this.chars*t,this.chars);n.fill(0),n.set(this.#t.encode(e))}fill(t){const e=this.#t.encode(t);for(let n=0;n<this.length;n++)this._data.set(e,n*this.chars)}*[Symbol.iterator](){for(let t=0;t<this.length;t++)yield this.get(t)}}class yn{#t;chars;constructor(t,e,n,s){if(this.chars=t,typeof e=="number")this.#t=new Int32Array(e*t);else if(e instanceof ArrayBuffer)s&&(s*=t),this.#t=new Int32Array(e,n,s);else{const i=e,a=new yn(t,1);this.#t=new Int32Array(function*(){for(let c of i)a.set(0,c),yield*a.#t}())}}get BYTES_PER_ELEMENT(){return this.#t.BYTES_PER_ELEMENT*this.chars}get byteLength(){return this.#t.byteLength}get byteOffset(){return this.#t.byteOffset}get buffer(){return this.#t.buffer}get length(){return this.#t.length/this.chars}get(t){const e=this.chars*t;let n="";for(let s=0;s<this.chars;s++)n+=String.fromCodePoint(this.#t[e+s]);return n.replace(/\u0000/g,"")}set(t,e){const n=this.chars*t,s=this.#t.subarray(n,n+this.chars);s.fill(0);for(let i=0;i<this.chars;i++)s[i]=e.codePointAt(i)??0}fill(t){this.set(0,t);let e=this.#t.subarray(0,this.chars);for(let n=1;n<this.length;n++)this.#t.set(e,n*this.chars)}*[Symbol.iterator](){for(let t=0;t<this.length;t++)yield this.get(t)}}function fs(r){const t=JSON.stringify(r,null,2);return new TextEncoder().encode(t)}function rr(r){const t=new TextDecoder().decode(r);return JSON.parse(t)}function qs(r,t){const e=t/2,n=t-1;let s=0;for(let i=0;i<r.length;i+=t)for(let a=0;a<e;a+=1)s=r[i+a],r[i+a]=r[i+n-a],r[i+n-a]=s}const $u={int8:Int8Array,int16:Int16Array,int32:Int32Array,int64:globalThis.BigInt64Array,uint8:Uint8Array,uint16:Uint16Array,uint32:Uint32Array,uint64:globalThis.BigUint64Array,float32:Float32Array,float64:Float64Array,bool:$n},zu=/v2:([US])(\d+)/;function la(r){if(r==="v2:object")return globalThis.Array;let t=r.match(zu);if(t){let[,n,s]=t;return(n==="U"?yn:ds).bind(null,Number(s))}let e=$u[r];return Yt(e,`Unknown or unsupported data_type: ${r}`),e}function tr(r,t){const e=r.length;typeof t=="string"&&(t=t==="C"?Array.from({length:e},(i,a)=>a):Array.from({length:e},(i,a)=>e-1-a)),Yt(e===t.length,"Order length must match the number of dimensions.");let n=1,s=new Array(e);for(let i=t.length-1;i>=0;i--)s[t[i]]=n,n*=r[t[i]];return s}function ju({name:r,configuration:t}){if(r==="default"){const e=t?.separator??"/";return n=>["c",...n].join(e)}if(r==="v2"){const e=t?.separator??".";return n=>n.join(e)||"0"}throw new Error(`Unknown chunk key encoding: ${r}`)}function Vu(r){if(r==="|O")return{data_type:"v2:object"};let t=r.match(/^([<|>])(.*)$/);Yt(t,`Invalid dtype: ${r}`);let[,e,n]=t,s={b1:"bool",i1:"int8",u1:"uint8",i2:"int16",u2:"uint16",i4:"int32",u4:"uint32",i8:"int64",u8:"uint64",f4:"float32",f8:"float64"}[n]??(n.startsWith("S")||n.startsWith("U")?`v2:${n}`:void 0);return Yt(s,`Unsupported or unknown dtype: ${r}`),e==="|"?{data_type:s}:{data_type:s,endian:e==="<"?"little":"big"}}function Wu(r,t={}){let e=[],n=Vu(r.dtype);r.order==="F"&&e.push({name:"transpose",configuration:{order:"F"}}),"endian"in n&&n.endian==="big"&&e.push({name:"bytes",configuration:{endian:"big"}});for(let{id:s,...i}of r.filters??[])e.push({name:s,configuration:i});if(r.compressor){let{id:s,...i}=r.compressor;e.push({name:s,configuration:i})}return{zarr_format:3,node_type:"array",shape:r.shape,data_type:n.data_type,chunk_grid:{name:"regular",configuration:{chunk_shape:r.chunks}},chunk_key_encoding:{name:"v2",configuration:{separator:r.dimension_separator??"."}},codecs:e,fill_value:r.fill_value,attributes:t}}function Zu(r,t={}){return{zarr_format:3,node_type:"group",attributes:t}}function Gu(r,t){if(t!=="number"&&t!=="bigint"&&t!=="boolean"&&t!=="object"&&t!=="string")return r===t;let e=r==="bool";if(t==="boolean")return e;let n=r.startsWith("v2:U")||r.startsWith("v2:S");if(t==="string")return n;let s=r==="int64"||r==="uint64";if(t==="bigint")return s;let i=r==="v2:object";return t==="object"?i:!n&&!s&&!e&&!i}function Yu(r){return r?.name==="sharding_indexed"}function da(r){return(r.data_type==="uint64"||r.data_type==="int64")&&r.fill_value!=null?BigInt(r.fill_value):r.fill_value}function fa(r,...t){if(!t.some(e=>r instanceof e))throw r}function Yt(r,t=""){if(!r)throw new Error(t)}class ps{kind="array_to_array";constructor(t,e){Yt(t.keepbits>=0,"keepbits must be zero or positive")}static fromConfig(t,e){return new ps(t,e)}encode(t){throw new Error("`BitroundCodec.encode` is not implemented. Please open an issue at https://github.com/manzt/zarrita.js/issues.")}decode(t){return t}}const Ks=Ju();function Ju(){const r=new Uint32Array([305419896]);return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)[0]!==18}function Xs(r){return"BYTES_PER_ELEMENT"in r?r.BYTES_PER_ELEMENT:4}class _i{kind="array_to_bytes";#t;#e;#n;#i;#r;constructor(t,e){this.#r=t?.endian,this.#e=la(e.data_type),this.#i=e.shape,this.#t=tr(e.shape,"C");const n=new this.#e(0);this.#n=n.BYTES_PER_ELEMENT}static fromConfig(t,e){return new _i(t,e)}encode(t){let e=new Uint8Array(t.data.buffer);return Ks&&this.#r==="big"&&qs(e,Xs(this.#e)),e}decode(t){return Ks&&this.#r==="big"&&qs(t,Xs(this.#e)),{data:new this.#e(t.buffer,t.byteOffset,t.byteLength/this.#n),shape:this.#i,stride:this.#t}}}class ys{kind="bytes_to_bytes";static fromConfig(){return new ys}encode(t){throw new Error("Not implemented")}decode(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength-4)}}function Hu(r,t){return Yt(!Number.isNaN(t),"JsonCodec allow_nan is false but NaN was encountered during encoding."),Yt(t!==Number.POSITIVE_INFINITY,"JsonCodec allow_nan is false but Infinity was encountered during encoding."),Yt(t!==Number.NEGATIVE_INFINITY,"JsonCodec allow_nan is false but -Infinity was encountered during encoding."),t}function qu(r,t){return t instanceof Object&&!Array.isArray(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t}class gs{configuration;kind="array_to_bytes";#t;#e;constructor(t={}){this.configuration=t;const{encoding:e="utf-8",skipkeys:n=!1,ensure_ascii:s=!0,check_circular:i=!0,allow_nan:a=!0,sort_keys:c=!0,indent:d,strict:f=!0}=t;let y=t.separators;y||(d?y=[", ",": "]:y=[",",":"]),this.#t={encoding:e,skipkeys:n,ensure_ascii:s,check_circular:i,allow_nan:a,indent:d,separators:y,sort_keys:c},this.#e={strict:f}}static fromConfig(t){return new gs(t)}encode(t){const{indent:e,encoding:n,ensure_ascii:s,check_circular:i,allow_nan:a,sort_keys:c}=this.#t;Yt(n==="utf-8","JsonCodec does not yet support non-utf-8 encoding.");const d=[];Yt(i,"JsonCodec does not yet support skipping the check for circular references during encoding."),a||d.push(Hu),c&&d.push(qu);const f=Array.from(t.data);f.push("|O"),f.push(t.shape);let y;d.length&&(y=(L,x)=>{let M=x;for(let U of d)M=U(L,M);return M});let B=JSON.stringify(f,y,e);return s&&(B=B.replace(/[\u007F-\uFFFF]/g,L=>{const x=`0000${L.charCodeAt(0).toString(16)}`;return`\\u${x.substring(x.length-4)}`})),new TextEncoder().encode(B)}decode(t){const{strict:e}=this.#e;Yt(e,"JsonCodec does not yet support non-strict decoding.");const n=rr(t),s=n.pop();n.pop(),Yt(s,"0D not implemented for JsonCodec.");const i=tr(s,"C");return{data:n,shape:s,stride:i}}}const ms={};function Qs(r){return r instanceof $n||r instanceof ds||r instanceof yn?new Proxy(r,{get(e,n){return e.get(Number(n))},set(e,n,s){return e.set(Number(n),s),!0}}):r}function Ku(r,t){let e;return r.data instanceof ds||r.data instanceof yn?e=new r.constructor(r.data.length,r.data.chars):e=new r.constructor(r.data.length),{data:e,shape:r.shape,stride:tr(r.shape,t)}}function Xu(r,t){let e=Ku(r,t),n=r.shape.length,s=r.data.length,i=Array(n).fill(0),a=Qs(r.data),c=Qs(e.data);for(let d=0;d<s;d++){let f=0;for(let y=0;y<n;y++)f+=i[y]*e.stride[y];c[f]=a[d],i[0]+=1;for(let y=0;y<n;y++)if(i[y]===r.shape[y]){if(y+1===n)break;i[y]=0,i[y+1]+=1}}return e}function Qu(r){let t=r.shape.length;return ms(t===r.stride.length,"Shape and stride must have the same length."),r.stride.map((e,n)=>({stride:e,index:n})).sort((e,n)=>n.stride-e.stride).map(e=>e.index)}function th(r,t){let e=Qu(r);return ms(e.length===t.length,"Orders must match"),e.every((n,s)=>n===t[s])}class ws{kind="array_to_array";#t;#e;constructor(t,e){let n=t.order??"C",s=e.shape.length,i=new Array(s),a=new Array(s);if(n==="C")for(let c=0;c<s;++c)i[c]=c,a[c]=c;else if(n==="F")for(let c=0;c<s;++c)i[c]=s-c-1,a[c]=s-c-1;else i=n,i.forEach((c,d)=>{ms(a[c]===void 0,`Invalid permutation: ${JSON.stringify(n)}`),a[c]=d});this.#t=i,this.#e=a}static fromConfig(t,e){return new ws(t,e)}encode(t){return th(t,this.#e)?t:Xu(t,this.#e)}decode(t){return{data:t.data,shape:t.shape,stride:tr(t.shape,this.#t)}}}class bs{kind="array_to_bytes";#t;#e;constructor(t){this.#t=t,this.#e=tr(t,"C")}static fromConfig(t,e){return new bs(e.shape)}encode(t){throw new Error("Method not implemented.")}decode(t){let e=new TextDecoder,n=new DataView(t.buffer),s=Array(n.getUint32(0,!0)),i=4;for(let a=0;a<s.length;a++){let c=n.getUint32(i,!0);i+=4,s[a]=e.decode(t.buffer.slice(i,i+c)),i+=c}return{data:s,shape:this.#t,stride:this.#e}}}function eh(){return new Map().set("blosc",()=>Promise.resolve().then(()=>require("./blosc-XU68L2JO.cjs")).then(r=>r.default)).set("gzip",()=>Promise.resolve().then(()=>require("./gzip-9a4q5uuM.cjs")).then(r=>r.default)).set("lz4",()=>Promise.resolve().then(()=>require("./lz4-DyL8MHib.cjs")).then(r=>r.default)).set("zlib",()=>Promise.resolve().then(()=>require("./zlib-BviSziX3.cjs")).then(r=>r.default)).set("zstd",()=>Promise.resolve().then(()=>require("./zstd-BJg46wpa.cjs")).then(r=>r.default)).set("transpose",()=>ws).set("bytes",()=>_i).set("crc32c",()=>ys).set("vlen-utf8",()=>bs).set("json2",()=>gs).set("bitround",()=>ps)}const pa=eh();function Ji(r){let t;return{async encode(e){t||(t=await to(r));for(const s of t.array_to_array)e=await s.encode(e);let n=await t.array_to_bytes.encode(e);for(const s of t.bytes_to_bytes)n=await s.encode(n);return n},async decode(e){t||(t=await to(r));for(let s=t.bytes_to_bytes.length-1;s>=0;s--)e=await t.bytes_to_bytes[s].decode(e);let n=await t.array_to_bytes.decode(e);for(let s=t.array_to_array.length-1;s>=0;s--)n=await t.array_to_array[s].decode(n);return n}}}async function to(r){let t=r.codecs.map(async i=>{let a=await pa.get(i.name)?.();return Yt(a,`Unknown codec: ${i.name}`),{Codec:a,meta:i}}),e=[],n,s=[];for await(let{Codec:i,meta:a}of t){let c=i.fromConfig(a.configuration,r);switch(c.kind){case"array_to_array":e.push(c);break;case"array_to_bytes":n=c;break;default:s.push(c)}}return n||(Yt(rh(r),`Cannot encode ${r.data_type} to bytes without a codec`),n=_i.fromConfig({endian:"little"},r)),{array_to_array:e,array_to_bytes:n,bytes_to_bytes:s}}function rh(r){return r.data_type!=="v2:object"}const eo=18446744073709551615n;function nh(r,t,e,n){Yt(r.store.getRange,"Store does not support range requests");let s=r.store.getRange.bind(r.store),i=t.map((d,f)=>d/n.chunk_shape[f]),a=Ji({data_type:"uint64",shape:[...i,2],codecs:n.index_codecs}),c={};return async d=>{let f=d.map((C,P)=>Math.floor(C/i[P])),y=r.resolve(e(f)).path,B;if(y in c)B=c[y];else{let C=4,P=16*i.reduce((G,A)=>G*A,1),V=await s(y,{suffixLength:P+C});B=c[y]=V?await a.decode(V):null}if(B===null)return;let{data:L,shape:x,stride:M}=B,U=d.map((C,P)=>C%x[P]).reduce((C,P,V)=>C+P*M[V],0),F=L[U],O=L[U+1];if(!(F===eo&&O===eo))return s(y,{offset:Number(F),length:Number(O)})}}class nr{store;path;constructor(t,e="/"){this.store=t,this.path=e}resolve(t){let e=new URL(`file://${this.path.endsWith("/")?this.path:`${this.path}/`}`);return new nr(this.store,new URL(t,e).pathname)}}class Si extends nr{kind="group";#t;constructor(t,e,n){super(t,e),this.#t=n}get attrs(){return this.#t.attributes}}function ro(r){return r.find(e=>e.name==="transpose")?.configuration?.order??"C"}const Kr=Symbol("zarrita.context");function ya(r){return r[Kr]}function ih(r,t){let{configuration:e}=t.codecs.find(Yu)??{},n={encode_chunk_key:ju(t.chunk_key_encoding),TypedArray:la(t.data_type),fill_value:t.fill_value};if(e){let i=ro(e.codecs);return{...n,kind:"sharded",chunk_shape:e.chunk_shape,codec:Ji({data_type:t.data_type,shape:e.chunk_shape,codecs:e.codecs}),get_strides(a,c){return tr(a,c??i)},get_chunk_bytes:nh(r,t.chunk_grid.configuration.chunk_shape,n.encode_chunk_key,e)}}let s=ro(t.codecs);return{...n,kind:"regular",chunk_shape:t.chunk_grid.configuration.chunk_shape,codec:Ji({data_type:t.data_type,shape:t.chunk_grid.configuration.chunk_shape,codecs:t.codecs}),get_strides(i,a){return tr(i,a??s)},async get_chunk_bytes(i,a){let c=n.encode_chunk_key(i),d=r.resolve(c).path;return r.store.get(d,a)}}}let vr=class extends nr{kind="array";#t;[Kr];constructor(t,e,n){super(t,e),this.#t={...n,fill_value:da(n)},this[Kr]=ih(this,n)}get attrs(){return this.#t.attributes}get shape(){return this.#t.shape}get chunks(){return this[Kr].chunk_shape}get dtype(){return this.#t.data_type}async getChunk(t,e){let n=this[Kr],s=await n.get_chunk_bytes(t,e);if(!s){let i=n.chunk_shape.reduce((c,d)=>c*d,1),a=new n.TypedArray(i);return a.fill(n.fill_value),{data:a,shape:n.chunk_shape,stride:n.get_strides(n.chunk_shape)}}return n.codec.decode(s)}is(t){return Gu(this.dtype,t)}},Ii=sh();function sh(){let r=new WeakMap;function t(e){let n=r.get(e)??{v2:0,v3:0};return r.set(e,n),n}return{increment(e,n){t(e)[n]+=1},version_max(e){let n=t(e);return n.v3>n.v2?"v3":"v2"}}}async function oh(r){let t=await r.store.get(r.resolve(".zattrs").path);return t?rr(t):{}}async function ah(r,t={}){let e="store"in r?r:new nr(r),n={};return(t.attrs??!0)&&(n=await oh(e)),t.kind==="array"?no(e,n):t.kind==="group"?io(e,n):no(e,n).catch(s=>(fa(s,Fr),io(e,n)))}async function no(r,t){let{path:e}=r.resolve(".zarray"),n=await r.store.get(e);if(!n)throw new Fr("v2 array",{cause:new bi(e)});return Ii.increment(r.store,"v2"),new vr(r.store,r.path,Wu(rr(n),t))}async function io(r,t){let{path:e}=r.resolve(".zgroup"),n=await r.store.get(e);if(!n)throw new Fr("v2 group",{cause:new bi(e)});return Ii.increment(r.store,"v2"),new Si(r.store,r.path,Zu(rr(n),t))}async function ch(r){let{store:t,path:e}=r.resolve("zarr.json"),n=await r.store.get(e);if(!n)throw new Fr("v3 array or group",{cause:new bi(e)});let s=rr(n);return s.node_type==="array"&&(s.fill_value=da(s)),s.node_type==="array"?new vr(t,r.path,s):new Si(t,r.path,s)}async function uh(r,t={}){let e="store"in r?r:new nr(r),n=await ch(e);if(Ii.increment(e.store,"v3"),t.kind===void 0||t.kind==="array"&&n instanceof vr||t.kind==="group"&&n instanceof Si)return n;let s=n instanceof vr?"array":"group";throw new Error(`Expected node of kind ${t.kind}, found ${s}.`)}async function Ge(r,t={}){let e="store"in r?r.store:r,n=Ii.version_max(e),s=n==="v2"?Ge.v2:Ge.v3,i=n==="v2"?Ge.v3:Ge.v2;return s(r,t).catch(a=>(fa(a,Fr),i(r,t)))}Ge.v2=ah;Ge.v3=uh;async function _n(r,t={}){let e="store"in r?r:new nr(r);return"shape"in t?await lh(e,t):hh(e,t)}async function hh(r,t={}){let e={zarr_format:3,node_type:"group",attributes:t.attributes??{}};return await r.store.set(r.resolve("zarr.json").path,fs(e)),new Si(r.store,r.path,e)}async function lh(r,t){let e={zarr_format:3,node_type:"array",shape:t.shape,data_type:t.data_type,chunk_grid:{name:"regular",configuration:{chunk_shape:t.chunk_shape}},chunk_key_encoding:{name:"default",configuration:{separator:t.chunk_separator??"/"}},codecs:t.codecs??[],fill_value:t.fill_value??null,attributes:t.attributes??{}};return await r.store.set(r.resolve("zarr.json").path,fs(e)),new vr(r.store,r.path,e)}async function dh(r){let t=await r.get("/.zmetadata");if(!t)throw new Fr("v2 consolidated metadata",{cause:new bi("/.zmetadata")});let e=rr(t);return Yt(e.zarr_consolidated_format===1,"Unsupported consolidated format."),e}function fh(r){return r.endsWith(".zarray")||r.endsWith(".zgroup")||r.endsWith(".zattrs")||r.endsWith("zarr.json")}function ph(r){return"zarr_format"in r&&r.zarr_format===3}async function yh(r){let t=await dh(r),e={};for(let[n,s]of Object.entries(t.metadata))e[`/${n}`]=s;return{async get(...n){let[s,i]=n;if(e[s])return fs(e[s]);let a=await r.get(s,i);if(fh(s)&&a){let c=rr(a);e[s]=c}return a},getRange:r.getRange?.bind(r),contents(){let n=[];for(let[s,i]of Object.entries(e)){let a=s.split("/"),c=a.pop(),d=a.join("/")||"/";c===".zarray"&&n.push({path:d,kind:"array"}),c===".zgroup"&&n.push({path:d,kind:"group"}),ph(i)&&n.push({path:d,kind:i.node_type})}return n}}}function*gh(r,t,e=1){t===void 0&&(t=r,r=0);for(let n=r;n<t;n+=e)yield n}function*mh(...r){if(r.length===0)return;const t=r.map(n=>n[Symbol.iterator]()),e=t.map(n=>n.next());if(e.some(n=>n.done))throw new Error("Input contains an empty iterator.");for(let n=0;;){if(e[n].done){if(t[n]=r[n][Symbol.iterator](),e[n]=t[n].next(),++n>=t.length)return}else yield e.map(({value:s})=>s),n=0;e[n]=t[n].next()}}function wh({start:r,stop:t,step:e},n){if(e===0)throw new Error("slice step cannot be zero");e=e??1;const s=e<0,[i,a]=s?[-1,n-1]:[0,n];return r===null?r=s?a:i:r<0?(r+=n,r<i&&(r=i)):r>a&&(r=a),t===null?t=s?i:a:t<0?(t+=n,t<i&&(t=i)):t>a&&(t=a),[r,t,e]}function Hi(r,t,e=null){return t===void 0&&(t=r,r=null),{start:r,stop:t,step:e}}function ga(){const r=[];return{add:t=>r.push(t()),onIdle:()=>Promise.all(r)}}class _s extends Error{constructor(t){super(t),this.name="IndexError"}}function bh(r,t){throw new _s(`too many indicies for array; expected ${t.length}, got ${r.length}`)}function _h(r){throw new _s(`index out of bounds for dimension with length ${r}`)}function Sh(){throw new _s("only slices with step >= 1 are supported")}function Ih(r,t){r.length>t.length&&bh(r,t)}function Bh(r,t){return r=Math.trunc(r),r<0&&(r=t+r),(r>=t||r<0)&&_h(t),r}class vh{dim_sel;dim_len;dim_chunk_len;nitems;constructor({dim_sel:t,dim_len:e,dim_chunk_len:n}){t=Bh(t,e),this.dim_sel=t,this.dim_len=e,this.dim_chunk_len=n,this.nitems=1}*[Symbol.iterator](){const t=Math.floor(this.dim_sel/this.dim_chunk_len),e=t*this.dim_chunk_len,n=this.dim_sel-e;yield{dim_chunk_ix:t,dim_chunk_sel:n}}}class so{start;stop;step;dim_len;dim_chunk_len;nitems;nchunks;constructor({dim_sel:t,dim_len:e,dim_chunk_len:n}){const[s,i,a]=wh(t,e);this.start=s,this.stop=i,this.step=a,this.step<1&&Sh(),this.dim_len=e,this.dim_chunk_len=n,this.nitems=Math.max(0,Math.ceil((this.stop-this.start)/this.step)),this.nchunks=Math.ceil(this.dim_len/this.dim_chunk_len)}*[Symbol.iterator](){const t=Math.floor(this.start/this.dim_chunk_len),e=Math.ceil(this.stop/this.dim_chunk_len);for(const n of gh(t,e)){const s=n*this.dim_chunk_len,i=Math.min(this.dim_len,(n+1)*this.dim_chunk_len),a=i-s;let c=0,d=0;if(this.start<s){const x=(s-this.start)%this.step;x&&(d+=this.step-x),c=Math.ceil((s-this.start)/this.step)}else d=this.start-s;const f=this.stop>i?a:this.stop-s,y=[d,f,this.step],B=Math.ceil((f-d)/this.step),L=[c,c+B,1];yield{dim_chunk_ix:n,dim_chunk_sel:y,dim_out_sel:L}}}}function xh(r,t){let e=[];return r===null?e=t.map(n=>Hi(null)):Array.isArray(r)&&(e=r.map(n=>n??Hi(null))),Ih(e,t),e}class ma{dim_indexers;shape;constructor({selection:t,shape:e,chunk_shape:n}){this.dim_indexers=xh(t,e).map((s,i)=>new(typeof s=="number"?vh:so)({dim_sel:s,dim_len:e[i],dim_chunk_len:n[i]})),this.shape=this.dim_indexers.filter(s=>s instanceof so).map(s=>s.nitems)}*[Symbol.iterator](){for(const t of mh(...this.dim_indexers)){const e=t.map(s=>s.dim_chunk_ix),n=t.map(s=>"dim_out_sel"in s?{from:s.dim_chunk_sel,to:s.dim_out_sel}:{from:s.dim_chunk_sel,to:null});yield{chunk_coords:e,mapping:n}}}}function Ah(r,t){return"get"in r?r.get(t):r[t]}async function Eh(r,t,e,n){let s=ya(r),i=new ma({selection:t,shape:r.shape,chunk_shape:r.chunks}),a=n.prepare(new s.TypedArray(i.shape.reduce((d,f)=>d*f,1)),i.shape,s.get_strides(i.shape,e.order)),c=e.create_queue?.()??ga();for(const{chunk_coords:d,mapping:f}of i)c.add(async()=>{let{data:y,shape:B,stride:L}=await r.getChunk(d,e.opts),x=n.prepare(y,B,L);n.set_from_chunk(a,x,f)});return await c.onIdle(),i.shape.length===0?Ah(a.data,0):a}function Th(r){return r.to==null?{from:r.to,to:r.from}:{from:r.to,to:r.from}}async function Mh(r,t,e,n,s){const i=ya(r);if(i.kind==="sharded")throw new Error("Set not supported for sharded arrays.");const a=new ma({selection:t,shape:r.shape,chunk_shape:r.chunks}),c=r.chunks.reduce((f,y)=>f*y,1),d=n.create_queue?n.create_queue():ga();for(const{chunk_coords:f,mapping:y}of a){const B=y.map(x=>x.from),L=y.map(Th);d.add(async()=>{const x=r.resolve(i.encode_chunk_key(f)).path;let M;const U=r.chunks.slice(),F=i.get_strides(U);if(Nh(B,U))if(M=new i.TypedArray(c),typeof e=="object"){const O=s.prepare(M,U.slice(),F.slice());s.set_from_chunk(O,e,L)}else M.fill(e);else{M=await r.getChunk(f).then(({data:C})=>C);const O=s.prepare(M,U.slice(),F.slice());typeof e=="object"?s.set_from_chunk(O,e,L):s.set_scalar(O,B,e)}await r.store.set(x,await i.codec.encode({data:M,shape:U,stride:F}))})}await d.onIdle()}function Nh(r,t){return r.every((e,n)=>{if(typeof e=="number")return!1;const[s,i,a]=e;return i-s===t[n]&&a===1})}function Ss(r,t=0,e){let n=e??r.length-t;return{length:n,subarray(s,i=n){return Ss(r,t+s,i-s)},set(s,i=0){for(let a=0;a<s.length;a++)r[t+i+a]=s.get(a)},get(s){return r[t+s]}}}function Oi(r){return globalThis.Array.isArray(r.data)?{data:Ss(r.data),stride:r.stride,bytes_per_element:1}:{data:new Uint8Array(r.data.buffer,r.data.byteOffset,r.data.byteLength),stride:r.stride,bytes_per_element:r.data.BYTES_PER_ELEMENT}}function Fh(r){return"chars"in r?r.constructor.bind(null,r.chars):r.constructor}function Oh(r,t){if(globalThis.Array.isArray(r.data))return Ss([t]);let e=Fh(r.data),n=new e([t]);return new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}const wa={prepare(r,t,e){return{data:r,shape:t,stride:e}},set_scalar(r,t,e){let n=Oi(r);qi(n,t,Oh(r,e),n.bytes_per_element)},set_from_chunk(r,t,e){let n=Oi(r);Tn(n,Oi(t),n.bytes_per_element,e)}};async function kh(r,t=null,e={}){return Eh(r,t,e,wa)}async function oo(r,t,e,n={}){return Mh(r,t,e,n,wa)}function ba(r,t,e){return e<0&&t<r?Math.floor((r-t-1)/-e)+1:r<t?Math.floor((t-r-1)/e)+1:0}function qi(r,t,e,n){if(t.length===0){r.data.set(e,0);return}const[s,...i]=t,[a,...c]=r.stride;if(typeof s=="number"){const L=r.data.subarray(a*s*n);qi({data:L,stride:c},i,e,n);return}const[d,f,y]=s,B=ba(d,f,y);if(i.length===0){for(let L=0;L<B;L++)r.data.set(e,a*(d+y*L)*n);return}for(let L=0;L<B;L++){const x=r.data.subarray(a*(d+y*L)*n);qi({data:x,stride:c},i,e,n)}}function Tn(r,t,e,n){const[s,...i]=n,[a,...c]=r.stride,[d,...f]=t.stride;if(s.from===null){if(i.length===0){r.data.set(t.data.subarray(0,e),s.to*e);return}Tn({data:r.data.subarray(a*s.to*e),stride:c},t,e,i);return}if(s.to===null){if(i.length===0){let O=s.from*e;r.data.set(t.data.subarray(O,O+e),0);return}Tn(r,{data:t.data.subarray(d*s.from*e),stride:f},e,i);return}const[y,B,L]=s.to,[x,M,U]=s.from,F=ba(y,B,L);if(i.length===0){if(L===1&&U===1&&a===1&&d===1){let O=x*e,C=F*e;r.data.set(t.data.subarray(O,O+C),y*e);return}for(let O=0;O<F;O++){let C=d*(x+U*O)*e;r.data.set(t.data.subarray(C,C+e),a*(y+L*O)*e)}return}for(let O=0;O<F;O++)Tn({data:r.data.subarray(a*(y+O*L)*e),stride:c},{data:t.data.subarray(d*(x+O*U)*e),stride:f},e,i)}function gt(r,t,e,n){function s(i){return i instanceof e?i:new e(function(a){a(i)})}return new(e||(e=Promise))(function(i,a){function c(y){try{f(n.next(y))}catch(B){a(B)}}function d(y){try{f(n.throw(y))}catch(B){a(B)}}function f(y){y.done?i(y.value):s(y.value).then(c,d)}f((n=n.apply(r,t||[])).next())})}function ao(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 wt(r){return this instanceof wt?(this.v=r,this):new wt(r)}function Ae(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),s,i=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",a),s[Symbol.asyncIterator]=function(){return this},s;function a(x){return function(M){return Promise.resolve(M).then(x,B)}}function c(x,M){n[x]&&(s[x]=function(U){return new Promise(function(F,O){i.push([x,U,F,O])>1||d(x,U)})},M&&(s[x]=M(s[x])))}function d(x,M){try{f(n[x](M))}catch(U){L(i[0][3],U)}}function f(x){x.value instanceof wt?Promise.resolve(x.value.v).then(y,B):L(i[0][2],x)}function y(x){d("next",x)}function B(x){d("throw",x)}function L(x,M){x(M),i.shift(),i.length&&d(i[0][0],i[0][1])}}function Mn(r){var t,e;return t={},n("next"),n("throw",function(s){throw s}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(s,i){t[s]=r[s]?function(a){return(e=!e)?{value:wt(r[s](a)),done:!1}:i?i(a):a}:i}}function br(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 ao=="function"?ao(r):r[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(i){e[i]=r[i]&&function(a){return new Promise(function(c,d){a=r[i](a),s(c,d,a.done,a.value)})}}function s(i,a,c,d){Promise.resolve(d).then(function(f){i({value:f,done:c})},a)}}const Dh=new TextDecoder("utf-8"),Ki=r=>Dh.decode(r),Uh=new TextEncoder,Is=r=>Uh.encode(r),Lh=r=>typeof r=="number",Ch=r=>typeof r=="boolean",qt=r=>typeof r=="function",me=r=>r!=null&&Object(r)===r,un=r=>me(r)&&qt(r.then),Bi=r=>me(r)&&qt(r[Symbol.iterator]),Bs=r=>me(r)&&qt(r[Symbol.asyncIterator]),Xi=r=>me(r)&&me(r.schema),_a=r=>me(r)&&"done"in r&&"value"in r,Sa=r=>me(r)&&qt(r.stat)&&Lh(r.fd),Ia=r=>me(r)&&vs(r.body),Ba=r=>"_getDOMStream"in r&&"_getNodeStream"in r,vs=r=>me(r)&&qt(r.cancel)&&qt(r.getReader)&&!Ba(r),va=r=>me(r)&&qt(r.read)&&qt(r.pipe)&&Ch(r.readable)&&!Ba(r),Rh=r=>me(r)&&qt(r.clear)&&qt(r.bytes)&&qt(r.position)&&qt(r.setPosition)&&qt(r.capacity)&&qt(r.getBufferIdentifier)&&qt(r.createLong),xs=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function Ph(r){const t=r[0]?[r[0]]:[];let e,n,s,i;for(let a,c,d=0,f=0,y=r.length;++d<y;){if(a=t[f],c=r[d],!a||!c||a.buffer!==c.buffer||c.byteOffset<a.byteOffset){c&&(t[++f]=c);continue}if({byteOffset:e,byteLength:s}=a,{byteOffset:n,byteLength:i}=c,e+s<n||n+i<e){c&&(t[++f]=c);continue}t[f]=new Uint8Array(a.buffer,e,n-e+i)}return t}function co(r,t,e=0,n=t.byteLength){const s=r.byteLength,i=new Uint8Array(r.buffer,r.byteOffset,s),a=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,s));return i.set(a,e),r}function Ee(r,t){const e=Ph(r),n=e.reduce((y,B)=>y+B.byteLength,0);let s,i,a,c=0,d=-1;const f=Math.min(t||Number.POSITIVE_INFINITY,n);for(const y=e.length;++d<y;){if(s=e[d],i=s.subarray(0,Math.min(s.length,f-c)),f<=c+i.length){i.length<s.length?e[d]=s.subarray(i.length):i.length===s.length&&d++,a?co(a,i,c):a=i;break}co(a||(a=new Uint8Array(f)),i,c),c+=i.length}return[a||new Uint8Array(0),e.slice(d),n-(a?a.byteLength:0)]}function Mt(r,t){let e=_a(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=Is(e)),e instanceof ArrayBuffer?new r(e):e instanceof xs?new r(e):Rh(e)?Mt(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)}const Dr=r=>Mt(Int32Array,r),uo=r=>Mt(BigInt64Array,r),It=r=>Mt(Uint8Array,r),Qi=r=>(r.next(),r);function*$h(r,t){const e=function*(s){yield s},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof xs?e(t):Bi(t)?t:e(t);return yield*Qi(function*(s){let i=null;do i=s.next(yield Mt(r,i));while(!i.done)}(n[Symbol.iterator]())),new r}const zh=r=>$h(Uint8Array,r);function xa(r,t){return Ae(this,arguments,function*(){if(un(t))return yield wt(yield wt(yield*Mn(br(xa(r,yield wt(t))))));const n=function(a){return Ae(this,arguments,function*(){yield yield wt(yield wt(a))})},s=function(a){return Ae(this,arguments,function*(){yield wt(yield*Mn(br(Qi(function*(c){let d=null;do d=c.next(yield d?.value);while(!d.done)}(a[Symbol.iterator]())))))})},i=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof xs?n(t):Bi(t)?s(t):Bs(t)?t:n(t);return yield wt(yield*Mn(br(Qi(function(a){return Ae(this,arguments,function*(){let c=null;do c=yield wt(a.next(yield yield wt(Mt(r,c))));while(!c.done)})}(i[Symbol.asyncIterator]()))))),yield wt(new r)})}const jh=r=>xa(Uint8Array,r);function Vh(r,t){let e=0;const 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}const ce={fromIterable(r){return Sn(Wh(r))},fromAsyncIterable(r){return Sn(Zh(r))},fromDOMStream(r){return Sn(Gh(r))},fromNodeStream(r){return Sn(Jh(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')}},Sn=r=>(r.next(),r);function*Wh(r){let t,e=!1,n=[],s,i,a,c=0;function d(){return i==="peek"?Ee(n,a)[0]:([s,n,c]=Ee(n,a),s)}({cmd:i,size:a}=(yield null)||{cmd:"read",size:0});const f=zh(r)[Symbol.iterator]();try{do if({done:t,value:s}=Number.isNaN(a-c)?f.next():f.next(a-c),!t&&s.byteLength>0&&(n.push(s),c+=s.byteLength),t||a<=c)do({cmd:i,size:a}=yield d());while(a<c);while(!t)}catch(y){(e=!0)&&typeof f.throw=="function"&&f.throw(y)}finally{e===!1&&typeof f.return=="function"&&f.return(null)}return null}function Zh(r){return Ae(this,arguments,function*(){let e,n=!1,s=[],i,a,c,d=0;function f(){return a==="peek"?Ee(s,c)[0]:([i,s,d]=Ee(s,c),i)}({cmd:a,size:c}=(yield yield wt(null))||{cmd:"read",size:0});const y=jh(r)[Symbol.asyncIterator]();try{do if({done:e,value:i}=Number.isNaN(c-d)?yield wt(y.next()):yield wt(y.next(c-d)),!e&&i.byteLength>0&&(s.push(i),d+=i.byteLength),e||c<=d)do({cmd:a,size:c}=yield yield wt(f()));while(c<d);while(!e)}catch(B){(n=!0)&&typeof y.throw=="function"&&(yield wt(y.throw(B)))}finally{n===!1&&typeof y.return=="function"&&(yield wt(y.return(new Uint8Array(0))))}return yield wt(null)})}function Gh(r){return Ae(this,arguments,function*(){let e=!1,n=!1,s=[],i,a,c,d=0;function f(){return a==="peek"?Ee(s,c)[0]:([i,s,d]=Ee(s,c),i)}({cmd:a,size:c}=(yield yield wt(null))||{cmd:"read",size:0});const y=new Yh(r);try{do if({done:e,value:i}=Number.isNaN(c-d)?yield wt(y.read()):yield wt(y.read(c-d)),!e&&i.byteLength>0&&(s.push(It(i)),d+=i.byteLength),e||c<=d)do({cmd:a,size:c}=yield yield wt(f()));while(c<d);while(!e)}catch(B){(n=!0)&&(yield wt(y.cancel(B)))}finally{n===!1?yield wt(y.cancel()):r.locked&&y.releaseLock()}return yield wt(null)})}class Yh{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 gt(this,void 0,void 0,function*(){const{reader:e,source:n}=this;e&&(yield e.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return gt(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};const e=yield this.reader.read();return!e.done&&(e.value=It(e)),e})}}const ki=(r,t)=>{const e=s=>n([t,s]);let n;return[t,e,new Promise(s=>(n=s)&&r.once(t,e))]};function Jh(r){return Ae(this,arguments,function*(){const e=[];let n="error",s=!1,i=null,a,c,d=0,f=[],y;function B(){return a==="peek"?Ee(f,c)[0]:([y,f,d]=Ee(f,c),y)}if({cmd:a,size:c}=(yield yield wt(null))||{cmd:"read",size:0},r.isTTY)return yield yield wt(new Uint8Array(0)),yield wt(null);try{e[0]=ki(r,"end"),e[1]=ki(r,"error");do{if(e[2]=ki(r,"readable"),[n,i]=yield wt(Promise.race(e.map(x=>x[2]))),n==="error")break;if((s=n==="end")||(Number.isFinite(c-d)?(y=It(r.read(c-d)),y.byteLength<c-d&&(y=It(r.read()))):y=It(r.read()),y.byteLength>0&&(f.push(y),d+=y.byteLength)),s||c<=d)do({cmd:a,size:c}=yield yield wt(B()));while(c<d)}while(!s)}finally{yield wt(L(e,n==="error"?i:null))}return yield wt(null);function L(x,M){return y=f=null,new Promise((U,F)=>{for(const[O,C]of x)r.off(O,C);try{const O=r.destroy;O&&O.call(r,M),M=void 0}catch(O){M=O||M}finally{M!=null?F(M):U()}})}})}var zt;(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"})(zt||(zt={}));var re;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(re||(re={}));var Jt;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(Jt||(Jt={}));var de;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(de||(de={}));var at;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(at||(at={}));var Te;(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"})(Te||(Te={}));const Di=2,Be=4,ke=4,xt=4,We=new Int32Array(2),ho=new Float32Array(We.buffer),lo=new Float64Array(We.buffer),In=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var ts;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(ts||(ts={}));let xr=class Aa{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new Aa(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 We[0]=this.readInt32(t),ho[0]}readFloat64(t){return We[In?0:1]=this.readInt32(t),We[In?1:0]=this.readInt32(t+4),lo[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){ho[0]=e,this.writeInt32(t,We[0])}writeFloat64(t,e){lo[0]=e,this.writeInt32(t,We[In?0:1]),this.writeInt32(t+4,We[In?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+Be+ke)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<ke;e++)t+=String.fromCharCode(this.readInt8(this.position_+Be+e));return t}__offset(t,e){const 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);const n=this.readInt32(t);t+=Be;const s=this.bytes_.subarray(t,t+n);return e===ts.UTF8_BYTES?s:this.text_decoder_.decode(s)}__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)+Be}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=ke)throw new Error("FlatBuffers: file identifier must be length "+ke);for(let e=0;e<ke;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+Be+e))return!1;return!0}createScalarList(t,e){const n=[];for(let s=0;s<e;++s){const i=t(s);i!==null&&n.push(i)}return n}createObjList(t,e){const n=[];for(let s=0;s<e;++s){const i=t(s);i!==null&&n.push(i.unpack())}return n}},Ea=class Ta{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=xr.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);const n=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<n+t+e;){const s=this.bb.capacity();this.bb=Ta.growByteBuffer(this.bb),this.space+=this.bb.capacity()-s}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){const e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const n=e<<1,s=xr.allocate(n);return s.setPosition(n-e),s.bytes().set(t.bytes(),n-e),s}addOffset(t){this.prep(Be,0),this.writeInt32(this.offset()-t+Be)}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);const t=this.offset();let e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);const n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);const s=2;this.addInt16(t-this.object_start);const i=(n+s)*Di;this.addInt16(i);let a=0;const c=this.space;t:for(e=0;e<this.vtables.length;e++){const d=this.bb.capacity()-this.vtables[e];if(i==this.bb.readInt16(d)){for(let f=Di;f<i;f+=Di)if(this.bb.readInt16(c+f)!=this.bb.readInt16(d+f))continue t;a=this.vtables[e];break}}return a?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,a-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,n){const s=n?xt:0;if(e){const i=e;if(this.prep(this.minalign,Be+ke+s),i.length!=ke)throw new TypeError("FlatBuffers: file identifier must be length "+ke);for(let a=ke-1;a>=0;a--)this.writeInt8(i.charCodeAt(a))}this.prep(this.minalign,Be+s),this.addOffset(t),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){const n=this.bb.capacity()-t,s=n-this.bb.readInt32(n);if(!(e<this.bb.readInt16(s)&&this.bb.readInt16(s+e)!=0))throw new TypeError("FlatBuffers: field "+e+" must be set")}startVector(t,e,n){this.notNested(),this.vector_num_elems=e,this.prep(Be,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);const e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(t==null)return 0;let e;return t instanceof Uint8Array?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){const e=[];for(let n=0;n<t.length;++n){const s=t[n];if(s!==null)e.push(this.createObjectOffset(s));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 zn;(function(r){r[r.BUFFER=0]="BUFFER"})(zn||(zn={}));var jn;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(jn||(jn={}));class Ze{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 Ze).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+xt),(e||new Ze).__init(t.readInt32(t.position())+t.position(),t)}codec(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):jn.LZ4_FRAME}method(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):zn.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,jn.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,zn.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return Ze.startBodyCompression(t),Ze.addCodec(t,e),Ze.addMethod(t,n),Ze.endBodyCompression(t)}}class Ma{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()}}let Na=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()}},Ne=class es{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 es).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+xt),(e||new es).__init(t.readInt32(t.position())+t.position(),t)}length(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,e){const n=this.bb.__offset(this.bb_pos,6);return n?(e||new Na).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new Ma).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){const e=this.bb.__offset(this.bb_pos,10);return e?(t||new Ze).__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()}},ar=class rs{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 rs).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+xt),(e||new rs).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new Ne).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){const t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,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 Vn;(function(r){r[r.DenseArray=0]="DenseArray"})(Vn||(Vn={}));class oe{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 oe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+xt),(e||new oe).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){const t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,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 oe.startInt(t),oe.addBitWidth(t,e),oe.addIsSigned(t,n),oe.endInt(t)}}class De{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 De).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+xt),(e||new De).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new oe).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){const t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):Vn.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,Vn.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}class jt{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 jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+xt),(e||new jt).__init(t.readInt32(t.position())+t.position(),t)}key(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){const 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 jt.startKeyValue(t),jt.addKey(t,e),jt.addValue(t,n),jt.endKeyValue(t)}}let fo=class Xr{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 Xr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+xt),(e||new Xr).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return Xr.startBinary(t),Xr.endBinary(t)}},po=class Qr{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 Qr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+xt),(e||new Qr).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return Qr.startBool(t),Qr.endBool(t)}},Nn=class cr{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 cr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+xt),(e||new cr).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):de.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,de.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return cr.startDate(t),cr.addUnit(t,e),cr.endDate(t)}},ur=class Ve{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 Ve).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+xt),(e||new Ve).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,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,s){return Ve.startDecimal(t),Ve.addPrecision(t,e),Ve.addScale(t,n),Ve.addBitWidth(t,s),Ve.endDecimal(t)}},Fn=class hr{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 hr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+xt),(e||new hr).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):at.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,at.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return hr.startDuration(t),hr.addUnit(t,e),hr.endDuration(t)}},On=class lr{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 lr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+xt),(e||new lr).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return lr.startFixedSizeBinary(t),lr.addByteWidth(t,e),lr.endFixedSizeBinary(t)}},kn=class dr{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 dr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+xt),(e||new dr).__init(t.readInt32(t.position())+t.position(),t)}listSize(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return dr.startFixedSizeList(t),dr.addListSize(t,e),dr.endFixedSizeList(t)}};class ve{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 ve).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+xt),(e||new ve).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Jt.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,Jt.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return ve.startFloatingPoint(t),ve.addPrecision(t,e),ve.endFloatingPoint(t)}}class xe{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 xe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+xt),(e||new xe).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Te.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Te.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return xe.startInterval(t),xe.addUnit(t,e),xe.endInterval(t)}}let yo=class tn{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 tn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+xt),(e||new tn).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return tn.startLargeBinary(t),tn.endLargeBinary(t)}},go=class en{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 en).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+xt),(e||new en).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return en.startLargeUtf8(t),en.endLargeUtf8(t)}},mo=class rn{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 rn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+xt),(e||new rn).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return rn.startList(t),rn.endList(t)}},Dn=class fr{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 fr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+xt),(e||new fr).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){const t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return fr.startMap(t),fr.addKeysSorted(t,e),fr.endMap(t)}},wo=class nn{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 nn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+xt),(e||new nn).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return nn.startNull(t),nn.endNull(t)}};class Qe{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 Qe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+xt),(e||new Qe).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return Qe.startStruct_(t),Qe.endStruct_(t)}}class ue{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 ue).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+xt),(e||new ue).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):at.MILLISECOND}bitWidth(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,at.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return ue.startTime(t),ue.addUnit(t,e),ue.addBitWidth(t,n),ue.endTime(t)}}class he{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 he).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+xt),(e||new he).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):at.SECOND}timezone(t){const 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,at.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return he.startTimestamp(t),he.addUnit(t,e),he.addTimezone(t,n),he.endTimestamp(t)}}class ee{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 ee).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+xt),(e||new ee).__init(t.readInt32(t.position())+t.position(),t)}mode(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):re.Sparse}typeIds(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+t*4):0}typeIdsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){const t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,re.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 ee.startUnion(t),ee.addMode(t,e),ee.addTypeIds(t,n),ee.endUnion(t)}}let bo=class sn{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 sn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+xt),(e||new sn).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return sn.startUtf8(t),sn.endUtf8(t)}};var Dt;(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"})(Dt||(Dt={}));let ae=class Un{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 Un).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+xt),(e||new Un).__init(t.readInt32(t.position())+t.position(),t)}name(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){const t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):Dt.NONE}type(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){const e=this.bb.__offset(this.bb_pos,12);return e?(t||new De).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){const n=this.bb.__offset(this.bb_pos,14);return n?(e||new Un).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){const t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,16);return n?(e||new jt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,Dt.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()}},Se=class Me{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 Me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+xt),(e||new Me).__init(t.readInt32(t.position())+t.position(),t)}endianness(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ar.Little}fields(t,e){const n=this.bb.__offset(this.bb_pos,6);return n?(e||new ae).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new jt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){const 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(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,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,s,i){return Me.startSchema(t),Me.addEndianness(t,e),Me.addFields(t,n),Me.addCustomMetadata(t,s),Me.addFeatures(t,i),Me.endSchema(t)}};var Bt;(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"})(Bt||(Bt={}));var E;(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"})(E||(E={}));var Fe;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(Fe||(Fe={}));const Hh=void 0;function hn(r){if(r===null)return"null";if(r===Hh)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=>hn(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}function Lt(r){if(typeof r=="bigint"&&(r<Number.MIN_SAFE_INTEGER||r>Number.MAX_SAFE_INTEGER))throw new TypeError(`${r} is not safe to convert to a number.`);return Number(r)}function Fa(r,t){return Lt(r/t)+Lt(r%t)/Lt(t)}const qh=Symbol.for("isArrowBigNum");function be(r,...t){return t.length===0?Object.setPrototypeOf(Mt(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}be.prototype[qh]=!0;be.prototype.toJSON=function(){return`"${dn(this)}"`};be.prototype.valueOf=function(r){return Oa(this,r)};be.prototype.toString=function(){return dn(this)};be.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return Oa(this);case"string":return dn(this);case"default":return Qh(this)}return dn(this)};function _r(...r){return be.apply(this,r)}function Sr(...r){return be.apply(this,r)}function ln(...r){return be.apply(this,r)}Object.setPrototypeOf(_r.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Sr.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(ln.prototype,Object.create(Uint32Array.prototype));Object.assign(_r.prototype,be.prototype,{constructor:_r,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Sr.prototype,be.prototype,{constructor:Sr,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(ln.prototype,be.prototype,{constructor:ln,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const Kh=BigInt(4294967296)*BigInt(4294967296),Xh=Kh-BigInt(1);function Oa(r,t){const{buffer:e,byteOffset:n,byteLength:s,signed:i}=r,a=new BigUint64Array(e,n,s/8),c=i&&a.at(-1)&BigInt(1)<<BigInt(63);let d=BigInt(0),f=0;if(c){for(const y of a)d|=(y^Xh)*(BigInt(1)<<BigInt(64*f++));d*=BigInt(-1),d-=BigInt(1)}else for(const y of a)d|=y*(BigInt(1)<<BigInt(64*f++));if(typeof t=="number"){const y=BigInt(Math.pow(10,t)),B=d/y,L=d%y;return Lt(B)+Lt(L)/Lt(y)}return Lt(d)}function dn(r){if(r.byteLength===8)return`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`;if(!r.signed)return Ui(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Ui(r);t=t.slice();let n=1;for(let i=0;i<t.length;i++){const a=t[i],c=~a+n;t[i]=c,n&=a===0?1:0}return`-${Ui(t)}`}function Qh(r){return r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:dn(r)}function Ui(r){let t="";const e=new Uint32Array(2);let n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);const s=new Uint32Array((n=new Uint16Array(n).reverse()).buffer);let i=-1;const a=n.length-1;do{for(e[0]=n[i=0];i<a;)n[i++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+n[i];n[i]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t=`${e[0]}${t}`}while(s[0]||s[1]||s[2]||s[3]);return t??"0"}class As{static new(t,e){switch(e){case!0:return new _r(t);case!1:return new Sr(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new _r(t)}return t.byteLength===16?new ln(t):new Sr(t)}static signed(t){return new _r(t)}static unsigned(t){return new Sr(t)}static decimal(t){return new ln(t)}constructor(t,e){return As.new(t,e)}}var ka,Da,Ua,La,Ca,Ra,Pa,$a,za,ja,Va,Wa,Za,Ga,Ya,Ja,Ha,qa,Ka,Xa,Qa,tc;class tt{static isNull(t){return t?.typeId===E.Null}static isInt(t){return t?.typeId===E.Int}static isFloat(t){return t?.typeId===E.Float}static isBinary(t){return t?.typeId===E.Binary}static isLargeBinary(t){return t?.typeId===E.LargeBinary}static isUtf8(t){return t?.typeId===E.Utf8}static isLargeUtf8(t){return t?.typeId===E.LargeUtf8}static isBool(t){return t?.typeId===E.Bool}static isDecimal(t){return t?.typeId===E.Decimal}static isDate(t){return t?.typeId===E.Date}static isTime(t){return t?.typeId===E.Time}static isTimestamp(t){return t?.typeId===E.Timestamp}static isInterval(t){return t?.typeId===E.Interval}static isDuration(t){return t?.typeId===E.Duration}static isList(t){return t?.typeId===E.List}static isStruct(t){return t?.typeId===E.Struct}static isUnion(t){return t?.typeId===E.Union}static isFixedSizeBinary(t){return t?.typeId===E.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===E.FixedSizeList}static isMap(t){return t?.typeId===E.Map}static isDictionary(t){return t?.typeId===E.Dictionary}static isDenseUnion(t){return tt.isUnion(t)&&t.mode===re.Dense}static isSparseUnion(t){return tt.isUnion(t)&&t.mode===re.Sparse}constructor(t){this.typeId=t}}ka=Symbol.toStringTag;tt[ka]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(tt.prototype);class Je extends tt{constructor(){super(E.Null)}toString(){return"Null"}}Da=Symbol.toStringTag;Je[Da]=(r=>r[Symbol.toStringTag]="Null")(Je.prototype);class er extends tt{constructor(t,e){super(E.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}`}}Ua=Symbol.toStringTag;er[Ua]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(er.prototype);class fn extends er{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(fn.prototype,"ArrayType",{value:Int32Array});class Wn extends tt{constructor(t){super(E.Float),this.precision=t}get ArrayType(){switch(this.precision){case Jt.HALF:return Uint16Array;case Jt.SINGLE:return Float32Array;case Jt.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}La=Symbol.toStringTag;Wn[La]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(Wn.prototype);class Zn extends tt{constructor(){super(E.Binary)}toString(){return"Binary"}}Ca=Symbol.toStringTag;Zn[Ca]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(Zn.prototype);class Gn extends tt{constructor(){super(E.LargeBinary)}toString(){return"LargeBinary"}}Ra=Symbol.toStringTag;Gn[Ra]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(Gn.prototype);class Yn extends tt{constructor(){super(E.Utf8)}toString(){return"Utf8"}}Pa=Symbol.toStringTag;Yn[Pa]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Yn.prototype);class Jn extends tt{constructor(){super(E.LargeUtf8)}toString(){return"LargeUtf8"}}$a=Symbol.toStringTag;Jn[$a]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Jn.prototype);class Hn extends tt{constructor(){super(E.Bool)}toString(){return"Bool"}}za=Symbol.toStringTag;Hn[za]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(Hn.prototype);class qn extends tt{constructor(t,e,n=128){super(E.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}ja=Symbol.toStringTag;qn[ja]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(qn.prototype);class Kn extends tt{constructor(t){super(E.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${de[this.unit]}>`}get ArrayType(){return this.unit===de.DAY?Int32Array:BigInt64Array}}Va=Symbol.toStringTag;Kn[Va]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))(Kn.prototype);class Xn extends tt{constructor(t,e){super(E.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${at[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}Wa=Symbol.toStringTag;Xn[Wa]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(Xn.prototype);class Qn extends tt{constructor(t,e){super(E.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${at[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}Za=Symbol.toStringTag;Qn[Za]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(Qn.prototype);class ti extends tt{constructor(t){super(E.Interval),this.unit=t}toString(){return`Interval<${Te[this.unit]}>`}}Ga=Symbol.toStringTag;ti[Ga]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(ti.prototype);class ei extends tt{constructor(t){super(E.Duration),this.unit=t}toString(){return`Duration<${at[this.unit]}>`}}Ya=Symbol.toStringTag;ei[Ya]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(ei.prototype);class ri extends tt{constructor(t){super(E.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}}Ja=Symbol.toStringTag;ri[Ja]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(ri.prototype);class Kt extends tt{constructor(t){super(E.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}Ha=Symbol.toStringTag;Kt[Ha]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(Kt.prototype);class ni extends tt{constructor(t,e,n){super(E.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((s,i,a)=>(s[i]=a)&&s||s,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}qa=Symbol.toStringTag;ni[qa]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(ni.prototype);class ii extends tt{constructor(t){super(E.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}Ka=Symbol.toStringTag;ii[Ka]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(ii.prototype);class si extends tt{constructor(t,e){super(E.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}>`}}Xa=Symbol.toStringTag;si[Xa]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(si.prototype);class oi extends tt{constructor(t,e=!1){var n,s,i;if(super(E.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){const a=(s=t?.type)===null||s===void 0?void 0:s.children[0];a&&(a.name="key");const c=(i=t?.type)===null||i===void 0?void 0:i.children[1];c&&(c.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}Qa=Symbol.toStringTag;oi[Qa]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(oi.prototype);const tl=(r=>()=>++r)(-1);class Er extends tt{constructor(t,e,n,s){super(E.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=s||!1,this.id=n==null?tl():Lt(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}>`}}tc=Symbol.toStringTag;Er[tc]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Er.prototype);function Oe(r){const t=r;switch(r.typeId){case E.Decimal:return r.bitWidth/32;case E.Interval:return 1+t.unit;case E.FixedSizeList:return t.listSize;case E.FixedSizeBinary:return t.byteWidth;default:return 1}}class St{visitMany(t,...e){return t.map((n,s)=>this.visit(n,...e.map(i=>i[s])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return el(this,t,e)}getVisitFnByTypeId(t,e=!0){return pr(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 el(r,t,e=!0){return typeof t=="number"?pr(r,t,e):typeof t=="string"&&t in E?pr(r,E[t],e):t&&t instanceof tt?pr(r,_o(t),e):t?.type&&t.type instanceof tt?pr(r,_o(t.type),e):pr(r,E.NONE,e)}function pr(r,t,e=!0){let n=null;switch(t){case E.Null:n=r.visitNull;break;case E.Bool:n=r.visitBool;break;case E.Int:n=r.visitInt;break;case E.Int8:n=r.visitInt8||r.visitInt;break;case E.Int16:n=r.visitInt16||r.visitInt;break;case E.Int32:n=r.visitInt32||r.visitInt;break;case E.Int64:n=r.visitInt64||r.visitInt;break;case E.Uint8:n=r.visitUint8||r.visitInt;break;case E.Uint16:n=r.visitUint16||r.visitInt;break;case E.Uint32:n=r.visitUint32||r.visitInt;break;case E.Uint64:n=r.visitUint64||r.visitInt;break;case E.Float:n=r.visitFloat;break;case E.Float16:n=r.visitFloat16||r.visitFloat;break;case E.Float32:n=r.visitFloat32||r.visitFloat;break;case E.Float64:n=r.visitFloat64||r.visitFloat;break;case E.Utf8:n=r.visitUtf8;break;case E.LargeUtf8:n=r.visitLargeUtf8;break;case E.Binary:n=r.visitBinary;break;case E.LargeBinary:n=r.visitLargeBinary;break;case E.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case E.Date:n=r.visitDate;break;case E.DateDay:n=r.visitDateDay||r.visitDate;break;case E.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case E.Timestamp:n=r.visitTimestamp;break;case E.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case E.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case E.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case E.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case E.Time:n=r.visitTime;break;case E.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case E.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case E.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case E.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case E.Decimal:n=r.visitDecimal;break;case E.List:n=r.visitList;break;case E.Struct:n=r.visitStruct;break;case E.Union:n=r.visitUnion;break;case E.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case E.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case E.Dictionary:n=r.visitDictionary;break;case E.Interval:n=r.visitInterval;break;case E.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case E.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case E.Duration:n=r.visitDuration;break;case E.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case E.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case E.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case E.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case E.FixedSizeList:n=r.visitFixedSizeList;break;case E.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${E[t]}'`)}function _o(r){switch(r.typeId){case E.Null:return E.Null;case E.Int:{const{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?E.Int8:E.Uint8;case 16:return e?E.Int16:E.Uint16;case 32:return e?E.Int32:E.Uint32;case 64:return e?E.Int64:E.Uint64}return E.Int}case E.Float:switch(r.precision){case Jt.HALF:return E.Float16;case Jt.SINGLE:return E.Float32;case Jt.DOUBLE:return E.Float64}return E.Float;case E.Binary:return E.Binary;case E.LargeBinary:return E.LargeBinary;case E.Utf8:return E.Utf8;case E.LargeUtf8:return E.LargeUtf8;case E.Bool:return E.Bool;case E.Decimal:return E.Decimal;case E.Time:switch(r.unit){case at.SECOND:return E.TimeSecond;case at.MILLISECOND:return E.TimeMillisecond;case at.MICROSECOND:return E.TimeMicrosecond;case at.NANOSECOND:return E.TimeNanosecond}return E.Time;case E.Timestamp:switch(r.unit){case at.SECOND:return E.TimestampSecond;case at.MILLISECOND:return E.TimestampMillisecond;case at.MICROSECOND:return E.TimestampMicrosecond;case at.NANOSECOND:return E.TimestampNanosecond}return E.Timestamp;case E.Date:switch(r.unit){case de.DAY:return E.DateDay;case de.MILLISECOND:return E.DateMillisecond}return E.Date;case E.Interval:switch(r.unit){case Te.DAY_TIME:return E.IntervalDayTime;case Te.YEAR_MONTH:return E.IntervalYearMonth}return E.Interval;case E.Duration:switch(r.unit){case at.SECOND:return E.DurationSecond;case at.MILLISECOND:return E.DurationMillisecond;case at.MICROSECOND:return E.DurationMicrosecond;case at.NANOSECOND:return E.DurationNanosecond}return E.Duration;case E.Map:return E.Map;case E.List:return E.List;case E.Struct:return E.Struct;case E.Union:switch(r.mode){case re.Dense:return E.DenseUnion;case re.Sparse:return E.SparseUnion}return E.Union;case E.FixedSizeBinary:return E.FixedSizeBinary;case E.FixedSizeList:return E.FixedSizeList;case E.Dictionary:return E.Dictionary}throw new Error(`Unrecognized type '${E[r.typeId]}'`)}St.prototype.visitInt8=null;St.prototype.visitInt16=null;St.prototype.visitInt32=null;St.prototype.visitInt64=null;St.prototype.visitUint8=null;St.prototype.visitUint16=null;St.prototype.visitUint32=null;St.prototype.visitUint64=null;St.prototype.visitFloat16=null;St.prototype.visitFloat32=null;St.prototype.visitFloat64=null;St.prototype.visitDateDay=null;St.prototype.visitDateMillisecond=null;St.prototype.visitTimestampSecond=null;St.prototype.visitTimestampMillisecond=null;St.prototype.visitTimestampMicrosecond=null;St.prototype.visitTimestampNanosecond=null;St.prototype.visitTimeSecond=null;St.prototype.visitTimeMillisecond=null;St.prototype.visitTimeMicrosecond=null;St.prototype.visitTimeNanosecond=null;St.prototype.visitDenseUnion=null;St.prototype.visitSparseUnion=null;St.prototype.visitIntervalDayTime=null;St.prototype.visitIntervalYearMonth=null;St.prototype.visitDuration=null;St.prototype.visitDurationSecond=null;St.prototype.visitDurationMillisecond=null;St.prototype.visitDurationMicrosecond=null;St.prototype.visitDurationNanosecond=null;const ec=new Float64Array(1),or=new Uint32Array(ec.buffer);function rc(r){const 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 rl(r){if(r!==r)return 32256;ec[0]=r;const t=(or[1]&2147483648)>>16&65535;let e=or[1]&2146435072,n=0;return e>=1089470464?or[0]>0?e=31744:(e=(e&2080374784)>>16,n=(or[1]&1048575)>>10):e<=1056964608?(n=1048576+(or[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(or[1]&1048575)+512>>10),t|e|n&65535}class ct extends St{}function dt(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}const nl=(r,t,e)=>{r[t]=Math.floor(e/864e5)},nc=(r,t,e,n)=>{if(e+1<t.length){const s=Lt(t[e]),i=Lt(t[e+1]);r.set(n.subarray(0,i-s),s)}},il=({offset:r,values:t},e,n)=>{const s=r+e;n?t[s>>3]|=1<<s%8:t[s>>3]&=~(1<<s%8)},Re=({values:r},t,e)=>{r[t]=e},Es=({values:r},t,e)=>{r[t]=e},ic=({values:r},t,e)=>{r[t]=rl(e)},sl=(r,t,e)=>{switch(r.type.precision){case Jt.HALF:return ic(r,t,e);case Jt.SINGLE:case Jt.DOUBLE:return Es(r,t,e)}},sc=({values:r},t,e)=>{nl(r,t,e.valueOf())},oc=({values:r},t,e)=>{r[t]=BigInt(e)},ol=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},ac=({values:r,valueOffsets:t},e,n)=>nc(r,t,e,n),cc=({values:r,valueOffsets:t},e,n)=>nc(r,t,e,Is(n)),al=(r,t,e)=>{r.type.unit===de.DAY?sc(r,t,e):oc(r,t,e)},uc=({values:r},t,e)=>{r[t]=BigInt(e/1e3)},hc=({values:r},t,e)=>{r[t]=BigInt(e)},lc=({values:r},t,e)=>{r[t]=BigInt(e*1e3)},dc=({values:r},t,e)=>{r[t]=BigInt(e*1e6)},cl=(r,t,e)=>{switch(r.type.unit){case at.SECOND:return uc(r,t,e);case at.MILLISECOND:return hc(r,t,e);case at.MICROSECOND:return lc(r,t,e);case at.NANOSECOND:return dc(r,t,e)}},fc=({values:r},t,e)=>{r[t]=e},pc=({values:r},t,e)=>{r[t]=e},yc=({values:r},t,e)=>{r[t]=e},gc=({values:r},t,e)=>{r[t]=e},ul=(r,t,e)=>{switch(r.type.unit){case at.SECOND:return fc(r,t,e);case at.MILLISECOND:return pc(r,t,e);case at.MICROSECOND:return yc(r,t,e);case at.NANOSECOND:return gc(r,t,e)}},hl=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},ll=(r,t,e)=>{const n=r.children[0],s=r.valueOffsets,i=fe.getVisitFn(n);if(Array.isArray(e))for(let a=-1,c=s[t],d=s[t+1];c<d;)i(n,c++,e[++a]);else for(let a=-1,c=s[t],d=s[t+1];c<d;)i(n,c++,e.get(++a))},dl=(r,t,e)=>{const n=r.children[0],{valueOffsets:s}=r,i=fe.getVisitFn(n);let{[t]:a,[t+1]:c}=s;const d=e instanceof Map?e.entries():Object.entries(e);for(const f of d)if(i(n,a,f),++a>=c)break},fl=(r,t)=>(e,n,s,i)=>n&&e(n,r,t[i]),pl=(r,t)=>(e,n,s,i)=>n&&e(n,r,t.get(i)),yl=(r,t)=>(e,n,s,i)=>n&&e(n,r,t.get(s.name)),gl=(r,t)=>(e,n,s,i)=>n&&e(n,r,t[s.name]),ml=(r,t,e)=>{const n=r.type.children.map(i=>fe.getVisitFn(i.type)),s=e instanceof Map?yl(t,e):e instanceof Ft?pl(t,e):Array.isArray(e)?fl(t,e):gl(t,e);r.type.children.forEach((i,a)=>s(n[a],r.children[a],i,a))},wl=(r,t,e)=>{r.type.mode===re.Dense?mc(r,t,e):wc(r,t,e)},mc=(r,t,e)=>{const n=r.type.typeIdToChildIndex[r.typeIds[t]],s=r.children[n];fe.visit(s,r.valueOffsets[t],e)},wc=(r,t,e)=>{const n=r.type.typeIdToChildIndex[r.typeIds[t]],s=r.children[n];fe.visit(s,t,e)},bl=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},_l=(r,t,e)=>{r.type.unit===Te.DAY_TIME?bc(r,t,e):_c(r,t,e)},bc=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},_c=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},Sc=({values:r},t,e)=>{r[t]=e},Ic=({values:r},t,e)=>{r[t]=e},Bc=({values:r},t,e)=>{r[t]=e},vc=({values:r},t,e)=>{r[t]=e},Sl=(r,t,e)=>{switch(r.type.unit){case at.SECOND:return Sc(r,t,e);case at.MILLISECOND:return Ic(r,t,e);case at.MICROSECOND:return Bc(r,t,e);case at.NANOSECOND:return vc(r,t,e)}},Il=(r,t,e)=>{const{stride:n}=r,s=r.children[0],i=fe.getVisitFn(s);if(Array.isArray(e))for(let a=-1,c=t*n;++a<n;)i(s,c+a,e[a]);else for(let a=-1,c=t*n;++a<n;)i(s,c+a,e.get(a))};ct.prototype.visitBool=dt(il);ct.prototype.visitInt=dt(Re);ct.prototype.visitInt8=dt(Re);ct.prototype.visitInt16=dt(Re);ct.prototype.visitInt32=dt(Re);ct.prototype.visitInt64=dt(Re);ct.prototype.visitUint8=dt(Re);ct.prototype.visitUint16=dt(Re);ct.prototype.visitUint32=dt(Re);ct.prototype.visitUint64=dt(Re);ct.prototype.visitFloat=dt(sl);ct.prototype.visitFloat16=dt(ic);ct.prototype.visitFloat32=dt(Es);ct.prototype.visitFloat64=dt(Es);ct.prototype.visitUtf8=dt(cc);ct.prototype.visitLargeUtf8=dt(cc);ct.prototype.visitBinary=dt(ac);ct.prototype.visitLargeBinary=dt(ac);ct.prototype.visitFixedSizeBinary=dt(ol);ct.prototype.visitDate=dt(al);ct.prototype.visitDateDay=dt(sc);ct.prototype.visitDateMillisecond=dt(oc);ct.prototype.visitTimestamp=dt(cl);ct.prototype.visitTimestampSecond=dt(uc);ct.prototype.visitTimestampMillisecond=dt(hc);ct.prototype.visitTimestampMicrosecond=dt(lc);ct.prototype.visitTimestampNanosecond=dt(dc);ct.prototype.visitTime=dt(ul);ct.prototype.visitTimeSecond=dt(fc);ct.prototype.visitTimeMillisecond=dt(pc);ct.prototype.visitTimeMicrosecond=dt(yc);ct.prototype.visitTimeNanosecond=dt(gc);ct.prototype.visitDecimal=dt(hl);ct.prototype.visitList=dt(ll);ct.prototype.visitStruct=dt(ml);ct.prototype.visitUnion=dt(wl);ct.prototype.visitDenseUnion=dt(mc);ct.prototype.visitSparseUnion=dt(wc);ct.prototype.visitDictionary=dt(bl);ct.prototype.visitInterval=dt(_l);ct.prototype.visitIntervalDayTime=dt(bc);ct.prototype.visitIntervalYearMonth=dt(_c);ct.prototype.visitDuration=dt(Sl);ct.prototype.visitDurationSecond=dt(Sc);ct.prototype.visitDurationMillisecond=dt(Ic);ct.prototype.visitDurationMicrosecond=dt(Bc);ct.prototype.visitDurationNanosecond=dt(vc);ct.prototype.visitFixedSizeList=dt(Il);ct.prototype.visitMap=dt(dl);const fe=new ct,pe=Symbol.for("parent"),Ir=Symbol.for("rowIndex");class Ts{constructor(t,e){return this[pe]=t,this[Ir]=e,new Proxy(this,xl)}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[Ir],e=this[pe],n=e.type.children,s={};for(let i=-1,a=n.length;++i<a;)s[n[i].name]=ne.visit(e.children[i],t);return s}toString(){return`{${[...this].map(([t,e])=>`${hn(t)}: ${hn(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Bl(this[pe],this[Ir])}}class Bl{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(){const t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,ne.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}}Object.defineProperties(Ts.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[pe]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ir]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});class vl{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[pe].type.children.map(e=>e.name)}has(t,e){return t[pe].type.children.some(n=>n.name===e)}getOwnPropertyDescriptor(t,e){if(t[pe].type.children.some(n=>n.name===e))return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[pe].type.children.findIndex(s=>s.name===e);if(n!==-1){const s=ne.visit(t[pe].children[n],t[Ir]);return Reflect.set(t,e,s),s}}set(t,e,n){const s=t[pe].type.children.findIndex(i=>i.name===e);return s!==-1?(fe.visit(t[pe].children[s],t[Ir],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}}const xl=new vl;class nt extends St{}function ut(r){return(t,e)=>t.getValid(e)?r(t,e):null}const Al=(r,t)=>864e5*r[t],El=(r,t)=>null,xc=(r,t,e)=>{if(e+1>=t.length)return null;const n=Lt(t[e]),s=Lt(t[e+1]);return r.subarray(n,s)},Tl=({offset:r,values:t},e)=>{const n=r+e;return(t[n>>3]&1<<n%8)!==0},Ac=({values:r},t)=>Al(r,t),Ec=({values:r},t)=>Lt(r[t]),qe=({stride:r,values:t},e)=>t[r*e],Ml=({stride:r,values:t},e)=>rc(t[r*e]),Tc=({values:r},t)=>r[t],Nl=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),Mc=({values:r,valueOffsets:t},e)=>xc(r,t,e),Nc=({values:r,valueOffsets:t},e)=>{const n=xc(r,t,e);return n!==null?Ki(n):null},Fl=({values:r},t)=>r[t],Ol=({type:r,values:t},e)=>r.precision!==Jt.HALF?t[e]:rc(t[e]),kl=(r,t)=>r.type.unit===de.DAY?Ac(r,t):Ec(r,t),Fc=({values:r},t)=>1e3*Lt(r[t]),Oc=({values:r},t)=>Lt(r[t]),kc=({values:r},t)=>Fa(r[t],BigInt(1e3)),Dc=({values:r},t)=>Fa(r[t],BigInt(1e6)),Dl=(r,t)=>{switch(r.type.unit){case at.SECOND:return Fc(r,t);case at.MILLISECOND:return Oc(r,t);case at.MICROSECOND:return kc(r,t);case at.NANOSECOND:return Dc(r,t)}},Uc=({values:r},t)=>r[t],Lc=({values:r},t)=>r[t],Cc=({values:r},t)=>r[t],Rc=({values:r},t)=>r[t],Ul=(r,t)=>{switch(r.type.unit){case at.SECOND:return Uc(r,t);case at.MILLISECOND:return Lc(r,t);case at.MICROSECOND:return Cc(r,t);case at.NANOSECOND:return Rc(r,t)}},Ll=({values:r,stride:t},e)=>As.decimal(r.subarray(t*e,t*(e+1))),Cl=(r,t)=>{const{valueOffsets:e,stride:n,children:s}=r,{[t*n]:i,[t*n+1]:a}=e,d=s[0].slice(i,a-i);return new Ft([d])},Rl=(r,t)=>{const{valueOffsets:e,children:n}=r,{[t]:s,[t+1]:i}=e,a=n[0];return new Ms(a.slice(s,i-s))},Pl=(r,t)=>new Ts(r,t),$l=(r,t)=>r.type.mode===re.Dense?Pc(r,t):$c(r,t),Pc=(r,t)=>{const e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return ne.visit(n,r.valueOffsets[t])},$c=(r,t)=>{const e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return ne.visit(n,t)},zl=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},jl=(r,t)=>r.type.unit===Te.DAY_TIME?zc(r,t):jc(r,t),zc=({values:r},t)=>r.subarray(2*t,2*(t+1)),jc=({values:r},t)=>{const e=r[t],n=new Int32Array(2);return n[0]=Math.trunc(e/12),n[1]=Math.trunc(e%12),n},Vc=({values:r},t)=>r[t],Wc=({values:r},t)=>r[t],Zc=({values:r},t)=>r[t],Gc=({values:r},t)=>r[t],Vl=(r,t)=>{switch(r.type.unit){case at.SECOND:return Vc(r,t);case at.MILLISECOND:return Wc(r,t);case at.MICROSECOND:return Zc(r,t);case at.NANOSECOND:return Gc(r,t)}},Wl=(r,t)=>{const{stride:e,children:n}=r,i=n[0].slice(t*e,e);return new Ft([i])};nt.prototype.visitNull=ut(El);nt.prototype.visitBool=ut(Tl);nt.prototype.visitInt=ut(Fl);nt.prototype.visitInt8=ut(qe);nt.prototype.visitInt16=ut(qe);nt.prototype.visitInt32=ut(qe);nt.prototype.visitInt64=ut(Tc);nt.prototype.visitUint8=ut(qe);nt.prototype.visitUint16=ut(qe);nt.prototype.visitUint32=ut(qe);nt.prototype.visitUint64=ut(Tc);nt.prototype.visitFloat=ut(Ol);nt.prototype.visitFloat16=ut(Ml);nt.prototype.visitFloat32=ut(qe);nt.prototype.visitFloat64=ut(qe);nt.prototype.visitUtf8=ut(Nc);nt.prototype.visitLargeUtf8=ut(Nc);nt.prototype.visitBinary=ut(Mc);nt.prototype.visitLargeBinary=ut(Mc);nt.prototype.visitFixedSizeBinary=ut(Nl);nt.prototype.visitDate=ut(kl);nt.prototype.visitDateDay=ut(Ac);nt.prototype.visitDateMillisecond=ut(Ec);nt.prototype.visitTimestamp=ut(Dl);nt.prototype.visitTimestampSecond=ut(Fc);nt.prototype.visitTimestampMillisecond=ut(Oc);nt.prototype.visitTimestampMicrosecond=ut(kc);nt.prototype.visitTimestampNanosecond=ut(Dc);nt.prototype.visitTime=ut(Ul);nt.prototype.visitTimeSecond=ut(Uc);nt.prototype.visitTimeMillisecond=ut(Lc);nt.prototype.visitTimeMicrosecond=ut(Cc);nt.prototype.visitTimeNanosecond=ut(Rc);nt.prototype.visitDecimal=ut(Ll);nt.prototype.visitList=ut(Cl);nt.prototype.visitStruct=ut(Pl);nt.prototype.visitUnion=ut($l);nt.prototype.visitDenseUnion=ut(Pc);nt.prototype.visitSparseUnion=ut($c);nt.prototype.visitDictionary=ut(zl);nt.prototype.visitInterval=ut(jl);nt.prototype.visitIntervalDayTime=ut(zc);nt.prototype.visitIntervalYearMonth=ut(jc);nt.prototype.visitDuration=ut(Vl);nt.prototype.visitDurationSecond=ut(Vc);nt.prototype.visitDurationMillisecond=ut(Wc);nt.prototype.visitDurationMicrosecond=ut(Zc);nt.prototype.visitDurationNanosecond=ut(Gc);nt.prototype.visitFixedSizeList=ut(Wl);nt.prototype.visitMap=ut(Rl);const ne=new nt,yr=Symbol.for("keys"),Br=Symbol.for("vals"),gr=Symbol.for("kKeysAsStrings"),ns=Symbol.for("_kKeysAsStrings");class Ms{constructor(t){return this[yr]=new Ft([t.children[0]]).memoize(),this[Br]=t.children[1],new Proxy(this,new Gl)}get[gr](){return this[ns]||(this[ns]=Array.from(this[yr].toArray(),String))}[Symbol.iterator](){return new Zl(this[yr],this[Br])}get size(){return this[yr].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[yr],e=this[Br],n={};for(let s=-1,i=t.length;++s<i;)n[t.get(s)]=ne.visit(e,s);return n}toString(){return`{${[...this].map(([t,e])=>`${hn(t)}: ${hn(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class Zl{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){const t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),ne.visit(this.vals,t)]})}}class Gl{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[gr]}has(t,e){return t[gr].includes(e)}getOwnPropertyDescriptor(t,e){if(t[gr].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[gr].indexOf(e);if(n!==-1){const s=ne.visit(Reflect.get(t,Br),n);return Reflect.set(t,e,s),s}}set(t,e,n){const s=t[gr].indexOf(e);return s!==-1?(fe.visit(Reflect.get(t,Br),s,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}}Object.defineProperties(Ms.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[yr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Br]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ns]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let So;function Yc(r,t,e,n){const{length:s=0}=r;let i=typeof t!="number"?0:t,a=typeof e!="number"?s:e;return i<0&&(i=(i%s+s)%s),a<0&&(a=(a%s+s)%s),a<i&&(So=i,i=a,a=So),a>s&&(a=s),n?n(r,i,a):[i,a]}const Ns=(r,t)=>r<0?t+r:r,Io=r=>r!==r;function Or(r){if(typeof r!=="object"||r===null)return Io(r)?Io:e=>e===r;if(r instanceof Date){const e=r.valueOf();return n=>n instanceof Date?n.valueOf()===e:!1}return ArrayBuffer.isView(r)?e=>e?Vh(r,e):!1:r instanceof Map?Jl(r):Array.isArray(r)?Yl(r):r instanceof Ft?Hl(r):ql(r,!0)}function Yl(r){const t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Or(r[e]);return vi(t)}function Jl(r){let t=-1;const e=[];for(const n of r.values())e[++t]=Or(n);return vi(e)}function Hl(r){const t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Or(r.get(e));return vi(t)}function ql(r,t=!1){const e=Object.keys(r);if(!t&&e.length===0)return()=>!1;const n=[];for(let s=-1,i=e.length;++s<i;)n[s]=Or(r[e[s]]);return vi(n,e)}function vi(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return Kl(r,e);case Map:return Bo(r,e,e.keys());case Ms:case Ts:case Object:case void 0:return Bo(r,e,t||Object.keys(e))}return e instanceof Ft?Xl(r,e):!1}}function Kl(r,t){const 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 Xl(r,t){const 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 Bo(r,t,e){const n=e[Symbol.iterator](),s=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),i=t instanceof Map?t.values():Object.values(t)[Symbol.iterator]();let a=0;const c=r.length;let d=i.next(),f=n.next(),y=s.next();for(;a<c&&!f.done&&!y.done&&!d.done&&!(f.value!==y.value||!r[a](d.value));++a,f=n.next(),y=s.next(),d=i.next());return a===c&&f.done&&y.done&&d.done?!0:(n.return&&n.return(),s.return&&s.return(),i.return&&i.return(),!1)}function Jc(r,t,e,n){return(e&1<<n)!==0}function Ql(r,t,e,n){return(e&1<<n)>>n}function vo(r,t,e){const n=e.byteLength+7&-8;if(r>0||e.byteLength<n){const s=new Uint8Array(n);return s.set(r%8===0?e.subarray(r>>3):is(new Fs(e,r,t,null,Jc)).subarray(0,n)),s}return e}function is(r){const t=[];let e=0,n=0,s=0;for(const a of r)a&&(s|=1<<n),++n===8&&(t[e++]=s,s=n=0);(e===0||n>0)&&(t[e++]=s);const i=new Uint8Array(t.length+7&-8);return i.set(t),i}class Fs{constructor(t,e,n,s,i){this.bytes=t,this.length=n,this.context=s,this.get=i,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 ss(r,t,e){if(e-t<=0)return 0;if(e-t<8){let i=0;for(const a of new Fs(r,t,e-t,r,Ql))i+=a;return i}const n=e>>3<<3,s=t+(t%8===0?0:8-t%8);return ss(r,t,s)+ss(r,n,e)+td(r,s>>3,n-s>>3)}function td(r,t,e){let n=0,s=Math.trunc(t);const i=new DataView(r.buffer,r.byteOffset,r.byteLength),a=e===void 0?r.byteLength:s+e;for(;a-s>=4;)n+=Li(i.getUint32(s)),s+=4;for(;a-s>=2;)n+=Li(i.getUint16(s)),s+=2;for(;a-s>=1;)n+=Li(i.getUint8(s)),s+=1;return n}function Li(r){let t=Math.trunc(r);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const ed=-1;class Et{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:t}=this;return tt.isSparseUnion(t)?this.children.some(e=>e.nullable):tt.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0;const{valueOffsets:e,values:n,nullBitmap:s,typeIds:i}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),s&&(t+=s.byteLength),i&&(t+=i.byteLength),this.children.reduce((a,c)=>a+c.byteLength,t)}get nullCount(){if(tt.isUnion(this.type))return this.children.reduce((n,s)=>n+s.nullCount,0);let t=this._nullCount,e;return t<=ed&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-ss(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,s,i,a=[],c){this.type=t,this.children=a,this.dictionary=c,this.offset=Math.floor(Math.max(e||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(s||0,-1));let d;i instanceof Et?(this.stride=i.stride,this.values=i.values,this.typeIds=i.typeIds,this.nullBitmap=i.nullBitmap,this.valueOffsets=i.valueOffsets):(this.stride=Oe(t),i&&((d=i[0])&&(this.valueOffsets=d),(d=i[1])&&(this.values=d),(d=i[2])&&(this.nullBitmap=d),(d=i[3])&&(this.typeIds=d)))}getValid(t){const{type:e}=this;if(tt.isUnion(e)){const n=e,s=this.children[n.typeIdToChildIndex[this.typeIds[t]]],i=n.mode===re.Dense?this.valueOffsets[t]:t;return s.getValid(i)}if(this.nullable&&this.nullCount>0){const n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,e){let n;const{type:s}=this;if(tt.isUnion(s)){const i=s,a=this.children[i.typeIdToChildIndex[this.typeIds[t]]],c=i.mode===re.Dense?this.valueOffsets[t]:t;n=a.getValid(c),a.setValid(c,e)}else{let{nullBitmap:i}=this;const{offset:a,length:c}=this,d=a+t,f=1<<d%8,y=d>>3;(!i||i.byteLength<=y)&&(i=new Uint8Array((a+c+63&-64)>>3).fill(255),this.nullCount>0?(i.set(vo(a,c,this.nullBitmap),0),Object.assign(this,{nullBitmap:i})):Object.assign(this,{nullBitmap:i,_nullCount:0}));const B=i[y];n=(B&f)!==0,i[y]=e?B|f:B&~f}return n!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,n=this.length,s=this._nullCount,i=this,a=this.children){return new Et(t,e,n,s,i,a,this.dictionary)}slice(t,e){const{stride:n,typeId:s,children:i}=this,a=+(this._nullCount===0)-1,c=s===16?n:1,d=this._sliceBuffers(t,e,n,s);return this.clone(this.type,this.offset+t,e,a,d,i.length===0||this.valueOffsets?i:this._sliceChildren(i,c*t,c*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===E.Null)return this.clone(this.type,0,t,0);const{length:e,nullCount:n}=this,s=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);s[e>>3]=(1<<e-(e&-8))-1,n>0&&s.set(vo(this.offset,e,this.nullBitmap),0);const i=this.buffers;return i[Fe.VALIDITY]=s,this.clone(this.type,0,t,n+(t-e),i)}_sliceBuffers(t,e,n,s){let i;const{buffers:a}=this;return(i=a[Fe.TYPE])&&(a[Fe.TYPE]=i.subarray(t,t+e)),(i=a[Fe.OFFSET])&&(a[Fe.OFFSET]=i.subarray(t,t+e+1))||(i=a[Fe.DATA])&&(a[Fe.DATA]=s===6?i:i.subarray(n*t,n*(t+e))),a}_sliceChildren(t,e,n){return t.map(s=>s.slice(e,n))}}Et.prototype.children=Object.freeze([]);class an extends St{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{["type"]:e,["offset"]:n=0,["length"]:s=0}=t;return new Et(e,n,s,s)}visitBool(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.ArrayType,t.data),{["length"]:a=i.length>>3,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Et(e,n,a,c,[void 0,i,s])}visitInt(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.ArrayType,t.data),{["length"]:a=i.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Et(e,n,a,c,[void 0,i,s])}visitFloat(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.ArrayType,t.data),{["length"]:a=i.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Et(e,n,a,c,[void 0,i,s])}visitUtf8(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.data),i=It(t.nullBitmap),a=Dr(t.valueOffsets),{["length"]:c=a.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new Et(e,n,c,d,[a,s,i])}visitLargeUtf8(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.data),i=It(t.nullBitmap),a=uo(t.valueOffsets),{["length"]:c=a.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new Et(e,n,c,d,[a,s,i])}visitBinary(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.data),i=It(t.nullBitmap),a=Dr(t.valueOffsets),{["length"]:c=a.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new Et(e,n,c,d,[a,s,i])}visitLargeBinary(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.data),i=It(t.nullBitmap),a=uo(t.valueOffsets),{["length"]:c=a.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new Et(e,n,c,d,[a,s,i])}visitFixedSizeBinary(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.ArrayType,t.data),{["length"]:a=i.length/Oe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Et(e,n,a,c,[void 0,i,s])}visitDate(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.ArrayType,t.data),{["length"]:a=i.length/Oe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Et(e,n,a,c,[void 0,i,s])}visitTimestamp(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.ArrayType,t.data),{["length"]:a=i.length/Oe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Et(e,n,a,c,[void 0,i,s])}visitTime(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.ArrayType,t.data),{["length"]:a=i.length/Oe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Et(e,n,a,c,[void 0,i,s])}visitDecimal(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.ArrayType,t.data),{["length"]:a=i.length/Oe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Et(e,n,a,c,[void 0,i,s])}visitList(t){const{["type"]:e,["offset"]:n=0,["child"]:s}=t,i=It(t.nullBitmap),a=Dr(t.valueOffsets),{["length"]:c=a.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new Et(e,n,c,d,[a,void 0,i],[s])}visitStruct(t){const{["type"]:e,["offset"]:n=0,["children"]:s=[]}=t,i=It(t.nullBitmap),{length:a=s.reduce((d,{length:f})=>Math.max(d,f),0),nullCount:c=t.nullBitmap?-1:0}=t;return new Et(e,n,a,c,[void 0,void 0,i],s)}visitUnion(t){const{["type"]:e,["offset"]:n=0,["children"]:s=[]}=t,i=Mt(e.ArrayType,t.typeIds),{["length"]:a=i.length,["nullCount"]:c=-1}=t;if(tt.isSparseUnion(e))return new Et(e,n,a,c,[void 0,void 0,void 0,i],s);const d=Dr(t.valueOffsets);return new Et(e,n,a,c,[d,void 0,void 0,i],s)}visitDictionary(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.indices.ArrayType,t.data),{["dictionary"]:a=new Ft([new an().visit({type:e.dictionary})])}=t,{["length"]:c=i.length,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new Et(e,n,c,d,[void 0,i,s],[],a)}visitInterval(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.ArrayType,t.data),{["length"]:a=i.length/Oe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Et(e,n,a,c,[void 0,i,s])}visitDuration(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.ArrayType,t.data),{["length"]:a=i.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Et(e,n,a,c,[void 0,i,s])}visitFixedSizeList(t){const{["type"]:e,["offset"]:n=0,["child"]:s=new an().visit({type:e.valueType})}=t,i=It(t.nullBitmap),{["length"]:a=s.length/Oe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Et(e,n,a,c,[void 0,void 0,i],[s])}visitMap(t){const{["type"]:e,["offset"]:n=0,["child"]:s=new an().visit({type:e.childType})}=t,i=It(t.nullBitmap),a=Dr(t.valueOffsets),{["length"]:c=a.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new Et(e,n,c,d,[a,void 0,i],[s])}}const rd=new an;function _t(r){return rd.visit(r)}class xo{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){const t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}}function nd(r){return r.some(t=>t.nullable)}function Hc(r){return r.reduce((t,e)=>t+e.nullCount,0)}function qc(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function Kc(r,t,e,n){const s=[];for(let i=-1,a=r.length;++i<a;){const c=r[i],d=t[i],{length:f}=c;if(d>=n)break;if(e>=d+f)continue;if(d>=e&&d+f<=n){s.push(c);continue}const y=Math.max(0,e-d),B=Math.min(n-d,f);s.push(c.slice(y,B-y))}return s.length===0&&s.push(r[0].slice(0,0)),s}function Os(r,t,e,n){let s=0,i=0,a=t.length-1;do{if(s>=a-1)return e<t[a]?n(r,s,e-t[s]):null;i=s+Math.trunc((a-s)*.5),e<t[i]?a=i:s=i}while(s<a)}function ks(r,t){return r.getValid(t)}function ai(r){function t(e,n,s){return r(e[n],s)}return function(e){const n=this.data;return Os(n,this._offsets,e,t)}}function Xc(r){let t;function e(n,s,i){return r(n[s],i,t)}return function(n,s){const i=this.data;t=s;const a=Os(i,this._offsets,n,e);return t=void 0,a}}function Qc(r){let t;function e(n,s,i){let a=i,c=0,d=0;for(let f=s-1,y=n.length;++f<y;){const B=n[f];if(~(c=r(B,t,a)))return d+c;a=0,d+=B.length}return-1}return function(n,s){t=n;const i=this.data,a=typeof s!="number"?e(i,0,0):Os(i,this._offsets,s,e);return t=void 0,a}}class it extends St{}function id(r,t){return t===null&&r.length>0?0:-1}function sd(r,t){const{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(const s of new Fs(e,r.offset+(t||0),r.length,e,Jc)){if(!s)return n;++n}return-1}function ft(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case E.Union:break;case E.Dictionary:break;default:return sd(r,e)}const n=ne.getVisitFn(r),s=Or(t);for(let i=(e||0)-1,a=r.length;++i<a;)if(s(n(r,i)))return i;return-1}function tu(r,t,e){const n=ne.getVisitFn(r),s=Or(t);for(let i=(e||0)-1,a=r.length;++i<a;)if(s(n(r,i)))return i;return-1}it.prototype.visitNull=id;it.prototype.visitBool=ft;it.prototype.visitInt=ft;it.prototype.visitInt8=ft;it.prototype.visitInt16=ft;it.prototype.visitInt32=ft;it.prototype.visitInt64=ft;it.prototype.visitUint8=ft;it.prototype.visitUint16=ft;it.prototype.visitUint32=ft;it.prototype.visitUint64=ft;it.prototype.visitFloat=ft;it.prototype.visitFloat16=ft;it.prototype.visitFloat32=ft;it.prototype.visitFloat64=ft;it.prototype.visitUtf8=ft;it.prototype.visitLargeUtf8=ft;it.prototype.visitBinary=ft;it.prototype.visitLargeBinary=ft;it.prototype.visitFixedSizeBinary=ft;it.prototype.visitDate=ft;it.prototype.visitDateDay=ft;it.prototype.visitDateMillisecond=ft;it.prototype.visitTimestamp=ft;it.prototype.visitTimestampSecond=ft;it.prototype.visitTimestampMillisecond=ft;it.prototype.visitTimestampMicrosecond=ft;it.prototype.visitTimestampNanosecond=ft;it.prototype.visitTime=ft;it.prototype.visitTimeSecond=ft;it.prototype.visitTimeMillisecond=ft;it.prototype.visitTimeMicrosecond=ft;it.prototype.visitTimeNanosecond=ft;it.prototype.visitDecimal=ft;it.prototype.visitList=ft;it.prototype.visitStruct=ft;it.prototype.visitUnion=ft;it.prototype.visitDenseUnion=tu;it.prototype.visitSparseUnion=tu;it.prototype.visitDictionary=ft;it.prototype.visitInterval=ft;it.prototype.visitIntervalDayTime=ft;it.prototype.visitIntervalYearMonth=ft;it.prototype.visitDuration=ft;it.prototype.visitDurationSecond=ft;it.prototype.visitDurationMillisecond=ft;it.prototype.visitDurationMicrosecond=ft;it.prototype.visitDurationNanosecond=ft;it.prototype.visitFixedSizeList=ft;it.prototype.visitMap=ft;const ci=new it;class st extends St{}function ht(r){const{type:t}=r;if(r.nullCount===0&&r.stride===1&&(tt.isInt(t)&&t.bitWidth!==64||tt.isTime(t)&&t.bitWidth!==64||tt.isFloat(t)&&t.precision!==Jt.HALF))return new xo(r.data.length,n=>{const s=r.data[n];return s.values.subarray(0,s.length)[Symbol.iterator]()});let e=0;return new xo(r.data.length,n=>{const i=r.data[n].length,a=r.slice(e,e+i);return e+=i,new od(a)})}class od{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}}st.prototype.visitNull=ht;st.prototype.visitBool=ht;st.prototype.visitInt=ht;st.prototype.visitInt8=ht;st.prototype.visitInt16=ht;st.prototype.visitInt32=ht;st.prototype.visitInt64=ht;st.prototype.visitUint8=ht;st.prototype.visitUint16=ht;st.prototype.visitUint32=ht;st.prototype.visitUint64=ht;st.prototype.visitFloat=ht;st.prototype.visitFloat16=ht;st.prototype.visitFloat32=ht;st.prototype.visitFloat64=ht;st.prototype.visitUtf8=ht;st.prototype.visitLargeUtf8=ht;st.prototype.visitBinary=ht;st.prototype.visitLargeBinary=ht;st.prototype.visitFixedSizeBinary=ht;st.prototype.visitDate=ht;st.prototype.visitDateDay=ht;st.prototype.visitDateMillisecond=ht;st.prototype.visitTimestamp=ht;st.prototype.visitTimestampSecond=ht;st.prototype.visitTimestampMillisecond=ht;st.prototype.visitTimestampMicrosecond=ht;st.prototype.visitTimestampNanosecond=ht;st.prototype.visitTime=ht;st.prototype.visitTimeSecond=ht;st.prototype.visitTimeMillisecond=ht;st.prototype.visitTimeMicrosecond=ht;st.prototype.visitTimeNanosecond=ht;st.prototype.visitDecimal=ht;st.prototype.visitList=ht;st.prototype.visitStruct=ht;st.prototype.visitUnion=ht;st.prototype.visitDenseUnion=ht;st.prototype.visitSparseUnion=ht;st.prototype.visitDictionary=ht;st.prototype.visitInterval=ht;st.prototype.visitIntervalDayTime=ht;st.prototype.visitIntervalYearMonth=ht;st.prototype.visitDuration=ht;st.prototype.visitDurationSecond=ht;st.prototype.visitDurationMillisecond=ht;st.prototype.visitDurationMicrosecond=ht;st.prototype.visitDurationNanosecond=ht;st.prototype.visitFixedSizeList=ht;st.prototype.visitMap=ht;const Ds=new st;var eu;const ru={},nu={};class Ft{constructor(t){var e,n,s;const i=t[0]instanceof Ft?t.flatMap(c=>c.data):t;if(i.length===0||i.some(c=>!(c instanceof Et)))throw new TypeError("Vector constructor expects an Array of Data instances.");const a=(e=i[0])===null||e===void 0?void 0:e.type;switch(i.length){case 0:this._offsets=[0];break;case 1:{const{get:c,set:d,indexOf:f}=ru[a.typeId],y=i[0];this.isValid=B=>ks(y,B),this.get=B=>c(y,B),this.set=(B,L)=>d(y,B,L),this.indexOf=B=>f(y,B),this._offsets=[0,y.length];break}default:Object.setPrototypeOf(this,nu[a.typeId]),this._offsets=qc(i);break}this.data=i,this.type=a,this.stride=Oe(a),this.numChildren=(s=(n=a.children)===null||n===void 0?void 0:n.length)!==null&&s!==void 0?s:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return nd(this.data)}get nullCount(){return Hc(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${E[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(Ns(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return Ds.visit(this)}concat(...t){return new Ft(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new Ft(Yc(this,t,e,({data:n,_offsets:s},i,a)=>Kc(n,s,i,a)))}toJSON(){return[...this]}toArray(){const{type:t,data:e,length:n,stride:s,ArrayType:i}=this;switch(t.typeId){case E.Int:case E.Float:case E.Decimal:case E.Time:case E.Timestamp:switch(e.length){case 0:return new i;case 1:return e[0].values.subarray(0,n*s);default:return e.reduce((a,{values:c,length:d})=>(a.array.set(c.subarray(0,d*s),a.offset),a.offset+=d*s,a),{array:new i(n*s),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 Ft(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return tt.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(tt.isDictionary(this.type)){const t=new ui(this.data[0].dictionary),e=this.data.map(n=>{const s=n.clone();return s.dictionary=t,s});return new Ft(e)}return new ui(this)}unmemoize(){if(tt.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),e=this.data.map(n=>{const s=n.clone();return s.dictionary=t,s});return new Ft(e)}return this}}eu=Symbol.toStringTag;Ft[eu]=(r=>{r.type=tt.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;const t=Object.keys(E).map(e=>E[e]).filter(e=>typeof e=="number"&&e!==E.NONE);for(const e of t){const n=ne.getVisitFnByTypeId(e),s=fe.getVisitFnByTypeId(e),i=ci.getVisitFnByTypeId(e);ru[e]={get:n,set:s,indexOf:i},nu[e]=Object.create(r,{isValid:{value:ai(ks)},get:{value:ai(ne.getVisitFnByTypeId(e))},set:{value:Xc(fe.getVisitFnByTypeId(e))},indexOf:{value:Qc(ci.getVisitFnByTypeId(e))}})}return"Vector"})(Ft.prototype);class ui extends Ft{constructor(t){super(t.data);const e=this.get,n=this.set,s=this.slice,i=new Array(this.length);Object.defineProperty(this,"get",{value(a){const c=i[a];if(c!==void 0)return c;const d=e.call(this,a);return i[a]=d,d}}),Object.defineProperty(this,"set",{value(a,c){n.call(this,a,c),i[a]=c}}),Object.defineProperty(this,"slice",{value:(a,c)=>new ui(s.call(this,a,c))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Ft(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class os{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,s){return t.prep(8,24),t.writeInt64(BigInt(s??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(e??0)),t.offset()}}class ie{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 ie).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+xt),(e||new ie).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):zt.V1}schema(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new Se).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new os).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){const n=this.bb.__offset(this.bb_pos,10);return n?(e||new os).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,12);return n?(e||new jt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,zt.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)}}class vt{constructor(t=[],e,n,s=zt.V5){this.fields=t||[],this.metadata=e||new Map,n||(n=as(this.fields)),this.dictionaries=n,this.metadataVersion=s}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){const e=new Set(t),n=this.fields.filter(s=>e.has(s.name));return new vt(n,this.metadata)}selectAt(t){const e=t.map(n=>this.fields[n]).filter(Boolean);return new vt(e,this.metadata)}assign(...t){const e=t[0]instanceof vt?t[0]:Array.isArray(t[0])?new vt(t[0]):new vt(t),n=[...this.fields],s=Bn(Bn(new Map,this.metadata),e.metadata),i=e.fields.filter(c=>{const d=n.findIndex(f=>f.name===c.name);return~d?(n[d]=c.clone({metadata:Bn(Bn(new Map,n[d].metadata),c.metadata)}))&&!1:!0}),a=as(i,new Map);return new vt([...n,...i],s,new Map([...this.dictionaries,...a]))}}vt.prototype.fields=null;vt.prototype.metadata=null;vt.prototype.dictionaries=null;class Ct{static new(...t){let[e,n,s,i]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],n===void 0&&(n=t[0].type),s===void 0&&(s=t[0].nullable),i===void 0&&(i=t[0].metadata)),new Ct(`${e}`,n,s,i)}constructor(t,e,n=!1,s){this.name=t,this.type=e,this.nullable=n,this.metadata=s||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,n,s,i]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,n=this.type,s=this.nullable,i=this.metadata]=t:{name:e=this.name,type:n=this.type,nullable:s=this.nullable,metadata:i=this.metadata}=t[0],Ct.new(e,n,s,i)}}Ct.prototype.type=null;Ct.prototype.name=null;Ct.prototype.nullable=null;Ct.prototype.metadata=null;function Bn(r,t){return new Map([...r||new Map,...t||new Map])}function as(r,t=new Map){for(let e=-1,n=r.length;++e<n;){const i=r[e].type;if(tt.isDictionary(i)){if(!t.has(i.id))t.set(i.id,i.dictionary);else if(t.get(i.id)!==i.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}i.children&&i.children.length>0&&as(i.children,t)}return t}var ad=Ea,cd=xr;class Us{static decode(t){t=new cd(It(t));const e=ie.getRootAsFooter(t),n=vt.decode(e.schema(),new Map,e.version());return new ud(n,e)}static encode(t){const e=new ad,n=vt.encode(e,t.schema);ie.startRecordBatchesVector(e,t.numRecordBatches);for(const a of[...t.recordBatches()].slice().reverse())Tr.encode(e,a);const s=e.endVector();ie.startDictionariesVector(e,t.numDictionaries);for(const a of[...t.dictionaryBatches()].slice().reverse())Tr.encode(e,a);const i=e.endVector();return ie.startFooter(e),ie.addSchema(e,n),ie.addVersion(e,zt.V5),ie.addRecordBatches(e,s),ie.addDictionaries(e,i),ie.finishFooterBuffer(e,ie.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=zt.V5,n,s){this.schema=t,this.version=e,n&&(this._recordBatches=n),s&&(this._dictionaryBatches=s)}*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}}class ud extends Us{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){const e=this._footer.recordBatches(t);if(e)return Tr.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){const e=this._footer.dictionaries(t);if(e)return Tr.decode(e)}return null}}class Tr{static decode(t){return new Tr(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){const{metaDataLength:n}=e,s=BigInt(e.offset),i=BigInt(e.bodyLength);return os.createBlock(t,s,n,i)}constructor(t,e,n){this.metaDataLength=t,this.offset=Lt(n),this.bodyLength=Lt(e)}}const Rt=Object.freeze({done:!0,value:void 0});class Ao{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class iu{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())}}class hd extends iu{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return gt(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){const{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(Rt);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return ce.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return ce.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return gt(this,void 0,void 0,function*(){return yield this.abort(t),Rt})}return(t){return gt(this,void 0,void 0,function*(){return yield this.close(),Rt})}read(t){return gt(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return gt(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(Rt)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class ld extends hd{write(t){if((t=It(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Ki(this.toUint8Array(!0)):this.toUint8Array(!1).then(Ki)}toUint8Array(t=!1){return t?Ee(this._values)[0]:gt(this,void 0,void 0,function*(){var e,n,s,i;const a=[];let c=0;try{for(var d=!0,f=br(this),y;y=yield f.next(),e=y.done,!e;d=!0){i=y.value,d=!1;const B=i;a.push(B),c+=B.byteLength}}catch(B){n={error:B}}finally{try{!d&&!e&&(s=f.return)&&(yield s.call(f))}finally{if(n)throw n.error}}return Ee(a,c)[0]})}}class hi{constructor(t){t&&(this.source=new dd(ce.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class Mr{constructor(t){t instanceof Mr?this.source=t.source:t instanceof ld?this.source=new Xe(ce.fromAsyncIterable(t)):va(t)?this.source=new Xe(ce.fromNodeStream(t)):vs(t)?this.source=new Xe(ce.fromDOMStream(t)):Ia(t)?this.source=new Xe(ce.fromDOMStream(t.body)):Bi(t)?this.source=new Xe(ce.fromIterable(t)):un(t)?this.source=new Xe(ce.fromAsyncIterable(t)):Bs(t)&&(this.source=new Xe(ce.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class dd{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)||Rt)}return(t){return Object.create(this.source.return&&this.source.return(t)||Rt)}}class Xe{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return gt(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return gt(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return gt(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return gt(this,arguments,void 0,function*(e,n="read"){return yield this.source.next({cmd:n,size:e})})}throw(t){return gt(this,void 0,void 0,function*(){const e=this.source.throw&&(yield this.source.throw(t))||Rt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return gt(this,void 0,void 0,function*(){const e=this.source.return&&(yield this.source.return(t))||Rt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}}class Eo extends hi{constructor(t,e){super(),this.position=0,this.buffer=It(t),this.size=e===void 0?this.buffer.byteLength:e}readInt32(t){const{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){const{buffer:e,size:n,position:s}=this;return e&&s<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,s+Math.min(n-s,t)),e.subarray(s,this.position)):null}readAt(t,e){const n=this.buffer,s=Math.min(this.size,t+e);return n?n.subarray(t,s):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}}}class li extends Mr{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=gt(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return gt(this,void 0,void 0,function*(){const{buffer:e,byteOffset:n}=yield this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)})}seek(t){return gt(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 gt(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:e,size:n,position:s}=this;if(e&&s<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let i=s,a=0,c=0;const d=Math.min(n,i+Math.min(n-i,t)),f=new Uint8Array(Math.max(0,(this.position=d)-i));for(;(i+=c)<d&&(a+=c)<f.byteLength;)({bytesRead:c}=yield e.read(f,a,f.byteLength-a,i));return f}return null})}readAt(t,e){return gt(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:n,size:s}=this;if(n&&t+e<s){const i=Math.min(s,t+e),a=new Uint8Array(i-t);return(yield n.read(a,0,e,t)).buffer}return new Uint8Array(e)})}close(){return gt(this,void 0,void 0,function*(){const t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return gt(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return gt(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}}const fd=65536;function wr(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}const Nr=8,Ls=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class su{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){const 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]);let s=e[3]*n[3];this.buffer[0]=s&65535;let i=s>>>16;return s=e[2]*n[3],i+=s,s=e[3]*n[2]>>>0,i+=s,this.buffer[0]+=i<<16,this.buffer[1]=i>>>0<s?fd:0,this.buffer[1]+=i>>>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){const 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`${wr(this.buffer[1])} ${wr(this.buffer[0])}`}}class Tt extends su{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return Tt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return Tt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){const n=t.length,s=new Tt(e);for(let i=0;i<n;){const a=Nr<n-i?Nr:n-i,c=new Tt(new Uint32Array([Number.parseInt(t.slice(i,i+a),10),0])),d=new Tt(new Uint32Array([Ls[a],0]));s.times(d),s.plus(c),i+=a}return s}static convertArray(t){const e=new Uint32Array(t.length*2);for(let n=-1,s=t.length;++n<s;)Tt.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new Tt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Tt(new Uint32Array(t.buffer)).plus(e)}}class te extends su{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){const 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 te.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return te.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){const n=t.startsWith("-"),s=t.length,i=new te(e);for(let a=n?1:0;a<s;){const c=Nr<s-a?Nr:s-a,d=new te(new Uint32Array([Number.parseInt(t.slice(a,a+c),10),0])),f=new te(new Uint32Array([Ls[c],0]));i.times(f),i.plus(d),a+=c}return n?i.negate():i}static convertArray(t){const e=new Uint32Array(t.length*2);for(let n=-1,s=t.length;++n<s;)te.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new te(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new te(new Uint32Array(t.buffer)).plus(e)}}class Ie{constructor(t){this.buffer=t}high(){return new te(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new te(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){const e=new Tt(new Uint32Array([this.buffer[3],0])),n=new Tt(new Uint32Array([this.buffer[2],0])),s=new Tt(new Uint32Array([this.buffer[1],0])),i=new Tt(new Uint32Array([this.buffer[0],0])),a=new Tt(new Uint32Array([t.buffer[3],0])),c=new Tt(new Uint32Array([t.buffer[2],0])),d=new Tt(new Uint32Array([t.buffer[1],0])),f=new Tt(new Uint32Array([t.buffer[0],0]));let y=Tt.multiply(i,f);this.buffer[0]=y.low();const B=new Tt(new Uint32Array([y.high(),0]));return y=Tt.multiply(s,f),B.plus(y),y=Tt.multiply(i,d),B.plus(y),this.buffer[1]=B.low(),this.buffer[3]=B.lessThan(y)?1:0,this.buffer[2]=B.high(),new Tt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Tt.multiply(n,f)).plus(Tt.multiply(s,d)).plus(Tt.multiply(i,c)),this.buffer[3]+=Tt.multiply(e,f).plus(Tt.multiply(n,d)).plus(Tt.multiply(s,c)).plus(Tt.multiply(i,a)).low(),this}plus(t){const 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`${wr(this.buffer[3])} ${wr(this.buffer[2])} ${wr(this.buffer[1])} ${wr(this.buffer[0])}`}static multiply(t,e){return new Ie(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Ie(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return Ie.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return Ie.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){const n=t.startsWith("-"),s=t.length,i=new Ie(e);for(let a=n?1:0;a<s;){const c=Nr<s-a?Nr:s-a,d=new Ie(new Uint32Array([Number.parseInt(t.slice(a,a+c),10),0,0,0])),f=new Ie(new Uint32Array([Ls[c],0,0,0]));i.times(f),i.plus(d),a+=c}return n?i.negate():i}static convertArray(t){const e=new Uint32Array(t.length*4);for(let n=-1,s=t.length;++n<s;)Ie.from(t[n],new Uint32Array(e.buffer,e.byteOffset+4*4*n,4));return e}}class ou extends St{constructor(t,e,n,s,i=zt.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=s,this.metadataVersion=i}visit(t){return super.visit(t instanceof Ct?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return _t({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({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 _t({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 _t({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 _t({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 _t({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({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 _t({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<zt.V5&&this.readNullBitmap(t,n),t.mode===re.Sparse?this.visitSparseUnion(t,{length:e,nullCount:n}):this.visitDenseUnion(t,{length:e,nullCount:n})}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({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 _t({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({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 _t({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({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 _t({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)}}class pd extends ou{constructor(t,e,n,s,i){super(new Uint8Array(0),e,n,s,i),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):is(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return Mt(Uint8Array,Mt(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return Mt(Uint8Array,Mt(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){const{sources:n}=this;return tt.isTimestamp(t)||(tt.isInt(t)||tt.isTime(t))&&t.bitWidth===64||tt.isDuration(t)||tt.isDate(t)&&t.unit===de.MILLISECOND?Mt(Uint8Array,te.convertArray(n[e])):tt.isDecimal(t)?Mt(Uint8Array,Ie.convertArray(n[e])):tt.isBinary(t)||tt.isLargeBinary(t)||tt.isFixedSizeBinary(t)?yd(n[e]):tt.isBool(t)?is(n[e]):tt.isUtf8(t)||tt.isLargeUtf8(t)?Is(n[e].join("")):Mt(Uint8Array,Mt(t.ArrayType,n[e].map(s=>+s)))}}function yd(r){const 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}class ot extends St{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,s)=>this.compareFields(n,e[s]))}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 Xt(r,t){return t instanceof r.constructor}function ir(r,t){return r===t||Xt(r,t)}function Pe(r,t){return r===t||Xt(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function xi(r,t){return r===t||Xt(r,t)&&r.precision===t.precision}function gd(r,t){return r===t||Xt(r,t)&&r.byteWidth===t.byteWidth}function Cs(r,t){return r===t||Xt(r,t)&&r.unit===t.unit}function gn(r,t){return r===t||Xt(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function mn(r,t){return r===t||Xt(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function md(r,t){return r===t||Xt(r,t)&&r.children.length===t.children.length&&He.compareManyFields(r.children,t.children)}function wd(r,t){return r===t||Xt(r,t)&&r.children.length===t.children.length&&He.compareManyFields(r.children,t.children)}function Rs(r,t){return r===t||Xt(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&He.compareManyFields(r.children,t.children)}function bd(r,t){return r===t||Xt(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&He.visit(r.indices,t.indices)&&He.visit(r.dictionary,t.dictionary)}function Ps(r,t){return r===t||Xt(r,t)&&r.unit===t.unit}function wn(r,t){return r===t||Xt(r,t)&&r.unit===t.unit}function _d(r,t){return r===t||Xt(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&He.compareManyFields(r.children,t.children)}function Sd(r,t){return r===t||Xt(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&He.compareManyFields(r.children,t.children)}ot.prototype.visitNull=ir;ot.prototype.visitBool=ir;ot.prototype.visitInt=Pe;ot.prototype.visitInt8=Pe;ot.prototype.visitInt16=Pe;ot.prototype.visitInt32=Pe;ot.prototype.visitInt64=Pe;ot.prototype.visitUint8=Pe;ot.prototype.visitUint16=Pe;ot.prototype.visitUint32=Pe;ot.prototype.visitUint64=Pe;ot.prototype.visitFloat=xi;ot.prototype.visitFloat16=xi;ot.prototype.visitFloat32=xi;ot.prototype.visitFloat64=xi;ot.prototype.visitUtf8=ir;ot.prototype.visitLargeUtf8=ir;ot.prototype.visitBinary=ir;ot.prototype.visitLargeBinary=ir;ot.prototype.visitFixedSizeBinary=gd;ot.prototype.visitDate=Cs;ot.prototype.visitDateDay=Cs;ot.prototype.visitDateMillisecond=Cs;ot.prototype.visitTimestamp=gn;ot.prototype.visitTimestampSecond=gn;ot.prototype.visitTimestampMillisecond=gn;ot.prototype.visitTimestampMicrosecond=gn;ot.prototype.visitTimestampNanosecond=gn;ot.prototype.visitTime=mn;ot.prototype.visitTimeSecond=mn;ot.prototype.visitTimeMillisecond=mn;ot.prototype.visitTimeMicrosecond=mn;ot.prototype.visitTimeNanosecond=mn;ot.prototype.visitDecimal=ir;ot.prototype.visitList=md;ot.prototype.visitStruct=wd;ot.prototype.visitUnion=Rs;ot.prototype.visitDenseUnion=Rs;ot.prototype.visitSparseUnion=Rs;ot.prototype.visitDictionary=bd;ot.prototype.visitInterval=Ps;ot.prototype.visitIntervalDayTime=Ps;ot.prototype.visitIntervalYearMonth=Ps;ot.prototype.visitDuration=wn;ot.prototype.visitDurationSecond=wn;ot.prototype.visitDurationMillisecond=wn;ot.prototype.visitDurationMicrosecond=wn;ot.prototype.visitDurationNanosecond=wn;ot.prototype.visitFixedSizeList=_d;ot.prototype.visitMap=Sd;const He=new ot;function Id(r,t){return He.compareSchemas(r,t)}function Ci(r,t){return Bd(r,t.map(e=>e.data.concat()))}function Bd(r,t){const e=[...r.fields],n=[],s={numBatches:t.reduce((B,L)=>Math.max(B,L.length),0)};let i=0,a=0,c=-1;const d=t.length;let f,y=[];for(;s.numBatches-- >0;){for(a=Number.POSITIVE_INFINITY,c=-1;++c<d;)y[c]=f=t[c].shift(),a=Math.min(a,f?f.length:a);Number.isFinite(a)&&(y=vd(e,a,y,t,s),a>0&&(n[i++]=_t({type:new Kt(e),length:a,nullCount:0,children:y.slice()})))}return[r=r.assign(e),n.map(B=>new ye(r,B))]}function vd(r,t,e,n,s){var i;const a=(t+63&-64)>>3;for(let c=-1,d=n.length;++c<d;){const f=e[c],y=f?.length;if(y>=t)y===t?e[c]=f:(e[c]=f.slice(0,t),s.numBatches=Math.max(s.numBatches,n[c].unshift(f.slice(t,y-t))));else{const B=r[c];r[c]=B.clone({nullable:!0}),e[c]=(i=f?._changeLengthAndBackfillNullBitmap(t))!==null&&i!==void 0?i:_t({type:B.type,length:t,nullCount:t,nullBitmap:new Uint8Array(a)})}}return e}var au;class le{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new vt([]),this._offsets=[0],this;let s,i;t[0]instanceof vt&&(s=t.shift()),t.at(-1)instanceof Uint32Array&&(i=t.pop());const a=d=>{if(d){if(d instanceof ye)return[d];if(d instanceof le)return d.batches;if(d instanceof Et){if(d.type instanceof Kt)return[new ye(new vt(d.type.children),d)]}else{if(Array.isArray(d))return d.flatMap(f=>a(f));if(typeof d[Symbol.iterator]=="function")return[...d].flatMap(f=>a(f));if(typeof d=="object"){const f=Object.keys(d),y=f.map(x=>new Ft([d[x]])),B=s??new vt(f.map((x,M)=>new Ct(String(x),y[M].type,y[M].nullable))),[,L]=Ci(B,y);return L.length===0?[new ye(d)]:L}}}return[]},c=t.flatMap(d=>a(d));if(s=(n=s??((e=c[0])===null||e===void 0?void 0:e.schema))!==null&&n!==void 0?n:new vt([]),!(s instanceof vt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const d of c){if(!(d instanceof ye))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Id(s,d.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=s,this.batches=c,this._offsets=i??qc(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=Hc(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(Ns(t,this.numRows))}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?Ds.visit(new Ft(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class Fr extends Error{constructor(t,e={}){super(`Node not found: ${t}`,e),this.name="NodeNotFoundError"}}class bi extends Error{constructor(t){super(`Missing key: ${t}`),this.name="KeyError"}}class $n{#t;constructor(t,e,n){typeof t=="number"?this.#t=new Uint8Array(t):t instanceof ArrayBuffer?this.#t=new Uint8Array(t,e,n):this.#t=new Uint8Array(Array.from(t,s=>s?1:0))}get BYTES_PER_ELEMENT(){return 1}get byteOffset(){return this.#t.byteOffset}get byteLength(){return this.#t.byteLength}get buffer(){return this.#t.buffer}get length(){return this.#t.length}get(t){let e=this.#t[t];return typeof e=="number"?e!==0:e}set(t,e){this.#t[t]=e?1:0}fill(t){this.#t.fill(t?1:0)}*[Symbol.iterator](){for(let t=0;t<this.length;t++)yield this.get(t)}}class ds{_data;chars;#t;constructor(t,e,n,s){if(this.chars=t,this.#t=new TextEncoder,typeof e=="number")this._data=new Uint8Array(e*t);else if(e instanceof ArrayBuffer)s&&(s=s*t),this._data=new Uint8Array(e,n,s);else{let i=Array.from(e);this._data=new Uint8Array(i.length*t);for(let c=0;c<i.length;c++)this.set(c,i[c])}}get BYTES_PER_ELEMENT(){return this.chars}get byteOffset(){return this._data.byteOffset}get byteLength(){return this._data.byteLength}get buffer(){return this._data.buffer}get length(){return this.byteLength/this.BYTES_PER_ELEMENT}get(t){const e=new Uint8Array(this.buffer,this.byteOffset+this.chars*t,this.chars);return new TextDecoder().decode(e).replace(/\x00/g,"")}set(t,e){const n=new Uint8Array(this.buffer,this.byteOffset+this.chars*t,this.chars);n.fill(0),n.set(this.#t.encode(e))}fill(t){const e=this.#t.encode(t);for(let n=0;n<this.length;n++)this._data.set(e,n*this.chars)}*[Symbol.iterator](){for(let t=0;t<this.length;t++)yield this.get(t)}}class yn{#t;chars;constructor(t,e,n,s){if(this.chars=t,typeof e=="number")this.#t=new Int32Array(e*t);else if(e instanceof ArrayBuffer)s&&(s*=t),this.#t=new Int32Array(e,n,s);else{const i=e,c=new yn(t,1);this.#t=new Int32Array(function*(){for(let a of i)c.set(0,a),yield*c.#t}())}}get BYTES_PER_ELEMENT(){return this.#t.BYTES_PER_ELEMENT*this.chars}get byteLength(){return this.#t.byteLength}get byteOffset(){return this.#t.byteOffset}get buffer(){return this.#t.buffer}get length(){return this.#t.length/this.chars}get(t){const e=this.chars*t;let n="";for(let s=0;s<this.chars;s++)n+=String.fromCodePoint(this.#t[e+s]);return n.replace(/\u0000/g,"")}set(t,e){const n=this.chars*t,s=this.#t.subarray(n,n+this.chars);s.fill(0);for(let i=0;i<this.chars;i++)s[i]=e.codePointAt(i)??0}fill(t){this.set(0,t);let e=this.#t.subarray(0,this.chars);for(let n=1;n<this.length;n++)this.#t.set(e,n*this.chars)}*[Symbol.iterator](){for(let t=0;t<this.length;t++)yield this.get(t)}}function fs(r){const t=JSON.stringify(r,null,2);return new TextEncoder().encode(t)}function rr(r){const t=new TextDecoder().decode(r);return JSON.parse(t)}function qs(r,t){const e=t/2,n=t-1;let s=0;for(let i=0;i<r.length;i+=t)for(let c=0;c<e;c+=1)s=r[i+c],r[i+c]=r[i+n-c],r[i+n-c]=s}const ju={int8:Int8Array,int16:Int16Array,int32:Int32Array,int64:globalThis.BigInt64Array,uint8:Uint8Array,uint16:Uint16Array,uint32:Uint32Array,uint64:globalThis.BigUint64Array,float32:Float32Array,float64:Float64Array,bool:$n},Vu=/v2:([US])(\d+)/;function da(r){if(r==="v2:object")return globalThis.Array;let t=r.match(Vu);if(t){let[,n,s]=t;return(n==="U"?yn:ds).bind(null,Number(s))}let e=ju[r];return Yt(e,`Unknown or unsupported data_type: ${r}`),e}function tr(r,t){const e=r.length;typeof t=="string"&&(t=t==="C"?Array.from({length:e},(i,c)=>c):Array.from({length:e},(i,c)=>e-1-c)),Yt(e===t.length,"Order length must match the number of dimensions.");let n=1,s=new Array(e);for(let i=t.length-1;i>=0;i--)s[t[i]]=n,n*=r[t[i]];return s}function Wu({name:r,configuration:t}){if(r==="default"){const e=t?.separator??"/";return n=>["c",...n].join(e)}if(r==="v2"){const e=t?.separator??".";return n=>n.join(e)||"0"}throw new Error(`Unknown chunk key encoding: ${r}`)}function Zu(r){if(r==="|O")return{data_type:"v2:object"};let t=r.match(/^([<|>])(.*)$/);Yt(t,`Invalid dtype: ${r}`);let[,e,n]=t,s={b1:"bool",i1:"int8",u1:"uint8",i2:"int16",u2:"uint16",i4:"int32",u4:"uint32",i8:"int64",u8:"uint64",f4:"float32",f8:"float64"}[n]??(n.startsWith("S")||n.startsWith("U")?`v2:${n}`:void 0);return Yt(s,`Unsupported or unknown dtype: ${r}`),e==="|"?{data_type:s}:{data_type:s,endian:e==="<"?"little":"big"}}function Gu(r,t={}){let e=[],n=Zu(r.dtype);r.order==="F"&&e.push({name:"transpose",configuration:{order:"F"}}),"endian"in n&&n.endian==="big"&&e.push({name:"bytes",configuration:{endian:"big"}});for(let{id:s,...i}of r.filters??[])e.push({name:s,configuration:i});if(r.compressor){let{id:s,...i}=r.compressor;e.push({name:s,configuration:i})}return{zarr_format:3,node_type:"array",shape:r.shape,data_type:n.data_type,chunk_grid:{name:"regular",configuration:{chunk_shape:r.chunks}},chunk_key_encoding:{name:"v2",configuration:{separator:r.dimension_separator??"."}},codecs:e,fill_value:r.fill_value,attributes:t}}function Yu(r,t={}){return{zarr_format:3,node_type:"group",attributes:t}}function Ju(r,t){if(t!=="number"&&t!=="bigint"&&t!=="boolean"&&t!=="object"&&t!=="string")return r===t;let e=r==="bool";if(t==="boolean")return e;let n=r.startsWith("v2:U")||r.startsWith("v2:S");if(t==="string")return n;let s=r==="int64"||r==="uint64";if(t==="bigint")return s;let i=r==="v2:object";return t==="object"?i:!n&&!s&&!e&&!i}function Hu(r){return r?.name==="sharding_indexed"}function fa(r){return(r.data_type==="uint64"||r.data_type==="int64")&&r.fill_value!=null?BigInt(r.fill_value):r.fill_value}function pa(r,...t){if(!t.some(e=>r instanceof e))throw r}function Yt(r,t=""){if(!r)throw new Error(t)}class ps{kind="array_to_array";constructor(t,e){Yt(t.keepbits>=0,"keepbits must be zero or positive")}static fromConfig(t,e){return new ps(t,e)}encode(t){throw new Error("`BitroundCodec.encode` is not implemented. Please open an issue at https://github.com/manzt/zarrita.js/issues.")}decode(t){return t}}const Ks=qu();function qu(){const r=new Uint32Array([305419896]);return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)[0]!==18}function Xs(r){return"BYTES_PER_ELEMENT"in r?r.BYTES_PER_ELEMENT:4}class _i{kind="array_to_bytes";#t;#e;#n;#i;#r;constructor(t,e){this.#r=t?.endian,this.#e=da(e.data_type),this.#i=e.shape,this.#t=tr(e.shape,"C");const n=new this.#e(0);this.#n=n.BYTES_PER_ELEMENT}static fromConfig(t,e){return new _i(t,e)}encode(t){let e=new Uint8Array(t.data.buffer);return Ks&&this.#r==="big"&&qs(e,Xs(this.#e)),e}decode(t){return Ks&&this.#r==="big"&&qs(t,Xs(this.#e)),{data:new this.#e(t.buffer,t.byteOffset,t.byteLength/this.#n),shape:this.#i,stride:this.#t}}}class ys{kind="bytes_to_bytes";static fromConfig(){return new ys}encode(t){throw new Error("Not implemented")}decode(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength-4)}}function Ku(r,t){return Yt(!Number.isNaN(t),"JsonCodec allow_nan is false but NaN was encountered during encoding."),Yt(t!==Number.POSITIVE_INFINITY,"JsonCodec allow_nan is false but Infinity was encountered during encoding."),Yt(t!==Number.NEGATIVE_INFINITY,"JsonCodec allow_nan is false but -Infinity was encountered during encoding."),t}function Xu(r,t){return t instanceof Object&&!Array.isArray(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t}class gs{configuration;kind="array_to_bytes";#t;#e;constructor(t={}){this.configuration=t;const{encoding:e="utf-8",skipkeys:n=!1,ensure_ascii:s=!0,check_circular:i=!0,allow_nan:c=!0,sort_keys:a=!0,indent:d,strict:f=!0}=t;let y=t.separators;y||(d?y=[", ",": "]:y=[",",":"]),this.#t={encoding:e,skipkeys:n,ensure_ascii:s,check_circular:i,allow_nan:c,indent:d,separators:y,sort_keys:a},this.#e={strict:f}}static fromConfig(t){return new gs(t)}encode(t){const{indent:e,encoding:n,ensure_ascii:s,check_circular:i,allow_nan:c,sort_keys:a}=this.#t;Yt(n==="utf-8","JsonCodec does not yet support non-utf-8 encoding.");const d=[];Yt(i,"JsonCodec does not yet support skipping the check for circular references during encoding."),c||d.push(Ku),a&&d.push(Xu);const f=Array.from(t.data);f.push("|O"),f.push(t.shape);let y;d.length&&(y=(L,x)=>{let M=x;for(let U of d)M=U(L,M);return M});let B=JSON.stringify(f,y,e);return s&&(B=B.replace(/[\u007F-\uFFFF]/g,L=>{const x=`0000${L.charCodeAt(0).toString(16)}`;return`\\u${x.substring(x.length-4)}`})),new TextEncoder().encode(B)}decode(t){const{strict:e}=this.#e;Yt(e,"JsonCodec does not yet support non-strict decoding.");const n=rr(t),s=n.pop();n.pop(),Yt(s,"0D not implemented for JsonCodec.");const i=tr(s,"C");return{data:n,shape:s,stride:i}}}const ms={};function Qs(r){return r instanceof $n||r instanceof ds||r instanceof yn?new Proxy(r,{get(e,n){return e.get(Number(n))},set(e,n,s){return e.set(Number(n),s),!0}}):r}function Qu(r,t){let e;return r.data instanceof ds||r.data instanceof yn?e=new r.constructor(r.data.length,r.data.chars):e=new r.constructor(r.data.length),{data:e,shape:r.shape,stride:tr(r.shape,t)}}function th(r,t){let e=Qu(r,t),n=r.shape.length,s=r.data.length,i=Array(n).fill(0),c=Qs(r.data),a=Qs(e.data);for(let d=0;d<s;d++){let f=0;for(let y=0;y<n;y++)f+=i[y]*e.stride[y];a[f]=c[d],i[0]+=1;for(let y=0;y<n;y++)if(i[y]===r.shape[y]){if(y+1===n)break;i[y]=0,i[y+1]+=1}}return e}function eh(r){let t=r.shape.length;return ms(t===r.stride.length,"Shape and stride must have the same length."),r.stride.map((e,n)=>({stride:e,index:n})).sort((e,n)=>n.stride-e.stride).map(e=>e.index)}function rh(r,t){let e=eh(r);return ms(e.length===t.length,"Orders must match"),e.every((n,s)=>n===t[s])}class ws{kind="array_to_array";#t;#e;constructor(t,e){let n=t.order??"C",s=e.shape.length,i=new Array(s),c=new Array(s);if(n==="C")for(let a=0;a<s;++a)i[a]=a,c[a]=a;else if(n==="F")for(let a=0;a<s;++a)i[a]=s-a-1,c[a]=s-a-1;else i=n,i.forEach((a,d)=>{ms(c[a]===void 0,`Invalid permutation: ${JSON.stringify(n)}`),c[a]=d});this.#t=i,this.#e=c}static fromConfig(t,e){return new ws(t,e)}encode(t){return rh(t,this.#e)?t:th(t,this.#e)}decode(t){return{data:t.data,shape:t.shape,stride:tr(t.shape,this.#t)}}}class bs{kind="array_to_bytes";#t;#e;constructor(t){this.#t=t,this.#e=tr(t,"C")}static fromConfig(t,e){return new bs(e.shape)}encode(t){throw new Error("Method not implemented.")}decode(t){let e=new TextDecoder,n=new DataView(t.buffer),s=Array(n.getUint32(0,!0)),i=4;for(let c=0;c<s.length;c++){let a=n.getUint32(i,!0);i+=4,s[c]=e.decode(t.buffer.slice(i,i+a)),i+=a}return{data:s,shape:this.#t,stride:this.#e}}}function nh(){return new Map().set("blosc",()=>Promise.resolve().then(()=>require("./blosc-XU68L2JO.cjs")).then(r=>r.default)).set("gzip",()=>Promise.resolve().then(()=>require("./gzip-9a4q5uuM.cjs")).then(r=>r.default)).set("lz4",()=>Promise.resolve().then(()=>require("./lz4-DyL8MHib.cjs")).then(r=>r.default)).set("zlib",()=>Promise.resolve().then(()=>require("./zlib-BviSziX3.cjs")).then(r=>r.default)).set("zstd",()=>Promise.resolve().then(()=>require("./zstd-BJg46wpa.cjs")).then(r=>r.default)).set("transpose",()=>ws).set("bytes",()=>_i).set("crc32c",()=>ys).set("vlen-utf8",()=>bs).set("json2",()=>gs).set("bitround",()=>ps)}const ya=nh();function Ji(r){let t;return{async encode(e){t||(t=await to(r));for(const s of t.array_to_array)e=await s.encode(e);let n=await t.array_to_bytes.encode(e);for(const s of t.bytes_to_bytes)n=await s.encode(n);return n},async decode(e){t||(t=await to(r));for(let s=t.bytes_to_bytes.length-1;s>=0;s--)e=await t.bytes_to_bytes[s].decode(e);let n=await t.array_to_bytes.decode(e);for(let s=t.array_to_array.length-1;s>=0;s--)n=await t.array_to_array[s].decode(n);return n}}}async function to(r){let t=r.codecs.map(async i=>{let c=await ya.get(i.name)?.();return Yt(c,`Unknown codec: ${i.name}`),{Codec:c,meta:i}}),e=[],n,s=[];for await(let{Codec:i,meta:c}of t){let a=i.fromConfig(c.configuration,r);switch(a.kind){case"array_to_array":e.push(a);break;case"array_to_bytes":n=a;break;default:s.push(a)}}return n||(Yt(ih(r),`Cannot encode ${r.data_type} to bytes without a codec`),n=_i.fromConfig({endian:"little"},r)),{array_to_array:e,array_to_bytes:n,bytes_to_bytes:s}}function ih(r){return r.data_type!=="v2:object"}const eo=18446744073709551615n;function sh(r,t,e,n){Yt(r.store.getRange,"Store does not support range requests");let s=r.store.getRange.bind(r.store),i=t.map((d,f)=>d/n.chunk_shape[f]),c=Ji({data_type:"uint64",shape:[...i,2],codecs:n.index_codecs}),a={};return async d=>{let f=d.map((C,P)=>Math.floor(C/i[P])),y=r.resolve(e(f)).path,B;if(y in a)B=a[y];else{let C=4,P=16*i.reduce((G,A)=>G*A,1),V=await s(y,{suffixLength:P+C});B=a[y]=V?await c.decode(V):null}if(B===null)return;let{data:L,shape:x,stride:M}=B,U=d.map((C,P)=>C%x[P]).reduce((C,P,V)=>C+P*M[V],0),F=L[U],O=L[U+1];if(!(F===eo&&O===eo))return s(y,{offset:Number(F),length:Number(O)})}}class nr{store;path;constructor(t,e="/"){this.store=t,this.path=e}resolve(t){let e=new URL(`file://${this.path.endsWith("/")?this.path:`${this.path}/`}`);return new nr(this.store,new URL(t,e).pathname)}}class Si extends nr{kind="group";#t;constructor(t,e,n){super(t,e),this.#t=n}get attrs(){return this.#t.attributes}}function ro(r){return r.find(e=>e.name==="transpose")?.configuration?.order??"C"}const Kr=Symbol("zarrita.context");function ga(r){return r[Kr]}function oh(r,t){let{configuration:e}=t.codecs.find(Hu)??{},n={encode_chunk_key:Wu(t.chunk_key_encoding),TypedArray:da(t.data_type),fill_value:t.fill_value};if(e){let i=ro(e.codecs);return{...n,kind:"sharded",chunk_shape:e.chunk_shape,codec:Ji({data_type:t.data_type,shape:e.chunk_shape,codecs:e.codecs}),get_strides(c,a){return tr(c,a??i)},get_chunk_bytes:sh(r,t.chunk_grid.configuration.chunk_shape,n.encode_chunk_key,e)}}let s=ro(t.codecs);return{...n,kind:"regular",chunk_shape:t.chunk_grid.configuration.chunk_shape,codec:Ji({data_type:t.data_type,shape:t.chunk_grid.configuration.chunk_shape,codecs:t.codecs}),get_strides(i,c){return tr(i,c??s)},async get_chunk_bytes(i,c){let a=n.encode_chunk_key(i),d=r.resolve(a).path;return r.store.get(d,c)}}}let vr=class extends nr{kind="array";#t;[Kr];constructor(t,e,n){super(t,e),this.#t={...n,fill_value:fa(n)},this[Kr]=oh(this,n)}get attrs(){return this.#t.attributes}get shape(){return this.#t.shape}get chunks(){return this[Kr].chunk_shape}get dtype(){return this.#t.data_type}async getChunk(t,e){let n=this[Kr],s=await n.get_chunk_bytes(t,e);if(!s){let i=n.chunk_shape.reduce((a,d)=>a*d,1),c=new n.TypedArray(i);return c.fill(n.fill_value),{data:c,shape:n.chunk_shape,stride:n.get_strides(n.chunk_shape)}}return n.codec.decode(s)}is(t){return Ju(this.dtype,t)}},Ii=ah();function ah(){let r=new WeakMap;function t(e){let n=r.get(e)??{v2:0,v3:0};return r.set(e,n),n}return{increment(e,n){t(e)[n]+=1},version_max(e){let n=t(e);return n.v3>n.v2?"v3":"v2"}}}async function ch(r){let t=await r.store.get(r.resolve(".zattrs").path);return t?rr(t):{}}async function uh(r,t={}){let e="store"in r?r:new nr(r),n={};return(t.attrs??!0)&&(n=await ch(e)),t.kind==="array"?no(e,n):t.kind==="group"?io(e,n):no(e,n).catch(s=>(pa(s,Fr),io(e,n)))}async function no(r,t){let{path:e}=r.resolve(".zarray"),n=await r.store.get(e);if(!n)throw new Fr("v2 array",{cause:new bi(e)});return Ii.increment(r.store,"v2"),new vr(r.store,r.path,Gu(rr(n),t))}async function io(r,t){let{path:e}=r.resolve(".zgroup"),n=await r.store.get(e);if(!n)throw new Fr("v2 group",{cause:new bi(e)});return Ii.increment(r.store,"v2"),new Si(r.store,r.path,Yu(rr(n),t))}async function hh(r){let{store:t,path:e}=r.resolve("zarr.json"),n=await r.store.get(e);if(!n)throw new Fr("v3 array or group",{cause:new bi(e)});let s=rr(n);return s.node_type==="array"&&(s.fill_value=fa(s)),s.node_type==="array"?new vr(t,r.path,s):new Si(t,r.path,s)}async function lh(r,t={}){let e="store"in r?r:new nr(r),n=await hh(e);if(Ii.increment(e.store,"v3"),t.kind===void 0||t.kind==="array"&&n instanceof vr||t.kind==="group"&&n instanceof Si)return n;let s=n instanceof vr?"array":"group";throw new Error(`Expected node of kind ${t.kind}, found ${s}.`)}async function Ge(r,t={}){let e="store"in r?r.store:r,n=Ii.version_max(e),s=n==="v2"?Ge.v2:Ge.v3,i=n==="v2"?Ge.v3:Ge.v2;return s(r,t).catch(c=>(pa(c,Fr),i(r,t)))}Ge.v2=uh;Ge.v3=lh;async function _n(r,t={}){let e="store"in r?r:new nr(r);return"shape"in t?await fh(e,t):dh(e,t)}async function dh(r,t={}){let e={zarr_format:3,node_type:"group",attributes:t.attributes??{}};return await r.store.set(r.resolve("zarr.json").path,fs(e)),new Si(r.store,r.path,e)}async function fh(r,t){let e={zarr_format:3,node_type:"array",shape:t.shape,data_type:t.data_type,chunk_grid:{name:"regular",configuration:{chunk_shape:t.chunk_shape}},chunk_key_encoding:{name:"default",configuration:{separator:t.chunk_separator??"/"}},codecs:t.codecs??[],fill_value:t.fill_value??null,attributes:t.attributes??{}};return await r.store.set(r.resolve("zarr.json").path,fs(e)),new vr(r.store,r.path,e)}async function ph(r){let t=await r.get("/.zmetadata");if(!t)throw new Fr("v2 consolidated metadata",{cause:new bi("/.zmetadata")});let e=rr(t);return Yt(e.zarr_consolidated_format===1,"Unsupported consolidated format."),e}function yh(r){return r.endsWith(".zarray")||r.endsWith(".zgroup")||r.endsWith(".zattrs")||r.endsWith("zarr.json")}function gh(r){return"zarr_format"in r&&r.zarr_format===3}async function mh(r){let t=await ph(r),e={};for(let[n,s]of Object.entries(t.metadata))e[`/${n}`]=s;return{async get(...n){let[s,i]=n;if(e[s])return fs(e[s]);let c=await r.get(s,i);if(yh(s)&&c){let a=rr(c);e[s]=a}return c},getRange:r.getRange?.bind(r),contents(){let n=[];for(let[s,i]of Object.entries(e)){let c=s.split("/"),a=c.pop(),d=c.join("/")||"/";a===".zarray"&&n.push({path:d,kind:"array"}),a===".zgroup"&&n.push({path:d,kind:"group"}),gh(i)&&n.push({path:d,kind:i.node_type})}return n}}}function*wh(r,t,e=1){t===void 0&&(t=r,r=0);for(let n=r;n<t;n+=e)yield n}function*bh(...r){if(r.length===0)return;const t=r.map(n=>n[Symbol.iterator]()),e=t.map(n=>n.next());if(e.some(n=>n.done))throw new Error("Input contains an empty iterator.");for(let n=0;;){if(e[n].done){if(t[n]=r[n][Symbol.iterator](),e[n]=t[n].next(),++n>=t.length)return}else yield e.map(({value:s})=>s),n=0;e[n]=t[n].next()}}function _h({start:r,stop:t,step:e},n){if(e===0)throw new Error("slice step cannot be zero");e=e??1;const s=e<0,[i,c]=s?[-1,n-1]:[0,n];return r===null?r=s?c:i:r<0?(r+=n,r<i&&(r=i)):r>c&&(r=c),t===null?t=s?i:c:t<0?(t+=n,t<i&&(t=i)):t>c&&(t=c),[r,t,e]}function Hi(r,t,e=null){return t===void 0&&(t=r,r=null),{start:r,stop:t,step:e}}function ma(){const r=[];return{add:t=>r.push(t()),onIdle:()=>Promise.all(r)}}class _s extends Error{constructor(t){super(t),this.name="IndexError"}}function Sh(r,t){throw new _s(`too many indicies for array; expected ${t.length}, got ${r.length}`)}function Ih(r){throw new _s(`index out of bounds for dimension with length ${r}`)}function Bh(){throw new _s("only slices with step >= 1 are supported")}function vh(r,t){r.length>t.length&&Sh(r,t)}function xh(r,t){return r=Math.trunc(r),r<0&&(r=t+r),(r>=t||r<0)&&Ih(t),r}class Ah{dim_sel;dim_len;dim_chunk_len;nitems;constructor({dim_sel:t,dim_len:e,dim_chunk_len:n}){t=xh(t,e),this.dim_sel=t,this.dim_len=e,this.dim_chunk_len=n,this.nitems=1}*[Symbol.iterator](){const t=Math.floor(this.dim_sel/this.dim_chunk_len),e=t*this.dim_chunk_len,n=this.dim_sel-e;yield{dim_chunk_ix:t,dim_chunk_sel:n}}}class so{start;stop;step;dim_len;dim_chunk_len;nitems;nchunks;constructor({dim_sel:t,dim_len:e,dim_chunk_len:n}){const[s,i,c]=_h(t,e);this.start=s,this.stop=i,this.step=c,this.step<1&&Bh(),this.dim_len=e,this.dim_chunk_len=n,this.nitems=Math.max(0,Math.ceil((this.stop-this.start)/this.step)),this.nchunks=Math.ceil(this.dim_len/this.dim_chunk_len)}*[Symbol.iterator](){const t=Math.floor(this.start/this.dim_chunk_len),e=Math.ceil(this.stop/this.dim_chunk_len);for(const n of wh(t,e)){const s=n*this.dim_chunk_len,i=Math.min(this.dim_len,(n+1)*this.dim_chunk_len),c=i-s;let a=0,d=0;if(this.start<s){const x=(s-this.start)%this.step;x&&(d+=this.step-x),a=Math.ceil((s-this.start)/this.step)}else d=this.start-s;const f=this.stop>i?c:this.stop-s,y=[d,f,this.step],B=Math.ceil((f-d)/this.step),L=[a,a+B,1];yield{dim_chunk_ix:n,dim_chunk_sel:y,dim_out_sel:L}}}}function Eh(r,t){let e=[];return r===null?e=t.map(n=>Hi(null)):Array.isArray(r)&&(e=r.map(n=>n??Hi(null))),vh(e,t),e}class wa{dim_indexers;shape;constructor({selection:t,shape:e,chunk_shape:n}){this.dim_indexers=Eh(t,e).map((s,i)=>new(typeof s=="number"?Ah:so)({dim_sel:s,dim_len:e[i],dim_chunk_len:n[i]})),this.shape=this.dim_indexers.filter(s=>s instanceof so).map(s=>s.nitems)}*[Symbol.iterator](){for(const t of bh(...this.dim_indexers)){const e=t.map(s=>s.dim_chunk_ix),n=t.map(s=>"dim_out_sel"in s?{from:s.dim_chunk_sel,to:s.dim_out_sel}:{from:s.dim_chunk_sel,to:null});yield{chunk_coords:e,mapping:n}}}}function Th(r,t){return"get"in r?r.get(t):r[t]}async function Mh(r,t,e,n){let s=ga(r),i=new wa({selection:t,shape:r.shape,chunk_shape:r.chunks}),c=n.prepare(new s.TypedArray(i.shape.reduce((d,f)=>d*f,1)),i.shape,s.get_strides(i.shape,e.order)),a=e.create_queue?.()??ma();for(const{chunk_coords:d,mapping:f}of i)a.add(async()=>{let{data:y,shape:B,stride:L}=await r.getChunk(d,e.opts),x=n.prepare(y,B,L);n.set_from_chunk(c,x,f)});return await a.onIdle(),i.shape.length===0?Th(c.data,0):c}function Nh(r){return r.to==null?{from:r.to,to:r.from}:{from:r.to,to:r.from}}async function Fh(r,t,e,n,s){const i=ga(r);if(i.kind==="sharded")throw new Error("Set not supported for sharded arrays.");const c=new wa({selection:t,shape:r.shape,chunk_shape:r.chunks}),a=r.chunks.reduce((f,y)=>f*y,1),d=n.create_queue?n.create_queue():ma();for(const{chunk_coords:f,mapping:y}of c){const B=y.map(x=>x.from),L=y.map(Nh);d.add(async()=>{const x=r.resolve(i.encode_chunk_key(f)).path;let M;const U=r.chunks.slice(),F=i.get_strides(U);if(Oh(B,U))if(M=new i.TypedArray(a),typeof e=="object"){const O=s.prepare(M,U.slice(),F.slice());s.set_from_chunk(O,e,L)}else M.fill(e);else{M=await r.getChunk(f).then(({data:C})=>C);const O=s.prepare(M,U.slice(),F.slice());typeof e=="object"?s.set_from_chunk(O,e,L):s.set_scalar(O,B,e)}await r.store.set(x,await i.codec.encode({data:M,shape:U,stride:F}))})}await d.onIdle()}function Oh(r,t){return r.every((e,n)=>{if(typeof e=="number")return!1;const[s,i,c]=e;return i-s===t[n]&&c===1})}function Ss(r,t=0,e){let n=e??r.length-t;return{length:n,subarray(s,i=n){return Ss(r,t+s,i-s)},set(s,i=0){for(let c=0;c<s.length;c++)r[t+i+c]=s.get(c)},get(s){return r[t+s]}}}function Oi(r){return globalThis.Array.isArray(r.data)?{data:Ss(r.data),stride:r.stride,bytes_per_element:1}:{data:new Uint8Array(r.data.buffer,r.data.byteOffset,r.data.byteLength),stride:r.stride,bytes_per_element:r.data.BYTES_PER_ELEMENT}}function kh(r){return"chars"in r?r.constructor.bind(null,r.chars):r.constructor}function Dh(r,t){if(globalThis.Array.isArray(r.data))return Ss([t]);let e=kh(r.data),n=new e([t]);return new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}const ba={prepare(r,t,e){return{data:r,shape:t,stride:e}},set_scalar(r,t,e){let n=Oi(r);qi(n,t,Dh(r,e),n.bytes_per_element)},set_from_chunk(r,t,e){let n=Oi(r);Tn(n,Oi(t),n.bytes_per_element,e)}};async function Uh(r,t=null,e={}){return Mh(r,t,e,ba)}async function oo(r,t,e,n={}){return Fh(r,t,e,n,ba)}function _a(r,t,e){return e<0&&t<r?Math.floor((r-t-1)/-e)+1:r<t?Math.floor((t-r-1)/e)+1:0}function qi(r,t,e,n){if(t.length===0){r.data.set(e,0);return}const[s,...i]=t,[c,...a]=r.stride;if(typeof s=="number"){const L=r.data.subarray(c*s*n);qi({data:L,stride:a},i,e,n);return}const[d,f,y]=s,B=_a(d,f,y);if(i.length===0){for(let L=0;L<B;L++)r.data.set(e,c*(d+y*L)*n);return}for(let L=0;L<B;L++){const x=r.data.subarray(c*(d+y*L)*n);qi({data:x,stride:a},i,e,n)}}function Tn(r,t,e,n){const[s,...i]=n,[c,...a]=r.stride,[d,...f]=t.stride;if(s.from===null){if(i.length===0){r.data.set(t.data.subarray(0,e),s.to*e);return}Tn({data:r.data.subarray(c*s.to*e),stride:a},t,e,i);return}if(s.to===null){if(i.length===0){let O=s.from*e;r.data.set(t.data.subarray(O,O+e),0);return}Tn(r,{data:t.data.subarray(d*s.from*e),stride:f},e,i);return}const[y,B,L]=s.to,[x,M,U]=s.from,F=_a(y,B,L);if(i.length===0){if(L===1&&U===1&&c===1&&d===1){let O=x*e,C=F*e;r.data.set(t.data.subarray(O,O+C),y*e);return}for(let O=0;O<F;O++){let C=d*(x+U*O)*e;r.data.set(t.data.subarray(C,C+e),c*(y+L*O)*e)}return}for(let O=0;O<F;O++)Tn({data:r.data.subarray(c*(y+O*L)*e),stride:a},{data:t.data.subarray(d*(x+O*U)*e),stride:f},e,i)}function gt(r,t,e,n){function s(i){return i instanceof e?i:new e(function(c){c(i)})}return new(e||(e=Promise))(function(i,c){function a(y){try{f(n.next(y))}catch(B){c(B)}}function d(y){try{f(n.throw(y))}catch(B){c(B)}}function f(y){y.done?i(y.value):s(y.value).then(a,d)}f((n=n.apply(r,t||[])).next())})}function ao(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 wt(r){return this instanceof wt?(this.v=r,this):new wt(r)}function Ae(r,t,e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=e.apply(r,t||[]),s,i=[];return s=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",c),s[Symbol.asyncIterator]=function(){return this},s;function c(x){return function(M){return Promise.resolve(M).then(x,B)}}function a(x,M){n[x]&&(s[x]=function(U){return new Promise(function(F,O){i.push([x,U,F,O])>1||d(x,U)})},M&&(s[x]=M(s[x])))}function d(x,M){try{f(n[x](M))}catch(U){L(i[0][3],U)}}function f(x){x.value instanceof wt?Promise.resolve(x.value.v).then(y,B):L(i[0][2],x)}function y(x){d("next",x)}function B(x){d("throw",x)}function L(x,M){x(M),i.shift(),i.length&&d(i[0][0],i[0][1])}}function Mn(r){var t,e;return t={},n("next"),n("throw",function(s){throw s}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(s,i){t[s]=r[s]?function(c){return(e=!e)?{value:wt(r[s](c)),done:!1}:i?i(c):c}:i}}function br(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 ao=="function"?ao(r):r[Symbol.iterator](),e={},n("next"),n("throw"),n("return"),e[Symbol.asyncIterator]=function(){return this},e);function n(i){e[i]=r[i]&&function(c){return new Promise(function(a,d){c=r[i](c),s(a,d,c.done,c.value)})}}function s(i,c,a,d){Promise.resolve(d).then(function(f){i({value:f,done:a})},c)}}const Lh=new TextDecoder("utf-8"),Ki=r=>Lh.decode(r),Ch=new TextEncoder,Is=r=>Ch.encode(r),Rh=r=>typeof r=="number",Ph=r=>typeof r=="boolean",qt=r=>typeof r=="function",me=r=>r!=null&&Object(r)===r,un=r=>me(r)&&qt(r.then),Bi=r=>me(r)&&qt(r[Symbol.iterator]),Bs=r=>me(r)&&qt(r[Symbol.asyncIterator]),Xi=r=>me(r)&&me(r.schema),Sa=r=>me(r)&&"done"in r&&"value"in r,Ia=r=>me(r)&&qt(r.stat)&&Rh(r.fd),Ba=r=>me(r)&&vs(r.body),va=r=>"_getDOMStream"in r&&"_getNodeStream"in r,vs=r=>me(r)&&qt(r.cancel)&&qt(r.getReader)&&!va(r),xa=r=>me(r)&&qt(r.read)&&qt(r.pipe)&&Ph(r.readable)&&!va(r),$h=r=>me(r)&&qt(r.clear)&&qt(r.bytes)&&qt(r.position)&&qt(r.setPosition)&&qt(r.capacity)&&qt(r.getBufferIdentifier)&&qt(r.createLong),xs=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function zh(r){const t=r[0]?[r[0]]:[];let e,n,s,i;for(let c,a,d=0,f=0,y=r.length;++d<y;){if(c=t[f],a=r[d],!c||!a||c.buffer!==a.buffer||a.byteOffset<c.byteOffset){a&&(t[++f]=a);continue}if({byteOffset:e,byteLength:s}=c,{byteOffset:n,byteLength:i}=a,e+s<n||n+i<e){a&&(t[++f]=a);continue}t[f]=new Uint8Array(c.buffer,e,n-e+i)}return t}function co(r,t,e=0,n=t.byteLength){const s=r.byteLength,i=new Uint8Array(r.buffer,r.byteOffset,s),c=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,s));return i.set(c,e),r}function Ee(r,t){const e=zh(r),n=e.reduce((y,B)=>y+B.byteLength,0);let s,i,c,a=0,d=-1;const f=Math.min(t||Number.POSITIVE_INFINITY,n);for(const y=e.length;++d<y;){if(s=e[d],i=s.subarray(0,Math.min(s.length,f-a)),f<=a+i.length){i.length<s.length?e[d]=s.subarray(i.length):i.length===s.length&&d++,c?co(c,i,a):c=i;break}co(c||(c=new Uint8Array(f)),i,a),a+=i.length}return[c||new Uint8Array(0),e.slice(d),n-(c?c.byteLength:0)]}function Mt(r,t){let e=Sa(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=Is(e)),e instanceof ArrayBuffer?new r(e):e instanceof xs?new r(e):$h(e)?Mt(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)}const Dr=r=>Mt(Int32Array,r),uo=r=>Mt(BigInt64Array,r),It=r=>Mt(Uint8Array,r),Qi=r=>(r.next(),r);function*jh(r,t){const e=function*(s){yield s},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof xs?e(t):Bi(t)?t:e(t);return yield*Qi(function*(s){let i=null;do i=s.next(yield Mt(r,i));while(!i.done)}(n[Symbol.iterator]())),new r}const Vh=r=>jh(Uint8Array,r);function Aa(r,t){return Ae(this,arguments,function*(){if(un(t))return yield wt(yield wt(yield*Mn(br(Aa(r,yield wt(t))))));const n=function(c){return Ae(this,arguments,function*(){yield yield wt(yield wt(c))})},s=function(c){return Ae(this,arguments,function*(){yield wt(yield*Mn(br(Qi(function*(a){let d=null;do d=a.next(yield d?.value);while(!d.done)}(c[Symbol.iterator]())))))})},i=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof xs?n(t):Bi(t)?s(t):Bs(t)?t:n(t);return yield wt(yield*Mn(br(Qi(function(c){return Ae(this,arguments,function*(){let a=null;do a=yield wt(c.next(yield yield wt(Mt(r,a))));while(!a.done)})}(i[Symbol.asyncIterator]()))))),yield wt(new r)})}const Wh=r=>Aa(Uint8Array,r);function Zh(r,t){let e=0;const 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}const ce={fromIterable(r){return Sn(Gh(r))},fromAsyncIterable(r){return Sn(Yh(r))},fromDOMStream(r){return Sn(Jh(r))},fromNodeStream(r){return Sn(qh(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')}},Sn=r=>(r.next(),r);function*Gh(r){let t,e=!1,n=[],s,i,c,a=0;function d(){return i==="peek"?Ee(n,c)[0]:([s,n,a]=Ee(n,c),s)}({cmd:i,size:c}=(yield null)||{cmd:"read",size:0});const f=Vh(r)[Symbol.iterator]();try{do if({done:t,value:s}=Number.isNaN(c-a)?f.next():f.next(c-a),!t&&s.byteLength>0&&(n.push(s),a+=s.byteLength),t||c<=a)do({cmd:i,size:c}=yield d());while(c<a);while(!t)}catch(y){(e=!0)&&typeof f.throw=="function"&&f.throw(y)}finally{e===!1&&typeof f.return=="function"&&f.return(null)}return null}function Yh(r){return Ae(this,arguments,function*(){let e,n=!1,s=[],i,c,a,d=0;function f(){return c==="peek"?Ee(s,a)[0]:([i,s,d]=Ee(s,a),i)}({cmd:c,size:a}=(yield yield wt(null))||{cmd:"read",size:0});const y=Wh(r)[Symbol.asyncIterator]();try{do if({done:e,value:i}=Number.isNaN(a-d)?yield wt(y.next()):yield wt(y.next(a-d)),!e&&i.byteLength>0&&(s.push(i),d+=i.byteLength),e||a<=d)do({cmd:c,size:a}=yield yield wt(f()));while(a<d);while(!e)}catch(B){(n=!0)&&typeof y.throw=="function"&&(yield wt(y.throw(B)))}finally{n===!1&&typeof y.return=="function"&&(yield wt(y.return(new Uint8Array(0))))}return yield wt(null)})}function Jh(r){return Ae(this,arguments,function*(){let e=!1,n=!1,s=[],i,c,a,d=0;function f(){return c==="peek"?Ee(s,a)[0]:([i,s,d]=Ee(s,a),i)}({cmd:c,size:a}=(yield yield wt(null))||{cmd:"read",size:0});const y=new Hh(r);try{do if({done:e,value:i}=Number.isNaN(a-d)?yield wt(y.read()):yield wt(y.read(a-d)),!e&&i.byteLength>0&&(s.push(It(i)),d+=i.byteLength),e||a<=d)do({cmd:c,size:a}=yield yield wt(f()));while(a<d);while(!e)}catch(B){(n=!0)&&(yield wt(y.cancel(B)))}finally{n===!1?yield wt(y.cancel()):r.locked&&y.releaseLock()}return yield wt(null)})}class Hh{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 gt(this,void 0,void 0,function*(){const{reader:e,source:n}=this;e&&(yield e.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return gt(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};const e=yield this.reader.read();return!e.done&&(e.value=It(e)),e})}}const ki=(r,t)=>{const e=s=>n([t,s]);let n;return[t,e,new Promise(s=>(n=s)&&r.once(t,e))]};function qh(r){return Ae(this,arguments,function*(){const e=[];let n="error",s=!1,i=null,c,a,d=0,f=[],y;function B(){return c==="peek"?Ee(f,a)[0]:([y,f,d]=Ee(f,a),y)}if({cmd:c,size:a}=(yield yield wt(null))||{cmd:"read",size:0},r.isTTY)return yield yield wt(new Uint8Array(0)),yield wt(null);try{e[0]=ki(r,"end"),e[1]=ki(r,"error");do{if(e[2]=ki(r,"readable"),[n,i]=yield wt(Promise.race(e.map(x=>x[2]))),n==="error")break;if((s=n==="end")||(Number.isFinite(a-d)?(y=It(r.read(a-d)),y.byteLength<a-d&&(y=It(r.read()))):y=It(r.read()),y.byteLength>0&&(f.push(y),d+=y.byteLength)),s||a<=d)do({cmd:c,size:a}=yield yield wt(B()));while(a<d)}while(!s)}finally{yield wt(L(e,n==="error"?i:null))}return yield wt(null);function L(x,M){return y=f=null,new Promise((U,F)=>{for(const[O,C]of x)r.off(O,C);try{const O=r.destroy;O&&O.call(r,M),M=void 0}catch(O){M=O||M}finally{M!=null?F(M):U()}})}})}var zt;(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"})(zt||(zt={}));var re;(function(r){r[r.Sparse=0]="Sparse",r[r.Dense=1]="Dense"})(re||(re={}));var Jt;(function(r){r[r.HALF=0]="HALF",r[r.SINGLE=1]="SINGLE",r[r.DOUBLE=2]="DOUBLE"})(Jt||(Jt={}));var de;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(de||(de={}));var at;(function(r){r[r.SECOND=0]="SECOND",r[r.MILLISECOND=1]="MILLISECOND",r[r.MICROSECOND=2]="MICROSECOND",r[r.NANOSECOND=3]="NANOSECOND"})(at||(at={}));var Te;(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"})(Te||(Te={}));const Di=2,Be=4,ke=4,xt=4,We=new Int32Array(2),ho=new Float32Array(We.buffer),lo=new Float64Array(We.buffer),In=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var ts;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})(ts||(ts={}));let xr=class Ea{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new Ea(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 We[0]=this.readInt32(t),ho[0]}readFloat64(t){return We[In?0:1]=this.readInt32(t),We[In?1:0]=this.readInt32(t+4),lo[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){ho[0]=e,this.writeInt32(t,We[0])}writeFloat64(t,e){lo[0]=e,this.writeInt32(t,We[In?0:1]),this.writeInt32(t+4,We[In?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+Be+ke)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<ke;e++)t+=String.fromCharCode(this.readInt8(this.position_+Be+e));return t}__offset(t,e){const 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);const n=this.readInt32(t);t+=Be;const s=this.bytes_.subarray(t,t+n);return e===ts.UTF8_BYTES?s:this.text_decoder_.decode(s)}__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)+Be}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=ke)throw new Error("FlatBuffers: file identifier must be length "+ke);for(let e=0;e<ke;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+Be+e))return!1;return!0}createScalarList(t,e){const n=[];for(let s=0;s<e;++s){const i=t(s);i!==null&&n.push(i)}return n}createObjList(t,e){const n=[];for(let s=0;s<e;++s){const i=t(s);i!==null&&n.push(i.unpack())}return n}},Ta=class Ma{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=xr.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);const n=~(this.bb.capacity()-this.space+e)+1&t-1;for(;this.space<n+t+e;){const s=this.bb.capacity();this.bb=Ma.growByteBuffer(this.bb),this.space+=this.bb.capacity()-s}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){const e=t.capacity();if(e&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");const n=e<<1,s=xr.allocate(n);return s.setPosition(n-e),s.bytes().set(t.bytes(),n-e),s}addOffset(t){this.prep(Be,0),this.writeInt32(this.offset()-t+Be)}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);const t=this.offset();let e=this.vtable_in_use-1;for(;e>=0&&this.vtable[e]==0;e--);const n=e+1;for(;e>=0;e--)this.addInt16(this.vtable[e]!=0?t-this.vtable[e]:0);const s=2;this.addInt16(t-this.object_start);const i=(n+s)*Di;this.addInt16(i);let c=0;const a=this.space;t:for(e=0;e<this.vtables.length;e++){const d=this.bb.capacity()-this.vtables[e];if(i==this.bb.readInt16(d)){for(let f=Di;f<i;f+=Di)if(this.bb.readInt16(a+f)!=this.bb.readInt16(d+f))continue t;c=this.vtables[e];break}}return c?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,c-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,e,n){const s=n?xt:0;if(e){const i=e;if(this.prep(this.minalign,Be+ke+s),i.length!=ke)throw new TypeError("FlatBuffers: file identifier must be length "+ke);for(let c=ke-1;c>=0;c--)this.writeInt8(i.charCodeAt(c))}this.prep(this.minalign,Be+s),this.addOffset(t),s&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,e){this.finish(t,e,!0)}requiredField(t,e){const n=this.bb.capacity()-t,s=n-this.bb.readInt32(n);if(!(e<this.bb.readInt16(s)&&this.bb.readInt16(s+e)!=0))throw new TypeError("FlatBuffers: field "+e+" must be set")}startVector(t,e,n){this.notNested(),this.vector_num_elems=e,this.prep(Be,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);const e=this.createString(t);return this.string_maps.set(t,e),e}createString(t){if(t==null)return 0;let e;return t instanceof Uint8Array?e=t:e=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,e.length,1),this.bb.setPosition(this.space-=e.length),this.bb.bytes().set(e,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){const e=[];for(let n=0;n<t.length;++n){const s=t[n];if(s!==null)e.push(this.createObjectOffset(s));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 zn;(function(r){r[r.BUFFER=0]="BUFFER"})(zn||(zn={}));var jn;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(jn||(jn={}));class Ze{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 Ze).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+xt),(e||new Ze).__init(t.readInt32(t.position())+t.position(),t)}codec(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):jn.LZ4_FRAME}method(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):zn.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,jn.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,zn.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return Ze.startBodyCompression(t),Ze.addCodec(t,e),Ze.addMethod(t,n),Ze.endBodyCompression(t)}}class Na{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()}}let Fa=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()}},Ne=class es{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 es).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+xt),(e||new es).__init(t.readInt32(t.position())+t.position(),t)}length(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,e){const n=this.bb.__offset(this.bb_pos,6);return n?(e||new Fa).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new Na).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){const e=this.bb.__offset(this.bb_pos,10);return e?(t||new Ze).__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()}},ar=class rs{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 rs).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+xt),(e||new rs).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new Ne).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isDelta(){const t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,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 Vn;(function(r){r[r.DenseArray=0]="DenseArray"})(Vn||(Vn={}));class oe{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 oe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+xt),(e||new oe).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){const t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,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 oe.startInt(t),oe.addBitWidth(t,e),oe.addIsSigned(t,n),oe.endInt(t)}}class De{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 De).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+xt),(e||new De).__init(t.readInt32(t.position())+t.position(),t)}id(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new oe).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}isOrdered(){const t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):Vn.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,Vn.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}class jt{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 jt).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,e){return t.setPosition(t.position()+xt),(e||new jt).__init(t.readInt32(t.position())+t.position(),t)}key(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}value(t){const 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 jt.startKeyValue(t),jt.addKey(t,e),jt.addValue(t,n),jt.endKeyValue(t)}}let fo=class Xr{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 Xr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+xt),(e||new Xr).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return Xr.startBinary(t),Xr.endBinary(t)}},po=class Qr{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 Qr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,e){return t.setPosition(t.position()+xt),(e||new Qr).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return Qr.startBool(t),Qr.endBool(t)}},Nn=class cr{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 cr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+xt),(e||new cr).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):de.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,de.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return cr.startDate(t),cr.addUnit(t,e),cr.endDate(t)}},ur=class Ve{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 Ve).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+xt),(e||new Ve).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,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,s){return Ve.startDecimal(t),Ve.addPrecision(t,e),Ve.addScale(t,n),Ve.addBitWidth(t,s),Ve.endDecimal(t)}},Fn=class hr{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 hr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+xt),(e||new hr).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):at.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,at.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,e){return hr.startDuration(t),hr.addUnit(t,e),hr.endDuration(t)}},On=class lr{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 lr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+xt),(e||new lr).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,e){return lr.startFixedSizeBinary(t),lr.addByteWidth(t,e),lr.endFixedSizeBinary(t)}},kn=class dr{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 dr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+xt),(e||new dr).__init(t.readInt32(t.position())+t.position(),t)}listSize(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,e){t.addFieldInt32(0,e,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,e){return dr.startFixedSizeList(t),dr.addListSize(t,e),dr.endFixedSizeList(t)}};class ve{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 ve).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+xt),(e||new ve).__init(t.readInt32(t.position())+t.position(),t)}precision(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Jt.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,e){t.addFieldInt16(0,e,Jt.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,e){return ve.startFloatingPoint(t),ve.addPrecision(t,e),ve.endFloatingPoint(t)}}class xe{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 xe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+xt),(e||new xe).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Te.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Te.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return xe.startInterval(t),xe.addUnit(t,e),xe.endInterval(t)}}let yo=class tn{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 tn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+xt),(e||new tn).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return tn.startLargeBinary(t),tn.endLargeBinary(t)}},go=class en{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 en).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+xt),(e||new en).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return en.startLargeUtf8(t),en.endLargeUtf8(t)}},mo=class rn{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 rn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+xt),(e||new rn).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return rn.startList(t),rn.endList(t)}},Dn=class fr{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 fr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,e){return t.setPosition(t.position()+xt),(e||new fr).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){const t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,e){t.addFieldInt8(0,+e,0)}static endMap(t){return t.endObject()}static createMap(t,e){return fr.startMap(t),fr.addKeysSorted(t,e),fr.endMap(t)}},wo=class nn{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 nn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+xt),(e||new nn).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return nn.startNull(t),nn.endNull(t)}};class Qe{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 Qe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+xt),(e||new Qe).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return Qe.startStruct_(t),Qe.endStruct_(t)}}class ue{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 ue).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+xt),(e||new ue).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):at.MILLISECOND}bitWidth(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,e){t.addFieldInt16(0,e,at.MILLISECOND)}static addBitWidth(t,e){t.addFieldInt32(1,e,32)}static endTime(t){return t.endObject()}static createTime(t,e,n){return ue.startTime(t),ue.addUnit(t,e),ue.addBitWidth(t,n),ue.endTime(t)}}class he{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 he).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+xt),(e||new he).__init(t.readInt32(t.position())+t.position(),t)}unit(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):at.SECOND}timezone(t){const 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,at.SECOND)}static addTimezone(t,e){t.addFieldOffset(1,e,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,e,n){return he.startTimestamp(t),he.addUnit(t,e),he.addTimezone(t,n),he.endTimestamp(t)}}class ee{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 ee).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,e){return t.setPosition(t.position()+xt),(e||new ee).__init(t.readInt32(t.position())+t.position(),t)}mode(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):re.Sparse}typeIds(t){const e=this.bb.__offset(this.bb_pos,6);return e?this.bb.readInt32(this.bb.__vector(this.bb_pos+e)+t*4):0}typeIdsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){const t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,e){t.addFieldInt16(0,e,re.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 ee.startUnion(t),ee.addMode(t,e),ee.addTypeIds(t,n),ee.endUnion(t)}}let bo=class sn{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 sn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+xt),(e||new sn).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return sn.startUtf8(t),sn.endUtf8(t)}};var Dt;(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"})(Dt||(Dt={}));let ae=class Un{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 Un).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+xt),(e||new Un).__init(t.readInt32(t.position())+t.position(),t)}name(t){const e=this.bb.__offset(this.bb_pos,4);return e?this.bb.__string(this.bb_pos+e,t):null}nullable(){const t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):Dt.NONE}type(t){const e=this.bb.__offset(this.bb_pos,10);return e?this.bb.__union(t,this.bb_pos+e):null}dictionary(t){const e=this.bb.__offset(this.bb_pos,12);return e?(t||new De).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}children(t,e){const n=this.bb.__offset(this.bb_pos,14);return n?(e||new Un).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){const t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,16);return n?(e||new jt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,e){t.addFieldOffset(0,e,0)}static addNullable(t,e){t.addFieldInt8(1,+e,0)}static addTypeType(t,e){t.addFieldInt8(2,e,Dt.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()}},Se=class Me{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 Me).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+xt),(e||new Me).__init(t.readInt32(t.position())+t.position(),t)}endianness(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Ar.Little}fields(t,e){const n=this.bb.__offset(this.bb_pos,6);return n?(e||new ae).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new jt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){const 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(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,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,s,i){return Me.startSchema(t),Me.addEndianness(t,e),Me.addFields(t,n),Me.addCustomMetadata(t,s),Me.addFeatures(t,i),Me.endSchema(t)}};var Bt;(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"})(Bt||(Bt={}));var E;(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"})(E||(E={}));var Fe;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(Fe||(Fe={}));const Kh=void 0;function hn(r){if(r===null)return"null";if(r===Kh)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=>hn(t))}]`:`[${r}]`:ArrayBuffer.isView(r)?`[${r}]`:JSON.stringify(r,(t,e)=>typeof e=="bigint"?`${e}`:e)}function Lt(r){if(typeof r=="bigint"&&(r<Number.MIN_SAFE_INTEGER||r>Number.MAX_SAFE_INTEGER))throw new TypeError(`${r} is not safe to convert to a number.`);return Number(r)}function Oa(r,t){return Lt(r/t)+Lt(r%t)/Lt(t)}const Xh=Symbol.for("isArrowBigNum");function be(r,...t){return t.length===0?Object.setPrototypeOf(Mt(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}be.prototype[Xh]=!0;be.prototype.toJSON=function(){return`"${dn(this)}"`};be.prototype.valueOf=function(r){return ka(this,r)};be.prototype.toString=function(){return dn(this)};be.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return ka(this);case"string":return dn(this);case"default":return el(this)}return dn(this)};function _r(...r){return be.apply(this,r)}function Sr(...r){return be.apply(this,r)}function ln(...r){return be.apply(this,r)}Object.setPrototypeOf(_r.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(Sr.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(ln.prototype,Object.create(Uint32Array.prototype));Object.assign(_r.prototype,be.prototype,{constructor:_r,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(Sr.prototype,be.prototype,{constructor:Sr,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(ln.prototype,be.prototype,{constructor:ln,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const Qh=BigInt(4294967296)*BigInt(4294967296),tl=Qh-BigInt(1);function ka(r,t){const{buffer:e,byteOffset:n,byteLength:s,signed:i}=r,c=new BigUint64Array(e,n,s/8),a=i&&c.at(-1)&BigInt(1)<<BigInt(63);let d=BigInt(0),f=0;if(a){for(const y of c)d|=(y^tl)*(BigInt(1)<<BigInt(64*f++));d*=BigInt(-1),d-=BigInt(1)}else for(const y of c)d|=y*(BigInt(1)<<BigInt(64*f++));if(typeof t=="number"){const y=BigInt(Math.pow(10,t)),B=d/y,L=d%y;return Lt(B)+Lt(L)/Lt(y)}return Lt(d)}function dn(r){if(r.byteLength===8)return`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`;if(!r.signed)return Ui(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Ui(r);t=t.slice();let n=1;for(let i=0;i<t.length;i++){const c=t[i],a=~c+n;t[i]=a,n&=c===0?1:0}return`-${Ui(t)}`}function el(r){return r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:dn(r)}function Ui(r){let t="";const e=new Uint32Array(2);let n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);const s=new Uint32Array((n=new Uint16Array(n).reverse()).buffer);let i=-1;const c=n.length-1;do{for(e[0]=n[i=0];i<c;)n[i++]=e[1]=e[0]/10,e[0]=(e[0]-e[1]*10<<16)+n[i];n[i]=e[1]=e[0]/10,e[0]=e[0]-e[1]*10,t=`${e[0]}${t}`}while(s[0]||s[1]||s[2]||s[3]);return t??"0"}class As{static new(t,e){switch(e){case!0:return new _r(t);case!1:return new Sr(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new _r(t)}return t.byteLength===16?new ln(t):new Sr(t)}static signed(t){return new _r(t)}static unsigned(t){return new Sr(t)}static decimal(t){return new ln(t)}constructor(t,e){return As.new(t,e)}}var Da,Ua,La,Ca,Ra,Pa,$a,za,ja,Va,Wa,Za,Ga,Ya,Ja,Ha,qa,Ka,Xa,Qa,tc,ec;class tt{static isNull(t){return t?.typeId===E.Null}static isInt(t){return t?.typeId===E.Int}static isFloat(t){return t?.typeId===E.Float}static isBinary(t){return t?.typeId===E.Binary}static isLargeBinary(t){return t?.typeId===E.LargeBinary}static isUtf8(t){return t?.typeId===E.Utf8}static isLargeUtf8(t){return t?.typeId===E.LargeUtf8}static isBool(t){return t?.typeId===E.Bool}static isDecimal(t){return t?.typeId===E.Decimal}static isDate(t){return t?.typeId===E.Date}static isTime(t){return t?.typeId===E.Time}static isTimestamp(t){return t?.typeId===E.Timestamp}static isInterval(t){return t?.typeId===E.Interval}static isDuration(t){return t?.typeId===E.Duration}static isList(t){return t?.typeId===E.List}static isStruct(t){return t?.typeId===E.Struct}static isUnion(t){return t?.typeId===E.Union}static isFixedSizeBinary(t){return t?.typeId===E.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===E.FixedSizeList}static isMap(t){return t?.typeId===E.Map}static isDictionary(t){return t?.typeId===E.Dictionary}static isDenseUnion(t){return tt.isUnion(t)&&t.mode===re.Dense}static isSparseUnion(t){return tt.isUnion(t)&&t.mode===re.Sparse}constructor(t){this.typeId=t}}Da=Symbol.toStringTag;tt[Da]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(tt.prototype);class Je extends tt{constructor(){super(E.Null)}toString(){return"Null"}}Ua=Symbol.toStringTag;Je[Ua]=(r=>r[Symbol.toStringTag]="Null")(Je.prototype);class er extends tt{constructor(t,e){super(E.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}`}}La=Symbol.toStringTag;er[La]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(er.prototype);class fn extends er{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(fn.prototype,"ArrayType",{value:Int32Array});class Wn extends tt{constructor(t){super(E.Float),this.precision=t}get ArrayType(){switch(this.precision){case Jt.HALF:return Uint16Array;case Jt.SINGLE:return Float32Array;case Jt.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}}Ca=Symbol.toStringTag;Wn[Ca]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(Wn.prototype);class Zn extends tt{constructor(){super(E.Binary)}toString(){return"Binary"}}Ra=Symbol.toStringTag;Zn[Ra]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(Zn.prototype);class Gn extends tt{constructor(){super(E.LargeBinary)}toString(){return"LargeBinary"}}Pa=Symbol.toStringTag;Gn[Pa]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(Gn.prototype);class Yn extends tt{constructor(){super(E.Utf8)}toString(){return"Utf8"}}$a=Symbol.toStringTag;Yn[$a]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Yn.prototype);class Jn extends tt{constructor(){super(E.LargeUtf8)}toString(){return"LargeUtf8"}}za=Symbol.toStringTag;Jn[za]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Jn.prototype);class Hn extends tt{constructor(){super(E.Bool)}toString(){return"Bool"}}ja=Symbol.toStringTag;Hn[ja]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))(Hn.prototype);class qn extends tt{constructor(t,e,n=128){super(E.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}Va=Symbol.toStringTag;qn[Va]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(qn.prototype);class Kn extends tt{constructor(t){super(E.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${de[this.unit]}>`}get ArrayType(){return this.unit===de.DAY?Int32Array:BigInt64Array}}Wa=Symbol.toStringTag;Kn[Wa]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))(Kn.prototype);class Xn extends tt{constructor(t,e){super(E.Time),this.unit=t,this.bitWidth=e}toString(){return`Time${this.bitWidth}<${at[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}}Za=Symbol.toStringTag;Xn[Za]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(Xn.prototype);class Qn extends tt{constructor(t,e){super(E.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${at[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}Ga=Symbol.toStringTag;Qn[Ga]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(Qn.prototype);class ti extends tt{constructor(t){super(E.Interval),this.unit=t}toString(){return`Interval<${Te[this.unit]}>`}}Ya=Symbol.toStringTag;ti[Ya]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(ti.prototype);class ei extends tt{constructor(t){super(E.Duration),this.unit=t}toString(){return`Duration<${at[this.unit]}>`}}Ja=Symbol.toStringTag;ei[Ja]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(ei.prototype);class ri extends tt{constructor(t){super(E.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}}Ha=Symbol.toStringTag;ri[Ha]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(ri.prototype);class Kt extends tt{constructor(t){super(E.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}qa=Symbol.toStringTag;Kt[qa]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(Kt.prototype);class ni extends tt{constructor(t,e,n){super(E.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((s,i,c)=>(s[i]=c)&&s||s,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}Ka=Symbol.toStringTag;ni[Ka]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(ni.prototype);class ii extends tt{constructor(t){super(E.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}Xa=Symbol.toStringTag;ii[Xa]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(ii.prototype);class si extends tt{constructor(t,e){super(E.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}>`}}Qa=Symbol.toStringTag;si[Qa]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(si.prototype);class oi extends tt{constructor(t,e=!1){var n,s,i;if(super(E.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){const c=(s=t?.type)===null||s===void 0?void 0:s.children[0];c&&(c.name="key");const a=(i=t?.type)===null||i===void 0?void 0:i.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(", ")}}>`}}tc=Symbol.toStringTag;oi[tc]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(oi.prototype);const rl=(r=>()=>++r)(-1);class Er extends tt{constructor(t,e,n,s){super(E.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=s||!1,this.id=n==null?rl():Lt(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}>`}}ec=Symbol.toStringTag;Er[ec]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(Er.prototype);function Oe(r){const t=r;switch(r.typeId){case E.Decimal:return r.bitWidth/32;case E.Interval:return 1+t.unit;case E.FixedSizeList:return t.listSize;case E.FixedSizeBinary:return t.byteWidth;default:return 1}}class St{visitMany(t,...e){return t.map((n,s)=>this.visit(n,...e.map(i=>i[s])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return nl(this,t,e)}getVisitFnByTypeId(t,e=!0){return pr(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 nl(r,t,e=!0){return typeof t=="number"?pr(r,t,e):typeof t=="string"&&t in E?pr(r,E[t],e):t&&t instanceof tt?pr(r,_o(t),e):t?.type&&t.type instanceof tt?pr(r,_o(t.type),e):pr(r,E.NONE,e)}function pr(r,t,e=!0){let n=null;switch(t){case E.Null:n=r.visitNull;break;case E.Bool:n=r.visitBool;break;case E.Int:n=r.visitInt;break;case E.Int8:n=r.visitInt8||r.visitInt;break;case E.Int16:n=r.visitInt16||r.visitInt;break;case E.Int32:n=r.visitInt32||r.visitInt;break;case E.Int64:n=r.visitInt64||r.visitInt;break;case E.Uint8:n=r.visitUint8||r.visitInt;break;case E.Uint16:n=r.visitUint16||r.visitInt;break;case E.Uint32:n=r.visitUint32||r.visitInt;break;case E.Uint64:n=r.visitUint64||r.visitInt;break;case E.Float:n=r.visitFloat;break;case E.Float16:n=r.visitFloat16||r.visitFloat;break;case E.Float32:n=r.visitFloat32||r.visitFloat;break;case E.Float64:n=r.visitFloat64||r.visitFloat;break;case E.Utf8:n=r.visitUtf8;break;case E.LargeUtf8:n=r.visitLargeUtf8;break;case E.Binary:n=r.visitBinary;break;case E.LargeBinary:n=r.visitLargeBinary;break;case E.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case E.Date:n=r.visitDate;break;case E.DateDay:n=r.visitDateDay||r.visitDate;break;case E.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case E.Timestamp:n=r.visitTimestamp;break;case E.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case E.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case E.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case E.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case E.Time:n=r.visitTime;break;case E.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case E.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case E.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case E.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case E.Decimal:n=r.visitDecimal;break;case E.List:n=r.visitList;break;case E.Struct:n=r.visitStruct;break;case E.Union:n=r.visitUnion;break;case E.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case E.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case E.Dictionary:n=r.visitDictionary;break;case E.Interval:n=r.visitInterval;break;case E.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case E.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case E.Duration:n=r.visitDuration;break;case E.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case E.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case E.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case E.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case E.FixedSizeList:n=r.visitFixedSizeList;break;case E.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${E[t]}'`)}function _o(r){switch(r.typeId){case E.Null:return E.Null;case E.Int:{const{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?E.Int8:E.Uint8;case 16:return e?E.Int16:E.Uint16;case 32:return e?E.Int32:E.Uint32;case 64:return e?E.Int64:E.Uint64}return E.Int}case E.Float:switch(r.precision){case Jt.HALF:return E.Float16;case Jt.SINGLE:return E.Float32;case Jt.DOUBLE:return E.Float64}return E.Float;case E.Binary:return E.Binary;case E.LargeBinary:return E.LargeBinary;case E.Utf8:return E.Utf8;case E.LargeUtf8:return E.LargeUtf8;case E.Bool:return E.Bool;case E.Decimal:return E.Decimal;case E.Time:switch(r.unit){case at.SECOND:return E.TimeSecond;case at.MILLISECOND:return E.TimeMillisecond;case at.MICROSECOND:return E.TimeMicrosecond;case at.NANOSECOND:return E.TimeNanosecond}return E.Time;case E.Timestamp:switch(r.unit){case at.SECOND:return E.TimestampSecond;case at.MILLISECOND:return E.TimestampMillisecond;case at.MICROSECOND:return E.TimestampMicrosecond;case at.NANOSECOND:return E.TimestampNanosecond}return E.Timestamp;case E.Date:switch(r.unit){case de.DAY:return E.DateDay;case de.MILLISECOND:return E.DateMillisecond}return E.Date;case E.Interval:switch(r.unit){case Te.DAY_TIME:return E.IntervalDayTime;case Te.YEAR_MONTH:return E.IntervalYearMonth}return E.Interval;case E.Duration:switch(r.unit){case at.SECOND:return E.DurationSecond;case at.MILLISECOND:return E.DurationMillisecond;case at.MICROSECOND:return E.DurationMicrosecond;case at.NANOSECOND:return E.DurationNanosecond}return E.Duration;case E.Map:return E.Map;case E.List:return E.List;case E.Struct:return E.Struct;case E.Union:switch(r.mode){case re.Dense:return E.DenseUnion;case re.Sparse:return E.SparseUnion}return E.Union;case E.FixedSizeBinary:return E.FixedSizeBinary;case E.FixedSizeList:return E.FixedSizeList;case E.Dictionary:return E.Dictionary}throw new Error(`Unrecognized type '${E[r.typeId]}'`)}St.prototype.visitInt8=null;St.prototype.visitInt16=null;St.prototype.visitInt32=null;St.prototype.visitInt64=null;St.prototype.visitUint8=null;St.prototype.visitUint16=null;St.prototype.visitUint32=null;St.prototype.visitUint64=null;St.prototype.visitFloat16=null;St.prototype.visitFloat32=null;St.prototype.visitFloat64=null;St.prototype.visitDateDay=null;St.prototype.visitDateMillisecond=null;St.prototype.visitTimestampSecond=null;St.prototype.visitTimestampMillisecond=null;St.prototype.visitTimestampMicrosecond=null;St.prototype.visitTimestampNanosecond=null;St.prototype.visitTimeSecond=null;St.prototype.visitTimeMillisecond=null;St.prototype.visitTimeMicrosecond=null;St.prototype.visitTimeNanosecond=null;St.prototype.visitDenseUnion=null;St.prototype.visitSparseUnion=null;St.prototype.visitIntervalDayTime=null;St.prototype.visitIntervalYearMonth=null;St.prototype.visitDuration=null;St.prototype.visitDurationSecond=null;St.prototype.visitDurationMillisecond=null;St.prototype.visitDurationMicrosecond=null;St.prototype.visitDurationNanosecond=null;const rc=new Float64Array(1),or=new Uint32Array(rc.buffer);function nc(r){const 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 il(r){if(r!==r)return 32256;rc[0]=r;const t=(or[1]&2147483648)>>16&65535;let e=or[1]&2146435072,n=0;return e>=1089470464?or[0]>0?e=31744:(e=(e&2080374784)>>16,n=(or[1]&1048575)>>10):e<=1056964608?(n=1048576+(or[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(or[1]&1048575)+512>>10),t|e|n&65535}class ct extends St{}function dt(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}const sl=(r,t,e)=>{r[t]=Math.floor(e/864e5)},ic=(r,t,e,n)=>{if(e+1<t.length){const s=Lt(t[e]),i=Lt(t[e+1]);r.set(n.subarray(0,i-s),s)}},ol=({offset:r,values:t},e,n)=>{const s=r+e;n?t[s>>3]|=1<<s%8:t[s>>3]&=~(1<<s%8)},Re=({values:r},t,e)=>{r[t]=e},Es=({values:r},t,e)=>{r[t]=e},sc=({values:r},t,e)=>{r[t]=il(e)},al=(r,t,e)=>{switch(r.type.precision){case Jt.HALF:return sc(r,t,e);case Jt.SINGLE:case Jt.DOUBLE:return Es(r,t,e)}},oc=({values:r},t,e)=>{sl(r,t,e.valueOf())},ac=({values:r},t,e)=>{r[t]=BigInt(e)},cl=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},cc=({values:r,valueOffsets:t},e,n)=>ic(r,t,e,n),uc=({values:r,valueOffsets:t},e,n)=>ic(r,t,e,Is(n)),ul=(r,t,e)=>{r.type.unit===de.DAY?oc(r,t,e):ac(r,t,e)},hc=({values:r},t,e)=>{r[t]=BigInt(e/1e3)},lc=({values:r},t,e)=>{r[t]=BigInt(e)},dc=({values:r},t,e)=>{r[t]=BigInt(e*1e3)},fc=({values:r},t,e)=>{r[t]=BigInt(e*1e6)},hl=(r,t,e)=>{switch(r.type.unit){case at.SECOND:return hc(r,t,e);case at.MILLISECOND:return lc(r,t,e);case at.MICROSECOND:return dc(r,t,e);case at.NANOSECOND:return fc(r,t,e)}},pc=({values:r},t,e)=>{r[t]=e},yc=({values:r},t,e)=>{r[t]=e},gc=({values:r},t,e)=>{r[t]=e},mc=({values:r},t,e)=>{r[t]=e},ll=(r,t,e)=>{switch(r.type.unit){case at.SECOND:return pc(r,t,e);case at.MILLISECOND:return yc(r,t,e);case at.MICROSECOND:return gc(r,t,e);case at.NANOSECOND:return mc(r,t,e)}},dl=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},fl=(r,t,e)=>{const n=r.children[0],s=r.valueOffsets,i=fe.getVisitFn(n);if(Array.isArray(e))for(let c=-1,a=s[t],d=s[t+1];a<d;)i(n,a++,e[++c]);else for(let c=-1,a=s[t],d=s[t+1];a<d;)i(n,a++,e.get(++c))},pl=(r,t,e)=>{const n=r.children[0],{valueOffsets:s}=r,i=fe.getVisitFn(n);let{[t]:c,[t+1]:a}=s;const d=e instanceof Map?e.entries():Object.entries(e);for(const f of d)if(i(n,c,f),++c>=a)break},yl=(r,t)=>(e,n,s,i)=>n&&e(n,r,t[i]),gl=(r,t)=>(e,n,s,i)=>n&&e(n,r,t.get(i)),ml=(r,t)=>(e,n,s,i)=>n&&e(n,r,t.get(s.name)),wl=(r,t)=>(e,n,s,i)=>n&&e(n,r,t[s.name]),bl=(r,t,e)=>{const n=r.type.children.map(i=>fe.getVisitFn(i.type)),s=e instanceof Map?ml(t,e):e instanceof Ft?gl(t,e):Array.isArray(e)?yl(t,e):wl(t,e);r.type.children.forEach((i,c)=>s(n[c],r.children[c],i,c))},_l=(r,t,e)=>{r.type.mode===re.Dense?wc(r,t,e):bc(r,t,e)},wc=(r,t,e)=>{const n=r.type.typeIdToChildIndex[r.typeIds[t]],s=r.children[n];fe.visit(s,r.valueOffsets[t],e)},bc=(r,t,e)=>{const n=r.type.typeIdToChildIndex[r.typeIds[t]],s=r.children[n];fe.visit(s,t,e)},Sl=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},Il=(r,t,e)=>{r.type.unit===Te.DAY_TIME?_c(r,t,e):Sc(r,t,e)},_c=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},Sc=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},Ic=({values:r},t,e)=>{r[t]=e},Bc=({values:r},t,e)=>{r[t]=e},vc=({values:r},t,e)=>{r[t]=e},xc=({values:r},t,e)=>{r[t]=e},Bl=(r,t,e)=>{switch(r.type.unit){case at.SECOND:return Ic(r,t,e);case at.MILLISECOND:return Bc(r,t,e);case at.MICROSECOND:return vc(r,t,e);case at.NANOSECOND:return xc(r,t,e)}},vl=(r,t,e)=>{const{stride:n}=r,s=r.children[0],i=fe.getVisitFn(s);if(Array.isArray(e))for(let c=-1,a=t*n;++c<n;)i(s,a+c,e[c]);else for(let c=-1,a=t*n;++c<n;)i(s,a+c,e.get(c))};ct.prototype.visitBool=dt(ol);ct.prototype.visitInt=dt(Re);ct.prototype.visitInt8=dt(Re);ct.prototype.visitInt16=dt(Re);ct.prototype.visitInt32=dt(Re);ct.prototype.visitInt64=dt(Re);ct.prototype.visitUint8=dt(Re);ct.prototype.visitUint16=dt(Re);ct.prototype.visitUint32=dt(Re);ct.prototype.visitUint64=dt(Re);ct.prototype.visitFloat=dt(al);ct.prototype.visitFloat16=dt(sc);ct.prototype.visitFloat32=dt(Es);ct.prototype.visitFloat64=dt(Es);ct.prototype.visitUtf8=dt(uc);ct.prototype.visitLargeUtf8=dt(uc);ct.prototype.visitBinary=dt(cc);ct.prototype.visitLargeBinary=dt(cc);ct.prototype.visitFixedSizeBinary=dt(cl);ct.prototype.visitDate=dt(ul);ct.prototype.visitDateDay=dt(oc);ct.prototype.visitDateMillisecond=dt(ac);ct.prototype.visitTimestamp=dt(hl);ct.prototype.visitTimestampSecond=dt(hc);ct.prototype.visitTimestampMillisecond=dt(lc);ct.prototype.visitTimestampMicrosecond=dt(dc);ct.prototype.visitTimestampNanosecond=dt(fc);ct.prototype.visitTime=dt(ll);ct.prototype.visitTimeSecond=dt(pc);ct.prototype.visitTimeMillisecond=dt(yc);ct.prototype.visitTimeMicrosecond=dt(gc);ct.prototype.visitTimeNanosecond=dt(mc);ct.prototype.visitDecimal=dt(dl);ct.prototype.visitList=dt(fl);ct.prototype.visitStruct=dt(bl);ct.prototype.visitUnion=dt(_l);ct.prototype.visitDenseUnion=dt(wc);ct.prototype.visitSparseUnion=dt(bc);ct.prototype.visitDictionary=dt(Sl);ct.prototype.visitInterval=dt(Il);ct.prototype.visitIntervalDayTime=dt(_c);ct.prototype.visitIntervalYearMonth=dt(Sc);ct.prototype.visitDuration=dt(Bl);ct.prototype.visitDurationSecond=dt(Ic);ct.prototype.visitDurationMillisecond=dt(Bc);ct.prototype.visitDurationMicrosecond=dt(vc);ct.prototype.visitDurationNanosecond=dt(xc);ct.prototype.visitFixedSizeList=dt(vl);ct.prototype.visitMap=dt(pl);const fe=new ct,pe=Symbol.for("parent"),Ir=Symbol.for("rowIndex");class Ts{constructor(t,e){return this[pe]=t,this[Ir]=e,new Proxy(this,El)}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[Ir],e=this[pe],n=e.type.children,s={};for(let i=-1,c=n.length;++i<c;)s[n[i].name]=ne.visit(e.children[i],t);return s}toString(){return`{${[...this].map(([t,e])=>`${hn(t)}: ${hn(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new xl(this[pe],this[Ir])}}class xl{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(){const t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,ne.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}}Object.defineProperties(Ts.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[pe]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ir]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});class Al{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[pe].type.children.map(e=>e.name)}has(t,e){return t[pe].type.children.some(n=>n.name===e)}getOwnPropertyDescriptor(t,e){if(t[pe].type.children.some(n=>n.name===e))return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[pe].type.children.findIndex(s=>s.name===e);if(n!==-1){const s=ne.visit(t[pe].children[n],t[Ir]);return Reflect.set(t,e,s),s}}set(t,e,n){const s=t[pe].type.children.findIndex(i=>i.name===e);return s!==-1?(fe.visit(t[pe].children[s],t[Ir],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}}const El=new Al;class nt extends St{}function ut(r){return(t,e)=>t.getValid(e)?r(t,e):null}const Tl=(r,t)=>864e5*r[t],Ml=(r,t)=>null,Ac=(r,t,e)=>{if(e+1>=t.length)return null;const n=Lt(t[e]),s=Lt(t[e+1]);return r.subarray(n,s)},Nl=({offset:r,values:t},e)=>{const n=r+e;return(t[n>>3]&1<<n%8)!==0},Ec=({values:r},t)=>Tl(r,t),Tc=({values:r},t)=>Lt(r[t]),qe=({stride:r,values:t},e)=>t[r*e],Fl=({stride:r,values:t},e)=>nc(t[r*e]),Mc=({values:r},t)=>r[t],Ol=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),Nc=({values:r,valueOffsets:t},e)=>Ac(r,t,e),Fc=({values:r,valueOffsets:t},e)=>{const n=Ac(r,t,e);return n!==null?Ki(n):null},kl=({values:r},t)=>r[t],Dl=({type:r,values:t},e)=>r.precision!==Jt.HALF?t[e]:nc(t[e]),Ul=(r,t)=>r.type.unit===de.DAY?Ec(r,t):Tc(r,t),Oc=({values:r},t)=>1e3*Lt(r[t]),kc=({values:r},t)=>Lt(r[t]),Dc=({values:r},t)=>Oa(r[t],BigInt(1e3)),Uc=({values:r},t)=>Oa(r[t],BigInt(1e6)),Ll=(r,t)=>{switch(r.type.unit){case at.SECOND:return Oc(r,t);case at.MILLISECOND:return kc(r,t);case at.MICROSECOND:return Dc(r,t);case at.NANOSECOND:return Uc(r,t)}},Lc=({values:r},t)=>r[t],Cc=({values:r},t)=>r[t],Rc=({values:r},t)=>r[t],Pc=({values:r},t)=>r[t],Cl=(r,t)=>{switch(r.type.unit){case at.SECOND:return Lc(r,t);case at.MILLISECOND:return Cc(r,t);case at.MICROSECOND:return Rc(r,t);case at.NANOSECOND:return Pc(r,t)}},Rl=({values:r,stride:t},e)=>As.decimal(r.subarray(t*e,t*(e+1))),Pl=(r,t)=>{const{valueOffsets:e,stride:n,children:s}=r,{[t*n]:i,[t*n+1]:c}=e,d=s[0].slice(i,c-i);return new Ft([d])},$l=(r,t)=>{const{valueOffsets:e,children:n}=r,{[t]:s,[t+1]:i}=e,c=n[0];return new Ms(c.slice(s,i-s))},zl=(r,t)=>new Ts(r,t),jl=(r,t)=>r.type.mode===re.Dense?$c(r,t):zc(r,t),$c=(r,t)=>{const e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return ne.visit(n,r.valueOffsets[t])},zc=(r,t)=>{const e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return ne.visit(n,t)},Vl=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},Wl=(r,t)=>r.type.unit===Te.DAY_TIME?jc(r,t):Vc(r,t),jc=({values:r},t)=>r.subarray(2*t,2*(t+1)),Vc=({values:r},t)=>{const e=r[t],n=new Int32Array(2);return n[0]=Math.trunc(e/12),n[1]=Math.trunc(e%12),n},Wc=({values:r},t)=>r[t],Zc=({values:r},t)=>r[t],Gc=({values:r},t)=>r[t],Yc=({values:r},t)=>r[t],Zl=(r,t)=>{switch(r.type.unit){case at.SECOND:return Wc(r,t);case at.MILLISECOND:return Zc(r,t);case at.MICROSECOND:return Gc(r,t);case at.NANOSECOND:return Yc(r,t)}},Gl=(r,t)=>{const{stride:e,children:n}=r,i=n[0].slice(t*e,e);return new Ft([i])};nt.prototype.visitNull=ut(Ml);nt.prototype.visitBool=ut(Nl);nt.prototype.visitInt=ut(kl);nt.prototype.visitInt8=ut(qe);nt.prototype.visitInt16=ut(qe);nt.prototype.visitInt32=ut(qe);nt.prototype.visitInt64=ut(Mc);nt.prototype.visitUint8=ut(qe);nt.prototype.visitUint16=ut(qe);nt.prototype.visitUint32=ut(qe);nt.prototype.visitUint64=ut(Mc);nt.prototype.visitFloat=ut(Dl);nt.prototype.visitFloat16=ut(Fl);nt.prototype.visitFloat32=ut(qe);nt.prototype.visitFloat64=ut(qe);nt.prototype.visitUtf8=ut(Fc);nt.prototype.visitLargeUtf8=ut(Fc);nt.prototype.visitBinary=ut(Nc);nt.prototype.visitLargeBinary=ut(Nc);nt.prototype.visitFixedSizeBinary=ut(Ol);nt.prototype.visitDate=ut(Ul);nt.prototype.visitDateDay=ut(Ec);nt.prototype.visitDateMillisecond=ut(Tc);nt.prototype.visitTimestamp=ut(Ll);nt.prototype.visitTimestampSecond=ut(Oc);nt.prototype.visitTimestampMillisecond=ut(kc);nt.prototype.visitTimestampMicrosecond=ut(Dc);nt.prototype.visitTimestampNanosecond=ut(Uc);nt.prototype.visitTime=ut(Cl);nt.prototype.visitTimeSecond=ut(Lc);nt.prototype.visitTimeMillisecond=ut(Cc);nt.prototype.visitTimeMicrosecond=ut(Rc);nt.prototype.visitTimeNanosecond=ut(Pc);nt.prototype.visitDecimal=ut(Rl);nt.prototype.visitList=ut(Pl);nt.prototype.visitStruct=ut(zl);nt.prototype.visitUnion=ut(jl);nt.prototype.visitDenseUnion=ut($c);nt.prototype.visitSparseUnion=ut(zc);nt.prototype.visitDictionary=ut(Vl);nt.prototype.visitInterval=ut(Wl);nt.prototype.visitIntervalDayTime=ut(jc);nt.prototype.visitIntervalYearMonth=ut(Vc);nt.prototype.visitDuration=ut(Zl);nt.prototype.visitDurationSecond=ut(Wc);nt.prototype.visitDurationMillisecond=ut(Zc);nt.prototype.visitDurationMicrosecond=ut(Gc);nt.prototype.visitDurationNanosecond=ut(Yc);nt.prototype.visitFixedSizeList=ut(Gl);nt.prototype.visitMap=ut($l);const ne=new nt,yr=Symbol.for("keys"),Br=Symbol.for("vals"),gr=Symbol.for("kKeysAsStrings"),ns=Symbol.for("_kKeysAsStrings");class Ms{constructor(t){return this[yr]=new Ft([t.children[0]]).memoize(),this[Br]=t.children[1],new Proxy(this,new Jl)}get[gr](){return this[ns]||(this[ns]=Array.from(this[yr].toArray(),String))}[Symbol.iterator](){return new Yl(this[yr],this[Br])}get size(){return this[yr].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[yr],e=this[Br],n={};for(let s=-1,i=t.length;++s<i;)n[t.get(s)]=ne.visit(e,s);return n}toString(){return`{${[...this].map(([t,e])=>`${hn(t)}: ${hn(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class Yl{constructor(t,e){this.keys=t,this.vals=e,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){const t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),ne.visit(this.vals,t)]})}}class Jl{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[gr]}has(t,e){return t[gr].includes(e)}getOwnPropertyDescriptor(t,e){if(t[gr].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[gr].indexOf(e);if(n!==-1){const s=ne.visit(Reflect.get(t,Br),n);return Reflect.set(t,e,s),s}}set(t,e,n){const s=t[gr].indexOf(e);return s!==-1?(fe.visit(Reflect.get(t,Br),s,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}}Object.defineProperties(Ms.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[yr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Br]:{writable:!0,enumerable:!1,configurable:!1,value:null},[ns]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let So;function Jc(r,t,e,n){const{length:s=0}=r;let i=typeof t!="number"?0:t,c=typeof e!="number"?s:e;return i<0&&(i=(i%s+s)%s),c<0&&(c=(c%s+s)%s),c<i&&(So=i,i=c,c=So),c>s&&(c=s),n?n(r,i,c):[i,c]}const Ns=(r,t)=>r<0?t+r:r,Io=r=>r!==r;function Or(r){if(typeof r!=="object"||r===null)return Io(r)?Io:e=>e===r;if(r instanceof Date){const e=r.valueOf();return n=>n instanceof Date?n.valueOf()===e:!1}return ArrayBuffer.isView(r)?e=>e?Zh(r,e):!1:r instanceof Map?ql(r):Array.isArray(r)?Hl(r):r instanceof Ft?Kl(r):Xl(r,!0)}function Hl(r){const t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Or(r[e]);return vi(t)}function ql(r){let t=-1;const e=[];for(const n of r.values())e[++t]=Or(n);return vi(e)}function Kl(r){const t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Or(r.get(e));return vi(t)}function Xl(r,t=!1){const e=Object.keys(r);if(!t&&e.length===0)return()=>!1;const n=[];for(let s=-1,i=e.length;++s<i;)n[s]=Or(r[e[s]]);return vi(n,e)}function vi(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return Ql(r,e);case Map:return Bo(r,e,e.keys());case Ms:case Ts:case Object:case void 0:return Bo(r,e,t||Object.keys(e))}return e instanceof Ft?td(r,e):!1}}function Ql(r,t){const 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 td(r,t){const 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 Bo(r,t,e){const n=e[Symbol.iterator](),s=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),i=t instanceof Map?t.values():Object.values(t)[Symbol.iterator]();let c=0;const a=r.length;let d=i.next(),f=n.next(),y=s.next();for(;c<a&&!f.done&&!y.done&&!d.done&&!(f.value!==y.value||!r[c](d.value));++c,f=n.next(),y=s.next(),d=i.next());return c===a&&f.done&&y.done&&d.done?!0:(n.return&&n.return(),s.return&&s.return(),i.return&&i.return(),!1)}function Hc(r,t,e,n){return(e&1<<n)!==0}function ed(r,t,e,n){return(e&1<<n)>>n}function vo(r,t,e){const n=e.byteLength+7&-8;if(r>0||e.byteLength<n){const s=new Uint8Array(n);return s.set(r%8===0?e.subarray(r>>3):is(new Fs(e,r,t,null,Hc)).subarray(0,n)),s}return e}function is(r){const t=[];let e=0,n=0,s=0;for(const c of r)c&&(s|=1<<n),++n===8&&(t[e++]=s,s=n=0);(e===0||n>0)&&(t[e++]=s);const i=new Uint8Array(t.length+7&-8);return i.set(t),i}class Fs{constructor(t,e,n,s,i){this.bytes=t,this.length=n,this.context=s,this.get=i,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 ss(r,t,e){if(e-t<=0)return 0;if(e-t<8){let i=0;for(const c of new Fs(r,t,e-t,r,ed))i+=c;return i}const n=e>>3<<3,s=t+(t%8===0?0:8-t%8);return ss(r,t,s)+ss(r,n,e)+rd(r,s>>3,n-s>>3)}function rd(r,t,e){let n=0,s=Math.trunc(t);const i=new DataView(r.buffer,r.byteOffset,r.byteLength),c=e===void 0?r.byteLength:s+e;for(;c-s>=4;)n+=Li(i.getUint32(s)),s+=4;for(;c-s>=2;)n+=Li(i.getUint16(s)),s+=2;for(;c-s>=1;)n+=Li(i.getUint8(s)),s+=1;return n}function Li(r){let t=Math.trunc(r);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}const nd=-1;class Et{get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){const{type:t}=this;return tt.isSparseUnion(t)?this.children.some(e=>e.nullable):tt.isDenseUnion(t)?this.children.some(e=>e.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0;const{valueOffsets:e,values:n,nullBitmap:s,typeIds:i}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),s&&(t+=s.byteLength),i&&(t+=i.byteLength),this.children.reduce((c,a)=>c+a.byteLength,t)}get nullCount(){if(tt.isUnion(this.type))return this.children.reduce((n,s)=>n+s.nullCount,0);let t=this._nullCount,e;return t<=nd&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-ss(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,s,i,c=[],a){this.type=t,this.children=c,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(s||0,-1));let d;i instanceof Et?(this.stride=i.stride,this.values=i.values,this.typeIds=i.typeIds,this.nullBitmap=i.nullBitmap,this.valueOffsets=i.valueOffsets):(this.stride=Oe(t),i&&((d=i[0])&&(this.valueOffsets=d),(d=i[1])&&(this.values=d),(d=i[2])&&(this.nullBitmap=d),(d=i[3])&&(this.typeIds=d)))}getValid(t){const{type:e}=this;if(tt.isUnion(e)){const n=e,s=this.children[n.typeIdToChildIndex[this.typeIds[t]]],i=n.mode===re.Dense?this.valueOffsets[t]:t;return s.getValid(i)}if(this.nullable&&this.nullCount>0){const n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,e){let n;const{type:s}=this;if(tt.isUnion(s)){const i=s,c=this.children[i.typeIdToChildIndex[this.typeIds[t]]],a=i.mode===re.Dense?this.valueOffsets[t]:t;n=c.getValid(a),c.setValid(a,e)}else{let{nullBitmap:i}=this;const{offset:c,length:a}=this,d=c+t,f=1<<d%8,y=d>>3;(!i||i.byteLength<=y)&&(i=new Uint8Array((c+a+63&-64)>>3).fill(255),this.nullCount>0?(i.set(vo(c,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:i})):Object.assign(this,{nullBitmap:i,_nullCount:0}));const B=i[y];n=(B&f)!==0,i[y]=e?B|f:B&~f}return n!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,n=this.length,s=this._nullCount,i=this,c=this.children){return new Et(t,e,n,s,i,c,this.dictionary)}slice(t,e){const{stride:n,typeId:s,children:i}=this,c=+(this._nullCount===0)-1,a=s===16?n:1,d=this._sliceBuffers(t,e,n,s);return this.clone(this.type,this.offset+t,e,c,d,i.length===0||this.valueOffsets?i:this._sliceChildren(i,a*t,a*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===E.Null)return this.clone(this.type,0,t,0);const{length:e,nullCount:n}=this,s=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);s[e>>3]=(1<<e-(e&-8))-1,n>0&&s.set(vo(this.offset,e,this.nullBitmap),0);const i=this.buffers;return i[Fe.VALIDITY]=s,this.clone(this.type,0,t,n+(t-e),i)}_sliceBuffers(t,e,n,s){let i;const{buffers:c}=this;return(i=c[Fe.TYPE])&&(c[Fe.TYPE]=i.subarray(t,t+e)),(i=c[Fe.OFFSET])&&(c[Fe.OFFSET]=i.subarray(t,t+e+1))||(i=c[Fe.DATA])&&(c[Fe.DATA]=s===6?i:i.subarray(n*t,n*(t+e))),c}_sliceChildren(t,e,n){return t.map(s=>s.slice(e,n))}}Et.prototype.children=Object.freeze([]);class an extends St{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{["type"]:e,["offset"]:n=0,["length"]:s=0}=t;return new Et(e,n,s,s)}visitBool(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.ArrayType,t.data),{["length"]:c=i.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Et(e,n,c,a,[void 0,i,s])}visitInt(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.ArrayType,t.data),{["length"]:c=i.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Et(e,n,c,a,[void 0,i,s])}visitFloat(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.ArrayType,t.data),{["length"]:c=i.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Et(e,n,c,a,[void 0,i,s])}visitUtf8(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.data),i=It(t.nullBitmap),c=Dr(t.valueOffsets),{["length"]:a=c.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new Et(e,n,a,d,[c,s,i])}visitLargeUtf8(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.data),i=It(t.nullBitmap),c=uo(t.valueOffsets),{["length"]:a=c.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new Et(e,n,a,d,[c,s,i])}visitBinary(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.data),i=It(t.nullBitmap),c=Dr(t.valueOffsets),{["length"]:a=c.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new Et(e,n,a,d,[c,s,i])}visitLargeBinary(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.data),i=It(t.nullBitmap),c=uo(t.valueOffsets),{["length"]:a=c.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new Et(e,n,a,d,[c,s,i])}visitFixedSizeBinary(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.ArrayType,t.data),{["length"]:c=i.length/Oe(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Et(e,n,c,a,[void 0,i,s])}visitDate(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.ArrayType,t.data),{["length"]:c=i.length/Oe(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Et(e,n,c,a,[void 0,i,s])}visitTimestamp(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.ArrayType,t.data),{["length"]:c=i.length/Oe(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Et(e,n,c,a,[void 0,i,s])}visitTime(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.ArrayType,t.data),{["length"]:c=i.length/Oe(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Et(e,n,c,a,[void 0,i,s])}visitDecimal(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.ArrayType,t.data),{["length"]:c=i.length/Oe(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Et(e,n,c,a,[void 0,i,s])}visitList(t){const{["type"]:e,["offset"]:n=0,["child"]:s}=t,i=It(t.nullBitmap),c=Dr(t.valueOffsets),{["length"]:a=c.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new Et(e,n,a,d,[c,void 0,i],[s])}visitStruct(t){const{["type"]:e,["offset"]:n=0,["children"]:s=[]}=t,i=It(t.nullBitmap),{length:c=s.reduce((d,{length:f})=>Math.max(d,f),0),nullCount:a=t.nullBitmap?-1:0}=t;return new Et(e,n,c,a,[void 0,void 0,i],s)}visitUnion(t){const{["type"]:e,["offset"]:n=0,["children"]:s=[]}=t,i=Mt(e.ArrayType,t.typeIds),{["length"]:c=i.length,["nullCount"]:a=-1}=t;if(tt.isSparseUnion(e))return new Et(e,n,c,a,[void 0,void 0,void 0,i],s);const d=Dr(t.valueOffsets);return new Et(e,n,c,a,[d,void 0,void 0,i],s)}visitDictionary(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.indices.ArrayType,t.data),{["dictionary"]:c=new Ft([new an().visit({type:e.dictionary})])}=t,{["length"]:a=i.length,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new Et(e,n,a,d,[void 0,i,s],[],c)}visitInterval(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.ArrayType,t.data),{["length"]:c=i.length/Oe(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Et(e,n,c,a,[void 0,i,s])}visitDuration(t){const{["type"]:e,["offset"]:n=0}=t,s=It(t.nullBitmap),i=Mt(e.ArrayType,t.data),{["length"]:c=i.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Et(e,n,c,a,[void 0,i,s])}visitFixedSizeList(t){const{["type"]:e,["offset"]:n=0,["child"]:s=new an().visit({type:e.valueType})}=t,i=It(t.nullBitmap),{["length"]:c=s.length/Oe(e),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new Et(e,n,c,a,[void 0,void 0,i],[s])}visitMap(t){const{["type"]:e,["offset"]:n=0,["child"]:s=new an().visit({type:e.childType})}=t,i=It(t.nullBitmap),c=Dr(t.valueOffsets),{["length"]:a=c.length-1,["nullCount"]:d=t.nullBitmap?-1:0}=t;return new Et(e,n,a,d,[c,void 0,i],[s])}}const id=new an;function _t(r){return id.visit(r)}class xo{constructor(t=0,e){this.numChunks=t,this.getChunkIterator=e,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){const t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}}function sd(r){return r.some(t=>t.nullable)}function qc(r){return r.reduce((t,e)=>t+e.nullCount,0)}function Kc(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function Xc(r,t,e,n){const s=[];for(let i=-1,c=r.length;++i<c;){const a=r[i],d=t[i],{length:f}=a;if(d>=n)break;if(e>=d+f)continue;if(d>=e&&d+f<=n){s.push(a);continue}const y=Math.max(0,e-d),B=Math.min(n-d,f);s.push(a.slice(y,B-y))}return s.length===0&&s.push(r[0].slice(0,0)),s}function Os(r,t,e,n){let s=0,i=0,c=t.length-1;do{if(s>=c-1)return e<t[c]?n(r,s,e-t[s]):null;i=s+Math.trunc((c-s)*.5),e<t[i]?c=i:s=i}while(s<c)}function ks(r,t){return r.getValid(t)}function ai(r){function t(e,n,s){return r(e[n],s)}return function(e){const n=this.data;return Os(n,this._offsets,e,t)}}function Qc(r){let t;function e(n,s,i){return r(n[s],i,t)}return function(n,s){const i=this.data;t=s;const c=Os(i,this._offsets,n,e);return t=void 0,c}}function tu(r){let t;function e(n,s,i){let c=i,a=0,d=0;for(let f=s-1,y=n.length;++f<y;){const B=n[f];if(~(a=r(B,t,c)))return d+a;c=0,d+=B.length}return-1}return function(n,s){t=n;const i=this.data,c=typeof s!="number"?e(i,0,0):Os(i,this._offsets,s,e);return t=void 0,c}}class it extends St{}function od(r,t){return t===null&&r.length>0?0:-1}function ad(r,t){const{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(const s of new Fs(e,r.offset+(t||0),r.length,e,Hc)){if(!s)return n;++n}return-1}function ft(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case E.Union:break;case E.Dictionary:break;default:return ad(r,e)}const n=ne.getVisitFn(r),s=Or(t);for(let i=(e||0)-1,c=r.length;++i<c;)if(s(n(r,i)))return i;return-1}function eu(r,t,e){const n=ne.getVisitFn(r),s=Or(t);for(let i=(e||0)-1,c=r.length;++i<c;)if(s(n(r,i)))return i;return-1}it.prototype.visitNull=od;it.prototype.visitBool=ft;it.prototype.visitInt=ft;it.prototype.visitInt8=ft;it.prototype.visitInt16=ft;it.prototype.visitInt32=ft;it.prototype.visitInt64=ft;it.prototype.visitUint8=ft;it.prototype.visitUint16=ft;it.prototype.visitUint32=ft;it.prototype.visitUint64=ft;it.prototype.visitFloat=ft;it.prototype.visitFloat16=ft;it.prototype.visitFloat32=ft;it.prototype.visitFloat64=ft;it.prototype.visitUtf8=ft;it.prototype.visitLargeUtf8=ft;it.prototype.visitBinary=ft;it.prototype.visitLargeBinary=ft;it.prototype.visitFixedSizeBinary=ft;it.prototype.visitDate=ft;it.prototype.visitDateDay=ft;it.prototype.visitDateMillisecond=ft;it.prototype.visitTimestamp=ft;it.prototype.visitTimestampSecond=ft;it.prototype.visitTimestampMillisecond=ft;it.prototype.visitTimestampMicrosecond=ft;it.prototype.visitTimestampNanosecond=ft;it.prototype.visitTime=ft;it.prototype.visitTimeSecond=ft;it.prototype.visitTimeMillisecond=ft;it.prototype.visitTimeMicrosecond=ft;it.prototype.visitTimeNanosecond=ft;it.prototype.visitDecimal=ft;it.prototype.visitList=ft;it.prototype.visitStruct=ft;it.prototype.visitUnion=ft;it.prototype.visitDenseUnion=eu;it.prototype.visitSparseUnion=eu;it.prototype.visitDictionary=ft;it.prototype.visitInterval=ft;it.prototype.visitIntervalDayTime=ft;it.prototype.visitIntervalYearMonth=ft;it.prototype.visitDuration=ft;it.prototype.visitDurationSecond=ft;it.prototype.visitDurationMillisecond=ft;it.prototype.visitDurationMicrosecond=ft;it.prototype.visitDurationNanosecond=ft;it.prototype.visitFixedSizeList=ft;it.prototype.visitMap=ft;const ci=new it;class st extends St{}function ht(r){const{type:t}=r;if(r.nullCount===0&&r.stride===1&&(tt.isInt(t)&&t.bitWidth!==64||tt.isTime(t)&&t.bitWidth!==64||tt.isFloat(t)&&t.precision!==Jt.HALF))return new xo(r.data.length,n=>{const s=r.data[n];return s.values.subarray(0,s.length)[Symbol.iterator]()});let e=0;return new xo(r.data.length,n=>{const i=r.data[n].length,c=r.slice(e,e+i);return e+=i,new cd(c)})}class cd{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}}st.prototype.visitNull=ht;st.prototype.visitBool=ht;st.prototype.visitInt=ht;st.prototype.visitInt8=ht;st.prototype.visitInt16=ht;st.prototype.visitInt32=ht;st.prototype.visitInt64=ht;st.prototype.visitUint8=ht;st.prototype.visitUint16=ht;st.prototype.visitUint32=ht;st.prototype.visitUint64=ht;st.prototype.visitFloat=ht;st.prototype.visitFloat16=ht;st.prototype.visitFloat32=ht;st.prototype.visitFloat64=ht;st.prototype.visitUtf8=ht;st.prototype.visitLargeUtf8=ht;st.prototype.visitBinary=ht;st.prototype.visitLargeBinary=ht;st.prototype.visitFixedSizeBinary=ht;st.prototype.visitDate=ht;st.prototype.visitDateDay=ht;st.prototype.visitDateMillisecond=ht;st.prototype.visitTimestamp=ht;st.prototype.visitTimestampSecond=ht;st.prototype.visitTimestampMillisecond=ht;st.prototype.visitTimestampMicrosecond=ht;st.prototype.visitTimestampNanosecond=ht;st.prototype.visitTime=ht;st.prototype.visitTimeSecond=ht;st.prototype.visitTimeMillisecond=ht;st.prototype.visitTimeMicrosecond=ht;st.prototype.visitTimeNanosecond=ht;st.prototype.visitDecimal=ht;st.prototype.visitList=ht;st.prototype.visitStruct=ht;st.prototype.visitUnion=ht;st.prototype.visitDenseUnion=ht;st.prototype.visitSparseUnion=ht;st.prototype.visitDictionary=ht;st.prototype.visitInterval=ht;st.prototype.visitIntervalDayTime=ht;st.prototype.visitIntervalYearMonth=ht;st.prototype.visitDuration=ht;st.prototype.visitDurationSecond=ht;st.prototype.visitDurationMillisecond=ht;st.prototype.visitDurationMicrosecond=ht;st.prototype.visitDurationNanosecond=ht;st.prototype.visitFixedSizeList=ht;st.prototype.visitMap=ht;const Ds=new st;var ru;const nu={},iu={};class Ft{constructor(t){var e,n,s;const i=t[0]instanceof Ft?t.flatMap(a=>a.data):t;if(i.length===0||i.some(a=>!(a instanceof Et)))throw new TypeError("Vector constructor expects an Array of Data instances.");const c=(e=i[0])===null||e===void 0?void 0:e.type;switch(i.length){case 0:this._offsets=[0];break;case 1:{const{get:a,set:d,indexOf:f}=nu[c.typeId],y=i[0];this.isValid=B=>ks(y,B),this.get=B=>a(y,B),this.set=(B,L)=>d(y,B,L),this.indexOf=B=>f(y,B),this._offsets=[0,y.length];break}default:Object.setPrototypeOf(this,iu[c.typeId]),this._offsets=Kc(i);break}this.data=i,this.type=c,this.stride=Oe(c),this.numChildren=(s=(n=c.children)===null||n===void 0?void 0:n.length)!==null&&s!==void 0?s:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return sd(this.data)}get nullCount(){return qc(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${E[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(Ns(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return Ds.visit(this)}concat(...t){return new Ft(this.data.concat(t.flatMap(e=>e.data).flat(Number.POSITIVE_INFINITY)))}slice(t,e){return new Ft(Jc(this,t,e,({data:n,_offsets:s},i,c)=>Xc(n,s,i,c)))}toJSON(){return[...this]}toArray(){const{type:t,data:e,length:n,stride:s,ArrayType:i}=this;switch(t.typeId){case E.Int:case E.Float:case E.Decimal:case E.Time:case E.Timestamp:switch(e.length){case 0:return new i;case 1:return e[0].values.subarray(0,n*s);default:return e.reduce((c,{values:a,length:d})=>(c.array.set(a.subarray(0,d*s),c.offset),c.offset+=d*s,c),{array:new i(n*s),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 Ft(this.data.map(({children:e})=>e[t])):null}get isMemoized(){return tt.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(tt.isDictionary(this.type)){const t=new ui(this.data[0].dictionary),e=this.data.map(n=>{const s=n.clone();return s.dictionary=t,s});return new Ft(e)}return new ui(this)}unmemoize(){if(tt.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),e=this.data.map(n=>{const s=n.clone();return s.dictionary=t,s});return new Ft(e)}return this}}ru=Symbol.toStringTag;Ft[ru]=(r=>{r.type=tt.prototype,r.data=[],r.length=0,r.stride=1,r.numChildren=0,r._offsets=new Uint32Array([0]),r[Symbol.isConcatSpreadable]=!0;const t=Object.keys(E).map(e=>E[e]).filter(e=>typeof e=="number"&&e!==E.NONE);for(const e of t){const n=ne.getVisitFnByTypeId(e),s=fe.getVisitFnByTypeId(e),i=ci.getVisitFnByTypeId(e);nu[e]={get:n,set:s,indexOf:i},iu[e]=Object.create(r,{isValid:{value:ai(ks)},get:{value:ai(ne.getVisitFnByTypeId(e))},set:{value:Qc(fe.getVisitFnByTypeId(e))},indexOf:{value:tu(ci.getVisitFnByTypeId(e))}})}return"Vector"})(Ft.prototype);class ui extends Ft{constructor(t){super(t.data);const e=this.get,n=this.set,s=this.slice,i=new Array(this.length);Object.defineProperty(this,"get",{value(c){const a=i[c];if(a!==void 0)return a;const d=e.call(this,c);return i[c]=d,d}}),Object.defineProperty(this,"set",{value(c,a){n.call(this,c,a),i[c]=a}}),Object.defineProperty(this,"slice",{value:(c,a)=>new ui(s.call(this,c,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new Ft(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}class os{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,s){return t.prep(8,24),t.writeInt64(BigInt(s??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(e??0)),t.offset()}}class ie{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 ie).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,e){return t.setPosition(t.position()+xt),(e||new ie).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):zt.V1}schema(t){const e=this.bb.__offset(this.bb_pos,6);return e?(t||new Se).__init(this.bb.__indirect(this.bb_pos+e),this.bb):null}dictionaries(t,e){const n=this.bb.__offset(this.bb_pos,8);return n?(e||new os).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){const t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,e){const n=this.bb.__offset(this.bb_pos,10);return n?(e||new os).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,12);return n?(e||new jt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,zt.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)}}class vt{constructor(t=[],e,n,s=zt.V5){this.fields=t||[],this.metadata=e||new Map,n||(n=as(this.fields)),this.dictionaries=n,this.metadataVersion=s}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){const e=new Set(t),n=this.fields.filter(s=>e.has(s.name));return new vt(n,this.metadata)}selectAt(t){const e=t.map(n=>this.fields[n]).filter(Boolean);return new vt(e,this.metadata)}assign(...t){const e=t[0]instanceof vt?t[0]:Array.isArray(t[0])?new vt(t[0]):new vt(t),n=[...this.fields],s=Bn(Bn(new Map,this.metadata),e.metadata),i=e.fields.filter(a=>{const d=n.findIndex(f=>f.name===a.name);return~d?(n[d]=a.clone({metadata:Bn(Bn(new Map,n[d].metadata),a.metadata)}))&&!1:!0}),c=as(i,new Map);return new vt([...n,...i],s,new Map([...this.dictionaries,...c]))}}vt.prototype.fields=null;vt.prototype.metadata=null;vt.prototype.dictionaries=null;class Ct{static new(...t){let[e,n,s,i]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],n===void 0&&(n=t[0].type),s===void 0&&(s=t[0].nullable),i===void 0&&(i=t[0].metadata)),new Ct(`${e}`,n,s,i)}constructor(t,e,n=!1,s){this.name=t,this.type=e,this.nullable=n,this.metadata=s||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,n,s,i]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,n=this.type,s=this.nullable,i=this.metadata]=t:{name:e=this.name,type:n=this.type,nullable:s=this.nullable,metadata:i=this.metadata}=t[0],Ct.new(e,n,s,i)}}Ct.prototype.type=null;Ct.prototype.name=null;Ct.prototype.nullable=null;Ct.prototype.metadata=null;function Bn(r,t){return new Map([...r||new Map,...t||new Map])}function as(r,t=new Map){for(let e=-1,n=r.length;++e<n;){const i=r[e].type;if(tt.isDictionary(i)){if(!t.has(i.id))t.set(i.id,i.dictionary);else if(t.get(i.id)!==i.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}i.children&&i.children.length>0&&as(i.children,t)}return t}var ud=Ta,hd=xr;class Us{static decode(t){t=new hd(It(t));const e=ie.getRootAsFooter(t),n=vt.decode(e.schema(),new Map,e.version());return new ld(n,e)}static encode(t){const e=new ud,n=vt.encode(e,t.schema);ie.startRecordBatchesVector(e,t.numRecordBatches);for(const c of[...t.recordBatches()].slice().reverse())Tr.encode(e,c);const s=e.endVector();ie.startDictionariesVector(e,t.numDictionaries);for(const c of[...t.dictionaryBatches()].slice().reverse())Tr.encode(e,c);const i=e.endVector();return ie.startFooter(e),ie.addSchema(e,n),ie.addVersion(e,zt.V5),ie.addRecordBatches(e,s),ie.addDictionaries(e,i),ie.finishFooterBuffer(e,ie.endFooter(e)),e.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,e=zt.V5,n,s){this.schema=t,this.version=e,n&&(this._recordBatches=n),s&&(this._dictionaryBatches=s)}*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}}class ld extends Us{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){const e=this._footer.recordBatches(t);if(e)return Tr.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){const e=this._footer.dictionaries(t);if(e)return Tr.decode(e)}return null}}class Tr{static decode(t){return new Tr(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){const{metaDataLength:n}=e,s=BigInt(e.offset),i=BigInt(e.bodyLength);return os.createBlock(t,s,n,i)}constructor(t,e,n){this.metaDataLength=t,this.offset=Lt(n),this.bodyLength=Lt(e)}}const Rt=Object.freeze({done:!0,value:void 0});class Ao{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class su{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())}}class dd extends su{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return gt(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){const{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(Rt);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return ce.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return ce.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return gt(this,void 0,void 0,function*(){return yield this.abort(t),Rt})}return(t){return gt(this,void 0,void 0,function*(){return yield this.close(),Rt})}read(t){return gt(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return gt(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(Rt)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class fd extends dd{write(t){if((t=It(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Ki(this.toUint8Array(!0)):this.toUint8Array(!1).then(Ki)}toUint8Array(t=!1){return t?Ee(this._values)[0]:gt(this,void 0,void 0,function*(){var e,n,s,i;const c=[];let a=0;try{for(var d=!0,f=br(this),y;y=yield f.next(),e=y.done,!e;d=!0){i=y.value,d=!1;const B=i;c.push(B),a+=B.byteLength}}catch(B){n={error:B}}finally{try{!d&&!e&&(s=f.return)&&(yield s.call(f))}finally{if(n)throw n.error}}return Ee(c,a)[0]})}}class hi{constructor(t){t&&(this.source=new pd(ce.fromIterable(t)))}[Symbol.iterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class Mr{constructor(t){t instanceof Mr?this.source=t.source:t instanceof fd?this.source=new Xe(ce.fromAsyncIterable(t)):xa(t)?this.source=new Xe(ce.fromNodeStream(t)):vs(t)?this.source=new Xe(ce.fromDOMStream(t)):Ba(t)?this.source=new Xe(ce.fromDOMStream(t.body)):Bi(t)?this.source=new Xe(ce.fromIterable(t)):un(t)?this.source=new Xe(ce.fromAsyncIterable(t)):Bs(t)&&(this.source=new Xe(ce.fromAsyncIterable(t)))}[Symbol.asyncIterator](){return this}next(t){return this.source.next(t)}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}get closed(){return this.source.closed}cancel(t){return this.source.cancel(t)}peek(t){return this.source.peek(t)}read(t){return this.source.read(t)}}class pd{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)||Rt)}return(t){return Object.create(this.source.return&&this.source.return(t)||Rt)}}class Xe{constructor(t){this.source=t,this._closedPromise=new Promise(e=>this._closedPromiseResolve=e)}cancel(t){return gt(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return gt(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return gt(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return gt(this,arguments,void 0,function*(e,n="read"){return yield this.source.next({cmd:n,size:e})})}throw(t){return gt(this,void 0,void 0,function*(){const e=this.source.throw&&(yield this.source.throw(t))||Rt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}return(t){return gt(this,void 0,void 0,function*(){const e=this.source.return&&(yield this.source.return(t))||Rt;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}}class Eo extends hi{constructor(t,e){super(),this.position=0,this.buffer=It(t),this.size=e===void 0?this.buffer.byteLength:e}readInt32(t){const{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){const{buffer:e,size:n,position:s}=this;return e&&s<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,s+Math.min(n-s,t)),e.subarray(s,this.position)):null}readAt(t,e){const n=this.buffer,s=Math.min(this.size,t+e);return n?n.subarray(t,s):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}}}class li extends Mr{constructor(t,e){super(),this.position=0,this._handle=t,typeof e=="number"?this.size=e:this._pending=gt(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return gt(this,void 0,void 0,function*(){const{buffer:e,byteOffset:n}=yield this.readAt(t,4);return new DataView(e,n).getInt32(0,!0)})}seek(t){return gt(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 gt(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:e,size:n,position:s}=this;if(e&&s<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let i=s,c=0,a=0;const d=Math.min(n,i+Math.min(n-i,t)),f=new Uint8Array(Math.max(0,(this.position=d)-i));for(;(i+=a)<d&&(c+=a)<f.byteLength;)({bytesRead:a}=yield e.read(f,c,f.byteLength-c,i));return f}return null})}readAt(t,e){return gt(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:n,size:s}=this;if(n&&t+e<s){const i=Math.min(s,t+e),c=new Uint8Array(i-t);return(yield n.read(c,0,e,t)).buffer}return new Uint8Array(e)})}close(){return gt(this,void 0,void 0,function*(){const t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return gt(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return gt(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}}const yd=65536;function wr(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}const Nr=8,Ls=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class ou{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){const 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]);let s=e[3]*n[3];this.buffer[0]=s&65535;let i=s>>>16;return s=e[2]*n[3],i+=s,s=e[3]*n[2]>>>0,i+=s,this.buffer[0]+=i<<16,this.buffer[1]=i>>>0<s?yd:0,this.buffer[1]+=i>>>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){const 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`${wr(this.buffer[1])} ${wr(this.buffer[0])}`}}class Tt extends ou{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,e=new Uint32Array(2)){return Tt.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return Tt.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){const n=t.length,s=new Tt(e);for(let i=0;i<n;){const c=Nr<n-i?Nr:n-i,a=new Tt(new Uint32Array([Number.parseInt(t.slice(i,i+c),10),0])),d=new Tt(new Uint32Array([Ls[c],0]));s.times(d),s.plus(a),i+=c}return s}static convertArray(t){const e=new Uint32Array(t.length*2);for(let n=-1,s=t.length;++n<s;)Tt.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new Tt(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Tt(new Uint32Array(t.buffer)).plus(e)}}class te extends ou{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){const 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 te.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(2)){return te.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(2)){const n=t.startsWith("-"),s=t.length,i=new te(e);for(let c=n?1:0;c<s;){const a=Nr<s-c?Nr:s-c,d=new te(new Uint32Array([Number.parseInt(t.slice(c,c+a),10),0])),f=new te(new Uint32Array([Ls[a],0]));i.times(f),i.plus(d),c+=a}return n?i.negate():i}static convertArray(t){const e=new Uint32Array(t.length*2);for(let n=-1,s=t.length;++n<s;)te.from(t[n],new Uint32Array(e.buffer,e.byteOffset+2*n*4,2));return e}static multiply(t,e){return new te(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new te(new Uint32Array(t.buffer)).plus(e)}}class Ie{constructor(t){this.buffer=t}high(){return new te(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new te(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){const e=new Tt(new Uint32Array([this.buffer[3],0])),n=new Tt(new Uint32Array([this.buffer[2],0])),s=new Tt(new Uint32Array([this.buffer[1],0])),i=new Tt(new Uint32Array([this.buffer[0],0])),c=new Tt(new Uint32Array([t.buffer[3],0])),a=new Tt(new Uint32Array([t.buffer[2],0])),d=new Tt(new Uint32Array([t.buffer[1],0])),f=new Tt(new Uint32Array([t.buffer[0],0]));let y=Tt.multiply(i,f);this.buffer[0]=y.low();const B=new Tt(new Uint32Array([y.high(),0]));return y=Tt.multiply(s,f),B.plus(y),y=Tt.multiply(i,d),B.plus(y),this.buffer[1]=B.low(),this.buffer[3]=B.lessThan(y)?1:0,this.buffer[2]=B.high(),new Tt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Tt.multiply(n,f)).plus(Tt.multiply(s,d)).plus(Tt.multiply(i,a)),this.buffer[3]+=Tt.multiply(e,f).plus(Tt.multiply(n,d)).plus(Tt.multiply(s,a)).plus(Tt.multiply(i,c)).low(),this}plus(t){const 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`${wr(this.buffer[3])} ${wr(this.buffer[2])} ${wr(this.buffer[1])} ${wr(this.buffer[0])}`}static multiply(t,e){return new Ie(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Ie(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return Ie.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return Ie.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){const n=t.startsWith("-"),s=t.length,i=new Ie(e);for(let c=n?1:0;c<s;){const a=Nr<s-c?Nr:s-c,d=new Ie(new Uint32Array([Number.parseInt(t.slice(c,c+a),10),0,0,0])),f=new Ie(new Uint32Array([Ls[a],0,0,0]));i.times(f),i.plus(d),c+=a}return n?i.negate():i}static convertArray(t){const e=new Uint32Array(t.length*4);for(let n=-1,s=t.length;++n<s;)Ie.from(t[n],new Uint32Array(e.buffer,e.byteOffset+4*4*n,4));return e}}class au extends St{constructor(t,e,n,s,i=zt.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=s,this.metadataVersion=i}visit(t){return super.visit(t instanceof Ct?t.type:t)}visitNull(t,{length:e}=this.nextFieldNode()){return _t({type:t,length:e})}visitBool(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({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 _t({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 _t({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 _t({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 _t({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({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 _t({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<zt.V5&&this.readNullBitmap(t,n),t.mode===re.Sparse?this.visitSparseUnion(t,{length:e,nullCount:n}):this.visitDenseUnion(t,{length:e,nullCount:n})}visitDenseUnion(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({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 _t({type:t,length:e,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({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 _t({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({type:t,length:e,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:e,nullCount:n}=this.nextFieldNode()){return _t({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 _t({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)}}class gd extends au{constructor(t,e,n,s,i){super(new Uint8Array(0),e,n,s,i),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):is(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return Mt(Uint8Array,Mt(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return Mt(Uint8Array,Mt(t.ArrayType,this.sources[e]))}readData(t,{offset:e}=this.nextBufferRange()){const{sources:n}=this;return tt.isTimestamp(t)||(tt.isInt(t)||tt.isTime(t))&&t.bitWidth===64||tt.isDuration(t)||tt.isDate(t)&&t.unit===de.MILLISECOND?Mt(Uint8Array,te.convertArray(n[e])):tt.isDecimal(t)?Mt(Uint8Array,Ie.convertArray(n[e])):tt.isBinary(t)||tt.isLargeBinary(t)||tt.isFixedSizeBinary(t)?md(n[e]):tt.isBool(t)?is(n[e]):tt.isUtf8(t)||tt.isLargeUtf8(t)?Is(n[e].join("")):Mt(Uint8Array,Mt(t.ArrayType,n[e].map(s=>+s)))}}function md(r){const 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}class ot extends St{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,s)=>this.compareFields(n,e[s]))}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 Xt(r,t){return t instanceof r.constructor}function ir(r,t){return r===t||Xt(r,t)}function Pe(r,t){return r===t||Xt(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function xi(r,t){return r===t||Xt(r,t)&&r.precision===t.precision}function wd(r,t){return r===t||Xt(r,t)&&r.byteWidth===t.byteWidth}function Cs(r,t){return r===t||Xt(r,t)&&r.unit===t.unit}function gn(r,t){return r===t||Xt(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function mn(r,t){return r===t||Xt(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function bd(r,t){return r===t||Xt(r,t)&&r.children.length===t.children.length&&He.compareManyFields(r.children,t.children)}function _d(r,t){return r===t||Xt(r,t)&&r.children.length===t.children.length&&He.compareManyFields(r.children,t.children)}function Rs(r,t){return r===t||Xt(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&He.compareManyFields(r.children,t.children)}function Sd(r,t){return r===t||Xt(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&He.visit(r.indices,t.indices)&&He.visit(r.dictionary,t.dictionary)}function Ps(r,t){return r===t||Xt(r,t)&&r.unit===t.unit}function wn(r,t){return r===t||Xt(r,t)&&r.unit===t.unit}function Id(r,t){return r===t||Xt(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&He.compareManyFields(r.children,t.children)}function Bd(r,t){return r===t||Xt(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&He.compareManyFields(r.children,t.children)}ot.prototype.visitNull=ir;ot.prototype.visitBool=ir;ot.prototype.visitInt=Pe;ot.prototype.visitInt8=Pe;ot.prototype.visitInt16=Pe;ot.prototype.visitInt32=Pe;ot.prototype.visitInt64=Pe;ot.prototype.visitUint8=Pe;ot.prototype.visitUint16=Pe;ot.prototype.visitUint32=Pe;ot.prototype.visitUint64=Pe;ot.prototype.visitFloat=xi;ot.prototype.visitFloat16=xi;ot.prototype.visitFloat32=xi;ot.prototype.visitFloat64=xi;ot.prototype.visitUtf8=ir;ot.prototype.visitLargeUtf8=ir;ot.prototype.visitBinary=ir;ot.prototype.visitLargeBinary=ir;ot.prototype.visitFixedSizeBinary=wd;ot.prototype.visitDate=Cs;ot.prototype.visitDateDay=Cs;ot.prototype.visitDateMillisecond=Cs;ot.prototype.visitTimestamp=gn;ot.prototype.visitTimestampSecond=gn;ot.prototype.visitTimestampMillisecond=gn;ot.prototype.visitTimestampMicrosecond=gn;ot.prototype.visitTimestampNanosecond=gn;ot.prototype.visitTime=mn;ot.prototype.visitTimeSecond=mn;ot.prototype.visitTimeMillisecond=mn;ot.prototype.visitTimeMicrosecond=mn;ot.prototype.visitTimeNanosecond=mn;ot.prototype.visitDecimal=ir;ot.prototype.visitList=bd;ot.prototype.visitStruct=_d;ot.prototype.visitUnion=Rs;ot.prototype.visitDenseUnion=Rs;ot.prototype.visitSparseUnion=Rs;ot.prototype.visitDictionary=Sd;ot.prototype.visitInterval=Ps;ot.prototype.visitIntervalDayTime=Ps;ot.prototype.visitIntervalYearMonth=Ps;ot.prototype.visitDuration=wn;ot.prototype.visitDurationSecond=wn;ot.prototype.visitDurationMillisecond=wn;ot.prototype.visitDurationMicrosecond=wn;ot.prototype.visitDurationNanosecond=wn;ot.prototype.visitFixedSizeList=Id;ot.prototype.visitMap=Bd;const He=new ot;function vd(r,t){return He.compareSchemas(r,t)}function Ci(r,t){return xd(r,t.map(e=>e.data.concat()))}function xd(r,t){const e=[...r.fields],n=[],s={numBatches:t.reduce((B,L)=>Math.max(B,L.length),0)};let i=0,c=0,a=-1;const d=t.length;let f,y=[];for(;s.numBatches-- >0;){for(c=Number.POSITIVE_INFINITY,a=-1;++a<d;)y[a]=f=t[a].shift(),c=Math.min(c,f?f.length:c);Number.isFinite(c)&&(y=Ad(e,c,y,t,s),c>0&&(n[i++]=_t({type:new Kt(e),length:c,nullCount:0,children:y.slice()})))}return[r=r.assign(e),n.map(B=>new ye(r,B))]}function Ad(r,t,e,n,s){var i;const c=(t+63&-64)>>3;for(let a=-1,d=n.length;++a<d;){const f=e[a],y=f?.length;if(y>=t)y===t?e[a]=f:(e[a]=f.slice(0,t),s.numBatches=Math.max(s.numBatches,n[a].unshift(f.slice(t,y-t))));else{const B=r[a];r[a]=B.clone({nullable:!0}),e[a]=(i=f?._changeLengthAndBackfillNullBitmap(t))!==null&&i!==void 0?i:_t({type:B.type,length:t,nullCount:t,nullBitmap:new Uint8Array(c)})}}return e}var cu;class le{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new vt([]),this._offsets=[0],this;let s,i;t[0]instanceof vt&&(s=t.shift()),t.at(-1)instanceof Uint32Array&&(i=t.pop());const c=d=>{if(d){if(d instanceof ye)return[d];if(d instanceof le)return d.batches;if(d instanceof Et){if(d.type instanceof Kt)return[new ye(new vt(d.type.children),d)]}else{if(Array.isArray(d))return d.flatMap(f=>c(f));if(typeof d[Symbol.iterator]=="function")return[...d].flatMap(f=>c(f));if(typeof d=="object"){const f=Object.keys(d),y=f.map(x=>new Ft([d[x]])),B=s??new vt(f.map((x,M)=>new Ct(String(x),y[M].type,y[M].nullable))),[,L]=Ci(B,y);return L.length===0?[new ye(d)]:L}}}return[]},a=t.flatMap(d=>c(d));if(s=(n=s??((e=a[0])===null||e===void 0?void 0:e.schema))!==null&&n!==void 0?n:new vt([]),!(s instanceof vt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const d of a){if(!(d instanceof ye))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!vd(s,d.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=s,this.batches=a,this._offsets=i??Kc(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=qc(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(Ns(t,this.numRows))}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?Ds.visit(new Ft(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
2
2
|
${this.toArray().join(`,
|
|
3
3
|
`)}
|
|
4
|
-
]`}concat(...t){const e=this.schema,n=this.data.concat(t.flatMap(({data:s})=>s));return new le(e,n.map(s=>new ye(e,s)))}slice(t,e){const n=this.schema;[t,e]=Yc({length:this.numRows},t,e);const s=Kc(this.data,this._offsets,t,e);return new le(n,s.map(i=>new ye(n,i)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){const e=this.data.map(n=>n.children[t]);if(e.length===0){const{type:n}=this.schema.fields[t],s=_t({type:n,length:0,nullCount:0});e.push(s._changeLengthAndBackfillNullBitmap(this.numRows))}return new Ft(e)}return null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(s=>s.name===t),e)}setChildAt(t,e){let n=this.schema,s=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new Ft([_t({type:new Je,length:this.numRows})]));const i=n.fields.slice(),a=i[t].clone({type:e.type}),c=this.schema.fields.map((d,f)=>this.getChildAt(f));[i[t],c[t]]=[a,e],[n,s]=Ci(n,c)}return new le(n,s)}select(t){const e=this.schema.fields.reduce((n,s,i)=>n.set(s.name,i),new Map);return this.selectAt(t.map(n=>e.get(n)).filter(n=>n>-1))}selectAt(t){const e=this.schema.selectAt(t),n=this.batches.map(s=>s.selectAt(t));return new le(e,n)}assign(t){const e=this.schema.fields,[n,s]=t.schema.fields.reduce((c,d,f)=>{const[y,B]=c,L=e.findIndex(x=>x.name===d.name);return~L?B[L]=f:y.push(f),c},[[],[]]),i=this.schema.assign(t.schema),a=[...e.map((c,d)=>[d,s[d]]).map(([c,d])=>d===void 0?this.getChildAt(c):t.getChildAt(d)),...n.map(c=>t.getChildAt(c))].filter(Boolean);return new le(...Ci(i,a))}}au=Symbol.toStringTag;le[au]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=ai(ks),r.get=ai(ne.getVisitFn(E.Struct)),r.set=Xc(fe.getVisitFn(E.Struct)),r.indexOf=Qc(ci.getVisitFn(E.Struct)),"Table"))(le.prototype);var cu;let ye=class on{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof vt))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=_t({nullCount:0,type:new Kt(this.schema.fields),children:this.schema.fields.map(e=>_t({type:e.type,nullCount:0}))})]=t,!(this.data instanceof Et))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=To(this.schema,this.data.children);break}case 1:{const[e]=t,{fields:n,children:s,length:i}=Object.keys(e).reduce((d,f,y)=>(d.children[y]=e[f],d.length=Math.max(d.length,e[f].length),d.fields[y]=Ct.new({name:f,type:e[f].type,nullable:!0}),d),{length:0,fields:new Array,children:new Array}),a=new vt(n),c=_t({type:new Kt(n),length:i,children:s,nullCount:0});[this.schema,this.data]=To(a,c.children,i);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=uu(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 ne.visit(this.data,t)}at(t){return this.get(Ns(t,this.numRows))}set(t,e){return fe.visit(this.data,t,e)}indexOf(t,e){return ci.visit(this.data,t,e)}[Symbol.iterator](){return Ds.visit(new Ft([this.data]))}toArray(){return[...this]}concat(...t){return new le(this.schema,[this,...t])}slice(t,e){const[n]=new Ft([this.data]).slice(t,e).data;return new on(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 Ft([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(s=>s.name===t),e)}setChildAt(t,e){let n=this.schema,s=this.data;if(t>-1&&t<this.numCols){e||(e=new Ft([_t({type:new Je,length:this.numRows})]));const i=n.fields.slice(),a=s.children.slice(),c=i[t].clone({type:e.type});[i[t],a[t]]=[c,e.data[0]],n=new vt(i,new Map(this.schema.metadata)),s=_t({type:new Kt(i),children:a})}return new on(n,s)}select(t){const e=this.schema.select(t),n=new Kt(e.fields),s=[];for(const i of t){const a=this.schema.fields.findIndex(c=>c.name===i);~a&&(s[a]=this.data.children[a])}return new on(e,_t({type:n,length:this.numRows,children:s}))}selectAt(t){const e=this.schema.selectAt(t),n=t.map(i=>this.data.children[i]).filter(Boolean),s=_t({type:new Kt(e.fields),length:this.numRows,children:n});return new on(e,s)}};cu=Symbol.toStringTag;ye[cu]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(ye.prototype);function To(r,t,e=t.reduce((n,s)=>Math.max(n,s.length),0)){var n;const s=[...r.fields],i=[...t],a=(e+63&-64)>>3;for(const[c,d]of r.fields.entries()){const f=t[c];(!f||f.length!==e)&&(s[c]=d.clone({nullable:!0}),i[c]=(n=f?._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:_t({type:d.type,length:e,nullCount:e,nullBitmap:new Uint8Array(a)}))}return[r.assign(s),_t({type:new Kt(s),length:e,children:i})]}function uu(r,t,e=new Map){var n,s;if(((n=r?.length)!==null&&n!==void 0?n:0)>0&&r?.length===t?.length)for(let i=-1,a=r.length;++i<a;){const{type:c}=r[i],d=t[i];for(const f of[d,...((s=d?.dictionary)===null||s===void 0?void 0:s.data)||[]])uu(c.children,f?.children,e);if(tt.isDictionary(c)){const{id:f}=c;if(!e.has(f))d?.dictionary&&e.set(f,d.dictionary);else if(e.get(f)!==d.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return e}class hu extends ye{constructor(t){const e=t.fields.map(s=>_t({type:s.type})),n=_t({type:new Kt(t.fields),nullCount:0,children:e});super(t,n)}}let je=class _e{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 _e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+xt),(e||new _e).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):zt.V1}headerType(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Bt.NONE}header(t){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,12);return n?(e||new jt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,zt.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,Bt.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,s,i,a){return _e.startMessage(t),_e.addVersion(t,e),_e.addHeaderType(t,n),_e.addHeader(t,s),_e.addBodyLength(t,i),_e.addCustomMetadata(t,a),_e.endMessage(t)}};class xd extends St{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return wo.startNull(e),wo.endNull(e)}visitInt(t,e){return oe.startInt(e),oe.addBitWidth(e,t.bitWidth),oe.addIsSigned(e,t.isSigned),oe.endInt(e)}visitFloat(t,e){return ve.startFloatingPoint(e),ve.addPrecision(e,t.precision),ve.endFloatingPoint(e)}visitBinary(t,e){return fo.startBinary(e),fo.endBinary(e)}visitLargeBinary(t,e){return yo.startLargeBinary(e),yo.endLargeBinary(e)}visitBool(t,e){return po.startBool(e),po.endBool(e)}visitUtf8(t,e){return bo.startUtf8(e),bo.endUtf8(e)}visitLargeUtf8(t,e){return go.startLargeUtf8(e),go.endLargeUtf8(e)}visitDecimal(t,e){return ur.startDecimal(e),ur.addScale(e,t.scale),ur.addPrecision(e,t.precision),ur.addBitWidth(e,t.bitWidth),ur.endDecimal(e)}visitDate(t,e){return Nn.startDate(e),Nn.addUnit(e,t.unit),Nn.endDate(e)}visitTime(t,e){return ue.startTime(e),ue.addUnit(e,t.unit),ue.addBitWidth(e,t.bitWidth),ue.endTime(e)}visitTimestamp(t,e){const n=t.timezone&&e.createString(t.timezone)||void 0;return he.startTimestamp(e),he.addUnit(e,t.unit),n!==void 0&&he.addTimezone(e,n),he.endTimestamp(e)}visitInterval(t,e){return xe.startInterval(e),xe.addUnit(e,t.unit),xe.endInterval(e)}visitDuration(t,e){return Fn.startDuration(e),Fn.addUnit(e,t.unit),Fn.endDuration(e)}visitList(t,e){return mo.startList(e),mo.endList(e)}visitStruct(t,e){return Qe.startStruct_(e),Qe.endStruct_(e)}visitUnion(t,e){ee.startTypeIdsVector(e,t.typeIds.length);const n=ee.createTypeIdsVector(e,t.typeIds);return ee.startUnion(e),ee.addMode(e,t.mode),ee.addTypeIds(e,n),ee.endUnion(e)}visitDictionary(t,e){const n=this.visit(t.indices,e);return De.startDictionaryEncoding(e),De.addId(e,BigInt(t.id)),De.addIsOrdered(e,t.isOrdered),n!==void 0&&De.addIndexType(e,n),De.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return On.startFixedSizeBinary(e),On.addByteWidth(e,t.byteWidth),On.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return kn.startFixedSizeList(e),kn.addListSize(e,t.listSize),kn.endFixedSizeList(e)}visitMap(t,e){return Dn.startMap(e),Dn.addKeysSorted(e,t.keysSorted),Dn.endMap(e)}}const Ri=new xd;function Ad(r,t=new Map){return new vt(Td(r,t),Ln(r.metadata),t)}function lu(r){return new we(r.count,du(r.columns),fu(r.columns))}function Ed(r){return new Ce(lu(r.data),r.id,r.isDelta)}function Td(r,t){return(r.fields||[]).filter(Boolean).map(e=>Ct.fromJSON(e,t))}function Mo(r,t){return(r.children||[]).filter(Boolean).map(e=>Ct.fromJSON(e,t))}function du(r){return(r||[]).reduce((t,e)=>[...t,new kr(e.count,Md(e.VALIDITY)),...du(e.children)],[])}function fu(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){const s=r[e];s.VALIDITY&&t.push(new Ue(t.length,s.VALIDITY.length)),s.TYPE_ID&&t.push(new Ue(t.length,s.TYPE_ID.length)),s.OFFSET&&t.push(new Ue(t.length,s.OFFSET.length)),s.DATA&&t.push(new Ue(t.length,s.DATA.length)),t=fu(s.children,t)}return t}function Md(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function Nd(r,t){let e,n,s,i,a,c;return!t||!(i=r.dictionary)?(a=Fo(r,Mo(r,t)),s=new Ct(r.name,a,r.nullable,Ln(r.metadata))):t.has(e=i.id)?(n=(n=i.indexType)?No(n):new fn,c=new Er(t.get(e),n,e,i.isOrdered),s=new Ct(r.name,c,r.nullable,Ln(r.metadata))):(n=(n=i.indexType)?No(n):new fn,t.set(e,a=Fo(r,Mo(r,t))),c=new Er(a,n,e,i.isOrdered),s=new Ct(r.name,c,r.nullable,Ln(r.metadata))),s||null}function Ln(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function No(r){return new er(r.isSigned,r.bitWidth)}function Fo(r,t){const e=r.type.name;switch(e){case"NONE":return new Je;case"null":return new Je;case"binary":return new Zn;case"largebinary":return new Gn;case"utf8":return new Yn;case"largeutf8":return new Jn;case"bool":return new Hn;case"list":return new ri((t||[])[0]);case"struct":return new Kt(t||[]);case"struct_":return new Kt(t||[])}switch(e){case"int":{const n=r.type;return new er(n.isSigned,n.bitWidth)}case"floatingpoint":{const n=r.type;return new Wn(Jt[n.precision])}case"decimal":{const n=r.type;return new qn(n.scale,n.precision,n.bitWidth)}case"date":{const n=r.type;return new Kn(de[n.unit])}case"time":{const n=r.type;return new Xn(at[n.unit],n.bitWidth)}case"timestamp":{const n=r.type;return new Qn(at[n.unit],n.timezone)}case"interval":{const n=r.type;return new ti(Te[n.unit])}case"duration":{const n=r.type;return new ei(at[n.unit])}case"union":{const n=r.type,[s,...i]=(n.mode+"").toLowerCase(),a=s.toUpperCase()+i.join("");return new ni(re[a],n.typeIds||[],t||[])}case"fixedsizebinary":{const n=r.type;return new ii(n.byteWidth)}case"fixedsizelist":{const n=r.type;return new si(n.listSize,(t||[])[0])}case"map":{const n=r.type;return new oi((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var Fd=Ea,Od=xr;class ge{static fromJSON(t,e){const n=new ge(0,zt.V5,e);return n._createHeader=kd(t,e),n}static decode(t){t=new Od(It(t));const e=je.getRootAsMessage(t),n=e.bodyLength(),s=e.version(),i=e.headerType(),a=new ge(n,s,i);return a._createHeader=Dd(e,i),a}static encode(t){const e=new Fd;let n=-1;return t.isSchema()?n=vt.encode(e,t.header()):t.isRecordBatch()?n=we.encode(e,t.header()):t.isDictionaryBatch()&&(n=Ce.encode(e,t.header())),je.startMessage(e),je.addVersion(e,zt.V5),je.addHeader(e,n),je.addHeaderType(e,t.headerType),je.addBodyLength(e,BigInt(t.bodyLength)),je.finishMessageBuffer(e,je.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof vt)return new ge(0,zt.V5,Bt.Schema,t);if(t instanceof we)return new ge(e,zt.V5,Bt.RecordBatch,t);if(t instanceof Ce)return new ge(e,zt.V5,Bt.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===Bt.Schema}isRecordBatch(){return this.headerType===Bt.RecordBatch}isDictionaryBatch(){return this.headerType===Bt.DictionaryBatch}constructor(t,e,n,s){this._version=e,this._headerType=n,this.body=new Uint8Array(0),s&&(this._createHeader=()=>s),this._bodyLength=Lt(t)}}class we{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=Lt(t)}}class Ce{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=Lt(e)}}class Ue{constructor(t,e){this.offset=Lt(t),this.length=Lt(e)}}class kr{constructor(t,e){this.length=Lt(t),this.nullCount=Lt(e)}}function kd(r,t){return()=>{switch(t){case Bt.Schema:return vt.fromJSON(r);case Bt.RecordBatch:return we.fromJSON(r);case Bt.DictionaryBatch:return Ce.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${Bt[t]}, type: ${t} }`)}}function Dd(r,t){return()=>{switch(t){case Bt.Schema:return vt.decode(r.header(new Se),new Map,r.version());case Bt.RecordBatch:return we.decode(r.header(new Ne),r.version());case Bt.DictionaryBatch:return Ce.decode(r.header(new ar),r.version())}throw new Error(`Unrecognized Message type: { name: ${Bt[t]}, type: ${t} }`)}}Ct.encode=Zd;Ct.decode=Vd;Ct.fromJSON=Nd;vt.encode=Wd;vt.decode=Ud;vt.fromJSON=Ad;we.encode=Gd;we.decode=Ld;we.fromJSON=lu;Ce.encode=Yd;Ce.decode=Cd;Ce.fromJSON=Ed;kr.encode=Jd;kr.decode=Pd;Ue.encode=Hd;Ue.decode=Rd;function Ud(r,t=new Map,e=zt.V5){const n=jd(r,t);return new vt(n,Cn(r),t,e)}function Ld(r,t=zt.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new we(r.length(),$d(r),zd(r,t))}function Cd(r,t=zt.V5){return new Ce(we.decode(r.data(),t),r.id(),r.isDelta())}function Rd(r){return new Ue(r.offset(),r.length())}function Pd(r){return new kr(r.length(),r.nullCount())}function $d(r){const t=[];for(let e,n=-1,s=-1,i=r.nodesLength();++n<i;)(e=r.nodes(n))&&(t[++s]=kr.decode(e));return t}function zd(r,t){const e=[];for(let n,s=-1,i=-1,a=r.buffersLength();++s<a;)(n=r.buffers(s))&&(t<zt.V4&&(n.bb_pos+=8*(s+1)),e[++i]=Ue.decode(n));return e}function jd(r,t){const e=[];for(let n,s=-1,i=-1,a=r.fieldsLength();++s<a;)(n=r.fields(s))&&(e[++i]=Ct.decode(n,t));return e}function Oo(r,t){const e=[];for(let n,s=-1,i=-1,a=r.childrenLength();++s<a;)(n=r.children(s))&&(e[++i]=Ct.decode(n,t));return e}function Vd(r,t){let e,n,s,i,a,c;return!t||!(c=r.dictionary())?(s=Do(r,Oo(r,t)),n=new Ct(r.name(),s,r.nullable(),Cn(r))):t.has(e=Lt(c.id()))?(i=(i=c.indexType())?ko(i):new fn,a=new Er(t.get(e),i,e,c.isOrdered()),n=new Ct(r.name(),a,r.nullable(),Cn(r))):(i=(i=c.indexType())?ko(i):new fn,t.set(e,s=Do(r,Oo(r,t))),a=new Er(s,i,e,c.isOrdered()),n=new Ct(r.name(),a,r.nullable(),Cn(r))),n||null}function Cn(r){const t=new Map;if(r)for(let e,n,s=-1,i=Math.trunc(r.customMetadataLength());++s<i;)(e=r.customMetadata(s))&&(n=e.key())!=null&&t.set(n,e.value());return t}function ko(r){return new er(r.isSigned(),r.bitWidth())}function Do(r,t){const e=r.typeType();switch(e){case Dt.NONE:return new Je;case Dt.Null:return new Je;case Dt.Binary:return new Zn;case Dt.LargeBinary:return new Gn;case Dt.Utf8:return new Yn;case Dt.LargeUtf8:return new Jn;case Dt.Bool:return new Hn;case Dt.List:return new ri((t||[])[0]);case Dt.Struct_:return new Kt(t||[])}switch(e){case Dt.Int:{const n=r.type(new oe);return new er(n.isSigned(),n.bitWidth())}case Dt.FloatingPoint:{const n=r.type(new ve);return new Wn(n.precision())}case Dt.Decimal:{const n=r.type(new ur);return new qn(n.scale(),n.precision(),n.bitWidth())}case Dt.Date:{const n=r.type(new Nn);return new Kn(n.unit())}case Dt.Time:{const n=r.type(new ue);return new Xn(n.unit(),n.bitWidth())}case Dt.Timestamp:{const n=r.type(new he);return new Qn(n.unit(),n.timezone())}case Dt.Interval:{const n=r.type(new xe);return new ti(n.unit())}case Dt.Duration:{const n=r.type(new Fn);return new ei(n.unit())}case Dt.Union:{const n=r.type(new ee);return new ni(n.mode(),n.typeIdsArray()||[],t||[])}case Dt.FixedSizeBinary:{const n=r.type(new On);return new ii(n.byteWidth())}case Dt.FixedSizeList:{const n=r.type(new kn);return new si(n.listSize(),(t||[])[0])}case Dt.Map:{const n=r.type(new Dn);return new oi((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${Dt[e]}" (${e})`)}function Wd(r,t){const e=t.fields.map(i=>Ct.encode(r,i));Se.startFieldsVector(r,e.length);const n=Se.createFieldsVector(r,e),s=t.metadata&&t.metadata.size>0?Se.createCustomMetadataVector(r,[...t.metadata].map(([i,a])=>{const c=r.createString(`${i}`),d=r.createString(`${a}`);return jt.startKeyValue(r),jt.addKey(r,c),jt.addValue(r,d),jt.endKeyValue(r)})):-1;return Se.startSchema(r),Se.addFields(r,n),Se.addEndianness(r,qd?Ar.Little:Ar.Big),s!==-1&&Se.addCustomMetadata(r,s),Se.endSchema(r)}function Zd(r,t){let e=-1,n=-1,s=-1;const i=t.type;let a=t.typeId;tt.isDictionary(i)?(a=i.dictionary.typeId,s=Ri.visit(i,r),n=Ri.visit(i.dictionary,r)):n=Ri.visit(i,r);const c=(i.children||[]).map(y=>Ct.encode(r,y)),d=ae.createChildrenVector(r,c),f=t.metadata&&t.metadata.size>0?ae.createCustomMetadataVector(r,[...t.metadata].map(([y,B])=>{const L=r.createString(`${y}`),x=r.createString(`${B}`);return jt.startKeyValue(r),jt.addKey(r,L),jt.addValue(r,x),jt.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),ae.startField(r),ae.addType(r,n),ae.addTypeType(r,a),ae.addChildren(r,d),ae.addNullable(r,!!t.nullable),e!==-1&&ae.addName(r,e),s!==-1&&ae.addDictionary(r,s),f!==-1&&ae.addCustomMetadata(r,f),ae.endField(r)}function Gd(r,t){const e=t.nodes||[],n=t.buffers||[];Ne.startNodesVector(r,e.length);for(const a of e.slice().reverse())kr.encode(r,a);const s=r.endVector();Ne.startBuffersVector(r,n.length);for(const a of n.slice().reverse())Ue.encode(r,a);const i=r.endVector();return Ne.startRecordBatch(r),Ne.addLength(r,BigInt(t.length)),Ne.addNodes(r,s),Ne.addBuffers(r,i),Ne.endRecordBatch(r)}function Yd(r,t){const e=we.encode(r,t.data);return ar.startDictionaryBatch(r),ar.addId(r,BigInt(t.id)),ar.addIsDelta(r,t.isDelta),ar.addData(r,e),ar.endDictionaryBatch(r)}function Jd(r,t){return Na.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function Hd(r,t){return Ma.createBuffer(r,BigInt(t.offset),BigInt(t.length))}const qd=(()=>{const r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})(),$s=r=>`Expected ${Bt[r]} Message in stream, but was null or length 0.`,zs=r=>`Header pointer of flatbuffer-encoded ${Bt[r]} Message is null or length 0.`,pu=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,yu=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`;class gu{constructor(t){this.source=t instanceof hi?t:new hi(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done||t.value===-1&&(t=this.readMetadataLength()).done||(t=this.readMetadata(t.value)).done?Rt: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($s(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const e=It(this.source.read(t));if(e.byteLength<t)throw new Error(yu(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){const e=Bt.Schema,n=this.readMessage(e),s=n?.header();if(t&&!s)throw new Error(zs(e));return s}readMetadataLength(){const t=this.source.read(Ai),e=t&&new xr(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){const e=this.source.read(t);if(!e)return Rt;if(e.byteLength<t)throw new Error(pu(t,e.byteLength));return{done:!1,value:ge.decode(e)}}}class Kd{constructor(t,e){this.source=t instanceof Mr?t:Sa(t)?new li(t,e):new Mr(t)}[Symbol.asyncIterator](){return this}next(){return gt(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done||t.value===-1&&(t=yield this.readMetadataLength()).done||(t=yield this.readMetadata(t.value)).done?Rt:t})}throw(t){return gt(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return gt(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return gt(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($s(t));return e.value})}readMessageBody(t){return gt(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);const e=It(yield this.source.read(t));if(e.byteLength<t)throw new Error(yu(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(){return gt(this,arguments,void 0,function*(t=!1){const e=Bt.Schema,n=yield this.readMessage(e),s=n?.header();if(t&&!s)throw new Error(zs(e));return s})}readMetadataLength(){return gt(this,void 0,void 0,function*(){const t=yield this.source.read(Ai),e=t&&new xr(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return gt(this,void 0,void 0,function*(){const e=yield this.source.read(t);if(!e)return Rt;if(e.byteLength<t)throw new Error(pu(t,e.byteLength));return{done:!1,value:ge.decode(e)}})}}class Xd extends gu{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Ao?t:new Ao(t)}next(){const{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:ge.fromJSON(t.schema,Bt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){const e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:ge.fromJSON(e,Bt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){const e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:ge.fromJSON(e,Bt.RecordBatch)}}return this._body=[],Rt}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((s,i)=>[...s,...i.VALIDITY&&[i.VALIDITY]||[],...i.TYPE_ID&&[i.TYPE_ID]||[],...i.OFFSET&&[i.OFFSET]||[],...i.DATA&&[i.DATA]||[],...e(i.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error($s(t));return e.value}readSchema(){const t=Bt.Schema,e=this.readMessage(t),n=e?.header();if(!e||!n)throw new Error(zs(t));return n}}const Ai=4,cs="ARROW1",di=new Uint8Array(cs.length);for(let r=0;r<cs.length;r+=1)di[r]=cs.codePointAt(r);function js(r,t=0){for(let e=-1,n=di.length;++e<n;)if(di[e]!==r[t+e])return!1;return!0}const bn=di.length,mu=bn+Ai,Qd=bn*2+Ai;class Le extends iu{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){const e=this._impl.open(t);return un(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 ce.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return ce.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 Le?t:Xi(t)?nf(t):Sa(t)?af(t):un(t)?gt(this,void 0,void 0,function*(){return yield Le.from(yield t)}):Ia(t)||vs(t)||va(t)||Bs(t)?of(new Mr(t)):sf(new hi(t))}static readAll(t){return t instanceof Le?t.isSync()?Uo(t):Lo(t):Xi(t)||ArrayBuffer.isView(t)||Bi(t)||_a(t)?Uo(t):Lo(t)}}class fi extends Le{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Ae(this,arguments,function*(){yield wt(yield*Mn(br(this[Symbol.iterator]())))})}}class pi extends Le{constructor(t){super(t),this._impl=t}readAll(){return gt(this,void 0,void 0,function*(){var t,e,n,s;const i=new Array;try{for(var a=!0,c=br(this),d;d=yield c.next(),t=d.done,!t;a=!0){s=d.value,a=!1;const f=s;i.push(f)}}catch(f){e={error:f}}finally{try{!a&&!t&&(n=c.return)&&(yield n.call(c))}finally{if(e)throw e.error}}return i})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class wu extends fi{constructor(t){super(t),this._impl=t}}class tf extends pi{constructor(t){super(t),this._impl=t}}class bu{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){const n=this._loadVectors(t,e,this.schema.fields),s=_t({type:new Kt(this.schema.fields),length:t.length,children:n});return new ye(this.schema,s)}_loadDictionaryBatch(t,e){const{id:n,isDelta:s}=t,{dictionaries:i,schema:a}=this,c=i.get(n),d=a.dictionaries.get(n),f=this._loadVectors(t.data,e,[d]);return(c&&s?c.concat(new Ft(f)):new Ft(f)).memoize()}_loadVectors(t,e,n){return new ou(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}}class yi extends bu{constructor(t,e){super(e),this._reader=Xi(t)?new Xd(this._handle=t):new gu(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=Su(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):Rt}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Rt}next(){if(this.closed)return Rt;let t;const{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const n=t.header(),s=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),s=e.readMessageBody(t.bodyLength),i=this._loadDictionaryBatch(n,s);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new hu(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class gi extends bu{constructor(t,e){super(e),this._reader=new Kd(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return gt(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 gt(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=Su(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return gt(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):Rt})}return(t){return gt(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Rt})}next(){return gt(this,void 0,void 0,function*(){if(this.closed)return Rt;let t;const{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const n=t.header(),s=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),s=yield e.readMessageBody(t.bodyLength),i=this._loadDictionaryBatch(n,s);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new hu(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return gt(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}}class _u extends yi{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,e){super(t instanceof Eo?t:new Eo(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const 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();const n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){const s=this._reader.readMessage(Bt.RecordBatch);if(s?.isRecordBatch()){const i=s.header(),a=this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(i,a)}}return null}_readDictionaryBatch(t){var e;const n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){const s=this._reader.readMessage(Bt.DictionaryBatch);if(s?.isDictionaryBatch()){const i=s.header(),a=this._reader.readMessageBody(s.bodyLength),c=this._loadDictionaryBatch(i,a);this.dictionaries.set(i.id,c)}}}_readFooter(){const{_handle:t}=this,e=t.size-mu,n=t.readInt32(e),s=t.readAt(e-n,n);return Us.decode(s)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const 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}}class ef extends gi{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){const n=typeof e[0]!="number"?e.shift():void 0,s=e[0]instanceof Map?e.shift():void 0;super(t instanceof li?t:new li(t,n),s)}isFile(){return!0}isAsync(){return!0}open(t){const e=Object.create(null,{open:{get:()=>super.open}});return gt(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){return gt(this,void 0,void 0,function*(){var e;if(this.closed)return null;this._footer||(yield this.open());const n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){const s=yield this._reader.readMessage(Bt.RecordBatch);if(s?.isRecordBatch()){const i=s.header(),a=yield this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(i,a)}}return null})}_readDictionaryBatch(t){return gt(this,void 0,void 0,function*(){var e;const n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){const s=yield this._reader.readMessage(Bt.DictionaryBatch);if(s?.isDictionaryBatch()){const i=s.header(),a=yield this._reader.readMessageBody(s.bodyLength),c=this._loadDictionaryBatch(i,a);this.dictionaries.set(i.id,c)}}})}_readFooter(){return gt(this,void 0,void 0,function*(){const{_handle:t}=this;t._pending&&(yield t._pending);const e=t.size-mu,n=yield t.readInt32(e),s=yield t.readAt(e-n,n);return Us.decode(s)})}_readNextMessageAndValidate(t){return gt(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){const e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null})}}class rf extends yi{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new pd(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}}function Su(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*Uo(r){const t=Le.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Lo(r){return Ae(this,arguments,function*(){const e=yield wt(Le.from(r));try{if(!(yield wt(e.open({autoDestroy:!1}))).closed)do yield yield wt(e);while(!(yield wt(e.reset().open())).closed)}finally{yield wt(e.cancel())}})}function nf(r){return new fi(new rf(r))}function sf(r){const t=r.peek(bn+7&-8);return t&&t.byteLength>=4?js(t)?new wu(new _u(r.read())):new fi(new yi(r)):new fi(new yi(function*(){}()))}function of(r){return gt(this,void 0,void 0,function*(){const t=yield r.peek(bn+7&-8);return t&&t.byteLength>=4?js(t)?new wu(new _u(yield r.read())):new pi(new gi(r)):new pi(new gi(function(){return Ae(this,arguments,function*(){})}()))})}function af(r){return gt(this,void 0,void 0,function*(){const{size:t}=yield r.stat(),e=new li(r,t);return t>=Qd&&js(yield e.readAt(0,bn+7&-8))?new tf(new ef(e)):new pi(new gi(e))})}function Iu(r){const t=Le.from(r);return un(t)?t.then(e=>Iu(e)):t.isAsync()?t.readAll().then(e=>new le(e)):new le(t.readAll())}function Vs(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Pi={},Ur={},$i={},Lr={},Co;function Bu(){if(Co)return Lr;Co=1,Lr.byteLength=c,Lr.toByteArray=f,Lr.fromByteArray=L;for(var r=[],t=[],e=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,i=n.length;s<i;++s)r[s]=n[s],t[n.charCodeAt(s)]=s;t[45]=62,t[95]=63;function a(x){var M=x.length;if(M%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var U=x.indexOf("=");U===-1&&(U=M);var F=U===M?0:4-U%4;return[U,F]}function c(x){var M=a(x),U=M[0],F=M[1];return(U+F)*3/4-F}function d(x,M,U){return(M+U)*3/4-U}function f(x){var M,U=a(x),F=U[0],O=U[1],C=new e(d(x,F,O)),P=0,V=O>0?F-4:F,G;for(G=0;G<V;G+=4)M=t[x.charCodeAt(G)]<<18|t[x.charCodeAt(G+1)]<<12|t[x.charCodeAt(G+2)]<<6|t[x.charCodeAt(G+3)],C[P++]=M>>16&255,C[P++]=M>>8&255,C[P++]=M&255;return O===2&&(M=t[x.charCodeAt(G)]<<2|t[x.charCodeAt(G+1)]>>4,C[P++]=M&255),O===1&&(M=t[x.charCodeAt(G)]<<10|t[x.charCodeAt(G+1)]<<4|t[x.charCodeAt(G+2)]>>2,C[P++]=M>>8&255,C[P++]=M&255),C}function y(x){return r[x>>18&63]+r[x>>12&63]+r[x>>6&63]+r[x&63]}function B(x,M,U){for(var F,O=[],C=M;C<U;C+=3)F=(x[C]<<16&16711680)+(x[C+1]<<8&65280)+(x[C+2]&255),O.push(y(F));return O.join("")}function L(x){for(var M,U=x.length,F=U%3,O=[],C=16383,P=0,V=U-F;P<V;P+=C)O.push(B(x,P,P+C>V?V:P+C));return F===1?(M=x[U-1],O.push(r[M>>2]+r[M<<4&63]+"==")):F===2&&(M=(x[U-2]<<8)+x[U-1],O.push(r[M>>10]+r[M>>4&63]+r[M<<2&63]+"=")),O.join("")}return Lr}var vn={};var Ro;function vu(){return Ro||(Ro=1,vn.read=function(r,t,e,n,s){var i,a,c=s*8-n-1,d=(1<<c)-1,f=d>>1,y=-7,B=e?s-1:0,L=e?-1:1,x=r[t+B];for(B+=L,i=x&(1<<-y)-1,x>>=-y,y+=c;y>0;i=i*256+r[t+B],B+=L,y-=8);for(a=i&(1<<-y)-1,i>>=-y,y+=n;y>0;a=a*256+r[t+B],B+=L,y-=8);if(i===0)i=1-f;else{if(i===d)return a?NaN:(x?-1:1)*(1/0);a=a+Math.pow(2,n),i=i-f}return(x?-1:1)*a*Math.pow(2,i-n)},vn.write=function(r,t,e,n,s,i){var a,c,d,f=i*8-s-1,y=(1<<f)-1,B=y>>1,L=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=n?0:i-1,M=n?1:-1,U=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(c=isNaN(t)?1:0,a=y):(a=Math.floor(Math.log(t)/Math.LN2),t*(d=Math.pow(2,-a))<1&&(a--,d*=2),a+B>=1?t+=L/d:t+=L*Math.pow(2,1-B),t*d>=2&&(a++,d/=2),a+B>=y?(c=0,a=y):a+B>=1?(c=(t*d-1)*Math.pow(2,s),a=a+B):(c=t*Math.pow(2,B-1)*Math.pow(2,s),a=0));s>=8;r[e+x]=c&255,x+=M,c/=256,s-=8);for(a=a<<s|c,f+=s;f>0;r[e+x]=a&255,x+=M,a/=256,f-=8);r[e+x-M]|=U*128}),vn}var Po;function Ws(){return Po||(Po=1,function(r){const t=Bu(),e=vu(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=c,r.SlowBuffer=C,r.INSPECT_MAX_BYTES=50;const s=2147483647;r.kMaxLength=s,c.TYPED_ARRAY_SUPPORT=i(),!c.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{const h=new Uint8Array(1),o={foo:function(){return 42}};return Object.setPrototypeOf(o,Uint8Array.prototype),Object.setPrototypeOf(h,o),h.foo()===42}catch{return!1}}Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}});function a(h){if(h>s)throw new RangeError('The value "'+h+'" is invalid for option "size"');const o=new Uint8Array(h);return Object.setPrototypeOf(o,c.prototype),o}function c(h,o,u){if(typeof h=="number"){if(typeof o=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return B(h)}return d(h,o,u)}c.poolSize=8192;function d(h,o,u){if(typeof h=="string")return L(h,o);if(ArrayBuffer.isView(h))return M(h);if(h==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof h);if(mt(h,ArrayBuffer)||h&&mt(h.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(mt(h,SharedArrayBuffer)||h&&mt(h.buffer,SharedArrayBuffer)))return U(h,o,u);if(typeof h=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const l=h.valueOf&&h.valueOf();if(l!=null&&l!==h)return c.from(l,o,u);const p=F(h);if(p)return p;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof h[Symbol.toPrimitive]=="function")return c.from(h[Symbol.toPrimitive]("string"),o,u);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof h)}c.from=function(h,o,u){return d(h,o,u)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array);function f(h){if(typeof h!="number")throw new TypeError('"size" argument must be of type number');if(h<0)throw new RangeError('The value "'+h+'" is invalid for option "size"')}function y(h,o,u){return f(h),h<=0?a(h):o!==void 0?typeof u=="string"?a(h).fill(o,u):a(h).fill(o):a(h)}c.alloc=function(h,o,u){return y(h,o,u)};function B(h){return f(h),a(h<0?0:O(h)|0)}c.allocUnsafe=function(h){return B(h)},c.allocUnsafeSlow=function(h){return B(h)};function L(h,o){if((typeof o!="string"||o==="")&&(o="utf8"),!c.isEncoding(o))throw new TypeError("Unknown encoding: "+o);const u=P(h,o)|0;let l=a(u);const p=l.write(h,o);return p!==u&&(l=l.slice(0,p)),l}function x(h){const o=h.length<0?0:O(h.length)|0,u=a(o);for(let l=0;l<o;l+=1)u[l]=h[l]&255;return u}function M(h){if(mt(h,Uint8Array)){const o=new Uint8Array(h);return U(o.buffer,o.byteOffset,o.byteLength)}return x(h)}function U(h,o,u){if(o<0||h.byteLength<o)throw new RangeError('"offset" is outside of buffer bounds');if(h.byteLength<o+(u||0))throw new RangeError('"length" is outside of buffer bounds');let l;return o===void 0&&u===void 0?l=new Uint8Array(h):u===void 0?l=new Uint8Array(h,o):l=new Uint8Array(h,o,u),Object.setPrototypeOf(l,c.prototype),l}function F(h){if(c.isBuffer(h)){const o=O(h.length)|0,u=a(o);return u.length===0||h.copy(u,0,0,o),u}if(h.length!==void 0)return typeof h.length!="number"||Qt(h.length)?a(0):x(h);if(h.type==="Buffer"&&Array.isArray(h.data))return x(h.data)}function O(h){if(h>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return h|0}function C(h){return+h!=h&&(h=0),c.alloc(+h)}c.isBuffer=function(o){return o!=null&&o._isBuffer===!0&&o!==c.prototype},c.compare=function(o,u){if(mt(o,Uint8Array)&&(o=c.from(o,o.offset,o.byteLength)),mt(u,Uint8Array)&&(u=c.from(u,u.offset,u.byteLength)),!c.isBuffer(o)||!c.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(o===u)return 0;let l=o.length,p=u.length;for(let b=0,I=Math.min(l,p);b<I;++b)if(o[b]!==u[b]){l=o[b],p=u[b];break}return l<p?-1:p<l?1:0},c.isEncoding=function(o){switch(String(o).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(o,u){if(!Array.isArray(o))throw new TypeError('"list" argument must be an Array of Buffers');if(o.length===0)return c.alloc(0);let l;if(u===void 0)for(u=0,l=0;l<o.length;++l)u+=o[l].length;const p=c.allocUnsafe(u);let b=0;for(l=0;l<o.length;++l){let I=o[l];if(mt(I,Uint8Array))b+I.length>p.length?(c.isBuffer(I)||(I=c.from(I)),I.copy(p,b)):Uint8Array.prototype.set.call(p,I,b);else if(c.isBuffer(I))I.copy(p,b);else throw new TypeError('"list" argument must be an Array of Buffers');b+=I.length}return p};function P(h,o){if(c.isBuffer(h))return h.length;if(ArrayBuffer.isView(h)||mt(h,ArrayBuffer))return h.byteLength;if(typeof h!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof h);const u=h.length,l=arguments.length>2&&arguments[2]===!0;if(!l&&u===0)return 0;let p=!1;for(;;)switch(o){case"ascii":case"latin1":case"binary":return u;case"utf8":case"utf-8":return kt(h).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u*2;case"hex":return u>>>1;case"base64":return $t(h).length;default:if(p)return l?-1:kt(h).length;o=(""+o).toLowerCase(),p=!0}}c.byteLength=P;function V(h,o,u){let l=!1;if((o===void 0||o<0)&&(o=0),o>this.length||((u===void 0||u>this.length)&&(u=this.length),u<=0)||(u>>>=0,o>>>=0,u<=o))return"";for(h||(h="utf8");;)switch(h){case"hex":return X(this,o,u);case"utf8":case"utf-8":return z(this,o,u);case"ascii":return Y(this,o,u);case"latin1":case"binary":return Z(this,o,u);case"base64":return Q(this,o,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K(this,o,u);default:if(l)throw new TypeError("Unknown encoding: "+h);h=(h+"").toLowerCase(),l=!0}}c.prototype._isBuffer=!0;function G(h,o,u){const l=h[o];h[o]=h[u],h[u]=l}c.prototype.swap16=function(){const o=this.length;if(o%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let u=0;u<o;u+=2)G(this,u,u+1);return this},c.prototype.swap32=function(){const o=this.length;if(o%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let u=0;u<o;u+=4)G(this,u,u+3),G(this,u+1,u+2);return this},c.prototype.swap64=function(){const o=this.length;if(o%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let u=0;u<o;u+=8)G(this,u,u+7),G(this,u+1,u+6),G(this,u+2,u+5),G(this,u+3,u+4);return this},c.prototype.toString=function(){const o=this.length;return o===0?"":arguments.length===0?z(this,0,o):V.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(o){if(!c.isBuffer(o))throw new TypeError("Argument must be a Buffer");return this===o?!0:c.compare(this,o)===0},c.prototype.inspect=function(){let o="";const u=r.INSPECT_MAX_BYTES;return o=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(o+=" ... "),"<Buffer "+o+">"},n&&(c.prototype[n]=c.prototype.inspect),c.prototype.compare=function(o,u,l,p,b){if(mt(o,Uint8Array)&&(o=c.from(o,o.offset,o.byteLength)),!c.isBuffer(o))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof o);if(u===void 0&&(u=0),l===void 0&&(l=o?o.length:0),p===void 0&&(p=0),b===void 0&&(b=this.length),u<0||l>o.length||p<0||b>this.length)throw new RangeError("out of range index");if(p>=b&&u>=l)return 0;if(p>=b)return-1;if(u>=l)return 1;if(u>>>=0,l>>>=0,p>>>=0,b>>>=0,this===o)return 0;let I=b-p,H=l-u;const pt=Math.min(I,H),lt=this.slice(p,b),yt=o.slice(u,l);for(let et=0;et<pt;++et)if(lt[et]!==yt[et]){I=lt[et],H=yt[et];break}return I<H?-1:H<I?1:0};function A(h,o,u,l,p){if(h.length===0)return-1;if(typeof u=="string"?(l=u,u=0):u>2147483647?u=2147483647:u<-2147483648&&(u=-2147483648),u=+u,Qt(u)&&(u=p?0:h.length-1),u<0&&(u=h.length+u),u>=h.length){if(p)return-1;u=h.length-1}else if(u<0)if(p)u=0;else return-1;if(typeof o=="string"&&(o=c.from(o,l)),c.isBuffer(o))return o.length===0?-1:N(h,o,u,l,p);if(typeof o=="number")return o=o&255,typeof Uint8Array.prototype.indexOf=="function"?p?Uint8Array.prototype.indexOf.call(h,o,u):Uint8Array.prototype.lastIndexOf.call(h,o,u):N(h,[o],u,l,p);throw new TypeError("val must be string, number or Buffer")}function N(h,o,u,l,p){let b=1,I=h.length,H=o.length;if(l!==void 0&&(l=String(l).toLowerCase(),l==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(h.length<2||o.length<2)return-1;b=2,I/=2,H/=2,u/=2}function pt(yt,et){return b===1?yt[et]:yt.readUInt16BE(et*b)}let lt;if(p){let yt=-1;for(lt=u;lt<I;lt++)if(pt(h,lt)===pt(o,yt===-1?0:lt-yt)){if(yt===-1&&(yt=lt),lt-yt+1===H)return yt*b}else yt!==-1&&(lt-=lt-yt),yt=-1}else for(u+H>I&&(u=I-H),lt=u;lt>=0;lt--){let yt=!0;for(let et=0;et<H;et++)if(pt(h,lt+et)!==pt(o,et)){yt=!1;break}if(yt)return lt}return-1}c.prototype.includes=function(o,u,l){return this.indexOf(o,u,l)!==-1},c.prototype.indexOf=function(o,u,l){return A(this,o,u,l,!0)},c.prototype.lastIndexOf=function(o,u,l){return A(this,o,u,l,!1)};function m(h,o,u,l){u=Number(u)||0;const p=h.length-u;l?(l=Number(l),l>p&&(l=p)):l=p;const b=o.length;l>b/2&&(l=b/2);let I;for(I=0;I<l;++I){const H=parseInt(o.substr(I*2,2),16);if(Qt(H))return I;h[u+I]=H}return I}function S(h,o,u,l){return Nt(kt(o,h.length-u),h,u,l)}function w(h,o,u,l){return Nt(Ht(o),h,u,l)}function v(h,o,u,l){return Nt($t(o),h,u,l)}function k(h,o,u,l){return Nt(Vt(o,h.length-u),h,u,l)}c.prototype.write=function(o,u,l,p){if(u===void 0)p="utf8",l=this.length,u=0;else if(l===void 0&&typeof u=="string")p=u,l=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(l)?(l=l>>>0,p===void 0&&(p="utf8")):(p=l,l=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const b=this.length-u;if((l===void 0||l>b)&&(l=b),o.length>0&&(l<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");p||(p="utf8");let I=!1;for(;;)switch(p){case"hex":return m(this,o,u,l);case"utf8":case"utf-8":return S(this,o,u,l);case"ascii":case"latin1":case"binary":return w(this,o,u,l);case"base64":return v(this,o,u,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,o,u,l);default:if(I)throw new TypeError("Unknown encoding: "+p);p=(""+p).toLowerCase(),I=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Q(h,o,u){return o===0&&u===h.length?t.fromByteArray(h):t.fromByteArray(h.slice(o,u))}function z(h,o,u){u=Math.min(h.length,u);const l=[];let p=o;for(;p<u;){const b=h[p];let I=null,H=b>239?4:b>223?3:b>191?2:1;if(p+H<=u){let pt,lt,yt,et;switch(H){case 1:b<128&&(I=b);break;case 2:pt=h[p+1],(pt&192)===128&&(et=(b&31)<<6|pt&63,et>127&&(I=et));break;case 3:pt=h[p+1],lt=h[p+2],(pt&192)===128&&(lt&192)===128&&(et=(b&15)<<12|(pt&63)<<6|lt&63,et>2047&&(et<55296||et>57343)&&(I=et));break;case 4:pt=h[p+1],lt=h[p+2],yt=h[p+3],(pt&192)===128&&(lt&192)===128&&(yt&192)===128&&(et=(b&15)<<18|(pt&63)<<12|(lt&63)<<6|yt&63,et>65535&&et<1114112&&(I=et))}}I===null?(I=65533,H=1):I>65535&&(I-=65536,l.push(I>>>10&1023|55296),I=56320|I&1023),l.push(I),p+=H}return D(l)}const R=4096;function D(h){const o=h.length;if(o<=R)return String.fromCharCode.apply(String,h);let u="",l=0;for(;l<o;)u+=String.fromCharCode.apply(String,h.slice(l,l+=R));return u}function Y(h,o,u){let l="";u=Math.min(h.length,u);for(let p=o;p<u;++p)l+=String.fromCharCode(h[p]&127);return l}function Z(h,o,u){let l="";u=Math.min(h.length,u);for(let p=o;p<u;++p)l+=String.fromCharCode(h[p]);return l}function X(h,o,u){const l=h.length;(!o||o<0)&&(o=0),(!u||u<0||u>l)&&(u=l);let p="";for(let b=o;b<u;++b)p+=sr[h[b]];return p}function K(h,o,u){const l=h.slice(o,u);let p="";for(let b=0;b<l.length-1;b+=2)p+=String.fromCharCode(l[b]+l[b+1]*256);return p}c.prototype.slice=function(o,u){const l=this.length;o=~~o,u=u===void 0?l:~~u,o<0?(o+=l,o<0&&(o=0)):o>l&&(o=l),u<0?(u+=l,u<0&&(u=0)):u>l&&(u=l),u<o&&(u=o);const p=this.subarray(o,u);return Object.setPrototypeOf(p,c.prototype),p};function q(h,o,u){if(h%1!==0||h<0)throw new RangeError("offset is not uint");if(h+o>u)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUintLE=c.prototype.readUIntLE=function(o,u,l){o=o>>>0,u=u>>>0,l||q(o,u,this.length);let p=this[o],b=1,I=0;for(;++I<u&&(b*=256);)p+=this[o+I]*b;return p},c.prototype.readUintBE=c.prototype.readUIntBE=function(o,u,l){o=o>>>0,u=u>>>0,l||q(o,u,this.length);let p=this[o+--u],b=1;for(;u>0&&(b*=256);)p+=this[o+--u]*b;return p},c.prototype.readUint8=c.prototype.readUInt8=function(o,u){return o=o>>>0,u||q(o,1,this.length),this[o]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(o,u){return o=o>>>0,u||q(o,2,this.length),this[o]|this[o+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(o,u){return o=o>>>0,u||q(o,2,this.length),this[o]<<8|this[o+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(o,u){return o=o>>>0,u||q(o,4,this.length),(this[o]|this[o+1]<<8|this[o+2]<<16)+this[o+3]*16777216},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(o,u){return o=o>>>0,u||q(o,4,this.length),this[o]*16777216+(this[o+1]<<16|this[o+2]<<8|this[o+3])},c.prototype.readBigUInt64LE=Wt(function(o){o=o>>>0,$(o,"offset");const u=this[o],l=this[o+7];(u===void 0||l===void 0)&&J(o,this.length-8);const p=u+this[++o]*2**8+this[++o]*2**16+this[++o]*2**24,b=this[++o]+this[++o]*2**8+this[++o]*2**16+l*2**24;return BigInt(p)+(BigInt(b)<<BigInt(32))}),c.prototype.readBigUInt64BE=Wt(function(o){o=o>>>0,$(o,"offset");const u=this[o],l=this[o+7];(u===void 0||l===void 0)&&J(o,this.length-8);const p=u*2**24+this[++o]*2**16+this[++o]*2**8+this[++o],b=this[++o]*2**24+this[++o]*2**16+this[++o]*2**8+l;return(BigInt(p)<<BigInt(32))+BigInt(b)}),c.prototype.readIntLE=function(o,u,l){o=o>>>0,u=u>>>0,l||q(o,u,this.length);let p=this[o],b=1,I=0;for(;++I<u&&(b*=256);)p+=this[o+I]*b;return b*=128,p>=b&&(p-=Math.pow(2,8*u)),p},c.prototype.readIntBE=function(o,u,l){o=o>>>0,u=u>>>0,l||q(o,u,this.length);let p=u,b=1,I=this[o+--p];for(;p>0&&(b*=256);)I+=this[o+--p]*b;return b*=128,I>=b&&(I-=Math.pow(2,8*u)),I},c.prototype.readInt8=function(o,u){return o=o>>>0,u||q(o,1,this.length),this[o]&128?(255-this[o]+1)*-1:this[o]},c.prototype.readInt16LE=function(o,u){o=o>>>0,u||q(o,2,this.length);const l=this[o]|this[o+1]<<8;return l&32768?l|4294901760:l},c.prototype.readInt16BE=function(o,u){o=o>>>0,u||q(o,2,this.length);const l=this[o+1]|this[o]<<8;return l&32768?l|4294901760:l},c.prototype.readInt32LE=function(o,u){return o=o>>>0,u||q(o,4,this.length),this[o]|this[o+1]<<8|this[o+2]<<16|this[o+3]<<24},c.prototype.readInt32BE=function(o,u){return o=o>>>0,u||q(o,4,this.length),this[o]<<24|this[o+1]<<16|this[o+2]<<8|this[o+3]},c.prototype.readBigInt64LE=Wt(function(o){o=o>>>0,$(o,"offset");const u=this[o],l=this[o+7];(u===void 0||l===void 0)&&J(o,this.length-8);const p=this[o+4]+this[o+5]*2**8+this[o+6]*2**16+(l<<24);return(BigInt(p)<<BigInt(32))+BigInt(u+this[++o]*2**8+this[++o]*2**16+this[++o]*2**24)}),c.prototype.readBigInt64BE=Wt(function(o){o=o>>>0,$(o,"offset");const u=this[o],l=this[o+7];(u===void 0||l===void 0)&&J(o,this.length-8);const p=(u<<24)+this[++o]*2**16+this[++o]*2**8+this[++o];return(BigInt(p)<<BigInt(32))+BigInt(this[++o]*2**24+this[++o]*2**16+this[++o]*2**8+l)}),c.prototype.readFloatLE=function(o,u){return o=o>>>0,u||q(o,4,this.length),e.read(this,o,!0,23,4)},c.prototype.readFloatBE=function(o,u){return o=o>>>0,u||q(o,4,this.length),e.read(this,o,!1,23,4)},c.prototype.readDoubleLE=function(o,u){return o=o>>>0,u||q(o,8,this.length),e.read(this,o,!0,52,8)},c.prototype.readDoubleBE=function(o,u){return o=o>>>0,u||q(o,8,this.length),e.read(this,o,!1,52,8)};function rt(h,o,u,l,p,b){if(!c.isBuffer(h))throw new TypeError('"buffer" argument must be a Buffer instance');if(o>p||o<b)throw new RangeError('"value" argument is out of bounds');if(u+l>h.length)throw new RangeError("Index out of range")}c.prototype.writeUintLE=c.prototype.writeUIntLE=function(o,u,l,p){if(o=+o,u=u>>>0,l=l>>>0,!p){const H=Math.pow(2,8*l)-1;rt(this,o,u,l,H,0)}let b=1,I=0;for(this[u]=o&255;++I<l&&(b*=256);)this[u+I]=o/b&255;return u+l},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(o,u,l,p){if(o=+o,u=u>>>0,l=l>>>0,!p){const H=Math.pow(2,8*l)-1;rt(this,o,u,l,H,0)}let b=l-1,I=1;for(this[u+b]=o&255;--b>=0&&(I*=256);)this[u+b]=o/I&255;return u+l},c.prototype.writeUint8=c.prototype.writeUInt8=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,1,255,0),this[u]=o&255,u+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,2,65535,0),this[u]=o&255,this[u+1]=o>>>8,u+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,2,65535,0),this[u]=o>>>8,this[u+1]=o&255,u+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,4,4294967295,0),this[u+3]=o>>>24,this[u+2]=o>>>16,this[u+1]=o>>>8,this[u]=o&255,u+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,4,4294967295,0),this[u]=o>>>24,this[u+1]=o>>>16,this[u+2]=o>>>8,this[u+3]=o&255,u+4};function At(h,o,u,l,p){j(o,l,p,h,u,7);let b=Number(o&BigInt(4294967295));h[u++]=b,b=b>>8,h[u++]=b,b=b>>8,h[u++]=b,b=b>>8,h[u++]=b;let I=Number(o>>BigInt(32)&BigInt(4294967295));return h[u++]=I,I=I>>8,h[u++]=I,I=I>>8,h[u++]=I,I=I>>8,h[u++]=I,u}function Ut(h,o,u,l,p){j(o,l,p,h,u,7);let b=Number(o&BigInt(4294967295));h[u+7]=b,b=b>>8,h[u+6]=b,b=b>>8,h[u+5]=b,b=b>>8,h[u+4]=b;let I=Number(o>>BigInt(32)&BigInt(4294967295));return h[u+3]=I,I=I>>8,h[u+2]=I,I=I>>8,h[u+1]=I,I=I>>8,h[u]=I,u+8}c.prototype.writeBigUInt64LE=Wt(function(o,u=0){return At(this,o,u,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Wt(function(o,u=0){return Ut(this,o,u,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(o,u,l,p){if(o=+o,u=u>>>0,!p){const pt=Math.pow(2,8*l-1);rt(this,o,u,l,pt-1,-pt)}let b=0,I=1,H=0;for(this[u]=o&255;++b<l&&(I*=256);)o<0&&H===0&&this[u+b-1]!==0&&(H=1),this[u+b]=(o/I>>0)-H&255;return u+l},c.prototype.writeIntBE=function(o,u,l,p){if(o=+o,u=u>>>0,!p){const pt=Math.pow(2,8*l-1);rt(this,o,u,l,pt-1,-pt)}let b=l-1,I=1,H=0;for(this[u+b]=o&255;--b>=0&&(I*=256);)o<0&&H===0&&this[u+b+1]!==0&&(H=1),this[u+b]=(o/I>>0)-H&255;return u+l},c.prototype.writeInt8=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,1,127,-128),o<0&&(o=255+o+1),this[u]=o&255,u+1},c.prototype.writeInt16LE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,2,32767,-32768),this[u]=o&255,this[u+1]=o>>>8,u+2},c.prototype.writeInt16BE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,2,32767,-32768),this[u]=o>>>8,this[u+1]=o&255,u+2},c.prototype.writeInt32LE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,4,2147483647,-2147483648),this[u]=o&255,this[u+1]=o>>>8,this[u+2]=o>>>16,this[u+3]=o>>>24,u+4},c.prototype.writeInt32BE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,4,2147483647,-2147483648),o<0&&(o=4294967295+o+1),this[u]=o>>>24,this[u+1]=o>>>16,this[u+2]=o>>>8,this[u+3]=o&255,u+4},c.prototype.writeBigInt64LE=Wt(function(o,u=0){return At(this,o,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Wt(function(o,u=0){return Ut(this,o,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Pt(h,o,u,l,p,b){if(u+l>h.length)throw new RangeError("Index out of range");if(u<0)throw new RangeError("Index out of range")}function Zt(h,o,u,l,p){return o=+o,u=u>>>0,p||Pt(h,o,u,4),e.write(h,o,u,l,23,4),u+4}c.prototype.writeFloatLE=function(o,u,l){return Zt(this,o,u,!0,l)},c.prototype.writeFloatBE=function(o,u,l){return Zt(this,o,u,!1,l)};function Gt(h,o,u,l,p){return o=+o,u=u>>>0,p||Pt(h,o,u,8),e.write(h,o,u,l,52,8),u+8}c.prototype.writeDoubleLE=function(o,u,l){return Gt(this,o,u,!0,l)},c.prototype.writeDoubleBE=function(o,u,l){return Gt(this,o,u,!1,l)},c.prototype.copy=function(o,u,l,p){if(!c.isBuffer(o))throw new TypeError("argument should be a Buffer");if(l||(l=0),!p&&p!==0&&(p=this.length),u>=o.length&&(u=o.length),u||(u=0),p>0&&p<l&&(p=l),p===l||o.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(l<0||l>=this.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("sourceEnd out of bounds");p>this.length&&(p=this.length),o.length-u<p-l&&(p=o.length-u+l);const b=p-l;return this===o&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,l,p):Uint8Array.prototype.set.call(o,this.subarray(l,p),u),b},c.prototype.fill=function(o,u,l,p){if(typeof o=="string"){if(typeof u=="string"?(p=u,u=0,l=this.length):typeof l=="string"&&(p=l,l=this.length),p!==void 0&&typeof p!="string")throw new TypeError("encoding must be a string");if(typeof p=="string"&&!c.isEncoding(p))throw new TypeError("Unknown encoding: "+p);if(o.length===1){const I=o.charCodeAt(0);(p==="utf8"&&I<128||p==="latin1")&&(o=I)}}else typeof o=="number"?o=o&255:typeof o=="boolean"&&(o=Number(o));if(u<0||this.length<u||this.length<l)throw new RangeError("Out of range index");if(l<=u)return this;u=u>>>0,l=l===void 0?this.length:l>>>0,o||(o=0);let b;if(typeof o=="number")for(b=u;b<l;++b)this[b]=o;else{const I=c.isBuffer(o)?o:c.from(o,p),H=I.length;if(H===0)throw new TypeError('The value "'+o+'" is invalid for argument "value"');for(b=0;b<l-u;++b)this[b+u]=I[b%H]}return this};const W={};function g(h,o,u){W[h]=class extends u{constructor(){super(),Object.defineProperty(this,"message",{value:o.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${h}]`,this.stack,delete this.name}get code(){return h}set code(p){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:p,writable:!0})}toString(){return`${this.name} [${h}]: ${this.message}`}}}g("ERR_BUFFER_OUT_OF_BOUNDS",function(h){return h?`${h} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),g("ERR_INVALID_ARG_TYPE",function(h,o){return`The "${h}" argument must be of type number. Received type ${typeof o}`},TypeError),g("ERR_OUT_OF_RANGE",function(h,o,u){let l=`The value of "${h}" is out of range.`,p=u;return Number.isInteger(u)&&Math.abs(u)>2**32?p=_(String(u)):typeof u=="bigint"&&(p=String(u),(u>BigInt(2)**BigInt(32)||u<-(BigInt(2)**BigInt(32)))&&(p=_(p)),p+="n"),l+=` It must be ${o}. Received ${p}`,l},RangeError);function _(h){let o="",u=h.length;const l=h[0]==="-"?1:0;for(;u>=l+4;u-=3)o=`_${h.slice(u-3,u)}${o}`;return`${h.slice(0,u)}${o}`}function T(h,o,u){$(o,"offset"),(h[o]===void 0||h[o+u]===void 0)&&J(o,h.length-(u+1))}function j(h,o,u,l,p,b){if(h>u||h<o){const I=typeof o=="bigint"?"n":"";let H;throw o===0||o===BigInt(0)?H=`>= 0${I} and < 2${I} ** ${(b+1)*8}${I}`:H=`>= -(2${I} ** ${(b+1)*8-1}${I}) and < 2 ** ${(b+1)*8-1}${I}`,new W.ERR_OUT_OF_RANGE("value",H,h)}T(l,p,b)}function $(h,o){if(typeof h!="number")throw new W.ERR_INVALID_ARG_TYPE(o,"number",h)}function J(h,o,u){throw Math.floor(h)!==h?($(h,u),new W.ERR_OUT_OF_RANGE("offset","an integer",h)):o<0?new W.ERR_BUFFER_OUT_OF_BOUNDS:new W.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${o}`,h)}const bt=/[^+/0-9A-Za-z-_]/g;function Ot(h){if(h=h.split("=")[0],h=h.trim().replace(bt,""),h.length<2)return"";for(;h.length%4!==0;)h=h+"=";return h}function kt(h,o){o=o||1/0;let u;const l=h.length;let p=null;const b=[];for(let I=0;I<l;++I){if(u=h.charCodeAt(I),u>55295&&u<57344){if(!p){if(u>56319){(o-=3)>-1&&b.push(239,191,189);continue}else if(I+1===l){(o-=3)>-1&&b.push(239,191,189);continue}p=u;continue}if(u<56320){(o-=3)>-1&&b.push(239,191,189),p=u;continue}u=(p-55296<<10|u-56320)+65536}else p&&(o-=3)>-1&&b.push(239,191,189);if(p=null,u<128){if((o-=1)<0)break;b.push(u)}else if(u<2048){if((o-=2)<0)break;b.push(u>>6|192,u&63|128)}else if(u<65536){if((o-=3)<0)break;b.push(u>>12|224,u>>6&63|128,u&63|128)}else if(u<1114112){if((o-=4)<0)break;b.push(u>>18|240,u>>12&63|128,u>>6&63|128,u&63|128)}else throw new Error("Invalid code point")}return b}function Ht(h){const o=[];for(let u=0;u<h.length;++u)o.push(h.charCodeAt(u)&255);return o}function Vt(h,o){let u,l,p;const b=[];for(let I=0;I<h.length&&!((o-=2)<0);++I)u=h.charCodeAt(I),l=u>>8,p=u%256,b.push(p),b.push(l);return b}function $t(h){return t.toByteArray(Ot(h))}function Nt(h,o,u,l){let p;for(p=0;p<l&&!(p+u>=o.length||p>=h.length);++p)o[p+u]=h[p];return p}function mt(h,o){return h instanceof o||h!=null&&h.constructor!=null&&h.constructor.name!=null&&h.constructor.name===o.name}function Qt(h){return h!==h}const sr=function(){const h="0123456789abcdef",o=new Array(256);for(let u=0;u<16;++u){const l=u*16;for(let p=0;p<16;++p)o[l+p]=h[u]+h[p]}return o}();function Wt(h){return typeof BigInt>"u"?Fi:h}function Fi(){throw new Error("BigInt not supported")}}($i)),$i}var $o;function cf(){if($o)return Ur;$o=1,Object.defineProperty(Ur,"__esModule",{value:!0}),Ur.BinaryReader=void 0;const r=Ws();class t{constructor(n,s=!1){this.readUInt8=this._read(r.Buffer.prototype.readUInt8,r.Buffer.prototype.readUInt8,1),this.readUInt16=this._read(r.Buffer.prototype.readUInt16LE,r.Buffer.prototype.readUInt16BE,2),this.readUInt32=this._read(r.Buffer.prototype.readUInt32LE,r.Buffer.prototype.readUInt32BE,4),this.readInt8=this._read(r.Buffer.prototype.readInt8,r.Buffer.prototype.readInt8,1),this.readInt16=this._read(r.Buffer.prototype.readInt16LE,r.Buffer.prototype.readInt16BE,2),this.readInt32=this._read(r.Buffer.prototype.readInt32LE,r.Buffer.prototype.readInt32BE,4),this.readFloat=this._read(r.Buffer.prototype.readFloatLE,r.Buffer.prototype.readFloatBE,4),this.readDouble=this._read(r.Buffer.prototype.readDoubleLE,r.Buffer.prototype.readDoubleBE,8),this.buffer=n,this.position=0,this.isBigEndian=s}_read(n,s,i){return()=>{let a;return this.isBigEndian?a=s.call(this.buffer,this.position):a=n.call(this.buffer,this.position),this.position+=i,a}}readVarInt(){let n,s=0,i=0;do n=this.buffer[this.position+i],s+=(n&127)<<7*i,i++;while(n>=128);return this.position+=i,s}}return Ur.BinaryReader=t,Ur}var Cr={},zo;function Ke(){if(zo)return Cr;zo=1,Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.BinaryWriter=void 0;const r=Ws();class t{constructor(n,s=!0){this.writeUInt8=this._write(r.Buffer.prototype.writeUInt8,1),this.writeUInt16LE=this._write(r.Buffer.prototype.writeUInt16LE,2),this.writeUInt16BE=this._write(r.Buffer.prototype.writeUInt16BE,2),this.writeUInt32LE=this._write(r.Buffer.prototype.writeUInt32LE,4),this.writeUInt32BE=this._write(r.Buffer.prototype.writeUInt32BE,4),this.writeInt8=this._write(r.Buffer.prototype.writeInt8,1),this.writeInt16LE=this._write(r.Buffer.prototype.writeInt16LE,2),this.writeInt16BE=this._write(r.Buffer.prototype.writeInt16BE,2),this.writeInt32LE=this._write(r.Buffer.prototype.writeInt32LE,4),this.writeInt32BE=this._write(r.Buffer.prototype.writeInt32BE,4),this.writeFloatLE=this._write(r.Buffer.prototype.writeFloatLE,4),this.writeFloatBE=this._write(r.Buffer.prototype.writeFloatBE,4),this.writeDoubleLE=this._write(r.Buffer.prototype.writeDoubleLE,8),this.writeDoubleBE=this._write(r.Buffer.prototype.writeDoubleBE,8),this.buffer=r.Buffer.alloc(n),this.position=0,this.allowResize=s}_write(n,s){return(i,a=!1)=>{this.ensureSize(s),n.call(this.buffer,i,this.position,a),this.position+=s}}writeBuffer(n){this.ensureSize(n.length),n.copy(this.buffer,this.position,0,n.length),this.position+=n.length}writeVarInt(n){let s=1;for(;(n&4294967168)!==0;)this.writeUInt8(n&127|128),n>>>=7,s++;return this.writeUInt8(n&127),s}ensureSize(n){if(this.buffer.length<this.position+n)if(this.allowResize){const s=r.Buffer.alloc(this.position+n);this.buffer.copy(s,0,0,this.buffer.length),this.buffer=s}else throw new RangeError("index out of range")}}return Cr.BinaryWriter=t,Cr}var Rr={},jo;function $e(){return jo||(jo=1,Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.CONSTANTS=void 0,Rr.CONSTANTS={wkt:{Point:"POINT",LineString:"LINESTRING",Polygon:"POLYGON",MultiPoint:"MULTIPOINT",MultiLineString:"MULTILINESTRING",MultiPolygon:"MULTIPOLYGON",GeometryCollection:"GEOMETRYCOLLECTION"},wkb:{Point:1,LineString:2,Polygon:3,MultiPoint:4,MultiLineString:5,MultiPolygon:6,GeometryCollection:7},geoJSON:{Point:"Point",LineString:"LineString",Polygon:"Polygon",MultiPoint:"MultiPoint",MultiLineString:"MultiLineString",MultiPolygon:"MultiPolygon",GeometryCollection:"GeometryCollection"}}),Rr}var Pr={},Vo;function uf(){if(Vo)return Pr;Vo=1,Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.Geometry=void 0;const r=Ws(),t=ze();class e{constructor(){this.srid=void 0,this.hasZ=!1,this.hasM=!1}static parse(s,i){if(typeof s==="string"||s instanceof t.WktParser)return e._parseWkt(s);if(r.Buffer.isBuffer(s)||s instanceof t.BinaryReader)try{return e._parseWkb(s,i)}catch{try{return e.parseTwkb(s)}catch{throw new Error("Could not parse WKB or TWKB")}}else throw new Error("First argument must be a string or Buffer")}static _parseWkt(s){let i,a;s instanceof t.WktParser?i=s:i=new t.WktParser(s);const c=i.matchRegex([/^SRID=(\d+);/]);c&&(a=parseInt(c[1],10));const d=i.matchType(),f=i.matchDimension(),y={srid:a,hasZ:f.hasZ,hasM:f.hasM};switch(d){case t.CONSTANTS.wkt.Point:return t.Point._parseWktWithOptions(i,y);case t.CONSTANTS.wkt.LineString:return t.LineString._parseWktWithOptions(i,y);case t.CONSTANTS.wkt.Polygon:return t.Polygon._parseWktWithOptions(i,y);case t.CONSTANTS.wkt.MultiPoint:return t.MultiPoint._parseWktWithOptions(i,y);case t.CONSTANTS.wkt.MultiLineString:return t.MultiLineString._parseWktWithOptions(i,y);case t.CONSTANTS.wkt.MultiPolygon:return t.MultiPolygon._parseWktWithOptions(i,y);case t.CONSTANTS.wkt.GeometryCollection:return t.GeometryCollection._parseWktWithOptions(i,y);default:throw new Error("Unsupported geometry type")}}static _parseWkb(s,i){let a,c,d;const f={};switch(s instanceof t.BinaryReader?a=s:a=new t.BinaryReader(s),a.isBigEndian=!a.readInt8(),c=a.readUInt32(),f.hasSrid=(c&536870912)===536870912,f.isEwkb=c&536870912||c&1073741824||c&2147483648,f.hasSrid&&(f.srid=a.readUInt32()),f.hasZ=!1,f.hasM=!1,!f.isEwkb&&(!i||!i.isEwkb)?c>=1e3&&c<2e3?(f.hasZ=!0,d=c-1e3):c>=2e3&&c<3e3?(f.hasM=!0,d=c-2e3):c>=3e3&&c<4e3?(f.hasZ=!0,f.hasM=!0,d=c-3e3):d=c:(c&2147483648&&(f.hasZ=!0),c&1073741824&&(f.hasM=!0),d=c&15),d){case t.CONSTANTS.wkb.Point:return t.Point._parseWkb(a,f);case t.CONSTANTS.wkb.LineString:return t.LineString._parseWkb(a,f);case t.CONSTANTS.wkb.Polygon:return t.Polygon._parseWkb(a,f);case t.CONSTANTS.wkb.MultiPoint:return t.MultiPoint._parseWkb(a,f);case t.CONSTANTS.wkb.MultiLineString:return t.MultiLineString._parseWkb(a,f);case t.CONSTANTS.wkb.MultiPolygon:return t.MultiPolygon._parseWkb(a,f);case t.CONSTANTS.wkb.GeometryCollection:return t.GeometryCollection._parseWkb(a,f);default:throw new Error(`GeometryType ${d} not supported`)}}static parseTwkb(s){let i;const a={};s instanceof t.BinaryReader?i=s:i=new t.BinaryReader(s);const c=i.readUInt8(),d=i.readUInt8(),f=c&15;if(a.precision=t.ZigZag.decode(c>>4),a.precisionFactor=Math.pow(10,a.precision),a.hasBoundingBox=d>>0&1,a.hasSizeAttribute=d>>1&1,a.hasIdList=d>>2&1,a.hasExtendedPrecision=d>>3&1,a.isEmpty=d>>4&1,a.hasExtendedPrecision){const y=i.readUInt8();a.hasZ=(y&1)===1,a.hasM=(y&2)===2,a.zPrecision=t.ZigZag.decode((y&28)>>2),a.zPrecisionFactor=Math.pow(10,a.zPrecision),a.mPrecision=t.ZigZag.decode((y&224)>>5),a.mPrecisionFactor=Math.pow(10,a.mPrecision)}else a.hasZ=!1,a.hasM=!1;if(a.hasSizeAttribute&&i.readVarInt(),a.hasBoundingBox){let y=2;a.hasZ&&y++,a.hasM&&y++;for(let B=0;B<y;B++)i.readVarInt(),i.readVarInt()}switch(f){case t.CONSTANTS.wkb.Point:return t.Point._parseTwkb(i,a);case t.CONSTANTS.wkb.LineString:return t.LineString._parseTwkb(i,a);case t.CONSTANTS.wkb.Polygon:return t.Polygon._parseTwkb(i,a);case t.CONSTANTS.wkb.MultiPoint:return t.MultiPoint._parseTwkb(i,a);case t.CONSTANTS.wkb.MultiLineString:return t.MultiLineString._parseTwkb(i,a);case t.CONSTANTS.wkb.MultiPolygon:return t.MultiPolygon._parseTwkb(i,a);case t.CONSTANTS.wkb.GeometryCollection:return t.GeometryCollection._parseTwkb(i,a);default:throw new Error("GeometryType "+f+" not supported")}}toGeoJSON(s){const i={};return this.srid&&s&&(s.shortCrs?i.crs={type:"name",properties:{name:"EPSG:"+this.srid}}:s.longCrs&&(i.crs={type:"name",properties:{name:"urn:ogc:def:crs:EPSG::"+this.srid}})),i}static _parseGeoJSON(s,i){let a;switch(s.type){case t.CONSTANTS.geoJSON.Point:a=t.Point._parseGeoJSON(s);break;case t.CONSTANTS.geoJSON.LineString:a=t.LineString._parseGeoJSON(s);break;case t.CONSTANTS.geoJSON.Polygon:a=t.Polygon._parseGeoJSON(s);break;case t.CONSTANTS.geoJSON.MultiPoint:a=t.MultiPoint._parseGeoJSON(s);break;case t.CONSTANTS.geoJSON.MultiLineString:a=t.MultiLineString._parseGeoJSON(s);break;case t.CONSTANTS.geoJSON.MultiPolygon:a=t.MultiPolygon._parseGeoJSON(s);break;case t.CONSTANTS.geoJSON.GeometryCollection:a=t.GeometryCollection._parseGeoJSON(s);break;default:throw new Error("GeometryType "+s.type+" not supported")}if(s.crs&&s.crs.type&&s.crs.type==="name"&&s.crs.properties&&s.crs.properties.name){const c=s.crs.properties.name;if(c.indexOf("EPSG:")===0)a.srid=parseInt(c.substring(5));else if(c.indexOf("urn:ogc:def:crs:EPSG::")===0)a.srid=parseInt(c.substring(22));else throw new Error("Unsupported crs: "+c)}else i||(a.srid=4326);return a}toEwkt(){return`SRID=${this.srid};${this.toWkt()}`}toEwkb(){const s=new t.BinaryWriter(this._getWkbSize()+4),i=this.toWkb();return s.writeInt8(1),s.writeUInt32LE((i.slice(1,5).readUInt32LE(0)|536870912)>>>0,!0),s.writeUInt32LE(this.srid),s.writeBuffer(i.slice(5)),s.buffer}_getWktType(s,i){let a=s;return this.hasZ&&this.hasM?a+=" ZM ":this.hasZ?a+=" Z ":this.hasM&&(a+=" M "),i&&!this.hasZ&&!this.hasM&&(a+=" "),i&&(a+="EMPTY"),a}_getWktCoordinate(s){let i=`${s.x} ${s.y}`;return this.hasZ&&(i+=` ${s.z}`),this.hasM&&(i+=` ${s.m}`),i}_writeWkbType(s,i,a){let c=0;typeof this.srid>"u"&&(!a||typeof a.srid>"u")?this.hasZ&&this.hasM?c+=3e3:this.hasZ?c+=1e3:this.hasM&&(c+=2e3):(this.hasZ&&(c|=2147483648),this.hasM&&(c|=1073741824)),s.writeUInt32LE(c+i>>>0,!0)}static getTwkbPrecision(s,i,a){return{xy:s,z:i,m:a,xyFactor:Math.pow(10,s),zFactor:Math.pow(10,i),mFactor:Math.pow(10,a)}}_writeTwkbHeader(s,i,a,c){const d=(t.ZigZag.encode(a.xy)<<4)+i;let f=this.hasZ||this.hasM?1:0;if(f+=c?1:0,s.writeUInt8(d),s.writeUInt8(f),this.hasZ||this.hasM){let y=0;this.hasZ&&(y|=1),this.hasM&&(y|=2),s.writeUInt8(y)}}toWkt(){throw new Error("Method 'toWkt' not implemented.")}toWkb(){throw new Error("Method 'toWkb' not implemented.")}toTwkb(){throw new Error("Method 'toTwkb' not implemented.")}_getWkbSize(){throw new Error("Method '_getWkbSize' not implemented.")}}return Pr.Geometry=e,Pr}var $r={},Wo;function hf(){if(Wo)return $r;Wo=1,Object.defineProperty($r,"__esModule",{value:!0}),$r.GeometryCollection=void 0;const r=Ke(),t=$e(),e=ze();class n extends e.Geometry{constructor(i=[],a){super(),this.geometries=i,this.srid=a,this.geometries.length>0&&(this.hasZ=this.geometries[0].hasZ,this.hasM=this.geometries[0].hasM)}static Z(i,a){const c=new n(i,a);return c.hasZ=!0,c}static M(i,a){const c=new n(i,a);return c.hasM=!0,c}static ZM(i,a){const c=new n(i,a);return c.hasZ=!0,c.hasM=!0,c}static _parseWktWithOptions(i,a){const c=new n;if(c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM,i.isMatch(["EMPTY"]))return c;i.expectGroupStart();do c.geometries.push(e.Geometry.parse(i));while(i.isMatch([","]));return i.expectGroupEnd(),c}static _parseWkb(i,a){const c=new n;c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM;const d=i.readUInt32();for(let f=0;f<d;f++)c.geometries.push(e.Geometry.parse(i,a));return c}static _parseTwkb(i,a){const c=new n;if(c.hasZ=a.hasZ,c.hasM=a.hasM,a.isEmpty)return c;const d=i.readVarInt();for(let f=0;f<d;f++)c.geometries.push(e.Geometry.parseTwkb(i));return c}static _parseGeoJSON(i){const a=new n;for(let c=0;c<i.geometries.length;c++)a.geometries.push(e.Geometry._parseGeoJSON(i.geometries[c],!0));return a.geometries.length>0&&(a.hasZ=a.geometries[0].hasZ),a}toWkt(){if(this.geometries.length===0)return this._getWktType(t.CONSTANTS.wkt.GeometryCollection,!0);let i=this._getWktType(t.CONSTANTS.wkt.GeometryCollection,!1)+"(";for(let a=0;a<this.geometries.length;a++)i+=this.geometries[a].toWkt()+",";return i=i.slice(0,-1)+")",i}toWkb(){const i=new r.BinaryWriter(this._getWkbSize());i.writeInt8(1),this._writeWkbType(i,t.CONSTANTS.wkb.GeometryCollection),i.writeUInt32LE(this.geometries.length);for(let a=0;a<this.geometries.length;a++)i.writeBuffer(this.geometries[a].toWkb());return i.buffer}toTwkb(){const i=new r.BinaryWriter(0,!0),a=e.Geometry.getTwkbPrecision(5,0,0),c=this.geometries.length===0;if(this._writeTwkbHeader(i,t.CONSTANTS.wkb.GeometryCollection,a,c),!c){i.writeVarInt(this.geometries.length);for(let d=0;d<this.geometries.length;d++)i.writeBuffer(this.geometries[d].toTwkb())}return i.buffer}_getWkbSize(){let i=9;for(let a=0;a<this.geometries.length;a++)i+=this.geometries[a]._getWkbSize();return i}toGeoJSON(i){const a=super.toGeoJSON(i);return a.type=t.CONSTANTS.geoJSON.GeometryCollection,a.geometries=this.geometries.map(c=>c.toGeoJSON()),a}}return $r.GeometryCollection=n,$r}var zr={},Zo;function lf(){if(Zo)return zr;Zo=1,Object.defineProperty(zr,"__esModule",{value:!0}),zr.LineString=void 0;const r=Ke(),t=$e(),e=ze();class n extends e.Geometry{constructor(i=[],a){super(),this.hasZ=!1,this.hasM=!1,this.points=i,this.srid=a,this.points.length>0&&(this.hasZ=this.points[0].hasZ,this.hasM=this.points[0].hasM)}static Z(i,a){const c=new n(i,a);return c.hasZ=!0,c}static M(i,a){const c=new n(i,a);return c.hasM=!0,c}static ZM(i,a){const c=new n(i,a);return c.hasZ=!0,c.hasM=!0,c}static _parseWktWithOptions(i,a){const c=new n;return c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM,i.isMatch(["EMPTY"])||(i.expectGroupStart(),c.points.push(...i.matchCoordinates(a)),i.expectGroupEnd()),c}static _parseWkb(i,a){const c=new n;c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM;const d=i.readUInt32();for(let f=0;f<d;f++)c.points.push(e.Point._readWkbPoint(i,a));return c}static _parseTwkb(i,a){const c=new n;if(c.hasZ=a.hasZ,c.hasM=a.hasM,a.isEmpty)return c;const d=new e.Point(0,0,0,0),f=i.readVarInt();for(let y=0;y<f;y++)c.points.push(e.Point._readTwkbPoint(i,a,d));return c}static _parseGeoJSON(i){const a=new n;i.coordinates.length>0&&(a.hasZ=i.coordinates[0].length>2);for(const c of i.coordinates)a.points.push(e.Point._readGeoJSONPoint(c));return a}static fromGeometry(i){const a=new n;return a.srid=i.srid,a.hasZ=i.hasZ,a.hasM=i.hasM,i instanceof n?a.points=i.points:i instanceof e.Point&&(a.points=[i]),a}toWkt(){return this.points.length===0?this._getWktType(t.CONSTANTS.wkt.LineString,!0):this._getWktType(t.CONSTANTS.wkt.LineString,!1)+this._toInnerWkt()}_toInnerWkt(){let i="(";for(const a of this.points)i+=`${this._getWktCoordinate(a)},`;return i.slice(0,-1)+")"}toWkb(i){const a=new r.BinaryWriter(this._getWkbSize());a.writeInt8(1),this._writeWkbType(a,t.CONSTANTS.wkb.LineString,i),a.writeUInt32LE(this.points.length);for(const c of this.points)c._writeWkbPoint(a);return a.buffer}toTwkb(){const i=new r.BinaryWriter(0,!0),a=e.Geometry.getTwkbPrecision(5,0,0),c=this.points.length===0;if(this._writeTwkbHeader(i,t.CONSTANTS.wkb.LineString,a,c),!c){i.writeVarInt(this.points.length);const d=new e.Point(0,0,0,0);for(const f of this.points)f._writeTwkbPoint(i,a,d)}return i.buffer}_getWkbSize(){let i=16;return this.hasZ&&(i+=8),this.hasM&&(i+=8),9+this.points.length*i}toGeoJSON(i){const a=super.toGeoJSON(i);return a.type=t.CONSTANTS.geoJSON.LineString,a.coordinates=this.points.map(c=>this.hasZ?[c.x,c.y,c.z]:[c.x,c.y]),a}}return zr.LineString=n,zr}var jr={},Go;function df(){if(Go)return jr;Go=1,Object.defineProperty(jr,"__esModule",{value:!0}),jr.MultiLineString=void 0;const r=Ke(),t=$e(),e=ze();class n extends e.Geometry{constructor(i=[],a){super(),this.lineStrings=i,this.srid=a,this.lineStrings.length>0&&(this.hasZ=this.lineStrings[0].hasZ,this.hasM=this.lineStrings[0].hasM)}static Z(i,a){const c=new n(i,a);return c.hasZ=!0,c}static M(i,a){const c=new n(i,a);return c.hasM=!0,c}static ZM(i,a){const c=new n(i,a);return c.hasZ=!0,c.hasM=!0,c}static _parseWktWithOptions(i,a){const c=new n;if(c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM,i.isMatch(["EMPTY"]))return c;i.expectGroupStart();do i.expectGroupStart(),c.lineStrings.push(new e.LineString(i.matchCoordinates(a))),i.expectGroupEnd();while(i.isMatch([","]));return i.expectGroupEnd(),c}static _parseWkb(i,a){const c=new n;c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM;const d=i.readUInt32();for(let f=0;f<d;f++){const y=e.Geometry.parse(i,a);c.lineStrings.push(e.LineString.fromGeometry(y))}return c}static _parseTwkb(i,a){const c=new n;if(c.hasZ=a.hasZ,c.hasM=a.hasM,a.isEmpty)return c;const d=new e.Point(0,0,0,0),f=i.readVarInt();for(let y=0;y<f;y++){const B=new e.LineString;B.hasZ=a.hasZ,B.hasM=a.hasM;const L=i.readVarInt();for(let x=0;x<L;x++)B.points.push(e.Point._readTwkbPoint(i,a,d));c.lineStrings.push(B)}return c}static _parseGeoJSON(i){const a=new n;i.coordinates.length>0&&i.coordinates[0].length>0&&(a.hasZ=i.coordinates[0][0].length>2);for(let c=0;c<i.coordinates.length;c++)a.lineStrings.push(e.LineString._parseGeoJSON({coordinates:i.coordinates[c]}));return a}toWkt(){if(this.lineStrings.length===0)return this._getWktType(t.CONSTANTS.wkt.MultiLineString,!0);let i=this._getWktType(t.CONSTANTS.wkt.MultiLineString,!1)+"(";for(let a=0;a<this.lineStrings.length;a++)i+=this.lineStrings[a]._toInnerWkt()+",";return i=i.slice(0,-1)+")",i}toWkb(){const i=new r.BinaryWriter(this._getWkbSize());i.writeInt8(1),this._writeWkbType(i,t.CONSTANTS.wkb.MultiLineString),i.writeUInt32LE(this.lineStrings.length);for(let a=0;a<this.lineStrings.length;a++)i.writeBuffer(this.lineStrings[a].toWkb({srid:this.srid}));return i.buffer}toTwkb(){const i=new r.BinaryWriter(0,!0),a=e.Geometry.getTwkbPrecision(5,0,0),c=this.lineStrings.length===0;if(this._writeTwkbHeader(i,t.CONSTANTS.wkb.MultiLineString,a,c),!c){i.writeVarInt(this.lineStrings.length);const d=new e.Point(0,0,0,0);for(let f=0;f<this.lineStrings.length;f++){i.writeVarInt(this.lineStrings[f].points.length);for(let y=0;y<this.lineStrings[f].points.length;y++)this.lineStrings[f].points[y]._writeTwkbPoint(i,a,d)}}return i.buffer}_getWkbSize(){let i=9;for(let a=0;a<this.lineStrings.length;a++)i+=this.lineStrings[a]._getWkbSize();return i}toGeoJSON(i){const a=super.toGeoJSON(i);a.type=t.CONSTANTS.geoJSON.MultiLineString,a.coordinates=[];for(let c=0;c<this.lineStrings.length;c++)a.coordinates.push(this.lineStrings[c].toGeoJSON().coordinates);return a}}return jr.MultiLineString=n,jr}var Vr={},Yo;function ff(){if(Yo)return Vr;Yo=1,Object.defineProperty(Vr,"__esModule",{value:!0}),Vr.MultiPoint=void 0;const r=Ke(),t=$e(),e=ze();class n extends e.Geometry{constructor(i=[],a){super(),this.points=i,this.srid=a,this.points.length>0&&(this.hasZ=this.points[0].hasZ,this.hasM=this.points[0].hasM)}static Z(i,a){const c=new n(i,a);return c.hasZ=!0,c}static M(i,a){const c=new n(i,a);return c.hasM=!0,c}static ZM(i,a){const c=new n(i,a);return c.hasZ=!0,c.hasM=!0,c}static _parseWktWithOptions(i,a){const c=new n;return c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM,i.isMatch(["EMPTY"])||(i.expectGroupStart(),c.points.push(...i.matchCoordinates(a)),i.expectGroupEnd()),c}static _parseWkb(i,a){const c=new n;c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM;const d=i.readUInt32();for(let f=0;f<d;f++){const y=e.Geometry.parse(i,a);c.points.push(e.Point.fromGeometry(y))}return c}static _parseTwkb(i,a){const c=new n;if(c.hasZ=a.hasZ,c.hasM=a.hasM,a.isEmpty)return c;const d=new e.Point(0,0,0,0),f=i.readVarInt();for(let y=0;y<f;y++)c.points.push(e.Point._readTwkbPoint(i,a,d));return c}static _parseGeoJSON(i){const a=new n;i.coordinates.length>0&&(a.hasZ=i.coordinates[0].length>2);for(let c=0;c<i.coordinates.length;c++)a.points.push(e.Point._parseGeoJSON({coordinates:i.coordinates[c]}));return a}toWkt(){if(this.points.length===0)return this._getWktType(t.CONSTANTS.wkt.MultiPoint,!0);let i=this._getWktType(t.CONSTANTS.wkt.MultiPoint,!1)+"(";for(let a=0;a<this.points.length;a++)i+=this._getWktCoordinate(this.points[a])+",";return i=i.slice(0,-1)+")",i}toWkb(){const i=new r.BinaryWriter(this._getWkbSize());i.writeInt8(1),this._writeWkbType(i,t.CONSTANTS.wkb.MultiPoint),i.writeUInt32LE(this.points.length);for(let a=0;a<this.points.length;a++)i.writeBuffer(this.points[a].toWkb({srid:this.srid}));return i.buffer}toTwkb(){const i=new r.BinaryWriter(0,!0),a=e.Geometry.getTwkbPrecision(5,0,0),c=this.points.length===0;if(this._writeTwkbHeader(i,t.CONSTANTS.wkb.MultiPoint,a,c),!c){i.writeVarInt(this.points.length);const d=new e.Point(0,0,0,0);for(let f=0;f<this.points.length;f++)this.points[f]._writeTwkbPoint(i,a,d)}return i.buffer}_getWkbSize(){let i=16;return this.hasZ&&(i+=8),this.hasM&&(i+=8),i+=5,9+this.points.length*i}toGeoJSON(i){const a=super.toGeoJSON(i);a.type=t.CONSTANTS.geoJSON.MultiPoint,a.coordinates=[];for(let c=0;c<this.points.length;c++)a.coordinates.push(this.points[c].toGeoJSON().coordinates);return a}}return Vr.MultiPoint=n,Vr}var Wr={},Jo;function pf(){if(Jo)return Wr;Jo=1,Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.MultiPolygon=void 0;const r=Ke(),t=$e(),e=ze();class n extends e.Geometry{constructor(i,a){super(),this.polygons=i||[],this.srid=a,this.polygons.length>0?(this.hasZ=this.polygons[0].hasZ,this.hasM=this.polygons[0].hasM):(this.hasZ=!1,this.hasM=!1)}static Z(i,a){const c=new n(i,a);return c.hasZ=!0,c}static M(i,a){const c=new n(i,a);return c.hasM=!0,c}static ZM(i,a){const c=new n(i,a);return c.hasZ=!0,c.hasM=!0,c}static _parseWktWithOptions(i,a){const c=new n;if(c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM,i.isMatch(["EMPTY"]))return c;i.expectGroupStart();do{i.expectGroupStart();const d=[],f=[];for(i.expectGroupStart(),d.push(...i.matchCoordinates(a)),i.expectGroupEnd();i.isMatch([","]);)i.expectGroupStart(),f.push(i.matchCoordinates(a)),i.expectGroupEnd();c.polygons.push(new e.Polygon(d,f)),i.expectGroupEnd()}while(i.isMatch([","]));return i.expectGroupEnd(),c}static _parseWkb(i,a){const c=new n;c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM;const d=i.readUInt32();for(let f=0;f<d;f++)c.polygons.push(e.Geometry.parse(i,a));return c}static _parseTwkb(i,a){const c=new n;if(c.hasZ=a.hasZ,c.hasM=a.hasM,a.isEmpty)return c;const d=new e.Point(0,0,0,0),f=i.readVarInt();for(let y=0;y<f;y++){const B=new e.Polygon;B.hasZ=a.hasZ,B.hasM=a.hasM;const L=i.readVarInt(),x=i.readVarInt();for(let M=0;M<x;M++)B.exteriorRing.push(e.Point._readTwkbPoint(i,a,d));for(let M=1;M<L;M++){const U=[],F=i.readVarInt();for(let O=0;O<F;O++)U.push(e.Point._readTwkbPoint(i,a,d));B.interiorRings.push(U)}c.polygons.push(B)}return c}static _parseGeoJSON(i){const a=new n;i.coordinates.length>0&&i.coordinates[0].length>0&&i.coordinates[0][0].length>0&&(a.hasZ=i.coordinates[0][0].length>2);for(let c=0;c<i.coordinates.length;c++)a.polygons.push(e.Polygon._parseGeoJSON({coordinates:i.coordinates}));return a}toWkt(){if(this.polygons.length===0)return this._getWktType(t.CONSTANTS.wkt.MultiPolygon,!0);let i=this._getWktType(t.CONSTANTS.wkt.MultiPolygon,!1)+"(";for(let a=0;a<this.polygons.length;a++)i+=this.polygons[a]._toInnerWkt()+",";return i=i.slice(0,-1),i+=")",i}toWkb(){const i=new r.BinaryWriter(this._getWkbSize());i.writeInt8(1),this._writeWkbType(i,t.CONSTANTS.wkb.MultiPolygon),i.writeUInt32LE(this.polygons.length);for(let a=0;a<this.polygons.length;a++)i.writeBuffer(this.polygons[a].toWkb({srid:this.srid}));return i.buffer}toTwkb(){const i=new r.BinaryWriter(0,!0),a=e.Geometry.getTwkbPrecision(5,0,0),c=this.polygons.length===0;if(this._writeTwkbHeader(i,t.CONSTANTS.wkb.MultiPolygon,a,c),this.polygons.length>0){i.writeVarInt(this.polygons.length);const d=new e.Point(0,0,0,0);for(let f=0;f<this.polygons.length;f++){i.writeVarInt(1+this.polygons[f].interiorRings.length),i.writeVarInt(this.polygons[f].exteriorRing.length);for(let y=0;y<this.polygons[f].exteriorRing.length;y++)this.polygons[f].exteriorRing[y]._writeTwkbPoint(i,a,d);for(let y=0;y<this.polygons[f].interiorRings.length;y++){i.writeVarInt(this.polygons[f].interiorRings[y].length);for(let B=0;B<this.polygons[f].interiorRings[y].length;B++)this.polygons[f].interiorRings[y][B]._writeTwkbPoint(i,a,d)}}}return i.buffer}_getWkbSize(){let i=9;for(let a=0;a<this.polygons.length;a++)i+=this.polygons[a]._getWkbSize();return i}toGeoJSON(i){const a=super.toGeoJSON(i);a.type=t.CONSTANTS.geoJSON.MultiPolygon,a.coordinates=[];for(let c=0;c<this.polygons.length;c++)a.coordinates.push(this.polygons[c].toGeoJSON().coordinates);return a}}return Wr.MultiPolygon=n,Wr}var Zr={},Gr={},Ho;function xu(){if(Ho)return Gr;Ho=1,Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.ZigZag=void 0;class r{static encode(e){return e<<1^e>>31}static decode(e){return e>>1^-(e&1)}}return Gr.ZigZag=r,Gr}var qo;function Au(){if(qo)return Zr;qo=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.Point=void 0;const r=Ke(),t=xu(),e=$e(),n=ze();class s extends n.Geometry{constructor(a,c,d,f,y){super(),this.x=a,this.y=c,this.z=d,this.m=f,this.srid=y,this.hasZ=typeof this.z<"u",this.hasM=typeof this.m<"u"}static Z(a,c,d,f){const y=new s(a,c,d,0,f);return y.hasZ=!0,y}static M(a,c,d,f){const y=new s(a,c,0,d,f);return y.hasM=!0,y}static ZM(a,c,d,f,y){const B=new s(a,c,d,f,y);return B.hasZ=!0,B.hasM=!0,B}static _parseWktWithOptions(a,c){const d=new s(0,0,0,0);if(d.srid=c.srid,d.hasZ=c.hasZ,d.hasM=c.hasM,a.isMatch(["EMPTY"]))return d;a.expectGroupStart();const f=a.matchCoordinate(c);return d.x=f.x,d.y=f.y,d.z=f.z,d.m=f.m,a.expectGroupEnd(),d}static _parseWkb(a,c){const d=s._readWkbPoint(a,c);return d.srid=c.srid,d}static _readWkbPoint(a,c){return new s(a.readDouble(),a.readDouble(),c.hasZ?a.readDouble():!1,c.hasM?a.readDouble():!1)}static _parseTwkb(a,c){const d=new s(0,0,0,0);return d.hasZ=c.hasZ,d.hasM=c.hasM,c.isEmpty||(d.x=t.ZigZag.decode(a.readVarInt())/c.precisionFactor,d.y=t.ZigZag.decode(a.readVarInt())/c.precisionFactor,d.z=c.hasZ?t.ZigZag.decode(a.readVarInt())/c.zPrecisionFactor:0,d.m=c.hasM?t.ZigZag.decode(a.readVarInt())/c.mPrecisionFactor:0),d}static _readTwkbPoint(a,c,d){return d.x+=t.ZigZag.decode(a.readVarInt())/c.precisionFactor,d.y+=t.ZigZag.decode(a.readVarInt())/c.precisionFactor,c.hasZ&&(d.z+=t.ZigZag.decode(a.readVarInt())/c.zPrecisionFactor),c.hasM&&(d.m+=t.ZigZag.decode(a.readVarInt())/c.mPrecisionFactor),new s(d.x,d.y,d.z,d.m)}static _parseGeoJSON(a){return s._readGeoJSONPoint(a.coordinates)}static _readGeoJSONPoint(a){return a.length===0?new s(0,0,0,0):a.length>2?new s(a[0],a[1],a[2],0):new s(a[0],a[1],0,0)}static fromGeometry(a){const c=new s(0,0,0,0);return c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM,a instanceof s?(c.x=a.x,c.y=a.y,c.z=a.z,c.m=a.m):console.log("Point.fromGeometry: geom is not an instance of Point"),c}toWkt(){return this.x===void 0&&this.y===void 0&&this.z===void 0&&this.m===void 0?this._getWktType(e.CONSTANTS.wkt.Point,!0):`${this._getWktType(e.CONSTANTS.wkt.Point,!1)}(${this._getWktCoordinate(this)})`}toWkb(a){const c=new r.BinaryWriter(this._getWkbSize());return c.writeInt8(1),this._writeWkbType(c,e.CONSTANTS.wkb.Point,a),this.x===void 0&&this.y===void 0?(c.writeDoubleLE(NaN),c.writeDoubleLE(NaN),this.hasZ&&c.writeDoubleLE(NaN),this.hasM&&c.writeDoubleLE(NaN)):this._writeWkbPoint(c),c.buffer}_writeWkbPoint(a){a.writeDoubleLE(this.x),a.writeDoubleLE(this.y),this.hasZ&&a.writeDoubleLE(this.z),this.hasM&&a.writeDoubleLE(this.m)}toTwkb(){const a=new r.BinaryWriter(0,!0),c=n.Geometry.getTwkbPrecision(5,0,0),d=this.x===void 0&&this.y===void 0;return this._writeTwkbHeader(a,e.CONSTANTS.wkb.Point,c,d),d||this._writeTwkbPoint(a,c,new s(0,0,0,0)),a.buffer}_writeTwkbPoint(a,c,d){const f=this.x*c.xyFactor,y=this.y*c.xyFactor,B=this.z*c.zFactor,L=this.m*c.mFactor;a.writeVarInt(t.ZigZag.encode(f-d.x)),a.writeVarInt(t.ZigZag.encode(y-d.y)),this.hasZ&&a.writeVarInt(t.ZigZag.encode(B-d.z)),this.hasM&&a.writeVarInt(t.ZigZag.encode(L-d.m)),d.x=f,d.y=y,d.z=B,d.m=L}_getWkbSize(){let a=21;return this.hasZ&&(a+=8),this.hasM&&(a+=8),a}toGeoJSON(a){const c=super.toGeoJSON(a);return c.type=e.CONSTANTS.geoJSON.Point,this.x===void 0&&this.y===void 0?c.coordinates=[]:this.z!==void 0?c.coordinates=[this.x,this.y,this.z]:c.coordinates=[this.x,this.y],c}}return Zr.Point=s,Zr}var Yr={},Ko;function yf(){if(Ko)return Yr;Ko=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.Polygon=void 0;const r=Ke(),t=$e(),e=ze();class n extends e.Geometry{constructor(i,a,c){super(),this.exteriorRing=i||[],this.interiorRings=a||[],this.srid=c,this.exteriorRing.length>0?(this.hasZ=this.exteriorRing[0].hasZ,this.hasM=this.exteriorRing[0].hasM):(this.hasZ=!1,this.hasM=!1)}static Z(i,a,c){const d=new n(i,a,c);return d.hasZ=!0,d}static M(i,a,c){const d=new n(i,a,c);return d.hasM=!0,d}static ZM(i,a,c){const d=new n(i,a,c);return d.hasZ=!0,d.hasM=!0,d}static _parseWktWithOptions(i,a){const c=new n;if(c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM,i.isMatch(["EMPTY"]))return c;for(i.expectGroupStart(),i.expectGroupStart(),c.exteriorRing.push(...i.matchCoordinates(a)),i.expectGroupEnd();i.isMatch([","]);)i.expectGroupStart(),c.interiorRings.push(i.matchCoordinates(a)),i.expectGroupEnd();return i.expectGroupEnd(),c}static _parseWkb(i,a){const c=new n;c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM;const d=i.readUInt32();if(d>0){const f=i.readUInt32();for(let y=0;y<f;y++)c.exteriorRing.push(e.Point._readWkbPoint(i,a));for(let y=1;y<d;y++){const B=[],L=i.readUInt32();for(let x=0;x<L;x++)B.push(e.Point._readWkbPoint(i,a));c.interiorRings.push(B)}}return c}static _parseTwkb(i,a){const c=new n;if(c.hasZ=a.hasZ,c.hasM=a.hasM,a.isEmpty)return c;const d=new e.Point(0,0,0,0),f=i.readVarInt(),y=i.readVarInt();for(let B=0;B<y;B++)c.exteriorRing.push(e.Point._readTwkbPoint(i,a,d));for(let B=1;B<f;B++){const L=[],x=i.readVarInt();for(let M=0;M<x;M++)L.push(e.Point._readTwkbPoint(i,a,d));c.interiorRings.push(L)}return c}static _parseGeoJSON(i){const a=new n;i.coordinates.length>0&&i.coordinates[0].length>0&&(a.hasZ=i.coordinates[0][0].length>2);for(let c=0;c<i.coordinates.length;c++){c>0&&a.interiorRings.push([]);for(let d=0;d<i.coordinates[c].length;d++)c===0?a.exteriorRing.push(e.Point._readGeoJSONPoint(i.coordinates[c][d])):a.interiorRings[c-1].push(e.Point._readGeoJSONPoint(i.coordinates[c][d]))}return a}toWkt(){return this.exteriorRing.length===0?this._getWktType(t.CONSTANTS.wkt.Polygon,!0):this._getWktType(t.CONSTANTS.wkt.Polygon,!1)+this._toInnerWkt()}_toInnerWkt(){let i="((";for(let a=0;a<this.exteriorRing.length;a++)i+=this._getWktCoordinate(this.exteriorRing[a])+",";i=i.slice(0,-1),i+=")";for(let a=0;a<this.interiorRings.length;a++){i+=",(";for(let c=0;c<this.interiorRings[a].length;c++)i+=this._getWktCoordinate(this.interiorRings[a][c])+",";i=i.slice(0,-1),i+=")"}return i+=")",i}toWkb(i){const a=new r.BinaryWriter(this._getWkbSize());a.writeInt8(1),this._writeWkbType(a,t.CONSTANTS.wkb.Polygon,i),this.exteriorRing.length>0?(a.writeUInt32LE(1+this.interiorRings.length),a.writeUInt32LE(this.exteriorRing.length)):a.writeUInt32LE(0);for(let c=0;c<this.exteriorRing.length;c++)this.exteriorRing[c]._writeWkbPoint(a);for(let c=0;c<this.interiorRings.length;c++){a.writeUInt32LE(this.interiorRings[c].length);for(let d=0;d<this.interiorRings[c].length;d++)this.interiorRings[c][d]._writeWkbPoint(a)}return a.buffer}toTwkb(){const i=new r.BinaryWriter(0,!0),a=e.Geometry.getTwkbPrecision(5,0,0),c=this.exteriorRing.length===0;if(this._writeTwkbHeader(i,t.CONSTANTS.wkb.Polygon,a,c),this.exteriorRing.length>0){i.writeVarInt(1+this.interiorRings.length),i.writeVarInt(this.exteriorRing.length);const d=new e.Point(0,0,0,0);for(let f=0;f<this.exteriorRing.length;f++)this.exteriorRing[f]._writeTwkbPoint(i,a,d);for(let f=0;f<this.interiorRings.length;f++){i.writeVarInt(this.interiorRings[f].length);for(let y=0;y<this.interiorRings[f].length;y++)this.interiorRings[f][y]._writeTwkbPoint(i,a,d)}}return i.buffer}_getWkbSize(){let i=16;this.hasZ&&(i+=8),this.hasM&&(i+=8);let a=9;this.exteriorRing.length>0&&(a+=4+this.exteriorRing.length*i);for(let c=0;c<this.interiorRings.length;c++)a+=4+this.interiorRings[c].length*i;return a}toGeoJSON(i){const a=super.toGeoJSON(i);if(a.type=t.CONSTANTS.geoJSON.Polygon,a.coordinates=[],this.exteriorRing.length>0){const c=[];for(let d=0;d<this.exteriorRing.length;d++)this.hasZ?c.push([this.exteriorRing[d].x,this.exteriorRing[d].y,this.exteriorRing[d].z]):c.push([this.exteriorRing[d].x,this.exteriorRing[d].y]);a.coordinates.push(c)}for(let c=0;c<this.interiorRings.length;c++){const d=[];for(let f=0;f<this.interiorRings[c].length;f++)this.hasZ?d.push([this.interiorRings[c][f].x,this.interiorRings[c][f].y,this.interiorRings[c][f].z]):d.push([this.interiorRings[c][f].x,this.interiorRings[c][f].y]);a.coordinates.push(d)}return a}}return Yr.Polygon=n,Yr}var Jr={},Xo;function gf(){if(Xo)return Jr;Xo=1,Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.WktParser=void 0;const r=$e(),t=Au();class e{constructor(s){this.value=s,this.position=0}match(s){this.skipWhitespaces();for(let i=0;i<s.length;i++)if(this.value.substring(this.position).indexOf(s[i])===0)return this.position+=s[i].length,s[i];return null}matchRegex(s){this.skipWhitespaces();for(let i=0;i<s.length;i++){const a=this.value.substring(this.position).match(s[i]);if(a)return this.position+=a[0].length,a}return null}isMatch(s){this.skipWhitespaces();for(let i=0;i<s.length;i++)if(this.value.substring(this.position).indexOf(s[i])===0)return this.position+=s[i].length,!0;return!1}matchType(){const s=this.match([r.CONSTANTS.wkt.Point,r.CONSTANTS.wkt.LineString,r.CONSTANTS.wkt.Polygon,r.CONSTANTS.wkt.MultiPoint,r.CONSTANTS.wkt.MultiLineString,r.CONSTANTS.wkt.MultiPolygon,r.CONSTANTS.wkt.GeometryCollection]);if(!s)throw new Error("Expected geometry type");return s}matchDimension(){switch(this.match(["ZM","Z","M"])){case"ZM":return{hasZ:!0,hasM:!0};case"Z":return{hasZ:!0,hasM:!1};case"M":return{hasZ:!1,hasM:!0};default:return{hasZ:!1,hasM:!1}}}expectGroupStart(){if(!this.isMatch(["("]))throw new Error("Expected group start")}expectGroupEnd(){if(!this.isMatch([")"]))throw new Error("Expected group end")}matchCoordinate(s){let i;if(s.hasZ&&s.hasM?i=this.matchRegex([/^(\S*)\s+(\S*)\s+(\S*)\s+([^\s,)]*)/]):s.hasZ||s.hasM?i=this.matchRegex([/^(\S*)\s+(\S*)\s+([^\s,)]*)/]):i=this.matchRegex([/^(\S*)\s+([^\s,)]*)/]),!i)throw new Error("Expected coordinates");return s.hasZ&&s.hasM?new t.Point(parseFloat(i[1]),parseFloat(i[2]),parseFloat(i[3]),parseFloat(i[4])):s.hasZ?new t.Point(parseFloat(i[1]),parseFloat(i[2]),parseFloat(i[3]),0):s.hasM?new t.Point(parseFloat(i[1]),parseFloat(i[2]),0,parseFloat(i[3])):new t.Point(parseFloat(i[1]),parseFloat(i[2]),0,0)}matchCoordinates(s){const i=[];do{const a=this.isMatch(["("]);i.push(this.matchCoordinate(s)),a&&this.expectGroupEnd()}while(this.isMatch([","]));return i}skipWhitespaces(){for(;this.position<this.value.length&&this.value[this.position]===" ";)this.position++}}return Jr.WktParser=e,Jr}var Qo;function ze(){return Qo||(Qo=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ZigZag=r.WktParser=r.Polygon=r.Point=r.MultiPolygon=r.MultiPoint=r.MultiLineString=r.LineString=r.GeometryCollection=r.Geometry=r.CONSTANTS=r.BinaryWriter=r.BinaryReader=void 0;const t=cf();Object.defineProperty(r,"BinaryReader",{enumerable:!0,get:function(){return t.BinaryReader}});const e=Ke();Object.defineProperty(r,"BinaryWriter",{enumerable:!0,get:function(){return e.BinaryWriter}});const n=$e();Object.defineProperty(r,"CONSTANTS",{enumerable:!0,get:function(){return n.CONSTANTS}});const s=uf();Object.defineProperty(r,"Geometry",{enumerable:!0,get:function(){return s.Geometry}});const i=hf();Object.defineProperty(r,"GeometryCollection",{enumerable:!0,get:function(){return i.GeometryCollection}});const a=lf();Object.defineProperty(r,"LineString",{enumerable:!0,get:function(){return a.LineString}});const c=df();Object.defineProperty(r,"MultiLineString",{enumerable:!0,get:function(){return c.MultiLineString}});const d=ff();Object.defineProperty(r,"MultiPoint",{enumerable:!0,get:function(){return d.MultiPoint}});const f=pf();Object.defineProperty(r,"MultiPolygon",{enumerable:!0,get:function(){return f.MultiPolygon}});const y=Au();Object.defineProperty(r,"Point",{enumerable:!0,get:function(){return y.Point}});const B=yf();Object.defineProperty(r,"Polygon",{enumerable:!0,get:function(){return B.Polygon}});const L=gf();Object.defineProperty(r,"WktParser",{enumerable:!0,get:function(){return L.WktParser}});const x=xu();Object.defineProperty(r,"ZigZag",{enumerable:!0,get:function(){return x.ZigZag}})}(Pi)),Pi}var mf=ze(),zi={};var ta;function wf(){return ta||(ta=1,function(r){const t=Bu(),e=vu(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=c,r.SlowBuffer=C,r.INSPECT_MAX_BYTES=50;const s=2147483647;r.kMaxLength=s,c.TYPED_ARRAY_SUPPORT=i(),!c.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{const h=new Uint8Array(1),o={foo:function(){return 42}};return Object.setPrototypeOf(o,Uint8Array.prototype),Object.setPrototypeOf(h,o),h.foo()===42}catch{return!1}}Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}});function a(h){if(h>s)throw new RangeError('The value "'+h+'" is invalid for option "size"');const o=new Uint8Array(h);return Object.setPrototypeOf(o,c.prototype),o}function c(h,o,u){if(typeof h=="number"){if(typeof o=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return B(h)}return d(h,o,u)}c.poolSize=8192;function d(h,o,u){if(typeof h=="string")return L(h,o);if(ArrayBuffer.isView(h))return M(h);if(h==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof h);if(mt(h,ArrayBuffer)||h&&mt(h.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(mt(h,SharedArrayBuffer)||h&&mt(h.buffer,SharedArrayBuffer)))return U(h,o,u);if(typeof h=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const l=h.valueOf&&h.valueOf();if(l!=null&&l!==h)return c.from(l,o,u);const p=F(h);if(p)return p;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof h[Symbol.toPrimitive]=="function")return c.from(h[Symbol.toPrimitive]("string"),o,u);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof h)}c.from=function(h,o,u){return d(h,o,u)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array);function f(h){if(typeof h!="number")throw new TypeError('"size" argument must be of type number');if(h<0)throw new RangeError('The value "'+h+'" is invalid for option "size"')}function y(h,o,u){return f(h),h<=0?a(h):o!==void 0?typeof u=="string"?a(h).fill(o,u):a(h).fill(o):a(h)}c.alloc=function(h,o,u){return y(h,o,u)};function B(h){return f(h),a(h<0?0:O(h)|0)}c.allocUnsafe=function(h){return B(h)},c.allocUnsafeSlow=function(h){return B(h)};function L(h,o){if((typeof o!="string"||o==="")&&(o="utf8"),!c.isEncoding(o))throw new TypeError("Unknown encoding: "+o);const u=P(h,o)|0;let l=a(u);const p=l.write(h,o);return p!==u&&(l=l.slice(0,p)),l}function x(h){const o=h.length<0?0:O(h.length)|0,u=a(o);for(let l=0;l<o;l+=1)u[l]=h[l]&255;return u}function M(h){if(mt(h,Uint8Array)){const o=new Uint8Array(h);return U(o.buffer,o.byteOffset,o.byteLength)}return x(h)}function U(h,o,u){if(o<0||h.byteLength<o)throw new RangeError('"offset" is outside of buffer bounds');if(h.byteLength<o+(u||0))throw new RangeError('"length" is outside of buffer bounds');let l;return o===void 0&&u===void 0?l=new Uint8Array(h):u===void 0?l=new Uint8Array(h,o):l=new Uint8Array(h,o,u),Object.setPrototypeOf(l,c.prototype),l}function F(h){if(c.isBuffer(h)){const o=O(h.length)|0,u=a(o);return u.length===0||h.copy(u,0,0,o),u}if(h.length!==void 0)return typeof h.length!="number"||Qt(h.length)?a(0):x(h);if(h.type==="Buffer"&&Array.isArray(h.data))return x(h.data)}function O(h){if(h>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return h|0}function C(h){return+h!=h&&(h=0),c.alloc(+h)}c.isBuffer=function(o){return o!=null&&o._isBuffer===!0&&o!==c.prototype},c.compare=function(o,u){if(mt(o,Uint8Array)&&(o=c.from(o,o.offset,o.byteLength)),mt(u,Uint8Array)&&(u=c.from(u,u.offset,u.byteLength)),!c.isBuffer(o)||!c.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(o===u)return 0;let l=o.length,p=u.length;for(let b=0,I=Math.min(l,p);b<I;++b)if(o[b]!==u[b]){l=o[b],p=u[b];break}return l<p?-1:p<l?1:0},c.isEncoding=function(o){switch(String(o).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(o,u){if(!Array.isArray(o))throw new TypeError('"list" argument must be an Array of Buffers');if(o.length===0)return c.alloc(0);let l;if(u===void 0)for(u=0,l=0;l<o.length;++l)u+=o[l].length;const p=c.allocUnsafe(u);let b=0;for(l=0;l<o.length;++l){let I=o[l];if(mt(I,Uint8Array))b+I.length>p.length?(c.isBuffer(I)||(I=c.from(I)),I.copy(p,b)):Uint8Array.prototype.set.call(p,I,b);else if(c.isBuffer(I))I.copy(p,b);else throw new TypeError('"list" argument must be an Array of Buffers');b+=I.length}return p};function P(h,o){if(c.isBuffer(h))return h.length;if(ArrayBuffer.isView(h)||mt(h,ArrayBuffer))return h.byteLength;if(typeof h!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof h);const u=h.length,l=arguments.length>2&&arguments[2]===!0;if(!l&&u===0)return 0;let p=!1;for(;;)switch(o){case"ascii":case"latin1":case"binary":return u;case"utf8":case"utf-8":return kt(h).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u*2;case"hex":return u>>>1;case"base64":return $t(h).length;default:if(p)return l?-1:kt(h).length;o=(""+o).toLowerCase(),p=!0}}c.byteLength=P;function V(h,o,u){let l=!1;if((o===void 0||o<0)&&(o=0),o>this.length||((u===void 0||u>this.length)&&(u=this.length),u<=0)||(u>>>=0,o>>>=0,u<=o))return"";for(h||(h="utf8");;)switch(h){case"hex":return X(this,o,u);case"utf8":case"utf-8":return z(this,o,u);case"ascii":return Y(this,o,u);case"latin1":case"binary":return Z(this,o,u);case"base64":return Q(this,o,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K(this,o,u);default:if(l)throw new TypeError("Unknown encoding: "+h);h=(h+"").toLowerCase(),l=!0}}c.prototype._isBuffer=!0;function G(h,o,u){const l=h[o];h[o]=h[u],h[u]=l}c.prototype.swap16=function(){const o=this.length;if(o%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let u=0;u<o;u+=2)G(this,u,u+1);return this},c.prototype.swap32=function(){const o=this.length;if(o%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let u=0;u<o;u+=4)G(this,u,u+3),G(this,u+1,u+2);return this},c.prototype.swap64=function(){const o=this.length;if(o%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let u=0;u<o;u+=8)G(this,u,u+7),G(this,u+1,u+6),G(this,u+2,u+5),G(this,u+3,u+4);return this},c.prototype.toString=function(){const o=this.length;return o===0?"":arguments.length===0?z(this,0,o):V.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(o){if(!c.isBuffer(o))throw new TypeError("Argument must be a Buffer");return this===o?!0:c.compare(this,o)===0},c.prototype.inspect=function(){let o="";const u=r.INSPECT_MAX_BYTES;return o=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(o+=" ... "),"<Buffer "+o+">"},n&&(c.prototype[n]=c.prototype.inspect),c.prototype.compare=function(o,u,l,p,b){if(mt(o,Uint8Array)&&(o=c.from(o,o.offset,o.byteLength)),!c.isBuffer(o))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof o);if(u===void 0&&(u=0),l===void 0&&(l=o?o.length:0),p===void 0&&(p=0),b===void 0&&(b=this.length),u<0||l>o.length||p<0||b>this.length)throw new RangeError("out of range index");if(p>=b&&u>=l)return 0;if(p>=b)return-1;if(u>=l)return 1;if(u>>>=0,l>>>=0,p>>>=0,b>>>=0,this===o)return 0;let I=b-p,H=l-u;const pt=Math.min(I,H),lt=this.slice(p,b),yt=o.slice(u,l);for(let et=0;et<pt;++et)if(lt[et]!==yt[et]){I=lt[et],H=yt[et];break}return I<H?-1:H<I?1:0};function A(h,o,u,l,p){if(h.length===0)return-1;if(typeof u=="string"?(l=u,u=0):u>2147483647?u=2147483647:u<-2147483648&&(u=-2147483648),u=+u,Qt(u)&&(u=p?0:h.length-1),u<0&&(u=h.length+u),u>=h.length){if(p)return-1;u=h.length-1}else if(u<0)if(p)u=0;else return-1;if(typeof o=="string"&&(o=c.from(o,l)),c.isBuffer(o))return o.length===0?-1:N(h,o,u,l,p);if(typeof o=="number")return o=o&255,typeof Uint8Array.prototype.indexOf=="function"?p?Uint8Array.prototype.indexOf.call(h,o,u):Uint8Array.prototype.lastIndexOf.call(h,o,u):N(h,[o],u,l,p);throw new TypeError("val must be string, number or Buffer")}function N(h,o,u,l,p){let b=1,I=h.length,H=o.length;if(l!==void 0&&(l=String(l).toLowerCase(),l==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(h.length<2||o.length<2)return-1;b=2,I/=2,H/=2,u/=2}function pt(yt,et){return b===1?yt[et]:yt.readUInt16BE(et*b)}let lt;if(p){let yt=-1;for(lt=u;lt<I;lt++)if(pt(h,lt)===pt(o,yt===-1?0:lt-yt)){if(yt===-1&&(yt=lt),lt-yt+1===H)return yt*b}else yt!==-1&&(lt-=lt-yt),yt=-1}else for(u+H>I&&(u=I-H),lt=u;lt>=0;lt--){let yt=!0;for(let et=0;et<H;et++)if(pt(h,lt+et)!==pt(o,et)){yt=!1;break}if(yt)return lt}return-1}c.prototype.includes=function(o,u,l){return this.indexOf(o,u,l)!==-1},c.prototype.indexOf=function(o,u,l){return A(this,o,u,l,!0)},c.prototype.lastIndexOf=function(o,u,l){return A(this,o,u,l,!1)};function m(h,o,u,l){u=Number(u)||0;const p=h.length-u;l?(l=Number(l),l>p&&(l=p)):l=p;const b=o.length;l>b/2&&(l=b/2);let I;for(I=0;I<l;++I){const H=parseInt(o.substr(I*2,2),16);if(Qt(H))return I;h[u+I]=H}return I}function S(h,o,u,l){return Nt(kt(o,h.length-u),h,u,l)}function w(h,o,u,l){return Nt(Ht(o),h,u,l)}function v(h,o,u,l){return Nt($t(o),h,u,l)}function k(h,o,u,l){return Nt(Vt(o,h.length-u),h,u,l)}c.prototype.write=function(o,u,l,p){if(u===void 0)p="utf8",l=this.length,u=0;else if(l===void 0&&typeof u=="string")p=u,l=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(l)?(l=l>>>0,p===void 0&&(p="utf8")):(p=l,l=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const b=this.length-u;if((l===void 0||l>b)&&(l=b),o.length>0&&(l<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");p||(p="utf8");let I=!1;for(;;)switch(p){case"hex":return m(this,o,u,l);case"utf8":case"utf-8":return S(this,o,u,l);case"ascii":case"latin1":case"binary":return w(this,o,u,l);case"base64":return v(this,o,u,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,o,u,l);default:if(I)throw new TypeError("Unknown encoding: "+p);p=(""+p).toLowerCase(),I=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Q(h,o,u){return o===0&&u===h.length?t.fromByteArray(h):t.fromByteArray(h.slice(o,u))}function z(h,o,u){u=Math.min(h.length,u);const l=[];let p=o;for(;p<u;){const b=h[p];let I=null,H=b>239?4:b>223?3:b>191?2:1;if(p+H<=u){let pt,lt,yt,et;switch(H){case 1:b<128&&(I=b);break;case 2:pt=h[p+1],(pt&192)===128&&(et=(b&31)<<6|pt&63,et>127&&(I=et));break;case 3:pt=h[p+1],lt=h[p+2],(pt&192)===128&&(lt&192)===128&&(et=(b&15)<<12|(pt&63)<<6|lt&63,et>2047&&(et<55296||et>57343)&&(I=et));break;case 4:pt=h[p+1],lt=h[p+2],yt=h[p+3],(pt&192)===128&&(lt&192)===128&&(yt&192)===128&&(et=(b&15)<<18|(pt&63)<<12|(lt&63)<<6|yt&63,et>65535&&et<1114112&&(I=et))}}I===null?(I=65533,H=1):I>65535&&(I-=65536,l.push(I>>>10&1023|55296),I=56320|I&1023),l.push(I),p+=H}return D(l)}const R=4096;function D(h){const o=h.length;if(o<=R)return String.fromCharCode.apply(String,h);let u="",l=0;for(;l<o;)u+=String.fromCharCode.apply(String,h.slice(l,l+=R));return u}function Y(h,o,u){let l="";u=Math.min(h.length,u);for(let p=o;p<u;++p)l+=String.fromCharCode(h[p]&127);return l}function Z(h,o,u){let l="";u=Math.min(h.length,u);for(let p=o;p<u;++p)l+=String.fromCharCode(h[p]);return l}function X(h,o,u){const l=h.length;(!o||o<0)&&(o=0),(!u||u<0||u>l)&&(u=l);let p="";for(let b=o;b<u;++b)p+=sr[h[b]];return p}function K(h,o,u){const l=h.slice(o,u);let p="";for(let b=0;b<l.length-1;b+=2)p+=String.fromCharCode(l[b]+l[b+1]*256);return p}c.prototype.slice=function(o,u){const l=this.length;o=~~o,u=u===void 0?l:~~u,o<0?(o+=l,o<0&&(o=0)):o>l&&(o=l),u<0?(u+=l,u<0&&(u=0)):u>l&&(u=l),u<o&&(u=o);const p=this.subarray(o,u);return Object.setPrototypeOf(p,c.prototype),p};function q(h,o,u){if(h%1!==0||h<0)throw new RangeError("offset is not uint");if(h+o>u)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUintLE=c.prototype.readUIntLE=function(o,u,l){o=o>>>0,u=u>>>0,l||q(o,u,this.length);let p=this[o],b=1,I=0;for(;++I<u&&(b*=256);)p+=this[o+I]*b;return p},c.prototype.readUintBE=c.prototype.readUIntBE=function(o,u,l){o=o>>>0,u=u>>>0,l||q(o,u,this.length);let p=this[o+--u],b=1;for(;u>0&&(b*=256);)p+=this[o+--u]*b;return p},c.prototype.readUint8=c.prototype.readUInt8=function(o,u){return o=o>>>0,u||q(o,1,this.length),this[o]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(o,u){return o=o>>>0,u||q(o,2,this.length),this[o]|this[o+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(o,u){return o=o>>>0,u||q(o,2,this.length),this[o]<<8|this[o+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(o,u){return o=o>>>0,u||q(o,4,this.length),(this[o]|this[o+1]<<8|this[o+2]<<16)+this[o+3]*16777216},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(o,u){return o=o>>>0,u||q(o,4,this.length),this[o]*16777216+(this[o+1]<<16|this[o+2]<<8|this[o+3])},c.prototype.readBigUInt64LE=Wt(function(o){o=o>>>0,$(o,"offset");const u=this[o],l=this[o+7];(u===void 0||l===void 0)&&J(o,this.length-8);const p=u+this[++o]*2**8+this[++o]*2**16+this[++o]*2**24,b=this[++o]+this[++o]*2**8+this[++o]*2**16+l*2**24;return BigInt(p)+(BigInt(b)<<BigInt(32))}),c.prototype.readBigUInt64BE=Wt(function(o){o=o>>>0,$(o,"offset");const u=this[o],l=this[o+7];(u===void 0||l===void 0)&&J(o,this.length-8);const p=u*2**24+this[++o]*2**16+this[++o]*2**8+this[++o],b=this[++o]*2**24+this[++o]*2**16+this[++o]*2**8+l;return(BigInt(p)<<BigInt(32))+BigInt(b)}),c.prototype.readIntLE=function(o,u,l){o=o>>>0,u=u>>>0,l||q(o,u,this.length);let p=this[o],b=1,I=0;for(;++I<u&&(b*=256);)p+=this[o+I]*b;return b*=128,p>=b&&(p-=Math.pow(2,8*u)),p},c.prototype.readIntBE=function(o,u,l){o=o>>>0,u=u>>>0,l||q(o,u,this.length);let p=u,b=1,I=this[o+--p];for(;p>0&&(b*=256);)I+=this[o+--p]*b;return b*=128,I>=b&&(I-=Math.pow(2,8*u)),I},c.prototype.readInt8=function(o,u){return o=o>>>0,u||q(o,1,this.length),this[o]&128?(255-this[o]+1)*-1:this[o]},c.prototype.readInt16LE=function(o,u){o=o>>>0,u||q(o,2,this.length);const l=this[o]|this[o+1]<<8;return l&32768?l|4294901760:l},c.prototype.readInt16BE=function(o,u){o=o>>>0,u||q(o,2,this.length);const l=this[o+1]|this[o]<<8;return l&32768?l|4294901760:l},c.prototype.readInt32LE=function(o,u){return o=o>>>0,u||q(o,4,this.length),this[o]|this[o+1]<<8|this[o+2]<<16|this[o+3]<<24},c.prototype.readInt32BE=function(o,u){return o=o>>>0,u||q(o,4,this.length),this[o]<<24|this[o+1]<<16|this[o+2]<<8|this[o+3]},c.prototype.readBigInt64LE=Wt(function(o){o=o>>>0,$(o,"offset");const u=this[o],l=this[o+7];(u===void 0||l===void 0)&&J(o,this.length-8);const p=this[o+4]+this[o+5]*2**8+this[o+6]*2**16+(l<<24);return(BigInt(p)<<BigInt(32))+BigInt(u+this[++o]*2**8+this[++o]*2**16+this[++o]*2**24)}),c.prototype.readBigInt64BE=Wt(function(o){o=o>>>0,$(o,"offset");const u=this[o],l=this[o+7];(u===void 0||l===void 0)&&J(o,this.length-8);const p=(u<<24)+this[++o]*2**16+this[++o]*2**8+this[++o];return(BigInt(p)<<BigInt(32))+BigInt(this[++o]*2**24+this[++o]*2**16+this[++o]*2**8+l)}),c.prototype.readFloatLE=function(o,u){return o=o>>>0,u||q(o,4,this.length),e.read(this,o,!0,23,4)},c.prototype.readFloatBE=function(o,u){return o=o>>>0,u||q(o,4,this.length),e.read(this,o,!1,23,4)},c.prototype.readDoubleLE=function(o,u){return o=o>>>0,u||q(o,8,this.length),e.read(this,o,!0,52,8)},c.prototype.readDoubleBE=function(o,u){return o=o>>>0,u||q(o,8,this.length),e.read(this,o,!1,52,8)};function rt(h,o,u,l,p,b){if(!c.isBuffer(h))throw new TypeError('"buffer" argument must be a Buffer instance');if(o>p||o<b)throw new RangeError('"value" argument is out of bounds');if(u+l>h.length)throw new RangeError("Index out of range")}c.prototype.writeUintLE=c.prototype.writeUIntLE=function(o,u,l,p){if(o=+o,u=u>>>0,l=l>>>0,!p){const H=Math.pow(2,8*l)-1;rt(this,o,u,l,H,0)}let b=1,I=0;for(this[u]=o&255;++I<l&&(b*=256);)this[u+I]=o/b&255;return u+l},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(o,u,l,p){if(o=+o,u=u>>>0,l=l>>>0,!p){const H=Math.pow(2,8*l)-1;rt(this,o,u,l,H,0)}let b=l-1,I=1;for(this[u+b]=o&255;--b>=0&&(I*=256);)this[u+b]=o/I&255;return u+l},c.prototype.writeUint8=c.prototype.writeUInt8=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,1,255,0),this[u]=o&255,u+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,2,65535,0),this[u]=o&255,this[u+1]=o>>>8,u+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,2,65535,0),this[u]=o>>>8,this[u+1]=o&255,u+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,4,4294967295,0),this[u+3]=o>>>24,this[u+2]=o>>>16,this[u+1]=o>>>8,this[u]=o&255,u+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,4,4294967295,0),this[u]=o>>>24,this[u+1]=o>>>16,this[u+2]=o>>>8,this[u+3]=o&255,u+4};function At(h,o,u,l,p){j(o,l,p,h,u,7);let b=Number(o&BigInt(4294967295));h[u++]=b,b=b>>8,h[u++]=b,b=b>>8,h[u++]=b,b=b>>8,h[u++]=b;let I=Number(o>>BigInt(32)&BigInt(4294967295));return h[u++]=I,I=I>>8,h[u++]=I,I=I>>8,h[u++]=I,I=I>>8,h[u++]=I,u}function Ut(h,o,u,l,p){j(o,l,p,h,u,7);let b=Number(o&BigInt(4294967295));h[u+7]=b,b=b>>8,h[u+6]=b,b=b>>8,h[u+5]=b,b=b>>8,h[u+4]=b;let I=Number(o>>BigInt(32)&BigInt(4294967295));return h[u+3]=I,I=I>>8,h[u+2]=I,I=I>>8,h[u+1]=I,I=I>>8,h[u]=I,u+8}c.prototype.writeBigUInt64LE=Wt(function(o,u=0){return At(this,o,u,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Wt(function(o,u=0){return Ut(this,o,u,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(o,u,l,p){if(o=+o,u=u>>>0,!p){const pt=Math.pow(2,8*l-1);rt(this,o,u,l,pt-1,-pt)}let b=0,I=1,H=0;for(this[u]=o&255;++b<l&&(I*=256);)o<0&&H===0&&this[u+b-1]!==0&&(H=1),this[u+b]=(o/I>>0)-H&255;return u+l},c.prototype.writeIntBE=function(o,u,l,p){if(o=+o,u=u>>>0,!p){const pt=Math.pow(2,8*l-1);rt(this,o,u,l,pt-1,-pt)}let b=l-1,I=1,H=0;for(this[u+b]=o&255;--b>=0&&(I*=256);)o<0&&H===0&&this[u+b+1]!==0&&(H=1),this[u+b]=(o/I>>0)-H&255;return u+l},c.prototype.writeInt8=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,1,127,-128),o<0&&(o=255+o+1),this[u]=o&255,u+1},c.prototype.writeInt16LE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,2,32767,-32768),this[u]=o&255,this[u+1]=o>>>8,u+2},c.prototype.writeInt16BE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,2,32767,-32768),this[u]=o>>>8,this[u+1]=o&255,u+2},c.prototype.writeInt32LE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,4,2147483647,-2147483648),this[u]=o&255,this[u+1]=o>>>8,this[u+2]=o>>>16,this[u+3]=o>>>24,u+4},c.prototype.writeInt32BE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,4,2147483647,-2147483648),o<0&&(o=4294967295+o+1),this[u]=o>>>24,this[u+1]=o>>>16,this[u+2]=o>>>8,this[u+3]=o&255,u+4},c.prototype.writeBigInt64LE=Wt(function(o,u=0){return At(this,o,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Wt(function(o,u=0){return Ut(this,o,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Pt(h,o,u,l,p,b){if(u+l>h.length)throw new RangeError("Index out of range");if(u<0)throw new RangeError("Index out of range")}function Zt(h,o,u,l,p){return o=+o,u=u>>>0,p||Pt(h,o,u,4),e.write(h,o,u,l,23,4),u+4}c.prototype.writeFloatLE=function(o,u,l){return Zt(this,o,u,!0,l)},c.prototype.writeFloatBE=function(o,u,l){return Zt(this,o,u,!1,l)};function Gt(h,o,u,l,p){return o=+o,u=u>>>0,p||Pt(h,o,u,8),e.write(h,o,u,l,52,8),u+8}c.prototype.writeDoubleLE=function(o,u,l){return Gt(this,o,u,!0,l)},c.prototype.writeDoubleBE=function(o,u,l){return Gt(this,o,u,!1,l)},c.prototype.copy=function(o,u,l,p){if(!c.isBuffer(o))throw new TypeError("argument should be a Buffer");if(l||(l=0),!p&&p!==0&&(p=this.length),u>=o.length&&(u=o.length),u||(u=0),p>0&&p<l&&(p=l),p===l||o.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(l<0||l>=this.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("sourceEnd out of bounds");p>this.length&&(p=this.length),o.length-u<p-l&&(p=o.length-u+l);const b=p-l;return this===o&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,l,p):Uint8Array.prototype.set.call(o,this.subarray(l,p),u),b},c.prototype.fill=function(o,u,l,p){if(typeof o=="string"){if(typeof u=="string"?(p=u,u=0,l=this.length):typeof l=="string"&&(p=l,l=this.length),p!==void 0&&typeof p!="string")throw new TypeError("encoding must be a string");if(typeof p=="string"&&!c.isEncoding(p))throw new TypeError("Unknown encoding: "+p);if(o.length===1){const I=o.charCodeAt(0);(p==="utf8"&&I<128||p==="latin1")&&(o=I)}}else typeof o=="number"?o=o&255:typeof o=="boolean"&&(o=Number(o));if(u<0||this.length<u||this.length<l)throw new RangeError("Out of range index");if(l<=u)return this;u=u>>>0,l=l===void 0?this.length:l>>>0,o||(o=0);let b;if(typeof o=="number")for(b=u;b<l;++b)this[b]=o;else{const I=c.isBuffer(o)?o:c.from(o,p),H=I.length;if(H===0)throw new TypeError('The value "'+o+'" is invalid for argument "value"');for(b=0;b<l-u;++b)this[b+u]=I[b%H]}return this};const W={};function g(h,o,u){W[h]=class extends u{constructor(){super(),Object.defineProperty(this,"message",{value:o.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${h}]`,this.stack,delete this.name}get code(){return h}set code(p){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:p,writable:!0})}toString(){return`${this.name} [${h}]: ${this.message}`}}}g("ERR_BUFFER_OUT_OF_BOUNDS",function(h){return h?`${h} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),g("ERR_INVALID_ARG_TYPE",function(h,o){return`The "${h}" argument must be of type number. Received type ${typeof o}`},TypeError),g("ERR_OUT_OF_RANGE",function(h,o,u){let l=`The value of "${h}" is out of range.`,p=u;return Number.isInteger(u)&&Math.abs(u)>2**32?p=_(String(u)):typeof u=="bigint"&&(p=String(u),(u>BigInt(2)**BigInt(32)||u<-(BigInt(2)**BigInt(32)))&&(p=_(p)),p+="n"),l+=` It must be ${o}. Received ${p}`,l},RangeError);function _(h){let o="",u=h.length;const l=h[0]==="-"?1:0;for(;u>=l+4;u-=3)o=`_${h.slice(u-3,u)}${o}`;return`${h.slice(0,u)}${o}`}function T(h,o,u){$(o,"offset"),(h[o]===void 0||h[o+u]===void 0)&&J(o,h.length-(u+1))}function j(h,o,u,l,p,b){if(h>u||h<o){const I=typeof o=="bigint"?"n":"";let H;throw o===0||o===BigInt(0)?H=`>= 0${I} and < 2${I} ** ${(b+1)*8}${I}`:H=`>= -(2${I} ** ${(b+1)*8-1}${I}) and < 2 ** ${(b+1)*8-1}${I}`,new W.ERR_OUT_OF_RANGE("value",H,h)}T(l,p,b)}function $(h,o){if(typeof h!="number")throw new W.ERR_INVALID_ARG_TYPE(o,"number",h)}function J(h,o,u){throw Math.floor(h)!==h?($(h,u),new W.ERR_OUT_OF_RANGE("offset","an integer",h)):o<0?new W.ERR_BUFFER_OUT_OF_BOUNDS:new W.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${o}`,h)}const bt=/[^+/0-9A-Za-z-_]/g;function Ot(h){if(h=h.split("=")[0],h=h.trim().replace(bt,""),h.length<2)return"";for(;h.length%4!==0;)h=h+"=";return h}function kt(h,o){o=o||1/0;let u;const l=h.length;let p=null;const b=[];for(let I=0;I<l;++I){if(u=h.charCodeAt(I),u>55295&&u<57344){if(!p){if(u>56319){(o-=3)>-1&&b.push(239,191,189);continue}else if(I+1===l){(o-=3)>-1&&b.push(239,191,189);continue}p=u;continue}if(u<56320){(o-=3)>-1&&b.push(239,191,189),p=u;continue}u=(p-55296<<10|u-56320)+65536}else p&&(o-=3)>-1&&b.push(239,191,189);if(p=null,u<128){if((o-=1)<0)break;b.push(u)}else if(u<2048){if((o-=2)<0)break;b.push(u>>6|192,u&63|128)}else if(u<65536){if((o-=3)<0)break;b.push(u>>12|224,u>>6&63|128,u&63|128)}else if(u<1114112){if((o-=4)<0)break;b.push(u>>18|240,u>>12&63|128,u>>6&63|128,u&63|128)}else throw new Error("Invalid code point")}return b}function Ht(h){const o=[];for(let u=0;u<h.length;++u)o.push(h.charCodeAt(u)&255);return o}function Vt(h,o){let u,l,p;const b=[];for(let I=0;I<h.length&&!((o-=2)<0);++I)u=h.charCodeAt(I),l=u>>8,p=u%256,b.push(p),b.push(l);return b}function $t(h){return t.toByteArray(Ot(h))}function Nt(h,o,u,l){let p;for(p=0;p<l&&!(p+u>=o.length||p>=h.length);++p)o[p+u]=h[p];return p}function mt(h,o){return h instanceof o||h!=null&&h.constructor!=null&&h.constructor.name!=null&&h.constructor.name===o.name}function Qt(h){return h!==h}const sr=function(){const h="0123456789abcdef",o=new Array(256);for(let u=0;u<16;++u){const l=u*16;for(let p=0;p<16;++p)o[l+p]=h[u]+h[p]}return o}();function Wt(h){return typeof BigInt>"u"?Fi:h}function Fi(){throw new Error("BigInt not supported")}}(zi)),zi}var Eu=wf();function Ei(r){return new Promise((t,e)=>{r.oncomplete=r.onsuccess=()=>t(r.result),r.onabort=r.onerror=()=>e(r.error)})}function Tu(r,t){const e=indexedDB.open(r);e.onupgradeneeded=()=>e.result.createObjectStore(t);const n=Ei(e);return(s,i)=>n.then(a=>i(a.transaction(t,s).objectStore(t)))}let ji;function Zs(){return ji||(ji=Tu("keyval-store","keyval")),ji}function Vi(r,t=Zs()){return t("readonly",e=>Ei(e.get(r)))}function ea(r,t,e=Zs()){return e("readwrite",n=>(n.put(t,r),Ei(n.transaction)))}function xn(r,t=Zs()){return t("readwrite",e=>(e.delete(r),Ei(e.transaction)))}function An(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Wi={exports:{}},ra;function bf(){return ra||(ra=1,function(r,t){(function(e){r.exports=e()})(function(){return function e(n,s,i){function a(f,y){if(!s[f]){if(!n[f]){var B=typeof An=="function"&&An;if(!y&&B)return B(f,!0);if(c)return c(f,!0);throw new Error("Cannot find module '"+f+"'")}y=s[f]={exports:{}},n[f][0].call(y.exports,function(L){var x=n[f][1][L];return a(x||L)},y,y.exports,e,n,s,i)}return s[f].exports}for(var c=typeof An=="function"&&An,d=0;d<i.length;d++)a(i[d]);return a}({1:[function(e,n,s){(function(i,a,c,d,f,y,B,L,x){var M=e("crypto");function U(A,N){N=C(A,N);var m;return(m=N.algorithm!=="passthrough"?M.createHash(N.algorithm):new G).write===void 0&&(m.write=m.update,m.end=m.update),V(N,m).dispatch(A),m.update||m.end(""),m.digest?m.digest(N.encoding==="buffer"?void 0:N.encoding):(A=m.read(),N.encoding!=="buffer"?A.toString(N.encoding):A)}(s=n.exports=U).sha1=function(A){return U(A)},s.keys=function(A){return U(A,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},s.MD5=function(A){return U(A,{algorithm:"md5",encoding:"hex"})},s.keysMD5=function(A){return U(A,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var F=M.getHashes?M.getHashes().slice():["sha1","md5"],O=(F.push("passthrough"),["buffer","hex","binary","base64"]);function C(A,N){var m={};if(m.algorithm=(N=N||{}).algorithm||"sha1",m.encoding=N.encoding||"hex",m.excludeValues=!!N.excludeValues,m.algorithm=m.algorithm.toLowerCase(),m.encoding=m.encoding.toLowerCase(),m.ignoreUnknown=N.ignoreUnknown===!0,m.respectType=N.respectType!==!1,m.respectFunctionNames=N.respectFunctionNames!==!1,m.respectFunctionProperties=N.respectFunctionProperties!==!1,m.unorderedArrays=N.unorderedArrays===!0,m.unorderedSets=N.unorderedSets!==!1,m.unorderedObjects=N.unorderedObjects!==!1,m.replacer=N.replacer||void 0,m.excludeKeys=N.excludeKeys||void 0,A===void 0)throw new Error("Object argument required.");for(var S=0;S<F.length;++S)F[S].toLowerCase()===m.algorithm.toLowerCase()&&(m.algorithm=F[S]);if(F.indexOf(m.algorithm)===-1)throw new Error('Algorithm "'+m.algorithm+'" not supported. supported values: '+F.join(", "));if(O.indexOf(m.encoding)===-1&&m.algorithm!=="passthrough")throw new Error('Encoding "'+m.encoding+'" not supported. supported values: '+O.join(", "));return m}function P(A){if(typeof A=="function")return/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(A))!=null}function V(A,N,m){m=m||[];function S(w){return N.update?N.update(w,"utf8"):N.write(w,"utf8")}return{dispatch:function(w){return this["_"+((w=A.replacer?A.replacer(w):w)===null?"null":typeof w)](w)},_object:function(w){var v,k=Object.prototype.toString.call(w),Q=/\[object (.*)\]/i.exec(k);if(Q=(Q=Q?Q[1]:"unknown:["+k+"]").toLowerCase(),0<=(k=m.indexOf(w)))return this.dispatch("[CIRCULAR:"+k+"]");if(m.push(w),c!==void 0&&c.isBuffer&&c.isBuffer(w))return S("buffer:"),S(w);if(Q==="object"||Q==="function"||Q==="asyncfunction")return k=Object.keys(w),A.unorderedObjects&&(k=k.sort()),A.respectType===!1||P(w)||k.splice(0,0,"prototype","__proto__","constructor"),A.excludeKeys&&(k=k.filter(function(z){return!A.excludeKeys(z)})),S("object:"+k.length+":"),v=this,k.forEach(function(z){v.dispatch(z),S(":"),A.excludeValues||v.dispatch(w[z]),S(",")});if(!this["_"+Q]){if(A.ignoreUnknown)return S("["+Q+"]");throw new Error('Unknown object type "'+Q+'"')}this["_"+Q](w)},_array:function(w,z){z=z!==void 0?z:A.unorderedArrays!==!1;var k=this;if(S("array:"+w.length+":"),!z||w.length<=1)return w.forEach(function(R){return k.dispatch(R)});var Q=[],z=w.map(function(R){var D=new G,Y=m.slice();return V(A,D,Y).dispatch(R),Q=Q.concat(Y.slice(m.length)),D.read().toString()});return m=m.concat(Q),z.sort(),this._array(z,!1)},_date:function(w){return S("date:"+w.toJSON())},_symbol:function(w){return S("symbol:"+w.toString())},_error:function(w){return S("error:"+w.toString())},_boolean:function(w){return S("bool:"+w.toString())},_string:function(w){S("string:"+w.length+":"),S(w.toString())},_function:function(w){S("fn:"),P(w)?this.dispatch("[native]"):this.dispatch(w.toString()),A.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(w.name)),A.respectFunctionProperties&&this._object(w)},_number:function(w){return S("number:"+w.toString())},_xml:function(w){return S("xml:"+w.toString())},_null:function(){return S("Null")},_undefined:function(){return S("Undefined")},_regexp:function(w){return S("regex:"+w.toString())},_uint8array:function(w){return S("uint8array:"),this.dispatch(Array.prototype.slice.call(w))},_uint8clampedarray:function(w){return S("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(w))},_int8array:function(w){return S("int8array:"),this.dispatch(Array.prototype.slice.call(w))},_uint16array:function(w){return S("uint16array:"),this.dispatch(Array.prototype.slice.call(w))},_int16array:function(w){return S("int16array:"),this.dispatch(Array.prototype.slice.call(w))},_uint32array:function(w){return S("uint32array:"),this.dispatch(Array.prototype.slice.call(w))},_int32array:function(w){return S("int32array:"),this.dispatch(Array.prototype.slice.call(w))},_float32array:function(w){return S("float32array:"),this.dispatch(Array.prototype.slice.call(w))},_float64array:function(w){return S("float64array:"),this.dispatch(Array.prototype.slice.call(w))},_arraybuffer:function(w){return S("arraybuffer:"),this.dispatch(new Uint8Array(w))},_url:function(w){return S("url:"+w.toString())},_map:function(w){return S("map:"),w=Array.from(w),this._array(w,A.unorderedSets!==!1)},_set:function(w){return S("set:"),w=Array.from(w),this._array(w,A.unorderedSets!==!1)},_file:function(w){return S("file:"),this.dispatch([w.name,w.size,w.type,w.lastModfied])},_blob:function(){if(A.ignoreUnknown)return S("[blob]");throw Error(`Hashing Blob objects is currently not supported
|
|
4
|
+
]`}concat(...t){const e=this.schema,n=this.data.concat(t.flatMap(({data:s})=>s));return new le(e,n.map(s=>new ye(e,s)))}slice(t,e){const n=this.schema;[t,e]=Jc({length:this.numRows},t,e);const s=Xc(this.data,this._offsets,t,e);return new le(n,s.map(i=>new ye(n,i)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(e=>e.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){const e=this.data.map(n=>n.children[t]);if(e.length===0){const{type:n}=this.schema.fields[t],s=_t({type:n,length:0,nullCount:0});e.push(s._changeLengthAndBackfillNullBitmap(this.numRows))}return new Ft(e)}return null}setChild(t,e){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(s=>s.name===t),e)}setChildAt(t,e){let n=this.schema,s=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new Ft([_t({type:new Je,length:this.numRows})]));const i=n.fields.slice(),c=i[t].clone({type:e.type}),a=this.schema.fields.map((d,f)=>this.getChildAt(f));[i[t],a[t]]=[c,e],[n,s]=Ci(n,a)}return new le(n,s)}select(t){const e=this.schema.fields.reduce((n,s,i)=>n.set(s.name,i),new Map);return this.selectAt(t.map(n=>e.get(n)).filter(n=>n>-1))}selectAt(t){const e=this.schema.selectAt(t),n=this.batches.map(s=>s.selectAt(t));return new le(e,n)}assign(t){const e=this.schema.fields,[n,s]=t.schema.fields.reduce((a,d,f)=>{const[y,B]=a,L=e.findIndex(x=>x.name===d.name);return~L?B[L]=f:y.push(f),a},[[],[]]),i=this.schema.assign(t.schema),c=[...e.map((a,d)=>[d,s[d]]).map(([a,d])=>d===void 0?this.getChildAt(a):t.getChildAt(d)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new le(...Ci(i,c))}}cu=Symbol.toStringTag;le[cu]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=ai(ks),r.get=ai(ne.getVisitFn(E.Struct)),r.set=Qc(fe.getVisitFn(E.Struct)),r.indexOf=tu(ci.getVisitFn(E.Struct)),"Table"))(le.prototype);var uu;let ye=class on{constructor(...t){switch(t.length){case 2:{if([this.schema]=t,!(this.schema instanceof vt))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=_t({nullCount:0,type:new Kt(this.schema.fields),children:this.schema.fields.map(e=>_t({type:e.type,nullCount:0}))})]=t,!(this.data instanceof Et))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=To(this.schema,this.data.children);break}case 1:{const[e]=t,{fields:n,children:s,length:i}=Object.keys(e).reduce((d,f,y)=>(d.children[y]=e[f],d.length=Math.max(d.length,e[f].length),d.fields[y]=Ct.new({name:f,type:e[f].type,nullable:!0}),d),{length:0,fields:new Array,children:new Array}),c=new vt(n),a=_t({type:new Kt(n),length:i,children:s,nullCount:0});[this.schema,this.data]=To(c,a.children,i);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=hu(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 ne.visit(this.data,t)}at(t){return this.get(Ns(t,this.numRows))}set(t,e){return fe.visit(this.data,t,e)}indexOf(t,e){return ci.visit(this.data,t,e)}[Symbol.iterator](){return Ds.visit(new Ft([this.data]))}toArray(){return[...this]}concat(...t){return new le(this.schema,[this,...t])}slice(t,e){const[n]=new Ft([this.data]).slice(t,e).data;return new on(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 Ft([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(s=>s.name===t),e)}setChildAt(t,e){let n=this.schema,s=this.data;if(t>-1&&t<this.numCols){e||(e=new Ft([_t({type:new Je,length:this.numRows})]));const i=n.fields.slice(),c=s.children.slice(),a=i[t].clone({type:e.type});[i[t],c[t]]=[a,e.data[0]],n=new vt(i,new Map(this.schema.metadata)),s=_t({type:new Kt(i),children:c})}return new on(n,s)}select(t){const e=this.schema.select(t),n=new Kt(e.fields),s=[];for(const i of t){const c=this.schema.fields.findIndex(a=>a.name===i);~c&&(s[c]=this.data.children[c])}return new on(e,_t({type:n,length:this.numRows,children:s}))}selectAt(t){const e=this.schema.selectAt(t),n=t.map(i=>this.data.children[i]).filter(Boolean),s=_t({type:new Kt(e.fields),length:this.numRows,children:n});return new on(e,s)}};uu=Symbol.toStringTag;ye[uu]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(ye.prototype);function To(r,t,e=t.reduce((n,s)=>Math.max(n,s.length),0)){var n;const s=[...r.fields],i=[...t],c=(e+63&-64)>>3;for(const[a,d]of r.fields.entries()){const f=t[a];(!f||f.length!==e)&&(s[a]=d.clone({nullable:!0}),i[a]=(n=f?._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:_t({type:d.type,length:e,nullCount:e,nullBitmap:new Uint8Array(c)}))}return[r.assign(s),_t({type:new Kt(s),length:e,children:i})]}function hu(r,t,e=new Map){var n,s;if(((n=r?.length)!==null&&n!==void 0?n:0)>0&&r?.length===t?.length)for(let i=-1,c=r.length;++i<c;){const{type:a}=r[i],d=t[i];for(const f of[d,...((s=d?.dictionary)===null||s===void 0?void 0:s.data)||[]])hu(a.children,f?.children,e);if(tt.isDictionary(a)){const{id:f}=a;if(!e.has(f))d?.dictionary&&e.set(f,d.dictionary);else if(e.get(f)!==d.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return e}class lu extends ye{constructor(t){const e=t.fields.map(s=>_t({type:s.type})),n=_t({type:new Kt(t.fields),nullCount:0,children:e});super(t,n)}}let je=class _e{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 _e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+xt),(e||new _e).__init(t.readInt32(t.position())+t.position(),t)}version(){const t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):zt.V1}headerType(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Bt.NONE}header(t){const e=this.bb.__offset(this.bb_pos,8);return e?this.bb.__union(t,this.bb_pos+e):null}bodyLength(){const t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,e){const n=this.bb.__offset(this.bb_pos,12);return n?(e||new jt).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){const t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,e){t.addFieldInt16(0,e,zt.V1)}static addHeaderType(t,e){t.addFieldInt8(1,e,Bt.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,s,i,c){return _e.startMessage(t),_e.addVersion(t,e),_e.addHeaderType(t,n),_e.addHeader(t,s),_e.addBodyLength(t,i),_e.addCustomMetadata(t,c),_e.endMessage(t)}};class Ed extends St{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return wo.startNull(e),wo.endNull(e)}visitInt(t,e){return oe.startInt(e),oe.addBitWidth(e,t.bitWidth),oe.addIsSigned(e,t.isSigned),oe.endInt(e)}visitFloat(t,e){return ve.startFloatingPoint(e),ve.addPrecision(e,t.precision),ve.endFloatingPoint(e)}visitBinary(t,e){return fo.startBinary(e),fo.endBinary(e)}visitLargeBinary(t,e){return yo.startLargeBinary(e),yo.endLargeBinary(e)}visitBool(t,e){return po.startBool(e),po.endBool(e)}visitUtf8(t,e){return bo.startUtf8(e),bo.endUtf8(e)}visitLargeUtf8(t,e){return go.startLargeUtf8(e),go.endLargeUtf8(e)}visitDecimal(t,e){return ur.startDecimal(e),ur.addScale(e,t.scale),ur.addPrecision(e,t.precision),ur.addBitWidth(e,t.bitWidth),ur.endDecimal(e)}visitDate(t,e){return Nn.startDate(e),Nn.addUnit(e,t.unit),Nn.endDate(e)}visitTime(t,e){return ue.startTime(e),ue.addUnit(e,t.unit),ue.addBitWidth(e,t.bitWidth),ue.endTime(e)}visitTimestamp(t,e){const n=t.timezone&&e.createString(t.timezone)||void 0;return he.startTimestamp(e),he.addUnit(e,t.unit),n!==void 0&&he.addTimezone(e,n),he.endTimestamp(e)}visitInterval(t,e){return xe.startInterval(e),xe.addUnit(e,t.unit),xe.endInterval(e)}visitDuration(t,e){return Fn.startDuration(e),Fn.addUnit(e,t.unit),Fn.endDuration(e)}visitList(t,e){return mo.startList(e),mo.endList(e)}visitStruct(t,e){return Qe.startStruct_(e),Qe.endStruct_(e)}visitUnion(t,e){ee.startTypeIdsVector(e,t.typeIds.length);const n=ee.createTypeIdsVector(e,t.typeIds);return ee.startUnion(e),ee.addMode(e,t.mode),ee.addTypeIds(e,n),ee.endUnion(e)}visitDictionary(t,e){const n=this.visit(t.indices,e);return De.startDictionaryEncoding(e),De.addId(e,BigInt(t.id)),De.addIsOrdered(e,t.isOrdered),n!==void 0&&De.addIndexType(e,n),De.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return On.startFixedSizeBinary(e),On.addByteWidth(e,t.byteWidth),On.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return kn.startFixedSizeList(e),kn.addListSize(e,t.listSize),kn.endFixedSizeList(e)}visitMap(t,e){return Dn.startMap(e),Dn.addKeysSorted(e,t.keysSorted),Dn.endMap(e)}}const Ri=new Ed;function Td(r,t=new Map){return new vt(Nd(r,t),Ln(r.metadata),t)}function du(r){return new we(r.count,fu(r.columns),pu(r.columns))}function Md(r){return new Ce(du(r.data),r.id,r.isDelta)}function Nd(r,t){return(r.fields||[]).filter(Boolean).map(e=>Ct.fromJSON(e,t))}function Mo(r,t){return(r.children||[]).filter(Boolean).map(e=>Ct.fromJSON(e,t))}function fu(r){return(r||[]).reduce((t,e)=>[...t,new kr(e.count,Fd(e.VALIDITY)),...fu(e.children)],[])}function pu(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){const s=r[e];s.VALIDITY&&t.push(new Ue(t.length,s.VALIDITY.length)),s.TYPE_ID&&t.push(new Ue(t.length,s.TYPE_ID.length)),s.OFFSET&&t.push(new Ue(t.length,s.OFFSET.length)),s.DATA&&t.push(new Ue(t.length,s.DATA.length)),t=pu(s.children,t)}return t}function Fd(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function Od(r,t){let e,n,s,i,c,a;return!t||!(i=r.dictionary)?(c=Fo(r,Mo(r,t)),s=new Ct(r.name,c,r.nullable,Ln(r.metadata))):t.has(e=i.id)?(n=(n=i.indexType)?No(n):new fn,a=new Er(t.get(e),n,e,i.isOrdered),s=new Ct(r.name,a,r.nullable,Ln(r.metadata))):(n=(n=i.indexType)?No(n):new fn,t.set(e,c=Fo(r,Mo(r,t))),a=new Er(c,n,e,i.isOrdered),s=new Ct(r.name,a,r.nullable,Ln(r.metadata))),s||null}function Ln(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function No(r){return new er(r.isSigned,r.bitWidth)}function Fo(r,t){const e=r.type.name;switch(e){case"NONE":return new Je;case"null":return new Je;case"binary":return new Zn;case"largebinary":return new Gn;case"utf8":return new Yn;case"largeutf8":return new Jn;case"bool":return new Hn;case"list":return new ri((t||[])[0]);case"struct":return new Kt(t||[]);case"struct_":return new Kt(t||[])}switch(e){case"int":{const n=r.type;return new er(n.isSigned,n.bitWidth)}case"floatingpoint":{const n=r.type;return new Wn(Jt[n.precision])}case"decimal":{const n=r.type;return new qn(n.scale,n.precision,n.bitWidth)}case"date":{const n=r.type;return new Kn(de[n.unit])}case"time":{const n=r.type;return new Xn(at[n.unit],n.bitWidth)}case"timestamp":{const n=r.type;return new Qn(at[n.unit],n.timezone)}case"interval":{const n=r.type;return new ti(Te[n.unit])}case"duration":{const n=r.type;return new ei(at[n.unit])}case"union":{const n=r.type,[s,...i]=(n.mode+"").toLowerCase(),c=s.toUpperCase()+i.join("");return new ni(re[c],n.typeIds||[],t||[])}case"fixedsizebinary":{const n=r.type;return new ii(n.byteWidth)}case"fixedsizelist":{const n=r.type;return new si(n.listSize,(t||[])[0])}case"map":{const n=r.type;return new oi((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var kd=Ta,Dd=xr;class ge{static fromJSON(t,e){const n=new ge(0,zt.V5,e);return n._createHeader=Ud(t,e),n}static decode(t){t=new Dd(It(t));const e=je.getRootAsMessage(t),n=e.bodyLength(),s=e.version(),i=e.headerType(),c=new ge(n,s,i);return c._createHeader=Ld(e,i),c}static encode(t){const e=new kd;let n=-1;return t.isSchema()?n=vt.encode(e,t.header()):t.isRecordBatch()?n=we.encode(e,t.header()):t.isDictionaryBatch()&&(n=Ce.encode(e,t.header())),je.startMessage(e),je.addVersion(e,zt.V5),je.addHeader(e,n),je.addHeaderType(e,t.headerType),je.addBodyLength(e,BigInt(t.bodyLength)),je.finishMessageBuffer(e,je.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof vt)return new ge(0,zt.V5,Bt.Schema,t);if(t instanceof we)return new ge(e,zt.V5,Bt.RecordBatch,t);if(t instanceof Ce)return new ge(e,zt.V5,Bt.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===Bt.Schema}isRecordBatch(){return this.headerType===Bt.RecordBatch}isDictionaryBatch(){return this.headerType===Bt.DictionaryBatch}constructor(t,e,n,s){this._version=e,this._headerType=n,this.body=new Uint8Array(0),s&&(this._createHeader=()=>s),this._bodyLength=Lt(t)}}class we{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=Lt(t)}}class Ce{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=Lt(e)}}class Ue{constructor(t,e){this.offset=Lt(t),this.length=Lt(e)}}class kr{constructor(t,e){this.length=Lt(t),this.nullCount=Lt(e)}}function Ud(r,t){return()=>{switch(t){case Bt.Schema:return vt.fromJSON(r);case Bt.RecordBatch:return we.fromJSON(r);case Bt.DictionaryBatch:return Ce.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${Bt[t]}, type: ${t} }`)}}function Ld(r,t){return()=>{switch(t){case Bt.Schema:return vt.decode(r.header(new Se),new Map,r.version());case Bt.RecordBatch:return we.decode(r.header(new Ne),r.version());case Bt.DictionaryBatch:return Ce.decode(r.header(new ar),r.version())}throw new Error(`Unrecognized Message type: { name: ${Bt[t]}, type: ${t} }`)}}Ct.encode=Yd;Ct.decode=Zd;Ct.fromJSON=Od;vt.encode=Gd;vt.decode=Cd;vt.fromJSON=Td;we.encode=Jd;we.decode=Rd;we.fromJSON=du;Ce.encode=Hd;Ce.decode=Pd;Ce.fromJSON=Md;kr.encode=qd;kr.decode=zd;Ue.encode=Kd;Ue.decode=$d;function Cd(r,t=new Map,e=zt.V5){const n=Wd(r,t);return new vt(n,Cn(r),t,e)}function Rd(r,t=zt.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new we(r.length(),jd(r),Vd(r,t))}function Pd(r,t=zt.V5){return new Ce(we.decode(r.data(),t),r.id(),r.isDelta())}function $d(r){return new Ue(r.offset(),r.length())}function zd(r){return new kr(r.length(),r.nullCount())}function jd(r){const t=[];for(let e,n=-1,s=-1,i=r.nodesLength();++n<i;)(e=r.nodes(n))&&(t[++s]=kr.decode(e));return t}function Vd(r,t){const e=[];for(let n,s=-1,i=-1,c=r.buffersLength();++s<c;)(n=r.buffers(s))&&(t<zt.V4&&(n.bb_pos+=8*(s+1)),e[++i]=Ue.decode(n));return e}function Wd(r,t){const e=[];for(let n,s=-1,i=-1,c=r.fieldsLength();++s<c;)(n=r.fields(s))&&(e[++i]=Ct.decode(n,t));return e}function Oo(r,t){const e=[];for(let n,s=-1,i=-1,c=r.childrenLength();++s<c;)(n=r.children(s))&&(e[++i]=Ct.decode(n,t));return e}function Zd(r,t){let e,n,s,i,c,a;return!t||!(a=r.dictionary())?(s=Do(r,Oo(r,t)),n=new Ct(r.name(),s,r.nullable(),Cn(r))):t.has(e=Lt(a.id()))?(i=(i=a.indexType())?ko(i):new fn,c=new Er(t.get(e),i,e,a.isOrdered()),n=new Ct(r.name(),c,r.nullable(),Cn(r))):(i=(i=a.indexType())?ko(i):new fn,t.set(e,s=Do(r,Oo(r,t))),c=new Er(s,i,e,a.isOrdered()),n=new Ct(r.name(),c,r.nullable(),Cn(r))),n||null}function Cn(r){const t=new Map;if(r)for(let e,n,s=-1,i=Math.trunc(r.customMetadataLength());++s<i;)(e=r.customMetadata(s))&&(n=e.key())!=null&&t.set(n,e.value());return t}function ko(r){return new er(r.isSigned(),r.bitWidth())}function Do(r,t){const e=r.typeType();switch(e){case Dt.NONE:return new Je;case Dt.Null:return new Je;case Dt.Binary:return new Zn;case Dt.LargeBinary:return new Gn;case Dt.Utf8:return new Yn;case Dt.LargeUtf8:return new Jn;case Dt.Bool:return new Hn;case Dt.List:return new ri((t||[])[0]);case Dt.Struct_:return new Kt(t||[])}switch(e){case Dt.Int:{const n=r.type(new oe);return new er(n.isSigned(),n.bitWidth())}case Dt.FloatingPoint:{const n=r.type(new ve);return new Wn(n.precision())}case Dt.Decimal:{const n=r.type(new ur);return new qn(n.scale(),n.precision(),n.bitWidth())}case Dt.Date:{const n=r.type(new Nn);return new Kn(n.unit())}case Dt.Time:{const n=r.type(new ue);return new Xn(n.unit(),n.bitWidth())}case Dt.Timestamp:{const n=r.type(new he);return new Qn(n.unit(),n.timezone())}case Dt.Interval:{const n=r.type(new xe);return new ti(n.unit())}case Dt.Duration:{const n=r.type(new Fn);return new ei(n.unit())}case Dt.Union:{const n=r.type(new ee);return new ni(n.mode(),n.typeIdsArray()||[],t||[])}case Dt.FixedSizeBinary:{const n=r.type(new On);return new ii(n.byteWidth())}case Dt.FixedSizeList:{const n=r.type(new kn);return new si(n.listSize(),(t||[])[0])}case Dt.Map:{const n=r.type(new Dn);return new oi((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${Dt[e]}" (${e})`)}function Gd(r,t){const e=t.fields.map(i=>Ct.encode(r,i));Se.startFieldsVector(r,e.length);const n=Se.createFieldsVector(r,e),s=t.metadata&&t.metadata.size>0?Se.createCustomMetadataVector(r,[...t.metadata].map(([i,c])=>{const a=r.createString(`${i}`),d=r.createString(`${c}`);return jt.startKeyValue(r),jt.addKey(r,a),jt.addValue(r,d),jt.endKeyValue(r)})):-1;return Se.startSchema(r),Se.addFields(r,n),Se.addEndianness(r,Xd?Ar.Little:Ar.Big),s!==-1&&Se.addCustomMetadata(r,s),Se.endSchema(r)}function Yd(r,t){let e=-1,n=-1,s=-1;const i=t.type;let c=t.typeId;tt.isDictionary(i)?(c=i.dictionary.typeId,s=Ri.visit(i,r),n=Ri.visit(i.dictionary,r)):n=Ri.visit(i,r);const a=(i.children||[]).map(y=>Ct.encode(r,y)),d=ae.createChildrenVector(r,a),f=t.metadata&&t.metadata.size>0?ae.createCustomMetadataVector(r,[...t.metadata].map(([y,B])=>{const L=r.createString(`${y}`),x=r.createString(`${B}`);return jt.startKeyValue(r),jt.addKey(r,L),jt.addValue(r,x),jt.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),ae.startField(r),ae.addType(r,n),ae.addTypeType(r,c),ae.addChildren(r,d),ae.addNullable(r,!!t.nullable),e!==-1&&ae.addName(r,e),s!==-1&&ae.addDictionary(r,s),f!==-1&&ae.addCustomMetadata(r,f),ae.endField(r)}function Jd(r,t){const e=t.nodes||[],n=t.buffers||[];Ne.startNodesVector(r,e.length);for(const c of e.slice().reverse())kr.encode(r,c);const s=r.endVector();Ne.startBuffersVector(r,n.length);for(const c of n.slice().reverse())Ue.encode(r,c);const i=r.endVector();return Ne.startRecordBatch(r),Ne.addLength(r,BigInt(t.length)),Ne.addNodes(r,s),Ne.addBuffers(r,i),Ne.endRecordBatch(r)}function Hd(r,t){const e=we.encode(r,t.data);return ar.startDictionaryBatch(r),ar.addId(r,BigInt(t.id)),ar.addIsDelta(r,t.isDelta),ar.addData(r,e),ar.endDictionaryBatch(r)}function qd(r,t){return Fa.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function Kd(r,t){return Na.createBuffer(r,BigInt(t.offset),BigInt(t.length))}const Xd=(()=>{const r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})(),$s=r=>`Expected ${Bt[r]} Message in stream, but was null or length 0.`,zs=r=>`Header pointer of flatbuffer-encoded ${Bt[r]} Message is null or length 0.`,yu=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,gu=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`;class mu{constructor(t){this.source=t instanceof hi?t:new hi(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done||t.value===-1&&(t=this.readMetadataLength()).done||(t=this.readMetadata(t.value)).done?Rt: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($s(t));return e.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);const e=It(this.source.read(t));if(e.byteLength<t)throw new Error(gu(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()}readSchema(t=!1){const e=Bt.Schema,n=this.readMessage(e),s=n?.header();if(t&&!s)throw new Error(zs(e));return s}readMetadataLength(){const t=this.source.read(Ai),e=t&&new xr(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){const e=this.source.read(t);if(!e)return Rt;if(e.byteLength<t)throw new Error(yu(t,e.byteLength));return{done:!1,value:ge.decode(e)}}}class Qd{constructor(t,e){this.source=t instanceof Mr?t:Ia(t)?new li(t,e):new Mr(t)}[Symbol.asyncIterator](){return this}next(){return gt(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done||t.value===-1&&(t=yield this.readMetadataLength()).done||(t=yield this.readMetadata(t.value)).done?Rt:t})}throw(t){return gt(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return gt(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return gt(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($s(t));return e.value})}readMessageBody(t){return gt(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);const e=It(yield this.source.read(t));if(e.byteLength<t)throw new Error(gu(t,e.byteLength));return e.byteOffset%8===0&&e.byteOffset+e.byteLength<=e.buffer.byteLength?e:e.slice()})}readSchema(){return gt(this,arguments,void 0,function*(t=!1){const e=Bt.Schema,n=yield this.readMessage(e),s=n?.header();if(t&&!s)throw new Error(zs(e));return s})}readMetadataLength(){return gt(this,void 0,void 0,function*(){const t=yield this.source.read(Ai),e=t&&new xr(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return gt(this,void 0,void 0,function*(){const e=yield this.source.read(t);if(!e)return Rt;if(e.byteLength<t)throw new Error(yu(t,e.byteLength));return{done:!1,value:ge.decode(e)}})}}class tf extends mu{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Ao?t:new Ao(t)}next(){const{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:ge.fromJSON(t.schema,Bt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){const e=t.dictionaries[this._dictionaryIndex++];return this._body=e.data.columns,{done:!1,value:ge.fromJSON(e,Bt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){const e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:ge.fromJSON(e,Bt.RecordBatch)}}return this._body=[],Rt}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((s,i)=>[...s,...i.VALIDITY&&[i.VALIDITY]||[],...i.TYPE_ID&&[i.TYPE_ID]||[],...i.OFFSET&&[i.OFFSET]||[],...i.DATA&&[i.DATA]||[],...e(i.children)],[])}}readMessage(t){let e;if((e=this.next()).done)return null;if(t!=null&&e.value.headerType!==t)throw new Error($s(t));return e.value}readSchema(){const t=Bt.Schema,e=this.readMessage(t),n=e?.header();if(!e||!n)throw new Error(zs(t));return n}}const Ai=4,cs="ARROW1",di=new Uint8Array(cs.length);for(let r=0;r<cs.length;r+=1)di[r]=cs.codePointAt(r);function js(r,t=0){for(let e=-1,n=di.length;++e<n;)if(di[e]!==r[t+e])return!1;return!0}const bn=di.length,wu=bn+Ai,ef=bn*2+Ai;class Le extends su{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){const e=this._impl.open(t);return un(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 ce.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return ce.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 Le?t:Xi(t)?of(t):Ia(t)?uf(t):un(t)?gt(this,void 0,void 0,function*(){return yield Le.from(yield t)}):Ba(t)||vs(t)||xa(t)||Bs(t)?cf(new Mr(t)):af(new hi(t))}static readAll(t){return t instanceof Le?t.isSync()?Uo(t):Lo(t):Xi(t)||ArrayBuffer.isView(t)||Bi(t)||Sa(t)?Uo(t):Lo(t)}}class fi extends Le{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Ae(this,arguments,function*(){yield wt(yield*Mn(br(this[Symbol.iterator]())))})}}class pi extends Le{constructor(t){super(t),this._impl=t}readAll(){return gt(this,void 0,void 0,function*(){var t,e,n,s;const i=new Array;try{for(var c=!0,a=br(this),d;d=yield a.next(),t=d.done,!t;c=!0){s=d.value,c=!1;const f=s;i.push(f)}}catch(f){e={error:f}}finally{try{!c&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(e)throw e.error}}return i})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}}class bu extends fi{constructor(t){super(t),this._impl=t}}class rf extends pi{constructor(t){super(t),this._impl=t}}class _u{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){const n=this._loadVectors(t,e,this.schema.fields),s=_t({type:new Kt(this.schema.fields),length:t.length,children:n});return new ye(this.schema,s)}_loadDictionaryBatch(t,e){const{id:n,isDelta:s}=t,{dictionaries:i,schema:c}=this,a=i.get(n),d=c.dictionaries.get(n),f=this._loadVectors(t.data,e,[d]);return(a&&s?a.concat(new Ft(f)):new Ft(f)).memoize()}_loadVectors(t,e,n){return new au(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}}class yi extends _u{constructor(t,e){super(e),this._reader=Xi(t)?new tf(this._handle=t):new mu(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):Rt}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Rt}next(){if(this.closed)return Rt;let t;const{_reader:e}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const n=t.header(),s=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),s=e.readMessageBody(t.bodyLength),i=this._loadDictionaryBatch(n,s);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new lu(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class gi extends _u{constructor(t,e){super(e),this._reader=new Qd(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return gt(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 gt(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 gt(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):Rt})}return(t){return gt(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Rt})}next(){return gt(this,void 0,void 0,function*(){if(this.closed)return Rt;let t;const{_reader:e}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;const n=t.header(),s=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,s)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),s=yield e.readMessageBody(t.bodyLength),i=this._loadDictionaryBatch(n,s);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new lu(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return gt(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}}class Su extends yi{get footer(){return this._footer}get numDictionaries(){return this._footer?this._footer.numDictionaries:0}get numRecordBatches(){return this._footer?this._footer.numRecordBatches:0}constructor(t,e){super(t instanceof Eo?t:new Eo(t),e)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(const 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();const n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){const s=this._reader.readMessage(Bt.RecordBatch);if(s?.isRecordBatch()){const i=s.header(),c=this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(i,c)}}return null}_readDictionaryBatch(t){var e;const n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){const s=this._reader.readMessage(Bt.DictionaryBatch);if(s?.isDictionaryBatch()){const i=s.header(),c=this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(i,c);this.dictionaries.set(i.id,a)}}}_readFooter(){const{_handle:t}=this,e=t.size-wu,n=t.readInt32(e),s=t.readAt(e-n,n);return Us.decode(s)}_readNextMessageAndValidate(t){var e;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){const 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}}class nf extends gi{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){const n=typeof e[0]!="number"?e.shift():void 0,s=e[0]instanceof Map?e.shift():void 0;super(t instanceof li?t:new li(t,n),s)}isFile(){return!0}isAsync(){return!0}open(t){const e=Object.create(null,{open:{get:()=>super.open}});return gt(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(const n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield e.open.call(this,t)})}readRecordBatch(t){return gt(this,void 0,void 0,function*(){var e;if(this.closed)return null;this._footer||(yield this.open());const n=(e=this._footer)===null||e===void 0?void 0:e.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){const s=yield this._reader.readMessage(Bt.RecordBatch);if(s?.isRecordBatch()){const i=s.header(),c=yield this._reader.readMessageBody(s.bodyLength);return this._loadRecordBatch(i,c)}}return null})}_readDictionaryBatch(t){return gt(this,void 0,void 0,function*(){var e;const n=(e=this._footer)===null||e===void 0?void 0:e.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){const s=yield this._reader.readMessage(Bt.DictionaryBatch);if(s?.isDictionaryBatch()){const i=s.header(),c=yield this._reader.readMessageBody(s.bodyLength),a=this._loadDictionaryBatch(i,c);this.dictionaries.set(i.id,a)}}})}_readFooter(){return gt(this,void 0,void 0,function*(){const{_handle:t}=this;t._pending&&(yield t._pending);const e=t.size-wu,n=yield t.readInt32(e),s=yield t.readAt(e-n,n);return Us.decode(s)})}_readNextMessageAndValidate(t){return gt(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){const e=this._footer.getRecordBatch(this._recordBatchIndex);if(e&&(yield this._handle.seek(e.offset)))return yield this._reader.readMessage(t)}return null})}}class sf extends yi{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new gd(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*Uo(r){const t=Le.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function Lo(r){return Ae(this,arguments,function*(){const e=yield wt(Le.from(r));try{if(!(yield wt(e.open({autoDestroy:!1}))).closed)do yield yield wt(e);while(!(yield wt(e.reset().open())).closed)}finally{yield wt(e.cancel())}})}function of(r){return new fi(new sf(r))}function af(r){const t=r.peek(bn+7&-8);return t&&t.byteLength>=4?js(t)?new bu(new Su(r.read())):new fi(new yi(r)):new fi(new yi(function*(){}()))}function cf(r){return gt(this,void 0,void 0,function*(){const t=yield r.peek(bn+7&-8);return t&&t.byteLength>=4?js(t)?new bu(new Su(yield r.read())):new pi(new gi(r)):new pi(new gi(function(){return Ae(this,arguments,function*(){})}()))})}function uf(r){return gt(this,void 0,void 0,function*(){const{size:t}=yield r.stat(),e=new li(r,t);return t>=ef&&js(yield e.readAt(0,bn+7&-8))?new rf(new nf(e)):new pi(new gi(e))})}function Bu(r){const t=Le.from(r);return un(t)?t.then(e=>Bu(e)):t.isAsync()?t.readAll().then(e=>new le(e)):new le(t.readAll())}function Vs(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Pi={},Ur={},$i={},Lr={},Co;function vu(){if(Co)return Lr;Co=1,Lr.byteLength=a,Lr.toByteArray=f,Lr.fromByteArray=L;for(var r=[],t=[],e=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,i=n.length;s<i;++s)r[s]=n[s],t[n.charCodeAt(s)]=s;t[45]=62,t[95]=63;function c(x){var M=x.length;if(M%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var U=x.indexOf("=");U===-1&&(U=M);var F=U===M?0:4-U%4;return[U,F]}function a(x){var M=c(x),U=M[0],F=M[1];return(U+F)*3/4-F}function d(x,M,U){return(M+U)*3/4-U}function f(x){var M,U=c(x),F=U[0],O=U[1],C=new e(d(x,F,O)),P=0,V=O>0?F-4:F,G;for(G=0;G<V;G+=4)M=t[x.charCodeAt(G)]<<18|t[x.charCodeAt(G+1)]<<12|t[x.charCodeAt(G+2)]<<6|t[x.charCodeAt(G+3)],C[P++]=M>>16&255,C[P++]=M>>8&255,C[P++]=M&255;return O===2&&(M=t[x.charCodeAt(G)]<<2|t[x.charCodeAt(G+1)]>>4,C[P++]=M&255),O===1&&(M=t[x.charCodeAt(G)]<<10|t[x.charCodeAt(G+1)]<<4|t[x.charCodeAt(G+2)]>>2,C[P++]=M>>8&255,C[P++]=M&255),C}function y(x){return r[x>>18&63]+r[x>>12&63]+r[x>>6&63]+r[x&63]}function B(x,M,U){for(var F,O=[],C=M;C<U;C+=3)F=(x[C]<<16&16711680)+(x[C+1]<<8&65280)+(x[C+2]&255),O.push(y(F));return O.join("")}function L(x){for(var M,U=x.length,F=U%3,O=[],C=16383,P=0,V=U-F;P<V;P+=C)O.push(B(x,P,P+C>V?V:P+C));return F===1?(M=x[U-1],O.push(r[M>>2]+r[M<<4&63]+"==")):F===2&&(M=(x[U-2]<<8)+x[U-1],O.push(r[M>>10]+r[M>>4&63]+r[M<<2&63]+"=")),O.join("")}return Lr}var vn={};var Ro;function xu(){return Ro||(Ro=1,vn.read=function(r,t,e,n,s){var i,c,a=s*8-n-1,d=(1<<a)-1,f=d>>1,y=-7,B=e?s-1:0,L=e?-1:1,x=r[t+B];for(B+=L,i=x&(1<<-y)-1,x>>=-y,y+=a;y>0;i=i*256+r[t+B],B+=L,y-=8);for(c=i&(1<<-y)-1,i>>=-y,y+=n;y>0;c=c*256+r[t+B],B+=L,y-=8);if(i===0)i=1-f;else{if(i===d)return c?NaN:(x?-1:1)*(1/0);c=c+Math.pow(2,n),i=i-f}return(x?-1:1)*c*Math.pow(2,i-n)},vn.write=function(r,t,e,n,s,i){var c,a,d,f=i*8-s-1,y=(1<<f)-1,B=y>>1,L=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,x=n?0:i-1,M=n?1:-1,U=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,c=y):(c=Math.floor(Math.log(t)/Math.LN2),t*(d=Math.pow(2,-c))<1&&(c--,d*=2),c+B>=1?t+=L/d:t+=L*Math.pow(2,1-B),t*d>=2&&(c++,d/=2),c+B>=y?(a=0,c=y):c+B>=1?(a=(t*d-1)*Math.pow(2,s),c=c+B):(a=t*Math.pow(2,B-1)*Math.pow(2,s),c=0));s>=8;r[e+x]=a&255,x+=M,a/=256,s-=8);for(c=c<<s|a,f+=s;f>0;r[e+x]=c&255,x+=M,c/=256,f-=8);r[e+x-M]|=U*128}),vn}var Po;function Ws(){return Po||(Po=1,function(r){const t=vu(),e=xu(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=a,r.SlowBuffer=C,r.INSPECT_MAX_BYTES=50;const s=2147483647;r.kMaxLength=s,a.TYPED_ARRAY_SUPPORT=i(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{const h=new Uint8Array(1),o={foo:function(){return 42}};return Object.setPrototypeOf(o,Uint8Array.prototype),Object.setPrototypeOf(h,o),h.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function c(h){if(h>s)throw new RangeError('The value "'+h+'" is invalid for option "size"');const o=new Uint8Array(h);return Object.setPrototypeOf(o,a.prototype),o}function a(h,o,u){if(typeof h=="number"){if(typeof o=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return B(h)}return d(h,o,u)}a.poolSize=8192;function d(h,o,u){if(typeof h=="string")return L(h,o);if(ArrayBuffer.isView(h))return M(h);if(h==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof h);if(mt(h,ArrayBuffer)||h&&mt(h.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(mt(h,SharedArrayBuffer)||h&&mt(h.buffer,SharedArrayBuffer)))return U(h,o,u);if(typeof h=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const l=h.valueOf&&h.valueOf();if(l!=null&&l!==h)return a.from(l,o,u);const p=F(h);if(p)return p;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof h[Symbol.toPrimitive]=="function")return a.from(h[Symbol.toPrimitive]("string"),o,u);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof h)}a.from=function(h,o,u){return d(h,o,u)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function f(h){if(typeof h!="number")throw new TypeError('"size" argument must be of type number');if(h<0)throw new RangeError('The value "'+h+'" is invalid for option "size"')}function y(h,o,u){return f(h),h<=0?c(h):o!==void 0?typeof u=="string"?c(h).fill(o,u):c(h).fill(o):c(h)}a.alloc=function(h,o,u){return y(h,o,u)};function B(h){return f(h),c(h<0?0:O(h)|0)}a.allocUnsafe=function(h){return B(h)},a.allocUnsafeSlow=function(h){return B(h)};function L(h,o){if((typeof o!="string"||o==="")&&(o="utf8"),!a.isEncoding(o))throw new TypeError("Unknown encoding: "+o);const u=P(h,o)|0;let l=c(u);const p=l.write(h,o);return p!==u&&(l=l.slice(0,p)),l}function x(h){const o=h.length<0?0:O(h.length)|0,u=c(o);for(let l=0;l<o;l+=1)u[l]=h[l]&255;return u}function M(h){if(mt(h,Uint8Array)){const o=new Uint8Array(h);return U(o.buffer,o.byteOffset,o.byteLength)}return x(h)}function U(h,o,u){if(o<0||h.byteLength<o)throw new RangeError('"offset" is outside of buffer bounds');if(h.byteLength<o+(u||0))throw new RangeError('"length" is outside of buffer bounds');let l;return o===void 0&&u===void 0?l=new Uint8Array(h):u===void 0?l=new Uint8Array(h,o):l=new Uint8Array(h,o,u),Object.setPrototypeOf(l,a.prototype),l}function F(h){if(a.isBuffer(h)){const o=O(h.length)|0,u=c(o);return u.length===0||h.copy(u,0,0,o),u}if(h.length!==void 0)return typeof h.length!="number"||Qt(h.length)?c(0):x(h);if(h.type==="Buffer"&&Array.isArray(h.data))return x(h.data)}function O(h){if(h>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return h|0}function C(h){return+h!=h&&(h=0),a.alloc(+h)}a.isBuffer=function(o){return o!=null&&o._isBuffer===!0&&o!==a.prototype},a.compare=function(o,u){if(mt(o,Uint8Array)&&(o=a.from(o,o.offset,o.byteLength)),mt(u,Uint8Array)&&(u=a.from(u,u.offset,u.byteLength)),!a.isBuffer(o)||!a.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(o===u)return 0;let l=o.length,p=u.length;for(let b=0,I=Math.min(l,p);b<I;++b)if(o[b]!==u[b]){l=o[b],p=u[b];break}return l<p?-1:p<l?1:0},a.isEncoding=function(o){switch(String(o).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(o,u){if(!Array.isArray(o))throw new TypeError('"list" argument must be an Array of Buffers');if(o.length===0)return a.alloc(0);let l;if(u===void 0)for(u=0,l=0;l<o.length;++l)u+=o[l].length;const p=a.allocUnsafe(u);let b=0;for(l=0;l<o.length;++l){let I=o[l];if(mt(I,Uint8Array))b+I.length>p.length?(a.isBuffer(I)||(I=a.from(I)),I.copy(p,b)):Uint8Array.prototype.set.call(p,I,b);else if(a.isBuffer(I))I.copy(p,b);else throw new TypeError('"list" argument must be an Array of Buffers');b+=I.length}return p};function P(h,o){if(a.isBuffer(h))return h.length;if(ArrayBuffer.isView(h)||mt(h,ArrayBuffer))return h.byteLength;if(typeof h!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof h);const u=h.length,l=arguments.length>2&&arguments[2]===!0;if(!l&&u===0)return 0;let p=!1;for(;;)switch(o){case"ascii":case"latin1":case"binary":return u;case"utf8":case"utf-8":return kt(h).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u*2;case"hex":return u>>>1;case"base64":return $t(h).length;default:if(p)return l?-1:kt(h).length;o=(""+o).toLowerCase(),p=!0}}a.byteLength=P;function V(h,o,u){let l=!1;if((o===void 0||o<0)&&(o=0),o>this.length||((u===void 0||u>this.length)&&(u=this.length),u<=0)||(u>>>=0,o>>>=0,u<=o))return"";for(h||(h="utf8");;)switch(h){case"hex":return X(this,o,u);case"utf8":case"utf-8":return z(this,o,u);case"ascii":return Y(this,o,u);case"latin1":case"binary":return Z(this,o,u);case"base64":return Q(this,o,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K(this,o,u);default:if(l)throw new TypeError("Unknown encoding: "+h);h=(h+"").toLowerCase(),l=!0}}a.prototype._isBuffer=!0;function G(h,o,u){const l=h[o];h[o]=h[u],h[u]=l}a.prototype.swap16=function(){const o=this.length;if(o%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let u=0;u<o;u+=2)G(this,u,u+1);return this},a.prototype.swap32=function(){const o=this.length;if(o%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let u=0;u<o;u+=4)G(this,u,u+3),G(this,u+1,u+2);return this},a.prototype.swap64=function(){const o=this.length;if(o%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let u=0;u<o;u+=8)G(this,u,u+7),G(this,u+1,u+6),G(this,u+2,u+5),G(this,u+3,u+4);return this},a.prototype.toString=function(){const o=this.length;return o===0?"":arguments.length===0?z(this,0,o):V.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(o){if(!a.isBuffer(o))throw new TypeError("Argument must be a Buffer");return this===o?!0:a.compare(this,o)===0},a.prototype.inspect=function(){let o="";const u=r.INSPECT_MAX_BYTES;return o=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(o+=" ... "),"<Buffer "+o+">"},n&&(a.prototype[n]=a.prototype.inspect),a.prototype.compare=function(o,u,l,p,b){if(mt(o,Uint8Array)&&(o=a.from(o,o.offset,o.byteLength)),!a.isBuffer(o))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof o);if(u===void 0&&(u=0),l===void 0&&(l=o?o.length:0),p===void 0&&(p=0),b===void 0&&(b=this.length),u<0||l>o.length||p<0||b>this.length)throw new RangeError("out of range index");if(p>=b&&u>=l)return 0;if(p>=b)return-1;if(u>=l)return 1;if(u>>>=0,l>>>=0,p>>>=0,b>>>=0,this===o)return 0;let I=b-p,H=l-u;const pt=Math.min(I,H),lt=this.slice(p,b),yt=o.slice(u,l);for(let et=0;et<pt;++et)if(lt[et]!==yt[et]){I=lt[et],H=yt[et];break}return I<H?-1:H<I?1:0};function A(h,o,u,l,p){if(h.length===0)return-1;if(typeof u=="string"?(l=u,u=0):u>2147483647?u=2147483647:u<-2147483648&&(u=-2147483648),u=+u,Qt(u)&&(u=p?0:h.length-1),u<0&&(u=h.length+u),u>=h.length){if(p)return-1;u=h.length-1}else if(u<0)if(p)u=0;else return-1;if(typeof o=="string"&&(o=a.from(o,l)),a.isBuffer(o))return o.length===0?-1:N(h,o,u,l,p);if(typeof o=="number")return o=o&255,typeof Uint8Array.prototype.indexOf=="function"?p?Uint8Array.prototype.indexOf.call(h,o,u):Uint8Array.prototype.lastIndexOf.call(h,o,u):N(h,[o],u,l,p);throw new TypeError("val must be string, number or Buffer")}function N(h,o,u,l,p){let b=1,I=h.length,H=o.length;if(l!==void 0&&(l=String(l).toLowerCase(),l==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(h.length<2||o.length<2)return-1;b=2,I/=2,H/=2,u/=2}function pt(yt,et){return b===1?yt[et]:yt.readUInt16BE(et*b)}let lt;if(p){let yt=-1;for(lt=u;lt<I;lt++)if(pt(h,lt)===pt(o,yt===-1?0:lt-yt)){if(yt===-1&&(yt=lt),lt-yt+1===H)return yt*b}else yt!==-1&&(lt-=lt-yt),yt=-1}else for(u+H>I&&(u=I-H),lt=u;lt>=0;lt--){let yt=!0;for(let et=0;et<H;et++)if(pt(h,lt+et)!==pt(o,et)){yt=!1;break}if(yt)return lt}return-1}a.prototype.includes=function(o,u,l){return this.indexOf(o,u,l)!==-1},a.prototype.indexOf=function(o,u,l){return A(this,o,u,l,!0)},a.prototype.lastIndexOf=function(o,u,l){return A(this,o,u,l,!1)};function m(h,o,u,l){u=Number(u)||0;const p=h.length-u;l?(l=Number(l),l>p&&(l=p)):l=p;const b=o.length;l>b/2&&(l=b/2);let I;for(I=0;I<l;++I){const H=parseInt(o.substr(I*2,2),16);if(Qt(H))return I;h[u+I]=H}return I}function S(h,o,u,l){return Nt(kt(o,h.length-u),h,u,l)}function w(h,o,u,l){return Nt(Ht(o),h,u,l)}function v(h,o,u,l){return Nt($t(o),h,u,l)}function k(h,o,u,l){return Nt(Vt(o,h.length-u),h,u,l)}a.prototype.write=function(o,u,l,p){if(u===void 0)p="utf8",l=this.length,u=0;else if(l===void 0&&typeof u=="string")p=u,l=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(l)?(l=l>>>0,p===void 0&&(p="utf8")):(p=l,l=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const b=this.length-u;if((l===void 0||l>b)&&(l=b),o.length>0&&(l<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");p||(p="utf8");let I=!1;for(;;)switch(p){case"hex":return m(this,o,u,l);case"utf8":case"utf-8":return S(this,o,u,l);case"ascii":case"latin1":case"binary":return w(this,o,u,l);case"base64":return v(this,o,u,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,o,u,l);default:if(I)throw new TypeError("Unknown encoding: "+p);p=(""+p).toLowerCase(),I=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Q(h,o,u){return o===0&&u===h.length?t.fromByteArray(h):t.fromByteArray(h.slice(o,u))}function z(h,o,u){u=Math.min(h.length,u);const l=[];let p=o;for(;p<u;){const b=h[p];let I=null,H=b>239?4:b>223?3:b>191?2:1;if(p+H<=u){let pt,lt,yt,et;switch(H){case 1:b<128&&(I=b);break;case 2:pt=h[p+1],(pt&192)===128&&(et=(b&31)<<6|pt&63,et>127&&(I=et));break;case 3:pt=h[p+1],lt=h[p+2],(pt&192)===128&&(lt&192)===128&&(et=(b&15)<<12|(pt&63)<<6|lt&63,et>2047&&(et<55296||et>57343)&&(I=et));break;case 4:pt=h[p+1],lt=h[p+2],yt=h[p+3],(pt&192)===128&&(lt&192)===128&&(yt&192)===128&&(et=(b&15)<<18|(pt&63)<<12|(lt&63)<<6|yt&63,et>65535&&et<1114112&&(I=et))}}I===null?(I=65533,H=1):I>65535&&(I-=65536,l.push(I>>>10&1023|55296),I=56320|I&1023),l.push(I),p+=H}return D(l)}const R=4096;function D(h){const o=h.length;if(o<=R)return String.fromCharCode.apply(String,h);let u="",l=0;for(;l<o;)u+=String.fromCharCode.apply(String,h.slice(l,l+=R));return u}function Y(h,o,u){let l="";u=Math.min(h.length,u);for(let p=o;p<u;++p)l+=String.fromCharCode(h[p]&127);return l}function Z(h,o,u){let l="";u=Math.min(h.length,u);for(let p=o;p<u;++p)l+=String.fromCharCode(h[p]);return l}function X(h,o,u){const l=h.length;(!o||o<0)&&(o=0),(!u||u<0||u>l)&&(u=l);let p="";for(let b=o;b<u;++b)p+=sr[h[b]];return p}function K(h,o,u){const l=h.slice(o,u);let p="";for(let b=0;b<l.length-1;b+=2)p+=String.fromCharCode(l[b]+l[b+1]*256);return p}a.prototype.slice=function(o,u){const l=this.length;o=~~o,u=u===void 0?l:~~u,o<0?(o+=l,o<0&&(o=0)):o>l&&(o=l),u<0?(u+=l,u<0&&(u=0)):u>l&&(u=l),u<o&&(u=o);const p=this.subarray(o,u);return Object.setPrototypeOf(p,a.prototype),p};function q(h,o,u){if(h%1!==0||h<0)throw new RangeError("offset is not uint");if(h+o>u)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(o,u,l){o=o>>>0,u=u>>>0,l||q(o,u,this.length);let p=this[o],b=1,I=0;for(;++I<u&&(b*=256);)p+=this[o+I]*b;return p},a.prototype.readUintBE=a.prototype.readUIntBE=function(o,u,l){o=o>>>0,u=u>>>0,l||q(o,u,this.length);let p=this[o+--u],b=1;for(;u>0&&(b*=256);)p+=this[o+--u]*b;return p},a.prototype.readUint8=a.prototype.readUInt8=function(o,u){return o=o>>>0,u||q(o,1,this.length),this[o]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(o,u){return o=o>>>0,u||q(o,2,this.length),this[o]|this[o+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(o,u){return o=o>>>0,u||q(o,2,this.length),this[o]<<8|this[o+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(o,u){return o=o>>>0,u||q(o,4,this.length),(this[o]|this[o+1]<<8|this[o+2]<<16)+this[o+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(o,u){return o=o>>>0,u||q(o,4,this.length),this[o]*16777216+(this[o+1]<<16|this[o+2]<<8|this[o+3])},a.prototype.readBigUInt64LE=Wt(function(o){o=o>>>0,$(o,"offset");const u=this[o],l=this[o+7];(u===void 0||l===void 0)&&J(o,this.length-8);const p=u+this[++o]*2**8+this[++o]*2**16+this[++o]*2**24,b=this[++o]+this[++o]*2**8+this[++o]*2**16+l*2**24;return BigInt(p)+(BigInt(b)<<BigInt(32))}),a.prototype.readBigUInt64BE=Wt(function(o){o=o>>>0,$(o,"offset");const u=this[o],l=this[o+7];(u===void 0||l===void 0)&&J(o,this.length-8);const p=u*2**24+this[++o]*2**16+this[++o]*2**8+this[++o],b=this[++o]*2**24+this[++o]*2**16+this[++o]*2**8+l;return(BigInt(p)<<BigInt(32))+BigInt(b)}),a.prototype.readIntLE=function(o,u,l){o=o>>>0,u=u>>>0,l||q(o,u,this.length);let p=this[o],b=1,I=0;for(;++I<u&&(b*=256);)p+=this[o+I]*b;return b*=128,p>=b&&(p-=Math.pow(2,8*u)),p},a.prototype.readIntBE=function(o,u,l){o=o>>>0,u=u>>>0,l||q(o,u,this.length);let p=u,b=1,I=this[o+--p];for(;p>0&&(b*=256);)I+=this[o+--p]*b;return b*=128,I>=b&&(I-=Math.pow(2,8*u)),I},a.prototype.readInt8=function(o,u){return o=o>>>0,u||q(o,1,this.length),this[o]&128?(255-this[o]+1)*-1:this[o]},a.prototype.readInt16LE=function(o,u){o=o>>>0,u||q(o,2,this.length);const l=this[o]|this[o+1]<<8;return l&32768?l|4294901760:l},a.prototype.readInt16BE=function(o,u){o=o>>>0,u||q(o,2,this.length);const l=this[o+1]|this[o]<<8;return l&32768?l|4294901760:l},a.prototype.readInt32LE=function(o,u){return o=o>>>0,u||q(o,4,this.length),this[o]|this[o+1]<<8|this[o+2]<<16|this[o+3]<<24},a.prototype.readInt32BE=function(o,u){return o=o>>>0,u||q(o,4,this.length),this[o]<<24|this[o+1]<<16|this[o+2]<<8|this[o+3]},a.prototype.readBigInt64LE=Wt(function(o){o=o>>>0,$(o,"offset");const u=this[o],l=this[o+7];(u===void 0||l===void 0)&&J(o,this.length-8);const p=this[o+4]+this[o+5]*2**8+this[o+6]*2**16+(l<<24);return(BigInt(p)<<BigInt(32))+BigInt(u+this[++o]*2**8+this[++o]*2**16+this[++o]*2**24)}),a.prototype.readBigInt64BE=Wt(function(o){o=o>>>0,$(o,"offset");const u=this[o],l=this[o+7];(u===void 0||l===void 0)&&J(o,this.length-8);const p=(u<<24)+this[++o]*2**16+this[++o]*2**8+this[++o];return(BigInt(p)<<BigInt(32))+BigInt(this[++o]*2**24+this[++o]*2**16+this[++o]*2**8+l)}),a.prototype.readFloatLE=function(o,u){return o=o>>>0,u||q(o,4,this.length),e.read(this,o,!0,23,4)},a.prototype.readFloatBE=function(o,u){return o=o>>>0,u||q(o,4,this.length),e.read(this,o,!1,23,4)},a.prototype.readDoubleLE=function(o,u){return o=o>>>0,u||q(o,8,this.length),e.read(this,o,!0,52,8)},a.prototype.readDoubleBE=function(o,u){return o=o>>>0,u||q(o,8,this.length),e.read(this,o,!1,52,8)};function rt(h,o,u,l,p,b){if(!a.isBuffer(h))throw new TypeError('"buffer" argument must be a Buffer instance');if(o>p||o<b)throw new RangeError('"value" argument is out of bounds');if(u+l>h.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(o,u,l,p){if(o=+o,u=u>>>0,l=l>>>0,!p){const H=Math.pow(2,8*l)-1;rt(this,o,u,l,H,0)}let b=1,I=0;for(this[u]=o&255;++I<l&&(b*=256);)this[u+I]=o/b&255;return u+l},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(o,u,l,p){if(o=+o,u=u>>>0,l=l>>>0,!p){const H=Math.pow(2,8*l)-1;rt(this,o,u,l,H,0)}let b=l-1,I=1;for(this[u+b]=o&255;--b>=0&&(I*=256);)this[u+b]=o/I&255;return u+l},a.prototype.writeUint8=a.prototype.writeUInt8=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,1,255,0),this[u]=o&255,u+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,2,65535,0),this[u]=o&255,this[u+1]=o>>>8,u+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,2,65535,0),this[u]=o>>>8,this[u+1]=o&255,u+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,4,4294967295,0),this[u+3]=o>>>24,this[u+2]=o>>>16,this[u+1]=o>>>8,this[u]=o&255,u+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,4,4294967295,0),this[u]=o>>>24,this[u+1]=o>>>16,this[u+2]=o>>>8,this[u+3]=o&255,u+4};function At(h,o,u,l,p){j(o,l,p,h,u,7);let b=Number(o&BigInt(4294967295));h[u++]=b,b=b>>8,h[u++]=b,b=b>>8,h[u++]=b,b=b>>8,h[u++]=b;let I=Number(o>>BigInt(32)&BigInt(4294967295));return h[u++]=I,I=I>>8,h[u++]=I,I=I>>8,h[u++]=I,I=I>>8,h[u++]=I,u}function Ut(h,o,u,l,p){j(o,l,p,h,u,7);let b=Number(o&BigInt(4294967295));h[u+7]=b,b=b>>8,h[u+6]=b,b=b>>8,h[u+5]=b,b=b>>8,h[u+4]=b;let I=Number(o>>BigInt(32)&BigInt(4294967295));return h[u+3]=I,I=I>>8,h[u+2]=I,I=I>>8,h[u+1]=I,I=I>>8,h[u]=I,u+8}a.prototype.writeBigUInt64LE=Wt(function(o,u=0){return At(this,o,u,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=Wt(function(o,u=0){return Ut(this,o,u,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(o,u,l,p){if(o=+o,u=u>>>0,!p){const pt=Math.pow(2,8*l-1);rt(this,o,u,l,pt-1,-pt)}let b=0,I=1,H=0;for(this[u]=o&255;++b<l&&(I*=256);)o<0&&H===0&&this[u+b-1]!==0&&(H=1),this[u+b]=(o/I>>0)-H&255;return u+l},a.prototype.writeIntBE=function(o,u,l,p){if(o=+o,u=u>>>0,!p){const pt=Math.pow(2,8*l-1);rt(this,o,u,l,pt-1,-pt)}let b=l-1,I=1,H=0;for(this[u+b]=o&255;--b>=0&&(I*=256);)o<0&&H===0&&this[u+b+1]!==0&&(H=1),this[u+b]=(o/I>>0)-H&255;return u+l},a.prototype.writeInt8=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,1,127,-128),o<0&&(o=255+o+1),this[u]=o&255,u+1},a.prototype.writeInt16LE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,2,32767,-32768),this[u]=o&255,this[u+1]=o>>>8,u+2},a.prototype.writeInt16BE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,2,32767,-32768),this[u]=o>>>8,this[u+1]=o&255,u+2},a.prototype.writeInt32LE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,4,2147483647,-2147483648),this[u]=o&255,this[u+1]=o>>>8,this[u+2]=o>>>16,this[u+3]=o>>>24,u+4},a.prototype.writeInt32BE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,4,2147483647,-2147483648),o<0&&(o=4294967295+o+1),this[u]=o>>>24,this[u+1]=o>>>16,this[u+2]=o>>>8,this[u+3]=o&255,u+4},a.prototype.writeBigInt64LE=Wt(function(o,u=0){return At(this,o,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=Wt(function(o,u=0){return Ut(this,o,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Pt(h,o,u,l,p,b){if(u+l>h.length)throw new RangeError("Index out of range");if(u<0)throw new RangeError("Index out of range")}function Zt(h,o,u,l,p){return o=+o,u=u>>>0,p||Pt(h,o,u,4),e.write(h,o,u,l,23,4),u+4}a.prototype.writeFloatLE=function(o,u,l){return Zt(this,o,u,!0,l)},a.prototype.writeFloatBE=function(o,u,l){return Zt(this,o,u,!1,l)};function Gt(h,o,u,l,p){return o=+o,u=u>>>0,p||Pt(h,o,u,8),e.write(h,o,u,l,52,8),u+8}a.prototype.writeDoubleLE=function(o,u,l){return Gt(this,o,u,!0,l)},a.prototype.writeDoubleBE=function(o,u,l){return Gt(this,o,u,!1,l)},a.prototype.copy=function(o,u,l,p){if(!a.isBuffer(o))throw new TypeError("argument should be a Buffer");if(l||(l=0),!p&&p!==0&&(p=this.length),u>=o.length&&(u=o.length),u||(u=0),p>0&&p<l&&(p=l),p===l||o.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(l<0||l>=this.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("sourceEnd out of bounds");p>this.length&&(p=this.length),o.length-u<p-l&&(p=o.length-u+l);const b=p-l;return this===o&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,l,p):Uint8Array.prototype.set.call(o,this.subarray(l,p),u),b},a.prototype.fill=function(o,u,l,p){if(typeof o=="string"){if(typeof u=="string"?(p=u,u=0,l=this.length):typeof l=="string"&&(p=l,l=this.length),p!==void 0&&typeof p!="string")throw new TypeError("encoding must be a string");if(typeof p=="string"&&!a.isEncoding(p))throw new TypeError("Unknown encoding: "+p);if(o.length===1){const I=o.charCodeAt(0);(p==="utf8"&&I<128||p==="latin1")&&(o=I)}}else typeof o=="number"?o=o&255:typeof o=="boolean"&&(o=Number(o));if(u<0||this.length<u||this.length<l)throw new RangeError("Out of range index");if(l<=u)return this;u=u>>>0,l=l===void 0?this.length:l>>>0,o||(o=0);let b;if(typeof o=="number")for(b=u;b<l;++b)this[b]=o;else{const I=a.isBuffer(o)?o:a.from(o,p),H=I.length;if(H===0)throw new TypeError('The value "'+o+'" is invalid for argument "value"');for(b=0;b<l-u;++b)this[b+u]=I[b%H]}return this};const W={};function g(h,o,u){W[h]=class extends u{constructor(){super(),Object.defineProperty(this,"message",{value:o.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${h}]`,this.stack,delete this.name}get code(){return h}set code(p){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:p,writable:!0})}toString(){return`${this.name} [${h}]: ${this.message}`}}}g("ERR_BUFFER_OUT_OF_BOUNDS",function(h){return h?`${h} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),g("ERR_INVALID_ARG_TYPE",function(h,o){return`The "${h}" argument must be of type number. Received type ${typeof o}`},TypeError),g("ERR_OUT_OF_RANGE",function(h,o,u){let l=`The value of "${h}" is out of range.`,p=u;return Number.isInteger(u)&&Math.abs(u)>2**32?p=_(String(u)):typeof u=="bigint"&&(p=String(u),(u>BigInt(2)**BigInt(32)||u<-(BigInt(2)**BigInt(32)))&&(p=_(p)),p+="n"),l+=` It must be ${o}. Received ${p}`,l},RangeError);function _(h){let o="",u=h.length;const l=h[0]==="-"?1:0;for(;u>=l+4;u-=3)o=`_${h.slice(u-3,u)}${o}`;return`${h.slice(0,u)}${o}`}function T(h,o,u){$(o,"offset"),(h[o]===void 0||h[o+u]===void 0)&&J(o,h.length-(u+1))}function j(h,o,u,l,p,b){if(h>u||h<o){const I=typeof o=="bigint"?"n":"";let H;throw o===0||o===BigInt(0)?H=`>= 0${I} and < 2${I} ** ${(b+1)*8}${I}`:H=`>= -(2${I} ** ${(b+1)*8-1}${I}) and < 2 ** ${(b+1)*8-1}${I}`,new W.ERR_OUT_OF_RANGE("value",H,h)}T(l,p,b)}function $(h,o){if(typeof h!="number")throw new W.ERR_INVALID_ARG_TYPE(o,"number",h)}function J(h,o,u){throw Math.floor(h)!==h?($(h,u),new W.ERR_OUT_OF_RANGE("offset","an integer",h)):o<0?new W.ERR_BUFFER_OUT_OF_BOUNDS:new W.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${o}`,h)}const bt=/[^+/0-9A-Za-z-_]/g;function Ot(h){if(h=h.split("=")[0],h=h.trim().replace(bt,""),h.length<2)return"";for(;h.length%4!==0;)h=h+"=";return h}function kt(h,o){o=o||1/0;let u;const l=h.length;let p=null;const b=[];for(let I=0;I<l;++I){if(u=h.charCodeAt(I),u>55295&&u<57344){if(!p){if(u>56319){(o-=3)>-1&&b.push(239,191,189);continue}else if(I+1===l){(o-=3)>-1&&b.push(239,191,189);continue}p=u;continue}if(u<56320){(o-=3)>-1&&b.push(239,191,189),p=u;continue}u=(p-55296<<10|u-56320)+65536}else p&&(o-=3)>-1&&b.push(239,191,189);if(p=null,u<128){if((o-=1)<0)break;b.push(u)}else if(u<2048){if((o-=2)<0)break;b.push(u>>6|192,u&63|128)}else if(u<65536){if((o-=3)<0)break;b.push(u>>12|224,u>>6&63|128,u&63|128)}else if(u<1114112){if((o-=4)<0)break;b.push(u>>18|240,u>>12&63|128,u>>6&63|128,u&63|128)}else throw new Error("Invalid code point")}return b}function Ht(h){const o=[];for(let u=0;u<h.length;++u)o.push(h.charCodeAt(u)&255);return o}function Vt(h,o){let u,l,p;const b=[];for(let I=0;I<h.length&&!((o-=2)<0);++I)u=h.charCodeAt(I),l=u>>8,p=u%256,b.push(p),b.push(l);return b}function $t(h){return t.toByteArray(Ot(h))}function Nt(h,o,u,l){let p;for(p=0;p<l&&!(p+u>=o.length||p>=h.length);++p)o[p+u]=h[p];return p}function mt(h,o){return h instanceof o||h!=null&&h.constructor!=null&&h.constructor.name!=null&&h.constructor.name===o.name}function Qt(h){return h!==h}const sr=function(){const h="0123456789abcdef",o=new Array(256);for(let u=0;u<16;++u){const l=u*16;for(let p=0;p<16;++p)o[l+p]=h[u]+h[p]}return o}();function Wt(h){return typeof BigInt>"u"?Fi:h}function Fi(){throw new Error("BigInt not supported")}}($i)),$i}var $o;function hf(){if($o)return Ur;$o=1,Object.defineProperty(Ur,"__esModule",{value:!0}),Ur.BinaryReader=void 0;const r=Ws();class t{constructor(n,s=!1){this.readUInt8=this._read(r.Buffer.prototype.readUInt8,r.Buffer.prototype.readUInt8,1),this.readUInt16=this._read(r.Buffer.prototype.readUInt16LE,r.Buffer.prototype.readUInt16BE,2),this.readUInt32=this._read(r.Buffer.prototype.readUInt32LE,r.Buffer.prototype.readUInt32BE,4),this.readInt8=this._read(r.Buffer.prototype.readInt8,r.Buffer.prototype.readInt8,1),this.readInt16=this._read(r.Buffer.prototype.readInt16LE,r.Buffer.prototype.readInt16BE,2),this.readInt32=this._read(r.Buffer.prototype.readInt32LE,r.Buffer.prototype.readInt32BE,4),this.readFloat=this._read(r.Buffer.prototype.readFloatLE,r.Buffer.prototype.readFloatBE,4),this.readDouble=this._read(r.Buffer.prototype.readDoubleLE,r.Buffer.prototype.readDoubleBE,8),this.buffer=n,this.position=0,this.isBigEndian=s}_read(n,s,i){return()=>{let c;return this.isBigEndian?c=s.call(this.buffer,this.position):c=n.call(this.buffer,this.position),this.position+=i,c}}readVarInt(){let n,s=0,i=0;do n=this.buffer[this.position+i],s+=(n&127)<<7*i,i++;while(n>=128);return this.position+=i,s}}return Ur.BinaryReader=t,Ur}var Cr={},zo;function Ke(){if(zo)return Cr;zo=1,Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.BinaryWriter=void 0;const r=Ws();class t{constructor(n,s=!0){this.writeUInt8=this._write(r.Buffer.prototype.writeUInt8,1),this.writeUInt16LE=this._write(r.Buffer.prototype.writeUInt16LE,2),this.writeUInt16BE=this._write(r.Buffer.prototype.writeUInt16BE,2),this.writeUInt32LE=this._write(r.Buffer.prototype.writeUInt32LE,4),this.writeUInt32BE=this._write(r.Buffer.prototype.writeUInt32BE,4),this.writeInt8=this._write(r.Buffer.prototype.writeInt8,1),this.writeInt16LE=this._write(r.Buffer.prototype.writeInt16LE,2),this.writeInt16BE=this._write(r.Buffer.prototype.writeInt16BE,2),this.writeInt32LE=this._write(r.Buffer.prototype.writeInt32LE,4),this.writeInt32BE=this._write(r.Buffer.prototype.writeInt32BE,4),this.writeFloatLE=this._write(r.Buffer.prototype.writeFloatLE,4),this.writeFloatBE=this._write(r.Buffer.prototype.writeFloatBE,4),this.writeDoubleLE=this._write(r.Buffer.prototype.writeDoubleLE,8),this.writeDoubleBE=this._write(r.Buffer.prototype.writeDoubleBE,8),this.buffer=r.Buffer.alloc(n),this.position=0,this.allowResize=s}_write(n,s){return(i,c=!1)=>{this.ensureSize(s),n.call(this.buffer,i,this.position,c),this.position+=s}}writeBuffer(n){this.ensureSize(n.length),n.copy(this.buffer,this.position,0,n.length),this.position+=n.length}writeVarInt(n){let s=1;for(;(n&4294967168)!==0;)this.writeUInt8(n&127|128),n>>>=7,s++;return this.writeUInt8(n&127),s}ensureSize(n){if(this.buffer.length<this.position+n)if(this.allowResize){const s=r.Buffer.alloc(this.position+n);this.buffer.copy(s,0,0,this.buffer.length),this.buffer=s}else throw new RangeError("index out of range")}}return Cr.BinaryWriter=t,Cr}var Rr={},jo;function $e(){return jo||(jo=1,Object.defineProperty(Rr,"__esModule",{value:!0}),Rr.CONSTANTS=void 0,Rr.CONSTANTS={wkt:{Point:"POINT",LineString:"LINESTRING",Polygon:"POLYGON",MultiPoint:"MULTIPOINT",MultiLineString:"MULTILINESTRING",MultiPolygon:"MULTIPOLYGON",GeometryCollection:"GEOMETRYCOLLECTION"},wkb:{Point:1,LineString:2,Polygon:3,MultiPoint:4,MultiLineString:5,MultiPolygon:6,GeometryCollection:7},geoJSON:{Point:"Point",LineString:"LineString",Polygon:"Polygon",MultiPoint:"MultiPoint",MultiLineString:"MultiLineString",MultiPolygon:"MultiPolygon",GeometryCollection:"GeometryCollection"}}),Rr}var Pr={},Vo;function lf(){if(Vo)return Pr;Vo=1,Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.Geometry=void 0;const r=Ws(),t=ze();class e{constructor(){this.srid=void 0,this.hasZ=!1,this.hasM=!1}static parse(s,i){if(typeof s==="string"||s instanceof t.WktParser)return e._parseWkt(s);if(r.Buffer.isBuffer(s)||s instanceof t.BinaryReader)try{return e._parseWkb(s,i)}catch{try{return e.parseTwkb(s)}catch{throw new Error("Could not parse WKB or TWKB")}}else throw new Error("First argument must be a string or Buffer")}static _parseWkt(s){let i,c;s instanceof t.WktParser?i=s:i=new t.WktParser(s);const a=i.matchRegex([/^SRID=(\d+);/]);a&&(c=parseInt(a[1],10));const d=i.matchType(),f=i.matchDimension(),y={srid:c,hasZ:f.hasZ,hasM:f.hasM};switch(d){case t.CONSTANTS.wkt.Point:return t.Point._parseWktWithOptions(i,y);case t.CONSTANTS.wkt.LineString:return t.LineString._parseWktWithOptions(i,y);case t.CONSTANTS.wkt.Polygon:return t.Polygon._parseWktWithOptions(i,y);case t.CONSTANTS.wkt.MultiPoint:return t.MultiPoint._parseWktWithOptions(i,y);case t.CONSTANTS.wkt.MultiLineString:return t.MultiLineString._parseWktWithOptions(i,y);case t.CONSTANTS.wkt.MultiPolygon:return t.MultiPolygon._parseWktWithOptions(i,y);case t.CONSTANTS.wkt.GeometryCollection:return t.GeometryCollection._parseWktWithOptions(i,y);default:throw new Error("Unsupported geometry type")}}static _parseWkb(s,i){let c,a,d;const f={};switch(s instanceof t.BinaryReader?c=s:c=new t.BinaryReader(s),c.isBigEndian=!c.readInt8(),a=c.readUInt32(),f.hasSrid=(a&536870912)===536870912,f.isEwkb=a&536870912||a&1073741824||a&2147483648,f.hasSrid&&(f.srid=c.readUInt32()),f.hasZ=!1,f.hasM=!1,!f.isEwkb&&(!i||!i.isEwkb)?a>=1e3&&a<2e3?(f.hasZ=!0,d=a-1e3):a>=2e3&&a<3e3?(f.hasM=!0,d=a-2e3):a>=3e3&&a<4e3?(f.hasZ=!0,f.hasM=!0,d=a-3e3):d=a:(a&2147483648&&(f.hasZ=!0),a&1073741824&&(f.hasM=!0),d=a&15),d){case t.CONSTANTS.wkb.Point:return t.Point._parseWkb(c,f);case t.CONSTANTS.wkb.LineString:return t.LineString._parseWkb(c,f);case t.CONSTANTS.wkb.Polygon:return t.Polygon._parseWkb(c,f);case t.CONSTANTS.wkb.MultiPoint:return t.MultiPoint._parseWkb(c,f);case t.CONSTANTS.wkb.MultiLineString:return t.MultiLineString._parseWkb(c,f);case t.CONSTANTS.wkb.MultiPolygon:return t.MultiPolygon._parseWkb(c,f);case t.CONSTANTS.wkb.GeometryCollection:return t.GeometryCollection._parseWkb(c,f);default:throw new Error(`GeometryType ${d} not supported`)}}static parseTwkb(s){let i;const c={};s instanceof t.BinaryReader?i=s:i=new t.BinaryReader(s);const a=i.readUInt8(),d=i.readUInt8(),f=a&15;if(c.precision=t.ZigZag.decode(a>>4),c.precisionFactor=Math.pow(10,c.precision),c.hasBoundingBox=d>>0&1,c.hasSizeAttribute=d>>1&1,c.hasIdList=d>>2&1,c.hasExtendedPrecision=d>>3&1,c.isEmpty=d>>4&1,c.hasExtendedPrecision){const y=i.readUInt8();c.hasZ=(y&1)===1,c.hasM=(y&2)===2,c.zPrecision=t.ZigZag.decode((y&28)>>2),c.zPrecisionFactor=Math.pow(10,c.zPrecision),c.mPrecision=t.ZigZag.decode((y&224)>>5),c.mPrecisionFactor=Math.pow(10,c.mPrecision)}else c.hasZ=!1,c.hasM=!1;if(c.hasSizeAttribute&&i.readVarInt(),c.hasBoundingBox){let y=2;c.hasZ&&y++,c.hasM&&y++;for(let B=0;B<y;B++)i.readVarInt(),i.readVarInt()}switch(f){case t.CONSTANTS.wkb.Point:return t.Point._parseTwkb(i,c);case t.CONSTANTS.wkb.LineString:return t.LineString._parseTwkb(i,c);case t.CONSTANTS.wkb.Polygon:return t.Polygon._parseTwkb(i,c);case t.CONSTANTS.wkb.MultiPoint:return t.MultiPoint._parseTwkb(i,c);case t.CONSTANTS.wkb.MultiLineString:return t.MultiLineString._parseTwkb(i,c);case t.CONSTANTS.wkb.MultiPolygon:return t.MultiPolygon._parseTwkb(i,c);case t.CONSTANTS.wkb.GeometryCollection:return t.GeometryCollection._parseTwkb(i,c);default:throw new Error("GeometryType "+f+" not supported")}}toGeoJSON(s){const i={};return this.srid&&s&&(s.shortCrs?i.crs={type:"name",properties:{name:"EPSG:"+this.srid}}:s.longCrs&&(i.crs={type:"name",properties:{name:"urn:ogc:def:crs:EPSG::"+this.srid}})),i}static _parseGeoJSON(s,i){let c;switch(s.type){case t.CONSTANTS.geoJSON.Point:c=t.Point._parseGeoJSON(s);break;case t.CONSTANTS.geoJSON.LineString:c=t.LineString._parseGeoJSON(s);break;case t.CONSTANTS.geoJSON.Polygon:c=t.Polygon._parseGeoJSON(s);break;case t.CONSTANTS.geoJSON.MultiPoint:c=t.MultiPoint._parseGeoJSON(s);break;case t.CONSTANTS.geoJSON.MultiLineString:c=t.MultiLineString._parseGeoJSON(s);break;case t.CONSTANTS.geoJSON.MultiPolygon:c=t.MultiPolygon._parseGeoJSON(s);break;case t.CONSTANTS.geoJSON.GeometryCollection:c=t.GeometryCollection._parseGeoJSON(s);break;default:throw new Error("GeometryType "+s.type+" not supported")}if(s.crs&&s.crs.type&&s.crs.type==="name"&&s.crs.properties&&s.crs.properties.name){const a=s.crs.properties.name;if(a.indexOf("EPSG:")===0)c.srid=parseInt(a.substring(5));else if(a.indexOf("urn:ogc:def:crs:EPSG::")===0)c.srid=parseInt(a.substring(22));else throw new Error("Unsupported crs: "+a)}else i||(c.srid=4326);return c}toEwkt(){return`SRID=${this.srid};${this.toWkt()}`}toEwkb(){const s=new t.BinaryWriter(this._getWkbSize()+4),i=this.toWkb();return s.writeInt8(1),s.writeUInt32LE((i.slice(1,5).readUInt32LE(0)|536870912)>>>0,!0),s.writeUInt32LE(this.srid),s.writeBuffer(i.slice(5)),s.buffer}_getWktType(s,i){let c=s;return this.hasZ&&this.hasM?c+=" ZM ":this.hasZ?c+=" Z ":this.hasM&&(c+=" M "),i&&!this.hasZ&&!this.hasM&&(c+=" "),i&&(c+="EMPTY"),c}_getWktCoordinate(s){let i=`${s.x} ${s.y}`;return this.hasZ&&(i+=` ${s.z}`),this.hasM&&(i+=` ${s.m}`),i}_writeWkbType(s,i,c){let a=0;typeof this.srid>"u"&&(!c||typeof c.srid>"u")?this.hasZ&&this.hasM?a+=3e3:this.hasZ?a+=1e3:this.hasM&&(a+=2e3):(this.hasZ&&(a|=2147483648),this.hasM&&(a|=1073741824)),s.writeUInt32LE(a+i>>>0,!0)}static getTwkbPrecision(s,i,c){return{xy:s,z:i,m:c,xyFactor:Math.pow(10,s),zFactor:Math.pow(10,i),mFactor:Math.pow(10,c)}}_writeTwkbHeader(s,i,c,a){const d=(t.ZigZag.encode(c.xy)<<4)+i;let f=this.hasZ||this.hasM?1:0;if(f+=a?1:0,s.writeUInt8(d),s.writeUInt8(f),this.hasZ||this.hasM){let y=0;this.hasZ&&(y|=1),this.hasM&&(y|=2),s.writeUInt8(y)}}toWkt(){throw new Error("Method 'toWkt' not implemented.")}toWkb(){throw new Error("Method 'toWkb' not implemented.")}toTwkb(){throw new Error("Method 'toTwkb' not implemented.")}_getWkbSize(){throw new Error("Method '_getWkbSize' not implemented.")}}return Pr.Geometry=e,Pr}var $r={},Wo;function df(){if(Wo)return $r;Wo=1,Object.defineProperty($r,"__esModule",{value:!0}),$r.GeometryCollection=void 0;const r=Ke(),t=$e(),e=ze();class n extends e.Geometry{constructor(i=[],c){super(),this.geometries=i,this.srid=c,this.geometries.length>0&&(this.hasZ=this.geometries[0].hasZ,this.hasM=this.geometries[0].hasM)}static Z(i,c){const a=new n(i,c);return a.hasZ=!0,a}static M(i,c){const a=new n(i,c);return a.hasM=!0,a}static ZM(i,c){const a=new n(i,c);return a.hasZ=!0,a.hasM=!0,a}static _parseWktWithOptions(i,c){const a=new n;if(a.srid=c.srid,a.hasZ=c.hasZ,a.hasM=c.hasM,i.isMatch(["EMPTY"]))return a;i.expectGroupStart();do a.geometries.push(e.Geometry.parse(i));while(i.isMatch([","]));return i.expectGroupEnd(),a}static _parseWkb(i,c){const a=new n;a.srid=c.srid,a.hasZ=c.hasZ,a.hasM=c.hasM;const d=i.readUInt32();for(let f=0;f<d;f++)a.geometries.push(e.Geometry.parse(i,c));return a}static _parseTwkb(i,c){const a=new n;if(a.hasZ=c.hasZ,a.hasM=c.hasM,c.isEmpty)return a;const d=i.readVarInt();for(let f=0;f<d;f++)a.geometries.push(e.Geometry.parseTwkb(i));return a}static _parseGeoJSON(i){const c=new n;for(let a=0;a<i.geometries.length;a++)c.geometries.push(e.Geometry._parseGeoJSON(i.geometries[a],!0));return c.geometries.length>0&&(c.hasZ=c.geometries[0].hasZ),c}toWkt(){if(this.geometries.length===0)return this._getWktType(t.CONSTANTS.wkt.GeometryCollection,!0);let i=this._getWktType(t.CONSTANTS.wkt.GeometryCollection,!1)+"(";for(let c=0;c<this.geometries.length;c++)i+=this.geometries[c].toWkt()+",";return i=i.slice(0,-1)+")",i}toWkb(){const i=new r.BinaryWriter(this._getWkbSize());i.writeInt8(1),this._writeWkbType(i,t.CONSTANTS.wkb.GeometryCollection),i.writeUInt32LE(this.geometries.length);for(let c=0;c<this.geometries.length;c++)i.writeBuffer(this.geometries[c].toWkb());return i.buffer}toTwkb(){const i=new r.BinaryWriter(0,!0),c=e.Geometry.getTwkbPrecision(5,0,0),a=this.geometries.length===0;if(this._writeTwkbHeader(i,t.CONSTANTS.wkb.GeometryCollection,c,a),!a){i.writeVarInt(this.geometries.length);for(let d=0;d<this.geometries.length;d++)i.writeBuffer(this.geometries[d].toTwkb())}return i.buffer}_getWkbSize(){let i=9;for(let c=0;c<this.geometries.length;c++)i+=this.geometries[c]._getWkbSize();return i}toGeoJSON(i){const c=super.toGeoJSON(i);return c.type=t.CONSTANTS.geoJSON.GeometryCollection,c.geometries=this.geometries.map(a=>a.toGeoJSON()),c}}return $r.GeometryCollection=n,$r}var zr={},Zo;function ff(){if(Zo)return zr;Zo=1,Object.defineProperty(zr,"__esModule",{value:!0}),zr.LineString=void 0;const r=Ke(),t=$e(),e=ze();class n extends e.Geometry{constructor(i=[],c){super(),this.hasZ=!1,this.hasM=!1,this.points=i,this.srid=c,this.points.length>0&&(this.hasZ=this.points[0].hasZ,this.hasM=this.points[0].hasM)}static Z(i,c){const a=new n(i,c);return a.hasZ=!0,a}static M(i,c){const a=new n(i,c);return a.hasM=!0,a}static ZM(i,c){const a=new n(i,c);return a.hasZ=!0,a.hasM=!0,a}static _parseWktWithOptions(i,c){const a=new n;return a.srid=c.srid,a.hasZ=c.hasZ,a.hasM=c.hasM,i.isMatch(["EMPTY"])||(i.expectGroupStart(),a.points.push(...i.matchCoordinates(c)),i.expectGroupEnd()),a}static _parseWkb(i,c){const a=new n;a.srid=c.srid,a.hasZ=c.hasZ,a.hasM=c.hasM;const d=i.readUInt32();for(let f=0;f<d;f++)a.points.push(e.Point._readWkbPoint(i,c));return a}static _parseTwkb(i,c){const a=new n;if(a.hasZ=c.hasZ,a.hasM=c.hasM,c.isEmpty)return a;const d=new e.Point(0,0,0,0),f=i.readVarInt();for(let y=0;y<f;y++)a.points.push(e.Point._readTwkbPoint(i,c,d));return a}static _parseGeoJSON(i){const c=new n;i.coordinates.length>0&&(c.hasZ=i.coordinates[0].length>2);for(const a of i.coordinates)c.points.push(e.Point._readGeoJSONPoint(a));return c}static fromGeometry(i){const c=new n;return c.srid=i.srid,c.hasZ=i.hasZ,c.hasM=i.hasM,i instanceof n?c.points=i.points:i instanceof e.Point&&(c.points=[i]),c}toWkt(){return this.points.length===0?this._getWktType(t.CONSTANTS.wkt.LineString,!0):this._getWktType(t.CONSTANTS.wkt.LineString,!1)+this._toInnerWkt()}_toInnerWkt(){let i="(";for(const c of this.points)i+=`${this._getWktCoordinate(c)},`;return i.slice(0,-1)+")"}toWkb(i){const c=new r.BinaryWriter(this._getWkbSize());c.writeInt8(1),this._writeWkbType(c,t.CONSTANTS.wkb.LineString,i),c.writeUInt32LE(this.points.length);for(const a of this.points)a._writeWkbPoint(c);return c.buffer}toTwkb(){const i=new r.BinaryWriter(0,!0),c=e.Geometry.getTwkbPrecision(5,0,0),a=this.points.length===0;if(this._writeTwkbHeader(i,t.CONSTANTS.wkb.LineString,c,a),!a){i.writeVarInt(this.points.length);const d=new e.Point(0,0,0,0);for(const f of this.points)f._writeTwkbPoint(i,c,d)}return i.buffer}_getWkbSize(){let i=16;return this.hasZ&&(i+=8),this.hasM&&(i+=8),9+this.points.length*i}toGeoJSON(i){const c=super.toGeoJSON(i);return c.type=t.CONSTANTS.geoJSON.LineString,c.coordinates=this.points.map(a=>this.hasZ?[a.x,a.y,a.z]:[a.x,a.y]),c}}return zr.LineString=n,zr}var jr={},Go;function pf(){if(Go)return jr;Go=1,Object.defineProperty(jr,"__esModule",{value:!0}),jr.MultiLineString=void 0;const r=Ke(),t=$e(),e=ze();class n extends e.Geometry{constructor(i=[],c){super(),this.lineStrings=i,this.srid=c,this.lineStrings.length>0&&(this.hasZ=this.lineStrings[0].hasZ,this.hasM=this.lineStrings[0].hasM)}static Z(i,c){const a=new n(i,c);return a.hasZ=!0,a}static M(i,c){const a=new n(i,c);return a.hasM=!0,a}static ZM(i,c){const a=new n(i,c);return a.hasZ=!0,a.hasM=!0,a}static _parseWktWithOptions(i,c){const a=new n;if(a.srid=c.srid,a.hasZ=c.hasZ,a.hasM=c.hasM,i.isMatch(["EMPTY"]))return a;i.expectGroupStart();do i.expectGroupStart(),a.lineStrings.push(new e.LineString(i.matchCoordinates(c))),i.expectGroupEnd();while(i.isMatch([","]));return i.expectGroupEnd(),a}static _parseWkb(i,c){const a=new n;a.srid=c.srid,a.hasZ=c.hasZ,a.hasM=c.hasM;const d=i.readUInt32();for(let f=0;f<d;f++){const y=e.Geometry.parse(i,c);a.lineStrings.push(e.LineString.fromGeometry(y))}return a}static _parseTwkb(i,c){const a=new n;if(a.hasZ=c.hasZ,a.hasM=c.hasM,c.isEmpty)return a;const d=new e.Point(0,0,0,0),f=i.readVarInt();for(let y=0;y<f;y++){const B=new e.LineString;B.hasZ=c.hasZ,B.hasM=c.hasM;const L=i.readVarInt();for(let x=0;x<L;x++)B.points.push(e.Point._readTwkbPoint(i,c,d));a.lineStrings.push(B)}return a}static _parseGeoJSON(i){const c=new n;i.coordinates.length>0&&i.coordinates[0].length>0&&(c.hasZ=i.coordinates[0][0].length>2);for(let a=0;a<i.coordinates.length;a++)c.lineStrings.push(e.LineString._parseGeoJSON({coordinates:i.coordinates[a]}));return c}toWkt(){if(this.lineStrings.length===0)return this._getWktType(t.CONSTANTS.wkt.MultiLineString,!0);let i=this._getWktType(t.CONSTANTS.wkt.MultiLineString,!1)+"(";for(let c=0;c<this.lineStrings.length;c++)i+=this.lineStrings[c]._toInnerWkt()+",";return i=i.slice(0,-1)+")",i}toWkb(){const i=new r.BinaryWriter(this._getWkbSize());i.writeInt8(1),this._writeWkbType(i,t.CONSTANTS.wkb.MultiLineString),i.writeUInt32LE(this.lineStrings.length);for(let c=0;c<this.lineStrings.length;c++)i.writeBuffer(this.lineStrings[c].toWkb({srid:this.srid}));return i.buffer}toTwkb(){const i=new r.BinaryWriter(0,!0),c=e.Geometry.getTwkbPrecision(5,0,0),a=this.lineStrings.length===0;if(this._writeTwkbHeader(i,t.CONSTANTS.wkb.MultiLineString,c,a),!a){i.writeVarInt(this.lineStrings.length);const d=new e.Point(0,0,0,0);for(let f=0;f<this.lineStrings.length;f++){i.writeVarInt(this.lineStrings[f].points.length);for(let y=0;y<this.lineStrings[f].points.length;y++)this.lineStrings[f].points[y]._writeTwkbPoint(i,c,d)}}return i.buffer}_getWkbSize(){let i=9;for(let c=0;c<this.lineStrings.length;c++)i+=this.lineStrings[c]._getWkbSize();return i}toGeoJSON(i){const c=super.toGeoJSON(i);c.type=t.CONSTANTS.geoJSON.MultiLineString,c.coordinates=[];for(let a=0;a<this.lineStrings.length;a++)c.coordinates.push(this.lineStrings[a].toGeoJSON().coordinates);return c}}return jr.MultiLineString=n,jr}var Vr={},Yo;function yf(){if(Yo)return Vr;Yo=1,Object.defineProperty(Vr,"__esModule",{value:!0}),Vr.MultiPoint=void 0;const r=Ke(),t=$e(),e=ze();class n extends e.Geometry{constructor(i=[],c){super(),this.points=i,this.srid=c,this.points.length>0&&(this.hasZ=this.points[0].hasZ,this.hasM=this.points[0].hasM)}static Z(i,c){const a=new n(i,c);return a.hasZ=!0,a}static M(i,c){const a=new n(i,c);return a.hasM=!0,a}static ZM(i,c){const a=new n(i,c);return a.hasZ=!0,a.hasM=!0,a}static _parseWktWithOptions(i,c){const a=new n;return a.srid=c.srid,a.hasZ=c.hasZ,a.hasM=c.hasM,i.isMatch(["EMPTY"])||(i.expectGroupStart(),a.points.push(...i.matchCoordinates(c)),i.expectGroupEnd()),a}static _parseWkb(i,c){const a=new n;a.srid=c.srid,a.hasZ=c.hasZ,a.hasM=c.hasM;const d=i.readUInt32();for(let f=0;f<d;f++){const y=e.Geometry.parse(i,c);a.points.push(e.Point.fromGeometry(y))}return a}static _parseTwkb(i,c){const a=new n;if(a.hasZ=c.hasZ,a.hasM=c.hasM,c.isEmpty)return a;const d=new e.Point(0,0,0,0),f=i.readVarInt();for(let y=0;y<f;y++)a.points.push(e.Point._readTwkbPoint(i,c,d));return a}static _parseGeoJSON(i){const c=new n;i.coordinates.length>0&&(c.hasZ=i.coordinates[0].length>2);for(let a=0;a<i.coordinates.length;a++)c.points.push(e.Point._parseGeoJSON({coordinates:i.coordinates[a]}));return c}toWkt(){if(this.points.length===0)return this._getWktType(t.CONSTANTS.wkt.MultiPoint,!0);let i=this._getWktType(t.CONSTANTS.wkt.MultiPoint,!1)+"(";for(let c=0;c<this.points.length;c++)i+=this._getWktCoordinate(this.points[c])+",";return i=i.slice(0,-1)+")",i}toWkb(){const i=new r.BinaryWriter(this._getWkbSize());i.writeInt8(1),this._writeWkbType(i,t.CONSTANTS.wkb.MultiPoint),i.writeUInt32LE(this.points.length);for(let c=0;c<this.points.length;c++)i.writeBuffer(this.points[c].toWkb({srid:this.srid}));return i.buffer}toTwkb(){const i=new r.BinaryWriter(0,!0),c=e.Geometry.getTwkbPrecision(5,0,0),a=this.points.length===0;if(this._writeTwkbHeader(i,t.CONSTANTS.wkb.MultiPoint,c,a),!a){i.writeVarInt(this.points.length);const d=new e.Point(0,0,0,0);for(let f=0;f<this.points.length;f++)this.points[f]._writeTwkbPoint(i,c,d)}return i.buffer}_getWkbSize(){let i=16;return this.hasZ&&(i+=8),this.hasM&&(i+=8),i+=5,9+this.points.length*i}toGeoJSON(i){const c=super.toGeoJSON(i);c.type=t.CONSTANTS.geoJSON.MultiPoint,c.coordinates=[];for(let a=0;a<this.points.length;a++)c.coordinates.push(this.points[a].toGeoJSON().coordinates);return c}}return Vr.MultiPoint=n,Vr}var Wr={},Jo;function gf(){if(Jo)return Wr;Jo=1,Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.MultiPolygon=void 0;const r=Ke(),t=$e(),e=ze();class n extends e.Geometry{constructor(i,c){super(),this.polygons=i||[],this.srid=c,this.polygons.length>0?(this.hasZ=this.polygons[0].hasZ,this.hasM=this.polygons[0].hasM):(this.hasZ=!1,this.hasM=!1)}static Z(i,c){const a=new n(i,c);return a.hasZ=!0,a}static M(i,c){const a=new n(i,c);return a.hasM=!0,a}static ZM(i,c){const a=new n(i,c);return a.hasZ=!0,a.hasM=!0,a}static _parseWktWithOptions(i,c){const a=new n;if(a.srid=c.srid,a.hasZ=c.hasZ,a.hasM=c.hasM,i.isMatch(["EMPTY"]))return a;i.expectGroupStart();do{i.expectGroupStart();const d=[],f=[];for(i.expectGroupStart(),d.push(...i.matchCoordinates(c)),i.expectGroupEnd();i.isMatch([","]);)i.expectGroupStart(),f.push(i.matchCoordinates(c)),i.expectGroupEnd();a.polygons.push(new e.Polygon(d,f)),i.expectGroupEnd()}while(i.isMatch([","]));return i.expectGroupEnd(),a}static _parseWkb(i,c){const a=new n;a.srid=c.srid,a.hasZ=c.hasZ,a.hasM=c.hasM;const d=i.readUInt32();for(let f=0;f<d;f++)a.polygons.push(e.Geometry.parse(i,c));return a}static _parseTwkb(i,c){const a=new n;if(a.hasZ=c.hasZ,a.hasM=c.hasM,c.isEmpty)return a;const d=new e.Point(0,0,0,0),f=i.readVarInt();for(let y=0;y<f;y++){const B=new e.Polygon;B.hasZ=c.hasZ,B.hasM=c.hasM;const L=i.readVarInt(),x=i.readVarInt();for(let M=0;M<x;M++)B.exteriorRing.push(e.Point._readTwkbPoint(i,c,d));for(let M=1;M<L;M++){const U=[],F=i.readVarInt();for(let O=0;O<F;O++)U.push(e.Point._readTwkbPoint(i,c,d));B.interiorRings.push(U)}a.polygons.push(B)}return a}static _parseGeoJSON(i){const c=new n;i.coordinates.length>0&&i.coordinates[0].length>0&&i.coordinates[0][0].length>0&&(c.hasZ=i.coordinates[0][0].length>2);for(let a=0;a<i.coordinates.length;a++)c.polygons.push(e.Polygon._parseGeoJSON({coordinates:i.coordinates}));return c}toWkt(){if(this.polygons.length===0)return this._getWktType(t.CONSTANTS.wkt.MultiPolygon,!0);let i=this._getWktType(t.CONSTANTS.wkt.MultiPolygon,!1)+"(";for(let c=0;c<this.polygons.length;c++)i+=this.polygons[c]._toInnerWkt()+",";return i=i.slice(0,-1),i+=")",i}toWkb(){const i=new r.BinaryWriter(this._getWkbSize());i.writeInt8(1),this._writeWkbType(i,t.CONSTANTS.wkb.MultiPolygon),i.writeUInt32LE(this.polygons.length);for(let c=0;c<this.polygons.length;c++)i.writeBuffer(this.polygons[c].toWkb({srid:this.srid}));return i.buffer}toTwkb(){const i=new r.BinaryWriter(0,!0),c=e.Geometry.getTwkbPrecision(5,0,0),a=this.polygons.length===0;if(this._writeTwkbHeader(i,t.CONSTANTS.wkb.MultiPolygon,c,a),this.polygons.length>0){i.writeVarInt(this.polygons.length);const d=new e.Point(0,0,0,0);for(let f=0;f<this.polygons.length;f++){i.writeVarInt(1+this.polygons[f].interiorRings.length),i.writeVarInt(this.polygons[f].exteriorRing.length);for(let y=0;y<this.polygons[f].exteriorRing.length;y++)this.polygons[f].exteriorRing[y]._writeTwkbPoint(i,c,d);for(let y=0;y<this.polygons[f].interiorRings.length;y++){i.writeVarInt(this.polygons[f].interiorRings[y].length);for(let B=0;B<this.polygons[f].interiorRings[y].length;B++)this.polygons[f].interiorRings[y][B]._writeTwkbPoint(i,c,d)}}}return i.buffer}_getWkbSize(){let i=9;for(let c=0;c<this.polygons.length;c++)i+=this.polygons[c]._getWkbSize();return i}toGeoJSON(i){const c=super.toGeoJSON(i);c.type=t.CONSTANTS.geoJSON.MultiPolygon,c.coordinates=[];for(let a=0;a<this.polygons.length;a++)c.coordinates.push(this.polygons[a].toGeoJSON().coordinates);return c}}return Wr.MultiPolygon=n,Wr}var Zr={},Gr={},Ho;function Au(){if(Ho)return Gr;Ho=1,Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.ZigZag=void 0;class r{static encode(e){return e<<1^e>>31}static decode(e){return e>>1^-(e&1)}}return Gr.ZigZag=r,Gr}var qo;function Eu(){if(qo)return Zr;qo=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.Point=void 0;const r=Ke(),t=Au(),e=$e(),n=ze();class s extends n.Geometry{constructor(c,a,d,f,y){super(),this.x=c,this.y=a,this.z=d,this.m=f,this.srid=y,this.hasZ=typeof this.z<"u",this.hasM=typeof this.m<"u"}static Z(c,a,d,f){const y=new s(c,a,d,0,f);return y.hasZ=!0,y}static M(c,a,d,f){const y=new s(c,a,0,d,f);return y.hasM=!0,y}static ZM(c,a,d,f,y){const B=new s(c,a,d,f,y);return B.hasZ=!0,B.hasM=!0,B}static _parseWktWithOptions(c,a){const d=new s(0,0,0,0);if(d.srid=a.srid,d.hasZ=a.hasZ,d.hasM=a.hasM,c.isMatch(["EMPTY"]))return d;c.expectGroupStart();const f=c.matchCoordinate(a);return d.x=f.x,d.y=f.y,d.z=f.z,d.m=f.m,c.expectGroupEnd(),d}static _parseWkb(c,a){const d=s._readWkbPoint(c,a);return d.srid=a.srid,d}static _readWkbPoint(c,a){return new s(c.readDouble(),c.readDouble(),a.hasZ?c.readDouble():!1,a.hasM?c.readDouble():!1)}static _parseTwkb(c,a){const d=new s(0,0,0,0);return d.hasZ=a.hasZ,d.hasM=a.hasM,a.isEmpty||(d.x=t.ZigZag.decode(c.readVarInt())/a.precisionFactor,d.y=t.ZigZag.decode(c.readVarInt())/a.precisionFactor,d.z=a.hasZ?t.ZigZag.decode(c.readVarInt())/a.zPrecisionFactor:0,d.m=a.hasM?t.ZigZag.decode(c.readVarInt())/a.mPrecisionFactor:0),d}static _readTwkbPoint(c,a,d){return d.x+=t.ZigZag.decode(c.readVarInt())/a.precisionFactor,d.y+=t.ZigZag.decode(c.readVarInt())/a.precisionFactor,a.hasZ&&(d.z+=t.ZigZag.decode(c.readVarInt())/a.zPrecisionFactor),a.hasM&&(d.m+=t.ZigZag.decode(c.readVarInt())/a.mPrecisionFactor),new s(d.x,d.y,d.z,d.m)}static _parseGeoJSON(c){return s._readGeoJSONPoint(c.coordinates)}static _readGeoJSONPoint(c){return c.length===0?new s(0,0,0,0):c.length>2?new s(c[0],c[1],c[2],0):new s(c[0],c[1],0,0)}static fromGeometry(c){const a=new s(0,0,0,0);return a.srid=c.srid,a.hasZ=c.hasZ,a.hasM=c.hasM,c instanceof s?(a.x=c.x,a.y=c.y,a.z=c.z,a.m=c.m):console.log("Point.fromGeometry: geom is not an instance of Point"),a}toWkt(){return this.x===void 0&&this.y===void 0&&this.z===void 0&&this.m===void 0?this._getWktType(e.CONSTANTS.wkt.Point,!0):`${this._getWktType(e.CONSTANTS.wkt.Point,!1)}(${this._getWktCoordinate(this)})`}toWkb(c){const a=new r.BinaryWriter(this._getWkbSize());return a.writeInt8(1),this._writeWkbType(a,e.CONSTANTS.wkb.Point,c),this.x===void 0&&this.y===void 0?(a.writeDoubleLE(NaN),a.writeDoubleLE(NaN),this.hasZ&&a.writeDoubleLE(NaN),this.hasM&&a.writeDoubleLE(NaN)):this._writeWkbPoint(a),a.buffer}_writeWkbPoint(c){c.writeDoubleLE(this.x),c.writeDoubleLE(this.y),this.hasZ&&c.writeDoubleLE(this.z),this.hasM&&c.writeDoubleLE(this.m)}toTwkb(){const c=new r.BinaryWriter(0,!0),a=n.Geometry.getTwkbPrecision(5,0,0),d=this.x===void 0&&this.y===void 0;return this._writeTwkbHeader(c,e.CONSTANTS.wkb.Point,a,d),d||this._writeTwkbPoint(c,a,new s(0,0,0,0)),c.buffer}_writeTwkbPoint(c,a,d){const f=this.x*a.xyFactor,y=this.y*a.xyFactor,B=this.z*a.zFactor,L=this.m*a.mFactor;c.writeVarInt(t.ZigZag.encode(f-d.x)),c.writeVarInt(t.ZigZag.encode(y-d.y)),this.hasZ&&c.writeVarInt(t.ZigZag.encode(B-d.z)),this.hasM&&c.writeVarInt(t.ZigZag.encode(L-d.m)),d.x=f,d.y=y,d.z=B,d.m=L}_getWkbSize(){let c=21;return this.hasZ&&(c+=8),this.hasM&&(c+=8),c}toGeoJSON(c){const a=super.toGeoJSON(c);return a.type=e.CONSTANTS.geoJSON.Point,this.x===void 0&&this.y===void 0?a.coordinates=[]:this.z!==void 0?a.coordinates=[this.x,this.y,this.z]:a.coordinates=[this.x,this.y],a}}return Zr.Point=s,Zr}var Yr={},Ko;function mf(){if(Ko)return Yr;Ko=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.Polygon=void 0;const r=Ke(),t=$e(),e=ze();class n extends e.Geometry{constructor(i,c,a){super(),this.exteriorRing=i||[],this.interiorRings=c||[],this.srid=a,this.exteriorRing.length>0?(this.hasZ=this.exteriorRing[0].hasZ,this.hasM=this.exteriorRing[0].hasM):(this.hasZ=!1,this.hasM=!1)}static Z(i,c,a){const d=new n(i,c,a);return d.hasZ=!0,d}static M(i,c,a){const d=new n(i,c,a);return d.hasM=!0,d}static ZM(i,c,a){const d=new n(i,c,a);return d.hasZ=!0,d.hasM=!0,d}static _parseWktWithOptions(i,c){const a=new n;if(a.srid=c.srid,a.hasZ=c.hasZ,a.hasM=c.hasM,i.isMatch(["EMPTY"]))return a;for(i.expectGroupStart(),i.expectGroupStart(),a.exteriorRing.push(...i.matchCoordinates(c)),i.expectGroupEnd();i.isMatch([","]);)i.expectGroupStart(),a.interiorRings.push(i.matchCoordinates(c)),i.expectGroupEnd();return i.expectGroupEnd(),a}static _parseWkb(i,c){const a=new n;a.srid=c.srid,a.hasZ=c.hasZ,a.hasM=c.hasM;const d=i.readUInt32();if(d>0){const f=i.readUInt32();for(let y=0;y<f;y++)a.exteriorRing.push(e.Point._readWkbPoint(i,c));for(let y=1;y<d;y++){const B=[],L=i.readUInt32();for(let x=0;x<L;x++)B.push(e.Point._readWkbPoint(i,c));a.interiorRings.push(B)}}return a}static _parseTwkb(i,c){const a=new n;if(a.hasZ=c.hasZ,a.hasM=c.hasM,c.isEmpty)return a;const d=new e.Point(0,0,0,0),f=i.readVarInt(),y=i.readVarInt();for(let B=0;B<y;B++)a.exteriorRing.push(e.Point._readTwkbPoint(i,c,d));for(let B=1;B<f;B++){const L=[],x=i.readVarInt();for(let M=0;M<x;M++)L.push(e.Point._readTwkbPoint(i,c,d));a.interiorRings.push(L)}return a}static _parseGeoJSON(i){const c=new n;i.coordinates.length>0&&i.coordinates[0].length>0&&(c.hasZ=i.coordinates[0][0].length>2);for(let a=0;a<i.coordinates.length;a++){a>0&&c.interiorRings.push([]);for(let d=0;d<i.coordinates[a].length;d++)a===0?c.exteriorRing.push(e.Point._readGeoJSONPoint(i.coordinates[a][d])):c.interiorRings[a-1].push(e.Point._readGeoJSONPoint(i.coordinates[a][d]))}return c}toWkt(){return this.exteriorRing.length===0?this._getWktType(t.CONSTANTS.wkt.Polygon,!0):this._getWktType(t.CONSTANTS.wkt.Polygon,!1)+this._toInnerWkt()}_toInnerWkt(){let i="((";for(let c=0;c<this.exteriorRing.length;c++)i+=this._getWktCoordinate(this.exteriorRing[c])+",";i=i.slice(0,-1),i+=")";for(let c=0;c<this.interiorRings.length;c++){i+=",(";for(let a=0;a<this.interiorRings[c].length;a++)i+=this._getWktCoordinate(this.interiorRings[c][a])+",";i=i.slice(0,-1),i+=")"}return i+=")",i}toWkb(i){const c=new r.BinaryWriter(this._getWkbSize());c.writeInt8(1),this._writeWkbType(c,t.CONSTANTS.wkb.Polygon,i),this.exteriorRing.length>0?(c.writeUInt32LE(1+this.interiorRings.length),c.writeUInt32LE(this.exteriorRing.length)):c.writeUInt32LE(0);for(let a=0;a<this.exteriorRing.length;a++)this.exteriorRing[a]._writeWkbPoint(c);for(let a=0;a<this.interiorRings.length;a++){c.writeUInt32LE(this.interiorRings[a].length);for(let d=0;d<this.interiorRings[a].length;d++)this.interiorRings[a][d]._writeWkbPoint(c)}return c.buffer}toTwkb(){const i=new r.BinaryWriter(0,!0),c=e.Geometry.getTwkbPrecision(5,0,0),a=this.exteriorRing.length===0;if(this._writeTwkbHeader(i,t.CONSTANTS.wkb.Polygon,c,a),this.exteriorRing.length>0){i.writeVarInt(1+this.interiorRings.length),i.writeVarInt(this.exteriorRing.length);const d=new e.Point(0,0,0,0);for(let f=0;f<this.exteriorRing.length;f++)this.exteriorRing[f]._writeTwkbPoint(i,c,d);for(let f=0;f<this.interiorRings.length;f++){i.writeVarInt(this.interiorRings[f].length);for(let y=0;y<this.interiorRings[f].length;y++)this.interiorRings[f][y]._writeTwkbPoint(i,c,d)}}return i.buffer}_getWkbSize(){let i=16;this.hasZ&&(i+=8),this.hasM&&(i+=8);let c=9;this.exteriorRing.length>0&&(c+=4+this.exteriorRing.length*i);for(let a=0;a<this.interiorRings.length;a++)c+=4+this.interiorRings[a].length*i;return c}toGeoJSON(i){const c=super.toGeoJSON(i);if(c.type=t.CONSTANTS.geoJSON.Polygon,c.coordinates=[],this.exteriorRing.length>0){const a=[];for(let d=0;d<this.exteriorRing.length;d++)this.hasZ?a.push([this.exteriorRing[d].x,this.exteriorRing[d].y,this.exteriorRing[d].z]):a.push([this.exteriorRing[d].x,this.exteriorRing[d].y]);c.coordinates.push(a)}for(let a=0;a<this.interiorRings.length;a++){const d=[];for(let f=0;f<this.interiorRings[a].length;f++)this.hasZ?d.push([this.interiorRings[a][f].x,this.interiorRings[a][f].y,this.interiorRings[a][f].z]):d.push([this.interiorRings[a][f].x,this.interiorRings[a][f].y]);c.coordinates.push(d)}return c}}return Yr.Polygon=n,Yr}var Jr={},Xo;function wf(){if(Xo)return Jr;Xo=1,Object.defineProperty(Jr,"__esModule",{value:!0}),Jr.WktParser=void 0;const r=$e(),t=Eu();class e{constructor(s){this.value=s,this.position=0}match(s){this.skipWhitespaces();for(let i=0;i<s.length;i++)if(this.value.substring(this.position).indexOf(s[i])===0)return this.position+=s[i].length,s[i];return null}matchRegex(s){this.skipWhitespaces();for(let i=0;i<s.length;i++){const c=this.value.substring(this.position).match(s[i]);if(c)return this.position+=c[0].length,c}return null}isMatch(s){this.skipWhitespaces();for(let i=0;i<s.length;i++)if(this.value.substring(this.position).indexOf(s[i])===0)return this.position+=s[i].length,!0;return!1}matchType(){const s=this.match([r.CONSTANTS.wkt.Point,r.CONSTANTS.wkt.LineString,r.CONSTANTS.wkt.Polygon,r.CONSTANTS.wkt.MultiPoint,r.CONSTANTS.wkt.MultiLineString,r.CONSTANTS.wkt.MultiPolygon,r.CONSTANTS.wkt.GeometryCollection]);if(!s)throw new Error("Expected geometry type");return s}matchDimension(){switch(this.match(["ZM","Z","M"])){case"ZM":return{hasZ:!0,hasM:!0};case"Z":return{hasZ:!0,hasM:!1};case"M":return{hasZ:!1,hasM:!0};default:return{hasZ:!1,hasM:!1}}}expectGroupStart(){if(!this.isMatch(["("]))throw new Error("Expected group start")}expectGroupEnd(){if(!this.isMatch([")"]))throw new Error("Expected group end")}matchCoordinate(s){let i;if(s.hasZ&&s.hasM?i=this.matchRegex([/^(\S*)\s+(\S*)\s+(\S*)\s+([^\s,)]*)/]):s.hasZ||s.hasM?i=this.matchRegex([/^(\S*)\s+(\S*)\s+([^\s,)]*)/]):i=this.matchRegex([/^(\S*)\s+([^\s,)]*)/]),!i)throw new Error("Expected coordinates");return s.hasZ&&s.hasM?new t.Point(parseFloat(i[1]),parseFloat(i[2]),parseFloat(i[3]),parseFloat(i[4])):s.hasZ?new t.Point(parseFloat(i[1]),parseFloat(i[2]),parseFloat(i[3]),0):s.hasM?new t.Point(parseFloat(i[1]),parseFloat(i[2]),0,parseFloat(i[3])):new t.Point(parseFloat(i[1]),parseFloat(i[2]),0,0)}matchCoordinates(s){const i=[];do{const c=this.isMatch(["("]);i.push(this.matchCoordinate(s)),c&&this.expectGroupEnd()}while(this.isMatch([","]));return i}skipWhitespaces(){for(;this.position<this.value.length&&this.value[this.position]===" ";)this.position++}}return Jr.WktParser=e,Jr}var Qo;function ze(){return Qo||(Qo=1,function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.ZigZag=r.WktParser=r.Polygon=r.Point=r.MultiPolygon=r.MultiPoint=r.MultiLineString=r.LineString=r.GeometryCollection=r.Geometry=r.CONSTANTS=r.BinaryWriter=r.BinaryReader=void 0;const t=hf();Object.defineProperty(r,"BinaryReader",{enumerable:!0,get:function(){return t.BinaryReader}});const e=Ke();Object.defineProperty(r,"BinaryWriter",{enumerable:!0,get:function(){return e.BinaryWriter}});const n=$e();Object.defineProperty(r,"CONSTANTS",{enumerable:!0,get:function(){return n.CONSTANTS}});const s=lf();Object.defineProperty(r,"Geometry",{enumerable:!0,get:function(){return s.Geometry}});const i=df();Object.defineProperty(r,"GeometryCollection",{enumerable:!0,get:function(){return i.GeometryCollection}});const c=ff();Object.defineProperty(r,"LineString",{enumerable:!0,get:function(){return c.LineString}});const a=pf();Object.defineProperty(r,"MultiLineString",{enumerable:!0,get:function(){return a.MultiLineString}});const d=yf();Object.defineProperty(r,"MultiPoint",{enumerable:!0,get:function(){return d.MultiPoint}});const f=gf();Object.defineProperty(r,"MultiPolygon",{enumerable:!0,get:function(){return f.MultiPolygon}});const y=Eu();Object.defineProperty(r,"Point",{enumerable:!0,get:function(){return y.Point}});const B=mf();Object.defineProperty(r,"Polygon",{enumerable:!0,get:function(){return B.Polygon}});const L=wf();Object.defineProperty(r,"WktParser",{enumerable:!0,get:function(){return L.WktParser}});const x=Au();Object.defineProperty(r,"ZigZag",{enumerable:!0,get:function(){return x.ZigZag}})}(Pi)),Pi}var bf=ze(),zi={};var ta;function _f(){return ta||(ta=1,function(r){const t=vu(),e=xu(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=a,r.SlowBuffer=C,r.INSPECT_MAX_BYTES=50;const s=2147483647;r.kMaxLength=s,a.TYPED_ARRAY_SUPPORT=i(),!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{const h=new Uint8Array(1),o={foo:function(){return 42}};return Object.setPrototypeOf(o,Uint8Array.prototype),Object.setPrototypeOf(h,o),h.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function c(h){if(h>s)throw new RangeError('The value "'+h+'" is invalid for option "size"');const o=new Uint8Array(h);return Object.setPrototypeOf(o,a.prototype),o}function a(h,o,u){if(typeof h=="number"){if(typeof o=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return B(h)}return d(h,o,u)}a.poolSize=8192;function d(h,o,u){if(typeof h=="string")return L(h,o);if(ArrayBuffer.isView(h))return M(h);if(h==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof h);if(mt(h,ArrayBuffer)||h&&mt(h.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(mt(h,SharedArrayBuffer)||h&&mt(h.buffer,SharedArrayBuffer)))return U(h,o,u);if(typeof h=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const l=h.valueOf&&h.valueOf();if(l!=null&&l!==h)return a.from(l,o,u);const p=F(h);if(p)return p;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof h[Symbol.toPrimitive]=="function")return a.from(h[Symbol.toPrimitive]("string"),o,u);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof h)}a.from=function(h,o,u){return d(h,o,u)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function f(h){if(typeof h!="number")throw new TypeError('"size" argument must be of type number');if(h<0)throw new RangeError('The value "'+h+'" is invalid for option "size"')}function y(h,o,u){return f(h),h<=0?c(h):o!==void 0?typeof u=="string"?c(h).fill(o,u):c(h).fill(o):c(h)}a.alloc=function(h,o,u){return y(h,o,u)};function B(h){return f(h),c(h<0?0:O(h)|0)}a.allocUnsafe=function(h){return B(h)},a.allocUnsafeSlow=function(h){return B(h)};function L(h,o){if((typeof o!="string"||o==="")&&(o="utf8"),!a.isEncoding(o))throw new TypeError("Unknown encoding: "+o);const u=P(h,o)|0;let l=c(u);const p=l.write(h,o);return p!==u&&(l=l.slice(0,p)),l}function x(h){const o=h.length<0?0:O(h.length)|0,u=c(o);for(let l=0;l<o;l+=1)u[l]=h[l]&255;return u}function M(h){if(mt(h,Uint8Array)){const o=new Uint8Array(h);return U(o.buffer,o.byteOffset,o.byteLength)}return x(h)}function U(h,o,u){if(o<0||h.byteLength<o)throw new RangeError('"offset" is outside of buffer bounds');if(h.byteLength<o+(u||0))throw new RangeError('"length" is outside of buffer bounds');let l;return o===void 0&&u===void 0?l=new Uint8Array(h):u===void 0?l=new Uint8Array(h,o):l=new Uint8Array(h,o,u),Object.setPrototypeOf(l,a.prototype),l}function F(h){if(a.isBuffer(h)){const o=O(h.length)|0,u=c(o);return u.length===0||h.copy(u,0,0,o),u}if(h.length!==void 0)return typeof h.length!="number"||Qt(h.length)?c(0):x(h);if(h.type==="Buffer"&&Array.isArray(h.data))return x(h.data)}function O(h){if(h>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return h|0}function C(h){return+h!=h&&(h=0),a.alloc(+h)}a.isBuffer=function(o){return o!=null&&o._isBuffer===!0&&o!==a.prototype},a.compare=function(o,u){if(mt(o,Uint8Array)&&(o=a.from(o,o.offset,o.byteLength)),mt(u,Uint8Array)&&(u=a.from(u,u.offset,u.byteLength)),!a.isBuffer(o)||!a.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(o===u)return 0;let l=o.length,p=u.length;for(let b=0,I=Math.min(l,p);b<I;++b)if(o[b]!==u[b]){l=o[b],p=u[b];break}return l<p?-1:p<l?1:0},a.isEncoding=function(o){switch(String(o).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(o,u){if(!Array.isArray(o))throw new TypeError('"list" argument must be an Array of Buffers');if(o.length===0)return a.alloc(0);let l;if(u===void 0)for(u=0,l=0;l<o.length;++l)u+=o[l].length;const p=a.allocUnsafe(u);let b=0;for(l=0;l<o.length;++l){let I=o[l];if(mt(I,Uint8Array))b+I.length>p.length?(a.isBuffer(I)||(I=a.from(I)),I.copy(p,b)):Uint8Array.prototype.set.call(p,I,b);else if(a.isBuffer(I))I.copy(p,b);else throw new TypeError('"list" argument must be an Array of Buffers');b+=I.length}return p};function P(h,o){if(a.isBuffer(h))return h.length;if(ArrayBuffer.isView(h)||mt(h,ArrayBuffer))return h.byteLength;if(typeof h!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof h);const u=h.length,l=arguments.length>2&&arguments[2]===!0;if(!l&&u===0)return 0;let p=!1;for(;;)switch(o){case"ascii":case"latin1":case"binary":return u;case"utf8":case"utf-8":return kt(h).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u*2;case"hex":return u>>>1;case"base64":return $t(h).length;default:if(p)return l?-1:kt(h).length;o=(""+o).toLowerCase(),p=!0}}a.byteLength=P;function V(h,o,u){let l=!1;if((o===void 0||o<0)&&(o=0),o>this.length||((u===void 0||u>this.length)&&(u=this.length),u<=0)||(u>>>=0,o>>>=0,u<=o))return"";for(h||(h="utf8");;)switch(h){case"hex":return X(this,o,u);case"utf8":case"utf-8":return z(this,o,u);case"ascii":return Y(this,o,u);case"latin1":case"binary":return Z(this,o,u);case"base64":return Q(this,o,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K(this,o,u);default:if(l)throw new TypeError("Unknown encoding: "+h);h=(h+"").toLowerCase(),l=!0}}a.prototype._isBuffer=!0;function G(h,o,u){const l=h[o];h[o]=h[u],h[u]=l}a.prototype.swap16=function(){const o=this.length;if(o%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let u=0;u<o;u+=2)G(this,u,u+1);return this},a.prototype.swap32=function(){const o=this.length;if(o%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let u=0;u<o;u+=4)G(this,u,u+3),G(this,u+1,u+2);return this},a.prototype.swap64=function(){const o=this.length;if(o%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let u=0;u<o;u+=8)G(this,u,u+7),G(this,u+1,u+6),G(this,u+2,u+5),G(this,u+3,u+4);return this},a.prototype.toString=function(){const o=this.length;return o===0?"":arguments.length===0?z(this,0,o):V.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(o){if(!a.isBuffer(o))throw new TypeError("Argument must be a Buffer");return this===o?!0:a.compare(this,o)===0},a.prototype.inspect=function(){let o="";const u=r.INSPECT_MAX_BYTES;return o=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(o+=" ... "),"<Buffer "+o+">"},n&&(a.prototype[n]=a.prototype.inspect),a.prototype.compare=function(o,u,l,p,b){if(mt(o,Uint8Array)&&(o=a.from(o,o.offset,o.byteLength)),!a.isBuffer(o))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof o);if(u===void 0&&(u=0),l===void 0&&(l=o?o.length:0),p===void 0&&(p=0),b===void 0&&(b=this.length),u<0||l>o.length||p<0||b>this.length)throw new RangeError("out of range index");if(p>=b&&u>=l)return 0;if(p>=b)return-1;if(u>=l)return 1;if(u>>>=0,l>>>=0,p>>>=0,b>>>=0,this===o)return 0;let I=b-p,H=l-u;const pt=Math.min(I,H),lt=this.slice(p,b),yt=o.slice(u,l);for(let et=0;et<pt;++et)if(lt[et]!==yt[et]){I=lt[et],H=yt[et];break}return I<H?-1:H<I?1:0};function A(h,o,u,l,p){if(h.length===0)return-1;if(typeof u=="string"?(l=u,u=0):u>2147483647?u=2147483647:u<-2147483648&&(u=-2147483648),u=+u,Qt(u)&&(u=p?0:h.length-1),u<0&&(u=h.length+u),u>=h.length){if(p)return-1;u=h.length-1}else if(u<0)if(p)u=0;else return-1;if(typeof o=="string"&&(o=a.from(o,l)),a.isBuffer(o))return o.length===0?-1:N(h,o,u,l,p);if(typeof o=="number")return o=o&255,typeof Uint8Array.prototype.indexOf=="function"?p?Uint8Array.prototype.indexOf.call(h,o,u):Uint8Array.prototype.lastIndexOf.call(h,o,u):N(h,[o],u,l,p);throw new TypeError("val must be string, number or Buffer")}function N(h,o,u,l,p){let b=1,I=h.length,H=o.length;if(l!==void 0&&(l=String(l).toLowerCase(),l==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(h.length<2||o.length<2)return-1;b=2,I/=2,H/=2,u/=2}function pt(yt,et){return b===1?yt[et]:yt.readUInt16BE(et*b)}let lt;if(p){let yt=-1;for(lt=u;lt<I;lt++)if(pt(h,lt)===pt(o,yt===-1?0:lt-yt)){if(yt===-1&&(yt=lt),lt-yt+1===H)return yt*b}else yt!==-1&&(lt-=lt-yt),yt=-1}else for(u+H>I&&(u=I-H),lt=u;lt>=0;lt--){let yt=!0;for(let et=0;et<H;et++)if(pt(h,lt+et)!==pt(o,et)){yt=!1;break}if(yt)return lt}return-1}a.prototype.includes=function(o,u,l){return this.indexOf(o,u,l)!==-1},a.prototype.indexOf=function(o,u,l){return A(this,o,u,l,!0)},a.prototype.lastIndexOf=function(o,u,l){return A(this,o,u,l,!1)};function m(h,o,u,l){u=Number(u)||0;const p=h.length-u;l?(l=Number(l),l>p&&(l=p)):l=p;const b=o.length;l>b/2&&(l=b/2);let I;for(I=0;I<l;++I){const H=parseInt(o.substr(I*2,2),16);if(Qt(H))return I;h[u+I]=H}return I}function S(h,o,u,l){return Nt(kt(o,h.length-u),h,u,l)}function w(h,o,u,l){return Nt(Ht(o),h,u,l)}function v(h,o,u,l){return Nt($t(o),h,u,l)}function k(h,o,u,l){return Nt(Vt(o,h.length-u),h,u,l)}a.prototype.write=function(o,u,l,p){if(u===void 0)p="utf8",l=this.length,u=0;else if(l===void 0&&typeof u=="string")p=u,l=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(l)?(l=l>>>0,p===void 0&&(p="utf8")):(p=l,l=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const b=this.length-u;if((l===void 0||l>b)&&(l=b),o.length>0&&(l<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");p||(p="utf8");let I=!1;for(;;)switch(p){case"hex":return m(this,o,u,l);case"utf8":case"utf-8":return S(this,o,u,l);case"ascii":case"latin1":case"binary":return w(this,o,u,l);case"base64":return v(this,o,u,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,o,u,l);default:if(I)throw new TypeError("Unknown encoding: "+p);p=(""+p).toLowerCase(),I=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Q(h,o,u){return o===0&&u===h.length?t.fromByteArray(h):t.fromByteArray(h.slice(o,u))}function z(h,o,u){u=Math.min(h.length,u);const l=[];let p=o;for(;p<u;){const b=h[p];let I=null,H=b>239?4:b>223?3:b>191?2:1;if(p+H<=u){let pt,lt,yt,et;switch(H){case 1:b<128&&(I=b);break;case 2:pt=h[p+1],(pt&192)===128&&(et=(b&31)<<6|pt&63,et>127&&(I=et));break;case 3:pt=h[p+1],lt=h[p+2],(pt&192)===128&&(lt&192)===128&&(et=(b&15)<<12|(pt&63)<<6|lt&63,et>2047&&(et<55296||et>57343)&&(I=et));break;case 4:pt=h[p+1],lt=h[p+2],yt=h[p+3],(pt&192)===128&&(lt&192)===128&&(yt&192)===128&&(et=(b&15)<<18|(pt&63)<<12|(lt&63)<<6|yt&63,et>65535&&et<1114112&&(I=et))}}I===null?(I=65533,H=1):I>65535&&(I-=65536,l.push(I>>>10&1023|55296),I=56320|I&1023),l.push(I),p+=H}return D(l)}const R=4096;function D(h){const o=h.length;if(o<=R)return String.fromCharCode.apply(String,h);let u="",l=0;for(;l<o;)u+=String.fromCharCode.apply(String,h.slice(l,l+=R));return u}function Y(h,o,u){let l="";u=Math.min(h.length,u);for(let p=o;p<u;++p)l+=String.fromCharCode(h[p]&127);return l}function Z(h,o,u){let l="";u=Math.min(h.length,u);for(let p=o;p<u;++p)l+=String.fromCharCode(h[p]);return l}function X(h,o,u){const l=h.length;(!o||o<0)&&(o=0),(!u||u<0||u>l)&&(u=l);let p="";for(let b=o;b<u;++b)p+=sr[h[b]];return p}function K(h,o,u){const l=h.slice(o,u);let p="";for(let b=0;b<l.length-1;b+=2)p+=String.fromCharCode(l[b]+l[b+1]*256);return p}a.prototype.slice=function(o,u){const l=this.length;o=~~o,u=u===void 0?l:~~u,o<0?(o+=l,o<0&&(o=0)):o>l&&(o=l),u<0?(u+=l,u<0&&(u=0)):u>l&&(u=l),u<o&&(u=o);const p=this.subarray(o,u);return Object.setPrototypeOf(p,a.prototype),p};function q(h,o,u){if(h%1!==0||h<0)throw new RangeError("offset is not uint");if(h+o>u)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(o,u,l){o=o>>>0,u=u>>>0,l||q(o,u,this.length);let p=this[o],b=1,I=0;for(;++I<u&&(b*=256);)p+=this[o+I]*b;return p},a.prototype.readUintBE=a.prototype.readUIntBE=function(o,u,l){o=o>>>0,u=u>>>0,l||q(o,u,this.length);let p=this[o+--u],b=1;for(;u>0&&(b*=256);)p+=this[o+--u]*b;return p},a.prototype.readUint8=a.prototype.readUInt8=function(o,u){return o=o>>>0,u||q(o,1,this.length),this[o]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(o,u){return o=o>>>0,u||q(o,2,this.length),this[o]|this[o+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(o,u){return o=o>>>0,u||q(o,2,this.length),this[o]<<8|this[o+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(o,u){return o=o>>>0,u||q(o,4,this.length),(this[o]|this[o+1]<<8|this[o+2]<<16)+this[o+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(o,u){return o=o>>>0,u||q(o,4,this.length),this[o]*16777216+(this[o+1]<<16|this[o+2]<<8|this[o+3])},a.prototype.readBigUInt64LE=Wt(function(o){o=o>>>0,$(o,"offset");const u=this[o],l=this[o+7];(u===void 0||l===void 0)&&J(o,this.length-8);const p=u+this[++o]*2**8+this[++o]*2**16+this[++o]*2**24,b=this[++o]+this[++o]*2**8+this[++o]*2**16+l*2**24;return BigInt(p)+(BigInt(b)<<BigInt(32))}),a.prototype.readBigUInt64BE=Wt(function(o){o=o>>>0,$(o,"offset");const u=this[o],l=this[o+7];(u===void 0||l===void 0)&&J(o,this.length-8);const p=u*2**24+this[++o]*2**16+this[++o]*2**8+this[++o],b=this[++o]*2**24+this[++o]*2**16+this[++o]*2**8+l;return(BigInt(p)<<BigInt(32))+BigInt(b)}),a.prototype.readIntLE=function(o,u,l){o=o>>>0,u=u>>>0,l||q(o,u,this.length);let p=this[o],b=1,I=0;for(;++I<u&&(b*=256);)p+=this[o+I]*b;return b*=128,p>=b&&(p-=Math.pow(2,8*u)),p},a.prototype.readIntBE=function(o,u,l){o=o>>>0,u=u>>>0,l||q(o,u,this.length);let p=u,b=1,I=this[o+--p];for(;p>0&&(b*=256);)I+=this[o+--p]*b;return b*=128,I>=b&&(I-=Math.pow(2,8*u)),I},a.prototype.readInt8=function(o,u){return o=o>>>0,u||q(o,1,this.length),this[o]&128?(255-this[o]+1)*-1:this[o]},a.prototype.readInt16LE=function(o,u){o=o>>>0,u||q(o,2,this.length);const l=this[o]|this[o+1]<<8;return l&32768?l|4294901760:l},a.prototype.readInt16BE=function(o,u){o=o>>>0,u||q(o,2,this.length);const l=this[o+1]|this[o]<<8;return l&32768?l|4294901760:l},a.prototype.readInt32LE=function(o,u){return o=o>>>0,u||q(o,4,this.length),this[o]|this[o+1]<<8|this[o+2]<<16|this[o+3]<<24},a.prototype.readInt32BE=function(o,u){return o=o>>>0,u||q(o,4,this.length),this[o]<<24|this[o+1]<<16|this[o+2]<<8|this[o+3]},a.prototype.readBigInt64LE=Wt(function(o){o=o>>>0,$(o,"offset");const u=this[o],l=this[o+7];(u===void 0||l===void 0)&&J(o,this.length-8);const p=this[o+4]+this[o+5]*2**8+this[o+6]*2**16+(l<<24);return(BigInt(p)<<BigInt(32))+BigInt(u+this[++o]*2**8+this[++o]*2**16+this[++o]*2**24)}),a.prototype.readBigInt64BE=Wt(function(o){o=o>>>0,$(o,"offset");const u=this[o],l=this[o+7];(u===void 0||l===void 0)&&J(o,this.length-8);const p=(u<<24)+this[++o]*2**16+this[++o]*2**8+this[++o];return(BigInt(p)<<BigInt(32))+BigInt(this[++o]*2**24+this[++o]*2**16+this[++o]*2**8+l)}),a.prototype.readFloatLE=function(o,u){return o=o>>>0,u||q(o,4,this.length),e.read(this,o,!0,23,4)},a.prototype.readFloatBE=function(o,u){return o=o>>>0,u||q(o,4,this.length),e.read(this,o,!1,23,4)},a.prototype.readDoubleLE=function(o,u){return o=o>>>0,u||q(o,8,this.length),e.read(this,o,!0,52,8)},a.prototype.readDoubleBE=function(o,u){return o=o>>>0,u||q(o,8,this.length),e.read(this,o,!1,52,8)};function rt(h,o,u,l,p,b){if(!a.isBuffer(h))throw new TypeError('"buffer" argument must be a Buffer instance');if(o>p||o<b)throw new RangeError('"value" argument is out of bounds');if(u+l>h.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(o,u,l,p){if(o=+o,u=u>>>0,l=l>>>0,!p){const H=Math.pow(2,8*l)-1;rt(this,o,u,l,H,0)}let b=1,I=0;for(this[u]=o&255;++I<l&&(b*=256);)this[u+I]=o/b&255;return u+l},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(o,u,l,p){if(o=+o,u=u>>>0,l=l>>>0,!p){const H=Math.pow(2,8*l)-1;rt(this,o,u,l,H,0)}let b=l-1,I=1;for(this[u+b]=o&255;--b>=0&&(I*=256);)this[u+b]=o/I&255;return u+l},a.prototype.writeUint8=a.prototype.writeUInt8=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,1,255,0),this[u]=o&255,u+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,2,65535,0),this[u]=o&255,this[u+1]=o>>>8,u+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,2,65535,0),this[u]=o>>>8,this[u+1]=o&255,u+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,4,4294967295,0),this[u+3]=o>>>24,this[u+2]=o>>>16,this[u+1]=o>>>8,this[u]=o&255,u+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,4,4294967295,0),this[u]=o>>>24,this[u+1]=o>>>16,this[u+2]=o>>>8,this[u+3]=o&255,u+4};function At(h,o,u,l,p){j(o,l,p,h,u,7);let b=Number(o&BigInt(4294967295));h[u++]=b,b=b>>8,h[u++]=b,b=b>>8,h[u++]=b,b=b>>8,h[u++]=b;let I=Number(o>>BigInt(32)&BigInt(4294967295));return h[u++]=I,I=I>>8,h[u++]=I,I=I>>8,h[u++]=I,I=I>>8,h[u++]=I,u}function Ut(h,o,u,l,p){j(o,l,p,h,u,7);let b=Number(o&BigInt(4294967295));h[u+7]=b,b=b>>8,h[u+6]=b,b=b>>8,h[u+5]=b,b=b>>8,h[u+4]=b;let I=Number(o>>BigInt(32)&BigInt(4294967295));return h[u+3]=I,I=I>>8,h[u+2]=I,I=I>>8,h[u+1]=I,I=I>>8,h[u]=I,u+8}a.prototype.writeBigUInt64LE=Wt(function(o,u=0){return At(this,o,u,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=Wt(function(o,u=0){return Ut(this,o,u,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(o,u,l,p){if(o=+o,u=u>>>0,!p){const pt=Math.pow(2,8*l-1);rt(this,o,u,l,pt-1,-pt)}let b=0,I=1,H=0;for(this[u]=o&255;++b<l&&(I*=256);)o<0&&H===0&&this[u+b-1]!==0&&(H=1),this[u+b]=(o/I>>0)-H&255;return u+l},a.prototype.writeIntBE=function(o,u,l,p){if(o=+o,u=u>>>0,!p){const pt=Math.pow(2,8*l-1);rt(this,o,u,l,pt-1,-pt)}let b=l-1,I=1,H=0;for(this[u+b]=o&255;--b>=0&&(I*=256);)o<0&&H===0&&this[u+b+1]!==0&&(H=1),this[u+b]=(o/I>>0)-H&255;return u+l},a.prototype.writeInt8=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,1,127,-128),o<0&&(o=255+o+1),this[u]=o&255,u+1},a.prototype.writeInt16LE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,2,32767,-32768),this[u]=o&255,this[u+1]=o>>>8,u+2},a.prototype.writeInt16BE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,2,32767,-32768),this[u]=o>>>8,this[u+1]=o&255,u+2},a.prototype.writeInt32LE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,4,2147483647,-2147483648),this[u]=o&255,this[u+1]=o>>>8,this[u+2]=o>>>16,this[u+3]=o>>>24,u+4},a.prototype.writeInt32BE=function(o,u,l){return o=+o,u=u>>>0,l||rt(this,o,u,4,2147483647,-2147483648),o<0&&(o=4294967295+o+1),this[u]=o>>>24,this[u+1]=o>>>16,this[u+2]=o>>>8,this[u+3]=o&255,u+4},a.prototype.writeBigInt64LE=Wt(function(o,u=0){return At(this,o,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=Wt(function(o,u=0){return Ut(this,o,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Pt(h,o,u,l,p,b){if(u+l>h.length)throw new RangeError("Index out of range");if(u<0)throw new RangeError("Index out of range")}function Zt(h,o,u,l,p){return o=+o,u=u>>>0,p||Pt(h,o,u,4),e.write(h,o,u,l,23,4),u+4}a.prototype.writeFloatLE=function(o,u,l){return Zt(this,o,u,!0,l)},a.prototype.writeFloatBE=function(o,u,l){return Zt(this,o,u,!1,l)};function Gt(h,o,u,l,p){return o=+o,u=u>>>0,p||Pt(h,o,u,8),e.write(h,o,u,l,52,8),u+8}a.prototype.writeDoubleLE=function(o,u,l){return Gt(this,o,u,!0,l)},a.prototype.writeDoubleBE=function(o,u,l){return Gt(this,o,u,!1,l)},a.prototype.copy=function(o,u,l,p){if(!a.isBuffer(o))throw new TypeError("argument should be a Buffer");if(l||(l=0),!p&&p!==0&&(p=this.length),u>=o.length&&(u=o.length),u||(u=0),p>0&&p<l&&(p=l),p===l||o.length===0||this.length===0)return 0;if(u<0)throw new RangeError("targetStart out of bounds");if(l<0||l>=this.length)throw new RangeError("Index out of range");if(p<0)throw new RangeError("sourceEnd out of bounds");p>this.length&&(p=this.length),o.length-u<p-l&&(p=o.length-u+l);const b=p-l;return this===o&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,l,p):Uint8Array.prototype.set.call(o,this.subarray(l,p),u),b},a.prototype.fill=function(o,u,l,p){if(typeof o=="string"){if(typeof u=="string"?(p=u,u=0,l=this.length):typeof l=="string"&&(p=l,l=this.length),p!==void 0&&typeof p!="string")throw new TypeError("encoding must be a string");if(typeof p=="string"&&!a.isEncoding(p))throw new TypeError("Unknown encoding: "+p);if(o.length===1){const I=o.charCodeAt(0);(p==="utf8"&&I<128||p==="latin1")&&(o=I)}}else typeof o=="number"?o=o&255:typeof o=="boolean"&&(o=Number(o));if(u<0||this.length<u||this.length<l)throw new RangeError("Out of range index");if(l<=u)return this;u=u>>>0,l=l===void 0?this.length:l>>>0,o||(o=0);let b;if(typeof o=="number")for(b=u;b<l;++b)this[b]=o;else{const I=a.isBuffer(o)?o:a.from(o,p),H=I.length;if(H===0)throw new TypeError('The value "'+o+'" is invalid for argument "value"');for(b=0;b<l-u;++b)this[b+u]=I[b%H]}return this};const W={};function g(h,o,u){W[h]=class extends u{constructor(){super(),Object.defineProperty(this,"message",{value:o.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${h}]`,this.stack,delete this.name}get code(){return h}set code(p){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:p,writable:!0})}toString(){return`${this.name} [${h}]: ${this.message}`}}}g("ERR_BUFFER_OUT_OF_BOUNDS",function(h){return h?`${h} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),g("ERR_INVALID_ARG_TYPE",function(h,o){return`The "${h}" argument must be of type number. Received type ${typeof o}`},TypeError),g("ERR_OUT_OF_RANGE",function(h,o,u){let l=`The value of "${h}" is out of range.`,p=u;return Number.isInteger(u)&&Math.abs(u)>2**32?p=_(String(u)):typeof u=="bigint"&&(p=String(u),(u>BigInt(2)**BigInt(32)||u<-(BigInt(2)**BigInt(32)))&&(p=_(p)),p+="n"),l+=` It must be ${o}. Received ${p}`,l},RangeError);function _(h){let o="",u=h.length;const l=h[0]==="-"?1:0;for(;u>=l+4;u-=3)o=`_${h.slice(u-3,u)}${o}`;return`${h.slice(0,u)}${o}`}function T(h,o,u){$(o,"offset"),(h[o]===void 0||h[o+u]===void 0)&&J(o,h.length-(u+1))}function j(h,o,u,l,p,b){if(h>u||h<o){const I=typeof o=="bigint"?"n":"";let H;throw o===0||o===BigInt(0)?H=`>= 0${I} and < 2${I} ** ${(b+1)*8}${I}`:H=`>= -(2${I} ** ${(b+1)*8-1}${I}) and < 2 ** ${(b+1)*8-1}${I}`,new W.ERR_OUT_OF_RANGE("value",H,h)}T(l,p,b)}function $(h,o){if(typeof h!="number")throw new W.ERR_INVALID_ARG_TYPE(o,"number",h)}function J(h,o,u){throw Math.floor(h)!==h?($(h,u),new W.ERR_OUT_OF_RANGE("offset","an integer",h)):o<0?new W.ERR_BUFFER_OUT_OF_BOUNDS:new W.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${o}`,h)}const bt=/[^+/0-9A-Za-z-_]/g;function Ot(h){if(h=h.split("=")[0],h=h.trim().replace(bt,""),h.length<2)return"";for(;h.length%4!==0;)h=h+"=";return h}function kt(h,o){o=o||1/0;let u;const l=h.length;let p=null;const b=[];for(let I=0;I<l;++I){if(u=h.charCodeAt(I),u>55295&&u<57344){if(!p){if(u>56319){(o-=3)>-1&&b.push(239,191,189);continue}else if(I+1===l){(o-=3)>-1&&b.push(239,191,189);continue}p=u;continue}if(u<56320){(o-=3)>-1&&b.push(239,191,189),p=u;continue}u=(p-55296<<10|u-56320)+65536}else p&&(o-=3)>-1&&b.push(239,191,189);if(p=null,u<128){if((o-=1)<0)break;b.push(u)}else if(u<2048){if((o-=2)<0)break;b.push(u>>6|192,u&63|128)}else if(u<65536){if((o-=3)<0)break;b.push(u>>12|224,u>>6&63|128,u&63|128)}else if(u<1114112){if((o-=4)<0)break;b.push(u>>18|240,u>>12&63|128,u>>6&63|128,u&63|128)}else throw new Error("Invalid code point")}return b}function Ht(h){const o=[];for(let u=0;u<h.length;++u)o.push(h.charCodeAt(u)&255);return o}function Vt(h,o){let u,l,p;const b=[];for(let I=0;I<h.length&&!((o-=2)<0);++I)u=h.charCodeAt(I),l=u>>8,p=u%256,b.push(p),b.push(l);return b}function $t(h){return t.toByteArray(Ot(h))}function Nt(h,o,u,l){let p;for(p=0;p<l&&!(p+u>=o.length||p>=h.length);++p)o[p+u]=h[p];return p}function mt(h,o){return h instanceof o||h!=null&&h.constructor!=null&&h.constructor.name!=null&&h.constructor.name===o.name}function Qt(h){return h!==h}const sr=function(){const h="0123456789abcdef",o=new Array(256);for(let u=0;u<16;++u){const l=u*16;for(let p=0;p<16;++p)o[l+p]=h[u]+h[p]}return o}();function Wt(h){return typeof BigInt>"u"?Fi:h}function Fi(){throw new Error("BigInt not supported")}}(zi)),zi}var Tu=_f();function Ei(r){return new Promise((t,e)=>{r.oncomplete=r.onsuccess=()=>t(r.result),r.onabort=r.onerror=()=>e(r.error)})}function Mu(r,t){const e=indexedDB.open(r);e.onupgradeneeded=()=>e.result.createObjectStore(t);const n=Ei(e);return(s,i)=>n.then(c=>i(c.transaction(t,s).objectStore(t)))}let ji;function Zs(){return ji||(ji=Mu("keyval-store","keyval")),ji}function Vi(r,t=Zs()){return t("readonly",e=>Ei(e.get(r)))}function ea(r,t,e=Zs()){return e("readwrite",n=>(n.put(t,r),Ei(n.transaction)))}function xn(r,t=Zs()){return t("readwrite",e=>(e.delete(r),Ei(e.transaction)))}function An(r){throw new Error('Could not dynamically require "'+r+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var Wi={exports:{}},ra;function Sf(){return ra||(ra=1,function(r,t){(function(e){r.exports=e()})(function(){return function e(n,s,i){function c(f,y){if(!s[f]){if(!n[f]){var B=typeof An=="function"&&An;if(!y&&B)return B(f,!0);if(a)return a(f,!0);throw new Error("Cannot find module '"+f+"'")}y=s[f]={exports:{}},n[f][0].call(y.exports,function(L){var x=n[f][1][L];return c(x||L)},y,y.exports,e,n,s,i)}return s[f].exports}for(var a=typeof An=="function"&&An,d=0;d<i.length;d++)c(i[d]);return c}({1:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){var M=e("crypto");function U(A,N){N=C(A,N);var m;return(m=N.algorithm!=="passthrough"?M.createHash(N.algorithm):new G).write===void 0&&(m.write=m.update,m.end=m.update),V(N,m).dispatch(A),m.update||m.end(""),m.digest?m.digest(N.encoding==="buffer"?void 0:N.encoding):(A=m.read(),N.encoding!=="buffer"?A.toString(N.encoding):A)}(s=n.exports=U).sha1=function(A){return U(A)},s.keys=function(A){return U(A,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},s.MD5=function(A){return U(A,{algorithm:"md5",encoding:"hex"})},s.keysMD5=function(A){return U(A,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var F=M.getHashes?M.getHashes().slice():["sha1","md5"],O=(F.push("passthrough"),["buffer","hex","binary","base64"]);function C(A,N){var m={};if(m.algorithm=(N=N||{}).algorithm||"sha1",m.encoding=N.encoding||"hex",m.excludeValues=!!N.excludeValues,m.algorithm=m.algorithm.toLowerCase(),m.encoding=m.encoding.toLowerCase(),m.ignoreUnknown=N.ignoreUnknown===!0,m.respectType=N.respectType!==!1,m.respectFunctionNames=N.respectFunctionNames!==!1,m.respectFunctionProperties=N.respectFunctionProperties!==!1,m.unorderedArrays=N.unorderedArrays===!0,m.unorderedSets=N.unorderedSets!==!1,m.unorderedObjects=N.unorderedObjects!==!1,m.replacer=N.replacer||void 0,m.excludeKeys=N.excludeKeys||void 0,A===void 0)throw new Error("Object argument required.");for(var S=0;S<F.length;++S)F[S].toLowerCase()===m.algorithm.toLowerCase()&&(m.algorithm=F[S]);if(F.indexOf(m.algorithm)===-1)throw new Error('Algorithm "'+m.algorithm+'" not supported. supported values: '+F.join(", "));if(O.indexOf(m.encoding)===-1&&m.algorithm!=="passthrough")throw new Error('Encoding "'+m.encoding+'" not supported. supported values: '+O.join(", "));return m}function P(A){if(typeof A=="function")return/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(A))!=null}function V(A,N,m){m=m||[];function S(w){return N.update?N.update(w,"utf8"):N.write(w,"utf8")}return{dispatch:function(w){return this["_"+((w=A.replacer?A.replacer(w):w)===null?"null":typeof w)](w)},_object:function(w){var v,k=Object.prototype.toString.call(w),Q=/\[object (.*)\]/i.exec(k);if(Q=(Q=Q?Q[1]:"unknown:["+k+"]").toLowerCase(),0<=(k=m.indexOf(w)))return this.dispatch("[CIRCULAR:"+k+"]");if(m.push(w),a!==void 0&&a.isBuffer&&a.isBuffer(w))return S("buffer:"),S(w);if(Q==="object"||Q==="function"||Q==="asyncfunction")return k=Object.keys(w),A.unorderedObjects&&(k=k.sort()),A.respectType===!1||P(w)||k.splice(0,0,"prototype","__proto__","constructor"),A.excludeKeys&&(k=k.filter(function(z){return!A.excludeKeys(z)})),S("object:"+k.length+":"),v=this,k.forEach(function(z){v.dispatch(z),S(":"),A.excludeValues||v.dispatch(w[z]),S(",")});if(!this["_"+Q]){if(A.ignoreUnknown)return S("["+Q+"]");throw new Error('Unknown object type "'+Q+'"')}this["_"+Q](w)},_array:function(w,z){z=z!==void 0?z:A.unorderedArrays!==!1;var k=this;if(S("array:"+w.length+":"),!z||w.length<=1)return w.forEach(function(R){return k.dispatch(R)});var Q=[],z=w.map(function(R){var D=new G,Y=m.slice();return V(A,D,Y).dispatch(R),Q=Q.concat(Y.slice(m.length)),D.read().toString()});return m=m.concat(Q),z.sort(),this._array(z,!1)},_date:function(w){return S("date:"+w.toJSON())},_symbol:function(w){return S("symbol:"+w.toString())},_error:function(w){return S("error:"+w.toString())},_boolean:function(w){return S("bool:"+w.toString())},_string:function(w){S("string:"+w.length+":"),S(w.toString())},_function:function(w){S("fn:"),P(w)?this.dispatch("[native]"):this.dispatch(w.toString()),A.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(w.name)),A.respectFunctionProperties&&this._object(w)},_number:function(w){return S("number:"+w.toString())},_xml:function(w){return S("xml:"+w.toString())},_null:function(){return S("Null")},_undefined:function(){return S("Undefined")},_regexp:function(w){return S("regex:"+w.toString())},_uint8array:function(w){return S("uint8array:"),this.dispatch(Array.prototype.slice.call(w))},_uint8clampedarray:function(w){return S("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(w))},_int8array:function(w){return S("int8array:"),this.dispatch(Array.prototype.slice.call(w))},_uint16array:function(w){return S("uint16array:"),this.dispatch(Array.prototype.slice.call(w))},_int16array:function(w){return S("int16array:"),this.dispatch(Array.prototype.slice.call(w))},_uint32array:function(w){return S("uint32array:"),this.dispatch(Array.prototype.slice.call(w))},_int32array:function(w){return S("int32array:"),this.dispatch(Array.prototype.slice.call(w))},_float32array:function(w){return S("float32array:"),this.dispatch(Array.prototype.slice.call(w))},_float64array:function(w){return S("float64array:"),this.dispatch(Array.prototype.slice.call(w))},_arraybuffer:function(w){return S("arraybuffer:"),this.dispatch(new Uint8Array(w))},_url:function(w){return S("url:"+w.toString())},_map:function(w){return S("map:"),w=Array.from(w),this._array(w,A.unorderedSets!==!1)},_set:function(w){return S("set:"),w=Array.from(w),this._array(w,A.unorderedSets!==!1)},_file:function(w){return S("file:"),this.dispatch([w.name,w.size,w.type,w.lastModfied])},_blob:function(){if(A.ignoreUnknown)return S("[blob]");throw Error(`Hashing Blob objects is currently not supported
|
|
5
5
|
(see https://github.com/puleos/object-hash/issues/26)
|
|
6
6
|
Use "options.replacer" or "options.ignoreUnknown"
|
|
7
|
-
`)},_domwindow:function(){return S("domwindow")},_bigint:function(w){return S("bigint:"+w.toString())},_process:function(){return S("process")},_timer:function(){return S("timer")},_pipe:function(){return S("pipe")},_tcp:function(){return S("tcp")},_udp:function(){return S("udp")},_tty:function(){return S("tty")},_statwatcher:function(){return S("statwatcher")},_securecontext:function(){return S("securecontext")},_connection:function(){return S("connection")},_zlib:function(){return S("zlib")},_context:function(){return S("context")},_nodescript:function(){return S("nodescript")},_httpparser:function(){return S("httpparser")},_dataview:function(){return S("dataview")},_signal:function(){return S("signal")},_fsevent:function(){return S("fsevent")},_tlswrap:function(){return S("tlswrap")}}}function G(){return{buf:"",write:function(A){this.buf+=A},end:function(A){this.buf+=A},read:function(){return this.buf}}}s.writeToStream=function(A,N,m){return m===void 0&&(m=N,N={}),V(N=C(A,N),m).dispatch(A)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_9a5aa49d.js","/")},{buffer:3,crypto:5,lYpoI2:11}],2:[function(e,n,s){(function(i,a,
|
|
8
|
-
list should be an Array.`),g.length===0)return new F(0);if(g.length===1)return g[0];if(typeof _!="number")for($=_=0;$<g.length;$++)_+=g[$].length;for(var T=new F(_),j=0,$=0;$<g.length;$++){var J=g[$];J.copy(T,j),j+=J.length}return T},F.prototype.write=function(g,_,T,j){isFinite(_)?isFinite(T)||(j=T,T=void 0):(kt=j,j=_,_=T,T=kt),_=Number(_)||0;var $,J,bt,Ot,kt=this.length-_;switch((!T||kt<(T=Number(T)))&&(T=kt),j=String(j||"utf8").toLowerCase()){case"hex":$=function(Ht,Vt,$t,Nt){$t=Number($t)||0;var mt=Ht.length-$t;(!Nt||mt<(Nt=Number(Nt)))&&(Nt=mt),W((mt=Vt.length)%2==0,"Invalid hex string"),mt/2<Nt&&(Nt=mt/2);for(var Qt=0;Qt<Nt;Qt++){var sr=parseInt(Vt.substr(2*Qt,2),16);W(!isNaN(sr),"Invalid hex string"),Ht[$t+Qt]=sr}return F._charsWritten=2*Qt,Qt}(this,g,_,T);break;case"utf8":case"utf-8":J=this,bt=_,Ot=T,$=F._charsWritten=At(q(g),J,bt,Ot);break;case"ascii":case"binary":$=O(this,g,_,T);break;case"base64":J=this,bt=_,Ot=T,$=F._charsWritten=At(rt(g),J,bt,Ot);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":$=C(this,g,_,T);break;default:throw new Error("Unknown encoding")}return $},F.prototype.toString=function(g,_,T){var j,$,J,bt,Ot=this;if(g=String(g||"utf8").toLowerCase(),_=Number(_)||0,(T=T!==void 0?Number(T):Ot.length)===_)return"";switch(g){case"hex":j=function(kt,Ht,Vt){var $t=kt.length;(!Ht||Ht<0)&&(Ht=0),(!Vt||Vt<0||$t<Vt)&&(Vt=$t);for(var Nt="",mt=Ht;mt<Vt;mt++)Nt+=K(kt[mt]);return Nt}(Ot,_,T);break;case"utf8":case"utf-8":j=function(kt,Ht,Vt){var $t="",Nt="";Vt=Math.min(kt.length,Vt);for(var mt=Ht;mt<Vt;mt++)kt[mt]<=127?($t+=Ut(Nt)+String.fromCharCode(kt[mt]),Nt=""):Nt+="%"+kt[mt].toString(16);return $t+Ut(Nt)}(Ot,_,T);break;case"ascii":case"binary":j=P(Ot,_,T);break;case"base64":$=Ot,bt=T,j=(J=_)===0&&bt===$.length?M.fromByteArray($):M.fromByteArray($.slice(J,bt));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":j=function(kt,Ht,Vt){for(var $t=kt.slice(Ht,Vt),Nt="",mt=0;mt<$t.length;mt+=2)Nt+=String.fromCharCode($t[mt]+256*$t[mt+1]);return Nt}(Ot,_,T);break;default:throw new Error("Unknown encoding")}return j},F.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},F.prototype.copy=function(g,_,T,j){if(_=_||0,(j=j||j===0?j:this.length)!==(T=T||0)&&g.length!==0&&this.length!==0){W(T<=j,"sourceEnd < sourceStart"),W(0<=_&&_<g.length,"targetStart out of bounds"),W(0<=T&&T<this.length,"sourceStart out of bounds"),W(0<=j&&j<=this.length,"sourceEnd out of bounds"),j>this.length&&(j=this.length);var $=(j=g.length-_<j-T?g.length-_+T:j)-T;if($<100||!F._useTypedArrays)for(var J=0;J<$;J++)g[J+_]=this[J+T];else g._set(this.subarray(T,T+$),_)}},F.prototype.slice=function(g,_){var T=this.length;if(g=Y(g,T,0),_=Y(_,T,T),F._useTypedArrays)return F._augment(this.subarray(g,_));for(var j=_-g,$=new F(j,void 0,!0),J=0;J<j;J++)$[J]=this[J+g];return $},F.prototype.get=function(g){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(g)},F.prototype.set=function(g,_){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(g,_)},F.prototype.readUInt8=function(g,_){if(_||(W(g!=null,"missing offset"),W(g<this.length,"Trying to read beyond buffer length")),!(g>=this.length))return this[g]},F.prototype.readUInt16LE=function(g,_){return V(this,g,!0,_)},F.prototype.readUInt16BE=function(g,_){return V(this,g,!1,_)},F.prototype.readUInt32LE=function(g,_){return G(this,g,!0,_)},F.prototype.readUInt32BE=function(g,_){return G(this,g,!1,_)},F.prototype.readInt8=function(g,_){if(_||(W(g!=null,"missing offset"),W(g<this.length,"Trying to read beyond buffer length")),!(g>=this.length))return 128&this[g]?-1*(255-this[g]+1):this[g]},F.prototype.readInt16LE=function(g,_){return A(this,g,!0,_)},F.prototype.readInt16BE=function(g,_){return A(this,g,!1,_)},F.prototype.readInt32LE=function(g,_){return N(this,g,!0,_)},F.prototype.readInt32BE=function(g,_){return N(this,g,!1,_)},F.prototype.readFloatLE=function(g,_){return m(this,g,!0,_)},F.prototype.readFloatBE=function(g,_){return m(this,g,!1,_)},F.prototype.readDoubleLE=function(g,_){return S(this,g,!0,_)},F.prototype.readDoubleBE=function(g,_){return S(this,g,!1,_)},F.prototype.writeUInt8=function(g,_,T){T||(W(g!=null,"missing value"),W(_!=null,"missing offset"),W(_<this.length,"trying to write beyond buffer length"),Pt(g,255)),_>=this.length||(this[_]=g)},F.prototype.writeUInt16LE=function(g,_,T){w(this,g,_,!0,T)},F.prototype.writeUInt16BE=function(g,_,T){w(this,g,_,!1,T)},F.prototype.writeUInt32LE=function(g,_,T){v(this,g,_,!0,T)},F.prototype.writeUInt32BE=function(g,_,T){v(this,g,_,!1,T)},F.prototype.writeInt8=function(g,_,T){T||(W(g!=null,"missing value"),W(_!=null,"missing offset"),W(_<this.length,"Trying to write beyond buffer length"),Zt(g,127,-128)),_>=this.length||(0<=g?this.writeUInt8(g,_,T):this.writeUInt8(255+g+1,_,T))},F.prototype.writeInt16LE=function(g,_,T){k(this,g,_,!0,T)},F.prototype.writeInt16BE=function(g,_,T){k(this,g,_,!1,T)},F.prototype.writeInt32LE=function(g,_,T){Q(this,g,_,!0,T)},F.prototype.writeInt32BE=function(g,_,T){Q(this,g,_,!1,T)},F.prototype.writeFloatLE=function(g,_,T){z(this,g,_,!0,T)},F.prototype.writeFloatBE=function(g,_,T){z(this,g,_,!1,T)},F.prototype.writeDoubleLE=function(g,_,T){R(this,g,_,!0,T)},F.prototype.writeDoubleBE=function(g,_,T){R(this,g,_,!1,T)},F.prototype.fill=function(g,_,T){if(_=_||0,T=T||this.length,W(typeof(g=typeof(g=g||0)=="string"?g.charCodeAt(0):g)=="number"&&!isNaN(g),"value is not a number"),W(_<=T,"end < start"),T!==_&&this.length!==0){W(0<=_&&_<this.length,"start out of bounds"),W(0<=T&&T<=this.length,"end out of bounds");for(var j=_;j<T;j++)this[j]=g}},F.prototype.inspect=function(){for(var g=[],_=this.length,T=0;T<_;T++)if(g[T]=K(this[T]),T===s.INSPECT_MAX_BYTES){g[T+1]="...";break}return"<Buffer "+g.join(" ")+">"},F.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(F._useTypedArrays)return new F(this).buffer;for(var g=new Uint8Array(this.length),_=0,T=g.length;_<T;_+=1)g[_]=this[_];return g.buffer};var D=F.prototype;function Y(g,_,T){return typeof g!="number"?T:_<=(g=~~g)?_:0<=g||0<=(g+=_)?g:0}function Z(g){return(g=~~Math.ceil(+g))<0?0:g}function X(g){return(Array.isArray||function(_){return Object.prototype.toString.call(_)==="[object Array]"})(g)}function K(g){return g<16?"0"+g.toString(16):g.toString(16)}function q(g){for(var _=[],T=0;T<g.length;T++){var j=g.charCodeAt(T);if(j<=127)_.push(g.charCodeAt(T));else for(var $=T,J=(55296<=j&&j<=57343&&T++,encodeURIComponent(g.slice($,T+1)).substr(1).split("%")),bt=0;bt<J.length;bt++)_.push(parseInt(J[bt],16))}return _}function rt(g){return M.toByteArray(g)}function At(g,_,T,j){for(var $=0;$<j&&!($+T>=_.length||$>=g.length);$++)_[$+T]=g[$];return $}function Ut(g){try{return decodeURIComponent(g)}catch{return"�"}}function Pt(g,_){W(typeof g=="number","cannot write a non-number as a number"),W(0<=g,"specified a negative value for writing an unsigned value"),W(g<=_,"value is larger than maximum value for type"),W(Math.floor(g)===g,"value has a fractional component")}function Zt(g,_,T){W(typeof g=="number","cannot write a non-number as a number"),W(g<=_,"value larger than maximum allowed value"),W(T<=g,"value smaller than minimum allowed value"),W(Math.floor(g)===g,"value has a fractional component")}function Gt(g,_,T){W(typeof g=="number","cannot write a non-number as a number"),W(g<=_,"value larger than maximum allowed value"),W(T<=g,"value smaller than minimum allowed value")}function W(g,_){if(!g)throw new Error(_||"Failed assertion")}F._augment=function(g){return g._isBuffer=!0,g._get=g.get,g._set=g.set,g.get=D.get,g.set=D.set,g.write=D.write,g.toString=D.toString,g.toLocaleString=D.toString,g.toJSON=D.toJSON,g.copy=D.copy,g.slice=D.slice,g.readUInt8=D.readUInt8,g.readUInt16LE=D.readUInt16LE,g.readUInt16BE=D.readUInt16BE,g.readUInt32LE=D.readUInt32LE,g.readUInt32BE=D.readUInt32BE,g.readInt8=D.readInt8,g.readInt16LE=D.readInt16LE,g.readInt16BE=D.readInt16BE,g.readInt32LE=D.readInt32LE,g.readInt32BE=D.readInt32BE,g.readFloatLE=D.readFloatLE,g.readFloatBE=D.readFloatBE,g.readDoubleLE=D.readDoubleLE,g.readDoubleBE=D.readDoubleBE,g.writeUInt8=D.writeUInt8,g.writeUInt16LE=D.writeUInt16LE,g.writeUInt16BE=D.writeUInt16BE,g.writeUInt32LE=D.writeUInt32LE,g.writeUInt32BE=D.writeUInt32BE,g.writeInt8=D.writeInt8,g.writeInt16LE=D.writeInt16LE,g.writeInt16BE=D.writeInt16BE,g.writeInt32LE=D.writeInt32LE,g.writeInt32BE=D.writeInt32BE,g.writeFloatLE=D.writeFloatLE,g.writeFloatBE=D.writeFloatBE,g.writeDoubleLE=D.writeDoubleLE,g.writeDoubleBE=D.writeDoubleBE,g.fill=D.fill,g.inspect=D.inspect,g.toArrayBuffer=D.toArrayBuffer,g}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(e,n,s){(function(i,a,M,d,f,y,B,L,x){var M=e("buffer").Buffer,U=4,F=new M(U);F.fill(0),n.exports={hash:function(O,C,P,V){for(var G=C(function(w,v){w.length%U!=0&&(k=w.length+(U-w.length%U),w=M.concat([w,F],k));for(var k,Q=[],z=v?w.readInt32BE:w.readInt32LE,R=0;R<w.length;R+=U)Q.push(z.call(w,R));return Q}(O=M.isBuffer(O)?O:new M(O),V),8*O.length),C=V,A=new M(P),N=C?A.writeInt32BE:A.writeInt32LE,m=0;m<G.length;m++)N.call(A,G[m],4*m,!0);return A}}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],5:[function(e,n,s){(function(i,a,M,d,f,y,B,L,x){var M=e("buffer").Buffer,U=e("./sha"),F=e("./sha256"),O=e("./rng"),C={sha1:U,sha256:F,md5:e("./md5")},P=64,V=new M(P);function G(w,v){var k=C[w=w||"sha1"],Q=[];return k||A("algorithm:",w,"is not yet supported"),{update:function(z){return M.isBuffer(z)||(z=new M(z)),Q.push(z),z.length,this},digest:function(z){var R=M.concat(Q),R=v?function(D,Y,Z){M.isBuffer(Y)||(Y=new M(Y)),M.isBuffer(Z)||(Z=new M(Z)),Y.length>P?Y=D(Y):Y.length<P&&(Y=M.concat([Y,V],P));for(var X=new M(P),K=new M(P),q=0;q<P;q++)X[q]=54^Y[q],K[q]=92^Y[q];return Z=D(M.concat([X,Z])),D(M.concat([K,Z]))}(k,v,R):k(R);return Q=null,z?R.toString(z):R}}}function A(){var w=[].slice.call(arguments).join(" ");throw new Error([w,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join(`
|
|
9
|
-
`))}V.fill(0),s.createHash=function(w){return G(w)},s.createHmac=G,s.randomBytes=function(w,v){if(!v||!v.call)return new M(O(w));try{v.call(this,void 0,new M(O(w)))}catch(k){v(k)}};var N,m=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],S=function(w){s[w]=function(){A("sorry,",w,"is not implemented yet")}};for(N in m)S(m[N])}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(e,n,s){(function(i,a,c,d,f,y,B,L,x){var M=e("./helpers");function U(A,N){A[N>>5]|=128<<N%32,A[14+(N+64>>>9<<4)]=N;for(var m=1732584193,S=-271733879,w=-1732584194,v=271733878,k=0;k<A.length;k+=16){var Q=m,z=S,R=w,D=v,m=O(m,S,w,v,A[k+0],7,-680876936),v=O(v,m,S,w,A[k+1],12,-389564586),w=O(w,v,m,S,A[k+2],17,606105819),S=O(S,w,v,m,A[k+3],22,-1044525330);m=O(m,S,w,v,A[k+4],7,-176418897),v=O(v,m,S,w,A[k+5],12,1200080426),w=O(w,v,m,S,A[k+6],17,-1473231341),S=O(S,w,v,m,A[k+7],22,-45705983),m=O(m,S,w,v,A[k+8],7,1770035416),v=O(v,m,S,w,A[k+9],12,-1958414417),w=O(w,v,m,S,A[k+10],17,-42063),S=O(S,w,v,m,A[k+11],22,-1990404162),m=O(m,S,w,v,A[k+12],7,1804603682),v=O(v,m,S,w,A[k+13],12,-40341101),w=O(w,v,m,S,A[k+14],17,-1502002290),m=C(m,S=O(S,w,v,m,A[k+15],22,1236535329),w,v,A[k+1],5,-165796510),v=C(v,m,S,w,A[k+6],9,-1069501632),w=C(w,v,m,S,A[k+11],14,643717713),S=C(S,w,v,m,A[k+0],20,-373897302),m=C(m,S,w,v,A[k+5],5,-701558691),v=C(v,m,S,w,A[k+10],9,38016083),w=C(w,v,m,S,A[k+15],14,-660478335),S=C(S,w,v,m,A[k+4],20,-405537848),m=C(m,S,w,v,A[k+9],5,568446438),v=C(v,m,S,w,A[k+14],9,-1019803690),w=C(w,v,m,S,A[k+3],14,-187363961),S=C(S,w,v,m,A[k+8],20,1163531501),m=C(m,S,w,v,A[k+13],5,-1444681467),v=C(v,m,S,w,A[k+2],9,-51403784),w=C(w,v,m,S,A[k+7],14,1735328473),m=P(m,S=C(S,w,v,m,A[k+12],20,-1926607734),w,v,A[k+5],4,-378558),v=P(v,m,S,w,A[k+8],11,-2022574463),w=P(w,v,m,S,A[k+11],16,1839030562),S=P(S,w,v,m,A[k+14],23,-35309556),m=P(m,S,w,v,A[k+1],4,-1530992060),v=P(v,m,S,w,A[k+4],11,1272893353),w=P(w,v,m,S,A[k+7],16,-155497632),S=P(S,w,v,m,A[k+10],23,-1094730640),m=P(m,S,w,v,A[k+13],4,681279174),v=P(v,m,S,w,A[k+0],11,-358537222),w=P(w,v,m,S,A[k+3],16,-722521979),S=P(S,w,v,m,A[k+6],23,76029189),m=P(m,S,w,v,A[k+9],4,-640364487),v=P(v,m,S,w,A[k+12],11,-421815835),w=P(w,v,m,S,A[k+15],16,530742520),m=V(m,S=P(S,w,v,m,A[k+2],23,-995338651),w,v,A[k+0],6,-198630844),v=V(v,m,S,w,A[k+7],10,1126891415),w=V(w,v,m,S,A[k+14],15,-1416354905),S=V(S,w,v,m,A[k+5],21,-57434055),m=V(m,S,w,v,A[k+12],6,1700485571),v=V(v,m,S,w,A[k+3],10,-1894986606),w=V(w,v,m,S,A[k+10],15,-1051523),S=V(S,w,v,m,A[k+1],21,-2054922799),m=V(m,S,w,v,A[k+8],6,1873313359),v=V(v,m,S,w,A[k+15],10,-30611744),w=V(w,v,m,S,A[k+6],15,-1560198380),S=V(S,w,v,m,A[k+13],21,1309151649),m=V(m,S,w,v,A[k+4],6,-145523070),v=V(v,m,S,w,A[k+11],10,-1120210379),w=V(w,v,m,S,A[k+2],15,718787259),S=V(S,w,v,m,A[k+9],21,-343485551),m=G(m,Q),S=G(S,z),w=G(w,R),v=G(v,D)}return Array(m,S,w,v)}function F(A,N,m,S,w,v){return G((N=G(G(N,A),G(S,v)))<<w|N>>>32-w,m)}function O(A,N,m,S,w,v,k){return F(N&m|~N&S,A,N,w,v,k)}function C(A,N,m,S,w,v,k){return F(N&S|m&~S,A,N,w,v,k)}function P(A,N,m,S,w,v,k){return F(N^m^S,A,N,w,v,k)}function V(A,N,m,S,w,v,k){return F(m^(N|~S),A,N,w,v,k)}function G(A,N){var m=(65535&A)+(65535&N);return(A>>16)+(N>>16)+(m>>16)<<16|65535&m}n.exports=function(A){return M.hash(A,U,16)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(e,n,s){(function(i,a,c,d,f,y,B,L,x){n.exports=function(M){for(var U,F=new Array(M),O=0;O<M;O++)(3&O)==0&&(U=4294967296*Math.random()),F[O]=U>>>((3&O)<<3)&255;return F}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(e,n,s){(function(i,a,c,d,f,y,B,L,x){var M=e("./helpers");function U(C,P){C[P>>5]|=128<<24-P%32,C[15+(P+64>>9<<4)]=P;for(var V,G,A,N=Array(80),m=1732584193,S=-271733879,w=-1732584194,v=271733878,k=-1009589776,Q=0;Q<C.length;Q+=16){for(var z=m,R=S,D=w,Y=v,Z=k,X=0;X<80;X++){N[X]=X<16?C[Q+X]:O(N[X-3]^N[X-8]^N[X-14]^N[X-16],1);var K=F(F(O(m,5),(K=S,G=w,A=v,(V=X)<20?K&G|~K&A:!(V<40)&&V<60?K&G|K&A|G&A:K^G^A)),F(F(k,N[X]),(V=X)<20?1518500249:V<40?1859775393:V<60?-1894007588:-899497514)),k=v,v=w,w=O(S,30),S=m,m=K}m=F(m,z),S=F(S,R),w=F(w,D),v=F(v,Y),k=F(k,Z)}return Array(m,S,w,v,k)}function F(C,P){var V=(65535&C)+(65535&P);return(C>>16)+(P>>16)+(V>>16)<<16|65535&V}function O(C,P){return C<<P|C>>>32-P}n.exports=function(C){return M.hash(C,U,20,!0)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(e,n,s){(function(i,a,c,d,f,y,B,L,x){function M(P,V){var G=(65535&P)+(65535&V);return(P>>16)+(V>>16)+(G>>16)<<16|65535&G}function U(P,V){var G,A=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),N=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),m=new Array(64);P[V>>5]|=128<<24-V%32,P[15+(V+64>>9<<4)]=V;for(var S,w,v=0;v<P.length;v+=16){for(var k=N[0],Q=N[1],z=N[2],R=N[3],D=N[4],Y=N[5],Z=N[6],X=N[7],K=0;K<64;K++)m[K]=K<16?P[K+v]:M(M(M((w=m[K-2],O(w,17)^O(w,19)^C(w,10)),m[K-7]),(w=m[K-15],O(w,7)^O(w,18)^C(w,3))),m[K-16]),G=M(M(M(M(X,O(w=D,6)^O(w,11)^O(w,25)),D&Y^~D&Z),A[K]),m[K]),S=M(O(S=k,2)^O(S,13)^O(S,22),k&Q^k&z^Q&z),X=Z,Z=Y,Y=D,D=M(R,G),R=z,z=Q,Q=k,k=M(G,S);N[0]=M(k,N[0]),N[1]=M(Q,N[1]),N[2]=M(z,N[2]),N[3]=M(R,N[3]),N[4]=M(D,N[4]),N[5]=M(Y,N[5]),N[6]=M(Z,N[6]),N[7]=M(X,N[7])}return N}var F=e("./helpers"),O=function(P,V){return P>>>V|P<<32-V},C=function(P,V){return P>>>V};n.exports=function(P){return F.hash(P,U,32,!0)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(e,n,s){(function(i,a,c,d,f,y,B,L,x){s.read=function(M,U,F,O,v){var P,V,G=8*v-O-1,A=(1<<G)-1,N=A>>1,m=-7,S=F?v-1:0,w=F?-1:1,v=M[U+S];for(S+=w,P=v&(1<<-m)-1,v>>=-m,m+=G;0<m;P=256*P+M[U+S],S+=w,m-=8);for(V=P&(1<<-m)-1,P>>=-m,m+=O;0<m;V=256*V+M[U+S],S+=w,m-=8);if(P===0)P=1-N;else{if(P===A)return V?NaN:1/0*(v?-1:1);V+=Math.pow(2,O),P-=N}return(v?-1:1)*V*Math.pow(2,P-O)},s.write=function(M,U,F,O,C,k){var V,G,A=8*k-C-1,N=(1<<A)-1,m=N>>1,S=C===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=O?0:k-1,v=O?1:-1,k=U<0||U===0&&1/U<0?1:0;for(U=Math.abs(U),isNaN(U)||U===1/0?(G=isNaN(U)?1:0,V=N):(V=Math.floor(Math.log(U)/Math.LN2),U*(O=Math.pow(2,-V))<1&&(V--,O*=2),2<=(U+=1<=V+m?S/O:S*Math.pow(2,1-m))*O&&(V++,O/=2),N<=V+m?(G=0,V=N):1<=V+m?(G=(U*O-1)*Math.pow(2,C),V+=m):(G=U*Math.pow(2,m-1)*Math.pow(2,C),V=0));8<=C;M[F+w]=255&G,w+=v,G/=256,C-=8);for(V=V<<C|G,A+=C;0<A;M[F+w]=255&V,w+=v,V/=256,A-=8);M[F+w-v]|=128*k}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754")},{buffer:3,lYpoI2:11}],11:[function(e,n,s){(function(i,a,c,d,f,y,B,L,x){var M,U,F;function O(){}(i=n.exports={}).nextTick=(U=typeof window<"u"&&window.setImmediate,F=typeof window<"u"&&window.postMessage&&window.addEventListener,U?function(C){return window.setImmediate(C)}:F?(M=[],window.addEventListener("message",function(C){var P=C.source;P!==window&&P!==null||C.data!=="process-tick"||(C.stopPropagation(),0<M.length&&M.shift()())},!0),function(C){M.push(C),window.postMessage("process-tick","*")}):function(C){setTimeout(C,0)}),i.title="browser",i.browser=!0,i.env={},i.argv=[],i.on=O,i.addListener=O,i.once=O,i.off=O,i.removeListener=O,i.removeAllListeners=O,i.emit=O,i.binding=function(C){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(C){throw new Error("process.chdir is not supported")}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:11}]},{},[1])(1)})}(Wi)),Wi.exports}var _f=bf();const Sf=Vs(_f);new TextEncoder;const If=4096;function Mu(r,t,e){let n=t;const s=n+e,i=[];let a="";for(;n<s;){const c=r[n++];if((c&128)===0)i.push(c);else if((c&224)===192){const d=r[n++]&63;i.push((c&31)<<6|d)}else if((c&240)===224){const d=r[n++]&63,f=r[n++]&63;i.push((c&31)<<12|d<<6|f)}else if((c&248)===240){const d=r[n++]&63,f=r[n++]&63,y=r[n++]&63;let B=(c&7)<<18|d<<12|f<<6|y;B>65535&&(B-=65536,i.push(B>>>10&1023|55296),B=56320|B&1023),i.push(B)}else i.push(c);i.length>=If&&(a+=String.fromCharCode(...i),i.length=0)}return i.length>0&&(a+=String.fromCharCode(...i)),a}const Bf=new TextDecoder,vf=200;function xf(r,t,e){const n=r.subarray(t,t+e);return Bf.decode(n)}function Af(r,t,e){return e>vf?xf(r,t,e):Mu(r,t,e)}class En{constructor(t,e){this.type=t,this.data=e}}class se extends Error{constructor(t){super(t);const e=Object.create(se.prototype);Object.setPrototypeOf(this,e),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:se.name})}}const Hr=4294967295;function Ef(r,t,e){const n=Math.floor(e/4294967296),s=e;r.setUint32(t,n),r.setUint32(t+4,s)}function Nu(r,t){const e=r.getInt32(t),n=r.getUint32(t+4);return e*4294967296+n}function Tf(r,t){const e=r.getUint32(t),n=r.getUint32(t+4);return e*4294967296+n}const Mf=-1,Nf=4294967296-1,Ff=17179869184-1;function Of({sec:r,nsec:t}){if(r>=0&&t>=0&&r<=Ff)if(t===0&&r<=Nf){const e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,r),e}else{const e=r/4294967296,n=r&4294967295,s=new Uint8Array(8),i=new DataView(s.buffer);return i.setUint32(0,t<<2|e&3),i.setUint32(4,n),s}else{const e=new Uint8Array(12),n=new DataView(e.buffer);return n.setUint32(0,t),Ef(n,4,r),e}}function kf(r){const t=r.getTime(),e=Math.floor(t/1e3),n=(t-e*1e3)*1e6,s=Math.floor(n/1e9);return{sec:e+s,nsec:n-s*1e9}}function Df(r){if(r instanceof Date){const t=kf(r);return Of(t)}else return null}function Uf(r){const t=new DataView(r.buffer,r.byteOffset,r.byteLength);switch(r.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{const e=t.getUint32(0),n=t.getUint32(4),s=(e&3)*4294967296+n,i=e>>>2;return{sec:s,nsec:i}}case 12:{const e=Nu(t,4),n=t.getUint32(0);return{sec:e,nsec:n}}default:throw new se(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${r.length}`)}}function Lf(r){const t=Uf(r);return new Date(t.sec*1e3+t.nsec/1e6)}const Cf={type:Mf,encode:Df,decode:Lf};class us{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Cf)}register({type:t,encode:e,decode:n}){if(t>=0)this.encoders[t]=e,this.decoders[t]=n;else{const s=-1-t;this.builtInEncoders[s]=e,this.builtInDecoders[s]=n}}tryToEncode(t,e){for(let n=0;n<this.builtInEncoders.length;n++){const s=this.builtInEncoders[n];if(s!=null){const i=s(t,e);if(i!=null){const a=-1-n;return new En(a,i)}}}for(let n=0;n<this.encoders.length;n++){const s=this.encoders[n];if(s!=null){const i=s(t,e);if(i!=null){const a=n;return new En(a,i)}}}return t instanceof En?t:null}decode(t,e,n){const s=e<0?this.builtInDecoders[-1-e]:this.decoders[e];return s?s(t,e,n):new En(e,t)}}us.defaultCodec=new us;function Rf(r){return r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer}function na(r){return r instanceof Uint8Array?r:ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):Rf(r)?new Uint8Array(r):Uint8Array.from(r)}function Zi(r){return`${r<0?"-":""}0x${Math.abs(r).toString(16).padStart(2,"0")}`}const Pf=16,$f=16;class zf{constructor(t=Pf,e=$f){this.hit=0,this.miss=0,this.maxKeyLength=t,this.maxLengthPerKey=e,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}find(t,e,n){const s=this.caches[n-1];t:for(const i of s){const a=i.bytes;for(let c=0;c<n;c++)if(a[c]!==t[e+c])continue t;return i.str}return null}store(t,e){const n=this.caches[t.length-1],s={bytes:t,str:e};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=s:n.push(s)}decode(t,e,n){const s=this.find(t,e,n);if(s!=null)return this.hit++,s;this.miss++;const i=Mu(t,e,n),a=Uint8Array.prototype.slice.call(t,e,e+n);return this.store(a,i),i}}const hs="array",cn="map_key",Fu="map_value",jf=r=>{if(typeof r=="string"||typeof r=="number")return r;throw new se("The type of key must be string or number but "+typeof r)};class Vf{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(t){const e=this.getUninitializedStateFromPool();e.type=hs,e.position=0,e.size=t,e.array=new Array(t)}pushMapState(t){const e=this.getUninitializedStateFromPool();e.type=cn,e.readCount=0,e.size=t,e.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const t={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(t)}return this.stack[this.stackHeadPosition]}release(t){if(this.stack[this.stackHeadPosition]!==t)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(t.type===hs){const n=t;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(t.type===cn||t.type===Fu){const n=t;n.size=0,n.map=void 0,n.readCount=0,n.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const qr=-1,Gs=new DataView(new ArrayBuffer(0)),Wf=new Uint8Array(Gs.buffer);try{Gs.getInt8(0)}catch(r){if(!(r instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const ia=new RangeError("Insufficient data"),Zf=new zf;class Ys{constructor(t){this.totalPos=0,this.pos=0,this.view=Gs,this.bytes=Wf,this.headByte=qr,this.stack=new Vf,this.entered=!1,this.extensionCodec=t?.extensionCodec??us.defaultCodec,this.context=t?.context,this.useBigInt64=t?.useBigInt64??!1,this.rawStrings=t?.rawStrings??!1,this.maxStrLength=t?.maxStrLength??Hr,this.maxBinLength=t?.maxBinLength??Hr,this.maxArrayLength=t?.maxArrayLength??Hr,this.maxMapLength=t?.maxMapLength??Hr,this.maxExtLength=t?.maxExtLength??Hr,this.keyDecoder=t?.keyDecoder!==void 0?t.keyDecoder:Zf,this.mapKeyConverter=t?.mapKeyConverter??jf}clone(){return new Ys({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=qr,this.stack.reset()}setBuffer(t){const e=na(t);this.bytes=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.pos=0}appendBuffer(t){if(this.headByte===qr&&!this.hasRemaining(1))this.setBuffer(t);else{const e=this.bytes.subarray(this.pos),n=na(t),s=new Uint8Array(e.length+n.length);s.set(e),s.set(n,e.length),this.setBuffer(s)}}hasRemaining(t){return this.view.byteLength-this.pos>=t}createExtraByteError(t){const{view:e,pos:n}=this;return new RangeError(`Extra ${e.byteLength-n} of ${e.byteLength} byte(s) found at buffer[${t}]`)}decode(t){if(this.entered)return this.clone().decode(t);try{this.entered=!0,this.reinitializeState(),this.setBuffer(t);const e=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return e}finally{this.entered=!1}}*decodeMulti(t){if(this.entered){yield*this.clone().decodeMulti(t);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(t);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(t){if(this.entered)return this.clone().decodeAsync(t);try{this.entered=!0;let e=!1,n;for await(const c of t){if(e)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(c);try{n=this.doDecodeSync(),e=!0}catch(d){if(!(d instanceof RangeError))throw d}this.totalPos+=this.pos}if(e){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}const{headByte:s,pos:i,totalPos:a}=this;throw new RangeError(`Insufficient data in parsing ${Zi(s)} at ${a} (${i} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(t){return this.decodeMultiAsync(t,!0)}decodeStream(t){return this.decodeMultiAsync(t,!1)}async*decodeMultiAsync(t,e){if(this.entered){yield*this.clone().decodeMultiAsync(t,e);return}try{this.entered=!0;let n=e,s=-1;for await(const i of t){if(e&&s===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(i),n&&(s=this.readArraySize(),n=!1,this.complete());try{for(;yield this.doDecodeSync(),--s!==0;);}catch(a){if(!(a instanceof RangeError))throw a}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){t:for(;;){const t=this.readHeadByte();let e;if(t>=224)e=t-256;else if(t<192)if(t<128)e=t;else if(t<144){const s=t-128;if(s!==0){this.pushMapState(s),this.complete();continue t}else e={}}else if(t<160){const s=t-144;if(s!==0){this.pushArrayState(s),this.complete();continue t}else e=[]}else{const s=t-160;e=this.decodeString(s,0)}else if(t===192)e=null;else if(t===194)e=!1;else if(t===195)e=!0;else if(t===202)e=this.readF32();else if(t===203)e=this.readF64();else if(t===204)e=this.readU8();else if(t===205)e=this.readU16();else if(t===206)e=this.readU32();else if(t===207)this.useBigInt64?e=this.readU64AsBigInt():e=this.readU64();else if(t===208)e=this.readI8();else if(t===209)e=this.readI16();else if(t===210)e=this.readI32();else if(t===211)this.useBigInt64?e=this.readI64AsBigInt():e=this.readI64();else if(t===217){const s=this.lookU8();e=this.decodeString(s,1)}else if(t===218){const s=this.lookU16();e=this.decodeString(s,2)}else if(t===219){const s=this.lookU32();e=this.decodeString(s,4)}else if(t===220){const s=this.readU16();if(s!==0){this.pushArrayState(s),this.complete();continue t}else e=[]}else if(t===221){const s=this.readU32();if(s!==0){this.pushArrayState(s),this.complete();continue t}else e=[]}else if(t===222){const s=this.readU16();if(s!==0){this.pushMapState(s),this.complete();continue t}else e={}}else if(t===223){const s=this.readU32();if(s!==0){this.pushMapState(s),this.complete();continue t}else e={}}else if(t===196){const s=this.lookU8();e=this.decodeBinary(s,1)}else if(t===197){const s=this.lookU16();e=this.decodeBinary(s,2)}else if(t===198){const s=this.lookU32();e=this.decodeBinary(s,4)}else if(t===212)e=this.decodeExtension(1,0);else if(t===213)e=this.decodeExtension(2,0);else if(t===214)e=this.decodeExtension(4,0);else if(t===215)e=this.decodeExtension(8,0);else if(t===216)e=this.decodeExtension(16,0);else if(t===199){const s=this.lookU8();e=this.decodeExtension(s,1)}else if(t===200){const s=this.lookU16();e=this.decodeExtension(s,2)}else if(t===201){const s=this.lookU32();e=this.decodeExtension(s,4)}else throw new se(`Unrecognized type byte: ${Zi(t)}`);this.complete();const n=this.stack;for(;n.length>0;){const s=n.top();if(s.type===hs)if(s.array[s.position]=e,s.position++,s.position===s.size)e=s.array,n.release(s);else continue t;else if(s.type===cn){if(e==="__proto__")throw new se("The key __proto__ is not allowed");s.key=this.mapKeyConverter(e),s.type=Fu;continue t}else if(s.map[s.key]=e,s.readCount++,s.readCount===s.size)e=s.map,n.release(s);else{s.key=null,s.type=cn;continue t}}return e}}readHeadByte(){return this.headByte===qr&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=qr}readArraySize(){const t=this.readHeadByte();switch(t){case 220:return this.readU16();case 221:return this.readU32();default:{if(t<160)return t-144;throw new se(`Unrecognized array type byte: ${Zi(t)}`)}}}pushMapState(t){if(t>this.maxMapLength)throw new se(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(t)}pushArrayState(t){if(t>this.maxArrayLength)throw new se(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(t)}decodeString(t,e){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(t,e):this.decodeBinary(t,e)}decodeUtf8String(t,e){if(t>this.maxStrLength)throw new se(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+e+t)throw ia;const n=this.pos+e;let s;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(t)?s=this.keyDecoder.decode(this.bytes,n,t):s=Af(this.bytes,n,t),this.pos+=e+t,s}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===cn:!1}decodeBinary(t,e){if(t>this.maxBinLength)throw new se(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+e))throw ia;const n=this.pos+e,s=this.bytes.subarray(n,n+t);return this.pos+=e+t,s}decodeExtension(t,e){if(t>this.maxExtLength)throw new se(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);const n=this.view.getInt8(this.pos+e),s=this.decodeBinary(t,e+1);return this.extensionCodec.decode(s,n,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){const t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){const t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){const t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){const t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){const t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){const t=Tf(this.view,this.pos);return this.pos+=8,t}readI64(){const t=Nu(this.view,this.pos);return this.pos+=8,t}readU64AsBigInt(){const t=this.view.getBigUint64(this.pos);return this.pos+=8,t}readI64AsBigInt(){const t=this.view.getBigInt64(this.pos);return this.pos+=8,t}readF32(){const t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){const t=this.view.getFloat64(this.pos);return this.pos+=8,t}}function Gf(r,t){return new Ys(t).decode(r)}pa.set("msgpack2",async()=>({kind:"array_to_bytes",fromConfig:(r,t)=>({kind:"array_to_bytes",async encode(e){throw new Error("msgpack2 encode not implemented")},async decode(e){const n=Gf(e),{shape:s}=t,i=new Array(s.length);let a=1;for(let c=s.length-1;c>=0;c--)i[c]=a,a*=s[c];return{data:n,shape:s,stride:i}}})}));function Yf(r){return new Promise(t=>setTimeout(t,r))}const Gi="__cache_created_at";class Jf{cache;url;params;cache_prefix;fetchOptions;timeout;ttl;_pending={};_cacheValid;constructor(t,e,n={}){const s={...e};n.parameters&&(s["x-parameters"]=JSON.stringify(n.parameters)),n.chunks&&(s["x-chunks"]=n.chunks),n.downsample&&(s["x-downsample"]=JSON.stringify(n.downsample)),s["x-filtered"]="True",this.params={},e["x-datamesh-auth"]&&(this.params.auth=e["x-datamesh-auth"]),e["x-datamesh-sig"]&&(this.params.sig=e["x-datamesh-sig"]),this.fetchOptions={headers:s},this.url=t,n.nocache&&console.warn("CachedHTTPStore: 'nocache' option is deprecated, use 'ttl: 0' instead"),n.ttl===0||n.nocache||typeof window>"u"?this.cache=void 0:this.cache=Tu("zarr","cache"),this.cache_prefix=Sf({root:t,...n.parameters,chunks:n.chunks,downsample:n.downsample}),this.timeout=n.timeout||6e4,this.ttl=n.ttl}async checkCacheTTL(){if(!this.ttl||!this.cache)return!0;if(this._cacheValid!==void 0)return this._cacheValid;const t=`${this.cache_prefix}${Gi}`,e=await Vi(t,this.cache);return e?(Date.now()-e)/1e3>this.ttl?(this._cacheValid=!1,!1):(this._cacheValid=!0,!0):(this._cacheValid=!0,!0)}async setCacheTimestamp(){if(!this.cache||!this.ttl)return;const t=`${this.cache_prefix}${Gi}`;await Vi(t,this.cache)||await ea(t,Date.now(),this.cache)}async invalidateCache(){if(!this.cache)return;const t=`${this.cache_prefix}${Gi}`;await xn(t,this.cache),this._cacheValid=void 0}async get(t,e,n=0){const s=`${this.cache_prefix}${t}`;let i=null;if(this.cache&&(await this.checkCacheTTL()?i=await Vi(s,this.cache):await this.invalidateCache(),i&&delete this._pending[s],this._pending[s]))if(await Yf(200),n>this.timeout){await xn(s,this.cache),delete this._pending[s],console.error("Zarr timeout");return}else return await this.get(t,e,n+200);if(!i){this._pending[s]=!0;try{const a={...this.fetchOptions,...e,headers:{...this.fetchOptions.headers||{},...e?.headers||{}},signal:AbortSignal.timeout(this.timeout)},c=new URLSearchParams(this.params).toString(),d=await fetch(`${this.url}${t}?${c}`,a);if(d.status===404){this.cache&&await xn(s,this.cache);return}if(d.status>=400)throw new Error(`HTTP error: ${d.status}`);i=new Uint8Array(await d.arrayBuffer()),this.cache&&(await ea(s,i,this.cache),await this.setCacheTimestamp())}catch(a){if(console.debug("Zarr retry:"+s),n<this.timeout/200)return delete this._pending[s],await this.get(t,e,n+200);this.cache&&await xn(s,this.cache),console.error(a);return}finally{delete this._pending[s]}}return i}}const sa=async(r,t=".zarray")=>{const{path:e}=r.resolve(t),n=await r.store.get(e);return n?JSON.parse(new TextDecoder().decode(n)):{}};async function Hf(r){const t=await sa(r,".zattrs"),e=await sa(r);e.dtype.startsWith("<M8")&&(t._dtype=e.dtype),e.fill_value!==void 0&&(t._fill_value=e.fill_value);const n=[];e.order==="F"&&n.push({name:"transpose",configuration:{order:"F"}}),typeof e.dtype=="string"&&e.dtype.startsWith(">")&&n.push({name:"bytes",configuration:{endian:"big"}});for(const{id:i,...a}of e.filters??[])n.push({name:i,configuration:a});if(e.compressor){const{id:i,...a}=e.compressor;n.push({name:i,configuration:a})}const s={zarr_format:3,node_type:"array",shape:e.shape,data_type:"int64",chunk_grid:{name:"regular",configuration:{chunk_shape:e.chunks}},chunk_key_encoding:{name:"v2",configuration:{separator:e.dimension_separator??"."}},codecs:n,fill_value:e.fill_value,attributes:t};return new vr(r.store,r.path,s)}function Ti(r,t,e){const n=e.value;return e.value=async function(...s){const i=Date.now(),a=await n.apply(this,s),d=Date.now()-i;return console.debug(`${t} took ${d}ms`),a},e}const Js={microseconds:.001,milliseconds:1,seconds:1e3,minutes:60*1e3,hours:60*60*1e3,days:24*60*60*1e3},qf={day:"days",days:"days",d:"days",hour:"hours",hours:"hours",hr:"hours",hrs:"hours",h:"hours",minute:"minutes",minutes:"minutes",min:"minutes",mins:"minutes",second:"seconds",seconds:"seconds",sec:"seconds",secs:"seconds",s:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds",msec:"milliseconds",msecs:"milliseconds",ms:"milliseconds",microsecond:"microseconds",microseconds:"microseconds",usec:"microseconds",usecs:"microseconds",us:"microseconds"},Mi=new Set(["standard","gregorian","proleptic_gregorian"]);function Ni(r){const t=/^\s*(\w+)\s+since\s+(.+?)\s*$/i,e=r.match(t);if(!e)throw new Error(`Invalid CF time units: "${r}". Expected format: "<unit> since <reference_time>"`);const[,n,s]=e,i=n.toLowerCase(),a=qf[i];if(!a)throw new Error(`Unsupported time unit: "${n}". Supported units: days, hours, minutes, seconds, milliseconds, microseconds`);const c=Kf(s),d=c.getTime();return{unit:a,referenceDate:c,referenceMs:d,original:r}}function Kf(r){const t=r.trim().replace("T"," ").replace(/Z$/i,""),e=/^(-?\d+)-(\d{1,2})-(\d{1,2})(?:\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d+))?)?)?$/,n=t.match(e);if(!n){const C=new Date(r);if(isNaN(C.getTime()))throw new Error(`Cannot parse reference time: "${r}"`);return C}const[,s,i,a,c,d,f,y]=n,B=parseInt(s,10),L=parseInt(i,10)-1,x=parseInt(a,10),M=c?parseInt(c,10):0,U=d?parseInt(d,10):0,F=f?parseInt(f,10):0;let O=0;if(y){const C=y.padEnd(3,"0").slice(0,3);O=parseInt(C,10)}return new Date(Date.UTC(B,L,x,M,U,F,O))}function Xf(r,t,e="standard"){if(!Mi.has(e))throw new Error(`Unsupported calendar: "${e}". Currently only Gregorian calendars are supported: standard, gregorian, proleptic_gregorian`);const n=Ni(t),s=Js[n.unit];if(typeof r=="number")return new Date(n.referenceMs+r*s);const i=[];for(let a=0;a<r.length;a++){const c=r[a];c==null||Number.isNaN(c)?i.push(new Date(NaN)):i.push(new Date(n.referenceMs+c*s))}return i}function Qf(r,t,e="standard"){if(!Mi.has(e))throw new Error(`Unsupported calendar: "${e}". Currently only Gregorian calendars are supported: standard, gregorian, proleptic_gregorian`);const n=Ni(t),s=Js[n.unit];return r instanceof Date?(r.getTime()-n.referenceMs)/s:r.map(i=>!i||isNaN(i.getTime())?NaN:(i.getTime()-n.referenceMs)/s)}function Ou(r){return Mi.has(r.toLowerCase())}function tp(){return Array.from(Mi)}function ku(r){const t=r.units;return typeof t=="string"&&/^\s*\w+\s+since\s+.+$/i.test(t)}function Du(r,t,e="standard"){if(!Ou(e))return null;const n=Ni(t),s=Js[n.unit],i=n.referenceMs,a=new Float64Array(r.length);for(let c=0;c<r.length;c++){const d=Number(r[c]);Number.isNaN(d)?a[c]=NaN:a[c]=(i+d*s)/1e3}return a}var ep=Object.defineProperty,rp=Object.getOwnPropertyDescriptor,np=(r,t,e,n)=>{for(var s=rp(t,e),i=r.length-1,a;i>=0;i--)(a=r[i])&&(s=a(t,e,s)||s);return s&&ep(t,e,s),s};const oa=(r,t,e,n,s)=>n?.variables?.[r]?n.variables[r]:s||(n?.dimensions?t.map((i,a)=>n.dimensions?.[i]??e[a]):e),Uu=r=>{const t=new Eu.Buffer(r,"base64");return mf.Geometry.parse(t).toGeoJSON()},mi=r=>r&&(Array.isArray(r)||ArrayBuffer.isView(r)),Yi=r=>{const t=[];if(!mi(r))return t;for(;t.push(r.length),mi(r[0]);)r=r[0];return t},ip=r=>{for(;Array.isArray(r);)r=r[0];if(r==null)return"uint8";switch(r.constructor.name){case"Boolean":return"bool";case"Number":return"float32";case"Int8Array":return"int8";case"Int16Array":return"int16";case"Int32Array":return"int32";case"BigInt64Array":return"int64";case"Uint8Array":return"uint8";case"Uint16Array":return"uint16";case"Uint32Array":return"uint32";case"Float32Array":return"float32";case"Float64Array":return"float64";case"String":return"v2:object";case"Object":return"v2:object"}throw new Error("Unsupported data type: "+r.constructor.name)},sp=r=>{let t=r.toString().toLowerCase();return r.typeId==5?t="v2:object":r.typeId==1&&(t="uint8"),t},aa=r=>{if(!Array.isArray(r))return r;const t=r.flat(1/0);if(mi(t[0])){const e=t[0].length,n=new t[0].constructor(t.length*e);for(let s=0;s<t.length;s++)n.set(t[s],s*e);return n}else return t},ca=r=>{const t=r.length,e=Array(t);for(let n=t-1,s=1;n>=0;n--)e[n]=s,s*=r[n];return e},pn=(r,t,e,n=0)=>{if(t.length===0)return r[0];if(t.length===1){const i=new r.constructor(t[0]);return i.set(r.slice(n,n+t[0])),i}const s=new Array(t[0]);for(let i=0;i<t[0];i++)s[i]=pn(r,t.slice(1),e.slice(1),n+i*e[0]);return s},op=(r,t)=>{const[e,n]=t.split("<M8"),s=new Float64Array(r.data.length);let i=1n;switch(n){case"[ms]":i=1000n;break;case"[us]":i=1000000n;break;case"[ns]":i=1000000000n;break;default:i=1n;break}for(let a=0;a<r.data.length;a++){const c=r.data[a];s[a]=Number(c/i)}return pn(s,r.shape,r.stride)},ap=(r,t,e="standard")=>{const n=Du(r.data,t,e);return n===null?(console.warn(`Unsupported calendar "${e}" for cftime conversion. Returning raw values. Supported: standard, gregorian, proleptic_gregorian`),pn(r.data,r.shape,r.stride)):pn(n,r.shape,r.stride)},cp=r=>{if(r==null)return!0;if(typeof r=="string"){const t=r.toLowerCase();return t==="nan"||t==="-nan"||t==="+nan"}return typeof r=="number"?Number.isNaN(r):!1},up=(r,t,e)=>{if(!e.startsWith("float")||cp(t))return r;if(typeof t=="number"&&!Number.isNaN(t)){const n=e==="float64"?new Float64Array(r.length):new Float32Array(r.length);for(let s=0;s<r.length;s++){const i=r[s];n[s]=Math.abs(i-t)<Math.abs(t*1e-6)?NaN:i}return n}return r},Lu=(r,t,e)=>{const n=Object.keys(t),s={};for(const i in r)mi(r[i].data)&&(s[i]=!0);if(n.length==1)for(let i=0;i<t[n[0]];i++){const a={};for(const c in r)s[c]?r[c].data.length>1&&(a[c]=r[c].data[i]):a[c]=r[c].data;e.push(a)}else for(let i=0;i<t[n[0]];i++){const a={};for(const d in r)r[d].dimensions.includes(n[0])?a[d]={attributes:r[d].attributes,data:r[d].data[i],dimensions:r[d].dimensions.slice(1)}:a[d]=r[d];const c={...t};delete c[n[0]],Lu(a,c,e)}return e};class wi{id;dimensions;attributes;arr;constructor(t,e,n,s){this.id=t,this.dimensions=e,this.attributes=n,this.arr=s}async get(t){if(this.arr.shape.length==0||this.arr.shape[0]==0)return[];const e=t&&t.map(s=>{if(typeof s=="string"){const[i,a,c]=s.split(":");return Hi(parseInt(i),parseInt(a),parseInt(c))}else return s}),n=await kh(this.arr,e);if(this.arr.dtype=="v2:object"||!n.shape)return n.data;if(this.arr.dtype=="bool")return[...n.data];{const s=this.arr.attrs,i=this.arr.dtype,a=s._dtype;if(a?.startsWith("<M8"))return op(n,a);if(ku(s)){const f=s.units,y=s.calendar||"standard";return ap(n,f,y)}const c=this.attributes._fill_value,d=c?up(n.data,c,i):n.data;return pn(d,n.shape,n.stride)}}}np([Ti],wi.prototype,"get");class Ye{dimensions;variables;attributes;coordkeys;root;constructor(t,e,n,s,i){this.dimensions=t,this.variables=e,this.attributes=n,this.coordkeys=s,this.root=i}static async zarr(t,e,n={}){const s=new Jf(t,e,{chunks:n.chunks,downsample:n.downsample,parameters:n.parameters,timeout:n.timeout,nocache:n.nocache,ttl:n.ttl}),i=await yh(s),a=await Ge(i,{kind:"group"}),c={},d={};for(const y of i.contents())if(y.kind=="array"){let B;try{B=await Ge(a.resolve(y.path),{kind:"array"})}catch(U){const F=typeof U=="object"&&U&&"message"in U?String(U.message):void 0;if(F&&F.includes("<M8"))B=await Hf(a.resolve(y.path));else throw U}const L={...B.attrs};if(L._fill_value===void 0){const U=`${y.path}/.zarray`.replace(/^\//,""),F=await i.get(`/${U}`);if(F){const O=JSON.parse(new TextDecoder().decode(F));O.fill_value!==void 0&&(L._fill_value=O.fill_value)}}const x=L._ARRAY_DIMENSIONS,M=y.path.split("/").pop();c[M]=new wi(M,x||[],L,B),x&&x.map((U,F)=>{const O=B.shape[F];if(d[U]&&d[U]!=O)throw new Error(`Inconsistent dimension size for ${U}: ${d[U]} != ${O}`);d[U]=O})}const f=JSON.parse(a.attrs._coordinates||"{}")||{};return new Ye(d,c,a.attrs,n.coordkeys||f,a)}static async fromArrow(t,e){const n={},s={record:t.numRows},i={};return t.schema.fields.forEach(a=>{const c=t.getChild(a.name);let d={},f=c?.toArray(),y=sp(a.type);if(tt.isTimestamp(a.type)){const B=new Float64Array(f.length),L=BigInt(1e3**(a.type.unit-0));for(let x=0;x<f.length;x++)B[x]=Number(f[x]/L);f=B,y="float64",d={unit:"Unix timestamp (s)"}}else if(tt.isBinary(a.type)){const B=[];for(let L=0;L<f.length;L++)B.push(new Eu.Buffer(f[L]).toString("base64"));f=B,y="v2:object"}i[a.name]={dimensions:["record"],attributes:d,data:f,dtype:y}}),await Ye.init({dimensions:s,variables:i,attributes:n},e)}static async fromGeojson(t,e){if(!("features"in t&&Array.isArray(t.features))&&!("geometry"in t))throw new Error("Invalid GeoJSON");const n="features"in t&&t.features?t.features:[t];if(n.length===0)throw new Error("FeatureCollection contains no features");const s=new Set;n.forEach(d=>{d.properties&&Object.keys(d.properties).forEach(f=>s.add(f))});const i=n.map(d=>{const f={geometry:d.geometry};return d.properties&&Object.assign(f,d.properties),f}),a={dimensions:{index:i.length},variables:{},attributes:{}},c=await Ye.init(a,{...e,g:"geometry"});await c.assign("geometry",["index"],i.map(d=>d.geometry),{description:"GeoJSON geometry"});for(const d of s){const f=i.map(y=>y[d]);await c.assign(d,["index"],f,{description:`Property: ${d}`})}return c}static async init(t,e,n){const s=await _n(new Map,{attributes:{created:new Date}}),i=new Ye(t.dimensions,{},t.attributes||{},e||{},s);for(const a in t.variables){const{dimensions:c,attributes:d,data:f,dtype:y,chunks:B}=t.variables[a],L=Yi(f),x=oa(a,c,L,n,B);await i.assign(a,c,f,d,y&&y==="string"?"v2:object":y,x)}return i}async asDataframe(){const t={},e=[];for(const s in this.variables)t[s]={attributes:this.variables[s].attributes,dimensions:this.variables[s].dimensions},t[s].data=await this.variables[s].get(),this.variables[s].arr.dtype=="int64"&&s!=this.coordkeys.t&&e.push(s);const n=Lu(t,{...this.dimensions},[]);if(this.coordkeys.t)for(let s=0;s<n.length;s++)n[s][this.coordkeys.t]=new Date(1e3*n[s][this.coordkeys.t]).toISOString();if(e.length>0)for(const s of e)for(let i=0;i<n.length;i++)n[i][s]=Number(n[i][s]);return n}async asGeojson(t){if(!this.coordkeys.g&&!t)throw new Error("No geometry found");const e=[],n=await this.asDataframe();for(let s=0;s<n.length;s++){const{...i}=n[s];let a=t;if(!a&&this.coordkeys.g){delete i[this.coordkeys.g];const c=n[s][this.coordkeys.g];c.slice(0,7)=='{"type:'?a=JSON.parse(c):a=Uu(c)}e.push({type:"Feature",geometry:a,properties:i})}return{type:"FeatureCollection",features:e}}async assign(t,e,n,s,i,a){const c=Yi(n);if(c.length!=e.length)throw new Error("Data shape does not match dimensions");e.map((B,L)=>{if(this.dimensions[B]){if(this.dimensions[B]!=c[L])throw new Error(`Existing size of dimension ${B} does not match new data`)}else this.dimensions[B]=c[L]});const d=i||ip(n),f=await _n(this.root.resolve(t),{shape:c,data_type:d,chunk_shape:a||c,codecs:d=="v2:object"?[{name:"json2"}]:[]});let y=aa(n);y.length==0?y=null:d=="bool"?y=new $n(y):Array.isArray(y)&&d=="float32"?y=Float32Array.from(y,B=>B??NaN):Array.isArray(y)&&d=="float64"?y=Float64Array.from(y,B=>B??NaN):Array.isArray(y)&&d=="int8"?y=Int8Array.from(y):Array.isArray(y)&&d=="int16"?y=Int16Array.from(y):Array.isArray(y)&&d=="int32"?y=Int32Array.from(y):Array.isArray(y)&&d=="int64"?y=BigInt64Array.from(y.map(B=>BigInt(B))):Array.isArray(y)&&d=="uint8"?y=Uint8Array.from(y):Array.isArray(y)&&d=="uint16"?y=Uint16Array.from(y):Array.isArray(y)&&d=="uint32"?y=Uint32Array.from(y):Array.isArray(y)&&d=="uint64"&&(y=BigUint64Array.from(y.map(B=>BigInt(B)))),y&&await oo(f,c.map(()=>null),{data:y,shape:c,stride:ca(c)}),this.variables[t]=new wi(t,e,s||{},f)}async toZarr(t){const e=t?.chunks,n=new Map,s=await _n(n,{attributes:{...this.attributes,_coordinates:JSON.stringify(this.coordkeys)}});for(const i in this.variables){const a=this.variables[i],c=await a.get(),d=Yi(c),f=a.dimensions,y=oa(i,f,d,e,e?void 0:a.arr.chunks),B=a.arr.dtype,L=await _n(s.resolve(i),{shape:d,data_type:B,chunk_shape:y,codecs:B==="v2:object"?[{name:"json2"}]:void 0,attributes:{...a.attributes,_ARRAY_DIMENSIONS:f}});let x=aa(c);x&&x.length>0&&(B==="bool"?x=new $n(x):Array.isArray(x)&&B==="float32"?x=Float32Array.from(x,M=>M??NaN):Array.isArray(x)&&B==="float64"?x=Float64Array.from(x,M=>M??NaN):Array.isArray(x)&&B==="int8"?x=Int8Array.from(x):Array.isArray(x)&&B==="int16"?x=Int16Array.from(x):Array.isArray(x)&&B==="int32"?x=Int32Array.from(x):Array.isArray(x)&&B==="int64"?x=BigInt64Array.from(x.map(M=>BigInt(M))):Array.isArray(x)&&B==="uint8"?x=Uint8Array.from(x):Array.isArray(x)&&B==="uint16"?x=Uint16Array.from(x):Array.isArray(x)&&B==="uint32"?x=Uint32Array.from(x):Array.isArray(x)&&B==="uint64"&&(x=BigUint64Array.from(x.map(M=>BigInt(M)))),await oo(L,d.map(()=>null),{data:x,shape:d,stride:ca(d)}))}return n}}var hp=Object.defineProperty,lp=Object.getOwnPropertyDescriptor,dp=(r,t,e,n)=>{for(var s=lp(t,e),i=r.length-1,a;i>=0;i--)(a=r[i])&&(s=a(t,e,s)||s);return s&&hp(t,e,s),s};const Cu=class ls{id;user;creationTime;endTime;write;verified=!1;_connection;static async acquire(t,e={}){if(!t._isV1){const n=new ls;return n.id="dummy_session",n.user="dummy_user",n.creationTime=new Date,n.endTime=new Date(Date.now()+(e.duration||3600)*1e3),n.write=!1,n.verified=!1,n._connection=t,typeof process<"u"&&process.on&&process.on("beforeExit",()=>{n.close()}),n}try{const n={...t._authHeaders};n["Cache-Control"]="no-store";const s=new URLSearchParams({duration:String(e.duration??3600)}),i=await fetch(`${t._gateway}/session/?${s.toString()}`,{headers:n});if(i.status!==200)throw new Error(`Failed to create session: ${await i.text()}`);const a=await i.json(),c=new ls;return c.id=a.id,c.user=a.user,c.creationTime=new Date(a.creation_time),c.endTime=new Date(a.end_time),c.write=a.write,c.verified=a.verified||!1,c._connection=t,typeof process<"u"&&process.on&&process.on("beforeExit",()=>{c.close()}),c}catch(n){throw new Error(`Error when acquiring datamesh session: ${n}`)}}get header(){return{"X-DATAMESH-SESSIONID":this.id}}addHeader(t){return{...t,...this.header}}async close(t=!1){if(this._connection._isV1)try{typeof process<"u"&&process.off&&process.off("beforeExit",this.close);const e=await fetch(`${this._connection._gateway}/session/${this.id}`,{method:"DELETE",headers:this.header,body:JSON.stringify({finalise_write:t})});if(e.status!==204){if(t)throw new Error(`Failed to finalise write: ${await e.text()}`);console.warn(`Failed to close session: ${await e.text()}`)}}catch(e){if(t)throw new Error(`Error when closing datamesh session: ${e}`);console.warn(`Error when closing datamesh session: ${e}`)}}async enter(){return this}async exit(t){await this.close(t===void 0)}};dp([Ti],Cu,"acquire");let fp=Cu;var pp=Object.defineProperty,yp=Object.getOwnPropertyDescriptor,Ru=(r,t,e,n)=>{for(var s=yp(t,e),i=r.length-1,a;i>=0;i--)(a=r[i])&&(s=a(t,e,s)||s);return s&&pp(t,e,s),s};const gp=typeof process<"u"&&process.env?.DATAMESH_SERVICE?process.env.DATAMESH_SERVICE:"https://datamesh.oceanum.io",Hs=class Pu{static LAZY_LOAD_SIZE=1e8;_token;_host;_authHeaders;_gateway;_nocache=!1;_isV1=!1;_sessionParams={};_currentSession=null;service;gateway;constructor(t=typeof process<"u"&&process.env?.DATAMESH_TOKEN?process.env.DATAMESH_TOKEN:"$DATAMESH_TOKEN",e){if(!t&&!e?.jwtAuth)throw new Error("A valid datamesh token must be supplied as a connector constructor argument or defined in environment variables as DATAMESH_TOKEN");this._token=t,this._nocache=e?.nocache??!1;const n=new URL(e?.service||gp);this._host=`${n.protocol}//${n.hostname}`,this._authHeaders=e?.jwtAuth?{Authorization:`Bearer ${e.jwtAuth}`}:{Authorization:`Token ${this._token}`,"X-DATAMESH-TOKEN":this._token},this._gateway=e?.gateway||this._host,this._host.split(".").slice(-1)[0]!==this._gateway.split(".").slice(-1)[0]&&console.warn("Datamesh gateway and service domains do not match"),e?.sessionDuration&&typeof e.sessionDuration=="number"&&(this._sessionParams={duration:e.sessionDuration}),this._checkApiVersion()}async _checkApiVersion(){try{(await fetch(`${this._gateway}/session`,{headers:this._authHeaders})).status===200?(this._isV1=!0,console.info("Using datamesh API version 1")):(this._isV1=!1,console.info("Using datamesh API version 0"))}catch{this._isV1=!1,console.info("Using datamesh API version 0")}}get host(){return this._host}async status(){return(await fetch(this._host,{headers:this._authHeaders})).status===200}async validateResponse(t){if(t.status>=400){let e;try{e=(await t.json()).detail}catch{e=`Datamesh server error: ${await t.text()}`}throw new Error(e)}}async createSession(t={}){const e={duration:t.duration||this._sessionParams.duration||3600};return this._currentSession=await fp.acquire(this,e),this._currentSession}async getSession(){return this._currentSession?this._currentSession:this.createSession()}async getSessionHeaders(t={}){return this._isV1&&!this._currentSession&&await this.createSession(),this._currentSession?this._currentSession.addHeader({...this._authHeaders,...t}):{...this._authHeaders,...t}}async metadataRequest(t="",e={}){const n=new URL(`${this._host}/datasource/${t}`);Object.keys(e).forEach(a=>n.searchParams.append(a,e[a]));const s=await this.getSessionHeaders(),i=await fetch(n.toString(),{headers:s});if(i.status===403)throw new Error(`Datasource ${t} not authorized`);return await this.validateResponse(i),i}async dataRequest(t,e="application/vnd.apache.arrow.file"){const n=await this.getSessionHeaders({Accept:e}),s=await fetch(`${this._gateway}/oceanql/${t}?f=arrow`,{headers:n});return await this.validateResponse(s),Iu(await s.arrayBuffer())}async stageRequest(t){const e=JSON.stringify(t),n=await this.getSessionHeaders({"Content-Type":"application/json"}),s=await fetch(`${this._gateway}/oceanql/stage/`,{method:"POST",headers:n,body:e});if(s.status>=400){const i=await s.json();throw new Error(i.detail)}else return s.status===204?null:s.json()}async query(t,e={}){const n=await this.stageRequest(t);if(!n)return console.warn("No data found for query"),null;if(n.size<Pu.LAZY_LOAD_SIZE&&n.container!="dataset"){const d=await this.dataRequest(n.qhash);return await Ye.fromArrow(d,n.coordkeys)}const s=`${this._gateway}/zarr/${this._isV1?"query/":""}${n.qhash}`,i=t.parameters,a=await this.getSessionHeaders(),c=await Ye.zarr(s,a,{parameters:i,timeout:e.timeout||6e4,nocache:this._nocache});if(t.variables)for(const d of Object.keys(c.variables))!t.variables.includes(d)&&!Object.values(c.coordkeys).includes(d)&&delete c.variables[d];return c}async getDatasource(t){const n=await(await this.metadataRequest(t)).json();return{id:t,geom:n.geometry,...n.properties}}async loadDatasource(t,e={}){const n={datasource:t,parameters:e};return await this.query(n)}async closeSession(t=!1){this._currentSession&&(await this._currentSession.close(t),this._currentSession=null)}};Ru([Ti],Hs.prototype,"stageRequest");Ru([Ti],Hs.prototype,"query");let mp=Hs;var Rn={exports:{}},wp=Rn.exports,ua;function bp(){return ua||(ua=1,function(r,t){(function(e,n){r.exports=n()})(wp,function(){var e=1e3,n=6e4,s=36e5,i="millisecond",a="second",c="minute",d="hour",f="day",y="week",B="month",L="quarter",x="year",M="date",U="Invalid Date",F=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,O=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(z){var R=["th","st","nd","rd"],D=z%100;return"["+z+(R[(D-20)%10]||R[D]||R[0])+"]"}},P=function(z,R,D){var Y=String(z);return!Y||Y.length>=R?z:""+Array(R+1-Y.length).join(D)+z},V={s:P,z:function(z){var R=-z.utcOffset(),D=Math.abs(R),Y=Math.floor(D/60),Z=D%60;return(R<=0?"+":"-")+P(Y,2,"0")+":"+P(Z,2,"0")},m:function z(R,D){if(R.date()<D.date())return-z(D,R);var Y=12*(D.year()-R.year())+(D.month()-R.month()),Z=R.clone().add(Y,B),X=D-Z<0,K=R.clone().add(Y+(X?-1:1),B);return+(-(Y+(D-Z)/(X?Z-K:K-Z))||0)},a:function(z){return z<0?Math.ceil(z)||0:Math.floor(z)},p:function(z){return{M:B,y:x,w:y,d:f,D:M,h:d,m:c,s:a,ms:i,Q:L}[z]||String(z||"").toLowerCase().replace(/s$/,"")},u:function(z){return z===void 0}},G="en",A={};A[G]=C;var N="$isDayjsObject",m=function(z){return z instanceof k||!(!z||!z[N])},S=function z(R,D,Y){var Z;if(!R)return G;if(typeof R=="string"){var X=R.toLowerCase();A[X]&&(Z=X),D&&(A[X]=D,Z=X);var K=R.split("-");if(!Z&&K.length>1)return z(K[0])}else{var q=R.name;A[q]=R,Z=q}return!Y&&Z&&(G=Z),Z||!Y&&G},w=function(z,R){if(m(z))return z.clone();var D=typeof R=="object"?R:{};return D.date=z,D.args=arguments,new k(D)},v=V;v.l=S,v.i=m,v.w=function(z,R){return w(z,{locale:R.$L,utc:R.$u,x:R.$x,$offset:R.$offset})};var k=function(){function z(D){this.$L=S(D.locale,null,!0),this.parse(D),this.$x=this.$x||D.x||{},this[N]=!0}var R=z.prototype;return R.parse=function(D){this.$d=function(Y){var Z=Y.date,X=Y.utc;if(Z===null)return new Date(NaN);if(v.u(Z))return new Date;if(Z instanceof Date)return new Date(Z);if(typeof Z=="string"&&!/Z$/i.test(Z)){var K=Z.match(F);if(K){var q=K[2]-1||0,rt=(K[7]||"0").substring(0,3);return X?new Date(Date.UTC(K[1],q,K[3]||1,K[4]||0,K[5]||0,K[6]||0,rt)):new Date(K[1],q,K[3]||1,K[4]||0,K[5]||0,K[6]||0,rt)}}return new Date(Z)}(D),this.init()},R.init=function(){var D=this.$d;this.$y=D.getFullYear(),this.$M=D.getMonth(),this.$D=D.getDate(),this.$W=D.getDay(),this.$H=D.getHours(),this.$m=D.getMinutes(),this.$s=D.getSeconds(),this.$ms=D.getMilliseconds()},R.$utils=function(){return v},R.isValid=function(){return this.$d.toString()!==U},R.isSame=function(D,Y){var Z=w(D);return this.startOf(Y)<=Z&&Z<=this.endOf(Y)},R.isAfter=function(D,Y){return w(D)<this.startOf(Y)},R.isBefore=function(D,Y){return this.endOf(Y)<w(D)},R.$g=function(D,Y,Z){return v.u(D)?this[Y]:this.set(Z,D)},R.unix=function(){return Math.floor(this.valueOf()/1e3)},R.valueOf=function(){return this.$d.getTime()},R.startOf=function(D,Y){var Z=this,X=!!v.u(Y)||Y,K=v.p(D),q=function(g,_){var T=v.w(Z.$u?Date.UTC(Z.$y,_,g):new Date(Z.$y,_,g),Z);return X?T:T.endOf(f)},rt=function(g,_){return v.w(Z.toDate()[g].apply(Z.toDate("s"),(X?[0,0,0,0]:[23,59,59,999]).slice(_)),Z)},At=this.$W,Ut=this.$M,Pt=this.$D,Zt="set"+(this.$u?"UTC":"");switch(K){case x:return X?q(1,0):q(31,11);case B:return X?q(1,Ut):q(0,Ut+1);case y:var Gt=this.$locale().weekStart||0,W=(At<Gt?At+7:At)-Gt;return q(X?Pt-W:Pt+(6-W),Ut);case f:case M:return rt(Zt+"Hours",0);case d:return rt(Zt+"Minutes",1);case c:return rt(Zt+"Seconds",2);case a:return rt(Zt+"Milliseconds",3);default:return this.clone()}},R.endOf=function(D){return this.startOf(D,!1)},R.$set=function(D,Y){var Z,X=v.p(D),K="set"+(this.$u?"UTC":""),q=(Z={},Z[f]=K+"Date",Z[M]=K+"Date",Z[B]=K+"Month",Z[x]=K+"FullYear",Z[d]=K+"Hours",Z[c]=K+"Minutes",Z[a]=K+"Seconds",Z[i]=K+"Milliseconds",Z)[X],rt=X===f?this.$D+(Y-this.$W):Y;if(X===B||X===x){var At=this.clone().set(M,1);At.$d[q](rt),At.init(),this.$d=At.set(M,Math.min(this.$D,At.daysInMonth())).$d}else q&&this.$d[q](rt);return this.init(),this},R.set=function(D,Y){return this.clone().$set(D,Y)},R.get=function(D){return this[v.p(D)]()},R.add=function(D,Y){var Z,X=this;D=Number(D);var K=v.p(Y),q=function(Ut){var Pt=w(X);return v.w(Pt.date(Pt.date()+Math.round(Ut*D)),X)};if(K===B)return this.set(B,this.$M+D);if(K===x)return this.set(x,this.$y+D);if(K===f)return q(1);if(K===y)return q(7);var rt=(Z={},Z[c]=n,Z[d]=s,Z[a]=e,Z)[K]||1,At=this.$d.getTime()+D*rt;return v.w(At,this)},R.subtract=function(D,Y){return this.add(-1*D,Y)},R.format=function(D){var Y=this,Z=this.$locale();if(!this.isValid())return Z.invalidDate||U;var X=D||"YYYY-MM-DDTHH:mm:ssZ",K=v.z(this),q=this.$H,rt=this.$m,At=this.$M,Ut=Z.weekdays,Pt=Z.months,Zt=Z.meridiem,Gt=function(_,T,j,$){return _&&(_[T]||_(Y,X))||j[T].slice(0,$)},W=function(_){return v.s(q%12||12,_,"0")},g=Zt||function(_,T,j){var $=_<12?"AM":"PM";return j?$.toLowerCase():$};return X.replace(O,function(_,T){return T||function(j){switch(j){case"YY":return String(Y.$y).slice(-2);case"YYYY":return v.s(Y.$y,4,"0");case"M":return At+1;case"MM":return v.s(At+1,2,"0");case"MMM":return Gt(Z.monthsShort,At,Pt,3);case"MMMM":return Gt(Pt,At);case"D":return Y.$D;case"DD":return v.s(Y.$D,2,"0");case"d":return String(Y.$W);case"dd":return Gt(Z.weekdaysMin,Y.$W,Ut,2);case"ddd":return Gt(Z.weekdaysShort,Y.$W,Ut,3);case"dddd":return Ut[Y.$W];case"H":return String(q);case"HH":return v.s(q,2,"0");case"h":return W(1);case"hh":return W(2);case"a":return g(q,rt,!0);case"A":return g(q,rt,!1);case"m":return String(rt);case"mm":return v.s(rt,2,"0");case"s":return String(Y.$s);case"ss":return v.s(Y.$s,2,"0");case"SSS":return v.s(Y.$ms,3,"0");case"Z":return K}return null}(_)||K.replace(":","")})},R.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},R.diff=function(D,Y,Z){var X,K=this,q=v.p(Y),rt=w(D),At=(rt.utcOffset()-this.utcOffset())*n,Ut=this-rt,Pt=function(){return v.m(K,rt)};switch(q){case x:X=Pt()/12;break;case B:X=Pt();break;case L:X=Pt()/3;break;case y:X=(Ut-At)/6048e5;break;case f:X=(Ut-At)/864e5;break;case d:X=Ut/s;break;case c:X=Ut/n;break;case a:X=Ut/e;break;default:X=Ut}return Z?X:v.a(X)},R.daysInMonth=function(){return this.endOf(B).$D},R.$locale=function(){return A[this.$L]},R.locale=function(D,Y){if(!D)return this.$L;var Z=this.clone(),X=S(D,Y,!0);return X&&(Z.$L=X),Z},R.clone=function(){return v.w(this.$d,this)},R.toDate=function(){return new Date(this.valueOf())},R.toJSON=function(){return this.isValid()?this.toISOString():null},R.toISOString=function(){return this.$d.toISOString()},R.toString=function(){return this.$d.toUTCString()},z}(),Q=k.prototype;return w.prototype=Q,[["$ms",i],["$s",a],["$m",c],["$H",d],["$W",f],["$M",B],["$y",x],["$D",M]].forEach(function(z){Q[z[1]]=function(R){return this.$g(R,z[0],z[1])}}),w.extend=function(z,R){return z.$i||(z(R,k,w),z.$i=!0),w},w.locale=S,w.isDayjs=m,w.unix=function(z){return w(1e3*z)},w.en=A[G],w.Ls=A,w.p={},w})}(Rn)),Rn.exports}var _p=bp();const mr=Vs(_p);var Pn={exports:{}},Sp=Pn.exports,ha;function Ip(){return ha||(ha=1,function(r,t){(function(e,n){r.exports=n()})(Sp,function(){var e,n,s=1e3,i=6e4,a=36e5,c=864e5,d=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,f=31536e6,y=2628e6,B=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,L={years:f,months:y,days:c,hours:a,minutes:i,seconds:s,milliseconds:1,weeks:6048e5},x=function(A){return A instanceof V},M=function(A,N,m){return new V(A,m,N.$l)},U=function(A){return n.p(A)+"s"},F=function(A){return A<0},O=function(A){return F(A)?Math.ceil(A):Math.floor(A)},C=function(A){return Math.abs(A)},P=function(A,N){return A?F(A)?{negative:!0,format:""+C(A)+N}:{negative:!1,format:""+A+N}:{negative:!1,format:""}},V=function(){function A(m,S,w){var v=this;if(this.$d={},this.$l=w,m===void 0&&(this.$ms=0,this.parseFromMilliseconds()),S)return M(m*L[U(S)],this);if(typeof m=="number")return this.$ms=m,this.parseFromMilliseconds(),this;if(typeof m=="object")return Object.keys(m).forEach(function(z){v.$d[U(z)]=m[z]}),this.calMilliseconds(),this;if(typeof m=="string"){var k=m.match(B);if(k){var Q=k.slice(2).map(function(z){return z!=null?Number(z):0});return this.$d.years=Q[0],this.$d.months=Q[1],this.$d.weeks=Q[2],this.$d.days=Q[3],this.$d.hours=Q[4],this.$d.minutes=Q[5],this.$d.seconds=Q[6],this.calMilliseconds(),this}}return this}var N=A.prototype;return N.calMilliseconds=function(){var m=this;this.$ms=Object.keys(this.$d).reduce(function(S,w){return S+(m.$d[w]||0)*L[w]},0)},N.parseFromMilliseconds=function(){var m=this.$ms;this.$d.years=O(m/f),m%=f,this.$d.months=O(m/y),m%=y,this.$d.days=O(m/c),m%=c,this.$d.hours=O(m/a),m%=a,this.$d.minutes=O(m/i),m%=i,this.$d.seconds=O(m/s),m%=s,this.$d.milliseconds=m},N.toISOString=function(){var m=P(this.$d.years,"Y"),S=P(this.$d.months,"M"),w=+this.$d.days||0;this.$d.weeks&&(w+=7*this.$d.weeks);var v=P(w,"D"),k=P(this.$d.hours,"H"),Q=P(this.$d.minutes,"M"),z=this.$d.seconds||0;this.$d.milliseconds&&(z+=this.$d.milliseconds/1e3,z=Math.round(1e3*z)/1e3);var R=P(z,"S"),D=m.negative||S.negative||v.negative||k.negative||Q.negative||R.negative,Y=k.format||Q.format||R.format?"T":"",Z=(D?"-":"")+"P"+m.format+S.format+v.format+Y+k.format+Q.format+R.format;return Z==="P"||Z==="-P"?"P0D":Z},N.toJSON=function(){return this.toISOString()},N.format=function(m){var S=m||"YYYY-MM-DDTHH:mm:ss",w={Y:this.$d.years,YY:n.s(this.$d.years,2,"0"),YYYY:n.s(this.$d.years,4,"0"),M:this.$d.months,MM:n.s(this.$d.months,2,"0"),D:this.$d.days,DD:n.s(this.$d.days,2,"0"),H:this.$d.hours,HH:n.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:n.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:n.s(this.$d.seconds,2,"0"),SSS:n.s(this.$d.milliseconds,3,"0")};return S.replace(d,function(v,k){return k||String(w[v])})},N.as=function(m){return this.$ms/L[U(m)]},N.get=function(m){var S=this.$ms,w=U(m);return w==="milliseconds"?S%=1e3:S=w==="weeks"?O(S/L[w]):this.$d[w],S||0},N.add=function(m,S,w){var v;return v=S?m*L[U(S)]:x(m)?m.$ms:M(m,this).$ms,M(this.$ms+v*(w?-1:1),this)},N.subtract=function(m,S){return this.add(m,S,!0)},N.locale=function(m){var S=this.clone();return S.$l=m,S},N.clone=function(){return M(this.$ms,this)},N.humanize=function(m){return e().add(this.$ms,"ms").locale(this.$l).fromNow(!m)},N.valueOf=function(){return this.asMilliseconds()},N.milliseconds=function(){return this.get("milliseconds")},N.asMilliseconds=function(){return this.as("milliseconds")},N.seconds=function(){return this.get("seconds")},N.asSeconds=function(){return this.as("seconds")},N.minutes=function(){return this.get("minutes")},N.asMinutes=function(){return this.as("minutes")},N.hours=function(){return this.get("hours")},N.asHours=function(){return this.as("hours")},N.days=function(){return this.get("days")},N.asDays=function(){return this.as("days")},N.weeks=function(){return this.get("weeks")},N.asWeeks=function(){return this.as("weeks")},N.months=function(){return this.get("months")},N.asMonths=function(){return this.as("months")},N.years=function(){return this.get("years")},N.asYears=function(){return this.as("years")},A}(),G=function(A,N,m){return A.add(N.years()*m,"y").add(N.months()*m,"M").add(N.days()*m,"d").add(N.hours()*m,"h").add(N.minutes()*m,"m").add(N.seconds()*m,"s").add(N.milliseconds()*m,"ms")};return function(A,N,m){e=m,n=m().$utils(),m.duration=function(v,k){var Q=m.locale();return M(v,{$l:Q},k)},m.isDuration=x;var S=N.prototype.add,w=N.prototype.subtract;N.prototype.add=function(v,k){return x(v)?G(this,v,1):S.bind(this)(v,k)},N.prototype.subtract=function(v,k){return x(v)?G(this,v,-1):w.bind(this)(v,k)}}})}(Pn)),Pn.exports}var Bp=Ip();const vp=Vs(Bp);mr.extend(vp);const xp=r=>{if(r instanceof Date)return mr(r).toISOString();if(r instanceof mr)return r.toISOString();if(r instanceof mr.duration)return r.toISOString();try{return mr.duration(r).toISOString()}catch{return mr(r).toISOString()}},Ap=r=>{const t=r.times.map(e=>xp(e));return{type:r.type||"range",times:t,resolution:r.resolution,resample:r.resample}};class Ep{datasource;parameters;description;variables;timefilter;geofilter;levelfilter;coordfilter;crs;aggregate;limit;id;constructor(t){this.datasource=t.datasource,this.parameters=t.parameters,this.description=t.description,this.variables=t.variables,this.timefilter=t.timefilter&&Ap(t.timefilter),this.geofilter=t.geofilter,this.levelfilter=t.levelfilter,this.coordfilter=t.coordfilter,this.crs=t.crs,this.aggregate=t.aggregate,this.limit=t.limit,this.id=t.id}toJSON(){return{datasource:this.datasource,parameters:this.parameters,description:this.description,variables:this.variables,timefilter:this.timefilter,geofilter:this.geofilter,levelfilter:this.levelfilter,coordfilter:this.coordfilter,crs:this.crs,aggregate:this.aggregate,limit:this.limit,id:this.id}}}exports.Connector=mp;exports.DataVar=wi;exports.Dataset=Ye;exports.Query=Ep;exports.cftimeToUnixSeconds=Du;exports.date2num=Qf;exports.getSupportedCalendars=tp;exports.hasCFTimeUnits=ku;exports.isCalendarSupported=Ou;exports.num2date=Xf;exports.parseCFUnits=Ni;exports.wkb_to_geojson=Uu;
|
|
7
|
+
`)},_domwindow:function(){return S("domwindow")},_bigint:function(w){return S("bigint:"+w.toString())},_process:function(){return S("process")},_timer:function(){return S("timer")},_pipe:function(){return S("pipe")},_tcp:function(){return S("tcp")},_udp:function(){return S("udp")},_tty:function(){return S("tty")},_statwatcher:function(){return S("statwatcher")},_securecontext:function(){return S("securecontext")},_connection:function(){return S("connection")},_zlib:function(){return S("zlib")},_context:function(){return S("context")},_nodescript:function(){return S("nodescript")},_httpparser:function(){return S("httpparser")},_dataview:function(){return S("dataview")},_signal:function(){return S("signal")},_fsevent:function(){return S("fsevent")},_tlswrap:function(){return S("tlswrap")}}}function G(){return{buf:"",write:function(A){this.buf+=A},end:function(A){this.buf+=A},read:function(){return this.buf}}}s.writeToStream=function(A,N,m){return m===void 0&&(m=N,N={}),V(N=C(A,N),m).dispatch(A)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_9a5aa49d.js","/")},{buffer:3,crypto:5,lYpoI2:11}],2:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){(function(M){var U=typeof Uint8Array<"u"?Uint8Array:Array,F=43,O=47,C=48,P=97,V=65,G=45,A=95;function N(m){return m=m.charCodeAt(0),m===F||m===G?62:m===O||m===A?63:m<C?-1:m<C+10?m-C+26+26:m<V+26?m-V:m<P+26?m-P+26:void 0}M.toByteArray=function(m){var S,w;if(0<m.length%4)throw new Error("Invalid string. Length must be a multiple of 4");var v=m.length,v=m.charAt(v-2)==="="?2:m.charAt(v-1)==="="?1:0,k=new U(3*m.length/4-v),Q=0<v?m.length-4:m.length,z=0;function R(D){k[z++]=D}for(S=0;S<Q;S+=4,0)R((16711680&(w=N(m.charAt(S))<<18|N(m.charAt(S+1))<<12|N(m.charAt(S+2))<<6|N(m.charAt(S+3))))>>16),R((65280&w)>>8),R(255&w);return v==2?R(255&(w=N(m.charAt(S))<<2|N(m.charAt(S+1))>>4)):v==1&&(R((w=N(m.charAt(S))<<10|N(m.charAt(S+1))<<4|N(m.charAt(S+2))>>2)>>8&255),R(255&w)),k},M.fromByteArray=function(m){var S,w,v,k,Q=m.length%3,z="";function R(D){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(D)}for(S=0,v=m.length-Q;S<v;S+=3)w=(m[S]<<16)+(m[S+1]<<8)+m[S+2],z+=R((k=w)>>18&63)+R(k>>12&63)+R(k>>6&63)+R(63&k);switch(Q){case 1:z=(z+=R((w=m[m.length-1])>>2))+R(w<<4&63)+"==";break;case 2:z=(z=(z+=R((w=(m[m.length-2]<<8)+m[m.length-1])>>10))+R(w>>4&63))+R(w<<2&63)+"="}return z}})(s===void 0?this.base64js={}:s)}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(e,n,s){(function(i,c,F,d,f,y,B,L,x){var M=e("base64-js"),U=e("ieee754");function F(g,_,T){if(!(this instanceof F))return new F(g,_,T);var j,$,J,bt,Ot=typeof g;if(_==="base64"&&Ot=="string")for(g=(bt=g).trim?bt.trim():bt.replace(/^\s+|\s+$/g,"");g.length%4!=0;)g+="=";if(Ot=="number")j=Z(g);else if(Ot=="string")j=F.byteLength(g,_);else{if(Ot!="object")throw new Error("First argument needs to be a number, array or string.");j=Z(g.length)}if(F._useTypedArrays?$=F._augment(new Uint8Array(j)):(($=this).length=j,$._isBuffer=!0),F._useTypedArrays&&typeof g.byteLength=="number")$._set(g);else if(X(bt=g)||F.isBuffer(bt)||bt&&typeof bt=="object"&&typeof bt.length=="number")for(J=0;J<j;J++)F.isBuffer(g)?$[J]=g.readUInt8(J):$[J]=g[J];else if(Ot=="string")$.write(g,0,_);else if(Ot=="number"&&!F._useTypedArrays&&!T)for(J=0;J<j;J++)$[J]=0;return $}function O(g,_,T,j){return F._charsWritten=At(function($){for(var J=[],bt=0;bt<$.length;bt++)J.push(255&$.charCodeAt(bt));return J}(_),g,T,j)}function C(g,_,T,j){return F._charsWritten=At(function($){for(var J,bt,Ot=[],kt=0;kt<$.length;kt++)bt=$.charCodeAt(kt),J=bt>>8,bt=bt%256,Ot.push(bt),Ot.push(J);return Ot}(_),g,T,j)}function P(g,_,T){var j="";T=Math.min(g.length,T);for(var $=_;$<T;$++)j+=String.fromCharCode(g[$]);return j}function V(g,_,T,J){J||(W(typeof T=="boolean","missing or invalid endian"),W(_!=null,"missing offset"),W(_+1<g.length,"Trying to read beyond buffer length"));var $,J=g.length;if(!(J<=_))return T?($=g[_],_+1<J&&($|=g[_+1]<<8)):($=g[_]<<8,_+1<J&&($|=g[_+1])),$}function G(g,_,T,J){J||(W(typeof T=="boolean","missing or invalid endian"),W(_!=null,"missing offset"),W(_+3<g.length,"Trying to read beyond buffer length"));var $,J=g.length;if(!(J<=_))return T?(_+2<J&&($=g[_+2]<<16),_+1<J&&($|=g[_+1]<<8),$|=g[_],_+3<J&&($+=g[_+3]<<24>>>0)):(_+1<J&&($=g[_+1]<<16),_+2<J&&($|=g[_+2]<<8),_+3<J&&($|=g[_+3]),$+=g[_]<<24>>>0),$}function A(g,_,T,j){if(j||(W(typeof T=="boolean","missing or invalid endian"),W(_!=null,"missing offset"),W(_+1<g.length,"Trying to read beyond buffer length")),!(g.length<=_))return j=V(g,_,T,!0),32768&j?-1*(65535-j+1):j}function N(g,_,T,j){if(j||(W(typeof T=="boolean","missing or invalid endian"),W(_!=null,"missing offset"),W(_+3<g.length,"Trying to read beyond buffer length")),!(g.length<=_))return j=G(g,_,T,!0),2147483648&j?-1*(4294967295-j+1):j}function m(g,_,T,j){return j||(W(typeof T=="boolean","missing or invalid endian"),W(_+3<g.length,"Trying to read beyond buffer length")),U.read(g,_,T,23,4)}function S(g,_,T,j){return j||(W(typeof T=="boolean","missing or invalid endian"),W(_+7<g.length,"Trying to read beyond buffer length")),U.read(g,_,T,52,8)}function w(g,_,T,j,$){if($||(W(_!=null,"missing value"),W(typeof j=="boolean","missing or invalid endian"),W(T!=null,"missing offset"),W(T+1<g.length,"trying to write beyond buffer length"),Pt(_,65535)),$=g.length,!($<=T))for(var J=0,bt=Math.min($-T,2);J<bt;J++)g[T+J]=(_&255<<8*(j?J:1-J))>>>8*(j?J:1-J)}function v(g,_,T,j,$){if($||(W(_!=null,"missing value"),W(typeof j=="boolean","missing or invalid endian"),W(T!=null,"missing offset"),W(T+3<g.length,"trying to write beyond buffer length"),Pt(_,4294967295)),$=g.length,!($<=T))for(var J=0,bt=Math.min($-T,4);J<bt;J++)g[T+J]=_>>>8*(j?J:3-J)&255}function k(g,_,T,j,$){$||(W(_!=null,"missing value"),W(typeof j=="boolean","missing or invalid endian"),W(T!=null,"missing offset"),W(T+1<g.length,"Trying to write beyond buffer length"),Zt(_,32767,-32768)),g.length<=T||w(g,0<=_?_:65535+_+1,T,j,$)}function Q(g,_,T,j,$){$||(W(_!=null,"missing value"),W(typeof j=="boolean","missing or invalid endian"),W(T!=null,"missing offset"),W(T+3<g.length,"Trying to write beyond buffer length"),Zt(_,2147483647,-2147483648)),g.length<=T||v(g,0<=_?_:4294967295+_+1,T,j,$)}function z(g,_,T,j,$){$||(W(_!=null,"missing value"),W(typeof j=="boolean","missing or invalid endian"),W(T!=null,"missing offset"),W(T+3<g.length,"Trying to write beyond buffer length"),Gt(_,34028234663852886e22,-34028234663852886e22)),g.length<=T||U.write(g,_,T,j,23,4)}function R(g,_,T,j,$){$||(W(_!=null,"missing value"),W(typeof j=="boolean","missing or invalid endian"),W(T!=null,"missing offset"),W(T+7<g.length,"Trying to write beyond buffer length"),Gt(_,17976931348623157e292,-17976931348623157e292)),g.length<=T||U.write(g,_,T,j,52,8)}s.Buffer=F,s.SlowBuffer=F,s.INSPECT_MAX_BYTES=50,F.poolSize=8192,F._useTypedArrays=function(){try{var g=new ArrayBuffer(0),_=new Uint8Array(g);return _.foo=function(){return 42},_.foo()===42&&typeof _.subarray=="function"}catch{return!1}}(),F.isEncoding=function(g){switch(String(g).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},F.isBuffer=function(g){return!(g==null||!g._isBuffer)},F.byteLength=function(g,_){var T;switch(g+="",_||"utf8"){case"hex":T=g.length/2;break;case"utf8":case"utf-8":T=q(g).length;break;case"ascii":case"binary":case"raw":T=g.length;break;case"base64":T=rt(g).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":T=2*g.length;break;default:throw new Error("Unknown encoding")}return T},F.concat=function(g,_){if(W(X(g),`Usage: Buffer.concat(list, [totalLength])
|
|
8
|
+
list should be an Array.`),g.length===0)return new F(0);if(g.length===1)return g[0];if(typeof _!="number")for($=_=0;$<g.length;$++)_+=g[$].length;for(var T=new F(_),j=0,$=0;$<g.length;$++){var J=g[$];J.copy(T,j),j+=J.length}return T},F.prototype.write=function(g,_,T,j){isFinite(_)?isFinite(T)||(j=T,T=void 0):(kt=j,j=_,_=T,T=kt),_=Number(_)||0;var $,J,bt,Ot,kt=this.length-_;switch((!T||kt<(T=Number(T)))&&(T=kt),j=String(j||"utf8").toLowerCase()){case"hex":$=function(Ht,Vt,$t,Nt){$t=Number($t)||0;var mt=Ht.length-$t;(!Nt||mt<(Nt=Number(Nt)))&&(Nt=mt),W((mt=Vt.length)%2==0,"Invalid hex string"),mt/2<Nt&&(Nt=mt/2);for(var Qt=0;Qt<Nt;Qt++){var sr=parseInt(Vt.substr(2*Qt,2),16);W(!isNaN(sr),"Invalid hex string"),Ht[$t+Qt]=sr}return F._charsWritten=2*Qt,Qt}(this,g,_,T);break;case"utf8":case"utf-8":J=this,bt=_,Ot=T,$=F._charsWritten=At(q(g),J,bt,Ot);break;case"ascii":case"binary":$=O(this,g,_,T);break;case"base64":J=this,bt=_,Ot=T,$=F._charsWritten=At(rt(g),J,bt,Ot);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":$=C(this,g,_,T);break;default:throw new Error("Unknown encoding")}return $},F.prototype.toString=function(g,_,T){var j,$,J,bt,Ot=this;if(g=String(g||"utf8").toLowerCase(),_=Number(_)||0,(T=T!==void 0?Number(T):Ot.length)===_)return"";switch(g){case"hex":j=function(kt,Ht,Vt){var $t=kt.length;(!Ht||Ht<0)&&(Ht=0),(!Vt||Vt<0||$t<Vt)&&(Vt=$t);for(var Nt="",mt=Ht;mt<Vt;mt++)Nt+=K(kt[mt]);return Nt}(Ot,_,T);break;case"utf8":case"utf-8":j=function(kt,Ht,Vt){var $t="",Nt="";Vt=Math.min(kt.length,Vt);for(var mt=Ht;mt<Vt;mt++)kt[mt]<=127?($t+=Ut(Nt)+String.fromCharCode(kt[mt]),Nt=""):Nt+="%"+kt[mt].toString(16);return $t+Ut(Nt)}(Ot,_,T);break;case"ascii":case"binary":j=P(Ot,_,T);break;case"base64":$=Ot,bt=T,j=(J=_)===0&&bt===$.length?M.fromByteArray($):M.fromByteArray($.slice(J,bt));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":j=function(kt,Ht,Vt){for(var $t=kt.slice(Ht,Vt),Nt="",mt=0;mt<$t.length;mt+=2)Nt+=String.fromCharCode($t[mt]+256*$t[mt+1]);return Nt}(Ot,_,T);break;default:throw new Error("Unknown encoding")}return j},F.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},F.prototype.copy=function(g,_,T,j){if(_=_||0,(j=j||j===0?j:this.length)!==(T=T||0)&&g.length!==0&&this.length!==0){W(T<=j,"sourceEnd < sourceStart"),W(0<=_&&_<g.length,"targetStart out of bounds"),W(0<=T&&T<this.length,"sourceStart out of bounds"),W(0<=j&&j<=this.length,"sourceEnd out of bounds"),j>this.length&&(j=this.length);var $=(j=g.length-_<j-T?g.length-_+T:j)-T;if($<100||!F._useTypedArrays)for(var J=0;J<$;J++)g[J+_]=this[J+T];else g._set(this.subarray(T,T+$),_)}},F.prototype.slice=function(g,_){var T=this.length;if(g=Y(g,T,0),_=Y(_,T,T),F._useTypedArrays)return F._augment(this.subarray(g,_));for(var j=_-g,$=new F(j,void 0,!0),J=0;J<j;J++)$[J]=this[J+g];return $},F.prototype.get=function(g){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(g)},F.prototype.set=function(g,_){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(g,_)},F.prototype.readUInt8=function(g,_){if(_||(W(g!=null,"missing offset"),W(g<this.length,"Trying to read beyond buffer length")),!(g>=this.length))return this[g]},F.prototype.readUInt16LE=function(g,_){return V(this,g,!0,_)},F.prototype.readUInt16BE=function(g,_){return V(this,g,!1,_)},F.prototype.readUInt32LE=function(g,_){return G(this,g,!0,_)},F.prototype.readUInt32BE=function(g,_){return G(this,g,!1,_)},F.prototype.readInt8=function(g,_){if(_||(W(g!=null,"missing offset"),W(g<this.length,"Trying to read beyond buffer length")),!(g>=this.length))return 128&this[g]?-1*(255-this[g]+1):this[g]},F.prototype.readInt16LE=function(g,_){return A(this,g,!0,_)},F.prototype.readInt16BE=function(g,_){return A(this,g,!1,_)},F.prototype.readInt32LE=function(g,_){return N(this,g,!0,_)},F.prototype.readInt32BE=function(g,_){return N(this,g,!1,_)},F.prototype.readFloatLE=function(g,_){return m(this,g,!0,_)},F.prototype.readFloatBE=function(g,_){return m(this,g,!1,_)},F.prototype.readDoubleLE=function(g,_){return S(this,g,!0,_)},F.prototype.readDoubleBE=function(g,_){return S(this,g,!1,_)},F.prototype.writeUInt8=function(g,_,T){T||(W(g!=null,"missing value"),W(_!=null,"missing offset"),W(_<this.length,"trying to write beyond buffer length"),Pt(g,255)),_>=this.length||(this[_]=g)},F.prototype.writeUInt16LE=function(g,_,T){w(this,g,_,!0,T)},F.prototype.writeUInt16BE=function(g,_,T){w(this,g,_,!1,T)},F.prototype.writeUInt32LE=function(g,_,T){v(this,g,_,!0,T)},F.prototype.writeUInt32BE=function(g,_,T){v(this,g,_,!1,T)},F.prototype.writeInt8=function(g,_,T){T||(W(g!=null,"missing value"),W(_!=null,"missing offset"),W(_<this.length,"Trying to write beyond buffer length"),Zt(g,127,-128)),_>=this.length||(0<=g?this.writeUInt8(g,_,T):this.writeUInt8(255+g+1,_,T))},F.prototype.writeInt16LE=function(g,_,T){k(this,g,_,!0,T)},F.prototype.writeInt16BE=function(g,_,T){k(this,g,_,!1,T)},F.prototype.writeInt32LE=function(g,_,T){Q(this,g,_,!0,T)},F.prototype.writeInt32BE=function(g,_,T){Q(this,g,_,!1,T)},F.prototype.writeFloatLE=function(g,_,T){z(this,g,_,!0,T)},F.prototype.writeFloatBE=function(g,_,T){z(this,g,_,!1,T)},F.prototype.writeDoubleLE=function(g,_,T){R(this,g,_,!0,T)},F.prototype.writeDoubleBE=function(g,_,T){R(this,g,_,!1,T)},F.prototype.fill=function(g,_,T){if(_=_||0,T=T||this.length,W(typeof(g=typeof(g=g||0)=="string"?g.charCodeAt(0):g)=="number"&&!isNaN(g),"value is not a number"),W(_<=T,"end < start"),T!==_&&this.length!==0){W(0<=_&&_<this.length,"start out of bounds"),W(0<=T&&T<=this.length,"end out of bounds");for(var j=_;j<T;j++)this[j]=g}},F.prototype.inspect=function(){for(var g=[],_=this.length,T=0;T<_;T++)if(g[T]=K(this[T]),T===s.INSPECT_MAX_BYTES){g[T+1]="...";break}return"<Buffer "+g.join(" ")+">"},F.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(F._useTypedArrays)return new F(this).buffer;for(var g=new Uint8Array(this.length),_=0,T=g.length;_<T;_+=1)g[_]=this[_];return g.buffer};var D=F.prototype;function Y(g,_,T){return typeof g!="number"?T:_<=(g=~~g)?_:0<=g||0<=(g+=_)?g:0}function Z(g){return(g=~~Math.ceil(+g))<0?0:g}function X(g){return(Array.isArray||function(_){return Object.prototype.toString.call(_)==="[object Array]"})(g)}function K(g){return g<16?"0"+g.toString(16):g.toString(16)}function q(g){for(var _=[],T=0;T<g.length;T++){var j=g.charCodeAt(T);if(j<=127)_.push(g.charCodeAt(T));else for(var $=T,J=(55296<=j&&j<=57343&&T++,encodeURIComponent(g.slice($,T+1)).substr(1).split("%")),bt=0;bt<J.length;bt++)_.push(parseInt(J[bt],16))}return _}function rt(g){return M.toByteArray(g)}function At(g,_,T,j){for(var $=0;$<j&&!($+T>=_.length||$>=g.length);$++)_[$+T]=g[$];return $}function Ut(g){try{return decodeURIComponent(g)}catch{return"�"}}function Pt(g,_){W(typeof g=="number","cannot write a non-number as a number"),W(0<=g,"specified a negative value for writing an unsigned value"),W(g<=_,"value is larger than maximum value for type"),W(Math.floor(g)===g,"value has a fractional component")}function Zt(g,_,T){W(typeof g=="number","cannot write a non-number as a number"),W(g<=_,"value larger than maximum allowed value"),W(T<=g,"value smaller than minimum allowed value"),W(Math.floor(g)===g,"value has a fractional component")}function Gt(g,_,T){W(typeof g=="number","cannot write a non-number as a number"),W(g<=_,"value larger than maximum allowed value"),W(T<=g,"value smaller than minimum allowed value")}function W(g,_){if(!g)throw new Error(_||"Failed assertion")}F._augment=function(g){return g._isBuffer=!0,g._get=g.get,g._set=g.set,g.get=D.get,g.set=D.set,g.write=D.write,g.toString=D.toString,g.toLocaleString=D.toString,g.toJSON=D.toJSON,g.copy=D.copy,g.slice=D.slice,g.readUInt8=D.readUInt8,g.readUInt16LE=D.readUInt16LE,g.readUInt16BE=D.readUInt16BE,g.readUInt32LE=D.readUInt32LE,g.readUInt32BE=D.readUInt32BE,g.readInt8=D.readInt8,g.readInt16LE=D.readInt16LE,g.readInt16BE=D.readInt16BE,g.readInt32LE=D.readInt32LE,g.readInt32BE=D.readInt32BE,g.readFloatLE=D.readFloatLE,g.readFloatBE=D.readFloatBE,g.readDoubleLE=D.readDoubleLE,g.readDoubleBE=D.readDoubleBE,g.writeUInt8=D.writeUInt8,g.writeUInt16LE=D.writeUInt16LE,g.writeUInt16BE=D.writeUInt16BE,g.writeUInt32LE=D.writeUInt32LE,g.writeUInt32BE=D.writeUInt32BE,g.writeInt8=D.writeInt8,g.writeInt16LE=D.writeInt16LE,g.writeInt16BE=D.writeInt16BE,g.writeInt32LE=D.writeInt32LE,g.writeInt32BE=D.writeInt32BE,g.writeFloatLE=D.writeFloatLE,g.writeFloatBE=D.writeFloatBE,g.writeDoubleLE=D.writeDoubleLE,g.writeDoubleBE=D.writeDoubleBE,g.fill=D.fill,g.inspect=D.inspect,g.toArrayBuffer=D.toArrayBuffer,g}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(e,n,s){(function(i,c,M,d,f,y,B,L,x){var M=e("buffer").Buffer,U=4,F=new M(U);F.fill(0),n.exports={hash:function(O,C,P,V){for(var G=C(function(w,v){w.length%U!=0&&(k=w.length+(U-w.length%U),w=M.concat([w,F],k));for(var k,Q=[],z=v?w.readInt32BE:w.readInt32LE,R=0;R<w.length;R+=U)Q.push(z.call(w,R));return Q}(O=M.isBuffer(O)?O:new M(O),V),8*O.length),C=V,A=new M(P),N=C?A.writeInt32BE:A.writeInt32LE,m=0;m<G.length;m++)N.call(A,G[m],4*m,!0);return A}}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],5:[function(e,n,s){(function(i,c,M,d,f,y,B,L,x){var M=e("buffer").Buffer,U=e("./sha"),F=e("./sha256"),O=e("./rng"),C={sha1:U,sha256:F,md5:e("./md5")},P=64,V=new M(P);function G(w,v){var k=C[w=w||"sha1"],Q=[];return k||A("algorithm:",w,"is not yet supported"),{update:function(z){return M.isBuffer(z)||(z=new M(z)),Q.push(z),z.length,this},digest:function(z){var R=M.concat(Q),R=v?function(D,Y,Z){M.isBuffer(Y)||(Y=new M(Y)),M.isBuffer(Z)||(Z=new M(Z)),Y.length>P?Y=D(Y):Y.length<P&&(Y=M.concat([Y,V],P));for(var X=new M(P),K=new M(P),q=0;q<P;q++)X[q]=54^Y[q],K[q]=92^Y[q];return Z=D(M.concat([X,Z])),D(M.concat([K,Z]))}(k,v,R):k(R);return Q=null,z?R.toString(z):R}}}function A(){var w=[].slice.call(arguments).join(" ");throw new Error([w,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join(`
|
|
9
|
+
`))}V.fill(0),s.createHash=function(w){return G(w)},s.createHmac=G,s.randomBytes=function(w,v){if(!v||!v.call)return new M(O(w));try{v.call(this,void 0,new M(O(w)))}catch(k){v(k)}};var N,m=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],S=function(w){s[w]=function(){A("sorry,",w,"is not implemented yet")}};for(N in m)S(m[N])}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){var M=e("./helpers");function U(A,N){A[N>>5]|=128<<N%32,A[14+(N+64>>>9<<4)]=N;for(var m=1732584193,S=-271733879,w=-1732584194,v=271733878,k=0;k<A.length;k+=16){var Q=m,z=S,R=w,D=v,m=O(m,S,w,v,A[k+0],7,-680876936),v=O(v,m,S,w,A[k+1],12,-389564586),w=O(w,v,m,S,A[k+2],17,606105819),S=O(S,w,v,m,A[k+3],22,-1044525330);m=O(m,S,w,v,A[k+4],7,-176418897),v=O(v,m,S,w,A[k+5],12,1200080426),w=O(w,v,m,S,A[k+6],17,-1473231341),S=O(S,w,v,m,A[k+7],22,-45705983),m=O(m,S,w,v,A[k+8],7,1770035416),v=O(v,m,S,w,A[k+9],12,-1958414417),w=O(w,v,m,S,A[k+10],17,-42063),S=O(S,w,v,m,A[k+11],22,-1990404162),m=O(m,S,w,v,A[k+12],7,1804603682),v=O(v,m,S,w,A[k+13],12,-40341101),w=O(w,v,m,S,A[k+14],17,-1502002290),m=C(m,S=O(S,w,v,m,A[k+15],22,1236535329),w,v,A[k+1],5,-165796510),v=C(v,m,S,w,A[k+6],9,-1069501632),w=C(w,v,m,S,A[k+11],14,643717713),S=C(S,w,v,m,A[k+0],20,-373897302),m=C(m,S,w,v,A[k+5],5,-701558691),v=C(v,m,S,w,A[k+10],9,38016083),w=C(w,v,m,S,A[k+15],14,-660478335),S=C(S,w,v,m,A[k+4],20,-405537848),m=C(m,S,w,v,A[k+9],5,568446438),v=C(v,m,S,w,A[k+14],9,-1019803690),w=C(w,v,m,S,A[k+3],14,-187363961),S=C(S,w,v,m,A[k+8],20,1163531501),m=C(m,S,w,v,A[k+13],5,-1444681467),v=C(v,m,S,w,A[k+2],9,-51403784),w=C(w,v,m,S,A[k+7],14,1735328473),m=P(m,S=C(S,w,v,m,A[k+12],20,-1926607734),w,v,A[k+5],4,-378558),v=P(v,m,S,w,A[k+8],11,-2022574463),w=P(w,v,m,S,A[k+11],16,1839030562),S=P(S,w,v,m,A[k+14],23,-35309556),m=P(m,S,w,v,A[k+1],4,-1530992060),v=P(v,m,S,w,A[k+4],11,1272893353),w=P(w,v,m,S,A[k+7],16,-155497632),S=P(S,w,v,m,A[k+10],23,-1094730640),m=P(m,S,w,v,A[k+13],4,681279174),v=P(v,m,S,w,A[k+0],11,-358537222),w=P(w,v,m,S,A[k+3],16,-722521979),S=P(S,w,v,m,A[k+6],23,76029189),m=P(m,S,w,v,A[k+9],4,-640364487),v=P(v,m,S,w,A[k+12],11,-421815835),w=P(w,v,m,S,A[k+15],16,530742520),m=V(m,S=P(S,w,v,m,A[k+2],23,-995338651),w,v,A[k+0],6,-198630844),v=V(v,m,S,w,A[k+7],10,1126891415),w=V(w,v,m,S,A[k+14],15,-1416354905),S=V(S,w,v,m,A[k+5],21,-57434055),m=V(m,S,w,v,A[k+12],6,1700485571),v=V(v,m,S,w,A[k+3],10,-1894986606),w=V(w,v,m,S,A[k+10],15,-1051523),S=V(S,w,v,m,A[k+1],21,-2054922799),m=V(m,S,w,v,A[k+8],6,1873313359),v=V(v,m,S,w,A[k+15],10,-30611744),w=V(w,v,m,S,A[k+6],15,-1560198380),S=V(S,w,v,m,A[k+13],21,1309151649),m=V(m,S,w,v,A[k+4],6,-145523070),v=V(v,m,S,w,A[k+11],10,-1120210379),w=V(w,v,m,S,A[k+2],15,718787259),S=V(S,w,v,m,A[k+9],21,-343485551),m=G(m,Q),S=G(S,z),w=G(w,R),v=G(v,D)}return Array(m,S,w,v)}function F(A,N,m,S,w,v){return G((N=G(G(N,A),G(S,v)))<<w|N>>>32-w,m)}function O(A,N,m,S,w,v,k){return F(N&m|~N&S,A,N,w,v,k)}function C(A,N,m,S,w,v,k){return F(N&S|m&~S,A,N,w,v,k)}function P(A,N,m,S,w,v,k){return F(N^m^S,A,N,w,v,k)}function V(A,N,m,S,w,v,k){return F(m^(N|~S),A,N,w,v,k)}function G(A,N){var m=(65535&A)+(65535&N);return(A>>16)+(N>>16)+(m>>16)<<16|65535&m}n.exports=function(A){return M.hash(A,U,16)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){n.exports=function(M){for(var U,F=new Array(M),O=0;O<M;O++)(3&O)==0&&(U=4294967296*Math.random()),F[O]=U>>>((3&O)<<3)&255;return F}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){var M=e("./helpers");function U(C,P){C[P>>5]|=128<<24-P%32,C[15+(P+64>>9<<4)]=P;for(var V,G,A,N=Array(80),m=1732584193,S=-271733879,w=-1732584194,v=271733878,k=-1009589776,Q=0;Q<C.length;Q+=16){for(var z=m,R=S,D=w,Y=v,Z=k,X=0;X<80;X++){N[X]=X<16?C[Q+X]:O(N[X-3]^N[X-8]^N[X-14]^N[X-16],1);var K=F(F(O(m,5),(K=S,G=w,A=v,(V=X)<20?K&G|~K&A:!(V<40)&&V<60?K&G|K&A|G&A:K^G^A)),F(F(k,N[X]),(V=X)<20?1518500249:V<40?1859775393:V<60?-1894007588:-899497514)),k=v,v=w,w=O(S,30),S=m,m=K}m=F(m,z),S=F(S,R),w=F(w,D),v=F(v,Y),k=F(k,Z)}return Array(m,S,w,v,k)}function F(C,P){var V=(65535&C)+(65535&P);return(C>>16)+(P>>16)+(V>>16)<<16|65535&V}function O(C,P){return C<<P|C>>>32-P}n.exports=function(C){return M.hash(C,U,20,!0)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){function M(P,V){var G=(65535&P)+(65535&V);return(P>>16)+(V>>16)+(G>>16)<<16|65535&G}function U(P,V){var G,A=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),N=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),m=new Array(64);P[V>>5]|=128<<24-V%32,P[15+(V+64>>9<<4)]=V;for(var S,w,v=0;v<P.length;v+=16){for(var k=N[0],Q=N[1],z=N[2],R=N[3],D=N[4],Y=N[5],Z=N[6],X=N[7],K=0;K<64;K++)m[K]=K<16?P[K+v]:M(M(M((w=m[K-2],O(w,17)^O(w,19)^C(w,10)),m[K-7]),(w=m[K-15],O(w,7)^O(w,18)^C(w,3))),m[K-16]),G=M(M(M(M(X,O(w=D,6)^O(w,11)^O(w,25)),D&Y^~D&Z),A[K]),m[K]),S=M(O(S=k,2)^O(S,13)^O(S,22),k&Q^k&z^Q&z),X=Z,Z=Y,Y=D,D=M(R,G),R=z,z=Q,Q=k,k=M(G,S);N[0]=M(k,N[0]),N[1]=M(Q,N[1]),N[2]=M(z,N[2]),N[3]=M(R,N[3]),N[4]=M(D,N[4]),N[5]=M(Y,N[5]),N[6]=M(Z,N[6]),N[7]=M(X,N[7])}return N}var F=e("./helpers"),O=function(P,V){return P>>>V|P<<32-V},C=function(P,V){return P>>>V};n.exports=function(P){return F.hash(P,U,32,!0)}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){s.read=function(M,U,F,O,v){var P,V,G=8*v-O-1,A=(1<<G)-1,N=A>>1,m=-7,S=F?v-1:0,w=F?-1:1,v=M[U+S];for(S+=w,P=v&(1<<-m)-1,v>>=-m,m+=G;0<m;P=256*P+M[U+S],S+=w,m-=8);for(V=P&(1<<-m)-1,P>>=-m,m+=O;0<m;V=256*V+M[U+S],S+=w,m-=8);if(P===0)P=1-N;else{if(P===A)return V?NaN:1/0*(v?-1:1);V+=Math.pow(2,O),P-=N}return(v?-1:1)*V*Math.pow(2,P-O)},s.write=function(M,U,F,O,C,k){var V,G,A=8*k-C-1,N=(1<<A)-1,m=N>>1,S=C===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=O?0:k-1,v=O?1:-1,k=U<0||U===0&&1/U<0?1:0;for(U=Math.abs(U),isNaN(U)||U===1/0?(G=isNaN(U)?1:0,V=N):(V=Math.floor(Math.log(U)/Math.LN2),U*(O=Math.pow(2,-V))<1&&(V--,O*=2),2<=(U+=1<=V+m?S/O:S*Math.pow(2,1-m))*O&&(V++,O/=2),N<=V+m?(G=0,V=N):1<=V+m?(G=(U*O-1)*Math.pow(2,C),V+=m):(G=U*Math.pow(2,m-1)*Math.pow(2,C),V=0));8<=C;M[F+w]=255&G,w+=v,G/=256,C-=8);for(V=V<<C|G,A+=C;0<A;M[F+w]=255&V,w+=v,V/=256,A-=8);M[F+w-v]|=128*k}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754")},{buffer:3,lYpoI2:11}],11:[function(e,n,s){(function(i,c,a,d,f,y,B,L,x){var M,U,F;function O(){}(i=n.exports={}).nextTick=(U=typeof window<"u"&&window.setImmediate,F=typeof window<"u"&&window.postMessage&&window.addEventListener,U?function(C){return window.setImmediate(C)}:F?(M=[],window.addEventListener("message",function(C){var P=C.source;P!==window&&P!==null||C.data!=="process-tick"||(C.stopPropagation(),0<M.length&&M.shift()())},!0),function(C){M.push(C),window.postMessage("process-tick","*")}):function(C){setTimeout(C,0)}),i.title="browser",i.browser=!0,i.env={},i.argv=[],i.on=O,i.addListener=O,i.once=O,i.off=O,i.removeListener=O,i.removeAllListeners=O,i.emit=O,i.binding=function(C){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(C){throw new Error("process.chdir is not supported")}}).call(this,e("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:11}]},{},[1])(1)})}(Wi)),Wi.exports}var If=Sf();const Bf=Vs(If);new TextEncoder;const vf=4096;function Nu(r,t,e){let n=t;const s=n+e,i=[];let c="";for(;n<s;){const a=r[n++];if((a&128)===0)i.push(a);else if((a&224)===192){const d=r[n++]&63;i.push((a&31)<<6|d)}else if((a&240)===224){const d=r[n++]&63,f=r[n++]&63;i.push((a&31)<<12|d<<6|f)}else if((a&248)===240){const d=r[n++]&63,f=r[n++]&63,y=r[n++]&63;let B=(a&7)<<18|d<<12|f<<6|y;B>65535&&(B-=65536,i.push(B>>>10&1023|55296),B=56320|B&1023),i.push(B)}else i.push(a);i.length>=vf&&(c+=String.fromCharCode(...i),i.length=0)}return i.length>0&&(c+=String.fromCharCode(...i)),c}const xf=new TextDecoder,Af=200;function Ef(r,t,e){const n=r.subarray(t,t+e);return xf.decode(n)}function Tf(r,t,e){return e>Af?Ef(r,t,e):Nu(r,t,e)}class En{constructor(t,e){this.type=t,this.data=e}}class se extends Error{constructor(t){super(t);const e=Object.create(se.prototype);Object.setPrototypeOf(this,e),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:se.name})}}const Hr=4294967295;function Mf(r,t,e){const n=Math.floor(e/4294967296),s=e;r.setUint32(t,n),r.setUint32(t+4,s)}function Fu(r,t){const e=r.getInt32(t),n=r.getUint32(t+4);return e*4294967296+n}function Nf(r,t){const e=r.getUint32(t),n=r.getUint32(t+4);return e*4294967296+n}const Ff=-1,Of=4294967296-1,kf=17179869184-1;function Df({sec:r,nsec:t}){if(r>=0&&t>=0&&r<=kf)if(t===0&&r<=Of){const e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,r),e}else{const e=r/4294967296,n=r&4294967295,s=new Uint8Array(8),i=new DataView(s.buffer);return i.setUint32(0,t<<2|e&3),i.setUint32(4,n),s}else{const e=new Uint8Array(12),n=new DataView(e.buffer);return n.setUint32(0,t),Mf(n,4,r),e}}function Uf(r){const t=r.getTime(),e=Math.floor(t/1e3),n=(t-e*1e3)*1e6,s=Math.floor(n/1e9);return{sec:e+s,nsec:n-s*1e9}}function Lf(r){if(r instanceof Date){const t=Uf(r);return Df(t)}else return null}function Cf(r){const t=new DataView(r.buffer,r.byteOffset,r.byteLength);switch(r.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{const e=t.getUint32(0),n=t.getUint32(4),s=(e&3)*4294967296+n,i=e>>>2;return{sec:s,nsec:i}}case 12:{const e=Fu(t,4),n=t.getUint32(0);return{sec:e,nsec:n}}default:throw new se(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${r.length}`)}}function Rf(r){const t=Cf(r);return new Date(t.sec*1e3+t.nsec/1e6)}const Pf={type:Ff,encode:Lf,decode:Rf};class us{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Pf)}register({type:t,encode:e,decode:n}){if(t>=0)this.encoders[t]=e,this.decoders[t]=n;else{const s=-1-t;this.builtInEncoders[s]=e,this.builtInDecoders[s]=n}}tryToEncode(t,e){for(let n=0;n<this.builtInEncoders.length;n++){const s=this.builtInEncoders[n];if(s!=null){const i=s(t,e);if(i!=null){const c=-1-n;return new En(c,i)}}}for(let n=0;n<this.encoders.length;n++){const s=this.encoders[n];if(s!=null){const i=s(t,e);if(i!=null){const c=n;return new En(c,i)}}}return t instanceof En?t:null}decode(t,e,n){const s=e<0?this.builtInDecoders[-1-e]:this.decoders[e];return s?s(t,e,n):new En(e,t)}}us.defaultCodec=new us;function $f(r){return r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer}function na(r){return r instanceof Uint8Array?r:ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):$f(r)?new Uint8Array(r):Uint8Array.from(r)}function Zi(r){return`${r<0?"-":""}0x${Math.abs(r).toString(16).padStart(2,"0")}`}const zf=16,jf=16;class Vf{constructor(t=zf,e=jf){this.hit=0,this.miss=0,this.maxKeyLength=t,this.maxLengthPerKey=e,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}find(t,e,n){const s=this.caches[n-1];t:for(const i of s){const c=i.bytes;for(let a=0;a<n;a++)if(c[a]!==t[e+a])continue t;return i.str}return null}store(t,e){const n=this.caches[t.length-1],s={bytes:t,str:e};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=s:n.push(s)}decode(t,e,n){const s=this.find(t,e,n);if(s!=null)return this.hit++,s;this.miss++;const i=Nu(t,e,n),c=Uint8Array.prototype.slice.call(t,e,e+n);return this.store(c,i),i}}const hs="array",cn="map_key",Ou="map_value",Wf=r=>{if(typeof r=="string"||typeof r=="number")return r;throw new se("The type of key must be string or number but "+typeof r)};class Zf{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(t){const e=this.getUninitializedStateFromPool();e.type=hs,e.position=0,e.size=t,e.array=new Array(t)}pushMapState(t){const e=this.getUninitializedStateFromPool();e.type=cn,e.readCount=0,e.size=t,e.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const t={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(t)}return this.stack[this.stackHeadPosition]}release(t){if(this.stack[this.stackHeadPosition]!==t)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(t.type===hs){const n=t;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(t.type===cn||t.type===Ou){const n=t;n.size=0,n.map=void 0,n.readCount=0,n.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const qr=-1,Gs=new DataView(new ArrayBuffer(0)),Gf=new Uint8Array(Gs.buffer);try{Gs.getInt8(0)}catch(r){if(!(r instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const ia=new RangeError("Insufficient data"),Yf=new Vf;class Ys{constructor(t){this.totalPos=0,this.pos=0,this.view=Gs,this.bytes=Gf,this.headByte=qr,this.stack=new Zf,this.entered=!1,this.extensionCodec=t?.extensionCodec??us.defaultCodec,this.context=t?.context,this.useBigInt64=t?.useBigInt64??!1,this.rawStrings=t?.rawStrings??!1,this.maxStrLength=t?.maxStrLength??Hr,this.maxBinLength=t?.maxBinLength??Hr,this.maxArrayLength=t?.maxArrayLength??Hr,this.maxMapLength=t?.maxMapLength??Hr,this.maxExtLength=t?.maxExtLength??Hr,this.keyDecoder=t?.keyDecoder!==void 0?t.keyDecoder:Yf,this.mapKeyConverter=t?.mapKeyConverter??Wf}clone(){return new Ys({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=qr,this.stack.reset()}setBuffer(t){const e=na(t);this.bytes=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.pos=0}appendBuffer(t){if(this.headByte===qr&&!this.hasRemaining(1))this.setBuffer(t);else{const e=this.bytes.subarray(this.pos),n=na(t),s=new Uint8Array(e.length+n.length);s.set(e),s.set(n,e.length),this.setBuffer(s)}}hasRemaining(t){return this.view.byteLength-this.pos>=t}createExtraByteError(t){const{view:e,pos:n}=this;return new RangeError(`Extra ${e.byteLength-n} of ${e.byteLength} byte(s) found at buffer[${t}]`)}decode(t){if(this.entered)return this.clone().decode(t);try{this.entered=!0,this.reinitializeState(),this.setBuffer(t);const e=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return e}finally{this.entered=!1}}*decodeMulti(t){if(this.entered){yield*this.clone().decodeMulti(t);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(t);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(t){if(this.entered)return this.clone().decodeAsync(t);try{this.entered=!0;let e=!1,n;for await(const a of t){if(e)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{n=this.doDecodeSync(),e=!0}catch(d){if(!(d instanceof RangeError))throw d}this.totalPos+=this.pos}if(e){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}const{headByte:s,pos:i,totalPos:c}=this;throw new RangeError(`Insufficient data in parsing ${Zi(s)} at ${c} (${i} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(t){return this.decodeMultiAsync(t,!0)}decodeStream(t){return this.decodeMultiAsync(t,!1)}async*decodeMultiAsync(t,e){if(this.entered){yield*this.clone().decodeMultiAsync(t,e);return}try{this.entered=!0;let n=e,s=-1;for await(const i of t){if(e&&s===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(i),n&&(s=this.readArraySize(),n=!1,this.complete());try{for(;yield this.doDecodeSync(),--s!==0;);}catch(c){if(!(c instanceof RangeError))throw c}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){t:for(;;){const t=this.readHeadByte();let e;if(t>=224)e=t-256;else if(t<192)if(t<128)e=t;else if(t<144){const s=t-128;if(s!==0){this.pushMapState(s),this.complete();continue t}else e={}}else if(t<160){const s=t-144;if(s!==0){this.pushArrayState(s),this.complete();continue t}else e=[]}else{const s=t-160;e=this.decodeString(s,0)}else if(t===192)e=null;else if(t===194)e=!1;else if(t===195)e=!0;else if(t===202)e=this.readF32();else if(t===203)e=this.readF64();else if(t===204)e=this.readU8();else if(t===205)e=this.readU16();else if(t===206)e=this.readU32();else if(t===207)this.useBigInt64?e=this.readU64AsBigInt():e=this.readU64();else if(t===208)e=this.readI8();else if(t===209)e=this.readI16();else if(t===210)e=this.readI32();else if(t===211)this.useBigInt64?e=this.readI64AsBigInt():e=this.readI64();else if(t===217){const s=this.lookU8();e=this.decodeString(s,1)}else if(t===218){const s=this.lookU16();e=this.decodeString(s,2)}else if(t===219){const s=this.lookU32();e=this.decodeString(s,4)}else if(t===220){const s=this.readU16();if(s!==0){this.pushArrayState(s),this.complete();continue t}else e=[]}else if(t===221){const s=this.readU32();if(s!==0){this.pushArrayState(s),this.complete();continue t}else e=[]}else if(t===222){const s=this.readU16();if(s!==0){this.pushMapState(s),this.complete();continue t}else e={}}else if(t===223){const s=this.readU32();if(s!==0){this.pushMapState(s),this.complete();continue t}else e={}}else if(t===196){const s=this.lookU8();e=this.decodeBinary(s,1)}else if(t===197){const s=this.lookU16();e=this.decodeBinary(s,2)}else if(t===198){const s=this.lookU32();e=this.decodeBinary(s,4)}else if(t===212)e=this.decodeExtension(1,0);else if(t===213)e=this.decodeExtension(2,0);else if(t===214)e=this.decodeExtension(4,0);else if(t===215)e=this.decodeExtension(8,0);else if(t===216)e=this.decodeExtension(16,0);else if(t===199){const s=this.lookU8();e=this.decodeExtension(s,1)}else if(t===200){const s=this.lookU16();e=this.decodeExtension(s,2)}else if(t===201){const s=this.lookU32();e=this.decodeExtension(s,4)}else throw new se(`Unrecognized type byte: ${Zi(t)}`);this.complete();const n=this.stack;for(;n.length>0;){const s=n.top();if(s.type===hs)if(s.array[s.position]=e,s.position++,s.position===s.size)e=s.array,n.release(s);else continue t;else if(s.type===cn){if(e==="__proto__")throw new se("The key __proto__ is not allowed");s.key=this.mapKeyConverter(e),s.type=Ou;continue t}else if(s.map[s.key]=e,s.readCount++,s.readCount===s.size)e=s.map,n.release(s);else{s.key=null,s.type=cn;continue t}}return e}}readHeadByte(){return this.headByte===qr&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=qr}readArraySize(){const t=this.readHeadByte();switch(t){case 220:return this.readU16();case 221:return this.readU32();default:{if(t<160)return t-144;throw new se(`Unrecognized array type byte: ${Zi(t)}`)}}}pushMapState(t){if(t>this.maxMapLength)throw new se(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(t)}pushArrayState(t){if(t>this.maxArrayLength)throw new se(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(t)}decodeString(t,e){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(t,e):this.decodeBinary(t,e)}decodeUtf8String(t,e){if(t>this.maxStrLength)throw new se(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+e+t)throw ia;const n=this.pos+e;let s;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(t)?s=this.keyDecoder.decode(this.bytes,n,t):s=Tf(this.bytes,n,t),this.pos+=e+t,s}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===cn:!1}decodeBinary(t,e){if(t>this.maxBinLength)throw new se(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+e))throw ia;const n=this.pos+e,s=this.bytes.subarray(n,n+t);return this.pos+=e+t,s}decodeExtension(t,e){if(t>this.maxExtLength)throw new se(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);const n=this.view.getInt8(this.pos+e),s=this.decodeBinary(t,e+1);return this.extensionCodec.decode(s,n,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){const t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){const t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){const t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){const t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){const t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){const t=Nf(this.view,this.pos);return this.pos+=8,t}readI64(){const t=Fu(this.view,this.pos);return this.pos+=8,t}readU64AsBigInt(){const t=this.view.getBigUint64(this.pos);return this.pos+=8,t}readI64AsBigInt(){const t=this.view.getBigInt64(this.pos);return this.pos+=8,t}readF32(){const t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){const t=this.view.getFloat64(this.pos);return this.pos+=8,t}}function Jf(r,t){return new Ys(t).decode(r)}ya.set("msgpack2",async()=>({kind:"array_to_bytes",fromConfig:(r,t)=>({kind:"array_to_bytes",async encode(e){throw new Error("msgpack2 encode not implemented")},async decode(e){const n=Jf(e),{shape:s}=t,i=new Array(s.length);let c=1;for(let a=s.length-1;a>=0;a--)i[a]=c,c*=s[a];return{data:n,shape:s,stride:i}}})}));function Hf(r){return new Promise(t=>setTimeout(t,r))}const Gi="__cache_created_at";class qf{cache;url;params;cache_prefix;fetchOptions;timeout;ttl;_pending={};_cacheValid;constructor(t,e,n={}){const s={...e};n.parameters&&(s["x-parameters"]=JSON.stringify(n.parameters)),n.chunks&&(s["x-chunks"]=n.chunks),n.downsample&&(s["x-downsample"]=JSON.stringify(n.downsample)),s["x-filtered"]="True",this.params={},e["x-datamesh-auth"]&&(this.params.auth=e["x-datamesh-auth"]),e["x-datamesh-sig"]&&(this.params.sig=e["x-datamesh-sig"]),this.fetchOptions={headers:s},this.url=t,n.nocache&&console.warn("CachedHTTPStore: 'nocache' option is deprecated, use 'ttl: 0' instead"),n.ttl===0||n.nocache||typeof window>"u"?this.cache=void 0:this.cache=Mu("zarr","cache"),this.cache_prefix=Bf({root:t,...n.parameters,chunks:n.chunks,downsample:n.downsample}),this.timeout=n.timeout||6e4,this.ttl=n.ttl}async checkCacheTTL(){if(!this.ttl||!this.cache)return!1;if(this._cacheValid!==void 0)return this._cacheValid;const t=`${this.cache_prefix}${Gi}`,e=await Vi(t,this.cache);return e?(Date.now()-e)/1e3>this.ttl?(this._cacheValid=!1,!1):(this._cacheValid=!0,!0):(this._cacheValid=!1,!1)}async setCacheTimestamp(){if(!this.cache||!this.ttl)return;const t=`${this.cache_prefix}${Gi}`;await Vi(t,this.cache)||await ea(t,Date.now(),this.cache)}async invalidateCache(){if(!this.cache)return;const t=`${this.cache_prefix}${Gi}`;await xn(t,this.cache),this._cacheValid=!1}async get(t,e,n=0){const s=`${this.cache_prefix}${t}`;let i=null;if(this.cache&&(await this.checkCacheTTL()?i=await Vi(s,this.cache):await this.invalidateCache(),i&&delete this._pending[s],this._pending[s]))if(await Hf(200),n>this.timeout){await xn(s,this.cache),delete this._pending[s],console.error("Zarr timeout");return}else return await this.get(t,e,n+200);if(!i){this._pending[s]=!0;try{const c={...this.fetchOptions,...e,headers:{...this.fetchOptions.headers||{},...e?.headers||{}},signal:AbortSignal.timeout(this.timeout)},a=new URLSearchParams(this.params).toString(),d=await fetch(`${this.url}${t}?${a}`,c);if(d.status===404){this.cache&&await xn(s,this.cache);return}if(d.status>=400)throw new Error(`HTTP error: ${d.status}`);i=new Uint8Array(await d.arrayBuffer()),this.cache&&(await ea(s,i,this.cache),await this.setCacheTimestamp())}catch(c){if(console.debug("Zarr retry:"+s),n<this.timeout/200)return delete this._pending[s],await this.get(t,e,n+200);this.cache&&await xn(s,this.cache),console.error(c);return}finally{delete this._pending[s]}}return i}}const sa=async(r,t=".zarray")=>{const{path:e}=r.resolve(t),n=await r.store.get(e);return n?JSON.parse(new TextDecoder().decode(n)):{}};async function Kf(r){const t=await sa(r,".zattrs"),e=await sa(r);e.dtype.startsWith("<M8")&&(t._dtype=e.dtype),e.fill_value!==void 0&&(t._fill_value=e.fill_value);const n=[];e.order==="F"&&n.push({name:"transpose",configuration:{order:"F"}}),typeof e.dtype=="string"&&e.dtype.startsWith(">")&&n.push({name:"bytes",configuration:{endian:"big"}});for(const{id:i,...c}of e.filters??[])n.push({name:i,configuration:c});if(e.compressor){const{id:i,...c}=e.compressor;n.push({name:i,configuration:c})}const s={zarr_format:3,node_type:"array",shape:e.shape,data_type:"int64",chunk_grid:{name:"regular",configuration:{chunk_shape:e.chunks}},chunk_key_encoding:{name:"v2",configuration:{separator:e.dimension_separator??"."}},codecs:n,fill_value:e.fill_value,attributes:t};return new vr(r.store,r.path,s)}let ku=typeof process<"u"&&!!process.env&&process.env.DATAMESH_DEBUG==="true";function oa(){return ku}function Ti(r,t,e){if(!ku)return e;const n=e.value;return e.value=function(...s){const i=s.map(a=>{if(!a||typeof a!="object")return a;try{return JSON.parse(JSON.stringify(a,(d,f)=>{if(typeof d=="string"){const y=d.toLowerCase();if(y.includes("token")||y.includes("authorization")||y.includes("jwt"))return"[redacted]"}return f}))}catch{return"[unserializable]"}}),c=Date.now();try{const a=n.apply(this,s);if(a&&typeof a.then=="function")return a.finally(()=>{const f=Date.now()-c;console.debug(`@oceanum/datamesh debug: ${t} took ${f}ms`,i)});const d=Date.now()-c;return console.debug(`@oceanum/datamesh debug: ${t} took ${d}ms`,i),a}catch(a){const d=Date.now()-c;throw console.debug(`@oceanum/datamesh debug: ${t} threw after ${d}ms`,i),a}},e}const Js={microseconds:.001,milliseconds:1,seconds:1e3,minutes:60*1e3,hours:60*60*1e3,days:24*60*60*1e3},Xf={day:"days",days:"days",d:"days",hour:"hours",hours:"hours",hr:"hours",hrs:"hours",h:"hours",minute:"minutes",minutes:"minutes",min:"minutes",mins:"minutes",second:"seconds",seconds:"seconds",sec:"seconds",secs:"seconds",s:"seconds",millisecond:"milliseconds",milliseconds:"milliseconds",msec:"milliseconds",msecs:"milliseconds",ms:"milliseconds",microsecond:"microseconds",microseconds:"microseconds",usec:"microseconds",usecs:"microseconds",us:"microseconds"},Mi=new Set(["standard","gregorian","proleptic_gregorian"]);function Ni(r){const t=/^\s*(\w+)\s+since\s+(.+?)\s*$/i,e=r.match(t);if(!e)throw new Error(`Invalid CF time units: "${r}". Expected format: "<unit> since <reference_time>"`);const[,n,s]=e,i=n.toLowerCase(),c=Xf[i];if(!c)throw new Error(`Unsupported time unit: "${n}". Supported units: days, hours, minutes, seconds, milliseconds, microseconds`);const a=Qf(s),d=a.getTime();return{unit:c,referenceDate:a,referenceMs:d,original:r}}function Qf(r){const t=r.trim().replace("T"," ").replace(/Z$/i,""),e=/^(-?\d+)-(\d{1,2})-(\d{1,2})(?:\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d+))?)?)?$/,n=t.match(e);if(!n){const C=new Date(r);if(isNaN(C.getTime()))throw new Error(`Cannot parse reference time: "${r}"`);return C}const[,s,i,c,a,d,f,y]=n,B=parseInt(s,10),L=parseInt(i,10)-1,x=parseInt(c,10),M=a?parseInt(a,10):0,U=d?parseInt(d,10):0,F=f?parseInt(f,10):0;let O=0;if(y){const C=y.padEnd(3,"0").slice(0,3);O=parseInt(C,10)}return new Date(Date.UTC(B,L,x,M,U,F,O))}function tp(r,t,e="standard"){if(!Mi.has(e))throw new Error(`Unsupported calendar: "${e}". Currently only Gregorian calendars are supported: standard, gregorian, proleptic_gregorian`);const n=Ni(t),s=Js[n.unit];if(typeof r=="number")return new Date(n.referenceMs+r*s);const i=[];for(let c=0;c<r.length;c++){const a=r[c];a==null||Number.isNaN(a)?i.push(new Date(NaN)):i.push(new Date(n.referenceMs+a*s))}return i}function ep(r,t,e="standard"){if(!Mi.has(e))throw new Error(`Unsupported calendar: "${e}". Currently only Gregorian calendars are supported: standard, gregorian, proleptic_gregorian`);const n=Ni(t),s=Js[n.unit];return r instanceof Date?(r.getTime()-n.referenceMs)/s:r.map(i=>!i||isNaN(i.getTime())?NaN:(i.getTime()-n.referenceMs)/s)}function Du(r){return Mi.has(r.toLowerCase())}function rp(){return Array.from(Mi)}function Uu(r){const t=r.units;return typeof t=="string"&&/^\s*\w+\s+since\s+.+$/i.test(t)}function Lu(r,t,e="standard"){if(!Du(e))return null;const n=Ni(t),s=Js[n.unit],i=n.referenceMs,c=new Float64Array(r.length);for(let a=0;a<r.length;a++){const d=Number(r[a]);Number.isNaN(d)?c[a]=NaN:c[a]=(i+d*s)/1e3}return c}var np=Object.defineProperty,ip=Object.getOwnPropertyDescriptor,sp=(r,t,e,n)=>{for(var s=ip(t,e),i=r.length-1,c;i>=0;i--)(c=r[i])&&(s=c(t,e,s)||s);return s&&np(t,e,s),s};const aa=(r,t,e,n,s)=>n?.variables?.[r]?n.variables[r]:s||(n?.dimensions?t.map((i,c)=>n.dimensions?.[i]??e[c]):e),Cu=r=>{const t=new Tu.Buffer(r,"base64");return bf.Geometry.parse(t).toGeoJSON()},mi=r=>r&&(Array.isArray(r)||ArrayBuffer.isView(r)),Yi=r=>{const t=[];if(!mi(r))return t;for(;t.push(r.length),mi(r[0]);)r=r[0];return t},op=r=>{for(;Array.isArray(r);)r=r[0];if(r==null)return"uint8";switch(r.constructor.name){case"Boolean":return"bool";case"Number":return"float32";case"Int8Array":return"int8";case"Int16Array":return"int16";case"Int32Array":return"int32";case"BigInt64Array":return"int64";case"Uint8Array":return"uint8";case"Uint16Array":return"uint16";case"Uint32Array":return"uint32";case"Float32Array":return"float32";case"Float64Array":return"float64";case"String":return"v2:object";case"Object":return"v2:object"}throw new Error("Unsupported data type: "+r.constructor.name)},ap=r=>{let t=r.toString().toLowerCase();return r.typeId==5?t="v2:object":r.typeId==1&&(t="uint8"),t},ca=r=>{if(!Array.isArray(r))return r;const t=r.flat(1/0);if(mi(t[0])){const e=t[0].length,n=new t[0].constructor(t.length*e);for(let s=0;s<t.length;s++)n.set(t[s],s*e);return n}else return t},ua=r=>{const t=r.length,e=Array(t);for(let n=t-1,s=1;n>=0;n--)e[n]=s,s*=r[n];return e},pn=(r,t,e,n=0)=>{if(t.length===0)return r[0];if(t.length===1){const i=new r.constructor(t[0]);return i.set(r.slice(n,n+t[0])),i}const s=new Array(t[0]);for(let i=0;i<t[0];i++)s[i]=pn(r,t.slice(1),e.slice(1),n+i*e[0]);return s},cp=(r,t)=>{const[e,n]=t.split("<M8"),s=new Float64Array(r.data.length);let i=1n;switch(n){case"[ms]":i=1000n;break;case"[us]":i=1000000n;break;case"[ns]":i=1000000000n;break;default:i=1n;break}for(let c=0;c<r.data.length;c++){const a=r.data[c];s[c]=Number(a/i)}return pn(s,r.shape,r.stride)},up=(r,t,e="standard")=>{const n=Lu(r.data,t,e);return n===null?(console.warn(`Unsupported calendar "${e}" for cftime conversion. Returning raw values. Supported: standard, gregorian, proleptic_gregorian`),pn(r.data,r.shape,r.stride)):pn(n,r.shape,r.stride)},hp=r=>{if(r==null)return!0;if(typeof r=="string"){const t=r.toLowerCase();return t==="nan"||t==="-nan"||t==="+nan"}return typeof r=="number"?Number.isNaN(r):!1},lp=(r,t,e)=>{if(!e.startsWith("float")||hp(t))return r;if(typeof t=="number"&&!Number.isNaN(t)){const n=e==="float64"?new Float64Array(r.length):new Float32Array(r.length);for(let s=0;s<r.length;s++){const i=r[s];n[s]=Math.abs(i-t)<Math.abs(t*1e-6)?NaN:i}return n}return r},Ru=(r,t,e)=>{const n=Object.keys(t),s={};for(const i in r)mi(r[i].data)&&(s[i]=!0);if(n.length==1)for(let i=0;i<t[n[0]];i++){const c={};for(const a in r)s[a]?r[a].data.length>1&&(c[a]=r[a].data[i]):c[a]=r[a].data;e.push(c)}else for(let i=0;i<t[n[0]];i++){const c={};for(const d in r)r[d].dimensions.includes(n[0])?c[d]={attributes:r[d].attributes,data:r[d].data[i],dimensions:r[d].dimensions.slice(1)}:c[d]=r[d];const a={...t};delete a[n[0]],Ru(c,a,e)}return e};class wi{id;dimensions;attributes;arr;constructor(t,e,n,s){this.id=t,this.dimensions=e,this.attributes=n,this.arr=s}async get(t){if(this.arr.shape.length==0||this.arr.shape[0]==0)return[];const e=t&&t.map(s=>{if(typeof s=="string"){const[i,c,a]=s.split(":");return Hi(parseInt(i),parseInt(c),parseInt(a))}else return s}),n=await Uh(this.arr,e);if(this.arr.dtype=="v2:object"||!n.shape)return n.data;if(this.arr.dtype=="bool")return[...n.data];{const s=this.arr.attrs,i=this.arr.dtype,c=s._dtype;if(c?.startsWith("<M8"))return cp(n,c);if(Uu(s)){const f=s.units,y=s.calendar||"standard";return up(n,f,y)}const a=this.attributes._fill_value,d=a?lp(n.data,a,i):n.data;return pn(d,n.shape,n.stride)}}}sp([Ti],wi.prototype,"get");class Ye{dimensions;variables;attributes;coordkeys;root;constructor(t,e,n,s,i){this.dimensions=t,this.variables=e,this.attributes=n,this.coordkeys=s,this.root=i}static async zarr(t,e,n={}){const s=new qf(t,e,{chunks:n.chunks,downsample:n.downsample,parameters:n.parameters,timeout:n.timeout,nocache:n.nocache,ttl:n.ttl}),i=await mh(s),c=await Ge(i,{kind:"group"}),a={},d={};for(const y of i.contents())if(y.kind=="array"){let B;try{B=await Ge(c.resolve(y.path),{kind:"array"})}catch(U){const F=typeof U=="object"&&U&&"message"in U?String(U.message):void 0;if(F&&F.includes("<M8"))B=await Kf(c.resolve(y.path));else throw U}const L={...B.attrs};if(L._fill_value===void 0){const U=`${y.path}/.zarray`.replace(/^\//,""),F=await i.get(`/${U}`);if(F){const O=JSON.parse(new TextDecoder().decode(F));O.fill_value!==void 0&&(L._fill_value=O.fill_value)}}const x=L._ARRAY_DIMENSIONS,M=y.path.split("/").pop();a[M]=new wi(M,x||[],L,B),x&&x.map((U,F)=>{const O=B.shape[F];if(d[U]&&d[U]!=O)throw new Error(`Inconsistent dimension size for ${U}: ${d[U]} != ${O}`);d[U]=O})}const f=JSON.parse(c.attrs._coordinates||"{}")||{};return new Ye(d,a,c.attrs,n.coordkeys||f,c)}static async fromArrow(t,e){const n={},s={record:t.numRows},i={};return t.schema.fields.forEach(c=>{const a=t.getChild(c.name);let d={},f=a?.toArray(),y=ap(c.type);if(tt.isTimestamp(c.type)){const B=new Float64Array(f.length),L=BigInt(1e3**(c.type.unit-0));for(let x=0;x<f.length;x++)B[x]=Number(f[x]/L);f=B,y="float64",d={unit:"Unix timestamp (s)"}}else if(tt.isBinary(c.type)){const B=[];for(let L=0;L<f.length;L++)B.push(new Tu.Buffer(f[L]).toString("base64"));f=B,y="v2:object"}i[c.name]={dimensions:["record"],attributes:d,data:f,dtype:y}}),await Ye.init({dimensions:s,variables:i,attributes:n},e)}static async fromGeojson(t,e){if(!("features"in t&&Array.isArray(t.features))&&!("geometry"in t))throw new Error("Invalid GeoJSON");const n="features"in t&&t.features?t.features:[t];if(n.length===0)throw new Error("FeatureCollection contains no features");const s=new Set;n.forEach(d=>{d.properties&&Object.keys(d.properties).forEach(f=>s.add(f))});const i=n.map(d=>{const f={geometry:d.geometry};return d.properties&&Object.assign(f,d.properties),f}),c={dimensions:{index:i.length},variables:{},attributes:{}},a=await Ye.init(c,{...e,g:"geometry"});await a.assign("geometry",["index"],i.map(d=>d.geometry),{description:"GeoJSON geometry"});for(const d of s){const f=i.map(y=>y[d]);await a.assign(d,["index"],f,{description:`Property: ${d}`})}return a}static async init(t,e,n){const s=await _n(new Map,{attributes:{created:new Date}}),i=new Ye(t.dimensions,{},t.attributes||{},e||{},s);for(const c in t.variables){const{dimensions:a,attributes:d,data:f,dtype:y,chunks:B}=t.variables[c],L=Yi(f),x=aa(c,a,L,n,B);await i.assign(c,a,f,d,y&&y==="string"?"v2:object":y,x)}return i}async asDataframe(){const t={},e=[];for(const s in this.variables)t[s]={attributes:this.variables[s].attributes,dimensions:this.variables[s].dimensions},t[s].data=await this.variables[s].get(),this.variables[s].arr.dtype=="int64"&&s!=this.coordkeys.t&&e.push(s);const n=Ru(t,{...this.dimensions},[]);if(this.coordkeys.t)for(let s=0;s<n.length;s++)n[s][this.coordkeys.t]=new Date(1e3*n[s][this.coordkeys.t]).toISOString();if(e.length>0)for(const s of e)for(let i=0;i<n.length;i++)n[i][s]=Number(n[i][s]);return n}async asGeojson(t){if(!this.coordkeys.g&&!t)throw new Error("No geometry found");const e=[],n=await this.asDataframe();for(let s=0;s<n.length;s++){const{...i}=n[s];let c=t;if(!c&&this.coordkeys.g){delete i[this.coordkeys.g];const a=n[s][this.coordkeys.g];a.slice(0,7)=='{"type:'?c=JSON.parse(a):c=Cu(a)}e.push({type:"Feature",geometry:c,properties:i})}return{type:"FeatureCollection",features:e}}async assign(t,e,n,s,i,c){const a=Yi(n);if(a.length!=e.length)throw new Error("Data shape does not match dimensions");e.map((B,L)=>{if(this.dimensions[B]){if(this.dimensions[B]!=a[L])throw new Error(`Existing size of dimension ${B} does not match new data`)}else this.dimensions[B]=a[L]});const d=i||op(n),f=await _n(this.root.resolve(t),{shape:a,data_type:d,chunk_shape:c||a,codecs:d=="v2:object"?[{name:"json2"}]:[]});let y=ca(n);y.length==0?y=null:d=="bool"?y=new $n(y):Array.isArray(y)&&d=="float32"?y=Float32Array.from(y,B=>B??NaN):Array.isArray(y)&&d=="float64"?y=Float64Array.from(y,B=>B??NaN):Array.isArray(y)&&d=="int8"?y=Int8Array.from(y):Array.isArray(y)&&d=="int16"?y=Int16Array.from(y):Array.isArray(y)&&d=="int32"?y=Int32Array.from(y):Array.isArray(y)&&d=="int64"?y=BigInt64Array.from(y.map(B=>BigInt(B))):Array.isArray(y)&&d=="uint8"?y=Uint8Array.from(y):Array.isArray(y)&&d=="uint16"?y=Uint16Array.from(y):Array.isArray(y)&&d=="uint32"?y=Uint32Array.from(y):Array.isArray(y)&&d=="uint64"&&(y=BigUint64Array.from(y.map(B=>BigInt(B)))),y&&await oo(f,a.map(()=>null),{data:y,shape:a,stride:ua(a)}),this.variables[t]=new wi(t,e,s||{},f)}async toZarr(t){const e=t?.chunks,n=new Map,s=await _n(n,{attributes:{...this.attributes,_coordinates:JSON.stringify(this.coordkeys)}});for(const i in this.variables){const c=this.variables[i],a=await c.get(),d=Yi(a),f=c.dimensions,y=aa(i,f,d,e,e?void 0:c.arr.chunks),B=c.arr.dtype,L=await _n(s.resolve(i),{shape:d,data_type:B,chunk_shape:y,codecs:B==="v2:object"?[{name:"json2"}]:void 0,attributes:{...c.attributes,_ARRAY_DIMENSIONS:f}});let x=ca(a);x&&x.length>0&&(B==="bool"?x=new $n(x):Array.isArray(x)&&B==="float32"?x=Float32Array.from(x,M=>M??NaN):Array.isArray(x)&&B==="float64"?x=Float64Array.from(x,M=>M??NaN):Array.isArray(x)&&B==="int8"?x=Int8Array.from(x):Array.isArray(x)&&B==="int16"?x=Int16Array.from(x):Array.isArray(x)&&B==="int32"?x=Int32Array.from(x):Array.isArray(x)&&B==="int64"?x=BigInt64Array.from(x.map(M=>BigInt(M))):Array.isArray(x)&&B==="uint8"?x=Uint8Array.from(x):Array.isArray(x)&&B==="uint16"?x=Uint16Array.from(x):Array.isArray(x)&&B==="uint32"?x=Uint32Array.from(x):Array.isArray(x)&&B==="uint64"&&(x=BigUint64Array.from(x.map(M=>BigInt(M)))),await oo(L,d.map(()=>null),{data:x,shape:d,stride:ua(d)}))}return n}}var dp=Object.defineProperty,fp=Object.getOwnPropertyDescriptor,pp=(r,t,e,n)=>{for(var s=fp(t,e),i=r.length-1,c;i>=0;i--)(c=r[i])&&(s=c(t,e,s)||s);return s&&dp(t,e,s),s};const Pu=class ls{id;user;creationTime;endTime;write;verified=!1;_connection;_closePromise=null;_closed=!1;_beforeExitHandler=null;static async acquire(t,e={}){if(!t._isV1){const n=new ls;return n.id="dummy_session",n.user="dummy_user",n.creationTime=new Date,n.endTime=new Date(Date.now()+(e.duration||3600)*1e3),n.write=!1,n.verified=!1,n._connection=t,typeof process<"u"&&process.on&&(n._beforeExitHandler=()=>{n.close()},process.once("beforeExit",n._beforeExitHandler)),n}try{const n={...t._authHeaders};n["Cache-Control"]="no-store";const s=new URLSearchParams({duration:String(e.duration??3600)}),i=await fetch(`${t._gateway}/session/?${s.toString()}`,{headers:n});if(i.status!==200)throw new Error(`Failed to create session: ${await i.text()}`);const c=await i.json(),a=new ls;return a.id=c.id,a.user=c.user,a.creationTime=new Date(c.creation_time),a.endTime=new Date(c.end_time),a.write=c.write,a.verified=c.verified||!1,a._connection=t,typeof process<"u"&&process.on&&(a._beforeExitHandler=()=>{a.close()},process.once("beforeExit",a._beforeExitHandler)),a}catch(n){throw new Error(`Error when acquiring datamesh session: ${n}`)}}get header(){return{"X-DATAMESH-SESSIONID":this.id}}addHeader(t){return{...t,...this.header}}async close(t=!1){if(this._connection._isV1&&!this._closed)return this._closePromise?this._closePromise:(this._closePromise=(async()=>{try{this._beforeExitHandler&&typeof process<"u"&&process.off&&(process.off("beforeExit",this._beforeExitHandler),this._beforeExitHandler=null);const e=await fetch(`${this._connection._gateway}/session/${this.id}`,{method:"DELETE",headers:this.header,body:JSON.stringify({finalise_write:t})});if(e.status===204){this._closed=!0;return}const n=await e.text();if(e.status===404&&n.includes("Session not found")){this._closed=!0;return}if(t)throw new Error(`Failed to finalise write: ${n}`);console.warn(`Failed to close session: ${n}`)}catch(e){if(t)throw new Error(`Error when closing datamesh session: ${e}`);console.warn(`Error when closing datamesh session: ${e}`)}finally{this._closePromise=null}})(),this._closePromise)}async enter(){return this}async exit(t){await this.close(t===void 0)}};pp([Ti],Pu,"acquire");let yp=Pu;var gp=Object.defineProperty,mp=Object.getOwnPropertyDescriptor,$u=(r,t,e,n)=>{for(var s=mp(t,e),i=r.length-1,c;i>=0;i--)(c=r[i])&&(s=c(t,e,s)||s);return s&&gp(t,e,s),s};const wp=typeof process<"u"&&process.env?.DATAMESH_SERVICE?process.env.DATAMESH_SERVICE:"https://datamesh.oceanum.io",Hs=class zu{static LAZY_LOAD_SIZE=1e8;_token;_host;_authHeaders;_gateway;_nocache=!1;_isV1=!0;_sessionParams={};_currentSession=null;service;gateway;constructor(t=typeof process<"u"&&process.env?.DATAMESH_TOKEN?process.env.DATAMESH_TOKEN:"$DATAMESH_TOKEN",e){if(!t&&!e?.jwtAuth)throw new Error("A valid datamesh token must be supplied as a connector constructor argument or defined in environment variables as DATAMESH_TOKEN");this._token=t,this._nocache=e?.nocache??!1;const n=new URL(e?.service||wp);this._host=`${n.protocol}//${n.hostname}`,this._authHeaders=e?.jwtAuth?{Authorization:`Bearer ${e.jwtAuth}`}:{Authorization:`Token ${this._token}`,"X-DATAMESH-TOKEN":this._token},this._gateway=e?.gateway||this._host,this._host.split(".").slice(-1)[0]!==this._gateway.split(".").slice(-1)[0]&&console.warn("Datamesh gateway and service domains do not match"),e?.sessionDuration&&typeof e.sessionDuration=="number"&&(this._sessionParams={duration:e.sessionDuration}),this._checkApiVersion()}async _checkApiVersion(){try{(await fetch(`${this._gateway}/session`,{headers:this._authHeaders})).status===200?(this._isV1=!0,console.info("Using datamesh API version 1")):(this._isV1=!1,console.info("Using datamesh API version 0"))}catch{this._isV1=!1,console.info("Using datamesh API version 0")}}get host(){return this._host}async status(){return(await fetch(this._host,{headers:this._authHeaders})).status===200}async validateResponse(t){if(t.status>=400){let e;try{e=(await t.json()).detail}catch{e=`Datamesh server error: ${await t.text()}`}throw new Error(e)}}async createSession(t={}){const e={duration:t.duration||this._sessionParams.duration||3600};return this._currentSession=await yp.acquire(this,e),this._currentSession}async getSession(){return this._currentSession?this._currentSession:this.createSession()}async getSessionHeaders(t={}){return this._isV1&&!this._currentSession&&await this.createSession(),this._currentSession?this._currentSession.addHeader({...this._authHeaders,...t}):{...this._authHeaders,...t}}async metadataRequest(t="",e={}){const n=new URL(`${this._host}/datasource/${t}`);Object.keys(e).forEach(c=>n.searchParams.append(c,e[c]));const s=await this.getSessionHeaders(),i=await fetch(n.toString(),{headers:s});if(i.status===403)throw new Error(`Datasource ${t} not authorized`);return await this.validateResponse(i),i}async dataRequest(t,e="application/vnd.apache.arrow.file"){const n=await this.getSessionHeaders({Accept:e}),s=await fetch(`${this._gateway}/oceanql/${t}?f=arrow`,{headers:n});return await this.validateResponse(s),Bu(await s.arrayBuffer())}async stageRequest(t){oa()&&console.debug("@oceanum/datamesh debug: stageRequest query",t);const e=JSON.stringify(t),n=await this.getSessionHeaders({"Content-Type":"application/json"}),s=await fetch(`${this._gateway}/oceanql/stage/`,{method:"POST",headers:n,body:e});if(s.status>=400){const i=await s.json();throw new Error(i.detail)}else return s.status===204?null:s.json()}async query(t,e={}){oa()&&console.debug("@oceanum/datamesh debug: query called",t);const n=await this.stageRequest(t);if(!n)return console.warn("No data found for query"),null;if(n.size<zu.LAZY_LOAD_SIZE&&n.container!="dataset"){const d=await this.dataRequest(n.qhash);return await Ye.fromArrow(d,n.coordkeys)}const s=`${this._gateway}/zarr/${this._isV1?"query/":""}${n.qhash}`,i=t.parameters,c=await this.getSessionHeaders(),a=await Ye.zarr(s,c,{parameters:i,timeout:e.timeout||6e4,nocache:this._nocache});if(t.variables)for(const d of Object.keys(a.variables))!t.variables.includes(d)&&!Object.values(a.coordkeys).includes(d)&&delete a.variables[d];return a}async getDatasource(t){const n=await(await this.metadataRequest(t)).json();return{id:t,geom:n.geometry,...n.properties}}async loadDatasource(t,e={}){const n={datasource:t,parameters:e};return await this.query(n)}async closeSession(t=!1){this._currentSession&&(await this._currentSession.close(t),this._currentSession=null)}};$u([Ti],Hs.prototype,"stageRequest");$u([Ti],Hs.prototype,"query");let bp=Hs;var Rn={exports:{}},_p=Rn.exports,ha;function Sp(){return ha||(ha=1,function(r,t){(function(e,n){r.exports=n()})(_p,function(){var e=1e3,n=6e4,s=36e5,i="millisecond",c="second",a="minute",d="hour",f="day",y="week",B="month",L="quarter",x="year",M="date",U="Invalid Date",F=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,O=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,C={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(z){var R=["th","st","nd","rd"],D=z%100;return"["+z+(R[(D-20)%10]||R[D]||R[0])+"]"}},P=function(z,R,D){var Y=String(z);return!Y||Y.length>=R?z:""+Array(R+1-Y.length).join(D)+z},V={s:P,z:function(z){var R=-z.utcOffset(),D=Math.abs(R),Y=Math.floor(D/60),Z=D%60;return(R<=0?"+":"-")+P(Y,2,"0")+":"+P(Z,2,"0")},m:function z(R,D){if(R.date()<D.date())return-z(D,R);var Y=12*(D.year()-R.year())+(D.month()-R.month()),Z=R.clone().add(Y,B),X=D-Z<0,K=R.clone().add(Y+(X?-1:1),B);return+(-(Y+(D-Z)/(X?Z-K:K-Z))||0)},a:function(z){return z<0?Math.ceil(z)||0:Math.floor(z)},p:function(z){return{M:B,y:x,w:y,d:f,D:M,h:d,m:a,s:c,ms:i,Q:L}[z]||String(z||"").toLowerCase().replace(/s$/,"")},u:function(z){return z===void 0}},G="en",A={};A[G]=C;var N="$isDayjsObject",m=function(z){return z instanceof k||!(!z||!z[N])},S=function z(R,D,Y){var Z;if(!R)return G;if(typeof R=="string"){var X=R.toLowerCase();A[X]&&(Z=X),D&&(A[X]=D,Z=X);var K=R.split("-");if(!Z&&K.length>1)return z(K[0])}else{var q=R.name;A[q]=R,Z=q}return!Y&&Z&&(G=Z),Z||!Y&&G},w=function(z,R){if(m(z))return z.clone();var D=typeof R=="object"?R:{};return D.date=z,D.args=arguments,new k(D)},v=V;v.l=S,v.i=m,v.w=function(z,R){return w(z,{locale:R.$L,utc:R.$u,x:R.$x,$offset:R.$offset})};var k=function(){function z(D){this.$L=S(D.locale,null,!0),this.parse(D),this.$x=this.$x||D.x||{},this[N]=!0}var R=z.prototype;return R.parse=function(D){this.$d=function(Y){var Z=Y.date,X=Y.utc;if(Z===null)return new Date(NaN);if(v.u(Z))return new Date;if(Z instanceof Date)return new Date(Z);if(typeof Z=="string"&&!/Z$/i.test(Z)){var K=Z.match(F);if(K){var q=K[2]-1||0,rt=(K[7]||"0").substring(0,3);return X?new Date(Date.UTC(K[1],q,K[3]||1,K[4]||0,K[5]||0,K[6]||0,rt)):new Date(K[1],q,K[3]||1,K[4]||0,K[5]||0,K[6]||0,rt)}}return new Date(Z)}(D),this.init()},R.init=function(){var D=this.$d;this.$y=D.getFullYear(),this.$M=D.getMonth(),this.$D=D.getDate(),this.$W=D.getDay(),this.$H=D.getHours(),this.$m=D.getMinutes(),this.$s=D.getSeconds(),this.$ms=D.getMilliseconds()},R.$utils=function(){return v},R.isValid=function(){return this.$d.toString()!==U},R.isSame=function(D,Y){var Z=w(D);return this.startOf(Y)<=Z&&Z<=this.endOf(Y)},R.isAfter=function(D,Y){return w(D)<this.startOf(Y)},R.isBefore=function(D,Y){return this.endOf(Y)<w(D)},R.$g=function(D,Y,Z){return v.u(D)?this[Y]:this.set(Z,D)},R.unix=function(){return Math.floor(this.valueOf()/1e3)},R.valueOf=function(){return this.$d.getTime()},R.startOf=function(D,Y){var Z=this,X=!!v.u(Y)||Y,K=v.p(D),q=function(g,_){var T=v.w(Z.$u?Date.UTC(Z.$y,_,g):new Date(Z.$y,_,g),Z);return X?T:T.endOf(f)},rt=function(g,_){return v.w(Z.toDate()[g].apply(Z.toDate("s"),(X?[0,0,0,0]:[23,59,59,999]).slice(_)),Z)},At=this.$W,Ut=this.$M,Pt=this.$D,Zt="set"+(this.$u?"UTC":"");switch(K){case x:return X?q(1,0):q(31,11);case B:return X?q(1,Ut):q(0,Ut+1);case y:var Gt=this.$locale().weekStart||0,W=(At<Gt?At+7:At)-Gt;return q(X?Pt-W:Pt+(6-W),Ut);case f:case M:return rt(Zt+"Hours",0);case d:return rt(Zt+"Minutes",1);case a:return rt(Zt+"Seconds",2);case c:return rt(Zt+"Milliseconds",3);default:return this.clone()}},R.endOf=function(D){return this.startOf(D,!1)},R.$set=function(D,Y){var Z,X=v.p(D),K="set"+(this.$u?"UTC":""),q=(Z={},Z[f]=K+"Date",Z[M]=K+"Date",Z[B]=K+"Month",Z[x]=K+"FullYear",Z[d]=K+"Hours",Z[a]=K+"Minutes",Z[c]=K+"Seconds",Z[i]=K+"Milliseconds",Z)[X],rt=X===f?this.$D+(Y-this.$W):Y;if(X===B||X===x){var At=this.clone().set(M,1);At.$d[q](rt),At.init(),this.$d=At.set(M,Math.min(this.$D,At.daysInMonth())).$d}else q&&this.$d[q](rt);return this.init(),this},R.set=function(D,Y){return this.clone().$set(D,Y)},R.get=function(D){return this[v.p(D)]()},R.add=function(D,Y){var Z,X=this;D=Number(D);var K=v.p(Y),q=function(Ut){var Pt=w(X);return v.w(Pt.date(Pt.date()+Math.round(Ut*D)),X)};if(K===B)return this.set(B,this.$M+D);if(K===x)return this.set(x,this.$y+D);if(K===f)return q(1);if(K===y)return q(7);var rt=(Z={},Z[a]=n,Z[d]=s,Z[c]=e,Z)[K]||1,At=this.$d.getTime()+D*rt;return v.w(At,this)},R.subtract=function(D,Y){return this.add(-1*D,Y)},R.format=function(D){var Y=this,Z=this.$locale();if(!this.isValid())return Z.invalidDate||U;var X=D||"YYYY-MM-DDTHH:mm:ssZ",K=v.z(this),q=this.$H,rt=this.$m,At=this.$M,Ut=Z.weekdays,Pt=Z.months,Zt=Z.meridiem,Gt=function(_,T,j,$){return _&&(_[T]||_(Y,X))||j[T].slice(0,$)},W=function(_){return v.s(q%12||12,_,"0")},g=Zt||function(_,T,j){var $=_<12?"AM":"PM";return j?$.toLowerCase():$};return X.replace(O,function(_,T){return T||function(j){switch(j){case"YY":return String(Y.$y).slice(-2);case"YYYY":return v.s(Y.$y,4,"0");case"M":return At+1;case"MM":return v.s(At+1,2,"0");case"MMM":return Gt(Z.monthsShort,At,Pt,3);case"MMMM":return Gt(Pt,At);case"D":return Y.$D;case"DD":return v.s(Y.$D,2,"0");case"d":return String(Y.$W);case"dd":return Gt(Z.weekdaysMin,Y.$W,Ut,2);case"ddd":return Gt(Z.weekdaysShort,Y.$W,Ut,3);case"dddd":return Ut[Y.$W];case"H":return String(q);case"HH":return v.s(q,2,"0");case"h":return W(1);case"hh":return W(2);case"a":return g(q,rt,!0);case"A":return g(q,rt,!1);case"m":return String(rt);case"mm":return v.s(rt,2,"0");case"s":return String(Y.$s);case"ss":return v.s(Y.$s,2,"0");case"SSS":return v.s(Y.$ms,3,"0");case"Z":return K}return null}(_)||K.replace(":","")})},R.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},R.diff=function(D,Y,Z){var X,K=this,q=v.p(Y),rt=w(D),At=(rt.utcOffset()-this.utcOffset())*n,Ut=this-rt,Pt=function(){return v.m(K,rt)};switch(q){case x:X=Pt()/12;break;case B:X=Pt();break;case L:X=Pt()/3;break;case y:X=(Ut-At)/6048e5;break;case f:X=(Ut-At)/864e5;break;case d:X=Ut/s;break;case a:X=Ut/n;break;case c:X=Ut/e;break;default:X=Ut}return Z?X:v.a(X)},R.daysInMonth=function(){return this.endOf(B).$D},R.$locale=function(){return A[this.$L]},R.locale=function(D,Y){if(!D)return this.$L;var Z=this.clone(),X=S(D,Y,!0);return X&&(Z.$L=X),Z},R.clone=function(){return v.w(this.$d,this)},R.toDate=function(){return new Date(this.valueOf())},R.toJSON=function(){return this.isValid()?this.toISOString():null},R.toISOString=function(){return this.$d.toISOString()},R.toString=function(){return this.$d.toUTCString()},z}(),Q=k.prototype;return w.prototype=Q,[["$ms",i],["$s",c],["$m",a],["$H",d],["$W",f],["$M",B],["$y",x],["$D",M]].forEach(function(z){Q[z[1]]=function(R){return this.$g(R,z[0],z[1])}}),w.extend=function(z,R){return z.$i||(z(R,k,w),z.$i=!0),w},w.locale=S,w.isDayjs=m,w.unix=function(z){return w(1e3*z)},w.en=A[G],w.Ls=A,w.p={},w})}(Rn)),Rn.exports}var Ip=Sp();const mr=Vs(Ip);var Pn={exports:{}},Bp=Pn.exports,la;function vp(){return la||(la=1,function(r,t){(function(e,n){r.exports=n()})(Bp,function(){var e,n,s=1e3,i=6e4,c=36e5,a=864e5,d=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,f=31536e6,y=2628e6,B=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,L={years:f,months:y,days:a,hours:c,minutes:i,seconds:s,milliseconds:1,weeks:6048e5},x=function(A){return A instanceof V},M=function(A,N,m){return new V(A,m,N.$l)},U=function(A){return n.p(A)+"s"},F=function(A){return A<0},O=function(A){return F(A)?Math.ceil(A):Math.floor(A)},C=function(A){return Math.abs(A)},P=function(A,N){return A?F(A)?{negative:!0,format:""+C(A)+N}:{negative:!1,format:""+A+N}:{negative:!1,format:""}},V=function(){function A(m,S,w){var v=this;if(this.$d={},this.$l=w,m===void 0&&(this.$ms=0,this.parseFromMilliseconds()),S)return M(m*L[U(S)],this);if(typeof m=="number")return this.$ms=m,this.parseFromMilliseconds(),this;if(typeof m=="object")return Object.keys(m).forEach(function(z){v.$d[U(z)]=m[z]}),this.calMilliseconds(),this;if(typeof m=="string"){var k=m.match(B);if(k){var Q=k.slice(2).map(function(z){return z!=null?Number(z):0});return this.$d.years=Q[0],this.$d.months=Q[1],this.$d.weeks=Q[2],this.$d.days=Q[3],this.$d.hours=Q[4],this.$d.minutes=Q[5],this.$d.seconds=Q[6],this.calMilliseconds(),this}}return this}var N=A.prototype;return N.calMilliseconds=function(){var m=this;this.$ms=Object.keys(this.$d).reduce(function(S,w){return S+(m.$d[w]||0)*L[w]},0)},N.parseFromMilliseconds=function(){var m=this.$ms;this.$d.years=O(m/f),m%=f,this.$d.months=O(m/y),m%=y,this.$d.days=O(m/a),m%=a,this.$d.hours=O(m/c),m%=c,this.$d.minutes=O(m/i),m%=i,this.$d.seconds=O(m/s),m%=s,this.$d.milliseconds=m},N.toISOString=function(){var m=P(this.$d.years,"Y"),S=P(this.$d.months,"M"),w=+this.$d.days||0;this.$d.weeks&&(w+=7*this.$d.weeks);var v=P(w,"D"),k=P(this.$d.hours,"H"),Q=P(this.$d.minutes,"M"),z=this.$d.seconds||0;this.$d.milliseconds&&(z+=this.$d.milliseconds/1e3,z=Math.round(1e3*z)/1e3);var R=P(z,"S"),D=m.negative||S.negative||v.negative||k.negative||Q.negative||R.negative,Y=k.format||Q.format||R.format?"T":"",Z=(D?"-":"")+"P"+m.format+S.format+v.format+Y+k.format+Q.format+R.format;return Z==="P"||Z==="-P"?"P0D":Z},N.toJSON=function(){return this.toISOString()},N.format=function(m){var S=m||"YYYY-MM-DDTHH:mm:ss",w={Y:this.$d.years,YY:n.s(this.$d.years,2,"0"),YYYY:n.s(this.$d.years,4,"0"),M:this.$d.months,MM:n.s(this.$d.months,2,"0"),D:this.$d.days,DD:n.s(this.$d.days,2,"0"),H:this.$d.hours,HH:n.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:n.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:n.s(this.$d.seconds,2,"0"),SSS:n.s(this.$d.milliseconds,3,"0")};return S.replace(d,function(v,k){return k||String(w[v])})},N.as=function(m){return this.$ms/L[U(m)]},N.get=function(m){var S=this.$ms,w=U(m);return w==="milliseconds"?S%=1e3:S=w==="weeks"?O(S/L[w]):this.$d[w],S||0},N.add=function(m,S,w){var v;return v=S?m*L[U(S)]:x(m)?m.$ms:M(m,this).$ms,M(this.$ms+v*(w?-1:1),this)},N.subtract=function(m,S){return this.add(m,S,!0)},N.locale=function(m){var S=this.clone();return S.$l=m,S},N.clone=function(){return M(this.$ms,this)},N.humanize=function(m){return e().add(this.$ms,"ms").locale(this.$l).fromNow(!m)},N.valueOf=function(){return this.asMilliseconds()},N.milliseconds=function(){return this.get("milliseconds")},N.asMilliseconds=function(){return this.as("milliseconds")},N.seconds=function(){return this.get("seconds")},N.asSeconds=function(){return this.as("seconds")},N.minutes=function(){return this.get("minutes")},N.asMinutes=function(){return this.as("minutes")},N.hours=function(){return this.get("hours")},N.asHours=function(){return this.as("hours")},N.days=function(){return this.get("days")},N.asDays=function(){return this.as("days")},N.weeks=function(){return this.get("weeks")},N.asWeeks=function(){return this.as("weeks")},N.months=function(){return this.get("months")},N.asMonths=function(){return this.as("months")},N.years=function(){return this.get("years")},N.asYears=function(){return this.as("years")},A}(),G=function(A,N,m){return A.add(N.years()*m,"y").add(N.months()*m,"M").add(N.days()*m,"d").add(N.hours()*m,"h").add(N.minutes()*m,"m").add(N.seconds()*m,"s").add(N.milliseconds()*m,"ms")};return function(A,N,m){e=m,n=m().$utils(),m.duration=function(v,k){var Q=m.locale();return M(v,{$l:Q},k)},m.isDuration=x;var S=N.prototype.add,w=N.prototype.subtract;N.prototype.add=function(v,k){return x(v)?G(this,v,1):S.bind(this)(v,k)},N.prototype.subtract=function(v,k){return x(v)?G(this,v,-1):w.bind(this)(v,k)}}})}(Pn)),Pn.exports}var xp=vp();const Ap=Vs(xp);mr.extend(Ap);const Ep=r=>{if(r instanceof Date)return mr(r).toISOString();if(r instanceof mr)return r.toISOString();if(r instanceof mr.duration)return r.toISOString();try{return mr.duration(r).toISOString()}catch{return mr(r).toISOString()}},Tp=r=>{const t=r.times.map(e=>Ep(e));return{type:r.type||"range",times:t,resolution:r.resolution,resample:r.resample}};class Mp{datasource;parameters;description;variables;timefilter;geofilter;levelfilter;coordfilter;crs;aggregate;limit;id;constructor(t){this.datasource=t.datasource,this.parameters=t.parameters,this.description=t.description,this.variables=t.variables,this.timefilter=t.timefilter&&Tp(t.timefilter),this.geofilter=t.geofilter,this.levelfilter=t.levelfilter,this.coordfilter=t.coordfilter,this.crs=t.crs,this.aggregate=t.aggregate,this.limit=t.limit,this.id=t.id}toJSON(){return{datasource:this.datasource,parameters:this.parameters,description:this.description,variables:this.variables,timefilter:this.timefilter,geofilter:this.geofilter,levelfilter:this.levelfilter,coordfilter:this.coordfilter,crs:this.crs,aggregate:this.aggregate,limit:this.limit,id:this.id}}}exports.Connector=bp;exports.DataVar=wi;exports.Dataset=Ye;exports.Query=Mp;exports.cftimeToUnixSeconds=Lu;exports.date2num=ep;exports.getSupportedCalendars=rp;exports.hasCFTimeUnits=Uu;exports.isCalendarSupported=Du;exports.num2date=tp;exports.parseCFUnits=Ni;exports.wkb_to_geojson=Cu;
|