@oceanum/datamesh 0.5.1 → 0.5.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 +2 -12
- package/dist/index.js +1 -14
- package/package.json +1 -1
- package/src/lib/connector.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class Mr extends Error{constructor(t,e={}){super(`Node not found: ${t}`,e),this.name="NodeNotFoundError"}}class hi extends Error{constructor(t){super(`Missing key: ${t}`),this.name="KeyError"}}class qi{#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,o=>o?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 Ki{_data;chars;#t;constructor(t,e,n,o){if(this.chars=t,this.#t=new TextEncoder,typeof e=="number")this._data=new Uint8Array(e*t);else if(e instanceof ArrayBuffer)o&&(o=o*t),this._data=new Uint8Array(e,n,o);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 hn{#t;chars;constructor(t,e,n,o){if(this.chars=t,typeof e=="number")this.#t=new Int32Array(e*t);else if(e instanceof ArrayBuffer)o&&(o*=t),this.#t=new Int32Array(e,n,o);else{const i=e,a=new hn(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 o=0;o<this.chars;o++)n+=String.fromCodePoint(this.#t[e+o]);return n.replace(/\u0000/g,"")}set(t,e){const n=this.chars*t,o=this.#t.subarray(n,n+this.chars);o.fill(0);for(let i=0;i<this.chars;i++)o[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 Xi(r){const t=JSON.stringify(r,null,2);return new TextEncoder().encode(t)}function er(r){const t=new TextDecoder().decode(r);return JSON.parse(t)}function ks(r,t){const e=t/2,n=t-1;let o=0;for(let i=0;i<r.length;i+=t)for(let a=0;a<e;a+=1)o=r[i+a],r[i+a]=r[i+n-a],r[i+n-a]=o}const hu={int8:Int8Array,int16:Int16Array,int32:Int32Array,int64:globalThis.BigInt64Array,uint8:Uint8Array,uint16:Uint16Array,uint32:Uint32Array,uint64:globalThis.BigUint64Array,float32:Float32Array,float64:Float64Array,bool:qi},lu=/v2:([US])(\d+)/;function jo(r){if(r==="v2:object")return globalThis.Array;let t=r.match(lu);if(t){let[,n,o]=t;return(n==="U"?hn:Ki).bind(null,Number(o))}let e=hu[r];return Yt(e,`Unknown or unsupported data_type: ${r}`),e}function Qe(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,o=new Array(e);for(let i=t.length-1;i>=0;i--)o[t[i]]=n,n*=r[t[i]];return o}function fu({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 du(r){if(r==="|O")return{data_type:"v2:object"};let t=r.match(/^([<|>])(.*)$/);Yt(t,`Invalid dtype: ${r}`);let[,e,n]=t,o={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(o,`Unsupported or unknown dtype: ${r}`),e==="|"?{data_type:o}:{data_type:o,endian:e==="<"?"little":"big"}}function pu(r,t={}){let e=[],n=du(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:o,...i}of r.filters??[])e.push({name:o,configuration:i});if(r.compressor){let{id:o,...i}=r.compressor;e.push({name:o,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 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 o=r==="int64"||r==="uint64";if(t==="bigint")return o;let i=r==="v2:object";return t==="object"?i:!n&&!o&&!e&&!i}function mu(r){return r?.name==="sharding_indexed"}function Vo(r){return(r.data_type==="uint64"||r.data_type==="int64")&&r.fill_value!=null?BigInt(r.fill_value):r.fill_value}function Wo(r,...t){if(!t.some(e=>r instanceof e))throw r}function Yt(r,t=""){if(!r)throw new Error(t)}class Qi{kind="array_to_array";constructor(t,e){Yt(t.keepbits>=0,"keepbits must be zero or positive")}static fromConfig(t,e){return new Qi(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 Ds=wu();function wu(){const r=new Uint32Array([305419896]);return new Uint8Array(r.buffer,r.byteOffset,r.byteLength)[0]!==18}function Us(r){return"BYTES_PER_ELEMENT"in r?r.BYTES_PER_ELEMENT:4}class li{kind="array_to_bytes";#t;#e;#n;#i;#r;constructor(t,e){this.#r=t?.endian,this.#e=jo(e.data_type),this.#i=e.shape,this.#t=Qe(e.shape,"C");const n=new this.#e(0);this.#n=n.BYTES_PER_ELEMENT}static fromConfig(t,e){return new li(t,e)}encode(t){let e=new Uint8Array(t.data.buffer);return Ds&&this.#r==="big"&&ks(e,Us(this.#e)),e}decode(t){return Ds&&this.#r==="big"&&ks(t,Us(this.#e)),{data:new this.#e(t.buffer,t.byteOffset,t.byteLength/this.#n),shape:this.#i,stride:this.#t}}}class ts{kind="bytes_to_bytes";static fromConfig(){return new ts}encode(t){throw new Error("Not implemented")}decode(t){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength-4)}}function bu(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 _u(r,t){return t instanceof Object&&!Array.isArray(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t}class es{configuration;kind="array_to_bytes";#t;#e;constructor(t={}){this.configuration=t;const{encoding:e="utf-8",skipkeys:n=!1,ensure_ascii:o=!0,check_circular:i=!0,allow_nan:a=!0,sort_keys:c=!0,indent:f,strict:p=!0}=t;let g=t.separators;g||(f?g=[", ",": "]:g=[",",":"]),this.#t={encoding:e,skipkeys:n,ensure_ascii:o,check_circular:i,allow_nan:a,indent:f,separators:g,sort_keys:c},this.#e={strict:p}}static fromConfig(t){return new es(t)}encode(t){const{indent:e,encoding:n,ensure_ascii:o,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 f=[];Yt(i,"JsonCodec does not yet support skipping the check for circular references during encoding."),a||f.push(bu),c&&f.push(_u);const p=Array.from(t.data);p.push("|O"),p.push(t.shape);let g;f.length&&(g=(C,F)=>{let T=F;for(let U of f)T=U(C,T);return T});let v=JSON.stringify(p,g,e);return o&&(v=v.replace(/[\u007F-\uFFFF]/g,C=>{const F=`0000${C.charCodeAt(0).toString(16)}`;return`\\u${F.substring(F.length-4)}`})),new TextEncoder().encode(v)}decode(t){const{strict:e}=this.#e;Yt(e,"JsonCodec does not yet support non-strict decoding.");const n=er(t),o=n.pop();n.pop(),Yt(o,"0D not implemented for JsonCodec.");const i=Qe(o,"C");return{data:n,shape:o,stride:i}}}const rs={};function Ls(r){return r instanceof qi||r instanceof Ki||r instanceof hn?new Proxy(r,{get(e,n){return e.get(Number(n))},set(e,n,o){return e.set(Number(n),o),!0}}):r}function Su(r,t){let e;return r.data instanceof Ki||r.data instanceof hn?e=new r.constructor(r.data.length,r.data.chars):e=new r.constructor(r.data.length),{data:e,shape:r.shape,stride:Qe(r.shape,t)}}function Iu(r,t){let e=Su(r,t),n=r.shape.length,o=r.data.length,i=Array(n).fill(0),a=Ls(r.data),c=Ls(e.data);for(let f=0;f<o;f++){let p=0;for(let g=0;g<n;g++)p+=i[g]*e.stride[g];c[p]=a[f],i[0]+=1;for(let g=0;g<n;g++)if(i[g]===r.shape[g]){if(g+1===n)break;i[g]=0,i[g+1]+=1}}return e}function Bu(r){let t=r.shape.length;return rs(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 vu(r,t){let e=Bu(r);return rs(e.length===t.length,"Orders must match"),e.every((n,o)=>n===t[o])}class ns{kind="array_to_array";#t;#e;constructor(t,e){let n=t.order??"C",o=e.shape.length,i=new Array(o),a=new Array(o);if(n==="C")for(let c=0;c<o;++c)i[c]=c,a[c]=c;else if(n==="F")for(let c=0;c<o;++c)i[c]=o-c-1,a[c]=o-c-1;else i=n,i.forEach((c,f)=>{rs(a[c]===void 0,`Invalid permutation: ${JSON.stringify(n)}`),a[c]=f});this.#t=i,this.#e=a}static fromConfig(t,e){return new ns(t,e)}encode(t){return vu(t,this.#e)?t:Iu(t,this.#e)}decode(t){return{data:t.data,shape:t.shape,stride:Qe(t.shape,this.#t)}}}class is{kind="array_to_bytes";#t;#e;constructor(t){this.#t=t,this.#e=Qe(t,"C")}static fromConfig(t,e){return new is(e.shape)}encode(t){throw new Error("Method not implemented.")}decode(t){let e=new TextDecoder,n=new DataView(t.buffer),o=Array(n.getUint32(0,!0)),i=4;for(let a=0;a<o.length;a++){let c=n.getUint32(i,!0);i+=4,o[a]=e.decode(t.buffer.slice(i,i+c)),i+=c}return{data:o,shape:this.#t,stride:this.#e}}}function Au(){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",()=>ns).set("bytes",()=>li).set("crc32c",()=>ts).set("vlen-utf8",()=>is).set("json2",()=>es).set("bitround",()=>Qi)}const xu=Au();function Di(r){let t;return{async encode(e){t||(t=await Rs(r));for(const o of t.array_to_array)e=await o.encode(e);let n=await t.array_to_bytes.encode(e);for(const o of t.bytes_to_bytes)n=await o.encode(n);return n},async decode(e){t||(t=await Rs(r));for(let o=t.bytes_to_bytes.length-1;o>=0;o--)e=await t.bytes_to_bytes[o].decode(e);let n=await t.array_to_bytes.decode(e);for(let o=t.array_to_array.length-1;o>=0;o--)n=await t.array_to_array[o].decode(n);return n}}}async function Rs(r){let t=r.codecs.map(async i=>{let a=await xu.get(i.name)?.();return Yt(a,`Unknown codec: ${i.name}`),{Codec:a,meta:i}}),e=[],n,o=[];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:o.push(c)}}return n||(Yt(Eu(r),`Cannot encode ${r.data_type} to bytes without a codec`),n=li.fromConfig({endian:"little"},r)),{array_to_array:e,array_to_bytes:n,bytes_to_bytes:o}}function Eu(r){return r.data_type!=="v2:object"}const Cs=18446744073709551615n;function Tu(r,t,e,n){Yt(r.store.getRange,"Store does not support range requests");let o=r.store.getRange.bind(r.store),i=t.map((f,p)=>f/n.chunk_shape[p]),a=Di({data_type:"uint64",shape:[...i,2],codecs:n.index_codecs}),c={};return async f=>{let p=f.map((P,R)=>Math.floor(P/i[R])),g=r.resolve(e(p)).path,v;if(g in c)v=c[g];else{let P=4,R=16*i.reduce((G,A)=>G*A,1),V=await o(g,{suffixLength:R+P});v=c[g]=V?await a.decode(V):null}if(v===null)return;let{data:C,shape:F,stride:T}=v,U=f.map((P,R)=>P%F[R]).reduce((P,R,V)=>P+R*T[V],0),M=C[U],k=C[U+1];if(!(M===Cs&&k===Cs))return o(g,{offset:Number(M),length:Number(k)})}}class rr{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 rr(this.store,new URL(t,e).pathname)}}class fi extends rr{kind="group";#t;constructor(t,e,n){super(t,e),this.#t=n}get attrs(){return this.#t.attributes}}function Ps(r){return r.find(e=>e.name==="transpose")?.configuration?.order??"C"}const Jr=Symbol("zarrita.context");function Zo(r){return r[Jr]}function Ou(r,t){let{configuration:e}=t.codecs.find(mu)??{},n={encode_chunk_key:fu(t.chunk_key_encoding),TypedArray:jo(t.data_type),fill_value:t.fill_value};if(e){let i=Ps(e.codecs);return{...n,kind:"sharded",chunk_shape:e.chunk_shape,codec:Di({data_type:t.data_type,shape:e.chunk_shape,codecs:e.codecs}),get_strides(a,c){return Qe(a,c??i)},get_chunk_bytes:Tu(r,t.chunk_grid.configuration.chunk_shape,n.encode_chunk_key,e)}}let o=Ps(t.codecs);return{...n,kind:"regular",chunk_shape:t.chunk_grid.configuration.chunk_shape,codec:Di({data_type:t.data_type,shape:t.chunk_grid.configuration.chunk_shape,codecs:t.codecs}),get_strides(i,a){return Qe(i,a??o)},async get_chunk_bytes(i,a){let c=n.encode_chunk_key(i),f=r.resolve(c).path;return r.store.get(f,a)}}}let Br=class extends rr{kind="array";#t;[Jr];constructor(t,e,n){super(t,e),this.#t={...n,fill_value:Vo(n)},this[Jr]=Ou(this,n)}get attrs(){return this.#t.attributes}get shape(){return this.#t.shape}get chunks(){return this[Jr].chunk_shape}get dtype(){return this.#t.data_type}async getChunk(t,e){let n=this[Jr],o=await n.get_chunk_bytes(t,e);if(!o){let i=n.chunk_shape.reduce((c,f)=>c*f,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(o)}is(t){return gu(this.dtype,t)}},di=Mu();function Mu(){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 Fu(r){let t=await r.store.get(r.resolve(".zattrs").path);return t?er(t):{}}async function Nu(r,t={}){let e="store"in r?r:new rr(r),n={};return(t.attrs??!0)&&(n=await Fu(e)),t.kind==="array"?$s(e,n):t.kind==="group"?zs(e,n):$s(e,n).catch(o=>(Wo(o,Mr),zs(e,n)))}async function $s(r,t){let{path:e}=r.resolve(".zarray"),n=await r.store.get(e);if(!n)throw new Mr("v2 array",{cause:new hi(e)});return di.increment(r.store,"v2"),new Br(r.store,r.path,pu(er(n),t))}async function zs(r,t){let{path:e}=r.resolve(".zgroup"),n=await r.store.get(e);if(!n)throw new Mr("v2 group",{cause:new hi(e)});return di.increment(r.store,"v2"),new fi(r.store,r.path,yu(er(n),t))}async function ku(r){let{store:t,path:e}=r.resolve("zarr.json"),n=await r.store.get(e);if(!n)throw new Mr("v3 array or group",{cause:new hi(e)});let o=er(n);return o.node_type==="array"&&(o.fill_value=Vo(o)),o.node_type==="array"?new Br(t,r.path,o):new fi(t,r.path,o)}async function Du(r,t={}){let e="store"in r?r:new rr(r),n=await ku(e);if(di.increment(e.store,"v3"),t.kind===void 0||t.kind==="array"&&n instanceof Br||t.kind==="group"&&n instanceof fi)return n;let o=n instanceof Br?"array":"group";throw new Error(`Expected node of kind ${t.kind}, found ${o}.`)}async function Ze(r,t={}){let e="store"in r?r.store:r,n=di.version_max(e),o=n==="v2"?Ze.v2:Ze.v3,i=n==="v2"?Ze.v3:Ze.v2;return o(r,t).catch(a=>(Wo(a,Mr),i(r,t)))}Ze.v2=Nu;Ze.v3=Du;async function js(r,t={}){let e="store"in r?r:new rr(r);return"shape"in t?await Lu(e,t):Uu(e,t)}async function Uu(r,t={}){let e={zarr_format:3,node_type:"group",attributes:t.attributes??{}};return await r.store.set(r.resolve("zarr.json").path,Xi(e)),new fi(r.store,r.path,e)}async function Lu(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,Xi(e)),new Br(r.store,r.path,e)}async function Ru(r){let t=await r.get("/.zmetadata");if(!t)throw new Mr("v2 consolidated metadata",{cause:new hi("/.zmetadata")});let e=er(t);return Yt(e.zarr_consolidated_format===1,"Unsupported consolidated format."),e}function Cu(r){return r.endsWith(".zarray")||r.endsWith(".zgroup")||r.endsWith(".zattrs")||r.endsWith("zarr.json")}function Pu(r){return"zarr_format"in r&&r.zarr_format===3}async function $u(r){let t=await Ru(r),e={};for(let[n,o]of Object.entries(t.metadata))e[`/${n}`]=o;return{async get(...n){let[o,i]=n;if(e[o])return Xi(e[o]);let a=await r.get(o,i);if(Cu(o)&&a){let c=er(a);e[o]=c}return a},getRange:r.getRange?.bind(r),contents(){let n=[];for(let[o,i]of Object.entries(e)){let a=o.split("/"),c=a.pop(),f=a.join("/")||"/";c===".zarray"&&n.push({path:f,kind:"array"}),c===".zgroup"&&n.push({path:f,kind:"group"}),Pu(i)&&n.push({path:f,kind:i.node_type})}return n}}}function*zu(r,t,e=1){t===void 0&&(t=r,r=0);for(let n=r;n<t;n+=e)yield n}function*ju(...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:o})=>o),n=0;e[n]=t[n].next()}}function Vu({start:r,stop:t,step:e},n){if(e===0)throw new Error("slice step cannot be zero");e=e??1;const o=e<0,[i,a]=o?[-1,n-1]:[0,n];return r===null?r=o?a:i:r<0?(r+=n,r<i&&(r=i)):r>a&&(r=a),t===null?t=o?i:a:t<0?(t+=n,t<i&&(t=i)):t>a&&(t=a),[r,t,e]}function Ui(r,t,e=null){return t===void 0&&(t=r,r=null),{start:r,stop:t,step:e}}function Go(){const r=[];return{add:t=>r.push(t()),onIdle:()=>Promise.all(r)}}class ss extends Error{constructor(t){super(t),this.name="IndexError"}}function Wu(r,t){throw new ss(`too many indicies for array; expected ${t.length}, got ${r.length}`)}function Zu(r){throw new ss(`index out of bounds for dimension with length ${r}`)}function Gu(){throw new ss("only slices with step >= 1 are supported")}function Yu(r,t){r.length>t.length&&Wu(r,t)}function Ju(r,t){return r=Math.trunc(r),r<0&&(r=t+r),(r>=t||r<0)&&Zu(t),r}class Hu{dim_sel;dim_len;dim_chunk_len;nitems;constructor({dim_sel:t,dim_len:e,dim_chunk_len:n}){t=Ju(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 Vs{start;stop;step;dim_len;dim_chunk_len;nitems;nchunks;constructor({dim_sel:t,dim_len:e,dim_chunk_len:n}){const[o,i,a]=Vu(t,e);this.start=o,this.stop=i,this.step=a,this.step<1&&Gu(),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 zu(t,e)){const o=n*this.dim_chunk_len,i=Math.min(this.dim_len,(n+1)*this.dim_chunk_len),a=i-o;let c=0,f=0;if(this.start<o){const F=(o-this.start)%this.step;F&&(f+=this.step-F),c=Math.ceil((o-this.start)/this.step)}else f=this.start-o;const p=this.stop>i?a:this.stop-o,g=[f,p,this.step],v=Math.ceil((p-f)/this.step),C=[c,c+v,1];yield{dim_chunk_ix:n,dim_chunk_sel:g,dim_out_sel:C}}}}function qu(r,t){let e=[];return r===null?e=t.map(n=>Ui(null)):Array.isArray(r)&&(e=r.map(n=>n??Ui(null))),Yu(e,t),e}class Yo{dim_indexers;shape;constructor({selection:t,shape:e,chunk_shape:n}){this.dim_indexers=qu(t,e).map((o,i)=>new(typeof o=="number"?Hu:Vs)({dim_sel:o,dim_len:e[i],dim_chunk_len:n[i]})),this.shape=this.dim_indexers.filter(o=>o instanceof Vs).map(o=>o.nitems)}*[Symbol.iterator](){for(const t of ju(...this.dim_indexers)){const e=t.map(o=>o.dim_chunk_ix),n=t.map(o=>"dim_out_sel"in o?{from:o.dim_chunk_sel,to:o.dim_out_sel}:{from:o.dim_chunk_sel,to:null});yield{chunk_coords:e,mapping:n}}}}function Ku(r,t){return"get"in r?r.get(t):r[t]}async function Xu(r,t,e,n){let o=Zo(r),i=new Yo({selection:t,shape:r.shape,chunk_shape:r.chunks}),a=n.prepare(new o.TypedArray(i.shape.reduce((f,p)=>f*p,1)),i.shape,o.get_strides(i.shape,e.order)),c=e.create_queue?.()??Go();for(const{chunk_coords:f,mapping:p}of i)c.add(async()=>{let{data:g,shape:v,stride:C}=await r.getChunk(f,e.opts),F=n.prepare(g,v,C);n.set_from_chunk(a,F,p)});return await c.onIdle(),i.shape.length===0?Ku(a.data,0):a}function Qu(r){return r.to==null?{from:r.to,to:r.from}:{from:r.to,to:r.from}}async function th(r,t,e,n,o){const i=Zo(r);if(i.kind==="sharded")throw new Error("Set not supported for sharded arrays.");const a=new Yo({selection:t,shape:r.shape,chunk_shape:r.chunks}),c=r.chunks.reduce((p,g)=>p*g,1),f=n.create_queue?n.create_queue():Go();for(const{chunk_coords:p,mapping:g}of a){const v=g.map(F=>F.from),C=g.map(Qu);f.add(async()=>{const F=r.resolve(i.encode_chunk_key(p)).path;let T;const U=r.chunks.slice(),M=i.get_strides(U);if(eh(v,U))if(T=new i.TypedArray(c),typeof e=="object"){const k=o.prepare(T,U.slice(),M.slice());o.set_from_chunk(k,e,C)}else T.fill(e);else{T=await r.getChunk(p).then(({data:P})=>P);const k=o.prepare(T,U.slice(),M.slice());typeof e=="object"?o.set_from_chunk(k,e,C):o.set_scalar(k,v,e)}await r.store.set(F,await i.codec.encode({data:T,shape:U,stride:M}))})}await f.onIdle()}function eh(r,t){return r.every((e,n)=>{if(typeof e=="number")return!1;const[o,i,a]=e;return i-o===t[n]&&a===1})}function os(r,t=0,e){let n=e??r.length-t;return{length:n,subarray(o,i=n){return os(r,t+o,i-o)},set(o,i=0){for(let a=0;a<o.length;a++)r[t+i+a]=o.get(a)},get(o){return r[t+o]}}}function Si(r){return globalThis.Array.isArray(r.data)?{data:os(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 rh(r){return"chars"in r?r.constructor.bind(null,r.chars):r.constructor}function nh(r,t){if(globalThis.Array.isArray(r.data))return os([t]);let e=rh(r.data),n=new e([t]);return new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}const Jo={prepare(r,t,e){return{data:r,shape:t,stride:e}},set_scalar(r,t,e){let n=Si(r);Li(n,t,nh(r,e),n.bytes_per_element)},set_from_chunk(r,t,e){let n=Si(r);_n(n,Si(t),n.bytes_per_element,e)}};async function ih(r,t=null,e={}){return Xu(r,t,e,Jo)}async function sh(r,t,e,n={}){return th(r,t,e,n,Jo)}function Ho(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 Li(r,t,e,n){if(t.length===0){r.data.set(e,0);return}const[o,...i]=t,[a,...c]=r.stride;if(typeof o=="number"){const C=r.data.subarray(a*o*n);Li({data:C,stride:c},i,e,n);return}const[f,p,g]=o,v=Ho(f,p,g);if(i.length===0){for(let C=0;C<v;C++)r.data.set(e,a*(f+g*C)*n);return}for(let C=0;C<v;C++){const F=r.data.subarray(a*(f+g*C)*n);Li({data:F,stride:c},i,e,n)}}function _n(r,t,e,n){const[o,...i]=n,[a,...c]=r.stride,[f,...p]=t.stride;if(o.from===null){if(i.length===0){r.data.set(t.data.subarray(0,e),o.to*e);return}_n({data:r.data.subarray(a*o.to*e),stride:c},t,e,i);return}if(o.to===null){if(i.length===0){let k=o.from*e;r.data.set(t.data.subarray(k,k+e),0);return}_n(r,{data:t.data.subarray(f*o.from*e),stride:p},e,i);return}const[g,v,C]=o.to,[F,T,U]=o.from,M=Ho(g,v,C);if(i.length===0){if(C===1&&U===1&&a===1&&f===1){let k=F*e,P=M*e;r.data.set(t.data.subarray(k,k+P),g*e);return}for(let k=0;k<M;k++){let P=f*(F+U*k)*e;r.data.set(t.data.subarray(P,P+e),a*(g+C*k)*e)}return}for(let k=0;k<M;k++)_n({data:r.data.subarray(a*(g+k*C)*e),stride:c},{data:t.data.subarray(f*(F+k*U)*e),stride:p},e,i)}function gt(r,t,e,n){function o(i){return i instanceof e?i:new e(function(a){a(i)})}return new(e||(e=Promise))(function(i,a){function c(g){try{p(n.next(g))}catch(v){a(v)}}function f(g){try{p(n.throw(g))}catch(v){a(v)}}function p(g){g.done?i(g.value):o(g.value).then(c,f)}p((n=n.apply(r,t||[])).next())})}function Ws(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||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),c("next"),c("throw"),c("return",a),o[Symbol.asyncIterator]=function(){return this},o;function a(F){return function(T){return Promise.resolve(T).then(F,v)}}function c(F,T){n[F]&&(o[F]=function(U){return new Promise(function(M,k){i.push([F,U,M,k])>1||f(F,U)})},T&&(o[F]=T(o[F])))}function f(F,T){try{p(n[F](T))}catch(U){C(i[0][3],U)}}function p(F){F.value instanceof wt?Promise.resolve(F.value.v).then(g,v):C(i[0][2],F)}function g(F){f("next",F)}function v(F){f("throw",F)}function C(F,T){F(T),i.shift(),i.length&&f(i[0][0],i[0][1])}}function Sn(r){var t,e;return t={},n("next"),n("throw",function(o){throw o}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(o,i){t[o]=r[o]?function(a){return(e=!e)?{value:wt(r[o](a)),done:!1}:i?i(a):a}:i}}function wr(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 Ws=="function"?Ws(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,f){a=r[i](a),o(c,f,a.done,a.value)})}}function o(i,a,c,f){Promise.resolve(f).then(function(p){i({value:p,done:c})},a)}}const oh=new TextDecoder("utf-8"),Ri=r=>oh.decode(r),ah=new TextEncoder,as=r=>ah.encode(r),ch=r=>typeof r=="number",uh=r=>typeof r=="boolean",qt=r=>typeof r=="function",ge=r=>r!=null&&Object(r)===r,sn=r=>ge(r)&&qt(r.then),pi=r=>ge(r)&&qt(r[Symbol.iterator]),cs=r=>ge(r)&&qt(r[Symbol.asyncIterator]),Ci=r=>ge(r)&&ge(r.schema),qo=r=>ge(r)&&"done"in r&&"value"in r,Ko=r=>ge(r)&&qt(r.stat)&&ch(r.fd),Xo=r=>ge(r)&&us(r.body),Qo=r=>"_getDOMStream"in r&&"_getNodeStream"in r,us=r=>ge(r)&&qt(r.cancel)&&qt(r.getReader)&&!Qo(r),ta=r=>ge(r)&&qt(r.read)&&qt(r.pipe)&&uh(r.readable)&&!Qo(r),hh=r=>ge(r)&&qt(r.clear)&&qt(r.bytes)&&qt(r.position)&&qt(r.setPosition)&&qt(r.capacity)&&qt(r.getBufferIdentifier)&&qt(r.createLong),hs=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;function lh(r){const t=r[0]?[r[0]]:[];let e,n,o,i;for(let a,c,f=0,p=0,g=r.length;++f<g;){if(a=t[p],c=r[f],!a||!c||a.buffer!==c.buffer||c.byteOffset<a.byteOffset){c&&(t[++p]=c);continue}if({byteOffset:e,byteLength:o}=a,{byteOffset:n,byteLength:i}=c,e+o<n||n+i<e){c&&(t[++p]=c);continue}t[p]=new Uint8Array(a.buffer,e,n-e+i)}return t}function Zs(r,t,e=0,n=t.byteLength){const o=r.byteLength,i=new Uint8Array(r.buffer,r.byteOffset,o),a=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,o));return i.set(a,e),r}function xe(r,t){const e=lh(r),n=e.reduce((g,v)=>g+v.byteLength,0);let o,i,a,c=0,f=-1;const p=Math.min(t||Number.POSITIVE_INFINITY,n);for(const g=e.length;++f<g;){if(o=e[f],i=o.subarray(0,Math.min(o.length,p-c)),p<=c+i.length){i.length<o.length?e[f]=o.subarray(i.length):i.length===o.length&&f++,a?Zs(a,i,c):a=i;break}Zs(a||(a=new Uint8Array(p)),i,c),c+=i.length}return[a||new Uint8Array(0),e.slice(f),n-(a?a.byteLength:0)]}function Ot(r,t){let e=qo(t)?t.value:t;return e instanceof r?r===Uint8Array?new r(e.buffer,e.byteOffset,e.byteLength):e:e?(typeof e=="string"&&(e=as(e)),e instanceof ArrayBuffer?new r(e):e instanceof hs?new r(e):hh(e)?Ot(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 kr=r=>Ot(Int32Array,r),Gs=r=>Ot(BigInt64Array,r),It=r=>Ot(Uint8Array,r),Pi=r=>(r.next(),r);function*fh(r,t){const e=function*(o){yield o},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof hs?e(t):pi(t)?t:e(t);return yield*Pi(function*(o){let i=null;do i=o.next(yield Ot(r,i));while(!i.done)}(n[Symbol.iterator]())),new r}const dh=r=>fh(Uint8Array,r);function ea(r,t){return Ae(this,arguments,function*(){if(sn(t))return yield wt(yield wt(yield*Sn(wr(ea(r,yield wt(t))))));const n=function(a){return Ae(this,arguments,function*(){yield yield wt(yield wt(a))})},o=function(a){return Ae(this,arguments,function*(){yield wt(yield*Sn(wr(Pi(function*(c){let f=null;do f=c.next(yield f?.value);while(!f.done)}(a[Symbol.iterator]())))))})},i=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof hs?n(t):pi(t)?o(t):cs(t)?t:n(t);return yield wt(yield*Sn(wr(Pi(function(a){return Ae(this,arguments,function*(){let c=null;do c=yield wt(a.next(yield yield wt(Ot(r,c))));while(!c.done)})}(i[Symbol.asyncIterator]()))))),yield wt(new r)})}const ph=r=>ea(Uint8Array,r);function yh(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 ae={fromIterable(r){return yn(gh(r))},fromAsyncIterable(r){return yn(mh(r))},fromDOMStream(r){return yn(wh(r))},fromNodeStream(r){return yn(_h(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')}},yn=r=>(r.next(),r);function*gh(r){let t,e=!1,n=[],o,i,a,c=0;function f(){return i==="peek"?xe(n,a)[0]:([o,n,c]=xe(n,a),o)}({cmd:i,size:a}=(yield null)||{cmd:"read",size:0});const p=dh(r)[Symbol.iterator]();try{do if({done:t,value:o}=Number.isNaN(a-c)?p.next():p.next(a-c),!t&&o.byteLength>0&&(n.push(o),c+=o.byteLength),t||a<=c)do({cmd:i,size:a}=yield f());while(a<c);while(!t)}catch(g){(e=!0)&&typeof p.throw=="function"&&p.throw(g)}finally{e===!1&&typeof p.return=="function"&&p.return(null)}return null}function mh(r){return Ae(this,arguments,function*(){let e,n=!1,o=[],i,a,c,f=0;function p(){return a==="peek"?xe(o,c)[0]:([i,o,f]=xe(o,c),i)}({cmd:a,size:c}=(yield yield wt(null))||{cmd:"read",size:0});const g=ph(r)[Symbol.asyncIterator]();try{do if({done:e,value:i}=Number.isNaN(c-f)?yield wt(g.next()):yield wt(g.next(c-f)),!e&&i.byteLength>0&&(o.push(i),f+=i.byteLength),e||c<=f)do({cmd:a,size:c}=yield yield wt(p()));while(c<f);while(!e)}catch(v){(n=!0)&&typeof g.throw=="function"&&(yield wt(g.throw(v)))}finally{n===!1&&typeof g.return=="function"&&(yield wt(g.return(new Uint8Array(0))))}return yield wt(null)})}function wh(r){return Ae(this,arguments,function*(){let e=!1,n=!1,o=[],i,a,c,f=0;function p(){return a==="peek"?xe(o,c)[0]:([i,o,f]=xe(o,c),i)}({cmd:a,size:c}=(yield yield wt(null))||{cmd:"read",size:0});const g=new bh(r);try{do if({done:e,value:i}=Number.isNaN(c-f)?yield wt(g.read()):yield wt(g.read(c-f)),!e&&i.byteLength>0&&(o.push(It(i)),f+=i.byteLength),e||c<=f)do({cmd:a,size:c}=yield yield wt(p()));while(c<f);while(!e)}catch(v){(n=!0)&&(yield wt(g.cancel(v)))}finally{n===!1?yield wt(g.cancel()):r.locked&&g.releaseLock()}return yield wt(null)})}class bh{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 Ii=(r,t)=>{const e=o=>n([t,o]);let n;return[t,e,new Promise(o=>(n=o)&&r.once(t,e))]};function _h(r){return Ae(this,arguments,function*(){const e=[];let n="error",o=!1,i=null,a,c,f=0,p=[],g;function v(){return a==="peek"?xe(p,c)[0]:([g,p,f]=xe(p,c),g)}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]=Ii(r,"end"),e[1]=Ii(r,"error");do{if(e[2]=Ii(r,"readable"),[n,i]=yield wt(Promise.race(e.map(F=>F[2]))),n==="error")break;if((o=n==="end")||(Number.isFinite(c-f)?(g=It(r.read(c-f)),g.byteLength<c-f&&(g=It(r.read()))):g=It(r.read()),g.byteLength>0&&(p.push(g),f+=g.byteLength)),o||c<=f)do({cmd:a,size:c}=yield yield wt(v()));while(c<f)}while(!o)}finally{yield wt(C(e,n==="error"?i:null))}return yield wt(null);function C(F,T){return g=p=null,new Promise((U,M)=>{for(const[k,P]of F)r.off(k,P);try{const k=r.destroy;k&&k.call(r,T),T=void 0}catch(k){T=k||T}finally{T!=null?M(T):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 le;(function(r){r[r.DAY=0]="DAY",r[r.MILLISECOND=1]="MILLISECOND"})(le||(le={}));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 Ee;(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"})(Ee||(Ee={}));const Bi=2,Ie=4,Ne=4,At=4,Ve=new Int32Array(2),Ys=new Float32Array(Ve.buffer),Js=new Float64Array(Ve.buffer),gn=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1;var $i;(function(r){r[r.UTF8_BYTES=1]="UTF8_BYTES",r[r.UTF16_STRING=2]="UTF16_STRING"})($i||($i={}));let vr=class ra{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new ra(new Uint8Array(t))}clear(){this.position_=0}bytes(){return this.bytes_}position(){return this.position_}setPosition(t){this.position_=t}capacity(){return this.bytes_.length}readInt8(t){return this.readUint8(t)<<24>>24}readUint8(t){return this.bytes_[t]}readInt16(t){return this.readUint16(t)<<16>>16}readUint16(t){return this.bytes_[t]|this.bytes_[t+1]<<8}readInt32(t){return this.bytes_[t]|this.bytes_[t+1]<<8|this.bytes_[t+2]<<16|this.bytes_[t+3]<<24}readUint32(t){return this.readInt32(t)>>>0}readInt64(t){return BigInt.asIntN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readUint64(t){return BigInt.asUintN(64,BigInt(this.readUint32(t))+(BigInt(this.readUint32(t+4))<<BigInt(32)))}readFloat32(t){return Ve[0]=this.readInt32(t),Ys[0]}readFloat64(t){return Ve[gn?0:1]=this.readInt32(t),Ve[gn?1:0]=this.readInt32(t+4),Js[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){Ys[0]=e,this.writeInt32(t,Ve[0])}writeFloat64(t,e){Js[0]=e,this.writeInt32(t,Ve[gn?0:1]),this.writeInt32(t+4,Ve[gn?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+Ie+Ne)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let e=0;e<Ne;e++)t+=String.fromCharCode(this.readInt8(this.position_+Ie+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+=Ie;const o=this.bytes_.subarray(t,t+n);return e===$i.UTF8_BYTES?o:this.text_decoder_.decode(o)}__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)+Ie}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=Ne)throw new Error("FlatBuffers: file identifier must be length "+Ne);for(let e=0;e<Ne;e++)if(t.charCodeAt(e)!=this.readInt8(this.position()+Ie+e))return!1;return!0}createScalarList(t,e){const n=[];for(let o=0;o<e;++o){const i=t(o);i!==null&&n.push(i)}return n}createObjList(t,e){const n=[];for(let o=0;o<e;++o){const i=t(o);i!==null&&n.push(i.unpack())}return n}},na=class ia{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=vr.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 o=this.bb.capacity();this.bb=ia.growByteBuffer(this.bb),this.space+=this.bb.capacity()-o}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,o=vr.allocate(n);return o.setPosition(n-e),o.bytes().set(t.bytes(),n-e),o}addOffset(t){this.prep(Ie,0),this.writeInt32(this.offset()-t+Ie)}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 o=2;this.addInt16(t-this.object_start);const i=(n+o)*Bi;this.addInt16(i);let a=0;const c=this.space;t:for(e=0;e<this.vtables.length;e++){const f=this.bb.capacity()-this.vtables[e];if(i==this.bb.readInt16(f)){for(let p=Bi;p<i;p+=Bi)if(this.bb.readInt16(c+p)!=this.bb.readInt16(f+p))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 o=n?At:0;if(e){const i=e;if(this.prep(this.minalign,Ie+Ne+o),i.length!=Ne)throw new TypeError("FlatBuffers: file identifier must be length "+Ne);for(let a=Ne-1;a>=0;a--)this.writeInt8(i.charCodeAt(a))}this.prep(this.minalign,Ie+o),this.addOffset(t),o&&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,o=n-this.bb.readInt32(n);if(!(e<this.bb.readInt16(o)&&this.bb.readInt16(o+e)!=0))throw new TypeError("FlatBuffers: field "+e+" must be set")}startVector(t,e,n){this.notNested(),this.vector_num_elems=e,this.prep(Ie,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 o=t[n];if(o!==null)e.push(this.createObjectOffset(o));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 Nn;(function(r){r[r.BUFFER=0]="BUFFER"})(Nn||(Nn={}));var kn;(function(r){r[r.LZ4_FRAME=0]="LZ4_FRAME",r[r.ZSTD=1]="ZSTD"})(kn||(kn={}));class We{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 We).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,e){return t.setPosition(t.position()+At),(e||new We).__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):kn.LZ4_FRAME}method(){const t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):Nn.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,e){t.addFieldInt8(0,e,kn.LZ4_FRAME)}static addMethod(t,e){t.addFieldInt8(1,e,Nn.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,e,n){return We.startBodyCompression(t),We.addCodec(t,e),We.addMethod(t,n),We.endBodyCompression(t)}}class sa{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 oa=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()}},Oe=class zi{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 zi).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,e){return t.setPosition(t.position()+At),(e||new zi).__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 oa).__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 sa).__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 We).__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()}},or=class ji{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 ji).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,e){return t.setPosition(t.position()+At),(e||new ji).__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 Oe).__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 Dn;(function(r){r[r.DenseArray=0]="DenseArray"})(Dn||(Dn={}));class se{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 se).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,e){return t.setPosition(t.position()+At),(e||new se).__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 se.startInt(t),se.addBitWidth(t,e),se.addIsSigned(t,n),se.endInt(t)}}class ke{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 ke).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,e){return t.setPosition(t.position()+At),(e||new ke).__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 se).__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):Dn.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,Dn.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()+At),(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 Hs=class Hr{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 Hr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,e){return t.setPosition(t.position()+At),(e||new Hr).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return Hr.startBinary(t),Hr.endBinary(t)}},qs=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()+At),(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)}},In=class ar{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 ar).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,e){return t.setPosition(t.position()+At),(e||new ar).__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):le.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,le.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,e){return ar.startDate(t),ar.addUnit(t,e),ar.endDate(t)}},cr=class je{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 je).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,e){return t.setPosition(t.position()+At),(e||new je).__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,o){return je.startDecimal(t),je.addPrecision(t,e),je.addScale(t,n),je.addBitWidth(t,o),je.endDecimal(t)}},Bn=class ur{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 ur).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,e){return t.setPosition(t.position()+At),(e||new ur).__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 ur.startDuration(t),ur.addUnit(t,e),ur.endDuration(t)}},vn=class hr{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 hr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,e){return t.setPosition(t.position()+At),(e||new hr).__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 hr.startFixedSizeBinary(t),hr.addByteWidth(t,e),hr.endFixedSizeBinary(t)}},An=class lr{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 lr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,e){return t.setPosition(t.position()+At),(e||new lr).__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 lr.startFixedSizeList(t),lr.addListSize(t,e),lr.endFixedSizeList(t)}};class Be{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 Be).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,e){return t.setPosition(t.position()+At),(e||new Be).__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 Be.startFloatingPoint(t),Be.addPrecision(t,e),Be.endFloatingPoint(t)}}class ve{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 ve).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,e){return t.setPosition(t.position()+At),(e||new ve).__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):Ee.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,e){t.addFieldInt16(0,e,Ee.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,e){return ve.startInterval(t),ve.addUnit(t,e),ve.endInterval(t)}}let Ks=class Kr{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 Kr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,e){return t.setPosition(t.position()+At),(e||new Kr).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return Kr.startLargeBinary(t),Kr.endLargeBinary(t)}},Xs=class Xr{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 Xr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,e){return t.setPosition(t.position()+At),(e||new Xr).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return Xr.startLargeUtf8(t),Xr.endLargeUtf8(t)}},Qs=class Qr{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 Qr).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,e){return t.setPosition(t.position()+At),(e||new Qr).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return Qr.startList(t),Qr.endList(t)}},xn=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()+At),(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)}},to=class tn{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 tn).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,e){return t.setPosition(t.position()+At),(e||new tn).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return tn.startNull(t),tn.endNull(t)}};class Xe{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 Xe).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,e){return t.setPosition(t.position()+At),(e||new Xe).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return Xe.startStruct_(t),Xe.endStruct_(t)}}class ce{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 ce).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,e){return t.setPosition(t.position()+At),(e||new ce).__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 ce.startTime(t),ce.addUnit(t,e),ce.addBitWidth(t,n),ce.endTime(t)}}class ue{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 ue).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,e){return t.setPosition(t.position()+At),(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.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 ue.startTimestamp(t),ue.addUnit(t,e),ue.addTimezone(t,n),ue.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()+At),(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 eo=class en{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 en).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,e){return t.setPosition(t.position()+At),(e||new en).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return en.startUtf8(t),en.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 oe=class En{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 En).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,e){return t.setPosition(t.position()+At),(e||new En).__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 ke).__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 En).__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()}},_e=class Te{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 Te).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,e){return t.setPosition(t.position()+At),(e||new Te).__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 oe).__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,o,i){return Te.startSchema(t),Te.addEndianness(t,e),Te.addFields(t,n),Te.addCustomMetadata(t,o),Te.addFeatures(t,i),Te.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 x;(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"})(x||(x={}));var Me;(function(r){r[r.OFFSET=0]="OFFSET",r[r.DATA=1]="DATA",r[r.VALIDITY=2]="VALIDITY",r[r.TYPE=3]="TYPE"})(Me||(Me={}));const Sh=void 0;function on(r){if(r===null)return"null";if(r===Sh)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=>on(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 aa(r,t){return Lt(r/t)+Lt(r%t)/Lt(t)}const Ih=Symbol.for("isArrowBigNum");function we(r,...t){return t.length===0?Object.setPrototypeOf(Ot(this.TypedArray,r),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(r,...t),this.constructor.prototype)}we.prototype[Ih]=!0;we.prototype.toJSON=function(){return`"${cn(this)}"`};we.prototype.valueOf=function(r){return ca(this,r)};we.prototype.toString=function(){return cn(this)};we.prototype[Symbol.toPrimitive]=function(r="default"){switch(r){case"number":return ca(this);case"string":return cn(this);case"default":return Ah(this)}return cn(this)};function br(...r){return we.apply(this,r)}function _r(...r){return we.apply(this,r)}function an(...r){return we.apply(this,r)}Object.setPrototypeOf(br.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(_r.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(an.prototype,Object.create(Uint32Array.prototype));Object.assign(br.prototype,we.prototype,{constructor:br,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(_r.prototype,we.prototype,{constructor:_r,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(an.prototype,we.prototype,{constructor:an,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});const Bh=BigInt(4294967296)*BigInt(4294967296),vh=Bh-BigInt(1);function ca(r,t){const{buffer:e,byteOffset:n,byteLength:o,signed:i}=r,a=new BigUint64Array(e,n,o/8),c=i&&a.at(-1)&BigInt(1)<<BigInt(63);let f=BigInt(0),p=0;if(c){for(const g of a)f|=(g^vh)*(BigInt(1)<<BigInt(64*p++));f*=BigInt(-1),f-=BigInt(1)}else for(const g of a)f|=g*(BigInt(1)<<BigInt(64*p++));if(typeof t=="number"){const g=BigInt(Math.pow(10,t)),v=f/g,C=f%g;return Lt(v)+Lt(C)/Lt(g)}return Lt(f)}function cn(r){if(r.byteLength===8)return`${new r.BigIntArray(r.buffer,r.byteOffset,1)[0]}`;if(!r.signed)return vi(r);let t=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return vi(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`-${vi(t)}`}function Ah(r){return r.byteLength===8?new r.BigIntArray(r.buffer,r.byteOffset,1)[0]:cn(r)}function vi(r){let t="";const e=new Uint32Array(2);let n=new Uint16Array(r.buffer,r.byteOffset,r.byteLength/2);const o=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(o[0]||o[1]||o[2]||o[3]);return t??"0"}class ls{static new(t,e){switch(e){case!0:return new br(t);case!1:return new _r(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new br(t)}return t.byteLength===16?new an(t):new _r(t)}static signed(t){return new br(t)}static unsigned(t){return new _r(t)}static decimal(t){return new an(t)}constructor(t,e){return ls.new(t,e)}}var ua,ha,la,fa,da,pa,ya,ga,ma,wa,ba,_a,Sa,Ia,Ba,va,Aa,xa,Ea,Ta,Oa,Ma;class tt{static isNull(t){return t?.typeId===x.Null}static isInt(t){return t?.typeId===x.Int}static isFloat(t){return t?.typeId===x.Float}static isBinary(t){return t?.typeId===x.Binary}static isLargeBinary(t){return t?.typeId===x.LargeBinary}static isUtf8(t){return t?.typeId===x.Utf8}static isLargeUtf8(t){return t?.typeId===x.LargeUtf8}static isBool(t){return t?.typeId===x.Bool}static isDecimal(t){return t?.typeId===x.Decimal}static isDate(t){return t?.typeId===x.Date}static isTime(t){return t?.typeId===x.Time}static isTimestamp(t){return t?.typeId===x.Timestamp}static isInterval(t){return t?.typeId===x.Interval}static isDuration(t){return t?.typeId===x.Duration}static isList(t){return t?.typeId===x.List}static isStruct(t){return t?.typeId===x.Struct}static isUnion(t){return t?.typeId===x.Union}static isFixedSizeBinary(t){return t?.typeId===x.FixedSizeBinary}static isFixedSizeList(t){return t?.typeId===x.FixedSizeList}static isMap(t){return t?.typeId===x.Map}static isDictionary(t){return t?.typeId===x.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}}ua=Symbol.toStringTag;tt[ua]=(r=>(r.children=null,r.ArrayType=Array,r.OffsetArrayType=Int32Array,r[Symbol.toStringTag]="DataType"))(tt.prototype);class Ye extends tt{constructor(){super(x.Null)}toString(){return"Null"}}ha=Symbol.toStringTag;Ye[ha]=(r=>r[Symbol.toStringTag]="Null")(Ye.prototype);class tr extends tt{constructor(t,e){super(x.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;tr[la]=(r=>(r.isSigned=null,r.bitWidth=null,r[Symbol.toStringTag]="Int"))(tr.prototype);class un extends tr{constructor(){super(!0,32)}get ArrayType(){return Int32Array}}Object.defineProperty(un.prototype,"ArrayType",{value:Int32Array});class Un extends tt{constructor(t){super(x.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}`}}fa=Symbol.toStringTag;Un[fa]=(r=>(r.precision=null,r[Symbol.toStringTag]="Float"))(Un.prototype);class Ln extends tt{constructor(){super(x.Binary)}toString(){return"Binary"}}da=Symbol.toStringTag;Ln[da]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Binary"))(Ln.prototype);class Rn extends tt{constructor(){super(x.LargeBinary)}toString(){return"LargeBinary"}}pa=Symbol.toStringTag;Rn[pa]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeBinary"))(Rn.prototype);class Cn extends tt{constructor(){super(x.Utf8)}toString(){return"Utf8"}}ya=Symbol.toStringTag;Cn[ya]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Utf8"))(Cn.prototype);class Pn extends tt{constructor(){super(x.LargeUtf8)}toString(){return"LargeUtf8"}}ga=Symbol.toStringTag;Pn[ga]=(r=>(r.ArrayType=Uint8Array,r.OffsetArrayType=BigInt64Array,r[Symbol.toStringTag]="LargeUtf8"))(Pn.prototype);class $n extends tt{constructor(){super(x.Bool)}toString(){return"Bool"}}ma=Symbol.toStringTag;$n[ma]=(r=>(r.ArrayType=Uint8Array,r[Symbol.toStringTag]="Bool"))($n.prototype);class zn extends tt{constructor(t,e,n=128){super(x.Decimal),this.scale=t,this.precision=e,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}}wa=Symbol.toStringTag;zn[wa]=(r=>(r.scale=null,r.precision=null,r.ArrayType=Uint32Array,r[Symbol.toStringTag]="Decimal"))(zn.prototype);class jn extends tt{constructor(t){super(x.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${le[this.unit]}>`}get ArrayType(){return this.unit===le.DAY?Int32Array:BigInt64Array}}ba=Symbol.toStringTag;jn[ba]=(r=>(r.unit=null,r[Symbol.toStringTag]="Date"))(jn.prototype);class Vn extends tt{constructor(t,e){super(x.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`)}}_a=Symbol.toStringTag;Vn[_a]=(r=>(r.unit=null,r.bitWidth=null,r[Symbol.toStringTag]="Time"))(Vn.prototype);class Wn extends tt{constructor(t,e){super(x.Timestamp),this.unit=t,this.timezone=e}toString(){return`Timestamp<${at[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}}Sa=Symbol.toStringTag;Wn[Sa]=(r=>(r.unit=null,r.timezone=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Timestamp"))(Wn.prototype);class Zn extends tt{constructor(t){super(x.Interval),this.unit=t}toString(){return`Interval<${Ee[this.unit]}>`}}Ia=Symbol.toStringTag;Zn[Ia]=(r=>(r.unit=null,r.ArrayType=Int32Array,r[Symbol.toStringTag]="Interval"))(Zn.prototype);class Gn extends tt{constructor(t){super(x.Duration),this.unit=t}toString(){return`Duration<${at[this.unit]}>`}}Ba=Symbol.toStringTag;Gn[Ba]=(r=>(r.unit=null,r.ArrayType=BigInt64Array,r[Symbol.toStringTag]="Duration"))(Gn.prototype);class Yn extends tt{constructor(t){super(x.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}}va=Symbol.toStringTag;Yn[va]=(r=>(r.children=null,r[Symbol.toStringTag]="List"))(Yn.prototype);class Kt extends tt{constructor(t){super(x.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}}Aa=Symbol.toStringTag;Kt[Aa]=(r=>(r.children=null,r[Symbol.toStringTag]="Struct"))(Kt.prototype);class Jn extends tt{constructor(t,e,n){super(x.Union),this.mode=t,this.children=n,this.typeIds=e=Int32Array.from(e),this.typeIdToChildIndex=e.reduce((o,i,a)=>(o[i]=a)&&o||o,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}}xa=Symbol.toStringTag;Jn[xa]=(r=>(r.mode=null,r.typeIds=null,r.children=null,r.typeIdToChildIndex=null,r.ArrayType=Int8Array,r[Symbol.toStringTag]="Union"))(Jn.prototype);class Hn extends tt{constructor(t){super(x.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}}Ea=Symbol.toStringTag;Hn[Ea]=(r=>(r.byteWidth=null,r.ArrayType=Uint8Array,r[Symbol.toStringTag]="FixedSizeBinary"))(Hn.prototype);class qn extends tt{constructor(t,e){super(x.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}>`}}Ta=Symbol.toStringTag;qn[Ta]=(r=>(r.children=null,r.listSize=null,r[Symbol.toStringTag]="FixedSizeList"))(qn.prototype);class Kn extends tt{constructor(t,e=!1){var n,o,i;if(super(x.Map),this.children=[t],this.keysSorted=e,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){const a=(o=t?.type)===null||o===void 0?void 0:o.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(", ")}}>`}}Oa=Symbol.toStringTag;Kn[Oa]=(r=>(r.children=null,r.keysSorted=null,r[Symbol.toStringTag]="Map_"))(Kn.prototype);const xh=(r=>()=>++r)(-1);class xr extends tt{constructor(t,e,n,o){super(x.Dictionary),this.indices=e,this.dictionary=t,this.isOrdered=o||!1,this.id=n==null?xh():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}>`}}Ma=Symbol.toStringTag;xr[Ma]=(r=>(r.id=null,r.indices=null,r.isOrdered=null,r.dictionary=null,r[Symbol.toStringTag]="Dictionary"))(xr.prototype);function Fe(r){const t=r;switch(r.typeId){case x.Decimal:return r.bitWidth/32;case x.Interval:return 1+t.unit;case x.FixedSizeList:return t.listSize;case x.FixedSizeBinary:return t.byteWidth;default:return 1}}class St{visitMany(t,...e){return t.map((n,o)=>this.visit(n,...e.map(i=>i[o])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,e=!0){return Eh(this,t,e)}getVisitFnByTypeId(t,e=!0){return dr(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 Eh(r,t,e=!0){return typeof t=="number"?dr(r,t,e):typeof t=="string"&&t in x?dr(r,x[t],e):t&&t instanceof tt?dr(r,ro(t),e):t?.type&&t.type instanceof tt?dr(r,ro(t.type),e):dr(r,x.NONE,e)}function dr(r,t,e=!0){let n=null;switch(t){case x.Null:n=r.visitNull;break;case x.Bool:n=r.visitBool;break;case x.Int:n=r.visitInt;break;case x.Int8:n=r.visitInt8||r.visitInt;break;case x.Int16:n=r.visitInt16||r.visitInt;break;case x.Int32:n=r.visitInt32||r.visitInt;break;case x.Int64:n=r.visitInt64||r.visitInt;break;case x.Uint8:n=r.visitUint8||r.visitInt;break;case x.Uint16:n=r.visitUint16||r.visitInt;break;case x.Uint32:n=r.visitUint32||r.visitInt;break;case x.Uint64:n=r.visitUint64||r.visitInt;break;case x.Float:n=r.visitFloat;break;case x.Float16:n=r.visitFloat16||r.visitFloat;break;case x.Float32:n=r.visitFloat32||r.visitFloat;break;case x.Float64:n=r.visitFloat64||r.visitFloat;break;case x.Utf8:n=r.visitUtf8;break;case x.LargeUtf8:n=r.visitLargeUtf8;break;case x.Binary:n=r.visitBinary;break;case x.LargeBinary:n=r.visitLargeBinary;break;case x.FixedSizeBinary:n=r.visitFixedSizeBinary;break;case x.Date:n=r.visitDate;break;case x.DateDay:n=r.visitDateDay||r.visitDate;break;case x.DateMillisecond:n=r.visitDateMillisecond||r.visitDate;break;case x.Timestamp:n=r.visitTimestamp;break;case x.TimestampSecond:n=r.visitTimestampSecond||r.visitTimestamp;break;case x.TimestampMillisecond:n=r.visitTimestampMillisecond||r.visitTimestamp;break;case x.TimestampMicrosecond:n=r.visitTimestampMicrosecond||r.visitTimestamp;break;case x.TimestampNanosecond:n=r.visitTimestampNanosecond||r.visitTimestamp;break;case x.Time:n=r.visitTime;break;case x.TimeSecond:n=r.visitTimeSecond||r.visitTime;break;case x.TimeMillisecond:n=r.visitTimeMillisecond||r.visitTime;break;case x.TimeMicrosecond:n=r.visitTimeMicrosecond||r.visitTime;break;case x.TimeNanosecond:n=r.visitTimeNanosecond||r.visitTime;break;case x.Decimal:n=r.visitDecimal;break;case x.List:n=r.visitList;break;case x.Struct:n=r.visitStruct;break;case x.Union:n=r.visitUnion;break;case x.DenseUnion:n=r.visitDenseUnion||r.visitUnion;break;case x.SparseUnion:n=r.visitSparseUnion||r.visitUnion;break;case x.Dictionary:n=r.visitDictionary;break;case x.Interval:n=r.visitInterval;break;case x.IntervalDayTime:n=r.visitIntervalDayTime||r.visitInterval;break;case x.IntervalYearMonth:n=r.visitIntervalYearMonth||r.visitInterval;break;case x.Duration:n=r.visitDuration;break;case x.DurationSecond:n=r.visitDurationSecond||r.visitDuration;break;case x.DurationMillisecond:n=r.visitDurationMillisecond||r.visitDuration;break;case x.DurationMicrosecond:n=r.visitDurationMicrosecond||r.visitDuration;break;case x.DurationNanosecond:n=r.visitDurationNanosecond||r.visitDuration;break;case x.FixedSizeList:n=r.visitFixedSizeList;break;case x.Map:n=r.visitMap;break}if(typeof n=="function")return n;if(!e)return()=>null;throw new Error(`Unrecognized type '${x[t]}'`)}function ro(r){switch(r.typeId){case x.Null:return x.Null;case x.Int:{const{bitWidth:t,isSigned:e}=r;switch(t){case 8:return e?x.Int8:x.Uint8;case 16:return e?x.Int16:x.Uint16;case 32:return e?x.Int32:x.Uint32;case 64:return e?x.Int64:x.Uint64}return x.Int}case x.Float:switch(r.precision){case Jt.HALF:return x.Float16;case Jt.SINGLE:return x.Float32;case Jt.DOUBLE:return x.Float64}return x.Float;case x.Binary:return x.Binary;case x.LargeBinary:return x.LargeBinary;case x.Utf8:return x.Utf8;case x.LargeUtf8:return x.LargeUtf8;case x.Bool:return x.Bool;case x.Decimal:return x.Decimal;case x.Time:switch(r.unit){case at.SECOND:return x.TimeSecond;case at.MILLISECOND:return x.TimeMillisecond;case at.MICROSECOND:return x.TimeMicrosecond;case at.NANOSECOND:return x.TimeNanosecond}return x.Time;case x.Timestamp:switch(r.unit){case at.SECOND:return x.TimestampSecond;case at.MILLISECOND:return x.TimestampMillisecond;case at.MICROSECOND:return x.TimestampMicrosecond;case at.NANOSECOND:return x.TimestampNanosecond}return x.Timestamp;case x.Date:switch(r.unit){case le.DAY:return x.DateDay;case le.MILLISECOND:return x.DateMillisecond}return x.Date;case x.Interval:switch(r.unit){case Ee.DAY_TIME:return x.IntervalDayTime;case Ee.YEAR_MONTH:return x.IntervalYearMonth}return x.Interval;case x.Duration:switch(r.unit){case at.SECOND:return x.DurationSecond;case at.MILLISECOND:return x.DurationMillisecond;case at.MICROSECOND:return x.DurationMicrosecond;case at.NANOSECOND:return x.DurationNanosecond}return x.Duration;case x.Map:return x.Map;case x.List:return x.List;case x.Struct:return x.Struct;case x.Union:switch(r.mode){case re.Dense:return x.DenseUnion;case re.Sparse:return x.SparseUnion}return x.Union;case x.FixedSizeBinary:return x.FixedSizeBinary;case x.FixedSizeList:return x.FixedSizeList;case x.Dictionary:return x.Dictionary}throw new Error(`Unrecognized type '${x[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 Fa=new Float64Array(1),sr=new Uint32Array(Fa.buffer);function Na(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 Th(r){if(r!==r)return 32256;Fa[0]=r;const t=(sr[1]&2147483648)>>16&65535;let e=sr[1]&2146435072,n=0;return e>=1089470464?sr[0]>0?e=31744:(e=(e&2080374784)>>16,n=(sr[1]&1048575)>>10):e<=1056964608?(n=1048576+(sr[1]&1048575),n=1048576+(n<<(e>>20)-998)>>21,e=0):(e=e-1056964608>>10,n=(sr[1]&1048575)+512>>10),t|e|n&65535}class ct extends St{}function ft(r){return(t,e,n)=>{if(t.setValid(e,n!=null))return r(t,e,n)}}const Oh=(r,t,e)=>{r[t]=Math.floor(e/864e5)},ka=(r,t,e,n)=>{if(e+1<t.length){const o=Lt(t[e]),i=Lt(t[e+1]);r.set(n.subarray(0,i-o),o)}},Mh=({offset:r,values:t},e,n)=>{const o=r+e;n?t[o>>3]|=1<<o%8:t[o>>3]&=~(1<<o%8)},Re=({values:r},t,e)=>{r[t]=e},fs=({values:r},t,e)=>{r[t]=e},Da=({values:r},t,e)=>{r[t]=Th(e)},Fh=(r,t,e)=>{switch(r.type.precision){case Jt.HALF:return Da(r,t,e);case Jt.SINGLE:case Jt.DOUBLE:return fs(r,t,e)}},Ua=({values:r},t,e)=>{Oh(r,t,e.valueOf())},La=({values:r},t,e)=>{r[t]=BigInt(e)},Nh=({stride:r,values:t},e,n)=>{t.set(n.subarray(0,r),r*e)},Ra=({values:r,valueOffsets:t},e,n)=>ka(r,t,e,n),Ca=({values:r,valueOffsets:t},e,n)=>ka(r,t,e,as(n)),kh=(r,t,e)=>{r.type.unit===le.DAY?Ua(r,t,e):La(r,t,e)},Pa=({values:r},t,e)=>{r[t]=BigInt(e/1e3)},$a=({values:r},t,e)=>{r[t]=BigInt(e)},za=({values:r},t,e)=>{r[t]=BigInt(e*1e3)},ja=({values:r},t,e)=>{r[t]=BigInt(e*1e6)},Dh=(r,t,e)=>{switch(r.type.unit){case at.SECOND:return Pa(r,t,e);case at.MILLISECOND:return $a(r,t,e);case at.MICROSECOND:return za(r,t,e);case at.NANOSECOND:return ja(r,t,e)}},Va=({values:r},t,e)=>{r[t]=e},Wa=({values:r},t,e)=>{r[t]=e},Za=({values:r},t,e)=>{r[t]=e},Ga=({values:r},t,e)=>{r[t]=e},Uh=(r,t,e)=>{switch(r.type.unit){case at.SECOND:return Va(r,t,e);case at.MILLISECOND:return Wa(r,t,e);case at.MICROSECOND:return Za(r,t,e);case at.NANOSECOND:return Ga(r,t,e)}},Lh=({values:r,stride:t},e,n)=>{r.set(n.subarray(0,t),t*e)},Rh=(r,t,e)=>{const n=r.children[0],o=r.valueOffsets,i=fe.getVisitFn(n);if(Array.isArray(e))for(let a=-1,c=o[t],f=o[t+1];c<f;)i(n,c++,e[++a]);else for(let a=-1,c=o[t],f=o[t+1];c<f;)i(n,c++,e.get(++a))},Ch=(r,t,e)=>{const n=r.children[0],{valueOffsets:o}=r,i=fe.getVisitFn(n);let{[t]:a,[t+1]:c}=o;const f=e instanceof Map?e.entries():Object.entries(e);for(const p of f)if(i(n,a,p),++a>=c)break},Ph=(r,t)=>(e,n,o,i)=>n&&e(n,r,t[i]),$h=(r,t)=>(e,n,o,i)=>n&&e(n,r,t.get(i)),zh=(r,t)=>(e,n,o,i)=>n&&e(n,r,t.get(o.name)),jh=(r,t)=>(e,n,o,i)=>n&&e(n,r,t[o.name]),Vh=(r,t,e)=>{const n=r.type.children.map(i=>fe.getVisitFn(i.type)),o=e instanceof Map?zh(t,e):e instanceof Ft?$h(t,e):Array.isArray(e)?Ph(t,e):jh(t,e);r.type.children.forEach((i,a)=>o(n[a],r.children[a],i,a))},Wh=(r,t,e)=>{r.type.mode===re.Dense?Ya(r,t,e):Ja(r,t,e)},Ya=(r,t,e)=>{const n=r.type.typeIdToChildIndex[r.typeIds[t]],o=r.children[n];fe.visit(o,r.valueOffsets[t],e)},Ja=(r,t,e)=>{const n=r.type.typeIdToChildIndex[r.typeIds[t]],o=r.children[n];fe.visit(o,t,e)},Zh=(r,t,e)=>{var n;(n=r.dictionary)===null||n===void 0||n.set(r.values[t],e)},Gh=(r,t,e)=>{r.type.unit===Ee.DAY_TIME?Ha(r,t,e):qa(r,t,e)},Ha=({values:r},t,e)=>{r.set(e.subarray(0,2),2*t)},qa=({values:r},t,e)=>{r[t]=e[0]*12+e[1]%12},Ka=({values:r},t,e)=>{r[t]=e},Xa=({values:r},t,e)=>{r[t]=e},Qa=({values:r},t,e)=>{r[t]=e},tc=({values:r},t,e)=>{r[t]=e},Yh=(r,t,e)=>{switch(r.type.unit){case at.SECOND:return Ka(r,t,e);case at.MILLISECOND:return Xa(r,t,e);case at.MICROSECOND:return Qa(r,t,e);case at.NANOSECOND:return tc(r,t,e)}},Jh=(r,t,e)=>{const{stride:n}=r,o=r.children[0],i=fe.getVisitFn(o);if(Array.isArray(e))for(let a=-1,c=t*n;++a<n;)i(o,c+a,e[a]);else for(let a=-1,c=t*n;++a<n;)i(o,c+a,e.get(a))};ct.prototype.visitBool=ft(Mh);ct.prototype.visitInt=ft(Re);ct.prototype.visitInt8=ft(Re);ct.prototype.visitInt16=ft(Re);ct.prototype.visitInt32=ft(Re);ct.prototype.visitInt64=ft(Re);ct.prototype.visitUint8=ft(Re);ct.prototype.visitUint16=ft(Re);ct.prototype.visitUint32=ft(Re);ct.prototype.visitUint64=ft(Re);ct.prototype.visitFloat=ft(Fh);ct.prototype.visitFloat16=ft(Da);ct.prototype.visitFloat32=ft(fs);ct.prototype.visitFloat64=ft(fs);ct.prototype.visitUtf8=ft(Ca);ct.prototype.visitLargeUtf8=ft(Ca);ct.prototype.visitBinary=ft(Ra);ct.prototype.visitLargeBinary=ft(Ra);ct.prototype.visitFixedSizeBinary=ft(Nh);ct.prototype.visitDate=ft(kh);ct.prototype.visitDateDay=ft(Ua);ct.prototype.visitDateMillisecond=ft(La);ct.prototype.visitTimestamp=ft(Dh);ct.prototype.visitTimestampSecond=ft(Pa);ct.prototype.visitTimestampMillisecond=ft($a);ct.prototype.visitTimestampMicrosecond=ft(za);ct.prototype.visitTimestampNanosecond=ft(ja);ct.prototype.visitTime=ft(Uh);ct.prototype.visitTimeSecond=ft(Va);ct.prototype.visitTimeMillisecond=ft(Wa);ct.prototype.visitTimeMicrosecond=ft(Za);ct.prototype.visitTimeNanosecond=ft(Ga);ct.prototype.visitDecimal=ft(Lh);ct.prototype.visitList=ft(Rh);ct.prototype.visitStruct=ft(Vh);ct.prototype.visitUnion=ft(Wh);ct.prototype.visitDenseUnion=ft(Ya);ct.prototype.visitSparseUnion=ft(Ja);ct.prototype.visitDictionary=ft(Zh);ct.prototype.visitInterval=ft(Gh);ct.prototype.visitIntervalDayTime=ft(Ha);ct.prototype.visitIntervalYearMonth=ft(qa);ct.prototype.visitDuration=ft(Yh);ct.prototype.visitDurationSecond=ft(Ka);ct.prototype.visitDurationMillisecond=ft(Xa);ct.prototype.visitDurationMicrosecond=ft(Qa);ct.prototype.visitDurationNanosecond=ft(tc);ct.prototype.visitFixedSizeList=ft(Jh);ct.prototype.visitMap=ft(Ch);const fe=new ct,de=Symbol.for("parent"),Sr=Symbol.for("rowIndex");class ds{constructor(t,e){return this[de]=t,this[Sr]=e,new Proxy(this,Kh)}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[Sr],e=this[de],n=e.type.children,o={};for(let i=-1,a=n.length;++i<a;)o[n[i].name]=ne.visit(e.children[i],t);return o}toString(){return`{${[...this].map(([t,e])=>`${on(t)}: ${on(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Hh(this[de],this[Sr])}}class Hh{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(ds.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[de]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Sr]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});class qh{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[de].type.children.map(e=>e.name)}has(t,e){return t[de].type.children.some(n=>n.name===e)}getOwnPropertyDescriptor(t,e){if(t[de].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[de].type.children.findIndex(o=>o.name===e);if(n!==-1){const o=ne.visit(t[de].children[n],t[Sr]);return Reflect.set(t,e,o),o}}set(t,e,n){const o=t[de].type.children.findIndex(i=>i.name===e);return o!==-1?(fe.visit(t[de].children[o],t[Sr],n),Reflect.set(t,e,n)):Reflect.has(t,e)||typeof e=="symbol"?Reflect.set(t,e,n):!1}}const Kh=new qh;class nt extends St{}function ut(r){return(t,e)=>t.getValid(e)?r(t,e):null}const Xh=(r,t)=>864e5*r[t],Qh=(r,t)=>null,ec=(r,t,e)=>{if(e+1>=t.length)return null;const n=Lt(t[e]),o=Lt(t[e+1]);return r.subarray(n,o)},tl=({offset:r,values:t},e)=>{const n=r+e;return(t[n>>3]&1<<n%8)!==0},rc=({values:r},t)=>Xh(r,t),nc=({values:r},t)=>Lt(r[t]),He=({stride:r,values:t},e)=>t[r*e],el=({stride:r,values:t},e)=>Na(t[r*e]),ic=({values:r},t)=>r[t],rl=({stride:r,values:t},e)=>t.subarray(r*e,r*(e+1)),sc=({values:r,valueOffsets:t},e)=>ec(r,t,e),oc=({values:r,valueOffsets:t},e)=>{const n=ec(r,t,e);return n!==null?Ri(n):null},nl=({values:r},t)=>r[t],il=({type:r,values:t},e)=>r.precision!==Jt.HALF?t[e]:Na(t[e]),sl=(r,t)=>r.type.unit===le.DAY?rc(r,t):nc(r,t),ac=({values:r},t)=>1e3*Lt(r[t]),cc=({values:r},t)=>Lt(r[t]),uc=({values:r},t)=>aa(r[t],BigInt(1e3)),hc=({values:r},t)=>aa(r[t],BigInt(1e6)),ol=(r,t)=>{switch(r.type.unit){case at.SECOND:return ac(r,t);case at.MILLISECOND:return cc(r,t);case at.MICROSECOND:return uc(r,t);case at.NANOSECOND:return hc(r,t)}},lc=({values:r},t)=>r[t],fc=({values:r},t)=>r[t],dc=({values:r},t)=>r[t],pc=({values:r},t)=>r[t],al=(r,t)=>{switch(r.type.unit){case at.SECOND:return lc(r,t);case at.MILLISECOND:return fc(r,t);case at.MICROSECOND:return dc(r,t);case at.NANOSECOND:return pc(r,t)}},cl=({values:r,stride:t},e)=>ls.decimal(r.subarray(t*e,t*(e+1))),ul=(r,t)=>{const{valueOffsets:e,stride:n,children:o}=r,{[t*n]:i,[t*n+1]:a}=e,f=o[0].slice(i,a-i);return new Ft([f])},hl=(r,t)=>{const{valueOffsets:e,children:n}=r,{[t]:o,[t+1]:i}=e,a=n[0];return new ps(a.slice(o,i-o))},ll=(r,t)=>new ds(r,t),fl=(r,t)=>r.type.mode===re.Dense?yc(r,t):gc(r,t),yc=(r,t)=>{const e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return ne.visit(n,r.valueOffsets[t])},gc=(r,t)=>{const e=r.type.typeIdToChildIndex[r.typeIds[t]],n=r.children[e];return ne.visit(n,t)},dl=(r,t)=>{var e;return(e=r.dictionary)===null||e===void 0?void 0:e.get(r.values[t])},pl=(r,t)=>r.type.unit===Ee.DAY_TIME?mc(r,t):wc(r,t),mc=({values:r},t)=>r.subarray(2*t,2*(t+1)),wc=({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},bc=({values:r},t)=>r[t],_c=({values:r},t)=>r[t],Sc=({values:r},t)=>r[t],Ic=({values:r},t)=>r[t],yl=(r,t)=>{switch(r.type.unit){case at.SECOND:return bc(r,t);case at.MILLISECOND:return _c(r,t);case at.MICROSECOND:return Sc(r,t);case at.NANOSECOND:return Ic(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(Qh);nt.prototype.visitBool=ut(tl);nt.prototype.visitInt=ut(nl);nt.prototype.visitInt8=ut(He);nt.prototype.visitInt16=ut(He);nt.prototype.visitInt32=ut(He);nt.prototype.visitInt64=ut(ic);nt.prototype.visitUint8=ut(He);nt.prototype.visitUint16=ut(He);nt.prototype.visitUint32=ut(He);nt.prototype.visitUint64=ut(ic);nt.prototype.visitFloat=ut(il);nt.prototype.visitFloat16=ut(el);nt.prototype.visitFloat32=ut(He);nt.prototype.visitFloat64=ut(He);nt.prototype.visitUtf8=ut(oc);nt.prototype.visitLargeUtf8=ut(oc);nt.prototype.visitBinary=ut(sc);nt.prototype.visitLargeBinary=ut(sc);nt.prototype.visitFixedSizeBinary=ut(rl);nt.prototype.visitDate=ut(sl);nt.prototype.visitDateDay=ut(rc);nt.prototype.visitDateMillisecond=ut(nc);nt.prototype.visitTimestamp=ut(ol);nt.prototype.visitTimestampSecond=ut(ac);nt.prototype.visitTimestampMillisecond=ut(cc);nt.prototype.visitTimestampMicrosecond=ut(uc);nt.prototype.visitTimestampNanosecond=ut(hc);nt.prototype.visitTime=ut(al);nt.prototype.visitTimeSecond=ut(lc);nt.prototype.visitTimeMillisecond=ut(fc);nt.prototype.visitTimeMicrosecond=ut(dc);nt.prototype.visitTimeNanosecond=ut(pc);nt.prototype.visitDecimal=ut(cl);nt.prototype.visitList=ut(ul);nt.prototype.visitStruct=ut(ll);nt.prototype.visitUnion=ut(fl);nt.prototype.visitDenseUnion=ut(yc);nt.prototype.visitSparseUnion=ut(gc);nt.prototype.visitDictionary=ut(dl);nt.prototype.visitInterval=ut(pl);nt.prototype.visitIntervalDayTime=ut(mc);nt.prototype.visitIntervalYearMonth=ut(wc);nt.prototype.visitDuration=ut(yl);nt.prototype.visitDurationSecond=ut(bc);nt.prototype.visitDurationMillisecond=ut(_c);nt.prototype.visitDurationMicrosecond=ut(Sc);nt.prototype.visitDurationNanosecond=ut(Ic);nt.prototype.visitFixedSizeList=ut(gl);nt.prototype.visitMap=ut(hl);const ne=new nt,pr=Symbol.for("keys"),Ir=Symbol.for("vals"),yr=Symbol.for("kKeysAsStrings"),Vi=Symbol.for("_kKeysAsStrings");class ps{constructor(t){return this[pr]=new Ft([t.children[0]]).memoize(),this[Ir]=t.children[1],new Proxy(this,new wl)}get[yr](){return this[Vi]||(this[Vi]=Array.from(this[pr].toArray(),String))}[Symbol.iterator](){return new ml(this[pr],this[Ir])}get size(){return this[pr].length}toArray(){return Object.values(this.toJSON())}toJSON(){const t=this[pr],e=this[Ir],n={};for(let o=-1,i=t.length;++o<i;)n[t.get(o)]=ne.visit(e,o);return n}toString(){return`{${[...this].map(([t,e])=>`${on(t)}: ${on(e)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}}class ml{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 wl{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[yr]}has(t,e){return t[yr].includes(e)}getOwnPropertyDescriptor(t,e){if(t[yr].indexOf(e)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,e){if(Reflect.has(t,e))return t[e];const n=t[yr].indexOf(e);if(n!==-1){const o=ne.visit(Reflect.get(t,Ir),n);return Reflect.set(t,e,o),o}}set(t,e,n){const o=t[yr].indexOf(e);return o!==-1?(fe.visit(Reflect.get(t,Ir),o,n),Reflect.set(t,e,n)):Reflect.has(t,e)?Reflect.set(t,e,n):!1}}Object.defineProperties(ps.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[pr]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Ir]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Vi]:{writable:!0,enumerable:!1,configurable:!1,value:null}});let no;function Bc(r,t,e,n){const{length:o=0}=r;let i=typeof t!="number"?0:t,a=typeof e!="number"?o:e;return i<0&&(i=(i%o+o)%o),a<0&&(a=(a%o+o)%o),a<i&&(no=i,i=a,a=no),a>o&&(a=o),n?n(r,i,a):[i,a]}const ys=(r,t)=>r<0?t+r:r,io=r=>r!==r;function Fr(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?yh(r,e):!1:r instanceof Map?_l(r):Array.isArray(r)?bl(r):r instanceof Ft?Sl(r):Il(r,!0)}function bl(r){const t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Fr(r[e]);return yi(t)}function _l(r){let t=-1;const e=[];for(const n of r.values())e[++t]=Fr(n);return yi(e)}function Sl(r){const t=[];for(let e=-1,n=r.length;++e<n;)t[e]=Fr(r.get(e));return yi(t)}function Il(r,t=!1){const e=Object.keys(r);if(!t&&e.length===0)return()=>!1;const n=[];for(let o=-1,i=e.length;++o<i;)n[o]=Fr(r[e[o]]);return yi(n,e)}function yi(r,t){return e=>{if(!e||typeof e!="object")return!1;switch(e.constructor){case Array:return Bl(r,e);case Map:return so(r,e,e.keys());case ps:case ds:case Object:case void 0:return so(r,e,t||Object.keys(e))}return e instanceof Ft?vl(r,e):!1}}function Bl(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 vl(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 so(r,t,e){const n=e[Symbol.iterator](),o=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 f=i.next(),p=n.next(),g=o.next();for(;a<c&&!p.done&&!g.done&&!f.done&&!(p.value!==g.value||!r[a](f.value));++a,p=n.next(),g=o.next(),f=i.next());return a===c&&p.done&&g.done&&f.done?!0:(n.return&&n.return(),o.return&&o.return(),i.return&&i.return(),!1)}function vc(r,t,e,n){return(e&1<<n)!==0}function Al(r,t,e,n){return(e&1<<n)>>n}function oo(r,t,e){const n=e.byteLength+7&-8;if(r>0||e.byteLength<n){const o=new Uint8Array(n);return o.set(r%8===0?e.subarray(r>>3):Wi(new gs(e,r,t,null,vc)).subarray(0,n)),o}return e}function Wi(r){const t=[];let e=0,n=0,o=0;for(const a of r)a&&(o|=1<<n),++n===8&&(t[e++]=o,o=n=0);(e===0||n>0)&&(t[e++]=o);const i=new Uint8Array(t.length+7&-8);return i.set(t),i}class gs{constructor(t,e,n,o,i){this.bytes=t,this.length=n,this.context=o,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 Zi(r,t,e){if(e-t<=0)return 0;if(e-t<8){let i=0;for(const a of new gs(r,t,e-t,r,Al))i+=a;return i}const n=e>>3<<3,o=t+(t%8===0?0:8-t%8);return Zi(r,t,o)+Zi(r,n,e)+xl(r,o>>3,n-o>>3)}function xl(r,t,e){let n=0,o=Math.trunc(t);const i=new DataView(r.buffer,r.byteOffset,r.byteLength),a=e===void 0?r.byteLength:o+e;for(;a-o>=4;)n+=Ai(i.getUint32(o)),o+=4;for(;a-o>=2;)n+=Ai(i.getUint16(o)),o+=2;for(;a-o>=1;)n+=Ai(i.getUint8(o)),o+=1;return n}function Ai(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 El=-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:o,typeIds:i}=this;return e&&(t+=e.byteLength),n&&(t+=n.byteLength),o&&(t+=o.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,o)=>n+o.nullCount,0);let t=this._nullCount,e;return t<=El&&(e=this.nullBitmap)&&(this._nullCount=t=e.length===0?0:this.length-Zi(e,this.offset,this.offset+this.length)),t}constructor(t,e,n,o,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(o||0,-1));let f;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=Fe(t),i&&((f=i[0])&&(this.valueOffsets=f),(f=i[1])&&(this.values=f),(f=i[2])&&(this.nullBitmap=f),(f=i[3])&&(this.typeIds=f)))}getValid(t){const{type:e}=this;if(tt.isUnion(e)){const n=e,o=this.children[n.typeIdToChildIndex[this.typeIds[t]]],i=n.mode===re.Dense?this.valueOffsets[t]:t;return o.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:o}=this;if(tt.isUnion(o)){const i=o,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,f=a+t,p=1<<f%8,g=f>>3;(!i||i.byteLength<=g)&&(i=new Uint8Array((a+c+63&-64)>>3).fill(255),this.nullCount>0?(i.set(oo(a,c,this.nullBitmap),0),Object.assign(this,{nullBitmap:i})):Object.assign(this,{nullBitmap:i,_nullCount:0}));const v=i[g];n=(v&p)!==0,i[g]=e?v|p:v&~p}return n!==!!e&&(this._nullCount=this.nullCount+(e?-1:1)),e}clone(t=this.type,e=this.offset,n=this.length,o=this._nullCount,i=this,a=this.children){return new Et(t,e,n,o,i,a,this.dictionary)}slice(t,e){const{stride:n,typeId:o,children:i}=this,a=+(this._nullCount===0)-1,c=o===16?n:1,f=this._sliceBuffers(t,e,n,o);return this.clone(this.type,this.offset+t,e,a,f,i.length===0||this.valueOffsets?i:this._sliceChildren(i,c*t,c*e))}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===x.Null)return this.clone(this.type,0,t,0);const{length:e,nullCount:n}=this,o=new Uint8Array((t+63&-64)>>3).fill(255,0,e>>3);o[e>>3]=(1<<e-(e&-8))-1,n>0&&o.set(oo(this.offset,e,this.nullBitmap),0);const i=this.buffers;return i[Me.VALIDITY]=o,this.clone(this.type,0,t,n+(t-e),i)}_sliceBuffers(t,e,n,o){let i;const{buffers:a}=this;return(i=a[Me.TYPE])&&(a[Me.TYPE]=i.subarray(t,t+e)),(i=a[Me.OFFSET])&&(a[Me.OFFSET]=i.subarray(t,t+e+1))||(i=a[Me.DATA])&&(a[Me.DATA]=o===6?i:i.subarray(n*t,n*(t+e))),a}_sliceChildren(t,e,n){return t.map(o=>o.slice(e,n))}}Et.prototype.children=Object.freeze([]);class nn extends St{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){const{["type"]:e,["offset"]:n=0,["length"]:o=0}=t;return new Et(e,n,o,o)}visitBool(t){const{["type"]:e,["offset"]:n=0}=t,o=It(t.nullBitmap),i=Ot(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,o])}visitInt(t){const{["type"]:e,["offset"]:n=0}=t,o=It(t.nullBitmap),i=Ot(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,o])}visitFloat(t){const{["type"]:e,["offset"]:n=0}=t,o=It(t.nullBitmap),i=Ot(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,o])}visitUtf8(t){const{["type"]:e,["offset"]:n=0}=t,o=It(t.data),i=It(t.nullBitmap),a=kr(t.valueOffsets),{["length"]:c=a.length-1,["nullCount"]:f=t.nullBitmap?-1:0}=t;return new Et(e,n,c,f,[a,o,i])}visitLargeUtf8(t){const{["type"]:e,["offset"]:n=0}=t,o=It(t.data),i=It(t.nullBitmap),a=Gs(t.valueOffsets),{["length"]:c=a.length-1,["nullCount"]:f=t.nullBitmap?-1:0}=t;return new Et(e,n,c,f,[a,o,i])}visitBinary(t){const{["type"]:e,["offset"]:n=0}=t,o=It(t.data),i=It(t.nullBitmap),a=kr(t.valueOffsets),{["length"]:c=a.length-1,["nullCount"]:f=t.nullBitmap?-1:0}=t;return new Et(e,n,c,f,[a,o,i])}visitLargeBinary(t){const{["type"]:e,["offset"]:n=0}=t,o=It(t.data),i=It(t.nullBitmap),a=Gs(t.valueOffsets),{["length"]:c=a.length-1,["nullCount"]:f=t.nullBitmap?-1:0}=t;return new Et(e,n,c,f,[a,o,i])}visitFixedSizeBinary(t){const{["type"]:e,["offset"]:n=0}=t,o=It(t.nullBitmap),i=Ot(e.ArrayType,t.data),{["length"]:a=i.length/Fe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Et(e,n,a,c,[void 0,i,o])}visitDate(t){const{["type"]:e,["offset"]:n=0}=t,o=It(t.nullBitmap),i=Ot(e.ArrayType,t.data),{["length"]:a=i.length/Fe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Et(e,n,a,c,[void 0,i,o])}visitTimestamp(t){const{["type"]:e,["offset"]:n=0}=t,o=It(t.nullBitmap),i=Ot(e.ArrayType,t.data),{["length"]:a=i.length/Fe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Et(e,n,a,c,[void 0,i,o])}visitTime(t){const{["type"]:e,["offset"]:n=0}=t,o=It(t.nullBitmap),i=Ot(e.ArrayType,t.data),{["length"]:a=i.length/Fe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Et(e,n,a,c,[void 0,i,o])}visitDecimal(t){const{["type"]:e,["offset"]:n=0}=t,o=It(t.nullBitmap),i=Ot(e.ArrayType,t.data),{["length"]:a=i.length/Fe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Et(e,n,a,c,[void 0,i,o])}visitList(t){const{["type"]:e,["offset"]:n=0,["child"]:o}=t,i=It(t.nullBitmap),a=kr(t.valueOffsets),{["length"]:c=a.length-1,["nullCount"]:f=t.nullBitmap?-1:0}=t;return new Et(e,n,c,f,[a,void 0,i],[o])}visitStruct(t){const{["type"]:e,["offset"]:n=0,["children"]:o=[]}=t,i=It(t.nullBitmap),{length:a=o.reduce((f,{length:p})=>Math.max(f,p),0),nullCount:c=t.nullBitmap?-1:0}=t;return new Et(e,n,a,c,[void 0,void 0,i],o)}visitUnion(t){const{["type"]:e,["offset"]:n=0,["children"]:o=[]}=t,i=Ot(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],o);const f=kr(t.valueOffsets);return new Et(e,n,a,c,[f,void 0,void 0,i],o)}visitDictionary(t){const{["type"]:e,["offset"]:n=0}=t,o=It(t.nullBitmap),i=Ot(e.indices.ArrayType,t.data),{["dictionary"]:a=new Ft([new nn().visit({type:e.dictionary})])}=t,{["length"]:c=i.length,["nullCount"]:f=t.nullBitmap?-1:0}=t;return new Et(e,n,c,f,[void 0,i,o],[],a)}visitInterval(t){const{["type"]:e,["offset"]:n=0}=t,o=It(t.nullBitmap),i=Ot(e.ArrayType,t.data),{["length"]:a=i.length/Fe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Et(e,n,a,c,[void 0,i,o])}visitDuration(t){const{["type"]:e,["offset"]:n=0}=t,o=It(t.nullBitmap),i=Ot(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,o])}visitFixedSizeList(t){const{["type"]:e,["offset"]:n=0,["child"]:o=new nn().visit({type:e.valueType})}=t,i=It(t.nullBitmap),{["length"]:a=o.length/Fe(e),["nullCount"]:c=t.nullBitmap?-1:0}=t;return new Et(e,n,a,c,[void 0,void 0,i],[o])}visitMap(t){const{["type"]:e,["offset"]:n=0,["child"]:o=new nn().visit({type:e.childType})}=t,i=It(t.nullBitmap),a=kr(t.valueOffsets),{["length"]:c=a.length-1,["nullCount"]:f=t.nullBitmap?-1:0}=t;return new Et(e,n,c,f,[a,void 0,i],[o])}}const Tl=new nn;function _t(r){return Tl.visit(r)}class ao{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 Ol(r){return r.some(t=>t.nullable)}function Ac(r){return r.reduce((t,e)=>t+e.nullCount,0)}function xc(r){return r.reduce((t,e,n)=>(t[n+1]=t[n]+e.length,t),new Uint32Array(r.length+1))}function Ec(r,t,e,n){const o=[];for(let i=-1,a=r.length;++i<a;){const c=r[i],f=t[i],{length:p}=c;if(f>=n)break;if(e>=f+p)continue;if(f>=e&&f+p<=n){o.push(c);continue}const g=Math.max(0,e-f),v=Math.min(n-f,p);o.push(c.slice(g,v-g))}return o.length===0&&o.push(r[0].slice(0,0)),o}function ms(r,t,e,n){let o=0,i=0,a=t.length-1;do{if(o>=a-1)return e<t[a]?n(r,o,e-t[o]):null;i=o+Math.trunc((a-o)*.5),e<t[i]?a=i:o=i}while(o<a)}function ws(r,t){return r.getValid(t)}function Xn(r){function t(e,n,o){return r(e[n],o)}return function(e){const n=this.data;return ms(n,this._offsets,e,t)}}function Tc(r){let t;function e(n,o,i){return r(n[o],i,t)}return function(n,o){const i=this.data;t=o;const a=ms(i,this._offsets,n,e);return t=void 0,a}}function Oc(r){let t;function e(n,o,i){let a=i,c=0,f=0;for(let p=o-1,g=n.length;++p<g;){const v=n[p];if(~(c=r(v,t,a)))return f+c;a=0,f+=v.length}return-1}return function(n,o){t=n;const i=this.data,a=typeof o!="number"?e(i,0,0):ms(i,this._offsets,o,e);return t=void 0,a}}class it extends St{}function Ml(r,t){return t===null&&r.length>0?0:-1}function Fl(r,t){const{nullBitmap:e}=r;if(!e||r.nullCount<=0)return-1;let n=0;for(const o of new gs(e,r.offset+(t||0),r.length,e,vc)){if(!o)return n;++n}return-1}function dt(r,t,e){if(t===void 0)return-1;if(t===null)switch(r.typeId){case x.Union:break;case x.Dictionary:break;default:return Fl(r,e)}const n=ne.getVisitFn(r),o=Fr(t);for(let i=(e||0)-1,a=r.length;++i<a;)if(o(n(r,i)))return i;return-1}function Mc(r,t,e){const n=ne.getVisitFn(r),o=Fr(t);for(let i=(e||0)-1,a=r.length;++i<a;)if(o(n(r,i)))return i;return-1}it.prototype.visitNull=Ml;it.prototype.visitBool=dt;it.prototype.visitInt=dt;it.prototype.visitInt8=dt;it.prototype.visitInt16=dt;it.prototype.visitInt32=dt;it.prototype.visitInt64=dt;it.prototype.visitUint8=dt;it.prototype.visitUint16=dt;it.prototype.visitUint32=dt;it.prototype.visitUint64=dt;it.prototype.visitFloat=dt;it.prototype.visitFloat16=dt;it.prototype.visitFloat32=dt;it.prototype.visitFloat64=dt;it.prototype.visitUtf8=dt;it.prototype.visitLargeUtf8=dt;it.prototype.visitBinary=dt;it.prototype.visitLargeBinary=dt;it.prototype.visitFixedSizeBinary=dt;it.prototype.visitDate=dt;it.prototype.visitDateDay=dt;it.prototype.visitDateMillisecond=dt;it.prototype.visitTimestamp=dt;it.prototype.visitTimestampSecond=dt;it.prototype.visitTimestampMillisecond=dt;it.prototype.visitTimestampMicrosecond=dt;it.prototype.visitTimestampNanosecond=dt;it.prototype.visitTime=dt;it.prototype.visitTimeSecond=dt;it.prototype.visitTimeMillisecond=dt;it.prototype.visitTimeMicrosecond=dt;it.prototype.visitTimeNanosecond=dt;it.prototype.visitDecimal=dt;it.prototype.visitList=dt;it.prototype.visitStruct=dt;it.prototype.visitUnion=dt;it.prototype.visitDenseUnion=Mc;it.prototype.visitSparseUnion=Mc;it.prototype.visitDictionary=dt;it.prototype.visitInterval=dt;it.prototype.visitIntervalDayTime=dt;it.prototype.visitIntervalYearMonth=dt;it.prototype.visitDuration=dt;it.prototype.visitDurationSecond=dt;it.prototype.visitDurationMillisecond=dt;it.prototype.visitDurationMicrosecond=dt;it.prototype.visitDurationNanosecond=dt;it.prototype.visitFixedSizeList=dt;it.prototype.visitMap=dt;const Qn=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 ao(r.data.length,n=>{const o=r.data[n];return o.values.subarray(0,o.length)[Symbol.iterator]()});let e=0;return new ao(r.data.length,n=>{const i=r.data[n].length,a=r.slice(e,e+i);return e+=i,new Nl(a)})}class Nl{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 bs=new st;var Fc;const Nc={},kc={};class Ft{constructor(t){var e,n,o;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:f,indexOf:p}=Nc[a.typeId],g=i[0];this.isValid=v=>ws(g,v),this.get=v=>c(g,v),this.set=(v,C)=>f(g,v,C),this.indexOf=v=>p(g,v),this._offsets=[0,g.length];break}default:Object.setPrototypeOf(this,kc[a.typeId]),this._offsets=xc(i);break}this.data=i,this.type=a,this.stride=Fe(a),this.numChildren=(o=(n=a.children)===null||n===void 0?void 0:n.length)!==null&&o!==void 0?o:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,e)=>t+e.byteLength,0)}get nullable(){return Ol(this.data)}get nullCount(){return Ac(this.data)}get ArrayType(){return this.type.ArrayType}get[Symbol.toStringTag](){return`${this.VectorName}<${this.type[Symbol.toStringTag]}>`}get VectorName(){return`${x[this.type.typeId]}Vector`}isValid(t){return!1}get(t){return null}at(t){return this.get(ys(t,this.length))}set(t,e){}indexOf(t,e){return-1}includes(t,e){return this.indexOf(t,e)>-1}[Symbol.iterator](){return bs.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(Bc(this,t,e,({data:n,_offsets:o},i,a)=>Ec(n,o,i,a)))}toJSON(){return[...this]}toArray(){const{type:t,data:e,length:n,stride:o,ArrayType:i}=this;switch(t.typeId){case x.Int:case x.Float:case x.Decimal:case x.Time:case x.Timestamp:switch(e.length){case 0:return new i;case 1:return e[0].values.subarray(0,n*o);default:return e.reduce((a,{values:c,length:f})=>(a.array.set(c.subarray(0,f*o),a.offset),a.offset+=f*o,a),{array:new i(n*o),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 ti(this.data[0].dictionary),e=this.data.map(n=>{const o=n.clone();return o.dictionary=t,o});return new Ft(e)}return new ti(this)}unmemoize(){if(tt.isDictionary(this.type)&&this.isMemoized){const t=this.data[0].dictionary.unmemoize(),e=this.data.map(n=>{const o=n.clone();return o.dictionary=t,o});return new Ft(e)}return this}}Fc=Symbol.toStringTag;Ft[Fc]=(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(x).map(e=>x[e]).filter(e=>typeof e=="number"&&e!==x.NONE);for(const e of t){const n=ne.getVisitFnByTypeId(e),o=fe.getVisitFnByTypeId(e),i=Qn.getVisitFnByTypeId(e);Nc[e]={get:n,set:o,indexOf:i},kc[e]=Object.create(r,{isValid:{value:Xn(ws)},get:{value:Xn(ne.getVisitFnByTypeId(e))},set:{value:Tc(fe.getVisitFnByTypeId(e))},indexOf:{value:Oc(Qn.getVisitFnByTypeId(e))}})}return"Vector"})(Ft.prototype);class ti extends Ft{constructor(t){super(t.data);const e=this.get,n=this.set,o=this.slice,i=new Array(this.length);Object.defineProperty(this,"get",{value(a){const c=i[a];if(c!==void 0)return c;const f=e.call(this,a);return i[a]=f,f}}),Object.defineProperty(this,"set",{value(a,c){n.call(this,a,c),i[a]=c}}),Object.defineProperty(this,"slice",{value:(a,c)=>new ti(o.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 Gi{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,o){return t.prep(8,24),t.writeInt64(BigInt(o??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()+At),(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 _e).__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 Gi).__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 Gi).__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,o=zt.V5){this.fields=t||[],this.metadata=e||new Map,n||(n=Yi(this.fields)),this.dictionaries=n,this.metadataVersion=o}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(o=>e.has(o.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],o=mn(mn(new Map,this.metadata),e.metadata),i=e.fields.filter(c=>{const f=n.findIndex(p=>p.name===c.name);return~f?(n[f]=c.clone({metadata:mn(mn(new Map,n[f].metadata),c.metadata)}))&&!1:!0}),a=Yi(i,new Map);return new vt([...n,...i],o,new Map([...this.dictionaries,...a]))}}vt.prototype.fields=null;vt.prototype.metadata=null;vt.prototype.dictionaries=null;class Rt{static new(...t){let[e,n,o,i]=t;return t[0]&&typeof t[0]=="object"&&({name:e}=t[0],n===void 0&&(n=t[0].type),o===void 0&&(o=t[0].nullable),i===void 0&&(i=t[0].metadata)),new Rt(`${e}`,n,o,i)}constructor(t,e,n=!1,o){this.name=t,this.type=e,this.nullable=n,this.metadata=o||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[e,n,o,i]=t;return!t[0]||typeof t[0]!="object"?[e=this.name,n=this.type,o=this.nullable,i=this.metadata]=t:{name:e=this.name,type:n=this.type,nullable:o=this.nullable,metadata:i=this.metadata}=t[0],Rt.new(e,n,o,i)}}Rt.prototype.type=null;Rt.prototype.name=null;Rt.prototype.nullable=null;Rt.prototype.metadata=null;function mn(r,t){return new Map([...r||new Map,...t||new Map])}function Yi(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&&Yi(i.children,t)}return t}var kl=na,Dl=vr;class _s{static decode(t){t=new Dl(It(t));const e=ie.getRootAsFooter(t),n=vt.decode(e.schema(),new Map,e.version());return new Ul(n,e)}static encode(t){const e=new kl,n=vt.encode(e,t.schema);ie.startRecordBatchesVector(e,t.numRecordBatches);for(const a of[...t.recordBatches()].slice().reverse())Er.encode(e,a);const o=e.endVector();ie.startDictionariesVector(e,t.numDictionaries);for(const a of[...t.dictionaryBatches()].slice().reverse())Er.encode(e,a);const i=e.endVector();return ie.startFooter(e),ie.addSchema(e,n),ie.addVersion(e,zt.V5),ie.addRecordBatches(e,o),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,o){this.schema=t,this.version=e,n&&(this._recordBatches=n),o&&(this._dictionaryBatches=o)}*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 Ul extends _s{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 Er.decode(e)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){const e=this._footer.dictionaries(t);if(e)return Er.decode(e)}return null}}class Er{static decode(t){return new Er(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,e){const{metaDataLength:n}=e,o=BigInt(e.offset),i=BigInt(e.bodyLength);return Gi.createBlock(t,o,n,i)}constructor(t,e,n){this.metaDataLength=t,this.offset=Lt(n),this.bodyLength=Lt(e)}}const Ct=Object.freeze({done:!0,value:void 0});class co{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}}class Dc{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 Ll extends Dc{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(Ct);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return ae.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return ae.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return gt(this,void 0,void 0,function*(){return yield this.abort(t),Ct})}return(t){return gt(this,void 0,void 0,function*(){return yield this.close(),Ct})}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(Ct)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}class Rl extends Ll{write(t){if((t=It(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?Ri(this.toUint8Array(!0)):this.toUint8Array(!1).then(Ri)}toUint8Array(t=!1){return t?xe(this._values)[0]:gt(this,void 0,void 0,function*(){var e,n,o,i;const a=[];let c=0;try{for(var f=!0,p=wr(this),g;g=yield p.next(),e=g.done,!e;f=!0){i=g.value,f=!1;const v=i;a.push(v),c+=v.byteLength}}catch(v){n={error:v}}finally{try{!f&&!e&&(o=p.return)&&(yield o.call(p))}finally{if(n)throw n.error}}return xe(a,c)[0]})}}class ei{constructor(t){t&&(this.source=new Cl(ae.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 Tr{constructor(t){t instanceof Tr?this.source=t.source:t instanceof Rl?this.source=new Ke(ae.fromAsyncIterable(t)):ta(t)?this.source=new Ke(ae.fromNodeStream(t)):us(t)?this.source=new Ke(ae.fromDOMStream(t)):Xo(t)?this.source=new Ke(ae.fromDOMStream(t.body)):pi(t)?this.source=new Ke(ae.fromIterable(t)):sn(t)?this.source=new Ke(ae.fromAsyncIterable(t)):cs(t)&&(this.source=new Ke(ae.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 Cl{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)||Ct)}return(t){return Object.create(this.source.return&&this.source.return(t)||Ct)}}class Ke{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))||Ct;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))||Ct;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(e)})}}class uo extends ei{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:o}=this;return e&&o<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,o+Math.min(n-o,t)),e.subarray(o,this.position)):null}readAt(t,e){const n=this.buffer,o=Math.min(this.size,t+e);return n?n.subarray(t,o):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 ri extends Tr{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:o}=this;if(e&&o<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let i=o,a=0,c=0;const f=Math.min(n,i+Math.min(n-i,t)),p=new Uint8Array(Math.max(0,(this.position=f)-i));for(;(i+=c)<f&&(a+=c)<p.byteLength;)({bytesRead:c}=yield e.read(p,a,p.byteLength-a,i));return p}return null})}readAt(t,e){return gt(this,void 0,void 0,function*(){this._pending&&(yield this._pending);const{_handle:n,size:o}=this;if(n&&t+e<o){const i=Math.min(o,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 Pl=65536;function mr(r){return r<0&&(r=4294967295+r+1),`0x${r.toString(16)}`}const Or=8,Ss=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8];class Uc{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 o=e[3]*n[3];this.buffer[0]=o&65535;let i=o>>>16;return o=e[2]*n[3],i+=o,o=e[3]*n[2]>>>0,i+=o,this.buffer[0]+=i<<16,this.buffer[1]=i>>>0<o?Pl: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`${mr(this.buffer[1])} ${mr(this.buffer[0])}`}}class Tt extends Uc{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,o=new Tt(e);for(let i=0;i<n;){const a=Or<n-i?Or:n-i,c=new Tt(new Uint32Array([Number.parseInt(t.slice(i,i+a),10),0])),f=new Tt(new Uint32Array([Ss[a],0]));o.times(f),o.plus(c),i+=a}return o}static convertArray(t){const e=new Uint32Array(t.length*2);for(let n=-1,o=t.length;++n<o;)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 Uc{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("-"),o=t.length,i=new te(e);for(let a=n?1:0;a<o;){const c=Or<o-a?Or:o-a,f=new te(new Uint32Array([Number.parseInt(t.slice(a,a+c),10),0])),p=new te(new Uint32Array([Ss[c],0]));i.times(p),i.plus(f),a+=c}return n?i.negate():i}static convertArray(t){const e=new Uint32Array(t.length*2);for(let n=-1,o=t.length;++n<o;)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 Se{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])),o=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])),f=new Tt(new Uint32Array([t.buffer[1],0])),p=new Tt(new Uint32Array([t.buffer[0],0]));let g=Tt.multiply(i,p);this.buffer[0]=g.low();const v=new Tt(new Uint32Array([g.high(),0]));return g=Tt.multiply(o,p),v.plus(g),g=Tt.multiply(i,f),v.plus(g),this.buffer[1]=v.low(),this.buffer[3]=v.lessThan(g)?1:0,this.buffer[2]=v.high(),new Tt(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Tt.multiply(n,p)).plus(Tt.multiply(o,f)).plus(Tt.multiply(i,c)),this.buffer[3]+=Tt.multiply(e,p).plus(Tt.multiply(n,f)).plus(Tt.multiply(o,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`${mr(this.buffer[3])} ${mr(this.buffer[2])} ${mr(this.buffer[1])} ${mr(this.buffer[0])}`}static multiply(t,e){return new Se(new Uint32Array(t.buffer)).times(e)}static add(t,e){return new Se(new Uint32Array(t.buffer)).plus(e)}static from(t,e=new Uint32Array(4)){return Se.fromString(typeof t=="string"?t:t.toString(),e)}static fromNumber(t,e=new Uint32Array(4)){return Se.fromString(t.toString(),e)}static fromString(t,e=new Uint32Array(4)){const n=t.startsWith("-"),o=t.length,i=new Se(e);for(let a=n?1:0;a<o;){const c=Or<o-a?Or:o-a,f=new Se(new Uint32Array([Number.parseInt(t.slice(a,a+c),10),0,0,0])),p=new Se(new Uint32Array([Ss[c],0,0,0]));i.times(p),i.plus(f),a+=c}return n?i.negate():i}static convertArray(t){const e=new Uint32Array(t.length*4);for(let n=-1,o=t.length;++n<o;)Se.from(t[n],new Uint32Array(e.buffer,e.byteOffset+4*4*n,4));return e}}class Lc extends St{constructor(t,e,n,o,i=zt.V5){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.bytes=t,this.nodes=e,this.buffers=n,this.dictionaries=o,this.metadataVersion=i}visit(t){return super.visit(t instanceof Rt?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 $l extends Lc{constructor(t,e,n,o,i){super(new Uint8Array(0),e,n,o,i),this.sources=t}readNullBitmap(t,e,{offset:n}=this.nextBufferRange()){return e<=0?new Uint8Array(0):Wi(this.sources[n])}readOffsets(t,{offset:e}=this.nextBufferRange()){return Ot(Uint8Array,Ot(t.OffsetArrayType,this.sources[e]))}readTypeIds(t,{offset:e}=this.nextBufferRange()){return Ot(Uint8Array,Ot(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===le.MILLISECOND?Ot(Uint8Array,te.convertArray(n[e])):tt.isDecimal(t)?Ot(Uint8Array,Se.convertArray(n[e])):tt.isBinary(t)||tt.isLargeBinary(t)||tt.isFixedSizeBinary(t)?zl(n[e]):tt.isBool(t)?Wi(n[e]):tt.isUtf8(t)||tt.isLargeUtf8(t)?as(n[e].join("")):Ot(Uint8Array,Ot(t.ArrayType,n[e].map(o=>+o)))}}function zl(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,o)=>this.compareFields(n,e[o]))}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 nr(r,t){return r===t||Xt(r,t)}function Ce(r,t){return r===t||Xt(r,t)&&r.bitWidth===t.bitWidth&&r.isSigned===t.isSigned}function gi(r,t){return r===t||Xt(r,t)&&r.precision===t.precision}function jl(r,t){return r===t||Xt(r,t)&&r.byteWidth===t.byteWidth}function Is(r,t){return r===t||Xt(r,t)&&r.unit===t.unit}function ln(r,t){return r===t||Xt(r,t)&&r.unit===t.unit&&r.timezone===t.timezone}function fn(r,t){return r===t||Xt(r,t)&&r.unit===t.unit&&r.bitWidth===t.bitWidth}function Vl(r,t){return r===t||Xt(r,t)&&r.children.length===t.children.length&&Je.compareManyFields(r.children,t.children)}function Wl(r,t){return r===t||Xt(r,t)&&r.children.length===t.children.length&&Je.compareManyFields(r.children,t.children)}function Bs(r,t){return r===t||Xt(r,t)&&r.mode===t.mode&&r.typeIds.every((e,n)=>e===t.typeIds[n])&&Je.compareManyFields(r.children,t.children)}function Zl(r,t){return r===t||Xt(r,t)&&r.id===t.id&&r.isOrdered===t.isOrdered&&Je.visit(r.indices,t.indices)&&Je.visit(r.dictionary,t.dictionary)}function vs(r,t){return r===t||Xt(r,t)&&r.unit===t.unit}function dn(r,t){return r===t||Xt(r,t)&&r.unit===t.unit}function Gl(r,t){return r===t||Xt(r,t)&&r.listSize===t.listSize&&r.children.length===t.children.length&&Je.compareManyFields(r.children,t.children)}function Yl(r,t){return r===t||Xt(r,t)&&r.keysSorted===t.keysSorted&&r.children.length===t.children.length&&Je.compareManyFields(r.children,t.children)}ot.prototype.visitNull=nr;ot.prototype.visitBool=nr;ot.prototype.visitInt=Ce;ot.prototype.visitInt8=Ce;ot.prototype.visitInt16=Ce;ot.prototype.visitInt32=Ce;ot.prototype.visitInt64=Ce;ot.prototype.visitUint8=Ce;ot.prototype.visitUint16=Ce;ot.prototype.visitUint32=Ce;ot.prototype.visitUint64=Ce;ot.prototype.visitFloat=gi;ot.prototype.visitFloat16=gi;ot.prototype.visitFloat32=gi;ot.prototype.visitFloat64=gi;ot.prototype.visitUtf8=nr;ot.prototype.visitLargeUtf8=nr;ot.prototype.visitBinary=nr;ot.prototype.visitLargeBinary=nr;ot.prototype.visitFixedSizeBinary=jl;ot.prototype.visitDate=Is;ot.prototype.visitDateDay=Is;ot.prototype.visitDateMillisecond=Is;ot.prototype.visitTimestamp=ln;ot.prototype.visitTimestampSecond=ln;ot.prototype.visitTimestampMillisecond=ln;ot.prototype.visitTimestampMicrosecond=ln;ot.prototype.visitTimestampNanosecond=ln;ot.prototype.visitTime=fn;ot.prototype.visitTimeSecond=fn;ot.prototype.visitTimeMillisecond=fn;ot.prototype.visitTimeMicrosecond=fn;ot.prototype.visitTimeNanosecond=fn;ot.prototype.visitDecimal=nr;ot.prototype.visitList=Vl;ot.prototype.visitStruct=Wl;ot.prototype.visitUnion=Bs;ot.prototype.visitDenseUnion=Bs;ot.prototype.visitSparseUnion=Bs;ot.prototype.visitDictionary=Zl;ot.prototype.visitInterval=vs;ot.prototype.visitIntervalDayTime=vs;ot.prototype.visitIntervalYearMonth=vs;ot.prototype.visitDuration=dn;ot.prototype.visitDurationSecond=dn;ot.prototype.visitDurationMillisecond=dn;ot.prototype.visitDurationMicrosecond=dn;ot.prototype.visitDurationNanosecond=dn;ot.prototype.visitFixedSizeList=Gl;ot.prototype.visitMap=Yl;const Je=new ot;function Jl(r,t){return Je.compareSchemas(r,t)}function xi(r,t){return Hl(r,t.map(e=>e.data.concat()))}function Hl(r,t){const e=[...r.fields],n=[],o={numBatches:t.reduce((v,C)=>Math.max(v,C.length),0)};let i=0,a=0,c=-1;const f=t.length;let p,g=[];for(;o.numBatches-- >0;){for(a=Number.POSITIVE_INFINITY,c=-1;++c<f;)g[c]=p=t[c].shift(),a=Math.min(a,p?p.length:a);Number.isFinite(a)&&(g=ql(e,a,g,t,o),a>0&&(n[i++]=_t({type:new Kt(e),length:a,nullCount:0,children:g.slice()})))}return[r=r.assign(e),n.map(v=>new pe(r,v))]}function ql(r,t,e,n,o){var i;const a=(t+63&-64)>>3;for(let c=-1,f=n.length;++c<f;){const p=e[c],g=p?.length;if(g>=t)g===t?e[c]=p:(e[c]=p.slice(0,t),o.numBatches=Math.max(o.numBatches,n[c].unshift(p.slice(t,g-t))));else{const v=r[c];r[c]=v.clone({nullable:!0}),e[c]=(i=p?._changeLengthAndBackfillNullBitmap(t))!==null&&i!==void 0?i:_t({type:v.type,length:t,nullCount:t,nullBitmap:new Uint8Array(a)})}}return e}var Rc;class he{constructor(...t){var e,n;if(t.length===0)return this.batches=[],this.schema=new vt([]),this._offsets=[0],this;let o,i;t[0]instanceof vt&&(o=t.shift()),t.at(-1)instanceof Uint32Array&&(i=t.pop());const a=f=>{if(f){if(f instanceof pe)return[f];if(f instanceof he)return f.batches;if(f instanceof Et){if(f.type instanceof Kt)return[new pe(new vt(f.type.children),f)]}else{if(Array.isArray(f))return f.flatMap(p=>a(p));if(typeof f[Symbol.iterator]=="function")return[...f].flatMap(p=>a(p));if(typeof f=="object"){const p=Object.keys(f),g=p.map(F=>new Ft([f[F]])),v=o??new vt(p.map((F,T)=>new Rt(String(F),g[T].type,g[T].nullable))),[,C]=xi(v,g);return C.length===0?[new pe(f)]:C}}}return[]},c=t.flatMap(f=>a(f));if(o=(n=o??((e=c[0])===null||e===void 0?void 0:e.schema))!==null&&n!==void 0?n:new vt([]),!(o instanceof vt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(const f of c){if(!(f instanceof pe))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!Jl(o,f.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=o,this.batches=c,this._offsets=i??xc(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=Ac(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(ys(t,this.numRows))}set(t,e){}indexOf(t,e){return-1}[Symbol.iterator](){return this.batches.length>0?bs.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:o})=>o));return new he(e,n.map(o=>new pe(e,o)))}slice(t,e){const n=this.schema;[t,e]=Bc({length:this.numRows},t,e);const o=Ec(this.data,this._offsets,t,e);return new he(n,o.map(i=>new pe(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],o=_t({type:n,length:0,nullCount:0});e.push(o._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(o=>o.name===t),e)}setChildAt(t,e){let n=this.schema,o=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new Ft([_t({type:new Ye,length:this.numRows})]));const i=n.fields.slice(),a=i[t].clone({type:e.type}),c=this.schema.fields.map((f,p)=>this.getChildAt(p));[i[t],c[t]]=[a,e],[n,o]=xi(n,c)}return new he(n,o)}select(t){const e=this.schema.fields.reduce((n,o,i)=>n.set(o.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(o=>o.selectAt(t));return new he(e,n)}assign(t){const e=this.schema.fields,[n,o]=t.schema.fields.reduce((c,f,p)=>{const[g,v]=c,C=e.findIndex(F=>F.name===f.name);return~C?v[C]=p:g.push(p),c},[[],[]]),i=this.schema.assign(t.schema),a=[...e.map((c,f)=>[f,o[f]]).map(([c,f])=>f===void 0?this.getChildAt(c):t.getChildAt(f)),...n.map(c=>t.getChildAt(c))].filter(Boolean);return new he(...xi(i,a))}}Rc=Symbol.toStringTag;he[Rc]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=Xn(ws),r.get=Xn(ne.getVisitFn(x.Struct)),r.set=Tc(fe.getVisitFn(x.Struct)),r.indexOf=Oc(Qn.getVisitFn(x.Struct)),"Table"))(he.prototype);var Cc;let pe=class rn{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]=ho(this.schema,this.data.children);break}case 1:{const[e]=t,{fields:n,children:o,length:i}=Object.keys(e).reduce((f,p,g)=>(f.children[g]=e[p],f.length=Math.max(f.length,e[p].length),f.fields[g]=Rt.new({name:p,type:e[p].type,nullable:!0}),f),{length:0,fields:new Array,children:new Array}),a=new vt(n),c=_t({type:new Kt(n),length:i,children:o,nullCount:0});[this.schema,this.data]=ho(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=Pc(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(ys(t,this.numRows))}set(t,e){return fe.visit(this.data,t,e)}indexOf(t,e){return Qn.visit(this.data,t,e)}[Symbol.iterator](){return bs.visit(new Ft([this.data]))}toArray(){return[...this]}concat(...t){return new he(this.schema,[this,...t])}slice(t,e){const[n]=new Ft([this.data]).slice(t,e).data;return new rn(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(o=>o.name===t),e)}setChildAt(t,e){let n=this.schema,o=this.data;if(t>-1&&t<this.numCols){e||(e=new Ft([_t({type:new Ye,length:this.numRows})]));const i=n.fields.slice(),a=o.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)),o=_t({type:new Kt(i),children:a})}return new rn(n,o)}select(t){const e=this.schema.select(t),n=new Kt(e.fields),o=[];for(const i of t){const a=this.schema.fields.findIndex(c=>c.name===i);~a&&(o[a]=this.data.children[a])}return new rn(e,_t({type:n,length:this.numRows,children:o}))}selectAt(t){const e=this.schema.selectAt(t),n=t.map(i=>this.data.children[i]).filter(Boolean),o=_t({type:new Kt(e.fields),length:this.numRows,children:n});return new rn(e,o)}};Cc=Symbol.toStringTag;pe[Cc]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(pe.prototype);function ho(r,t,e=t.reduce((n,o)=>Math.max(n,o.length),0)){var n;const o=[...r.fields],i=[...t],a=(e+63&-64)>>3;for(const[c,f]of r.fields.entries()){const p=t[c];(!p||p.length!==e)&&(o[c]=f.clone({nullable:!0}),i[c]=(n=p?._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:_t({type:f.type,length:e,nullCount:e,nullBitmap:new Uint8Array(a)}))}return[r.assign(o),_t({type:new Kt(o),length:e,children:i})]}function Pc(r,t,e=new Map){var n,o;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],f=t[i];for(const p of[f,...((o=f?.dictionary)===null||o===void 0?void 0:o.data)||[]])Pc(c.children,p?.children,e);if(tt.isDictionary(c)){const{id:p}=c;if(!e.has(p))f?.dictionary&&e.set(p,f.dictionary);else if(e.get(p)!==f.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return e}class $c extends pe{constructor(t){const e=t.fields.map(o=>_t({type:o.type})),n=_t({type:new Kt(t.fields),nullCount:0,children:e});super(t,n)}}let ze=class be{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 be).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+At),(e||new be).__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,o,i,a){return be.startMessage(t),be.addVersion(t,e),be.addHeaderType(t,n),be.addHeader(t,o),be.addBodyLength(t,i),be.addCustomMetadata(t,a),be.endMessage(t)}};class Kl extends St{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return to.startNull(e),to.endNull(e)}visitInt(t,e){return se.startInt(e),se.addBitWidth(e,t.bitWidth),se.addIsSigned(e,t.isSigned),se.endInt(e)}visitFloat(t,e){return Be.startFloatingPoint(e),Be.addPrecision(e,t.precision),Be.endFloatingPoint(e)}visitBinary(t,e){return Hs.startBinary(e),Hs.endBinary(e)}visitLargeBinary(t,e){return Ks.startLargeBinary(e),Ks.endLargeBinary(e)}visitBool(t,e){return qs.startBool(e),qs.endBool(e)}visitUtf8(t,e){return eo.startUtf8(e),eo.endUtf8(e)}visitLargeUtf8(t,e){return Xs.startLargeUtf8(e),Xs.endLargeUtf8(e)}visitDecimal(t,e){return cr.startDecimal(e),cr.addScale(e,t.scale),cr.addPrecision(e,t.precision),cr.addBitWidth(e,t.bitWidth),cr.endDecimal(e)}visitDate(t,e){return In.startDate(e),In.addUnit(e,t.unit),In.endDate(e)}visitTime(t,e){return ce.startTime(e),ce.addUnit(e,t.unit),ce.addBitWidth(e,t.bitWidth),ce.endTime(e)}visitTimestamp(t,e){const n=t.timezone&&e.createString(t.timezone)||void 0;return ue.startTimestamp(e),ue.addUnit(e,t.unit),n!==void 0&&ue.addTimezone(e,n),ue.endTimestamp(e)}visitInterval(t,e){return ve.startInterval(e),ve.addUnit(e,t.unit),ve.endInterval(e)}visitDuration(t,e){return Bn.startDuration(e),Bn.addUnit(e,t.unit),Bn.endDuration(e)}visitList(t,e){return Qs.startList(e),Qs.endList(e)}visitStruct(t,e){return Xe.startStruct_(e),Xe.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 ke.startDictionaryEncoding(e),ke.addId(e,BigInt(t.id)),ke.addIsOrdered(e,t.isOrdered),n!==void 0&&ke.addIndexType(e,n),ke.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return vn.startFixedSizeBinary(e),vn.addByteWidth(e,t.byteWidth),vn.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return An.startFixedSizeList(e),An.addListSize(e,t.listSize),An.endFixedSizeList(e)}visitMap(t,e){return xn.startMap(e),xn.addKeysSorted(e,t.keysSorted),xn.endMap(e)}}const Ei=new Kl;function Xl(r,t=new Map){return new vt(tf(r,t),Tn(r.metadata),t)}function zc(r){return new me(r.count,jc(r.columns),Vc(r.columns))}function Ql(r){return new Le(zc(r.data),r.id,r.isDelta)}function tf(r,t){return(r.fields||[]).filter(Boolean).map(e=>Rt.fromJSON(e,t))}function lo(r,t){return(r.children||[]).filter(Boolean).map(e=>Rt.fromJSON(e,t))}function jc(r){return(r||[]).reduce((t,e)=>[...t,new Nr(e.count,ef(e.VALIDITY)),...jc(e.children)],[])}function Vc(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){const o=r[e];o.VALIDITY&&t.push(new De(t.length,o.VALIDITY.length)),o.TYPE_ID&&t.push(new De(t.length,o.TYPE_ID.length)),o.OFFSET&&t.push(new De(t.length,o.OFFSET.length)),o.DATA&&t.push(new De(t.length,o.DATA.length)),t=Vc(o.children,t)}return t}function ef(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function rf(r,t){let e,n,o,i,a,c;return!t||!(i=r.dictionary)?(a=po(r,lo(r,t)),o=new Rt(r.name,a,r.nullable,Tn(r.metadata))):t.has(e=i.id)?(n=(n=i.indexType)?fo(n):new un,c=new xr(t.get(e),n,e,i.isOrdered),o=new Rt(r.name,c,r.nullable,Tn(r.metadata))):(n=(n=i.indexType)?fo(n):new un,t.set(e,a=po(r,lo(r,t))),c=new xr(a,n,e,i.isOrdered),o=new Rt(r.name,c,r.nullable,Tn(r.metadata))),o||null}function Tn(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function fo(r){return new tr(r.isSigned,r.bitWidth)}function po(r,t){const e=r.type.name;switch(e){case"NONE":return new Ye;case"null":return new Ye;case"binary":return new Ln;case"largebinary":return new Rn;case"utf8":return new Cn;case"largeutf8":return new Pn;case"bool":return new $n;case"list":return new Yn((t||[])[0]);case"struct":return new Kt(t||[]);case"struct_":return new Kt(t||[])}switch(e){case"int":{const n=r.type;return new tr(n.isSigned,n.bitWidth)}case"floatingpoint":{const n=r.type;return new Un(Jt[n.precision])}case"decimal":{const n=r.type;return new zn(n.scale,n.precision,n.bitWidth)}case"date":{const n=r.type;return new jn(le[n.unit])}case"time":{const n=r.type;return new Vn(at[n.unit],n.bitWidth)}case"timestamp":{const n=r.type;return new Wn(at[n.unit],n.timezone)}case"interval":{const n=r.type;return new Zn(Ee[n.unit])}case"duration":{const n=r.type;return new Gn(at[n.unit])}case"union":{const n=r.type,[o,...i]=(n.mode+"").toLowerCase(),a=o.toUpperCase()+i.join("");return new Jn(re[a],n.typeIds||[],t||[])}case"fixedsizebinary":{const n=r.type;return new Hn(n.byteWidth)}case"fixedsizelist":{const n=r.type;return new qn(n.listSize,(t||[])[0])}case"map":{const n=r.type;return new Kn((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var nf=na,sf=vr;class ye{static fromJSON(t,e){const n=new ye(0,zt.V5,e);return n._createHeader=of(t,e),n}static decode(t){t=new sf(It(t));const e=ze.getRootAsMessage(t),n=e.bodyLength(),o=e.version(),i=e.headerType(),a=new ye(n,o,i);return a._createHeader=af(e,i),a}static encode(t){const e=new nf;let n=-1;return t.isSchema()?n=vt.encode(e,t.header()):t.isRecordBatch()?n=me.encode(e,t.header()):t.isDictionaryBatch()&&(n=Le.encode(e,t.header())),ze.startMessage(e),ze.addVersion(e,zt.V5),ze.addHeader(e,n),ze.addHeaderType(e,t.headerType),ze.addBodyLength(e,BigInt(t.bodyLength)),ze.finishMessageBuffer(e,ze.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof vt)return new ye(0,zt.V5,Bt.Schema,t);if(t instanceof me)return new ye(e,zt.V5,Bt.RecordBatch,t);if(t instanceof Le)return new ye(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,o){this._version=e,this._headerType=n,this.body=new Uint8Array(0),o&&(this._createHeader=()=>o),this._bodyLength=Lt(t)}}class me{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 Le{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 De{constructor(t,e){this.offset=Lt(t),this.length=Lt(e)}}class Nr{constructor(t,e){this.length=Lt(t),this.nullCount=Lt(e)}}function of(r,t){return()=>{switch(t){case Bt.Schema:return vt.fromJSON(r);case Bt.RecordBatch:return me.fromJSON(r);case Bt.DictionaryBatch:return Le.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${Bt[t]}, type: ${t} }`)}}function af(r,t){return()=>{switch(t){case Bt.Schema:return vt.decode(r.header(new _e),new Map,r.version());case Bt.RecordBatch:return me.decode(r.header(new Oe),r.version());case Bt.DictionaryBatch:return Le.decode(r.header(new or),r.version())}throw new Error(`Unrecognized Message type: { name: ${Bt[t]}, type: ${t} }`)}}Rt.encode=wf;Rt.decode=gf;Rt.fromJSON=rf;vt.encode=mf;vt.decode=cf;vt.fromJSON=Xl;me.encode=bf;me.decode=uf;me.fromJSON=zc;Le.encode=_f;Le.decode=hf;Le.fromJSON=Ql;Nr.encode=Sf;Nr.decode=ff;De.encode=If;De.decode=lf;function cf(r,t=new Map,e=zt.V5){const n=yf(r,t);return new vt(n,On(r),t,e)}function uf(r,t=zt.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new me(r.length(),df(r),pf(r,t))}function hf(r,t=zt.V5){return new Le(me.decode(r.data(),t),r.id(),r.isDelta())}function lf(r){return new De(r.offset(),r.length())}function ff(r){return new Nr(r.length(),r.nullCount())}function df(r){const t=[];for(let e,n=-1,o=-1,i=r.nodesLength();++n<i;)(e=r.nodes(n))&&(t[++o]=Nr.decode(e));return t}function pf(r,t){const e=[];for(let n,o=-1,i=-1,a=r.buffersLength();++o<a;)(n=r.buffers(o))&&(t<zt.V4&&(n.bb_pos+=8*(o+1)),e[++i]=De.decode(n));return e}function yf(r,t){const e=[];for(let n,o=-1,i=-1,a=r.fieldsLength();++o<a;)(n=r.fields(o))&&(e[++i]=Rt.decode(n,t));return e}function yo(r,t){const e=[];for(let n,o=-1,i=-1,a=r.childrenLength();++o<a;)(n=r.children(o))&&(e[++i]=Rt.decode(n,t));return e}function gf(r,t){let e,n,o,i,a,c;return!t||!(c=r.dictionary())?(o=mo(r,yo(r,t)),n=new Rt(r.name(),o,r.nullable(),On(r))):t.has(e=Lt(c.id()))?(i=(i=c.indexType())?go(i):new un,a=new xr(t.get(e),i,e,c.isOrdered()),n=new Rt(r.name(),a,r.nullable(),On(r))):(i=(i=c.indexType())?go(i):new un,t.set(e,o=mo(r,yo(r,t))),a=new xr(o,i,e,c.isOrdered()),n=new Rt(r.name(),a,r.nullable(),On(r))),n||null}function On(r){const t=new Map;if(r)for(let e,n,o=-1,i=Math.trunc(r.customMetadataLength());++o<i;)(e=r.customMetadata(o))&&(n=e.key())!=null&&t.set(n,e.value());return t}function go(r){return new tr(r.isSigned(),r.bitWidth())}function mo(r,t){const e=r.typeType();switch(e){case Dt.NONE:return new Ye;case Dt.Null:return new Ye;case Dt.Binary:return new Ln;case Dt.LargeBinary:return new Rn;case Dt.Utf8:return new Cn;case Dt.LargeUtf8:return new Pn;case Dt.Bool:return new $n;case Dt.List:return new Yn((t||[])[0]);case Dt.Struct_:return new Kt(t||[])}switch(e){case Dt.Int:{const n=r.type(new se);return new tr(n.isSigned(),n.bitWidth())}case Dt.FloatingPoint:{const n=r.type(new Be);return new Un(n.precision())}case Dt.Decimal:{const n=r.type(new cr);return new zn(n.scale(),n.precision(),n.bitWidth())}case Dt.Date:{const n=r.type(new In);return new jn(n.unit())}case Dt.Time:{const n=r.type(new ce);return new Vn(n.unit(),n.bitWidth())}case Dt.Timestamp:{const n=r.type(new ue);return new Wn(n.unit(),n.timezone())}case Dt.Interval:{const n=r.type(new ve);return new Zn(n.unit())}case Dt.Duration:{const n=r.type(new Bn);return new Gn(n.unit())}case Dt.Union:{const n=r.type(new ee);return new Jn(n.mode(),n.typeIdsArray()||[],t||[])}case Dt.FixedSizeBinary:{const n=r.type(new vn);return new Hn(n.byteWidth())}case Dt.FixedSizeList:{const n=r.type(new An);return new qn(n.listSize(),(t||[])[0])}case Dt.Map:{const n=r.type(new xn);return new Kn((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${Dt[e]}" (${e})`)}function mf(r,t){const e=t.fields.map(i=>Rt.encode(r,i));_e.startFieldsVector(r,e.length);const n=_e.createFieldsVector(r,e),o=t.metadata&&t.metadata.size>0?_e.createCustomMetadataVector(r,[...t.metadata].map(([i,a])=>{const c=r.createString(`${i}`),f=r.createString(`${a}`);return jt.startKeyValue(r),jt.addKey(r,c),jt.addValue(r,f),jt.endKeyValue(r)})):-1;return _e.startSchema(r),_e.addFields(r,n),_e.addEndianness(r,Bf?Ar.Little:Ar.Big),o!==-1&&_e.addCustomMetadata(r,o),_e.endSchema(r)}function wf(r,t){let e=-1,n=-1,o=-1;const i=t.type;let a=t.typeId;tt.isDictionary(i)?(a=i.dictionary.typeId,o=Ei.visit(i,r),n=Ei.visit(i.dictionary,r)):n=Ei.visit(i,r);const c=(i.children||[]).map(g=>Rt.encode(r,g)),f=oe.createChildrenVector(r,c),p=t.metadata&&t.metadata.size>0?oe.createCustomMetadataVector(r,[...t.metadata].map(([g,v])=>{const C=r.createString(`${g}`),F=r.createString(`${v}`);return jt.startKeyValue(r),jt.addKey(r,C),jt.addValue(r,F),jt.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),oe.startField(r),oe.addType(r,n),oe.addTypeType(r,a),oe.addChildren(r,f),oe.addNullable(r,!!t.nullable),e!==-1&&oe.addName(r,e),o!==-1&&oe.addDictionary(r,o),p!==-1&&oe.addCustomMetadata(r,p),oe.endField(r)}function bf(r,t){const e=t.nodes||[],n=t.buffers||[];Oe.startNodesVector(r,e.length);for(const a of e.slice().reverse())Nr.encode(r,a);const o=r.endVector();Oe.startBuffersVector(r,n.length);for(const a of n.slice().reverse())De.encode(r,a);const i=r.endVector();return Oe.startRecordBatch(r),Oe.addLength(r,BigInt(t.length)),Oe.addNodes(r,o),Oe.addBuffers(r,i),Oe.endRecordBatch(r)}function _f(r,t){const e=me.encode(r,t.data);return or.startDictionaryBatch(r),or.addId(r,BigInt(t.id)),or.addIsDelta(r,t.isDelta),or.addData(r,e),or.endDictionaryBatch(r)}function Sf(r,t){return oa.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function If(r,t){return sa.createBuffer(r,BigInt(t.offset),BigInt(t.length))}const Bf=(()=>{const r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})(),As=r=>`Expected ${Bt[r]} Message in stream, but was null or length 0.`,xs=r=>`Header pointer of flatbuffer-encoded ${Bt[r]} Message is null or length 0.`,Wc=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,Zc=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`;class Gc{constructor(t){this.source=t instanceof ei?t:new ei(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?Ct: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(As(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(Zc(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),o=n?.header();if(t&&!o)throw new Error(xs(e));return o}readMetadataLength(){const t=this.source.read(mi),e=t&&new vr(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){const e=this.source.read(t);if(!e)return Ct;if(e.byteLength<t)throw new Error(Wc(t,e.byteLength));return{done:!1,value:ye.decode(e)}}}class vf{constructor(t,e){this.source=t instanceof Tr?t:Ko(t)?new ri(t,e):new Tr(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?Ct: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(As(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(Zc(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),o=n?.header();if(t&&!o)throw new Error(xs(e));return o})}readMetadataLength(){return gt(this,void 0,void 0,function*(){const t=yield this.source.read(mi),e=t&&new vr(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 Ct;if(e.byteLength<t)throw new Error(Wc(t,e.byteLength));return{done:!1,value:ye.decode(e)}})}}class Af extends Gc{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof co?t:new co(t)}next(){const{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:ye.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:ye.fromJSON(e,Bt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){const e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:ye.fromJSON(e,Bt.RecordBatch)}}return this._body=[],Ct}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((o,i)=>[...o,...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(As(t));return e.value}readSchema(){const t=Bt.Schema,e=this.readMessage(t),n=e?.header();if(!e||!n)throw new Error(xs(t));return n}}const mi=4,Ji="ARROW1",ni=new Uint8Array(Ji.length);for(let r=0;r<Ji.length;r+=1)ni[r]=Ji.codePointAt(r);function Es(r,t=0){for(let e=-1,n=ni.length;++e<n;)if(ni[e]!==r[t+e])return!1;return!0}const pn=ni.length,Yc=pn+mi,xf=pn*2+mi;class Ue extends Dc{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 sn(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 ae.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return ae.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 Ue?t:Ci(t)?Mf(t):Ko(t)?kf(t):sn(t)?gt(this,void 0,void 0,function*(){return yield Ue.from(yield t)}):Xo(t)||us(t)||ta(t)||cs(t)?Nf(new Tr(t)):Ff(new ei(t))}static readAll(t){return t instanceof Ue?t.isSync()?wo(t):bo(t):Ci(t)||ArrayBuffer.isView(t)||pi(t)||qo(t)?wo(t):bo(t)}}class ii extends Ue{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*Sn(wr(this[Symbol.iterator]())))})}}class si extends Ue{constructor(t){super(t),this._impl=t}readAll(){return gt(this,void 0,void 0,function*(){var t,e,n,o;const i=new Array;try{for(var a=!0,c=wr(this),f;f=yield c.next(),t=f.done,!t;a=!0){o=f.value,a=!1;const p=o;i.push(p)}}catch(p){e={error:p}}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 Jc extends ii{constructor(t){super(t),this._impl=t}}class Ef extends si{constructor(t){super(t),this._impl=t}}class Hc{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),o=_t({type:new Kt(this.schema.fields),length:t.length,children:n});return new pe(this.schema,o)}_loadDictionaryBatch(t,e){const{id:n,isDelta:o}=t,{dictionaries:i,schema:a}=this,c=i.get(n),f=a.dictionaries.get(n),p=this._loadVectors(t.data,e,[f]);return(c&&o?c.concat(new Ft(p)):new Ft(p)).memoize()}_loadVectors(t,e,n){return new Lc(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}}class oi extends Hc{constructor(t,e){super(e),this._reader=Ci(t)?new Af(this._handle=t):new Gc(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=Kc(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):Ct}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Ct}next(){if(this.closed)return Ct;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(),o=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,o)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),o=e.readMessageBody(t.bodyLength),i=this._loadDictionaryBatch(n,o);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new $c(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class ai extends Hc{constructor(t,e){super(e),this._reader=new vf(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=Kc(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):Ct})}return(t){return gt(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Ct})}next(){return gt(this,void 0,void 0,function*(){if(this.closed)return Ct;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(),o=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,o)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),o=yield e.readMessageBody(t.bodyLength),i=this._loadDictionaryBatch(n,o);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new $c(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return gt(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}}class qc extends oi{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 uo?t:new uo(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 o=this._reader.readMessage(Bt.RecordBatch);if(o?.isRecordBatch()){const i=o.header(),a=this._reader.readMessageBody(o.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 o=this._reader.readMessage(Bt.DictionaryBatch);if(o?.isDictionaryBatch()){const i=o.header(),a=this._reader.readMessageBody(o.bodyLength),c=this._loadDictionaryBatch(i,a);this.dictionaries.set(i.id,c)}}}_readFooter(){const{_handle:t}=this,e=t.size-Yc,n=t.readInt32(e),o=t.readAt(e-n,n);return _s.decode(o)}_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 Tf extends ai{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,o=e[0]instanceof Map?e.shift():void 0;super(t instanceof ri?t:new ri(t,n),o)}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 o=yield this._reader.readMessage(Bt.RecordBatch);if(o?.isRecordBatch()){const i=o.header(),a=yield this._reader.readMessageBody(o.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 o=yield this._reader.readMessage(Bt.DictionaryBatch);if(o?.isDictionaryBatch()){const i=o.header(),a=yield this._reader.readMessageBody(o.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-Yc,n=yield t.readInt32(e),o=yield t.readAt(e-n,n);return _s.decode(o)})}_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 Of extends oi{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new $l(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}}function Kc(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*wo(r){const t=Ue.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function bo(r){return Ae(this,arguments,function*(){const e=yield wt(Ue.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 Mf(r){return new ii(new Of(r))}function Ff(r){const t=r.peek(pn+7&-8);return t&&t.byteLength>=4?Es(t)?new Jc(new qc(r.read())):new ii(new oi(r)):new ii(new oi(function*(){}()))}function Nf(r){return gt(this,void 0,void 0,function*(){const t=yield r.peek(pn+7&-8);return t&&t.byteLength>=4?Es(t)?new Jc(new qc(yield r.read())):new si(new ai(r)):new si(new ai(function(){return Ae(this,arguments,function*(){})}()))})}function kf(r){return gt(this,void 0,void 0,function*(){const{size:t}=yield r.stat(),e=new ri(r,t);return t>=xf&&Es(yield e.readAt(0,pn+7&-8))?new Ef(new Tf(e)):new si(new ai(e))})}function Xc(r){const t=Ue.from(r);return sn(t)?t.then(e=>Xc(e)):t.isAsync()?t.readAll().then(e=>new he(e)):new he(t.readAll())}function Ts(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Ti={},Dr={},Oi={},Ur={},_o;function Qc(){if(_o)return Ur;_o=1,Ur.byteLength=c,Ur.toByteArray=p,Ur.fromByteArray=C;for(var r=[],t=[],e=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,i=n.length;o<i;++o)r[o]=n[o],t[n.charCodeAt(o)]=o;t[45]=62,t[95]=63;function a(F){var T=F.length;if(T%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var U=F.indexOf("=");U===-1&&(U=T);var M=U===T?0:4-U%4;return[U,M]}function c(F){var T=a(F),U=T[0],M=T[1];return(U+M)*3/4-M}function f(F,T,U){return(T+U)*3/4-U}function p(F){var T,U=a(F),M=U[0],k=U[1],P=new e(f(F,M,k)),R=0,V=k>0?M-4:M,G;for(G=0;G<V;G+=4)T=t[F.charCodeAt(G)]<<18|t[F.charCodeAt(G+1)]<<12|t[F.charCodeAt(G+2)]<<6|t[F.charCodeAt(G+3)],P[R++]=T>>16&255,P[R++]=T>>8&255,P[R++]=T&255;return k===2&&(T=t[F.charCodeAt(G)]<<2|t[F.charCodeAt(G+1)]>>4,P[R++]=T&255),k===1&&(T=t[F.charCodeAt(G)]<<10|t[F.charCodeAt(G+1)]<<4|t[F.charCodeAt(G+2)]>>2,P[R++]=T>>8&255,P[R++]=T&255),P}function g(F){return r[F>>18&63]+r[F>>12&63]+r[F>>6&63]+r[F&63]}function v(F,T,U){for(var M,k=[],P=T;P<U;P+=3)M=(F[P]<<16&16711680)+(F[P+1]<<8&65280)+(F[P+2]&255),k.push(g(M));return k.join("")}function C(F){for(var T,U=F.length,M=U%3,k=[],P=16383,R=0,V=U-M;R<V;R+=P)k.push(v(F,R,R+P>V?V:R+P));return M===1?(T=F[U-1],k.push(r[T>>2]+r[T<<4&63]+"==")):M===2&&(T=(F[U-2]<<8)+F[U-1],k.push(r[T>>10]+r[T>>4&63]+r[T<<2&63]+"=")),k.join("")}return Ur}var wn={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */var So;function tu(){return So||(So=1,wn.read=function(r,t,e,n,o){var i,a,c=o*8-n-1,f=(1<<c)-1,p=f>>1,g=-7,v=e?o-1:0,C=e?-1:1,F=r[t+v];for(v+=C,i=F&(1<<-g)-1,F>>=-g,g+=c;g>0;i=i*256+r[t+v],v+=C,g-=8);for(a=i&(1<<-g)-1,i>>=-g,g+=n;g>0;a=a*256+r[t+v],v+=C,g-=8);if(i===0)i=1-p;else{if(i===f)return a?NaN:(F?-1:1)*(1/0);a=a+Math.pow(2,n),i=i-p}return(F?-1:1)*a*Math.pow(2,i-n)},wn.write=function(r,t,e,n,o,i){var a,c,f,p=i*8-o-1,g=(1<<p)-1,v=g>>1,C=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,F=n?0:i-1,T=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=g):(a=Math.floor(Math.log(t)/Math.LN2),t*(f=Math.pow(2,-a))<1&&(a--,f*=2),a+v>=1?t+=C/f:t+=C*Math.pow(2,1-v),t*f>=2&&(a++,f/=2),a+v>=g?(c=0,a=g):a+v>=1?(c=(t*f-1)*Math.pow(2,o),a=a+v):(c=t*Math.pow(2,v-1)*Math.pow(2,o),a=0));o>=8;r[e+F]=c&255,F+=T,c/=256,o-=8);for(a=a<<o|c,p+=o;p>0;r[e+F]=a&255,F+=T,a/=256,p-=8);r[e+F-T]|=U*128}),wn}/*!
|
|
5
|
-
* The buffer module from node.js, for the browser.
|
|
6
|
-
*
|
|
7
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
8
|
-
* @license MIT
|
|
9
|
-
*/var Io;function Os(){return Io||(Io=1,function(r){const t=Qc(),e=tu(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=c,r.SlowBuffer=P,r.INSPECT_MAX_BYTES=50;const o=2147483647;r.kMaxLength=o,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),s={foo:function(){return 42}};return Object.setPrototypeOf(s,Uint8Array.prototype),Object.setPrototypeOf(h,s),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>o)throw new RangeError('The value "'+h+'" is invalid for option "size"');const s=new Uint8Array(h);return Object.setPrototypeOf(s,c.prototype),s}function c(h,s,u){if(typeof h=="number"){if(typeof s=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return v(h)}return f(h,s,u)}c.poolSize=8192;function f(h,s,u){if(typeof h=="string")return C(h,s);if(ArrayBuffer.isView(h))return T(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,s,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,s,u);const d=M(h);if(d)return d;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof h[Symbol.toPrimitive]=="function")return c.from(h[Symbol.toPrimitive]("string"),s,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,s,u){return f(h,s,u)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array);function p(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 g(h,s,u){return p(h),h<=0?a(h):s!==void 0?typeof u=="string"?a(h).fill(s,u):a(h).fill(s):a(h)}c.alloc=function(h,s,u){return g(h,s,u)};function v(h){return p(h),a(h<0?0:k(h)|0)}c.allocUnsafe=function(h){return v(h)},c.allocUnsafeSlow=function(h){return v(h)};function C(h,s){if((typeof s!="string"||s==="")&&(s="utf8"),!c.isEncoding(s))throw new TypeError("Unknown encoding: "+s);const u=R(h,s)|0;let l=a(u);const d=l.write(h,s);return d!==u&&(l=l.slice(0,d)),l}function F(h){const s=h.length<0?0:k(h.length)|0,u=a(s);for(let l=0;l<s;l+=1)u[l]=h[l]&255;return u}function T(h){if(mt(h,Uint8Array)){const s=new Uint8Array(h);return U(s.buffer,s.byteOffset,s.byteLength)}return F(h)}function U(h,s,u){if(s<0||h.byteLength<s)throw new RangeError('"offset" is outside of buffer bounds');if(h.byteLength<s+(u||0))throw new RangeError('"length" is outside of buffer bounds');let l;return s===void 0&&u===void 0?l=new Uint8Array(h):u===void 0?l=new Uint8Array(h,s):l=new Uint8Array(h,s,u),Object.setPrototypeOf(l,c.prototype),l}function M(h){if(c.isBuffer(h)){const s=k(h.length)|0,u=a(s);return u.length===0||h.copy(u,0,0,s),u}if(h.length!==void 0)return typeof h.length!="number"||Qt(h.length)?a(0):F(h);if(h.type==="Buffer"&&Array.isArray(h.data))return F(h.data)}function k(h){if(h>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return h|0}function P(h){return+h!=h&&(h=0),c.alloc(+h)}c.isBuffer=function(s){return s!=null&&s._isBuffer===!0&&s!==c.prototype},c.compare=function(s,u){if(mt(s,Uint8Array)&&(s=c.from(s,s.offset,s.byteLength)),mt(u,Uint8Array)&&(u=c.from(u,u.offset,u.byteLength)),!c.isBuffer(s)||!c.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(s===u)return 0;let l=s.length,d=u.length;for(let b=0,I=Math.min(l,d);b<I;++b)if(s[b]!==u[b]){l=s[b],d=u[b];break}return l<d?-1:d<l?1:0},c.isEncoding=function(s){switch(String(s).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(s,u){if(!Array.isArray(s))throw new TypeError('"list" argument must be an Array of Buffers');if(s.length===0)return c.alloc(0);let l;if(u===void 0)for(u=0,l=0;l<s.length;++l)u+=s[l].length;const d=c.allocUnsafe(u);let b=0;for(l=0;l<s.length;++l){let I=s[l];if(mt(I,Uint8Array))b+I.length>d.length?(c.isBuffer(I)||(I=c.from(I)),I.copy(d,b)):Uint8Array.prototype.set.call(d,I,b);else if(c.isBuffer(I))I.copy(d,b);else throw new TypeError('"list" argument must be an Array of Buffers');b+=I.length}return d};function R(h,s){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 d=!1;for(;;)switch(s){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(d)return l?-1:kt(h).length;s=(""+s).toLowerCase(),d=!0}}c.byteLength=R;function V(h,s,u){let l=!1;if((s===void 0||s<0)&&(s=0),s>this.length||((u===void 0||u>this.length)&&(u=this.length),u<=0)||(u>>>=0,s>>>=0,u<=s))return"";for(h||(h="utf8");;)switch(h){case"hex":return X(this,s,u);case"utf8":case"utf-8":return z(this,s,u);case"ascii":return Y(this,s,u);case"latin1":case"binary":return Z(this,s,u);case"base64":return Q(this,s,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K(this,s,u);default:if(l)throw new TypeError("Unknown encoding: "+h);h=(h+"").toLowerCase(),l=!0}}c.prototype._isBuffer=!0;function G(h,s,u){const l=h[s];h[s]=h[u],h[u]=l}c.prototype.swap16=function(){const s=this.length;if(s%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let u=0;u<s;u+=2)G(this,u,u+1);return this},c.prototype.swap32=function(){const s=this.length;if(s%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let u=0;u<s;u+=4)G(this,u,u+3),G(this,u+1,u+2);return this},c.prototype.swap64=function(){const s=this.length;if(s%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let u=0;u<s;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 s=this.length;return s===0?"":arguments.length===0?z(this,0,s):V.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(s){if(!c.isBuffer(s))throw new TypeError("Argument must be a Buffer");return this===s?!0:c.compare(this,s)===0},c.prototype.inspect=function(){let s="";const u=r.INSPECT_MAX_BYTES;return s=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(s+=" ... "),"<Buffer "+s+">"},n&&(c.prototype[n]=c.prototype.inspect),c.prototype.compare=function(s,u,l,d,b){if(mt(s,Uint8Array)&&(s=c.from(s,s.offset,s.byteLength)),!c.isBuffer(s))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof s);if(u===void 0&&(u=0),l===void 0&&(l=s?s.length:0),d===void 0&&(d=0),b===void 0&&(b=this.length),u<0||l>s.length||d<0||b>this.length)throw new RangeError("out of range index");if(d>=b&&u>=l)return 0;if(d>=b)return-1;if(u>=l)return 1;if(u>>>=0,l>>>=0,d>>>=0,b>>>=0,this===s)return 0;let I=b-d,H=l-u;const pt=Math.min(I,H),lt=this.slice(d,b),yt=s.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,s,u,l,d){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=d?0:h.length-1),u<0&&(u=h.length+u),u>=h.length){if(d)return-1;u=h.length-1}else if(u<0)if(d)u=0;else return-1;if(typeof s=="string"&&(s=c.from(s,l)),c.isBuffer(s))return s.length===0?-1:O(h,s,u,l,d);if(typeof s=="number")return s=s&255,typeof Uint8Array.prototype.indexOf=="function"?d?Uint8Array.prototype.indexOf.call(h,s,u):Uint8Array.prototype.lastIndexOf.call(h,s,u):O(h,[s],u,l,d);throw new TypeError("val must be string, number or Buffer")}function O(h,s,u,l,d){let b=1,I=h.length,H=s.length;if(l!==void 0&&(l=String(l).toLowerCase(),l==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(h.length<2||s.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(d){let yt=-1;for(lt=u;lt<I;lt++)if(pt(h,lt)===pt(s,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(s,et)){yt=!1;break}if(yt)return lt}return-1}c.prototype.includes=function(s,u,l){return this.indexOf(s,u,l)!==-1},c.prototype.indexOf=function(s,u,l){return A(this,s,u,l,!0)},c.prototype.lastIndexOf=function(s,u,l){return A(this,s,u,l,!1)};function m(h,s,u,l){u=Number(u)||0;const d=h.length-u;l?(l=Number(l),l>d&&(l=d)):l=d;const b=s.length;l>b/2&&(l=b/2);let I;for(I=0;I<l;++I){const H=parseInt(s.substr(I*2,2),16);if(Qt(H))return I;h[u+I]=H}return I}function S(h,s,u,l){return Mt(kt(s,h.length-u),h,u,l)}function w(h,s,u,l){return Mt(Ht(s),h,u,l)}function B(h,s,u,l){return Mt($t(s),h,u,l)}function N(h,s,u,l){return Mt(Vt(s,h.length-u),h,u,l)}c.prototype.write=function(s,u,l,d){if(u===void 0)d="utf8",l=this.length,u=0;else if(l===void 0&&typeof u=="string")d=u,l=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(l)?(l=l>>>0,d===void 0&&(d="utf8")):(d=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),s.length>0&&(l<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");d||(d="utf8");let I=!1;for(;;)switch(d){case"hex":return m(this,s,u,l);case"utf8":case"utf-8":return S(this,s,u,l);case"ascii":case"latin1":case"binary":return w(this,s,u,l);case"base64":return B(this,s,u,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,s,u,l);default:if(I)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),I=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Q(h,s,u){return s===0&&u===h.length?t.fromByteArray(h):t.fromByteArray(h.slice(s,u))}function z(h,s,u){u=Math.min(h.length,u);const l=[];let d=s;for(;d<u;){const b=h[d];let I=null,H=b>239?4:b>223?3:b>191?2:1;if(d+H<=u){let pt,lt,yt,et;switch(H){case 1:b<128&&(I=b);break;case 2:pt=h[d+1],(pt&192)===128&&(et=(b&31)<<6|pt&63,et>127&&(I=et));break;case 3:pt=h[d+1],lt=h[d+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[d+1],lt=h[d+2],yt=h[d+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),d+=H}return D(l)}const L=4096;function D(h){const s=h.length;if(s<=L)return String.fromCharCode.apply(String,h);let u="",l=0;for(;l<s;)u+=String.fromCharCode.apply(String,h.slice(l,l+=L));return u}function Y(h,s,u){let l="";u=Math.min(h.length,u);for(let d=s;d<u;++d)l+=String.fromCharCode(h[d]&127);return l}function Z(h,s,u){let l="";u=Math.min(h.length,u);for(let d=s;d<u;++d)l+=String.fromCharCode(h[d]);return l}function X(h,s,u){const l=h.length;(!s||s<0)&&(s=0),(!u||u<0||u>l)&&(u=l);let d="";for(let b=s;b<u;++b)d+=ir[h[b]];return d}function K(h,s,u){const l=h.slice(s,u);let d="";for(let b=0;b<l.length-1;b+=2)d+=String.fromCharCode(l[b]+l[b+1]*256);return d}c.prototype.slice=function(s,u){const l=this.length;s=~~s,u=u===void 0?l:~~u,s<0?(s+=l,s<0&&(s=0)):s>l&&(s=l),u<0?(u+=l,u<0&&(u=0)):u>l&&(u=l),u<s&&(u=s);const d=this.subarray(s,u);return Object.setPrototypeOf(d,c.prototype),d};function q(h,s,u){if(h%1!==0||h<0)throw new RangeError("offset is not uint");if(h+s>u)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUintLE=c.prototype.readUIntLE=function(s,u,l){s=s>>>0,u=u>>>0,l||q(s,u,this.length);let d=this[s],b=1,I=0;for(;++I<u&&(b*=256);)d+=this[s+I]*b;return d},c.prototype.readUintBE=c.prototype.readUIntBE=function(s,u,l){s=s>>>0,u=u>>>0,l||q(s,u,this.length);let d=this[s+--u],b=1;for(;u>0&&(b*=256);)d+=this[s+--u]*b;return d},c.prototype.readUint8=c.prototype.readUInt8=function(s,u){return s=s>>>0,u||q(s,1,this.length),this[s]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(s,u){return s=s>>>0,u||q(s,2,this.length),this[s]|this[s+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(s,u){return s=s>>>0,u||q(s,2,this.length),this[s]<<8|this[s+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(s,u){return s=s>>>0,u||q(s,4,this.length),(this[s]|this[s+1]<<8|this[s+2]<<16)+this[s+3]*16777216},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(s,u){return s=s>>>0,u||q(s,4,this.length),this[s]*16777216+(this[s+1]<<16|this[s+2]<<8|this[s+3])},c.prototype.readBigUInt64LE=Wt(function(s){s=s>>>0,$(s,"offset");const u=this[s],l=this[s+7];(u===void 0||l===void 0)&&J(s,this.length-8);const d=u+this[++s]*2**8+this[++s]*2**16+this[++s]*2**24,b=this[++s]+this[++s]*2**8+this[++s]*2**16+l*2**24;return BigInt(d)+(BigInt(b)<<BigInt(32))}),c.prototype.readBigUInt64BE=Wt(function(s){s=s>>>0,$(s,"offset");const u=this[s],l=this[s+7];(u===void 0||l===void 0)&&J(s,this.length-8);const d=u*2**24+this[++s]*2**16+this[++s]*2**8+this[++s],b=this[++s]*2**24+this[++s]*2**16+this[++s]*2**8+l;return(BigInt(d)<<BigInt(32))+BigInt(b)}),c.prototype.readIntLE=function(s,u,l){s=s>>>0,u=u>>>0,l||q(s,u,this.length);let d=this[s],b=1,I=0;for(;++I<u&&(b*=256);)d+=this[s+I]*b;return b*=128,d>=b&&(d-=Math.pow(2,8*u)),d},c.prototype.readIntBE=function(s,u,l){s=s>>>0,u=u>>>0,l||q(s,u,this.length);let d=u,b=1,I=this[s+--d];for(;d>0&&(b*=256);)I+=this[s+--d]*b;return b*=128,I>=b&&(I-=Math.pow(2,8*u)),I},c.prototype.readInt8=function(s,u){return s=s>>>0,u||q(s,1,this.length),this[s]&128?(255-this[s]+1)*-1:this[s]},c.prototype.readInt16LE=function(s,u){s=s>>>0,u||q(s,2,this.length);const l=this[s]|this[s+1]<<8;return l&32768?l|4294901760:l},c.prototype.readInt16BE=function(s,u){s=s>>>0,u||q(s,2,this.length);const l=this[s+1]|this[s]<<8;return l&32768?l|4294901760:l},c.prototype.readInt32LE=function(s,u){return s=s>>>0,u||q(s,4,this.length),this[s]|this[s+1]<<8|this[s+2]<<16|this[s+3]<<24},c.prototype.readInt32BE=function(s,u){return s=s>>>0,u||q(s,4,this.length),this[s]<<24|this[s+1]<<16|this[s+2]<<8|this[s+3]},c.prototype.readBigInt64LE=Wt(function(s){s=s>>>0,$(s,"offset");const u=this[s],l=this[s+7];(u===void 0||l===void 0)&&J(s,this.length-8);const d=this[s+4]+this[s+5]*2**8+this[s+6]*2**16+(l<<24);return(BigInt(d)<<BigInt(32))+BigInt(u+this[++s]*2**8+this[++s]*2**16+this[++s]*2**24)}),c.prototype.readBigInt64BE=Wt(function(s){s=s>>>0,$(s,"offset");const u=this[s],l=this[s+7];(u===void 0||l===void 0)&&J(s,this.length-8);const d=(u<<24)+this[++s]*2**16+this[++s]*2**8+this[++s];return(BigInt(d)<<BigInt(32))+BigInt(this[++s]*2**24+this[++s]*2**16+this[++s]*2**8+l)}),c.prototype.readFloatLE=function(s,u){return s=s>>>0,u||q(s,4,this.length),e.read(this,s,!0,23,4)},c.prototype.readFloatBE=function(s,u){return s=s>>>0,u||q(s,4,this.length),e.read(this,s,!1,23,4)},c.prototype.readDoubleLE=function(s,u){return s=s>>>0,u||q(s,8,this.length),e.read(this,s,!0,52,8)},c.prototype.readDoubleBE=function(s,u){return s=s>>>0,u||q(s,8,this.length),e.read(this,s,!1,52,8)};function rt(h,s,u,l,d,b){if(!c.isBuffer(h))throw new TypeError('"buffer" argument must be a Buffer instance');if(s>d||s<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(s,u,l,d){if(s=+s,u=u>>>0,l=l>>>0,!d){const H=Math.pow(2,8*l)-1;rt(this,s,u,l,H,0)}let b=1,I=0;for(this[u]=s&255;++I<l&&(b*=256);)this[u+I]=s/b&255;return u+l},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(s,u,l,d){if(s=+s,u=u>>>0,l=l>>>0,!d){const H=Math.pow(2,8*l)-1;rt(this,s,u,l,H,0)}let b=l-1,I=1;for(this[u+b]=s&255;--b>=0&&(I*=256);)this[u+b]=s/I&255;return u+l},c.prototype.writeUint8=c.prototype.writeUInt8=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,1,255,0),this[u]=s&255,u+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,2,65535,0),this[u]=s&255,this[u+1]=s>>>8,u+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,2,65535,0),this[u]=s>>>8,this[u+1]=s&255,u+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,4,4294967295,0),this[u+3]=s>>>24,this[u+2]=s>>>16,this[u+1]=s>>>8,this[u]=s&255,u+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,4,4294967295,0),this[u]=s>>>24,this[u+1]=s>>>16,this[u+2]=s>>>8,this[u+3]=s&255,u+4};function xt(h,s,u,l,d){j(s,l,d,h,u,7);let b=Number(s&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(s>>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,s,u,l,d){j(s,l,d,h,u,7);let b=Number(s&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(s>>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(s,u=0){return xt(this,s,u,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Wt(function(s,u=0){return Ut(this,s,u,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(s,u,l,d){if(s=+s,u=u>>>0,!d){const pt=Math.pow(2,8*l-1);rt(this,s,u,l,pt-1,-pt)}let b=0,I=1,H=0;for(this[u]=s&255;++b<l&&(I*=256);)s<0&&H===0&&this[u+b-1]!==0&&(H=1),this[u+b]=(s/I>>0)-H&255;return u+l},c.prototype.writeIntBE=function(s,u,l,d){if(s=+s,u=u>>>0,!d){const pt=Math.pow(2,8*l-1);rt(this,s,u,l,pt-1,-pt)}let b=l-1,I=1,H=0;for(this[u+b]=s&255;--b>=0&&(I*=256);)s<0&&H===0&&this[u+b+1]!==0&&(H=1),this[u+b]=(s/I>>0)-H&255;return u+l},c.prototype.writeInt8=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,1,127,-128),s<0&&(s=255+s+1),this[u]=s&255,u+1},c.prototype.writeInt16LE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,2,32767,-32768),this[u]=s&255,this[u+1]=s>>>8,u+2},c.prototype.writeInt16BE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,2,32767,-32768),this[u]=s>>>8,this[u+1]=s&255,u+2},c.prototype.writeInt32LE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,4,2147483647,-2147483648),this[u]=s&255,this[u+1]=s>>>8,this[u+2]=s>>>16,this[u+3]=s>>>24,u+4},c.prototype.writeInt32BE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,4,2147483647,-2147483648),s<0&&(s=4294967295+s+1),this[u]=s>>>24,this[u+1]=s>>>16,this[u+2]=s>>>8,this[u+3]=s&255,u+4},c.prototype.writeBigInt64LE=Wt(function(s,u=0){return xt(this,s,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Wt(function(s,u=0){return Ut(this,s,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Pt(h,s,u,l,d,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,s,u,l,d){return s=+s,u=u>>>0,d||Pt(h,s,u,4),e.write(h,s,u,l,23,4),u+4}c.prototype.writeFloatLE=function(s,u,l){return Zt(this,s,u,!0,l)},c.prototype.writeFloatBE=function(s,u,l){return Zt(this,s,u,!1,l)};function Gt(h,s,u,l,d){return s=+s,u=u>>>0,d||Pt(h,s,u,8),e.write(h,s,u,l,52,8),u+8}c.prototype.writeDoubleLE=function(s,u,l){return Gt(this,s,u,!0,l)},c.prototype.writeDoubleBE=function(s,u,l){return Gt(this,s,u,!1,l)},c.prototype.copy=function(s,u,l,d){if(!c.isBuffer(s))throw new TypeError("argument should be a Buffer");if(l||(l=0),!d&&d!==0&&(d=this.length),u>=s.length&&(u=s.length),u||(u=0),d>0&&d<l&&(d=l),d===l||s.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(d<0)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),s.length-u<d-l&&(d=s.length-u+l);const b=d-l;return this===s&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,l,d):Uint8Array.prototype.set.call(s,this.subarray(l,d),u),b},c.prototype.fill=function(s,u,l,d){if(typeof s=="string"){if(typeof u=="string"?(d=u,u=0,l=this.length):typeof l=="string"&&(d=l,l=this.length),d!==void 0&&typeof d!="string")throw new TypeError("encoding must be a string");if(typeof d=="string"&&!c.isEncoding(d))throw new TypeError("Unknown encoding: "+d);if(s.length===1){const I=s.charCodeAt(0);(d==="utf8"&&I<128||d==="latin1")&&(s=I)}}else typeof s=="number"?s=s&255:typeof s=="boolean"&&(s=Number(s));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,s||(s=0);let b;if(typeof s=="number")for(b=u;b<l;++b)this[b]=s;else{const I=c.isBuffer(s)?s:c.from(s,d),H=I.length;if(H===0)throw new TypeError('The value "'+s+'" is invalid for argument "value"');for(b=0;b<l-u;++b)this[b+u]=I[b%H]}return this};const W={};function y(h,s,u){W[h]=class extends u{constructor(){super(),Object.defineProperty(this,"message",{value:s.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${h}]`,this.stack,delete this.name}get code(){return h}set code(d){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:d,writable:!0})}toString(){return`${this.name} [${h}]: ${this.message}`}}}y("ERR_BUFFER_OUT_OF_BOUNDS",function(h){return h?`${h} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),y("ERR_INVALID_ARG_TYPE",function(h,s){return`The "${h}" argument must be of type number. Received type ${typeof s}`},TypeError),y("ERR_OUT_OF_RANGE",function(h,s,u){let l=`The value of "${h}" is out of range.`,d=u;return Number.isInteger(u)&&Math.abs(u)>2**32?d=_(String(u)):typeof u=="bigint"&&(d=String(u),(u>BigInt(2)**BigInt(32)||u<-(BigInt(2)**BigInt(32)))&&(d=_(d)),d+="n"),l+=` It must be ${s}. Received ${d}`,l},RangeError);function _(h){let s="",u=h.length;const l=h[0]==="-"?1:0;for(;u>=l+4;u-=3)s=`_${h.slice(u-3,u)}${s}`;return`${h.slice(0,u)}${s}`}function E(h,s,u){$(s,"offset"),(h[s]===void 0||h[s+u]===void 0)&&J(s,h.length-(u+1))}function j(h,s,u,l,d,b){if(h>u||h<s){const I=typeof s=="bigint"?"n":"";let H;throw s===0||s===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)}E(l,d,b)}function $(h,s){if(typeof h!="number")throw new W.ERR_INVALID_ARG_TYPE(s,"number",h)}function J(h,s,u){throw Math.floor(h)!==h?($(h,u),new W.ERR_OUT_OF_RANGE("offset","an integer",h)):s<0?new W.ERR_BUFFER_OUT_OF_BOUNDS:new W.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${s}`,h)}const bt=/[^+/0-9A-Za-z-_]/g;function Nt(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,s){s=s||1/0;let u;const l=h.length;let d=null;const b=[];for(let I=0;I<l;++I){if(u=h.charCodeAt(I),u>55295&&u<57344){if(!d){if(u>56319){(s-=3)>-1&&b.push(239,191,189);continue}else if(I+1===l){(s-=3)>-1&&b.push(239,191,189);continue}d=u;continue}if(u<56320){(s-=3)>-1&&b.push(239,191,189),d=u;continue}u=(d-55296<<10|u-56320)+65536}else d&&(s-=3)>-1&&b.push(239,191,189);if(d=null,u<128){if((s-=1)<0)break;b.push(u)}else if(u<2048){if((s-=2)<0)break;b.push(u>>6|192,u&63|128)}else if(u<65536){if((s-=3)<0)break;b.push(u>>12|224,u>>6&63|128,u&63|128)}else if(u<1114112){if((s-=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 s=[];for(let u=0;u<h.length;++u)s.push(h.charCodeAt(u)&255);return s}function Vt(h,s){let u,l,d;const b=[];for(let I=0;I<h.length&&!((s-=2)<0);++I)u=h.charCodeAt(I),l=u>>8,d=u%256,b.push(d),b.push(l);return b}function $t(h){return t.toByteArray(Nt(h))}function Mt(h,s,u,l){let d;for(d=0;d<l&&!(d+u>=s.length||d>=h.length);++d)s[d+u]=h[d];return d}function mt(h,s){return h instanceof s||h!=null&&h.constructor!=null&&h.constructor.name!=null&&h.constructor.name===s.name}function Qt(h){return h!==h}const ir=function(){const h="0123456789abcdef",s=new Array(256);for(let u=0;u<16;++u){const l=u*16;for(let d=0;d<16;++d)s[l+d]=h[u]+h[d]}return s}();function Wt(h){return typeof BigInt>"u"?_i:h}function _i(){throw new Error("BigInt not supported")}}(Oi)),Oi}var Bo;function Df(){if(Bo)return Dr;Bo=1,Object.defineProperty(Dr,"__esModule",{value:!0}),Dr.BinaryReader=void 0;const r=Os();class t{constructor(n,o=!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=o}_read(n,o,i){return()=>{let a;return this.isBigEndian?a=o.call(this.buffer,this.position):a=n.call(this.buffer,this.position),this.position+=i,a}}readVarInt(){let n,o=0,i=0;do n=this.buffer[this.position+i],o+=(n&127)<<7*i,i++;while(n>=128);return this.position+=i,o}}return Dr.BinaryReader=t,Dr}var Lr={},vo;function qe(){if(vo)return Lr;vo=1,Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.BinaryWriter=void 0;const r=Os();class t{constructor(n,o=!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=o}_write(n,o){return(i,a=!1)=>{this.ensureSize(o),n.call(this.buffer,i,this.position,a),this.position+=o}}writeBuffer(n){this.ensureSize(n.length),n.copy(this.buffer,this.position,0,n.length),this.position+=n.length}writeVarInt(n){let o=1;for(;(n&4294967168)!==0;)this.writeUInt8(n&127|128),n>>>=7,o++;return this.writeUInt8(n&127),o}ensureSize(n){if(this.buffer.length<this.position+n)if(this.allowResize){const o=r.Buffer.alloc(this.position+n);this.buffer.copy(o,0,0,this.buffer.length),this.buffer=o}else throw new RangeError("index out of range")}}return Lr.BinaryWriter=t,Lr}var Rr={},Ao;function Pe(){return Ao||(Ao=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 Cr={},xo;function Uf(){if(xo)return Cr;xo=1,Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.Geometry=void 0;const r=Os(),t=$e();class e{constructor(){this.srid=void 0,this.hasZ=!1,this.hasM=!1}static parse(o,i){if(typeof o==="string"||o instanceof t.WktParser)return e._parseWkt(o);if(r.Buffer.isBuffer(o)||o instanceof t.BinaryReader)try{return e._parseWkb(o,i)}catch{try{return e.parseTwkb(o)}catch{throw new Error("Could not parse WKB or TWKB")}}else throw new Error("First argument must be a string or Buffer")}static _parseWkt(o){let i,a;o instanceof t.WktParser?i=o:i=new t.WktParser(o);const c=i.matchRegex([/^SRID=(\d+);/]);c&&(a=parseInt(c[1],10));const f=i.matchType(),p=i.matchDimension(),g={srid:a,hasZ:p.hasZ,hasM:p.hasM};switch(f){case t.CONSTANTS.wkt.Point:return t.Point._parseWktWithOptions(i,g);case t.CONSTANTS.wkt.LineString:return t.LineString._parseWktWithOptions(i,g);case t.CONSTANTS.wkt.Polygon:return t.Polygon._parseWktWithOptions(i,g);case t.CONSTANTS.wkt.MultiPoint:return t.MultiPoint._parseWktWithOptions(i,g);case t.CONSTANTS.wkt.MultiLineString:return t.MultiLineString._parseWktWithOptions(i,g);case t.CONSTANTS.wkt.MultiPolygon:return t.MultiPolygon._parseWktWithOptions(i,g);case t.CONSTANTS.wkt.GeometryCollection:return t.GeometryCollection._parseWktWithOptions(i,g);default:throw new Error("Unsupported geometry type")}}static _parseWkb(o,i){let a,c,f;const p={};switch(o instanceof t.BinaryReader?a=o:a=new t.BinaryReader(o),a.isBigEndian=!a.readInt8(),c=a.readUInt32(),p.hasSrid=(c&536870912)===536870912,p.isEwkb=c&536870912||c&1073741824||c&2147483648,p.hasSrid&&(p.srid=a.readUInt32()),p.hasZ=!1,p.hasM=!1,!p.isEwkb&&(!i||!i.isEwkb)?c>=1e3&&c<2e3?(p.hasZ=!0,f=c-1e3):c>=2e3&&c<3e3?(p.hasM=!0,f=c-2e3):c>=3e3&&c<4e3?(p.hasZ=!0,p.hasM=!0,f=c-3e3):f=c:(c&2147483648&&(p.hasZ=!0),c&1073741824&&(p.hasM=!0),f=c&15),f){case t.CONSTANTS.wkb.Point:return t.Point._parseWkb(a,p);case t.CONSTANTS.wkb.LineString:return t.LineString._parseWkb(a,p);case t.CONSTANTS.wkb.Polygon:return t.Polygon._parseWkb(a,p);case t.CONSTANTS.wkb.MultiPoint:return t.MultiPoint._parseWkb(a,p);case t.CONSTANTS.wkb.MultiLineString:return t.MultiLineString._parseWkb(a,p);case t.CONSTANTS.wkb.MultiPolygon:return t.MultiPolygon._parseWkb(a,p);case t.CONSTANTS.wkb.GeometryCollection:return t.GeometryCollection._parseWkb(a,p);default:throw new Error(`GeometryType ${f} not supported`)}}static parseTwkb(o){let i;const a={};o instanceof t.BinaryReader?i=o:i=new t.BinaryReader(o);const c=i.readUInt8(),f=i.readUInt8(),p=c&15;if(a.precision=t.ZigZag.decode(c>>4),a.precisionFactor=Math.pow(10,a.precision),a.hasBoundingBox=f>>0&1,a.hasSizeAttribute=f>>1&1,a.hasIdList=f>>2&1,a.hasExtendedPrecision=f>>3&1,a.isEmpty=f>>4&1,a.hasExtendedPrecision){const g=i.readUInt8();a.hasZ=(g&1)===1,a.hasM=(g&2)===2,a.zPrecision=t.ZigZag.decode((g&28)>>2),a.zPrecisionFactor=Math.pow(10,a.zPrecision),a.mPrecision=t.ZigZag.decode((g&224)>>5),a.mPrecisionFactor=Math.pow(10,a.mPrecision)}else a.hasZ=!1,a.hasM=!1;if(a.hasSizeAttribute&&i.readVarInt(),a.hasBoundingBox){let g=2;a.hasZ&&g++,a.hasM&&g++;for(let v=0;v<g;v++)i.readVarInt(),i.readVarInt()}switch(p){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 "+p+" not supported")}}toGeoJSON(o){const i={};return this.srid&&o&&(o.shortCrs?i.crs={type:"name",properties:{name:"EPSG:"+this.srid}}:o.longCrs&&(i.crs={type:"name",properties:{name:"urn:ogc:def:crs:EPSG::"+this.srid}})),i}static _parseGeoJSON(o,i){let a;switch(o.type){case t.CONSTANTS.geoJSON.Point:a=t.Point._parseGeoJSON(o);break;case t.CONSTANTS.geoJSON.LineString:a=t.LineString._parseGeoJSON(o);break;case t.CONSTANTS.geoJSON.Polygon:a=t.Polygon._parseGeoJSON(o);break;case t.CONSTANTS.geoJSON.MultiPoint:a=t.MultiPoint._parseGeoJSON(o);break;case t.CONSTANTS.geoJSON.MultiLineString:a=t.MultiLineString._parseGeoJSON(o);break;case t.CONSTANTS.geoJSON.MultiPolygon:a=t.MultiPolygon._parseGeoJSON(o);break;case t.CONSTANTS.geoJSON.GeometryCollection:a=t.GeometryCollection._parseGeoJSON(o);break;default:throw new Error("GeometryType "+o.type+" not supported")}if(o.crs&&o.crs.type&&o.crs.type==="name"&&o.crs.properties&&o.crs.properties.name){const c=o.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 o=new t.BinaryWriter(this._getWkbSize()+4),i=this.toWkb();return o.writeInt8(1),o.writeUInt32LE((i.slice(1,5).readUInt32LE(0)|536870912)>>>0,!0),o.writeUInt32LE(this.srid),o.writeBuffer(i.slice(5)),o.buffer}_getWktType(o,i){let a=o;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(o){let i=`${o.x} ${o.y}`;return this.hasZ&&(i+=` ${o.z}`),this.hasM&&(i+=` ${o.m}`),i}_writeWkbType(o,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)),o.writeUInt32LE(c+i>>>0,!0)}static getTwkbPrecision(o,i,a){return{xy:o,z:i,m:a,xyFactor:Math.pow(10,o),zFactor:Math.pow(10,i),mFactor:Math.pow(10,a)}}_writeTwkbHeader(o,i,a,c){const f=(t.ZigZag.encode(a.xy)<<4)+i;let p=this.hasZ||this.hasM?1:0;if(p+=c?1:0,o.writeUInt8(f),o.writeUInt8(p),this.hasZ||this.hasM){let g=0;this.hasZ&&(g|=1),this.hasM&&(g|=2),o.writeUInt8(g)}}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 Cr.Geometry=e,Cr}var Pr={},Eo;function Lf(){if(Eo)return Pr;Eo=1,Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.GeometryCollection=void 0;const r=qe(),t=Pe(),e=$e();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 f=i.readUInt32();for(let p=0;p<f;p++)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 f=i.readVarInt();for(let p=0;p<f;p++)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 f=0;f<this.geometries.length;f++)i.writeBuffer(this.geometries[f].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 Pr.GeometryCollection=n,Pr}var $r={},To;function Rf(){if(To)return $r;To=1,Object.defineProperty($r,"__esModule",{value:!0}),$r.LineString=void 0;const r=qe(),t=Pe(),e=$e();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 f=i.readUInt32();for(let p=0;p<f;p++)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 f=new e.Point(0,0,0,0),p=i.readVarInt();for(let g=0;g<p;g++)c.points.push(e.Point._readTwkbPoint(i,a,f));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 f=new e.Point(0,0,0,0);for(const p of this.points)p._writeTwkbPoint(i,a,f)}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 $r.LineString=n,$r}var zr={},Oo;function Cf(){if(Oo)return zr;Oo=1,Object.defineProperty(zr,"__esModule",{value:!0}),zr.MultiLineString=void 0;const r=qe(),t=Pe(),e=$e();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 f=i.readUInt32();for(let p=0;p<f;p++){const g=e.Geometry.parse(i,a);c.lineStrings.push(e.LineString.fromGeometry(g))}return c}static _parseTwkb(i,a){const c=new n;if(c.hasZ=a.hasZ,c.hasM=a.hasM,a.isEmpty)return c;const f=new e.Point(0,0,0,0),p=i.readVarInt();for(let g=0;g<p;g++){const v=new e.LineString;v.hasZ=a.hasZ,v.hasM=a.hasM;const C=i.readVarInt();for(let F=0;F<C;F++)v.points.push(e.Point._readTwkbPoint(i,a,f));c.lineStrings.push(v)}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 f=new e.Point(0,0,0,0);for(let p=0;p<this.lineStrings.length;p++){i.writeVarInt(this.lineStrings[p].points.length);for(let g=0;g<this.lineStrings[p].points.length;g++)this.lineStrings[p].points[g]._writeTwkbPoint(i,a,f)}}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 zr.MultiLineString=n,zr}var jr={},Mo;function Pf(){if(Mo)return jr;Mo=1,Object.defineProperty(jr,"__esModule",{value:!0}),jr.MultiPoint=void 0;const r=qe(),t=Pe(),e=$e();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 f=i.readUInt32();for(let p=0;p<f;p++){const g=e.Geometry.parse(i,a);c.points.push(e.Point.fromGeometry(g))}return c}static _parseTwkb(i,a){const c=new n;if(c.hasZ=a.hasZ,c.hasM=a.hasM,a.isEmpty)return c;const f=new e.Point(0,0,0,0),p=i.readVarInt();for(let g=0;g<p;g++)c.points.push(e.Point._readTwkbPoint(i,a,f));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 f=new e.Point(0,0,0,0);for(let p=0;p<this.points.length;p++)this.points[p]._writeTwkbPoint(i,a,f)}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 jr.MultiPoint=n,jr}var Vr={},Fo;function $f(){if(Fo)return Vr;Fo=1,Object.defineProperty(Vr,"__esModule",{value:!0}),Vr.MultiPolygon=void 0;const r=qe(),t=Pe(),e=$e();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 f=[],p=[];for(i.expectGroupStart(),f.push(...i.matchCoordinates(a)),i.expectGroupEnd();i.isMatch([","]);)i.expectGroupStart(),p.push(i.matchCoordinates(a)),i.expectGroupEnd();c.polygons.push(new e.Polygon(f,p)),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 f=i.readUInt32();for(let p=0;p<f;p++)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 f=new e.Point(0,0,0,0),p=i.readVarInt();for(let g=0;g<p;g++){const v=new e.Polygon;v.hasZ=a.hasZ,v.hasM=a.hasM;const C=i.readVarInt(),F=i.readVarInt();for(let T=0;T<F;T++)v.exteriorRing.push(e.Point._readTwkbPoint(i,a,f));for(let T=1;T<C;T++){const U=[],M=i.readVarInt();for(let k=0;k<M;k++)U.push(e.Point._readTwkbPoint(i,a,f));v.interiorRings.push(U)}c.polygons.push(v)}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 f=new e.Point(0,0,0,0);for(let p=0;p<this.polygons.length;p++){i.writeVarInt(1+this.polygons[p].interiorRings.length),i.writeVarInt(this.polygons[p].exteriorRing.length);for(let g=0;g<this.polygons[p].exteriorRing.length;g++)this.polygons[p].exteriorRing[g]._writeTwkbPoint(i,a,f);for(let g=0;g<this.polygons[p].interiorRings.length;g++){i.writeVarInt(this.polygons[p].interiorRings[g].length);for(let v=0;v<this.polygons[p].interiorRings[g].length;v++)this.polygons[p].interiorRings[g][v]._writeTwkbPoint(i,a,f)}}}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 Vr.MultiPolygon=n,Vr}var Wr={},Zr={},No;function eu(){if(No)return Zr;No=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.ZigZag=void 0;class r{static encode(e){return e<<1^e>>31}static decode(e){return e>>1^-(e&1)}}return Zr.ZigZag=r,Zr}var ko;function ru(){if(ko)return Wr;ko=1,Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.Point=void 0;const r=qe(),t=eu(),e=Pe(),n=$e();class o extends n.Geometry{constructor(a,c,f,p,g){super(),this.x=a,this.y=c,this.z=f,this.m=p,this.srid=g,this.hasZ=typeof this.z<"u",this.hasM=typeof this.m<"u"}static Z(a,c,f,p){const g=new o(a,c,f,0,p);return g.hasZ=!0,g}static M(a,c,f,p){const g=new o(a,c,0,f,p);return g.hasM=!0,g}static ZM(a,c,f,p,g){const v=new o(a,c,f,p,g);return v.hasZ=!0,v.hasM=!0,v}static _parseWktWithOptions(a,c){const f=new o(0,0,0,0);if(f.srid=c.srid,f.hasZ=c.hasZ,f.hasM=c.hasM,a.isMatch(["EMPTY"]))return f;a.expectGroupStart();const p=a.matchCoordinate(c);return f.x=p.x,f.y=p.y,f.z=p.z,f.m=p.m,a.expectGroupEnd(),f}static _parseWkb(a,c){const f=o._readWkbPoint(a,c);return f.srid=c.srid,f}static _readWkbPoint(a,c){return new o(a.readDouble(),a.readDouble(),c.hasZ?a.readDouble():!1,c.hasM?a.readDouble():!1)}static _parseTwkb(a,c){const f=new o(0,0,0,0);return f.hasZ=c.hasZ,f.hasM=c.hasM,c.isEmpty||(f.x=t.ZigZag.decode(a.readVarInt())/c.precisionFactor,f.y=t.ZigZag.decode(a.readVarInt())/c.precisionFactor,f.z=c.hasZ?t.ZigZag.decode(a.readVarInt())/c.zPrecisionFactor:0,f.m=c.hasM?t.ZigZag.decode(a.readVarInt())/c.mPrecisionFactor:0),f}static _readTwkbPoint(a,c,f){return f.x+=t.ZigZag.decode(a.readVarInt())/c.precisionFactor,f.y+=t.ZigZag.decode(a.readVarInt())/c.precisionFactor,c.hasZ&&(f.z+=t.ZigZag.decode(a.readVarInt())/c.zPrecisionFactor),c.hasM&&(f.m+=t.ZigZag.decode(a.readVarInt())/c.mPrecisionFactor),new o(f.x,f.y,f.z,f.m)}static _parseGeoJSON(a){return o._readGeoJSONPoint(a.coordinates)}static _readGeoJSONPoint(a){return a.length===0?new o(0,0,0,0):a.length>2?new o(a[0],a[1],a[2],0):new o(a[0],a[1],0,0)}static fromGeometry(a){const c=new o(0,0,0,0);return c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM,a instanceof o?(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),f=this.x===void 0&&this.y===void 0;return this._writeTwkbHeader(a,e.CONSTANTS.wkb.Point,c,f),f||this._writeTwkbPoint(a,c,new o(0,0,0,0)),a.buffer}_writeTwkbPoint(a,c,f){const p=this.x*c.xyFactor,g=this.y*c.xyFactor,v=this.z*c.zFactor,C=this.m*c.mFactor;a.writeVarInt(t.ZigZag.encode(p-f.x)),a.writeVarInt(t.ZigZag.encode(g-f.y)),this.hasZ&&a.writeVarInt(t.ZigZag.encode(v-f.z)),this.hasM&&a.writeVarInt(t.ZigZag.encode(C-f.m)),f.x=p,f.y=g,f.z=v,f.m=C}_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 Wr.Point=o,Wr}var Gr={},Do;function zf(){if(Do)return Gr;Do=1,Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.Polygon=void 0;const r=qe(),t=Pe(),e=$e();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 f=new n(i,a,c);return f.hasZ=!0,f}static M(i,a,c){const f=new n(i,a,c);return f.hasM=!0,f}static ZM(i,a,c){const f=new n(i,a,c);return f.hasZ=!0,f.hasM=!0,f}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 f=i.readUInt32();if(f>0){const p=i.readUInt32();for(let g=0;g<p;g++)c.exteriorRing.push(e.Point._readWkbPoint(i,a));for(let g=1;g<f;g++){const v=[],C=i.readUInt32();for(let F=0;F<C;F++)v.push(e.Point._readWkbPoint(i,a));c.interiorRings.push(v)}}return c}static _parseTwkb(i,a){const c=new n;if(c.hasZ=a.hasZ,c.hasM=a.hasM,a.isEmpty)return c;const f=new e.Point(0,0,0,0),p=i.readVarInt(),g=i.readVarInt();for(let v=0;v<g;v++)c.exteriorRing.push(e.Point._readTwkbPoint(i,a,f));for(let v=1;v<p;v++){const C=[],F=i.readVarInt();for(let T=0;T<F;T++)C.push(e.Point._readTwkbPoint(i,a,f));c.interiorRings.push(C)}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 f=0;f<i.coordinates[c].length;f++)c===0?a.exteriorRing.push(e.Point._readGeoJSONPoint(i.coordinates[c][f])):a.interiorRings[c-1].push(e.Point._readGeoJSONPoint(i.coordinates[c][f]))}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 f=0;f<this.interiorRings[c].length;f++)this.interiorRings[c][f]._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 f=new e.Point(0,0,0,0);for(let p=0;p<this.exteriorRing.length;p++)this.exteriorRing[p]._writeTwkbPoint(i,a,f);for(let p=0;p<this.interiorRings.length;p++){i.writeVarInt(this.interiorRings[p].length);for(let g=0;g<this.interiorRings[p].length;g++)this.interiorRings[p][g]._writeTwkbPoint(i,a,f)}}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 f=0;f<this.exteriorRing.length;f++)this.hasZ?c.push([this.exteriorRing[f].x,this.exteriorRing[f].y,this.exteriorRing[f].z]):c.push([this.exteriorRing[f].x,this.exteriorRing[f].y]);a.coordinates.push(c)}for(let c=0;c<this.interiorRings.length;c++){const f=[];for(let p=0;p<this.interiorRings[c].length;p++)this.hasZ?f.push([this.interiorRings[c][p].x,this.interiorRings[c][p].y,this.interiorRings[c][p].z]):f.push([this.interiorRings[c][p].x,this.interiorRings[c][p].y]);a.coordinates.push(f)}return a}}return Gr.Polygon=n,Gr}var Yr={},Uo;function jf(){if(Uo)return Yr;Uo=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.WktParser=void 0;const r=Pe(),t=ru();class e{constructor(o){this.value=o,this.position=0}match(o){this.skipWhitespaces();for(let i=0;i<o.length;i++)if(this.value.substring(this.position).indexOf(o[i])===0)return this.position+=o[i].length,o[i];return null}matchRegex(o){this.skipWhitespaces();for(let i=0;i<o.length;i++){const a=this.value.substring(this.position).match(o[i]);if(a)return this.position+=a[0].length,a}return null}isMatch(o){this.skipWhitespaces();for(let i=0;i<o.length;i++)if(this.value.substring(this.position).indexOf(o[i])===0)return this.position+=o[i].length,!0;return!1}matchType(){const o=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(!o)throw new Error("Expected geometry type");return o}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(o){let i;if(o.hasZ&&o.hasM?i=this.matchRegex([/^(\S*)\s+(\S*)\s+(\S*)\s+([^\s,)]*)/]):o.hasZ||o.hasM?i=this.matchRegex([/^(\S*)\s+(\S*)\s+([^\s,)]*)/]):i=this.matchRegex([/^(\S*)\s+([^\s,)]*)/]),!i)throw new Error("Expected coordinates");return o.hasZ&&o.hasM?new t.Point(parseFloat(i[1]),parseFloat(i[2]),parseFloat(i[3]),parseFloat(i[4])):o.hasZ?new t.Point(parseFloat(i[1]),parseFloat(i[2]),parseFloat(i[3]),0):o.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(o){const i=[];do{const a=this.isMatch(["("]);i.push(this.matchCoordinate(o)),a&&this.expectGroupEnd()}while(this.isMatch([","]));return i}skipWhitespaces(){for(;this.position<this.value.length&&this.value[this.position]===" ";)this.position++}}return Yr.WktParser=e,Yr}var Lo;function $e(){return Lo||(Lo=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=Df();Object.defineProperty(r,"BinaryReader",{enumerable:!0,get:function(){return t.BinaryReader}});const e=qe();Object.defineProperty(r,"BinaryWriter",{enumerable:!0,get:function(){return e.BinaryWriter}});const n=Pe();Object.defineProperty(r,"CONSTANTS",{enumerable:!0,get:function(){return n.CONSTANTS}});const o=Uf();Object.defineProperty(r,"Geometry",{enumerable:!0,get:function(){return o.Geometry}});const i=Lf();Object.defineProperty(r,"GeometryCollection",{enumerable:!0,get:function(){return i.GeometryCollection}});const a=Rf();Object.defineProperty(r,"LineString",{enumerable:!0,get:function(){return a.LineString}});const c=Cf();Object.defineProperty(r,"MultiLineString",{enumerable:!0,get:function(){return c.MultiLineString}});const f=Pf();Object.defineProperty(r,"MultiPoint",{enumerable:!0,get:function(){return f.MultiPoint}});const p=$f();Object.defineProperty(r,"MultiPolygon",{enumerable:!0,get:function(){return p.MultiPolygon}});const g=ru();Object.defineProperty(r,"Point",{enumerable:!0,get:function(){return g.Point}});const v=zf();Object.defineProperty(r,"Polygon",{enumerable:!0,get:function(){return v.Polygon}});const C=jf();Object.defineProperty(r,"WktParser",{enumerable:!0,get:function(){return C.WktParser}});const F=eu();Object.defineProperty(r,"ZigZag",{enumerable:!0,get:function(){return F.ZigZag}})}(Ti)),Ti}var Vf=$e(),Mi={};/*!
|
|
10
|
-
* The buffer module from node.js, for the browser.
|
|
11
|
-
*
|
|
12
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
13
|
-
* @license MIT
|
|
14
|
-
*/var Ro;function Wf(){return Ro||(Ro=1,function(r){const t=Qc(),e=tu(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=c,r.SlowBuffer=P,r.INSPECT_MAX_BYTES=50;const o=2147483647;r.kMaxLength=o,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),s={foo:function(){return 42}};return Object.setPrototypeOf(s,Uint8Array.prototype),Object.setPrototypeOf(h,s),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>o)throw new RangeError('The value "'+h+'" is invalid for option "size"');const s=new Uint8Array(h);return Object.setPrototypeOf(s,c.prototype),s}function c(h,s,u){if(typeof h=="number"){if(typeof s=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return v(h)}return f(h,s,u)}c.poolSize=8192;function f(h,s,u){if(typeof h=="string")return C(h,s);if(ArrayBuffer.isView(h))return T(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,s,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,s,u);const d=M(h);if(d)return d;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof h[Symbol.toPrimitive]=="function")return c.from(h[Symbol.toPrimitive]("string"),s,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,s,u){return f(h,s,u)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array);function p(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 g(h,s,u){return p(h),h<=0?a(h):s!==void 0?typeof u=="string"?a(h).fill(s,u):a(h).fill(s):a(h)}c.alloc=function(h,s,u){return g(h,s,u)};function v(h){return p(h),a(h<0?0:k(h)|0)}c.allocUnsafe=function(h){return v(h)},c.allocUnsafeSlow=function(h){return v(h)};function C(h,s){if((typeof s!="string"||s==="")&&(s="utf8"),!c.isEncoding(s))throw new TypeError("Unknown encoding: "+s);const u=R(h,s)|0;let l=a(u);const d=l.write(h,s);return d!==u&&(l=l.slice(0,d)),l}function F(h){const s=h.length<0?0:k(h.length)|0,u=a(s);for(let l=0;l<s;l+=1)u[l]=h[l]&255;return u}function T(h){if(mt(h,Uint8Array)){const s=new Uint8Array(h);return U(s.buffer,s.byteOffset,s.byteLength)}return F(h)}function U(h,s,u){if(s<0||h.byteLength<s)throw new RangeError('"offset" is outside of buffer bounds');if(h.byteLength<s+(u||0))throw new RangeError('"length" is outside of buffer bounds');let l;return s===void 0&&u===void 0?l=new Uint8Array(h):u===void 0?l=new Uint8Array(h,s):l=new Uint8Array(h,s,u),Object.setPrototypeOf(l,c.prototype),l}function M(h){if(c.isBuffer(h)){const s=k(h.length)|0,u=a(s);return u.length===0||h.copy(u,0,0,s),u}if(h.length!==void 0)return typeof h.length!="number"||Qt(h.length)?a(0):F(h);if(h.type==="Buffer"&&Array.isArray(h.data))return F(h.data)}function k(h){if(h>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return h|0}function P(h){return+h!=h&&(h=0),c.alloc(+h)}c.isBuffer=function(s){return s!=null&&s._isBuffer===!0&&s!==c.prototype},c.compare=function(s,u){if(mt(s,Uint8Array)&&(s=c.from(s,s.offset,s.byteLength)),mt(u,Uint8Array)&&(u=c.from(u,u.offset,u.byteLength)),!c.isBuffer(s)||!c.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(s===u)return 0;let l=s.length,d=u.length;for(let b=0,I=Math.min(l,d);b<I;++b)if(s[b]!==u[b]){l=s[b],d=u[b];break}return l<d?-1:d<l?1:0},c.isEncoding=function(s){switch(String(s).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(s,u){if(!Array.isArray(s))throw new TypeError('"list" argument must be an Array of Buffers');if(s.length===0)return c.alloc(0);let l;if(u===void 0)for(u=0,l=0;l<s.length;++l)u+=s[l].length;const d=c.allocUnsafe(u);let b=0;for(l=0;l<s.length;++l){let I=s[l];if(mt(I,Uint8Array))b+I.length>d.length?(c.isBuffer(I)||(I=c.from(I)),I.copy(d,b)):Uint8Array.prototype.set.call(d,I,b);else if(c.isBuffer(I))I.copy(d,b);else throw new TypeError('"list" argument must be an Array of Buffers');b+=I.length}return d};function R(h,s){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 d=!1;for(;;)switch(s){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(d)return l?-1:kt(h).length;s=(""+s).toLowerCase(),d=!0}}c.byteLength=R;function V(h,s,u){let l=!1;if((s===void 0||s<0)&&(s=0),s>this.length||((u===void 0||u>this.length)&&(u=this.length),u<=0)||(u>>>=0,s>>>=0,u<=s))return"";for(h||(h="utf8");;)switch(h){case"hex":return X(this,s,u);case"utf8":case"utf-8":return z(this,s,u);case"ascii":return Y(this,s,u);case"latin1":case"binary":return Z(this,s,u);case"base64":return Q(this,s,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K(this,s,u);default:if(l)throw new TypeError("Unknown encoding: "+h);h=(h+"").toLowerCase(),l=!0}}c.prototype._isBuffer=!0;function G(h,s,u){const l=h[s];h[s]=h[u],h[u]=l}c.prototype.swap16=function(){const s=this.length;if(s%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let u=0;u<s;u+=2)G(this,u,u+1);return this},c.prototype.swap32=function(){const s=this.length;if(s%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let u=0;u<s;u+=4)G(this,u,u+3),G(this,u+1,u+2);return this},c.prototype.swap64=function(){const s=this.length;if(s%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let u=0;u<s;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 s=this.length;return s===0?"":arguments.length===0?z(this,0,s):V.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(s){if(!c.isBuffer(s))throw new TypeError("Argument must be a Buffer");return this===s?!0:c.compare(this,s)===0},c.prototype.inspect=function(){let s="";const u=r.INSPECT_MAX_BYTES;return s=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(s+=" ... "),"<Buffer "+s+">"},n&&(c.prototype[n]=c.prototype.inspect),c.prototype.compare=function(s,u,l,d,b){if(mt(s,Uint8Array)&&(s=c.from(s,s.offset,s.byteLength)),!c.isBuffer(s))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof s);if(u===void 0&&(u=0),l===void 0&&(l=s?s.length:0),d===void 0&&(d=0),b===void 0&&(b=this.length),u<0||l>s.length||d<0||b>this.length)throw new RangeError("out of range index");if(d>=b&&u>=l)return 0;if(d>=b)return-1;if(u>=l)return 1;if(u>>>=0,l>>>=0,d>>>=0,b>>>=0,this===s)return 0;let I=b-d,H=l-u;const pt=Math.min(I,H),lt=this.slice(d,b),yt=s.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,s,u,l,d){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=d?0:h.length-1),u<0&&(u=h.length+u),u>=h.length){if(d)return-1;u=h.length-1}else if(u<0)if(d)u=0;else return-1;if(typeof s=="string"&&(s=c.from(s,l)),c.isBuffer(s))return s.length===0?-1:O(h,s,u,l,d);if(typeof s=="number")return s=s&255,typeof Uint8Array.prototype.indexOf=="function"?d?Uint8Array.prototype.indexOf.call(h,s,u):Uint8Array.prototype.lastIndexOf.call(h,s,u):O(h,[s],u,l,d);throw new TypeError("val must be string, number or Buffer")}function O(h,s,u,l,d){let b=1,I=h.length,H=s.length;if(l!==void 0&&(l=String(l).toLowerCase(),l==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(h.length<2||s.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(d){let yt=-1;for(lt=u;lt<I;lt++)if(pt(h,lt)===pt(s,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(s,et)){yt=!1;break}if(yt)return lt}return-1}c.prototype.includes=function(s,u,l){return this.indexOf(s,u,l)!==-1},c.prototype.indexOf=function(s,u,l){return A(this,s,u,l,!0)},c.prototype.lastIndexOf=function(s,u,l){return A(this,s,u,l,!1)};function m(h,s,u,l){u=Number(u)||0;const d=h.length-u;l?(l=Number(l),l>d&&(l=d)):l=d;const b=s.length;l>b/2&&(l=b/2);let I;for(I=0;I<l;++I){const H=parseInt(s.substr(I*2,2),16);if(Qt(H))return I;h[u+I]=H}return I}function S(h,s,u,l){return Mt(kt(s,h.length-u),h,u,l)}function w(h,s,u,l){return Mt(Ht(s),h,u,l)}function B(h,s,u,l){return Mt($t(s),h,u,l)}function N(h,s,u,l){return Mt(Vt(s,h.length-u),h,u,l)}c.prototype.write=function(s,u,l,d){if(u===void 0)d="utf8",l=this.length,u=0;else if(l===void 0&&typeof u=="string")d=u,l=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(l)?(l=l>>>0,d===void 0&&(d="utf8")):(d=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),s.length>0&&(l<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");d||(d="utf8");let I=!1;for(;;)switch(d){case"hex":return m(this,s,u,l);case"utf8":case"utf-8":return S(this,s,u,l);case"ascii":case"latin1":case"binary":return w(this,s,u,l);case"base64":return B(this,s,u,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,s,u,l);default:if(I)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),I=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Q(h,s,u){return s===0&&u===h.length?t.fromByteArray(h):t.fromByteArray(h.slice(s,u))}function z(h,s,u){u=Math.min(h.length,u);const l=[];let d=s;for(;d<u;){const b=h[d];let I=null,H=b>239?4:b>223?3:b>191?2:1;if(d+H<=u){let pt,lt,yt,et;switch(H){case 1:b<128&&(I=b);break;case 2:pt=h[d+1],(pt&192)===128&&(et=(b&31)<<6|pt&63,et>127&&(I=et));break;case 3:pt=h[d+1],lt=h[d+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[d+1],lt=h[d+2],yt=h[d+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),d+=H}return D(l)}const L=4096;function D(h){const s=h.length;if(s<=L)return String.fromCharCode.apply(String,h);let u="",l=0;for(;l<s;)u+=String.fromCharCode.apply(String,h.slice(l,l+=L));return u}function Y(h,s,u){let l="";u=Math.min(h.length,u);for(let d=s;d<u;++d)l+=String.fromCharCode(h[d]&127);return l}function Z(h,s,u){let l="";u=Math.min(h.length,u);for(let d=s;d<u;++d)l+=String.fromCharCode(h[d]);return l}function X(h,s,u){const l=h.length;(!s||s<0)&&(s=0),(!u||u<0||u>l)&&(u=l);let d="";for(let b=s;b<u;++b)d+=ir[h[b]];return d}function K(h,s,u){const l=h.slice(s,u);let d="";for(let b=0;b<l.length-1;b+=2)d+=String.fromCharCode(l[b]+l[b+1]*256);return d}c.prototype.slice=function(s,u){const l=this.length;s=~~s,u=u===void 0?l:~~u,s<0?(s+=l,s<0&&(s=0)):s>l&&(s=l),u<0?(u+=l,u<0&&(u=0)):u>l&&(u=l),u<s&&(u=s);const d=this.subarray(s,u);return Object.setPrototypeOf(d,c.prototype),d};function q(h,s,u){if(h%1!==0||h<0)throw new RangeError("offset is not uint");if(h+s>u)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUintLE=c.prototype.readUIntLE=function(s,u,l){s=s>>>0,u=u>>>0,l||q(s,u,this.length);let d=this[s],b=1,I=0;for(;++I<u&&(b*=256);)d+=this[s+I]*b;return d},c.prototype.readUintBE=c.prototype.readUIntBE=function(s,u,l){s=s>>>0,u=u>>>0,l||q(s,u,this.length);let d=this[s+--u],b=1;for(;u>0&&(b*=256);)d+=this[s+--u]*b;return d},c.prototype.readUint8=c.prototype.readUInt8=function(s,u){return s=s>>>0,u||q(s,1,this.length),this[s]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(s,u){return s=s>>>0,u||q(s,2,this.length),this[s]|this[s+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(s,u){return s=s>>>0,u||q(s,2,this.length),this[s]<<8|this[s+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(s,u){return s=s>>>0,u||q(s,4,this.length),(this[s]|this[s+1]<<8|this[s+2]<<16)+this[s+3]*16777216},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(s,u){return s=s>>>0,u||q(s,4,this.length),this[s]*16777216+(this[s+1]<<16|this[s+2]<<8|this[s+3])},c.prototype.readBigUInt64LE=Wt(function(s){s=s>>>0,$(s,"offset");const u=this[s],l=this[s+7];(u===void 0||l===void 0)&&J(s,this.length-8);const d=u+this[++s]*2**8+this[++s]*2**16+this[++s]*2**24,b=this[++s]+this[++s]*2**8+this[++s]*2**16+l*2**24;return BigInt(d)+(BigInt(b)<<BigInt(32))}),c.prototype.readBigUInt64BE=Wt(function(s){s=s>>>0,$(s,"offset");const u=this[s],l=this[s+7];(u===void 0||l===void 0)&&J(s,this.length-8);const d=u*2**24+this[++s]*2**16+this[++s]*2**8+this[++s],b=this[++s]*2**24+this[++s]*2**16+this[++s]*2**8+l;return(BigInt(d)<<BigInt(32))+BigInt(b)}),c.prototype.readIntLE=function(s,u,l){s=s>>>0,u=u>>>0,l||q(s,u,this.length);let d=this[s],b=1,I=0;for(;++I<u&&(b*=256);)d+=this[s+I]*b;return b*=128,d>=b&&(d-=Math.pow(2,8*u)),d},c.prototype.readIntBE=function(s,u,l){s=s>>>0,u=u>>>0,l||q(s,u,this.length);let d=u,b=1,I=this[s+--d];for(;d>0&&(b*=256);)I+=this[s+--d]*b;return b*=128,I>=b&&(I-=Math.pow(2,8*u)),I},c.prototype.readInt8=function(s,u){return s=s>>>0,u||q(s,1,this.length),this[s]&128?(255-this[s]+1)*-1:this[s]},c.prototype.readInt16LE=function(s,u){s=s>>>0,u||q(s,2,this.length);const l=this[s]|this[s+1]<<8;return l&32768?l|4294901760:l},c.prototype.readInt16BE=function(s,u){s=s>>>0,u||q(s,2,this.length);const l=this[s+1]|this[s]<<8;return l&32768?l|4294901760:l},c.prototype.readInt32LE=function(s,u){return s=s>>>0,u||q(s,4,this.length),this[s]|this[s+1]<<8|this[s+2]<<16|this[s+3]<<24},c.prototype.readInt32BE=function(s,u){return s=s>>>0,u||q(s,4,this.length),this[s]<<24|this[s+1]<<16|this[s+2]<<8|this[s+3]},c.prototype.readBigInt64LE=Wt(function(s){s=s>>>0,$(s,"offset");const u=this[s],l=this[s+7];(u===void 0||l===void 0)&&J(s,this.length-8);const d=this[s+4]+this[s+5]*2**8+this[s+6]*2**16+(l<<24);return(BigInt(d)<<BigInt(32))+BigInt(u+this[++s]*2**8+this[++s]*2**16+this[++s]*2**24)}),c.prototype.readBigInt64BE=Wt(function(s){s=s>>>0,$(s,"offset");const u=this[s],l=this[s+7];(u===void 0||l===void 0)&&J(s,this.length-8);const d=(u<<24)+this[++s]*2**16+this[++s]*2**8+this[++s];return(BigInt(d)<<BigInt(32))+BigInt(this[++s]*2**24+this[++s]*2**16+this[++s]*2**8+l)}),c.prototype.readFloatLE=function(s,u){return s=s>>>0,u||q(s,4,this.length),e.read(this,s,!0,23,4)},c.prototype.readFloatBE=function(s,u){return s=s>>>0,u||q(s,4,this.length),e.read(this,s,!1,23,4)},c.prototype.readDoubleLE=function(s,u){return s=s>>>0,u||q(s,8,this.length),e.read(this,s,!0,52,8)},c.prototype.readDoubleBE=function(s,u){return s=s>>>0,u||q(s,8,this.length),e.read(this,s,!1,52,8)};function rt(h,s,u,l,d,b){if(!c.isBuffer(h))throw new TypeError('"buffer" argument must be a Buffer instance');if(s>d||s<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(s,u,l,d){if(s=+s,u=u>>>0,l=l>>>0,!d){const H=Math.pow(2,8*l)-1;rt(this,s,u,l,H,0)}let b=1,I=0;for(this[u]=s&255;++I<l&&(b*=256);)this[u+I]=s/b&255;return u+l},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(s,u,l,d){if(s=+s,u=u>>>0,l=l>>>0,!d){const H=Math.pow(2,8*l)-1;rt(this,s,u,l,H,0)}let b=l-1,I=1;for(this[u+b]=s&255;--b>=0&&(I*=256);)this[u+b]=s/I&255;return u+l},c.prototype.writeUint8=c.prototype.writeUInt8=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,1,255,0),this[u]=s&255,u+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,2,65535,0),this[u]=s&255,this[u+1]=s>>>8,u+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,2,65535,0),this[u]=s>>>8,this[u+1]=s&255,u+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,4,4294967295,0),this[u+3]=s>>>24,this[u+2]=s>>>16,this[u+1]=s>>>8,this[u]=s&255,u+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,4,4294967295,0),this[u]=s>>>24,this[u+1]=s>>>16,this[u+2]=s>>>8,this[u+3]=s&255,u+4};function xt(h,s,u,l,d){j(s,l,d,h,u,7);let b=Number(s&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(s>>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,s,u,l,d){j(s,l,d,h,u,7);let b=Number(s&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(s>>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(s,u=0){return xt(this,s,u,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Wt(function(s,u=0){return Ut(this,s,u,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(s,u,l,d){if(s=+s,u=u>>>0,!d){const pt=Math.pow(2,8*l-1);rt(this,s,u,l,pt-1,-pt)}let b=0,I=1,H=0;for(this[u]=s&255;++b<l&&(I*=256);)s<0&&H===0&&this[u+b-1]!==0&&(H=1),this[u+b]=(s/I>>0)-H&255;return u+l},c.prototype.writeIntBE=function(s,u,l,d){if(s=+s,u=u>>>0,!d){const pt=Math.pow(2,8*l-1);rt(this,s,u,l,pt-1,-pt)}let b=l-1,I=1,H=0;for(this[u+b]=s&255;--b>=0&&(I*=256);)s<0&&H===0&&this[u+b+1]!==0&&(H=1),this[u+b]=(s/I>>0)-H&255;return u+l},c.prototype.writeInt8=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,1,127,-128),s<0&&(s=255+s+1),this[u]=s&255,u+1},c.prototype.writeInt16LE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,2,32767,-32768),this[u]=s&255,this[u+1]=s>>>8,u+2},c.prototype.writeInt16BE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,2,32767,-32768),this[u]=s>>>8,this[u+1]=s&255,u+2},c.prototype.writeInt32LE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,4,2147483647,-2147483648),this[u]=s&255,this[u+1]=s>>>8,this[u+2]=s>>>16,this[u+3]=s>>>24,u+4},c.prototype.writeInt32BE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,4,2147483647,-2147483648),s<0&&(s=4294967295+s+1),this[u]=s>>>24,this[u+1]=s>>>16,this[u+2]=s>>>8,this[u+3]=s&255,u+4},c.prototype.writeBigInt64LE=Wt(function(s,u=0){return xt(this,s,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Wt(function(s,u=0){return Ut(this,s,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Pt(h,s,u,l,d,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,s,u,l,d){return s=+s,u=u>>>0,d||Pt(h,s,u,4),e.write(h,s,u,l,23,4),u+4}c.prototype.writeFloatLE=function(s,u,l){return Zt(this,s,u,!0,l)},c.prototype.writeFloatBE=function(s,u,l){return Zt(this,s,u,!1,l)};function Gt(h,s,u,l,d){return s=+s,u=u>>>0,d||Pt(h,s,u,8),e.write(h,s,u,l,52,8),u+8}c.prototype.writeDoubleLE=function(s,u,l){return Gt(this,s,u,!0,l)},c.prototype.writeDoubleBE=function(s,u,l){return Gt(this,s,u,!1,l)},c.prototype.copy=function(s,u,l,d){if(!c.isBuffer(s))throw new TypeError("argument should be a Buffer");if(l||(l=0),!d&&d!==0&&(d=this.length),u>=s.length&&(u=s.length),u||(u=0),d>0&&d<l&&(d=l),d===l||s.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(d<0)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),s.length-u<d-l&&(d=s.length-u+l);const b=d-l;return this===s&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,l,d):Uint8Array.prototype.set.call(s,this.subarray(l,d),u),b},c.prototype.fill=function(s,u,l,d){if(typeof s=="string"){if(typeof u=="string"?(d=u,u=0,l=this.length):typeof l=="string"&&(d=l,l=this.length),d!==void 0&&typeof d!="string")throw new TypeError("encoding must be a string");if(typeof d=="string"&&!c.isEncoding(d))throw new TypeError("Unknown encoding: "+d);if(s.length===1){const I=s.charCodeAt(0);(d==="utf8"&&I<128||d==="latin1")&&(s=I)}}else typeof s=="number"?s=s&255:typeof s=="boolean"&&(s=Number(s));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,s||(s=0);let b;if(typeof s=="number")for(b=u;b<l;++b)this[b]=s;else{const I=c.isBuffer(s)?s:c.from(s,d),H=I.length;if(H===0)throw new TypeError('The value "'+s+'" is invalid for argument "value"');for(b=0;b<l-u;++b)this[b+u]=I[b%H]}return this};const W={};function y(h,s,u){W[h]=class extends u{constructor(){super(),Object.defineProperty(this,"message",{value:s.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${h}]`,this.stack,delete this.name}get code(){return h}set code(d){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:d,writable:!0})}toString(){return`${this.name} [${h}]: ${this.message}`}}}y("ERR_BUFFER_OUT_OF_BOUNDS",function(h){return h?`${h} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),y("ERR_INVALID_ARG_TYPE",function(h,s){return`The "${h}" argument must be of type number. Received type ${typeof s}`},TypeError),y("ERR_OUT_OF_RANGE",function(h,s,u){let l=`The value of "${h}" is out of range.`,d=u;return Number.isInteger(u)&&Math.abs(u)>2**32?d=_(String(u)):typeof u=="bigint"&&(d=String(u),(u>BigInt(2)**BigInt(32)||u<-(BigInt(2)**BigInt(32)))&&(d=_(d)),d+="n"),l+=` It must be ${s}. Received ${d}`,l},RangeError);function _(h){let s="",u=h.length;const l=h[0]==="-"?1:0;for(;u>=l+4;u-=3)s=`_${h.slice(u-3,u)}${s}`;return`${h.slice(0,u)}${s}`}function E(h,s,u){$(s,"offset"),(h[s]===void 0||h[s+u]===void 0)&&J(s,h.length-(u+1))}function j(h,s,u,l,d,b){if(h>u||h<s){const I=typeof s=="bigint"?"n":"";let H;throw s===0||s===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)}E(l,d,b)}function $(h,s){if(typeof h!="number")throw new W.ERR_INVALID_ARG_TYPE(s,"number",h)}function J(h,s,u){throw Math.floor(h)!==h?($(h,u),new W.ERR_OUT_OF_RANGE("offset","an integer",h)):s<0?new W.ERR_BUFFER_OUT_OF_BOUNDS:new W.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${s}`,h)}const bt=/[^+/0-9A-Za-z-_]/g;function Nt(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,s){s=s||1/0;let u;const l=h.length;let d=null;const b=[];for(let I=0;I<l;++I){if(u=h.charCodeAt(I),u>55295&&u<57344){if(!d){if(u>56319){(s-=3)>-1&&b.push(239,191,189);continue}else if(I+1===l){(s-=3)>-1&&b.push(239,191,189);continue}d=u;continue}if(u<56320){(s-=3)>-1&&b.push(239,191,189),d=u;continue}u=(d-55296<<10|u-56320)+65536}else d&&(s-=3)>-1&&b.push(239,191,189);if(d=null,u<128){if((s-=1)<0)break;b.push(u)}else if(u<2048){if((s-=2)<0)break;b.push(u>>6|192,u&63|128)}else if(u<65536){if((s-=3)<0)break;b.push(u>>12|224,u>>6&63|128,u&63|128)}else if(u<1114112){if((s-=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 s=[];for(let u=0;u<h.length;++u)s.push(h.charCodeAt(u)&255);return s}function Vt(h,s){let u,l,d;const b=[];for(let I=0;I<h.length&&!((s-=2)<0);++I)u=h.charCodeAt(I),l=u>>8,d=u%256,b.push(d),b.push(l);return b}function $t(h){return t.toByteArray(Nt(h))}function Mt(h,s,u,l){let d;for(d=0;d<l&&!(d+u>=s.length||d>=h.length);++d)s[d+u]=h[d];return d}function mt(h,s){return h instanceof s||h!=null&&h.constructor!=null&&h.constructor.name!=null&&h.constructor.name===s.name}function Qt(h){return h!==h}const ir=function(){const h="0123456789abcdef",s=new Array(256);for(let u=0;u<16;++u){const l=u*16;for(let d=0;d<16;++d)s[l+d]=h[u]+h[d]}return s}();function Wt(h){return typeof BigInt>"u"?_i:h}function _i(){throw new Error("BigInt not supported")}}(Mi)),Mi}var nu=Wf();function wi(r){return new Promise((t,e)=>{r.oncomplete=r.onsuccess=()=>t(r.result),r.onabort=r.onerror=()=>e(r.error)})}function iu(r,t){const e=indexedDB.open(r);e.onupgradeneeded=()=>e.result.createObjectStore(t);const n=wi(e);return(o,i)=>n.then(a=>i(a.transaction(t,o).objectStore(t)))}let Fi;function Ms(){return Fi||(Fi=iu("keyval-store","keyval")),Fi}function Zf(r,t=Ms()){return t("readonly",e=>wi(e.get(r)))}function Gf(r,t,e=Ms()){return e("readwrite",n=>(n.put(t,r),wi(n.transaction)))}function Ni(r,t=Ms()){return t("readwrite",e=>(e.delete(r),wi(e.transaction)))}function bn(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 ki={exports:{}},Co;function Yf(){return Co||(Co=1,function(r,t){(function(e){r.exports=e()})(function(){return function e(n,o,i){function a(p,g){if(!o[p]){if(!n[p]){var v=typeof bn=="function"&&bn;if(!g&&v)return v(p,!0);if(c)return c(p,!0);throw new Error("Cannot find module '"+p+"'")}g=o[p]={exports:{}},n[p][0].call(g.exports,function(C){var F=n[p][1][C];return a(F||C)},g,g.exports,e,n,o,i)}return o[p].exports}for(var c=typeof bn=="function"&&bn,f=0;f<i.length;f++)a(i[f]);return a}({1:[function(e,n,o){(function(i,a,c,f,p,g,v,C,F){var T=e("crypto");function U(A,O){O=P(A,O);var m;return(m=O.algorithm!=="passthrough"?T.createHash(O.algorithm):new G).write===void 0&&(m.write=m.update,m.end=m.update),V(O,m).dispatch(A),m.update||m.end(""),m.digest?m.digest(O.encoding==="buffer"?void 0:O.encoding):(A=m.read(),O.encoding!=="buffer"?A.toString(O.encoding):A)}(o=n.exports=U).sha1=function(A){return U(A)},o.keys=function(A){return U(A,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},o.MD5=function(A){return U(A,{algorithm:"md5",encoding:"hex"})},o.keysMD5=function(A){return U(A,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var M=T.getHashes?T.getHashes().slice():["sha1","md5"],k=(M.push("passthrough"),["buffer","hex","binary","base64"]);function P(A,O){var m={};if(m.algorithm=(O=O||{}).algorithm||"sha1",m.encoding=O.encoding||"hex",m.excludeValues=!!O.excludeValues,m.algorithm=m.algorithm.toLowerCase(),m.encoding=m.encoding.toLowerCase(),m.ignoreUnknown=O.ignoreUnknown===!0,m.respectType=O.respectType!==!1,m.respectFunctionNames=O.respectFunctionNames!==!1,m.respectFunctionProperties=O.respectFunctionProperties!==!1,m.unorderedArrays=O.unorderedArrays===!0,m.unorderedSets=O.unorderedSets!==!1,m.unorderedObjects=O.unorderedObjects!==!1,m.replacer=O.replacer||void 0,m.excludeKeys=O.excludeKeys||void 0,A===void 0)throw new Error("Object argument required.");for(var S=0;S<M.length;++S)M[S].toLowerCase()===m.algorithm.toLowerCase()&&(m.algorithm=M[S]);if(M.indexOf(m.algorithm)===-1)throw new Error('Algorithm "'+m.algorithm+'" not supported. supported values: '+M.join(", "));if(k.indexOf(m.encoding)===-1&&m.algorithm!=="passthrough")throw new Error('Encoding "'+m.encoding+'" not supported. supported values: '+k.join(", "));return m}function R(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,O,m){m=m||[];function S(w){return O.update?O.update(w,"utf8"):O.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 B,N=Object.prototype.toString.call(w),Q=/\[object (.*)\]/i.exec(N);if(Q=(Q=Q?Q[1]:"unknown:["+N+"]").toLowerCase(),0<=(N=m.indexOf(w)))return this.dispatch("[CIRCULAR:"+N+"]");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 N=Object.keys(w),A.unorderedObjects&&(N=N.sort()),A.respectType===!1||R(w)||N.splice(0,0,"prototype","__proto__","constructor"),A.excludeKeys&&(N=N.filter(function(z){return!A.excludeKeys(z)})),S("object:"+N.length+":"),B=this,N.forEach(function(z){B.dispatch(z),S(":"),A.excludeValues||B.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 N=this;if(S("array:"+w.length+":"),!z||w.length<=1)return w.forEach(function(L){return N.dispatch(L)});var Q=[],z=w.map(function(L){var D=new G,Y=m.slice();return V(A,D,Y).dispatch(L),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:"),R(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:o})=>o));return new he(e,n.map(o=>new pe(e,o)))}slice(t,e){const n=this.schema;[t,e]=Bc({length:this.numRows},t,e);const o=Ec(this.data,this._offsets,t,e);return new he(n,o.map(i=>new pe(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],o=_t({type:n,length:0,nullCount:0});e.push(o._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(o=>o.name===t),e)}setChildAt(t,e){let n=this.schema,o=[...this.batches];if(t>-1&&t<this.numCols){e||(e=new Ft([_t({type:new Ye,length:this.numRows})]));const i=n.fields.slice(),a=i[t].clone({type:e.type}),c=this.schema.fields.map((f,p)=>this.getChildAt(p));[i[t],c[t]]=[a,e],[n,o]=xi(n,c)}return new he(n,o)}select(t){const e=this.schema.fields.reduce((n,o,i)=>n.set(o.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(o=>o.selectAt(t));return new he(e,n)}assign(t){const e=this.schema.fields,[n,o]=t.schema.fields.reduce((c,f,p)=>{const[g,v]=c,C=e.findIndex(F=>F.name===f.name);return~C?v[C]=p:g.push(p),c},[[],[]]),i=this.schema.assign(t.schema),a=[...e.map((c,f)=>[f,o[f]]).map(([c,f])=>f===void 0?this.getChildAt(c):t.getChildAt(f)),...n.map(c=>t.getChildAt(c))].filter(Boolean);return new he(...xi(i,a))}}Rc=Symbol.toStringTag;he[Rc]=(r=>(r.schema=null,r.batches=[],r._offsets=new Uint32Array([0]),r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,r.isValid=Xn(ws),r.get=Xn(ne.getVisitFn(x.Struct)),r.set=Tc(fe.getVisitFn(x.Struct)),r.indexOf=Oc(Qn.getVisitFn(x.Struct)),"Table"))(he.prototype);var Cc;let pe=class rn{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]=ho(this.schema,this.data.children);break}case 1:{const[e]=t,{fields:n,children:o,length:i}=Object.keys(e).reduce((f,p,g)=>(f.children[g]=e[p],f.length=Math.max(f.length,e[p].length),f.fields[g]=Rt.new({name:p,type:e[p].type,nullable:!0}),f),{length:0,fields:new Array,children:new Array}),a=new vt(n),c=_t({type:new Kt(n),length:i,children:o,nullCount:0});[this.schema,this.data]=ho(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=Pc(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(ys(t,this.numRows))}set(t,e){return fe.visit(this.data,t,e)}indexOf(t,e){return Qn.visit(this.data,t,e)}[Symbol.iterator](){return bs.visit(new Ft([this.data]))}toArray(){return[...this]}concat(...t){return new he(this.schema,[this,...t])}slice(t,e){const[n]=new Ft([this.data]).slice(t,e).data;return new rn(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(o=>o.name===t),e)}setChildAt(t,e){let n=this.schema,o=this.data;if(t>-1&&t<this.numCols){e||(e=new Ft([_t({type:new Ye,length:this.numRows})]));const i=n.fields.slice(),a=o.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)),o=_t({type:new Kt(i),children:a})}return new rn(n,o)}select(t){const e=this.schema.select(t),n=new Kt(e.fields),o=[];for(const i of t){const a=this.schema.fields.findIndex(c=>c.name===i);~a&&(o[a]=this.data.children[a])}return new rn(e,_t({type:n,length:this.numRows,children:o}))}selectAt(t){const e=this.schema.selectAt(t),n=t.map(i=>this.data.children[i]).filter(Boolean),o=_t({type:new Kt(e.fields),length:this.numRows,children:n});return new rn(e,o)}};Cc=Symbol.toStringTag;pe[Cc]=(r=>(r._nullCount=-1,r[Symbol.isConcatSpreadable]=!0,"RecordBatch"))(pe.prototype);function ho(r,t,e=t.reduce((n,o)=>Math.max(n,o.length),0)){var n;const o=[...r.fields],i=[...t],a=(e+63&-64)>>3;for(const[c,f]of r.fields.entries()){const p=t[c];(!p||p.length!==e)&&(o[c]=f.clone({nullable:!0}),i[c]=(n=p?._changeLengthAndBackfillNullBitmap(e))!==null&&n!==void 0?n:_t({type:f.type,length:e,nullCount:e,nullBitmap:new Uint8Array(a)}))}return[r.assign(o),_t({type:new Kt(o),length:e,children:i})]}function Pc(r,t,e=new Map){var n,o;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],f=t[i];for(const p of[f,...((o=f?.dictionary)===null||o===void 0?void 0:o.data)||[]])Pc(c.children,p?.children,e);if(tt.isDictionary(c)){const{id:p}=c;if(!e.has(p))f?.dictionary&&e.set(p,f.dictionary);else if(e.get(p)!==f.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return e}class $c extends pe{constructor(t){const e=t.fields.map(o=>_t({type:o.type})),n=_t({type:new Kt(t.fields),nullCount:0,children:e});super(t,n)}}let ze=class be{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 be).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,e){return t.setPosition(t.position()+At),(e||new be).__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,o,i,a){return be.startMessage(t),be.addVersion(t,e),be.addHeaderType(t,n),be.addHeader(t,o),be.addBodyLength(t,i),be.addCustomMetadata(t,a),be.endMessage(t)}};class Kl extends St{visit(t,e){return t==null||e==null?void 0:super.visit(t,e)}visitNull(t,e){return to.startNull(e),to.endNull(e)}visitInt(t,e){return se.startInt(e),se.addBitWidth(e,t.bitWidth),se.addIsSigned(e,t.isSigned),se.endInt(e)}visitFloat(t,e){return Be.startFloatingPoint(e),Be.addPrecision(e,t.precision),Be.endFloatingPoint(e)}visitBinary(t,e){return Hs.startBinary(e),Hs.endBinary(e)}visitLargeBinary(t,e){return Ks.startLargeBinary(e),Ks.endLargeBinary(e)}visitBool(t,e){return qs.startBool(e),qs.endBool(e)}visitUtf8(t,e){return eo.startUtf8(e),eo.endUtf8(e)}visitLargeUtf8(t,e){return Xs.startLargeUtf8(e),Xs.endLargeUtf8(e)}visitDecimal(t,e){return cr.startDecimal(e),cr.addScale(e,t.scale),cr.addPrecision(e,t.precision),cr.addBitWidth(e,t.bitWidth),cr.endDecimal(e)}visitDate(t,e){return In.startDate(e),In.addUnit(e,t.unit),In.endDate(e)}visitTime(t,e){return ce.startTime(e),ce.addUnit(e,t.unit),ce.addBitWidth(e,t.bitWidth),ce.endTime(e)}visitTimestamp(t,e){const n=t.timezone&&e.createString(t.timezone)||void 0;return ue.startTimestamp(e),ue.addUnit(e,t.unit),n!==void 0&&ue.addTimezone(e,n),ue.endTimestamp(e)}visitInterval(t,e){return ve.startInterval(e),ve.addUnit(e,t.unit),ve.endInterval(e)}visitDuration(t,e){return Bn.startDuration(e),Bn.addUnit(e,t.unit),Bn.endDuration(e)}visitList(t,e){return Qs.startList(e),Qs.endList(e)}visitStruct(t,e){return Xe.startStruct_(e),Xe.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 ke.startDictionaryEncoding(e),ke.addId(e,BigInt(t.id)),ke.addIsOrdered(e,t.isOrdered),n!==void 0&&ke.addIndexType(e,n),ke.endDictionaryEncoding(e)}visitFixedSizeBinary(t,e){return vn.startFixedSizeBinary(e),vn.addByteWidth(e,t.byteWidth),vn.endFixedSizeBinary(e)}visitFixedSizeList(t,e){return An.startFixedSizeList(e),An.addListSize(e,t.listSize),An.endFixedSizeList(e)}visitMap(t,e){return xn.startMap(e),xn.addKeysSorted(e,t.keysSorted),xn.endMap(e)}}const Ei=new Kl;function Xl(r,t=new Map){return new vt(tf(r,t),Tn(r.metadata),t)}function zc(r){return new me(r.count,jc(r.columns),Vc(r.columns))}function Ql(r){return new Le(zc(r.data),r.id,r.isDelta)}function tf(r,t){return(r.fields||[]).filter(Boolean).map(e=>Rt.fromJSON(e,t))}function lo(r,t){return(r.children||[]).filter(Boolean).map(e=>Rt.fromJSON(e,t))}function jc(r){return(r||[]).reduce((t,e)=>[...t,new Nr(e.count,ef(e.VALIDITY)),...jc(e.children)],[])}function Vc(r,t=[]){for(let e=-1,n=(r||[]).length;++e<n;){const o=r[e];o.VALIDITY&&t.push(new De(t.length,o.VALIDITY.length)),o.TYPE_ID&&t.push(new De(t.length,o.TYPE_ID.length)),o.OFFSET&&t.push(new De(t.length,o.OFFSET.length)),o.DATA&&t.push(new De(t.length,o.DATA.length)),t=Vc(o.children,t)}return t}function ef(r){return(r||[]).reduce((t,e)=>t+ +(e===0),0)}function rf(r,t){let e,n,o,i,a,c;return!t||!(i=r.dictionary)?(a=po(r,lo(r,t)),o=new Rt(r.name,a,r.nullable,Tn(r.metadata))):t.has(e=i.id)?(n=(n=i.indexType)?fo(n):new un,c=new xr(t.get(e),n,e,i.isOrdered),o=new Rt(r.name,c,r.nullable,Tn(r.metadata))):(n=(n=i.indexType)?fo(n):new un,t.set(e,a=po(r,lo(r,t))),c=new xr(a,n,e,i.isOrdered),o=new Rt(r.name,c,r.nullable,Tn(r.metadata))),o||null}function Tn(r=[]){return new Map(r.map(({key:t,value:e})=>[t,e]))}function fo(r){return new tr(r.isSigned,r.bitWidth)}function po(r,t){const e=r.type.name;switch(e){case"NONE":return new Ye;case"null":return new Ye;case"binary":return new Ln;case"largebinary":return new Rn;case"utf8":return new Cn;case"largeutf8":return new Pn;case"bool":return new $n;case"list":return new Yn((t||[])[0]);case"struct":return new Kt(t||[]);case"struct_":return new Kt(t||[])}switch(e){case"int":{const n=r.type;return new tr(n.isSigned,n.bitWidth)}case"floatingpoint":{const n=r.type;return new Un(Jt[n.precision])}case"decimal":{const n=r.type;return new zn(n.scale,n.precision,n.bitWidth)}case"date":{const n=r.type;return new jn(le[n.unit])}case"time":{const n=r.type;return new Vn(at[n.unit],n.bitWidth)}case"timestamp":{const n=r.type;return new Wn(at[n.unit],n.timezone)}case"interval":{const n=r.type;return new Zn(Ee[n.unit])}case"duration":{const n=r.type;return new Gn(at[n.unit])}case"union":{const n=r.type,[o,...i]=(n.mode+"").toLowerCase(),a=o.toUpperCase()+i.join("");return new Jn(re[a],n.typeIds||[],t||[])}case"fixedsizebinary":{const n=r.type;return new Hn(n.byteWidth)}case"fixedsizelist":{const n=r.type;return new qn(n.listSize,(t||[])[0])}case"map":{const n=r.type;return new Kn((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${e}"`)}var nf=na,sf=vr;class ye{static fromJSON(t,e){const n=new ye(0,zt.V5,e);return n._createHeader=of(t,e),n}static decode(t){t=new sf(It(t));const e=ze.getRootAsMessage(t),n=e.bodyLength(),o=e.version(),i=e.headerType(),a=new ye(n,o,i);return a._createHeader=af(e,i),a}static encode(t){const e=new nf;let n=-1;return t.isSchema()?n=vt.encode(e,t.header()):t.isRecordBatch()?n=me.encode(e,t.header()):t.isDictionaryBatch()&&(n=Le.encode(e,t.header())),ze.startMessage(e),ze.addVersion(e,zt.V5),ze.addHeader(e,n),ze.addHeaderType(e,t.headerType),ze.addBodyLength(e,BigInt(t.bodyLength)),ze.finishMessageBuffer(e,ze.endMessage(e)),e.asUint8Array()}static from(t,e=0){if(t instanceof vt)return new ye(0,zt.V5,Bt.Schema,t);if(t instanceof me)return new ye(e,zt.V5,Bt.RecordBatch,t);if(t instanceof Le)return new ye(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,o){this._version=e,this._headerType=n,this.body=new Uint8Array(0),o&&(this._createHeader=()=>o),this._bodyLength=Lt(t)}}class me{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 Le{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 De{constructor(t,e){this.offset=Lt(t),this.length=Lt(e)}}class Nr{constructor(t,e){this.length=Lt(t),this.nullCount=Lt(e)}}function of(r,t){return()=>{switch(t){case Bt.Schema:return vt.fromJSON(r);case Bt.RecordBatch:return me.fromJSON(r);case Bt.DictionaryBatch:return Le.fromJSON(r)}throw new Error(`Unrecognized Message type: { name: ${Bt[t]}, type: ${t} }`)}}function af(r,t){return()=>{switch(t){case Bt.Schema:return vt.decode(r.header(new _e),new Map,r.version());case Bt.RecordBatch:return me.decode(r.header(new Oe),r.version());case Bt.DictionaryBatch:return Le.decode(r.header(new or),r.version())}throw new Error(`Unrecognized Message type: { name: ${Bt[t]}, type: ${t} }`)}}Rt.encode=wf;Rt.decode=gf;Rt.fromJSON=rf;vt.encode=mf;vt.decode=cf;vt.fromJSON=Xl;me.encode=bf;me.decode=uf;me.fromJSON=zc;Le.encode=_f;Le.decode=hf;Le.fromJSON=Ql;Nr.encode=Sf;Nr.decode=ff;De.encode=If;De.decode=lf;function cf(r,t=new Map,e=zt.V5){const n=yf(r,t);return new vt(n,On(r),t,e)}function uf(r,t=zt.V5){if(r.compression()!==null)throw new Error("Record batch compression not implemented");return new me(r.length(),df(r),pf(r,t))}function hf(r,t=zt.V5){return new Le(me.decode(r.data(),t),r.id(),r.isDelta())}function lf(r){return new De(r.offset(),r.length())}function ff(r){return new Nr(r.length(),r.nullCount())}function df(r){const t=[];for(let e,n=-1,o=-1,i=r.nodesLength();++n<i;)(e=r.nodes(n))&&(t[++o]=Nr.decode(e));return t}function pf(r,t){const e=[];for(let n,o=-1,i=-1,a=r.buffersLength();++o<a;)(n=r.buffers(o))&&(t<zt.V4&&(n.bb_pos+=8*(o+1)),e[++i]=De.decode(n));return e}function yf(r,t){const e=[];for(let n,o=-1,i=-1,a=r.fieldsLength();++o<a;)(n=r.fields(o))&&(e[++i]=Rt.decode(n,t));return e}function yo(r,t){const e=[];for(let n,o=-1,i=-1,a=r.childrenLength();++o<a;)(n=r.children(o))&&(e[++i]=Rt.decode(n,t));return e}function gf(r,t){let e,n,o,i,a,c;return!t||!(c=r.dictionary())?(o=mo(r,yo(r,t)),n=new Rt(r.name(),o,r.nullable(),On(r))):t.has(e=Lt(c.id()))?(i=(i=c.indexType())?go(i):new un,a=new xr(t.get(e),i,e,c.isOrdered()),n=new Rt(r.name(),a,r.nullable(),On(r))):(i=(i=c.indexType())?go(i):new un,t.set(e,o=mo(r,yo(r,t))),a=new xr(o,i,e,c.isOrdered()),n=new Rt(r.name(),a,r.nullable(),On(r))),n||null}function On(r){const t=new Map;if(r)for(let e,n,o=-1,i=Math.trunc(r.customMetadataLength());++o<i;)(e=r.customMetadata(o))&&(n=e.key())!=null&&t.set(n,e.value());return t}function go(r){return new tr(r.isSigned(),r.bitWidth())}function mo(r,t){const e=r.typeType();switch(e){case Dt.NONE:return new Ye;case Dt.Null:return new Ye;case Dt.Binary:return new Ln;case Dt.LargeBinary:return new Rn;case Dt.Utf8:return new Cn;case Dt.LargeUtf8:return new Pn;case Dt.Bool:return new $n;case Dt.List:return new Yn((t||[])[0]);case Dt.Struct_:return new Kt(t||[])}switch(e){case Dt.Int:{const n=r.type(new se);return new tr(n.isSigned(),n.bitWidth())}case Dt.FloatingPoint:{const n=r.type(new Be);return new Un(n.precision())}case Dt.Decimal:{const n=r.type(new cr);return new zn(n.scale(),n.precision(),n.bitWidth())}case Dt.Date:{const n=r.type(new In);return new jn(n.unit())}case Dt.Time:{const n=r.type(new ce);return new Vn(n.unit(),n.bitWidth())}case Dt.Timestamp:{const n=r.type(new ue);return new Wn(n.unit(),n.timezone())}case Dt.Interval:{const n=r.type(new ve);return new Zn(n.unit())}case Dt.Duration:{const n=r.type(new Bn);return new Gn(n.unit())}case Dt.Union:{const n=r.type(new ee);return new Jn(n.mode(),n.typeIdsArray()||[],t||[])}case Dt.FixedSizeBinary:{const n=r.type(new vn);return new Hn(n.byteWidth())}case Dt.FixedSizeList:{const n=r.type(new An);return new qn(n.listSize(),(t||[])[0])}case Dt.Map:{const n=r.type(new xn);return new Kn((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${Dt[e]}" (${e})`)}function mf(r,t){const e=t.fields.map(i=>Rt.encode(r,i));_e.startFieldsVector(r,e.length);const n=_e.createFieldsVector(r,e),o=t.metadata&&t.metadata.size>0?_e.createCustomMetadataVector(r,[...t.metadata].map(([i,a])=>{const c=r.createString(`${i}`),f=r.createString(`${a}`);return jt.startKeyValue(r),jt.addKey(r,c),jt.addValue(r,f),jt.endKeyValue(r)})):-1;return _e.startSchema(r),_e.addFields(r,n),_e.addEndianness(r,Bf?Ar.Little:Ar.Big),o!==-1&&_e.addCustomMetadata(r,o),_e.endSchema(r)}function wf(r,t){let e=-1,n=-1,o=-1;const i=t.type;let a=t.typeId;tt.isDictionary(i)?(a=i.dictionary.typeId,o=Ei.visit(i,r),n=Ei.visit(i.dictionary,r)):n=Ei.visit(i,r);const c=(i.children||[]).map(g=>Rt.encode(r,g)),f=oe.createChildrenVector(r,c),p=t.metadata&&t.metadata.size>0?oe.createCustomMetadataVector(r,[...t.metadata].map(([g,v])=>{const C=r.createString(`${g}`),F=r.createString(`${v}`);return jt.startKeyValue(r),jt.addKey(r,C),jt.addValue(r,F),jt.endKeyValue(r)})):-1;return t.name&&(e=r.createString(t.name)),oe.startField(r),oe.addType(r,n),oe.addTypeType(r,a),oe.addChildren(r,f),oe.addNullable(r,!!t.nullable),e!==-1&&oe.addName(r,e),o!==-1&&oe.addDictionary(r,o),p!==-1&&oe.addCustomMetadata(r,p),oe.endField(r)}function bf(r,t){const e=t.nodes||[],n=t.buffers||[];Oe.startNodesVector(r,e.length);for(const a of e.slice().reverse())Nr.encode(r,a);const o=r.endVector();Oe.startBuffersVector(r,n.length);for(const a of n.slice().reverse())De.encode(r,a);const i=r.endVector();return Oe.startRecordBatch(r),Oe.addLength(r,BigInt(t.length)),Oe.addNodes(r,o),Oe.addBuffers(r,i),Oe.endRecordBatch(r)}function _f(r,t){const e=me.encode(r,t.data);return or.startDictionaryBatch(r),or.addId(r,BigInt(t.id)),or.addIsDelta(r,t.isDelta),or.addData(r,e),or.endDictionaryBatch(r)}function Sf(r,t){return oa.createFieldNode(r,BigInt(t.length),BigInt(t.nullCount))}function If(r,t){return sa.createBuffer(r,BigInt(t.offset),BigInt(t.length))}const Bf=(()=>{const r=new ArrayBuffer(2);return new DataView(r).setInt16(0,256,!0),new Int16Array(r)[0]===256})(),As=r=>`Expected ${Bt[r]} Message in stream, but was null or length 0.`,xs=r=>`Header pointer of flatbuffer-encoded ${Bt[r]} Message is null or length 0.`,Wc=(r,t)=>`Expected to read ${r} metadata bytes, but only read ${t}.`,Zc=(r,t)=>`Expected to read ${r} bytes for message body, but only read ${t}.`;class Gc{constructor(t){this.source=t instanceof ei?t:new ei(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?Ct: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(As(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(Zc(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),o=n?.header();if(t&&!o)throw new Error(xs(e));return o}readMetadataLength(){const t=this.source.read(mi),e=t&&new vr(t),n=e?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){const e=this.source.read(t);if(!e)return Ct;if(e.byteLength<t)throw new Error(Wc(t,e.byteLength));return{done:!1,value:ye.decode(e)}}}class vf{constructor(t,e){this.source=t instanceof Tr?t:Ko(t)?new ri(t,e):new Tr(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?Ct: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(As(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(Zc(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),o=n?.header();if(t&&!o)throw new Error(xs(e));return o})}readMetadataLength(){return gt(this,void 0,void 0,function*(){const t=yield this.source.read(mi),e=t&&new vr(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 Ct;if(e.byteLength<t)throw new Error(Wc(t,e.byteLength));return{done:!1,value:ye.decode(e)}})}}class Af extends Gc{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof co?t:new co(t)}next(){const{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:ye.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:ye.fromJSON(e,Bt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){const e=t.batches[this._batchIndex++];return this._body=e.columns,{done:!1,value:ye.fromJSON(e,Bt.RecordBatch)}}return this._body=[],Ct}readMessageBody(t){return e(this._body);function e(n){return(n||[]).reduce((o,i)=>[...o,...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(As(t));return e.value}readSchema(){const t=Bt.Schema,e=this.readMessage(t),n=e?.header();if(!e||!n)throw new Error(xs(t));return n}}const mi=4,Ji="ARROW1",ni=new Uint8Array(Ji.length);for(let r=0;r<Ji.length;r+=1)ni[r]=Ji.codePointAt(r);function Es(r,t=0){for(let e=-1,n=ni.length;++e<n;)if(ni[e]!==r[t+e])return!1;return!0}const pn=ni.length,Yc=pn+mi,xf=pn*2+mi;class Ue extends Dc{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 sn(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 ae.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return ae.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 Ue?t:Ci(t)?Mf(t):Ko(t)?kf(t):sn(t)?gt(this,void 0,void 0,function*(){return yield Ue.from(yield t)}):Xo(t)||us(t)||ta(t)||cs(t)?Nf(new Tr(t)):Ff(new ei(t))}static readAll(t){return t instanceof Ue?t.isSync()?wo(t):bo(t):Ci(t)||ArrayBuffer.isView(t)||pi(t)||qo(t)?wo(t):bo(t)}}class ii extends Ue{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*Sn(wr(this[Symbol.iterator]())))})}}class si extends Ue{constructor(t){super(t),this._impl=t}readAll(){return gt(this,void 0,void 0,function*(){var t,e,n,o;const i=new Array;try{for(var a=!0,c=wr(this),f;f=yield c.next(),t=f.done,!t;a=!0){o=f.value,a=!1;const p=o;i.push(p)}}catch(p){e={error:p}}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 Jc extends ii{constructor(t){super(t),this._impl=t}}class Ef extends si{constructor(t){super(t),this._impl=t}}class Hc{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),o=_t({type:new Kt(this.schema.fields),length:t.length,children:n});return new pe(this.schema,o)}_loadDictionaryBatch(t,e){const{id:n,isDelta:o}=t,{dictionaries:i,schema:a}=this,c=i.get(n),f=a.dictionaries.get(n),p=this._loadVectors(t.data,e,[f]);return(c&&o?c.concat(new Ft(p)):new Ft(p)).memoize()}_loadVectors(t,e,n){return new Lc(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}}class oi extends Hc{constructor(t,e){super(e),this._reader=Ci(t)?new Af(this._handle=t):new Gc(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=Kc(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):Ct}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):Ct}next(){if(this.closed)return Ct;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(),o=e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,o)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),o=e.readMessageBody(t.bodyLength),i=this._loadDictionaryBatch(n,o);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new $c(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}}class ai extends Hc{constructor(t,e){super(e),this._reader=new vf(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=Kc(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):Ct})}return(t){return gt(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):Ct})}next(){return gt(this,void 0,void 0,function*(){if(this.closed)return Ct;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(),o=yield e.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,o)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;const n=t.header(),o=yield e.readMessageBody(t.bodyLength),i=this._loadDictionaryBatch(n,o);this.dictionaries.set(n.id,i)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new $c(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return gt(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}}class qc extends oi{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 uo?t:new uo(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 o=this._reader.readMessage(Bt.RecordBatch);if(o?.isRecordBatch()){const i=o.header(),a=this._reader.readMessageBody(o.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 o=this._reader.readMessage(Bt.DictionaryBatch);if(o?.isDictionaryBatch()){const i=o.header(),a=this._reader.readMessageBody(o.bodyLength),c=this._loadDictionaryBatch(i,a);this.dictionaries.set(i.id,c)}}}_readFooter(){const{_handle:t}=this,e=t.size-Yc,n=t.readInt32(e),o=t.readAt(e-n,n);return _s.decode(o)}_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 Tf extends ai{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,o=e[0]instanceof Map?e.shift():void 0;super(t instanceof ri?t:new ri(t,n),o)}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 o=yield this._reader.readMessage(Bt.RecordBatch);if(o?.isRecordBatch()){const i=o.header(),a=yield this._reader.readMessageBody(o.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 o=yield this._reader.readMessage(Bt.DictionaryBatch);if(o?.isDictionaryBatch()){const i=o.header(),a=yield this._reader.readMessageBody(o.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-Yc,n=yield t.readInt32(e),o=yield t.readAt(e-n,n);return _s.decode(o)})}_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 Of extends oi{constructor(t,e){super(t,e)}_loadVectors(t,e,n){return new $l(e,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion).visitMany(n)}}function Kc(r,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:r.autoDestroy}function*wo(r){const t=Ue.from(r);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function bo(r){return Ae(this,arguments,function*(){const e=yield wt(Ue.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 Mf(r){return new ii(new Of(r))}function Ff(r){const t=r.peek(pn+7&-8);return t&&t.byteLength>=4?Es(t)?new Jc(new qc(r.read())):new ii(new oi(r)):new ii(new oi(function*(){}()))}function Nf(r){return gt(this,void 0,void 0,function*(){const t=yield r.peek(pn+7&-8);return t&&t.byteLength>=4?Es(t)?new Jc(new qc(yield r.read())):new si(new ai(r)):new si(new ai(function(){return Ae(this,arguments,function*(){})}()))})}function kf(r){return gt(this,void 0,void 0,function*(){const{size:t}=yield r.stat(),e=new ri(r,t);return t>=xf&&Es(yield e.readAt(0,pn+7&-8))?new Ef(new Tf(e)):new si(new ai(e))})}function Xc(r){const t=Ue.from(r);return sn(t)?t.then(e=>Xc(e)):t.isAsync()?t.readAll().then(e=>new he(e)):new he(t.readAll())}function Ts(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Ti={},Dr={},Oi={},Ur={},_o;function Qc(){if(_o)return Ur;_o=1,Ur.byteLength=c,Ur.toByteArray=p,Ur.fromByteArray=C;for(var r=[],t=[],e=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,i=n.length;o<i;++o)r[o]=n[o],t[n.charCodeAt(o)]=o;t[45]=62,t[95]=63;function a(F){var T=F.length;if(T%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var U=F.indexOf("=");U===-1&&(U=T);var M=U===T?0:4-U%4;return[U,M]}function c(F){var T=a(F),U=T[0],M=T[1];return(U+M)*3/4-M}function f(F,T,U){return(T+U)*3/4-U}function p(F){var T,U=a(F),M=U[0],k=U[1],P=new e(f(F,M,k)),R=0,V=k>0?M-4:M,G;for(G=0;G<V;G+=4)T=t[F.charCodeAt(G)]<<18|t[F.charCodeAt(G+1)]<<12|t[F.charCodeAt(G+2)]<<6|t[F.charCodeAt(G+3)],P[R++]=T>>16&255,P[R++]=T>>8&255,P[R++]=T&255;return k===2&&(T=t[F.charCodeAt(G)]<<2|t[F.charCodeAt(G+1)]>>4,P[R++]=T&255),k===1&&(T=t[F.charCodeAt(G)]<<10|t[F.charCodeAt(G+1)]<<4|t[F.charCodeAt(G+2)]>>2,P[R++]=T>>8&255,P[R++]=T&255),P}function g(F){return r[F>>18&63]+r[F>>12&63]+r[F>>6&63]+r[F&63]}function v(F,T,U){for(var M,k=[],P=T;P<U;P+=3)M=(F[P]<<16&16711680)+(F[P+1]<<8&65280)+(F[P+2]&255),k.push(g(M));return k.join("")}function C(F){for(var T,U=F.length,M=U%3,k=[],P=16383,R=0,V=U-M;R<V;R+=P)k.push(v(F,R,R+P>V?V:R+P));return M===1?(T=F[U-1],k.push(r[T>>2]+r[T<<4&63]+"==")):M===2&&(T=(F[U-2]<<8)+F[U-1],k.push(r[T>>10]+r[T>>4&63]+r[T<<2&63]+"=")),k.join("")}return Ur}var wn={};var So;function tu(){return So||(So=1,wn.read=function(r,t,e,n,o){var i,a,c=o*8-n-1,f=(1<<c)-1,p=f>>1,g=-7,v=e?o-1:0,C=e?-1:1,F=r[t+v];for(v+=C,i=F&(1<<-g)-1,F>>=-g,g+=c;g>0;i=i*256+r[t+v],v+=C,g-=8);for(a=i&(1<<-g)-1,i>>=-g,g+=n;g>0;a=a*256+r[t+v],v+=C,g-=8);if(i===0)i=1-p;else{if(i===f)return a?NaN:(F?-1:1)*(1/0);a=a+Math.pow(2,n),i=i-p}return(F?-1:1)*a*Math.pow(2,i-n)},wn.write=function(r,t,e,n,o,i){var a,c,f,p=i*8-o-1,g=(1<<p)-1,v=g>>1,C=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,F=n?0:i-1,T=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=g):(a=Math.floor(Math.log(t)/Math.LN2),t*(f=Math.pow(2,-a))<1&&(a--,f*=2),a+v>=1?t+=C/f:t+=C*Math.pow(2,1-v),t*f>=2&&(a++,f/=2),a+v>=g?(c=0,a=g):a+v>=1?(c=(t*f-1)*Math.pow(2,o),a=a+v):(c=t*Math.pow(2,v-1)*Math.pow(2,o),a=0));o>=8;r[e+F]=c&255,F+=T,c/=256,o-=8);for(a=a<<o|c,p+=o;p>0;r[e+F]=a&255,F+=T,a/=256,p-=8);r[e+F-T]|=U*128}),wn}var Io;function Os(){return Io||(Io=1,function(r){const t=Qc(),e=tu(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=c,r.SlowBuffer=P,r.INSPECT_MAX_BYTES=50;const o=2147483647;r.kMaxLength=o,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),s={foo:function(){return 42}};return Object.setPrototypeOf(s,Uint8Array.prototype),Object.setPrototypeOf(h,s),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>o)throw new RangeError('The value "'+h+'" is invalid for option "size"');const s=new Uint8Array(h);return Object.setPrototypeOf(s,c.prototype),s}function c(h,s,u){if(typeof h=="number"){if(typeof s=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return v(h)}return f(h,s,u)}c.poolSize=8192;function f(h,s,u){if(typeof h=="string")return C(h,s);if(ArrayBuffer.isView(h))return T(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,s,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,s,u);const d=M(h);if(d)return d;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof h[Symbol.toPrimitive]=="function")return c.from(h[Symbol.toPrimitive]("string"),s,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,s,u){return f(h,s,u)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array);function p(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 g(h,s,u){return p(h),h<=0?a(h):s!==void 0?typeof u=="string"?a(h).fill(s,u):a(h).fill(s):a(h)}c.alloc=function(h,s,u){return g(h,s,u)};function v(h){return p(h),a(h<0?0:k(h)|0)}c.allocUnsafe=function(h){return v(h)},c.allocUnsafeSlow=function(h){return v(h)};function C(h,s){if((typeof s!="string"||s==="")&&(s="utf8"),!c.isEncoding(s))throw new TypeError("Unknown encoding: "+s);const u=R(h,s)|0;let l=a(u);const d=l.write(h,s);return d!==u&&(l=l.slice(0,d)),l}function F(h){const s=h.length<0?0:k(h.length)|0,u=a(s);for(let l=0;l<s;l+=1)u[l]=h[l]&255;return u}function T(h){if(mt(h,Uint8Array)){const s=new Uint8Array(h);return U(s.buffer,s.byteOffset,s.byteLength)}return F(h)}function U(h,s,u){if(s<0||h.byteLength<s)throw new RangeError('"offset" is outside of buffer bounds');if(h.byteLength<s+(u||0))throw new RangeError('"length" is outside of buffer bounds');let l;return s===void 0&&u===void 0?l=new Uint8Array(h):u===void 0?l=new Uint8Array(h,s):l=new Uint8Array(h,s,u),Object.setPrototypeOf(l,c.prototype),l}function M(h){if(c.isBuffer(h)){const s=k(h.length)|0,u=a(s);return u.length===0||h.copy(u,0,0,s),u}if(h.length!==void 0)return typeof h.length!="number"||Qt(h.length)?a(0):F(h);if(h.type==="Buffer"&&Array.isArray(h.data))return F(h.data)}function k(h){if(h>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return h|0}function P(h){return+h!=h&&(h=0),c.alloc(+h)}c.isBuffer=function(s){return s!=null&&s._isBuffer===!0&&s!==c.prototype},c.compare=function(s,u){if(mt(s,Uint8Array)&&(s=c.from(s,s.offset,s.byteLength)),mt(u,Uint8Array)&&(u=c.from(u,u.offset,u.byteLength)),!c.isBuffer(s)||!c.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(s===u)return 0;let l=s.length,d=u.length;for(let b=0,I=Math.min(l,d);b<I;++b)if(s[b]!==u[b]){l=s[b],d=u[b];break}return l<d?-1:d<l?1:0},c.isEncoding=function(s){switch(String(s).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(s,u){if(!Array.isArray(s))throw new TypeError('"list" argument must be an Array of Buffers');if(s.length===0)return c.alloc(0);let l;if(u===void 0)for(u=0,l=0;l<s.length;++l)u+=s[l].length;const d=c.allocUnsafe(u);let b=0;for(l=0;l<s.length;++l){let I=s[l];if(mt(I,Uint8Array))b+I.length>d.length?(c.isBuffer(I)||(I=c.from(I)),I.copy(d,b)):Uint8Array.prototype.set.call(d,I,b);else if(c.isBuffer(I))I.copy(d,b);else throw new TypeError('"list" argument must be an Array of Buffers');b+=I.length}return d};function R(h,s){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 d=!1;for(;;)switch(s){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(d)return l?-1:kt(h).length;s=(""+s).toLowerCase(),d=!0}}c.byteLength=R;function V(h,s,u){let l=!1;if((s===void 0||s<0)&&(s=0),s>this.length||((u===void 0||u>this.length)&&(u=this.length),u<=0)||(u>>>=0,s>>>=0,u<=s))return"";for(h||(h="utf8");;)switch(h){case"hex":return X(this,s,u);case"utf8":case"utf-8":return z(this,s,u);case"ascii":return Y(this,s,u);case"latin1":case"binary":return Z(this,s,u);case"base64":return Q(this,s,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K(this,s,u);default:if(l)throw new TypeError("Unknown encoding: "+h);h=(h+"").toLowerCase(),l=!0}}c.prototype._isBuffer=!0;function G(h,s,u){const l=h[s];h[s]=h[u],h[u]=l}c.prototype.swap16=function(){const s=this.length;if(s%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let u=0;u<s;u+=2)G(this,u,u+1);return this},c.prototype.swap32=function(){const s=this.length;if(s%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let u=0;u<s;u+=4)G(this,u,u+3),G(this,u+1,u+2);return this},c.prototype.swap64=function(){const s=this.length;if(s%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let u=0;u<s;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 s=this.length;return s===0?"":arguments.length===0?z(this,0,s):V.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(s){if(!c.isBuffer(s))throw new TypeError("Argument must be a Buffer");return this===s?!0:c.compare(this,s)===0},c.prototype.inspect=function(){let s="";const u=r.INSPECT_MAX_BYTES;return s=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(s+=" ... "),"<Buffer "+s+">"},n&&(c.prototype[n]=c.prototype.inspect),c.prototype.compare=function(s,u,l,d,b){if(mt(s,Uint8Array)&&(s=c.from(s,s.offset,s.byteLength)),!c.isBuffer(s))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof s);if(u===void 0&&(u=0),l===void 0&&(l=s?s.length:0),d===void 0&&(d=0),b===void 0&&(b=this.length),u<0||l>s.length||d<0||b>this.length)throw new RangeError("out of range index");if(d>=b&&u>=l)return 0;if(d>=b)return-1;if(u>=l)return 1;if(u>>>=0,l>>>=0,d>>>=0,b>>>=0,this===s)return 0;let I=b-d,H=l-u;const pt=Math.min(I,H),lt=this.slice(d,b),yt=s.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,s,u,l,d){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=d?0:h.length-1),u<0&&(u=h.length+u),u>=h.length){if(d)return-1;u=h.length-1}else if(u<0)if(d)u=0;else return-1;if(typeof s=="string"&&(s=c.from(s,l)),c.isBuffer(s))return s.length===0?-1:O(h,s,u,l,d);if(typeof s=="number")return s=s&255,typeof Uint8Array.prototype.indexOf=="function"?d?Uint8Array.prototype.indexOf.call(h,s,u):Uint8Array.prototype.lastIndexOf.call(h,s,u):O(h,[s],u,l,d);throw new TypeError("val must be string, number or Buffer")}function O(h,s,u,l,d){let b=1,I=h.length,H=s.length;if(l!==void 0&&(l=String(l).toLowerCase(),l==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(h.length<2||s.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(d){let yt=-1;for(lt=u;lt<I;lt++)if(pt(h,lt)===pt(s,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(s,et)){yt=!1;break}if(yt)return lt}return-1}c.prototype.includes=function(s,u,l){return this.indexOf(s,u,l)!==-1},c.prototype.indexOf=function(s,u,l){return A(this,s,u,l,!0)},c.prototype.lastIndexOf=function(s,u,l){return A(this,s,u,l,!1)};function m(h,s,u,l){u=Number(u)||0;const d=h.length-u;l?(l=Number(l),l>d&&(l=d)):l=d;const b=s.length;l>b/2&&(l=b/2);let I;for(I=0;I<l;++I){const H=parseInt(s.substr(I*2,2),16);if(Qt(H))return I;h[u+I]=H}return I}function S(h,s,u,l){return Mt(kt(s,h.length-u),h,u,l)}function w(h,s,u,l){return Mt(Ht(s),h,u,l)}function B(h,s,u,l){return Mt($t(s),h,u,l)}function N(h,s,u,l){return Mt(Vt(s,h.length-u),h,u,l)}c.prototype.write=function(s,u,l,d){if(u===void 0)d="utf8",l=this.length,u=0;else if(l===void 0&&typeof u=="string")d=u,l=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(l)?(l=l>>>0,d===void 0&&(d="utf8")):(d=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),s.length>0&&(l<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");d||(d="utf8");let I=!1;for(;;)switch(d){case"hex":return m(this,s,u,l);case"utf8":case"utf-8":return S(this,s,u,l);case"ascii":case"latin1":case"binary":return w(this,s,u,l);case"base64":return B(this,s,u,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,s,u,l);default:if(I)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),I=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Q(h,s,u){return s===0&&u===h.length?t.fromByteArray(h):t.fromByteArray(h.slice(s,u))}function z(h,s,u){u=Math.min(h.length,u);const l=[];let d=s;for(;d<u;){const b=h[d];let I=null,H=b>239?4:b>223?3:b>191?2:1;if(d+H<=u){let pt,lt,yt,et;switch(H){case 1:b<128&&(I=b);break;case 2:pt=h[d+1],(pt&192)===128&&(et=(b&31)<<6|pt&63,et>127&&(I=et));break;case 3:pt=h[d+1],lt=h[d+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[d+1],lt=h[d+2],yt=h[d+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),d+=H}return D(l)}const L=4096;function D(h){const s=h.length;if(s<=L)return String.fromCharCode.apply(String,h);let u="",l=0;for(;l<s;)u+=String.fromCharCode.apply(String,h.slice(l,l+=L));return u}function Y(h,s,u){let l="";u=Math.min(h.length,u);for(let d=s;d<u;++d)l+=String.fromCharCode(h[d]&127);return l}function Z(h,s,u){let l="";u=Math.min(h.length,u);for(let d=s;d<u;++d)l+=String.fromCharCode(h[d]);return l}function X(h,s,u){const l=h.length;(!s||s<0)&&(s=0),(!u||u<0||u>l)&&(u=l);let d="";for(let b=s;b<u;++b)d+=ir[h[b]];return d}function K(h,s,u){const l=h.slice(s,u);let d="";for(let b=0;b<l.length-1;b+=2)d+=String.fromCharCode(l[b]+l[b+1]*256);return d}c.prototype.slice=function(s,u){const l=this.length;s=~~s,u=u===void 0?l:~~u,s<0?(s+=l,s<0&&(s=0)):s>l&&(s=l),u<0?(u+=l,u<0&&(u=0)):u>l&&(u=l),u<s&&(u=s);const d=this.subarray(s,u);return Object.setPrototypeOf(d,c.prototype),d};function q(h,s,u){if(h%1!==0||h<0)throw new RangeError("offset is not uint");if(h+s>u)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUintLE=c.prototype.readUIntLE=function(s,u,l){s=s>>>0,u=u>>>0,l||q(s,u,this.length);let d=this[s],b=1,I=0;for(;++I<u&&(b*=256);)d+=this[s+I]*b;return d},c.prototype.readUintBE=c.prototype.readUIntBE=function(s,u,l){s=s>>>0,u=u>>>0,l||q(s,u,this.length);let d=this[s+--u],b=1;for(;u>0&&(b*=256);)d+=this[s+--u]*b;return d},c.prototype.readUint8=c.prototype.readUInt8=function(s,u){return s=s>>>0,u||q(s,1,this.length),this[s]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(s,u){return s=s>>>0,u||q(s,2,this.length),this[s]|this[s+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(s,u){return s=s>>>0,u||q(s,2,this.length),this[s]<<8|this[s+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(s,u){return s=s>>>0,u||q(s,4,this.length),(this[s]|this[s+1]<<8|this[s+2]<<16)+this[s+3]*16777216},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(s,u){return s=s>>>0,u||q(s,4,this.length),this[s]*16777216+(this[s+1]<<16|this[s+2]<<8|this[s+3])},c.prototype.readBigUInt64LE=Wt(function(s){s=s>>>0,$(s,"offset");const u=this[s],l=this[s+7];(u===void 0||l===void 0)&&J(s,this.length-8);const d=u+this[++s]*2**8+this[++s]*2**16+this[++s]*2**24,b=this[++s]+this[++s]*2**8+this[++s]*2**16+l*2**24;return BigInt(d)+(BigInt(b)<<BigInt(32))}),c.prototype.readBigUInt64BE=Wt(function(s){s=s>>>0,$(s,"offset");const u=this[s],l=this[s+7];(u===void 0||l===void 0)&&J(s,this.length-8);const d=u*2**24+this[++s]*2**16+this[++s]*2**8+this[++s],b=this[++s]*2**24+this[++s]*2**16+this[++s]*2**8+l;return(BigInt(d)<<BigInt(32))+BigInt(b)}),c.prototype.readIntLE=function(s,u,l){s=s>>>0,u=u>>>0,l||q(s,u,this.length);let d=this[s],b=1,I=0;for(;++I<u&&(b*=256);)d+=this[s+I]*b;return b*=128,d>=b&&(d-=Math.pow(2,8*u)),d},c.prototype.readIntBE=function(s,u,l){s=s>>>0,u=u>>>0,l||q(s,u,this.length);let d=u,b=1,I=this[s+--d];for(;d>0&&(b*=256);)I+=this[s+--d]*b;return b*=128,I>=b&&(I-=Math.pow(2,8*u)),I},c.prototype.readInt8=function(s,u){return s=s>>>0,u||q(s,1,this.length),this[s]&128?(255-this[s]+1)*-1:this[s]},c.prototype.readInt16LE=function(s,u){s=s>>>0,u||q(s,2,this.length);const l=this[s]|this[s+1]<<8;return l&32768?l|4294901760:l},c.prototype.readInt16BE=function(s,u){s=s>>>0,u||q(s,2,this.length);const l=this[s+1]|this[s]<<8;return l&32768?l|4294901760:l},c.prototype.readInt32LE=function(s,u){return s=s>>>0,u||q(s,4,this.length),this[s]|this[s+1]<<8|this[s+2]<<16|this[s+3]<<24},c.prototype.readInt32BE=function(s,u){return s=s>>>0,u||q(s,4,this.length),this[s]<<24|this[s+1]<<16|this[s+2]<<8|this[s+3]},c.prototype.readBigInt64LE=Wt(function(s){s=s>>>0,$(s,"offset");const u=this[s],l=this[s+7];(u===void 0||l===void 0)&&J(s,this.length-8);const d=this[s+4]+this[s+5]*2**8+this[s+6]*2**16+(l<<24);return(BigInt(d)<<BigInt(32))+BigInt(u+this[++s]*2**8+this[++s]*2**16+this[++s]*2**24)}),c.prototype.readBigInt64BE=Wt(function(s){s=s>>>0,$(s,"offset");const u=this[s],l=this[s+7];(u===void 0||l===void 0)&&J(s,this.length-8);const d=(u<<24)+this[++s]*2**16+this[++s]*2**8+this[++s];return(BigInt(d)<<BigInt(32))+BigInt(this[++s]*2**24+this[++s]*2**16+this[++s]*2**8+l)}),c.prototype.readFloatLE=function(s,u){return s=s>>>0,u||q(s,4,this.length),e.read(this,s,!0,23,4)},c.prototype.readFloatBE=function(s,u){return s=s>>>0,u||q(s,4,this.length),e.read(this,s,!1,23,4)},c.prototype.readDoubleLE=function(s,u){return s=s>>>0,u||q(s,8,this.length),e.read(this,s,!0,52,8)},c.prototype.readDoubleBE=function(s,u){return s=s>>>0,u||q(s,8,this.length),e.read(this,s,!1,52,8)};function rt(h,s,u,l,d,b){if(!c.isBuffer(h))throw new TypeError('"buffer" argument must be a Buffer instance');if(s>d||s<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(s,u,l,d){if(s=+s,u=u>>>0,l=l>>>0,!d){const H=Math.pow(2,8*l)-1;rt(this,s,u,l,H,0)}let b=1,I=0;for(this[u]=s&255;++I<l&&(b*=256);)this[u+I]=s/b&255;return u+l},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(s,u,l,d){if(s=+s,u=u>>>0,l=l>>>0,!d){const H=Math.pow(2,8*l)-1;rt(this,s,u,l,H,0)}let b=l-1,I=1;for(this[u+b]=s&255;--b>=0&&(I*=256);)this[u+b]=s/I&255;return u+l},c.prototype.writeUint8=c.prototype.writeUInt8=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,1,255,0),this[u]=s&255,u+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,2,65535,0),this[u]=s&255,this[u+1]=s>>>8,u+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,2,65535,0),this[u]=s>>>8,this[u+1]=s&255,u+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,4,4294967295,0),this[u+3]=s>>>24,this[u+2]=s>>>16,this[u+1]=s>>>8,this[u]=s&255,u+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,4,4294967295,0),this[u]=s>>>24,this[u+1]=s>>>16,this[u+2]=s>>>8,this[u+3]=s&255,u+4};function xt(h,s,u,l,d){j(s,l,d,h,u,7);let b=Number(s&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(s>>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,s,u,l,d){j(s,l,d,h,u,7);let b=Number(s&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(s>>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(s,u=0){return xt(this,s,u,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Wt(function(s,u=0){return Ut(this,s,u,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(s,u,l,d){if(s=+s,u=u>>>0,!d){const pt=Math.pow(2,8*l-1);rt(this,s,u,l,pt-1,-pt)}let b=0,I=1,H=0;for(this[u]=s&255;++b<l&&(I*=256);)s<0&&H===0&&this[u+b-1]!==0&&(H=1),this[u+b]=(s/I>>0)-H&255;return u+l},c.prototype.writeIntBE=function(s,u,l,d){if(s=+s,u=u>>>0,!d){const pt=Math.pow(2,8*l-1);rt(this,s,u,l,pt-1,-pt)}let b=l-1,I=1,H=0;for(this[u+b]=s&255;--b>=0&&(I*=256);)s<0&&H===0&&this[u+b+1]!==0&&(H=1),this[u+b]=(s/I>>0)-H&255;return u+l},c.prototype.writeInt8=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,1,127,-128),s<0&&(s=255+s+1),this[u]=s&255,u+1},c.prototype.writeInt16LE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,2,32767,-32768),this[u]=s&255,this[u+1]=s>>>8,u+2},c.prototype.writeInt16BE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,2,32767,-32768),this[u]=s>>>8,this[u+1]=s&255,u+2},c.prototype.writeInt32LE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,4,2147483647,-2147483648),this[u]=s&255,this[u+1]=s>>>8,this[u+2]=s>>>16,this[u+3]=s>>>24,u+4},c.prototype.writeInt32BE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,4,2147483647,-2147483648),s<0&&(s=4294967295+s+1),this[u]=s>>>24,this[u+1]=s>>>16,this[u+2]=s>>>8,this[u+3]=s&255,u+4},c.prototype.writeBigInt64LE=Wt(function(s,u=0){return xt(this,s,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Wt(function(s,u=0){return Ut(this,s,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Pt(h,s,u,l,d,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,s,u,l,d){return s=+s,u=u>>>0,d||Pt(h,s,u,4),e.write(h,s,u,l,23,4),u+4}c.prototype.writeFloatLE=function(s,u,l){return Zt(this,s,u,!0,l)},c.prototype.writeFloatBE=function(s,u,l){return Zt(this,s,u,!1,l)};function Gt(h,s,u,l,d){return s=+s,u=u>>>0,d||Pt(h,s,u,8),e.write(h,s,u,l,52,8),u+8}c.prototype.writeDoubleLE=function(s,u,l){return Gt(this,s,u,!0,l)},c.prototype.writeDoubleBE=function(s,u,l){return Gt(this,s,u,!1,l)},c.prototype.copy=function(s,u,l,d){if(!c.isBuffer(s))throw new TypeError("argument should be a Buffer");if(l||(l=0),!d&&d!==0&&(d=this.length),u>=s.length&&(u=s.length),u||(u=0),d>0&&d<l&&(d=l),d===l||s.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(d<0)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),s.length-u<d-l&&(d=s.length-u+l);const b=d-l;return this===s&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,l,d):Uint8Array.prototype.set.call(s,this.subarray(l,d),u),b},c.prototype.fill=function(s,u,l,d){if(typeof s=="string"){if(typeof u=="string"?(d=u,u=0,l=this.length):typeof l=="string"&&(d=l,l=this.length),d!==void 0&&typeof d!="string")throw new TypeError("encoding must be a string");if(typeof d=="string"&&!c.isEncoding(d))throw new TypeError("Unknown encoding: "+d);if(s.length===1){const I=s.charCodeAt(0);(d==="utf8"&&I<128||d==="latin1")&&(s=I)}}else typeof s=="number"?s=s&255:typeof s=="boolean"&&(s=Number(s));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,s||(s=0);let b;if(typeof s=="number")for(b=u;b<l;++b)this[b]=s;else{const I=c.isBuffer(s)?s:c.from(s,d),H=I.length;if(H===0)throw new TypeError('The value "'+s+'" is invalid for argument "value"');for(b=0;b<l-u;++b)this[b+u]=I[b%H]}return this};const W={};function y(h,s,u){W[h]=class extends u{constructor(){super(),Object.defineProperty(this,"message",{value:s.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${h}]`,this.stack,delete this.name}get code(){return h}set code(d){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:d,writable:!0})}toString(){return`${this.name} [${h}]: ${this.message}`}}}y("ERR_BUFFER_OUT_OF_BOUNDS",function(h){return h?`${h} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),y("ERR_INVALID_ARG_TYPE",function(h,s){return`The "${h}" argument must be of type number. Received type ${typeof s}`},TypeError),y("ERR_OUT_OF_RANGE",function(h,s,u){let l=`The value of "${h}" is out of range.`,d=u;return Number.isInteger(u)&&Math.abs(u)>2**32?d=_(String(u)):typeof u=="bigint"&&(d=String(u),(u>BigInt(2)**BigInt(32)||u<-(BigInt(2)**BigInt(32)))&&(d=_(d)),d+="n"),l+=` It must be ${s}. Received ${d}`,l},RangeError);function _(h){let s="",u=h.length;const l=h[0]==="-"?1:0;for(;u>=l+4;u-=3)s=`_${h.slice(u-3,u)}${s}`;return`${h.slice(0,u)}${s}`}function E(h,s,u){$(s,"offset"),(h[s]===void 0||h[s+u]===void 0)&&J(s,h.length-(u+1))}function j(h,s,u,l,d,b){if(h>u||h<s){const I=typeof s=="bigint"?"n":"";let H;throw s===0||s===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)}E(l,d,b)}function $(h,s){if(typeof h!="number")throw new W.ERR_INVALID_ARG_TYPE(s,"number",h)}function J(h,s,u){throw Math.floor(h)!==h?($(h,u),new W.ERR_OUT_OF_RANGE("offset","an integer",h)):s<0?new W.ERR_BUFFER_OUT_OF_BOUNDS:new W.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${s}`,h)}const bt=/[^+/0-9A-Za-z-_]/g;function Nt(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,s){s=s||1/0;let u;const l=h.length;let d=null;const b=[];for(let I=0;I<l;++I){if(u=h.charCodeAt(I),u>55295&&u<57344){if(!d){if(u>56319){(s-=3)>-1&&b.push(239,191,189);continue}else if(I+1===l){(s-=3)>-1&&b.push(239,191,189);continue}d=u;continue}if(u<56320){(s-=3)>-1&&b.push(239,191,189),d=u;continue}u=(d-55296<<10|u-56320)+65536}else d&&(s-=3)>-1&&b.push(239,191,189);if(d=null,u<128){if((s-=1)<0)break;b.push(u)}else if(u<2048){if((s-=2)<0)break;b.push(u>>6|192,u&63|128)}else if(u<65536){if((s-=3)<0)break;b.push(u>>12|224,u>>6&63|128,u&63|128)}else if(u<1114112){if((s-=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 s=[];for(let u=0;u<h.length;++u)s.push(h.charCodeAt(u)&255);return s}function Vt(h,s){let u,l,d;const b=[];for(let I=0;I<h.length&&!((s-=2)<0);++I)u=h.charCodeAt(I),l=u>>8,d=u%256,b.push(d),b.push(l);return b}function $t(h){return t.toByteArray(Nt(h))}function Mt(h,s,u,l){let d;for(d=0;d<l&&!(d+u>=s.length||d>=h.length);++d)s[d+u]=h[d];return d}function mt(h,s){return h instanceof s||h!=null&&h.constructor!=null&&h.constructor.name!=null&&h.constructor.name===s.name}function Qt(h){return h!==h}const ir=function(){const h="0123456789abcdef",s=new Array(256);for(let u=0;u<16;++u){const l=u*16;for(let d=0;d<16;++d)s[l+d]=h[u]+h[d]}return s}();function Wt(h){return typeof BigInt>"u"?_i:h}function _i(){throw new Error("BigInt not supported")}}(Oi)),Oi}var Bo;function Df(){if(Bo)return Dr;Bo=1,Object.defineProperty(Dr,"__esModule",{value:!0}),Dr.BinaryReader=void 0;const r=Os();class t{constructor(n,o=!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=o}_read(n,o,i){return()=>{let a;return this.isBigEndian?a=o.call(this.buffer,this.position):a=n.call(this.buffer,this.position),this.position+=i,a}}readVarInt(){let n,o=0,i=0;do n=this.buffer[this.position+i],o+=(n&127)<<7*i,i++;while(n>=128);return this.position+=i,o}}return Dr.BinaryReader=t,Dr}var Lr={},vo;function qe(){if(vo)return Lr;vo=1,Object.defineProperty(Lr,"__esModule",{value:!0}),Lr.BinaryWriter=void 0;const r=Os();class t{constructor(n,o=!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=o}_write(n,o){return(i,a=!1)=>{this.ensureSize(o),n.call(this.buffer,i,this.position,a),this.position+=o}}writeBuffer(n){this.ensureSize(n.length),n.copy(this.buffer,this.position,0,n.length),this.position+=n.length}writeVarInt(n){let o=1;for(;(n&4294967168)!==0;)this.writeUInt8(n&127|128),n>>>=7,o++;return this.writeUInt8(n&127),o}ensureSize(n){if(this.buffer.length<this.position+n)if(this.allowResize){const o=r.Buffer.alloc(this.position+n);this.buffer.copy(o,0,0,this.buffer.length),this.buffer=o}else throw new RangeError("index out of range")}}return Lr.BinaryWriter=t,Lr}var Rr={},Ao;function Pe(){return Ao||(Ao=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 Cr={},xo;function Uf(){if(xo)return Cr;xo=1,Object.defineProperty(Cr,"__esModule",{value:!0}),Cr.Geometry=void 0;const r=Os(),t=$e();class e{constructor(){this.srid=void 0,this.hasZ=!1,this.hasM=!1}static parse(o,i){if(typeof o==="string"||o instanceof t.WktParser)return e._parseWkt(o);if(r.Buffer.isBuffer(o)||o instanceof t.BinaryReader)try{return e._parseWkb(o,i)}catch{try{return e.parseTwkb(o)}catch{throw new Error("Could not parse WKB or TWKB")}}else throw new Error("First argument must be a string or Buffer")}static _parseWkt(o){let i,a;o instanceof t.WktParser?i=o:i=new t.WktParser(o);const c=i.matchRegex([/^SRID=(\d+);/]);c&&(a=parseInt(c[1],10));const f=i.matchType(),p=i.matchDimension(),g={srid:a,hasZ:p.hasZ,hasM:p.hasM};switch(f){case t.CONSTANTS.wkt.Point:return t.Point._parseWktWithOptions(i,g);case t.CONSTANTS.wkt.LineString:return t.LineString._parseWktWithOptions(i,g);case t.CONSTANTS.wkt.Polygon:return t.Polygon._parseWktWithOptions(i,g);case t.CONSTANTS.wkt.MultiPoint:return t.MultiPoint._parseWktWithOptions(i,g);case t.CONSTANTS.wkt.MultiLineString:return t.MultiLineString._parseWktWithOptions(i,g);case t.CONSTANTS.wkt.MultiPolygon:return t.MultiPolygon._parseWktWithOptions(i,g);case t.CONSTANTS.wkt.GeometryCollection:return t.GeometryCollection._parseWktWithOptions(i,g);default:throw new Error("Unsupported geometry type")}}static _parseWkb(o,i){let a,c,f;const p={};switch(o instanceof t.BinaryReader?a=o:a=new t.BinaryReader(o),a.isBigEndian=!a.readInt8(),c=a.readUInt32(),p.hasSrid=(c&536870912)===536870912,p.isEwkb=c&536870912||c&1073741824||c&2147483648,p.hasSrid&&(p.srid=a.readUInt32()),p.hasZ=!1,p.hasM=!1,!p.isEwkb&&(!i||!i.isEwkb)?c>=1e3&&c<2e3?(p.hasZ=!0,f=c-1e3):c>=2e3&&c<3e3?(p.hasM=!0,f=c-2e3):c>=3e3&&c<4e3?(p.hasZ=!0,p.hasM=!0,f=c-3e3):f=c:(c&2147483648&&(p.hasZ=!0),c&1073741824&&(p.hasM=!0),f=c&15),f){case t.CONSTANTS.wkb.Point:return t.Point._parseWkb(a,p);case t.CONSTANTS.wkb.LineString:return t.LineString._parseWkb(a,p);case t.CONSTANTS.wkb.Polygon:return t.Polygon._parseWkb(a,p);case t.CONSTANTS.wkb.MultiPoint:return t.MultiPoint._parseWkb(a,p);case t.CONSTANTS.wkb.MultiLineString:return t.MultiLineString._parseWkb(a,p);case t.CONSTANTS.wkb.MultiPolygon:return t.MultiPolygon._parseWkb(a,p);case t.CONSTANTS.wkb.GeometryCollection:return t.GeometryCollection._parseWkb(a,p);default:throw new Error(`GeometryType ${f} not supported`)}}static parseTwkb(o){let i;const a={};o instanceof t.BinaryReader?i=o:i=new t.BinaryReader(o);const c=i.readUInt8(),f=i.readUInt8(),p=c&15;if(a.precision=t.ZigZag.decode(c>>4),a.precisionFactor=Math.pow(10,a.precision),a.hasBoundingBox=f>>0&1,a.hasSizeAttribute=f>>1&1,a.hasIdList=f>>2&1,a.hasExtendedPrecision=f>>3&1,a.isEmpty=f>>4&1,a.hasExtendedPrecision){const g=i.readUInt8();a.hasZ=(g&1)===1,a.hasM=(g&2)===2,a.zPrecision=t.ZigZag.decode((g&28)>>2),a.zPrecisionFactor=Math.pow(10,a.zPrecision),a.mPrecision=t.ZigZag.decode((g&224)>>5),a.mPrecisionFactor=Math.pow(10,a.mPrecision)}else a.hasZ=!1,a.hasM=!1;if(a.hasSizeAttribute&&i.readVarInt(),a.hasBoundingBox){let g=2;a.hasZ&&g++,a.hasM&&g++;for(let v=0;v<g;v++)i.readVarInt(),i.readVarInt()}switch(p){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 "+p+" not supported")}}toGeoJSON(o){const i={};return this.srid&&o&&(o.shortCrs?i.crs={type:"name",properties:{name:"EPSG:"+this.srid}}:o.longCrs&&(i.crs={type:"name",properties:{name:"urn:ogc:def:crs:EPSG::"+this.srid}})),i}static _parseGeoJSON(o,i){let a;switch(o.type){case t.CONSTANTS.geoJSON.Point:a=t.Point._parseGeoJSON(o);break;case t.CONSTANTS.geoJSON.LineString:a=t.LineString._parseGeoJSON(o);break;case t.CONSTANTS.geoJSON.Polygon:a=t.Polygon._parseGeoJSON(o);break;case t.CONSTANTS.geoJSON.MultiPoint:a=t.MultiPoint._parseGeoJSON(o);break;case t.CONSTANTS.geoJSON.MultiLineString:a=t.MultiLineString._parseGeoJSON(o);break;case t.CONSTANTS.geoJSON.MultiPolygon:a=t.MultiPolygon._parseGeoJSON(o);break;case t.CONSTANTS.geoJSON.GeometryCollection:a=t.GeometryCollection._parseGeoJSON(o);break;default:throw new Error("GeometryType "+o.type+" not supported")}if(o.crs&&o.crs.type&&o.crs.type==="name"&&o.crs.properties&&o.crs.properties.name){const c=o.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 o=new t.BinaryWriter(this._getWkbSize()+4),i=this.toWkb();return o.writeInt8(1),o.writeUInt32LE((i.slice(1,5).readUInt32LE(0)|536870912)>>>0,!0),o.writeUInt32LE(this.srid),o.writeBuffer(i.slice(5)),o.buffer}_getWktType(o,i){let a=o;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(o){let i=`${o.x} ${o.y}`;return this.hasZ&&(i+=` ${o.z}`),this.hasM&&(i+=` ${o.m}`),i}_writeWkbType(o,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)),o.writeUInt32LE(c+i>>>0,!0)}static getTwkbPrecision(o,i,a){return{xy:o,z:i,m:a,xyFactor:Math.pow(10,o),zFactor:Math.pow(10,i),mFactor:Math.pow(10,a)}}_writeTwkbHeader(o,i,a,c){const f=(t.ZigZag.encode(a.xy)<<4)+i;let p=this.hasZ||this.hasM?1:0;if(p+=c?1:0,o.writeUInt8(f),o.writeUInt8(p),this.hasZ||this.hasM){let g=0;this.hasZ&&(g|=1),this.hasM&&(g|=2),o.writeUInt8(g)}}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 Cr.Geometry=e,Cr}var Pr={},Eo;function Lf(){if(Eo)return Pr;Eo=1,Object.defineProperty(Pr,"__esModule",{value:!0}),Pr.GeometryCollection=void 0;const r=qe(),t=Pe(),e=$e();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 f=i.readUInt32();for(let p=0;p<f;p++)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 f=i.readVarInt();for(let p=0;p<f;p++)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 f=0;f<this.geometries.length;f++)i.writeBuffer(this.geometries[f].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 Pr.GeometryCollection=n,Pr}var $r={},To;function Rf(){if(To)return $r;To=1,Object.defineProperty($r,"__esModule",{value:!0}),$r.LineString=void 0;const r=qe(),t=Pe(),e=$e();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 f=i.readUInt32();for(let p=0;p<f;p++)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 f=new e.Point(0,0,0,0),p=i.readVarInt();for(let g=0;g<p;g++)c.points.push(e.Point._readTwkbPoint(i,a,f));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 f=new e.Point(0,0,0,0);for(const p of this.points)p._writeTwkbPoint(i,a,f)}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 $r.LineString=n,$r}var zr={},Oo;function Cf(){if(Oo)return zr;Oo=1,Object.defineProperty(zr,"__esModule",{value:!0}),zr.MultiLineString=void 0;const r=qe(),t=Pe(),e=$e();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 f=i.readUInt32();for(let p=0;p<f;p++){const g=e.Geometry.parse(i,a);c.lineStrings.push(e.LineString.fromGeometry(g))}return c}static _parseTwkb(i,a){const c=new n;if(c.hasZ=a.hasZ,c.hasM=a.hasM,a.isEmpty)return c;const f=new e.Point(0,0,0,0),p=i.readVarInt();for(let g=0;g<p;g++){const v=new e.LineString;v.hasZ=a.hasZ,v.hasM=a.hasM;const C=i.readVarInt();for(let F=0;F<C;F++)v.points.push(e.Point._readTwkbPoint(i,a,f));c.lineStrings.push(v)}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 f=new e.Point(0,0,0,0);for(let p=0;p<this.lineStrings.length;p++){i.writeVarInt(this.lineStrings[p].points.length);for(let g=0;g<this.lineStrings[p].points.length;g++)this.lineStrings[p].points[g]._writeTwkbPoint(i,a,f)}}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 zr.MultiLineString=n,zr}var jr={},Mo;function Pf(){if(Mo)return jr;Mo=1,Object.defineProperty(jr,"__esModule",{value:!0}),jr.MultiPoint=void 0;const r=qe(),t=Pe(),e=$e();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 f=i.readUInt32();for(let p=0;p<f;p++){const g=e.Geometry.parse(i,a);c.points.push(e.Point.fromGeometry(g))}return c}static _parseTwkb(i,a){const c=new n;if(c.hasZ=a.hasZ,c.hasM=a.hasM,a.isEmpty)return c;const f=new e.Point(0,0,0,0),p=i.readVarInt();for(let g=0;g<p;g++)c.points.push(e.Point._readTwkbPoint(i,a,f));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 f=new e.Point(0,0,0,0);for(let p=0;p<this.points.length;p++)this.points[p]._writeTwkbPoint(i,a,f)}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 jr.MultiPoint=n,jr}var Vr={},Fo;function $f(){if(Fo)return Vr;Fo=1,Object.defineProperty(Vr,"__esModule",{value:!0}),Vr.MultiPolygon=void 0;const r=qe(),t=Pe(),e=$e();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 f=[],p=[];for(i.expectGroupStart(),f.push(...i.matchCoordinates(a)),i.expectGroupEnd();i.isMatch([","]);)i.expectGroupStart(),p.push(i.matchCoordinates(a)),i.expectGroupEnd();c.polygons.push(new e.Polygon(f,p)),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 f=i.readUInt32();for(let p=0;p<f;p++)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 f=new e.Point(0,0,0,0),p=i.readVarInt();for(let g=0;g<p;g++){const v=new e.Polygon;v.hasZ=a.hasZ,v.hasM=a.hasM;const C=i.readVarInt(),F=i.readVarInt();for(let T=0;T<F;T++)v.exteriorRing.push(e.Point._readTwkbPoint(i,a,f));for(let T=1;T<C;T++){const U=[],M=i.readVarInt();for(let k=0;k<M;k++)U.push(e.Point._readTwkbPoint(i,a,f));v.interiorRings.push(U)}c.polygons.push(v)}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 f=new e.Point(0,0,0,0);for(let p=0;p<this.polygons.length;p++){i.writeVarInt(1+this.polygons[p].interiorRings.length),i.writeVarInt(this.polygons[p].exteriorRing.length);for(let g=0;g<this.polygons[p].exteriorRing.length;g++)this.polygons[p].exteriorRing[g]._writeTwkbPoint(i,a,f);for(let g=0;g<this.polygons[p].interiorRings.length;g++){i.writeVarInt(this.polygons[p].interiorRings[g].length);for(let v=0;v<this.polygons[p].interiorRings[g].length;v++)this.polygons[p].interiorRings[g][v]._writeTwkbPoint(i,a,f)}}}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 Vr.MultiPolygon=n,Vr}var Wr={},Zr={},No;function eu(){if(No)return Zr;No=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.ZigZag=void 0;class r{static encode(e){return e<<1^e>>31}static decode(e){return e>>1^-(e&1)}}return Zr.ZigZag=r,Zr}var ko;function ru(){if(ko)return Wr;ko=1,Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.Point=void 0;const r=qe(),t=eu(),e=Pe(),n=$e();class o extends n.Geometry{constructor(a,c,f,p,g){super(),this.x=a,this.y=c,this.z=f,this.m=p,this.srid=g,this.hasZ=typeof this.z<"u",this.hasM=typeof this.m<"u"}static Z(a,c,f,p){const g=new o(a,c,f,0,p);return g.hasZ=!0,g}static M(a,c,f,p){const g=new o(a,c,0,f,p);return g.hasM=!0,g}static ZM(a,c,f,p,g){const v=new o(a,c,f,p,g);return v.hasZ=!0,v.hasM=!0,v}static _parseWktWithOptions(a,c){const f=new o(0,0,0,0);if(f.srid=c.srid,f.hasZ=c.hasZ,f.hasM=c.hasM,a.isMatch(["EMPTY"]))return f;a.expectGroupStart();const p=a.matchCoordinate(c);return f.x=p.x,f.y=p.y,f.z=p.z,f.m=p.m,a.expectGroupEnd(),f}static _parseWkb(a,c){const f=o._readWkbPoint(a,c);return f.srid=c.srid,f}static _readWkbPoint(a,c){return new o(a.readDouble(),a.readDouble(),c.hasZ?a.readDouble():!1,c.hasM?a.readDouble():!1)}static _parseTwkb(a,c){const f=new o(0,0,0,0);return f.hasZ=c.hasZ,f.hasM=c.hasM,c.isEmpty||(f.x=t.ZigZag.decode(a.readVarInt())/c.precisionFactor,f.y=t.ZigZag.decode(a.readVarInt())/c.precisionFactor,f.z=c.hasZ?t.ZigZag.decode(a.readVarInt())/c.zPrecisionFactor:0,f.m=c.hasM?t.ZigZag.decode(a.readVarInt())/c.mPrecisionFactor:0),f}static _readTwkbPoint(a,c,f){return f.x+=t.ZigZag.decode(a.readVarInt())/c.precisionFactor,f.y+=t.ZigZag.decode(a.readVarInt())/c.precisionFactor,c.hasZ&&(f.z+=t.ZigZag.decode(a.readVarInt())/c.zPrecisionFactor),c.hasM&&(f.m+=t.ZigZag.decode(a.readVarInt())/c.mPrecisionFactor),new o(f.x,f.y,f.z,f.m)}static _parseGeoJSON(a){return o._readGeoJSONPoint(a.coordinates)}static _readGeoJSONPoint(a){return a.length===0?new o(0,0,0,0):a.length>2?new o(a[0],a[1],a[2],0):new o(a[0],a[1],0,0)}static fromGeometry(a){const c=new o(0,0,0,0);return c.srid=a.srid,c.hasZ=a.hasZ,c.hasM=a.hasM,a instanceof o?(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),f=this.x===void 0&&this.y===void 0;return this._writeTwkbHeader(a,e.CONSTANTS.wkb.Point,c,f),f||this._writeTwkbPoint(a,c,new o(0,0,0,0)),a.buffer}_writeTwkbPoint(a,c,f){const p=this.x*c.xyFactor,g=this.y*c.xyFactor,v=this.z*c.zFactor,C=this.m*c.mFactor;a.writeVarInt(t.ZigZag.encode(p-f.x)),a.writeVarInt(t.ZigZag.encode(g-f.y)),this.hasZ&&a.writeVarInt(t.ZigZag.encode(v-f.z)),this.hasM&&a.writeVarInt(t.ZigZag.encode(C-f.m)),f.x=p,f.y=g,f.z=v,f.m=C}_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 Wr.Point=o,Wr}var Gr={},Do;function zf(){if(Do)return Gr;Do=1,Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.Polygon=void 0;const r=qe(),t=Pe(),e=$e();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 f=new n(i,a,c);return f.hasZ=!0,f}static M(i,a,c){const f=new n(i,a,c);return f.hasM=!0,f}static ZM(i,a,c){const f=new n(i,a,c);return f.hasZ=!0,f.hasM=!0,f}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 f=i.readUInt32();if(f>0){const p=i.readUInt32();for(let g=0;g<p;g++)c.exteriorRing.push(e.Point._readWkbPoint(i,a));for(let g=1;g<f;g++){const v=[],C=i.readUInt32();for(let F=0;F<C;F++)v.push(e.Point._readWkbPoint(i,a));c.interiorRings.push(v)}}return c}static _parseTwkb(i,a){const c=new n;if(c.hasZ=a.hasZ,c.hasM=a.hasM,a.isEmpty)return c;const f=new e.Point(0,0,0,0),p=i.readVarInt(),g=i.readVarInt();for(let v=0;v<g;v++)c.exteriorRing.push(e.Point._readTwkbPoint(i,a,f));for(let v=1;v<p;v++){const C=[],F=i.readVarInt();for(let T=0;T<F;T++)C.push(e.Point._readTwkbPoint(i,a,f));c.interiorRings.push(C)}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 f=0;f<i.coordinates[c].length;f++)c===0?a.exteriorRing.push(e.Point._readGeoJSONPoint(i.coordinates[c][f])):a.interiorRings[c-1].push(e.Point._readGeoJSONPoint(i.coordinates[c][f]))}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 f=0;f<this.interiorRings[c].length;f++)this.interiorRings[c][f]._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 f=new e.Point(0,0,0,0);for(let p=0;p<this.exteriorRing.length;p++)this.exteriorRing[p]._writeTwkbPoint(i,a,f);for(let p=0;p<this.interiorRings.length;p++){i.writeVarInt(this.interiorRings[p].length);for(let g=0;g<this.interiorRings[p].length;g++)this.interiorRings[p][g]._writeTwkbPoint(i,a,f)}}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 f=0;f<this.exteriorRing.length;f++)this.hasZ?c.push([this.exteriorRing[f].x,this.exteriorRing[f].y,this.exteriorRing[f].z]):c.push([this.exteriorRing[f].x,this.exteriorRing[f].y]);a.coordinates.push(c)}for(let c=0;c<this.interiorRings.length;c++){const f=[];for(let p=0;p<this.interiorRings[c].length;p++)this.hasZ?f.push([this.interiorRings[c][p].x,this.interiorRings[c][p].y,this.interiorRings[c][p].z]):f.push([this.interiorRings[c][p].x,this.interiorRings[c][p].y]);a.coordinates.push(f)}return a}}return Gr.Polygon=n,Gr}var Yr={},Uo;function jf(){if(Uo)return Yr;Uo=1,Object.defineProperty(Yr,"__esModule",{value:!0}),Yr.WktParser=void 0;const r=Pe(),t=ru();class e{constructor(o){this.value=o,this.position=0}match(o){this.skipWhitespaces();for(let i=0;i<o.length;i++)if(this.value.substring(this.position).indexOf(o[i])===0)return this.position+=o[i].length,o[i];return null}matchRegex(o){this.skipWhitespaces();for(let i=0;i<o.length;i++){const a=this.value.substring(this.position).match(o[i]);if(a)return this.position+=a[0].length,a}return null}isMatch(o){this.skipWhitespaces();for(let i=0;i<o.length;i++)if(this.value.substring(this.position).indexOf(o[i])===0)return this.position+=o[i].length,!0;return!1}matchType(){const o=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(!o)throw new Error("Expected geometry type");return o}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(o){let i;if(o.hasZ&&o.hasM?i=this.matchRegex([/^(\S*)\s+(\S*)\s+(\S*)\s+([^\s,)]*)/]):o.hasZ||o.hasM?i=this.matchRegex([/^(\S*)\s+(\S*)\s+([^\s,)]*)/]):i=this.matchRegex([/^(\S*)\s+([^\s,)]*)/]),!i)throw new Error("Expected coordinates");return o.hasZ&&o.hasM?new t.Point(parseFloat(i[1]),parseFloat(i[2]),parseFloat(i[3]),parseFloat(i[4])):o.hasZ?new t.Point(parseFloat(i[1]),parseFloat(i[2]),parseFloat(i[3]),0):o.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(o){const i=[];do{const a=this.isMatch(["("]);i.push(this.matchCoordinate(o)),a&&this.expectGroupEnd()}while(this.isMatch([","]));return i}skipWhitespaces(){for(;this.position<this.value.length&&this.value[this.position]===" ";)this.position++}}return Yr.WktParser=e,Yr}var Lo;function $e(){return Lo||(Lo=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=Df();Object.defineProperty(r,"BinaryReader",{enumerable:!0,get:function(){return t.BinaryReader}});const e=qe();Object.defineProperty(r,"BinaryWriter",{enumerable:!0,get:function(){return e.BinaryWriter}});const n=Pe();Object.defineProperty(r,"CONSTANTS",{enumerable:!0,get:function(){return n.CONSTANTS}});const o=Uf();Object.defineProperty(r,"Geometry",{enumerable:!0,get:function(){return o.Geometry}});const i=Lf();Object.defineProperty(r,"GeometryCollection",{enumerable:!0,get:function(){return i.GeometryCollection}});const a=Rf();Object.defineProperty(r,"LineString",{enumerable:!0,get:function(){return a.LineString}});const c=Cf();Object.defineProperty(r,"MultiLineString",{enumerable:!0,get:function(){return c.MultiLineString}});const f=Pf();Object.defineProperty(r,"MultiPoint",{enumerable:!0,get:function(){return f.MultiPoint}});const p=$f();Object.defineProperty(r,"MultiPolygon",{enumerable:!0,get:function(){return p.MultiPolygon}});const g=ru();Object.defineProperty(r,"Point",{enumerable:!0,get:function(){return g.Point}});const v=zf();Object.defineProperty(r,"Polygon",{enumerable:!0,get:function(){return v.Polygon}});const C=jf();Object.defineProperty(r,"WktParser",{enumerable:!0,get:function(){return C.WktParser}});const F=eu();Object.defineProperty(r,"ZigZag",{enumerable:!0,get:function(){return F.ZigZag}})}(Ti)),Ti}var Vf=$e(),Mi={};var Ro;function Wf(){return Ro||(Ro=1,function(r){const t=Qc(),e=tu(),n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=c,r.SlowBuffer=P,r.INSPECT_MAX_BYTES=50;const o=2147483647;r.kMaxLength=o,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),s={foo:function(){return 42}};return Object.setPrototypeOf(s,Uint8Array.prototype),Object.setPrototypeOf(h,s),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>o)throw new RangeError('The value "'+h+'" is invalid for option "size"');const s=new Uint8Array(h);return Object.setPrototypeOf(s,c.prototype),s}function c(h,s,u){if(typeof h=="number"){if(typeof s=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return v(h)}return f(h,s,u)}c.poolSize=8192;function f(h,s,u){if(typeof h=="string")return C(h,s);if(ArrayBuffer.isView(h))return T(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,s,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,s,u);const d=M(h);if(d)return d;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof h[Symbol.toPrimitive]=="function")return c.from(h[Symbol.toPrimitive]("string"),s,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,s,u){return f(h,s,u)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array);function p(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 g(h,s,u){return p(h),h<=0?a(h):s!==void 0?typeof u=="string"?a(h).fill(s,u):a(h).fill(s):a(h)}c.alloc=function(h,s,u){return g(h,s,u)};function v(h){return p(h),a(h<0?0:k(h)|0)}c.allocUnsafe=function(h){return v(h)},c.allocUnsafeSlow=function(h){return v(h)};function C(h,s){if((typeof s!="string"||s==="")&&(s="utf8"),!c.isEncoding(s))throw new TypeError("Unknown encoding: "+s);const u=R(h,s)|0;let l=a(u);const d=l.write(h,s);return d!==u&&(l=l.slice(0,d)),l}function F(h){const s=h.length<0?0:k(h.length)|0,u=a(s);for(let l=0;l<s;l+=1)u[l]=h[l]&255;return u}function T(h){if(mt(h,Uint8Array)){const s=new Uint8Array(h);return U(s.buffer,s.byteOffset,s.byteLength)}return F(h)}function U(h,s,u){if(s<0||h.byteLength<s)throw new RangeError('"offset" is outside of buffer bounds');if(h.byteLength<s+(u||0))throw new RangeError('"length" is outside of buffer bounds');let l;return s===void 0&&u===void 0?l=new Uint8Array(h):u===void 0?l=new Uint8Array(h,s):l=new Uint8Array(h,s,u),Object.setPrototypeOf(l,c.prototype),l}function M(h){if(c.isBuffer(h)){const s=k(h.length)|0,u=a(s);return u.length===0||h.copy(u,0,0,s),u}if(h.length!==void 0)return typeof h.length!="number"||Qt(h.length)?a(0):F(h);if(h.type==="Buffer"&&Array.isArray(h.data))return F(h.data)}function k(h){if(h>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return h|0}function P(h){return+h!=h&&(h=0),c.alloc(+h)}c.isBuffer=function(s){return s!=null&&s._isBuffer===!0&&s!==c.prototype},c.compare=function(s,u){if(mt(s,Uint8Array)&&(s=c.from(s,s.offset,s.byteLength)),mt(u,Uint8Array)&&(u=c.from(u,u.offset,u.byteLength)),!c.isBuffer(s)||!c.isBuffer(u))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(s===u)return 0;let l=s.length,d=u.length;for(let b=0,I=Math.min(l,d);b<I;++b)if(s[b]!==u[b]){l=s[b],d=u[b];break}return l<d?-1:d<l?1:0},c.isEncoding=function(s){switch(String(s).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(s,u){if(!Array.isArray(s))throw new TypeError('"list" argument must be an Array of Buffers');if(s.length===0)return c.alloc(0);let l;if(u===void 0)for(u=0,l=0;l<s.length;++l)u+=s[l].length;const d=c.allocUnsafe(u);let b=0;for(l=0;l<s.length;++l){let I=s[l];if(mt(I,Uint8Array))b+I.length>d.length?(c.isBuffer(I)||(I=c.from(I)),I.copy(d,b)):Uint8Array.prototype.set.call(d,I,b);else if(c.isBuffer(I))I.copy(d,b);else throw new TypeError('"list" argument must be an Array of Buffers');b+=I.length}return d};function R(h,s){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 d=!1;for(;;)switch(s){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(d)return l?-1:kt(h).length;s=(""+s).toLowerCase(),d=!0}}c.byteLength=R;function V(h,s,u){let l=!1;if((s===void 0||s<0)&&(s=0),s>this.length||((u===void 0||u>this.length)&&(u=this.length),u<=0)||(u>>>=0,s>>>=0,u<=s))return"";for(h||(h="utf8");;)switch(h){case"hex":return X(this,s,u);case"utf8":case"utf-8":return z(this,s,u);case"ascii":return Y(this,s,u);case"latin1":case"binary":return Z(this,s,u);case"base64":return Q(this,s,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return K(this,s,u);default:if(l)throw new TypeError("Unknown encoding: "+h);h=(h+"").toLowerCase(),l=!0}}c.prototype._isBuffer=!0;function G(h,s,u){const l=h[s];h[s]=h[u],h[u]=l}c.prototype.swap16=function(){const s=this.length;if(s%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let u=0;u<s;u+=2)G(this,u,u+1);return this},c.prototype.swap32=function(){const s=this.length;if(s%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let u=0;u<s;u+=4)G(this,u,u+3),G(this,u+1,u+2);return this},c.prototype.swap64=function(){const s=this.length;if(s%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let u=0;u<s;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 s=this.length;return s===0?"":arguments.length===0?z(this,0,s):V.apply(this,arguments)},c.prototype.toLocaleString=c.prototype.toString,c.prototype.equals=function(s){if(!c.isBuffer(s))throw new TypeError("Argument must be a Buffer");return this===s?!0:c.compare(this,s)===0},c.prototype.inspect=function(){let s="";const u=r.INSPECT_MAX_BYTES;return s=this.toString("hex",0,u).replace(/(.{2})/g,"$1 ").trim(),this.length>u&&(s+=" ... "),"<Buffer "+s+">"},n&&(c.prototype[n]=c.prototype.inspect),c.prototype.compare=function(s,u,l,d,b){if(mt(s,Uint8Array)&&(s=c.from(s,s.offset,s.byteLength)),!c.isBuffer(s))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof s);if(u===void 0&&(u=0),l===void 0&&(l=s?s.length:0),d===void 0&&(d=0),b===void 0&&(b=this.length),u<0||l>s.length||d<0||b>this.length)throw new RangeError("out of range index");if(d>=b&&u>=l)return 0;if(d>=b)return-1;if(u>=l)return 1;if(u>>>=0,l>>>=0,d>>>=0,b>>>=0,this===s)return 0;let I=b-d,H=l-u;const pt=Math.min(I,H),lt=this.slice(d,b),yt=s.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,s,u,l,d){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=d?0:h.length-1),u<0&&(u=h.length+u),u>=h.length){if(d)return-1;u=h.length-1}else if(u<0)if(d)u=0;else return-1;if(typeof s=="string"&&(s=c.from(s,l)),c.isBuffer(s))return s.length===0?-1:O(h,s,u,l,d);if(typeof s=="number")return s=s&255,typeof Uint8Array.prototype.indexOf=="function"?d?Uint8Array.prototype.indexOf.call(h,s,u):Uint8Array.prototype.lastIndexOf.call(h,s,u):O(h,[s],u,l,d);throw new TypeError("val must be string, number or Buffer")}function O(h,s,u,l,d){let b=1,I=h.length,H=s.length;if(l!==void 0&&(l=String(l).toLowerCase(),l==="ucs2"||l==="ucs-2"||l==="utf16le"||l==="utf-16le")){if(h.length<2||s.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(d){let yt=-1;for(lt=u;lt<I;lt++)if(pt(h,lt)===pt(s,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(s,et)){yt=!1;break}if(yt)return lt}return-1}c.prototype.includes=function(s,u,l){return this.indexOf(s,u,l)!==-1},c.prototype.indexOf=function(s,u,l){return A(this,s,u,l,!0)},c.prototype.lastIndexOf=function(s,u,l){return A(this,s,u,l,!1)};function m(h,s,u,l){u=Number(u)||0;const d=h.length-u;l?(l=Number(l),l>d&&(l=d)):l=d;const b=s.length;l>b/2&&(l=b/2);let I;for(I=0;I<l;++I){const H=parseInt(s.substr(I*2,2),16);if(Qt(H))return I;h[u+I]=H}return I}function S(h,s,u,l){return Mt(kt(s,h.length-u),h,u,l)}function w(h,s,u,l){return Mt(Ht(s),h,u,l)}function B(h,s,u,l){return Mt($t(s),h,u,l)}function N(h,s,u,l){return Mt(Vt(s,h.length-u),h,u,l)}c.prototype.write=function(s,u,l,d){if(u===void 0)d="utf8",l=this.length,u=0;else if(l===void 0&&typeof u=="string")d=u,l=this.length,u=0;else if(isFinite(u))u=u>>>0,isFinite(l)?(l=l>>>0,d===void 0&&(d="utf8")):(d=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),s.length>0&&(l<0||u<0)||u>this.length)throw new RangeError("Attempt to write outside buffer bounds");d||(d="utf8");let I=!1;for(;;)switch(d){case"hex":return m(this,s,u,l);case"utf8":case"utf-8":return S(this,s,u,l);case"ascii":case"latin1":case"binary":return w(this,s,u,l);case"base64":return B(this,s,u,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,s,u,l);default:if(I)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),I=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Q(h,s,u){return s===0&&u===h.length?t.fromByteArray(h):t.fromByteArray(h.slice(s,u))}function z(h,s,u){u=Math.min(h.length,u);const l=[];let d=s;for(;d<u;){const b=h[d];let I=null,H=b>239?4:b>223?3:b>191?2:1;if(d+H<=u){let pt,lt,yt,et;switch(H){case 1:b<128&&(I=b);break;case 2:pt=h[d+1],(pt&192)===128&&(et=(b&31)<<6|pt&63,et>127&&(I=et));break;case 3:pt=h[d+1],lt=h[d+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[d+1],lt=h[d+2],yt=h[d+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),d+=H}return D(l)}const L=4096;function D(h){const s=h.length;if(s<=L)return String.fromCharCode.apply(String,h);let u="",l=0;for(;l<s;)u+=String.fromCharCode.apply(String,h.slice(l,l+=L));return u}function Y(h,s,u){let l="";u=Math.min(h.length,u);for(let d=s;d<u;++d)l+=String.fromCharCode(h[d]&127);return l}function Z(h,s,u){let l="";u=Math.min(h.length,u);for(let d=s;d<u;++d)l+=String.fromCharCode(h[d]);return l}function X(h,s,u){const l=h.length;(!s||s<0)&&(s=0),(!u||u<0||u>l)&&(u=l);let d="";for(let b=s;b<u;++b)d+=ir[h[b]];return d}function K(h,s,u){const l=h.slice(s,u);let d="";for(let b=0;b<l.length-1;b+=2)d+=String.fromCharCode(l[b]+l[b+1]*256);return d}c.prototype.slice=function(s,u){const l=this.length;s=~~s,u=u===void 0?l:~~u,s<0?(s+=l,s<0&&(s=0)):s>l&&(s=l),u<0?(u+=l,u<0&&(u=0)):u>l&&(u=l),u<s&&(u=s);const d=this.subarray(s,u);return Object.setPrototypeOf(d,c.prototype),d};function q(h,s,u){if(h%1!==0||h<0)throw new RangeError("offset is not uint");if(h+s>u)throw new RangeError("Trying to access beyond buffer length")}c.prototype.readUintLE=c.prototype.readUIntLE=function(s,u,l){s=s>>>0,u=u>>>0,l||q(s,u,this.length);let d=this[s],b=1,I=0;for(;++I<u&&(b*=256);)d+=this[s+I]*b;return d},c.prototype.readUintBE=c.prototype.readUIntBE=function(s,u,l){s=s>>>0,u=u>>>0,l||q(s,u,this.length);let d=this[s+--u],b=1;for(;u>0&&(b*=256);)d+=this[s+--u]*b;return d},c.prototype.readUint8=c.prototype.readUInt8=function(s,u){return s=s>>>0,u||q(s,1,this.length),this[s]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(s,u){return s=s>>>0,u||q(s,2,this.length),this[s]|this[s+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(s,u){return s=s>>>0,u||q(s,2,this.length),this[s]<<8|this[s+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(s,u){return s=s>>>0,u||q(s,4,this.length),(this[s]|this[s+1]<<8|this[s+2]<<16)+this[s+3]*16777216},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(s,u){return s=s>>>0,u||q(s,4,this.length),this[s]*16777216+(this[s+1]<<16|this[s+2]<<8|this[s+3])},c.prototype.readBigUInt64LE=Wt(function(s){s=s>>>0,$(s,"offset");const u=this[s],l=this[s+7];(u===void 0||l===void 0)&&J(s,this.length-8);const d=u+this[++s]*2**8+this[++s]*2**16+this[++s]*2**24,b=this[++s]+this[++s]*2**8+this[++s]*2**16+l*2**24;return BigInt(d)+(BigInt(b)<<BigInt(32))}),c.prototype.readBigUInt64BE=Wt(function(s){s=s>>>0,$(s,"offset");const u=this[s],l=this[s+7];(u===void 0||l===void 0)&&J(s,this.length-8);const d=u*2**24+this[++s]*2**16+this[++s]*2**8+this[++s],b=this[++s]*2**24+this[++s]*2**16+this[++s]*2**8+l;return(BigInt(d)<<BigInt(32))+BigInt(b)}),c.prototype.readIntLE=function(s,u,l){s=s>>>0,u=u>>>0,l||q(s,u,this.length);let d=this[s],b=1,I=0;for(;++I<u&&(b*=256);)d+=this[s+I]*b;return b*=128,d>=b&&(d-=Math.pow(2,8*u)),d},c.prototype.readIntBE=function(s,u,l){s=s>>>0,u=u>>>0,l||q(s,u,this.length);let d=u,b=1,I=this[s+--d];for(;d>0&&(b*=256);)I+=this[s+--d]*b;return b*=128,I>=b&&(I-=Math.pow(2,8*u)),I},c.prototype.readInt8=function(s,u){return s=s>>>0,u||q(s,1,this.length),this[s]&128?(255-this[s]+1)*-1:this[s]},c.prototype.readInt16LE=function(s,u){s=s>>>0,u||q(s,2,this.length);const l=this[s]|this[s+1]<<8;return l&32768?l|4294901760:l},c.prototype.readInt16BE=function(s,u){s=s>>>0,u||q(s,2,this.length);const l=this[s+1]|this[s]<<8;return l&32768?l|4294901760:l},c.prototype.readInt32LE=function(s,u){return s=s>>>0,u||q(s,4,this.length),this[s]|this[s+1]<<8|this[s+2]<<16|this[s+3]<<24},c.prototype.readInt32BE=function(s,u){return s=s>>>0,u||q(s,4,this.length),this[s]<<24|this[s+1]<<16|this[s+2]<<8|this[s+3]},c.prototype.readBigInt64LE=Wt(function(s){s=s>>>0,$(s,"offset");const u=this[s],l=this[s+7];(u===void 0||l===void 0)&&J(s,this.length-8);const d=this[s+4]+this[s+5]*2**8+this[s+6]*2**16+(l<<24);return(BigInt(d)<<BigInt(32))+BigInt(u+this[++s]*2**8+this[++s]*2**16+this[++s]*2**24)}),c.prototype.readBigInt64BE=Wt(function(s){s=s>>>0,$(s,"offset");const u=this[s],l=this[s+7];(u===void 0||l===void 0)&&J(s,this.length-8);const d=(u<<24)+this[++s]*2**16+this[++s]*2**8+this[++s];return(BigInt(d)<<BigInt(32))+BigInt(this[++s]*2**24+this[++s]*2**16+this[++s]*2**8+l)}),c.prototype.readFloatLE=function(s,u){return s=s>>>0,u||q(s,4,this.length),e.read(this,s,!0,23,4)},c.prototype.readFloatBE=function(s,u){return s=s>>>0,u||q(s,4,this.length),e.read(this,s,!1,23,4)},c.prototype.readDoubleLE=function(s,u){return s=s>>>0,u||q(s,8,this.length),e.read(this,s,!0,52,8)},c.prototype.readDoubleBE=function(s,u){return s=s>>>0,u||q(s,8,this.length),e.read(this,s,!1,52,8)};function rt(h,s,u,l,d,b){if(!c.isBuffer(h))throw new TypeError('"buffer" argument must be a Buffer instance');if(s>d||s<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(s,u,l,d){if(s=+s,u=u>>>0,l=l>>>0,!d){const H=Math.pow(2,8*l)-1;rt(this,s,u,l,H,0)}let b=1,I=0;for(this[u]=s&255;++I<l&&(b*=256);)this[u+I]=s/b&255;return u+l},c.prototype.writeUintBE=c.prototype.writeUIntBE=function(s,u,l,d){if(s=+s,u=u>>>0,l=l>>>0,!d){const H=Math.pow(2,8*l)-1;rt(this,s,u,l,H,0)}let b=l-1,I=1;for(this[u+b]=s&255;--b>=0&&(I*=256);)this[u+b]=s/I&255;return u+l},c.prototype.writeUint8=c.prototype.writeUInt8=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,1,255,0),this[u]=s&255,u+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,2,65535,0),this[u]=s&255,this[u+1]=s>>>8,u+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,2,65535,0),this[u]=s>>>8,this[u+1]=s&255,u+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,4,4294967295,0),this[u+3]=s>>>24,this[u+2]=s>>>16,this[u+1]=s>>>8,this[u]=s&255,u+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,4,4294967295,0),this[u]=s>>>24,this[u+1]=s>>>16,this[u+2]=s>>>8,this[u+3]=s&255,u+4};function xt(h,s,u,l,d){j(s,l,d,h,u,7);let b=Number(s&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(s>>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,s,u,l,d){j(s,l,d,h,u,7);let b=Number(s&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(s>>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(s,u=0){return xt(this,s,u,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Wt(function(s,u=0){return Ut(this,s,u,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(s,u,l,d){if(s=+s,u=u>>>0,!d){const pt=Math.pow(2,8*l-1);rt(this,s,u,l,pt-1,-pt)}let b=0,I=1,H=0;for(this[u]=s&255;++b<l&&(I*=256);)s<0&&H===0&&this[u+b-1]!==0&&(H=1),this[u+b]=(s/I>>0)-H&255;return u+l},c.prototype.writeIntBE=function(s,u,l,d){if(s=+s,u=u>>>0,!d){const pt=Math.pow(2,8*l-1);rt(this,s,u,l,pt-1,-pt)}let b=l-1,I=1,H=0;for(this[u+b]=s&255;--b>=0&&(I*=256);)s<0&&H===0&&this[u+b+1]!==0&&(H=1),this[u+b]=(s/I>>0)-H&255;return u+l},c.prototype.writeInt8=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,1,127,-128),s<0&&(s=255+s+1),this[u]=s&255,u+1},c.prototype.writeInt16LE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,2,32767,-32768),this[u]=s&255,this[u+1]=s>>>8,u+2},c.prototype.writeInt16BE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,2,32767,-32768),this[u]=s>>>8,this[u+1]=s&255,u+2},c.prototype.writeInt32LE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,4,2147483647,-2147483648),this[u]=s&255,this[u+1]=s>>>8,this[u+2]=s>>>16,this[u+3]=s>>>24,u+4},c.prototype.writeInt32BE=function(s,u,l){return s=+s,u=u>>>0,l||rt(this,s,u,4,2147483647,-2147483648),s<0&&(s=4294967295+s+1),this[u]=s>>>24,this[u+1]=s>>>16,this[u+2]=s>>>8,this[u+3]=s&255,u+4},c.prototype.writeBigInt64LE=Wt(function(s,u=0){return xt(this,s,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Wt(function(s,u=0){return Ut(this,s,u,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Pt(h,s,u,l,d,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,s,u,l,d){return s=+s,u=u>>>0,d||Pt(h,s,u,4),e.write(h,s,u,l,23,4),u+4}c.prototype.writeFloatLE=function(s,u,l){return Zt(this,s,u,!0,l)},c.prototype.writeFloatBE=function(s,u,l){return Zt(this,s,u,!1,l)};function Gt(h,s,u,l,d){return s=+s,u=u>>>0,d||Pt(h,s,u,8),e.write(h,s,u,l,52,8),u+8}c.prototype.writeDoubleLE=function(s,u,l){return Gt(this,s,u,!0,l)},c.prototype.writeDoubleBE=function(s,u,l){return Gt(this,s,u,!1,l)},c.prototype.copy=function(s,u,l,d){if(!c.isBuffer(s))throw new TypeError("argument should be a Buffer");if(l||(l=0),!d&&d!==0&&(d=this.length),u>=s.length&&(u=s.length),u||(u=0),d>0&&d<l&&(d=l),d===l||s.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(d<0)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),s.length-u<d-l&&(d=s.length-u+l);const b=d-l;return this===s&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(u,l,d):Uint8Array.prototype.set.call(s,this.subarray(l,d),u),b},c.prototype.fill=function(s,u,l,d){if(typeof s=="string"){if(typeof u=="string"?(d=u,u=0,l=this.length):typeof l=="string"&&(d=l,l=this.length),d!==void 0&&typeof d!="string")throw new TypeError("encoding must be a string");if(typeof d=="string"&&!c.isEncoding(d))throw new TypeError("Unknown encoding: "+d);if(s.length===1){const I=s.charCodeAt(0);(d==="utf8"&&I<128||d==="latin1")&&(s=I)}}else typeof s=="number"?s=s&255:typeof s=="boolean"&&(s=Number(s));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,s||(s=0);let b;if(typeof s=="number")for(b=u;b<l;++b)this[b]=s;else{const I=c.isBuffer(s)?s:c.from(s,d),H=I.length;if(H===0)throw new TypeError('The value "'+s+'" is invalid for argument "value"');for(b=0;b<l-u;++b)this[b+u]=I[b%H]}return this};const W={};function y(h,s,u){W[h]=class extends u{constructor(){super(),Object.defineProperty(this,"message",{value:s.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${h}]`,this.stack,delete this.name}get code(){return h}set code(d){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:d,writable:!0})}toString(){return`${this.name} [${h}]: ${this.message}`}}}y("ERR_BUFFER_OUT_OF_BOUNDS",function(h){return h?`${h} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),y("ERR_INVALID_ARG_TYPE",function(h,s){return`The "${h}" argument must be of type number. Received type ${typeof s}`},TypeError),y("ERR_OUT_OF_RANGE",function(h,s,u){let l=`The value of "${h}" is out of range.`,d=u;return Number.isInteger(u)&&Math.abs(u)>2**32?d=_(String(u)):typeof u=="bigint"&&(d=String(u),(u>BigInt(2)**BigInt(32)||u<-(BigInt(2)**BigInt(32)))&&(d=_(d)),d+="n"),l+=` It must be ${s}. Received ${d}`,l},RangeError);function _(h){let s="",u=h.length;const l=h[0]==="-"?1:0;for(;u>=l+4;u-=3)s=`_${h.slice(u-3,u)}${s}`;return`${h.slice(0,u)}${s}`}function E(h,s,u){$(s,"offset"),(h[s]===void 0||h[s+u]===void 0)&&J(s,h.length-(u+1))}function j(h,s,u,l,d,b){if(h>u||h<s){const I=typeof s=="bigint"?"n":"";let H;throw s===0||s===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)}E(l,d,b)}function $(h,s){if(typeof h!="number")throw new W.ERR_INVALID_ARG_TYPE(s,"number",h)}function J(h,s,u){throw Math.floor(h)!==h?($(h,u),new W.ERR_OUT_OF_RANGE("offset","an integer",h)):s<0?new W.ERR_BUFFER_OUT_OF_BOUNDS:new W.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${s}`,h)}const bt=/[^+/0-9A-Za-z-_]/g;function Nt(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,s){s=s||1/0;let u;const l=h.length;let d=null;const b=[];for(let I=0;I<l;++I){if(u=h.charCodeAt(I),u>55295&&u<57344){if(!d){if(u>56319){(s-=3)>-1&&b.push(239,191,189);continue}else if(I+1===l){(s-=3)>-1&&b.push(239,191,189);continue}d=u;continue}if(u<56320){(s-=3)>-1&&b.push(239,191,189),d=u;continue}u=(d-55296<<10|u-56320)+65536}else d&&(s-=3)>-1&&b.push(239,191,189);if(d=null,u<128){if((s-=1)<0)break;b.push(u)}else if(u<2048){if((s-=2)<0)break;b.push(u>>6|192,u&63|128)}else if(u<65536){if((s-=3)<0)break;b.push(u>>12|224,u>>6&63|128,u&63|128)}else if(u<1114112){if((s-=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 s=[];for(let u=0;u<h.length;++u)s.push(h.charCodeAt(u)&255);return s}function Vt(h,s){let u,l,d;const b=[];for(let I=0;I<h.length&&!((s-=2)<0);++I)u=h.charCodeAt(I),l=u>>8,d=u%256,b.push(d),b.push(l);return b}function $t(h){return t.toByteArray(Nt(h))}function Mt(h,s,u,l){let d;for(d=0;d<l&&!(d+u>=s.length||d>=h.length);++d)s[d+u]=h[d];return d}function mt(h,s){return h instanceof s||h!=null&&h.constructor!=null&&h.constructor.name!=null&&h.constructor.name===s.name}function Qt(h){return h!==h}const ir=function(){const h="0123456789abcdef",s=new Array(256);for(let u=0;u<16;++u){const l=u*16;for(let d=0;d<16;++d)s[l+d]=h[u]+h[d]}return s}();function Wt(h){return typeof BigInt>"u"?_i:h}function _i(){throw new Error("BigInt not supported")}}(Mi)),Mi}var nu=Wf();function wi(r){return new Promise((t,e)=>{r.oncomplete=r.onsuccess=()=>t(r.result),r.onabort=r.onerror=()=>e(r.error)})}function iu(r,t){const e=indexedDB.open(r);e.onupgradeneeded=()=>e.result.createObjectStore(t);const n=wi(e);return(o,i)=>n.then(a=>i(a.transaction(t,o).objectStore(t)))}let Fi;function Ms(){return Fi||(Fi=iu("keyval-store","keyval")),Fi}function Zf(r,t=Ms()){return t("readonly",e=>wi(e.get(r)))}function Gf(r,t,e=Ms()){return e("readwrite",n=>(n.put(t,r),wi(n.transaction)))}function Ni(r,t=Ms()){return t("readwrite",e=>(e.delete(r),wi(e.transaction)))}function bn(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 ki={exports:{}},Co;function Yf(){return Co||(Co=1,function(r,t){(function(e){r.exports=e()})(function(){return function e(n,o,i){function a(p,g){if(!o[p]){if(!n[p]){var v=typeof bn=="function"&&bn;if(!g&&v)return v(p,!0);if(c)return c(p,!0);throw new Error("Cannot find module '"+p+"'")}g=o[p]={exports:{}},n[p][0].call(g.exports,function(C){var F=n[p][1][C];return a(F||C)},g,g.exports,e,n,o,i)}return o[p].exports}for(var c=typeof bn=="function"&&bn,f=0;f<i.length;f++)a(i[f]);return a}({1:[function(e,n,o){(function(i,a,c,f,p,g,v,C,F){var T=e("crypto");function U(A,O){O=P(A,O);var m;return(m=O.algorithm!=="passthrough"?T.createHash(O.algorithm):new G).write===void 0&&(m.write=m.update,m.end=m.update),V(O,m).dispatch(A),m.update||m.end(""),m.digest?m.digest(O.encoding==="buffer"?void 0:O.encoding):(A=m.read(),O.encoding!=="buffer"?A.toString(O.encoding):A)}(o=n.exports=U).sha1=function(A){return U(A)},o.keys=function(A){return U(A,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},o.MD5=function(A){return U(A,{algorithm:"md5",encoding:"hex"})},o.keysMD5=function(A){return U(A,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var M=T.getHashes?T.getHashes().slice():["sha1","md5"],k=(M.push("passthrough"),["buffer","hex","binary","base64"]);function P(A,O){var m={};if(m.algorithm=(O=O||{}).algorithm||"sha1",m.encoding=O.encoding||"hex",m.excludeValues=!!O.excludeValues,m.algorithm=m.algorithm.toLowerCase(),m.encoding=m.encoding.toLowerCase(),m.ignoreUnknown=O.ignoreUnknown===!0,m.respectType=O.respectType!==!1,m.respectFunctionNames=O.respectFunctionNames!==!1,m.respectFunctionProperties=O.respectFunctionProperties!==!1,m.unorderedArrays=O.unorderedArrays===!0,m.unorderedSets=O.unorderedSets!==!1,m.unorderedObjects=O.unorderedObjects!==!1,m.replacer=O.replacer||void 0,m.excludeKeys=O.excludeKeys||void 0,A===void 0)throw new Error("Object argument required.");for(var S=0;S<M.length;++S)M[S].toLowerCase()===m.algorithm.toLowerCase()&&(m.algorithm=M[S]);if(M.indexOf(m.algorithm)===-1)throw new Error('Algorithm "'+m.algorithm+'" not supported. supported values: '+M.join(", "));if(k.indexOf(m.encoding)===-1&&m.algorithm!=="passthrough")throw new Error('Encoding "'+m.encoding+'" not supported. supported values: '+k.join(", "));return m}function R(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,O,m){m=m||[];function S(w){return O.update?O.update(w,"utf8"):O.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 B,N=Object.prototype.toString.call(w),Q=/\[object (.*)\]/i.exec(N);if(Q=(Q=Q?Q[1]:"unknown:["+N+"]").toLowerCase(),0<=(N=m.indexOf(w)))return this.dispatch("[CIRCULAR:"+N+"]");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 N=Object.keys(w),A.unorderedObjects&&(N=N.sort()),A.respectType===!1||R(w)||N.splice(0,0,"prototype","__proto__","constructor"),A.excludeKeys&&(N=N.filter(function(z){return!A.excludeKeys(z)})),S("object:"+N.length+":"),B=this,N.forEach(function(z){B.dispatch(z),S(":"),A.excludeValues||B.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 N=this;if(S("array:"+w.length+":"),!z||w.length<=1)return w.forEach(function(L){return N.dispatch(L)});var Q=[],z=w.map(function(L){var D=new G,Y=m.slice();return V(A,D,Y).dispatch(L),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:"),R(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
|
|
15
5
|
(see https://github.com/puleos/object-hash/issues/26)
|
|
16
6
|
Use "options.replacer" or "options.ignoreUnknown"
|
|
17
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}}}o.writeToStream=function(A,O,m){return m===void 0&&(m=O,O={}),V(O=P(A,O),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,o){(function(i,a,c,f,p,g,v,C,F){(function(T){var U=typeof Uint8Array<"u"?Uint8Array:Array,M=43,k=47,P=48,R=97,V=65,G=45,A=95;function O(m){return m=m.charCodeAt(0),m===M||m===G?62:m===k||m===A?63:m<P?-1:m<P+10?m-P+26+26:m<V+26?m-V:m<R+26?m-R+26:void 0}T.toByteArray=function(m){var S,w;if(0<m.length%4)throw new Error("Invalid string. Length must be a multiple of 4");var B=m.length,B=m.charAt(B-2)==="="?2:m.charAt(B-1)==="="?1:0,N=new U(3*m.length/4-B),Q=0<B?m.length-4:m.length,z=0;function L(D){N[z++]=D}for(S=0;S<Q;S+=4,0)L((16711680&(w=O(m.charAt(S))<<18|O(m.charAt(S+1))<<12|O(m.charAt(S+2))<<6|O(m.charAt(S+3))))>>16),L((65280&w)>>8),L(255&w);return B==2?L(255&(w=O(m.charAt(S))<<2|O(m.charAt(S+1))>>4)):B==1&&(L((w=O(m.charAt(S))<<10|O(m.charAt(S+1))<<4|O(m.charAt(S+2))>>2)>>8&255),L(255&w)),N},T.fromByteArray=function(m){var S,w,B,N,Q=m.length%3,z="";function L(D){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(D)}for(S=0,B=m.length-Q;S<B;S+=3)w=(m[S]<<16)+(m[S+1]<<8)+m[S+2],z+=L((N=w)>>18&63)+L(N>>12&63)+L(N>>6&63)+L(63&N);switch(Q){case 1:z=(z+=L((w=m[m.length-1])>>2))+L(w<<4&63)+"==";break;case 2:z=(z=(z+=L((w=(m[m.length-2]<<8)+m[m.length-1])>>10))+L(w>>4&63))+L(w<<2&63)+"="}return z}})(o===void 0?this.base64js={}:o)}).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,o){(function(i,a,M,f,p,g,v,C,F){var T=e("base64-js"),U=e("ieee754");function M(y,_,E){if(!(this instanceof M))return new M(y,_,E);var j,$,J,bt,Nt=typeof y;if(_==="base64"&&Nt=="string")for(y=(bt=y).trim?bt.trim():bt.replace(/^\s+|\s+$/g,"");y.length%4!=0;)y+="=";if(Nt=="number")j=Z(y);else if(Nt=="string")j=M.byteLength(y,_);else{if(Nt!="object")throw new Error("First argument needs to be a number, array or string.");j=Z(y.length)}if(M._useTypedArrays?$=M._augment(new Uint8Array(j)):(($=this).length=j,$._isBuffer=!0),M._useTypedArrays&&typeof y.byteLength=="number")$._set(y);else if(X(bt=y)||M.isBuffer(bt)||bt&&typeof bt=="object"&&typeof bt.length=="number")for(J=0;J<j;J++)M.isBuffer(y)?$[J]=y.readUInt8(J):$[J]=y[J];else if(Nt=="string")$.write(y,0,_);else if(Nt=="number"&&!M._useTypedArrays&&!E)for(J=0;J<j;J++)$[J]=0;return $}function k(y,_,E,j){return M._charsWritten=xt(function($){for(var J=[],bt=0;bt<$.length;bt++)J.push(255&$.charCodeAt(bt));return J}(_),y,E,j)}function P(y,_,E,j){return M._charsWritten=xt(function($){for(var J,bt,Nt=[],kt=0;kt<$.length;kt++)bt=$.charCodeAt(kt),J=bt>>8,bt=bt%256,Nt.push(bt),Nt.push(J);return Nt}(_),y,E,j)}function R(y,_,E){var j="";E=Math.min(y.length,E);for(var $=_;$<E;$++)j+=String.fromCharCode(y[$]);return j}function V(y,_,E,J){J||(W(typeof E=="boolean","missing or invalid endian"),W(_!=null,"missing offset"),W(_+1<y.length,"Trying to read beyond buffer length"));var $,J=y.length;if(!(J<=_))return E?($=y[_],_+1<J&&($|=y[_+1]<<8)):($=y[_]<<8,_+1<J&&($|=y[_+1])),$}function G(y,_,E,J){J||(W(typeof E=="boolean","missing or invalid endian"),W(_!=null,"missing offset"),W(_+3<y.length,"Trying to read beyond buffer length"));var $,J=y.length;if(!(J<=_))return E?(_+2<J&&($=y[_+2]<<16),_+1<J&&($|=y[_+1]<<8),$|=y[_],_+3<J&&($+=y[_+3]<<24>>>0)):(_+1<J&&($=y[_+1]<<16),_+2<J&&($|=y[_+2]<<8),_+3<J&&($|=y[_+3]),$+=y[_]<<24>>>0),$}function A(y,_,E,j){if(j||(W(typeof E=="boolean","missing or invalid endian"),W(_!=null,"missing offset"),W(_+1<y.length,"Trying to read beyond buffer length")),!(y.length<=_))return j=V(y,_,E,!0),32768&j?-1*(65535-j+1):j}function O(y,_,E,j){if(j||(W(typeof E=="boolean","missing or invalid endian"),W(_!=null,"missing offset"),W(_+3<y.length,"Trying to read beyond buffer length")),!(y.length<=_))return j=G(y,_,E,!0),2147483648&j?-1*(4294967295-j+1):j}function m(y,_,E,j){return j||(W(typeof E=="boolean","missing or invalid endian"),W(_+3<y.length,"Trying to read beyond buffer length")),U.read(y,_,E,23,4)}function S(y,_,E,j){return j||(W(typeof E=="boolean","missing or invalid endian"),W(_+7<y.length,"Trying to read beyond buffer length")),U.read(y,_,E,52,8)}function w(y,_,E,j,$){if($||(W(_!=null,"missing value"),W(typeof j=="boolean","missing or invalid endian"),W(E!=null,"missing offset"),W(E+1<y.length,"trying to write beyond buffer length"),Pt(_,65535)),$=y.length,!($<=E))for(var J=0,bt=Math.min($-E,2);J<bt;J++)y[E+J]=(_&255<<8*(j?J:1-J))>>>8*(j?J:1-J)}function B(y,_,E,j,$){if($||(W(_!=null,"missing value"),W(typeof j=="boolean","missing or invalid endian"),W(E!=null,"missing offset"),W(E+3<y.length,"trying to write beyond buffer length"),Pt(_,4294967295)),$=y.length,!($<=E))for(var J=0,bt=Math.min($-E,4);J<bt;J++)y[E+J]=_>>>8*(j?J:3-J)&255}function N(y,_,E,j,$){$||(W(_!=null,"missing value"),W(typeof j=="boolean","missing or invalid endian"),W(E!=null,"missing offset"),W(E+1<y.length,"Trying to write beyond buffer length"),Zt(_,32767,-32768)),y.length<=E||w(y,0<=_?_:65535+_+1,E,j,$)}function Q(y,_,E,j,$){$||(W(_!=null,"missing value"),W(typeof j=="boolean","missing or invalid endian"),W(E!=null,"missing offset"),W(E+3<y.length,"Trying to write beyond buffer length"),Zt(_,2147483647,-2147483648)),y.length<=E||B(y,0<=_?_:4294967295+_+1,E,j,$)}function z(y,_,E,j,$){$||(W(_!=null,"missing value"),W(typeof j=="boolean","missing or invalid endian"),W(E!=null,"missing offset"),W(E+3<y.length,"Trying to write beyond buffer length"),Gt(_,34028234663852886e22,-34028234663852886e22)),y.length<=E||U.write(y,_,E,j,23,4)}function L(y,_,E,j,$){$||(W(_!=null,"missing value"),W(typeof j=="boolean","missing or invalid endian"),W(E!=null,"missing offset"),W(E+7<y.length,"Trying to write beyond buffer length"),Gt(_,17976931348623157e292,-17976931348623157e292)),y.length<=E||U.write(y,_,E,j,52,8)}o.Buffer=M,o.SlowBuffer=M,o.INSPECT_MAX_BYTES=50,M.poolSize=8192,M._useTypedArrays=function(){try{var y=new ArrayBuffer(0),_=new Uint8Array(y);return _.foo=function(){return 42},_.foo()===42&&typeof _.subarray=="function"}catch{return!1}}(),M.isEncoding=function(y){switch(String(y).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}},M.isBuffer=function(y){return!(y==null||!y._isBuffer)},M.byteLength=function(y,_){var E;switch(y+="",_||"utf8"){case"hex":E=y.length/2;break;case"utf8":case"utf-8":E=q(y).length;break;case"ascii":case"binary":case"raw":E=y.length;break;case"base64":E=rt(y).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":E=2*y.length;break;default:throw new Error("Unknown encoding")}return E},M.concat=function(y,_){if(W(X(y),`Usage: Buffer.concat(list, [totalLength])
|
|
18
8
|
list should be an Array.`),y.length===0)return new M(0);if(y.length===1)return y[0];if(typeof _!="number")for($=_=0;$<y.length;$++)_+=y[$].length;for(var E=new M(_),j=0,$=0;$<y.length;$++){var J=y[$];J.copy(E,j),j+=J.length}return E},M.prototype.write=function(y,_,E,j){isFinite(_)?isFinite(E)||(j=E,E=void 0):(kt=j,j=_,_=E,E=kt),_=Number(_)||0;var $,J,bt,Nt,kt=this.length-_;switch((!E||kt<(E=Number(E)))&&(E=kt),j=String(j||"utf8").toLowerCase()){case"hex":$=function(Ht,Vt,$t,Mt){$t=Number($t)||0;var mt=Ht.length-$t;(!Mt||mt<(Mt=Number(Mt)))&&(Mt=mt),W((mt=Vt.length)%2==0,"Invalid hex string"),mt/2<Mt&&(Mt=mt/2);for(var Qt=0;Qt<Mt;Qt++){var ir=parseInt(Vt.substr(2*Qt,2),16);W(!isNaN(ir),"Invalid hex string"),Ht[$t+Qt]=ir}return M._charsWritten=2*Qt,Qt}(this,y,_,E);break;case"utf8":case"utf-8":J=this,bt=_,Nt=E,$=M._charsWritten=xt(q(y),J,bt,Nt);break;case"ascii":case"binary":$=k(this,y,_,E);break;case"base64":J=this,bt=_,Nt=E,$=M._charsWritten=xt(rt(y),J,bt,Nt);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":$=P(this,y,_,E);break;default:throw new Error("Unknown encoding")}return $},M.prototype.toString=function(y,_,E){var j,$,J,bt,Nt=this;if(y=String(y||"utf8").toLowerCase(),_=Number(_)||0,(E=E!==void 0?Number(E):Nt.length)===_)return"";switch(y){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 Mt="",mt=Ht;mt<Vt;mt++)Mt+=K(kt[mt]);return Mt}(Nt,_,E);break;case"utf8":case"utf-8":j=function(kt,Ht,Vt){var $t="",Mt="";Vt=Math.min(kt.length,Vt);for(var mt=Ht;mt<Vt;mt++)kt[mt]<=127?($t+=Ut(Mt)+String.fromCharCode(kt[mt]),Mt=""):Mt+="%"+kt[mt].toString(16);return $t+Ut(Mt)}(Nt,_,E);break;case"ascii":case"binary":j=R(Nt,_,E);break;case"base64":$=Nt,bt=E,j=(J=_)===0&&bt===$.length?T.fromByteArray($):T.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),Mt="",mt=0;mt<$t.length;mt+=2)Mt+=String.fromCharCode($t[mt]+256*$t[mt+1]);return Mt}(Nt,_,E);break;default:throw new Error("Unknown encoding")}return j},M.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},M.prototype.copy=function(y,_,E,j){if(_=_||0,(j=j||j===0?j:this.length)!==(E=E||0)&&y.length!==0&&this.length!==0){W(E<=j,"sourceEnd < sourceStart"),W(0<=_&&_<y.length,"targetStart out of bounds"),W(0<=E&&E<this.length,"sourceStart out of bounds"),W(0<=j&&j<=this.length,"sourceEnd out of bounds"),j>this.length&&(j=this.length);var $=(j=y.length-_<j-E?y.length-_+E:j)-E;if($<100||!M._useTypedArrays)for(var J=0;J<$;J++)y[J+_]=this[J+E];else y._set(this.subarray(E,E+$),_)}},M.prototype.slice=function(y,_){var E=this.length;if(y=Y(y,E,0),_=Y(_,E,E),M._useTypedArrays)return M._augment(this.subarray(y,_));for(var j=_-y,$=new M(j,void 0,!0),J=0;J<j;J++)$[J]=this[J+y];return $},M.prototype.get=function(y){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(y)},M.prototype.set=function(y,_){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(y,_)},M.prototype.readUInt8=function(y,_){if(_||(W(y!=null,"missing offset"),W(y<this.length,"Trying to read beyond buffer length")),!(y>=this.length))return this[y]},M.prototype.readUInt16LE=function(y,_){return V(this,y,!0,_)},M.prototype.readUInt16BE=function(y,_){return V(this,y,!1,_)},M.prototype.readUInt32LE=function(y,_){return G(this,y,!0,_)},M.prototype.readUInt32BE=function(y,_){return G(this,y,!1,_)},M.prototype.readInt8=function(y,_){if(_||(W(y!=null,"missing offset"),W(y<this.length,"Trying to read beyond buffer length")),!(y>=this.length))return 128&this[y]?-1*(255-this[y]+1):this[y]},M.prototype.readInt16LE=function(y,_){return A(this,y,!0,_)},M.prototype.readInt16BE=function(y,_){return A(this,y,!1,_)},M.prototype.readInt32LE=function(y,_){return O(this,y,!0,_)},M.prototype.readInt32BE=function(y,_){return O(this,y,!1,_)},M.prototype.readFloatLE=function(y,_){return m(this,y,!0,_)},M.prototype.readFloatBE=function(y,_){return m(this,y,!1,_)},M.prototype.readDoubleLE=function(y,_){return S(this,y,!0,_)},M.prototype.readDoubleBE=function(y,_){return S(this,y,!1,_)},M.prototype.writeUInt8=function(y,_,E){E||(W(y!=null,"missing value"),W(_!=null,"missing offset"),W(_<this.length,"trying to write beyond buffer length"),Pt(y,255)),_>=this.length||(this[_]=y)},M.prototype.writeUInt16LE=function(y,_,E){w(this,y,_,!0,E)},M.prototype.writeUInt16BE=function(y,_,E){w(this,y,_,!1,E)},M.prototype.writeUInt32LE=function(y,_,E){B(this,y,_,!0,E)},M.prototype.writeUInt32BE=function(y,_,E){B(this,y,_,!1,E)},M.prototype.writeInt8=function(y,_,E){E||(W(y!=null,"missing value"),W(_!=null,"missing offset"),W(_<this.length,"Trying to write beyond buffer length"),Zt(y,127,-128)),_>=this.length||(0<=y?this.writeUInt8(y,_,E):this.writeUInt8(255+y+1,_,E))},M.prototype.writeInt16LE=function(y,_,E){N(this,y,_,!0,E)},M.prototype.writeInt16BE=function(y,_,E){N(this,y,_,!1,E)},M.prototype.writeInt32LE=function(y,_,E){Q(this,y,_,!0,E)},M.prototype.writeInt32BE=function(y,_,E){Q(this,y,_,!1,E)},M.prototype.writeFloatLE=function(y,_,E){z(this,y,_,!0,E)},M.prototype.writeFloatBE=function(y,_,E){z(this,y,_,!1,E)},M.prototype.writeDoubleLE=function(y,_,E){L(this,y,_,!0,E)},M.prototype.writeDoubleBE=function(y,_,E){L(this,y,_,!1,E)},M.prototype.fill=function(y,_,E){if(_=_||0,E=E||this.length,W(typeof(y=typeof(y=y||0)=="string"?y.charCodeAt(0):y)=="number"&&!isNaN(y),"value is not a number"),W(_<=E,"end < start"),E!==_&&this.length!==0){W(0<=_&&_<this.length,"start out of bounds"),W(0<=E&&E<=this.length,"end out of bounds");for(var j=_;j<E;j++)this[j]=y}},M.prototype.inspect=function(){for(var y=[],_=this.length,E=0;E<_;E++)if(y[E]=K(this[E]),E===o.INSPECT_MAX_BYTES){y[E+1]="...";break}return"<Buffer "+y.join(" ")+">"},M.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(M._useTypedArrays)return new M(this).buffer;for(var y=new Uint8Array(this.length),_=0,E=y.length;_<E;_+=1)y[_]=this[_];return y.buffer};var D=M.prototype;function Y(y,_,E){return typeof y!="number"?E:_<=(y=~~y)?_:0<=y||0<=(y+=_)?y:0}function Z(y){return(y=~~Math.ceil(+y))<0?0:y}function X(y){return(Array.isArray||function(_){return Object.prototype.toString.call(_)==="[object Array]"})(y)}function K(y){return y<16?"0"+y.toString(16):y.toString(16)}function q(y){for(var _=[],E=0;E<y.length;E++){var j=y.charCodeAt(E);if(j<=127)_.push(y.charCodeAt(E));else for(var $=E,J=(55296<=j&&j<=57343&&E++,encodeURIComponent(y.slice($,E+1)).substr(1).split("%")),bt=0;bt<J.length;bt++)_.push(parseInt(J[bt],16))}return _}function rt(y){return T.toByteArray(y)}function xt(y,_,E,j){for(var $=0;$<j&&!($+E>=_.length||$>=y.length);$++)_[$+E]=y[$];return $}function Ut(y){try{return decodeURIComponent(y)}catch{return"�"}}function Pt(y,_){W(typeof y=="number","cannot write a non-number as a number"),W(0<=y,"specified a negative value for writing an unsigned value"),W(y<=_,"value is larger than maximum value for type"),W(Math.floor(y)===y,"value has a fractional component")}function Zt(y,_,E){W(typeof y=="number","cannot write a non-number as a number"),W(y<=_,"value larger than maximum allowed value"),W(E<=y,"value smaller than minimum allowed value"),W(Math.floor(y)===y,"value has a fractional component")}function Gt(y,_,E){W(typeof y=="number","cannot write a non-number as a number"),W(y<=_,"value larger than maximum allowed value"),W(E<=y,"value smaller than minimum allowed value")}function W(y,_){if(!y)throw new Error(_||"Failed assertion")}M._augment=function(y){return y._isBuffer=!0,y._get=y.get,y._set=y.set,y.get=D.get,y.set=D.set,y.write=D.write,y.toString=D.toString,y.toLocaleString=D.toString,y.toJSON=D.toJSON,y.copy=D.copy,y.slice=D.slice,y.readUInt8=D.readUInt8,y.readUInt16LE=D.readUInt16LE,y.readUInt16BE=D.readUInt16BE,y.readUInt32LE=D.readUInt32LE,y.readUInt32BE=D.readUInt32BE,y.readInt8=D.readInt8,y.readInt16LE=D.readInt16LE,y.readInt16BE=D.readInt16BE,y.readInt32LE=D.readInt32LE,y.readInt32BE=D.readInt32BE,y.readFloatLE=D.readFloatLE,y.readFloatBE=D.readFloatBE,y.readDoubleLE=D.readDoubleLE,y.readDoubleBE=D.readDoubleBE,y.writeUInt8=D.writeUInt8,y.writeUInt16LE=D.writeUInt16LE,y.writeUInt16BE=D.writeUInt16BE,y.writeUInt32LE=D.writeUInt32LE,y.writeUInt32BE=D.writeUInt32BE,y.writeInt8=D.writeInt8,y.writeInt16LE=D.writeInt16LE,y.writeInt16BE=D.writeInt16BE,y.writeInt32LE=D.writeInt32LE,y.writeInt32BE=D.writeInt32BE,y.writeFloatLE=D.writeFloatLE,y.writeFloatBE=D.writeFloatBE,y.writeDoubleLE=D.writeDoubleLE,y.writeDoubleBE=D.writeDoubleBE,y.fill=D.fill,y.inspect=D.inspect,y.toArrayBuffer=D.toArrayBuffer,y}}).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,o){(function(i,a,T,f,p,g,v,C,F){var T=e("buffer").Buffer,U=4,M=new T(U);M.fill(0),n.exports={hash:function(k,P,R,V){for(var G=P(function(w,B){w.length%U!=0&&(N=w.length+(U-w.length%U),w=T.concat([w,M],N));for(var N,Q=[],z=B?w.readInt32BE:w.readInt32LE,L=0;L<w.length;L+=U)Q.push(z.call(w,L));return Q}(k=T.isBuffer(k)?k:new T(k),V),8*k.length),P=V,A=new T(R),O=P?A.writeInt32BE:A.writeInt32LE,m=0;m<G.length;m++)O.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,o){(function(i,a,T,f,p,g,v,C,F){var T=e("buffer").Buffer,U=e("./sha"),M=e("./sha256"),k=e("./rng"),P={sha1:U,sha256:M,md5:e("./md5")},R=64,V=new T(R);function G(w,B){var N=P[w=w||"sha1"],Q=[];return N||A("algorithm:",w,"is not yet supported"),{update:function(z){return T.isBuffer(z)||(z=new T(z)),Q.push(z),z.length,this},digest:function(z){var L=T.concat(Q),L=B?function(D,Y,Z){T.isBuffer(Y)||(Y=new T(Y)),T.isBuffer(Z)||(Z=new T(Z)),Y.length>R?Y=D(Y):Y.length<R&&(Y=T.concat([Y,V],R));for(var X=new T(R),K=new T(R),q=0;q<R;q++)X[q]=54^Y[q],K[q]=92^Y[q];return Z=D(T.concat([X,Z])),D(T.concat([K,Z]))}(N,B,L):N(L);return Q=null,z?L.toString(z):L}}}function A(){var w=[].slice.call(arguments).join(" ");throw new Error([w,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join(`
|
|
19
|
-
`))}V.fill(0),o.createHash=function(w){return G(w)},o.createHmac=G,o.randomBytes=function(w,B){if(!B||!B.call)return new T(k(w));try{B.call(this,void 0,new T(k(w)))}catch(N){B(N)}};var O,m=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],S=function(w){o[w]=function(){A("sorry,",w,"is not implemented yet")}};for(O in m)S(m[O])}).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,o){(function(i,a,c,f,p,g,v,C,F){var T=e("./helpers");function U(A,O){A[O>>5]|=128<<O%32,A[14+(O+64>>>9<<4)]=O;for(var m=1732584193,S=-271733879,w=-1732584194,B=271733878,N=0;N<A.length;N+=16){var Q=m,z=S,L=w,D=B,m=k(m,S,w,B,A[N+0],7,-680876936),B=k(B,m,S,w,A[N+1],12,-389564586),w=k(w,B,m,S,A[N+2],17,606105819),S=k(S,w,B,m,A[N+3],22,-1044525330);m=k(m,S,w,B,A[N+4],7,-176418897),B=k(B,m,S,w,A[N+5],12,1200080426),w=k(w,B,m,S,A[N+6],17,-1473231341),S=k(S,w,B,m,A[N+7],22,-45705983),m=k(m,S,w,B,A[N+8],7,1770035416),B=k(B,m,S,w,A[N+9],12,-1958414417),w=k(w,B,m,S,A[N+10],17,-42063),S=k(S,w,B,m,A[N+11],22,-1990404162),m=k(m,S,w,B,A[N+12],7,1804603682),B=k(B,m,S,w,A[N+13],12,-40341101),w=k(w,B,m,S,A[N+14],17,-1502002290),m=P(m,S=k(S,w,B,m,A[N+15],22,1236535329),w,B,A[N+1],5,-165796510),B=P(B,m,S,w,A[N+6],9,-1069501632),w=P(w,B,m,S,A[N+11],14,643717713),S=P(S,w,B,m,A[N+0],20,-373897302),m=P(m,S,w,B,A[N+5],5,-701558691),B=P(B,m,S,w,A[N+10],9,38016083),w=P(w,B,m,S,A[N+15],14,-660478335),S=P(S,w,B,m,A[N+4],20,-405537848),m=P(m,S,w,B,A[N+9],5,568446438),B=P(B,m,S,w,A[N+14],9,-1019803690),w=P(w,B,m,S,A[N+3],14,-187363961),S=P(S,w,B,m,A[N+8],20,1163531501),m=P(m,S,w,B,A[N+13],5,-1444681467),B=P(B,m,S,w,A[N+2],9,-51403784),w=P(w,B,m,S,A[N+7],14,1735328473),m=R(m,S=P(S,w,B,m,A[N+12],20,-1926607734),w,B,A[N+5],4,-378558),B=R(B,m,S,w,A[N+8],11,-2022574463),w=R(w,B,m,S,A[N+11],16,1839030562),S=R(S,w,B,m,A[N+14],23,-35309556),m=R(m,S,w,B,A[N+1],4,-1530992060),B=R(B,m,S,w,A[N+4],11,1272893353),w=R(w,B,m,S,A[N+7],16,-155497632),S=R(S,w,B,m,A[N+10],23,-1094730640),m=R(m,S,w,B,A[N+13],4,681279174),B=R(B,m,S,w,A[N+0],11,-358537222),w=R(w,B,m,S,A[N+3],16,-722521979),S=R(S,w,B,m,A[N+6],23,76029189),m=R(m,S,w,B,A[N+9],4,-640364487),B=R(B,m,S,w,A[N+12],11,-421815835),w=R(w,B,m,S,A[N+15],16,530742520),m=V(m,S=R(S,w,B,m,A[N+2],23,-995338651),w,B,A[N+0],6,-198630844),B=V(B,m,S,w,A[N+7],10,1126891415),w=V(w,B,m,S,A[N+14],15,-1416354905),S=V(S,w,B,m,A[N+5],21,-57434055),m=V(m,S,w,B,A[N+12],6,1700485571),B=V(B,m,S,w,A[N+3],10,-1894986606),w=V(w,B,m,S,A[N+10],15,-1051523),S=V(S,w,B,m,A[N+1],21,-2054922799),m=V(m,S,w,B,A[N+8],6,1873313359),B=V(B,m,S,w,A[N+15],10,-30611744),w=V(w,B,m,S,A[N+6],15,-1560198380),S=V(S,w,B,m,A[N+13],21,1309151649),m=V(m,S,w,B,A[N+4],6,-145523070),B=V(B,m,S,w,A[N+11],10,-1120210379),w=V(w,B,m,S,A[N+2],15,718787259),S=V(S,w,B,m,A[N+9],21,-343485551),m=G(m,Q),S=G(S,z),w=G(w,L),B=G(B,D)}return Array(m,S,w,B)}function M(A,O,m,S,w,B){return G((O=G(G(O,A),G(S,B)))<<w|O>>>32-w,m)}function k(A,O,m,S,w,B,N){return M(O&m|~O&S,A,O,w,B,N)}function P(A,O,m,S,w,B,N){return M(O&S|m&~S,A,O,w,B,N)}function R(A,O,m,S,w,B,N){return M(O^m^S,A,O,w,B,N)}function V(A,O,m,S,w,B,N){return M(m^(O|~S),A,O,w,B,N)}function G(A,O){var m=(65535&A)+(65535&O);return(A>>16)+(O>>16)+(m>>16)<<16|65535&m}n.exports=function(A){return T.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,o){(function(i,a,c,f,p,g,v,C,F){n.exports=function(T){for(var U,M=new Array(T),k=0;k<T;k++)(3&k)==0&&(U=4294967296*Math.random()),M[k]=U>>>((3&k)<<3)&255;return M}}).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,o){(function(i,a,c,f,p,g,v,C,F){var T=e("./helpers");function U(P,R){P[R>>5]|=128<<24-R%32,P[15+(R+64>>9<<4)]=R;for(var V,G,A,O=Array(80),m=1732584193,S=-271733879,w=-1732584194,B=271733878,N=-1009589776,Q=0;Q<P.length;Q+=16){for(var z=m,L=S,D=w,Y=B,Z=N,X=0;X<80;X++){O[X]=X<16?P[Q+X]:k(O[X-3]^O[X-8]^O[X-14]^O[X-16],1);var K=M(M(k(m,5),(K=S,G=w,A=B,(V=X)<20?K&G|~K&A:!(V<40)&&V<60?K&G|K&A|G&A:K^G^A)),M(M(N,O[X]),(V=X)<20?1518500249:V<40?1859775393:V<60?-1894007588:-899497514)),N=B,B=w,w=k(S,30),S=m,m=K}m=M(m,z),S=M(S,L),w=M(w,D),B=M(B,Y),N=M(N,Z)}return Array(m,S,w,B,N)}function M(P,R){var V=(65535&P)+(65535&R);return(P>>16)+(R>>16)+(V>>16)<<16|65535&V}function k(P,R){return P<<R|P>>>32-R}n.exports=function(P){return T.hash(P,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,o){(function(i,a,c,f,p,g,v,C,F){function T(R,V){var G=(65535&R)+(65535&V);return(R>>16)+(V>>16)+(G>>16)<<16|65535&G}function U(R,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),O=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),m=new Array(64);R[V>>5]|=128<<24-V%32,R[15+(V+64>>9<<4)]=V;for(var S,w,B=0;B<R.length;B+=16){for(var N=O[0],Q=O[1],z=O[2],L=O[3],D=O[4],Y=O[5],Z=O[6],X=O[7],K=0;K<64;K++)m[K]=K<16?R[K+B]:T(T(T((w=m[K-2],k(w,17)^k(w,19)^P(w,10)),m[K-7]),(w=m[K-15],k(w,7)^k(w,18)^P(w,3))),m[K-16]),G=T(T(T(T(X,k(w=D,6)^k(w,11)^k(w,25)),D&Y^~D&Z),A[K]),m[K]),S=T(k(S=N,2)^k(S,13)^k(S,22),N&Q^N&z^Q&z),X=Z,Z=Y,Y=D,D=T(L,G),L=z,z=Q,Q=N,N=T(G,S);O[0]=T(N,O[0]),O[1]=T(Q,O[1]),O[2]=T(z,O[2]),O[3]=T(L,O[3]),O[4]=T(D,O[4]),O[5]=T(Y,O[5]),O[6]=T(Z,O[6]),O[7]=T(X,O[7])}return O}var M=e("./helpers"),k=function(R,V){return R>>>V|R<<32-V},P=function(R,V){return R>>>V};n.exports=function(R){return M.hash(R,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,o){(function(i,a,c,f,p,g,v,C,F){o.read=function(T,U,M,k,B){var R,V,G=8*B-k-1,A=(1<<G)-1,O=A>>1,m=-7,S=M?B-1:0,w=M?-1:1,B=T[U+S];for(S+=w,R=B&(1<<-m)-1,B>>=-m,m+=G;0<m;R=256*R+T[U+S],S+=w,m-=8);for(V=R&(1<<-m)-1,R>>=-m,m+=k;0<m;V=256*V+T[U+S],S+=w,m-=8);if(R===0)R=1-O;else{if(R===A)return V?NaN:1/0*(B?-1:1);V+=Math.pow(2,k),R-=O}return(B?-1:1)*V*Math.pow(2,R-k)},o.write=function(T,U,M,k,P,N){var V,G,A=8*N-P-1,O=(1<<A)-1,m=O>>1,S=P===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=k?0:N-1,B=k?1:-1,N=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=O):(V=Math.floor(Math.log(U)/Math.LN2),U*(k=Math.pow(2,-V))<1&&(V--,k*=2),2<=(U+=1<=V+m?S/k:S*Math.pow(2,1-m))*k&&(V++,k/=2),O<=V+m?(G=0,V=O):1<=V+m?(G=(U*k-1)*Math.pow(2,P),V+=m):(G=U*Math.pow(2,m-1)*Math.pow(2,P),V=0));8<=P;T[M+w]=255&G,w+=B,G/=256,P-=8);for(V=V<<P|G,A+=P;0<A;T[M+w]=255&V,w+=B,V/=256,A-=8);T[M+w-B]|=128*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/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754")},{buffer:3,lYpoI2:11}],11:[function(e,n,o){(function(i,a,c,f,p,g,v,C,F){var T,U,M;function k(){}(i=n.exports={}).nextTick=(U=typeof window<"u"&&window.setImmediate,M=typeof window<"u"&&window.postMessage&&window.addEventListener,U?function(P){return window.setImmediate(P)}:M?(T=[],window.addEventListener("message",function(P){var R=P.source;R!==window&&R!==null||P.data!=="process-tick"||(P.stopPropagation(),0<T.length&&T.shift()())},!0),function(P){T.push(P),window.postMessage("process-tick","*")}):function(P){setTimeout(P,0)}),i.title="browser",i.browser=!0,i.env={},i.argv=[],i.on=k,i.addListener=k,i.once=k,i.off=k,i.removeListener=k,i.removeAllListeners=k,i.emit=k,i.binding=function(P){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(P){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)})}(ki)),ki.exports}var Jf=Yf();const Hf=Ts(Jf);function qf(r){return new Promise(t=>setTimeout(t,r))}class Kf{cache;url;params;cache_prefix;fetchOptions;timeout;_pending={};constructor(t,e,n={}){const o={...e};n.parameters&&(o["x-parameters"]=JSON.stringify(n.parameters)),n.chunks&&(o["x-chunks"]=n.chunks),n.downsample&&(o["x-downsample"]=JSON.stringify(n.downsample)),o["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:o},this.url=t;const i=t.split("/").pop();n.nocache||typeof window>"u"?this.cache=void 0:this.cache=iu("zarr","cache"),this.cache_prefix=Hf({datasource:i,...n.parameters,chunks:n.chunks,downsample:n.downsample}),this.timeout=n.timeout||6e4}async get(t,e,n=0){const o=`${this.cache_prefix}${t}`;let i=null;if(this.cache&&(i=await Zf(o,this.cache),i&&delete this._pending[o],this._pending[o]))if(await qf(200),n>this.timeout){await Ni(o,this.cache),delete this._pending[o],console.error("Zarr timeout");return}else return await this.get(t,e,n+200);if(!i){this._pending[o]=!0;try{const a={...this.fetchOptions,...e,headers:{...this.fetchOptions.headers||{},...e?.headers||{}},signal:AbortSignal.timeout(this.timeout)},c=new URLSearchParams(this.params).toString(),f=await fetch(`${this.url}${t}?${c}`,a);if(f.status===404){this.cache&&await Ni(o,this.cache);return}if(f.status>=400)throw new Error(`HTTP error: ${f.status}`);i=new Uint8Array(await f.arrayBuffer()),this.cache&&await Gf(o,i,this.cache)}catch(a){if(console.debug("Zarr retry:"+o),n<this.timeout/200)return delete this._pending[o],await this.get(t,e,n+200);this.cache&&await Ni(o,this.cache),console.error(a);return}finally{delete this._pending[o]}}return i}}const Po=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 Xf(r){const t=await Po(r,".zattrs"),e=await Po(r);e.dtype.startsWith("<M8")&&(t._dtype=e.dtype);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 o={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 Br(r.store,r.path,o)}function bi(r,t,e){const n=e.value;return e.value=async function(...o){const i=Date.now(),a=await n.apply(this,o),f=Date.now()-i;return console.debug(`${t} took ${f}ms`),a},e}var Qf=Object.defineProperty,td=Object.getOwnPropertyDescriptor,ed=(r,t,e,n)=>{for(var o=td(t,e),i=r.length-1,a;i>=0;i--)(a=r[i])&&(o=a(t,e,o)||o);return o&&Qf(t,e,o),o};const su=r=>{const t=new nu.Buffer(r,"base64");return Vf.Geometry.parse(t).toGeoJSON()},ci=r=>r&&(Array.isArray(r)||ArrayBuffer.isView(r)),rd=r=>{const t=[];if(!ci(r))return t;for(;t.push(r.length),ci(r[0]);)r=r[0];return t},nd=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)},id=r=>{let t=r.toString().toLowerCase();return r.typeId==5?t="v2:object":r.typeId==1&&(t="uint8"),t},sd=r=>{if(!Array.isArray(r))return r;const t=r.flat(1/0);if(ci(t[0])){const e=t[0].length,n=new t[0].constructor(t.length*e);for(let o=0;o<t.length;o++)n.set(t[o],o*e);return n}else return t},od=r=>{const t=r.length,e=Array(t);for(let n=t-1,o=1;n>=0;n--)e[n]=o,o*=r[n];return e},Fs=(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 o=new Array(t[0]);for(let i=0;i<t[0];i++)o[i]=Fs(r,t.slice(1),e.slice(1),n+i*e[0]);return o},ad=(r,t)=>{const[e,n]=t.split("<M8"),o=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];o[a]=Number(c/i)}return Fs(o,r.shape,r.stride)},ou=(r,t,e)=>{const n=Object.keys(t),o={};for(const i in r)ci(r[i].data)&&(o[i]=!0);if(n.length==1)for(let i=0;i<t[n[0]];i++){const a={};for(const c in r)o[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 f in r)r[f].dimensions.includes(n[0])?a[f]={attributes:r[f].attributes,data:r[f].data[i],dimensions:r[f].dimensions.slice(1)}:a[f]=r[f];const c={...t};delete c[n[0]],ou(a,c,e)}return e};class ui{id;dimensions;attributes;arr;constructor(t,e,n,o){this.id=t,this.dimensions=e,this.attributes=n,this.arr=o}async get(t){if(this.arr.shape.length==0||this.arr.shape[0]==0)return[];const e=t&&t.map(o=>{if(typeof o=="string"){const[i,a,c]=o.split(":");return Ui(parseInt(i),parseInt(a),parseInt(c))}else return o}),n=await ih(this.arr,e);if(this.arr.dtype=="v2:object"||!n.shape)return n.data;if(this.arr.dtype=="bool")return[...n.data];{const o=this.arr.attrs._dtype;return o?.startsWith("<M8")?ad(n,o):Fs(n.data,n.shape,n.stride)}}}ed([bi],ui.prototype,"get");class Ge{dimensions;variables;attributes;coordkeys;root;constructor(t,e,n,o,i){this.dimensions=t,this.variables=e,this.attributes=n,this.coordkeys=o,this.root=i}static async zarr(t,e,n={}){const o=new Kf(t,e,{chunks:n.chunks,downsample:n.downsample,parameters:n.parameters,timeout:n.timeout,nocache:n.nocache}),i=await $u(o),a=await Ze(i,{kind:"group"}),c={},f={};for(const g of i.contents())if(g.kind=="array"){let v;try{v=await Ze(a.resolve(g.path),{kind:"array"})}catch(T){const U=typeof T=="object"&&T&&"message"in T?String(T.message):void 0;if(U&&U.includes("<M8"))v=await Xf(a.resolve(g.path));else throw T}const C=v.attrs._ARRAY_DIMENSIONS,F=g.path.split("/").pop();c[F]=new ui(F,C||[],v.attrs,v),C&&C.map((T,U)=>{const M=v.shape[U];if(f[T]&&f[T]!=M)throw new Error(`Inconsistent dimension size for ${T}: ${f[T]} != ${M}`);f[T]=M})}const p=JSON.parse(a.attrs._coordinates)||{};return new Ge(f,c,a.attrs,n.coordkeys||p,a)}static async fromArrow(t,e){const n={},o={record:t.numRows},i={};return t.schema.fields.forEach(a=>{const c=t.getChild(a.name);let f={},p=c?.toArray(),g=id(a.type);if(tt.isTimestamp(a.type)){const v=new Float64Array(p.length),C=BigInt(1e3**(a.type.unit-0));for(let F=0;F<p.length;F++)v[F]=Number(p[F]/C);p=v,g="float64",f={unit:"Unix timestamp (s)"}}else if(tt.isBinary(a.type)){const v=[];for(let C=0;C<p.length;C++)v.push(new nu.Buffer(p[C]).toString("base64"));p=v,g="v2:object"}i[a.name]={dimensions:["record"],attributes:f,data:p,dtype:g}}),await Ge.init({dimensions:o,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 o=new Set;n.forEach(f=>{f.properties&&Object.keys(f.properties).forEach(p=>o.add(p))});const i=n.map(f=>{const p={geometry:f.geometry};return f.properties&&Object.assign(p,f.properties),p}),a={dimensions:{index:i.length},variables:{},attributes:{}},c=await Ge.init(a,{...e,g:"geometry"});await c.assign("geometry",["index"],i.map(f=>f.geometry),{description:"GeoJSON geometry"});for(const f of o){const p=i.map(g=>g[f]);await c.assign(f,["index"],p,{description:`Property: ${f}`})}return c}static async init(t,e){const n=await js(new Map,{attributes:{created:new Date}}),o=new Ge(t.dimensions,{},t.attributes||{},e||{},n);for(const i in t.variables){const{dimensions:a,attributes:c,data:f,dtype:p}=t.variables[i];await o.assign(i,a,f,c,p&&p==="string"?"v2:object":p)}return o}async asDataframe(){const t={},e=[];for(const o in this.variables)t[o]={attributes:this.variables[o].attributes,dimensions:this.variables[o].dimensions},t[o].data=await this.variables[o].get(),this.variables[o].arr.dtype=="int64"&&e.push(o);const n=ou(t,{...this.dimensions},[]);if(this.coordkeys.t)for(let o=0;o<n.length;o++)n[o][this.coordkeys.t]=new Date(1e3*n[o][this.coordkeys.t]).toISOString();if(e.length>0)for(const o of e)for(let i=0;i<n.length;i++)n[i][o]=Number(n[i][o]);return n}async asGeojson(t){if(!this.coordkeys.g&&!t)throw new Error("No geometry found");const e=[],n=await this.asDataframe();for(let o=0;o<n.length;o++){const{...i}=n[o];let a=t;if(!a&&this.coordkeys.g){delete i[this.coordkeys.g];const c=n[o][this.coordkeys.g];c.slice(0,7)=='{"type:'?a=JSON.parse(c):a=su(c)}e.push({type:"Feature",geometry:a,properties:i})}return{type:"FeatureCollection",features:e}}async assign(t,e,n,o,i,a){const c=rd(n);if(c.length!=e.length)throw new Error("Data shape does not match dimensions");e.map((v,C)=>{if(this.dimensions[v]){if(this.dimensions[v]!=c[C])throw new Error(`Existing size of dimension ${v} does not match new data`)}else this.dimensions[v]=c[C]});const f=i||nd(n),p=await js(this.root.resolve(t),{shape:c,data_type:f,chunk_shape:a||c,codecs:f=="v2:object"?[{name:"json2"}]:[]});let g=sd(n);g.length==0?g=null:f=="bool"?g=new qi(g):Array.isArray(g)&&f=="float32"?g=Float32Array.from(g,v=>v??NaN):Array.isArray(g)&&f=="float64"?g=Float64Array.from(g,v=>v??NaN):Array.isArray(g)&&f=="int8"?g=Int8Array.from(g):Array.isArray(g)&&f=="int16"?g=Int16Array.from(g):Array.isArray(g)&&f=="int32"?g=Int32Array.from(g):Array.isArray(g)&&f=="int64"?g=BigInt64Array.from(g.map(v=>BigInt(v))):Array.isArray(g)&&f=="uint8"?g=Uint8Array.from(g):Array.isArray(g)&&f=="uint16"?g=Uint16Array.from(g):Array.isArray(g)&&f=="uint32"?g=Uint32Array.from(g):Array.isArray(g)&&f=="uint64"&&(g=BigUint64Array.from(g.map(v=>BigInt(v)))),g&&await sh(p,c.map(()=>null),{data:g,shape:c,stride:od(c)}),this.variables[t]=new ui(t,e,o||{},p)}}var cd=Object.defineProperty,ud=Object.getOwnPropertyDescriptor,hd=(r,t,e,n)=>{for(var o=ud(t,e),i=r.length-1,a;i>=0;i--)(a=r[i])&&(o=a(t,e,o)||o);return o&&cd(t,e,o),o};const au=class Hi{id;user;creationTime;endTime;write;verified=!1;_connection;static async acquire(t,e={}){if(!t._isV1){const n=new Hi;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 o=new URLSearchParams({duration:String(e.duration??3600)}),i=await fetch(`${t._gateway}/session/?${o.toString()}`,{headers:n});if(i.status!==200)throw new Error(`Failed to create session: ${await i.text()}`);const a=await i.json(),c=new Hi;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)}};hd([bi],au,"acquire");let ld=au;var fd=Object.defineProperty,dd=Object.getOwnPropertyDescriptor,cu=(r,t,e,n)=>{for(var o=dd(t,e),i=r.length-1,a;i>=0;i--)(a=r[i])&&(o=a(t,e,o)||o);return o&&fd(t,e,o),o};const pd=typeof process<"u"&&process.env?.DATAMESH_SERVICE?process.env.DATAMESH_SERVICE:"https://datamesh.oceanum.io",Ns=class uu{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||pd);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||1};return this._currentSession=await ld.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 o=await this.getSessionHeaders(),i=await fetch(n.toString(),{headers:o});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}),o=await fetch(`${this._gateway}/oceanql/${t}?f=arrow`,{headers:n});return await this.validateResponse(o),Xc(await o.arrayBuffer())}async stageRequest(t){const e=JSON.stringify(t),n=await this.getSessionHeaders({"Content-Type":"application/json"}),o=await fetch(`${this._gateway}/oceanql/stage/`,{method:"POST",headers:n,body:e});if(o.status>=400){const i=await o.json();throw new Error(i.detail)}else return o.status===204?null:o.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<uu.LAZY_LOAD_SIZE&&n.container!="dataset"){const f=await this.dataRequest(n.qhash);return await Ge.fromArrow(f,n.coordkeys)}const o=`${this._gateway}/zarr/${this._isV1?"query/":""}${n.qhash}`,i=t.parameters,a=await this.getSessionHeaders(),c=await Ge.zarr(o,a,{parameters:i,timeout:e.timeout||6e4,nocache:this._nocache});if(t.variables)for(const f of Object.keys(c.variables))!t.variables.includes(f)&&!Object.values(c.coordkeys).includes(f)&&delete c.variables[f];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)}};cu([bi],Ns.prototype,"stageRequest");cu([bi],Ns.prototype,"query");let yd=Ns;var Mn={exports:{}},gd=Mn.exports,$o;function md(){return $o||($o=1,function(r,t){(function(e,n){r.exports=n()})(gd,function(){var e=1e3,n=6e4,o=36e5,i="millisecond",a="second",c="minute",f="hour",p="day",g="week",v="month",C="quarter",F="year",T="date",U="Invalid Date",M=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,k=/\[([^\]]+)]|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,P={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 L=["th","st","nd","rd"],D=z%100;return"["+z+(L[(D-20)%10]||L[D]||L[0])+"]"}},R=function(z,L,D){var Y=String(z);return!Y||Y.length>=L?z:""+Array(L+1-Y.length).join(D)+z},V={s:R,z:function(z){var L=-z.utcOffset(),D=Math.abs(L),Y=Math.floor(D/60),Z=D%60;return(L<=0?"+":"-")+R(Y,2,"0")+":"+R(Z,2,"0")},m:function z(L,D){if(L.date()<D.date())return-z(D,L);var Y=12*(D.year()-L.year())+(D.month()-L.month()),Z=L.clone().add(Y,v),X=D-Z<0,K=L.clone().add(Y+(X?-1:1),v);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:v,y:F,w:g,d:p,D:T,h:f,m:c,s:a,ms:i,Q:C}[z]||String(z||"").toLowerCase().replace(/s$/,"")},u:function(z){return z===void 0}},G="en",A={};A[G]=P;var O="$isDayjsObject",m=function(z){return z instanceof N||!(!z||!z[O])},S=function z(L,D,Y){var Z;if(!L)return G;if(typeof L=="string"){var X=L.toLowerCase();A[X]&&(Z=X),D&&(A[X]=D,Z=X);var K=L.split("-");if(!Z&&K.length>1)return z(K[0])}else{var q=L.name;A[q]=L,Z=q}return!Y&&Z&&(G=Z),Z||!Y&&G},w=function(z,L){if(m(z))return z.clone();var D=typeof L=="object"?L:{};return D.date=z,D.args=arguments,new N(D)},B=V;B.l=S,B.i=m,B.w=function(z,L){return w(z,{locale:L.$L,utc:L.$u,x:L.$x,$offset:L.$offset})};var N=function(){function z(D){this.$L=S(D.locale,null,!0),this.parse(D),this.$x=this.$x||D.x||{},this[O]=!0}var L=z.prototype;return L.parse=function(D){this.$d=function(Y){var Z=Y.date,X=Y.utc;if(Z===null)return new Date(NaN);if(B.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(M);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()},L.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()},L.$utils=function(){return B},L.isValid=function(){return this.$d.toString()!==U},L.isSame=function(D,Y){var Z=w(D);return this.startOf(Y)<=Z&&Z<=this.endOf(Y)},L.isAfter=function(D,Y){return w(D)<this.startOf(Y)},L.isBefore=function(D,Y){return this.endOf(Y)<w(D)},L.$g=function(D,Y,Z){return B.u(D)?this[Y]:this.set(Z,D)},L.unix=function(){return Math.floor(this.valueOf()/1e3)},L.valueOf=function(){return this.$d.getTime()},L.startOf=function(D,Y){var Z=this,X=!!B.u(Y)||Y,K=B.p(D),q=function(y,_){var E=B.w(Z.$u?Date.UTC(Z.$y,_,y):new Date(Z.$y,_,y),Z);return X?E:E.endOf(p)},rt=function(y,_){return B.w(Z.toDate()[y].apply(Z.toDate("s"),(X?[0,0,0,0]:[23,59,59,999]).slice(_)),Z)},xt=this.$W,Ut=this.$M,Pt=this.$D,Zt="set"+(this.$u?"UTC":"");switch(K){case F:return X?q(1,0):q(31,11);case v:return X?q(1,Ut):q(0,Ut+1);case g:var Gt=this.$locale().weekStart||0,W=(xt<Gt?xt+7:xt)-Gt;return q(X?Pt-W:Pt+(6-W),Ut);case p:case T:return rt(Zt+"Hours",0);case f:return rt(Zt+"Minutes",1);case c:return rt(Zt+"Seconds",2);case a:return rt(Zt+"Milliseconds",3);default:return this.clone()}},L.endOf=function(D){return this.startOf(D,!1)},L.$set=function(D,Y){var Z,X=B.p(D),K="set"+(this.$u?"UTC":""),q=(Z={},Z[p]=K+"Date",Z[T]=K+"Date",Z[v]=K+"Month",Z[F]=K+"FullYear",Z[f]=K+"Hours",Z[c]=K+"Minutes",Z[a]=K+"Seconds",Z[i]=K+"Milliseconds",Z)[X],rt=X===p?this.$D+(Y-this.$W):Y;if(X===v||X===F){var xt=this.clone().set(T,1);xt.$d[q](rt),xt.init(),this.$d=xt.set(T,Math.min(this.$D,xt.daysInMonth())).$d}else q&&this.$d[q](rt);return this.init(),this},L.set=function(D,Y){return this.clone().$set(D,Y)},L.get=function(D){return this[B.p(D)]()},L.add=function(D,Y){var Z,X=this;D=Number(D);var K=B.p(Y),q=function(Ut){var Pt=w(X);return B.w(Pt.date(Pt.date()+Math.round(Ut*D)),X)};if(K===v)return this.set(v,this.$M+D);if(K===F)return this.set(F,this.$y+D);if(K===p)return q(1);if(K===g)return q(7);var rt=(Z={},Z[c]=n,Z[f]=o,Z[a]=e,Z)[K]||1,xt=this.$d.getTime()+D*rt;return B.w(xt,this)},L.subtract=function(D,Y){return this.add(-1*D,Y)},L.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=B.z(this),q=this.$H,rt=this.$m,xt=this.$M,Ut=Z.weekdays,Pt=Z.months,Zt=Z.meridiem,Gt=function(_,E,j,$){return _&&(_[E]||_(Y,X))||j[E].slice(0,$)},W=function(_){return B.s(q%12||12,_,"0")},y=Zt||function(_,E,j){var $=_<12?"AM":"PM";return j?$.toLowerCase():$};return X.replace(k,function(_,E){return E||function(j){switch(j){case"YY":return String(Y.$y).slice(-2);case"YYYY":return B.s(Y.$y,4,"0");case"M":return xt+1;case"MM":return B.s(xt+1,2,"0");case"MMM":return Gt(Z.monthsShort,xt,Pt,3);case"MMMM":return Gt(Pt,xt);case"D":return Y.$D;case"DD":return B.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 B.s(q,2,"0");case"h":return W(1);case"hh":return W(2);case"a":return y(q,rt,!0);case"A":return y(q,rt,!1);case"m":return String(rt);case"mm":return B.s(rt,2,"0");case"s":return String(Y.$s);case"ss":return B.s(Y.$s,2,"0");case"SSS":return B.s(Y.$ms,3,"0");case"Z":return K}return null}(_)||K.replace(":","")})},L.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},L.diff=function(D,Y,Z){var X,K=this,q=B.p(Y),rt=w(D),xt=(rt.utcOffset()-this.utcOffset())*n,Ut=this-rt,Pt=function(){return B.m(K,rt)};switch(q){case F:X=Pt()/12;break;case v:X=Pt();break;case C:X=Pt()/3;break;case g:X=(Ut-xt)/6048e5;break;case p:X=(Ut-xt)/864e5;break;case f:X=Ut/o;break;case c:X=Ut/n;break;case a:X=Ut/e;break;default:X=Ut}return Z?X:B.a(X)},L.daysInMonth=function(){return this.endOf(v).$D},L.$locale=function(){return A[this.$L]},L.locale=function(D,Y){if(!D)return this.$L;var Z=this.clone(),X=S(D,Y,!0);return X&&(Z.$L=X),Z},L.clone=function(){return B.w(this.$d,this)},L.toDate=function(){return new Date(this.valueOf())},L.toJSON=function(){return this.isValid()?this.toISOString():null},L.toISOString=function(){return this.$d.toISOString()},L.toString=function(){return this.$d.toUTCString()},z}(),Q=N.prototype;return w.prototype=Q,[["$ms",i],["$s",a],["$m",c],["$H",f],["$W",p],["$M",v],["$y",F],["$D",T]].forEach(function(z){Q[z[1]]=function(L){return this.$g(L,z[0],z[1])}}),w.extend=function(z,L){return z.$i||(z(L,N,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})}(Mn)),Mn.exports}var wd=md();const gr=Ts(wd);var Fn={exports:{}},bd=Fn.exports,zo;function _d(){return zo||(zo=1,function(r,t){(function(e,n){r.exports=n()})(bd,function(){var e,n,o=1e3,i=6e4,a=36e5,c=864e5,f=/\[([^\]]+)]|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,p=31536e6,g=2628e6,v=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,C={years:p,months:g,days:c,hours:a,minutes:i,seconds:o,milliseconds:1,weeks:6048e5},F=function(A){return A instanceof V},T=function(A,O,m){return new V(A,m,O.$l)},U=function(A){return n.p(A)+"s"},M=function(A){return A<0},k=function(A){return M(A)?Math.ceil(A):Math.floor(A)},P=function(A){return Math.abs(A)},R=function(A,O){return A?M(A)?{negative:!0,format:""+P(A)+O}:{negative:!1,format:""+A+O}:{negative:!1,format:""}},V=function(){function A(m,S,w){var B=this;if(this.$d={},this.$l=w,m===void 0&&(this.$ms=0,this.parseFromMilliseconds()),S)return T(m*C[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){B.$d[U(z)]=m[z]}),this.calMilliseconds(),this;if(typeof m=="string"){var N=m.match(v);if(N){var Q=N.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 O=A.prototype;return O.calMilliseconds=function(){var m=this;this.$ms=Object.keys(this.$d).reduce(function(S,w){return S+(m.$d[w]||0)*C[w]},0)},O.parseFromMilliseconds=function(){var m=this.$ms;this.$d.years=k(m/p),m%=p,this.$d.months=k(m/g),m%=g,this.$d.days=k(m/c),m%=c,this.$d.hours=k(m/a),m%=a,this.$d.minutes=k(m/i),m%=i,this.$d.seconds=k(m/o),m%=o,this.$d.milliseconds=m},O.toISOString=function(){var m=R(this.$d.years,"Y"),S=R(this.$d.months,"M"),w=+this.$d.days||0;this.$d.weeks&&(w+=7*this.$d.weeks);var B=R(w,"D"),N=R(this.$d.hours,"H"),Q=R(this.$d.minutes,"M"),z=this.$d.seconds||0;this.$d.milliseconds&&(z+=this.$d.milliseconds/1e3,z=Math.round(1e3*z)/1e3);var L=R(z,"S"),D=m.negative||S.negative||B.negative||N.negative||Q.negative||L.negative,Y=N.format||Q.format||L.format?"T":"",Z=(D?"-":"")+"P"+m.format+S.format+B.format+Y+N.format+Q.format+L.format;return Z==="P"||Z==="-P"?"P0D":Z},O.toJSON=function(){return this.toISOString()},O.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(f,function(B,N){return N||String(w[B])})},O.as=function(m){return this.$ms/C[U(m)]},O.get=function(m){var S=this.$ms,w=U(m);return w==="milliseconds"?S%=1e3:S=w==="weeks"?k(S/C[w]):this.$d[w],S||0},O.add=function(m,S,w){var B;return B=S?m*C[U(S)]:F(m)?m.$ms:T(m,this).$ms,T(this.$ms+B*(w?-1:1),this)},O.subtract=function(m,S){return this.add(m,S,!0)},O.locale=function(m){var S=this.clone();return S.$l=m,S},O.clone=function(){return T(this.$ms,this)},O.humanize=function(m){return e().add(this.$ms,"ms").locale(this.$l).fromNow(!m)},O.valueOf=function(){return this.asMilliseconds()},O.milliseconds=function(){return this.get("milliseconds")},O.asMilliseconds=function(){return this.as("milliseconds")},O.seconds=function(){return this.get("seconds")},O.asSeconds=function(){return this.as("seconds")},O.minutes=function(){return this.get("minutes")},O.asMinutes=function(){return this.as("minutes")},O.hours=function(){return this.get("hours")},O.asHours=function(){return this.as("hours")},O.days=function(){return this.get("days")},O.asDays=function(){return this.as("days")},O.weeks=function(){return this.get("weeks")},O.asWeeks=function(){return this.as("weeks")},O.months=function(){return this.get("months")},O.asMonths=function(){return this.as("months")},O.years=function(){return this.get("years")},O.asYears=function(){return this.as("years")},A}(),G=function(A,O,m){return A.add(O.years()*m,"y").add(O.months()*m,"M").add(O.days()*m,"d").add(O.hours()*m,"h").add(O.minutes()*m,"m").add(O.seconds()*m,"s").add(O.milliseconds()*m,"ms")};return function(A,O,m){e=m,n=m().$utils(),m.duration=function(B,N){var Q=m.locale();return T(B,{$l:Q},N)},m.isDuration=F;var S=O.prototype.add,w=O.prototype.subtract;O.prototype.add=function(B,N){return F(B)?G(this,B,1):S.bind(this)(B,N)},O.prototype.subtract=function(B,N){return F(B)?G(this,B,-1):w.bind(this)(B,N)}}})}(Fn)),Fn.exports}var Sd=_d();const Id=Ts(Sd);gr.extend(Id);const Bd=r=>{if(r instanceof Date)return gr(r).toISOString();if(r instanceof gr)return r.toISOString();if(r instanceof gr.duration)return r.toISOString();try{return gr.duration(r).toISOString()}catch{return gr(r).toISOString()}},vd=r=>{const t=r.times.map(e=>Bd(e));return{type:r.type||"range",times:t,resolution:r.resolution,resample:r.resample}};class Ad{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&&vd(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=yd;exports.DataVar=ui;exports.Dataset=Ge;exports.Query=Ad;exports.wkb_to_geojson=su;
|
|
9
|
+
`))}V.fill(0),o.createHash=function(w){return G(w)},o.createHmac=G,o.randomBytes=function(w,B){if(!B||!B.call)return new T(k(w));try{B.call(this,void 0,new T(k(w)))}catch(N){B(N)}};var O,m=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],S=function(w){o[w]=function(){A("sorry,",w,"is not implemented yet")}};for(O in m)S(m[O])}).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,o){(function(i,a,c,f,p,g,v,C,F){var T=e("./helpers");function U(A,O){A[O>>5]|=128<<O%32,A[14+(O+64>>>9<<4)]=O;for(var m=1732584193,S=-271733879,w=-1732584194,B=271733878,N=0;N<A.length;N+=16){var Q=m,z=S,L=w,D=B,m=k(m,S,w,B,A[N+0],7,-680876936),B=k(B,m,S,w,A[N+1],12,-389564586),w=k(w,B,m,S,A[N+2],17,606105819),S=k(S,w,B,m,A[N+3],22,-1044525330);m=k(m,S,w,B,A[N+4],7,-176418897),B=k(B,m,S,w,A[N+5],12,1200080426),w=k(w,B,m,S,A[N+6],17,-1473231341),S=k(S,w,B,m,A[N+7],22,-45705983),m=k(m,S,w,B,A[N+8],7,1770035416),B=k(B,m,S,w,A[N+9],12,-1958414417),w=k(w,B,m,S,A[N+10],17,-42063),S=k(S,w,B,m,A[N+11],22,-1990404162),m=k(m,S,w,B,A[N+12],7,1804603682),B=k(B,m,S,w,A[N+13],12,-40341101),w=k(w,B,m,S,A[N+14],17,-1502002290),m=P(m,S=k(S,w,B,m,A[N+15],22,1236535329),w,B,A[N+1],5,-165796510),B=P(B,m,S,w,A[N+6],9,-1069501632),w=P(w,B,m,S,A[N+11],14,643717713),S=P(S,w,B,m,A[N+0],20,-373897302),m=P(m,S,w,B,A[N+5],5,-701558691),B=P(B,m,S,w,A[N+10],9,38016083),w=P(w,B,m,S,A[N+15],14,-660478335),S=P(S,w,B,m,A[N+4],20,-405537848),m=P(m,S,w,B,A[N+9],5,568446438),B=P(B,m,S,w,A[N+14],9,-1019803690),w=P(w,B,m,S,A[N+3],14,-187363961),S=P(S,w,B,m,A[N+8],20,1163531501),m=P(m,S,w,B,A[N+13],5,-1444681467),B=P(B,m,S,w,A[N+2],9,-51403784),w=P(w,B,m,S,A[N+7],14,1735328473),m=R(m,S=P(S,w,B,m,A[N+12],20,-1926607734),w,B,A[N+5],4,-378558),B=R(B,m,S,w,A[N+8],11,-2022574463),w=R(w,B,m,S,A[N+11],16,1839030562),S=R(S,w,B,m,A[N+14],23,-35309556),m=R(m,S,w,B,A[N+1],4,-1530992060),B=R(B,m,S,w,A[N+4],11,1272893353),w=R(w,B,m,S,A[N+7],16,-155497632),S=R(S,w,B,m,A[N+10],23,-1094730640),m=R(m,S,w,B,A[N+13],4,681279174),B=R(B,m,S,w,A[N+0],11,-358537222),w=R(w,B,m,S,A[N+3],16,-722521979),S=R(S,w,B,m,A[N+6],23,76029189),m=R(m,S,w,B,A[N+9],4,-640364487),B=R(B,m,S,w,A[N+12],11,-421815835),w=R(w,B,m,S,A[N+15],16,530742520),m=V(m,S=R(S,w,B,m,A[N+2],23,-995338651),w,B,A[N+0],6,-198630844),B=V(B,m,S,w,A[N+7],10,1126891415),w=V(w,B,m,S,A[N+14],15,-1416354905),S=V(S,w,B,m,A[N+5],21,-57434055),m=V(m,S,w,B,A[N+12],6,1700485571),B=V(B,m,S,w,A[N+3],10,-1894986606),w=V(w,B,m,S,A[N+10],15,-1051523),S=V(S,w,B,m,A[N+1],21,-2054922799),m=V(m,S,w,B,A[N+8],6,1873313359),B=V(B,m,S,w,A[N+15],10,-30611744),w=V(w,B,m,S,A[N+6],15,-1560198380),S=V(S,w,B,m,A[N+13],21,1309151649),m=V(m,S,w,B,A[N+4],6,-145523070),B=V(B,m,S,w,A[N+11],10,-1120210379),w=V(w,B,m,S,A[N+2],15,718787259),S=V(S,w,B,m,A[N+9],21,-343485551),m=G(m,Q),S=G(S,z),w=G(w,L),B=G(B,D)}return Array(m,S,w,B)}function M(A,O,m,S,w,B){return G((O=G(G(O,A),G(S,B)))<<w|O>>>32-w,m)}function k(A,O,m,S,w,B,N){return M(O&m|~O&S,A,O,w,B,N)}function P(A,O,m,S,w,B,N){return M(O&S|m&~S,A,O,w,B,N)}function R(A,O,m,S,w,B,N){return M(O^m^S,A,O,w,B,N)}function V(A,O,m,S,w,B,N){return M(m^(O|~S),A,O,w,B,N)}function G(A,O){var m=(65535&A)+(65535&O);return(A>>16)+(O>>16)+(m>>16)<<16|65535&m}n.exports=function(A){return T.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,o){(function(i,a,c,f,p,g,v,C,F){n.exports=function(T){for(var U,M=new Array(T),k=0;k<T;k++)(3&k)==0&&(U=4294967296*Math.random()),M[k]=U>>>((3&k)<<3)&255;return M}}).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,o){(function(i,a,c,f,p,g,v,C,F){var T=e("./helpers");function U(P,R){P[R>>5]|=128<<24-R%32,P[15+(R+64>>9<<4)]=R;for(var V,G,A,O=Array(80),m=1732584193,S=-271733879,w=-1732584194,B=271733878,N=-1009589776,Q=0;Q<P.length;Q+=16){for(var z=m,L=S,D=w,Y=B,Z=N,X=0;X<80;X++){O[X]=X<16?P[Q+X]:k(O[X-3]^O[X-8]^O[X-14]^O[X-16],1);var K=M(M(k(m,5),(K=S,G=w,A=B,(V=X)<20?K&G|~K&A:!(V<40)&&V<60?K&G|K&A|G&A:K^G^A)),M(M(N,O[X]),(V=X)<20?1518500249:V<40?1859775393:V<60?-1894007588:-899497514)),N=B,B=w,w=k(S,30),S=m,m=K}m=M(m,z),S=M(S,L),w=M(w,D),B=M(B,Y),N=M(N,Z)}return Array(m,S,w,B,N)}function M(P,R){var V=(65535&P)+(65535&R);return(P>>16)+(R>>16)+(V>>16)<<16|65535&V}function k(P,R){return P<<R|P>>>32-R}n.exports=function(P){return T.hash(P,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,o){(function(i,a,c,f,p,g,v,C,F){function T(R,V){var G=(65535&R)+(65535&V);return(R>>16)+(V>>16)+(G>>16)<<16|65535&G}function U(R,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),O=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),m=new Array(64);R[V>>5]|=128<<24-V%32,R[15+(V+64>>9<<4)]=V;for(var S,w,B=0;B<R.length;B+=16){for(var N=O[0],Q=O[1],z=O[2],L=O[3],D=O[4],Y=O[5],Z=O[6],X=O[7],K=0;K<64;K++)m[K]=K<16?R[K+B]:T(T(T((w=m[K-2],k(w,17)^k(w,19)^P(w,10)),m[K-7]),(w=m[K-15],k(w,7)^k(w,18)^P(w,3))),m[K-16]),G=T(T(T(T(X,k(w=D,6)^k(w,11)^k(w,25)),D&Y^~D&Z),A[K]),m[K]),S=T(k(S=N,2)^k(S,13)^k(S,22),N&Q^N&z^Q&z),X=Z,Z=Y,Y=D,D=T(L,G),L=z,z=Q,Q=N,N=T(G,S);O[0]=T(N,O[0]),O[1]=T(Q,O[1]),O[2]=T(z,O[2]),O[3]=T(L,O[3]),O[4]=T(D,O[4]),O[5]=T(Y,O[5]),O[6]=T(Z,O[6]),O[7]=T(X,O[7])}return O}var M=e("./helpers"),k=function(R,V){return R>>>V|R<<32-V},P=function(R,V){return R>>>V};n.exports=function(R){return M.hash(R,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,o){(function(i,a,c,f,p,g,v,C,F){o.read=function(T,U,M,k,B){var R,V,G=8*B-k-1,A=(1<<G)-1,O=A>>1,m=-7,S=M?B-1:0,w=M?-1:1,B=T[U+S];for(S+=w,R=B&(1<<-m)-1,B>>=-m,m+=G;0<m;R=256*R+T[U+S],S+=w,m-=8);for(V=R&(1<<-m)-1,R>>=-m,m+=k;0<m;V=256*V+T[U+S],S+=w,m-=8);if(R===0)R=1-O;else{if(R===A)return V?NaN:1/0*(B?-1:1);V+=Math.pow(2,k),R-=O}return(B?-1:1)*V*Math.pow(2,R-k)},o.write=function(T,U,M,k,P,N){var V,G,A=8*N-P-1,O=(1<<A)-1,m=O>>1,S=P===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=k?0:N-1,B=k?1:-1,N=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=O):(V=Math.floor(Math.log(U)/Math.LN2),U*(k=Math.pow(2,-V))<1&&(V--,k*=2),2<=(U+=1<=V+m?S/k:S*Math.pow(2,1-m))*k&&(V++,k/=2),O<=V+m?(G=0,V=O):1<=V+m?(G=(U*k-1)*Math.pow(2,P),V+=m):(G=U*Math.pow(2,m-1)*Math.pow(2,P),V=0));8<=P;T[M+w]=255&G,w+=B,G/=256,P-=8);for(V=V<<P|G,A+=P;0<A;T[M+w]=255&V,w+=B,V/=256,A-=8);T[M+w-B]|=128*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/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754")},{buffer:3,lYpoI2:11}],11:[function(e,n,o){(function(i,a,c,f,p,g,v,C,F){var T,U,M;function k(){}(i=n.exports={}).nextTick=(U=typeof window<"u"&&window.setImmediate,M=typeof window<"u"&&window.postMessage&&window.addEventListener,U?function(P){return window.setImmediate(P)}:M?(T=[],window.addEventListener("message",function(P){var R=P.source;R!==window&&R!==null||P.data!=="process-tick"||(P.stopPropagation(),0<T.length&&T.shift()())},!0),function(P){T.push(P),window.postMessage("process-tick","*")}):function(P){setTimeout(P,0)}),i.title="browser",i.browser=!0,i.env={},i.argv=[],i.on=k,i.addListener=k,i.once=k,i.off=k,i.removeListener=k,i.removeAllListeners=k,i.emit=k,i.binding=function(P){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(P){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)})}(ki)),ki.exports}var Jf=Yf();const Hf=Ts(Jf);function qf(r){return new Promise(t=>setTimeout(t,r))}class Kf{cache;url;params;cache_prefix;fetchOptions;timeout;_pending={};constructor(t,e,n={}){const o={...e};n.parameters&&(o["x-parameters"]=JSON.stringify(n.parameters)),n.chunks&&(o["x-chunks"]=n.chunks),n.downsample&&(o["x-downsample"]=JSON.stringify(n.downsample)),o["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:o},this.url=t;const i=t.split("/").pop();n.nocache||typeof window>"u"?this.cache=void 0:this.cache=iu("zarr","cache"),this.cache_prefix=Hf({datasource:i,...n.parameters,chunks:n.chunks,downsample:n.downsample}),this.timeout=n.timeout||6e4}async get(t,e,n=0){const o=`${this.cache_prefix}${t}`;let i=null;if(this.cache&&(i=await Zf(o,this.cache),i&&delete this._pending[o],this._pending[o]))if(await qf(200),n>this.timeout){await Ni(o,this.cache),delete this._pending[o],console.error("Zarr timeout");return}else return await this.get(t,e,n+200);if(!i){this._pending[o]=!0;try{const a={...this.fetchOptions,...e,headers:{...this.fetchOptions.headers||{},...e?.headers||{}},signal:AbortSignal.timeout(this.timeout)},c=new URLSearchParams(this.params).toString(),f=await fetch(`${this.url}${t}?${c}`,a);if(f.status===404){this.cache&&await Ni(o,this.cache);return}if(f.status>=400)throw new Error(`HTTP error: ${f.status}`);i=new Uint8Array(await f.arrayBuffer()),this.cache&&await Gf(o,i,this.cache)}catch(a){if(console.debug("Zarr retry:"+o),n<this.timeout/200)return delete this._pending[o],await this.get(t,e,n+200);this.cache&&await Ni(o,this.cache),console.error(a);return}finally{delete this._pending[o]}}return i}}const Po=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 Xf(r){const t=await Po(r,".zattrs"),e=await Po(r);e.dtype.startsWith("<M8")&&(t._dtype=e.dtype);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 o={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 Br(r.store,r.path,o)}function bi(r,t,e){const n=e.value;return e.value=async function(...o){const i=Date.now(),a=await n.apply(this,o),f=Date.now()-i;return console.debug(`${t} took ${f}ms`),a},e}var Qf=Object.defineProperty,td=Object.getOwnPropertyDescriptor,ed=(r,t,e,n)=>{for(var o=td(t,e),i=r.length-1,a;i>=0;i--)(a=r[i])&&(o=a(t,e,o)||o);return o&&Qf(t,e,o),o};const su=r=>{const t=new nu.Buffer(r,"base64");return Vf.Geometry.parse(t).toGeoJSON()},ci=r=>r&&(Array.isArray(r)||ArrayBuffer.isView(r)),rd=r=>{const t=[];if(!ci(r))return t;for(;t.push(r.length),ci(r[0]);)r=r[0];return t},nd=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)},id=r=>{let t=r.toString().toLowerCase();return r.typeId==5?t="v2:object":r.typeId==1&&(t="uint8"),t},sd=r=>{if(!Array.isArray(r))return r;const t=r.flat(1/0);if(ci(t[0])){const e=t[0].length,n=new t[0].constructor(t.length*e);for(let o=0;o<t.length;o++)n.set(t[o],o*e);return n}else return t},od=r=>{const t=r.length,e=Array(t);for(let n=t-1,o=1;n>=0;n--)e[n]=o,o*=r[n];return e},Fs=(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 o=new Array(t[0]);for(let i=0;i<t[0];i++)o[i]=Fs(r,t.slice(1),e.slice(1),n+i*e[0]);return o},ad=(r,t)=>{const[e,n]=t.split("<M8"),o=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];o[a]=Number(c/i)}return Fs(o,r.shape,r.stride)},ou=(r,t,e)=>{const n=Object.keys(t),o={};for(const i in r)ci(r[i].data)&&(o[i]=!0);if(n.length==1)for(let i=0;i<t[n[0]];i++){const a={};for(const c in r)o[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 f in r)r[f].dimensions.includes(n[0])?a[f]={attributes:r[f].attributes,data:r[f].data[i],dimensions:r[f].dimensions.slice(1)}:a[f]=r[f];const c={...t};delete c[n[0]],ou(a,c,e)}return e};class ui{id;dimensions;attributes;arr;constructor(t,e,n,o){this.id=t,this.dimensions=e,this.attributes=n,this.arr=o}async get(t){if(this.arr.shape.length==0||this.arr.shape[0]==0)return[];const e=t&&t.map(o=>{if(typeof o=="string"){const[i,a,c]=o.split(":");return Ui(parseInt(i),parseInt(a),parseInt(c))}else return o}),n=await ih(this.arr,e);if(this.arr.dtype=="v2:object"||!n.shape)return n.data;if(this.arr.dtype=="bool")return[...n.data];{const o=this.arr.attrs._dtype;return o?.startsWith("<M8")?ad(n,o):Fs(n.data,n.shape,n.stride)}}}ed([bi],ui.prototype,"get");class Ge{dimensions;variables;attributes;coordkeys;root;constructor(t,e,n,o,i){this.dimensions=t,this.variables=e,this.attributes=n,this.coordkeys=o,this.root=i}static async zarr(t,e,n={}){const o=new Kf(t,e,{chunks:n.chunks,downsample:n.downsample,parameters:n.parameters,timeout:n.timeout,nocache:n.nocache}),i=await $u(o),a=await Ze(i,{kind:"group"}),c={},f={};for(const g of i.contents())if(g.kind=="array"){let v;try{v=await Ze(a.resolve(g.path),{kind:"array"})}catch(T){const U=typeof T=="object"&&T&&"message"in T?String(T.message):void 0;if(U&&U.includes("<M8"))v=await Xf(a.resolve(g.path));else throw T}const C=v.attrs._ARRAY_DIMENSIONS,F=g.path.split("/").pop();c[F]=new ui(F,C||[],v.attrs,v),C&&C.map((T,U)=>{const M=v.shape[U];if(f[T]&&f[T]!=M)throw new Error(`Inconsistent dimension size for ${T}: ${f[T]} != ${M}`);f[T]=M})}const p=JSON.parse(a.attrs._coordinates)||{};return new Ge(f,c,a.attrs,n.coordkeys||p,a)}static async fromArrow(t,e){const n={},o={record:t.numRows},i={};return t.schema.fields.forEach(a=>{const c=t.getChild(a.name);let f={},p=c?.toArray(),g=id(a.type);if(tt.isTimestamp(a.type)){const v=new Float64Array(p.length),C=BigInt(1e3**(a.type.unit-0));for(let F=0;F<p.length;F++)v[F]=Number(p[F]/C);p=v,g="float64",f={unit:"Unix timestamp (s)"}}else if(tt.isBinary(a.type)){const v=[];for(let C=0;C<p.length;C++)v.push(new nu.Buffer(p[C]).toString("base64"));p=v,g="v2:object"}i[a.name]={dimensions:["record"],attributes:f,data:p,dtype:g}}),await Ge.init({dimensions:o,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 o=new Set;n.forEach(f=>{f.properties&&Object.keys(f.properties).forEach(p=>o.add(p))});const i=n.map(f=>{const p={geometry:f.geometry};return f.properties&&Object.assign(p,f.properties),p}),a={dimensions:{index:i.length},variables:{},attributes:{}},c=await Ge.init(a,{...e,g:"geometry"});await c.assign("geometry",["index"],i.map(f=>f.geometry),{description:"GeoJSON geometry"});for(const f of o){const p=i.map(g=>g[f]);await c.assign(f,["index"],p,{description:`Property: ${f}`})}return c}static async init(t,e){const n=await js(new Map,{attributes:{created:new Date}}),o=new Ge(t.dimensions,{},t.attributes||{},e||{},n);for(const i in t.variables){const{dimensions:a,attributes:c,data:f,dtype:p}=t.variables[i];await o.assign(i,a,f,c,p&&p==="string"?"v2:object":p)}return o}async asDataframe(){const t={},e=[];for(const o in this.variables)t[o]={attributes:this.variables[o].attributes,dimensions:this.variables[o].dimensions},t[o].data=await this.variables[o].get(),this.variables[o].arr.dtype=="int64"&&e.push(o);const n=ou(t,{...this.dimensions},[]);if(this.coordkeys.t)for(let o=0;o<n.length;o++)n[o][this.coordkeys.t]=new Date(1e3*n[o][this.coordkeys.t]).toISOString();if(e.length>0)for(const o of e)for(let i=0;i<n.length;i++)n[i][o]=Number(n[i][o]);return n}async asGeojson(t){if(!this.coordkeys.g&&!t)throw new Error("No geometry found");const e=[],n=await this.asDataframe();for(let o=0;o<n.length;o++){const{...i}=n[o];let a=t;if(!a&&this.coordkeys.g){delete i[this.coordkeys.g];const c=n[o][this.coordkeys.g];c.slice(0,7)=='{"type:'?a=JSON.parse(c):a=su(c)}e.push({type:"Feature",geometry:a,properties:i})}return{type:"FeatureCollection",features:e}}async assign(t,e,n,o,i,a){const c=rd(n);if(c.length!=e.length)throw new Error("Data shape does not match dimensions");e.map((v,C)=>{if(this.dimensions[v]){if(this.dimensions[v]!=c[C])throw new Error(`Existing size of dimension ${v} does not match new data`)}else this.dimensions[v]=c[C]});const f=i||nd(n),p=await js(this.root.resolve(t),{shape:c,data_type:f,chunk_shape:a||c,codecs:f=="v2:object"?[{name:"json2"}]:[]});let g=sd(n);g.length==0?g=null:f=="bool"?g=new qi(g):Array.isArray(g)&&f=="float32"?g=Float32Array.from(g,v=>v??NaN):Array.isArray(g)&&f=="float64"?g=Float64Array.from(g,v=>v??NaN):Array.isArray(g)&&f=="int8"?g=Int8Array.from(g):Array.isArray(g)&&f=="int16"?g=Int16Array.from(g):Array.isArray(g)&&f=="int32"?g=Int32Array.from(g):Array.isArray(g)&&f=="int64"?g=BigInt64Array.from(g.map(v=>BigInt(v))):Array.isArray(g)&&f=="uint8"?g=Uint8Array.from(g):Array.isArray(g)&&f=="uint16"?g=Uint16Array.from(g):Array.isArray(g)&&f=="uint32"?g=Uint32Array.from(g):Array.isArray(g)&&f=="uint64"&&(g=BigUint64Array.from(g.map(v=>BigInt(v)))),g&&await sh(p,c.map(()=>null),{data:g,shape:c,stride:od(c)}),this.variables[t]=new ui(t,e,o||{},p)}}var cd=Object.defineProperty,ud=Object.getOwnPropertyDescriptor,hd=(r,t,e,n)=>{for(var o=ud(t,e),i=r.length-1,a;i>=0;i--)(a=r[i])&&(o=a(t,e,o)||o);return o&&cd(t,e,o),o};const au=class Hi{id;user;creationTime;endTime;write;verified=!1;_connection;static async acquire(t,e={}){if(!t._isV1){const n=new Hi;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 o=new URLSearchParams({duration:String(e.duration??3600)}),i=await fetch(`${t._gateway}/session/?${o.toString()}`,{headers:n});if(i.status!==200)throw new Error(`Failed to create session: ${await i.text()}`);const a=await i.json(),c=new Hi;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)}};hd([bi],au,"acquire");let ld=au;var fd=Object.defineProperty,dd=Object.getOwnPropertyDescriptor,cu=(r,t,e,n)=>{for(var o=dd(t,e),i=r.length-1,a;i>=0;i--)(a=r[i])&&(o=a(t,e,o)||o);return o&&fd(t,e,o),o};const pd=typeof process<"u"&&process.env?.DATAMESH_SERVICE?process.env.DATAMESH_SERVICE:"https://datamesh.oceanum.io",Ns=class uu{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||pd);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 ld.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 o=await this.getSessionHeaders(),i=await fetch(n.toString(),{headers:o});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}),o=await fetch(`${this._gateway}/oceanql/${t}?f=arrow`,{headers:n});return await this.validateResponse(o),Xc(await o.arrayBuffer())}async stageRequest(t){const e=JSON.stringify(t),n=await this.getSessionHeaders({"Content-Type":"application/json"}),o=await fetch(`${this._gateway}/oceanql/stage/`,{method:"POST",headers:n,body:e});if(o.status>=400){const i=await o.json();throw new Error(i.detail)}else return o.status===204?null:o.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<uu.LAZY_LOAD_SIZE&&n.container!="dataset"){const f=await this.dataRequest(n.qhash);return await Ge.fromArrow(f,n.coordkeys)}const o=`${this._gateway}/zarr/${this._isV1?"query/":""}${n.qhash}`,i=t.parameters,a=await this.getSessionHeaders(),c=await Ge.zarr(o,a,{parameters:i,timeout:e.timeout||6e4,nocache:this._nocache});if(t.variables)for(const f of Object.keys(c.variables))!t.variables.includes(f)&&!Object.values(c.coordkeys).includes(f)&&delete c.variables[f];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)}};cu([bi],Ns.prototype,"stageRequest");cu([bi],Ns.prototype,"query");let yd=Ns;var Mn={exports:{}},gd=Mn.exports,$o;function md(){return $o||($o=1,function(r,t){(function(e,n){r.exports=n()})(gd,function(){var e=1e3,n=6e4,o=36e5,i="millisecond",a="second",c="minute",f="hour",p="day",g="week",v="month",C="quarter",F="year",T="date",U="Invalid Date",M=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,k=/\[([^\]]+)]|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,P={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 L=["th","st","nd","rd"],D=z%100;return"["+z+(L[(D-20)%10]||L[D]||L[0])+"]"}},R=function(z,L,D){var Y=String(z);return!Y||Y.length>=L?z:""+Array(L+1-Y.length).join(D)+z},V={s:R,z:function(z){var L=-z.utcOffset(),D=Math.abs(L),Y=Math.floor(D/60),Z=D%60;return(L<=0?"+":"-")+R(Y,2,"0")+":"+R(Z,2,"0")},m:function z(L,D){if(L.date()<D.date())return-z(D,L);var Y=12*(D.year()-L.year())+(D.month()-L.month()),Z=L.clone().add(Y,v),X=D-Z<0,K=L.clone().add(Y+(X?-1:1),v);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:v,y:F,w:g,d:p,D:T,h:f,m:c,s:a,ms:i,Q:C}[z]||String(z||"").toLowerCase().replace(/s$/,"")},u:function(z){return z===void 0}},G="en",A={};A[G]=P;var O="$isDayjsObject",m=function(z){return z instanceof N||!(!z||!z[O])},S=function z(L,D,Y){var Z;if(!L)return G;if(typeof L=="string"){var X=L.toLowerCase();A[X]&&(Z=X),D&&(A[X]=D,Z=X);var K=L.split("-");if(!Z&&K.length>1)return z(K[0])}else{var q=L.name;A[q]=L,Z=q}return!Y&&Z&&(G=Z),Z||!Y&&G},w=function(z,L){if(m(z))return z.clone();var D=typeof L=="object"?L:{};return D.date=z,D.args=arguments,new N(D)},B=V;B.l=S,B.i=m,B.w=function(z,L){return w(z,{locale:L.$L,utc:L.$u,x:L.$x,$offset:L.$offset})};var N=function(){function z(D){this.$L=S(D.locale,null,!0),this.parse(D),this.$x=this.$x||D.x||{},this[O]=!0}var L=z.prototype;return L.parse=function(D){this.$d=function(Y){var Z=Y.date,X=Y.utc;if(Z===null)return new Date(NaN);if(B.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(M);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()},L.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()},L.$utils=function(){return B},L.isValid=function(){return this.$d.toString()!==U},L.isSame=function(D,Y){var Z=w(D);return this.startOf(Y)<=Z&&Z<=this.endOf(Y)},L.isAfter=function(D,Y){return w(D)<this.startOf(Y)},L.isBefore=function(D,Y){return this.endOf(Y)<w(D)},L.$g=function(D,Y,Z){return B.u(D)?this[Y]:this.set(Z,D)},L.unix=function(){return Math.floor(this.valueOf()/1e3)},L.valueOf=function(){return this.$d.getTime()},L.startOf=function(D,Y){var Z=this,X=!!B.u(Y)||Y,K=B.p(D),q=function(y,_){var E=B.w(Z.$u?Date.UTC(Z.$y,_,y):new Date(Z.$y,_,y),Z);return X?E:E.endOf(p)},rt=function(y,_){return B.w(Z.toDate()[y].apply(Z.toDate("s"),(X?[0,0,0,0]:[23,59,59,999]).slice(_)),Z)},xt=this.$W,Ut=this.$M,Pt=this.$D,Zt="set"+(this.$u?"UTC":"");switch(K){case F:return X?q(1,0):q(31,11);case v:return X?q(1,Ut):q(0,Ut+1);case g:var Gt=this.$locale().weekStart||0,W=(xt<Gt?xt+7:xt)-Gt;return q(X?Pt-W:Pt+(6-W),Ut);case p:case T:return rt(Zt+"Hours",0);case f:return rt(Zt+"Minutes",1);case c:return rt(Zt+"Seconds",2);case a:return rt(Zt+"Milliseconds",3);default:return this.clone()}},L.endOf=function(D){return this.startOf(D,!1)},L.$set=function(D,Y){var Z,X=B.p(D),K="set"+(this.$u?"UTC":""),q=(Z={},Z[p]=K+"Date",Z[T]=K+"Date",Z[v]=K+"Month",Z[F]=K+"FullYear",Z[f]=K+"Hours",Z[c]=K+"Minutes",Z[a]=K+"Seconds",Z[i]=K+"Milliseconds",Z)[X],rt=X===p?this.$D+(Y-this.$W):Y;if(X===v||X===F){var xt=this.clone().set(T,1);xt.$d[q](rt),xt.init(),this.$d=xt.set(T,Math.min(this.$D,xt.daysInMonth())).$d}else q&&this.$d[q](rt);return this.init(),this},L.set=function(D,Y){return this.clone().$set(D,Y)},L.get=function(D){return this[B.p(D)]()},L.add=function(D,Y){var Z,X=this;D=Number(D);var K=B.p(Y),q=function(Ut){var Pt=w(X);return B.w(Pt.date(Pt.date()+Math.round(Ut*D)),X)};if(K===v)return this.set(v,this.$M+D);if(K===F)return this.set(F,this.$y+D);if(K===p)return q(1);if(K===g)return q(7);var rt=(Z={},Z[c]=n,Z[f]=o,Z[a]=e,Z)[K]||1,xt=this.$d.getTime()+D*rt;return B.w(xt,this)},L.subtract=function(D,Y){return this.add(-1*D,Y)},L.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=B.z(this),q=this.$H,rt=this.$m,xt=this.$M,Ut=Z.weekdays,Pt=Z.months,Zt=Z.meridiem,Gt=function(_,E,j,$){return _&&(_[E]||_(Y,X))||j[E].slice(0,$)},W=function(_){return B.s(q%12||12,_,"0")},y=Zt||function(_,E,j){var $=_<12?"AM":"PM";return j?$.toLowerCase():$};return X.replace(k,function(_,E){return E||function(j){switch(j){case"YY":return String(Y.$y).slice(-2);case"YYYY":return B.s(Y.$y,4,"0");case"M":return xt+1;case"MM":return B.s(xt+1,2,"0");case"MMM":return Gt(Z.monthsShort,xt,Pt,3);case"MMMM":return Gt(Pt,xt);case"D":return Y.$D;case"DD":return B.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 B.s(q,2,"0");case"h":return W(1);case"hh":return W(2);case"a":return y(q,rt,!0);case"A":return y(q,rt,!1);case"m":return String(rt);case"mm":return B.s(rt,2,"0");case"s":return String(Y.$s);case"ss":return B.s(Y.$s,2,"0");case"SSS":return B.s(Y.$ms,3,"0");case"Z":return K}return null}(_)||K.replace(":","")})},L.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},L.diff=function(D,Y,Z){var X,K=this,q=B.p(Y),rt=w(D),xt=(rt.utcOffset()-this.utcOffset())*n,Ut=this-rt,Pt=function(){return B.m(K,rt)};switch(q){case F:X=Pt()/12;break;case v:X=Pt();break;case C:X=Pt()/3;break;case g:X=(Ut-xt)/6048e5;break;case p:X=(Ut-xt)/864e5;break;case f:X=Ut/o;break;case c:X=Ut/n;break;case a:X=Ut/e;break;default:X=Ut}return Z?X:B.a(X)},L.daysInMonth=function(){return this.endOf(v).$D},L.$locale=function(){return A[this.$L]},L.locale=function(D,Y){if(!D)return this.$L;var Z=this.clone(),X=S(D,Y,!0);return X&&(Z.$L=X),Z},L.clone=function(){return B.w(this.$d,this)},L.toDate=function(){return new Date(this.valueOf())},L.toJSON=function(){return this.isValid()?this.toISOString():null},L.toISOString=function(){return this.$d.toISOString()},L.toString=function(){return this.$d.toUTCString()},z}(),Q=N.prototype;return w.prototype=Q,[["$ms",i],["$s",a],["$m",c],["$H",f],["$W",p],["$M",v],["$y",F],["$D",T]].forEach(function(z){Q[z[1]]=function(L){return this.$g(L,z[0],z[1])}}),w.extend=function(z,L){return z.$i||(z(L,N,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})}(Mn)),Mn.exports}var wd=md();const gr=Ts(wd);var Fn={exports:{}},bd=Fn.exports,zo;function _d(){return zo||(zo=1,function(r,t){(function(e,n){r.exports=n()})(bd,function(){var e,n,o=1e3,i=6e4,a=36e5,c=864e5,f=/\[([^\]]+)]|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,p=31536e6,g=2628e6,v=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,C={years:p,months:g,days:c,hours:a,minutes:i,seconds:o,milliseconds:1,weeks:6048e5},F=function(A){return A instanceof V},T=function(A,O,m){return new V(A,m,O.$l)},U=function(A){return n.p(A)+"s"},M=function(A){return A<0},k=function(A){return M(A)?Math.ceil(A):Math.floor(A)},P=function(A){return Math.abs(A)},R=function(A,O){return A?M(A)?{negative:!0,format:""+P(A)+O}:{negative:!1,format:""+A+O}:{negative:!1,format:""}},V=function(){function A(m,S,w){var B=this;if(this.$d={},this.$l=w,m===void 0&&(this.$ms=0,this.parseFromMilliseconds()),S)return T(m*C[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){B.$d[U(z)]=m[z]}),this.calMilliseconds(),this;if(typeof m=="string"){var N=m.match(v);if(N){var Q=N.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 O=A.prototype;return O.calMilliseconds=function(){var m=this;this.$ms=Object.keys(this.$d).reduce(function(S,w){return S+(m.$d[w]||0)*C[w]},0)},O.parseFromMilliseconds=function(){var m=this.$ms;this.$d.years=k(m/p),m%=p,this.$d.months=k(m/g),m%=g,this.$d.days=k(m/c),m%=c,this.$d.hours=k(m/a),m%=a,this.$d.minutes=k(m/i),m%=i,this.$d.seconds=k(m/o),m%=o,this.$d.milliseconds=m},O.toISOString=function(){var m=R(this.$d.years,"Y"),S=R(this.$d.months,"M"),w=+this.$d.days||0;this.$d.weeks&&(w+=7*this.$d.weeks);var B=R(w,"D"),N=R(this.$d.hours,"H"),Q=R(this.$d.minutes,"M"),z=this.$d.seconds||0;this.$d.milliseconds&&(z+=this.$d.milliseconds/1e3,z=Math.round(1e3*z)/1e3);var L=R(z,"S"),D=m.negative||S.negative||B.negative||N.negative||Q.negative||L.negative,Y=N.format||Q.format||L.format?"T":"",Z=(D?"-":"")+"P"+m.format+S.format+B.format+Y+N.format+Q.format+L.format;return Z==="P"||Z==="-P"?"P0D":Z},O.toJSON=function(){return this.toISOString()},O.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(f,function(B,N){return N||String(w[B])})},O.as=function(m){return this.$ms/C[U(m)]},O.get=function(m){var S=this.$ms,w=U(m);return w==="milliseconds"?S%=1e3:S=w==="weeks"?k(S/C[w]):this.$d[w],S||0},O.add=function(m,S,w){var B;return B=S?m*C[U(S)]:F(m)?m.$ms:T(m,this).$ms,T(this.$ms+B*(w?-1:1),this)},O.subtract=function(m,S){return this.add(m,S,!0)},O.locale=function(m){var S=this.clone();return S.$l=m,S},O.clone=function(){return T(this.$ms,this)},O.humanize=function(m){return e().add(this.$ms,"ms").locale(this.$l).fromNow(!m)},O.valueOf=function(){return this.asMilliseconds()},O.milliseconds=function(){return this.get("milliseconds")},O.asMilliseconds=function(){return this.as("milliseconds")},O.seconds=function(){return this.get("seconds")},O.asSeconds=function(){return this.as("seconds")},O.minutes=function(){return this.get("minutes")},O.asMinutes=function(){return this.as("minutes")},O.hours=function(){return this.get("hours")},O.asHours=function(){return this.as("hours")},O.days=function(){return this.get("days")},O.asDays=function(){return this.as("days")},O.weeks=function(){return this.get("weeks")},O.asWeeks=function(){return this.as("weeks")},O.months=function(){return this.get("months")},O.asMonths=function(){return this.as("months")},O.years=function(){return this.get("years")},O.asYears=function(){return this.as("years")},A}(),G=function(A,O,m){return A.add(O.years()*m,"y").add(O.months()*m,"M").add(O.days()*m,"d").add(O.hours()*m,"h").add(O.minutes()*m,"m").add(O.seconds()*m,"s").add(O.milliseconds()*m,"ms")};return function(A,O,m){e=m,n=m().$utils(),m.duration=function(B,N){var Q=m.locale();return T(B,{$l:Q},N)},m.isDuration=F;var S=O.prototype.add,w=O.prototype.subtract;O.prototype.add=function(B,N){return F(B)?G(this,B,1):S.bind(this)(B,N)},O.prototype.subtract=function(B,N){return F(B)?G(this,B,-1):w.bind(this)(B,N)}}})}(Fn)),Fn.exports}var Sd=_d();const Id=Ts(Sd);gr.extend(Id);const Bd=r=>{if(r instanceof Date)return gr(r).toISOString();if(r instanceof gr)return r.toISOString();if(r instanceof gr.duration)return r.toISOString();try{return gr.duration(r).toISOString()}catch{return gr(r).toISOString()}},vd=r=>{const t=r.times.map(e=>Bd(e));return{type:r.type||"range",times:t,resolution:r.resolution,resample:r.resample}};class Ad{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&&vd(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=yd;exports.DataVar=ui;exports.Dataset=Ge;exports.Query=Ad;exports.wkb_to_geojson=su;
|