@loaders.gl/tiles-3d 5.0.0-beta.4 → 5.0.0-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/3d-tiles/3d-tiles-archive-loader.js +1 -1
- package/dist/3d-tiles/dist.dev.js +941 -621
- package/dist/3d-tiles/dist.min.js +37 -37
- package/dist/3d-tiles/index.cjs +876 -947
- package/dist/3d-tiles/index.cjs.map +3 -3
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js +5 -1
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -1
- package/dist/3d-tiles/lib/utils/version.js +1 -1
- package/dist/3d-tiles-archive-writer.cjs +1 -1
- package/dist/cesium-ion-loader-with-parser.cjs +821 -942
- package/dist/cesium-ion-loader-with-parser.cjs.map +3 -3
- package/dist/copc/copc-source-loader.js +2 -2
- package/dist/copc/copc-source-loader.js.map +1 -1
- package/dist/copc/copc-writer.js +1 -1
- package/dist/copc/index.cjs +121 -181
- package/dist/copc/index.cjs.map +3 -3
- package/dist/dist.dev.js +323 -40
- package/dist/dist.min.js +10 -10
- package/dist/i3s/arcgis-webscene-loader.js +1 -1
- package/dist/i3s/dist.dev.js +3173 -712
- package/dist/i3s/dist.min.js +47 -47
- package/dist/i3s/i3s-attribute-loader.js +1 -1
- package/dist/i3s/i3s-building-scene-layer-loader.js +1 -1
- package/dist/i3s/i3s-content-loader.js +1 -1
- package/dist/i3s/i3s-lepcc-loader-types.js +1 -1
- package/dist/i3s/i3s-loader.js +1 -1
- package/dist/i3s/i3s-node-page-loader.js +1 -1
- package/dist/i3s/i3s-slpk-loader.js +1 -1
- package/dist/i3s/i3s-slpk-writer.js +1 -1
- package/dist/i3s/index.cjs +2097 -544
- package/dist/i3s/index.cjs.map +3 -3
- package/dist/i3s-content-worker-node.js +11 -11
- package/dist/i3s-content-worker-node.js.map +4 -4
- package/dist/i3s-content-worker.js +768 -346
- package/dist/i3s-lepcc-worker-node.js +245 -12
- package/dist/i3s-lepcc-worker-node.js.map +4 -4
- package/dist/i3s-lepcc-worker.js +240 -12
- package/dist/i3s-mesh-writer.cjs +1749 -290
- package/dist/i3s-mesh-writer.cjs.map +3 -3
- package/dist/i3s-slpk-writer.cjs +1 -1
- package/dist/index.cjs +98 -4
- package/dist/index.cjs.map +2 -2
- package/dist/point-cloud-tile-source-loader-types.js +1 -1
- package/dist/point-cloud-tile-source-loader.cjs +46 -2
- package/dist/point-cloud-tile-source-loader.cjs.map +2 -2
- package/dist/point-cloud-tile-source.cjs +45 -1
- package/dist/point-cloud-tile-source.cjs.map +1 -1
- package/dist/potree/dist.dev.js +325 -91
- package/dist/potree/dist.min.js +30 -30
- package/dist/potree/index.cjs +115 -176
- package/dist/potree/index.cjs.map +3 -3
- package/dist/potree/potree-bin-loader.js +1 -1
- package/dist/potree/potree-hierarchy-chunk-loader.js +1 -1
- package/dist/potree/potree-loader-types.js +1 -1
- package/dist/potree/potree-source-loader.js +1 -1
- package/dist/potree/potree-writer.js +1 -1
- package/dist/potree/potree2-source.d.ts.map +1 -1
- package/dist/potree/potree2-source.js +3 -13
- package/dist/potree/potree2-source.js.map +1 -1
- package/dist/potree-loader.cjs +1 -1
- package/package.json +13 -13
- package/src/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.ts +4 -1
- package/src/copc/copc-source-loader.ts +1 -1
- package/src/potree/potree2-source.ts +3 -14
package/dist/dist.min.js
CHANGED
|
@@ -4,27 +4,27 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['loaders'] = factory();
|
|
6
6
|
else root['loaders'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var dP=Object.create;var hf=Object.defineProperty;var mP=Object.getOwnPropertyDescriptor;var pP=Object.getOwnPropertyNames;var gP=Object.getPrototypeOf,yP=Object.prototype.hasOwnProperty;var w=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var wP=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Zr=(e,t)=>{for(var r in t)hf(e,r,{get:t[r],enumerable:!0})},lf=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of pP(t))!yP.call(e,i)&&i!==r&&hf(e,i,{get:()=>t[i],enumerable:!(n=mP(t,i))||n.enumerable});return e},uf=(e,t,r)=>(lf(e,t,"default"),r&&lf(r,t,"default")),_P=(e,t,r)=>(r=e!=null?dP(gP(e)):{},lf(t||!e||!e.__esModule?hf(r,"default",{value:e,enumerable:!0}):r,e)),MP=e=>lf(hf({},"__esModule",{value:!0}),e);var AM=wP((VD,IM)=>{IM.exports=globalThis.loaders});var we={};Zr(we,{EPSILON1:()=>bP,EPSILON10:()=>RP,EPSILON11:()=>CP,EPSILON12:()=>NP,EPSILON13:()=>OP,EPSILON14:()=>ff,EPSILON15:()=>BP,EPSILON16:()=>LP,EPSILON17:()=>DP,EPSILON18:()=>FP,EPSILON19:()=>UP,EPSILON2:()=>xP,EPSILON20:()=>GP,EPSILON3:()=>SP,EPSILON4:()=>vP,EPSILON5:()=>EP,EPSILON6:()=>TP,EPSILON7:()=>IP,EPSILON8:()=>AP,EPSILON9:()=>PP,PI:()=>Sc,PI_OVER_FOUR:()=>VP,PI_OVER_SIX:()=>kP,PI_OVER_TWO:()=>zP,TWO_PI:()=>eh});var bP,xP,SP,vP,EP,TP,IP,AP,PP,RP,CP,NP,OP,ff,BP,LP,DP,FP,UP,GP,zP,VP,kP,Sc,eh,S0=w(()=>{bP=.1,xP=.01,SP=.001,vP=1e-4,EP=1e-5,TP=1e-6,IP=1e-7,AP=1e-8,PP=1e-9,RP=1e-10,CP=1e-11,NP=1e-12,OP=1e-13,ff=1e-14,BP=1e-15,LP=1e-16,DP=1e-17,FP=1e-18,UP=1e-19,GP=1e-20,zP=Math.PI/2,VP=Math.PI/4,kP=Math.PI/6,Sc=Math.PI,eh=Math.PI*2});function v0(e,{precision:t=ie.precision}={}){return e=$P(e),`${parseFloat(e.toPrecision(t))}`}function zn(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function E0(e){return df(e)}function T0(e){return Br(e)}function df(e,t){return A0(e,r=>r*jP,t)}function Br(e,t){return A0(e,r=>r*qP,t)}function PM(e,t){return Math.sign(e)===Math.sign(t)&&Math.abs(e)<Math.abs(t)?e:(e%t+t)%t}function I0(e,t){switch(t){case"negative-pi-to-pi":return HP(e);case"zero-to-two-pi":return RM(e);default:return e}}function RM(e){if(e>=0&&e<=eh)return e;let t=PM(e,eh);return Math.abs(t)<1e-14&&Math.abs(e)>1e-14?eh:t}function HP(e){return e>=-Sc&&e<=Sc?e:RM(e+Sc)-Sc}function rh(e,t,r){return A0(e,n=>Math.max(t,Math.min(r,n)))}function Go(e,t,r){let n=ie.EPSILON;r&&(ie.EPSILON=r);try{if(e===t)return!0;if(zn(e)&&zn(t)){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(!Go(e[i],t[i]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=ie.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{ie.EPSILON=n}}function $P(e){return Math.round(e/ie.EPSILON)*ie.EPSILON}function YP(e){return e.clone?e.clone():new Array(e.length)}function A0(e,t,r){if(zn(e)){let n=e;r=r||YP(n);for(let i=0;i<r.length&&i<n.length;++i){let o=typeof e=="number"?e:e[i];r[i]=t(o,i,r)}return r}return t(e)}var qP,jP,WP,ie,ha=w(()=>{S0();qP=1/Math.PI*180,jP=1/180*Math.PI,WP={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...WP}};ie=globalThis.mathgl.config});var zo,mf=w(()=>{ha();zo=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=t[n+r];return this.check()}toArray(t=[],r=0){for(let n=0;n<this.ELEMENTS;++n)t[r+n]=this[n];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:zn(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toString(){return this.formatString(ie)}formatString(t){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+v0(this[n],t);return`${t.printTypes?this.constructor.name:""}[${r}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!Go(this[r],t[r]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==t[r])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,r,n){if(n===void 0)return this.lerp(this,t,r);for(let i=0;i<this.ELEMENTS;++i){let o=t[i],s=typeof r=="number"?r:r[i];this[i]=o+n*(s-o)}return this.check()}min(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(t[r],this[r]);return this.check()}max(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(t[r],this[r]);return this.check()}clamp(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t[n]),r[n]);return this.check()}add(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(t){if(typeof t=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;else for(let r=0;r<this.ELEMENTS&&r<t.length;++r)this[r]*=t[r];return this.check()}multiplyByScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}check(){if(ie.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)t=t&&Number.isFinite(this[r]);return t}}});function KP(e,t){if(e.length!==t)return!1;for(let r=0;r<e.length;++r)if(!Number.isFinite(e[r]))return!1;return!0}function he(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function vc(e,t,r=""){if(ie.debug&&!KP(e,t))throw new Error(`math.gl: ${r} some fields set to invalid numbers'`);return e}var Vo=w(()=>{ha()});var Ec,P0=w(()=>{mf();Vo();ha();Ec=class extends zo{toString(){let t="[";if(ie.printRowMajor){t+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)t+=` ${this[n*this.RANK+r]}`}else{t+="column-major:";for(let r=0;r<this.ELEMENTS;++r)t+=` ${this[r]}`}return t+="]",t}getElementIndex(t,r){return r*this.RANK+t}getElement(t,r){return this[r*this.RANK+t]}setElement(t,r,n){return this[r*this.RANK+t]=he(n),this}getColumn(t,r=new Array(this.RANK).fill(-0)){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)r[i]=this[n+i];return r}setColumn(t,r){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)this[n+i]=r[i];return this}}});function pr(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var R0=w(()=>{});var Tc,C0=w(()=>{mf();Vo();R0();Tc=class extends zo{get x(){return this[0]}set x(t){this[0]=he(t)}get y(){return this[1]}set y(t){this[1]=he(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*this[r];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let r=0;for(let n=0;n<this.ELEMENTS;++n){let i=this[n]-t[n];r+=i*i}return he(r)}dot(t){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*t[n];return he(r)}normalize(){let t=this.magnitude();if(t!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=t;return this.check()}multiply(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]*=r[n];return this.check()}divide(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]/=r[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return pr(t>=0&&t<this.ELEMENTS,"index is out of range"),he(this[t])}setComponent(t,r){return pr(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=r,this.check()}addVectors(t,r){return this.copy(t).add(r)}subVectors(t,r){return this.copy(t).subtract(r)}multiplyVectors(t,r){return this.copy(t).multiply(r)}addScaledVector(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t[n]*r;return this.check()}}});var pf,nF,CM=w(()=>{pf=typeof Float32Array<"u"?Float32Array:Array,nF=Math.PI/180});function NM(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e}function OM(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i+r[4],e[1]=r[1]*n+r[3]*i+r[5],e}function gf(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[3]*i+r[6],e[1]=r[1]*n+r[4]*i+r[7],e}function yf(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[4]*i+r[12],e[1]=r[1]*n+r[5]*i+r[13],e}var nh=w(()=>{});function wf(e,t,r){let n=t[0],i=t[1],o=r[3]*n+r[7]*i||1;return e[0]=(r[0]*n+r[4]*i)/o,e[1]=(r[1]*n+r[5]*i)/o,e}function _f(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[3]*n+r[7]*i+r[11]*o||1;return e[0]=(r[0]*n+r[4]*i+r[8]*o)/s,e[1]=(r[1]*n+r[5]*i+r[9]*o)/s,e[2]=(r[2]*n+r[6]*i+r[10]*o)/s,e}function BM(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2],e}function LM(e,t,r){let n=t[0],i=t[1],o=t[2];return e[0]=r[0]*n+r[3]*i+r[6]*o,e[1]=r[1]*n+r[4]*i+r[7]*o,e[2]=r[2]*n+r[5]*i+r[8]*o,e[3]=t[3],e}var ih=w(()=>{});var Jr,DM=w(()=>{C0();ha();Vo();nh();ih();Jr=class extends Tc{constructor(t=0,r=0){super(2),zn(t)&&arguments.length===1?this.copy(t):(ie.debug&&(he(t),he(r)),this[0]=t,this[1]=r)}set(t,r){return this[0]=t,this[1]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this.check()}fromObject(t){return ie.debug&&(he(t.x),he(t.y)),this[0]=t.x,this[1]=t.y,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return yf(this,this,t),this.check()}transformAsVector(t){return wf(this,this,t),this.check()}transformByMatrix3(t){return gf(this,this,t),this.check()}transformByMatrix2x3(t){return OM(this,this,t),this.check()}transformByMatrix2(t){return NM(this,this,t),this.check()}}});function FM(){let e=new pf(3);return pf!==Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function ZP(e){let t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function N0(e,t,r){let n=new pf(3);return n[0]=e,n[1]=t,n[2]=r,n}function UM(e,t){let r=t[0],n=t[1],i=t[2],o=r*r+n*n+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function O0(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Ic(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[0],a=r[1],c=r[2];return e[0]=i*c-o*a,e[1]=o*s-n*c,e[2]=n*a-i*s,e}function Mf(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[3]*n+r[7]*i+r[11]*o+r[15];return s=s||1,e[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/s,e[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/s,e[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/s,e}function bf(e,t,r){let n=t[0],i=t[1],o=t[2];return e[0]=n*r[0]+i*r[3]+o*r[6],e[1]=n*r[1]+i*r[4]+o*r[7],e[2]=n*r[2]+i*r[5]+o*r[8],e}function GM(e,t,r){let n=r[0],i=r[1],o=r[2],s=r[3],a=t[0],c=t[1],l=t[2],h=i*l-o*c,u=o*a-n*l,f=n*c-i*a,d=i*f-o*u,m=o*h-n*f,p=n*u-i*h,g=s*2;return h*=g,u*=g,f*=g,d*=2,m*=2,p*=2,e[0]=a+h+d,e[1]=c+u+m,e[2]=l+f+p,e}function zM(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function VM(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function kM(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function qM(e,t){let r=e[0],n=e[1],i=e[2],o=t[0],s=t[1],a=t[2],c=Math.sqrt((r*r+n*n+i*i)*(o*o+s*s+a*a)),l=c&&O0(e,t)/c;return Math.acos(Math.min(Math.max(l,-1),1))}var jM,Ac=w(()=>{CM();jM=ZP});var B0,xf,E,WM=w(()=>{C0();ha();Vo();Ac();ih();B0=[0,0,0],E=class e extends Tc{static get ZERO(){return xf||(xf=new e(0,0,0),Object.freeze(xf)),xf}constructor(t=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&zn(t)?this.copy(t):(ie.debug&&(he(t),he(r),he(n)),this[0]=t,this[1]=r,this[2]=n)}set(t,r,n){return this[0]=t,this[1]=r,this[2]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return ie.debug&&(he(t.x),he(t.y),he(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=he(t)}angle(t){return qM(this,t)}cross(t){return Ic(this,this,t),this.check()}rotateX({radians:t,origin:r=B0}){return zM(this,this,r,t),this.check()}rotateY({radians:t,origin:r=B0}){return VM(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=B0}){return kM(this,this,r,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return Mf(this,this,t),this.check()}transformAsVector(t){return _f(this,this,t),this.check()}transformByMatrix3(t){return bf(this,this,t),this.check()}transformByMatrix2(t){return BM(this,this,t),this.check()}transformByQuaternion(t){return GM(this,this,t),this.check()}}});function HM(e,t){if(e===t){let r=t[1],n=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=i}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function $M(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=t[4],a=t[5],c=t[6],l=t[7],h=t[8],u=h*s-a*l,f=-h*o+a*c,d=l*o-s*c,m=r*u+n*f+i*d;return m?(m=1/m,e[0]=u*m,e[1]=(-h*n+i*l)*m,e[2]=(a*n-i*s)*m,e[3]=f*m,e[4]=(h*r-i*c)*m,e[5]=(-a*r+i*o)*m,e[6]=d*m,e[7]=(-l*r+n*c)*m,e[8]=(s*r-n*o)*m,e):null}function YM(e){let t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],s=e[5],a=e[6],c=e[7],l=e[8];return t*(l*o-s*c)+r*(-l*i+s*a)+n*(c*i-o*a)}function L0(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=r[0],d=r[1],m=r[2],p=r[3],g=r[4],y=r[5],_=r[6],b=r[7],M=r[8];return e[0]=f*n+d*s+m*l,e[1]=f*i+d*a+m*h,e[2]=f*o+d*c+m*u,e[3]=p*n+g*s+y*l,e[4]=p*i+g*a+y*h,e[5]=p*o+g*c+y*u,e[6]=_*n+b*s+M*l,e[7]=_*i+b*a+M*h,e[8]=_*o+b*c+M*u,e}function KM(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=r[0],d=r[1];return e[0]=n,e[1]=i,e[2]=o,e[3]=s,e[4]=a,e[5]=c,e[6]=f*n+d*s+l,e[7]=f*i+d*a+h,e[8]=f*o+d*c+u,e}function XM(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=Math.sin(r),d=Math.cos(r);return e[0]=d*n+f*s,e[1]=d*i+f*a,e[2]=d*o+f*c,e[3]=d*s-f*n,e[4]=d*a-f*i,e[5]=d*c-f*o,e[6]=l,e[7]=h,e[8]=u,e}function D0(e,t,r){let n=r[0],i=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function ZM(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r+r,a=n+n,c=i+i,l=r*s,h=n*s,u=n*a,f=i*s,d=i*a,m=i*c,p=o*s,g=o*a,y=o*c;return e[0]=1-u-m,e[3]=h-y,e[6]=f+g,e[1]=h+y,e[4]=1-l-m,e[7]=d-p,e[2]=f-g,e[5]=d+p,e[8]=1-l-u,e}var F0=w(()=>{});function tR(){return Sf||(Sf=new Qr([0,0,0,0,0,0,0,0,0]),Object.freeze(Sf)),Sf}function eR(){return vf||(vf=new Qr,Object.freeze(vf)),vf}var U0,QP,Qr,Sf,vf,JM=w(()=>{P0();Vo();ih();F0();nh();Ac();(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL1ROW0=3]="COL1ROW0",e[e.COL1ROW1=4]="COL1ROW1",e[e.COL1ROW2=5]="COL1ROW2",e[e.COL2ROW0=6]="COL2ROW0",e[e.COL2ROW1=7]="COL2ROW1",e[e.COL2ROW2=8]="COL2ROW2"})(U0||(U0={}));QP=Object.freeze([1,0,0,0,1,0,0,0,1]),Qr=class extends Ec{static get IDENTITY(){return eR()}static get ZERO(){return tR()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return U0}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(QP)}fromObject(t){return this.check()}fromQuaternion(t){return ZM(this,t),this.check()}fromMatrix4(t){return this.set(t[0],t[1],t[2],t[4],t[5],t[6],t[8],t[9],t[10])}set(t,r,n,i,o,s,a,c,l){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this[4]=o,this[5]=s,this[6]=a,this[7]=c,this[8]=l,this.check()}setRowMajor(t,r,n,i,o,s,a,c,l){return this[0]=t,this[1]=i,this[2]=a,this[3]=r,this[4]=o,this[5]=c,this[6]=n,this[7]=s,this[8]=l,this.check()}determinant(){return YM(this)}transpose(){return HM(this,this),this.check()}invert(){return $M(this,this),this.check()}multiplyLeft(t){return L0(this,t,this),this.check()}multiplyRight(t){return L0(this,this,t),this.check()}rotate(t){return XM(this,this,t),this.check()}scale(t){return Array.isArray(t)?D0(this,this,t):D0(this,this,[t,t]),this.check()}translate(t){return KM(this,this,t),this.check()}transform(t,r){let n;switch(t.length){case 2:n=gf(r||[-0,-0],t,this);break;case 3:n=bf(r||[-0,-0,-0],t,this);break;case 4:n=LM(r||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return vc(n,t.length),n}},vf=null});function QM(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function G0(e,t){if(e===t){let r=t[1],n=t[2],i=t[3],o=t[6],s=t[7],a=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=o,e[11]=t[14],e[12]=i,e[13]=s,e[14]=a}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function z0(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=t[4],a=t[5],c=t[6],l=t[7],h=t[8],u=t[9],f=t[10],d=t[11],m=t[12],p=t[13],g=t[14],y=t[15],_=r*a-n*s,b=r*c-i*s,M=r*l-o*s,T=n*c-i*a,A=n*l-o*a,S=i*l-o*c,v=h*p-u*m,N=h*g-f*m,B=h*y-d*m,C=u*g-f*p,R=u*y-d*p,W=f*y-d*g,j=_*W-b*R+M*C+T*B-A*N+S*v;return j?(j=1/j,e[0]=(a*W-c*R+l*C)*j,e[1]=(i*R-n*W-o*C)*j,e[2]=(p*S-g*A+y*T)*j,e[3]=(f*A-u*S-d*T)*j,e[4]=(c*B-s*W-l*N)*j,e[5]=(r*W-i*B+o*N)*j,e[6]=(g*M-m*S-y*b)*j,e[7]=(h*S-f*M+d*b)*j,e[8]=(s*R-a*B+l*v)*j,e[9]=(n*B-r*R-o*v)*j,e[10]=(m*A-p*M+y*_)*j,e[11]=(u*M-h*A-d*_)*j,e[12]=(a*N-s*C-c*v)*j,e[13]=(r*C-n*N+i*v)*j,e[14]=(p*b-m*T-g*_)*j,e[15]=(h*T-u*b+f*_)*j,e):null}function V0(e){let t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],s=e[5],a=e[6],c=e[7],l=e[8],h=e[9],u=e[10],f=e[11],d=e[12],m=e[13],p=e[14],g=e[15],y=t*s-r*o,_=t*a-n*o,b=r*a-n*s,M=l*m-h*d,T=l*p-u*d,A=h*p-u*m,S=t*A-r*T+n*M,v=o*A-s*T+a*M,N=l*b-h*_+u*y,B=d*b-m*_+p*y;return c*S-i*v+g*N-f*B}function Ef(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=t[9],d=t[10],m=t[11],p=t[12],g=t[13],y=t[14],_=t[15],b=r[0],M=r[1],T=r[2],A=r[3];return e[0]=b*n+M*a+T*u+A*p,e[1]=b*i+M*c+T*f+A*g,e[2]=b*o+M*l+T*d+A*y,e[3]=b*s+M*h+T*m+A*_,b=r[4],M=r[5],T=r[6],A=r[7],e[4]=b*n+M*a+T*u+A*p,e[5]=b*i+M*c+T*f+A*g,e[6]=b*o+M*l+T*d+A*y,e[7]=b*s+M*h+T*m+A*_,b=r[8],M=r[9],T=r[10],A=r[11],e[8]=b*n+M*a+T*u+A*p,e[9]=b*i+M*c+T*f+A*g,e[10]=b*o+M*l+T*d+A*y,e[11]=b*s+M*h+T*m+A*_,b=r[12],M=r[13],T=r[14],A=r[15],e[12]=b*n+M*a+T*u+A*p,e[13]=b*i+M*c+T*f+A*g,e[14]=b*o+M*l+T*d+A*y,e[15]=b*s+M*h+T*m+A*_,e}function k0(e,t,r){let n=r[0],i=r[1],o=r[2],s,a,c,l,h,u,f,d,m,p,g,y;return t===e?(e[12]=t[0]*n+t[4]*i+t[8]*o+t[12],e[13]=t[1]*n+t[5]*i+t[9]*o+t[13],e[14]=t[2]*n+t[6]*i+t[10]*o+t[14],e[15]=t[3]*n+t[7]*i+t[11]*o+t[15]):(s=t[0],a=t[1],c=t[2],l=t[3],h=t[4],u=t[5],f=t[6],d=t[7],m=t[8],p=t[9],g=t[10],y=t[11],e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=h,e[5]=u,e[6]=f,e[7]=d,e[8]=m,e[9]=p,e[10]=g,e[11]=y,e[12]=s*n+h*i+m*o+t[12],e[13]=a*n+u*i+p*o+t[13],e[14]=c*n+f*i+g*o+t[14],e[15]=l*n+d*i+y*o+t[15]),e}function q0(e,t,r){let n=r[0],i=r[1],o=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function j0(e,t,r,n){let i=n[0],o=n[1],s=n[2],a=Math.sqrt(i*i+o*o+s*s),c,l,h,u,f,d,m,p,g,y,_,b,M,T,A,S,v,N,B,C,R,W,j,I;return a<1e-6?null:(a=1/a,i*=a,o*=a,s*=a,l=Math.sin(r),c=Math.cos(r),h=1-c,u=t[0],f=t[1],d=t[2],m=t[3],p=t[4],g=t[5],y=t[6],_=t[7],b=t[8],M=t[9],T=t[10],A=t[11],S=i*i*h+c,v=o*i*h+s*l,N=s*i*h-o*l,B=i*o*h-s*l,C=o*o*h+c,R=s*o*h+i*l,W=i*s*h+o*l,j=o*s*h-i*l,I=s*s*h+c,e[0]=u*S+p*v+b*N,e[1]=f*S+g*v+M*N,e[2]=d*S+y*v+T*N,e[3]=m*S+_*v+A*N,e[4]=u*B+p*C+b*R,e[5]=f*B+g*C+M*R,e[6]=d*B+y*C+T*R,e[7]=m*B+_*C+A*R,e[8]=u*W+p*j+b*I,e[9]=f*W+g*j+M*I,e[10]=d*W+y*j+T*I,e[11]=m*W+_*j+A*I,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function W0(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[4],s=t[5],a=t[6],c=t[7],l=t[8],h=t[9],u=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*i+l*n,e[5]=s*i+h*n,e[6]=a*i+u*n,e[7]=c*i+f*n,e[8]=l*i-o*n,e[9]=h*i-s*n,e[10]=u*i-a*n,e[11]=f*i-c*n,e}function H0(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[0],s=t[1],a=t[2],c=t[3],l=t[8],h=t[9],u=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i-l*n,e[1]=s*i-h*n,e[2]=a*i-u*n,e[3]=c*i-f*n,e[8]=o*n+l*i,e[9]=s*n+h*i,e[10]=a*n+u*i,e[11]=c*n+f*i,e}function $0(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[0],s=t[1],a=t[2],c=t[3],l=t[4],h=t[5],u=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i+l*n,e[1]=s*i+h*n,e[2]=a*i+u*n,e[3]=c*i+f*n,e[4]=l*i-o*n,e[5]=h*i-s*n,e[6]=u*i-a*n,e[7]=f*i-c*n,e}function Y0(e,t){let r=t[0],n=t[1],i=t[2],o=t[4],s=t[5],a=t[6],c=t[8],l=t[9],h=t[10];return e[0]=Math.sqrt(r*r+n*n+i*i),e[1]=Math.sqrt(o*o+s*s+a*a),e[2]=Math.sqrt(c*c+l*l+h*h),e}function K0(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r+r,a=n+n,c=i+i,l=r*s,h=n*s,u=n*a,f=i*s,d=i*a,m=i*c,p=o*s,g=o*a,y=o*c;return e[0]=1-u-m,e[1]=h+y,e[2]=f-g,e[3]=0,e[4]=h-y,e[5]=1-l-m,e[6]=d+p,e[7]=0,e[8]=f+g,e[9]=d-p,e[10]=1-l-u,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function X0(e,t,r,n,i,o,s){let a=1/(r-t),c=1/(i-n),l=1/(o-s);return e[0]=o*2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o*2*c,e[6]=0,e[7]=0,e[8]=(r+t)*a,e[9]=(i+n)*c,e[10]=(s+o)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=s*o*2*l,e[15]=0,e}function t2(e,t,r,n,i){let o=1/Math.tan(t/2);if(e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let s=1/(n-i);e[10]=(i+n)*s,e[14]=2*i*n*s}else e[10]=-1,e[14]=-2*n;return e}function e2(e,t,r,n,i,o,s){let a=1/(t-r),c=1/(n-i),l=1/(o-s);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*a,e[13]=(i+n)*c,e[14]=(s+o)*l,e[15]=1,e}function Q0(e,t,r,n){let i,o,s,a,c,l,h,u,f,d,m=t[0],p=t[1],g=t[2],y=n[0],_=n[1],b=n[2],M=r[0],T=r[1],A=r[2];return Math.abs(m-M)<1e-6&&Math.abs(p-T)<1e-6&&Math.abs(g-A)<1e-6?QM(e):(u=m-M,f=p-T,d=g-A,i=1/Math.sqrt(u*u+f*f+d*d),u*=i,f*=i,d*=i,o=_*d-b*f,s=b*u-y*d,a=y*f-_*u,i=Math.sqrt(o*o+s*s+a*a),i?(i=1/i,o*=i,s*=i,a*=i):(o=0,s=0,a=0),c=f*a-d*s,l=d*o-u*a,h=u*s-f*o,i=Math.sqrt(c*c+l*l+h*h),i?(i=1/i,c*=i,l*=i,h*=i):(c=0,l=0,h=0),e[0]=o,e[1]=c,e[2]=u,e[3]=0,e[4]=s,e[5]=l,e[6]=f,e[7]=0,e[8]=a,e[9]=h,e[10]=d,e[11]=0,e[12]=-(o*m+s*p+a*g),e[13]=-(c*m+l*p+h*g),e[14]=-(u*m+f*p+d*g),e[15]=1,e)}var Z0,J0,tg=w(()=>{Z0=t2;J0=e2});function r2(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function n2(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function i2(e){let t=e[0],r=e[1],n=e[2],i=e[3];return Math.sqrt(t*t+r*r+n*n+i*i)}function o2(e){let t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i}function s2(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r*r+n*n+i*i+o*o;return s>0&&(s=1/Math.sqrt(s)),e[0]=r*s,e[1]=n*s,e[2]=i*s,e[3]=o*s,e}function a2(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function c2(e,t,r,n){let i=t[0],o=t[1],s=t[2],a=t[3];return e[0]=i+n*(r[0]-i),e[1]=o+n*(r[1]-o),e[2]=s+n*(r[2]-s),e[3]=a+n*(r[3]-a),e}function l2(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*s,e[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*s,e[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*s,e[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*s,e}var Tf=w(()=>{});function sR(){return If||(If=new bt([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(If)),If}function aR(){return Af||(Af=new bt,Object.freeze(Af)),Af}function h2(e){if(e>Math.PI*2)throw Error("expected radians")}function cR(e,t,r,n,i,o){let s=2*o/(r-t),a=2*o/(i-n),c=(r+t)/(r-t),l=(i+n)/(i-n),h=-1,u=-1,f=-2*o;return e[0]=s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=c,e[9]=l,e[10]=h,e[11]=u,e[12]=0,e[13]=0,e[14]=f,e[15]=0,e}var ng,nR,iR,eg,rg,oR,bt,If,Af,u2=w(()=>{P0();Vo();ih();tg();nh();Ac();Tf();(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(ng||(ng={}));nR=45*Math.PI/180,iR=1,eg=.1,rg=500,oR=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),bt=class extends Ec{static get IDENTITY(){return aR()}static get ZERO(){return sR()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return ng}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,r,n,i,o,s,a,c,l,h,u,f,d,m,p,g){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this[4]=o,this[5]=s,this[6]=a,this[7]=c,this[8]=l,this[9]=h,this[10]=u,this[11]=f,this[12]=d,this[13]=m,this[14]=p,this[15]=g,this.check()}setRowMajor(t,r,n,i,o,s,a,c,l,h,u,f,d,m,p,g){return this[0]=t,this[1]=o,this[2]=l,this[3]=d,this[4]=r,this[5]=s,this[6]=h,this[7]=m,this[8]=n,this[9]=a,this[10]=u,this[11]=p,this[12]=i,this[13]=c,this[14]=f,this[15]=g,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(oR)}fromObject(t){return this.check()}fromQuaternion(t){return K0(this,t),this.check()}fromMatrix3(t){return this.set(t[0],t[1],t[2],0,t[3],t[4],t[5],0,t[6],t[7],t[8],0,0,0,0,1)}frustum(t){let{left:r,right:n,bottom:i,top:o,near:s=eg,far:a=rg}=t;return a===1/0?cR(this,r,n,i,o,s):X0(this,r,n,i,o,s,a),this.check()}lookAt(t){let{eye:r,center:n=[0,0,0],up:i=[0,1,0]}=t;return Q0(this,r,n,i),this.check()}ortho(t){let{left:r,right:n,bottom:i,top:o,near:s=eg,far:a=rg}=t;return J0(this,r,n,i,o,s,a),this.check()}orthographic(t){let{fovy:r=nR,aspect:n=iR,focalDistance:i=1,near:o=eg,far:s=rg}=t;h2(r);let a=r/2,c=i*Math.tan(a),l=c*n;return this.ortho({left:-l,right:l,bottom:-c,top:c,near:o,far:s})}perspective(t){let{fovy:r=45*Math.PI/180,aspect:n=1,near:i=.1,far:o=500}=t;return h2(r),Z0(this,r,n,i,o),this.check()}determinant(){return V0(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),i=1/n[0],o=1/n[1],s=1/n[2];return t[0]=this[0]*i,t[1]=this[1]*o,t[2]=this[2]*s,t[3]=0,t[4]=this[4]*i,t[5]=this[5]*o,t[6]=this[6]*s,t[7]=0,t[8]=this[8]*i,t[9]=this[9]*o,t[10]=this[10]*s,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}getRotationMatrix3(t,r){t=t||[-0,-0,-0,-0,-0,-0,-0,-0,-0],r=r||[-0,-0,-0];let n=this.getScale(r),i=1/n[0],o=1/n[1],s=1/n[2];return t[0]=this[0]*i,t[1]=this[1]*o,t[2]=this[2]*s,t[3]=this[4]*i,t[4]=this[5]*o,t[5]=this[6]*s,t[6]=this[8]*i,t[7]=this[9]*o,t[8]=this[10]*s,t}transpose(){return G0(this,this),this.check()}invert(){return z0(this,this),this.check()}multiplyLeft(t){return Ef(this,t,this),this.check()}multiplyRight(t){return Ef(this,this,t),this.check()}rotateX(t){return W0(this,this,t),this.check()}rotateY(t){return H0(this,this,t),this.check()}rotateZ(t){return $0(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return j0(this,this,t,r),this.check()}scale(t){return q0(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return k0(this,this,t),this.check()}transform(t,r){return t.length===4?(r=l2(r||[-0,-0,-0,-0],t,this),vc(r,4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let{length:n}=t,i;switch(n){case 2:i=yf(r||[-0,-0],t,this);break;case 3:i=Mf(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return vc(i,t.length),i}transformAsVector(t,r){let n;switch(t.length){case 2:n=wf(r||[-0,-0],t,this);break;case 3:n=_f(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return vc(n,t.length),n}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,r,n){return this.identity().translate([t,r,n])}}});function f2(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function ig(e,t,r){r=r*.5;let n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function og(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=r[0],c=r[1],l=r[2],h=r[3];return e[0]=n*h+s*a+i*l-o*c,e[1]=i*h+s*c+o*a-n*l,e[2]=o*h+s*l+n*c-i*a,e[3]=s*h-n*a-i*c-o*l,e}function d2(e,t,r){r*=.5;let n=t[0],i=t[1],o=t[2],s=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+s*a,e[1]=i*c+o*a,e[2]=o*c-i*a,e[3]=s*c-n*a,e}function m2(e,t,r){r*=.5;let n=t[0],i=t[1],o=t[2],s=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c-o*a,e[1]=i*c+s*a,e[2]=o*c+n*a,e[3]=s*c-i*a,e}function p2(e,t,r){r*=.5;let n=t[0],i=t[1],o=t[2],s=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+i*a,e[1]=i*c-n*a,e[2]=o*c+s*a,e[3]=s*c-o*a,e}function g2(e,t){let r=t[0],n=t[1],i=t[2];return e[0]=r,e[1]=n,e[2]=i,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),e}function y2(e,t,r,n){let i=t[0],o=t[1],s=t[2],a=t[3],c=r[0],l=r[1],h=r[2],u=r[3],f,d,m,p,g;return f=i*c+o*l+s*h+a*u,f<0&&(f=-f,c=-c,l=-l,h=-h,u=-u),1-f>1e-6?(d=Math.acos(f),g=Math.sin(d),m=Math.sin((1-n)*d)/g,p=Math.sin(n*d)/g):(m=1-n,p=n),e[0]=m*i+p*c,e[1]=m*o+p*l,e[2]=m*s+p*h,e[3]=m*a+p*u,e}function w2(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r*r+n*n+i*i+o*o,a=s?1/s:0;return e[0]=-r*a,e[1]=-n*a,e[2]=-i*a,e[3]=o*a,e}function _2(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function M2(e,t){let r=t[0]+t[4]+t[8],n;if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{let i=0;t[4]>t[0]&&(i=1),t[8]>t[i*3+i]&&(i=2);let o=(i+1)%3,s=(i+2)%3;n=Math.sqrt(t[i*3+i]-t[o*3+o]-t[s*3+s]+1),e[i]=.5*n,n=.5/n,e[3]=(t[o*3+s]-t[s*3+o])*n,e[o]=(t[o*3+i]+t[i*3+o])*n,e[s]=(t[s*3+i]+t[i*3+s])*n}return e}var b2,x2,S2,v2,E2,T2,lR,I2,sg=w(()=>{Ac();Tf();b2=r2,x2=n2,S2=a2,v2=c2,E2=i2,T2=o2,lR=s2,I2=(function(){let e=FM(),t=N0(1,0,0),r=N0(0,1,0);return function(n,i,o){let s=O0(i,o);return s<-.999999?(Ic(e,t,i),jM(e)<1e-6&&Ic(e,r,i),UM(e,e),ig(n,e,Math.PI),n):s>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Ic(e,i,o),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+s,lR(n,n))}})()});var Xi,A2=w(()=>{mf();Vo();sg();Xi=class extends zo{constructor(t=0,r=0,n=0,i=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,r,n,i)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,r,n,i){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return M2(this,t),this.check()}fromEuler(t){switch(this.identity(),t.order){case"xyz":return this.rotateX(t.x).rotateY(t.y).rotateZ(t.z);case"yxz":return this.rotateY(t.y).rotateX(t.x).rotateZ(t.z);case"zxy":return this.rotateZ(t.z).rotateX(t.x).rotateY(t.y);case"zyx":return this.rotateZ(t.z).rotateY(t.y).rotateX(t.x);case"yzx":return this.rotateY(t.y).rotateZ(t.z).rotateX(t.x);case"xzy":return this.rotateX(t.x).rotateZ(t.z).rotateY(t.y);default:throw new Error("Unknown Euler angle order")}}fromAxisRotation(t,r){return ig(this,t,r),this.check()}identity(){return f2(this),this.check()}setAxisAngle(t,r){return this.fromAxisRotation(t,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=he(t)}get y(){return this[1]}set y(t){this[1]=he(t)}get z(){return this[2]}set z(t){this[2]=he(t)}get w(){return this[3]}set w(t){this[3]=he(t)}len(){return E2(this)}lengthSquared(){return T2(this)}dot(t){return S2(this,t)}rotationTo(t,r){return I2(this,t,r),this.check()}add(t){return b2(this,this,t),this.check()}calculateW(){return g2(this,this),this.check()}conjugate(){return _2(this,this),this.check()}invert(){return w2(this,this),this.check()}lerp(t,r,n){return n===void 0?this.lerp(this,t,r):(v2(this,t,r,n),this.check())}multiplyRight(t){return og(this,this,t),this.check()}multiplyLeft(t){return og(this,t,this),this.check()}normalize(){let t=this.len(),r=t>0?1/t:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,t===0&&(this[3]=1),this.check()}rotateX(t){return d2(this,this,t),this.check()}rotateY(t){return m2(this,this,t),this.check()}rotateZ(t){return p2(this,this,t),this.check()}scale(t){return x2(this,this,t),this.check()}slerp(t,r,n){let i,o,s;return arguments.length===2?(i=this,o=t,s=r):(i=t,o=r,s=n),y2(this,i,o,s),this.check()}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,r){return this.setAxisAngle(t,r)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}}});function cg(){return{eastX:0,eastY:1,northZ:1,upX:1,upY:0,upZ:0}}function lg(e,t,r){let n=e.x,i=e.y,o=e.z,s=t.x,a=t.y,c=t.z;return o!==0?!1:hR(r,n,i,s*i-a*n,s,a,c)}function hg(e,t,r,n,i,o){let s=ag(r),a=ag(n),c=ag(i),l=Math.abs(s),h=Math.abs(a),u=Math.abs(c);if(!l||!h||!u||l===h||l===u||h===u||(l%3+1===h?1:-1)*Math.sign(s*a*c)!==1||!Array.isArray(o)&&o.length<16)return!1;let d=e.eastX,m=e.eastY,p=e.northZ,g=e.upX,y=e.upY,_=e.upZ,b=-_*m,M=_*d,T=t.x,A=t.y,S=t.z,v=(l===1?d:l===2?b:g)*Math.sign(s),N=(l===1?m:l===2?M:y)*Math.sign(s),B=(l===1?0:l===2?p:_)*Math.sign(s),C=(h===1?d:h===2?b:g)*Math.sign(a),R=(h===1?m:h===2?M:y)*Math.sign(a),W=(h===1?0:h===2?p:_)*Math.sign(a),j=(u===1?d:u===2?b:g)*Math.sign(c),I=(u===1?m:u===2?M:y)*Math.sign(c),P=(u===1?0:u===2?p:_)*Math.sign(c);return!Number.isFinite(v)||!Number.isFinite(N)||!Number.isFinite(B)||!Number.isFinite(C)||!Number.isFinite(R)||!Number.isFinite(W)||!Number.isFinite(j)||!Number.isFinite(I)||!Number.isFinite(P)||!Number.isFinite(T)||!Number.isFinite(A)||!Number.isFinite(S)||o instanceof Float32Array&&(!Number.isFinite(Math.fround(v))||!Number.isFinite(Math.fround(N))||!Number.isFinite(Math.fround(B))||!Number.isFinite(Math.fround(C))||!Number.isFinite(Math.fround(R))||!Number.isFinite(Math.fround(W))||!Number.isFinite(Math.fround(j))||!Number.isFinite(Math.fround(I))||!Number.isFinite(Math.fround(P))||!Number.isFinite(Math.fround(T))||!Number.isFinite(Math.fround(A))||!Number.isFinite(Math.fround(S)))?!1:(o[0]=v,o[1]=N,o[2]=B,o[3]=0,o[4]=C,o[5]=R,o[6]=W,o[7]=0,o[8]=j,o[9]=I,o[10]=P,o[11]=0,o[12]=T,o[13]=A,o[14]=S,o[15]=1,!0)}function ag(e){switch(e){case"east":return 1;case"west":return-1;case"north":return 2;case"south":return-2;case"up":return 3;case"down":return-3;default:return 0}}function hR(e,t,r,n,i,o,s){return!Number.isFinite(t)||!Number.isFinite(r)||!Number.isFinite(n)||!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s)?!1:(e.eastX=t,e.eastY=r,e.northZ=n,e.upX=i,e.upY=o,e.upZ=s,!0)}var P2=w(()=>{});function sh(e,t,r=e){let n=e.x,i=e.y,o=e.z,{semiMajorAxis:s,semiMinorAxis:a,eccentricitySquared:c}=t,l=Math.sin(i),h=Math.abs(i)===Math.PI/2?0:Math.cos(i),u=a/s,f=c<.9?s/Math.sqrt(1-c*l*l):s/Math.hypot(h,u*l),d=(f+o)*h*Math.cos(n),m=(f+o)*h*Math.sin(n),p=(f*(c<.9?1-c:u*u)+o)*l;return Pc(r,d,m,p)}function ah(e,t,r=e){let n=e.x,i=e.y,o=e.z,{semiMajorAxis:s,semiMinorAxis:a,eccentricitySquared:c}=t,l=Math.atan2(i,n),h=Math.hypot(n,i),u=Math.hypot(n,i,o);if(!(u>0)||!Number.isFinite(u))return!1;if(c===0)return Pc(r,h===0?0:l,Math.atan2(o,h),u-s);if(h===0)return Pc(r,0,Math.sign(o)*Math.PI/2,Math.abs(o)-a);let f=h/s,d=o/a;if(f*f+d*d<1-16*Rf||c>=.9)return ug(n,i,o,h,s,a,r);let m=o/u,p=h/u,g=1/Math.sqrt(1-c*(2-c)*p*p),y=p*(1-c)*g,_=m*g;for(let b=0;b<30;b++){let M=s/Math.sqrt(1-c*_*_),T=h*y+o*_-M*(1-c*_*_),A=c*M/(M+T);g=1/Math.sqrt(1-A*(2-A)*p*p);let S=p*(1-A)*g,v=m*g;if(Math.abs(v*y-S*_)<=1e-12){if(!Number.isFinite(T))break;return Pc(r,l,Math.atan2(v,Math.abs(S)),T)}y=S,_=v}return ug(n,i,o,h,s,a,r)}function ug(e,t,r,n,i,o,s){let a=Math.atan2(t,e),c=o/i,l=c*c,h=n/i,u=r/i,f=1-l;if(!(l>0)||c>1)return!1;let d=i*i,m=o*o,p=Number.isFinite(d)&&d>0?(m-l*d+ko(o,o,m)-l*ko(i,i,d)-ko(l,d,l*d))/d:0,g=n*n,y=e*e,_=t*t,b=y+_,M=Number.isFinite(g)&&g>0?(b-g+Pf(y,_,b)+ko(e,e,y)+ko(t,t,_)-ko(n,n,g))/(2*n):0,T=i*l,A=n-i,S=A+T,v=M+Pf(n,-i,A)+Pf(A,T,S)+ko(i,l,T)+i*p;if(r===0)return S+v<0?!1:Pc(s,a,0,A);let N=Math.abs(u)*c,B=0,C=l+Math.hypot(h,u*c);if(!Number.isFinite(C))return!1;let R=Math.max(N,h-f);R>B&&R<C||(R=C/2);let W=-(S+v)/i,j=Math.sqrt(W*(h+f))/f,I=W>0&&Math.abs(r)/j/i*c<=Rf*W?Math.atan2(Math.sign(r)*j/c,h/f):void 0;for(let P=0;P<1024&&I===void 0;P++){let D=f+R,F=h/D,L=r/R/i,O=L*c,V=i*R,yt=S-V,X=(yt+(Pf(S,-V,yt)+v-ko(i,R,V)))/(i*D)*(F+1),xt=X+O*O;if(!Number.isFinite(xt))return!1;xt>0?B=R:C=R;let et=-2*(F*F/D+O*O/R),dt=R-xt/et,St=dt>B&&dt<C?dt:B+(C-B)/2;if(Math.abs(xt)<=4*Rf*(Math.abs(X)+O*O)||C-B<=4*Rf*R){I=Math.atan2(L,F);break}R=St}return I!==void 0&&uR(s,a,I,n,r,i,c)}function Pf(e,t,r){let n=r-e;return e-(r-n)+(t-n)}function ko(e,t,r){let n=134217729*e,i=134217729*t;if(!Number.isFinite(n)||!Number.isFinite(i))return 0;let o=n-(n-e),s=i-(i-t),a=e-o,c=t-s;return o*s-r+o*c+a*s+a*c}function uR(e,t,r,n,i,o,s){let a=Math.sin(r),c=Math.cos(r);return Pc(e,t,r,n*c+i*a-o*Math.hypot(c,s*a))}function Pc(e,t,r,n){return!Number.isFinite(t)||!Number.isFinite(r)||!Number.isFinite(n)?!1:(e.x=t,e.y=r,e.z=n,!0)}var Rf,R2=w(()=>{Rf=Number.EPSILON});function C2(e){return ArrayBuffer.isView(e)?fR.call(e):void 0}var fR,N2=w(()=>{fR=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag).get});function Cf(e){return C2(e)==="Uint16Array"}var O2=w(()=>{N2()});function Nf(){return Rc??Uint16Array}var Rc,B2=w(()=>{Rc=globalThis.Float16Array});var L2=w(()=>{O2();B2()});var D2=w(()=>{L2()});var F2=w(()=>{F0()});var fg=w(()=>{tg()});var U2=w(()=>{sg()});var G2=w(()=>{nh()});var z2=w(()=>{Ac()});var V2=w(()=>{Tf()});var jt=w(()=>{DM();WM();JM();u2();A2();S0();R0();ha();P2();R2();D2();F2();fg();U2();G2();z2();V2();fg()});var Zi,fU,k2=w(()=>{Zi=6356752314245179e-9,fU={radii:[6378137,6378137,Zi],radiiSquared:[6378137*6378137,6378137*6378137,Zi*Zi],oneOverRadii:[1/6378137,1/6378137,1/Zi],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(Zi*Zi)],maximumRadius:Math.max(6378137,6378137,Zi),centerToleranceSquared:.1}});function dg(e){return e}function Ji(e,t=[],r=dg){return"longitude"in e?(t[0]=r(e.longitude),t[1]=r(e.latitude),t[2]=e.height):"x"in e?(t[0]=r(e.x),t[1]=r(e.y),t[2]=e.z):(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]),t}function q2(e,t=[]){return Ji(e,t,ie._cartographicRadians?dg:E0)}function mg(e,t,r,n){let i=ie._cartographicRadians?dg:T0,o=i(e),s=i(t);return"longitude"in n?(n.longitude=o,n.latitude=s,n.height=r):"x"in n?(n.x=o,n.y=s,n.z=r):(n[0]=o,n[1]=s,n[2]=r),n}var pU,j2=w(()=>{jt();pU=new E});function Ai(e,t,r,n,i,o,s){let c=[n,i,o,Math.abs(e),Math.abs(t),Math.abs(r)].map(S=>{let v=S.toString(2),N=v.indexOf(".");return{integer:BigInt("0b"+v.replace(".","")),exponent:N<0?0:N+1-v.length}}),l=Math.min(...c.filter(S=>S.integer!==0n).map(S=>S.exponent)),h=c.map(S=>S.integer<<BigInt(S.exponent-l)),u=h.slice(0,3).map(S=>S*S),f=u.reduce((S,v)=>S<v?S:v),d=u.map(S=>S-f),m=u.map((S,v)=>h[v]*h[v+3]),p=64;if(!m.some((S,v)=>d[v]===0n&&S!==0n)){let S=-1n,v=1n;for(let C=0;C<3;C++){if(d[C]===0n)continue;let R=d[C]*d[C];S=S*R+m[C]*m[C]*v,v*=R}if(S<0n)return!1;if(S===0n)return A(0n,1n);let B=d.filter(C=>C>0n).reduce((C,R)=>C<R?C:R);p=Math.max(64,(2n*(v+S)).toString(2).length-(S*B).toString(2).length+128)}let g=1n<<BigInt(p),y=d.map(S=>S*g),_=m.map(S=>S*g),b=_.map(S=>S*S),M=0n,T=_.reduce((S,v)=>S+v,0n);if(T===0n)return!1;for(let S=0;S<4096;S++){let v=M+T>>1n;if(v===M)return!1;let N=y[0]+v,B=y[1]+v,C=y[2]+v,R=N*N,W=B*B,j=C*C,I=b[0]*W*j+b[1]*R*j+b[2]*R*W-R*W*j;if(I===0n)return A(v,g);if(I>0n?M=v:T=v,M>0n&&T-M<=M>>60n)return A(M+T>>1n,g)}return!1;function A(S,v){let N=u.map((W,j)=>{let I=d[j]*v+S;return I===0n?0:pg(W*h[j+3]*v,I,l)});if(!N.every(Number.isFinite))return!1;let B=Math.sign(e)*N[0],C=Math.sign(t)*N[1],R=Math.sign(r)*N[2];return s.x=B,s.y=C,s.z=R,!0}}function pg(e,t,r){if(e===0n)return 0;let n=52-(e.toString(2).length-t.toString(2).length),i=n>=0?e<<BigInt(n):e,o=n>=0?t:t<<BigInt(-n),s=i/o,a=i%o;(2n*a>o||2n*a===o&&s&1n)&&s++;let c=r-n,l=Math.max(-1022,Math.min(1023,c));return Number(s)*2**l*2**(c-l)}var gg=w(()=>{});function W2(e,t,r,n,i,o,s){let a=Math.min(n,i,o),c=a*a,l=n*n,h=i*i,u=o*o;if(!(a>0)||!(c>0)||!Number.isFinite(Math.max(l,h,u)))return!1;let f=ua(a,a,c),d=l-c,m=h-c,p=u-c,g=Qi(l,-c,d)+ua(n,n,l)-f,y=Qi(h,-c,m)+ua(i,i,h)-f,_=Qi(u,-c,p)+ua(o,o,u)-f,b=n*Math.abs(e),M=i*Math.abs(t),T=o*Math.abs(r);if(c<2**-1022||e!==0&&b<2**-1022||t!==0&&M<2**-1022||r!==0&&T<2**-1022)return Ai(e,t,r,n,i,o,s);let A=ua(n,Math.abs(e),b),S=ua(i,Math.abs(t),M),v=ua(o,Math.abs(r),T);if(Math.hypot(d===0?b===0?0:1/0:b/(d+g),m===0?M===0?0:1/0:M/(m+y),p===0?T===0?0:1/0:T/(p+_))<=1+64*Number.EPSILON)return Ai(e,t,r,n,i,o,s);if((e!==0?1:0)+(t!==0?1:0)+(r!==0?1:0)==1)return s.x=e===0?e:Math.sign(e)*n,s.y=t===0?t:Math.sign(t)*i,s.z=r===0?r:Math.sign(r)*o,!0;let B=Math.hypot(d===0?b:0,m===0?M:0,p===0?T:0),C=Math.hypot(b,M,T);if(!(C>0)||!Number.isFinite(C))return Ai(e,t,r,n,i,o,s);let R=B>0?B:C;for(let W=0;W<512;W++){let j=d+R,I=m+R,P=p+R,D=Qi(d,R,j)+g,F=Qi(m,R,I)+y,L=Qi(p,R,P)+_,O=b/j,V=M/I,yt=T/P,Dt,X;O>=V&&O>=yt?(Dt=yg(b,A,d,g,R,j)*(O+1),X=(V*(1-F/I))**2+(yt*(1-L/P))**2):V>=yt?(Dt=yg(M,S,m,y,R,I)*(V+1),X=(O*(1-D/j))**2+(yt*(1-L/P))**2):(Dt=yg(T,v,p,_,R,P)*(yt+1),X=(O*(1-D/j))**2+(V*(1-F/I))**2);let xt=-2*(O*O/j+V*V/I+yt*yt/P),et=4*Number.EPSILON*(Math.abs(Dt)+X),dt=Dt+X;if(!Number.isFinite(dt))return Ai(e,t,r,n,i,o,s);if(Math.abs(dt)<=4*Number.EPSILON*(Math.abs(Dt)+X)||C-B<=4*Number.EPSILON*R){let Rt=et/Math.abs(xt);if(!Number.isFinite(xt)||!(Math.abs(xt)>0)||Rt>2e-13*R)return Ai(e,t,r,n,i,o,s);let zt=Math.sign(e)*n*(O*(1-D/j)),Wt=Math.sign(t)*i*(V*(1-F/I)),ee=Math.sign(r)*o*(yt*(1-L/P)),Jt=2*Rt*Math.max(Math.abs(zt/j),Math.abs(Wt/I),Math.abs(ee/P));return!Number.isFinite(Jt)||Jt>2e-13*Math.max(n,i,o)?Ai(e,t,r,n,i,o,s):!Number.isFinite(zt)||!Number.isFinite(Wt)||!Number.isFinite(ee)?Ai(e,t,r,n,i,o,s):(s.x=zt,s.y=Wt,s.z=ee,!0)}dt>0?B=R:C=R;let St=R-dt/xt,k=St>B&&St<C?St:B+(C-B)/2;if(k===R)return Ai(e,t,r,n,i,o,s);R=k}return Ai(e,t,r,n,i,o,s)}function yg(e,t,r,n,i,o){let s=e-r,a=Qi(e,-r,s)+t-n,c=s+a,l=Qi(s,a,c),h=c-i;return(h+(Qi(c,-i,h)+l))/o}function Qi(e,t,r){let n=r-e;return e-(r-n)+(t-n)}function ua(e,t,r){let n=134217729*e,i=134217729*t;if(!Number.isFinite(n)||!Number.isFinite(i))return 0;let o=n-(n-e),s=i-(i-t),a=e-o,c=t-s;return o*s-r+o*c+a*s+a*c}var H2=w(()=>{gg()});function $2(e,t,r=[]){let n=e,i="x"in e?n.x:e[0],o="x"in e?n.y:e[1],s="x"in e?n.z:e[2];if(!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(i*i+o*o+s*s))return;let{radii:a}=t;if(W2(i,o,s,a.x,a.y,a.z,Of))return Pi(r,Of.x,Of.y,Of.z)}function Pi(e,t,r,n){if(zn(e))e[0]=t,e[1]=r,e[2]=n;else{let i=e;i.x=t,i.y=r,i.z=n}return e}var Of,Y2=w(()=>{jt();H2();Of={x:0,y:0,z:0}});function K2(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0||t>e)throw new Error("Spheroid requires finite positive axes with semiMinorAxis <= semiMajorAxis")}function Df(e,t,r,n){let i=Math.max(Math.abs(e),Math.abs(t),Math.abs(r));if(!(i>0)||!Number.isFinite(i))return;let o=e/i,s=t/i,a=r/i,c=Math.hypot(o,s,a);return Pi(n,o/c,s/c,a/c)}var tn,Bf,SR,Vn,Lf,pt,Ff=w(()=>{jt();jt();k2();j2();Y2();tn={x:0,y:0,z:0},Bf=new E,SR=new E,Vn=new E,Lf=new E,pt=class e{static fromSpheroid(t){let{semiMajorAxis:r,semiMinorAxis:n}=t;return K2(r,n),new e(r,r,n)}constructor(t=0,r=0,n=0){this.centerToleranceSquared=we.EPSILON1,pr(Number.isFinite(t)&&t>=0),pr(Number.isFinite(r)&&r>=0),pr(Number.isFinite(n)&&n>=0),this.radii=new E(t,r,n),this.radiiSquared=new E(t*t,r*r,n*n),this.radiiToTheFourth=new E(t*t*t*t,r*r*r*r,n*n*n*n),this.oneOverRadii=new E(t===0?0:1/t,r===0?0:1/r,n===0?0:1/n),this.oneOverRadiiSquared=new E(t===0?0:1/(t*t),r===0?0:1/(r*r),n===0?0:1/(n*n)),this.minimumRadius=Math.min(t,r,n),this.maximumRadius=Math.max(t,r,n),n!==0&&(this.squaredXOverSquaredZ=(t/n)**2),t===r&&n>0&&n<=t&&Number.isFinite(this.radiiSquared.x)&&this.radiiSquared.z>0&&(this.spheroidGeometry=Object.freeze({semiMajorAxis:t,semiMinorAxis:n,eccentricitySquared:1-(n/t)**2})),Object.freeze(this.radii),Object.freeze(this.radiiSquared),Object.freeze(this.radiiToTheFourth),Object.freeze(this.oneOverRadii),Object.freeze(this.oneOverRadiiSquared),Object.freeze(this)}toSpheroid(){let{x:t,y:r,z:n}=this.radii;if(t!==r)throw new Error("Spheroid requires equal X/Y radii");return K2(t,n),Object.freeze({semiMajorAxis:t,semiMinorAxis:n})}equals(t){return this===t||!!(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,r=[0,0,0]){let n=q2(t,Lf),i=n[0],o=n[1],s=n[2];if(!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s)||!(this.minimumRadius>0)||!Number.isFinite(this.maximumRadius*this.maximumRadius))return;if(this.spheroidGeometry&&(ie._cartographicRadians||Math.abs(o)<=Math.PI/4))return tn.x=i,tn.y=o,tn.z=s,sh(tn,this.spheroidGeometry)?Pi(r,tn.x,tn.y,tn.z):void 0;let a=SR;this.geodeticSurfaceNormalCartographic(t,a);let c=a.x,l=a.y,h=a.z,u=this.radii.x,f=this.radii.y,d=this.radii.z,m=Math.hypot(u*c,f*l,d*h),p=u*(u*c/m)+s*c,g=f*(f*l/m)+s*l,y=d*(d*h/m)+s*h;if(!(!Number.isFinite(p)||!Number.isFinite(g)||!Number.isFinite(y)))return Pi(r,p,g,y)}cartesianToCartographic(t,r=[0,0,0]){let n=t,i="x"in t?n.x:t[0],o="x"in t?n.y:t[1],s="x"in t?n.z:t[2];if(!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s))return;if(this.spheroidGeometry&&Number.isFinite(i*i+o*o+s*s)&&Number.isFinite(this.oneOverRadiiSquared.x)&&Number.isFinite(this.oneOverRadiiSquared.z)){tn.x=i,tn.y=o,tn.z=s;let _=this.spheroidGeometry;if(!(s===0&&_.semiMinorAxis<_.semiMajorAxis&&Math.abs(Math.hypot(i,o)-_.semiMajorAxis*_.eccentricitySquared)<=64*Number.EPSILON*_.semiMajorAxis)&&ah(tn,_)){let M=i===0&&o===0?Math.atan2(o,i):tn.x;return mg(M,tn.y,tn.z,r)}}if(!(this.minimumRadius>0)||!Number.isFinite(this.maximumRadius*this.maximumRadius)||!Number.isFinite(1/(this.minimumRadius*this.minimumRadius)))return;Lf.set(i,o,s);let a=this.scaleToGeodeticSurface(Lf,Vn);if(!a)return;let c=a[0]*this.oneOverRadiiSquared.x,l=a[1]*this.oneOverRadiiSquared.y,h=a[2]*this.oneOverRadiiSquared.z,u=Math.hypot(c,l,h);if(!(u>0)||!Number.isFinite(u))return;let f=c/u,d=l/u,m=h/u,p=Math.atan2(d,f),g=Math.atan2(m,Math.hypot(f,d)),y=(i-a[0])*f+(o-a[1])*d+(s-a[2])*m;return mg(p,g,y,r)}geocentricSurfaceNormal(t,r=[0,0,0]){Ji(t,Bf);let n=Bf;return Df(n.x,n.y,n.z,r)}geodeticSurfaceNormalCartographic(t,r=[0,0,0]){let n=Ji(t,Lf),i=ie._cartographicRadians?n[0]:n[0]*Math.PI/180,o=ie._cartographicRadians?n[1]:n[1]*Math.PI/180,s=!ie._cartographicRadians&&Math.abs(n[1])>45,a=(90-Math.abs(n[1]))*Math.PI/180,c=s?Math.sin(a):Math.abs(o)===Math.PI/2?0:Math.cos(o),l=s?Math.sign(n[1])*Math.cos(a):Math.sin(o);return Df(c*Math.cos(i),c*Math.sin(i),l,r)}geodeticSurfaceNormal(t,r=[0,0,0]){if(!(this.minimumRadius>0))return;Ji(t,Bf);let n=Bf,i=Math.max(Math.abs(n.x),Math.abs(n.y),Math.abs(n.z));if(!(i>0)||!Number.isFinite(i))return;let o=n.x/i*(this.minimumRadius/this.radii.x)**2,s=n.y/i*(this.minimumRadius/this.radii.y)**2,a=n.z/i*(this.minimumRadius/this.radii.z)**2;if((n.x===0||Math.abs(o)>=2**-1022)&&(n.y===0||Math.abs(s)>=2**-1022)&&(n.z===0||Math.abs(a)>=2**-1022))return Df(o,s,a,r);let c=n.x===0?0:Math.min(1023,Math.floor(Math.log2(Math.abs(n.x)))),l=n.y===0?0:Math.min(1023,Math.floor(Math.log2(Math.abs(n.y)))),h=n.z===0?0:Math.min(1023,Math.floor(Math.log2(Math.abs(n.z)))),u=Math.min(1023,Math.floor(Math.log2(this.radii.x))),f=Math.min(1023,Math.floor(Math.log2(this.radii.y))),d=Math.min(1023,Math.floor(Math.log2(this.radii.z))),m=Math.max(n.x===0?-1/0:c-2*u,n.y===0?-1/0:l-2*f,n.z===0?-1/0:h-2*d);return Df(n.x===0?n.x:n.x/2**c/(this.radii.x/2**u)**2*2**(c-2*u-m),n.y===0?n.y:n.y/2**l/(this.radii.y/2**f)**2*2**(l-2*f-m),n.z===0?n.z:n.z/2**h/(this.radii.z/2**d)**2*2**(h-2*d-m),r)}scaleToGeodeticSurface(t,r){return $2(t,this,r)}scaleToGeocentricSurface(t,r=[0,0,0]){Ji(t,Vn);let n=Vn,i=Math.max(Math.abs(n.x),Math.abs(n.y),Math.abs(n.z));if(!(this.minimumRadius>0)||!(i>0)||!Number.isFinite(i))return;let o=n.x*n.x*this.oneOverRadiiSquared.x+n.y*n.y*this.oneOverRadiiSquared.y+n.z*n.z*this.oneOverRadiiSquared.z;if(o>=2**-1022&&Number.isFinite(o)&&i*i>=2**-1022&&Number.isFinite(i*i)){let h=1/Math.sqrt(o);return Pi(r,n.x*h,n.y*h,n.z*h)}let s=n.x/i,a=n.y/i,c=n.z/i,l=Math.hypot(s/this.radii.x,a/this.radii.y,c/this.radii.z);if(!(!(l>0)||!Number.isFinite(l)))return Pi(r,s/l,a/l,c/l)}transformPositionToScaledSpace(t,r=[0,0,0]){Ji(t,Vn);let n=Vn.scale(this.oneOverRadii);return Pi(r,n.x,n.y,n.z)}transformPositionFromScaledSpace(t,r=[0,0,0]){Ji(t,Vn);let n=Vn.scale(this.radii);return Pi(r,n.x,n.y,n.z)}getSurfaceNormalIntersectionWithZAxis(t,r=0,n=[0,0,0]){if(pr(this.radii.x===this.radii.y&&this.minimumRadius>0),Ji(t,Vn),!Number.isFinite(Vn.x)||!Number.isFinite(Vn.y)||!Number.isFinite(Vn.z)||!Number.isFinite(r))return;let i=Vn.z*(1-this.squaredXOverSquaredZ);if(Number.isFinite(i)&&!(Math.abs(i)>=this.radii.z-r))return Pi(n,0,0,i)}};pt.WGS84=new pt(6378137,6378137,Zi)});var ch,X2,en,wg=w(()=>{jt();jt();ch=new E,X2=new E,en=class e{constructor(t=[0,0,0],r=0){this.radius=-0,this.center=new E,this.fromCenterRadius(t,r)}fromCenterRadius(t,r){return this.center.from(t),this.radius=r,this}fromCornerPoints(t,r){return r=ch.from(r),this.center=new E().from(t).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new e(this.center,this.radius)}union(t){let r=this.center,n=this.radius,i=t.center,o=t.radius,s=ch.copy(i).subtract(r),a=s.magnitude();if(n>=a+o)return this.clone();if(o>=a+n)return t.clone();let c=(n+a+o)*.5;return X2.copy(s).scale((-n+c)/a).add(r),this.center.copy(X2),this.radius=c,this}expand(t){let n=ch.from(t).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(t){this.center.transform(t);let r=Y0(ch,t);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(t){let r=this.distanceTo(t);return r*r}distanceTo(t){let n=ch.from(t).subtract(this.center);return Math.max(0,n.len()-this.radius)}intersectPlane(t){let r=this.center,n=this.radius,o=t.normal.dot(r)+t.distance;return o<-n?"outside":o<n?"intersecting":"inside"}}});var vR,ER,Uf,Gf,zf,TR,IR,to,eo,Z2=w(()=>{jt();wg();vR=new E,ER=new E,Uf=new E,Gf=new E,zf=new E,TR=new E,IR=new E,to={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},eo=class e{constructor(t=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){this.center=new E().from(t),this.halfAxes=new Qr(r)}get halfSize(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new E(t).len(),new E(r).len(),new E(n).len()]}clone(){return new e(this.center,this.halfAxes)}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new en){let r=this.halfAxes,n=r.getColumn(0,Uf),i=r.getColumn(1,Gf),o=r.getColumn(2,zf),s=vR.copy(n).add(i).add(o);return t.center.copy(this.center),t.radius=s.magnitude(),t}intersectPlane(t){let r=this.center,n=t.normal,i=this.halfAxes,o=n.x,s=n.y,a=n.z,c=Math.abs(o*i[to.COLUMN0ROW0]+s*i[to.COLUMN0ROW1]+a*i[to.COLUMN0ROW2])+Math.abs(o*i[to.COLUMN1ROW0]+s*i[to.COLUMN1ROW1]+a*i[to.COLUMN1ROW2])+Math.abs(o*i[to.COLUMN2ROW0]+s*i[to.COLUMN2ROW1]+a*i[to.COLUMN2ROW2]),l=n.dot(r)+t.distance;return l<=-c?"outside":l>=c?"inside":"intersecting"}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=ER.from(t).subtract(this.center),n=this.halfAxes,i=n.getColumn(0,Uf),o=n.getColumn(1,Gf),s=n.getColumn(2,zf),a=i.magnitude(),c=o.magnitude(),l=s.magnitude();i.normalize(),o.normalize(),s.normalize();let h=0,u;return u=Math.abs(r.dot(i))-a,u>0&&(h+=u*u),u=Math.abs(r.dot(o))-c,u>0&&(h+=u*u),u=Math.abs(r.dot(s))-l,u>0&&(h+=u*u),h}computePlaneDistances(t,r,n=[-0,-0]){let i=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,s=this.center,a=this.halfAxes,c=a.getColumn(0,Uf),l=a.getColumn(1,Gf),h=a.getColumn(2,zf),u=TR.copy(c).add(l).add(h).add(s),f=IR.copy(u).subtract(t),d=r.dot(f);return i=Math.min(d,i),o=Math.max(d,o),u.copy(s).add(c).add(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),u.copy(s).add(c).subtract(l).add(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),u.copy(s).add(c).subtract(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),s.copy(u).subtract(c).add(l).add(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),s.copy(u).subtract(c).add(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),s.copy(u).subtract(c).subtract(l).add(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),s.copy(u).subtract(c).subtract(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),n[0]=i,n[1]=o,n}transform(t){this.center.transformAsPoint(t);let r=this.halfAxes.getColumn(0,Uf);r.transformAsPoint(t);let n=this.halfAxes.getColumn(1,Gf);n.transformAsPoint(t);let i=this.halfAxes.getColumn(2,zf);return i.transformAsPoint(t),this.halfAxes=new Qr([...r,...n,...i]),this}getTransform(){throw new Error("not implemented")}}});var J2,Q2,Ye,_g=w(()=>{jt();J2=new E,Q2=new E,Ye=class e{constructor(t=[0,0,1],r=0){this.normal=new E,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return pr(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=J2.from(t),this.normal.from(r).normalize();let n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,r,n,i){return this.normal.set(t,r,n),pr(Go(this.normal.len(),1)),this.distance=i,this}clone(){return new e(this.normal,this.distance)}equals(t){return Go(this.distance,t.distance)&&Go(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let r=Q2.copy(this.normal).transformAsVector(t).normalize(),n=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(n,r)}projectPointOntoPlane(t,r=[0,0,0]){let n=J2.from(t),i=this.getPointDistance(n),o=Q2.copy(this.normal).scale(i);return n.subtract(o).to(r)}intersectWithRay(t,r=new E){let n=t.origin,i=t.direction,o=this.normal,s=o.dot(i);if(Math.abs(s)<we.EPSILON15)return;let a=(-this.distance-o.dot(n))/s;if(!(a<0))return r.copy(i).multiplyByScalar(a).add(n)}}});var tb,eb,AR,sr,rb=w(()=>{jt();_g();tb=[new E([1,0,0]),new E([0,1,0]),new E([0,0,1])],eb=new E,AR=new E,sr=class e{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*tb.length;let r=t.center,n=t.radius,i=0;for(let o of tb){let s=this.planes[i],a=this.planes[i+1];s||(s=this.planes[i]=new Ye),a||(a=this.planes[i+1]=new Ye);let c=eb.copy(o).scale(-n).add(r);s.fromPointNormal(c,o);let l=eb.copy(o).scale(n).add(r),h=AR.copy(o).negate();a.fromPointNormal(l,h),i+=2}return this}computeVisibility(t){let r="inside";for(let n of this.planes)switch(t.intersectPlane(n)){case"outside":return"outside";case"intersecting":r="intersecting";break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(pr(Number.isFinite(r),"parentPlaneMask is required."),r===e.MASK_OUTSIDE||r===e.MASK_INSIDE)return r;let n=e.MASK_INSIDE,i=this.planes;for(let o=0;o<this.planes.length;++o){let s=o<31?1<<o:0;if(o<31&&(r&s)===0)continue;let a=i[o],c=t.intersectPlane(a);if(c==="outside")return e.MASK_OUTSIDE;c==="intersecting"&&(n|=s)}return n}};sr.MASK_OUTSIDE=4294967295;sr.MASK_INSIDE=0;sr.MASK_INDETERMINATE=2147483647});var ro=w(()=>{wg();Z2();rb();_g()});function Mg(e,t,r){let n=nb*e,i=nb*t,o=n-(n-e),s=e-o,a=i-(i-t),c=t-a;return o*a-r+o*c+s*a+s*c}function ib(e,t,r){let n=r-e;return e-(r-n)+(t-n)}function PR(e){return 2**Math.min(1023,Math.floor(Math.log2(e)))}function bg(e,t,r,n,i,o){let s=Math.max(Math.abs(e),Math.abs(t),Math.abs(r));if(s===0)return 0;let a=PR(s),c=e/a,l=t/a,h=r/a,u=c*n,f=l*i,d=h*o,m=u+f,p=m+d;return(p+(ib(u,f,m)+ib(m,d,p)+Mg(c,n,u)+Mg(l,i,f)+Mg(h,o,d)))*a}function ob(e,t,r,n,i,o,s){let c=(s?[s,s,s,s,0,0,0,1,0,0,0,1,1,0,0,o[0],o[1]]:[...e,...t,...r,...n,...i,...o]).map(A=>{let[S,v=""]=Math.abs(A).toString(2).split(".");return(A<0?-1n:1n)*BigInt("0b"+S+v)<<BigInt(1074-v.length)}),l=1n<<1074n,h=1n<<64n,u=[c[1]*c[2],c[0]*c[2],c[0]*c[1]],f=[0,1,2].map(A=>(c[3+A]*l+c[6+A]*c[15]+c[9+A]*c[16])*u[A]),d=c.slice(12,15).map((A,S)=>A*u[S]),m=(A,S)=>A.reduce((v,N,B)=>v+N*S[B],0n),p=m(d,d),g=m(d,f),y=m(f,f)-(c[0]*c[1]*c[2]*l)**2n,_=g*g-p*y;if(p===0n||_<0n)return;let b=_<<128n,M=b===0n?0n:1n<<BigInt(Math.ceil(b.toString(2).length/2));if(M)for(;;){let A=M+b/M>>1n;if(A>=M)break;M=A}let T=f.map((A,S)=>RR(A*p*h+d[S]*(M-g*h),p*h*u[S]));return s?T.map((A,S)=>r[S]*T[1]+n[S]*T[2]+i[S]*T[0]):T}function RR(e,t){return Math.sign(Number(e))*pg(e<0n?-e:e,t,-2148)}var nb,sb=w(()=>{gg();nb=134217729});function Vf(e,t){if(e.length!==t)throw new RangeError(`Expected ${t} finite coordinates`);for(let r=0;r<t;r++)if(!Number.isFinite(e[r]))throw new RangeError(`Expected ${t} finite coordinates`)}function ab(e){if(e!=="normal"&&e!=="radial")throw new RangeError("Invalid tangent-plane mode")}function cb(e,t,r,n,i,o){let s=t*e.xAxis[0]+r*e.xAxis[1]+n*e.xAxis[2],a=t*e.yAxis[0]+r*e.yAxis[1]+n*e.yAxis[2];if(o!==void 0&&Math.abs((s/o)**2+(a/o)**2-1)<=32*Number.EPSILON&&(s=bg(t,r,n,e.xAxis[0],e.xAxis[1],e.xAxis[2]),a=bg(t,r,n,e.yAxis[0],e.yAxis[1],e.yAxis[2])),!(!Number.isFinite(s)||!Number.isFinite(a)))return i.set(s,a)}function xg(e,t,r,n){if([e,t,r].every(Number.isFinite))return n.set(e,t,r)}var kf,lb=w(()=>{jt();ro();Ff();sb();kf=class{constructor(t,r=pt.WGS84){if(Vf(t,3),this.radii=Object.freeze(Array.from(r.radii)),this.radii[0]===this.radii[1]&&this.radii[1]===this.radii[2]&&(this.radius=this.radii[0]),!this.radii.every(s=>s>0&&Number.isFinite(s)))throw new RangeError("Tangent plane requires positive finite ellipsoid radii");let n=r.scaleToGeodeticSurface(Array.from(t),new E);if(!n)throw new RangeError("Origin has no unique ellipsoid surface point");this.anchor=new E(n);let i=new E(r.geodeticSurfaceNormal(n));if(!i.every(Number.isFinite)||!(i.len()>0))throw new RangeError("Cannot resolve tangent-plane normal");i.normalize();let o=Math.hypot(i[0],i[1]);this.east=o>0?new E(-i[1]/o,i[0]/o,0):new E(0,1,0),this.north=new E(i).cross(this.east).normalize(),this._plane=new Ye().fromPointNormal(this.anchor,i)}projectPointToNearestOnPlane(t,r=new Jr){Vf(t,3);let n=t[0]-this.anchor[0],i=t[1]-this.anchor[1],o=t[2]-this.anchor[2],s=cb(this,n,i,o,r,this.radius);if(!s)throw new RangeError("Tangent-plane projection overflow");return s}projectPointRadiallyOntoPlane(t,r=new Jr){Vf(t,3);let n=Math.max(Math.abs(t[0]),Math.abs(t[1]),Math.abs(t[2]));if(n===0)return;let i=t[0]/n,o=t[1]/n,s=t[2]/n,a=Math.hypot(i,o,s),c=i/a,l=o/a,h=s/a,u=this.zAxis,f=c*u[0]+l*u[1]+h*u[2];if(f<=1e-14)return;let d=this.anchor.dot(u)/f;return cb(this,c*d-this.anchor[0],l*d-this.anchor[1],h*d-this.anchor[2],r,this.radius)}projectPointOntoEllipsoid(t,r="radial",n=new E){Vf(t,2),ab(r);let[i,o,s]=this.radii;if(r==="radial"){let v=Math.max(Math.abs(this.anchor[0]),Math.abs(this.anchor[1]),Math.abs(this.anchor[2]),Math.abs(t[0]),Math.abs(t[1])),N=t[0]/v,B=t[1]/v,C=this.anchor[0]/v+this.east[0]*N+this.north[0]*B,R=this.anchor[1]/v+this.east[1]*N+this.north[1]*B,W=this.anchor[2]/v+this.east[2]*N+this.north[2]*B,j=Math.min(i,o,s),I=C*(j/i),P=R*(j/o),D=W*(j/s),F=Math.hypot(I,P,D);return F>0&&Number.isFinite(F)?xg(i*(I/F),o*(P/F),s*(D/F),n):void 0}let a=this.zAxis,c=[this.anchor[0]+this.east[0]*t[0]+this.north[0]*t[1],this.anchor[1]+this.east[1]*t[0]+this.north[1]*t[1],this.anchor[2]+this.east[2]*t[0]+this.north[2]*t[1]];if(!c.every(Number.isFinite))return;let l=a[0]/i,h=a[1]/o,u=a[2]/s,f=c[0]/i,d=c[1]/o,m=c[2]/s,p=l*l+h*h+u*u,g=l*f+h*d+u*m,y=f*f+d*d+m*m-1,_=g*g,b=p*y,M=1e-6*(Math.abs(_)+Math.abs(b)),T=_-b;if(!(p>0)||!Number.isFinite(T)||Math.abs(T)<=M){let v=ob(this.radii,this.anchor,this.east,this.north,a,t,this.radius);return v&&xg(v[0],v[1],v[2],n)}if(T<0)return;let A=Math.sqrt(Math.max(0,T)),S=g>0?-y/(g+A):(-g+A)/p;return xg(c[0]+S*a[0],c[1]+S*a[1],c[2]+S*a[2],n)}projectPointsFlat(t,r="normal",n){if(ab(r),t.length%3)throw new RangeError("Expected packed XYZ coordinates");let i=t.length/3,o=n||new Float64Array(i*2);if(o.length!==i*2)throw new RangeError("Invalid tangent-plane output length");if(ArrayBuffer.isView(t)&&t.buffer===o.buffer&&t.byteOffset<o.byteOffset+o.byteLength&&o.byteOffset<t.byteOffset+t.byteLength)throw new RangeError("Input and output buffers must not overlap");for(let l=0;l<t.length;l++)if(!Number.isFinite(t[l]))throw new RangeError("Expected finite coordinates");let s=new Uint8Array(i),a=new E,c=new Jr;for(let l=0;l<i;l++){a.set(t[l*3],t[l*3+1],t[l*3+2]);let h=r==="normal"?this.projectPointToNearestOnPlane(a,c):this.projectPointRadiallyOntoPlane(a,c);s[l]=h?1:0,o[l*2]=h?h[0]:NaN,o[l*2+1]=h?h[1]:NaN}return{positions:o,valid:s}}get plane(){return this._plane}get origin(){return this.anchor}get xAxis(){return this.east}get yAxis(){return this.north}get zAxis(){return this._plane.normal}}});var Ve,hb=w(()=>{Ve={};Ve.Constants={};Ve.Math={};Ve.Accumulator={};(function(e){"use strict";e.WGS84={a:6378137,f:1/298.257223563},e.version={major:2,minor:2,patch:0},e.version_string="2.2.0"})(Ve.Constants);(function(e){"use strict";e.digits=53,e.epsilon=Math.pow(.5,e.digits-1),e.degree=Math.PI/180,e.sq=function(t){return t*t},e.hypot=function(t,r){return Math.sqrt(t*t+r*r)},e.cbrt=Math.cbrt||function(t){var r=Math.pow(Math.abs(t),.3333333333333333);return t>0?r:t<0?-r:t},e.log1p=Math.log1p||function(t){var r=1+t,n=r-1;return n===0?t:t*Math.log(r)/n},e.atanh=Math.atanh||function(t){var r=Math.abs(t);return r=e.log1p(2*r/(1-r))/2,t>0?r:t<0?-r:t},e.copysign=function(t,r){return Math.abs(t)*(r<0||r===0&&1/r<0?-1:1)},e.sum=function(t,r){var n=t+r,i=n-r,o=n-i,s;return i-=t,o-=r,s=n&&0-(i+o),{s:n,t:s}},e.polyval=function(t,r,n,i){for(var o=t<0?0:r[n++];--t>=0;)o=o*i+r[n++];return o},e.AngRound=function(t){var r=.0625,n=Math.abs(t);return n=n<r?r-(r-n):n,e.copysign(n,t)},e.remainder=function(t,r){return t%=r,t<-r/2?t+r:t<r/2?t:t-r},e.AngNormalize=function(t){var r=e.remainder(t,360);return Math.abs(r)===180?e.copysign(180,t):r},e.LatFix=function(t){return Math.abs(t)>90?NaN:t},e.AngDiff=function(t,r){var n=e.sum(e.remainder(-t,360),e.remainder(r,360)),i,o;return n=e.sum(e.remainder(n.s,360),n.t),i=n.s,o=n.t,(i===0||Math.abs(i)===180)&&(i=e.copysign(i,o===0?r-t:-o)),{d:i,e:o}},e.sincosd=function(t){var r,n,i,o,s,a,c;switch(r=t%360,i=Math.round(r/90),r-=90*i,n=r*this.degree,o=Math.sin(n),s=Math.cos(n),Math.abs(r)===45?(s=Math.sqrt(.5),o=e.copysign(s,n)):Math.abs(r)===30&&(s=Math.sqrt(.75),o=e.copysign(.5,n)),i&3){case 0:a=o,c=s;break;case 1:a=s,c=-o;break;case 2:a=-o,c=-s;break;default:a=-s,c=o;break}return c+=0,a===0&&(a=e.copysign(a,t)),{s:a,c}},e.sincosde=function(t,r){var n,i,o,s,a,c,l;switch(n=t%360,o=Math.round(n/90),n=e.AngRound(n-90*o+r),i=n*this.degree,s=Math.sin(i),a=Math.cos(i),Math.abs(n)===45?(a=Math.sqrt(.5),s=e.copysign(a,i)):Math.abs(n)===30&&(a=Math.sqrt(.75),s=e.copysign(.5,i)),o&3){case 0:c=s,l=a;break;case 1:c=a,l=-s;break;case 2:c=-s,l=-a;break;default:c=-a,l=s;break}return l+=0,c===0&&(c=e.copysign(c,t+r)),{s:c,c:l}},e.atan2d=function(t,r){var n=0,i;switch(Math.abs(t)>Math.abs(r)&&([t,r]=[r,t],n=2),e.copysign(1,r)<0&&(r=-r,++n),i=Math.atan2(t,r)/this.degree,n){case 1:i=e.copysign(180,t)-i;break;case 2:i=90-i;break;case 3:i=-90+i;break;default:break}return i}})(Ve.Math);(function(e,t){"use strict";e.Accumulator=function(r){this.Set(r)},e.Accumulator.prototype.Set=function(r){r||(r=0),r.constructor===e.Accumulator?(this._s=r._s,this._t=r._t):(this._s=r,this._t=0)},e.Accumulator.prototype.Add=function(r){var n=t.sum(r,this._t),i=t.sum(n.s,this._s);n=n.t,this._s=i.s,this._t=i.t,this._s===0?this._s=n:this._t+=n},e.Accumulator.prototype.Sum=function(r){var n;return r?(n=new e.Accumulator(this),n.Add(r),n._s):this._s},e.Accumulator.prototype.Negate=function(){this._s*=-1,this._t*=-1},e.Accumulator.prototype.Remainder=function(r){this._s=t.remainder(this._s,r),this.Add(0)}})(Ve.Accumulator,Ve.Math);Ve.Geodesic={};Ve.GeodesicLine={};Ve.PolygonArea={};(function(e,t,r,n,i){"use strict";var o=6,s=o,a=o,c=o,l=c,h,u,f=20,d=f+n.digits+10,m=n.epsilon,p=200*m,g=Math.sqrt(m),y=m,_=1e3*g,b=0,M=31,T=32640,A,S,v,N,B,C,R,W,j;e.tiny_=Math.sqrt(Number.MIN_VALUE/Number.EPSILON),e.nC1_=o,e.nC1p_=o,e.nC2_=o,e.nC3_=o,e.nC4_=o,h=e.nC3_*(e.nC3_-1)/2,u=e.nC4_*(e.nC4_+1)/2,e.CAP_C1=1,e.CAP_C1p=2,e.CAP_C2=4,e.CAP_C3=8,e.CAP_C4=16,e.NONE=0,e.ARC=64,e.LATITUDE=128|b,e.LONGITUDE=256|e.CAP_C3,e.AZIMUTH=512|b,e.DISTANCE=1024|e.CAP_C1,e.STANDARD=e.LATITUDE|e.LONGITUDE|e.AZIMUTH|e.DISTANCE,e.DISTANCE_IN=2048|e.CAP_C1|e.CAP_C1p,e.REDUCEDLENGTH=4096|e.CAP_C1|e.CAP_C2,e.GEODESICSCALE=8192|e.CAP_C1|e.CAP_C2,e.AREA=16384|e.CAP_C4,e.ALL=T|M,e.LONG_UNROLL=32768,e.OUT_MASK=T|e.LONG_UNROLL,e.SinCosSeries=function(I,P,D,F,L){if(L!==void 0){var O=L/2,V=Math.sin(O),yt=Math.cos(O);return-2*e.SinCosSeries(!1,D*yt-P*V,P*yt+D*V,F.map(function(St,k){return(k%2?-St:St)*Math.sin((2*k+1)*O)}))}var Dt=F.length,X=Dt-(I?1:0),xt=2*(D-P)*(D+P),et=X&1?F[--Dt]:0,dt=0;for(X=Math.floor(X/2);X--;)dt=xt*et-dt+F[--Dt],et=xt*dt-et+F[--Dt];return I?2*P*D*et:D*(et-dt)},A=function(I,P){var D,F=n.sq(I),L=n.sq(P),O=(F+L-1)/6,V,yt,Dt,X,xt,et,dt,St,k,Rt,zt;return L===0&&O<=0?D=0:(V=F*L/4,yt=n.sq(O),Dt=O*yt,X=V*(V+2*Dt),xt=O,X>=0?(et=V+Dt,et+=et<0?-Math.sqrt(X):Math.sqrt(X),dt=n.cbrt(et),xt+=dt+(dt!==0?yt/dt:0)):(St=Math.atan2(Math.sqrt(-X),-(V+Dt)),xt+=2*O*Math.cos(St/3)),k=Math.sqrt(n.sq(xt)+L),Rt=xt<0?L/(k-xt):xt+k,zt=(Rt-L)/(2*k),D=Rt/(Math.sqrt(Rt+n.sq(zt))+zt)),D},S=[1,4,64,0,256],e.A1m1f=function(I){var P=Math.floor(s/2),D=n.polyval(P,S,0,n.sq(I))/S[P+1];return(D+I)/(1-I)},v=[-1,6,-16,32,-9,64,-128,2048,9,-16,768,3,-5,512,-7,1280,-7,2048],e.C1f=function(I,P){var D=n.sq(I),F=I,L=0,O,V;for(O=1;O<=e.nC1_;++O)V=Math.floor((e.nC1_-O)/2),P[O]=F*n.polyval(V,v,L,D)/v[L+V+1],L+=V+2,F*=I},N=[205,-432,768,1536,4005,-4736,3840,12288,-225,116,384,-7173,2695,7680,3467,7680,38081,61440],e.C1pf=function(I,P){var D=n.sq(I),F=I,L=0,O,V;for(O=1;O<=e.nC1p_;++O)V=Math.floor((e.nC1p_-O)/2),P[O]=F*n.polyval(V,N,L,D)/N[L+V+1],L+=V+2,F*=I},B=[-11,-28,-192,0,256],e.A2m1f=function(I){var P=Math.floor(a/2),D=n.polyval(P,B,0,n.sq(I))/B[P+1];return(D-I)/(1+I)},C=[1,2,16,32,35,64,384,2048,15,80,768,7,35,512,63,1280,77,2048],e.C2f=function(I,P){var D=n.sq(I),F=I,L=0,O,V;for(O=1;O<=e.nC2_;++O)V=Math.floor((e.nC2_-O)/2),P[O]=F*n.polyval(V,C,L,D)/C[L+V+1],L+=V+2,F*=I},e.Geodesic=function(I,P){if(this.a=I,this.f=P,this._f1=1-this.f,this._e2=this.f*(2-this.f),this._ep2=this._e2/n.sq(this._f1),this._n=this.f/(2-this.f),this._b=this.a*this._f1,this._c2=(n.sq(this.a)+n.sq(this._b)*(this._e2===0?1:(this._e2>0?n.atanh(Math.sqrt(this._e2)):Math.atan(Math.sqrt(-this._e2)))/Math.sqrt(Math.abs(this._e2))))/2,this._etol2=.1*g/Math.sqrt(Math.max(.001,Math.abs(this.f))*Math.min(1,1-this.f/2)/2),!(isFinite(this.a)&&this.a>0))throw new Error("Equatorial radius is not positive");if(!(isFinite(this._b)&&this._b>0))throw new Error("Polar semi-axis is not positive");this._A3x=new Array(l),this._C3x=new Array(h),this._C4x=new Array(u),this.A3coeff(),this.C3coeff(),this.C4coeff()},R=[-3,128,-2,-3,64,-1,-3,-1,16,3,-1,-2,8,1,-1,2,1,1],e.Geodesic.prototype.A3coeff=function(){var I=0,P=0,D,F;for(D=c-1;D>=0;--D)F=Math.min(c-D-1,D),this._A3x[P++]=n.polyval(F,R,I,this._n)/R[I+F+1],I+=F+2},W=[3,128,2,5,128,-1,3,3,64,-1,0,1,8,-1,1,4,5,256,1,3,128,-3,-2,3,64,1,-3,2,32,7,512,-10,9,384,5,-9,5,192,7,512,-14,7,512,21,2560],e.Geodesic.prototype.C3coeff=function(){var I=0,P=0,D,F,L;for(D=1;D<e.nC3_;++D)for(F=e.nC3_-1;F>=D;--F)L=Math.min(e.nC3_-F-1,F),this._C3x[P++]=n.polyval(L,W,I,this._n)/W[I+L+1],I+=L+2},j=[97,15015,1088,156,45045,-224,-4784,1573,45045,-10656,14144,-4576,-858,45045,64,624,-4576,6864,-3003,15015,100,208,572,3432,-12012,30030,45045,1,9009,-2944,468,135135,5792,1040,-1287,135135,5952,-11648,9152,-2574,135135,-64,-624,4576,-6864,3003,135135,8,10725,1856,-936,225225,-8448,4992,-1144,225225,-1440,4160,-4576,1716,225225,-136,63063,1024,-208,105105,3584,-3328,1144,315315,-128,135135,-2560,832,405405,128,99099],e.Geodesic.prototype.C4coeff=function(){var I=0,P=0,D,F,L;for(D=0;D<e.nC4_;++D)for(F=e.nC4_-1;F>=D;--F)L=e.nC4_-F-1,this._C4x[P++]=n.polyval(L,j,I,this._n)/j[I+L+1],I+=L+2},e.Geodesic.prototype.A3f=function(I){return n.polyval(l-1,this._A3x,0,I)},e.Geodesic.prototype.C3f=function(I,P){var D=1,F=0,L,O;for(L=1;L<e.nC3_;++L)O=e.nC3_-L-1,D*=I,P[L]=D*n.polyval(O,this._C3x,F,I),F+=O+1},e.Geodesic.prototype.C4f=function(I,P){var D=1,F=0,L,O;for(L=0;L<e.nC4_;++L)O=e.nC4_-L-1,P[L]=D*n.polyval(O,this._C4x,F,I),F+=O+1,D*=I},e.Geodesic.prototype.Lengths=function(I,P,D,F,L,O,V,yt,Dt,X,xt,et,dt){xt&=e.OUT_MASK;var St={},k=0,Rt=0,zt=0,Wt=0,ee,Jt,ye,Be,Ue;if(xt&(e.DISTANCE|e.REDUCEDLENGTH|e.GEODESICSCALE)&&(zt=e.A1m1f(I),e.C1f(I,et),xt&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(Wt=e.A2m1f(I),e.C2f(I,dt),k=zt-Wt,Wt=1+Wt),zt=1+zt),xt&e.DISTANCE)ee=e.SinCosSeries(!0,O,V,et)-e.SinCosSeries(!0,D,F,et),St.s12b=zt*(P+ee),xt&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(Jt=e.SinCosSeries(!0,O,V,dt)-e.SinCosSeries(!0,D,F,dt),Rt=k*P+(zt*ee-Wt*Jt));else if(xt&(e.REDUCEDLENGTH|e.GEODESICSCALE)){for(ye=1;ye<=e.nC2_;++ye)dt[ye]=zt*et[ye]-Wt*dt[ye];Rt=k*P+(e.SinCosSeries(!0,O,V,dt)-e.SinCosSeries(!0,D,F,dt))}return xt&e.REDUCEDLENGTH?(St.m0=k,St.m12b=yt*(F*O)-L*(D*V)-F*V*Rt):St.m12b=NaN,xt&e.GEODESICSCALE&&(Be=F*V+D*O,Ue=this._ep2*(Dt-X)*(Dt+X)/(L+yt),St.M12=Be+(Ue*O-V*Rt)*D/L,St.M21=Be-(Ue*D-F*Rt)*O/yt),St},e.Geodesic.prototype.InverseStart=function(I,P,D,F,L,O,V,yt,Dt,X,xt){var et={},dt=F*P-L*I,St=L*P+F*I,k,Rt,zt,Wt,ee,Jt,ye,Be,Ue,Ft,Ot,Ut,Le,Qe,Fo,Uo,$l,Ii,Kt,Or,or,Xr,pn;return et.sig12=-1,k=F*P,k+=L*I,Rt=St>=0&&dt<.5&&L*V<.5,Rt?(Wt=n.sq(I+F),Wt/=Wt+n.sq(P+L),et.dnm=Math.sqrt(1+this._ep2*Wt),zt=V/(this._f1*et.dnm),ee=Math.sin(zt),Jt=Math.cos(zt)):(ee=yt,Jt=Dt),et.salp1=L*ee,et.calp1=Jt>=0?dt+L*I*n.sq(ee)/(1+Jt):k-L*I*n.sq(ee)/(1-Jt),Be=n.hypot(et.salp1,et.calp1),Ue=I*F+P*L*Jt,Rt&&Be<this._etol2?(et.salp2=P*ee,et.calp2=dt-P*F*(Jt>=0?n.sq(ee)/(1+Jt):1-Jt),ye=n.hypot(et.salp2,et.calp2),et.salp2/=ye,et.calp2/=ye,et.sig12=Math.atan2(Be,Ue)):Math.abs(this._n)>.1||Ue>=0||Be>=6*Math.abs(this._n)*Math.PI*n.sq(P)||(pn=Math.atan2(-yt,-Dt),this.f>=0?(Qe=n.sq(I)*this._ep2,Fo=Qe/(2*(1+Math.sqrt(1+Qe))+Qe),Ut=this.f*P*this.A3f(Fo)*Math.PI,Le=Ut*P,Ft=pn/Ut,Ot=k/Le):(Uo=L*P-F*I,$l=Math.atan2(k,Uo),Or=this.Lengths(this._n,Math.PI+$l,I,-P,D,F,L,O,P,L,e.REDUCEDLENGTH,X,xt),Ii=Or.m12b,Kt=Or.m0,Ft=-1+Ii/(P*L*Kt*Math.PI),Le=Ft<-.01?k/Ft:-this.f*n.sq(P)*Math.PI,Ut=Le/P,Ot=V/Ut),Ot>-p&&Ft>-1-_?this.f>=0?(et.salp1=Math.min(1,-Ft),et.calp1=-Math.sqrt(1-n.sq(et.salp1))):(et.calp1=Math.max(Ft>-p?0:-1,Ft),et.salp1=Math.sqrt(1-n.sq(et.calp1))):(or=A(Ft,Ot),Xr=Ut*(this.f>=0?-Ft*or/(1+or):-Ot*(1+or)/or),ee=Math.sin(Xr),Jt=-Math.cos(Xr),et.salp1=L*ee,et.calp1=k-L*I*n.sq(ee)/(1-Jt))),et.salp1<=0?(et.salp1=1,et.calp1=0):(ye=n.hypot(et.salp1,et.calp1),et.salp1/=ye,et.calp1/=ye),et},e.Geodesic.prototype.Lambda12=function(I,P,D,F,L,O,V,yt,Dt,X,xt,et,dt,St){var k={},Rt,zt,Wt,ee,Jt,ye,Be,Ue,Ft,Ot,Ut,Le,Qe;return I===0&&yt===0&&(yt=-e.tiny_),zt=V*P,Wt=n.hypot(yt,V*I),k.ssig1=I,ee=zt*I,k.csig1=Jt=yt*P,Rt=n.hypot(k.ssig1,k.csig1),k.ssig1/=Rt,k.csig1/=Rt,k.salp2=L!==P?zt/L:V,k.calp2=L!==P||Math.abs(F)!==-I?Math.sqrt(n.sq(yt*P)+(P<-I?(L-P)*(P+L):(I-F)*(I+F)))/L:Math.abs(yt),k.ssig2=F,ye=zt*F,k.csig2=Be=k.calp2*L,Rt=n.hypot(k.ssig2,k.csig2),k.ssig2/=Rt,k.csig2/=Rt,k.sig12=Math.atan2(Math.max(0,k.csig1*k.ssig2-k.ssig1*k.csig2),k.csig1*k.csig2+k.ssig1*k.ssig2),Ue=Math.max(0,Jt*ye-ee*Be),Ft=Jt*Be+ee*ye,Ut=Math.atan2(Ue*X-Ft*Dt,Ft*X+Ue*Dt),Le=n.sq(Wt)*this._ep2,k.eps=Le/(2*(1+Math.sqrt(1+Le))+Le),this.C3f(k.eps,St),Ot=e.SinCosSeries(!0,k.ssig2,k.csig2,St)-e.SinCosSeries(!0,k.ssig1,k.csig1,St),k.domg12=-this.f*this.A3f(k.eps)*zt*(k.sig12+Ot),k.lam12=Ut+k.domg12,xt&&(k.calp2===0?k.dlam12=-2*this._f1*D/I:(Qe=this.Lengths(k.eps,k.sig12,k.ssig1,k.csig1,D,k.ssig2,k.csig2,O,P,L,e.REDUCEDLENGTH,et,dt),k.dlam12=Qe.m12b,k.dlam12*=this._f1/(k.calp2*L))),k},e.Geodesic.prototype.Inverse=function(I,P,D,F,L){var O,V;return L||(L=e.STANDARD),L===e.LONG_UNROLL&&(L|=e.STANDARD),L&=e.OUT_MASK,O=this.InverseInt(I,P,D,F,L),V=O.vals,L&e.AZIMUTH&&(V.azi1=n.atan2d(O.salp1,O.calp1),V.azi2=n.atan2d(O.salp2,O.calp2)),V},e.Geodesic.prototype.InverseInt=function(I,P,D,F,L){var O={},V,yt,Dt,X,xt,et,dt,St,k,Rt,zt,Wt,ee,Jt,ye,Be,Ue,Ft,Ot,Ut,Le,Qe,Fo,Uo,$l,Ii,Kt,Or,or,Xr,pn,Qu,tf,bc,la,Yl,Kl,Xl,Zl,ef,f0,xc,d0,rf,m0,p0,g0,SM,y0,nf,w0,of,vM,Jl,EM,TM,Ql,sf,th,_0,M0,af,cf,b0,x0;if(O.lat1=I=n.LatFix(I),O.lat2=D=n.LatFix(D),I=n.AngRound(I),D=n.AngRound(D),V=n.AngDiff(P,F),yt=V.e,V=V.d,L&e.LONG_UNROLL?(O.lon1=P,O.lon2=P+V+yt):(O.lon1=n.AngNormalize(P),O.lon2=n.AngNormalize(F)),Dt=n.copysign(1,V),V*=Dt,yt*=Dt,ye=V*n.degree,X=n.sincosde(V,yt),Be=X.s,Ue=X.c,yt=180-V-yt,xt=Math.abs(I)<Math.abs(D)||isNaN(D)?-1:1,xt<0&&(Dt*=-1,[D,I]=[I,D]),et=n.copysign(1,-I),I*=et,D*=et,X=n.sincosd(I),dt=this._f1*X.s,St=X.c,X=n.hypot(dt,St),dt/=X,St/=X,St=Math.max(e.tiny_,St),X=n.sincosd(D),k=this._f1*X.s,Rt=X.c,X=n.hypot(k,Rt),k/=X,Rt/=X,Rt=Math.max(e.tiny_,Rt),St<-dt?Rt===St&&(k=n.copysign(dt,k)):Math.abs(k)===-dt&&(Rt=St),ee=Math.sqrt(1+this._ep2*n.sq(dt)),Jt=Math.sqrt(1+this._ep2*n.sq(k)),Fo=new Array(e.nC1_+1),Uo=new Array(e.nC2_+1),$l=new Array(e.nC3_),Ii=I===-90||Be===0,Ii&&(Ot=Ue,Ut=Be,Le=1,Qe=0,Or=dt,or=Ot*St,Xr=k,pn=Le*Rt,Ft=Math.atan2(Math.max(0,or*Xr-Or*pn),or*pn+Or*Xr),Kt=this.Lengths(this._n,Ft,Or,or,ee,Xr,pn,Jt,St,Rt,L|e.DISTANCE|e.REDUCEDLENGTH,Fo,Uo),zt=Kt.s12b,Wt=Kt.m12b,L&e.GEODESICSCALE&&(O.M12=Kt.M12,O.M21=Kt.M21),Ft<g||Wt>=0?((Ft<3*e.tiny_||Ft<m&&(zt<0||Wt<0))&&(Ft=Wt=zt=0),Wt*=this._b,zt*=this._b,O.a12=Ft/n.degree):Ii=!1),Ql=2,!Ii&&dt===0&&(this.f<=0||yt>=this.f*180))Ot=Le=0,Ut=Qe=1,zt=this.a*ye,Ft=tf=ye/this._f1,Wt=this._b*Math.sin(Ft),L&e.GEODESICSCALE&&(O.M12=O.M21=Math.cos(Ft)),O.a12=V/this._f1;else if(!Ii)if(Kt=this.InverseStart(dt,St,ee,k,Rt,Jt,ye,Be,Ue,Fo,Uo),Ft=Kt.sig12,Ut=Kt.salp1,Ot=Kt.calp1,Ft>=0)Qe=Kt.salp2,Le=Kt.calp2,bc=Kt.dnm,zt=Ft*this._b*bc,Wt=n.sq(bc)*this._b*Math.sin(Ft/bc),L&e.GEODESICSCALE&&(O.M12=O.M21=Math.cos(Ft/bc)),O.a12=Ft/n.degree,tf=ye/(this._f1*bc);else{for(la=0,Yl=e.tiny_,Kl=1,Xl=e.tiny_,Zl=-1,ef=!1,f0=!1;Kt=this.Lambda12(dt,St,ee,k,Rt,Jt,Ut,Ot,Be,Ue,la<f,Fo,Uo,$l),xc=Kt.lam12,Qe=Kt.salp2,Le=Kt.calp2,Ft=Kt.sig12,Or=Kt.ssig1,or=Kt.csig1,Xr=Kt.ssig2,pn=Kt.csig2,Qu=Kt.eps,th=Kt.domg12,d0=Kt.dlam12,!(f0||!(Math.abs(xc)>=(ef?8:1)*m)||la==d);++la){if(xc>0&&(la<f||Ot/Ut>Zl/Xl)?(Xl=Ut,Zl=Ot):xc<0&&(la<f||Ot/Ut<Kl/Yl)&&(Yl=Ut,Kl=Ot),la<f&&d0>0&&(rf=-xc/d0,Math.abs(rf)<Math.PI&&(m0=Math.sin(rf),p0=Math.cos(rf),g0=Ut*p0+Ot*m0,g0>0))){Ot=Ot*p0-Ut*m0,Ut=g0,X=n.hypot(Ut,Ot),Ut/=X,Ot/=X,ef=Math.abs(xc)<=16*m;continue}Ut=(Yl+Xl)/2,Ot=(Kl+Zl)/2,X=n.hypot(Ut,Ot),Ut/=X,Ot/=X,ef=!1,f0=Math.abs(Yl-Ut)+(Kl-Ot)<y||Math.abs(Ut-Xl)+(Ot-Zl)<y}SM=L|(L&(e.REDUCEDLENGTH|e.GEODESICSCALE)?e.DISTANCE:e.NONE),Kt=this.Lengths(Qu,Ft,Or,or,ee,Xr,pn,Jt,St,Rt,SM,Fo,Uo),zt=Kt.s12b,Wt=Kt.m12b,L&e.GEODESICSCALE&&(O.M12=Kt.M12,O.M21=Kt.M21),Wt*=this._b,zt*=this._b,O.a12=Ft/n.degree,L&e.AREA&&(b0=Math.sin(th),x0=Math.cos(th),Ql=Be*x0-Ue*b0,sf=Ue*x0+Be*b0)}return L&e.DISTANCE&&(O.s12=0+zt),L&e.REDUCEDLENGTH&&(O.m12=0+Wt),L&e.AREA&&(y0=Ut*St,nf=n.hypot(Ot,Ut*dt),nf!==0&&y0!==0?(Or=dt,or=Ot*St,Xr=k,pn=Le*Rt,of=n.sq(nf)*this._ep2,Qu=of/(2*(1+Math.sqrt(1+of))+of),vM=n.sq(this.a)*nf*y0*this._e2,X=n.hypot(Or,or),Or/=X,or/=X,X=n.hypot(Xr,pn),Xr/=X,pn/=X,Jl=new Array(e.nC4_),this.C4f(Qu,Jl),EM=e.SinCosSeries(!1,Or,or,Jl),TM=e.SinCosSeries(!1,Xr,pn,Jl),O.S12=vM*(Ft<.01?e.SinCosSeries(!1,Or,or,Jl,Ft):TM-EM)):O.S12=0,!Ii&&Ql==2&&(Ql=Math.sin(tf),sf=Math.cos(tf)),!Ii&&sf>-.7071&&k-dt<1.75?(th=1+sf,_0=1+St,M0=1+Rt,w0=2*Math.atan2(Ql*(dt*M0+k*_0),th*(dt*k+_0*M0))):(af=Qe*Ot-Le*Ut,cf=Le*Ot+Qe*Ut,af===0&&cf<0&&(af=e.tiny_*Ot,cf=-1),w0=Math.atan2(af,cf)),O.S12+=this._c2*w0,O.S12*=xt*Dt*et,O.S12+=0),xt<0&&([Qe,Ut]=[Ut,Qe],[Le,Ot]=[Ot,Le],L&e.GEODESICSCALE&&([O.M21,O.M12]=[O.M12,O.M21])),Ut*=xt*Dt,Ot*=xt*et,Qe*=xt*Dt,Le*=xt*et,{vals:O,salp1:Ut,calp1:Ot,salp2:Qe,calp2:Le}},e.Geodesic.prototype.GenDirect=function(I,P,D,F,L,O){var V;return O?O===e.LONG_UNROLL&&(O|=e.STANDARD):O=e.STANDARD,F||(O|=e.DISTANCE_IN),V=new t.GeodesicLine(this,I,P,D,O),V.GenPosition(F,L,O)},e.Geodesic.prototype.Direct=function(I,P,D,F,L){return this.GenDirect(I,P,D,!1,F,L)},e.Geodesic.prototype.ArcDirect=function(I,P,D,F,L){return this.GenDirect(I,P,D,!0,F,L)},e.Geodesic.prototype.Line=function(I,P,D,F){return new t.GeodesicLine(this,I,P,D,F)},e.Geodesic.prototype.DirectLine=function(I,P,D,F,L){return this.GenDirectLine(I,P,D,!1,F,L)},e.Geodesic.prototype.ArcDirectLine=function(I,P,D,F,L){return this.GenDirectLine(I,P,D,!0,F,L)},e.Geodesic.prototype.GenDirectLine=function(I,P,D,F,L,O){var V;return O||(O=e.STANDARD|e.DISTANCE_IN),F||(O|=e.DISTANCE_IN),V=new t.GeodesicLine(this,I,P,D,O),V.GenSetDistance(F,L),V},e.Geodesic.prototype.InverseLine=function(I,P,D,F,L){var O,V,yt;return L||(L=e.STANDARD|e.DISTANCE_IN),O=this.InverseInt(I,P,D,F,e.ARC),yt=n.atan2d(O.salp1,O.calp1),L&(e.OUT_MASK&e.DISTANCE_IN)&&(L|=e.DISTANCE),V=new t.GeodesicLine(this,I,P,yt,L,O.salp1,O.calp1),V.SetArc(O.vals.a12),V},e.Geodesic.prototype.Polygon=function(I){return new r.PolygonArea(this,I)},e.WGS84=new e.Geodesic(i.WGS84.a,i.WGS84.f)})(Ve.Geodesic,Ve.GeodesicLine,Ve.PolygonArea,Ve.Math,Ve.Constants);(function(e,t,r){"use strict";t.GeodesicLine=function(n,i,o,s,a,c,l){var h,u,f,d,m,p;a||(a=e.STANDARD|e.DISTANCE_IN),this.a=n.a,this.f=n.f,this._b=n._b,this._c2=n._c2,this._f1=n._f1,this.caps=a|e.LATITUDE|e.AZIMUTH|e.LONG_UNROLL,this.lat1=r.LatFix(i),this.lon1=o,typeof c>"u"||typeof l>"u"?(this.azi1=r.AngNormalize(s),h=r.sincosd(r.AngRound(this.azi1)),this.salp1=h.s,this.calp1=h.c):(this.azi1=s,this.salp1=c,this.calp1=l),h=r.sincosd(r.AngRound(this.lat1)),f=this._f1*h.s,u=h.c,h=r.hypot(f,u),f/=h,u/=h,u=Math.max(e.tiny_,u),this._dn1=Math.sqrt(1+n._ep2*r.sq(f)),this._salp0=this.salp1*u,this._calp0=r.hypot(this.calp1,this.salp1*f),this._ssig1=f,this._somg1=this._salp0*f,this._csig1=this._comg1=f!==0||this.calp1!==0?u*this.calp1:1,h=r.hypot(this._ssig1,this._csig1),this._ssig1/=h,this._csig1/=h,this._k2=r.sq(this._calp0)*n._ep2,d=this._k2/(2*(1+Math.sqrt(1+this._k2))+this._k2),this.caps&e.CAP_C1&&(this._A1m1=e.A1m1f(d),this._C1a=new Array(e.nC1_+1),e.C1f(d,this._C1a),this._B11=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C1a),m=Math.sin(this._B11),p=Math.cos(this._B11),this._stau1=this._ssig1*p+this._csig1*m,this._ctau1=this._csig1*p-this._ssig1*m),this.caps&e.CAP_C1p&&(this._C1pa=new Array(e.nC1p_+1),e.C1pf(d,this._C1pa)),this.caps&e.CAP_C2&&(this._A2m1=e.A2m1f(d),this._C2a=new Array(e.nC2_+1),e.C2f(d,this._C2a),this._B21=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C2a)),this.caps&e.CAP_C3&&(this._C3a=new Array(e.nC3_),n.C3f(d,this._C3a),this._A3c=-this.f*this._salp0*n.A3f(d),this._B31=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C3a)),this.caps&e.CAP_C4&&(this._C4a=new Array(e.nC4_),n.C4f(d,this._C4a),this._A4=r.sq(this.a)*this._calp0*this._salp0*n._e2,this._B41=e.SinCosSeries(!1,this._ssig1,this._csig1,this._C4a)),this.a13=this.s13=NaN},t.GeodesicLine.prototype.GenPosition=function(n,i,o,s={}){var a,c,l,h,u,f,d,m,p,g,y,_,b,M,T,A,S,v,N,B,C,R,W,j,I,P,D,F,L;return o?o===e.LONG_UNROLL&&(o|=e.STANDARD):o=e.STANDARD,o&=this.caps&e.OUT_MASK,s.lat1=this.lat1,s.azi1=this.azi1,s.lon1=o&e.LONG_UNROLL?this.lon1:r.AngNormalize(this.lon1),n?s.a12=i:s.s12=i,n||this.caps&e.DISTANCE_IN&e.OUT_MASK?(h=0,u=0,n?(a=i*r.degree,P=r.sincosd(i),c=P.s,l=P.c):(m=i/(this._b*(1+this._A1m1)),p=Math.sin(m),g=Math.cos(m),h=-e.SinCosSeries(!0,this._stau1*g+this._ctau1*p,this._ctau1*g-this._stau1*p,this._C1pa),a=m-(h-this._B11),c=Math.sin(a),l=Math.cos(a),Math.abs(this.f)>.01&&(f=this._ssig1*l+this._csig1*c,d=this._csig1*l-this._ssig1*c,h=e.SinCosSeries(!0,f,d,this._C1a),y=(1+this._A1m1)*(a+(h-this._B11))-i/this._b,a=a-y/Math.sqrt(1+this._k2*r.sq(f)),c=Math.sin(a),l=Math.cos(a))),f=this._ssig1*l+this._csig1*c,d=this._csig1*l-this._ssig1*c,R=Math.sqrt(1+this._k2*r.sq(f)),o&(e.DISTANCE|e.REDUCEDLENGTH|e.GEODESICSCALE)&&((n||Math.abs(this.f)>.01)&&(h=e.SinCosSeries(!0,f,d,this._C1a)),u=(1+this._A1m1)*(h-this._B11)),A=this._calp0*f,S=r.hypot(this._salp0,this._calp0*d),S===0&&(S=d=e.tiny_),B=this._salp0,C=this._calp0*d,n&&o&e.DISTANCE&&(s.s12=this._b*((1+this._A1m1)*a+u)),o&e.LONGITUDE&&(v=this._salp0*f,N=d,T=r.copysign(1,this._salp0),_=o&e.LONG_UNROLL?T*(a-(Math.atan2(f,d)-Math.atan2(this._ssig1,this._csig1))+(Math.atan2(T*v,N)-Math.atan2(T*this._somg1,this._comg1))):Math.atan2(v*this._comg1-N*this._somg1,N*this._comg1+v*this._somg1),b=_+this._A3c*(a+(e.SinCosSeries(!0,f,d,this._C3a)-this._B31)),M=b/r.degree,s.lon2=o&e.LONG_UNROLL?this.lon1+M:r.AngNormalize(r.AngNormalize(this.lon1)+r.AngNormalize(M))),o&e.LATITUDE&&(s.lat2=r.atan2d(A,this._f1*S)),o&e.AZIMUTH&&(s.azi2=r.atan2d(B,C)),o&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(W=e.SinCosSeries(!0,f,d,this._C2a),j=(1+this._A2m1)*(W-this._B21),I=(this._A1m1-this._A2m1)*a+(u-j),o&e.REDUCEDLENGTH&&(s.m12=this._b*(R*(this._csig1*f)-this._dn1*(this._ssig1*d)-this._csig1*d*I)),o&e.GEODESICSCALE&&(P=this._k2*(f-this._ssig1)*(f+this._ssig1)/(this._dn1+R),s.M12=l+(P*f-d*I)*this._ssig1/this._dn1,s.M21=l-(P*this._ssig1-this._csig1*I)*f/R)),o&e.AREA&&(D=e.SinCosSeries(!1,f,d,this._C4a),this._calp0===0||this._salp0===0?(F=B*this.calp1-C*this.salp1,L=C*this.calp1+B*this.salp1):(F=this._calp0*this._salp0*(l<=0?this._csig1*(1-l)+c*this._ssig1:c*(this._csig1*c/(1+l)+this._ssig1)),L=r.sq(this._salp0)+r.sq(this._calp0)*this._csig1*d),s.S12=this._c2*Math.atan2(F,L)+this._A4*(Math.abs(a)<.01?e.SinCosSeries(!1,this._ssig1,this._csig1,this._C4a,a):D-this._B41)),n||(s.a12=a/r.degree),s):(s.a12=NaN,s)},t.GeodesicLine.prototype.Position=function(n,i){return this.GenPosition(!1,n,i)},t.GeodesicLine.prototype.ArcPosition=function(n,i){return this.GenPosition(!0,n,i)},t.GeodesicLine.prototype.GenSetDistance=function(n,i){n?this.SetArc(i):this.SetDistance(i)},t.GeodesicLine.prototype.SetDistance=function(n){var i;this.s13=n,i=this.GenPosition(!1,this.s13,e.ARC),this.a13=0+i.a12},t.GeodesicLine.prototype.SetArc=function(n){var i;this.a13=n,i=this.GenPosition(!0,this.a13,e.DISTANCE),this.s13=0+i.s12}})(Ve.Geodesic,Ve.GeodesicLine,Ve.Math)});function ub(e){if(!Number.isFinite(e))throw new Error("Nonfinite axis, azimuth, distance or arc")}function fb({semiMajorAxis:e,semiMinorAxis:t}){return ub(e),ub(t),new Sg.Geodesic(e,(e-t)/e)}var Sg,lh,db=w(()=>{hb();Sg=Ve.Geodesic;lh=Sg.ALL&~Sg.AREA});function gb(e,t,r,n,i,o){let s=pb[t]&&pb[t][r];pr(s&&(!n||n===s));let a,c,l,h=NR.copy(i);if(!Number.isFinite(h.x)||!Number.isFinite(h.y)||!Number.isFinite(h.z)||!Array.isArray(o)&&o.length<16)throw new Error("Unsupported local frame");let u=CR*Math.min(1,e.maximumRadius),f=Math.abs(h.x)<=u&&Math.abs(h.y)<=u,d=e.radii;if(d.x===d.y&&d.x>0&&d.z>0&&d.z<=d.x&&(!f||h.z!==0)){let{east:B,up:C}=Cc;if(f)B.set(0,1,0),C.set(0,0,Math.sign(h.z));else{let R=Math.max(Math.abs(h.x),Math.abs(h.y));B.set(-h.y/R,h.x/R,0).normalize(),e.geodeticSurfaceNormal(h,C)}if(!lg(B,C,mb)||!hg(mb,h,t,r,n,o))throw new Error("Unsupported local frame");return o}if(f){let B=Math.sign(h.z);a=OR.fromArray(vg[t]),t!=="east"&&t!=="west"&&a.scale(B),c=BR.fromArray(vg[r]),r!=="east"&&r!=="west"&&c.scale(B),l=LR.fromArray(vg[n]),n!=="east"&&n!=="west"&&l.scale(B)}else{let{up:B,east:C,north:R}=Cc,W=Math.max(Math.abs(h.x),Math.abs(h.y));C.set(-h.y/W,h.x/W,0).normalize(),e.geodeticSurfaceNormal(h,B),R.copy(B).cross(C);let{down:j,west:I,south:P}=Cc;j.copy(B).scale(-1),I.copy(C).scale(-1),P.copy(R).scale(-1),a=Cc[t],c=Cc[r],l=Cc[n]}let m=a.x,p=a.y,g=a.z,y=c.x,_=c.y,b=c.z,M=l.x,T=l.y,A=l.z,S=h.x,v=h.y,N=h.z;return o[0]=m,o[1]=p,o[2]=g,o[3]=0,o[4]=y,o[5]=_,o[6]=b,o[7]=0,o[8]=M,o[9]=T,o[10]=A,o[11]=0,o[12]=S,o[13]=v,o[14]=N,o[15]=1,o}var CR,NR,mb,pb,vg,Cc,OR,BR,LR,yb=w(()=>{jt();jt();CR=1e-14,NR=new E,mb=cg(),pb={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},vg={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Cc={east:new E,north:new E,up:new E,west:new E,south:new E,down:new E},OR=new E,BR=new E,LR=new E});function fa(e,t,r=new bt){return gb(e,"east","north","up",t,r)}var wb=w(()=>{jt();yb()});var _b=w(()=>{Ff();wb()});var hh,Mb=w(()=>{jt();hh=class{constructor(t,r,n,i){this.west=t,this.south=r,this.east=n,this.north=i}static center(t,r){r||(r=new E);let n=t.east,i=t.west;n<i&&(n+=we.TWO_PI);let o=I0((i+n)*.5,"negative-pi-to-pi"),s=(t.south+t.north)*.5;return r.x=o,r.y=s,r.z=0,r}get width(){let t=this.east,r=this.west;return t<r&&(t+=we.TWO_PI),t-r}}});function uh(e,t=pt.WGS84,r={}){if(!e||e.length!==6||e.some(_=>!Number.isFinite(_)))throw new Error("makeOBBFromRegion: region must contain exactly six finite numbers");let n=r.units==="degrees"?df(1):1,[i,o,s,a,c,l]=e;if(c>l)throw new Error("makeOBBFromRegion: minimumHeight must not exceed maximumHeight");let h=o*n,u=a*n,f=Sb(i*n),d=Sb(s*n);s*n-i*n>=we.TWO_PI-1e-12&&(d=f+we.TWO_PI);let p=1e-12;if(h>u||h<-we.PI_OVER_TWO-p||u>we.PI_OVER_TWO+p)throw new Error("makeOBBFromRegion: latitude must be within [-\u03C0/2, \u03C0/2] and south \u2264 north");let g=Math.max(-we.PI_OVER_TWO,Math.min(we.PI_OVER_TWO,h)),y=Math.max(-we.PI_OVER_TWO,Math.min(we.PI_OVER_TWO,u));return a8([f,g,d,y,c,l],t,r.transform)}function Sb(e){let t=((e+Math.PI)%we.TWO_PI+we.TWO_PI)%we.TWO_PI-Math.PI;return t===-Math.PI&&e>0?Math.PI:t}function a8(e,t,r){let n=new eo,[i,o,s,a,c,l]=e,h=Br(a),u=Br(o),f,d,m,p,g,y,_,b=new hh(i,o,s,a),M=hh.center(b,FR),T=new E([Br(M.x),Br(M.y),0]),A=M.x,S=T.x;if(b.width<=we.PI){let yt=Br(i),Dt=t.cartographicToCartesian(T),X=new kf(Dt,t),xt=u<0&&h>0?0:T.y,et=UR.copy([S,h,l]),dt=GR.copy([yt,h,l]),St=zR.copy([yt,xt,l]),k=VR.copy([yt,u,l]),Rt=kR.copy([S,u,l]),zt=t.cartographicToCartesian(et,qR),Wt=t.cartographicToCartesian(dt,bb),ee=t.cartographicToCartesian(St,jR),Jt=t.cartographicToCartesian(k,xb),ye=t.cartographicToCartesian(Rt,WR),Be=X.projectPointToNearestOnPlane(zt,HR),Ue=X.projectPointToNearestOnPlane(Wt,$R),Ft=X.projectPointToNearestOnPlane(ee,YR),Ot=X.projectPointToNearestOnPlane(Jt,KR),Ut=X.projectPointToNearestOnPlane(ye,XR);return p=Math.min(Ue.x,Ft.x,Ot.x),f=-p,d=Math.max(Ue.y,Be.y),g=Math.min(Ot.y,Ut.y),dt.z=k.z=c,Wt=t.cartographicToCartesian(dt,bb),Jt=t.cartographicToCartesian(k,xb),_=X.plane,y=Math.min(_.getPointDistance(Wt),_.getPointDistance(Jt)),m=l,vb(Tb(X.origin,X.xAxis,X.yAxis,X.zAxis,p,f,g,d,y,m,n),r)}let v=Br(s),N=o>0,B=a<0,C=N?u:B?h:0,R=t.cartographicToCartesian([S,C,l],JR);R.z=0;let j=Math.abs(R.x)<we.EPSILON10&&Math.abs(R.y)<we.EPSILON10?o8:QR.copy(R).normalize(),I=s8,P=t8.copy(j).cross(I);_=ZR.fromPointNormal(R,j);let D=t.cartographicToCartesian([Br(A+we.PI_OVER_TWO),C,l],e8);f=_.projectPointOntoPlane(D,r8).dot(P),p=-f;let L=B?c:l,O=N?c:l;d=Eb(t,h,L,!0),g=Eb(t,u,O,!1);let V=t.cartographicToCartesian([v,C,l],i8);return y=_.getPointDistance(V),m=0,vb(Tb(R,P,I,j,p,f,g,d,y,m,n),r)}function vb(e,t){if(!t)return e;let r=[0,1,2].map(a=>e.halfAxes.getColumn(a,new E)),n=t.transformAsPoint(e.center),i=[1/0,1/0,1/0],o=[-1/0,-1/0,-1/0];for(let a=0;a<8;a++){let c=new E(n);for(let l=0;l<3;l++){let h=t.transformAsVector(r[l]);c.add(new E(h).scale((a&1<<l)===0?-1:1))}for(let l=0;l<3;l++)i[l]=Math.min(i[l],c[l]),o[l]=Math.max(o[l],c[l])}e.center.copy(i).add(o).scale(.5);let s=new E(o).subtract(i).scale(.5);return e.halfAxes=new Qr().set(s.x,0,0,0,s.y,0,0,0,s.z),e}function Eb(e,t,r,n){let i=n?-1/0:1/0;for(let o of[0,90,180,270]){let s=e.cartographicToCartesian([o,t,r],n8).z;i=n?Math.max(i,s):Math.min(i,s)}return i}function Tb(e,t,r,n,i,o,s,a,c,l,h){let u=h.center,f=h.halfAxes;f.setColumn(0,t),f.setColumn(1,r),f.setColumn(2,n);let d=DR.set((i+o)/2,(s+a)/2,(c+l)/2).transformByMatrix3(f),m=(o-i)/2,p=(a-s)/2,g=(l-c)/2;return f[0]*=m,f[1]*=m,f[2]*=m,f[3]*=p,f[4]*=p,f[5]*=p,f[6]*=g,f[7]*=g,f[8]*=g,u.copy(e).add(d),h}var DR,FR,UR,GR,zR,VR,kR,qR,bb,jR,xb,WR,HR,$R,YR,KR,XR,ZR,JR,QR,t8,e8,r8,n8,i8,o8,s8,Ib=w(()=>{jt();ro();Mb();Ff();lb();DR=new E,FR=new E,UR=new E,GR=new E,zR=new E,VR=new E,kR=new E,qR=new E,bb=new E,jR=new E,xb=new E,WR=new E,HR=new Jr,$R=new Jr,YR=new Jr,KR=new Jr,XR=new Jr,ZR=new Ye,JR=new E,QR=new E,t8=new E,e8=new E,r8=new Jr,n8=new E,i8=new E,o8=new E(1,0,0),s8=new E(0,0,1)});var Ab=w(()=>{Ib()});var Pb=w(()=>{});function qf(e={}){if(e.coordinateEpoch!==void 0&&!Number.isFinite(e.coordinateEpoch))throw new Error("Spatial reference coordinate epoch must be a finite decimal year");return Object.freeze({crs:Rb(e.crs||{state:"absent",provenance:"unknown"}),vertical:e.vertical?Rb(e.vertical):void 0,coordinateEpoch:e.coordinateEpoch,coordinateFrame:e.coordinateFrame||"unknown",coordinateOrder:Object.freeze([...e.coordinateOrder||[]]),units:e.units?Object.freeze([...e.units]):void 0})}function tr(e){if(typeof e=="object")return"projjson";let t=e.trim();return/^[A-Z][A-Z0-9_]*\s*[\[(]/i.test(t)?"wkt":/(?:^|\s)\+?proj=/i.test(t)?"proj-string":/^[A-Z][A-Z0-9._-]*(?::[A-Z0-9._-]+)+$/i.test(t)||/^urn:ogc:def:crs:/i.test(t)||/^https?:\/\//i.test(t)||/^[A-Z][A-Z0-9._-]*$/i.test(t)?"identifier":"opaque"}function Rb(e){return e.state==="explicit"||e.state==="default"?Object.freeze({...e,definition:Cb(e.definition),alternatives:e.alternatives?Object.freeze(e.alternatives.map(t=>Object.freeze({...t,definition:Cb(t.definition)}))):void 0}):Object.freeze({...e})}function Cb(e){return typeof e=="string"?e:Eg(e)}function Eg(e){return Array.isArray(e)?Object.freeze(e.map(t=>Eg(t))):e&&typeof e=="object"?Object.freeze(Object.fromEntries(Object.entries(e).map(([t,r])=>[t,Eg(r)]))):e}var Nc=w(()=>{});function dh(e,t){let n={type:"wkt-crs",root:new Tg(e).parse()};if(t?.strict){let i=Lb(n,{profile:t.profile,allowExtensions:!1});if(i.length>0)throw new Wf(i)}return n}function Lb(e,t){if(!e||e.type!=="wkt-crs"||e.root?.type!=="node")throw new TypeError("validateWKTCRS expects a WKTCRSAst");let r=w8(e.root.keyword,t?.profile||"auto"),n=g8[r],i=y8[r],o=[],s=e.root.keyword.toUpperCase();return n.has(s)||o.push({code:"invalid-root",message:`${e.root.keyword} is not a ${r} root keyword`,path:[],keyword:e.root.keyword}),Db(e.root,[],a=>{let c=a.node.keyword.toUpperCase();!t?.allowExtensions&&!i.has(c)&&o.push({code:"unknown-keyword",message:`${a.node.keyword} is not defined by the ${r} profile`,path:a.path,keyword:a.node.keyword}),a.node.values.length===0&&o.push({code:"empty-node",message:`${a.node.keyword} must contain at least one value`,path:a.path,keyword:a.node.keyword});let l=_8(a.node);l&&o.push({code:"invalid-value",message:l,path:a.path,keyword:a.node.keyword})}),o}function w8(e,t){return t!=="auto"?t:fh.has(e.toUpperCase())?"wkt1":"wkt2:2019"}function _8(e){let t=e.keyword.toUpperCase(),r=e.values,n=(o,...s)=>!!(r[o]&&s.includes(r[o].type)),i=(o,...s)=>r.length===o&&s.every((a,c)=>n(c,a));if(["ANGLEUNIT","LENGTHUNIT","PARAMETRICUNIT","SCALEUNIT","TIMEUNIT","TEMPORALQUANTITY","UNIT"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"number")))return`${e.keyword} must start with a quoted name and numeric conversion factor`;if(t==="CS"&&!i(2,"enumeration","number"))return`${e.keyword} must contain a coordinate-system type and dimension`;if(t==="BBOX"&&!i(4,"number","number","number","number"))return`${e.keyword} must contain four numeric bounds`;if(["ENSEMBLEACCURACY","EPOCH","COORDEPOCH","FRAMEEPOCH","OPERATIONACCURACY","ORDER"].includes(t)&&!i(1,"number"))return`${e.keyword} must contain one number`;if(["ANCHOR","AREA","CALENDAR","CITATION","REMARK","SCOPE","URI","VERSION"].includes(t)&&!i(1,"string"))return`${e.keyword} must contain one quoted string`;if(["ELLIPSOID","SPHEROID","TRIAXIAL"].includes(t)&&!(r.length>=3&&n(0,"string")&&n(1,"number")&&n(2,"number")))return`${e.keyword} must start with a quoted name and numeric ellipsoid axes`;if(["PARAMETER"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"number")))return`${e.keyword} must start with a quoted name and numeric value`;if(t==="PARAMETERFILE"&&!i(2,"string","string"))return`${e.keyword} must contain a quoted name and file name`;if(["AUTHORITY","ID"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"string","number")))return`${e.keyword} must start with a quoted authority and identifier`;if(["AXIS"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"enumeration")))return`${e.keyword} must start with a quoted name and axis direction`;if(["METHOD","PROJECTION"].includes(t)&&!(r.length>=1&&n(0,"string")))return`${e.keyword} must start with a quoted name`;if(t==="TIMEEXTENT"){let o=s=>n(s,"enumeration","string");if(r.length!==2||!o(0)||!o(1))return`${e.keyword} must contain two date-time or quoted values`}if(t==="VERTICALEXTENT"&&(r.length<2||r.length>3||!n(0,"number")||!n(1,"number")||r.length===3&&!n(2,"node")))return`${e.keyword} must contain two numeric bounds and an optional unit`;if(t==="COORDINATEMETADATA"&&(r.length<1||r.length>2||!n(0,"node")||r.length===2&&(!n(1,"node")||!["EPOCH","COORDEPOCH"].includes(r[1].keyword.toUpperCase()))))return`${e.keyword} must contain a CRS and an optional coordinate epoch`;if(t==="BOUNDCRS"){let o=r.slice(0,3).map(s=>s.type==="node"?s.keyword.toUpperCase():"");if(o[0]!=="SOURCECRS"||o[1]!=="TARGETCRS"||o[2]!=="ABRIDGEDTRANSFORMATION")return`${e.keyword} must start with SOURCECRS, TARGETCRS, and ABRIDGEDTRANSFORMATION`}return["COMPOUNDCRS","CONCATENATEDOPERATION","COORDINATEOPERATION","DERIVEDPROJCRS","ENGCRS","ENGINEERINGCRS","GEODCRS","GEODETICCRS","GEOGCRS","GEOGRAPHICCRS","PARAMETRICCRS","POINTMOTIONOPERATION","PROJCRS","PROJECTEDCRS","TIMECRS","VERTCRS","VERTICALCRS"].includes(t)&&!n(0,"string")?`${e.keyword} must start with a quoted name`:null}function Db(e,t,r){r({node:e,path:t});for(let n=0;n<e.values.length;n++){let i=e.values[n];i.type==="node"&&Db(i,[...t,n],r)}}function M8(e,t){let r=1,n=1;for(let i=0;i<t&&i<e.length;i++)e[i]===`
|
|
8
|
-
`?(r++,n=1):n++;return{line:r,column:n}}var
|
|
9
|
-
`?(r++,n=1):n++;return{line:r,column:n}}var no,b8,Pg=w(()=>{no=class extends SyntaxError{constructor(t,r,n){let i=E8(r,n);super(`${t} at ${i.line}:${i.column}`),this.name="PROJStringSyntaxError",this.offset=n,this.line=i.line,this.column=i.column}};b8=/^[+-]?\d+(?:\.\d*)?d(?:\d+(?:\.\d*)?'(?:\d+(?:\.\d*)?")?)?[NSEW]?$/i});var ph,Fb=w(()=>{ph={m:{name:"meters",metersPerUnit:1},mm:{name:"millimeters",metersPerUnit:.001},cm:{name:"centimeters",metersPerUnit:.01},ft:{name:"feet",metersPerUnit:.3048},"us-ft":{name:"us-survey-feet",metersPerUnit:.3048006096012192},fath:{name:"fathoms",metersPerUnit:1.8288},kmi:{name:"nautical-miles",metersPerUnit:1852},"us-ch":{name:"us-survey-chains",metersPerUnit:20.1168402336805},"us-mi":{name:"us-survey-miles",metersPerUnit:1609.34721869444},km:{name:"kilometers",metersPerUnit:1e3},"ind-ft":{name:"indian-feet",metersPerUnit:.30479841},"ind-yd":{name:"indian-yards",metersPerUnit:.91439523},mi:{name:"miles",metersPerUnit:1609.344},yd:{name:"yards",metersPerUnit:.9144},ch:{name:"chains",metersPerUnit:20.1168},link:{name:"links",metersPerUnit:.201168},dm:{name:"decimeters",metersPerUnit:.1},in:{name:"inches",metersPerUnit:.0254},"ind-ch":{name:"indian-chains",metersPerUnit:20.11669506},"us-in":{name:"us-survey-inches",metersPerUnit:.025400050800101},"us-yd":{name:"us-survey-yards",metersPerUnit:.914401828803658}}});function Ub(e){return JSON.stringify([e.coordinateFrame,e.projection,Object.keys(e.parameters).sort().map(t=>[t,e.parameters[t]]),[e.ellipsoid.semiMajorAxis,e.ellipsoid.semiMinorAxis],e.axis,[e.xUnit.name,e.xUnit.metersPerUnit,e.xUnit.degreesPerUnit],[e.yUnit.name,e.yUnit.metersPerUnit,e.yUnit.degreesPerUnit],[e.zUnit.name,e.zUnit.metersPerUnit,e.zUnit.degreesPerUnit],e.lossy,e.areaOfUse])}var Rg=w(()=>{Fb()});var Cg=w(()=>{Nc();Ag();Pg()});function tt(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))return r;let n=e[t];if(typeof n!="string"||!/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i.test(n))throw new Error(`Invalid numeric PROJ parameter: +${t}`);let i=Number(n);if(!Number.isFinite(i))throw new Error(`Invalid numeric PROJ parameter: +${t}`);return i}function gh(e,t){let r=tt(e,t,0);if(Math.abs(r)>=90)throw new Error(`+${t} must be between -90 and 90 degrees`);return r*Me}function ve(e,t=!1){if(t||Math.abs(e)<=Math.PI)return e;let r=2*Math.PI;return((e+Math.PI)%r+r)%r-Math.PI}var Me,Ee=w(()=>{Me=Math.PI/180});function Te(e,t){let r=[e[0]*t[0],e[0]*t[1],e[1]*t[0],e[1]*t[1]];return[Math.min(...r),Math.max(...r)]}function yh([e,t]){let r=[Math.sin(e),Math.sin(t)];for(let[n,i]of[[Math.PI/2,1],[-Math.PI/2,-1]])Math.ceil((e-n)/(2*Math.PI))<=Math.floor((t-n)/(2*Math.PI))&&r.push(i);return[Math.min(...r),Math.max(...r)]}function re(e,t){let r=n=>Math.max(1,qo(n))*1e-12;if(![...e,...t].every(Number.isFinite))throw new Error("Projection rendering bounds are not finite");return[[e[0]-r(e),t[0]-r(t),0],[e[1]+r(e),t[1]+r(t),0]]}function gr(e,t,r=!1){let n=e[0][0]-t,i=e[1][0]-t;if(r)return[n,i];let o=i-n;if(o>=2*Math.PI-1e-12)return[-Math.PI,Math.PI];let s=ve(n);o>0&&Math.abs(s-Math.PI)<1e-12&&(s=-Math.PI);let a=s+o;return a>Math.PI+1e-12?[-Math.PI,Math.PI]:[s,Math.min(a,Math.PI)]}function yr(e,t,r,n=!1){let i=gr(t,r,n),o=[t[0][1],t[1][1],Math.max(t[0][1],Math.min(t[1][1],0))],s=i.flatMap(a=>o.map(c=>e(r+a,c)));return re([Math.min(...s.map(a=>a[0])),Math.max(...s.map(a=>a[0]))],[Math.min(...s.map(a=>a[1])),Math.max(...s.map(a=>a[1]))])}function Oc(e,t,r,n=!1,i=0){let o=gr(t,r,n);if(qo(o)>Math.PI/6+1e-12)throw new Error("Unsupported transverse rendering coverage");let s=[o[0],o[1],Math.max(o[0],Math.min(o[1],0))],a=[t[0][1],t[1][1],Math.max(t[0][1],Math.min(t[1][1],i))],c=s.flatMap(l=>a.map(h=>e(r+l,h)));return re([Math.min(...c.map(l=>l[0])),Math.max(...c.map(l=>l[0]))],[Math.min(...c.map(l=>l[1])),Math.max(...c.map(l=>l[1]))])}function Gb(e,t,r,n=!1){let i=gr(t,r,n),o=[i[0],i[1],Math.max(i[0],Math.min(i[1],0))],s=[t[0][1],t[1][1],Math.max(t[0][1],Math.min(t[1][1],0))],a=o.flatMap(c=>s.map(l=>e(r+c,l)));return re([Math.min(...a.map(c=>c[0])),Math.max(...a.map(c=>c[0]))],[Math.min(...a.map(c=>c[1])),Math.max(...a.map(c=>c[1]))])}function Bc(e,t,r,n,i,o,s=!1){let a=Ct(gr(t,r,s),n),c=kn(o-e(r,t[0][1])[1],o-e(r,t[1][1])[1]);return re(At([i,i],Te(c,yh(a))),At([o,o],Ct(Te(c,Hf(a)),-1)))}var kn,At,Ct,Hf,qo,Ie=w(()=>{Ee();kn=(e,t)=>[Math.min(e,t),Math.max(e,t)],At=(e,t)=>[e[0]+t[0],e[1]+t[1]],Ct=(e,t)=>kn(e[0]*t,e[1]*t);Hf=e=>yh([e[0]+Math.PI/2,e[1]+Math.PI/2]),qo=e=>Math.max(Math.abs(e[0]),Math.abs(e[1]))});function K(e,t,r,n){return[[e,t],[r,n]]}function ni(e){return e>=-180&&e<180?e:((e+180)%360+360)%360-180}function T8(e,t,r,n){if(![e,t,r,n].every(Number.isFinite)||t<-90||n>90||t>n||r-e<-360||r-e>360+1e-10)throw new Error("Invalid geographic coverage");if(r-e>=360-1e-10)return[-180,t,180,n];let i=ni(r);return[ni(e),t,i===-180&&r>e?180:i,n]}function Ng(e){let t=e[2]-e[0];return t<0?t+360:t}function zb(e){let[t,r,n,i]=e;return t<=n?[e]:[[t,r,180,i],[-180,r,n,i]]}function I8(e,t){let[r,n,i,o]=e,s=ni(t[0]);return t[1]>=n&&t[1]<=o&&(r<=i?s>=r&&s<=i||s===-180&&i===180:s>=r||s<=i)}function $f(e,t){let r=Math.max(e[1],t[1]),n=Math.min(e[3],t[3]);if(r>n)return[];let i=[];for(let s of zb(e))for(let a of zb(t)){let c=Math.max(s[0],a[0]),l=Math.min(s[2],a[2]);c<=l?i.push([c,l]):(s[2]===180&&a[0]===-180||a[2]===180&&s[0]===-180)&&i.push([-180,-180])}i.sort((s,a)=>s[0]-a[0]);let o=[];for(let s of i){let a=o[o.length-1];a&&s[0]<=a[1]?a[1]=Math.max(a[1],s[1]):o.push([...s])}if(o.length>1&&o[0][0]===-180&&o[o.length-1][1]===180){let s=o.shift();return[[o.pop()[0],r,s[1],n],...o.map(([c,l])=>[c,r,l,n])]}return o.map(([s,a])=>[s,r,a,n])}function Vb(e,t){let r=ni(t[0]),n=Math.max(e[1],Math.min(e[3],t[1]));if(!I8(e,[r,n])){let i=Math.abs(ni(r-e[0])),o=Math.abs(ni(r-e[2]));r=i<=o?e[0]:e[2]}return[r,n]}function jo(e,t=0,r=0){let n=Ng(e),i=e[0]*io-t,o=i+n*io/2,s=Math.round((r-o)/(2*Math.PI))*2*Math.PI;return K(n===360?r-Math.PI:i+s,e[1]*io,n===360?r+Math.PI:i+s+n*io,e[3]*io)}function gn(e,t=0){return T8((e[0][0]+t)/io,e[0][1]/io,(e[1][0]+t)/io,e[1][1]/io)}function kb(e){if(!e.length)throw new Error("CRS coverage does not intersect the rendering target");return[[0,1,2].map(t=>Math.min(...e.map(r=>r[0][t]))),[0,1,2].map(t=>Math.max(...e.map(r=>r[1][t])))]}var io,Ht=w(()=>{io=Math.PI/180});function qb(e,t){if(t)try{let n=e(t);return Og(n)}catch{}let r=e();return Og(r)}function Og(e){let t=e.bounds;if(t.some(r=>r.some(n=>!Number.isFinite(n))))throw new Error("Projection rendering bounds must be finite");return{bounds:t,normalize:e.normalize?.bind(e)}}function Wo(e,t=0){return r=>{let n=r.x*Math.PI/180-t,i=r.y*Math.PI/180,o={x:n,y:i,z:r.z};e(o),o.x!==n&&(r.x=(o.x+t)*180/Math.PI),o.y!==i&&(r.y=o.y*180/Math.PI)}}function Yf(e,t){let r=[];for(let n of e){let i=t(n);i!==null&&r.push(Og(i))}return r.length?r.length===1?r[0]:{bounds:kb(r.map(n=>n.bounds)),normalize(n){let i=n.x,o=n.y,s=1/0;for(let a of r){let c={x:n.x,y:n.y,z:n.z};a.normalize?.(c);let l=Math.sin((c.y-n.y)*Math.PI/360)**2+Math.cos(n.y*Math.PI/180)*Math.cos(c.y*Math.PI/180)*Math.sin((c.x-n.x)*Math.PI/360)**2;l<s&&(s=l,i=c.x,o=c.y)}n.x=i,n.y=o}}:null}var da=w(()=>{Ht()});function Kf(e,t,r=0,n=!1){let i=Ng(t),o=i===360?r-180:t[0]+Math.round((r-t[0]-i/2)/360)*360,s=o+i;if(n){e.x=Math.max(o,Math.min(s,e.x)),e.y=Math.max(t[1],Math.min(t[3],e.y));return}let a=Vb(t,[e.x,e.y]),c=a[0];a[0]===ni(e.x)&&e.x>=o&&e.x<=s?c=e.x:(c<o||c>s)&&(c+=Math.round(((o+s)/2-c)/360)*360);let l=c-r;e.x=Math.abs(l)<=180?c:r+ni(l),e.y=a[1]}function Ke(e,t,r=0,n=0,i=!1){let o=(r+n)*180/Math.PI;return{get bounds(){return e(jo(t,n,r))},normalize(s){Kf(s,t,o,i)}}}function A8(e,t,r,n,i){let o=Yf(t,s=>Ke(e,s,r,n,i));if(!o)throw new Error("CRS coverage does not intersect the rendering target");return o}function Pt(e,t,r,n=0,i=!1){let o=(t[0][0]+t[1][0])/2,s=gn(t,n),a=(o+n)*180/Math.PI;return{...e,longitudeOrigin:o,getRenderingProfile(c){if(!c)return{bounds:r(t),normalize(l){Kf(l,s,a,i)}};try{let l=Ke(r,c,o,n,i);return{bounds:l.bounds,normalize:l.normalize}}catch{return A8(r,$f(c,s),o,n,i)}}}}var ne=w(()=>{Ht();da()});function jb(){return{x:0,y:0,z:0}}var Ho,Xf=w(()=>{Ho=class{constructor(){this.point=jb(),this.points=[this.point],this.active=0}get depth(){return this.active}acquire(){var t;let r=this.active++;return(t=this.points)[r]||(t[r]=jb()),this.points[r]}release(t){this.active>0&&this.points[this.active-1]===t&&this.active--}}});function qn(e,t){let r=new Ho,n=(i,o,s)=>{let a=r.acquire();try{return a.x=i,a.y=o,a.z=0,s(a),[a.x,a.y]}finally{r.release(a)}};return{forward(i,o){return n(i,o,e)},inverse(i,o){return n(i,o,t)},forwardInPlace:e,inverseInPlace:t}}function oo(e,t,r=!1){let n=t?e.inverseInPlace:e.forwardInPlace;if(n)return n.bind(e);if(r){let o=t?e.inverse3D:e.forward3D;return s=>{let a=o.call(e,[s.x,s.y,s.z]);s.x=a[0],s.y=a[1],s.z=a[2]}}let i=t?e.inverse:e.forward;return o=>{let s=i.call(e,o.x,o.y);o.x=s[0],o.y=s[1]}}var ma=w(()=>{Xf()});function $o(e,t,r=0){let n=tt(e,t,r);if(t!=="lon_0"&&Math.abs(n)>90)throw new Error("Latitude parameter must be between -90 and 90 degrees: +"+t);return n*Me}function ii(e,t){let r=Object.prototype.hasOwnProperty.call(e,t);if(r&&e[t]!==void 0)throw new Error("Expected a flag without a value: +"+t);return r}function er({semiMajorAxis:e,eccentricitySquared:t,parameters:r,primeMeridian:n=0}){let i=tt(r,"k_0",tt(r,"k",1));if(i<=0)throw new Error("Projection scale must be positive");return{primeMeridian:n,a:e,b:e*Math.sqrt(1-t),es:t,e:Math.sqrt(t),ep2:t/(1-t),sphere:t===0,over:ii(r,"over"),long0:$o(r,"lon_0"),lat0:$o(r,"lat_0"),lat1:$o(r,"lat_1"),lat2:$o(r,"lat_2",tt(r,"lat_1",0)),lat_ts:$o(r,"lat_ts",NaN),x0:tt(r,"x_0",0),y0:tt(r,"y_0",0),k0:i}}function Lc(e,t){if(!Object.prototype.hasOwnProperty.call(t,"lat_1"))throw new Error("Conic projections require +lat_1");if(Math.abs(e.lat1+e.lat2)<1e-10||Math.abs(e.lat1)>=Math.PI/2||Math.abs(e.lat2)>=Math.PI/2)throw new Error("Conic standard parallels must not be opposite or at a pole")}function Xe(e,t,r,n,i=qn){let o=(s,a)=>{let c=s(t,a);if(!c||typeof c!="object"||!Number.isFinite(c.x)||!Number.isFinite(c.y))throw new Error(e+": coordinate outside projection domain or inverse did not converge");a.x=c.x,a.y=c.y};return i(s=>o(r,s),s=>o(n,s))}function Yo(e,t){let r=oo(t,!1);return qn(n=>{let i=n.x,o=n.y,s=Math.atan2(Math.sin(i-e.long0),Math.cos(i-e.long0)),a=Math.abs(Math.abs(e.lat0)-Math.PI/2)<1e-10;if(Math.abs(o+e.lat0)<1e-10&&(a||Math.abs(Math.abs(s)-Math.PI)<1e-10))throw new Error("Azimuthal projection is undefined at the antipode");r(n)},oo(t,!0))}var ar,so,yn=w(()=>{ma();Ee();ar=["lon_0","lat_0","x_0","y_0"],so=["k","k_0"]});function oi(e,t){return{...qn(e,t),createForwardFlat(r){return this.forwardInPlace===e?Wb(e,!1,r):void 0},createInverseFlat(r){return this.inverseInPlace===t?Wb(t,!0,r):void 0}}}function Wb(e,t,{inputScale:r,outputScale:n}){let i=new Ho;return(o,s)=>{let a=i.acquire();try{let c=o instanceof Float32Array;for(let l=0;l<o.length;l+=s){if(a.x=o[l],a.y=o[l+1],a.z=s>=3?o[l+2]:0,!Number.isFinite(a.x)||!Number.isFinite(a.y)||!Number.isFinite(a.z))throw new Error("Coordinates must contain finite x, y and optional z values");if(r!==1&&(a.x*=r,a.y*=r),t&&e(a),Math.abs(a.y)>Math.PI/2||!Number.isFinite(a.x)||!Number.isFinite(a.y))throw new Error("Coordinate is outside the geographic domain");if(a.x+=0,a.x-=0,t||e(a),n!==1&&(a.x/=n,a.y/=n),!Number.isFinite(a.x)||!Number.isFinite(a.y))throw new Error("Projection produced non-finite coordinates");if(c&&(Math.abs(a.x)>34028234663852886e22||Math.abs(a.y)>34028234663852886e22))throw new Error("Projected coordinate exceeds Float32 range");o[l]=a.x,o[l+1]=a.y}}finally{i.release(a)}}}var Dc=w(()=>{ma();Xf()});function pa(e){var t=Math.exp(e);return t=(t-1/t)/2,t}var Zf=w(()=>{});function ke(e,t){e=Math.abs(e),t=Math.abs(t);var r=Math.max(e,t),n=Math.min(e,t)/(r||1);return r*Math.sqrt(1+Math.pow(n,2))}var ga=w(()=>{});function Hb(e){var t=1+e,r=t-1;return r===0?e:e*Math.log(t)/r}var $b=w(()=>{});function Yb(e){var t=Math.abs(e);return t=Hb(t*(1+t/(ke(1,t)+1))),e<0?-t:t}var Kb=w(()=>{ga();$b()});function Jf(e,t){for(var r=2*Math.cos(2*t),n=e.length-1,i=e[n],o=0,s;--n>=0;)s=-o+r*i+e[n],o=i,i=s;return t+s*Math.sin(2*t)}var Xb=w(()=>{});function Zb(e,t){for(var r=2*Math.cos(t),n=e.length-1,i=e[n],o=0,s;--n>=0;)s=-o+r*i+e[n],o=i,i=s;return Math.sin(t)*s}var Jb=w(()=>{});function wh(e){var t=Math.exp(e);return t=(t+1/t)/2,t}var Bg=w(()=>{});function Lg(e,t,r,n){for(var i=Math.sin(t),o=Math.cos(t),s=pa(r),a=wh(r),c=2*o*a,l=-2*i*s,h=e.length-1,u=e[h],f=0,d=0,m=0,p,g;--h>=0;)p=d,g=f,d=u,f=m,u=-p+c*d-l*f+e[h],m=-g+l*d+c*f;c=i*a,l=o*s,n.x=c*u-l*m,n.y=c*m+l*u}var Qb=w(()=>{Zf();Bg()});var U,$t,Ko,tx,Dg,Fg,_h,Ae=w(()=>{U=Math.PI/2,$t=Math.PI/4,Ko=Math.PI*2,tx=3.14159265359,Dg=Math.PI/180,Fg=180/Math.PI,_h=Math.PI/(180*3600)});function Xo(e){return e<0?-1:1}var Mh=w(()=>{});function G(e,t){return t||Math.abs(e)<=tx?e:e-Xo(e)*Ko}var ue=w(()=>{Ae();Mh()});function P8(e){e.x0=e.x0!==void 0?e.x0:0,e.y0=e.y0!==void 0?e.y0:0,e.long0=e.long0!==void 0?e.long0:0,e.lat0=e.lat0!==void 0?e.lat0:0,e.k0=e.k0!==void 0?e.k0:1,e.cgb=[],e.cbg=[],e.utg=[],e.gtu=[];var t=e.es/(1+Math.sqrt(1-e.es)),r=t/(2-t),n=r;e.cgb[0]=r*(2+r*(-2/3+r*(-2+r*(116/45+r*(26/45+r*(-2854/675)))))),e.cbg[0]=r*(-2+r*(2/3+r*(4/3+r*(-82/45+r*(32/45+r*(4642/4725)))))),n=n*r,e.cgb[1]=n*(7/3+r*(-8/5+r*(-227/45+r*(2704/315+r*(2323/945))))),e.cbg[1]=n*(5/3+r*(-16/15+r*(-13/9+r*(904/315+r*(-1522/945))))),n=n*r,e.cgb[2]=n*(56/15+r*(-136/35+r*(-1262/105+r*(73814/2835)))),e.cbg[2]=n*(-26/15+r*(34/21+r*(8/5+r*(-12686/2835)))),n=n*r,e.cgb[3]=n*(4279/630+r*(-332/35+r*(-399572/14175))),e.cbg[3]=n*(1237/630+r*(-12/5+r*(-24832/14175))),n=n*r,e.cgb[4]=n*(4174/315+r*(-144838/6237)),e.cbg[4]=n*(-734/315+r*(109598/31185)),n=n*r,e.cgb[5]=n*(601676/22275),e.cbg[5]=n*(444337/155925),n=Math.pow(r,2),e.Qn=e.k0/(1+r)*(1+n*(1/4+n*(1/64+n/256))),e.utg[0]=r*(-.5+r*(2/3+r*(-37/96+r*(1/360+r*(81/512+r*(-96199/604800)))))),e.gtu[0]=r*(.5+r*(-2/3+r*(5/16+r*(41/180+r*(-127/288+r*(7891/37800)))))),e.utg[1]=n*(-1/48+r*(-1/15+r*(437/1440+r*(-46/105+r*(1118711/3870720))))),e.gtu[1]=n*(13/48+r*(-3/5+r*(557/1440+r*(281/630+r*(-1983433/1935360))))),n=n*r,e.utg[2]=n*(-17/480+r*(37/840+r*(209/4480+r*(-5569/90720)))),e.gtu[2]=n*(61/240+r*(-103/140+r*(15061/26880+r*(167603/181440)))),n=n*r,e.utg[3]=n*(-4397/161280+r*(11/504+r*(830251/7257600))),e.gtu[3]=n*(49561/161280+r*(-179/168+r*(6601661/7257600))),n=n*r,e.utg[4]=n*(-4583/161280+r*(108847/3991680)),e.gtu[4]=n*(34729/80640+r*(-3418889/1995840)),n=n*r,e.utg[5]=n*(-20648693/638668800),e.gtu[5]=n*(212378941/319334400);var i=Jf(e.cbg,e.lat0);e.Zb=-e.Qn*(i+Zb(e.gtu,2*i))}function ex(e,t){var r=G(t.x-e.long0,e.over),n=t.y;n=Jf(e.cbg,n);var i=Math.sin(n),o=Math.cos(n),s=Math.sin(r),a=Math.cos(r);n=Math.atan2(i,a*o),r=Math.atan2(s*o,ke(i,o*a)),r=Yb(Math.tan(r)),Lg(e.gtu,2*n,2*r,t),n=n+t.x,r=r+t.y;var c,l;return Math.abs(r)<=2.623395162778?(c=e.a*(e.Qn*r)+e.x0,l=e.a*(e.Qn*n+e.Zb)+e.y0):(c=1/0,l=1/0),t.x=c,t.y=l,t}function rx(e,t){var r=(t.x-e.x0)*(1/e.a),n=(t.y-e.y0)*(1/e.a);n=(n-e.Zb)/e.Qn,r=r/e.Qn;var i,o;if(Math.abs(r)<=2.623395162778){Lg(e.utg,2*n,2*r,t),n=n+t.x,r=r+t.y,r=Math.atan(pa(r));var s=Math.sin(n),a=Math.cos(n),c=Math.sin(r),l=Math.cos(r);n=Math.atan2(s*l,ke(c,l*a)),r=Math.atan2(c,l*a),i=G(r+e.long0,e.over),o=Jf(e.cgb,n)}else i=1/0,o=1/0;return t.x=i,t.y=o,t}function nx(e){let t={...e,cgb:[],cbg:[],utg:[],gtu:[],Qn:0,Zb:0};return P8(t),t}var ix=w(()=>{Zf();ga();Kb();Xb();Jb();Qb();ue()});function Ri(e){var t=[];t[0]=R8-e*(C8+e*(ox+e*(sx+e*ax))),t[1]=e*(N8-e*(ox+e*(sx+e*ax)));var r=e*e;return t[2]=r*(O8-e*(B8+e*L8)),r*=e,t[3]=r*(D8-e*F8),t[4]=r*e*U8,t}var R8,C8,ox,sx,ax,N8,O8,B8,L8,D8,F8,U8,Fc=w(()=>{R8=1,C8=.25,ox=.046875,sx=.01953125,ax=.01068115234375,N8=.75,O8=.46875,B8=.013020833333333334,L8=.007120768229166667,D8=.3645833333333333,F8=.005696614583333333,U8=.3076171875});function rr(e,t,r,n){return r*=t,t*=t,n[0]*e-r*(n[1]+t*(n[2]+t*(n[3]+t*n[4])))}var ya=w(()=>{});function Ci(e,t,r){for(var n=1/(1-t),i=e,o=G8;o;--o){var s=Math.sin(i),a=1-t*s*s;if(a=(rr(i,s,Math.cos(i),r)-e)*(a*Math.sqrt(a))*n,i-=a,Math.abs(a)<1e-10)return i}return i}var G8,Uc=w(()=>{ya();G8=20});function z8(e){e.x0=e.x0!==void 0?e.x0:0,e.y0=e.y0!==void 0?e.y0:0,e.long0=e.long0!==void 0?e.long0:0,e.lat0=e.lat0!==void 0?e.lat0:0,e.es&&(e.en=Ri(e.es),e.ml0=rr(e.lat0,Math.sin(e.lat0),Math.cos(e.lat0),e.en))}function cx(e,t){var r=t.x,n=t.y,i=G(r-e.long0,e.over),o,s,a,c=Math.sin(n),l=Math.cos(n);if(e.es){var u=l*i,f=Math.pow(u,2),d=e.ep2*Math.pow(l,2),m=Math.pow(d,2),p=Math.abs(l)>1e-10?Math.tan(n):0,g=Math.pow(p,2),y=Math.pow(g,2);o=1-e.es*Math.pow(c,2),u=u/Math.sqrt(o);var _=rr(n,c,l,e.en);s=e.a*(e.k0*u*(1+f/6*(1-g+d+f/20*(5-18*g+y+14*d-58*g*d+f/42*(61+179*y-y*g-479*g)))))+e.x0,a=e.a*(e.k0*(_-e.ml0+c*i*u/2*(1+f/12*(5-g+9*d+4*m+f/30*(61+y-58*g+270*d-330*g*d+f/56*(1385+543*y-y*g-3111*g))))))+e.y0}else{var h=l*Math.sin(i);if(Math.abs(Math.abs(h)-1)<1e-10)return 93;if(s=.5*e.a*e.k0*Math.log((1+h)/(1-h))+e.x0,a=l*Math.cos(i)/Math.sqrt(1-Math.pow(h,2)),h=Math.abs(a),h>=1){if(h-1>1e-10)return 93;a=0}else a=Math.acos(a);n<0&&(a=-a),a=e.a*e.k0*(a-e.lat0)+e.y0}return t.x=s,t.y=a,t}function lx(e,t){var r,n,i,o,s=(t.x-e.x0)*(1/e.a),a=(t.y-e.y0)*(1/e.a);if(e.es)if(r=e.ml0+a/e.k0,n=Ci(r,e.es,e.en),Math.abs(n)<U){var f=Math.sin(n),d=Math.cos(n),m=Math.abs(d)>1e-10?Math.tan(n):0,p=e.ep2*Math.pow(d,2),g=Math.pow(p,2),y=Math.pow(m,2),_=Math.pow(y,2);r=1-e.es*Math.pow(f,2);var b=s*Math.sqrt(r)/e.k0,M=Math.pow(b,2);r=r*m,i=n-r*M/(1-e.es)*.5*(1-M/12*(5+3*y-9*p*y+p-4*g-M/30*(61+90*y-252*p*y+45*_+46*p-M/56*(1385+3633*y+4095*_+1574*_*y)))),o=G(e.long0+b*(1-M/6*(1+2*y+p-M/20*(5+28*y+24*_+8*p*y+6*p-M/42*(61+662*y+1320*_+720*_*y))))/d,e.over)}else i=U*Xo(a),o=0;else{var c=Math.exp(s/e.k0),l=.5*(c-1/c),h=e.lat0+a/e.k0,u=Math.cos(h);r=Math.sqrt((1-Math.pow(u,2))/(1+Math.pow(l,2))),i=Math.asin(r),Math.sin(h)<0&&(i=-i),l===0&&u===0?o=0:o=G(Math.atan2(l,u)+e.long0,e.over)}return t.x=o,t.y=i,t}function hx(e){let t={...e,en:[],ml0:0};return z8(t),t}var ux=w(()=>{Fc();ya();Uc();ue();Ae();Mh()});function Qf(e){let t=er(e),r=n=>Pt(n,K(t.long0-Math.PI/6,-Math.PI/2,t.long0+Math.PI/6,Math.PI/2),i=>Oc(n.forward,i,t.long0,t.over),t.primeMeridian,t.over);if(ii(e.parameters,"approx"))return r({...Xe("tmerc +approx",hx(t),cx,lx,oi)});if(t.sphere)throw new Error("Spherical transverse Mercator requires +approx");return r({...Xe("etmerc",nx(t),ex,rx,oi)})}var Ug,Gg,zg=w(()=>{Dc();Ie();Ht();ne();yn();ix();ux();Ug={name:"tmerc",aliases:["Fast_Transverse_Mercator","Fast Transverse Mercator","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger"],parameters:[...ar,...so,"approx"],flags:["approx"],create:Qf},Gg={name:"etmerc",aliases:["Extended_Transverse_Mercator","Extended Transverse Mercator"],parameters:[...ar,...so,"approx"],flags:["approx"],create:Qf}});var Vg,fx=w(()=>{Ie();Ht();ne();Ee();yn();zg();Vg={name:"utm",aliases:["Universal Transverse Mercator System"],parameters:["zone","south","approx"],flags:["south","approx"],create(e){let t=tt(e.parameters,"zone",NaN);if(!Number.isInteger(t)||t<1||t>60)throw new Error("UTM requires an integer +zone from 1 to 60");let r=ii(e.parameters,"south"),n=Qf({...e,parameters:{...e.parameters,lat_0:"0",lon_0:String(6*t-183),x_0:"500000",y_0:r?"10000000":"0",k_0:"0.9996"}}),i=(6*t-183)*Math.PI/180;return Pt(n,K(i-Math.PI/60,r?-80*Math.PI/180:0,i+Math.PI/60,r?0:84*Math.PI/180),o=>Oc(n.forward,o,i),e.primeMeridian??0,Object.prototype.hasOwnProperty.call(e.parameters,"over"))}}});function qg(e,t){return[Math.cos(t)*Math.cos(e),Math.cos(t)*Math.sin(e),Math.sin(t)]}function td(e,t,r,n,i){let o=Math.hypot(e,t);if(!o||Math.abs(r)>o+1e-14)return[];let s=Math.atan2(t,e),a=Math.acos(Math.max(-1,Math.min(1,r/o))),c=[];for(let l of[s-a,s+a])for(let h=Math.ceil((n-l)/(2*Math.PI));h<=Math.floor((i-l)/(2*Math.PI));h++)c.push(l+h*2*Math.PI);return c}function Zo(e,t,r,n=!0){let[[i,o],[s,a]]=t,c=(i+s)/2,l=r?[Math.cos(r.latitude),0,Math.sin(r.latitude)]:[1,0,0],h=r?Math.cos(r.distance):-1,u=n?-1/0:1/0,f=[NaN,NaN],d=(p,g)=>{if(p=c+ve(p-c),p<i-1e-12||p>s+1e-12||g<o-1e-12||g>a+1e-12)return;let y=qg(p,g);if(r&&kg(l,y)<h-1e-13)return;let _=kg(e,y);(n?_>u:_<u)&&(u=_,f=[p,g])},m=[i,s,...td(-e[1],e[0],0,i,s)];for(let p of m){let g=e[0]*Math.cos(p)+e[1]*Math.sin(p);for(let y of[o,a,...td(e[2],-g,0,o,a)])d(p,y)}if(r){let[p,,g]=l;for(let M of[o,a])for(let T of td(p*Math.cos(M),0,h-g*Math.sin(M),i,s))d(T,M);for(let M of[i,s])for(let T of td(p*Math.cos(M),g,h,o,a))d(M,T);let y=kg(e,l),_=e.map((M,T)=>M-y*l[T]),b=Math.hypot(..._);if(b<=1e-14&&(_=[-l[2],0,l[0]],b=1),b>1e-14)for(let M of[-1,1]){let T=l.map((A,S)=>A*h+M*_[S]*Math.sin(r.distance)/b);d(Math.atan2(T[1],T[0]),Math.atan2(T[2],Math.hypot(T[0],T[1])))}}if(!Number.isFinite(u))throw new Error("CRS coverage does not intersect the rendering domain");return{value:u,point:f}}function se(e,t,r){return[Zo(e,t,r,!1).value,Zo(e,t,r).value]}function Jo(e,t,r,n,i){let o=se(e,n,i),s=se(t,n,i).map(c=>c+r);if(s[0]<=0)throw new Error("Projection rendering denominator is not positive");let a=o.flatMap(c=>s.map(l=>c/l));return[!1,!0].map(c=>{let l=Math.min(...a),h=Math.max(...a);for(let u=0;u<60;u++){let f=(l+h)/2,d=e.map((p,g)=>p-f*t[g]);Zo(d,n,i,c).value-f*r>0?l=f:h=f}return c?h:l})}var kg,wa=w(()=>{Ee();kg=(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2]});function V8(e,t,r,n=Math.PI){let i=[-180,-90,180,90],o=(s,a)=>{let c=jo(s,e.primeMeridian,e.long0),l=K(c[0][0]-e.long0,c[0][1],c[1][0]-e.long0,c[1][1]),h=[Math.cos(e.lat0),0,Math.sin(e.lat0)],u=a?Zo(h,l,void 0,!1).value:-1,d=!a||u<=Math.cos(n)+1e-13?{latitude:e.lat0,distance:t}:void 0,m=Ke(()=>r(l,d),s,e.long0,e.primeMeridian),p=Math.abs(Math.cos(e.lat0))<1e-12,g=(Math.PI/2-t)*180/Math.PI,y=d&&!p&&Wo(_=>{let b=qg(_.x-e.long0,_.y);if(b[0]*Math.cos(e.lat0)+b[2]*Math.sin(e.lat0)>=Math.cos(d.distance)-1e-14)return;if(Math.hypot(b[0]+h[0],b[1],b[2]+h[2])<1e-12){let T=e.lat0+d.distance,A=(l[0][0]+l[1][0])/2,S=A+ve((Math.cos(T)<0?Math.PI:0)-A),v=Math.atan2(Math.sin(T),Math.abs(Math.cos(T)));if(S>=l[0][0]&&S<=l[1][0]&&v>=l[0][1]&&v<=l[1][1]){_.x=S+e.long0,_.y=v;return}}let M=Zo(b,l,d);[_.x,_.y]=[M.point[0]+e.long0,M.point[1]]},e.primeMeridian);return{get bounds(){return r(l,d)},normalize(_){m.normalize(_),d&&p?_.y=e.lat0>0?Math.max(g,_.y):Math.min(-g,_.y):y?.(_);let b=(e.long0+e.primeMeridian)*180/Math.PI,M=_.x-b;Math.abs(M)>180&&(_.x=b+ni(M))}}};return s=>o(s??i,!!s)}function rn(e,t,r,n,i=Math.PI){return{...e,longitudeOrigin:t.long0,getRenderingProfile:V8(t,r,n,i)}}var Qo=w(()=>{Ht();ne();wa();Ee();da()});function ed(e,t,r,n){let i=[-Math.sin(e.lat0),0,Math.cos(e.lat0)],o=[Math.cos(e.lat0),0,Math.sin(e.lat0)],s=[0,1,0],a=n==="stere"?1:0,c=h=>n==="ortho"?se(h,t,r):Jo(h,o,a,t,r),l=e.a*(n==="stere"?2*e.k0:1);return re(At([e.x0,e.x0],Ct(c(s),l)),At([e.y0,e.y0],Ct(c(i),l)))}function dx(e,t,r){let n=Math.sin(e.lat0),i=Math.cos(e.lat0),o=se([0,0,1],t,r);if(Math.abs(n)<1e-15&&(!r||Math.abs(r.distance-Math.PI/2)<1e-15)){let u=d=>{let m=Zo([0,1,0],t,r,d);return m.value/Math.sqrt(1-e.es*Math.sin(m.point[1])**2)},f=d=>(1-e.es)*d/Math.sqrt(1-e.es*d*d);return re(At([e.x0,e.x0],Ct([u(!1),u(!0)],e.a*e.k0)),At([e.y0,e.y0],Ct([f(o[0]),f(o[1])],e.a*e.k0)))}let s=o[0]<=0&&o[1]>=0?0:Math.min(o[0]**2,o[1]**2),a=Math.max(o[0]**2,o[1]**2),c=kn(1/Math.sqrt(1-e.es*s),1/Math.sqrt(1-e.es*a)),l=e.a*e.k0,h=e.es*n*i/Math.sqrt(1-e.es*n*n);return re(At([e.x0,e.x0],Ct(Te(se([0,1,0],t,r),c),l)),At([e.y0+l*h,e.y0+l*h],Ct(Te(se([-n,0,(1-e.es)*i],t,r),c),l)))}function mx(e,t,r){let n=se([Math.cos(e.lat0),0,Math.sin(e.lat0)],t,r)[0],i=e.a/Math.sqrt(1-e.es)*Math.acos(Math.max(-1,Math.min(1,n)));return re([e.x0-i,e.x0+i],[e.y0-i,e.y0+i])}function px(e,t,r,n,i,o,s){let a=i&&se([0,0,1],n,i),c=K(n[0][0],s(a?Math.asin(Math.max(-1,a[0])):n[0][1]),n[1][0],s(a?Math.asin(Math.min(1,a[1])):n[1][1])),l=i&&{latitude:o,distance:Math.PI-(1-e.es)**2*(Math.PI-i.distance)},h=[Math.cos(o),0,Math.sin(o)],u=[-Math.sin(o),0,Math.cos(o)],f=se(h,c,l),d=[Math.sqrt(2/(1+Math.min(1,f[1]))),f[0]>-1+1e-14?Math.sqrt(2/(1+f[0])):1/0],m=(p,g)=>{let y=se(p,c,l),_=y[0]===0?0:y[0]*(y[0]<0?d[1]:d[0]),b=y[1]===0?0:y[1]*(y[1]>0?d[1]:d[0]);return Ct([Math.max(-2,_),Math.min(2,b)],e.a*g)};return re(At([e.x0,e.x0],m([0,1,0],t)),At([e.y0,e.y0],m(u,r)))}function rd(e,t,r,n,i,o,s=1,a=e.e*Math.atanh(e.e)){let c=K(i[0][0]*s,t(i[0][1]),i[1][0]*s,t(i[1][1])),l=2*a+Math.PI*Math.abs(s-1),h=o&&s===1?Math.min(o.distance+l,Math.PI-(1-e.es)*(Math.PI-o.distance)):o&&o.distance+l,u=h&&h<Math.PI?{latitude:r,distance:h}:void 0,f=[Math.cos(r),0,Math.sin(r)],d=[-Math.sin(r),0,Math.cos(r)],p=c[1][0]-c[0][0]>=2*Math.PI?K(-Math.PI,c[0][1],Math.PI,c[1][1]):c,g=Jo([0,1,0],f,1,p,u),y=Jo(d,f,1,p,u);return re(At([e.x0,e.x0],Ct(g,n)),At([e.y0,e.y0],Ct(y,n)))}function gx(e,t,r,n,i,o){let s=[Math.cos(e.lat0),0,Math.sin(e.lat0)],a=[-Math.sin(e.lat0),0,Math.cos(e.lat0)],c=[0,1,0],l=Math.cos(n),h=Math.sin(n),u=Math.cos(r),f=Math.sin(r),d=a.map((_,b)=>l*_+h*c[b]),m=c.map((_,b)=>l*_-h*a[b]),p=s.map((_,b)=>-u*_+f*d[b]),g=Jo(m,p,u*t,i,o),y=Jo(d,p,u*t,i,o);return re(At([e.x0,e.x0],Ct(g,e.a*(t-1)*u)),At([e.y0,e.y0],Ct(y,e.a*(t-1))))}function yx(e,t,r){let n=se([Math.cos(e.lat0),0,Math.sin(e.lat0)],t,r)[0],i=Math.acos(Math.max(-1,Math.min(1,n))),o=1-e.es,s=e.a*i/Math.sqrt(o),a=Math.cos(i/o);if(!(a>0))throw new Error("Gnomonic rendering coverage approaches its ellipsoidal horizon");let c=s/a;return re([e.x0-c,e.x0+c],[e.y0-c,e.y0+c])}var ts=w(()=>{Ht();wa();Ie()});function si(e,t,r,n,i,o,s){let a=i*r/s,c=n*t-o*r*e/s,l=n*e+o*r*t/s;return Math.atan2(l,Math.hypot(a,c))}var bh=w(()=>{});function nn(e,t,r){var n=e*t;return r/Math.sqrt(1-n*n)}var Gc=w(()=>{});function Lr(e,t,r){let n=Math.cos(t);return Math.exp(e*Math.atanh(e*r))*(r>0?n/(1+r):(1-r)/n)}var xh=w(()=>{});function _a(e,t){for(var r=.5*e,n,i,o=U-2*Math.atan(t),s=0;s<=15;s++)if(n=e*Math.sin(o),i=U-2*Math.atan(t*Math.pow((1-n)/(1+n),r))-o,o+=i,Math.abs(i)<=1e-10)return o;return-9999}var nd=w(()=>{Ae()});function wx(e,t,r){return t*=r,Math.tan(.5*(U+e))*Math.pow((1-t)/(1+t),.5*r)}function k8(e){e.x0=e.x0||0,e.y0=e.y0||0,e.lat0=e.lat0||0,e.long0=e.long0||0,e.coslat0=Math.cos(e.lat0),e.sinlat0=Math.sin(e.lat0),e.sphere?!Number.isNaN(e.lat_ts)&&Math.abs(e.coslat0)<=1e-10&&(e.k0=.5*(1+Xo(e.lat0)*Math.sin(e.lat_ts))):(Math.abs(e.coslat0)<=1e-10&&(e.lat0>0?e.con=1:e.con=-1),e.cons=Math.sqrt(Math.pow(1+e.e,1+e.e)*Math.pow(1-e.e,1-e.e)),!Number.isNaN(e.lat_ts)&&Math.abs(e.coslat0)<=1e-10&&Math.abs(Math.cos(e.lat_ts))>1e-10&&(e.k0=.5*e.cons*nn(e.e,Math.sin(e.lat_ts),Math.cos(e.lat_ts))/Lr(e.e,e.con*e.lat_ts,e.con*Math.sin(e.lat_ts))),e.ms1=nn(e.e,e.sinlat0,e.coslat0),e.X0=2*Math.atan(wx(e.lat0,e.sinlat0,e.e))-U,e.cosX0=Math.cos(e.X0),e.sinX0=Math.sin(e.X0))}function _x(e,t){var r=t.x,n=t.y,i=Math.sin(n),o=Math.cos(n),s,a,c,l,h,u,f=G(r-e.long0,e.over);if(Math.abs(Math.abs(r-e.long0)-Math.PI)<=1e-10&&Math.abs(n+e.lat0)<=1e-10)return t.x=NaN,t.y=NaN,t;if(e.sphere&&Math.abs(e.coslat0)<=1e-10){let d=e.lat0>0?1:-1,m=2*e.a*e.k0*Math.tan(Math.PI/4-d*n/2);return t.x=e.x0+m*Math.sin(f),t.y=e.y0-d*m*Math.cos(f),t}return e.sphere?(s=2*e.k0/(1+e.sinlat0*i+e.coslat0*o*Math.cos(f)),t.x=e.a*s*o*Math.sin(f)+e.x0,t.y=e.a*s*(e.coslat0*i-e.sinlat0*o*Math.cos(f))+e.y0,t):(a=2*Math.atan(wx(n,i,e.e))-U,l=Math.cos(a),c=Math.sin(a),Math.abs(e.coslat0)<=1e-10?(h=Lr(e.e,n*e.con,e.con*i),u=2*e.a*e.k0*h/e.cons,t.x=e.x0+u*Math.sin(r-e.long0),t.y=e.y0-e.con*u*Math.cos(r-e.long0),t):(Math.abs(e.sinlat0)<1e-10?(s=2*e.a*e.k0/(1+l*Math.cos(f)),t.y=s*c+e.y0):(s=2*e.a*e.k0*e.ms1/(e.cosX0*(1+e.sinX0*c+e.cosX0*l*Math.cos(f))),t.y=s*(e.cosX0*c-e.sinX0*l*Math.cos(f))+e.y0),t.x=s*l*Math.sin(f)+e.x0,t))}function Mx(e,t){t.x-=e.x0,t.y-=e.y0;var r,n,i,o,s,a=Math.sqrt(t.x*t.x+t.y*t.y);if(e.sphere){var c=2*Math.atan(a/(2*e.a*e.k0));return r=e.long0,n=e.lat0,a<=1e-10?(t.x=r,t.y=n,t):(n=si(e.sinlat0,e.coslat0,Math.sin(c),Math.cos(c),t.x,t.y,a),Math.abs(e.coslat0)<1e-10?e.lat0>0?r=G(e.long0+Math.atan2(t.x,-1*t.y),e.over):r=G(e.long0+Math.atan2(t.x,t.y),e.over):r=G(e.long0+Math.atan2(t.x*Math.sin(c),a*e.coslat0*Math.cos(c)-t.y*e.sinlat0*Math.sin(c)),e.over),t.x=r,t.y=n,t)}else if(Math.abs(e.coslat0)<=1e-10){if(a<=1e-10)return n=e.lat0,r=e.long0,t.x=r,t.y=n,t;t.x*=e.con,t.y*=e.con,i=a*e.cons/(2*e.a*e.k0),n=e.con*_a(e.e,i),r=e.con*G(e.con*e.long0+Math.atan2(t.x,-1*t.y),e.over)}else o=2*Math.atan(a*e.cosX0/(2*e.a*e.k0*e.ms1)),r=e.long0,a<=1e-10?s=e.X0:(s=si(e.sinX0,e.cosX0,Math.sin(o),Math.cos(o),t.x,t.y,a),r=G(e.long0+Math.atan2(t.x*Math.sin(o),a*e.cosX0*Math.cos(o)-t.y*e.sinX0*Math.sin(o)),e.over)),n=-1*_a(e.e,Math.tan(.5*(U+s)));return t.x=r,t.y=n,t}function bx(e){let t={...e,coslat0:0,sinlat0:0,con:0,cons:0,ms1:0,X0:0,cosX0:0,sinX0:0};return k8(t),t}var xx=w(()=>{bh();Ae();Mh();Gc();xh();nd();ue()});var jg,Sx=w(()=>{Qo();ts();yn();xx();jg={name:"stere",aliases:["Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"],parameters:[...ar,...so,"lat_ts"],create(e){let t=er(e),r=bx(t),n=Yo(t,Xe("stere",r,_x,Mx));return rn(n,t,150*Math.PI/180,(i,o)=>r.sphere?ed(r,i,o,"stere"):rd(r,s=>2*Math.atan(Math.tan(Math.PI/4+s/2)*Math.pow((1-r.e*Math.sin(s))/(1+r.e*Math.sin(s)),r.e/2))-Math.PI/2,r.X0,2*r.a*r.k0*(Math.abs(r.coslat0)<1e-10?1/r.cons:r.ms1/r.cosX0),i,o))}}});var Dr=w(()=>{_b();Ab();Pb()});function Sh(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Wg=w(()=>{});var Ma,Hg=w(()=>{Wg();Ma=class{constructor(t,r){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=Sh(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(Sh()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}});var Ni,vx=w(()=>{Hg();Ni=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,r="count"){return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,i=this.stats[r];return i||(t instanceof Ma?i=t:i=new Ma(r,n),this.stats[r]=i),i}}});var id=w(()=>{vx();Hg();Wg()});function ai(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var Ex=w(()=>{"use strict"});var vh,q8,od,j8,W8,$g=w(()=>{vh=globalThis,q8=globalThis.document||{},od=globalThis.process||{},j8=globalThis.console,W8=globalThis.navigator||{}});function sd(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;let t=typeof navigator<"u"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}var ad=w(()=>{});function es(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||sd()}var Yg=w(()=>{ad()});var Tx=w(()=>{Yg();ad();$g()});var Ix=w(()=>{});var Kg,cd=w(()=>{$g();Yg();Tx();ad();Ix();Kg="5.0.0"});function zc(e,t){if(!e)throw new Error(t||"Assertion failed")}var Xg=w(()=>{});function ld(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return zc(Number.isFinite(t)&&t>=0),t}function Zg(e){let{logLevel:t,message:r}=e;e.logLevel=ld(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let i=typeof e.message;return zc(i==="string"||i==="object"),Object.assign(e,{args:n},e.opts)}var hd=w(()=>{Xg()});var rs,ba,Eh=w(()=>{hd();rs=()=>{},ba=class{constructor({level:t=0}={}){this.userData={},this._onceCache=new Set,this._level=t}set level(t){this.setLevel(t)}get level(){return this.getLevel()}setLevel(t){return this._level=t,this}getLevel(){return this._level}warn(t,...r){return this._log("warn",0,t,r,{once:!0})}error(t,...r){return this._log("error",0,t,r)}log(t,r,...n){return this._log("log",t,r,n)}info(t,r,...n){return this._log("info",t,r,n)}once(t,r,...n){return this._log("once",t,r,n,{once:!0})}_log(t,r,n,i,o={}){let s=Zg({logLevel:r,message:n,args:this._buildArgs(r,n,i),opts:o});return this._createLogFunction(t,s,o)}_buildArgs(t,r,n){return[t,r,...n]}_createLogFunction(t,r,n){if(!this._shouldLog(r.logLevel))return rs;let i=this._getOnceTag(n.tag??r.tag??r.message);if((n.once||r.once)&&i!==void 0){if(this._onceCache.has(i))return rs;this._onceCache.add(i)}return this._emit(t,r)}_shouldLog(t){return this.getLevel()>=ld(t)}_getOnceTag(t){if(t!==void 0)try{return typeof t=="string"?t:String(t)}catch{return}}}});function $8(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var Th,Jg=w(()=>{Th=class{constructor(t,r,n="sessionStorage"){this.storage=$8(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}}});function Ax(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function Qg(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var t1=w(()=>{});function Px(e){return typeof e!="string"?e:(e=e.toUpperCase(),Ih[e]||Ih.WHITE)}function e1(e,t,r){return!es&&typeof e=="string"&&(t&&(e=`\x1B[${Px(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${Px(r)+Y8}m${e}\x1B[49m`)),e}var Ih,Y8,ud=w(()=>{cd();(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Ih||(Ih={}));Y8=10});function r1(e,t=["constructor"]){let r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),i=e;for(let o of n){let s=i[o];typeof s=="function"&&(t.find(a=>o===a)||(i[o]=s.bind(e)))}}var n1=w(()=>{});var fd,jn,Ah=w(()=>{cd();fd=class{getHighResolutionTimer(){let t;if(es()&&vh.performance)t=vh?.performance?.now?.();else if("hrtime"in od){let r=od?.hrtime?.();t=r[0]*1e3+r[1]/1e6}else t=Date.now();return t}getMemoryUsageMB(){let r=vh?.performance?.memory?.usedJSHeapSize;return r==null?null:Math.trunc(r/1024/1024)}},jn=new fd;globalThis.Probe=fd;globalThis.probe=jn});function K8(e,t,r){if(typeof t=="string"){let n=r.time?Qg(Ax(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=e1(t,r.color,r.background)}return t}function X8(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var Vc,i1,ao,o1=w(()=>{cd();Eh();Jg();t1();ud();n1();Xg();Ah();hd();hd();Vc={debug:es()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},i1={enabled:!0,level:0},ao=class extends ba{constructor({id:t}={id:""}){super({level:0}),this.VERSION=Kg,this._startTs=jn.getHighResolutionTimer(),this._deltaTs=jn.getHighResolutionTimer(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new Th(`__probe-${this.id}__`,{[this.id]:i1}),this.timeStamp(`${this.id} started`),r1(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((jn.getHighResolutionTimer()-this._startTs).toPrecision(10))}getDelta(){return Number((jn.getHighResolutionTimer()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._updateConfiguration({enabled:t}),this}setLevel(t){return this._updateConfiguration({level:t}),this}get(t){return this._getConfiguration()[t]}set(t,r){this._updateConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){if(!t)throw new Error(r||"Assertion failed")}warn(t,...r){return this._log("warn",0,t,r,{method:Vc.warn,once:!0})}error(t,...r){return this._log("error",0,t,r,{method:Vc.error})}deprecated(t,r){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(t,r){return this.error(`\`${t}\` has been removed. Use \`${r}\` instead`)}probe(t,r,...n){let i=jn.getMemoryUsageMB();if(i!==null){let o=`${i}MB `;typeof r=="function"?r=()=>`${o}${r()}`:typeof r=="string"&&(r=`${o}${r}`)}return this._log("log",t,r,n,{method:Vc.log,time:!0,once:!0})}log(t,r,...n){return this._log("log",t,r,n,{method:Vc.debug})}info(t,r,...n){return this._log("info",t,r,n,{method:console.info})}once(t,r,...n){return this._log("once",t,r,n,{method:Vc.debug||Vc.info,once:!0})}table(t,r,n){return r?this._log("table",t,r,n&&[n]||[],{method:console.table||rs,tag:X8(r)}):rs}time(t,r){return this._log("time",t,r,[],{method:console.time?console.time:console.info})}timeEnd(t,r){return this._log("time",t,r,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(t,r){return this._log("time",t,r,[],{method:console.timeStamp||rs})}group(t,r,n={collapsed:!1}){let i=(n.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",t,r,[],{method:i})}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._log("groupEnd",t,"",[],{method:console.groupEnd||rs})}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&super._shouldLog(t)}_emit(t,r){let n=r.method;zc(n),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=jn.getHighResolutionTimer();let i=K8(this.id,r.message,r);return n.bind(console,i,...r.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(i1),this._storage.config[this.id]}_updateConfiguration(t){let r=this._storage.config[this.id]||{...i1};this._storage.setConfiguration({[this.id]:{...r,...t}})}};ao.VERSION=Kg});var Rx=w(()=>{Eh()});var Cx=w(()=>{Eh()});var Nx=w(()=>{Ah()});var Ox=w(()=>{Ah();globalThis.probe||(globalThis.probe=jn)});var Uz,Bx=w(()=>{o1();Ah();o1();Rx();Eh();Cx();ud();ud();t1();n1();Jg();Nx();Ox();Uz=new ao({id:"@probe.gl/log"})});function J8(){let e=new ao({id:"loaders.gl"});return globalThis.loaders||={},globalThis.loaders.log=e,globalThis.loaders.version=Z8,globalThis.probe||={},globalThis.probe.loaders=e,e}var s1,Z8,Lx,Dx=w(()=>{"use strict";Bx();s1="5.0.0-beta.4",Z8=s1[0]>="0"&&s1[0]<="9"?`v${s1}`:"";Lx=J8()});var Q8,Fx,Ux=w(()=>{"use strict";Q8=e=>e!==null&&typeof e=="object",Fx=e=>Q8(e)&&e.constructor==={}.constructor});function dd(e,t){return Gx(e||{},t)}function Gx(e,t,r=0){if(r>3)return t;let n={...e};for(let[i,o]of Object.entries(t))Fx(o)?n[i]=Gx(n[i]||{},t[i],r+1):n[i]=t[i];return n}var zx=w(()=>{"use strict";Ux()});function md(e,t,r){let n=r!==void 0?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}var Vx=w(()=>{"use strict"});var tC,eC,rC,nC,iC,oC,kc,kx=w(()=>{"use strict";id();tC="Queued Requests",eC="Active Requests",rC="Cancelled Requests",nC="Queued Requests Ever",iC="Active Requests Ever",oC={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},kc=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...oC,...t},this.stats=new Ni({id:this.props.id}),this.stats.get(tC),this.stats.get(eC),this.stats.get(rC),this.stats.get(nC),this.stats.get(iC)}setProps(t){t.throttleRequests!==void 0&&(this.props.throttleRequests=t.throttleRequests),t.maxRequests!==void 0&&(this.props.maxRequests=t.maxRequests),t.debounceTime!==void 0&&(this.props.debounceTime=t.debounceTime)}scheduleRequest(t,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let n={handle:t,priority:0,getPriority:r},i=new Promise(o=>(n.resolve=o,n));return this.requestQueue.push(n),this.requestMap.set(t,i),this._issueNewRequests(),i}_issueRequest(t){let{handle:r,resolve:n}=t,i=!1,o=()=>{i||(i=!0,this.requestMap.delete(r),this.activeRequestCount--,this.scheduleRefill())};return this.activeRequestCount++,n?n({done:o}):Promise.resolve({done:o})}scheduleRefill(){this.updateTimer===null&&(this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let r=0;r<t;++r){let n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){let t=this.requestQueue;for(let r=0;r<t.length;++r){let n=t[r];this._updateRequest(n)||(t.splice(r,1),this.requestMap.delete(n.handle),r--)}t.sort((r,n)=>r.priority-n.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}}});function c1(e,t=[]){return e.every(a1)?e:e.map((r,n)=>{if(a1(r))return r;let i=t.find(s=>s.type===r?.type);if(!i)throw new Error(`No authentication class registered for credential at index ${n}.`);let o;try{o=new i(r)}catch{throw new Error(`Invalid authentication configuration at index ${n}.`)}if(!a1(o))throw new Error(`Authentication class returned an invalid credential at index ${n}.`);return o})}function l1(e){if(!e.core?.credentials?.length)return e;let t=c1(e.core.credentials,e.core.authentications);return t===e.core.credentials?e:{...e,core:{...e.core,credentials:t}}}function a1(e){return!e||typeof e!="object"||typeof e.id!="string"||!Array.isArray(e.origins)?!1:e.type==="request"?typeof e.authenticate=="function":(e.type==="header"||e.type==="query-parameter")&&typeof e.name=="string"&&(typeof e.token=="string"||typeof e.token=="function")&&Array.isArray(e.refreshStatusCodes)}var h1=w(()=>{"use strict"});function u1(){let e=new Error("Request aborted");return e.name="AbortError",e}function qx(e,t,r){let n=e??t;if(n<0||Number.isNaN(n))throw new Error(`${r} must be a non-negative number`);return n}function jx(e){if(!Number.isFinite(e)||e<0)throw new Error("Request cache entry byte length must be a non-negative finite number");return e}var sC,aC,Ph,Wx=w(()=>{"use strict";sC=Number.POSITIVE_INFINITY,aC=Number.POSITIVE_INFINITY,Ph=class{maxEntries;maxBytes;getByteLength;onRemove;entries=new Map;retainedByteLength=0;constructor(t={}){this.maxEntries=qx(t.maxEntries,sC,"maxEntries"),this.maxBytes=qx(t.maxBytes,aC,"maxBytes"),this.getByteLength=t.getByteLength||(()=>0),this.onRemove=t.onRemove}get size(){return this.entries.size}get pendingSize(){let t=0;for(let r of this.entries.values())t+=r.pending?1:0;return t}get byteLength(){return this.retainedByteLength}get(t,r){let n=this.entries.get(t);if(n)return this.touch(t,n),this.waitForEntry(t,n,r)}has(t){return this.entries.has(t)}set(t,r){this.removeEntry(t,"replace");let n=jx(this.getByteLength(r)),i={promise:Promise.resolve(r),pending:!1,waiterCount:0,byteLength:n};return this.entries.set(t,i),this.retainedByteLength+=n,this.trim(),r}getOrLoad(t,r,n){let i=this.get(t,n);if(i)return i;if(n?.aborted)return Promise.reject(u1());let o=new AbortController,s,a,l={promise:new Promise((h,u)=>{s=h,a=u}),controller:o,pending:!0,waiterCount:0,byteLength:0};this.entries.set(t,l),l.promise.then(h=>this.handleLoadedValue(t,l,h),()=>this.handleLoadError(t,l));try{Promise.resolve(r(o.signal)).then(s,a)}catch(h){a(h)}return this.waitForEntry(t,l,n)}delete(t){return this.removeEntry(t,"delete")}clear(){for(let t of Array.from(this.entries.keys()))this.removeEntry(t,"clear")}handleLoadedValue(t,r,n){if(this.entries.get(t)===r){r.pending=!1,r.controller=void 0;try{r.byteLength=jx(this.getByteLength(n))}catch{this.removeEntry(t,"error");return}this.retainedByteLength+=r.byteLength,this.trim()}}handleLoadError(t,r){this.entries.get(t)===r&&this.removeEntry(t,r.controller?.signal.aborted?"abort":"error")}waitForEntry(t,r,n){return n?.aborted?Promise.reject(u1()):r.pending?(r.waiterCount++,new Promise((i,o)=>{let s=!0,a=()=>{s&&(s=!1,n?.removeEventListener("abort",c),r.waiterCount--)},c=()=>{s&&(a(),o(u1()),r.pending&&r.waiterCount===0&&this.entries.get(t)===r&&this.removeEntry(t,"abort"))};n?.addEventListener("abort",c,{once:!0}),r.promise.then(l=>{s&&(a(),i(l))},l=>{s&&(a(),o(l))})})):r.promise}touch(t,r){this.entries.delete(t),this.entries.set(t,r)}trim(){let t=this.entries.size-this.pendingSize;if(!(t<=this.maxEntries&&this.retainedByteLength<=this.maxBytes)){for(let[r,n]of this.entries)if(n.pending||(this.removeEntry(r,"evict"),t--),t<=this.maxEntries&&this.retainedByteLength<=this.maxBytes)break}}removeEntry(t,r){let n=this.entries.get(t);return n?(this.entries.delete(t),this.retainedByteLength-=n.byteLength,n.pending&&n.controller?.abort(),this.onRemove?.(t,r),!0):!1}}});function cC(e){let t=e.fetch||((u,f)=>fetch(u,f)),r=t[Hx],n=new Map(r?.credentialResolutions),i=c1(e.credentials.map(u=>n.get(u)||u),e.authentications);if(e.credentials.forEach((u,f)=>{n.set(u,i[f])}),!e.fetchOptions&&(!i.length||r?.credentials.length===i.length&&i.every((u,f)=>u===r.credentials[f])))return t;let o=r?.fetch||t,s=r?[...new Set([...i,...r.credentials])]:i,a=$x(r?.fetchOptions||{},e.fetchOptions),c=s.filter(u=>u.type!=="request"),l=s.filter(u=>u.type==="request");for(let u of l)Jx(u.origins);let h=async(u,f={})=>{if(f=$x(a,f),f.signal?.throwIfAborted(),!s.length)return o(u,f);let d=uC(u),m=d?await Kx(d,f,c):{url:u,options:f,credentials:[]},p=await Yx(m,l,"request"),g=await o(p.url,p.options),y=[];for(let A of m.credentials){let{credential:S}=A;typeof S.token=="function"&&(pd(f)||S.canReplayRequest?.(u,f))&&(pd(p.options)||S.canReplayRequest?.(p.url,p.options))&&(S.refreshStatusCodes.includes(g.status)||await S.shouldRefresh?.(g))&&y.push(A)}let _=pd(f)&&pd(p.options)&&p.credentials.some(A=>A.refreshStatusCodes?.includes(g.status));if(!y.length&&!_)return g;f.signal?.throwIfAborted();let b=new Map;if(await Promise.all(y.map(async({credential:A})=>{let S=await lC(A,u,g);S&&b.set(A,S)})),!b.size&&!_)return g;await g.body?.cancel().catch(()=>{}),f.signal?.throwIfAborted();let M=d?await Kx(d,f,c,b,m.credentials):{url:u,options:f},T=await Yx(M,l,"retry",g);return o(T.url,T.options)};return Object.defineProperty(h,Hx,{value:{fetch:o,credentials:s,credentialResolutions:n,fetchOptions:a}}),h}function Xx(e={}){let t=e.fetch??e.core?.fetch,r;typeof t=="function"?r=t:r=(i,o)=>fetch(i,o);let n=typeof t=="object"&&t?t:void 0;return cC({fetch:r,fetchOptions:e.signal?{...n,signal:e.signal}:n,credentials:e.core?.credentials||[],authentications:e.core?.authentications})}function $x(e,t){let r={...e,...t};if(e.headers||t?.headers){let n=new Headers(e.headers);new Headers(t?.headers).forEach((i,o)=>n.set(o,i)),r.headers=n}return r}async function Yx(e,t,r,n){let i=[],o=e.options.signal;for(let s of t){let a=Zx(e.url);if(!a||!Jx(s.origins).includes(a))continue;o?.throwIfAborted();let c=await s.authenticate({url:e.url,options:{...e.options,headers:new Headers(e.options.headers)},reason:r,response:n?{status:n.status,headers:new Headers(n.headers)}:void 0});if(!c||typeof c.url!="string"||!c.options||typeof c.options!="object")throw new Error("Authentication callback returned an invalid request.");e={url:c.url,options:{...c.options,...o?{signal:o}:{}}},i.push(s)}return o?.throwIfAborted(),{...e,credentials:i}}function Zx(e){try{let t=new URL(e);return!t.host||t.username||t.password?null:t.origin!=="null"?t.origin:`${t.protocol}//${t.host}`}catch{return null}}function Jx(e){if(!e.length)throw new Error("Request authentication requires at least one exact origin.");return e.map(t=>{let r=Zx(t),n;try{n=new URL(t)}catch{throw new Error("Invalid request authentication origin.")}if(!r||n.pathname&&n.pathname!=="/"||n.search||n.hash)throw new Error("Invalid request authentication origin.");return r})}async function Kx(e,t,r,n=new Map,i=[]){let o=new URL(e),s=new Headers(t.headers),a=[],c=new Map(i.map(({credential:l,token:h})=>[l,h]));for(let l of r){if(!l.origins.includes(o.origin))continue;let h=n.get(l),u=c.get(l),f=l.type==="query-parameter"&&u!==void 0,d=l.type==="header"&&u!==void 0;if(l.type==="query-parameter"&&o.searchParams.has(l.name)&&!f||l.type==="header"&&s.has(l.name)&&!d)continue;let m=h??u??await hC(l.token,{url:e.toString(),reason:"request"});m&&(l.type==="query-parameter"?o.searchParams.set(l.name,m):s.set(l.name,`${l.prefix||""}${m}`),a.push({credential:l,token:m}))}return{url:o.toString(),options:{...t,headers:s},credentials:a}}async function lC(e,t,r){let n=f1.get(e);if(n)return n;let i=e.token,o=Promise.resolve(i({url:t,reason:"refresh",response:{status:r.status,headers:r.headers}})).finally(()=>f1.delete(e));return f1.set(e,o),o}async function hC(e,t){return typeof e=="function"?e(t):e}function uC(e){try{let t=new URL(e);return["http:","https:"].includes(t.protocol)?t:null}catch{return null}}function pd(e){let t=(e.method||"GET").toUpperCase();return["GET","HEAD","OPTIONS","PUT","DELETE"].includes(t)?!(e.body&&typeof ReadableStream<"u"&&e.body instanceof ReadableStream):!1}var Hx,f1,Qx=w(()=>{"use strict";h1();Hx=Symbol("loaders.gl.authenticated-fetch"),f1=new WeakMap});function fC(e,t){switch((t.type==="response"||t.type==="error")&&t.networkTimeMs!==void 0&&e.get(fe.networkTimeMs,"time").addTime(t.networkTimeMs),t.type){case"queued":e.get(fe.logicalRanges,"count").incrementCount(),e.get(fe.requestedBytes,"count").addCount(t.logicalBytes||0);break;case"batch":e.get(fe.rangeBatches,"count").incrementCount(),e.get("Logical Ranges Batched","count").addCount(t.logicalRequestCount||0),e.get(fe.transportRanges,"count").addCount(t.transportRequestCount||0),e.get(fe.coalescedRanges,"count").addCount(Math.max((t.logicalRequestCount||0)-(t.transportRequestCount||0),0)),e.get(fe.transportBytes,"count").addCount(t.transportBytes||0),e.get(fe.overfetchBytes,"count").addCount(t.overfetchBytes||0);break;case"response":e.get(fe.completedTransportRanges,"count").incrementCount(),e.get(fe.responseBytes,"count").addCount(t.responseBytes||0),t.fullResponse&&e.get(fe.fullResponseFallbacks,"count").incrementCount();break;case"error":e.get(fe.failedTransportRanges,"count").incrementCount();break;case"abort":e.get(fe.abortedLogicalRanges,"count").incrementCount();break;default:}}function rS(e="range-request-scheduler"){let t=new Ni({id:e});return nS(t),t}async function dC(e){let t=_C(e.signal),r=Rh();try{let n=!1,i=await e.fetch(e.url,tS(e.fetchOptions,e.offset,e.length,t.signal));if(i.status===416&&e.offset===0){let c=yC(i.headers.get("Content-Range"));if(!c)throw new Error("Missing content-length on 416 response");i=await e.fetch(e.url,tS(e.fetchOptions,0,c,t.signal)),n=!0}if(i.status===200)throw t.abort(),await MC(i),new Error("Byte-range request failed: server returned 200 instead of 206");if(i.status!==206&&!i.ok)throw new Error(`Bad response code: ${i.status}`);let o=await i.arrayBuffer(),s=i.headers.get("Content-Range"),a=wC(s);if(s&&!a)throw new Error(`Invalid Content-Range header: ${s}`);if(a){let c=a.endOffset-a.offset+1,l=e.offset+e.length-1;if(a.offset!==e.offset||a.endOffset>l||c!==o.byteLength||a.sourceByteLength!==void 0&&a.endOffset>=a.sourceByteLength)throw new Error(`Content-Range does not match requested range: ${s}`)}return{arrayBuffer:o,status:i.status,sourceByteLength:a?.sourceByteLength,transportBytes:o.byteLength,networkTimeMs:Rh()-r,fullResponse:n}}finally{t.removeAbortListener()}}function mC(e,t,r){if(e.sourceId!==t.sourceId||e.isolationKey!==(t.isolationKey??t.sourceId))return!1;let n=t.offset+t.length,i=t.offset-e.endOffset,o=Math.max(e.endOffset,n)-e.offset;return i<=r.rangeExpansionBytes&&o<=r.maxMergedBytes}function nS(e){e.get(fe.logicalRanges,"count"),e.get(fe.requestedBytes,"count"),e.get(fe.rangeBatches,"count"),e.get("Logical Ranges Batched","count"),e.get(fe.transportRanges,"count"),e.get(fe.coalescedRanges,"count"),e.get(fe.transportBytes,"count"),e.get(fe.completedTransportRanges,"count"),e.get(fe.responseBytes,"count"),e.get(fe.networkTimeMs,"time"),e.get(fe.overfetchBytes,"count"),e.get(fe.fullResponseFallbacks,"count"),e.get(fe.failedTransportRanges,"count"),e.get(fe.abortedLogicalRanges,"count")}function d1(e){return e.reduce((t,r)=>t+r.length,0)}function pC(e){return e instanceof ArrayBuffer?{arrayBuffer:e}:e}function tS(e,t,r,n){return{...e,signal:n,headers:{...gC(e?.headers),Range:`bytes=${t}-${t+r-1}`}}}function gC(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e:{}}function yC(e){let t=e?.match(/^bytes \*\/(\d+)$/);return t?Number(t[1]):null}function wC(e){let t=e?.match(/^bytes (\d+)-(\d+)\/(\d+|\*)$/);if(!t)return null;let r=Number(t[1]),n=Number(t[2]),i=t[3]==="*"?void 0:Number(t[3]);return!Number.isSafeInteger(r)||!Number.isSafeInteger(n)||r>n||i!==void 0&&!Number.isSafeInteger(i)?null:{offset:r,endOffset:n,sourceByteLength:i}}function _C(e){let t=new AbortController,r=()=>t.abort(e?.reason);return e?.aborted?t.abort(e?.reason):e?.addEventListener("abort",r,{once:!0}),{signal:t.signal,abort:()=>t.abort(),removeAbortListener:()=>e?.removeEventListener("abort",r)}}async function MC(e){await e.body?.cancel().catch(()=>{})}function Rh(){return globalThis.performance?.now()??Date.now()}function eS(){if(typeof DOMException<"u")return new DOMException("Request aborted","AbortError");let e=new Error("Request aborted");return e.name="AbortError",e}var fe,gd,yd,iS=w(()=>{"use strict";id();fe={logicalRanges:"Logical Range Requests",rangeBatches:"Range Request Batches",transportRanges:"Transport Ranges Created",completedTransportRanges:"Range Transport Requests Completed",coalescedRanges:"Coalesced Logical Ranges",requestedBytes:"Logical Range Request Bytes",transportBytes:"Range Transport Bytes Requested",responseBytes:"Range Response Bytes",networkTimeMs:"Range Network Time",overfetchBytes:"Range Overfetch Bytes",failedTransportRanges:"Range Transport Requests Failed",abortedLogicalRanges:"Aborted Logical Range Requests",fullResponseFallbacks:"Full Response Fallbacks"},gd={batchDelayMs:50,maxGapBytes:65536,rangeExpansionBytes:65536,maxMergedBytes:8388608,maxConcurrency:6,maxQueueSize:4096,maxRangeBytes:64*1024*1024,maxTotalBytes:Number.MAX_SAFE_INTEGER,stats:rS("range-request-scheduler-default"),onEvent:()=>{}},yd=class{props;stats;onEvent;pendingRequests=[];transportQueue=[];activeTransports=0;reservedTransportBytes=0;queuedRequests=0;logicalRequests=new Set;transportControllers=new Set;finalized=!1;flushTimer=null;constructor(t={}){let r=t.rangeExpansionBytes??t.maxGapBytes??gd.rangeExpansionBytes;this.props={batchDelayMs:t.batchDelayMs??gd.batchDelayMs,maxGapBytes:t.maxGapBytes??r,rangeExpansionBytes:r,maxMergedBytes:t.maxMergedBytes??gd.maxMergedBytes,maxConcurrency:t.maxConcurrency??6,maxQueueSize:t.maxQueueSize??4096,maxRangeBytes:t.maxRangeBytes??64*1024*1024,maxTotalBytes:t.maxTotalBytes??gd.maxTotalBytes};for(let n of[this.props.maxConcurrency,this.props.maxQueueSize,this.props.maxRangeBytes,this.props.maxTotalBytes])if(!Number.isSafeInteger(n)||n<=0)throw new Error("Range scheduler limits must be positive integers");this.stats=t.stats||rS("range-request-scheduler"),this.onEvent=t.onEvent,nS(this.stats)}scheduleRequest(t){if(this.finalized)return Promise.reject(new Error("Range scheduler is finalized"));if(!Number.isSafeInteger(t.offset)||t.offset<0||!Number.isSafeInteger(t.length)||t.length>this.props.maxRangeBytes||!Number.isSafeInteger(t.offset+t.length))return Promise.reject(new Error("Invalid or oversized byte range"));if(this.queuedRequests>=this.props.maxQueueSize)return Promise.reject(new Error("Range scheduler queue limit exceeded"));if(t.length<0)return Promise.reject(new Error("Byte range length cannot be negative"));if(t.signal?.aborted)return Promise.reject(t.signal.reason??eS());if(t.length===0)return Promise.resolve(new ArrayBuffer(0));this.queuedRequests++;let r,n=new Promise((i,o)=>{r={...t,resolve:i,reject:o,settled:!1},this.logicalRequests.add(r),t.signal&&(r.abortListener=()=>{this.abortRequest(r),r.onAbort?.()},t.signal.addEventListener("abort",r.abortListener,{once:!0})),this.pendingRequests.push(r)});return this.trackEvent({type:"queued",sourceId:t.sourceId,offset:t.offset,length:t.length,logicalRequestCount:1,logicalBytes:t.length}),this.scheduleFlush(),n.finally(()=>{r.abortListener&&t.signal?.removeEventListener("abort",r.abortListener),this.queuedRequests--,this.logicalRequests.delete(r)})}fetch(t){let r=t.fetch||globalThis.fetch;return this.scheduleRequest({sourceId:t.sourceId||t.url,offset:t.offset,length:t.length,signal:t.signal,isolationKey:t.isolationKey??{},fetchRange:(n,i,o)=>dC({url:t.url,offset:n,length:i,signal:o,fetch:r,fetchOptions:t.fetchOptions})})}flush(){this.flushTimer!==null&&(clearTimeout(this.flushTimer),this.flushTimer=null);let t=this.pendingRequests;this.pendingRequests=[];let r=t.filter(i=>i.settled||i.signal?.aborted?(this.abortRequest(i),!1):!0),n=this.mergeRequests(r);r.length>0&&this.trackBatch(r,n),this.transportQueue.push(...n),this.startQueuedTransports()}finalize(){this.finalized=!0,this.flushTimer!==null&&clearTimeout(this.flushTimer),this.flushTimer=null;for(let t of this.logicalRequests)this.abortRequest(t),t.abortListener&&t.signal?.removeEventListener("abort",t.abortListener);for(let t of this.transportControllers)t.abort();this.transportQueue=[],this.pendingRequests=[],this.logicalRequests.clear()}startQueuedTransports(){for(;this.activeTransports<this.props.maxConcurrency&&this.transportQueue.length;){let t=this.transportQueue.shift();this.activeTransports++,this.fetchMergedRequest(t).finally(()=>{this.activeTransports--,this.startQueuedTransports()})}}scheduleFlush(){this.flushTimer===null&&(this.flushTimer=setTimeout(()=>this.flush(),this.props.batchDelayMs))}mergeRequests(t){t.sort((n,i)=>n.sourceId!==i.sourceId?n.sourceId<i.sourceId?-1:1:n.offset-i.offset);let r=[];for(let n of t){let i=n.offset+n.length,o=r[r.length-1];o&&mC(o,n,this.props)?(o.endOffset=Math.max(o.endOffset,i),o.requests.push(n)):r.push({sourceId:n.sourceId,isolationKey:n.isolationKey??n.sourceId,offset:n.offset,endOffset:i,fetchRange:n.fetchRange,requests:[n]})}return r}async fetchMergedRequest(t){let{offset:r,endOffset:n,fetchRange:i,requests:o}=t,s=new AbortController;this.transportControllers.add(s);let a=Rh(),c=()=>{o.every(l=>l.settled||l.signal?.aborted)&&s.abort()};try{for(let g of o)g.onAbort=c;if(c(),o.every(g=>g.settled))return;let l=d1(o),h=n-r;if(h>this.props.maxTotalBytes-this.reservedTransportBytes)throw new RangeError("Range request total byte limit exceeded");this.reservedTransportBytes+=h,this.trackEvent({type:"request",sourceId:t.sourceId,offset:r,length:h,logicalRequestCount:o.length,logicalBytes:l,transportBytes:h,overfetchBytes:Math.max(h-l,0)});let u=pC(await i(r,h,s.signal)),{arrayBuffer:f}=u,d=u.fullResponse&&r===0&&f.byteLength<h,m=f.byteLength<h&&Number.isSafeInteger(u.sourceByteLength)&&r+f.byteLength===u.sourceByteLength;if(f.byteLength!==h&&!d&&!m)throw new Error(`Byte-range transport returned ${f.byteLength} bytes; expected ${h}`);let p=u.networkTimeMs??Rh()-a;this.trackEvent({type:"response",sourceId:t.sourceId,offset:r,length:h,logicalRequestCount:o.length,logicalBytes:l,transportBytes:h,responseBytes:u.transportBytes??f.byteLength,networkTimeMs:p,overfetchBytes:Math.max(h-l,0),status:u.status,fullResponse:u.fullResponse});for(let g of o){if(g.settled)continue;let y=g.offset-r;g.settled=!0,g.resolve(f.slice(y,y+g.length))}}catch(l){s.signal.aborted||this.trackEvent({type:"error",sourceId:t.sourceId,offset:r,length:n-r,logicalRequestCount:o.length,logicalBytes:d1(o),networkTimeMs:Rh()-a,error:l});for(let h of o)h.settled||(h.signal?.aborted?this.abortRequest(h):(h.settled=!0,h.reject(l)))}finally{this.transportControllers.delete(s);for(let l of o)l.abortListener&&l.signal?.removeEventListener("abort",l.abortListener),l.onAbort=void 0}}abortRequest(t){if(!t.settled){t.settled=!0,this.pendingRequests=this.pendingRequests.filter(r=>r!==t);for(let r of this.transportQueue)r.requests=r.requests.filter(n=>!n.settled),r.requests.length&&(r.offset=Math.min(...r.requests.map(n=>n.offset)),r.endOffset=Math.max(...r.requests.map(n=>n.offset+n.length)));this.transportQueue=this.transportQueue.filter(r=>r.requests.length>0),t.reject(t.signal?.reason??eS()),this.trackEvent({type:"abort",sourceId:t.sourceId,offset:t.offset,length:t.length,logicalRequestCount:1,logicalBytes:t.length})}}trackEvent(t){fC(this.stats,t);try{this.onEvent?.(t)}catch{}}trackBatch(t,r){let n=d1(t),i=r.reduce((o,s)=>o+s.endOffset-s.offset,0);this.trackEvent({type:"batch",logicalRequestCount:t.length,transportRequestCount:r.length,logicalBytes:n,transportBytes:i,overfetchBytes:Math.max(i-n,0)})}}});function sS(e){for(let t in oS)if(e.startsWith(t)){let r=oS[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${bC}${e}`),e}var bC,oS,aS=w(()=>{"use strict";bC="",oS={}});function cS(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=globalThis.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}var lS=w(()=>{"use strict"});var wn={};Zr(wn,{dirname:()=>SC,filename:()=>xC,join:()=>vC,resolve:()=>EC});function xC(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):e}function SC(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function vC(...e){return e=e.map((r,n)=>(n&&(r=r.replace(new RegExp("^/"),"")),n!==e.length-1&&(r=r.replace(new RegExp("/$"),"")),r)),e.join("/")}function EC(...e){let t=[];for(let o=0;o<e.length;o++)t[o]=e[o];let r="",n=!1,i;for(let o=t.length-1;o>=-1&&!n;o--){let s;o>=0?s=t[o]:(i===void 0&&(i=cS()),s=i),s.length!==0&&(r=`${s}/${r}`,n=s.charCodeAt(0)===Ch)}return r=TC(r,!n),n?`/${r}`:r.length>0?r:"."}function TC(e,t){let r="",n=-1,i=0,o,s=!1;for(let a=0;a<=e.length;++a){if(a<e.length)o=e.charCodeAt(a);else{if(o===Ch)break;o=Ch}if(o===Ch){if(!(n===a-1||i===1))if(n!==a-1&&i===2){if(r.length<2||!s||r.charCodeAt(r.length-1)!==m1||r.charCodeAt(r.length-2)!==m1){if(r.length>2){let c=r.length-1,l=c;for(;l>=0&&r.charCodeAt(l)!==Ch;--l);if(l!==c){r=l===-1?"":r.slice(0,l),n=a,i=0,s=!1;continue}}else if(r.length===2||r.length===1){r="",n=a,i=0,s=!1;continue}}t&&(r.length>0?r+="/..":r="..",s=!0)}else{let c=e.slice(n+1,a);r.length>0?r+=`/${c}`:r=c,s=!1}n=a,i=0}else o===m1&&i!==-1?++i:i=-1}return r}var Ch,m1,hS=w(()=>{"use strict";lS();Ch=47,m1=46});var qc,uS=w(()=>{"use strict";qc=class{handle;size;bigsize;url;constructor(t){this.handle=t instanceof ArrayBuffer?new Blob([t]):t,this.size=t instanceof ArrayBuffer?t.byteLength:t.size,this.bigsize=BigInt(this.size),this.url=t instanceof File?t.name:""}async close(){}async stat(){return{size:this.handle.size,bigsize:BigInt(this.handle.size),isDirectory:!1}}async read(t,r,n){if(n?.aborted)throw new Error("Request aborted");let i=await this.handle.slice(Number(t),Number(t)+Number(r)).arrayBuffer();if(n?.aborted)throw new Error("Request aborted");return i}}});function fS(e,t){return t?t.aborted?(e.catch(()=>{}),Promise.reject(t.reason)):new Promise((r,n)=>{let i=()=>{t.removeEventListener("abort",i),n(t.reason)};t.addEventListener("abort",i,{once:!0}),e.then(o=>{t.removeEventListener("abort",i),r(o)},o=>{t.removeEventListener("abort",i),n(o)})}):e}var dS=w(()=>{"use strict"});function IC(e,t,r,n){let i=new Headers(e?.headers);return i.set("Range",`bytes=${t}-${t+r-1}`),{...e,method:"GET",body:void 0,headers:i,signal:n}}function AC(e,t,r,n){return e.status===416&&n===null&&t===0&&r===1&&/^bytes \*\/0$/i.test(e.headers.get("Content-Range")||"")}async function PC(e){try{return RC(e.headers.get("Content-Range"))}catch(t){throw await _d(e),t}}function RC(e){let t=e?.match(/^bytes (\d+)-(\d+)\/(\d+)$/);if(!t)throw new Error("HTTP byte-range response has an invalid Content-Range header");return{offset:Number(t[1]),endOffset:Number(t[2]),byteLength:Number(t[3])}}function mS(e,t){return bd(t,xd(e.headers.get("ETag")),xd(e.headers.get("Last-Modified")))}function pS(e,t,r){return e||bd(t.byteLength,t.etag??r.etag,t.lastModified??r.lastModified)}function CC(e,t,r){return!Number.isSafeInteger(e.offset)||!Number.isSafeInteger(e.endOffset)||!Number.isSafeInteger(e.byteLength)||e.offset<0||e.endOffset<e.offset||e.endOffset>=e.byteLength?"HTTP byte-range response has invalid range bounds":e.offset!==t||e.endOffset!==t+r-1?"HTTP byte-range response does not match the requested range":null}function gS(e,t,r,n){let i=e?.byteLength??r.byteLength;if(i!==void 0&&t.byteLength!==i)return"HTTP file length changed while the file was open";let o=e?.etag??r.etag,s=e?.lastModified??r.lastModified;return o?t.etag?o===t.etag?null:"HTTP file ETag changed while the file was open":n==="strict"?"HTTP byte-range response is missing the pinned ETag":s&&t.lastModified&&s!==t.lastModified?"HTTP file Last-Modified value changed while the file was open":null:s?t.lastModified&&s!==t.lastModified?"HTTP file Last-Modified value changed while the file was open":n==="strict"&&!t.lastModified?"HTTP byte-range response is missing the pinned Last-Modified value":null:n==="strict"&&!t.etag&&!t.lastModified?"HTTP byte-range response does not provide an ETag or Last-Modified validator":null}function bd(e,t,r){return Object.freeze({byteLength:e,etag:t,lastModified:r})}function NC(e){if(e!==void 0&&(!Number.isSafeInteger(e)||e<0))throw new Error("HttpFile byteLength must be a non-negative safe integer")}async function _d(e){await e.body?.cancel().catch(()=>{})}function xd(e){return e||void 0}function wd(){return globalThis.performance?.now()??Date.now()}function yS(e){return e instanceof Error&&e.name==="AbortError"||e instanceof Error&&/aborted/i.test(e.message)}function OC(...e){let t=new AbortController,r=[...new Set(e.filter(i=>!!i))],n=()=>t.abort();for(let i of r)i.aborted?t.abort():i.addEventListener("abort",n,{once:!0});return{signal:t.signal,removeAbortListeners:()=>{for(let i of r)i.removeEventListener("abort",n)}}}var Md,wS=w(()=>{"use strict";Md=class{url;fetchFunction;fetchOptions;consistency;identityHints;countedFailures=new WeakSet;telemetry={requestedBytes:0,downloadedBytes:0,requestCount:0,networkTimeMs:0,abortCount:0,errorCount:0};constructor(t,r){NC(r.byteLength),this.url=t,this.fetchFunction=r.fetch||((n,i)=>globalThis.fetch(n,i)),this.fetchOptions=r.fetchOptions?{...r.fetchOptions,headers:new Headers(r.fetchOptions.headers)}:void 0,this.consistency=r.consistency||"best-effort",this.identityHints={byteLength:r.byteLength,etag:xd(r.etag),lastModified:xd(r.lastModified)}}getInitialIdentity(){let{byteLength:t,etag:r,lastModified:n}=this.identityHints;return t!==void 0&&(r!==void 0||n!==void 0)?bd(t,r,n):t===0&&this.consistency==="best-effort"?bd(0):null}getTelemetry(){return Object.freeze({...this.telemetry})}trackFailure(t){if(typeof t=="object"&&t!==null){if(this.countedFailures.has(t))return;this.countedFailures.add(t)}yS(t)?this.telemetry.abortCount++:this.telemetry.errorCount++}async requestRange(t,r,n,i){let o=wd(),s=OC(n,this.fetchOptions?.signal);this.telemetry.requestCount++,this.telemetry.requestedBytes+=r;try{let a=await this.fetchFunction(this.url,IC(this.fetchOptions,t,r,s.signal));if(AC(a,t,r,i))return await this.readEmptyIdentityProbe(a,o);if(a.status!==206)throw await _d(a),new Error(`HTTP byte-range request expected 206, received ${a.status}`);let c=await PC(a),l=mS(a,c.byteLength),h=gS(i,l,this.identityHints,this.consistency)||CC(c,t,r);if(h)throw await _d(a),new Error(h);let u=await a.arrayBuffer();if(this.telemetry.downloadedBytes+=u.byteLength,u.byteLength!==r)throw new Error(`HTTP byte-range response contained ${u.byteLength} bytes; expected ${r}`);return{arrayBuffer:u,identity:pS(i,l,this.identityHints),status:a.status,transportBytes:u.byteLength,networkTimeMs:wd()-o}}catch(a){throw(i===null||!yS(a))&&this.trackFailure(a),a}finally{s.removeAbortListeners(),this.telemetry.networkTimeMs+=wd()-o}}async readEmptyIdentityProbe(t,r){let n=mS(t,0),i=gS(null,n,this.identityHints,this.consistency);if(await _d(t),i)throw new Error(i);return{arrayBuffer:new ArrayBuffer(0),identity:pS(null,n,this.identityHints),status:t.status,transportBytes:0,networkTimeMs:wd()-r}}}});function BC(e,t,r){let n=new Headers;return r>0&&e&&n.set("Content-Range",`bytes ${t}-${t+r-1}/${e.byteLength}`),e?.etag&&n.set("ETag",e.etag),e?.lastModified&&n.set("Last-Modified",e.lastModified),n}function _S(e){let t=Number(e);if(!Number.isSafeInteger(t)||t<0)throw new Error("HTTP byte-range offset must be a non-negative safe integer");return t}function LC(e,t,r){if(!Number.isSafeInteger(t)||t<0)throw new Error("HTTP byte-range length must be a non-negative safe integer");if(e+t>r)throw new Error("HTTP byte range extends beyond the end of the file")}function MS(){if(typeof DOMException<"u")return new DOMException("Request aborted","AbortError");let e=new Error("Request aborted");return e.name="AbortError",e}var Nh,bS=w(()=>{"use strict";dS();iS();wS();Nh=class e{handle;url;transport;rangeScheduler;schedulerIsolationKey={};suppliedByteLength;identity;openPromise=null;closed=!1;constructor(t,r={}){this.handle=t,this.url=t,this.transport=new Md(t,r),this.rangeScheduler=r.rangeScheduler||new yd({batchDelayMs:0,...r.rangeSchedulerProps}),this.suppliedByteLength=r.byteLength,this.identity=this.transport.getInitialIdentity()}static async open(t,r={},n){let i=new e(t,r);return await i.open(n),i}async open(t){if(this.assertOpen(),t?.aborted){let r=MS();throw this.transport.trackFailure(r),r}return await this.getIdentity(t),this}get size(){return this.identity?.byteLength??this.suppliedByteLength??0}get bigsize(){return BigInt(this.size)}getIdentitySnapshot(){return this.identity}getTelemetry(){return this.transport.getTelemetry()}async close(){this.closed=!0}async stat(){this.assertOpen();let t=await this.getIdentity();return{size:t.byteLength,bigsize:BigInt(t.byteLength),isDirectory:!1}}async read(t=0,r=0,n){if(this.assertOpen(),n?.aborted){let s=MS();throw this.transport.trackFailure(s),s}let i=await this.getIdentity(n),o=_S(t);if(LC(o,r,i.byteLength),r===0)return new ArrayBuffer(0);try{return await this.rangeScheduler.scheduleRequest({sourceId:this.url,isolationKey:this.schedulerIsolationKey,offset:o,length:r,signal:n,fetchRange:this.fetchScheduledRange})}catch(s){throw this.transport.trackFailure(s),s}}async fetchRange(t,r,n){let i=_S(t),o=await this.read(i,r,n),s=BC(this.identity,i,r);return new Response(o,{status:206,headers:s})}fetchScheduledRange=async(t,r,n)=>{let i=await this.getIdentity(n),o=await this.transport.requestRange(t,r,n,i);return{arrayBuffer:o.arrayBuffer,status:o.status,transportBytes:o.transportBytes,networkTimeMs:o.networkTimeMs}};getIdentity(t){if(this.identity)return Promise.resolve(this.identity);if(!this.openPromise){let n=this.probeIdentity().catch(i=>{throw this.openPromise===n&&(this.openPromise=null),i});this.openPromise=n}return fS(this.openPromise,t).catch(r=>{throw this.transport.trackFailure(r),r})}async probeIdentity(){try{let t=await this.transport.requestRange(0,1,void 0,null);return this.identity=t.identity,t.identity}catch(t){throw this.transport.trackFailure(t),t}}assertOpen(){if(this.closed)throw new Error("HttpFile is closed")}}});function xS(e){return Xx(e)}function SS(e){if(e.loadOptions!==void 0||e.core?.loadOptions!==void 0)throw new Error("Source loadOptions and core.loadOptions were removed. Use core and root loader namespaces directly.");let t={...e};if(e?.core){t.core={...e.core};let i=t.core;for(let o of["type","attributions","loaders","onError","loadOptions"])delete i[o];Object.keys(i).length===0&&delete t.core}let r=typeof t.baseUri=="string"?t.baseUri:void 0,n=typeof t.baseUrl=="string"?t.baseUrl:void 0;return(r!==void 0||n!==void 0)&&(t.core||={},t.core.baseUrl===void 0&&(t.core.baseUrl=n??r),delete t.baseUri,delete t.baseUrl),t}function FC(e,t){return e instanceof Error?e:typeof e=="string"?new Error(e):new Error(t)}function xa(e){return()=>{throw new Error(`CoreAPI.${e} is unavailable. Use @loaders.gl/core.createDataSource().`)}}var DC,Oh,vS=w(()=>{"use strict";zx();aS();Dx();Qx();h1();DC={fetchFile:xa("fetchFile"),parse:xa("parse"),parseFile:xa("parseFile"),parseSync:xa("parseSync"),parseInBatches:xa("parseInBatches"),load:xa("load"),loadInBatches:xa("loadInBatches")},Oh=class e{static defaultOptions={core:{type:"auto",attributions:[],loaders:[],onError:void 0}};optionsType;options;data;url;loadOptions;fetch;coreApi;hasCoreApi;_needsRefresh=!0;constructor(t,r,n,i){this.options=dd(dd(e.defaultOptions,n||{}),r),this.data=t,this.url=typeof t=="string"?sS(t):"";let o=l1(SS(this.options));this.loadOptions=o;let s=xS(o);this.coreApi=i||DC,this.hasCoreApi=!!i,this.fetch=s}setProps(t){let r=dd(this.options,t),n=l1(SS(r));this.options=r,this.loadOptions=n,this.fetch=xS(n),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}reportError(t,r){let n=FC(t,r),i=this.options.core?.onError;return i?i(n,this):Lx.warn(`${this.constructor.name}: ${n.message}`)(),n}}});var co=w(()=>{"use strict";Ex();Vx();kx();Wx();hS();uS();bS();vS()});function zB(e,t="float32"){return e instanceof Date?"date-millisecond":typeof e=="number"?t:typeof e=="boolean"?"bool":typeof e=="string"?"utf8":"null"}function WI(e){let t=VB(e);return t!=="null"?{type:t,nullable:!1}:e.length>0?(t=zB(e[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function VB(e){if(typeof Float16Array<"u"&&e instanceof Float16Array)return"float16";switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case BigInt64Array:return"int64";case BigUint64Array:return"uint64";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}var HI=w(()=>{"use strict"});function YI(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function Y(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{l(n.next(h))}catch(u){s(u)}}function c(h){try{l(n.throw(h))}catch(u){s(u)}}function l(h){h.done?o(h.value):i(h.value).then(a,c)}l((n=n.apply(e,t||[])).next())})}function $I(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function wt(e){return this instanceof wt?(this.v=e,this):new wt(e)}function Gr(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(d){return function(m){return Promise.resolve(m).then(d,u)}}function a(d,m){n[d]&&(i[d]=function(p){return new Promise(function(g,y){o.push([d,p,g,y])>1||c(d,p)})},m&&(i[d]=m(i[d])))}function c(d,m){try{l(n[d](m))}catch(p){f(o[0][3],p)}}function l(d){d.value instanceof wt?Promise.resolve(d.value.v).then(h,u):f(o[0][2],d)}function h(d){c("next",d)}function u(d){c("throw",d)}function f(d,m){d(m),o.shift(),o.length&&c(o[0][0],o[0][1])}}function gl(e){var t,r;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,o){t[i]=e[i]?function(s){return(r=!r)?{value:wt(e[i](s)),done:!1}:o?o(s):s}:o}}function vn(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof $I=="function"?$I(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(s){return new Promise(function(a,c){s=e[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var an=w(()=>{});var KI,yl,kB,En,uo=w(()=>{KI=new TextDecoder("utf-8"),yl=KI.decode.bind(KI),kB=new TextEncoder,En=e=>kB.encode(e)});var qB,XI,Ze,zr,Tn,hi,$n,Pm,Rm,Cm,Nm,Om,ZI,nu,JI,Bm,QI,us=w(()=>{qB=e=>typeof e=="number",XI=e=>typeof e=="boolean",Ze=e=>typeof e=="function",zr=e=>e!=null&&Object(e)===e,Tn=e=>zr(e)&&Ze(e.then),hi=e=>zr(e)&&Ze(e[Symbol.iterator]),$n=e=>zr(e)&&Ze(e[Symbol.asyncIterator]),Pm=e=>zr(e)&&zr(e.schema),Rm=e=>zr(e)&&"done"in e&&"value"in e,Cm=e=>zr(e)&&Ze(e.stat)&&qB(e.fd),Nm=e=>zr(e)&&nu(e.body),Om=e=>"_getDOMStream"in e&&"_getNodeStream"in e,ZI=e=>zr(e)&&Ze(e.abort)&&Ze(e.getWriter)&&!Om(e),nu=e=>zr(e)&&Ze(e.cancel)&&Ze(e.getReader)&&!Om(e),JI=e=>zr(e)&&Ze(e.end)&&Ze(e.write)&&XI(e.writable)&&!Om(e),Bm=e=>zr(e)&&Ze(e.read)&&Ze(e.pipe)&&XI(e.readable)&&!Om(e),QI=e=>zr(e)&&Ze(e.clear)&&Ze(e.bytes)&&Ze(e.position)&&Ze(e.setPosition)&&Ze(e.capacity)&&Ze(e.getBufferIdentifier)&&Ze(e.createLong)});var iw={};Zr(iw,{compareArrayLike:()=>nw,joinUint8Arrays:()=>In,memcpy:()=>iu,rebaseValueOffsets:()=>Lm,toArrayBufferView:()=>Tt,toArrayBufferViewAsyncIterator:()=>ui,toArrayBufferViewIterator:()=>Fi,toBigInt64Array:()=>ou,toBigUint64Array:()=>KB,toFloat32Array:()=>XB,toFloat32ArrayAsyncIterator:()=>f6,toFloat32ArrayIterator:()=>i6,toFloat64Array:()=>ZB,toFloat64ArrayAsyncIterator:()=>d6,toFloat64ArrayIterator:()=>o6,toInt16Array:()=>HB,toInt16ArrayAsyncIterator:()=>c6,toInt16ArrayIterator:()=>t6,toInt32Array:()=>Oa,toInt32ArrayAsyncIterator:()=>l6,toInt32ArrayIterator:()=>e6,toInt8Array:()=>WB,toInt8ArrayAsyncIterator:()=>a6,toInt8ArrayIterator:()=>QB,toUint16Array:()=>$B,toUint16ArrayAsyncIterator:()=>h6,toUint16ArrayIterator:()=>r6,toUint32Array:()=>YB,toUint32ArrayAsyncIterator:()=>u6,toUint32ArrayIterator:()=>n6,toUint8Array:()=>nt,toUint8ArrayAsyncIterator:()=>rw,toUint8ArrayIterator:()=>ew,toUint8ClampedArray:()=>JB,toUint8ClampedArrayAsyncIterator:()=>m6,toUint8ClampedArrayIterator:()=>s6});function jB(e){let t=e[0]?[e[0]]:[],r,n,i,o;for(let s,a,c=0,l=0,h=e.length;++c<h;){if(s=t[l],a=e[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:r,byteLength:i}=s,{byteOffset:n,byteLength:o}=a,r+i<n||n+o<r){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,r,n-r+o)}return t}function iu(e,t,r=0,n=t.byteLength){let i=e.byteLength,o=new Uint8Array(e.buffer,e.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return o.set(s,r),e}function In(e,t){let r=jB(e),n=r.reduce((h,u)=>h+u.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let h=r.length;++c<h;){if(i=r[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?r[c]=i.subarray(o.length):o.length===i.length&&c++,s?iu(s,o,a):s=o;break}iu(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),r.slice(c),n-(s?s.byteLength:0)]}function Tt(e,t){let r=Rm(t)?t.value:t;return r instanceof e?e===Uint8Array?new e(r.buffer,r.byteOffset,r.byteLength):r:r?(typeof r=="string"&&(r=En(r)),r instanceof ArrayBuffer?new e(r):r instanceof tw?new e(r):QI(r)?Tt(e,r.bytes()):ArrayBuffer.isView(r)?r.byteLength<=0?new e(0):new e(r.buffer,r.byteOffset,r.byteLength/e.BYTES_PER_ELEMENT):e.from(r)):new e(0)}function*Fi(e,t){let r=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof tw?r(t):hi(t)?t:r(t);return yield*Qy((function*(i){let o=null;do o=i.next(yield Tt(e,o));while(!o.done)})(n[Symbol.iterator]())),new e}function ui(e,t){return Gr(this,arguments,function*(){if(Tn(t))return yield wt(yield wt(yield*gl(vn(ui(e,yield wt(t))))));let n=function(s){return Gr(this,arguments,function*(){yield yield wt(yield wt(s))})},i=function(s){return Gr(this,arguments,function*(){yield wt(yield*gl(vn(Qy((function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)})(s[Symbol.iterator]())))))})},o=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof tw?n(t):hi(t)?i(t):$n(t)?t:n(t);return yield wt(yield*gl(vn(Qy((function(s){return Gr(this,arguments,function*(){let a=null;do a=yield wt(s.next(yield yield wt(Tt(e,a))));while(!a.done)})})(o[Symbol.asyncIterator]()))))),yield wt(new e)})}function Lm(e,t,r){if(e!==0){r=r.slice(0,t);let n=typeof r[0]=="bigint"?BigInt(e):e;for(let i=-1,o=r.length;++i<o;)r[i]+=n}return r.subarray(0,t)}function nw(e,t){let r=0,n=e.length;if(n!==t.length)return!1;if(n>0)do if(e[r]!==t[r])return!1;while(++r<n);return!0}var tw,WB,HB,Oa,ou,nt,$B,YB,KB,XB,ZB,JB,Qy,QB,t6,e6,ew,r6,n6,i6,o6,s6,a6,c6,l6,rw,h6,u6,f6,d6,m6,Je=w(()=>{an();uo();us();tw=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;WB=e=>Tt(Int8Array,e),HB=e=>Tt(Int16Array,e),Oa=e=>Tt(Int32Array,e),ou=e=>Tt(BigInt64Array,e),nt=e=>Tt(Uint8Array,e),$B=e=>Tt(Uint16Array,e),YB=e=>Tt(Uint32Array,e),KB=e=>Tt(BigUint64Array,e),XB=e=>Tt(Float32Array,e),ZB=e=>Tt(Float64Array,e),JB=e=>Tt(Uint8ClampedArray,e),Qy=e=>(e.next(),e);QB=e=>Fi(Int8Array,e),t6=e=>Fi(Int16Array,e),e6=e=>Fi(Int32Array,e),ew=e=>Fi(Uint8Array,e),r6=e=>Fi(Uint16Array,e),n6=e=>Fi(Uint32Array,e),i6=e=>Fi(Float32Array,e),o6=e=>Fi(Float64Array,e),s6=e=>Fi(Uint8ClampedArray,e);a6=e=>ui(Int8Array,e),c6=e=>ui(Int16Array,e),l6=e=>ui(Int32Array,e),rw=e=>ui(Uint8Array,e),h6=e=>ui(Uint16Array,e),u6=e=>ui(Uint32Array,e),f6=e=>ui(Float32Array,e),d6=e=>ui(Float64Array,e),m6=e=>ui(Uint8ClampedArray,e)});function*p6(e){let t,r=!1,n=[],i,o,s,a=0;function c(){return o==="peek"?In(n,s)[0]:([i,n,a]=In(n,s),i)}({cmd:o,size:s}=(yield null)||{cmd:"read",size:0});let l=ew(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(h){r=!0,typeof l.throw=="function"&&l.throw(h)}finally{r===!1&&typeof l.return=="function"&&l.return(null)}return null}function g6(e){return Gr(this,arguments,function*(){let r,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?In(i,a)[0]:([o,i,c]=In(i,a),o)}({cmd:s,size:a}=(yield yield wt(null))||{cmd:"read",size:0});let h=rw(e)[Symbol.asyncIterator]();try{do if({done:r,value:o}=Number.isNaN(a-c)?yield wt(h.next()):yield wt(h.next(a-c)),!r&&o.byteLength>0&&(i.push(o),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield wt(l()));while(a<c);while(!r)}catch(u){n=!0,typeof h.throw=="function"&&(yield wt(h.throw(u)))}finally{n===!1&&typeof h.return=="function"&&(yield wt(h.return(new Uint8Array(0))))}return yield wt(null)})}function y6(e){return Gr(this,arguments,function*(){let r=!1,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?In(i,a)[0]:([o,i,c]=In(i,a),o)}({cmd:s,size:a}=(yield yield wt(null))||{cmd:"read",size:0});let h=new sw(e);try{do if({done:r,value:o}=Number.isNaN(a-c)?yield wt(h.read()):yield wt(h.read(a-c)),!r&&o.byteLength>0&&(i.push(nt(o)),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield wt(l()));while(a<c);while(!r)}catch(u){n=!0,yield wt(h.cancel(u))}finally{n===!1?yield wt(h.cancel()):e.locked&&h.releaseLock()}return yield wt(null)})}function w6(e){return Gr(this,arguments,function*(){let r=[],n="error",i=!1,o=null,s,a,c=0,l=[],h;function u(){return s==="peek"?In(l,a)[0]:([h,l,c]=In(l,a),h)}if({cmd:s,size:a}=(yield yield wt(null))||{cmd:"read",size:0},e.isTTY)return yield yield wt(new Uint8Array(0)),yield wt(null);try{r[0]=ow(e,"end"),r[1]=ow(e,"error");do{if(r[2]=ow(e,"readable"),[n,o]=yield wt(Promise.race(r.map(d=>d[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(h=nt(e.read(a-c)),h.byteLength<a-c&&(h=nt(e.read()))):h=nt(e.read()),h.byteLength>0&&(l.push(h),c+=h.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield wt(u()));while(a<c)}while(!i)}finally{yield wt(f(r,n==="error"?o:null))}return yield wt(null);function f(d,m){return h=l=null,new Promise((p,g)=>{for(let[y,_]of d)e.off(y,_);try{let y=e.destroy;y&&y.call(e,m),m=void 0}catch(y){m=y||m}finally{m!=null?g(m):p()}})}})}var lr,Dm,sw,ow,su=w(()=>{an();Je();lr={fromIterable(e){return Dm(p6(e))},fromAsyncIterable(e){return Dm(g6(e))},fromDOMStream(e){return Dm(y6(e))},fromNodeStream(e){return Dm(w6(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},Dm=e=>(e.next(),e);sw=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return Y(this,void 0,void 0,function*(){let{reader:r,source:n}=this;r&&(yield r.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return Y(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let r=yield this.reader.read();return!r.done&&(r.value=nt(r)),r})}},ow=(e,t)=>{let r=i=>n([t,i]),n;return[t,r,new Promise(i=>(n=i)&&e.once(t,r))]}});var Xt,Fm=w(()=>{(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(Xt||(Xt={}))});var qt,aw=w(()=>{(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(qt||(qt={}))});var Vt,cw=w(()=>{(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Vt||(Vt={}))});var Qt,lw=w(()=>{(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Qt||(Qt={}))});var q,au=w(()=>{(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(q||(q={}))});var Lt,hw=w(()=>{(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Lt||(Lt={}))});var Um=w(()=>{});var Ui,Gm,zm,wl,uw=w(()=>{Ui=new Int32Array(2),Gm=new Float32Array(Ui.buffer),zm=new Float64Array(Ui.buffer),wl=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1});var cu,fw=w(()=>{(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(cu||(cu={}))});var hr,dw=w(()=>{Um();fw();uw();hr=class e{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(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 Ui[0]=this.readInt32(t),Gm[0]}readFloat64(t){return Ui[wl?0:1]=this.readInt32(t),Ui[wl?1:0]=this.readInt32(t+4),zm[0]}writeInt8(t,r){this.bytes_[t]=r}writeUint8(t,r){this.bytes_[t]=r}writeInt16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeUint16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeInt32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeUint32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeInt64(t,r){this.writeInt32(t,Number(BigInt.asIntN(32,r))),this.writeInt32(t+4,Number(BigInt.asIntN(32,r>>BigInt(32))))}writeUint64(t,r){this.writeUint32(t,Number(BigInt.asUintN(32,r))),this.writeUint32(t+4,Number(BigInt.asUintN(32,r>>BigInt(32))))}writeFloat32(t,r){Gm[0]=r,this.writeInt32(t,Ui[0])}writeFloat64(t,r){zm[0]=r,this.writeInt32(t,Ui[wl?0:1]),this.writeInt32(t+4,Ui[wl?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let r=0;r<4;r++)t+=String.fromCharCode(this.readInt8(this.position_+4+r));return t}__offset(t,r){let n=t-this.readInt32(t);return r<this.readInt16(n)?this.readInt16(n+r):0}__union(t,r){return t.bb_pos=r+this.readInt32(r),t.bb=this,t}__string(t,r){t+=this.readInt32(t);let n=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+n);return r===cu.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,r){return typeof t=="string"?this.__string(r):this.__union(t,r)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let r=0;r<4;r++)if(t.charCodeAt(r)!=this.readInt8(this.position()+4+r))return!1;return!0}createScalarList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o)}return n}createObjList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o.unpack())}return n}}});var Ba,t3=w(()=>{dw();Um();Ba=class e{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 r;t?r=t:r=1024,this.bb=hr.allocate(r),this.space=r}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,r){t>this.minalign&&(this.minalign=t);let n=~(this.bb.capacity()-this.space+r)+1&t-1;for(;this.space<n+t+r;){let i=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(n)}pad(t){for(let r=0;r<t;r++)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,r,n){(this.force_defaults||r!=n)&&(this.addInt8(r),this.slot(t))}addFieldInt16(t,r,n){(this.force_defaults||r!=n)&&(this.addInt16(r),this.slot(t))}addFieldInt32(t,r,n){(this.force_defaults||r!=n)&&(this.addInt32(r),this.slot(t))}addFieldInt64(t,r,n){(this.force_defaults||r!==n)&&(this.addInt64(r),this.slot(t))}addFieldFloat32(t,r,n){(this.force_defaults||r!=n)&&(this.addFloat32(r),this.slot(t))}addFieldFloat64(t,r,n){(this.force_defaults||r!=n)&&(this.addFloat64(r),this.slot(t))}addFieldOffset(t,r,n){(this.force_defaults||r!=n)&&(this.addOffset(r),this.slot(t))}addFieldStruct(t,r,n){r!=n&&(this.nested(r),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let r=t.capacity();if(r&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=r<<1,i=hr.allocate(n);return i.setPosition(n-r),i.bytes().set(t.bytes(),n-r),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let r=0;r<t;r++)this.vtable[r]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),r=this.vtable_in_use-1;for(;r>=0&&this.vtable[r]==0;r--);let n=r+1;for(;r>=0;r--)this.addInt16(this.vtable[r]!=0?t-this.vtable[r]:0);let i=2;this.addInt16(t-this.object_start);let o=(n+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(r=0;r<this.vtables.length;r++){let c=this.bb.capacity()-this.vtables[r];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[r];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,r,n){let i=n?4:0;if(r){let o=r;if(this.prep(this.minalign,8+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=3;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,r){this.finish(t,r,!0)}requiredField(t,r){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(r<this.bb.readInt16(i)&&this.bb.readInt16(i+r)!=0))throw new TypeError("FlatBuffers: field "+r+" must be set")}startVector(t,r,n){this.notNested(),this.vector_num_elems=r,this.prep(4,t*r),this.prep(n,t*r)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let r=this.createString(t);return this.string_maps.set(t,r),r}createString(t){if(t==null)return 0;let r;return t instanceof Uint8Array?r=t:r=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,r.length,1),this.bb.setPosition(this.space-=r.length),this.bb.bytes().set(r,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let r=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)r.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return r}createStructOffsetList(t,r){return r(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}}});var Gt=w(()=>{Um();uw();t3();dw();fw()});var La,mw=w(()=>{(function(e){e[e.BUFFER=0]="BUFFER"})(La||(La={}))});var ur,_l=w(()=>{(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(ur||(ur={}))});var fo,pw=w(()=>{Gt();mw();_l();fo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBodyCompression(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):ur.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):La.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,r){t.addFieldInt8(0,r,ur.LZ4_FRAME)}static addMethod(t,r){t.addFieldInt8(1,r,La.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,r,n){return e.startBodyCompression(t),e.addCodec(t,r),e.addMethod(t,n),e.endBodyCompression(t)}}});var Ml,gw=w(()=>{Ml=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,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,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}}});var bl,yw=w(()=>{bl=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,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,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}}});var br,ww=w(()=>{Gt();pw();gw();yw();br=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsRecordBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new bl).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new Ml).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let r=this.bb.__offset(this.bb_pos,10);return r?(t||new fo).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}variadicBufferCounts(t){let r=this.bb.__offset(this.bb_pos,12);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}variadicBufferCountsLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startRecordBatch(t){t.startObject(5)}static addLength(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addNodes(t,r){t.addFieldOffset(1,r,0)}static startNodesVector(t,r){t.startVector(16,r,8)}static addBuffers(t,r){t.addFieldOffset(2,r,0)}static startBuffersVector(t,r){t.startVector(16,r,8)}static addCompression(t,r){t.addFieldOffset(3,r,0)}static addVariadicBufferCounts(t,r){t.addFieldOffset(4,r,0)}static createVariadicBufferCountsVector(t,r){t.startVector(8,r.length,8);for(let n=r.length-1;n>=0;n--)t.addInt64(r[n]);return t.endVector()}static startVariadicBufferCountsVector(t,r){t.startVector(8,r,8)}static endRecordBatch(t){return t.endObject()}}});var mo,e3=w(()=>{Gt();ww();mo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new br).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addData(t,r){t.addFieldOffset(1,r,0)}static addIsDelta(t,r){t.addFieldInt8(2,+r,0)}static endDictionaryBatch(t){return t.endObject()}}});var fs,_w=w(()=>{(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(fs||(fs={}))});var lu,r3=w(()=>{(function(e){e[e.DenseArray=0]="DenseArray"})(lu||(lu={}))});var di,km=w(()=>{Gt();di=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInt(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,r){t.addFieldInt32(0,r,0)}static addIsSigned(t,r){t.addFieldInt8(1,+r,0)}static endInt(t){return t.endObject()}static createInt(t,r,n){return e.startInt(t),e.addBitWidth(t,r),e.addIsSigned(t,n),e.endInt(t)}}});var Gi,Mw=w(()=>{Gt();r3();km();Gi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryEncoding(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new di).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):lu.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addIndexType(t,r){t.addFieldOffset(1,r,0)}static addIsOrdered(t,r){t.addFieldInt8(2,+r,0)}static addDictionaryKind(t,r){t.addFieldInt16(3,r,lu.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}});var Ce,xl=w(()=>{Gt();Ce=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsKeyValue(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}value(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,r){t.addFieldOffset(0,r,0)}static addValue(t,r){t.addFieldOffset(1,r,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,r,n){return e.startKeyValue(t),e.addKey(t,r),e.addValue(t,n),e.endKeyValue(t)}}});var hu,n3=w(()=>{Gt();hu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}}});var uu,i3=w(()=>{Gt();uu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinaryView(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinaryView(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinaryView(t){t.startObject(0)}static endBinaryView(t){return t.endObject()}static createBinaryView(t){return e.startBinaryView(t),e.endBinaryView(t)}}});var fu,o3=w(()=>{Gt();fu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBool(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}}});var ds,bw=w(()=>{Gt();lw();ds=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDate(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Qt.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,Qt.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,r){return e.startDate(t),e.addUnit(t,r),e.endDate(t)}}});var zi,xw=w(()=>{Gt();zi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDecimal(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,r){t.addFieldInt32(0,r,0)}static addScale(t,r){t.addFieldInt32(1,r,0)}static addBitWidth(t,r){t.addFieldInt32(2,r,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,r,n,i){return e.startDecimal(t),e.addPrecision(t,r),e.addScale(t,n),e.addBitWidth(t,i),e.endDecimal(t)}}});var ms,Sw=w(()=>{Gt();au();ms=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDuration(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):q.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,q.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,r){return e.startDuration(t),e.addUnit(t,r),e.endDuration(t)}}});var ps,vw=w(()=>{Gt();ps=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,r){return e.startFixedSizeBinary(t),e.addByteWidth(t,r),e.endFixedSizeBinary(t)}}});var gs,Ew=w(()=>{Gt();gs=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,r){return e.startFixedSizeList(t),e.addListSize(t,r),e.endFixedSizeList(t)}}});var ys,Tw=w(()=>{Gt();cw();ys=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFloatingPoint(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Vt.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,r){t.addFieldInt16(0,r,Vt.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,r){return e.startFloatingPoint(t),e.addPrecision(t,r),e.endFloatingPoint(t)}}});var ws,Iw=w(()=>{Gt();hw();ws=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInterval(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Lt.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,Lt.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,r){return e.startInterval(t),e.addUnit(t,r),e.endInterval(t)}}});var du,s3=w(()=>{Gt();du=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return e.startLargeBinary(t),e.endLargeBinary(t)}}});var mu,a3=w(()=>{Gt();mu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeList(t){t.startObject(0)}static endLargeList(t){return t.endObject()}static createLargeList(t){return e.startLargeList(t),e.endLargeList(t)}}});var pu,c3=w(()=>{Gt();pu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return e.startLargeUtf8(t),e.endLargeUtf8(t)}}});var gu,l3=w(()=>{Gt();gu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return e.startList(t),e.endList(t)}}});var _s,Aw=w(()=>{Gt();_s=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMap(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,r){t.addFieldInt8(0,+r,0)}static endMap(t){return t.endObject()}static createMap(t,r){return e.startMap(t),e.addKeysSorted(t,r),e.endMap(t)}}});var yu,h3=w(()=>{Gt();yu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsNull(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}}});var wu,u3=w(()=>{Gt();wu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsStruct_(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}}});var po,Pw=w(()=>{Gt();au();po=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTime(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):q.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,q.MILLISECOND)}static addBitWidth(t,r){t.addFieldInt32(1,r,32)}static endTime(t){return t.endObject()}static createTime(t,r,n){return e.startTime(t),e.addUnit(t,r),e.addBitWidth(t,n),e.endTime(t)}}});var go,Rw=w(()=>{Gt();au();go=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTimestamp(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):q.SECOND}timezone(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,q.SECOND)}static addTimezone(t,r){t.addFieldOffset(1,r,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,r,n){return e.startTimestamp(t),e.addUnit(t,r),e.addTimezone(t,n),e.endTimestamp(t)}}});var mi,Cw=w(()=>{Gt();aw();mi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUnion(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):qt.Sparse}typeIds(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readInt32(this.bb.__vector(this.bb_pos+r)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,r){t.addFieldInt16(0,r,qt.Sparse)}static addTypeIds(t,r){t.addFieldOffset(1,r,0)}static createTypeIdsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addInt32(r[n]);return t.endVector()}static startTypeIdsVector(t,r){t.startVector(4,r,4)}static endUnion(t){return t.endObject()}static createUnion(t,r,n){return e.startUnion(t),e.addMode(t,r),e.addTypeIds(t,n),e.endUnion(t)}}});var _u,f3=w(()=>{Gt();_u=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}}});var Mu,d3=w(()=>{Gt();Mu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8View(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8View(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8View(t){t.startObject(0)}static endUtf8View(t){return t.endObject()}static createUtf8View(t){return e.startUtf8View(t),e.endUtf8View(t)}}});var lt,qm=w(()=>{(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.FloatingPoint=3]="FloatingPoint",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct_=13]="Struct_",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.RunEndEncoded=22]="RunEndEncoded",e[e.BinaryView=23]="BinaryView",e[e.Utf8View=24]="Utf8View",e[e.ListView=25]="ListView",e[e.LargeListView=26]="LargeListView"})(lt||(lt={}))});var xr,Nw=w(()=>{Gt();Mw();xl();qm();xr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsField(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):lt.NONE}type(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(t,this.bb_pos+r):null}dictionary(t){let r=this.bb.__offset(this.bb_pos,12);return r?(t||new Gi).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(t,r){let n=this.bb.__offset(this.bb_pos,14);return n?(r||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,16);return n?(r||new Ce).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,r){t.addFieldOffset(0,r,0)}static addNullable(t,r){t.addFieldInt8(1,+r,0)}static addTypeType(t,r){t.addFieldInt8(2,r,lt.NONE)}static addType(t,r){t.addFieldOffset(3,r,0)}static addDictionary(t,r){t.addFieldOffset(4,r,0)}static addChildren(t,r){t.addFieldOffset(5,r,0)}static createChildrenVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startChildrenVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(6,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endField(t){return t.endObject()}}});var cn,Ow=w(()=>{Gt();_w();Nw();xl();cn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsSchema(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):fs.Little}fields(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new xr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new Ce).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,r){t.addFieldInt16(0,r,fs.Little)}static addFields(t,r){t.addFieldOffset(1,r,0)}static createFieldsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startFieldsVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(2,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static addFeatures(t,r){t.addFieldOffset(3,r,0)}static createFeaturesVector(t,r){t.startVector(8,r.length,8);for(let n=r.length-1;n>=0;n--)t.addInt64(r[n]);return t.endVector()}static startFeaturesVector(t,r){t.startVector(8,r,8)}static endSchema(t){return t.endObject()}static createSchema(t,r,n,i,o){return e.startSchema(t),e.addEndianness(t,r),e.addFields(t,n),e.addCustomMetadata(t,i),e.addFeatures(t,o),e.endSchema(t)}}});var Nt,jm=w(()=>{(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(Nt||(Nt={}))});var x,xe,Ne=w(()=>{Fm();aw();cw();lw();au();hw();jm();(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.BinaryView=23]="BinaryView",e[e.Utf8View=24]="Utf8View",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond",e[e.IntervalMonthDayNano=-31]="IntervalMonthDayNano"})(x||(x={}));(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(xe||(xe={}))});var Bw={};Zr(Bw,{valueToString:()=>pi});function pi(e){if(e===null)return"null";if(e===void 0)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>pi(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,r)=>typeof r=="bigint"?`${r}`:r)}var bu=w(()=>{});function It(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function Lw(e,t){return It(e/t)+It(e%t)/It(t)}var Vi=w(()=>{});var Uw={};Zr(Uw,{BN:()=>Da,bigNumToBigInt:()=>p3,bigNumToNumber:()=>Fw,bigNumToString:()=>El,isArrowBigNumSymbol:()=>m3});function gi(e,...t){return t.length===0?Object.setPrototypeOf(Tt(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}function Sl(...e){return gi.apply(this,e)}function vl(...e){return gi.apply(this,e)}function xu(...e){return gi.apply(this,e)}function Fw(e,t){let{buffer:r,byteOffset:n,byteLength:i,signed:o}=e,s=new BigUint64Array(r,n,i/8),a=o&&s.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(a){for(let h of s)c|=(h^M6)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let h of s)c|=h*(BigInt(1)<<BigInt(64*l++));if(typeof t=="number"&&t>0){let h=BigInt("1".padEnd(t+1,"0")),u=c/h,f=a?-(c%h):c%h,d=It(u),m=`${f}`.padStart(t,"0");return+`${a&&d===0?"-":""}${d}.${m}`}return It(c)}function El(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return Dw(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return Dw(e);t=t.slice();let n=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+n;t[o]=a,n&=s===0?1:0}return`-${Dw(t)}`}function p3(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:El(e)}function Dw(e){let t="",r=new Uint32Array(2),n=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),o=-1,s=n.length-1;do{for(r[0]=n[o=0];o<s;)n[o++]=r[1]=r[0]/10,r[0]=(r[0]-r[1]*10<<16)+n[o];n[o]=r[1]=r[0]/10,r[0]=r[0]-r[1]*10,t=`${r[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var m3,_6,M6,Da,Wm=w(()=>{Je();Vi();m3=Symbol.for("isArrowBigNum");gi.prototype[m3]=!0;gi.prototype.toJSON=function(){return`"${El(this)}"`};gi.prototype.valueOf=function(e){return Fw(this,e)};gi.prototype.toString=function(){return El(this)};gi.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return Fw(this);case"string":return El(this);case"default":return p3(this)}return El(this)};Object.setPrototypeOf(Sl.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(vl.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(xu.prototype,Object.create(Uint32Array.prototype));Object.assign(Sl.prototype,gi.prototype,{constructor:Sl,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(vl.prototype,gi.prototype,{constructor:vl,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(xu.prototype,gi.prototype,{constructor:xu,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});_6=BigInt(4294967296)*BigInt(4294967296),M6=_6-BigInt(1);Da=class e{static new(t,r){switch(r){case!0:return new Sl(t);case!1:return new vl(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new Sl(t)}return t.byteLength===16?new xu(t):new vl(t)}static signed(t){return new Sl(t)}static unsigned(t){return new vl(t)}static decimal(t){return new xu(t)}constructor(t,r){return e.new(t,r)}}});function Ln(e){let t=e;switch(e.typeId){case x.Decimal:return e.bitWidth/32;case x.Interval:return t.unit===Lt.MONTH_DAY_NANO?4:1+t.unit;case x.BinaryView:case x.Utf8View:return 16;case x.FixedSizeList:return t.listSize;case x.FixedSizeBinary:return t.byteWidth;default:return 1}}var g3,y3,w3,_3,M3,b3,x3,S3,v3,E3,T3,I3,A3,P3,R3,C3,N3,O3,B3,L3,D3,F3,U3,G3,z3,V3,z,De,Se,An,Pn,ze,Rn,Cn,Nn,Vr,yi,Sr,wi,kr,On,ln,Mt,_i,vr,qr,Mi,Er,hn,jr,Ms,bs,fr,xs,Ss,vs,Es,dr,Ts,ki,Is,As,Tr,Ps,Rs,Su,Wr,vu,Eu,Tu,Iu,qe,Bn,Yt,Hr,yo,Cs,un,_e,Ir,b6,je,te=w(()=>{Vi();Ne();V3=Symbol.for("apache-arrow/DataType"),z=class e{static isDataType(t){return t?.[V3]===!0}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 isBinaryView(t){return t?.typeId===x.BinaryView}static isLargeBinary(t){return t?.typeId===x.LargeBinary}static isUtf8(t){return t?.typeId===x.Utf8}static isUtf8View(t){return t?.typeId===x.Utf8View}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 isLargeList(t){return t?.typeId===x.LargeList}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 e.isUnion(t)&&t.mode===qt.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===qt.Sparse}constructor(t){this.typeId=t}};g3=Symbol.toStringTag;z[g3]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[V3]=!0,e[Symbol.toStringTag]="DataType"))(z.prototype);De=class extends z{constructor(){super(x.Null)}toString(){return"Null"}};y3=Symbol.toStringTag;De[y3]=(e=>e[Symbol.toStringTag]="Null")(De.prototype);Se=class extends z{constructor(t,r){super(x.Int),this.isSigned=t,this.bitWidth=r}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}`}};w3=Symbol.toStringTag;Se[w3]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(Se.prototype);An=class extends Se{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Pn=class extends Se{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},ze=class extends Se{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Rn=class extends Se{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Cn=class extends Se{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Nn=class extends Se{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Vr=class extends Se{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},yi=class extends Se{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(An.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Pn.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(ze.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Rn.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Cn.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Nn.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Vr.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(yi.prototype,"ArrayType",{value:BigUint64Array});Sr=class extends z{constructor(t){super(x.Float),this.precision=t}get ArrayType(){switch(this.precision){case Vt.HALF:return Uint16Array;case Vt.SINGLE:return Float32Array;case Vt.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};_3=Symbol.toStringTag;Sr[_3]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(Sr.prototype);wi=class extends Sr{constructor(){super(Vt.HALF)}},kr=class extends Sr{constructor(){super(Vt.SINGLE)}},On=class extends Sr{constructor(){super(Vt.DOUBLE)}};Object.defineProperty(wi.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(kr.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(On.prototype,"ArrayType",{value:Float64Array});ln=class extends z{constructor(){super(x.Binary)}toString(){return"Binary"}};M3=Symbol.toStringTag;ln[M3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(ln.prototype);Mt=class extends z{constructor(){super(x.BinaryView)}toString(){return"BinaryView"}};b3=Symbol.toStringTag;Mt.ELEMENT_WIDTH=16;Mt.INLINE_CAPACITY=12;Mt.LENGTH_OFFSET=0;Mt.INLINE_OFFSET=4;Mt.BUFFER_INDEX_OFFSET=8;Mt.BUFFER_OFFSET_OFFSET=12;Mt[b3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="BinaryView"))(Mt.prototype);_i=class extends z{constructor(){super(x.LargeBinary)}toString(){return"LargeBinary"}};x3=Symbol.toStringTag;_i[x3]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(_i.prototype);vr=class extends z{constructor(){super(x.Utf8)}toString(){return"Utf8"}};S3=Symbol.toStringTag;vr[S3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(vr.prototype);qr=class extends z{constructor(){super(x.Utf8View)}toString(){return"Utf8View"}};v3=Symbol.toStringTag;qr.ELEMENT_WIDTH=Mt.ELEMENT_WIDTH;qr.INLINE_CAPACITY=Mt.INLINE_CAPACITY;qr[v3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8View"))(qr.prototype);Mi=class extends z{constructor(){super(x.LargeUtf8)}toString(){return"LargeUtf8"}};E3=Symbol.toStringTag;Mi[E3]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(Mi.prototype);Er=class extends z{constructor(){super(x.Bool)}toString(){return"Bool"}};T3=Symbol.toStringTag;Er[T3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Er.prototype);hn=class extends z{constructor(t,r,n=128){super(x.Decimal),this.scale=t,this.precision=r,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};I3=Symbol.toStringTag;hn[I3]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(hn.prototype);jr=class extends z{constructor(t){super(x.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Qt[this.unit]}>`}get ArrayType(){return this.unit===Qt.DAY?Int32Array:BigInt64Array}};A3=Symbol.toStringTag;jr[A3]=(e=>(e.unit=null,e[Symbol.toStringTag]="Date"))(jr.prototype);Ms=class extends jr{constructor(){super(Qt.DAY)}},bs=class extends jr{constructor(){super(Qt.MILLISECOND)}},fr=class extends z{constructor(t,r){super(x.Time),this.unit=t,this.bitWidth=r}toString(){return`Time${this.bitWidth}<${q[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};P3=Symbol.toStringTag;fr[P3]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(fr.prototype);xs=class extends fr{constructor(){super(q.SECOND,32)}},Ss=class extends fr{constructor(){super(q.MILLISECOND,32)}},vs=class extends fr{constructor(){super(q.MICROSECOND,64)}},Es=class extends fr{constructor(){super(q.NANOSECOND,64)}},dr=class extends z{constructor(t,r){super(x.Timestamp),this.unit=t,this.timezone=r}toString(){return`Timestamp<${q[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};R3=Symbol.toStringTag;dr[R3]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Timestamp"))(dr.prototype);Ts=class extends dr{constructor(t){super(q.SECOND,t)}},ki=class extends dr{constructor(t){super(q.MILLISECOND,t)}},Is=class extends dr{constructor(t){super(q.MICROSECOND,t)}},As=class extends dr{constructor(t){super(q.NANOSECOND,t)}},Tr=class extends z{constructor(t){super(x.Interval),this.unit=t}toString(){return`Interval<${Lt[this.unit]}>`}};C3=Symbol.toStringTag;Tr[C3]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(Tr.prototype);Ps=class extends Tr{constructor(){super(Lt.DAY_TIME)}},Rs=class extends Tr{constructor(){super(Lt.YEAR_MONTH)}},Su=class extends Tr{constructor(){super(Lt.MONTH_DAY_NANO)}},Wr=class extends z{constructor(t){super(x.Duration),this.unit=t}toString(){return`Duration<${q[this.unit]}>`}};N3=Symbol.toStringTag;Wr[N3]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(Wr.prototype);vu=class extends Wr{constructor(){super(q.SECOND)}},Eu=class extends Wr{constructor(){super(q.MILLISECOND)}},Tu=class extends Wr{constructor(){super(q.MICROSECOND)}},Iu=class extends Wr{constructor(){super(q.NANOSECOND)}},qe=class extends z{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}};O3=Symbol.toStringTag;qe[O3]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(qe.prototype);Bn=class extends z{constructor(t){super(x.LargeList),this.children=[t]}toString(){return`LargeList<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};B3=Symbol.toStringTag;Bn[B3]=(e=>(e.children=null,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeList"))(Bn.prototype);Yt=class extends z{constructor(t){super(x.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};L3=Symbol.toStringTag;Yt[L3]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(Yt.prototype);Hr=class extends z{constructor(t,r,n){super(x.Union),this.mode=t,this.children=n,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};D3=Symbol.toStringTag;Hr[D3]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Hr.prototype);yo=class extends Hr{constructor(t,r){super(qt.Dense,t,r)}},Cs=class extends Hr{constructor(t,r){super(qt.Sparse,t,r)}},un=class extends z{constructor(t){super(x.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};F3=Symbol.toStringTag;un[F3]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(un.prototype);_e=class extends z{constructor(t,r){super(x.FixedSizeList),this.listSize=t,this.children=[r]}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}>`}};U3=Symbol.toStringTag;_e[U3]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(_e.prototype);Ir=class extends z{constructor(t,r=!1){var n,i,o;if(super(x.Map),this.children=[t],this.keysSorted=r,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};G3=Symbol.toStringTag;Ir[G3]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Ir.prototype);b6=(e=>()=>++e)(-1),je=class extends z{constructor(t,r,n,i){super(x.Dictionary),this.indices=r,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?b6():It(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}>`}};z3=Symbol.toStringTag;je[z3]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(je.prototype)});function x6(e,t,r=!0){return typeof t=="number"?Tl(e,t,r):typeof t=="string"&&t in x?Tl(e,x[t],r):t&&t instanceof z?Tl(e,q3(t),r):t?.type&&t.type instanceof z?Tl(e,q3(t.type),r):Tl(e,x.NONE,r)}function Tl(e,t,r=!0){let n=null;switch(t){case x.Null:n=e.visitNull;break;case x.Bool:n=e.visitBool;break;case x.Int:n=e.visitInt;break;case x.Int8:n=e.visitInt8||e.visitInt;break;case x.Int16:n=e.visitInt16||e.visitInt;break;case x.Int32:n=e.visitInt32||e.visitInt;break;case x.Int64:n=e.visitInt64||e.visitInt;break;case x.Uint8:n=e.visitUint8||e.visitInt;break;case x.Uint16:n=e.visitUint16||e.visitInt;break;case x.Uint32:n=e.visitUint32||e.visitInt;break;case x.Uint64:n=e.visitUint64||e.visitInt;break;case x.Float:n=e.visitFloat;break;case x.Float16:n=e.visitFloat16||e.visitFloat;break;case x.Float32:n=e.visitFloat32||e.visitFloat;break;case x.Float64:n=e.visitFloat64||e.visitFloat;break;case x.Utf8:n=e.visitUtf8;break;case x.LargeUtf8:n=e.visitLargeUtf8;break;case x.Utf8View:n=e.visitUtf8View||e.visitUtf8;break;case x.Binary:n=e.visitBinary;break;case x.LargeBinary:n=e.visitLargeBinary;break;case x.BinaryView:n=e.visitBinaryView||e.visitBinary;break;case x.FixedSizeBinary:n=e.visitFixedSizeBinary;break;case x.Date:n=e.visitDate;break;case x.DateDay:n=e.visitDateDay||e.visitDate;break;case x.DateMillisecond:n=e.visitDateMillisecond||e.visitDate;break;case x.Timestamp:n=e.visitTimestamp;break;case x.TimestampSecond:n=e.visitTimestampSecond||e.visitTimestamp;break;case x.TimestampMillisecond:n=e.visitTimestampMillisecond||e.visitTimestamp;break;case x.TimestampMicrosecond:n=e.visitTimestampMicrosecond||e.visitTimestamp;break;case x.TimestampNanosecond:n=e.visitTimestampNanosecond||e.visitTimestamp;break;case x.Time:n=e.visitTime;break;case x.TimeSecond:n=e.visitTimeSecond||e.visitTime;break;case x.TimeMillisecond:n=e.visitTimeMillisecond||e.visitTime;break;case x.TimeMicrosecond:n=e.visitTimeMicrosecond||e.visitTime;break;case x.TimeNanosecond:n=e.visitTimeNanosecond||e.visitTime;break;case x.Decimal:n=e.visitDecimal;break;case x.List:n=e.visitList;break;case x.LargeList:n=e.visitLargeList;break;case x.Struct:n=e.visitStruct;break;case x.Union:n=e.visitUnion;break;case x.DenseUnion:n=e.visitDenseUnion||e.visitUnion;break;case x.SparseUnion:n=e.visitSparseUnion||e.visitUnion;break;case x.Dictionary:n=e.visitDictionary;break;case x.Interval:n=e.visitInterval;break;case x.IntervalDayTime:n=e.visitIntervalDayTime||e.visitInterval;break;case x.IntervalYearMonth:n=e.visitIntervalYearMonth||e.visitInterval;break;case x.IntervalMonthDayNano:n=e.visitIntervalMonthDayNano||e.visitInterval;break;case x.Duration:n=e.visitDuration;break;case x.DurationSecond:n=e.visitDurationSecond||e.visitDuration;break;case x.DurationMillisecond:n=e.visitDurationMillisecond||e.visitDuration;break;case x.DurationMicrosecond:n=e.visitDurationMicrosecond||e.visitDuration;break;case x.DurationNanosecond:n=e.visitDurationNanosecond||e.visitDuration;break;case x.FixedSizeList:n=e.visitFixedSizeList;break;case x.Map:n=e.visitMap;break}if(typeof n=="function")return n;if(!r)return()=>null;throw new Error(`Unrecognized type '${x[t]}'`)}function q3(e){switch(e.typeId){case x.Null:return x.Null;case x.Int:{let{bitWidth:t,isSigned:r}=e;switch(t){case 8:return r?x.Int8:x.Uint8;case 16:return r?x.Int16:x.Uint16;case 32:return r?x.Int32:x.Uint32;case 64:return r?x.Int64:x.Uint64}return x.Int}case x.Float:switch(e.precision){case Vt.HALF:return x.Float16;case Vt.SINGLE:return x.Float32;case Vt.DOUBLE:return x.Float64}return x.Float;case x.Binary:return x.Binary;case x.LargeBinary:return x.LargeBinary;case x.BinaryView:return x.BinaryView;case x.Utf8:return x.Utf8;case x.LargeUtf8:return x.LargeUtf8;case x.Utf8View:return x.Utf8View;case x.Bool:return x.Bool;case x.Decimal:return x.Decimal;case x.Time:switch(e.unit){case q.SECOND:return x.TimeSecond;case q.MILLISECOND:return x.TimeMillisecond;case q.MICROSECOND:return x.TimeMicrosecond;case q.NANOSECOND:return x.TimeNanosecond}return x.Time;case x.Timestamp:switch(e.unit){case q.SECOND:return x.TimestampSecond;case q.MILLISECOND:return x.TimestampMillisecond;case q.MICROSECOND:return x.TimestampMicrosecond;case q.NANOSECOND:return x.TimestampNanosecond}return x.Timestamp;case x.Date:switch(e.unit){case Qt.DAY:return x.DateDay;case Qt.MILLISECOND:return x.DateMillisecond}return x.Date;case x.Interval:switch(e.unit){case Lt.DAY_TIME:return x.IntervalDayTime;case Lt.YEAR_MONTH:return x.IntervalYearMonth;case Lt.MONTH_DAY_NANO:return x.IntervalMonthDayNano}return x.Interval;case x.Duration:switch(e.unit){case q.SECOND:return x.DurationSecond;case q.MILLISECOND:return x.DurationMillisecond;case q.MICROSECOND:return x.DurationMicrosecond;case q.NANOSECOND:return x.DurationNanosecond}return x.Duration;case x.Map:return x.Map;case x.List:return x.List;case x.LargeList:return x.LargeList;case x.Struct:return x.Struct;case x.Union:switch(e.mode){case qt.Dense:return x.DenseUnion;case qt.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[e.typeId]}'`)}var rt,fn=w(()=>{Ne();te();rt=class{visitMany(t,...r){return t.map((n,i)=>this.visit(n,...r.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,r=!0){return x6(this,t,r)}getVisitFnByTypeId(t,r=!0){return Tl(this,t,r)}visitNull(t,...r){return null}visitBool(t,...r){return null}visitInt(t,...r){return null}visitFloat(t,...r){return null}visitUtf8(t,...r){return null}visitLargeUtf8(t,...r){return null}visitUtf8View(t,...r){return null}visitBinary(t,...r){return null}visitLargeBinary(t,...r){return null}visitBinaryView(t,...r){return null}visitFixedSizeBinary(t,...r){return null}visitDate(t,...r){return null}visitTimestamp(t,...r){return null}visitTime(t,...r){return null}visitDecimal(t,...r){return null}visitList(t,...r){return null}visitLargeList(t,...r){return null}visitStruct(t,...r){return null}visitUnion(t,...r){return null}visitDictionary(t,...r){return null}visitInterval(t,...r){return null}visitDuration(t,...r){return null}visitFixedSizeList(t,...r){return null}visitMap(t,...r){return null}};rt.prototype.visitInt8=null;rt.prototype.visitInt16=null;rt.prototype.visitInt32=null;rt.prototype.visitInt64=null;rt.prototype.visitUint8=null;rt.prototype.visitUint16=null;rt.prototype.visitUint32=null;rt.prototype.visitUint64=null;rt.prototype.visitFloat16=null;rt.prototype.visitFloat32=null;rt.prototype.visitFloat64=null;rt.prototype.visitDateDay=null;rt.prototype.visitDateMillisecond=null;rt.prototype.visitTimestampSecond=null;rt.prototype.visitTimestampMillisecond=null;rt.prototype.visitTimestampMicrosecond=null;rt.prototype.visitTimestampNanosecond=null;rt.prototype.visitTimeSecond=null;rt.prototype.visitTimeMillisecond=null;rt.prototype.visitTimeMicrosecond=null;rt.prototype.visitTimeNanosecond=null;rt.prototype.visitDenseUnion=null;rt.prototype.visitSparseUnion=null;rt.prototype.visitIntervalDayTime=null;rt.prototype.visitIntervalYearMonth=null;rt.prototype.visitIntervalMonthDayNano=null;rt.prototype.visitDuration=null;rt.prototype.visitDurationSecond=null;rt.prototype.visitDurationMillisecond=null;rt.prototype.visitDurationMicrosecond=null;rt.prototype.visitDurationNanosecond=null});var Gw={};Zr(Gw,{float64ToUint16:()=>Au,uint16ToFloat64:()=>Hm});function Hm(e){let t=(e&31744)>>10,r=(e&1023)/1024,n=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return n*(r?Number.NaN:1/0);case 0:return n*(r?6103515625e-14*r:0)}return n*Math.pow(2,t-15)*(1+r)}function Au(e){if(e!==e)return 32256;j3[0]=e;let t=(Il[1]&2147483648)>>16&65535,r=Il[1]&2146435072,n=0;return r>=1089470464?Il[0]>0?r=31744:(r=(r&2080374784)>>16,n=(Il[1]&1048575)>>10):r<=1056964608?(n=1048576+(Il[1]&1048575),n=1048576+(n<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,n=(Il[1]&1048575)+512>>10),t|r|n&65535}var j3,Il,Pu=w(()=>{j3=new Float64Array(1),Il=new Uint32Array(j3.buffer)});function mt(e){return(t,r,n)=>{if(t.setValid(r,n!=null))return e(t,r,n)}}var ct,S6,W3,v6,wo,zw,H3,E6,$m,Ym,Vw,$3,T6,Y3,I6,K3,A6,kw,Km,Xm,Zm,Jm,qw,Qm,tp,ep,rp,jw,Ww,X3,P6,R6,C6,N6,O6,B6,L6,Z3,J3,D6,Hw,np,ip,op,sp,ap,cp,lp,$w,F6,mr,Dn=w(()=>{Ar();fn();Vi();uo();Pu();Ne();te();ct=class extends rt{};S6=(e,t,r)=>{e[t]=Math.floor(r/864e5)},W3=(e,t,r,n)=>{if(r+1<t.length){let i=It(t[r]),o=It(t[r+1]);e.set(n.subarray(0,o-i),i)}},v6=({offset:e,values:t},r,n)=>{let i=e+r;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},wo=({values:e},t,r)=>{e[t]=r},zw=({values:e},t,r)=>{e[t]=r},H3=({values:e},t,r)=>{e[t]=Au(r)},E6=(e,t,r)=>{switch(e.type.precision){case Vt.HALF:return H3(e,t,r);case Vt.SINGLE:case Vt.DOUBLE:return zw(e,t,r)}},$m=({values:e},t,r)=>{S6(e,t,r.valueOf())},Ym=({values:e},t,r)=>{e[t]=BigInt(r)},Vw=({stride:e,values:t},r,n)=>{t.set(n.subarray(0,e),e*r)},$3=({values:e,valueOffsets:t},r,n)=>W3(e,t,r,n),T6=e=>{let t=e.variadicBuffers;return(!Array.isArray(t)||Object.isFrozen(t))&&(t=Array.from(t),e.variadicBuffers=t),t},Y3=(e,t,r)=>{var n,i,o,s;let a=e.values;if(!a)throw new Error("BinaryView data is missing view buffer");let c=Mt.ELEMENT_WIDTH,l=t*c,h=l+c;if(l<0||h>a.length)throw new RangeError(`BinaryView index ${t} out of bounds`);a.fill(0,l,h);let u=new DataView(a.buffer,a.byteOffset+l,c),f=r.length;if(u.setInt32(Mt.LENGTH_OFFSET,f,!0),f<=Mt.INLINE_CAPACITY){a.set(r,l+Mt.INLINE_OFFSET);return}let d=((n=r[0])!==null&&n!==void 0?n:0)|((i=r[1])!==null&&i!==void 0?i:0)<<8|((o=r[2])!==null&&o!==void 0?o:0)<<16|((s=r[3])!==null&&s!==void 0?s:0)<<24;u.setUint32(Mt.INLINE_OFFSET,d>>>0,!0);let m=T6(e),p=r.slice(),g=m.push(p)-1;u.setInt32(Mt.BUFFER_INDEX_OFFSET,g,!0),u.setInt32(Mt.BUFFER_OFFSET_OFFSET,0,!0)},I6=(e,t,r)=>{let n=r instanceof Uint8Array?r:new Uint8Array(r);Y3(e,t,n)},K3=({values:e,valueOffsets:t},r,n)=>W3(e,t,r,En(n)),A6=(e,t,r)=>{let n=En(r);Y3(e,t,n)},kw=(e,t,r)=>{e.type.unit===Qt.DAY?$m(e,t,r):Ym(e,t,r)},Km=({values:e},t,r)=>{e[t]=BigInt(r/1e3)},Xm=({values:e},t,r)=>{e[t]=BigInt(r)},Zm=({values:e},t,r)=>{e[t]=BigInt(r*1e3)},Jm=({values:e},t,r)=>{e[t]=BigInt(r*1e6)},qw=(e,t,r)=>{switch(e.type.unit){case q.SECOND:return Km(e,t,r);case q.MILLISECOND:return Xm(e,t,r);case q.MICROSECOND:return Zm(e,t,r);case q.NANOSECOND:return Jm(e,t,r)}},Qm=({values:e},t,r)=>{e[t]=r},tp=({values:e},t,r)=>{e[t]=r},ep=({values:e},t,r)=>{e[t]=r},rp=({values:e},t,r)=>{e[t]=r},jw=(e,t,r)=>{switch(e.type.unit){case q.SECOND:return Qm(e,t,r);case q.MILLISECOND:return tp(e,t,r);case q.MICROSECOND:return ep(e,t,r);case q.NANOSECOND:return rp(e,t,r)}},Ww=({values:e,stride:t},r,n)=>{e.set(n.subarray(0,t),t*r)},X3=(e,t,r)=>{let n=e.children[0],i=e.valueOffsets,o=mr.getVisitFn(n),s=It(i[t]),a=It(i[t+1]);if(Array.isArray(r))for(let c=-1,l=s;l<a;)o(n,l++,r[++c]);else for(let c=-1,l=s;l<a;)o(n,l++,r.get(++c))},P6=(e,t,r)=>{let n=e.children[0],{valueOffsets:i}=e,o=mr.getVisitFn(n),{[t]:s,[t+1]:a}=i,c=r instanceof Map?r.entries():Object.entries(r);for(let l of c)if(o(n,s,l),++s>=a)break},R6=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[o]),C6=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(o)),N6=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(i.name)),O6=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[i.name]),B6=(e,t,r)=>{let n=e.type.children.map(o=>mr.getVisitFn(o.type)),i=r instanceof Map?N6(t,r):r instanceof $?C6(t,r):Array.isArray(r)?R6(t,r):O6(t,r);e.type.children.forEach((o,s)=>i(n[s],e.children[s],o,s))},L6=(e,t,r)=>{e.type.mode===qt.Dense?Z3(e,t,r):J3(e,t,r)},Z3=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];mr.visit(i,e.valueOffsets[t],r)},J3=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];mr.visit(i,t,r)},D6=(e,t,r)=>{var n;(n=e.dictionary)===null||n===void 0||n.set(e.values[t],r)},Hw=(e,t,r)=>{switch(e.type.unit){case Lt.YEAR_MONTH:return ip(e,t,r);case Lt.DAY_TIME:return np(e,t,r);case Lt.MONTH_DAY_NANO:return op(e,t,r)}},np=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},ip=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},op=({values:e,stride:t},r,n)=>{e.set(n.subarray(0,t),t*r)},sp=({values:e},t,r)=>{e[t]=r},ap=({values:e},t,r)=>{e[t]=r},cp=({values:e},t,r)=>{e[t]=r},lp=({values:e},t,r)=>{e[t]=r},$w=(e,t,r)=>{switch(e.type.unit){case q.SECOND:return sp(e,t,r);case q.MILLISECOND:return ap(e,t,r);case q.MICROSECOND:return cp(e,t,r);case q.NANOSECOND:return lp(e,t,r)}},F6=(e,t,r)=>{let{stride:n}=e,i=e.children[0],o=mr.getVisitFn(i);if(Array.isArray(r))for(let s=-1,a=t*n;++s<n;)o(i,a+s,r[s]);else for(let s=-1,a=t*n;++s<n;)o(i,a+s,r.get(s))};ct.prototype.visitBool=mt(v6);ct.prototype.visitInt=mt(wo);ct.prototype.visitInt8=mt(wo);ct.prototype.visitInt16=mt(wo);ct.prototype.visitInt32=mt(wo);ct.prototype.visitInt64=mt(wo);ct.prototype.visitUint8=mt(wo);ct.prototype.visitUint16=mt(wo);ct.prototype.visitUint32=mt(wo);ct.prototype.visitUint64=mt(wo);ct.prototype.visitFloat=mt(E6);ct.prototype.visitFloat16=mt(H3);ct.prototype.visitFloat32=mt(zw);ct.prototype.visitFloat64=mt(zw);ct.prototype.visitUtf8=mt(K3);ct.prototype.visitLargeUtf8=mt(K3);ct.prototype.visitUtf8View=mt(A6);ct.prototype.visitBinary=mt($3);ct.prototype.visitLargeBinary=mt($3);ct.prototype.visitBinaryView=mt(I6);ct.prototype.visitFixedSizeBinary=mt(Vw);ct.prototype.visitDate=mt(kw);ct.prototype.visitDateDay=mt($m);ct.prototype.visitDateMillisecond=mt(Ym);ct.prototype.visitTimestamp=mt(qw);ct.prototype.visitTimestampSecond=mt(Km);ct.prototype.visitTimestampMillisecond=mt(Xm);ct.prototype.visitTimestampMicrosecond=mt(Zm);ct.prototype.visitTimestampNanosecond=mt(Jm);ct.prototype.visitTime=mt(jw);ct.prototype.visitTimeSecond=mt(Qm);ct.prototype.visitTimeMillisecond=mt(tp);ct.prototype.visitTimeMicrosecond=mt(ep);ct.prototype.visitTimeNanosecond=mt(rp);ct.prototype.visitDecimal=mt(Ww);ct.prototype.visitList=mt(X3);ct.prototype.visitLargeList=mt(X3);ct.prototype.visitStruct=mt(B6);ct.prototype.visitUnion=mt(L6);ct.prototype.visitDenseUnion=mt(Z3);ct.prototype.visitSparseUnion=mt(J3);ct.prototype.visitDictionary=mt(D6);ct.prototype.visitInterval=mt(Hw);ct.prototype.visitIntervalDayTime=mt(np);ct.prototype.visitIntervalYearMonth=mt(ip);ct.prototype.visitIntervalMonthDayNano=mt(op);ct.prototype.visitDuration=mt($w);ct.prototype.visitDurationSecond=mt(sp);ct.prototype.visitDurationMillisecond=mt(ap);ct.prototype.visitDurationMicrosecond=mt(cp);ct.prototype.visitDurationNanosecond=mt(lp);ct.prototype.visitFixedSizeList=mt(F6);ct.prototype.visitMap=mt(P6);mr=new ct});var bi,Al,qi,Yw,Kw,U6,hp=w(()=>{bu();Fa();Dn();bi=Symbol.for("parent"),Al=Symbol.for("rowIndex"),qi=class{constructor(t,r){return this[bi]=t,this[Al]=r,new Proxy(this,U6)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Al],r=this[bi],n=r.type.children,i={};for(let o=-1,s=n.length;++o<s;)i[n[o].name]=We.visit(r.children[o],t);return i}toString(){return`{${[...this].map(([t,r])=>`${pi(t)}: ${pi(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new Yw(this[bi],this[Al])}},Yw=class{constructor(t,r){this.childIndex=0,this.children=t.children,this.rowIndex=r,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,We.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(qi.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[bi]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Al]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});Kw=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[bi].type.children.map(r=>r.name)}has(t,r){return t[bi].type.children.some(n=>n.name===r)}getOwnPropertyDescriptor(t,r){if(t[bi].type.children.some(n=>n.name===r))return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[bi].type.children.findIndex(i=>i.name===r);if(n!==-1){let i=We.visit(t[bi].children[n],t[Al]);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[bi].type.children.findIndex(o=>o.name===r);return i!==-1?(mr.visit(t[bi].children[i],t[Al],n),Reflect.set(t,r,n)):Reflect.has(t,r)||typeof r=="symbol"?Reflect.set(t,r,n):!1}},U6=new Kw});function ht(e){return(t,r)=>t.getValid(r)?e(t,r):null}var it,G6,Pl,z6,V6,Q3,k6,t4,e4,Ns,q6,r4,j6,n4,i4,W6,o4,H6,$6,Y6,K6,s4,a4,c4,l4,X6,h4,u4,f4,d4,Z6,J6,m4,Q6,tL,eL,p4,g4,rL,nL,y4,w4,_4,M4,b4,x4,S4,iL,oL,We,Fa=w(()=>{Wm();Ar();fn();Ru();hp();Vi();uo();Pu();Ne();it=class extends rt{};G6=(e,t)=>864e5*e[t],Pl=16,z6=12,V6=(e,t)=>null,Q3=(e,t,r)=>{if(r+1>=t.length)return null;let n=It(t[r]),i=It(t[r+1]);return e.subarray(n,i)},k6=({offset:e,values:t},r)=>{let n=e+r;return(t[n>>3]&1<<n%8)!==0},t4=({values:e},t)=>G6(e,t),e4=({values:e},t)=>It(e[t]),Ns=({stride:e,values:t},r)=>t[e*r],q6=({stride:e,values:t},r)=>Hm(t[e*r]),r4=({values:e},t)=>e[t],j6=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),n4=({values:e,valueOffsets:t},r)=>Q3(e,t,r),i4=(e,t)=>{var r;let n=e.values;if(!n)throw new Error("BinaryView data is missing view buffer");let i=t*Pl,o=i+Pl;if(i<0||o>n.length)throw new Error(`BinaryView data buffer is too short: expected ${Pl} bytes, got ${Math.max(0,n.length-i)}`);let s=n.subarray(i,o);if(s.length<Pl)throw new Error(`BinaryView data buffer is too short: expected ${Pl} bytes, got ${s.length}`);let a=new DataView(n.buffer,s.byteOffset,Pl),c=a.getInt32(0,!0);if(c<=0)return new Uint8Array(0);if(c<=z6)return s.subarray(4,4+c);let l=a.getInt32(8,!0),h=a.getInt32(12,!0),u=(r=e.variadicBuffers)===null||r===void 0?void 0:r[l];if(!u)throw new Error(`BinaryView variadic buffer ${l} is missing`);return u.subarray(h,h+c)},W6=(e,t)=>i4(e,t),o4=({values:e,valueOffsets:t},r)=>{let n=Q3(e,t,r);return n!==null?yl(n):null},H6=(e,t)=>{let r=i4(e,t);return yl(r)},$6=({values:e},t)=>e[t],Y6=({type:e,values:t},r)=>e.precision!==Vt.HALF?t[r]:Hm(t[r]),K6=(e,t)=>e.type.unit===Qt.DAY?t4(e,t):e4(e,t),s4=({values:e},t)=>1e3*It(e[t]),a4=({values:e},t)=>It(e[t]),c4=({values:e},t)=>Lw(e[t],BigInt(1e3)),l4=({values:e},t)=>Lw(e[t],BigInt(1e6)),X6=(e,t)=>{switch(e.type.unit){case q.SECOND:return s4(e,t);case q.MILLISECOND:return a4(e,t);case q.MICROSECOND:return c4(e,t);case q.NANOSECOND:return l4(e,t)}},h4=({values:e},t)=>e[t],u4=({values:e},t)=>e[t],f4=({values:e},t)=>e[t],d4=({values:e},t)=>e[t],Z6=(e,t)=>{switch(e.type.unit){case q.SECOND:return h4(e,t);case q.MILLISECOND:return u4(e,t);case q.MICROSECOND:return f4(e,t);case q.NANOSECOND:return d4(e,t)}},J6=({values:e,stride:t},r)=>Da.decimal(e.subarray(t*r,t*(r+1))),m4=(e,t)=>{let{valueOffsets:r,stride:n,children:i}=e,o=It(r[t*n]),s=It(r[t*n+1]),c=i[0].slice(o,s-o);return new $([c])},Q6=(e,t)=>{let{valueOffsets:r,children:n}=e,{[t]:i,[t+1]:o}=r,s=n[0];return new Kn(s.slice(i,o-i))},tL=(e,t)=>new qi(e,t),eL=(e,t)=>e.type.mode===qt.Dense?p4(e,t):g4(e,t),p4=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return We.visit(n,e.valueOffsets[t])},g4=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return We.visit(n,t)},rL=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},nL=(e,t)=>e.type.unit===Lt.MONTH_DAY_NANO?_4(e,t):e.type.unit===Lt.DAY_TIME?y4(e,t):w4(e,t),y4=({values:e},t)=>e.subarray(2*t,2*(t+1)),w4=({values:e},t)=>{let r=e[t],n=new Int32Array(2);return n[0]=Math.trunc(r/12),n[1]=Math.trunc(r%12),n},_4=({values:e},t)=>e.subarray(4*t,4*(t+1)),M4=({values:e},t)=>e[t],b4=({values:e},t)=>e[t],x4=({values:e},t)=>e[t],S4=({values:e},t)=>e[t],iL=(e,t)=>{switch(e.type.unit){case q.SECOND:return M4(e,t);case q.MILLISECOND:return b4(e,t);case q.MICROSECOND:return x4(e,t);case q.NANOSECOND:return S4(e,t)}},oL=(e,t)=>{let{stride:r,children:n}=e,o=n[0].slice(t*r,r);return new $([o])};it.prototype.visitNull=ht(V6);it.prototype.visitBool=ht(k6);it.prototype.visitInt=ht($6);it.prototype.visitInt8=ht(Ns);it.prototype.visitInt16=ht(Ns);it.prototype.visitInt32=ht(Ns);it.prototype.visitInt64=ht(r4);it.prototype.visitUint8=ht(Ns);it.prototype.visitUint16=ht(Ns);it.prototype.visitUint32=ht(Ns);it.prototype.visitUint64=ht(r4);it.prototype.visitFloat=ht(Y6);it.prototype.visitFloat16=ht(q6);it.prototype.visitFloat32=ht(Ns);it.prototype.visitFloat64=ht(Ns);it.prototype.visitUtf8=ht(o4);it.prototype.visitLargeUtf8=ht(o4);it.prototype.visitUtf8View=ht(H6);it.prototype.visitBinary=ht(n4);it.prototype.visitLargeBinary=ht(n4);it.prototype.visitBinaryView=ht(W6);it.prototype.visitFixedSizeBinary=ht(j6);it.prototype.visitDate=ht(K6);it.prototype.visitDateDay=ht(t4);it.prototype.visitDateMillisecond=ht(e4);it.prototype.visitTimestamp=ht(X6);it.prototype.visitTimestampSecond=ht(s4);it.prototype.visitTimestampMillisecond=ht(a4);it.prototype.visitTimestampMicrosecond=ht(c4);it.prototype.visitTimestampNanosecond=ht(l4);it.prototype.visitTime=ht(Z6);it.prototype.visitTimeSecond=ht(h4);it.prototype.visitTimeMillisecond=ht(u4);it.prototype.visitTimeMicrosecond=ht(f4);it.prototype.visitTimeNanosecond=ht(d4);it.prototype.visitDecimal=ht(J6);it.prototype.visitList=ht(m4);it.prototype.visitLargeList=ht(m4);it.prototype.visitStruct=ht(tL);it.prototype.visitUnion=ht(eL);it.prototype.visitDenseUnion=ht(p4);it.prototype.visitSparseUnion=ht(g4);it.prototype.visitDictionary=ht(rL);it.prototype.visitInterval=ht(nL);it.prototype.visitIntervalDayTime=ht(y4);it.prototype.visitIntervalYearMonth=ht(w4);it.prototype.visitIntervalMonthDayNano=ht(_4);it.prototype.visitDuration=ht(iL);it.prototype.visitDurationSecond=ht(M4);it.prototype.visitDurationMillisecond=ht(b4);it.prototype.visitDurationMicrosecond=ht(x4);it.prototype.visitDurationNanosecond=ht(S4);it.prototype.visitFixedSizeList=ht(oL);it.prototype.visitMap=ht(Q6);We=new it});var Os,Cl,Rl,Xw,Kn,Zw,Jw,Ru=w(()=>{Ar();bu();Fa();Dn();Os=Symbol.for("keys"),Cl=Symbol.for("vals"),Rl=Symbol.for("kKeysAsStrings"),Xw=Symbol.for("_kKeysAsStrings"),Kn=class{constructor(t){return this[Os]=new $([t.children[0]]).memoize(),this[Cl]=t.children[1],new Proxy(this,new Jw)}get[Rl](){return this[Xw]||(this[Xw]=Array.from(this[Os].toArray(),String))}[Symbol.iterator](){return new Zw(this[Os],this[Cl])}get size(){return this[Os].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Os],r=this[Cl],n={};for(let i=-1,o=t.length;++i<o;)n[t.get(i)]=We.visit(r,i);return n}toString(){return`{${[...this].map(([t,r])=>`${pi(t)}: ${pi(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},Zw=class{constructor(t,r){this.keys=t,this.vals=r,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),We.visit(this.vals,t)]})}},Jw=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Rl]}has(t,r){return t[Rl].includes(r)}getOwnPropertyDescriptor(t,r){if(t[Rl].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[Rl].indexOf(r);if(n!==-1){let i=We.visit(Reflect.get(t,Cl),n);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[Rl].indexOf(r);return i!==-1?(mr.visit(Reflect.get(t,Cl),i,n),Reflect.set(t,r,n)):Reflect.has(t,r)?Reflect.set(t,r,n):!1}};Object.defineProperties(Kn.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Os]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Cl]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Xw]:{writable:!0,enumerable:!1,configurable:!1,value:null}})});var Qw={};Zr(Qw,{clampRange:()=>Cu,createElementComparator:()=>Bs,wrapIndex:()=>Ua});function Cu(e,t,r,n){let{length:i=0}=e,o=typeof t!="number"?0:t,s=typeof r!="number"?i:r;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(v4=o,o=s,s=v4),s>i&&(s=i),n?n(e,o,s):[o,s]}function Bs(e){if(typeof e!=="object"||e===null)return E4(e)?E4:r=>r===e;if(e instanceof Date){let r=e.valueOf();return n=>n instanceof Date?n.valueOf()===r:!1}return ArrayBuffer.isView(e)?r=>r?nw(e,r):!1:e instanceof Map?aL(e):Array.isArray(e)?sL(e):e instanceof $?cL(e):lL(e,!0)}function sL(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Bs(e[r]);return up(t)}function aL(e){let t=-1,r=[];for(let n of e.values())r[++t]=Bs(n);return up(r)}function cL(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Bs(e.get(r));return up(t)}function lL(e,t=!1){let r=Object.keys(e);if(!t&&r.length===0)return()=>!1;let n=[];for(let i=-1,o=r.length;++i<o;)n[i]=Bs(e[r[i]]);return up(n,r)}function up(e,t){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return hL(e,r);case Map:return T4(e,r,r.keys());case Kn:case qi:case Object:case void 0:return T4(e,r,t||Object.keys(r))}return r instanceof $?uL(e,r):!1}}function hL(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t[n]))return!1;return!0}function uL(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t.get(n)))return!1;return!0}function T4(e,t,r){let n=r[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),o=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),s=0,a=e.length,c=o.next(),l=n.next(),h=i.next();for(;s<a&&!l.done&&!h.done&&!c.done&&!(l.value!==h.value||!e[s](c.value));++s,l=n.next(),h=i.next(),c=o.next());return s===a&&l.done&&h.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),o.return&&o.return(),!1)}var v4,Ua,E4,Nl=w(()=>{Ar();Ru();hp();Je();Ua=(e,t)=>e<0?t+e:e,E4=e=>e!==e});var t_={};Zr(t_,{BitIterator:()=>ji,getBit:()=>dp,getBool:()=>Ol,packBools:()=>za,popcnt_array:()=>I4,popcnt_bit_range:()=>Nu,popcnt_uint32:()=>fp,setBool:()=>fL,truncateBitmap:()=>Ga});function Ol(e,t,r,n){return(r&1<<n)!==0}function dp(e,t,r,n){return(r&1<<n)>>n}function fL(e,t,r){return r?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function Ga(e,t,r){let n=r.byteLength+7&-8;if(e>0||r.byteLength<n){let i=new Uint8Array(n);return i.set(e%8===0?r.subarray(e>>3):za(new ji(r,e,t,null,Ol)).subarray(0,n)),i}return r}function za(e){let t=[],r=0,n=0,i=0;for(let s of e)s&&(i|=1<<n),++n===8&&(t[r++]=i,i=n=0);(r===0||n>0)&&(t[r++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}function Nu(e,t,r){if(r-t<=0)return 0;if(r-t<8){let o=0;for(let s of new ji(e,t,r-t,e,dp))o+=s;return o}let n=r>>3<<3,i=t+(t%8===0?0:8-t%8);return Nu(e,t,i)+Nu(e,n,r)+I4(e,i>>3,n-i>>3)}function I4(e,t,r){let n=0,i=Math.trunc(t),o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=r===void 0?e.byteLength:i+r;for(;s-i>=4;)n+=fp(o.getUint32(i)),i+=4;for(;s-i>=2;)n+=fp(o.getUint16(i)),i+=2;for(;s-i>=1;)n+=fp(o.getUint8(i)),i+=1;return n}function fp(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var ji,Va=w(()=>{ji=class{constructor(t,r,n,i,o){this.bytes=t,this.length=n,this.context=i,this.get=o,this.bit=r%8,this.byteIndex=r>>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 Q(e){return mL.visit(e)}var dL,A4,ut,e_,mL,Xn=w(()=>{Ar();Ne();te();Va();te();fn();Je();dL=-1,A4=Symbol.for("apache-arrow/Data"),ut=class e{static isData(t){return t?.[A4]===!0}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return z.isSparseUnion(t)?this.children.some(r=>r.nullable):z.isDenseUnion(t)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:r,values:n,nullBitmap:i,typeIds:o}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),t+=this.variadicBuffers.reduce((s,a)=>{var c;return s+((c=a?.byteLength)!==null&&c!==void 0?c:0)},0),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(z.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,r;return t<=dL&&(r=this.nullBitmap)&&(this._nullCount=t=r.length===0?0:this.length-Nu(r,this.offset,this.offset+this.length)),t}constructor(t,r,n,i,o,s=[],a,c=[]){var l;this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let h;o instanceof e?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets,this.variadicBuffers=o.variadicBuffers):(this.stride=Ln(t),o&&((h=o[0])&&(this.valueOffsets=h),(h=o[1])&&(this.values=h),(h=o[2])&&(this.nullBitmap=h),(h=o[3])&&(this.typeIds=h)),this.variadicBuffers=c),(l=this.variadicBuffers)!==null&&l!==void 0||(this.variadicBuffers=[])}getValid(t){let{type:r}=this;if(z.isUnion(r)){let n=r,i=this.typeIds[t],o=n.typeIdToChildIndex[i],s=this.children[o],a=this.valueOffsets,c=n.mode===qt.Dense&&a?Number(a[t]):t;return s.getValid(c)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,r){let n,{type:i}=this;if(z.isUnion(i)){let o=i,s=this.typeIds[t],a=o.typeIdToChildIndex[s],c=this.children[a],l=this.valueOffsets,h=o.mode===qt.Dense&&l?Number(l[t]):t;n=c.getValid(h),c.setValid(h,r)}else{let{nullBitmap:o}=this,{offset:s,length:a}=this,c=s+t,l=1<<c%8,h=c>>3;(!o||o.byteLength<=h)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0?(o.set(Ga(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o})):Object.assign(this,{nullBitmap:o,_nullCount:0}));let u=o[h];n=(u&l)!==0,o[h]=r?u|l:u&~l}return n!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(t=this.type,r=this.offset,n=this.length,i=this._nullCount,o=this,s=this.children,a=this.variadicBuffers){return new e(t,r,n,i,o,s,this.dictionary,a)}slice(t,r){let{stride:n,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,r,n,i);return this.clone(this.type,this.offset+t,r,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*r),this.variadicBuffers)}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===x.Null)return this.clone(this.type,0,t,0,this.buffers,this.children,this.variadicBuffers);let{length:r,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,r>>3);i[r>>3]=(1<<r-(r&-8))-1,n>0&&i.set(Ga(this.offset,r,this.nullBitmap),0);let o=this.buffers;return o[xe.VALIDITY]=i,this.clone(this.type,0,t,n+(t-r),o,this.children,this.variadicBuffers)}_sliceBuffers(t,r,n,i){let o,{buffers:s}=this;if((o=s[xe.TYPE])&&(s[xe.TYPE]=o.subarray(t,t+r)),z.isBinaryView(this.type)||z.isUtf8View(this.type)){let a=Mt.ELEMENT_WIDTH;(o=s[xe.DATA])&&(s[xe.DATA]=o.subarray(t*a,(t+r)*a))}else(o=s[xe.OFFSET])&&(s[xe.OFFSET]=o.subarray(t,t+r+1))||(o=s[xe.DATA])&&(s[xe.DATA]=i===6?o:o.subarray(n*t,n*(t+r)));return s}_sliceChildren(t,r,n){return t.map(i=>i.slice(r,n))}};ut.prototype.children=Object.freeze([]);ut.prototype[A4]=!0;Object.defineProperty(ut,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===ut&&ut.isData(t)}});e_=class e extends rt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:r,["offset"]:n=0,["length"]:i=0}=t;return new ut(r,n,i,i)}visitBool(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitInt(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.data),o=nt(t.nullBitmap),s=Oa(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,i,o])}visitUtf8View(t){var r;let{["type"]:n,["offset"]:i=0}=t,o=Tt(n.ArrayType,t.views),s=nt(t.nullBitmap),a=(t.variadicBuffers||[]).map(h=>nt(h)),c=(r=t.length)!==null&&r!==void 0?r:Math.trunc(o.length/qr.ELEMENT_WIDTH),l=t.nullBitmap?-1:0;return new ut(n,i,c,l,[void 0,o,s],[],void 0,a)}visitLargeUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.data),o=nt(t.nullBitmap),s=ou(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,i,o])}visitBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.data),o=nt(t.nullBitmap),s=Oa(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,i,o])}visitBinaryView(t){var r;let{["type"]:n,["offset"]:i=0}=t,o=Tt(n.ArrayType,t.views),s=nt(t.nullBitmap),a=(t.variadicBuffers||[]).map(h=>nt(h)),c=(r=t.length)!==null&&r!==void 0?r:Math.trunc(o.length/Mt.ELEMENT_WIDTH),l=t.nullBitmap?-1:0;return new ut(n,i,c,l,[void 0,o,s],[],void 0,a)}visitLargeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.data),o=nt(t.nullBitmap),s=ou(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitDate(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitTime(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitList(t){let{["type"]:r,["offset"]:n=0,["child"]:i}=t,o=nt(t.nullBitmap),s=Oa(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,void 0,o],[i])}visitLargeList(t){let{["type"]:r,["offset"]:n=0,["child"]:i}=t,o=nt(t.nullBitmap),s=ou(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=nt(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=Tt(r.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(z.isSparseUnion(r))return new ut(r,n,s,a,[void 0,void 0,void 0,o],i);let c=Oa(t.valueOffsets);return new ut(r,n,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.indices.ArrayType,t.data),{["dictionary"]:s=new $([new e().visit({type:r.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.valueType})}=t,o=nt(t.nullBitmap),{["length"]:s=i.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.childType})}=t,o=nt(t.nullBitmap),s=Oa(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,void 0,o],[i])}},mL=new e_});function P4(e){return e.some(t=>t.nullable)}function mp(e){return e.reduce((t,r)=>t+r.nullCount,0)}function pp(e){return e.reduce((t,r,n)=>(t[n+1]=t[n]+r.length,t),new Uint32Array(e.length+1))}function gp(e,t,r,n){let i=[];for(let o=-1,s=e.length;++o<s;){let a=e[o],c=t[o],{length:l}=a;if(c>=n)break;if(r>=c+l)continue;if(c>=r&&c+l<=n){i.push(a);continue}let h=Math.max(0,r-c),u=Math.min(n-c,l);i.push(a.slice(h,u-h))}return i.length===0&&i.push(e[0].slice(0,0)),i}function r_(e,t,r,n){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return r<t[s]?n(e,i,r-t[i]):null;o=i+Math.trunc((s-i)*.5),r<t[o]?s=o:i=o}while(i<s)}function Bu(e,t){return e.getValid(t)}function Bl(e){function t(r,n,i){return e(r[n],i)}return function(r){let n=this.data;return r_(n,this._offsets,r,t)}}function yp(e){let t;function r(n,i,o){return e(n[i],o,t)}return function(n,i){let o=this.data;t=i;let s=r_(o,this._offsets,n,r);return t=void 0,s}}function wp(e){let t;function r(n,i,o){let s=o,a=0,c=0;for(let l=i-1,h=n.length;++l<h;){let u=n[l];if(~(a=e(u,t,s)))return c+a;s=0,c+=u.length}return-1}return function(n,i){t=n;let o=this.data,s=typeof i!="number"?r(o,0,0):r_(o,this._offsets,i,r);return t=void 0,s}}var Ou,_p=w(()=>{Ou=class{constructor(t=0,r){this.numChunks=t,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}}});function pL(e,t){return t===null&&e.length>0?0:-1}function gL(e,t){let{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let n=0;for(let i of new ji(r,e.offset+(t||0),e.length,r,Ol)){if(!i)return n;++n}return-1}function gt(e,t,r){if(t===void 0)return-1;if(t===null)switch(e.typeId){case x.Union:break;case x.Dictionary:break;default:return gL(e,r)}let n=We.getVisitFn(e),i=Bs(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}function R4(e,t,r){let n=We.getVisitFn(e),i=Bs(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}var ot,ka,Mp=w(()=>{Ne();fn();Fa();Va();Nl();ot=class extends rt{};ot.prototype.visitNull=pL;ot.prototype.visitBool=gt;ot.prototype.visitInt=gt;ot.prototype.visitInt8=gt;ot.prototype.visitInt16=gt;ot.prototype.visitInt32=gt;ot.prototype.visitInt64=gt;ot.prototype.visitUint8=gt;ot.prototype.visitUint16=gt;ot.prototype.visitUint32=gt;ot.prototype.visitUint64=gt;ot.prototype.visitFloat=gt;ot.prototype.visitFloat16=gt;ot.prototype.visitFloat32=gt;ot.prototype.visitFloat64=gt;ot.prototype.visitUtf8=gt;ot.prototype.visitLargeUtf8=gt;ot.prototype.visitUtf8View=gt;ot.prototype.visitBinary=gt;ot.prototype.visitLargeBinary=gt;ot.prototype.visitBinaryView=gt;ot.prototype.visitFixedSizeBinary=gt;ot.prototype.visitDate=gt;ot.prototype.visitDateDay=gt;ot.prototype.visitDateMillisecond=gt;ot.prototype.visitTimestamp=gt;ot.prototype.visitTimestampSecond=gt;ot.prototype.visitTimestampMillisecond=gt;ot.prototype.visitTimestampMicrosecond=gt;ot.prototype.visitTimestampNanosecond=gt;ot.prototype.visitTime=gt;ot.prototype.visitTimeSecond=gt;ot.prototype.visitTimeMillisecond=gt;ot.prototype.visitTimeMicrosecond=gt;ot.prototype.visitTimeNanosecond=gt;ot.prototype.visitDecimal=gt;ot.prototype.visitList=gt;ot.prototype.visitLargeList=gt;ot.prototype.visitStruct=gt;ot.prototype.visitUnion=gt;ot.prototype.visitDenseUnion=R4;ot.prototype.visitSparseUnion=R4;ot.prototype.visitDictionary=gt;ot.prototype.visitInterval=gt;ot.prototype.visitIntervalDayTime=gt;ot.prototype.visitIntervalYearMonth=gt;ot.prototype.visitIntervalMonthDayNano=gt;ot.prototype.visitDuration=gt;ot.prototype.visitDurationSecond=gt;ot.prototype.visitDurationMillisecond=gt;ot.prototype.visitDurationMicrosecond=gt;ot.prototype.visitDurationNanosecond=gt;ot.prototype.visitFixedSizeList=gt;ot.prototype.visitMap=gt;ka=new ot});function ft(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(z.isInt(t)&&t.bitWidth!==64||z.isTime(t)&&t.bitWidth!==64||z.isFloat(t)&&t.precision!==Vt.HALF))return new Ou(e.data.length,n=>{let i=e.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let r=0;return new Ou(e.data.length,n=>{let o=e.data[n].length,s=e.slice(r,r+o);return r+=o,new n_(s)})}var st,n_,Ll,bp=w(()=>{fn();Ne();te();_p();st=class extends rt{};n_=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};st.prototype.visitNull=ft;st.prototype.visitBool=ft;st.prototype.visitInt=ft;st.prototype.visitInt8=ft;st.prototype.visitInt16=ft;st.prototype.visitInt32=ft;st.prototype.visitInt64=ft;st.prototype.visitUint8=ft;st.prototype.visitUint16=ft;st.prototype.visitUint32=ft;st.prototype.visitUint64=ft;st.prototype.visitFloat=ft;st.prototype.visitFloat16=ft;st.prototype.visitFloat32=ft;st.prototype.visitFloat64=ft;st.prototype.visitUtf8=ft;st.prototype.visitLargeUtf8=ft;st.prototype.visitUtf8View=ft;st.prototype.visitBinary=ft;st.prototype.visitLargeBinary=ft;st.prototype.visitBinaryView=ft;st.prototype.visitFixedSizeBinary=ft;st.prototype.visitDate=ft;st.prototype.visitDateDay=ft;st.prototype.visitDateMillisecond=ft;st.prototype.visitTimestamp=ft;st.prototype.visitTimestampSecond=ft;st.prototype.visitTimestampMillisecond=ft;st.prototype.visitTimestampMicrosecond=ft;st.prototype.visitTimestampNanosecond=ft;st.prototype.visitTime=ft;st.prototype.visitTimeSecond=ft;st.prototype.visitTimeMillisecond=ft;st.prototype.visitTimeMicrosecond=ft;st.prototype.visitTimeNanosecond=ft;st.prototype.visitDecimal=ft;st.prototype.visitList=ft;st.prototype.visitLargeList=ft;st.prototype.visitStruct=ft;st.prototype.visitUnion=ft;st.prototype.visitDenseUnion=ft;st.prototype.visitSparseUnion=ft;st.prototype.visitDictionary=ft;st.prototype.visitInterval=ft;st.prototype.visitIntervalDayTime=ft;st.prototype.visitIntervalYearMonth=ft;st.prototype.visitIntervalMonthDayNano=ft;st.prototype.visitDuration=ft;st.prototype.visitDurationSecond=ft;st.prototype.visitDurationMillisecond=ft;st.prototype.visitDurationMicrosecond=ft;st.prototype.visitDurationNanosecond=ft;st.prototype.visitFixedSizeList=ft;st.prototype.visitMap=ft;Ll=new st});function Wi(e){if(e){if(e instanceof ut)return new $([e]);if(e instanceof $)return new $(e.data);if(e.type instanceof z)return new $([Q(e)]);if(Array.isArray(e))return new $(e.flatMap(t=>yL(t)));if(ArrayBuffer.isView(e)){e instanceof DataView&&(e=new Uint8Array(e.buffer));let t={offset:0,length:e.length,nullCount:-1,data:e};if(e instanceof Int8Array)return new $([Q(Object.assign(Object.assign({},t),{type:new An}))]);if(e instanceof Int16Array)return new $([Q(Object.assign(Object.assign({},t),{type:new Pn}))]);if(e instanceof Int32Array)return new $([Q(Object.assign(Object.assign({},t),{type:new ze}))]);if(e instanceof BigInt64Array)return new $([Q(Object.assign(Object.assign({},t),{type:new Rn}))]);if(e instanceof Uint8Array||e instanceof Uint8ClampedArray)return new $([Q(Object.assign(Object.assign({},t),{type:new Cn}))]);if(e instanceof Uint16Array)return new $([Q(Object.assign(Object.assign({},t),{type:new Nn}))]);if(e instanceof Uint32Array)return new $([Q(Object.assign(Object.assign({},t),{type:new Vr}))]);if(e instanceof BigUint64Array)return new $([Q(Object.assign(Object.assign({},t),{type:new yi}))]);if(e instanceof Float32Array)return new $([Q(Object.assign(Object.assign({},t),{type:new kr}))]);if(e instanceof Float64Array)return new $([Q(Object.assign(Object.assign({},t),{type:new On}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function yL(e){return e instanceof ut?[e]:e instanceof $?e.data:Wi(e).data}var C4,N4,O4,B4,$,xp,Ar=w(()=>{Ne();Nl();te();Xn();_p();Fa();Dn();Mp();bp();te();N4=Symbol.for("apache-arrow/Vector"),O4={},B4={},$=class e{static isVector(t){return t?.[N4]===!0}constructor(t){var r,n,i;let o=t[0]instanceof e?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof ut)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(r=o[0])===null||r===void 0?void 0:r.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=O4[s.typeId],h=o[0];this.isValid=u=>Bu(h,u),this.get=u=>a(h,u),this.set=(u,f)=>c(h,u,f),this.indexOf=u=>l(h,u),this._offsets=[0,h.length];break}default:Object.setPrototypeOf(this,B4[s.typeId]),this._offsets=pp(o);break}this.data=o,this.type=s,this.stride=Ln(s),this.numChildren=(i=(n=s.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,r)=>t+r.byteLength,0)}get nullable(){return P4(this.data)}get nullCount(){return mp(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(Ua(t,this.length))}set(t,r){}indexOf(t,r){return-1}includes(t,r){return this.indexOf(t,r)>-1}[Symbol.iterator](){return Ll.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(t,r){return new e(Cu(this,t,r,({data:n,_offsets:i},o,s)=>gp(n,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:r,length:n,stride:i,ArrayType:o}=this;switch(t.typeId){case x.Int:case x.Float:case x.Decimal:case x.Time:case x.Timestamp:switch(r.length){case 0:return new o;case 1:return r[0].values.subarray(0,n*i);default:return r.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:r})=>r[t])):null}get isMemoized(){return z.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(z.isDictionary(this.type)){let t=new xp(this.data[0].dictionary),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return new xp(this)}unmemoize(){if(z.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return this}};C4=Symbol.toStringTag;$[C4]=(e=>{e.type=z.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0,e[N4]=!0;let t=Object.keys(x).map(r=>x[r]).filter(r=>typeof r=="number"&&r!==x.NONE);for(let r of t){let n=We.getVisitFnByTypeId(r),i=mr.getVisitFnByTypeId(r),o=ka.getVisitFnByTypeId(r);O4[r]={get:n,set:i,indexOf:o},B4[r]=Object.create(e,{isValid:{value:Bl(Bu)},get:{value:Bl(We.getVisitFnByTypeId(r))},set:{value:yp(mr.getVisitFnByTypeId(r))},indexOf:{value:wp(ka.getVisitFnByTypeId(r))}})}return"Vector"})($.prototype);Object.defineProperty($,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===$&&$.isVector(t)}});xp=class e extends ${constructor(t){super(t.data);let r=this.get,n=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=r.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){n.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new e(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new $(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}});function L4(e){if(!e||e.length<=0)return function(i){return!0};let t="",r=e.filter(n=>n===n);return r.length>0&&(t=`
|
|
7
|
+
"use strict";var __exports__=(()=>{var xP=Object.create;var uf=Object.defineProperty;var SP=Object.getOwnPropertyDescriptor;var vP=Object.getOwnPropertyNames;var EP=Object.getPrototypeOf,TP=Object.prototype.hasOwnProperty;var w=(e,t,r)=>()=>{if(r)throw r[0];try{return e&&(t=e(e=0)),t}catch(n){throw r=[n],n}};var IP=(e,t)=>()=>{try{return t||e((t={exports:{}}).exports,t),t.exports}catch(r){throw t=0,r}},Zr=(e,t)=>{for(var r in t)uf(e,r,{get:t[r],enumerable:!0})},hf=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of vP(t))!TP.call(e,i)&&i!==r&&uf(e,i,{get:()=>t[i],enumerable:!(n=SP(t,i))||n.enumerable});return e},ff=(e,t,r)=>(hf(e,t,"default"),r&&hf(r,t,"default")),AP=(e,t,r)=>(r=e!=null?xP(EP(e)):{},hf(t||!e||!e.__esModule?uf(r,"default",{value:e,enumerable:!0}):r,e)),PP=e=>hf(uf({},"__esModule",{value:!0}),e);var BM=IP((ZD,OM)=>{OM.exports=globalThis.loaders});var we={};Zr(we,{EPSILON1:()=>RP,EPSILON10:()=>GP,EPSILON11:()=>zP,EPSILON12:()=>VP,EPSILON13:()=>kP,EPSILON14:()=>df,EPSILON15:()=>qP,EPSILON16:()=>jP,EPSILON17:()=>WP,EPSILON18:()=>HP,EPSILON19:()=>$P,EPSILON2:()=>CP,EPSILON20:()=>YP,EPSILON3:()=>NP,EPSILON4:()=>OP,EPSILON5:()=>BP,EPSILON6:()=>LP,EPSILON7:()=>DP,EPSILON8:()=>FP,EPSILON9:()=>UP,PI:()=>Sc,PI_OVER_FOUR:()=>XP,PI_OVER_SIX:()=>ZP,PI_OVER_TWO:()=>KP,TWO_PI:()=>rh});var RP,CP,NP,OP,BP,LP,DP,FP,UP,GP,zP,VP,kP,df,qP,jP,WP,HP,$P,YP,KP,XP,ZP,Sc,rh,I0=w(()=>{RP=.1,CP=.01,NP=.001,OP=1e-4,BP=1e-5,LP=1e-6,DP=1e-7,FP=1e-8,UP=1e-9,GP=1e-10,zP=1e-11,VP=1e-12,kP=1e-13,df=1e-14,qP=1e-15,jP=1e-16,WP=1e-17,HP=1e-18,$P=1e-19,YP=1e-20,KP=Math.PI/2,XP=Math.PI/4,ZP=Math.PI/6,Sc=Math.PI,rh=Math.PI*2});function A0(e,{precision:t=ie.precision}={}){return e=rR(e),`${parseFloat(e.toPrecision(t))}`}function zn(e){return Array.isArray(e)||ArrayBuffer.isView(e)&&!(e instanceof DataView)}function P0(e){return mf(e)}function R0(e){return Br(e)}function mf(e,t){return N0(e,r=>r*QP,t)}function Br(e,t){return N0(e,r=>r*JP,t)}function LM(e,t){return Math.sign(e)===Math.sign(t)&&Math.abs(e)<Math.abs(t)?e:(e%t+t)%t}function C0(e,t){switch(t){case"negative-pi-to-pi":return eR(e);case"zero-to-two-pi":return DM(e);default:return e}}function DM(e){if(e>=0&&e<=rh)return e;let t=LM(e,rh);return Math.abs(t)<1e-14&&Math.abs(e)>1e-14?rh:t}function eR(e){return e>=-Sc&&e<=Sc?e:DM(e+Sc)-Sc}function nh(e,t,r){return N0(e,n=>Math.max(t,Math.min(r,n)))}function Go(e,t,r){let n=ie.EPSILON;r&&(ie.EPSILON=r);try{if(e===t)return!0;if(zn(e)&&zn(t)){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(!Go(e[i],t[i]))return!1;return!0}return e&&e.equals?e.equals(t):t&&t.equals?t.equals(e):typeof e=="number"&&typeof t=="number"?Math.abs(e-t)<=ie.EPSILON*Math.max(1,Math.abs(e),Math.abs(t)):!1}finally{ie.EPSILON=n}}function rR(e){return Math.round(e/ie.EPSILON)*ie.EPSILON}function nR(e){return e.clone?e.clone():new Array(e.length)}function N0(e,t,r){if(zn(e)){let n=e;r=r||nR(n);for(let i=0;i<r.length&&i<n.length;++i){let o=typeof e=="number"?e:e[i];r[i]=t(o,i,r)}return r}return t(e)}var JP,QP,tR,ie,ha=w(()=>{I0();JP=1/Math.PI*180,QP=1/180*Math.PI,tR={EPSILON:1e-12,debug:!1,precision:4,printTypes:!1,printDegrees:!1,printRowMajor:!0,_cartographicRadians:!1};globalThis.mathgl=globalThis.mathgl||{config:{...tR}};ie=globalThis.mathgl.config});var zo,pf=w(()=>{ha();zo=class extends Array{clone(){return new this.constructor().copy(this)}fromArray(t,r=0){for(let n=0;n<this.ELEMENTS;++n)this[n]=t[n+r];return this.check()}toArray(t=[],r=0){for(let n=0;n<this.ELEMENTS;++n)t[r+n]=this[n];return t}toObject(t){return t}from(t){return Array.isArray(t)?this.copy(t):this.fromObject(t)}to(t){return t===this?this:zn(t)?this.toArray(t):this.toObject(t)}toTarget(t){return t?this.to(t):this}toString(){return this.formatString(ie)}formatString(t){let r="";for(let n=0;n<this.ELEMENTS;++n)r+=(n>0?", ":"")+A0(this[n],t);return`${t.printTypes?this.constructor.name:""}[${r}]`}equals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(!Go(this[r],t[r]))return!1;return!0}exactEquals(t){if(!t||this.length!==t.length)return!1;for(let r=0;r<this.ELEMENTS;++r)if(this[r]!==t[r])return!1;return!0}negate(){for(let t=0;t<this.ELEMENTS;++t)this[t]=-this[t];return this.check()}lerp(t,r,n){if(n===void 0)return this.lerp(this,t,r);for(let i=0;i<this.ELEMENTS;++i){let o=t[i],s=typeof r=="number"?r:r[i];this[i]=o+n*(s-o)}return this.check()}min(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.min(t[r],this[r]);return this.check()}max(t){for(let r=0;r<this.ELEMENTS;++r)this[r]=Math.max(t[r],this[r]);return this.check()}clamp(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]=Math.min(Math.max(this[n],t[n]),r[n]);return this.check()}add(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]+=r[n];return this.check()}subtract(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]-=r[n];return this.check()}scale(t){if(typeof t=="number")for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;else for(let r=0;r<this.ELEMENTS&&r<t.length;++r)this[r]*=t[r];return this.check()}multiplyByScalar(t){for(let r=0;r<this.ELEMENTS;++r)this[r]*=t;return this.check()}check(){if(ie.debug&&!this.validate())throw new Error(`math.gl: ${this.constructor.name} some fields set to invalid numbers'`);return this}validate(){let t=this.length===this.ELEMENTS;for(let r=0;r<this.ELEMENTS;++r)t=t&&Number.isFinite(this[r]);return t}}});function iR(e,t){if(e.length!==t)return!1;for(let r=0;r<e.length;++r)if(!Number.isFinite(e[r]))return!1;return!0}function he(e){if(!Number.isFinite(e))throw new Error(`Invalid number ${JSON.stringify(e)}`);return e}function vc(e,t,r=""){if(ie.debug&&!iR(e,t))throw new Error(`math.gl: ${r} some fields set to invalid numbers'`);return e}var Vo=w(()=>{ha()});var Ec,O0=w(()=>{pf();Vo();ha();Ec=class extends zo{toString(){let t="[";if(ie.printRowMajor){t+="row-major:";for(let r=0;r<this.RANK;++r)for(let n=0;n<this.RANK;++n)t+=` ${this[n*this.RANK+r]}`}else{t+="column-major:";for(let r=0;r<this.ELEMENTS;++r)t+=` ${this[r]}`}return t+="]",t}getElementIndex(t,r){return r*this.RANK+t}getElement(t,r){return this[r*this.RANK+t]}setElement(t,r,n){return this[r*this.RANK+t]=he(n),this}getColumn(t,r=new Array(this.RANK).fill(-0)){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)r[i]=this[n+i];return r}setColumn(t,r){let n=t*this.RANK;for(let i=0;i<this.RANK;++i)this[n+i]=r[i];return this}}});function pr(e,t){if(!e)throw new Error(`math.gl assertion ${t}`)}var B0=w(()=>{});var Tc,L0=w(()=>{pf();Vo();B0();Tc=class extends zo{get x(){return this[0]}set x(t){this[0]=he(t)}get y(){return this[1]}set y(t){this[1]=he(t)}len(){return Math.sqrt(this.lengthSquared())}magnitude(){return this.len()}lengthSquared(){let t=0;for(let r=0;r<this.ELEMENTS;++r)t+=this[r]*this[r];return t}magnitudeSquared(){return this.lengthSquared()}distance(t){return Math.sqrt(this.distanceSquared(t))}distanceSquared(t){let r=0;for(let n=0;n<this.ELEMENTS;++n){let i=this[n]-t[n];r+=i*i}return he(r)}dot(t){let r=0;for(let n=0;n<this.ELEMENTS;++n)r+=this[n]*t[n];return he(r)}normalize(){let t=this.magnitude();if(t!==0)for(let r=0;r<this.ELEMENTS;++r)this[r]/=t;return this.check()}multiply(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]*=r[n];return this.check()}divide(...t){for(let r of t)for(let n=0;n<this.ELEMENTS;++n)this[n]/=r[n];return this.check()}lengthSq(){return this.lengthSquared()}distanceTo(t){return this.distance(t)}distanceToSquared(t){return this.distanceSquared(t)}getComponent(t){return pr(t>=0&&t<this.ELEMENTS,"index is out of range"),he(this[t])}setComponent(t,r){return pr(t>=0&&t<this.ELEMENTS,"index is out of range"),this[t]=r,this.check()}addVectors(t,r){return this.copy(t).add(r)}subVectors(t,r){return this.copy(t).subtract(r)}multiplyVectors(t,r){return this.copy(t).multiply(r)}addScaledVector(t,r){for(let n=0;n<this.ELEMENTS;++n)this[n]+=t[n]*r;return this.check()}}});var gf,dF,FM=w(()=>{gf=typeof Float32Array<"u"?Float32Array:Array,dF=Math.PI/180});function UM(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e}function GM(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i+r[4],e[1]=r[1]*n+r[3]*i+r[5],e}function yf(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[3]*i+r[6],e[1]=r[1]*n+r[4]*i+r[7],e}function wf(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[4]*i+r[12],e[1]=r[1]*n+r[5]*i+r[13],e}var ih=w(()=>{});function _f(e,t,r){let n=t[0],i=t[1],o=r[3]*n+r[7]*i||1;return e[0]=(r[0]*n+r[4]*i)/o,e[1]=(r[1]*n+r[5]*i)/o,e}function Mf(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[3]*n+r[7]*i+r[11]*o||1;return e[0]=(r[0]*n+r[4]*i+r[8]*o)/s,e[1]=(r[1]*n+r[5]*i+r[9]*o)/s,e[2]=(r[2]*n+r[6]*i+r[10]*o)/s,e}function zM(e,t,r){let n=t[0],i=t[1];return e[0]=r[0]*n+r[2]*i,e[1]=r[1]*n+r[3]*i,e[2]=t[2],e}function VM(e,t,r){let n=t[0],i=t[1],o=t[2];return e[0]=r[0]*n+r[3]*i+r[6]*o,e[1]=r[1]*n+r[4]*i+r[7]*o,e[2]=r[2]*n+r[5]*i+r[8]*o,e[3]=t[3],e}var oh=w(()=>{});var Jr,kM=w(()=>{L0();ha();Vo();ih();oh();Jr=class extends Tc{constructor(t=0,r=0){super(2),zn(t)&&arguments.length===1?this.copy(t):(ie.debug&&(he(t),he(r)),this[0]=t,this[1]=r)}set(t,r){return this[0]=t,this[1]=r,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this.check()}fromObject(t){return ie.debug&&(he(t.x),he(t.y)),this[0]=t.x,this[1]=t.y,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t}get ELEMENTS(){return 2}horizontalAngle(){return Math.atan2(this.y,this.x)}verticalAngle(){return Math.atan2(this.x,this.y)}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return wf(this,this,t),this.check()}transformAsVector(t){return _f(this,this,t),this.check()}transformByMatrix3(t){return yf(this,this,t),this.check()}transformByMatrix2x3(t){return GM(this,this,t),this.check()}transformByMatrix2(t){return UM(this,this,t),this.check()}}});function qM(){let e=new gf(3);return gf!==Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function sR(e){let t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function D0(e,t,r){let n=new gf(3);return n[0]=e,n[1]=t,n[2]=r,n}function jM(e,t){let r=t[0],n=t[1],i=t[2],o=r*r+n*n+i*i;return o>0&&(o=1/Math.sqrt(o)),e[0]=t[0]*o,e[1]=t[1]*o,e[2]=t[2]*o,e}function F0(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function Ic(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[0],a=r[1],c=r[2];return e[0]=i*c-o*a,e[1]=o*s-n*c,e[2]=n*a-i*s,e}function bf(e,t,r){let n=t[0],i=t[1],o=t[2],s=r[3]*n+r[7]*i+r[11]*o+r[15];return s=s||1,e[0]=(r[0]*n+r[4]*i+r[8]*o+r[12])/s,e[1]=(r[1]*n+r[5]*i+r[9]*o+r[13])/s,e[2]=(r[2]*n+r[6]*i+r[10]*o+r[14])/s,e}function xf(e,t,r){let n=t[0],i=t[1],o=t[2];return e[0]=n*r[0]+i*r[3]+o*r[6],e[1]=n*r[1]+i*r[4]+o*r[7],e[2]=n*r[2]+i*r[5]+o*r[8],e}function WM(e,t,r){let n=r[0],i=r[1],o=r[2],s=r[3],a=t[0],c=t[1],l=t[2],h=i*l-o*c,u=o*a-n*l,f=n*c-i*a,d=i*f-o*u,m=o*h-n*f,p=n*u-i*h,g=s*2;return h*=g,u*=g,f*=g,d*=2,m*=2,p*=2,e[0]=a+h+d,e[1]=c+u+m,e[2]=l+f+p,e}function HM(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[0],o[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),o[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function $M(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),o[1]=i[1],o[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function YM(e,t,r,n){let i=[],o=[];return i[0]=t[0]-r[0],i[1]=t[1]-r[1],i[2]=t[2]-r[2],o[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),o[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),o[2]=i[2],e[0]=o[0]+r[0],e[1]=o[1]+r[1],e[2]=o[2]+r[2],e}function KM(e,t){let r=e[0],n=e[1],i=e[2],o=t[0],s=t[1],a=t[2],c=Math.sqrt((r*r+n*n+i*i)*(o*o+s*s+a*a)),l=c&&F0(e,t)/c;return Math.acos(Math.min(Math.max(l,-1),1))}var XM,Ac=w(()=>{FM();XM=sR});var U0,Sf,I,ZM=w(()=>{L0();ha();Vo();Ac();oh();U0=[0,0,0],I=class e extends Tc{static get ZERO(){return Sf||(Sf=new e(0,0,0),Object.freeze(Sf)),Sf}constructor(t=0,r=0,n=0){super(-0,-0,-0),arguments.length===1&&zn(t)?this.copy(t):(ie.debug&&(he(t),he(r),he(n)),this[0]=t,this[1]=r,this[2]=n)}set(t,r,n){return this[0]=t,this[1]=r,this[2]=n,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this.check()}fromObject(t){return ie.debug&&(he(t.x),he(t.y),he(t.z)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this.check()}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t}get ELEMENTS(){return 3}get z(){return this[2]}set z(t){this[2]=he(t)}angle(t){return KM(this,t)}cross(t){return Ic(this,this,t),this.check()}rotateX({radians:t,origin:r=U0}){return HM(this,this,r,t),this.check()}rotateY({radians:t,origin:r=U0}){return $M(this,this,r,t),this.check()}rotateZ({radians:t,origin:r=U0}){return YM(this,this,r,t),this.check()}transform(t){return this.transformAsPoint(t)}transformAsPoint(t){return bf(this,this,t),this.check()}transformAsVector(t){return Mf(this,this,t),this.check()}transformByMatrix3(t){return xf(this,this,t),this.check()}transformByMatrix2(t){return zM(this,this,t),this.check()}transformByQuaternion(t){return WM(this,this,t),this.check()}}});function JM(e,t){if(e===t){let r=t[1],n=t[2],i=t[5];e[1]=t[3],e[2]=t[6],e[3]=r,e[5]=t[7],e[6]=n,e[7]=i}else e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8];return e}function QM(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=t[4],a=t[5],c=t[6],l=t[7],h=t[8],u=h*s-a*l,f=-h*o+a*c,d=l*o-s*c,m=r*u+n*f+i*d;return m?(m=1/m,e[0]=u*m,e[1]=(-h*n+i*l)*m,e[2]=(a*n-i*s)*m,e[3]=f*m,e[4]=(h*r-i*c)*m,e[5]=(-a*r+i*o)*m,e[6]=d*m,e[7]=(-l*r+n*c)*m,e[8]=(s*r-n*o)*m,e):null}function t2(e){let t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],s=e[5],a=e[6],c=e[7],l=e[8];return t*(l*o-s*c)+r*(-l*i+s*a)+n*(c*i-o*a)}function G0(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=r[0],d=r[1],m=r[2],p=r[3],g=r[4],y=r[5],_=r[6],M=r[7],b=r[8];return e[0]=f*n+d*s+m*l,e[1]=f*i+d*a+m*h,e[2]=f*o+d*c+m*u,e[3]=p*n+g*s+y*l,e[4]=p*i+g*a+y*h,e[5]=p*o+g*c+y*u,e[6]=_*n+M*s+b*l,e[7]=_*i+M*a+b*h,e[8]=_*o+M*c+b*u,e}function e2(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=r[0],d=r[1];return e[0]=n,e[1]=i,e[2]=o,e[3]=s,e[4]=a,e[5]=c,e[6]=f*n+d*s+l,e[7]=f*i+d*a+h,e[8]=f*o+d*c+u,e}function r2(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=Math.sin(r),d=Math.cos(r);return e[0]=d*n+f*s,e[1]=d*i+f*a,e[2]=d*o+f*c,e[3]=d*s-f*n,e[4]=d*a-f*i,e[5]=d*c-f*o,e[6]=l,e[7]=h,e[8]=u,e}function z0(e,t,r){let n=r[0],i=r[1];return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=i*t[3],e[4]=i*t[4],e[5]=i*t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e}function n2(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r+r,a=n+n,c=i+i,l=r*s,h=n*s,u=n*a,f=i*s,d=i*a,m=i*c,p=o*s,g=o*a,y=o*c;return e[0]=1-u-m,e[3]=h-y,e[6]=f+g,e[1]=h+y,e[4]=1-l-m,e[7]=d-p,e[2]=f-g,e[5]=d+p,e[8]=1-l-u,e}var V0=w(()=>{});function lR(){return vf||(vf=new Qr([0,0,0,0,0,0,0,0,0]),Object.freeze(vf)),vf}function hR(){return Ef||(Ef=new Qr,Object.freeze(Ef)),Ef}var k0,cR,Qr,vf,Ef,i2=w(()=>{O0();Vo();oh();V0();ih();Ac();(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL1ROW0=3]="COL1ROW0",e[e.COL1ROW1=4]="COL1ROW1",e[e.COL1ROW2=5]="COL1ROW2",e[e.COL2ROW0=6]="COL2ROW0",e[e.COL2ROW1=7]="COL2ROW1",e[e.COL2ROW2=8]="COL2ROW2"})(k0||(k0={}));cR=Object.freeze([1,0,0,0,1,0,0,0,1]),Qr=class extends Ec{static get IDENTITY(){return hR()}static get ZERO(){return lR()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return k0}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this.check()}identity(){return this.copy(cR)}fromObject(t){return this.check()}fromQuaternion(t){return n2(this,t),this.check()}fromMatrix4(t){return this.set(t[0],t[1],t[2],t[4],t[5],t[6],t[8],t[9],t[10])}set(t,r,n,i,o,s,a,c,l){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this[4]=o,this[5]=s,this[6]=a,this[7]=c,this[8]=l,this.check()}setRowMajor(t,r,n,i,o,s,a,c,l){return this[0]=t,this[1]=i,this[2]=a,this[3]=r,this[4]=o,this[5]=c,this[6]=n,this[7]=s,this[8]=l,this.check()}determinant(){return t2(this)}transpose(){return JM(this,this),this.check()}invert(){return QM(this,this),this.check()}multiplyLeft(t){return G0(this,t,this),this.check()}multiplyRight(t){return G0(this,this,t),this.check()}rotate(t){return r2(this,this,t),this.check()}scale(t){return Array.isArray(t)?z0(this,this,t):z0(this,this,[t,t]),this.check()}translate(t){return e2(this,this,t),this.check()}transform(t,r){let n;switch(t.length){case 2:n=yf(r||[-0,-0],t,this);break;case 3:n=xf(r||[-0,-0,-0],t,this);break;case 4:n=VM(r||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return vc(n,t.length),n}},Ef=null});function o2(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function q0(e,t){if(e===t){let r=t[1],n=t[2],i=t[3],o=t[6],s=t[7],a=t[11];e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=r,e[6]=t[9],e[7]=t[13],e[8]=n,e[9]=o,e[11]=t[14],e[12]=i,e[13]=s,e[14]=a}else e[0]=t[0],e[1]=t[4],e[2]=t[8],e[3]=t[12],e[4]=t[1],e[5]=t[5],e[6]=t[9],e[7]=t[13],e[8]=t[2],e[9]=t[6],e[10]=t[10],e[11]=t[14],e[12]=t[3],e[13]=t[7],e[14]=t[11],e[15]=t[15];return e}function j0(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=t[4],a=t[5],c=t[6],l=t[7],h=t[8],u=t[9],f=t[10],d=t[11],m=t[12],p=t[13],g=t[14],y=t[15],_=r*a-n*s,M=r*c-i*s,b=r*l-o*s,v=n*c-i*a,T=n*l-o*a,S=i*l-o*c,E=h*p-u*m,N=h*g-f*m,B=h*y-d*m,C=u*g-f*p,R=u*y-d*p,W=f*y-d*g,j=_*W-M*R+b*C+v*B-T*N+S*E;return j?(j=1/j,e[0]=(a*W-c*R+l*C)*j,e[1]=(i*R-n*W-o*C)*j,e[2]=(p*S-g*T+y*v)*j,e[3]=(f*T-u*S-d*v)*j,e[4]=(c*B-s*W-l*N)*j,e[5]=(r*W-i*B+o*N)*j,e[6]=(g*b-m*S-y*M)*j,e[7]=(h*S-f*b+d*M)*j,e[8]=(s*R-a*B+l*E)*j,e[9]=(n*B-r*R-o*E)*j,e[10]=(m*T-p*b+y*_)*j,e[11]=(u*b-h*T-d*_)*j,e[12]=(a*N-s*C-c*E)*j,e[13]=(r*C-n*N+i*E)*j,e[14]=(p*M-m*v-g*_)*j,e[15]=(h*v-u*M+f*_)*j,e):null}function W0(e){let t=e[0],r=e[1],n=e[2],i=e[3],o=e[4],s=e[5],a=e[6],c=e[7],l=e[8],h=e[9],u=e[10],f=e[11],d=e[12],m=e[13],p=e[14],g=e[15],y=t*s-r*o,_=t*a-n*o,M=r*a-n*s,b=l*m-h*d,v=l*p-u*d,T=h*p-u*m,S=t*T-r*v+n*b,E=o*T-s*v+a*b,N=l*M-h*_+u*y,B=d*M-m*_+p*y;return c*S-i*E+g*N-f*B}function Tf(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=t[4],c=t[5],l=t[6],h=t[7],u=t[8],f=t[9],d=t[10],m=t[11],p=t[12],g=t[13],y=t[14],_=t[15],M=r[0],b=r[1],v=r[2],T=r[3];return e[0]=M*n+b*a+v*u+T*p,e[1]=M*i+b*c+v*f+T*g,e[2]=M*o+b*l+v*d+T*y,e[3]=M*s+b*h+v*m+T*_,M=r[4],b=r[5],v=r[6],T=r[7],e[4]=M*n+b*a+v*u+T*p,e[5]=M*i+b*c+v*f+T*g,e[6]=M*o+b*l+v*d+T*y,e[7]=M*s+b*h+v*m+T*_,M=r[8],b=r[9],v=r[10],T=r[11],e[8]=M*n+b*a+v*u+T*p,e[9]=M*i+b*c+v*f+T*g,e[10]=M*o+b*l+v*d+T*y,e[11]=M*s+b*h+v*m+T*_,M=r[12],b=r[13],v=r[14],T=r[15],e[12]=M*n+b*a+v*u+T*p,e[13]=M*i+b*c+v*f+T*g,e[14]=M*o+b*l+v*d+T*y,e[15]=M*s+b*h+v*m+T*_,e}function H0(e,t,r){let n=r[0],i=r[1],o=r[2],s,a,c,l,h,u,f,d,m,p,g,y;return t===e?(e[12]=t[0]*n+t[4]*i+t[8]*o+t[12],e[13]=t[1]*n+t[5]*i+t[9]*o+t[13],e[14]=t[2]*n+t[6]*i+t[10]*o+t[14],e[15]=t[3]*n+t[7]*i+t[11]*o+t[15]):(s=t[0],a=t[1],c=t[2],l=t[3],h=t[4],u=t[5],f=t[6],d=t[7],m=t[8],p=t[9],g=t[10],y=t[11],e[0]=s,e[1]=a,e[2]=c,e[3]=l,e[4]=h,e[5]=u,e[6]=f,e[7]=d,e[8]=m,e[9]=p,e[10]=g,e[11]=y,e[12]=s*n+h*i+m*o+t[12],e[13]=a*n+u*i+p*o+t[13],e[14]=c*n+f*i+g*o+t[14],e[15]=l*n+d*i+y*o+t[15]),e}function $0(e,t,r){let n=r[0],i=r[1],o=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*o,e[9]=t[9]*o,e[10]=t[10]*o,e[11]=t[11]*o,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function Y0(e,t,r,n){let i=n[0],o=n[1],s=n[2],a=Math.sqrt(i*i+o*o+s*s),c,l,h,u,f,d,m,p,g,y,_,M,b,v,T,S,E,N,B,C,R,W,j,A;return a<1e-6?null:(a=1/a,i*=a,o*=a,s*=a,l=Math.sin(r),c=Math.cos(r),h=1-c,u=t[0],f=t[1],d=t[2],m=t[3],p=t[4],g=t[5],y=t[6],_=t[7],M=t[8],b=t[9],v=t[10],T=t[11],S=i*i*h+c,E=o*i*h+s*l,N=s*i*h-o*l,B=i*o*h-s*l,C=o*o*h+c,R=s*o*h+i*l,W=i*s*h+o*l,j=o*s*h-i*l,A=s*s*h+c,e[0]=u*S+p*E+M*N,e[1]=f*S+g*E+b*N,e[2]=d*S+y*E+v*N,e[3]=m*S+_*E+T*N,e[4]=u*B+p*C+M*R,e[5]=f*B+g*C+b*R,e[6]=d*B+y*C+v*R,e[7]=m*B+_*C+T*R,e[8]=u*W+p*j+M*A,e[9]=f*W+g*j+b*A,e[10]=d*W+y*j+v*A,e[11]=m*W+_*j+T*A,t!==e&&(e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e)}function K0(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[4],s=t[5],a=t[6],c=t[7],l=t[8],h=t[9],u=t[10],f=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=o*i+l*n,e[5]=s*i+h*n,e[6]=a*i+u*n,e[7]=c*i+f*n,e[8]=l*i-o*n,e[9]=h*i-s*n,e[10]=u*i-a*n,e[11]=f*i-c*n,e}function X0(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[0],s=t[1],a=t[2],c=t[3],l=t[8],h=t[9],u=t[10],f=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i-l*n,e[1]=s*i-h*n,e[2]=a*i-u*n,e[3]=c*i-f*n,e[8]=o*n+l*i,e[9]=s*n+h*i,e[10]=a*n+u*i,e[11]=c*n+f*i,e}function Z0(e,t,r){let n=Math.sin(r),i=Math.cos(r),o=t[0],s=t[1],a=t[2],c=t[3],l=t[4],h=t[5],u=t[6],f=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=o*i+l*n,e[1]=s*i+h*n,e[2]=a*i+u*n,e[3]=c*i+f*n,e[4]=l*i-o*n,e[5]=h*i-s*n,e[6]=u*i-a*n,e[7]=f*i-c*n,e}function J0(e,t){let r=t[0],n=t[1],i=t[2],o=t[4],s=t[5],a=t[6],c=t[8],l=t[9],h=t[10];return e[0]=Math.sqrt(r*r+n*n+i*i),e[1]=Math.sqrt(o*o+s*s+a*a),e[2]=Math.sqrt(c*c+l*l+h*h),e}function Q0(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r+r,a=n+n,c=i+i,l=r*s,h=n*s,u=n*a,f=i*s,d=i*a,m=i*c,p=o*s,g=o*a,y=o*c;return e[0]=1-u-m,e[1]=h+y,e[2]=f-g,e[3]=0,e[4]=h-y,e[5]=1-l-m,e[6]=d+p,e[7]=0,e[8]=f+g,e[9]=d-p,e[10]=1-l-u,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function tg(e,t,r,n,i,o,s){let a=1/(r-t),c=1/(i-n),l=1/(o-s);return e[0]=o*2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o*2*c,e[6]=0,e[7]=0,e[8]=(r+t)*a,e[9]=(i+n)*c,e[10]=(s+o)*l,e[11]=-1,e[12]=0,e[13]=0,e[14]=s*o*2*l,e[15]=0,e}function s2(e,t,r,n,i){let o=1/Math.tan(t/2);if(e[0]=o/r,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=o,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=-1,e[12]=0,e[13]=0,e[15]=0,i!=null&&i!==1/0){let s=1/(n-i);e[10]=(i+n)*s,e[14]=2*i*n*s}else e[10]=-1,e[14]=-2*n;return e}function a2(e,t,r,n,i,o,s){let a=1/(t-r),c=1/(n-i),l=1/(o-s);return e[0]=-2*a,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=-2*c,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=2*l,e[11]=0,e[12]=(t+r)*a,e[13]=(i+n)*c,e[14]=(s+o)*l,e[15]=1,e}function ng(e,t,r,n){let i,o,s,a,c,l,h,u,f,d,m=t[0],p=t[1],g=t[2],y=n[0],_=n[1],M=n[2],b=r[0],v=r[1],T=r[2];return Math.abs(m-b)<1e-6&&Math.abs(p-v)<1e-6&&Math.abs(g-T)<1e-6?o2(e):(u=m-b,f=p-v,d=g-T,i=1/Math.sqrt(u*u+f*f+d*d),u*=i,f*=i,d*=i,o=_*d-M*f,s=M*u-y*d,a=y*f-_*u,i=Math.sqrt(o*o+s*s+a*a),i?(i=1/i,o*=i,s*=i,a*=i):(o=0,s=0,a=0),c=f*a-d*s,l=d*o-u*a,h=u*s-f*o,i=Math.sqrt(c*c+l*l+h*h),i?(i=1/i,c*=i,l*=i,h*=i):(c=0,l=0,h=0),e[0]=o,e[1]=c,e[2]=u,e[3]=0,e[4]=s,e[5]=l,e[6]=f,e[7]=0,e[8]=a,e[9]=h,e[10]=d,e[11]=0,e[12]=-(o*m+s*p+a*g),e[13]=-(c*m+l*p+h*g),e[14]=-(u*m+f*p+d*g),e[15]=1,e)}function ig(e){if(e.length!==16||Array.from(e).some(i=>!Number.isFinite(i))||e[3]!==0||e[7]!==0||e[11]!==0||e[15]!==1)throw new RangeError("Expected a finite affine matrix");let t=[Math.hypot(e[0],e[1],e[2]),Math.hypot(e[4],e[5],e[6]),Math.hypot(e[8],e[9],e[10])];if(t.some(i=>i===0||!Number.isFinite(i)))throw new RangeError("Singular transform");let r=Array.from({length:9},(i,o)=>e[Math.floor(o/3)*4+o%3]/t[Math.floor(o/3)]);for(let[i,o]of[[0,3],[0,6],[3,6]])if(Math.abs(r[i]*r[o]+r[i+1]*r[o+1]+r[i+2]*r[o+2])>1e-7)throw new RangeError("Sheared transforms do not have a TRS decomposition");if(r[0]*(r[4]*r[8]-r[5]*r[7])-r[3]*(r[1]*r[8]-r[2]*r[7])+r[6]*(r[1]*r[5]-r[2]*r[4])<0){t[0]=-t[0];for(let i=0;i<3;i++)r[i]=-r[i]}return{rotation:r,scale:t,translation:[e[12],e[13],e[14]]}}var eg,rg,If=w(()=>{eg=s2;rg=a2});function c2(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e[3]=t[3]+r[3],e}function l2(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r,e}function h2(e){let t=e[0],r=e[1],n=e[2],i=e[3];return Math.sqrt(t*t+r*r+n*n+i*i)}function u2(e){let t=e[0],r=e[1],n=e[2],i=e[3];return t*t+r*r+n*n+i*i}function f2(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r*r+n*n+i*i+o*o;return s>0&&(s=1/Math.sqrt(s)),e[0]=r*s,e[1]=n*s,e[2]=i*s,e[3]=o*s,e}function d2(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]}function m2(e,t,r,n){let i=t[0],o=t[1],s=t[2],a=t[3];return e[0]=i+n*(r[0]-i),e[1]=o+n*(r[1]-o),e[2]=s+n*(r[2]-s),e[3]=a+n*(r[3]-a),e}function p2(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*o+r[12]*s,e[1]=r[1]*n+r[5]*i+r[9]*o+r[13]*s,e[2]=r[2]*n+r[6]*i+r[10]*o+r[14]*s,e[3]=r[3]*n+r[7]*i+r[11]*o+r[15]*s,e}var Af=w(()=>{});function pR(){return Pf||(Pf=new bt([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Object.freeze(Pf)),Pf}function gR(){return Rf||(Rf=new bt,Object.freeze(Rf)),Rf}function g2(e){if(e>Math.PI*2)throw Error("expected radians")}function yR(e,t,r,n,i,o){let s=2*o/(r-t),a=2*o/(i-n),c=(r+t)/(r-t),l=(i+n)/(i-n),h=-1,u=-1,f=-2*o;return e[0]=s,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=a,e[6]=0,e[7]=0,e[8]=c,e[9]=l,e[10]=h,e[11]=u,e[12]=0,e[13]=0,e[14]=f,e[15]=0,e}var ag,fR,dR,og,sg,mR,bt,Pf,Rf,y2=w(()=>{O0();If();Vo();oh();If();ih();Ac();Af();(function(e){e[e.COL0ROW0=0]="COL0ROW0",e[e.COL0ROW1=1]="COL0ROW1",e[e.COL0ROW2=2]="COL0ROW2",e[e.COL0ROW3=3]="COL0ROW3",e[e.COL1ROW0=4]="COL1ROW0",e[e.COL1ROW1=5]="COL1ROW1",e[e.COL1ROW2=6]="COL1ROW2",e[e.COL1ROW3=7]="COL1ROW3",e[e.COL2ROW0=8]="COL2ROW0",e[e.COL2ROW1=9]="COL2ROW1",e[e.COL2ROW2=10]="COL2ROW2",e[e.COL2ROW3=11]="COL2ROW3",e[e.COL3ROW0=12]="COL3ROW0",e[e.COL3ROW1=13]="COL3ROW1",e[e.COL3ROW2=14]="COL3ROW2",e[e.COL3ROW3=15]="COL3ROW3"})(ag||(ag={}));fR=45*Math.PI/180,dR=1,og=.1,sg=500,mR=Object.freeze([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),bt=class extends Ec{static get IDENTITY(){return gR()}static get ZERO(){return pR()}get ELEMENTS(){return 16}get RANK(){return 4}get INDICES(){return ag}constructor(t){super(-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):this.identity()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this[4]=t[4],this[5]=t[5],this[6]=t[6],this[7]=t[7],this[8]=t[8],this[9]=t[9],this[10]=t[10],this[11]=t[11],this[12]=t[12],this[13]=t[13],this[14]=t[14],this[15]=t[15],this.check()}set(t,r,n,i,o,s,a,c,l,h,u,f,d,m,p,g){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this[4]=o,this[5]=s,this[6]=a,this[7]=c,this[8]=l,this[9]=h,this[10]=u,this[11]=f,this[12]=d,this[13]=m,this[14]=p,this[15]=g,this.check()}setRowMajor(t,r,n,i,o,s,a,c,l,h,u,f,d,m,p,g){return this[0]=t,this[1]=o,this[2]=l,this[3]=d,this[4]=r,this[5]=s,this[6]=h,this[7]=m,this[8]=n,this[9]=a,this[10]=u,this[11]=p,this[12]=i,this[13]=c,this[14]=f,this[15]=g,this.check()}toRowMajor(t){return t[0]=this[0],t[1]=this[4],t[2]=this[8],t[3]=this[12],t[4]=this[1],t[5]=this[5],t[6]=this[9],t[7]=this[13],t[8]=this[2],t[9]=this[6],t[10]=this[10],t[11]=this[14],t[12]=this[3],t[13]=this[7],t[14]=this[11],t[15]=this[15],t}identity(){return this.copy(mR)}fromObject(t){return this.check()}fromQuaternion(t){return Q0(this,t),this.check()}fromMatrix3(t){return this.set(t[0],t[1],t[2],0,t[3],t[4],t[5],0,t[6],t[7],t[8],0,0,0,0,1)}frustum(t){let{left:r,right:n,bottom:i,top:o,near:s=og,far:a=sg}=t;return a===1/0?yR(this,r,n,i,o,s):tg(this,r,n,i,o,s,a),this.check()}lookAt(t){let{eye:r,center:n=[0,0,0],up:i=[0,1,0]}=t;return ng(this,r,n,i),this.check()}ortho(t){let{left:r,right:n,bottom:i,top:o,near:s=og,far:a=sg}=t;return rg(this,r,n,i,o,s,a),this.check()}orthographic(t){let{fovy:r=fR,aspect:n=dR,focalDistance:i=1,near:o=og,far:s=sg}=t;g2(r);let a=r/2,c=i*Math.tan(a),l=c*n;return this.ortho({left:-l,right:l,bottom:-c,top:c,near:o,far:s})}perspective(t){let{fovy:r=45*Math.PI/180,aspect:n=1,near:i=.1,far:o=500}=t;return g2(r),eg(this,r,n,i,o),this.check()}determinant(){return W0(this)}getScale(t=[-0,-0,-0]){return t[0]=Math.sqrt(this[0]*this[0]+this[1]*this[1]+this[2]*this[2]),t[1]=Math.sqrt(this[4]*this[4]+this[5]*this[5]+this[6]*this[6]),t[2]=Math.sqrt(this[8]*this[8]+this[9]*this[9]+this[10]*this[10]),t}getTranslation(t=[-0,-0,-0]){return t[0]=this[12],t[1]=this[13],t[2]=this[14],t}getRotation(t,r){let{rotation:n,scale:i}=ig(this);if(t=t||new Array(16),r)for(let o=0;o<3;o++)r[o]=i[o];for(let o=0;o<16;o++)t[o]=0;for(let o=0;o<9;o++)t[Math.floor(o/3)*4+o%3]=n[o];return t[15]=1,t}getRotationMatrix3(t,r){let{rotation:n,scale:i}=ig(this);if(t=t||new Array(9),r)for(let o=0;o<3;o++)r[o]=i[o];for(let o=0;o<9;o++)t[o]=n[o];return t}transpose(){return q0(this,this),this.check()}invert(){return j0(this,this),this.check()}multiplyLeft(t){return Tf(this,t,this),this.check()}multiplyRight(t){return Tf(this,this,t),this.check()}rotateX(t){return K0(this,this,t),this.check()}rotateY(t){return X0(this,this,t),this.check()}rotateZ(t){return Z0(this,this,t),this.check()}rotateXYZ(t){return this.rotateX(t[0]).rotateY(t[1]).rotateZ(t[2])}rotateAxis(t,r){return Y0(this,this,t,r),this.check()}scale(t){return $0(this,this,Array.isArray(t)?t:[t,t,t]),this.check()}translate(t){return H0(this,this,t),this.check()}transform(t,r){return t.length===4?(r=p2(r||[-0,-0,-0,-0],t,this),vc(r,4),r):this.transformAsPoint(t,r)}transformAsPoint(t,r){let{length:n}=t,i;switch(n){case 2:i=wf(r||[-0,-0],t,this);break;case 3:i=bf(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return vc(i,t.length),i}transformAsVector(t,r){let n;switch(t.length){case 2:n=_f(r||[-0,-0],t,this);break;case 3:n=Mf(r||[-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return vc(n,t.length),n}makeRotationX(t){return this.identity().rotateX(t)}makeTranslation(t,r,n){return this.identity().translate([t,r,n])}}});function w2(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}function cg(e,t,r){r=r*.5;let n=Math.sin(r);return e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r),e}function lg(e,t,r){let n=t[0],i=t[1],o=t[2],s=t[3],a=r[0],c=r[1],l=r[2],h=r[3];return e[0]=n*h+s*a+i*l-o*c,e[1]=i*h+s*c+o*a-n*l,e[2]=o*h+s*l+n*c-i*a,e[3]=s*h-n*a-i*c-o*l,e}function _2(e,t,r){r*=.5;let n=t[0],i=t[1],o=t[2],s=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+s*a,e[1]=i*c+o*a,e[2]=o*c-i*a,e[3]=s*c-n*a,e}function M2(e,t,r){r*=.5;let n=t[0],i=t[1],o=t[2],s=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c-o*a,e[1]=i*c+s*a,e[2]=o*c+n*a,e[3]=s*c-i*a,e}function b2(e,t,r){r*=.5;let n=t[0],i=t[1],o=t[2],s=t[3],a=Math.sin(r),c=Math.cos(r);return e[0]=n*c+i*a,e[1]=i*c-n*a,e[2]=o*c+s*a,e[3]=s*c-o*a,e}function x2(e,t){let r=t[0],n=t[1],i=t[2];return e[0]=r,e[1]=n,e[2]=i,e[3]=Math.sqrt(Math.abs(1-r*r-n*n-i*i)),e}function hg(e,t,r,n){let i=t[0],o=t[1],s=t[2],a=t[3],c=r[0],l=r[1],h=r[2],u=r[3],f,d,m,p,g;return f=i*c+o*l+s*h+a*u,f<0&&(f=-f,c=-c,l=-l,h=-h,u=-u),1-f>1e-6?(d=Math.acos(f),g=Math.sin(d),m=Math.sin((1-n)*d)/g,p=Math.sin(n*d)/g):(m=1-n,p=n),e[0]=m*i+p*c,e[1]=m*o+p*l,e[2]=m*s+p*h,e[3]=m*a+p*u,e}function S2(e,t){let r=t[0],n=t[1],i=t[2],o=t[3],s=r*r+n*n+i*i+o*o,a=s?1/s:0;return e[0]=-r*a,e[1]=-n*a,e[2]=-i*a,e[3]=o*a,e}function v2(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=t[3],e}function E2(e,t){let r=t[0]+t[4]+t[8],n;if(r>0)n=Math.sqrt(r+1),e[3]=.5*n,n=.5/n,e[0]=(t[5]-t[7])*n,e[1]=(t[6]-t[2])*n,e[2]=(t[1]-t[3])*n;else{let i=0;t[4]>t[0]&&(i=1),t[8]>t[i*3+i]&&(i=2);let o=(i+1)%3,s=(i+2)%3;n=Math.sqrt(t[i*3+i]-t[o*3+o]-t[s*3+s]+1),e[i]=.5*n,n=.5/n,e[3]=(t[o*3+s]-t[s*3+o])*n,e[o]=(t[o*3+i]+t[i*3+o])*n,e[s]=(t[s*3+i]+t[i*3+s])*n}return e}function O2(e,t,r,n){if(t.length!==4||r.length!==4||[...Array.from(t),...Array.from(r),n].some(f=>!Number.isFinite(f)))throw new RangeError("Expected finite quaternions and step");if(t.length!==4||n<0)throw new RangeError("Expected quaternions and a nonnegative step");let i=Math.max(...Array.from(t,Math.abs)),o=Math.max(...Array.from(r,Math.abs));if(!i||!o)throw new RangeError("Zero quaternion");let s=Array.from(t,f=>f/i),a=Array.from(r,f=>f/o),c=Math.hypot(...s),l=Math.hypot(...a);for(let f=0;f<4;f++)s[f]/=c,a[f]/=l;let h=s.reduce((f,d,m)=>f+d*a[m],0),u=2*Math.acos(Math.min(1,Math.abs(h)));if(e.length<4)throw new RangeError("Result buffer is too short");return hg(e,s,a,u===0?0:Math.min(1,n/u)),e}var T2,I2,A2,P2,R2,C2,wR,N2,Cf=w(()=>{Ac();Af();T2=c2,I2=l2,A2=d2,P2=m2,R2=h2,C2=u2,wR=f2,N2=(function(){let e=qM(),t=D0(1,0,0),r=D0(0,1,0);return function(n,i,o){let s=F0(i,o);return s<-.999999?(Ic(e,t,i),XM(e)<1e-6&&Ic(e,r,i),jM(e,e),cg(n,e,Math.PI),n):s>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Ic(e,i,o),n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=1+s,wR(n,n))}})()});var Xi,B2=w(()=>{Cf();pf();Vo();Cf();Xi=class extends zo{constructor(t=0,r=0,n=0,i=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,r,n,i)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,r,n,i){return this[0]=t,this[1]=r,this[2]=n,this[3]=i,this.check()}fromObject(t){return this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this.check()}fromMatrix3(t){return E2(this,t),this.check()}fromEuler(t){switch(this.identity(),t.order){case"xyz":return this.rotateX(t.x).rotateY(t.y).rotateZ(t.z);case"yxz":return this.rotateY(t.y).rotateX(t.x).rotateZ(t.z);case"zxy":return this.rotateZ(t.z).rotateX(t.x).rotateY(t.y);case"zyx":return this.rotateZ(t.z).rotateY(t.y).rotateX(t.x);case"yzx":return this.rotateY(t.y).rotateZ(t.z).rotateX(t.x);case"xzy":return this.rotateX(t.x).rotateZ(t.z).rotateY(t.y);default:throw new Error("Unknown Euler angle order")}}fromAxisRotation(t,r){return cg(this,t,r),this.check()}rotateTowards(t,r){return O2(this,this,t,r)}identity(){return w2(this),this.check()}setAxisAngle(t,r){return this.fromAxisRotation(t,r)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=he(t)}get y(){return this[1]}set y(t){this[1]=he(t)}get z(){return this[2]}set z(t){this[2]=he(t)}get w(){return this[3]}set w(t){this[3]=he(t)}len(){return R2(this)}lengthSquared(){return C2(this)}dot(t){return A2(this,t)}rotationTo(t,r){return N2(this,t,r),this.check()}add(t){return T2(this,this,t),this.check()}calculateW(){return x2(this,this),this.check()}conjugate(){return v2(this,this),this.check()}invert(){return S2(this,this),this.check()}lerp(t,r,n){return n===void 0?this.lerp(this,t,r):(P2(this,t,r,n),this.check())}multiplyRight(t){return lg(this,this,t),this.check()}multiplyLeft(t){return lg(this,t,this),this.check()}normalize(){let t=this.len(),r=t>0?1/t:0;return this[0]=this[0]*r,this[1]=this[1]*r,this[2]=this[2]*r,this[3]=this[3]*r,t===0&&(this[3]=1),this.check()}rotateX(t){return _2(this,this,t),this.check()}rotateY(t){return M2(this,this,t),this.check()}rotateZ(t){return b2(this,this,t),this.check()}scale(t){return I2(this,this,t),this.check()}slerp(t,r,n){let i,o,s;return arguments.length===2?(i=this,o=t,s=r):(i=t,o=r,s=n),hg(this,i,o,s),this.check()}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,r){return this.setAxisAngle(t,r)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}}});function fg(){return{eastX:0,eastY:1,northZ:1,upX:1,upY:0,upZ:0}}function dg(e,t,r){let n=e.x,i=e.y,o=e.z,s=t.x,a=t.y,c=t.z;return o!==0?!1:_R(r,n,i,s*i-a*n,s,a,c)}function mg(e,t,r,n,i,o){let s=ug(r),a=ug(n),c=ug(i),l=Math.abs(s),h=Math.abs(a),u=Math.abs(c);if(!l||!h||!u||l===h||l===u||h===u||(l%3+1===h?1:-1)*Math.sign(s*a*c)!==1||!Array.isArray(o)&&o.length<16)return!1;let d=e.eastX,m=e.eastY,p=e.northZ,g=e.upX,y=e.upY,_=e.upZ,M=-_*m,b=_*d,v=t.x,T=t.y,S=t.z,E=(l===1?d:l===2?M:g)*Math.sign(s),N=(l===1?m:l===2?b:y)*Math.sign(s),B=(l===1?0:l===2?p:_)*Math.sign(s),C=(h===1?d:h===2?M:g)*Math.sign(a),R=(h===1?m:h===2?b:y)*Math.sign(a),W=(h===1?0:h===2?p:_)*Math.sign(a),j=(u===1?d:u===2?M:g)*Math.sign(c),A=(u===1?m:u===2?b:y)*Math.sign(c),P=(u===1?0:u===2?p:_)*Math.sign(c);return!Number.isFinite(E)||!Number.isFinite(N)||!Number.isFinite(B)||!Number.isFinite(C)||!Number.isFinite(R)||!Number.isFinite(W)||!Number.isFinite(j)||!Number.isFinite(A)||!Number.isFinite(P)||!Number.isFinite(v)||!Number.isFinite(T)||!Number.isFinite(S)||o instanceof Float32Array&&(!Number.isFinite(Math.fround(E))||!Number.isFinite(Math.fround(N))||!Number.isFinite(Math.fround(B))||!Number.isFinite(Math.fround(C))||!Number.isFinite(Math.fround(R))||!Number.isFinite(Math.fround(W))||!Number.isFinite(Math.fround(j))||!Number.isFinite(Math.fround(A))||!Number.isFinite(Math.fround(P))||!Number.isFinite(Math.fround(v))||!Number.isFinite(Math.fround(T))||!Number.isFinite(Math.fround(S)))?!1:(o[0]=E,o[1]=N,o[2]=B,o[3]=0,o[4]=C,o[5]=R,o[6]=W,o[7]=0,o[8]=j,o[9]=A,o[10]=P,o[11]=0,o[12]=v,o[13]=T,o[14]=S,o[15]=1,!0)}function ug(e){switch(e){case"east":return 1;case"west":return-1;case"north":return 2;case"south":return-2;case"up":return 3;case"down":return-3;default:return 0}}function _R(e,t,r,n,i,o,s){return!Number.isFinite(t)||!Number.isFinite(r)||!Number.isFinite(n)||!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s)?!1:(e.eastX=t,e.eastY=r,e.northZ=n,e.upX=i,e.upY=o,e.upZ=s,!0)}var L2=w(()=>{});function ah(e,t,r=e){let n=e.x,i=e.y,o=e.z,{semiMajorAxis:s,semiMinorAxis:a,eccentricitySquared:c}=t,l=Math.sin(i),h=Math.abs(i)===Math.PI/2?0:Math.cos(i),u=a/s,f=c<.9?s/Math.sqrt(1-c*l*l):s/Math.hypot(h,u*l),d=(f+o)*h*Math.cos(n),m=(f+o)*h*Math.sin(n),p=(f*(c<.9?1-c:u*u)+o)*l;return Pc(r,d,m,p)}function ch(e,t,r=e){let n=e.x,i=e.y,o=e.z,{semiMajorAxis:s,semiMinorAxis:a,eccentricitySquared:c}=t,l=Math.atan2(i,n),h=Math.hypot(n,i),u=Math.hypot(n,i,o);if(!(u>0)||!Number.isFinite(u))return!1;if(c===0)return Pc(r,h===0?0:l,Math.atan2(o,h),u-s);if(h===0)return Pc(r,0,Math.sign(o)*Math.PI/2,Math.abs(o)-a);let f=h/s,d=o/a;if(f*f+d*d<1-16*Of||c>=.9)return pg(n,i,o,h,s,a,r);let m=o/u,p=h/u,g=1/Math.sqrt(1-c*(2-c)*p*p),y=p*(1-c)*g,_=m*g;for(let M=0;M<30;M++){let b=s/Math.sqrt(1-c*_*_),v=h*y+o*_-b*(1-c*_*_),T=c*b/(b+v);g=1/Math.sqrt(1-T*(2-T)*p*p);let S=p*(1-T)*g,E=m*g;if(Math.abs(E*y-S*_)<=1e-12){if(!Number.isFinite(v))break;return Pc(r,l,Math.atan2(E,Math.abs(S)),v)}y=S,_=E}return pg(n,i,o,h,s,a,r)}function pg(e,t,r,n,i,o,s){let a=Math.atan2(t,e),c=o/i,l=c*c,h=n/i,u=r/i,f=1-l;if(!(l>0)||c>1)return!1;let d=i*i,m=o*o,p=Number.isFinite(d)&&d>0?(m-l*d+ko(o,o,m)-l*ko(i,i,d)-ko(l,d,l*d))/d:0,g=n*n,y=e*e,_=t*t,M=y+_,b=Number.isFinite(g)&&g>0?(M-g+Nf(y,_,M)+ko(e,e,y)+ko(t,t,_)-ko(n,n,g))/(2*n):0,v=i*l,T=n-i,S=T+v,E=b+Nf(n,-i,T)+Nf(T,v,S)+ko(i,l,v)+i*p;if(r===0)return S+E<0?!1:Pc(s,a,0,T);let N=Math.abs(u)*c,B=0,C=l+Math.hypot(h,u*c);if(!Number.isFinite(C))return!1;let R=Math.max(N,h-f);R>B&&R<C||(R=C/2);let W=-(S+E)/i,j=Math.sqrt(W*(h+f))/f,A=W>0&&Math.abs(r)/j/i*c<=Of*W?Math.atan2(Math.sign(r)*j/c,h/f):void 0;for(let P=0;P<1024&&A===void 0;P++){let D=f+R,F=h/D,L=r/R/i,O=L*c,V=i*R,yt=S-V,X=(yt+(Nf(S,-V,yt)+E-ko(i,R,V)))/(i*D)*(F+1),xt=X+O*O;if(!Number.isFinite(xt))return!1;xt>0?B=R:C=R;let et=-2*(F*F/D+O*O/R),dt=R-xt/et,St=dt>B&&dt<C?dt:B+(C-B)/2;if(Math.abs(xt)<=4*Of*(Math.abs(X)+O*O)||C-B<=4*Of*R){A=Math.atan2(L,F);break}R=St}return A!==void 0&&MR(s,a,A,n,r,i,c)}function Nf(e,t,r){let n=r-e;return e-(r-n)+(t-n)}function ko(e,t,r){let n=134217729*e,i=134217729*t;if(!Number.isFinite(n)||!Number.isFinite(i))return 0;let o=n-(n-e),s=i-(i-t),a=e-o,c=t-s;return o*s-r+o*c+a*s+a*c}function MR(e,t,r,n,i,o,s){let a=Math.sin(r),c=Math.cos(r);return Pc(e,t,r,n*c+i*a-o*Math.hypot(c,s*a))}function Pc(e,t,r,n){return!Number.isFinite(t)||!Number.isFinite(r)||!Number.isFinite(n)?!1:(e.x=t,e.y=r,e.z=n,!0)}var Of,D2=w(()=>{Of=Number.EPSILON});function F2(e){return ArrayBuffer.isView(e)?bR.call(e):void 0}var bR,U2=w(()=>{bR=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype),Symbol.toStringTag).get});function Bf(e){return F2(e)==="Uint16Array"}var G2=w(()=>{U2()});function Lf(){return Rc??Uint16Array}var Rc,z2=w(()=>{Rc=globalThis.Float16Array});var V2=w(()=>{G2();z2()});var k2=w(()=>{V2()});var q2=w(()=>{V0()});var gg=w(()=>{If()});var j2=w(()=>{Cf()});var W2=w(()=>{ih()});var H2=w(()=>{Ac()});var $2=w(()=>{Af()});function yg(e={}){let t=e.depthRange??"negative-one-to-one";if(t!=="negative-one-to-one"&&t!=="zero-to-one")throw new RangeError("Unknown depth range");let r=t==="zero-to-one"?0:-1;return e.reversedDepth?[1,r]:[r,1]}var Y2=w(()=>{});var qt=w(()=>{kM();ZM();i2();y2();B2();I0();B0();ha();L2();D2();k2();q2();gg();j2();W2();H2();$2();gg();Y2()});var Zi,PU,K2=w(()=>{Zi=6356752314245179e-9,PU={radii:[6378137,6378137,Zi],radiiSquared:[6378137*6378137,6378137*6378137,Zi*Zi],oneOverRadii:[1/6378137,1/6378137,1/Zi],oneOverRadiiSquared:[1/(6378137*6378137),1/(6378137*6378137),1/(Zi*Zi)],maximumRadius:Math.max(6378137,6378137,Zi),centerToleranceSquared:.1}});function wg(e){return e}function Ji(e,t=[],r=wg){return"longitude"in e?(t[0]=r(e.longitude),t[1]=r(e.latitude),t[2]=e.height):"x"in e?(t[0]=r(e.x),t[1]=r(e.y),t[2]=e.z):(t[0]=r(e[0]),t[1]=r(e[1]),t[2]=e[2]),t}function X2(e,t=[]){return Ji(e,t,ie._cartographicRadians?wg:P0)}function _g(e,t,r,n){let i=ie._cartographicRadians?wg:R0,o=i(e),s=i(t);return"longitude"in n?(n.longitude=o,n.latitude=s,n.height=r):"x"in n?(n.x=o,n.y=s,n.z=r):(n[0]=o,n[1]=s,n[2]=r),n}var NU,Z2=w(()=>{qt();NU=new I});function Ai(e,t,r,n,i,o,s){let c=[n,i,o,Math.abs(e),Math.abs(t),Math.abs(r)].map(S=>{let E=S.toString(2),N=E.indexOf(".");return{integer:BigInt("0b"+E.replace(".","")),exponent:N<0?0:N+1-E.length}}),l=Math.min(...c.filter(S=>S.integer!==0n).map(S=>S.exponent)),h=c.map(S=>S.integer<<BigInt(S.exponent-l)),u=h.slice(0,3).map(S=>S*S),f=u.reduce((S,E)=>S<E?S:E),d=u.map(S=>S-f),m=u.map((S,E)=>h[E]*h[E+3]),p=64;if(!m.some((S,E)=>d[E]===0n&&S!==0n)){let S=-1n,E=1n;for(let C=0;C<3;C++){if(d[C]===0n)continue;let R=d[C]*d[C];S=S*R+m[C]*m[C]*E,E*=R}if(S<0n)return!1;if(S===0n)return T(0n,1n);let B=d.filter(C=>C>0n).reduce((C,R)=>C<R?C:R);p=Math.max(64,(2n*(E+S)).toString(2).length-(S*B).toString(2).length+128)}let g=1n<<BigInt(p),y=d.map(S=>S*g),_=m.map(S=>S*g),M=_.map(S=>S*S),b=0n,v=_.reduce((S,E)=>S+E,0n);if(v===0n)return!1;for(let S=0;S<4096;S++){let E=b+v>>1n;if(E===b)return!1;let N=y[0]+E,B=y[1]+E,C=y[2]+E,R=N*N,W=B*B,j=C*C,A=M[0]*W*j+M[1]*R*j+M[2]*R*W-R*W*j;if(A===0n)return T(E,g);if(A>0n?b=E:v=E,b>0n&&v-b<=b>>60n)return T(b+v>>1n,g)}return!1;function T(S,E){let N=u.map((W,j)=>{let A=d[j]*E+S;return A===0n?0:Mg(W*h[j+3]*E,A,l)});if(!N.every(Number.isFinite))return!1;let B=Math.sign(e)*N[0],C=Math.sign(t)*N[1],R=Math.sign(r)*N[2];return s.x=B,s.y=C,s.z=R,!0}}function Mg(e,t,r){if(e===0n)return 0;let n=52-(e.toString(2).length-t.toString(2).length),i=n>=0?e<<BigInt(n):e,o=n>=0?t:t<<BigInt(-n),s=i/o,a=i%o;(2n*a>o||2n*a===o&&s&1n)&&s++;let c=r-n,l=Math.max(-1022,Math.min(1023,c));return Number(s)*2**l*2**(c-l)}var bg=w(()=>{});function J2(e,t,r,n,i,o,s){let a=Math.min(n,i,o),c=a*a,l=n*n,h=i*i,u=o*o;if(!(a>0)||!(c>0)||!Number.isFinite(Math.max(l,h,u)))return!1;let f=ua(a,a,c),d=l-c,m=h-c,p=u-c,g=Qi(l,-c,d)+ua(n,n,l)-f,y=Qi(h,-c,m)+ua(i,i,h)-f,_=Qi(u,-c,p)+ua(o,o,u)-f,M=n*Math.abs(e),b=i*Math.abs(t),v=o*Math.abs(r);if(c<2**-1022||e!==0&&M<2**-1022||t!==0&&b<2**-1022||r!==0&&v<2**-1022)return Ai(e,t,r,n,i,o,s);let T=ua(n,Math.abs(e),M),S=ua(i,Math.abs(t),b),E=ua(o,Math.abs(r),v);if(Math.hypot(d===0?M===0?0:1/0:M/(d+g),m===0?b===0?0:1/0:b/(m+y),p===0?v===0?0:1/0:v/(p+_))<=1+64*Number.EPSILON)return Ai(e,t,r,n,i,o,s);if((e!==0?1:0)+(t!==0?1:0)+(r!==0?1:0)==1)return s.x=e===0?e:Math.sign(e)*n,s.y=t===0?t:Math.sign(t)*i,s.z=r===0?r:Math.sign(r)*o,!0;let B=Math.hypot(d===0?M:0,m===0?b:0,p===0?v:0),C=Math.hypot(M,b,v);if(!(C>0)||!Number.isFinite(C))return Ai(e,t,r,n,i,o,s);let R=B>0?B:C;for(let W=0;W<512;W++){let j=d+R,A=m+R,P=p+R,D=Qi(d,R,j)+g,F=Qi(m,R,A)+y,L=Qi(p,R,P)+_,O=M/j,V=b/A,yt=v/P,Dt,X;O>=V&&O>=yt?(Dt=xg(M,T,d,g,R,j)*(O+1),X=(V*(1-F/A))**2+(yt*(1-L/P))**2):V>=yt?(Dt=xg(b,S,m,y,R,A)*(V+1),X=(O*(1-D/j))**2+(yt*(1-L/P))**2):(Dt=xg(v,E,p,_,R,P)*(yt+1),X=(O*(1-D/j))**2+(V*(1-F/A))**2);let xt=-2*(O*O/j+V*V/A+yt*yt/P),et=4*Number.EPSILON*(Math.abs(Dt)+X),dt=Dt+X;if(!Number.isFinite(dt))return Ai(e,t,r,n,i,o,s);if(Math.abs(dt)<=4*Number.EPSILON*(Math.abs(Dt)+X)||C-B<=4*Number.EPSILON*R){let Rt=et/Math.abs(xt);if(!Number.isFinite(xt)||!(Math.abs(xt)>0)||Rt>2e-13*R)return Ai(e,t,r,n,i,o,s);let zt=Math.sign(e)*n*(O*(1-D/j)),Wt=Math.sign(t)*i*(V*(1-F/A)),ee=Math.sign(r)*o*(yt*(1-L/P)),Jt=2*Rt*Math.max(Math.abs(zt/j),Math.abs(Wt/A),Math.abs(ee/P));return!Number.isFinite(Jt)||Jt>2e-13*Math.max(n,i,o)?Ai(e,t,r,n,i,o,s):!Number.isFinite(zt)||!Number.isFinite(Wt)||!Number.isFinite(ee)?Ai(e,t,r,n,i,o,s):(s.x=zt,s.y=Wt,s.z=ee,!0)}dt>0?B=R:C=R;let St=R-dt/xt,k=St>B&&St<C?St:B+(C-B)/2;if(k===R)return Ai(e,t,r,n,i,o,s);R=k}return Ai(e,t,r,n,i,o,s)}function xg(e,t,r,n,i,o){let s=e-r,a=Qi(e,-r,s)+t-n,c=s+a,l=Qi(s,a,c),h=c-i;return(h+(Qi(c,-i,h)+l))/o}function Qi(e,t,r){let n=r-e;return e-(r-n)+(t-n)}function ua(e,t,r){let n=134217729*e,i=134217729*t;if(!Number.isFinite(n)||!Number.isFinite(i))return 0;let o=n-(n-e),s=i-(i-t),a=e-o,c=t-s;return o*s-r+o*c+a*s+a*c}var Q2=w(()=>{bg()});function tb(e,t,r=[]){let n=e,i="x"in e?n.x:e[0],o="x"in e?n.y:e[1],s="x"in e?n.z:e[2];if(!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(i*i+o*o+s*s))return;let{radii:a}=t;if(J2(i,o,s,a.x,a.y,a.z,Df))return Pi(r,Df.x,Df.y,Df.z)}function Pi(e,t,r,n){if(zn(e))e[0]=t,e[1]=r,e[2]=n;else{let i=e;i.x=t,i.y=r,i.z=n}return e}var Df,eb=w(()=>{qt();Q2();Df={x:0,y:0,z:0}});function rb(e,t){if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0||t>e)throw new Error("Spheroid requires finite positive axes with semiMinorAxis <= semiMajorAxis")}function Gf(e,t,r,n){let i=Math.max(Math.abs(e),Math.abs(t),Math.abs(r));if(!(i>0)||!Number.isFinite(i))return;let o=e/i,s=t/i,a=r/i,c=Math.hypot(o,s,a);return Pi(n,o/c,s/c,a/c)}var tn,Ff,NR,Vn,Uf,pt,zf=w(()=>{qt();qt();K2();Z2();eb();tn={x:0,y:0,z:0},Ff=new I,NR=new I,Vn=new I,Uf=new I,pt=class e{static fromSpheroid(t){let{semiMajorAxis:r,semiMinorAxis:n}=t;return rb(r,n),new e(r,r,n)}constructor(t=0,r=0,n=0){this.centerToleranceSquared=we.EPSILON1,pr(Number.isFinite(t)&&t>=0),pr(Number.isFinite(r)&&r>=0),pr(Number.isFinite(n)&&n>=0),this.radii=new I(t,r,n),this.radiiSquared=new I(t*t,r*r,n*n),this.radiiToTheFourth=new I(t*t*t*t,r*r*r*r,n*n*n*n),this.oneOverRadii=new I(t===0?0:1/t,r===0?0:1/r,n===0?0:1/n),this.oneOverRadiiSquared=new I(t===0?0:1/(t*t),r===0?0:1/(r*r),n===0?0:1/(n*n)),this.minimumRadius=Math.min(t,r,n),this.maximumRadius=Math.max(t,r,n),n!==0&&(this.squaredXOverSquaredZ=(t/n)**2),t===r&&n>0&&n<=t&&Number.isFinite(this.radiiSquared.x)&&this.radiiSquared.z>0&&(this.spheroidGeometry=Object.freeze({semiMajorAxis:t,semiMinorAxis:n,eccentricitySquared:1-(n/t)**2})),Object.freeze(this.radii),Object.freeze(this.radiiSquared),Object.freeze(this.radiiToTheFourth),Object.freeze(this.oneOverRadii),Object.freeze(this.oneOverRadiiSquared),Object.freeze(this)}toSpheroid(){let{x:t,y:r,z:n}=this.radii;if(t!==r)throw new Error("Spheroid requires equal X/Y radii");return rb(t,n),Object.freeze({semiMajorAxis:t,semiMinorAxis:n})}equals(t){return this===t||!!(t&&this.radii.equals(t.radii))}toString(){return this.radii.toString()}cartographicToCartesian(t,r=[0,0,0]){let n=X2(t,Uf),i=n[0],o=n[1],s=n[2];if(!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s)||!(this.minimumRadius>0)||!Number.isFinite(this.maximumRadius*this.maximumRadius))return;if(this.spheroidGeometry&&(ie._cartographicRadians||Math.abs(o)<=Math.PI/4))return tn.x=i,tn.y=o,tn.z=s,ah(tn,this.spheroidGeometry)?Pi(r,tn.x,tn.y,tn.z):void 0;let a=NR;this.geodeticSurfaceNormalCartographic(t,a);let c=a.x,l=a.y,h=a.z,u=this.radii.x,f=this.radii.y,d=this.radii.z,m=Math.hypot(u*c,f*l,d*h),p=u*(u*c/m)+s*c,g=f*(f*l/m)+s*l,y=d*(d*h/m)+s*h;if(!(!Number.isFinite(p)||!Number.isFinite(g)||!Number.isFinite(y)))return Pi(r,p,g,y)}cartesianToCartographic(t,r=[0,0,0]){let n=t,i="x"in t?n.x:t[0],o="x"in t?n.y:t[1],s="x"in t?n.z:t[2];if(!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s))return;if(this.spheroidGeometry&&Number.isFinite(i*i+o*o+s*s)&&Number.isFinite(this.oneOverRadiiSquared.x)&&Number.isFinite(this.oneOverRadiiSquared.z)){tn.x=i,tn.y=o,tn.z=s;let _=this.spheroidGeometry;if(!(s===0&&_.semiMinorAxis<_.semiMajorAxis&&Math.abs(Math.hypot(i,o)-_.semiMajorAxis*_.eccentricitySquared)<=64*Number.EPSILON*_.semiMajorAxis)&&ch(tn,_)){let b=i===0&&o===0?Math.atan2(o,i):tn.x;return _g(b,tn.y,tn.z,r)}}if(!(this.minimumRadius>0)||!Number.isFinite(this.maximumRadius*this.maximumRadius)||!Number.isFinite(1/(this.minimumRadius*this.minimumRadius)))return;Uf.set(i,o,s);let a=this.scaleToGeodeticSurface(Uf,Vn);if(!a)return;let c=a[0]*this.oneOverRadiiSquared.x,l=a[1]*this.oneOverRadiiSquared.y,h=a[2]*this.oneOverRadiiSquared.z,u=Math.hypot(c,l,h);if(!(u>0)||!Number.isFinite(u))return;let f=c/u,d=l/u,m=h/u,p=Math.atan2(d,f),g=Math.atan2(m,Math.hypot(f,d)),y=(i-a[0])*f+(o-a[1])*d+(s-a[2])*m;return _g(p,g,y,r)}geocentricSurfaceNormal(t,r=[0,0,0]){Ji(t,Ff);let n=Ff;return Gf(n.x,n.y,n.z,r)}geodeticSurfaceNormalCartographic(t,r=[0,0,0]){let n=Ji(t,Uf),i=ie._cartographicRadians?n[0]:n[0]*Math.PI/180,o=ie._cartographicRadians?n[1]:n[1]*Math.PI/180,s=!ie._cartographicRadians&&Math.abs(n[1])>45,a=(90-Math.abs(n[1]))*Math.PI/180,c=s?Math.sin(a):Math.abs(o)===Math.PI/2?0:Math.cos(o),l=s?Math.sign(n[1])*Math.cos(a):Math.sin(o);return Gf(c*Math.cos(i),c*Math.sin(i),l,r)}geodeticSurfaceNormal(t,r=[0,0,0]){if(!(this.minimumRadius>0))return;Ji(t,Ff);let n=Ff,i=Math.max(Math.abs(n.x),Math.abs(n.y),Math.abs(n.z));if(!(i>0)||!Number.isFinite(i))return;let o=n.x/i*(this.minimumRadius/this.radii.x)**2,s=n.y/i*(this.minimumRadius/this.radii.y)**2,a=n.z/i*(this.minimumRadius/this.radii.z)**2;if((n.x===0||Math.abs(o)>=2**-1022)&&(n.y===0||Math.abs(s)>=2**-1022)&&(n.z===0||Math.abs(a)>=2**-1022))return Gf(o,s,a,r);let c=n.x===0?0:Math.min(1023,Math.floor(Math.log2(Math.abs(n.x)))),l=n.y===0?0:Math.min(1023,Math.floor(Math.log2(Math.abs(n.y)))),h=n.z===0?0:Math.min(1023,Math.floor(Math.log2(Math.abs(n.z)))),u=Math.min(1023,Math.floor(Math.log2(this.radii.x))),f=Math.min(1023,Math.floor(Math.log2(this.radii.y))),d=Math.min(1023,Math.floor(Math.log2(this.radii.z))),m=Math.max(n.x===0?-1/0:c-2*u,n.y===0?-1/0:l-2*f,n.z===0?-1/0:h-2*d);return Gf(n.x===0?n.x:n.x/2**c/(this.radii.x/2**u)**2*2**(c-2*u-m),n.y===0?n.y:n.y/2**l/(this.radii.y/2**f)**2*2**(l-2*f-m),n.z===0?n.z:n.z/2**h/(this.radii.z/2**d)**2*2**(h-2*d-m),r)}scaleToGeodeticSurface(t,r){return tb(t,this,r)}scaleToGeocentricSurface(t,r=[0,0,0]){Ji(t,Vn);let n=Vn,i=Math.max(Math.abs(n.x),Math.abs(n.y),Math.abs(n.z));if(!(this.minimumRadius>0)||!(i>0)||!Number.isFinite(i))return;let o=n.x*n.x*this.oneOverRadiiSquared.x+n.y*n.y*this.oneOverRadiiSquared.y+n.z*n.z*this.oneOverRadiiSquared.z;if(o>=2**-1022&&Number.isFinite(o)&&i*i>=2**-1022&&Number.isFinite(i*i)){let h=1/Math.sqrt(o);return Pi(r,n.x*h,n.y*h,n.z*h)}let s=n.x/i,a=n.y/i,c=n.z/i,l=Math.hypot(s/this.radii.x,a/this.radii.y,c/this.radii.z);if(!(!(l>0)||!Number.isFinite(l)))return Pi(r,s/l,a/l,c/l)}transformPositionToScaledSpace(t,r=[0,0,0]){Ji(t,Vn);let n=Vn.scale(this.oneOverRadii);return Pi(r,n.x,n.y,n.z)}transformPositionFromScaledSpace(t,r=[0,0,0]){Ji(t,Vn);let n=Vn.scale(this.radii);return Pi(r,n.x,n.y,n.z)}getSurfaceNormalIntersectionWithZAxis(t,r=0,n=[0,0,0]){if(pr(this.radii.x===this.radii.y&&this.minimumRadius>0),Ji(t,Vn),!Number.isFinite(Vn.x)||!Number.isFinite(Vn.y)||!Number.isFinite(Vn.z)||!Number.isFinite(r))return;let i=Vn.z*(1-this.squaredXOverSquaredZ);if(Number.isFinite(i)&&!(Math.abs(i)>=this.radii.z-r))return Pi(n,0,0,i)}};pt.WGS84=new pt(6378137,6378137,Zi)});var lh,nb,en,Sg=w(()=>{qt();qt();lh=new I,nb=new I,en=class e{constructor(t=[0,0,0],r=0){this.radius=-0,this.center=new I,this.fromCenterRadius(t,r)}fromCenterRadius(t,r){return this.center.from(t),this.radius=r,this}fromCornerPoints(t,r){return r=lh.from(r),this.center=new I().from(t).add(r).scale(.5),this.radius=this.center.distance(r),this}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new e(this.center,this.radius)}union(t){let r=this.center,n=this.radius,i=t.center,o=t.radius,s=lh.copy(i).subtract(r),a=s.magnitude();if(n>=a+o)return this.clone();if(o>=a+n)return t.clone();let c=(n+a+o)*.5;return nb.copy(s).scale((-n+c)/a).add(r),this.center.copy(nb),this.radius=c,this}expand(t){let n=lh.from(t).subtract(this.center).magnitude();return n>this.radius&&(this.radius=n),this}transform(t){this.center.transform(t);let r=J0(lh,t);return this.radius=Math.max(r[0],Math.max(r[1],r[2]))*this.radius,this}distanceSquaredTo(t){let r=this.distanceTo(t);return r*r}distanceTo(t){let n=lh.from(t).subtract(this.center);return Math.max(0,n.len()-this.radius)}intersectPlane(t){let r=this.center,n=this.radius,o=t.normal.dot(r)+t.distance;return o<-n?"outside":o<n?"intersecting":"inside"}}});var OR,BR,Vf,kf,qf,LR,DR,to,eo,ib=w(()=>{qt();Sg();OR=new I,BR=new I,Vf=new I,kf=new I,qf=new I,LR=new I,DR=new I,to={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8},eo=class e{constructor(t=[0,0,0],r=[0,0,0,0,0,0,0,0,0]){this.center=new I().from(t),this.halfAxes=new Qr(r)}get halfSize(){let t=this.halfAxes.getColumn(0),r=this.halfAxes.getColumn(1),n=this.halfAxes.getColumn(2);return[new I(t).len(),new I(r).len(),new I(n).len()]}clone(){return new e(this.center,this.halfAxes)}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new en){let r=this.halfAxes,n=r.getColumn(0,Vf),i=r.getColumn(1,kf),o=r.getColumn(2,qf),s=OR.copy(n).add(i).add(o);return t.center.copy(this.center),t.radius=s.magnitude(),t}intersectPlane(t){let r=this.center,n=t.normal,i=this.halfAxes,o=n.x,s=n.y,a=n.z,c=Math.abs(o*i[to.COLUMN0ROW0]+s*i[to.COLUMN0ROW1]+a*i[to.COLUMN0ROW2])+Math.abs(o*i[to.COLUMN1ROW0]+s*i[to.COLUMN1ROW1]+a*i[to.COLUMN1ROW2])+Math.abs(o*i[to.COLUMN2ROW0]+s*i[to.COLUMN2ROW1]+a*i[to.COLUMN2ROW2]),l=n.dot(r)+t.distance;return l<=-c?"outside":l>=c?"inside":"intersecting"}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){let r=BR.from(t).subtract(this.center),n=this.halfAxes,i=n.getColumn(0,Vf),o=n.getColumn(1,kf),s=n.getColumn(2,qf),a=i.magnitude(),c=o.magnitude(),l=s.magnitude();i.normalize(),o.normalize(),s.normalize();let h=0,u;return u=Math.abs(r.dot(i))-a,u>0&&(h+=u*u),u=Math.abs(r.dot(o))-c,u>0&&(h+=u*u),u=Math.abs(r.dot(s))-l,u>0&&(h+=u*u),h}computePlaneDistances(t,r,n=[-0,-0]){let i=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY,s=this.center,a=this.halfAxes,c=a.getColumn(0,Vf),l=a.getColumn(1,kf),h=a.getColumn(2,qf),u=LR.copy(c).add(l).add(h).add(s),f=DR.copy(u).subtract(t),d=r.dot(f);return i=Math.min(d,i),o=Math.max(d,o),u.copy(s).add(c).add(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),u.copy(s).add(c).subtract(l).add(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),u.copy(s).add(c).subtract(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),s.copy(u).subtract(c).add(l).add(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),s.copy(u).subtract(c).add(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),s.copy(u).subtract(c).subtract(l).add(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),s.copy(u).subtract(c).subtract(l).subtract(h),f.copy(u).subtract(t),d=r.dot(f),i=Math.min(d,i),o=Math.max(d,o),n[0]=i,n[1]=o,n}transform(t){this.center.transformAsPoint(t);let r=this.halfAxes.getColumn(0,Vf);r.transformAsPoint(t);let n=this.halfAxes.getColumn(1,kf);n.transformAsPoint(t);let i=this.halfAxes.getColumn(2,qf);return i.transformAsPoint(t),this.halfAxes=new Qr([...r,...n,...i]),this}getTransform(){throw new Error("not implemented")}}});var ob,sb,Ge,jf=w(()=>{qt();ob=new I,sb=new I,Ge=class e{constructor(t=[0,0,1],r=0){this.normal=new I,this.distance=-0,this.fromNormalDistance(t,r)}fromNormalDistance(t,r){return pr(Number.isFinite(r)),this.normal.from(t).normalize(),this.distance=r,this}fromPointNormal(t,r){t=ob.from(t),this.normal.from(r).normalize();let n=-this.normal.dot(t);return this.distance=n,this}fromCoefficients(t,r,n,i){return this.normal.set(t,r,n),pr(Go(this.normal.len(),1)),this.distance=i,this}clone(){return new e(this.normal,this.distance)}equals(t){return Go(this.distance,t.distance)&&Go(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){let r=sb.copy(this.normal).transformAsVector(t).normalize(),n=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(n,r)}projectPointOntoPlane(t,r=[0,0,0]){let n=ob.from(t),i=this.getPointDistance(n),o=sb.copy(this.normal).scale(i);return n.subtract(o).to(r)}intersectWithRay(t,r=new I){let n=t.origin,i=t.direction,o=this.normal,s=o.dot(i);if(Math.abs(s)<we.EPSILON15)return;let a=(-this.distance-o.dot(n))/s;if(!(a<0))return r.copy(i).multiplyByScalar(a).add(n)}}});function ab(e,t={}){if(e.length!==16||Array.from(e).some(g=>!Number.isFinite(g)))throw new RangeError("Expected a finite view-projection matrix");let[r,n]=yg(t),i=Math.min(r,n),o=Math.max(r,n),s=g=>[e[g],e[g+4],e[g+8],e[g+12]],a=s(0),c=s(1),l=s(2),h=s(3),u=(g,y,_)=>g.map((M,b)=>M+_*y[b]),f=u(l,h,-i),d=h.map((g,y)=>o*g-l[y]),m=[u(h,a,1),u(h,a,-1),u(h,c,1),u(h,c,-1),...t.reversedDepth?[d,f]:[f,d]],p=[];for(let[g,y,_,M]of m){let b=Math.hypot(g,y,_);if(b===0){if(M<0)throw new RangeError("Empty clipping volume")}else p.push(new Ge([g/b,y/b,_/b],M/b))}if(p.length<4)throw new RangeError("Degenerate clipping volume");return p}var cb=w(()=>{qt();jf()});var lb,hb,FR,sr,ub=w(()=>{qt();cb();jf();lb=[new I([1,0,0]),new I([0,1,0]),new I([0,0,1])],hb=new I,FR=new I,sr=class e{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*lb.length;let r=t.center,n=t.radius,i=0;for(let o of lb){let s=this.planes[i],a=this.planes[i+1];s||(s=this.planes[i]=new Ge),a||(a=this.planes[i+1]=new Ge);let c=hb.copy(o).scale(-n).add(r);s.fromPointNormal(c,o);let l=hb.copy(o).scale(n).add(r),h=FR.copy(o).negate();a.fromPointNormal(l,h),i+=2}return this}fromViewProjection(t,r={}){let n=ab(t,r);return this.planes.splice(0,this.planes.length,...n),this}computeVisibility(t){let r="inside";for(let n of this.planes)switch(t.intersectPlane(n)){case"outside":return"outside";case"intersecting":r="intersecting";break;default:}return r}computeVisibilityWithPlaneMask(t,r){if(pr(Number.isFinite(r),"parentPlaneMask is required."),r===e.MASK_OUTSIDE||r===e.MASK_INSIDE)return r;let n=e.MASK_INSIDE,i=this.planes;for(let o=0;o<this.planes.length;++o){let s=o<31?1<<o:0;if(o<31&&(r&s)===0)continue;let a=i[o],c=t.intersectPlane(a);if(c==="outside")return e.MASK_OUTSIDE;c==="intersecting"&&(n|=s)}return n}};sr.MASK_OUTSIDE=4294967295;sr.MASK_INSIDE=0;sr.MASK_INDETERMINATE=2147483647});var ro=w(()=>{Sg();ib();ub();jf()});function vg(e,t,r){let n=fb*e,i=fb*t,o=n-(n-e),s=e-o,a=i-(i-t),c=t-a;return o*a-r+o*c+s*a+s*c}function db(e,t,r){let n=r-e;return e-(r-n)+(t-n)}function UR(e){return 2**Math.min(1023,Math.floor(Math.log2(e)))}function Eg(e,t,r,n,i,o){let s=Math.max(Math.abs(e),Math.abs(t),Math.abs(r));if(s===0)return 0;let a=UR(s),c=e/a,l=t/a,h=r/a,u=c*n,f=l*i,d=h*o,m=u+f,p=m+d;return(p+(db(u,f,m)+db(m,d,p)+vg(c,n,u)+vg(l,i,f)+vg(h,o,d)))*a}function mb(e,t,r,n,i,o,s){let c=(s?[s,s,s,s,0,0,0,1,0,0,0,1,1,0,0,o[0],o[1]]:[...e,...t,...r,...n,...i,...o]).map(T=>{let[S,E=""]=Math.abs(T).toString(2).split(".");return(T<0?-1n:1n)*BigInt("0b"+S+E)<<BigInt(1074-E.length)}),l=1n<<1074n,h=1n<<64n,u=[c[1]*c[2],c[0]*c[2],c[0]*c[1]],f=[0,1,2].map(T=>(c[3+T]*l+c[6+T]*c[15]+c[9+T]*c[16])*u[T]),d=c.slice(12,15).map((T,S)=>T*u[S]),m=(T,S)=>T.reduce((E,N,B)=>E+N*S[B],0n),p=m(d,d),g=m(d,f),y=m(f,f)-(c[0]*c[1]*c[2]*l)**2n,_=g*g-p*y;if(p===0n||_<0n)return;let M=_<<128n,b=M===0n?0n:1n<<BigInt(Math.ceil(M.toString(2).length/2));if(b)for(;;){let T=b+M/b>>1n;if(T>=b)break;b=T}let v=f.map((T,S)=>GR(T*p*h+d[S]*(b-g*h),p*h*u[S]));return s?v.map((T,S)=>r[S]*v[1]+n[S]*v[2]+i[S]*v[0]):v}function GR(e,t){return Math.sign(Number(e))*Mg(e<0n?-e:e,t,-2148)}var fb,pb=w(()=>{bg();fb=134217729});function Wf(e,t){if(e.length!==t)throw new RangeError(`Expected ${t} finite coordinates`);for(let r=0;r<t;r++)if(!Number.isFinite(e[r]))throw new RangeError(`Expected ${t} finite coordinates`)}function gb(e){if(e!=="normal"&&e!=="radial")throw new RangeError("Invalid tangent-plane mode")}function yb(e,t,r,n,i,o){let s=t*e.xAxis[0]+r*e.xAxis[1]+n*e.xAxis[2],a=t*e.yAxis[0]+r*e.yAxis[1]+n*e.yAxis[2];if(o!==void 0&&Math.abs((s/o)**2+(a/o)**2-1)<=32*Number.EPSILON&&(s=Eg(t,r,n,e.xAxis[0],e.xAxis[1],e.xAxis[2]),a=Eg(t,r,n,e.yAxis[0],e.yAxis[1],e.yAxis[2])),!(!Number.isFinite(s)||!Number.isFinite(a)))return i.set(s,a)}function Tg(e,t,r,n){if([e,t,r].every(Number.isFinite))return n.set(e,t,r)}var Hf,wb=w(()=>{qt();ro();zf();pb();Hf=class{constructor(t,r=pt.WGS84){if(Wf(t,3),this.radii=Object.freeze(Array.from(r.radii)),this.radii[0]===this.radii[1]&&this.radii[1]===this.radii[2]&&(this.radius=this.radii[0]),!this.radii.every(s=>s>0&&Number.isFinite(s)))throw new RangeError("Tangent plane requires positive finite ellipsoid radii");let n=r.scaleToGeodeticSurface(Array.from(t),new I);if(!n)throw new RangeError("Origin has no unique ellipsoid surface point");this.anchor=new I(n);let i=new I(r.geodeticSurfaceNormal(n));if(!i.every(Number.isFinite)||!(i.len()>0))throw new RangeError("Cannot resolve tangent-plane normal");i.normalize();let o=Math.hypot(i[0],i[1]);this.east=o>0?new I(-i[1]/o,i[0]/o,0):new I(0,1,0),this.north=new I(i).cross(this.east).normalize(),this._plane=new Ge().fromPointNormal(this.anchor,i)}projectPointToNearestOnPlane(t,r=new Jr){Wf(t,3);let n=t[0]-this.anchor[0],i=t[1]-this.anchor[1],o=t[2]-this.anchor[2],s=yb(this,n,i,o,r,this.radius);if(!s)throw new RangeError("Tangent-plane projection overflow");return s}projectPointRadiallyOntoPlane(t,r=new Jr){Wf(t,3);let n=Math.max(Math.abs(t[0]),Math.abs(t[1]),Math.abs(t[2]));if(n===0)return;let i=t[0]/n,o=t[1]/n,s=t[2]/n,a=Math.hypot(i,o,s),c=i/a,l=o/a,h=s/a,u=this.zAxis,f=c*u[0]+l*u[1]+h*u[2];if(f<=1e-14)return;let d=this.anchor.dot(u)/f;return yb(this,c*d-this.anchor[0],l*d-this.anchor[1],h*d-this.anchor[2],r,this.radius)}projectPointOntoEllipsoid(t,r="radial",n=new I){Wf(t,2),gb(r);let[i,o,s]=this.radii;if(r==="radial"){let E=Math.max(Math.abs(this.anchor[0]),Math.abs(this.anchor[1]),Math.abs(this.anchor[2]),Math.abs(t[0]),Math.abs(t[1])),N=t[0]/E,B=t[1]/E,C=this.anchor[0]/E+this.east[0]*N+this.north[0]*B,R=this.anchor[1]/E+this.east[1]*N+this.north[1]*B,W=this.anchor[2]/E+this.east[2]*N+this.north[2]*B,j=Math.min(i,o,s),A=C*(j/i),P=R*(j/o),D=W*(j/s),F=Math.hypot(A,P,D);return F>0&&Number.isFinite(F)?Tg(i*(A/F),o*(P/F),s*(D/F),n):void 0}let a=this.zAxis,c=[this.anchor[0]+this.east[0]*t[0]+this.north[0]*t[1],this.anchor[1]+this.east[1]*t[0]+this.north[1]*t[1],this.anchor[2]+this.east[2]*t[0]+this.north[2]*t[1]];if(!c.every(Number.isFinite))return;let l=a[0]/i,h=a[1]/o,u=a[2]/s,f=c[0]/i,d=c[1]/o,m=c[2]/s,p=l*l+h*h+u*u,g=l*f+h*d+u*m,y=f*f+d*d+m*m-1,_=g*g,M=p*y,b=1e-6*(Math.abs(_)+Math.abs(M)),v=_-M;if(!(p>0)||!Number.isFinite(v)||Math.abs(v)<=b){let E=mb(this.radii,this.anchor,this.east,this.north,a,t,this.radius);return E&&Tg(E[0],E[1],E[2],n)}if(v<0)return;let T=Math.sqrt(Math.max(0,v)),S=g>0?-y/(g+T):(-g+T)/p;return Tg(c[0]+S*a[0],c[1]+S*a[1],c[2]+S*a[2],n)}projectPointsFlat(t,r="normal",n){if(gb(r),t.length%3)throw new RangeError("Expected packed XYZ coordinates");let i=t.length/3,o=n||new Float64Array(i*2);if(o.length!==i*2)throw new RangeError("Invalid tangent-plane output length");if(ArrayBuffer.isView(t)&&t.buffer===o.buffer&&t.byteOffset<o.byteOffset+o.byteLength&&o.byteOffset<t.byteOffset+t.byteLength)throw new RangeError("Input and output buffers must not overlap");for(let l=0;l<t.length;l++)if(!Number.isFinite(t[l]))throw new RangeError("Expected finite coordinates");let s=new Uint8Array(i),a=new I,c=new Jr;for(let l=0;l<i;l++){a.set(t[l*3],t[l*3+1],t[l*3+2]);let h=r==="normal"?this.projectPointToNearestOnPlane(a,c):this.projectPointRadiallyOntoPlane(a,c);s[l]=h?1:0,o[l*2]=h?h[0]:NaN,o[l*2+1]=h?h[1]:NaN}return{positions:o,valid:s}}get plane(){return this._plane}get origin(){return this.anchor}get xAxis(){return this.east}get yAxis(){return this.north}get zAxis(){return this._plane.normal}}});var ke,_b=w(()=>{ke={};ke.Constants={};ke.Math={};ke.Accumulator={};(function(e){"use strict";e.WGS84={a:6378137,f:1/298.257223563},e.version={major:2,minor:2,patch:0},e.version_string="2.2.0"})(ke.Constants);(function(e){"use strict";e.digits=53,e.epsilon=Math.pow(.5,e.digits-1),e.degree=Math.PI/180,e.sq=function(t){return t*t},e.hypot=function(t,r){return Math.sqrt(t*t+r*r)},e.cbrt=Math.cbrt||function(t){var r=Math.pow(Math.abs(t),.3333333333333333);return t>0?r:t<0?-r:t},e.log1p=Math.log1p||function(t){var r=1+t,n=r-1;return n===0?t:t*Math.log(r)/n},e.atanh=Math.atanh||function(t){var r=Math.abs(t);return r=e.log1p(2*r/(1-r))/2,t>0?r:t<0?-r:t},e.copysign=function(t,r){return Math.abs(t)*(r<0||r===0&&1/r<0?-1:1)},e.sum=function(t,r){var n=t+r,i=n-r,o=n-i,s;return i-=t,o-=r,s=n&&0-(i+o),{s:n,t:s}},e.polyval=function(t,r,n,i){for(var o=t<0?0:r[n++];--t>=0;)o=o*i+r[n++];return o},e.AngRound=function(t){var r=.0625,n=Math.abs(t);return n=n<r?r-(r-n):n,e.copysign(n,t)},e.remainder=function(t,r){return t%=r,t<-r/2?t+r:t<r/2?t:t-r},e.AngNormalize=function(t){var r=e.remainder(t,360);return Math.abs(r)===180?e.copysign(180,t):r},e.LatFix=function(t){return Math.abs(t)>90?NaN:t},e.AngDiff=function(t,r){var n=e.sum(e.remainder(-t,360),e.remainder(r,360)),i,o;return n=e.sum(e.remainder(n.s,360),n.t),i=n.s,o=n.t,(i===0||Math.abs(i)===180)&&(i=e.copysign(i,o===0?r-t:-o)),{d:i,e:o}},e.sincosd=function(t){var r,n,i,o,s,a,c;switch(r=t%360,i=Math.round(r/90),r-=90*i,n=r*this.degree,o=Math.sin(n),s=Math.cos(n),Math.abs(r)===45?(s=Math.sqrt(.5),o=e.copysign(s,n)):Math.abs(r)===30&&(s=Math.sqrt(.75),o=e.copysign(.5,n)),i&3){case 0:a=o,c=s;break;case 1:a=s,c=-o;break;case 2:a=-o,c=-s;break;default:a=-s,c=o;break}return c+=0,a===0&&(a=e.copysign(a,t)),{s:a,c}},e.sincosde=function(t,r){var n,i,o,s,a,c,l;switch(n=t%360,o=Math.round(n/90),n=e.AngRound(n-90*o+r),i=n*this.degree,s=Math.sin(i),a=Math.cos(i),Math.abs(n)===45?(a=Math.sqrt(.5),s=e.copysign(a,i)):Math.abs(n)===30&&(a=Math.sqrt(.75),s=e.copysign(.5,i)),o&3){case 0:c=s,l=a;break;case 1:c=a,l=-s;break;case 2:c=-s,l=-a;break;default:c=-a,l=s;break}return l+=0,c===0&&(c=e.copysign(c,t+r)),{s:c,c:l}},e.atan2d=function(t,r){var n=0,i;switch(Math.abs(t)>Math.abs(r)&&([t,r]=[r,t],n=2),e.copysign(1,r)<0&&(r=-r,++n),i=Math.atan2(t,r)/this.degree,n){case 1:i=e.copysign(180,t)-i;break;case 2:i=90-i;break;case 3:i=-90+i;break;default:break}return i}})(ke.Math);(function(e,t){"use strict";e.Accumulator=function(r){this.Set(r)},e.Accumulator.prototype.Set=function(r){r||(r=0),r.constructor===e.Accumulator?(this._s=r._s,this._t=r._t):(this._s=r,this._t=0)},e.Accumulator.prototype.Add=function(r){var n=t.sum(r,this._t),i=t.sum(n.s,this._s);n=n.t,this._s=i.s,this._t=i.t,this._s===0?this._s=n:this._t+=n},e.Accumulator.prototype.Sum=function(r){var n;return r?(n=new e.Accumulator(this),n.Add(r),n._s):this._s},e.Accumulator.prototype.Negate=function(){this._s*=-1,this._t*=-1},e.Accumulator.prototype.Remainder=function(r){this._s=t.remainder(this._s,r),this.Add(0)}})(ke.Accumulator,ke.Math);ke.Geodesic={};ke.GeodesicLine={};ke.PolygonArea={};(function(e,t,r,n,i){"use strict";var o=6,s=o,a=o,c=o,l=c,h,u,f=20,d=f+n.digits+10,m=n.epsilon,p=200*m,g=Math.sqrt(m),y=m,_=1e3*g,M=0,b=31,v=32640,T,S,E,N,B,C,R,W,j;e.tiny_=Math.sqrt(Number.MIN_VALUE/Number.EPSILON),e.nC1_=o,e.nC1p_=o,e.nC2_=o,e.nC3_=o,e.nC4_=o,h=e.nC3_*(e.nC3_-1)/2,u=e.nC4_*(e.nC4_+1)/2,e.CAP_C1=1,e.CAP_C1p=2,e.CAP_C2=4,e.CAP_C3=8,e.CAP_C4=16,e.NONE=0,e.ARC=64,e.LATITUDE=128|M,e.LONGITUDE=256|e.CAP_C3,e.AZIMUTH=512|M,e.DISTANCE=1024|e.CAP_C1,e.STANDARD=e.LATITUDE|e.LONGITUDE|e.AZIMUTH|e.DISTANCE,e.DISTANCE_IN=2048|e.CAP_C1|e.CAP_C1p,e.REDUCEDLENGTH=4096|e.CAP_C1|e.CAP_C2,e.GEODESICSCALE=8192|e.CAP_C1|e.CAP_C2,e.AREA=16384|e.CAP_C4,e.ALL=v|b,e.LONG_UNROLL=32768,e.OUT_MASK=v|e.LONG_UNROLL,e.SinCosSeries=function(A,P,D,F,L){if(L!==void 0){var O=L/2,V=Math.sin(O),yt=Math.cos(O);return-2*e.SinCosSeries(!1,D*yt-P*V,P*yt+D*V,F.map(function(St,k){return(k%2?-St:St)*Math.sin((2*k+1)*O)}))}var Dt=F.length,X=Dt-(A?1:0),xt=2*(D-P)*(D+P),et=X&1?F[--Dt]:0,dt=0;for(X=Math.floor(X/2);X--;)dt=xt*et-dt+F[--Dt],et=xt*dt-et+F[--Dt];return A?2*P*D*et:D*(et-dt)},T=function(A,P){var D,F=n.sq(A),L=n.sq(P),O=(F+L-1)/6,V,yt,Dt,X,xt,et,dt,St,k,Rt,zt;return L===0&&O<=0?D=0:(V=F*L/4,yt=n.sq(O),Dt=O*yt,X=V*(V+2*Dt),xt=O,X>=0?(et=V+Dt,et+=et<0?-Math.sqrt(X):Math.sqrt(X),dt=n.cbrt(et),xt+=dt+(dt!==0?yt/dt:0)):(St=Math.atan2(Math.sqrt(-X),-(V+Dt)),xt+=2*O*Math.cos(St/3)),k=Math.sqrt(n.sq(xt)+L),Rt=xt<0?L/(k-xt):xt+k,zt=(Rt-L)/(2*k),D=Rt/(Math.sqrt(Rt+n.sq(zt))+zt)),D},S=[1,4,64,0,256],e.A1m1f=function(A){var P=Math.floor(s/2),D=n.polyval(P,S,0,n.sq(A))/S[P+1];return(D+A)/(1-A)},E=[-1,6,-16,32,-9,64,-128,2048,9,-16,768,3,-5,512,-7,1280,-7,2048],e.C1f=function(A,P){var D=n.sq(A),F=A,L=0,O,V;for(O=1;O<=e.nC1_;++O)V=Math.floor((e.nC1_-O)/2),P[O]=F*n.polyval(V,E,L,D)/E[L+V+1],L+=V+2,F*=A},N=[205,-432,768,1536,4005,-4736,3840,12288,-225,116,384,-7173,2695,7680,3467,7680,38081,61440],e.C1pf=function(A,P){var D=n.sq(A),F=A,L=0,O,V;for(O=1;O<=e.nC1p_;++O)V=Math.floor((e.nC1p_-O)/2),P[O]=F*n.polyval(V,N,L,D)/N[L+V+1],L+=V+2,F*=A},B=[-11,-28,-192,0,256],e.A2m1f=function(A){var P=Math.floor(a/2),D=n.polyval(P,B,0,n.sq(A))/B[P+1];return(D-A)/(1+A)},C=[1,2,16,32,35,64,384,2048,15,80,768,7,35,512,63,1280,77,2048],e.C2f=function(A,P){var D=n.sq(A),F=A,L=0,O,V;for(O=1;O<=e.nC2_;++O)V=Math.floor((e.nC2_-O)/2),P[O]=F*n.polyval(V,C,L,D)/C[L+V+1],L+=V+2,F*=A},e.Geodesic=function(A,P){if(this.a=A,this.f=P,this._f1=1-this.f,this._e2=this.f*(2-this.f),this._ep2=this._e2/n.sq(this._f1),this._n=this.f/(2-this.f),this._b=this.a*this._f1,this._c2=(n.sq(this.a)+n.sq(this._b)*(this._e2===0?1:(this._e2>0?n.atanh(Math.sqrt(this._e2)):Math.atan(Math.sqrt(-this._e2)))/Math.sqrt(Math.abs(this._e2))))/2,this._etol2=.1*g/Math.sqrt(Math.max(.001,Math.abs(this.f))*Math.min(1,1-this.f/2)/2),!(isFinite(this.a)&&this.a>0))throw new Error("Equatorial radius is not positive");if(!(isFinite(this._b)&&this._b>0))throw new Error("Polar semi-axis is not positive");this._A3x=new Array(l),this._C3x=new Array(h),this._C4x=new Array(u),this.A3coeff(),this.C3coeff(),this.C4coeff()},R=[-3,128,-2,-3,64,-1,-3,-1,16,3,-1,-2,8,1,-1,2,1,1],e.Geodesic.prototype.A3coeff=function(){var A=0,P=0,D,F;for(D=c-1;D>=0;--D)F=Math.min(c-D-1,D),this._A3x[P++]=n.polyval(F,R,A,this._n)/R[A+F+1],A+=F+2},W=[3,128,2,5,128,-1,3,3,64,-1,0,1,8,-1,1,4,5,256,1,3,128,-3,-2,3,64,1,-3,2,32,7,512,-10,9,384,5,-9,5,192,7,512,-14,7,512,21,2560],e.Geodesic.prototype.C3coeff=function(){var A=0,P=0,D,F,L;for(D=1;D<e.nC3_;++D)for(F=e.nC3_-1;F>=D;--F)L=Math.min(e.nC3_-F-1,F),this._C3x[P++]=n.polyval(L,W,A,this._n)/W[A+L+1],A+=L+2},j=[97,15015,1088,156,45045,-224,-4784,1573,45045,-10656,14144,-4576,-858,45045,64,624,-4576,6864,-3003,15015,100,208,572,3432,-12012,30030,45045,1,9009,-2944,468,135135,5792,1040,-1287,135135,5952,-11648,9152,-2574,135135,-64,-624,4576,-6864,3003,135135,8,10725,1856,-936,225225,-8448,4992,-1144,225225,-1440,4160,-4576,1716,225225,-136,63063,1024,-208,105105,3584,-3328,1144,315315,-128,135135,-2560,832,405405,128,99099],e.Geodesic.prototype.C4coeff=function(){var A=0,P=0,D,F,L;for(D=0;D<e.nC4_;++D)for(F=e.nC4_-1;F>=D;--F)L=e.nC4_-F-1,this._C4x[P++]=n.polyval(L,j,A,this._n)/j[A+L+1],A+=L+2},e.Geodesic.prototype.A3f=function(A){return n.polyval(l-1,this._A3x,0,A)},e.Geodesic.prototype.C3f=function(A,P){var D=1,F=0,L,O;for(L=1;L<e.nC3_;++L)O=e.nC3_-L-1,D*=A,P[L]=D*n.polyval(O,this._C3x,F,A),F+=O+1},e.Geodesic.prototype.C4f=function(A,P){var D=1,F=0,L,O;for(L=0;L<e.nC4_;++L)O=e.nC4_-L-1,P[L]=D*n.polyval(O,this._C4x,F,A),F+=O+1,D*=A},e.Geodesic.prototype.Lengths=function(A,P,D,F,L,O,V,yt,Dt,X,xt,et,dt){xt&=e.OUT_MASK;var St={},k=0,Rt=0,zt=0,Wt=0,ee,Jt,ye,Be,Ue;if(xt&(e.DISTANCE|e.REDUCEDLENGTH|e.GEODESICSCALE)&&(zt=e.A1m1f(A),e.C1f(A,et),xt&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(Wt=e.A2m1f(A),e.C2f(A,dt),k=zt-Wt,Wt=1+Wt),zt=1+zt),xt&e.DISTANCE)ee=e.SinCosSeries(!0,O,V,et)-e.SinCosSeries(!0,D,F,et),St.s12b=zt*(P+ee),xt&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(Jt=e.SinCosSeries(!0,O,V,dt)-e.SinCosSeries(!0,D,F,dt),Rt=k*P+(zt*ee-Wt*Jt));else if(xt&(e.REDUCEDLENGTH|e.GEODESICSCALE)){for(ye=1;ye<=e.nC2_;++ye)dt[ye]=zt*et[ye]-Wt*dt[ye];Rt=k*P+(e.SinCosSeries(!0,O,V,dt)-e.SinCosSeries(!0,D,F,dt))}return xt&e.REDUCEDLENGTH?(St.m0=k,St.m12b=yt*(F*O)-L*(D*V)-F*V*Rt):St.m12b=NaN,xt&e.GEODESICSCALE&&(Be=F*V+D*O,Ue=this._ep2*(Dt-X)*(Dt+X)/(L+yt),St.M12=Be+(Ue*O-V*Rt)*D/L,St.M21=Be-(Ue*D-F*Rt)*O/yt),St},e.Geodesic.prototype.InverseStart=function(A,P,D,F,L,O,V,yt,Dt,X,xt){var et={},dt=F*P-L*A,St=L*P+F*A,k,Rt,zt,Wt,ee,Jt,ye,Be,Ue,Ft,Ot,Ut,Le,Qe,Fo,Uo,Yl,Ii,Kt,Or,or,Xr,pn;return et.sig12=-1,k=F*P,k+=L*A,Rt=St>=0&&dt<.5&&L*V<.5,Rt?(Wt=n.sq(A+F),Wt/=Wt+n.sq(P+L),et.dnm=Math.sqrt(1+this._ep2*Wt),zt=V/(this._f1*et.dnm),ee=Math.sin(zt),Jt=Math.cos(zt)):(ee=yt,Jt=Dt),et.salp1=L*ee,et.calp1=Jt>=0?dt+L*A*n.sq(ee)/(1+Jt):k-L*A*n.sq(ee)/(1-Jt),Be=n.hypot(et.salp1,et.calp1),Ue=A*F+P*L*Jt,Rt&&Be<this._etol2?(et.salp2=P*ee,et.calp2=dt-P*F*(Jt>=0?n.sq(ee)/(1+Jt):1-Jt),ye=n.hypot(et.salp2,et.calp2),et.salp2/=ye,et.calp2/=ye,et.sig12=Math.atan2(Be,Ue)):Math.abs(this._n)>.1||Ue>=0||Be>=6*Math.abs(this._n)*Math.PI*n.sq(P)||(pn=Math.atan2(-yt,-Dt),this.f>=0?(Qe=n.sq(A)*this._ep2,Fo=Qe/(2*(1+Math.sqrt(1+Qe))+Qe),Ut=this.f*P*this.A3f(Fo)*Math.PI,Le=Ut*P,Ft=pn/Ut,Ot=k/Le):(Uo=L*P-F*A,Yl=Math.atan2(k,Uo),Or=this.Lengths(this._n,Math.PI+Yl,A,-P,D,F,L,O,P,L,e.REDUCEDLENGTH,X,xt),Ii=Or.m12b,Kt=Or.m0,Ft=-1+Ii/(P*L*Kt*Math.PI),Le=Ft<-.01?k/Ft:-this.f*n.sq(P)*Math.PI,Ut=Le/P,Ot=V/Ut),Ot>-p&&Ft>-1-_?this.f>=0?(et.salp1=Math.min(1,-Ft),et.calp1=-Math.sqrt(1-n.sq(et.salp1))):(et.calp1=Math.max(Ft>-p?0:-1,Ft),et.salp1=Math.sqrt(1-n.sq(et.calp1))):(or=T(Ft,Ot),Xr=Ut*(this.f>=0?-Ft*or/(1+or):-Ot*(1+or)/or),ee=Math.sin(Xr),Jt=-Math.cos(Xr),et.salp1=L*ee,et.calp1=k-L*A*n.sq(ee)/(1-Jt))),et.salp1<=0?(et.salp1=1,et.calp1=0):(ye=n.hypot(et.salp1,et.calp1),et.salp1/=ye,et.calp1/=ye),et},e.Geodesic.prototype.Lambda12=function(A,P,D,F,L,O,V,yt,Dt,X,xt,et,dt,St){var k={},Rt,zt,Wt,ee,Jt,ye,Be,Ue,Ft,Ot,Ut,Le,Qe;return A===0&&yt===0&&(yt=-e.tiny_),zt=V*P,Wt=n.hypot(yt,V*A),k.ssig1=A,ee=zt*A,k.csig1=Jt=yt*P,Rt=n.hypot(k.ssig1,k.csig1),k.ssig1/=Rt,k.csig1/=Rt,k.salp2=L!==P?zt/L:V,k.calp2=L!==P||Math.abs(F)!==-A?Math.sqrt(n.sq(yt*P)+(P<-A?(L-P)*(P+L):(A-F)*(A+F)))/L:Math.abs(yt),k.ssig2=F,ye=zt*F,k.csig2=Be=k.calp2*L,Rt=n.hypot(k.ssig2,k.csig2),k.ssig2/=Rt,k.csig2/=Rt,k.sig12=Math.atan2(Math.max(0,k.csig1*k.ssig2-k.ssig1*k.csig2),k.csig1*k.csig2+k.ssig1*k.ssig2),Ue=Math.max(0,Jt*ye-ee*Be),Ft=Jt*Be+ee*ye,Ut=Math.atan2(Ue*X-Ft*Dt,Ft*X+Ue*Dt),Le=n.sq(Wt)*this._ep2,k.eps=Le/(2*(1+Math.sqrt(1+Le))+Le),this.C3f(k.eps,St),Ot=e.SinCosSeries(!0,k.ssig2,k.csig2,St)-e.SinCosSeries(!0,k.ssig1,k.csig1,St),k.domg12=-this.f*this.A3f(k.eps)*zt*(k.sig12+Ot),k.lam12=Ut+k.domg12,xt&&(k.calp2===0?k.dlam12=-2*this._f1*D/A:(Qe=this.Lengths(k.eps,k.sig12,k.ssig1,k.csig1,D,k.ssig2,k.csig2,O,P,L,e.REDUCEDLENGTH,et,dt),k.dlam12=Qe.m12b,k.dlam12*=this._f1/(k.calp2*L))),k},e.Geodesic.prototype.Inverse=function(A,P,D,F,L){var O,V;return L||(L=e.STANDARD),L===e.LONG_UNROLL&&(L|=e.STANDARD),L&=e.OUT_MASK,O=this.InverseInt(A,P,D,F,L),V=O.vals,L&e.AZIMUTH&&(V.azi1=n.atan2d(O.salp1,O.calp1),V.azi2=n.atan2d(O.salp2,O.calp2)),V},e.Geodesic.prototype.InverseInt=function(A,P,D,F,L){var O={},V,yt,Dt,X,xt,et,dt,St,k,Rt,zt,Wt,ee,Jt,ye,Be,Ue,Ft,Ot,Ut,Le,Qe,Fo,Uo,Yl,Ii,Kt,Or,or,Xr,pn,tf,ef,bc,la,Kl,Xl,Zl,Jl,rf,g0,xc,y0,nf,w0,_0,M0,PM,b0,of,x0,sf,RM,Ql,CM,NM,th,af,eh,S0,v0,cf,lf,E0,T0;if(O.lat1=A=n.LatFix(A),O.lat2=D=n.LatFix(D),A=n.AngRound(A),D=n.AngRound(D),V=n.AngDiff(P,F),yt=V.e,V=V.d,L&e.LONG_UNROLL?(O.lon1=P,O.lon2=P+V+yt):(O.lon1=n.AngNormalize(P),O.lon2=n.AngNormalize(F)),Dt=n.copysign(1,V),V*=Dt,yt*=Dt,ye=V*n.degree,X=n.sincosde(V,yt),Be=X.s,Ue=X.c,yt=180-V-yt,xt=Math.abs(A)<Math.abs(D)||isNaN(D)?-1:1,xt<0&&(Dt*=-1,[D,A]=[A,D]),et=n.copysign(1,-A),A*=et,D*=et,X=n.sincosd(A),dt=this._f1*X.s,St=X.c,X=n.hypot(dt,St),dt/=X,St/=X,St=Math.max(e.tiny_,St),X=n.sincosd(D),k=this._f1*X.s,Rt=X.c,X=n.hypot(k,Rt),k/=X,Rt/=X,Rt=Math.max(e.tiny_,Rt),St<-dt?Rt===St&&(k=n.copysign(dt,k)):Math.abs(k)===-dt&&(Rt=St),ee=Math.sqrt(1+this._ep2*n.sq(dt)),Jt=Math.sqrt(1+this._ep2*n.sq(k)),Fo=new Array(e.nC1_+1),Uo=new Array(e.nC2_+1),Yl=new Array(e.nC3_),Ii=A===-90||Be===0,Ii&&(Ot=Ue,Ut=Be,Le=1,Qe=0,Or=dt,or=Ot*St,Xr=k,pn=Le*Rt,Ft=Math.atan2(Math.max(0,or*Xr-Or*pn),or*pn+Or*Xr),Kt=this.Lengths(this._n,Ft,Or,or,ee,Xr,pn,Jt,St,Rt,L|e.DISTANCE|e.REDUCEDLENGTH,Fo,Uo),zt=Kt.s12b,Wt=Kt.m12b,L&e.GEODESICSCALE&&(O.M12=Kt.M12,O.M21=Kt.M21),Ft<g||Wt>=0?((Ft<3*e.tiny_||Ft<m&&(zt<0||Wt<0))&&(Ft=Wt=zt=0),Wt*=this._b,zt*=this._b,O.a12=Ft/n.degree):Ii=!1),th=2,!Ii&&dt===0&&(this.f<=0||yt>=this.f*180))Ot=Le=0,Ut=Qe=1,zt=this.a*ye,Ft=ef=ye/this._f1,Wt=this._b*Math.sin(Ft),L&e.GEODESICSCALE&&(O.M12=O.M21=Math.cos(Ft)),O.a12=V/this._f1;else if(!Ii)if(Kt=this.InverseStart(dt,St,ee,k,Rt,Jt,ye,Be,Ue,Fo,Uo),Ft=Kt.sig12,Ut=Kt.salp1,Ot=Kt.calp1,Ft>=0)Qe=Kt.salp2,Le=Kt.calp2,bc=Kt.dnm,zt=Ft*this._b*bc,Wt=n.sq(bc)*this._b*Math.sin(Ft/bc),L&e.GEODESICSCALE&&(O.M12=O.M21=Math.cos(Ft/bc)),O.a12=Ft/n.degree,ef=ye/(this._f1*bc);else{for(la=0,Kl=e.tiny_,Xl=1,Zl=e.tiny_,Jl=-1,rf=!1,g0=!1;Kt=this.Lambda12(dt,St,ee,k,Rt,Jt,Ut,Ot,Be,Ue,la<f,Fo,Uo,Yl),xc=Kt.lam12,Qe=Kt.salp2,Le=Kt.calp2,Ft=Kt.sig12,Or=Kt.ssig1,or=Kt.csig1,Xr=Kt.ssig2,pn=Kt.csig2,tf=Kt.eps,eh=Kt.domg12,y0=Kt.dlam12,!(g0||!(Math.abs(xc)>=(rf?8:1)*m)||la==d);++la){if(xc>0&&(la<f||Ot/Ut>Jl/Zl)?(Zl=Ut,Jl=Ot):xc<0&&(la<f||Ot/Ut<Xl/Kl)&&(Kl=Ut,Xl=Ot),la<f&&y0>0&&(nf=-xc/y0,Math.abs(nf)<Math.PI&&(w0=Math.sin(nf),_0=Math.cos(nf),M0=Ut*_0+Ot*w0,M0>0))){Ot=Ot*_0-Ut*w0,Ut=M0,X=n.hypot(Ut,Ot),Ut/=X,Ot/=X,rf=Math.abs(xc)<=16*m;continue}Ut=(Kl+Zl)/2,Ot=(Xl+Jl)/2,X=n.hypot(Ut,Ot),Ut/=X,Ot/=X,rf=!1,g0=Math.abs(Kl-Ut)+(Xl-Ot)<y||Math.abs(Ut-Zl)+(Ot-Jl)<y}PM=L|(L&(e.REDUCEDLENGTH|e.GEODESICSCALE)?e.DISTANCE:e.NONE),Kt=this.Lengths(tf,Ft,Or,or,ee,Xr,pn,Jt,St,Rt,PM,Fo,Uo),zt=Kt.s12b,Wt=Kt.m12b,L&e.GEODESICSCALE&&(O.M12=Kt.M12,O.M21=Kt.M21),Wt*=this._b,zt*=this._b,O.a12=Ft/n.degree,L&e.AREA&&(E0=Math.sin(eh),T0=Math.cos(eh),th=Be*T0-Ue*E0,af=Ue*T0+Be*E0)}return L&e.DISTANCE&&(O.s12=0+zt),L&e.REDUCEDLENGTH&&(O.m12=0+Wt),L&e.AREA&&(b0=Ut*St,of=n.hypot(Ot,Ut*dt),of!==0&&b0!==0?(Or=dt,or=Ot*St,Xr=k,pn=Le*Rt,sf=n.sq(of)*this._ep2,tf=sf/(2*(1+Math.sqrt(1+sf))+sf),RM=n.sq(this.a)*of*b0*this._e2,X=n.hypot(Or,or),Or/=X,or/=X,X=n.hypot(Xr,pn),Xr/=X,pn/=X,Ql=new Array(e.nC4_),this.C4f(tf,Ql),CM=e.SinCosSeries(!1,Or,or,Ql),NM=e.SinCosSeries(!1,Xr,pn,Ql),O.S12=RM*(Ft<.01?e.SinCosSeries(!1,Or,or,Ql,Ft):NM-CM)):O.S12=0,!Ii&&th==2&&(th=Math.sin(ef),af=Math.cos(ef)),!Ii&&af>-.7071&&k-dt<1.75?(eh=1+af,S0=1+St,v0=1+Rt,x0=2*Math.atan2(th*(dt*v0+k*S0),eh*(dt*k+S0*v0))):(cf=Qe*Ot-Le*Ut,lf=Le*Ot+Qe*Ut,cf===0&&lf<0&&(cf=e.tiny_*Ot,lf=-1),x0=Math.atan2(cf,lf)),O.S12+=this._c2*x0,O.S12*=xt*Dt*et,O.S12+=0),xt<0&&([Qe,Ut]=[Ut,Qe],[Le,Ot]=[Ot,Le],L&e.GEODESICSCALE&&([O.M21,O.M12]=[O.M12,O.M21])),Ut*=xt*Dt,Ot*=xt*et,Qe*=xt*Dt,Le*=xt*et,{vals:O,salp1:Ut,calp1:Ot,salp2:Qe,calp2:Le}},e.Geodesic.prototype.GenDirect=function(A,P,D,F,L,O){var V;return O?O===e.LONG_UNROLL&&(O|=e.STANDARD):O=e.STANDARD,F||(O|=e.DISTANCE_IN),V=new t.GeodesicLine(this,A,P,D,O),V.GenPosition(F,L,O)},e.Geodesic.prototype.Direct=function(A,P,D,F,L){return this.GenDirect(A,P,D,!1,F,L)},e.Geodesic.prototype.ArcDirect=function(A,P,D,F,L){return this.GenDirect(A,P,D,!0,F,L)},e.Geodesic.prototype.Line=function(A,P,D,F){return new t.GeodesicLine(this,A,P,D,F)},e.Geodesic.prototype.DirectLine=function(A,P,D,F,L){return this.GenDirectLine(A,P,D,!1,F,L)},e.Geodesic.prototype.ArcDirectLine=function(A,P,D,F,L){return this.GenDirectLine(A,P,D,!0,F,L)},e.Geodesic.prototype.GenDirectLine=function(A,P,D,F,L,O){var V;return O||(O=e.STANDARD|e.DISTANCE_IN),F||(O|=e.DISTANCE_IN),V=new t.GeodesicLine(this,A,P,D,O),V.GenSetDistance(F,L),V},e.Geodesic.prototype.InverseLine=function(A,P,D,F,L){var O,V,yt;return L||(L=e.STANDARD|e.DISTANCE_IN),O=this.InverseInt(A,P,D,F,e.ARC),yt=n.atan2d(O.salp1,O.calp1),L&(e.OUT_MASK&e.DISTANCE_IN)&&(L|=e.DISTANCE),V=new t.GeodesicLine(this,A,P,yt,L,O.salp1,O.calp1),V.SetArc(O.vals.a12),V},e.Geodesic.prototype.Polygon=function(A){return new r.PolygonArea(this,A)},e.WGS84=new e.Geodesic(i.WGS84.a,i.WGS84.f)})(ke.Geodesic,ke.GeodesicLine,ke.PolygonArea,ke.Math,ke.Constants);(function(e,t,r){"use strict";t.GeodesicLine=function(n,i,o,s,a,c,l){var h,u,f,d,m,p;a||(a=e.STANDARD|e.DISTANCE_IN),this.a=n.a,this.f=n.f,this._b=n._b,this._c2=n._c2,this._f1=n._f1,this.caps=a|e.LATITUDE|e.AZIMUTH|e.LONG_UNROLL,this.lat1=r.LatFix(i),this.lon1=o,typeof c>"u"||typeof l>"u"?(this.azi1=r.AngNormalize(s),h=r.sincosd(r.AngRound(this.azi1)),this.salp1=h.s,this.calp1=h.c):(this.azi1=s,this.salp1=c,this.calp1=l),h=r.sincosd(r.AngRound(this.lat1)),f=this._f1*h.s,u=h.c,h=r.hypot(f,u),f/=h,u/=h,u=Math.max(e.tiny_,u),this._dn1=Math.sqrt(1+n._ep2*r.sq(f)),this._salp0=this.salp1*u,this._calp0=r.hypot(this.calp1,this.salp1*f),this._ssig1=f,this._somg1=this._salp0*f,this._csig1=this._comg1=f!==0||this.calp1!==0?u*this.calp1:1,h=r.hypot(this._ssig1,this._csig1),this._ssig1/=h,this._csig1/=h,this._k2=r.sq(this._calp0)*n._ep2,d=this._k2/(2*(1+Math.sqrt(1+this._k2))+this._k2),this.caps&e.CAP_C1&&(this._A1m1=e.A1m1f(d),this._C1a=new Array(e.nC1_+1),e.C1f(d,this._C1a),this._B11=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C1a),m=Math.sin(this._B11),p=Math.cos(this._B11),this._stau1=this._ssig1*p+this._csig1*m,this._ctau1=this._csig1*p-this._ssig1*m),this.caps&e.CAP_C1p&&(this._C1pa=new Array(e.nC1p_+1),e.C1pf(d,this._C1pa)),this.caps&e.CAP_C2&&(this._A2m1=e.A2m1f(d),this._C2a=new Array(e.nC2_+1),e.C2f(d,this._C2a),this._B21=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C2a)),this.caps&e.CAP_C3&&(this._C3a=new Array(e.nC3_),n.C3f(d,this._C3a),this._A3c=-this.f*this._salp0*n.A3f(d),this._B31=e.SinCosSeries(!0,this._ssig1,this._csig1,this._C3a)),this.caps&e.CAP_C4&&(this._C4a=new Array(e.nC4_),n.C4f(d,this._C4a),this._A4=r.sq(this.a)*this._calp0*this._salp0*n._e2,this._B41=e.SinCosSeries(!1,this._ssig1,this._csig1,this._C4a)),this.a13=this.s13=NaN},t.GeodesicLine.prototype.GenPosition=function(n,i,o,s={}){var a,c,l,h,u,f,d,m,p,g,y,_,M,b,v,T,S,E,N,B,C,R,W,j,A,P,D,F,L;return o?o===e.LONG_UNROLL&&(o|=e.STANDARD):o=e.STANDARD,o&=this.caps&e.OUT_MASK,s.lat1=this.lat1,s.azi1=this.azi1,s.lon1=o&e.LONG_UNROLL?this.lon1:r.AngNormalize(this.lon1),n?s.a12=i:s.s12=i,n||this.caps&e.DISTANCE_IN&e.OUT_MASK?(h=0,u=0,n?(a=i*r.degree,P=r.sincosd(i),c=P.s,l=P.c):(m=i/(this._b*(1+this._A1m1)),p=Math.sin(m),g=Math.cos(m),h=-e.SinCosSeries(!0,this._stau1*g+this._ctau1*p,this._ctau1*g-this._stau1*p,this._C1pa),a=m-(h-this._B11),c=Math.sin(a),l=Math.cos(a),Math.abs(this.f)>.01&&(f=this._ssig1*l+this._csig1*c,d=this._csig1*l-this._ssig1*c,h=e.SinCosSeries(!0,f,d,this._C1a),y=(1+this._A1m1)*(a+(h-this._B11))-i/this._b,a=a-y/Math.sqrt(1+this._k2*r.sq(f)),c=Math.sin(a),l=Math.cos(a))),f=this._ssig1*l+this._csig1*c,d=this._csig1*l-this._ssig1*c,R=Math.sqrt(1+this._k2*r.sq(f)),o&(e.DISTANCE|e.REDUCEDLENGTH|e.GEODESICSCALE)&&((n||Math.abs(this.f)>.01)&&(h=e.SinCosSeries(!0,f,d,this._C1a)),u=(1+this._A1m1)*(h-this._B11)),T=this._calp0*f,S=r.hypot(this._salp0,this._calp0*d),S===0&&(S=d=e.tiny_),B=this._salp0,C=this._calp0*d,n&&o&e.DISTANCE&&(s.s12=this._b*((1+this._A1m1)*a+u)),o&e.LONGITUDE&&(E=this._salp0*f,N=d,v=r.copysign(1,this._salp0),_=o&e.LONG_UNROLL?v*(a-(Math.atan2(f,d)-Math.atan2(this._ssig1,this._csig1))+(Math.atan2(v*E,N)-Math.atan2(v*this._somg1,this._comg1))):Math.atan2(E*this._comg1-N*this._somg1,N*this._comg1+E*this._somg1),M=_+this._A3c*(a+(e.SinCosSeries(!0,f,d,this._C3a)-this._B31)),b=M/r.degree,s.lon2=o&e.LONG_UNROLL?this.lon1+b:r.AngNormalize(r.AngNormalize(this.lon1)+r.AngNormalize(b))),o&e.LATITUDE&&(s.lat2=r.atan2d(T,this._f1*S)),o&e.AZIMUTH&&(s.azi2=r.atan2d(B,C)),o&(e.REDUCEDLENGTH|e.GEODESICSCALE)&&(W=e.SinCosSeries(!0,f,d,this._C2a),j=(1+this._A2m1)*(W-this._B21),A=(this._A1m1-this._A2m1)*a+(u-j),o&e.REDUCEDLENGTH&&(s.m12=this._b*(R*(this._csig1*f)-this._dn1*(this._ssig1*d)-this._csig1*d*A)),o&e.GEODESICSCALE&&(P=this._k2*(f-this._ssig1)*(f+this._ssig1)/(this._dn1+R),s.M12=l+(P*f-d*A)*this._ssig1/this._dn1,s.M21=l-(P*this._ssig1-this._csig1*A)*f/R)),o&e.AREA&&(D=e.SinCosSeries(!1,f,d,this._C4a),this._calp0===0||this._salp0===0?(F=B*this.calp1-C*this.salp1,L=C*this.calp1+B*this.salp1):(F=this._calp0*this._salp0*(l<=0?this._csig1*(1-l)+c*this._ssig1:c*(this._csig1*c/(1+l)+this._ssig1)),L=r.sq(this._salp0)+r.sq(this._calp0)*this._csig1*d),s.S12=this._c2*Math.atan2(F,L)+this._A4*(Math.abs(a)<.01?e.SinCosSeries(!1,this._ssig1,this._csig1,this._C4a,a):D-this._B41)),n||(s.a12=a/r.degree),s):(s.a12=NaN,s)},t.GeodesicLine.prototype.Position=function(n,i){return this.GenPosition(!1,n,i)},t.GeodesicLine.prototype.ArcPosition=function(n,i){return this.GenPosition(!0,n,i)},t.GeodesicLine.prototype.GenSetDistance=function(n,i){n?this.SetArc(i):this.SetDistance(i)},t.GeodesicLine.prototype.SetDistance=function(n){var i;this.s13=n,i=this.GenPosition(!1,this.s13,e.ARC),this.a13=0+i.a12},t.GeodesicLine.prototype.SetArc=function(n){var i;this.a13=n,i=this.GenPosition(!0,this.a13,e.DISTANCE),this.s13=0+i.s12}})(ke.Geodesic,ke.GeodesicLine,ke.Math)});function Mb(e){if(!Number.isFinite(e))throw new Error("Nonfinite axis, azimuth, distance or arc")}function bb({semiMajorAxis:e,semiMinorAxis:t}){return Mb(e),Mb(t),new Ig.Geodesic(e,(e-t)/e)}var Ig,hh,xb=w(()=>{_b();Ig=ke.Geodesic;hh=Ig.ALL&~Ig.AREA});function Eb(e,t,r,n,i,o){let s=vb[t]&&vb[t][r];pr(s&&(!n||n===s));let a,c,l,h=VR.copy(i);if(!Number.isFinite(h.x)||!Number.isFinite(h.y)||!Number.isFinite(h.z)||!Array.isArray(o)&&o.length<16)throw new Error("Unsupported local frame");let u=zR*Math.min(1,e.maximumRadius),f=Math.abs(h.x)<=u&&Math.abs(h.y)<=u,d=e.radii;if(d.x===d.y&&d.x>0&&d.z>0&&d.z<=d.x&&(!f||h.z!==0)){let{east:B,up:C}=Cc;if(f)B.set(0,1,0),C.set(0,0,Math.sign(h.z));else{let R=Math.max(Math.abs(h.x),Math.abs(h.y));B.set(-h.y/R,h.x/R,0).normalize(),e.geodeticSurfaceNormal(h,C)}if(!dg(B,C,Sb)||!mg(Sb,h,t,r,n,o))throw new Error("Unsupported local frame");return o}if(f){let B=Math.sign(h.z);a=kR.fromArray(Ag[t]),t!=="east"&&t!=="west"&&a.scale(B),c=qR.fromArray(Ag[r]),r!=="east"&&r!=="west"&&c.scale(B),l=jR.fromArray(Ag[n]),n!=="east"&&n!=="west"&&l.scale(B)}else{let{up:B,east:C,north:R}=Cc,W=Math.max(Math.abs(h.x),Math.abs(h.y));C.set(-h.y/W,h.x/W,0).normalize(),e.geodeticSurfaceNormal(h,B),R.copy(B).cross(C);let{down:j,west:A,south:P}=Cc;j.copy(B).scale(-1),A.copy(C).scale(-1),P.copy(R).scale(-1),a=Cc[t],c=Cc[r],l=Cc[n]}let m=a.x,p=a.y,g=a.z,y=c.x,_=c.y,M=c.z,b=l.x,v=l.y,T=l.z,S=h.x,E=h.y,N=h.z;return o[0]=m,o[1]=p,o[2]=g,o[3]=0,o[4]=y,o[5]=_,o[6]=M,o[7]=0,o[8]=b,o[9]=v,o[10]=T,o[11]=0,o[12]=S,o[13]=E,o[14]=N,o[15]=1,o}var zR,VR,Sb,vb,Ag,Cc,kR,qR,jR,Tb=w(()=>{qt();qt();zR=1e-14,VR=new I,Sb=fg(),vb={up:{south:"east",north:"west",west:"south",east:"north"},down:{south:"west",north:"east",west:"north",east:"south"},south:{up:"west",down:"east",west:"down",east:"up"},north:{up:"east",down:"west",west:"up",east:"down"},west:{up:"north",down:"south",north:"down",south:"up"},east:{up:"south",down:"north",north:"up",south:"down"}},Ag={north:[-1,0,0],east:[0,1,0],up:[0,0,1],south:[1,0,0],west:[0,-1,0],down:[0,0,-1]},Cc={east:new I,north:new I,up:new I,west:new I,south:new I,down:new I},kR=new I,qR=new I,jR=new I});function fa(e,t,r=new bt){return Eb(e,"east","north","up",t,r)}var Ib=w(()=>{qt();Tb()});var Ab=w(()=>{zf();Ib()});var uh,Pb=w(()=>{qt();uh=class{constructor(t,r,n,i){this.west=t,this.south=r,this.east=n,this.north=i}static center(t,r){r||(r=new I);let n=t.east,i=t.west;n<i&&(n+=we.TWO_PI);let o=C0((i+n)*.5,"negative-pi-to-pi"),s=(t.south+t.north)*.5;return r.x=o,r.y=s,r.z=0,r}get width(){let t=this.east,r=this.west;return t<r&&(t+=we.TWO_PI),t-r}}});function fh(e,t=pt.WGS84,r={}){if(!e||e.length!==6||e.some(_=>!Number.isFinite(_)))throw new Error("makeOBBFromRegion: region must contain exactly six finite numbers");let n=r.units==="degrees"?mf(1):1,[i,o,s,a,c,l]=e;if(c>l)throw new Error("makeOBBFromRegion: minimumHeight must not exceed maximumHeight");let h=o*n,u=a*n,f=Nb(i*n),d=Nb(s*n);s*n-i*n>=we.TWO_PI-1e-12&&(d=f+we.TWO_PI);let p=1e-12;if(h>u||h<-we.PI_OVER_TWO-p||u>we.PI_OVER_TWO+p)throw new Error("makeOBBFromRegion: latitude must be within [-\u03C0/2, \u03C0/2] and south \u2264 north");let g=Math.max(-we.PI_OVER_TWO,Math.min(we.PI_OVER_TWO,h)),y=Math.max(-we.PI_OVER_TWO,Math.min(we.PI_OVER_TWO,u));return g8([f,g,d,y,c,l],t,r.transform)}function Nb(e){let t=((e+Math.PI)%we.TWO_PI+we.TWO_PI)%we.TWO_PI-Math.PI;return t===-Math.PI&&e>0?Math.PI:t}function g8(e,t,r){let n=new eo,[i,o,s,a,c,l]=e,h=Br(a),u=Br(o),f,d,m,p,g,y,_,M=new uh(i,o,s,a),b=uh.center(M,HR),v=new I([Br(b.x),Br(b.y),0]),T=b.x,S=v.x;if(M.width<=we.PI){let yt=Br(i),Dt=t.cartographicToCartesian(v),X=new Hf(Dt,t),xt=u<0&&h>0?0:v.y,et=$R.copy([S,h,l]),dt=YR.copy([yt,h,l]),St=KR.copy([yt,xt,l]),k=XR.copy([yt,u,l]),Rt=ZR.copy([S,u,l]),zt=t.cartographicToCartesian(et,JR),Wt=t.cartographicToCartesian(dt,Rb),ee=t.cartographicToCartesian(St,QR),Jt=t.cartographicToCartesian(k,Cb),ye=t.cartographicToCartesian(Rt,t8),Be=X.projectPointToNearestOnPlane(zt,e8),Ue=X.projectPointToNearestOnPlane(Wt,r8),Ft=X.projectPointToNearestOnPlane(ee,n8),Ot=X.projectPointToNearestOnPlane(Jt,i8),Ut=X.projectPointToNearestOnPlane(ye,o8);return p=Math.min(Ue.x,Ft.x,Ot.x),f=-p,d=Math.max(Ue.y,Be.y),g=Math.min(Ot.y,Ut.y),dt.z=k.z=c,Wt=t.cartographicToCartesian(dt,Rb),Jt=t.cartographicToCartesian(k,Cb),_=X.plane,y=Math.min(_.getPointDistance(Wt),_.getPointDistance(Jt)),m=l,Ob(Lb(X.origin,X.xAxis,X.yAxis,X.zAxis,p,f,g,d,y,m,n),r)}let E=Br(s),N=o>0,B=a<0,C=N?u:B?h:0,R=t.cartographicToCartesian([S,C,l],a8);R.z=0;let j=Math.abs(R.x)<we.EPSILON10&&Math.abs(R.y)<we.EPSILON10?m8:c8.copy(R).normalize(),A=p8,P=l8.copy(j).cross(A);_=s8.fromPointNormal(R,j);let D=t.cartographicToCartesian([Br(T+we.PI_OVER_TWO),C,l],h8);f=_.projectPointOntoPlane(D,u8).dot(P),p=-f;let L=B?c:l,O=N?c:l;d=Bb(t,h,L,!0),g=Bb(t,u,O,!1);let V=t.cartographicToCartesian([E,C,l],d8);return y=_.getPointDistance(V),m=0,Ob(Lb(R,P,A,j,p,f,g,d,y,m,n),r)}function Ob(e,t){if(!t)return e;let r=[0,1,2].map(a=>e.halfAxes.getColumn(a,new I)),n=t.transformAsPoint(e.center),i=[1/0,1/0,1/0],o=[-1/0,-1/0,-1/0];for(let a=0;a<8;a++){let c=new I(n);for(let l=0;l<3;l++){let h=t.transformAsVector(r[l]);c.add(new I(h).scale((a&1<<l)===0?-1:1))}for(let l=0;l<3;l++)i[l]=Math.min(i[l],c[l]),o[l]=Math.max(o[l],c[l])}e.center.copy(i).add(o).scale(.5);let s=new I(o).subtract(i).scale(.5);return e.halfAxes=new Qr().set(s.x,0,0,0,s.y,0,0,0,s.z),e}function Bb(e,t,r,n){let i=n?-1/0:1/0;for(let o of[0,90,180,270]){let s=e.cartographicToCartesian([o,t,r],f8).z;i=n?Math.max(i,s):Math.min(i,s)}return i}function Lb(e,t,r,n,i,o,s,a,c,l,h){let u=h.center,f=h.halfAxes;f.setColumn(0,t),f.setColumn(1,r),f.setColumn(2,n);let d=WR.set((i+o)/2,(s+a)/2,(c+l)/2).transformByMatrix3(f),m=(o-i)/2,p=(a-s)/2,g=(l-c)/2;return f[0]*=m,f[1]*=m,f[2]*=m,f[3]*=p,f[4]*=p,f[5]*=p,f[6]*=g,f[7]*=g,f[8]*=g,u.copy(e).add(d),h}var WR,HR,$R,YR,KR,XR,ZR,JR,Rb,QR,Cb,t8,e8,r8,n8,i8,o8,s8,a8,c8,l8,h8,u8,f8,d8,m8,p8,Db=w(()=>{qt();ro();Pb();zf();wb();WR=new I,HR=new I,$R=new I,YR=new I,KR=new I,XR=new I,ZR=new I,JR=new I,Rb=new I,QR=new I,Cb=new I,t8=new I,e8=new Jr,r8=new Jr,n8=new Jr,i8=new Jr,o8=new Jr,s8=new Ge,a8=new I,c8=new I,l8=new I,h8=new I,u8=new Jr,f8=new I,d8=new I,m8=new I(1,0,0),p8=new I(0,0,1)});var Fb=w(()=>{Db()});var Ub=w(()=>{});function $f(e={}){if(e.coordinateEpoch!==void 0&&!Number.isFinite(e.coordinateEpoch))throw new Error("Spatial reference coordinate epoch must be a finite decimal year");return Object.freeze({crs:Gb(e.crs||{state:"absent",provenance:"unknown"}),vertical:e.vertical?Gb(e.vertical):void 0,coordinateEpoch:e.coordinateEpoch,coordinateFrame:e.coordinateFrame||"unknown",coordinateOrder:Object.freeze([...e.coordinateOrder||[]]),units:e.units?Object.freeze([...e.units]):void 0})}function tr(e){if(typeof e=="object")return"projjson";let t=e.trim();return/^[A-Z][A-Z0-9_]*\s*[\[(]/i.test(t)?"wkt":/(?:^|\s)\+?proj=/i.test(t)?"proj-string":/^[A-Z][A-Z0-9._-]*(?::[A-Z0-9._-]+)+$/i.test(t)||/^urn:ogc:def:crs:/i.test(t)||/^https?:\/\//i.test(t)||/^[A-Z][A-Z0-9._-]*$/i.test(t)?"identifier":"opaque"}function Gb(e){return e.state==="explicit"||e.state==="default"?Object.freeze({...e,definition:zb(e.definition),alternatives:e.alternatives?Object.freeze(e.alternatives.map(t=>Object.freeze({...t,definition:zb(t.definition)}))):void 0}):Object.freeze({...e})}function zb(e){return typeof e=="string"?e:Pg(e)}function Pg(e){return Array.isArray(e)?Object.freeze(e.map(t=>Pg(t))):e&&typeof e=="object"?Object.freeze(Object.fromEntries(Object.entries(e).map(([t,r])=>[t,Pg(r)]))):e}var Nc=w(()=>{});function mh(e,t){let n={type:"wkt-crs",root:new Rg(e).parse()};if(t?.strict){let i=jb(n,{profile:t.profile,allowExtensions:!1});if(i.length>0)throw new Kf(i)}return n}function jb(e,t){if(!e||e.type!=="wkt-crs"||e.root?.type!=="node")throw new TypeError("validateWKTCRS expects a WKTCRSAst");let r=I8(e.root.keyword,t?.profile||"auto"),n=E8[r],i=T8[r],o=[],s=e.root.keyword.toUpperCase();return n.has(s)||o.push({code:"invalid-root",message:`${e.root.keyword} is not a ${r} root keyword`,path:[],keyword:e.root.keyword}),Wb(e.root,[],a=>{let c=a.node.keyword.toUpperCase();!t?.allowExtensions&&!i.has(c)&&o.push({code:"unknown-keyword",message:`${a.node.keyword} is not defined by the ${r} profile`,path:a.path,keyword:a.node.keyword}),a.node.values.length===0&&o.push({code:"empty-node",message:`${a.node.keyword} must contain at least one value`,path:a.path,keyword:a.node.keyword});let l=A8(a.node);l&&o.push({code:"invalid-value",message:l,path:a.path,keyword:a.node.keyword})}),o}function I8(e,t){return t!=="auto"?t:dh.has(e.toUpperCase())?"wkt1":"wkt2:2019"}function A8(e){let t=e.keyword.toUpperCase(),r=e.values,n=(o,...s)=>!!(r[o]&&s.includes(r[o].type)),i=(o,...s)=>r.length===o&&s.every((a,c)=>n(c,a));if(["ANGLEUNIT","LENGTHUNIT","PARAMETRICUNIT","SCALEUNIT","TIMEUNIT","TEMPORALQUANTITY","UNIT"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"number")))return`${e.keyword} must start with a quoted name and numeric conversion factor`;if(t==="CS"&&!i(2,"enumeration","number"))return`${e.keyword} must contain a coordinate-system type and dimension`;if(t==="BBOX"&&!i(4,"number","number","number","number"))return`${e.keyword} must contain four numeric bounds`;if(["ENSEMBLEACCURACY","EPOCH","COORDEPOCH","FRAMEEPOCH","OPERATIONACCURACY","ORDER"].includes(t)&&!i(1,"number"))return`${e.keyword} must contain one number`;if(["ANCHOR","AREA","CALENDAR","CITATION","REMARK","SCOPE","URI","VERSION"].includes(t)&&!i(1,"string"))return`${e.keyword} must contain one quoted string`;if(["ELLIPSOID","SPHEROID","TRIAXIAL"].includes(t)&&!(r.length>=3&&n(0,"string")&&n(1,"number")&&n(2,"number")))return`${e.keyword} must start with a quoted name and numeric ellipsoid axes`;if(["PARAMETER"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"number")))return`${e.keyword} must start with a quoted name and numeric value`;if(t==="PARAMETERFILE"&&!i(2,"string","string"))return`${e.keyword} must contain a quoted name and file name`;if(["AUTHORITY","ID"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"string","number")))return`${e.keyword} must start with a quoted authority and identifier`;if(["AXIS"].includes(t)&&!(r.length>=2&&n(0,"string")&&n(1,"enumeration")))return`${e.keyword} must start with a quoted name and axis direction`;if(["METHOD","PROJECTION"].includes(t)&&!(r.length>=1&&n(0,"string")))return`${e.keyword} must start with a quoted name`;if(t==="TIMEEXTENT"){let o=s=>n(s,"enumeration","string");if(r.length!==2||!o(0)||!o(1))return`${e.keyword} must contain two date-time or quoted values`}if(t==="VERTICALEXTENT"&&(r.length<2||r.length>3||!n(0,"number")||!n(1,"number")||r.length===3&&!n(2,"node")))return`${e.keyword} must contain two numeric bounds and an optional unit`;if(t==="COORDINATEMETADATA"&&(r.length<1||r.length>2||!n(0,"node")||r.length===2&&(!n(1,"node")||!["EPOCH","COORDEPOCH"].includes(r[1].keyword.toUpperCase()))))return`${e.keyword} must contain a CRS and an optional coordinate epoch`;if(t==="BOUNDCRS"){let o=r.slice(0,3).map(s=>s.type==="node"?s.keyword.toUpperCase():"");if(o[0]!=="SOURCECRS"||o[1]!=="TARGETCRS"||o[2]!=="ABRIDGEDTRANSFORMATION")return`${e.keyword} must start with SOURCECRS, TARGETCRS, and ABRIDGEDTRANSFORMATION`}return["COMPOUNDCRS","CONCATENATEDOPERATION","COORDINATEOPERATION","DERIVEDPROJCRS","ENGCRS","ENGINEERINGCRS","GEODCRS","GEODETICCRS","GEOGCRS","GEOGRAPHICCRS","PARAMETRICCRS","POINTMOTIONOPERATION","PROJCRS","PROJECTEDCRS","TIMECRS","VERTCRS","VERTICALCRS"].includes(t)&&!n(0,"string")?`${e.keyword} must start with a quoted name`:null}function Wb(e,t,r){r({node:e,path:t});for(let n=0;n<e.values.length;n++){let i=e.values[n];i.type==="node"&&Wb(i,[...t,n],r)}}function P8(e,t){let r=1,n=1;for(let i=0;i<t&&i<e.length;i++)e[i]===`
|
|
8
|
+
`?(r++,n=1):n++;return{line:r,column:n}}var Yf,Kf,y8,w8,dh,Cg,_8,M8,b8,x8,Vb,kb,qb,S8,v8,E8,T8,Rg,Ng=w(()=>{Yf=class extends SyntaxError{constructor(t,r,n){let i=P8(r,n);super(`${t} at ${i.line}:${i.column}`),this.name="WKTCRSSyntaxError",this.offset=n,this.line=i.line,this.column=i.column}},Kf=class extends Error{constructor(t){super(t[0]?.message||"WKT validation failed"),this.name="WKTCRSValidationError",this.issues=t}},y8=/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)?$/,w8=/^[A-Za-z][A-Za-z0-9_]*/,dh=new Set(["COMPD_CS","CONCAT_MT","FITTED_CS","GEOCCS","GEOGCS","INVERSE_MT","LOCAL_CS","PARAM_MT","PASSTHROUGH_MT","PROJCS","VERT_CS"]),Cg=new Set([...dh,"AUTHORITY","AXIS","CONCAT_MT","DATUM","INVERSE_MT","LOCAL_DATUM","PARAMETER","PARAM_MT","PASSTHROUGH_MT","PRIMEM","PROJECTION","SPHEROID","TOWGS84","UNIT","VERT_DATUM"]),_8=new Set(dh),M8=new Set([...Cg,"EXTENSION"]),b8=new Set([...dh,"COMPDCS","LOCALCS","VERTCS"]),x8=new Set([...Cg,"COMPDCS","LOCALCS","VDATUM","VERTCS"]),Vb=new Set(["BOUNDCRS","COMPOUNDCRS","COORDINATEOPERATION","ENGCRS","ENGINEERINGCRS","GEODCRS","GEODETICCRS","PARAMETRICCRS","PROJCRS","PROJECTEDCRS","TIMECRS","VERTCRS","VERTICALCRS"]),kb=new Set([...Vb,"CONCATENATEDOPERATION","COORDINATEMETADATA","DERIVEDPROJCRS","GEOGCRS","GEOGRAPHICCRS","POINTMOTIONOPERATION"]),qb=new Set([...kb,"ABRIDGEDTRANSFORMATION","ANCHOR","ANGLEUNIT","AREA","AXIS","BASEENGCRS","BASEGEODCRS","BASEGEOGCRS","BASEPARAMCRS","BASEPROJCRS","BASETIMECRS","BASEVERTCRS","BBOX","BEARING","CALENDAR","CITATION","CONVERSION","COORDEPOCH","CS","DATUM","DERIVINGCONVERSION","DYNAMIC","EDATUM","ELLIPSOID","ENGINEERINGDATUM","ENSEMBLE","ENSEMBLEACCURACY","EPOCH","FRAMEEPOCH","GEODETICDATUM","GEOIDMODEL","ID","INTERPOLATIONCRS","LENGTHUNIT","MEMBER","MERIDIAN","METHOD","MODEL","OPERATIONACCURACY","ORDER","PARAMETER","PARAMETERFILE","PARAMETRICDATUM","PARAMETRICUNIT","PDATUM","PRIMEM","PRIMEMERIDIAN","REMARK","SCALEUNIT","SCOPE","SOURCECRS","STEP","TARGETCRS","TDATUM","TEMPORALQUANTITY","TIMEEXTENT","TIMEORIGIN","TIMEUNIT","TIMEDATUM","TRIAXIAL","TRF","URI","USAGE","VDATUM","VERSION","VERTICALDATUM","VERTICALEXTENT","VELOCITYGRID","VRF"]),S8=new Set(["BASEGEOGCRS","CALENDAR","CONCATENATEDOPERATION","COORDEPOCH","COORDINATEMETADATA","DERIVEDPROJCRS","DYNAMIC","ENSEMBLE","ENSEMBLEACCURACY","EPOCH","FRAMEEPOCH","GEOGCRS","GEOGRAPHICCRS","GEOIDMODEL","MEMBER","MODEL","POINTMOTIONOPERATION","STEP","TEMPORALQUANTITY","TRF","TRIAXIAL","VELOCITYGRID","VRF"]),v8=new Set([...qb].filter(e=>!S8.has(e))),E8={wkt1:dh,gdal:_8,esri:b8,"wkt2:2015":Vb,"wkt2:2019":kb},T8={wkt1:Cg,gdal:M8,esri:x8,"wkt2:2015":v8,"wkt2:2019":qb};Rg=class{constructor(t){this.offset=0,this.source=t}parse(){this.skipWhitespace();let t=this.parseNode();return this.skipWhitespace(),this.offset!==this.source.length&&this.fail("Unexpected content after WKT root"),t}parseNode(){let t=this.parseKeyword();return this.parseNodeAfterKeyword(t)}parseNodeAfterKeyword(t){this.skipWhitespace();let r=this.source[this.offset];r!=="["&&r!=="("&&this.fail(`Expected '[' or '(' after ${t}`),this.offset++;let n=r==="["?"bracket":"parenthesis",i=r==="["?"]":")",o=[];if(this.skipWhitespace(),this.source[this.offset]===i)return this.offset++,{type:"node",keyword:t,delimiter:n,values:o};for(;this.offset<this.source.length;){o.push(this.parseValue()),this.skipWhitespace();let s=this.source[this.offset];if(s===","){this.offset++,this.skipWhitespace(),this.source[this.offset]===i&&this.fail("Expected a WKT value after comma");continue}if(s===i)return this.offset++,{type:"node",keyword:t,delimiter:n,values:o};(s==="]"||s===")")&&this.fail(`Expected '${i}' to close ${t}`),this.fail(`Expected ',' or '${i}' in ${t}`)}this.fail(`Unterminated ${t} node`)}parseValue(){if(this.skipWhitespace(),this.source[this.offset]==='"')return this.parseString();let r=this.offset;for(;this.offset<this.source.length&&!/[\s,\[\]()"]/.test(this.source[this.offset]);)this.offset++;r===this.offset&&this.fail("Expected a WKT value");let n=this.source.slice(r,this.offset);return this.source[this.offset]==='"'&&this.fail("Unexpected quote in unquoted WKT value"),this.skipWhitespace(),this.source[this.offset]==="["||this.source[this.offset]==="("?(/^[A-Za-z][A-Za-z0-9_]*$/.test(n)||this.fail(`Invalid WKT keyword '${n}'`),this.parseNodeAfterKeyword(n)):y8.test(n)?{type:"number",value:Number(n),raw:n}:{type:"enumeration",value:n}}parseKeyword(){let t=this.source.slice(this.offset).match(w8);return t||this.fail("Expected a WKT keyword"),this.offset+=t[0].length,t[0]}parseString(){this.offset++;let t="";for(;this.offset<this.source.length;){let r=this.source[this.offset++];if(r==='"'){if(this.source[this.offset]==='"'){t+='"',this.offset++;continue}return{type:"string",value:t}}t+=r}this.fail("Unterminated WKT string")}skipWhitespace(){for(;this.offset<this.source.length&&/\s/.test(this.source[this.offset]);)this.offset++}fail(t){throw new Yf(t,this.source,this.offset)}}});function ph(e){let t=N8(e);if(t.length===0)throw new no("PROJ string is empty",e,0);return{type:"proj-string",parameters:t.map(n=>C8(n.raw,n.offset,e))}}function C8(e,t,r){let n=e.startsWith("+")?e.slice(1):e;if(!n)throw new no("Expected a parameter after '+'",r,t);let i=n.indexOf("="),o=i<0?n:n.slice(0,i);if(!o||/[\s+=]/.test(o))throw new no(`Invalid PROJ parameter name '${o}'`,r,t);if(i<0)return{type:"parameter",name:o};let s=n.slice(i+1),a=O8(s,r,t+i+1);return{type:"parameter",name:o,value:a,rawValue:s}}function N8(e){let t=[],r=0;for(;r<e.length;){for(;r<e.length&&/\s/.test(e[r]);)r++;if(r>=e.length)break;let n=r,i=null,o=!1;for(;r<e.length;){let s=e[r];if(o){o=!1,r++;continue}if(s==="\\"&&i){o=!0,r++;continue}if(i){s===i&&(i=null),r++;continue}if((s==='"'||s==="'")&&e[r-1]==="="){i=s,r++;continue}if(/\s/.test(s))break;r++}if(i)throw new no("Unterminated quoted PROJ value",e,n);t.push({raw:e.slice(n,r),offset:n})}return t}function O8(e,t,r){if(!e)return"";let n=e[0];if(n!=='"'&&n!=="'"){if((e.includes('"')||e.includes("'"))&&!R8.test(e))throw new no("Quote must begin a PROJ parameter value",t,r);return e}if(e[e.length-1]!==n)throw new no("Unterminated quoted PROJ value",t,r);let i="";for(let o=1;o<e.length-1;o++){let s=e[o];s==="\\"&&o+1<e.length-1?i+=e[++o]:i+=s}return i}function B8(e,t){let r=1,n=1;for(let i=0;i<t&&i<e.length;i++)e[i]===`
|
|
9
|
+
`?(r++,n=1):n++;return{line:r,column:n}}var no,R8,Og=w(()=>{no=class extends SyntaxError{constructor(t,r,n){let i=B8(r,n);super(`${t} at ${i.line}:${i.column}`),this.name="PROJStringSyntaxError",this.offset=n,this.line=i.line,this.column=i.column}};R8=/^[+-]?\d+(?:\.\d*)?d(?:\d+(?:\.\d*)?'(?:\d+(?:\.\d*)?")?)?[NSEW]?$/i});var gh,Hb=w(()=>{gh={m:{name:"meters",metersPerUnit:1},mm:{name:"millimeters",metersPerUnit:.001},cm:{name:"centimeters",metersPerUnit:.01},ft:{name:"feet",metersPerUnit:.3048},"us-ft":{name:"us-survey-feet",metersPerUnit:.3048006096012192},fath:{name:"fathoms",metersPerUnit:1.8288},kmi:{name:"nautical-miles",metersPerUnit:1852},"us-ch":{name:"us-survey-chains",metersPerUnit:20.1168402336805},"us-mi":{name:"us-survey-miles",metersPerUnit:1609.34721869444},km:{name:"kilometers",metersPerUnit:1e3},"ind-ft":{name:"indian-feet",metersPerUnit:.30479841},"ind-yd":{name:"indian-yards",metersPerUnit:.91439523},mi:{name:"miles",metersPerUnit:1609.344},yd:{name:"yards",metersPerUnit:.9144},ch:{name:"chains",metersPerUnit:20.1168},link:{name:"links",metersPerUnit:.201168},dm:{name:"decimeters",metersPerUnit:.1},in:{name:"inches",metersPerUnit:.0254},"ind-ch":{name:"indian-chains",metersPerUnit:20.11669506},"us-in":{name:"us-survey-inches",metersPerUnit:.025400050800101},"us-yd":{name:"us-survey-yards",metersPerUnit:.914401828803658}}});function $b(e){return JSON.stringify([e.coordinateFrame,e.projection,Object.keys(e.parameters).sort().map(t=>[t,e.parameters[t]]),[e.ellipsoid.semiMajorAxis,e.ellipsoid.semiMinorAxis],e.axis,[e.xUnit.name,e.xUnit.metersPerUnit,e.xUnit.degreesPerUnit],[e.yUnit.name,e.yUnit.metersPerUnit,e.yUnit.degreesPerUnit],[e.zUnit.name,e.zUnit.metersPerUnit,e.zUnit.degreesPerUnit],e.lossy,e.areaOfUse])}var Bg=w(()=>{Hb()});var Lg=w(()=>{Nc();Ng();Og()});function tt(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))return r;let n=e[t];if(typeof n!="string"||!/^[+-]?(?:\d+\.?\d*|\.\d+)(?:e[+-]?\d+)?$/i.test(n))throw new Error(`Invalid numeric PROJ parameter: +${t}`);let i=Number(n);if(!Number.isFinite(i))throw new Error(`Invalid numeric PROJ parameter: +${t}`);return i}function yh(e,t){let r=tt(e,t,0);if(Math.abs(r)>=90)throw new Error(`+${t} must be between -90 and 90 degrees`);return r*Me}function ve(e,t=!1){if(t||Math.abs(e)<=Math.PI)return e;let r=2*Math.PI;return((e+Math.PI)%r+r)%r-Math.PI}var Me,Ee=w(()=>{Me=Math.PI/180});function Te(e,t){let r=[e[0]*t[0],e[0]*t[1],e[1]*t[0],e[1]*t[1]];return[Math.min(...r),Math.max(...r)]}function wh([e,t]){let r=[Math.sin(e),Math.sin(t)];for(let[n,i]of[[Math.PI/2,1],[-Math.PI/2,-1]])Math.ceil((e-n)/(2*Math.PI))<=Math.floor((t-n)/(2*Math.PI))&&r.push(i);return[Math.min(...r),Math.max(...r)]}function re(e,t){let r=n=>Math.max(1,qo(n))*1e-12;if(![...e,...t].every(Number.isFinite))throw new Error("Projection rendering bounds are not finite");return[[e[0]-r(e),t[0]-r(t),0],[e[1]+r(e),t[1]+r(t),0]]}function gr(e,t,r=!1){let n=e[0][0]-t,i=e[1][0]-t;if(r)return[n,i];let o=i-n;if(o>=2*Math.PI-1e-12)return[-Math.PI,Math.PI];let s=ve(n);o>0&&Math.abs(s-Math.PI)<1e-12&&(s=-Math.PI);let a=s+o;return a>Math.PI+1e-12?[-Math.PI,Math.PI]:[s,Math.min(a,Math.PI)]}function yr(e,t,r,n=!1){let i=gr(t,r,n),o=[t[0][1],t[1][1],Math.max(t[0][1],Math.min(t[1][1],0))],s=i.flatMap(a=>o.map(c=>e(r+a,c)));return re([Math.min(...s.map(a=>a[0])),Math.max(...s.map(a=>a[0]))],[Math.min(...s.map(a=>a[1])),Math.max(...s.map(a=>a[1]))])}function Oc(e,t,r,n=!1,i=0){let o=gr(t,r,n);if(qo(o)>Math.PI/6+1e-12)throw new Error("Unsupported transverse rendering coverage");let s=[o[0],o[1],Math.max(o[0],Math.min(o[1],0))],a=[t[0][1],t[1][1],Math.max(t[0][1],Math.min(t[1][1],i))],c=s.flatMap(l=>a.map(h=>e(r+l,h)));return re([Math.min(...c.map(l=>l[0])),Math.max(...c.map(l=>l[0]))],[Math.min(...c.map(l=>l[1])),Math.max(...c.map(l=>l[1]))])}function Yb(e,t,r,n=!1){let i=gr(t,r,n),o=[i[0],i[1],Math.max(i[0],Math.min(i[1],0))],s=[t[0][1],t[1][1],Math.max(t[0][1],Math.min(t[1][1],0))],a=o.flatMap(c=>s.map(l=>e(r+c,l)));return re([Math.min(...a.map(c=>c[0])),Math.max(...a.map(c=>c[0]))],[Math.min(...a.map(c=>c[1])),Math.max(...a.map(c=>c[1]))])}function Bc(e,t,r,n,i,o,s=!1){let a=Ct(gr(t,r,s),n),c=kn(o-e(r,t[0][1])[1],o-e(r,t[1][1])[1]);return re(At([i,i],Te(c,wh(a))),At([o,o],Ct(Te(c,Xf(a)),-1)))}var kn,At,Ct,Xf,qo,Ie=w(()=>{Ee();kn=(e,t)=>[Math.min(e,t),Math.max(e,t)],At=(e,t)=>[e[0]+t[0],e[1]+t[1]],Ct=(e,t)=>kn(e[0]*t,e[1]*t);Xf=e=>wh([e[0]+Math.PI/2,e[1]+Math.PI/2]),qo=e=>Math.max(Math.abs(e[0]),Math.abs(e[1]))});function K(e,t,r,n){return[[e,t],[r,n]]}function ni(e){return e>=-180&&e<180?e:((e+180)%360+360)%360-180}function L8(e,t,r,n){if(![e,t,r,n].every(Number.isFinite)||t<-90||n>90||t>n||r-e<-360||r-e>360+1e-10)throw new Error("Invalid geographic coverage");if(r-e>=360-1e-10)return[-180,t,180,n];let i=ni(r);return[ni(e),t,i===-180&&r>e?180:i,n]}function Dg(e){let t=e[2]-e[0];return t<0?t+360:t}function Kb(e){let[t,r,n,i]=e;return t<=n?[e]:[[t,r,180,i],[-180,r,n,i]]}function D8(e,t){let[r,n,i,o]=e,s=ni(t[0]);return t[1]>=n&&t[1]<=o&&(r<=i?s>=r&&s<=i||s===-180&&i===180:s>=r||s<=i)}function Zf(e,t){let r=Math.max(e[1],t[1]),n=Math.min(e[3],t[3]);if(r>n)return[];let i=[];for(let s of Kb(e))for(let a of Kb(t)){let c=Math.max(s[0],a[0]),l=Math.min(s[2],a[2]);c<=l?i.push([c,l]):(s[2]===180&&a[0]===-180||a[2]===180&&s[0]===-180)&&i.push([-180,-180])}i.sort((s,a)=>s[0]-a[0]);let o=[];for(let s of i){let a=o[o.length-1];a&&s[0]<=a[1]?a[1]=Math.max(a[1],s[1]):o.push([...s])}if(o.length>1&&o[0][0]===-180&&o[o.length-1][1]===180){let s=o.shift();return[[o.pop()[0],r,s[1],n],...o.map(([c,l])=>[c,r,l,n])]}return o.map(([s,a])=>[s,r,a,n])}function Xb(e,t){let r=ni(t[0]),n=Math.max(e[1],Math.min(e[3],t[1]));if(!D8(e,[r,n])){let i=Math.abs(ni(r-e[0])),o=Math.abs(ni(r-e[2]));r=i<=o?e[0]:e[2]}return[r,n]}function jo(e,t=0,r=0){let n=Dg(e),i=e[0]*io-t,o=i+n*io/2,s=Math.round((r-o)/(2*Math.PI))*2*Math.PI;return K(n===360?r-Math.PI:i+s,e[1]*io,n===360?r+Math.PI:i+s+n*io,e[3]*io)}function gn(e,t=0){return L8((e[0][0]+t)/io,e[0][1]/io,(e[1][0]+t)/io,e[1][1]/io)}function Zb(e){if(!e.length)throw new Error("CRS coverage does not intersect the rendering target");return[[0,1,2].map(t=>Math.min(...e.map(r=>r[0][t]))),[0,1,2].map(t=>Math.max(...e.map(r=>r[1][t])))]}var io,Ht=w(()=>{io=Math.PI/180});function Jb(e,t){if(t)try{let n=e(t);return Fg(n)}catch{}let r=e();return Fg(r)}function Fg(e){let t=e.bounds;if(t.some(r=>r.some(n=>!Number.isFinite(n))))throw new Error("Projection rendering bounds must be finite");return{bounds:t,normalize:e.normalize?.bind(e)}}function Wo(e,t=0){return r=>{let n=r.x*Math.PI/180-t,i=r.y*Math.PI/180,o={x:n,y:i,z:r.z};e(o),o.x!==n&&(r.x=(o.x+t)*180/Math.PI),o.y!==i&&(r.y=o.y*180/Math.PI)}}function Jf(e,t){let r=[];for(let n of e){let i=t(n);i!==null&&r.push(Fg(i))}return r.length?r.length===1?r[0]:{bounds:Zb(r.map(n=>n.bounds)),normalize(n){let i=n.x,o=n.y,s=1/0;for(let a of r){let c={x:n.x,y:n.y,z:n.z};a.normalize?.(c);let l=Math.sin((c.y-n.y)*Math.PI/360)**2+Math.cos(n.y*Math.PI/180)*Math.cos(c.y*Math.PI/180)*Math.sin((c.x-n.x)*Math.PI/360)**2;l<s&&(s=l,i=c.x,o=c.y)}n.x=i,n.y=o}}:null}var da=w(()=>{Ht()});function Qf(e,t,r=0,n=!1){let i=Dg(t),o=i===360?r-180:t[0]+Math.round((r-t[0]-i/2)/360)*360,s=o+i;if(n){e.x=Math.max(o,Math.min(s,e.x)),e.y=Math.max(t[1],Math.min(t[3],e.y));return}let a=Xb(t,[e.x,e.y]),c=a[0];a[0]===ni(e.x)&&e.x>=o&&e.x<=s?c=e.x:(c<o||c>s)&&(c+=Math.round(((o+s)/2-c)/360)*360);let l=c-r;e.x=Math.abs(l)<=180?c:r+ni(l),e.y=a[1]}function Ke(e,t,r=0,n=0,i=!1){let o=(r+n)*180/Math.PI;return{get bounds(){return e(jo(t,n,r))},normalize(s){Qf(s,t,o,i)}}}function F8(e,t,r,n,i){let o=Jf(t,s=>Ke(e,s,r,n,i));if(!o)throw new Error("CRS coverage does not intersect the rendering target");return o}function Pt(e,t,r,n=0,i=!1){let o=(t[0][0]+t[1][0])/2,s=gn(t,n),a=(o+n)*180/Math.PI;return{...e,longitudeOrigin:o,getRenderingProfile(c){if(!c)return{bounds:r(t),normalize(l){Qf(l,s,a,i)}};try{let l=Ke(r,c,o,n,i);return{bounds:l.bounds,normalize:l.normalize}}catch{return F8(r,Zf(c,s),o,n,i)}}}}var ne=w(()=>{Ht();da()});function Qb(){return{x:0,y:0,z:0}}var Ho,td=w(()=>{Ho=class{constructor(){this.point=Qb(),this.points=[this.point],this.active=0}get depth(){return this.active}acquire(){var t;let r=this.active++;return(t=this.points)[r]||(t[r]=Qb()),this.points[r]}release(t){this.active>0&&this.points[this.active-1]===t&&this.active--}}});function qn(e,t){let r=new Ho,n=(i,o,s)=>{let a=r.acquire();try{return a.x=i,a.y=o,a.z=0,s(a),[a.x,a.y]}finally{r.release(a)}};return{forward(i,o){return n(i,o,e)},inverse(i,o){return n(i,o,t)},forwardInPlace:e,inverseInPlace:t}}function oo(e,t,r=!1){let n=t?e.inverseInPlace:e.forwardInPlace;if(n)return n.bind(e);if(r){let o=t?e.inverse3D:e.forward3D;return s=>{let a=o.call(e,[s.x,s.y,s.z]);s.x=a[0],s.y=a[1],s.z=a[2]}}let i=t?e.inverse:e.forward;return o=>{let s=i.call(e,o.x,o.y);o.x=s[0],o.y=s[1]}}var ma=w(()=>{td()});function $o(e,t,r=0){let n=tt(e,t,r);if(t!=="lon_0"&&Math.abs(n)>90)throw new Error("Latitude parameter must be between -90 and 90 degrees: +"+t);return n*Me}function ii(e,t){let r=Object.prototype.hasOwnProperty.call(e,t);if(r&&e[t]!==void 0)throw new Error("Expected a flag without a value: +"+t);return r}function er({semiMajorAxis:e,eccentricitySquared:t,parameters:r,primeMeridian:n=0}){let i=tt(r,"k_0",tt(r,"k",1));if(i<=0)throw new Error("Projection scale must be positive");return{primeMeridian:n,a:e,b:e*Math.sqrt(1-t),es:t,e:Math.sqrt(t),ep2:t/(1-t),sphere:t===0,over:ii(r,"over"),long0:$o(r,"lon_0"),lat0:$o(r,"lat_0"),lat1:$o(r,"lat_1"),lat2:$o(r,"lat_2",tt(r,"lat_1",0)),lat_ts:$o(r,"lat_ts",NaN),x0:tt(r,"x_0",0),y0:tt(r,"y_0",0),k0:i}}function Lc(e,t){if(!Object.prototype.hasOwnProperty.call(t,"lat_1"))throw new Error("Conic projections require +lat_1");if(Math.abs(e.lat1+e.lat2)<1e-10||Math.abs(e.lat1)>=Math.PI/2||Math.abs(e.lat2)>=Math.PI/2)throw new Error("Conic standard parallels must not be opposite or at a pole")}function Xe(e,t,r,n,i=qn){let o=(s,a)=>{let c=s(t,a);if(!c||typeof c!="object"||!Number.isFinite(c.x)||!Number.isFinite(c.y))throw new Error(e+": coordinate outside projection domain or inverse did not converge");a.x=c.x,a.y=c.y};return i(s=>o(r,s),s=>o(n,s))}function Yo(e,t){let r=oo(t,!1);return qn(n=>{let i=n.x,o=n.y,s=Math.atan2(Math.sin(i-e.long0),Math.cos(i-e.long0)),a=Math.abs(Math.abs(e.lat0)-Math.PI/2)<1e-10;if(Math.abs(o+e.lat0)<1e-10&&(a||Math.abs(Math.abs(s)-Math.PI)<1e-10))throw new Error("Azimuthal projection is undefined at the antipode");r(n)},oo(t,!0))}var ar,so,yn=w(()=>{ma();Ee();ar=["lon_0","lat_0","x_0","y_0"],so=["k","k_0"]});function oi(e,t){return{...qn(e,t),createForwardFlat(r){return this.forwardInPlace===e?tx(e,!1,r):void 0},createInverseFlat(r){return this.inverseInPlace===t?tx(t,!0,r):void 0}}}function tx(e,t,{inputScale:r,outputScale:n}){let i=new Ho;return(o,s)=>{let a=i.acquire();try{let c=o instanceof Float32Array;for(let l=0;l<o.length;l+=s){if(a.x=o[l],a.y=o[l+1],a.z=s>=3?o[l+2]:0,!Number.isFinite(a.x)||!Number.isFinite(a.y)||!Number.isFinite(a.z))throw new Error("Coordinates must contain finite x, y and optional z values");if(r!==1&&(a.x*=r,a.y*=r),t&&e(a),Math.abs(a.y)>Math.PI/2||!Number.isFinite(a.x)||!Number.isFinite(a.y))throw new Error("Coordinate is outside the geographic domain");if(a.x+=0,a.x-=0,t||e(a),n!==1&&(a.x/=n,a.y/=n),!Number.isFinite(a.x)||!Number.isFinite(a.y))throw new Error("Projection produced non-finite coordinates");if(c&&(Math.abs(a.x)>34028234663852886e22||Math.abs(a.y)>34028234663852886e22))throw new Error("Projected coordinate exceeds Float32 range");o[l]=a.x,o[l+1]=a.y}}finally{i.release(a)}}}var Dc=w(()=>{ma();td()});function pa(e){var t=Math.exp(e);return t=(t-1/t)/2,t}var ed=w(()=>{});function qe(e,t){e=Math.abs(e),t=Math.abs(t);var r=Math.max(e,t),n=Math.min(e,t)/(r||1);return r*Math.sqrt(1+Math.pow(n,2))}var ga=w(()=>{});function ex(e){var t=1+e,r=t-1;return r===0?e:e*Math.log(t)/r}var rx=w(()=>{});function nx(e){var t=Math.abs(e);return t=ex(t*(1+t/(qe(1,t)+1))),e<0?-t:t}var ix=w(()=>{ga();rx()});function rd(e,t){for(var r=2*Math.cos(2*t),n=e.length-1,i=e[n],o=0,s;--n>=0;)s=-o+r*i+e[n],o=i,i=s;return t+s*Math.sin(2*t)}var ox=w(()=>{});function sx(e,t){for(var r=2*Math.cos(t),n=e.length-1,i=e[n],o=0,s;--n>=0;)s=-o+r*i+e[n],o=i,i=s;return Math.sin(t)*s}var ax=w(()=>{});function _h(e){var t=Math.exp(e);return t=(t+1/t)/2,t}var Ug=w(()=>{});function Gg(e,t,r,n){for(var i=Math.sin(t),o=Math.cos(t),s=pa(r),a=_h(r),c=2*o*a,l=-2*i*s,h=e.length-1,u=e[h],f=0,d=0,m=0,p,g;--h>=0;)p=d,g=f,d=u,f=m,u=-p+c*d-l*f+e[h],m=-g+l*d+c*f;c=i*a,l=o*s,n.x=c*u-l*m,n.y=c*m+l*u}var cx=w(()=>{ed();Ug()});var U,$t,Ko,lx,zg,Vg,Mh,Ae=w(()=>{U=Math.PI/2,$t=Math.PI/4,Ko=Math.PI*2,lx=3.14159265359,zg=Math.PI/180,Vg=180/Math.PI,Mh=Math.PI/(180*3600)});function Xo(e){return e<0?-1:1}var bh=w(()=>{});function G(e,t){return t||Math.abs(e)<=lx?e:e-Xo(e)*Ko}var ue=w(()=>{Ae();bh()});function U8(e){e.x0=e.x0!==void 0?e.x0:0,e.y0=e.y0!==void 0?e.y0:0,e.long0=e.long0!==void 0?e.long0:0,e.lat0=e.lat0!==void 0?e.lat0:0,e.k0=e.k0!==void 0?e.k0:1,e.cgb=[],e.cbg=[],e.utg=[],e.gtu=[];var t=e.es/(1+Math.sqrt(1-e.es)),r=t/(2-t),n=r;e.cgb[0]=r*(2+r*(-2/3+r*(-2+r*(116/45+r*(26/45+r*(-2854/675)))))),e.cbg[0]=r*(-2+r*(2/3+r*(4/3+r*(-82/45+r*(32/45+r*(4642/4725)))))),n=n*r,e.cgb[1]=n*(7/3+r*(-8/5+r*(-227/45+r*(2704/315+r*(2323/945))))),e.cbg[1]=n*(5/3+r*(-16/15+r*(-13/9+r*(904/315+r*(-1522/945))))),n=n*r,e.cgb[2]=n*(56/15+r*(-136/35+r*(-1262/105+r*(73814/2835)))),e.cbg[2]=n*(-26/15+r*(34/21+r*(8/5+r*(-12686/2835)))),n=n*r,e.cgb[3]=n*(4279/630+r*(-332/35+r*(-399572/14175))),e.cbg[3]=n*(1237/630+r*(-12/5+r*(-24832/14175))),n=n*r,e.cgb[4]=n*(4174/315+r*(-144838/6237)),e.cbg[4]=n*(-734/315+r*(109598/31185)),n=n*r,e.cgb[5]=n*(601676/22275),e.cbg[5]=n*(444337/155925),n=Math.pow(r,2),e.Qn=e.k0/(1+r)*(1+n*(1/4+n*(1/64+n/256))),e.utg[0]=r*(-.5+r*(2/3+r*(-37/96+r*(1/360+r*(81/512+r*(-96199/604800)))))),e.gtu[0]=r*(.5+r*(-2/3+r*(5/16+r*(41/180+r*(-127/288+r*(7891/37800)))))),e.utg[1]=n*(-1/48+r*(-1/15+r*(437/1440+r*(-46/105+r*(1118711/3870720))))),e.gtu[1]=n*(13/48+r*(-3/5+r*(557/1440+r*(281/630+r*(-1983433/1935360))))),n=n*r,e.utg[2]=n*(-17/480+r*(37/840+r*(209/4480+r*(-5569/90720)))),e.gtu[2]=n*(61/240+r*(-103/140+r*(15061/26880+r*(167603/181440)))),n=n*r,e.utg[3]=n*(-4397/161280+r*(11/504+r*(830251/7257600))),e.gtu[3]=n*(49561/161280+r*(-179/168+r*(6601661/7257600))),n=n*r,e.utg[4]=n*(-4583/161280+r*(108847/3991680)),e.gtu[4]=n*(34729/80640+r*(-3418889/1995840)),n=n*r,e.utg[5]=n*(-20648693/638668800),e.gtu[5]=n*(212378941/319334400);var i=rd(e.cbg,e.lat0);e.Zb=-e.Qn*(i+sx(e.gtu,2*i))}function hx(e,t){var r=G(t.x-e.long0,e.over),n=t.y;n=rd(e.cbg,n);var i=Math.sin(n),o=Math.cos(n),s=Math.sin(r),a=Math.cos(r);n=Math.atan2(i,a*o),r=Math.atan2(s*o,qe(i,o*a)),r=nx(Math.tan(r)),Gg(e.gtu,2*n,2*r,t),n=n+t.x,r=r+t.y;var c,l;return Math.abs(r)<=2.623395162778?(c=e.a*(e.Qn*r)+e.x0,l=e.a*(e.Qn*n+e.Zb)+e.y0):(c=1/0,l=1/0),t.x=c,t.y=l,t}function ux(e,t){var r=(t.x-e.x0)*(1/e.a),n=(t.y-e.y0)*(1/e.a);n=(n-e.Zb)/e.Qn,r=r/e.Qn;var i,o;if(Math.abs(r)<=2.623395162778){Gg(e.utg,2*n,2*r,t),n=n+t.x,r=r+t.y,r=Math.atan(pa(r));var s=Math.sin(n),a=Math.cos(n),c=Math.sin(r),l=Math.cos(r);n=Math.atan2(s*l,qe(c,l*a)),r=Math.atan2(c,l*a),i=G(r+e.long0,e.over),o=rd(e.cgb,n)}else i=1/0,o=1/0;return t.x=i,t.y=o,t}function fx(e){let t={...e,cgb:[],cbg:[],utg:[],gtu:[],Qn:0,Zb:0};return U8(t),t}var dx=w(()=>{ed();ga();ix();ox();ax();cx();ue()});function Ri(e){var t=[];t[0]=G8-e*(z8+e*(mx+e*(px+e*gx))),t[1]=e*(V8-e*(mx+e*(px+e*gx)));var r=e*e;return t[2]=r*(k8-e*(q8+e*j8)),r*=e,t[3]=r*(W8-e*H8),t[4]=r*e*$8,t}var G8,z8,mx,px,gx,V8,k8,q8,j8,W8,H8,$8,Fc=w(()=>{G8=1,z8=.25,mx=.046875,px=.01953125,gx=.01068115234375,V8=.75,k8=.46875,q8=.013020833333333334,j8=.007120768229166667,W8=.3645833333333333,H8=.005696614583333333,$8=.3076171875});function rr(e,t,r,n){return r*=t,t*=t,n[0]*e-r*(n[1]+t*(n[2]+t*(n[3]+t*n[4])))}var ya=w(()=>{});function Ci(e,t,r){for(var n=1/(1-t),i=e,o=Y8;o;--o){var s=Math.sin(i),a=1-t*s*s;if(a=(rr(i,s,Math.cos(i),r)-e)*(a*Math.sqrt(a))*n,i-=a,Math.abs(a)<1e-10)return i}return i}var Y8,Uc=w(()=>{ya();Y8=20});function K8(e){e.x0=e.x0!==void 0?e.x0:0,e.y0=e.y0!==void 0?e.y0:0,e.long0=e.long0!==void 0?e.long0:0,e.lat0=e.lat0!==void 0?e.lat0:0,e.es&&(e.en=Ri(e.es),e.ml0=rr(e.lat0,Math.sin(e.lat0),Math.cos(e.lat0),e.en))}function yx(e,t){var r=t.x,n=t.y,i=G(r-e.long0,e.over),o,s,a,c=Math.sin(n),l=Math.cos(n);if(e.es){var u=l*i,f=Math.pow(u,2),d=e.ep2*Math.pow(l,2),m=Math.pow(d,2),p=Math.abs(l)>1e-10?Math.tan(n):0,g=Math.pow(p,2),y=Math.pow(g,2);o=1-e.es*Math.pow(c,2),u=u/Math.sqrt(o);var _=rr(n,c,l,e.en);s=e.a*(e.k0*u*(1+f/6*(1-g+d+f/20*(5-18*g+y+14*d-58*g*d+f/42*(61+179*y-y*g-479*g)))))+e.x0,a=e.a*(e.k0*(_-e.ml0+c*i*u/2*(1+f/12*(5-g+9*d+4*m+f/30*(61+y-58*g+270*d-330*g*d+f/56*(1385+543*y-y*g-3111*g))))))+e.y0}else{var h=l*Math.sin(i);if(Math.abs(Math.abs(h)-1)<1e-10)return 93;if(s=.5*e.a*e.k0*Math.log((1+h)/(1-h))+e.x0,a=l*Math.cos(i)/Math.sqrt(1-Math.pow(h,2)),h=Math.abs(a),h>=1){if(h-1>1e-10)return 93;a=0}else a=Math.acos(a);n<0&&(a=-a),a=e.a*e.k0*(a-e.lat0)+e.y0}return t.x=s,t.y=a,t}function wx(e,t){var r,n,i,o,s=(t.x-e.x0)*(1/e.a),a=(t.y-e.y0)*(1/e.a);if(e.es)if(r=e.ml0+a/e.k0,n=Ci(r,e.es,e.en),Math.abs(n)<U){var f=Math.sin(n),d=Math.cos(n),m=Math.abs(d)>1e-10?Math.tan(n):0,p=e.ep2*Math.pow(d,2),g=Math.pow(p,2),y=Math.pow(m,2),_=Math.pow(y,2);r=1-e.es*Math.pow(f,2);var M=s*Math.sqrt(r)/e.k0,b=Math.pow(M,2);r=r*m,i=n-r*b/(1-e.es)*.5*(1-b/12*(5+3*y-9*p*y+p-4*g-b/30*(61+90*y-252*p*y+45*_+46*p-b/56*(1385+3633*y+4095*_+1574*_*y)))),o=G(e.long0+M*(1-b/6*(1+2*y+p-b/20*(5+28*y+24*_+8*p*y+6*p-b/42*(61+662*y+1320*_+720*_*y))))/d,e.over)}else i=U*Xo(a),o=0;else{var c=Math.exp(s/e.k0),l=.5*(c-1/c),h=e.lat0+a/e.k0,u=Math.cos(h);r=Math.sqrt((1-Math.pow(u,2))/(1+Math.pow(l,2))),i=Math.asin(r),Math.sin(h)<0&&(i=-i),l===0&&u===0?o=0:o=G(Math.atan2(l,u)+e.long0,e.over)}return t.x=o,t.y=i,t}function _x(e){let t={...e,en:[],ml0:0};return K8(t),t}var Mx=w(()=>{Fc();ya();Uc();ue();Ae();bh()});function nd(e){let t=er(e),r=n=>Pt(n,K(t.long0-Math.PI/6,-Math.PI/2,t.long0+Math.PI/6,Math.PI/2),i=>Oc(n.forward,i,t.long0,t.over),t.primeMeridian,t.over);if(ii(e.parameters,"approx"))return r({...Xe("tmerc +approx",_x(t),yx,wx,oi)});if(t.sphere)throw new Error("Spherical transverse Mercator requires +approx");return r({...Xe("etmerc",fx(t),hx,ux,oi)})}var kg,qg,jg=w(()=>{Dc();Ie();Ht();ne();yn();dx();Mx();kg={name:"tmerc",aliases:["Fast_Transverse_Mercator","Fast Transverse Mercator","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger"],parameters:[...ar,...so,"approx"],flags:["approx"],create:nd},qg={name:"etmerc",aliases:["Extended_Transverse_Mercator","Extended Transverse Mercator"],parameters:[...ar,...so,"approx"],flags:["approx"],create:nd}});var Wg,bx=w(()=>{Ie();Ht();ne();Ee();yn();jg();Wg={name:"utm",aliases:["Universal Transverse Mercator System"],parameters:["zone","south","approx"],flags:["south","approx"],create(e){let t=tt(e.parameters,"zone",NaN);if(!Number.isInteger(t)||t<1||t>60)throw new Error("UTM requires an integer +zone from 1 to 60");let r=ii(e.parameters,"south"),n=nd({...e,parameters:{...e.parameters,lat_0:"0",lon_0:String(6*t-183),x_0:"500000",y_0:r?"10000000":"0",k_0:"0.9996"}}),i=(6*t-183)*Math.PI/180;return Pt(n,K(i-Math.PI/60,r?-80*Math.PI/180:0,i+Math.PI/60,r?0:84*Math.PI/180),o=>Oc(n.forward,o,i),e.primeMeridian??0,Object.prototype.hasOwnProperty.call(e.parameters,"over"))}}});function $g(e,t){return[Math.cos(t)*Math.cos(e),Math.cos(t)*Math.sin(e),Math.sin(t)]}function id(e,t,r,n,i){let o=Math.hypot(e,t);if(!o||Math.abs(r)>o+1e-14)return[];let s=Math.atan2(t,e),a=Math.acos(Math.max(-1,Math.min(1,r/o))),c=[];for(let l of[s-a,s+a])for(let h=Math.ceil((n-l)/(2*Math.PI));h<=Math.floor((i-l)/(2*Math.PI));h++)c.push(l+h*2*Math.PI);return c}function Zo(e,t,r,n=!0){let[[i,o],[s,a]]=t,c=(i+s)/2,l=r?[Math.cos(r.latitude),0,Math.sin(r.latitude)]:[1,0,0],h=r?Math.cos(r.distance):-1,u=n?-1/0:1/0,f=[NaN,NaN],d=(p,g)=>{if(p=c+ve(p-c),p<i-1e-12||p>s+1e-12||g<o-1e-12||g>a+1e-12)return;let y=$g(p,g);if(r&&Hg(l,y)<h-1e-13)return;let _=Hg(e,y);(n?_>u:_<u)&&(u=_,f=[p,g])},m=[i,s,...id(-e[1],e[0],0,i,s)];for(let p of m){let g=e[0]*Math.cos(p)+e[1]*Math.sin(p);for(let y of[o,a,...id(e[2],-g,0,o,a)])d(p,y)}if(r){let[p,,g]=l;for(let b of[o,a])for(let v of id(p*Math.cos(b),0,h-g*Math.sin(b),i,s))d(v,b);for(let b of[i,s])for(let v of id(p*Math.cos(b),g,h,o,a))d(b,v);let y=Hg(e,l),_=e.map((b,v)=>b-y*l[v]),M=Math.hypot(..._);if(M<=1e-14&&(_=[-l[2],0,l[0]],M=1),M>1e-14)for(let b of[-1,1]){let v=l.map((T,S)=>T*h+b*_[S]*Math.sin(r.distance)/M);d(Math.atan2(v[1],v[0]),Math.atan2(v[2],Math.hypot(v[0],v[1])))}}if(!Number.isFinite(u))throw new Error("CRS coverage does not intersect the rendering domain");return{value:u,point:f}}function se(e,t,r){return[Zo(e,t,r,!1).value,Zo(e,t,r).value]}function Jo(e,t,r,n,i){let o=se(e,n,i),s=se(t,n,i).map(c=>c+r);if(s[0]<=0)throw new Error("Projection rendering denominator is not positive");let a=o.flatMap(c=>s.map(l=>c/l));return[!1,!0].map(c=>{let l=Math.min(...a),h=Math.max(...a);for(let u=0;u<60;u++){let f=(l+h)/2,d=e.map((p,g)=>p-f*t[g]);Zo(d,n,i,c).value-f*r>0?l=f:h=f}return c?h:l})}var Hg,wa=w(()=>{Ee();Hg=(e,t)=>e[0]*t[0]+e[1]*t[1]+e[2]*t[2]});function X8(e,t,r,n=Math.PI){let i=[-180,-90,180,90],o=(s,a)=>{let c=jo(s,e.primeMeridian,e.long0),l=K(c[0][0]-e.long0,c[0][1],c[1][0]-e.long0,c[1][1]),h=[Math.cos(e.lat0),0,Math.sin(e.lat0)],u=a?Zo(h,l,void 0,!1).value:-1,d=!a||u<=Math.cos(n)+1e-13?{latitude:e.lat0,distance:t}:void 0,m=Ke(()=>r(l,d),s,e.long0,e.primeMeridian),p=Math.abs(Math.cos(e.lat0))<1e-12,g=(Math.PI/2-t)*180/Math.PI,y=d&&!p&&Wo(_=>{let M=$g(_.x-e.long0,_.y);if(M[0]*Math.cos(e.lat0)+M[2]*Math.sin(e.lat0)>=Math.cos(d.distance)-1e-14)return;if(Math.hypot(M[0]+h[0],M[1],M[2]+h[2])<1e-12){let v=e.lat0+d.distance,T=(l[0][0]+l[1][0])/2,S=T+ve((Math.cos(v)<0?Math.PI:0)-T),E=Math.atan2(Math.sin(v),Math.abs(Math.cos(v)));if(S>=l[0][0]&&S<=l[1][0]&&E>=l[0][1]&&E<=l[1][1]){_.x=S+e.long0,_.y=E;return}}let b=Zo(M,l,d);[_.x,_.y]=[b.point[0]+e.long0,b.point[1]]},e.primeMeridian);return{get bounds(){return r(l,d)},normalize(_){m.normalize(_),d&&p?_.y=e.lat0>0?Math.max(g,_.y):Math.min(-g,_.y):y?.(_);let M=(e.long0+e.primeMeridian)*180/Math.PI,b=_.x-M;Math.abs(b)>180&&(_.x=M+ni(b))}}};return s=>o(s??i,!!s)}function rn(e,t,r,n,i=Math.PI){return{...e,longitudeOrigin:t.long0,getRenderingProfile:X8(t,r,n,i)}}var Qo=w(()=>{Ht();ne();wa();Ee();da()});function od(e,t,r,n){let i=[-Math.sin(e.lat0),0,Math.cos(e.lat0)],o=[Math.cos(e.lat0),0,Math.sin(e.lat0)],s=[0,1,0],a=n==="stere"?1:0,c=h=>n==="ortho"?se(h,t,r):Jo(h,o,a,t,r),l=e.a*(n==="stere"?2*e.k0:1);return re(At([e.x0,e.x0],Ct(c(s),l)),At([e.y0,e.y0],Ct(c(i),l)))}function xx(e,t,r){let n=Math.sin(e.lat0),i=Math.cos(e.lat0),o=se([0,0,1],t,r);if(Math.abs(n)<1e-15&&(!r||Math.abs(r.distance-Math.PI/2)<1e-15)){let u=d=>{let m=Zo([0,1,0],t,r,d);return m.value/Math.sqrt(1-e.es*Math.sin(m.point[1])**2)},f=d=>(1-e.es)*d/Math.sqrt(1-e.es*d*d);return re(At([e.x0,e.x0],Ct([u(!1),u(!0)],e.a*e.k0)),At([e.y0,e.y0],Ct([f(o[0]),f(o[1])],e.a*e.k0)))}let s=o[0]<=0&&o[1]>=0?0:Math.min(o[0]**2,o[1]**2),a=Math.max(o[0]**2,o[1]**2),c=kn(1/Math.sqrt(1-e.es*s),1/Math.sqrt(1-e.es*a)),l=e.a*e.k0,h=e.es*n*i/Math.sqrt(1-e.es*n*n);return re(At([e.x0,e.x0],Ct(Te(se([0,1,0],t,r),c),l)),At([e.y0+l*h,e.y0+l*h],Ct(Te(se([-n,0,(1-e.es)*i],t,r),c),l)))}function Sx(e,t,r){let n=se([Math.cos(e.lat0),0,Math.sin(e.lat0)],t,r)[0],i=e.a/Math.sqrt(1-e.es)*Math.acos(Math.max(-1,Math.min(1,n)));return re([e.x0-i,e.x0+i],[e.y0-i,e.y0+i])}function vx(e,t,r,n,i,o,s){let a=i&&se([0,0,1],n,i),c=K(n[0][0],s(a?Math.asin(Math.max(-1,a[0])):n[0][1]),n[1][0],s(a?Math.asin(Math.min(1,a[1])):n[1][1])),l=i&&{latitude:o,distance:Math.PI-(1-e.es)**2*(Math.PI-i.distance)},h=[Math.cos(o),0,Math.sin(o)],u=[-Math.sin(o),0,Math.cos(o)],f=se(h,c,l),d=[Math.sqrt(2/(1+Math.min(1,f[1]))),f[0]>-1+1e-14?Math.sqrt(2/(1+f[0])):1/0],m=(p,g)=>{let y=se(p,c,l),_=y[0]===0?0:y[0]*(y[0]<0?d[1]:d[0]),M=y[1]===0?0:y[1]*(y[1]>0?d[1]:d[0]);return Ct([Math.max(-2,_),Math.min(2,M)],e.a*g)};return re(At([e.x0,e.x0],m([0,1,0],t)),At([e.y0,e.y0],m(u,r)))}function sd(e,t,r,n,i,o,s=1,a=e.e*Math.atanh(e.e)){let c=K(i[0][0]*s,t(i[0][1]),i[1][0]*s,t(i[1][1])),l=2*a+Math.PI*Math.abs(s-1),h=o&&s===1?Math.min(o.distance+l,Math.PI-(1-e.es)*(Math.PI-o.distance)):o&&o.distance+l,u=h&&h<Math.PI?{latitude:r,distance:h}:void 0,f=[Math.cos(r),0,Math.sin(r)],d=[-Math.sin(r),0,Math.cos(r)],p=c[1][0]-c[0][0]>=2*Math.PI?K(-Math.PI,c[0][1],Math.PI,c[1][1]):c,g=Jo([0,1,0],f,1,p,u),y=Jo(d,f,1,p,u);return re(At([e.x0,e.x0],Ct(g,n)),At([e.y0,e.y0],Ct(y,n)))}function Ex(e,t,r,n,i,o){let s=[Math.cos(e.lat0),0,Math.sin(e.lat0)],a=[-Math.sin(e.lat0),0,Math.cos(e.lat0)],c=[0,1,0],l=Math.cos(n),h=Math.sin(n),u=Math.cos(r),f=Math.sin(r),d=a.map((_,M)=>l*_+h*c[M]),m=c.map((_,M)=>l*_-h*a[M]),p=s.map((_,M)=>-u*_+f*d[M]),g=Jo(m,p,u*t,i,o),y=Jo(d,p,u*t,i,o);return re(At([e.x0,e.x0],Ct(g,e.a*(t-1)*u)),At([e.y0,e.y0],Ct(y,e.a*(t-1))))}function Tx(e,t,r){let n=se([Math.cos(e.lat0),0,Math.sin(e.lat0)],t,r)[0],i=Math.acos(Math.max(-1,Math.min(1,n))),o=1-e.es,s=e.a*i/Math.sqrt(o),a=Math.cos(i/o);if(!(a>0))throw new Error("Gnomonic rendering coverage approaches its ellipsoidal horizon");let c=s/a;return re([e.x0-c,e.x0+c],[e.y0-c,e.y0+c])}var ts=w(()=>{Ht();wa();Ie()});function si(e,t,r,n,i,o,s){let a=i*r/s,c=n*t-o*r*e/s,l=n*e+o*r*t/s;return Math.atan2(l,Math.hypot(a,c))}var xh=w(()=>{});function nn(e,t,r){var n=e*t;return r/Math.sqrt(1-n*n)}var Gc=w(()=>{});function Lr(e,t,r){let n=Math.cos(t);return Math.exp(e*Math.atanh(e*r))*(r>0?n/(1+r):(1-r)/n)}var Sh=w(()=>{});function _a(e,t){for(var r=.5*e,n,i,o=U-2*Math.atan(t),s=0;s<=15;s++)if(n=e*Math.sin(o),i=U-2*Math.atan(t*Math.pow((1-n)/(1+n),r))-o,o+=i,Math.abs(i)<=1e-10)return o;return-9999}var ad=w(()=>{Ae()});function Ix(e,t,r){return t*=r,Math.tan(.5*(U+e))*Math.pow((1-t)/(1+t),.5*r)}function Z8(e){e.x0=e.x0||0,e.y0=e.y0||0,e.lat0=e.lat0||0,e.long0=e.long0||0,e.coslat0=Math.cos(e.lat0),e.sinlat0=Math.sin(e.lat0),e.sphere?!Number.isNaN(e.lat_ts)&&Math.abs(e.coslat0)<=1e-10&&(e.k0=.5*(1+Xo(e.lat0)*Math.sin(e.lat_ts))):(Math.abs(e.coslat0)<=1e-10&&(e.lat0>0?e.con=1:e.con=-1),e.cons=Math.sqrt(Math.pow(1+e.e,1+e.e)*Math.pow(1-e.e,1-e.e)),!Number.isNaN(e.lat_ts)&&Math.abs(e.coslat0)<=1e-10&&Math.abs(Math.cos(e.lat_ts))>1e-10&&(e.k0=.5*e.cons*nn(e.e,Math.sin(e.lat_ts),Math.cos(e.lat_ts))/Lr(e.e,e.con*e.lat_ts,e.con*Math.sin(e.lat_ts))),e.ms1=nn(e.e,e.sinlat0,e.coslat0),e.X0=2*Math.atan(Ix(e.lat0,e.sinlat0,e.e))-U,e.cosX0=Math.cos(e.X0),e.sinX0=Math.sin(e.X0))}function Ax(e,t){var r=t.x,n=t.y,i=Math.sin(n),o=Math.cos(n),s,a,c,l,h,u,f=G(r-e.long0,e.over);if(Math.abs(Math.abs(r-e.long0)-Math.PI)<=1e-10&&Math.abs(n+e.lat0)<=1e-10)return t.x=NaN,t.y=NaN,t;if(e.sphere&&Math.abs(e.coslat0)<=1e-10){let d=e.lat0>0?1:-1,m=2*e.a*e.k0*Math.tan(Math.PI/4-d*n/2);return t.x=e.x0+m*Math.sin(f),t.y=e.y0-d*m*Math.cos(f),t}return e.sphere?(s=2*e.k0/(1+e.sinlat0*i+e.coslat0*o*Math.cos(f)),t.x=e.a*s*o*Math.sin(f)+e.x0,t.y=e.a*s*(e.coslat0*i-e.sinlat0*o*Math.cos(f))+e.y0,t):(a=2*Math.atan(Ix(n,i,e.e))-U,l=Math.cos(a),c=Math.sin(a),Math.abs(e.coslat0)<=1e-10?(h=Lr(e.e,n*e.con,e.con*i),u=2*e.a*e.k0*h/e.cons,t.x=e.x0+u*Math.sin(r-e.long0),t.y=e.y0-e.con*u*Math.cos(r-e.long0),t):(Math.abs(e.sinlat0)<1e-10?(s=2*e.a*e.k0/(1+l*Math.cos(f)),t.y=s*c+e.y0):(s=2*e.a*e.k0*e.ms1/(e.cosX0*(1+e.sinX0*c+e.cosX0*l*Math.cos(f))),t.y=s*(e.cosX0*c-e.sinX0*l*Math.cos(f))+e.y0),t.x=s*l*Math.sin(f)+e.x0,t))}function Px(e,t){t.x-=e.x0,t.y-=e.y0;var r,n,i,o,s,a=Math.sqrt(t.x*t.x+t.y*t.y);if(e.sphere){var c=2*Math.atan(a/(2*e.a*e.k0));return r=e.long0,n=e.lat0,a<=1e-10?(t.x=r,t.y=n,t):(n=si(e.sinlat0,e.coslat0,Math.sin(c),Math.cos(c),t.x,t.y,a),Math.abs(e.coslat0)<1e-10?e.lat0>0?r=G(e.long0+Math.atan2(t.x,-1*t.y),e.over):r=G(e.long0+Math.atan2(t.x,t.y),e.over):r=G(e.long0+Math.atan2(t.x*Math.sin(c),a*e.coslat0*Math.cos(c)-t.y*e.sinlat0*Math.sin(c)),e.over),t.x=r,t.y=n,t)}else if(Math.abs(e.coslat0)<=1e-10){if(a<=1e-10)return n=e.lat0,r=e.long0,t.x=r,t.y=n,t;t.x*=e.con,t.y*=e.con,i=a*e.cons/(2*e.a*e.k0),n=e.con*_a(e.e,i),r=e.con*G(e.con*e.long0+Math.atan2(t.x,-1*t.y),e.over)}else o=2*Math.atan(a*e.cosX0/(2*e.a*e.k0*e.ms1)),r=e.long0,a<=1e-10?s=e.X0:(s=si(e.sinX0,e.cosX0,Math.sin(o),Math.cos(o),t.x,t.y,a),r=G(e.long0+Math.atan2(t.x*Math.sin(o),a*e.cosX0*Math.cos(o)-t.y*e.sinX0*Math.sin(o)),e.over)),n=-1*_a(e.e,Math.tan(.5*(U+s)));return t.x=r,t.y=n,t}function Rx(e){let t={...e,coslat0:0,sinlat0:0,con:0,cons:0,ms1:0,X0:0,cosX0:0,sinX0:0};return Z8(t),t}var Cx=w(()=>{xh();Ae();bh();Gc();Sh();ad();ue()});var Yg,Nx=w(()=>{Qo();ts();yn();Cx();Yg={name:"stere",aliases:["Stereographic_South_Pole","Polar_Stereographic_variant_A","Polar_Stereographic_variant_B","Polar_Stereographic"],parameters:[...ar,...so,"lat_ts"],create(e){let t=er(e),r=Rx(t),n=Yo(t,Xe("stere",r,Ax,Px));return rn(n,t,150*Math.PI/180,(i,o)=>r.sphere?od(r,i,o,"stere"):sd(r,s=>2*Math.atan(Math.tan(Math.PI/4+s/2)*Math.pow((1-r.e*Math.sin(s))/(1+r.e*Math.sin(s)),r.e/2))-Math.PI/2,r.X0,2*r.a*r.k0*(Math.abs(r.coslat0)<1e-10?1/r.cons:r.ms1/r.cosX0),i,o))}}});var Dr=w(()=>{Ab();Fb();Ub()});function vh(){let e;if(typeof window<"u"&&window.performance)e=window.performance.now();else if(typeof process<"u"&&process.hrtime){let t=process.hrtime();e=t[0]*1e3+t[1]/1e6}else e=Date.now();return e}var Kg=w(()=>{});var Ma,Xg=w(()=>{Kg();Ma=class{constructor(t,r){this.sampleSize=1,this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this.name=t,this.type=r,this.reset()}reset(){return this.time=0,this.count=0,this.samples=0,this.lastTiming=0,this.lastSampleTime=0,this.lastSampleCount=0,this._count=0,this._time=0,this._samples=0,this._startTime=0,this._timerPending=!1,this}setSampleSize(t){return this.sampleSize=t,this}incrementCount(){return this.addCount(1),this}decrementCount(){return this.subtractCount(1),this}addCount(t){return this._count+=t,this._samples++,this._checkSampling(),this}subtractCount(t){return this._count-=t,this._samples++,this._checkSampling(),this}addTime(t){return this._time+=t,this.lastTiming=t,this._samples++,this._checkSampling(),this}timeStart(){return this._startTime=vh(),this._timerPending=!0,this}timeEnd(){return this._timerPending?(this.addTime(vh()-this._startTime),this._timerPending=!1,this._checkSampling(),this):this}getSampleAverageCount(){return this.sampleSize>0?this.lastSampleCount/this.sampleSize:0}getSampleAverageTime(){return this.sampleSize>0?this.lastSampleTime/this.sampleSize:0}getSampleHz(){return this.lastSampleTime>0?this.sampleSize/(this.lastSampleTime/1e3):0}getAverageCount(){return this.samples>0?this.count/this.samples:0}getAverageTime(){return this.samples>0?this.time/this.samples:0}getHz(){return this.time>0?this.samples/(this.time/1e3):0}_checkSampling(){this._samples===this.sampleSize&&(this.lastSampleTime=this._time,this.lastSampleCount=this._count,this.count+=this._count,this.time+=this._time,this.samples+=this._samples,this._time=0,this._count=0,this._samples=0)}}});var Ni,Ox=w(()=>{Xg();Ni=class{constructor(t){this.stats={},this.id=t.id,this.stats={},this._initializeStats(t.stats),Object.seal(this)}get(t,r="count"){return this._getOrCreate({name:t,type:r})}get size(){return Object.keys(this.stats).length}reset(){for(let t of Object.values(this.stats))t.reset();return this}forEach(t){for(let r of Object.values(this.stats))t(r)}getTable(){let t={};return this.forEach(r=>{t[r.name]={time:r.time||0,count:r.count||0,average:r.getAverageTime()||0,hz:r.getHz()||0}}),t}_initializeStats(t=[]){t.forEach(r=>this._getOrCreate(r))}_getOrCreate(t){let{name:r,type:n}=t,i=this.stats[r];return i||(t instanceof Ma?i=t:i=new Ma(r,n),this.stats[r]=i),i}}});var cd=w(()=>{Ox();Xg();Kg()});function ai(e,t){if(!e)throw new Error(t||"loader assertion failed.")}var Bx=w(()=>{"use strict"});var Eh,J8,ld,Q8,tC,Zg=w(()=>{Eh=globalThis,J8=globalThis.document||{},ld=globalThis.process||{},Q8=globalThis.console,tC=globalThis.navigator||{}});function hd(e){if(typeof window<"u"&&window.process?.type==="renderer"||typeof process<"u"&&process.versions?.electron)return!0;let t=typeof navigator<"u"&&navigator.userAgent,r=e||t;return!!(r&&r.indexOf("Electron")>=0)}var ud=w(()=>{});function es(){return!(typeof process=="object"&&String(process)==="[object process]"&&!process?.browser)||hd()}var Jg=w(()=>{ud()});var Lx=w(()=>{Jg();ud();Zg()});var Dx=w(()=>{});var Qg,fd=w(()=>{Zg();Jg();Lx();ud();Dx();Qg="5.0.0"});function zc(e,t){if(!e)throw new Error(t||"Assertion failed")}var t1=w(()=>{});function dd(e){if(!e)return 0;let t;switch(typeof e){case"number":t=e;break;case"object":t=e.logLevel||e.priority||0;break;default:return 0}return zc(Number.isFinite(t)&&t>=0),t}function e1(e){let{logLevel:t,message:r}=e;e.logLevel=dd(t);let n=e.args?Array.from(e.args):[];for(;n.length&&n.shift()!==r;);switch(typeof t){case"string":case"function":r!==void 0&&n.unshift(r),e.message=t;break;case"object":Object.assign(e,t);break;default:}typeof e.message=="function"&&(e.message=e.message());let i=typeof e.message;return zc(i==="string"||i==="object"),Object.assign(e,{args:n},e.opts)}var md=w(()=>{t1()});var rs,ba,Th=w(()=>{md();rs=()=>{},ba=class{constructor({level:t=0}={}){this.userData={},this._onceCache=new Set,this._level=t}set level(t){this.setLevel(t)}get level(){return this.getLevel()}setLevel(t){return this._level=t,this}getLevel(){return this._level}warn(t,...r){return this._log("warn",0,t,r,{once:!0})}error(t,...r){return this._log("error",0,t,r)}log(t,r,...n){return this._log("log",t,r,n)}info(t,r,...n){return this._log("info",t,r,n)}once(t,r,...n){return this._log("once",t,r,n,{once:!0})}_log(t,r,n,i,o={}){let s=e1({logLevel:r,message:n,args:this._buildArgs(r,n,i),opts:o});return this._createLogFunction(t,s,o)}_buildArgs(t,r,n){return[t,r,...n]}_createLogFunction(t,r,n){if(!this._shouldLog(r.logLevel))return rs;let i=this._getOnceTag(n.tag??r.tag??r.message);if((n.once||r.once)&&i!==void 0){if(this._onceCache.has(i))return rs;this._onceCache.add(i)}return this._emit(t,r)}_shouldLog(t){return this.getLevel()>=dd(t)}_getOnceTag(t){if(t!==void 0)try{return typeof t=="string"?t:String(t)}catch{return}}}});function rC(e){try{let t=window[e],r="__storage_test__";return t.setItem(r,r),t.removeItem(r),t}catch{return null}}var Ih,r1=w(()=>{Ih=class{constructor(t,r,n="sessionStorage"){this.storage=rC(n),this.id=t,this.config=r,this._loadConfiguration()}getConfiguration(){return this.config}setConfiguration(t){if(Object.assign(this.config,t),this.storage){let r=JSON.stringify(this.config);this.storage.setItem(this.id,r)}}_loadConfiguration(){let t={};if(this.storage){let r=this.storage.getItem(this.id);t=r?JSON.parse(r):{}}return Object.assign(this.config,t),this}}});function Fx(e){let t;return e<10?t=`${e.toFixed(2)}ms`:e<100?t=`${e.toFixed(1)}ms`:e<1e3?t=`${e.toFixed(0)}ms`:t=`${(e/1e3).toFixed(2)}s`,t}function n1(e,t=8){let r=Math.max(t-e.length,0);return`${" ".repeat(r)}${e}`}var i1=w(()=>{});function Ux(e){return typeof e!="string"?e:(e=e.toUpperCase(),Ah[e]||Ah.WHITE)}function o1(e,t,r){return!es&&typeof e=="string"&&(t&&(e=`\x1B[${Ux(t)}m${e}\x1B[39m`),r&&(e=`\x1B[${Ux(r)+nC}m${e}\x1B[49m`)),e}var Ah,nC,pd=w(()=>{fd();(function(e){e[e.BLACK=30]="BLACK",e[e.RED=31]="RED",e[e.GREEN=32]="GREEN",e[e.YELLOW=33]="YELLOW",e[e.BLUE=34]="BLUE",e[e.MAGENTA=35]="MAGENTA",e[e.CYAN=36]="CYAN",e[e.WHITE=37]="WHITE",e[e.BRIGHT_BLACK=90]="BRIGHT_BLACK",e[e.BRIGHT_RED=91]="BRIGHT_RED",e[e.BRIGHT_GREEN=92]="BRIGHT_GREEN",e[e.BRIGHT_YELLOW=93]="BRIGHT_YELLOW",e[e.BRIGHT_BLUE=94]="BRIGHT_BLUE",e[e.BRIGHT_MAGENTA=95]="BRIGHT_MAGENTA",e[e.BRIGHT_CYAN=96]="BRIGHT_CYAN",e[e.BRIGHT_WHITE=97]="BRIGHT_WHITE"})(Ah||(Ah={}));nC=10});function s1(e,t=["constructor"]){let r=Object.getPrototypeOf(e),n=Object.getOwnPropertyNames(r),i=e;for(let o of n){let s=i[o];typeof s=="function"&&(t.find(a=>o===a)||(i[o]=s.bind(e)))}}var a1=w(()=>{});var gd,jn,Ph=w(()=>{fd();gd=class{getHighResolutionTimer(){let t;if(es()&&Eh.performance)t=Eh?.performance?.now?.();else if("hrtime"in ld){let r=ld?.hrtime?.();t=r[0]*1e3+r[1]/1e6}else t=Date.now();return t}getMemoryUsageMB(){let r=Eh?.performance?.memory?.usedJSHeapSize;return r==null?null:Math.trunc(r/1024/1024)}},jn=new gd;globalThis.Probe=gd;globalThis.probe=jn});function iC(e,t,r){if(typeof t=="string"){let n=r.time?n1(Fx(r.total)):"";t=r.time?`${e}: ${n} ${t}`:`${e}: ${t}`,t=o1(t,r.color,r.background)}return t}function oC(e){for(let t in e)for(let r in e[t])return r||"untitled";return"empty"}var Vc,c1,ao,l1=w(()=>{fd();Th();r1();i1();pd();a1();t1();Ph();md();md();Vc={debug:es()&&console.debug||console.log,log:console.log,info:console.info,warn:console.warn,error:console.error},c1={enabled:!0,level:0},ao=class extends ba{constructor({id:t}={id:""}){super({level:0}),this.VERSION=Qg,this._startTs=jn.getHighResolutionTimer(),this._deltaTs=jn.getHighResolutionTimer(),this.userData={},this.LOG_THROTTLE_TIMEOUT=0,this.id=t,this.userData={},this._storage=new Ih(`__probe-${this.id}__`,{[this.id]:c1}),this.timeStamp(`${this.id} started`),s1(this),Object.seal(this)}isEnabled(){return this._getConfiguration().enabled}getLevel(){return this._getConfiguration().level}getTotal(){return Number((jn.getHighResolutionTimer()-this._startTs).toPrecision(10))}getDelta(){return Number((jn.getHighResolutionTimer()-this._deltaTs).toPrecision(10))}set priority(t){this.level=t}get priority(){return this.level}getPriority(){return this.level}enable(t=!0){return this._updateConfiguration({enabled:t}),this}setLevel(t){return this._updateConfiguration({level:t}),this}get(t){return this._getConfiguration()[t]}set(t,r){this._updateConfiguration({[t]:r})}settings(){console.table?console.table(this._storage.config):console.log(this._storage.config)}assert(t,r){if(!t)throw new Error(r||"Assertion failed")}warn(t,...r){return this._log("warn",0,t,r,{method:Vc.warn,once:!0})}error(t,...r){return this._log("error",0,t,r,{method:Vc.error})}deprecated(t,r){return this.warn(`\`${t}\` is deprecated and will be removed in a later version. Use \`${r}\` instead`)}removed(t,r){return this.error(`\`${t}\` has been removed. Use \`${r}\` instead`)}probe(t,r,...n){let i=jn.getMemoryUsageMB();if(i!==null){let o=`${i}MB `;typeof r=="function"?r=()=>`${o}${r()}`:typeof r=="string"&&(r=`${o}${r}`)}return this._log("log",t,r,n,{method:Vc.log,time:!0,once:!0})}log(t,r,...n){return this._log("log",t,r,n,{method:Vc.debug})}info(t,r,...n){return this._log("info",t,r,n,{method:console.info})}once(t,r,...n){return this._log("once",t,r,n,{method:Vc.debug||Vc.info,once:!0})}table(t,r,n){return r?this._log("table",t,r,n&&[n]||[],{method:console.table||rs,tag:oC(r)}):rs}time(t,r){return this._log("time",t,r,[],{method:console.time?console.time:console.info})}timeEnd(t,r){return this._log("time",t,r,[],{method:console.timeEnd?console.timeEnd:console.info})}timeStamp(t,r){return this._log("time",t,r,[],{method:console.timeStamp||rs})}group(t,r,n={collapsed:!1}){let i=(n.collapsed?console.groupCollapsed:console.group)||console.info;return this._log("group",t,r,[],{method:i})}groupCollapsed(t,r,n={}){return this.group(t,r,Object.assign({},n,{collapsed:!0}))}groupEnd(t){return this._log("groupEnd",t,"",[],{method:console.groupEnd||rs})}withGroup(t,r,n){this.group(t,r)();try{n()}finally{this.groupEnd(t)()}}trace(){console.trace&&console.trace()}_shouldLog(t){return this.isEnabled()&&super._shouldLog(t)}_emit(t,r){let n=r.method;zc(n),r.total=this.getTotal(),r.delta=this.getDelta(),this._deltaTs=jn.getHighResolutionTimer();let i=iC(this.id,r.message,r);return n.bind(console,i,...r.args)}_getConfiguration(){return this._storage.config[this.id]||this._updateConfiguration(c1),this._storage.config[this.id]}_updateConfiguration(t){let r=this._storage.config[this.id]||{...c1};this._storage.setConfiguration({[this.id]:{...r,...t}})}};ao.VERSION=Qg});var Gx=w(()=>{Th()});var zx=w(()=>{Th()});var Vx=w(()=>{Ph()});var kx=w(()=>{Ph();globalThis.probe||(globalThis.probe=jn)});var oV,qx=w(()=>{l1();Ph();l1();Gx();Th();zx();pd();pd();i1();a1();r1();Vx();kx();oV=new ao({id:"@probe.gl/log"})});function aC(){let e=new ao({id:"loaders.gl"});return globalThis.loaders||={},globalThis.loaders.log=e,globalThis.loaders.version=sC,globalThis.probe||={},globalThis.probe.loaders=e,e}var h1,sC,jx,Wx=w(()=>{"use strict";qx();h1="5.0.0-beta.6",sC=h1[0]>="0"&&h1[0]<="9"?`v${h1}`:"";jx=aC()});var cC,Hx,$x=w(()=>{"use strict";cC=e=>e!==null&&typeof e=="object",Hx=e=>cC(e)&&e.constructor==={}.constructor});function yd(e,t){return Yx(e||{},t)}function Yx(e,t,r=0){if(r>3)return t;let n={...e};for(let[i,o]of Object.entries(t))Hx(o)?n[i]=Yx(n[i]||{},t[i],r+1):n[i]=t[i];return n}var Kx=w(()=>{"use strict";$x()});function wd(e,t,r){let n=r!==void 0?new Uint8Array(e).subarray(t,t+r):new Uint8Array(e).subarray(t);return new Uint8Array(n).buffer}var Xx=w(()=>{"use strict"});var lC,hC,uC,fC,dC,mC,kc,Zx=w(()=>{"use strict";cd();lC="Queued Requests",hC="Active Requests",uC="Cancelled Requests",fC="Queued Requests Ever",dC="Active Requests Ever",mC={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0},kc=class{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...mC,...t},this.stats=new Ni({id:this.props.id}),this.stats.get(lC),this.stats.get(hC),this.stats.get(uC),this.stats.get(fC),this.stats.get(dC)}setProps(t){t.throttleRequests!==void 0&&(this.props.throttleRequests=t.throttleRequests),t.maxRequests!==void 0&&(this.props.maxRequests=t.maxRequests),t.debounceTime!==void 0&&(this.props.debounceTime=t.debounceTime)}scheduleRequest(t,r=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);let n={handle:t,priority:0,getPriority:r},i=new Promise(o=>(n.resolve=o,n));return this.requestQueue.push(n),this.requestMap.set(t,i),this._issueNewRequests(),i}_issueRequest(t){let{handle:r,resolve:n}=t,i=!1,o=()=>{i||(i=!0,this.requestMap.delete(r),this.activeRequestCount--,this.scheduleRefill())};return this.activeRequestCount++,n?n({done:o}):Promise.resolve({done:o})}scheduleRefill(){this.updateTimer===null&&(this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),0))}_issueNewRequests(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=setTimeout(()=>this._issueNewRequestsAsync(),this.props.debounceTime)}_issueNewRequestsAsync(){this.updateTimer!==null&&clearTimeout(this.updateTimer),this.updateTimer=null;let t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let r=0;r<t;++r){let n=this.requestQueue.shift();n&&this._issueRequest(n)}}}_updateAllRequests(){let t=this.requestQueue;for(let r=0;r<t.length;++r){let n=t[r];this._updateRequest(n)||(t.splice(r,1),this.requestMap.delete(n.handle),r--)}t.sort((r,n)=>r.priority-n.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}}});function f1(e,t=[]){return e.every(u1)?e:e.map((r,n)=>{if(u1(r))return r;let i=t.find(s=>s.type===r?.type);if(!i)throw new Error(`No authentication class registered for credential at index ${n}.`);let o;try{o=new i(r)}catch{throw new Error(`Invalid authentication configuration at index ${n}.`)}if(!u1(o))throw new Error(`Authentication class returned an invalid credential at index ${n}.`);return o})}function d1(e){if(!e.core?.credentials?.length)return e;let t=f1(e.core.credentials,e.core.authentications);return t===e.core.credentials?e:{...e,core:{...e.core,credentials:t}}}function u1(e){return!e||typeof e!="object"||typeof e.id!="string"||!Array.isArray(e.origins)?!1:e.type==="request"?typeof e.authenticate=="function":(e.type==="header"||e.type==="query-parameter")&&typeof e.name=="string"&&(typeof e.token=="string"||typeof e.token=="function")&&Array.isArray(e.refreshStatusCodes)}var m1=w(()=>{"use strict"});function p1(){let e=new Error("Request aborted");return e.name="AbortError",e}function Jx(e,t,r){let n=e??t;if(n<0||Number.isNaN(n))throw new Error(`${r} must be a non-negative number`);return n}function Qx(e){if(!Number.isFinite(e)||e<0)throw new Error("Request cache entry byte length must be a non-negative finite number");return e}var pC,gC,Rh,tS=w(()=>{"use strict";pC=Number.POSITIVE_INFINITY,gC=Number.POSITIVE_INFINITY,Rh=class{maxEntries;maxBytes;getByteLength;onRemove;entries=new Map;retainedByteLength=0;constructor(t={}){this.maxEntries=Jx(t.maxEntries,pC,"maxEntries"),this.maxBytes=Jx(t.maxBytes,gC,"maxBytes"),this.getByteLength=t.getByteLength||(()=>0),this.onRemove=t.onRemove}get size(){return this.entries.size}get pendingSize(){let t=0;for(let r of this.entries.values())t+=r.pending?1:0;return t}get byteLength(){return this.retainedByteLength}get(t,r){let n=this.entries.get(t);if(n)return this.touch(t,n),this.waitForEntry(t,n,r)}has(t){return this.entries.has(t)}set(t,r){this.removeEntry(t,"replace");let n=Qx(this.getByteLength(r)),i={promise:Promise.resolve(r),pending:!1,waiterCount:0,byteLength:n};return this.entries.set(t,i),this.retainedByteLength+=n,this.trim(),r}getOrLoad(t,r,n){let i=this.get(t,n);if(i)return i;if(n?.aborted)return Promise.reject(p1());let o=new AbortController,s,a,l={promise:new Promise((h,u)=>{s=h,a=u}),controller:o,pending:!0,waiterCount:0,byteLength:0};this.entries.set(t,l),l.promise.then(h=>this.handleLoadedValue(t,l,h),()=>this.handleLoadError(t,l));try{Promise.resolve(r(o.signal)).then(s,a)}catch(h){a(h)}return this.waitForEntry(t,l,n)}delete(t){return this.removeEntry(t,"delete")}clear(){for(let t of Array.from(this.entries.keys()))this.removeEntry(t,"clear")}handleLoadedValue(t,r,n){if(this.entries.get(t)===r){r.pending=!1,r.controller=void 0;try{r.byteLength=Qx(this.getByteLength(n))}catch{this.removeEntry(t,"error");return}this.retainedByteLength+=r.byteLength,this.trim()}}handleLoadError(t,r){this.entries.get(t)===r&&this.removeEntry(t,r.controller?.signal.aborted?"abort":"error")}waitForEntry(t,r,n){return n?.aborted?Promise.reject(p1()):r.pending?(r.waiterCount++,new Promise((i,o)=>{let s=!0,a=()=>{s&&(s=!1,n?.removeEventListener("abort",c),r.waiterCount--)},c=()=>{s&&(a(),o(p1()),r.pending&&r.waiterCount===0&&this.entries.get(t)===r&&this.removeEntry(t,"abort"))};n?.addEventListener("abort",c,{once:!0}),r.promise.then(l=>{s&&(a(),i(l))},l=>{s&&(a(),o(l))})})):r.promise}touch(t,r){this.entries.delete(t),this.entries.set(t,r)}trim(){let t=this.entries.size-this.pendingSize;if(!(t<=this.maxEntries&&this.retainedByteLength<=this.maxBytes)){for(let[r,n]of this.entries)if(n.pending||(this.removeEntry(r,"evict"),t--),t<=this.maxEntries&&this.retainedByteLength<=this.maxBytes)break}}removeEntry(t,r){let n=this.entries.get(t);return n?(this.entries.delete(t),this.retainedByteLength-=n.byteLength,n.pending&&n.controller?.abort(),this.onRemove?.(t,r),!0):!1}}});function yC(e){let t=e.fetch||((u,f)=>fetch(u,f)),r=t[eS],n=new Map(r?.credentialResolutions),i=f1(e.credentials.map(u=>n.get(u)||u),e.authentications);if(e.credentials.forEach((u,f)=>{n.set(u,i[f])}),!e.fetchOptions&&(!i.length||r?.credentials.length===i.length&&i.every((u,f)=>u===r.credentials[f])))return t;let o=r?.fetch||t,s=r?[...new Set([...i,...r.credentials])]:i,a=rS(r?.fetchOptions||{},e.fetchOptions),c=s.filter(u=>u.type!=="request"),l=s.filter(u=>u.type==="request");for(let u of l)aS(u.origins);let h=async(u,f={})=>{if(f=rS(a,f),f.signal?.throwIfAborted(),!s.length)return o(u,f);let d=MC(u),m=d?await iS(d,f,c):{url:u,options:f,credentials:[]},p=await nS(m,l,"request"),g=await o(p.url,p.options),y=[];for(let T of m.credentials){let{credential:S}=T;typeof S.token=="function"&&(_d(f)||S.canReplayRequest?.(u,f))&&(_d(p.options)||S.canReplayRequest?.(p.url,p.options))&&(S.refreshStatusCodes.includes(g.status)||await S.shouldRefresh?.(g))&&y.push(T)}let _=_d(f)&&_d(p.options)&&p.credentials.some(T=>T.refreshStatusCodes?.includes(g.status));if(!y.length&&!_)return g;f.signal?.throwIfAborted();let M=new Map;if(await Promise.all(y.map(async({credential:T})=>{let S=await wC(T,u,g);S&&M.set(T,S)})),!M.size&&!_)return g;await g.body?.cancel().catch(()=>{}),f.signal?.throwIfAborted();let b=d?await iS(d,f,c,M,m.credentials):{url:u,options:f},v=await nS(b,l,"retry",g);return o(v.url,v.options)};return Object.defineProperty(h,eS,{value:{fetch:o,credentials:s,credentialResolutions:n,fetchOptions:a}}),h}function oS(e={}){let t=e.fetch??e.core?.fetch,r;typeof t=="function"?r=t:r=(i,o)=>fetch(i,o);let n=typeof t=="object"&&t?t:void 0;return yC({fetch:r,fetchOptions:e.signal?{...n,signal:e.signal}:n,credentials:e.core?.credentials||[],authentications:e.core?.authentications})}function rS(e,t){let r={...e,...t};if(e.headers||t?.headers){let n=new Headers(e.headers);new Headers(t?.headers).forEach((i,o)=>n.set(o,i)),r.headers=n}return r}async function nS(e,t,r,n){let i=[],o=e.options.signal;for(let s of t){let a=sS(e.url);if(!a||!aS(s.origins).includes(a))continue;o?.throwIfAborted();let c=await s.authenticate({url:e.url,options:{...e.options,headers:new Headers(e.options.headers)},reason:r,response:n?{status:n.status,headers:new Headers(n.headers)}:void 0});if(!c||typeof c.url!="string"||!c.options||typeof c.options!="object")throw new Error("Authentication callback returned an invalid request.");e={url:c.url,options:{...c.options,...o?{signal:o}:{}}},i.push(s)}return o?.throwIfAborted(),{...e,credentials:i}}function sS(e){try{let t=new URL(e);return!t.host||t.username||t.password?null:t.origin!=="null"?t.origin:`${t.protocol}//${t.host}`}catch{return null}}function aS(e){if(!e.length)throw new Error("Request authentication requires at least one exact origin.");return e.map(t=>{let r=sS(t),n;try{n=new URL(t)}catch{throw new Error("Invalid request authentication origin.")}if(!r||n.pathname&&n.pathname!=="/"||n.search||n.hash)throw new Error("Invalid request authentication origin.");return r})}async function iS(e,t,r,n=new Map,i=[]){let o=new URL(e),s=new Headers(t.headers),a=[],c=new Map(i.map(({credential:l,token:h})=>[l,h]));for(let l of r){if(!l.origins.includes(o.origin))continue;let h=n.get(l),u=c.get(l),f=l.type==="query-parameter"&&u!==void 0,d=l.type==="header"&&u!==void 0;if(l.type==="query-parameter"&&o.searchParams.has(l.name)&&!f||l.type==="header"&&s.has(l.name)&&!d)continue;let m=h??u??await _C(l.token,{url:e.toString(),reason:"request"});m&&(l.type==="query-parameter"?o.searchParams.set(l.name,m):s.set(l.name,`${l.prefix||""}${m}`),a.push({credential:l,token:m}))}return{url:o.toString(),options:{...t,headers:s},credentials:a}}async function wC(e,t,r){let n=g1.get(e);if(n)return n;let i=e.token,o=Promise.resolve(i({url:t,reason:"refresh",response:{status:r.status,headers:r.headers}})).finally(()=>g1.delete(e));return g1.set(e,o),o}async function _C(e,t){return typeof e=="function"?e(t):e}function MC(e){try{let t=new URL(e);return["http:","https:"].includes(t.protocol)?t:null}catch{return null}}function _d(e){let t=(e.method||"GET").toUpperCase();return["GET","HEAD","OPTIONS","PUT","DELETE"].includes(t)?!(e.body&&typeof ReadableStream<"u"&&e.body instanceof ReadableStream):!1}var eS,g1,cS=w(()=>{"use strict";m1();eS=Symbol("loaders.gl.authenticated-fetch"),g1=new WeakMap});function bC(e,t){switch((t.type==="response"||t.type==="error")&&t.networkTimeMs!==void 0&&e.get(fe.networkTimeMs,"time").addTime(t.networkTimeMs),t.type){case"queued":e.get(fe.logicalRanges,"count").incrementCount(),e.get(fe.requestedBytes,"count").addCount(t.logicalBytes||0);break;case"batch":e.get(fe.rangeBatches,"count").incrementCount(),e.get("Logical Ranges Batched","count").addCount(t.logicalRequestCount||0),e.get(fe.transportRanges,"count").addCount(t.transportRequestCount||0),e.get(fe.coalescedRanges,"count").addCount(Math.max((t.logicalRequestCount||0)-(t.transportRequestCount||0),0)),e.get(fe.transportBytes,"count").addCount(t.transportBytes||0),e.get(fe.overfetchBytes,"count").addCount(t.overfetchBytes||0);break;case"response":e.get(fe.completedTransportRanges,"count").incrementCount(),e.get(fe.responseBytes,"count").addCount(t.responseBytes||0),t.fullResponse&&e.get(fe.fullResponseFallbacks,"count").incrementCount();break;case"error":e.get(fe.failedTransportRanges,"count").incrementCount();break;case"abort":e.get(fe.abortedLogicalRanges,"count").incrementCount();break;default:}}function uS(e="range-request-scheduler"){let t=new Ni({id:e});return fS(t),t}async function xC(e){let t=AC(e.signal),r=Ch();try{let n=!1,i=await e.fetch(e.url,lS(e.fetchOptions,e.offset,e.length,t.signal));if(i.status===416&&e.offset===0){let c=TC(i.headers.get("Content-Range"));if(!c)throw new Error("Missing content-length on 416 response");i=await e.fetch(e.url,lS(e.fetchOptions,0,c,t.signal)),n=!0}if(i.status===200)throw t.abort(),await PC(i),new Error("Byte-range request failed: server returned 200 instead of 206");if(i.status!==206&&!i.ok)throw new Error(`Bad response code: ${i.status}`);let o=await i.arrayBuffer(),s=i.headers.get("Content-Range"),a=IC(s);if(s&&!a)throw new Error(`Invalid Content-Range header: ${s}`);if(a){let c=a.endOffset-a.offset+1,l=e.offset+e.length-1;if(a.offset!==e.offset||a.endOffset>l||c!==o.byteLength||a.sourceByteLength!==void 0&&a.endOffset>=a.sourceByteLength)throw new Error(`Content-Range does not match requested range: ${s}`)}return{arrayBuffer:o,status:i.status,sourceByteLength:a?.sourceByteLength,transportBytes:o.byteLength,networkTimeMs:Ch()-r,fullResponse:n}}finally{t.removeAbortListener()}}function SC(e,t,r){if(e.sourceId!==t.sourceId||e.isolationKey!==(t.isolationKey??t.sourceId))return!1;let n=t.offset+t.length,i=t.offset-e.endOffset,o=Math.max(e.endOffset,n)-e.offset;return i<=r.rangeExpansionBytes&&o<=r.maxMergedBytes}function fS(e){e.get(fe.logicalRanges,"count"),e.get(fe.requestedBytes,"count"),e.get(fe.rangeBatches,"count"),e.get("Logical Ranges Batched","count"),e.get(fe.transportRanges,"count"),e.get(fe.coalescedRanges,"count"),e.get(fe.transportBytes,"count"),e.get(fe.completedTransportRanges,"count"),e.get(fe.responseBytes,"count"),e.get(fe.networkTimeMs,"time"),e.get(fe.overfetchBytes,"count"),e.get(fe.fullResponseFallbacks,"count"),e.get(fe.failedTransportRanges,"count"),e.get(fe.abortedLogicalRanges,"count")}function y1(e){return e.reduce((t,r)=>t+r.length,0)}function vC(e){return e instanceof ArrayBuffer?{arrayBuffer:e}:e}function lS(e,t,r,n){return{...e,signal:n,headers:{...EC(e?.headers),Range:`bytes=${t}-${t+r-1}`}}}function EC(e){return e?e instanceof Headers?Object.fromEntries(e.entries()):Array.isArray(e)?Object.fromEntries(e):e:{}}function TC(e){let t=e?.match(/^bytes \*\/(\d+)$/);return t?Number(t[1]):null}function IC(e){let t=e?.match(/^bytes (\d+)-(\d+)\/(\d+|\*)$/);if(!t)return null;let r=Number(t[1]),n=Number(t[2]),i=t[3]==="*"?void 0:Number(t[3]);return!Number.isSafeInteger(r)||!Number.isSafeInteger(n)||r>n||i!==void 0&&!Number.isSafeInteger(i)?null:{offset:r,endOffset:n,sourceByteLength:i}}function AC(e){let t=new AbortController,r=()=>t.abort(e?.reason);return e?.aborted?t.abort(e?.reason):e?.addEventListener("abort",r,{once:!0}),{signal:t.signal,abort:()=>t.abort(),removeAbortListener:()=>e?.removeEventListener("abort",r)}}async function PC(e){await e.body?.cancel().catch(()=>{})}function Ch(){return globalThis.performance?.now()??Date.now()}function hS(){if(typeof DOMException<"u")return new DOMException("Request aborted","AbortError");let e=new Error("Request aborted");return e.name="AbortError",e}var fe,Md,bd,dS=w(()=>{"use strict";cd();fe={logicalRanges:"Logical Range Requests",rangeBatches:"Range Request Batches",transportRanges:"Transport Ranges Created",completedTransportRanges:"Range Transport Requests Completed",coalescedRanges:"Coalesced Logical Ranges",requestedBytes:"Logical Range Request Bytes",transportBytes:"Range Transport Bytes Requested",responseBytes:"Range Response Bytes",networkTimeMs:"Range Network Time",overfetchBytes:"Range Overfetch Bytes",failedTransportRanges:"Range Transport Requests Failed",abortedLogicalRanges:"Aborted Logical Range Requests",fullResponseFallbacks:"Full Response Fallbacks"},Md={batchDelayMs:50,maxGapBytes:65536,rangeExpansionBytes:65536,maxMergedBytes:8388608,maxConcurrency:6,maxQueueSize:4096,maxRangeBytes:64*1024*1024,maxTotalBytes:Number.MAX_SAFE_INTEGER,stats:uS("range-request-scheduler-default"),onEvent:()=>{}},bd=class{props;stats;onEvent;pendingRequests=[];transportQueue=[];activeTransports=0;reservedTransportBytes=0;queuedRequests=0;logicalRequests=new Set;transportControllers=new Set;finalized=!1;flushTimer=null;constructor(t={}){let r=t.rangeExpansionBytes??t.maxGapBytes??Md.rangeExpansionBytes;this.props={batchDelayMs:t.batchDelayMs??Md.batchDelayMs,maxGapBytes:t.maxGapBytes??r,rangeExpansionBytes:r,maxMergedBytes:t.maxMergedBytes??Md.maxMergedBytes,maxConcurrency:t.maxConcurrency??6,maxQueueSize:t.maxQueueSize??4096,maxRangeBytes:t.maxRangeBytes??64*1024*1024,maxTotalBytes:t.maxTotalBytes??Md.maxTotalBytes};for(let n of[this.props.maxConcurrency,this.props.maxQueueSize,this.props.maxRangeBytes,this.props.maxTotalBytes])if(!Number.isSafeInteger(n)||n<=0)throw new Error("Range scheduler limits must be positive integers");this.stats=t.stats||uS("range-request-scheduler"),this.onEvent=t.onEvent,fS(this.stats)}scheduleRequest(t){if(this.finalized)return Promise.reject(new Error("Range scheduler is finalized"));if(!Number.isSafeInteger(t.offset)||t.offset<0||!Number.isSafeInteger(t.length)||t.length>this.props.maxRangeBytes||!Number.isSafeInteger(t.offset+t.length))return Promise.reject(new Error("Invalid or oversized byte range"));if(this.queuedRequests>=this.props.maxQueueSize)return Promise.reject(new Error("Range scheduler queue limit exceeded"));if(t.length<0)return Promise.reject(new Error("Byte range length cannot be negative"));if(t.signal?.aborted)return Promise.reject(t.signal.reason??hS());if(t.length===0)return Promise.resolve(new ArrayBuffer(0));this.queuedRequests++;let r,n=new Promise((i,o)=>{r={...t,resolve:i,reject:o,settled:!1},this.logicalRequests.add(r),t.signal&&(r.abortListener=()=>{this.abortRequest(r),r.onAbort?.()},t.signal.addEventListener("abort",r.abortListener,{once:!0})),this.pendingRequests.push(r)});return this.trackEvent({type:"queued",sourceId:t.sourceId,offset:t.offset,length:t.length,logicalRequestCount:1,logicalBytes:t.length}),this.scheduleFlush(),n.finally(()=>{r.abortListener&&t.signal?.removeEventListener("abort",r.abortListener),this.queuedRequests--,this.logicalRequests.delete(r)})}fetch(t){let r=t.fetch||globalThis.fetch;return this.scheduleRequest({sourceId:t.sourceId||t.url,offset:t.offset,length:t.length,signal:t.signal,isolationKey:t.isolationKey??{},fetchRange:(n,i,o)=>xC({url:t.url,offset:n,length:i,signal:o,fetch:r,fetchOptions:t.fetchOptions})})}flush(){this.flushTimer!==null&&(clearTimeout(this.flushTimer),this.flushTimer=null);let t=this.pendingRequests;this.pendingRequests=[];let r=t.filter(i=>i.settled||i.signal?.aborted?(this.abortRequest(i),!1):!0),n=this.mergeRequests(r);r.length>0&&this.trackBatch(r,n),this.transportQueue.push(...n),this.startQueuedTransports()}finalize(){this.finalized=!0,this.flushTimer!==null&&clearTimeout(this.flushTimer),this.flushTimer=null;for(let t of this.logicalRequests)this.abortRequest(t),t.abortListener&&t.signal?.removeEventListener("abort",t.abortListener);for(let t of this.transportControllers)t.abort();this.transportQueue=[],this.pendingRequests=[],this.logicalRequests.clear()}startQueuedTransports(){for(;this.activeTransports<this.props.maxConcurrency&&this.transportQueue.length;){let t=this.transportQueue.shift();this.activeTransports++,this.fetchMergedRequest(t).finally(()=>{this.activeTransports--,this.startQueuedTransports()})}}scheduleFlush(){this.flushTimer===null&&(this.flushTimer=setTimeout(()=>this.flush(),this.props.batchDelayMs))}mergeRequests(t){t.sort((n,i)=>n.sourceId!==i.sourceId?n.sourceId<i.sourceId?-1:1:n.offset-i.offset);let r=[];for(let n of t){let i=n.offset+n.length,o=r[r.length-1];o&&SC(o,n,this.props)?(o.endOffset=Math.max(o.endOffset,i),o.requests.push(n)):r.push({sourceId:n.sourceId,isolationKey:n.isolationKey??n.sourceId,offset:n.offset,endOffset:i,fetchRange:n.fetchRange,requests:[n]})}return r}async fetchMergedRequest(t){let{offset:r,endOffset:n,fetchRange:i,requests:o}=t,s=new AbortController;this.transportControllers.add(s);let a=Ch(),c=()=>{o.every(l=>l.settled||l.signal?.aborted)&&s.abort()};try{for(let g of o)g.onAbort=c;if(c(),o.every(g=>g.settled))return;let l=y1(o),h=n-r;if(h>this.props.maxTotalBytes-this.reservedTransportBytes)throw new RangeError("Range request total byte limit exceeded");this.reservedTransportBytes+=h,this.trackEvent({type:"request",sourceId:t.sourceId,offset:r,length:h,logicalRequestCount:o.length,logicalBytes:l,transportBytes:h,overfetchBytes:Math.max(h-l,0)});let u=vC(await i(r,h,s.signal)),{arrayBuffer:f}=u,d=u.fullResponse&&r===0&&f.byteLength<h,m=f.byteLength<h&&Number.isSafeInteger(u.sourceByteLength)&&r+f.byteLength===u.sourceByteLength;if(f.byteLength!==h&&!d&&!m)throw new Error(`Byte-range transport returned ${f.byteLength} bytes; expected ${h}`);let p=u.networkTimeMs??Ch()-a;this.trackEvent({type:"response",sourceId:t.sourceId,offset:r,length:h,logicalRequestCount:o.length,logicalBytes:l,transportBytes:h,responseBytes:u.transportBytes??f.byteLength,networkTimeMs:p,overfetchBytes:Math.max(h-l,0),status:u.status,fullResponse:u.fullResponse});for(let g of o){if(g.settled)continue;let y=g.offset-r;g.settled=!0,g.resolve(f.slice(y,y+g.length))}}catch(l){s.signal.aborted||this.trackEvent({type:"error",sourceId:t.sourceId,offset:r,length:n-r,logicalRequestCount:o.length,logicalBytes:y1(o),networkTimeMs:Ch()-a,error:l});for(let h of o)h.settled||(h.signal?.aborted?this.abortRequest(h):(h.settled=!0,h.reject(l)))}finally{this.transportControllers.delete(s);for(let l of o)l.abortListener&&l.signal?.removeEventListener("abort",l.abortListener),l.onAbort=void 0}}abortRequest(t){if(!t.settled){t.settled=!0,this.pendingRequests=this.pendingRequests.filter(r=>r!==t);for(let r of this.transportQueue)r.requests=r.requests.filter(n=>!n.settled),r.requests.length&&(r.offset=Math.min(...r.requests.map(n=>n.offset)),r.endOffset=Math.max(...r.requests.map(n=>n.offset+n.length)));this.transportQueue=this.transportQueue.filter(r=>r.requests.length>0),t.reject(t.signal?.reason??hS()),this.trackEvent({type:"abort",sourceId:t.sourceId,offset:t.offset,length:t.length,logicalRequestCount:1,logicalBytes:t.length})}}trackEvent(t){bC(this.stats,t);try{this.onEvent?.(t)}catch{}}trackBatch(t,r){let n=y1(t),i=r.reduce((o,s)=>o+s.endOffset-s.offset,0);this.trackEvent({type:"batch",logicalRequestCount:t.length,transportRequestCount:r.length,logicalBytes:n,transportBytes:i,overfetchBytes:Math.max(i-n,0)})}}});function pS(e){for(let t in mS)if(e.startsWith(t)){let r=mS[t];e=e.replace(t,r)}return!e.startsWith("http://")&&!e.startsWith("https://")&&(e=`${RC}${e}`),e}var RC,mS,gS=w(()=>{"use strict";RC="",mS={}});function yS(){if(typeof process<"u"&&typeof process.cwd<"u")return process.cwd();let e=globalThis.location?.pathname;return e?.slice(0,e.lastIndexOf("/")+1)||""}var wS=w(()=>{"use strict"});var wn={};Zr(wn,{dirname:()=>NC,filename:()=>CC,join:()=>OC,resolve:()=>BC});function CC(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(t+1):e}function NC(e){let t=e?e.lastIndexOf("/"):-1;return t>=0?e.substr(0,t):""}function OC(...e){return e=e.map((r,n)=>(n&&(r=r.replace(new RegExp("^/"),"")),n!==e.length-1&&(r=r.replace(new RegExp("/$"),"")),r)),e.join("/")}function BC(...e){let t=[];for(let o=0;o<e.length;o++)t[o]=e[o];let r="",n=!1,i;for(let o=t.length-1;o>=-1&&!n;o--){let s;o>=0?s=t[o]:(i===void 0&&(i=yS()),s=i),s.length!==0&&(r=`${s}/${r}`,n=s.charCodeAt(0)===Nh)}return r=LC(r,!n),n?`/${r}`:r.length>0?r:"."}function LC(e,t){let r="",n=-1,i=0,o,s=!1;for(let a=0;a<=e.length;++a){if(a<e.length)o=e.charCodeAt(a);else{if(o===Nh)break;o=Nh}if(o===Nh){if(!(n===a-1||i===1))if(n!==a-1&&i===2){if(r.length<2||!s||r.charCodeAt(r.length-1)!==w1||r.charCodeAt(r.length-2)!==w1){if(r.length>2){let c=r.length-1,l=c;for(;l>=0&&r.charCodeAt(l)!==Nh;--l);if(l!==c){r=l===-1?"":r.slice(0,l),n=a,i=0,s=!1;continue}}else if(r.length===2||r.length===1){r="",n=a,i=0,s=!1;continue}}t&&(r.length>0?r+="/..":r="..",s=!0)}else{let c=e.slice(n+1,a);r.length>0?r+=`/${c}`:r=c,s=!1}n=a,i=0}else o===w1&&i!==-1?++i:i=-1}return r}var Nh,w1,_S=w(()=>{"use strict";wS();Nh=47,w1=46});var qc,MS=w(()=>{"use strict";qc=class{handle;size;bigsize;url;constructor(t){this.handle=t instanceof ArrayBuffer?new Blob([t]):t,this.size=t instanceof ArrayBuffer?t.byteLength:t.size,this.bigsize=BigInt(this.size),this.url=t instanceof File?t.name:""}async close(){}async stat(){return{size:this.handle.size,bigsize:BigInt(this.handle.size),isDirectory:!1}}async read(t,r,n){if(n?.aborted)throw new Error("Request aborted");let i=await this.handle.slice(Number(t),Number(t)+Number(r)).arrayBuffer();if(n?.aborted)throw new Error("Request aborted");return i}}});function bS(e,t){return t?t.aborted?(e.catch(()=>{}),Promise.reject(t.reason)):new Promise((r,n)=>{let i=()=>{t.removeEventListener("abort",i),n(t.reason)};t.addEventListener("abort",i,{once:!0}),e.then(o=>{t.removeEventListener("abort",i),r(o)},o=>{t.removeEventListener("abort",i),n(o)})}):e}var xS=w(()=>{"use strict"});function DC(e,t,r,n){let i=new Headers(e?.headers);return i.set("Range",`bytes=${t}-${t+r-1}`),{...e,method:"GET",body:void 0,headers:i,signal:n}}function FC(e,t,r,n){return e.status===416&&n===null&&t===0&&r===1&&/^bytes \*\/0$/i.test(e.headers.get("Content-Range")||"")}async function UC(e){try{return GC(e.headers.get("Content-Range"))}catch(t){throw await jc(e),t}}function GC(e){let t=e?.match(/^bytes (\d+)-(\d+)\/(\d+)$/);if(!t)throw new Error("HTTP byte-range response has an invalid Content-Range header");return{offset:Number(t[1]),endOffset:Number(t[2]),byteLength:Number(t[3])}}function xd(e,t){return Ed(t,Td(e.headers.get("ETag")),Td(e.headers.get("Last-Modified")))}function SS(e,t,r){return e||Ed(t.byteLength,t.etag??r.etag,t.lastModified??r.lastModified)}function zC(e,t,r){return!Number.isSafeInteger(e.offset)||!Number.isSafeInteger(e.endOffset)||!Number.isSafeInteger(e.byteLength)||e.offset<0||e.endOffset<e.offset||e.endOffset>=e.byteLength?"HTTP byte-range response has invalid range bounds":e.offset!==t||e.endOffset!==t+r-1?"HTTP byte-range response does not match the requested range":null}function _1(e,t,r,n){let i=e?.byteLength??r.byteLength;if(i!==void 0&&t.byteLength!==i)return"HTTP file length changed while the file was open";let o=e?.etag??r.etag,s=e?.lastModified??r.lastModified;return o?t.etag?o===t.etag?null:"HTTP file ETag changed while the file was open":n==="strict"?"HTTP byte-range response is missing the pinned ETag":s&&t.lastModified&&s!==t.lastModified?"HTTP file Last-Modified value changed while the file was open":null:s?t.lastModified&&s!==t.lastModified?"HTTP file Last-Modified value changed while the file was open":n==="strict"&&!t.lastModified?"HTTP byte-range response is missing the pinned Last-Modified value":null:n==="strict"&&!t.etag&&!t.lastModified?"HTTP byte-range response does not provide an ETag or Last-Modified validator":null}function Ed(e,t,r){return Object.freeze({byteLength:e,etag:t,lastModified:r})}function VC(e){if(e!==void 0&&(!Number.isSafeInteger(e)||e<0))throw new Error("HttpFile byteLength must be a non-negative safe integer")}async function jc(e){await e.body?.cancel().catch(()=>{})}function Td(e){return e||void 0}function Sd(){return globalThis.performance?.now()??Date.now()}function vS(e){return e instanceof Error&&e.name==="AbortError"||e instanceof Error&&/aborted/i.test(e.message)}function kC(...e){let t=new AbortController,r=[...new Set(e.filter(i=>!!i))],n=()=>t.abort();for(let i of r)i.aborted?t.abort():i.addEventListener("abort",n,{once:!0});return{signal:t.signal,removeAbortListeners:()=>{for(let i of r)i.removeEventListener("abort",n)}}}var vd,ES=w(()=>{"use strict";vd=class{url;fetchFunction;fetchOptions;consistency;identityHints;countedFailures=new WeakSet;onTelemetry;telemetry={requestedBytes:0,downloadedBytes:0,requestCount:0,networkTimeMs:0,abortCount:0,errorCount:0};constructor(t,r){VC(r.byteLength),this.url=t,this.onTelemetry=r.onTelemetry,this.fetchFunction=r.fetch||((n,i)=>globalThis.fetch(n,i)),this.fetchOptions=r.fetchOptions?{...r.fetchOptions,headers:new Headers(r.fetchOptions.headers)}:void 0,this.consistency=r.consistency||"best-effort",this.identityHints={byteLength:r.byteLength,etag:Td(r.etag),lastModified:Td(r.lastModified)}}getInitialIdentity(){let{byteLength:t,etag:r,lastModified:n}=this.identityHints;return t!==void 0&&(r!==void 0||n!==void 0)?Ed(t,r,n):t===0&&this.consistency==="best-effort"?Ed(0):null}getTelemetry(){return Object.freeze({...this.telemetry})}trackFailure(t){if(typeof t=="object"&&t!==null){if(this.countedFailures.has(t))return;this.countedFailures.add(t)}vS(t)?this.telemetry.abortCount++:this.telemetry.errorCount++,this.onTelemetry?.(this.getTelemetry(),t)}async requestRange(t,r,n,i){let o=Sd(),s=kC(n,this.fetchOptions?.signal);this.telemetry.requestCount++,this.telemetry.requestedBytes+=r;try{let a=await this.fetchFunction(this.url,DC(this.fetchOptions,t,r,s.signal));if(FC(a,t,r,i))return await this.readEmptyIdentityProbe(a,o);if(a.status!==206)throw await jc(a),new Error(`HTTP byte-range request expected 206, received ${a.status}`);let c=a.headers.has("Content-Range")?await UC(a):await this.inferContentRange(a,t,r,i,s.signal),l=xd(a,c.byteLength),h=_1(i,l,this.identityHints,this.consistency)||zC(c,t,r);if(h)throw await jc(a),new Error(h);let u=await a.arrayBuffer();if(this.telemetry.downloadedBytes+=u.byteLength,u.byteLength!==r)throw new Error(`HTTP byte-range response contained ${u.byteLength} bytes; expected ${r}`);return{arrayBuffer:u,identity:SS(i,l,this.identityHints),status:a.status,transportBytes:u.byteLength,networkTimeMs:Sd()-o}}catch(a){throw(i===null||!vS(a))&&this.trackFailure(a),a}finally{s.removeAbortListeners(),this.telemetry.networkTimeMs+=Sd()-o,this.onTelemetry?.(this.getTelemetry())}}async inferContentRange(t,r,n,i,o){try{let s=i?.byteLength??this.identityHints.byteLength;if(s===void 0){let a=new Headers(this.fetchOptions?.headers);a.delete("Range"),this.telemetry.requestCount++;let c=await this.fetchFunction(this.url,{...this.fetchOptions,method:"HEAD",body:void 0,headers:a,signal:o});await jc(c);let l=c.headers.get("Content-Length");if(s=l&&/^\d+$/.test(l)?Number(l):NaN,c.status!==200||!Number.isSafeInteger(s)||s<r+n)throw new Error("HTTP byte-range response is missing Content-Range and HEAD did not provide a valid file length");let h=_1(xd(c,s),xd(t,s),this.identityHints,this.consistency);if(h)throw new Error(h)}return{offset:r,endOffset:r+n-1,byteLength:s}}catch(s){throw await jc(t),s}}async readEmptyIdentityProbe(t,r){let n=xd(t,0),i=_1(null,n,this.identityHints,this.consistency);if(await jc(t),i)throw new Error(i);return{arrayBuffer:new ArrayBuffer(0),identity:SS(null,n,this.identityHints),status:t.status,transportBytes:0,networkTimeMs:Sd()-r}}}});function qC(e,t,r){let n=new Headers;return r>0&&e&&n.set("Content-Range",`bytes ${t}-${t+r-1}/${e.byteLength}`),e?.etag&&n.set("ETag",e.etag),e?.lastModified&&n.set("Last-Modified",e.lastModified),n}function TS(e){let t=Number(e);if(!Number.isSafeInteger(t)||t<0)throw new Error("HTTP byte-range offset must be a non-negative safe integer");return t}function jC(e,t,r){if(!Number.isSafeInteger(t)||t<0)throw new Error("HTTP byte-range length must be a non-negative safe integer");if(e+t>r)throw new Error("HTTP byte range extends beyond the end of the file")}function IS(){if(typeof DOMException<"u")return new DOMException("Request aborted","AbortError");let e=new Error("Request aborted");return e.name="AbortError",e}var Oh,AS=w(()=>{"use strict";xS();dS();ES();Oh=class e{handle;url;transport;rangeScheduler;schedulerIsolationKey={};suppliedByteLength;identity;openPromise=null;closed=!1;constructor(t,r={}){this.handle=t,this.url=t,this.transport=new vd(t,r),this.rangeScheduler=r.rangeScheduler||new bd({batchDelayMs:0,...r.rangeSchedulerProps}),this.suppliedByteLength=r.byteLength,this.identity=this.transport.getInitialIdentity()}static async open(t,r={},n){let i=new e(t,r);return await i.open(n),i}async open(t){if(this.assertOpen(),t?.aborted){let r=IS();throw this.transport.trackFailure(r),r}return await this.getIdentity(t),this}get size(){return this.identity?.byteLength??this.suppliedByteLength??0}get bigsize(){return BigInt(this.size)}getIdentitySnapshot(){return this.identity}getTelemetry(){return this.transport.getTelemetry()}async close(){this.closed=!0}async stat(){this.assertOpen();let t=await this.getIdentity();return{size:t.byteLength,bigsize:BigInt(t.byteLength),isDirectory:!1}}async read(t=0,r=0,n){if(this.assertOpen(),n?.aborted){let s=IS();throw this.transport.trackFailure(s),s}let i=await this.getIdentity(n),o=TS(t);if(jC(o,r,i.byteLength),r===0)return new ArrayBuffer(0);try{return await this.rangeScheduler.scheduleRequest({sourceId:this.url,isolationKey:this.schedulerIsolationKey,offset:o,length:r,signal:n,fetchRange:this.fetchScheduledRange})}catch(s){throw this.transport.trackFailure(s),s}}async fetchRange(t,r,n){let i=TS(t),o=await this.read(i,r,n),s=qC(this.identity,i,r);return new Response(o,{status:206,headers:s})}fetchScheduledRange=async(t,r,n)=>{let i=await this.getIdentity(n),o=await this.transport.requestRange(t,r,n,i);return{arrayBuffer:o.arrayBuffer,status:o.status,transportBytes:o.transportBytes,networkTimeMs:o.networkTimeMs}};getIdentity(t){if(this.identity)return Promise.resolve(this.identity);if(!this.openPromise){let n=this.probeIdentity().catch(i=>{throw this.openPromise===n&&(this.openPromise=null),i});this.openPromise=n}return bS(this.openPromise,t).catch(r=>{throw this.transport.trackFailure(r),r})}async probeIdentity(){try{let t=await this.transport.requestRange(0,1,void 0,null);return this.identity=t.identity,t.identity}catch(t){throw this.transport.trackFailure(t),t}}assertOpen(){if(this.closed)throw new Error("HttpFile is closed")}}});function PS(e){return oS(e)}function RS(e){if(e.loadOptions!==void 0||e.core?.loadOptions!==void 0)throw new Error("Source loadOptions and core.loadOptions were removed. Use core and root loader namespaces directly.");let t={...e};if(e?.core){t.core={...e.core};let i=t.core;for(let o of["type","name","attributions","loaders","onError","loadOptions"])delete i[o];Object.keys(i).length===0&&delete t.core}let r=typeof t.baseUri=="string"?t.baseUri:void 0,n=typeof t.baseUrl=="string"?t.baseUrl:void 0;return(r!==void 0||n!==void 0)&&(t.core||={},t.core.baseUrl===void 0&&(t.core.baseUrl=n??r),delete t.baseUri,delete t.baseUrl),t}function HC(e,t){return e instanceof Error?e:typeof e=="string"?new Error(e):new Error(t)}function xa(e){return()=>{throw new Error(`CoreAPI.${e} is unavailable. Use @loaders.gl/core.createDataSource().`)}}function $C(e,t){let r=t.core?.name;if(r!==void 0){if(typeof r!="string"||!r.trim())throw new Error("Data source name must be a non-empty string.");return r}if(e&&typeof e=="object"){let n=e;if(typeof n.name=="string"&&n.name.trim())return e instanceof Blob?CS(n.name):n.name;let i=n.schema?.metadata,o=i instanceof Map?i.get("name"):i?.name;if(typeof o=="string"&&o.trim())return o}if(typeof e=="string")try{let n=new URL(e.replace(/\\/g,"/"),"https://source.invalid/");if(!["data:","blob:"].includes(n.protocol)){let i=n.pathname.split("/").filter(Boolean).pop();if(i){try{i=decodeURIComponent(i)}catch{}return CS(i)}}}catch{}return t.core?.type&&t.core.type!=="auto"?t.core.type:"source"}function CS(e){let t=e.lastIndexOf(".");return t>0?e.slice(0,t):e}var WC,Bh,NS=w(()=>{"use strict";Kx();gS();Wx();cS();m1();WC={fetchFile:xa("fetchFile"),parse:xa("parse"),parseFile:xa("parseFile"),parseSync:xa("parseSync"),parseInBatches:xa("parseInBatches"),load:xa("load"),loadInBatches:xa("loadInBatches")},Bh=class e{static defaultOptions={core:{type:"auto",attributions:[],loaders:[],onError:void 0}};optionsType;options;data;url;name;loadOptions;fetch;coreApi;hasCoreApi;_needsRefresh=!0;constructor(t,r,n,i){this.options=yd(yd(e.defaultOptions,n||{}),r),this.data=t,this.url=typeof t=="string"?pS(t):"",this.name=$C(t,this.options);let o=d1(RS(this.options));this.loadOptions=o;let s=PS(o);this.coreApi=i||WC,this.hasCoreApi=!!i,this.fetch=s}setProps(t){if(t.core?.name!==void 0&&t.core.name!==this.name)throw new Error("Data source names are fixed at creation.");let r=yd(this.options,t),n=d1(RS(r));this.options=r,this.loadOptions=n,this.fetch=PS(n),this.setNeedsRefresh()}setNeedsRefresh(){this._needsRefresh=!0}getNeedsRefresh(t=!0){let r=this._needsRefresh;return t&&(this._needsRefresh=!1),r}reportError(t,r){let n=HC(t,r),i=this.options.core?.onError;return i?i(n,this):jx.warn(`${this.constructor.name}: ${n.message}`)(),n}}});var co=w(()=>{"use strict";Bx();Xx();Zx();tS();_S();MS();AS();NS()});function XB(e,t="float32"){return e instanceof Date?"date-millisecond":typeof e=="number"?t:typeof e=="boolean"?"bool":typeof e=="string"?"utf8":"null"}function t3(e){let t=ZB(e);return t!=="null"?{type:t,nullable:!1}:e.length>0?(t=XB(e[0]),{type:t,nullable:!0}):{type:"null",nullable:!0}}function ZB(e){if(typeof Float16Array<"u"&&e instanceof Float16Array)return"float16";switch(e.constructor){case Int8Array:return"int8";case Uint8Array:case Uint8ClampedArray:return"uint8";case Int16Array:return"int16";case Uint16Array:return"uint16";case Int32Array:return"int32";case Uint32Array:return"uint32";case BigInt64Array:return"int64";case BigUint64Array:return"uint64";case Float32Array:return"float32";case Float64Array:return"float64";default:return"null"}}var e3=w(()=>{"use strict"});function n3(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function Y(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(h){try{l(n.next(h))}catch(u){s(u)}}function c(h){try{l(n.throw(h))}catch(u){s(u)}}function l(h){h.done?o(h.value):i(h.value).then(a,c)}l((n=n.apply(e,t||[])).next())})}function r3(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function wt(e){return this instanceof wt?(this.v=e,this):new wt(e)}function Gr(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=r.apply(e,t||[]),i,o=[];return i=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),i[Symbol.asyncIterator]=function(){return this},i;function s(d){return function(m){return Promise.resolve(m).then(d,u)}}function a(d,m){n[d]&&(i[d]=function(p){return new Promise(function(g,y){o.push([d,p,g,y])>1||c(d,p)})},m&&(i[d]=m(i[d])))}function c(d,m){try{l(n[d](m))}catch(p){f(o[0][3],p)}}function l(d){d.value instanceof wt?Promise.resolve(d.value.v).then(h,u):f(o[0][2],d)}function h(d){c("next",d)}function u(d){c("throw",d)}function f(d,m){d(m),o.shift(),o.length&&c(o[0][0],o[0][1])}}function yl(e){var t,r;return t={},n("next"),n("throw",function(i){throw i}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(i,o){t[i]=e[i]?function(s){return(r=!r)?{value:wt(e[i](s)),done:!1}:o?o(s):s}:o}}function vn(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof r3=="function"?r3(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=e[o]&&function(s){return new Promise(function(a,c){s=e[o](s),i(a,c,s.done,s.value)})}}function i(o,s,a,c){Promise.resolve(c).then(function(l){o({value:l,done:a})},s)}}var an=w(()=>{});var i3,wl,JB,En,uo=w(()=>{i3=new TextDecoder("utf-8"),wl=i3.decode.bind(i3),JB=new TextEncoder,En=e=>JB.encode(e)});var QB,o3,Ze,zr,Tn,hi,$n,Om,Bm,Lm,Dm,Fm,s3,iu,a3,Um,c3,us=w(()=>{QB=e=>typeof e=="number",o3=e=>typeof e=="boolean",Ze=e=>typeof e=="function",zr=e=>e!=null&&Object(e)===e,Tn=e=>zr(e)&&Ze(e.then),hi=e=>zr(e)&&Ze(e[Symbol.iterator]),$n=e=>zr(e)&&Ze(e[Symbol.asyncIterator]),Om=e=>zr(e)&&zr(e.schema),Bm=e=>zr(e)&&"done"in e&&"value"in e,Lm=e=>zr(e)&&Ze(e.stat)&&QB(e.fd),Dm=e=>zr(e)&&iu(e.body),Fm=e=>"_getDOMStream"in e&&"_getNodeStream"in e,s3=e=>zr(e)&&Ze(e.abort)&&Ze(e.getWriter)&&!Fm(e),iu=e=>zr(e)&&Ze(e.cancel)&&Ze(e.getReader)&&!Fm(e),a3=e=>zr(e)&&Ze(e.end)&&Ze(e.write)&&o3(e.writable)&&!Fm(e),Um=e=>zr(e)&&Ze(e.read)&&Ze(e.pipe)&&o3(e.readable)&&!Fm(e),c3=e=>zr(e)&&Ze(e.clear)&&Ze(e.bytes)&&Ze(e.position)&&Ze(e.setPosition)&&Ze(e.capacity)&&Ze(e.getBufferIdentifier)&&Ze(e.createLong)});var hw={};Zr(hw,{compareArrayLike:()=>lw,joinUint8Arrays:()=>In,memcpy:()=>ou,rebaseValueOffsets:()=>Gm,toArrayBufferView:()=>Tt,toArrayBufferViewAsyncIterator:()=>ui,toArrayBufferViewIterator:()=>Fi,toBigInt64Array:()=>su,toBigUint64Array:()=>o6,toFloat32Array:()=>s6,toFloat32ArrayAsyncIterator:()=>x6,toFloat32ArrayIterator:()=>m6,toFloat64Array:()=>a6,toFloat64ArrayAsyncIterator:()=>S6,toFloat64ArrayIterator:()=>p6,toInt16Array:()=>r6,toInt16ArrayAsyncIterator:()=>w6,toInt16ArrayIterator:()=>h6,toInt32Array:()=>Oa,toInt32ArrayAsyncIterator:()=>_6,toInt32ArrayIterator:()=>u6,toInt8Array:()=>e6,toInt8ArrayAsyncIterator:()=>y6,toInt8ArrayIterator:()=>l6,toUint16Array:()=>n6,toUint16ArrayAsyncIterator:()=>M6,toUint16ArrayIterator:()=>f6,toUint32Array:()=>i6,toUint32ArrayAsyncIterator:()=>b6,toUint32ArrayIterator:()=>d6,toUint8Array:()=>nt,toUint8ArrayAsyncIterator:()=>cw,toUint8ArrayIterator:()=>aw,toUint8ClampedArray:()=>c6,toUint8ClampedArrayAsyncIterator:()=>v6,toUint8ClampedArrayIterator:()=>g6});function t6(e){let t=e[0]?[e[0]]:[],r,n,i,o;for(let s,a,c=0,l=0,h=e.length;++c<h;){if(s=t[l],a=e[c],!s||!a||s.buffer!==a.buffer||a.byteOffset<s.byteOffset){a&&(t[++l]=a);continue}if({byteOffset:r,byteLength:i}=s,{byteOffset:n,byteLength:o}=a,r+i<n||n+o<r){a&&(t[++l]=a);continue}t[l]=new Uint8Array(s.buffer,r,n-r+o)}return t}function ou(e,t,r=0,n=t.byteLength){let i=e.byteLength,o=new Uint8Array(e.buffer,e.byteOffset,i),s=new Uint8Array(t.buffer,t.byteOffset,Math.min(n,i));return o.set(s,r),e}function In(e,t){let r=t6(e),n=r.reduce((h,u)=>h+u.byteLength,0),i,o,s,a=0,c=-1,l=Math.min(t||Number.POSITIVE_INFINITY,n);for(let h=r.length;++c<h;){if(i=r[c],o=i.subarray(0,Math.min(i.length,l-a)),l<=a+o.length){o.length<i.length?r[c]=i.subarray(o.length):o.length===i.length&&c++,s?ou(s,o,a):s=o;break}ou(s||(s=new Uint8Array(l)),o,a),a+=o.length}return[s||new Uint8Array(0),r.slice(c),n-(s?s.byteLength:0)]}function Tt(e,t){let r=Bm(t)?t.value:t;return r instanceof e?e===Uint8Array?new e(r.buffer,r.byteOffset,r.byteLength):r:r?(typeof r=="string"&&(r=En(r)),r instanceof ArrayBuffer?new e(r):r instanceof sw?new e(r):c3(r)?Tt(e,r.bytes()):ArrayBuffer.isView(r)?r.byteLength<=0?new e(0):new e(r.buffer,r.byteOffset,r.byteLength/e.BYTES_PER_ELEMENT):e.from(r)):new e(0)}function*Fi(e,t){let r=function*(i){yield i},n=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof sw?r(t):hi(t)?t:r(t);return yield*ow((function*(i){let o=null;do o=i.next(yield Tt(e,o));while(!o.done)})(n[Symbol.iterator]())),new e}function ui(e,t){return Gr(this,arguments,function*(){if(Tn(t))return yield wt(yield wt(yield*yl(vn(ui(e,yield wt(t))))));let n=function(s){return Gr(this,arguments,function*(){yield yield wt(yield wt(s))})},i=function(s){return Gr(this,arguments,function*(){yield wt(yield*yl(vn(ow((function*(a){let c=null;do c=a.next(yield c?.value);while(!c.done)})(s[Symbol.iterator]())))))})},o=typeof t=="string"||ArrayBuffer.isView(t)||t instanceof ArrayBuffer||t instanceof sw?n(t):hi(t)?i(t):$n(t)?t:n(t);return yield wt(yield*yl(vn(ow((function(s){return Gr(this,arguments,function*(){let a=null;do a=yield wt(s.next(yield yield wt(Tt(e,a))));while(!a.done)})})(o[Symbol.asyncIterator]()))))),yield wt(new e)})}function Gm(e,t,r){if(e!==0){r=r.slice(0,t);let n=typeof r[0]=="bigint"?BigInt(e):e;for(let i=-1,o=r.length;++i<o;)r[i]+=n}return r.subarray(0,t)}function lw(e,t){let r=0,n=e.length;if(n!==t.length)return!1;if(n>0)do if(e[r]!==t[r])return!1;while(++r<n);return!0}var sw,e6,r6,Oa,su,nt,n6,i6,o6,s6,a6,c6,ow,l6,h6,u6,aw,f6,d6,m6,p6,g6,y6,w6,_6,cw,M6,b6,x6,S6,v6,Je=w(()=>{an();uo();us();sw=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:ArrayBuffer;e6=e=>Tt(Int8Array,e),r6=e=>Tt(Int16Array,e),Oa=e=>Tt(Int32Array,e),su=e=>Tt(BigInt64Array,e),nt=e=>Tt(Uint8Array,e),n6=e=>Tt(Uint16Array,e),i6=e=>Tt(Uint32Array,e),o6=e=>Tt(BigUint64Array,e),s6=e=>Tt(Float32Array,e),a6=e=>Tt(Float64Array,e),c6=e=>Tt(Uint8ClampedArray,e),ow=e=>(e.next(),e);l6=e=>Fi(Int8Array,e),h6=e=>Fi(Int16Array,e),u6=e=>Fi(Int32Array,e),aw=e=>Fi(Uint8Array,e),f6=e=>Fi(Uint16Array,e),d6=e=>Fi(Uint32Array,e),m6=e=>Fi(Float32Array,e),p6=e=>Fi(Float64Array,e),g6=e=>Fi(Uint8ClampedArray,e);y6=e=>ui(Int8Array,e),w6=e=>ui(Int16Array,e),_6=e=>ui(Int32Array,e),cw=e=>ui(Uint8Array,e),M6=e=>ui(Uint16Array,e),b6=e=>ui(Uint32Array,e),x6=e=>ui(Float32Array,e),S6=e=>ui(Float64Array,e),v6=e=>ui(Uint8ClampedArray,e)});function*E6(e){let t,r=!1,n=[],i,o,s,a=0;function c(){return o==="peek"?In(n,s)[0]:([i,n,a]=In(n,s),i)}({cmd:o,size:s}=(yield null)||{cmd:"read",size:0});let l=aw(e)[Symbol.iterator]();try{do if({done:t,value:i}=Number.isNaN(s-a)?l.next():l.next(s-a),!t&&i.byteLength>0&&(n.push(i),a+=i.byteLength),t||s<=a)do({cmd:o,size:s}=yield c());while(s<a);while(!t)}catch(h){r=!0,typeof l.throw=="function"&&l.throw(h)}finally{r===!1&&typeof l.return=="function"&&l.return(null)}return null}function T6(e){return Gr(this,arguments,function*(){let r,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?In(i,a)[0]:([o,i,c]=In(i,a),o)}({cmd:s,size:a}=(yield yield wt(null))||{cmd:"read",size:0});let h=cw(e)[Symbol.asyncIterator]();try{do if({done:r,value:o}=Number.isNaN(a-c)?yield wt(h.next()):yield wt(h.next(a-c)),!r&&o.byteLength>0&&(i.push(o),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield wt(l()));while(a<c);while(!r)}catch(u){n=!0,typeof h.throw=="function"&&(yield wt(h.throw(u)))}finally{n===!1&&typeof h.return=="function"&&(yield wt(h.return(new Uint8Array(0))))}return yield wt(null)})}function I6(e){return Gr(this,arguments,function*(){let r=!1,n=!1,i=[],o,s,a,c=0;function l(){return s==="peek"?In(i,a)[0]:([o,i,c]=In(i,a),o)}({cmd:s,size:a}=(yield yield wt(null))||{cmd:"read",size:0});let h=new fw(e);try{do if({done:r,value:o}=Number.isNaN(a-c)?yield wt(h.read()):yield wt(h.read(a-c)),!r&&o.byteLength>0&&(i.push(nt(o)),c+=o.byteLength),r||a<=c)do({cmd:s,size:a}=yield yield wt(l()));while(a<c);while(!r)}catch(u){n=!0,yield wt(h.cancel(u))}finally{n===!1?yield wt(h.cancel()):e.locked&&h.releaseLock()}return yield wt(null)})}function A6(e){return Gr(this,arguments,function*(){let r=[],n="error",i=!1,o=null,s,a,c=0,l=[],h;function u(){return s==="peek"?In(l,a)[0]:([h,l,c]=In(l,a),h)}if({cmd:s,size:a}=(yield yield wt(null))||{cmd:"read",size:0},e.isTTY)return yield yield wt(new Uint8Array(0)),yield wt(null);try{r[0]=uw(e,"end"),r[1]=uw(e,"error");do{if(r[2]=uw(e,"readable"),[n,o]=yield wt(Promise.race(r.map(d=>d[2]))),n==="error")break;if((i=n==="end")||(Number.isFinite(a-c)?(h=nt(e.read(a-c)),h.byteLength<a-c&&(h=nt(e.read()))):h=nt(e.read()),h.byteLength>0&&(l.push(h),c+=h.byteLength)),i||a<=c)do({cmd:s,size:a}=yield yield wt(u()));while(a<c)}while(!i)}finally{yield wt(f(r,n==="error"?o:null))}return yield wt(null);function f(d,m){return h=l=null,new Promise((p,g)=>{for(let[y,_]of d)e.off(y,_);try{let y=e.destroy;y&&y.call(e,m),m=void 0}catch(y){m=y||m}finally{m!=null?g(m):p()}})}})}var lr,zm,fw,uw,au=w(()=>{an();Je();lr={fromIterable(e){return zm(E6(e))},fromAsyncIterable(e){return zm(T6(e))},fromDOMStream(e){return zm(I6(e))},fromNodeStream(e){return zm(A6(e))},toDOMStream(e,t){throw new Error('"toDOMStream" not available in this environment')},toNodeStream(e,t){throw new Error('"toNodeStream" not available in this environment')}},zm=e=>(e.next(),e);fw=class{constructor(t){this.source=t,this.reader=null,this.reader=this.source.getReader(),this.reader.closed.catch(()=>{})}get closed(){return this.reader?this.reader.closed.catch(()=>{}):Promise.resolve()}releaseLock(){this.reader&&this.reader.releaseLock(),this.reader=null}cancel(t){return Y(this,void 0,void 0,function*(){let{reader:r,source:n}=this;r&&(yield r.cancel(t).catch(()=>{})),n&&n.locked&&this.releaseLock()})}read(t){return Y(this,void 0,void 0,function*(){if(t===0)return{done:this.reader==null,value:new Uint8Array(0)};let r=yield this.reader.read();return!r.done&&(r.value=nt(r)),r})}},uw=(e,t)=>{let r=i=>n([t,i]),n;return[t,r,new Promise(i=>(n=i)&&e.once(t,r))]}});var Xt,Vm=w(()=>{(function(e){e[e.V1=0]="V1",e[e.V2=1]="V2",e[e.V3=2]="V3",e[e.V4=3]="V4",e[e.V5=4]="V5"})(Xt||(Xt={}))});var jt,dw=w(()=>{(function(e){e[e.Sparse=0]="Sparse",e[e.Dense=1]="Dense"})(jt||(jt={}))});var Vt,mw=w(()=>{(function(e){e[e.HALF=0]="HALF",e[e.SINGLE=1]="SINGLE",e[e.DOUBLE=2]="DOUBLE"})(Vt||(Vt={}))});var Qt,pw=w(()=>{(function(e){e[e.DAY=0]="DAY",e[e.MILLISECOND=1]="MILLISECOND"})(Qt||(Qt={}))});var q,cu=w(()=>{(function(e){e[e.SECOND=0]="SECOND",e[e.MILLISECOND=1]="MILLISECOND",e[e.MICROSECOND=2]="MICROSECOND",e[e.NANOSECOND=3]="NANOSECOND"})(q||(q={}))});var Lt,gw=w(()=>{(function(e){e[e.YEAR_MONTH=0]="YEAR_MONTH",e[e.DAY_TIME=1]="DAY_TIME",e[e.MONTH_DAY_NANO=2]="MONTH_DAY_NANO"})(Lt||(Lt={}))});var km=w(()=>{});var Ui,qm,jm,_l,yw=w(()=>{Ui=new Int32Array(2),qm=new Float32Array(Ui.buffer),jm=new Float64Array(Ui.buffer),_l=new Uint16Array(new Uint8Array([1,0]).buffer)[0]===1});var lu,ww=w(()=>{(function(e){e[e.UTF8_BYTES=1]="UTF8_BYTES",e[e.UTF16_STRING=2]="UTF16_STRING"})(lu||(lu={}))});var hr,_w=w(()=>{km();ww();yw();hr=class e{constructor(t){this.bytes_=t,this.position_=0,this.text_decoder_=new TextDecoder}static allocate(t){return new e(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 Ui[0]=this.readInt32(t),qm[0]}readFloat64(t){return Ui[_l?0:1]=this.readInt32(t),Ui[_l?1:0]=this.readInt32(t+4),jm[0]}writeInt8(t,r){this.bytes_[t]=r}writeUint8(t,r){this.bytes_[t]=r}writeInt16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeUint16(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8}writeInt32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeUint32(t,r){this.bytes_[t]=r,this.bytes_[t+1]=r>>8,this.bytes_[t+2]=r>>16,this.bytes_[t+3]=r>>24}writeInt64(t,r){this.writeInt32(t,Number(BigInt.asIntN(32,r))),this.writeInt32(t+4,Number(BigInt.asIntN(32,r>>BigInt(32))))}writeUint64(t,r){this.writeUint32(t,Number(BigInt.asUintN(32,r))),this.writeUint32(t+4,Number(BigInt.asUintN(32,r>>BigInt(32))))}writeFloat32(t,r){qm[0]=r,this.writeInt32(t,Ui[0])}writeFloat64(t,r){jm[0]=r,this.writeInt32(t,Ui[_l?0:1]),this.writeInt32(t+4,Ui[_l?1:0])}getBufferIdentifier(){if(this.bytes_.length<this.position_+4+4)throw new Error("FlatBuffers: ByteBuffer is too short to contain an identifier.");let t="";for(let r=0;r<4;r++)t+=String.fromCharCode(this.readInt8(this.position_+4+r));return t}__offset(t,r){let n=t-this.readInt32(t);return r<this.readInt16(n)?this.readInt16(n+r):0}__union(t,r){return t.bb_pos=r+this.readInt32(r),t.bb=this,t}__string(t,r){t+=this.readInt32(t);let n=this.readInt32(t);t+=4;let i=this.bytes_.subarray(t,t+n);return r===lu.UTF8_BYTES?i:this.text_decoder_.decode(i)}__union_with_string(t,r){return typeof t=="string"?this.__string(r):this.__union(t,r)}__indirect(t){return t+this.readInt32(t)}__vector(t){return t+this.readInt32(t)+4}__vector_len(t){return this.readInt32(t+this.readInt32(t))}__has_identifier(t){if(t.length!=4)throw new Error("FlatBuffers: file identifier must be length "+4);for(let r=0;r<4;r++)if(t.charCodeAt(r)!=this.readInt8(this.position()+4+r))return!1;return!0}createScalarList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o)}return n}createObjList(t,r){let n=[];for(let i=0;i<r;++i){let o=t(i);o!==null&&n.push(o.unpack())}return n}}});var Ba,l3=w(()=>{_w();km();Ba=class e{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 r;t?r=t:r=1024,this.bb=hr.allocate(r),this.space=r}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,r){t>this.minalign&&(this.minalign=t);let n=~(this.bb.capacity()-this.space+r)+1&t-1;for(;this.space<n+t+r;){let i=this.bb.capacity();this.bb=e.growByteBuffer(this.bb),this.space+=this.bb.capacity()-i}this.pad(n)}pad(t){for(let r=0;r<t;r++)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,r,n){(this.force_defaults||r!=n)&&(this.addInt8(r),this.slot(t))}addFieldInt16(t,r,n){(this.force_defaults||r!=n)&&(this.addInt16(r),this.slot(t))}addFieldInt32(t,r,n){(this.force_defaults||r!=n)&&(this.addInt32(r),this.slot(t))}addFieldInt64(t,r,n){(this.force_defaults||r!==n)&&(this.addInt64(r),this.slot(t))}addFieldFloat32(t,r,n){(this.force_defaults||r!=n)&&(this.addFloat32(r),this.slot(t))}addFieldFloat64(t,r,n){(this.force_defaults||r!=n)&&(this.addFloat64(r),this.slot(t))}addFieldOffset(t,r,n){(this.force_defaults||r!=n)&&(this.addOffset(r),this.slot(t))}addFieldStruct(t,r,n){r!=n&&(this.nested(r),this.slot(t))}nested(t){if(t!=this.offset())throw new TypeError("FlatBuffers: struct must be serialized inline.")}notNested(){if(this.isNested)throw new TypeError("FlatBuffers: object serialization must not be nested.")}slot(t){this.vtable!==null&&(this.vtable[t]=this.offset())}offset(){return this.bb.capacity()-this.space}static growByteBuffer(t){let r=t.capacity();if(r&3221225472)throw new Error("FlatBuffers: cannot grow buffer beyond 2 gigabytes.");let n=r<<1,i=hr.allocate(n);return i.setPosition(n-r),i.bytes().set(t.bytes(),n-r),i}addOffset(t){this.prep(4,0),this.writeInt32(this.offset()-t+4)}startObject(t){this.notNested(),this.vtable==null&&(this.vtable=[]),this.vtable_in_use=t;for(let r=0;r<t;r++)this.vtable[r]=0;this.isNested=!0,this.object_start=this.offset()}endObject(){if(this.vtable==null||!this.isNested)throw new Error("FlatBuffers: endObject called without startObject");this.addInt32(0);let t=this.offset(),r=this.vtable_in_use-1;for(;r>=0&&this.vtable[r]==0;r--);let n=r+1;for(;r>=0;r--)this.addInt16(this.vtable[r]!=0?t-this.vtable[r]:0);let i=2;this.addInt16(t-this.object_start);let o=(n+i)*2;this.addInt16(o);let s=0,a=this.space;t:for(r=0;r<this.vtables.length;r++){let c=this.bb.capacity()-this.vtables[r];if(o==this.bb.readInt16(c)){for(let l=2;l<o;l+=2)if(this.bb.readInt16(a+l)!=this.bb.readInt16(c+l))continue t;s=this.vtables[r];break}}return s?(this.space=this.bb.capacity()-t,this.bb.writeInt32(this.space,s-t)):(this.vtables.push(this.offset()),this.bb.writeInt32(this.bb.capacity()-t,this.offset()-t)),this.isNested=!1,t}finish(t,r,n){let i=n?4:0;if(r){let o=r;if(this.prep(this.minalign,8+i),o.length!=4)throw new TypeError("FlatBuffers: file identifier must be length "+4);for(let s=3;s>=0;s--)this.writeInt8(o.charCodeAt(s))}this.prep(this.minalign,4+i),this.addOffset(t),i&&this.addInt32(this.bb.capacity()-this.space),this.bb.setPosition(this.space)}finishSizePrefixed(t,r){this.finish(t,r,!0)}requiredField(t,r){let n=this.bb.capacity()-t,i=n-this.bb.readInt32(n);if(!(r<this.bb.readInt16(i)&&this.bb.readInt16(i+r)!=0))throw new TypeError("FlatBuffers: field "+r+" must be set")}startVector(t,r,n){this.notNested(),this.vector_num_elems=r,this.prep(4,t*r),this.prep(n,t*r)}endVector(){return this.writeInt32(this.vector_num_elems),this.offset()}createSharedString(t){if(!t)return 0;if(this.string_maps||(this.string_maps=new Map),this.string_maps.has(t))return this.string_maps.get(t);let r=this.createString(t);return this.string_maps.set(t,r),r}createString(t){if(t==null)return 0;let r;return t instanceof Uint8Array?r=t:r=this.text_encoder.encode(t),this.addInt8(0),this.startVector(1,r.length,1),this.bb.setPosition(this.space-=r.length),this.bb.bytes().set(r,this.space),this.endVector()}createByteVector(t){return t==null?0:(this.startVector(1,t.length,1),this.bb.setPosition(this.space-=t.length),this.bb.bytes().set(t,this.space),this.endVector())}createObjectOffset(t){return t===null?0:typeof t=="string"?this.createString(t):t.pack(this)}createObjectOffsetList(t){let r=[];for(let n=0;n<t.length;++n){let i=t[n];if(i!==null)r.push(this.createObjectOffset(i));else throw new TypeError("FlatBuffers: Argument for createObjectOffsetList cannot contain null.")}return r}createStructOffsetList(t,r){return r(this,t.length),this.createObjectOffsetList(t.slice().reverse()),this.endVector()}}});var Gt=w(()=>{km();yw();l3();_w();ww()});var La,Mw=w(()=>{(function(e){e[e.BUFFER=0]="BUFFER"})(La||(La={}))});var ur,Ml=w(()=>{(function(e){e[e.LZ4_FRAME=0]="LZ4_FRAME",e[e.ZSTD=1]="ZSTD"})(ur||(ur={}))});var fo,bw=w(()=>{Gt();Mw();Ml();fo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBodyCompression(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBodyCompression(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}codec(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt8(this.bb_pos+t):ur.LZ4_FRAME}method(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt8(this.bb_pos+t):La.BUFFER}static startBodyCompression(t){t.startObject(2)}static addCodec(t,r){t.addFieldInt8(0,r,ur.LZ4_FRAME)}static addMethod(t,r){t.addFieldInt8(1,r,La.BUFFER)}static endBodyCompression(t){return t.endObject()}static createBodyCompression(t,r,n){return e.startBodyCompression(t),e.addCodec(t,r),e.addMethod(t,n),e.endBodyCompression(t)}}});var bl,xw=w(()=>{bl=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,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,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}}});var xl,Sw=w(()=>{xl=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,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,r,n){return t.prep(8,16),t.writeInt64(BigInt(n??0)),t.writeInt64(BigInt(r??0)),t.offset()}}});var br,vw=w(()=>{Gt();bw();xw();Sw();br=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsRecordBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsRecordBatch(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}length(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}nodes(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new xl).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}nodesLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}buffers(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new bl).__init(this.bb.__vector(this.bb_pos+n)+t*16,this.bb):null}buffersLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}compression(t){let r=this.bb.__offset(this.bb_pos,10);return r?(t||new fo).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}variadicBufferCounts(t){let r=this.bb.__offset(this.bb_pos,12);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}variadicBufferCountsLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startRecordBatch(t){t.startObject(5)}static addLength(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addNodes(t,r){t.addFieldOffset(1,r,0)}static startNodesVector(t,r){t.startVector(16,r,8)}static addBuffers(t,r){t.addFieldOffset(2,r,0)}static startBuffersVector(t,r){t.startVector(16,r,8)}static addCompression(t,r){t.addFieldOffset(3,r,0)}static addVariadicBufferCounts(t,r){t.addFieldOffset(4,r,0)}static createVariadicBufferCountsVector(t,r){t.startVector(8,r.length,8);for(let n=r.length-1;n>=0;n--)t.addInt64(r[n]);return t.endVector()}static startVariadicBufferCountsVector(t,r){t.startVector(8,r,8)}static endRecordBatch(t){return t.endObject()}}});var mo,h3=w(()=>{Gt();vw();mo=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryBatch(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryBatch(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}data(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new br).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isDelta(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startDictionaryBatch(t){t.startObject(3)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addData(t,r){t.addFieldOffset(1,r,0)}static addIsDelta(t,r){t.addFieldInt8(2,+r,0)}static endDictionaryBatch(t){return t.endObject()}}});var fs,Ew=w(()=>{(function(e){e[e.Little=0]="Little",e[e.Big=1]="Big"})(fs||(fs={}))});var hu,u3=w(()=>{(function(e){e[e.DenseArray=0]="DenseArray"})(hu||(hu={}))});var di,Hm=w(()=>{Gt();di=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInt(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInt(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}bitWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}isSigned(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startInt(t){t.startObject(2)}static addBitWidth(t,r){t.addFieldInt32(0,r,0)}static addIsSigned(t,r){t.addFieldInt8(1,+r,0)}static endInt(t){return t.endObject()}static createInt(t,r,n){return e.startInt(t),e.addBitWidth(t,r),e.addIsSigned(t,n),e.endInt(t)}}});var Gi,Tw=w(()=>{Gt();u3();Hm();Gi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDictionaryEncoding(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDictionaryEncoding(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}id(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}indexType(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new di).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}isOrdered(){let t=this.bb.__offset(this.bb_pos,8);return t?!!this.bb.readInt8(this.bb_pos+t):!1}dictionaryKind(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt16(this.bb_pos+t):hu.DenseArray}static startDictionaryEncoding(t){t.startObject(4)}static addId(t,r){t.addFieldInt64(0,r,BigInt("0"))}static addIndexType(t,r){t.addFieldOffset(1,r,0)}static addIsOrdered(t,r){t.addFieldInt8(2,+r,0)}static addDictionaryKind(t,r){t.addFieldInt16(3,r,hu.DenseArray)}static endDictionaryEncoding(t){return t.endObject()}}});var Ce,Sl=w(()=>{Gt();Ce=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsKeyValue(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsKeyValue(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}key(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}value(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startKeyValue(t){t.startObject(2)}static addKey(t,r){t.addFieldOffset(0,r,0)}static addValue(t,r){t.addFieldOffset(1,r,0)}static endKeyValue(t){return t.endObject()}static createKeyValue(t,r,n){return e.startKeyValue(t),e.addKey(t,r),e.addValue(t,n),e.endKeyValue(t)}}});var uu,f3=w(()=>{Gt();uu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinary(t){t.startObject(0)}static endBinary(t){return t.endObject()}static createBinary(t){return e.startBinary(t),e.endBinary(t)}}});var fu,d3=w(()=>{Gt();fu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBinaryView(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBinaryView(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBinaryView(t){t.startObject(0)}static endBinaryView(t){return t.endObject()}static createBinaryView(t){return e.startBinaryView(t),e.endBinaryView(t)}}});var du,m3=w(()=>{Gt();du=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsBool(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsBool(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startBool(t){t.startObject(0)}static endBool(t){return t.endObject()}static createBool(t){return e.startBool(t),e.endBool(t)}}});var ds,Iw=w(()=>{Gt();pw();ds=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDate(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDate(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Qt.MILLISECOND}static startDate(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,Qt.MILLISECOND)}static endDate(t){return t.endObject()}static createDate(t,r){return e.startDate(t),e.addUnit(t,r),e.endDate(t)}}});var zi,Aw=w(()=>{Gt();zi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDecimal(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDecimal(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}scale(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):0}bitWidth(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readInt32(this.bb_pos+t):128}static startDecimal(t){t.startObject(3)}static addPrecision(t,r){t.addFieldInt32(0,r,0)}static addScale(t,r){t.addFieldInt32(1,r,0)}static addBitWidth(t,r){t.addFieldInt32(2,r,128)}static endDecimal(t){return t.endObject()}static createDecimal(t,r,n,i){return e.startDecimal(t),e.addPrecision(t,r),e.addScale(t,n),e.addBitWidth(t,i),e.endDecimal(t)}}});var ms,Pw=w(()=>{Gt();cu();ms=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsDuration(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsDuration(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):q.MILLISECOND}static startDuration(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,q.MILLISECOND)}static endDuration(t){return t.endObject()}static createDuration(t,r){return e.startDuration(t),e.addUnit(t,r),e.endDuration(t)}}});var ps,Rw=w(()=>{Gt();ps=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}byteWidth(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeBinary(t){t.startObject(1)}static addByteWidth(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeBinary(t){return t.endObject()}static createFixedSizeBinary(t,r){return e.startFixedSizeBinary(t),e.addByteWidth(t,r),e.endFixedSizeBinary(t)}}});var gs,Cw=w(()=>{Gt();gs=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFixedSizeList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFixedSizeList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}listSize(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt32(this.bb_pos+t):0}static startFixedSizeList(t){t.startObject(1)}static addListSize(t,r){t.addFieldInt32(0,r,0)}static endFixedSizeList(t){return t.endObject()}static createFixedSizeList(t,r){return e.startFixedSizeList(t),e.addListSize(t,r),e.endFixedSizeList(t)}}});var ys,Nw=w(()=>{Gt();mw();ys=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFloatingPoint(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFloatingPoint(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}precision(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Vt.HALF}static startFloatingPoint(t){t.startObject(1)}static addPrecision(t,r){t.addFieldInt16(0,r,Vt.HALF)}static endFloatingPoint(t){return t.endObject()}static createFloatingPoint(t,r){return e.startFloatingPoint(t),e.addPrecision(t,r),e.endFloatingPoint(t)}}});var ws,Ow=w(()=>{Gt();gw();ws=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsInterval(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsInterval(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Lt.YEAR_MONTH}static startInterval(t){t.startObject(1)}static addUnit(t,r){t.addFieldInt16(0,r,Lt.YEAR_MONTH)}static endInterval(t){return t.endObject()}static createInterval(t,r){return e.startInterval(t),e.addUnit(t,r),e.endInterval(t)}}});var mu,p3=w(()=>{Gt();mu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeBinary(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeBinary(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeBinary(t){t.startObject(0)}static endLargeBinary(t){return t.endObject()}static createLargeBinary(t){return e.startLargeBinary(t),e.endLargeBinary(t)}}});var pu,g3=w(()=>{Gt();pu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeList(t){t.startObject(0)}static endLargeList(t){return t.endObject()}static createLargeList(t){return e.startLargeList(t),e.endLargeList(t)}}});var gu,y3=w(()=>{Gt();gu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsLargeUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsLargeUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startLargeUtf8(t){t.startObject(0)}static endLargeUtf8(t){return t.endObject()}static createLargeUtf8(t){return e.startLargeUtf8(t),e.endLargeUtf8(t)}}});var yu,w3=w(()=>{Gt();yu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsList(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsList(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startList(t){t.startObject(0)}static endList(t){return t.endObject()}static createList(t){return e.startList(t),e.endList(t)}}});var _s,Bw=w(()=>{Gt();_s=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMap(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMap(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}keysSorted(){let t=this.bb.__offset(this.bb_pos,4);return t?!!this.bb.readInt8(this.bb_pos+t):!1}static startMap(t){t.startObject(1)}static addKeysSorted(t,r){t.addFieldInt8(0,+r,0)}static endMap(t){return t.endObject()}static createMap(t,r){return e.startMap(t),e.addKeysSorted(t,r),e.endMap(t)}}});var wu,_3=w(()=>{Gt();wu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsNull(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsNull(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startNull(t){t.startObject(0)}static endNull(t){return t.endObject()}static createNull(t){return e.startNull(t),e.endNull(t)}}});var _u,M3=w(()=>{Gt();_u=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsStruct_(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsStruct_(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startStruct_(t){t.startObject(0)}static endStruct_(t){return t.endObject()}static createStruct_(t){return e.startStruct_(t),e.endStruct_(t)}}});var po,Lw=w(()=>{Gt();cu();po=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTime(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTime(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):q.MILLISECOND}bitWidth(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readInt32(this.bb_pos+t):32}static startTime(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,q.MILLISECOND)}static addBitWidth(t,r){t.addFieldInt32(1,r,32)}static endTime(t){return t.endObject()}static createTime(t,r,n){return e.startTime(t),e.addUnit(t,r),e.addBitWidth(t,n),e.endTime(t)}}});var go,Dw=w(()=>{Gt();cu();go=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsTimestamp(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsTimestamp(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}unit(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):q.SECOND}timezone(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.__string(this.bb_pos+r,t):null}static startTimestamp(t){t.startObject(2)}static addUnit(t,r){t.addFieldInt16(0,r,q.SECOND)}static addTimezone(t,r){t.addFieldOffset(1,r,0)}static endTimestamp(t){return t.endObject()}static createTimestamp(t,r,n){return e.startTimestamp(t),e.addUnit(t,r),e.addTimezone(t,n),e.endTimestamp(t)}}});var mi,Fw=w(()=>{Gt();dw();mi=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUnion(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUnion(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}mode(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):jt.Sparse}typeIds(t){let r=this.bb.__offset(this.bb_pos,6);return r?this.bb.readInt32(this.bb.__vector(this.bb_pos+r)+t*4):0}typeIdsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}typeIdsArray(){let t=this.bb.__offset(this.bb_pos,6);return t?new Int32Array(this.bb.bytes().buffer,this.bb.bytes().byteOffset+this.bb.__vector(this.bb_pos+t),this.bb.__vector_len(this.bb_pos+t)):null}static startUnion(t){t.startObject(2)}static addMode(t,r){t.addFieldInt16(0,r,jt.Sparse)}static addTypeIds(t,r){t.addFieldOffset(1,r,0)}static createTypeIdsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addInt32(r[n]);return t.endVector()}static startTypeIdsVector(t,r){t.startVector(4,r,4)}static endUnion(t){return t.endObject()}static createUnion(t,r,n){return e.startUnion(t),e.addMode(t,r),e.addTypeIds(t,n),e.endUnion(t)}}});var Mu,b3=w(()=>{Gt();Mu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8(t){t.startObject(0)}static endUtf8(t){return t.endObject()}static createUtf8(t){return e.startUtf8(t),e.endUtf8(t)}}});var bu,x3=w(()=>{Gt();bu=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsUtf8View(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsUtf8View(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static startUtf8View(t){t.startObject(0)}static endUtf8View(t){return t.endObject()}static createUtf8View(t){return e.startUtf8View(t),e.endUtf8View(t)}}});var lt,$m=w(()=>{(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.FloatingPoint=3]="FloatingPoint",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct_=13]="Struct_",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.RunEndEncoded=22]="RunEndEncoded",e[e.BinaryView=23]="BinaryView",e[e.Utf8View=24]="Utf8View",e[e.ListView=25]="ListView",e[e.LargeListView=26]="LargeListView"})(lt||(lt={}))});var xr,Uw=w(()=>{Gt();Tw();Sl();$m();xr=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsField(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsField(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}name(t){let r=this.bb.__offset(this.bb_pos,4);return r?this.bb.__string(this.bb_pos+r,t):null}nullable(){let t=this.bb.__offset(this.bb_pos,6);return t?!!this.bb.readInt8(this.bb_pos+t):!1}typeType(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.readUint8(this.bb_pos+t):lt.NONE}type(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.__union(t,this.bb_pos+r):null}dictionary(t){let r=this.bb.__offset(this.bb_pos,12);return r?(t||new Gi).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}children(t,r){let n=this.bb.__offset(this.bb_pos,14);return n?(r||new e).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}childrenLength(){let t=this.bb.__offset(this.bb_pos,14);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,16);return n?(r||new Ce).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,16);return t?this.bb.__vector_len(this.bb_pos+t):0}static startField(t){t.startObject(7)}static addName(t,r){t.addFieldOffset(0,r,0)}static addNullable(t,r){t.addFieldInt8(1,+r,0)}static addTypeType(t,r){t.addFieldInt8(2,r,lt.NONE)}static addType(t,r){t.addFieldOffset(3,r,0)}static addDictionary(t,r){t.addFieldOffset(4,r,0)}static addChildren(t,r){t.addFieldOffset(5,r,0)}static createChildrenVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startChildrenVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(6,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endField(t){return t.endObject()}}});var cn,Gw=w(()=>{Gt();Ew();Uw();Sl();cn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsSchema(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsSchema(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}endianness(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):fs.Little}fields(t,r){let n=this.bb.__offset(this.bb_pos,6);return n?(r||new xr).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}fieldsLength(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new Ce).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}features(t){let r=this.bb.__offset(this.bb_pos,10);return r?this.bb.readInt64(this.bb.__vector(this.bb_pos+r)+t*8):BigInt(0)}featuresLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}static startSchema(t){t.startObject(4)}static addEndianness(t,r){t.addFieldInt16(0,r,fs.Little)}static addFields(t,r){t.addFieldOffset(1,r,0)}static createFieldsVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startFieldsVector(t,r){t.startVector(4,r,4)}static addCustomMetadata(t,r){t.addFieldOffset(2,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static addFeatures(t,r){t.addFieldOffset(3,r,0)}static createFeaturesVector(t,r){t.startVector(8,r.length,8);for(let n=r.length-1;n>=0;n--)t.addInt64(r[n]);return t.endVector()}static startFeaturesVector(t,r){t.startVector(8,r,8)}static endSchema(t){return t.endObject()}static createSchema(t,r,n,i,o){return e.startSchema(t),e.addEndianness(t,r),e.addFields(t,n),e.addCustomMetadata(t,i),e.addFeatures(t,o),e.endSchema(t)}}});var Nt,Ym=w(()=>{(function(e){e[e.NONE=0]="NONE",e[e.Schema=1]="Schema",e[e.DictionaryBatch=2]="DictionaryBatch",e[e.RecordBatch=3]="RecordBatch",e[e.Tensor=4]="Tensor",e[e.SparseTensor=5]="SparseTensor"})(Nt||(Nt={}))});var x,xe,Ne=w(()=>{Vm();dw();mw();pw();cu();gw();Ym();(function(e){e[e.NONE=0]="NONE",e[e.Null=1]="Null",e[e.Int=2]="Int",e[e.Float=3]="Float",e[e.Binary=4]="Binary",e[e.Utf8=5]="Utf8",e[e.Bool=6]="Bool",e[e.Decimal=7]="Decimal",e[e.Date=8]="Date",e[e.Time=9]="Time",e[e.Timestamp=10]="Timestamp",e[e.Interval=11]="Interval",e[e.List=12]="List",e[e.Struct=13]="Struct",e[e.Union=14]="Union",e[e.FixedSizeBinary=15]="FixedSizeBinary",e[e.FixedSizeList=16]="FixedSizeList",e[e.Map=17]="Map",e[e.Duration=18]="Duration",e[e.LargeBinary=19]="LargeBinary",e[e.LargeUtf8=20]="LargeUtf8",e[e.LargeList=21]="LargeList",e[e.BinaryView=23]="BinaryView",e[e.Utf8View=24]="Utf8View",e[e.Dictionary=-1]="Dictionary",e[e.Int8=-2]="Int8",e[e.Int16=-3]="Int16",e[e.Int32=-4]="Int32",e[e.Int64=-5]="Int64",e[e.Uint8=-6]="Uint8",e[e.Uint16=-7]="Uint16",e[e.Uint32=-8]="Uint32",e[e.Uint64=-9]="Uint64",e[e.Float16=-10]="Float16",e[e.Float32=-11]="Float32",e[e.Float64=-12]="Float64",e[e.DateDay=-13]="DateDay",e[e.DateMillisecond=-14]="DateMillisecond",e[e.TimestampSecond=-15]="TimestampSecond",e[e.TimestampMillisecond=-16]="TimestampMillisecond",e[e.TimestampMicrosecond=-17]="TimestampMicrosecond",e[e.TimestampNanosecond=-18]="TimestampNanosecond",e[e.TimeSecond=-19]="TimeSecond",e[e.TimeMillisecond=-20]="TimeMillisecond",e[e.TimeMicrosecond=-21]="TimeMicrosecond",e[e.TimeNanosecond=-22]="TimeNanosecond",e[e.DenseUnion=-23]="DenseUnion",e[e.SparseUnion=-24]="SparseUnion",e[e.IntervalDayTime=-25]="IntervalDayTime",e[e.IntervalYearMonth=-26]="IntervalYearMonth",e[e.DurationSecond=-27]="DurationSecond",e[e.DurationMillisecond=-28]="DurationMillisecond",e[e.DurationMicrosecond=-29]="DurationMicrosecond",e[e.DurationNanosecond=-30]="DurationNanosecond",e[e.IntervalMonthDayNano=-31]="IntervalMonthDayNano"})(x||(x={}));(function(e){e[e.OFFSET=0]="OFFSET",e[e.DATA=1]="DATA",e[e.VALIDITY=2]="VALIDITY",e[e.TYPE=3]="TYPE"})(xe||(xe={}))});var zw={};Zr(zw,{valueToString:()=>pi});function pi(e){if(e===null)return"null";if(e===void 0)return"undefined";switch(typeof e){case"number":return`${e}`;case"bigint":return`${e}`;case"string":return`"${e}"`}return typeof e[Symbol.toPrimitive]=="function"?e[Symbol.toPrimitive]("string"):ArrayBuffer.isView(e)?e instanceof BigInt64Array||e instanceof BigUint64Array?`[${[...e].map(t=>pi(t))}]`:`[${e}]`:ArrayBuffer.isView(e)?`[${e}]`:JSON.stringify(e,(t,r)=>typeof r=="bigint"?`${r}`:r)}var xu=w(()=>{});function It(e){if(typeof e=="bigint"&&(e<Number.MIN_SAFE_INTEGER||e>Number.MAX_SAFE_INTEGER))throw new TypeError(`${e} is not safe to convert to a number.`);return Number(e)}function Vw(e,t){return It(e/t)+It(e%t)/It(t)}var Vi=w(()=>{});var jw={};Zr(jw,{BN:()=>Da,bigNumToBigInt:()=>v3,bigNumToNumber:()=>qw,bigNumToString:()=>Tl,isArrowBigNumSymbol:()=>S3});function gi(e,...t){return t.length===0?Object.setPrototypeOf(Tt(this.TypedArray,e),this.constructor.prototype):Object.setPrototypeOf(new this.TypedArray(e,...t),this.constructor.prototype)}function vl(...e){return gi.apply(this,e)}function El(...e){return gi.apply(this,e)}function Su(...e){return gi.apply(this,e)}function qw(e,t){let{buffer:r,byteOffset:n,byteLength:i,signed:o}=e,s=new BigUint64Array(r,n,i/8),a=o&&s.at(-1)&BigInt(1)<<BigInt(63),c=BigInt(0),l=0;if(a){for(let h of s)c|=(h^R6)*(BigInt(1)<<BigInt(64*l++));c*=BigInt(-1),c-=BigInt(1)}else for(let h of s)c|=h*(BigInt(1)<<BigInt(64*l++));if(typeof t=="number"&&t>0){let h=BigInt("1".padEnd(t+1,"0")),u=c/h,f=a?-(c%h):c%h,d=It(u),m=`${f}`.padStart(t,"0");return+`${a&&d===0?"-":""}${d}.${m}`}return It(c)}function Tl(e){if(e.byteLength===8)return`${new e.BigIntArray(e.buffer,e.byteOffset,1)[0]}`;if(!e.signed)return kw(e);let t=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2);if(new Int16Array([t.at(-1)])[0]>=0)return kw(e);t=t.slice();let n=1;for(let o=0;o<t.length;o++){let s=t[o],a=~s+n;t[o]=a,n&=s===0?1:0}return`-${kw(t)}`}function v3(e){return e.byteLength===8?new e.BigIntArray(e.buffer,e.byteOffset,1)[0]:Tl(e)}function kw(e){let t="",r=new Uint32Array(2),n=new Uint16Array(e.buffer,e.byteOffset,e.byteLength/2),i=new Uint32Array((n=new Uint16Array(n).reverse()).buffer),o=-1,s=n.length-1;do{for(r[0]=n[o=0];o<s;)n[o++]=r[1]=r[0]/10,r[0]=(r[0]-r[1]*10<<16)+n[o];n[o]=r[1]=r[0]/10,r[0]=r[0]-r[1]*10,t=`${r[0]}${t}`}while(i[0]||i[1]||i[2]||i[3]);return t??"0"}var S3,P6,R6,Da,Km=w(()=>{Je();Vi();S3=Symbol.for("isArrowBigNum");gi.prototype[S3]=!0;gi.prototype.toJSON=function(){return`"${Tl(this)}"`};gi.prototype.valueOf=function(e){return qw(this,e)};gi.prototype.toString=function(){return Tl(this)};gi.prototype[Symbol.toPrimitive]=function(e="default"){switch(e){case"number":return qw(this);case"string":return Tl(this);case"default":return v3(this)}return Tl(this)};Object.setPrototypeOf(vl.prototype,Object.create(Int32Array.prototype));Object.setPrototypeOf(El.prototype,Object.create(Uint32Array.prototype));Object.setPrototypeOf(Su.prototype,Object.create(Uint32Array.prototype));Object.assign(vl.prototype,gi.prototype,{constructor:vl,signed:!0,TypedArray:Int32Array,BigIntArray:BigInt64Array});Object.assign(El.prototype,gi.prototype,{constructor:El,signed:!1,TypedArray:Uint32Array,BigIntArray:BigUint64Array});Object.assign(Su.prototype,gi.prototype,{constructor:Su,signed:!0,TypedArray:Uint32Array,BigIntArray:BigUint64Array});P6=BigInt(4294967296)*BigInt(4294967296),R6=P6-BigInt(1);Da=class e{static new(t,r){switch(r){case!0:return new vl(t);case!1:return new El(t)}switch(t.constructor){case Int8Array:case Int16Array:case Int32Array:case BigInt64Array:return new vl(t)}return t.byteLength===16?new Su(t):new El(t)}static signed(t){return new vl(t)}static unsigned(t){return new El(t)}static decimal(t){return new Su(t)}constructor(t,r){return e.new(t,r)}}});function Ln(e){let t=e;switch(e.typeId){case x.Decimal:return e.bitWidth/32;case x.Interval:return t.unit===Lt.MONTH_DAY_NANO?4:1+t.unit;case x.BinaryView:case x.Utf8View:return 16;case x.FixedSizeList:return t.listSize;case x.FixedSizeBinary:return t.byteWidth;default:return 1}}var E3,T3,I3,A3,P3,R3,C3,N3,O3,B3,L3,D3,F3,U3,G3,z3,V3,k3,q3,j3,W3,H3,$3,Y3,K3,X3,z,De,Se,An,Pn,Ve,Rn,Cn,Nn,Vr,yi,Sr,wi,kr,On,ln,Mt,_i,vr,qr,Mi,Er,hn,jr,Ms,bs,fr,xs,Ss,vs,Es,dr,Ts,ki,Is,As,Tr,Ps,Rs,vu,Wr,Eu,Tu,Iu,Au,je,Bn,Yt,Hr,yo,Cs,un,_e,Ir,C6,We,te=w(()=>{Vi();Ne();X3=Symbol.for("apache-arrow/DataType"),z=class e{static isDataType(t){return t?.[X3]===!0}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 isBinaryView(t){return t?.typeId===x.BinaryView}static isLargeBinary(t){return t?.typeId===x.LargeBinary}static isUtf8(t){return t?.typeId===x.Utf8}static isUtf8View(t){return t?.typeId===x.Utf8View}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 isLargeList(t){return t?.typeId===x.LargeList}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 e.isUnion(t)&&t.mode===jt.Dense}static isSparseUnion(t){return e.isUnion(t)&&t.mode===jt.Sparse}constructor(t){this.typeId=t}};E3=Symbol.toStringTag;z[E3]=(e=>(e.children=null,e.ArrayType=Array,e.OffsetArrayType=Int32Array,e[X3]=!0,e[Symbol.toStringTag]="DataType"))(z.prototype);De=class extends z{constructor(){super(x.Null)}toString(){return"Null"}};T3=Symbol.toStringTag;De[T3]=(e=>e[Symbol.toStringTag]="Null")(De.prototype);Se=class extends z{constructor(t,r){super(x.Int),this.isSigned=t,this.bitWidth=r}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}`}};I3=Symbol.toStringTag;Se[I3]=(e=>(e.isSigned=null,e.bitWidth=null,e[Symbol.toStringTag]="Int"))(Se.prototype);An=class extends Se{constructor(){super(!0,8)}get ArrayType(){return Int8Array}},Pn=class extends Se{constructor(){super(!0,16)}get ArrayType(){return Int16Array}},Ve=class extends Se{constructor(){super(!0,32)}get ArrayType(){return Int32Array}},Rn=class extends Se{constructor(){super(!0,64)}get ArrayType(){return BigInt64Array}},Cn=class extends Se{constructor(){super(!1,8)}get ArrayType(){return Uint8Array}},Nn=class extends Se{constructor(){super(!1,16)}get ArrayType(){return Uint16Array}},Vr=class extends Se{constructor(){super(!1,32)}get ArrayType(){return Uint32Array}},yi=class extends Se{constructor(){super(!1,64)}get ArrayType(){return BigUint64Array}};Object.defineProperty(An.prototype,"ArrayType",{value:Int8Array});Object.defineProperty(Pn.prototype,"ArrayType",{value:Int16Array});Object.defineProperty(Ve.prototype,"ArrayType",{value:Int32Array});Object.defineProperty(Rn.prototype,"ArrayType",{value:BigInt64Array});Object.defineProperty(Cn.prototype,"ArrayType",{value:Uint8Array});Object.defineProperty(Nn.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(Vr.prototype,"ArrayType",{value:Uint32Array});Object.defineProperty(yi.prototype,"ArrayType",{value:BigUint64Array});Sr=class extends z{constructor(t){super(x.Float),this.precision=t}get ArrayType(){switch(this.precision){case Vt.HALF:return Uint16Array;case Vt.SINGLE:return Float32Array;case Vt.DOUBLE:return Float64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}toString(){return`Float${this.precision<<5||16}`}};A3=Symbol.toStringTag;Sr[A3]=(e=>(e.precision=null,e[Symbol.toStringTag]="Float"))(Sr.prototype);wi=class extends Sr{constructor(){super(Vt.HALF)}},kr=class extends Sr{constructor(){super(Vt.SINGLE)}},On=class extends Sr{constructor(){super(Vt.DOUBLE)}};Object.defineProperty(wi.prototype,"ArrayType",{value:Uint16Array});Object.defineProperty(kr.prototype,"ArrayType",{value:Float32Array});Object.defineProperty(On.prototype,"ArrayType",{value:Float64Array});ln=class extends z{constructor(){super(x.Binary)}toString(){return"Binary"}};P3=Symbol.toStringTag;ln[P3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Binary"))(ln.prototype);Mt=class extends z{constructor(){super(x.BinaryView)}toString(){return"BinaryView"}};R3=Symbol.toStringTag;Mt.ELEMENT_WIDTH=16;Mt.INLINE_CAPACITY=12;Mt.LENGTH_OFFSET=0;Mt.INLINE_OFFSET=4;Mt.BUFFER_INDEX_OFFSET=8;Mt.BUFFER_OFFSET_OFFSET=12;Mt[R3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="BinaryView"))(Mt.prototype);_i=class extends z{constructor(){super(x.LargeBinary)}toString(){return"LargeBinary"}};C3=Symbol.toStringTag;_i[C3]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeBinary"))(_i.prototype);vr=class extends z{constructor(){super(x.Utf8)}toString(){return"Utf8"}};N3=Symbol.toStringTag;vr[N3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8"))(vr.prototype);qr=class extends z{constructor(){super(x.Utf8View)}toString(){return"Utf8View"}};O3=Symbol.toStringTag;qr.ELEMENT_WIDTH=Mt.ELEMENT_WIDTH;qr.INLINE_CAPACITY=Mt.INLINE_CAPACITY;qr[O3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Utf8View"))(qr.prototype);Mi=class extends z{constructor(){super(x.LargeUtf8)}toString(){return"LargeUtf8"}};B3=Symbol.toStringTag;Mi[B3]=(e=>(e.ArrayType=Uint8Array,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeUtf8"))(Mi.prototype);Er=class extends z{constructor(){super(x.Bool)}toString(){return"Bool"}};L3=Symbol.toStringTag;Er[L3]=(e=>(e.ArrayType=Uint8Array,e[Symbol.toStringTag]="Bool"))(Er.prototype);hn=class extends z{constructor(t,r,n=128){super(x.Decimal),this.scale=t,this.precision=r,this.bitWidth=n}toString(){return`Decimal[${this.precision}e${this.scale>0?"+":""}${this.scale}]`}};D3=Symbol.toStringTag;hn[D3]=(e=>(e.scale=null,e.precision=null,e.ArrayType=Uint32Array,e[Symbol.toStringTag]="Decimal"))(hn.prototype);jr=class extends z{constructor(t){super(x.Date),this.unit=t}toString(){return`Date${(this.unit+1)*32}<${Qt[this.unit]}>`}get ArrayType(){return this.unit===Qt.DAY?Int32Array:BigInt64Array}};F3=Symbol.toStringTag;jr[F3]=(e=>(e.unit=null,e[Symbol.toStringTag]="Date"))(jr.prototype);Ms=class extends jr{constructor(){super(Qt.DAY)}},bs=class extends jr{constructor(){super(Qt.MILLISECOND)}},fr=class extends z{constructor(t,r){super(x.Time),this.unit=t,this.bitWidth=r}toString(){return`Time${this.bitWidth}<${q[this.unit]}>`}get ArrayType(){switch(this.bitWidth){case 32:return Int32Array;case 64:return BigInt64Array}throw new Error(`Unrecognized ${this[Symbol.toStringTag]} type`)}};U3=Symbol.toStringTag;fr[U3]=(e=>(e.unit=null,e.bitWidth=null,e[Symbol.toStringTag]="Time"))(fr.prototype);xs=class extends fr{constructor(){super(q.SECOND,32)}},Ss=class extends fr{constructor(){super(q.MILLISECOND,32)}},vs=class extends fr{constructor(){super(q.MICROSECOND,64)}},Es=class extends fr{constructor(){super(q.NANOSECOND,64)}},dr=class extends z{constructor(t,r){super(x.Timestamp),this.unit=t,this.timezone=r}toString(){return`Timestamp<${q[this.unit]}${this.timezone?`, ${this.timezone}`:""}>`}};G3=Symbol.toStringTag;dr[G3]=(e=>(e.unit=null,e.timezone=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Timestamp"))(dr.prototype);Ts=class extends dr{constructor(t){super(q.SECOND,t)}},ki=class extends dr{constructor(t){super(q.MILLISECOND,t)}},Is=class extends dr{constructor(t){super(q.MICROSECOND,t)}},As=class extends dr{constructor(t){super(q.NANOSECOND,t)}},Tr=class extends z{constructor(t){super(x.Interval),this.unit=t}toString(){return`Interval<${Lt[this.unit]}>`}};z3=Symbol.toStringTag;Tr[z3]=(e=>(e.unit=null,e.ArrayType=Int32Array,e[Symbol.toStringTag]="Interval"))(Tr.prototype);Ps=class extends Tr{constructor(){super(Lt.DAY_TIME)}},Rs=class extends Tr{constructor(){super(Lt.YEAR_MONTH)}},vu=class extends Tr{constructor(){super(Lt.MONTH_DAY_NANO)}},Wr=class extends z{constructor(t){super(x.Duration),this.unit=t}toString(){return`Duration<${q[this.unit]}>`}};V3=Symbol.toStringTag;Wr[V3]=(e=>(e.unit=null,e.ArrayType=BigInt64Array,e[Symbol.toStringTag]="Duration"))(Wr.prototype);Eu=class extends Wr{constructor(){super(q.SECOND)}},Tu=class extends Wr{constructor(){super(q.MILLISECOND)}},Iu=class extends Wr{constructor(){super(q.MICROSECOND)}},Au=class extends Wr{constructor(){super(q.NANOSECOND)}},je=class extends z{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}};k3=Symbol.toStringTag;je[k3]=(e=>(e.children=null,e[Symbol.toStringTag]="List"))(je.prototype);Bn=class extends z{constructor(t){super(x.LargeList),this.children=[t]}toString(){return`LargeList<${this.valueType}>`}get valueType(){return this.children[0].type}get valueField(){return this.children[0]}get ArrayType(){return this.valueType.ArrayType}};q3=Symbol.toStringTag;Bn[q3]=(e=>(e.children=null,e.OffsetArrayType=BigInt64Array,e[Symbol.toStringTag]="LargeList"))(Bn.prototype);Yt=class extends z{constructor(t){super(x.Struct),this.children=t}toString(){return`Struct<{${this.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};j3=Symbol.toStringTag;Yt[j3]=(e=>(e.children=null,e[Symbol.toStringTag]="Struct"))(Yt.prototype);Hr=class extends z{constructor(t,r,n){super(x.Union),this.mode=t,this.children=n,this.typeIds=r=Int32Array.from(r),this.typeIdToChildIndex=r.reduce((i,o,s)=>(i[o]=s)&&i||i,Object.create(null))}toString(){return`${this[Symbol.toStringTag]}<${this.children.map(t=>`${t.type}`).join(" | ")}>`}};W3=Symbol.toStringTag;Hr[W3]=(e=>(e.mode=null,e.typeIds=null,e.children=null,e.typeIdToChildIndex=null,e.ArrayType=Int8Array,e[Symbol.toStringTag]="Union"))(Hr.prototype);yo=class extends Hr{constructor(t,r){super(jt.Dense,t,r)}},Cs=class extends Hr{constructor(t,r){super(jt.Sparse,t,r)}},un=class extends z{constructor(t){super(x.FixedSizeBinary),this.byteWidth=t}toString(){return`FixedSizeBinary[${this.byteWidth}]`}};H3=Symbol.toStringTag;un[H3]=(e=>(e.byteWidth=null,e.ArrayType=Uint8Array,e[Symbol.toStringTag]="FixedSizeBinary"))(un.prototype);_e=class extends z{constructor(t,r){super(x.FixedSizeList),this.listSize=t,this.children=[r]}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}>`}};$3=Symbol.toStringTag;_e[$3]=(e=>(e.children=null,e.listSize=null,e[Symbol.toStringTag]="FixedSizeList"))(_e.prototype);Ir=class extends z{constructor(t,r=!1){var n,i,o;if(super(x.Map),this.children=[t],this.keysSorted=r,t&&(t.name="entries",!((n=t?.type)===null||n===void 0)&&n.children)){let s=(i=t?.type)===null||i===void 0?void 0:i.children[0];s&&(s.name="key");let a=(o=t?.type)===null||o===void 0?void 0:o.children[1];a&&(a.name="value")}}get keyType(){return this.children[0].type.children[0].type}get valueType(){return this.children[0].type.children[1].type}get childType(){return this.children[0].type}toString(){return`Map<{${this.children[0].type.children.map(t=>`${t.name}:${t.type}`).join(", ")}}>`}};Y3=Symbol.toStringTag;Ir[Y3]=(e=>(e.children=null,e.keysSorted=null,e[Symbol.toStringTag]="Map_"))(Ir.prototype);C6=(e=>()=>++e)(-1),We=class extends z{constructor(t,r,n,i){super(x.Dictionary),this.indices=r,this.dictionary=t,this.isOrdered=i||!1,this.id=n==null?C6():It(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}>`}};K3=Symbol.toStringTag;We[K3]=(e=>(e.id=null,e.indices=null,e.isOrdered=null,e.dictionary=null,e[Symbol.toStringTag]="Dictionary"))(We.prototype)});function N6(e,t,r=!0){return typeof t=="number"?Il(e,t,r):typeof t=="string"&&t in x?Il(e,x[t],r):t&&t instanceof z?Il(e,J3(t),r):t?.type&&t.type instanceof z?Il(e,J3(t.type),r):Il(e,x.NONE,r)}function Il(e,t,r=!0){let n=null;switch(t){case x.Null:n=e.visitNull;break;case x.Bool:n=e.visitBool;break;case x.Int:n=e.visitInt;break;case x.Int8:n=e.visitInt8||e.visitInt;break;case x.Int16:n=e.visitInt16||e.visitInt;break;case x.Int32:n=e.visitInt32||e.visitInt;break;case x.Int64:n=e.visitInt64||e.visitInt;break;case x.Uint8:n=e.visitUint8||e.visitInt;break;case x.Uint16:n=e.visitUint16||e.visitInt;break;case x.Uint32:n=e.visitUint32||e.visitInt;break;case x.Uint64:n=e.visitUint64||e.visitInt;break;case x.Float:n=e.visitFloat;break;case x.Float16:n=e.visitFloat16||e.visitFloat;break;case x.Float32:n=e.visitFloat32||e.visitFloat;break;case x.Float64:n=e.visitFloat64||e.visitFloat;break;case x.Utf8:n=e.visitUtf8;break;case x.LargeUtf8:n=e.visitLargeUtf8;break;case x.Utf8View:n=e.visitUtf8View||e.visitUtf8;break;case x.Binary:n=e.visitBinary;break;case x.LargeBinary:n=e.visitLargeBinary;break;case x.BinaryView:n=e.visitBinaryView||e.visitBinary;break;case x.FixedSizeBinary:n=e.visitFixedSizeBinary;break;case x.Date:n=e.visitDate;break;case x.DateDay:n=e.visitDateDay||e.visitDate;break;case x.DateMillisecond:n=e.visitDateMillisecond||e.visitDate;break;case x.Timestamp:n=e.visitTimestamp;break;case x.TimestampSecond:n=e.visitTimestampSecond||e.visitTimestamp;break;case x.TimestampMillisecond:n=e.visitTimestampMillisecond||e.visitTimestamp;break;case x.TimestampMicrosecond:n=e.visitTimestampMicrosecond||e.visitTimestamp;break;case x.TimestampNanosecond:n=e.visitTimestampNanosecond||e.visitTimestamp;break;case x.Time:n=e.visitTime;break;case x.TimeSecond:n=e.visitTimeSecond||e.visitTime;break;case x.TimeMillisecond:n=e.visitTimeMillisecond||e.visitTime;break;case x.TimeMicrosecond:n=e.visitTimeMicrosecond||e.visitTime;break;case x.TimeNanosecond:n=e.visitTimeNanosecond||e.visitTime;break;case x.Decimal:n=e.visitDecimal;break;case x.List:n=e.visitList;break;case x.LargeList:n=e.visitLargeList;break;case x.Struct:n=e.visitStruct;break;case x.Union:n=e.visitUnion;break;case x.DenseUnion:n=e.visitDenseUnion||e.visitUnion;break;case x.SparseUnion:n=e.visitSparseUnion||e.visitUnion;break;case x.Dictionary:n=e.visitDictionary;break;case x.Interval:n=e.visitInterval;break;case x.IntervalDayTime:n=e.visitIntervalDayTime||e.visitInterval;break;case x.IntervalYearMonth:n=e.visitIntervalYearMonth||e.visitInterval;break;case x.IntervalMonthDayNano:n=e.visitIntervalMonthDayNano||e.visitInterval;break;case x.Duration:n=e.visitDuration;break;case x.DurationSecond:n=e.visitDurationSecond||e.visitDuration;break;case x.DurationMillisecond:n=e.visitDurationMillisecond||e.visitDuration;break;case x.DurationMicrosecond:n=e.visitDurationMicrosecond||e.visitDuration;break;case x.DurationNanosecond:n=e.visitDurationNanosecond||e.visitDuration;break;case x.FixedSizeList:n=e.visitFixedSizeList;break;case x.Map:n=e.visitMap;break}if(typeof n=="function")return n;if(!r)return()=>null;throw new Error(`Unrecognized type '${x[t]}'`)}function J3(e){switch(e.typeId){case x.Null:return x.Null;case x.Int:{let{bitWidth:t,isSigned:r}=e;switch(t){case 8:return r?x.Int8:x.Uint8;case 16:return r?x.Int16:x.Uint16;case 32:return r?x.Int32:x.Uint32;case 64:return r?x.Int64:x.Uint64}return x.Int}case x.Float:switch(e.precision){case Vt.HALF:return x.Float16;case Vt.SINGLE:return x.Float32;case Vt.DOUBLE:return x.Float64}return x.Float;case x.Binary:return x.Binary;case x.LargeBinary:return x.LargeBinary;case x.BinaryView:return x.BinaryView;case x.Utf8:return x.Utf8;case x.LargeUtf8:return x.LargeUtf8;case x.Utf8View:return x.Utf8View;case x.Bool:return x.Bool;case x.Decimal:return x.Decimal;case x.Time:switch(e.unit){case q.SECOND:return x.TimeSecond;case q.MILLISECOND:return x.TimeMillisecond;case q.MICROSECOND:return x.TimeMicrosecond;case q.NANOSECOND:return x.TimeNanosecond}return x.Time;case x.Timestamp:switch(e.unit){case q.SECOND:return x.TimestampSecond;case q.MILLISECOND:return x.TimestampMillisecond;case q.MICROSECOND:return x.TimestampMicrosecond;case q.NANOSECOND:return x.TimestampNanosecond}return x.Timestamp;case x.Date:switch(e.unit){case Qt.DAY:return x.DateDay;case Qt.MILLISECOND:return x.DateMillisecond}return x.Date;case x.Interval:switch(e.unit){case Lt.DAY_TIME:return x.IntervalDayTime;case Lt.YEAR_MONTH:return x.IntervalYearMonth;case Lt.MONTH_DAY_NANO:return x.IntervalMonthDayNano}return x.Interval;case x.Duration:switch(e.unit){case q.SECOND:return x.DurationSecond;case q.MILLISECOND:return x.DurationMillisecond;case q.MICROSECOND:return x.DurationMicrosecond;case q.NANOSECOND:return x.DurationNanosecond}return x.Duration;case x.Map:return x.Map;case x.List:return x.List;case x.LargeList:return x.LargeList;case x.Struct:return x.Struct;case x.Union:switch(e.mode){case jt.Dense:return x.DenseUnion;case jt.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[e.typeId]}'`)}var rt,fn=w(()=>{Ne();te();rt=class{visitMany(t,...r){return t.map((n,i)=>this.visit(n,...r.map(o=>o[i])))}visit(...t){return this.getVisitFn(t[0],!1).apply(this,t)}getVisitFn(t,r=!0){return N6(this,t,r)}getVisitFnByTypeId(t,r=!0){return Il(this,t,r)}visitNull(t,...r){return null}visitBool(t,...r){return null}visitInt(t,...r){return null}visitFloat(t,...r){return null}visitUtf8(t,...r){return null}visitLargeUtf8(t,...r){return null}visitUtf8View(t,...r){return null}visitBinary(t,...r){return null}visitLargeBinary(t,...r){return null}visitBinaryView(t,...r){return null}visitFixedSizeBinary(t,...r){return null}visitDate(t,...r){return null}visitTimestamp(t,...r){return null}visitTime(t,...r){return null}visitDecimal(t,...r){return null}visitList(t,...r){return null}visitLargeList(t,...r){return null}visitStruct(t,...r){return null}visitUnion(t,...r){return null}visitDictionary(t,...r){return null}visitInterval(t,...r){return null}visitDuration(t,...r){return null}visitFixedSizeList(t,...r){return null}visitMap(t,...r){return null}};rt.prototype.visitInt8=null;rt.prototype.visitInt16=null;rt.prototype.visitInt32=null;rt.prototype.visitInt64=null;rt.prototype.visitUint8=null;rt.prototype.visitUint16=null;rt.prototype.visitUint32=null;rt.prototype.visitUint64=null;rt.prototype.visitFloat16=null;rt.prototype.visitFloat32=null;rt.prototype.visitFloat64=null;rt.prototype.visitDateDay=null;rt.prototype.visitDateMillisecond=null;rt.prototype.visitTimestampSecond=null;rt.prototype.visitTimestampMillisecond=null;rt.prototype.visitTimestampMicrosecond=null;rt.prototype.visitTimestampNanosecond=null;rt.prototype.visitTimeSecond=null;rt.prototype.visitTimeMillisecond=null;rt.prototype.visitTimeMicrosecond=null;rt.prototype.visitTimeNanosecond=null;rt.prototype.visitDenseUnion=null;rt.prototype.visitSparseUnion=null;rt.prototype.visitIntervalDayTime=null;rt.prototype.visitIntervalYearMonth=null;rt.prototype.visitIntervalMonthDayNano=null;rt.prototype.visitDuration=null;rt.prototype.visitDurationSecond=null;rt.prototype.visitDurationMillisecond=null;rt.prototype.visitDurationMicrosecond=null;rt.prototype.visitDurationNanosecond=null});var Ww={};Zr(Ww,{float64ToUint16:()=>Pu,uint16ToFloat64:()=>Xm});function Xm(e){let t=(e&31744)>>10,r=(e&1023)/1024,n=Math.pow(-1,(e&32768)>>15);switch(t){case 31:return n*(r?Number.NaN:1/0);case 0:return n*(r?6103515625e-14*r:0)}return n*Math.pow(2,t-15)*(1+r)}function Pu(e){if(e!==e)return 32256;Q3[0]=e;let t=(Al[1]&2147483648)>>16&65535,r=Al[1]&2146435072,n=0;return r>=1089470464?Al[0]>0?r=31744:(r=(r&2080374784)>>16,n=(Al[1]&1048575)>>10):r<=1056964608?(n=1048576+(Al[1]&1048575),n=1048576+(n<<(r>>20)-998)>>21,r=0):(r=r-1056964608>>10,n=(Al[1]&1048575)+512>>10),t|r|n&65535}var Q3,Al,Ru=w(()=>{Q3=new Float64Array(1),Al=new Uint32Array(Q3.buffer)});function mt(e){return(t,r,n)=>{if(t.setValid(r,n!=null))return e(t,r,n)}}var ct,O6,t4,B6,wo,Hw,e4,L6,Zm,Jm,$w,r4,D6,n4,F6,i4,U6,Yw,Qm,tp,ep,rp,Kw,np,ip,op,sp,Xw,Zw,o4,G6,z6,V6,k6,q6,j6,W6,s4,a4,H6,Jw,ap,cp,lp,hp,up,fp,dp,Qw,$6,mr,Dn=w(()=>{Ar();fn();Vi();uo();Ru();Ne();te();ct=class extends rt{};O6=(e,t,r)=>{e[t]=Math.floor(r/864e5)},t4=(e,t,r,n)=>{if(r+1<t.length){let i=It(t[r]),o=It(t[r+1]);e.set(n.subarray(0,o-i),i)}},B6=({offset:e,values:t},r,n)=>{let i=e+r;n?t[i>>3]|=1<<i%8:t[i>>3]&=~(1<<i%8)},wo=({values:e},t,r)=>{e[t]=r},Hw=({values:e},t,r)=>{e[t]=r},e4=({values:e},t,r)=>{e[t]=Pu(r)},L6=(e,t,r)=>{switch(e.type.precision){case Vt.HALF:return e4(e,t,r);case Vt.SINGLE:case Vt.DOUBLE:return Hw(e,t,r)}},Zm=({values:e},t,r)=>{O6(e,t,r.valueOf())},Jm=({values:e},t,r)=>{e[t]=BigInt(r)},$w=({stride:e,values:t},r,n)=>{t.set(n.subarray(0,e),e*r)},r4=({values:e,valueOffsets:t},r,n)=>t4(e,t,r,n),D6=e=>{let t=e.variadicBuffers;return(!Array.isArray(t)||Object.isFrozen(t))&&(t=Array.from(t),e.variadicBuffers=t),t},n4=(e,t,r)=>{var n,i,o,s;let a=e.values;if(!a)throw new Error("BinaryView data is missing view buffer");let c=Mt.ELEMENT_WIDTH,l=t*c,h=l+c;if(l<0||h>a.length)throw new RangeError(`BinaryView index ${t} out of bounds`);a.fill(0,l,h);let u=new DataView(a.buffer,a.byteOffset+l,c),f=r.length;if(u.setInt32(Mt.LENGTH_OFFSET,f,!0),f<=Mt.INLINE_CAPACITY){a.set(r,l+Mt.INLINE_OFFSET);return}let d=((n=r[0])!==null&&n!==void 0?n:0)|((i=r[1])!==null&&i!==void 0?i:0)<<8|((o=r[2])!==null&&o!==void 0?o:0)<<16|((s=r[3])!==null&&s!==void 0?s:0)<<24;u.setUint32(Mt.INLINE_OFFSET,d>>>0,!0);let m=D6(e),p=r.slice(),g=m.push(p)-1;u.setInt32(Mt.BUFFER_INDEX_OFFSET,g,!0),u.setInt32(Mt.BUFFER_OFFSET_OFFSET,0,!0)},F6=(e,t,r)=>{let n=r instanceof Uint8Array?r:new Uint8Array(r);n4(e,t,n)},i4=({values:e,valueOffsets:t},r,n)=>t4(e,t,r,En(n)),U6=(e,t,r)=>{let n=En(r);n4(e,t,n)},Yw=(e,t,r)=>{e.type.unit===Qt.DAY?Zm(e,t,r):Jm(e,t,r)},Qm=({values:e},t,r)=>{e[t]=BigInt(r/1e3)},tp=({values:e},t,r)=>{e[t]=BigInt(r)},ep=({values:e},t,r)=>{e[t]=BigInt(r*1e3)},rp=({values:e},t,r)=>{e[t]=BigInt(r*1e6)},Kw=(e,t,r)=>{switch(e.type.unit){case q.SECOND:return Qm(e,t,r);case q.MILLISECOND:return tp(e,t,r);case q.MICROSECOND:return ep(e,t,r);case q.NANOSECOND:return rp(e,t,r)}},np=({values:e},t,r)=>{e[t]=r},ip=({values:e},t,r)=>{e[t]=r},op=({values:e},t,r)=>{e[t]=r},sp=({values:e},t,r)=>{e[t]=r},Xw=(e,t,r)=>{switch(e.type.unit){case q.SECOND:return np(e,t,r);case q.MILLISECOND:return ip(e,t,r);case q.MICROSECOND:return op(e,t,r);case q.NANOSECOND:return sp(e,t,r)}},Zw=({values:e,stride:t},r,n)=>{e.set(n.subarray(0,t),t*r)},o4=(e,t,r)=>{let n=e.children[0],i=e.valueOffsets,o=mr.getVisitFn(n),s=It(i[t]),a=It(i[t+1]);if(Array.isArray(r))for(let c=-1,l=s;l<a;)o(n,l++,r[++c]);else for(let c=-1,l=s;l<a;)o(n,l++,r.get(++c))},G6=(e,t,r)=>{let n=e.children[0],{valueOffsets:i}=e,o=mr.getVisitFn(n),{[t]:s,[t+1]:a}=i,c=r instanceof Map?r.entries():Object.entries(r);for(let l of c)if(o(n,s,l),++s>=a)break},z6=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[o]),V6=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(o)),k6=(e,t)=>(r,n,i,o)=>n&&r(n,e,t.get(i.name)),q6=(e,t)=>(r,n,i,o)=>n&&r(n,e,t[i.name]),j6=(e,t,r)=>{let n=e.type.children.map(o=>mr.getVisitFn(o.type)),i=r instanceof Map?k6(t,r):r instanceof $?V6(t,r):Array.isArray(r)?z6(t,r):q6(t,r);e.type.children.forEach((o,s)=>i(n[s],e.children[s],o,s))},W6=(e,t,r)=>{e.type.mode===jt.Dense?s4(e,t,r):a4(e,t,r)},s4=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];mr.visit(i,e.valueOffsets[t],r)},a4=(e,t,r)=>{let n=e.type.typeIdToChildIndex[e.typeIds[t]],i=e.children[n];mr.visit(i,t,r)},H6=(e,t,r)=>{var n;(n=e.dictionary)===null||n===void 0||n.set(e.values[t],r)},Jw=(e,t,r)=>{switch(e.type.unit){case Lt.YEAR_MONTH:return cp(e,t,r);case Lt.DAY_TIME:return ap(e,t,r);case Lt.MONTH_DAY_NANO:return lp(e,t,r)}},ap=({values:e},t,r)=>{e.set(r.subarray(0,2),2*t)},cp=({values:e},t,r)=>{e[t]=r[0]*12+r[1]%12},lp=({values:e,stride:t},r,n)=>{e.set(n.subarray(0,t),t*r)},hp=({values:e},t,r)=>{e[t]=r},up=({values:e},t,r)=>{e[t]=r},fp=({values:e},t,r)=>{e[t]=r},dp=({values:e},t,r)=>{e[t]=r},Qw=(e,t,r)=>{switch(e.type.unit){case q.SECOND:return hp(e,t,r);case q.MILLISECOND:return up(e,t,r);case q.MICROSECOND:return fp(e,t,r);case q.NANOSECOND:return dp(e,t,r)}},$6=(e,t,r)=>{let{stride:n}=e,i=e.children[0],o=mr.getVisitFn(i);if(Array.isArray(r))for(let s=-1,a=t*n;++s<n;)o(i,a+s,r[s]);else for(let s=-1,a=t*n;++s<n;)o(i,a+s,r.get(s))};ct.prototype.visitBool=mt(B6);ct.prototype.visitInt=mt(wo);ct.prototype.visitInt8=mt(wo);ct.prototype.visitInt16=mt(wo);ct.prototype.visitInt32=mt(wo);ct.prototype.visitInt64=mt(wo);ct.prototype.visitUint8=mt(wo);ct.prototype.visitUint16=mt(wo);ct.prototype.visitUint32=mt(wo);ct.prototype.visitUint64=mt(wo);ct.prototype.visitFloat=mt(L6);ct.prototype.visitFloat16=mt(e4);ct.prototype.visitFloat32=mt(Hw);ct.prototype.visitFloat64=mt(Hw);ct.prototype.visitUtf8=mt(i4);ct.prototype.visitLargeUtf8=mt(i4);ct.prototype.visitUtf8View=mt(U6);ct.prototype.visitBinary=mt(r4);ct.prototype.visitLargeBinary=mt(r4);ct.prototype.visitBinaryView=mt(F6);ct.prototype.visitFixedSizeBinary=mt($w);ct.prototype.visitDate=mt(Yw);ct.prototype.visitDateDay=mt(Zm);ct.prototype.visitDateMillisecond=mt(Jm);ct.prototype.visitTimestamp=mt(Kw);ct.prototype.visitTimestampSecond=mt(Qm);ct.prototype.visitTimestampMillisecond=mt(tp);ct.prototype.visitTimestampMicrosecond=mt(ep);ct.prototype.visitTimestampNanosecond=mt(rp);ct.prototype.visitTime=mt(Xw);ct.prototype.visitTimeSecond=mt(np);ct.prototype.visitTimeMillisecond=mt(ip);ct.prototype.visitTimeMicrosecond=mt(op);ct.prototype.visitTimeNanosecond=mt(sp);ct.prototype.visitDecimal=mt(Zw);ct.prototype.visitList=mt(o4);ct.prototype.visitLargeList=mt(o4);ct.prototype.visitStruct=mt(j6);ct.prototype.visitUnion=mt(W6);ct.prototype.visitDenseUnion=mt(s4);ct.prototype.visitSparseUnion=mt(a4);ct.prototype.visitDictionary=mt(H6);ct.prototype.visitInterval=mt(Jw);ct.prototype.visitIntervalDayTime=mt(ap);ct.prototype.visitIntervalYearMonth=mt(cp);ct.prototype.visitIntervalMonthDayNano=mt(lp);ct.prototype.visitDuration=mt(Qw);ct.prototype.visitDurationSecond=mt(hp);ct.prototype.visitDurationMillisecond=mt(up);ct.prototype.visitDurationMicrosecond=mt(fp);ct.prototype.visitDurationNanosecond=mt(dp);ct.prototype.visitFixedSizeList=mt($6);ct.prototype.visitMap=mt(G6);mr=new ct});var bi,Pl,qi,t_,e_,Y6,mp=w(()=>{xu();Fa();Dn();bi=Symbol.for("parent"),Pl=Symbol.for("rowIndex"),qi=class{constructor(t,r){return this[bi]=t,this[Pl]=r,new Proxy(this,Y6)}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Pl],r=this[bi],n=r.type.children,i={};for(let o=-1,s=n.length;++o<s;)i[n[o].name]=He.visit(r.children[o],t);return i}toString(){return`{${[...this].map(([t,r])=>`${pi(t)}: ${pi(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}[Symbol.iterator](){return new t_(this[bi],this[Pl])}},t_=class{constructor(t,r){this.childIndex=0,this.children=t.children,this.rowIndex=r,this.childFields=t.type.children,this.numChildren=this.childFields.length}[Symbol.iterator](){return this}next(){let t=this.childIndex;return t<this.numChildren?(this.childIndex=t+1,{done:!1,value:[this.childFields[t].name,He.visit(this.children[t],this.rowIndex)]}):{done:!0,value:null}}};Object.defineProperties(qi.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[bi]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Pl]:{writable:!0,enumerable:!1,configurable:!1,value:-1}});e_=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[bi].type.children.map(r=>r.name)}has(t,r){return t[bi].type.children.some(n=>n.name===r)}getOwnPropertyDescriptor(t,r){if(t[bi].type.children.some(n=>n.name===r))return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[bi].type.children.findIndex(i=>i.name===r);if(n!==-1){let i=He.visit(t[bi].children[n],t[Pl]);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[bi].type.children.findIndex(o=>o.name===r);return i!==-1?(mr.visit(t[bi].children[i],t[Pl],n),Reflect.set(t,r,n)):Reflect.has(t,r)||typeof r=="symbol"?Reflect.set(t,r,n):!1}},Y6=new e_});function ht(e){return(t,r)=>t.getValid(r)?e(t,r):null}var it,K6,Rl,X6,Z6,c4,J6,l4,h4,Ns,Q6,u4,tL,f4,d4,eL,m4,rL,nL,iL,oL,p4,g4,y4,w4,sL,_4,M4,b4,x4,aL,cL,S4,lL,hL,uL,v4,E4,fL,dL,T4,I4,A4,P4,R4,C4,N4,mL,pL,He,Fa=w(()=>{Km();Ar();fn();Cu();mp();Vi();uo();Ru();Ne();it=class extends rt{};K6=(e,t)=>864e5*e[t],Rl=16,X6=12,Z6=(e,t)=>null,c4=(e,t,r)=>{if(r+1>=t.length)return null;let n=It(t[r]),i=It(t[r+1]);return e.subarray(n,i)},J6=({offset:e,values:t},r)=>{let n=e+r;return(t[n>>3]&1<<n%8)!==0},l4=({values:e},t)=>K6(e,t),h4=({values:e},t)=>It(e[t]),Ns=({stride:e,values:t},r)=>t[e*r],Q6=({stride:e,values:t},r)=>Xm(t[e*r]),u4=({values:e},t)=>e[t],tL=({stride:e,values:t},r)=>t.subarray(e*r,e*(r+1)),f4=({values:e,valueOffsets:t},r)=>c4(e,t,r),d4=(e,t)=>{var r;let n=e.values;if(!n)throw new Error("BinaryView data is missing view buffer");let i=t*Rl,o=i+Rl;if(i<0||o>n.length)throw new Error(`BinaryView data buffer is too short: expected ${Rl} bytes, got ${Math.max(0,n.length-i)}`);let s=n.subarray(i,o);if(s.length<Rl)throw new Error(`BinaryView data buffer is too short: expected ${Rl} bytes, got ${s.length}`);let a=new DataView(n.buffer,s.byteOffset,Rl),c=a.getInt32(0,!0);if(c<=0)return new Uint8Array(0);if(c<=X6)return s.subarray(4,4+c);let l=a.getInt32(8,!0),h=a.getInt32(12,!0),u=(r=e.variadicBuffers)===null||r===void 0?void 0:r[l];if(!u)throw new Error(`BinaryView variadic buffer ${l} is missing`);return u.subarray(h,h+c)},eL=(e,t)=>d4(e,t),m4=({values:e,valueOffsets:t},r)=>{let n=c4(e,t,r);return n!==null?wl(n):null},rL=(e,t)=>{let r=d4(e,t);return wl(r)},nL=({values:e},t)=>e[t],iL=({type:e,values:t},r)=>e.precision!==Vt.HALF?t[r]:Xm(t[r]),oL=(e,t)=>e.type.unit===Qt.DAY?l4(e,t):h4(e,t),p4=({values:e},t)=>1e3*It(e[t]),g4=({values:e},t)=>It(e[t]),y4=({values:e},t)=>Vw(e[t],BigInt(1e3)),w4=({values:e},t)=>Vw(e[t],BigInt(1e6)),sL=(e,t)=>{switch(e.type.unit){case q.SECOND:return p4(e,t);case q.MILLISECOND:return g4(e,t);case q.MICROSECOND:return y4(e,t);case q.NANOSECOND:return w4(e,t)}},_4=({values:e},t)=>e[t],M4=({values:e},t)=>e[t],b4=({values:e},t)=>e[t],x4=({values:e},t)=>e[t],aL=(e,t)=>{switch(e.type.unit){case q.SECOND:return _4(e,t);case q.MILLISECOND:return M4(e,t);case q.MICROSECOND:return b4(e,t);case q.NANOSECOND:return x4(e,t)}},cL=({values:e,stride:t},r)=>Da.decimal(e.subarray(t*r,t*(r+1))),S4=(e,t)=>{let{valueOffsets:r,stride:n,children:i}=e,o=It(r[t*n]),s=It(r[t*n+1]),c=i[0].slice(o,s-o);return new $([c])},lL=(e,t)=>{let{valueOffsets:r,children:n}=e,{[t]:i,[t+1]:o}=r,s=n[0];return new Kn(s.slice(i,o-i))},hL=(e,t)=>new qi(e,t),uL=(e,t)=>e.type.mode===jt.Dense?v4(e,t):E4(e,t),v4=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return He.visit(n,e.valueOffsets[t])},E4=(e,t)=>{let r=e.type.typeIdToChildIndex[e.typeIds[t]],n=e.children[r];return He.visit(n,t)},fL=(e,t)=>{var r;return(r=e.dictionary)===null||r===void 0?void 0:r.get(e.values[t])},dL=(e,t)=>e.type.unit===Lt.MONTH_DAY_NANO?A4(e,t):e.type.unit===Lt.DAY_TIME?T4(e,t):I4(e,t),T4=({values:e},t)=>e.subarray(2*t,2*(t+1)),I4=({values:e},t)=>{let r=e[t],n=new Int32Array(2);return n[0]=Math.trunc(r/12),n[1]=Math.trunc(r%12),n},A4=({values:e},t)=>e.subarray(4*t,4*(t+1)),P4=({values:e},t)=>e[t],R4=({values:e},t)=>e[t],C4=({values:e},t)=>e[t],N4=({values:e},t)=>e[t],mL=(e,t)=>{switch(e.type.unit){case q.SECOND:return P4(e,t);case q.MILLISECOND:return R4(e,t);case q.MICROSECOND:return C4(e,t);case q.NANOSECOND:return N4(e,t)}},pL=(e,t)=>{let{stride:r,children:n}=e,o=n[0].slice(t*r,r);return new $([o])};it.prototype.visitNull=ht(Z6);it.prototype.visitBool=ht(J6);it.prototype.visitInt=ht(nL);it.prototype.visitInt8=ht(Ns);it.prototype.visitInt16=ht(Ns);it.prototype.visitInt32=ht(Ns);it.prototype.visitInt64=ht(u4);it.prototype.visitUint8=ht(Ns);it.prototype.visitUint16=ht(Ns);it.prototype.visitUint32=ht(Ns);it.prototype.visitUint64=ht(u4);it.prototype.visitFloat=ht(iL);it.prototype.visitFloat16=ht(Q6);it.prototype.visitFloat32=ht(Ns);it.prototype.visitFloat64=ht(Ns);it.prototype.visitUtf8=ht(m4);it.prototype.visitLargeUtf8=ht(m4);it.prototype.visitUtf8View=ht(rL);it.prototype.visitBinary=ht(f4);it.prototype.visitLargeBinary=ht(f4);it.prototype.visitBinaryView=ht(eL);it.prototype.visitFixedSizeBinary=ht(tL);it.prototype.visitDate=ht(oL);it.prototype.visitDateDay=ht(l4);it.prototype.visitDateMillisecond=ht(h4);it.prototype.visitTimestamp=ht(sL);it.prototype.visitTimestampSecond=ht(p4);it.prototype.visitTimestampMillisecond=ht(g4);it.prototype.visitTimestampMicrosecond=ht(y4);it.prototype.visitTimestampNanosecond=ht(w4);it.prototype.visitTime=ht(aL);it.prototype.visitTimeSecond=ht(_4);it.prototype.visitTimeMillisecond=ht(M4);it.prototype.visitTimeMicrosecond=ht(b4);it.prototype.visitTimeNanosecond=ht(x4);it.prototype.visitDecimal=ht(cL);it.prototype.visitList=ht(S4);it.prototype.visitLargeList=ht(S4);it.prototype.visitStruct=ht(hL);it.prototype.visitUnion=ht(uL);it.prototype.visitDenseUnion=ht(v4);it.prototype.visitSparseUnion=ht(E4);it.prototype.visitDictionary=ht(fL);it.prototype.visitInterval=ht(dL);it.prototype.visitIntervalDayTime=ht(T4);it.prototype.visitIntervalYearMonth=ht(I4);it.prototype.visitIntervalMonthDayNano=ht(A4);it.prototype.visitDuration=ht(mL);it.prototype.visitDurationSecond=ht(P4);it.prototype.visitDurationMillisecond=ht(R4);it.prototype.visitDurationMicrosecond=ht(C4);it.prototype.visitDurationNanosecond=ht(N4);it.prototype.visitFixedSizeList=ht(pL);it.prototype.visitMap=ht(lL);He=new it});var Os,Nl,Cl,r_,Kn,n_,i_,Cu=w(()=>{Ar();xu();Fa();Dn();Os=Symbol.for("keys"),Nl=Symbol.for("vals"),Cl=Symbol.for("kKeysAsStrings"),r_=Symbol.for("_kKeysAsStrings"),Kn=class{constructor(t){return this[Os]=new $([t.children[0]]).memoize(),this[Nl]=t.children[1],new Proxy(this,new i_)}get[Cl](){return this[r_]||(this[r_]=Array.from(this[Os].toArray(),String))}[Symbol.iterator](){return new n_(this[Os],this[Nl])}get size(){return this[Os].length}toArray(){return Object.values(this.toJSON())}toJSON(){let t=this[Os],r=this[Nl],n={};for(let i=-1,o=t.length;++i<o;)n[t.get(i)]=He.visit(r,i);return n}toString(){return`{${[...this].map(([t,r])=>`${pi(t)}: ${pi(r)}`).join(", ")}}`}[Symbol.for("nodejs.util.inspect.custom")](){return this.toString()}},n_=class{constructor(t,r){this.keys=t,this.vals=r,this.keyIndex=0,this.numKeys=t.length}[Symbol.iterator](){return this}next(){let t=this.keyIndex;return t===this.numKeys?{done:!0,value:null}:(this.keyIndex++,{done:!1,value:[this.keys.get(t),He.visit(this.vals,t)]})}},i_=class{isExtensible(){return!1}deleteProperty(){return!1}preventExtensions(){return!0}ownKeys(t){return t[Cl]}has(t,r){return t[Cl].includes(r)}getOwnPropertyDescriptor(t,r){if(t[Cl].indexOf(r)!==-1)return{writable:!0,enumerable:!0,configurable:!0}}get(t,r){if(Reflect.has(t,r))return t[r];let n=t[Cl].indexOf(r);if(n!==-1){let i=He.visit(Reflect.get(t,Nl),n);return Reflect.set(t,r,i),i}}set(t,r,n){let i=t[Cl].indexOf(r);return i!==-1?(mr.visit(Reflect.get(t,Nl),i,n),Reflect.set(t,r,n)):Reflect.has(t,r)?Reflect.set(t,r,n):!1}};Object.defineProperties(Kn.prototype,{[Symbol.toStringTag]:{enumerable:!1,configurable:!1,value:"Row"},[Os]:{writable:!0,enumerable:!1,configurable:!1,value:null},[Nl]:{writable:!0,enumerable:!1,configurable:!1,value:null},[r_]:{writable:!0,enumerable:!1,configurable:!1,value:null}})});var o_={};Zr(o_,{clampRange:()=>Nu,createElementComparator:()=>Bs,wrapIndex:()=>Ua});function Nu(e,t,r,n){let{length:i=0}=e,o=typeof t!="number"?0:t,s=typeof r!="number"?i:r;return o<0&&(o=(o%i+i)%i),s<0&&(s=(s%i+i)%i),s<o&&(O4=o,o=s,s=O4),s>i&&(s=i),n?n(e,o,s):[o,s]}function Bs(e){if(typeof e!=="object"||e===null)return B4(e)?B4:r=>r===e;if(e instanceof Date){let r=e.valueOf();return n=>n instanceof Date?n.valueOf()===r:!1}return ArrayBuffer.isView(e)?r=>r?lw(e,r):!1:e instanceof Map?yL(e):Array.isArray(e)?gL(e):e instanceof $?wL(e):_L(e,!0)}function gL(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Bs(e[r]);return pp(t)}function yL(e){let t=-1,r=[];for(let n of e.values())r[++t]=Bs(n);return pp(r)}function wL(e){let t=[];for(let r=-1,n=e.length;++r<n;)t[r]=Bs(e.get(r));return pp(t)}function _L(e,t=!1){let r=Object.keys(e);if(!t&&r.length===0)return()=>!1;let n=[];for(let i=-1,o=r.length;++i<o;)n[i]=Bs(e[r[i]]);return pp(n,r)}function pp(e,t){return r=>{if(!r||typeof r!="object")return!1;switch(r.constructor){case Array:return ML(e,r);case Map:return L4(e,r,r.keys());case Kn:case qi:case Object:case void 0:return L4(e,r,t||Object.keys(r))}return r instanceof $?bL(e,r):!1}}function ML(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t[n]))return!1;return!0}function bL(e,t){let r=e.length;if(t.length!==r)return!1;for(let n=-1;++n<r;)if(!e[n](t.get(n)))return!1;return!0}function L4(e,t,r){let n=r[Symbol.iterator](),i=t instanceof Map?t.keys():Object.keys(t)[Symbol.iterator](),o=t instanceof Map?t.values():Object.values(t)[Symbol.iterator](),s=0,a=e.length,c=o.next(),l=n.next(),h=i.next();for(;s<a&&!l.done&&!h.done&&!c.done&&!(l.value!==h.value||!e[s](c.value));++s,l=n.next(),h=i.next(),c=o.next());return s===a&&l.done&&h.done&&c.done?!0:(n.return&&n.return(),i.return&&i.return(),o.return&&o.return(),!1)}var O4,Ua,B4,Ol=w(()=>{Ar();Cu();mp();Je();Ua=(e,t)=>e<0?t+e:e,B4=e=>e!==e});var s_={};Zr(s_,{BitIterator:()=>ji,getBit:()=>yp,getBool:()=>Bl,packBools:()=>za,popcnt_array:()=>D4,popcnt_bit_range:()=>Ou,popcnt_uint32:()=>gp,setBool:()=>xL,truncateBitmap:()=>Ga});function Bl(e,t,r,n){return(r&1<<n)!==0}function yp(e,t,r,n){return(r&1<<n)>>n}function xL(e,t,r){return r?!!(e[t>>3]|=1<<t%8)||!0:!(e[t>>3]&=~(1<<t%8))&&!1}function Ga(e,t,r){let n=r.byteLength+7&-8;if(e>0||r.byteLength<n){let i=new Uint8Array(n);return i.set(e%8===0?r.subarray(e>>3):za(new ji(r,e,t,null,Bl)).subarray(0,n)),i}return r}function za(e){let t=[],r=0,n=0,i=0;for(let s of e)s&&(i|=1<<n),++n===8&&(t[r++]=i,i=n=0);(r===0||n>0)&&(t[r++]=i);let o=new Uint8Array(t.length+7&-8);return o.set(t),o}function Ou(e,t,r){if(r-t<=0)return 0;if(r-t<8){let o=0;for(let s of new ji(e,t,r-t,e,yp))o+=s;return o}let n=r>>3<<3,i=t+(t%8===0?0:8-t%8);return Ou(e,t,i)+Ou(e,n,r)+D4(e,i>>3,n-i>>3)}function D4(e,t,r){let n=0,i=Math.trunc(t),o=new DataView(e.buffer,e.byteOffset,e.byteLength),s=r===void 0?e.byteLength:i+r;for(;s-i>=4;)n+=gp(o.getUint32(i)),i+=4;for(;s-i>=2;)n+=gp(o.getUint16(i)),i+=2;for(;s-i>=1;)n+=gp(o.getUint8(i)),i+=1;return n}function gp(e){let t=Math.trunc(e);return t=t-(t>>>1&1431655765),t=(t&858993459)+(t>>>2&858993459),(t+(t>>>4)&252645135)*16843009>>>24}var ji,Va=w(()=>{ji=class{constructor(t,r,n,i,o){this.bytes=t,this.length=n,this.context=i,this.get=o,this.bit=r%8,this.byteIndex=r>>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 Q(e){return vL.visit(e)}var SL,F4,ut,a_,vL,Xn=w(()=>{Ar();Ne();te();Va();te();fn();Je();SL=-1,F4=Symbol.for("apache-arrow/Data"),ut=class e{static isData(t){return t?.[F4]===!0}get typeId(){return this.type.typeId}get ArrayType(){return this.type.ArrayType}get buffers(){return[this.valueOffsets,this.values,this.nullBitmap,this.typeIds]}get nullable(){if(this._nullCount!==0){let{type:t}=this;return z.isSparseUnion(t)?this.children.some(r=>r.nullable):z.isDenseUnion(t)?this.children.some(r=>r.nullable):this.nullBitmap&&this.nullBitmap.byteLength>0}return!0}get byteLength(){let t=0,{valueOffsets:r,values:n,nullBitmap:i,typeIds:o}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),t+=this.variadicBuffers.reduce((s,a)=>{var c;return s+((c=a?.byteLength)!==null&&c!==void 0?c:0)},0),this.children.reduce((s,a)=>s+a.byteLength,t)}get nullCount(){if(z.isUnion(this.type))return this.children.reduce((n,i)=>n+i.nullCount,0);let t=this._nullCount,r;return t<=SL&&(r=this.nullBitmap)&&(this._nullCount=t=r.length===0?0:this.length-Ou(r,this.offset,this.offset+this.length)),t}constructor(t,r,n,i,o,s=[],a,c=[]){var l;this.type=t,this.children=s,this.dictionary=a,this.offset=Math.floor(Math.max(r||0,0)),this.length=Math.floor(Math.max(n||0,0)),this._nullCount=Math.floor(Math.max(i||0,-1));let h;o instanceof e?(this.stride=o.stride,this.values=o.values,this.typeIds=o.typeIds,this.nullBitmap=o.nullBitmap,this.valueOffsets=o.valueOffsets,this.variadicBuffers=o.variadicBuffers):(this.stride=Ln(t),o&&((h=o[0])&&(this.valueOffsets=h),(h=o[1])&&(this.values=h),(h=o[2])&&(this.nullBitmap=h),(h=o[3])&&(this.typeIds=h)),this.variadicBuffers=c),(l=this.variadicBuffers)!==null&&l!==void 0||(this.variadicBuffers=[])}getValid(t){let{type:r}=this;if(z.isUnion(r)){let n=r,i=this.typeIds[t],o=n.typeIdToChildIndex[i],s=this.children[o],a=this.valueOffsets,c=n.mode===jt.Dense&&a?Number(a[t]):t;return s.getValid(c)}if(this.nullable&&this.nullCount>0){let n=this.offset+t;return(this.nullBitmap[n>>3]&1<<n%8)!==0}return!0}setValid(t,r){let n,{type:i}=this;if(z.isUnion(i)){let o=i,s=this.typeIds[t],a=o.typeIdToChildIndex[s],c=this.children[a],l=this.valueOffsets,h=o.mode===jt.Dense&&l?Number(l[t]):t;n=c.getValid(h),c.setValid(h,r)}else{let{nullBitmap:o}=this,{offset:s,length:a}=this,c=s+t,l=1<<c%8,h=c>>3;(!o||o.byteLength<=h)&&(o=new Uint8Array((s+a+63&-64)>>3).fill(255),this.nullCount>0?(o.set(Ga(s,a,this.nullBitmap),0),Object.assign(this,{nullBitmap:o})):Object.assign(this,{nullBitmap:o,_nullCount:0}));let u=o[h];n=(u&l)!==0,o[h]=r?u|l:u&~l}return n!==!!r&&(this._nullCount=this.nullCount+(r?-1:1)),r}clone(t=this.type,r=this.offset,n=this.length,i=this._nullCount,o=this,s=this.children,a=this.variadicBuffers){return new e(t,r,n,i,o,s,this.dictionary,a)}slice(t,r){let{stride:n,typeId:i,children:o}=this,s=+(this._nullCount===0)-1,a=i===16?n:1,c=this._sliceBuffers(t,r,n,i);return this.clone(this.type,this.offset+t,r,s,c,o.length===0||this.valueOffsets?o:this._sliceChildren(o,a*t,a*r),this.variadicBuffers)}_changeLengthAndBackfillNullBitmap(t){if(this.typeId===x.Null)return this.clone(this.type,0,t,0,this.buffers,this.children,this.variadicBuffers);let{length:r,nullCount:n}=this,i=new Uint8Array((t+63&-64)>>3).fill(255,0,r>>3);i[r>>3]=(1<<r-(r&-8))-1,n>0&&i.set(Ga(this.offset,r,this.nullBitmap),0);let o=this.buffers;return o[xe.VALIDITY]=i,this.clone(this.type,0,t,n+(t-r),o,this.children,this.variadicBuffers)}_sliceBuffers(t,r,n,i){let o,{buffers:s}=this;if((o=s[xe.TYPE])&&(s[xe.TYPE]=o.subarray(t,t+r)),z.isBinaryView(this.type)||z.isUtf8View(this.type)){let a=Mt.ELEMENT_WIDTH;(o=s[xe.DATA])&&(s[xe.DATA]=o.subarray(t*a,(t+r)*a))}else(o=s[xe.OFFSET])&&(s[xe.OFFSET]=o.subarray(t,t+r+1))||(o=s[xe.DATA])&&(s[xe.DATA]=i===6?o:o.subarray(n*t,n*(t+r)));return s}_sliceChildren(t,r,n){return t.map(i=>i.slice(r,n))}};ut.prototype.children=Object.freeze([]);ut.prototype[F4]=!0;Object.defineProperty(ut,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===ut&&ut.isData(t)}});a_=class e extends rt{visit(t){return this.getVisitFn(t.type).call(this,t)}visitNull(t){let{["type"]:r,["offset"]:n=0,["length"]:i=0}=t;return new ut(r,n,i,i)}visitBool(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length>>3,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitInt(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitFloat(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.data),o=nt(t.nullBitmap),s=Oa(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,i,o])}visitUtf8View(t){var r;let{["type"]:n,["offset"]:i=0}=t,o=Tt(n.ArrayType,t.views),s=nt(t.nullBitmap),a=(t.variadicBuffers||[]).map(h=>nt(h)),c=(r=t.length)!==null&&r!==void 0?r:Math.trunc(o.length/qr.ELEMENT_WIDTH),l=t.nullBitmap?-1:0;return new ut(n,i,c,l,[void 0,o,s],[],void 0,a)}visitLargeUtf8(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.data),o=nt(t.nullBitmap),s=su(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,i,o])}visitBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.data),o=nt(t.nullBitmap),s=Oa(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,i,o])}visitBinaryView(t){var r;let{["type"]:n,["offset"]:i=0}=t,o=Tt(n.ArrayType,t.views),s=nt(t.nullBitmap),a=(t.variadicBuffers||[]).map(h=>nt(h)),c=(r=t.length)!==null&&r!==void 0?r:Math.trunc(o.length/Mt.ELEMENT_WIDTH),l=t.nullBitmap?-1:0;return new ut(n,i,c,l,[void 0,o,s],[],void 0,a)}visitLargeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.data),o=nt(t.nullBitmap),s=su(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,i,o])}visitFixedSizeBinary(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitDate(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitTimestamp(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitTime(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitDecimal(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitList(t){let{["type"]:r,["offset"]:n=0,["child"]:i}=t,o=nt(t.nullBitmap),s=Oa(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,void 0,o],[i])}visitLargeList(t){let{["type"]:r,["offset"]:n=0,["child"]:i}=t,o=nt(t.nullBitmap),s=su(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,void 0,o],[i])}visitStruct(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=nt(t.nullBitmap),{length:s=i.reduce((c,{length:l})=>Math.max(c,l),0),nullCount:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,void 0,o],i)}visitUnion(t){let{["type"]:r,["offset"]:n=0,["children"]:i=[]}=t,o=Tt(r.ArrayType,t.typeIds),{["length"]:s=o.length,["nullCount"]:a=-1}=t;if(z.isSparseUnion(r))return new ut(r,n,s,a,[void 0,void 0,void 0,o],i);let c=Oa(t.valueOffsets);return new ut(r,n,s,a,[c,void 0,void 0,o],i)}visitDictionary(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.indices.ArrayType,t.data),{["dictionary"]:s=new $([new e().visit({type:r.dictionary})])}=t,{["length"]:a=o.length,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[void 0,o,i],[],s)}visitInterval(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitDuration(t){let{["type"]:r,["offset"]:n=0}=t,i=nt(t.nullBitmap),o=Tt(r.ArrayType,t.data),{["length"]:s=o.length,["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,o,i])}visitFixedSizeList(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.valueType})}=t,o=nt(t.nullBitmap),{["length"]:s=i.length/Ln(r),["nullCount"]:a=t.nullBitmap?-1:0}=t;return new ut(r,n,s,a,[void 0,void 0,o],[i])}visitMap(t){let{["type"]:r,["offset"]:n=0,["child"]:i=new e().visit({type:r.childType})}=t,o=nt(t.nullBitmap),s=Oa(t.valueOffsets),{["length"]:a=s.length-1,["nullCount"]:c=t.nullBitmap?-1:0}=t;return new ut(r,n,a,c,[s,void 0,o],[i])}},vL=new a_});function U4(e){return e.some(t=>t.nullable)}function wp(e){return e.reduce((t,r)=>t+r.nullCount,0)}function _p(e){return e.reduce((t,r,n)=>(t[n+1]=t[n]+r.length,t),new Uint32Array(e.length+1))}function Mp(e,t,r,n){let i=[];for(let o=-1,s=e.length;++o<s;){let a=e[o],c=t[o],{length:l}=a;if(c>=n)break;if(r>=c+l)continue;if(c>=r&&c+l<=n){i.push(a);continue}let h=Math.max(0,r-c),u=Math.min(n-c,l);i.push(a.slice(h,u-h))}return i.length===0&&i.push(e[0].slice(0,0)),i}function c_(e,t,r,n){let i=0,o=0,s=t.length-1;do{if(i>=s-1)return r<t[s]?n(e,i,r-t[i]):null;o=i+Math.trunc((s-i)*.5),r<t[o]?s=o:i=o}while(i<s)}function Lu(e,t){return e.getValid(t)}function Ll(e){function t(r,n,i){return e(r[n],i)}return function(r){let n=this.data;return c_(n,this._offsets,r,t)}}function bp(e){let t;function r(n,i,o){return e(n[i],o,t)}return function(n,i){let o=this.data;t=i;let s=c_(o,this._offsets,n,r);return t=void 0,s}}function xp(e){let t;function r(n,i,o){let s=o,a=0,c=0;for(let l=i-1,h=n.length;++l<h;){let u=n[l];if(~(a=e(u,t,s)))return c+a;s=0,c+=u.length}return-1}return function(n,i){t=n;let o=this.data,s=typeof i!="number"?r(o,0,0):c_(o,this._offsets,i,r);return t=void 0,s}}var Bu,Sp=w(()=>{Bu=class{constructor(t=0,r){this.numChunks=t,this.getChunkIterator=r,this.chunkIndex=0,this.chunkIterator=this.getChunkIterator(0)}next(){for(;this.chunkIndex<this.numChunks;){let t=this.chunkIterator.next();if(!t.done)return t;++this.chunkIndex<this.numChunks&&(this.chunkIterator=this.getChunkIterator(this.chunkIndex))}return{done:!0,value:null}}[Symbol.iterator](){return this}}});function EL(e,t){return t===null&&e.length>0?0:-1}function TL(e,t){let{nullBitmap:r}=e;if(!r||e.nullCount<=0)return-1;let n=0;for(let i of new ji(r,e.offset+(t||0),e.length,r,Bl)){if(!i)return n;++n}return-1}function gt(e,t,r){if(t===void 0)return-1;if(t===null)switch(e.typeId){case x.Union:break;case x.Dictionary:break;default:return TL(e,r)}let n=He.getVisitFn(e),i=Bs(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}function G4(e,t,r){let n=He.getVisitFn(e),i=Bs(t);for(let o=(r||0)-1,s=e.length;++o<s;)if(i(n(e,o)))return o;return-1}var ot,ka,vp=w(()=>{Ne();fn();Fa();Va();Ol();ot=class extends rt{};ot.prototype.visitNull=EL;ot.prototype.visitBool=gt;ot.prototype.visitInt=gt;ot.prototype.visitInt8=gt;ot.prototype.visitInt16=gt;ot.prototype.visitInt32=gt;ot.prototype.visitInt64=gt;ot.prototype.visitUint8=gt;ot.prototype.visitUint16=gt;ot.prototype.visitUint32=gt;ot.prototype.visitUint64=gt;ot.prototype.visitFloat=gt;ot.prototype.visitFloat16=gt;ot.prototype.visitFloat32=gt;ot.prototype.visitFloat64=gt;ot.prototype.visitUtf8=gt;ot.prototype.visitLargeUtf8=gt;ot.prototype.visitUtf8View=gt;ot.prototype.visitBinary=gt;ot.prototype.visitLargeBinary=gt;ot.prototype.visitBinaryView=gt;ot.prototype.visitFixedSizeBinary=gt;ot.prototype.visitDate=gt;ot.prototype.visitDateDay=gt;ot.prototype.visitDateMillisecond=gt;ot.prototype.visitTimestamp=gt;ot.prototype.visitTimestampSecond=gt;ot.prototype.visitTimestampMillisecond=gt;ot.prototype.visitTimestampMicrosecond=gt;ot.prototype.visitTimestampNanosecond=gt;ot.prototype.visitTime=gt;ot.prototype.visitTimeSecond=gt;ot.prototype.visitTimeMillisecond=gt;ot.prototype.visitTimeMicrosecond=gt;ot.prototype.visitTimeNanosecond=gt;ot.prototype.visitDecimal=gt;ot.prototype.visitList=gt;ot.prototype.visitLargeList=gt;ot.prototype.visitStruct=gt;ot.prototype.visitUnion=gt;ot.prototype.visitDenseUnion=G4;ot.prototype.visitSparseUnion=G4;ot.prototype.visitDictionary=gt;ot.prototype.visitInterval=gt;ot.prototype.visitIntervalDayTime=gt;ot.prototype.visitIntervalYearMonth=gt;ot.prototype.visitIntervalMonthDayNano=gt;ot.prototype.visitDuration=gt;ot.prototype.visitDurationSecond=gt;ot.prototype.visitDurationMillisecond=gt;ot.prototype.visitDurationMicrosecond=gt;ot.prototype.visitDurationNanosecond=gt;ot.prototype.visitFixedSizeList=gt;ot.prototype.visitMap=gt;ka=new ot});function ft(e){let{type:t}=e;if(e.nullCount===0&&e.stride===1&&(z.isInt(t)&&t.bitWidth!==64||z.isTime(t)&&t.bitWidth!==64||z.isFloat(t)&&t.precision!==Vt.HALF))return new Bu(e.data.length,n=>{let i=e.data[n];return i.values.subarray(0,i.length)[Symbol.iterator]()});let r=0;return new Bu(e.data.length,n=>{let o=e.data[n].length,s=e.slice(r,r+o);return r+=o,new l_(s)})}var st,l_,Dl,Ep=w(()=>{fn();Ne();te();Sp();st=class extends rt{};l_=class{constructor(t){this.vector=t,this.index=0}next(){return this.index<this.vector.length?{value:this.vector.get(this.index++)}:{done:!0,value:null}}[Symbol.iterator](){return this}};st.prototype.visitNull=ft;st.prototype.visitBool=ft;st.prototype.visitInt=ft;st.prototype.visitInt8=ft;st.prototype.visitInt16=ft;st.prototype.visitInt32=ft;st.prototype.visitInt64=ft;st.prototype.visitUint8=ft;st.prototype.visitUint16=ft;st.prototype.visitUint32=ft;st.prototype.visitUint64=ft;st.prototype.visitFloat=ft;st.prototype.visitFloat16=ft;st.prototype.visitFloat32=ft;st.prototype.visitFloat64=ft;st.prototype.visitUtf8=ft;st.prototype.visitLargeUtf8=ft;st.prototype.visitUtf8View=ft;st.prototype.visitBinary=ft;st.prototype.visitLargeBinary=ft;st.prototype.visitBinaryView=ft;st.prototype.visitFixedSizeBinary=ft;st.prototype.visitDate=ft;st.prototype.visitDateDay=ft;st.prototype.visitDateMillisecond=ft;st.prototype.visitTimestamp=ft;st.prototype.visitTimestampSecond=ft;st.prototype.visitTimestampMillisecond=ft;st.prototype.visitTimestampMicrosecond=ft;st.prototype.visitTimestampNanosecond=ft;st.prototype.visitTime=ft;st.prototype.visitTimeSecond=ft;st.prototype.visitTimeMillisecond=ft;st.prototype.visitTimeMicrosecond=ft;st.prototype.visitTimeNanosecond=ft;st.prototype.visitDecimal=ft;st.prototype.visitList=ft;st.prototype.visitLargeList=ft;st.prototype.visitStruct=ft;st.prototype.visitUnion=ft;st.prototype.visitDenseUnion=ft;st.prototype.visitSparseUnion=ft;st.prototype.visitDictionary=ft;st.prototype.visitInterval=ft;st.prototype.visitIntervalDayTime=ft;st.prototype.visitIntervalYearMonth=ft;st.prototype.visitIntervalMonthDayNano=ft;st.prototype.visitDuration=ft;st.prototype.visitDurationSecond=ft;st.prototype.visitDurationMillisecond=ft;st.prototype.visitDurationMicrosecond=ft;st.prototype.visitDurationNanosecond=ft;st.prototype.visitFixedSizeList=ft;st.prototype.visitMap=ft;Dl=new st});function Wi(e){if(e){if(e instanceof ut)return new $([e]);if(e instanceof $)return new $(e.data);if(e.type instanceof z)return new $([Q(e)]);if(Array.isArray(e))return new $(e.flatMap(t=>IL(t)));if(ArrayBuffer.isView(e)){e instanceof DataView&&(e=new Uint8Array(e.buffer));let t={offset:0,length:e.length,nullCount:-1,data:e};if(e instanceof Int8Array)return new $([Q(Object.assign(Object.assign({},t),{type:new An}))]);if(e instanceof Int16Array)return new $([Q(Object.assign(Object.assign({},t),{type:new Pn}))]);if(e instanceof Int32Array)return new $([Q(Object.assign(Object.assign({},t),{type:new Ve}))]);if(e instanceof BigInt64Array)return new $([Q(Object.assign(Object.assign({},t),{type:new Rn}))]);if(e instanceof Uint8Array||e instanceof Uint8ClampedArray)return new $([Q(Object.assign(Object.assign({},t),{type:new Cn}))]);if(e instanceof Uint16Array)return new $([Q(Object.assign(Object.assign({},t),{type:new Nn}))]);if(e instanceof Uint32Array)return new $([Q(Object.assign(Object.assign({},t),{type:new Vr}))]);if(e instanceof BigUint64Array)return new $([Q(Object.assign(Object.assign({},t),{type:new yi}))]);if(e instanceof Float32Array)return new $([Q(Object.assign(Object.assign({},t),{type:new kr}))]);if(e instanceof Float64Array)return new $([Q(Object.assign(Object.assign({},t),{type:new On}))]);throw new Error("Unrecognized input")}}throw new Error("Unrecognized input")}function IL(e){return e instanceof ut?[e]:e instanceof $?e.data:Wi(e).data}var z4,V4,k4,q4,$,Tp,Ar=w(()=>{Ne();Ol();te();Xn();Sp();Fa();Dn();vp();Ep();te();V4=Symbol.for("apache-arrow/Vector"),k4={},q4={},$=class e{static isVector(t){return t?.[V4]===!0}constructor(t){var r,n,i;let o=t[0]instanceof e?t.flatMap(a=>a.data):t;if(o.length===0||o.some(a=>!(a instanceof ut)))throw new TypeError("Vector constructor expects an Array of Data instances.");let s=(r=o[0])===null||r===void 0?void 0:r.type;switch(o.length){case 0:this._offsets=[0];break;case 1:{let{get:a,set:c,indexOf:l}=k4[s.typeId],h=o[0];this.isValid=u=>Lu(h,u),this.get=u=>a(h,u),this.set=(u,f)=>c(h,u,f),this.indexOf=u=>l(h,u),this._offsets=[0,h.length];break}default:Object.setPrototypeOf(this,q4[s.typeId]),this._offsets=_p(o);break}this.data=o,this.type=s,this.stride=Ln(s),this.numChildren=(i=(n=s.children)===null||n===void 0?void 0:n.length)!==null&&i!==void 0?i:0,this.length=this._offsets.at(-1)}get byteLength(){return this.data.reduce((t,r)=>t+r.byteLength,0)}get nullable(){return U4(this.data)}get nullCount(){return wp(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(Ua(t,this.length))}set(t,r){}indexOf(t,r){return-1}includes(t,r){return this.indexOf(t,r)>-1}[Symbol.iterator](){return Dl.visit(this)}concat(...t){return new e(this.data.concat(t.flatMap(r=>r.data).flat(Number.POSITIVE_INFINITY)))}slice(t,r){return new e(Nu(this,t,r,({data:n,_offsets:i},o,s)=>Mp(n,i,o,s)))}toJSON(){return[...this]}toArray(){let{type:t,data:r,length:n,stride:i,ArrayType:o}=this;switch(t.typeId){case x.Int:case x.Float:case x.Decimal:case x.Time:case x.Timestamp:switch(r.length){case 0:return new o;case 1:return r[0].values.subarray(0,n*i);default:return r.reduce((s,{values:a,length:c})=>(s.array.set(a.subarray(0,c*i),s.offset),s.offset+=c*i,s),{array:new o(n*i),offset:0}).array}}return[...this]}toString(){return`[${[...this].join(",")}]`}getChild(t){var r;return this.getChildAt((r=this.type.children)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.numChildren?new e(this.data.map(({children:r})=>r[t])):null}get isMemoized(){return z.isDictionary(this.type)?this.data[0].dictionary.isMemoized:!1}memoize(){if(z.isDictionary(this.type)){let t=new Tp(this.data[0].dictionary),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return new Tp(this)}unmemoize(){if(z.isDictionary(this.type)&&this.isMemoized){let t=this.data[0].dictionary.unmemoize(),r=this.data.map(n=>{let i=n.clone();return i.dictionary=t,i});return new e(r)}return this}};z4=Symbol.toStringTag;$[z4]=(e=>{e.type=z.prototype,e.data=[],e.length=0,e.stride=1,e.numChildren=0,e._offsets=new Uint32Array([0]),e[Symbol.isConcatSpreadable]=!0,e[V4]=!0;let t=Object.keys(x).map(r=>x[r]).filter(r=>typeof r=="number"&&r!==x.NONE);for(let r of t){let n=He.getVisitFnByTypeId(r),i=mr.getVisitFnByTypeId(r),o=ka.getVisitFnByTypeId(r);k4[r]={get:n,set:i,indexOf:o},q4[r]=Object.create(e,{isValid:{value:Ll(Lu)},get:{value:Ll(He.getVisitFnByTypeId(r))},set:{value:bp(mr.getVisitFnByTypeId(r))},indexOf:{value:xp(ka.getVisitFnByTypeId(r))}})}return"Vector"})($.prototype);Object.defineProperty($,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===$&&$.isVector(t)}});Tp=class e extends ${constructor(t){super(t.data);let r=this.get,n=this.set,i=this.slice,o=new Array(this.length);Object.defineProperty(this,"get",{value(s){let a=o[s];if(a!==void 0)return a;let c=r.call(this,s);return o[s]=c,c}}),Object.defineProperty(this,"set",{value(s,a){n.call(this,s,a),o[s]=a}}),Object.defineProperty(this,"slice",{value:(s,a)=>new e(i.call(this,s,a))}),Object.defineProperty(this,"isMemoized",{value:!0}),Object.defineProperty(this,"unmemoize",{value:()=>new $(this.data)}),Object.defineProperty(this,"memoize",{value:()=>this})}}});function j4(e){if(!e||e.length<=0)return function(i){return!0};let t="",r=e.filter(n=>n===n);return r.length>0&&(t=`
|
|
10
10
|
switch (x) {${r.map(n=>`
|
|
11
|
-
case ${
|
|
11
|
+
case ${AL(n)}:`).join("")}
|
|
12
12
|
return false;
|
|
13
13
|
}`),e.length!==r.length&&(t=`if (x !== x) return false;
|
|
14
14
|
${t}`),new Function("x",`${t}
|
|
15
|
-
return true;`)}function wL(e){return typeof e!="bigint"?pi(e):`${pi(e)}n`}var D4=w(()=>{bu()});function i_(e,t){let r=Math.ceil(e)*t-1;return(r-r%64+64||64)/t}function F4(e,t=0){return e.length>=t?e.subarray(0,t):iu(new e.constructor(t),e,0)}var dn,_o,Dl,Ls,xi=w(()=>{Je();dn=class{constructor(t,r=0,n=1){this.length=Math.ceil(r/n),this.buffer=new t(this.length),this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let r=this.stride,n=this.length*r,i=this.buffer.length;n>=i&&this._resize(i===0?i_(n*1,this.BYTES_PER_ELEMENT):i_(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=i_(t*this.stride,this.BYTES_PER_ELEMENT);let r=F4(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=F4(this.buffer,t)}},_o=class extends dn{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}},Dl=class extends _o{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,r){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=n[i]>>o&1;return r?s===0&&(n[i]|=1<<o,++this.numValid):s===1&&(n[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},Ls=class extends _o{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,r){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&n>=0&&i.fill(i[n],n,t),i[t]=i[t-1]+r,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}}});var oe,He,Pr,me=w(()=>{Ar();Xn();Ru();te();D4();xi();oe=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:r}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=r,this.stride=Ln(t),this._nulls=new Dl,r&&r.length>0&&(this._isValid=L4(r))}toVector(){return new $([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:r,_values:n,_nulls:i,_typeIds:o,children:s}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((r,n)=>r+n.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,r){return this.setValid(t,this.isValid(r))&&this.setValue(t,r),this}setValue(t,r){this._setValue(this,t,r)}setValid(t,r){return this.length=this._nulls.set(t,+r).length,r}addChild(t,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,r,n,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:h,_nulls:u}=this;(r=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=h?.flush(l.last()):t=h?.flush(s),a>0&&(n=u?.flush(s));let f=this.children.map(d=>d.flush());return this.clear(),Q({type:o,length:s,nullCount:a,children:f,child:f[0],data:t,typeIds:r,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,r,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(r=this._values)===null||r===void 0||r.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};oe.prototype.length=1;oe.prototype.stride=1;oe.prototype.children=null;oe.prototype.finished=!1;oe.prototype.nullValues=null;oe.prototype._isValid=()=>!0;He=class extends oe{constructor(t){super(t),this._values=new _o(this.ArrayType,0,this.stride)}setValue(t,r){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,r)}},Pr=class extends oe{constructor(t){super(t),this._pendingLength=0,this._offsets=new Ls(t.type)}setValue(t,r){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=r instanceof Kn?r[Os].length:r.length,n.set(t,r)}setValid(t,r){return super.setValid(t,r)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,r),this}}});var qa,o_=w(()=>{qa=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,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,r,n,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(r??0)),t.offset()}}});var Fn,U4=w(()=>{Gt();o_();xl();Fm();Ow();Fn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFooter(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Xt.V1}schema(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new cn).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new qa).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,r){let n=this.bb.__offset(this.bb_pos,10);return n?(r||new qa).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new Ce).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,Xt.V1)}static addSchema(t,r){t.addFieldOffset(1,r,0)}static addDictionaries(t,r){t.addFieldOffset(2,r,0)}static startDictionariesVector(t,r){t.startVector(24,r,8)}static addRecordBatches(t,r){t.addFieldOffset(3,r,0)}static startRecordBatchesVector(t,r){t.startVector(24,r,8)}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,r){t.finish(r)}static finishSizePrefixedFooterBuffer(t,r){t.finish(r,void 0,!0)}}});function Sp(e,t){return new Map([...e||new Map,...t||new Map])}function s_(e,t=new Map){for(let r=-1,n=e.length;++r<n;){let o=e[r].type;if(z.isDictionary(o)){if(!t.has(o.id))t.set(o.id,o.dictionary);else if(t.get(o.id)!==o.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&s_(o.children,t)}return t}var G4,z4,_t,Z,Rr=w(()=>{Ne();te();G4=Symbol.for("apache-arrow/Schema"),z4=Symbol.for("apache-arrow/Field"),_t=class e{static isSchema(t){return t?.[G4]===!0}constructor(t=[],r,n,i=Xt.V5){this.fields=t||[],this.metadata=r||new Map,n||(n=s_(this.fields)),this.dictionaries=n,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,r)=>`${r}: ${t}`).join(", ")} }>`}select(t){let r=new Set(t),n=this.fields.filter(i=>r.has(i.name));return new e(n,this.metadata)}selectAt(t){let r=t.map(n=>this.fields[n]).filter(Boolean);return new e(r,this.metadata)}assign(...t){let r=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),n=[...this.fields],i=Sp(Sp(new Map,this.metadata),r.metadata),o=r.fields.filter(a=>{let c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:Sp(Sp(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),s=s_(o,new Map);return new e([...n,...o],i,new Map([...this.dictionaries,...s]))}};_t.prototype.fields=null;_t.prototype.metadata=null;_t.prototype.dictionaries=null;_t.prototype[G4]=!0;Object.defineProperty(_t,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===_t&&_t.isSchema(t)}});Z=class e{static isField(t){return t?.[z4]===!0}static new(...t){let[r,n,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:r}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${r}`,n,i,o)}constructor(t,r,n=!1,i){this.name=t,this.type=r,this.nullable=n,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[r,n,i,o]=t;return!t[0]||typeof t[0]!="object"?[r=this.name,n=this.type,i=this.nullable,o=this.metadata]=t:{name:r=this.name,type:n=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(r,n,i,o)}};Z.prototype.type=null;Z.prototype.name=null;Z.prototype.nullable=null;Z.prototype.metadata=null;Z.prototype[z4]=!0;Object.defineProperty(Z,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===Z&&Z.isField(t)}})});var _L,ML,Mo,a_,Si,c_=w(()=>{o_();U4();Gt();Rr();Ne();Je();Vi();_L=Ba,ML=hr,Mo=class{static decode(t){t=new ML(nt(t));let r=Fn.getRootAsFooter(t),n=_t.decode(r.schema(),new Map,r.version());return new a_(n,r)}static encode(t){let r=new _L,n=_t.encode(r,t.schema);Fn.startRecordBatchesVector(r,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())Si.encode(r,s);let i=r.endVector();Fn.startDictionariesVector(r,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())Si.encode(r,s);let o=r.endVector();return Fn.startFooter(r),Fn.addSchema(r,n),Fn.addVersion(r,Xt.V5),Fn.addRecordBatches(r,i),Fn.addDictionaries(r,o),Fn.finishFooterBuffer(r,Fn.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,r=Xt.V5,n,i){this.schema=t,this.version=r,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,r=-1,n=this.numRecordBatches;++r<n;)(t=this.getRecordBatch(r))&&(yield t)}*dictionaryBatches(){for(let t,r=-1,n=this.numDictionaries;++r<n;)(t=this.getDictionaryBatch(r))&&(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}},a_=class extends Mo{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,r){super(t,r.version()),this._footer=r}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let r=this._footer.recordBatches(t);if(r)return Si.decode(r)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let r=this._footer.dictionaries(t);if(r)return Si.decode(r)}return null}},Si=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,r){let{metaDataLength:n}=r,i=BigInt(r.offset),o=BigInt(r.bodyLength);return qa.createBlock(t,i,n,o)}constructor(t,r,n){this.metaDataLength=t,this.offset=It(n),this.bodyLength=It(r)}}});var Un,V4=w(()=>{Gt();xl();jm();Fm();Un=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMessage(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Xt.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Nt.NONE}header(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(t,this.bb_pos+r):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new Ce).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,Xt.V1)}static addHeaderType(t,r){t.addFieldInt8(1,r,Nt.NONE)}static addHeader(t,r){t.addFieldOffset(2,r,0)}static addBodyLength(t,r){t.addFieldInt64(3,r,BigInt("0"))}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,r){t.finish(r)}static finishSizePrefixedMessageBuffer(t,r){t.finish(r,void 0,!0)}static createMessage(t,r,n,i,o,s){return e.startMessage(t),e.addVersion(t,r),e.addHeaderType(t,n),e.addHeader(t,i),e.addBodyLength(t,o),e.addCustomMetadata(t,s),e.endMessage(t)}}});var l_,vp,k4=w(()=>{fn();h3();km();Tw();n3();i3();s3();o3();f3();d3();c3();xw();bw();Pw();Rw();Iw();Sw();l3();a3();u3();Cw();Mw();vw();Ew();Aw();l_=class extends rt{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return yu.startNull(r),yu.endNull(r)}visitInt(t,r){return di.startInt(r),di.addBitWidth(r,t.bitWidth),di.addIsSigned(r,t.isSigned),di.endInt(r)}visitFloat(t,r){return ys.startFloatingPoint(r),ys.addPrecision(r,t.precision),ys.endFloatingPoint(r)}visitBinary(t,r){return hu.startBinary(r),hu.endBinary(r)}visitBinaryView(t,r){return uu.startBinaryView(r),uu.endBinaryView(r)}visitLargeBinary(t,r){return du.startLargeBinary(r),du.endLargeBinary(r)}visitBool(t,r){return fu.startBool(r),fu.endBool(r)}visitUtf8(t,r){return _u.startUtf8(r),_u.endUtf8(r)}visitUtf8View(t,r){return Mu.startUtf8View(r),Mu.endUtf8View(r)}visitLargeUtf8(t,r){return pu.startLargeUtf8(r),pu.endLargeUtf8(r)}visitDecimal(t,r){return zi.startDecimal(r),zi.addScale(r,t.scale),zi.addPrecision(r,t.precision),zi.addBitWidth(r,t.bitWidth),zi.endDecimal(r)}visitDate(t,r){return ds.startDate(r),ds.addUnit(r,t.unit),ds.endDate(r)}visitTime(t,r){return po.startTime(r),po.addUnit(r,t.unit),po.addBitWidth(r,t.bitWidth),po.endTime(r)}visitTimestamp(t,r){let n=t.timezone&&r.createString(t.timezone)||void 0;return go.startTimestamp(r),go.addUnit(r,t.unit),n!==void 0&&go.addTimezone(r,n),go.endTimestamp(r)}visitInterval(t,r){return ws.startInterval(r),ws.addUnit(r,t.unit),ws.endInterval(r)}visitDuration(t,r){return ms.startDuration(r),ms.addUnit(r,t.unit),ms.endDuration(r)}visitList(t,r){return gu.startList(r),gu.endList(r)}visitLargeList(t,r){return mu.startLargeList(r),mu.endLargeList(r)}visitStruct(t,r){return wu.startStruct_(r),wu.endStruct_(r)}visitUnion(t,r){mi.startTypeIdsVector(r,t.typeIds.length);let n=mi.createTypeIdsVector(r,t.typeIds);return mi.startUnion(r),mi.addMode(r,t.mode),mi.addTypeIds(r,n),mi.endUnion(r)}visitDictionary(t,r){let n=this.visit(t.indices,r);return Gi.startDictionaryEncoding(r),Gi.addId(r,BigInt(t.id)),Gi.addIsOrdered(r,t.isOrdered),n!==void 0&&Gi.addIndexType(r,n),Gi.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return ps.startFixedSizeBinary(r),ps.addByteWidth(r,t.byteWidth),ps.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return gs.startFixedSizeList(r),gs.addListSize(r,t.listSize),gs.endFixedSizeList(r)}visitMap(t,r){return _s.startMap(r),_s.addKeysSorted(r,t.keysSorted),_s.endMap(r)}},vp=new l_});function H4(e,t=new Map){return new _t(bL(e,t),Ep(e.metadata),t)}function h_(e){return new $e(e.count,Y4(e.columns),K4(e.columns),null,X4(e.columns))}function $4(e){return new Cr(h_(e.data),e.id,e.isDelta)}function bL(e,t){return(e.fields||[]).filter(Boolean).map(r=>Z.fromJSON(r,t))}function q4(e,t){return(e.children||[]).filter(Boolean).map(r=>Z.fromJSON(r,t))}function Y4(e){return(e||[]).reduce((t,r)=>[...t,new Zn(r.count,xL(r.VALIDITY)),...Y4(r.children)],[])}function K4(e,t=[]){for(let r=-1,n=(e||[]).length;++r<n;){let i=e[r];if(i.VALIDITY&&t.push(new Fe(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new Fe(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new Fe(t.length,i.OFFSET.length)),i.DATA&&t.push(new Fe(t.length,i.DATA.length)),i.VIEWS&&t.push(new Fe(t.length,i.VIEWS.length)),i.VARIADIC_DATA_BUFFERS)for(let o of i.VARIADIC_DATA_BUFFERS)t.push(new Fe(t.length,o.length));t=K4(i.children,t)}return t}function xL(e){return(e||[]).reduce((t,r)=>t+ +(r===0),0)}function X4(e){return(e||[]).reduce((t,r)=>[...t,...r.VARIADIC_DATA_BUFFERS?[r.VARIADIC_DATA_BUFFERS.length]:[],...X4(r.children)],[])}function Z4(e,t){let r,n,i,o,s,a;return!t||!(o=e.dictionary)?(s=W4(e,q4(e,t)),i=new Z(e.name,s,e.nullable,Ep(e.metadata))):t.has(r=o.id)?(n=(n=o.indexType)?j4(n):new ze,a=new je(t.get(r),n,r,o.isOrdered),i=new Z(e.name,a,e.nullable,Ep(e.metadata))):(n=(n=o.indexType)?j4(n):new ze,t.set(r,s=W4(e,q4(e,t))),a=new je(s,n,r,o.isOrdered),i=new Z(e.name,a,e.nullable,Ep(e.metadata))),i||null}function Ep(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function j4(e){return new Se(e.isSigned,e.bitWidth)}function W4(e,t){let r=e.type.name;switch(r){case"NONE":return new De;case"null":return new De;case"binary":return new ln;case"largebinary":return new _i;case"binaryview":return new Mt;case"utf8":return new vr;case"largeutf8":return new Mi;case"utf8view":return new qr;case"bool":return new Er;case"list":return new qe((t||[])[0]);case"largelist":return new Bn((t||[])[0]);case"struct":return new Yt(t||[]);case"struct_":return new Yt(t||[])}switch(r){case"int":{let n=e.type;return new Se(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=e.type;return new Sr(Vt[n.precision])}case"decimal":{let n=e.type;return new hn(n.scale,n.precision,n.bitWidth)}case"date":{let n=e.type;return new jr(Qt[n.unit])}case"time":{let n=e.type;return new fr(q[n.unit],n.bitWidth)}case"timestamp":{let n=e.type;return new dr(q[n.unit],n.timezone)}case"interval":{let n=e.type;return new Tr(Lt[n.unit])}case"duration":{let n=e.type;return new Wr(q[n.unit])}case"union":{let n=e.type,[i,...o]=(n.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new Hr(qt[s],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=e.type;return new un(n.byteWidth)}case"fixedsizelist":{let n=e.type;return new _e(n.listSize,(t||[])[0])}case"map":{let n=e.type;return new Ir((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var J4=w(()=>{Rr();te();Ds();Ne()});function EL(e,t){return(()=>{switch(t){case Nt.Schema:return _t.fromJSON(e);case Nt.RecordBatch:return $e.fromJSON(e);case Nt.DictionaryBatch:return Cr.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Nt[t]}, type: ${t} }`)})}function TL(e,t){return(()=>{switch(t){case Nt.Schema:return _t.decode(e.header(new cn),new Map,e.version());case Nt.RecordBatch:return $e.decode(e.header(new br),e.version());case Nt.DictionaryBatch:return Cr.decode(e.header(new mo),e.version())}throw new Error(`Unrecognized Message type: { name: ${Nt[t]}, type: ${t} }`)})}function IL(e,t=new Map,r=Xt.V5){let n=LL(e,t);return new _t(n,Tp(e),t,r)}function AL(e,t=Xt.V5){return new $e(e.length(),NL(e),OL(e,t),rA(e.compression()),BL(e))}function PL(e,t=Xt.V5){return new Cr($e.decode(e.data(),t),e.id(),e.isDelta())}function RL(e){return new Fe(e.offset(),e.length())}function CL(e){return new Zn(e.length(),e.nullCount())}function NL(e){let t=[];for(let r,n=-1,i=-1,o=e.nodesLength();++n<o;)(r=e.nodes(n))&&(t[++i]=Zn.decode(r));return t}function OL(e,t){let r=[];for(let n,i=-1,o=-1,s=e.buffersLength();++i<s;)(n=e.buffers(i))&&(t<Xt.V4&&(n.bb_pos+=8*(i+1)),r[++o]=Fe.decode(n));return r}function BL(e){let t=[],r=Math.trunc(e.variadicBufferCountsLength());for(let n=0;n<r;++n)t.push(It(e.variadicBufferCounts(n)));return t}function LL(e,t){let r=[];for(let n,i=-1,o=-1,s=e.fieldsLength();++i<s;)(n=e.fields(i))&&(r[++o]=Z.decode(n,t));return r}function Q4(e,t){let r=[];for(let n,i=-1,o=-1,s=e.childrenLength();++i<s;)(n=e.children(i))&&(r[++o]=Z.decode(n,t));return r}function DL(e,t){let r,n,i,o,s,a;return!t||!(a=e.dictionary())?(i=eA(e,Q4(e,t)),n=new Z(e.name(),i,e.nullable(),Tp(e))):t.has(r=It(a.id()))?(o=(o=a.indexType())?tA(o):new ze,s=new je(t.get(r),o,r,a.isOrdered()),n=new Z(e.name(),s,e.nullable(),Tp(e))):(o=(o=a.indexType())?tA(o):new ze,t.set(r,i=eA(e,Q4(e,t))),s=new je(i,o,r,a.isOrdered()),n=new Z(e.name(),s,e.nullable(),Tp(e))),n||null}function Tp(e){let t=new Map;if(e)for(let r,n,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(r=e.customMetadata(i))&&(n=r.key())!=null&&t.set(n,r.value());return t}function FL(e){let t=new Map;for(let r,n,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(r=e.customMetadata(i))&&(n=r.key())!=null&&t.set(n,r.value());return t}function tA(e){return new Se(e.isSigned(),e.bitWidth())}function eA(e,t){let r=e.typeType();switch(r){case lt.NONE:return new De;case lt.Null:return new De;case lt.Binary:return new ln;case lt.LargeBinary:return new _i;case lt.BinaryView:return new Mt;case lt.Utf8:return new vr;case lt.LargeUtf8:return new Mi;case lt.Utf8View:return new qr;case lt.Bool:return new Er;case lt.List:return new qe((t||[])[0]);case lt.LargeList:return new Bn((t||[])[0]);case lt.Struct_:return new Yt(t||[])}switch(r){case lt.Int:{let n=e.type(new di);return new Se(n.isSigned(),n.bitWidth())}case lt.FloatingPoint:{let n=e.type(new ys);return new Sr(n.precision())}case lt.Decimal:{let n=e.type(new zi);return new hn(n.scale(),n.precision(),n.bitWidth())}case lt.Date:{let n=e.type(new ds);return new jr(n.unit())}case lt.Time:{let n=e.type(new po);return new fr(n.unit(),n.bitWidth())}case lt.Timestamp:{let n=e.type(new go);return new dr(n.unit(),n.timezone())}case lt.Interval:{let n=e.type(new ws);return new Tr(n.unit())}case lt.Duration:{let n=e.type(new ms);return new Wr(n.unit())}case lt.Union:{let n=e.type(new mi);return new Hr(n.mode(),n.typeIdsArray()||[],t||[])}case lt.FixedSizeBinary:{let n=e.type(new ps);return new un(n.byteWidth())}case lt.FixedSizeList:{let n=e.type(new gs);return new _e(n.listSize(),(t||[])[0])}case lt.Map:{let n=e.type(new _s);return new Ir((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${lt[r]}" (${r})`)}function rA(e){return e?new ja(e.codec(),e.method()):null}function UL(e,t){let r=t.fields.map(o=>Z.encode(e,o));cn.startFieldsVector(e,r.length);let n=cn.createFieldsVector(e,r),i=t.metadata&&t.metadata.size>0?cn.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return Ce.startKeyValue(e),Ce.addKey(e,a),Ce.addValue(e,c),Ce.endKeyValue(e)})):-1;return cn.startSchema(e),cn.addFields(e,n),cn.addEndianness(e,jL?fs.Little:fs.Big),i!==-1&&cn.addCustomMetadata(e,i),cn.endSchema(e)}function GL(e,t){let r=-1,n=-1,i=-1,o=t.type,s=t.typeId;z.isDictionary(o)?(s=o.dictionary.typeId,i=vp.visit(o,e),n=vp.visit(o.dictionary,e)):n=vp.visit(o,e);let a=(o.children||[]).map(h=>Z.encode(e,h)),c=xr.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?xr.createCustomMetadataVector(e,[...t.metadata].map(([h,u])=>{let f=e.createString(`${h}`),d=e.createString(`${u}`);return Ce.startKeyValue(e),Ce.addKey(e,f),Ce.addValue(e,d),Ce.endKeyValue(e)})):-1;return t.name&&(r=e.createString(t.name)),xr.startField(e),xr.addType(e,n),xr.addTypeType(e,s),xr.addChildren(e,c),xr.addNullable(e,!!t.nullable),r!==-1&&xr.addName(e,r),i!==-1&&xr.addDictionary(e,i),l!==-1&&xr.addCustomMetadata(e,l),xr.endField(e)}function zL(e,t){let r=t.nodes||[],n=t.buffers||[],i=t.variadicBufferCounts||[];br.startNodesVector(e,r.length);for(let l of r.slice().reverse())Zn.encode(e,l);let o=e.endVector();br.startBuffersVector(e,n.length);for(let l of n.slice().reverse())Fe.encode(e,l);let s=e.endVector(),a=null;t.compression!==null&&(a=nA(e,t.compression));let c=-1;return i.length>0&&(c=br.createVariadicBufferCountsVector(e,i.map(BigInt))),br.startRecordBatch(e),br.addLength(e,BigInt(t.length)),br.addNodes(e,o),br.addBuffers(e,s),t.compression!==null&&a&&br.addCompression(e,a),c!==-1&&br.addVariadicBufferCounts(e,c),br.endRecordBatch(e)}function nA(e,t){return fo.startBodyCompression(e),fo.addCodec(e,t.type),fo.addMethod(e,t.method),fo.endBodyCompression(e)}function VL(e,t){let r=$e.encode(e,t.data);return mo.startDictionaryBatch(e),mo.addId(e,BigInt(t.id)),mo.addIsDelta(e,t.isDelta),mo.addData(e,r),mo.endDictionaryBatch(e)}function kL(e,t){return bl.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function qL(e,t){return Ml.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var SL,vL,Nr,$e,Cr,Fe,Zn,ja,jL,Ds=w(()=>{Gt();Ow();km();ww();e3();gw();Nw();yw();qm();xl();_w();Tw();xw();bw();Pw();Rw();Iw();Sw();Cw();vw();Ew();Aw();V4();pw();mw();Rr();Je();Vi();Ne();k4();J4();te();SL=Ba,vL=hr,Nr=class e{static fromJSON(t,r){let n=new e(0,Xt.V5,r);return n._createHeader=EL(t,r),n}static decode(t){t=new vL(nt(t));let r=Un.getRootAsMessage(t),n=r.bodyLength(),i=r.version(),o=r.headerType(),s=FL(r),a=new e(n,i,o,void 0,s);return a._createHeader=TL(r,o),a}static encode(t){let r=new SL,n=-1;t.isSchema()?n=_t.encode(r,t.header()):t.isRecordBatch()?n=$e.encode(r,t.header()):t.isDictionaryBatch()&&(n=Cr.encode(r,t.header()));let i=t.metadata&&t.metadata.size>0?Un.createCustomMetadataVector(r,[...t.metadata].map(([o,s])=>{let a=r.createString(`${o}`),c=r.createString(`${s}`);return Ce.startKeyValue(r),Ce.addKey(r,a),Ce.addValue(r,c),Ce.endKeyValue(r)})):-1;return Un.startMessage(r),Un.addVersion(r,Xt.V5),Un.addHeader(r,n),Un.addHeaderType(r,t.headerType),Un.addBodyLength(r,BigInt(t.bodyLength)),i!==-1&&Un.addCustomMetadata(r,i),Un.finishMessageBuffer(r,Un.endMessage(r)),r.asUint8Array()}static from(t,r=0){if(t instanceof _t)return new e(0,Xt.V5,Nt.Schema,t);if(t instanceof $e)return new e(r,Xt.V5,Nt.RecordBatch,t,t.metadata);if(t instanceof Cr)return new e(r,Xt.V5,Nt.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 compression(){return this._compression}get bodyLength(){return this._bodyLength}get metadata(){return this._metadata}header(){return this._createHeader()}isSchema(){return this.headerType===Nt.Schema}isRecordBatch(){return this.headerType===Nt.RecordBatch}isDictionaryBatch(){return this.headerType===Nt.DictionaryBatch}constructor(t,r,n,i,o){this._version=r,this._headerType=n,this.body=new Uint8Array(0),this._compression=i?.compression,i&&(this._createHeader=()=>i),this._bodyLength=It(t),this._metadata=o||new Map}},$e=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}get compression(){return this._compression}get variadicBufferCounts(){return this._variadicBufferCounts}get metadata(){return this._metadata}constructor(t,r,n,i,o=[],s){this._nodes=r,this._buffers=n,this._length=It(t),this._compression=i,this._variadicBufferCounts=o,this._metadata=s||new Map}},Cr=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,r,n=!1){this._data=t,this._isDelta=n,this._id=It(r)}},Fe=class{constructor(t,r){this.offset=It(t),this.length=It(r)}},Zn=class{constructor(t,r){this.length=It(t),this.nullCount=It(r)}},ja=class{constructor(t,r=La.BUFFER){this.type=t,this.method=r}};Z.encode=GL;Z.decode=DL;Z.fromJSON=Z4;_t.encode=UL;_t.decode=IL;_t.fromJSON=H4;$e.encode=zL;$e.decode=AL;$e.fromJSON=h_;Cr.encode=VL;Cr.decode=PL;Cr.fromJSON=$4;Zn.encode=kL;Zn.decode=CL;Fe.encode=qL;Fe.decode=RL;ja.encode=nA;ja.decode=rA;jL=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})()});var pe,Lu,Wa,Ip,Du=w(()=>{an();su();pe=Object.freeze({done:!0,value:void 0}),Lu=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Wa=class{tee(){return this._getDOMStream().tee()}pipe(t,r){return this._getNodeStream().pipe(t,r)}pipeTo(t,r){return this._getDOMStream().pipeTo(t,r)}pipeThrough(t,r){return this._getDOMStream().pipeThrough(t,r)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},Ip=class extends Wa{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return Y(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(pe);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return lr.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return lr.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Y(this,void 0,void 0,function*(){return yield this.abort(t),pe})}return(t){return Y(this,void 0,void 0,function*(){return yield this.close(),pe})}read(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((r,n)=>{this.resolvers.push({resolve:r,reject:n})}):Promise.resolve(pe)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}});var Jn,Qn,mn,u_,bo,Fs=w(()=>{an();su();uo();Du();Je();us();Jn=class extends Ip{write(t){if((t=nt(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?yl(this.toUint8Array(!0)):this.toUint8Array(!1).then(yl)}toUint8Array(t=!1){return t?In(this._values)[0]:Y(this,void 0,void 0,function*(){var r,n,i,o;let s=[],a=0;try{for(var c=!0,l=vn(this),h;h=yield l.next(),r=h.done,!r;c=!0){o=h.value,c=!1;let u=o;s.push(u),a+=u.byteLength}}catch(u){n={error:u}}finally{try{!c&&!r&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return In(s,a)[0]})}},Qn=class{constructor(t){t&&(this.source=new u_(lr.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)}},mn=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof Jn?this.source=new bo(lr.fromAsyncIterable(t)):Bm(t)?this.source=new bo(lr.fromNodeStream(t)):nu(t)?this.source=new bo(lr.fromDOMStream(t)):Nm(t)?this.source=new bo(lr.fromDOMStream(t.body)):hi(t)?this.source=new bo(lr.fromIterable(t)):Tn(t)?this.source=new bo(lr.fromAsyncIterable(t)):$n(t)&&(this.source=new bo(lr.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)}},u_=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,r="read"){return this.source.next({cmd:r,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||pe)}return(t){return Object.create(this.source.return&&this.source.return(t)||pe)}},bo=class{constructor(t){this.source=t,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(t){return Y(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return Y(this,arguments,void 0,function*(r,n="read"){return yield this.source.next({cmd:n,size:r})})}throw(t){return Y(this,void 0,void 0,function*(){let r=this.source.throw&&(yield this.source.throw(t))||pe;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(t){return Y(this,void 0,void 0,function*(){let r=this.source.return&&(yield this.source.return(t))||pe;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}}});var Fu,Us,f_=w(()=>{an();Fs();Je();Fu=class extends Qn{constructor(t,r){super(),this.position=0,this.buffer=nt(t),this.size=r===void 0?this.buffer.byteLength:r}readInt32(t){let{buffer:r,byteOffset:n}=this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:r,size:n,position:i}=this;return r&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),r.subarray(i,this.position)):null}readAt(t,r){let n=this.buffer,i=Math.min(this.size,t+r);return n?n.subarray(t,i):new Uint8Array(r)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Us=class extends mn{constructor(t,r){super(),this.position=0,this._handle=t,typeof r=="number"?this.size=r:this._pending=Y(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return Y(this,void 0,void 0,function*(){let{buffer:r,byteOffset:n}=yield this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)})}seek(t){return Y(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return Y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:n,position:i}=this;if(r&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(n,o+Math.min(n-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield r.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,r){return Y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+r<i){let o=Math.min(i,t+r),s=new Uint8Array(o-t);return(yield n.read(s,0,r,t)).buffer}return new Uint8Array(r)})}close(){return Y(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return Y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return Y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}}});var m_={};Zr(m_,{BaseInt64:()=>Uu,Int128:()=>Gu,Int64:()=>xo,Uint64:()=>Oe});function Fl(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var Ul,d_,Uu,Oe,xo,Gu,p_=w(()=>{Ul=8,d_=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Uu=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=r[3]*n[3];this.buffer[0]=i&65535;let o=i>>>16;return i=r[2]*n[3],o+=i,i=r[3]*n[2]>>>0,o+=i,this.buffer[0]+=o<<16,this.buffer[1]=o>>>0<i?65536:0,this.buffer[1]+=o>>>16,this.buffer[1]+=r[1]*n[3]+r[2]*n[2]+r[3]*n[1],this.buffer[1]+=r[0]*n[3]+r[1]*n[2]+r[2]*n[1]+r[3]*n[0]<<16,this}_plus(t){let r=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],r<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=r}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`${Fl(this.buffer[1])} ${Fl(this.buffer[0])}`}},Oe=class e extends Uu{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.length,i=new e(r);for(let o=0;o<n;){let s=Ul<n-o?Ul:n-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([d_[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},xo=class e extends Uu{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let r=this.buffer[1]<<0,n=t.buffer[1]<<0;return r<n||r===n&&this.buffer[0]<t.buffer[0]}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=Ul<i-s?Ul:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([d_[a],0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},Gu=class e{constructor(t){this.buffer=t}high(){return new xo(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new xo(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let r=new Oe(new Uint32Array([this.buffer[3],0])),n=new Oe(new Uint32Array([this.buffer[2],0])),i=new Oe(new Uint32Array([this.buffer[1],0])),o=new Oe(new Uint32Array([this.buffer[0],0])),s=new Oe(new Uint32Array([t.buffer[3],0])),a=new Oe(new Uint32Array([t.buffer[2],0])),c=new Oe(new Uint32Array([t.buffer[1],0])),l=new Oe(new Uint32Array([t.buffer[0],0])),h=Oe.multiply(o,l);this.buffer[0]=h.low();let u=new Oe(new Uint32Array([h.high(),0]));return h=Oe.multiply(i,l),u.plus(h),h=Oe.multiply(o,c),u.plus(h),this.buffer[1]=u.low(),this.buffer[3]=u.lessThan(h)?1:0,this.buffer[2]=u.high(),new Oe(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Oe.multiply(n,l)).plus(Oe.multiply(i,c)).plus(Oe.multiply(o,a)),this.buffer[3]+=Oe.multiply(r,l).plus(Oe.multiply(n,c)).plus(Oe.multiply(i,a)).plus(Oe.multiply(o,s)).low(),this}plus(t){let r=new Uint32Array(4);return r[3]=this.buffer[3]+t.buffer[3]>>>0,r[2]=this.buffer[2]+t.buffer[2]>>>0,r[1]=this.buffer[1]+t.buffer[1]>>>0,r[0]=this.buffer[0]+t.buffer[0]>>>0,r[0]<this.buffer[0]>>>0&&++r[1],r[1]<this.buffer[1]>>>0&&++r[2],r[2]<this.buffer[2]>>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${Fl(this.buffer[3])} ${Fl(this.buffer[2])} ${Fl(this.buffer[1])} ${Fl(this.buffer[0])}`}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}static from(t,r=new Uint32Array(4)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(4)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=Ul<i-s?Ul:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([d_[a],0,0,0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+16*n,4));return r}}});var M_={};Zr(M_,{toIntervalDayTimeInt32Array:()=>g_,toIntervalDayTimeObjects:()=>w_,toIntervalMonthDayNanoInt32Array:()=>y_,toIntervalMonthDayNanoObjects:()=>__});function g_(e){var t,r;let n=e.length,i=new Int32Array(n*2);for(let o=0,s=0;o<n;o++){let a=e[o];i[s++]=(t=a.days)!==null&&t!==void 0?t:0,i[s++]=(r=a.milliseconds)!==null&&r!==void 0?r:0}return i}function y_(e){var t,r;let n=e.length,i=new Int32Array(n*4);for(let o=0,s=0;o<n;o++){let a=e[o];i[s++]=(t=a.months)!==null&&t!==void 0?t:0,i[s++]=(r=a.days)!==null&&r!==void 0?r:0;let c=a.nanoseconds;if(c){let l=BigInt(c);i[s++]=Number(l&BigInt(4294967295))>>>0,i[s++]=Number(l>>BigInt(32))>>>0}else s+=2}return i}function w_(e){let t=e.length,r=new Array(t/2);for(let n=0,i=0;n<t;n+=2)r[i++]={days:e[n],milliseconds:e[n+1]};return r}function __(e,t){let r=e.length,n=new Array(r/4);for(let i=0,o=0;i<r;i+=4){let s=BigInt(e[i+3])<<BigInt(32)|BigInt(e[i+2]>>>0);n[o++]={months:e[i],days:e[i+1],nanoseconds:t?`${s}`:s}}return n}var Ap=w(()=>{});function oA(e){let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)t[r>>1]=Number.parseInt(e.slice(r,r+2),16);return t}function WL(e){return oA(e.join(""))}function sA(e,t){let r=new Uint8Array(e.length*16),n=new DataView(r.buffer);for(let[i,o]of e.entries()){let s=i*16,a=o.SIZE;if(n.setInt32(s,a,!0),o.INLINED!==void 0){let c=t(o.INLINED);for(let l=0;l<c.length&&l<12;l++)r[s+4+l]=c[l]}else{let c=o.PREFIX_HEX;for(let l=0;l<8&&l<c.length;l+=2)r[s+4+(l>>1)]=Number.parseInt(c.slice(l,l+2),16);n.setInt32(s+8,o.BUFFER_INDEX,!0),n.setInt32(s+12,o.OFFSET,!0)}}return r}function HL(e){return sA(e,t=>{let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n>>1]=Number.parseInt(t.slice(n,n+2),16);return r})}function $L(e){return sA(e,t=>new TextEncoder().encode(t))}var Gl,Pp,Rp,aA=w(()=>{Xn();Rr();te();fn();Va();uo();p_();Ne();Je();Ap();Gl=class extends rt{constructor(t,r,n,i,o=Xt.V5,s=[]){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.variadicBufferIndex=-1,this.bytes=t,this.nodes=r,this.buffers=n,this.dictionaries=i,this.metadataVersion=o,this.variadicBufferCounts=s}visit(t){return super.visit(t instanceof Z?t.type:t)}visitNull(t,{length:r}=this.nextFieldNode()){return Q({type:t,length:r})}visitBool(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitUtf8View(t,{length:r,nullCount:n}=this.nextFieldNode()){let i=this.readNullBitmap(t,n),o=this.readData(t),s=this.readVariadicBuffers(this.nextVariadicBufferCount());return Q({type:t,length:r,nullCount:n,nullBitmap:i,views:o,variadicBuffers:s})}visitBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinaryView(t,{length:r,nullCount:n}=this.nextFieldNode()){let i=this.readNullBitmap(t,n),o=this.readData(t),s=this.readVariadicBuffers(this.nextVariadicBufferCount());return Q({type:t,length:r,nullCount:n,nullBitmap:i,views:o,variadicBuffers:s})}visitFixedSizeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitLargeList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<Xt.V5&&this.readNullBitmap(t,n),t.mode===qt.Sparse?this.visitSparseUnion(t,{length:r,nullCount:n}):this.visitDenseUnion(t,{length:r,nullCount:n})}visitDenseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,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,r,n=this.nextBufferRange()){return r>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,r){return this.readData(t,r)}readTypeIds(t,r){return this.readData(t,r)}readData(t,{length:r,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+r)}readVariadicBuffers(t){return Array.from({length:t},()=>this.readData(null))}nextVariadicBufferCount(){var t;return(t=this.variadicBufferCounts[++this.variadicBufferIndex])!==null&&t!==void 0?t:0}readDictionary(t){return this.dictionaries.get(t.id)}},Pp=class extends Gl{constructor(t,r,n,i,o,s=[]){super(new Uint8Array(0),r,n,i,o,s),this.sources=t}readNullBitmap(t,r,{offset:n}=this.nextBufferRange()){return r<=0?new Uint8Array(0):za(this.sources[n])}readOffsets(t,{offset:r}=this.nextBufferRange()){return Tt(Uint8Array,Tt(t.OffsetArrayType,this.sources[r]))}readTypeIds(t,{offset:r}=this.nextBufferRange()){return Tt(Uint8Array,Tt(t.ArrayType,this.sources[r]))}readData(t,{offset:r}=this.nextBufferRange()){let{sources:n}=this;if(z.isTimestamp(t))return Tt(Uint8Array,xo.convertArray(n[r]));if((z.isInt(t)||z.isTime(t))&&t.bitWidth===64||z.isDuration(t))return Tt(Uint8Array,xo.convertArray(n[r]));if(z.isDate(t)&&t.unit===Qt.MILLISECOND)return Tt(Uint8Array,xo.convertArray(n[r]));if(z.isDecimal(t))return Tt(Uint8Array,Gu.convertArray(n[r]));if(z.isBinary(t)||z.isLargeBinary(t)||z.isFixedSizeBinary(t))return WL(n[r]);if(z.isBinaryView(t))return HL(n[r]);if(z.isUtf8View(t))return $L(n[r]);if(z.isBool(t))return za(n[r]);if(z.isUtf8(t)||z.isLargeUtf8(t))return En(n[r].join(""));if(z.isInterval(t))switch(t.unit){case Lt.DAY_TIME:return g_(n[r]);case Lt.MONTH_DAY_NANO:return y_(n[r]);default:break}return Tt(Uint8Array,Tt(t.ArrayType,n[r].map(i=>+i)))}readVariadicBuffers(t){let r=[];for(let n=0;n<t;n++){let{offset:i}=this.nextBufferRange(),o=this.sources[i];r.push(oA(o))}return r}};Rp=class extends Gl{constructor(t,r,n,i,o,s=[]){super(new Uint8Array(0),r,n,i,o,s),this.bodyChunks=t}readData(t,r=this.nextBufferRange()){return this.bodyChunks[this.buffersIndex]}}});var So,Cp=w(()=>{xi();me();Je();So=class extends Pr{constructor(t){super(t),this._values=new dn(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,nt(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,0);else{let c=a.length;i.set(a,o),n.set(s,c),o+=c}}}});var vo,Np=w(()=>{Je();xi();me();vo=class extends Pr{constructor(t){super(t),this._values=new dn(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,nt(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,BigInt(0));else{let c=a.length;i.set(a,o),n.set(s,BigInt(c)),o+=c}}}});var Ha,b_=w(()=>{xi();me();Ha=class extends oe{constructor(t){super(t),this._values=new Dl}setValue(t,r){this._values.set(t,+r)}}});var Hi,Gs,zs,x_=w(()=>{me();Dn();Hi=class extends He{};Hi.prototype._setValue=kw;Gs=class extends Hi{};Gs.prototype._setValue=$m;zs=class extends Hi{};zs.prototype._setValue=Ym});var Vs,S_=w(()=>{me();Dn();Vs=class extends He{};Vs.prototype._setValue=Ww});var $a,v_=w(()=>{te();me();zu();$a=class extends oe{constructor({type:t,nullValues:r,dictionaryHashFunction:n}){super({type:new je(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=vi({type:this.type.indices,nullValues:r}),this.dictionary=vi({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,r){let n=this.indices;return r=n.setValid(t,r),this.length=n.length,r}setValue(t,r){let n=this._keysToIndices,i=this.valueToKey(r),o=n[i];return o===void 0&&(n[i]=o=this._dictionaryOffset+this.dictionary.append(r).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,r=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=r?r.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}}});var ks,E_=w(()=>{me();Dn();ks=class extends He{};ks.prototype._setValue=Vw});var Ya,T_=w(()=>{Rr();me();te();Ya=class extends oe{setValue(t,r){let[n]=this.children,i=t*this.stride;for(let o=-1,s=this.stride;++o<s;)n.set(i+o,r[o])}setValid(t,r){return super.setValid(t,r)||this.children[0].setValid((t+1)*this.stride-1,!1),r}addChild(t,r="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new _e(this.type.listSize,new Z(r,t.type,!0)),n}}});var $i,Ka,Xa,Za,I_=w(()=>{Pu();me();$i=class extends He{setValue(t,r){this._values.set(t,r)}},Ka=class extends $i{setValue(t,r){super.setValue(t,Au(r))}},Xa=class extends $i{},Za=class extends $i{}});var Ei,qs,js,Ws,A_=w(()=>{me();Dn();Ei=class extends He{};Ei.prototype._setValue=Hw;qs=class extends Ei{};qs.prototype._setValue=np;js=class extends Ei{};js.prototype._setValue=ip;Ws=class extends Ei{};Ws.prototype._setValue=op});var ti,Hs,$s,Ys,Ks,P_=w(()=>{me();Dn();ti=class extends He{};ti.prototype._setValue=$w;Hs=class extends ti{};Hs.prototype._setValue=sp;$s=class extends ti{};$s.prototype._setValue=ap;Ys=class extends ti{};Ys.prototype._setValue=cp;Ks=class extends ti{};Ks.prototype._setValue=lp});var $r,Ja,Qa,tc,ec,rc,nc,ic,oc,R_=w(()=>{me();$r=class extends He{setValue(t,r){this._values.set(t,r)}},Ja=class extends $r{},Qa=class extends $r{},tc=class extends $r{},ec=class extends $r{},rc=class extends $r{},nc=class extends $r{},ic=class extends $r{},oc=class extends $r{}});var sc,C_=w(()=>{Rr();te();xi();me();sc=class extends Pr{constructor(t){super(t),this._offsets=new Ls(t.type)}addChild(t,r="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new qe(new Z(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(typeof o>"u")r.set(i,0);else{let s=o,a=s.length,c=r.set(i,a).buffer[i];for(let l=-1;++l<a;)n.set(c+l,s[l])}}}});var ac,N_=w(()=>{Rr();te();xi();Vi();me();ac=class extends Pr{constructor(t){super(t),this._offsets=new Ls(t.type)}addChild(t,r="0"){if(this.numChildren>0)throw new Error("LargeListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Bn(new Z(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(typeof o>"u")r.set(i,BigInt(0));else{let s=o,a=s.length,c=It(r.set(i,BigInt(a)).buffer[i]);for(let l=-1;++l<a;)n.set(c+l,s[l])}}}});var cc,O_=w(()=>{Rr();te();me();cc=class extends Pr{set(t,r){return super.set(t,r)}setValue(t,r){let n=r instanceof Map?r:new Map(Object.entries(r)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,r=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Ir(new Z(r,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(o===void 0)r.set(i,0);else{let{[i]:s,[i+1]:a}=r.set(i,o.size).buffer;for(let c of o.entries())if(n.set(s,c),++s>=a)break}}}});var lc,B_=w(()=>{me();lc=class extends oe{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}}});var hc,L_=w(()=>{Rr();me();te();hc=class extends oe{setValue(t,r){let{children:n,type:i}=this;switch(Array.isArray(r)||r.constructor){case!0:return i.children.forEach((o,s)=>n[s].set(t,r[s]));case Map:return i.children.forEach((o,s)=>n[s].set(t,r.get(o.name)));default:return i.children.forEach((o,s)=>n[s].set(t,r[o.name]))}}setValid(t,r){return super.setValid(t,r)||this.children.forEach(n=>n.setValid(t,r)),r}addChild(t,r=`${this.numChildren}`){let n=this.children.push(t);return this.type=new Yt([...this.type.children,new Z(r,t.type,!0)]),n}}});var ei,Xs,Zs,Js,Qs,D_=w(()=>{me();Dn();ei=class extends He{};ei.prototype._setValue=qw;Xs=class extends ei{};Xs.prototype._setValue=Km;Zs=class extends ei{};Zs.prototype._setValue=Xm;Js=class extends ei{};Js.prototype._setValue=Zm;Qs=class extends ei{};Qs.prototype._setValue=Jm});var ri,ta,ea,ra,na,F_=w(()=>{me();Dn();ri=class extends He{};ri.prototype._setValue=jw;ta=class extends ri{};ta.prototype._setValue=Qm;ea=class extends ri{};ea.prototype._setValue=tp;ra=class extends ri{};ra.prototype._setValue=ep;na=class extends ri{};na.prototype._setValue=rp});var Eo,uc,fc,U_=w(()=>{Rr();xi();me();te();Eo=class extends oe{constructor(t){super(t),this._typeIds=new _o(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,r){return this.set(this.length,t,r)}set(t,r,n){return n===void 0&&(n=this._valueToChildTypeId(this,r,t)),this.setValue(t,r,n),this}setValue(t,r,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],o=this.children[i];o?.set(t,r),this.length=Math.max(t+1,this.length)}addChild(t,r=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new Z(r,t.type)];return this.type=new Hr(o,[...s,n],a),n}_valueToChildTypeId(t,r,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},uc=class extends Eo{},fc=class extends Eo{constructor(t){super(t),this._offsets=new _o(Int32Array)}setValue(t,r,n){let i=this._typeIds.set(t,n).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,r),this.length=Math.max(t+1,this.length)}}});var ia,G_=w(()=>{uo();Cp();xi();me();ia=class extends Pr{constructor(t){super(t),this._values=new dn(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,En(r))}_flushPending(t,r){}};ia.prototype._flushPending=So.prototype._flushPending});var oa,z_=w(()=>{uo();xi();me();Np();oa=class extends Pr{constructor(t){super(t),this._values=new dn(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,En(r))}_flushPending(t,r){}};oa.prototype._flushPending=vo.prototype._flushPending});var To,Op=w(()=>{te();me();xi();Je();Xn();To=class extends oe{constructor(t){super(t),this._variadicBuffers=[],this._currentBuffer=null,this._currentBufferIndex=0,this._currentBufferOffset=0,this._bufferSize=32*1024*1024,this._views=new dn(Uint8Array)}get byteLength(){let t=0;this._views&&(t+=this._views.byteLength),this._nulls&&(t+=this._nulls.byteLength);for(let r of this._variadicBuffers)t+=r.byteLength;return this._currentBuffer&&(t+=this._currentBuffer.byteLength),t}setValue(t,r){return this.writeBinaryValue(t,this.encodeValue(r))}writeBinaryValue(t,r){let n=r.length,i=(t+1)*Mt.ELEMENT_WIDTH,o=this._views.length;i>o&&this._views.reserve(i-o);let s=this._views.buffer,a=t*Mt.ELEMENT_WIDTH,c=new DataView(s.buffer,s.byteOffset+a,Mt.ELEMENT_WIDTH);if(c.setInt32(Mt.LENGTH_OFFSET,n,!0),n<=Mt.INLINE_CAPACITY){s.set(r,a+Mt.INLINE_OFFSET);for(let l=n;l<Mt.INLINE_CAPACITY;l++)s[a+Mt.INLINE_OFFSET+l]=0}else{let l=new DataView(r.buffer,r.byteOffset,Math.min(4,n));c.setUint32(Mt.INLINE_OFFSET,l.getUint32(0,!0),!0),(!this._currentBuffer||this._currentBufferOffset+n>this._bufferSize)&&(this._currentBuffer&&this._variadicBuffers.push(this._currentBuffer.buffer.slice(0,this._currentBufferOffset)),this._currentBuffer=new dn(Uint8Array),this._currentBufferIndex=this._variadicBuffers.length,this._currentBufferOffset=0),this._currentBuffer.reserve(n).buffer.set(r,this._currentBufferOffset),c.setInt32(Mt.BUFFER_INDEX_OFFSET,this._currentBufferIndex,!0),c.setInt32(Mt.BUFFER_OFFSET_OFFSET,this._currentBufferOffset,!0),this._currentBufferOffset+=n}return this}encodeValue(t){return nt(t)}setValid(t,r){let n=(t+1)*Mt.ELEMENT_WIDTH,i=this._views.length;n>i&&this._views.reserve(n-i);let o=super.setValid(t,r);if(!o){let s=this._views.buffer,a=t*Mt.ELEMENT_WIDTH;for(let c=0;c<Mt.ELEMENT_WIDTH;c++)s[a+c]=0}return o}clear(){return this._variadicBuffers=[],this._currentBuffer=null,this._currentBufferIndex=0,this._currentBufferOffset=0,this._views.clear(),super.clear()}flush(){let{type:t,length:r,nullCount:n,_views:i,_nulls:o}=this;this._currentBuffer&&this._currentBufferOffset>0&&(this._variadicBuffers.push(this._currentBuffer.buffer.slice(0,this._currentBufferOffset)),this._currentBuffer=null,this._currentBufferOffset=0);let s=i.flush(r*Mt.ELEMENT_WIDTH),a=n>0?o.flush(r):void 0,c=this._variadicBuffers.slice();return this._variadicBuffers=[],this._currentBufferIndex=0,this.clear(),Q({type:t,length:r,nullCount:n,nullBitmap:a,views:s,variadicBuffers:c})}finish(){return this.finished=!0,this}}});var dc,V_=w(()=>{Op();uo();dc=class extends To{constructor(t){super(t)}setValue(t,r){return this.writeBinaryValue(t,En(r))}}});var k_,cA,lA=w(()=>{fn();Cp();Np();b_();x_();S_();v_();E_();T_();I_();A_();P_();R_();C_();N_();O_();B_();L_();D_();F_();U_();G_();z_();Op();V_();k_=class extends rt{visitNull(){return lc}visitBool(){return Ha}visitInt(){return $r}visitInt8(){return Ja}visitInt16(){return Qa}visitInt32(){return tc}visitInt64(){return ec}visitUint8(){return rc}visitUint16(){return nc}visitUint32(){return ic}visitUint64(){return oc}visitFloat(){return $i}visitFloat16(){return Ka}visitFloat32(){return Xa}visitFloat64(){return Za}visitUtf8(){return ia}visitLargeUtf8(){return oa}visitBinary(){return So}visitLargeBinary(){return vo}visitFixedSizeBinary(){return ks}visitDate(){return Hi}visitDateDay(){return Gs}visitDateMillisecond(){return zs}visitTimestamp(){return ei}visitTimestampSecond(){return Xs}visitTimestampMillisecond(){return Zs}visitTimestampMicrosecond(){return Js}visitTimestampNanosecond(){return Qs}visitTime(){return ri}visitTimeSecond(){return ta}visitTimeMillisecond(){return ea}visitTimeMicrosecond(){return ra}visitTimeNanosecond(){return na}visitDecimal(){return Vs}visitList(){return sc}visitLargeList(){return ac}visitStruct(){return hc}visitUnion(){return Eo}visitDenseUnion(){return fc}visitSparseUnion(){return uc}visitDictionary(){return $a}visitInterval(){return Ei}visitIntervalDayTime(){return qs}visitIntervalYearMonth(){return js}visitIntervalMonthDayNano(){return Ws}visitDuration(){return ti}visitDurationSecond(){return Hs}visitDurationMillisecond(){return $s}visitDurationMicrosecond(){return Ys}visitDurationNanosecond(){return Ks}visitFixedSizeList(){return Ya}visitMap(){return cc}visitBinaryView(){return To}visitUtf8View(){return dc}},cA=new k_});function Yr(e,t){return t instanceof e.constructor}function Io(e,t){return e===t||Yr(e,t)}function Ao(e,t){return e===t||Yr(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function Bp(e,t){return e===t||Yr(e,t)&&e.precision===t.precision}function YL(e,t){return e===t||Yr(e,t)&&e.byteWidth===t.byteWidth}function q_(e,t){return e===t||Yr(e,t)&&e.unit===t.unit}function Vu(e,t){return e===t||Yr(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function ku(e,t){return e===t||Yr(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function hA(e,t){return e===t||Yr(e,t)&&e.children.length===t.children.length&&Yi.compareManyFields(e.children,t.children)}function KL(e,t){return e===t||Yr(e,t)&&e.children.length===t.children.length&&Yi.compareManyFields(e.children,t.children)}function j_(e,t){return e===t||Yr(e,t)&&e.mode===t.mode&&e.typeIds.every((r,n)=>r===t.typeIds[n])&&Yi.compareManyFields(e.children,t.children)}function XL(e,t){return e===t||Yr(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Yi.visit(e.indices,t.indices)&&Yi.visit(e.dictionary,t.dictionary)}function Lp(e,t){return e===t||Yr(e,t)&&e.unit===t.unit}function qu(e,t){return e===t||Yr(e,t)&&e.unit===t.unit}function ZL(e,t){return e===t||Yr(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Yi.compareManyFields(e.children,t.children)}function JL(e,t){return e===t||Yr(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Yi.compareManyFields(e.children,t.children)}function mc(e,t){return Yi.compareSchemas(e,t)}function uA(e,t){return Yi.compareFields(e,t)}function Dp(e,t){return Yi.visit(e,t)}var at,Yi,ju=w(()=>{fn();at=class extends rt{compareSchemas(t,r){return t===r||r instanceof t.constructor&&this.compareManyFields(t.fields,r.fields)}compareManyFields(t,r){return t===r||Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((n,i)=>this.compareFields(n,r[i]))}compareFields(t,r){return t===r||r instanceof t.constructor&&t.name===r.name&&t.nullable===r.nullable&&this.visit(t.type,r.type)}};at.prototype.visitNull=Io;at.prototype.visitBool=Io;at.prototype.visitInt=Ao;at.prototype.visitInt8=Ao;at.prototype.visitInt16=Ao;at.prototype.visitInt32=Ao;at.prototype.visitInt64=Ao;at.prototype.visitUint8=Ao;at.prototype.visitUint16=Ao;at.prototype.visitUint32=Ao;at.prototype.visitUint64=Ao;at.prototype.visitFloat=Bp;at.prototype.visitFloat16=Bp;at.prototype.visitFloat32=Bp;at.prototype.visitFloat64=Bp;at.prototype.visitUtf8=Io;at.prototype.visitLargeUtf8=Io;at.prototype.visitUtf8View=Io;at.prototype.visitBinary=Io;at.prototype.visitLargeBinary=Io;at.prototype.visitBinaryView=Io;at.prototype.visitFixedSizeBinary=YL;at.prototype.visitDate=q_;at.prototype.visitDateDay=q_;at.prototype.visitDateMillisecond=q_;at.prototype.visitTimestamp=Vu;at.prototype.visitTimestampSecond=Vu;at.prototype.visitTimestampMillisecond=Vu;at.prototype.visitTimestampMicrosecond=Vu;at.prototype.visitTimestampNanosecond=Vu;at.prototype.visitTime=ku;at.prototype.visitTimeSecond=ku;at.prototype.visitTimeMillisecond=ku;at.prototype.visitTimeMicrosecond=ku;at.prototype.visitTimeNanosecond=ku;at.prototype.visitDecimal=Io;at.prototype.visitList=hA;at.prototype.visitLargeList=hA;at.prototype.visitStruct=KL;at.prototype.visitUnion=j_;at.prototype.visitDenseUnion=j_;at.prototype.visitSparseUnion=j_;at.prototype.visitDictionary=XL;at.prototype.visitInterval=Lp;at.prototype.visitIntervalDayTime=Lp;at.prototype.visitIntervalYearMonth=Lp;at.prototype.visitIntervalMonthDayNano=Lp;at.prototype.visitDuration=qu;at.prototype.visitDurationSecond=qu;at.prototype.visitDurationMillisecond=qu;at.prototype.visitDurationMicrosecond=qu;at.prototype.visitDurationNanosecond=qu;at.prototype.visitFixedSizeList=ZL;at.prototype.visitMap=JL;Yi=new at});function vi(e){let t=e.type,r=new(cA.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let n=e.children||[],i={nullValues:e.nullValues},o=Array.isArray(n)?((s,a)=>n[a]||i):(({name:s})=>n[s]||i);for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);r.children.push(vi(Object.assign(Object.assign({},l),{type:c})))}}return r}function zl(e,t){if(e instanceof ut||e instanceof $||e.type instanceof z||ArrayBuffer.isView(e))return Wi(e);let r={type:t??Fp(e),nullValues:[null]},n=[...Up(r)(e)],i=n.length===1?n[0]:n.reduce((o,s)=>o.concat(s));return z.isDictionary(i.type)?i.memoize():i}function W_(e){let t=zl(e),r=new Zt(new _t(t.type.children),t.data[0]);return new ce(r)}function Fp(e){if(e.length===0)return new De;let t=0,r=0,n=0,i=0,o=0,s=0,a=0,c=0;for(let l of e){if(l==null){++t;continue}switch(typeof l){case"bigint":++s;continue;case"boolean":++a;continue;case"number":++i;continue;case"string":++o;continue;case"object":Array.isArray(l)?++r:Object.prototype.toString.call(l)==="[object Date]"?++c:++n;continue}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}if(i+t===e.length)return new On;if(o+t===e.length)return new je(new vr,new ze);if(s+t===e.length)return new Rn;if(a+t===e.length)return new Er;if(c+t===e.length)return new ki;if(r+t===e.length){let l=e,h=Fp(l[l.findIndex(u=>u!=null)]);if(l.every(u=>u==null||Dp(h,Fp(u))))return new qe(new Z("",h,!0))}else if(n+t===e.length){let l=new Map;for(let h of e)for(let u of Object.keys(h))!l.has(u)&&h[u]!=null&&l.set(u,new Z(u,Fp([h[u]]),!0));return new Yt([...l.values()])}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}function Up(e){let{["queueingStrategy"]:t="count"}=e,{["highWaterMark"]:r=t!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=e,n=t!=="bytes"?"length":"byteLength";return function*(i){let o=0,s=vi(e);for(let a of i)s.append(a)[n]>=r&&++o&&(yield s.toVector());(s.finish().length>0||o===0)&&(yield s.toVector())}}function H_(e){let{["queueingStrategy"]:t="count"}=e,{["highWaterMark"]:r=t!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=e,n=t!=="bytes"?"length":"byteLength";return function(i){return Gr(this,arguments,function*(){var o,s,a,c;let l=0,h=vi(e);try{for(var u=!0,f=vn(i),d;d=yield wt(f.next()),o=d.done,!o;u=!0){c=d.value,u=!1;let m=c;h.append(m)[n]>=r&&++l&&(yield yield wt(h.toVector()))}}catch(m){s={error:m}}finally{try{!u&&!o&&(a=f.return)&&(yield wt(a.call(f)))}finally{if(s)throw s.error}}(h.finish().length>0||l===0)&&(yield yield wt(h.toVector()))})}}var zu=w(()=>{an();Rr();te();Xn();Ar();lA();pc();Po();ju()});function Gp(e,t){return QL(e,t.map(r=>r.data.concat()))}function QL(e,t){let r=[...e.fields],n=[],i={numBatches:t.reduce((u,f)=>Math.max(u,f.length),0)},o=0,s=0,a=-1,c=t.length,l,h=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)h[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(h=tD(r,s,h,t,i),s>0&&(n[o++]=Q({type:new Yt(r),length:s,nullCount:0,children:h.slice()})))}return[e=e.assign(r),n.map(u=>new Zt(e,u))]}function tD(e,t,r,n,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let l=r[a],h=l?.length;if(h>=t)h===t?r[a]=l:(r[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(l.slice(t,h-t))));else{let u=e[a];e[a]=u.clone({nullable:!0}),r[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:Q({type:u.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return r}var fA=w(()=>{Xn();te();Po()});function $_(e){let t={},r=Object.entries(e);for(let[n,i]of r)t[n]=Wi(i);return new ce(t)}function Y_(e){let t={},r=Object.entries(e);for(let[n,i]of r)t[n]=zl(i);return new ce(t)}var dA,mA,ce,pc=w(()=>{Ne();Xn();zu();Ar();Rr();te();ju();fA();_p();Fa();Dn();Mp();bp();Nl();Po();mA=Symbol.for("apache-arrow/Table"),ce=class e{static isTable(t){return t?.[mA]===!0}constructor(...t){var r,n;if(t.length===0)return this.batches=[],this.schema=new _t([]),this._offsets=[0],this;let i,o;t[0]instanceof _t&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof Zt)return[c];if(c instanceof e)return c.batches;if(c instanceof ut){if(c.type instanceof Yt)return[new Zt(new _t(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>s(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>s(l));if(typeof c=="object"){let l=Object.keys(c),h=l.map(d=>new $([c[d]])),u=i??new _t(l.map((d,m)=>new Z(String(d),h[m].type,h[m].nullable))),[,f]=Gp(u,h);return f.length===0?[new Zt(c)]:f}}}return[]},a=t.flatMap(c=>s(c));if(i=(n=i??((r=a[0])===null||r===void 0?void 0:r.schema))!==null&&n!==void 0?n:new _t([]),!(i instanceof _t))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof Zt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!mc(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??pp(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,r)=>t+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=mp(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(Ua(t,this.numRows))}set(t,r){}indexOf(t,r){return-1}[Symbol.iterator](){return this.batches.length>0?Ll.visit(new $(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
15
|
+
return true;`)}function AL(e){return typeof e!="bigint"?pi(e):`${pi(e)}n`}var W4=w(()=>{xu()});function h_(e,t){let r=Math.ceil(e)*t-1;return(r-r%64+64||64)/t}function H4(e,t=0){return e.length>=t?e.subarray(0,t):ou(new e.constructor(t),e,0)}var dn,_o,Fl,Ls,xi=w(()=>{Je();dn=class{constructor(t,r=0,n=1){this.length=Math.ceil(r/n),this.buffer=new t(this.length),this.stride=n,this.BYTES_PER_ELEMENT=t.BYTES_PER_ELEMENT,this.ArrayType=t}get byteLength(){return Math.ceil(this.length*this.stride)*this.BYTES_PER_ELEMENT}get reservedLength(){return this.buffer.length/this.stride}get reservedByteLength(){return this.buffer.byteLength}set(t,r){return this}append(t){return this.set(this.length,t)}reserve(t){if(t>0){this.length+=t;let r=this.stride,n=this.length*r,i=this.buffer.length;n>=i&&this._resize(i===0?h_(n*1,this.BYTES_PER_ELEMENT):h_(n*2,this.BYTES_PER_ELEMENT))}return this}flush(t=this.length){t=h_(t*this.stride,this.BYTES_PER_ELEMENT);let r=H4(this.buffer,t);return this.clear(),r}clear(){return this.length=0,this.buffer=new this.ArrayType,this}_resize(t){return this.buffer=H4(this.buffer,t)}},_o=class extends dn{last(){return this.get(this.length-1)}get(t){return this.buffer[t]}set(t,r){return this.reserve(t-this.length+1),this.buffer[t*this.stride]=r,this}},Fl=class extends _o{constructor(){super(Uint8Array,0,1/8),this.numValid=0}get numInvalid(){return this.length-this.numValid}get(t){return this.buffer[t>>3]>>t%8&1}set(t,r){let{buffer:n}=this.reserve(t-this.length+1),i=t>>3,o=t%8,s=n[i]>>o&1;return r?s===0&&(n[i]|=1<<o,++this.numValid):s===1&&(n[i]&=~(1<<o),--this.numValid),this}clear(){return this.numValid=0,super.clear()}},Ls=class extends _o{constructor(t){super(t.OffsetArrayType,1,1)}append(t){return this.set(this.length-1,t)}set(t,r){let n=this.length-1,i=this.reserve(t-n+1).buffer;return n<t++&&n>=0&&i.fill(i[n],n,t),i[t]=i[t-1]+r,this}flush(t=this.length-1){return t>this.length&&this.set(t-1,this.BYTES_PER_ELEMENT>4?BigInt(0):0),super.flush(t+1)}}});var oe,$e,Pr,me=w(()=>{Ar();Xn();Cu();te();W4();xi();oe=class{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t){throw new Error('"throughDOM" not available in this environment')}constructor({type:t,nullValues:r}){this.length=0,this.finished=!1,this.type=t,this.children=[],this.nullValues=r,this.stride=Ln(t),this._nulls=new Fl,r&&r.length>0&&(this._isValid=j4(r))}toVector(){return new $([this.flush()])}get ArrayType(){return this.type.ArrayType}get nullCount(){return this._nulls.numInvalid}get numChildren(){return this.children.length}get byteLength(){let t=0,{_offsets:r,_values:n,_nulls:i,_typeIds:o,children:s}=this;return r&&(t+=r.byteLength),n&&(t+=n.byteLength),i&&(t+=i.byteLength),o&&(t+=o.byteLength),s.reduce((a,c)=>a+c.byteLength,t)}get reservedLength(){return this._nulls.reservedLength}get reservedByteLength(){let t=0;return this._offsets&&(t+=this._offsets.reservedByteLength),this._values&&(t+=this._values.reservedByteLength),this._nulls&&(t+=this._nulls.reservedByteLength),this._typeIds&&(t+=this._typeIds.reservedByteLength),this.children.reduce((r,n)=>r+n.reservedByteLength,t)}get valueOffsets(){return this._offsets?this._offsets.buffer:null}get values(){return this._values?this._values.buffer:null}get nullBitmap(){return this._nulls?this._nulls.buffer:null}get typeIds(){return this._typeIds?this._typeIds.buffer:null}append(t){return this.set(this.length,t)}isValid(t){return this._isValid(t)}set(t,r){return this.setValid(t,this.isValid(r))&&this.setValue(t,r),this}setValue(t,r){this._setValue(this,t,r)}setValid(t,r){return this.length=this._nulls.set(t,+r).length,r}addChild(t,r=`${this.numChildren}`){throw new Error(`Cannot append children to non-nested type "${this.type}"`)}getChildAt(t){return this.children[t]||null}flush(){let t,r,n,i,{type:o,length:s,nullCount:a,_typeIds:c,_offsets:l,_values:h,_nulls:u}=this;(r=c?.flush(s))?i=l?.flush(s):(i=l?.flush(s))?t=h?.flush(l.last()):t=h?.flush(s),a>0&&(n=u?.flush(s));let f=this.children.map(d=>d.flush());return this.clear(),Q({type:o,length:s,nullCount:a,children:f,child:f[0],data:t,typeIds:r,nullBitmap:n,valueOffsets:i})}finish(){this.finished=!0;for(let t of this.children)t.finish();return this}clear(){var t,r,n,i;this.length=0,(t=this._nulls)===null||t===void 0||t.clear(),(r=this._values)===null||r===void 0||r.clear(),(n=this._offsets)===null||n===void 0||n.clear(),(i=this._typeIds)===null||i===void 0||i.clear();for(let o of this.children)o.clear();return this}};oe.prototype.length=1;oe.prototype.stride=1;oe.prototype.children=null;oe.prototype.finished=!1;oe.prototype.nullValues=null;oe.prototype._isValid=()=>!0;$e=class extends oe{constructor(t){super(t),this._values=new _o(this.ArrayType,0,this.stride)}setValue(t,r){let n=this._values;return n.reserve(t-n.length+1),super.setValue(t,r)}},Pr=class extends oe{constructor(t){super(t),this._pendingLength=0,this._offsets=new Ls(t.type)}setValue(t,r){let n=this._pending||(this._pending=new Map),i=n.get(t);i&&(this._pendingLength-=i.length),this._pendingLength+=r instanceof Kn?r[Os].length:r.length,n.set(t,r)}setValid(t,r){return super.setValid(t,r)?!0:((this._pending||(this._pending=new Map)).set(t,void 0),!1)}clear(){return this._pendingLength=0,this._pending=void 0,super.clear()}flush(){return this._flush(),super.flush()}finish(){return this._flush(),super.finish()}_flush(){let t=this._pending,r=this._pendingLength;return this._pendingLength=0,this._pending=void 0,t&&t.size>0&&this._flushPending(t,r),this}}});var qa,u_=w(()=>{qa=class{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,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,r,n,i){return t.prep(8,24),t.writeInt64(BigInt(i??0)),t.pad(4),t.writeInt32(n),t.writeInt64(BigInt(r??0)),t.offset()}}});var Fn,$4=w(()=>{Gt();u_();Sl();Vm();Gw();Fn=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsFooter(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsFooter(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Xt.V1}schema(t){let r=this.bb.__offset(this.bb_pos,6);return r?(t||new cn).__init(this.bb.__indirect(this.bb_pos+r),this.bb):null}dictionaries(t,r){let n=this.bb.__offset(this.bb_pos,8);return n?(r||new qa).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}dictionariesLength(){let t=this.bb.__offset(this.bb_pos,8);return t?this.bb.__vector_len(this.bb_pos+t):0}recordBatches(t,r){let n=this.bb.__offset(this.bb_pos,10);return n?(r||new qa).__init(this.bb.__vector(this.bb_pos+n)+t*24,this.bb):null}recordBatchesLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.__vector_len(this.bb_pos+t):0}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new Ce).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startFooter(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,Xt.V1)}static addSchema(t,r){t.addFieldOffset(1,r,0)}static addDictionaries(t,r){t.addFieldOffset(2,r,0)}static startDictionariesVector(t,r){t.startVector(24,r,8)}static addRecordBatches(t,r){t.addFieldOffset(3,r,0)}static startRecordBatchesVector(t,r){t.startVector(24,r,8)}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endFooter(t){return t.endObject()}static finishFooterBuffer(t,r){t.finish(r)}static finishSizePrefixedFooterBuffer(t,r){t.finish(r,void 0,!0)}}});function Ip(e,t){return new Map([...e||new Map,...t||new Map])}function f_(e,t=new Map){for(let r=-1,n=e.length;++r<n;){let o=e[r].type;if(z.isDictionary(o)){if(!t.has(o.id))t.set(o.id,o.dictionary);else if(t.get(o.id)!==o.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}o.children&&o.children.length>0&&f_(o.children,t)}return t}var Y4,K4,_t,Z,Rr=w(()=>{Ne();te();Y4=Symbol.for("apache-arrow/Schema"),K4=Symbol.for("apache-arrow/Field"),_t=class e{static isSchema(t){return t?.[Y4]===!0}constructor(t=[],r,n,i=Xt.V5){this.fields=t||[],this.metadata=r||new Map,n||(n=f_(this.fields)),this.dictionaries=n,this.metadataVersion=i}get[Symbol.toStringTag](){return"Schema"}get names(){return this.fields.map(t=>t.name)}toString(){return`Schema<{ ${this.fields.map((t,r)=>`${r}: ${t}`).join(", ")} }>`}select(t){let r=new Set(t),n=this.fields.filter(i=>r.has(i.name));return new e(n,this.metadata)}selectAt(t){let r=t.map(n=>this.fields[n]).filter(Boolean);return new e(r,this.metadata)}assign(...t){let r=t[0]instanceof e?t[0]:Array.isArray(t[0])?new e(t[0]):new e(t),n=[...this.fields],i=Ip(Ip(new Map,this.metadata),r.metadata),o=r.fields.filter(a=>{let c=n.findIndex(l=>l.name===a.name);return~c?(n[c]=a.clone({metadata:Ip(Ip(new Map,n[c].metadata),a.metadata)}))&&!1:!0}),s=f_(o,new Map);return new e([...n,...o],i,new Map([...this.dictionaries,...s]))}};_t.prototype.fields=null;_t.prototype.metadata=null;_t.prototype.dictionaries=null;_t.prototype[Y4]=!0;Object.defineProperty(_t,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===_t&&_t.isSchema(t)}});Z=class e{static isField(t){return t?.[K4]===!0}static new(...t){let[r,n,i,o]=t;return t[0]&&typeof t[0]=="object"&&({name:r}=t[0],n===void 0&&(n=t[0].type),i===void 0&&(i=t[0].nullable),o===void 0&&(o=t[0].metadata)),new e(`${r}`,n,i,o)}constructor(t,r,n=!1,i){this.name=t,this.type=r,this.nullable=n,this.metadata=i||new Map}get typeId(){return this.type.typeId}get[Symbol.toStringTag](){return"Field"}toString(){return`${this.name}: ${this.type}`}clone(...t){let[r,n,i,o]=t;return!t[0]||typeof t[0]!="object"?[r=this.name,n=this.type,i=this.nullable,o=this.metadata]=t:{name:r=this.name,type:n=this.type,nullable:i=this.nullable,metadata:o=this.metadata}=t[0],e.new(r,n,i,o)}};Z.prototype.type=null;Z.prototype.name=null;Z.prototype.nullable=null;Z.prototype.metadata=null;Z.prototype[K4]=!0;Object.defineProperty(Z,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===Z&&Z.isField(t)}})});var PL,RL,Mo,d_,Si,m_=w(()=>{u_();$4();Gt();Rr();Ne();Je();Vi();PL=Ba,RL=hr,Mo=class{static decode(t){t=new RL(nt(t));let r=Fn.getRootAsFooter(t),n=_t.decode(r.schema(),new Map,r.version());return new d_(n,r)}static encode(t){let r=new PL,n=_t.encode(r,t.schema);Fn.startRecordBatchesVector(r,t.numRecordBatches);for(let s of[...t.recordBatches()].slice().reverse())Si.encode(r,s);let i=r.endVector();Fn.startDictionariesVector(r,t.numDictionaries);for(let s of[...t.dictionaryBatches()].slice().reverse())Si.encode(r,s);let o=r.endVector();return Fn.startFooter(r),Fn.addSchema(r,n),Fn.addVersion(r,Xt.V5),Fn.addRecordBatches(r,i),Fn.addDictionaries(r,o),Fn.finishFooterBuffer(r,Fn.endFooter(r)),r.asUint8Array()}get numRecordBatches(){return this._recordBatches.length}get numDictionaries(){return this._dictionaryBatches.length}constructor(t,r=Xt.V5,n,i){this.schema=t,this.version=r,n&&(this._recordBatches=n),i&&(this._dictionaryBatches=i)}*recordBatches(){for(let t,r=-1,n=this.numRecordBatches;++r<n;)(t=this.getRecordBatch(r))&&(yield t)}*dictionaryBatches(){for(let t,r=-1,n=this.numDictionaries;++r<n;)(t=this.getDictionaryBatch(r))&&(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}},d_=class extends Mo{get numRecordBatches(){return this._footer.recordBatchesLength()}get numDictionaries(){return this._footer.dictionariesLength()}constructor(t,r){super(t,r.version()),this._footer=r}getRecordBatch(t){if(t>=0&&t<this.numRecordBatches){let r=this._footer.recordBatches(t);if(r)return Si.decode(r)}return null}getDictionaryBatch(t){if(t>=0&&t<this.numDictionaries){let r=this._footer.dictionaries(t);if(r)return Si.decode(r)}return null}},Si=class e{static decode(t){return new e(t.metaDataLength(),t.bodyLength(),t.offset())}static encode(t,r){let{metaDataLength:n}=r,i=BigInt(r.offset),o=BigInt(r.bodyLength);return qa.createBlock(t,i,n,o)}constructor(t,r,n){this.metaDataLength=t,this.offset=It(n),this.bodyLength=It(r)}}});var Un,X4=w(()=>{Gt();Sl();Ym();Vm();Un=class e{constructor(){this.bb=null,this.bb_pos=0}__init(t,r){return this.bb_pos=t,this.bb=r,this}static getRootAsMessage(t,r){return(r||new e).__init(t.readInt32(t.position())+t.position(),t)}static getSizePrefixedRootAsMessage(t,r){return t.setPosition(t.position()+4),(r||new e).__init(t.readInt32(t.position())+t.position(),t)}version(){let t=this.bb.__offset(this.bb_pos,4);return t?this.bb.readInt16(this.bb_pos+t):Xt.V1}headerType(){let t=this.bb.__offset(this.bb_pos,6);return t?this.bb.readUint8(this.bb_pos+t):Nt.NONE}header(t){let r=this.bb.__offset(this.bb_pos,8);return r?this.bb.__union(t,this.bb_pos+r):null}bodyLength(){let t=this.bb.__offset(this.bb_pos,10);return t?this.bb.readInt64(this.bb_pos+t):BigInt("0")}customMetadata(t,r){let n=this.bb.__offset(this.bb_pos,12);return n?(r||new Ce).__init(this.bb.__indirect(this.bb.__vector(this.bb_pos+n)+t*4),this.bb):null}customMetadataLength(){let t=this.bb.__offset(this.bb_pos,12);return t?this.bb.__vector_len(this.bb_pos+t):0}static startMessage(t){t.startObject(5)}static addVersion(t,r){t.addFieldInt16(0,r,Xt.V1)}static addHeaderType(t,r){t.addFieldInt8(1,r,Nt.NONE)}static addHeader(t,r){t.addFieldOffset(2,r,0)}static addBodyLength(t,r){t.addFieldInt64(3,r,BigInt("0"))}static addCustomMetadata(t,r){t.addFieldOffset(4,r,0)}static createCustomMetadataVector(t,r){t.startVector(4,r.length,4);for(let n=r.length-1;n>=0;n--)t.addOffset(r[n]);return t.endVector()}static startCustomMetadataVector(t,r){t.startVector(4,r,4)}static endMessage(t){return t.endObject()}static finishMessageBuffer(t,r){t.finish(r)}static finishSizePrefixedMessageBuffer(t,r){t.finish(r,void 0,!0)}static createMessage(t,r,n,i,o,s){return e.startMessage(t),e.addVersion(t,r),e.addHeaderType(t,n),e.addHeader(t,i),e.addBodyLength(t,o),e.addCustomMetadata(t,s),e.endMessage(t)}}});var p_,Ap,Z4=w(()=>{fn();_3();Hm();Nw();f3();d3();p3();m3();b3();x3();y3();Aw();Iw();Lw();Dw();Ow();Pw();w3();g3();M3();Fw();Tw();Rw();Cw();Bw();p_=class extends rt{visit(t,r){return t==null||r==null?void 0:super.visit(t,r)}visitNull(t,r){return wu.startNull(r),wu.endNull(r)}visitInt(t,r){return di.startInt(r),di.addBitWidth(r,t.bitWidth),di.addIsSigned(r,t.isSigned),di.endInt(r)}visitFloat(t,r){return ys.startFloatingPoint(r),ys.addPrecision(r,t.precision),ys.endFloatingPoint(r)}visitBinary(t,r){return uu.startBinary(r),uu.endBinary(r)}visitBinaryView(t,r){return fu.startBinaryView(r),fu.endBinaryView(r)}visitLargeBinary(t,r){return mu.startLargeBinary(r),mu.endLargeBinary(r)}visitBool(t,r){return du.startBool(r),du.endBool(r)}visitUtf8(t,r){return Mu.startUtf8(r),Mu.endUtf8(r)}visitUtf8View(t,r){return bu.startUtf8View(r),bu.endUtf8View(r)}visitLargeUtf8(t,r){return gu.startLargeUtf8(r),gu.endLargeUtf8(r)}visitDecimal(t,r){return zi.startDecimal(r),zi.addScale(r,t.scale),zi.addPrecision(r,t.precision),zi.addBitWidth(r,t.bitWidth),zi.endDecimal(r)}visitDate(t,r){return ds.startDate(r),ds.addUnit(r,t.unit),ds.endDate(r)}visitTime(t,r){return po.startTime(r),po.addUnit(r,t.unit),po.addBitWidth(r,t.bitWidth),po.endTime(r)}visitTimestamp(t,r){let n=t.timezone&&r.createString(t.timezone)||void 0;return go.startTimestamp(r),go.addUnit(r,t.unit),n!==void 0&&go.addTimezone(r,n),go.endTimestamp(r)}visitInterval(t,r){return ws.startInterval(r),ws.addUnit(r,t.unit),ws.endInterval(r)}visitDuration(t,r){return ms.startDuration(r),ms.addUnit(r,t.unit),ms.endDuration(r)}visitList(t,r){return yu.startList(r),yu.endList(r)}visitLargeList(t,r){return pu.startLargeList(r),pu.endLargeList(r)}visitStruct(t,r){return _u.startStruct_(r),_u.endStruct_(r)}visitUnion(t,r){mi.startTypeIdsVector(r,t.typeIds.length);let n=mi.createTypeIdsVector(r,t.typeIds);return mi.startUnion(r),mi.addMode(r,t.mode),mi.addTypeIds(r,n),mi.endUnion(r)}visitDictionary(t,r){let n=this.visit(t.indices,r);return Gi.startDictionaryEncoding(r),Gi.addId(r,BigInt(t.id)),Gi.addIsOrdered(r,t.isOrdered),n!==void 0&&Gi.addIndexType(r,n),Gi.endDictionaryEncoding(r)}visitFixedSizeBinary(t,r){return ps.startFixedSizeBinary(r),ps.addByteWidth(r,t.byteWidth),ps.endFixedSizeBinary(r)}visitFixedSizeList(t,r){return gs.startFixedSizeList(r),gs.addListSize(r,t.listSize),gs.endFixedSizeList(r)}visitMap(t,r){return _s.startMap(r),_s.addKeysSorted(r,t.keysSorted),_s.endMap(r)}},Ap=new p_});function eA(e,t=new Map){return new _t(CL(e,t),Pp(e.metadata),t)}function g_(e){return new Ye(e.count,nA(e.columns),iA(e.columns),null,oA(e.columns))}function rA(e){return new Cr(g_(e.data),e.id,e.isDelta)}function CL(e,t){return(e.fields||[]).filter(Boolean).map(r=>Z.fromJSON(r,t))}function J4(e,t){return(e.children||[]).filter(Boolean).map(r=>Z.fromJSON(r,t))}function nA(e){return(e||[]).reduce((t,r)=>[...t,new Zn(r.count,NL(r.VALIDITY)),...nA(r.children)],[])}function iA(e,t=[]){for(let r=-1,n=(e||[]).length;++r<n;){let i=e[r];if(i.VALIDITY&&t.push(new Fe(t.length,i.VALIDITY.length)),i.TYPE_ID&&t.push(new Fe(t.length,i.TYPE_ID.length)),i.OFFSET&&t.push(new Fe(t.length,i.OFFSET.length)),i.DATA&&t.push(new Fe(t.length,i.DATA.length)),i.VIEWS&&t.push(new Fe(t.length,i.VIEWS.length)),i.VARIADIC_DATA_BUFFERS)for(let o of i.VARIADIC_DATA_BUFFERS)t.push(new Fe(t.length,o.length));t=iA(i.children,t)}return t}function NL(e){return(e||[]).reduce((t,r)=>t+ +(r===0),0)}function oA(e){return(e||[]).reduce((t,r)=>[...t,...r.VARIADIC_DATA_BUFFERS?[r.VARIADIC_DATA_BUFFERS.length]:[],...oA(r.children)],[])}function sA(e,t){let r,n,i,o,s,a;return!t||!(o=e.dictionary)?(s=tA(e,J4(e,t)),i=new Z(e.name,s,e.nullable,Pp(e.metadata))):t.has(r=o.id)?(n=(n=o.indexType)?Q4(n):new Ve,a=new We(t.get(r),n,r,o.isOrdered),i=new Z(e.name,a,e.nullable,Pp(e.metadata))):(n=(n=o.indexType)?Q4(n):new Ve,t.set(r,s=tA(e,J4(e,t))),a=new We(s,n,r,o.isOrdered),i=new Z(e.name,a,e.nullable,Pp(e.metadata))),i||null}function Pp(e=[]){return new Map(e.map(({key:t,value:r})=>[t,r]))}function Q4(e){return new Se(e.isSigned,e.bitWidth)}function tA(e,t){let r=e.type.name;switch(r){case"NONE":return new De;case"null":return new De;case"binary":return new ln;case"largebinary":return new _i;case"binaryview":return new Mt;case"utf8":return new vr;case"largeutf8":return new Mi;case"utf8view":return new qr;case"bool":return new Er;case"list":return new je((t||[])[0]);case"largelist":return new Bn((t||[])[0]);case"struct":return new Yt(t||[]);case"struct_":return new Yt(t||[])}switch(r){case"int":{let n=e.type;return new Se(n.isSigned,n.bitWidth)}case"floatingpoint":{let n=e.type;return new Sr(Vt[n.precision])}case"decimal":{let n=e.type;return new hn(n.scale,n.precision,n.bitWidth)}case"date":{let n=e.type;return new jr(Qt[n.unit])}case"time":{let n=e.type;return new fr(q[n.unit],n.bitWidth)}case"timestamp":{let n=e.type;return new dr(q[n.unit],n.timezone)}case"interval":{let n=e.type;return new Tr(Lt[n.unit])}case"duration":{let n=e.type;return new Wr(q[n.unit])}case"union":{let n=e.type,[i,...o]=(n.mode+"").toLowerCase(),s=i.toUpperCase()+o.join("");return new Hr(jt[s],n.typeIds||[],t||[])}case"fixedsizebinary":{let n=e.type;return new un(n.byteWidth)}case"fixedsizelist":{let n=e.type;return new _e(n.listSize,(t||[])[0])}case"map":{let n=e.type;return new Ir((t||[])[0],n.keysSorted)}}throw new Error(`Unrecognized type: "${r}"`)}var aA=w(()=>{Rr();te();Ds();Ne()});function LL(e,t){return(()=>{switch(t){case Nt.Schema:return _t.fromJSON(e);case Nt.RecordBatch:return Ye.fromJSON(e);case Nt.DictionaryBatch:return Cr.fromJSON(e)}throw new Error(`Unrecognized Message type: { name: ${Nt[t]}, type: ${t} }`)})}function DL(e,t){return(()=>{switch(t){case Nt.Schema:return _t.decode(e.header(new cn),new Map,e.version());case Nt.RecordBatch:return Ye.decode(e.header(new br),e.version());case Nt.DictionaryBatch:return Cr.decode(e.header(new mo),e.version())}throw new Error(`Unrecognized Message type: { name: ${Nt[t]}, type: ${t} }`)})}function FL(e,t=new Map,r=Xt.V5){let n=WL(e,t);return new _t(n,Rp(e),t,r)}function UL(e,t=Xt.V5){return new Ye(e.length(),kL(e),qL(e,t),uA(e.compression()),jL(e))}function GL(e,t=Xt.V5){return new Cr(Ye.decode(e.data(),t),e.id(),e.isDelta())}function zL(e){return new Fe(e.offset(),e.length())}function VL(e){return new Zn(e.length(),e.nullCount())}function kL(e){let t=[];for(let r,n=-1,i=-1,o=e.nodesLength();++n<o;)(r=e.nodes(n))&&(t[++i]=Zn.decode(r));return t}function qL(e,t){let r=[];for(let n,i=-1,o=-1,s=e.buffersLength();++i<s;)(n=e.buffers(i))&&(t<Xt.V4&&(n.bb_pos+=8*(i+1)),r[++o]=Fe.decode(n));return r}function jL(e){let t=[],r=Math.trunc(e.variadicBufferCountsLength());for(let n=0;n<r;++n)t.push(It(e.variadicBufferCounts(n)));return t}function WL(e,t){let r=[];for(let n,i=-1,o=-1,s=e.fieldsLength();++i<s;)(n=e.fields(i))&&(r[++o]=Z.decode(n,t));return r}function cA(e,t){let r=[];for(let n,i=-1,o=-1,s=e.childrenLength();++i<s;)(n=e.children(i))&&(r[++o]=Z.decode(n,t));return r}function HL(e,t){let r,n,i,o,s,a;return!t||!(a=e.dictionary())?(i=hA(e,cA(e,t)),n=new Z(e.name(),i,e.nullable(),Rp(e))):t.has(r=It(a.id()))?(o=(o=a.indexType())?lA(o):new Ve,s=new We(t.get(r),o,r,a.isOrdered()),n=new Z(e.name(),s,e.nullable(),Rp(e))):(o=(o=a.indexType())?lA(o):new Ve,t.set(r,i=hA(e,cA(e,t))),s=new We(i,o,r,a.isOrdered()),n=new Z(e.name(),s,e.nullable(),Rp(e))),n||null}function Rp(e){let t=new Map;if(e)for(let r,n,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(r=e.customMetadata(i))&&(n=r.key())!=null&&t.set(n,r.value());return t}function $L(e){let t=new Map;for(let r,n,i=-1,o=Math.trunc(e.customMetadataLength());++i<o;)(r=e.customMetadata(i))&&(n=r.key())!=null&&t.set(n,r.value());return t}function lA(e){return new Se(e.isSigned(),e.bitWidth())}function hA(e,t){let r=e.typeType();switch(r){case lt.NONE:return new De;case lt.Null:return new De;case lt.Binary:return new ln;case lt.LargeBinary:return new _i;case lt.BinaryView:return new Mt;case lt.Utf8:return new vr;case lt.LargeUtf8:return new Mi;case lt.Utf8View:return new qr;case lt.Bool:return new Er;case lt.List:return new je((t||[])[0]);case lt.LargeList:return new Bn((t||[])[0]);case lt.Struct_:return new Yt(t||[])}switch(r){case lt.Int:{let n=e.type(new di);return new Se(n.isSigned(),n.bitWidth())}case lt.FloatingPoint:{let n=e.type(new ys);return new Sr(n.precision())}case lt.Decimal:{let n=e.type(new zi);return new hn(n.scale(),n.precision(),n.bitWidth())}case lt.Date:{let n=e.type(new ds);return new jr(n.unit())}case lt.Time:{let n=e.type(new po);return new fr(n.unit(),n.bitWidth())}case lt.Timestamp:{let n=e.type(new go);return new dr(n.unit(),n.timezone())}case lt.Interval:{let n=e.type(new ws);return new Tr(n.unit())}case lt.Duration:{let n=e.type(new ms);return new Wr(n.unit())}case lt.Union:{let n=e.type(new mi);return new Hr(n.mode(),n.typeIdsArray()||[],t||[])}case lt.FixedSizeBinary:{let n=e.type(new ps);return new un(n.byteWidth())}case lt.FixedSizeList:{let n=e.type(new gs);return new _e(n.listSize(),(t||[])[0])}case lt.Map:{let n=e.type(new _s);return new Ir((t||[])[0],n.keysSorted())}}throw new Error(`Unrecognized type: "${lt[r]}" (${r})`)}function uA(e){return e?new ja(e.codec(),e.method()):null}function YL(e,t){let r=t.fields.map(o=>Z.encode(e,o));cn.startFieldsVector(e,r.length);let n=cn.createFieldsVector(e,r),i=t.metadata&&t.metadata.size>0?cn.createCustomMetadataVector(e,[...t.metadata].map(([o,s])=>{let a=e.createString(`${o}`),c=e.createString(`${s}`);return Ce.startKeyValue(e),Ce.addKey(e,a),Ce.addValue(e,c),Ce.endKeyValue(e)})):-1;return cn.startSchema(e),cn.addFields(e,n),cn.addEndianness(e,tD?fs.Little:fs.Big),i!==-1&&cn.addCustomMetadata(e,i),cn.endSchema(e)}function KL(e,t){let r=-1,n=-1,i=-1,o=t.type,s=t.typeId;z.isDictionary(o)?(s=o.dictionary.typeId,i=Ap.visit(o,e),n=Ap.visit(o.dictionary,e)):n=Ap.visit(o,e);let a=(o.children||[]).map(h=>Z.encode(e,h)),c=xr.createChildrenVector(e,a),l=t.metadata&&t.metadata.size>0?xr.createCustomMetadataVector(e,[...t.metadata].map(([h,u])=>{let f=e.createString(`${h}`),d=e.createString(`${u}`);return Ce.startKeyValue(e),Ce.addKey(e,f),Ce.addValue(e,d),Ce.endKeyValue(e)})):-1;return t.name&&(r=e.createString(t.name)),xr.startField(e),xr.addType(e,n),xr.addTypeType(e,s),xr.addChildren(e,c),xr.addNullable(e,!!t.nullable),r!==-1&&xr.addName(e,r),i!==-1&&xr.addDictionary(e,i),l!==-1&&xr.addCustomMetadata(e,l),xr.endField(e)}function XL(e,t){let r=t.nodes||[],n=t.buffers||[],i=t.variadicBufferCounts||[];br.startNodesVector(e,r.length);for(let l of r.slice().reverse())Zn.encode(e,l);let o=e.endVector();br.startBuffersVector(e,n.length);for(let l of n.slice().reverse())Fe.encode(e,l);let s=e.endVector(),a=null;t.compression!==null&&(a=fA(e,t.compression));let c=-1;return i.length>0&&(c=br.createVariadicBufferCountsVector(e,i.map(BigInt))),br.startRecordBatch(e),br.addLength(e,BigInt(t.length)),br.addNodes(e,o),br.addBuffers(e,s),t.compression!==null&&a&&br.addCompression(e,a),c!==-1&&br.addVariadicBufferCounts(e,c),br.endRecordBatch(e)}function fA(e,t){return fo.startBodyCompression(e),fo.addCodec(e,t.type),fo.addMethod(e,t.method),fo.endBodyCompression(e)}function ZL(e,t){let r=Ye.encode(e,t.data);return mo.startDictionaryBatch(e),mo.addId(e,BigInt(t.id)),mo.addIsDelta(e,t.isDelta),mo.addData(e,r),mo.endDictionaryBatch(e)}function JL(e,t){return xl.createFieldNode(e,BigInt(t.length),BigInt(t.nullCount))}function QL(e,t){return bl.createBuffer(e,BigInt(t.offset),BigInt(t.length))}var OL,BL,Nr,Ye,Cr,Fe,Zn,ja,tD,Ds=w(()=>{Gt();Gw();Hm();vw();h3();xw();Uw();Sw();$m();Sl();Ew();Nw();Aw();Iw();Lw();Dw();Ow();Pw();Fw();Rw();Cw();Bw();X4();bw();Mw();Rr();Je();Vi();Ne();Z4();aA();te();OL=Ba,BL=hr,Nr=class e{static fromJSON(t,r){let n=new e(0,Xt.V5,r);return n._createHeader=LL(t,r),n}static decode(t){t=new BL(nt(t));let r=Un.getRootAsMessage(t),n=r.bodyLength(),i=r.version(),o=r.headerType(),s=$L(r),a=new e(n,i,o,void 0,s);return a._createHeader=DL(r,o),a}static encode(t){let r=new OL,n=-1;t.isSchema()?n=_t.encode(r,t.header()):t.isRecordBatch()?n=Ye.encode(r,t.header()):t.isDictionaryBatch()&&(n=Cr.encode(r,t.header()));let i=t.metadata&&t.metadata.size>0?Un.createCustomMetadataVector(r,[...t.metadata].map(([o,s])=>{let a=r.createString(`${o}`),c=r.createString(`${s}`);return Ce.startKeyValue(r),Ce.addKey(r,a),Ce.addValue(r,c),Ce.endKeyValue(r)})):-1;return Un.startMessage(r),Un.addVersion(r,Xt.V5),Un.addHeader(r,n),Un.addHeaderType(r,t.headerType),Un.addBodyLength(r,BigInt(t.bodyLength)),i!==-1&&Un.addCustomMetadata(r,i),Un.finishMessageBuffer(r,Un.endMessage(r)),r.asUint8Array()}static from(t,r=0){if(t instanceof _t)return new e(0,Xt.V5,Nt.Schema,t);if(t instanceof Ye)return new e(r,Xt.V5,Nt.RecordBatch,t,t.metadata);if(t instanceof Cr)return new e(r,Xt.V5,Nt.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 compression(){return this._compression}get bodyLength(){return this._bodyLength}get metadata(){return this._metadata}header(){return this._createHeader()}isSchema(){return this.headerType===Nt.Schema}isRecordBatch(){return this.headerType===Nt.RecordBatch}isDictionaryBatch(){return this.headerType===Nt.DictionaryBatch}constructor(t,r,n,i,o){this._version=r,this._headerType=n,this.body=new Uint8Array(0),this._compression=i?.compression,i&&(this._createHeader=()=>i),this._bodyLength=It(t),this._metadata=o||new Map}},Ye=class{get nodes(){return this._nodes}get length(){return this._length}get buffers(){return this._buffers}get compression(){return this._compression}get variadicBufferCounts(){return this._variadicBufferCounts}get metadata(){return this._metadata}constructor(t,r,n,i,o=[],s){this._nodes=r,this._buffers=n,this._length=It(t),this._compression=i,this._variadicBufferCounts=o,this._metadata=s||new Map}},Cr=class{get id(){return this._id}get data(){return this._data}get isDelta(){return this._isDelta}get length(){return this.data.length}get nodes(){return this.data.nodes}get buffers(){return this.data.buffers}constructor(t,r,n=!1){this._data=t,this._isDelta=n,this._id=It(r)}},Fe=class{constructor(t,r){this.offset=It(t),this.length=It(r)}},Zn=class{constructor(t,r){this.length=It(t),this.nullCount=It(r)}},ja=class{constructor(t,r=La.BUFFER){this.type=t,this.method=r}};Z.encode=KL;Z.decode=HL;Z.fromJSON=sA;_t.encode=YL;_t.decode=FL;_t.fromJSON=eA;Ye.encode=XL;Ye.decode=UL;Ye.fromJSON=g_;Cr.encode=ZL;Cr.decode=GL;Cr.fromJSON=rA;Zn.encode=JL;Zn.decode=VL;Fe.encode=QL;Fe.decode=zL;ja.encode=fA;ja.decode=uA;tD=(()=>{let e=new ArrayBuffer(2);return new DataView(e).setInt16(0,256,!0),new Int16Array(e)[0]===256})()});var pe,Du,Wa,Cp,Fu=w(()=>{an();au();pe=Object.freeze({done:!0,value:void 0}),Du=class{constructor(t){this._json=t}get schema(){return this._json.schema}get batches(){return this._json.batches||[]}get dictionaries(){return this._json.dictionaries||[]}},Wa=class{tee(){return this._getDOMStream().tee()}pipe(t,r){return this._getNodeStream().pipe(t,r)}pipeTo(t,r){return this._getDOMStream().pipeTo(t,r)}pipeThrough(t,r){return this._getDOMStream().pipeThrough(t,r)}_getDOMStream(){return this._DOMStream||(this._DOMStream=this.toDOMStream())}_getNodeStream(){return this._nodeStream||(this._nodeStream=this.toNodeStream())}},Cp=class extends Wa{constructor(){super(),this._values=[],this.resolvers=[],this._closedPromise=new Promise(t=>this._closedPromiseResolve=t)}get closed(){return this._closedPromise}cancel(t){return Y(this,void 0,void 0,function*(){yield this.return(t)})}write(t){this._ensureOpen()&&(this.resolvers.length<=0?this._values.push(t):this.resolvers.shift().resolve({done:!1,value:t}))}abort(t){this._closedPromiseResolve&&(this.resolvers.length<=0?this._error={error:t}:this.resolvers.shift().reject({done:!0,value:t}))}close(){if(this._closedPromiseResolve){let{resolvers:t}=this;for(;t.length>0;)t.shift().resolve(pe);this._closedPromiseResolve(),this._closedPromiseResolve=void 0}}[Symbol.asyncIterator](){return this}toDOMStream(t){return lr.toDOMStream(this._closedPromiseResolve||this._error?this:this._values,t)}toNodeStream(t){return lr.toNodeStream(this._closedPromiseResolve||this._error?this:this._values,t)}throw(t){return Y(this,void 0,void 0,function*(){return yield this.abort(t),pe})}return(t){return Y(this,void 0,void 0,function*(){return yield this.close(),pe})}read(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(...t){return this._values.length>0?Promise.resolve({done:!1,value:this._values.shift()}):this._error?Promise.reject({done:!0,value:this._error.error}):this._closedPromiseResolve?new Promise((r,n)=>{this.resolvers.push({resolve:r,reject:n})}):Promise.resolve(pe)}_ensureOpen(){if(this._closedPromiseResolve)return!0;throw new Error("AsyncQueue is closed")}}});var Jn,Qn,mn,y_,bo,Fs=w(()=>{an();au();uo();Fu();Je();us();Jn=class extends Cp{write(t){if((t=nt(t)).byteLength>0)return super.write(t)}toString(t=!1){return t?wl(this.toUint8Array(!0)):this.toUint8Array(!1).then(wl)}toUint8Array(t=!1){return t?In(this._values)[0]:Y(this,void 0,void 0,function*(){var r,n,i,o;let s=[],a=0;try{for(var c=!0,l=vn(this),h;h=yield l.next(),r=h.done,!r;c=!0){o=h.value,c=!1;let u=o;s.push(u),a+=u.byteLength}}catch(u){n={error:u}}finally{try{!c&&!r&&(i=l.return)&&(yield i.call(l))}finally{if(n)throw n.error}}return In(s,a)[0]})}},Qn=class{constructor(t){t&&(this.source=new y_(lr.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)}},mn=class e{constructor(t){t instanceof e?this.source=t.source:t instanceof Jn?this.source=new bo(lr.fromAsyncIterable(t)):Um(t)?this.source=new bo(lr.fromNodeStream(t)):iu(t)?this.source=new bo(lr.fromDOMStream(t)):Dm(t)?this.source=new bo(lr.fromDOMStream(t.body)):hi(t)?this.source=new bo(lr.fromIterable(t)):Tn(t)?this.source=new bo(lr.fromAsyncIterable(t)):$n(t)&&(this.source=new bo(lr.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)}},y_=class{constructor(t){this.source=t}cancel(t){this.return(t)}peek(t){return this.next(t,"peek").value}read(t){return this.next(t,"read").value}next(t,r="read"){return this.source.next({cmd:r,size:t})}throw(t){return Object.create(this.source.throw&&this.source.throw(t)||pe)}return(t){return Object.create(this.source.return&&this.source.return(t)||pe)}},bo=class{constructor(t){this.source=t,this._closedPromise=new Promise(r=>this._closedPromiseResolve=r)}cancel(t){return Y(this,void 0,void 0,function*(){yield this.return(t)})}get closed(){return this._closedPromise}read(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"read")).value})}peek(t){return Y(this,void 0,void 0,function*(){return(yield this.next(t,"peek")).value})}next(t){return Y(this,arguments,void 0,function*(r,n="read"){return yield this.source.next({cmd:n,size:r})})}throw(t){return Y(this,void 0,void 0,function*(){let r=this.source.throw&&(yield this.source.throw(t))||pe;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}return(t){return Y(this,void 0,void 0,function*(){let r=this.source.return&&(yield this.source.return(t))||pe;return this._closedPromiseResolve&&this._closedPromiseResolve(),this._closedPromiseResolve=void 0,Object.create(r)})}}});var Uu,Us,w_=w(()=>{an();Fs();Je();Uu=class extends Qn{constructor(t,r){super(),this.position=0,this.buffer=nt(t),this.size=r===void 0?this.buffer.byteLength:r}readInt32(t){let{buffer:r,byteOffset:n}=this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)}seek(t){return this.position=Math.min(t,this.size),t<this.size}read(t){let{buffer:r,size:n,position:i}=this;return r&&i<n?(typeof t!="number"&&(t=Number.POSITIVE_INFINITY),this.position=Math.min(n,i+Math.min(n-i,t)),r.subarray(i,this.position)):null}readAt(t,r){let n=this.buffer,i=Math.min(this.size,t+r);return n?n.subarray(t,i):new Uint8Array(r)}close(){this.buffer&&(this.buffer=null)}throw(t){return this.close(),{done:!0,value:t}}return(t){return this.close(),{done:!0,value:t}}},Us=class extends mn{constructor(t,r){super(),this.position=0,this._handle=t,typeof r=="number"?this.size=r:this._pending=Y(this,void 0,void 0,function*(){this.size=(yield t.stat()).size,delete this._pending})}readInt32(t){return Y(this,void 0,void 0,function*(){let{buffer:r,byteOffset:n}=yield this.readAt(t,4);return new DataView(r,n).getInt32(0,!0)})}seek(t){return Y(this,void 0,void 0,function*(){return this._pending&&(yield this._pending),this.position=Math.min(t,this.size),t<this.size})}read(t){return Y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:r,size:n,position:i}=this;if(r&&i<n){typeof t!="number"&&(t=Number.POSITIVE_INFINITY);let o=i,s=0,a=0,c=Math.min(n,o+Math.min(n-o,t)),l=new Uint8Array(Math.max(0,(this.position=c)-o));for(;(o+=a)<c&&(s+=a)<l.byteLength;)({bytesRead:a}=yield r.read(l,s,l.byteLength-s,o));return l}return null})}readAt(t,r){return Y(this,void 0,void 0,function*(){this._pending&&(yield this._pending);let{_handle:n,size:i}=this;if(n&&t+r<i){let o=Math.min(i,t+r),s=new Uint8Array(o-t);return(yield n.read(s,0,r,t)).buffer}return new Uint8Array(r)})}close(){return Y(this,void 0,void 0,function*(){let t=this._handle;this._handle=null,t&&(yield t.close())})}throw(t){return Y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}return(t){return Y(this,void 0,void 0,function*(){return yield this.close(),{done:!0,value:t}})}}});var M_={};Zr(M_,{BaseInt64:()=>Gu,Int128:()=>zu,Int64:()=>xo,Uint64:()=>Oe});function Ul(e){return e<0&&(e=4294967295+e+1),`0x${e.toString(16)}`}var Gl,__,Gu,Oe,xo,zu,b_=w(()=>{Gl=8,__=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8],Gu=class{constructor(t){this.buffer=t}high(){return this.buffer[1]}low(){return this.buffer[0]}_times(t){let r=new Uint32Array([this.buffer[1]>>>16,this.buffer[1]&65535,this.buffer[0]>>>16,this.buffer[0]&65535]),n=new Uint32Array([t.buffer[1]>>>16,t.buffer[1]&65535,t.buffer[0]>>>16,t.buffer[0]&65535]),i=r[3]*n[3];this.buffer[0]=i&65535;let o=i>>>16;return i=r[2]*n[3],o+=i,i=r[3]*n[2]>>>0,o+=i,this.buffer[0]+=o<<16,this.buffer[1]=o>>>0<i?65536:0,this.buffer[1]+=o>>>16,this.buffer[1]+=r[1]*n[3]+r[2]*n[2]+r[3]*n[1],this.buffer[1]+=r[0]*n[3]+r[1]*n[2]+r[2]*n[1]+r[3]*n[0]<<16,this}_plus(t){let r=this.buffer[0]+t.buffer[0]>>>0;this.buffer[1]+=t.buffer[1],r<this.buffer[0]>>>0&&++this.buffer[1],this.buffer[0]=r}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`${Ul(this.buffer[1])} ${Ul(this.buffer[0])}`}},Oe=class e extends Gu{times(t){return this._times(t),this}plus(t){return this._plus(t),this}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.length,i=new e(r);for(let o=0;o<n;){let s=Gl<n-o?Gl:n-o,a=new e(new Uint32Array([Number.parseInt(t.slice(o,o+s),10),0])),c=new e(new Uint32Array([__[s],0]));i.times(c),i.plus(a),o+=s}return i}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},xo=class e extends Gu{negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[0]==0&&++this.buffer[1],this}times(t){return this._times(t),this}plus(t){return this._plus(t),this}lessThan(t){let r=this.buffer[1]<<0,n=t.buffer[1]<<0;return r<n||r===n&&this.buffer[0]<t.buffer[0]}static from(t,r=new Uint32Array(2)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(2)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(2)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=Gl<i-s?Gl:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0])),l=new e(new Uint32Array([__[a],0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*2);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+2*n*4,2));return r}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}},zu=class e{constructor(t){this.buffer=t}high(){return new xo(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2))}low(){return new xo(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset,2))}negate(){return this.buffer[0]=~this.buffer[0]+1,this.buffer[1]=~this.buffer[1],this.buffer[2]=~this.buffer[2],this.buffer[3]=~this.buffer[3],this.buffer[0]==0&&++this.buffer[1],this.buffer[1]==0&&++this.buffer[2],this.buffer[2]==0&&++this.buffer[3],this}times(t){let r=new Oe(new Uint32Array([this.buffer[3],0])),n=new Oe(new Uint32Array([this.buffer[2],0])),i=new Oe(new Uint32Array([this.buffer[1],0])),o=new Oe(new Uint32Array([this.buffer[0],0])),s=new Oe(new Uint32Array([t.buffer[3],0])),a=new Oe(new Uint32Array([t.buffer[2],0])),c=new Oe(new Uint32Array([t.buffer[1],0])),l=new Oe(new Uint32Array([t.buffer[0],0])),h=Oe.multiply(o,l);this.buffer[0]=h.low();let u=new Oe(new Uint32Array([h.high(),0]));return h=Oe.multiply(i,l),u.plus(h),h=Oe.multiply(o,c),u.plus(h),this.buffer[1]=u.low(),this.buffer[3]=u.lessThan(h)?1:0,this.buffer[2]=u.high(),new Oe(new Uint32Array(this.buffer.buffer,this.buffer.byteOffset+8,2)).plus(Oe.multiply(n,l)).plus(Oe.multiply(i,c)).plus(Oe.multiply(o,a)),this.buffer[3]+=Oe.multiply(r,l).plus(Oe.multiply(n,c)).plus(Oe.multiply(i,a)).plus(Oe.multiply(o,s)).low(),this}plus(t){let r=new Uint32Array(4);return r[3]=this.buffer[3]+t.buffer[3]>>>0,r[2]=this.buffer[2]+t.buffer[2]>>>0,r[1]=this.buffer[1]+t.buffer[1]>>>0,r[0]=this.buffer[0]+t.buffer[0]>>>0,r[0]<this.buffer[0]>>>0&&++r[1],r[1]<this.buffer[1]>>>0&&++r[2],r[2]<this.buffer[2]>>>0&&++r[3],this.buffer[3]=r[3],this.buffer[2]=r[2],this.buffer[1]=r[1],this.buffer[0]=r[0],this}hex(){return`${Ul(this.buffer[3])} ${Ul(this.buffer[2])} ${Ul(this.buffer[1])} ${Ul(this.buffer[0])}`}static multiply(t,r){return new e(new Uint32Array(t.buffer)).times(r)}static add(t,r){return new e(new Uint32Array(t.buffer)).plus(r)}static from(t,r=new Uint32Array(4)){return e.fromString(typeof t=="string"?t:t.toString(),r)}static fromNumber(t,r=new Uint32Array(4)){return e.fromString(t.toString(),r)}static fromString(t,r=new Uint32Array(4)){let n=t.startsWith("-"),i=t.length,o=new e(r);for(let s=n?1:0;s<i;){let a=Gl<i-s?Gl:i-s,c=new e(new Uint32Array([Number.parseInt(t.slice(s,s+a),10),0,0,0])),l=new e(new Uint32Array([__[a],0,0,0]));o.times(l),o.plus(c),s+=a}return n?o.negate():o}static convertArray(t){let r=new Uint32Array(t.length*4);for(let n=-1,i=t.length;++n<i;)e.from(t[n],new Uint32Array(r.buffer,r.byteOffset+16*n,4));return r}}});var T_={};Zr(T_,{toIntervalDayTimeInt32Array:()=>x_,toIntervalDayTimeObjects:()=>v_,toIntervalMonthDayNanoInt32Array:()=>S_,toIntervalMonthDayNanoObjects:()=>E_});function x_(e){var t,r;let n=e.length,i=new Int32Array(n*2);for(let o=0,s=0;o<n;o++){let a=e[o];i[s++]=(t=a.days)!==null&&t!==void 0?t:0,i[s++]=(r=a.milliseconds)!==null&&r!==void 0?r:0}return i}function S_(e){var t,r;let n=e.length,i=new Int32Array(n*4);for(let o=0,s=0;o<n;o++){let a=e[o];i[s++]=(t=a.months)!==null&&t!==void 0?t:0,i[s++]=(r=a.days)!==null&&r!==void 0?r:0;let c=a.nanoseconds;if(c){let l=BigInt(c);i[s++]=Number(l&BigInt(4294967295))>>>0,i[s++]=Number(l>>BigInt(32))>>>0}else s+=2}return i}function v_(e){let t=e.length,r=new Array(t/2);for(let n=0,i=0;n<t;n+=2)r[i++]={days:e[n],milliseconds:e[n+1]};return r}function E_(e,t){let r=e.length,n=new Array(r/4);for(let i=0,o=0;i<r;i+=4){let s=BigInt(e[i+3])<<BigInt(32)|BigInt(e[i+2]>>>0);n[o++]={months:e[i],days:e[i+1],nanoseconds:t?`${s}`:s}}return n}var Np=w(()=>{});function mA(e){let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)t[r>>1]=Number.parseInt(e.slice(r,r+2),16);return t}function eD(e){return mA(e.join(""))}function pA(e,t){let r=new Uint8Array(e.length*16),n=new DataView(r.buffer);for(let[i,o]of e.entries()){let s=i*16,a=o.SIZE;if(n.setInt32(s,a,!0),o.INLINED!==void 0){let c=t(o.INLINED);for(let l=0;l<c.length&&l<12;l++)r[s+4+l]=c[l]}else{let c=o.PREFIX_HEX;for(let l=0;l<8&&l<c.length;l+=2)r[s+4+(l>>1)]=Number.parseInt(c.slice(l,l+2),16);n.setInt32(s+8,o.BUFFER_INDEX,!0),n.setInt32(s+12,o.OFFSET,!0)}}return r}function rD(e){return pA(e,t=>{let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n>>1]=Number.parseInt(t.slice(n,n+2),16);return r})}function nD(e){return pA(e,t=>new TextEncoder().encode(t))}var zl,Op,Bp,gA=w(()=>{Xn();Rr();te();fn();Va();uo();b_();Ne();Je();Np();zl=class extends rt{constructor(t,r,n,i,o=Xt.V5,s=[]){super(),this.nodesIndex=-1,this.buffersIndex=-1,this.variadicBufferIndex=-1,this.bytes=t,this.nodes=r,this.buffers=n,this.dictionaries=i,this.metadataVersion=o,this.variadicBufferCounts=s}visit(t){return super.visit(t instanceof Z?t.type:t)}visitNull(t,{length:r}=this.nextFieldNode()){return Q({type:t,length:r})}visitBool(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitInt(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFloat(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeUtf8(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitUtf8View(t,{length:r,nullCount:n}=this.nextFieldNode()){let i=this.readNullBitmap(t,n),o=this.readData(t),s=this.readVariadicBuffers(this.nextVariadicBufferCount());return Q({type:t,length:r,nullCount:n,nullBitmap:i,views:o,variadicBuffers:s})}visitBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitLargeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),data:this.readData(t)})}visitBinaryView(t,{length:r,nullCount:n}=this.nextFieldNode()){let i=this.readNullBitmap(t,n),o=this.readData(t),s=this.readVariadicBuffers(this.nextVariadicBufferCount());return Q({type:t,length:r,nullCount:n,nullBitmap:i,views:o,variadicBuffers:s})}visitFixedSizeBinary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDate(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTimestamp(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitTime(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDecimal(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitLargeList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),valueOffsets:this.readOffsets(t),child:this.visit(t.children[0])})}visitStruct(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),children:this.visitMany(t.children)})}visitUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return this.metadataVersion<Xt.V5&&this.readNullBitmap(t,n),t.mode===jt.Sparse?this.visitSparseUnion(t,{length:r,nullCount:n}):this.visitDenseUnion(t,{length:r,nullCount:n})}visitDenseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),valueOffsets:this.readOffsets(t),children:this.visitMany(t.children)})}visitSparseUnion(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,typeIds:this.readTypeIds(t),children:this.visitMany(t.children)})}visitDictionary(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t.indices),dictionary:this.readDictionary(t)})}visitInterval(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitDuration(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),data:this.readData(t)})}visitFixedSizeList(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,nullCount:n,nullBitmap:this.readNullBitmap(t,n),child:this.visit(t.children[0])})}visitMap(t,{length:r,nullCount:n}=this.nextFieldNode()){return Q({type:t,length:r,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,r,n=this.nextBufferRange()){return r>0&&this.readData(t,n)||new Uint8Array(0)}readOffsets(t,r){return this.readData(t,r)}readTypeIds(t,r){return this.readData(t,r)}readData(t,{length:r,offset:n}=this.nextBufferRange()){return this.bytes.subarray(n,n+r)}readVariadicBuffers(t){return Array.from({length:t},()=>this.readData(null))}nextVariadicBufferCount(){var t;return(t=this.variadicBufferCounts[++this.variadicBufferIndex])!==null&&t!==void 0?t:0}readDictionary(t){return this.dictionaries.get(t.id)}},Op=class extends zl{constructor(t,r,n,i,o,s=[]){super(new Uint8Array(0),r,n,i,o,s),this.sources=t}readNullBitmap(t,r,{offset:n}=this.nextBufferRange()){return r<=0?new Uint8Array(0):za(this.sources[n])}readOffsets(t,{offset:r}=this.nextBufferRange()){return Tt(Uint8Array,Tt(t.OffsetArrayType,this.sources[r]))}readTypeIds(t,{offset:r}=this.nextBufferRange()){return Tt(Uint8Array,Tt(t.ArrayType,this.sources[r]))}readData(t,{offset:r}=this.nextBufferRange()){let{sources:n}=this;if(z.isTimestamp(t))return Tt(Uint8Array,xo.convertArray(n[r]));if((z.isInt(t)||z.isTime(t))&&t.bitWidth===64||z.isDuration(t))return Tt(Uint8Array,xo.convertArray(n[r]));if(z.isDate(t)&&t.unit===Qt.MILLISECOND)return Tt(Uint8Array,xo.convertArray(n[r]));if(z.isDecimal(t))return Tt(Uint8Array,zu.convertArray(n[r]));if(z.isBinary(t)||z.isLargeBinary(t)||z.isFixedSizeBinary(t))return eD(n[r]);if(z.isBinaryView(t))return rD(n[r]);if(z.isUtf8View(t))return nD(n[r]);if(z.isBool(t))return za(n[r]);if(z.isUtf8(t)||z.isLargeUtf8(t))return En(n[r].join(""));if(z.isInterval(t))switch(t.unit){case Lt.DAY_TIME:return x_(n[r]);case Lt.MONTH_DAY_NANO:return S_(n[r]);default:break}return Tt(Uint8Array,Tt(t.ArrayType,n[r].map(i=>+i)))}readVariadicBuffers(t){let r=[];for(let n=0;n<t;n++){let{offset:i}=this.nextBufferRange(),o=this.sources[i];r.push(mA(o))}return r}};Bp=class extends zl{constructor(t,r,n,i,o,s=[]){super(new Uint8Array(0),r,n,i,o,s),this.bodyChunks=t}readData(t,r=this.nextBufferRange()){return this.bodyChunks[this.buffersIndex]}}});var So,Lp=w(()=>{xi();me();Je();So=class extends Pr{constructor(t){super(t),this._values=new dn(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,nt(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,0);else{let c=a.length;i.set(a,o),n.set(s,c),o+=c}}}});var vo,Dp=w(()=>{Je();xi();me();vo=class extends Pr{constructor(t){super(t),this._values=new dn(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,nt(r))}_flushPending(t,r){let n=this._offsets,i=this._values.reserve(r).buffer,o=0;for(let[s,a]of t)if(a===void 0)n.set(s,BigInt(0));else{let c=a.length;i.set(a,o),n.set(s,BigInt(c)),o+=c}}}});var Ha,I_=w(()=>{xi();me();Ha=class extends oe{constructor(t){super(t),this._values=new Fl}setValue(t,r){this._values.set(t,+r)}}});var Hi,Gs,zs,A_=w(()=>{me();Dn();Hi=class extends $e{};Hi.prototype._setValue=Yw;Gs=class extends Hi{};Gs.prototype._setValue=Zm;zs=class extends Hi{};zs.prototype._setValue=Jm});var Vs,P_=w(()=>{me();Dn();Vs=class extends $e{};Vs.prototype._setValue=Zw});var $a,R_=w(()=>{te();me();Vu();$a=class extends oe{constructor({type:t,nullValues:r,dictionaryHashFunction:n}){super({type:new We(t.dictionary,t.indices,t.id,t.isOrdered)}),this._nulls=null,this._dictionaryOffset=0,this._keysToIndices=Object.create(null),this.indices=vi({type:this.type.indices,nullValues:r}),this.dictionary=vi({type:this.type.dictionary,nullValues:null}),typeof n=="function"&&(this.valueToKey=n)}get values(){return this.indices.values}get nullCount(){return this.indices.nullCount}get nullBitmap(){return this.indices.nullBitmap}get byteLength(){return this.indices.byteLength+this.dictionary.byteLength}get reservedLength(){return this.indices.reservedLength+this.dictionary.reservedLength}get reservedByteLength(){return this.indices.reservedByteLength+this.dictionary.reservedByteLength}isValid(t){return this.indices.isValid(t)}setValid(t,r){let n=this.indices;return r=n.setValid(t,r),this.length=n.length,r}setValue(t,r){let n=this._keysToIndices,i=this.valueToKey(r),o=n[i];return o===void 0&&(n[i]=o=this._dictionaryOffset+this.dictionary.append(r).length-1),this.indices.setValue(t,o)}flush(){let t=this.type,r=this._dictionary,n=this.dictionary.toVector(),i=this.indices.flush().clone(t);return i.dictionary=r?r.concat(n):n,this.finished||(this._dictionaryOffset+=n.length),this._dictionary=i.dictionary,this.clear(),i}finish(){return this.indices.finish(),this.dictionary.finish(),this._dictionaryOffset=0,this._keysToIndices=Object.create(null),super.finish()}clear(){return this.indices.clear(),this.dictionary.clear(),super.clear()}valueToKey(t){return typeof t=="string"?t:`${t}`}}});var ks,C_=w(()=>{me();Dn();ks=class extends $e{};ks.prototype._setValue=$w});var Ya,N_=w(()=>{Rr();me();te();Ya=class extends oe{setValue(t,r){let[n]=this.children,i=t*this.stride;for(let o=-1,s=this.stride;++o<s;)n.set(i+o,r[o])}setValid(t,r){return super.setValid(t,r)||this.children[0].setValid((t+1)*this.stride-1,!1),r}addChild(t,r="0"){if(this.numChildren>0)throw new Error("FixedSizeListBuilder can only have one child.");let n=this.children.push(t);return this.type=new _e(this.type.listSize,new Z(r,t.type,!0)),n}}});var $i,Ka,Xa,Za,O_=w(()=>{Ru();me();$i=class extends $e{setValue(t,r){this._values.set(t,r)}},Ka=class extends $i{setValue(t,r){super.setValue(t,Pu(r))}},Xa=class extends $i{},Za=class extends $i{}});var Ei,qs,js,Ws,B_=w(()=>{me();Dn();Ei=class extends $e{};Ei.prototype._setValue=Jw;qs=class extends Ei{};qs.prototype._setValue=ap;js=class extends Ei{};js.prototype._setValue=cp;Ws=class extends Ei{};Ws.prototype._setValue=lp});var ti,Hs,$s,Ys,Ks,L_=w(()=>{me();Dn();ti=class extends $e{};ti.prototype._setValue=Qw;Hs=class extends ti{};Hs.prototype._setValue=hp;$s=class extends ti{};$s.prototype._setValue=up;Ys=class extends ti{};Ys.prototype._setValue=fp;Ks=class extends ti{};Ks.prototype._setValue=dp});var $r,Ja,Qa,tc,ec,rc,nc,ic,oc,D_=w(()=>{me();$r=class extends $e{setValue(t,r){this._values.set(t,r)}},Ja=class extends $r{},Qa=class extends $r{},tc=class extends $r{},ec=class extends $r{},rc=class extends $r{},nc=class extends $r{},ic=class extends $r{},oc=class extends $r{}});var sc,F_=w(()=>{Rr();te();xi();me();sc=class extends Pr{constructor(t){super(t),this._offsets=new Ls(t.type)}addChild(t,r="0"){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new je(new Z(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(typeof o>"u")r.set(i,0);else{let s=o,a=s.length,c=r.set(i,a).buffer[i];for(let l=-1;++l<a;)n.set(c+l,s[l])}}}});var ac,U_=w(()=>{Rr();te();xi();Vi();me();ac=class extends Pr{constructor(t){super(t),this._offsets=new Ls(t.type)}addChild(t,r="0"){if(this.numChildren>0)throw new Error("LargeListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Bn(new Z(r,t.type,!0)),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(typeof o>"u")r.set(i,BigInt(0));else{let s=o,a=s.length,c=It(r.set(i,BigInt(a)).buffer[i]);for(let l=-1;++l<a;)n.set(c+l,s[l])}}}});var cc,G_=w(()=>{Rr();te();me();cc=class extends Pr{set(t,r){return super.set(t,r)}setValue(t,r){let n=r instanceof Map?r:new Map(Object.entries(r)),i=this._pending||(this._pending=new Map),o=i.get(t);o&&(this._pendingLength-=o.size),this._pendingLength+=n.size,i.set(t,n)}addChild(t,r=`${this.numChildren}`){if(this.numChildren>0)throw new Error("ListBuilder can only have one child.");return this.children[this.numChildren]=t,this.type=new Ir(new Z(r,t.type,!0),this.type.keysSorted),this.numChildren-1}_flushPending(t){let r=this._offsets,[n]=this.children;for(let[i,o]of t)if(o===void 0)r.set(i,0);else{let{[i]:s,[i+1]:a}=r.set(i,o.size).buffer;for(let c of o.entries())if(n.set(s,c),++s>=a)break}}}});var lc,z_=w(()=>{me();lc=class extends oe{setValue(t,r){}setValid(t,r){return this.length=Math.max(t+1,this.length),r}}});var hc,V_=w(()=>{Rr();me();te();hc=class extends oe{setValue(t,r){let{children:n,type:i}=this;switch(Array.isArray(r)||r.constructor){case!0:return i.children.forEach((o,s)=>n[s].set(t,r[s]));case Map:return i.children.forEach((o,s)=>n[s].set(t,r.get(o.name)));default:return i.children.forEach((o,s)=>n[s].set(t,r[o.name]))}}setValid(t,r){return super.setValid(t,r)||this.children.forEach(n=>n.setValid(t,r)),r}addChild(t,r=`${this.numChildren}`){let n=this.children.push(t);return this.type=new Yt([...this.type.children,new Z(r,t.type,!0)]),n}}});var ei,Xs,Zs,Js,Qs,k_=w(()=>{me();Dn();ei=class extends $e{};ei.prototype._setValue=Kw;Xs=class extends ei{};Xs.prototype._setValue=Qm;Zs=class extends ei{};Zs.prototype._setValue=tp;Js=class extends ei{};Js.prototype._setValue=ep;Qs=class extends ei{};Qs.prototype._setValue=rp});var ri,ta,ea,ra,na,q_=w(()=>{me();Dn();ri=class extends $e{};ri.prototype._setValue=Xw;ta=class extends ri{};ta.prototype._setValue=np;ea=class extends ri{};ea.prototype._setValue=ip;ra=class extends ri{};ra.prototype._setValue=op;na=class extends ri{};na.prototype._setValue=sp});var Eo,uc,fc,j_=w(()=>{Rr();xi();me();te();Eo=class extends oe{constructor(t){super(t),this._typeIds=new _o(Int8Array,0,1),typeof t.valueToChildTypeId=="function"&&(this._valueToChildTypeId=t.valueToChildTypeId)}get typeIdToChildIndex(){return this.type.typeIdToChildIndex}append(t,r){return this.set(this.length,t,r)}set(t,r,n){return n===void 0&&(n=this._valueToChildTypeId(this,r,t)),this.setValue(t,r,n),this}setValue(t,r,n){this._typeIds.set(t,n);let i=this.type.typeIdToChildIndex[n],o=this.children[i];o?.set(t,r),this.length=Math.max(t+1,this.length)}addChild(t,r=`${this.children.length}`){let n=this.children.push(t),{type:{children:i,mode:o,typeIds:s}}=this,a=[...i,new Z(r,t.type)];return this.type=new Hr(o,[...s,n],a),n}_valueToChildTypeId(t,r,n){throw new Error("Cannot map UnionBuilder value to child typeId. Pass the `childTypeId` as the second argument to unionBuilder.append(), or supply a `valueToChildTypeId` function as part of the UnionBuilder constructor options.")}},uc=class extends Eo{},fc=class extends Eo{constructor(t){super(t),this._offsets=new _o(Int32Array)}setValue(t,r,n){let i=this._typeIds.set(t,n).buffer[t],o=this.getChildAt(this.type.typeIdToChildIndex[i]),s=this._offsets.set(t,o.length).buffer[t];o?.set(s,r),this.length=Math.max(t+1,this.length)}}});var ia,W_=w(()=>{uo();Lp();xi();me();ia=class extends Pr{constructor(t){super(t),this._values=new dn(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,En(r))}_flushPending(t,r){}};ia.prototype._flushPending=So.prototype._flushPending});var oa,H_=w(()=>{uo();xi();me();Dp();oa=class extends Pr{constructor(t){super(t),this._values=new dn(Uint8Array)}get byteLength(){let t=this._pendingLength+this.length*4;return this._offsets&&(t+=this._offsets.byteLength),this._values&&(t+=this._values.byteLength),this._nulls&&(t+=this._nulls.byteLength),t}setValue(t,r){return super.setValue(t,En(r))}_flushPending(t,r){}};oa.prototype._flushPending=vo.prototype._flushPending});var To,Fp=w(()=>{te();me();xi();Je();Xn();To=class extends oe{constructor(t){super(t),this._variadicBuffers=[],this._currentBuffer=null,this._currentBufferIndex=0,this._currentBufferOffset=0,this._bufferSize=32*1024*1024,this._views=new dn(Uint8Array)}get byteLength(){let t=0;this._views&&(t+=this._views.byteLength),this._nulls&&(t+=this._nulls.byteLength);for(let r of this._variadicBuffers)t+=r.byteLength;return this._currentBuffer&&(t+=this._currentBuffer.byteLength),t}setValue(t,r){return this.writeBinaryValue(t,this.encodeValue(r))}writeBinaryValue(t,r){let n=r.length,i=(t+1)*Mt.ELEMENT_WIDTH,o=this._views.length;i>o&&this._views.reserve(i-o);let s=this._views.buffer,a=t*Mt.ELEMENT_WIDTH,c=new DataView(s.buffer,s.byteOffset+a,Mt.ELEMENT_WIDTH);if(c.setInt32(Mt.LENGTH_OFFSET,n,!0),n<=Mt.INLINE_CAPACITY){s.set(r,a+Mt.INLINE_OFFSET);for(let l=n;l<Mt.INLINE_CAPACITY;l++)s[a+Mt.INLINE_OFFSET+l]=0}else{let l=new DataView(r.buffer,r.byteOffset,Math.min(4,n));c.setUint32(Mt.INLINE_OFFSET,l.getUint32(0,!0),!0),(!this._currentBuffer||this._currentBufferOffset+n>this._bufferSize)&&(this._currentBuffer&&this._variadicBuffers.push(this._currentBuffer.buffer.slice(0,this._currentBufferOffset)),this._currentBuffer=new dn(Uint8Array),this._currentBufferIndex=this._variadicBuffers.length,this._currentBufferOffset=0),this._currentBuffer.reserve(n).buffer.set(r,this._currentBufferOffset),c.setInt32(Mt.BUFFER_INDEX_OFFSET,this._currentBufferIndex,!0),c.setInt32(Mt.BUFFER_OFFSET_OFFSET,this._currentBufferOffset,!0),this._currentBufferOffset+=n}return this}encodeValue(t){return nt(t)}setValid(t,r){let n=(t+1)*Mt.ELEMENT_WIDTH,i=this._views.length;n>i&&this._views.reserve(n-i);let o=super.setValid(t,r);if(!o){let s=this._views.buffer,a=t*Mt.ELEMENT_WIDTH;for(let c=0;c<Mt.ELEMENT_WIDTH;c++)s[a+c]=0}return o}clear(){return this._variadicBuffers=[],this._currentBuffer=null,this._currentBufferIndex=0,this._currentBufferOffset=0,this._views.clear(),super.clear()}flush(){let{type:t,length:r,nullCount:n,_views:i,_nulls:o}=this;this._currentBuffer&&this._currentBufferOffset>0&&(this._variadicBuffers.push(this._currentBuffer.buffer.slice(0,this._currentBufferOffset)),this._currentBuffer=null,this._currentBufferOffset=0);let s=i.flush(r*Mt.ELEMENT_WIDTH),a=n>0?o.flush(r):void 0,c=this._variadicBuffers.slice();return this._variadicBuffers=[],this._currentBufferIndex=0,this.clear(),Q({type:t,length:r,nullCount:n,nullBitmap:a,views:s,variadicBuffers:c})}finish(){return this.finished=!0,this}}});var dc,$_=w(()=>{Fp();uo();dc=class extends To{constructor(t){super(t)}setValue(t,r){return this.writeBinaryValue(t,En(r))}}});var Y_,yA,wA=w(()=>{fn();Lp();Dp();I_();A_();P_();R_();C_();N_();O_();B_();L_();D_();F_();U_();G_();z_();V_();k_();q_();j_();W_();H_();Fp();$_();Y_=class extends rt{visitNull(){return lc}visitBool(){return Ha}visitInt(){return $r}visitInt8(){return Ja}visitInt16(){return Qa}visitInt32(){return tc}visitInt64(){return ec}visitUint8(){return rc}visitUint16(){return nc}visitUint32(){return ic}visitUint64(){return oc}visitFloat(){return $i}visitFloat16(){return Ka}visitFloat32(){return Xa}visitFloat64(){return Za}visitUtf8(){return ia}visitLargeUtf8(){return oa}visitBinary(){return So}visitLargeBinary(){return vo}visitFixedSizeBinary(){return ks}visitDate(){return Hi}visitDateDay(){return Gs}visitDateMillisecond(){return zs}visitTimestamp(){return ei}visitTimestampSecond(){return Xs}visitTimestampMillisecond(){return Zs}visitTimestampMicrosecond(){return Js}visitTimestampNanosecond(){return Qs}visitTime(){return ri}visitTimeSecond(){return ta}visitTimeMillisecond(){return ea}visitTimeMicrosecond(){return ra}visitTimeNanosecond(){return na}visitDecimal(){return Vs}visitList(){return sc}visitLargeList(){return ac}visitStruct(){return hc}visitUnion(){return Eo}visitDenseUnion(){return fc}visitSparseUnion(){return uc}visitDictionary(){return $a}visitInterval(){return Ei}visitIntervalDayTime(){return qs}visitIntervalYearMonth(){return js}visitIntervalMonthDayNano(){return Ws}visitDuration(){return ti}visitDurationSecond(){return Hs}visitDurationMillisecond(){return $s}visitDurationMicrosecond(){return Ys}visitDurationNanosecond(){return Ks}visitFixedSizeList(){return Ya}visitMap(){return cc}visitBinaryView(){return To}visitUtf8View(){return dc}},yA=new Y_});function Yr(e,t){return t instanceof e.constructor}function Io(e,t){return e===t||Yr(e,t)}function Ao(e,t){return e===t||Yr(e,t)&&e.bitWidth===t.bitWidth&&e.isSigned===t.isSigned}function Up(e,t){return e===t||Yr(e,t)&&e.precision===t.precision}function iD(e,t){return e===t||Yr(e,t)&&e.byteWidth===t.byteWidth}function K_(e,t){return e===t||Yr(e,t)&&e.unit===t.unit}function ku(e,t){return e===t||Yr(e,t)&&e.unit===t.unit&&e.timezone===t.timezone}function qu(e,t){return e===t||Yr(e,t)&&e.unit===t.unit&&e.bitWidth===t.bitWidth}function _A(e,t){return e===t||Yr(e,t)&&e.children.length===t.children.length&&Yi.compareManyFields(e.children,t.children)}function oD(e,t){return e===t||Yr(e,t)&&e.children.length===t.children.length&&Yi.compareManyFields(e.children,t.children)}function X_(e,t){return e===t||Yr(e,t)&&e.mode===t.mode&&e.typeIds.every((r,n)=>r===t.typeIds[n])&&Yi.compareManyFields(e.children,t.children)}function sD(e,t){return e===t||Yr(e,t)&&e.id===t.id&&e.isOrdered===t.isOrdered&&Yi.visit(e.indices,t.indices)&&Yi.visit(e.dictionary,t.dictionary)}function Gp(e,t){return e===t||Yr(e,t)&&e.unit===t.unit}function ju(e,t){return e===t||Yr(e,t)&&e.unit===t.unit}function aD(e,t){return e===t||Yr(e,t)&&e.listSize===t.listSize&&e.children.length===t.children.length&&Yi.compareManyFields(e.children,t.children)}function cD(e,t){return e===t||Yr(e,t)&&e.keysSorted===t.keysSorted&&e.children.length===t.children.length&&Yi.compareManyFields(e.children,t.children)}function mc(e,t){return Yi.compareSchemas(e,t)}function MA(e,t){return Yi.compareFields(e,t)}function zp(e,t){return Yi.visit(e,t)}var at,Yi,Wu=w(()=>{fn();at=class extends rt{compareSchemas(t,r){return t===r||r instanceof t.constructor&&this.compareManyFields(t.fields,r.fields)}compareManyFields(t,r){return t===r||Array.isArray(t)&&Array.isArray(r)&&t.length===r.length&&t.every((n,i)=>this.compareFields(n,r[i]))}compareFields(t,r){return t===r||r instanceof t.constructor&&t.name===r.name&&t.nullable===r.nullable&&this.visit(t.type,r.type)}};at.prototype.visitNull=Io;at.prototype.visitBool=Io;at.prototype.visitInt=Ao;at.prototype.visitInt8=Ao;at.prototype.visitInt16=Ao;at.prototype.visitInt32=Ao;at.prototype.visitInt64=Ao;at.prototype.visitUint8=Ao;at.prototype.visitUint16=Ao;at.prototype.visitUint32=Ao;at.prototype.visitUint64=Ao;at.prototype.visitFloat=Up;at.prototype.visitFloat16=Up;at.prototype.visitFloat32=Up;at.prototype.visitFloat64=Up;at.prototype.visitUtf8=Io;at.prototype.visitLargeUtf8=Io;at.prototype.visitUtf8View=Io;at.prototype.visitBinary=Io;at.prototype.visitLargeBinary=Io;at.prototype.visitBinaryView=Io;at.prototype.visitFixedSizeBinary=iD;at.prototype.visitDate=K_;at.prototype.visitDateDay=K_;at.prototype.visitDateMillisecond=K_;at.prototype.visitTimestamp=ku;at.prototype.visitTimestampSecond=ku;at.prototype.visitTimestampMillisecond=ku;at.prototype.visitTimestampMicrosecond=ku;at.prototype.visitTimestampNanosecond=ku;at.prototype.visitTime=qu;at.prototype.visitTimeSecond=qu;at.prototype.visitTimeMillisecond=qu;at.prototype.visitTimeMicrosecond=qu;at.prototype.visitTimeNanosecond=qu;at.prototype.visitDecimal=Io;at.prototype.visitList=_A;at.prototype.visitLargeList=_A;at.prototype.visitStruct=oD;at.prototype.visitUnion=X_;at.prototype.visitDenseUnion=X_;at.prototype.visitSparseUnion=X_;at.prototype.visitDictionary=sD;at.prototype.visitInterval=Gp;at.prototype.visitIntervalDayTime=Gp;at.prototype.visitIntervalYearMonth=Gp;at.prototype.visitIntervalMonthDayNano=Gp;at.prototype.visitDuration=ju;at.prototype.visitDurationSecond=ju;at.prototype.visitDurationMillisecond=ju;at.prototype.visitDurationMicrosecond=ju;at.prototype.visitDurationNanosecond=ju;at.prototype.visitFixedSizeList=aD;at.prototype.visitMap=cD;Yi=new at});function vi(e){let t=e.type,r=new(yA.getVisitFn(t)())(e);if(t.children&&t.children.length>0){let n=e.children||[],i={nullValues:e.nullValues},o=Array.isArray(n)?((s,a)=>n[a]||i):(({name:s})=>n[s]||i);for(let[s,a]of t.children.entries()){let{type:c}=a,l=o(a,s);r.children.push(vi(Object.assign(Object.assign({},l),{type:c})))}}return r}function Vl(e,t){if(e instanceof ut||e instanceof $||e.type instanceof z||ArrayBuffer.isView(e))return Wi(e);let r={type:t??Vp(e),nullValues:[null]},n=[...kp(r)(e)],i=n.length===1?n[0]:n.reduce((o,s)=>o.concat(s));return z.isDictionary(i.type)?i.memoize():i}function Z_(e){let t=Vl(e),r=new Zt(new _t(t.type.children),t.data[0]);return new ce(r)}function Vp(e){if(e.length===0)return new De;let t=0,r=0,n=0,i=0,o=0,s=0,a=0,c=0;for(let l of e){if(l==null){++t;continue}switch(typeof l){case"bigint":++s;continue;case"boolean":++a;continue;case"number":++i;continue;case"string":++o;continue;case"object":Array.isArray(l)?++r:Object.prototype.toString.call(l)==="[object Date]"?++c:++n;continue}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}if(i+t===e.length)return new On;if(o+t===e.length)return new We(new vr,new Ve);if(s+t===e.length)return new Rn;if(a+t===e.length)return new Er;if(c+t===e.length)return new ki;if(r+t===e.length){let l=e,h=Vp(l[l.findIndex(u=>u!=null)]);if(l.every(u=>u==null||zp(h,Vp(u))))return new je(new Z("",h,!0))}else if(n+t===e.length){let l=new Map;for(let h of e)for(let u of Object.keys(h))!l.has(u)&&h[u]!=null&&l.set(u,new Z(u,Vp([h[u]]),!0));return new Yt([...l.values()])}throw new TypeError("Unable to infer Vector type from input values, explicit type declaration expected.")}function kp(e){let{["queueingStrategy"]:t="count"}=e,{["highWaterMark"]:r=t!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=e,n=t!=="bytes"?"length":"byteLength";return function*(i){let o=0,s=vi(e);for(let a of i)s.append(a)[n]>=r&&++o&&(yield s.toVector());(s.finish().length>0||o===0)&&(yield s.toVector())}}function J_(e){let{["queueingStrategy"]:t="count"}=e,{["highWaterMark"]:r=t!=="bytes"?Number.POSITIVE_INFINITY:Math.pow(2,14)}=e,n=t!=="bytes"?"length":"byteLength";return function(i){return Gr(this,arguments,function*(){var o,s,a,c;let l=0,h=vi(e);try{for(var u=!0,f=vn(i),d;d=yield wt(f.next()),o=d.done,!o;u=!0){c=d.value,u=!1;let m=c;h.append(m)[n]>=r&&++l&&(yield yield wt(h.toVector()))}}catch(m){s={error:m}}finally{try{!u&&!o&&(a=f.return)&&(yield wt(a.call(f)))}finally{if(s)throw s.error}}(h.finish().length>0||l===0)&&(yield yield wt(h.toVector()))})}}var Vu=w(()=>{an();Rr();te();Xn();Ar();wA();pc();Po();Wu()});function qp(e,t){return lD(e,t.map(r=>r.data.concat()))}function lD(e,t){let r=[...e.fields],n=[],i={numBatches:t.reduce((u,f)=>Math.max(u,f.length),0)},o=0,s=0,a=-1,c=t.length,l,h=[];for(;i.numBatches-- >0;){for(s=Number.POSITIVE_INFINITY,a=-1;++a<c;)h[a]=l=t[a].shift(),s=Math.min(s,l?l.length:s);Number.isFinite(s)&&(h=hD(r,s,h,t,i),s>0&&(n[o++]=Q({type:new Yt(r),length:s,nullCount:0,children:h.slice()})))}return[e=e.assign(r),n.map(u=>new Zt(e,u))]}function hD(e,t,r,n,i){var o;let s=(t+63&-64)>>3;for(let a=-1,c=n.length;++a<c;){let l=r[a],h=l?.length;if(h>=t)h===t?r[a]=l:(r[a]=l.slice(0,t),i.numBatches=Math.max(i.numBatches,n[a].unshift(l.slice(t,h-t))));else{let u=e[a];e[a]=u.clone({nullable:!0}),r[a]=(o=l?._changeLengthAndBackfillNullBitmap(t))!==null&&o!==void 0?o:Q({type:u.type,length:t,nullCount:t,nullBitmap:new Uint8Array(s)})}}return r}var bA=w(()=>{Xn();te();Po()});function Q_(e){let t={},r=Object.entries(e);for(let[n,i]of r)t[n]=Wi(i);return new ce(t)}function tM(e){let t={},r=Object.entries(e);for(let[n,i]of r)t[n]=Vl(i);return new ce(t)}var xA,SA,ce,pc=w(()=>{Ne();Xn();Vu();Ar();Rr();te();Wu();bA();Sp();Fa();Dn();vp();Ep();Ol();Po();SA=Symbol.for("apache-arrow/Table"),ce=class e{static isTable(t){return t?.[SA]===!0}constructor(...t){var r,n;if(t.length===0)return this.batches=[],this.schema=new _t([]),this._offsets=[0],this;let i,o;t[0]instanceof _t&&(i=t.shift()),t.at(-1)instanceof Uint32Array&&(o=t.pop());let s=c=>{if(c){if(c instanceof Zt)return[c];if(c instanceof e)return c.batches;if(c instanceof ut){if(c.type instanceof Yt)return[new Zt(new _t(c.type.children),c)]}else{if(Array.isArray(c))return c.flatMap(l=>s(l));if(typeof c[Symbol.iterator]=="function")return[...c].flatMap(l=>s(l));if(typeof c=="object"){let l=Object.keys(c),h=l.map(d=>new $([c[d]])),u=i??new _t(l.map((d,m)=>new Z(String(d),h[m].type,h[m].nullable))),[,f]=qp(u,h);return f.length===0?[new Zt(c)]:f}}}return[]},a=t.flatMap(c=>s(c));if(i=(n=i??((r=a[0])===null||r===void 0?void 0:r.schema))!==null&&n!==void 0?n:new _t([]),!(i instanceof _t))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");for(let c of a){if(!(c instanceof Zt))throw new TypeError("Table constructor expects a [Schema, RecordBatch[]] pair.");if(!mc(i,c.schema))throw new TypeError("Table and inner RecordBatch schemas must be equivalent.")}this.schema=i,this.batches=a,this._offsets=o??_p(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,r)=>t+r.length,0)}get nullCount(){return this._nullCount===-1&&(this._nullCount=wp(this.data)),this._nullCount}isValid(t){return!1}get(t){return null}at(t){return this.get(Ua(t,this.numRows))}set(t,r){}indexOf(t,r){return-1}[Symbol.iterator](){return this.batches.length>0?Dl.visit(new $(this.data)):new Array(0)[Symbol.iterator]()}toArray(){return[...this]}toString(){return`[
|
|
16
16
|
${this.toArray().join(`,
|
|
17
17
|
`)}
|
|
18
|
-
]`}concat(...t){let r=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new e(r,n.map(i=>new Zt(r,i)))}slice(t,r){let n=this.schema;[t,r]=Cu({length:this.numRows},t,r);let i=gp(this.data,this._offsets,t,r);return new e(n,i.map(o=>new Zt(n,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let r=this.data.map(n=>n.children[t]);if(r.length===0){let{type:n}=this.schema.fields[t],i=Q({type:n,length:0,nullCount:0});r.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new $(r)}return null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){r||(r=new $([Q({type:new De,length:this.numRows})]));let o=n.fields.slice(),s=o[t].clone({type:r.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,r],[n,i]=Gp(n,a)}return new e(n,i)}select(t){let r=this.schema.fields.reduce((n,i,o)=>n.set(i.name,o),new Map);return this.selectAt(t.map(n=>r.get(n)).filter(n=>n>-1))}selectAt(t){let r=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new e(r,n)}assign(t){let r=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[h,u]=a,f=r.findIndex(d=>d.name===c.name);return~f?u[f]=l:h.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...r.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new e(...Gp(o,s))}};dA=Symbol.toStringTag;ce[dA]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e[mA]=!0,e.isValid=Bl(Bu),e.get=Bl(We.getVisitFn(x.Struct)),e.set=yp(mr.getVisitFn(x.Struct)),e.indexOf=wp(ka.getVisitFn(x.Struct)),"Table"))(ce.prototype);Object.defineProperty(ce,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===ce&&ce.isTable(t)}})});function pA(e,t,r=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...e.fields],o=[...t],s=(r+63&-64)>>3;for(let[a,c]of e.fields.entries()){let l=t[a];(!l||l.length!==r)&&(i[a]=c.clone({nullable:!0}),o[a]=(n=l?._changeLengthAndBackfillNullBitmap(r))!==null&&n!==void 0?n:Q({type:c.type,length:r,nullCount:r,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Q({type:new Yt(i),length:r,children:o})]}function wA(e,t,r=new Map){var n,i;if(((n=e?.length)!==null&&n!==void 0?n:0)>0&&e?.length===t?.length)for(let o=-1,s=e.length;++o<s;){let{type:a}=e[o],c=t[o];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])wA(a.children,l?.children,r);if(z.isDictionary(a)){let{id:l}=a;if(!r.has(l))c?.dictionary&&r.set(l,c.dictionary);else if(r.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return r}var gA,yA,Zt,gc,Po=w(()=>{Xn();pc();Ar();Rr();te();Nl();Fa();Dn();Mp();bp();yA=Symbol.for("apache-arrow/RecordBatch"),Zt=class e{static isRecordBatch(t){return t?.[yA]===!0}constructor(...t){switch(t.length){case 3:case 2:{if([this.schema]=t,!(this.schema instanceof _t))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Q({nullCount:0,type:new Yt(this.schema.fields),children:this.schema.fields.map(r=>Q({type:r.type,nullCount:0}))}),this._metadata=new Map]=t,!(this.data instanceof ut))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=pA(this.schema,this.data.children,this.data.length);break}case 1:{let[r]=t,{fields:n,children:i,length:o}=Object.keys(r).reduce((c,l,h)=>(c.children[h]=r[l],c.length=Math.max(c.length,r[l].length),c.fields[h]=Z.new({name:l,type:r[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new _t(n),a=Q({type:new Yt(n),length:o,children:i,nullCount:0});[this.schema,this.data]=pA(s,a.children,o),this._metadata=new Map;break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get metadata(){return this._metadata}get dictionaries(){return this._dictionaries||(this._dictionaries=wA(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 We.visit(this.data,t)}at(t){return this.get(Ua(t,this.numRows))}set(t,r){return mr.visit(this.data,t,r)}indexOf(t,r){return ka.visit(this.data,t,r)}[Symbol.iterator](){return Ll.visit(new $([this.data]))}toArray(){return[...this]}concat(...t){return new ce(this.schema,[this,...t])}slice(t,r){let[n]=new $([this.data]).slice(t,r).data;return new e(this.schema,n,this._metadata)}getChild(t){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new $([this.data.children[t]]):null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){r||(r=new $([Q({type:new De,length:this.numRows})]));let o=n.fields.slice(),s=i.children.slice(),a=o[t].clone({type:r.type});[o[t],s[t]]=[a,r.data[0]],n=new _t(o,new Map(this.schema.metadata)),i=Q({type:new Yt(o),length:i.length,children:s})}return new e(n,i,this._metadata)}select(t){let r=this.schema.select(t),n=new Yt(r.fields),i=[];for(let o of t){let s=this.schema.fields.findIndex(a=>a.name===o);~s&&(i[s]=this.data.children[s])}return new e(r,Q({type:n,length:this.numRows,children:i}),this._metadata)}selectAt(t){let r=this.schema.selectAt(t),n=t.map(o=>this.data.children[o]).filter(Boolean),i=Q({type:new Yt(r.fields),length:this.numRows,children:n});return new e(r,i,this._metadata)}};gA=Symbol.toStringTag;Zt[gA]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e[yA]=!0,"RecordBatch"))(Zt.prototype);Object.defineProperty(Zt,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===Zt&&Zt.isRecordBatch(t)}});gc=class extends Zt{constructor(t,r){let n=t.fields.map(o=>Q({type:o.type})),i=Q({type:new Yt(t.fields),length:0,nullCount:0,children:n});super(t,i,r||new Map)}}});function Vp(e,t=0){for(let r=-1,n=Vl.length;++r<n;)if(Vl[r]!==e[t+r])return!1;return!0}var X_,Z_,_A,MA,sa,yc,wc,zp,K_,Vl,kl,J_,bA,kp=w(()=>{an();Ne();Gt();Ds();us();f_();Je();Fs();Du();X_=e=>`Expected ${Nt[e]} Message in stream, but was null or length 0.`,Z_=e=>`Header pointer of flatbuffer-encoded ${Nt[e]} Message is null or length 0.`,_A=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,MA=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,sa=class{constructor(t){this.source=t instanceof Qn?t:new Qn(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?pe:t.value===-1&&(t=this.readMetadataLength()).done?pe:(t=this.readMetadata(t.value)).done?pe:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(X_(t));return r.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let r=nt(this.source.read(t));if(r.byteLength<t)throw new Error(MA(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()}readSchema(t=!1){let r=Nt.Schema,n=this.readMessage(r),i=n?.header();if(t&&!i)throw new Error(Z_(r));return i}readMetadataLength(){let t=this.source.read(zp),r=t&&new hr(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let r=this.source.read(t);if(!r)return pe;if(r.byteLength<t)throw new Error(_A(t,r.byteLength));return{done:!1,value:Nr.decode(r)}}},yc=class{constructor(t,r){this.source=t instanceof mn?t:Cm(t)?new Us(t,r):new mn(t)}[Symbol.asyncIterator](){return this}next(){return Y(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?pe:t.value===-1&&(t=yield this.readMetadataLength()).done?pe:(t=yield this.readMetadata(t.value)).done?pe:t})}throw(t){return Y(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return Y(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return Y(this,void 0,void 0,function*(){let r;if((r=yield this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(X_(t));return r.value})}readMessageBody(t){return Y(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let r=nt(yield this.source.read(t));if(r.byteLength<t)throw new Error(MA(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()})}readSchema(){return Y(this,arguments,void 0,function*(t=!1){let r=Nt.Schema,n=yield this.readMessage(r),i=n?.header();if(t&&!i)throw new Error(Z_(r));return i})}readMetadataLength(){return Y(this,void 0,void 0,function*(){let t=yield this.source.read(zp),r=t&&new hr(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return Y(this,void 0,void 0,function*(){let r=yield this.source.read(t);if(!r)return pe;if(r.byteLength<t)throw new Error(_A(t,r.byteLength));return{done:!1,value:Nr.decode(r)}})}},wc=class extends sa{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Lu?t:new Lu(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Nr.fromJSON(t.schema,Nt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let r=t.dictionaries[this._dictionaryIndex++];return this._body=r.data.columns,{done:!1,value:Nr.fromJSON(r,Nt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let r=t.batches[this._batchIndex++];return this._body=r.columns,{done:!1,value:Nr.fromJSON(r,Nt.RecordBatch)}}return this._body=[],pe}readMessageBody(t){return r(this._body);function r(n){return(n||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...o.VIEWS&&[o.VIEWS]||[],...o.VARIADIC_DATA_BUFFERS||[],...r(o.children)],[])}}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(X_(t));return r.value}readSchema(){let t=Nt.Schema,r=this.readMessage(t),n=r?.header();if(!r||!n)throw new Error(Z_(t));return n}},zp=4,K_="ARROW1",Vl=new Uint8Array(K_.length);for(let e=0;e<K_.length;e+=1)Vl[e]=K_.codePointAt(e);kl=Vl.length,J_=kl+zp,bA=kl*2+zp});var Q_,tM,xA,SA=w(()=>{_l();Q_=class{constructor(){this.LZ4_FRAME_MAGIC=new Uint8Array([4,34,77,24]),this.MIN_HEADER_LENGTH=7}isValidCodecEncode(t){let r=new Uint8Array([1,2,3,4,5,6,7,8]),n=t.encode(r);return this._isValidCompressed(n)}_isValidCompressed(t){return this._hasMinimumLength(t)&&this._hasValidMagicNumber(t)&&this._hasValidVersion(t)}_hasMinimumLength(t){return t.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(t){return this.LZ4_FRAME_MAGIC.every((r,n)=>t[n]===r)}_hasValidVersion(t){return(t[4]&192)>>6===1}},tM=class{constructor(){this.ZSTD_MAGIC=new Uint8Array([40,181,47,253]),this.MIN_HEADER_LENGTH=6}isValidCodecEncode(t){let r=new Uint8Array([1,2,3,4,5,6,7,8]),n=t.encode(r);return this._isValidCompressed(n)}_isValidCompressed(t){return this._hasMinimumLength(t)&&this._hasValidMagicNumber(t)}_hasMinimumLength(t){return t.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(t){return this.ZSTD_MAGIC.every((r,n)=>t[n]===r)}},xA={[ur.LZ4_FRAME]:new Q_,[ur.ZSTD]:new tM}});var eM,aa,qp=w(()=>{_l();SA();eM=class{constructor(){this.registry={}}set(t,r){if(r?.encode&&typeof r.encode=="function"&&!xA[t].isValidCodecEncode(r))throw new Error(`Encoder for ${ur[t]} is not valid.`);this.registry[t]=r}get(t){var r;return((r=this.registry)===null||r===void 0?void 0:r[t])||null}},aa=new eM});function IA(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*vA(e){let t=Kr.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function EA(e){return Gr(this,arguments,function*(){let r=yield wt(Kr.from(e));try{if(!(yield wt(r.open({autoDestroy:!1}))).closed)do yield yield wt(r);while(!(yield wt(r.reset().open())).closed)}finally{yield wt(r.cancel())}})}function rD(e){return new Ti(new nM(e))}function nD(e){let t=e.peek(kl+7&-8);return t&&t.byteLength>=4?Vp(t)?new Co(new Wp(e.read())):new Ti(new jl(e)):new Ti(new jl((function*(){})()))}function iD(e){return Y(this,void 0,void 0,function*(){let t=yield e.peek(kl+7&-8);return t&&t.byteLength>=4?Vp(t)?new Co(new Wp(yield e.read())):new Ro(new Wl(e)):new Ro(new Wl((function(){return Gr(this,arguments,function*(){})})()))})}function oD(e){return Y(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new Us(e,t);return t>=bA&&Vp(yield r.readAt(0,kl+7&-8))?new ql(new rM(r)):new Ro(new Wl(r))})}var Kr,Ti,Ro,Co,ql,jp,jl,Wl,Wp,rM,nM,Wu=w(()=>{an();Xn();Ar();te();Ne();c_();su();Ds();Fs();f_();aA();Po();Du();kp();us();qp();Vi();Gt();Kr=class e extends Wa{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let r=this._impl.open(t);return Tn(r)?r.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 lr.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return lr.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,r){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof e?t:Pm(t)?rD(t):Cm(t)?oD(t):Tn(t)?Y(this,void 0,void 0,function*(){return yield e.from(yield t)}):Nm(t)||nu(t)||Bm(t)||$n(t)?iD(new mn(t)):nD(new Qn(t))}static readAll(t){return t instanceof e?t.isSync()?vA(t):EA(t):Pm(t)||ArrayBuffer.isView(t)||hi(t)||Rm(t)?vA(t):EA(t)}},Ti=class extends Kr{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Gr(this,arguments,function*(){yield wt(yield*gl(vn(this[Symbol.iterator]())))})}},Ro=class extends Kr{constructor(t){super(t),this._impl=t}readAll(){return Y(this,void 0,void 0,function*(){var t,r,n,i;let o=new Array;try{for(var s=!0,a=vn(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){r={error:l}}finally{try{!s&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(r)throw r.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Co=class extends Ti{constructor(t){super(t),this._impl=t}},ql=class extends Ro{constructor(t){super(t),this._impl=t}},jp=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,r,n){let i;if(t.compression!=null){let s=aa.get(t.compression.type);if(s?.decode&&typeof s.decode=="function"){let{decommpressedBody:a,buffers:c}=this._decompressBuffers(t,r,s);i=this._loadCompressedVectors(t,a,this.schema.fields),t=new $e(t.length,t.nodes,c,null)}else throw new Error("Record batch is compressed but codec not found")}else i=this._loadVectors(t,r,this.schema.fields);let o=Q({type:new Yt(this.schema.fields),length:t.length,children:i});return new Zt(this.schema,o,n)}_loadDictionaryBatch(t,r){let{id:n,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(n),c=s.dictionaries.get(n),l;if(t.data.compression!=null){let h=aa.get(t.data.compression.type);if(h?.decode&&typeof h.decode=="function"){let{decommpressedBody:u,buffers:f}=this._decompressBuffers(t.data,r,h);l=this._loadCompressedVectors(t.data,u,[c]),t=new Cr(new $e(t.data.length,t.data.nodes,f,null,t.data.variadicBufferCounts),n,i)}else throw new Error("Dictionary batch is compressed but codec not found")}else l=this._loadVectors(t.data,r,[c]);return(a&&i?a.concat(new $(l)):new $(l)).memoize()}_loadVectors(t,r,n){return new Gl(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion,t.variadicBufferCounts).visitMany(n)}_loadCompressedVectors(t,r,n){return new Rp(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion,t.variadicBufferCounts).visitMany(n)}_decompressBuffers(t,r,n){let i=[],o=[],s=0;for(let{offset:a,length:c}of t.buffers){if(c===0){i.push(new Uint8Array(0)),o.push(new Fe(s,0));continue}let l=new hr(r.subarray(a,a+c)),h=It(l.readInt64(0)),u=l.bytes().subarray(8),f=h===-1?u:n.decode(u);i.push(f);let d=(s+7&-8)-s;s+=d,o.push(new Fe(s,f.length)),s+=f.length}return{decommpressedBody:i,buffers:o}}},jl=class extends jp{constructor(t,r){super(r),this._reader=Pm(t)?new wc(this._handle=t):new sa(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=IA(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):pe}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):pe}next(){if(this.closed)return pe;let t,{_reader:r}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i,t.metadata)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new gc(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Wl=class extends jp{constructor(t,r){super(r),this._reader=new yc(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Y(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return Y(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=IA(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return Y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):pe})}return(t){return Y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):pe})}next(){return Y(this,void 0,void 0,function*(){if(this.closed)return pe;let t,{_reader:r}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i,t.metadata)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new gc(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Y(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Wp=class extends jl{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,r){super(t instanceof Fu?t:new Fu(t),r)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var r;if(this.closed)return null;this._footer||this.open();let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(Nt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s,i.metadata)}}return null}_readDictionaryBatch(t){var r;let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(Nt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,r=t.size-J_,n=t.readInt32(r),i=t.readAt(r-n,n);return Mo.decode(i)}_readNextMessageAndValidate(t){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},rM=class extends Wl{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,...r){let n=typeof r[0]!="number"?r.shift():void 0,i=r[0]instanceof Map?r.shift():void 0;super(t instanceof Us?t:new Us(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let r=Object.create(null,{open:{get:()=>super.open}});return Y(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,t)})}readRecordBatch(t){return Y(this,void 0,void 0,function*(){var r;if(this.closed)return null;this._footer||(yield this.open());let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(Nt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s,i.metadata)}}return null})}_readDictionaryBatch(t){return Y(this,void 0,void 0,function*(){var r;let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(Nt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}})}_readFooter(){return Y(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let r=t.size-J_,n=yield t.readInt32(r),i=yield t.readAt(r-n,n);return Mo.decode(i)})}_readNextMessageAndValidate(t){return Y(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=this._footer.getRecordBatch(this._recordBatchIndex);if(r&&(yield this._handle.seek(r.offset)))return yield this._reader.readMessage(t)}return null})}},nM=class extends jl{constructor(t,r){super(t,r)}_loadVectors(t,r,n){return new Pp(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion,t.variadicBufferCounts).visitMany(n)}}});function Gn(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new Fe(this._byteLength,t)),this._byteLength+=t,this}function sD(e){var t;let{type:r,length:n,typeIds:i,valueOffsets:o}=e;if(Gn.call(this,i),r.mode===qt.Sparse)return iM.call(this,e);if(r.mode===qt.Dense){if(e.offset<=0)return Gn.call(this,o),iM.call(this,e);{let s=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,h,u=-1;++u<n;)(l=i[u])!==void 0&&((h=a[l])===void 0&&(h=a[l]=o[u]),s[u]=o[u]-h,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);Gn.call(this,s),this.visitMany(e.children.map((l,h)=>{let u=r.typeIds[h],f=a[u],d=c[u];return l.slice(f,Math.min(n,d))}))}}return this}function aD(e){let t;return e.nullCount>=e.length?Gn.call(this,new Uint8Array(e.length+7>>3)):(t=e.values)instanceof Uint8Array?Gn.call(this,Ga(e.offset,e.length,t)):Gn.call(this,za(e.values))}function No(e){return Gn.call(this,e.values.subarray(0,e.length*e.stride))}function Hp(e){let{length:t,values:r,valueOffsets:n}=e,i=It(n[0]),o=It(n[t]),s=Math.min(o-i,r.byteLength-i);return Gn.call(this,Lm(-i,t+1,n)),Gn.call(this,r.subarray(i,i+s)),this}function AA(e){let{offset:t,length:r,stride:n,values:i,variadicBuffers:o=[]}=e;if(!i)throw new Error("BinaryView data is missing view buffer");let s=t*n,a=s+r*n;Gn.call(this,i.subarray(s,a));for(let c of o)Gn.call(this,c);return this._variadicBufferCounts.push(o.length),this}function $p(e){let{length:t,valueOffsets:r}=e;if(r){let n=It(r[0]),i=It(r[t]);return Gn.call(this,Lm(-n,t+1,r)),this.visit(e.children[0].slice(n,i-n))}return this.visit(e.children[0])}function iM(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}var ge,PA=w(()=>{Ar();fn();Ne();Po();Je();Va();Ds();te();Vi();ge=class e extends rt{static assemble(...t){let r=i=>i.flatMap(o=>Array.isArray(o)?r(o):o instanceof Zt?o.data.children:o.data),n=new e;return n.visitMany(r(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[],this._variadicBufferCounts=[]}visit(t){if(t instanceof $)return this.visitMany(t.data),this;let{type:r}=t;if(!z.isDictionary(r)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(z.isUnion(r))this.nodes.push(new Zn(n,0));else{let{nullCount:i}=t;z.isNull(r)||Gn.call(this,i<=0?new Uint8Array(0):Ga(t.offset,n,t.nullBitmap)),this.nodes.push(new Zn(n,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}get variadicBufferCounts(){return this._variadicBufferCounts}};ge.prototype.visitBool=aD;ge.prototype.visitInt=No;ge.prototype.visitFloat=No;ge.prototype.visitUtf8=Hp;ge.prototype.visitLargeUtf8=Hp;ge.prototype.visitUtf8View=AA;ge.prototype.visitBinary=Hp;ge.prototype.visitLargeBinary=Hp;ge.prototype.visitBinaryView=AA;ge.prototype.visitFixedSizeBinary=No;ge.prototype.visitDate=No;ge.prototype.visitTimestamp=No;ge.prototype.visitTime=No;ge.prototype.visitDecimal=No;ge.prototype.visitList=$p;ge.prototype.visitLargeList=$p;ge.prototype.visitStruct=iM;ge.prototype.visitUnion=sD;ge.prototype.visitInterval=No;ge.prototype.visitDuration=No;ge.prototype.visitFixedSizeList=$p;ge.prototype.visitMap=$p});var Yp,RA=w(()=>{fn();qm();Ne();Yp=class extends rt{visit(t){return t==null?void 0:super.visit(t)}visitNull({typeId:t}){return{name:lt[t].toLowerCase()}}visitInt({typeId:t,bitWidth:r,isSigned:n}){return{name:lt[t].toLowerCase(),bitWidth:r,isSigned:n}}visitFloat({typeId:t,precision:r}){return{name:lt[t].toLowerCase(),precision:Vt[r]}}visitBinary({typeId:t}){return{name:lt[t].toLowerCase()}}visitLargeBinary({typeId:t}){return{name:lt[t].toLowerCase()}}visitBinaryView({typeId:t}){return{name:lt[t].toLowerCase()}}visitBool({typeId:t}){return{name:lt[t].toLowerCase()}}visitUtf8({typeId:t}){return{name:lt[t].toLowerCase()}}visitLargeUtf8({typeId:t}){return{name:lt[t].toLowerCase()}}visitUtf8View({typeId:t}){return{name:lt[t].toLowerCase()}}visitDecimal({typeId:t,scale:r,precision:n,bitWidth:i}){return{name:lt[t].toLowerCase(),scale:r,precision:n,bitWidth:i}}visitDate({typeId:t,unit:r}){return{name:lt[t].toLowerCase(),unit:Qt[r]}}visitTime({typeId:t,unit:r,bitWidth:n}){return{name:lt[t].toLowerCase(),unit:q[r],bitWidth:n}}visitTimestamp({typeId:t,timezone:r,unit:n}){return{name:lt[t].toLowerCase(),unit:q[n],timezone:r}}visitInterval({typeId:t,unit:r}){return{name:lt[t].toLowerCase(),unit:Lt[r]}}visitDuration({typeId:t,unit:r}){return{name:lt[t].toLocaleLowerCase(),unit:q[r]}}visitList({typeId:t}){return{name:lt[t].toLowerCase()}}visitLargeList({typeId:t}){return{name:lt[t].toLowerCase()}}visitStruct({typeId:t}){return{name:lt[t].toLowerCase()}}visitUnion({typeId:t,mode:r,typeIds:n}){return{name:lt[t].toLowerCase(),mode:qt[r].toUpperCase(),typeIds:[...n]}}visitDictionary(t){return this.visit(t.dictionary)}visitFixedSizeBinary({typeId:t,byteWidth:r}){return{name:lt[t].toLowerCase(),byteWidth:r}}visitFixedSizeList({typeId:t,listSize:r}){return{name:lt[t].toLowerCase(),listSize:r}}visitMap({typeId:t,keysSorted:r}){return{name:lt[t].toLowerCase(),keysSorted:r}}}});function*oM(e){for(let t of e)yield t.reduce((r,n)=>`${r}${("0"+(n&255).toString(16)).slice(-2)}`,"").toUpperCase()}function*Oo(e,t){let r=new Uint32Array(e.buffer,e.byteOffset,e.byteLength/Uint32Array.BYTES_PER_ELEMENT);for(let n=-1,i=r.length/t;++n<i;)yield`${Da.new(r.subarray((n+0)*t,(n+1)*t),!1)}`}function CA(e,t){let n=e.values,i=new DataView(n.buffer,n.byteOffset,n.byteLength),o=n.byteLength/16,s=f=>Array.from(f).map(d=>("0"+(d&255).toString(16)).slice(-2)).join("").toUpperCase(),a=Array.from({length:o},(f,d)=>{let m=d*16,p=i.getInt32(m,!0);return[m,p]}).map(([f,d])=>d>12?{SIZE:d,PREFIX_HEX:s(n.subarray(f+4,f+8)),BUFFER_INDEX:i.getInt32(f+8,!0),OFFSET:i.getInt32(f+12,!0)}:{SIZE:d,INLINED:t(n.subarray(f+4,f+4+d))}),c=[...new Set(a.map(f=>f.BUFFER_INDEX).filter(f=>f!==void 0))],l=c.map(f=>s(e.variadicBuffers[f])),h=new Map(c.map((f,d)=>[f,d]));return{VIEWS:a.map(f=>f.BUFFER_INDEX!==void 0?Object.assign(Object.assign({},f),{BUFFER_INDEX:h.get(f.BUFFER_INDEX)}):f),VARIADIC_DATA_BUFFERS:l}}var Hu,NA=w(()=>{Wm();Ar();fn();Ne();Ne();Va();Ap();te();Hu=class e extends rt{static assemble(...t){let r=new e;return t.map(({schema:n,data:i})=>r.visitMany(n.fields,i.children))}visit({name:t},r){let{length:n}=r,{offset:i,nullCount:o,nullBitmap:s}=r,a=z.isDictionary(r.type)?r.type.indices:r.type,c=Object.assign([],r.buffers,{[xe.VALIDITY]:void 0});return Object.assign({name:t,count:n,VALIDITY:z.isNull(a)||z.isUnion(a)?void 0:o<=0?Array.from({length:n},()=>1):[...new ji(s,i,n,null,dp)]},super.visit(r.clone(a,i,n,0,c)))}visitNull(){return{}}visitBool({values:t,offset:r,length:n}){return{DATA:[...new ji(t,r,n,null,Ol)]}}visitInt(t){return{DATA:t.type.bitWidth<64?[...t.values]:[...Oo(t.values,2)]}}visitFloat(t){return{DATA:[...t.values]}}visitUtf8(t){return{DATA:[...new $([t])],OFFSET:[...t.valueOffsets]}}visitLargeUtf8(t){return{DATA:[...new $([t])],OFFSET:[...Oo(t.valueOffsets,2)]}}visitBinary(t){return{DATA:[...oM(new $([t]))],OFFSET:[...t.valueOffsets]}}visitLargeBinary(t){return{DATA:[...oM(new $([t]))],OFFSET:[...Oo(t.valueOffsets,2)]}}visitBinaryView(t){return CA(t,r=>Array.from(r).map(n=>("0"+(n&255).toString(16)).slice(-2)).join("").toUpperCase())}visitUtf8View(t){return CA(t,r=>Array.from(r).map(n=>String.fromCodePoint(n)).join(""))}visitFixedSizeBinary(t){return{DATA:[...oM(new $([t]))]}}visitDate(t){return{DATA:t.type.unit===Qt.DAY?[...t.values]:[...Oo(t.values,2)]}}visitTimestamp(t){return{DATA:[...Oo(t.values,2)]}}visitTime(t){return{DATA:t.type.unit<q.MICROSECOND?[...t.values]:[...Oo(t.values,2)]}}visitDecimal(t){return{DATA:[...Oo(t.values,4)]}}visitList(t){return{OFFSET:[...t.valueOffsets],children:this.visitMany(t.type.children,t.children)}}visitLargeList(t){return{OFFSET:[...Oo(t.valueOffsets,2)],children:this.visitMany(t.type.children,t.children)}}visitStruct(t){return{children:this.visitMany(t.type.children,t.children)}}visitUnion(t){return{TYPE_ID:[...t.typeIds],OFFSET:t.type.mode===qt.Dense?[...t.valueOffsets]:void 0,children:this.visitMany(t.type.children,t.children)}}visitInterval(t){switch(t.type.unit){case Lt.YEAR_MONTH:return{DATA:[...t.values]};case Lt.DAY_TIME:return{DATA:w_(t.values)};case Lt.MONTH_DAY_NANO:return{DATA:__(t.values,!0)}}}visitDuration(t){return{DATA:[...Oo(t.values,2)]}}visitFixedSizeList(t){return{children:this.visitMany(t.type.children,t.children)}}visitMap(t){return{OFFSET:[...t.valueOffsets],children:this.visitMany(t.type.children,t.children)}}}});function sM(e,t){let r=t;t instanceof ce&&(r=t.batches,e.reset(void 0,t.schema));for(let n of r)e.write(n);return e.finish()}function aM(e,t){return Y(this,void 0,void 0,function*(){var r,n,i,o,s,a,c;try{for(r=!0,n=vn(t);i=yield n.next(),o=i.done,!o;r=!0){c=i.value,r=!1;let l=c;e.write(l)}}catch(l){s={error:l}}finally{try{!r&&!o&&(a=n.return)&&(yield a.call(n))}finally{if(s)throw s.error}}return e.finish()})}function OA({name:e,type:t,nullable:r}){let n=new Yp;return{name:e,nullable:r,type:n.visit(t),children:(t.children||[]).map(i=>OA(i)),dictionary:z.isDictionary(t)?{id:t.id,isOrdered:t.isOrdered,indexType:n.visit(t.indices)}:void 0}}function cD(e,t,r=!1){let[n]=Hu.assemble(new Zt({[t]:e}));return JSON.stringify({id:t,isDelta:r,data:{count:e.length,columns:n}},null,2)}function lD(e){let[t]=Hu.assemble(e);return JSON.stringify({count:e.numRows,columns:t},null,2)}var Ki,Bo,Lo,$u,Kp=w(()=>{an();pc();kp();Ar();te();Ds();Ds();c_();Ne();ju();Fs();PA();RA();NA();Je();Po();Du();us();_l();qp();Gt();Ki=class extends Wa{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}constructor(t){if(super(),this._position=0,this._started=!1,this._compression=null,this._sink=new Jn,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,zr(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1,compressionType:null}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1,t.compressionType!=null){if(this._writeLegacyIpcFormat)throw new Error("Legacy IPC format does not support columnar compression. Use modern IPC format (writeLegacyIpcFormat=false).");if(Object.values(ur).includes(t.compressionType))this._compression=new ja(t.compressionType);else{let r=Object.values(ur).filter(n=>typeof n=="string");throw new Error(`Unsupported compressionType: ${t.compressionType} Available types: ${r.join(", ")}`)}}else this._compression=null}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Tn(t)?t.then(r=>this.writeAll(r)):$n(t)?aM(this,t):sM(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,r=null){return t===this._sink||t instanceof Jn?this._sink=t:(this._sink=new Jn,t&&ZI(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&JI(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!r||!mc(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(t){let r=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof ce&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof Zt&&!(r=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(r&&!mc(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof Zt?t instanceof gc||this._writeRecordBatch(t):t instanceof ce?this.writeAll(t.batches):hi(t)&&this.writeAll(t)}_writeMessage(t,r=8){let n=r-1,i=Nr.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+n&~n,c=a-o-s;return t.headerType===Nt.RecordBatch?this._recordBatchBlocks.push(new Si(a,t.bodyLength,this._position)):t.headerType===Nt.DictionaryBatch&&this._dictionaryBlocks.push(new Si(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let r=nt(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(Nr.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(Vl)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:r,nodes:n,bufferRegions:i,buffers:o,variadicBufferCounts:s}=this._assembleRecordBatch(t),a=new $e(t.numRows,n,i,this._compression,s,t.metadata),c=Nr.from(a,r);return this._writeDictionaries(t)._writeMessage(c)._writeBodyBuffers(o)}_assembleRecordBatch(t){let{byteLength:r,nodes:n,bufferRegions:i,buffers:o,variadicBufferCounts:s}=ge.assemble(t);return this._compression!=null&&({byteLength:r,bufferRegions:i,buffers:o}=this._compressBodyBuffers(o)),{byteLength:r,nodes:n,bufferRegions:i,buffers:o,variadicBufferCounts:s}}_compressBodyBuffers(t){let r=aa.get(this._compression.type);if(!r?.encode||typeof r.encode!="function")throw new Error(`Codec for compression type "${ur[this._compression.type]}" has invalid encode method`);let n=0,i=[],o=[];for(let a of t){let c=nt(a);if(c.length===0){i.push(new Uint8Array(0),new Uint8Array(0)),o.push(new Fe(n,0));continue}let l=r.encode(c),h=l.length<c.length,u=h?l:c,f=h?u.length:-1,d=new hr(new Uint8Array(8));d.writeInt64(0,BigInt(f)),i.push(d.bytes(),new Uint8Array(u));let m=(n+7&-8)-n;n+=m;let p=8+u.length;o.push(new Fe(n,p)),n+=p}let s=(n+7&-8)-n;return n+=s,{byteLength:n,bufferRegions:o,buffers:i}}_writeDictionaryBatch(t,r,n=!1){let{byteLength:i,nodes:o,bufferRegions:s,buffers:a,variadicBufferCounts:c}=this._assembleRecordBatch(new $([t])),l=new $e(t.length,o,s,this._compression,c),h=new Cr(l,r,n),u=Nr.from(h,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let r=this._compression!=null?2:1,n=new Array(r);for(let i=0;i<t.length;i+=r){let o=0;for(let a=-1;++a<r;)n[a]=t[i+a],o+=n[a].byteLength;if(o===0)continue;for(let a of n)this._write(a);let s=(o+7&-8)-o;s>0&&this._writePadding(s)}return this}_writeDictionaries(t){var r,n;for(let[i,o]of t.dictionaries){let s=(r=o?.data)!==null&&r!==void 0?r:[],a=this._seenDictionaries.get(i),c=(n=this._dictionaryDeltaOffsets.get(i))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==s[0])for(let[l,h]of s.entries())this._writeDictionaryBatch(h,i,l>0);else if(c<s.length)for(let l of s.slice(c))this._writeDictionaryBatch(l,i,!0);this._seenDictionaries.set(i,o),this._dictionaryDeltaOffsets.set(i,s.length)}return this}},Bo=class e extends Ki{static writeAll(t,r){let n=new e(r);return Tn(t)?t.then(i=>n.writeAll(i)):$n(t)?aM(n,t):sM(n,t)}},Lo=class e extends Ki{static writeAll(t,r){let n=new e(r);return Tn(t)?t.then(i=>n.writeAll(i)):$n(t)?aM(n,t):sM(n,t)}constructor(t){super(t),this._autoDestroy=!0,this._writeLegacyIpcFormat=!1}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,r,n=!1){if(!n&&this._seenDictionaries.has(r))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,r,n)}_writeFooter(t){let r=Mo.encode(new Mo(t,Xt.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}},$u=class e extends Ki{static writeAll(t){return new e().writeAll(t)}constructor(){super(),this._autoDestroy=!0,this._recordBatches=[],this._recordBatchesWithDictionaries=[]}_writeMessage(){return this}_writeFooter(t){return this}_writeSchema(t){return this._write(`{
|
|
19
|
-
"schema": ${JSON.stringify({fields:t.fields.map(r=>
|
|
20
|
-
`),this._write(
|
|
18
|
+
]`}concat(...t){let r=this.schema,n=this.data.concat(t.flatMap(({data:i})=>i));return new e(r,n.map(i=>new Zt(r,i)))}slice(t,r){let n=this.schema;[t,r]=Nu({length:this.numRows},t,r);let i=Mp(this.data,this._offsets,t,r);return new e(n,i.map(o=>new Zt(n,o)))}getChild(t){return this.getChildAt(this.schema.fields.findIndex(r=>r.name===t))}getChildAt(t){if(t>-1&&t<this.schema.fields.length){let r=this.data.map(n=>n.children[t]);if(r.length===0){let{type:n}=this.schema.fields[t],i=Q({type:n,length:0,nullCount:0});r.push(i._changeLengthAndBackfillNullBitmap(this.numRows))}return new $(r)}return null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=[...this.batches];if(t>-1&&t<this.numCols){r||(r=new $([Q({type:new De,length:this.numRows})]));let o=n.fields.slice(),s=o[t].clone({type:r.type}),a=this.schema.fields.map((c,l)=>this.getChildAt(l));[o[t],a[t]]=[s,r],[n,i]=qp(n,a)}return new e(n,i)}select(t){let r=this.schema.fields.reduce((n,i,o)=>n.set(i.name,o),new Map);return this.selectAt(t.map(n=>r.get(n)).filter(n=>n>-1))}selectAt(t){let r=this.schema.selectAt(t),n=this.batches.map(i=>i.selectAt(t));return new e(r,n)}assign(t){let r=this.schema.fields,[n,i]=t.schema.fields.reduce((a,c,l)=>{let[h,u]=a,f=r.findIndex(d=>d.name===c.name);return~f?u[f]=l:h.push(l),a},[[],[]]),o=this.schema.assign(t.schema),s=[...r.map((a,c)=>[c,i[c]]).map(([a,c])=>c===void 0?this.getChildAt(a):t.getChildAt(c)),...n.map(a=>t.getChildAt(a))].filter(Boolean);return new e(...qp(o,s))}};xA=Symbol.toStringTag;ce[xA]=(e=>(e.schema=null,e.batches=[],e._offsets=new Uint32Array([0]),e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e[SA]=!0,e.isValid=Ll(Lu),e.get=Ll(He.getVisitFn(x.Struct)),e.set=bp(mr.getVisitFn(x.Struct)),e.indexOf=xp(ka.getVisitFn(x.Struct)),"Table"))(ce.prototype);Object.defineProperty(ce,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===ce&&ce.isTable(t)}})});function vA(e,t,r=t.reduce((n,i)=>Math.max(n,i.length),0)){var n;let i=[...e.fields],o=[...t],s=(r+63&-64)>>3;for(let[a,c]of e.fields.entries()){let l=t[a];(!l||l.length!==r)&&(i[a]=c.clone({nullable:!0}),o[a]=(n=l?._changeLengthAndBackfillNullBitmap(r))!==null&&n!==void 0?n:Q({type:c.type,length:r,nullCount:r,nullBitmap:new Uint8Array(s)}))}return[e.assign(i),Q({type:new Yt(i),length:r,children:o})]}function IA(e,t,r=new Map){var n,i;if(((n=e?.length)!==null&&n!==void 0?n:0)>0&&e?.length===t?.length)for(let o=-1,s=e.length;++o<s;){let{type:a}=e[o],c=t[o];for(let l of[c,...((i=c?.dictionary)===null||i===void 0?void 0:i.data)||[]])IA(a.children,l?.children,r);if(z.isDictionary(a)){let{id:l}=a;if(!r.has(l))c?.dictionary&&r.set(l,c.dictionary);else if(r.get(l)!==c.dictionary)throw new Error("Cannot create Schema containing two different dictionaries with the same Id")}}return r}var EA,TA,Zt,gc,Po=w(()=>{Xn();pc();Ar();Rr();te();Ol();Fa();Dn();vp();Ep();TA=Symbol.for("apache-arrow/RecordBatch"),Zt=class e{static isRecordBatch(t){return t?.[TA]===!0}constructor(...t){switch(t.length){case 3:case 2:{if([this.schema]=t,!(this.schema instanceof _t))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");if([,this.data=Q({nullCount:0,type:new Yt(this.schema.fields),children:this.schema.fields.map(r=>Q({type:r.type,nullCount:0}))}),this._metadata=new Map]=t,!(this.data instanceof ut))throw new TypeError("RecordBatch constructor expects a [Schema, Data] pair.");[this.schema,this.data]=vA(this.schema,this.data.children,this.data.length);break}case 1:{let[r]=t,{fields:n,children:i,length:o}=Object.keys(r).reduce((c,l,h)=>(c.children[h]=r[l],c.length=Math.max(c.length,r[l].length),c.fields[h]=Z.new({name:l,type:r[l].type,nullable:!0}),c),{length:0,fields:new Array,children:new Array}),s=new _t(n),a=Q({type:new Yt(n),length:o,children:i,nullCount:0});[this.schema,this.data]=vA(s,a.children,o),this._metadata=new Map;break}default:throw new TypeError("RecordBatch constructor expects an Object mapping names to child Data, or a [Schema, Data] pair.")}}get metadata(){return this._metadata}get dictionaries(){return this._dictionaries||(this._dictionaries=IA(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 He.visit(this.data,t)}at(t){return this.get(Ua(t,this.numRows))}set(t,r){return mr.visit(this.data,t,r)}indexOf(t,r){return ka.visit(this.data,t,r)}[Symbol.iterator](){return Dl.visit(new $([this.data]))}toArray(){return[...this]}concat(...t){return new ce(this.schema,[this,...t])}slice(t,r){let[n]=new $([this.data]).slice(t,r).data;return new e(this.schema,n,this._metadata)}getChild(t){var r;return this.getChildAt((r=this.schema.fields)===null||r===void 0?void 0:r.findIndex(n=>n.name===t))}getChildAt(t){return t>-1&&t<this.schema.fields.length?new $([this.data.children[t]]):null}setChild(t,r){var n;return this.setChildAt((n=this.schema.fields)===null||n===void 0?void 0:n.findIndex(i=>i.name===t),r)}setChildAt(t,r){let n=this.schema,i=this.data;if(t>-1&&t<this.numCols){r||(r=new $([Q({type:new De,length:this.numRows})]));let o=n.fields.slice(),s=i.children.slice(),a=o[t].clone({type:r.type});[o[t],s[t]]=[a,r.data[0]],n=new _t(o,new Map(this.schema.metadata)),i=Q({type:new Yt(o),length:i.length,children:s})}return new e(n,i,this._metadata)}select(t){let r=this.schema.select(t),n=new Yt(r.fields),i=[];for(let o of t){let s=this.schema.fields.findIndex(a=>a.name===o);~s&&(i[s]=this.data.children[s])}return new e(r,Q({type:n,length:this.numRows,children:i}),this._metadata)}selectAt(t){let r=this.schema.selectAt(t),n=t.map(o=>this.data.children[o]).filter(Boolean),i=Q({type:new Yt(r.fields),length:this.numRows,children:n});return new e(r,i,this._metadata)}};EA=Symbol.toStringTag;Zt[EA]=(e=>(e._nullCount=-1,e[Symbol.isConcatSpreadable]=!0,e[TA]=!0,"RecordBatch"))(Zt.prototype);Object.defineProperty(Zt,Symbol.hasInstance,{value:function(t){return Function.prototype[Symbol.hasInstance].call(this,t)||this===Zt&&Zt.isRecordBatch(t)}});gc=class extends Zt{constructor(t,r){let n=t.fields.map(o=>Q({type:o.type})),i=Q({type:new Yt(t.fields),length:0,nullCount:0,children:n});super(t,i,r||new Map)}}});function Wp(e,t=0){for(let r=-1,n=kl.length;++r<n;)if(kl[r]!==e[t+r])return!1;return!0}var rM,nM,AA,PA,sa,yc,wc,jp,eM,kl,ql,iM,RA,Hp=w(()=>{an();Ne();Gt();Ds();us();w_();Je();Fs();Fu();rM=e=>`Expected ${Nt[e]} Message in stream, but was null or length 0.`,nM=e=>`Header pointer of flatbuffer-encoded ${Nt[e]} Message is null or length 0.`,AA=(e,t)=>`Expected to read ${e} metadata bytes, but only read ${t}.`,PA=(e,t)=>`Expected to read ${e} bytes for message body, but only read ${t}.`,sa=class{constructor(t){this.source=t instanceof Qn?t:new Qn(t)}[Symbol.iterator](){return this}next(){let t;return(t=this.readMetadataLength()).done?pe:t.value===-1&&(t=this.readMetadataLength()).done?pe:(t=this.readMetadata(t.value)).done?pe:t}throw(t){return this.source.throw(t)}return(t){return this.source.return(t)}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(rM(t));return r.value}readMessageBody(t){if(t<=0)return new Uint8Array(0);let r=nt(this.source.read(t));if(r.byteLength<t)throw new Error(PA(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()}readSchema(t=!1){let r=Nt.Schema,n=this.readMessage(r),i=n?.header();if(t&&!i)throw new Error(nM(r));return i}readMetadataLength(){let t=this.source.read(jp),r=t&&new hr(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}}readMetadata(t){let r=this.source.read(t);if(!r)return pe;if(r.byteLength<t)throw new Error(AA(t,r.byteLength));return{done:!1,value:Nr.decode(r)}}},yc=class{constructor(t,r){this.source=t instanceof mn?t:Lm(t)?new Us(t,r):new mn(t)}[Symbol.asyncIterator](){return this}next(){return Y(this,void 0,void 0,function*(){let t;return(t=yield this.readMetadataLength()).done?pe:t.value===-1&&(t=yield this.readMetadataLength()).done?pe:(t=yield this.readMetadata(t.value)).done?pe:t})}throw(t){return Y(this,void 0,void 0,function*(){return yield this.source.throw(t)})}return(t){return Y(this,void 0,void 0,function*(){return yield this.source.return(t)})}readMessage(t){return Y(this,void 0,void 0,function*(){let r;if((r=yield this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(rM(t));return r.value})}readMessageBody(t){return Y(this,void 0,void 0,function*(){if(t<=0)return new Uint8Array(0);let r=nt(yield this.source.read(t));if(r.byteLength<t)throw new Error(PA(t,r.byteLength));return r.byteOffset%8===0&&r.byteOffset+r.byteLength<=r.buffer.byteLength?r:r.slice()})}readSchema(){return Y(this,arguments,void 0,function*(t=!1){let r=Nt.Schema,n=yield this.readMessage(r),i=n?.header();if(t&&!i)throw new Error(nM(r));return i})}readMetadataLength(){return Y(this,void 0,void 0,function*(){let t=yield this.source.read(jp),r=t&&new hr(t),n=r?.readInt32(0)||0;return{done:n===0,value:n}})}readMetadata(t){return Y(this,void 0,void 0,function*(){let r=yield this.source.read(t);if(!r)return pe;if(r.byteLength<t)throw new Error(AA(t,r.byteLength));return{done:!1,value:Nr.decode(r)}})}},wc=class extends sa{constructor(t){super(new Uint8Array(0)),this._schema=!1,this._body=[],this._batchIndex=0,this._dictionaryIndex=0,this._json=t instanceof Du?t:new Du(t)}next(){let{_json:t}=this;if(!this._schema)return this._schema=!0,{done:!1,value:Nr.fromJSON(t.schema,Nt.Schema)};if(this._dictionaryIndex<t.dictionaries.length){let r=t.dictionaries[this._dictionaryIndex++];return this._body=r.data.columns,{done:!1,value:Nr.fromJSON(r,Nt.DictionaryBatch)}}if(this._batchIndex<t.batches.length){let r=t.batches[this._batchIndex++];return this._body=r.columns,{done:!1,value:Nr.fromJSON(r,Nt.RecordBatch)}}return this._body=[],pe}readMessageBody(t){return r(this._body);function r(n){return(n||[]).reduce((i,o)=>[...i,...o.VALIDITY&&[o.VALIDITY]||[],...o.TYPE_ID&&[o.TYPE_ID]||[],...o.OFFSET&&[o.OFFSET]||[],...o.DATA&&[o.DATA]||[],...o.VIEWS&&[o.VIEWS]||[],...o.VARIADIC_DATA_BUFFERS||[],...r(o.children)],[])}}readMessage(t){let r;if((r=this.next()).done)return null;if(t!=null&&r.value.headerType!==t)throw new Error(rM(t));return r.value}readSchema(){let t=Nt.Schema,r=this.readMessage(t),n=r?.header();if(!r||!n)throw new Error(nM(t));return n}},jp=4,eM="ARROW1",kl=new Uint8Array(eM.length);for(let e=0;e<eM.length;e+=1)kl[e]=eM.codePointAt(e);ql=kl.length,iM=ql+jp,RA=ql*2+jp});var oM,sM,CA,NA=w(()=>{Ml();oM=class{constructor(){this.LZ4_FRAME_MAGIC=new Uint8Array([4,34,77,24]),this.MIN_HEADER_LENGTH=7}isValidCodecEncode(t){let r=new Uint8Array([1,2,3,4,5,6,7,8]),n=t.encode(r);return this._isValidCompressed(n)}_isValidCompressed(t){return this._hasMinimumLength(t)&&this._hasValidMagicNumber(t)&&this._hasValidVersion(t)}_hasMinimumLength(t){return t.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(t){return this.LZ4_FRAME_MAGIC.every((r,n)=>t[n]===r)}_hasValidVersion(t){return(t[4]&192)>>6===1}},sM=class{constructor(){this.ZSTD_MAGIC=new Uint8Array([40,181,47,253]),this.MIN_HEADER_LENGTH=6}isValidCodecEncode(t){let r=new Uint8Array([1,2,3,4,5,6,7,8]),n=t.encode(r);return this._isValidCompressed(n)}_isValidCompressed(t){return this._hasMinimumLength(t)&&this._hasValidMagicNumber(t)}_hasMinimumLength(t){return t.length>=this.MIN_HEADER_LENGTH}_hasValidMagicNumber(t){return this.ZSTD_MAGIC.every((r,n)=>t[n]===r)}},CA={[ur.LZ4_FRAME]:new oM,[ur.ZSTD]:new sM}});var aM,aa,$p=w(()=>{Ml();NA();aM=class{constructor(){this.registry={}}set(t,r){if(r?.encode&&typeof r.encode=="function"&&!CA[t].isValidCodecEncode(r))throw new Error(`Encoder for ${ur[t]} is not valid.`);this.registry[t]=r}get(t){var r;return((r=this.registry)===null||r===void 0?void 0:r[t])||null}},aa=new aM});function DA(e,t){return t&&typeof t.autoDestroy=="boolean"?t.autoDestroy:e.autoDestroy}function*OA(e){let t=Kr.from(e);try{if(!t.open({autoDestroy:!1}).closed)do yield t;while(!t.reset().open().closed)}finally{t.cancel()}}function BA(e){return Gr(this,arguments,function*(){let r=yield wt(Kr.from(e));try{if(!(yield wt(r.open({autoDestroy:!1}))).closed)do yield yield wt(r);while(!(yield wt(r.reset().open())).closed)}finally{yield wt(r.cancel())}})}function fD(e){return new Ti(new lM(e))}function dD(e){let t=e.peek(ql+7&-8);return t&&t.byteLength>=4?Wp(t)?new Co(new Kp(e.read())):new Ti(new Wl(e)):new Ti(new Wl((function*(){})()))}function mD(e){return Y(this,void 0,void 0,function*(){let t=yield e.peek(ql+7&-8);return t&&t.byteLength>=4?Wp(t)?new Co(new Kp(yield e.read())):new Ro(new Hl(e)):new Ro(new Hl((function(){return Gr(this,arguments,function*(){})})()))})}function pD(e){return Y(this,void 0,void 0,function*(){let{size:t}=yield e.stat(),r=new Us(e,t);return t>=RA&&Wp(yield r.readAt(0,ql+7&-8))?new jl(new cM(r)):new Ro(new Hl(r))})}var Kr,Ti,Ro,Co,jl,Yp,Wl,Hl,Kp,cM,lM,Hu=w(()=>{an();Xn();Ar();te();Ne();m_();au();Ds();Fs();w_();gA();Po();Fu();Hp();us();$p();Vi();Gt();Kr=class e extends Wa{constructor(t){super(),this._impl=t}get closed(){return this._impl.closed}get schema(){return this._impl.schema}get autoDestroy(){return this._impl.autoDestroy}get dictionaries(){return this._impl.dictionaries}get numDictionaries(){return this._impl.numDictionaries}get numRecordBatches(){return this._impl.numRecordBatches}get footer(){return this._impl.isFile()?this._impl.footer:null}isSync(){return this._impl.isSync()}isAsync(){return this._impl.isAsync()}isFile(){return this._impl.isFile()}isStream(){return this._impl.isStream()}next(){return this._impl.next()}throw(t){return this._impl.throw(t)}return(t){return this._impl.return(t)}cancel(){return this._impl.cancel()}reset(t){return this._impl.reset(t),this._DOMStream=void 0,this._nodeStream=void 0,this}open(t){let r=this._impl.open(t);return Tn(r)?r.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 lr.toDOMStream(this.isSync()?{[Symbol.iterator]:()=>this}:{[Symbol.asyncIterator]:()=>this})}toNodeStream(){return lr.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,r){throw new Error('"throughDOM" not available in this environment')}static from(t){return t instanceof e?t:Om(t)?fD(t):Lm(t)?pD(t):Tn(t)?Y(this,void 0,void 0,function*(){return yield e.from(yield t)}):Dm(t)||iu(t)||Um(t)||$n(t)?mD(new mn(t)):dD(new Qn(t))}static readAll(t){return t instanceof e?t.isSync()?OA(t):BA(t):Om(t)||ArrayBuffer.isView(t)||hi(t)||Bm(t)?OA(t):BA(t)}},Ti=class extends Kr{constructor(t){super(t),this._impl=t}readAll(){return[...this]}[Symbol.iterator](){return this._impl[Symbol.iterator]()}[Symbol.asyncIterator](){return Gr(this,arguments,function*(){yield wt(yield*yl(vn(this[Symbol.iterator]())))})}},Ro=class extends Kr{constructor(t){super(t),this._impl=t}readAll(){return Y(this,void 0,void 0,function*(){var t,r,n,i;let o=new Array;try{for(var s=!0,a=vn(this),c;c=yield a.next(),t=c.done,!t;s=!0){i=c.value,s=!1;let l=i;o.push(l)}}catch(l){r={error:l}}finally{try{!s&&!t&&(n=a.return)&&(yield n.call(a))}finally{if(r)throw r.error}}return o})}[Symbol.iterator](){throw new Error("AsyncRecordBatchStreamReader is not Iterable")}[Symbol.asyncIterator](){return this._impl[Symbol.asyncIterator]()}},Co=class extends Ti{constructor(t){super(t),this._impl=t}},jl=class extends Ro{constructor(t){super(t),this._impl=t}},Yp=class{get numDictionaries(){return this._dictionaryIndex}get numRecordBatches(){return this._recordBatchIndex}constructor(t=new Map){this.closed=!1,this.autoDestroy=!0,this._dictionaryIndex=0,this._recordBatchIndex=0,this.dictionaries=t}isSync(){return!1}isAsync(){return!1}isFile(){return!1}isStream(){return!1}reset(t){return this._dictionaryIndex=0,this._recordBatchIndex=0,this.schema=t,this.dictionaries=new Map,this}_loadRecordBatch(t,r,n){let i;if(t.compression!=null){let s=aa.get(t.compression.type);if(s?.decode&&typeof s.decode=="function"){let{decommpressedBody:a,buffers:c}=this._decompressBuffers(t,r,s);i=this._loadCompressedVectors(t,a,this.schema.fields),t=new Ye(t.length,t.nodes,c,null)}else throw new Error("Record batch is compressed but codec not found")}else i=this._loadVectors(t,r,this.schema.fields);let o=Q({type:new Yt(this.schema.fields),length:t.length,children:i});return new Zt(this.schema,o,n)}_loadDictionaryBatch(t,r){let{id:n,isDelta:i}=t,{dictionaries:o,schema:s}=this,a=o.get(n),c=s.dictionaries.get(n),l;if(t.data.compression!=null){let h=aa.get(t.data.compression.type);if(h?.decode&&typeof h.decode=="function"){let{decommpressedBody:u,buffers:f}=this._decompressBuffers(t.data,r,h);l=this._loadCompressedVectors(t.data,u,[c]),t=new Cr(new Ye(t.data.length,t.data.nodes,f,null,t.data.variadicBufferCounts),n,i)}else throw new Error("Dictionary batch is compressed but codec not found")}else l=this._loadVectors(t.data,r,[c]);return(a&&i?a.concat(new $(l)):new $(l)).memoize()}_loadVectors(t,r,n){return new zl(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion,t.variadicBufferCounts).visitMany(n)}_loadCompressedVectors(t,r,n){return new Bp(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion,t.variadicBufferCounts).visitMany(n)}_decompressBuffers(t,r,n){let i=[],o=[],s=0;for(let{offset:a,length:c}of t.buffers){if(c===0){i.push(new Uint8Array(0)),o.push(new Fe(s,0));continue}let l=new hr(r.subarray(a,a+c)),h=It(l.readInt64(0)),u=l.bytes().subarray(8),f=h===-1?u:n.decode(u);i.push(f);let d=(s+7&-8)-s;s+=d,o.push(new Fe(s,f.length)),s+=f.length}return{decommpressedBody:i,buffers:o}}},Wl=class extends Yp{constructor(t,r){super(r),this._reader=Om(t)?new wc(this._handle=t):new sa(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=DA(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):pe}return(t){return!this.closed&&this.autoDestroy&&(this.closed=!0)?this.reset()._reader.return(t):pe}next(){if(this.closed)return pe;let t,{_reader:r}=this;for(;t=this._readNextMessageAndValidate();)if(t.isSchema())this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i,t.metadata)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new gc(this.schema)}):this.return()}_readNextMessageAndValidate(t){return this._reader.readMessage(t)}},Hl=class extends Yp{constructor(t,r){super(r),this._reader=new yc(this._handle=t)}isAsync(){return!0}isStream(){return!0}[Symbol.asyncIterator](){return this}cancel(){return Y(this,void 0,void 0,function*(){!this.closed&&(this.closed=!0)&&(yield this.reset()._reader.return(),this._reader=null,this.dictionaries=null)})}open(t){return Y(this,void 0,void 0,function*(){return this.closed||(this.autoDestroy=DA(this,t),this.schema||(this.schema=yield this._reader.readSchema())||(yield this.cancel())),this})}throw(t){return Y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.throw(t):pe})}return(t){return Y(this,void 0,void 0,function*(){return!this.closed&&this.autoDestroy&&(this.closed=!0)?yield this.reset()._reader.return(t):pe})}next(){return Y(this,void 0,void 0,function*(){if(this.closed)return pe;let t,{_reader:r}=this;for(;t=yield this._readNextMessageAndValidate();)if(t.isSchema())yield this.reset(t.header());else if(t.isRecordBatch()){this._recordBatchIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength);return{done:!1,value:this._loadRecordBatch(n,i,t.metadata)}}else if(t.isDictionaryBatch()){this._dictionaryIndex++;let n=t.header(),i=yield r.readMessageBody(t.bodyLength),o=this._loadDictionaryBatch(n,i);this.dictionaries.set(n.id,o)}return this.schema&&this._recordBatchIndex===0?(this._recordBatchIndex++,{done:!1,value:new gc(this.schema)}):yield this.return()})}_readNextMessageAndValidate(t){return Y(this,void 0,void 0,function*(){return yield this._reader.readMessage(t)})}},Kp=class extends Wl{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,r){super(t instanceof Uu?t:new Uu(t),r)}isSync(){return!0}isFile(){return!0}open(t){if(!this.closed&&!this._footer){this.schema=(this._footer=this._readFooter()).schema;for(let r of this._footer.dictionaryBatches())r&&this._readDictionaryBatch(this._dictionaryIndex++)}return super.open(t)}readRecordBatch(t){var r;if(this.closed)return null;this._footer||this.open();let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(Nt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s,i.metadata)}}return null}_readDictionaryBatch(t){var r;let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&this._handle.seek(n.offset)){let i=this._reader.readMessage(Nt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}}_readFooter(){let{_handle:t}=this,r=t.size-iM,n=t.readInt32(r),i=t.readAt(r-n,n);return Mo.decode(i)}_readNextMessageAndValidate(t){var r;if(this._footer||this.open(),this._footer&&this._recordBatchIndex<this.numRecordBatches){let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(this._recordBatchIndex);if(n&&this._handle.seek(n.offset))return this._reader.readMessage(t)}return null}},cM=class extends Hl{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,...r){let n=typeof r[0]!="number"?r.shift():void 0,i=r[0]instanceof Map?r.shift():void 0;super(t instanceof Us?t:new Us(t,n),i)}isFile(){return!0}isAsync(){return!0}open(t){let r=Object.create(null,{open:{get:()=>super.open}});return Y(this,void 0,void 0,function*(){if(!this.closed&&!this._footer){this.schema=(this._footer=yield this._readFooter()).schema;for(let n of this._footer.dictionaryBatches())n&&(yield this._readDictionaryBatch(this._dictionaryIndex++))}return yield r.open.call(this,t)})}readRecordBatch(t){return Y(this,void 0,void 0,function*(){var r;if(this.closed)return null;this._footer||(yield this.open());let n=(r=this._footer)===null||r===void 0?void 0:r.getRecordBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(Nt.RecordBatch);if(i?.isRecordBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength);return this._loadRecordBatch(o,s,i.metadata)}}return null})}_readDictionaryBatch(t){return Y(this,void 0,void 0,function*(){var r;let n=(r=this._footer)===null||r===void 0?void 0:r.getDictionaryBatch(t);if(n&&(yield this._handle.seek(n.offset))){let i=yield this._reader.readMessage(Nt.DictionaryBatch);if(i?.isDictionaryBatch()){let o=i.header(),s=yield this._reader.readMessageBody(i.bodyLength),a=this._loadDictionaryBatch(o,s);this.dictionaries.set(o.id,a)}}})}_readFooter(){return Y(this,void 0,void 0,function*(){let{_handle:t}=this;t._pending&&(yield t._pending);let r=t.size-iM,n=yield t.readInt32(r),i=yield t.readAt(r-n,n);return Mo.decode(i)})}_readNextMessageAndValidate(t){return Y(this,void 0,void 0,function*(){if(this._footer||(yield this.open()),this._footer&&this._recordBatchIndex<this.numRecordBatches){let r=this._footer.getRecordBatch(this._recordBatchIndex);if(r&&(yield this._handle.seek(r.offset)))return yield this._reader.readMessage(t)}return null})}},lM=class extends Wl{constructor(t,r){super(t,r)}_loadVectors(t,r,n){return new Op(r,t.nodes,t.buffers,this.dictionaries,this.schema.metadataVersion,t.variadicBufferCounts).visitMany(n)}}});function Gn(e){let t=e.byteLength+7&-8;return this.buffers.push(e),this.bufferRegions.push(new Fe(this._byteLength,t)),this._byteLength+=t,this}function gD(e){var t;let{type:r,length:n,typeIds:i,valueOffsets:o}=e;if(Gn.call(this,i),r.mode===jt.Sparse)return hM.call(this,e);if(r.mode===jt.Dense){if(e.offset<=0)return Gn.call(this,o),hM.call(this,e);{let s=new Int32Array(n),a=Object.create(null),c=Object.create(null);for(let l,h,u=-1;++u<n;)(l=i[u])!==void 0&&((h=a[l])===void 0&&(h=a[l]=o[u]),s[u]=o[u]-h,c[l]=((t=c[l])!==null&&t!==void 0?t:0)+1);Gn.call(this,s),this.visitMany(e.children.map((l,h)=>{let u=r.typeIds[h],f=a[u],d=c[u];return l.slice(f,Math.min(n,d))}))}}return this}function yD(e){let t;return e.nullCount>=e.length?Gn.call(this,new Uint8Array(e.length+7>>3)):(t=e.values)instanceof Uint8Array?Gn.call(this,Ga(e.offset,e.length,t)):Gn.call(this,za(e.values))}function No(e){return Gn.call(this,e.values.subarray(0,e.length*e.stride))}function Xp(e){let{length:t,values:r,valueOffsets:n}=e,i=It(n[0]),o=It(n[t]),s=Math.min(o-i,r.byteLength-i);return Gn.call(this,Gm(-i,t+1,n)),Gn.call(this,r.subarray(i,i+s)),this}function FA(e){let{offset:t,length:r,stride:n,values:i,variadicBuffers:o=[]}=e;if(!i)throw new Error("BinaryView data is missing view buffer");let s=t*n,a=s+r*n;Gn.call(this,i.subarray(s,a));for(let c of o)Gn.call(this,c);return this._variadicBufferCounts.push(o.length),this}function Zp(e){let{length:t,valueOffsets:r}=e;if(r){let n=It(r[0]),i=It(r[t]);return Gn.call(this,Gm(-n,t+1,r)),this.visit(e.children[0].slice(n,i-n))}return this.visit(e.children[0])}function hM(e){return this.visitMany(e.type.children.map((t,r)=>e.children[r]).filter(Boolean))[0]}var ge,UA=w(()=>{Ar();fn();Ne();Po();Je();Va();Ds();te();Vi();ge=class e extends rt{static assemble(...t){let r=i=>i.flatMap(o=>Array.isArray(o)?r(o):o instanceof Zt?o.data.children:o.data),n=new e;return n.visitMany(r(t)),n}constructor(){super(),this._byteLength=0,this._nodes=[],this._buffers=[],this._bufferRegions=[],this._variadicBufferCounts=[]}visit(t){if(t instanceof $)return this.visitMany(t.data),this;let{type:r}=t;if(!z.isDictionary(r)){let{length:n}=t;if(n>2147483647)throw new RangeError("Cannot write arrays larger than 2^31 - 1 in length");if(z.isUnion(r))this.nodes.push(new Zn(n,0));else{let{nullCount:i}=t;z.isNull(r)||Gn.call(this,i<=0?new Uint8Array(0):Ga(t.offset,n,t.nullBitmap)),this.nodes.push(new Zn(n,i))}}return super.visit(t)}visitNull(t){return this}visitDictionary(t){return this.visit(t.clone(t.type.indices))}get nodes(){return this._nodes}get buffers(){return this._buffers}get byteLength(){return this._byteLength}get bufferRegions(){return this._bufferRegions}get variadicBufferCounts(){return this._variadicBufferCounts}};ge.prototype.visitBool=yD;ge.prototype.visitInt=No;ge.prototype.visitFloat=No;ge.prototype.visitUtf8=Xp;ge.prototype.visitLargeUtf8=Xp;ge.prototype.visitUtf8View=FA;ge.prototype.visitBinary=Xp;ge.prototype.visitLargeBinary=Xp;ge.prototype.visitBinaryView=FA;ge.prototype.visitFixedSizeBinary=No;ge.prototype.visitDate=No;ge.prototype.visitTimestamp=No;ge.prototype.visitTime=No;ge.prototype.visitDecimal=No;ge.prototype.visitList=Zp;ge.prototype.visitLargeList=Zp;ge.prototype.visitStruct=hM;ge.prototype.visitUnion=gD;ge.prototype.visitInterval=No;ge.prototype.visitDuration=No;ge.prototype.visitFixedSizeList=Zp;ge.prototype.visitMap=Zp});var Jp,GA=w(()=>{fn();$m();Ne();Jp=class extends rt{visit(t){return t==null?void 0:super.visit(t)}visitNull({typeId:t}){return{name:lt[t].toLowerCase()}}visitInt({typeId:t,bitWidth:r,isSigned:n}){return{name:lt[t].toLowerCase(),bitWidth:r,isSigned:n}}visitFloat({typeId:t,precision:r}){return{name:lt[t].toLowerCase(),precision:Vt[r]}}visitBinary({typeId:t}){return{name:lt[t].toLowerCase()}}visitLargeBinary({typeId:t}){return{name:lt[t].toLowerCase()}}visitBinaryView({typeId:t}){return{name:lt[t].toLowerCase()}}visitBool({typeId:t}){return{name:lt[t].toLowerCase()}}visitUtf8({typeId:t}){return{name:lt[t].toLowerCase()}}visitLargeUtf8({typeId:t}){return{name:lt[t].toLowerCase()}}visitUtf8View({typeId:t}){return{name:lt[t].toLowerCase()}}visitDecimal({typeId:t,scale:r,precision:n,bitWidth:i}){return{name:lt[t].toLowerCase(),scale:r,precision:n,bitWidth:i}}visitDate({typeId:t,unit:r}){return{name:lt[t].toLowerCase(),unit:Qt[r]}}visitTime({typeId:t,unit:r,bitWidth:n}){return{name:lt[t].toLowerCase(),unit:q[r],bitWidth:n}}visitTimestamp({typeId:t,timezone:r,unit:n}){return{name:lt[t].toLowerCase(),unit:q[n],timezone:r}}visitInterval({typeId:t,unit:r}){return{name:lt[t].toLowerCase(),unit:Lt[r]}}visitDuration({typeId:t,unit:r}){return{name:lt[t].toLocaleLowerCase(),unit:q[r]}}visitList({typeId:t}){return{name:lt[t].toLowerCase()}}visitLargeList({typeId:t}){return{name:lt[t].toLowerCase()}}visitStruct({typeId:t}){return{name:lt[t].toLowerCase()}}visitUnion({typeId:t,mode:r,typeIds:n}){return{name:lt[t].toLowerCase(),mode:jt[r].toUpperCase(),typeIds:[...n]}}visitDictionary(t){return this.visit(t.dictionary)}visitFixedSizeBinary({typeId:t,byteWidth:r}){return{name:lt[t].toLowerCase(),byteWidth:r}}visitFixedSizeList({typeId:t,listSize:r}){return{name:lt[t].toLowerCase(),listSize:r}}visitMap({typeId:t,keysSorted:r}){return{name:lt[t].toLowerCase(),keysSorted:r}}}});function*uM(e){for(let t of e)yield t.reduce((r,n)=>`${r}${("0"+(n&255).toString(16)).slice(-2)}`,"").toUpperCase()}function*Oo(e,t){let r=new Uint32Array(e.buffer,e.byteOffset,e.byteLength/Uint32Array.BYTES_PER_ELEMENT);for(let n=-1,i=r.length/t;++n<i;)yield`${Da.new(r.subarray((n+0)*t,(n+1)*t),!1)}`}function zA(e,t){let n=e.values,i=new DataView(n.buffer,n.byteOffset,n.byteLength),o=n.byteLength/16,s=f=>Array.from(f).map(d=>("0"+(d&255).toString(16)).slice(-2)).join("").toUpperCase(),a=Array.from({length:o},(f,d)=>{let m=d*16,p=i.getInt32(m,!0);return[m,p]}).map(([f,d])=>d>12?{SIZE:d,PREFIX_HEX:s(n.subarray(f+4,f+8)),BUFFER_INDEX:i.getInt32(f+8,!0),OFFSET:i.getInt32(f+12,!0)}:{SIZE:d,INLINED:t(n.subarray(f+4,f+4+d))}),c=[...new Set(a.map(f=>f.BUFFER_INDEX).filter(f=>f!==void 0))],l=c.map(f=>s(e.variadicBuffers[f])),h=new Map(c.map((f,d)=>[f,d]));return{VIEWS:a.map(f=>f.BUFFER_INDEX!==void 0?Object.assign(Object.assign({},f),{BUFFER_INDEX:h.get(f.BUFFER_INDEX)}):f),VARIADIC_DATA_BUFFERS:l}}var $u,VA=w(()=>{Km();Ar();fn();Ne();Ne();Va();Np();te();$u=class e extends rt{static assemble(...t){let r=new e;return t.map(({schema:n,data:i})=>r.visitMany(n.fields,i.children))}visit({name:t},r){let{length:n}=r,{offset:i,nullCount:o,nullBitmap:s}=r,a=z.isDictionary(r.type)?r.type.indices:r.type,c=Object.assign([],r.buffers,{[xe.VALIDITY]:void 0});return Object.assign({name:t,count:n,VALIDITY:z.isNull(a)||z.isUnion(a)?void 0:o<=0?Array.from({length:n},()=>1):[...new ji(s,i,n,null,yp)]},super.visit(r.clone(a,i,n,0,c)))}visitNull(){return{}}visitBool({values:t,offset:r,length:n}){return{DATA:[...new ji(t,r,n,null,Bl)]}}visitInt(t){return{DATA:t.type.bitWidth<64?[...t.values]:[...Oo(t.values,2)]}}visitFloat(t){return{DATA:[...t.values]}}visitUtf8(t){return{DATA:[...new $([t])],OFFSET:[...t.valueOffsets]}}visitLargeUtf8(t){return{DATA:[...new $([t])],OFFSET:[...Oo(t.valueOffsets,2)]}}visitBinary(t){return{DATA:[...uM(new $([t]))],OFFSET:[...t.valueOffsets]}}visitLargeBinary(t){return{DATA:[...uM(new $([t]))],OFFSET:[...Oo(t.valueOffsets,2)]}}visitBinaryView(t){return zA(t,r=>Array.from(r).map(n=>("0"+(n&255).toString(16)).slice(-2)).join("").toUpperCase())}visitUtf8View(t){return zA(t,r=>Array.from(r).map(n=>String.fromCodePoint(n)).join(""))}visitFixedSizeBinary(t){return{DATA:[...uM(new $([t]))]}}visitDate(t){return{DATA:t.type.unit===Qt.DAY?[...t.values]:[...Oo(t.values,2)]}}visitTimestamp(t){return{DATA:[...Oo(t.values,2)]}}visitTime(t){return{DATA:t.type.unit<q.MICROSECOND?[...t.values]:[...Oo(t.values,2)]}}visitDecimal(t){return{DATA:[...Oo(t.values,4)]}}visitList(t){return{OFFSET:[...t.valueOffsets],children:this.visitMany(t.type.children,t.children)}}visitLargeList(t){return{OFFSET:[...Oo(t.valueOffsets,2)],children:this.visitMany(t.type.children,t.children)}}visitStruct(t){return{children:this.visitMany(t.type.children,t.children)}}visitUnion(t){return{TYPE_ID:[...t.typeIds],OFFSET:t.type.mode===jt.Dense?[...t.valueOffsets]:void 0,children:this.visitMany(t.type.children,t.children)}}visitInterval(t){switch(t.type.unit){case Lt.YEAR_MONTH:return{DATA:[...t.values]};case Lt.DAY_TIME:return{DATA:v_(t.values)};case Lt.MONTH_DAY_NANO:return{DATA:E_(t.values,!0)}}}visitDuration(t){return{DATA:[...Oo(t.values,2)]}}visitFixedSizeList(t){return{children:this.visitMany(t.type.children,t.children)}}visitMap(t){return{OFFSET:[...t.valueOffsets],children:this.visitMany(t.type.children,t.children)}}}});function fM(e,t){let r=t;t instanceof ce&&(r=t.batches,e.reset(void 0,t.schema));for(let n of r)e.write(n);return e.finish()}function dM(e,t){return Y(this,void 0,void 0,function*(){var r,n,i,o,s,a,c;try{for(r=!0,n=vn(t);i=yield n.next(),o=i.done,!o;r=!0){c=i.value,r=!1;let l=c;e.write(l)}}catch(l){s={error:l}}finally{try{!r&&!o&&(a=n.return)&&(yield a.call(n))}finally{if(s)throw s.error}}return e.finish()})}function kA({name:e,type:t,nullable:r}){let n=new Jp;return{name:e,nullable:r,type:n.visit(t),children:(t.children||[]).map(i=>kA(i)),dictionary:z.isDictionary(t)?{id:t.id,isOrdered:t.isOrdered,indexType:n.visit(t.indices)}:void 0}}function wD(e,t,r=!1){let[n]=$u.assemble(new Zt({[t]:e}));return JSON.stringify({id:t,isDelta:r,data:{count:e.length,columns:n}},null,2)}function _D(e){let[t]=$u.assemble(e);return JSON.stringify({count:e.numRows,columns:t},null,2)}var Ki,Bo,Lo,Yu,Qp=w(()=>{an();pc();Hp();Ar();te();Ds();Ds();m_();Ne();Wu();Fs();UA();GA();VA();Je();Po();Fu();us();Ml();$p();Gt();Ki=class extends Wa{static throughNode(t){throw new Error('"throughNode" not available in this environment')}static throughDOM(t,r){throw new Error('"throughDOM" not available in this environment')}constructor(t){if(super(),this._position=0,this._started=!1,this._compression=null,this._sink=new Jn,this._schema=null,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,zr(t)||(t={autoDestroy:!0,writeLegacyIpcFormat:!1,compressionType:null}),this._autoDestroy=typeof t.autoDestroy=="boolean"?t.autoDestroy:!0,this._writeLegacyIpcFormat=typeof t.writeLegacyIpcFormat=="boolean"?t.writeLegacyIpcFormat:!1,t.compressionType!=null){if(this._writeLegacyIpcFormat)throw new Error("Legacy IPC format does not support columnar compression. Use modern IPC format (writeLegacyIpcFormat=false).");if(Object.values(ur).includes(t.compressionType))this._compression=new ja(t.compressionType);else{let r=Object.values(ur).filter(n=>typeof n=="string");throw new Error(`Unsupported compressionType: ${t.compressionType} Available types: ${r.join(", ")}`)}}else this._compression=null}toString(t=!1){return this._sink.toString(t)}toUint8Array(t=!1){return this._sink.toUint8Array(t)}writeAll(t){return Tn(t)?t.then(r=>this.writeAll(r)):$n(t)?dM(this,t):fM(this,t)}get closed(){return this._sink.closed}[Symbol.asyncIterator](){return this._sink[Symbol.asyncIterator]()}toDOMStream(t){return this._sink.toDOMStream(t)}toNodeStream(t){return this._sink.toNodeStream(t)}close(){return this.reset()._sink.close()}abort(t){return this.reset()._sink.abort(t)}finish(){return this._autoDestroy?this.close():this.reset(this._sink,this._schema),this}reset(t=this._sink,r=null){return t===this._sink||t instanceof Jn?this._sink=t:(this._sink=new Jn,t&&s3(t)?this.toDOMStream({type:"bytes"}).pipeTo(t):t&&a3(t)&&this.toNodeStream({objectMode:!1}).pipe(t)),this._started&&this._schema&&this._writeFooter(this._schema),this._started=!1,this._dictionaryBlocks=[],this._recordBatchBlocks=[],this._seenDictionaries=new Map,this._dictionaryDeltaOffsets=new Map,(!r||!mc(r,this._schema))&&(r==null?(this._position=0,this._schema=null):(this._started=!0,this._schema=r,this._writeSchema(r))),this}write(t){let r=null;if(this._sink){if(t==null)return this.finish()&&void 0;if(t instanceof ce&&!(r=t.schema))return this.finish()&&void 0;if(t instanceof Zt&&!(r=t.schema))return this.finish()&&void 0}else throw new Error("RecordBatchWriter is closed");if(r&&!mc(r,this._schema)){if(this._started&&this._autoDestroy)return this.close();this.reset(this._sink,r)}t instanceof Zt?t instanceof gc||this._writeRecordBatch(t):t instanceof ce?this.writeAll(t.batches):hi(t)&&this.writeAll(t)}_writeMessage(t,r=8){let n=r-1,i=Nr.encode(t),o=i.byteLength,s=this._writeLegacyIpcFormat?4:8,a=o+s+n&~n,c=a-o-s;return t.headerType===Nt.RecordBatch?this._recordBatchBlocks.push(new Si(a,t.bodyLength,this._position)):t.headerType===Nt.DictionaryBatch&&this._dictionaryBlocks.push(new Si(a,t.bodyLength,this._position)),this._writeLegacyIpcFormat||this._write(Int32Array.of(-1)),this._write(Int32Array.of(a-s)),o>0&&this._write(i),this._writePadding(c)}_write(t){if(this._started){let r=nt(t);r&&r.byteLength>0&&(this._sink.write(r),this._position+=r.byteLength)}return this}_writeSchema(t){return this._writeMessage(Nr.from(t))}_writeFooter(t){return this._writeLegacyIpcFormat?this._write(Int32Array.of(0)):this._write(Int32Array.of(-1,0))}_writeMagic(){return this._write(kl)}_writePadding(t){return t>0?this._write(new Uint8Array(t)):this}_writeRecordBatch(t){let{byteLength:r,nodes:n,bufferRegions:i,buffers:o,variadicBufferCounts:s}=this._assembleRecordBatch(t),a=new Ye(t.numRows,n,i,this._compression,s,t.metadata),c=Nr.from(a,r);return this._writeDictionaries(t)._writeMessage(c)._writeBodyBuffers(o)}_assembleRecordBatch(t){let{byteLength:r,nodes:n,bufferRegions:i,buffers:o,variadicBufferCounts:s}=ge.assemble(t);return this._compression!=null&&({byteLength:r,bufferRegions:i,buffers:o}=this._compressBodyBuffers(o)),{byteLength:r,nodes:n,bufferRegions:i,buffers:o,variadicBufferCounts:s}}_compressBodyBuffers(t){let r=aa.get(this._compression.type);if(!r?.encode||typeof r.encode!="function")throw new Error(`Codec for compression type "${ur[this._compression.type]}" has invalid encode method`);let n=0,i=[],o=[];for(let a of t){let c=nt(a);if(c.length===0){i.push(new Uint8Array(0),new Uint8Array(0)),o.push(new Fe(n,0));continue}let l=r.encode(c),h=l.length<c.length,u=h?l:c,f=h?u.length:-1,d=new hr(new Uint8Array(8));d.writeInt64(0,BigInt(f)),i.push(d.bytes(),new Uint8Array(u));let m=(n+7&-8)-n;n+=m;let p=8+u.length;o.push(new Fe(n,p)),n+=p}let s=(n+7&-8)-n;return n+=s,{byteLength:n,bufferRegions:o,buffers:i}}_writeDictionaryBatch(t,r,n=!1){let{byteLength:i,nodes:o,bufferRegions:s,buffers:a,variadicBufferCounts:c}=this._assembleRecordBatch(new $([t])),l=new Ye(t.length,o,s,this._compression,c),h=new Cr(l,r,n),u=Nr.from(h,i);return this._writeMessage(u)._writeBodyBuffers(a)}_writeBodyBuffers(t){let r=this._compression!=null?2:1,n=new Array(r);for(let i=0;i<t.length;i+=r){let o=0;for(let a=-1;++a<r;)n[a]=t[i+a],o+=n[a].byteLength;if(o===0)continue;for(let a of n)this._write(a);let s=(o+7&-8)-o;s>0&&this._writePadding(s)}return this}_writeDictionaries(t){var r,n;for(let[i,o]of t.dictionaries){let s=(r=o?.data)!==null&&r!==void 0?r:[],a=this._seenDictionaries.get(i),c=(n=this._dictionaryDeltaOffsets.get(i))!==null&&n!==void 0?n:0;if(!a||a.data[0]!==s[0])for(let[l,h]of s.entries())this._writeDictionaryBatch(h,i,l>0);else if(c<s.length)for(let l of s.slice(c))this._writeDictionaryBatch(l,i,!0);this._seenDictionaries.set(i,o),this._dictionaryDeltaOffsets.set(i,s.length)}return this}},Bo=class e extends Ki{static writeAll(t,r){let n=new e(r);return Tn(t)?t.then(i=>n.writeAll(i)):$n(t)?dM(n,t):fM(n,t)}},Lo=class e extends Ki{static writeAll(t,r){let n=new e(r);return Tn(t)?t.then(i=>n.writeAll(i)):$n(t)?dM(n,t):fM(n,t)}constructor(t){super(t),this._autoDestroy=!0,this._writeLegacyIpcFormat=!1}_writeSchema(t){return this._writeMagic()._writePadding(2)}_writeDictionaryBatch(t,r,n=!1){if(!n&&this._seenDictionaries.has(r))throw new Error("The Arrow File format does not support replacement dictionaries. ");return super._writeDictionaryBatch(t,r,n)}_writeFooter(t){let r=Mo.encode(new Mo(t,Xt.V5,this._recordBatchBlocks,this._dictionaryBlocks));return super._writeFooter(t)._write(r)._write(Int32Array.of(r.byteLength))._writeMagic()}},Yu=class e extends Ki{static writeAll(t){return new e().writeAll(t)}constructor(){super(),this._autoDestroy=!0,this._recordBatches=[],this._recordBatchesWithDictionaries=[]}_writeMessage(){return this}_writeFooter(t){return this}_writeSchema(t){return this._write(`{
|
|
19
|
+
"schema": ${JSON.stringify({fields:t.fields.map(r=>kA(r))},null,2)}`)}_writeDictionaries(t){return t.dictionaries.size>0&&this._recordBatchesWithDictionaries.push(t),this}_writeDictionaryBatch(t,r,n=!1){return this._write(this._dictionaryBlocks.length===0?" ":`,
|
|
20
|
+
`),this._write(wD(t,r,n)),this._dictionaryBlocks.push(new Si(0,0,0)),this}_writeRecordBatch(t){return this._writeDictionaries(t),this._recordBatches.push(t),this}close(){if(this._recordBatchesWithDictionaries.length>0){this._write(`,
|
|
21
21
|
"dictionaries": [
|
|
22
22
|
`);for(let t of this._recordBatchesWithDictionaries)super._writeDictionaries(t);this._write(`
|
|
23
23
|
]`)}if(this._recordBatches.length>0){for(let t=-1,r=this._recordBatches.length;++t<r;)this._write(t===0?`,
|
|
24
24
|
"batches": [
|
|
25
25
|
`:`,
|
|
26
|
-
`),this._write(
|
|
26
|
+
`),this._write(_D(this._recordBatches[t])),this._recordBatchBlocks.push(new Si(0,0,0));this._write(`
|
|
27
27
|
]`)}return this._schema&&this._write(`
|
|
28
|
-
}`),this._recordBatchesWithDictionaries=[],this._recordBatches=[],super.close()}}});function BA(e,t){if($n(e))return uD(e,t);if(hi(e))return hD(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function hD(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,r||(r=e[Symbol.iterator]()))},pull(s){r?o(s,r):s.close()},cancel(){r?.return&&r.return(),r=null}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){let c,l=null,h=s.desiredSize||null;for(;!(l=a.next(n?h:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=nt(l.value))&&(h!=null&&n&&(h=h-c.byteLength+1),l.value=c),s.enqueue(l.value),h!=null&&--h<=0)return;s.close()}}function uD(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return Y(this,void 0,void 0,function*(){yield o(s,r||(r=e[Symbol.asyncIterator]()))})},pull(s){return Y(this,void 0,void 0,function*(){r?yield o(s,r):s.close()})},cancel(){return Y(this,void 0,void 0,function*(){r?.return&&(yield r.return()),r=null})}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){return Y(this,void 0,void 0,function*(){let c,l=null,h=s.desiredSize||null;for(;!(l=yield a.next(n?h:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=nt(l.value))&&(h!=null&&n&&(h=h-c.byteLength+1),l.value=c),s.enqueue(l.value),h!=null&&--h<=0)return;s.close()})}}var LA=w(()=>{an();Je();us()});function UA(e){return new cM(e)}var cM,DA,FA,GA=w(()=>{an();zu();cM=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:r,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,o=YI(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=vi(o),this._getSize=i!=="bytes"?DA:FA;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:s,size:i!=="bytes"?DA:FA}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-r}_maybeFlush(t,r){r!=null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(t,r){this._bufferedSize=0,this._controller=null,r==null?t.close():t.enqueue(r)}},DA=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},FA=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0}});function Xp(e,t){let r=new Jn,n=null,i=new ReadableStream({cancel(){return Y(this,void 0,void 0,function*(){yield r.close()})},start(a){return Y(this,void 0,void 0,function*(){yield s(a,n||(n=yield o()))})},pull(a){return Y(this,void 0,void 0,function*(){n?yield s(a,n):a.close()})}});return{writable:new WritableStream(r,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:i};function o(){return Y(this,void 0,void 0,function*(){return yield(yield Kr.from(r)).open(t)})}function s(a,c){return Y(this,void 0,void 0,function*(){let l=a.desiredSize,h=null;for(;!(h=yield c.next()).done;)if(a.enqueue(h.value),l!=null&&--l<=0)return;a.close()})}}var zA=w(()=>{an();Fs();Wu()});function Zp(e,t){let r=new this(e),n=new mn(r),i=new ReadableStream({cancel(){return Y(this,void 0,void 0,function*(){yield n.cancel()})},pull(s){return Y(this,void 0,void 0,function*(){yield o(s)})},start(s){return Y(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(r,e),readable:i};function o(s){return Y(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield n.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}var VA=w(()=>{an();Fs()});function Jp(e){let t=Kr.from(e);return Tn(t)?t.then(r=>Jp(r)):t.isAsync()?t.readAll().then(r=>new ce(r)):new ce(t.readAll())}function lM(e,t="stream",r=null){let n={compressionType:r};return(t==="stream"?Bo:Lo).writeAll(e,n).toUint8Array(!0)}var kA=w(()=>{pc();us();Wu();Kp()});var hM={};Zr(hM,{isArrowData:()=>r0,isArrowDataType:()=>e0,isArrowField:()=>t0,isArrowRecordBatch:()=>i0,isArrowSchema:()=>Qp,isArrowTable:()=>o0,isArrowVector:()=>n0});function Qp(e){return _t.isSchema(e)}function t0(e){return Z.isField(e)}function e0(e){return z.isDataType(e)}function r0(e){return ut.isData(e)}function n0(e){return $.isVector(e)}function i0(e){return Zt.isRecordBatch(e)}function o0(e){return ce.isTable(e)}var uM=w(()=>{Rr();te();Xn();Ar();Po();pc()});var qA,fM=w(()=>{jm();_l();Ne();Xn();te();pc();Ar();fn();Rr();Ru();hp();me();zu();b_();B_();x_();S_();v_();E_();I_();R_();F_();D_();A_();P_();G_();V_();z_();Cp();Op();Np();C_();N_();T_();O_();L_();U_();Fs();Wu();Kp();kA();qp();kp();Ds();Po();uM();Wm();p_();Va();Pu();Je();Nl();bu();Ap();uM();ju();qA=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},Uw),m_),t_),Gw),iw),Qw),Bw),M_),hM),{compareSchemas:mc,compareFields:uA,compareTypes:Dp})});var _c={};Zr(_c,{AsyncByteQueue:()=>Jn,AsyncByteStream:()=>mn,AsyncMessageReader:()=>yc,AsyncRecordBatchFileReader:()=>ql,AsyncRecordBatchStreamReader:()=>Ro,Binary:()=>ln,BinaryBuilder:()=>So,BinaryView:()=>Mt,BinaryViewBuilder:()=>To,Bool:()=>Er,BoolBuilder:()=>Ha,BufferType:()=>xe,Builder:()=>oe,ByteStream:()=>Qn,CompressionType:()=>ur,Data:()=>ut,DataType:()=>z,DateBuilder:()=>Hi,DateDay:()=>Ms,DateDayBuilder:()=>Gs,DateMillisecond:()=>bs,DateMillisecondBuilder:()=>zs,DateUnit:()=>Qt,Date_:()=>jr,Decimal:()=>hn,DecimalBuilder:()=>Vs,DenseUnion:()=>yo,DenseUnionBuilder:()=>fc,Dictionary:()=>je,DictionaryBuilder:()=>$a,Duration:()=>Wr,DurationBuilder:()=>ti,DurationMicrosecond:()=>Tu,DurationMicrosecondBuilder:()=>Ys,DurationMillisecond:()=>Eu,DurationMillisecondBuilder:()=>$s,DurationNanosecond:()=>Iu,DurationNanosecondBuilder:()=>Ks,DurationSecond:()=>vu,DurationSecondBuilder:()=>Hs,Field:()=>Z,FixedSizeBinary:()=>un,FixedSizeBinaryBuilder:()=>ks,FixedSizeList:()=>_e,FixedSizeListBuilder:()=>Ya,Float:()=>Sr,Float16:()=>wi,Float16Builder:()=>Ka,Float32:()=>kr,Float32Builder:()=>Xa,Float64:()=>On,Float64Builder:()=>Za,FloatBuilder:()=>$i,Int:()=>Se,Int16:()=>Pn,Int16Builder:()=>Qa,Int32:()=>ze,Int32Builder:()=>tc,Int64:()=>Rn,Int64Builder:()=>ec,Int8:()=>An,Int8Builder:()=>Ja,IntBuilder:()=>$r,Interval:()=>Tr,IntervalBuilder:()=>Ei,IntervalDayTime:()=>Ps,IntervalDayTimeBuilder:()=>qs,IntervalMonthDayNano:()=>Su,IntervalMonthDayNanoBuilder:()=>Ws,IntervalUnit:()=>Lt,IntervalYearMonth:()=>Rs,IntervalYearMonthBuilder:()=>js,JSONMessageReader:()=>wc,LargeBinary:()=>_i,LargeBinaryBuilder:()=>vo,LargeList:()=>Bn,LargeListBuilder:()=>ac,LargeUtf8:()=>Mi,LargeUtf8Builder:()=>oa,List:()=>qe,ListBuilder:()=>sc,MapBuilder:()=>cc,MapRow:()=>Kn,Map_:()=>Ir,Message:()=>Nr,MessageHeader:()=>Nt,MessageReader:()=>sa,MetadataVersion:()=>Xt,Null:()=>De,NullBuilder:()=>lc,Precision:()=>Vt,RecordBatch:()=>Zt,RecordBatchFileReader:()=>Co,RecordBatchFileWriter:()=>Lo,RecordBatchJSONWriter:()=>$u,RecordBatchReader:()=>Kr,RecordBatchStreamReader:()=>Ti,RecordBatchStreamWriter:()=>Bo,RecordBatchWriter:()=>Ki,Schema:()=>_t,SparseUnion:()=>Cs,SparseUnionBuilder:()=>uc,Struct:()=>Yt,StructBuilder:()=>hc,StructRow:()=>qi,Table:()=>ce,Time:()=>fr,TimeBuilder:()=>ri,TimeMicrosecond:()=>vs,TimeMicrosecondBuilder:()=>ra,TimeMillisecond:()=>Ss,TimeMillisecondBuilder:()=>ea,TimeNanosecond:()=>Es,TimeNanosecondBuilder:()=>na,TimeSecond:()=>xs,TimeSecondBuilder:()=>ta,TimeUnit:()=>q,Timestamp:()=>dr,TimestampBuilder:()=>ei,TimestampMicrosecond:()=>Is,TimestampMicrosecondBuilder:()=>Js,TimestampMillisecond:()=>ki,TimestampMillisecondBuilder:()=>Zs,TimestampNanosecond:()=>As,TimestampNanosecondBuilder:()=>Qs,TimestampSecond:()=>Ts,TimestampSecondBuilder:()=>Xs,Type:()=>x,Uint16:()=>Nn,Uint16Builder:()=>nc,Uint32:()=>Vr,Uint32Builder:()=>ic,Uint64:()=>yi,Uint64Builder:()=>oc,Uint8:()=>Cn,Uint8Builder:()=>rc,Union:()=>Hr,UnionBuilder:()=>Eo,UnionMode:()=>qt,Utf8:()=>vr,Utf8Builder:()=>ia,Utf8View:()=>qr,Utf8ViewBuilder:()=>dc,Vector:()=>$,Visitor:()=>rt,builderThroughAsyncIterable:()=>H_,builderThroughIterable:()=>Up,compressionRegistry:()=>aa,isArrowData:()=>r0,isArrowDataType:()=>e0,isArrowField:()=>t0,isArrowRecordBatch:()=>i0,isArrowSchema:()=>Qp,isArrowTable:()=>o0,isArrowVector:()=>n0,makeBuilder:()=>vi,makeData:()=>Q,makeTable:()=>$_,makeVector:()=>Wi,tableFromArrays:()=>Y_,tableFromIPC:()=>Jp,tableFromJSON:()=>W_,tableToIPC:()=>lM,util:()=>qA,vectorFromArray:()=>zl});var Hl=w(()=>{su();me();Wu();Kp();LA();GA();zA();VA();fM();fM();lr.toDOMStream=BA;oe.throughDOM=UA;Kr.throughDOM=Xp;Co.throughDOM=Xp;Ti.throughDOM=Xp;Ki.throughDOM=Zp;Lo.throughDOM=Zp;Bo.throughDOM=Zp});function s0(e){return{fields:e.fields.map(t=>Mc(t)),metadata:$A(e.metadata)}}function $A(e){return Object.fromEntries(e)}function dM(e){return e?new Map(Object.entries(e)):new Map}function Mc(e){return{name:e.name,type:YA(e.type),nullable:e.nullable,metadata:$A(e.metadata)}}function Do(e,t){return new Z(e.name,a0(e.type,t),e.nullable,dM(e.metadata))}function YA(e){if(jA(e,"BinaryView"))return"binary-view";if(jA(e,"Utf8View"))return"utf8-view";if(fD(e,"LargeList"))return{type:"large-list",children:[Mc(e.valueField)]};switch(e.constructor){case De:return"null";case ln:return"binary";case un:return{type:"fixed-size-binary",byteWidth:e.byteWidth};case Er:return"bool";case Se:let t=e;return`${t.isSigned?"":"u"}int${t.bitWidth}`;case An:return"int8";case Pn:return"int16";case ze:return"int32";case Rn:return"int64";case Cn:return"uint8";case Nn:return"uint16";case Vr:return"uint32";case yi:return"uint64";case Sr:switch(e.precision){case Vt.HALF:return"float16";case Vt.SINGLE:return"float32";case Vt.DOUBLE:return"float64";default:return"float16"}case wi:return"float16";case kr:return"float32";case On:return"float64";case vr:return"utf8";case hn:let n=e;return{type:"decimal",bitWidth:n.bitWidth,precision:n.precision,scale:n.scale};case jr:return e.unit===Qt.DAY?"date-day":"date-millisecond";case Ms:return"date-day";case bs:return"date-millisecond";case fr:switch(e.unit){case q.SECOND:return"time-second";case q.MILLISECOND:return"time-millisecond";case q.MICROSECOND:return"time-microsecond";case q.NANOSECOND:return"time-nanosecond";default:return"time-second"}case Ss:return"time-millisecond";case xs:return"time-second";case vs:return"time-microsecond";case Es:return"time-nanosecond";case dr:switch(e.unit){case q.SECOND:return"timestamp-second";case q.MILLISECOND:return"timestamp-millisecond";case q.MICROSECOND:return"timestamp-microsecond";case q.NANOSECOND:return"timestamp-nanosecond";default:return"timestamp-second"}case Ts:return"timestamp-second";case ki:return"timestamp-millisecond";case Is:return"timestamp-microsecond";case As:return"timestamp-nanosecond";case Tr:switch(e.unit){case Lt.DAY_TIME:return"interval-daytime";case Lt.YEAR_MONTH:return"interval-yearmonth";default:return"interval-daytime"}case Ps:return"interval-daytime";case Rs:return"interval-yearmonth";case Ir:let c=e;return{type:"map",keysSorted:c.keysSorted,children:c.children.map(p=>Mc(p))};case qe:let h=e.valueField;return{type:"list",children:[Mc(h)]};case _e:let u=e;return{type:"fixed-size-list",listSize:u.listSize,children:[Mc(u.children[0])]};case Yt:return{type:"struct",children:e.children.map(p=>Mc(p))};case Cs:case yo:let d=e;return{type:d instanceof yo?"dense-union":"sparse-union",typeIds:d.typeIds,children:d.children.map(p=>Mc(p)),typeIdToChildIndex:{...d.typeIdToChildIndex}};case je:let m=e;return{type:"dictionary",id:m.id,indices:dD(m.indices),dictionary:YA(m.dictionary),isOrdered:m.isOrdered};default:throw new Error(`arrow type not supported: ${e.constructor.name}`)}}function a0(e,t){if(typeof e=="object")switch(e.type){case"decimal":return new hn(e.scale,e.precision,e.bitWidth);case"map":{let r=e.children.map(n=>Do(n,t));return new Ir(r[0],e.keysSorted)}case"list":{let r=Do(e.children[0],t);return new qe(r)}case"large-list":{let r=Do(e.children[0],t),n=Yu("LargeList");if(!n)throw new Error("LargeList requires an Apache Arrow runtime that exports the LargeList constructor");return new n(r)}case"fixed-size-list":{let r=Do(e.children[0],t);return new _e(e.listSize,r)}case"fixed-size-binary":return new un(e.byteWidth);case"struct":{let r=e.children.map(n=>Do(n,t));return new Yt(r)}case"sparse-union":case"dense-union":{let r=e.children.map(n=>Do(n,t));return e.type==="dense-union"?new yo(e.typeIds,r):new Cs(e.typeIds,r)}case"dictionary":return new je(a0(e.dictionary,t),pD(e.indices),e.id,e.isOrdered);default:throw new Error("array type not supported")}switch(e){case"null":return new De;case"binary":return WA("BinaryView",new ln,t);case"binary-view":return HA("BinaryView");case"bool":return new Er;case"int8":return new An;case"int16":return new Pn;case"int32":return new ze;case"int64":return new Rn;case"uint8":return new Cn;case"uint16":return new Nn;case"uint32":return new Vr;case"uint64":return new yi;case"float16":return new wi;case"float32":return new kr;case"float64":return new On;case"utf8":return WA("Utf8View",new vr,t);case"utf8-view":return HA("Utf8View");case"date-day":return new Ms;case"date-millisecond":return new bs;case"time-second":return new xs;case"time-millisecond":return new Ss;case"time-microsecond":return new vs;case"time-nanosecond":return new Es;case"timestamp-second":return new Ts;case"timestamp-millisecond":return new ki;case"timestamp-microsecond":return new Is;case"timestamp-nanosecond":return new As;case"interval-daytime":return new Ps;case"interval-yearmonth":return new Rs;default:throw new Error("array type not supported")}}function Yu(e){return _c[e]}function jA(e,t){let r=Yu(t);if(r&&e instanceof r)return!0;let n=z;return!!(t==="BinaryView"?n.isBinaryView:n.isUtf8View)?.(e)}function fD(e,t){let r=Yu(t);return!!(r&&e instanceof r)}function WA(e,t,r){let n=r?.viewTypes||"never";if(n==="never")return t;let i=Yu(e);if(i)return new i;if(n==="require")throw new Error(`${e} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`);return t}function HA(e){let t=Yu(e);if(!t)throw new Error(`${e} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`);return new t}function dD(e){if(e instanceof Se){let r=`${e.isSigned?"int":"uint"}${e.bitWidth}`;if(mD(r))return r}switch(e.constructor){case An:return"int8";case Pn:return"int16";case ze:return"int32";case Cn:return"uint8";case Nn:return"uint16";case Vr:return"uint32";default:throw new Error(`arrow dictionary index type not supported: ${e.constructor.name}`)}}function mD(e){return["int8","int16","int32","uint8","uint16","uint32"].includes(e)}function pD(e){switch(e){case"int8":return new An;case"int16":return new Pn;case"int32":return new ze;case"uint8":return new Cn;case"uint16":return new Nn;case"uint32":return new Vr;default:throw new Error(`schema dictionary index type not supported: ${e}`)}}var c0=w(()=>{"use strict";Hl()});function mM(e){let t=e?.POSITION;if(!t||!("value"in t)||!t.value.length)return null;let r=1/0,n=1/0,i=1/0,o=-1/0,s=-1/0,a=-1/0,c=t.value,l=c.length;for(let h=0;h<l;h+=3){let u=c[h],f=c[h+1],d=c[h+2];r=u<r?u:r,n=f<n?f:n,i=d<i?d:i,o=u>o?u:o,s=f>s?f:s,a=d>a?d:a}return[[r,n,i],[o,s,a]]}var KA=w(()=>{"use strict"});function pM(e){let t=Nf();return new t(e)}function ca(e){return!!(Rc&&e instanceof Rc)}function gM(e,t,r){ca(e)?e[t]=r:e[t]=XA(r)}function yM(e,t){return ca(e)?e[t]:gD(e[t])}function Ku(e){return ca(e)?new Uint16Array(e.buffer,e.byteOffset,e.length):e}function XA(e){if(!Number.isFinite(e))return e===1/0?31744:e===-1/0?64512:32256;let t=e<0||Object.is(e,-0)?32768:0,r=Math.abs(e);if(r===0)return t;if(r>=65520)return t|31744;if(r>=65504)return t|31743;let n=Math.floor(Math.log2(r));if(n<-14)return t|Math.round(r/2**-24);let i=n+15,o=Math.round((r/2**n-1)*1024);return o===1024?t|i+1<<10:t|i<<10|o}function gD(e){let t=e&32768?-1:1,r=e>>10&31,n=e&1023;return r===0?t*n*2**-24:r===31?n?NaN:t*(1/0):t*(1+n/1024)*2**(r-15)}var ZA=w(()=>{"use strict";jt()});var l0,wM,JA=w(()=>{"use strict";Hl();l0=new _t([new Z("POSITION",new _e(3,new Z("value",new kr,!1)),!1)]),wM=new _t([...l0.fields,new Z("indices",new qe(new Z("item",new Vr,!1)),!0)])});var Xu=w(()=>{"use strict";ZA();JA()});function QA(e){return e.type instanceof _e?e.type.listSize:1}function _M(e,t,r){let n=yD(e,t,r);return new $([n])}function yD(e,t,r){let n=wD(e,t,r),i=n.children[0].type,o=r==="float16"&&ca(e)?Ku(e):e,s={[xe.DATA]:o},a=new ut(i,0,o.length,0,s);return new ut(n,0,o.length/t,0,void 0,[a])}function wD(e,t,r){let n=r||WI(e).type,i=a0(n);return new _e(t,new Z("value",i,!1))}var MM=w(()=>{"use strict";Xu();Hl();HI();c0()});function bM(e,t){switch(t){case"columnar-table":return _D(e);case"arrow-table":return MD(e);default:throw new Error(t)}}function _D(e){let t={},r=rP(e);for(let[n,i]of Object.entries(e.attributes))t[n]=i.value;return{shape:"columnar-table",schema:e.schema,data:t,topology:e.topology,indices:r?e.indices:void 0}}function MD(e,t){return eP(e.attributes,{schema:e.schema,topology:e.topology,mode:e.mode,boundingBox:e.header?.boundingBox,indices:rP(e)?e.indices:void 0})}function eP(e,t={}){let r=[],n={},i=xD(e);for(let c of i){let l=e[c],{value:h,size:u=1}=l,f=bD(h,u,l.componentType);if(n[c]=f,r.push(SD(t.schema,c,f,l.componentType)),c==="POSITION"&&t.indices?.value?.length){let d=wM.fields.find(m=>m.name==="indices");n.indices=ED(t.indices.value,f.length,d.type),r.push(d)}}let o=new _t(r,TD(t)),s=n[i[0]]?.length===0?new ce(o):new ce(o,n);return{shape:"arrow-table",schema:s0(s.schema),data:s,topology:t.topology||"point-list",indices:t.indices}}function bD(e,t,r){if(r==="float16"){let n=ca(e)?Ku(e):e;if(t===1){let i=new ut(new wi,0,n.length,0,{[xe.DATA]:n});return new $([i])}return _M(e,t,r)}return t===1?Wi(e):_M(e,t)}function xD(e){let t=Object.keys(e),r=tP.filter(i=>i in e),n=t.filter(i=>!tP.includes(i));return[...r,...n]}function rP(e){return!!e.indices?.value?.length}function SD(e,t,r,n){if(t==="POSITION"&&vD(r)){let o=l0.fields[0],s=e?.fields.find(c=>c.name===t);if(!s?.metadata)return o;let a=new Map(o.metadata);for(let[c,l]of Object.entries(s.metadata))a.set(c,l);return new Z(o.name,o.type,o.nullable,a)}let i=e?.fields.find(o=>o.name===t);if(n==="float16"){let o=new Map(Object.entries(i?.metadata||{}));return o.set("componentType","float16"),new Z(t,r.type,!1,o)}if(i&&i.type.toString()!==r.type.toString()){let o=Do(i);return new Z(t,r.type,o.nullable,o.metadata)}return i?Do(i):new Z(t,r.type,!1)}function vD(e){return e.type instanceof _e&&e.type.listSize===3&&e.type.children[0].type instanceof kr}function ED(e,t,r){let n=r,i=e instanceof Uint32Array?e:Uint32Array.from(e),o=new Int32Array(t+1);t>0&&o.fill(i.length,1);let s=new Uint8Array(Math.ceil(t/8));t>0&&(s[0]=1);let a=new ut(n.children[0].type,0,i.length,0,{[xe.DATA]:i}),c=new ut(n,0,t,Math.max(0,t-1),{[xe.OFFSET]:o,[xe.VALIDITY]:s},[a]);return new $([c])}function TD(e){let t={...e.schema?.metadata};return e.topology&&(t.topology||=e.topology),Number.isFinite(e.mode)&&(t.mode||=String(e.mode)),e.boundingBox&&(t.boundingBox||=JSON.stringify(e.boundingBox)),dM(t)}var tP,nP=w(()=>{"use strict";Xu();Xu();Hl();MM();c0();tP=["POSITION"]});function iP(e){if(e.shape==="arrow-table")return ID(e);throw new Error(e.shape)}function ID(e){let t=e.data,r=s0(t.schema),n=r.fields,i={},o=[];for(let h of n){let{name:u}=h;if(u==="indices")continue;let f=t.getChild(u),d=QA(f),m=ND(f,d),p=PD(h.metadata),g=p.componentType==="float16"?OD(m):m,y=o.find(_=>_.data.length===f.data.length&&i[_.name].value.constructor===g.constructor&&_.data.every((b,M)=>oP(b,f.data[M])));i[u]={value:y?i[y.name].value:g,size:d,...p},y||o.push({name:u,data:f.data})}CD(r);let s=r.metadata.topology,a=BD(r),c=LD(t),l=i.POSITION?.transform?.type==="quantization"?AD(r)||mM(i):mM(i);return{schema:r,attributes:i,topology:s,mode:a,indices:c,header:{vertexCount:t.numRows,boundingBox:l??void 0}}}function AD(e){let t=e.metadata?.boundingBox;if(!t)return null;try{let r=JSON.parse(t);if(Array.isArray(r)&&r.length===2&&r.every(n=>Array.isArray(n)&&n.length===3&&n.every(i=>typeof i=="number")))return r}catch{}return null}function PD(e={}){let t={};if(e.byteOffset!==void 0&&(t.byteOffset=Number(e.byteOffset)),e.byteStride!==void 0&&(t.byteStride=Number(e.byteStride)),e.normalized!==void 0&&(t.normalized=e.normalized==="true"),e.componentType==="float16"&&(t.componentType="float16"),e["loaders.gl.transform"])try{let r=JSON.parse(e["loaders.gl.transform"]);RD(r)&&(t.transform=r)}catch{}return t}function RD(e){if(!e||typeof e!="object"||!("type"in e))return!1;let t=e;return t.type==="octahedron"?Number.isInteger(t.bits)&&t.bits>=1&&t.bits<=30:t.type==="quantization"&&Number.isInteger(t.bits)&&t.bits>=1&&t.bits<=30&&Array.isArray(t.origin)&&t.origin.every(r=>typeof r=="number")&&typeof t.range=="number"}function CD(e){e.metadata||={},e.metadata.topology||="point-list",e.metadata.mode||="0"}function ND(e,t){if(!(e.type instanceof _e))return e.toArray();let n=e.data[0].children[0].values.constructor,i=new n(e.length*t),o=0;for(let s of e.data){let a=s.children[0],c=s.length*t,l=a.offset||s.offset*t,h=l+c<=a.values.length?l:0,u=a.values.subarray(h,h+c);i.set(u,o),o+=c}return i}function OD(e){let t=pM(e.length);for(let r=0;r<e.length;r++)gM(t,r,yM(e,r));return t}function BD(e){let t=Number(e.metadata?.mode);return Number.isFinite(t)?t:0}function LD(e){let t=e.getChild("indices");if(!t?.isValid(0))return;let r=t.data[0],n=r.valueOffsets,i=n[r.offset],o=n[r.offset+1];return{value:r.children[0].values.subarray(i,o),size:1}}function oP(e,t){let r=Object.values(t.buffers);return e.type.toString()===t.type.toString()&&e.offset===t.offset&&e.length===t.length&&e.nullCount===t.nullCount&&e.dictionary===t.dictionary&&Object.values(e.buffers).every((n,i)=>{let o=r[i];return n===o||!!(n&&o&&n.buffer===o.buffer&&n.byteOffset===o.byteOffset&&n.byteLength===o.byteLength)})&&e.children.length===t.children.length&&e.children.every((n,i)=>oP(n,t.children[i]))}var sP=w(()=>{"use strict";Xu();Hl();MM();c0();KA()});function aP(e){return[e.value.constructor.name,e.value.byteOffset,e.value.byteLength,e.size,e.byteOffset??0,e.byteStride||e.size*e.value.BYTES_PER_ELEMENT].join(":")}var Zu,cP=w(()=>{"use strict";sP();Zu=class{ready;sourcePointCount=0;get pointCount(){return this.sourcePointCount}controller=new AbortController;options;signal;mesh=null;nodes=new Map;indexBytes=0;pointByteLength=0;constructor(t,r={}){this.options={nodePointLimit:r.nodePointLimit??5e4,maximumDepth:r.maximumDepth??16,maxInputBytes:r.maxInputBytes??512*1024*1024,maxIndexBytes:r.maxIndexBytes??128*1024*1024,maxTileBytes:r.maxTileBytes??64*1024*1024,maxNodes:r.maxNodes??1e5};for(let[n,i]of Object.entries(this.options))if(!Number.isSafeInteger(i)||i<(n==="maximumDepth"?0:1))throw new Error(`PointCloudTiler: invalid ${n}`);if(this.options.maximumDepth>24||this.options.nodePointLimit>1e6)throw new Error("PointCloudTiler: maximumDepth must be <= 24 and nodePointLimit <= 1000000");this.signal=r.signal?AbortSignal.any([r.signal,this.controller.signal]):this.controller.signal,this.ready=this.initialize(t).catch(n=>{throw this.close(),n})}async getRootNode(){return await this.ready,this.getNode("r").node}async getNodeMetadata(t){return await this.ready,this.getNode(t).node}async getChildNodes(t){await this.ready;let r=this.getNode(t);return r.childrenPromise||(r.childrenPromise=this.splitNode(r)),r.childrenPromise}async splitNode(t){let r=t.node.id;if(t.children)return t.children;let n=Array.from({length:8},()=>0),i=t.node.bounds[0].map((a,c)=>a+(t.node.bounds[1][c]-a)/2);for(let a=0;a<t.remaining.length;a++)a%65536===0&&await this.checkpoint(),n[this.getOctant(t.remaining[a],i)]++;if(this.nodes.size+n.filter(a=>a>0).length>this.options.maxNodes)throw new Error("PointCloudTiler: node budget exceeded");let o=[],s=[];try{for(let c of n)s.push(this.allocateRows(c));let a=new Uint32Array(8);for(let c=0;c<t.remaining.length;c++){c%65536===0&&await this.checkpoint();let l=t.remaining[c],h=this.getOctant(l,i);s[h][a[h]++]=l}for(let c=0;c<8;c++){if(!s[c].length)continue;let l=t.node.bounds.map(u=>[...u]);for(let u=0;u<3;u++)l[c&4>>u?0:1][u]=i[u];let h=await this.createNode(`${r}${c}`,l,s[c]);s[c]=new Uint32Array(0),o.push(h.node)}return this.releaseRows(t.remaining),t.remaining=new Uint32Array(0),t.children=Object.freeze(o),t.children}catch(a){throw this.close(),a}}async getTileMesh(t){await this.ready;let r=this.getNode(t);if(r.rows.length*this.pointByteLength>this.options.maxTileBytes)throw new Error("PointCloudTiler: tile byte budget exceeded");let i={},o=new Map;for(let[s,a]of Object.entries(this.mesh.attributes)){let c=aP(a),l=o.get(a.value.buffer)?.get(c);if(l){i[s]={...a,value:l,byteOffset:0,byteStride:0};continue}let h=a.value.constructor,u=new h(r.rows.length*a.size),f=new Uint8Array(a.value.buffer,a.value.byteOffset,a.value.byteLength),d=new Uint8Array(u.buffer,u.byteOffset,u.byteLength),m=a.value.BYTES_PER_ELEMENT,p=a.size*m,g=a.byteStride||p;for(let _=0;_<r.rows.length;_++){_%65536===0&&await this.checkpoint();let b=(a.byteOffset||0)+r.rows[_]*g;d.set(f.subarray(b,b+p),_*p)}let y=o.get(a.value.buffer)??new Map;y.set(c,u),o.set(a.value.buffer,y),i[s]={...a,value:u,byteOffset:0,byteStride:0}}return{...this.mesh,attributes:i,topology:"point-list",mode:0,indices:void 0,header:{vertexCount:r.rows.length,boundingBox:r.node.bounds.map(s=>[...s])},loaderData:{...this.mesh.loaderData,pointCloudTileId:t}}}close(){this.controller.abort(new Error("PointCloudTiler: closed")),this.mesh=null,this.nodes.clear(),this.indexBytes=0}async initialize(t){if(this.signal.throwIfAborted(),"shape"in t){let f=new Set,d=0,m=p=>{if(p.nullCount)throw new Error("PointCloudTiler: null point attributes require an explicit mapping");for(let g of Object.values(p.buffers))g&&!f.has(g.buffer)&&(f.add(g.buffer),d+=g.buffer.byteLength);for(let g of p.children)m(g);if(p.dictionary)for(let g of p.dictionary.data)m(g)};for(let p of t.data.batches)m(p.data);if(d>this.options.maxInputBytes)throw new Error("PointCloudTiler: input byte budget exceeded");for(let p of t.data.schema.fields)if(t.data.getChild(p.name)?.nullCount)throw new Error("PointCloudTiler: null point attributes require an explicit mapping")}let r="shape"in t?iP(t):t;if(r.topology!=="point-list"||r.indices)throw new Error("PointCloudTiler: unindexed point-list input required");let n=r.attributes.POSITION;if(!n||n.size!==3||!(n.value instanceof Float32Array||n.value instanceof Float64Array)||n.transform||n.normalized||n.componentType==="float16")throw new Error("PointCloudTiler: POSITION requires decoded floating-point XYZ");if(!r.header&&(n.byteOffset||n.byteStride))throw new Error("PointCloudTiler: strided POSITION requires vertexCount");let i=r.header?.vertexCount??n.value.length/3;if(!Number.isSafeInteger(i)||i<0||i>4294967295)throw new Error("PointCloudTiler: invalid point count");let o=0,s=new Map,a=new Set;for(let f of Object.values(r.attributes)){this.validateAttribute(f,i),a.has(f.value.buffer)||(a.add(f.value.buffer),o+=f.value.buffer.byteLength);let d=s.get(f.value.buffer)??new Set,m=aP(f);d.has(m)||(this.pointByteLength+=f.size*f.value.BYTES_PER_ELEMENT,d.add(m),s.set(f.value.buffer,d))}if(o>this.options.maxInputBytes)throw new Error("PointCloudTiler: input byte budget exceeded");this.mesh=r,this.sourcePointCount=i;let c=this.allocateRows(i),l=[1/0,1/0,1/0],h=[-1/0,-1/0,-1/0];for(let f=0;f<i;f++){f%65536===0&&await this.checkpoint(),c[f]=f;for(let d=0;d<3;d++){let m=this.getCoordinate(f,d);if(!Number.isFinite(m))throw new Error("PointCloudTiler: nonfinite position");l[d]=Math.min(l[d],m),h[d]=Math.max(h[d],m)}}i||(l.fill(0),h.fill(0));let u=Math.max(...l.map((f,d)=>h[d]-f));if(!Number.isFinite(u))throw new Error("PointCloudTiler: coordinate extent overflow");for(let f=0;f<3;f++)h[f]=l[f]+u;if(!h.every(Number.isFinite)||!Number.isFinite(Math.hypot(u,u,u)))throw new Error("PointCloudTiler: coordinate extent overflow");await this.createNode("r",[l,h],c),this.signal.throwIfAborted()}async createNode(t,r,n){let i=t.length-1>=this.options.maximumDepth||r[0].every((c,l)=>c===r[1][l])||n.length<=this.options.nodePointLimit,o=n,s=new Uint32Array(0);if(!i){let c=Math.ceil(Math.cbrt(this.options.nodePointLimit)),l=new Set,h=this.allocateRows(Math.min(n.length,this.options.nodePointLimit)),u=this.allocateRows(n.length),f=0,d=0;for(let m=0;m<n.length;m++){m%65536===0&&await this.checkpoint();let p=n[m],g=0;for(let y=0;y<3;y++){let _=Math.min(c-1,Math.floor((this.getCoordinate(p,y)-r[0][y])/(r[1][y]-r[0][y])*c));g=g*c+_}f<h.length&&!l.has(g)?(l.add(g),h[f++]=p):u[d++]=p}o=h.subarray(0,f),s=u.subarray(0,d),this.releaseRows(n)}let a={node:{id:t,level:t.length-1,pointCount:o.length,bounds:r,geometricError:s.length?Math.hypot(...r[0].map((c,l)=>r[1][l]-c)):0},rows:o,remaining:s};if(Object.freeze(r[0]),Object.freeze(r[1]),Object.freeze(r),Object.freeze(a.node),this.signal.throwIfAborted(),this.nodes.size>=this.options.maxNodes)throw new Error("PointCloudTiler: node budget exceeded");return this.nodes.set(t,a),a}getCoordinate(t,r){let n=this.mesh.attributes.POSITION;return Number(n.value[(n.byteOffset||0)/n.value.BYTES_PER_ELEMENT+t*(n.byteStride||3*n.value.BYTES_PER_ELEMENT)/n.value.BYTES_PER_ELEMENT+r])}validateAttribute(t,r){let n=t.value?.BYTES_PER_ELEMENT,i=t.byteOffset??0,o=t.byteStride||t.size*n;if(!n||!Number.isSafeInteger(t.size)||t.size<1||!Number.isSafeInteger(i)||i<0||i%n||!Number.isSafeInteger(o)||o<t.size*n||o%n||r&&i+(r-1)*o+t.size*n>t.value.byteLength)throw new Error("PointCloudTiler: invalid attribute layout")}allocateRows(t){if(t*4>this.options.maxIndexBytes-this.indexBytes)throw new Error("PointCloudTiler: index byte budget exceeded");let r=new Uint32Array(t);return this.indexBytes+=r.byteLength,r}releaseRows(t){this.indexBytes-=t.buffer.byteLength}getNode(t){this.signal.throwIfAborted();let r=this.nodes.get(t);if(!r)throw new Error(`PointCloudTiler: unknown tile ${t}`);return r}getOctant(t,r){let n=0;for(let i=0;i<3;i++)this.getCoordinate(t,i)>=r[i]&&(n|=4>>i);return n}async checkpoint(){this.signal.throwIfAborted(),await new Promise(t=>setTimeout(t,0)),this.signal.throwIfAborted()}}});var lP=w(()=>{"use strict";nP();cP()});var h0,hP=w(()=>{"use strict";co();lP();h0=class extends Oh{ready;isReady=!1;tiler;constructor(t,r={},n){super(null,r,{pointCloudTiler:{}},n),this.tiler=new Zu(t,r.pointCloudTiler),this.ready=this.tiler.getRootNode().then(()=>{this.isReady=!0}),this.ready.catch(()=>{})}async initialize(){await this.ready,await this.tiler.getRootNode()}async getMetadata(){return await this.initialize(),{pointCount:this.tiler.pointCount,refinement:"ADD"}}async getRootTile(){return this.createHeader(await this.tiler.getRootNode())}async getChildren(t){return(await this.tiler.getChildNodes(t.id)).map(r=>this.createHeader(r))}async loadTileContent(t){let r=await this.tiler.getTileMesh(t.id);return r.header.vertexCount?{data:bM(r,"arrow-table"),pointCount:r.header.vertexCount,cartographicOrigin:[0,0,0],coordinateSystem:"cartesian",spatialReference:this.options.pointCloudTiler.spatialReference,spatialBoundingVolume:this.createHeader(await this.tiler.getNodeMetadata(t.id)).boundingVolume}:null}close(){this.tiler.close(),this.isReady=!1}createHeader(t){let r=t.bounds[0].map((i,o)=>i+(t.bounds[1][o]-i)/2),n={cartographicBounds:t.bounds.map(i=>[...i]),center:r,radius:Math.hypot(...r.map((i,o)=>t.bounds[1][o]-i)),coordinateFrame:"cartesian"};return{id:t.id,level:t.level,pointCount:t.pointCount,geometricError:t.geometricError,boundingVolume:n,spatialBoundingVolume:n}}}});var uP={};Zr(uP,{PointCloudTileSourceLoaderWithParser:()=>FD});var Hut,$ut,DD,FD,fP=w(()=>{"use strict";hP();xM();({preload:Hut,createDataSource:$ut,...DD}=u0),FD={...DD,createDataSource(e,t={},r){if(typeof e=="string"||e instanceof Blob)throw new Error("PointCloudTileSourceLoader requires decoded Mesh/Arrow input");return new h0(e,t,r)}}});async function GD(){let{PointCloudTileSourceLoaderWithParser:e}=await Promise.resolve().then(()=>(fP(),uP));return e}var UD,u0,xM=w(()=>{"use strict";UD="5.0.0-beta.4";u0={dataType:null,batchType:null,name:"PointCloudTiler",id:"point-cloud-tiler",module:"tiles",version:UD,extensions:[],mimeTypes:[],type:"point-cloud",fromUrl:!1,fromBlob:!1,testURL:()=>!1,options:{pointCloudTiler:{}},defaultOptions:{pointCloudTiler:{}},preload:GD,createDataSource(e,t={},r){throw new Error("PointCloudTileSourceLoader requires preload() or @loaders.gl/tiles-3d/point-cloud-tile-source-loader")}}});var Ju={};Zr(Ju,{I3SSource:()=>Tm,I3SSpatialTransformer:()=>ml,IndexedArchiveTilesetSource:()=>Dd,LOD_METRIC_TYPE:()=>Wc,PointCloudTile:()=>pl,PointCloudTileSourceLoader:()=>u0,PointCloudTileset:()=>Am,SpatialCoordinateTransformer:()=>Hn,TILESET_TYPE:()=>nr,TILE_CONTENT_STATE:()=>ir,TILE_REFINEMENT:()=>Ge,TILE_TYPE:()=>Oi,Tile3D:()=>bn,Tiles3DSource:()=>xm,Tiles3DSpatialTransformer:()=>ls,Tileset3D:()=>Nd,TilesetCache:()=>jc,TilesetTraverser:()=>Bi,applyTilesetSpatialOptions:()=>va,calculateTransformProps:()=>Ed,convertS2BoundingVolumeToOBB:()=>Mm,createBoundingVolume:()=>Yc,createImplicitSubtreeReference:()=>Yy,createTilesetSpatialReference:()=>Mn,get3DTilesSpatialReference:()=>kd,getFrameState:()=>Td,getGeoidModel:()=>ym,getI3SSpatialReference:()=>Vd,getLodStatus:()=>Gd,getSpatialCoordinateFrame:()=>_n,getTileset3DTraversalSnapshot:()=>rv,isTileset3DSource:()=>Rd,markTilesetSpatialReferenceTransformed:()=>$c,materializeImplicitSubtree:()=>bm,registerGeoidModel:()=>Vy,registerGeoidModelFromPgm:()=>uI,registerSpatialCrs:()=>lI,registerSpatialDatumGrid:()=>hI,replaceImplicitUrlTemplate:()=>ru,traverseTilesetContents:()=>nv});uf(Ju,_P(AM(),1));jt();Dr();id();co();var Sd=class{item;previous;next;constructor(t,r,n){this.item=t,this.previous=r,this.next=n}};var vd=class{head=null;tail=null;_length=0;get length(){return this._length}add(t){let r=new Sd(t,this.tail,null);return this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),++this._length,r}remove(t){t&&(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,r){t!==r&&(this.remove(r),this._insert(t,r))}_insert(t,r){let n=t.next;t.next=r,this.tail===t?this.tail=r:n.previous=r,r.next=n,r.previous=t,++this._length}};var jc=class{_list;_sentinel;_trimTiles;constructor(){this._list=new vd,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){let r=t._cacheNode;r&&this._list.splice(this._sentinel,r)}add(t,r,n){r._cacheNode||(r._cacheNode=this._list.add(r),n&&n(t,r))}unloadTile(t,r,n){let i=r._cacheNode;i&&(this._list.remove(i),r._cacheNode=null,n&&n(t,r))}unloadTiles(t,r){let n=this._trimTiles;this._trimTiles=!1;let i=this._list,o=this._sentinel,s=i.head;for(;s!==o&&(t.gpuMemoryUsageInBytes>t.cacheBytes||n);){let a=s.item;s=s.next,this.unloadTile(t,a,r)}}trim(){this._trimTiles=!0}};Dr();Dr();jt();co();function Ed(e,t){ai(e),ai(t);let{rtcCenter:r,gltfUpAxis:n}=t,{computedTransform:i,boundingVolume:{center:o}}=e,s=new bt(i);switch(r&&s.translate(r),n){case"Z":break;case"Y":let f=new bt().rotateX(Math.PI/2);s=s.multiplyRight(f);break;case"X":let d=new bt().rotateY(-Math.PI/2);s=s.multiplyRight(d);break;default:break}t.isQuantized&&s.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);let a=new E(o);t.cartesianModelMatrix=s,t.cartesianOrigin=a;let c=pt.WGS84.cartesianToCartographic(a,new E),h=fa(pt.WGS84,a).invert();t.cartographicModelMatrix=h.multiplyRight(s),t.cartographicOrigin=c;let u=GC(t);u&&(t.cartesianModelMatrix=new bt(s).multiplyRight(u.matrix),t.cartographicModelMatrix.multiplyRight(u.matrix),u.matrix=bt.IDENTITY),t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var UC=1e6**2;function GC(e){let t=e.gltf?.json;if(!t)return null;let r=typeof t.scene=="number"?t.scene:0,i=t.scenes?.[r]?.nodes?.[0],o=i===void 0?void 0:t.nodes?.[i];if(!o?.matrix)return null;let s=o.matrix;return s[12]*s[12]+s[13]*s[13]+s[14]*s[14]<=UC?null:o}jt();ro();Dr();Dr();var ES=new E,p1=new E,zC=1e-5,VC=1e-7,g1=new sr([new Ye,new Ye,new Ye,new Ye,new Ye,new Ye]);function Td(e,t,r={}){let{cameraUp:n,height:i}=e,o=e.cameraDirection,{metersPerUnit:s}=e.distanceScales,a=Bh(e,e.center),c=fa(pt.WGS84,a),l=e.unprojectPosition(e.cameraPosition),h=pt.WGS84.cartographicToCartesian(l,new E),u;if(o)u=new E(c.transformAsVector(new E(o).scale(s))).normalize();else{let A=e.getFrustumPlanes().near,S=y1(A,e.cameraPosition),v=Bh(e,S);u=new E(v).subtract(h).normalize()}let f=new E(c.transformAsVector(new E(n).scale(s))).normalize();kC(e);let d=e.constructor,{longitude:m,latitude:p,width:g,bearing:y,zoom:_,position:b}=e,M=new d({longitude:m,latitude:p,height:i,width:g,bearing:y,zoom:_,position:b,pitch:0}),T=Number.isFinite(e.fovy)&&Number(e.fovy)>0&&Number(e.fovy)<180?Number(e.fovy)*Math.PI/180:Math.PI/3;return{camera:{position:h,direction:u,up:f,cartographicPosition:l,verticalFieldOfView:T,timeSinceMovement:r.timeSinceCameraMovement??Number.POSITIVE_INFINITY},viewport:e,topDownViewport:M,height:i,cullingVolume:g1,clippingPlanes:e.clippingPlanes,frameNumber:t,sseDenominator:2*Math.tan(T/2),dynamicScreenSpaceErrorDensity:0}}function TS(e,t,r,n){let i=Array.from(t),o=Array.from(r),s=e?i.length!==e.position.length||i.some((l,h)=>Math.abs(l-e.position[h])>zC):!1,a=e?o.length!==e.direction.length||o.some((l,h)=>Math.abs(l-e.direction[h])>VC):!1,c=s||a?n:e?.lastMovementTime??Number.NEGATIVE_INFINITY;return{state:{position:i,direction:o,lastMovementTime:c},timeSinceMovement:Math.max((n-c)/1e3,0)}}function IS(e,t,r){if(r===0||e.length<=r)return[e,[]];let n=[],{longitude:i,latitude:o}=t.viewport;for(let[l,h]of e.entries()){let[u,f]=h.header.mbs,d=Math.abs(i-u),m=Math.abs(o-f),p=Math.sqrt(m*m+d*d);n.push([l,p])}let s=n.sort((l,h)=>l[1]-h[1]),a=[];for(let l=0;l<r;l++)a.push(e[s[l][0]]);let c=[];for(let l=r;l<s.length;l++)c.push(e[s[l][0]]);return[a,c]}function kC(e){let t=e.getFrustumPlanes(),r=y1(t.near,e.cameraPosition),n=Bh(e,r),i=Bh(e,e.cameraPosition,p1),o=0;g1.planes[o++].fromPointNormal(n,ES.copy(n).subtract(i));for(let s in t){if(s==="near")continue;let a=t[s],c=y1(a,r,p1),l=Bh(e,c,p1);g1.planes[o++].fromPointNormal(l,ES.copy(n).subtract(l))}}function y1(e,t,r=new E){let n=e.normal.dot(t);return r.copy(e.normal).scale(e.distance-n).add(t),r}function Bh(e,t,r=new E){let n=e.unprojectPosition(t);return pt.WGS84.cartographicToCartesian(n,r)}jt();var NS=new E,qC=new E,Sa=new E,AS=new E,Lh=new E,PS=new E,RS=new E,CS=new E,Id=new Xi,jC=new E(0,0,1);function OS(e,t){e._updateTransform(t)}function BS(e,t,r){if(!Number.isFinite(r.dynamicScreenSpaceErrorDensity)||r.dynamicScreenSpaceErrorDensity<=0)return 0;let n=YC(e),i=n.region?KC(n.region,t):XC(e,n,t);if(!i)return 0;let o=rh(r.dynamicScreenSpaceErrorHeightFalloff,0,1),s=i.minimumHeight+(i.maximumHeight-i.minimumHeight)*o,a=i.maximumHeight-s,c=a>0?rh((i.cameraHeight-s)/a,0,1):i.cameraHeight>=i.maximumHeight?1:0,h=(1-rh(Math.abs(i.cameraDirection.dot(i.upDirection)),0,1))*(1-c);return r.dynamicScreenSpaceErrorDensity*h}function WC(e,t){let r=e*t;return 1-Math.exp(-(r*r))}function HC(e,t,r){return t<=0||r<=0||!Number.isFinite(t)||!Number.isFinite(r)?0:WC(e,t)*r}function LS(e,t,r,n=1){let i=e.tileset,o=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,s=r?o:e.lodMetricValue;if(s===0)return 0;let{viewDistanceScale:a}=i.options,c=a||1,l=Number.isFinite(n)?Math.max(n,0):1,h=$C(s,t,c,l);if(h!==null)return h;let u=Math.max(e._distanceToCamera,1e-7),{height:f,sseDenominator:d}=t,m=s*f*l*c/(u*d);return i.options.dynamicScreenSpaceError&&!t.viewport.orthographic&&(m-=HC(u,t.dynamicScreenSpaceErrorDensity,i.options.dynamicScreenSpaceErrorFactor)),m}function $C(e,t,r,n){let i=t.viewport;if(!i?.orthographic)return null;let o=i.metersPerPixel;return!Number.isFinite(o)||!o||o<=0?null:e*r*n/o}function YC(e){return e.header.content?.boundingVolume||e.header.boundingVolume}function KC(e,t){let r=NS.copy(t.camera.position).normalize(),n=Lh.copy(t.camera.direction).normalize();return{cameraHeight:t.camera.cartographicPosition[2],minimumHeight:e[4],maximumHeight:e[5],cameraDirection:n,upDirection:r}}function XC(e,t,r){let n=ZC(t,Sa);if(n===null)return null;let i=new bt(e.computedTransform).invert(),o=e.tileset.ellipsoid;if(Math.hypot(Sa[0],Sa[1],Sa[2])>o.minimumRadius){let a=o.cartesianToCartographic(Sa,qC),c=NS.copy(r.camera.position).normalize(),l=Lh.copy(r.camera.direction).normalize();return{cameraHeight:r.camera.cartographicPosition[2],minimumHeight:0,maximumHeight:a[2]*2,cameraDirection:l,upDirection:c}}return i.transformAsPoint(r.camera.position,AS),i.transformAsVector(r.camera.direction,Lh),Lh.normalize(),{cameraHeight:AS[2],minimumHeight:Sa[2]-n,maximumHeight:Sa[2]+n,cameraDirection:Lh,upDirection:jC}}function ZC(e,t){if(e.box){let r=e.box;return t.set(r[0],r[1],r[2]),JC(r)}if(e.sphere){let r=e.sphere;return t.set(r[0],r[1],r[2]),r[3]}return null}function JC(e){return e.length===10?(Id.fromArray(e,6),PS.set(e[3],0,0).transformByQuaternion(Id),RS.set(0,e[4],0).transformByQuaternion(Id),CS.set(0,0,e[5]).transformByQuaternion(Id),Math.abs(PS[2])+Math.abs(RS[2])+Math.abs(CS[2])):Math.abs(e[5])+Math.abs(e[8])+Math.abs(e[11])}jt();ro();var ir={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},Ge;(function(e){e[e.ADD=1]="ADD",e[e.REPLACE=2]="REPLACE"})(Ge||(Ge={}));var Oi;(function(e){e.EMPTY="empty",e.SCENEGRAPH="scenegraph",e.POINTCLOUD="pointcloud",e.MESH="mesh"})(Oi||(Oi={}));var nr;(function(e){e.I3S="I3S",e.TILES3D="TILES3D"})(nr||(nr={}));var Wc;(function(e){e.GEOMETRIC_ERROR="geometricError",e.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})(Wc||(Wc={}));var DS={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};var FS=1e4,QC=1e4,tN=1e8,eN=new en,US=new E,GS=new E,w1=new E,Ad=new E;function _1(e,t,r){return e+(t-e)*r}function zS(e,t){let r=e instanceof en?e:e.getBoundingSphere(eN),{center:n,radius:i}=r;US.copy(n).subtract(t.position);let o=Math.max(US.dot(t.direction),0);return GS.copy(t.direction).scale(o).add(t.position),w1.copy(GS).subtract(n),w1.magnitude()<=i||(Ad.copy(w1).normalize().scale(i).add(n).subtract(t.position),Ad.magnitude()===0)?0:(Ad.normalize(),Math.min(Math.max(1-Ad.dot(t.direction),0),1))}function VS(e,t,r,n){return!Number.isFinite(n)||n<=0||n>.5?!1:e>r?!0:t!==void 0&&t>r}function kS(e){let t=Number.isFinite(e.foveatedConeSize)?Math.min(Math.max(e.foveatedConeSize,0),1):1,r=e.refinement===Ge.REPLACE;if(r&&!e.skipLevelOfDetail||!e.foveatedScreenSpaceError||t>=1||r&&e.skipLevelOfDetail&&e.priorityProgressiveResolution)return!1;let n=Number.isFinite(e.verticalFieldOfView)&&e.verticalFieldOfView>0?e.verticalFieldOfView:Math.PI/3,i=1-Math.cos(n*.5),o=t*i;if(e.foveatedFactor<=o||i<=o)return!1;let s=Math.min(Math.max((e.foveatedFactor-o)/(i-o),0),1),c=(typeof e.interpolationCallback=="function"?e.interpolationCallback:_1)(e.minimumScreenSpaceErrorRelaxation,e.maximumScreenSpaceError,s),l=Number.isFinite(c)?Math.min(Math.max(c,0),e.maximumScreenSpaceError):0,h=e.screenSpaceError===0&&e.parentScreenSpaceError!==void 0?e.parentScreenSpaceError*.5:e.screenSpaceError;return e.maximumScreenSpaceError-l<=h}function qS(e,t,r){return e&&Number.isFinite(t)&&Number.isFinite(r)&&r>0&&t<r}function jS(e){let t=e.rootScreenSpaceError>0?Math.min(Math.max(e.reverseScreenSpaceError/e.rootScreenSpaceError,0),1):0,r=Math.floor(t*(FS-1)),n=Number.isFinite(e.foveatedFactor)?Math.min(Math.max(e.foveatedFactor,0),1):0,i=Math.floor(n*(FS-1))*QC;return(e.priorityProgressiveResolution?0:tN)+i+r}Cg();Cg();var Hc="EPSG:4326",Pd="EPSG:4978";function Dh(e){let t=e.trim().toUpperCase(),r=t.match(/(?:\/DEF\/CRS\/|URN:OGC:DEF:CRS:)([A-Z0-9_-]+)(?:\/|::)(?:[^/:]*[/:])?([A-Z0-9_.-]+)$/);return r?`${r[1]}:${r[2]}`:t}function _n(e){if(typeof e=="string"){let r=tr(e);return r==="wkt"?rN(e):r==="proj-string"?nN(e):M1(e)||"projected"}let t=e;return t.type==="BoundCRS"&&t.source_crs?_n(t.source_crs):t.type==="CompoundCRS"&&t.components?.[0]?_n(t.components[0]):String(t.type).includes("Projected")?"projected":String(t.type).includes("Geographic")?"geographic":String(t.type).includes("Geodetic")?t.coordinate_system?.subtype==="Cartesian"?"geocentric":"geographic":"unknown"}function M1(e){if(typeof e!="string")return;let t=Dh(e);if(t===Pd)return"geocentric";if(t===Hc||t==="OGC:CRS84")return"geographic";let r=/^EPSG:(\d+)$/.exec(t);if(!r)return;let n=Number(r[1]);if(n===7789)return"geocentric";if(n===4490||n===4979)return"geographic";if(n===3857||n>=32601&&n<=32660||n>=32701&&n<=32760)return"projected"}function rN(e){let t;try{t=dh(e).root}catch{return"unknown"}switch(t.keyword.toUpperCase()){case"GEOCCS":return"geocentric";case"GEOGCS":case"GEOGCRS":case"GEOGRAPHICCRS":case"GEOGRAPHIC2DCRS":case"GEOGRAPHIC3DCRS":return"geographic";case"PROJCS":case"PROJCRS":case"PROJECTEDCRS":return"projected";case"GEODCRS":case"GEODETICCRS":{let n=t.values.find(i=>i.type==="node"&&i.keyword.toUpperCase()==="CS")?.values[0];return n?.type!=="enumeration"&&n?.type!=="string"?"unknown":n.value.toUpperCase()==="CARTESIAN"?"geocentric":n.value.toUpperCase()==="ELLIPSOIDAL"?"geographic":"unknown"}default:return"unknown"}}function nN(e){try{let t=mh(e).parameters.find(r=>r.name.toLowerCase()==="proj")?.value;switch(t?.toLowerCase()){case"longlat":case"latlong":return"geographic";case"geocent":return"geocentric";default:return t?"projected":"unknown"}}catch{return"unknown"}}function Mn(e,t={}){let r=t.sourceCrs!==void 0,n=t.sourceCrs||e.sourceCrs,i=t.outputCoordinates||"auto",o=t.targetCrs||(i==="ecef"?"EPSG:4978":void 0),s=t.targetHeightReference||"native",a=e.verticalUnitScale??1,c=e.elevationUnitScale??1,l=e.elevationOffset||0,h=e.elevationMode==="onTheGround"||e.elevationMode==="relativeToGround"||e.elevationMode==="relativeToScene",u=e.elevationMode==="relativeToScene"?!!t.sceneElevationProvider:!h||!!t.terrainElevationProvider,f=a!==1||c!==1||e.elevationMode!==void 0&&(h||e.elevationMode==="absoluteHeight"&&l!==0),d=s!=="native"&&s!==e.heightReference,m=!!o||s!=="native"||i!=="auto"||f,p=i!=="target-crs"||!!o,g=!d||(e.heightReference||"unknown")!=="unknown",y=Number.isFinite(a)&&a>0&&Number.isFinite(c)&&c>0,_=!!n&&m&&p&&g&&y&&u&&i!=="local-enu",b=r?"caller-override":e.provenance||"unknown",M=r&&n?_n(n):e.coordinateFrame,T=r?"explicit":e.sourceCrsState||(n?b==="format-default"?"default":"explicit":"absent"),A=qf({crs:n?{state:T==="default"?"default":"explicit",definition:n,representation:!r&&e.sourceCrsRepresentation||tr(n),provenance:b,alternatives:r?void 0:e.sourceCrsAlternatives}:{state:T==="unknown"?"unknown":"absent",provenance:b},vertical:e.verticalCrs?{state:"explicit",definition:e.verticalCrs,representation:tr(e.verticalCrs),provenance:e.provenance||"metadata"}:void 0,coordinateEpoch:t.coordinateEpoch??e.coordinateEpoch,coordinateFrame:M,coordinateOrder:oN(e.axisOrder),units:r?void 0:e.units}),S=b1(A.crs),v=A.vertical?b1(A.vertical):void 0,N=o?iN(o):void 0;return Object.freeze({...A,sourceCrs:S,verticalCrs:v,verticalUnitScale:a,coordinateEpoch:t.coordinateEpoch??e.coordinateEpoch,heightReference:e.heightReference||"unknown",elevationMode:e.elevationMode,elevationOffset:e.elevationOffset,elevationUnit:e.elevationUnit,elevationUnitScale:c,coordinateFrame:M||"unknown",axisOrder:e.axisOrder||"unknown",provenance:b,targetCrs:N,targetHeightReference:s,outputCoordinates:i,status:m?_?"transformable":"unresolved":"native",warnings:Object.freeze([...e.warnings||[]])})}function va(e,t={}){return Mn({sourceCrs:e?.sourceCrs,sourceCrsState:e?.crs.state,sourceCrsRepresentation:e?.crs.state==="explicit"||e?.crs.state==="default"?e.crs.representation:void 0,sourceCrsAlternatives:e?.crs.state==="explicit"||e?.crs.state==="default"?e.crs.alternatives:void 0,verticalCrs:e?.verticalCrs,units:e?.units,verticalUnitScale:e?.verticalUnitScale,coordinateEpoch:e?.coordinateEpoch,heightReference:e?.heightReference,elevationMode:e?.elevationMode,elevationOffset:e?.elevationOffset,elevationUnit:e?.elevationUnit,elevationUnitScale:e?.elevationUnitScale,coordinateFrame:e?.coordinateFrame,axisOrder:e?.axisOrder,provenance:e?.provenance,warnings:e?.warnings},t)}function b1(e){return e.state==="explicit"||e.state==="default"?e.definition:void 0}function iN(e){let t=qf({crs:{state:"explicit",definition:e,representation:tr(e),provenance:"caller-override"}}),r=b1(t.crs);if(!r)throw new Error("Failed to normalize a known target CRS definition");return r}function oN(e){switch(e){case"xy":return["x","y"];case"yx":return["y","x"];case"xyz":return["x","y","z"];default:return[]}}function $c(e){if(e.status!=="transformable"&&e.status!=="transformed")throw new Error("Only a transformable spatial reference can be marked as transformed");return Object.freeze({...e,status:"transformed"})}function Rd(e){return!!(e&&typeof e=="object"&&"initialize"in e&&"getRootTileset"in e&&"initializeTileHeaders"in e&&"loadTileContent"in e)}var Od=1024*1024,tv=512*Od,ev=512*Od,sN=32*Od,aN=Od;function Cd(e,t){if(!Number.isFinite(e)||e<0)throw new Error(`${t} must be a finite number greater than or equal to 0`);return e}function WS(e,t){let r=e.cacheBytes??t;return Cd(r,"cacheBytes")}function HS(e,t){let r=e.maximumCacheOverflowBytes??t;return Cd(r,"maximumCacheOverflowBytes")}var x1={description:"",ellipsoid:pt.WGS84,modelMatrix:new bt,throttleRequests:!0,maxRequests:64,cacheBytes:tv,maximumCacheOverflowBytes:ev,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onSourceError:()=>{},onTilesetError:()=>{},onTraversalComplete:e=>e,onUpdate:()=>{},contentLoader:void 0,viewDistanceScale:1,progressiveResolutionHeightFraction:.3,foveatedScreenSpaceError:!0,foveatedConeSize:.1,foveatedMinimumScreenSpaceErrorRelaxation:0,foveatedInterpolationCallback:_1,foveatedTimeDelay:.2,maximumScreenSpaceError:8,skipLevelOfDetail:!1,baseScreenSpaceError:1024,skipScreenSpaceErrorFactor:16,skipLevels:1,immediatelyLoadDesiredLevelOfDetail:!1,dynamicScreenSpaceError:!0,dynamicScreenSpaceErrorDensity:2e-4,dynamicScreenSpaceErrorFactor:24,dynamicScreenSpaceErrorHeightFalloff:.25,memoryAdjustedScreenSpaceError:!0,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{},spatial:{}},S1="Tiles In Tileset(s)",v1="Tiles In Memory",$S="Tiles In View",YS="Tiles To Render",KS="Tiles Loaded",E1="Tiles Loading",XS="Tiles Unloaded",ZS="Failed Tile Loads",JS="Points/Vertices",T1="Tile Memory Use",QS="Maximum Screen Space Error",Nd=class{options;loadOptions;source;type;tileset;loader;url;basePath;modelMatrix;ellipsoid;lodMetricType;lodMetricValue;refine;root=null;roots={};asset={};schema=null;schemaUri=null;groups=[];metadata=null;statistics=null;spatialReference=Mn({});description="";properties;extras=null;attributions={};credits={};stats;contentFormats;cartographicCenter=null;cartesianCenter=null;zoom=1;boundingVolume=null;dynamicScreenSpaceErrorComputedDensity=0;gpuMemoryUsageInBytes=0;memoryAdjustedScreenSpaceError=0;_cacheBytes=tv;_maximumCacheOverflowBytes=ev;_frameNumber=0;_tiles={};_pendingCount=0;selectedTiles=[];traverseCounter=0;geometricError=0;lastUpdatedVieports=null;_requestedTiles=[];_emptyTiles=[];frameStateData={};_cameraMotionStates={};_deferredTraversalTimeout=null;_traverser;_cache=new jc;_requestScheduler;_heldTiles=new Set;updatePromise=null;tilesetInitializationPromise;constructor(t,r){if(!Rd(t))throw new Error("Tileset3D requires a Tileset3DSource instance");let n=r||{},i=t.type===nr.TILES3D,o=i?x1.cacheBytes:sN,s=i?x1.maximumCacheOverflowBytes:aN,a=WS(n,o),c=HS(n,s);this.options={...x1,...n,cacheBytes:a,maximumCacheOverflowBytes:c,skipLevelOfDetail:n.skipLevelOfDetail??t.type===nr.TILES3D,memoryAdjustedScreenSpaceError:n.memoryAdjustedScreenSpaceError??i},this.loadOptions=this.options.loadOptions||{},this.source=t,this.tileset=null,this.loader=this.source.loader,this.type=this.source.type,this.url=this.source.url,this.basePath=this.source.basePath,this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType="",this.lodMetricValue=0,this.refine="",this.contentFormats=this.source.contentFormats,this._traverser=this._initializeTraverser(),this._requestScheduler=new kc({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.memoryAdjustedScreenSpaceError=this.options.maximumScreenSpaceError,this._cacheBytes=a,this._maximumCacheOverflowBytes=c;let l=this._getSourceMetadata();l&&(this.spatialReference=va(l.spatialReference,this.options.spatial)),this.stats=new Ni({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet()}destroy(){this._clearDeferredTraversal(),this.source.destroy?.(),this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get requestedTiles(){return this._requestedTiles.slice()}get emptyTiles(){return this._emptyTiles.slice()}get cacheBytes(){return this._cacheBytes}set cacheBytes(t){this._cacheBytes=Cd(t,"cacheBytes"),this.options.cacheBytes=this._cacheBytes}get maximumCacheOverflowBytes(){return this._maximumCacheOverflowBytes}set maximumCacheOverflowBytes(t){this._maximumCacheOverflowBytes=Cd(t,"maximumCacheOverflowBytes"),this.options.maximumCacheOverflowBytes=this._maximumCacheOverflowBytes}get queryParams(){let t=this.source.getTileUrl(this.url),r=t.indexOf("?");return r>=0?t.slice(r+1):""}setProps(t){let r=WS(t,this.cacheBytes),n=HS(t,this.maximumCacheOverflowBytes);this.options={...this.options,...t,cacheBytes:r,maximumCacheOverflowBytes:n},this._cacheBytes=r,this._maximumCacheOverflowBytes=n}getTileUrl(t){return this.source.getTileUrl(t)}hasExtension(t){return!!this.source.hasExtension?.(t)}update(t=null){this.tilesetInitializationPromise.then(()=>{!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t&&this.doUpdate(t)})}async selectTiles(t=null){return await this.tilesetInitializationPromise,t&&(this.lastUpdatedVieports=t),this.updatePromise||(this.updatePromise=new Promise(r=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),r(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytes<this.cacheBytes?this.memoryAdjustedScreenSpaceError=Math.max(this.memoryAdjustedScreenSpaceError/1.02,this.options.maximumScreenSpaceError):this.gpuMemoryUsageInBytes>this.cacheBytes+this.maximumCacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(t){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let r=t instanceof Array?t:[t],n=new Set(r.map(a=>a.id));for(let a of Object.keys(this.frameStateData))n.has(a)||delete this.frameStateData[a];this._cache.reset(),this._frameNumber++,this.traverseCounter=r.length;let i=Date.now(),o=Number.POSITIVE_INFINITY,s=[];for(let a of r){let c=a.id;this._needTraverse(c)?s.push(c):this.traverseCounter--}for(let a of r){let c=a.id;if(this.roots[c]||(this.roots[c]=this._initializeTileHeaders(this.tileset,null)),!s.includes(c))continue;let l=Td(a,this._frameNumber),h=this.roots[c],u=TS(this._cameraMotionStates[c],l.camera.position,l.camera.direction,i);this._cameraMotionStates[c]=u.state,l.camera.timeSinceMovement=u.timeSinceMovement,OS(h,this.modelMatrix),l.dynamicScreenSpaceErrorDensity=this.type===nr.TILES3D&&this.options.dynamicScreenSpaceError&&!l.viewport.orthographic?BS(h,l,this.options):0,this.dynamicScreenSpaceErrorComputedDensity=l.dynamicScreenSpaceErrorDensity,this._traverser.traverse(h,l,this.options),Object.keys(this._traverser.deferredTiles).length>0&&(o=Math.min(o,Math.max(this.options.foveatedTimeDelay-u.timeSinceMovement,0)))}Number.isFinite(o)?this._scheduleDeferredTraversal(o):this._clearDeferredTraversal()}_scheduleDeferredTraversal(t){this._clearDeferredTraversal(),this._deferredTraversalTimeout=setTimeout(()=>{this._deferredTraversalTimeout=null,this.selectTiles().catch(r=>{let n=r instanceof Error?r:new Error(String(r));this._onTilesetError(n)})},Math.max(t*1e3,0))}_clearDeferredTraversal(){this._deferredTraversalTimeout!==null&&(clearTimeout(this._deferredTraversalTimeout),this._deferredTraversalTimeout=null)}_needTraverse(t){let r=t;return this.options.viewportTraversersMap&&(r=this.options.viewportTraversersMap[t]),r===t}_onTraversalEnd(t){let r=t.viewport.id;this.frameStateData[r]||(this.frameStateData[r]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let n=this.frameStateData[r],i=Object.values(this._traverser.selectedTiles),[o,s]=IS(i,t,this.options.maximumTilesSelected);n.selectedTiles=o;for(let a of s)a.unselect();n._requestedTiles=Object.values(this._traverser.requestedTiles),n._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){let t=this.selectedTiles;this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let o in this.frameStateData){let s=this.frameStateData[o];this.selectedTiles=this.selectedTiles.concat(s.selectedTiles),this._requestedTiles=this._requestedTiles.concat(s._requestedTiles),this._emptyTiles=this._emptyTiles.concat(s._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);let r=new Set(this.selectedTiles),n=this.selectedTiles.some(o=>!o.tileDrawn),i=0;if(n){let o=new Set(Object.keys(this.frameStateData).map(a=>this.roots[a])),s=new Map;for(let a of this.selectedTiles)for(let c=a.parent;c;c=c.parent)s.set(c,(s.get(c)??!0)&&a.tileDrawn);for(let a of t)a.tileDrawn&&this._heldTiles.add(a);for(let a of this._heldTiles){let c=a;for(;c.parent;)c=c.parent;if(!o.has(c)){this._heldTiles.delete(a);continue}r.has(a)||(a.contentAvailable&&!this._hasDrawnReplacement(a,r,s)?(a._selectedFrame=this._frameNumber,this.selectedTiles.push(a),i++):this._heldTiles.delete(a))}}else this._heldTiles=r;i>0&&setTimeout(()=>{this.selectTiles()},0);for(let o of this.selectedTiles)this._tiles[o.id]=o;this._loadTiles(),this._unloadTiles(),this._updateStats(),this._tilesChanged(t,this.selectedTiles)&&this.options.onUpdate()}_hasDrawnReplacement(t,r,n){for(let i=t.parent;i;i=i.parent)if(r.has(i))return i.tileDrawn;return n.get(t)===!0}_tilesChanged(t,r){if(t.length!==r.length)return!0;let n=new Set(t.map(s=>s.id)),i=new Set(r.map(s=>s.id)),o=t.some(s=>!i.has(s.id));return o=o||r.some(s=>!n.has(s.id)),o}_loadTiles(){this._requestedTiles.sort((t,r)=>t._priority-r._priority);for(let t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,(t,r)=>t._unloadTile(r)),this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_updateStats(){let t=0,r=0;for(let n of this.selectedTiles)if(n.contentAvailable&&n.content){t++;let i=n.contents.length?n.contents:[n.content];for(let o of i)o.pointCount?r+=o.pointCount:r+=o.vertexCount||0}this.stats.get($S).count=this.selectedTiles.length,this.stats.get(YS).count=t,this.stats.get(JS).count=r,this.stats.get(QS).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(){try{let t=this.source.initialize(),r=this._getSourceMetadata();r&&this._syncSourceState(r),r?.tileset?.root&&typeof r.tileset.root.then!="function"&&(!this.source.prepareTileset||this.spatialReference?.status==="native")&&(this.root=this._initializeTileHeaders(r.tileset,null),this._applyViewState()),await t;let n=this.source.getMetadata();this._syncSourceState(n),await this.source.prepareTileset?.(this),this.root||(this.root=this._initializeTileHeaders(n.tileset,null)),this._applyViewState()}catch(t){let r=t instanceof Error?t:new Error(String(t));throw this._onSourceError(r,this.root),this._onTilesetError(r),r}}_initializeStats(){this.stats.get(S1),this.stats.get(E1),this.stats.get(v1),this.stats.get($S),this.stats.get(YS),this.stats.get(KS),this.stats.get(XS),this.stats.get(ZS),this.stats.get(JS),this.stats.get(T1,"memory"),this.stats.get(QS)}_initializeTileHeaders(t,r){return this.source.initializeTileHeaders(this,t,r)}_initializeTraverser(){return this.source.createTraverser({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let r=null;try{this._onStartTileLoading(),r=await t.loadContent()}catch(n){let i=n instanceof Error?n:new Error("load failed");this._onSourceError(i,t),this._onTileLoadError(t,i)}finally{this._onEndTileLoading(),this._onTileLoad(t,r)}}async _loadTileChildren(t,r){try{this._onStartTileLoading(),await t.loadChildren(r)}catch(n){let i=n instanceof Error?n:new Error("subtree load failed");this._onSourceError(i,t),this._onTileLoadError(t,i)}finally{this._onEndTileLoading()}}_onTileLoadError(t,r){this.stats.get(ZS).incrementCount();let n=r.message||r.toString(),i=t.url;console.error(`A 3D tile failed to load: ${t.url} ${n}`),this.options.onTileError(t,n,i)}_onSourceError(t,r=null){this.options.onSourceError(t,this.source,r)}_onTilesetError(t){this.options.onTilesetError(t,this)}_onTileLoad(t,r){if(!r?.loaded)return;t.content&&Ed(t,t.content),this.source.onTileLoaded?.(this,t,r),this._syncSourceState(this.source.getMetadata());let n=this.source.getTilesTotalCount?.();n&&(this.stats.get(S1).reset(),this.stats.get(S1).addCount(n)),this._addTileToCache(t),this.options.onTileLoad(t)}_onStartTileLoading(){this._pendingCount++,this.stats.get(E1).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(E1).decrementCount()}_addTileToCache(t){this._cache.add(this,t,r=>r._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(KS).incrementCount(),this.stats.get(v1).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(T1).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(v1).decrementCount(),this.stats.get(XS).incrementCount(),this.stats.get(T1).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){let t=[];for(this.root&&t.push(this.root);t.length>0;){let r=t.pop();for(let n of r.children)t.push(n);this._destroyTile(r)}this.root=null}_destroySubtree(t){let r=t,n=[r];for(;n.length>0;){t=n.pop();for(let i of t.children)n.push(i);t!==r&&this._destroyTile(t)}r.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_syncSourceState(t){this.tileset=t.tileset,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath,this.lodMetricType=t.lodMetricType,this.lodMetricValue=t.lodMetricValue,this.refine=t.refine,this.contentFormats=this.source.contentFormats,this.asset=this.source.asset||this.asset;let r=t.tileset;this.schema=r.schema||null,this.schemaUri=r.schemaUri||null,this.groups=r.groups||[],this.metadata=r.metadata||null,this.statistics=r.statistics??null;let n=va(t.spatialReference,this.options.spatial);this.spatialReference=cN(this.spatialReference,n),this.properties=this.source.properties??this.properties,this.extras=this.source.extras??this.extras,this.options.attributions?.length?this.credits={attributions:this.options.attributions}:this.credits=this.source.credits||this.credits}_applyViewState(){let t=this.source.getViewState(this.root);this.asset=t.asset||this.source.asset||{},this.properties=t.properties??this.source.properties,this.extras=t.extras??this.source.extras??null,this.credits=t.credits||this.source.credits||this.credits||{attributions:this.options.attributions||[]},this.description=t.description||this.options.description||"",this.boundingVolume=t.boundingVolume||this.root?.boundingVolume||null,this.cartographicCenter=t.cartographicCenter||new E,this.cartesianCenter=t.cartesianCenter||null,this.zoom=t.zoom||1,this.geometricError=this.tileset?.geometricError||0}_getSourceMetadata(){try{return this.source.getMetadata()}catch{return null}}};function cN(e,t){return e?.status==="transformed"&&e.sourceCrs===t.sourceCrs&&e.targetCrs===t.targetCrs&&e.targetHeightReference===t.targetHeightReference&&e.outputCoordinates===t.outputCoordinates?e:t}function rv(e){let t=e.selectedTiles.slice(),r=e.requestedTiles.slice(),n=e.emptyTiles.slice(),i=c=>c.map(l=>String(l.id)).sort(),o=c=>{let l=e.stats.get(c).count;return typeof l=="number"&&Number.isFinite(l)?l:0},a=e.source.getImplicitTilingStats?.();return{frameNumber:e.frameNumber,selectedTileIds:i(t),requestedTileIds:i(r),emptyTileIds:i(n),visibleTileCount:t.length,renderableTileCount:t.filter(c=>c.contentAvailable&&!!c.content).length,loadingTileCount:o("Tiles Loading"),loadedTileCount:o("Tiles Loaded"),failedTileCount:o("Failed Tile Loads"),cachedTileCount:o("Tiles In Memory"),cacheBytes:e.gpuMemoryUsageInBytes,maximumScreenSpaceError:e.memoryAdjustedScreenSpaceError,...a?{implicitTiling:a}:{}}}async function*nv(e,t={}){if(await e.tilesetInitializationPromise,Bd(t.signal),!e.root)throw new Error("Tileset initialization completed without a root tile");let r=[e.root],n=new Set;for(;r.length>0;){Bd(t.signal);let i=r.pop();if(n.has(i))continue;if(n.add(i),i.header.implicitSubtree&&i.childrenState!=="ready"){let s=e.source.loadTileChildrenForTraversal;if(!s)throw new Error("Tileset source does not support camera-independent subtree loading");if(!(await s.call(e.source,i,t.signal)).loaded)throw new Error(`Unable to load implicit subtree for tile ${i.id}`);i.childrenState="ready"}if(e.type===nr.I3S&&e.source.loadTileChildrenForTraversal&&!(await e.source.loadTileChildrenForTraversal(i,t.signal)).loaded)throw new Error(`Unable to load I3S child nodes for tile ${i.id}`);Bd(t.signal);let o=i.contentUrls.length>0&&!i.content;try{if(o){let s=await i.loadContentForTraversal();if(Bd(t.signal),!s.loaded)throw new Error(`Unable to load tile content for tile ${i.id}`);e.source.onTileLoaded?.(e,i,s)}yield{tile:i,contents:i.contentEntries}}finally{t.unloadContent&&o&&i.unloadContent()}for(let s=i.children.length-1;s>=0;s--)r.push(i.children[s])}}function Bd(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted","AbortError")}co();var Dd=class{sourceUrl;options;archivePromise;constructor(t){this.options=t,this.sourceUrl=lN(t.data,t.fallbackFilename)}async loadRoot(t,r,n){let i=this.options.rootPath?`${Ld(this.sourceUrl)}/${this.options.rootPath}`:t;return await this.parseArchiveResource(i,this.options.rootPath,r,n,this.options.rootMode)}async loadResource(t,r,n){let i=this.resolveArchivePath(t,t);return await this.parseArchiveResource(t,i,r,n)}async parseArchiveResource(t,r,n,i,o){let s=this.options.getCoreApi();if(!s)throw new Error(this.options.missingCoreApiMessage);let a=await this.loadFile(r,o),c=this.createArchiveFetch(t);return await s.parse(a,n,{...i,fetch:c},{url:t,fetch:c,_parse:s.parse,loaders:[n],coreApi:s})}createArchiveFetch(t){return async r=>{let n=typeof r=="string"?r:r instanceof URL?r.toString():r.url,i=this.resolveArchivePath(n,t),o=await this.loadFile(i);return new Response(o,{status:200})}}async loadFile(t,r){this.archivePromise||=this.openArchiveReadableFile().then(i=>this.options.parseArchive(i));let n=await this.archivePromise;return await this.options.getFile(n,t,r)}async openArchiveReadableFile(){let{data:t}=this.options;if(typeof t!="string")return new qc(t);if(/^https?:\/\//i.test(t))return new Nh(t);let r=this.options.getCoreApi();if(!r)throw new Error(this.options.missingCoreApiMessage);let n=await r.fetchFile(t);return new qc(await n.arrayBuffer())}resolveArchivePath(t,r){let n=Ld(t),i=Ld(this.sourceUrl),o=Ld(r),s=o===i?i:wn.dirname(o),a=new RegExp(`\\.${this.options.archiveExtension}/(.*)$`,"i"),c=n.match(a);if(c?.[1])return c[1];let l=/^[a-z][a-z0-9+.-]*:/i.test(n)||n.startsWith("/"),h=n.startsWith(i)?n:o===i&&!l?`${i}/${n}`:/^[a-z][a-z0-9+.-]*:\/\//i.test(o)?new URL(n,o).href:wn.resolve(s,n);return h===i?"":h.startsWith(`${i}/`)?h.slice(i.length+1):h.replace(/^\/+/,"")}};function lN(e,t){return typeof e=="string"?e:`memory://${"name"in e&&typeof e.name=="string"&&e.name?e.name:t}`}function Ld(e){return e.split(/[?#]/,1)[0]}jt();ro();function Fd(e){let t=[],r=new Set,n=i=>{if(!i||typeof i!="object"||r.has(i))return;r.add(i);let o=i,s=o.extensions?.EXT_mesh_features?.featureIds;if(Array.isArray(s))for(let a of s){if(!a||typeof a!="object")continue;let c=a.texture?"texture":a.implicit?"implicit":a.attribute!==void 0?"attribute":a.propertyTable!==void 0?"property-table":"constant";t.push({source:c,attribute:a.attribute,propertyTable:a.propertyTable,constant:a.constant,texture:a.texture,implicit:a.implicit,values:a.values,details:a})}for(let a of Object.values(o))n(a)};return n(e),t}jt();ro();Dr();co();function sv(e){return e!=null}var wr=new E,Ud=new E,iv=new bt;function Yc(e,t,r,n=t){if(ai(e,"3D Tile: boundingVolume must be defined"),e.box){let i=e.s2VolumeInfo?iv:t;return ov(e.box,i,r)}if(e.region){let i=uh(e.region),o=t.equals(n)?iv:t.clone().multiplyRight(n.clone().invert());return ov([...i.center,...i.halfAxes],o,r)}if(e.sphere)return hN(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function av(e,t,r=!1){if(e.box||e.region&&r)return uN(t);if(e.region){let[n,i,o,s,a,c]=e.region;return[[Br(n),Br(i),a],[Br(o),Br(s),c]]}if(e.sphere)return fN(t);throw new Error("Unkown boundingVolume type")}function ov(e,t,r){let n=new E(e[0],e[1],e[2]);t.transform(n,n);let i=[];if(e.length===10){let l=e.slice(3,6),h=new Xi;h.fromArray(e,6);let u=new E([1,0,0]),f=new E([0,1,0]),d=new E([0,0,1]);u.transformByQuaternion(h),u.scale(l[0]),f.transformByQuaternion(h),f.scale(l[1]),d.transformByQuaternion(h),d.scale(l[2]),i=[...u.toArray(),...f.toArray(),...d.toArray()]}else i=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let o=t.transformAsVector(i.slice(0,3)),s=t.transformAsVector(i.slice(3,6)),a=t.transformAsVector(i.slice(6,9)),c=new Qr([o[0],o[1],o[2],s[0],s[1],s[2],a[0],a[1],a[2]]);return sv(r)?(r.center=n,r.halfAxes=c,r):new eo(n,c)}function hN(e,t,r){let n=new E(e[0],e[1],e[2]);t.transform(n,n);let i=t.getScale(Ud),o=Math.max(Math.max(i[0],i[1]),i[2]),s=e[3]*o;return sv(r)?(r.center=n,r.radius=s,r):new en(n,s)}function uN(e){let t=cv(),{halfAxes:r}=e,n=new E(r.getColumn(0)),i=new E(r.getColumn(1)),o=new E(r.getColumn(2));for(let s=0;s<2;s++){for(let a=0;a<2;a++){for(let c=0;c<2;c++)wr.copy(e.center),wr.add(n),wr.add(i),wr.add(o),lv(t,wr),o.negate();i.negate()}n.negate()}return t}function fN(e){let t=cv(),{center:r,radius:n}=e,i=pt.WGS84.scaleToGeodeticSurface(r,wr),o;i?o=pt.WGS84.geodeticSurfaceNormal(i):o=new E(0,0,1);let s=new E(o[2],-o[1],0);s.len()>0?s.normalize():s=new E(0,1,0);let a=s.clone().cross(o);for(let c of[s,a,o]){Ud.copy(c).scale(n);for(let l=0;l<2;l++)wr.copy(r),wr.add(Ud),lv(t,wr),Ud.negate()}return t}function cv(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function lv(e,t){pt.WGS84.cartesianToCartographic(t,wr),e[0][0]=Math.min(e[0][0],wr[0]),e[0][1]=Math.min(e[0][1],wr[1]),e[0][2]=Math.min(e[0][2],wr[2]),e[1][0]=Math.max(e[1][0],wr[0]),e[1][1]=Math.max(e[1][1],wr[1]),e[1][2]=Math.max(e[1][2],wr[2])}jt();Dr();Dr();var I1=new E,hv=new E,ns=new E,uv=new E,dN=new E,A1=new bt,fv=new bt;function Gd(e,t){if(e.lodMetricValue===0||Number.isNaN(e.lodMetricValue))return"DIG";let r=2*P1(e,t);if(r<2)return"OUT";if(!e.header.children)return"DRAW";switch(e.lodMetricType){case"screenSpaceRelative":{let n=t.topDownViewport.height||1;return r/n<=e.lodMetricValue?"DRAW":"DIG"}case"distanceRangeFromDefaultCamera":return e.distanceToTile(t)>=e.lodMetricValue?"DRAW":"DIG";case"maxScreenThresholdSQ":{let n=Math.sqrt(e.lodMetricValue/(Math.PI*.25));return r<=n?"DRAW":"DIG"}default:return r<=e.lodMetricValue?"DRAW":"DIG"}}function P1(e,t){let{topDownViewport:r}=t,n=e.header.i3sLodMbs||e.header.mbs,i=n[1],o=n[0],s=n[2],a=n[3],c=[...e.boundingVolume.center],l=r.unprojectPosition(r.cameraPosition);pt.WGS84.cartographicToCartesian(l,I1),hv.copy(I1).subtract(c).normalize(),fa(pt.WGS84,c,A1),fv.copy(A1).invert(),ns.copy(I1).transform(fv);let h=Math.sqrt(ns[0]*ns[0]+ns[1]*ns[1]),u=h*h/ns[2];uv.copy([ns[0],ns[1],u]);let d=uv.transform(A1).subtract(c).normalize(),p=hv.cross(d).normalize().scale(a).add(c),g=pt.WGS84.cartesianToCartographic(p),y=r.project([o,i,s]),_=r.project(g);return dN.copy(y).subtract(_).magnitude()}co();var Fh=class{_map=new Map;_array;_length;constructor(t=0){this._array=new Array(t),this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return ai(t<this._array.length),this._array[t]}set(t,r){ai(t>=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=r,this._map.set(r,t)}delete(t){let r=this._map.get(t);r>=0&&(this._array.splice(r,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){let r=this.length++;this._array[r]=t,this._map.set(t,r)}}pop(){let t=this._array[--this.length];return this._map.delete(t),t}reserve(t){ai(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){ai(t>=0),this.length=t}trim(t){t==null&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}};var mN={loadSiblings:!1,skipLevelOfDetail:!1,baseScreenSpaceError:1024,skipScreenSpaceErrorFactor:16,skipLevels:1,immediatelyLoadDesiredLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},Bi=class{options;disableSkipLevelOfDetail=!1;root=null;selectedTiles={};requestedTiles={};deferredTiles={};emptyTiles={};lastUpdate=new Date().getTime();updateDebounceTime=1e3;_traversalStack=new Fh;_emptyTraversalStack=new Fh;_frameNumber=null;traversalFinished(t){return!0}constructor(t){this.options={...mN,...t}}isSkipLevelOfDetailEnabled(){return this.options.skipLevelOfDetail&&!this.disableSkipLevelOfDetail}traverse(t,r,n){this.root=t,this.options={...this.options,...n},this.reset(),this.updateTile(t,r),this._frameNumber=r.frameNumber,this.executeTraversal(t,r)}reset(){this.requestedTiles={},this.deferredTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,r){let n=this._traversalStack;for(t._selectionDepth=1,n.push(t);n.length>0;){let i=n.pop(),o=!1;this.canTraverse(i,r)&&(this.updateChildTiles(i,r),o=this.updateAndPushChildren(i,r,n,i.hasRenderContent?i._selectionDepth+1:i._selectionDepth));let s=i.parent,a=!!(!s||s._shouldRefine),c=!o;i.hasRenderContent?i.refine===Ge.ADD?(this.loadTile(i,r),this.selectTile(i,r)):i.refine===Ge.REPLACE&&(this.loadTile(i,r),(c||this.isSkipLevelOfDetailEnabled())&&this.selectTile(i,r)):(this.emptyTiles[i.id]=i,this.loadTile(i,r),c&&this.selectTile(i,r)),this.touchTile(i,r),i._shouldRefine=o&&a}this.completeTraversal(r)}completeTraversal(t){let r=new Date().getTime();(this.traversalFinished(t)||r-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=r,this.options.onTraversalEnd(t))}updateChildTiles(t,r){let n=t.children;for(let i of n)this.updateTile(i,r)}updateAndPushChildren(t,r,n,i){let{loadSiblings:o}=this.options,s=this.isSkipLevelOfDetailEnabled(),a=t.children;a.sort(this.compareDistanceToCamera.bind(this));let c=t.refine===Ge.REPLACE&&t.hasRenderContent&&!s,l=!1,h=!0;for(let u of a)if(u._selectionDepth=i,u.isVisibleAndInRequestVolume?(n.find(u)&&n.delete(u),n.push(u),l=!0):(c||o)&&u._inRequestVolume&&(this.loadTile(u,r),this.touchTile(u,r)),c){let f;u._inRequestVolume?u.hasRenderContent?f=u.contentAvailable:f=this.executeEmptyTraversal(u,r):f=!1,h=h&&f}return l||(h=!1),h}updateTile(t,r){this.updateTileVisibility(t,r)}selectTile(t,r){this.shouldSelectTile(t,r)&&(t._selectedFrame=r.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,r){if(this.shouldLoadTile(t)){if(this.shouldDeferTileRequest(t)){this.deferredTiles[t.id]=t;return}t._requestedFrame=r.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t}}shouldDeferTileRequest(t){return t.priorityDeferred}touchTile(t,r){t.tileset._cache.touch(t),t._touchedFrame=r.frameNumber}canTraverse(t,r){return t.hasChildren?t.hasTilesetContent?!t.contentExpired:this.shouldRefine(t,r):!1}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t,r){return t.contentAvailable&&t.contentVisibility(r)!=="outside"}shouldRefine(t,r,n=!1){let i=t._screenSpaceError;return n&&(i=t.getScreenSpaceError(r,!0)),i>t.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(t,r){let n=[];if(this.options.viewportTraversersMap)for(let i in this.options.viewportTraversersMap)this.options.viewportTraversersMap[i]===r.viewport.id&&n.push(i);else n.push(r.viewport.id);t.updateVisibility(r,n)}compareDistanceToCamera(t,r){return t._distanceToCamera-r._distanceToCamera}anyChildrenVisible(t,r){let n=!1;for(let i of t.children)i.updateVisibility(r),n=n||i.isVisibleAndInRequestVolume;return n}executeEmptyTraversal(t,r){let n=!0,i=!1,o=this._emptyTraversalStack;for(o.push(t);o.length>0;){let s=o.pop(),a=!s.hasRenderContent&&this.canTraverse(s,r),c=!s.hasRenderContent&&s.children.length===0;if(s.header.implicitSubtree&&(i=!0,n=!1),!a&&!s.contentAvailable&&!c&&(n=!1),this.updateTile(s,r),s.isVisibleAndInRequestVolume||(this.loadTile(s,r),this.touchTile(s,r)),a){let l=s.children;for(let h of l)o.push(h)}}return t.hasEmptyContent&&!i||n}};var R1=new E;function pN(e,t,r,n,i=[]){let o=e.length?e:[t],s=!1,a=!1;for(let c of o){let l="inside";if(n!==sr.MASK_INSIDE&&(l=r.computeVisibility(c),l==="outside"))continue;let h=!1;for(let u of i)if(c.intersectPlane(u)==="outside"){h=!0;break}h||(s=!0,a=a||l==="intersecting")}return s?a?"intersecting":"inside":"outside"}function dv(e){if(!e||typeof e!="object")return!1;let t=e;return t.shape==="tileset3d"||t.type==="tileset3d"||!!t.tileset}function gN(e){return e!=null}var bn=class{tileset;header;id;url;parent;refine;type;contentUrl;contentUrls=[];lodMetricType="geometricError";lodMetricValue=0;_unscaledLodMetricValue=0;_scaleGeometricError=!0;boundingVolume=null;content=null;contents=[];contentEntries=[];metadataContext={};featureIdSets=[];vectorContent=null;metadata=null;contentMetadata=[];contentState=ir.UNLOADED;gpuMemoryUsageInBytes=0;children=[];childrenState="ready";depth=0;viewportIds=[];transform=new bt;extensions=null;implicitTiling=null;userData={};computedTransform;hasEmptyContent=!1;hasTilesetContent=!1;traverser=new Bi({});_cacheNode=null;_frameNumber=null;_expireDate=null;_expiredContent=null;_childrenPromise=null;_boundingBox=void 0;_distanceToCamera=0;_screenSpaceError=0;_screenSpaceErrorProgressiveResolution=0;_priorityProgressiveResolution=!1;_foveatedFactor=0;priorityDeferred=!1;_visibilityPlaneMask;_visible=void 0;_contentBoundingVolume;_contentBoundingVolumes=[];_contentBoundingVolumeHeaders=[];_viewerRequestVolume;get contentBoundingVolume(){return this._contentBoundingVolume}get contentBoundingVolumes(){return this._contentBoundingVolumes}get viewerRequestVolume(){return this._viewerRequestVolume}_initialTransform=new bt;_priority=0;_selectedFrame=0;_requestedFrame=0;_selectionDepth=0;_touchedFrame=0;_centerZDepth=0;_shouldRefine=!1;_stackLength=0;_visitedFrame=0;_inRequestVolume=!1;_lodJudge=null;tileDrawn=!0;constructor(t,r,n,i=""){this.header=r,this.tileset=t,this.id=i||r.id,this.url=r.url,this.parent=n,this.refine=this._getRefine(r.refine),this.type=r.type,this.contentUrl=r.contentUrl,this.contentUrls=r.contentUrls||(r.contentUrl?[r.contentUrl]:[]),this._initializeMetadata(r),this.childrenState=r.implicitSubtree?"unloaded":"ready",this._initializeLodMetric(r),this._initializeTransforms(r),this._updateLodMetricScale(),this._initializeBoundingVolumes(r),this._initializeContent(r),this._initializeContentEntries(r),this._initializeRenderingState(r),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return this.header===null}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0||!!(this.header.implicitSubtree&&this.childrenState!=="ready")}get hasUnloadedChildren(){return!!(this.header.implicitSubtree&&(this.childrenState==="unloaded"||this.childrenState==="failed"))}get childrenLoading(){return this.childrenState==="loading"}get contentReady(){return this.contentState===ir.READY||this.hasEmptyContent}get contentAvailable(){return!!(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===ir.UNLOADED}get contentExpired(){return this.contentState===ir.EXPIRED}get contentFailed(){return this.contentState===ir.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=av(this.header.boundingVolume,this.boundingVolume,!this.computedTransform.equals(this._initialTransform))),this._boundingBox}getScreenSpaceError(t,r,n=1){switch(this.tileset.type){case nr.I3S:return P1(this,t);case nr.TILES3D:return LS(this,t,r,n);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return(this.contents.length?this.contents:[this.content]).reduce((r,n)=>r+(n?.gpuMemoryUsageInBytes||n?.byteLength||0),0)}_getPriority(){return this._calculateRequestPriority(!1)}_getChildrenPriority(){return this._calculateRequestPriority(!0)}_calculateRequestPriority(t){let r=this.tileset._traverser,n=r.options.skipLevelOfDetail&&!r.disableSkipLevelOfDetail,i=this.refine===Ge.ADD||n;if(i&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.priorityDeferred||!t&&this.contentState===ir.UNLOADED)return-1;let o=this.parent,a=o&&(!i||this._screenSpaceError===0||o.hasTilesetContent)?o._screenSpaceError:this._screenSpaceError,c=r.root?r.root._screenSpaceError:0,l=Math.max(c-a,0);return jS({priorityProgressiveResolution:this._priorityProgressiveResolution,foveatedFactor:this._foveatedFactor,reverseScreenSpaceError:l,rootScreenSpaceError:c})}async loadContent(){if(this.hasEmptyContent)return{loaded:!1};if(this.content)return{loaded:!0};this.contentExpired&&(this._expireDate=null),this.contentState=ir.LOADING;let r=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!r)return this.contentState=ir.UNLOADED,{loaded:!1};try{return await this._loadContentFromSource()}catch(n){throw this.contentState=ir.FAILED,n}finally{r.done()}}async loadContentForTraversal(){if(this.hasEmptyContent)return{loaded:!1};if(this.content)return{loaded:!0,contents:this.contents};this.contentState=ir.LOADING;try{return await this._loadContentFromSource()}catch(t){throw this.contentState=ir.FAILED,t}}async _loadContentFromSource(){let t=await this.tileset.source.loadTileContent(this);return t.contents&&(this.contents=t.contents,this.content=this.contents[0]||null),this.vectorContent=this.contents.find(r=>!!r?.vectorContent)?.vectorContent||null,this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this.contentState=ir.READY,this._onContentLoaded(),this._updateContentEntriesAfterLoad(t),t}async loadChildren(t){if(!this.header.implicitSubtree||this.childrenState==="ready")return{loaded:!1,tileCount:0,childSubtreeCount:0};if(this._childrenPromise)return await this._childrenPromise;if(!this.tileset.source.loadTileChildren)throw new Error("Tileset source does not support lazy tile children");this.childrenState="loading",this._childrenPromise=this._loadChildrenWithScheduler(t);try{return await this._childrenPromise}finally{this._childrenPromise=null}}async _loadChildrenWithScheduler(t){let r=await this.tileset._requestScheduler.scheduleRequest(`${this.id}:implicit-subtree`,this._getChildrenPriority.bind(this));if(!r)return this.childrenState="unloaded",{loaded:!1,tileCount:0,childSubtreeCount:0};try{let n=await this.tileset.source.loadTileChildren(this,t);return this.childrenState=n.loaded?"ready":"unloaded",n}catch(n){throw this.childrenState="failed",n}finally{r.done()}}applyImplicitSubtreeHeader(t){let r=this.header.transform,n=this.header.transformMatrix,i=t.transform!==void 0;this.header={...this.header,...t,transform:i?t.transform:r,transformMatrix:i?t.transformMatrix:n,implicitSubtree:void 0},i&&this._initializeTransforms(this.header),this.refine=this._getRefine(t.refine),this.type=t.type,this.contentUrl=t.contentUrl,this.contentUrls=t.contentUrls||(t.contentUrl?[t.contentUrl]:[]),this._initializeMetadata(this.header),this._initializeLodMetric(t),this._updateLodMetricScale(),this._initializeBoundingVolumes(this.header),this._boundingBox=void 0,this._initializeContent(this.header),this._initializeContentEntries(this.header)}_initializeMetadata(t){this.metadata=t.metadata||null;let r=Array.isArray(t.content)?t.content:[t.content];this.contentMetadata=r.filter(Boolean).map(a=>a.metadata||null);let i=(r.find(Boolean)||{}).group,o=typeof i=="number"?this.tileset.groups?.[i]||null:i||null,s={tileset:this.tileset.metadata||null,group:o,tile:this.metadata,content:this.contentMetadata[0]||null,subtree:t.implicitMetadata||null};this.tileset.groups&&(s.groups=this.tileset.groups),this.metadataContext=s}_updateContentEntriesAfterLoad(t){if(t.contentEntries){this.contentEntries=t.contentEntries.map((r,n)=>({...r,index:n,boundingVolume:r.boundingVolume||this._contentBoundingVolumes[n]||this.boundingVolume,payload:r.payload??this.contents[n]??null,featureIds:r.featureIds?.length?r.featureIds:Fd(r.payload??this.contents[n]),renderable:!!(r.renderable!==!1&&(r.payload??this.contents[n])&&!dv(r.payload??this.contents[n]))})),this.featureIdSets=this.contentEntries.flatMap(r=>r.featureIds);return}this.contentEntries=this.contentEntries.map((r,n)=>({...r,payload:this.contents[n]??null,featureIds:Fd(this.contents[n]),renderable:!!this.contents[n]&&!dv(this.contents[n])})),this.featureIdSets=this.contentEntries.flatMap(r=>r.featureIds)}getContentEntry(t){return this.contentEntries[t]||null}isContentRenderable(t){return!!this.contentEntries[t]?.renderable}_initializeContentEntries(t){let r=Array.isArray(t.content)?t.content:t.content?[t.content]:[];this.contentEntries=r.map((n,i)=>{let o=n||{};return{index:i,uri:this.contentUrls[i]||o.uri||o.url,group:o.group,type:o.type,payload:null,metadata:o.metadata||null,boundingVolume:this._contentBoundingVolumes[i]||this.boundingVolume,featureIds:this._getFeatureIdSets(o),renderable:!1}})}_getFeatureIdSets(t){return Fd(t)}unloadContent(){for(let t of this.contents.length?this.contents:[this.content])t&&t.destroy&&t.destroy();return this.contents=[],this.content=null,this.vectorContent=null,this.contentEntries=this.contentEntries.map(t=>({...t,payload:null,renderable:!1})),this.featureIdSets=this.contentEntries.flatMap(t=>t.featureIds),this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=ir.UNLOADED,this.tileDrawn=!0,!0}updateVisibility(t,r){if(this._frameNumber===t.frameNumber)return;let n=this.parent,i=n?n._visibilityPlaneMask:sr.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){let o=n?n.computedTransform:this.tileset.modelMatrix;this._updateTransform(o)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._updateRequestPriorityMetrics(t),this._visibilityPlaneMask=this.visibility(t,i),this._visible=this._visibilityPlaneMask!==sr.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=r}_updateRequestPriorityMetrics(t){if(this.tileset.type!==nr.TILES3D){this._screenSpaceErrorProgressiveResolution=this._screenSpaceError,this._priorityProgressiveResolution=!1,this._foveatedFactor=0,this.priorityDeferred=!1;return}let r=this.tileset.options,n=r.progressiveResolutionHeightFraction;if(this._screenSpaceErrorProgressiveResolution=this.getScreenSpaceError(t,!1,n),this._priorityProgressiveResolution=VS(this._screenSpaceErrorProgressiveResolution,this.parent?._screenSpaceErrorProgressiveResolution,this.tileset.memoryAdjustedScreenSpaceError,n),!r.foveatedScreenSpaceError||t.viewport?.orthographic||!t.camera?.position||!t.camera?.direction){this._foveatedFactor=0,this.priorityDeferred=!1;return}this._foveatedFactor=zS(this.boundingVolume,t.camera);let i=this.tileset._traverser,o=i.options.skipLevelOfDetail&&!i.disableSkipLevelOfDetail,s=kS({refinement:this.refine,skipLevelOfDetail:o,foveatedScreenSpaceError:r.foveatedScreenSpaceError,foveatedConeSize:r.foveatedConeSize,minimumScreenSpaceErrorRelaxation:r.foveatedMinimumScreenSpaceErrorRelaxation,interpolationCallback:r.foveatedInterpolationCallback,foveatedFactor:this._foveatedFactor,verticalFieldOfView:t.camera.verticalFieldOfView,screenSpaceError:this._screenSpaceError,parentScreenSpaceError:this.parent?._screenSpaceError,maximumScreenSpaceError:this.tileset.memoryAdjustedScreenSpaceError,priorityProgressiveResolution:this._priorityProgressiveResolution});this.priorityDeferred=qS(s,t.camera.timeSinceMovement,r.foveatedTimeDelay)}visibility(t,r){let{cullingVolume:n}=t,{boundingVolume:i}=this;return n.computeVisibilityWithPlaneMask(i,r)}contentVisibility(t,r){let n=r===void 0?this._contentBoundingVolumes:this._contentBoundingVolumes[r]?[this._contentBoundingVolumes[r]]:[];return pN(n,this.boundingVolume,t.cullingVolume,this._visibilityPlaneMask,t.clippingPlanes)}distanceToTile(t){let r=this.boundingVolume;return Math.sqrt(Math.max(r.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth({camera:t}){let r=this.boundingVolume;return R1.subVectors(r.center,t.position),t.direction.dot(R1)}insideViewerRequestVolume(t){let r=this._viewerRequestVolume;return!r||r.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(gN(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=ir.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){this._scaleGeometricError=typeof t._scaleGeometricError=="boolean"?t._scaleGeometricError:this.parent?._scaleGeometricError??!0,"lodMetricType"in t?this.lodMetricType=t.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in t?this._unscaledLodMetricValue=t.lodMetricValue:(this._unscaledLodMetricValue=this.parent?this.parent._unscaledLodMetricValue:this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue")),this.lodMetricValue=this._unscaledLodMetricValue}_initializeTransforms(t){this.transform=t.transform?new bt(t.transform):new bt;let r=this.parent,n=this.tileset,i=r&&r.computedTransform?r.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new bt(i).multiplyRight(this.transform);let o=r&&r._initialTransform?r._initialTransform.clone():new bt;this._initialTransform=new bt(o).multiplyRight(this.transform)}_updateLodMetricScale(){if(this.lodMetricType!==Wc.GEOMETRIC_ERROR||!this._scaleGeometricError){this.lodMetricValue=this._unscaledLodMetricValue;return}let t=this.computedTransform.getScale(R1),r=Math.max(t[0],t[1],t[2]);this.lodMetricValue=this._unscaledLodMetricValue*r}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._contentBoundingVolumeHeaders=[],this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.contents=[],this.hasEmptyContent=!0,this.contentState=ir.UNLOADED,this.hasTilesetContent=!1,(t.contentUrl||t.contentUrls?.length)&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._screenSpaceErrorProgressiveResolution=0,this._priorityProgressiveResolution=!1,this._foveatedFactor=0,this.priorityDeferred=!1,this._visibilityPlaneMask=sr.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(t){return t||this.parent&&this.parent.refine||Ge.REPLACE}_isTileset(){return(this.contents.length?this.contents:[this.content]).some(t=>t?.shape==="tileset3d")}_onContentLoaded(){let t=this.contents.length?this.contents:[this.content];for(let r of t)switch(r&&r.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0;break;default:}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(t){this._boundingBox=void 0,this.boundingVolume=Yc(t.boundingVolume,this.computedTransform,this.boundingVolume,this._initialTransform),t.viewerRequestVolume&&(this._viewerRequestVolume=Yc(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume,this._initialTransform));let r=t.content;r&&(this._contentBoundingVolumeHeaders=Array.isArray(r)?r:[r]);let n=r?Array.isArray(r)?r:[r]:this._contentBoundingVolumeHeaders;this._contentBoundingVolumes=n.length?n.map(i=>i?.boundingVolume?Yc(i.boundingVolume,this.computedTransform,void 0,this._initialTransform):this.boundingVolume):[this.boundingVolume],this._contentBoundingVolume=this._contentBoundingVolumes[0]||null}_updateTransform(t=new bt){let r=t.clone().multiplyRight(this.transform);r.equals(this.computedTransform)||(this.computedTransform=r,this._updateLodMetricScale(),this._updateBoundingVolume(this.header))}};co();Dr();jt();var zd=class extends Bi{pendingImplicitSubtrees=new Map;traversalFinished(t){let r=`${t.viewport.id}:`;for(let[n,i]of this.pendingImplicitSubtrees)if(n.startsWith(r)&&i===t.frameNumber)return!1;return!0}executeTraversal(t,r){if(!this.isSkipLevelOfDetailEnabled()){super.executeTraversal(t,r);return}this.executeSkipTraversal(t,r)}executeSkipTraversal(t,r){let n=[t];for(t._selectionDepth=t.parent?t.parent._selectionDepth:1;n.length>0;){let i=n.pop(),o=!i.parent||i.parent._shouldRefine,s=this.canTraverse(i,r)&&this.updateAndPushSkipChildren(i,r,n)&&o,a=!s&&o;i.hasRenderContent?i.refine===Ge.ADD?(this.loadTile(i,r),this.selectDesiredTile(i,r)):i.refine===Ge.REPLACE&&(this.isInBaseTraversal(i,r)?(this.loadTile(i,r),a&&this.selectDesiredTile(i,r)):a?(this.loadTile(i,r),this.selectDesiredTile(i,r)):this.hasReachedSkippingThreshold(i,r)&&this.loadTile(i,r)):(this.emptyTiles[i.id]=i,this.loadTile(i,r),a&&(!i.hasEmptyContent||i.hasChildren)&&this.selectDesiredTile(i,r)),this.touchTile(i,r),i._shouldRefine=s}this.completeTraversal(r)}updateAndPushSkipChildren(t,r,n){this.updateChildTiles(t,r),t.children.sort(this.compareDistanceToCamera.bind(this));let i=!1;for(let o of t.children)o._selectionDepth=t.hasRenderContent?t._selectionDepth+1:t._selectionDepth,o.isVisibleAndInRequestVolume?(n.push(o),i=!0):this.options.loadSiblings&&o._inRequestVolume&&(this.loadTile(o,r),this.touchTile(o,r));return i}isInBaseTraversal(t,r){if(this.options.immediatelyLoadDesiredLevelOfDetail)return!1;if(!this.findNearestRequestedOrLoadedAncestor(t,r))return!0;let n=Number.isFinite(this.options.baseScreenSpaceError)?Math.max(this.options.baseScreenSpaceError,0):1024,i=Math.max(n,t.tileset.memoryAdjustedScreenSpaceError);return t._screenSpaceError===0&&t.parent?t.parent._screenSpaceError>i:t._screenSpaceError>i}hasReachedSkippingThreshold(t,r){if(this.options.immediatelyLoadDesiredLevelOfDetail)return!1;if(t._priorityProgressiveResolution&&t._screenSpaceErrorProgressiveResolution<=t.tileset.memoryAdjustedScreenSpaceError&&!!(t.parent&&t.parent._screenSpaceErrorProgressiveResolution>t.tileset.memoryAdjustedScreenSpaceError))return!0;let i=this.findNearestRequestedOrLoadedAncestor(t,r);if(!i)return!1;let o=Number.isFinite(this.options.skipScreenSpaceErrorFactor)&&this.options.skipScreenSpaceErrorFactor>0?this.options.skipScreenSpaceErrorFactor:16,s=Number.isFinite(this.options.skipLevels)?Math.max(Math.floor(this.options.skipLevels),0):1;return t._screenSpaceError<i._screenSpaceError/o&&t.depth>i.depth+s}findNearestRequestedOrLoadedAncestor(t,r){let n=t.parent;for(;n;){if(n.hasRenderContent&&!n.contentFailed&&(!n.hasUnloadedContent||n._requestedFrame===r.frameNumber))return n;n=n.parent}return null}selectDesiredTile(t,r){let n=t;for(;n;){if(this.shouldSelectTile(n,r)){this.selectTile(n,r),n!==t&&this.selectLoadedDescendants(t,r,!0);return}n=n.parent}this.selectLoadedDescendants(t,r)}selectLoadedDescendants(t,r,n=!1){let i=[{tile:t,depth:0}];for(;i.length>0;){let{tile:o,depth:s}=i.pop();for(let a of o.children)this.updateTile(a,r),a.isVisibleAndInRequestVolume&&(this.shouldSelectTile(a,r)&&(!n||a.tileDrawn)?(this.selectTile(a,r),this.touchTile(a,r)):s<1&&i.push({tile:a,depth:s+1}))}}compareDistanceToCamera(t,r){return r._distanceToCamera===0&&t._distanceToCamera===0?r._centerZDepth-t._centerZDepth:r._distanceToCamera-t._distanceToCamera}updateChildTiles(t,r){let n=t.header.implicitSubtree?.coordinates.level===0;if(t.hasUnloadedChildren&&t.isVisibleAndInRequestVolume&&(n||this.shouldRefine(t,r))){let i=`${r.viewport.id}:${t.id}`;this.pendingImplicitSubtrees.has(i)||(this.pendingImplicitSubtrees.set(i,r.frameNumber),t.tileset._loadTileChildren(t,r).finally(()=>{this.handleImplicitSubtreeLoad(t,r,i)}))}super.updateChildTiles(t,r)}handleImplicitSubtreeLoad(t,r,n){this.pendingImplicitSubtrees.delete(n),this._frameNumber===r.frameNumber&&(t.childrenState==="ready"?this.executeTraversal(t,r):this.traversalFinished(r)&&this.options.onTraversalEnd(r))}updateTileVisibility(t,r){if(super.updateTileVisibility(t,r),!t.isVisibleAndInRequestVolume)return;let n=t.children.length>0;if(t.hasTilesetContent&&n){let s=t.children[0];this.updateTileVisibility(s,r),t._visible=s._visible;return}if(this.meetsScreenSpaceErrorEarly(t,r)){t._visible=!1;return}let i=t.refine===Ge.REPLACE,o=t._optimChildrenWithinParent===DS.USE_OPTIMIZATION;if(i&&o&&n&&!this.anyChildrenVisible(t,r)){t._visible=!1;return}}meetsScreenSpaceErrorEarly(t,r){let{parent:n}=t;return!n||n.hasTilesetContent||n.refine!==Ge.ADD?!1:!this.shouldRefine(t,r,!0)}};jt();ro();Dr();var yN=6378137,wN=6378137,C1=6356752314245179e-9,Kc=new E;function mv(e,t){if(e instanceof eo){let{halfAxes:r}=e,n=_N(r);return Math.log2(C1/(n+t[2]))}else if(e instanceof en){let{radius:r}=e;return Math.log2(C1/(r+t[2]))}else if(e.width&&e.height){let{width:r,height:n}=e,i=Math.log2(yN/r),o=Math.log2(wN/n);return(i+o)/2}return 1}function N1(e,t,r){pt.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],Kc);let n=Math.sqrt(Math.pow(Kc[0]-r[0],2)+Math.pow(Kc[1]-r[1],2)+Math.pow(Kc[2]-r[2],2));return Math.log2(C1/(n+t[2]))}function pv(e,t,r){let[n,i,o,s]=e;return N1({xmin:n,xmax:o,ymin:i,ymax:s,zmin:0,zmax:0},t,r)}function _N(e){e.getColumn(0,Kc);let t=e.getColumn(1),r=e.getColumn(2);return Kc.add(t).add(r).len()}var MN=Object.freeze({meter:1,millimeter:.001,centimeter:.01,decimeter:.1,kilometer:1e3,foot:.3048,yard:.9144,mile:1609.344,"us-foot":.3048006096012192,"us-inch":.0254000508001016,"us-yard":.9144018288036576,"us-mile":1609.3472186944373,"clarke-foot":.3047972654,"clarke-yard":.9143917962,"clarke-link":.201166195164,"sears-yard":.914398414616,"sears-foot":.304799471539,"sears-chain":20.1167651216,"sears-1922-truncated-chain":20.116756,"benoit-1895-b-chain":20.1167824944,"indian-yard":.914398530744,"indian-1937-yard":.91439523,"gold-coast-foot":.304799710181}),bN=Object.freeze({m:"meter",metre:"meter",meters:"meter",metres:"meter",mm:"millimeter",millimetre:"millimeter",millimeters:"millimeter",millimetres:"millimeter",cm:"centimeter",centimetre:"centimeter",centimeters:"centimeter",centimetres:"centimeter",dm:"decimeter",decimetre:"decimeter",decimeters:"decimeter",decimetres:"decimeter",km:"kilometer",kilometre:"kilometer",kilometers:"kilometer",kilometres:"kilometer",ft:"foot",feet:"foot","us-survey-foot":"us-foot","us-survey-feet":"us-foot",yd:"yard",yards:"yard",mi:"mile",miles:"mile"});function Uh(e){if(!e)return;let t=e.trim().toLowerCase().replaceAll("_","-"),r=bN[t]||t;return MN[r]}function gv(e,t){return t!==void 0?Number.isFinite(t)&&t>0?t:void 0:e?Uh(e):1}function Vd(e){let t=e.spatialReference||e.fullExtent?.spatialReference,r=TN(t),n=e.heightModelInfo?.vertCRS||IN(t),i=e.heightModelInfo?.heightModel,o=e.heightModelInfo?.heightUnit,s=gv(o,e.ZFactor),a=i==="ellipsoidal"?"ellipsoidal":i==="gravity_related_height"?"orthometric":"unknown",c=_v(t),l=c===void 0?r?_n(r):"unknown":_n(`EPSG:${c}`),h=xN(l,o,e.ZFactor),u=[],f=SN(e.elevationInfo?.mode),d=e.elevationInfo?e.elevationInfo.unit||"meter":void 0,m=Uh(d);return s===void 0&&u.push(e.ZFactor!==void 0?`I3S ZFactor ${e.ZFactor} is not a positive finite conversion factor`:`Unsupported I3S vertical unit ${o}`),e.elevationInfo&&m===void 0&&u.push(`Unsupported I3S elevation unit ${d}`),e.elevationInfo?.mode&&!f&&u.push(`Unsupported I3S elevation mode ${e.elevationInfo.mode}`),f&&f!=="absoluteHeight"&&u.push(`I3S elevation mode ${f} requires a terrain or scene elevation provider`),Mn({sourceCrs:r,sourceCrsRepresentation:c!==void 0?"identifier":r?"wkt":void 0,sourceCrsAlternatives:c!==void 0&&t?.wkt?[{definition:t.wkt,representation:"wkt"}]:void 0,verticalCrs:n,units:h,verticalUnitScale:s??Number.NaN,heightReference:a,elevationMode:f,elevationOffset:e.elevationInfo?.offset,elevationUnit:d,elevationUnitScale:e.elevationInfo?.mode&&!f?Number.NaN:m??(e.elevationInfo?Number.NaN:1),coordinateFrame:l,axisOrder:r?"xyz":"unknown",provenance:r?"metadata":"unknown",warnings:u})}function xN(e,t,r){if(e==="geocentric")return["meter","meter","meter"];if(e==="geographic"&&(t||r===void 0))return["degree","degree",t||"meter"]}function SN(e){switch(e){case"absoluteHeight":case"onTheGround":case"relativeToGround":case"relativeToScene":return e;default:return}}function kd(e){let t=vN(e);if(t)return t;let r=yv(e,"TILESET_CRS_GEOCENTRIC"),n=yv(e,"TILESET_CRS_COORDINATE_EPOCH"),i=[],o,s="unknown",a;typeof r=="string"&&r.toUpperCase()!=="UNKNOWN"?(o=r,s="metadata",a="explicit"):r!==void 0?(i.push("3D Tiles geocentric CRS is explicitly unknown"),s="metadata",a="unknown"):e.root?.boundingVolume?.region?(o="EPSG:4978",s="format-default",a="default"):e.schemaUri&&!e.schema&&i.push("External 3D Tiles metadata schema must be loaded before CRS semantics can resolve");let c=wv(n);return n!==void 0&&c===void 0&&i.push("3D Tiles coordinate epoch is not a finite decimal year"),Mn({sourceCrs:o,sourceCrsState:a,sourceCrsRepresentation:o?"identifier":void 0,coordinateEpoch:c,heightReference:o?"ellipsoidal":"unknown",coordinateFrame:o?"geocentric":"unknown",axisOrder:o?"xyz":"unknown",provenance:s,warnings:i})}function vN(e){let t=e.extensions?.EXT_geospatial_crs;if(!t)return;let r=[],n,i,o,s;if(t.format==="wkid"){let h=t.extensions?.EXT_geospatial_crs_wkid;typeof h?.authority=="string"&&Number.isInteger(h.wkid)?(n=`${h.authority}:${h.wkid}`,s="identifier",Number.isInteger(h.vcsWkid)&&(i=`${h.authority}:${h.vcsWkid}`),o=wv(h.epoch),h.epoch!==void 0&&o===void 0&&r.push("EXT_geospatial_crs_wkid epoch is not a finite decimal year")):r.push("EXT_geospatial_crs_wkid requires string authority and integer wkid")}else if(t.format==="wkt2"){let h=t.extensions?.EXT_geospatial_crs_wkt2;typeof h?.wkt2=="string"&&h.wkt2.trim()?(n=h.wkt2,s="wkt"):r.push("EXT_geospatial_crs_wkt2 requires a nonempty wkt2 string")}else r.push(`Unsupported EXT_geospatial_crs format ${String(t.format)}`);let a=s==="wkt"?_n(n):M1(n)||"unknown",c=EN(i);i&&!c&&r.push(`Unsupported vertical CRS ${String(i)}; vertical unit and height reference are unknown`);let l=i?c?.unit:"meter";return Mn({sourceCrs:n,sourceCrsState:n?"explicit":"unknown",sourceCrsRepresentation:s,verticalCrs:i,coordinateEpoch:o,units:a==="geocentric"?["meter","meter","meter"]:a==="geographic"&&l?["degree","degree",l]:void 0,verticalUnitScale:i?c?.verticalUnitScale??Number.NaN:1,heightReference:i?c?.heightReference??"unknown":n?"ellipsoidal":"unknown",coordinateFrame:a,axisOrder:n?"xyz":"unknown",provenance:"metadata",warnings:r})}function EN(e){if(typeof e!="string")return;let t=/^EPSG:(\d+)$/i.exec(e);if(t)switch(Number(t[1])){case 5702:case 6360:return{unit:"us-foot",verticalUnitScale:1200/3937,heightReference:"orthometric"};case 5703:return{unit:"meter",verticalUnitScale:1,heightReference:"orthometric"};default:return}}function wv(e){if(typeof e!="string"&&typeof e!="number"||typeof e=="string"&&!e.trim())return;let t=Number(e);return Number.isFinite(t)?t:void 0}function TN(e){let t=_v(e);return t!==void 0?`EPSG:${t}`:e?.wkt}function IN(e){let t=e?.latestVcsWkid??e?.vcsWkid;return t===void 0?void 0:`EPSG:${t}`}function _v(e){return e?.latestWkid??e?.wkid}function yv(e,t){let r=e.metadata?.class;if(!r)return;let i=e.schema?.classes?.[r]?.properties,o=e.metadata?.properties;for(let[s,a]of Object.entries(i||{}))if(a.semantic===t)return o?.[s]}jt();Dr();function Mv(e){return{input:new Float64Array(e),output:new Float64Array(e)}}function Gh(e){return e instanceof Float32Array||e instanceof Float64Array}function bv(e){return typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer}function O1(e,t,r,n,i,o){return(e.buffer===n.buffer||bv(e.buffer)&&bv(n.buffer))&&t<o&&i<r}function qd(e,t,r,n){return e<t+n?0:Math.floor((e-t-n)/r)+1}var jd=class{constructor(t){this.depth=0;let r=t.dimension??2,n=t.inputOffset??0,i=t.outputOffset??0;if(!Number.isSafeInteger(r)||r<2||!Number.isSafeInteger(n)||n<0||!Number.isSafeInteger(i)||i<0||t.inputStride!==void 0&&(!Number.isSafeInteger(t.inputStride)||t.inputStride<1)||t.outputStride!==void 0&&(!Number.isSafeInteger(t.outputStride)||t.outputStride<1)||typeof t.projection?.projectToSync!="function"||typeof t.projection?.unprojectToSync!="function")throw new Error("Invalid projection buffer transform or layout");this.dimension=r,this.projection=t.projection,this.inputOffset=n,this.outputOffset=i,this.inputStride=t.inputStride,this.outputStride=t.outputStride,this.scratch=[Mv(r)]}projectFlatTo(t,r,n,i=0,o){return this.flat(t,r,n,i,!1,o)}unprojectFlatTo(t,r,n,i=0,o){return this.flat(t,r,n,i,!0,o)}projectColumnsTo(t,r,n,i=0,o){return this.columns(t,r,n,i,!1,o)}unprojectColumnsTo(t,r,n,i=0,o){return this.columns(t,r,n,i,!0,o)}range(t,r,n){let i=r??Math.max(0,t-n);if(!Number.isSafeInteger(n)||n<0||!Number.isSafeInteger(i)||i<0||!Number.isSafeInteger(n+i)||n+i>t)throw new Error("Invalid projection buffer record range");return i}epochStorage(t,r,n){if(t!==void 0){if(typeof t=="number"){if(!Number.isFinite(t))throw new Error("Coordinate epoch must be finite")}else if(!Gh(t)||t.length<r+n)throw new Error("Epoch buffer requires one value per addressed record")}}aliases(t,r,n,i,o,s,a){if(!i)return;let c=t.byteOffset+(this.inputOffset+n*o)*t.BYTES_PER_ELEMENT,l=c+((i-1)*o+a)*t.BYTES_PER_ELEMENT,h=r.byteOffset+(this.outputOffset+n*s)*r.BYTES_PER_ELEMENT,u=h+((i-1)*s+a)*r.BYTES_PER_ELEMENT,f=t.buffer===r.buffer&&t.constructor===r.constructor&&c===h&&o===s;if(O1(t,c,l,r,h,u)&&!f)throw new Error("Projection input/output ranges overlap without an exact in-place mapping")}epochAlias(t,r,n,i,o,s){if(typeof t!="object"||!t||!i)return;let a=t.byteOffset+n*t.BYTES_PER_ELEMENT,c=a+i*t.BYTES_PER_ELEMENT,l=r.byteOffset+(this.outputOffset+n*o)*r.BYTES_PER_ELEMENT,h=l+((i-1)*o+s)*r.BYTES_PER_ELEMENT;if(O1(t,a,c,r,l,h))throw new Error("Epoch and output buffers must not overlap")}acquire(){var t;let r=this.depth++;return(t=this.scratch)[r]||(t[r]=Mv(this.dimension)),this.scratch[r]}transform(t,r,n){if(n!==void 0&&!Number.isFinite(n))throw new Error("Coordinate epoch must be finite");r?this.projection.unprojectToSync(t.input,t.output,n):this.projection.projectToSync(t.input,t.output,n)}floatRange(t,r){for(let n=0;n<this.dimension;n++){let i=t[n];if(n<3&&!Number.isFinite(i)||r&&Number.isFinite(i)&&Math.abs(i)>34028234663852886e22)throw new Error("Projection output is nonfinite or exceeds Float32 range")}}flat(t,r,n,i,o,s){if(!Gh(t)||!Gh(r))throw new Error("Projection buffers require Float32Array or Float64Array");let a=this.inputStride??this.dimension,c=this.outputStride??this.dimension;if(a<this.dimension||c<this.dimension)throw new Error("Interleaved stride must contain every ordinate");let l=this.range(qd(t.length,this.inputOffset,a,this.dimension),n,i);if(i+l>qd(r.length,this.outputOffset,c,this.dimension))throw new Error("Projection output buffer is too short");this.epochStorage(s,i,l),this.aliases(t,r,i,l,a,c,this.dimension),this.epochAlias(s,r,i,l,c,this.dimension);let h=this.acquire();try{let u=typeof s=="number"?void 0:s,f=r instanceof Float32Array;for(let d=i;d<i+l;d++){let m=this.inputOffset+d*a,p=this.outputOffset+d*c;for(let g=0;g<this.dimension;g++)h.input[g]=t[m+g];this.transform(h,o,u?u[d]:s),this.floatRange(h.output,f);for(let g=0;g<this.dimension;g++)r[p+g]=h.output[g]}return r}finally{this.depth--}}columns(t,r,n,i,o,s){if(t.length!==this.dimension||r.length!==this.dimension)throw new Error("Projection columns must match dimension");let a=this.inputStride??1,c=this.outputStride??1,l=Number.MAX_SAFE_INTEGER;for(let f=0;f<this.dimension;f++){if(!Gh(t[f])||!Gh(r[f]))throw new Error("Projection columns require floating typed arrays");l=Math.min(l,qd(t[f].length,this.inputOffset,a,1))}let h=this.range(l,n,i);this.epochStorage(s,i,h);for(let f=0;f<this.dimension;f++){if(i+h>qd(r[f].length,this.outputOffset,c,1))throw new Error("Projection output column is too short");this.epochAlias(s,r[f],i,h,c,1);for(let d=0;d<this.dimension;d++)this.aliases(t[f],r[d],i,h,a,c,1);for(let d=0;d<f&&h;d++){let m=r[f].byteOffset+(this.outputOffset+i*c)*r[f].BYTES_PER_ELEMENT,p=r[d].byteOffset+(this.outputOffset+i*c)*r[d].BYTES_PER_ELEMENT;if(O1(r[f],m,m+((h-1)*c+1)*r[f].BYTES_PER_ELEMENT,r[d],p,p+((h-1)*c+1)*r[d].BYTES_PER_ELEMENT))throw new Error("Projection output columns overlap")}}let u=this.acquire();try{let f=typeof s=="number"?void 0:s;for(let d=i;d<i+h;d++){let m=this.inputOffset+d*a,p=this.outputOffset+d*c;for(let g=0;g<this.dimension;g++)u.input[g]=t[g][m];this.transform(u,o,f?f[d]:s);for(let g=0;g<this.dimension;g++){let y=u.output[g];if(g<3&&!Number.isFinite(y)||r[g]instanceof Float32Array&&Number.isFinite(y)&&Math.abs(y)>34028234663852886e22)throw new Error("Projection output is nonfinite or exceeds Float32 range")}for(let g=0;g<this.dimension;g++)r[g][p]=u.output[g]}return r}finally{this.depth--}}};jt();var AN=240,PN=[9,-18,-88,0,96,90,0,0,-60,-20,-9,18,8,0,-96,30,0,0,60,-20,9,-88,-18,90,96,0,-20,-60,0,0,186,-42,-42,-150,-96,-150,60,60,60,60,54,162,-78,30,-24,-90,-60,60,-60,60,-9,-32,18,30,24,0,20,-60,0,0,-9,8,18,30,-96,0,-20,60,0,0,54,-78,162,-90,-24,30,60,-60,60,-60,-54,78,78,90,144,90,-60,-60,-60,-60,9,-8,-18,-30,-24,0,20,60,0,0,-9,18,-32,0,24,30,0,0,-60,20,9,-18,-8,0,-24,-30,0,0,60,20],RN=372,CN=[0,0,-131,0,138,144,0,0,-102,-31,0,0,7,0,-138,42,0,0,102,-31,62,0,-31,0,0,-62,0,0,0,31,124,0,-62,0,0,-124,0,0,0,62,124,0,-62,0,0,-124,0,0,0,62,62,0,-31,0,0,-62,0,0,0,31,0,0,45,0,-183,-9,0,93,18,0,0,0,216,0,33,87,0,-93,12,-93,0,0,156,0,153,99,0,-93,-12,-93,0,0,-45,0,-3,9,0,93,-18,0,0,0,-55,0,48,42,0,0,-84,31,0,0,-7,0,-48,-42,0,0,84,31],NN=372,ON=[18,-36,-122,0,120,135,0,0,-84,-31,-18,36,-2,0,-120,51,0,0,84,-31,36,-165,-27,93,147,-9,0,-93,18,0,210,45,-111,-93,-57,-192,0,93,12,93,162,141,-75,-93,-129,-180,0,93,-12,93,-36,-21,27,93,39,9,0,-93,-18,0,0,0,62,0,0,31,0,0,0,-31,0,0,124,0,0,62,0,0,0,-62,0,0,124,0,0,62,0,0,0,-62,0,0,62,0,0,31,0,0,0,-31,-18,36,-64,0,66,51,0,0,-102,31,18,-36,2,0,-66,-51,0,0,102,31],BN=12,B1=20/2,LN=2,zh=class{constructor(t){this._v00=0,this._v01=0,this._v10=0,this._v11=0,this._t=[],this.options=t,this._ix=this.options._width,this._iy=this.options._height,this._hasUint16Data=Cf(t.data)}getHeight(t,r){if(t=Math.abs(t)>90?NaN:t,Number.isNaN(t)||Number.isNaN(r))return NaN;let n=DN(r,360);r=n!==-180?n:180;let i=r*this.options._rlonres,o=-t*this.options._rlatres,s=Math.floor(i),a=Math.min(Math.round((this.options._height-1)/2-1),Math.floor(o));i-=s,o-=a,a+=(this.options._height-1)/2,s+=s<0?this.options._width:s>=this.options._width?-this.options._width:0;let c=0,l=0,h=0,u=0,f=new Array(B1);if(s===this._ix&&a===this._iy)this.options.cubic?f=this._t:(c=this._v00,l=this._v01,h=this._v10,u=this._v11);else if(!this.options.cubic)c=this._rawval(s,a),l=this._rawval(s+1,a),h=this._rawval(s,a+1),u=this._rawval(s+1,a+1);else{let m=[this._rawval(s,a-1),this._rawval(s+1,a-1),this._rawval(s-1,a),this._rawval(s,a),this._rawval(s+1,a),this._rawval(s+2,a),this._rawval(s-1,a+1),this._rawval(s,a+1),this._rawval(s+1,a+1),this._rawval(s+2,a+1),this._rawval(s,a+2),this._rawval(s+1,a+2)],p=CN;a!==0&&(p=a===this.options._height-2?ON:PN);let g=RN;a!==0&&(g=a===this.options._height-2?NN:AN);for(let y=0;y<B1;++y){f[y]=0;for(let _=0;_<BN;++_)f[y]+=m[_]*p[B1*_+y];f[y]/=g}}if(!this.options.cubic){let m=(1-i)*c+i*l,p=(1-i)*h+i*u,g=(1-o)*m+o*p,y=this.options._offset+this.options._scale*g;return this._ix=s,this._iy=a,this._v00=c,this._v01=l,this._v10=h,this._v11=u,y}let d=f[0]+i*(f[1]+i*(f[3]+i*f[6]))+o*(f[2]+i*(f[4]+i*f[7])+o*(f[5]+i*f[8]+o*f[9]));return d=this.options._offset+this.options._scale*d,this._ix=s,this._iy=a,this._t=f,d}_rawval(t,r){t<0?t+=this.options._width:t>=this.options._width&&(t-=this.options._width),(r<0||r>=this.options._height)&&(r=r<0?-r:2*(this.options._height-1)-r,t+=(t<this.options._width/2?1:-1)*this.options._width/2);let n=r*this.options._swidth+t;if(this._hasUint16Data)return this.options.data[this.options._datastart+n];let i=this.options._datastart+LN*n,o=this.options.data[i],s=this.options.data[i+1];return o<<8|s}};function DN(e,t){t=Math.abs(t);let r=xv(e,t);return 2*Math.abs(r)===t?r-=xv(e,2*t)-r:2*Math.abs(r)>t&&(r+=r<0?t:-t),r}function xv(e,t){return e-Math.floor(e/t)*t}var FN=10,UN=65535;function Wd(e,t){let r=GN(e),n=r.next();if(n.done||n.value.line!=="P5")throw new Error("Geoid model file: File not in PGM format");let i=Number.MAX_VALUE,o=0,s=-1,a=-1,c="NONE",l="UNKNOWN",h=0,u=0,f=null,d=null;do{n=r.next();let y=n.value.line;if(y.length)if(y[0]==="#"){let _=y.split(" "),b=_[0],M=_[1];if(b!=="#"||!M)continue;let T=_.length>2?_.slice(2):[];if(M==="Description")c=T.join(" ");else if(M==="DateTime")l=T.join(" ");else if(M==="Offset"){if(!_[2])throw new Error("Geoid model file: Error reading offset");i=parseInt(_[2],10)}else if(M==="Scale"){if(!_[2])throw new Error("Geoid model file: Error reading scale");o=parseFloat(_[2])}else M===(t.cubic?"MaxCubicError":"MaxBilinearError")?isFinite(parseFloat(_[2]))&&(s=parseFloat(_[2])):M===(t.cubic?"RMSCubicError":"RMSBilinearError")&&isFinite(parseFloat(_[2]))&&(a=parseFloat(_[2]))}else{let _=y.split(" ");if(_=_.filter(b=>b!==""),h=parseInt(_[0],10),u=parseInt(_[1],10),!(h&&u))throw new Error("Geoid model file: Error reading raster size");break}}while(!n.done);n=r.next();let m=parseInt(n.value.line,10);if(n.done)throw new Error("Geoid model file: Error reading maxval");if(m!==UN)throw new Error("Geoid model file: Incorrect value of maxval");if(f=n.value.offset,d=h,i===Number.MAX_VALUE)throw new Error("Geoid model file: Offset not set");if(o===0)throw new Error("Geoid model file: Scale not set");if(o<0)throw new Error("Geoid model file: Scale must be positive");if(u<2||h<2)throw new Error("Geoid model file: Raster size too small");if(h&1)throw new Error("Geoid model file: Raster width is odd");if(!(u&1))throw new Error("Geoid model file: Raster height is even");let p=h/360,g=(u-1)/180;return new zh({cubic:t.cubic,_width:h,_height:u,_rlonres:p,_rlatres:g,_offset:i,_scale:o,_swidth:d,_datastart:f,_maxerror:s,_rmserror:a,_description:c,_datetime:l,data:e})}function*GN(e){let t=0;do{let r=e.indexOf(FN,t);if(r!==-1){let n=e.subarray(t,r);t=r+1,yield{offset:t,line:Sv(n)}}else{let n=e.subarray(t,e.length);t=e.length,yield{offset:t,line:Sv(n)}}}while(t<e.length);return{offset:t,line:""}}function Sv(e){let t="";for(let r of e)t+=String.fromCharCode(r);return t}da();function vv(){return{bounds:[[-1,-1,0],[1,1,0]]}}var L1=Symbol.for("@math.gl/projection/projection-implementations");function D1(){let e=globalThis;return e[L1]||(e[L1]=new WeakMap),e[L1]}function Ev(e){return"create"in e?e:D1().get(e)?.implementation}function Tv(e){if("create"in e)return Promise.resolve(e);let t=D1().get(e);if(t||(t={load:()=>e.preload()},D1().set(e,t)),t.implementation)return Promise.resolve(t.implementation);let r=t;return r.pending||(r.pending=Promise.resolve().then(r.load).then(n=>{let i=s=>s.toLowerCase().replace(/[\s_-]/g,""),o=new Set([n.name,...n.aliases||[]].map(i));if(typeof n.create!="function"||![e.name,...e.aliases||[]].every(s=>o.has(i(s))))throw new Error("Loaded projection does not match descriptor: "+e.name);return r.implementation=n,n}).catch(n=>{throw r.pending=void 0,n})),r.pending}ma();Xf();var Hd=34028234663852886e22;function Ea(e,t,r){if(!(Array.isArray(e)||e instanceof Float32Array||e instanceof Float64Array))throw new Error("Scalar input requires a number array, Float32Array or Float64Array");if(!(Array.isArray(t)||t instanceof Float32Array||t instanceof Float64Array)||t.length<r)throw new Error("Scalar output requires a preallocated number array, Float32Array or Float64Array with sufficient capacity");if(e===t||Array.isArray(e)||Array.isArray(t))return;let n=e,i=t,o=typeof SharedArrayBuffer<"u"&&n.buffer instanceof SharedArrayBuffer&&i.buffer instanceof SharedArrayBuffer;if((n.buffer===i.buffer||o)&&n.byteOffset<i.byteOffset+r*i.BYTES_PER_ELEMENT&&i.byteOffset<n.byteOffset+n.byteLength)throw new Error("Scalar input/output views overlap; use the same view for in-place projection")}function Vh(e,t,r,n){if(t instanceof Float32Array){if(Math.abs(r.x)>Hd||Math.abs(r.y)>Hd||n>=3&&Math.abs(r.z)>Hd)throw new Error("Projected coordinate exceeds Float32 range");for(let i=3;i<e.length;i++){let o=e[i];if(Number.isFinite(o)&&Math.abs(o)>Hd)throw new Error("Trailing ordinate exceeds Float32 range")}}for(let i=3;i<e.length;i++)t[i]=e[i];return t[0]=r.x,t[1]=r.y,n>=3&&(t[2]=r.z),t}Nc();Pg();var Iv,Av=Symbol.for("@math.gl/projection/TypeScriptCRSError"),xn=class e extends Error{static[(Iv=Av,Symbol.hasInstance)](t){return this!==e?Function.prototype[Symbol.hasInstance].call(this,t):t instanceof Error&&t[Av]===!0}constructor(t,r){super(r),this.reason=t,this[Iv]=!0,this.name="TypeScriptCRSError"}};function Bt(e){throw new xn("missing-transform-stage",e)}function kh(e,t){if(typeof e=="string"||"type"in e)return{definition:e,lossy:!1};let r=e,n="crs"in r?r:void 0,i="crs"in r?r.crs:r;if(i.state!=="explicit"&&i.state!=="default")throw new xn("unknown-syntax","Cannot transform an "+i.state+" CRS reference");let o=!1;return n?.coordinateEpoch!==void 0&&Bt("Coordinate epochs require a time-dependent transformation"),n?.vertical&&n.vertical.state!=="absent"&&(t.mode!=="horizontal"&&Bt("A separately declared vertical CRS requires explicit horizontal extraction"),o=!0),{definition:i.definition,spatialReference:n,lossy:o}}function Pv(e,t){if(!t)return e;if(t.coordinateFrame!=="unknown"&&t.coordinateFrame!==e.kind)throw new Error("SpatialReference coordinate frame disagrees with its CRS");let r=t.coordinateOrder,n=e.kind==="geocentric"?{x:"e",y:"n",z:"u"}:{longitude:"e",lon:"e",latitude:"n",lat:"n",easting:"e",northing:"n",height:"u",altitude:"u",x:"e",y:"n",z:"u"},i;if(r.length&&(i=r.slice(0,3).map(o=>n[o.toLowerCase()]||"?").join(""),i.length===2&&(i+="u"),(i.length!==3||!i.includes("e")||!i.includes("n")||!i.includes("u"))&&Bt("Unsupported SpatialReference coordinate order"),(r.length>4||r.length>3&&!["m","measure"].includes(r[3]))&&Bt("Unsupported fourth coordinate component")),t.units?.length){let o={m:1,meter:1,metre:1,meters:1,metres:1,km:1e3,ft:.3048,"us-ft":.3048006096012192,degree:Math.PI/180,degrees:Math.PI/180,radian:1,radians:1,grad:Math.PI/200};for(let s=0;s<Math.min(t.units.length,3);s++){let a=(i||"enu")[s]==="u",c=e.kind==="geocentric"?e.toMeter:a?e.verticalUnit:e.kind==="geographic"?e.angularUnit:e.toMeter;(Math.abs((o[t.units[s]]??NaN)-c)>1e-12||o[t.units[s]]===void 0)&&Bt("SpatialReference units disagree with its CRS")}}return Object.freeze({...e,storedAxis:i})}Ee();var Rv={towgs84:"0,0,0",ellipse:"WGS84"},Cv={towgs84:"0,0,0",ellipse:"GRS80"},F1={wgs84:Rv,WGS84:Rv,nad83:Cv,North_American_Datum_1983:Cv},Nv=new WeakMap,Ta=e=>e.toLowerCase().replace(/[\s_-]/g,"");function Xc(e){if(!e.datumCatalogs?.length)return F1;let t=Nv.get(e);if(t?.catalogs===e.datumCatalogs)return t.definitions;let r=Object.assign(Object.create(null),F1),n=new Map(Object.entries(F1).map(([i,o])=>[Ta(i),{definition:o,owner:-1}]));return e.datumCatalogs.forEach((i,o)=>{if(!i.name||!i.datums)throw new Error("Invalid datum catalogue plugin");for(let[s,a]of Object.entries(i.datums)){let c=Ta(s);if(!c||c==="none"||!a||["ellipse","towgs84","nadgrids"].some(h=>a[h]!==void 0&&typeof a[h]!="string"))throw new Error("Invalid datum definition: "+s);let l=n.get(c);if(l&&(l.owner!==o||l.definition.ellipse!==a.ellipse||l.definition.towgs84!==a.towgs84||l.definition.nadgrids!==a.nadgrids))throw new Error("Conflicting datum registration: "+s);n.set(c,{definition:a,owner:o}),r[s]=a}}),Nv.set(e,{catalogs:e.datumCatalogs,definitions:r}),r}var VN={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"},andrae:{a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"},clrk80:{a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:63782492e-1,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"},plessis:{a:6376523,b:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:63558348467e-4,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS72:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}},Ov=VN;var on={};on.greenwich=0;on.lisbon=-9.131906111111;on.paris=2.337229166667;on.bogota=-74.080916666667;on.madrid=-3.687938888889;on.rome=12.452333333333;on.bern=7.439583333333;on.jakarta=106.807719444444;on.ferro=-17.666666666667;on.brussels=4.367975;on.stockholm=18.058277777778;on.athens=23.7163375;on.oslo=10.722916666667;var Bv=on;Rg();var Lv={WGS84:"+proj=longlat +datum=WGS84","EPSG:4326":"+proj=longlat +datum=WGS84","EPSG:4269":"+proj=longlat +datum=NAD83","EPSG:4978":"+proj=geocent +datum=WGS84","EPSG:4979":"+proj=longlat +datum=WGS84","EPSG:3857":"+proj=merc +a=6378137 +b=6378137 +nadgrids=@null +units=m","EPSG:3785":"EPSG:3857",GOOGLE:"EPSG:3857","EPSG:900913":"EPSG:3857","EPSG:102113":"EPSG:3857"},$d=["proj","datum","ellps","a","b","rf","f","R","units","to_meter","vunits","vto_meter","no_defs","type","title","towgs84","nadgrids","geoidgrids","axis","pm","over","lon_wrap"],zv=["no_defs","over"],Li=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),Dv=e=>e.toLowerCase().replace(/[\s_-]/g,"");function U1(e,t){let r=Object.keys(e).find(n=>Dv(n)===Dv(t));return r===void 0?void 0:e[r]}function Fv(e){if(/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(e)){let r=Number(e);if(Number.isFinite(r))return r}if(/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?r$/i.test(e)){let r=Number(e.slice(0,-1))/Me;if(Number.isFinite(r))return r}let t=/^([+-]?)(\d+(?:\.\d*)?)(?:d(?:(\d+(?:\.\d*)?)'(?:(\d+(?:\.\d*)?)")?)?)?([NSEW])?$/i.exec(e);if(t&&(/d/i.test(e)||t[5])){let r=Number(t[3]||0),n=Number(t[4]||0);if(r<60&&n<60){let i=t[1]==="-"?-1:1,o=/[SW]/i.test(t[5]||"")?-1:1,s=i*o*(Number(t[2])+r/60+n/3600);if(Number.isFinite(s))return s}}throw new Error("Invalid angular parameter: "+e)}function G1(e,t={}){let r=e,n=t.aliases||{},i=new Set;for(;typeof r=="string"&&(Li(n,r)||Li(Lv,r));){if(i.has(r))throw new Error("Circular CRS alias: "+r);i.add(r),r=Li(n,r)?n[r]:Lv[r]}if(typeof r=="string"){let o=/^EPSG:(326|327)(\d{2})$/.exec(r);o&&Number(o[2])>=1&&Number(o[2])<=60&&(r="+proj=utm +datum=WGS84 +zone="+Number(o[2])+(o[1]==="327"?" +south":"")),(r==="EPSG:5041"||r==="EPSG:5042")&&(r="+proj=stere +datum=WGS84 +lat_0="+(r==="EPSG:5041"?90:-90)+" +k_0=0.994 +x_0=2000000 +y_0=2000000")}return r}function lo(e,t={}){let r=Xc(t),n=kh(e,t),i=G1(n.definition,t),o;if(tr(i)==="proj-string"&&typeof i=="string"){let N=Object.create(null);for(let B of mh(i).parameters){if(Li(N,B.name))throw new Error("Duplicate PROJ parameter: +"+B.name);N[B.name]=B.value}o={parameters:N}}else{let N=t.parsers?.find(B=>B.canParse(i));if(!N){let B=["wkt","projjson"].includes(tr(i));throw new xn(B?"missing-parser":"unknown-syntax",tr(i)==="identifier"?"Unsupported CRS definition: "+i+"; resolve it first":"Unsupported CRS definition; register a WKT or PROJJSON parser for structured definitions")}o=N.parse(i,t)}let s={...o.parameters};for(let N of["lon_0","lat_0","lat_1","lat_2","lat_ts","lon_wrap","lon_1","lon_2","lonc","alpha","gamma","tilt","azi","o_alpha","o_lon_c","o_lat_c","o_lon_p","o_lat_p","o_lon_1","o_lat_1","o_lon_2","o_lat_2"])s[N]!==void 0&&(s[N]=String(Fv(s[N])));let a=s.proj,c=a?.toLowerCase(),l=c==="geocentric"?"geocent":["longlat","latlong","latlon","lonlat","identity","geocent"].includes(c)?c:a;if(!l)throw new Error("CRS requires +proj");let h=["longlat","latlong","latlon","lonlat"].includes(l)?"geographic":l==="geocent"?"geocentric":l==="identity"?"identity":"projected",u=s.datum,f=u&&u!=="none"?U1(r,u):void 0;u&&u!=="none"&&!f&&Bt("Unknown datum: "+u+"; register a datumCatalogs plugin");let d=Gv(s,f?.ellipse),m=s.nadgrids??f?.nadgrids,p=m===void 0?void 0:m.split(",").map(N=>{let B=N.startsWith("@"),C=B?N.slice(1):N;if(!C||/\s/.test(C))throw new Error("Invalid datum grid name");return Object.freeze({name:C,optional:B})}),g=s.towgs84??f?.towgs84,y;if(g!==void 0&&(y=g.split(",").map(N=>tt({value:N},"value",NaN)),![3,7].includes(y.length)||y.some(N=>!Number.isFinite(N))||y.length===7&&y[6]<=-1e6))throw new Error("+towgs84 requires three or seven finite values and positive scale");u==="none"&&(y=void 0),p&&u!=="none"&&(y=[0,0,0]);let _=m==="@null"||m==="null"?Gv({ellps:"WGS84"}):d,b=s.axis||"enu";if(b.length!==3||!/[ew]/.test(b)||!/[ns]/.test(b)||!/[ud]/.test(b))throw new Error("Invalid axis: "+b);let M=o.angularUnit??Me;if(h==="geographic"&&(s.units&&s.units!=="degrees"||Li(s,"to_meter")))throw new Error("Geographic coordinates must use angular units");if(h!=="geographic"&&s.units==="degrees")throw new Error("Linear coordinates require linear units");let T=Uv(s,"units","to_meter"),A=o.verticalUnit??Uv(s,"vunits","vto_meter");if(!(A>0)||!Number.isFinite(A))throw new Error("Invalid vertical unit");if(!(M>0)||!Number.isFinite(M))throw new Error("Invalid angular unit");let S=s.pm,v=S===void 0?0:(U1(Bv,S)??Fv(S))*Me;return Pv(Object.freeze({kind:h,projection:l,parameters:Object.freeze(s),ellipsoid:d,datum:Object.freeze({ellipsoid:_,towgs84:y&&Object.freeze(y),grids:u==="none"||m==="@null"||m==="null"?void 0:p&&Object.freeze(p)}),areaOfUse:o.areaOfUse,angularUnit:M,toMeter:T,verticalUnit:A,primeMeridian:v,axis:b,longitudeWrap:s.lon_wrap===void 0?void 0:Number(s.lon_wrap)*Me,lossy:!!(o.lossy||n.lossy)}),n.spatialReference)}function Uv(e,t,r){let n=e[t],i=ph;if(t==="vunits"&&n==="degrees")throw new Error("Height requires linear units");if(n&&!["m","degrees"].includes(n)&&!Li(i,n))throw new Error("Unsupported units: "+n);let o=tt(e,r,n&&i[n]?i[n].metersPerUnit:1);if(!(o>0))throw new Error("+"+r+" must be positive");return o}function Gv(e,t){let r=t||e.ellps||"WGS84",n=U1(Ov,r);if(!n)throw new Error("Unsupported ellipsoid: "+r);let i=tt(e,"a",n.a),o=tt(e,"f",NaN),s=tt(e,"rf",Number.isNaN(o)?n.rf||0:o===0?0:1/o),a=tt(e,"b",s?i*(1-1/s):Li(e,"f")||Li(e,"rf")||Li(e,"a")?i:n.b||i),c=tt(e,"R",0);if(i<=0||a<=0||a>i||s<0||s>0&&s<=1||Li(e,"R")&&c<=0||!Number.isNaN(o)&&(o<0||o>=1))throw new Error("Invalid ellipsoid dimensions");return Object.freeze({semiMajorAxis:c||i,semiMinorAxis:c||a,eccentricitySquared:c?0:1-(a/i)**2})}jt();var z1=Math.PI/(180*3600),Yd={ellipsoid:{semiMajorAxis:6378137,semiMinorAxis:6356752314245179e-9,eccentricitySquared:.0066943799901413165},towgs84:[0,0,0]};function Xd(e,t){if(Math.abs(e.y)>Math.PI/2)throw new Error("Latitude outside geocentric domain");if(!sh(e,t))throw new Error("Geocentric coordinate must be finite")}function Zd(e,t){let r=e.x,n=e.y,i=e.z,{semiMajorAxis:o,semiMinorAxis:s,eccentricitySquared:a}=t;if(r===0&&n===0&&i===0)throw new Error("Geodetic coordinates are undefined at the Earth center");if(a!==0&&Math.abs(r)<1e-12*o&&Math.abs(n)<1e-12*o&&Math.hypot(r,n)<1e-12*o){if(!Number.isFinite(Math.hypot(r,n,i)))throw new Error("Geocentric radius must be finite");e.x=0,e.y=Math.sign(i)*Math.PI/2,e.z=Math.abs(i)-s;return}if(!ah(e,t))throw Number.isFinite(Math.hypot(r,n,i))?new Error("Geocentric inverse did not converge"):new Error("Geocentric radius must be finite")}function Vv(e,t){let r=e[0],n=e[1],i=e[2],o=(e[3]||0)*z1,s=(e[4]||0)*z1,a=(e[5]||0)*z1,c=1+(e[6]||0)/1e6;return t?l=>{let h=(l.x-r)/c,u=(l.y-n)/c,f=(l.z-i)/c;l.x=h+a*u-s*f,l.y=-a*h+u+o*f,l.z=s*h-o*u+f}:l=>{let h=l.x,u=l.y,f=l.z;l.x=c*(h-a*u+s*f)+r,l.y=c*(a*h+u-o*f)+n,l.z=c*(-s*h+o*u+f)+i}}function Kd(e){return!!e.towgs84?.some(t=>t!==0)}function k1(e,t){if(!(!e.towgs84||!t.towgs84)){if(e.grids||t.grids){if(e.grids&&t.grids&&e.ellipsoid.semiMajorAxis===t.ellipsoid.semiMajorAxis&&e.ellipsoid.eccentricitySquared===t.ellipsoid.eccentricitySquared&&e.grids.length===t.grids.length&&e.grids.every((n,i)=>n.name===t.grids[i].name&&n.optional===t.grids[i].optional&&n.grid===t.grids[i].grid))return;let r=k1(e.grids?Yd:e,t.grids?Yd:t);return n=>{e.grids&&kv(n,e,!1),r?.(n),t.grids&&kv(n,t,!0)}}if(Kd(e)||Kd(t)){let r=V1(e,Yd),n=V1(Yd,t);return i=>{r?.(i),n?.(i)}}return V1(e,t)}}function V1(e,t){if(!e.towgs84||!t.towgs84)return;let r=e.ellipsoid,n=t.ellipsoid,i=!0;for(let a=0;a<7;a++)(e.towgs84[a]||0)!==(t.towgs84[a]||0)&&(i=!1);if(r.semiMajorAxis===n.semiMajorAxis&&Math.abs(r.eccentricitySquared-n.eccentricitySquared)<=5e-11&&i)return;let o=Kd(e)?Vv(e.towgs84,!1):void 0,s=Kd(t)?Vv(t.towgs84,!0):void 0;return a=>{Xd(a,r),o?.(a),s?.(a),Zd(a,n)}}function kv(e,t,r){for(let n of t.grids){if(n.name==="null")return;if(!n.grid){if(n.optional)continue;throw new Error("Required datum grid is not registered: "+n.name)}let i=!1;if(n.grid.shiftInPlace)i=n.grid.shiftInPlace(e,r);else{let o=n.grid.shift(e.x,e.y,r);o&&(e.x=o[0],e.y=o[1],i=!0)}if(i){if(!Number.isFinite(e.x)||!Number.isFinite(e.y)||Math.abs(e.y)>Math.PI/2)throw new Error("Datum grid produced a coordinate outside the geographic domain");return}}throw new Error("No datum grid covers coordinate: "+t.grids.map(n=>n.name).join(","))}function qv(e,t){let r={x:e[0],y:e[1],z:e[2]};return Xd(r,t),[r.x,r.y,r.z]}function jv(e,t){let r={x:e[0],y:e[1],z:e[2]};return Zd(r,t),[r.x,r.y,r.z]}Ee();Ee();ne();Ie();function is(e,t=0){let r=tt(e,"lon_wrap",0)*Me;return n=>Ke(i=>{let o=gr(i,r);return[[r+o[0],i[0][1],0],[r+o[1],i[1][1],0]]},n??[-180,-90,180,90],r,t)}function Wv(e,t={}){if(e===void 0)return;let r=[];for(let n of e.split(",")){let i=n.startsWith("@"),o=i?n.slice(1):n;if(!o||/\s/.test(o))throw new Error("Invalid vertical grid name");if(o==="null"){r.push(null);break}let s=Object.prototype.hasOwnProperty.call(t,o)?t[o]:void 0;if(s){if(typeof s.getOffset!="function")throw new Error("Invalid vertical grid: "+o);r.push(s.getOffset.bind(s))}else i||Bt("Required vertical grid is not registered: "+o)}return(n,i)=>{for(let o of r){if(!o)return 0;let s=o(n,i);if(s!==void 0){if(!Number.isFinite(s))throw new Error("Vertical grid returned a non-finite offset");return s}}throw new Error("No vertical grid covers this coordinate")}}var qh=class e{static async create(t={}){let r=await Promise.all(Hv(t).map(Tv));return new e({...t,projections:r})}get targetProfile(){return this.getTargetRenderingProfile(this.targetCoverage)}getTargetRenderingProfile(t){return this.targetRenderingProfile&&qb(this.targetRenderingProfile,t)}constructor(t={}){this.coordinateScratch=new Ho,this.targetLongitudeOrigin=0;let r=t.projections||[],n=Xv(r);if(r.some(i=>!("create"in i))){let i=lo(t.from??"WGS84",t),o=lo(t.to??"WGS84",t);this.lossy=i.lossy||o.lossy,this.deferred={options:{...t,projections:[...r]}}}else{let i=t,o=n,s=$v(i.from??"WGS84",o,i),a=$v(i.to??"WGS84",o,i);this.targetRenderingProfile=a.implementation?.getRenderingProfile?.bind(a.implementation)??(a.kind==="geographic"?is(a.parameters,a.primeMeridian):a.kind==="identity"?vv:void 0),this.targetCoverage=a.areaOfUse,this.targetLongitudeOrigin=a.implementation?.longitudeOrigin??(a.kind==="geographic"?a.longitudeWrap??0:0),this.lossy=s.lossy||a.lossy,this.lossy&&(s.kind==="geocentric"||a.kind==="geocentric")&&Bt("Horizontal extraction cannot supply ellipsoidal height for geocentric coordinates"),this.lossy&&(s.verticalGrid||a.verticalGrid)&&Bt("Horizontal extraction cannot be combined with vertical grids"),this.forwardTransform=Kv(s,a,!!t.enforceAxis),this.inverseTransform=Kv(a,s,!!t.enforceAxis)}this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectTo=this.projectTo.bind(this),this.unprojectTo=this.unprojectTo.bind(this),this.projectToSync=this.projectToSync.bind(this),this.unprojectToSync=this.unprojectToSync.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this),this.projectSync=this.projectSync.bind(this),this.unprojectSync=this.unprojectSync.bind(this),this.projectFlatSync=this.projectFlatSync.bind(this),this.unprojectFlatSync=this.unprojectFlatSync.bind(this)}load(){let t=this.deferred;return t?t.implementation?Promise.resolve(t.implementation):(t.pending||(t.pending=e.create(t.options).then(r=>(t.implementation=r,r)).catch(r=>{throw t.pending=void 0,r})),t.pending):Promise.resolve(this)}loadSync(){let t=this.deferred;if(!t)return this;if(!t.implementation){let r=Hv(t.options).map(n=>{let i=Ev(n);if(!i)throw new Error("Projection is not preloaded: "+n.name+". Call preload() first.");return i});t.implementation=new e({...t.options,projections:r})}return t.implementation}projectSync(t){return this.deferred?this.loadSync().project(t):Zc(t,this.forwardTransform,this.coordinateScratch)}unprojectSync(t){return this.deferred?this.loadSync().unproject(t):Zc(t,this.inverseTransform,this.coordinateScratch)}projectFlatSync(t,r=2){return this.deferred?this.loadSync().projectFlat(t,r):Jd(t,r,this.forwardTransform,this.coordinateScratch)}unprojectFlatSync(t,r=2){return this.deferred?this.loadSync().unprojectFlat(t,r):Jd(t,r,this.inverseTransform,this.coordinateScratch)}async preload(){await this.load()}project(t){return this.deferred?this.projectLoaded(t,!1):Zc(t,this.forwardTransform,this.coordinateScratch)}unproject(t){return this.deferred?this.projectLoaded(t,!0):Zc(t,this.inverseTransform,this.coordinateScratch)}projectTo(t,r){return this.deferred?this.projectToLoaded(t,r,!1):this.projectToSync(t,r)}unprojectTo(t,r){return this.deferred?this.projectToLoaded(t,r,!0):this.unprojectToSync(t,r)}projectToSync(t,r){return this.deferred?this.loadSync().projectTo(t,r):(Ea(t,r,Math.max(t.length,this.forwardTransform.geocentricOutput?3:2)),Zc(t,this.forwardTransform,this.coordinateScratch,r))}unprojectToSync(t,r){return this.deferred?this.loadSync().unprojectTo(t,r):(Ea(t,r,Math.max(t.length,this.inverseTransform.geocentricOutput?3:2)),Zc(t,this.inverseTransform,this.coordinateScratch,r))}projectToLoaded(t,r,n){Ea(t,r,t.length);let i=t.slice();return this.load().then(o=>n?o.unprojectTo(i,r):o.projectTo(i,r))}projectLoaded(t,r){let n=t.slice();return this.load().then(i=>r?i.unproject(n):i.project(n))}projectFlat(t,r=2){return this.deferred?this.load().then(i=>i.projectFlat(t,r)):Jd(t,r,this.forwardTransform,this.coordinateScratch)}unprojectFlat(t,r=2){return this.deferred?this.load().then(i=>i.unprojectFlat(t,r)):Jd(t,r,this.inverseTransform,this.coordinateScratch)}};function Hv(e){let t=Xv(e.projections||[]),r=new Set;for(let n of[e.from??"WGS84",e.to??"WGS84"]){let i=lo(n,e);if(["geographic","identity"].includes(i.kind))continue;let o=t.get(Qd(i.projection));if(!o)throw new xn("missing-plugin","Projection plugin is not registered: "+i.projection);r.add(o)}return[...r]}var Qd=e=>e.toLowerCase().replace(/[\s_-]/g,"");function Xv(e){let t=new Map;for(let r of e)for(let n of new Set([r.name,...r.aliases||[]].map(Qd))){if(!n||["longlat","latlong","latlon","lonlat","identity"].includes(n)||t.has(n))throw new Error("Duplicate or reserved projection plugin: "+n);t.set(n,r)}return t}function $v(e,t,r){let n=lo(e,r),i=t.get(Qd(n.projection));if(!["geographic","identity"].includes(n.kind)&&!i)throw new xn("missing-plugin","Projection plugin is not registered: "+n.projection);let o=new Set([...$d,...i?.parameters||[]]);for(let d of Object.keys(n.parameters)){if(!o.has(d))throw new xn("missing-transform-stage","Unsupported PROJ parameter: +"+d);let m=zv.includes(d)||i?.flags?.includes(d);if(m&&n.parameters[d]!==void 0)throw new Error("Expected a flag without a value: +"+d);if(!m&&!n.parameters[d])throw new Error("PROJ parameter requires a value: +"+d)}if(n.parameters.type&&n.parameters.type!=="crs")throw new Error("Only +type=crs is supported");let s=Qd(n.projection)==="fasttransversemercator"?Object.freeze({...n.parameters,approx:void 0}):n.parameters,a=i?.create({...n.ellipsoid,parameters:s,primeMeridian:n.primeMeridian});if(n.kind==="geocentric"&&(!a?.forward3D||!a?.inverse3D))throw new Error("Geocentric plugin must implement 3D operations");let c=n.datum.grids,l=c?.findIndex(d=>d.name==="null")??-1,h=c?.slice(0,l<0?void 0:l+1).map(d=>{let m=Object.prototype.hasOwnProperty.call(r.datumGrids||{},d.name)?r.datumGrids[d.name]:void 0;if(m&&typeof m.shift!="function")throw new Error("Invalid prepared datum grid: "+d.name);return Object.freeze({...d,grid:m})});for(let d of h||[]){if(d.name==="null")break;!d.optional&&!d.grid&&Bt("Required datum grid is not registered: "+d.name)}let u=h?Object.freeze({...n.datum,grids:Object.freeze(h)}):n.datum,f=Wv(n.parameters.geoidgrids,r.verticalGrids);return f&&(n.kind==="geocentric"||n.kind==="identity"||n.lossy)&&Bt("Vertical grids require a non-lossy geographic or projected CRS"),{...n,datum:u,implementation:a,verticalGrid:f}}function q1(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.z)}function Yv(e,t){if(e==="enu")return;let r=[0,0,0],n=[0,0,0];for(let i=0;i<3;i++){let o=e[i],s="ew".includes(o)?0:"ns".includes(o)?1:2;r[t?i:s]=t?s:i,n[t?i:s]="wsd".includes(o)?-1:1}return i=>{let o=i.x,s=i.y,a=i.z;i.x=n[0]*(r[0]===0?o:r[0]===1?s:a),i.y=n[1]*(r[1]===0?o:r[1]===1?s:a),i.z=n[2]*(r[2]===0?o:r[2]===1?s:a)}}function Kv(e,t,r){let n=e.storedAxis||(r?e.axis:"enu"),i=t.storedAxis||(r?t.axis:"enu"),o=Yv(n,!1),s=Yv(i,!0),a=e.implementation&&oo(e.implementation,!0,e.kind==="geocentric"),c=t.implementation&&oo(t.implementation,!1,t.kind==="geocentric"),l=k1(e.datum,t.datum),h=e.lossy||t.lossy,u=e.kind==="geocentric",f=e.kind==="geographic"?e.angularUnit:e.toMeter,d=t.kind==="geographic"?t.angularUnit:t.toMeter,m=u?1:e.verticalUnit,p=t.kind==="geocentric"?d:t.verticalUnit,g=e.primeMeridian,y=t.primeMeridian,_=t.kind==="geographic"?t.longitudeWrap:void 0,b;if(!l&&!e.verticalGrid&&!t.verticalGrid&&!h&&!o&&!s&&!g&&!y&&e.verticalUnit===1&&t.verticalUnit===1&&_===void 0){let M=Object.freeze({inputScale:f,outputScale:d});e.kind==="geographic"&&t.kind==="projected"&&(b=t.implementation?.createForwardFlat?.(M)),e.kind==="projected"&&t.kind==="geographic"&&(b=e.implementation?.createInverseFlat?.(M))}return{flat:b,requiresInputZ:!!(e.verticalGrid||t.verticalGrid)||e.kind==="geocentric"||/[ud]/.test(n.slice(0,2))||/[ud]/.test(i.slice(0,2)),geocentricOutput:t.kind==="geocentric",run(M){if(!q1(M))throw new Error("Coordinates must contain finite x, y and optional z values");o?.(M);let T=M.z;if(h&&(M.z=0),f!==1&&(M.x*=f,M.y*=f,u&&(M.z*=f)),a?.(M),m!==1&&(M.z*=m),Math.abs(M.y)>Math.PI/2||!q1(M))throw new Error("Coordinate is outside the geographic domain");if(M.x+=g,e.verticalGrid&&(M.z+=e.verticalGrid(M.x,M.y)),l?.(M),t.verticalGrid&&(M.z-=t.verticalGrid(M.x,M.y)),M.x-=y,_!==void 0&&(M.x=_+ve(M.x-_)),c?.(M),d!==1&&(M.x/=d,M.y/=d),p!==1&&(M.z/=p),h&&(M.z=T),s?.(M),!q1(M))throw new Error("Projection produced non-finite coordinates")}}}function Zc(e,t,r,n){if(e.length<2)throw new Error("Coordinates must contain finite x, y and optional z values");if(e.length<3&&t.requiresInputZ)throw new Error("This transform requires three ordinates");let i=Math.max(e.length,t.geocentricOutput?3:2),o=r.acquire();try{if(o.x=e[0],o.y=e[1],o.z=e.length>=3?e[2]:0,t.run(o),n)return Vh(e,n,o,i);let s=e.slice();return s[0]=o.x,s[1]=o.y,(e.length>=3||t.geocentricOutput)&&(s[2]=o.z),s}finally{r.release(o)}}function Jd(e,t,r,n){if(!(e instanceof Float32Array||e instanceof Float64Array))throw new Error("In-place projection requires a Float32Array or Float64Array");if(!Number.isSafeInteger(t)||t<2||e.length%t!==0)throw new Error("Dimension must be an integer >= 2 and divide the typed array length");if(t<3&&(r.requiresInputZ||r.geocentricOutput))throw new Error("This transform requires a dimension of at least 3");if(r.flat)return r.flat(e,t),e;let i=n.acquire();try{let o=e instanceof Float32Array;for(let s=0;s<e.length;s+=t){if(i.x=e[s],i.y=e[s+1],i.z=t>=3?e[s+2]:0,r.run(i),o&&(Math.abs(i.x)>34028234663852886e22||Math.abs(i.y)>34028234663852886e22||t>=3&&Math.abs(i.z)>34028234663852886e22))throw new Error("Projected coordinate exceeds Float32 range");e[s]=i.x,e[s+1]=i.y,t>=3&&(e[s+2]=i.z)}return e}finally{n.release(i)}}var tm=class{constructor(t){this.sample=t,this.result=[0,0,0],this.samples=Array.from({length:4},()=>[0,0,0]),this.coarse=[0,0,0],this.fine=[0,0,0]}evaluate(t,r,n=1e-6){if(!this.difference(t,this.coarse)||!this.difference(t/2,this.fine))return!1;let i=n*Math.max(r,Math.abs(this.fine[0]),Math.abs(this.fine[1]),Math.abs(this.fine[2]));for(let o=0;o<3;o++)if(Math.abs(this.coarse[o]-this.fine[o])>i||(this.fine[o]+=(this.fine[o]-this.coarse[o])/15,!Number.isFinite(this.fine[o])))return!1;for(let o=0;o<3;o++)this.result[o]=this.fine[o];return!0}difference(t,r){let[n,i,o,s]=this.samples;if(!this.sample(-2*t,n)||!this.sample(-t,i)||!this.sample(t,o)||!this.sample(2*t,s))return!1;for(let a=0;a<3;a++)if(r[a]=(n[a]-s[a]+8*(o[a]-i[a]))/(12*t),!Number.isFinite(r[a]))return!1;return!0}};var jh=Math.PI/180,Zv=lo("WGS84").ellipsoid;function j1(e){if(e.length!==3||e.some(t=>!Number.isFinite(t)||t<=0))throw new Error("Invalid CRS rendering scale");return e}function Jv(e,t,r,n){if(e.kind==="geocentric")return j1([e.toMeter,e.toMeter,e.toMeter]);if(e.kind==="identity")return j1([...r].map(m=>/[ud]/.test(m)?e.verticalUnit:e.toMeter));let i=[0,0,0],o=[0,0,0],s=[0,0,0],a=[0,0,0],c=Array.from({length:3},()=>[0,0,0]),l=0,h=0,u=0,f=!1,d=new tm((m,p)=>{for(let _=0;_<3;_++)o[_]=i[_];o[l]+=m,t.unprojectTo(o,a);let g=a[0]-s[0],y=Math.abs(g)<=180?g:((g+180)%360+360)%360-180;return Math.abs(a[1])>=90?!1:(p[0]=y*h,p[1]=(a[1]-s[1])*u,p[2]=a[2]-s[2],p.every(Number.isFinite))});return m=>{if(f||m.length<2)return null;f=!0;let p;try{if(i[0]=m[0],i[1]=m[1],i[2]=m[2]??0,!i.every(Number.isFinite))return null;t.unprojectTo(i,s);let g=s[1]*jh,y=Zv.semiMajorAxis,_=Zv.eccentricitySquared,b=1-_*Math.sin(g)**2;if(h=y*Math.cos(g)/Math.sqrt(b)*jh,u=y*(1-_)/b**1.5*jh,!(h>y*jh*1e-8)||!(u>0))return null;let M=((s[0]-n+180)%360+360)%360-180;if((e.kind==="geographic"?e.longitudeWrap!==void 0:!Object.prototype.hasOwnProperty.call(e.parameters,"over"))&&Math.abs(M)+2/h>=180||Math.abs(s[1])+2/u>=90)return null;for(l=0;l<3;l++){let A=r[l],S=/[ud]/.test(A)?e.verticalUnit:e.kind==="geographic"?(/[ew]/.test(A)?h:u)*e.angularUnit/jh:e.toMeter;if(!d.evaluate(1/S,S))return null;for(let v=0;v<3;v++)c[l][v]=d.result[v]}if(p=c.map(A=>Math.hypot(...A)),e.kind==="projected"){let A=c[r.search(/[ew]/)],S=c[r.search(/[ns]/)],v=Math.abs(A[0]*S[1]-A[1]*S[0])/e.toMeter**2;p[r.search(/[ud]/)]=e.verticalUnit*Math.sqrt(v)}}catch{return null}finally{f=!1}return j1(p)}}Rg();var Qv={degrees:Math.PI/180,radians:1,gradians:Math.PI/200},kN={...Object.fromEntries(Object.values(ph).map(e=>[e.name,e.metersPerUnit]))};async function nE(e,t,r,n={},i=!1,o){let s=typeof t=="string"?t:JSON.parse(JSON.stringify(t)),a={enforceAxis:r.enforceAxis,mode:r.mode,...n,converters:n.converters&&[...n.converters]},c=o?await o(s,{...r,...a}):s,l=lo(c,{...r,...a}),h=await e.createProjectionAsync({...a,from:"WGS84",to:c}),u=l.storedAxis||(a.enforceAxis?l.axis:"enu"),f=rE(l.kind==="geographic"?l.angularUnit:l.toMeter,l.kind==="geographic"),d=rE(l.verticalUnit,!1),m=[...u].map(v=>l.kind!=="geocentric"&&/[ud]/.test(v)?d:f),p=h.targetProfile;if(!p)throw new Error("Projection must define a rendering profile for CRS retrieval");let g=(h.targetLongitudeOrigin+l.primeMeridian)*180/Math.PI,y=WN(p,l,u),_=jN(p.normalize),b=Jv(l,h,u,g),M=[...new Set(["WGS84",...a.converters||[]])];if(M.some(v=>typeof v!="string"||!v.trim()))throw new Error("Converter source CRS must be a nonempty string");let T=await Promise.all(M.map(async v=>{if(v==="WGS84")return[v,tE(h,_)];let[N,B]=await Promise.all([e.createProjectionAsync({...a,from:v,to:c}),e.createProjectionAsync({...a,from:"WGS84",to:v})]);return[v,tE(N,qN(B,_))]})),A=Object.assign(Object.create(null),Object.fromEntries(T)),S={coordinateFrame:l.kind,projection:l.projection,parameters:l.parameters,ellipsoid:{semiMajorAxis:l.ellipsoid.semiMajorAxis,semiMinorAxis:l.ellipsoid.semiMinorAxis},axis:u,xUnit:m[0],yUnit:m[1],zUnit:m[2],areaOfUse:l.areaOfUse,lossy:l.lossy};return{...S,signature:i&&typeof c=="string"&&!a.enforceAxis&&!l.lossy?c:Ub(S),renderingBounds:y,renderingScale:b,getRenderingScale:v=>typeof b=="function"?b(v):b,converter:A}}function tE(e,t){return{from:eE(e.project.bind(e),e.projectTo.bind(e)),to:eE(e.unproject.bind(e),e.unprojectTo.bind(e)),normalize:t}}function qN(e,t){function r(n,i){i!==void 0&&Ea(n,i,n.length);let o=e.unproject(Array.from(n)),[s,a,c]=o;return t(o,o),o[0]===s&&o[1]===a&&o[2]===c?i===void 0?Array.from(n):Vh(n,i,{x:n[0],y:n[1],z:n[2]??0},n.length):i===void 0?e.project(o):e.projectTo(o,i)}return r}function eE(e,t){function r(n,i){return i===void 0?e(Array.isArray(n)?n:Array.from(n)):t(n,i)}return r}function jN(e){function t(r,n){let i=n??new Array(r.length);Ea(r,i,r.length);let o=r[0],s=r[1],a=r[2]??0;if(r.length<2||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(a))throw new Error("Normalization requires finite longitude, latitude and altitude");let c={x:o,y:s,z:a};return e?.(c),Vh(r,i,c,r.length)}return t}function WN(e,t,r){let n=t.kind==="geographic"?t.angularUnit:t.toMeter,i=[n,n,t.kind==="geocentric"?t.toMeter:t.verticalUnit],o=e.bounds,s=[...r].map(a=>{let c=/[ew]/.test(a)?0:/[ns]/.test(a)?1:2,l=o[0][c]/i[c],h=o[1][c]/i[c];return/[wsd]/.test(a)?[-h,-l]:[l,h]});return[[s[0][0],s[1][0],s[2][0]],[s[0][1],s[1][1],s[2][1]]]}function rE(e,t){let r=t?Qv:kN,n=Object.keys(r).find(i=>r[i]===e)||"custom";return t?{name:n,degreesPerUnit:e/Qv.degrees}:{name:n,metersPerUnit:e}}function iE(e){return{...e,projections:e.projections&&[...e.projections],parsers:e.parsers&&[...e.parsers],datumCatalogs:e.datumCatalogs&&[...e.datumCatalogs],aliases:e.aliases&&JSON.parse(JSON.stringify(e.aliases)),datumGrids:e.datumGrids&&{...e.datumGrids},verticalGrids:e.verticalGrids&&{...e.verticalGrids}}}function Wh(e){return!!(e.projections||e.parsers||e.datumCatalogs||e.aliases||e.datumGrids||e.verticalGrids||e.resolver)}Nc();async function sE(e){let t={...e,from:oE(e.from??"WGS84"),to:oE(e.to??"WGS84")},[r,n]=await Promise.all([em(t.from,t),em(t.to,t)]);return{...t,from:r,to:n}}async function em(e,t){let r=kh(e,t),n=G1(r.definition,t),i=typeof e=="string"||"type"in e?void 0:"crs"in e?e.crs:e,o=n===r.definition&&i?i.representation:tr(n);if(o!=="identifier"||t.parsers?.some(h=>h.canParse(n)))return e;let s=await t.resolver.resolve({state:"explicit",provenance:i?.provenance??"unknown",definition:n,representation:o}),a=kh(s.input,t).definition;if(!i)return a;let c=e,l={...i,definition:a,representation:tr(a),alternatives:[{definition:i.definition,representation:i.representation},...i.alternatives??[]]};return"crs"in c?{...c,crs:l}:l}function oE(e){return typeof e=="string"?e:JSON.parse(JSON.stringify(e))}var rm=class{constructor(t={}){this.options=iE(t),this.useDefinitionSignature=!Wh(t)}getCRS(t,r={}){return nE(this,t,this.options,r,this.useDefinitionSignature,this.options.resolver?em:void 0)}createProjection(t={}){return new qh({...this.options,...t})}async createProjectionAsync(t={}){let r={...this.options,...t};return qh.create(r.resolver?await sE(r):r)}};Dc();Ee();Ht();ne();Ie();var W1={name:"merc",aliases:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A"],parameters:["lon_0","lat_ts","k","k_0","x_0","y_0"],create({semiMajorAxis:e,eccentricitySquared:t,parameters:r,primeMeridian:n=0}){let i=Math.sqrt(t),o=Object.prototype.hasOwnProperty.call(r,"over"),s=tt(r,"lon_0",0)*Me,a=tt(r,"x_0",0),c=tt(r,"y_0",0),l=tt(r,"k_0",tt(r,"k",1));if(Object.prototype.hasOwnProperty.call(r,"lat_ts")){let m=gh(r,"lat_ts");l=Math.cos(m)/Math.sqrt(1-t*Math.sin(m)**2)}if(l<=0)throw new Error("Mercator scale must be positive");let h=e*l,u=Math.atan(Math.sinh(Math.PI)),f=h*Math.PI,d=h*(Math.PI-i*Math.atanh(i*Math.sin(u)));return{longitudeOrigin:s,getRenderingProfile(m){if(m){let g=m[1]<=-90||m[3]>=90,y=[m[0],g?Math.max(-u*180/Math.PI,Math.min(u*180/Math.PI,m[1])):m[1],m[2],g?Math.max(-u*180/Math.PI,Math.min(u*180/Math.PI,m[3])):m[3]],_=b=>c+h*(Math.asinh(Math.tan(b))-i*Math.atanh(i*Math.sin(b)));return Ke(b=>re(At([a,a],Ct(gr(b,s,o),h)),[_(b[0][1]),_(b[1][1])]),y,s,n,o)}let p=[[a-f,c-d,0],[a+f,c+d,0]];return{bounds:p,normalize:Ke(()=>p,gn(K(s-Math.PI,-u,s+Math.PI,u),n),s,n,o).normalize}},...oi(m=>{let p=m.x,g=m.y;if(Math.abs(g)>=Math.PI/2)throw new Error("Mercator is undefined at the poles");let y=Math.asinh(Math.tan(g));m.x=a+h*ve(p-s,o),m.y=c+h*(i===0?y+0:y-i*Math.atanh(i*Math.sin(g)))},m=>{let p=m.x,y=(m.y-c)/h,_=Math.atan(Math.sinh(y));if(i===0){m.x=ve(s+(p-a)/h,o),m.y=_+0;return}for(let b=0;b<30;b++){let M=Math.atan(Math.sinh(y+i*Math.atanh(i*Math.sin(_))));if(Math.abs(M-_)<1e-13){m.x=ve(s+(p-a)/h,o),m.y=M;return}_=M}throw new Error("Mercator inverse did not converge")})}}};ma();Ee();Ht();ne();Ie();var H1={name:"eqc",aliases:["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical"],parameters:["lon_0","lat_0","lat_ts","x_0","y_0"],create({semiMajorAxis:e,parameters:t,primeMeridian:r=0}){let n=Object.prototype.hasOwnProperty.call(t,"over"),i=tt(t,"lon_0",0)*Me,o=gh(t,"lat_0"),s=Math.cos(gh(t,"lat_ts")),a=tt(t,"x_0",0),c=tt(t,"y_0",0),l=e*Math.abs(s)*Math.PI;return{longitudeOrigin:i,getRenderingProfile(h){if(h)return Ke(f=>re(At([a,a],Ct(gr(f,i,n),e*s)),[c+e*(f[0][1]-o),c+e*(f[1][1]-o)]),h,i,r,n);let u=[[a-l,c+e*(-Math.PI/2-o),0],[a+l,c+e*(Math.PI/2-o),0]];return{bounds:u,normalize:Ke(()=>u,gn(K(i-Math.PI,-(Math.PI/2),i+Math.PI,Math.PI/2),r),i,r,n).normalize}},...qn(h=>{h.x=a+e*s*ve(h.x-i,n),h.y=c+e*(h.y-o)},h=>{h.x=ve(i+(h.x-a)/(e*s),n),h.y=o+(h.y-c)/e})}}};Ie();Ht();ne();Dc();yn();Gc();xh();ue();nd();Ae();function HN(e){if(e.k0||(e.k0=1),e.x0=e.x0||0,e.y0=e.y0||0,e.long0=e.long0||0,!(Math.abs(e.lat1+e.lat2)<1e-10)){var t=e.b/e.a;e.e=Math.sqrt(1-t*t);var r=Math.sin(e.lat1),n=Math.cos(e.lat1),i=nn(e.e,r,n),o=Lr(e.e,e.lat1,r),s=Math.sin(e.lat2),a=Math.cos(e.lat2),c=nn(e.e,s,a),l=Lr(e.e,e.lat2,s),h=Lr(e.e,e.lat0,Math.sin(e.lat0));Math.abs(e.lat1-e.lat2)>1e-10?e.ns=Math.log(i/c)/Math.log(o/l):e.ns=r,Number.isNaN(e.ns)&&(e.ns=r),e.f0=i/(e.ns*Math.pow(o,e.ns)),e.rh=Math.abs(Math.abs(e.lat0)-U)<1e-10?0:e.a*e.f0*Math.pow(h,e.ns)}}function aE(e,t){var r=t.x,n=t.y,i=Math.abs(Math.abs(n)-U),o,s;if(i>1e-10)o=e.sphere?1/Math.tan(Math.PI/4+n/2):Lr(e.e,n,Math.sin(n)),s=e.a*e.f0*Math.pow(o,e.ns);else{if(i=n*e.ns,i<=0)return null;s=0}var a=e.ns*G(r-e.long0,e.over);return t.x=e.k0*(s*Math.sin(a))+e.x0,t.y=e.k0*(e.rh-s*Math.cos(a))+e.y0,t}function cE(e,t){var r,n,i,o,s,a=(t.x-e.x0)/e.k0,c=e.rh-(t.y-e.y0)/e.k0;e.ns>0?(r=Math.sqrt(a*a+c*c),n=1):(r=-Math.sqrt(a*a+c*c),n=-1);var l=0;if(r!==0&&(l=Math.atan2(n*a,n*c)),r!==0||e.ns>0){if(n=1/e.ns,i=Math.pow(r/(e.a*e.f0),n),o=_a(e.e,i),o===-9999)return null}else o=-U;return s=G(l/e.ns+e.long0,e.over),t.x=s,t.y=o,t}function lE(e){let t={...e,ns:0,f0:0,rh:0};return HN(t),t}var $1={name:"lcc",aliases:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"],parameters:[...ar,...so,"lat_1","lat_2"],create(e){let t=er(e);Lc(t,e.parameters);let r=lE(t),n=Xe("lcc",r,aE,cE),i={...oi(o=>{let s=o.y;if(Math.abs(s)===Math.PI/2&&s*r.ns<0)throw new Error("Lambert conformal conic is undefined at the opposite pole");n.forwardInPlace(o)},n.inverseInPlace)};return Pt(i,K(t.long0-Math.PI,r.ns>0?-Math.PI/3:-Math.PI/2,t.long0+Math.PI,r.ns>0?Math.PI/2:Math.PI/3),o=>Bc(i.forward,o,t.long0,r.ns,r.x0,r.y0+r.k0*r.rh,t.over),t.primeMeridian,t.over)}};Dc();Ie();Ht();ne();yn();Gc();function Fr(e,t){var r;return e>1e-7?(r=e*t,(1-e*e)*(t/(1-r*r)-.5/e*Math.log((1-r)/(1+r)))):2*t}ue();Ae();function nm(e,t){var r=1-(1-e*e)/(2*e)*Math.log((1-e)/(1+e));let n=4*Number.EPSILON*r;if(Math.abs(t)>r+n)return NaN;if(Math.abs(Math.abs(t)-r)<=n)return t<0?-1*U:U;for(var i=Math.asin(.5*t),o,s,a,c,l=0;l<30;l++)if(s=Math.sin(i),a=Math.cos(i),c=e*s,o=Math.pow(1-c*c,2)/(2*a)*(t/(1-e*e)-s/(1-c*c)+.5/e*Math.log((1-c)/(1+c))),i+=o,Math.abs(o)<=1e-10)return i;return NaN}function $N(e){Math.abs(e.lat1+e.lat2)<1e-10||(e.temp=e.b/e.a,e.es=1-Math.pow(e.temp,2),e.e3=Math.sqrt(e.es),e.sin_po=Math.sin(e.lat1),e.cos_po=Math.cos(e.lat1),e.t1=e.sin_po,e.con=e.sin_po,e.ms1=nn(e.e3,e.sin_po,e.cos_po),e.qs1=Fr(e.e3,e.sin_po),e.sin_po=Math.sin(e.lat2),e.cos_po=Math.cos(e.lat2),e.t2=e.sin_po,e.ms2=nn(e.e3,e.sin_po,e.cos_po),e.qs2=Fr(e.e3,e.sin_po),e.sin_po=Math.sin(e.lat0),e.cos_po=Math.cos(e.lat0),e.t3=e.sin_po,e.qs0=Fr(e.e3,e.sin_po),Math.abs(e.lat1-e.lat2)>1e-10?e.ns0=(e.ms1*e.ms1-e.ms2*e.ms2)/(e.qs2-e.qs1):e.ns0=e.con,e.c=e.ms1*e.ms1+e.ns0*e.qs1,e.rh=e.a*Math.sqrt(e.c-e.ns0*e.qs0)/e.ns0)}function hE(e,t){var r=t.x,n=t.y;e.sin_phi=Math.sin(n),e.cos_phi=Math.cos(n);var i=Fr(e.e3,e.sin_phi),o=e.a*Math.sqrt(e.c-e.ns0*i)/e.ns0,s=e.ns0*G(r-e.long0,e.over),a=o*Math.sin(s)+e.x0,c=e.rh-o*Math.cos(s)+e.y0;return t.x=a,t.y=c,t}function uE(e,t){var r,n,i,o,s,a;if(t.x-=e.x0,t.y=e.rh-t.y+e.y0,e.ns0>=0?(r=Math.sqrt(t.x*t.x+t.y*t.y),i=1):(r=-Math.sqrt(t.x*t.x+t.y*t.y),i=-1),o=0,r!==0&&(o=Math.atan2(i*t.x,i*t.y)),i=r*e.ns0/e.a,e.sphere){let c=(e.c-i*i)/(2*e.ns0);if(Math.abs(c)>1+8*Number.EPSILON)return null;a=Math.asin(Math.max(-1,Math.min(1,c)))}else{n=(e.c-i*i)/e.ns0;let c=Fr(e.e3,1);a=Math.abs(Math.abs(n)-c)<=16*Number.EPSILON*c?Math.sign(n)*Math.PI/2:nm(e.e3,n)}return s=G(o/e.ns0+e.long0,e.over),t.x=s,t.y=a,t}function fE(e){let t={...e,temp:0,e3:0,sin_po:0,cos_po:0,t1:0,con:0,ms1:0,qs1:0,t2:0,ms2:0,qs2:0,t3:0,qs0:0,ns0:0,c:0,rh:0,sin_phi:0,cos_phi:0};return $N(t),t}var Y1={name:"aea",aliases:["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers"],parameters:[...ar,"lat_1","lat_2"],create(e){let t=er(e);Lc(t,e.parameters);let r=fE(t),n={...Xe("aea",r,hE,uE,oi)};return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>Bc(n.forward,i,t.long0,r.ns0,r.x0,r.y0+r.rh,t.over),t.primeMeridian,t.over)}};Dc();Ie();Ht();ne();yn();Fc();ya();Uc();Gc();ue();Ae();Mh();function ho(e){return Math.abs(e)<=U?e:e-Xo(e)*Math.PI}function YN(e){Math.abs(e.lat1+e.lat2)<1e-10||(e.temp=e.b/e.a,e.es=1-Math.pow(e.temp,2),e.e=Math.sqrt(e.es),e.en=Ri(e.es),e.sin_phi=Math.sin(e.lat1),e.cos_phi=Math.cos(e.lat1),e.ms1=nn(e.e,e.sin_phi,e.cos_phi),e.ml1=rr(e.lat1,Math.sin(e.lat1),Math.cos(e.lat1),e.en),Math.abs(e.lat1-e.lat2)<1e-10?e.ns=e.sin_phi:(e.sin_phi=Math.sin(e.lat2),e.cos_phi=Math.cos(e.lat2),e.ms2=nn(e.e,e.sin_phi,e.cos_phi),e.ml2=rr(e.lat2,Math.sin(e.lat2),Math.cos(e.lat2),e.en),e.ns=(e.ms1-e.ms2)/(e.ml2-e.ml1)),e.g=e.ml1+e.ms1/e.ns,e.ml0=rr(e.lat0,Math.sin(e.lat0),Math.cos(e.lat0),e.en),e.rh=e.a*(e.g-e.ml0))}function dE(e,t){var r=t.x,n=t.y,i;if(e.sphere)i=e.a*(e.g-n);else{var o=rr(n,Math.sin(n),Math.cos(n),e.en);i=e.a*(e.g-o)}var s=e.ns*G(r-e.long0,e.over),a=e.x0+i*Math.sin(s),c=e.y0+e.rh-i*Math.cos(s);return t.x=a,t.y=c,t}function mE(e,t){t.x-=e.x0,t.y=e.rh-t.y+e.y0;var r,n,i,o;e.ns>=0?(n=Math.sqrt(t.x*t.x+t.y*t.y),r=1):(n=-Math.sqrt(t.x*t.x+t.y*t.y),r=-1);var s=0;if(n!==0&&(s=Math.atan2(r*t.x,r*t.y)),e.sphere)return o=G(e.long0+s/e.ns,e.over),i=ho(e.g-n/e.a),t.x=o,t.y=i,t;var a=e.g-n/e.a;return i=Ci(a,e.es,e.en),o=G(e.long0+s/e.ns,e.over),t.x=o,t.y=i,t}function pE(e){let t={...e,temp:0,en:[],sin_phi:0,cos_phi:0,ms1:0,ml1:0,ns:0,ms2:0,ml2:0,g:0,ml0:0,rh:0};return YN(t),t}var K1={name:"eqdc",aliases:["Equidistant_Conic"],parameters:[...ar,"lat_1","lat_2"],create(e){let t=er(e);Lc(t,e.parameters);let r=pE(t),n=Xe("eqdc",r,dE,mE,oi);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>Bc(n.forward,i,t.long0,r.ns,r.x0,r.y0+r.rh,t.over),t.primeMeridian,t.over)}};function os(e,t){let r=Math.abs(Math.sin(t)),n=Math.cos(t),i=n*n/(1+r);if(e===0)return 2*i;let o=e*e;return i*(1+o*r)/(1-o*r*r)+(1-o)/e*Math.atanh(e*i/(1-o*r))}function X1(e,t,r){if(r===0||e===0)return r;let n=os(e,r)/t;return Math.atan2(Math.sign(r)*(1-n),Math.sqrt(n*(2-n)))}function Z1(e,t,r){if(e===0||r===0||Math.abs(r)===Math.PI/2)return r;let n=Math.abs(Math.sin(r)),i=Math.cos(r),o=t*i*i/(1+n),s=Math.abs(r),a=e*e,c=0,l=Math.PI/2;for(let h=0;h<48;h++){let u=Math.sin(s),f=1-a*u*u,d=2*(1-a)*Math.cos(s)/(f*f),m=os(e,s)-o,p=m/d;if(Math.abs(p)<2e-15)return Math.sign(r)*s;m>0?c=s:l=s;let g=s+p;s=g>c&&g<l?g:(c+l)/2}throw new Error("Authalic latitude inverse did not converge")}Qo();ts();yn();Ae();ue();bh();var ci=1,Di=2,Wn=3,Ur=4;function KN(e){var t=Math.abs(e.lat0);if(Math.abs(t-U)<1e-10?e.mode=e.lat0<0?ci:Di:Math.abs(t)<1e-10?e.mode=Wn:e.mode=Ur,e.es>0){var r;switch(e.qp=Fr(e.e,1),e.mmf=.5/(1-e.es),e.mode){case Di:e.dd=1;break;case ci:e.dd=1;break;case Wn:e.rq=Math.sqrt(.5*e.qp),e.dd=1/e.rq,e.xmf=1,e.ymf=.5*e.qp;break;case Ur:e.rq=Math.sqrt(.5*e.qp),r=Math.sin(e.lat0),e.sinb1=Fr(e.e,r)/e.qp,e.cosb1=Math.sqrt(1-e.sinb1*e.sinb1),e.dd=Math.cos(e.lat0)/(Math.sqrt(1-e.es*r*r)*e.rq*e.cosb1),e.xmf=e.rq,e.ymf=e.xmf/e.dd,e.xmf*=e.dd;break}}else e.mode===Ur&&(e.sinph0=Math.sin(e.lat0),e.cosph0=Math.cos(e.lat0))}function gE(e,t){var r,n,i,o,s,a,c,l,h,u,f=t.x,d=t.y;if(f=G(f-e.long0,e.over),e.sphere){if(s=Math.sin(d),u=Math.cos(d),i=Math.cos(f),e.mode===Ur||e.mode===Wn){if(n=e.mode===Wn?1+u*i:1+e.sinph0*s+e.cosph0*u*i,n<=1e-10)return null;n=Math.sqrt(2/n),r=n*u*Math.sin(f),n*=e.mode===Wn?s:e.cosph0*s-e.sinph0*u*i}else if(e.mode===Di||e.mode===ci){if(e.mode===Di&&(i=-i),Math.abs(d+e.lat0)<1e-10)return null;n=$t-d*.5,n=2*(e.mode===ci?Math.cos(n):Math.sin(n)),r=n*Math.sin(f),n*=i}}else{if(c=0,l=0,h=0,i=Math.cos(f),o=Math.sin(f),s=Math.sin(d),a=Fr(e.e,s),e.mode===Ur||e.mode===Wn){c=a/e.qp;let m=os(e.e,d)/e.qp;l=Math.sqrt(m*(2-m))}switch(e.mode){case Ur:h=1+e.sinb1*c+e.cosb1*l*i;break;case Wn:h=1+l*i;break;case Di:h=U+d,a=d>=0?os(e.e,d):2*e.qp-os(e.e,d);break;case ci:h=d-U,a=d<=0?os(e.e,d):2*e.qp-os(e.e,d);break}if(Math.abs(h)<1e-10)return null;switch(e.mode){case Ur:case Wn:h=Math.sqrt(2/h),e.mode===Ur?n=e.ymf*h*(e.cosb1*c-e.sinb1*l*i):(h=Math.sqrt(2/(1+l*i)),n=h*c*e.ymf),r=e.xmf*h*l*o;break;case Di:case ci:a>=0?(h=Math.sqrt(a),r=h*o,n=i*(e.mode===ci?h:-h)):r=n=0;break}}return t.x=e.a*r+e.x0,t.y=e.a*n+e.y0,t}function yE(e,t){t.x-=e.x0,t.y-=e.y0;var r=t.x/e.a,n=t.y/e.a,i,o,s,a,c,l,h;if(e.sphere){var u=0,f,d=0;if(f=Math.sqrt(r*r+n*n),o=f*.5,o>1+8*Number.EPSILON)return null;switch(o=2*Math.asin(Math.min(1,o)),(e.mode===Ur||e.mode===Wn)&&(d=Math.sin(o),u=Math.cos(o)),e.mode){case Wn:o=Math.abs(f)<=1e-10?0:si(0,1,d,u,r,n,f),r*=d,n=u*f;break;case Ur:o=Math.abs(f)<=1e-10?e.lat0:si(e.sinph0,e.cosph0,d,u,r,n,f),r*=d*e.cosph0,n=(u-Math.sin(o)*e.sinph0)*f;break;case Di:n=-n,o=U-o;break;case ci:o-=U;break}i=n===0&&(e.mode===Wn||e.mode===Ur)?0:Math.atan2(r,n)}else{if(h=0,e.mode===Ur||e.mode===Wn){if(r/=e.dd,n*=e.dd,l=Math.sqrt(r*r+n*n),l<1e-10)return t.x=e.long0,t.y=e.lat0,t;let m=.5*l/e.rq;if(m>1+8*Number.EPSILON)return null;a=2*Math.asin(Math.min(1,m)),s=Math.cos(a),a=Math.sin(a);let p=si(e.mode===Ur?e.sinb1:0,e.mode===Ur?e.cosb1:1,a,s,r,n,l);o=Z1(e.e,e.qp,p),r*=a,e.mode===Ur?(h=s*e.sinb1+n*a*e.cosb1/l,c=e.qp*h,n=l*e.cosb1*s-n*e.sinb1*a):(h=n*a/l,c=e.qp*h,n=l*s)}else if(e.mode===Di||e.mode===ci){if(e.mode===Di&&(n=-n),c=r*r+n*n,!c)return t.x=e.long0,t.y=e.lat0,t;h=1-c/e.qp,e.mode===ci&&(h=-h)}if(i=Math.atan2(r,n),Math.abs(h)>1+8*Number.EPSILON)return null;if(e.mode===Di||e.mode===ci){let m=Math.max(0,Math.min(2,c/e.qp)),p=Math.atan2(h,Math.sqrt(m*(2-m)));o=Z1(e.e,e.qp,p)}}return t.x=G(e.long0+i,e.over),t.y=o,t}function wE(e){let t={...e,mode:0,qp:0,mmf:0,dd:0,rq:0,xmf:0,ymf:0,sinb1:0,cosb1:0,sinph0:0,cosph0:0};return KN(t),t}var J1={name:"laea",aliases:["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area"],parameters:ar,create(e){let t=er(e),r=wE(t);return rn(Yo(t,Xe("laea",r,gE,yE)),t,Math.PI*179/180,(n,i)=>px(t,t.sphere?1:r.xmf||Math.sqrt(r.qp/2),t.sphere?1:r.ymf||Math.sqrt(r.qp/2),n,i,t.sphere?t.lat0:X1(t.e,r.qp,t.lat0),t.sphere?o=>o:o=>X1(t.e,r.qp,o)))}};Sx();Qo();ts();yn();bh();function im(e,t){return Math.pow((1-e)/(1+e),t)}Ae();var XN=20;function ZN(e){var t=Math.sin(e.lat0),r=Math.cos(e.lat0);r*=r,e.rc=Math.sqrt(1-e.es)/(1-e.es*t*t),e.C=Math.sqrt(1+e.es*r*r/(1-e.es)),e.phic0=Math.asin(t/e.C),e.ratexp=.5*e.C*e.e,e.K=Math.tan(.5*e.phic0+$t)/(Math.pow(Math.tan(.5*e.lat0+$t),e.C)*im(e.e*t,e.ratexp))}function _E(e,t){var r=t.x,n=t.y;return t.y=2*Math.atan(e.K*Math.pow(Math.tan(.5*n+$t),e.C)*im(e.e*Math.sin(n),e.ratexp))-U,t.x=e.C*r,t}function ME(e,t){for(var r=1e-14,n=t.x/e.C,i=t.y,o=Math.pow(Math.tan(.5*i+$t)/e.K,1/e.C),s=XN;s>0&&(i=2*Math.atan(o*im(e.e*Math.sin(t.y),-.5*e.e))-U,!(Math.abs(i-t.y)<r));--s)t.y=i;return s?(t.x=n,t.y=i,t):null}function bE(e){let t={...e,rc:0,C:0,phic0:0,ratexp:0,K:0};return ZN(t),t}ue();ga();function JN(e){e.rc&&(e.sinc0=Math.sin(e.phic0),e.cosc0=Math.cos(e.phic0),e.R2=2*e.rc)}function xE(e,t){var r,n,i,o;return t.x=G(t.x-e.long0,e.over),_E(e,t),r=Math.sin(t.y),n=Math.cos(t.y),i=Math.cos(t.x),o=e.k0*e.R2/(1+e.sinc0*r+e.cosc0*n*i),t.x=o*n*Math.sin(t.x),t.y=o*(e.cosc0*r-e.sinc0*n*i),t.x=e.a*t.x+e.x0,t.y=e.a*t.y+e.y0,t}function SE(e,t){var r,n,i,o,s;if(t.x=(t.x-e.x0)/e.a,t.y=(t.y-e.y0)/e.a,t.x/=e.k0,t.y/=e.k0,s=ke(t.x,t.y),s){var a=2*Math.atan2(s,e.R2);r=Math.sin(a),n=Math.cos(a),o=si(e.sinc0,e.cosc0,r,n,t.x,t.y,s),i=Math.atan2(t.x*r,s*e.cosc0*n-t.y*e.sinc0*r)}else o=e.phic0,i=0;if(t.x=i,t.y=o,!ME(e,t))throw new Error("Oblique stereographic inverse did not converge");return t.x=G(t.x+e.long0,e.over),t}function vE(e){let t={...bE(e),sinc0:0,cosc0:0,R2:0};return JN(t),t}var Q1={name:"sterea",aliases:["Stereographic_North_Pole","Oblique_Stereographic","Oblique Stereographic Alternative","Double_Stereographic"],parameters:[...ar,...so],create(e){let t=er(e);if(Math.abs(t.lat0)===Math.PI/2)throw new Error("sterea requires a non-polar origin; use stere at the poles");let r=vE(t);return rn(Yo(t,Xe("sterea",r,xE,SE)),t,Math.PI*150/180,(n,i)=>rd(t,o=>2*Math.atan(r.K*Math.pow(Math.tan(Math.PI/4+o/2),r.C)*Math.pow((1-t.e*Math.sin(o))/(1+t.e*Math.sin(o)),r.ratexp))-Math.PI/2,r.phic0,t.a*t.k0*r.R2,n,i,r.C,Math.abs(Math.log(r.C))+Math.abs(Math.log(r.K))+r.C*t.e*Math.atanh(t.e)))}};Qo();ts();yn();bh();ue();Ae();function ty(e,t){let r=1-e*Math.sin(t)**2;return(1-e)/(r*Math.sqrt(r))}function om(e,t,r,n){return ty(e,t-r*n)+ty(e,t+r*n)}function Sn(e,t,r,n){let i=(n-r)/8,o=0;for(let s=0;s<4;s++){let a=r+(2*s+1)*i;o+=i*(.362683783378362*om(t,a,i,.1834346424956498)+.3137066458778873*om(t,a,i,.525532409916329)+.2223810344533745*om(t,a,i,.7966664774136267)+.1012285362903763*om(t,a,i,.9602898564975363))}return e*o}function ey(e,t,r){let n=Math.PI/2,i=Sn(e,t,0,n);if(!Number.isFinite(r)||Math.abs(r)>i)return NaN;let o=-n,s=n,a=r/i*n;for(let c=0;c<48;c++){let l=Sn(e,t,0,a)-r;if(Math.abs(l)<=8*Number.EPSILON*e)return a;l>0?s=a:o=a;let h=a-l/(e*ty(t,a));a=h>o&&h<s?h:(o+s)/2}return NaN}function EE(e,t,r,n,i,o,s){let a=n-t,c=Math.atan((1-o)*Math.tan(e)),l=Math.atan((1-o)*Math.tan(r)),h=Math.sin(c),u=Math.cos(c),f=Math.sin(l),d=Math.cos(l),m=a,p,g=100,y,_,b,M,T,A,S,v,N,B,C,R,W,j;do{if(y=Math.sin(m),_=Math.cos(m),b=Math.sqrt(d*y*(d*y)+(u*f-h*d*_)*(u*f-h*d*_)),b===0){s.x=0,s.y=0;return}M=h*f+u*d*_,T=Math.atan2(b,M),A=u*d*y/b,S=1-A*A,v=S!==0?M-2*h*f/S:0,N=o/16*S*(4+o*(4-3*S)),p=m,m=a+(1-N)*o*A*(T+N*b*(v+N*M*(-1+2*v*v)))}while(Math.abs(m-p)>1e-12&&--g>0);if(g===0){s.x=NaN,s.y=NaN;return}B=S*(i*i-i*(1-o)*(i*(1-o)))/(i*(1-o)*(i*(1-o))),C=1+B/16384*(4096+B*(-768+B*(320-175*B))),R=B/1024*(256+B*(-128+B*(74-47*B))),W=R*b*(v+R/4*(M*(-1+2*v*v)-R/6*v*(-3+4*b*b)*(-3+4*v*v))),j=i*(1-o)*C*(T-W);let I=Math.atan2(d*y,u*f-h*d*_);s.x=I,s.y=j}function TE(e,t,r,n,i,o,s){let a=Math.atan((1-o)*Math.tan(e)),c=Math.sin(a),l=Math.cos(a),h=Math.sin(r),u=Math.cos(r),f=Math.atan2(c,l*u),d=l*h,m=1-d*d,p=m*(i*i-i*(1-o)*(i*(1-o)))/(i*(1-o)*(i*(1-o))),g=1+p/16384*(4096+p*(-768+p*(320-175*p))),y=p/1024*(256+p*(-128+p*(74-47*p))),_=n/(i*(1-o)*g),b,M=100,T,A,S,v;do T=Math.cos(2*f+_),A=Math.sin(_),S=Math.cos(_),v=y*A*(T+y/4*(S*(-1+2*T*T)-y/6*T*(-3+4*A*A)*(-3+4*T*T))),b=_,_=n/(i*(1-o)*g)+v;while(Math.abs(_-b)>1e-12&&--M>0);if(M===0){s.x=NaN,s.y=NaN;return}let N=c*A-l*S*u,B=Math.atan2(c*S+l*A*u,(1-o)*Math.sqrt(d*d+N*N)),C=Math.atan2(A*h,l*S-c*A*u),R=o/16*m*(4+o*(4-3*m)),W=C-(1-R)*o*d*(_+R*A*(T+R*S*(-1+2*T*T))),j=t+W;s.x=j,s.y=B}function QN(e){e.sin_p12=Math.sin(e.lat0),e.cos_p12=Math.cos(e.lat0),e.x0=e.x0||0,e.y0=e.y0||0,e.long0=e.long0||0,e.f=e.es/(1+Math.sqrt(1-e.es))}function IE(e,t){var r=t.x,n=t.y,i=Math.sin(t.y),o=Math.cos(t.y),s=G(r-e.long0,e.over),a,c,l,h,u;if(e.sphere)return Math.abs(e.sin_p12-1)<=1e-10?(t.x=e.x0+e.a*(U-n)*Math.sin(s),t.y=e.y0-e.a*(U-n)*Math.cos(s),t):Math.abs(e.sin_p12+1)<=1e-10?(t.x=e.x0+e.a*(U+n)*Math.sin(s),t.y=e.y0+e.a*(U+n)*Math.cos(s),t):(h=e.sin_p12*i+e.cos_p12*o*Math.cos(s),c=Math.acos(h),l=c?c/Math.sin(c):1,t.x=e.x0+e.a*l*o*Math.sin(s),t.y=e.y0+e.a*l*(e.cos_p12*i-e.sin_p12*o*Math.cos(s)),t);if(Math.abs(e.sin_p12-1)<=1e-10)return a=Sn(e.a,e.es,n,U),t.x=e.x0+a*Math.sin(s),t.y=e.y0-a*Math.cos(s),t;if(Math.abs(e.sin_p12+1)<=1e-10)return a=Sn(e.a,e.es,-U,n),t.x=e.x0+a*Math.sin(s),t.y=e.y0+a*Math.cos(s),t;{if(Math.abs(s)<1e-10&&Math.abs(n-e.lat0)<1e-10)return t.x=e.x0,t.y=e.y0,t;EE(e.lat0,e.long0,n,r,e.a,e.f,t),u=t.x;let f=t.y;return t.x=e.x0+f*Math.sin(u),t.y=e.y0+f*Math.cos(u),t}}function AE(e,t){t.x-=e.x0,t.y-=e.y0;var r,n,i,o,s,a,c,l,h,u,f;if(e.sphere){if(r=Math.sqrt(t.x*t.x+t.y*t.y),r>2*U*e.a)return null;if(n=r/e.a,i=Math.sin(n),o=Math.cos(n),s=e.long0,Math.abs(r)<=1e-10)a=e.lat0;else if(a=si(e.sin_p12,e.cos_p12,i,o,t.x,t.y,r),c=Math.abs(e.lat0)-U,Math.abs(c)<=1e-10)if(e.lat0>=0){if(!Number.isFinite(a))return null;s=G(e.long0+Math.atan2(t.x,-t.y),e.over)}else s=G(e.long0-Math.atan2(-t.x,t.y),e.over);else s=G(e.long0+Math.atan2(t.x*i,r*e.cos_p12*o-t.y*e.sin_p12*i),e.over);return t.x=s,t.y=a,t}else return Math.abs(e.sin_p12-1)<=1e-10?(l=Sn(e.a,e.es,0,U),r=Math.sqrt(t.x*t.x+t.y*t.y),h=l-r,a=ey(e.a,e.es,h),Number.isFinite(a)?(s=G(e.long0+Math.atan2(t.x,-1*t.y),e.over),t.x=s,t.y=a,t):null):Math.abs(e.sin_p12+1)<=1e-10?(l=Sn(e.a,e.es,0,U),r=Math.sqrt(t.x*t.x+t.y*t.y),h=r-l,a=ey(e.a,e.es,h),Number.isFinite(a)?(s=G(e.long0+Math.atan2(t.x,t.y),e.over),t.x=s,t.y=a,t):null):(u=Math.atan2(t.x,t.y),f=Math.sqrt(t.x*t.x+t.y*t.y),TE(e.lat0,e.long0,u,f,e.a,e.f,t),t)}function PE(e){let t={...e,sin_p12:0,cos_p12:0,f:0};return QN(t),t}var ry={name:"aeqd",aliases:["Azimuthal_Equidistant"],parameters:ar,create(e){let t=er(e),r=PE(t);return rn(Yo(t,Xe("aeqd",r,IE,AE)),t,Math.PI*179/180,(n,i)=>mx(t,n,i))}};zg();fx();var ny={name:"geocent",aliases:["Geocentric","geocentric","Geocent"],parameters:[],create({semiMajorAxis:e,semiMinorAxis:t,eccentricitySquared:r,primeMeridian:n=0}){let i={semiMajorAxis:e,eccentricitySquared:r,semiMinorAxis:t??e*Math.sqrt(1-r)};return{getRenderingProfile:()=>({bounds:[[-e,-e,-i.semiMinorAxis],[e,e,i.semiMinorAxis]],normalize:is({},n)().normalize}),forward(){throw new Error("Geocentric projection requires the 3D pipeline")},inverse(){throw new Error("Geocentric projection requires the 3D pipeline")},forwardInPlace:o=>Xd(o,i),inverseInPlace:o=>Zd(o,i),forward3D:o=>qv(o,i),inverse3D:o=>jv(o,i)}}};Ht();wa();Ie();xh();Ae();function RE(e,t,r){let n=qo(gr(r,e.long0,e.over)),i=e.a/Math.sqrt(1-e.es),o=kn(t(e.long0,r[0][1])[1],t(e.long0,r[1][1])[1]),s=Math.max(Math.abs(e.a*(e.es?e.am1:e.cphi1)+e.y0-o[0]),Math.abs(e.a*(e.es?e.am1:e.cphi1)+e.y0-o[1])),a=Math.min(s,i*n),c=Math.min(2*s,i*n);return re([e.x0-a,e.x0+a],[o[0]-c,o[1]+c])}function CE(e,t,r){let n=qo(gr(r,e.long0,e.over)),i=e.a/Math.sqrt(1-e.es),o=i*n*n/4,s=kn(t(e.long0,r[0][1])[1],t(e.long0,r[1][1])[1]);return e.sphere&&(r[0][1]-e.lat0<-Math.PI/2||r[1][1]-e.lat0>Math.PI/2)&&(s=[e.y0-e.a*Math.PI/2,e.y0+e.a*Math.PI/2]),re([e.x0-i*n,e.x0+i*n],[s[0]-o,s[1]+o])}function NE(e,t,r){let n=qo(gr(r,e.long0,e.over));if(e.sphere&&n>Math.PI/2)throw new Error("Unsupported Cassini rendering coverage");let i=e.a/Math.sqrt(1-e.es),o=e.es/(1-e.es),s=e.sphere?e.a*Math.asin(Math.min(1,Math.sin(Math.min(n,Math.PI/2)))):i*(n+n**3/6+(9+8*o)*n**5/120),a=e.sphere?e.a*n:i*(n*n/4+(6+6*o)*n**4/24),c=kn(t(e.long0,r[0][1])[1],t(e.long0,r[1][1])[1]);return re([e.x0-s,e.x0+s],[c[0]-a,c[1]+a])}function iy(e,t){return t[0]<=0&&t[1]>=0?[-1/0,1/0]:Te(e,kn(1/t[0],1/t[1]))}function OE(e,t){let r=l=>{let h=e.alpha*(Math.asinh(Math.tan(l))-e.e*Math.atanh(e.e*Math.sin(l)))+e.K;return Math.asin(Math.tanh(h))},n=K((t[0][0]-e.long0)*e.alpha,r(t[0][1]),(t[1][0]-e.long0)*e.alpha,r(t[1][1])),i=se([-Math.sin(e.b0),0,Math.cos(e.b0)],n);if(qo(i)>=1-1e-14)throw new Error("Swiss oblique Mercator coverage reaches a rotated pole");let o=se([0,1,0],n),s=se([Math.cos(e.b0),0,Math.sin(e.b0)],n),a=iy(o,s).map(Math.atan),c=i.map(l=>Math.atanh(Math.max(-1+Number.EPSILON,Math.min(1-Number.EPSILON,l))));return re(At([e.x0,e.x0],Ct(a,e.R)),At([e.y0,e.y0],Ct(c,e.R)))}function BE(e,t){let r=m=>Math.log(e.E)-e.B*Math.log(Lr(e.e,m,Math.sin(m))),n=kn(r(t[0][1]),r(t[1][1])),i=Ct([t[0][0]-e.lam0,t[1][0]-e.lam0],e.B),o=K(i[0],Math.asin(Math.tanh(n[0])),i[1],Math.asin(Math.tanh(n[1]))),s=se([0,-e.cosgam,e.singam],o),a=Ct(kn(-Math.atanh(s[0]),-Math.atanh(s[1])),e.ArB),c=At(Ct([Math.sinh(n[0]),Math.sinh(n[1])],e.cosgam),Ct(yh(i),e.singam)),l=Hf(i),h=l[0]>0?iy(c,l).map(Math.atan):[-Math.PI,Math.PI],u=Ct(h,e.ArB),f,d;return e.no_rot?(f=u,d=a):(u=At(u,[-e.u_0,-e.u_0]),f=At(Ct(a,e.cosrot),Ct(u,e.sinrot)),d=At(Ct(u,e.cosrot),Ct(a,-e.sinrot))),re(At([e.x0,e.x0],Ct(f,e.a)),At([e.y0,e.y0],Ct(d,e.a)))}function LE(e,t){let r=d=>2*(Math.atan(e.k*Math.pow(Math.tan(d/2+e.s45),e.alfa)/Math.pow((1+e.e*Math.sin(d))/(1-e.e*Math.sin(d)),e.alfa*e.e/2))-e.s45),n=Ct(gr(t,e.long0,e.over),-e.alfa),i=K(n[0],r(t[0][1]),n[1],r(t[1][1])),o=se([Math.sin(e.ad),0,Math.cos(e.ad)],i),s=[Math.sqrt(Math.max(Number.EPSILON,1-qo(o)**2)),1],a=se([0,1,0],i),c=iy(a,s),l=Ct(c.map(d=>Math.asin(Math.max(-1,Math.min(1,d)))),e.n),h=d=>e.ro0*Math.pow(Math.tan(e.s0/2+e.s45)/Math.tan(Math.asin(d)/2+e.s45),e.n),u=kn(h(o[0]),h(o[1])),f=e.czech?1:-1;return re(At([e.x0,e.x0],Ct(Te(u,yh(l)),f)),At([e.y0,e.y0],Ct(Te(u,Hf(l)),f)))}function DE(e,t){let r=Ct([t[0][1]-e.lat0,t[1][1]-e.lat0],1e-5/_h),n=gr(t,e.long0,e.over),i=[0,0];for(let l=10;l>=1;l--)i=At([e.A[l],e.A[l]],Te(i,r));i=Te(i,r);let o=[0,0],s=[0,0];for(let l=6;l>=1;l--){let h=At(Te(o,i),Ct(Te(s,n),-1)),u=At(Te(o,n),Te(s,i));o=At(h,[e.B_re[l],e.B_re[l]]),s=At(u,[e.B_im[l],e.B_im[l]])}let a=At(Te(o,i),Ct(Te(s,n),-1)),c=At(Te(o,n),Te(s,i));return re(At([e.x0,e.x0],Ct(c,e.a)),At([e.y0,e.y0],Ct(a,e.a)))}Ht();ne();ma();yn();Ee();function vt(e){let t=er(e);return{...t,x0:0,y0:0,lat_ts:Number.isNaN(t.lat_ts)?0:t.lat_ts}}function Pe(e,t){return{...e,x0:tt(t.parameters,"x_0",0),y0:tt(t.parameters,"y_0",0)}}function Et(e,t,r,n,i,o){let s=Xe(e,r,n,i),a=tt(t.parameters,"x_0",0),c=tt(t.parameters,"y_0",0);return qn(l=>{o?.(l.x,l.y),s.forwardInPlace(l),l.x+=a,l.y+=c},l=>{l.x-=a,l.y-=c,s.inverseInPlace(l)})}function ss(e,t=0,r=!1){return(n,i)=>{let o=Math.sin(e.lat0)*Math.sin(i)+Math.cos(e.lat0)*Math.cos(i)*Math.cos(n-e.long0);if(r?o<t-1e-14:o<=t+1e-14)throw new Error("Coordinate is outside the visible projection horizon")}}ue();ga();Fc();Uc();ya();Ae();var Hh=1e-10;function tO(e){var t;if(e.phi1=e.lat1,Math.abs(e.phi1)<Hh)throw new Error;e.es?(e.en=Ri(e.es),e.am1=Math.sin(e.phi1),t=Math.cos(e.phi1),e.m1=rr(e.phi1,e.am1,t,e.en),e.am1=t/(Math.sqrt(1-e.es*e.am1*e.am1)*e.am1)):Math.abs(e.phi1)+Hh>=U?e.cphi1=0:e.cphi1=1/Math.tan(e.phi1)}function eO(e,t){var r=G(t.x-(e.long0||0),e.over),n=t.y,i,o,s;return o=Math.sin(n),s=Math.cos(n),i=e.am1+e.m1-rr(n,o,s,e.en),o=s*r/(i*Math.sqrt(1-e.es*o*o)),t.x=i*Math.sin(o),t.y=e.am1-i*Math.cos(o),t.x=e.a*t.x+(e.x0||0),t.y=e.a*t.y+(e.y0||0),t}function rO(e,t){t.x=(t.x-(e.x0||0))/e.a,t.y=(t.y-(e.y0||0))/e.a;var r,n,i,o;if(t.y=e.am1-t.y,n=ke(t.x,t.y),e.phi1<0&&(n=-n),o=Ci(e.am1+e.m1-n,e.es,e.en),r=Math.abs(o),r<U)r=Math.sin(o),i=n*Math.atan2(Math.sign(e.phi1)*t.x,Math.sign(e.phi1)*t.y)*Math.sqrt(1-e.es*r*r)/Math.cos(o);else if(Math.abs(r-U)<=Hh)i=0;else throw new Error;return t.x=G(i+(e.long0||0),e.over),t.y=ho(o),t}function nO(e,t){var r=G(t.x-(e.long0||0),e.over),n=t.y,i,o;return o=e.cphi1+e.phi1-n,Math.abs(o)>Hh?(i=r*Math.cos(n)/o,t.x=o*Math.sin(i),t.y=e.cphi1-o*Math.cos(i)):t.x=t.y=0,t.x=e.a*t.x+(e.x0||0),t.y=e.a*t.y+(e.y0||0),t}function iO(e,t){t.x=(t.x-(e.x0||0))/e.a,t.y=(t.y-(e.y0||0))/e.a;var r,n;t.y=e.cphi1-t.y;var i=ke(t.x,t.y);if(e.phi1<0&&(i=-i),n=e.cphi1+e.phi1-i,Math.abs(n)>U)throw new Error;return Math.abs(Math.abs(n)-U)<=Hh?r=0:r=i*Math.atan2(Math.sign(e.phi1)*t.x,Math.sign(e.phi1)*t.y)/Math.cos(n),t.x=G(r+(e.long0||0),e.over),t.y=ho(n),t}function FE(e,t){return e.es?eO(e,t):nO(e,t)}function UE(e,t){return e.es?rO(e,t):iO(e,t)}function GE(e,t={}){let r={...e,phi1:0,en:[],m1:0,am1:0,cphi1:0,...t};return tO(r),r}var oy={name:"bonne",aliases:["Bonne (Werner lat_1=90)"],parameters:["lon_0","x_0","y_0","lat_1"],create(e){let t=vt(e);if(!Object.prototype.hasOwnProperty.call(e.parameters,"lat_1")||Math.abs(t.lat1)<1e-10)throw new Error("Bonne requires a nonzero lat_1");let r=GE(t),n=Et("bonne",e,r,FE,UE);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>RE(Pe(r,e),n.forward,i),t.primeMeridian,t.over)}};Ht();ne();Fc();ya();Uc();function Jc(e,t,r){var n=t*r;return e/Math.sqrt(1-n*n)}ue();Ae();function oO(e){e.sphere||(e.en=Ri(e.es),e.ml0=e.a*rr(e.lat0,Math.sin(e.lat0),Math.cos(e.lat0),e.en))}function ay(e,t){var r,n,i=t.x,o=t.y;if(i=G(i-e.long0,e.over),e.sphere)r=e.a*Math.asin(Math.cos(o)*Math.sin(i)),n=e.a*(Math.atan2(Math.tan(o),Math.cos(i))-e.lat0);else{var s=Math.sin(o),a=Math.cos(o),c=Jc(e.a,e.e,s),l=Math.tan(o)*Math.tan(o),h=i*Math.cos(o),u=h*h,f=e.es*a*a/(1-e.es),d=e.a*rr(o,s,a,e.en);r=c*h*(1-u*l*(1/6+(8-l+8*f)*u/120)),n=d-e.ml0+c*s/a*u*(.5+(5-l+6*f)*u/24)}return t.x=r+e.x0,t.y=n+e.y0,t}function zE(e,t){t.x-=e.x0,t.y-=e.y0;var r=t.x/e.a,n=t.y/e.a,i,o;if(e.sphere){var s=n+e.lat0;i=Math.asin(Math.sin(s)*Math.cos(r)),o=Math.atan2(Math.tan(r),Math.cos(s))}else{var a=e.ml0/e.a+n,c=Ci(a,e.es,e.en);if(Math.abs(Math.abs(c)-U)<=1e-10)return t.x=e.long0,t.y=Math.sign(c)*U,t;var l=Jc(e.a,e.e,Math.sin(c)),h=l*l*l/e.a/e.a*(1-e.es),u=Math.pow(Math.tan(c),2),f=r*e.a/l,d=f*f;i=c-l*Math.tan(c)/h*f*f*(.5-(1+3*u)*f*f/24),o=f*(1-d*(u/3-(1+3*u)*u*d/15))/Math.cos(c)}if(!e.sphere){let m=t.x+e.x0,p=t.y+e.y0,g=e.scratch,y=!1;for(let _=0;_<12;_++){sy(e,o,i);let b=g.x-m,M=g.y-p;if(Math.max(Math.abs(b),Math.abs(M))<1e-7){y=!0;break}let T=1e-7,A=i>U-T?-T:T,S=g.x,v=g.y;sy(e,o+T,i);let N=(g.x-S)/T,B=(g.y-v)/T;sy(e,o,i+A);let C=(g.x-S)/A,R=(g.y-v)/A,W=N*R-C*B;if(!Number.isFinite(W)||Math.abs(W)<1e-12||(o-=(R*b-C*M)/W,i-=(N*M-B*b)/W,!Number.isFinite(o)||Math.abs(i)>U))break}if(!y)throw new Error("Cassini inverse did not converge")}return t.x=G(o+e.long0,e.over),t.y=ho(i),t}function sy(e,t,r){e.scratch.x=t+e.long0,e.scratch.y=r,ay(e,e.scratch)}function VE(e,t={}){let r={...e,en:[],scratch:{x:0,y:0},ml0:0,...t};return oO(r),r}var cy={name:"cass",aliases:["Cassini","Cassini_Soldner"],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=vt(e),r=VE(t),n=Et("cass",e,r,ay,zE);return Pt(n,K(t.long0-Math.PI/6,-Math.PI/2+1e-8,t.long0+Math.PI/6,Math.PI/2-1e-8),i=>NE(Pe(t,e),n.forward,i),t.primeMeridian,t.over)}};Ie();Ht();ne();ue();Gc();function sO(e){e.sphere||(e.k0=nn(e.e,Math.sin(e.lat_ts),Math.cos(e.lat_ts)))}function kE(e,t){var r=t.x,n=t.y,i,o,s=G(r-e.long0,e.over);if(e.sphere)i=e.x0+e.a*s*Math.cos(e.lat_ts),o=e.y0+e.a*Math.sin(n)/Math.cos(e.lat_ts);else{var a=Fr(e.e,Math.sin(n));i=e.x0+e.a*e.k0*s,o=e.y0+e.a*a*.5/e.k0}return t.x=i,t.y=o,t}function qE(e,t){t.x-=e.x0,t.y-=e.y0;var r,n;return e.sphere?(r=G(e.long0+t.x/e.a/Math.cos(e.lat_ts),e.over),n=Math.asin(t.y/e.a*Math.cos(e.lat_ts))):(n=nm(e.e,2*t.y*e.k0/e.a),r=G(e.long0+t.x/(e.a*e.k0),e.over)),t.x=r,t.y=n,t}function jE(e,t={}){let r={...e,...t};return sO(r),r}var ly={name:"cea",aliases:[],parameters:["lon_0","x_0","y_0","lat_ts"],create(e){let t=vt(e);if(Math.abs(t.lat_ts)>=Math.PI/2)throw new Error("CEA standard parallel must be away from the poles");let r=jE(t),n=Et("cea",e,r,kE,qE);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ie();Ht();ne();ue();Fc();ya();Uc();Ae();function Ia(e){return Math.abs(e)>1&&(e=e>1?1:-1),Math.asin(e)}var aO=20;function cO(e){e.long0=e.long0||0,e.sphere?(e.n=1,e.m=0,e.es=0,e.C_y=Math.sqrt((e.m+1)/e.n),e.C_x=e.C_y/(e.m+1)):e.en=Ri(e.es)}function sm(e,t){var r,n,i=t.x,o=t.y;if(i=G(i-e.long0,e.over),e.sphere){if(!e.m)o=e.n!==1?Math.asin(e.n*Math.sin(o)):o;else for(var s=e.n*Math.sin(o),a=aO;a;--a){var c=(e.m*o+Math.sin(o)-s)/(e.m+Math.cos(o));if(o-=c,Math.abs(c)<1e-10)break}r=e.a*e.C_x*i*(e.m+Math.cos(o)),n=e.a*e.C_y*o}else{var l=Math.sin(o),h=Math.cos(o);n=e.a*rr(o,l,h,e.en),r=e.a*i*h/Math.sqrt(1-e.es*l*l)}return t.x=r,t.y=n,t}function am(e,t){var r,n,i,o;if(t.x-=e.x0,i=t.x/e.a,t.y-=e.y0,r=t.y/e.a,e.sphere){if(r/=e.C_y,i=i/(e.C_x*(e.m+Math.cos(r))),e.m){let s=(e.m*r+Math.sin(r))/e.n;if(Math.abs(s)>1+8*Number.EPSILON)return null;r=Ia(s)}else e.n!==1&&(r=Ia(Math.sin(r)/e.n));i=G(i+e.long0,e.over),r=ho(r)}else r=Ci(t.y/e.a,e.es,e.en),o=Math.abs(r),o<U?(o=Math.sin(r),n=e.long0+t.x*Math.sqrt(1-e.es*o*o)/(e.a*Math.cos(r)),i=G(n,e.over)):o-1e-10<U&&(i=e.long0);return t.x=i,t.y=r,t}function WE(e,t={}){let r={...e,en:[],n:0,m:0,C_y:0,C_x:0,...t};return cO(r),r}function lO(e){e.sphere=!0,e.b=e.a,e.m=1,e.n=2.5707963267948966,e.es=0,e.C_y=Math.sqrt((e.m+1)/e.n),e.C_x=e.C_y/(e.m+1)}var HE=sm,$E=am;function YE(e,t={}){let r={...e,m:0,n:0,C_y:0,C_x:0,en:[],...t};return lO(r),r}var hy={name:"eck6",aliases:["Eckert_VI"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=YE(t),n=Et("eck6",e,r,HE,$E);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ee();ue();var hO=.3333333333333333,uO=.17222222222222222,fO=.10257936507936508,dO=.06388888888888888,mO=.0664021164021164,pO=.016415012942191543;function uy(e){var t,r=[];return r[0]=e*hO,t=e*e,r[0]+=t*uO,r[1]=t*dO,t*=e,r[0]+=t*fO,r[1]+=t*mO,r[2]=t*pO,r}function fy(e,t){var r=e+e;return e+t[0]*Math.sin(r)+t[1]*Math.sin(r+r)+t[2]*Math.sin(r+r+r)}var Qc=1.340264,tl=-.081106,el=893e-6,rl=.003796,cm=Math.sqrt(3)/2;function gO(e){e.long0=e.long0!==void 0?e.long0:0,e.x0=e.x0!==void 0?e.x0:0,e.y0=e.y0!==void 0?e.y0:0,e.es!==0&&(e.apa=uy(e.es),e.qp=Fr(e.e,1),e.rqda=Math.sqrt(.5*e.qp))}function KE(e,t){var r=G(t.x-e.long0,e.over),n=t.y,i=Math.sin(n);e.es!==0&&(i=Fr(e.e,i)/e.qp);var o=Math.asin(cm*i),s=o*o,a=s*s*s;return t.x=r*Math.cos(o)/(cm*(Qc+3*tl*s+a*(7*el+9*rl*s))),t.y=o*(Qc+tl*s+a*(el+rl*s)),e.es!==0&&(t.x*=e.rqda,t.y*=e.rqda),t.x=e.a*t.x+e.x0,t.y=e.a*t.y+e.y0,t}function XE(e,t){t.x=(t.x-e.x0)/e.a,t.y=(t.y-e.y0)/e.a,e.es!==0&&(t.x/=e.rqda,t.y/=e.rqda);let r=Math.PI/3,n=r*r,i=r*(Qc+tl*n+n**3*(el+rl*n));if(Math.abs(t.y)>i+8*Number.EPSILON*i)return null;var o=1e-9,s=12,a=t.y,c,l,h,u,f,d;for(d=0;d<s&&(c=a*a,l=c*c*c,h=a*(Qc+tl*c+l*(el+rl*c))-t.y,u=Qc+3*tl*c+l*(7*el+9*rl*c),a-=f=h/u,!(Math.abs(f)<o));++d);c=a*a,l=c*c*c,t.x=cm*t.x*(Qc+3*tl*c+l*(7*el+9*rl*c))/Math.cos(a);let m=Math.sin(a)/cm,p=8*Number.EPSILON;return Math.abs(m)>1+p?null:(t.y=Math.abs(m)>=1-p?Math.sign(m)*Math.PI/2:Math.asin(m),e.es!==0&&(t.y=fy(t.y,e.apa)),t.x=G(t.x+e.long0,e.over),t)}function ZE(e,t={}){let r={...e,apa:[],qp:0,rqda:0,...t};return gO(r),r}Ht();ne();Ie();var dy={name:"eqearth",aliases:["Equal Earth","Equal_Earth"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=e.primeMeridian??0,n=ZE(t),i=Et("eqearth",e,n,KE,XE),o=Math.sqrt(e.eccentricitySquared),s=e.semiMajorAxis*(o?Math.sqrt((1+(1-o*o)*Math.atanh(o)/o)/2):1),a=Math.PI/3,c=a*a,l=c**3,h=s*Math.PI/(Math.sqrt(3)/2*1.340264),u=tt(e.parameters,"x_0",0),f=tt(e.parameters,"y_0",0),d=s*a*(1.340264-.081106*c+l*(893e-6+.003796*c));return{...i,longitudeOrigin:t.long0,getRenderingProfile(m){if(m)return Ke(g=>yr(i.forward,g,t.long0,t.over),m,t.long0,r,t.over);let p=[[u-h,f-d,0],[u+h,f+d,0]];return{bounds:p,normalize:Ke(()=>p,gn(K(t.long0-Math.PI,-(Math.PI/2),t.long0+Math.PI,Math.PI/2),r),t.long0,r,t.over).normalize}}}}};Ie();Ht();ne();ue();function yO(e){e.x0=e.x0||0,e.y0=e.y0||0,e.lat0=e.lat0||0,e.long0=e.long0||0}function JE(e,t){var r=t.x,n=t.y,i=G(r-e.long0,e.over),o=e.x0+e.a*i*Math.cos(e.lat0),s=e.y0+e.a*n;return e.t1=o,e.t2=Math.cos(e.lat0),t.x=o,t.y=s,t}function QE(e,t){t.x-=e.x0,t.y-=e.y0;var r=t.y/e.a;Math.abs(r)>Math.PI/2&&Math.abs(r)<=Math.PI/2+8*Number.EPSILON&&(r=Math.sign(r)*Math.PI/2);var n=G(e.long0+t.x/(e.a*Math.cos(e.lat0)),e.over);return t.x=n,t.y=r,t}function tT(e,t={}){let r={...e,t2:0,t1:0,...t};return yO(r),r}var my={name:"equi",aliases:[],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=vt(e);if(Math.abs(t.lat0)>=Math.PI/2)throw new Error("Equirectangular standard parallel must be away from the poles");let r=tT(t),n=Et("equi",e,r,JE,QE);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ht();da();ne();Ee();wa();Ie();function eT(e,t,r=!1){let n=1+t/e.a,i=n/(1+1e-10),o=u=>Math.acos(Math.min(1,Math.sqrt(1-e.es*Math.sin(u)**2)/(i*Math.cos(u)))),s=u=>{let f=(i*Math.cos(u))**2;return Math.asin(Math.sqrt(Math.max(0,(f-1)/(f-e.es))))},a=t*Math.asin(1/n),c=t*Math.atan(Math.sqrt((1-e.es)/(n*n-1))),l=(u,f)=>{let d=Math.max(u[0][1],Math.min(u[1][1],0)),m=o(d),p=Math.max(u[0][0]-e.long0,-m),g=Math.min(u[1][0]-e.long0,m),y=s(Math.max(p,Math.min(g,0))),_=Math.max(u[0][1],-y),b=Math.min(u[1][1],y);if(g<p||b<_)return null;let M=K(p,_,g,b),T=gn(K(p+e.long0,_,g+e.long0,b),e.primeMeridian),A=(e.long0+e.primeMeridian)*180/Math.PI,S=Wo(v=>{let N=Math.max(p,Math.min(g,ve(v.x-e.long0))),B=s(N),C=Math.max(Math.max(_,-B),Math.min(Math.min(b,B),v.y));N!==v.x-e.long0&&(v.x=N+e.long0),v.y=C},e.primeMeridian);return{get bounds(){if(!f)return re([e.x0-a,e.x0+a],[e.y0-c,e.y0+c]);let v=se([0,0,1],M),N=[1,1/Math.sqrt(1-e.es*Math.max(v[0]**2,v[1]**2))],B=Te(se([1,0,0],M),N),C=Te(se([0,1,0],M),N),R=Te(v,[1-e.es,(1-e.es)*N[1]]),W=[n-Math.min(1,B[1]),n-Math.max(1/n,B[0])],j=(I,P,D,F)=>{let L=P[0]<=0&&P[1]>=0?0:Math.min(Math.abs(P[0]),Math.abs(P[1])),O=F?[Math.hypot(W[0],L),Math.hypot(W[1],Math.max(Math.abs(P[0]),Math.abs(P[1])))]:W,V=I.flatMap(yt=>O.map(Dt=>t*Math.atan(yt/Dt)));return[Math.max(-D,Math.min(...V)),Math.min(D,Math.max(...V))]};return re(At([e.x0,e.x0],j(C,R,a,r)),At([e.y0,e.y0],j(R,C,c,!r)))},normalize(v){Kf(v,T,A),S(v)}}},h=gn(K(e.long0-o(0),-s(0),e.long0+o(0),s(0)),e.primeMeridian);return u=>{let f=u?$f(u,h):[h],d=Yf(f,m=>l(jo(m,e.primeMeridian,e.long0),!!u));if(!d)throw new Error("CRS coverage does not intersect the satellite limb");return d}}ga();function wO(e){if(e.flip_axis=e.sweep==="x"?1:0,e.h=Number(e.h),e.radius_g_1=e.h/e.a,e.radius_g_1<=0||e.radius_g_1>1e10)throw new Error;if(e.radius_g=1+e.radius_g_1,e.C=e.radius_g*e.radius_g-1,e.es!==0){var t=1-e.es,r=1/t;e.radius_p=Math.sqrt(t),e.radius_p2=t,e.radius_p_inv2=r,e.shape="ellipse"}else e.radius_p=1,e.radius_p2=1,e.radius_p_inv2=1,e.shape="sphere"}function rT(e,t){var r=t.x,n=t.y,i,o,s,a;if(r=r-e.long0,e.shape==="ellipse"){n=Math.atan(e.radius_p2*Math.tan(n));var c=e.radius_p/ke(e.radius_p*Math.cos(n),Math.sin(n));if(o=c*Math.cos(r)*Math.cos(n),s=c*Math.sin(r)*Math.cos(n),a=c*Math.sin(n),(e.radius_g-o)*o-s*s-a*a*e.radius_p_inv2<0)return t.x=Number.NaN,t.y=Number.NaN,t;i=e.radius_g-o,e.flip_axis?(t.x=e.radius_g_1*Math.atan(s/ke(a,i)),t.y=e.radius_g_1*Math.atan(a/i)):(t.x=e.radius_g_1*Math.atan(s/i),t.y=e.radius_g_1*Math.atan(a/ke(s,i)))}else e.shape==="sphere"&&(i=Math.cos(n),o=Math.cos(r)*i,s=Math.sin(r)*i,a=Math.sin(n),i=e.radius_g-o,e.flip_axis?(t.x=e.radius_g_1*Math.atan(s/ke(a,i)),t.y=e.radius_g_1*Math.atan(a/i)):(t.x=e.radius_g_1*Math.atan(s/i),t.y=e.radius_g_1*Math.atan(a/ke(s,i))));return t.x=t.x*e.a,t.y=t.y*e.a,t}function nT(e,t){var r=-1,n=0,i=0,o,s,a,c;if(t.x=t.x/e.a,t.y=t.y/e.a,e.shape==="ellipse"){e.flip_axis?(i=Math.tan(t.y/e.radius_g_1),n=Math.tan(t.x/e.radius_g_1)*ke(1,i)):(n=Math.tan(t.x/e.radius_g_1),i=Math.tan(t.y/e.radius_g_1)*ke(1,n));var l=i/e.radius_p;if(o=n*n+l*l+r*r,s=2*e.radius_g*r,a=s*s-4*o*e.C,a<0)return t.x=Number.NaN,t.y=Number.NaN,t;c=(-s-Math.sqrt(a))/(2*o),r=e.radius_g+c*r,n*=c,i*=c,t.x=Math.atan2(n,r),t.y=Math.atan(i*Math.cos(t.x)/r),t.y=Math.atan(e.radius_p_inv2*Math.tan(t.y))}else if(e.shape==="sphere"){if(e.flip_axis?(i=Math.tan(t.y/e.radius_g_1),n=Math.tan(t.x/e.radius_g_1)*Math.sqrt(1+i*i)):(n=Math.tan(t.x/e.radius_g_1),i=Math.tan(t.y/e.radius_g_1)*Math.sqrt(1+n*n)),o=n*n+i*i+r*r,s=2*e.radius_g*r,a=s*s-4*o*e.C,a<0)return t.x=Number.NaN,t.y=Number.NaN,t;c=(-s-Math.sqrt(a))/(2*o),r=e.radius_g+c*r,n*=c,i*=c,t.x=Math.atan2(n,r),t.y=Math.atan(i*Math.cos(t.x)/r)}return t.x=t.x+e.long0,t}function iT(e,t={}){let r={...e,flip_axis:0,sweep:"",h:0,radius_g_1:0,radius_g:0,C:0,radius_p:0,radius_p2:0,radius_p_inv2:0,shape:"",...t};return wO(r),r}Ee();var py={name:"geos",aliases:["Geostationary Satellite View","Geostationary_Satellite"],parameters:["lon_0","x_0","y_0","h","sweep"],create(e){let t=vt(e),r=tt(e.parameters,"h",NaN);if(!Number.isFinite(r)||r<=0)throw new Error("Geostationary projection requires positive h");let n=e.parameters.sweep||"y";if(!["x","y"].includes(n))throw new Error("Geostationary sweep must be x or y");let i=iT(t,{h:r,sweep:n});return{...Et("geos",e,i,rT,nT,t.sphere?ss({...t,lat0:0},1/(1+r/t.a),!0):void 0),longitudeOrigin:t.long0,getRenderingProfile:eT(Pe(t,e),r,n==="x")}}};Qo();ts();db();ue();var Aa=180/Math.PI;function oT(e){return{engine:fb({semiMajorAxis:1,semiMinorAxis:Math.sqrt(1-e.es)}),latitude:e.lat0*Aa}}function sT(e,t,r){let n=t.engine.Inverse(t.latitude,0,r.y*Aa,G(r.x-e.long0,e.over)*Aa,lh);if(!(n.M12>0))throw new Error("Coordinate is outside the ellipsoidal gnomonic horizon");let i=e.a*n.m12/n.M12,o=n.azi1/Aa;return r.x=e.x0+i*Math.sin(o),r.y=e.y0+i*Math.cos(o),r}function aT(e,t,r){let n=(r.x-e.x0)/e.a,i=(r.y-e.y0)/e.a,o=Math.hypot(n,i);if(o===0)return r.x=e.long0,r.y=e.lat0,r;let s=t.engine.Line(t.latitude,0,Math.atan2(n,i)*Aa,lh),a=o<=1,c=a?o:1/o,l=Math.atan(o);for(let h=0;h<20;h++){let u=s.Position(l,lh),f=a?(u.m12-c*u.M12)*u.M12:(c*u.m12-u.M12)*u.m12;if(!Number.isFinite(f))break;if(l-=f,Math.abs(f)<1e-14){let d=s.Position(l,lh);if(!(d.M12>0))break;return r.x=G(e.long0+d.lon2/Aa,e.over),r.y=d.lat2/Aa,r}}throw new Error("Ellipsoidal gnomonic inverse did not converge")}ue();function _O(e){e.sphere||(e.ellipsoid=oT(e)),e.sin_p14=Math.sin(e.lat0),e.cos_p14=Math.cos(e.lat0),e.infinity_dist=1e3*e.a,e.rc=1}function cT(e,t){if(e.ellipsoid)return sT(e,e.ellipsoid,t);var r,n,i,o,s,a,c,l,h=t.x,u=t.y;return i=G(h-e.long0,e.over),r=Math.sin(u),n=Math.cos(u),o=Math.cos(i),a=e.sin_p14*r+e.cos_p14*n*o,s=1,a>0||Math.abs(a)<=1e-10?(c=e.x0+e.a*s*n*Math.sin(i)/a,l=e.y0+e.a*s*(e.cos_p14*r-e.sin_p14*n*o)/a):(c=e.x0+e.infinity_dist*n*Math.sin(i),l=e.y0+e.infinity_dist*(e.cos_p14*r-e.sin_p14*n*o)),t.x=c,t.y=l,t}function lT(e,t){if(e.ellipsoid)return aT(e,e.ellipsoid,t);var r,n,i,o,s,a;return t.x=(t.x-e.x0)/e.a,t.y=(t.y-e.y0)/e.a,t.x/=e.k0,t.y/=e.k0,r=Math.sqrt(t.x*t.x+t.y*t.y),r?(o=Math.atan2(r,e.rc),n=Math.sin(o),i=Math.cos(o),a=Ia(i*e.sin_p14+t.y*n*e.cos_p14/r),s=Math.atan2(t.x*n,r*e.cos_p14*i-t.y*e.sin_p14*n),s=G(e.long0+s,e.over)):(a=e.lat0,s=e.long0),t.x=s,t.y=a,t}function hT(e,t={}){let r={...e,sin_p14:0,cos_p14:0,infinity_dist:0,rc:0,phic0:0,...t};return _O(r),r}var gy={name:"gnom",aliases:[],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=vt(e),r=hT(t);return rn(Et("gnom",e,r,cT,lT,t.sphere?ss(t):void 0),t,Math.min(Math.PI*80/180,(1-t.es)*Math.PI*.45),(n,i)=>t.sphere?ed(Pe(t,e),n,i,"gnom"):yx(Pe(t,e),n,i),(1-t.es)*Math.PI/2)}};Ie();Ae();function yy(e,t){return 2*Math.atan(e*Math.exp(t))-U}function lm(e,t){var r=yy(1,t),n=0,i=0;let o=0;do{if(++o>50)throw new Error("Isometric latitude inverse did not converge");n=r,i=e*Math.sin(n),r=yy(Math.exp(e*Math.log((1+i)/(1-i))/2),t)}while(Math.abs(r-n)>1e-12);return r}Ht();ne();Ae();function nl(e,t,r){if(Math.abs(t)>U)return Number.NaN;if(t===U)return Number.POSITIVE_INFINITY;if(t===-1*U)return Number.NEGATIVE_INFINITY;var n=e*r;return Math.log(Math.tan((U+t)/2))+e*Math.log((1-n)/(1+n))/2}Zf();Bg();function MO(e){e.k0||(e.k0=1);var t=e.b/e.a;e.e=Math.sqrt(1-t*t),e.lc=e.long0,e.rs=Math.sqrt(1+e.e*e.e*Math.pow(Math.cos(e.lat0),4)/(1-e.e*e.e));var r=Math.sin(e.lat0),n=Math.asin(r/e.rs),i=Math.sin(n);e.cp=nl(0,n,i)-e.rs*nl(e.e,e.lat0,r),e.n2=e.k0*e.a*Math.sqrt(1-e.e*e.e)/(1-e.e*e.e*r*r),e.xs=e.x0,e.ys=e.y0-e.n2*n}function uT(e,t){var r=t.x,n=t.y,i=e.rs*(r-e.lc),o=e.cp+e.rs*nl(e.e,n,Math.sin(n)),s=Math.asin(Math.sin(i)/wh(o)),a=nl(0,s,Math.sin(s));return t.x=e.xs+e.n2*a,t.y=e.ys+e.n2*Math.atan(pa(o)/Math.cos(i)),t}function fT(e,t){var r=t.x,n=t.y,i=Math.atan(pa((r-e.xs)/e.n2)/Math.cos((n-e.ys)/e.n2)),o=Math.asin(Math.sin((n-e.ys)/e.n2)/wh((r-e.xs)/e.n2)),s=nl(0,o,Math.sin(o));return t.x=e.lc+i/e.rs,t.y=lm(e.e,(s-e.cp)/e.rs),t}function dT(e,t={}){let r={...e,lc:0,rs:0,cp:0,n2:0,xs:0,ys:0,...t};return MO(r),r}var wy={name:"gstmerc",aliases:["gstmerg"],parameters:["lon_0","x_0","y_0","lat_0","k","k_0"],create(e){let t=vt(e),r=dT(t),n=Et("gstmerc",e,r,uT,fT);return Pt(n,K(t.long0-Math.PI/6,-Math.PI/3,t.long0+Math.PI/6,Math.PI/3),i=>Oc(n.forward,i,t.long0,t.over,lm(r.e,-r.cp/r.rs)),t.primeMeridian,t.over)}};Ht();ne();ue();function bO(e){e.a=6377397155e-3,e.es=.006674372230614,e.e=Math.sqrt(e.es),e.s45=Math.PI/4,e.s90=2*e.s45,e.fi0=e.lat0,e.e2=e.es,e.e=Math.sqrt(e.e2),e.alfa=Math.sqrt(1+e.e2*Math.pow(Math.cos(e.fi0),4)/(1-e.e2)),e.uq=1.04216856380474,e.u0=Math.asin(Math.sin(e.fi0)/e.alfa),e.g=Math.pow((1+e.e*Math.sin(e.fi0))/(1-e.e*Math.sin(e.fi0)),e.alfa*e.e/2),e.k=Math.tan(e.u0/2+e.s45)/Math.pow(Math.tan(e.fi0/2+e.s45),e.alfa)*e.g,e.k1=e.k0,e.n0=e.a*Math.sqrt(1-e.e2)/(1-e.e2*Math.pow(Math.sin(e.fi0),2)),e.s0=1.37008346281555,e.n=Math.sin(e.s0),e.ro0=e.k1*e.n0/Math.tan(e.s0),e.ad=e.s90-e.uq}function mT(e,t){var r,n,i,o,s,a,c,l=t.x,h=t.y,u=G(l-e.long0,e.over);return r=Math.pow((1+e.e*Math.sin(h))/(1-e.e*Math.sin(h)),e.alfa*e.e/2),n=2*(Math.atan(e.k*Math.pow(Math.tan(h/2+e.s45),e.alfa)/r)-e.s45),i=-u*e.alfa,o=Math.asin(Math.cos(e.ad)*Math.sin(n)+Math.sin(e.ad)*Math.cos(n)*Math.cos(i)),s=Math.asin(Math.cos(n)*Math.sin(i)/Math.cos(o)),a=e.n*s,c=e.ro0*Math.pow(Math.tan(e.s0/2+e.s45),e.n)/Math.pow(Math.tan(o/2+e.s45),e.n),t.y=c*Math.cos(a)/1,t.x=c*Math.sin(a)/1,e.czech||(t.y*=-1,t.x*=-1),t}function pT(e,t){var r,n,i,o,s,a,c,l,h=t.x;t.x=t.y,t.y=h,e.czech||(t.y*=-1,t.x*=-1),a=Math.sqrt(t.x*t.x+t.y*t.y),s=Math.atan2(t.y,t.x),o=s/Math.sin(e.s0),i=2*(Math.atan(Math.pow(e.ro0/a,1/e.n)*Math.tan(e.s0/2+e.s45))-e.s45),r=Math.asin(Math.cos(e.ad)*Math.sin(i)-Math.sin(e.ad)*Math.cos(i)*Math.cos(o)),n=Math.asin(Math.cos(i)*Math.sin(o)/Math.cos(r)),t.x=e.long0-n/e.alfa,c=r,l=0;var u=0;do t.y=2*(Math.atan(Math.pow(e.k,-1/e.alfa)*Math.pow(Math.tan(r/2+e.s45),1/e.alfa)*Math.pow((1+e.e*Math.sin(c))/(1-e.e*Math.sin(c)),e.e/2))-e.s45),Math.abs(c-t.y)<1e-10&&(l=1),c=t.y,u+=1;while(l===0&&u<15);return u>=15?null:t}function gT(e,t={}){let r={...e,s45:0,s90:0,fi0:0,e2:0,alfa:0,uq:0,u0:0,g:0,k:0,k1:0,n0:0,s0:0,n:0,ro0:0,ad:0,czech:!1,...t};return bO(r),r}Ee();yn();var _y={name:"krovak",aliases:["Krovak","Krovak Modified","Krovak (North Orientated)","Krovak Modified (North Orientated)"],parameters:["lon_0","x_0","y_0","lat_0","k","k_0","czech","alpha","lat_ts"],flags:["czech"],create(e){let t=tt(e.parameters,"alpha",30.28813972222222),r=tt(e.parameters,"lat_ts",78.5);if(![30.28813972222222,30.28813975277778].some(s=>Math.abs(t-s)<=1e-10))throw new Error("Krovak requires its fixed cone-axis co-latitude");if(Math.abs(r-78.5)>1e-10)throw new Error("Krovak requires its fixed 78.5 degree pseudo standard parallel");let n=vt(e);n.lat0=$o(e.parameters,"lat_0",49.5),n.long0=$o(e.parameters,"lon_0",24.83333333333333),n.k0=tt(e.parameters,"k_0",tt(e.parameters,"k",.9999));let i=gT(n,{czech:ii(e.parameters,"czech")}),o=Et("krovak",e,i,mT,pT);return Pt(o,K(n.long0-Math.PI/12,Math.max(-Math.PI/2+1e-8,n.lat0-Math.PI/36),n.long0+Math.PI/12,Math.min(Math.PI/2-1e-8,n.lat0+Math.PI/36)),s=>LE(Pe(i,e),s),n.primeMeridian,n.over)}};Ie();Ht();ne();ue();function yT(e,t){var r=t.x,n=t.y,i=G(r-e.long0,e.over),o=e.x0+e.a*i,s=e.y0+e.a*Math.log(Math.tan(Math.PI/4+n/2.5))*1.25;return t.x=o,t.y=s,t}function wT(e,t){t.x-=e.x0,t.y-=e.y0;var r=G(e.long0+t.x/e.a,e.over),n=2.5*(Math.atan(Math.exp(.8*t.y/e.a))-Math.PI/4);return t.x=r,t.y=n,t}function _T(e,t={}){let r={...e,...t};return r}var My={name:"mill",aliases:["Miller_Cylindrical"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=_T(t),n=Et("mill",e,r,yT,wT);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ie();Ht();ne();ue();function xO(e){e.x0=e.x0!==void 0?e.x0:0,e.y0=e.y0!==void 0?e.y0:0,e.long0=e.long0!==void 0?e.long0:0}function MT(e,t){var r=t.x,n=t.y,i=G(r-e.long0,e.over);let o=Math.sin(Math.abs(n)),s=Math.cos(n),a=Math.abs(n)===Math.PI/2?0:Math.PI*s*s/(1+o),c=Math.cbrt(6*a),l=0,h=Math.PI;c=Math.min(c,h);for(let d=0;d<32&&c>0;d++){let m=ST(c)-a,p=m/(2*Math.sin(c/2)**2);if(Math.abs(p)<=16*Number.EPSILON*c)break;m>0?h=c:l=c;let g=c-p;if(g===c||h-l<=8*Number.EPSILON*Math.max(1,c))break;if(c=g>=l&&g<=h?g:(l+h)/2,d===31)throw new Error("Mollweide forward did not converge")}var u=2*Math.SQRT2/Math.PI*e.a*i*Math.sin(c/2)+e.x0,f=Math.sign(n)*Math.SQRT2*e.a*Math.cos(c/2)+e.y0;return t.x=u,t.y=f,t}function bT(e,t){let r=t.x-e.x0,n=(t.y-e.y0)/(Math.SQRT2*e.a);if(Math.abs(n)>1+8*Number.EPSILON)return null;let i=r/(2*Math.SQRT2*e.a),o=i*i+n*n;if(!e.over&&o>1+8*Number.EPSILON)return null;let s=2*Math.acos(Math.min(1,Math.abs(n))),a=Math.sin(s/2);if(!e.over&&Math.abs(o-1)<=8*Number.EPSILON&&(a=Math.min(1,Math.abs(i)),s=2*Math.asin(a)),a===0&&Math.abs(r)>8*Number.EPSILON*e.a)return null;let c=a===0?0:Math.PI*i/a;var l=G(e.long0+c,e.over),h=Math.sign(n)*(Math.PI/2-2*Math.asin(Math.sqrt(ST(s)/(2*Math.PI))));return t.x=l,t.y=h,t}function xT(e,t={}){let r={...e,...t};return xO(r),r}function ST(e){if(e>.5)return e-Math.sin(e);let t=e*e;return e*t*(1/6+t*(-1/120+t*(1/5040+t*(-1/362880+t*(1/39916800+t*(-1/6227020800+t/1307674368e3))))))}var by={name:"moll",aliases:["Mollweide"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=xT(t),n=Et("moll",e,r,MT,bT);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ht();ne();Ae();function SO(e){e.A=[],e.A[1]=.6399175073,e.A[2]=-.1358797613,e.A[3]=.063294409,e.A[4]=-.02526853,e.A[5]=.0117879,e.A[6]=-.0055161,e.A[7]=.0026906,e.A[8]=-.001333,e.A[9]=67e-5,e.A[10]=-34e-5,e.B_re=[],e.B_im=[],e.B_re[1]=.7557853228,e.B_im[1]=0,e.B_re[2]=.249204646,e.B_im[2]=.003371507,e.B_re[3]=-.001541739,e.B_im[3]=.04105856,e.B_re[4]=-.10162907,e.B_im[4]=.01727609,e.B_re[5]=-.26623489,e.B_im[5]=-.36249218,e.B_re[6]=-.6870983,e.B_im[6]=-1.1651967,e.C_re=[],e.C_im=[],e.C_re[1]=1.3231270439,e.C_im[1]=0,e.C_re[2]=-.577245789,e.C_im[2]=-.007809598,e.C_re[3]=.508307513,e.C_im[3]=-.112208952,e.C_re[4]=-.15094762,e.C_im[4]=.18200602,e.C_re[5]=1.01418179,e.C_im[5]=1.64497696,e.C_re[6]=1.9660549,e.C_im[6]=2.5127645,e.D=[],e.D[1]=1.5627014243,e.D[2]=.5185406398,e.D[3]=-.03333098,e.D[4]=-.1052906,e.D[5]=-.0368594,e.D[6]=.007317,e.D[7]=.0122,e.D[8]=.00394,e.D[9]=-.0013}function vT(e,t){var r,n=t.x,i=t.y,o=i-e.lat0,s=n-e.long0,a=o/_h*1e-5,c=s,l=1,h=0;for(r=1;r<=10;r++)l=l*a,h=h+e.A[r]*l;var u=h,f=c,d=1,m=0,p,g,y=0,_=0;for(r=1;r<=6;r++)p=d*u-m*f,g=m*u+d*f,d=p,m=g,y=y+e.B_re[r]*d-e.B_im[r]*m,_=_+e.B_im[r]*d+e.B_re[r]*m;return t.x=_*e.a+e.x0,t.y=y*e.a+e.y0,t}function ET(e,t){var r,n=t.x,i=t.y,o=n-e.x0,s=i-e.y0,a=s/e.a,c=o/e.a,l=1,h=0,u,f,d=0,m=0;for(r=1;r<=6;r++)u=l*a-h*c,f=h*a+l*c,l=u,h=f,d=d+e.C_re[r]*l-e.C_im[r]*h,m=m+e.C_im[r]*l+e.C_re[r]*h;for(var p=0;p<e.iterations;p++){var g=d,y=m,_,b,M=a,T=c;for(r=2;r<=6;r++)_=g*d-y*m,b=y*d+g*m,g=_,y=b,M=M+(r-1)*(e.B_re[r]*g-e.B_im[r]*y),T=T+(r-1)*(e.B_im[r]*g+e.B_re[r]*y);g=1,y=0;var A=e.B_re[1],S=e.B_im[1];for(r=2;r<=6;r++)_=g*d-y*m,b=y*d+g*m,g=_,y=b,A=A+r*(e.B_re[r]*g-e.B_im[r]*y),S=S+r*(e.B_im[r]*g+e.B_re[r]*y);var v=A*A+S*S;d=(M*A+T*S)/v,m=(T*A-M*S)/v}var N=d,B=m,C=1,R=0;for(r=1;r<=9;r++)C=C*N,R=R+e.D[r]*C;var W=e.lat0+R*_h*1e5,j=e.long0+B;return t.x=j,t.y=W,t}function TT(e,t={}){let r={...e,A:[],B_re:[],B_im:[],C_re:[],C_im:[],D:[],iterations:1,...t};return SO(r),r}Ee();var xy={name:"nzmg",aliases:["New_Zealand_Map_Grid"],parameters:["lon_0","x_0","y_0","lat_0","iterations"],create(e){let t=vt(e),r=tt(e.parameters,"iterations",1);if(!Number.isInteger(r)||r<0||r>10)throw new Error("NZMG iterations must be an integer from 0 to 10");if(!Object.prototype.hasOwnProperty.call(e.parameters,"lat_0")||!Object.prototype.hasOwnProperty.call(e.parameters,"lon_0"))throw new Error("NZMG requires lat_0 and lon_0");let n=TT(t,{iterations:r}),i=Et("nzmg",e,n,vT,ET);return Pt(i,K(t.long0-Math.PI/22.5,Math.max(-Math.PI/2,t.lat0-Math.PI/22.5),t.long0+Math.PI/22.5,Math.min(Math.PI/2,t.lat0+Math.PI/22.5)),o=>DE(Pe(n,e),o),t.primeMeridian,t.over)}};Ht();ne();xh();ue();nd();Ae();var il=1e-7;function vO(e){return e.no_uoff||e.no_off||["hotineobliquemercator","hotineobliquemercatorvarianta","hotineobliquemercatorazimuthnaturalorigin"].includes(e.projName.toLowerCase().replace(/[ _-]/g,""))}function EO(e){var t,r,n,i,o,s,a,c,l,h,u=0,f,d=0,m=0,p=0,g=0,y=0,_=0;e.k0||(e.k0=1),e.no_off=vO(e),e.no_rot=e.no_rot;var b=!1;Number.isFinite(e.alpha)&&(b=!0);var M=!1;if(Number.isFinite(e.rectified_grid_angle)&&(M=!0),b&&(_=e.alpha),M&&(u=e.rectified_grid_angle,b||(_=0,b=!0)),b||M)d=e.longc;else if(m=e.long1,g=e.lat1,p=e.long2,y=e.lat2,Math.abs(g-y)<=il||Math.abs(g)<=il||Math.abs(Math.abs(g)-U)<=il||Math.abs(Math.abs(e.lat0)-U)<=il||Math.abs(Math.abs(y)-U)<=il)throw new Error;var T=1-e.es;if(r=Math.sqrt(T),Math.abs(e.lat0)>1e-10?(c=Math.sin(e.lat0),n=Math.cos(e.lat0),t=1-e.es*c*c,e.B=n*n,e.B=Math.sqrt(1+e.es*e.B*e.B/T),e.A=e.B*e.k0*r/t,i=e.B*r/(n*Math.sqrt(t)),o=i*i-1,o<=0?o=0:(o=Math.sqrt(o),e.lat0<0&&(o=-o)),e.E=o+=i,e.E*=Math.pow(Lr(e.e,e.lat0,c),e.B)):(e.B=1/r,e.A=e.k0,e.E=i=o=1),b||M){b?(f=Math.asin(Math.sin(_)/i),M||(u=_)):(f=u,_=Math.asin(i*Math.sin(f)));let A=.5*(o-1/o)*Math.tan(f);i>1&&Math.abs(Math.cos(_))<=8*Number.EPSILON?A=Math.sign(e.lat0)*Math.sign(Math.sin(_)):Math.abs(A)>1&&Math.abs(A)<=1+8*Number.EPSILON&&(A=Math.sign(A)),e.lam0=d-Math.asin(A)/e.B}else s=Math.pow(Lr(e.e,g,Math.sin(g)),e.B),a=Math.pow(Lr(e.e,y,Math.sin(y)),e.B),o=e.E/s,l=(a-s)/(a+s),h=e.E*e.E,h=(h-a*s)/(h+a*s),t=m-p,t<-Math.PI?p-=Ko:t>Math.PI&&(p+=Ko),e.lam0=G(.5*(m+p)-Math.atan(h*Math.tan(.5*e.B*(m-p))/l)/e.B,e.over),f=Math.atan(2*Math.sin(e.B*G(m-e.lam0,e.over))/(o-1/o)),u=_=Math.asin(i*Math.sin(f));e.singam=Math.sin(f),e.cosgam=Math.cos(f),e.sinrot=Math.sin(u),e.cosrot=Math.cos(u),e.rB=1/e.B,e.ArB=e.A*e.rB,e.BrA=1/e.ArB,e.no_off?e.u_0=0:(e.u_0=Math.abs(e.ArB*Math.atan(Math.sqrt(i*i-1)/Math.cos(_))),e.lat0<0&&(e.u_0=-e.u_0)),o=.5*f,e.v_pole_n=e.ArB*Math.log(Math.tan($t-o)),e.v_pole_s=e.ArB*Math.log(Math.tan($t+o))}function IT(e,t){var r=t,n,i,o,s,a,c,l,h;if(t.x=t.x-e.lam0,Math.abs(Math.abs(t.y)-U)>1e-10){if(a=e.E/Math.pow(Lr(e.e,t.y,Math.sin(t.y)),e.B),c=1/a,n=.5*(a-c),i=.5*(a+c),s=Math.sin(e.B*t.x),o=(n*e.singam-s*e.cosgam)/i,Math.abs(Math.abs(o)-1)<1e-10)throw new Error;h=.5*e.ArB*Math.log((1-o)/(1+o)),c=Math.cos(e.B*t.x),Math.abs(c)<il?l=e.A*t.x:l=e.ArB*Math.atan2(n*e.cosgam+s*e.singam,c)}else h=t.y>0?e.v_pole_n:e.v_pole_s,l=e.ArB*t.y;return e.no_rot?(r.x=l,r.y=h):(l-=e.u_0,r.x=h*e.cosrot+l*e.sinrot,r.y=l*e.cosrot-h*e.sinrot),r.x=e.a*r.x+e.x0,r.y=e.a*r.y+e.y0,r}function AT(e,t){var r,n,i,o,s,a,c,l=t;if(t.x=(t.x-e.x0)*(1/e.a),t.y=(t.y-e.y0)*(1/e.a),e.no_rot?(n=t.y,r=t.x):(n=t.x*e.cosrot-t.y*e.sinrot,r=t.y*e.cosrot+t.x*e.sinrot+e.u_0),i=Math.exp(-e.BrA*n),o=.5*(i-1/i),s=.5*(i+1/i),a=Math.sin(e.BrA*r),c=(a*e.cosgam+o*e.singam)/s,Math.abs(Math.abs(c)-1)<1e-10)l.x=0,l.y=c<0?-U:U;else{if(l.y=e.E/Math.sqrt((1+c)/(1-c)),l.y=_a(e.e,Math.pow(l.y,1/e.B)),l.y===1/0)throw new Error;l.x=-e.rB*Math.atan2(o*e.cosgam-a*e.singam,Math.cos(e.BrA*r))}return l.x+=e.lam0,l}function PT(e,t={}){let r={...e,no_off:!1,no_rot:!1,alpha:NaN,rectified_grid_angle:NaN,longc:0,long1:0,long2:0,B:0,A:0,E:0,lam0:0,singam:0,cosgam:0,sinrot:0,cosrot:0,rB:0,ArB:0,BrA:0,u_0:0,v_pole_n:0,v_pole_s:0,no_uoff:!1,projName:"",...t};return EO(r),r}Ee();yn();var Sy={name:"omerc",aliases:["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Variant_B","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator"],parameters:["lon_0","x_0","y_0","lat_0","k","k_0","alpha","gamma","lonc","lon_1","lon_2","lat_1","lat_2","no_off","no_uoff","no_rot"],flags:["no_off","no_uoff","no_rot"],create(e){let t=vt(e);if(Math.abs(t.lat0)>=Math.PI/2)throw new Error("Oblique Mercator origin must be away from the poles");let n=Object.prototype.hasOwnProperty.call(e.parameters,"alpha")||Object.prototype.hasOwnProperty.call(e.parameters,"gamma")?["lonc"]:["lon_1","lat_1","lon_2","lat_2"];for(let s of n)if(!Object.prototype.hasOwnProperty.call(e.parameters,s))throw new Error("Oblique Mercator requires "+s);let i=PT(t,{projName:e.parameters.proj||"omerc",alpha:tt(e.parameters,"alpha",NaN)*Math.PI/180,rectified_grid_angle:tt(e.parameters,"gamma",NaN)*Math.PI/180,longc:tt(e.parameters,"lonc",0)*Math.PI/180,long1:tt(e.parameters,"lon_1",0)*Math.PI/180,long2:tt(e.parameters,"lon_2",0)*Math.PI/180,no_off:ii(e.parameters,"no_off"),no_uoff:ii(e.parameters,"no_uoff"),no_rot:ii(e.parameters,"no_rot")}),o=Et("omerc",e,i,IT,AT);return Pt(o,K(i.lam0-Math.PI/18,Math.max(-Math.PI/2+1e-8,t.lat0-Math.PI/18),i.lam0+Math.PI/18,Math.min(Math.PI/2-1e-8,t.lat0+Math.PI/18)),s=>BE(Pe(i,e),s),t.primeMeridian,t.over)}};Qo();ts();ue();function RT(e){let t=Math.sin(e.lat0),r=Math.cos(e.lat0),n=1/Math.sqrt(1-e.es*t*t);return{...e,sin0:t,cos0:r,originY:-e.es*n*t*r}}function CT(e,t){let r=G(t.x-e.long0,e.over),n=Math.sin(t.y),i=Math.cos(t.y),o=1/Math.sqrt(1-e.es*n*n);return t.x=e.x0+e.a*e.k0*o*i*Math.sin(r),t.y=e.y0+e.a*e.k0*(o*((1-e.es)*n*e.cos0-i*Math.cos(r)*e.sin0)-e.originY),t}function NT(e,t){let r=(t.x-e.x0)/(e.a*e.k0),n=(t.y-e.y0)/(e.a*e.k0)+e.originY,i=1-e.es,o=e.cos0*e.cos0+e.sin0*e.sin0/i,s=n*e.sin0*e.cos0*e.es/i,a=r*r+n*n*(e.sin0*e.sin0+e.cos0*e.cos0/i)-1,c=s*s-o*a;if(c<-32*Number.EPSILON*o)throw new Error("Coordinate is outside the orthographic ellipse");let l=(-s+Math.sqrt(Math.max(0,c)))/o,h=l*e.cos0-n*e.sin0,u=l*e.sin0+n*e.cos0;return t.x=G(e.long0+Math.atan2(r,h),e.over),t.y=Math.atan2(u,i*Math.hypot(h,r)),t}var vy={name:"ortho",aliases:[],parameters:["lon_0","x_0","y_0","lat_0","k","k_0"],create(e){let t=vt(e),r=RT(t);return rn(Et("ortho",e,r,CT,NT,ss(t,0,!0)),t,Math.PI/2,(n,i)=>dx(Pe(t,e),n,i),Math.PI/2)}};Ht();ne();ue();var OT=20;function TO(e){e.meridianPole=Sn(e.a,e.es,0,Math.PI/2),e.poleRadius=e.a/Math.sqrt(1-e.es),e.ml0=Sn(e.a,e.es,0,e.lat0)}function LT(e,t){var r=t.x,n=t.y,i,o,s,a=G(r-e.long0,e.over);if(s=a*Math.sin(n),e.sphere)n===0?(i=e.a*a,o=-1*e.a*e.lat0):(i=e.a*Math.sin(s)/Math.tan(n),o=e.a*(n-e.lat0+2*Math.sin(s/2)**2/Math.tan(n)));else if(n===0)i=e.a*a,o=-1*e.ml0;else{var c=Jc(e.a,e.e,Math.sin(n))/Math.tan(n);i=c*Math.sin(s),o=Sn(e.a,e.es,e.lat0,n)+c*(2*Math.sin(s/2)**2)}return t.x=i+e.x0,t.y=o+e.y0,t}function DT(e,t){var r,n,i,o,s,a,c,l,h;i=t.x-e.x0,o=t.y-e.y0;let u=o+(e.sphere?e.a*e.lat0:e.ml0),f=u<0?-1:1,m=(e.sphere?e.a*Math.PI/2:e.meridianPole)-f*u,p=Math.hypot(i,m);if(p/e.a<1e-6)return t.x=G(e.long0+Math.atan2(i,m),e.over),t.y=f*(Math.PI/2-p/e.poleRadius),t;if(e.sphere)if(Math.abs(o+e.a*e.lat0)<=1e-10)r=G(i/e.a+e.long0,e.over),n=0;else{a=e.lat0+o/e.a,c=i*i/e.a/e.a+a*a,l=a;var g;for(s=OT;s;--s)if(g=Math.tan(l),h=-1*(a*(l*g+1)-l-.5*(l*l+c)*g)/((l-a)/g-1),l+=h,Math.abs(h)<=1e-14){n=l;break}if(n=BT(e,n===void 0?l:n,i,o),n===void 0)return null;l=n,r=G(e.long0+Math.asin(i*Math.tan(l)/e.a)/Math.sin(n),e.over)}else if(Math.abs(o+e.ml0)<=1e-10)n=0,r=G(e.long0+i/e.a,e.over);else{a=(e.ml0+o)/e.a,c=i*i/e.a/e.a+a*a,l=a;var y,_,b,M,T;for(s=OT;s;--s)if(T=e.e*Math.sin(l),y=Math.sqrt(1-T*T)*Math.tan(l),_=Sn(e.a,e.es,0,l),b=(1-e.es)/Math.pow(1-T*T,1.5),M=_/e.a,h=(a*(y*M+1)-M-.5*y*(M*M+c))/(e.es*Math.sin(2*l)*(M*M+c-2*a*M)/(4*y)+(a-M)*(y*b-2/Math.sin(2*l))-b),l-=h,Math.abs(h)<=1e-14){n=l;break}if(n=BT(e,n===void 0?l:n,i,o),n===void 0)return null;l=n,y=Math.sqrt(1-e.es*Math.pow(Math.sin(n),2))*Math.tan(n),r=G(e.long0+Math.asin(i*y/e.a)/Math.sin(n),e.over)}return t.x=r,t.y=n,t}function FT(e,t={}){let r={...e,ml0:0,meridianPole:0,poleRadius:0,...t};return TO(r),r}function BT(e,t,r,n){for(let i=0;i<8;i++){if(!Number.isFinite(t)||Math.abs(t)>=Math.PI/2)return;let o=Math.sin(t),s=Math.cos(t),a=1-e.es*o*o,c=e.sphere?e.a:Jc(e.a,e.e,o),l=c/Math.tan(t),h=Math.asin(r/l),u=l*Math.sin(h),f=2*Math.sin(h/2)**2,d=e.sphere?e.a*(t-e.lat0):Sn(e.a,e.es,e.lat0,t),m=l*f,g=d+m-n;if(Math.abs(u-r)<=64*Number.EPSILON*Math.max(e.a,Math.abs(r))&&Math.abs(g)<=64*Number.EPSILON*Math.max(Math.abs(n),Math.abs(d),Math.abs(m),e.a*Math.max(Math.abs(t),Math.abs(e.lat0))))return t;let y=e.sphere?e.a:e.a*(1-e.es)/Math.pow(a,1.5),_=c*((e.sphere?0:e.es*s*s/a)-1/(o*o)),b=y+_*(-f/Math.cos(h)),M=g/b;if(!Number.isFinite(M)||Math.abs(M)>1e-6)return;t-=M}}var Ey={name:"poly",aliases:["Polyconic","American_Polyconic"],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=vt(e),r=FT(t),n=Et("poly",e,r,LT,DT);return Pt(n,K(t.long0-Math.PI/6,Math.max(-Math.PI/2+1e-8,t.lat0-Math.PI/2+1e-8),t.long0+Math.PI/6,Math.min(Math.PI/2-1e-8,t.lat0+Math.PI/2-1e-8)),i=>CE(Pe(t,e),n.forward,i),t.primeMeridian,t.over)}};da();Ee();Ae();var Re={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},ae={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function IO(e){e.x0=e.x0||0,e.y0=e.y0||0,e.lat0=e.lat0||0,e.long0=e.long0||0,e.lat_ts=e.lat_ts||0,e.lat0>=U-$t/2?e.face=Re.TOP:e.lat0<=-(U-$t/2)?e.face=Re.BOTTOM:Math.abs(e.long0)<=$t?e.face=Re.FRONT:Math.abs(e.long0)<=U+$t?e.face=e.long0>0?Re.RIGHT:Re.LEFT:e.face=Re.BACK,e.es!==0&&(e.one_minus_f=1-(e.a-e.b)/e.a,e.one_minus_f_squared=e.one_minus_f*e.one_minus_f)}function UT(e,t){var r=t,n,i,o,s,a,c,l=0;if(t.x-=e.long0,e.es!==0?n=Math.atan(e.one_minus_f_squared*Math.tan(t.y)):n=t.y,i=t.x,e.face===Re.TOP)s=U-n,i>=$t&&i<=U+$t?(l=ae.AREA_0,o=i-U):i>U+$t||i<=-(U+$t)?(l=ae.AREA_1,o=i>0?i-Math.PI:i+Math.PI):i>-(U+$t)&&i<=-$t?(l=ae.AREA_2,o=i+U):(l=ae.AREA_3,o=i);else if(e.face===Re.BOTTOM)s=U+n,i>=$t&&i<=U+$t?(l=ae.AREA_0,o=-i+U):i<$t&&i>=-$t?(l=ae.AREA_1,o=-i):i<-$t&&i>=-(U+$t)?(l=ae.AREA_2,o=-i-U):(l=ae.AREA_3,o=i>0?-i+Math.PI:-i-Math.PI);else{var h,u,f,d,m,p,g;e.face===Re.RIGHT?i=ol(i,+U):e.face===Re.BACK?i=ol(i,+Math.PI):e.face===Re.LEFT&&(i=ol(i,-U)),d=Math.sin(n),m=Math.cos(n),p=Math.sin(i),g=Math.cos(i),h=m*g,u=m*p,f=d,e.face===Re.FRONT?(s=Math.atan2(Math.hypot(u,f),h),o=hm(s,f,u)):e.face===Re.RIGHT?(s=Math.atan2(Math.hypot(h,f),u),o=hm(s,f,-h)):e.face===Re.BACK?(s=Math.atan2(Math.hypot(u,f),-h),o=hm(s,f,-u)):e.face===Re.LEFT?(s=Math.atan2(Math.hypot(h,f),-u),o=hm(s,f,h)):s=o=0,Math.abs(o)<=$t?l=ae.AREA_0:o>$t&&o<=U+$t?(l=ae.AREA_1,o-=U):o>U+$t||o<=-(U+$t)?(l=ae.AREA_2,o=o>=0?o-Math.PI:o+Math.PI):(l=ae.AREA_3,o+=U)}return c=Math.atan(12/Math.PI*(o+Math.acos(Math.sin(o)*Math.cos($t))-U)),a=Math.sqrt(2*Math.sin(s/2)**2/(Math.cos(c)*Math.cos(c))/(1-Math.cos(Math.atan(1/Math.cos(o))))),l===ae.AREA_1?c+=U:l===ae.AREA_2?c+=Math.PI:l===ae.AREA_3&&(c+=1.5*Math.PI),r.x=a*Math.cos(c),r.y=a*Math.sin(c),r.x=r.x*e.a+e.x0,r.y=r.y*e.a+e.y0,t}function GT(e,t){var r=0,n=0,i,o,s,a,c,l,h,u,f=0;t.x=(t.x-e.x0)/e.a,t.y=(t.y-e.y0)/e.a,i=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?f=ae.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(f=ae.AREA_1,i-=U):t.x<0&&-t.x>=Math.abs(t.y)?(f=ae.AREA_2,i=i<0?i+Math.PI:i-Math.PI):(f=ae.AREA_3,i+=U),u=Math.PI/12*Math.tan(i),a=Math.sin(u)/(Math.cos(u)-1/Math.sqrt(2)),c=Math.atan(a),o=Math.cos(i),s=Math.hypot(t.x,t.y);let d=o*o*s*s*(1-Math.cos(Math.atan(1/Math.cos(c))));if(l=1-d,l<-1?l=-1:l>1&&(l=1),e.face===Re.TOP)h=2*Math.asin(Math.sqrt(Math.min(1,d/2))),n=U-h,f===ae.AREA_0?r=c+U:f===ae.AREA_1?r=c<0?c+Math.PI:c-Math.PI:f===ae.AREA_2?r=c-U:r=c;else if(e.face===Re.BOTTOM)h=2*Math.asin(Math.sqrt(Math.min(1,d/2))),n=h-U,f===ae.AREA_0?r=-c+U:f===ae.AREA_1?r=-c:f===ae.AREA_2?r=-c-U:r=c<0?-c-Math.PI:-c+Math.PI;else{var m,p,g;m=l;let y=Math.sqrt(Math.max(0,d*(2-d)));g=y*Math.sin(c),p=y*Math.cos(c),f===ae.AREA_1?(u=p,p=-g,g=u):f===ae.AREA_2?(p=-p,g=-g):f===ae.AREA_3&&(u=p,p=g,g=-u),e.face===Re.RIGHT?(u=m,m=-p,p=u):e.face===Re.BACK?(m=-m,p=-p):e.face===Re.LEFT&&(u=m,m=p,p=-u),n=Math.atan2(g,Math.hypot(m,p)),r=Math.atan2(p,m),e.face===Re.RIGHT?r=ol(r,-U):e.face===Re.BACK?r=ol(r,-Math.PI):e.face===Re.LEFT&&(r=ol(r,+U))}return e.es!==0&&(n=Math.atan2(Math.sin(n),e.one_minus_f_squared*Math.cos(n))),r+=e.long0,t.x=r,t.y=n,t}function hm(e,t,r){return e===0?0:Math.atan2(t,r)}function ol(e,t){var r=e+t;return r<-Math.PI?r+=Ko:r>+Math.PI&&(r-=Ko),r}function zT(e,t={}){let r={...e,face:0,one_minus_f:0,one_minus_f_squared:0,...t};return IO(r),r}Ht();ne();wa();Ie();var Ty={name:"qsc",aliases:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube"],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=vt(e),r=e.primeMeridian??0,n=zT(t),i=Et("qsc",e,n,UT,GT),o=tt(e.parameters,"x_0",0),s=tt(e.parameters,"y_0",0);return{...i,longitudeOrigin:t.long0,getRenderingProfile(a){if(a)return Ke(u=>{let f=y=>t.es?Math.atan((1-t.es)*Math.tan(y)):y,d=K(u[0][0]-t.long0,f(u[0][1]),u[1][0]-t.long0,f(u[1][1])),m=n.face===5?[0,0,1]:n.face===6?[0,0,-1]:[1,0,0],p=se(m,d)[0],g=t.a*Math.sqrt((1-p)/(.5*(1-Math.SQRT1_2)));return re([o-g,o+g],[s-g,s+g])},a,t.long0,r);let c=[[o-t.a,s-t.a,0],[o+t.a,s+t.a,0]],l=is(e.parameters,r)().normalize,h=Wo(u=>{let[f,d]=i.forward(u.x,u.y);Math.abs(f-o)<=t.a&&Math.abs(d-s)<=t.a||([u.x,u.y]=i.inverse(o+Math.max(-t.a,Math.min(t.a,f-o)),s+Math.max(-t.a,Math.min(t.a,d-s))))},r);return{bounds:c,normalize(u){l(u),h(u)}}}}}};Ie();Ht();ne();Ae();ue();var sl=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],as=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]];sl=sl.map(e=>e.map(Math.fround));as=as.map(e=>e.map(Math.fround));var VT=.8487,kT=1.3523,qT=Fg/5,AO=1/qT,Pa=18,um=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},PO=function(e,t){return e[1]+t*(2*e[2]+t*3*e[3])};function RO(e,t,r,n,i){for(var o=r;i;--i){var s=(um(e,o)-t)/PO(e,o);if(o-=s,Math.abs(s)<n)break}return o}function CO(e){e.x0=e.x0||0,e.y0=e.y0||0,e.long0=e.long0||0,e.es=0}function jT(e,t){var r=G(t.x-e.long0,e.over),n=Math.abs(t.y),i=Math.floor(n*qT+1e-15);i<0?i=0:i>=Pa&&(i=Pa),n=Fg*(n-AO*i);var o=um(sl[i],n)*r,s=um(as[i],n);return t.y<0&&(s=-s),t.x=o*e.a*VT+e.x0,t.y=s*e.a*kT+e.y0,t}function WT(e,t){var r=t.y,n=t;n.x=(n.x-e.x0)/(e.a*VT),n.y=Math.abs(r-e.y0)/(e.a*kT);for(let a=0;a<=Pa;a++)if(Math.abs(n.y-as[a][0])<=8*Number.EPSILON)return n.x=G(n.x/sl[a][0]+e.long0,e.over),n.y=(r<e.y0?-1:1)*a*5*Dg,n;if(n.y>=1)n.x/=sl[Pa][0],n.y=r<0?-U:U;else{var i=Math.floor(n.y*Pa);for(i<0?i=0:i>=Pa&&(i=Pa-1);;)if(as[i][0]>n.y)--i;else if(as[i+1][0]<=n.y)++i;else break;var o=as[i],s=5*(n.y-o[0])/(as[i+1][0]-o[0]);s=RO(o,n.y,s,1e-10,100),n.x/=um(sl[i],s),n.y=(5*i+s)*Dg,r<0&&(n.y=-n.y)}return n.x=G(n.x+e.long0,e.over),n}function HT(e,t={}){let r={...e,...t};return CO(r),r}var Iy={name:"robin",aliases:["Robinson"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=HT(t),n=Et("robin",e,r,jT,WT);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ie();Ht();ne();var Ay={name:"sinu",aliases:["Sinusoidal"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=WE(t),n=Et("sinu",e,r,sm,am);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ht();ne();function NO(e){e.k0||(e.k0=1);var t=e.lat0;e.lambda0=e.long0;var r=Math.sin(t),n=e.a,i=e.rf,o=1/i,s=2*o-Math.pow(o,2);e.e=Math.sqrt(s);var a=e.e;e.R=e.k0*n*Math.sqrt(1-s)/(1-s*Math.pow(r,2)),e.alpha=Math.sqrt(1+s/(1-s)*Math.pow(Math.cos(t),4)),e.b0=Math.asin(r/e.alpha);var c=Math.log(Math.tan(Math.PI/4+e.b0/2)),l=Math.log(Math.tan(Math.PI/4+t/2)),h=Math.log((1+a*r)/(1-a*r));e.K=c-e.alpha*l+e.alpha*a/2*h}function $T(e,t){let r=e.e*Math.sin(t.y),n=2*Math.atan(Math.exp(e.alpha*(Math.log(Math.tan(Math.PI/4+t.y/2))-e.e/2*Math.log((1+r)/(1-r)))+e.K))-Math.PI/2,i=e.alpha*(t.x-e.lambda0),o=Math.cos(n),s=Math.asin(Math.cos(e.b0)*Math.sin(n)-Math.sin(e.b0)*o*Math.cos(i)),a=Math.asin(o*Math.sin(i)/Math.cos(s));return t.x=e.x0+e.R*a,t.y=e.y0+e.R*Math.log(Math.tan(Math.PI/4+s/2)),t}function YT(e,t){let r=(t.x-e.x0)/e.R,n=2*(Math.atan(Math.exp((t.y-e.y0)/e.R))-Math.PI/4),i=Math.asin(Math.cos(e.b0)*Math.sin(n)+Math.sin(e.b0)*Math.cos(n)*Math.cos(r)),o=Math.asin(Math.cos(n)*Math.sin(r)/Math.cos(i)),s=(e.K-Math.log(Math.tan(Math.PI/4+i/2)))/e.alpha;for(let a=0;a<6;a++){let c=e.e*Math.sin(i),l=(s+Math.log(Math.tan(Math.PI/4+i/2))-e.e/2*Math.log((1+c)/(1-c)))*(1-c*c)*Math.cos(i)/(1-e.es);if(i-=l,Math.abs(l)<1e-10)return t.x=e.lambda0+o/e.alpha,t.y=i,t}return null}function KT(e,t={}){let r={...e,lambda0:0,rf:0,R:0,alpha:0,b0:0,K:0,...t};return NO(r),r}var Py={name:"somerc",aliases:[],parameters:["lon_0","x_0","y_0","lat_0","k","k_0"],create(e){let t=vt(e),r=KT(t,{rf:t.a===t.b?1/0:1/(1-t.b/t.a)}),n=Et("somerc",e,r,$T,YT);return Pt(n,K(t.long0-Math.PI/18,Math.max(-Math.PI/2+1e-8,t.lat0-Math.PI/18),t.long0+Math.PI/18,Math.min(Math.PI/2-1e-8,t.lat0+Math.PI/18)),i=>OE(Pe(r,e),i),t.primeMeridian,t.over)}};Qo();ts();Ae();ga();var _r={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3};function OO(e){if(Math.abs(Math.abs(e.lat0)-U)<1e-10?e.mode=e.lat0<0?_r.S_POLE:_r.N_POLE:Math.abs(e.lat0)<1e-10?e.mode=_r.EQUIT:(e.mode=_r.OBLIQ,e.sinph0=Math.sin(e.lat0),e.cosph0=Math.cos(e.lat0)),e.pn1=e.h/e.a,e.pn1<=0||e.pn1>1e10)throw new Error("Invalid height");e.p=1+e.pn1,e.rp=1/e.p,e.h1=1/e.pn1,e.pfact=(e.p+1)*e.h1,e.es=0;var t=e.tilt,r=e.azi;e.cg=Math.cos(r),e.sg=Math.sin(r),e.cw=Math.cos(t),e.sw=Math.sin(t)}function XT(e,t){t.x-=e.long0;var r=Math.sin(t.y),n=Math.cos(t.y),i=Math.cos(t.x),o,s;switch(e.mode){case _r.OBLIQ:s=e.sinph0*r+e.cosph0*n*i;break;case _r.EQUIT:s=n*i;break;case _r.S_POLE:s=-r;break;case _r.N_POLE:s=r;break}switch(s=e.pn1/(e.p-s),o=s*n*Math.sin(t.x),e.mode){case _r.OBLIQ:s*=e.cosph0*r-e.sinph0*n*i;break;case _r.EQUIT:s*=r;break;case _r.N_POLE:s*=-(n*i);break;case _r.S_POLE:s*=n*i;break}var a,c;return a=s*e.cg+o*e.sg,c=1/(a*e.sw*e.h1+e.cw),o=(o*e.cg-s*e.sg)*e.cw*c,s=a*c,t.x=o*e.a,t.y=s*e.a,t}function ZT(e,t){t.x/=e.a,t.y/=e.a;var r=t.x,n=t.y,i,o,s;s=1/(e.pn1-t.y*e.sw),i=e.pn1*t.x*s,o=e.pn1*t.y*e.cw*s,t.x=i*e.cg+o*e.sg,t.y=o*e.cg-i*e.sg;var a=ke(t.x,t.y);if(Math.abs(a)<1e-10)r=0,n=e.lat0;else{var c,l;switch(l=1-a*a*e.pfact,l=(e.p-Math.sqrt(l))/(e.pn1/a+a/e.pn1),c=Math.sqrt(1-l*l),e.mode){case _r.OBLIQ:n=Math.asin(c*e.sinph0+t.y*l*e.cosph0/a),t.y=(c-e.sinph0*Math.sin(n))*a,t.x*=l*e.cosph0;break;case _r.EQUIT:n=Math.asin(t.y*l/a),t.y=c*a,t.x*=l;break;case _r.N_POLE:n=Math.asin(c),t.y=-t.y;break;case _r.S_POLE:n=-Math.asin(c);break}r=Math.atan2(t.x,t.y)}return t.x=r+e.long0,t.y=n,t}function JT(e,t={}){let r={...e,mode:0,sinph0:0,cosph0:0,pn1:0,h:0,p:0,rp:0,h1:0,pfact:0,tilt:0,azi:0,cg:0,sg:0,cw:0,sw:0,...t};return OO(r),r}Ee();var Ry={name:"tpers",aliases:["Tilted_Perspective"],parameters:["lon_0","x_0","y_0","lat_0","h","tilt","azi"],create(e){let t=vt(e),r=tt(e.parameters,"h",1e5),n=tt(e.parameters,"tilt",0)*Math.PI/180,i=tt(e.parameters,"azi",0)*Math.PI/180;if(Math.abs(n)>=Math.PI/2)throw new Error("Perspective tilt must be between -90 and 90 degrees");let o=JT(t,{h:r,tilt:n,azi:i}),s=1+r/t.a,a=Math.acos(1/s),c=Math.abs(n),l=s*Math.cos(c)<1?c-Math.acos(s*Math.cos(c)):a,h=Math.min(a,l)*(1-1e-10);return rn(Et("tpers",e,o,XT,ZT,ss(t,1/(1+r/t.a))),t,h,(u,f)=>gx(Pe(t,e),s,n,i,u,f),a)}};Ie();Ht();ne();ue();Ae();function BO(e){e.R=e.a}function QT(e,t){var r=t.x,n=t.y,i=G(r-e.long0,e.over),o,s;if(Math.abs(n)<=1e-10)return o=e.x0+e.R*i,s=e.y0,t.x=o,t.y=s,t;var a=Ia(2*Math.abs(n/Math.PI));if(Math.abs(i)<=1e-10||Math.abs(Math.abs(n)-U)<=1e-10)return o=e.x0,n>=0?s=e.y0+Math.PI*e.R*Math.tan(.5*a):s=e.y0+Math.PI*e.R*-Math.tan(.5*a),t.x=o,t.y=s,t;var c=.5*Math.abs(Math.PI/i-i/Math.PI),l=c*c,h=Math.sin(a),u=Math.cos(a),f=u/(h-2*Math.sin(a/2)**2),d=f*f,m=f*(2/h-1),p=m*m,g=Math.sqrt(l*(f-p)*(f-p)-(p+l)*(d-p)),y=Math.PI*e.R*(p-d)/(g-c*(f-p));i<0&&(y=-y),o=e.x0+y;var _=l+f;return y=Math.PI*e.R*(l*(2*f-1)+d)/(m*_+c*Math.sqrt((p+l)*(l+1)-_*_)),n>=0?s=e.y0+y:s=e.y0-y,t.x=o,t.y=s,t}function tI(e,t){var r,n,i,o,s,a,c,l,h,u,f,d,m;return t.x-=e.x0,t.y-=e.y0,Math.abs(t.y)<1e-10?(t.x=G(e.long0+t.x/e.R,e.over),t.y=0,t):(f=Math.PI*e.R,i=t.x/f,o=t.y/f,s=i*i+o*o,a=-Math.abs(o)*(1+s),c=a-2*o*o+i*i,l=-2*a+1+2*o*o+s*s,m=o*o/l+(2*c*c*c/l/l/l-9*a*c/l/l)/27,h=(a-c*c/3/l)/l,u=2*Math.sqrt(-h/3),f=3*m/h/u,Math.abs(f)>1&&(f>=0?f=1:f=-1),d=Math.acos(f)/3,t.y>=0?n=(-u*Math.cos(d+Math.PI/3)-c/3/l)*Math.PI:n=-(-u*Math.cos(d+Math.PI/3)-c/3/l)*Math.PI,Math.abs(i)<1e-10?r=e.long0:r=G(e.long0+2*Math.PI*i/(Math.sqrt(1+2*(i*i-o*o)+s*s)+1-s),e.over),t.x=r,t.y=n,t)}function eI(e,t={}){let r={...e,R:0,...t};return BO(r),r}var Cy={name:"vandg",aliases:["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=eI(t),n=Et("vandg",e,r,QT,tI);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>Gb(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};ma();Ee();da();ne();Ht();wa();var rI=["o_proj","o_alpha","o_lon_c","o_lat_c","o_lon_p","o_lat_p","o_lon_1","o_lat_1","o_lon_2","o_lat_2"],Ny=e=>e.toLowerCase().replace(/[ _-]/g,""),Oy=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),li=(e,t)=>tt(e,t,0)*Math.PI/180;function LO(e){let t=[["o_alpha","o_lon_c","o_lat_c"],["o_lat_p","o_lon_p"],["o_lon_1","o_lat_1","o_lon_2","o_lat_2"]],r=t.find(c=>c.some(l=>Oy(e,l)));if(!r)throw new Error("Oblique transformation requires a rotation parameter set");for(let c of r){if(!Oy(e,c))throw new Error("Oblique transformation requires "+c);if(c.includes("lat")&&Math.abs(li(e,c))>Math.PI/2)throw new Error("Invalid rotation latitude: "+c)}if(r===t[0]){let c=li(e,"o_alpha"),l=li(e,"o_lon_c"),h=li(e,"o_lat_c");if(Math.abs(h)>=Math.PI/2-1e-10)throw new Error("Rotation center must be away from the poles");return{lamp:l+Math.atan2(-Math.cos(c),-Math.sin(c)*Math.sin(h)),phip:Math.asin(Math.cos(h)*Math.sin(c))}}if(r===t[1])return{lamp:li(e,"o_lon_p"),phip:li(e,"o_lat_p")};let n=li(e,"o_lon_1"),i=li(e,"o_lat_1"),o=li(e,"o_lon_2"),s=li(e,"o_lat_2");if(Math.abs(i)>=Math.PI/2-1e-10||Math.abs(s)>=Math.PI/2-1e-10||Math.abs(i)<1e-10||Math.abs(i-s)<1e-10)throw new Error("Invalid new-equator reference points");let a=Math.atan2(Math.cos(i)*Math.sin(s)*Math.cos(n)-Math.sin(i)*Math.cos(s)*Math.cos(o),Math.sin(i)*Math.cos(s)*Math.sin(o)-Math.cos(i)*Math.sin(s)*Math.sin(n));return{lamp:a,phip:Math.atan(-Math.cos(a-n)/Math.tan(i))}}function fm(e){let t=e==="longlat";if(!t&&["obtran","geocent"].includes(Ny(e.name)))throw new Error("Cannot wrap a composite or geocentric projection");return{name:"ob_tran",aliases:["General Oblique Transformation","General_Oblique_Transformation"],parameters:[...rI,"lon_0",...t?[]:e.parameters],flags:t?[]:e.flags,create(r){let{parameters:n}=r,i=n.o_proj,o=t?["longlat","latlong","lonlat","latlon","identity"]:[e.name,...e.aliases||[]];if(i&&!o.map(Ny).includes(Ny(i)))throw new xn("missing-plugin","Oblique transformation dependency does not match +o_proj="+i);let{lamp:s,phip:a}=LO(n),c=Math.cos(a),l=Math.sin(a),h=Math.abs(a)>1e-10,u=li(n,"lon_0"),f=Oy(n,"over"),d={...n,proj:t?"longlat":i||e.name,lon_0:"0"};for(let S of rI)delete d[S];let m=t?qn(S=>{S.x*=180/Math.PI,S.y*=180/Math.PI},S=>{S.x*=Math.PI/180,S.y*=Math.PI/180}):e.create({...r,parameters:Object.freeze(d),primeMeridian:0}),p=oo(m,!1),g=oo(m,!0),y=S=>Math.asin(Math.max(-1,Math.min(1,S))),_=S=>{let v=S.x,N=S.y,B=ve(v-u,f),C=Math.cos(B),R=Math.sin(N),W=Math.cos(N),j=ve(Math.atan2(W*Math.sin(B),h?l*W*C+c*R:R)+s),I=y(h?l*R-c*W*C:-W*C);S.x=j,S.y=I},b=S=>{let v=S.x,N=S.y,B=v-s,C=Math.cos(B),R=Math.sin(N),W=Math.cos(N),j=Math.atan2(W*Math.sin(B),h?l*W*C-c*R:-R),I=y(h?l*R+c*W*C:W*C);S.x=ve(j+u),S.y=I},M=qn(S=>{_(S),p(S)},S=>{g(S),b(S)}),T=t?is(d):m.getRenderingProfile?.bind(m);if(!T)return M;let A=(S,v)=>{let N=v&&Ke(()=>S.bounds,v,u,r.primeMeridian??0,f),B=Wo(C=>{let R=C.x,W=C.y;_(C);let j=C.x*180/Math.PI,I=C.y*180/Math.PI,P={x:j,y:I,z:C.z};if(S.normalize?.(P),P.x===j&&P.y===I){C.x=R,C.y=W;return}C.x=P.x*Math.PI/180,C.y=P.y*Math.PI/180,b(C),f&&(C.x+=Math.round((R-C.x)/(2*Math.PI))*2*Math.PI)},r.primeMeridian??0);return{get bounds(){let C=S.bounds,R=W=>[W[0]*180/Math.PI,W[1]*180/Math.PI,W[2]];return t?[R(C[0]),R(C[1])]:C},normalize(C){N?.normalize(C),B(C)}}};return{...M,longitudeOrigin:u,getRenderingProfile(S){if(!S)return A(T());let v=jo(S,r.primeMeridian??0,u),N=K(v[0][0]-u,v[0][1],v[1][0]-u,v[1][1]),B=se(h?[-c,0,l]:[-1,0,0],N),C=h?[l,0,c]:[0,0,1],W=se(C,N)[0]>0?Jo([0,1,0],C,0,N).map(Math.atan):[-Math.PI,Math.PI];return A(T(gn(K(W[0]+s,y(B[0]),W[1]+s,y(B[1])))),S)}}}}}Nc();Ag();Ee();function be(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Expected a CRS object");return e}function $h(e){return Array.isArray(e)?e:[]}function Mr(e){return String(e||"").toLowerCase().replace(/[^a-z0-9]/g,"")}function cr(e){if(typeof e!="number"||!Number.isFinite(e))throw new Error("Expected a finite CRS parameter");return e}function sn(e,t){if(e===void 0)return t;if(typeof e=="object"){let i=cr(be(e).conversion_factor);if(i<=0)throw new Error("Unit conversion factor must be positive");return i}let n={metre:1,meter:1,degree:Me,radian:1,grad:Math.PI/200,gon:Math.PI/200,foot:.3048,ussurveyfoot:1200/3937,kilometre:1e3,arcsecond:Me/3600,partspermillion:1e-6,unity:1}[Mr(e)];return n||Bt("Unsupported CRS unit: "+String(e)),n}var DO={hotineobliquemercator:"omerc",hotineobliquemercatorvarianta:"omerc",hotineobliquemercatorvariantb:"omerc",hotineobliquemercatorazimuthnaturalorigin:"omerc",hotineobliquemercatorazimuthcenter:"omerc",obliquemercator:"omerc",krovak:"krovak",krovaknorthorientated:"krovak",quadrilateralizedsphericalcube:"qsc",transversemercator:"tmerc",transversemercatorsouthorientated:"unsupported-south-tmerc",mercator:"merc",mercator1sp:"merc",mercator2sp:"merc",mercatorvarianta:"merc",mercatorvariantb:"merc",mercatorauxiliarysphere:"webmerc",popularvisualisationpseudomercator:"webmerc",lambertconformalconic:"lcc",lambertconformalconic1sp:"lcc",lambertconformalconic2sp:"lcc",lambertconicconformal1sp:"lcc",lambertconicconformal2sp:"lcc",albers:"aea",albersconicequalarea:"aea",albersequalarea:"aea",equidistantconic:"eqdc",lambertazimuthalequalarea:"laea",stereographic:"stere",stereographicnorthpole:"sterea",stereographicsouthpole:"stere",polarstereographic:"stere",polarstereographicvarianta:"stere",polarstereographicvariantb:"stere",obliquestereographic:"sterea",doublestereographic:"sterea",azimuthalequidistant:"aeqd",modifiedazimuthalequidistant:"aeqd",equidistantcylindrical:"eqc",equidistantcylindricalspherical:"eqc",equirectangular:"eqc",platecarree:"eqc",bonne:"bonne",cassinisoldner:"cass",cassini:"cass",cylindricalequalarea:"cea",lambertcylindricalequalarea:"cea",eckertvi:"eck6",equalearth:"eqearth",millercylindrical:"mill",mollweide:"moll",robinson:"robin",sinusoidal:"sinu",vandergrinten:"vandg",vandergrinteni:"vandg",gnomonic:"gnom",orthographic:"ortho",polyconic:"poly",americanpolyconic:"poly",newzealandmapgrid:"nzmg",gaussschreibertransversemercator:"gstmerc"},FO={centralmeridian:"lon_0",longitudeoforigin:"lon_0",longitudeofcenter:"lon_0",longitudeofnaturalorigin:"lon_0",longitudeoffalseorigin:"lon_0",longitudeofprojectioncentre:"lon_0",straightverticalpolelongitude:"lon_0",longitudeoforiginmeridian:"lon_0",latitudeoforigin:"lat_0",latitudeofcenter:"lat_0",latitudeofnaturalorigin:"lat_0",latitudeoffalseorigin:"lat_0",latitudeofprojectioncentre:"lat_0",standardparallel1:"lat_1",latitudeof1ststandardparallel:"lat_1",standardparallel2:"lat_2",latitudeof2ndstandardparallel:"lat_2",latitudeofstandardparallel:"lat_ts",scalefactor:"k_0",scalefactoratnaturalorigin:"k_0",scalefactoratprojectionorigin:"k_0",falseeasting:"x_0",falsenorthing:"y_0",eastingatfalseorigin:"x_0",northingatfalseorigin:"y_0"},UO={omerc:{longitudeofcenter:"lonc",longitudeofprojectioncentre:"lonc",azimuth:"alpha",azimuthatprojectioncentre:"alpha",rectifiedgridangle:"gamma",anglefromrectifiedtoskewgrid:"gamma",scalefactoratprojectioncentre:"k_0",eastingatprojectioncentre:"x_0",northingatprojectioncentre:"y_0"},krovak:{azimuth:"alpha",colatitudeofconeaxis:"alpha",pseudostandardparallel1:"lat_ts",latitudeofpseudostandardparallel:"lat_ts",scalefactoronpseudostandardparallel:"k_0"}},GO={east:"e",west:"w",north:"n",south:"s",up:"u",down:"d",geocentricx:"e",geocentricy:"n",geocentricz:"u"};function Ra(e,t){let r=String(e.type),n=zO(e.bbox);if(r==="CompoundCRS"){t.mode!=="horizontal"&&Bt("CompoundCRS requires explicit horizontal extraction");let v=$h(e.components).map(be).filter(B=>["ProjectedCRS","GeographicCRS","GeodeticCRS","BoundCRS"].includes(String(B.type)));if(v.length!==1)throw new Error("CompoundCRS requires exactly one horizontal component");let N=Ra(v[0],t);return{...N,areaOfUse:n??N.areaOfUse,lossy:!0}}if(r==="BoundCRS"){let v=Ra(be(e.source_crs),t),N=Ra(be(e.target_crs),t);(N.parameters.datum!=="WGS84"||!["longlat","geocent"].includes(N.parameters.proj)||Number(N.parameters.pm||0)!==0||N.parameters.towgs84||Number(N.parameters.a)!==6378137||!(Math.abs(Number(N.parameters.rf)-298.257223563)<=1e-9||Math.abs(Number(N.parameters.b)-6356752314245179e-9)<=1e-6))&&Bt("BoundCRS requires a WGS84 target");let B=be(e.transformation),C=Mr(be(B.method).name),R=C==="geocentrictranslations"||/^geocentrictranslationsgeog[23]ddomain$/.test(C),W=/^positionvector(?:transformation)?(?:geog[23]ddomain|geocentricdomain)?$/.test(C),j=/^coordinateframe(?:rotation)?(?:geog[23]ddomain|geocentricdomain)?$/.test(C);!R&&!W&&!j&&Bt("Unsupported BoundCRS transformation: "+C);let I=["xaxistranslation","yaxistranslation","zaxistranslation","xaxisrotation","yaxisrotation","zaxisrotation","scaledifference"],P=new Array(R?3:7).fill(void 0);for(let F of $h(B.parameters)){let L=be(F),O=I.indexOf(Mr(L.name));(O<0||O>=P.length||P[O]!==void 0)&&Bt("Unsupported or duplicate Helmert parameter: "+String(L.name));let V=O<3?1:O<6?Me/3600:1e-6;P[O]=cr(L.value)*sn(L.unit,V)/V*(j&&O>=3&&O<6?-1:1)}if(P.some(F=>F===void 0))throw new Error("Incomplete BoundCRS Helmert transformation");let D={...v.parameters,towgs84:P.join(",")};return delete D.datum,{...v,parameters:D,areaOfUse:n??v.areaOfUse}}["ProjectedCRS","GeographicCRS","GeodeticCRS"].includes(r)||Bt("Unsupported CRS type: "+r);let i=r==="ProjectedCRS"?be(e.base_crs):e,o=be(i.datum||i.datum_ensemble);(o.type==="DynamicGeodeticReferenceFrame"||o.frame_reference_epoch!==void 0||e.coordinate_epoch!==void 0)&&Bt("Time-dependent datum transformations are not implemented");let s=be(o.ellipsoid),a=cr(s.semi_major_axis??s.radius),c={proj:"longlat",a:String(a*sn(s.unit,1))};if(s.inverse_flattening!==void 0)c.rf=String(cr(s.inverse_flattening));else if(s.semi_minor_axis!==void 0)c.b=String(cr(s.semi_minor_axis)*sn(s.unit,1));else if(s.radius!==void 0)c.b=c.a;else throw new Error("Ellipsoid requires inverse flattening or semi-minor axis");let l=Xc(t),h=String(o.name||""),u=Mr(h),f=Object.keys(l),d=f.find(v=>Ta(v)===Ta(h)),m=d?[d]:f.filter(v=>Mr(v)===u||Mr(v)===u.replace(/^d/,"")),p=m[0],g=l[p];if(g&&m.some(v=>{let N=l[v];return N.ellipse!==g.ellipse||N.towgs84!==g.towgs84||N.nadgrids!==g.nadgrids}))throw new Error("Ambiguous structured datum name: "+h);if(u&&(c.datum=p||h),p&&Ta(p)==="wgs84"&&(c.datum="WGS84"),p&&["nad83","northamericandatum1983"].includes(Ta(p))&&(c.datum="NAD83"),!p){["wgs84","worldgeodeticsystem1984","worldgeodeticsystem1984ensemble","dwgs1984","wgs1984"].includes(u)&&(c.datum="WGS84"),["nad83","northamericandatum1983","dnorthamerican1983"].includes(u)&&(c.datum="NAD83"),["nad27","northamericandatum1927","dnorthamerican1927"].includes(u)&&(c.datum="NAD27");let N={newzealand1949:"nzgd49",belge1972:"rnb72"}[u.replace(/^d/,"")];N&&(c.datum=N)}if(r==="ProjectedCRS"&&i.id){let v=be(i.id),N=String(v.authority)+"_"+String(v.code);Object.prototype.hasOwnProperty.call(l,N)&&(c.datum=N)}o.towgs84!==void 0&&(c.towgs84=$h(o.towgs84).map(cr).join(","),delete c.datum);let y=e.coordinate_system?be(e.coordinate_system):{},_=$h(y.axis).map(be),b=Mr(y.subtype)==="cartesian"&&r==="GeodeticCRS";r!=="ProjectedCRS"&&!b&&y.subtype&&Mr(y.subtype)!=="ellipsoidal"&&Bt("Unsupported coordinate system subtype"),b&&(c.proj="geocent");let M=sn(i.angular_unit,Me),T=sn(_[0]?.unit,r==="ProjectedCRS"||b?1:M);_[1]&&sn(_[1].unit,T)!==T&&Bt("Mixed horizontal axis units are not supported"),b&&_[2]&&sn(_[2].unit,T)!==T&&Bt("Mixed geocentric axis units are not supported");let A=i.prime_meridian||o.prime_meridian;if(A){let v=be(A);c.pm=String(cr(v.longitude)*sn(v.unit,M)/Me)}if(r==="ProjectedCRS"){let v=be(e.conversion),N=Mr(be(v.method).name),B=$h(v.parameters).map(be),C=N==="stereographicnorthpole"&&!B.some(I=>Mr(I.name).startsWith("scalefactor")),R=C?"stere":DO[N],W=B.filter(I=>["xscale","yscale","xyplanerotation"].includes(Mr(I.name)));if(W.length){let I={xscale:-1,yscale:1,xyplanerotation:90};(R!=="krovak"||W.length!==3||new Set(W.map(P=>Mr(P.name))).size!==3||W.some(P=>{let D=Mr(P.name),F=D==="xyplanerotation"?sn(P.unit,M)/Me:sn(P.unit,1);return Math.abs(cr(P.value)*F-I[D])>1e-10}))&&Bt("Unsupported ESRI Krovak axis adjustment")}(!R||R.startsWith("unsupported"))&&Bt("Unsupported projection method: "+String(be(v.method).name)),c.proj=R==="webmerc"?"merc":R;let j=!1;for(let I of B){let P=Mr(I.name);if(W.includes(I)||P==="auxiliaryspheretype"&&R==="webmerc"&&I.value===0)continue;if(P==="semiminor"&&R==="webmerc"){if(j)throw new Error("Duplicate conversion parameter: semi_minor");j=!0;let V=cr(I.value)*sn(I.unit,1);Math.abs(V-Number(c.a))>4*Number.EPSILON*Number(c.a)&&Bt("Pseudo-Mercator semi_minor must equal the semi-major axis");continue}let D=UO[R]?.[P]||FO[P];if(D||Bt("Unsupported conversion parameter: "+String(I.name)),D==="lat_1"&&N==="stereographicnorthpole"&&!C?D="lat_0":D==="lat_1"&&["merc","webmerc","eqc","stere","cea"].includes(R)&&(D="lat_ts"),c[D]!==void 0)throw new Error("Duplicate conversion parameter: "+D);if(["merc","webmerc"].includes(R)&&D==="lat_0"&&I.value===0)continue;let F=D.startsWith("lat")||D.startsWith("lon")||D==="alpha"||D==="gamma",L=D==="x_0"||D==="y_0",O=cr(I.value)*sn(I.unit,F?M:L?T:1)/(F?Me:1);D.startsWith("lat")&&Math.abs(Math.abs(O)-90)<=4*Number.EPSILON*90&&(O=Math.sign(O)*90),c[D]=String(O)}if(R==="omerc"&&["hotineobliquemercator","hotineobliquemercatorvarianta","hotineobliquemercatorazimuthnaturalorigin"].includes(N)&&(c.no_uoff=void 0),R==="omerc"&&c.lon_0!==void 0&&c.lonc!==void 0&&(Math.abs(Number(c.lon_0)-Number(c.lonc))>1e-10&&Bt("Oblique Mercator central meridian conflicts with projection centre"),delete c.lon_0),N==="stereographicnorthpole"&&Math.abs(Number(c.lat_0))===90&&(c.proj="stere"),R==="lcc"&&c.lat_1===void 0&&(c.lat_1=c.lat_0),N==="polarstereographic"&&c.lat_0!==void 0){if(c.lat_ts!==void 0)throw new Error("Duplicate polar stereographic latitude of true scale");c.lat_ts=c.lat_0,delete c.lat_0}R==="stere"&&(N.includes("polar")||N==="stereographicsouthpole"||C)&&c.lat_0===void 0&&(c.lat_0=Number(c.lat_ts||90)<0?"-90":"90"),R==="webmerc"&&(c.b=c.a,delete c.rf,c.nadgrids="@null")}let S=_.map(v=>VO(v,c,r==="ProjectedCRS")).join("");return S.length===2&&(S+="u"),!b&&/[ud]/.test(S.slice(0,2))&&Bt("Structured CRS vertical-first axes require an explicit PROJ axis definition"),S&&(c.axis=S),(r==="ProjectedCRS"||b)&&(c.to_meter=String(T)),{parameters:c,areaOfUse:n,angularUnit:r==="ProjectedCRS"||b?M:T,verticalUnit:b?1:sn(_[2]?.unit,1)}}function zO(e){let t;if(e!==void 0){let r=be(e),n=cr(r.west_longitude),i=cr(r.south_latitude),o=cr(r.east_longitude),s=cr(r.north_latitude);if(n<-180||n>180||o<-180||o>180||i<-90||s>90||i>=s||n===o)throw new Error("Invalid CRS geographic bounding box");t=[n,i,o,s]}return t}function VO(e,t,r){let n=String(e.direction),i=e.meridian,o=/^(north|south) along ([+-]?(?:\d+(?:\.\d*)?|\.\d+)) deg(?: (east|west))?$/i.exec(n);if(o){if(i!==void 0)throw new Error("Duplicate axis meridian");n=o[1],i={longitude:Number(o[2])*(o[3]?.toLowerCase()==="west"?-1:1)}}if(i!==void 0){let a=Number(t.lat_0),c=a===90;(!r||t.proj!=="stere"||Math.abs(a)!==90||Mr(n)!==(c?"south":"north"))&&Bt("Axis meridians require an outward-facing polar stereographic axis");let l=be(i).longitude,h=typeof l=="number"?cr(l):cr(be(l).value)*sn(be(l).unit,Me)/Me,u=cr((h-Number(t.lon_0||0))/90);Math.abs(u-Math.round(u))>1e-12&&Bt("Non-cardinal axis meridians require an orientation operation");let f=(Math.round(u)%4+4)%4;return(c?"senw":"nesw")[f]}let s=GO[Mr(n)];return s||Bt("Unsupported axis direction: "+n),s}function dm(e,...t){return e.values.filter(r=>r.type==="node"&&t.includes(r.keyword.toUpperCase()))}function de(e,...t){return dm(e,...t)[0]}function le(e,t=0){let r=e.values[t];return r&&r.type!=="node"?r.value:void 0}function Ca(e){return e?{name:le(e),conversion_factor:le(e,1)}:void 0}function kO(e,t){let r=le(e,1);if(t&&String(r).toLowerCase()==="unknown"){let n=String(le(e)).toLowerCase(),i=/^(easting|northing|westing|southing)(?:\s*\([a-z]\))?$/.exec(n);if(i)return{easting:"east",northing:"north",westing:"west",southing:"south"}[i[1]]}return r}function qO(e){let t=de(e,"MERIDIAN");if(t)return{longitude:{value:le(t),unit:Ca(de(t,"ANGLEUNIT"))}}}function nI(e){let t=de(e,"METHOD","PROJECTION");if(!t)throw new Error("WKT conversion requires a METHOD or PROJECTION");return de(e,"PARAMETERFILE")&&Bt("Grid-based WKT operation is not implemented"),{method:{name:le(t)},parameters:dm(e,"PARAMETER").map(r=>({name:le(r),value:le(r,1),unit:Ca(de(r,"ANGLEUNIT","LENGTHUNIT","SCALEUNIT"))}))}}function Yh(e){let t=e.keyword.toUpperCase();if(t==="COMPD_CS"||t==="COMPOUNDCRS")return{type:"CompoundCRS",components:dm(e,"PROJCS","PROJCRS","GEOGCS","GEOGCRS","GEODCRS","BOUNDCRS","VERT_CS","VERTCRS").map(Yh)};if(t==="BOUNDCRS"){let f=de(e,"SOURCECRS"),d=de(e,"TARGETCRS"),m=de(e,"ABRIDGEDTRANSFORMATION");if(!f||!d||!m)throw new Error("Incomplete WKT BoundCRS");let p=_=>{let b=_.values.find(M=>M.type==="node");if(!b)throw new Error("Missing bound CRS component");return b},g=nI(m),y=g.parameters;for(let _ of y)String(_.name).toLowerCase()==="scale difference"&&_.unit===void 0&&(_.value=(Number(_.value)-1)*1e6);return{type:"BoundCRS",source_crs:Yh(p(f)),target_crs:Yh(p(d)),transformation:g}}if(["VERT_CS","VERTCRS"].includes(t))return{type:"VerticalCRS"};let r=["PROJCS","PROJCRS","PROJECTEDCRS"].includes(t),n=["GEOGCS","GEOGCRS","GEODCRS","GEODETICCRS","GEOGRAPHICCRS","BASEGEOGCRS","BASEGEODCRS","GEOCCS"].includes(t);!r&&!n&&Bt("Unsupported WKT CRS: "+t),de(e,"DYNAMIC","DERIVINGCONVERSION","VELOCITYGRID","EXTENSION")&&Bt("Unsupported WKT dynamic/extension operation");let i=de(e,"CS"),o=t==="GEOCCS"||String(le(i||e)).toLowerCase()==="cartesian"&&!r,s=de(e,r||o?"LENGTHUNIT":"ANGLEUNIT","UNIT"),a=dm(e,"AXIS").sort((f,d)=>Number(le(de(f,"ORDER")||f))-Number(le(de(d,"ORDER")||d))).map((f,d)=>({name:le(f),direction:t==="GEOCCS"?["geocentricX","geocentricY","geocentricZ"][d]:kO(f,r),unit:Ca(de(f,"ANGLEUNIT","LENGTHUNIT")||(!o&&!r&&/^(up|down)$/i.test(String(le(f,1)))?void 0:s)),meridian:qO(f)}));if(!a.length)for(let f of o?["geocentricX","geocentricY","geocentricZ"]:["east","north"])a.push({name:f,direction:f,unit:Ca(s),meridian:void 0});let c=t==="GEOGCS"?void 0:de(e,"ID"),l={type:r?"ProjectedCRS":o?"GeodeticCRS":"GeographicCRS",name:le(e),id:c?{authority:le(c),code:le(c,1)}:void 0,coordinate_system:{subtype:r||o?"Cartesian":"ellipsoidal",axis:a}},h=de(e,"USAGE"),u=de(h||e,"BBOX");if(u&&(l.bbox={south_latitude:le(u,0),west_longitude:le(u,1),north_latitude:le(u,2),east_longitude:le(u,3)}),r){let f=de(e,"GEOGCS","BASEGEOGCRS","BASEGEODCRS","GEODCRS","GEOGCRS");if(!f)throw new Error("Projected WKT requires a base geographic CRS");l.base_crs=Yh(f),l.conversion=nI(de(e,"CONVERSION")||e)}else{let f=de(e,"DATUM","GEODETICDATUM","ENSEMBLE");if(!f)throw new Error("WKT requires a geodetic datum");de(f,"EXTENSION","DYNAMIC")&&Bt("Unsupported datum extension");let d=de(f,"SPHEROID","ELLIPSOID");if(!d)throw new Error("WKT datum requires an ellipsoid");let m=de(f,"TOWGS84");l.datum={name:le(f),ellipsoid:{name:le(d),semi_major_axis:le(d,1),inverse_flattening:le(d,2),unit:Ca(de(d,"LENGTHUNIT"))},towgs84:m?.values.map((g,y)=>le(m,y))};let p=de(e,"PRIMEM");p&&(l.prime_meridian={name:le(p),longitude:le(p,1),unit:Ca(de(p,"ANGLEUNIT")||(o?void 0:s))}),l.angular_unit=o?void 0:Ca(s)}return l}var By={name:"wkt",canParse:e=>tr(e)==="wkt",parse(e,t){if(typeof e!="string")throw new Error("Expected serialized WKT");return Ra(Yh(dh(e).root),t)}};Nc();var Ly={name:"projjson",canParse:e=>tr(e)==="projjson",parse:(e,t)=>Ra(be(e),t)};Ee();var Dy=1e-12;function mm(e,t,r,n,i=!1){let o=(t-e.origin[0])/e.step[0],s=(r-e.origin[1])/e.step[1],a=e.size[0],c=e.size[1];if(!i&&(o<-1e-10||s<-1e-10||o>a-1+1e-10||s>c-1+1e-10))return!1;o=Math.max(0,Math.min(a-1,o)),s=Math.max(0,Math.min(c-1,s));let l=Math.min(a-2,Math.floor(o)),h=Math.min(c-2,Math.floor(s)),u=o-l,f=s-h,d=0,m=0;for(let p=0;p<4;p++){let g=p%2,y=p>1,_=(g?u:1-u)*(y?f:1-f);if(_===0)continue;let b=((h+(y?1:0))*a+l+g)*2,M=e.shifts[b],T=e.shifts[b+1];if(!Number.isFinite(M)||!Number.isFinite(T))return!1;d+=_*M,m+=_*T}return n.x=d,n.y=m,!0}function jO(e,t,r,n,i){if(!n)return mm(e,t,r,i)?(i.x+=t,i.y+=r,!0):!1;for(let a=0;a<2;a++){let c=a===0?t:r;if(c<e.origin[a]-e.maxShift[a]-Dy||c>e.origin[a]+(e.size[a]-1)*e.step[a]+e.maxShift[a]+Dy)return!1}if(!mm(e,t,r,i,!0))return!1;let o=t-i.x,s=r-i.y;for(let a=0;a<20;a++){if(!mm(e,o,s,i,!0))return!1;let c=t-o-i.x,l=r-s-i.y;if(o+=c,s+=l,Math.max(Math.abs(c),Math.abs(l))<=Dy)return mm(e,o,s,i)?(i.x=ve(o),i.y=s,!0):!1}throw new Error("Inverse datum grid shift did not converge")}function iI(e){if(!e.length)throw new Error("Datum grid requires at least one subgrid");let t=e.map(i=>{let[o,s]=i.size;if(![o,s].every(c=>Number.isSafeInteger(c)&&c>=2)||o*s*2!==i.shifts.length||!i.origin.every(Number.isFinite)||!i.step.every(c=>Number.isFinite(c)&&c>0))throw new Error("Invalid datum subgrid geometry or node count");let a=[0,0];for(let c=0;c<i.shifts.length;c++){let l=i.shifts[c];Number.isFinite(l)&&(a[c%2]=Math.max(a[c%2],Math.abs(l)))}return{...i,maxShift:a}}),r=(i,o)=>{let s=i.x,a=i.y;if(!Number.isFinite(s)||!Number.isFinite(a))throw new Error("Grid coordinates must be finite");for(let c of t)if(jO(c,-s,a,o,i))return i.x=-i.x,!0;return i.x=s,i.y=a,!1},n={x:NaN,y:NaN};return Object.freeze({subgridCount:t.length,shiftInPlace:r,shift(i,o,s){return n.x=i,n.y=o,r(n,s)?[n.x,n.y]:void 0}})}var al=Math.PI/648e3;function Fy(e,t={}){let r=new DataView(e);if(r.byteLength<176)throw new Error("Truncated NTv2 overview header");let n=r.getInt32(8,!0)===11;if(!n&&r.getInt32(8,!1)!==11)throw new Error("Invalid NTv2 header or byte order");let i=u=>r.getInt32(u,n),o=u=>r.getFloat64(u,n),s=u=>String.fromCharCode(...new Uint8Array(e,u,8)).replace(/\0/g,"").trim();if(s(0)!=="NUM_OREC"||i(24)!==11||s(56)!=="SECONDS")throw new Error("Unsupported NTv2 header or shift units");let a=i(40),c=t.includeErrorFields===!1?8:16;if(a<1||a>Math.floor((r.byteLength-176)/(176+4*c)))throw new Error("Invalid NTv2 subgrid count");let l=176,h=[];for(let u=0;u<a;u++){if(l+176>r.byteLength)throw new Error("Truncated NTv2 subgrid header");let f=o(l+72),d=o(l+88),m=o(l+104),p=o(l+120),g=o(l+136),y=o(l+152),_=i(l+168),b=1+(p-m)/y,M=1+(d-f)/g;if(![b,M].every(v=>Number.isFinite(v)&&v>=2&&Math.abs(v-Math.round(v))<1e-7)||!(y>0&&g>0)||_!==Math.round(b)*Math.round(M))throw new Error("Invalid NTv2 subgrid dimensions");let T=l+176,A=T+_*c;if(A>r.byteLength)throw new Error("Truncated NTv2 node records");let S=new Float64Array(_*2);for(let v=0;v<_;v++)S[v*2]=r.getFloat32(T+v*c+4,n)*al,S[v*2+1]=r.getFloat32(T+v*c,n)*al;h.push({origin:[m*al,f*al],step:[y*al,g*al],size:[Math.round(b),Math.round(M)],shifts:S}),l=A}return iI(h)}var pm={ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clrk80ign",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},mgi:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Militar-Geographische Institut"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Ordnance Survey of Great Britain 1936"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"},EPSG_5451:{towgs84:"6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649"},IGNF_LURESG:{towgs84:"-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43"},EPSG_4614:{towgs84:"-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065"},EPSG_4615:{towgs84:"-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748"},ESRI_37241:{towgs84:"-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031"},ESRI_37249:{towgs84:"-440.296,58.548,296.265,1.128,10.202,4.559,-0.438"},ESRI_37245:{towgs84:"-511.151,-181.269,139.609,1.05,2.703,1.798,3.071"},EPSG_4178:{towgs84:"24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01"},EPSG_4622:{towgs84:"-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984"},EPSG_4625:{towgs84:"126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227"},EPSG_5252:{towgs84:"0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439"},EPSG_4314:{towgs84:"597.1,71.4,412.1,0.894,0.068,-1.563,7.58"},EPSG_4282:{towgs84:"-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166"},EPSG_4231:{towgs84:"-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218"},EPSG_4274:{towgs84:"-230.994,102.591,25.199,0.633,-0.239,0.9,1.95"},EPSG_4134:{towgs84:"-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006"},EPSG_4254:{towgs84:"18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013"},EPSG_4159:{towgs84:"-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175"},EPSG_4687:{towgs84:"0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093"},EPSG_4227:{towgs84:"-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225"},EPSG_4746:{towgs84:"599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46"},EPSG_4745:{towgs84:"612.4,77,440.2,-0.054,0.057,-2.797,2.55"},EPSG_6311:{towgs84:"8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926"},EPSG_4289:{towgs84:"565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244"},EPSG_4230:{towgs84:"-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4"},EPSG_4154:{towgs84:"-123.02,-158.95,-168.47"},EPSG_4156:{towgs84:"570.8,85.7,462.8,4.998,1.587,5.261,3.56"},EPSG_4299:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4179:{towgs84:"33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84"},EPSG_4313:{towgs84:"-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747"},EPSG_4194:{towgs84:"163.511,127.533,-159.789"},EPSG_4195:{towgs84:"105,326,-102.5"},EPSG_4196:{towgs84:"-45,417,-3.5"},EPSG_4611:{towgs84:"-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246"},EPSG_4633:{towgs84:"137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824"},EPSG_4641:{towgs84:"-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993"},EPSG_4643:{towgs84:"-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002"},EPSG_4300:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4188:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4660:{towgs84:"982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805"},EPSG_4662:{towgs84:"97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259"},EPSG_3906:{towgs84:"577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664"},EPSG_4307:{towgs84:"-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547"},EPSG_6892:{towgs84:"-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686"},EPSG_4690:{towgs84:"221.597,152.441,176.523,2.403,1.3893,0.884,11.4648"},EPSG_4691:{towgs84:"218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817"},EPSG_4629:{towgs84:"72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653"},EPSG_4630:{towgs84:"165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111"},EPSG_4692:{towgs84:"217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093"},EPSG_9333:{towgs84:"0,0,0,-0.008393,0.000749,-0.010276,0"},EPSG_9059:{towgs84:"0,0,0"},EPSG_4312:{towgs84:"601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887"},EPSG_4123:{towgs84:"-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496"},EPSG_4309:{towgs84:"-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365"},ESRI_104106:{towgs84:"-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058"},EPSG_4281:{towgs84:"-219.247,-73.802,269.529"},EPSG_4322:{towgs84:"0,0,4.5"},EPSG_4324:{towgs84:"0,0,1.9"},EPSG_4284:{towgs84:"43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549"},EPSG_4277:{towgs84:"446.448,-125.157,542.06,0.15,0.247,0.842,-20.489"},EPSG_4207:{towgs84:"-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46"},EPSG_4688:{towgs84:"347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647"},EPSG_4689:{towgs84:"410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218"},EPSG_4720:{towgs84:"0,0,4.5"},EPSG_4273:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},EPSG_4240:{towgs84:"204.64,834.74,293.8"},EPSG_4817:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},ESRI_104131:{towgs84:"426.62,142.62,460.09,4.98,4.49,-12.42,-17.1"},EPSG_4265:{towgs84:"-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68"},EPSG_4263:{towgs84:"-111.92,-87.85,114.5,1.875,0.202,0.219,0.032"},EPSG_4298:{towgs84:"-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536"},EPSG_4270:{towgs84:"-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424"},EPSG_4229:{towgs84:"-121.8,98.1,-10.7"},EPSG_4220:{towgs84:"-55.5,-348,-229.2"},EPSG_4214:{towgs84:"12.646,-155.176,-80.863"},EPSG_4232:{towgs84:"-345,3,223"},EPSG_4238:{towgs84:"-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037"},EPSG_4168:{towgs84:"-170,33,326"},EPSG_4131:{towgs84:"199,931,318.9"},EPSG_4152:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_5228:{towgs84:"572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378"},EPSG_8351:{towgs84:"485.021,169.465,483.839,7.786342,4.397554,4.102655,0"},EPSG_4683:{towgs84:"-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06"},EPSG_4133:{towgs84:"0,0,0"},EPSG_7373:{towgs84:"0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693"},EPSG_9075:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9072:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9294:{towgs84:"1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388"},EPSG_4212:{towgs84:"-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492"},EPSG_4191:{towgs84:"-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703"},EPSG_4237:{towgs84:"52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191"},EPSG_4740:{towgs84:"-1.08,-0.27,-0.9"},EPSG_4124:{towgs84:"419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496"},EPSG_5681:{towgs84:"584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922"},EPSG_4141:{towgs84:"23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262"},EPSG_4204:{towgs84:"-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194"},EPSG_4319:{towgs84:"226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798"},EPSG_4200:{towgs84:"24.82,-131.21,-82.66"},EPSG_4130:{towgs84:"0,0,0"},EPSG_4127:{towgs84:"-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359"},EPSG_4149:{towgs84:"674.374,15.056,405.346"},EPSG_4617:{towgs84:"-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0"},EPSG_4663:{towgs84:"-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485"},EPSG_4664:{towgs84:"-211.939,137.626,58.3,-0.089,0.251,0.079,0.384"},EPSG_4665:{towgs84:"-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048"},EPSG_4666:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},EPSG_4756:{towgs84:"-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188"},EPSG_4723:{towgs84:"-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925"},EPSG_4726:{towgs84:"8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081"},EPSG_4267:{towgs84:"-8.0,160.0,176.0"},EPSG_5365:{towgs84:"-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693"},EPSG_4218:{towgs84:"304.5,306.5,-318.1"},EPSG_4242:{towgs84:"-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95"},EPSG_4216:{towgs84:"-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289"},ESRI_104105:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},ESRI_104129:{towgs84:"0,0,0"},EPSG_4673:{towgs84:"174.05,-25.49,112.57"},EPSG_4202:{towgs84:"-124,-60,154"},EPSG_4203:{towgs84:"-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191"},EPSG_3819:{towgs84:"595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408"},EPSG_8694:{towgs84:"-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169"},EPSG_4145:{towgs84:"275.57,676.78,229.6"},EPSG_4283:{towgs84:"0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994"},EPSG_4317:{towgs84:"2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063"},EPSG_4272:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993"},EPSG_4248:{towgs84:"-307.7,265.3,-363.5"},EPSG_5561:{towgs84:"24,-121,-76"},EPSG_5233:{towgs84:"-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338"},ESRI_104130:{towgs84:"-86,-98,-119"},ESRI_104102:{towgs84:"682,-203,480"},ESRI_37207:{towgs84:"7,-10,-26"},EPSG_4675:{towgs84:"59.935,118.4,-10.871"},ESRI_104109:{towgs84:"-89.121,-348.182,260.871"},ESRI_104112:{towgs84:"-185.583,-230.096,281.361"},ESRI_104113:{towgs84:"25.1,-275.6,222.6"},IGNF_WGS72G:{towgs84:"0,12,6"},IGNF_NTFG:{towgs84:"-168,-60,320"},IGNF_EFATE57G:{towgs84:"-127,-769,472"},IGNF_PGP50G:{towgs84:"324.8,153.6,172.1"},IGNF_REUN47G:{towgs84:"94,-948,-1262"},IGNF_CSG67G:{towgs84:"-186,230,110"},IGNF_GUAD48G:{towgs84:"-467,-16,-300"},IGNF_TAHI51G:{towgs84:"162,117,154"},IGNF_TAHAAG:{towgs84:"65,342,77"},IGNF_NUKU72G:{towgs84:"84,274,65"},IGNF_PETRELS72G:{towgs84:"365,194,166"},IGNF_WALL78G:{towgs84:"253,-133,-127"},IGNF_MAYO50G:{towgs84:"-382,-59,-262"},IGNF_TANNAG:{towgs84:"-139,-967,436"},IGNF_IGN72G:{towgs84:"-13,-348,292"},IGNF_ATIGG:{towgs84:"1118,23,66"},IGNF_FANGA84G:{towgs84:"150.57,158.33,118.32"},IGNF_RUSAT84G:{towgs84:"202.13,174.6,-15.74"},IGNF_KAUE70G:{towgs84:"126.74,300.1,-75.49"},IGNF_MOP90G:{towgs84:"-10.8,-1.8,12.77"},IGNF_MHPF67G:{towgs84:"338.08,212.58,-296.17"},IGNF_TAHI79G:{towgs84:"160.61,116.05,153.69"},IGNF_ANAA92G:{towgs84:"1.5,3.84,4.81"},IGNF_MARQUI72G:{towgs84:"330.91,-13.92,58.56"},IGNF_APAT86G:{towgs84:"143.6,197.82,74.05"},IGNF_TUBU69G:{towgs84:"237.17,171.61,-77.84"},IGNF_STPM50G:{towgs84:"11.363,424.148,373.13"},EPSG_4150:{towgs84:"674.374,15.056,405.346"},EPSG_4754:{towgs84:"-208.4058,-109.8777,-2.5764"},ESRI_104101:{towgs84:"372.87,149.23,585.29"},EPSG_4693:{towgs84:"0,-0.15,0.68"},EPSG_6207:{towgs84:"293.17,726.18,245.36"},EPSG_4153:{towgs84:"-133.63,-157.5,-158.62"},EPSG_4132:{towgs84:"-241.54,-163.64,396.06"},EPSG_4221:{towgs84:"-154.5,150.7,100.4"},EPSG_4266:{towgs84:"-80.7,-132.5,41.1"},EPSG_4193:{towgs84:"-70.9,-151.8,-41.4"},EPSG_5340:{towgs84:"-0.41,0.46,-0.35"},EPSG_4246:{towgs84:"-294.7,-200.1,525.5"},EPSG_4318:{towgs84:"-3.2,-5.7,2.8"},EPSG_4121:{towgs84:"-199.87,74.79,246.62"},EPSG_4223:{towgs84:"-260.1,5.5,432.2"},EPSG_4158:{towgs84:"-0.465,372.095,171.736"},EPSG_4285:{towgs84:"-128.16,-282.42,21.93"},EPSG_4613:{towgs84:"-404.78,685.68,45.47"},EPSG_4607:{towgs84:"195.671,332.517,274.607"},EPSG_4475:{towgs84:"-381.788,-57.501,-256.673"},EPSG_4208:{towgs84:"-157.84,308.54,-146.6"},EPSG_4743:{towgs84:"70.995,-335.916,262.898"},EPSG_4710:{towgs84:"-323.65,551.39,-491.22"},EPSG_7881:{towgs84:"-0.077,0.079,0.086"},EPSG_4682:{towgs84:"283.729,735.942,261.143"},EPSG_4739:{towgs84:"-156,-271,-189"},EPSG_4679:{towgs84:"-80.01,253.26,291.19"},EPSG_4750:{towgs84:"-56.263,16.136,-22.856"},EPSG_4644:{towgs84:"-10.18,-350.43,291.37"},EPSG_4695:{towgs84:"-103.746,-9.614,-255.95"},EPSG_4292:{towgs84:"-355,21,72"},EPSG_4302:{towgs84:"-61.702,284.488,472.052"},EPSG_4143:{towgs84:"-124.76,53,466.79"},EPSG_4606:{towgs84:"-153,153,307"},EPSG_4699:{towgs84:"-770.1,158.4,-498.2"},EPSG_4247:{towgs84:"-273.5,110.6,-357.9"},EPSG_4160:{towgs84:"8.88,184.86,106.69"},EPSG_4161:{towgs84:"-233.43,6.65,173.64"},EPSG_9251:{towgs84:"-9.5,122.9,138.2"},EPSG_9253:{towgs84:"-78.1,101.6,133.3"},EPSG_4297:{towgs84:"-198.383,-240.517,-107.909"},EPSG_4269:{towgs84:"0,0,0"},EPSG_4301:{towgs84:"-147,506,687"},EPSG_4618:{towgs84:"-59,-11,-52"},EPSG_4612:{towgs84:"0,0,0"},EPSG_4678:{towgs84:"44.585,-131.212,-39.544"},EPSG_4250:{towgs84:"-130,29,364"},EPSG_4144:{towgs84:"214,804,268"},EPSG_4147:{towgs84:"-17.51,-108.32,-62.39"},EPSG_4259:{towgs84:"-254.1,-5.36,-100.29"},EPSG_4164:{towgs84:"-76,-138,67"},EPSG_4211:{towgs84:"-378.873,676.002,-46.255"},EPSG_4182:{towgs84:"-422.651,-172.995,84.02"},EPSG_4224:{towgs84:"-143.87,243.37,-33.52"},EPSG_4225:{towgs84:"-205.57,168.77,-4.12"},EPSG_5527:{towgs84:"-67.35,3.88,-38.22"},EPSG_4752:{towgs84:"98,390,-22"},EPSG_4310:{towgs84:"-30,190,89"},EPSG_9248:{towgs84:"-192.26,65.72,132.08"},EPSG_4680:{towgs84:"124.5,-63.5,-281"},EPSG_4701:{towgs84:"-79.9,-158,-168.9"},EPSG_4706:{towgs84:"-146.21,112.63,4.05"},EPSG_4805:{towgs84:"682,-203,480"},EPSG_4201:{towgs84:"-165,-11,206"},EPSG_4210:{towgs84:"-157,-2,-299"},EPSG_4183:{towgs84:"-104,167,-38"},EPSG_4139:{towgs84:"11,72,-101"},EPSG_4668:{towgs84:"-86,-98,-119"},EPSG_4717:{towgs84:"-2,151,181"},EPSG_4732:{towgs84:"102,52,-38"},EPSG_4280:{towgs84:"-377,681,-50"},EPSG_4209:{towgs84:"-138,-105,-289"},EPSG_4261:{towgs84:"31,146,47"},EPSG_4658:{towgs84:"-73,46,-86"},EPSG_4721:{towgs84:"265.025,384.929,-194.046"},EPSG_4222:{towgs84:"-136,-108,-292"},EPSG_4601:{towgs84:"-255,-15,71"},EPSG_4602:{towgs84:"725,685,536"},EPSG_4603:{towgs84:"72,213.7,93"},EPSG_4605:{towgs84:"9,183,236"},EPSG_4621:{towgs84:"137,248,-430"},EPSG_4657:{towgs84:"-28,199,5"},EPSG_4316:{towgs84:"103.25,-100.4,-307.19"},EPSG_4642:{towgs84:"-13,-348,292"},EPSG_4698:{towgs84:"145,-187,103"},EPSG_4192:{towgs84:"-206.1,-174.7,-87.7"},EPSG_4311:{towgs84:"-265,120,-358"},EPSG_4135:{towgs84:"58,-283,-182"},ESRI_104138:{towgs84:"198,-226,-347"},EPSG_4245:{towgs84:"-11,851,5"},EPSG_4142:{towgs84:"-125,53,467"},EPSG_4213:{towgs84:"-106,-87,188"},EPSG_4253:{towgs84:"-133,-77,-51"},EPSG_4129:{towgs84:"-132,-110,-335"},EPSG_4713:{towgs84:"-77,-128,142"},EPSG_4239:{towgs84:"217,823,299"},EPSG_4146:{towgs84:"295,736,257"},EPSG_4155:{towgs84:"-83,37,124"},EPSG_4165:{towgs84:"-173,253,27"},EPSG_4672:{towgs84:"175,-38,113"},EPSG_4236:{towgs84:"-637,-549,-203"},EPSG_4251:{towgs84:"-90,40,88"},EPSG_4271:{towgs84:"-2,374,172"},EPSG_4175:{towgs84:"-88,4,101"},EPSG_4716:{towgs84:"298,-304,-375"},EPSG_4315:{towgs84:"-23,259,-9"},EPSG_4744:{towgs84:"-242.2,-144.9,370.3"},EPSG_4244:{towgs84:"-97,787,86"},EPSG_4293:{towgs84:"616,97,-251"},EPSG_4714:{towgs84:"-127,-769,472"},EPSG_4736:{towgs84:"260,12,-147"},EPSG_6883:{towgs84:"-235,-110,393"},EPSG_6894:{towgs84:"-63,176,185"},EPSG_4205:{towgs84:"-43,-163,45"},EPSG_4256:{towgs84:"41,-220,-134"},EPSG_4262:{towgs84:"639,405,60"},EPSG_4604:{towgs84:"174,359,365"},EPSG_4169:{towgs84:"-115,118,426"},EPSG_4620:{towgs84:"-106,-129,165"},EPSG_4184:{towgs84:"-203,141,53"},EPSG_4616:{towgs84:"-289,-124,60"},EPSG_9403:{towgs84:"-307,-92,127"},EPSG_4684:{towgs84:"-133,-321,50"},EPSG_4708:{towgs84:"-491,-22,435"},EPSG_4707:{towgs84:"114,-116,-333"},EPSG_4709:{towgs84:"145,75,-272"},EPSG_4712:{towgs84:"-205,107,53"},EPSG_4711:{towgs84:"124,-234,-25"},EPSG_4718:{towgs84:"230,-199,-752"},EPSG_4719:{towgs84:"211,147,111"},EPSG_4724:{towgs84:"208,-435,-229"},EPSG_4725:{towgs84:"189,-79,-202"},EPSG_4735:{towgs84:"647,1777,-1124"},EPSG_4722:{towgs84:"-794,119,-298"},EPSG_4728:{towgs84:"-307,-92,127"},EPSG_4734:{towgs84:"-632,438,-609"},EPSG_4727:{towgs84:"912,-58,1227"},EPSG_4729:{towgs84:"185,165,42"},EPSG_4730:{towgs84:"170,42,84"},EPSG_4733:{towgs84:"276,-57,149"},ESRI_37218:{towgs84:"230,-199,-752"},ESRI_37240:{towgs84:"-7,215,225"},ESRI_37221:{towgs84:"252,-209,-751"},ESRI_4305:{towgs84:"-123,-206,219"},ESRI_104139:{towgs84:"-73,-247,227"},EPSG_4748:{towgs84:"51,391,-36"},EPSG_4219:{towgs84:"-384,664,-48"},EPSG_4255:{towgs84:"-333,-222,114"},EPSG_4257:{towgs84:"-587.8,519.75,145.76"},EPSG_4646:{towgs84:"-963,510,-359"},EPSG_6881:{towgs84:"-24,-203,268"},EPSG_6882:{towgs84:"-183,-15,273"},EPSG_4715:{towgs84:"-104,-129,239"},IGNF_RGF93GDD:{towgs84:"0,0,0"},IGNF_RGM04GDD:{towgs84:"0,0,0"},IGNF_RGSPM06GDD:{towgs84:"0,0,0"},IGNF_RGTAAF07GDD:{towgs84:"0,0,0"},IGNF_RGFG95GDD:{towgs84:"0,0,0"},IGNF_RGNCG:{towgs84:"0,0,0"},IGNF_RGPFGDD:{towgs84:"0,0,0"},IGNF_ETRS89G:{towgs84:"0,0,0"},IGNF_RGR92GDD:{towgs84:"0,0,0"},EPSG_4173:{towgs84:"0,0,0"},EPSG_4180:{towgs84:"0,0,0"},EPSG_4619:{towgs84:"0,0,0"},EPSG_4667:{towgs84:"0,0,0"},EPSG_4075:{towgs84:"0,0,0"},EPSG_6706:{towgs84:"0,0,0"},EPSG_7798:{towgs84:"0,0,0"},EPSG_4661:{towgs84:"0,0,0"},EPSG_4669:{towgs84:"0,0,0"},EPSG_8685:{towgs84:"0,0,0"},EPSG_4151:{towgs84:"0,0,0"},EPSG_9702:{towgs84:"0,0,0"},EPSG_4758:{towgs84:"0,0,0"},EPSG_4761:{towgs84:"0,0,0"},EPSG_4765:{towgs84:"0,0,0"},EPSG_8997:{towgs84:"0,0,0"},EPSG_4023:{towgs84:"0,0,0"},EPSG_4670:{towgs84:"0,0,0"},EPSG_4694:{towgs84:"0,0,0"},EPSG_4148:{towgs84:"0,0,0"},EPSG_4163:{towgs84:"0,0,0"},EPSG_4167:{towgs84:"0,0,0"},EPSG_4189:{towgs84:"0,0,0"},EPSG_4190:{towgs84:"0,0,0"},EPSG_4176:{towgs84:"0,0,0"},EPSG_4659:{towgs84:"0,0,0"},EPSG_3824:{towgs84:"0,0,0"},EPSG_3889:{towgs84:"0,0,0"},EPSG_4046:{towgs84:"0,0,0"},EPSG_4081:{towgs84:"0,0,0"},EPSG_4558:{towgs84:"0,0,0"},EPSG_4483:{towgs84:"0,0,0"},EPSG_5013:{towgs84:"0,0,0"},EPSG_5264:{towgs84:"0,0,0"},EPSG_5324:{towgs84:"0,0,0"},EPSG_5354:{towgs84:"0,0,0"},EPSG_5371:{towgs84:"0,0,0"},EPSG_5373:{towgs84:"0,0,0"},EPSG_5381:{towgs84:"0,0,0"},EPSG_5393:{towgs84:"0,0,0"},EPSG_5489:{towgs84:"0,0,0"},EPSG_5593:{towgs84:"0,0,0"},EPSG_6135:{towgs84:"0,0,0"},EPSG_6365:{towgs84:"0,0,0"},EPSG_5246:{towgs84:"0,0,0"},EPSG_7886:{towgs84:"0,0,0"},EPSG_8431:{towgs84:"0,0,0"},EPSG_8427:{towgs84:"0,0,0"},EPSG_8699:{towgs84:"0,0,0"},EPSG_8818:{towgs84:"0,0,0"},EPSG_4757:{towgs84:"0,0,0"},EPSG_9140:{towgs84:"0,0,0"},EPSG_8086:{towgs84:"0,0,0"},EPSG_4686:{towgs84:"0,0,0"},EPSG_4737:{towgs84:"0,0,0"},EPSG_4702:{towgs84:"0,0,0"},EPSG_4747:{towgs84:"0,0,0"},EPSG_4749:{towgs84:"0,0,0"},EPSG_4674:{towgs84:"0,0,0"},EPSG_4755:{towgs84:"0,0,0"},EPSG_4759:{towgs84:"0,0,0"},EPSG_4762:{towgs84:"0,0,0"},EPSG_4763:{towgs84:"0,0,0"},EPSG_4764:{towgs84:"0,0,0"},EPSG_4166:{towgs84:"0,0,0"},EPSG_4170:{towgs84:"0,0,0"},EPSG_5546:{towgs84:"0,0,0"},EPSG_7844:{towgs84:"0,0,0"},EPSG_4818:{towgs84:"589,76,480"},EPSG_10328:{towgs84:"0,0,0"},EPSG_9782:{towgs84:"0,0,0"},EPSG_9777:{towgs84:"0,0,0"},EPSG_10690:{towgs84:"0,0,0"},EPSG_10639:{towgs84:"0,0,0"},EPSG_10739:{towgs84:"0,0,0"},EPSG_7686:{towgs84:"0,0,0"},EPSG_8900:{towgs84:"0,0,0"},EPSG_5886:{towgs84:"0,0,0"},EPSG_7683:{towgs84:"0,0,0"},EPSG_6668:{towgs84:"0,0,0"},EPSG_20046:{towgs84:"0,0,0"},EPSG_10299:{towgs84:"0,0,0"},EPSG_10310:{towgs84:"0,0,0"},EPSG_10475:{towgs84:"0,0,0"},EPSG_4742:{towgs84:"0,0,0"},EPSG_10671:{towgs84:"0,0,0"},EPSG_10762:{towgs84:"0,0,0"},EPSG_10725:{towgs84:"0,0,0"},EPSG_10791:{towgs84:"0,0,0"},EPSG_10800:{towgs84:"0,0,0"},EPSG_10305:{towgs84:"0,0,0"},EPSG_10941:{towgs84:"0,0,0"},EPSG_10968:{towgs84:"0,0,0"},EPSG_10875:{towgs84:"0,0,0"},EPSG_6318:{towgs84:"0,0,0"},EPSG_10910:{towgs84:"0,0,0"}};for(let e in pm){let t=pm[e];t.datumName&&(pm[t.datumName]=t)}var oI=pm;var sI=Object.freeze({name:"regional-datums",datums:Object.freeze(oI)});function WO(e){return{...e,parse(t,r){let n=e.parse(t,r),i=n.parameters.datum,o=s=>s.toLowerCase().replace(/[\s_-]/g,"");if(i&&!Object.keys(Xc(r)).some(s=>o(s)===o(i))){let s={...n.parameters};return delete s.datum,{...n,parameters:s}}return n}}}var HO=[By,Ly].map(WO),gm;function $O(){if(gm)return gm;let e=[W1,H1,$1,Y1,K1,J1,jg,Q1,ry,Ug,Gg,Vg,ny,oy,cy,ly,hy,dy,my,py,gy,wy,_y,My,by,xy,Sy,vy,Ey,Ty,Iy,Ay,Py,Ry,Cy],t=i=>i.toLowerCase().replace(/[\s_-]/g,""),r=fm("longlat"),n={name:r.name,aliases:r.aliases,parameters:[...new Set([...r.parameters,...e.flatMap(i=>i.parameters)])],flags:[...new Set(e.flatMap(i=>i.flags||[]))],create(i){let o=i.parameters.o_proj;if(!o)throw new Error("Oblique transformation requires +o_proj");let s=["longlat","latlong","latlon","lonlat","identity"].includes(t(o))?"longlat":e.find(l=>[l.name,...l.aliases||[]].some(h=>t(h)===t(o)));if(!s)throw new Error("Unknown oblique transformation projection: "+o);let a=fm(s),c=new Set([...$d,...a.parameters]);for(let l of Object.keys(i.parameters))if(!c.has(l))throw new Error("Unsupported PROJ parameter: +"+l);return a.create(i)}};return gm=[...e,n],gm}var cs=class extends rm{constructor(t={}){super({...t,projections:t.projections??$O(),parsers:t.parsers??HO,datumCatalogs:t.datumCatalogs??[sI]}),this.useDefinitionSignature=!Wh(t)}},YO=new cs;var aI=new Map,Uy={},Gy={},zy=new cs;function cI(){return zy}function lI(e,t){ky(e,"CRS"),Uy[e]=t,zy=new cs({aliases:Uy,datumGrids:Gy})}function hI(e,t){ky(e,"datum grid"),Gy[e]=Fy(t),zy=new cs({aliases:Uy,datumGrids:Gy})}function Vy(e,t){ky(e,"geoid model"),aI.set(e,t)}function uI(e,t,r={}){let n=Wd(t,r);return Vy(e,n),n}function ym(e){return aI.get(e)}function ky(e,t){if(!e.trim())throw new Error(`${t} name must not be empty`)}var Hn=class{spatialReference;horizontalProjection;horizontalProjectionBuffer;geographicProjection;heightOutputProjection;sourceIsGeocentric;outputIsGeocentric;sourceIsGeographic;outputIsGeographic;geoid;constructor(t,r={}){this.spatialReference=t;let n=cI();ZO(t);let i=t.targetCrs||t.sourceCrs;if(this.sourceIsGeocentric=qy(t.sourceCrs),this.outputIsGeocentric=qy(i),this.sourceIsGeographic=fI(t.sourceCrs),this.outputIsGeographic=fI(i),t.sourceCrs&&t.targetCrs&&!this.sourceIsGeocentric&&!this.outputIsGeocentric&&(this.horizontalProjection=n.createProjection({from:Kh(t.sourceCrs),to:Kh(t.targetCrs),enforceAxis:!1}),cl(t)||(this.horizontalProjectionBuffer=new jd({projection:this.horizontalProjection,dimension:3}))),(cl(t)||this.sourceIsGeocentric||this.outputIsGeocentric)&&(!this.sourceIsGeographic&&!this.sourceIsGeocentric&&(this.geographicProjection=n.createProjection({from:Kh(t.sourceCrs),to:Hc,enforceAxis:!1})),!this.outputIsGeographic&&!this.outputIsGeocentric&&(this.heightOutputProjection=n.createProjection({from:Hc,to:Kh(i),enforceAxis:!1}))),cl(t)&&(this.geoid=JO(r.geoidModel),!this.geoid)){let o=typeof r.geoidModel=="string"?` "${r.geoidModel}"`:"";throw new Error(`Height conversion requires a registered geoid model${o}; call registerGeoidModel() or pass a parsed Geoid instance`)}}transformPosition(t){if(t.length<2)throw new Error("A spatial coordinate must contain at least x and y components");let r=[...t];if(cl(this.spatialReference)||this.sourceIsGeocentric||this.outputIsGeocentric){if(r.length<3||!Number.isFinite(r[2]))throw new Error("Three-dimensional CRS conversion requires a finite z coordinate");let n=this.toGeographic(r);if(cl(this.spatialReference)){let o=this.geoid.getHeight(n[1],n[0]);n[2]=QO(n[2],o,this.spatialReference.heightReference,this.spatialReference.targetHeightReference)}let i=this.fromGeographic(n);return r.splice(0,i.length,...i),r}if(this.horizontalProjection){let n=this.horizontalProjection.projectSync(r.slice(0,3));r.splice(0,n.length,...n)}return r}transformPositions(t){if(t.length%3!==0)throw new Error("Packed spatial positions must contain a multiple of three components");let r=new Float64Array(t.length);if(this.horizontalProjectionBuffer&&(r.set(t),r.every(Number.isFinite)))return this.horizontalProjectionBuffer.projectFlatTo(r,r);for(let n=0;n<t.length;n+=3){let i=this.transformPosition([Number(t[n]),Number(t[n+1]),Number(t[n+2])]);r[n]=i[0],r[n+1]=i[1],r[n+2]=i[2]}return r}transformNormals(t,r){if(t.length!==r.length||t.length%3!==0)throw new Error("Spatial normals and positions must have matching xyz component counts");let n=new Float32Array(t.length),i=1e-5;for(let o=0;o<t.length;o+=3){let s=[Number(r[o]),Number(r[o+1]),Number(r[o+2])],a=[Number(t[o]),Number(t[o+1]),Number(t[o+2])],c=KO(this,s,i),l=XO(c,a),h=Math.hypot(...l);h>0&&Number.isFinite(h)?(n[o]=l[0]/h,n[o+1]=l[1]/h,n[o+2]=l[2]/h):(n[o]=a[0],n[o+1]=a[1],n[o+2]=a[2])}return n}toGeographic(t){return this.sourceIsGeocentric?Array.from(pt.WGS84.cartesianToCartographic(new E(t))):this.sourceIsGeographic?t.slice(0,3):this.geographicProjection.projectSync(t.slice(0,3))}fromGeographic(t){return this.outputIsGeocentric?Array.from(pt.WGS84.cartographicToCartesian(new E(t))):this.outputIsGeographic?t.slice(0,3):this.heightOutputProjection.projectSync(t.slice(0,3))}};function KO(e,t,r){let n=[];for(let i=0;i<3;i++){let o=t.slice(),s=t.slice();o[i]+=r,s[i]-=r;let a=e.transformPosition(o),c=e.transformPosition(s);n.push([(a[0]-c[0])/(2*r),(a[1]-c[1])/(2*r),(a[2]-c[2])/(2*r)])}return n}function XO(e,t){let[r,n,i]=e,o=r[0]*(n[1]*i[2]-n[2]*i[1])-n[0]*(r[1]*i[2]-r[2]*i[1])+i[0]*(r[1]*n[2]-r[2]*n[1]);return!Number.isFinite(o)||Math.abs(o)<1e-15?t:[[n[1]*i[2]-n[2]*i[1],r[2]*i[1]-r[1]*i[2],r[1]*n[2]-r[2]*n[1]],[n[2]*i[0]-n[0]*i[2],r[0]*i[2]-r[2]*i[0],r[2]*n[0]-r[0]*n[2]],[n[0]*i[1]-n[1]*i[0],r[1]*i[0]-r[0]*i[1],r[0]*n[1]-r[1]*n[0]]].map(a=>(a[0]*t[0]+a[1]*t[1]+a[2]*t[2])/o)}function Kh(e){if(!e)throw new Error("Cannot construct a projection because the CRS is unknown");if(typeof e!="string"&&e.type==="CompoundCRS"){let t=e.components.filter(r=>r.type!=="VerticalCRS");if(t.length!==1)throw new Error("CompoundCRS requires exactly one horizontal component");return Kh(t[0])}return e}function ZO(e){if(e.outputCoordinates==="local-enu")throw new Error("local-enu output requires a dataset-derived local origin and must be created by a tileset source");if(e.outputCoordinates==="target-crs"&&!e.targetCrs)throw new Error("target-crs output requires targetCrs");if(!e.sourceCrs&&e.status==="unresolved")throw new Error("Cannot transform coordinates because the source CRS is unknown");if(cl(e)&&e.heightReference==="unknown")throw new Error("Cannot convert heights because the source height reference is unknown");if(e.coordinateFrame==="geocentric"&&!qy(e.sourceCrs))throw new Error("Only EPSG:4978 geocentric coordinates are supported by the current spatial transformer");if(e.status==="unresolved")throw new Error("The requested spatial output cannot be resolved from the available metadata")}function qy(e){return typeof e=="string"&&Dh(e)===Pd}function fI(e){if(typeof e!="string")return!1;let t=Dh(e);return t===Hc||t==="EPSG:4979"||t==="OGC:CRS84"}function cl(e){let t=e.targetHeightReference;return t!=="native"&&t!==e.heightReference}function JO(e){return typeof e=="string"?ym(e):e}function QO(e,t,r,n){if(r===n||n==="native")return e;if(r==="orthometric"&&n==="ellipsoidal")return e+t;if(r==="ellipsoidal"&&n==="orthometric")return e-t;throw new Error(`Unsupported height conversion from ${r} to ${n}`)}jt();var ls=class{spatialReference;coordinateTransformer;geographicCoordinateTransformer;constructor(t,r={}){this.coordinateTransformer=new Hn(t,r);let n={...t,sourceCrs:"EPSG:4326",targetCrs:t.targetCrs||t.sourceCrs,coordinateFrame:"geographic",axisOrder:"xy"};this.geographicCoordinateTransformer=new Hn(n,r),this.spatialReference=t}transformPositions(t){return this.coordinateTransformer.transformPositions(t)}transformNormals(t,r){return this.coordinateTransformer.transformNormals(t,r)}transformBoundingVolume(t,r){let n=r?new bt(Array.from(r)):void 0,i=t.region?tB(t.region):eB(t).map(s=>n?Array.from(n.transformAsPoint(s)):s);if(!i.length)return t;let o=t.region?i.map(s=>this.transformRegionSample(s)):i.map(s=>this.coordinateTransformer.transformPosition(s));return{box:rB(o)}}transformRegionSample(t){return this.geographicCoordinateTransformer.transformPosition(t)}};function tB(e){if(e.length<6||e.some(u=>!Number.isFinite(u)))return[];let[t,r,n,i,o,s]=e,a=n<t?n+Math.PI*2:n,c=dI(t,a),l=dI(r,i),h=[];for(let u of c)for(let f of l)for(let d of[o,s])h.push([u*180/Math.PI,f*180/Math.PI,d]);return h}function dI(e,t){let r=[e,(e+t)/2,t],n=Math.PI/2,i=Math.ceil(e/n),o=Math.floor(t/n);for(let s=i;s<=o;s++)r.push(s*n);return r}function eB(e){if(e.box&&e.box.length>=12){let t=e.box.slice(0,3),r=[e.box.slice(3,6),e.box.slice(6,9),e.box.slice(9,12)],n=[];for(let i=0;i<=4;i++)for(let o=0;o<=4;o++)for(let s=0;s<=4;s++){let a=i/2-1,c=o/2-1,l=s/2-1;n.push([t[0]+a*r[0][0]+c*r[1][0]+l*r[2][0],t[1]+a*r[0][1]+c*r[1][1]+l*r[2][1],t[2]+a*r[0][2]+c*r[1][2]+l*r[2][2]])}return n}if(e.sphere&&e.sphere.length>=4){let[t,r,n,i]=e.sphere,o=[[t-i,r,n],[t+i,r,n],[t,r-i,n],[t,r+i,n],[t,r,n-i],[t,r,n+i]];for(let s=0;s<16;s++){let a=s*Math.PI*2/16;o.push([t+i*Math.cos(a),r+i*Math.sin(a),n])}return o}return[]}function rB(e){let t=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(let o of e)for(let s=0;s<3;s++)t[s]=Math.min(t[s],o[s]),r[s]=Math.max(r[s],o[s]);let n=[Math.max((r[0]-t[0])*.01,1e-9),Math.max((r[1]-t[1])*.01,1e-9),Math.max((r[2]-t[2])*.01,1e-9)];return[...[(t[0]+r[0])/2,(t[1]+r[1])/2,(t[2]+r[2])/2],(r[0]-t[0])/2+n[0],0,0,0,(r[1]-t[1])/2+n[1],0,0,0,(r[2]-t[2])/2+n[2]]}function mI(e,t){let r=e.map(([c,l])=>[c,l]);if(r.length===0)return r;let n=1/0,i=-1/0;for(let[c]of e)n=Math.min(n,c),i=Math.max(i,c);if(i-n>=360)return r;let o=t??r[0][0];for(let c of r){let l=c[0]-o;l>180?c[0]-=360*Math.ceil((l-180)/360):l<-180&&(c[0]+=360*Math.ceil((-l-180)/360)),o=c[0]}let s=e[0],a=e[e.length-1];if(s[0]===a[0]&&s[1]===a[1]){if(Math.abs(r[r.length-1][0]-r[0][0])>180)return e.map(([c,l])=>[c,l]);r[r.length-1]=[...r[0]]}return r}function nB(e){let t=1/0,r=1/0,n=-1/0,i=-1/0;for(let[o,s]of e)t=Math.min(t,o),r=Math.min(r,s),n=Math.max(n,o),i=Math.max(i,s);return[[t,r],[n,i]]}function pI(e){let t=(r,n)=>{let i=e.cellToBoundary(r);return n?.unwrap?mI(i,n.referenceLongitude):i};return{...e,cellToBoundary:t,cellToBoundaryFlat:(r,n)=>n?.unwrap?t(r,n).flat():e.cellToBoundaryFlat(r),cellToBounds:(r,n)=>{let i=e.cellToBounds(r);if(!n?.unwrap||i[1][0]-i[0][0]>=360)return i;let o=nB(t(r,n));return o[0][1]=i[0][1],o[1][1]=i[1][1],o}}}var iB=(1n<<64n)-1n,oB=0x1555555555555555n;function ll(e){if(e==="X")return 0n;if(!gI(e))throw new Error(`Invalid S2 token: ${e}`);let t=e.padEnd(16,"0");return BigInt(`0x${t}`)}function Xh(e){if(e===0n)return"X";if(!hl(e))throw new Error(`Invalid S2 index: ${e}`);let t=sB(e),r=t%4;t=(t-r)/4;let n=t;t*=4;let o=(e>>BigInt(t)).toString(16).replace(/0+$/,"");return Array(17-n-o.length).join("0")+o}function hl(e){if(typeof e!="bigint"||e<=0n||e>iB)return!1;let t=e>>61n,r=e&-e;return t<6n&&(r&oB)!==0n}function gI(e){if(typeof e!="string"||!/^[0-9a-fA-F]{1,16}$/.test(e)||e.endsWith("0"))return!1;let t=e.padEnd(16,"0");return hl(BigInt(`0x${t}`))}function sB(e){let t=0;for(;e%2n===0n;)e/=2n,t++;return t}function ul(e){if(!hl(e))throw new Error(`Invalid S2 index: ${e}`);let t=uB(e);return hB(t)}var aB=3,jy=30,cB=2*jy+1,yI=180/Math.PI,lB={a:[[0,"d"],[1,"a"],[3,"b"],[2,"a"]],b:[[2,"b"],[1,"b"],[3,"a"],[0,"c"]],c:[[2,"c"],[3,"d"],[1,"c"],[0,"b"]],d:[[0,"a"],[3,"c"],[1,"d"],[2,"d"]]};function hB(e){if(!/^[0-5]\/[0-3]{0,30}$/.test(e))throw new Error(`Invalid S2 Hilbert quadkey: ${e}`);let t=e.split("/"),r=parseInt(t[0],10),n=t[1]||"",i=n.length,o=0,s=[0,0];for(let a=i-1;a>=0;a--){o=i-a;let c=n[a],l=0,h=0;c==="1"?h=1:c==="2"?(l=1,h=1):c==="3"&&(l=1);let u=Math.pow(2,o-1);fB(u,s,l,h),s[0]+=u*l,s[1]+=u*h}if(r%2===1){let a=s[0];s[0]=s[1],s[1]=a}return{face:r,ij:s,level:o}}function uB(e){if(!hl(e))throw new Error(`Invalid S2 index: ${e}`);let t=e.toString(2);for(;t.length<aB+cB;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),i=t.substring(3,r),o=i.length/2,s=BigInt(`0b${n}`).toString(10),a="";if(o!==0)for(a=BigInt(`0b${i}`).toString(4);a.length<o;)a="0"+a;return`${s}/${a}`}function _I(e){let{face:t,ij:r,level:n}=e;if(!Number.isInteger(t)||t<0||t>5)throw new Error(`Invalid S2 face: ${t}`);if(!Number.isInteger(n)||n<0||n>jy)throw new Error(`Invalid S2 level: ${n}`);let i=2**n;if(!Number.isInteger(r[0])||!Number.isInteger(r[1])||r[0]<0||r[1]<0||r[0]>=i||r[1]>=i)throw new Error(`Invalid S2 IJ coordinates: ${r[0]}, ${r[1]}`);let o=dB(r[0],r[1],n,t),s=BigInt(t)<<61n;for(let a=0;a<o.length;a++){let c=59-a*2;s|=BigInt(o[a])<<BigInt(c)}return s|=1n<<BigInt(60-n*2),s}function Wy(e,t,r,n){let i=ul(e);if(!Number.isInteger(t)||t<0||i.level+t>jy)throw new Error(`Invalid S2 relative level: ${t}`);let o=2**t;if(!Number.isInteger(r)||!Number.isInteger(n)||r<0||n<0||r>=o||n>=o)throw new Error(`Invalid S2 descendant coordinates: ${r}, ${n}`);return _I({face:i.face,ij:[i.ij[0]*o+r,i.ij[1]*o+n],level:i.level+t})}function Zh(e,t,r){let n=1<<t;return[(e[0]+r[0])/n,(e[1]+r[1])/n]}function wI(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function Jh(e){return[wI(e[0]),wI(e[1])]}function Qh(e,[t,r]){switch(e){case 0:return[1,t,r];case 1:return[-t,1,r];case 2:return[-t,-r,1];case 3:return[-1,-r,-t];case 4:return[r,-1,-t];case 5:return[r,t,-1];default:throw new Error("Invalid face")}}function tu([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*yI,n*yI]}function fB(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let i=t[0];t[0]=t[1],t[1]=i}}function dB(e,t,r,n){let i=n%2===1?"d":"a",o=[];for(let s=r-1;s>=0;s--){let a=1<<s,c=(e&a)!==0?1:0,l=(t&a)!==0?1:0,[h,u]=lB[i][c*2+l];o.push(h),i=u}return o}var mB=100;function MI(e){let t=ul(e);return pB(t)}function pB({face:e,ij:t,level:r}){let n=[[0,0],[0,1],[1,1],[1,0],[0,0]],i=Math.max(1,Math.ceil(mB*Math.pow(2,-r))),o=new Float64Array(4*i*2+2),s=0,a=0;for(let c=0;c<4;c++){let l=n[c].slice(0),h=n[c+1],u=(h[0]-l[0])/i,f=(h[1]-l[1])/i;for(let d=0;d<i;d++){l[0]+=u,l[1]+=f;let m=Zh(t,r,l),p=Jh(m),g=Qh(e,p),y=tu(g);Math.abs(y[1])>89.999&&(y[0]=a);let _=y[0]-a;y[0]+=_>180?-360:_<-180?360:0,o[s++]=y[0],o[s++]=y[1],a=y[0]}}return o[s++]=o[0],o[s++]=o[1],o}var gB=pI({name:"s2",hasNumericRepresentation:!0,cellColumnNames:["s2","s2Token","s2_token","s2Cell","s2_cell","s2CellId","s2_cell_id"],tokenToCell:e=>ll(e),cellToToken:e=>Xh(_m(e)),cellToLngLat:e=>bI(e),cellToBoundary:e=>yB(e),cellToBoundaryFlat:e=>Hy(e),cellToBounds:e=>wm(e)});function bI(e){let t=_m(e),r=ul(t),n=Zh(r.ij,r.level,[.5,.5]),i=Jh(n),o=Qh(r.face,i);return tu(o)}function Hy(e){let t=_m(e),r=MI(t);return Array.from(r)}function yB(e){let t=Hy(e),r=[];for(let n=0;n<t.length;n+=2)r.push([t[n],t[n+1]]);return r}function wm(e){let t=ul(_m(e));if(t.level===0)return wB(t.face);let r=[[0,0],[0,1],[1,1],[1,0]],n=1/0,i=1/0,o=-1/0,s=-1/0,a;for(let l of r){let h=Zh(t.ij,t.level,l),u=Jh(h),[f,d,m]=Qh(t.face,u),[p,g]=tu([f,d,m]);if(f===0&&d===0&&a!==void 0&&(p=a),a!==void 0){let y=p-a;p+=y>180?-360:y<-180?360:0}a=p,n=Math.min(n,p),i=Math.min(i,g),o=Math.max(o,p),s=Math.max(s,g)}let c=2*Number.EPSILON*180/Math.PI;return[[n-c,Math.max(-90,i-c)],[o+c,Math.min(90,s+c)]]}function _m(e){return typeof e=="bigint"?e:ll(e)}function wB(e){let t=Math.asin(Math.sqrt(.3333333333333333))*180/Math.PI;switch(e){case 0:return[[-45,-45],[45,45]];case 1:return[[45,-45],[135,45]];case 2:return[[-180,t],[180,90]];case 3:return[[135,-45],[225,45]];case 4:return[[-135,-45],[-45,45]];case 5:return[[-180,-90],[180,-t]];default:throw new Error(`Invalid S2 face: ${e}`)}}Dr();function Mm(e){let[[t,r],[n,i]]=wm(e.token),o=uh([t,r,n,i,e.minimumHeight,e.maximumHeight],pt.WGS84,{units:"degrees"});return[...o.center,...o.halfAxes]}var _B=4,MB=8,xI=new WeakMap;function Yy(e,t){return{coordinates:t,subtreeUrl:ru(e.subtreesUrlTemplate,t),descriptor:e,resource:RI(e.resourceFiles,ru(e.subtreesUrlTemplate,t))}}function bm(e,t){let{descriptor:r}=t;AB(r),bB(e,r);let n={tileCount:0,childSubtreeCount:0},i=PI(e,t,{localLevel:0,mortonIndex:0},t.coordinates,n);if(!i)throw new Error(`Invalid 3D Tiles subtree: root tile is unavailable at ${t.subtreeUrl}`);return{root:i,...n}}function bB(e,t){let r=BI(t.subdivisionScheme),n=(r**t.subtreeLevels-1)/(r-1),i=r**t.subtreeLevels;$y(e.tileAvailability,n,"tile");let o=Array.isArray(e.contentAvailability)?e.contentAvailability:e.contentAvailability?[e.contentAvailability]:[];for(let c of o)$y(c,n,"content");$y(e.childSubtreeAvailability,i,"child subtree");let s=SI(e.tileAvailability,n),a=o[0]?SI(o[0],n):0;if(vI(e.tileAttributes,s,"tile"),vI(e.contentAttributes,a,"content"),e.tilePropertyRows&&e.tilePropertyRows.length!==s)throw new Error("3DTILES_subtree: tile property-table count does not match availability");if(e.contentPropertyRows&&e.contentPropertyRows.length!==a)throw new Error("3DTILES_subtree: content property-table count does not match availability")}function $y(e,t,r){if(!(e.constant===0||e.constant===1)&&(!e.explicitBitstream||e.explicitBitstream.byteLength*8<t))throw new Error(`3DTILES_subtree: ${r} availability bitstream is too short`)}function SI(e,t){if(e.constant===1)return t;if(e.constant===0)return 0;let r=0;for(let n=0;n<t;n++)fl(e,n)&&r++;return r}function vI(e,t,r){let n={TILE_BOUNDING_BOX:16,TILE_BOUNDING_SPHERE:4,TILE_GEOMETRIC_ERROR:1,TILE_REFINE:1,TILE_TRANSFORM:16,CONTENT_BOUNDING_BOX:16,CONTENT_BOUNDING_SPHERE:4};for(let[i,o]of Object.entries(e||{})){let s=n[i];if(s&&o.length!==t*s)throw new Error(`3DTILES_subtree: ${r} attribute ${i} count does not match availability`)}}function ru(e,t,r={}){let n={level:t.level,x:t.x,y:t.y,z:t.z,...r};return e.replace(/{([^{}]+)}/g,(i,o)=>{let s=Object.hasOwn(n,o)?n[o]:n[o.toLowerCase()];return s===void 0?i:String(s)})}function PI(e,t,r,n,i){let{descriptor:o}=t,s=BI(o.subdivisionScheme),a=EB(s,r.localLevel)+r.mortonIndex;if(!fl(e.tileAvailability,a))return null;i.tileCount++;let c=vB(e.contentAvailability,a),l=[];if(n.level<o.maximumLevel)if(r.localLevel+1<o.subtreeLevels)for(let h=0;h<s;h++){let u=II(n,h,o.subdivisionScheme),f=PI(e,t,{localLevel:r.localLevel+1,mortonIndex:r.mortonIndex*s+h},u,i);f&&l.push(f)}else for(let h=0;h<s;h++){let u=r.mortonIndex*s+h;if(fl(e.childSubtreeAvailability,u)){let f=II(n,h,o.subdivisionScheme);l.push(xB(e,o,f)),i.childSubtreeCount++}}return SB(e,o,t,n,a,c,l)}function xB(e,t,r){let n=CI(t.resourceFiles,e.resourceFiles),i=n?{...t,resourceFiles:n}:t,o=Yy(i,r);return{id:OI(o,r),children:[],implicitSubtree:o,boundingVolume:LI(t.rootBoundingVolume,r,t.subdivisionScheme),geometricError:t.rootLodMetricValue/2**r.level,lodMetricType:t.lodMetricType,lodMetricValue:t.rootLodMetricValue/2**r.level,refine:t.refine,type:Oi.EMPTY,implicitMetadata:NI(e),_scaleGeometricError:t.scaleGeometricError!==!1}}function EI(e,t,r){if(!e||t<0)return{};let n=eu(e[r==="tile"?"TILE_BOUNDING_BOX":"CONTENT_BOUNDING_BOX"],t,16),i=eu(e[r==="tile"?"TILE_BOUNDING_SPHERE":"CONTENT_BOUNDING_SPHERE"],t,4),o=n?{box:[n[12],n[13],n[14],n[0]/2,n[1]/2,n[2]/2,n[4]/2,n[5]/2,n[6]/2,n[8]/2,n[9]/2,n[10]/2]}:i?{sphere:i}:void 0;if(r==="content")return{boundingVolume:o};let s=eu(e.TILE_GEOMETRIC_ERROR,t,1)?.[0];if(s!==void 0&&(!Number.isFinite(s)||s<0))throw new Error("3DTILES_subtree: TILE_GEOMETRIC_ERROR must be nonnegative");let a=eu(e.TILE_REFINE,t,1)?.[0];if(a!==void 0&&a!==0&&a!==1)throw new Error("3DTILES_subtree: TILE_REFINE must be 0 or 1");return{boundingVolume:o,geometricError:s,refine:a===void 0?void 0:a===0?Ge.ADD:Ge.REPLACE,transform:eu(e.TILE_TRANSFORM,t,16)}}function eu(e,t,r){if(!e)return;let n=t*r;if(n+r>e.length)throw new Error("3DTILES_subtree: attribute accessor is shorter than availability");return Array.from({length:r},(i,o)=>Number(e[n+o]))}function TI(e,t){if(e.constant===1)return t;if(e.constant===0)return 0;let r=xI.get(e);if(!r){let n=(e.explicitBitstream?.byteLength||0)*8;r=new Uint32Array(n+1);for(let i=0;i<n;i++)r[i+1]=r[i]+Number(fl(e,i));xI.set(e,r)}return r[t]}function RI(e,t){if(!e?.length)return;let r=t.split("?")[0],n=/^gltf-package:\/\/[^/]+\/(.*)$/.exec(r)?.[1],i=e.findIndex(s=>{let a=s.originalUri||s.name;return s.uri===r||!!(a&&(r===a||n===a))});if(i>=0)return{fileIndex:i,files:e};let o=e.findIndex(s=>{let a=s.originalUri||s.name;return!!(a&&(r.endsWith(`/${a}`)||r.endsWith(`:${a}`)))});return o<0?void 0:{fileIndex:o,files:e}}function CI(e,t){if(!t?.length)return e;if(!e?.length)return t;let r=new Set(t.flatMap(n=>[n.uri,n.originalUri,n.name].filter(Boolean)));return[...t,...e.filter(n=>![n.uri,n.originalUri,n.name].some(i=>i&&r.has(i)))]}function SB(e,t,r,n,i,o,s){let a=TI(e.tileAvailability,i),c=e.tilePropertyRows?.[a],l=Array.isArray(e.contentAvailability)?e.contentAvailability[0]:e.contentAvailability,h=l&&fl(l,i)?TI(l,i):-1,u=e.contentPropertyRows?.[h],f=e.tileTemplatePropertyRows?.[a]||c,d=e.contentTemplatePropertyRows?.[h]||u,m={...f,...d},p=EI(e.tileAttributes,a,"tile"),g=EI(e.contentAttributes,h,"content"),_=(t.contentUrlTemplates?.length?t.contentUrlTemplates:[t.contentUrlTemplate]).map((B,C)=>{if(!o[C]||!B)return null;let R=ru(B,n,m);if(/{[^{}]+}/.test(R))throw new Error(`Implicit content URI has unresolved template values: ${R}`);return{contentIndex:C,contentUrl:R}}).filter(B=>!!B),b=_.map(B=>B.contentUrl),M=CI(t.resourceFiles,e.resourceFiles),T=_.map(({contentIndex:B,contentUrl:C})=>{let R=RI(M,C);return{...t.contentHeaders?.[B]||(B===0?t.contentHeader:{})||{},...g,uri:C,...u?{metadata:{properties:u}}:{},...R?{_resource:R}:{}}}),A=b[0],S=t.rootLodMetricValue/2**n.level,v=p.geometricError??S,N=LI(t.rootBoundingVolume,n,t.subdivisionScheme);return{id:OI(r,n),children:s,contentUrl:A,content:T.length>1?T:T[0],contents:t.useCanonicalContents&&T.length?T:void 0,contentUrls:b,refine:p.refine||t.refine,type:IB(A),lodMetricType:t.lodMetricType,lodMetricValue:v,geometricError:v,boundingVolume:p.boundingVolume||N,transform:p.transform,transformMatrix:p.transform,metadata:c?{properties:c}:void 0,implicitMetadata:NI(e,c,u),_scaleGeometricError:t.scaleGeometricError!==!1}}function NI(e,t,r){if(!(!e.propertyTables&&e.tileMetadata===void 0&&!e.contentMetadata&&e.subtreeMetadata===void 0&&!t&&!r))return{propertyTables:e.propertyTables,tileMetadata:e.tileMetadata,contentMetadata:e.contentMetadata,subtreeMetadata:e.subtreeMetadata,tileProperties:t,contentProperties:r}}function OI(e,t){return`${e.subtreeUrl}#implicit=${t.level}/${t.x}/${t.y}/${t.z}`}function fl(e,t){if(typeof e?.constant=="number")return!!e.constant;let r=e?.explicitBitstream;if(!r)return!1;let n=Math.floor(t/8),i=t%8;return!!(r[n]>>i&1)}function vB(e,t){return(Array.isArray(e)?e:[e]).map(n=>fl(n||{constant:0},t))}function EB(e,t){return(e**t-1)/(e-1)}function II(e,t,r){return{level:e.level+1,x:e.x*2+(t&1),y:e.y*2+(t>>1&1),z:r==="OCTREE"?e.z*2+(t>>2&1):0}}function BI(e){return e==="OCTREE"?MB:_B}function LI(e,t,r){if(e.region){let[n,i,o,s,a,c]=e.region,l=2**t.level,u=(o>=n?o-n:o+2*Math.PI-n)/l,f=(s-i)/l,d=AI(n+u*t.x),m=AI(n+u*(t.x+1)),p=i+f*t.y,g=a,y=c;if(r==="OCTREE"){let _=(c-a)/l;g=a+_*t.z,y=g+_}return{region:[d,p,m,p+f,g,y]}}if(e.box){if(e.s2VolumeInfo)return TB(e,t,r);if(e.extensions?.["3DTILES_shape_cylinder_region"])return{...e,box:[...e.box]};let n=e.box,i=2**t.level,o=-1+(2*t.x+1)/i,s=-1+(2*t.y+1)/i,a=-1+(2*t.z+1)/i,c=r==="OCTREE";return{box:[...[n[0]+n[3]*o+n[6]*s+(c?n[9]*a:0),n[1]+n[4]*o+n[7]*s+(c?n[10]*a:0),n[2]+n[5]*o+n[8]*s+(c?n[11]*a:0)],n[3]/i,n[4]/i,n[5]/i,n[6]/i,n[7]/i,n[8]/i,c?n[9]/i:n[9],c?n[10]/i:n[10],c?n[11]/i:n[11]]}}throw new Error(`Unsupported implicit 3D Tiles bounding volume: ${JSON.stringify(e)}`)}function TB(e,t,r){let n=e.s2VolumeInfo,i=ll(n.token),o=Wy(i,t.level,t.x,t.y),s=2**t.level,a=(n.maximumHeight-n.minimumHeight)/s,c={token:Xh(o),minimumHeight:n.minimumHeight+(r==="OCTREE"?a*t.z:0),maximumHeight:n.minimumHeight+(r==="OCTREE"?a*(t.z+1):a*s)},l=e.extensions?{...e.extensions}:void 0;return l?.["3DTILES_bounding_volume_S2"]&&(l["3DTILES_bounding_volume_S2"]=c),l?.["3DTILES_shape_s2"]&&(l["3DTILES_shape_s2"]=c),{...e,...l?{extensions:l}:{},s2VolumeInfo:c,box:Mm(c)}}function AI(e){let t=e;for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function IB(e){if(!e)return Oi.EMPTY;let t=e.split("?")[0].split(".").pop()?.toLowerCase();switch(t){case"pnts":return Oi.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return Oi.SCENEGRAPH;default:return t||Oi.EMPTY}}function AB(e){if(e.subdivisionScheme!=="QUADTREE"&&e.subdivisionScheme!=="OCTREE")throw new Error(`Unsupported implicit subdivision scheme: ${e.subdivisionScheme}`);if(!Number.isInteger(e.subtreeLevels)||e.subtreeLevels<1)throw new Error("Implicit subtreeLevels must be a positive integer");if(!Number.isInteger(e.maximumLevel)||e.maximumLevel<0)throw new Error("Implicit availableLevels must describe at least the root level")}var PB={draco:!1,meshopt:!1,dds:!1,ktx2:!1},RB=32,xm=class{type=nr.TILES3D;loader;url;basePath;tileset=null;loadOptions;coreApi;contentFormats={...PB};asset;properties;extras;credits;metadata;queryParams={};tileUrlCache=new Map;tileContentHeaders=new WeakMap;nestedTilesetRoots=new WeakMap;packageNamespaces=new WeakMap;nextPackageNamespace=0;implicitSubtreeCache;implicitTilingStats={requestedSubtrees:0,loadedSubtrees:0,cacheHits:0,materializedTiles:0};destroyed=!1;extensionsUsed=[];resolver;rootTileset;spatialTransformer;preparedRootHeader;constructor(t,r={}){let n=CB(t);this.rootTileset=FI(t)?null:t,this.tileset=this.rootTileset,this.loader=n.loader,this.url=n.url,this.basePath=n.basePath||wn.dirname(n.url),this.resolver=n.resolver,this.coreApi=n.coreApi,this.loadOptions=r;let i=Number(r["3d-tiles"]?.maximumCachedSubtrees),o=Number.isFinite(i)?Math.max(0,Math.floor(i)):RB;this.implicitSubtreeCache=new Ph({maxEntries:o})}destroy(){this.destroyed=!0,this.tileUrlCache.clear(),this.implicitSubtreeCache.clear()}async initialize(){if(!this.rootTileset){let t=this.loadOptions[this.loader.id]||{};this.rootTileset=await this.loadRootData(this.url,{...this.loadOptions,[this.loader.id]:{...t,isTileset:!0}})}if(this.tileset=this.rootTileset,this.rootTileset.queryString){let t=new URLSearchParams(this.rootTileset.queryString);for(let[r,n]of t.entries())this.setQueryParameter(r,n)}if(this.asset=this.rootTileset.asset,!this.asset)throw new Error("Tileset must have an asset property.");if(this.rootTileset.formatVersion!=="2.0-draft"&&this.asset.version!=="0.0"&&this.asset.version!=="1.0"&&this.asset.version!=="1.1")throw new Error("The tileset must be 3D Tiles version 0.0, 1.0, 1.1, or 2.0-draft.");"tilesetVersion"in this.asset&&this.setQueryParameter("v",this.asset.tilesetVersion),this.properties=this.rootTileset.properties,this.extras=this.rootTileset.extras,this.credits={attributions:[]},this.extensionsUsed.splice(0,this.extensionsUsed.length,...this.rootTileset.extensionsUsed||[]),this.metadata={type:this.type,loader:this.loader,url:this.url,basePath:this.basePath,tileset:this.rootTileset,lodMetricType:this.rootTileset.lodMetricType,lodMetricValue:this.rootTileset.lodMetricValue,refine:this.rootTileset.root?.refine,spatialReference:kd(this.rootTileset)}}getMetadata(){if(!this.metadata)throw new Error("Tiles3DSource has not been initialized");return this.metadata}async getRootTileset(){return this.getMetadata().tileset}async prepareTileset(t){let r=t.spatialReference;if(r.status==="unresolved")throw new Error(r.warnings[0]||"3D Tiles spatial operations cannot be resolved from the supplied metadata and options");r.status!=="transformable"&&r.status!=="transformed"||(this.spatialTransformer||=new ls(r,t.options.spatial),t.spatialReference=$c(r),this.preparedRootHeader=this.transformTileHeader(this.getMetadata().tileset.root,new bt))}initializeTileHeaders(t,r,n){let i=n?r.root:this.preparedRootHeader||r.root,o=new bn(t,i,n||void 0);n&&(n.children.push(o),o.depth=n.depth+1);let s=[o];for(;s.length>0;){let a=s.pop();t.stats.get("Tiles In Tileset(s)").incrementCount();let c=a.header.children||[];for(let l of c){let h=new bn(t,l,a);if(h.contentUrl?.includes("?session=")){let f=new URL(h.contentUrl).searchParams.get("session");f&&this.setQueryParameter("session",f)}a.children.push(h),h.depth=a.depth+1,s.push(h)}}return o}createTraverser(t){return new zd(t)}async loadTileContent(t){let r=(t.contentUrls||[t.contentUrl]).filter(Boolean),n=this.tileContentHeaders.get(t),i=n||(Array.isArray(t.header?.content)?t.header.content:t.header?.content?[t.header.content]:[]);n||this.tileContentHeaders.set(t,i);let o=this.loadOptions[this.loader.id]||{},s={...this.loadOptions,[this.loader.id]:{...o,isTileset:"auto",assetGltfUpAxis:this.asset&&this.asset.gltfUpAxis||"Y",_tilesetOptions:{spatialReference:t.header?._spatialReference||t.tileset?.spatialReference,spatialOptions:t.tileset?.options.spatial,spatialTransform:t.header?._spatialTransform}}},a=await Promise.all(r.map((l,h)=>{let u=i[h]||{},f=u.extensions?.["3DTILES_content_gltf_vector"],d=u._vectorContent||(f?.vector===!0?{clip:f.clip===!0}:void 0),m=d?{...s,[this.loader.id]:{...s[this.loader.id],vectorContent:d}}:s;return this.loadContentResource(this.getTileUrl(l),u._resource,m)}));t.contents=a,t.content=a[0]||null;let c=a.filter(l=>l?.shape==="tileset3d");return{loaded:!0,contents:a,nestedTileset:c[0],nestedTilesets:c}}transformTileHeader(t,r=new bt){return this.spatialTransformer?this.transformTileHeaderWithTransformer(t,this.spatialTransformer,r):t}transformTileHeaderWithTransformer(t,r,n,i){let o=t.transform?new bt(t.transform):new bt,s=new bt(n).multiplyRight(o),a=Array.isArray(t.content)?t.content.map(c=>this.transformContentHeader(c,s,r)):t.content?this.transformContentHeader(t.content,s,r):t.content;return{...t,transform:void 0,boundingVolume:t.boundingVolume?r.transformBoundingVolume(t.boundingVolume,s):t.boundingVolume,_spatialReference:i,_spatialTransform:s.toArray(),content:a,children:Array.isArray(t.children)?t.children.map(c=>this.transformTileHeaderWithTransformer(c,r,s,i)):t.children}}transformContentHeader(t,r,n){return{...t,boundingVolume:t.boundingVolume?n.transformBoundingVolume(t.boundingVolume,r):t.boundingVolume}}async loadTileChildren(t,r){let n=t.header.implicitSubtree;if(!n)return{loaded:!1,tileCount:0,childSubtreeCount:0};let i=this.getTileUrl(n.subtreeUrl),o=await this.loadImplicitSubtreeResource(i,n.resource);if(this.destroyed||t.isDestroyed())return{loaded:!1,tileCount:0,childSubtreeCount:0};let s=bm(o,{...n,subtreeUrl:i}),a=t.header._spatialReference,c=a?new ls(a,t.tileset.options.spatial):this.spatialTransformer,l=c?this.transformTileHeaderWithTransformer(s.root,c,new bt,a):s.root;t.applyImplicitSubtreeHeader(l);let h=this.initializeMaterializedChildren(t.tileset,t,l.children);return this.implicitTilingStats.loadedSubtrees++,this.implicitTilingStats.materializedTiles+=h,{loaded:!0,tileCount:s.tileCount,childSubtreeCount:s.childSubtreeCount}}async loadTileChildrenForTraversal(t,r){DI(r);let n=await this.loadTileChildren(t,{});return DI(r),n}getImplicitTilingStats(){return{...this.implicitTilingStats,cachedSubtrees:this.implicitSubtreeCache.size-this.implicitSubtreeCache.pendingSize,pendingSubtrees:this.implicitSubtreeCache.pendingSize}}getTileUrl(t){if(t.startsWith("data:"))return t;let r=this.tileUrlCache.get(t);if(r)return r;if(!Object.keys(this.queryParams).length)return this.tileUrlCache.set(t,t),t;let[n,i=""]=t.split("?"),o=new URLSearchParams(i);for(let[c,l]of Object.entries(this.queryParams))o.has(c)||o.set(c,l);let s=o.toString(),a=s?`${n}?${s}`:n;return this.tileUrlCache.set(t,a),a}setQueryParameter(t,r){this.queryParams[t]!==r&&(this.queryParams[t]=r,this.tileUrlCache.clear())}getViewState(t){if(!t)return{asset:this.asset,properties:this.properties,extras:this.extras,credits:this.credits};let{center:r}=t.boundingVolume,n;return r&&(r[0]!==0||r[1]!==0||r[2]!==0)?(n=new E,pt.WGS84.cartesianToCartographic(r,n)):n=new E(0,0,-pt.WGS84.radii[0]),{asset:this.asset,properties:this.properties,extras:this.extras,credits:this.credits,boundingVolume:t.boundingVolume,cartographicCenter:n,cartesianCenter:r,zoom:mv(t.boundingVolume,n)}}hasExtension(t){return this.extensionsUsed.includes(t)}onTileLoaded(t,r,n){let o=(r.contents.length?r.contents:[r.content]).flatMap(c=>c?.gltf?.json.extensionsRemoved||[]);o.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),o.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),o.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0);let s=n.nestedTilesets||(n.nestedTileset?[n.nestedTileset]:[]),a=this.nestedTilesetRoots.get(r)||[];for(let[c,l]of s.entries()){let h=a[c];if(h&&r.children.includes(h))continue;let u=a.slice(c+1).find(d=>r.children.includes(d)),f=t._initializeTileHeaders(this.prepareNestedTileset(t,l),r);u&&(r.children.splice(r.children.indexOf(f),1),r.children.splice(r.children.indexOf(u),0,f)),a[c]=f,this.nestedTilesetRoots.set(r,a)}}prepareNestedTileset(t,r){let n=r.spatialMetadata,i=t.spatialReference;if(n?.status==="unresolved"||n?.crs.state==="unknown")throw new Error(n.warnings[0]||"Nested 3D Tiles CRS is explicitly unresolved and cannot be placed in the parent frame");if(!n||!n.sourceCrs)return this.spatialTransformer&&(i.status==="transformable"||i.status==="transformed")?{...r,spatialMetadata:i,root:this.transformTileHeaderWithTransformer(r.root,this.spatialTransformer,new bt,i)}:Ky(r,i);let o=i.coordinateEpoch,s=n.coordinateEpoch;if(o!==void 0&&s!==void 0&&o!==s)throw new Error(`Nested 3D Tiles coordinate epoch ${s} differs from parent epoch ${o}; epoch-aware transformation is unavailable`);let a=i.targetCrs||i.sourceCrs;if(!a)return Ky(r,n);let c=va(n,{...t.options.spatial,outputCoordinates:"target-crs",targetCrs:a});if(c.status==="unresolved")throw new Error(c.warnings[0]||"Nested 3D Tiles CRS cannot be resolved in the parent output frame");if(c.status==="native")return Ky(r,c);let l=new ls(c,t.options.spatial);return{...r,spatialMetadata:c,root:this.transformTileHeaderWithTransformer(r.root,l,new bt,c)}}async loadWithCoreApi(t,r,n=this.loader){if(!this.coreApi)throw new Error("Tiles3DSource requires an injected coreApi to load tileset data");return await this.coreApi.load(t,n,r)}async loadRootData(t,r){return this.resolver?await this.resolver.loadRoot(t,this.loader,r):await this.loadWithCoreApi(t,r)}async loadResourceData(t,r,n=this.loader){return this.resolver?await this.resolver.loadResource(t,n,r):await this.loadWithCoreApi(t,r,n)}async loadContentResource(t,r,n){if(!r)return await this.loadResourceData(t,n);let i=r.files[r.fileIndex];if(!i)throw new Error(`3D Tiles package references missing file ${r.fileIndex}`);if(i.uri)return await this.loadResourceData(this.getTileUrl(i.uri),n);if(!this.coreApi)throw new Error("Tiles3DSource requires an injected coreApi to parse embedded package data");let o=await this.getPackageFileData(i),a=`gltf-package://${this.getPackageNamespace(r.files)}/${r.fileIndex}`,c=i.name||"content",l=c.lastIndexOf("/"),h=l>=0?`${a}/${c.slice(0,l)}`:a;return await this.coreApi.parse(o,this.loader,n,{url:`${a}/${c}`,filename:c,baseUrl:h,loaders:[this.loader],coreApi:this.coreApi,_parse:this.coreApi.parse,_tiles3dPackageFiles:r.files,fetch:async(u,f)=>{let d=u.startsWith(`${a}/`)?u.slice(a.length+1):u,m=r.files.find(g=>g.name===d||g.originalUri===d);if(!m)throw new Error(`3D Tiles glTF package does not contain file ${d}`);if(m.uri)return await this.coreApi.fetchFile(this.getTileUrl(m.uri),f);let p=await this.getPackageFileData(m);return new Response(p,{headers:{"content-type":m.mimeType}})}})}getPackageNamespace(t){let r=this.packageNamespaces.get(t);if(r!==void 0)return r;let n=this.nextPackageNamespace++;return this.packageNamespaces.set(t,n),n}async getPackageFileData(t){if(t.data)return md(t.data,t.byteOffset,t.byteLength);if(t.bufferUri&&this.coreApi){let r=await this.coreApi.fetchFile(this.getTileUrl(t.bufferUri));if(!r.ok)throw new Error(`Failed to fetch 3D Tiles package buffer: HTTP ${r.status}`);let n=await r.arrayBuffer();return md(n,t.byteOffset,t.byteLength)}throw new Error("3D Tiles package file has no available byte source")}async loadImplicitSubtreeResource(t,r){let n=this.implicitSubtreeCache.get(t);if(n)return this.implicitTilingStats.cacheHits++,await n;this.implicitTilingStats.requestedSubtrees++;let i=this.loadOptions[this.loader.id]||{};return await this.implicitSubtreeCache.getOrLoad(t,async()=>{let o={...this.loadOptions,[this.loader.id]:{...i,isTileset:!1,isSubtree:!0}};return await(r?this.loadContentResource(t,r,o):this.loadResourceData(t,o))})}initializeMaterializedChildren(t,r,n){let i=0,o=[{parentTile:r,childHeaders:n}];for(;o.length>0;){let s=o.pop();for(let a of s.childHeaders){let c=new bn(t,a,s.parentTile);s.parentTile.children.push(c),c.depth=s.parentTile.depth+1,t.stats.get("Tiles In Tileset(s)").incrementCount(),i++,a.children?.length&&o.push({parentTile:c,childHeaders:a.children})}}return i}};function DI(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted","AbortError")}function FI(e){return!!(e&&typeof e=="object"&&"url"in e&&"loader"in e&&!("type"in e))}function CB(e){return FI(e)?{...e,basePath:e.basePath||wn.dirname(e.url)}:{url:e.url,loader:e.loader,basePath:e.basePath||wn.dirname(e.url),resolver:e.resolver,coreApi:e.coreApi}}function Ky(e,t){let r=n=>({...n,_spatialReference:t,children:Array.isArray(n.children)?n.children.map(r):n.children});return{...e,spatialMetadata:t,root:r(e.root)}}co();Dr();jt();var Sm=class{frameNumberMap=new Map;register(t,r){let n=this.frameNumberMap.get(t)||new Map,i=n.get(r)||0;n.set(r,i+1),this.frameNumberMap.set(t,n)}deregister(t,r){let n=this.frameNumberMap.get(t);if(!n)return;let i=n.get(r)||1;n.set(r,i-1)}isZero(t,r){return(this.frameNumberMap.get(t)?.get(r)||0)===0}};var Xy={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},vm=class{_statusMap;pendingTilesRegister=new Sm;constructor(){this._statusMap={}}add(t,r,n,i){if(!this._statusMap[r]){let{frameNumber:o,viewport:{id:s}}=i;this._statusMap[r]={request:t,callback:n,key:r,frameState:i,status:Xy.REQUESTED},this.pendingTilesRegister.register(s,o),t().then(a=>{this._statusMap[r].status=Xy.COMPLETED;let{frameNumber:c,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,c),this._statusMap[r].callback(a,i)}).catch(a=>{this._statusMap[r].status=Xy.ERROR;let{frameNumber:c,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,c),n(a)})}}update(t,r){if(this._statusMap[t]){let{frameNumber:n,viewport:{id:i}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(i,n);let{frameNumber:o,viewport:{id:s}}=r;this.pendingTilesRegister.register(s,o),this._statusMap[t].frameState=r}}find(t){return this._statusMap[t]}hasPendingTiles(t,r){return!this.pendingTilesRegister.isZero(t,r)}};var Em=class extends Bi{_tileManager;constructor(t){super(t),this._tileManager=new vm}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,r){return t._lodJudge=Gd(t,r),t._lodJudge==="DIG"}updateChildTiles(t,r){let n=t.header.children||[],i=t.children;for(let o of n){let s=`${o.id}-${r.viewport.id}`,a=i&&i.find(c=>c.id===s||c.header?.id===o.id);if(a)a&&this.updateTile(a,r);else{let c=()=>this._loadTile(t,o.id,r);this._tileManager.find(s)?this._tileManager.update(s,r):this._tileManager.add(c,s,h=>this._onTileLoad(h,t,s),r)}}return!1}async _loadTile(t,r,n){if(!t.tileset.source.loadChildTileHeader)throw new Error("I3S source does not support child tile header loading");return await t.tileset.source.loadChildTileHeader(t,r,n)}_onTileLoad(t,r,n){if(t instanceof Error){r.tileset._onSourceError(t,r);return}let i=new bn(r.tileset,t,r,n);r.children.push(i);let o=this._tileManager.find(i.id).frameState;this.updateTile(i,o),this._frameNumber===o.frameNumber&&(this.traversalFinished(o)||new Date().getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(i,o)}};jt();Dr();var ml=class{spatialReference;targetCoordinateFrame;positionTransformer;sourceToGeographicTransformer;geographicToTargetTransformer;sourceCoordinateFrame;sourceVerticalUnitScale;elevationMode;elevationOffset;elevationProvider;providerUnitScale;providerHeightTransformer;constructor(t,r={}){if(t.status!=="transformable"&&t.status!=="transformed")throw new Error("I3SSpatialTransformer requires a requested, transformable spatial output");let n=t.targetCrs||t.sourceCrs;if(!n)throw new Error("I3S spatial transformation requires a target CRS");if(this.positionTransformer=new Hn(t,r),this.sourceCoordinateFrame=t.coordinateFrame,this.sourceVerticalUnitScale=t.verticalUnitScale,this.elevationMode=t.elevationMode,this.elevationOffset=(t.elevationOffset||0)*t.elevationUnitScale,this.elevationProvider=NB(this.elevationMode,r),this.elevationProvider&&(typeof this.elevationProvider.sampleElevations!="function"||typeof this.elevationProvider.getElevationRange!="function"))throw new Error("An I3S elevation provider must implement sampleElevations() and getElevationRange()");let i=Uh(this.elevationProvider?.unit||"meter");if(this.elevationProvider&&i===void 0)throw new Error(`Unsupported elevation-provider unit ${this.elevationProvider.unit}`);this.providerUnitScale=i||1,this.targetCoordinateFrame=_n(n),this.spatialReference=$c(t);let o=Mn({sourceCrs:t.sourceCrs,heightReference:t.heightReference,coordinateFrame:t.coordinateFrame,axisOrder:t.axisOrder,provenance:t.provenance},{targetCrs:"EPSG:4326"});if(this.sourceToGeographicTransformer=new Hn(o),dl(this.elevationMode)){if(!this.elevationProvider){let c=this.elevationMode==="relativeToScene"?"scene":"terrain";throw new Error(`I3S elevation mode ${this.elevationMode} requires a ${c} elevation provider`)}if(t.heightReference==="unknown")throw new Error(`I3S elevation mode ${this.elevationMode} requires a known source height reference`);let a=this.elevationProvider.heightReference||t.heightReference;if(a!==t.heightReference){if(t.heightReference!=="ellipsoidal"&&t.heightReference!=="orthometric")throw new Error("Converting elevation-provider heights requires an ellipsoidal or orthometric source height reference");let c=Mn({sourceCrs:"EPSG:4326",heightReference:a,coordinateFrame:"geographic",axisOrder:"xyz",provenance:"caller-override"},{targetCrs:"EPSG:4326",targetHeightReference:t.heightReference,geoidModel:r.geoidModel});this.providerHeightTransformer=new Hn(c,r)}}let s=Mn({sourceCrs:"EPSG:4326",heightReference:t.heightReference,coordinateFrame:"geographic",axisOrder:"xyz",provenance:"format-default"},{targetCrs:n,targetHeightReference:t.targetHeightReference,geoidModel:r.geoidModel});this.geographicToTargetTransformer=new Hn(s,r)}transformPosition(t){let r=this.placeSourcePositionsSync(t),n=this.positionTransformer.transformPosition([r[0],r[1],r[2]]);return[n[0],n[1],n[2]]}async transformPositionAsync(t){let r=await this.placeSourcePositions(t),n=this.positionTransformer.transformPosition([r[0],r[1],r[2]]);return[n[0],n[1],n[2]]}transformPlacedPosition(t){let r=this.positionTransformer.transformPosition([t[0],t[1],t[2]]);return[r[0],r[1],r[2]]}transformSourcePositionToGeographic(t){let r=this.placeSourcePositionsSync(t),n=this.sourceToGeographicTransformer.transformPosition([r[0],r[1],r[2]]);return[n[0],n[1],n[2]]}async transformSourcePositionToGeographicAsync(t){let r=await this.placeSourcePositions(t),n=this.sourceToGeographicTransformer.transformPosition([r[0],r[1],r[2]]);return[n[0],n[1],n[2]]}transformPositions(t,r){let n=this.placeSourcePositionsSync(t),i=this.placeSourcePositionsSync(r);return this.transformPlacedPositions(n,i)}async transformPositionsAsync(t,r){let n=new Float64Array(t.length+3);n.set(Array.from(t),0),n.set(Array.from(r).slice(0,3),t.length);let i=await this.placeSourcePositions(n);return this.transformPlacedPositions(i.subarray(0,t.length),i.subarray(t.length))}async transformGeometryAsync(t,r,n="earth-centered"){if(t.length%3||r&&r.length!==t.length)throw new Error("Conversion positions and normals must contain matching finite xyz triples");for(let o=0;o<t.length;o++)if(!Number.isFinite(t[o])||r&&!Number.isFinite(r[o]))throw new Error("Conversion positions and normals must contain matching finite xyz triples");if(!["earth-centered","vertex-reference-frame"].includes(n))throw new Error("Unsupported I3S normal reference frame");let i=await this.placeSourcePositions(t);return{positions:this.positionTransformer.transformPositions(i),normals:r?this.transformNormals(r,i,n):void 0}}transformPlacedPositions(t,r){let n=this.transformPlacedPosition(r),i=new Float32Array(t.length),o=Float64Array.from(t);for(let c=0;c<t.length;c+=3){let l=this.transformPlacedPosition([t[c],t[c+1],t[c+2]]);i[c]=l[0]-n[0],i[c+1]=l[1]-n[1],i[c+2]=l[2]-n[2]}let s=this.targetCoordinateFrame==="geographic",a=s?new bt:new bt().translate(n);return{positions:i,sourcePositions:o,origin:n,cartographicOrigin:s?n:[0,0,0],coordinateSystem:s?"lnglat-offsets":"cartesian",modelMatrix:a}}transformNormals(t,r,n="earth-centered"){if(t.length!==r.length||t.length%3)throw new Error("I3S normals and positions must have matching xyz component counts");let i=new Float32Array(t.length);if(n==="earth-centered"&&(this.spatialReference.targetCrs||this.spatialReference.sourceCrs)==="EPSG:4978"){for(let o=0;o<t.length;o+=3){let s=Math.hypot(t[o],t[o+1],t[o+2]);for(let a=0;a<3;a++)i[o+a]=s?t[o+a]/s:t[o+a]}return i}for(let o=0;o<t.length;o+=3){let s=this.sourceToGeographicTransformer.transformPosition([r[o],r[o+1],r[o+2]]),a=new E([t[o],t[o+1],t[o+2]]).normalize(),c=n==="earth-centered"?a:kI(a,s),l=this.transformEcefNormal(c,s);i.set(l,o)}return i}transformBoundingVolume(t){let n=this.getGeographicBoundSamples(t).map(i=>this.geographicToTargetTransformer.transformPosition(i));return this.targetCoordinateFrame==="geographic"?{region:hs(n)}:{box:Na(n)}}async transformBoundingVolumeAsync(t){let n=(await this.getGeographicBoundSamplesAsync(t)).map(i=>this.geographicToTargetTransformer.transformPosition(i));return this.targetCoordinateFrame==="geographic"?{region:hs(n)}:{box:Na(n)}}transformBoundingVolumeToGeographic(t){return{region:hs(this.getGeographicBoundSamples(t))}}async transformBoundingVolumeToGeographicAsync(t){return{region:hs(await this.getGeographicBoundSamplesAsync(t))}}transformBoundingVolumeToGeocentric(t){let r=this.getGeographicBoundSamples(t).map(n=>Array.from(pt.WGS84.cartographicToCartesian(new E(n))));return{box:Na(r)}}async transformBoundingVolumeToGeocentricAsync(t){let r=(await this.getGeographicBoundSamplesAsync(t)).map(n=>Array.from(pt.WGS84.cartographicToCartesian(new E(n))));return{box:Na(r)}}transformBoundingSphereToGeographic(t){let r=t.mbs?.length?Array.from(t.mbs).slice(0,3):t.obb?Array.from(t.obb.center).slice(0,3):null;if(!r)throw new Error("I3S spatial transformation requires an MBS or OBB bound");let n=this.placeSourcePositionsSync(r),i=this.sourceToGeographicTransformer.transformPosition(Array.from(n)),o=t.mbs?.length?t.mbs[3]:Math.hypot(...Array.from(t.obb.halfSize).slice(0,3));return[i[0],i[1],i[2],o]}async transformBoundingSphereToGeographicAsync(t){return UI(await this.getGeographicBoundSamplesAsync(t))}async transformBoundsAsync(t){let r=await this.getGeographicBoundSamplesAsync(t),n=r.map(o=>Array.from(pt.WGS84.cartographicToCartesian(new E(o)))),i=r.map(o=>this.geographicToTargetTransformer.transformPosition(o));return{boundingVolume:{box:Na(n)},spatialBoundingVolume:this.targetCoordinateFrame==="geographic"?{region:hs(i)}:{box:Na(i)},i3sLodMbs:dl(this.elevationMode)?UI(r):this.transformBoundingSphereToGeographic(t)}}async transformPointCloudBoundsAsync(t){let r=await this.getGeographicBoundSamplesAsync(t),n=r.map(i=>this.geographicToTargetTransformer.transformPosition(i));return{boundingVolume:{region:hs(r)},spatialBoundingVolume:this.targetCoordinateFrame==="geographic"?{region:hs(n)}:{box:Na(n)}}}getGeographicBoundSamples(t){let r=GI(t,this.sourceCoordinateFrame,this.sourceToGeographicTransformer,this.sourceVerticalUnitScale);if(!r.length)throw new Error("I3S spatial transformation requires an MBS or OBB bound");let n=this.placeSourcePositionsSync(r.flat(),!0),i=Zy(n);return this.sourceCoordinateFrame==="geographic"?i:i.map(o=>this.sourceToGeographicTransformer.transformPosition(o))}async getGeographicBoundSamplesAsync(t){let r=GI(t,this.sourceCoordinateFrame,this.sourceToGeographicTransformer,this.sourceVerticalUnitScale);if(!r.length)throw new Error("I3S spatial transformation requires an MBS or OBB bound");if(dl(this.elevationMode)){let i=this.sourceCoordinateFrame==="geographic"?r:r.map(o=>this.sourceToGeographicTransformer.transformPosition(o));return await this.placeGeographicBoundSamples(i)}let n=Zy(await this.placeSourcePositions(r.flat(),!0));return this.sourceCoordinateFrame==="geographic"?n:n.map(i=>this.sourceToGeographicTransformer.transformPosition(i))}async placeGeographicBoundSamples(t){let n=await this.elevationProvider.getElevationRange(OB(t)),i=n.minimum*this.providerUnitScale,o=n.maximum*this.providerUnitScale;if(!Number.isFinite(i)||!Number.isFinite(o)||i>o)throw new Error("Elevation provider returned an invalid range; minimum and maximum must be finite and ordered");let s=t.map(h=>h[2]),a=Math.min(...s),c=Math.max(...s),l=[];for(let[h,u]of t){let f=this.providerHeightTransformer?this.providerHeightTransformer.transformPosition([h,u,i])[2]:i,d=this.providerHeightTransformer?this.providerHeightTransformer.transformPosition([h,u,o])[2]:o,m=Math.min(f,d),p=Math.max(f,d),g=this.elevationMode==="onTheGround"?m:m+a+this.elevationOffset,y=this.elevationMode==="onTheGround"?p:p+c+this.elevationOffset;l.push([h,u,g],[h,u,y])}return l}placeSourcePositionsSync(t,r=!1){if(dl(this.elevationMode))throw new Error(`I3S elevation mode ${this.elevationMode} requires asynchronous surface placement`);let n=Float64Array.from(t),i=this.elevationMode==="absoluteHeight"?this.elevationOffset:0;for(let o=2;o<n.length;o+=3)n[o]=n[o]*(r?1:this.sourceVerticalUnitScale)+i;return n}async placeSourcePositions(t,r=!1){if(!dl(this.elevationMode))return this.placeSourcePositionsSync(t,r);let n=Float64Array.from(t),i=Zy(n).map(s=>{let a=this.sourceToGeographicTransformer.transformPosition(s);return[a[0],a[1]]}),o=await this.elevationProvider.sampleElevations(i);if(o.length!==i.length)throw new Error(`Elevation provider returned ${o.length} heights for ${i.length} positions`);for(let s=0;s<i.length;s++){let a=o[s]*this.providerUnitScale;if(!Number.isFinite(a))throw new Error(`Elevation provider returned a non-finite height at index ${s}`);let[c,l]=i[s],h=this.providerHeightTransformer?this.providerHeightTransformer.transformPosition([c,l,a])[2]:a,u=n[s*3+2]*(r?1:this.sourceVerticalUnitScale);n[s*3+2]=this.elevationMode==="onTheGround"?h:h+u+this.elevationOffset}return n}transformEcefNormal(t,r){if(this.targetCoordinateFrame==="geocentric")return t.normalize();if(this.targetCoordinateFrame==="geographic")return LB(t,r).normalize();let n=pt.WGS84.cartographicToCartesian(new E(r)),i=[];for(let s of BB()){let a=pt.WGS84.cartesianToCartographic(new E(n).add(s)),c=pt.WGS84.cartesianToCartographic(new E(n).subtract(s)),l=this.geographicToTargetTransformer.transformPosition(a),h=this.geographicToTargetTransformer.transformPosition(c);i.push((l[0]-h[0])/2,(l[1]-h[1])/2,(l[2]-h[2])/2)}let o=new Qr(i);if(Math.abs(o.determinant())<1e-12)throw new Error("Cannot transform an I3S normal through a singular local projection");return o.invert().transpose(),new E(t).transformByMatrix3(o).normalize()}};function NB(e,t){return e==="relativeToScene"?t.sceneElevationProvider:dl(e)?t.terrainElevationProvider:void 0}function dl(e){return e==="onTheGround"||e==="relativeToGround"||e==="relativeToScene"}function Zy(e){if(e.length%3!==0)throw new Error("I3S position arrays must contain complete XYZ tuples");let t=[];for(let r=0;r<e.length;r+=3)t.push([e[r],e[r+1],e[r+2]]);return t}function OB(e){let t=hs(e);return{west:t[0]*180/Math.PI,south:t[1]*180/Math.PI,east:t[2]*180/Math.PI,north:t[3]*180/Math.PI}}function UI(e){if(!e.length)throw new Error("I3S spatial transformation requires at least one bound sample");let t=e.map(o=>pt.WGS84.cartographicToCartesian(new E(o))),r=new E;for(let o of t)r.add(o);r.scale(1/t.length);let n=0;for(let o of t)n=Math.max(n,new E(o).subtract(r).magnitude());let i=pt.WGS84.cartesianToCartographic(r);return[i[0],i[1],i[2],n]}function GI(e,t,r,n){let i=e.obb;if(i){let c=Array.from(i.center).slice(0,3);c[2]*=n;let l=Array.from(i.halfSize).slice(0,3),h=new Xi().fromArray(Array.from(i.quaternion)),u=[new E([l[0],0,0]).transformByQuaternion(h),new E([0,l[1],0]).transformByQuaternion(h),new E([0,0,l[2]]).transformByQuaternion(h)];if(t==="geographic"){let f=r.transformPosition(c),d=pt.WGS84.cartographicToCartesian(new E(f)),m=e.normalReferenceFrame==="vertex-reference-frame"?u.map(p=>kI(p,f)):u;return zI().map(p=>{let g=new E(d);for(let y=0;y<3;y++)g.add(new E(m[y]).scale(p[y]));return Array.from(pt.WGS84.cartesianToCartographic(g))})}return zI().map(f=>{let d=new E(c);for(let m=0;m<3;m++)d.add(new E(u[m]).scale(f[m]));return Array.from(d)})}let o=e.mbs?Array.from(e.mbs):[];if(o.length<4)return[];let s=o.slice(0,3);s[2]*=n;let a=o[3];if(t==="geographic"){let c=r.transformPosition(s),l=pt.WGS84.cartographicToCartesian(new E(c));return VI().map(h=>Array.from(pt.WGS84.cartesianToCartographic(new E(l).add(new E(h).scale(a)))))}return VI().map(c=>Array.from(new E(s).add(new E(c).scale(a))))}function zI(){return[-1,1].flatMap(e=>[-1,1].flatMap(t=>[-1,1].map(r=>[e,t,r])))}function VI(){return[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]]}function BB(){return[new E([1,0,0]),new E([0,1,0]),new E([0,0,1])]}function kI(e,t){let r=t[0]*Math.PI/180,n=t[1]*Math.PI/180,i=new E([-Math.sin(r),Math.cos(r),0]),o=new E([-Math.sin(n)*Math.cos(r),-Math.sin(n)*Math.sin(r),Math.cos(n)]),s=new E([Math.cos(n)*Math.cos(r),Math.cos(n)*Math.sin(r),Math.sin(n)]);return i.scale(e[0]).add(o.scale(e[1])).add(s.scale(e[2]))}function LB(e,t){let r=t[0]*Math.PI/180,n=t[1]*Math.PI/180,i=new E([-Math.sin(r),Math.cos(r),0]),o=new E([-Math.sin(n)*Math.cos(r),-Math.sin(n)*Math.sin(r),Math.cos(n)]),s=new E([Math.cos(n)*Math.cos(r),Math.cos(n)*Math.sin(r),Math.sin(n)]);return new E([i.dot(e),o.dot(e),s.dot(e)])}function Na(e){let t=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(let o of e)for(let s=0;s<3;s++)t[s]=Math.min(t[s],o[s]),r[s]=Math.max(r[s],o[s]);let n=t.map((o,s)=>(o+r[s])/2),i=t.map((o,s)=>(r[s]-o)/2);return[n[0],n[1],n[2],i[0],0,0,0,i[1],0,0,0,i[2]]}function hs(e){let t=e[0][0],r=1/0,n=-1/0,i=1/0,o=-1/0,s=1/0,a=-1/0;for(let c of e){let l=t+Jy(c[0]-t);r=Math.min(r,l),n=Math.max(n,l),i=Math.min(i,c[1]),o=Math.max(o,c[1]),s=Math.min(s,c[2]),a=Math.max(a,c[2])}return[Jy(r)*Math.PI/180,i*Math.PI/180,Jy(n)*Math.PI/180,o*Math.PI/180,s,a]}function Jy(e){return((e+180)%360+360)%360-180}var DB={draco:!1,meshopt:!1,dds:!1,ktx2:!1},Tm=class{type=nr.I3S;loader;contentLoader;url;basePath;tileset=null;loadOptions;coreApi;contentFormats={...DB};asset;properties;extras;credits;metadata;queryParams={};resolver;rootTileset;spatialTransformer;preparedRootHeader;constructor(t,r={}){let n=UB(t);this.rootTileset=jI(t)?null:t,this.tileset=this.rootTileset,this.loader=n.loader,this.contentLoader=FB(n.loader),this.url=n.url,this.basePath=n.basePath||wn.dirname(n.url),this.resolver=n.resolver,this.coreApi=n.coreApi,this.loadOptions=r,this.initializeQueryParams(r)}async initialize(){this.rootTileset||(this.rootTileset=await this.loadRootData(this.getTileUrl(this.url),{...this.loadOptions,i3s:{...this.loadOptions.i3s,isTileset:!0}})),this.tileset=this.rootTileset,this.rootTileset.root&&typeof this.rootTileset.root.then=="function"&&(this.rootTileset.root=await this.rootTileset.root),this.metadata={type:this.type,loader:this.loader,url:this.url,basePath:this.basePath,tileset:this.rootTileset,lodMetricType:this.rootTileset.lodMetricType,lodMetricValue:this.rootTileset.lodMetricValue,refine:this.rootTileset.root?.refine,spatialReference:Vd(this.rootTileset)}}getMetadata(){if(!this.metadata)throw new Error("I3SSource has not been initialized");return this.metadata}async getRootTileset(){return this.getMetadata().tileset}async prepareTileset(t){let r=t.spatialReference;if(r.status==="unresolved")throw new Error(r.warnings[0]||"I3S spatial operations cannot be resolved from the supplied metadata and options");r.status!=="transformable"&&r.status!=="transformed"||(this.spatialTransformer||=new ml(r,t.options.spatial),t.spatialReference=this.spatialTransformer.spatialReference,this.preparedRootHeader=await this.transformTileHeader(this.getMetadata().tileset.root))}initializeTileHeaders(t,r,n){let i=n?r.root:this.preparedRootHeader||r.root;if(this.spatialTransformer&&!this.preparedRootHeader)throw new Error("I3S spatial root header was not prepared before tile initialization");let o=new bn(t,i,n||void 0);return n&&(n.children.push(o),o.depth=n.depth+1),o}createTraverser(t){return new Em(t)}async loadTileContent(t){let r=this.getTileUrl(t.contentUrl),n=this.loader.id,i=this.loadOptions[n]||{},o=this.getMetadata(),s={...this.loadOptions,[n]:{...i,...t.tileset.options.i3s,_tileOptions:{attributeUrls:t.header.attributeUrls,textureUrl:t.header.textureUrl,textureUrls:t.header.textureUrls,textureFormat:t.header.textureFormat,textureLoaderOptions:t.header.textureLoaderOptions,materialDefinition:t.header.materialDefinition,layerType:t.header.layerType,pointRenderer:t.header.pointRenderer,pointSymbol:t.header.pointSymbol,isDracoGeometry:t.header.isDracoGeometry,mbs:t.header.mbs},_tilesetOptions:{store:o.tileset.store,attributeStorageInfo:o.tileset.attributeStorageInfo,fields:o.tileset.fields,spatialReference:t.tileset.spatialReference,spatialOptions:t.tileset.options.spatial},isTileHeader:!1}};t.content=await this.loadResourceData(r,s,this.contentLoader);let a={index:0,uri:t.contentUrl,type:t.header.layerType,payload:t.content,metadata:t.header.metadata||null,boundingVolume:t.boundingVolume,featureIds:t.featureIdSets,renderable:!!t.content};return{loaded:!0,contents:[t.content],contentEntries:[a]}}async loadChildTileHeader(t,r,n){let i=this.getMetadata();if(i.tileset.nodePages||i.tileset.pointNodePages){let l=await i.tileset.nodePagesTile.formTileFromNodePages(r);return await this.transformTileHeader(l)}let o=this.getTileUrl(`${this.url}/nodes/${r}`),s=this.loadOptions.i3s&&typeof this.loadOptions.i3s=="object"?this.loadOptions.i3s:{},a={...this.loadOptions,i3s:{...s,isTileHeader:!0}},c=await this.loadResourceData(o,a);return await this.transformTileHeader(c)}async loadTileChildrenForTraversal(t,r){let n=t.header.children||[],i=0,o=[];for(let a of n){qI(r);let c=a.id;if(typeof c!="string"&&typeof c!="number")throw new Error("I3S child header is missing its node ID");let l=t.children.find(f=>f.id===String(c)||f.header?.id===c);if(l){o.push(l);continue}let h=await this.loadChildTileHeader(t,String(c),null);qI(r);let u=new bn(t.tileset,h,t,String(c));o.push(u),i++}let s=new Set(o);return t.children=[...o,...t.children.filter(a=>!s.has(a))],{loaded:!0,tileCount:i,childSubtreeCount:0}}getTileUrl(t){if(t.startsWith("data:")||!Object.keys(this.queryParams).length)return t;let r=t.indexOf("#"),n=r>=0?t.slice(r):"",i=r>=0?t.slice(0,r):t,o=i.indexOf("?"),s=o===-1?i:i.slice(0,o),a=o===-1?"":i.slice(o+1),c=new URLSearchParams(a),l=new URLSearchParams;for(let[u,f]of Object.entries(this.queryParams))c.has(u)||l.set(u,f);let h=l.toString();return`${s}${a?`?${a}`:""}${h?`${a?"&":"?"}${h}`:""}${n}`}getViewState(t){if(this.spatialTransformer&&t){let o=new E(t.boundingVolume.center),s=new E(t.header.i3sLodMbs.slice(0,3));return this.spatialTransformer.targetCoordinateFrame==="geographic"?{boundingVolume:t.boundingVolume,cartographicCenter:s,cartesianCenter:o,zoom:1}:{boundingVolume:t.boundingVolume,cartographicCenter:s,cartesianCenter:o,zoom:1}}let r=this.getMetadata(),n=r.tileset.fullExtent;if(n){let{xmin:o,xmax:s,ymin:a,ymax:c,zmin:l,zmax:h}=n,u=new E(o+(s-o)/2,a+(c-a)/2,l+(h-l)/2),f=new E;return pt.WGS84.cartographicToCartesian(u,f),{cartographicCenter:u,cartesianCenter:f,zoom:N1(n,u,f)}}let i=r.tileset.store?.extent;if(i){let[o,s,a,c]=i,l=new E(o+(a-o)/2,s+(c-s)/2,0),h=new E;return pt.WGS84.cartographicToCartesian(l,h),{cartographicCenter:l,cartesianCenter:h,zoom:pv(i,l,h)}}return console.warn("Extent is not defined in the tileset header"),{cartographicCenter:new E,zoom:1}}onTileLoaded(t,r){switch(r.header.isDracoGeometry&&(this.contentFormats.draco=!0),r.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0;break;default:}}getTilesTotalCount(){return this.getMetadata().tileset?.nodePagesTile?.nodesInNodePages||null}async loadWithCoreApi(t,r,n=this.loader){if(!this.coreApi)throw new Error("I3SSource requires an injected coreApi to load tileset data");return await this.coreApi.load(t,n,r)}async loadRootData(t,r){return this.resolver?await this.resolver.loadRoot(t,this.loader,r):await this.loadWithCoreApi(t,r)}initializeQueryParams(t){for(let[n,i]of Object.entries(t.searchParams||{}))this.queryParams[n]=String(i);let r=t.i3s;if(r&&typeof r=="object"&&"token"in r){let n=r.token;typeof n=="string"&&(this.queryParams.token=n)}}async loadResourceData(t,r,n=this.loader){return this.resolver?await this.resolver.loadResource(t,n,r):await this.loadWithCoreApi(t,r,n)}async transformTileHeader(t){if(!this.spatialTransformer)return t;let r={mbs:t.mbs,obb:t.obb,normalReferenceFrame:this.getMetadata().tileset.store?.normalReferenceFrame},n=await this.spatialTransformer.transformBoundsAsync(r);return{...t,boundingVolume:n.boundingVolume,spatialBoundingVolume:n.spatialBoundingVolume,i3sLodMbs:n.i3sLodMbs}}};function qI(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted","AbortError")}function FB(e){return e.contentLoader||e}function jI(e){return!!(e&&typeof e=="object"&&"url"in e&&"loader"in e&&!("type"in e))}function UB(e){return jI(e)?{...e,basePath:e.basePath||wn.dirname(e.url)}:{url:e.url,loader:e.loader,basePath:e.basePath||wn.dirname(e.url),resolver:e.resolver,coreApi:e.coreApi}}jt();ro();var pl=class{header;parent;children=[];childrenLoaded=!1;childrenPromise=null;selected=!1;viewportIds=[];content=null;contentAvailable=!1;contentFailed=!1;isContentLoading=!1;constructor(t,r=null){this.header=t,this.parent=r}get id(){return this.header.id}get level(){return this.header.level}get pointCount(){return this.header.pointCount}get geometricError(){return this.header.geometricError}get boundingVolume(){return this.header.boundingVolume}setSelected(t){this.selected=!0,this.viewportIds.includes(t)||this.viewportIds.push(t)}clearSelection(){this.selected=!1,this.viewportIds=[]}};var GB={debounceTime:0,minimumNodePixelSize:150,maximumScreenSpaceError:1,lodSelectionMetricType:"maxScreenThresholdSQ",densityThreshold:1,pointBudget:2e6,maxDepth:Number.POSITIVE_INFINITY,onTileLoad:()=>{},onTileError:()=>{},onTraversalComplete:e=>e,onUpdate:()=>{}},Im=64,Am=class{dataSource;options;root=null;cartographicCenter=null;zoom=1;boundingVolume=null;visibleTilesCount=0;frameNumberValue=0;pendingCount=0;lastUpdatedViewports=null;updatePromise=null;tilesMap=new Map;constructor(t,r={}){this.dataSource=t,this.options={...GB,...r},this.tilesetInitializationPromise=this.initialize()}tilesetInitializationPromise;get isReady(){return this.dataSource.isReady}get frameNumber(){return this.frameNumberValue}get tiles(){return Array.from(this.tilesMap.values())}isLoaded(){return this.frameNumberValue>0&&this.pendingCount===0&&this.selectedTiles.every(t=>t.contentAvailable||t.contentFailed)}selectedTiles=[];update(t=null){this.selectTiles(t).catch(()=>{})}destroy(){this.selectedTiles=[],this.tilesMap.clear(),this.root=null,this.cartographicCenter=null,this.boundingVolume=null,this.visibleTilesCount=0,this.pendingCount=0,this.lastUpdatedViewports=null,this.updatePromise=null}async initialize(){await this.dataSource.initialize();let t=await this.dataSource.getRootTile();this.root=this.getOrCreateTile(t,null);let r=await this.dataSource.getViewState?.();this.boundingVolume=r?.boundingVolume||this.root.boundingVolume;let n=r?.cartographicCenter||this.root.boundingVolume.center;this.cartographicCenter=new E(n),this.zoom=r?.zoom||this.estimateZoom(this.boundingVolume)}async selectTiles(t=null){return await this.tilesetInitializationPromise,t&&(this.lastUpdatedViewports=t),this.updatePromise||(this.updatePromise=new Promise((r,n)=>{setTimeout(()=>{this.doSelectTiles().then(()=>r(this.frameNumberValue)).catch(n).finally(()=>{this.updatePromise=null})},this.options.debounceTime)})),this.updatePromise}async doSelectTiles(){if(!this.root||!this.lastUpdatedViewports)return;let t=new Set(this.selectedTiles.map(a=>a.id));for(let a of this.tilesMap.values())a.clearSelection();this.frameNumberValue++;let r=Array.isArray(this.lastUpdatedViewports)?this.lastUpdatedViewports:[this.lastUpdatedViewports],n=new Map,i=new Set,o=0;for(let a of r){let c=this.getTraversalContext(a);o=await this.traverseTiles(c,n,o,i)}this.visibleTilesCount=i.size,this.selectedTiles=this.options.onTraversalComplete(Array.from(n.values()));for(let a of this.selectedTiles)this.loadTile(a).catch(()=>{});let s=new Set(this.selectedTiles.map(a=>a.id));this.haveSameIds(t,s)||this.options.onUpdate()}async traverseTiles(t,r,n,i){if(!this.root)return n;let o=n,s=[{tile:this.root,weight:this.estimateScreenRadius(this.root,t.viewport)}];for(;s.length>0;){s.sort((u,f)=>f.weight-u.weight);let a=s.shift();if(!a)break;let{tile:c,weight:l}=a;if(!this.isVisible(c,t))continue;if(i.add(c.id),!r.has(c.id)&&c.pointCount>0){if(o>0&&o+c.pointCount>this.options.pointBudget)break;r.set(c.id,c),o+=c.pointCount}if(r.has(c.id)&&c.setSelected(t.viewport.id),!this.shouldRefine(c,l))continue;let h=await this.getVisibleChildren(c,t);h.length>0&&s.push(...h)}return o}shouldRefine(t,r){if(t.level<this.options.maxDepth&&Number.isFinite(r)&&(t.header.lodSelectionMetricType||this.options.lodSelectionMetricType)==="density-threshold"){let n=Math.max(1,Math.PI*r*r),i=t.pointCount/n,o=t.header.lodThreshold||this.options.densityThreshold;return i<o}return t.level<this.options.maxDepth&&Number.isFinite(r)&&r>=this.options.minimumNodePixelSize}getTraversalContext(t){let r=this.getCullingVolume(t);return{viewport:t,cullingVolume:this.shouldUseCullingVolume(t,r)?r:null}}isVisible(t,r){if(r.cullingVolume){let i=this.getCommonSpaceBoundingSphere(t.boundingVolume,r.viewport);if(i)return this.isBoundingSphereInsideCullingVolume(i,r.cullingVolume)}let n=this.getProjectedFootprint(t.boundingVolume,r.viewport);return n?this.isProjectedFootprintVisible(n,r.viewport):!1}shouldUseCullingVolume(t,r){if(!this.root||!r)return!1;let n=this.getCommonSpaceBoundingSphere(this.root.boundingVolume,t);if(!n)return!1;if(this.isBoundingSphereInsideCullingVolume(n,r))return!0;let i=this.getProjectedFootprint(this.root.boundingVolume,t);return!i||!this.isProjectedFootprintVisible(i,t)}isBoundingSphereInsideCullingVolume(t,r){return r.computeVisibilityWithPlaneMask(t,sr.MASK_INDETERMINATE)!==sr.MASK_OUTSIDE}isProjectedFootprintVisible(t,r){return!(t.x+t.radius<-Im||t.x-t.radius>r.width+Im||t.y+t.radius<-Im||t.y-t.radius>r.height+Im)}estimateScreenRadius(t,r){let n=this.getProjectedFootprint(t.boundingVolume,r);return n?n.radius:0}projectBounds(t,r){let n=this.getBoundingVolumeCorners(t),i=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,a=Number.NEGATIVE_INFINITY;try{for(let c of n){let[l,h]=r.project(c);!Number.isFinite(l)||!Number.isFinite(h)||(i=Math.min(i,l),o=Math.min(o,h),s=Math.max(s,l),a=Math.max(a,h))}}catch{return null}return!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(a)?null:{minX:i,minY:o,maxX:s,maxY:a}}getProjectedFootprint(t,r){let n=Number.NaN,i=Number.NaN;try{[n,i]=r.project(t.center)}catch{return null}if(!Number.isFinite(n)||!Number.isFinite(i))return null;let o=this.getBoundingVolumeCorners(t),s=0;try{for(let a of o){let[c,l]=r.project(a);!Number.isFinite(c)||!Number.isFinite(l)||(s=Math.max(s,Math.hypot(c-n,l-i)))}}catch{return null}if(s===0){let a=this.projectBounds(t,r);a&&(s=Math.max(a.maxX-a.minX,a.maxY-a.minY)/2)}return{x:n,y:i,radius:s}}async getVisibleChildren(t,r){return t.level>=this.options.maxDepth?[]:(await this.getChildren(t)).map(i=>({tile:i,weight:this.estimateScreenRadius(i,r.viewport)})).filter(i=>this.isVisible(i.tile,r))}async getChildren(t){if(t.childrenLoaded)return t.children;if(!t.childrenPromise){let r=this.dataSource.getChildren(t.header).then(n=>n.map(i=>this.getOrCreateTile(i,t))).then(n=>(t.children=n,t.childrenLoaded=!0,n));t.childrenPromise=r.finally(()=>{t.childrenPromise===r&&(t.childrenPromise=null)})}return t.childrenPromise}getOrCreateTile(t,r){let n=this.tilesMap.get(t.id);if(n)return n.header=t,r&&n.parent!==r&&(n.parent=r),n;let i=new pl(t,r);return this.tilesMap.set(t.id,i),r&&!r.children.find(o=>o.id===i.id)&&r.children.push(i),i}async loadTile(t){if(!(t.contentAvailable||t.isContentLoading||t.contentFailed)){t.isContentLoading=!0,this.pendingCount++;try{let r=await this.dataSource.loadTileContent(t.header);t.content=r,t.contentAvailable=!0,r&&this.options.onTileLoad(t)}catch(r){t.contentFailed=!0,this.options.onTileError(t,r)}finally{t.isContentLoading=!1,this.pendingCount--}}}estimateZoom(t){if(!t||t.coordinateFrame==="cartesian")return 1;let[r,n]=t.cartographicBounds,i=t.coversFullLongitude?360:t.wrapsDateline?360-Math.abs(n[0]-r[0]):Math.abs(n[0]-r[0]),o=Math.max(i,1e-6);return Math.max(1,Math.round(Math.log2(360/o)))}haveSameIds(t,r){if(t.size!==r.size)return!1;for(let n of t)if(!r.has(n))return!1;return!0}getBoundingVolumeCorners(t){let[r,n]=t.cartographicBounds,i=t.coversFullLongitude?[[-180,180]]:t.wrapsDateline?[[r[0],180],[-180,n[0]]]:[[r[0],n[0]]],o=[],s=360-Math.abs(n[0]-r[0]),a=r[0]+s/2;for(let[c,l]of i){let h=d=>{if(!t.wrapsDateline)return d;let m=d;for(;m-a>180;)m-=360;for(;m-a<-180;)m+=360;return m},u=h(c),f=h(l);o.push([u,r[1],r[2]||0],[u,r[1],n[2]||0],[u,n[1],r[2]||0],[u,n[1],n[2]||0],[f,r[1],r[2]||0],[f,r[1],n[2]||0],[f,n[1],r[2]||0],[f,n[1],n[2]||0])}return o}getCullingVolume(t){let r=t.getFrustumPlanes?.bind(t);if(!r)return null;let n=r(),i=["left","right","bottom","top","near","far"],o=[];for(let s of i){let a=n[s];if(!a)return null;o.push(new Ye(a.normal,-a.distance))}return new sr(o)}getCommonSpaceBoundingSphere(t,r){let n=r.projectPosition?.bind(r);if(!n)return null;let i=this.getBoundingVolumeCorners(t),o=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;try{for(let u of i){let[f,d,m=0]=n(u);!Number.isFinite(f)||!Number.isFinite(d)||!Number.isFinite(m)||(o=Math.min(o,f),s=Math.min(s,d),a=Math.min(a,m),c=Math.max(c,f),l=Math.max(l,d),h=Math.max(h,m))}}catch{return null}return!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(a)||!Number.isFinite(c)||!Number.isFinite(l)||!Number.isFinite(h)?null:new en().fromCornerPoints([o,s,a],[c,l,h])}};xM();return MP(Ju);})();
|
|
28
|
+
}`),this._recordBatchesWithDictionaries=[],this._recordBatches=[],super.close()}}});function qA(e,t){if($n(e))return bD(e,t);if(hi(e))return MD(e,t);throw new Error("toDOMStream() must be called with an Iterable or AsyncIterable")}function MD(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){o(s,r||(r=e[Symbol.iterator]()))},pull(s){r?o(s,r):s.close()},cancel(){r?.return&&r.return(),r=null}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){let c,l=null,h=s.desiredSize||null;for(;!(l=a.next(n?h:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=nt(l.value))&&(h!=null&&n&&(h=h-c.byteLength+1),l.value=c),s.enqueue(l.value),h!=null&&--h<=0)return;s.close()}}function bD(e,t){let r=null,n=t?.type==="bytes"||!1,i=t?.highWaterMark||Math.pow(2,24);return new ReadableStream(Object.assign(Object.assign({},t),{start(s){return Y(this,void 0,void 0,function*(){yield o(s,r||(r=e[Symbol.asyncIterator]()))})},pull(s){return Y(this,void 0,void 0,function*(){r?yield o(s,r):s.close()})},cancel(){return Y(this,void 0,void 0,function*(){r?.return&&(yield r.return()),r=null})}}),Object.assign({highWaterMark:n?i:void 0},t));function o(s,a){return Y(this,void 0,void 0,function*(){let c,l=null,h=s.desiredSize||null;for(;!(l=yield a.next(n?h:null)).done;)if(ArrayBuffer.isView(l.value)&&(c=nt(l.value))&&(h!=null&&n&&(h=h-c.byteLength+1),l.value=c),s.enqueue(l.value),h!=null&&--h<=0)return;s.close()})}}var jA=w(()=>{an();Je();us()});function $A(e){return new mM(e)}var mM,WA,HA,YA=w(()=>{an();Vu();mM=class{constructor(t){this._numChunks=0,this._finished=!1,this._bufferedSize=0;let{["readableStrategy"]:r,["writableStrategy"]:n,["queueingStrategy"]:i="count"}=t,o=n3(t,["readableStrategy","writableStrategy","queueingStrategy"]);this._controller=null,this._builder=vi(o),this._getSize=i!=="bytes"?WA:HA;let{["highWaterMark"]:s=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},r),{["highWaterMark"]:a=i==="bytes"?Math.pow(2,14):1e3}=Object.assign({},n);this.readable=new ReadableStream({cancel:()=>{this._builder.clear()},pull:c=>{this._maybeFlush(this._builder,this._controller=c)},start:c=>{this._maybeFlush(this._builder,this._controller=c)}},{highWaterMark:s,size:i!=="bytes"?WA:HA}),this.writable=new WritableStream({abort:()=>{this._builder.clear()},write:()=>{this._maybeFlush(this._builder,this._controller)},close:()=>{this._maybeFlush(this._builder.finish(),this._controller)}},{highWaterMark:a,size:c=>this._writeValueAndReturnChunkSize(c)})}_writeValueAndReturnChunkSize(t){let r=this._bufferedSize;return this._bufferedSize=this._getSize(this._builder.append(t)),this._bufferedSize-r}_maybeFlush(t,r){r!=null&&(this._bufferedSize>=r.desiredSize&&++this._numChunks&&this._enqueue(r,t.toVector()),t.finished&&((t.length>0||this._numChunks===0)&&++this._numChunks&&this._enqueue(r,t.toVector()),!this._finished&&(this._finished=!0)&&this._enqueue(r,null)))}_enqueue(t,r){this._bufferedSize=0,this._controller=null,r==null?t.close():t.enqueue(r)}},WA=e=>{var t;return(t=e?.length)!==null&&t!==void 0?t:0},HA=e=>{var t;return(t=e?.byteLength)!==null&&t!==void 0?t:0}});function t0(e,t){let r=new Jn,n=null,i=new ReadableStream({cancel(){return Y(this,void 0,void 0,function*(){yield r.close()})},start(a){return Y(this,void 0,void 0,function*(){yield s(a,n||(n=yield o()))})},pull(a){return Y(this,void 0,void 0,function*(){n?yield s(a,n):a.close()})}});return{writable:new WritableStream(r,Object.assign({highWaterMark:Math.pow(2,14)},e)),readable:i};function o(){return Y(this,void 0,void 0,function*(){return yield(yield Kr.from(r)).open(t)})}function s(a,c){return Y(this,void 0,void 0,function*(){let l=a.desiredSize,h=null;for(;!(h=yield c.next()).done;)if(a.enqueue(h.value),l!=null&&--l<=0)return;a.close()})}}var KA=w(()=>{an();Fs();Hu()});function e0(e,t){let r=new this(e),n=new mn(r),i=new ReadableStream({cancel(){return Y(this,void 0,void 0,function*(){yield n.cancel()})},pull(s){return Y(this,void 0,void 0,function*(){yield o(s)})},start(s){return Y(this,void 0,void 0,function*(){yield o(s)})}},Object.assign({highWaterMark:Math.pow(2,14)},t));return{writable:new WritableStream(r,e),readable:i};function o(s){return Y(this,void 0,void 0,function*(){let a=null,c=s.desiredSize;for(;a=yield n.read(c||null);)if(s.enqueue(a),c!=null&&(c-=a.byteLength)<=0)return;s.close()})}}var XA=w(()=>{an();Fs()});function r0(e){let t=Kr.from(e);return Tn(t)?t.then(r=>r0(r)):t.isAsync()?t.readAll().then(r=>new ce(r)):new ce(t.readAll())}function pM(e,t="stream",r=null){let n={compressionType:r};return(t==="stream"?Bo:Lo).writeAll(e,n).toUint8Array(!0)}var ZA=w(()=>{pc();us();Hu();Qp()});var gM={};Zr(gM,{isArrowData:()=>s0,isArrowDataType:()=>o0,isArrowField:()=>i0,isArrowRecordBatch:()=>c0,isArrowSchema:()=>n0,isArrowTable:()=>l0,isArrowVector:()=>a0});function n0(e){return _t.isSchema(e)}function i0(e){return Z.isField(e)}function o0(e){return z.isDataType(e)}function s0(e){return ut.isData(e)}function a0(e){return $.isVector(e)}function c0(e){return Zt.isRecordBatch(e)}function l0(e){return ce.isTable(e)}var yM=w(()=>{Rr();te();Xn();Ar();Po();pc()});var JA,wM=w(()=>{Ym();Ml();Ne();Xn();te();pc();Ar();fn();Rr();Cu();mp();me();Vu();I_();z_();A_();P_();R_();C_();O_();D_();q_();k_();B_();L_();W_();$_();H_();Lp();Fp();Dp();F_();U_();N_();G_();V_();j_();Fs();Hu();Qp();ZA();$p();Hp();Ds();Po();yM();Km();b_();Va();Ru();Je();Ol();xu();Np();yM();Wu();JA=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},jw),M_),s_),Ww),hw),o_),zw),T_),gM),{compareSchemas:mc,compareFields:MA,compareTypes:zp})});var _c={};Zr(_c,{AsyncByteQueue:()=>Jn,AsyncByteStream:()=>mn,AsyncMessageReader:()=>yc,AsyncRecordBatchFileReader:()=>jl,AsyncRecordBatchStreamReader:()=>Ro,Binary:()=>ln,BinaryBuilder:()=>So,BinaryView:()=>Mt,BinaryViewBuilder:()=>To,Bool:()=>Er,BoolBuilder:()=>Ha,BufferType:()=>xe,Builder:()=>oe,ByteStream:()=>Qn,CompressionType:()=>ur,Data:()=>ut,DataType:()=>z,DateBuilder:()=>Hi,DateDay:()=>Ms,DateDayBuilder:()=>Gs,DateMillisecond:()=>bs,DateMillisecondBuilder:()=>zs,DateUnit:()=>Qt,Date_:()=>jr,Decimal:()=>hn,DecimalBuilder:()=>Vs,DenseUnion:()=>yo,DenseUnionBuilder:()=>fc,Dictionary:()=>We,DictionaryBuilder:()=>$a,Duration:()=>Wr,DurationBuilder:()=>ti,DurationMicrosecond:()=>Iu,DurationMicrosecondBuilder:()=>Ys,DurationMillisecond:()=>Tu,DurationMillisecondBuilder:()=>$s,DurationNanosecond:()=>Au,DurationNanosecondBuilder:()=>Ks,DurationSecond:()=>Eu,DurationSecondBuilder:()=>Hs,Field:()=>Z,FixedSizeBinary:()=>un,FixedSizeBinaryBuilder:()=>ks,FixedSizeList:()=>_e,FixedSizeListBuilder:()=>Ya,Float:()=>Sr,Float16:()=>wi,Float16Builder:()=>Ka,Float32:()=>kr,Float32Builder:()=>Xa,Float64:()=>On,Float64Builder:()=>Za,FloatBuilder:()=>$i,Int:()=>Se,Int16:()=>Pn,Int16Builder:()=>Qa,Int32:()=>Ve,Int32Builder:()=>tc,Int64:()=>Rn,Int64Builder:()=>ec,Int8:()=>An,Int8Builder:()=>Ja,IntBuilder:()=>$r,Interval:()=>Tr,IntervalBuilder:()=>Ei,IntervalDayTime:()=>Ps,IntervalDayTimeBuilder:()=>qs,IntervalMonthDayNano:()=>vu,IntervalMonthDayNanoBuilder:()=>Ws,IntervalUnit:()=>Lt,IntervalYearMonth:()=>Rs,IntervalYearMonthBuilder:()=>js,JSONMessageReader:()=>wc,LargeBinary:()=>_i,LargeBinaryBuilder:()=>vo,LargeList:()=>Bn,LargeListBuilder:()=>ac,LargeUtf8:()=>Mi,LargeUtf8Builder:()=>oa,List:()=>je,ListBuilder:()=>sc,MapBuilder:()=>cc,MapRow:()=>Kn,Map_:()=>Ir,Message:()=>Nr,MessageHeader:()=>Nt,MessageReader:()=>sa,MetadataVersion:()=>Xt,Null:()=>De,NullBuilder:()=>lc,Precision:()=>Vt,RecordBatch:()=>Zt,RecordBatchFileReader:()=>Co,RecordBatchFileWriter:()=>Lo,RecordBatchJSONWriter:()=>Yu,RecordBatchReader:()=>Kr,RecordBatchStreamReader:()=>Ti,RecordBatchStreamWriter:()=>Bo,RecordBatchWriter:()=>Ki,Schema:()=>_t,SparseUnion:()=>Cs,SparseUnionBuilder:()=>uc,Struct:()=>Yt,StructBuilder:()=>hc,StructRow:()=>qi,Table:()=>ce,Time:()=>fr,TimeBuilder:()=>ri,TimeMicrosecond:()=>vs,TimeMicrosecondBuilder:()=>ra,TimeMillisecond:()=>Ss,TimeMillisecondBuilder:()=>ea,TimeNanosecond:()=>Es,TimeNanosecondBuilder:()=>na,TimeSecond:()=>xs,TimeSecondBuilder:()=>ta,TimeUnit:()=>q,Timestamp:()=>dr,TimestampBuilder:()=>ei,TimestampMicrosecond:()=>Is,TimestampMicrosecondBuilder:()=>Js,TimestampMillisecond:()=>ki,TimestampMillisecondBuilder:()=>Zs,TimestampNanosecond:()=>As,TimestampNanosecondBuilder:()=>Qs,TimestampSecond:()=>Ts,TimestampSecondBuilder:()=>Xs,Type:()=>x,Uint16:()=>Nn,Uint16Builder:()=>nc,Uint32:()=>Vr,Uint32Builder:()=>ic,Uint64:()=>yi,Uint64Builder:()=>oc,Uint8:()=>Cn,Uint8Builder:()=>rc,Union:()=>Hr,UnionBuilder:()=>Eo,UnionMode:()=>jt,Utf8:()=>vr,Utf8Builder:()=>ia,Utf8View:()=>qr,Utf8ViewBuilder:()=>dc,Vector:()=>$,Visitor:()=>rt,builderThroughAsyncIterable:()=>J_,builderThroughIterable:()=>kp,compressionRegistry:()=>aa,isArrowData:()=>s0,isArrowDataType:()=>o0,isArrowField:()=>i0,isArrowRecordBatch:()=>c0,isArrowSchema:()=>n0,isArrowTable:()=>l0,isArrowVector:()=>a0,makeBuilder:()=>vi,makeData:()=>Q,makeTable:()=>Q_,makeVector:()=>Wi,tableFromArrays:()=>tM,tableFromIPC:()=>r0,tableFromJSON:()=>Z_,tableToIPC:()=>pM,util:()=>JA,vectorFromArray:()=>Vl});var $l=w(()=>{au();me();Hu();Qp();jA();YA();KA();XA();wM();wM();lr.toDOMStream=qA;oe.throughDOM=$A;Kr.throughDOM=t0;Co.throughDOM=t0;Ti.throughDOM=t0;Ki.throughDOM=e0;Lo.throughDOM=e0;Bo.throughDOM=e0});function h0(e){return{fields:e.fields.map(t=>Mc(t)),metadata:rP(e.metadata)}}function rP(e){return Object.fromEntries(e)}function _M(e){return e?new Map(Object.entries(e)):new Map}function Mc(e){return{name:e.name,type:nP(e.type),nullable:e.nullable,metadata:rP(e.metadata)}}function Do(e,t){return new Z(e.name,u0(e.type,t),e.nullable,_M(e.metadata))}function nP(e){if(QA(e,"BinaryView"))return"binary-view";if(QA(e,"Utf8View"))return"utf8-view";if(xD(e,"LargeList"))return{type:"large-list",children:[Mc(e.valueField)]};switch(e.constructor){case De:return"null";case ln:return"binary";case un:return{type:"fixed-size-binary",byteWidth:e.byteWidth};case Er:return"bool";case Se:let t=e;return`${t.isSigned?"":"u"}int${t.bitWidth}`;case An:return"int8";case Pn:return"int16";case Ve:return"int32";case Rn:return"int64";case Cn:return"uint8";case Nn:return"uint16";case Vr:return"uint32";case yi:return"uint64";case Sr:switch(e.precision){case Vt.HALF:return"float16";case Vt.SINGLE:return"float32";case Vt.DOUBLE:return"float64";default:return"float16"}case wi:return"float16";case kr:return"float32";case On:return"float64";case vr:return"utf8";case hn:let n=e;return{type:"decimal",bitWidth:n.bitWidth,precision:n.precision,scale:n.scale};case jr:return e.unit===Qt.DAY?"date-day":"date-millisecond";case Ms:return"date-day";case bs:return"date-millisecond";case fr:switch(e.unit){case q.SECOND:return"time-second";case q.MILLISECOND:return"time-millisecond";case q.MICROSECOND:return"time-microsecond";case q.NANOSECOND:return"time-nanosecond";default:return"time-second"}case Ss:return"time-millisecond";case xs:return"time-second";case vs:return"time-microsecond";case Es:return"time-nanosecond";case dr:switch(e.unit){case q.SECOND:return"timestamp-second";case q.MILLISECOND:return"timestamp-millisecond";case q.MICROSECOND:return"timestamp-microsecond";case q.NANOSECOND:return"timestamp-nanosecond";default:return"timestamp-second"}case Ts:return"timestamp-second";case ki:return"timestamp-millisecond";case Is:return"timestamp-microsecond";case As:return"timestamp-nanosecond";case Tr:switch(e.unit){case Lt.DAY_TIME:return"interval-daytime";case Lt.YEAR_MONTH:return"interval-yearmonth";default:return"interval-daytime"}case Ps:return"interval-daytime";case Rs:return"interval-yearmonth";case Ir:let c=e;return{type:"map",keysSorted:c.keysSorted,children:c.children.map(p=>Mc(p))};case je:let h=e.valueField;return{type:"list",children:[Mc(h)]};case _e:let u=e;return{type:"fixed-size-list",listSize:u.listSize,children:[Mc(u.children[0])]};case Yt:return{type:"struct",children:e.children.map(p=>Mc(p))};case Cs:case yo:let d=e;return{type:d instanceof yo?"dense-union":"sparse-union",typeIds:d.typeIds,children:d.children.map(p=>Mc(p)),typeIdToChildIndex:{...d.typeIdToChildIndex}};case We:let m=e;return{type:"dictionary",id:m.id,indices:SD(m.indices),dictionary:nP(m.dictionary),isOrdered:m.isOrdered};default:throw new Error(`arrow type not supported: ${e.constructor.name}`)}}function u0(e,t){if(typeof e=="object")switch(e.type){case"decimal":return new hn(e.scale,e.precision,e.bitWidth);case"map":{let r=e.children.map(n=>Do(n,t));return new Ir(r[0],e.keysSorted)}case"list":{let r=Do(e.children[0],t);return new je(r)}case"large-list":{let r=Do(e.children[0],t),n=Ku("LargeList");if(!n)throw new Error("LargeList requires an Apache Arrow runtime that exports the LargeList constructor");return new n(r)}case"fixed-size-list":{let r=Do(e.children[0],t);return new _e(e.listSize,r)}case"fixed-size-binary":return new un(e.byteWidth);case"struct":{let r=e.children.map(n=>Do(n,t));return new Yt(r)}case"sparse-union":case"dense-union":{let r=e.children.map(n=>Do(n,t));return e.type==="dense-union"?new yo(e.typeIds,r):new Cs(e.typeIds,r)}case"dictionary":return new We(u0(e.dictionary,t),ED(e.indices),e.id,e.isOrdered);default:throw new Error("array type not supported")}switch(e){case"null":return new De;case"binary":return tP("BinaryView",new ln,t);case"binary-view":return eP("BinaryView");case"bool":return new Er;case"int8":return new An;case"int16":return new Pn;case"int32":return new Ve;case"int64":return new Rn;case"uint8":return new Cn;case"uint16":return new Nn;case"uint32":return new Vr;case"uint64":return new yi;case"float16":return new wi;case"float32":return new kr;case"float64":return new On;case"utf8":return tP("Utf8View",new vr,t);case"utf8-view":return eP("Utf8View");case"date-day":return new Ms;case"date-millisecond":return new bs;case"time-second":return new xs;case"time-millisecond":return new Ss;case"time-microsecond":return new vs;case"time-nanosecond":return new Es;case"timestamp-second":return new Ts;case"timestamp-millisecond":return new ki;case"timestamp-microsecond":return new Is;case"timestamp-nanosecond":return new As;case"interval-daytime":return new Ps;case"interval-yearmonth":return new Rs;default:throw new Error("array type not supported")}}function Ku(e){return _c[e]}function QA(e,t){let r=Ku(t);if(r&&e instanceof r)return!0;let n=z;return!!(t==="BinaryView"?n.isBinaryView:n.isUtf8View)?.(e)}function xD(e,t){let r=Ku(t);return!!(r&&e instanceof r)}function tP(e,t,r){let n=r?.viewTypes||"never";if(n==="never")return t;let i=Ku(e);if(i)return new i;if(n==="require")throw new Error(`${e} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`);return t}function eP(e){let t=Ku(e);if(!t)throw new Error(`${e} requires apache-arrow 21.2.0 or later; the installed runtime does not support it`);return new t}function SD(e){if(e instanceof Se){let r=`${e.isSigned?"int":"uint"}${e.bitWidth}`;if(vD(r))return r}switch(e.constructor){case An:return"int8";case Pn:return"int16";case Ve:return"int32";case Cn:return"uint8";case Nn:return"uint16";case Vr:return"uint32";default:throw new Error(`arrow dictionary index type not supported: ${e.constructor.name}`)}}function vD(e){return["int8","int16","int32","uint8","uint16","uint32"].includes(e)}function ED(e){switch(e){case"int8":return new An;case"int16":return new Pn;case"int32":return new Ve;case"uint8":return new Cn;case"uint16":return new Nn;case"uint32":return new Vr;default:throw new Error(`schema dictionary index type not supported: ${e}`)}}var f0=w(()=>{"use strict";$l()});function MM(e){let t=e?.POSITION;if(!t||!("value"in t)||!t.value.length)return null;let r=1/0,n=1/0,i=1/0,o=-1/0,s=-1/0,a=-1/0,c=t.value,l=c.length;for(let h=0;h<l;h+=3){let u=c[h],f=c[h+1],d=c[h+2];r=u<r?u:r,n=f<n?f:n,i=d<i?d:i,o=u>o?u:o,s=f>s?f:s,a=d>a?d:a}return[[r,n,i],[o,s,a]]}var iP=w(()=>{"use strict"});function bM(e){let t=Lf();return new t(e)}function ca(e){return!!(Rc&&e instanceof Rc)}function xM(e,t,r){ca(e)?e[t]=r:e[t]=oP(r)}function SM(e,t){return ca(e)?e[t]:TD(e[t])}function Xu(e){return ca(e)?new Uint16Array(e.buffer,e.byteOffset,e.length):e}function oP(e){if(!Number.isFinite(e))return e===1/0?31744:e===-1/0?64512:32256;let t=e<0||Object.is(e,-0)?32768:0,r=Math.abs(e);if(r===0)return t;if(r>=65520)return t|31744;if(r>=65504)return t|31743;let n=Math.floor(Math.log2(r));if(n<-14)return t|Math.round(r/2**-24);let i=n+15,o=Math.round((r/2**n-1)*1024);return o===1024?t|i+1<<10:t|i<<10|o}function TD(e){let t=e&32768?-1:1,r=e>>10&31,n=e&1023;return r===0?t*n*2**-24:r===31?n?NaN:t*(1/0):t*(1+n/1024)*2**(r-15)}var sP=w(()=>{"use strict";qt()});var d0,vM,aP=w(()=>{"use strict";$l();d0=new _t([new Z("POSITION",new _e(3,new Z("value",new kr,!1)),!1)]),vM=new _t([...d0.fields,new Z("indices",new je(new Z("item",new Vr,!1)),!0)])});var Zu=w(()=>{"use strict";sP();aP()});function cP(e){return e.type instanceof _e?e.type.listSize:1}function EM(e,t,r){let n=ID(e,t,r);return new $([n])}function ID(e,t,r){let n=AD(e,t,r),i=n.children[0].type,o=r==="float16"&&ca(e)?Xu(e):e,s={[xe.DATA]:o},a=new ut(i,0,o.length,0,s);return new ut(n,0,o.length/t,0,void 0,[a])}function AD(e,t,r){let n=r||t3(e).type,i=u0(n);return new _e(t,new Z("value",i,!1))}var TM=w(()=>{"use strict";Zu();$l();e3();f0()});function IM(e,t){switch(t){case"columnar-table":return PD(e);case"arrow-table":return RD(e);default:throw new Error(t)}}function PD(e){let t={},r=uP(e);for(let[n,i]of Object.entries(e.attributes))t[n]=i.value;return{shape:"columnar-table",schema:e.schema,data:t,topology:e.topology,indices:r?e.indices:void 0}}function RD(e,t){return hP(e.attributes,{schema:e.schema,topology:e.topology,mode:e.mode,boundingBox:e.header?.boundingBox,indices:uP(e)?e.indices:void 0})}function hP(e,t={}){let r=[],n={},i=ND(e);for(let c of i){let l=e[c],{value:h,size:u=1}=l,f=CD(h,u,l.componentType);if(n[c]=f,r.push(OD(t.schema,c,f,l.componentType)),c==="POSITION"&&t.indices?.value?.length){let d=vM.fields.find(m=>m.name==="indices");n.indices=LD(t.indices.value,f.length,d.type),r.push(d)}}let o=new _t(r,DD(t)),s=n[i[0]]?.length===0?new ce(o):new ce(o,n);return{shape:"arrow-table",schema:h0(s.schema),data:s,topology:t.topology||"point-list",indices:t.indices}}function CD(e,t,r){if(r==="float16"){let n=ca(e)?Xu(e):e;if(t===1){let i=new ut(new wi,0,n.length,0,{[xe.DATA]:n});return new $([i])}return EM(e,t,r)}return t===1?Wi(e):EM(e,t)}function ND(e){let t=Object.keys(e),r=lP.filter(i=>i in e),n=t.filter(i=>!lP.includes(i));return[...r,...n]}function uP(e){return!!e.indices?.value?.length}function OD(e,t,r,n){if(t==="POSITION"&&BD(r)){let o=d0.fields[0],s=e?.fields.find(c=>c.name===t);if(!s?.metadata)return o;let a=new Map(o.metadata);for(let[c,l]of Object.entries(s.metadata))a.set(c,l);return new Z(o.name,o.type,o.nullable,a)}let i=e?.fields.find(o=>o.name===t);if(n==="float16"){let o=new Map(Object.entries(i?.metadata||{}));return o.set("componentType","float16"),new Z(t,r.type,!1,o)}if(i&&i.type.toString()!==r.type.toString()){let o=Do(i);return new Z(t,r.type,o.nullable,o.metadata)}return i?Do(i):new Z(t,r.type,!1)}function BD(e){return e.type instanceof _e&&e.type.listSize===3&&e.type.children[0].type instanceof kr}function LD(e,t,r){let n=r,i=e instanceof Uint32Array?e:Uint32Array.from(e),o=new Int32Array(t+1);t>0&&o.fill(i.length,1);let s=new Uint8Array(Math.ceil(t/8));t>0&&(s[0]=1);let a=new ut(n.children[0].type,0,i.length,0,{[xe.DATA]:i}),c=new ut(n,0,t,Math.max(0,t-1),{[xe.OFFSET]:o,[xe.VALIDITY]:s},[a]);return new $([c])}function DD(e){let t={...e.schema?.metadata};return e.topology&&(t.topology||=e.topology),Number.isFinite(e.mode)&&(t.mode||=String(e.mode)),e.boundingBox&&(t.boundingBox||=JSON.stringify(e.boundingBox)),_M(t)}var lP,fP=w(()=>{"use strict";Zu();Zu();$l();TM();f0();lP=["POSITION"]});function dP(e){if(e.shape==="arrow-table")return FD(e);throw new Error(e.shape)}function FD(e){let t=e.data,r=h0(t.schema),n=r.fields,i={},o=[];for(let h of n){let{name:u}=h;if(u==="indices")continue;let f=t.getChild(u),d=cP(f),m=kD(f,d),p=GD(h.metadata),g=p.componentType==="float16"?qD(m):m,y=o.find(_=>_.data.length===f.data.length&&i[_.name].value.constructor===g.constructor&&_.data.every((M,b)=>mP(M,f.data[b])));i[u]={value:y?i[y.name].value:g,size:d,...p},y||o.push({name:u,data:f.data})}VD(r);let s=r.metadata.topology,a=jD(r),c=WD(t),l=i.POSITION?.transform?.type==="quantization"?UD(r)||MM(i):MM(i);return{schema:r,attributes:i,topology:s,mode:a,indices:c,header:{vertexCount:t.numRows,boundingBox:l??void 0}}}function UD(e){let t=e.metadata?.boundingBox;if(!t)return null;try{let r=JSON.parse(t);if(Array.isArray(r)&&r.length===2&&r.every(n=>Array.isArray(n)&&n.length===3&&n.every(i=>typeof i=="number")))return r}catch{}return null}function GD(e={}){let t={};if(e.byteOffset!==void 0&&(t.byteOffset=Number(e.byteOffset)),e.byteStride!==void 0&&(t.byteStride=Number(e.byteStride)),e.normalized!==void 0&&(t.normalized=e.normalized==="true"),e.componentType==="float16"&&(t.componentType="float16"),e["loaders.gl.transform"])try{let r=JSON.parse(e["loaders.gl.transform"]);zD(r)&&(t.transform=r)}catch{}return t}function zD(e){if(!e||typeof e!="object"||!("type"in e))return!1;let t=e;return t.type==="octahedron"?Number.isInteger(t.bits)&&t.bits>=1&&t.bits<=30:t.type==="quantization"&&Number.isInteger(t.bits)&&t.bits>=1&&t.bits<=30&&Array.isArray(t.origin)&&t.origin.every(r=>typeof r=="number")&&typeof t.range=="number"}function VD(e){e.metadata||={},e.metadata.topology||="point-list",e.metadata.mode||="0"}function kD(e,t){if(!(e.type instanceof _e))return e.toArray();let n=e.data[0].children[0].values.constructor,i=new n(e.length*t),o=0;for(let s of e.data){let a=s.children[0],c=s.length*t,l=a.offset||s.offset*t,h=l+c<=a.values.length?l:0,u=a.values.subarray(h,h+c);i.set(u,o),o+=c}return i}function qD(e){let t=bM(e.length);for(let r=0;r<e.length;r++)xM(t,r,SM(e,r));return t}function jD(e){let t=Number(e.metadata?.mode);return Number.isFinite(t)?t:0}function WD(e){let t=e.getChild("indices");if(!t?.isValid(0))return;let r=t.data[0],n=r.valueOffsets,i=n[r.offset],o=n[r.offset+1];return{value:r.children[0].values.subarray(i,o),size:1}}function mP(e,t){let r=Object.values(t.buffers);return e.type.toString()===t.type.toString()&&e.offset===t.offset&&e.length===t.length&&e.nullCount===t.nullCount&&e.dictionary===t.dictionary&&Object.values(e.buffers).every((n,i)=>{let o=r[i];return n===o||!!(n&&o&&n.buffer===o.buffer&&n.byteOffset===o.byteOffset&&n.byteLength===o.byteLength)})&&e.children.length===t.children.length&&e.children.every((n,i)=>mP(n,t.children[i]))}var pP=w(()=>{"use strict";Zu();$l();TM();f0();iP()});function gP(e){return[e.value.constructor.name,e.value.byteOffset,e.value.byteLength,e.size,e.byteOffset??0,e.byteStride||e.size*e.value.BYTES_PER_ELEMENT].join(":")}var Ju,yP=w(()=>{"use strict";pP();Ju=class{ready;sourcePointCount=0;get pointCount(){return this.sourcePointCount}controller=new AbortController;options;signal;mesh=null;nodes=new Map;indexBytes=0;pointByteLength=0;constructor(t,r={}){this.options={nodePointLimit:r.nodePointLimit??5e4,maximumDepth:r.maximumDepth??16,maxInputBytes:r.maxInputBytes??512*1024*1024,maxIndexBytes:r.maxIndexBytes??128*1024*1024,maxTileBytes:r.maxTileBytes??64*1024*1024,maxNodes:r.maxNodes??1e5};for(let[n,i]of Object.entries(this.options))if(!Number.isSafeInteger(i)||i<(n==="maximumDepth"?0:1))throw new Error(`PointCloudTiler: invalid ${n}`);if(this.options.maximumDepth>24||this.options.nodePointLimit>1e6)throw new Error("PointCloudTiler: maximumDepth must be <= 24 and nodePointLimit <= 1000000");this.signal=r.signal?AbortSignal.any([r.signal,this.controller.signal]):this.controller.signal,this.ready=this.initialize(t).catch(n=>{throw this.close(),n})}async getRootNode(){return await this.ready,this.getNode("r").node}async getNodeMetadata(t){return await this.ready,this.getNode(t).node}async getChildNodes(t){await this.ready;let r=this.getNode(t);return r.childrenPromise||(r.childrenPromise=this.splitNode(r)),r.childrenPromise}async splitNode(t){let r=t.node.id;if(t.children)return t.children;let n=Array.from({length:8},()=>0),i=t.node.bounds[0].map((a,c)=>a+(t.node.bounds[1][c]-a)/2);for(let a=0;a<t.remaining.length;a++)a%65536===0&&await this.checkpoint(),n[this.getOctant(t.remaining[a],i)]++;if(this.nodes.size+n.filter(a=>a>0).length>this.options.maxNodes)throw new Error("PointCloudTiler: node budget exceeded");let o=[],s=[];try{for(let c of n)s.push(this.allocateRows(c));let a=new Uint32Array(8);for(let c=0;c<t.remaining.length;c++){c%65536===0&&await this.checkpoint();let l=t.remaining[c],h=this.getOctant(l,i);s[h][a[h]++]=l}for(let c=0;c<8;c++){if(!s[c].length)continue;let l=t.node.bounds.map(u=>[...u]);for(let u=0;u<3;u++)l[c&4>>u?0:1][u]=i[u];let h=await this.createNode(`${r}${c}`,l,s[c]);s[c]=new Uint32Array(0),o.push(h.node)}return this.releaseRows(t.remaining),t.remaining=new Uint32Array(0),t.children=Object.freeze(o),t.children}catch(a){throw this.close(),a}}async getTileMesh(t){await this.ready;let r=this.getNode(t);if(r.rows.length*this.pointByteLength>this.options.maxTileBytes)throw new Error("PointCloudTiler: tile byte budget exceeded");let i={},o=new Map;for(let[s,a]of Object.entries(this.mesh.attributes)){let c=gP(a),l=o.get(a.value.buffer)?.get(c);if(l){i[s]={...a,value:l,byteOffset:0,byteStride:0};continue}let h=a.value.constructor,u=new h(r.rows.length*a.size),f=new Uint8Array(a.value.buffer,a.value.byteOffset,a.value.byteLength),d=new Uint8Array(u.buffer,u.byteOffset,u.byteLength),m=a.value.BYTES_PER_ELEMENT,p=a.size*m,g=a.byteStride||p;for(let _=0;_<r.rows.length;_++){_%65536===0&&await this.checkpoint();let M=(a.byteOffset||0)+r.rows[_]*g;d.set(f.subarray(M,M+p),_*p)}let y=o.get(a.value.buffer)??new Map;y.set(c,u),o.set(a.value.buffer,y),i[s]={...a,value:u,byteOffset:0,byteStride:0}}return{...this.mesh,attributes:i,topology:"point-list",mode:0,indices:void 0,header:{vertexCount:r.rows.length,boundingBox:r.node.bounds.map(s=>[...s])},loaderData:{...this.mesh.loaderData,pointCloudTileId:t}}}close(){this.controller.abort(new Error("PointCloudTiler: closed")),this.mesh=null,this.nodes.clear(),this.indexBytes=0}async initialize(t){if(this.signal.throwIfAborted(),"shape"in t){let f=new Set,d=0,m=p=>{if(p.nullCount)throw new Error("PointCloudTiler: null point attributes require an explicit mapping");for(let g of Object.values(p.buffers))g&&!f.has(g.buffer)&&(f.add(g.buffer),d+=g.buffer.byteLength);for(let g of p.children)m(g);if(p.dictionary)for(let g of p.dictionary.data)m(g)};for(let p of t.data.batches)m(p.data);if(d>this.options.maxInputBytes)throw new Error("PointCloudTiler: input byte budget exceeded");for(let p of t.data.schema.fields)if(t.data.getChild(p.name)?.nullCount)throw new Error("PointCloudTiler: null point attributes require an explicit mapping")}let r="shape"in t?dP(t):t;if(r.topology!=="point-list"||r.indices)throw new Error("PointCloudTiler: unindexed point-list input required");let n=r.attributes.POSITION;if(!n||n.size!==3||!(n.value instanceof Float32Array||n.value instanceof Float64Array)||n.transform||n.normalized||n.componentType==="float16")throw new Error("PointCloudTiler: POSITION requires decoded floating-point XYZ");if(!r.header&&(n.byteOffset||n.byteStride))throw new Error("PointCloudTiler: strided POSITION requires vertexCount");let i=r.header?.vertexCount??n.value.length/3;if(!Number.isSafeInteger(i)||i<0||i>4294967295)throw new Error("PointCloudTiler: invalid point count");let o=0,s=new Map,a=new Set;for(let f of Object.values(r.attributes)){this.validateAttribute(f,i),a.has(f.value.buffer)||(a.add(f.value.buffer),o+=f.value.buffer.byteLength);let d=s.get(f.value.buffer)??new Set,m=gP(f);d.has(m)||(this.pointByteLength+=f.size*f.value.BYTES_PER_ELEMENT,d.add(m),s.set(f.value.buffer,d))}if(o>this.options.maxInputBytes)throw new Error("PointCloudTiler: input byte budget exceeded");this.mesh=r,this.sourcePointCount=i;let c=this.allocateRows(i),l=[1/0,1/0,1/0],h=[-1/0,-1/0,-1/0];for(let f=0;f<i;f++){f%65536===0&&await this.checkpoint(),c[f]=f;for(let d=0;d<3;d++){let m=this.getCoordinate(f,d);if(!Number.isFinite(m))throw new Error("PointCloudTiler: nonfinite position");l[d]=Math.min(l[d],m),h[d]=Math.max(h[d],m)}}i||(l.fill(0),h.fill(0));let u=Math.max(...l.map((f,d)=>h[d]-f));if(!Number.isFinite(u))throw new Error("PointCloudTiler: coordinate extent overflow");for(let f=0;f<3;f++)h[f]=l[f]+u;if(!h.every(Number.isFinite)||!Number.isFinite(Math.hypot(u,u,u)))throw new Error("PointCloudTiler: coordinate extent overflow");await this.createNode("r",[l,h],c),this.signal.throwIfAborted()}async createNode(t,r,n){let i=t.length-1>=this.options.maximumDepth||r[0].every((c,l)=>c===r[1][l])||n.length<=this.options.nodePointLimit,o=n,s=new Uint32Array(0);if(!i){let c=Math.ceil(Math.cbrt(this.options.nodePointLimit)),l=new Set,h=this.allocateRows(Math.min(n.length,this.options.nodePointLimit)),u=this.allocateRows(n.length),f=0,d=0;for(let m=0;m<n.length;m++){m%65536===0&&await this.checkpoint();let p=n[m],g=0;for(let y=0;y<3;y++){let _=Math.min(c-1,Math.floor((this.getCoordinate(p,y)-r[0][y])/(r[1][y]-r[0][y])*c));g=g*c+_}f<h.length&&!l.has(g)?(l.add(g),h[f++]=p):u[d++]=p}o=h.subarray(0,f),s=u.subarray(0,d),this.releaseRows(n)}let a={node:{id:t,level:t.length-1,pointCount:o.length,bounds:r,geometricError:s.length?Math.hypot(...r[0].map((c,l)=>r[1][l]-c)):0},rows:o,remaining:s};if(Object.freeze(r[0]),Object.freeze(r[1]),Object.freeze(r),Object.freeze(a.node),this.signal.throwIfAborted(),this.nodes.size>=this.options.maxNodes)throw new Error("PointCloudTiler: node budget exceeded");return this.nodes.set(t,a),a}getCoordinate(t,r){let n=this.mesh.attributes.POSITION;return Number(n.value[(n.byteOffset||0)/n.value.BYTES_PER_ELEMENT+t*(n.byteStride||3*n.value.BYTES_PER_ELEMENT)/n.value.BYTES_PER_ELEMENT+r])}validateAttribute(t,r){let n=t.value?.BYTES_PER_ELEMENT,i=t.byteOffset??0,o=t.byteStride||t.size*n;if(!n||!Number.isSafeInteger(t.size)||t.size<1||!Number.isSafeInteger(i)||i<0||i%n||!Number.isSafeInteger(o)||o<t.size*n||o%n||r&&i+(r-1)*o+t.size*n>t.value.byteLength)throw new Error("PointCloudTiler: invalid attribute layout")}allocateRows(t){if(t*4>this.options.maxIndexBytes-this.indexBytes)throw new Error("PointCloudTiler: index byte budget exceeded");let r=new Uint32Array(t);return this.indexBytes+=r.byteLength,r}releaseRows(t){this.indexBytes-=t.buffer.byteLength}getNode(t){this.signal.throwIfAborted();let r=this.nodes.get(t);if(!r)throw new Error(`PointCloudTiler: unknown tile ${t}`);return r}getOctant(t,r){let n=0;for(let i=0;i<3;i++)this.getCoordinate(t,i)>=r[i]&&(n|=4>>i);return n}async checkpoint(){this.signal.throwIfAborted(),await new Promise(t=>setTimeout(t,0)),this.signal.throwIfAborted()}}});var wP=w(()=>{"use strict";fP();yP()});var m0,_P=w(()=>{"use strict";co();wP();m0=class extends Bh{ready;isReady=!1;tiler;constructor(t,r={},n){super(null,r,{pointCloudTiler:{}},n),this.tiler=new Ju(t,r.pointCloudTiler),this.ready=this.tiler.getRootNode().then(()=>{this.isReady=!0}),this.ready.catch(()=>{})}async initialize(){await this.ready,await this.tiler.getRootNode()}async getMetadata(){return await this.initialize(),{pointCount:this.tiler.pointCount,refinement:"ADD"}}async getRootTile(){return this.createHeader(await this.tiler.getRootNode())}async getChildren(t){return(await this.tiler.getChildNodes(t.id)).map(r=>this.createHeader(r))}async loadTileContent(t){let r=await this.tiler.getTileMesh(t.id);return r.header.vertexCount?{data:IM(r,"arrow-table"),pointCount:r.header.vertexCount,cartographicOrigin:[0,0,0],coordinateSystem:"cartesian",spatialReference:this.options.pointCloudTiler.spatialReference,spatialBoundingVolume:this.createHeader(await this.tiler.getNodeMetadata(t.id)).boundingVolume}:null}close(){this.tiler.close(),this.isReady=!1}createHeader(t){let r=t.bounds[0].map((i,o)=>i+(t.bounds[1][o]-i)/2),n={cartographicBounds:t.bounds.map(i=>[...i]),center:r,radius:Math.hypot(...r.map((i,o)=>t.bounds[1][o]-i)),coordinateFrame:"cartesian"};return{id:t.id,level:t.level,pointCount:t.pointCount,geometricError:t.geometricError,boundingVolume:n,spatialBoundingVolume:n}}}});var MP={};Zr(MP,{PointCloudTileSourceLoaderWithParser:()=>$D});var pft,gft,HD,$D,bP=w(()=>{"use strict";_P();AM();({preload:pft,createDataSource:gft,...HD}=p0),$D={...HD,createDataSource(e,t={},r){if(typeof e=="string"||e instanceof Blob)throw new Error("PointCloudTileSourceLoader requires decoded Mesh/Arrow input");return new m0(e,t,r)}}});async function KD(){let{PointCloudTileSourceLoaderWithParser:e}=await Promise.resolve().then(()=>(bP(),MP));return e}var YD,p0,AM=w(()=>{"use strict";YD="5.0.0-beta.6";p0={dataType:null,batchType:null,name:"PointCloudTiler",id:"point-cloud-tiler",module:"tiles",version:YD,extensions:[],mimeTypes:[],type:"point-cloud",fromUrl:!1,fromBlob:!1,testURL:()=>!1,options:{pointCloudTiler:{}},defaultOptions:{pointCloudTiler:{}},preload:KD,createDataSource(e,t={},r){throw new Error("PointCloudTileSourceLoader requires preload() or @loaders.gl/tiles-3d/point-cloud-tile-source-loader")}}});var Qu={};Zr(Qu,{I3SSource:()=>Rm,I3SSpatialTransformer:()=>pl,IndexedArchiveTilesetSource:()=>zd,LOD_METRIC_TYPE:()=>Hc,PointCloudTile:()=>gl,PointCloudTileSourceLoader:()=>p0,PointCloudTileset:()=>Nm,SpatialCoordinateTransformer:()=>Hn,TILESET_TYPE:()=>nr,TILE_CONTENT_STATE:()=>ir,TILE_REFINEMENT:()=>ze,TILE_TYPE:()=>Oi,Tile3D:()=>bn,Tiles3DSource:()=>Tm,Tiles3DSpatialTransformer:()=>ls,Tileset3D:()=>Dd,TilesetCache:()=>Wc,TilesetTraverser:()=>Bi,applyTilesetSpatialOptions:()=>va,calculateTransformProps:()=>Pd,convertS2BoundingVolumeToOBB:()=>vm,createBoundingVolume:()=>Kc,createImplicitSubtreeReference:()=>tw,createTilesetSpatialReference:()=>Mn,get3DTilesSpatialReference:()=>Hd,getFrameState:()=>Rd,getGeoidModel:()=>bm,getI3SSpatialReference:()=>Wd,getLodStatus:()=>qd,getSpatialCoordinateFrame:()=>_n,getTileset3DTraversalSnapshot:()=>hv,isTileset3DSource:()=>Bd,markTilesetSpatialReferenceTransformed:()=>Yc,materializeImplicitSubtree:()=>Em,registerGeoidModel:()=>$y,registerGeoidModelFromPgm:()=>MI,registerSpatialCrs:()=>wI,registerSpatialDatumGrid:()=>_I,replaceImplicitUrlTemplate:()=>nu,traverseTilesetContents:()=>uv});ff(Qu,AP(BM(),1));qt();Dr();cd();co();var Id=class{item;previous;next;constructor(t,r,n){this.item=t,this.previous=r,this.next=n}};var Ad=class{head=null;tail=null;_length=0;get length(){return this._length}add(t){let r=new Id(t,this.tail,null);return this.tail?(this.tail.next=r,this.tail=r):(this.head=r,this.tail=r),++this._length,r}remove(t){t&&(t.previous&&t.next?(t.previous.next=t.next,t.next.previous=t.previous):t.previous?(t.previous.next=null,this.tail=t.previous):t.next?(t.next.previous=null,this.head=t.next):(this.head=null,this.tail=null),t.next=null,t.previous=null,--this._length)}splice(t,r){t!==r&&(this.remove(r),this._insert(t,r))}_insert(t,r){let n=t.next;t.next=r,this.tail===t?this.tail=r:n.previous=r,r.next=n,r.previous=t,++this._length}};var Wc=class{_list;_sentinel;_trimTiles;constructor(){this._list=new Ad,this._sentinel=this._list.add("sentinel"),this._trimTiles=!1}reset(){this._list.splice(this._list.tail,this._sentinel)}touch(t){let r=t._cacheNode;r&&this._list.splice(this._sentinel,r)}add(t,r,n){r._cacheNode||(r._cacheNode=this._list.add(r),n&&n(t,r))}unloadTile(t,r,n){let i=r._cacheNode;i&&(this._list.remove(i),r._cacheNode=null,n&&n(t,r))}unloadTiles(t,r){let n=this._trimTiles;this._trimTiles=!1;let i=this._list,o=this._sentinel,s=i.head;for(;s!==o&&(t.gpuMemoryUsageInBytes>t.cacheBytes||n);){let a=s.item;s=s.next,this.unloadTile(t,a,r)}}trim(){this._trimTiles=!0}};Dr();Dr();qt();co();function Pd(e,t){ai(e),ai(t);let{rtcCenter:r,gltfUpAxis:n}=t,{computedTransform:i,boundingVolume:{center:o}}=e,s=new bt(i);switch(r&&s.translate(r),n){case"Z":break;case"Y":let f=new bt().rotateX(Math.PI/2);s=s.multiplyRight(f);break;case"X":let d=new bt().rotateY(-Math.PI/2);s=s.multiplyRight(d);break;default:break}t.isQuantized&&s.translate(t.quantizedVolumeOffset).scale(t.quantizedVolumeScale);let a=new I(o);t.cartesianModelMatrix=s,t.cartesianOrigin=a;let c=pt.WGS84.cartesianToCartographic(a,new I),h=fa(pt.WGS84,a).invert();t.cartographicModelMatrix=h.multiplyRight(s),t.cartographicOrigin=c;let u=KC(t);u&&(t.cartesianModelMatrix=new bt(s).multiplyRight(u.matrix),t.cartographicModelMatrix.multiplyRight(u.matrix),u.matrix=bt.IDENTITY),t.coordinateSystem||(t.modelMatrix=t.cartographicModelMatrix)}var YC=1e6**2;function KC(e){let t=e.gltf?.json;if(!t)return null;let r=typeof t.scene=="number"?t.scene:0,i=t.scenes?.[r]?.nodes?.[0],o=i===void 0?void 0:t.nodes?.[i];if(!o?.matrix)return null;let s=o.matrix;return s[12]*s[12]+s[13]*s[13]+s[14]*s[14]<=YC?null:o}qt();ro();Dr();Dr();var OS=new I,M1=new I,XC=1e-5,ZC=1e-7,b1=new sr([new Ge,new Ge,new Ge,new Ge,new Ge,new Ge]);function Rd(e,t,r={}){let{cameraUp:n,height:i}=e,o=e.cameraDirection,{metersPerUnit:s}=e.distanceScales,a=Lh(e,e.center),c=fa(pt.WGS84,a),l=e.unprojectPosition(e.cameraPosition),h=pt.WGS84.cartographicToCartesian(l,new I),u;if(o)u=new I(c.transformAsVector(new I(o).scale(s))).normalize();else{let T=e.getFrustumPlanes().near,S=x1(T,e.cameraPosition),E=Lh(e,S);u=new I(E).subtract(h).normalize()}let f=new I(c.transformAsVector(new I(n).scale(s))).normalize();JC(e);let d=e.constructor,{longitude:m,latitude:p,width:g,bearing:y,zoom:_,position:M}=e,b=new d({longitude:m,latitude:p,height:i,width:g,bearing:y,zoom:_,position:M,pitch:0}),v=Number.isFinite(e.fovy)&&Number(e.fovy)>0&&Number(e.fovy)<180?Number(e.fovy)*Math.PI/180:Math.PI/3;return{camera:{position:h,direction:u,up:f,cartographicPosition:l,verticalFieldOfView:v,timeSinceMovement:r.timeSinceCameraMovement??Number.POSITIVE_INFINITY},viewport:e,topDownViewport:b,height:i,cullingVolume:b1,clippingPlanes:e.clippingPlanes,frameNumber:t,sseDenominator:2*Math.tan(v/2),dynamicScreenSpaceErrorDensity:0}}function BS(e,t,r,n){let i=Array.from(t),o=Array.from(r),s=e?i.length!==e.position.length||i.some((l,h)=>Math.abs(l-e.position[h])>XC):!1,a=e?o.length!==e.direction.length||o.some((l,h)=>Math.abs(l-e.direction[h])>ZC):!1,c=s||a?n:e?.lastMovementTime??Number.NEGATIVE_INFINITY;return{state:{position:i,direction:o,lastMovementTime:c},timeSinceMovement:Math.max((n-c)/1e3,0)}}function LS(e,t,r){if(r===0||e.length<=r)return[e,[]];let n=[],{longitude:i,latitude:o}=t.viewport;for(let[l,h]of e.entries()){let[u,f]=h.header.mbs,d=Math.abs(i-u),m=Math.abs(o-f),p=Math.sqrt(m*m+d*d);n.push([l,p])}let s=n.sort((l,h)=>l[1]-h[1]),a=[];for(let l=0;l<r;l++)a.push(e[s[l][0]]);let c=[];for(let l=r;l<s.length;l++)c.push(e[s[l][0]]);return[a,c]}function JC(e){let t=e.getFrustumPlanes(),r=x1(t.near,e.cameraPosition),n=Lh(e,r),i=Lh(e,e.cameraPosition,M1),o=0;b1.planes[o++].fromPointNormal(n,OS.copy(n).subtract(i));for(let s in t){if(s==="near")continue;let a=t[s],c=x1(a,r,M1),l=Lh(e,c,M1);b1.planes[o++].fromPointNormal(l,OS.copy(n).subtract(l))}}function x1(e,t,r=new I){let n=e.normal.dot(t);return r.copy(e.normal).scale(e.distance-n).add(t),r}function Lh(e,t,r=new I){let n=e.unprojectPosition(t);return pt.WGS84.cartographicToCartesian(n,r)}qt();var zS=new I,QC=new I,Sa=new I,DS=new I,Dh=new I,FS=new I,US=new I,GS=new I,Cd=new Xi,tN=new I(0,0,1);function VS(e,t){e._updateTransform(t)}function kS(e,t,r){if(!Number.isFinite(r.dynamicScreenSpaceErrorDensity)||r.dynamicScreenSpaceErrorDensity<=0)return 0;let n=iN(e),i=n.region?oN(n.region,t):sN(e,n,t);if(!i)return 0;let o=nh(r.dynamicScreenSpaceErrorHeightFalloff,0,1),s=i.minimumHeight+(i.maximumHeight-i.minimumHeight)*o,a=i.maximumHeight-s,c=a>0?nh((i.cameraHeight-s)/a,0,1):i.cameraHeight>=i.maximumHeight?1:0,h=(1-nh(Math.abs(i.cameraDirection.dot(i.upDirection)),0,1))*(1-c);return r.dynamicScreenSpaceErrorDensity*h}function eN(e,t){let r=e*t;return 1-Math.exp(-(r*r))}function rN(e,t,r){return t<=0||r<=0||!Number.isFinite(t)||!Number.isFinite(r)?0:eN(e,t)*r}function qS(e,t,r,n=1){let i=e.tileset,o=e.parent&&e.parent.lodMetricValue||e.lodMetricValue,s=r?o:e.lodMetricValue;if(s===0)return 0;let{viewDistanceScale:a}=i.options,c=a||1,l=Number.isFinite(n)?Math.max(n,0):1,h=nN(s,t,c,l);if(h!==null)return h;let u=Math.max(e._distanceToCamera,1e-7),{height:f,sseDenominator:d}=t,m=s*f*l*c/(u*d);return i.options.dynamicScreenSpaceError&&!t.viewport.orthographic&&(m-=rN(u,t.dynamicScreenSpaceErrorDensity,i.options.dynamicScreenSpaceErrorFactor)),m}function nN(e,t,r,n){let i=t.viewport;if(!i?.orthographic)return null;let o=i.metersPerPixel;return!Number.isFinite(o)||!o||o<=0?null:e*r*n/o}function iN(e){return e.header.content?.boundingVolume||e.header.boundingVolume}function oN(e,t){let r=zS.copy(t.camera.position).normalize(),n=Dh.copy(t.camera.direction).normalize();return{cameraHeight:t.camera.cartographicPosition[2],minimumHeight:e[4],maximumHeight:e[5],cameraDirection:n,upDirection:r}}function sN(e,t,r){let n=aN(t,Sa);if(n===null)return null;let i=new bt(e.computedTransform).invert(),o=e.tileset.ellipsoid;if(Math.hypot(Sa[0],Sa[1],Sa[2])>o.minimumRadius){let a=o.cartesianToCartographic(Sa,QC),c=zS.copy(r.camera.position).normalize(),l=Dh.copy(r.camera.direction).normalize();return{cameraHeight:r.camera.cartographicPosition[2],minimumHeight:0,maximumHeight:a[2]*2,cameraDirection:l,upDirection:c}}return i.transformAsPoint(r.camera.position,DS),i.transformAsVector(r.camera.direction,Dh),Dh.normalize(),{cameraHeight:DS[2],minimumHeight:Sa[2]-n,maximumHeight:Sa[2]+n,cameraDirection:Dh,upDirection:tN}}function aN(e,t){if(e.box){let r=e.box;return t.set(r[0],r[1],r[2]),cN(r)}if(e.sphere){let r=e.sphere;return t.set(r[0],r[1],r[2]),r[3]}return null}function cN(e){return e.length===10?(Cd.fromArray(e,6),FS.set(e[3],0,0).transformByQuaternion(Cd),US.set(0,e[4],0).transformByQuaternion(Cd),GS.set(0,0,e[5]).transformByQuaternion(Cd),Math.abs(FS[2])+Math.abs(US[2])+Math.abs(GS[2])):Math.abs(e[5])+Math.abs(e[8])+Math.abs(e[11])}qt();ro();var ir={UNLOADED:0,LOADING:1,PROCESSING:2,READY:3,EXPIRED:4,FAILED:5},ze;(function(e){e[e.ADD=1]="ADD",e[e.REPLACE=2]="REPLACE"})(ze||(ze={}));var Oi;(function(e){e.EMPTY="empty",e.SCENEGRAPH="scenegraph",e.POINTCLOUD="pointcloud",e.MESH="mesh"})(Oi||(Oi={}));var nr;(function(e){e.I3S="I3S",e.TILES3D="TILES3D"})(nr||(nr={}));var Hc;(function(e){e.GEOMETRIC_ERROR="geometricError",e.MAX_SCREEN_THRESHOLD="maxScreenThreshold"})(Hc||(Hc={}));var jS={NOT_COMPUTED:-1,USE_OPTIMIZATION:1,SKIP_OPTIMIZATION:0};var WS=1e4,lN=1e4,hN=1e8,uN=new en,HS=new I,$S=new I,S1=new I,Nd=new I;function v1(e,t,r){return e+(t-e)*r}function YS(e,t){let r=e instanceof en?e:e.getBoundingSphere(uN),{center:n,radius:i}=r;HS.copy(n).subtract(t.position);let o=Math.max(HS.dot(t.direction),0);return $S.copy(t.direction).scale(o).add(t.position),S1.copy($S).subtract(n),S1.magnitude()<=i||(Nd.copy(S1).normalize().scale(i).add(n).subtract(t.position),Nd.magnitude()===0)?0:(Nd.normalize(),Math.min(Math.max(1-Nd.dot(t.direction),0),1))}function KS(e,t,r,n){return!Number.isFinite(n)||n<=0||n>.5?!1:e>r?!0:t!==void 0&&t>r}function XS(e){let t=Number.isFinite(e.foveatedConeSize)?Math.min(Math.max(e.foveatedConeSize,0),1):1,r=e.refinement===ze.REPLACE;if(r&&!e.skipLevelOfDetail||!e.foveatedScreenSpaceError||t>=1||r&&e.skipLevelOfDetail&&e.priorityProgressiveResolution)return!1;let n=Number.isFinite(e.verticalFieldOfView)&&e.verticalFieldOfView>0?e.verticalFieldOfView:Math.PI/3,i=1-Math.cos(n*.5),o=t*i;if(e.foveatedFactor<=o||i<=o)return!1;let s=Math.min(Math.max((e.foveatedFactor-o)/(i-o),0),1),c=(typeof e.interpolationCallback=="function"?e.interpolationCallback:v1)(e.minimumScreenSpaceErrorRelaxation,e.maximumScreenSpaceError,s),l=Number.isFinite(c)?Math.min(Math.max(c,0),e.maximumScreenSpaceError):0,h=e.screenSpaceError===0&&e.parentScreenSpaceError!==void 0?e.parentScreenSpaceError*.5:e.screenSpaceError;return e.maximumScreenSpaceError-l<=h}function ZS(e,t,r){return e&&Number.isFinite(t)&&Number.isFinite(r)&&r>0&&t<r}function JS(e){let t=e.rootScreenSpaceError>0?Math.min(Math.max(e.reverseScreenSpaceError/e.rootScreenSpaceError,0),1):0,r=Math.floor(t*(WS-1)),n=Number.isFinite(e.foveatedFactor)?Math.min(Math.max(e.foveatedFactor,0),1):0,i=Math.floor(n*(WS-1))*lN;return(e.priorityProgressiveResolution?0:hN)+i+r}Lg();Lg();var $c="EPSG:4326",Od="EPSG:4978";function Fh(e){let t=e.trim().toUpperCase(),r=t.match(/(?:\/DEF\/CRS\/|URN:OGC:DEF:CRS:)([A-Z0-9_-]+)(?:\/|::)(?:[^/:]*[/:])?([A-Z0-9_.-]+)$/);return r?`${r[1]}:${r[2]}`:t}function _n(e){if(typeof e=="string"){let r=tr(e);return r==="wkt"?fN(e):r==="proj-string"?dN(e):E1(e)||"projected"}let t=e;return t.type==="BoundCRS"&&t.source_crs?_n(t.source_crs):t.type==="CompoundCRS"&&t.components?.[0]?_n(t.components[0]):String(t.type).includes("Projected")?"projected":String(t.type).includes("Geographic")?"geographic":String(t.type).includes("Geodetic")?t.coordinate_system?.subtype==="Cartesian"?"geocentric":"geographic":"unknown"}function E1(e){if(typeof e!="string")return;let t=Fh(e);if(t===Od)return"geocentric";if(t===$c||t==="OGC:CRS84")return"geographic";let r=/^EPSG:(\d+)$/.exec(t);if(!r)return;let n=Number(r[1]);if(n===7789)return"geocentric";if(n===4490||n===4979)return"geographic";if(n===3857||n>=32601&&n<=32660||n>=32701&&n<=32760)return"projected"}function fN(e){let t;try{t=mh(e).root}catch{return"unknown"}switch(t.keyword.toUpperCase()){case"GEOCCS":return"geocentric";case"GEOGCS":case"GEOGCRS":case"GEOGRAPHICCRS":case"GEOGRAPHIC2DCRS":case"GEOGRAPHIC3DCRS":return"geographic";case"PROJCS":case"PROJCRS":case"PROJECTEDCRS":return"projected";case"GEODCRS":case"GEODETICCRS":{let n=t.values.find(i=>i.type==="node"&&i.keyword.toUpperCase()==="CS")?.values[0];return n?.type!=="enumeration"&&n?.type!=="string"?"unknown":n.value.toUpperCase()==="CARTESIAN"?"geocentric":n.value.toUpperCase()==="ELLIPSOIDAL"?"geographic":"unknown"}default:return"unknown"}}function dN(e){try{let t=ph(e).parameters.find(r=>r.name.toLowerCase()==="proj")?.value;switch(t?.toLowerCase()){case"longlat":case"latlong":return"geographic";case"geocent":return"geocentric";default:return t?"projected":"unknown"}}catch{return"unknown"}}function Mn(e,t={}){let r=t.sourceCrs!==void 0,n=t.sourceCrs||e.sourceCrs,i=t.outputCoordinates||"auto",o=t.targetCrs||(i==="ecef"?"EPSG:4978":void 0),s=t.targetHeightReference||"native",a=e.verticalUnitScale??1,c=e.elevationUnitScale??1,l=e.elevationOffset||0,h=e.elevationMode==="onTheGround"||e.elevationMode==="relativeToGround"||e.elevationMode==="relativeToScene",u=e.elevationMode==="relativeToScene"?!!t.sceneElevationProvider:!h||!!t.terrainElevationProvider,f=a!==1||c!==1||e.elevationMode!==void 0&&(h||e.elevationMode==="absoluteHeight"&&l!==0),d=s!=="native"&&s!==e.heightReference,m=!!o||s!=="native"||i!=="auto"||f,p=i!=="target-crs"||!!o,g=!d||(e.heightReference||"unknown")!=="unknown",y=Number.isFinite(a)&&a>0&&Number.isFinite(c)&&c>0,_=!!n&&m&&p&&g&&y&&u&&i!=="local-enu",M=r?"caller-override":e.provenance||"unknown",b=r&&n?_n(n):e.coordinateFrame,v=r?"explicit":e.sourceCrsState||(n?M==="format-default"?"default":"explicit":"absent"),T=$f({crs:n?{state:v==="default"?"default":"explicit",definition:n,representation:!r&&e.sourceCrsRepresentation||tr(n),provenance:M,alternatives:r?void 0:e.sourceCrsAlternatives}:{state:v==="unknown"?"unknown":"absent",provenance:M},vertical:e.verticalCrs?{state:"explicit",definition:e.verticalCrs,representation:tr(e.verticalCrs),provenance:e.provenance||"metadata"}:void 0,coordinateEpoch:t.coordinateEpoch??e.coordinateEpoch,coordinateFrame:b,coordinateOrder:pN(e.axisOrder),units:r?void 0:e.units}),S=T1(T.crs),E=T.vertical?T1(T.vertical):void 0,N=o?mN(o):void 0;return Object.freeze({...T,sourceCrs:S,verticalCrs:E,verticalUnitScale:a,coordinateEpoch:t.coordinateEpoch??e.coordinateEpoch,heightReference:e.heightReference||"unknown",elevationMode:e.elevationMode,elevationOffset:e.elevationOffset,elevationUnit:e.elevationUnit,elevationUnitScale:c,coordinateFrame:b||"unknown",axisOrder:e.axisOrder||"unknown",provenance:M,targetCrs:N,targetHeightReference:s,outputCoordinates:i,status:m?_?"transformable":"unresolved":"native",warnings:Object.freeze([...e.warnings||[]])})}function va(e,t={}){return Mn({sourceCrs:e?.sourceCrs,sourceCrsState:e?.crs.state,sourceCrsRepresentation:e?.crs.state==="explicit"||e?.crs.state==="default"?e.crs.representation:void 0,sourceCrsAlternatives:e?.crs.state==="explicit"||e?.crs.state==="default"?e.crs.alternatives:void 0,verticalCrs:e?.verticalCrs,units:e?.units,verticalUnitScale:e?.verticalUnitScale,coordinateEpoch:e?.coordinateEpoch,heightReference:e?.heightReference,elevationMode:e?.elevationMode,elevationOffset:e?.elevationOffset,elevationUnit:e?.elevationUnit,elevationUnitScale:e?.elevationUnitScale,coordinateFrame:e?.coordinateFrame,axisOrder:e?.axisOrder,provenance:e?.provenance,warnings:e?.warnings},t)}function T1(e){return e.state==="explicit"||e.state==="default"?e.definition:void 0}function mN(e){let t=$f({crs:{state:"explicit",definition:e,representation:tr(e),provenance:"caller-override"}}),r=T1(t.crs);if(!r)throw new Error("Failed to normalize a known target CRS definition");return r}function pN(e){switch(e){case"xy":return["x","y"];case"yx":return["y","x"];case"xyz":return["x","y","z"];default:return[]}}function Yc(e){if(e.status!=="transformable"&&e.status!=="transformed")throw new Error("Only a transformable spatial reference can be marked as transformed");return Object.freeze({...e,status:"transformed"})}function Bd(e){return!!(e&&typeof e=="object"&&"initialize"in e&&"getRootTileset"in e&&"initializeTileHeaders"in e&&"loadTileContent"in e)}var Fd=1024*1024,cv=512*Fd,lv=512*Fd,gN=32*Fd,yN=Fd;function Ld(e,t){if(!Number.isFinite(e)||e<0)throw new Error(`${t} must be a finite number greater than or equal to 0`);return e}function QS(e,t){let r=e.cacheBytes??t;return Ld(r,"cacheBytes")}function tv(e,t){let r=e.maximumCacheOverflowBytes??t;return Ld(r,"maximumCacheOverflowBytes")}var I1={description:"",ellipsoid:pt.WGS84,modelMatrix:new bt,throttleRequests:!0,maxRequests:64,cacheBytes:cv,maximumCacheOverflowBytes:lv,maximumTilesSelected:0,debounceTime:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{},onSourceError:()=>{},onTilesetError:()=>{},onTraversalComplete:e=>e,onUpdate:()=>{},contentLoader:void 0,viewDistanceScale:1,progressiveResolutionHeightFraction:.3,foveatedScreenSpaceError:!0,foveatedConeSize:.1,foveatedMinimumScreenSpaceErrorRelaxation:0,foveatedInterpolationCallback:v1,foveatedTimeDelay:.2,maximumScreenSpaceError:8,skipLevelOfDetail:!1,baseScreenSpaceError:1024,skipScreenSpaceErrorFactor:16,skipLevels:1,immediatelyLoadDesiredLevelOfDetail:!1,dynamicScreenSpaceError:!0,dynamicScreenSpaceErrorDensity:2e-4,dynamicScreenSpaceErrorFactor:24,dynamicScreenSpaceErrorHeightFalloff:.25,memoryAdjustedScreenSpaceError:!0,loadTiles:!0,updateTransforms:!0,viewportTraversersMap:null,loadOptions:{fetch:{}},attributions:[],basePath:"",i3s:{},spatial:{}},A1="Tiles In Tileset(s)",P1="Tiles In Memory",ev="Tiles In View",rv="Tiles To Render",nv="Tiles Loaded",R1="Tiles Loading",iv="Tiles Unloaded",ov="Failed Tile Loads",sv="Points/Vertices",C1="Tile Memory Use",av="Maximum Screen Space Error",Dd=class{options;loadOptions;source;type;tileset;loader;url;basePath;modelMatrix;ellipsoid;lodMetricType;lodMetricValue;refine;root=null;roots={};asset={};schema=null;schemaUri=null;groups=[];metadata=null;statistics=null;spatialReference=Mn({});description="";properties;extras=null;attributions={};credits={};stats;contentFormats;cartographicCenter=null;cartesianCenter=null;zoom=1;boundingVolume=null;dynamicScreenSpaceErrorComputedDensity=0;gpuMemoryUsageInBytes=0;memoryAdjustedScreenSpaceError=0;_cacheBytes=cv;_maximumCacheOverflowBytes=lv;_frameNumber=0;_tiles={};_pendingCount=0;selectedTiles=[];traverseCounter=0;geometricError=0;lastUpdatedVieports=null;_requestedTiles=[];_emptyTiles=[];frameStateData={};_cameraMotionStates={};_deferredTraversalTimeout=null;_traverser;_cache=new Wc;_requestScheduler;_heldTiles=new Set;updatePromise=null;tilesetInitializationPromise;constructor(t,r){if(!Bd(t))throw new Error("Tileset3D requires a Tileset3DSource instance");let n=r||{},i=t.type===nr.TILES3D,o=i?I1.cacheBytes:gN,s=i?I1.maximumCacheOverflowBytes:yN,a=QS(n,o),c=tv(n,s);this.options={...I1,...n,cacheBytes:a,maximumCacheOverflowBytes:c,skipLevelOfDetail:n.skipLevelOfDetail??t.type===nr.TILES3D,memoryAdjustedScreenSpaceError:n.memoryAdjustedScreenSpaceError??i},this.loadOptions=this.options.loadOptions||{},this.source=t,this.tileset=null,this.loader=this.source.loader,this.type=this.source.type,this.url=this.source.url,this.basePath=this.source.basePath,this.modelMatrix=this.options.modelMatrix,this.ellipsoid=this.options.ellipsoid,this.lodMetricType="",this.lodMetricValue=0,this.refine="",this.contentFormats=this.source.contentFormats,this._traverser=this._initializeTraverser(),this._requestScheduler=new kc({throttleRequests:this.options.throttleRequests,maxRequests:this.options.maxRequests}),this.memoryAdjustedScreenSpaceError=this.options.maximumScreenSpaceError,this._cacheBytes=a,this._maximumCacheOverflowBytes=c;let l=this._getSourceMetadata();l&&(this.spatialReference=va(l.spatialReference,this.options.spatial)),this.stats=new Ni({id:this.url}),this._initializeStats(),this.tilesetInitializationPromise=this._initializeTileSet()}destroy(){this._clearDeferredTraversal(),this.source.destroy?.(),this._destroy()}isLoaded(){return this._pendingCount===0&&this._frameNumber!==0&&this._requestedTiles.length===0}get tiles(){return Object.values(this._tiles)}get frameNumber(){return this._frameNumber}get requestedTiles(){return this._requestedTiles.slice()}get emptyTiles(){return this._emptyTiles.slice()}get cacheBytes(){return this._cacheBytes}set cacheBytes(t){this._cacheBytes=Ld(t,"cacheBytes"),this.options.cacheBytes=this._cacheBytes}get maximumCacheOverflowBytes(){return this._maximumCacheOverflowBytes}set maximumCacheOverflowBytes(t){this._maximumCacheOverflowBytes=Ld(t,"maximumCacheOverflowBytes"),this.options.maximumCacheOverflowBytes=this._maximumCacheOverflowBytes}get queryParams(){let t=this.source.getTileUrl(this.url),r=t.indexOf("?");return r>=0?t.slice(r+1):""}setProps(t){let r=QS(t,this.cacheBytes),n=tv(t,this.maximumCacheOverflowBytes);this.options={...this.options,...t,cacheBytes:r,maximumCacheOverflowBytes:n},this._cacheBytes=r,this._maximumCacheOverflowBytes=n}getTileUrl(t){return this.source.getTileUrl(t)}hasExtension(t){return!!this.source.hasExtension?.(t)}update(t=null){this.tilesetInitializationPromise.then(()=>{!t&&this.lastUpdatedVieports?t=this.lastUpdatedVieports:this.lastUpdatedVieports=t,t&&this.doUpdate(t)})}async selectTiles(t=null){return await this.tilesetInitializationPromise,t&&(this.lastUpdatedVieports=t),this.updatePromise||(this.updatePromise=new Promise(r=>{setTimeout(()=>{this.lastUpdatedVieports&&this.doUpdate(this.lastUpdatedVieports),r(this._frameNumber),this.updatePromise=null},this.options.debounceTime)})),this.updatePromise}adjustScreenSpaceError(){this.gpuMemoryUsageInBytes<this.cacheBytes?this.memoryAdjustedScreenSpaceError=Math.max(this.memoryAdjustedScreenSpaceError/1.02,this.options.maximumScreenSpaceError):this.gpuMemoryUsageInBytes>this.cacheBytes+this.maximumCacheOverflowBytes&&(this.memoryAdjustedScreenSpaceError*=1.02)}doUpdate(t){if("loadTiles"in this.options&&!this.options.loadTiles||this.traverseCounter>0)return;let r=t instanceof Array?t:[t],n=new Set(r.map(a=>a.id));for(let a of Object.keys(this.frameStateData))n.has(a)||delete this.frameStateData[a];this._cache.reset(),this._frameNumber++,this.traverseCounter=r.length;let i=Date.now(),o=Number.POSITIVE_INFINITY,s=[];for(let a of r){let c=a.id;this._needTraverse(c)?s.push(c):this.traverseCounter--}for(let a of r){let c=a.id;if(this.roots[c]||(this.roots[c]=this._initializeTileHeaders(this.tileset,null)),!s.includes(c))continue;let l=Rd(a,this._frameNumber),h=this.roots[c],u=BS(this._cameraMotionStates[c],l.camera.position,l.camera.direction,i);this._cameraMotionStates[c]=u.state,l.camera.timeSinceMovement=u.timeSinceMovement,VS(h,this.modelMatrix),l.dynamicScreenSpaceErrorDensity=this.type===nr.TILES3D&&this.options.dynamicScreenSpaceError&&!l.viewport.orthographic?kS(h,l,this.options):0,this.dynamicScreenSpaceErrorComputedDensity=l.dynamicScreenSpaceErrorDensity,this._traverser.traverse(h,l,this.options),Object.keys(this._traverser.deferredTiles).length>0&&(o=Math.min(o,Math.max(this.options.foveatedTimeDelay-u.timeSinceMovement,0)))}Number.isFinite(o)?this._scheduleDeferredTraversal(o):this._clearDeferredTraversal()}_scheduleDeferredTraversal(t){this._clearDeferredTraversal(),this._deferredTraversalTimeout=setTimeout(()=>{this._deferredTraversalTimeout=null,this.selectTiles().catch(r=>{let n=r instanceof Error?r:new Error(String(r));this._onTilesetError(n)})},Math.max(t*1e3,0))}_clearDeferredTraversal(){this._deferredTraversalTimeout!==null&&(clearTimeout(this._deferredTraversalTimeout),this._deferredTraversalTimeout=null)}_needTraverse(t){let r=t;return this.options.viewportTraversersMap&&(r=this.options.viewportTraversersMap[t]),r===t}_onTraversalEnd(t){let r=t.viewport.id;this.frameStateData[r]||(this.frameStateData[r]={selectedTiles:[],_requestedTiles:[],_emptyTiles:[]});let n=this.frameStateData[r],i=Object.values(this._traverser.selectedTiles),[o,s]=LS(i,t,this.options.maximumTilesSelected);n.selectedTiles=o;for(let a of s)a.unselect();n._requestedTiles=Object.values(this._traverser.requestedTiles),n._emptyTiles=Object.values(this._traverser.emptyTiles),this.traverseCounter--,!(this.traverseCounter>0)&&this._updateTiles()}_updateTiles(){let t=this.selectedTiles;this.selectedTiles=[],this._requestedTiles=[],this._emptyTiles=[];for(let o in this.frameStateData){let s=this.frameStateData[o];this.selectedTiles=this.selectedTiles.concat(s.selectedTiles),this._requestedTiles=this._requestedTiles.concat(s._requestedTiles),this._emptyTiles=this._emptyTiles.concat(s._emptyTiles)}this.selectedTiles=this.options.onTraversalComplete(this.selectedTiles);let r=new Set(this.selectedTiles),n=this.selectedTiles.some(o=>!o.tileDrawn),i=0;if(n){let o=new Set(Object.keys(this.frameStateData).map(a=>this.roots[a])),s=new Map;for(let a of this.selectedTiles)for(let c=a.parent;c;c=c.parent)s.set(c,(s.get(c)??!0)&&a.tileDrawn);for(let a of t)a.tileDrawn&&this._heldTiles.add(a);for(let a of this._heldTiles){let c=a;for(;c.parent;)c=c.parent;if(!o.has(c)){this._heldTiles.delete(a);continue}r.has(a)||(a.contentAvailable&&!this._hasDrawnReplacement(a,r,s)?(a._selectedFrame=this._frameNumber,this.selectedTiles.push(a),i++):this._heldTiles.delete(a))}}else this._heldTiles=r;i>0&&setTimeout(()=>{this.selectTiles()},0);for(let o of this.selectedTiles)this._tiles[o.id]=o;this._loadTiles(),this._unloadTiles(),this._updateStats(),this._tilesChanged(t,this.selectedTiles)&&this.options.onUpdate()}_hasDrawnReplacement(t,r,n){for(let i=t.parent;i;i=i.parent)if(r.has(i))return i.tileDrawn;return n.get(t)===!0}_tilesChanged(t,r){if(t.length!==r.length)return!0;let n=new Set(t.map(s=>s.id)),i=new Set(r.map(s=>s.id)),o=t.some(s=>!i.has(s.id));return o=o||r.some(s=>!n.has(s.id)),o}_loadTiles(){this._requestedTiles.sort((t,r)=>t._priority-r._priority);for(let t of this._requestedTiles)t.contentUnloaded&&this._loadTile(t)}_unloadTiles(){this._cache.unloadTiles(this,(t,r)=>t._unloadTile(r)),this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_updateStats(){let t=0,r=0;for(let n of this.selectedTiles)if(n.contentAvailable&&n.content){t++;let i=n.contents.length?n.contents:[n.content];for(let o of i)o.pointCount?r+=o.pointCount:r+=o.vertexCount||0}this.stats.get(ev).count=this.selectedTiles.length,this.stats.get(rv).count=t,this.stats.get(sv).count=r,this.stats.get(av).count=this.memoryAdjustedScreenSpaceError}async _initializeTileSet(){try{let t=this.source.initialize(),r=this._getSourceMetadata();r&&this._syncSourceState(r),r?.tileset?.root&&typeof r.tileset.root.then!="function"&&(!this.source.prepareTileset||this.spatialReference?.status==="native")&&(this.root=this._initializeTileHeaders(r.tileset,null),this._applyViewState()),await t;let n=this.source.getMetadata();this._syncSourceState(n),await this.source.prepareTileset?.(this),this.root||(this.root=this._initializeTileHeaders(n.tileset,null)),this._applyViewState()}catch(t){let r=t instanceof Error?t:new Error(String(t));throw this._onSourceError(r,this.root),this._onTilesetError(r),r}}_initializeStats(){this.stats.get(A1),this.stats.get(R1),this.stats.get(P1),this.stats.get(ev),this.stats.get(rv),this.stats.get(nv),this.stats.get(iv),this.stats.get(ov),this.stats.get(sv),this.stats.get(C1,"memory"),this.stats.get(av)}_initializeTileHeaders(t,r){return this.source.initializeTileHeaders(this,t,r)}_initializeTraverser(){return this.source.createTraverser({basePath:this.basePath,onTraversalEnd:this._onTraversalEnd.bind(this)})}_destroyTileHeaders(t){this._destroySubtree(t)}async _loadTile(t){let r=null;try{this._onStartTileLoading(),r=await t.loadContent()}catch(n){let i=n instanceof Error?n:new Error("load failed");this._onSourceError(i,t),this._onTileLoadError(t,i)}finally{this._onEndTileLoading(),this._onTileLoad(t,r)}}async _loadTileChildren(t,r){try{this._onStartTileLoading(),await t.loadChildren(r)}catch(n){let i=n instanceof Error?n:new Error("subtree load failed");this._onSourceError(i,t),this._onTileLoadError(t,i)}finally{this._onEndTileLoading()}}_onTileLoadError(t,r){this.stats.get(ov).incrementCount();let n=r.message||r.toString(),i=t.url;console.error(`A 3D tile failed to load: ${t.url} ${n}`),this.options.onTileError(t,n,i)}_onSourceError(t,r=null){this.options.onSourceError(t,this.source,r)}_onTilesetError(t){this.options.onTilesetError(t,this)}_onTileLoad(t,r){if(!r?.loaded)return;t.content&&Pd(t,t.content),this.source.onTileLoaded?.(this,t,r),this._syncSourceState(this.source.getMetadata());let n=this.source.getTilesTotalCount?.();n&&(this.stats.get(A1).reset(),this.stats.get(A1).addCount(n)),this._addTileToCache(t),this.options.onTileLoad(t)}_onStartTileLoading(){this._pendingCount++,this.stats.get(R1).incrementCount()}_onEndTileLoading(){this._pendingCount--,this.stats.get(R1).decrementCount()}_addTileToCache(t){this._cache.add(this,t,r=>r._updateCacheStats(t))}_updateCacheStats(t){this.stats.get(nv).incrementCount(),this.stats.get(P1).incrementCount(),this.gpuMemoryUsageInBytes+=t.gpuMemoryUsageInBytes||0,this.stats.get(C1).count=this.gpuMemoryUsageInBytes,this.options.memoryAdjustedScreenSpaceError&&this.adjustScreenSpaceError()}_unloadTile(t){this.gpuMemoryUsageInBytes-=t.gpuMemoryUsageInBytes||0,this.stats.get(P1).decrementCount(),this.stats.get(iv).incrementCount(),this.stats.get(C1).count=this.gpuMemoryUsageInBytes,this.options.onTileUnload(t),t.unloadContent()}_destroy(){let t=[];for(this.root&&t.push(this.root);t.length>0;){let r=t.pop();for(let n of r.children)t.push(n);this._destroyTile(r)}this.root=null}_destroySubtree(t){let r=t,n=[r];for(;n.length>0;){t=n.pop();for(let i of t.children)n.push(i);t!==r&&this._destroyTile(t)}r.children=[]}_destroyTile(t){this._cache.unloadTile(this,t),this._unloadTile(t),t.destroy()}_syncSourceState(t){this.tileset=t.tileset,this.loader=t.loader,this.type=t.type,this.url=t.url,this.basePath=t.basePath,this.lodMetricType=t.lodMetricType,this.lodMetricValue=t.lodMetricValue,this.refine=t.refine,this.contentFormats=this.source.contentFormats,this.asset=this.source.asset||this.asset;let r=t.tileset;this.schema=r.schema||null,this.schemaUri=r.schemaUri||null,this.groups=r.groups||[],this.metadata=r.metadata||null,this.statistics=r.statistics??null;let n=va(t.spatialReference,this.options.spatial);this.spatialReference=wN(this.spatialReference,n),this.properties=this.source.properties??this.properties,this.extras=this.source.extras??this.extras,this.options.attributions?.length?this.credits={attributions:this.options.attributions}:this.credits=this.source.credits||this.credits}_applyViewState(){let t=this.source.getViewState(this.root);this.asset=t.asset||this.source.asset||{},this.properties=t.properties??this.source.properties,this.extras=t.extras??this.source.extras??null,this.credits=t.credits||this.source.credits||this.credits||{attributions:this.options.attributions||[]},this.description=t.description||this.options.description||"",this.boundingVolume=t.boundingVolume||this.root?.boundingVolume||null,this.cartographicCenter=t.cartographicCenter||new I,this.cartesianCenter=t.cartesianCenter||null,this.zoom=t.zoom||1,this.geometricError=this.tileset?.geometricError||0}_getSourceMetadata(){try{return this.source.getMetadata()}catch{return null}}};function wN(e,t){return e?.status==="transformed"&&e.sourceCrs===t.sourceCrs&&e.targetCrs===t.targetCrs&&e.targetHeightReference===t.targetHeightReference&&e.outputCoordinates===t.outputCoordinates?e:t}function hv(e){let t=e.selectedTiles.slice(),r=e.requestedTiles.slice(),n=e.emptyTiles.slice(),i=c=>c.map(l=>String(l.id)).sort(),o=c=>{let l=e.stats.get(c).count;return typeof l=="number"&&Number.isFinite(l)?l:0},a=e.source.getImplicitTilingStats?.();return{frameNumber:e.frameNumber,selectedTileIds:i(t),requestedTileIds:i(r),emptyTileIds:i(n),visibleTileCount:t.length,renderableTileCount:t.filter(c=>c.contentAvailable&&!!c.content).length,loadingTileCount:o("Tiles Loading"),loadedTileCount:o("Tiles Loaded"),failedTileCount:o("Failed Tile Loads"),cachedTileCount:o("Tiles In Memory"),cacheBytes:e.gpuMemoryUsageInBytes,maximumScreenSpaceError:e.memoryAdjustedScreenSpaceError,...a?{implicitTiling:a}:{}}}async function*uv(e,t={}){if(await e.tilesetInitializationPromise,Ud(t.signal),!e.root)throw new Error("Tileset initialization completed without a root tile");let r=[e.root],n=new Set;for(;r.length>0;){Ud(t.signal);let i=r.pop();if(n.has(i))continue;if(n.add(i),i.header.implicitSubtree&&i.childrenState!=="ready"){let s=e.source.loadTileChildrenForTraversal;if(!s)throw new Error("Tileset source does not support camera-independent subtree loading");if(!(await s.call(e.source,i,t.signal)).loaded)throw new Error(`Unable to load implicit subtree for tile ${i.id}`);i.childrenState="ready"}if(e.type===nr.I3S&&e.source.loadTileChildrenForTraversal&&!(await e.source.loadTileChildrenForTraversal(i,t.signal)).loaded)throw new Error(`Unable to load I3S child nodes for tile ${i.id}`);Ud(t.signal);let o=i.contentUrls.length>0&&!i.content;try{if(o){let s=await i.loadContentForTraversal();if(Ud(t.signal),!s.loaded)throw new Error(`Unable to load tile content for tile ${i.id}`);e.source.onTileLoaded?.(e,i,s)}yield{tile:i,contents:i.contentEntries}}finally{t.unloadContent&&o&&i.unloadContent()}for(let s=i.children.length-1;s>=0;s--)r.push(i.children[s])}}function Ud(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted","AbortError")}co();var zd=class{sourceUrl;options;archivePromise;constructor(t){this.options=t,this.sourceUrl=_N(t.data,t.fallbackFilename)}async loadRoot(t,r,n){let i=this.options.rootPath?`${Gd(this.sourceUrl)}/${this.options.rootPath}`:t;return await this.parseArchiveResource(i,this.options.rootPath,r,n,this.options.rootMode)}async loadResource(t,r,n){let i=this.resolveArchivePath(t,t);return await this.parseArchiveResource(t,i,r,n)}async parseArchiveResource(t,r,n,i,o){let s=this.options.getCoreApi();if(!s)throw new Error(this.options.missingCoreApiMessage);let a=await this.loadFile(r,o),c=this.createArchiveFetch(t);return await s.parse(a,n,{...i,fetch:c},{url:t,fetch:c,_parse:s.parse,loaders:[n],coreApi:s})}createArchiveFetch(t){return async r=>{let n=typeof r=="string"?r:r instanceof URL?r.toString():r.url,i=this.resolveArchivePath(n,t),o=await this.loadFile(i);return new Response(o,{status:200})}}async loadFile(t,r){this.archivePromise||=this.openArchiveReadableFile().then(i=>this.options.parseArchive(i));let n=await this.archivePromise;return await this.options.getFile(n,t,r)}async openArchiveReadableFile(){let{data:t}=this.options;if(typeof t!="string")return new qc(t);if(/^https?:\/\//i.test(t))return new Oh(t);let r=this.options.getCoreApi();if(!r)throw new Error(this.options.missingCoreApiMessage);let n=await r.fetchFile(t);return new qc(await n.arrayBuffer())}resolveArchivePath(t,r){let n=Gd(t),i=Gd(this.sourceUrl),o=Gd(r),s=o===i?i:wn.dirname(o),a=new RegExp(`\\.${this.options.archiveExtension}/(.*)$`,"i"),c=n.match(a);if(c?.[1])return c[1];let l=/^[a-z][a-z0-9+.-]*:/i.test(n)||n.startsWith("/"),h=n.startsWith(i)?n:o===i&&!l?`${i}/${n}`:/^[a-z][a-z0-9+.-]*:\/\//i.test(o)?new URL(n,o).href:wn.resolve(s,n);return h===i?"":h.startsWith(`${i}/`)?h.slice(i.length+1):h.replace(/^\/+/,"")}};function _N(e,t){return typeof e=="string"?e:`memory://${"name"in e&&typeof e.name=="string"&&e.name?e.name:t}`}function Gd(e){return e.split(/[?#]/,1)[0]}qt();ro();function Vd(e){let t=[],r=new Set,n=i=>{if(!i||typeof i!="object"||r.has(i))return;r.add(i);let o=i,s=o.extensions?.EXT_mesh_features?.featureIds;if(Array.isArray(s))for(let a of s){if(!a||typeof a!="object")continue;let c=a.texture?"texture":a.implicit?"implicit":a.attribute!==void 0?"attribute":a.propertyTable!==void 0?"property-table":"constant";t.push({source:c,attribute:a.attribute,propertyTable:a.propertyTable,constant:a.constant,texture:a.texture,implicit:a.implicit,values:a.values,details:a})}for(let a of Object.values(o))n(a)};return n(e),t}qt();ro();Dr();co();function mv(e){return e!=null}var wr=new I,kd=new I,fv=new bt;function Kc(e,t,r,n=t){if(ai(e,"3D Tile: boundingVolume must be defined"),e.box){let i=e.s2VolumeInfo?fv:t;return dv(e.box,i,r)}if(e.region){let i=fh(e.region),o=t.equals(n)?fv:t.clone().multiplyRight(n.clone().invert());return dv([...i.center,...i.halfAxes],o,r)}if(e.sphere)return MN(e.sphere,t,r);throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box")}function pv(e,t,r=!1){if(e.box||e.region&&r)return bN(t);if(e.region){let[n,i,o,s,a,c]=e.region;return[[Br(n),Br(i),a],[Br(o),Br(s),c]]}if(e.sphere)return xN(t);throw new Error("Unkown boundingVolume type")}function dv(e,t,r){let n=new I(e[0],e[1],e[2]);t.transform(n,n);let i=[];if(e.length===10){let l=e.slice(3,6),h=new Xi;h.fromArray(e,6);let u=new I([1,0,0]),f=new I([0,1,0]),d=new I([0,0,1]);u.transformByQuaternion(h),u.scale(l[0]),f.transformByQuaternion(h),f.scale(l[1]),d.transformByQuaternion(h),d.scale(l[2]),i=[...u.toArray(),...f.toArray(),...d.toArray()]}else i=[...e.slice(3,6),...e.slice(6,9),...e.slice(9,12)];let o=t.transformAsVector(i.slice(0,3)),s=t.transformAsVector(i.slice(3,6)),a=t.transformAsVector(i.slice(6,9)),c=new Qr([o[0],o[1],o[2],s[0],s[1],s[2],a[0],a[1],a[2]]);return mv(r)?(r.center=n,r.halfAxes=c,r):new eo(n,c)}function MN(e,t,r){let n=new I(e[0],e[1],e[2]);t.transform(n,n);let i=t.getScale(kd),o=Math.max(Math.max(i[0],i[1]),i[2]),s=e[3]*o;return mv(r)?(r.center=n,r.radius=s,r):new en(n,s)}function bN(e){let t=gv(),{halfAxes:r}=e,n=new I(r.getColumn(0)),i=new I(r.getColumn(1)),o=new I(r.getColumn(2));for(let s=0;s<2;s++){for(let a=0;a<2;a++){for(let c=0;c<2;c++)wr.copy(e.center),wr.add(n),wr.add(i),wr.add(o),yv(t,wr),o.negate();i.negate()}n.negate()}return t}function xN(e){let t=gv(),{center:r,radius:n}=e,i=pt.WGS84.scaleToGeodeticSurface(r,wr),o;i?o=pt.WGS84.geodeticSurfaceNormal(i):o=new I(0,0,1);let s=new I(o[2],-o[1],0);s.len()>0?s.normalize():s=new I(0,1,0);let a=s.clone().cross(o);for(let c of[s,a,o]){kd.copy(c).scale(n);for(let l=0;l<2;l++)wr.copy(r),wr.add(kd),yv(t,wr),kd.negate()}return t}function gv(){return[[1/0,1/0,1/0],[-1/0,-1/0,-1/0]]}function yv(e,t){pt.WGS84.cartesianToCartographic(t,wr),e[0][0]=Math.min(e[0][0],wr[0]),e[0][1]=Math.min(e[0][1],wr[1]),e[0][2]=Math.min(e[0][2],wr[2]),e[1][0]=Math.max(e[1][0],wr[0]),e[1][1]=Math.max(e[1][1],wr[1]),e[1][2]=Math.max(e[1][2],wr[2])}qt();Dr();Dr();var N1=new I,wv=new I,ns=new I,_v=new I,SN=new I,O1=new bt,Mv=new bt;function qd(e,t){if(e.lodMetricValue===0||Number.isNaN(e.lodMetricValue))return"DIG";let r=2*B1(e,t);if(r<2)return"OUT";if(!e.header.children)return"DRAW";switch(e.lodMetricType){case"screenSpaceRelative":{let n=t.topDownViewport.height||1;return r/n<=e.lodMetricValue?"DRAW":"DIG"}case"distanceRangeFromDefaultCamera":return e.distanceToTile(t)>=e.lodMetricValue?"DRAW":"DIG";case"maxScreenThresholdSQ":{let n=Math.sqrt(e.lodMetricValue/(Math.PI*.25));return r<=n?"DRAW":"DIG"}default:return r<=e.lodMetricValue?"DRAW":"DIG"}}function B1(e,t){let{topDownViewport:r}=t,n=e.header.i3sLodMbs||e.header.mbs,i=n[1],o=n[0],s=n[2],a=n[3],c=[...e.boundingVolume.center],l=r.unprojectPosition(r.cameraPosition);pt.WGS84.cartographicToCartesian(l,N1),wv.copy(N1).subtract(c).normalize(),fa(pt.WGS84,c,O1),Mv.copy(O1).invert(),ns.copy(N1).transform(Mv);let h=Math.sqrt(ns[0]*ns[0]+ns[1]*ns[1]),u=h*h/ns[2];_v.copy([ns[0],ns[1],u]);let d=_v.transform(O1).subtract(c).normalize(),p=wv.cross(d).normalize().scale(a).add(c),g=pt.WGS84.cartesianToCartographic(p),y=r.project([o,i,s]),_=r.project(g);return SN.copy(y).subtract(_).magnitude()}co();var Uh=class{_map=new Map;_array;_length;constructor(t=0){this._array=new Array(t),this._length=t}get length(){return this._length}set length(t){this._length=t,t>this._array.length&&(this._array.length=t)}get values(){return this._array}get(t){return ai(t<this._array.length),this._array[t]}set(t,r){ai(t>=0),t>=this.length&&(this.length=t+1),this._map.has(this._array[t])&&this._map.delete(this._array[t]),this._array[t]=r,this._map.set(r,t)}delete(t){let r=this._map.get(t);r>=0&&(this._array.splice(r,1),this._map.delete(t),this.length--)}peek(){return this._array[this._length-1]}push(t){if(!this._map.has(t)){let r=this.length++;this._array[r]=t,this._map.set(t,r)}}pop(){let t=this._array[--this.length];return this._map.delete(t),t}reserve(t){ai(t>=0),t>this._array.length&&(this._array.length=t)}resize(t){ai(t>=0),this.length=t}trim(t){t==null&&(t=this.length),this._array.length=t}reset(){this._array=[],this._map=new Map,this._length=0}find(t){return this._map.has(t)}};var vN={loadSiblings:!1,skipLevelOfDetail:!1,baseScreenSpaceError:1024,skipScreenSpaceErrorFactor:16,skipLevels:1,immediatelyLoadDesiredLevelOfDetail:!1,updateTransforms:!0,onTraversalEnd:()=>{},viewportTraversersMap:{},basePath:""},Bi=class{options;disableSkipLevelOfDetail=!1;root=null;selectedTiles={};requestedTiles={};deferredTiles={};emptyTiles={};lastUpdate=new Date().getTime();updateDebounceTime=1e3;_traversalStack=new Uh;_emptyTraversalStack=new Uh;_frameNumber=null;traversalFinished(t){return!0}constructor(t){this.options={...vN,...t}}isSkipLevelOfDetailEnabled(){return this.options.skipLevelOfDetail&&!this.disableSkipLevelOfDetail}traverse(t,r,n){this.root=t,this.options={...this.options,...n},this.reset(),this.updateTile(t,r),this._frameNumber=r.frameNumber,this.executeTraversal(t,r)}reset(){this.requestedTiles={},this.deferredTiles={},this.selectedTiles={},this.emptyTiles={},this._traversalStack.reset(),this._emptyTraversalStack.reset()}executeTraversal(t,r){let n=this._traversalStack;for(t._selectionDepth=1,n.push(t);n.length>0;){let i=n.pop(),o=!1;this.canTraverse(i,r)&&(this.updateChildTiles(i,r),o=this.updateAndPushChildren(i,r,n,i.hasRenderContent?i._selectionDepth+1:i._selectionDepth));let s=i.parent,a=!!(!s||s._shouldRefine),c=!o;i.hasRenderContent?i.refine===ze.ADD?(this.loadTile(i,r),this.selectTile(i,r)):i.refine===ze.REPLACE&&(this.loadTile(i,r),(c||this.isSkipLevelOfDetailEnabled())&&this.selectTile(i,r)):(this.emptyTiles[i.id]=i,this.loadTile(i,r),c&&this.selectTile(i,r)),this.touchTile(i,r),i._shouldRefine=o&&a}this.completeTraversal(r)}completeTraversal(t){let r=new Date().getTime();(this.traversalFinished(t)||r-this.lastUpdate>this.updateDebounceTime)&&(this.lastUpdate=r,this.options.onTraversalEnd(t))}updateChildTiles(t,r){let n=t.children;for(let i of n)this.updateTile(i,r)}updateAndPushChildren(t,r,n,i){let{loadSiblings:o}=this.options,s=this.isSkipLevelOfDetailEnabled(),a=t.children;a.sort(this.compareDistanceToCamera.bind(this));let c=t.refine===ze.REPLACE&&t.hasRenderContent&&!s,l=!1,h=!0;for(let u of a)if(u._selectionDepth=i,u.isVisibleAndInRequestVolume?(n.find(u)&&n.delete(u),n.push(u),l=!0):(c||o)&&u._inRequestVolume&&(this.loadTile(u,r),this.touchTile(u,r)),c){let f;u._inRequestVolume?u.hasRenderContent?f=u.contentAvailable:f=this.executeEmptyTraversal(u,r):f=!1,h=h&&f}return l||(h=!1),h}updateTile(t,r){this.updateTileVisibility(t,r)}selectTile(t,r){this.shouldSelectTile(t,r)&&(t._selectedFrame=r.frameNumber,this.selectedTiles[t.id]=t)}loadTile(t,r){if(this.shouldLoadTile(t)){if(this.shouldDeferTileRequest(t)){this.deferredTiles[t.id]=t;return}t._requestedFrame=r.frameNumber,t._priority=t._getPriority(),this.requestedTiles[t.id]=t}}shouldDeferTileRequest(t){return t.priorityDeferred}touchTile(t,r){t.tileset._cache.touch(t),t._touchedFrame=r.frameNumber}canTraverse(t,r){return t.hasChildren?t.hasTilesetContent?!t.contentExpired:this.shouldRefine(t,r):!1}shouldLoadTile(t){return t.hasUnloadedContent||t.contentExpired}shouldSelectTile(t,r){return t.contentAvailable&&t.contentVisibility(r)!=="outside"}shouldRefine(t,r,n=!1){let i=t._screenSpaceError;return n&&(i=t.getScreenSpaceError(r,!0)),i>t.tileset.memoryAdjustedScreenSpaceError}updateTileVisibility(t,r){let n=[];if(this.options.viewportTraversersMap)for(let i in this.options.viewportTraversersMap)this.options.viewportTraversersMap[i]===r.viewport.id&&n.push(i);else n.push(r.viewport.id);t.updateVisibility(r,n)}compareDistanceToCamera(t,r){return t._distanceToCamera-r._distanceToCamera}anyChildrenVisible(t,r){let n=!1;for(let i of t.children)i.updateVisibility(r),n=n||i.isVisibleAndInRequestVolume;return n}executeEmptyTraversal(t,r){let n=!0,i=!1,o=this._emptyTraversalStack;for(o.push(t);o.length>0;){let s=o.pop(),a=!s.hasRenderContent&&this.canTraverse(s,r),c=!s.hasRenderContent&&s.children.length===0;if(s.header.implicitSubtree&&(i=!0,n=!1),!a&&!s.contentAvailable&&!c&&(n=!1),this.updateTile(s,r),s.isVisibleAndInRequestVolume||(this.loadTile(s,r),this.touchTile(s,r)),a){let l=s.children;for(let h of l)o.push(h)}}return t.hasEmptyContent&&!i||n}};var L1=new I;function EN(e,t,r,n,i=[]){let o=e.length?e:[t],s=!1,a=!1;for(let c of o){let l="inside";if(n!==sr.MASK_INSIDE&&(l=r.computeVisibility(c),l==="outside"))continue;let h=!1;for(let u of i)if(c.intersectPlane(u)==="outside"){h=!0;break}h||(s=!0,a=a||l==="intersecting")}return s?a?"intersecting":"inside":"outside"}function bv(e){if(!e||typeof e!="object")return!1;let t=e;return t.shape==="tileset3d"||t.type==="tileset3d"||!!t.tileset}function TN(e){return e!=null}var bn=class{tileset;header;id;url;parent;refine;type;contentUrl;contentUrls=[];lodMetricType="geometricError";lodMetricValue=0;_unscaledLodMetricValue=0;_scaleGeometricError=!0;boundingVolume=null;content=null;contents=[];contentEntries=[];metadataContext={};featureIdSets=[];vectorContent=null;metadata=null;contentMetadata=[];contentState=ir.UNLOADED;gpuMemoryUsageInBytes=0;children=[];childrenState="ready";depth=0;viewportIds=[];transform=new bt;extensions=null;implicitTiling=null;userData={};computedTransform;hasEmptyContent=!1;hasTilesetContent=!1;traverser=new Bi({});_cacheNode=null;_frameNumber=null;_expireDate=null;_expiredContent=null;_childrenPromise=null;_boundingBox=void 0;_distanceToCamera=0;_screenSpaceError=0;_screenSpaceErrorProgressiveResolution=0;_priorityProgressiveResolution=!1;_foveatedFactor=0;priorityDeferred=!1;_visibilityPlaneMask;_visible=void 0;_contentBoundingVolume;_contentBoundingVolumes=[];_contentBoundingVolumeHeaders=[];_viewerRequestVolume;get contentBoundingVolume(){return this._contentBoundingVolume}get contentBoundingVolumes(){return this._contentBoundingVolumes}get viewerRequestVolume(){return this._viewerRequestVolume}_initialTransform=new bt;_priority=0;_selectedFrame=0;_requestedFrame=0;_selectionDepth=0;_touchedFrame=0;_centerZDepth=0;_shouldRefine=!1;_stackLength=0;_visitedFrame=0;_inRequestVolume=!1;_lodJudge=null;tileDrawn=!0;constructor(t,r,n,i=""){this.header=r,this.tileset=t,this.id=i||r.id,this.url=r.url,this.parent=n,this.refine=this._getRefine(r.refine),this.type=r.type,this.contentUrl=r.contentUrl,this.contentUrls=r.contentUrls||(r.contentUrl?[r.contentUrl]:[]),this._initializeMetadata(r),this.childrenState=r.implicitSubtree?"unloaded":"ready",this._initializeLodMetric(r),this._initializeTransforms(r),this._updateLodMetricScale(),this._initializeBoundingVolumes(r),this._initializeContent(r),this._initializeContentEntries(r),this._initializeRenderingState(r),Object.seal(this)}destroy(){this.header=null}isDestroyed(){return this.header===null}get selected(){return this._selectedFrame===this.tileset._frameNumber}get isVisible(){return this._visible}get isVisibleAndInRequestVolume(){return this._visible&&this._inRequestVolume}get hasRenderContent(){return!this.hasEmptyContent&&!this.hasTilesetContent}get hasChildren(){return this.children.length>0||this.header.children&&this.header.children.length>0||!!(this.header.implicitSubtree&&this.childrenState!=="ready")}get hasUnloadedChildren(){return!!(this.header.implicitSubtree&&(this.childrenState==="unloaded"||this.childrenState==="failed"))}get childrenLoading(){return this.childrenState==="loading"}get contentReady(){return this.contentState===ir.READY||this.hasEmptyContent}get contentAvailable(){return!!(this.contentReady&&this.hasRenderContent||this._expiredContent&&!this.contentFailed)}get hasUnloadedContent(){return this.hasRenderContent&&this.contentUnloaded}get contentUnloaded(){return this.contentState===ir.UNLOADED}get contentExpired(){return this.contentState===ir.EXPIRED}get contentFailed(){return this.contentState===ir.FAILED}get distanceToCamera(){return this._distanceToCamera}get screenSpaceError(){return this._screenSpaceError}get boundingBox(){return this._boundingBox||(this._boundingBox=pv(this.header.boundingVolume,this.boundingVolume,!this.computedTransform.equals(this._initialTransform))),this._boundingBox}getScreenSpaceError(t,r,n=1){switch(this.tileset.type){case nr.I3S:return B1(this,t);case nr.TILES3D:return qS(this,t,r,n);default:throw new Error("Unsupported tileset type")}}unselect(){this._selectedFrame=0}_getGpuMemoryUsageInBytes(){return(this.contents.length?this.contents:[this.content]).reduce((r,n)=>r+(n?.gpuMemoryUsageInBytes||n?.byteLength||0),0)}_getPriority(){return this._calculateRequestPriority(!1)}_getChildrenPriority(){return this._calculateRequestPriority(!0)}_calculateRequestPriority(t){let r=this.tileset._traverser,n=r.options.skipLevelOfDetail&&!r.disableSkipLevelOfDetail,i=this.refine===ze.ADD||n;if(i&&!this.isVisible&&this._visible!==void 0||this.tileset._frameNumber-this._touchedFrame>=1||this.priorityDeferred||!t&&this.contentState===ir.UNLOADED)return-1;let o=this.parent,a=o&&(!i||this._screenSpaceError===0||o.hasTilesetContent)?o._screenSpaceError:this._screenSpaceError,c=r.root?r.root._screenSpaceError:0,l=Math.max(c-a,0);return JS({priorityProgressiveResolution:this._priorityProgressiveResolution,foveatedFactor:this._foveatedFactor,reverseScreenSpaceError:l,rootScreenSpaceError:c})}async loadContent(){if(this.hasEmptyContent)return{loaded:!1};if(this.content)return{loaded:!0};this.contentExpired&&(this._expireDate=null),this.contentState=ir.LOADING;let r=await this.tileset._requestScheduler.scheduleRequest(this.id,this._getPriority.bind(this));if(!r)return this.contentState=ir.UNLOADED,{loaded:!1};try{return await this._loadContentFromSource()}catch(n){throw this.contentState=ir.FAILED,n}finally{r.done()}}async loadContentForTraversal(){if(this.hasEmptyContent)return{loaded:!1};if(this.content)return{loaded:!0,contents:this.contents};this.contentState=ir.LOADING;try{return await this._loadContentFromSource()}catch(t){throw this.contentState=ir.FAILED,t}}async _loadContentFromSource(){let t=await this.tileset.source.loadTileContent(this);return t.contents&&(this.contents=t.contents,this.content=this.contents[0]||null),this.vectorContent=this.contents.find(r=>!!r?.vectorContent)?.vectorContent||null,this.tileset.options.contentLoader&&await this.tileset.options.contentLoader(this),this.contentState=ir.READY,this._onContentLoaded(),this._updateContentEntriesAfterLoad(t),t}async loadChildren(t){if(!this.header.implicitSubtree||this.childrenState==="ready")return{loaded:!1,tileCount:0,childSubtreeCount:0};if(this._childrenPromise)return await this._childrenPromise;if(!this.tileset.source.loadTileChildren)throw new Error("Tileset source does not support lazy tile children");this.childrenState="loading",this._childrenPromise=this._loadChildrenWithScheduler(t);try{return await this._childrenPromise}finally{this._childrenPromise=null}}async _loadChildrenWithScheduler(t){let r=await this.tileset._requestScheduler.scheduleRequest(`${this.id}:implicit-subtree`,this._getChildrenPriority.bind(this));if(!r)return this.childrenState="unloaded",{loaded:!1,tileCount:0,childSubtreeCount:0};try{let n=await this.tileset.source.loadTileChildren(this,t);return this.childrenState=n.loaded?"ready":"unloaded",n}catch(n){throw this.childrenState="failed",n}finally{r.done()}}applyImplicitSubtreeHeader(t){let r=this.header.transform,n=this.header.transformMatrix,i=t.transform!==void 0;this.header={...this.header,...t,transform:i?t.transform:r,transformMatrix:i?t.transformMatrix:n,implicitSubtree:void 0},i&&this._initializeTransforms(this.header),this.refine=this._getRefine(t.refine),this.type=t.type,this.contentUrl=t.contentUrl,this.contentUrls=t.contentUrls||(t.contentUrl?[t.contentUrl]:[]),this._initializeMetadata(this.header),this._initializeLodMetric(t),this._updateLodMetricScale(),this._initializeBoundingVolumes(this.header),this._boundingBox=void 0,this._initializeContent(this.header),this._initializeContentEntries(this.header)}_initializeMetadata(t){this.metadata=t.metadata||null;let r=Array.isArray(t.content)?t.content:[t.content];this.contentMetadata=r.filter(Boolean).map(a=>a.metadata||null);let i=(r.find(Boolean)||{}).group,o=typeof i=="number"?this.tileset.groups?.[i]||null:i||null,s={tileset:this.tileset.metadata||null,group:o,tile:this.metadata,content:this.contentMetadata[0]||null,subtree:t.implicitMetadata||null};this.tileset.groups&&(s.groups=this.tileset.groups),this.metadataContext=s}_updateContentEntriesAfterLoad(t){if(t.contentEntries){this.contentEntries=t.contentEntries.map((r,n)=>({...r,index:n,boundingVolume:r.boundingVolume||this._contentBoundingVolumes[n]||this.boundingVolume,payload:r.payload??this.contents[n]??null,featureIds:r.featureIds?.length?r.featureIds:Vd(r.payload??this.contents[n]),renderable:!!(r.renderable!==!1&&(r.payload??this.contents[n])&&!bv(r.payload??this.contents[n]))})),this.featureIdSets=this.contentEntries.flatMap(r=>r.featureIds);return}this.contentEntries=this.contentEntries.map((r,n)=>({...r,payload:this.contents[n]??null,featureIds:Vd(this.contents[n]),renderable:!!this.contents[n]&&!bv(this.contents[n])})),this.featureIdSets=this.contentEntries.flatMap(r=>r.featureIds)}getContentEntry(t){return this.contentEntries[t]||null}isContentRenderable(t){return!!this.contentEntries[t]?.renderable}_initializeContentEntries(t){let r=Array.isArray(t.content)?t.content:t.content?[t.content]:[];this.contentEntries=r.map((n,i)=>{let o=n||{};return{index:i,uri:this.contentUrls[i]||o.uri||o.url,group:o.group,type:o.type,payload:null,metadata:o.metadata||null,boundingVolume:this._contentBoundingVolumes[i]||this.boundingVolume,featureIds:this._getFeatureIdSets(o),renderable:!1}})}_getFeatureIdSets(t){return Vd(t)}unloadContent(){for(let t of this.contents.length?this.contents:[this.content])t&&t.destroy&&t.destroy();return this.contents=[],this.content=null,this.vectorContent=null,this.contentEntries=this.contentEntries.map(t=>({...t,payload:null,renderable:!1})),this.featureIdSets=this.contentEntries.flatMap(t=>t.featureIds),this.header.content&&this.header.content.destroy&&this.header.content.destroy(),this.header.content=null,this.contentState=ir.UNLOADED,this.tileDrawn=!0,!0}updateVisibility(t,r){if(this._frameNumber===t.frameNumber)return;let n=this.parent,i=n?n._visibilityPlaneMask:sr.MASK_INDETERMINATE;if(this.tileset._traverser.options.updateTransforms){let o=n?n.computedTransform:this.tileset.modelMatrix;this._updateTransform(o)}this._distanceToCamera=this.distanceToTile(t),this._screenSpaceError=this.getScreenSpaceError(t,!1),this._updateRequestPriorityMetrics(t),this._visibilityPlaneMask=this.visibility(t,i),this._visible=this._visibilityPlaneMask!==sr.MASK_OUTSIDE,this._inRequestVolume=this.insideViewerRequestVolume(t),this._frameNumber=t.frameNumber,this.viewportIds=r}_updateRequestPriorityMetrics(t){if(this.tileset.type!==nr.TILES3D){this._screenSpaceErrorProgressiveResolution=this._screenSpaceError,this._priorityProgressiveResolution=!1,this._foveatedFactor=0,this.priorityDeferred=!1;return}let r=this.tileset.options,n=r.progressiveResolutionHeightFraction;if(this._screenSpaceErrorProgressiveResolution=this.getScreenSpaceError(t,!1,n),this._priorityProgressiveResolution=KS(this._screenSpaceErrorProgressiveResolution,this.parent?._screenSpaceErrorProgressiveResolution,this.tileset.memoryAdjustedScreenSpaceError,n),!r.foveatedScreenSpaceError||t.viewport?.orthographic||!t.camera?.position||!t.camera?.direction){this._foveatedFactor=0,this.priorityDeferred=!1;return}this._foveatedFactor=YS(this.boundingVolume,t.camera);let i=this.tileset._traverser,o=i.options.skipLevelOfDetail&&!i.disableSkipLevelOfDetail,s=XS({refinement:this.refine,skipLevelOfDetail:o,foveatedScreenSpaceError:r.foveatedScreenSpaceError,foveatedConeSize:r.foveatedConeSize,minimumScreenSpaceErrorRelaxation:r.foveatedMinimumScreenSpaceErrorRelaxation,interpolationCallback:r.foveatedInterpolationCallback,foveatedFactor:this._foveatedFactor,verticalFieldOfView:t.camera.verticalFieldOfView,screenSpaceError:this._screenSpaceError,parentScreenSpaceError:this.parent?._screenSpaceError,maximumScreenSpaceError:this.tileset.memoryAdjustedScreenSpaceError,priorityProgressiveResolution:this._priorityProgressiveResolution});this.priorityDeferred=ZS(s,t.camera.timeSinceMovement,r.foveatedTimeDelay)}visibility(t,r){let{cullingVolume:n}=t,{boundingVolume:i}=this;return n.computeVisibilityWithPlaneMask(i,r)}contentVisibility(t,r){let n=r===void 0?this._contentBoundingVolumes:this._contentBoundingVolumes[r]?[this._contentBoundingVolumes[r]]:[];return EN(n,this.boundingVolume,t.cullingVolume,this._visibilityPlaneMask,t.clippingPlanes)}distanceToTile(t){let r=this.boundingVolume;return Math.sqrt(Math.max(r.distanceSquaredTo(t.camera.position),0))}cameraSpaceZDepth({camera:t}){let r=this.boundingVolume;return L1.subVectors(r.center,t.position),t.direction.dot(L1)}insideViewerRequestVolume(t){let r=this._viewerRequestVolume;return!r||r.distanceSquaredTo(t.camera.position)<=0}updateExpiration(){if(TN(this._expireDate)&&this.contentReady&&!this.hasEmptyContent){let t=Date.now();Date.lessThan(this._expireDate,t)&&(this.contentState=ir.EXPIRED,this._expiredContent=this.content)}}get extras(){return this.header.extras}_initializeLodMetric(t){this._scaleGeometricError=typeof t._scaleGeometricError=="boolean"?t._scaleGeometricError:this.parent?._scaleGeometricError??!0,"lodMetricType"in t?this.lodMetricType=t.lodMetricType:(this.lodMetricType=this.parent&&this.parent.lodMetricType||this.tileset.lodMetricType,console.warn("3D Tile: Required prop lodMetricType is undefined. Using parent lodMetricType")),"lodMetricValue"in t?this._unscaledLodMetricValue=t.lodMetricValue:(this._unscaledLodMetricValue=this.parent?this.parent._unscaledLodMetricValue:this.tileset.lodMetricValue,console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue")),this.lodMetricValue=this._unscaledLodMetricValue}_initializeTransforms(t){this.transform=t.transform?new bt(t.transform):new bt;let r=this.parent,n=this.tileset,i=r&&r.computedTransform?r.computedTransform.clone():n.modelMatrix.clone();this.computedTransform=new bt(i).multiplyRight(this.transform);let o=r&&r._initialTransform?r._initialTransform.clone():new bt;this._initialTransform=new bt(o).multiplyRight(this.transform)}_updateLodMetricScale(){if(this.lodMetricType!==Hc.GEOMETRIC_ERROR||!this._scaleGeometricError){this.lodMetricValue=this._unscaledLodMetricValue;return}let t=this.computedTransform.getScale(L1),r=Math.max(t[0],t[1],t[2]);this.lodMetricValue=this._unscaledLodMetricValue*r}_initializeBoundingVolumes(t){this._contentBoundingVolume=null,this._contentBoundingVolumeHeaders=[],this._viewerRequestVolume=null,this._updateBoundingVolume(t)}_initializeContent(t){this.content={_tileset:this.tileset,_tile:this},this.contents=[],this.hasEmptyContent=!0,this.contentState=ir.UNLOADED,this.hasTilesetContent=!1,(t.contentUrl||t.contentUrls?.length)&&(this.content=null,this.hasEmptyContent=!1)}_initializeRenderingState(t){this.depth=t.level||(this.parent?this.parent.depth+1:0),this._shouldRefine=!1,this._distanceToCamera=0,this._centerZDepth=0,this._screenSpaceError=0,this._screenSpaceErrorProgressiveResolution=0,this._priorityProgressiveResolution=!1,this._foveatedFactor=0,this.priorityDeferred=!1,this._visibilityPlaneMask=sr.MASK_INDETERMINATE,this._visible=void 0,this._inRequestVolume=!1,this._stackLength=0,this._selectionDepth=0,this._frameNumber=0,this._touchedFrame=0,this._visitedFrame=0,this._selectedFrame=0,this._requestedFrame=0,this._priority=0}_getRefine(t){return t||this.parent&&this.parent.refine||ze.REPLACE}_isTileset(){return(this.contents.length?this.contents:[this.content]).some(t=>t?.shape==="tileset3d")}_onContentLoaded(){let t=this.contents.length?this.contents:[this.content];for(let r of t)switch(r&&r.type){case"vctr":case"geom":this.tileset._traverser.disableSkipLevelOfDetail=!0;break;default:}this._isTileset()?this.hasTilesetContent=!0:this.gpuMemoryUsageInBytes=this._getGpuMemoryUsageInBytes()}_updateBoundingVolume(t){this._boundingBox=void 0,this.boundingVolume=Kc(t.boundingVolume,this.computedTransform,this.boundingVolume,this._initialTransform),t.viewerRequestVolume&&(this._viewerRequestVolume=Kc(t.viewerRequestVolume,this.computedTransform,this._viewerRequestVolume,this._initialTransform));let r=t.content;r&&(this._contentBoundingVolumeHeaders=Array.isArray(r)?r:[r]);let n=r?Array.isArray(r)?r:[r]:this._contentBoundingVolumeHeaders;this._contentBoundingVolumes=n.length?n.map(i=>i?.boundingVolume?Kc(i.boundingVolume,this.computedTransform,void 0,this._initialTransform):this.boundingVolume):[this.boundingVolume],this._contentBoundingVolume=this._contentBoundingVolumes[0]||null}_updateTransform(t=new bt){let r=t.clone().multiplyRight(this.transform);r.equals(this.computedTransform)||(this.computedTransform=r,this._updateLodMetricScale(),this._updateBoundingVolume(this.header))}};co();Dr();qt();var jd=class extends Bi{pendingImplicitSubtrees=new Map;traversalFinished(t){let r=`${t.viewport.id}:`;for(let[n,i]of this.pendingImplicitSubtrees)if(n.startsWith(r)&&i===t.frameNumber)return!1;return!0}executeTraversal(t,r){if(!this.isSkipLevelOfDetailEnabled()){super.executeTraversal(t,r);return}this.executeSkipTraversal(t,r)}executeSkipTraversal(t,r){let n=[t];for(t._selectionDepth=t.parent?t.parent._selectionDepth:1;n.length>0;){let i=n.pop(),o=!i.parent||i.parent._shouldRefine,s=this.canTraverse(i,r)&&this.updateAndPushSkipChildren(i,r,n)&&o,a=!s&&o;i.hasRenderContent?i.refine===ze.ADD?(this.loadTile(i,r),this.selectDesiredTile(i,r)):i.refine===ze.REPLACE&&(this.isInBaseTraversal(i,r)?(this.loadTile(i,r),a&&this.selectDesiredTile(i,r)):a?(this.loadTile(i,r),this.selectDesiredTile(i,r)):this.hasReachedSkippingThreshold(i,r)&&this.loadTile(i,r)):(this.emptyTiles[i.id]=i,this.loadTile(i,r),a&&(!i.hasEmptyContent||i.hasChildren)&&this.selectDesiredTile(i,r)),this.touchTile(i,r),i._shouldRefine=s}this.completeTraversal(r)}updateAndPushSkipChildren(t,r,n){this.updateChildTiles(t,r),t.children.sort(this.compareDistanceToCamera.bind(this));let i=!1;for(let o of t.children)o._selectionDepth=t.hasRenderContent?t._selectionDepth+1:t._selectionDepth,o.isVisibleAndInRequestVolume?(n.push(o),i=!0):this.options.loadSiblings&&o._inRequestVolume&&(this.loadTile(o,r),this.touchTile(o,r));return i}isInBaseTraversal(t,r){if(this.options.immediatelyLoadDesiredLevelOfDetail)return!1;if(!this.findNearestRequestedOrLoadedAncestor(t,r))return!0;let n=Number.isFinite(this.options.baseScreenSpaceError)?Math.max(this.options.baseScreenSpaceError,0):1024,i=Math.max(n,t.tileset.memoryAdjustedScreenSpaceError);return t._screenSpaceError===0&&t.parent?t.parent._screenSpaceError>i:t._screenSpaceError>i}hasReachedSkippingThreshold(t,r){if(this.options.immediatelyLoadDesiredLevelOfDetail)return!1;if(t._priorityProgressiveResolution&&t._screenSpaceErrorProgressiveResolution<=t.tileset.memoryAdjustedScreenSpaceError&&!!(t.parent&&t.parent._screenSpaceErrorProgressiveResolution>t.tileset.memoryAdjustedScreenSpaceError))return!0;let i=this.findNearestRequestedOrLoadedAncestor(t,r);if(!i)return!1;let o=Number.isFinite(this.options.skipScreenSpaceErrorFactor)&&this.options.skipScreenSpaceErrorFactor>0?this.options.skipScreenSpaceErrorFactor:16,s=Number.isFinite(this.options.skipLevels)?Math.max(Math.floor(this.options.skipLevels),0):1;return t._screenSpaceError<i._screenSpaceError/o&&t.depth>i.depth+s}findNearestRequestedOrLoadedAncestor(t,r){let n=t.parent;for(;n;){if(n.hasRenderContent&&!n.contentFailed&&(!n.hasUnloadedContent||n._requestedFrame===r.frameNumber))return n;n=n.parent}return null}selectDesiredTile(t,r){let n=t;for(;n;){if(this.shouldSelectTile(n,r)){this.selectTile(n,r),n!==t&&this.selectLoadedDescendants(t,r,!0);return}n=n.parent}this.selectLoadedDescendants(t,r)}selectLoadedDescendants(t,r,n=!1){let i=[{tile:t,depth:0}];for(;i.length>0;){let{tile:o,depth:s}=i.pop();for(let a of o.children)this.updateTile(a,r),a.isVisibleAndInRequestVolume&&(this.shouldSelectTile(a,r)&&(!n||a.tileDrawn)?(this.selectTile(a,r),this.touchTile(a,r)):s<1&&i.push({tile:a,depth:s+1}))}}compareDistanceToCamera(t,r){return r._distanceToCamera===0&&t._distanceToCamera===0?r._centerZDepth-t._centerZDepth:r._distanceToCamera-t._distanceToCamera}updateChildTiles(t,r){let n=t.header.implicitSubtree?.coordinates.level===0;if(t.hasUnloadedChildren&&t.isVisibleAndInRequestVolume&&(n||this.shouldRefine(t,r))){let i=`${r.viewport.id}:${t.id}`;this.pendingImplicitSubtrees.has(i)||(this.pendingImplicitSubtrees.set(i,r.frameNumber),t.tileset._loadTileChildren(t,r).finally(()=>{this.handleImplicitSubtreeLoad(t,r,i)}))}super.updateChildTiles(t,r)}handleImplicitSubtreeLoad(t,r,n){this.pendingImplicitSubtrees.delete(n),this._frameNumber===r.frameNumber&&(t.childrenState==="ready"?this.executeTraversal(t,r):this.traversalFinished(r)&&this.options.onTraversalEnd(r))}updateTileVisibility(t,r){if(super.updateTileVisibility(t,r),!t.isVisibleAndInRequestVolume)return;let n=t.children.length>0;if(t.hasTilesetContent&&n){let s=t.children[0];this.updateTileVisibility(s,r),t._visible=s._visible;return}if(this.meetsScreenSpaceErrorEarly(t,r)){t._visible=!1;return}let i=t.refine===ze.REPLACE,o=t._optimChildrenWithinParent===jS.USE_OPTIMIZATION;if(i&&o&&n&&!this.anyChildrenVisible(t,r)){t._visible=!1;return}}meetsScreenSpaceErrorEarly(t,r){let{parent:n}=t;return!n||n.hasTilesetContent||n.refine!==ze.ADD?!1:!this.shouldRefine(t,r,!0)}};qt();ro();Dr();var IN=6378137,AN=6378137,D1=6356752314245179e-9,Xc=new I;function xv(e,t){if(e instanceof eo){let{halfAxes:r}=e,n=PN(r);return Math.log2(D1/(n+t[2]))}else if(e instanceof en){let{radius:r}=e;return Math.log2(D1/(r+t[2]))}else if(e.width&&e.height){let{width:r,height:n}=e,i=Math.log2(IN/r),o=Math.log2(AN/n);return(i+o)/2}return 1}function F1(e,t,r){pt.WGS84.cartographicToCartesian([e.xmax,e.ymax,e.zmax],Xc);let n=Math.sqrt(Math.pow(Xc[0]-r[0],2)+Math.pow(Xc[1]-r[1],2)+Math.pow(Xc[2]-r[2],2));return Math.log2(D1/(n+t[2]))}function Sv(e,t,r){let[n,i,o,s]=e;return F1({xmin:n,xmax:o,ymin:i,ymax:s,zmin:0,zmax:0},t,r)}function PN(e){e.getColumn(0,Xc);let t=e.getColumn(1),r=e.getColumn(2);return Xc.add(t).add(r).len()}var RN=Object.freeze({meter:1,millimeter:.001,centimeter:.01,decimeter:.1,kilometer:1e3,foot:.3048,yard:.9144,mile:1609.344,"us-foot":.3048006096012192,"us-inch":.0254000508001016,"us-yard":.9144018288036576,"us-mile":1609.3472186944373,"clarke-foot":.3047972654,"clarke-yard":.9143917962,"clarke-link":.201166195164,"sears-yard":.914398414616,"sears-foot":.304799471539,"sears-chain":20.1167651216,"sears-1922-truncated-chain":20.116756,"benoit-1895-b-chain":20.1167824944,"indian-yard":.914398530744,"indian-1937-yard":.91439523,"gold-coast-foot":.304799710181}),CN=Object.freeze({m:"meter",metre:"meter",meters:"meter",metres:"meter",mm:"millimeter",millimetre:"millimeter",millimeters:"millimeter",millimetres:"millimeter",cm:"centimeter",centimetre:"centimeter",centimeters:"centimeter",centimetres:"centimeter",dm:"decimeter",decimetre:"decimeter",decimeters:"decimeter",decimetres:"decimeter",km:"kilometer",kilometre:"kilometer",kilometers:"kilometer",kilometres:"kilometer",ft:"foot",feet:"foot","us-survey-foot":"us-foot","us-survey-feet":"us-foot",yd:"yard",yards:"yard",mi:"mile",miles:"mile"});function Gh(e){if(!e)return;let t=e.trim().toLowerCase().replaceAll("_","-"),r=CN[t]||t;return RN[r]}function vv(e,t){return t!==void 0?Number.isFinite(t)&&t>0?t:void 0:e?Gh(e):1}function Wd(e){let t=e.spatialReference||e.fullExtent?.spatialReference,r=DN(t),n=e.heightModelInfo?.vertCRS||FN(t),i=e.heightModelInfo?.heightModel,o=e.heightModelInfo?.heightUnit,s=vv(o,e.ZFactor),a=i==="ellipsoidal"?"ellipsoidal":i==="gravity_related_height"?"orthometric":"unknown",c=Iv(t),l=c===void 0?r?_n(r):"unknown":_n(`EPSG:${c}`),h=NN(l,o,e.ZFactor),u=[],f=ON(e.elevationInfo?.mode),d=e.elevationInfo?e.elevationInfo.unit||"meter":void 0,m=Gh(d);return s===void 0&&u.push(e.ZFactor!==void 0?`I3S ZFactor ${e.ZFactor} is not a positive finite conversion factor`:`Unsupported I3S vertical unit ${o}`),e.elevationInfo&&m===void 0&&u.push(`Unsupported I3S elevation unit ${d}`),e.elevationInfo?.mode&&!f&&u.push(`Unsupported I3S elevation mode ${e.elevationInfo.mode}`),f&&f!=="absoluteHeight"&&u.push(`I3S elevation mode ${f} requires a terrain or scene elevation provider`),Mn({sourceCrs:r,sourceCrsRepresentation:c!==void 0?"identifier":r?"wkt":void 0,sourceCrsAlternatives:c!==void 0&&t?.wkt?[{definition:t.wkt,representation:"wkt"}]:void 0,verticalCrs:n,units:h,verticalUnitScale:s??Number.NaN,heightReference:a,elevationMode:f,elevationOffset:e.elevationInfo?.offset,elevationUnit:d,elevationUnitScale:e.elevationInfo?.mode&&!f?Number.NaN:m??(e.elevationInfo?Number.NaN:1),coordinateFrame:l,axisOrder:r?"xyz":"unknown",provenance:r?"metadata":"unknown",warnings:u})}function NN(e,t,r){if(e==="geocentric")return["meter","meter","meter"];if(e==="geographic"&&(t||r===void 0))return["degree","degree",t||"meter"]}function ON(e){switch(e){case"absoluteHeight":case"onTheGround":case"relativeToGround":case"relativeToScene":return e;default:return}}function Hd(e){let t=BN(e);if(t)return t;let r=Ev(e,"TILESET_CRS_GEOCENTRIC"),n=Ev(e,"TILESET_CRS_COORDINATE_EPOCH"),i=[],o,s="unknown",a;typeof r=="string"&&r.toUpperCase()!=="UNKNOWN"?(o=r,s="metadata",a="explicit"):r!==void 0?(i.push("3D Tiles geocentric CRS is explicitly unknown"),s="metadata",a="unknown"):e.root?.boundingVolume?.region?(o="EPSG:4978",s="format-default",a="default"):e.schemaUri&&!e.schema&&i.push("External 3D Tiles metadata schema must be loaded before CRS semantics can resolve");let c=Tv(n);return n!==void 0&&c===void 0&&i.push("3D Tiles coordinate epoch is not a finite decimal year"),Mn({sourceCrs:o,sourceCrsState:a,sourceCrsRepresentation:o?"identifier":void 0,coordinateEpoch:c,heightReference:o?"ellipsoidal":"unknown",coordinateFrame:o?"geocentric":"unknown",axisOrder:o?"xyz":"unknown",provenance:s,warnings:i})}function BN(e){let t=e.extensions?.EXT_geospatial_crs;if(!t)return;let r=[],n,i,o,s;if(t.format==="wkid"){let h=t.extensions?.EXT_geospatial_crs_wkid;typeof h?.authority=="string"&&Number.isInteger(h.wkid)?(n=`${h.authority}:${h.wkid}`,s="identifier",Number.isInteger(h.vcsWkid)&&(i=`${h.authority}:${h.vcsWkid}`),o=Tv(h.epoch),h.epoch!==void 0&&o===void 0&&r.push("EXT_geospatial_crs_wkid epoch is not a finite decimal year")):r.push("EXT_geospatial_crs_wkid requires string authority and integer wkid")}else if(t.format==="wkt2"){let h=t.extensions?.EXT_geospatial_crs_wkt2;typeof h?.wkt2=="string"&&h.wkt2.trim()?(n=h.wkt2,s="wkt"):r.push("EXT_geospatial_crs_wkt2 requires a nonempty wkt2 string")}else r.push(`Unsupported EXT_geospatial_crs format ${String(t.format)}`);let a=s==="wkt"?_n(n):E1(n)||"unknown",c=LN(i);i&&!c&&r.push(`Unsupported vertical CRS ${String(i)}; vertical unit and height reference are unknown`);let l=i?c?.unit:"meter";return Mn({sourceCrs:n,sourceCrsState:n?"explicit":"unknown",sourceCrsRepresentation:s,verticalCrs:i,coordinateEpoch:o,units:a==="geocentric"?["meter","meter","meter"]:a==="geographic"&&l?["degree","degree",l]:void 0,verticalUnitScale:i?c?.verticalUnitScale??Number.NaN:1,heightReference:i?c?.heightReference??"unknown":n?"ellipsoidal":"unknown",coordinateFrame:a,axisOrder:n?"xyz":"unknown",provenance:"metadata",warnings:r})}function LN(e){if(typeof e!="string")return;let t=/^EPSG:(\d+)$/i.exec(e);if(t)switch(Number(t[1])){case 5702:case 6360:return{unit:"us-foot",verticalUnitScale:1200/3937,heightReference:"orthometric"};case 5703:return{unit:"meter",verticalUnitScale:1,heightReference:"orthometric"};default:return}}function Tv(e){if(typeof e!="string"&&typeof e!="number"||typeof e=="string"&&!e.trim())return;let t=Number(e);return Number.isFinite(t)?t:void 0}function DN(e){let t=Iv(e);return t!==void 0?`EPSG:${t}`:e?.wkt}function FN(e){let t=e?.latestVcsWkid??e?.vcsWkid;return t===void 0?void 0:`EPSG:${t}`}function Iv(e){return e?.latestWkid??e?.wkid}function Ev(e,t){let r=e.metadata?.class;if(!r)return;let i=e.schema?.classes?.[r]?.properties,o=e.metadata?.properties;for(let[s,a]of Object.entries(i||{}))if(a.semantic===t)return o?.[s]}qt();Dr();function Av(e){return{input:new Float64Array(e),output:new Float64Array(e)}}function zh(e){return e instanceof Float32Array||e instanceof Float64Array}function Pv(e){return typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer}function U1(e,t,r,n,i,o){return(e.buffer===n.buffer||Pv(e.buffer)&&Pv(n.buffer))&&t<o&&i<r}function $d(e,t,r,n){return e<t+n?0:Math.floor((e-t-n)/r)+1}var Yd=class{constructor(t){this.depth=0;let r=t.dimension??2,n=t.inputOffset??0,i=t.outputOffset??0;if(!Number.isSafeInteger(r)||r<2||!Number.isSafeInteger(n)||n<0||!Number.isSafeInteger(i)||i<0||t.inputStride!==void 0&&(!Number.isSafeInteger(t.inputStride)||t.inputStride<1)||t.outputStride!==void 0&&(!Number.isSafeInteger(t.outputStride)||t.outputStride<1)||typeof t.projection?.projectToSync!="function"||typeof t.projection?.unprojectToSync!="function")throw new Error("Invalid projection buffer transform or layout");this.dimension=r,this.projection=t.projection,this.inputOffset=n,this.outputOffset=i,this.inputStride=t.inputStride,this.outputStride=t.outputStride,this.scratch=[Av(r)]}projectFlatTo(t,r,n,i=0,o){return this.flat(t,r,n,i,!1,o)}unprojectFlatTo(t,r,n,i=0,o){return this.flat(t,r,n,i,!0,o)}projectColumnsTo(t,r,n,i=0,o){return this.columns(t,r,n,i,!1,o)}unprojectColumnsTo(t,r,n,i=0,o){return this.columns(t,r,n,i,!0,o)}range(t,r,n){let i=r??Math.max(0,t-n);if(!Number.isSafeInteger(n)||n<0||!Number.isSafeInteger(i)||i<0||!Number.isSafeInteger(n+i)||n+i>t)throw new Error("Invalid projection buffer record range");return i}epochStorage(t,r,n){if(t!==void 0){if(typeof t=="number"){if(!Number.isFinite(t))throw new Error("Coordinate epoch must be finite")}else if(!zh(t)||t.length<r+n)throw new Error("Epoch buffer requires one value per addressed record")}}aliases(t,r,n,i,o,s,a){if(!i)return;let c=t.byteOffset+(this.inputOffset+n*o)*t.BYTES_PER_ELEMENT,l=c+((i-1)*o+a)*t.BYTES_PER_ELEMENT,h=r.byteOffset+(this.outputOffset+n*s)*r.BYTES_PER_ELEMENT,u=h+((i-1)*s+a)*r.BYTES_PER_ELEMENT,f=t.buffer===r.buffer&&t.constructor===r.constructor&&c===h&&o===s;if(U1(t,c,l,r,h,u)&&!f)throw new Error("Projection input/output ranges overlap without an exact in-place mapping")}epochAlias(t,r,n,i,o,s){if(typeof t!="object"||!t||!i)return;let a=t.byteOffset+n*t.BYTES_PER_ELEMENT,c=a+i*t.BYTES_PER_ELEMENT,l=r.byteOffset+(this.outputOffset+n*o)*r.BYTES_PER_ELEMENT,h=l+((i-1)*o+s)*r.BYTES_PER_ELEMENT;if(U1(t,a,c,r,l,h))throw new Error("Epoch and output buffers must not overlap")}acquire(){var t;let r=this.depth++;return(t=this.scratch)[r]||(t[r]=Av(this.dimension)),this.scratch[r]}transform(t,r,n){if(n!==void 0&&!Number.isFinite(n))throw new Error("Coordinate epoch must be finite");r?this.projection.unprojectToSync(t.input,t.output,n):this.projection.projectToSync(t.input,t.output,n)}floatRange(t,r){for(let n=0;n<this.dimension;n++){let i=t[n];if(n<3&&!Number.isFinite(i)||r&&Number.isFinite(i)&&Math.abs(i)>34028234663852886e22)throw new Error("Projection output is nonfinite or exceeds Float32 range")}}flat(t,r,n,i,o,s){if(!zh(t)||!zh(r))throw new Error("Projection buffers require Float32Array or Float64Array");let a=this.inputStride??this.dimension,c=this.outputStride??this.dimension;if(a<this.dimension||c<this.dimension)throw new Error("Interleaved stride must contain every ordinate");let l=this.range($d(t.length,this.inputOffset,a,this.dimension),n,i);if(i+l>$d(r.length,this.outputOffset,c,this.dimension))throw new Error("Projection output buffer is too short");this.epochStorage(s,i,l),this.aliases(t,r,i,l,a,c,this.dimension),this.epochAlias(s,r,i,l,c,this.dimension);let h=this.acquire();try{let u=typeof s=="number"?void 0:s,f=r instanceof Float32Array;for(let d=i;d<i+l;d++){let m=this.inputOffset+d*a,p=this.outputOffset+d*c;for(let g=0;g<this.dimension;g++)h.input[g]=t[m+g];this.transform(h,o,u?u[d]:s),this.floatRange(h.output,f);for(let g=0;g<this.dimension;g++)r[p+g]=h.output[g]}return r}finally{this.depth--}}columns(t,r,n,i,o,s){if(t.length!==this.dimension||r.length!==this.dimension)throw new Error("Projection columns must match dimension");let a=this.inputStride??1,c=this.outputStride??1,l=Number.MAX_SAFE_INTEGER;for(let f=0;f<this.dimension;f++){if(!zh(t[f])||!zh(r[f]))throw new Error("Projection columns require floating typed arrays");l=Math.min(l,$d(t[f].length,this.inputOffset,a,1))}let h=this.range(l,n,i);this.epochStorage(s,i,h);for(let f=0;f<this.dimension;f++){if(i+h>$d(r[f].length,this.outputOffset,c,1))throw new Error("Projection output column is too short");this.epochAlias(s,r[f],i,h,c,1);for(let d=0;d<this.dimension;d++)this.aliases(t[f],r[d],i,h,a,c,1);for(let d=0;d<f&&h;d++){let m=r[f].byteOffset+(this.outputOffset+i*c)*r[f].BYTES_PER_ELEMENT,p=r[d].byteOffset+(this.outputOffset+i*c)*r[d].BYTES_PER_ELEMENT;if(U1(r[f],m,m+((h-1)*c+1)*r[f].BYTES_PER_ELEMENT,r[d],p,p+((h-1)*c+1)*r[d].BYTES_PER_ELEMENT))throw new Error("Projection output columns overlap")}}let u=this.acquire();try{let f=typeof s=="number"?void 0:s;for(let d=i;d<i+h;d++){let m=this.inputOffset+d*a,p=this.outputOffset+d*c;for(let g=0;g<this.dimension;g++)u.input[g]=t[g][m];this.transform(u,o,f?f[d]:s);for(let g=0;g<this.dimension;g++){let y=u.output[g];if(g<3&&!Number.isFinite(y)||r[g]instanceof Float32Array&&Number.isFinite(y)&&Math.abs(y)>34028234663852886e22)throw new Error("Projection output is nonfinite or exceeds Float32 range")}for(let g=0;g<this.dimension;g++)r[g][p]=u.output[g]}return r}finally{this.depth--}}};qt();var UN=240,GN=[9,-18,-88,0,96,90,0,0,-60,-20,-9,18,8,0,-96,30,0,0,60,-20,9,-88,-18,90,96,0,-20,-60,0,0,186,-42,-42,-150,-96,-150,60,60,60,60,54,162,-78,30,-24,-90,-60,60,-60,60,-9,-32,18,30,24,0,20,-60,0,0,-9,8,18,30,-96,0,-20,60,0,0,54,-78,162,-90,-24,30,60,-60,60,-60,-54,78,78,90,144,90,-60,-60,-60,-60,9,-8,-18,-30,-24,0,20,60,0,0,-9,18,-32,0,24,30,0,0,-60,20,9,-18,-8,0,-24,-30,0,0,60,20],zN=372,VN=[0,0,-131,0,138,144,0,0,-102,-31,0,0,7,0,-138,42,0,0,102,-31,62,0,-31,0,0,-62,0,0,0,31,124,0,-62,0,0,-124,0,0,0,62,124,0,-62,0,0,-124,0,0,0,62,62,0,-31,0,0,-62,0,0,0,31,0,0,45,0,-183,-9,0,93,18,0,0,0,216,0,33,87,0,-93,12,-93,0,0,156,0,153,99,0,-93,-12,-93,0,0,-45,0,-3,9,0,93,-18,0,0,0,-55,0,48,42,0,0,-84,31,0,0,-7,0,-48,-42,0,0,84,31],kN=372,qN=[18,-36,-122,0,120,135,0,0,-84,-31,-18,36,-2,0,-120,51,0,0,84,-31,36,-165,-27,93,147,-9,0,-93,18,0,210,45,-111,-93,-57,-192,0,93,12,93,162,141,-75,-93,-129,-180,0,93,-12,93,-36,-21,27,93,39,9,0,-93,-18,0,0,0,62,0,0,31,0,0,0,-31,0,0,124,0,0,62,0,0,0,-62,0,0,124,0,0,62,0,0,0,-62,0,0,62,0,0,31,0,0,0,-31,-18,36,-64,0,66,51,0,0,-102,31,18,-36,2,0,-66,-51,0,0,102,31],jN=12,G1=20/2,WN=2,Vh=class{constructor(t){this._v00=0,this._v01=0,this._v10=0,this._v11=0,this._t=[],this.options=t,this._ix=this.options._width,this._iy=this.options._height,this._hasUint16Data=Bf(t.data)}getHeight(t,r){if(t=Math.abs(t)>90?NaN:t,Number.isNaN(t)||Number.isNaN(r))return NaN;let n=HN(r,360);r=n!==-180?n:180;let i=r*this.options._rlonres,o=-t*this.options._rlatres,s=Math.floor(i),a=Math.min(Math.round((this.options._height-1)/2-1),Math.floor(o));i-=s,o-=a,a+=(this.options._height-1)/2,s+=s<0?this.options._width:s>=this.options._width?-this.options._width:0;let c=0,l=0,h=0,u=0,f=new Array(G1);if(s===this._ix&&a===this._iy)this.options.cubic?f=this._t:(c=this._v00,l=this._v01,h=this._v10,u=this._v11);else if(!this.options.cubic)c=this._rawval(s,a),l=this._rawval(s+1,a),h=this._rawval(s,a+1),u=this._rawval(s+1,a+1);else{let m=[this._rawval(s,a-1),this._rawval(s+1,a-1),this._rawval(s-1,a),this._rawval(s,a),this._rawval(s+1,a),this._rawval(s+2,a),this._rawval(s-1,a+1),this._rawval(s,a+1),this._rawval(s+1,a+1),this._rawval(s+2,a+1),this._rawval(s,a+2),this._rawval(s+1,a+2)],p=VN;a!==0&&(p=a===this.options._height-2?qN:GN);let g=zN;a!==0&&(g=a===this.options._height-2?kN:UN);for(let y=0;y<G1;++y){f[y]=0;for(let _=0;_<jN;++_)f[y]+=m[_]*p[G1*_+y];f[y]/=g}}if(!this.options.cubic){let m=(1-i)*c+i*l,p=(1-i)*h+i*u,g=(1-o)*m+o*p,y=this.options._offset+this.options._scale*g;return this._ix=s,this._iy=a,this._v00=c,this._v01=l,this._v10=h,this._v11=u,y}let d=f[0]+i*(f[1]+i*(f[3]+i*f[6]))+o*(f[2]+i*(f[4]+i*f[7])+o*(f[5]+i*f[8]+o*f[9]));return d=this.options._offset+this.options._scale*d,this._ix=s,this._iy=a,this._t=f,d}_rawval(t,r){t<0?t+=this.options._width:t>=this.options._width&&(t-=this.options._width),(r<0||r>=this.options._height)&&(r=r<0?-r:2*(this.options._height-1)-r,t+=(t<this.options._width/2?1:-1)*this.options._width/2);let n=r*this.options._swidth+t;if(this._hasUint16Data)return this.options.data[this.options._datastart+n];let i=this.options._datastart+WN*n,o=this.options.data[i],s=this.options.data[i+1];return o<<8|s}};function HN(e,t){t=Math.abs(t);let r=Rv(e,t);return 2*Math.abs(r)===t?r-=Rv(e,2*t)-r:2*Math.abs(r)>t&&(r+=r<0?t:-t),r}function Rv(e,t){return e-Math.floor(e/t)*t}var $N=10,YN=65535;function Kd(e,t){let r=KN(e),n=r.next();if(n.done||n.value.line!=="P5")throw new Error("Geoid model file: File not in PGM format");let i=Number.MAX_VALUE,o=0,s=-1,a=-1,c="NONE",l="UNKNOWN",h=0,u=0,f=null,d=null;do{n=r.next();let y=n.value.line;if(y.length)if(y[0]==="#"){let _=y.split(" "),M=_[0],b=_[1];if(M!=="#"||!b)continue;let v=_.length>2?_.slice(2):[];if(b==="Description")c=v.join(" ");else if(b==="DateTime")l=v.join(" ");else if(b==="Offset"){if(!_[2])throw new Error("Geoid model file: Error reading offset");i=parseInt(_[2],10)}else if(b==="Scale"){if(!_[2])throw new Error("Geoid model file: Error reading scale");o=parseFloat(_[2])}else b===(t.cubic?"MaxCubicError":"MaxBilinearError")?isFinite(parseFloat(_[2]))&&(s=parseFloat(_[2])):b===(t.cubic?"RMSCubicError":"RMSBilinearError")&&isFinite(parseFloat(_[2]))&&(a=parseFloat(_[2]))}else{let _=y.split(" ");if(_=_.filter(M=>M!==""),h=parseInt(_[0],10),u=parseInt(_[1],10),!(h&&u))throw new Error("Geoid model file: Error reading raster size");break}}while(!n.done);n=r.next();let m=parseInt(n.value.line,10);if(n.done)throw new Error("Geoid model file: Error reading maxval");if(m!==YN)throw new Error("Geoid model file: Incorrect value of maxval");if(f=n.value.offset,d=h,i===Number.MAX_VALUE)throw new Error("Geoid model file: Offset not set");if(o===0)throw new Error("Geoid model file: Scale not set");if(o<0)throw new Error("Geoid model file: Scale must be positive");if(u<2||h<2)throw new Error("Geoid model file: Raster size too small");if(h&1)throw new Error("Geoid model file: Raster width is odd");if(!(u&1))throw new Error("Geoid model file: Raster height is even");let p=h/360,g=(u-1)/180;return new Vh({cubic:t.cubic,_width:h,_height:u,_rlonres:p,_rlatres:g,_offset:i,_scale:o,_swidth:d,_datastart:f,_maxerror:s,_rmserror:a,_description:c,_datetime:l,data:e})}function*KN(e){let t=0;do{let r=e.indexOf($N,t);if(r!==-1){let n=e.subarray(t,r);t=r+1,yield{offset:t,line:Cv(n)}}else{let n=e.subarray(t,e.length);t=e.length,yield{offset:t,line:Cv(n)}}}while(t<e.length);return{offset:t,line:""}}function Cv(e){let t="";for(let r of e)t+=String.fromCharCode(r);return t}da();function Nv(){return{bounds:[[-1,-1,0],[1,1,0]]}}var z1=Symbol.for("@math.gl/projection/projection-implementations");function V1(){let e=globalThis;return e[z1]||(e[z1]=new WeakMap),e[z1]}function Ov(e){return"create"in e?e:V1().get(e)?.implementation}function Bv(e){if("create"in e)return Promise.resolve(e);let t=V1().get(e);if(t||(t={load:()=>e.preload()},V1().set(e,t)),t.implementation)return Promise.resolve(t.implementation);let r=t;return r.pending||(r.pending=Promise.resolve().then(r.load).then(n=>{let i=s=>s.toLowerCase().replace(/[\s_-]/g,""),o=new Set([n.name,...n.aliases||[]].map(i));if(typeof n.create!="function"||![e.name,...e.aliases||[]].every(s=>o.has(i(s))))throw new Error("Loaded projection does not match descriptor: "+e.name);return r.implementation=n,n}).catch(n=>{throw r.pending=void 0,n})),r.pending}ma();td();var Xd=34028234663852886e22;function Ea(e,t,r){if(!(Array.isArray(e)||e instanceof Float32Array||e instanceof Float64Array))throw new Error("Scalar input requires a number array, Float32Array or Float64Array");if(!(Array.isArray(t)||t instanceof Float32Array||t instanceof Float64Array)||t.length<r)throw new Error("Scalar output requires a preallocated number array, Float32Array or Float64Array with sufficient capacity");if(e===t||Array.isArray(e)||Array.isArray(t))return;let n=e,i=t,o=typeof SharedArrayBuffer<"u"&&n.buffer instanceof SharedArrayBuffer&&i.buffer instanceof SharedArrayBuffer;if((n.buffer===i.buffer||o)&&n.byteOffset<i.byteOffset+r*i.BYTES_PER_ELEMENT&&i.byteOffset<n.byteOffset+n.byteLength)throw new Error("Scalar input/output views overlap; use the same view for in-place projection")}function kh(e,t,r,n){if(t instanceof Float32Array){if(Math.abs(r.x)>Xd||Math.abs(r.y)>Xd||n>=3&&Math.abs(r.z)>Xd)throw new Error("Projected coordinate exceeds Float32 range");for(let i=3;i<e.length;i++){let o=e[i];if(Number.isFinite(o)&&Math.abs(o)>Xd)throw new Error("Trailing ordinate exceeds Float32 range")}}for(let i=3;i<e.length;i++)t[i]=e[i];return t[0]=r.x,t[1]=r.y,n>=3&&(t[2]=r.z),t}Nc();Og();var Lv,Dv=Symbol.for("@math.gl/projection/TypeScriptCRSError"),xn=class e extends Error{static[(Lv=Dv,Symbol.hasInstance)](t){return this!==e?Function.prototype[Symbol.hasInstance].call(this,t):t instanceof Error&&t[Dv]===!0}constructor(t,r){super(r),this.reason=t,this[Lv]=!0,this.name="TypeScriptCRSError"}};function Bt(e){throw new xn("missing-transform-stage",e)}function qh(e,t){if(typeof e=="string"||"type"in e)return{definition:e,lossy:!1};let r=e,n="crs"in r?r:void 0,i="crs"in r?r.crs:r;if(i.state!=="explicit"&&i.state!=="default")throw new xn("unknown-syntax","Cannot transform an "+i.state+" CRS reference");let o=!1;return n?.coordinateEpoch!==void 0&&Bt("Coordinate epochs require a time-dependent transformation"),n?.vertical&&n.vertical.state!=="absent"&&(t.mode!=="horizontal"&&Bt("A separately declared vertical CRS requires explicit horizontal extraction"),o=!0),{definition:i.definition,spatialReference:n,lossy:o}}function Fv(e,t){if(!t)return e;if(t.coordinateFrame!=="unknown"&&t.coordinateFrame!==e.kind)throw new Error("SpatialReference coordinate frame disagrees with its CRS");let r=t.coordinateOrder,n=e.kind==="geocentric"?{x:"e",y:"n",z:"u"}:{longitude:"e",lon:"e",latitude:"n",lat:"n",easting:"e",northing:"n",height:"u",altitude:"u",x:"e",y:"n",z:"u"},i;if(r.length&&(i=r.slice(0,3).map(o=>n[o.toLowerCase()]||"?").join(""),i.length===2&&(i+="u"),(i.length!==3||!i.includes("e")||!i.includes("n")||!i.includes("u"))&&Bt("Unsupported SpatialReference coordinate order"),(r.length>4||r.length>3&&!["m","measure"].includes(r[3]))&&Bt("Unsupported fourth coordinate component")),t.units?.length){let o={m:1,meter:1,metre:1,meters:1,metres:1,km:1e3,ft:.3048,"us-ft":.3048006096012192,degree:Math.PI/180,degrees:Math.PI/180,radian:1,radians:1,grad:Math.PI/200};for(let s=0;s<Math.min(t.units.length,3);s++){let a=(i||"enu")[s]==="u",c=e.kind==="geocentric"?e.toMeter:a?e.verticalUnit:e.kind==="geographic"?e.angularUnit:e.toMeter;(Math.abs((o[t.units[s]]??NaN)-c)>1e-12||o[t.units[s]]===void 0)&&Bt("SpatialReference units disagree with its CRS")}}return Object.freeze({...e,storedAxis:i})}Ee();var Uv={towgs84:"0,0,0",ellipse:"WGS84"},Gv={towgs84:"0,0,0",ellipse:"GRS80"},k1={wgs84:Uv,WGS84:Uv,nad83:Gv,North_American_Datum_1983:Gv},zv=new WeakMap,Ta=e=>e.toLowerCase().replace(/[\s_-]/g,"");function Zc(e){if(!e.datumCatalogs?.length)return k1;let t=zv.get(e);if(t?.catalogs===e.datumCatalogs)return t.definitions;let r=Object.assign(Object.create(null),k1),n=new Map(Object.entries(k1).map(([i,o])=>[Ta(i),{definition:o,owner:-1}]));return e.datumCatalogs.forEach((i,o)=>{if(!i.name||!i.datums)throw new Error("Invalid datum catalogue plugin");for(let[s,a]of Object.entries(i.datums)){let c=Ta(s);if(!c||c==="none"||!a||["ellipse","towgs84","nadgrids"].some(h=>a[h]!==void 0&&typeof a[h]!="string"))throw new Error("Invalid datum definition: "+s);let l=n.get(c);if(l&&(l.owner!==o||l.definition.ellipse!==a.ellipse||l.definition.towgs84!==a.towgs84||l.definition.nadgrids!==a.nadgrids))throw new Error("Conflicting datum registration: "+s);n.set(c,{definition:a,owner:o}),r[s]=a}}),zv.set(e,{catalogs:e.datumCatalogs,definitions:r}),r}var ZN={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563396e-3,b:635625691e-2,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340189e-3,b:6356034446e-3,ellipseName:"Modified Airy"},andrae:{a:637710443e-2,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397155e-3,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483865e-3,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:63782064e-1,b:63565838e-1,ellipseName:"Clarke 1866"},clrk80:{a:6378249145e-3,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:63782492e-1,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293645208759e-9,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:63757387e-1,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:637813605e-2,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276345e-3,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304063e-3,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301243e-3,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295664e-3,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298556e-3,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:63781575e-1,b:63567722e-1,ellipseName:"New International 1967"},plessis:{a:6376523,b:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:63567733205e-4,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:63558348467e-4,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS72:{a:6378135,rf:298.26,ellipseName:"WGS 72"},WGS84:{a:6378137,rf:298.257223563,ellipseName:"WGS 84"},sphere:{a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"}},Vv=ZN;var on={};on.greenwich=0;on.lisbon=-9.131906111111;on.paris=2.337229166667;on.bogota=-74.080916666667;on.madrid=-3.687938888889;on.rome=12.452333333333;on.bern=7.439583333333;on.jakarta=106.807719444444;on.ferro=-17.666666666667;on.brussels=4.367975;on.stockholm=18.058277777778;on.athens=23.7163375;on.oslo=10.722916666667;var kv=on;Bg();var qv={WGS84:"+proj=longlat +datum=WGS84","EPSG:4326":"+proj=longlat +datum=WGS84","EPSG:4269":"+proj=longlat +datum=NAD83","EPSG:4978":"+proj=geocent +datum=WGS84","EPSG:4979":"+proj=longlat +datum=WGS84","EPSG:3857":"+proj=merc +a=6378137 +b=6378137 +nadgrids=@null +units=m","EPSG:3785":"EPSG:3857",GOOGLE:"EPSG:3857","EPSG:900913":"EPSG:3857","EPSG:102113":"EPSG:3857"},Zd=["proj","datum","ellps","a","b","rf","f","R","units","to_meter","vunits","vto_meter","no_defs","type","title","towgs84","nadgrids","geoidgrids","axis","pm","over","lon_wrap"],Yv=["no_defs","over"],Li=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),jv=e=>e.toLowerCase().replace(/[\s_-]/g,"");function q1(e,t){let r=Object.keys(e).find(n=>jv(n)===jv(t));return r===void 0?void 0:e[r]}function Wv(e){if(/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i.test(e)){let r=Number(e);if(Number.isFinite(r))return r}if(/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?r$/i.test(e)){let r=Number(e.slice(0,-1))/Me;if(Number.isFinite(r))return r}let t=/^([+-]?)(\d+(?:\.\d*)?)(?:d(?:(\d+(?:\.\d*)?)'(?:(\d+(?:\.\d*)?)")?)?)?([NSEW])?$/i.exec(e);if(t&&(/d/i.test(e)||t[5])){let r=Number(t[3]||0),n=Number(t[4]||0);if(r<60&&n<60){let i=t[1]==="-"?-1:1,o=/[SW]/i.test(t[5]||"")?-1:1,s=i*o*(Number(t[2])+r/60+n/3600);if(Number.isFinite(s))return s}}throw new Error("Invalid angular parameter: "+e)}function j1(e,t={}){let r=e,n=t.aliases||{},i=new Set;for(;typeof r=="string"&&(Li(n,r)||Li(qv,r));){if(i.has(r))throw new Error("Circular CRS alias: "+r);i.add(r),r=Li(n,r)?n[r]:qv[r]}if(typeof r=="string"){let o=/^EPSG:(326|327)(\d{2})$/.exec(r);o&&Number(o[2])>=1&&Number(o[2])<=60&&(r="+proj=utm +datum=WGS84 +zone="+Number(o[2])+(o[1]==="327"?" +south":"")),(r==="EPSG:5041"||r==="EPSG:5042")&&(r="+proj=stere +datum=WGS84 +lat_0="+(r==="EPSG:5041"?90:-90)+" +k_0=0.994 +x_0=2000000 +y_0=2000000")}return r}function lo(e,t={}){let r=Zc(t),n=qh(e,t),i=j1(n.definition,t),o;if(tr(i)==="proj-string"&&typeof i=="string"){let N=Object.create(null);for(let B of ph(i).parameters){if(Li(N,B.name))throw new Error("Duplicate PROJ parameter: +"+B.name);N[B.name]=B.value}o={parameters:N}}else{let N=t.parsers?.find(B=>B.canParse(i));if(!N){let B=["wkt","projjson"].includes(tr(i));throw new xn(B?"missing-parser":"unknown-syntax",tr(i)==="identifier"?"Unsupported CRS definition: "+i+"; resolve it first":"Unsupported CRS definition; register a WKT or PROJJSON parser for structured definitions")}o=N.parse(i,t)}let s={...o.parameters};for(let N of["lon_0","lat_0","lat_1","lat_2","lat_ts","lon_wrap","lon_1","lon_2","lonc","alpha","gamma","tilt","azi","o_alpha","o_lon_c","o_lat_c","o_lon_p","o_lat_p","o_lon_1","o_lat_1","o_lon_2","o_lat_2"])s[N]!==void 0&&(s[N]=String(Wv(s[N])));let a=s.proj,c=a?.toLowerCase(),l=c==="geocentric"?"geocent":["longlat","latlong","latlon","lonlat","identity","geocent"].includes(c)?c:a;if(!l)throw new Error("CRS requires +proj");let h=["longlat","latlong","latlon","lonlat"].includes(l)?"geographic":l==="geocent"?"geocentric":l==="identity"?"identity":"projected",u=s.datum,f=u&&u!=="none"?q1(r,u):void 0;u&&u!=="none"&&!f&&Bt("Unknown datum: "+u+"; register a datumCatalogs plugin");let d=$v(s,f?.ellipse),m=s.nadgrids??f?.nadgrids,p=m===void 0?void 0:m.split(",").map(N=>{let B=N.startsWith("@"),C=B?N.slice(1):N;if(!C||/\s/.test(C))throw new Error("Invalid datum grid name");return Object.freeze({name:C,optional:B})}),g=s.towgs84??f?.towgs84,y;if(g!==void 0&&(y=g.split(",").map(N=>tt({value:N},"value",NaN)),![3,7].includes(y.length)||y.some(N=>!Number.isFinite(N))||y.length===7&&y[6]<=-1e6))throw new Error("+towgs84 requires three or seven finite values and positive scale");u==="none"&&(y=void 0),p&&u!=="none"&&(y=[0,0,0]);let _=m==="@null"||m==="null"?$v({ellps:"WGS84"}):d,M=s.axis||"enu";if(M.length!==3||!/[ew]/.test(M)||!/[ns]/.test(M)||!/[ud]/.test(M))throw new Error("Invalid axis: "+M);let b=o.angularUnit??Me;if(h==="geographic"&&(s.units&&s.units!=="degrees"||Li(s,"to_meter")))throw new Error("Geographic coordinates must use angular units");if(h!=="geographic"&&s.units==="degrees")throw new Error("Linear coordinates require linear units");let v=Hv(s,"units","to_meter"),T=o.verticalUnit??Hv(s,"vunits","vto_meter");if(!(T>0)||!Number.isFinite(T))throw new Error("Invalid vertical unit");if(!(b>0)||!Number.isFinite(b))throw new Error("Invalid angular unit");let S=s.pm,E=S===void 0?0:(q1(kv,S)??Wv(S))*Me;return Fv(Object.freeze({kind:h,projection:l,parameters:Object.freeze(s),ellipsoid:d,datum:Object.freeze({ellipsoid:_,towgs84:y&&Object.freeze(y),grids:u==="none"||m==="@null"||m==="null"?void 0:p&&Object.freeze(p)}),areaOfUse:o.areaOfUse,angularUnit:b,toMeter:v,verticalUnit:T,primeMeridian:E,axis:M,longitudeWrap:s.lon_wrap===void 0?void 0:Number(s.lon_wrap)*Me,lossy:!!(o.lossy||n.lossy)}),n.spatialReference)}function Hv(e,t,r){let n=e[t],i=gh;if(t==="vunits"&&n==="degrees")throw new Error("Height requires linear units");if(n&&!["m","degrees"].includes(n)&&!Li(i,n))throw new Error("Unsupported units: "+n);let o=tt(e,r,n&&i[n]?i[n].metersPerUnit:1);if(!(o>0))throw new Error("+"+r+" must be positive");return o}function $v(e,t){let r=t||e.ellps||"WGS84",n=q1(Vv,r);if(!n)throw new Error("Unsupported ellipsoid: "+r);let i=tt(e,"a",n.a),o=tt(e,"f",NaN),s=tt(e,"rf",Number.isNaN(o)?n.rf||0:o===0?0:1/o),a=tt(e,"b",s?i*(1-1/s):Li(e,"f")||Li(e,"rf")||Li(e,"a")?i:n.b||i),c=tt(e,"R",0);if(i<=0||a<=0||a>i||s<0||s>0&&s<=1||Li(e,"R")&&c<=0||!Number.isNaN(o)&&(o<0||o>=1))throw new Error("Invalid ellipsoid dimensions");return Object.freeze({semiMajorAxis:c||i,semiMinorAxis:c||a,eccentricitySquared:c?0:1-(a/i)**2})}qt();var W1=Math.PI/(180*3600),Jd={ellipsoid:{semiMajorAxis:6378137,semiMinorAxis:6356752314245179e-9,eccentricitySquared:.0066943799901413165},towgs84:[0,0,0]};function tm(e,t){if(Math.abs(e.y)>Math.PI/2)throw new Error("Latitude outside geocentric domain");if(!ah(e,t))throw new Error("Geocentric coordinate must be finite")}function em(e,t){let r=e.x,n=e.y,i=e.z,{semiMajorAxis:o,semiMinorAxis:s,eccentricitySquared:a}=t;if(r===0&&n===0&&i===0)throw new Error("Geodetic coordinates are undefined at the Earth center");if(a!==0&&Math.abs(r)<1e-12*o&&Math.abs(n)<1e-12*o&&Math.hypot(r,n)<1e-12*o){if(!Number.isFinite(Math.hypot(r,n,i)))throw new Error("Geocentric radius must be finite");e.x=0,e.y=Math.sign(i)*Math.PI/2,e.z=Math.abs(i)-s;return}if(!ch(e,t))throw Number.isFinite(Math.hypot(r,n,i))?new Error("Geocentric inverse did not converge"):new Error("Geocentric radius must be finite")}function Kv(e,t){let r=e[0],n=e[1],i=e[2],o=(e[3]||0)*W1,s=(e[4]||0)*W1,a=(e[5]||0)*W1,c=1+(e[6]||0)/1e6;return t?l=>{let h=(l.x-r)/c,u=(l.y-n)/c,f=(l.z-i)/c;l.x=h+a*u-s*f,l.y=-a*h+u+o*f,l.z=s*h-o*u+f}:l=>{let h=l.x,u=l.y,f=l.z;l.x=c*(h-a*u+s*f)+r,l.y=c*(a*h+u-o*f)+n,l.z=c*(-s*h+o*u+f)+i}}function Qd(e){return!!e.towgs84?.some(t=>t!==0)}function $1(e,t){if(!(!e.towgs84||!t.towgs84)){if(e.grids||t.grids){if(e.grids&&t.grids&&e.ellipsoid.semiMajorAxis===t.ellipsoid.semiMajorAxis&&e.ellipsoid.eccentricitySquared===t.ellipsoid.eccentricitySquared&&e.grids.length===t.grids.length&&e.grids.every((n,i)=>n.name===t.grids[i].name&&n.optional===t.grids[i].optional&&n.grid===t.grids[i].grid))return;let r=$1(e.grids?Jd:e,t.grids?Jd:t);return n=>{e.grids&&Xv(n,e,!1),r?.(n),t.grids&&Xv(n,t,!0)}}if(Qd(e)||Qd(t)){let r=H1(e,Jd),n=H1(Jd,t);return i=>{r?.(i),n?.(i)}}return H1(e,t)}}function H1(e,t){if(!e.towgs84||!t.towgs84)return;let r=e.ellipsoid,n=t.ellipsoid,i=!0;for(let a=0;a<7;a++)(e.towgs84[a]||0)!==(t.towgs84[a]||0)&&(i=!1);if(r.semiMajorAxis===n.semiMajorAxis&&Math.abs(r.eccentricitySquared-n.eccentricitySquared)<=5e-11&&i)return;let o=Qd(e)?Kv(e.towgs84,!1):void 0,s=Qd(t)?Kv(t.towgs84,!0):void 0;return a=>{tm(a,r),o?.(a),s?.(a),em(a,n)}}function Xv(e,t,r){for(let n of t.grids){if(n.name==="null")return;if(!n.grid){if(n.optional)continue;throw new Error("Required datum grid is not registered: "+n.name)}let i=!1;if(n.grid.shiftInPlace)i=n.grid.shiftInPlace(e,r);else{let o=n.grid.shift(e.x,e.y,r);o&&(e.x=o[0],e.y=o[1],i=!0)}if(i){if(!Number.isFinite(e.x)||!Number.isFinite(e.y)||Math.abs(e.y)>Math.PI/2)throw new Error("Datum grid produced a coordinate outside the geographic domain");return}}throw new Error("No datum grid covers coordinate: "+t.grids.map(n=>n.name).join(","))}function Zv(e,t){let r={x:e[0],y:e[1],z:e[2]};return tm(r,t),[r.x,r.y,r.z]}function Jv(e,t){let r={x:e[0],y:e[1],z:e[2]};return em(r,t),[r.x,r.y,r.z]}Ee();Ee();ne();Ie();function is(e,t=0){let r=tt(e,"lon_wrap",0)*Me;return n=>Ke(i=>{let o=gr(i,r);return[[r+o[0],i[0][1],0],[r+o[1],i[1][1],0]]},n??[-180,-90,180,90],r,t)}function Qv(e,t={}){if(e===void 0)return;let r=[];for(let n of e.split(",")){let i=n.startsWith("@"),o=i?n.slice(1):n;if(!o||/\s/.test(o))throw new Error("Invalid vertical grid name");if(o==="null"){r.push(null);break}let s=Object.prototype.hasOwnProperty.call(t,o)?t[o]:void 0;if(s){if(typeof s.getOffset!="function")throw new Error("Invalid vertical grid: "+o);r.push(s.getOffset.bind(s))}else i||Bt("Required vertical grid is not registered: "+o)}return(n,i)=>{for(let o of r){if(!o)return 0;let s=o(n,i);if(s!==void 0){if(!Number.isFinite(s))throw new Error("Vertical grid returned a non-finite offset");return s}}throw new Error("No vertical grid covers this coordinate")}}function Y1(e){let t=Object.freeze({...e.ellipsoid});return Object.freeze({kind:e.kind,projection:e.projection,parameters:Object.freeze(Object.fromEntries(Object.entries(e.parameters).map(([r,n])=>[r,n??null]))),ellipsoid:t,datum:Object.freeze({ellipsoid:Object.freeze({...e.datum.ellipsoid}),towgs84:e.datum.towgs84&&Object.freeze([...e.datum.towgs84]),grids:e.datum.grids&&Object.freeze(e.datum.grids.map(r=>Object.freeze({name:r.name,optional:r.optional,loaded:!!r.grid})))}),angularUnit:e.angularUnit,toMeter:e.toMeter,verticalUnit:e.verticalUnit,primeMeridian:e.primeMeridian,axis:e.axis,storedAxis:e.storedAxis,longitudeWrap:e.longitudeWrap,areaOfUse:e.areaOfUse&&Object.freeze([...e.areaOfUse]),lossy:e.lossy,algorithm:e.algorithm&&Object.freeze({...e.algorithm})})}function tE(e,t,r,n){let i=[];return e.algorithm||i.push("source-algorithm"),t.algorithm||i.push("target-algorithm"),(e.datum.grids||t.datum.grids||e.parameters.geoidgrids||t.parameters.geoidgrids)&&i.push("grid-resource"),Object.freeze({version:1,source:e,target:t,forward:r,inverse:n,lossy:e.lossy||t.lossy,complete:i.length===0,opaqueReasons:Object.freeze(i)})}var jh=class e{static async create(t={}){let r=await Promise.all(eE(t).map(Bv));return new e({...t,projections:r})}get targetProfile(){return this.getTargetRenderingProfile(this.targetCoverage)}getTargetRenderingProfile(t){return this.targetRenderingProfile&&Jb(this.targetRenderingProfile,t)}get description(){return this.deferred?.implementation?.description??this.resolvedDescription}constructor(t={}){this.coordinateScratch=new Ho,this.targetLongitudeOrigin=0;let r=t.projections||[],n=oE(r);if(r.some(i=>!("create"in i))){let i=lo(t.from??"WGS84",t),o=lo(t.to??"WGS84",t);this.lossy=i.lossy||o.lossy,this.deferred={options:{...t,projections:[...r]}}}else{let i=t,o=n,s=rE(i.from??"WGS84",o,i),a=rE(i.to??"WGS84",o,i);this.targetRenderingProfile=a.implementation?.getRenderingProfile?.bind(a.implementation)??(a.kind==="geographic"?is(a.parameters,a.primeMeridian):a.kind==="identity"?Nv:void 0),this.targetCoverage=a.areaOfUse,this.targetLongitudeOrigin=a.implementation?.longitudeOrigin??(a.kind==="geographic"?a.longitudeWrap??0:0),this.lossy=s.lossy||a.lossy,this.lossy&&(s.kind==="geocentric"||a.kind==="geocentric")&&Bt("Horizontal extraction cannot supply ellipsoidal height for geocentric coordinates"),this.lossy&&(s.verticalGrid||a.verticalGrid)&&Bt("Horizontal extraction cannot be combined with vertical grids"),this.forwardTransform=iE(s,a,!!t.enforceAxis),this.inverseTransform=iE(a,s,!!t.enforceAxis),this.resolvedDescription=tE(Y1(s),Y1(a),this.forwardTransform.description,this.inverseTransform.description)}this.project=this.project.bind(this),this.unproject=this.unproject.bind(this),this.projectTo=this.projectTo.bind(this),this.unprojectTo=this.unprojectTo.bind(this),this.projectToSync=this.projectToSync.bind(this),this.unprojectToSync=this.unprojectToSync.bind(this),this.projectFlat=this.projectFlat.bind(this),this.unprojectFlat=this.unprojectFlat.bind(this),this.projectSync=this.projectSync.bind(this),this.unprojectSync=this.unprojectSync.bind(this),this.projectFlatSync=this.projectFlatSync.bind(this),this.unprojectFlatSync=this.unprojectFlatSync.bind(this)}load(){let t=this.deferred;return t?t.implementation?Promise.resolve(t.implementation):(t.pending||(t.pending=e.create(t.options).then(r=>(t.implementation=r,r)).catch(r=>{throw t.pending=void 0,r})),t.pending):Promise.resolve(this)}loadSync(){let t=this.deferred;if(!t)return this;if(!t.implementation){let r=eE(t.options).map(n=>{let i=Ov(n);if(!i)throw new Error("Projection is not preloaded: "+n.name+". Call preload() first.");return i});t.implementation=new e({...t.options,projections:r})}return t.implementation}projectSync(t){return this.deferred?this.loadSync().project(t):Jc(t,this.forwardTransform,this.coordinateScratch)}unprojectSync(t){return this.deferred?this.loadSync().unproject(t):Jc(t,this.inverseTransform,this.coordinateScratch)}projectFlatSync(t,r=2){return this.deferred?this.loadSync().projectFlat(t,r):rm(t,r,this.forwardTransform,this.coordinateScratch)}unprojectFlatSync(t,r=2){return this.deferred?this.loadSync().unprojectFlat(t,r):rm(t,r,this.inverseTransform,this.coordinateScratch)}async preload(){await this.load()}project(t){return this.deferred?this.projectLoaded(t,!1):Jc(t,this.forwardTransform,this.coordinateScratch)}unproject(t){return this.deferred?this.projectLoaded(t,!0):Jc(t,this.inverseTransform,this.coordinateScratch)}projectTo(t,r){return this.deferred?this.projectToLoaded(t,r,!1):this.projectToSync(t,r)}unprojectTo(t,r){return this.deferred?this.projectToLoaded(t,r,!0):this.unprojectToSync(t,r)}projectToSync(t,r){return this.deferred?this.loadSync().projectTo(t,r):(Ea(t,r,Math.max(t.length,this.forwardTransform.geocentricOutput?3:2)),Jc(t,this.forwardTransform,this.coordinateScratch,r))}unprojectToSync(t,r){return this.deferred?this.loadSync().unprojectTo(t,r):(Ea(t,r,Math.max(t.length,this.inverseTransform.geocentricOutput?3:2)),Jc(t,this.inverseTransform,this.coordinateScratch,r))}projectToLoaded(t,r,n){Ea(t,r,t.length);let i=t.slice();return this.load().then(o=>n?o.unprojectTo(i,r):o.projectTo(i,r))}projectLoaded(t,r){let n=t.slice();return this.load().then(i=>r?i.unproject(n):i.project(n))}projectFlat(t,r=2){return this.deferred?this.load().then(i=>i.projectFlat(t,r)):rm(t,r,this.forwardTransform,this.coordinateScratch)}unprojectFlat(t,r=2){return this.deferred?this.load().then(i=>i.unprojectFlat(t,r)):rm(t,r,this.inverseTransform,this.coordinateScratch)}};function eE(e){let t=oE(e.projections||[]),r=new Set;for(let n of[e.from??"WGS84",e.to??"WGS84"]){let i=lo(n,e);if(["geographic","identity"].includes(i.kind))continue;let o=t.get(nm(i.projection));if(!o)throw new xn("missing-plugin","Projection plugin is not registered: "+i.projection);r.add(o)}return[...r]}var nm=e=>e.toLowerCase().replace(/[\s_-]/g,"");function oE(e){let t=new Map;for(let r of e)for(let n of new Set([r.name,...r.aliases||[]].map(nm))){if(!n||["longlat","latlong","latlon","lonlat","identity"].includes(n)||t.has(n))throw new Error("Duplicate or reserved projection plugin: "+n);t.set(n,r)}return t}function rE(e,t,r){let n=lo(e,r),i=t.get(nm(n.projection));if(!["geographic","identity"].includes(n.kind)&&!i)throw new xn("missing-plugin","Projection plugin is not registered: "+n.projection);let o=new Set([...Zd,...i?.parameters||[]]);for(let m of Object.keys(n.parameters)){if(!o.has(m))throw new xn("missing-transform-stage","Unsupported PROJ parameter: +"+m);let p=Yv.includes(m)||i?.flags?.includes(m);if(p&&n.parameters[m]!==void 0)throw new Error("Expected a flag without a value: +"+m);if(!p&&!n.parameters[m])throw new Error("PROJ parameter requires a value: +"+m)}if(n.parameters.type&&n.parameters.type!=="crs")throw new Error("Only +type=crs is supported");let s=nm(n.projection)==="fasttransversemercator"?Object.freeze({...n.parameters,approx:void 0}):n.parameters,a=i?.create({...n.ellipsoid,parameters:s,primeMeridian:n.primeMeridian});if(n.kind==="geocentric"&&(!a?.forward3D||!a?.inverse3D))throw new Error("Geocentric plugin must implement 3D operations");let c=n.datum.grids,l=c?.findIndex(m=>m.name==="null")??-1,h=c?.slice(0,l<0?void 0:l+1).map(m=>{let p=Object.prototype.hasOwnProperty.call(r.datumGrids||{},m.name)?r.datumGrids[m.name]:void 0;if(p&&typeof p.shift!="function")throw new Error("Invalid prepared datum grid: "+m.name);return Object.freeze({...m,grid:p})});for(let m of h||[]){if(m.name==="null")break;!m.optional&&!m.grid&&Bt("Required datum grid is not registered: "+m.name)}let u=h?Object.freeze({...n.datum,grids:Object.freeze(h)}):n.datum,f=Qv(n.parameters.geoidgrids,r.verticalGrids);f&&(n.kind==="geocentric"||n.kind==="identity"||n.lossy)&&Bt("Vertical grids require a non-lossy geographic or projected CRS");let d=i?i.semantics:{id:"@math.gl/geospatial/"+n.kind,version:1};return{...n,datum:u,implementation:a,verticalGrid:f,algorithm:d}}function K1(e){return Number.isFinite(e.x)&&Number.isFinite(e.y)&&Number.isFinite(e.z)}function nE(e,t){if(e==="enu")return;let r=[0,0,0],n=[0,0,0];for(let i=0;i<3;i++){let o=e[i],s="ew".includes(o)?0:"ns".includes(o)?1:2;r[t?i:s]=t?s:i,n[t?i:s]="wsd".includes(o)?-1:1}return i=>{let o=i.x,s=i.y,a=i.z;i.x=n[0]*(r[0]===0?o:r[0]===1?s:a),i.y=n[1]*(r[1]===0?o:r[1]===1?s:a),i.z=n[2]*(r[2]===0?o:r[2]===1?s:a)}}function iE(e,t,r){let n=e.storedAxis||(r?e.axis:"enu"),i=t.storedAxis||(r?t.axis:"enu"),o=nE(n,!1),s=nE(i,!0),a=e.implementation&&oo(e.implementation,!0,e.kind==="geocentric"),c=t.implementation&&oo(t.implementation,!1,t.kind==="geocentric"),l=$1(e.datum,t.datum),h=e.lossy||t.lossy,u=e.kind==="geocentric",f=e.kind==="geographic"?e.angularUnit:e.toMeter,d=t.kind==="geographic"?t.angularUnit:t.toMeter,m=u?1:e.verticalUnit,p=t.kind==="geocentric"?d:t.verticalUnit,g=e.primeMeridian,y=t.primeMeridian,_=t.kind==="geographic"?t.longitudeWrap:void 0,M;if(!l&&!e.verticalGrid&&!t.verticalGrid&&!h&&!o&&!s&&!g&&!y&&e.verticalUnit===1&&t.verticalUnit===1&&_===void 0){let T=Object.freeze({inputScale:f,outputScale:d});e.kind==="geographic"&&t.kind==="projected"&&(M=t.implementation?.createForwardFlat?.(T)),e.kind==="projected"&&t.kind==="geographic"&&(M=e.implementation?.createInverseFlat?.(T))}let b=!!(e.verticalGrid||t.verticalGrid)||e.kind==="geocentric"||/[ud]/.test(n.slice(0,2))||/[ud]/.test(i.slice(0,2)),v=[];return o&&v.push("input-axis"),h&&v.push("discard-height"),f!==1&&v.push("input-scale"),a&&v.push("source-inverse"),m!==1&&v.push("input-height-scale"),v.push("geographic-domain-check"),g&&v.push("source-prime-meridian"),e.verticalGrid&&v.push("source-vertical-grid"),l&&v.push("datum"),t.verticalGrid&&v.push("target-vertical-grid"),y&&v.push("target-prime-meridian"),_!==void 0&&v.push("longitude-wrap"),c&&v.push("target-forward"),d!==1&&v.push("output-scale"),p!==1&&v.push("output-height-scale"),h&&v.push("restore-height"),s&&v.push("output-axis"),{description:Object.freeze({inputAxis:n,outputAxis:i,requiresInputZ:b,geocentricOutput:t.kind==="geocentric",stages:Object.freeze(v)}),flat:M,requiresInputZ:b,geocentricOutput:t.kind==="geocentric",run(T){if(!K1(T))throw new Error("Coordinates must contain finite x, y and optional z values");o?.(T);let S=T.z;if(h&&(T.z=0),f!==1&&(T.x*=f,T.y*=f,u&&(T.z*=f)),a?.(T),m!==1&&(T.z*=m),Math.abs(T.y)>Math.PI/2||!K1(T))throw new Error("Coordinate is outside the geographic domain");if(T.x+=g,e.verticalGrid&&(T.z+=e.verticalGrid(T.x,T.y)),l?.(T),t.verticalGrid&&(T.z-=t.verticalGrid(T.x,T.y)),T.x-=y,_!==void 0&&(T.x=_+ve(T.x-_)),c?.(T),d!==1&&(T.x/=d,T.y/=d),p!==1&&(T.z/=p),h&&(T.z=S),s?.(T),!K1(T))throw new Error("Projection produced non-finite coordinates")}}}function Jc(e,t,r,n){if(e.length<2)throw new Error("Coordinates must contain finite x, y and optional z values");if(e.length<3&&t.requiresInputZ)throw new Error("This transform requires three ordinates");let i=Math.max(e.length,t.geocentricOutput?3:2),o=r.acquire();try{if(o.x=e[0],o.y=e[1],o.z=e.length>=3?e[2]:0,t.run(o),n)return kh(e,n,o,i);let s=e.slice();return s[0]=o.x,s[1]=o.y,(e.length>=3||t.geocentricOutput)&&(s[2]=o.z),s}finally{r.release(o)}}function rm(e,t,r,n){if(!(e instanceof Float32Array||e instanceof Float64Array))throw new Error("In-place projection requires a Float32Array or Float64Array");if(!Number.isSafeInteger(t)||t<2||e.length%t!==0)throw new Error("Dimension must be an integer >= 2 and divide the typed array length");if(t<3&&(r.requiresInputZ||r.geocentricOutput))throw new Error("This transform requires a dimension of at least 3");if(r.flat)return r.flat(e,t),e;let i=n.acquire();try{let o=e instanceof Float32Array;for(let s=0;s<e.length;s+=t){if(i.x=e[s],i.y=e[s+1],i.z=t>=3?e[s+2]:0,r.run(i),o&&(Math.abs(i.x)>34028234663852886e22||Math.abs(i.y)>34028234663852886e22||t>=3&&Math.abs(i.z)>34028234663852886e22))throw new Error("Projected coordinate exceeds Float32 range");e[s]=i.x,e[s+1]=i.y,t>=3&&(e[s+2]=i.z)}return e}finally{n.release(i)}}var im=class{constructor(t){this.sample=t,this.result=[0,0,0],this.samples=Array.from({length:4},()=>[0,0,0]),this.coarse=[0,0,0],this.fine=[0,0,0]}evaluate(t,r,n=1e-6){if(!this.difference(t,this.coarse)||!this.difference(t/2,this.fine))return!1;let i=n*Math.max(r,Math.abs(this.fine[0]),Math.abs(this.fine[1]),Math.abs(this.fine[2]));for(let o=0;o<3;o++)if(Math.abs(this.coarse[o]-this.fine[o])>i||(this.fine[o]+=(this.fine[o]-this.coarse[o])/15,!Number.isFinite(this.fine[o])))return!1;for(let o=0;o<3;o++)this.result[o]=this.fine[o];return!0}difference(t,r){let[n,i,o,s]=this.samples;if(!this.sample(-2*t,n)||!this.sample(-t,i)||!this.sample(t,o)||!this.sample(2*t,s))return!1;for(let a=0;a<3;a++)if(r[a]=(n[a]-s[a]+8*(o[a]-i[a]))/(12*t),!Number.isFinite(r[a]))return!1;return!0}};var Wh=Math.PI/180,sE=lo("WGS84").ellipsoid;function X1(e){if(e.length!==3||e.some(t=>!Number.isFinite(t)||t<=0))throw new Error("Invalid CRS rendering scale");return e}function aE(e,t,r,n){if(e.kind==="geocentric")return X1([e.toMeter,e.toMeter,e.toMeter]);if(e.kind==="identity")return X1([...r].map(m=>/[ud]/.test(m)?e.verticalUnit:e.toMeter));let i=[0,0,0],o=[0,0,0],s=[0,0,0],a=[0,0,0],c=Array.from({length:3},()=>[0,0,0]),l=0,h=0,u=0,f=!1,d=new im((m,p)=>{for(let _=0;_<3;_++)o[_]=i[_];o[l]+=m,t.unprojectTo(o,a);let g=a[0]-s[0],y=Math.abs(g)<=180?g:((g+180)%360+360)%360-180;return Math.abs(a[1])>=90?!1:(p[0]=y*h,p[1]=(a[1]-s[1])*u,p[2]=a[2]-s[2],p.every(Number.isFinite))});return m=>{if(f||m.length<2)return null;f=!0;let p;try{if(i[0]=m[0],i[1]=m[1],i[2]=m[2]??0,!i.every(Number.isFinite))return null;t.unprojectTo(i,s);let g=s[1]*Wh,y=sE.semiMajorAxis,_=sE.eccentricitySquared,M=1-_*Math.sin(g)**2;if(h=y*Math.cos(g)/Math.sqrt(M)*Wh,u=y*(1-_)/M**1.5*Wh,!(h>y*Wh*1e-8)||!(u>0))return null;let b=((s[0]-n+180)%360+360)%360-180;if((e.kind==="geographic"?e.longitudeWrap!==void 0:!Object.prototype.hasOwnProperty.call(e.parameters,"over"))&&Math.abs(b)+2/h>=180||Math.abs(s[1])+2/u>=90)return null;for(l=0;l<3;l++){let T=r[l],S=/[ud]/.test(T)?e.verticalUnit:e.kind==="geographic"?(/[ew]/.test(T)?h:u)*e.angularUnit/Wh:e.toMeter;if(!d.evaluate(1/S,S))return null;for(let E=0;E<3;E++)c[l][E]=d.result[E]}if(p=c.map(T=>Math.hypot(...T)),e.kind==="projected"){let T=c[r.search(/[ew]/)],S=c[r.search(/[ns]/)],E=Math.abs(T[0]*S[1]-T[1]*S[0])/e.toMeter**2;p[r.search(/[ud]/)]=e.verticalUnit*Math.sqrt(E)}}catch{return null}finally{f=!1}return X1(p)}}Bg();var cE={degrees:Math.PI/180,radians:1,gradians:Math.PI/200},JN={...Object.fromEntries(Object.values(gh).map(e=>[e.name,e.metersPerUnit]))};async function fE(e,t,r,n={},i=!1,o){let s=typeof t=="string"?t:JSON.parse(JSON.stringify(t)),a={enforceAxis:r.enforceAxis,mode:r.mode,...n,converters:n.converters&&[...n.converters]},c=o?await o(s,{...r,...a}):s,l=lo(c,{...r,...a}),h=await e.createProjectionAsync({...a,from:"WGS84",to:c}),u=l.storedAxis||(a.enforceAxis?l.axis:"enu"),f=uE(l.kind==="geographic"?l.angularUnit:l.toMeter,l.kind==="geographic"),d=uE(l.verticalUnit,!1),m=[...u].map(E=>l.kind!=="geocentric"&&/[ud]/.test(E)?d:f),p=h.targetProfile;if(!p)throw new Error("Projection must define a rendering profile for CRS retrieval");let g=(h.targetLongitudeOrigin+l.primeMeridian)*180/Math.PI,y=eO(p,l,u),_=tO(p.normalize),M=aE(l,h,u,g),b=[...new Set(["WGS84",...a.converters||[]])];if(b.some(E=>typeof E!="string"||!E.trim()))throw new Error("Converter source CRS must be a nonempty string");let v=await Promise.all(b.map(async E=>{if(E==="WGS84")return[E,lE(h,_)];let[N,B]=await Promise.all([e.createProjectionAsync({...a,from:E,to:c}),e.createProjectionAsync({...a,from:"WGS84",to:E})]);return[E,lE(N,QN(B,_))]})),T=Object.assign(Object.create(null),Object.fromEntries(v)),S={coordinateFrame:l.kind,projection:l.projection,parameters:l.parameters,ellipsoid:{semiMajorAxis:l.ellipsoid.semiMajorAxis,semiMinorAxis:l.ellipsoid.semiMinorAxis},axis:u,xUnit:m[0],yUnit:m[1],zUnit:m[2],areaOfUse:l.areaOfUse,lossy:l.lossy};return{...S,signature:i&&typeof c=="string"&&!a.enforceAxis&&!l.lossy?c:$b(S),renderingBounds:y,renderingScale:M,getRenderingScale:E=>typeof M=="function"?M(E):M,converter:T}}function lE(e,t){return{from:hE(e.project.bind(e),e.projectTo.bind(e)),to:hE(e.unproject.bind(e),e.unprojectTo.bind(e)),normalize:t}}function QN(e,t){function r(n,i){i!==void 0&&Ea(n,i,n.length);let o=e.unproject(Array.from(n)),[s,a,c]=o;return t(o,o),o[0]===s&&o[1]===a&&o[2]===c?i===void 0?Array.from(n):kh(n,i,{x:n[0],y:n[1],z:n[2]??0},n.length):i===void 0?e.project(o):e.projectTo(o,i)}return r}function hE(e,t){function r(n,i){return i===void 0?e(Array.isArray(n)?n:Array.from(n)):t(n,i)}return r}function tO(e){function t(r,n){let i=n??new Array(r.length);Ea(r,i,r.length);let o=r[0],s=r[1],a=r[2]??0;if(r.length<2||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(a))throw new Error("Normalization requires finite longitude, latitude and altitude");let c={x:o,y:s,z:a};return e?.(c),kh(r,i,c,r.length)}return t}function eO(e,t,r){let n=t.kind==="geographic"?t.angularUnit:t.toMeter,i=[n,n,t.kind==="geocentric"?t.toMeter:t.verticalUnit],o=e.bounds,s=[...r].map(a=>{let c=/[ew]/.test(a)?0:/[ns]/.test(a)?1:2,l=o[0][c]/i[c],h=o[1][c]/i[c];return/[wsd]/.test(a)?[-h,-l]:[l,h]});return[[s[0][0],s[1][0],s[2][0]],[s[0][1],s[1][1],s[2][1]]]}function uE(e,t){let r=t?cE:JN,n=Object.keys(r).find(i=>r[i]===e)||"custom";return t?{name:n,degreesPerUnit:e/cE.degrees}:{name:n,metersPerUnit:e}}function dE(e){return{...e,projections:e.projections&&[...e.projections],parsers:e.parsers&&[...e.parsers],datumCatalogs:e.datumCatalogs&&[...e.datumCatalogs],aliases:e.aliases&&JSON.parse(JSON.stringify(e.aliases)),datumGrids:e.datumGrids&&{...e.datumGrids},verticalGrids:e.verticalGrids&&{...e.verticalGrids}}}function Hh(e){return!!(e.projections||e.parsers||e.datumCatalogs||e.aliases||e.datumGrids||e.verticalGrids||e.resolver)}Nc();async function pE(e){let t={...e,from:mE(e.from??"WGS84"),to:mE(e.to??"WGS84")},[r,n]=await Promise.all([om(t.from,t),om(t.to,t)]);return{...t,from:r,to:n}}async function om(e,t){let r=qh(e,t),n=j1(r.definition,t),i=typeof e=="string"||"type"in e?void 0:"crs"in e?e.crs:e,o=n===r.definition&&i?i.representation:tr(n);if(o!=="identifier"||t.parsers?.some(h=>h.canParse(n)))return e;let s=await t.resolver.resolve({state:"explicit",provenance:i?.provenance??"unknown",definition:n,representation:o}),a=qh(s.input,t).definition;if(!i)return a;let c=e,l={...i,definition:a,representation:tr(a),alternatives:[{definition:i.definition,representation:i.representation},...i.alternatives??[]]};return"crs"in c?{...c,crs:l}:l}function mE(e){return typeof e=="string"?e:JSON.parse(JSON.stringify(e))}var sm=class{constructor(t={}){this.options=dE(t),this.useDefinitionSignature=!Hh(t)}getCRS(t,r={}){return fE(this,t,this.options,r,this.useDefinitionSignature,this.options.resolver?om:void 0)}createProjection(t={}){return new jh({...this.options,...t})}async createProjectionAsync(t={}){let r={...this.options,...t};return jh.create(r.resolver?await pE(r):r)}};Dc();Ee();Ht();ne();Ie();var Z1={name:"merc",semantics:{id:"@math.gl/geospatial/merc",version:1},aliases:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","Mercator_Variant_A"],parameters:["lon_0","lat_ts","k","k_0","x_0","y_0"],create({semiMajorAxis:e,eccentricitySquared:t,parameters:r,primeMeridian:n=0}){let i=Math.sqrt(t),o=Object.prototype.hasOwnProperty.call(r,"over"),s=tt(r,"lon_0",0)*Me,a=tt(r,"x_0",0),c=tt(r,"y_0",0),l=tt(r,"k_0",tt(r,"k",1));if(Object.prototype.hasOwnProperty.call(r,"lat_ts")){let m=yh(r,"lat_ts");l=Math.cos(m)/Math.sqrt(1-t*Math.sin(m)**2)}if(l<=0)throw new Error("Mercator scale must be positive");let h=e*l,u=Math.atan(Math.sinh(Math.PI)),f=h*Math.PI,d=h*(Math.PI-i*Math.atanh(i*Math.sin(u)));return{longitudeOrigin:s,getRenderingProfile(m){if(m){let g=m[1]<=-90||m[3]>=90,y=[m[0],g?Math.max(-u*180/Math.PI,Math.min(u*180/Math.PI,m[1])):m[1],m[2],g?Math.max(-u*180/Math.PI,Math.min(u*180/Math.PI,m[3])):m[3]],_=M=>c+h*(Math.asinh(Math.tan(M))-i*Math.atanh(i*Math.sin(M)));return Ke(M=>re(At([a,a],Ct(gr(M,s,o),h)),[_(M[0][1]),_(M[1][1])]),y,s,n,o)}let p=[[a-f,c-d,0],[a+f,c+d,0]];return{bounds:p,normalize:Ke(()=>p,gn(K(s-Math.PI,-u,s+Math.PI,u),n),s,n,o).normalize}},...oi(m=>{let p=m.x,g=m.y;if(Math.abs(g)>=Math.PI/2)throw new Error("Mercator is undefined at the poles");let y=Math.asinh(Math.tan(g));m.x=a+h*ve(p-s,o),m.y=c+h*(i===0?y+0:y-i*Math.atanh(i*Math.sin(g)))},m=>{let p=m.x,y=(m.y-c)/h,_=Math.atan(Math.sinh(y));if(i===0){m.x=ve(s+(p-a)/h,o),m.y=_+0;return}for(let M=0;M<30;M++){let b=Math.atan(Math.sinh(y+i*Math.atanh(i*Math.sin(_))));if(Math.abs(b-_)<1e-13){m.x=ve(s+(p-a)/h,o),m.y=b;return}_=b}throw new Error("Mercator inverse did not converge")})}}};ma();Ee();Ht();ne();Ie();var J1={name:"eqc",semantics:{id:"@math.gl/geospatial/eqc",version:1},aliases:["Equirectangular","Equidistant_Cylindrical","Equidistant_Cylindrical_Spherical"],parameters:["lon_0","lat_0","lat_ts","x_0","y_0"],create({semiMajorAxis:e,parameters:t,primeMeridian:r=0}){let n=Object.prototype.hasOwnProperty.call(t,"over"),i=tt(t,"lon_0",0)*Me,o=yh(t,"lat_0"),s=Math.cos(yh(t,"lat_ts")),a=tt(t,"x_0",0),c=tt(t,"y_0",0),l=e*Math.abs(s)*Math.PI;return{longitudeOrigin:i,getRenderingProfile(h){if(h)return Ke(f=>re(At([a,a],Ct(gr(f,i,n),e*s)),[c+e*(f[0][1]-o),c+e*(f[1][1]-o)]),h,i,r,n);let u=[[a-l,c+e*(-Math.PI/2-o),0],[a+l,c+e*(Math.PI/2-o),0]];return{bounds:u,normalize:Ke(()=>u,gn(K(i-Math.PI,-(Math.PI/2),i+Math.PI,Math.PI/2),r),i,r,n).normalize}},...qn(h=>{h.x=a+e*s*ve(h.x-i,n),h.y=c+e*(h.y-o)},h=>{h.x=ve(i+(h.x-a)/(e*s),n),h.y=o+(h.y-c)/e})}}};Ie();Ht();ne();Dc();yn();Gc();Sh();ue();ad();Ae();function rO(e){if(e.k0||(e.k0=1),e.x0=e.x0||0,e.y0=e.y0||0,e.long0=e.long0||0,!(Math.abs(e.lat1+e.lat2)<1e-10)){var t=e.b/e.a;e.e=Math.sqrt(1-t*t);var r=Math.sin(e.lat1),n=Math.cos(e.lat1),i=nn(e.e,r,n),o=Lr(e.e,e.lat1,r),s=Math.sin(e.lat2),a=Math.cos(e.lat2),c=nn(e.e,s,a),l=Lr(e.e,e.lat2,s),h=Lr(e.e,e.lat0,Math.sin(e.lat0));Math.abs(e.lat1-e.lat2)>1e-10?e.ns=Math.log(i/c)/Math.log(o/l):e.ns=r,Number.isNaN(e.ns)&&(e.ns=r),e.f0=i/(e.ns*Math.pow(o,e.ns)),e.rh=Math.abs(Math.abs(e.lat0)-U)<1e-10?0:e.a*e.f0*Math.pow(h,e.ns)}}function gE(e,t){var r=t.x,n=t.y,i=Math.abs(Math.abs(n)-U),o,s;if(i>1e-10)o=e.sphere?1/Math.tan(Math.PI/4+n/2):Lr(e.e,n,Math.sin(n)),s=e.a*e.f0*Math.pow(o,e.ns);else{if(i=n*e.ns,i<=0)return null;s=0}var a=e.ns*G(r-e.long0,e.over);return t.x=e.k0*(s*Math.sin(a))+e.x0,t.y=e.k0*(e.rh-s*Math.cos(a))+e.y0,t}function yE(e,t){var r,n,i,o,s,a=(t.x-e.x0)/e.k0,c=e.rh-(t.y-e.y0)/e.k0;e.ns>0?(r=Math.sqrt(a*a+c*c),n=1):(r=-Math.sqrt(a*a+c*c),n=-1);var l=0;if(r!==0&&(l=Math.atan2(n*a,n*c)),r!==0||e.ns>0){if(n=1/e.ns,i=Math.pow(r/(e.a*e.f0),n),o=_a(e.e,i),o===-9999)return null}else o=-U;return s=G(l/e.ns+e.long0,e.over),t.x=s,t.y=o,t}function wE(e){let t={...e,ns:0,f0:0,rh:0};return rO(t),t}var Q1={name:"lcc",aliases:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"],parameters:[...ar,...so,"lat_1","lat_2"],create(e){let t=er(e);Lc(t,e.parameters);let r=wE(t),n=Xe("lcc",r,gE,yE),i={...oi(o=>{let s=o.y;if(Math.abs(s)===Math.PI/2&&s*r.ns<0)throw new Error("Lambert conformal conic is undefined at the opposite pole");n.forwardInPlace(o)},n.inverseInPlace)};return Pt(i,K(t.long0-Math.PI,r.ns>0?-Math.PI/3:-Math.PI/2,t.long0+Math.PI,r.ns>0?Math.PI/2:Math.PI/3),o=>Bc(i.forward,o,t.long0,r.ns,r.x0,r.y0+r.k0*r.rh,t.over),t.primeMeridian,t.over)}};Dc();Ie();Ht();ne();yn();Gc();function Fr(e,t){var r;return e>1e-7?(r=e*t,(1-e*e)*(t/(1-r*r)-.5/e*Math.log((1-r)/(1+r)))):2*t}ue();Ae();function am(e,t){var r=1-(1-e*e)/(2*e)*Math.log((1-e)/(1+e));let n=4*Number.EPSILON*r;if(Math.abs(t)>r+n)return NaN;if(Math.abs(Math.abs(t)-r)<=n)return t<0?-1*U:U;for(var i=Math.asin(.5*t),o,s,a,c,l=0;l<30;l++)if(s=Math.sin(i),a=Math.cos(i),c=e*s,o=Math.pow(1-c*c,2)/(2*a)*(t/(1-e*e)-s/(1-c*c)+.5/e*Math.log((1-c)/(1+c))),i+=o,Math.abs(o)<=1e-10)return i;return NaN}function nO(e){Math.abs(e.lat1+e.lat2)<1e-10||(e.temp=e.b/e.a,e.es=1-Math.pow(e.temp,2),e.e3=Math.sqrt(e.es),e.sin_po=Math.sin(e.lat1),e.cos_po=Math.cos(e.lat1),e.t1=e.sin_po,e.con=e.sin_po,e.ms1=nn(e.e3,e.sin_po,e.cos_po),e.qs1=Fr(e.e3,e.sin_po),e.sin_po=Math.sin(e.lat2),e.cos_po=Math.cos(e.lat2),e.t2=e.sin_po,e.ms2=nn(e.e3,e.sin_po,e.cos_po),e.qs2=Fr(e.e3,e.sin_po),e.sin_po=Math.sin(e.lat0),e.cos_po=Math.cos(e.lat0),e.t3=e.sin_po,e.qs0=Fr(e.e3,e.sin_po),Math.abs(e.lat1-e.lat2)>1e-10?e.ns0=(e.ms1*e.ms1-e.ms2*e.ms2)/(e.qs2-e.qs1):e.ns0=e.con,e.c=e.ms1*e.ms1+e.ns0*e.qs1,e.rh=e.a*Math.sqrt(e.c-e.ns0*e.qs0)/e.ns0)}function _E(e,t){var r=t.x,n=t.y;e.sin_phi=Math.sin(n),e.cos_phi=Math.cos(n);var i=Fr(e.e3,e.sin_phi),o=e.a*Math.sqrt(e.c-e.ns0*i)/e.ns0,s=e.ns0*G(r-e.long0,e.over),a=o*Math.sin(s)+e.x0,c=e.rh-o*Math.cos(s)+e.y0;return t.x=a,t.y=c,t}function ME(e,t){var r,n,i,o,s,a;if(t.x-=e.x0,t.y=e.rh-t.y+e.y0,e.ns0>=0?(r=Math.sqrt(t.x*t.x+t.y*t.y),i=1):(r=-Math.sqrt(t.x*t.x+t.y*t.y),i=-1),o=0,r!==0&&(o=Math.atan2(i*t.x,i*t.y)),i=r*e.ns0/e.a,e.sphere){let c=(e.c-i*i)/(2*e.ns0);if(Math.abs(c)>1+8*Number.EPSILON)return null;a=Math.asin(Math.max(-1,Math.min(1,c)))}else{n=(e.c-i*i)/e.ns0;let c=Fr(e.e3,1);a=Math.abs(Math.abs(n)-c)<=16*Number.EPSILON*c?Math.sign(n)*Math.PI/2:am(e.e3,n)}return s=G(o/e.ns0+e.long0,e.over),t.x=s,t.y=a,t}function bE(e){let t={...e,temp:0,e3:0,sin_po:0,cos_po:0,t1:0,con:0,ms1:0,qs1:0,t2:0,ms2:0,qs2:0,t3:0,qs0:0,ns0:0,c:0,rh:0,sin_phi:0,cos_phi:0};return nO(t),t}var ty={name:"aea",aliases:["Albers_Conic_Equal_Area","Albers_Equal_Area","Albers"],parameters:[...ar,"lat_1","lat_2"],create(e){let t=er(e);Lc(t,e.parameters);let r=bE(t),n={...Xe("aea",r,_E,ME,oi)};return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>Bc(n.forward,i,t.long0,r.ns0,r.x0,r.y0+r.rh,t.over),t.primeMeridian,t.over)}};Dc();Ie();Ht();ne();yn();Fc();ya();Uc();Gc();ue();Ae();bh();function ho(e){return Math.abs(e)<=U?e:e-Xo(e)*Math.PI}function iO(e){Math.abs(e.lat1+e.lat2)<1e-10||(e.temp=e.b/e.a,e.es=1-Math.pow(e.temp,2),e.e=Math.sqrt(e.es),e.en=Ri(e.es),e.sin_phi=Math.sin(e.lat1),e.cos_phi=Math.cos(e.lat1),e.ms1=nn(e.e,e.sin_phi,e.cos_phi),e.ml1=rr(e.lat1,Math.sin(e.lat1),Math.cos(e.lat1),e.en),Math.abs(e.lat1-e.lat2)<1e-10?e.ns=e.sin_phi:(e.sin_phi=Math.sin(e.lat2),e.cos_phi=Math.cos(e.lat2),e.ms2=nn(e.e,e.sin_phi,e.cos_phi),e.ml2=rr(e.lat2,Math.sin(e.lat2),Math.cos(e.lat2),e.en),e.ns=(e.ms1-e.ms2)/(e.ml2-e.ml1)),e.g=e.ml1+e.ms1/e.ns,e.ml0=rr(e.lat0,Math.sin(e.lat0),Math.cos(e.lat0),e.en),e.rh=e.a*(e.g-e.ml0))}function xE(e,t){var r=t.x,n=t.y,i;if(e.sphere)i=e.a*(e.g-n);else{var o=rr(n,Math.sin(n),Math.cos(n),e.en);i=e.a*(e.g-o)}var s=e.ns*G(r-e.long0,e.over),a=e.x0+i*Math.sin(s),c=e.y0+e.rh-i*Math.cos(s);return t.x=a,t.y=c,t}function SE(e,t){t.x-=e.x0,t.y=e.rh-t.y+e.y0;var r,n,i,o;e.ns>=0?(n=Math.sqrt(t.x*t.x+t.y*t.y),r=1):(n=-Math.sqrt(t.x*t.x+t.y*t.y),r=-1);var s=0;if(n!==0&&(s=Math.atan2(r*t.x,r*t.y)),e.sphere)return o=G(e.long0+s/e.ns,e.over),i=ho(e.g-n/e.a),t.x=o,t.y=i,t;var a=e.g-n/e.a;return i=Ci(a,e.es,e.en),o=G(e.long0+s/e.ns,e.over),t.x=o,t.y=i,t}function vE(e){let t={...e,temp:0,en:[],sin_phi:0,cos_phi:0,ms1:0,ml1:0,ns:0,ms2:0,ml2:0,g:0,ml0:0,rh:0};return iO(t),t}var ey={name:"eqdc",aliases:["Equidistant_Conic"],parameters:[...ar,"lat_1","lat_2"],create(e){let t=er(e);Lc(t,e.parameters);let r=vE(t),n=Xe("eqdc",r,xE,SE,oi);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>Bc(n.forward,i,t.long0,r.ns,r.x0,r.y0+r.rh,t.over),t.primeMeridian,t.over)}};function os(e,t){let r=Math.abs(Math.sin(t)),n=Math.cos(t),i=n*n/(1+r);if(e===0)return 2*i;let o=e*e;return i*(1+o*r)/(1-o*r*r)+(1-o)/e*Math.atanh(e*i/(1-o*r))}function ry(e,t,r){if(r===0||e===0)return r;let n=os(e,r)/t;return Math.atan2(Math.sign(r)*(1-n),Math.sqrt(n*(2-n)))}function ny(e,t,r){if(e===0||r===0||Math.abs(r)===Math.PI/2)return r;let n=Math.abs(Math.sin(r)),i=Math.cos(r),o=t*i*i/(1+n),s=Math.abs(r),a=e*e,c=0,l=Math.PI/2;for(let h=0;h<48;h++){let u=Math.sin(s),f=1-a*u*u,d=2*(1-a)*Math.cos(s)/(f*f),m=os(e,s)-o,p=m/d;if(Math.abs(p)<2e-15)return Math.sign(r)*s;m>0?c=s:l=s;let g=s+p;s=g>c&&g<l?g:(c+l)/2}throw new Error("Authalic latitude inverse did not converge")}Qo();ts();yn();Ae();ue();xh();var ci=1,Di=2,Wn=3,Ur=4;function oO(e){var t=Math.abs(e.lat0);if(Math.abs(t-U)<1e-10?e.mode=e.lat0<0?ci:Di:Math.abs(t)<1e-10?e.mode=Wn:e.mode=Ur,e.es>0){var r;switch(e.qp=Fr(e.e,1),e.mmf=.5/(1-e.es),e.mode){case Di:e.dd=1;break;case ci:e.dd=1;break;case Wn:e.rq=Math.sqrt(.5*e.qp),e.dd=1/e.rq,e.xmf=1,e.ymf=.5*e.qp;break;case Ur:e.rq=Math.sqrt(.5*e.qp),r=Math.sin(e.lat0),e.sinb1=Fr(e.e,r)/e.qp,e.cosb1=Math.sqrt(1-e.sinb1*e.sinb1),e.dd=Math.cos(e.lat0)/(Math.sqrt(1-e.es*r*r)*e.rq*e.cosb1),e.xmf=e.rq,e.ymf=e.xmf/e.dd,e.xmf*=e.dd;break}}else e.mode===Ur&&(e.sinph0=Math.sin(e.lat0),e.cosph0=Math.cos(e.lat0))}function EE(e,t){var r,n,i,o,s,a,c,l,h,u,f=t.x,d=t.y;if(f=G(f-e.long0,e.over),e.sphere){if(s=Math.sin(d),u=Math.cos(d),i=Math.cos(f),e.mode===Ur||e.mode===Wn){if(n=e.mode===Wn?1+u*i:1+e.sinph0*s+e.cosph0*u*i,n<=1e-10)return null;n=Math.sqrt(2/n),r=n*u*Math.sin(f),n*=e.mode===Wn?s:e.cosph0*s-e.sinph0*u*i}else if(e.mode===Di||e.mode===ci){if(e.mode===Di&&(i=-i),Math.abs(d+e.lat0)<1e-10)return null;n=$t-d*.5,n=2*(e.mode===ci?Math.cos(n):Math.sin(n)),r=n*Math.sin(f),n*=i}}else{if(c=0,l=0,h=0,i=Math.cos(f),o=Math.sin(f),s=Math.sin(d),a=Fr(e.e,s),e.mode===Ur||e.mode===Wn){c=a/e.qp;let m=os(e.e,d)/e.qp;l=Math.sqrt(m*(2-m))}switch(e.mode){case Ur:h=1+e.sinb1*c+e.cosb1*l*i;break;case Wn:h=1+l*i;break;case Di:h=U+d,a=d>=0?os(e.e,d):2*e.qp-os(e.e,d);break;case ci:h=d-U,a=d<=0?os(e.e,d):2*e.qp-os(e.e,d);break}if(Math.abs(h)<1e-10)return null;switch(e.mode){case Ur:case Wn:h=Math.sqrt(2/h),e.mode===Ur?n=e.ymf*h*(e.cosb1*c-e.sinb1*l*i):(h=Math.sqrt(2/(1+l*i)),n=h*c*e.ymf),r=e.xmf*h*l*o;break;case Di:case ci:a>=0?(h=Math.sqrt(a),r=h*o,n=i*(e.mode===ci?h:-h)):r=n=0;break}}return t.x=e.a*r+e.x0,t.y=e.a*n+e.y0,t}function TE(e,t){t.x-=e.x0,t.y-=e.y0;var r=t.x/e.a,n=t.y/e.a,i,o,s,a,c,l,h;if(e.sphere){var u=0,f,d=0;if(f=Math.sqrt(r*r+n*n),o=f*.5,o>1+8*Number.EPSILON)return null;switch(o=2*Math.asin(Math.min(1,o)),(e.mode===Ur||e.mode===Wn)&&(d=Math.sin(o),u=Math.cos(o)),e.mode){case Wn:o=Math.abs(f)<=1e-10?0:si(0,1,d,u,r,n,f),r*=d,n=u*f;break;case Ur:o=Math.abs(f)<=1e-10?e.lat0:si(e.sinph0,e.cosph0,d,u,r,n,f),r*=d*e.cosph0,n=(u-Math.sin(o)*e.sinph0)*f;break;case Di:n=-n,o=U-o;break;case ci:o-=U;break}i=n===0&&(e.mode===Wn||e.mode===Ur)?0:Math.atan2(r,n)}else{if(h=0,e.mode===Ur||e.mode===Wn){if(r/=e.dd,n*=e.dd,l=Math.sqrt(r*r+n*n),l<1e-10)return t.x=e.long0,t.y=e.lat0,t;let m=.5*l/e.rq;if(m>1+8*Number.EPSILON)return null;a=2*Math.asin(Math.min(1,m)),s=Math.cos(a),a=Math.sin(a);let p=si(e.mode===Ur?e.sinb1:0,e.mode===Ur?e.cosb1:1,a,s,r,n,l);o=ny(e.e,e.qp,p),r*=a,e.mode===Ur?(h=s*e.sinb1+n*a*e.cosb1/l,c=e.qp*h,n=l*e.cosb1*s-n*e.sinb1*a):(h=n*a/l,c=e.qp*h,n=l*s)}else if(e.mode===Di||e.mode===ci){if(e.mode===Di&&(n=-n),c=r*r+n*n,!c)return t.x=e.long0,t.y=e.lat0,t;h=1-c/e.qp,e.mode===ci&&(h=-h)}if(i=Math.atan2(r,n),Math.abs(h)>1+8*Number.EPSILON)return null;if(e.mode===Di||e.mode===ci){let m=Math.max(0,Math.min(2,c/e.qp)),p=Math.atan2(h,Math.sqrt(m*(2-m)));o=ny(e.e,e.qp,p)}}return t.x=G(e.long0+i,e.over),t.y=o,t}function IE(e){let t={...e,mode:0,qp:0,mmf:0,dd:0,rq:0,xmf:0,ymf:0,sinb1:0,cosb1:0,sinph0:0,cosph0:0};return oO(t),t}var iy={name:"laea",aliases:["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area"],parameters:ar,create(e){let t=er(e),r=IE(t);return rn(Yo(t,Xe("laea",r,EE,TE)),t,Math.PI*179/180,(n,i)=>vx(t,t.sphere?1:r.xmf||Math.sqrt(r.qp/2),t.sphere?1:r.ymf||Math.sqrt(r.qp/2),n,i,t.sphere?t.lat0:ry(t.e,r.qp,t.lat0),t.sphere?o=>o:o=>ry(t.e,r.qp,o)))}};Nx();Qo();ts();yn();xh();function cm(e,t){return Math.pow((1-e)/(1+e),t)}Ae();var sO=20;function aO(e){var t=Math.sin(e.lat0),r=Math.cos(e.lat0);r*=r,e.rc=Math.sqrt(1-e.es)/(1-e.es*t*t),e.C=Math.sqrt(1+e.es*r*r/(1-e.es)),e.phic0=Math.asin(t/e.C),e.ratexp=.5*e.C*e.e,e.K=Math.tan(.5*e.phic0+$t)/(Math.pow(Math.tan(.5*e.lat0+$t),e.C)*cm(e.e*t,e.ratexp))}function AE(e,t){var r=t.x,n=t.y;return t.y=2*Math.atan(e.K*Math.pow(Math.tan(.5*n+$t),e.C)*cm(e.e*Math.sin(n),e.ratexp))-U,t.x=e.C*r,t}function PE(e,t){for(var r=1e-14,n=t.x/e.C,i=t.y,o=Math.pow(Math.tan(.5*i+$t)/e.K,1/e.C),s=sO;s>0&&(i=2*Math.atan(o*cm(e.e*Math.sin(t.y),-.5*e.e))-U,!(Math.abs(i-t.y)<r));--s)t.y=i;return s?(t.x=n,t.y=i,t):null}function RE(e){let t={...e,rc:0,C:0,phic0:0,ratexp:0,K:0};return aO(t),t}ue();ga();function cO(e){e.rc&&(e.sinc0=Math.sin(e.phic0),e.cosc0=Math.cos(e.phic0),e.R2=2*e.rc)}function CE(e,t){var r,n,i,o;return t.x=G(t.x-e.long0,e.over),AE(e,t),r=Math.sin(t.y),n=Math.cos(t.y),i=Math.cos(t.x),o=e.k0*e.R2/(1+e.sinc0*r+e.cosc0*n*i),t.x=o*n*Math.sin(t.x),t.y=o*(e.cosc0*r-e.sinc0*n*i),t.x=e.a*t.x+e.x0,t.y=e.a*t.y+e.y0,t}function NE(e,t){var r,n,i,o,s;if(t.x=(t.x-e.x0)/e.a,t.y=(t.y-e.y0)/e.a,t.x/=e.k0,t.y/=e.k0,s=qe(t.x,t.y),s){var a=2*Math.atan2(s,e.R2);r=Math.sin(a),n=Math.cos(a),o=si(e.sinc0,e.cosc0,r,n,t.x,t.y,s),i=Math.atan2(t.x*r,s*e.cosc0*n-t.y*e.sinc0*r)}else o=e.phic0,i=0;if(t.x=i,t.y=o,!PE(e,t))throw new Error("Oblique stereographic inverse did not converge");return t.x=G(t.x+e.long0,e.over),t}function OE(e){let t={...RE(e),sinc0:0,cosc0:0,R2:0};return cO(t),t}var oy={name:"sterea",aliases:["Stereographic_North_Pole","Oblique_Stereographic","Oblique Stereographic Alternative","Double_Stereographic"],parameters:[...ar,...so],create(e){let t=er(e);if(Math.abs(t.lat0)===Math.PI/2)throw new Error("sterea requires a non-polar origin; use stere at the poles");let r=OE(t);return rn(Yo(t,Xe("sterea",r,CE,NE)),t,Math.PI*150/180,(n,i)=>sd(t,o=>2*Math.atan(r.K*Math.pow(Math.tan(Math.PI/4+o/2),r.C)*Math.pow((1-t.e*Math.sin(o))/(1+t.e*Math.sin(o)),r.ratexp))-Math.PI/2,r.phic0,t.a*t.k0*r.R2,n,i,r.C,Math.abs(Math.log(r.C))+Math.abs(Math.log(r.K))+r.C*t.e*Math.atanh(t.e)))}};Qo();ts();yn();xh();ue();Ae();function sy(e,t){let r=1-e*Math.sin(t)**2;return(1-e)/(r*Math.sqrt(r))}function lm(e,t,r,n){return sy(e,t-r*n)+sy(e,t+r*n)}function Sn(e,t,r,n){let i=(n-r)/8,o=0;for(let s=0;s<4;s++){let a=r+(2*s+1)*i;o+=i*(.362683783378362*lm(t,a,i,.1834346424956498)+.3137066458778873*lm(t,a,i,.525532409916329)+.2223810344533745*lm(t,a,i,.7966664774136267)+.1012285362903763*lm(t,a,i,.9602898564975363))}return e*o}function ay(e,t,r){let n=Math.PI/2,i=Sn(e,t,0,n);if(!Number.isFinite(r)||Math.abs(r)>i)return NaN;let o=-n,s=n,a=r/i*n;for(let c=0;c<48;c++){let l=Sn(e,t,0,a)-r;if(Math.abs(l)<=8*Number.EPSILON*e)return a;l>0?s=a:o=a;let h=a-l/(e*sy(t,a));a=h>o&&h<s?h:(o+s)/2}return NaN}function BE(e,t,r,n,i,o,s){let a=n-t,c=Math.atan((1-o)*Math.tan(e)),l=Math.atan((1-o)*Math.tan(r)),h=Math.sin(c),u=Math.cos(c),f=Math.sin(l),d=Math.cos(l),m=a,p,g=100,y,_,M,b,v,T,S,E,N,B,C,R,W,j;do{if(y=Math.sin(m),_=Math.cos(m),M=Math.sqrt(d*y*(d*y)+(u*f-h*d*_)*(u*f-h*d*_)),M===0){s.x=0,s.y=0;return}b=h*f+u*d*_,v=Math.atan2(M,b),T=u*d*y/M,S=1-T*T,E=S!==0?b-2*h*f/S:0,N=o/16*S*(4+o*(4-3*S)),p=m,m=a+(1-N)*o*T*(v+N*M*(E+N*b*(-1+2*E*E)))}while(Math.abs(m-p)>1e-12&&--g>0);if(g===0){s.x=NaN,s.y=NaN;return}B=S*(i*i-i*(1-o)*(i*(1-o)))/(i*(1-o)*(i*(1-o))),C=1+B/16384*(4096+B*(-768+B*(320-175*B))),R=B/1024*(256+B*(-128+B*(74-47*B))),W=R*M*(E+R/4*(b*(-1+2*E*E)-R/6*E*(-3+4*M*M)*(-3+4*E*E))),j=i*(1-o)*C*(v-W);let A=Math.atan2(d*y,u*f-h*d*_);s.x=A,s.y=j}function LE(e,t,r,n,i,o,s){let a=Math.atan((1-o)*Math.tan(e)),c=Math.sin(a),l=Math.cos(a),h=Math.sin(r),u=Math.cos(r),f=Math.atan2(c,l*u),d=l*h,m=1-d*d,p=m*(i*i-i*(1-o)*(i*(1-o)))/(i*(1-o)*(i*(1-o))),g=1+p/16384*(4096+p*(-768+p*(320-175*p))),y=p/1024*(256+p*(-128+p*(74-47*p))),_=n/(i*(1-o)*g),M,b=100,v,T,S,E;do v=Math.cos(2*f+_),T=Math.sin(_),S=Math.cos(_),E=y*T*(v+y/4*(S*(-1+2*v*v)-y/6*v*(-3+4*T*T)*(-3+4*v*v))),M=_,_=n/(i*(1-o)*g)+E;while(Math.abs(_-M)>1e-12&&--b>0);if(b===0){s.x=NaN,s.y=NaN;return}let N=c*T-l*S*u,B=Math.atan2(c*S+l*T*u,(1-o)*Math.sqrt(d*d+N*N)),C=Math.atan2(T*h,l*S-c*T*u),R=o/16*m*(4+o*(4-3*m)),W=C-(1-R)*o*d*(_+R*T*(v+R*S*(-1+2*v*v))),j=t+W;s.x=j,s.y=B}function lO(e){e.sin_p12=Math.sin(e.lat0),e.cos_p12=Math.cos(e.lat0),e.x0=e.x0||0,e.y0=e.y0||0,e.long0=e.long0||0,e.f=e.es/(1+Math.sqrt(1-e.es))}function DE(e,t){var r=t.x,n=t.y,i=Math.sin(t.y),o=Math.cos(t.y),s=G(r-e.long0,e.over),a,c,l,h,u;if(e.sphere)return Math.abs(e.sin_p12-1)<=1e-10?(t.x=e.x0+e.a*(U-n)*Math.sin(s),t.y=e.y0-e.a*(U-n)*Math.cos(s),t):Math.abs(e.sin_p12+1)<=1e-10?(t.x=e.x0+e.a*(U+n)*Math.sin(s),t.y=e.y0+e.a*(U+n)*Math.cos(s),t):(h=e.sin_p12*i+e.cos_p12*o*Math.cos(s),c=Math.acos(h),l=c?c/Math.sin(c):1,t.x=e.x0+e.a*l*o*Math.sin(s),t.y=e.y0+e.a*l*(e.cos_p12*i-e.sin_p12*o*Math.cos(s)),t);if(Math.abs(e.sin_p12-1)<=1e-10)return a=Sn(e.a,e.es,n,U),t.x=e.x0+a*Math.sin(s),t.y=e.y0-a*Math.cos(s),t;if(Math.abs(e.sin_p12+1)<=1e-10)return a=Sn(e.a,e.es,-U,n),t.x=e.x0+a*Math.sin(s),t.y=e.y0+a*Math.cos(s),t;{if(Math.abs(s)<1e-10&&Math.abs(n-e.lat0)<1e-10)return t.x=e.x0,t.y=e.y0,t;BE(e.lat0,e.long0,n,r,e.a,e.f,t),u=t.x;let f=t.y;return t.x=e.x0+f*Math.sin(u),t.y=e.y0+f*Math.cos(u),t}}function FE(e,t){t.x-=e.x0,t.y-=e.y0;var r,n,i,o,s,a,c,l,h,u,f;if(e.sphere){if(r=Math.sqrt(t.x*t.x+t.y*t.y),r>2*U*e.a)return null;if(n=r/e.a,i=Math.sin(n),o=Math.cos(n),s=e.long0,Math.abs(r)<=1e-10)a=e.lat0;else if(a=si(e.sin_p12,e.cos_p12,i,o,t.x,t.y,r),c=Math.abs(e.lat0)-U,Math.abs(c)<=1e-10)if(e.lat0>=0){if(!Number.isFinite(a))return null;s=G(e.long0+Math.atan2(t.x,-t.y),e.over)}else s=G(e.long0-Math.atan2(-t.x,t.y),e.over);else s=G(e.long0+Math.atan2(t.x*i,r*e.cos_p12*o-t.y*e.sin_p12*i),e.over);return t.x=s,t.y=a,t}else return Math.abs(e.sin_p12-1)<=1e-10?(l=Sn(e.a,e.es,0,U),r=Math.sqrt(t.x*t.x+t.y*t.y),h=l-r,a=ay(e.a,e.es,h),Number.isFinite(a)?(s=G(e.long0+Math.atan2(t.x,-1*t.y),e.over),t.x=s,t.y=a,t):null):Math.abs(e.sin_p12+1)<=1e-10?(l=Sn(e.a,e.es,0,U),r=Math.sqrt(t.x*t.x+t.y*t.y),h=r-l,a=ay(e.a,e.es,h),Number.isFinite(a)?(s=G(e.long0+Math.atan2(t.x,t.y),e.over),t.x=s,t.y=a,t):null):(u=Math.atan2(t.x,t.y),f=Math.sqrt(t.x*t.x+t.y*t.y),LE(e.lat0,e.long0,u,f,e.a,e.f,t),t)}function UE(e){let t={...e,sin_p12:0,cos_p12:0,f:0};return lO(t),t}var cy={name:"aeqd",aliases:["Azimuthal_Equidistant"],parameters:ar,create(e){let t=er(e),r=UE(t);return rn(Yo(t,Xe("aeqd",r,DE,FE)),t,Math.PI*179/180,(n,i)=>Sx(t,n,i))}};jg();bx();var ly={name:"geocent",aliases:["Geocentric","geocentric","Geocent"],parameters:[],create({semiMajorAxis:e,semiMinorAxis:t,eccentricitySquared:r,primeMeridian:n=0}){let i={semiMajorAxis:e,eccentricitySquared:r,semiMinorAxis:t??e*Math.sqrt(1-r)};return{getRenderingProfile:()=>({bounds:[[-e,-e,-i.semiMinorAxis],[e,e,i.semiMinorAxis]],normalize:is({},n)().normalize}),forward(){throw new Error("Geocentric projection requires the 3D pipeline")},inverse(){throw new Error("Geocentric projection requires the 3D pipeline")},forwardInPlace:o=>tm(o,i),inverseInPlace:o=>em(o,i),forward3D:o=>Zv(o,i),inverse3D:o=>Jv(o,i)}}};Ht();wa();Ie();Sh();Ae();function GE(e,t,r){let n=qo(gr(r,e.long0,e.over)),i=e.a/Math.sqrt(1-e.es),o=kn(t(e.long0,r[0][1])[1],t(e.long0,r[1][1])[1]),s=Math.max(Math.abs(e.a*(e.es?e.am1:e.cphi1)+e.y0-o[0]),Math.abs(e.a*(e.es?e.am1:e.cphi1)+e.y0-o[1])),a=Math.min(s,i*n),c=Math.min(2*s,i*n);return re([e.x0-a,e.x0+a],[o[0]-c,o[1]+c])}function zE(e,t,r){let n=qo(gr(r,e.long0,e.over)),i=e.a/Math.sqrt(1-e.es),o=i*n*n/4,s=kn(t(e.long0,r[0][1])[1],t(e.long0,r[1][1])[1]);return e.sphere&&(r[0][1]-e.lat0<-Math.PI/2||r[1][1]-e.lat0>Math.PI/2)&&(s=[e.y0-e.a*Math.PI/2,e.y0+e.a*Math.PI/2]),re([e.x0-i*n,e.x0+i*n],[s[0]-o,s[1]+o])}function VE(e,t,r){let n=qo(gr(r,e.long0,e.over));if(e.sphere&&n>Math.PI/2)throw new Error("Unsupported Cassini rendering coverage");let i=e.a/Math.sqrt(1-e.es),o=e.es/(1-e.es),s=e.sphere?e.a*Math.asin(Math.min(1,Math.sin(Math.min(n,Math.PI/2)))):i*(n+n**3/6+(9+8*o)*n**5/120),a=e.sphere?e.a*n:i*(n*n/4+(6+6*o)*n**4/24),c=kn(t(e.long0,r[0][1])[1],t(e.long0,r[1][1])[1]);return re([e.x0-s,e.x0+s],[c[0]-a,c[1]+a])}function hy(e,t){return t[0]<=0&&t[1]>=0?[-1/0,1/0]:Te(e,kn(1/t[0],1/t[1]))}function kE(e,t){let r=l=>{let h=e.alpha*(Math.asinh(Math.tan(l))-e.e*Math.atanh(e.e*Math.sin(l)))+e.K;return Math.asin(Math.tanh(h))},n=K((t[0][0]-e.long0)*e.alpha,r(t[0][1]),(t[1][0]-e.long0)*e.alpha,r(t[1][1])),i=se([-Math.sin(e.b0),0,Math.cos(e.b0)],n);if(qo(i)>=1-1e-14)throw new Error("Swiss oblique Mercator coverage reaches a rotated pole");let o=se([0,1,0],n),s=se([Math.cos(e.b0),0,Math.sin(e.b0)],n),a=hy(o,s).map(Math.atan),c=i.map(l=>Math.atanh(Math.max(-1+Number.EPSILON,Math.min(1-Number.EPSILON,l))));return re(At([e.x0,e.x0],Ct(a,e.R)),At([e.y0,e.y0],Ct(c,e.R)))}function qE(e,t){let r=m=>Math.log(e.E)-e.B*Math.log(Lr(e.e,m,Math.sin(m))),n=kn(r(t[0][1]),r(t[1][1])),i=Ct([t[0][0]-e.lam0,t[1][0]-e.lam0],e.B),o=K(i[0],Math.asin(Math.tanh(n[0])),i[1],Math.asin(Math.tanh(n[1]))),s=se([0,-e.cosgam,e.singam],o),a=Ct(kn(-Math.atanh(s[0]),-Math.atanh(s[1])),e.ArB),c=At(Ct([Math.sinh(n[0]),Math.sinh(n[1])],e.cosgam),Ct(wh(i),e.singam)),l=Xf(i),h=l[0]>0?hy(c,l).map(Math.atan):[-Math.PI,Math.PI],u=Ct(h,e.ArB),f,d;return e.no_rot?(f=u,d=a):(u=At(u,[-e.u_0,-e.u_0]),f=At(Ct(a,e.cosrot),Ct(u,e.sinrot)),d=At(Ct(u,e.cosrot),Ct(a,-e.sinrot))),re(At([e.x0,e.x0],Ct(f,e.a)),At([e.y0,e.y0],Ct(d,e.a)))}function jE(e,t){let r=d=>2*(Math.atan(e.k*Math.pow(Math.tan(d/2+e.s45),e.alfa)/Math.pow((1+e.e*Math.sin(d))/(1-e.e*Math.sin(d)),e.alfa*e.e/2))-e.s45),n=Ct(gr(t,e.long0,e.over),-e.alfa),i=K(n[0],r(t[0][1]),n[1],r(t[1][1])),o=se([Math.sin(e.ad),0,Math.cos(e.ad)],i),s=[Math.sqrt(Math.max(Number.EPSILON,1-qo(o)**2)),1],a=se([0,1,0],i),c=hy(a,s),l=Ct(c.map(d=>Math.asin(Math.max(-1,Math.min(1,d)))),e.n),h=d=>e.ro0*Math.pow(Math.tan(e.s0/2+e.s45)/Math.tan(Math.asin(d)/2+e.s45),e.n),u=kn(h(o[0]),h(o[1])),f=e.czech?1:-1;return re(At([e.x0,e.x0],Ct(Te(u,wh(l)),f)),At([e.y0,e.y0],Ct(Te(u,Xf(l)),f)))}function WE(e,t){let r=Ct([t[0][1]-e.lat0,t[1][1]-e.lat0],1e-5/Mh),n=gr(t,e.long0,e.over),i=[0,0];for(let l=10;l>=1;l--)i=At([e.A[l],e.A[l]],Te(i,r));i=Te(i,r);let o=[0,0],s=[0,0];for(let l=6;l>=1;l--){let h=At(Te(o,i),Ct(Te(s,n),-1)),u=At(Te(o,n),Te(s,i));o=At(h,[e.B_re[l],e.B_re[l]]),s=At(u,[e.B_im[l],e.B_im[l]])}let a=At(Te(o,i),Ct(Te(s,n),-1)),c=At(Te(o,n),Te(s,i));return re(At([e.x0,e.x0],Ct(c,e.a)),At([e.y0,e.y0],Ct(a,e.a)))}Ht();ne();ma();yn();Ee();function vt(e){let t=er(e);return{...t,x0:0,y0:0,lat_ts:Number.isNaN(t.lat_ts)?0:t.lat_ts}}function Pe(e,t){return{...e,x0:tt(t.parameters,"x_0",0),y0:tt(t.parameters,"y_0",0)}}function Et(e,t,r,n,i,o){let s=Xe(e,r,n,i),a=tt(t.parameters,"x_0",0),c=tt(t.parameters,"y_0",0);return qn(l=>{o?.(l.x,l.y),s.forwardInPlace(l),l.x+=a,l.y+=c},l=>{l.x-=a,l.y-=c,s.inverseInPlace(l)})}function ss(e,t=0,r=!1){return(n,i)=>{let o=Math.sin(e.lat0)*Math.sin(i)+Math.cos(e.lat0)*Math.cos(i)*Math.cos(n-e.long0);if(r?o<t-1e-14:o<=t+1e-14)throw new Error("Coordinate is outside the visible projection horizon")}}ue();ga();Fc();Uc();ya();Ae();var $h=1e-10;function hO(e){var t;if(e.phi1=e.lat1,Math.abs(e.phi1)<$h)throw new Error;e.es?(e.en=Ri(e.es),e.am1=Math.sin(e.phi1),t=Math.cos(e.phi1),e.m1=rr(e.phi1,e.am1,t,e.en),e.am1=t/(Math.sqrt(1-e.es*e.am1*e.am1)*e.am1)):Math.abs(e.phi1)+$h>=U?e.cphi1=0:e.cphi1=1/Math.tan(e.phi1)}function uO(e,t){var r=G(t.x-(e.long0||0),e.over),n=t.y,i,o,s;return o=Math.sin(n),s=Math.cos(n),i=e.am1+e.m1-rr(n,o,s,e.en),o=s*r/(i*Math.sqrt(1-e.es*o*o)),t.x=i*Math.sin(o),t.y=e.am1-i*Math.cos(o),t.x=e.a*t.x+(e.x0||0),t.y=e.a*t.y+(e.y0||0),t}function fO(e,t){t.x=(t.x-(e.x0||0))/e.a,t.y=(t.y-(e.y0||0))/e.a;var r,n,i,o;if(t.y=e.am1-t.y,n=qe(t.x,t.y),e.phi1<0&&(n=-n),o=Ci(e.am1+e.m1-n,e.es,e.en),r=Math.abs(o),r<U)r=Math.sin(o),i=n*Math.atan2(Math.sign(e.phi1)*t.x,Math.sign(e.phi1)*t.y)*Math.sqrt(1-e.es*r*r)/Math.cos(o);else if(Math.abs(r-U)<=$h)i=0;else throw new Error;return t.x=G(i+(e.long0||0),e.over),t.y=ho(o),t}function dO(e,t){var r=G(t.x-(e.long0||0),e.over),n=t.y,i,o;return o=e.cphi1+e.phi1-n,Math.abs(o)>$h?(i=r*Math.cos(n)/o,t.x=o*Math.sin(i),t.y=e.cphi1-o*Math.cos(i)):t.x=t.y=0,t.x=e.a*t.x+(e.x0||0),t.y=e.a*t.y+(e.y0||0),t}function mO(e,t){t.x=(t.x-(e.x0||0))/e.a,t.y=(t.y-(e.y0||0))/e.a;var r,n;t.y=e.cphi1-t.y;var i=qe(t.x,t.y);if(e.phi1<0&&(i=-i),n=e.cphi1+e.phi1-i,Math.abs(n)>U)throw new Error;return Math.abs(Math.abs(n)-U)<=$h?r=0:r=i*Math.atan2(Math.sign(e.phi1)*t.x,Math.sign(e.phi1)*t.y)/Math.cos(n),t.x=G(r+(e.long0||0),e.over),t.y=ho(n),t}function HE(e,t){return e.es?uO(e,t):dO(e,t)}function $E(e,t){return e.es?fO(e,t):mO(e,t)}function YE(e,t={}){let r={...e,phi1:0,en:[],m1:0,am1:0,cphi1:0,...t};return hO(r),r}var uy={name:"bonne",aliases:["Bonne (Werner lat_1=90)"],parameters:["lon_0","x_0","y_0","lat_1"],create(e){let t=vt(e);if(!Object.prototype.hasOwnProperty.call(e.parameters,"lat_1")||Math.abs(t.lat1)<1e-10)throw new Error("Bonne requires a nonzero lat_1");let r=YE(t),n=Et("bonne",e,r,HE,$E);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>GE(Pe(r,e),n.forward,i),t.primeMeridian,t.over)}};Ht();ne();Fc();ya();Uc();function Qc(e,t,r){var n=t*r;return e/Math.sqrt(1-n*n)}ue();Ae();function pO(e){e.sphere||(e.en=Ri(e.es),e.ml0=e.a*rr(e.lat0,Math.sin(e.lat0),Math.cos(e.lat0),e.en))}function dy(e,t){var r,n,i=t.x,o=t.y;if(i=G(i-e.long0,e.over),e.sphere)r=e.a*Math.asin(Math.cos(o)*Math.sin(i)),n=e.a*(Math.atan2(Math.tan(o),Math.cos(i))-e.lat0);else{var s=Math.sin(o),a=Math.cos(o),c=Qc(e.a,e.e,s),l=Math.tan(o)*Math.tan(o),h=i*Math.cos(o),u=h*h,f=e.es*a*a/(1-e.es),d=e.a*rr(o,s,a,e.en);r=c*h*(1-u*l*(1/6+(8-l+8*f)*u/120)),n=d-e.ml0+c*s/a*u*(.5+(5-l+6*f)*u/24)}return t.x=r+e.x0,t.y=n+e.y0,t}function KE(e,t){t.x-=e.x0,t.y-=e.y0;var r=t.x/e.a,n=t.y/e.a,i,o;if(e.sphere){var s=n+e.lat0;i=Math.asin(Math.sin(s)*Math.cos(r)),o=Math.atan2(Math.tan(r),Math.cos(s))}else{var a=e.ml0/e.a+n,c=Ci(a,e.es,e.en);if(Math.abs(Math.abs(c)-U)<=1e-10)return t.x=e.long0,t.y=Math.sign(c)*U,t;var l=Qc(e.a,e.e,Math.sin(c)),h=l*l*l/e.a/e.a*(1-e.es),u=Math.pow(Math.tan(c),2),f=r*e.a/l,d=f*f;i=c-l*Math.tan(c)/h*f*f*(.5-(1+3*u)*f*f/24),o=f*(1-d*(u/3-(1+3*u)*u*d/15))/Math.cos(c)}if(!e.sphere){let m=t.x+e.x0,p=t.y+e.y0,g=e.scratch,y=!1;for(let _=0;_<12;_++){fy(e,o,i);let M=g.x-m,b=g.y-p;if(Math.max(Math.abs(M),Math.abs(b))<1e-7){y=!0;break}let v=1e-7,T=i>U-v?-v:v,S=g.x,E=g.y;fy(e,o+v,i);let N=(g.x-S)/v,B=(g.y-E)/v;fy(e,o,i+T);let C=(g.x-S)/T,R=(g.y-E)/T,W=N*R-C*B;if(!Number.isFinite(W)||Math.abs(W)<1e-12||(o-=(R*M-C*b)/W,i-=(N*b-B*M)/W,!Number.isFinite(o)||Math.abs(i)>U))break}if(!y)throw new Error("Cassini inverse did not converge")}return t.x=G(o+e.long0,e.over),t.y=ho(i),t}function fy(e,t,r){e.scratch.x=t+e.long0,e.scratch.y=r,dy(e,e.scratch)}function XE(e,t={}){let r={...e,en:[],scratch:{x:0,y:0},ml0:0,...t};return pO(r),r}var my={name:"cass",aliases:["Cassini","Cassini_Soldner"],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=vt(e),r=XE(t),n=Et("cass",e,r,dy,KE);return Pt(n,K(t.long0-Math.PI/6,-Math.PI/2+1e-8,t.long0+Math.PI/6,Math.PI/2-1e-8),i=>VE(Pe(t,e),n.forward,i),t.primeMeridian,t.over)}};Ie();Ht();ne();ue();Gc();function gO(e){e.sphere||(e.k0=nn(e.e,Math.sin(e.lat_ts),Math.cos(e.lat_ts)))}function ZE(e,t){var r=t.x,n=t.y,i,o,s=G(r-e.long0,e.over);if(e.sphere)i=e.x0+e.a*s*Math.cos(e.lat_ts),o=e.y0+e.a*Math.sin(n)/Math.cos(e.lat_ts);else{var a=Fr(e.e,Math.sin(n));i=e.x0+e.a*e.k0*s,o=e.y0+e.a*a*.5/e.k0}return t.x=i,t.y=o,t}function JE(e,t){t.x-=e.x0,t.y-=e.y0;var r,n;return e.sphere?(r=G(e.long0+t.x/e.a/Math.cos(e.lat_ts),e.over),n=Math.asin(t.y/e.a*Math.cos(e.lat_ts))):(n=am(e.e,2*t.y*e.k0/e.a),r=G(e.long0+t.x/(e.a*e.k0),e.over)),t.x=r,t.y=n,t}function QE(e,t={}){let r={...e,...t};return gO(r),r}var py={name:"cea",aliases:[],parameters:["lon_0","x_0","y_0","lat_ts"],create(e){let t=vt(e);if(Math.abs(t.lat_ts)>=Math.PI/2)throw new Error("CEA standard parallel must be away from the poles");let r=QE(t),n=Et("cea",e,r,ZE,JE);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ie();Ht();ne();ue();Fc();ya();Uc();Ae();function Ia(e){return Math.abs(e)>1&&(e=e>1?1:-1),Math.asin(e)}var yO=20;function wO(e){e.long0=e.long0||0,e.sphere?(e.n=1,e.m=0,e.es=0,e.C_y=Math.sqrt((e.m+1)/e.n),e.C_x=e.C_y/(e.m+1)):e.en=Ri(e.es)}function hm(e,t){var r,n,i=t.x,o=t.y;if(i=G(i-e.long0,e.over),e.sphere){if(!e.m)o=e.n!==1?Math.asin(e.n*Math.sin(o)):o;else for(var s=e.n*Math.sin(o),a=yO;a;--a){var c=(e.m*o+Math.sin(o)-s)/(e.m+Math.cos(o));if(o-=c,Math.abs(c)<1e-10)break}r=e.a*e.C_x*i*(e.m+Math.cos(o)),n=e.a*e.C_y*o}else{var l=Math.sin(o),h=Math.cos(o);n=e.a*rr(o,l,h,e.en),r=e.a*i*h/Math.sqrt(1-e.es*l*l)}return t.x=r,t.y=n,t}function um(e,t){var r,n,i,o;if(t.x-=e.x0,i=t.x/e.a,t.y-=e.y0,r=t.y/e.a,e.sphere){if(r/=e.C_y,i=i/(e.C_x*(e.m+Math.cos(r))),e.m){let s=(e.m*r+Math.sin(r))/e.n;if(Math.abs(s)>1+8*Number.EPSILON)return null;r=Ia(s)}else e.n!==1&&(r=Ia(Math.sin(r)/e.n));i=G(i+e.long0,e.over),r=ho(r)}else r=Ci(t.y/e.a,e.es,e.en),o=Math.abs(r),o<U?(o=Math.sin(r),n=e.long0+t.x*Math.sqrt(1-e.es*o*o)/(e.a*Math.cos(r)),i=G(n,e.over)):o-1e-10<U&&(i=e.long0);return t.x=i,t.y=r,t}function tT(e,t={}){let r={...e,en:[],n:0,m:0,C_y:0,C_x:0,...t};return wO(r),r}function _O(e){e.sphere=!0,e.b=e.a,e.m=1,e.n=2.5707963267948966,e.es=0,e.C_y=Math.sqrt((e.m+1)/e.n),e.C_x=e.C_y/(e.m+1)}var eT=hm,rT=um;function nT(e,t={}){let r={...e,m:0,n:0,C_y:0,C_x:0,en:[],...t};return _O(r),r}var gy={name:"eck6",aliases:["Eckert_VI"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=nT(t),n=Et("eck6",e,r,eT,rT);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ee();ue();var MO=.3333333333333333,bO=.17222222222222222,xO=.10257936507936508,SO=.06388888888888888,vO=.0664021164021164,EO=.016415012942191543;function yy(e){var t,r=[];return r[0]=e*MO,t=e*e,r[0]+=t*bO,r[1]=t*SO,t*=e,r[0]+=t*xO,r[1]+=t*vO,r[2]=t*EO,r}function wy(e,t){var r=e+e;return e+t[0]*Math.sin(r)+t[1]*Math.sin(r+r)+t[2]*Math.sin(r+r+r)}var tl=1.340264,el=-.081106,rl=893e-6,nl=.003796,fm=Math.sqrt(3)/2;function TO(e){e.long0=e.long0!==void 0?e.long0:0,e.x0=e.x0!==void 0?e.x0:0,e.y0=e.y0!==void 0?e.y0:0,e.es!==0&&(e.apa=yy(e.es),e.qp=Fr(e.e,1),e.rqda=Math.sqrt(.5*e.qp))}function iT(e,t){var r=G(t.x-e.long0,e.over),n=t.y,i=Math.sin(n);e.es!==0&&(i=Fr(e.e,i)/e.qp);var o=Math.asin(fm*i),s=o*o,a=s*s*s;return t.x=r*Math.cos(o)/(fm*(tl+3*el*s+a*(7*rl+9*nl*s))),t.y=o*(tl+el*s+a*(rl+nl*s)),e.es!==0&&(t.x*=e.rqda,t.y*=e.rqda),t.x=e.a*t.x+e.x0,t.y=e.a*t.y+e.y0,t}function oT(e,t){t.x=(t.x-e.x0)/e.a,t.y=(t.y-e.y0)/e.a,e.es!==0&&(t.x/=e.rqda,t.y/=e.rqda);let r=Math.PI/3,n=r*r,i=r*(tl+el*n+n**3*(rl+nl*n));if(Math.abs(t.y)>i+8*Number.EPSILON*i)return null;var o=1e-9,s=12,a=t.y,c,l,h,u,f,d;for(d=0;d<s&&(c=a*a,l=c*c*c,h=a*(tl+el*c+l*(rl+nl*c))-t.y,u=tl+3*el*c+l*(7*rl+9*nl*c),a-=f=h/u,!(Math.abs(f)<o));++d);c=a*a,l=c*c*c,t.x=fm*t.x*(tl+3*el*c+l*(7*rl+9*nl*c))/Math.cos(a);let m=Math.sin(a)/fm,p=8*Number.EPSILON;return Math.abs(m)>1+p?null:(t.y=Math.abs(m)>=1-p?Math.sign(m)*Math.PI/2:Math.asin(m),e.es!==0&&(t.y=wy(t.y,e.apa)),t.x=G(t.x+e.long0,e.over),t)}function sT(e,t={}){let r={...e,apa:[],qp:0,rqda:0,...t};return TO(r),r}Ht();ne();Ie();var _y={name:"eqearth",aliases:["Equal Earth","Equal_Earth"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=e.primeMeridian??0,n=sT(t),i=Et("eqearth",e,n,iT,oT),o=Math.sqrt(e.eccentricitySquared),s=e.semiMajorAxis*(o?Math.sqrt((1+(1-o*o)*Math.atanh(o)/o)/2):1),a=Math.PI/3,c=a*a,l=c**3,h=s*Math.PI/(Math.sqrt(3)/2*1.340264),u=tt(e.parameters,"x_0",0),f=tt(e.parameters,"y_0",0),d=s*a*(1.340264-.081106*c+l*(893e-6+.003796*c));return{...i,longitudeOrigin:t.long0,getRenderingProfile(m){if(m)return Ke(g=>yr(i.forward,g,t.long0,t.over),m,t.long0,r,t.over);let p=[[u-h,f-d,0],[u+h,f+d,0]];return{bounds:p,normalize:Ke(()=>p,gn(K(t.long0-Math.PI,-(Math.PI/2),t.long0+Math.PI,Math.PI/2),r),t.long0,r,t.over).normalize}}}}};Ie();Ht();ne();ue();function IO(e){e.x0=e.x0||0,e.y0=e.y0||0,e.lat0=e.lat0||0,e.long0=e.long0||0}function aT(e,t){var r=t.x,n=t.y,i=G(r-e.long0,e.over),o=e.x0+e.a*i*Math.cos(e.lat0),s=e.y0+e.a*n;return e.t1=o,e.t2=Math.cos(e.lat0),t.x=o,t.y=s,t}function cT(e,t){t.x-=e.x0,t.y-=e.y0;var r=t.y/e.a;Math.abs(r)>Math.PI/2&&Math.abs(r)<=Math.PI/2+8*Number.EPSILON&&(r=Math.sign(r)*Math.PI/2);var n=G(e.long0+t.x/(e.a*Math.cos(e.lat0)),e.over);return t.x=n,t.y=r,t}function lT(e,t={}){let r={...e,t2:0,t1:0,...t};return IO(r),r}var My={name:"equi",aliases:[],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=vt(e);if(Math.abs(t.lat0)>=Math.PI/2)throw new Error("Equirectangular standard parallel must be away from the poles");let r=lT(t),n=Et("equi",e,r,aT,cT);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ht();da();ne();Ee();wa();Ie();function hT(e,t,r=!1){let n=1+t/e.a,i=n/(1+1e-10),o=u=>Math.acos(Math.min(1,Math.sqrt(1-e.es*Math.sin(u)**2)/(i*Math.cos(u)))),s=u=>{let f=(i*Math.cos(u))**2;return Math.asin(Math.sqrt(Math.max(0,(f-1)/(f-e.es))))},a=t*Math.asin(1/n),c=t*Math.atan(Math.sqrt((1-e.es)/(n*n-1))),l=(u,f)=>{let d=Math.max(u[0][1],Math.min(u[1][1],0)),m=o(d),p=Math.max(u[0][0]-e.long0,-m),g=Math.min(u[1][0]-e.long0,m),y=s(Math.max(p,Math.min(g,0))),_=Math.max(u[0][1],-y),M=Math.min(u[1][1],y);if(g<p||M<_)return null;let b=K(p,_,g,M),v=gn(K(p+e.long0,_,g+e.long0,M),e.primeMeridian),T=(e.long0+e.primeMeridian)*180/Math.PI,S=Wo(E=>{let N=Math.max(p,Math.min(g,ve(E.x-e.long0))),B=s(N),C=Math.max(Math.max(_,-B),Math.min(Math.min(M,B),E.y));N!==E.x-e.long0&&(E.x=N+e.long0),E.y=C},e.primeMeridian);return{get bounds(){if(!f)return re([e.x0-a,e.x0+a],[e.y0-c,e.y0+c]);let E=se([0,0,1],b),N=[1,1/Math.sqrt(1-e.es*Math.max(E[0]**2,E[1]**2))],B=Te(se([1,0,0],b),N),C=Te(se([0,1,0],b),N),R=Te(E,[1-e.es,(1-e.es)*N[1]]),W=[n-Math.min(1,B[1]),n-Math.max(1/n,B[0])],j=(A,P,D,F)=>{let L=P[0]<=0&&P[1]>=0?0:Math.min(Math.abs(P[0]),Math.abs(P[1])),O=F?[Math.hypot(W[0],L),Math.hypot(W[1],Math.max(Math.abs(P[0]),Math.abs(P[1])))]:W,V=A.flatMap(yt=>O.map(Dt=>t*Math.atan(yt/Dt)));return[Math.max(-D,Math.min(...V)),Math.min(D,Math.max(...V))]};return re(At([e.x0,e.x0],j(C,R,a,r)),At([e.y0,e.y0],j(R,C,c,!r)))},normalize(E){Qf(E,v,T),S(E)}}},h=gn(K(e.long0-o(0),-s(0),e.long0+o(0),s(0)),e.primeMeridian);return u=>{let f=u?Zf(u,h):[h],d=Jf(f,m=>l(jo(m,e.primeMeridian,e.long0),!!u));if(!d)throw new Error("CRS coverage does not intersect the satellite limb");return d}}ga();function AO(e){if(e.flip_axis=e.sweep==="x"?1:0,e.h=Number(e.h),e.radius_g_1=e.h/e.a,e.radius_g_1<=0||e.radius_g_1>1e10)throw new Error;if(e.radius_g=1+e.radius_g_1,e.C=e.radius_g*e.radius_g-1,e.es!==0){var t=1-e.es,r=1/t;e.radius_p=Math.sqrt(t),e.radius_p2=t,e.radius_p_inv2=r,e.shape="ellipse"}else e.radius_p=1,e.radius_p2=1,e.radius_p_inv2=1,e.shape="sphere"}function uT(e,t){var r=t.x,n=t.y,i,o,s,a;if(r=r-e.long0,e.shape==="ellipse"){n=Math.atan(e.radius_p2*Math.tan(n));var c=e.radius_p/qe(e.radius_p*Math.cos(n),Math.sin(n));if(o=c*Math.cos(r)*Math.cos(n),s=c*Math.sin(r)*Math.cos(n),a=c*Math.sin(n),(e.radius_g-o)*o-s*s-a*a*e.radius_p_inv2<0)return t.x=Number.NaN,t.y=Number.NaN,t;i=e.radius_g-o,e.flip_axis?(t.x=e.radius_g_1*Math.atan(s/qe(a,i)),t.y=e.radius_g_1*Math.atan(a/i)):(t.x=e.radius_g_1*Math.atan(s/i),t.y=e.radius_g_1*Math.atan(a/qe(s,i)))}else e.shape==="sphere"&&(i=Math.cos(n),o=Math.cos(r)*i,s=Math.sin(r)*i,a=Math.sin(n),i=e.radius_g-o,e.flip_axis?(t.x=e.radius_g_1*Math.atan(s/qe(a,i)),t.y=e.radius_g_1*Math.atan(a/i)):(t.x=e.radius_g_1*Math.atan(s/i),t.y=e.radius_g_1*Math.atan(a/qe(s,i))));return t.x=t.x*e.a,t.y=t.y*e.a,t}function fT(e,t){var r=-1,n=0,i=0,o,s,a,c;if(t.x=t.x/e.a,t.y=t.y/e.a,e.shape==="ellipse"){e.flip_axis?(i=Math.tan(t.y/e.radius_g_1),n=Math.tan(t.x/e.radius_g_1)*qe(1,i)):(n=Math.tan(t.x/e.radius_g_1),i=Math.tan(t.y/e.radius_g_1)*qe(1,n));var l=i/e.radius_p;if(o=n*n+l*l+r*r,s=2*e.radius_g*r,a=s*s-4*o*e.C,a<0)return t.x=Number.NaN,t.y=Number.NaN,t;c=(-s-Math.sqrt(a))/(2*o),r=e.radius_g+c*r,n*=c,i*=c,t.x=Math.atan2(n,r),t.y=Math.atan(i*Math.cos(t.x)/r),t.y=Math.atan(e.radius_p_inv2*Math.tan(t.y))}else if(e.shape==="sphere"){if(e.flip_axis?(i=Math.tan(t.y/e.radius_g_1),n=Math.tan(t.x/e.radius_g_1)*Math.sqrt(1+i*i)):(n=Math.tan(t.x/e.radius_g_1),i=Math.tan(t.y/e.radius_g_1)*Math.sqrt(1+n*n)),o=n*n+i*i+r*r,s=2*e.radius_g*r,a=s*s-4*o*e.C,a<0)return t.x=Number.NaN,t.y=Number.NaN,t;c=(-s-Math.sqrt(a))/(2*o),r=e.radius_g+c*r,n*=c,i*=c,t.x=Math.atan2(n,r),t.y=Math.atan(i*Math.cos(t.x)/r)}return t.x=t.x+e.long0,t}function dT(e,t={}){let r={...e,flip_axis:0,sweep:"",h:0,radius_g_1:0,radius_g:0,C:0,radius_p:0,radius_p2:0,radius_p_inv2:0,shape:"",...t};return AO(r),r}Ee();var by={name:"geos",aliases:["Geostationary Satellite View","Geostationary_Satellite"],parameters:["lon_0","x_0","y_0","h","sweep"],create(e){let t=vt(e),r=tt(e.parameters,"h",NaN);if(!Number.isFinite(r)||r<=0)throw new Error("Geostationary projection requires positive h");let n=e.parameters.sweep||"y";if(!["x","y"].includes(n))throw new Error("Geostationary sweep must be x or y");let i=dT(t,{h:r,sweep:n});return{...Et("geos",e,i,uT,fT,t.sphere?ss({...t,lat0:0},1/(1+r/t.a),!0):void 0),longitudeOrigin:t.long0,getRenderingProfile:hT(Pe(t,e),r,n==="x")}}};Qo();ts();xb();ue();var Aa=180/Math.PI;function mT(e){return{engine:bb({semiMajorAxis:1,semiMinorAxis:Math.sqrt(1-e.es)}),latitude:e.lat0*Aa}}function pT(e,t,r){let n=t.engine.Inverse(t.latitude,0,r.y*Aa,G(r.x-e.long0,e.over)*Aa,hh);if(!(n.M12>0))throw new Error("Coordinate is outside the ellipsoidal gnomonic horizon");let i=e.a*n.m12/n.M12,o=n.azi1/Aa;return r.x=e.x0+i*Math.sin(o),r.y=e.y0+i*Math.cos(o),r}function gT(e,t,r){let n=(r.x-e.x0)/e.a,i=(r.y-e.y0)/e.a,o=Math.hypot(n,i);if(o===0)return r.x=e.long0,r.y=e.lat0,r;let s=t.engine.Line(t.latitude,0,Math.atan2(n,i)*Aa,hh),a=o<=1,c=a?o:1/o,l=Math.atan(o);for(let h=0;h<20;h++){let u=s.Position(l,hh),f=a?(u.m12-c*u.M12)*u.M12:(c*u.m12-u.M12)*u.m12;if(!Number.isFinite(f))break;if(l-=f,Math.abs(f)<1e-14){let d=s.Position(l,hh);if(!(d.M12>0))break;return r.x=G(e.long0+d.lon2/Aa,e.over),r.y=d.lat2/Aa,r}}throw new Error("Ellipsoidal gnomonic inverse did not converge")}ue();function PO(e){e.sphere||(e.ellipsoid=mT(e)),e.sin_p14=Math.sin(e.lat0),e.cos_p14=Math.cos(e.lat0),e.infinity_dist=1e3*e.a,e.rc=1}function yT(e,t){if(e.ellipsoid)return pT(e,e.ellipsoid,t);var r,n,i,o,s,a,c,l,h=t.x,u=t.y;return i=G(h-e.long0,e.over),r=Math.sin(u),n=Math.cos(u),o=Math.cos(i),a=e.sin_p14*r+e.cos_p14*n*o,s=1,a>0||Math.abs(a)<=1e-10?(c=e.x0+e.a*s*n*Math.sin(i)/a,l=e.y0+e.a*s*(e.cos_p14*r-e.sin_p14*n*o)/a):(c=e.x0+e.infinity_dist*n*Math.sin(i),l=e.y0+e.infinity_dist*(e.cos_p14*r-e.sin_p14*n*o)),t.x=c,t.y=l,t}function wT(e,t){if(e.ellipsoid)return gT(e,e.ellipsoid,t);var r,n,i,o,s,a;return t.x=(t.x-e.x0)/e.a,t.y=(t.y-e.y0)/e.a,t.x/=e.k0,t.y/=e.k0,r=Math.sqrt(t.x*t.x+t.y*t.y),r?(o=Math.atan2(r,e.rc),n=Math.sin(o),i=Math.cos(o),a=Ia(i*e.sin_p14+t.y*n*e.cos_p14/r),s=Math.atan2(t.x*n,r*e.cos_p14*i-t.y*e.sin_p14*n),s=G(e.long0+s,e.over)):(a=e.lat0,s=e.long0),t.x=s,t.y=a,t}function _T(e,t={}){let r={...e,sin_p14:0,cos_p14:0,infinity_dist:0,rc:0,phic0:0,...t};return PO(r),r}var xy={name:"gnom",aliases:[],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=vt(e),r=_T(t);return rn(Et("gnom",e,r,yT,wT,t.sphere?ss(t):void 0),t,Math.min(Math.PI*80/180,(1-t.es)*Math.PI*.45),(n,i)=>t.sphere?od(Pe(t,e),n,i,"gnom"):Tx(Pe(t,e),n,i),(1-t.es)*Math.PI/2)}};Ie();Ae();function Sy(e,t){return 2*Math.atan(e*Math.exp(t))-U}function dm(e,t){var r=Sy(1,t),n=0,i=0;let o=0;do{if(++o>50)throw new Error("Isometric latitude inverse did not converge");n=r,i=e*Math.sin(n),r=Sy(Math.exp(e*Math.log((1+i)/(1-i))/2),t)}while(Math.abs(r-n)>1e-12);return r}Ht();ne();Ae();function il(e,t,r){if(Math.abs(t)>U)return Number.NaN;if(t===U)return Number.POSITIVE_INFINITY;if(t===-1*U)return Number.NEGATIVE_INFINITY;var n=e*r;return Math.log(Math.tan((U+t)/2))+e*Math.log((1-n)/(1+n))/2}ed();Ug();function RO(e){e.k0||(e.k0=1);var t=e.b/e.a;e.e=Math.sqrt(1-t*t),e.lc=e.long0,e.rs=Math.sqrt(1+e.e*e.e*Math.pow(Math.cos(e.lat0),4)/(1-e.e*e.e));var r=Math.sin(e.lat0),n=Math.asin(r/e.rs),i=Math.sin(n);e.cp=il(0,n,i)-e.rs*il(e.e,e.lat0,r),e.n2=e.k0*e.a*Math.sqrt(1-e.e*e.e)/(1-e.e*e.e*r*r),e.xs=e.x0,e.ys=e.y0-e.n2*n}function MT(e,t){var r=t.x,n=t.y,i=e.rs*(r-e.lc),o=e.cp+e.rs*il(e.e,n,Math.sin(n)),s=Math.asin(Math.sin(i)/_h(o)),a=il(0,s,Math.sin(s));return t.x=e.xs+e.n2*a,t.y=e.ys+e.n2*Math.atan(pa(o)/Math.cos(i)),t}function bT(e,t){var r=t.x,n=t.y,i=Math.atan(pa((r-e.xs)/e.n2)/Math.cos((n-e.ys)/e.n2)),o=Math.asin(Math.sin((n-e.ys)/e.n2)/_h((r-e.xs)/e.n2)),s=il(0,o,Math.sin(o));return t.x=e.lc+i/e.rs,t.y=dm(e.e,(s-e.cp)/e.rs),t}function xT(e,t={}){let r={...e,lc:0,rs:0,cp:0,n2:0,xs:0,ys:0,...t};return RO(r),r}var vy={name:"gstmerc",aliases:["gstmerg"],parameters:["lon_0","x_0","y_0","lat_0","k","k_0"],create(e){let t=vt(e),r=xT(t),n=Et("gstmerc",e,r,MT,bT);return Pt(n,K(t.long0-Math.PI/6,-Math.PI/3,t.long0+Math.PI/6,Math.PI/3),i=>Oc(n.forward,i,t.long0,t.over,dm(r.e,-r.cp/r.rs)),t.primeMeridian,t.over)}};Ht();ne();ue();function CO(e){e.a=6377397155e-3,e.es=.006674372230614,e.e=Math.sqrt(e.es),e.s45=Math.PI/4,e.s90=2*e.s45,e.fi0=e.lat0,e.e2=e.es,e.e=Math.sqrt(e.e2),e.alfa=Math.sqrt(1+e.e2*Math.pow(Math.cos(e.fi0),4)/(1-e.e2)),e.uq=1.04216856380474,e.u0=Math.asin(Math.sin(e.fi0)/e.alfa),e.g=Math.pow((1+e.e*Math.sin(e.fi0))/(1-e.e*Math.sin(e.fi0)),e.alfa*e.e/2),e.k=Math.tan(e.u0/2+e.s45)/Math.pow(Math.tan(e.fi0/2+e.s45),e.alfa)*e.g,e.k1=e.k0,e.n0=e.a*Math.sqrt(1-e.e2)/(1-e.e2*Math.pow(Math.sin(e.fi0),2)),e.s0=1.37008346281555,e.n=Math.sin(e.s0),e.ro0=e.k1*e.n0/Math.tan(e.s0),e.ad=e.s90-e.uq}function ST(e,t){var r,n,i,o,s,a,c,l=t.x,h=t.y,u=G(l-e.long0,e.over);return r=Math.pow((1+e.e*Math.sin(h))/(1-e.e*Math.sin(h)),e.alfa*e.e/2),n=2*(Math.atan(e.k*Math.pow(Math.tan(h/2+e.s45),e.alfa)/r)-e.s45),i=-u*e.alfa,o=Math.asin(Math.cos(e.ad)*Math.sin(n)+Math.sin(e.ad)*Math.cos(n)*Math.cos(i)),s=Math.asin(Math.cos(n)*Math.sin(i)/Math.cos(o)),a=e.n*s,c=e.ro0*Math.pow(Math.tan(e.s0/2+e.s45),e.n)/Math.pow(Math.tan(o/2+e.s45),e.n),t.y=c*Math.cos(a)/1,t.x=c*Math.sin(a)/1,e.czech||(t.y*=-1,t.x*=-1),t}function vT(e,t){var r,n,i,o,s,a,c,l,h=t.x;t.x=t.y,t.y=h,e.czech||(t.y*=-1,t.x*=-1),a=Math.sqrt(t.x*t.x+t.y*t.y),s=Math.atan2(t.y,t.x),o=s/Math.sin(e.s0),i=2*(Math.atan(Math.pow(e.ro0/a,1/e.n)*Math.tan(e.s0/2+e.s45))-e.s45),r=Math.asin(Math.cos(e.ad)*Math.sin(i)-Math.sin(e.ad)*Math.cos(i)*Math.cos(o)),n=Math.asin(Math.cos(i)*Math.sin(o)/Math.cos(r)),t.x=e.long0-n/e.alfa,c=r,l=0;var u=0;do t.y=2*(Math.atan(Math.pow(e.k,-1/e.alfa)*Math.pow(Math.tan(r/2+e.s45),1/e.alfa)*Math.pow((1+e.e*Math.sin(c))/(1-e.e*Math.sin(c)),e.e/2))-e.s45),Math.abs(c-t.y)<1e-10&&(l=1),c=t.y,u+=1;while(l===0&&u<15);return u>=15?null:t}function ET(e,t={}){let r={...e,s45:0,s90:0,fi0:0,e2:0,alfa:0,uq:0,u0:0,g:0,k:0,k1:0,n0:0,s0:0,n:0,ro0:0,ad:0,czech:!1,...t};return CO(r),r}Ee();yn();var Ey={name:"krovak",aliases:["Krovak","Krovak Modified","Krovak (North Orientated)","Krovak Modified (North Orientated)"],parameters:["lon_0","x_0","y_0","lat_0","k","k_0","czech","alpha","lat_ts"],flags:["czech"],create(e){let t=tt(e.parameters,"alpha",30.28813972222222),r=tt(e.parameters,"lat_ts",78.5);if(![30.28813972222222,30.28813975277778].some(s=>Math.abs(t-s)<=1e-10))throw new Error("Krovak requires its fixed cone-axis co-latitude");if(Math.abs(r-78.5)>1e-10)throw new Error("Krovak requires its fixed 78.5 degree pseudo standard parallel");let n=vt(e);n.lat0=$o(e.parameters,"lat_0",49.5),n.long0=$o(e.parameters,"lon_0",24.83333333333333),n.k0=tt(e.parameters,"k_0",tt(e.parameters,"k",.9999));let i=ET(n,{czech:ii(e.parameters,"czech")}),o=Et("krovak",e,i,ST,vT);return Pt(o,K(n.long0-Math.PI/12,Math.max(-Math.PI/2+1e-8,n.lat0-Math.PI/36),n.long0+Math.PI/12,Math.min(Math.PI/2-1e-8,n.lat0+Math.PI/36)),s=>jE(Pe(i,e),s),n.primeMeridian,n.over)}};Ie();Ht();ne();ue();function TT(e,t){var r=t.x,n=t.y,i=G(r-e.long0,e.over),o=e.x0+e.a*i,s=e.y0+e.a*Math.log(Math.tan(Math.PI/4+n/2.5))*1.25;return t.x=o,t.y=s,t}function IT(e,t){t.x-=e.x0,t.y-=e.y0;var r=G(e.long0+t.x/e.a,e.over),n=2.5*(Math.atan(Math.exp(.8*t.y/e.a))-Math.PI/4);return t.x=r,t.y=n,t}function AT(e,t={}){let r={...e,...t};return r}var Ty={name:"mill",aliases:["Miller_Cylindrical"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=AT(t),n=Et("mill",e,r,TT,IT);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ie();Ht();ne();ue();function NO(e){e.x0=e.x0!==void 0?e.x0:0,e.y0=e.y0!==void 0?e.y0:0,e.long0=e.long0!==void 0?e.long0:0}function PT(e,t){var r=t.x,n=t.y,i=G(r-e.long0,e.over);let o=Math.sin(Math.abs(n)),s=Math.cos(n),a=Math.abs(n)===Math.PI/2?0:Math.PI*s*s/(1+o),c=Math.cbrt(6*a),l=0,h=Math.PI;c=Math.min(c,h);for(let d=0;d<32&&c>0;d++){let m=NT(c)-a,p=m/(2*Math.sin(c/2)**2);if(Math.abs(p)<=16*Number.EPSILON*c)break;m>0?h=c:l=c;let g=c-p;if(g===c||h-l<=8*Number.EPSILON*Math.max(1,c))break;if(c=g>=l&&g<=h?g:(l+h)/2,d===31)throw new Error("Mollweide forward did not converge")}var u=2*Math.SQRT2/Math.PI*e.a*i*Math.sin(c/2)+e.x0,f=Math.sign(n)*Math.SQRT2*e.a*Math.cos(c/2)+e.y0;return t.x=u,t.y=f,t}function RT(e,t){let r=t.x-e.x0,n=(t.y-e.y0)/(Math.SQRT2*e.a);if(Math.abs(n)>1+8*Number.EPSILON)return null;let i=r/(2*Math.SQRT2*e.a),o=i*i+n*n;if(!e.over&&o>1+8*Number.EPSILON)return null;let s=2*Math.acos(Math.min(1,Math.abs(n))),a=Math.sin(s/2);if(!e.over&&Math.abs(o-1)<=8*Number.EPSILON&&(a=Math.min(1,Math.abs(i)),s=2*Math.asin(a)),a===0&&Math.abs(r)>8*Number.EPSILON*e.a)return null;let c=a===0?0:Math.PI*i/a;var l=G(e.long0+c,e.over),h=Math.sign(n)*(Math.PI/2-2*Math.asin(Math.sqrt(NT(s)/(2*Math.PI))));return t.x=l,t.y=h,t}function CT(e,t={}){let r={...e,...t};return NO(r),r}function NT(e){if(e>.5)return e-Math.sin(e);let t=e*e;return e*t*(1/6+t*(-1/120+t*(1/5040+t*(-1/362880+t*(1/39916800+t*(-1/6227020800+t/1307674368e3))))))}var Iy={name:"moll",aliases:["Mollweide"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=CT(t),n=Et("moll",e,r,PT,RT);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ht();ne();Ae();function OO(e){e.A=[],e.A[1]=.6399175073,e.A[2]=-.1358797613,e.A[3]=.063294409,e.A[4]=-.02526853,e.A[5]=.0117879,e.A[6]=-.0055161,e.A[7]=.0026906,e.A[8]=-.001333,e.A[9]=67e-5,e.A[10]=-34e-5,e.B_re=[],e.B_im=[],e.B_re[1]=.7557853228,e.B_im[1]=0,e.B_re[2]=.249204646,e.B_im[2]=.003371507,e.B_re[3]=-.001541739,e.B_im[3]=.04105856,e.B_re[4]=-.10162907,e.B_im[4]=.01727609,e.B_re[5]=-.26623489,e.B_im[5]=-.36249218,e.B_re[6]=-.6870983,e.B_im[6]=-1.1651967,e.C_re=[],e.C_im=[],e.C_re[1]=1.3231270439,e.C_im[1]=0,e.C_re[2]=-.577245789,e.C_im[2]=-.007809598,e.C_re[3]=.508307513,e.C_im[3]=-.112208952,e.C_re[4]=-.15094762,e.C_im[4]=.18200602,e.C_re[5]=1.01418179,e.C_im[5]=1.64497696,e.C_re[6]=1.9660549,e.C_im[6]=2.5127645,e.D=[],e.D[1]=1.5627014243,e.D[2]=.5185406398,e.D[3]=-.03333098,e.D[4]=-.1052906,e.D[5]=-.0368594,e.D[6]=.007317,e.D[7]=.0122,e.D[8]=.00394,e.D[9]=-.0013}function OT(e,t){var r,n=t.x,i=t.y,o=i-e.lat0,s=n-e.long0,a=o/Mh*1e-5,c=s,l=1,h=0;for(r=1;r<=10;r++)l=l*a,h=h+e.A[r]*l;var u=h,f=c,d=1,m=0,p,g,y=0,_=0;for(r=1;r<=6;r++)p=d*u-m*f,g=m*u+d*f,d=p,m=g,y=y+e.B_re[r]*d-e.B_im[r]*m,_=_+e.B_im[r]*d+e.B_re[r]*m;return t.x=_*e.a+e.x0,t.y=y*e.a+e.y0,t}function BT(e,t){var r,n=t.x,i=t.y,o=n-e.x0,s=i-e.y0,a=s/e.a,c=o/e.a,l=1,h=0,u,f,d=0,m=0;for(r=1;r<=6;r++)u=l*a-h*c,f=h*a+l*c,l=u,h=f,d=d+e.C_re[r]*l-e.C_im[r]*h,m=m+e.C_im[r]*l+e.C_re[r]*h;for(var p=0;p<e.iterations;p++){var g=d,y=m,_,M,b=a,v=c;for(r=2;r<=6;r++)_=g*d-y*m,M=y*d+g*m,g=_,y=M,b=b+(r-1)*(e.B_re[r]*g-e.B_im[r]*y),v=v+(r-1)*(e.B_im[r]*g+e.B_re[r]*y);g=1,y=0;var T=e.B_re[1],S=e.B_im[1];for(r=2;r<=6;r++)_=g*d-y*m,M=y*d+g*m,g=_,y=M,T=T+r*(e.B_re[r]*g-e.B_im[r]*y),S=S+r*(e.B_im[r]*g+e.B_re[r]*y);var E=T*T+S*S;d=(b*T+v*S)/E,m=(v*T-b*S)/E}var N=d,B=m,C=1,R=0;for(r=1;r<=9;r++)C=C*N,R=R+e.D[r]*C;var W=e.lat0+R*Mh*1e5,j=e.long0+B;return t.x=j,t.y=W,t}function LT(e,t={}){let r={...e,A:[],B_re:[],B_im:[],C_re:[],C_im:[],D:[],iterations:1,...t};return OO(r),r}Ee();var Ay={name:"nzmg",aliases:["New_Zealand_Map_Grid"],parameters:["lon_0","x_0","y_0","lat_0","iterations"],create(e){let t=vt(e),r=tt(e.parameters,"iterations",1);if(!Number.isInteger(r)||r<0||r>10)throw new Error("NZMG iterations must be an integer from 0 to 10");if(!Object.prototype.hasOwnProperty.call(e.parameters,"lat_0")||!Object.prototype.hasOwnProperty.call(e.parameters,"lon_0"))throw new Error("NZMG requires lat_0 and lon_0");let n=LT(t,{iterations:r}),i=Et("nzmg",e,n,OT,BT);return Pt(i,K(t.long0-Math.PI/22.5,Math.max(-Math.PI/2,t.lat0-Math.PI/22.5),t.long0+Math.PI/22.5,Math.min(Math.PI/2,t.lat0+Math.PI/22.5)),o=>WE(Pe(n,e),o),t.primeMeridian,t.over)}};Ht();ne();Sh();ue();ad();Ae();var ol=1e-7;function BO(e){return e.no_uoff||e.no_off||["hotineobliquemercator","hotineobliquemercatorvarianta","hotineobliquemercatorazimuthnaturalorigin"].includes(e.projName.toLowerCase().replace(/[ _-]/g,""))}function LO(e){var t,r,n,i,o,s,a,c,l,h,u=0,f,d=0,m=0,p=0,g=0,y=0,_=0;e.k0||(e.k0=1),e.no_off=BO(e),e.no_rot=e.no_rot;var M=!1;Number.isFinite(e.alpha)&&(M=!0);var b=!1;if(Number.isFinite(e.rectified_grid_angle)&&(b=!0),M&&(_=e.alpha),b&&(u=e.rectified_grid_angle,M||(_=0,M=!0)),M||b)d=e.longc;else if(m=e.long1,g=e.lat1,p=e.long2,y=e.lat2,Math.abs(g-y)<=ol||Math.abs(g)<=ol||Math.abs(Math.abs(g)-U)<=ol||Math.abs(Math.abs(e.lat0)-U)<=ol||Math.abs(Math.abs(y)-U)<=ol)throw new Error;var v=1-e.es;if(r=Math.sqrt(v),Math.abs(e.lat0)>1e-10?(c=Math.sin(e.lat0),n=Math.cos(e.lat0),t=1-e.es*c*c,e.B=n*n,e.B=Math.sqrt(1+e.es*e.B*e.B/v),e.A=e.B*e.k0*r/t,i=e.B*r/(n*Math.sqrt(t)),o=i*i-1,o<=0?o=0:(o=Math.sqrt(o),e.lat0<0&&(o=-o)),e.E=o+=i,e.E*=Math.pow(Lr(e.e,e.lat0,c),e.B)):(e.B=1/r,e.A=e.k0,e.E=i=o=1),M||b){M?(f=Math.asin(Math.sin(_)/i),b||(u=_)):(f=u,_=Math.asin(i*Math.sin(f)));let T=.5*(o-1/o)*Math.tan(f);i>1&&Math.abs(Math.cos(_))<=8*Number.EPSILON?T=Math.sign(e.lat0)*Math.sign(Math.sin(_)):Math.abs(T)>1&&Math.abs(T)<=1+8*Number.EPSILON&&(T=Math.sign(T)),e.lam0=d-Math.asin(T)/e.B}else s=Math.pow(Lr(e.e,g,Math.sin(g)),e.B),a=Math.pow(Lr(e.e,y,Math.sin(y)),e.B),o=e.E/s,l=(a-s)/(a+s),h=e.E*e.E,h=(h-a*s)/(h+a*s),t=m-p,t<-Math.PI?p-=Ko:t>Math.PI&&(p+=Ko),e.lam0=G(.5*(m+p)-Math.atan(h*Math.tan(.5*e.B*(m-p))/l)/e.B,e.over),f=Math.atan(2*Math.sin(e.B*G(m-e.lam0,e.over))/(o-1/o)),u=_=Math.asin(i*Math.sin(f));e.singam=Math.sin(f),e.cosgam=Math.cos(f),e.sinrot=Math.sin(u),e.cosrot=Math.cos(u),e.rB=1/e.B,e.ArB=e.A*e.rB,e.BrA=1/e.ArB,e.no_off?e.u_0=0:(e.u_0=Math.abs(e.ArB*Math.atan(Math.sqrt(i*i-1)/Math.cos(_))),e.lat0<0&&(e.u_0=-e.u_0)),o=.5*f,e.v_pole_n=e.ArB*Math.log(Math.tan($t-o)),e.v_pole_s=e.ArB*Math.log(Math.tan($t+o))}function DT(e,t){var r=t,n,i,o,s,a,c,l,h;if(t.x=t.x-e.lam0,Math.abs(Math.abs(t.y)-U)>1e-10){if(a=e.E/Math.pow(Lr(e.e,t.y,Math.sin(t.y)),e.B),c=1/a,n=.5*(a-c),i=.5*(a+c),s=Math.sin(e.B*t.x),o=(n*e.singam-s*e.cosgam)/i,Math.abs(Math.abs(o)-1)<1e-10)throw new Error;h=.5*e.ArB*Math.log((1-o)/(1+o)),c=Math.cos(e.B*t.x),Math.abs(c)<ol?l=e.A*t.x:l=e.ArB*Math.atan2(n*e.cosgam+s*e.singam,c)}else h=t.y>0?e.v_pole_n:e.v_pole_s,l=e.ArB*t.y;return e.no_rot?(r.x=l,r.y=h):(l-=e.u_0,r.x=h*e.cosrot+l*e.sinrot,r.y=l*e.cosrot-h*e.sinrot),r.x=e.a*r.x+e.x0,r.y=e.a*r.y+e.y0,r}function FT(e,t){var r,n,i,o,s,a,c,l=t;if(t.x=(t.x-e.x0)*(1/e.a),t.y=(t.y-e.y0)*(1/e.a),e.no_rot?(n=t.y,r=t.x):(n=t.x*e.cosrot-t.y*e.sinrot,r=t.y*e.cosrot+t.x*e.sinrot+e.u_0),i=Math.exp(-e.BrA*n),o=.5*(i-1/i),s=.5*(i+1/i),a=Math.sin(e.BrA*r),c=(a*e.cosgam+o*e.singam)/s,Math.abs(Math.abs(c)-1)<1e-10)l.x=0,l.y=c<0?-U:U;else{if(l.y=e.E/Math.sqrt((1+c)/(1-c)),l.y=_a(e.e,Math.pow(l.y,1/e.B)),l.y===1/0)throw new Error;l.x=-e.rB*Math.atan2(o*e.cosgam-a*e.singam,Math.cos(e.BrA*r))}return l.x+=e.lam0,l}function UT(e,t={}){let r={...e,no_off:!1,no_rot:!1,alpha:NaN,rectified_grid_angle:NaN,longc:0,long1:0,long2:0,B:0,A:0,E:0,lam0:0,singam:0,cosgam:0,sinrot:0,cosrot:0,rB:0,ArB:0,BrA:0,u_0:0,v_pole_n:0,v_pole_s:0,no_uoff:!1,projName:"",...t};return LO(r),r}Ee();yn();var Py={name:"omerc",aliases:["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_variant_A","Hotine_Oblique_Mercator_Variant_B","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator"],parameters:["lon_0","x_0","y_0","lat_0","k","k_0","alpha","gamma","lonc","lon_1","lon_2","lat_1","lat_2","no_off","no_uoff","no_rot"],flags:["no_off","no_uoff","no_rot"],create(e){let t=vt(e);if(Math.abs(t.lat0)>=Math.PI/2)throw new Error("Oblique Mercator origin must be away from the poles");let n=Object.prototype.hasOwnProperty.call(e.parameters,"alpha")||Object.prototype.hasOwnProperty.call(e.parameters,"gamma")?["lonc"]:["lon_1","lat_1","lon_2","lat_2"];for(let s of n)if(!Object.prototype.hasOwnProperty.call(e.parameters,s))throw new Error("Oblique Mercator requires "+s);let i=UT(t,{projName:e.parameters.proj||"omerc",alpha:tt(e.parameters,"alpha",NaN)*Math.PI/180,rectified_grid_angle:tt(e.parameters,"gamma",NaN)*Math.PI/180,longc:tt(e.parameters,"lonc",0)*Math.PI/180,long1:tt(e.parameters,"lon_1",0)*Math.PI/180,long2:tt(e.parameters,"lon_2",0)*Math.PI/180,no_off:ii(e.parameters,"no_off"),no_uoff:ii(e.parameters,"no_uoff"),no_rot:ii(e.parameters,"no_rot")}),o=Et("omerc",e,i,DT,FT);return Pt(o,K(i.lam0-Math.PI/18,Math.max(-Math.PI/2+1e-8,t.lat0-Math.PI/18),i.lam0+Math.PI/18,Math.min(Math.PI/2-1e-8,t.lat0+Math.PI/18)),s=>qE(Pe(i,e),s),t.primeMeridian,t.over)}};Qo();ts();ue();function GT(e){let t=Math.sin(e.lat0),r=Math.cos(e.lat0),n=1/Math.sqrt(1-e.es*t*t);return{...e,sin0:t,cos0:r,originY:-e.es*n*t*r}}function zT(e,t){let r=G(t.x-e.long0,e.over),n=Math.sin(t.y),i=Math.cos(t.y),o=1/Math.sqrt(1-e.es*n*n);return t.x=e.x0+e.a*e.k0*o*i*Math.sin(r),t.y=e.y0+e.a*e.k0*(o*((1-e.es)*n*e.cos0-i*Math.cos(r)*e.sin0)-e.originY),t}function VT(e,t){let r=(t.x-e.x0)/(e.a*e.k0),n=(t.y-e.y0)/(e.a*e.k0)+e.originY,i=1-e.es,o=e.cos0*e.cos0+e.sin0*e.sin0/i,s=n*e.sin0*e.cos0*e.es/i,a=r*r+n*n*(e.sin0*e.sin0+e.cos0*e.cos0/i)-1,c=s*s-o*a;if(c<-32*Number.EPSILON*o)throw new Error("Coordinate is outside the orthographic ellipse");let l=(-s+Math.sqrt(Math.max(0,c)))/o,h=l*e.cos0-n*e.sin0,u=l*e.sin0+n*e.cos0;return t.x=G(e.long0+Math.atan2(r,h),e.over),t.y=Math.atan2(u,i*Math.hypot(h,r)),t}var Ry={name:"ortho",aliases:[],parameters:["lon_0","x_0","y_0","lat_0","k","k_0"],create(e){let t=vt(e),r=GT(t);return rn(Et("ortho",e,r,zT,VT,ss(t,0,!0)),t,Math.PI/2,(n,i)=>xx(Pe(t,e),n,i),Math.PI/2)}};Ht();ne();ue();var kT=20;function DO(e){e.meridianPole=Sn(e.a,e.es,0,Math.PI/2),e.poleRadius=e.a/Math.sqrt(1-e.es),e.ml0=Sn(e.a,e.es,0,e.lat0)}function jT(e,t){var r=t.x,n=t.y,i,o,s,a=G(r-e.long0,e.over);if(s=a*Math.sin(n),e.sphere)n===0?(i=e.a*a,o=-1*e.a*e.lat0):(i=e.a*Math.sin(s)/Math.tan(n),o=e.a*(n-e.lat0+2*Math.sin(s/2)**2/Math.tan(n)));else if(n===0)i=e.a*a,o=-1*e.ml0;else{var c=Qc(e.a,e.e,Math.sin(n))/Math.tan(n);i=c*Math.sin(s),o=Sn(e.a,e.es,e.lat0,n)+c*(2*Math.sin(s/2)**2)}return t.x=i+e.x0,t.y=o+e.y0,t}function WT(e,t){var r,n,i,o,s,a,c,l,h;i=t.x-e.x0,o=t.y-e.y0;let u=o+(e.sphere?e.a*e.lat0:e.ml0),f=u<0?-1:1,m=(e.sphere?e.a*Math.PI/2:e.meridianPole)-f*u,p=Math.hypot(i,m);if(p/e.a<1e-6)return t.x=G(e.long0+Math.atan2(i,m),e.over),t.y=f*(Math.PI/2-p/e.poleRadius),t;if(e.sphere)if(Math.abs(o+e.a*e.lat0)<=1e-10)r=G(i/e.a+e.long0,e.over),n=0;else{a=e.lat0+o/e.a,c=i*i/e.a/e.a+a*a,l=a;var g;for(s=kT;s;--s)if(g=Math.tan(l),h=-1*(a*(l*g+1)-l-.5*(l*l+c)*g)/((l-a)/g-1),l+=h,Math.abs(h)<=1e-14){n=l;break}if(n=qT(e,n===void 0?l:n,i,o),n===void 0)return null;l=n,r=G(e.long0+Math.asin(i*Math.tan(l)/e.a)/Math.sin(n),e.over)}else if(Math.abs(o+e.ml0)<=1e-10)n=0,r=G(e.long0+i/e.a,e.over);else{a=(e.ml0+o)/e.a,c=i*i/e.a/e.a+a*a,l=a;var y,_,M,b,v;for(s=kT;s;--s)if(v=e.e*Math.sin(l),y=Math.sqrt(1-v*v)*Math.tan(l),_=Sn(e.a,e.es,0,l),M=(1-e.es)/Math.pow(1-v*v,1.5),b=_/e.a,h=(a*(y*b+1)-b-.5*y*(b*b+c))/(e.es*Math.sin(2*l)*(b*b+c-2*a*b)/(4*y)+(a-b)*(y*M-2/Math.sin(2*l))-M),l-=h,Math.abs(h)<=1e-14){n=l;break}if(n=qT(e,n===void 0?l:n,i,o),n===void 0)return null;l=n,y=Math.sqrt(1-e.es*Math.pow(Math.sin(n),2))*Math.tan(n),r=G(e.long0+Math.asin(i*y/e.a)/Math.sin(n),e.over)}return t.x=r,t.y=n,t}function HT(e,t={}){let r={...e,ml0:0,meridianPole:0,poleRadius:0,...t};return DO(r),r}function qT(e,t,r,n){for(let i=0;i<8;i++){if(!Number.isFinite(t)||Math.abs(t)>=Math.PI/2)return;let o=Math.sin(t),s=Math.cos(t),a=1-e.es*o*o,c=e.sphere?e.a:Qc(e.a,e.e,o),l=c/Math.tan(t),h=Math.asin(r/l),u=l*Math.sin(h),f=2*Math.sin(h/2)**2,d=e.sphere?e.a*(t-e.lat0):Sn(e.a,e.es,e.lat0,t),m=l*f,g=d+m-n;if(Math.abs(u-r)<=64*Number.EPSILON*Math.max(e.a,Math.abs(r))&&Math.abs(g)<=64*Number.EPSILON*Math.max(Math.abs(n),Math.abs(d),Math.abs(m),e.a*Math.max(Math.abs(t),Math.abs(e.lat0))))return t;let y=e.sphere?e.a:e.a*(1-e.es)/Math.pow(a,1.5),_=c*((e.sphere?0:e.es*s*s/a)-1/(o*o)),M=y+_*(-f/Math.cos(h)),b=g/M;if(!Number.isFinite(b)||Math.abs(b)>1e-6)return;t-=b}}var Cy={name:"poly",aliases:["Polyconic","American_Polyconic"],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=vt(e),r=HT(t),n=Et("poly",e,r,jT,WT);return Pt(n,K(t.long0-Math.PI/6,Math.max(-Math.PI/2+1e-8,t.lat0-Math.PI/2+1e-8),t.long0+Math.PI/6,Math.min(Math.PI/2-1e-8,t.lat0+Math.PI/2-1e-8)),i=>zE(Pe(t,e),n.forward,i),t.primeMeridian,t.over)}};da();Ee();Ae();var Re={FRONT:1,RIGHT:2,BACK:3,LEFT:4,TOP:5,BOTTOM:6},ae={AREA_0:1,AREA_1:2,AREA_2:3,AREA_3:4};function FO(e){e.x0=e.x0||0,e.y0=e.y0||0,e.lat0=e.lat0||0,e.long0=e.long0||0,e.lat_ts=e.lat_ts||0,e.lat0>=U-$t/2?e.face=Re.TOP:e.lat0<=-(U-$t/2)?e.face=Re.BOTTOM:Math.abs(e.long0)<=$t?e.face=Re.FRONT:Math.abs(e.long0)<=U+$t?e.face=e.long0>0?Re.RIGHT:Re.LEFT:e.face=Re.BACK,e.es!==0&&(e.one_minus_f=1-(e.a-e.b)/e.a,e.one_minus_f_squared=e.one_minus_f*e.one_minus_f)}function $T(e,t){var r=t,n,i,o,s,a,c,l=0;if(t.x-=e.long0,e.es!==0?n=Math.atan(e.one_minus_f_squared*Math.tan(t.y)):n=t.y,i=t.x,e.face===Re.TOP)s=U-n,i>=$t&&i<=U+$t?(l=ae.AREA_0,o=i-U):i>U+$t||i<=-(U+$t)?(l=ae.AREA_1,o=i>0?i-Math.PI:i+Math.PI):i>-(U+$t)&&i<=-$t?(l=ae.AREA_2,o=i+U):(l=ae.AREA_3,o=i);else if(e.face===Re.BOTTOM)s=U+n,i>=$t&&i<=U+$t?(l=ae.AREA_0,o=-i+U):i<$t&&i>=-$t?(l=ae.AREA_1,o=-i):i<-$t&&i>=-(U+$t)?(l=ae.AREA_2,o=-i-U):(l=ae.AREA_3,o=i>0?-i+Math.PI:-i-Math.PI);else{var h,u,f,d,m,p,g;e.face===Re.RIGHT?i=sl(i,+U):e.face===Re.BACK?i=sl(i,+Math.PI):e.face===Re.LEFT&&(i=sl(i,-U)),d=Math.sin(n),m=Math.cos(n),p=Math.sin(i),g=Math.cos(i),h=m*g,u=m*p,f=d,e.face===Re.FRONT?(s=Math.atan2(Math.hypot(u,f),h),o=mm(s,f,u)):e.face===Re.RIGHT?(s=Math.atan2(Math.hypot(h,f),u),o=mm(s,f,-h)):e.face===Re.BACK?(s=Math.atan2(Math.hypot(u,f),-h),o=mm(s,f,-u)):e.face===Re.LEFT?(s=Math.atan2(Math.hypot(h,f),-u),o=mm(s,f,h)):s=o=0,Math.abs(o)<=$t?l=ae.AREA_0:o>$t&&o<=U+$t?(l=ae.AREA_1,o-=U):o>U+$t||o<=-(U+$t)?(l=ae.AREA_2,o=o>=0?o-Math.PI:o+Math.PI):(l=ae.AREA_3,o+=U)}return c=Math.atan(12/Math.PI*(o+Math.acos(Math.sin(o)*Math.cos($t))-U)),a=Math.sqrt(2*Math.sin(s/2)**2/(Math.cos(c)*Math.cos(c))/(1-Math.cos(Math.atan(1/Math.cos(o))))),l===ae.AREA_1?c+=U:l===ae.AREA_2?c+=Math.PI:l===ae.AREA_3&&(c+=1.5*Math.PI),r.x=a*Math.cos(c),r.y=a*Math.sin(c),r.x=r.x*e.a+e.x0,r.y=r.y*e.a+e.y0,t}function YT(e,t){var r=0,n=0,i,o,s,a,c,l,h,u,f=0;t.x=(t.x-e.x0)/e.a,t.y=(t.y-e.y0)/e.a,i=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?f=ae.AREA_0:t.y>=0&&t.y>=Math.abs(t.x)?(f=ae.AREA_1,i-=U):t.x<0&&-t.x>=Math.abs(t.y)?(f=ae.AREA_2,i=i<0?i+Math.PI:i-Math.PI):(f=ae.AREA_3,i+=U),u=Math.PI/12*Math.tan(i),a=Math.sin(u)/(Math.cos(u)-1/Math.sqrt(2)),c=Math.atan(a),o=Math.cos(i),s=Math.hypot(t.x,t.y);let d=o*o*s*s*(1-Math.cos(Math.atan(1/Math.cos(c))));if(l=1-d,l<-1?l=-1:l>1&&(l=1),e.face===Re.TOP)h=2*Math.asin(Math.sqrt(Math.min(1,d/2))),n=U-h,f===ae.AREA_0?r=c+U:f===ae.AREA_1?r=c<0?c+Math.PI:c-Math.PI:f===ae.AREA_2?r=c-U:r=c;else if(e.face===Re.BOTTOM)h=2*Math.asin(Math.sqrt(Math.min(1,d/2))),n=h-U,f===ae.AREA_0?r=-c+U:f===ae.AREA_1?r=-c:f===ae.AREA_2?r=-c-U:r=c<0?-c-Math.PI:-c+Math.PI;else{var m,p,g;m=l;let y=Math.sqrt(Math.max(0,d*(2-d)));g=y*Math.sin(c),p=y*Math.cos(c),f===ae.AREA_1?(u=p,p=-g,g=u):f===ae.AREA_2?(p=-p,g=-g):f===ae.AREA_3&&(u=p,p=g,g=-u),e.face===Re.RIGHT?(u=m,m=-p,p=u):e.face===Re.BACK?(m=-m,p=-p):e.face===Re.LEFT&&(u=m,m=p,p=-u),n=Math.atan2(g,Math.hypot(m,p)),r=Math.atan2(p,m),e.face===Re.RIGHT?r=sl(r,-U):e.face===Re.BACK?r=sl(r,-Math.PI):e.face===Re.LEFT&&(r=sl(r,+U))}return e.es!==0&&(n=Math.atan2(Math.sin(n),e.one_minus_f_squared*Math.cos(n))),r+=e.long0,t.x=r,t.y=n,t}function mm(e,t,r){return e===0?0:Math.atan2(t,r)}function sl(e,t){var r=e+t;return r<-Math.PI?r+=Ko:r>+Math.PI&&(r-=Ko),r}function KT(e,t={}){let r={...e,face:0,one_minus_f:0,one_minus_f_squared:0,...t};return FO(r),r}Ht();ne();wa();Ie();var Ny={name:"qsc",aliases:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube"],parameters:["lon_0","x_0","y_0","lat_0"],create(e){let t=vt(e),r=e.primeMeridian??0,n=KT(t),i=Et("qsc",e,n,$T,YT),o=tt(e.parameters,"x_0",0),s=tt(e.parameters,"y_0",0);return{...i,longitudeOrigin:t.long0,getRenderingProfile(a){if(a)return Ke(u=>{let f=y=>t.es?Math.atan((1-t.es)*Math.tan(y)):y,d=K(u[0][0]-t.long0,f(u[0][1]),u[1][0]-t.long0,f(u[1][1])),m=n.face===5?[0,0,1]:n.face===6?[0,0,-1]:[1,0,0],p=se(m,d)[0],g=t.a*Math.sqrt((1-p)/(.5*(1-Math.SQRT1_2)));return re([o-g,o+g],[s-g,s+g])},a,t.long0,r);let c=[[o-t.a,s-t.a,0],[o+t.a,s+t.a,0]],l=is(e.parameters,r)().normalize,h=Wo(u=>{let[f,d]=i.forward(u.x,u.y);Math.abs(f-o)<=t.a&&Math.abs(d-s)<=t.a||([u.x,u.y]=i.inverse(o+Math.max(-t.a,Math.min(t.a,f-o)),s+Math.max(-t.a,Math.min(t.a,d-s))))},r);return{bounds:c,normalize(u){l(u),h(u)}}}}}};Ie();Ht();ne();Ae();ue();var al=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-986701e-12],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,18736e-12],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,934959e-12],[.7986,-.00755338,-500009e-10,935324e-12],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],as=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-126793e-14,422642e-15],[.124,.0124,507171e-14,-160604e-14],[.186,.0123999,-190189e-13,600152e-14],[.248,.0124002,710039e-13,-224e-10],[.31,.0123992,-264997e-12,835986e-13],[.372,.0124029,988983e-12,-311994e-12],[.434,.0123893,-369093e-11,-435621e-12],[.4958,.0123198,-102252e-10,-345523e-12],[.5571,.0121916,-154081e-10,-582288e-12],[.6176,.0119938,-241424e-10,-525327e-12],[.6769,.011713,-320223e-10,-516405e-12],[.7346,.0113541,-397684e-10,-609052e-12],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-140374e-14],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]];al=al.map(e=>e.map(Math.fround));as=as.map(e=>e.map(Math.fround));var XT=.8487,ZT=1.3523,JT=Vg/5,UO=1/JT,Pa=18,pm=function(e,t){return e[0]+t*(e[1]+t*(e[2]+t*e[3]))},GO=function(e,t){return e[1]+t*(2*e[2]+t*3*e[3])};function zO(e,t,r,n,i){for(var o=r;i;--i){var s=(pm(e,o)-t)/GO(e,o);if(o-=s,Math.abs(s)<n)break}return o}function VO(e){e.x0=e.x0||0,e.y0=e.y0||0,e.long0=e.long0||0,e.es=0}function QT(e,t){var r=G(t.x-e.long0,e.over),n=Math.abs(t.y),i=Math.floor(n*JT+1e-15);i<0?i=0:i>=Pa&&(i=Pa),n=Vg*(n-UO*i);var o=pm(al[i],n)*r,s=pm(as[i],n);return t.y<0&&(s=-s),t.x=o*e.a*XT+e.x0,t.y=s*e.a*ZT+e.y0,t}function tI(e,t){var r=t.y,n=t;n.x=(n.x-e.x0)/(e.a*XT),n.y=Math.abs(r-e.y0)/(e.a*ZT);for(let a=0;a<=Pa;a++)if(Math.abs(n.y-as[a][0])<=8*Number.EPSILON)return n.x=G(n.x/al[a][0]+e.long0,e.over),n.y=(r<e.y0?-1:1)*a*5*zg,n;if(n.y>=1)n.x/=al[Pa][0],n.y=r<0?-U:U;else{var i=Math.floor(n.y*Pa);for(i<0?i=0:i>=Pa&&(i=Pa-1);;)if(as[i][0]>n.y)--i;else if(as[i+1][0]<=n.y)++i;else break;var o=as[i],s=5*(n.y-o[0])/(as[i+1][0]-o[0]);s=zO(o,n.y,s,1e-10,100),n.x/=pm(al[i],s),n.y=(5*i+s)*zg,r<0&&(n.y=-n.y)}return n.x=G(n.x+e.long0,e.over),n}function eI(e,t={}){let r={...e,...t};return VO(r),r}var Oy={name:"robin",aliases:["Robinson"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=eI(t),n=Et("robin",e,r,QT,tI);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ie();Ht();ne();var By={name:"sinu",aliases:["Sinusoidal"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=tT(t),n=Et("sinu",e,r,hm,um);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>yr(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};Ht();ne();function kO(e){e.k0||(e.k0=1);var t=e.lat0;e.lambda0=e.long0;var r=Math.sin(t),n=e.a,i=e.rf,o=1/i,s=2*o-Math.pow(o,2);e.e=Math.sqrt(s);var a=e.e;e.R=e.k0*n*Math.sqrt(1-s)/(1-s*Math.pow(r,2)),e.alpha=Math.sqrt(1+s/(1-s)*Math.pow(Math.cos(t),4)),e.b0=Math.asin(r/e.alpha);var c=Math.log(Math.tan(Math.PI/4+e.b0/2)),l=Math.log(Math.tan(Math.PI/4+t/2)),h=Math.log((1+a*r)/(1-a*r));e.K=c-e.alpha*l+e.alpha*a/2*h}function rI(e,t){let r=e.e*Math.sin(t.y),n=2*Math.atan(Math.exp(e.alpha*(Math.log(Math.tan(Math.PI/4+t.y/2))-e.e/2*Math.log((1+r)/(1-r)))+e.K))-Math.PI/2,i=e.alpha*(t.x-e.lambda0),o=Math.cos(n),s=Math.asin(Math.cos(e.b0)*Math.sin(n)-Math.sin(e.b0)*o*Math.cos(i)),a=Math.asin(o*Math.sin(i)/Math.cos(s));return t.x=e.x0+e.R*a,t.y=e.y0+e.R*Math.log(Math.tan(Math.PI/4+s/2)),t}function nI(e,t){let r=(t.x-e.x0)/e.R,n=2*(Math.atan(Math.exp((t.y-e.y0)/e.R))-Math.PI/4),i=Math.asin(Math.cos(e.b0)*Math.sin(n)+Math.sin(e.b0)*Math.cos(n)*Math.cos(r)),o=Math.asin(Math.cos(n)*Math.sin(r)/Math.cos(i)),s=(e.K-Math.log(Math.tan(Math.PI/4+i/2)))/e.alpha;for(let a=0;a<6;a++){let c=e.e*Math.sin(i),l=(s+Math.log(Math.tan(Math.PI/4+i/2))-e.e/2*Math.log((1+c)/(1-c)))*(1-c*c)*Math.cos(i)/(1-e.es);if(i-=l,Math.abs(l)<1e-10)return t.x=e.lambda0+o/e.alpha,t.y=i,t}return null}function iI(e,t={}){let r={...e,lambda0:0,rf:0,R:0,alpha:0,b0:0,K:0,...t};return kO(r),r}var Ly={name:"somerc",aliases:[],parameters:["lon_0","x_0","y_0","lat_0","k","k_0"],create(e){let t=vt(e),r=iI(t,{rf:t.a===t.b?1/0:1/(1-t.b/t.a)}),n=Et("somerc",e,r,rI,nI);return Pt(n,K(t.long0-Math.PI/18,Math.max(-Math.PI/2+1e-8,t.lat0-Math.PI/18),t.long0+Math.PI/18,Math.min(Math.PI/2-1e-8,t.lat0+Math.PI/18)),i=>kE(Pe(r,e),i),t.primeMeridian,t.over)}};Qo();ts();Ae();ga();var _r={N_POLE:0,S_POLE:1,EQUIT:2,OBLIQ:3};function qO(e){if(Math.abs(Math.abs(e.lat0)-U)<1e-10?e.mode=e.lat0<0?_r.S_POLE:_r.N_POLE:Math.abs(e.lat0)<1e-10?e.mode=_r.EQUIT:(e.mode=_r.OBLIQ,e.sinph0=Math.sin(e.lat0),e.cosph0=Math.cos(e.lat0)),e.pn1=e.h/e.a,e.pn1<=0||e.pn1>1e10)throw new Error("Invalid height");e.p=1+e.pn1,e.rp=1/e.p,e.h1=1/e.pn1,e.pfact=(e.p+1)*e.h1,e.es=0;var t=e.tilt,r=e.azi;e.cg=Math.cos(r),e.sg=Math.sin(r),e.cw=Math.cos(t),e.sw=Math.sin(t)}function oI(e,t){t.x-=e.long0;var r=Math.sin(t.y),n=Math.cos(t.y),i=Math.cos(t.x),o,s;switch(e.mode){case _r.OBLIQ:s=e.sinph0*r+e.cosph0*n*i;break;case _r.EQUIT:s=n*i;break;case _r.S_POLE:s=-r;break;case _r.N_POLE:s=r;break}switch(s=e.pn1/(e.p-s),o=s*n*Math.sin(t.x),e.mode){case _r.OBLIQ:s*=e.cosph0*r-e.sinph0*n*i;break;case _r.EQUIT:s*=r;break;case _r.N_POLE:s*=-(n*i);break;case _r.S_POLE:s*=n*i;break}var a,c;return a=s*e.cg+o*e.sg,c=1/(a*e.sw*e.h1+e.cw),o=(o*e.cg-s*e.sg)*e.cw*c,s=a*c,t.x=o*e.a,t.y=s*e.a,t}function sI(e,t){t.x/=e.a,t.y/=e.a;var r=t.x,n=t.y,i,o,s;s=1/(e.pn1-t.y*e.sw),i=e.pn1*t.x*s,o=e.pn1*t.y*e.cw*s,t.x=i*e.cg+o*e.sg,t.y=o*e.cg-i*e.sg;var a=qe(t.x,t.y);if(Math.abs(a)<1e-10)r=0,n=e.lat0;else{var c,l;switch(l=1-a*a*e.pfact,l=(e.p-Math.sqrt(l))/(e.pn1/a+a/e.pn1),c=Math.sqrt(1-l*l),e.mode){case _r.OBLIQ:n=Math.asin(c*e.sinph0+t.y*l*e.cosph0/a),t.y=(c-e.sinph0*Math.sin(n))*a,t.x*=l*e.cosph0;break;case _r.EQUIT:n=Math.asin(t.y*l/a),t.y=c*a,t.x*=l;break;case _r.N_POLE:n=Math.asin(c),t.y=-t.y;break;case _r.S_POLE:n=-Math.asin(c);break}r=Math.atan2(t.x,t.y)}return t.x=r+e.long0,t.y=n,t}function aI(e,t={}){let r={...e,mode:0,sinph0:0,cosph0:0,pn1:0,h:0,p:0,rp:0,h1:0,pfact:0,tilt:0,azi:0,cg:0,sg:0,cw:0,sw:0,...t};return qO(r),r}Ee();var Dy={name:"tpers",aliases:["Tilted_Perspective"],parameters:["lon_0","x_0","y_0","lat_0","h","tilt","azi"],create(e){let t=vt(e),r=tt(e.parameters,"h",1e5),n=tt(e.parameters,"tilt",0)*Math.PI/180,i=tt(e.parameters,"azi",0)*Math.PI/180;if(Math.abs(n)>=Math.PI/2)throw new Error("Perspective tilt must be between -90 and 90 degrees");let o=aI(t,{h:r,tilt:n,azi:i}),s=1+r/t.a,a=Math.acos(1/s),c=Math.abs(n),l=s*Math.cos(c)<1?c-Math.acos(s*Math.cos(c)):a,h=Math.min(a,l)*(1-1e-10);return rn(Et("tpers",e,o,oI,sI,ss(t,1/(1+r/t.a))),t,h,(u,f)=>Ex(Pe(t,e),s,n,i,u,f),a)}};Ie();Ht();ne();ue();Ae();function jO(e){e.R=e.a}function cI(e,t){var r=t.x,n=t.y,i=G(r-e.long0,e.over),o,s;if(Math.abs(n)<=1e-10)return o=e.x0+e.R*i,s=e.y0,t.x=o,t.y=s,t;var a=Ia(2*Math.abs(n/Math.PI));if(Math.abs(i)<=1e-10||Math.abs(Math.abs(n)-U)<=1e-10)return o=e.x0,n>=0?s=e.y0+Math.PI*e.R*Math.tan(.5*a):s=e.y0+Math.PI*e.R*-Math.tan(.5*a),t.x=o,t.y=s,t;var c=.5*Math.abs(Math.PI/i-i/Math.PI),l=c*c,h=Math.sin(a),u=Math.cos(a),f=u/(h-2*Math.sin(a/2)**2),d=f*f,m=f*(2/h-1),p=m*m,g=Math.sqrt(l*(f-p)*(f-p)-(p+l)*(d-p)),y=Math.PI*e.R*(p-d)/(g-c*(f-p));i<0&&(y=-y),o=e.x0+y;var _=l+f;return y=Math.PI*e.R*(l*(2*f-1)+d)/(m*_+c*Math.sqrt((p+l)*(l+1)-_*_)),n>=0?s=e.y0+y:s=e.y0-y,t.x=o,t.y=s,t}function lI(e,t){var r,n,i,o,s,a,c,l,h,u,f,d,m;return t.x-=e.x0,t.y-=e.y0,Math.abs(t.y)<1e-10?(t.x=G(e.long0+t.x/e.R,e.over),t.y=0,t):(f=Math.PI*e.R,i=t.x/f,o=t.y/f,s=i*i+o*o,a=-Math.abs(o)*(1+s),c=a-2*o*o+i*i,l=-2*a+1+2*o*o+s*s,m=o*o/l+(2*c*c*c/l/l/l-9*a*c/l/l)/27,h=(a-c*c/3/l)/l,u=2*Math.sqrt(-h/3),f=3*m/h/u,Math.abs(f)>1&&(f>=0?f=1:f=-1),d=Math.acos(f)/3,t.y>=0?n=(-u*Math.cos(d+Math.PI/3)-c/3/l)*Math.PI:n=-(-u*Math.cos(d+Math.PI/3)-c/3/l)*Math.PI,Math.abs(i)<1e-10?r=e.long0:r=G(e.long0+2*Math.PI*i/(Math.sqrt(1+2*(i*i-o*o)+s*s)+1-s),e.over),t.x=r,t.y=n,t)}function hI(e,t={}){let r={...e,R:0,...t};return jO(r),r}var Fy={name:"vandg",aliases:["Van_der_Grinten_I","VanDerGrinten","Van_der_Grinten"],parameters:["lon_0","x_0","y_0"],create(e){let t=vt(e),r=hI(t),n=Et("vandg",e,r,cI,lI);return Pt(n,K(t.long0-Math.PI,-Math.PI/2,t.long0+Math.PI,Math.PI/2),i=>Yb(n.forward,i,t.long0,t.over),t.primeMeridian,t.over)}};ma();Ee();da();ne();Ht();wa();var uI=["o_proj","o_alpha","o_lon_c","o_lat_c","o_lon_p","o_lat_p","o_lon_1","o_lat_1","o_lon_2","o_lat_2"],Uy=e=>e.toLowerCase().replace(/[ _-]/g,""),Gy=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),li=(e,t)=>tt(e,t,0)*Math.PI/180;function WO(e){let t=[["o_alpha","o_lon_c","o_lat_c"],["o_lat_p","o_lon_p"],["o_lon_1","o_lat_1","o_lon_2","o_lat_2"]],r=t.find(c=>c.some(l=>Gy(e,l)));if(!r)throw new Error("Oblique transformation requires a rotation parameter set");for(let c of r){if(!Gy(e,c))throw new Error("Oblique transformation requires "+c);if(c.includes("lat")&&Math.abs(li(e,c))>Math.PI/2)throw new Error("Invalid rotation latitude: "+c)}if(r===t[0]){let c=li(e,"o_alpha"),l=li(e,"o_lon_c"),h=li(e,"o_lat_c");if(Math.abs(h)>=Math.PI/2-1e-10)throw new Error("Rotation center must be away from the poles");return{lamp:l+Math.atan2(-Math.cos(c),-Math.sin(c)*Math.sin(h)),phip:Math.asin(Math.cos(h)*Math.sin(c))}}if(r===t[1])return{lamp:li(e,"o_lon_p"),phip:li(e,"o_lat_p")};let n=li(e,"o_lon_1"),i=li(e,"o_lat_1"),o=li(e,"o_lon_2"),s=li(e,"o_lat_2");if(Math.abs(i)>=Math.PI/2-1e-10||Math.abs(s)>=Math.PI/2-1e-10||Math.abs(i)<1e-10||Math.abs(i-s)<1e-10)throw new Error("Invalid new-equator reference points");let a=Math.atan2(Math.cos(i)*Math.sin(s)*Math.cos(n)-Math.sin(i)*Math.cos(s)*Math.cos(o),Math.sin(i)*Math.cos(s)*Math.sin(o)-Math.cos(i)*Math.sin(s)*Math.sin(n));return{lamp:a,phip:Math.atan(-Math.cos(a-n)/Math.tan(i))}}function gm(e){let t=e==="longlat";if(!t&&["obtran","geocent"].includes(Uy(e.name)))throw new Error("Cannot wrap a composite or geocentric projection");return{name:"ob_tran",aliases:["General Oblique Transformation","General_Oblique_Transformation"],parameters:[...uI,"lon_0",...t?[]:e.parameters],flags:t?[]:e.flags,create(r){let{parameters:n}=r,i=n.o_proj,o=t?["longlat","latlong","lonlat","latlon","identity"]:[e.name,...e.aliases||[]];if(i&&!o.map(Uy).includes(Uy(i)))throw new xn("missing-plugin","Oblique transformation dependency does not match +o_proj="+i);let{lamp:s,phip:a}=WO(n),c=Math.cos(a),l=Math.sin(a),h=Math.abs(a)>1e-10,u=li(n,"lon_0"),f=Gy(n,"over"),d={...n,proj:t?"longlat":i||e.name,lon_0:"0"};for(let S of uI)delete d[S];let m=t?qn(S=>{S.x*=180/Math.PI,S.y*=180/Math.PI},S=>{S.x*=Math.PI/180,S.y*=Math.PI/180}):e.create({...r,parameters:Object.freeze(d),primeMeridian:0}),p=oo(m,!1),g=oo(m,!0),y=S=>Math.asin(Math.max(-1,Math.min(1,S))),_=S=>{let E=S.x,N=S.y,B=ve(E-u,f),C=Math.cos(B),R=Math.sin(N),W=Math.cos(N),j=ve(Math.atan2(W*Math.sin(B),h?l*W*C+c*R:R)+s),A=y(h?l*R-c*W*C:-W*C);S.x=j,S.y=A},M=S=>{let E=S.x,N=S.y,B=E-s,C=Math.cos(B),R=Math.sin(N),W=Math.cos(N),j=Math.atan2(W*Math.sin(B),h?l*W*C-c*R:-R),A=y(h?l*R+c*W*C:W*C);S.x=ve(j+u),S.y=A},b=qn(S=>{_(S),p(S)},S=>{g(S),M(S)}),v=t?is(d):m.getRenderingProfile?.bind(m);if(!v)return b;let T=(S,E)=>{let N=E&&Ke(()=>S.bounds,E,u,r.primeMeridian??0,f),B=Wo(C=>{let R=C.x,W=C.y;_(C);let j=C.x*180/Math.PI,A=C.y*180/Math.PI,P={x:j,y:A,z:C.z};if(S.normalize?.(P),P.x===j&&P.y===A){C.x=R,C.y=W;return}C.x=P.x*Math.PI/180,C.y=P.y*Math.PI/180,M(C),f&&(C.x+=Math.round((R-C.x)/(2*Math.PI))*2*Math.PI)},r.primeMeridian??0);return{get bounds(){let C=S.bounds,R=W=>[W[0]*180/Math.PI,W[1]*180/Math.PI,W[2]];return t?[R(C[0]),R(C[1])]:C},normalize(C){N?.normalize(C),B(C)}}};return{...b,longitudeOrigin:u,getRenderingProfile(S){if(!S)return T(v());let E=jo(S,r.primeMeridian??0,u),N=K(E[0][0]-u,E[0][1],E[1][0]-u,E[1][1]),B=se(h?[-c,0,l]:[-1,0,0],N),C=h?[l,0,c]:[0,0,1],W=se(C,N)[0]>0?Jo([0,1,0],C,0,N).map(Math.atan):[-Math.PI,Math.PI];return T(v(gn(K(W[0]+s,y(B[0]),W[1]+s,y(B[1])))),S)}}}}}Nc();Ng();Ee();function be(e){if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Expected a CRS object");return e}function Yh(e){return Array.isArray(e)?e:[]}function Mr(e){return String(e||"").toLowerCase().replace(/[^a-z0-9]/g,"")}function cr(e){if(typeof e!="number"||!Number.isFinite(e))throw new Error("Expected a finite CRS parameter");return e}function sn(e,t){if(e===void 0)return t;if(typeof e=="object"){let i=cr(be(e).conversion_factor);if(i<=0)throw new Error("Unit conversion factor must be positive");return i}let n={metre:1,meter:1,degree:Me,radian:1,grad:Math.PI/200,gon:Math.PI/200,foot:.3048,ussurveyfoot:1200/3937,kilometre:1e3,arcsecond:Me/3600,partspermillion:1e-6,unity:1}[Mr(e)];return n||Bt("Unsupported CRS unit: "+String(e)),n}var HO={hotineobliquemercator:"omerc",hotineobliquemercatorvarianta:"omerc",hotineobliquemercatorvariantb:"omerc",hotineobliquemercatorazimuthnaturalorigin:"omerc",hotineobliquemercatorazimuthcenter:"omerc",obliquemercator:"omerc",krovak:"krovak",krovaknorthorientated:"krovak",quadrilateralizedsphericalcube:"qsc",transversemercator:"tmerc",transversemercatorsouthorientated:"unsupported-south-tmerc",mercator:"merc",mercator1sp:"merc",mercator2sp:"merc",mercatorvarianta:"merc",mercatorvariantb:"merc",mercatorauxiliarysphere:"webmerc",popularvisualisationpseudomercator:"webmerc",lambertconformalconic:"lcc",lambertconformalconic1sp:"lcc",lambertconformalconic2sp:"lcc",lambertconicconformal1sp:"lcc",lambertconicconformal2sp:"lcc",albers:"aea",albersconicequalarea:"aea",albersequalarea:"aea",equidistantconic:"eqdc",lambertazimuthalequalarea:"laea",stereographic:"stere",stereographicnorthpole:"sterea",stereographicsouthpole:"stere",polarstereographic:"stere",polarstereographicvarianta:"stere",polarstereographicvariantb:"stere",obliquestereographic:"sterea",doublestereographic:"sterea",azimuthalequidistant:"aeqd",modifiedazimuthalequidistant:"aeqd",equidistantcylindrical:"eqc",equidistantcylindricalspherical:"eqc",equirectangular:"eqc",platecarree:"eqc",bonne:"bonne",cassinisoldner:"cass",cassini:"cass",cylindricalequalarea:"cea",lambertcylindricalequalarea:"cea",eckertvi:"eck6",equalearth:"eqearth",millercylindrical:"mill",mollweide:"moll",robinson:"robin",sinusoidal:"sinu",vandergrinten:"vandg",vandergrinteni:"vandg",gnomonic:"gnom",orthographic:"ortho",polyconic:"poly",americanpolyconic:"poly",newzealandmapgrid:"nzmg",gaussschreibertransversemercator:"gstmerc"},$O={centralmeridian:"lon_0",longitudeoforigin:"lon_0",longitudeofcenter:"lon_0",longitudeofnaturalorigin:"lon_0",longitudeoffalseorigin:"lon_0",longitudeofprojectioncentre:"lon_0",straightverticalpolelongitude:"lon_0",longitudeoforiginmeridian:"lon_0",latitudeoforigin:"lat_0",latitudeofcenter:"lat_0",latitudeofnaturalorigin:"lat_0",latitudeoffalseorigin:"lat_0",latitudeofprojectioncentre:"lat_0",standardparallel1:"lat_1",latitudeof1ststandardparallel:"lat_1",standardparallel2:"lat_2",latitudeof2ndstandardparallel:"lat_2",latitudeofstandardparallel:"lat_ts",scalefactor:"k_0",scalefactoratnaturalorigin:"k_0",scalefactoratprojectionorigin:"k_0",falseeasting:"x_0",falsenorthing:"y_0",eastingatfalseorigin:"x_0",northingatfalseorigin:"y_0"},YO={omerc:{longitudeofcenter:"lonc",longitudeofprojectioncentre:"lonc",azimuth:"alpha",azimuthatprojectioncentre:"alpha",rectifiedgridangle:"gamma",anglefromrectifiedtoskewgrid:"gamma",scalefactoratprojectioncentre:"k_0",eastingatprojectioncentre:"x_0",northingatprojectioncentre:"y_0"},krovak:{azimuth:"alpha",colatitudeofconeaxis:"alpha",pseudostandardparallel1:"lat_ts",latitudeofpseudostandardparallel:"lat_ts",scalefactoronpseudostandardparallel:"k_0"}},KO={east:"e",west:"w",north:"n",south:"s",up:"u",down:"d",geocentricx:"e",geocentricy:"n",geocentricz:"u"};function Ra(e,t){let r=String(e.type),n=XO(e.bbox);if(r==="CompoundCRS"){t.mode!=="horizontal"&&Bt("CompoundCRS requires explicit horizontal extraction");let E=Yh(e.components).map(be).filter(B=>["ProjectedCRS","GeographicCRS","GeodeticCRS","BoundCRS"].includes(String(B.type)));if(E.length!==1)throw new Error("CompoundCRS requires exactly one horizontal component");let N=Ra(E[0],t);return{...N,areaOfUse:n??N.areaOfUse,lossy:!0}}if(r==="BoundCRS"){let E=Ra(be(e.source_crs),t),N=Ra(be(e.target_crs),t);(N.parameters.datum!=="WGS84"||!["longlat","geocent"].includes(N.parameters.proj)||Number(N.parameters.pm||0)!==0||N.parameters.towgs84||Number(N.parameters.a)!==6378137||!(Math.abs(Number(N.parameters.rf)-298.257223563)<=1e-9||Math.abs(Number(N.parameters.b)-6356752314245179e-9)<=1e-6))&&Bt("BoundCRS requires a WGS84 target");let B=be(e.transformation),C=Mr(be(B.method).name),R=C==="geocentrictranslations"||/^geocentrictranslationsgeog[23]ddomain$/.test(C),W=/^positionvector(?:transformation)?(?:geog[23]ddomain|geocentricdomain)?$/.test(C),j=/^coordinateframe(?:rotation)?(?:geog[23]ddomain|geocentricdomain)?$/.test(C);!R&&!W&&!j&&Bt("Unsupported BoundCRS transformation: "+C);let A=["xaxistranslation","yaxistranslation","zaxistranslation","xaxisrotation","yaxisrotation","zaxisrotation","scaledifference"],P=new Array(R?3:7).fill(void 0);for(let F of Yh(B.parameters)){let L=be(F),O=A.indexOf(Mr(L.name));(O<0||O>=P.length||P[O]!==void 0)&&Bt("Unsupported or duplicate Helmert parameter: "+String(L.name));let V=O<3?1:O<6?Me/3600:1e-6;P[O]=cr(L.value)*sn(L.unit,V)/V*(j&&O>=3&&O<6?-1:1)}if(P.some(F=>F===void 0))throw new Error("Incomplete BoundCRS Helmert transformation");let D={...E.parameters,towgs84:P.join(",")};return delete D.datum,{...E,parameters:D,areaOfUse:n??E.areaOfUse}}["ProjectedCRS","GeographicCRS","GeodeticCRS"].includes(r)||Bt("Unsupported CRS type: "+r);let i=r==="ProjectedCRS"?be(e.base_crs):e,o=be(i.datum||i.datum_ensemble);(o.type==="DynamicGeodeticReferenceFrame"||o.frame_reference_epoch!==void 0||e.coordinate_epoch!==void 0)&&Bt("Time-dependent datum transformations are not implemented");let s=be(o.ellipsoid),a=cr(s.semi_major_axis??s.radius),c={proj:"longlat",a:String(a*sn(s.unit,1))};if(s.inverse_flattening!==void 0)c.rf=String(cr(s.inverse_flattening));else if(s.semi_minor_axis!==void 0)c.b=String(cr(s.semi_minor_axis)*sn(s.unit,1));else if(s.radius!==void 0)c.b=c.a;else throw new Error("Ellipsoid requires inverse flattening or semi-minor axis");let l=Zc(t),h=String(o.name||""),u=Mr(h),f=Object.keys(l),d=f.find(E=>Ta(E)===Ta(h)),m=d?[d]:f.filter(E=>Mr(E)===u||Mr(E)===u.replace(/^d/,"")),p=m[0],g=l[p];if(g&&m.some(E=>{let N=l[E];return N.ellipse!==g.ellipse||N.towgs84!==g.towgs84||N.nadgrids!==g.nadgrids}))throw new Error("Ambiguous structured datum name: "+h);if(u&&(c.datum=p||h),p&&Ta(p)==="wgs84"&&(c.datum="WGS84"),p&&["nad83","northamericandatum1983"].includes(Ta(p))&&(c.datum="NAD83"),!p){["wgs84","worldgeodeticsystem1984","worldgeodeticsystem1984ensemble","dwgs1984","wgs1984"].includes(u)&&(c.datum="WGS84"),["nad83","northamericandatum1983","dnorthamerican1983"].includes(u)&&(c.datum="NAD83"),["nad27","northamericandatum1927","dnorthamerican1927"].includes(u)&&(c.datum="NAD27");let N={newzealand1949:"nzgd49",belge1972:"rnb72"}[u.replace(/^d/,"")];N&&(c.datum=N)}if(r==="ProjectedCRS"&&i.id){let E=be(i.id),N=String(E.authority)+"_"+String(E.code);Object.prototype.hasOwnProperty.call(l,N)&&(c.datum=N)}o.towgs84!==void 0&&(c.towgs84=Yh(o.towgs84).map(cr).join(","),delete c.datum);let y=e.coordinate_system?be(e.coordinate_system):{},_=Yh(y.axis).map(be),M=Mr(y.subtype)==="cartesian"&&r==="GeodeticCRS";r!=="ProjectedCRS"&&!M&&y.subtype&&Mr(y.subtype)!=="ellipsoidal"&&Bt("Unsupported coordinate system subtype"),M&&(c.proj="geocent");let b=sn(i.angular_unit,Me),v=sn(_[0]?.unit,r==="ProjectedCRS"||M?1:b);_[1]&&sn(_[1].unit,v)!==v&&Bt("Mixed horizontal axis units are not supported"),M&&_[2]&&sn(_[2].unit,v)!==v&&Bt("Mixed geocentric axis units are not supported");let T=i.prime_meridian||o.prime_meridian;if(T){let E=be(T);c.pm=String(cr(E.longitude)*sn(E.unit,b)/Me)}if(r==="ProjectedCRS"){let E=be(e.conversion),N=Mr(be(E.method).name),B=Yh(E.parameters).map(be),C=N==="stereographicnorthpole"&&!B.some(A=>Mr(A.name).startsWith("scalefactor")),R=C?"stere":HO[N],W=B.filter(A=>["xscale","yscale","xyplanerotation"].includes(Mr(A.name)));if(W.length){let A={xscale:-1,yscale:1,xyplanerotation:90};(R!=="krovak"||W.length!==3||new Set(W.map(P=>Mr(P.name))).size!==3||W.some(P=>{let D=Mr(P.name),F=D==="xyplanerotation"?sn(P.unit,b)/Me:sn(P.unit,1);return Math.abs(cr(P.value)*F-A[D])>1e-10}))&&Bt("Unsupported ESRI Krovak axis adjustment")}(!R||R.startsWith("unsupported"))&&Bt("Unsupported projection method: "+String(be(E.method).name)),c.proj=R==="webmerc"?"merc":R;let j=!1;for(let A of B){let P=Mr(A.name);if(W.includes(A)||P==="auxiliaryspheretype"&&R==="webmerc"&&A.value===0)continue;if(P==="semiminor"&&R==="webmerc"){if(j)throw new Error("Duplicate conversion parameter: semi_minor");j=!0;let V=cr(A.value)*sn(A.unit,1);Math.abs(V-Number(c.a))>4*Number.EPSILON*Number(c.a)&&Bt("Pseudo-Mercator semi_minor must equal the semi-major axis");continue}let D=YO[R]?.[P]||$O[P];if(D||Bt("Unsupported conversion parameter: "+String(A.name)),D==="lat_1"&&N==="stereographicnorthpole"&&!C?D="lat_0":D==="lat_1"&&["merc","webmerc","eqc","stere","cea"].includes(R)&&(D="lat_ts"),c[D]!==void 0)throw new Error("Duplicate conversion parameter: "+D);if(["merc","webmerc"].includes(R)&&D==="lat_0"&&A.value===0)continue;let F=D.startsWith("lat")||D.startsWith("lon")||D==="alpha"||D==="gamma",L=D==="x_0"||D==="y_0",O=cr(A.value)*sn(A.unit,F?b:L?v:1)/(F?Me:1);D.startsWith("lat")&&Math.abs(Math.abs(O)-90)<=4*Number.EPSILON*90&&(O=Math.sign(O)*90),c[D]=String(O)}if(R==="omerc"&&["hotineobliquemercator","hotineobliquemercatorvarianta","hotineobliquemercatorazimuthnaturalorigin"].includes(N)&&(c.no_uoff=void 0),R==="omerc"&&c.lon_0!==void 0&&c.lonc!==void 0&&(Math.abs(Number(c.lon_0)-Number(c.lonc))>1e-10&&Bt("Oblique Mercator central meridian conflicts with projection centre"),delete c.lon_0),N==="stereographicnorthpole"&&Math.abs(Number(c.lat_0))===90&&(c.proj="stere"),R==="lcc"&&c.lat_1===void 0&&(c.lat_1=c.lat_0),N==="polarstereographic"&&c.lat_0!==void 0){if(c.lat_ts!==void 0)throw new Error("Duplicate polar stereographic latitude of true scale");c.lat_ts=c.lat_0,delete c.lat_0}R==="stere"&&(N.includes("polar")||N==="stereographicsouthpole"||C)&&c.lat_0===void 0&&(c.lat_0=Number(c.lat_ts||90)<0?"-90":"90"),R==="webmerc"&&(c.b=c.a,delete c.rf,c.nadgrids="@null")}let S=_.map(E=>ZO(E,c,r==="ProjectedCRS")).join("");return S.length===2&&(S+="u"),!M&&/[ud]/.test(S.slice(0,2))&&Bt("Structured CRS vertical-first axes require an explicit PROJ axis definition"),S&&(c.axis=S),(r==="ProjectedCRS"||M)&&(c.to_meter=String(v)),{parameters:c,areaOfUse:n,angularUnit:r==="ProjectedCRS"||M?b:v,verticalUnit:M?1:sn(_[2]?.unit,1)}}function XO(e){let t;if(e!==void 0){let r=be(e),n=cr(r.west_longitude),i=cr(r.south_latitude),o=cr(r.east_longitude),s=cr(r.north_latitude);if(n<-180||n>180||o<-180||o>180||i<-90||s>90||i>=s||n===o)throw new Error("Invalid CRS geographic bounding box");t=[n,i,o,s]}return t}function ZO(e,t,r){let n=String(e.direction),i=e.meridian,o=/^(north|south) along ([+-]?(?:\d+(?:\.\d*)?|\.\d+)) deg(?: (east|west))?$/i.exec(n);if(o){if(i!==void 0)throw new Error("Duplicate axis meridian");n=o[1],i={longitude:Number(o[2])*(o[3]?.toLowerCase()==="west"?-1:1)}}if(i!==void 0){let a=Number(t.lat_0),c=a===90;(!r||t.proj!=="stere"||Math.abs(a)!==90||Mr(n)!==(c?"south":"north"))&&Bt("Axis meridians require an outward-facing polar stereographic axis");let l=be(i).longitude,h=typeof l=="number"?cr(l):cr(be(l).value)*sn(be(l).unit,Me)/Me,u=cr((h-Number(t.lon_0||0))/90);Math.abs(u-Math.round(u))>1e-12&&Bt("Non-cardinal axis meridians require an orientation operation");let f=(Math.round(u)%4+4)%4;return(c?"senw":"nesw")[f]}let s=KO[Mr(n)];return s||Bt("Unsupported axis direction: "+n),s}function ym(e,...t){return e.values.filter(r=>r.type==="node"&&t.includes(r.keyword.toUpperCase()))}function de(e,...t){return ym(e,...t)[0]}function le(e,t=0){let r=e.values[t];return r&&r.type!=="node"?r.value:void 0}function Ca(e){return e?{name:le(e),conversion_factor:le(e,1)}:void 0}function JO(e,t){let r=le(e,1);if(t&&String(r).toLowerCase()==="unknown"){let n=String(le(e)).toLowerCase(),i=/^(easting|northing|westing|southing)(?:\s*\([a-z]\))?$/.exec(n);if(i)return{easting:"east",northing:"north",westing:"west",southing:"south"}[i[1]]}return r}function QO(e){let t=de(e,"MERIDIAN");if(t)return{longitude:{value:le(t),unit:Ca(de(t,"ANGLEUNIT"))}}}function fI(e){let t=de(e,"METHOD","PROJECTION");if(!t)throw new Error("WKT conversion requires a METHOD or PROJECTION");return de(e,"PARAMETERFILE")&&Bt("Grid-based WKT operation is not implemented"),{method:{name:le(t)},parameters:ym(e,"PARAMETER").map(r=>({name:le(r),value:le(r,1),unit:Ca(de(r,"ANGLEUNIT","LENGTHUNIT","SCALEUNIT"))}))}}function Kh(e){let t=e.keyword.toUpperCase();if(t==="COMPD_CS"||t==="COMPOUNDCRS")return{type:"CompoundCRS",components:ym(e,"PROJCS","PROJCRS","GEOGCS","GEOGCRS","GEODCRS","BOUNDCRS","VERT_CS","VERTCRS").map(Kh)};if(t==="BOUNDCRS"){let f=de(e,"SOURCECRS"),d=de(e,"TARGETCRS"),m=de(e,"ABRIDGEDTRANSFORMATION");if(!f||!d||!m)throw new Error("Incomplete WKT BoundCRS");let p=_=>{let M=_.values.find(b=>b.type==="node");if(!M)throw new Error("Missing bound CRS component");return M},g=fI(m),y=g.parameters;for(let _ of y)String(_.name).toLowerCase()==="scale difference"&&_.unit===void 0&&(_.value=(Number(_.value)-1)*1e6);return{type:"BoundCRS",source_crs:Kh(p(f)),target_crs:Kh(p(d)),transformation:g}}if(["VERT_CS","VERTCRS"].includes(t))return{type:"VerticalCRS"};let r=["PROJCS","PROJCRS","PROJECTEDCRS"].includes(t),n=["GEOGCS","GEOGCRS","GEODCRS","GEODETICCRS","GEOGRAPHICCRS","BASEGEOGCRS","BASEGEODCRS","GEOCCS"].includes(t);!r&&!n&&Bt("Unsupported WKT CRS: "+t),de(e,"DYNAMIC","DERIVINGCONVERSION","VELOCITYGRID","EXTENSION")&&Bt("Unsupported WKT dynamic/extension operation");let i=de(e,"CS"),o=t==="GEOCCS"||String(le(i||e)).toLowerCase()==="cartesian"&&!r,s=de(e,r||o?"LENGTHUNIT":"ANGLEUNIT","UNIT"),a=ym(e,"AXIS").sort((f,d)=>Number(le(de(f,"ORDER")||f))-Number(le(de(d,"ORDER")||d))).map((f,d)=>({name:le(f),direction:t==="GEOCCS"?["geocentricX","geocentricY","geocentricZ"][d]:JO(f,r),unit:Ca(de(f,"ANGLEUNIT","LENGTHUNIT")||(!o&&!r&&/^(up|down)$/i.test(String(le(f,1)))?void 0:s)),meridian:QO(f)}));if(!a.length)for(let f of o?["geocentricX","geocentricY","geocentricZ"]:["east","north"])a.push({name:f,direction:f,unit:Ca(s),meridian:void 0});let c=t==="GEOGCS"?void 0:de(e,"ID"),l={type:r?"ProjectedCRS":o?"GeodeticCRS":"GeographicCRS",name:le(e),id:c?{authority:le(c),code:le(c,1)}:void 0,coordinate_system:{subtype:r||o?"Cartesian":"ellipsoidal",axis:a}},h=de(e,"USAGE"),u=de(h||e,"BBOX");if(u&&(l.bbox={south_latitude:le(u,0),west_longitude:le(u,1),north_latitude:le(u,2),east_longitude:le(u,3)}),r){let f=de(e,"GEOGCS","BASEGEOGCRS","BASEGEODCRS","GEODCRS","GEOGCRS");if(!f)throw new Error("Projected WKT requires a base geographic CRS");l.base_crs=Kh(f),l.conversion=fI(de(e,"CONVERSION")||e)}else{let f=de(e,"DATUM","GEODETICDATUM","ENSEMBLE");if(!f)throw new Error("WKT requires a geodetic datum");de(f,"EXTENSION","DYNAMIC")&&Bt("Unsupported datum extension");let d=de(f,"SPHEROID","ELLIPSOID");if(!d)throw new Error("WKT datum requires an ellipsoid");let m=de(f,"TOWGS84");l.datum={name:le(f),ellipsoid:{name:le(d),semi_major_axis:le(d,1),inverse_flattening:le(d,2),unit:Ca(de(d,"LENGTHUNIT"))},towgs84:m?.values.map((g,y)=>le(m,y))};let p=de(e,"PRIMEM");p&&(l.prime_meridian={name:le(p),longitude:le(p,1),unit:Ca(de(p,"ANGLEUNIT")||(o?void 0:s))}),l.angular_unit=o?void 0:Ca(s)}return l}var zy={name:"wkt",canParse:e=>tr(e)==="wkt",parse(e,t){if(typeof e!="string")throw new Error("Expected serialized WKT");return Ra(Kh(mh(e).root),t)}};Nc();var Vy={name:"projjson",canParse:e=>tr(e)==="projjson",parse:(e,t)=>Ra(be(e),t)};Ee();var ky=1e-12;function wm(e,t,r,n,i=!1){let o=(t-e.origin[0])/e.step[0],s=(r-e.origin[1])/e.step[1],a=e.size[0],c=e.size[1];if(!i&&(o<-1e-10||s<-1e-10||o>a-1+1e-10||s>c-1+1e-10))return!1;o=Math.max(0,Math.min(a-1,o)),s=Math.max(0,Math.min(c-1,s));let l=Math.min(a-2,Math.floor(o)),h=Math.min(c-2,Math.floor(s)),u=o-l,f=s-h,d=0,m=0;for(let p=0;p<4;p++){let g=p%2,y=p>1,_=(g?u:1-u)*(y?f:1-f);if(_===0)continue;let M=((h+(y?1:0))*a+l+g)*2,b=e.shifts[M],v=e.shifts[M+1];if(!Number.isFinite(b)||!Number.isFinite(v))return!1;d+=_*b,m+=_*v}return n.x=d,n.y=m,!0}function tB(e,t,r,n,i){if(!n)return wm(e,t,r,i)?(i.x+=t,i.y+=r,!0):!1;for(let a=0;a<2;a++){let c=a===0?t:r;if(c<e.origin[a]-e.maxShift[a]-ky||c>e.origin[a]+(e.size[a]-1)*e.step[a]+e.maxShift[a]+ky)return!1}if(!wm(e,t,r,i,!0))return!1;let o=t-i.x,s=r-i.y;for(let a=0;a<20;a++){if(!wm(e,o,s,i,!0))return!1;let c=t-o-i.x,l=r-s-i.y;if(o+=c,s+=l,Math.max(Math.abs(c),Math.abs(l))<=ky)return wm(e,o,s,i)?(i.x=ve(o),i.y=s,!0):!1}throw new Error("Inverse datum grid shift did not converge")}function dI(e){if(!e.length)throw new Error("Datum grid requires at least one subgrid");let t=e.map(i=>{let[o,s]=i.size;if(![o,s].every(c=>Number.isSafeInteger(c)&&c>=2)||o*s*2!==i.shifts.length||!i.origin.every(Number.isFinite)||!i.step.every(c=>Number.isFinite(c)&&c>0))throw new Error("Invalid datum subgrid geometry or node count");let a=[0,0];for(let c=0;c<i.shifts.length;c++){let l=i.shifts[c];Number.isFinite(l)&&(a[c%2]=Math.max(a[c%2],Math.abs(l)))}return{...i,maxShift:a}}),r=(i,o)=>{let s=i.x,a=i.y;if(!Number.isFinite(s)||!Number.isFinite(a))throw new Error("Grid coordinates must be finite");for(let c of t)if(tB(c,-s,a,o,i))return i.x=-i.x,!0;return i.x=s,i.y=a,!1},n={x:NaN,y:NaN};return Object.freeze({subgridCount:t.length,shiftInPlace:r,shift(i,o,s){return n.x=i,n.y=o,r(n,s)?[n.x,n.y]:void 0}})}var cl=Math.PI/648e3;function qy(e,t={}){let r=new DataView(e);if(r.byteLength<176)throw new Error("Truncated NTv2 overview header");let n=r.getInt32(8,!0)===11;if(!n&&r.getInt32(8,!1)!==11)throw new Error("Invalid NTv2 header or byte order");let i=u=>r.getInt32(u,n),o=u=>r.getFloat64(u,n),s=u=>String.fromCharCode(...new Uint8Array(e,u,8)).replace(/\0/g,"").trim();if(s(0)!=="NUM_OREC"||i(24)!==11||s(56)!=="SECONDS")throw new Error("Unsupported NTv2 header or shift units");let a=i(40),c=t.includeErrorFields===!1?8:16;if(a<1||a>Math.floor((r.byteLength-176)/(176+4*c)))throw new Error("Invalid NTv2 subgrid count");let l=176,h=[];for(let u=0;u<a;u++){if(l+176>r.byteLength)throw new Error("Truncated NTv2 subgrid header");let f=o(l+72),d=o(l+88),m=o(l+104),p=o(l+120),g=o(l+136),y=o(l+152),_=i(l+168),M=1+(p-m)/y,b=1+(d-f)/g;if(![M,b].every(E=>Number.isFinite(E)&&E>=2&&Math.abs(E-Math.round(E))<1e-7)||!(y>0&&g>0)||_!==Math.round(M)*Math.round(b))throw new Error("Invalid NTv2 subgrid dimensions");let v=l+176,T=v+_*c;if(T>r.byteLength)throw new Error("Truncated NTv2 node records");let S=new Float64Array(_*2);for(let E=0;E<_;E++)S[E*2]=r.getFloat32(v+E*c+4,n)*cl,S[E*2+1]=r.getFloat32(v+E*c,n)*cl;h.push({origin:[m*cl,f*cl],step:[y*cl,g*cl],size:[Math.round(M),Math.round(b)],shifts:S}),l=T}return dI(h)}var _m={ch1903:{towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},ggrs87:{towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},nad27:{nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},potsdam:{towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},carthage:{towgs84:"-263.0,6.0,431.0",ellipse:"clrk80ign",datumName:"Carthage 1934 Tunisia"},hermannskogel:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},mgi:{towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Militar-Geographische Institut"},osni52:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},ire65:{towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},rassadiran:{towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},nzgd49:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},osgb36:{towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Ordnance Survey of Great Britain 1936"},s_jtsk:{towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},beduaram:{towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},gunung_segara:{towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},rnb72:{towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"},EPSG_5451:{towgs84:"6.41,-49.05,-11.28,1.5657,0.5242,6.9718,-5.7649"},IGNF_LURESG:{towgs84:"-192.986,13.673,-39.309,-0.4099,-2.9332,2.6881,0.43"},EPSG_4614:{towgs84:"-119.4248,-303.65872,-11.00061,1.164298,0.174458,1.096259,3.657065"},EPSG_4615:{towgs84:"-494.088,-312.129,279.877,-1.423,-1.013,1.59,-0.748"},ESRI_37241:{towgs84:"-76.822,257.457,-12.817,2.136,-0.033,-2.392,-0.031"},ESRI_37249:{towgs84:"-440.296,58.548,296.265,1.128,10.202,4.559,-0.438"},ESRI_37245:{towgs84:"-511.151,-181.269,139.609,1.05,2.703,1.798,3.071"},EPSG_4178:{towgs84:"24.9,-126.4,-93.2,-0.063,-0.247,-0.041,1.01"},EPSG_4622:{towgs84:"-472.29,-5.63,-304.12,0.4362,-0.8374,0.2563,1.8984"},EPSG_4625:{towgs84:"126.93,547.94,130.41,-2.7867,5.1612,-0.8584,13.8227"},EPSG_5252:{towgs84:"0.023,0.036,-0.068,0.00176,0.00912,-0.01136,0.00439"},EPSG_4314:{towgs84:"597.1,71.4,412.1,0.894,0.068,-1.563,7.58"},EPSG_4282:{towgs84:"-178.3,-316.7,-131.5,5.278,6.077,10.979,19.166"},EPSG_4231:{towgs84:"-83.11,-97.38,-117.22,0.005693,-0.044698,0.044285,0.1218"},EPSG_4274:{towgs84:"-230.994,102.591,25.199,0.633,-0.239,0.9,1.95"},EPSG_4134:{towgs84:"-180.624,-225.516,173.919,-0.81,-1.898,8.336,16.71006"},EPSG_4254:{towgs84:"18.38,192.45,96.82,0.056,-0.142,-0.2,-0.0013"},EPSG_4159:{towgs84:"-194.513,-63.978,-25.759,-3.4027,3.756,-3.352,-0.9175"},EPSG_4687:{towgs84:"0.072,-0.507,-0.245,0.0183,-0.0003,0.007,-0.0093"},EPSG_4227:{towgs84:"-83.58,-397.54,458.78,-17.595,-2.847,4.256,3.225"},EPSG_4746:{towgs84:"599.4,72.4,419.2,-0.062,-0.022,-2.723,6.46"},EPSG_4745:{towgs84:"612.4,77,440.2,-0.054,0.057,-2.797,2.55"},EPSG_6311:{towgs84:"8.846,-4.394,-1.122,-0.00237,-0.146528,0.130428,0.783926"},EPSG_4289:{towgs84:"565.7381,50.4018,465.2904,-0.395026,0.330772,-1.876073,4.07244"},EPSG_4230:{towgs84:"-68.863,-134.888,-111.49,-0.53,-0.14,0.57,-3.4"},EPSG_4154:{towgs84:"-123.02,-158.95,-168.47"},EPSG_4156:{towgs84:"570.8,85.7,462.8,4.998,1.587,5.261,3.56"},EPSG_4299:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4179:{towgs84:"33.4,-146.6,-76.3,-0.359,-0.053,0.844,-0.84"},EPSG_4313:{towgs84:"-106.8686,52.2978,-103.7239,0.3366,-0.457,1.8422,-1.2747"},EPSG_4194:{towgs84:"163.511,127.533,-159.789"},EPSG_4195:{towgs84:"105,326,-102.5"},EPSG_4196:{towgs84:"-45,417,-3.5"},EPSG_4611:{towgs84:"-162.619,-276.959,-161.764,0.067753,-2.243648,-1.158828,-1.094246"},EPSG_4633:{towgs84:"137.092,131.66,91.475,-1.9436,-11.5993,-4.3321,-7.4824"},EPSG_4641:{towgs84:"-408.809,366.856,-412.987,1.8842,-0.5308,2.1655,-121.0993"},EPSG_4643:{towgs84:"-480.26,-438.32,-643.429,16.3119,20.1721,-4.0349,-111.7002"},EPSG_4300:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4188:{towgs84:"482.5,-130.6,564.6,-1.042,-0.214,-0.631,8.15"},EPSG_4660:{towgs84:"982.6087,552.753,-540.873,6.681627,-31.611492,-19.848161,16.805"},EPSG_4662:{towgs84:"97.295,-263.247,310.882,-1.5999,0.8386,3.1409,13.3259"},EPSG_3906:{towgs84:"577.88891,165.22205,391.18289,4.9145,-0.94729,-13.05098,7.78664"},EPSG_4307:{towgs84:"-209.3622,-87.8162,404.6198,0.0046,3.4784,0.5805,-1.4547"},EPSG_6892:{towgs84:"-76.269,-16.683,68.562,-6.275,10.536,-4.286,-13.686"},EPSG_4690:{towgs84:"221.597,152.441,176.523,2.403,1.3893,0.884,11.4648"},EPSG_4691:{towgs84:"218.769,150.75,176.75,3.5231,2.0037,1.288,10.9817"},EPSG_4629:{towgs84:"72.51,345.411,79.241,-1.5862,-0.8826,-0.5495,1.3653"},EPSG_4630:{towgs84:"165.804,216.213,180.26,-0.6251,-0.4515,-0.0721,7.4111"},EPSG_4692:{towgs84:"217.109,86.452,23.711,0.0183,-0.0003,0.007,-0.0093"},EPSG_9333:{towgs84:"0,0,0,-0.008393,0.000749,-0.010276,0"},EPSG_9059:{towgs84:"0,0,0"},EPSG_4312:{towgs84:"601.705,84.263,485.227,4.7354,1.3145,5.393,-2.3887"},EPSG_4123:{towgs84:"-96.062,-82.428,-121.753,4.801,0.345,-1.376,1.496"},EPSG_4309:{towgs84:"-124.45,183.74,44.64,-0.4384,0.5446,-0.9706,-2.1365"},ESRI_104106:{towgs84:"-283.088,-70.693,117.445,-1.157,0.059,-0.652,-4.058"},EPSG_4281:{towgs84:"-219.247,-73.802,269.529"},EPSG_4322:{towgs84:"0,0,4.5"},EPSG_4324:{towgs84:"0,0,1.9"},EPSG_4284:{towgs84:"43.822,-108.842,-119.585,1.455,-0.761,0.737,0.549"},EPSG_4277:{towgs84:"446.448,-125.157,542.06,0.15,0.247,0.842,-20.489"},EPSG_4207:{towgs84:"-282.1,-72.2,120,-1.529,0.145,-0.89,-4.46"},EPSG_4688:{towgs84:"347.175,1077.618,2623.677,33.9058,-70.6776,9.4013,186.0647"},EPSG_4689:{towgs84:"410.793,54.542,80.501,-2.5596,-2.3517,-0.6594,17.3218"},EPSG_4720:{towgs84:"0,0,4.5"},EPSG_4273:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},EPSG_4240:{towgs84:"204.64,834.74,293.8"},EPSG_4817:{towgs84:"278.3,93,474.5,7.889,0.05,-6.61,6.21"},ESRI_104131:{towgs84:"426.62,142.62,460.09,4.98,4.49,-12.42,-17.1"},EPSG_4265:{towgs84:"-104.1,-49.1,-9.9,0.971,-2.917,0.714,-11.68"},EPSG_4263:{towgs84:"-111.92,-87.85,114.5,1.875,0.202,0.219,0.032"},EPSG_4298:{towgs84:"-689.5937,623.84046,-65.93566,-0.02331,1.17094,-0.80054,5.88536"},EPSG_4270:{towgs84:"-253.4392,-148.452,386.5267,0.15605,0.43,-0.1013,-0.0424"},EPSG_4229:{towgs84:"-121.8,98.1,-10.7"},EPSG_4220:{towgs84:"-55.5,-348,-229.2"},EPSG_4214:{towgs84:"12.646,-155.176,-80.863"},EPSG_4232:{towgs84:"-345,3,223"},EPSG_4238:{towgs84:"-1.977,-13.06,-9.993,0.364,0.254,0.689,-1.037"},EPSG_4168:{towgs84:"-170,33,326"},EPSG_4131:{towgs84:"199,931,318.9"},EPSG_4152:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_5228:{towgs84:"572.213,85.334,461.94,4.9732,1.529,5.2484,3.5378"},EPSG_8351:{towgs84:"485.021,169.465,483.839,7.786342,4.397554,4.102655,0"},EPSG_4683:{towgs84:"-127.62,-67.24,-47.04,-3.068,4.903,1.578,-1.06"},EPSG_4133:{towgs84:"0,0,0"},EPSG_7373:{towgs84:"0.819,-0.5762,-1.6446,-0.00378,-0.03317,0.00318,0.0693"},EPSG_9075:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9072:{towgs84:"-0.9102,2.0141,0.5602,0.029039,0.010065,0.010101,0"},EPSG_9294:{towgs84:"1.16835,-1.42001,-2.24431,-0.00822,-0.05508,0.01818,0.23388"},EPSG_4212:{towgs84:"-267.434,173.496,181.814,-13.4704,8.7154,7.3926,14.7492"},EPSG_4191:{towgs84:"-44.183,-0.58,-38.489,2.3867,2.7072,-3.5196,-8.2703"},EPSG_4237:{towgs84:"52.684,-71.194,-13.975,-0.312,-0.1063,-0.3729,1.0191"},EPSG_4740:{towgs84:"-1.08,-0.27,-0.9"},EPSG_4124:{towgs84:"419.3836,99.3335,591.3451,0.850389,1.817277,-7.862238,-0.99496"},EPSG_5681:{towgs84:"584.9636,107.7175,413.8067,1.1155,0.2824,-3.1384,7.9922"},EPSG_4141:{towgs84:"23.772,17.49,17.859,-0.3132,-1.85274,1.67299,-5.4262"},EPSG_4204:{towgs84:"-85.645,-273.077,-79.708,2.289,-1.421,2.532,3.194"},EPSG_4319:{towgs84:"226.702,-193.337,-35.371,-2.229,-4.391,9.238,0.9798"},EPSG_4200:{towgs84:"24.82,-131.21,-82.66"},EPSG_4130:{towgs84:"0,0,0"},EPSG_4127:{towgs84:"-82.875,-57.097,-156.768,-2.158,1.524,-0.982,-0.359"},EPSG_4149:{towgs84:"674.374,15.056,405.346"},EPSG_4617:{towgs84:"-0.991,1.9072,0.5129,0.02579,0.00965,0.01166,0"},EPSG_4663:{towgs84:"-210.502,-66.902,-48.476,2.094,-15.067,-5.817,0.485"},EPSG_4664:{towgs84:"-211.939,137.626,58.3,-0.089,0.251,0.079,0.384"},EPSG_4665:{towgs84:"-105.854,165.589,-38.312,-0.003,-0.026,0.024,-0.048"},EPSG_4666:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},EPSG_4756:{towgs84:"-192.873,-39.382,-111.202,-0.00205,-0.0005,0.00335,0.0188"},EPSG_4723:{towgs84:"-179.483,-69.379,-27.584,-7.862,8.163,6.042,-13.925"},EPSG_4726:{towgs84:"8.853,-52.644,180.304,-0.393,-2.323,2.96,-24.081"},EPSG_4267:{towgs84:"-8.0,160.0,176.0"},EPSG_5365:{towgs84:"-0.16959,0.35312,0.51846,0.03385,-0.16325,0.03446,0.03693"},EPSG_4218:{towgs84:"304.5,306.5,-318.1"},EPSG_4242:{towgs84:"-33.722,153.789,94.959,-8.581,-4.478,4.54,8.95"},EPSG_4216:{towgs84:"-292.295,248.758,429.447,4.9971,2.99,6.6906,1.0289"},ESRI_104105:{towgs84:"631.392,-66.551,481.442,1.09,-4.445,-4.487,-4.43"},ESRI_104129:{towgs84:"0,0,0"},EPSG_4673:{towgs84:"174.05,-25.49,112.57"},EPSG_4202:{towgs84:"-124,-60,154"},EPSG_4203:{towgs84:"-117.763,-51.51,139.061,0.292,0.443,0.277,-0.191"},EPSG_3819:{towgs84:"595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408"},EPSG_8694:{towgs84:"-93.799,-132.737,-219.073,-1.844,0.648,-6.37,-0.169"},EPSG_4145:{towgs84:"275.57,676.78,229.6"},EPSG_4283:{towgs84:"0.06155,-0.01087,-0.04019,0.039492,0.032722,0.032898,-0.009994"},EPSG_4317:{towgs84:"2.3287,-147.0425,-92.0802,-0.309248,0.324822,0.497299,5.689063"},EPSG_4272:{towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993"},EPSG_4248:{towgs84:"-307.7,265.3,-363.5"},EPSG_5561:{towgs84:"24,-121,-76"},EPSG_5233:{towgs84:"-0.293,766.95,87.713,0.195704,1.695068,3.473016,-0.039338"},ESRI_104130:{towgs84:"-86,-98,-119"},ESRI_104102:{towgs84:"682,-203,480"},ESRI_37207:{towgs84:"7,-10,-26"},EPSG_4675:{towgs84:"59.935,118.4,-10.871"},ESRI_104109:{towgs84:"-89.121,-348.182,260.871"},ESRI_104112:{towgs84:"-185.583,-230.096,281.361"},ESRI_104113:{towgs84:"25.1,-275.6,222.6"},IGNF_WGS72G:{towgs84:"0,12,6"},IGNF_NTFG:{towgs84:"-168,-60,320"},IGNF_EFATE57G:{towgs84:"-127,-769,472"},IGNF_PGP50G:{towgs84:"324.8,153.6,172.1"},IGNF_REUN47G:{towgs84:"94,-948,-1262"},IGNF_CSG67G:{towgs84:"-186,230,110"},IGNF_GUAD48G:{towgs84:"-467,-16,-300"},IGNF_TAHI51G:{towgs84:"162,117,154"},IGNF_TAHAAG:{towgs84:"65,342,77"},IGNF_NUKU72G:{towgs84:"84,274,65"},IGNF_PETRELS72G:{towgs84:"365,194,166"},IGNF_WALL78G:{towgs84:"253,-133,-127"},IGNF_MAYO50G:{towgs84:"-382,-59,-262"},IGNF_TANNAG:{towgs84:"-139,-967,436"},IGNF_IGN72G:{towgs84:"-13,-348,292"},IGNF_ATIGG:{towgs84:"1118,23,66"},IGNF_FANGA84G:{towgs84:"150.57,158.33,118.32"},IGNF_RUSAT84G:{towgs84:"202.13,174.6,-15.74"},IGNF_KAUE70G:{towgs84:"126.74,300.1,-75.49"},IGNF_MOP90G:{towgs84:"-10.8,-1.8,12.77"},IGNF_MHPF67G:{towgs84:"338.08,212.58,-296.17"},IGNF_TAHI79G:{towgs84:"160.61,116.05,153.69"},IGNF_ANAA92G:{towgs84:"1.5,3.84,4.81"},IGNF_MARQUI72G:{towgs84:"330.91,-13.92,58.56"},IGNF_APAT86G:{towgs84:"143.6,197.82,74.05"},IGNF_TUBU69G:{towgs84:"237.17,171.61,-77.84"},IGNF_STPM50G:{towgs84:"11.363,424.148,373.13"},EPSG_4150:{towgs84:"674.374,15.056,405.346"},EPSG_4754:{towgs84:"-208.4058,-109.8777,-2.5764"},ESRI_104101:{towgs84:"372.87,149.23,585.29"},EPSG_4693:{towgs84:"0,-0.15,0.68"},EPSG_6207:{towgs84:"293.17,726.18,245.36"},EPSG_4153:{towgs84:"-133.63,-157.5,-158.62"},EPSG_4132:{towgs84:"-241.54,-163.64,396.06"},EPSG_4221:{towgs84:"-154.5,150.7,100.4"},EPSG_4266:{towgs84:"-80.7,-132.5,41.1"},EPSG_4193:{towgs84:"-70.9,-151.8,-41.4"},EPSG_5340:{towgs84:"-0.41,0.46,-0.35"},EPSG_4246:{towgs84:"-294.7,-200.1,525.5"},EPSG_4318:{towgs84:"-3.2,-5.7,2.8"},EPSG_4121:{towgs84:"-199.87,74.79,246.62"},EPSG_4223:{towgs84:"-260.1,5.5,432.2"},EPSG_4158:{towgs84:"-0.465,372.095,171.736"},EPSG_4285:{towgs84:"-128.16,-282.42,21.93"},EPSG_4613:{towgs84:"-404.78,685.68,45.47"},EPSG_4607:{towgs84:"195.671,332.517,274.607"},EPSG_4475:{towgs84:"-381.788,-57.501,-256.673"},EPSG_4208:{towgs84:"-157.84,308.54,-146.6"},EPSG_4743:{towgs84:"70.995,-335.916,262.898"},EPSG_4710:{towgs84:"-323.65,551.39,-491.22"},EPSG_7881:{towgs84:"-0.077,0.079,0.086"},EPSG_4682:{towgs84:"283.729,735.942,261.143"},EPSG_4739:{towgs84:"-156,-271,-189"},EPSG_4679:{towgs84:"-80.01,253.26,291.19"},EPSG_4750:{towgs84:"-56.263,16.136,-22.856"},EPSG_4644:{towgs84:"-10.18,-350.43,291.37"},EPSG_4695:{towgs84:"-103.746,-9.614,-255.95"},EPSG_4292:{towgs84:"-355,21,72"},EPSG_4302:{towgs84:"-61.702,284.488,472.052"},EPSG_4143:{towgs84:"-124.76,53,466.79"},EPSG_4606:{towgs84:"-153,153,307"},EPSG_4699:{towgs84:"-770.1,158.4,-498.2"},EPSG_4247:{towgs84:"-273.5,110.6,-357.9"},EPSG_4160:{towgs84:"8.88,184.86,106.69"},EPSG_4161:{towgs84:"-233.43,6.65,173.64"},EPSG_9251:{towgs84:"-9.5,122.9,138.2"},EPSG_9253:{towgs84:"-78.1,101.6,133.3"},EPSG_4297:{towgs84:"-198.383,-240.517,-107.909"},EPSG_4269:{towgs84:"0,0,0"},EPSG_4301:{towgs84:"-147,506,687"},EPSG_4618:{towgs84:"-59,-11,-52"},EPSG_4612:{towgs84:"0,0,0"},EPSG_4678:{towgs84:"44.585,-131.212,-39.544"},EPSG_4250:{towgs84:"-130,29,364"},EPSG_4144:{towgs84:"214,804,268"},EPSG_4147:{towgs84:"-17.51,-108.32,-62.39"},EPSG_4259:{towgs84:"-254.1,-5.36,-100.29"},EPSG_4164:{towgs84:"-76,-138,67"},EPSG_4211:{towgs84:"-378.873,676.002,-46.255"},EPSG_4182:{towgs84:"-422.651,-172.995,84.02"},EPSG_4224:{towgs84:"-143.87,243.37,-33.52"},EPSG_4225:{towgs84:"-205.57,168.77,-4.12"},EPSG_5527:{towgs84:"-67.35,3.88,-38.22"},EPSG_4752:{towgs84:"98,390,-22"},EPSG_4310:{towgs84:"-30,190,89"},EPSG_9248:{towgs84:"-192.26,65.72,132.08"},EPSG_4680:{towgs84:"124.5,-63.5,-281"},EPSG_4701:{towgs84:"-79.9,-158,-168.9"},EPSG_4706:{towgs84:"-146.21,112.63,4.05"},EPSG_4805:{towgs84:"682,-203,480"},EPSG_4201:{towgs84:"-165,-11,206"},EPSG_4210:{towgs84:"-157,-2,-299"},EPSG_4183:{towgs84:"-104,167,-38"},EPSG_4139:{towgs84:"11,72,-101"},EPSG_4668:{towgs84:"-86,-98,-119"},EPSG_4717:{towgs84:"-2,151,181"},EPSG_4732:{towgs84:"102,52,-38"},EPSG_4280:{towgs84:"-377,681,-50"},EPSG_4209:{towgs84:"-138,-105,-289"},EPSG_4261:{towgs84:"31,146,47"},EPSG_4658:{towgs84:"-73,46,-86"},EPSG_4721:{towgs84:"265.025,384.929,-194.046"},EPSG_4222:{towgs84:"-136,-108,-292"},EPSG_4601:{towgs84:"-255,-15,71"},EPSG_4602:{towgs84:"725,685,536"},EPSG_4603:{towgs84:"72,213.7,93"},EPSG_4605:{towgs84:"9,183,236"},EPSG_4621:{towgs84:"137,248,-430"},EPSG_4657:{towgs84:"-28,199,5"},EPSG_4316:{towgs84:"103.25,-100.4,-307.19"},EPSG_4642:{towgs84:"-13,-348,292"},EPSG_4698:{towgs84:"145,-187,103"},EPSG_4192:{towgs84:"-206.1,-174.7,-87.7"},EPSG_4311:{towgs84:"-265,120,-358"},EPSG_4135:{towgs84:"58,-283,-182"},ESRI_104138:{towgs84:"198,-226,-347"},EPSG_4245:{towgs84:"-11,851,5"},EPSG_4142:{towgs84:"-125,53,467"},EPSG_4213:{towgs84:"-106,-87,188"},EPSG_4253:{towgs84:"-133,-77,-51"},EPSG_4129:{towgs84:"-132,-110,-335"},EPSG_4713:{towgs84:"-77,-128,142"},EPSG_4239:{towgs84:"217,823,299"},EPSG_4146:{towgs84:"295,736,257"},EPSG_4155:{towgs84:"-83,37,124"},EPSG_4165:{towgs84:"-173,253,27"},EPSG_4672:{towgs84:"175,-38,113"},EPSG_4236:{towgs84:"-637,-549,-203"},EPSG_4251:{towgs84:"-90,40,88"},EPSG_4271:{towgs84:"-2,374,172"},EPSG_4175:{towgs84:"-88,4,101"},EPSG_4716:{towgs84:"298,-304,-375"},EPSG_4315:{towgs84:"-23,259,-9"},EPSG_4744:{towgs84:"-242.2,-144.9,370.3"},EPSG_4244:{towgs84:"-97,787,86"},EPSG_4293:{towgs84:"616,97,-251"},EPSG_4714:{towgs84:"-127,-769,472"},EPSG_4736:{towgs84:"260,12,-147"},EPSG_6883:{towgs84:"-235,-110,393"},EPSG_6894:{towgs84:"-63,176,185"},EPSG_4205:{towgs84:"-43,-163,45"},EPSG_4256:{towgs84:"41,-220,-134"},EPSG_4262:{towgs84:"639,405,60"},EPSG_4604:{towgs84:"174,359,365"},EPSG_4169:{towgs84:"-115,118,426"},EPSG_4620:{towgs84:"-106,-129,165"},EPSG_4184:{towgs84:"-203,141,53"},EPSG_4616:{towgs84:"-289,-124,60"},EPSG_9403:{towgs84:"-307,-92,127"},EPSG_4684:{towgs84:"-133,-321,50"},EPSG_4708:{towgs84:"-491,-22,435"},EPSG_4707:{towgs84:"114,-116,-333"},EPSG_4709:{towgs84:"145,75,-272"},EPSG_4712:{towgs84:"-205,107,53"},EPSG_4711:{towgs84:"124,-234,-25"},EPSG_4718:{towgs84:"230,-199,-752"},EPSG_4719:{towgs84:"211,147,111"},EPSG_4724:{towgs84:"208,-435,-229"},EPSG_4725:{towgs84:"189,-79,-202"},EPSG_4735:{towgs84:"647,1777,-1124"},EPSG_4722:{towgs84:"-794,119,-298"},EPSG_4728:{towgs84:"-307,-92,127"},EPSG_4734:{towgs84:"-632,438,-609"},EPSG_4727:{towgs84:"912,-58,1227"},EPSG_4729:{towgs84:"185,165,42"},EPSG_4730:{towgs84:"170,42,84"},EPSG_4733:{towgs84:"276,-57,149"},ESRI_37218:{towgs84:"230,-199,-752"},ESRI_37240:{towgs84:"-7,215,225"},ESRI_37221:{towgs84:"252,-209,-751"},ESRI_4305:{towgs84:"-123,-206,219"},ESRI_104139:{towgs84:"-73,-247,227"},EPSG_4748:{towgs84:"51,391,-36"},EPSG_4219:{towgs84:"-384,664,-48"},EPSG_4255:{towgs84:"-333,-222,114"},EPSG_4257:{towgs84:"-587.8,519.75,145.76"},EPSG_4646:{towgs84:"-963,510,-359"},EPSG_6881:{towgs84:"-24,-203,268"},EPSG_6882:{towgs84:"-183,-15,273"},EPSG_4715:{towgs84:"-104,-129,239"},IGNF_RGF93GDD:{towgs84:"0,0,0"},IGNF_RGM04GDD:{towgs84:"0,0,0"},IGNF_RGSPM06GDD:{towgs84:"0,0,0"},IGNF_RGTAAF07GDD:{towgs84:"0,0,0"},IGNF_RGFG95GDD:{towgs84:"0,0,0"},IGNF_RGNCG:{towgs84:"0,0,0"},IGNF_RGPFGDD:{towgs84:"0,0,0"},IGNF_ETRS89G:{towgs84:"0,0,0"},IGNF_RGR92GDD:{towgs84:"0,0,0"},EPSG_4173:{towgs84:"0,0,0"},EPSG_4180:{towgs84:"0,0,0"},EPSG_4619:{towgs84:"0,0,0"},EPSG_4667:{towgs84:"0,0,0"},EPSG_4075:{towgs84:"0,0,0"},EPSG_6706:{towgs84:"0,0,0"},EPSG_7798:{towgs84:"0,0,0"},EPSG_4661:{towgs84:"0,0,0"},EPSG_4669:{towgs84:"0,0,0"},EPSG_8685:{towgs84:"0,0,0"},EPSG_4151:{towgs84:"0,0,0"},EPSG_9702:{towgs84:"0,0,0"},EPSG_4758:{towgs84:"0,0,0"},EPSG_4761:{towgs84:"0,0,0"},EPSG_4765:{towgs84:"0,0,0"},EPSG_8997:{towgs84:"0,0,0"},EPSG_4023:{towgs84:"0,0,0"},EPSG_4670:{towgs84:"0,0,0"},EPSG_4694:{towgs84:"0,0,0"},EPSG_4148:{towgs84:"0,0,0"},EPSG_4163:{towgs84:"0,0,0"},EPSG_4167:{towgs84:"0,0,0"},EPSG_4189:{towgs84:"0,0,0"},EPSG_4190:{towgs84:"0,0,0"},EPSG_4176:{towgs84:"0,0,0"},EPSG_4659:{towgs84:"0,0,0"},EPSG_3824:{towgs84:"0,0,0"},EPSG_3889:{towgs84:"0,0,0"},EPSG_4046:{towgs84:"0,0,0"},EPSG_4081:{towgs84:"0,0,0"},EPSG_4558:{towgs84:"0,0,0"},EPSG_4483:{towgs84:"0,0,0"},EPSG_5013:{towgs84:"0,0,0"},EPSG_5264:{towgs84:"0,0,0"},EPSG_5324:{towgs84:"0,0,0"},EPSG_5354:{towgs84:"0,0,0"},EPSG_5371:{towgs84:"0,0,0"},EPSG_5373:{towgs84:"0,0,0"},EPSG_5381:{towgs84:"0,0,0"},EPSG_5393:{towgs84:"0,0,0"},EPSG_5489:{towgs84:"0,0,0"},EPSG_5593:{towgs84:"0,0,0"},EPSG_6135:{towgs84:"0,0,0"},EPSG_6365:{towgs84:"0,0,0"},EPSG_5246:{towgs84:"0,0,0"},EPSG_7886:{towgs84:"0,0,0"},EPSG_8431:{towgs84:"0,0,0"},EPSG_8427:{towgs84:"0,0,0"},EPSG_8699:{towgs84:"0,0,0"},EPSG_8818:{towgs84:"0,0,0"},EPSG_4757:{towgs84:"0,0,0"},EPSG_9140:{towgs84:"0,0,0"},EPSG_8086:{towgs84:"0,0,0"},EPSG_4686:{towgs84:"0,0,0"},EPSG_4737:{towgs84:"0,0,0"},EPSG_4702:{towgs84:"0,0,0"},EPSG_4747:{towgs84:"0,0,0"},EPSG_4749:{towgs84:"0,0,0"},EPSG_4674:{towgs84:"0,0,0"},EPSG_4755:{towgs84:"0,0,0"},EPSG_4759:{towgs84:"0,0,0"},EPSG_4762:{towgs84:"0,0,0"},EPSG_4763:{towgs84:"0,0,0"},EPSG_4764:{towgs84:"0,0,0"},EPSG_4166:{towgs84:"0,0,0"},EPSG_4170:{towgs84:"0,0,0"},EPSG_5546:{towgs84:"0,0,0"},EPSG_7844:{towgs84:"0,0,0"},EPSG_4818:{towgs84:"589,76,480"},EPSG_10328:{towgs84:"0,0,0"},EPSG_9782:{towgs84:"0,0,0"},EPSG_9777:{towgs84:"0,0,0"},EPSG_10690:{towgs84:"0,0,0"},EPSG_10639:{towgs84:"0,0,0"},EPSG_10739:{towgs84:"0,0,0"},EPSG_7686:{towgs84:"0,0,0"},EPSG_8900:{towgs84:"0,0,0"},EPSG_5886:{towgs84:"0,0,0"},EPSG_7683:{towgs84:"0,0,0"},EPSG_6668:{towgs84:"0,0,0"},EPSG_20046:{towgs84:"0,0,0"},EPSG_10299:{towgs84:"0,0,0"},EPSG_10310:{towgs84:"0,0,0"},EPSG_10475:{towgs84:"0,0,0"},EPSG_4742:{towgs84:"0,0,0"},EPSG_10671:{towgs84:"0,0,0"},EPSG_10762:{towgs84:"0,0,0"},EPSG_10725:{towgs84:"0,0,0"},EPSG_10791:{towgs84:"0,0,0"},EPSG_10800:{towgs84:"0,0,0"},EPSG_10305:{towgs84:"0,0,0"},EPSG_10941:{towgs84:"0,0,0"},EPSG_10968:{towgs84:"0,0,0"},EPSG_10875:{towgs84:"0,0,0"},EPSG_6318:{towgs84:"0,0,0"},EPSG_10910:{towgs84:"0,0,0"}};for(let e in _m){let t=_m[e];t.datumName&&(_m[t.datumName]=t)}var mI=_m;var pI=Object.freeze({name:"regional-datums",datums:Object.freeze(mI)});function eB(e){return{...e,parse(t,r){let n=e.parse(t,r),i=n.parameters.datum,o=s=>s.toLowerCase().replace(/[\s_-]/g,"");if(i&&!Object.keys(Zc(r)).some(s=>o(s)===o(i))){let s={...n.parameters};return delete s.datum,{...n,parameters:s}}return n}}}var rB=[zy,Vy].map(eB),Mm;function nB(){if(Mm)return Mm;let e=[Z1,J1,Q1,ty,ey,iy,Yg,oy,cy,kg,qg,Wg,ly,uy,my,py,gy,_y,My,by,xy,vy,Ey,Ty,Iy,Ay,Py,Ry,Cy,Ny,Oy,By,Ly,Dy,Fy],t=i=>i.toLowerCase().replace(/[\s_-]/g,""),r=gm("longlat"),n={name:r.name,aliases:r.aliases,parameters:[...new Set([...r.parameters,...e.flatMap(i=>i.parameters)])],flags:[...new Set(e.flatMap(i=>i.flags||[]))],create(i){let o=i.parameters.o_proj;if(!o)throw new Error("Oblique transformation requires +o_proj");let s=["longlat","latlong","latlon","lonlat","identity"].includes(t(o))?"longlat":e.find(l=>[l.name,...l.aliases||[]].some(h=>t(h)===t(o)));if(!s)throw new Error("Unknown oblique transformation projection: "+o);let a=gm(s),c=new Set([...Zd,...a.parameters]);for(let l of Object.keys(i.parameters))if(!c.has(l))throw new Error("Unsupported PROJ parameter: +"+l);return a.create(i)}};return Mm=[...e,n],Mm}var cs=class extends sm{constructor(t={}){super({...t,projections:t.projections??nB(),parsers:t.parsers??rB,datumCatalogs:t.datumCatalogs??[pI]}),this.useDefinitionSignature=!Hh(t)}},iB=new cs;var gI=new Map,jy={},Wy={},Hy=new cs;function yI(){return Hy}function wI(e,t){Yy(e,"CRS"),jy[e]=t,Hy=new cs({aliases:jy,datumGrids:Wy})}function _I(e,t){Yy(e,"datum grid"),Wy[e]=qy(t),Hy=new cs({aliases:jy,datumGrids:Wy})}function $y(e,t){Yy(e,"geoid model"),gI.set(e,t)}function MI(e,t,r={}){let n=Kd(t,r);return $y(e,n),n}function bm(e){return gI.get(e)}function Yy(e,t){if(!e.trim())throw new Error(`${t} name must not be empty`)}var Hn=class{spatialReference;horizontalProjection;horizontalProjectionBuffer;geographicProjection;heightOutputProjection;sourceIsGeocentric;outputIsGeocentric;sourceIsGeographic;outputIsGeographic;geoid;constructor(t,r={}){this.spatialReference=t;let n=yI();aB(t);let i=t.targetCrs||t.sourceCrs;if(this.sourceIsGeocentric=Ky(t.sourceCrs),this.outputIsGeocentric=Ky(i),this.sourceIsGeographic=bI(t.sourceCrs),this.outputIsGeographic=bI(i),t.sourceCrs&&t.targetCrs&&!this.sourceIsGeocentric&&!this.outputIsGeocentric&&(this.horizontalProjection=n.createProjection({from:Xh(t.sourceCrs),to:Xh(t.targetCrs),enforceAxis:!1}),ll(t)||(this.horizontalProjectionBuffer=new Yd({projection:this.horizontalProjection,dimension:3}))),(ll(t)||this.sourceIsGeocentric||this.outputIsGeocentric)&&(!this.sourceIsGeographic&&!this.sourceIsGeocentric&&(this.geographicProjection=n.createProjection({from:Xh(t.sourceCrs),to:$c,enforceAxis:!1})),!this.outputIsGeographic&&!this.outputIsGeocentric&&(this.heightOutputProjection=n.createProjection({from:$c,to:Xh(i),enforceAxis:!1}))),ll(t)&&(this.geoid=cB(r.geoidModel),!this.geoid)){let o=typeof r.geoidModel=="string"?` "${r.geoidModel}"`:"";throw new Error(`Height conversion requires a registered geoid model${o}; call registerGeoidModel() or pass a parsed Geoid instance`)}}transformPosition(t){if(t.length<2)throw new Error("A spatial coordinate must contain at least x and y components");let r=[...t];if(ll(this.spatialReference)||this.sourceIsGeocentric||this.outputIsGeocentric){if(r.length<3||!Number.isFinite(r[2]))throw new Error("Three-dimensional CRS conversion requires a finite z coordinate");let n=this.toGeographic(r);if(ll(this.spatialReference)){let o=this.geoid.getHeight(n[1],n[0]);n[2]=lB(n[2],o,this.spatialReference.heightReference,this.spatialReference.targetHeightReference)}let i=this.fromGeographic(n);return r.splice(0,i.length,...i),r}if(this.horizontalProjection){let n=this.horizontalProjection.projectSync(r.slice(0,3));r.splice(0,n.length,...n)}return r}transformPositions(t){if(t.length%3!==0)throw new Error("Packed spatial positions must contain a multiple of three components");let r=new Float64Array(t.length);if(this.horizontalProjectionBuffer&&(r.set(t),r.every(Number.isFinite)))return this.horizontalProjectionBuffer.projectFlatTo(r,r);for(let n=0;n<t.length;n+=3){let i=this.transformPosition([Number(t[n]),Number(t[n+1]),Number(t[n+2])]);r[n]=i[0],r[n+1]=i[1],r[n+2]=i[2]}return r}transformNormals(t,r){if(t.length!==r.length||t.length%3!==0)throw new Error("Spatial normals and positions must have matching xyz component counts");let n=new Float32Array(t.length),i=1e-5;for(let o=0;o<t.length;o+=3){let s=[Number(r[o]),Number(r[o+1]),Number(r[o+2])],a=[Number(t[o]),Number(t[o+1]),Number(t[o+2])],c=oB(this,s,i),l=sB(c,a),h=Math.hypot(...l);h>0&&Number.isFinite(h)?(n[o]=l[0]/h,n[o+1]=l[1]/h,n[o+2]=l[2]/h):(n[o]=a[0],n[o+1]=a[1],n[o+2]=a[2])}return n}toGeographic(t){return this.sourceIsGeocentric?Array.from(pt.WGS84.cartesianToCartographic(new I(t))):this.sourceIsGeographic?t.slice(0,3):this.geographicProjection.projectSync(t.slice(0,3))}fromGeographic(t){return this.outputIsGeocentric?Array.from(pt.WGS84.cartographicToCartesian(new I(t))):this.outputIsGeographic?t.slice(0,3):this.heightOutputProjection.projectSync(t.slice(0,3))}};function oB(e,t,r){let n=[];for(let i=0;i<3;i++){let o=t.slice(),s=t.slice();o[i]+=r,s[i]-=r;let a=e.transformPosition(o),c=e.transformPosition(s);n.push([(a[0]-c[0])/(2*r),(a[1]-c[1])/(2*r),(a[2]-c[2])/(2*r)])}return n}function sB(e,t){let[r,n,i]=e,o=r[0]*(n[1]*i[2]-n[2]*i[1])-n[0]*(r[1]*i[2]-r[2]*i[1])+i[0]*(r[1]*n[2]-r[2]*n[1]);return!Number.isFinite(o)||Math.abs(o)<1e-15?t:[[n[1]*i[2]-n[2]*i[1],r[2]*i[1]-r[1]*i[2],r[1]*n[2]-r[2]*n[1]],[n[2]*i[0]-n[0]*i[2],r[0]*i[2]-r[2]*i[0],r[2]*n[0]-r[0]*n[2]],[n[0]*i[1]-n[1]*i[0],r[1]*i[0]-r[0]*i[1],r[0]*n[1]-r[1]*n[0]]].map(a=>(a[0]*t[0]+a[1]*t[1]+a[2]*t[2])/o)}function Xh(e){if(!e)throw new Error("Cannot construct a projection because the CRS is unknown");if(typeof e!="string"&&e.type==="CompoundCRS"){let t=e.components.filter(r=>r.type!=="VerticalCRS");if(t.length!==1)throw new Error("CompoundCRS requires exactly one horizontal component");return Xh(t[0])}return e}function aB(e){if(e.outputCoordinates==="local-enu")throw new Error("local-enu output requires a dataset-derived local origin and must be created by a tileset source");if(e.outputCoordinates==="target-crs"&&!e.targetCrs)throw new Error("target-crs output requires targetCrs");if(!e.sourceCrs&&e.status==="unresolved")throw new Error("Cannot transform coordinates because the source CRS is unknown");if(ll(e)&&e.heightReference==="unknown")throw new Error("Cannot convert heights because the source height reference is unknown");if(e.coordinateFrame==="geocentric"&&!Ky(e.sourceCrs))throw new Error("Only EPSG:4978 geocentric coordinates are supported by the current spatial transformer");if(e.status==="unresolved")throw new Error("The requested spatial output cannot be resolved from the available metadata")}function Ky(e){return typeof e=="string"&&Fh(e)===Od}function bI(e){if(typeof e!="string")return!1;let t=Fh(e);return t===$c||t==="EPSG:4979"||t==="OGC:CRS84"}function ll(e){let t=e.targetHeightReference;return t!=="native"&&t!==e.heightReference}function cB(e){return typeof e=="string"?bm(e):e}function lB(e,t,r,n){if(r===n||n==="native")return e;if(r==="orthometric"&&n==="ellipsoidal")return e+t;if(r==="ellipsoidal"&&n==="orthometric")return e-t;throw new Error(`Unsupported height conversion from ${r} to ${n}`)}qt();var ls=class{spatialReference;coordinateTransformer;geographicCoordinateTransformer;constructor(t,r={}){this.coordinateTransformer=new Hn(t,r);let n={...t,sourceCrs:"EPSG:4326",targetCrs:t.targetCrs||t.sourceCrs,coordinateFrame:"geographic",axisOrder:"xy"};this.geographicCoordinateTransformer=new Hn(n,r),this.spatialReference=t}transformPositions(t){return this.coordinateTransformer.transformPositions(t)}transformNormals(t,r){return this.coordinateTransformer.transformNormals(t,r)}transformBoundingVolume(t,r){let n=r?new bt(Array.from(r)):void 0,i=t.region?hB(t.region):uB(t).map(s=>n?Array.from(n.transformAsPoint(s)):s);if(!i.length)return t;let o=t.region?i.map(s=>this.transformRegionSample(s)):i.map(s=>this.coordinateTransformer.transformPosition(s));return{box:fB(o)}}transformRegionSample(t){return this.geographicCoordinateTransformer.transformPosition(t)}};function hB(e){if(e.length<6||e.some(u=>!Number.isFinite(u)))return[];let[t,r,n,i,o,s]=e,a=n<t?n+Math.PI*2:n,c=xI(t,a),l=xI(r,i),h=[];for(let u of c)for(let f of l)for(let d of[o,s])h.push([u*180/Math.PI,f*180/Math.PI,d]);return h}function xI(e,t){let r=[e,(e+t)/2,t],n=Math.PI/2,i=Math.ceil(e/n),o=Math.floor(t/n);for(let s=i;s<=o;s++)r.push(s*n);return r}function uB(e){if(e.box&&e.box.length>=12){let t=e.box.slice(0,3),r=[e.box.slice(3,6),e.box.slice(6,9),e.box.slice(9,12)],n=[];for(let i=0;i<=4;i++)for(let o=0;o<=4;o++)for(let s=0;s<=4;s++){let a=i/2-1,c=o/2-1,l=s/2-1;n.push([t[0]+a*r[0][0]+c*r[1][0]+l*r[2][0],t[1]+a*r[0][1]+c*r[1][1]+l*r[2][1],t[2]+a*r[0][2]+c*r[1][2]+l*r[2][2]])}return n}if(e.sphere&&e.sphere.length>=4){let[t,r,n,i]=e.sphere,o=[[t-i,r,n],[t+i,r,n],[t,r-i,n],[t,r+i,n],[t,r,n-i],[t,r,n+i]];for(let s=0;s<16;s++){let a=s*Math.PI*2/16;o.push([t+i*Math.cos(a),r+i*Math.sin(a),n])}return o}return[]}function fB(e){let t=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(let o of e)for(let s=0;s<3;s++)t[s]=Math.min(t[s],o[s]),r[s]=Math.max(r[s],o[s]);let n=[Math.max((r[0]-t[0])*.01,1e-9),Math.max((r[1]-t[1])*.01,1e-9),Math.max((r[2]-t[2])*.01,1e-9)];return[...[(t[0]+r[0])/2,(t[1]+r[1])/2,(t[2]+r[2])/2],(r[0]-t[0])/2+n[0],0,0,0,(r[1]-t[1])/2+n[1],0,0,0,(r[2]-t[2])/2+n[2]]}function SI(e,t){let r=e.map(([c,l])=>[c,l]);if(r.length===0)return r;let n=1/0,i=-1/0;for(let[c]of e)n=Math.min(n,c),i=Math.max(i,c);if(i-n>=360)return r;let o=t??r[0][0];for(let c of r){let l=c[0]-o;l>180?c[0]-=360*Math.ceil((l-180)/360):l<-180&&(c[0]+=360*Math.ceil((-l-180)/360)),o=c[0]}let s=e[0],a=e[e.length-1];if(s[0]===a[0]&&s[1]===a[1]){if(Math.abs(r[r.length-1][0]-r[0][0])>180)return e.map(([c,l])=>[c,l]);r[r.length-1]=[...r[0]]}return r}function dB(e){let t=1/0,r=1/0,n=-1/0,i=-1/0;for(let[o,s]of e)t=Math.min(t,o),r=Math.min(r,s),n=Math.max(n,o),i=Math.max(i,s);return[[t,r],[n,i]]}function vI(e){let t=(r,n)=>{let i=e.cellToBoundary(r);return n?.unwrap?SI(i,n.referenceLongitude):i};return{...e,cellToBoundary:t,cellToBoundaryFlat:(r,n)=>n?.unwrap?t(r,n).flat():e.cellToBoundaryFlat(r),cellToBounds:(r,n)=>{let i=e.cellToBounds(r);if(!n?.unwrap||i[1][0]-i[0][0]>=360)return i;let o=dB(t(r,n));return o[0][1]=i[0][1],o[1][1]=i[1][1],o}}}var mB=(1n<<64n)-1n,pB=0x1555555555555555n;function hl(e){if(e==="X")return 0n;if(!EI(e))throw new Error(`Invalid S2 token: ${e}`);let t=e.padEnd(16,"0");return BigInt(`0x${t}`)}function Zh(e){if(e===0n)return"X";if(!ul(e))throw new Error(`Invalid S2 index: ${e}`);let t=gB(e),r=t%4;t=(t-r)/4;let n=t;t*=4;let o=(e>>BigInt(t)).toString(16).replace(/0+$/,"");return Array(17-n-o.length).join("0")+o}function ul(e){if(typeof e!="bigint"||e<=0n||e>mB)return!1;let t=e>>61n,r=e&-e;return t<6n&&(r&pB)!==0n}function EI(e){if(typeof e!="string"||!/^[0-9a-fA-F]{1,16}$/.test(e)||e.endsWith("0"))return!1;let t=e.padEnd(16,"0");return ul(BigInt(`0x${t}`))}function gB(e){let t=0;for(;e%2n===0n;)e/=2n,t++;return t}function fl(e){if(!ul(e))throw new Error(`Invalid S2 index: ${e}`);let t=bB(e);return MB(t)}var yB=3,Xy=30,wB=2*Xy+1,TI=180/Math.PI,_B={a:[[0,"d"],[1,"a"],[3,"b"],[2,"a"]],b:[[2,"b"],[1,"b"],[3,"a"],[0,"c"]],c:[[2,"c"],[3,"d"],[1,"c"],[0,"b"]],d:[[0,"a"],[3,"c"],[1,"d"],[2,"d"]]};function MB(e){if(!/^[0-5]\/[0-3]{0,30}$/.test(e))throw new Error(`Invalid S2 Hilbert quadkey: ${e}`);let t=e.split("/"),r=parseInt(t[0],10),n=t[1]||"",i=n.length,o=0,s=[0,0];for(let a=i-1;a>=0;a--){o=i-a;let c=n[a],l=0,h=0;c==="1"?h=1:c==="2"?(l=1,h=1):c==="3"&&(l=1);let u=Math.pow(2,o-1);xB(u,s,l,h),s[0]+=u*l,s[1]+=u*h}if(r%2===1){let a=s[0];s[0]=s[1],s[1]=a}return{face:r,ij:s,level:o}}function bB(e){if(!ul(e))throw new Error(`Invalid S2 index: ${e}`);let t=e.toString(2);for(;t.length<yB+wB;)t="0"+t;let r=t.lastIndexOf("1"),n=t.substring(0,3),i=t.substring(3,r),o=i.length/2,s=BigInt(`0b${n}`).toString(10),a="";if(o!==0)for(a=BigInt(`0b${i}`).toString(4);a.length<o;)a="0"+a;return`${s}/${a}`}function AI(e){let{face:t,ij:r,level:n}=e;if(!Number.isInteger(t)||t<0||t>5)throw new Error(`Invalid S2 face: ${t}`);if(!Number.isInteger(n)||n<0||n>Xy)throw new Error(`Invalid S2 level: ${n}`);let i=2**n;if(!Number.isInteger(r[0])||!Number.isInteger(r[1])||r[0]<0||r[1]<0||r[0]>=i||r[1]>=i)throw new Error(`Invalid S2 IJ coordinates: ${r[0]}, ${r[1]}`);let o=SB(r[0],r[1],n,t),s=BigInt(t)<<61n;for(let a=0;a<o.length;a++){let c=59-a*2;s|=BigInt(o[a])<<BigInt(c)}return s|=1n<<BigInt(60-n*2),s}function Zy(e,t,r,n){let i=fl(e);if(!Number.isInteger(t)||t<0||i.level+t>Xy)throw new Error(`Invalid S2 relative level: ${t}`);let o=2**t;if(!Number.isInteger(r)||!Number.isInteger(n)||r<0||n<0||r>=o||n>=o)throw new Error(`Invalid S2 descendant coordinates: ${r}, ${n}`);return AI({face:i.face,ij:[i.ij[0]*o+r,i.ij[1]*o+n],level:i.level+t})}function Jh(e,t,r){let n=1<<t;return[(e[0]+r[0])/n,(e[1]+r[1])/n]}function II(e){return e>=.5?1/3*(4*e*e-1):1/3*(1-4*(1-e)*(1-e))}function Qh(e){return[II(e[0]),II(e[1])]}function tu(e,[t,r]){switch(e){case 0:return[1,t,r];case 1:return[-t,1,r];case 2:return[-t,-r,1];case 3:return[-1,-r,-t];case 4:return[r,-1,-t];case 5:return[r,t,-1];default:throw new Error("Invalid face")}}function eu([e,t,r]){let n=Math.atan2(r,Math.sqrt(e*e+t*t));return[Math.atan2(t,e)*TI,n*TI]}function xB(e,t,r,n){if(n===0){r===1&&(t[0]=e-1-t[0],t[1]=e-1-t[1]);let i=t[0];t[0]=t[1],t[1]=i}}function SB(e,t,r,n){let i=n%2===1?"d":"a",o=[];for(let s=r-1;s>=0;s--){let a=1<<s,c=(e&a)!==0?1:0,l=(t&a)!==0?1:0,[h,u]=_B[i][c*2+l];o.push(h),i=u}return o}var vB=100;function PI(e){let t=fl(e);return EB(t)}function EB({face:e,ij:t,level:r}){let n=[[0,0],[0,1],[1,1],[1,0],[0,0]],i=Math.max(1,Math.ceil(vB*Math.pow(2,-r))),o=new Float64Array(4*i*2+2),s=0,a=0;for(let c=0;c<4;c++){let l=n[c].slice(0),h=n[c+1],u=(h[0]-l[0])/i,f=(h[1]-l[1])/i;for(let d=0;d<i;d++){l[0]+=u,l[1]+=f;let m=Jh(t,r,l),p=Qh(m),g=tu(e,p),y=eu(g);Math.abs(y[1])>89.999&&(y[0]=a);let _=y[0]-a;y[0]+=_>180?-360:_<-180?360:0,o[s++]=y[0],o[s++]=y[1],a=y[0]}}return o[s++]=o[0],o[s++]=o[1],o}var TB=vI({name:"s2",hasNumericRepresentation:!0,cellColumnNames:["s2","s2Token","s2_token","s2Cell","s2_cell","s2CellId","s2_cell_id"],tokenToCell:e=>hl(e),cellToToken:e=>Zh(Sm(e)),cellToLngLat:e=>RI(e),cellToBoundary:e=>IB(e),cellToBoundaryFlat:e=>Jy(e),cellToBounds:e=>xm(e)});function RI(e){let t=Sm(e),r=fl(t),n=Jh(r.ij,r.level,[.5,.5]),i=Qh(n),o=tu(r.face,i);return eu(o)}function Jy(e){let t=Sm(e),r=PI(t);return Array.from(r)}function IB(e){let t=Jy(e),r=[];for(let n=0;n<t.length;n+=2)r.push([t[n],t[n+1]]);return r}function xm(e){let t=fl(Sm(e));if(t.level===0)return AB(t.face);let r=[[0,0],[0,1],[1,1],[1,0]],n=1/0,i=1/0,o=-1/0,s=-1/0,a;for(let l of r){let h=Jh(t.ij,t.level,l),u=Qh(h),[f,d,m]=tu(t.face,u),[p,g]=eu([f,d,m]);if(f===0&&d===0&&a!==void 0&&(p=a),a!==void 0){let y=p-a;p+=y>180?-360:y<-180?360:0}a=p,n=Math.min(n,p),i=Math.min(i,g),o=Math.max(o,p),s=Math.max(s,g)}let c=2*Number.EPSILON*180/Math.PI;return[[n-c,Math.max(-90,i-c)],[o+c,Math.min(90,s+c)]]}function Sm(e){return typeof e=="bigint"?e:hl(e)}function AB(e){let t=Math.asin(Math.sqrt(.3333333333333333))*180/Math.PI;switch(e){case 0:return[[-45,-45],[45,45]];case 1:return[[45,-45],[135,45]];case 2:return[[-180,t],[180,90]];case 3:return[[135,-45],[225,45]];case 4:return[[-135,-45],[-45,45]];case 5:return[[-180,-90],[180,-t]];default:throw new Error(`Invalid S2 face: ${e}`)}}Dr();function vm(e){let[[t,r],[n,i]]=xm(e.token),o=fh([t,r,n,i,e.minimumHeight,e.maximumHeight],pt.WGS84,{units:"degrees"});return[...o.center,...o.halfAxes]}var PB=4,RB=8,CI=new WeakMap;function tw(e,t){return{coordinates:t,subtreeUrl:nu(e.subtreesUrlTemplate,t),descriptor:e,resource:GI(e.resourceFiles,nu(e.subtreesUrlTemplate,t))}}function Em(e,t){let{descriptor:r}=t;UB(r),CB(e,r);let n={tileCount:0,childSubtreeCount:0},i=UI(e,t,{localLevel:0,mortonIndex:0},t.coordinates,n);if(!i)throw new Error(`Invalid 3D Tiles subtree: root tile is unavailable at ${t.subtreeUrl}`);return{root:i,...n}}function CB(e,t){let r=qI(t.subdivisionScheme),n=(r**t.subtreeLevels-1)/(r-1),i=r**t.subtreeLevels;Qy(e.tileAvailability,n,"tile");let o=Array.isArray(e.contentAvailability)?e.contentAvailability:e.contentAvailability?[e.contentAvailability]:[];for(let c of o)Qy(c,n,"content");Qy(e.childSubtreeAvailability,i,"child subtree");let s=NI(e.tileAvailability,n),a=o[0]?NI(o[0],n):0;if(OI(e.tileAttributes,s,"tile"),OI(e.contentAttributes,a,"content"),e.tilePropertyRows&&e.tilePropertyRows.length!==s)throw new Error("3DTILES_subtree: tile property-table count does not match availability");if(e.contentPropertyRows&&e.contentPropertyRows.length!==a)throw new Error("3DTILES_subtree: content property-table count does not match availability")}function Qy(e,t,r){if(!(e.constant===0||e.constant===1)&&(!e.explicitBitstream||e.explicitBitstream.byteLength*8<t))throw new Error(`3DTILES_subtree: ${r} availability bitstream is too short`)}function NI(e,t){if(e.constant===1)return t;if(e.constant===0)return 0;let r=0;for(let n=0;n<t;n++)dl(e,n)&&r++;return r}function OI(e,t,r){let n={TILE_BOUNDING_BOX:16,TILE_BOUNDING_SPHERE:4,TILE_GEOMETRIC_ERROR:1,TILE_REFINE:1,TILE_TRANSFORM:16,CONTENT_BOUNDING_BOX:16,CONTENT_BOUNDING_SPHERE:4};for(let[i,o]of Object.entries(e||{})){let s=n[i];if(s&&o.length!==t*s)throw new Error(`3DTILES_subtree: ${r} attribute ${i} count does not match availability`)}}function nu(e,t,r={}){let n={level:t.level,x:t.x,y:t.y,z:t.z,...r};return e.replace(/{([^{}]+)}/g,(i,o)=>{let s=Object.hasOwn(n,o)?n[o]:n[o.toLowerCase()];return s===void 0?i:String(s)})}function UI(e,t,r,n,i){let{descriptor:o}=t,s=qI(o.subdivisionScheme),a=LB(s,r.localLevel)+r.mortonIndex;if(!dl(e.tileAvailability,a))return null;i.tileCount++;let c=BB(e.contentAvailability,a),l=[];if(n.level<o.maximumLevel)if(r.localLevel+1<o.subtreeLevels)for(let h=0;h<s;h++){let u=DI(n,h,o.subdivisionScheme),f=UI(e,t,{localLevel:r.localLevel+1,mortonIndex:r.mortonIndex*s+h},u,i);f&&l.push(f)}else for(let h=0;h<s;h++){let u=r.mortonIndex*s+h;if(dl(e.childSubtreeAvailability,u)){let f=DI(n,h,o.subdivisionScheme);l.push(NB(e,o,f)),i.childSubtreeCount++}}return OB(e,o,t,n,a,c,l)}function NB(e,t,r){let n=zI(t.resourceFiles,e.resourceFiles),i=n?{...t,resourceFiles:n}:t,o=tw(i,r);return{id:kI(o,r),children:[],implicitSubtree:o,boundingVolume:jI(t.rootBoundingVolume,r,t.subdivisionScheme),geometricError:t.rootLodMetricValue/2**r.level,lodMetricType:t.lodMetricType,lodMetricValue:t.rootLodMetricValue/2**r.level,refine:t.refine,type:Oi.EMPTY,implicitMetadata:VI(e),_scaleGeometricError:t.scaleGeometricError!==!1}}function BI(e,t,r){if(!e||t<0)return{};let n=ru(e[r==="tile"?"TILE_BOUNDING_BOX":"CONTENT_BOUNDING_BOX"],t,16),i=ru(e[r==="tile"?"TILE_BOUNDING_SPHERE":"CONTENT_BOUNDING_SPHERE"],t,4),o=n?{box:[n[12],n[13],n[14],n[0]/2,n[1]/2,n[2]/2,n[4]/2,n[5]/2,n[6]/2,n[8]/2,n[9]/2,n[10]/2]}:i?{sphere:i}:void 0;if(r==="content")return{boundingVolume:o};let s=ru(e.TILE_GEOMETRIC_ERROR,t,1)?.[0];if(s!==void 0&&(!Number.isFinite(s)||s<0))throw new Error("3DTILES_subtree: TILE_GEOMETRIC_ERROR must be nonnegative");let a=ru(e.TILE_REFINE,t,1)?.[0];if(a!==void 0&&a!==0&&a!==1)throw new Error("3DTILES_subtree: TILE_REFINE must be 0 or 1");return{boundingVolume:o,geometricError:s,refine:a===void 0?void 0:a===0?ze.ADD:ze.REPLACE,transform:ru(e.TILE_TRANSFORM,t,16)}}function ru(e,t,r){if(!e)return;let n=t*r;if(n+r>e.length)throw new Error("3DTILES_subtree: attribute accessor is shorter than availability");return Array.from({length:r},(i,o)=>Number(e[n+o]))}function LI(e,t){if(e.constant===1)return t;if(e.constant===0)return 0;let r=CI.get(e);if(!r){let n=(e.explicitBitstream?.byteLength||0)*8;r=new Uint32Array(n+1);for(let i=0;i<n;i++)r[i+1]=r[i]+Number(dl(e,i));CI.set(e,r)}return r[t]}function GI(e,t){if(!e?.length)return;let r=t.split("?")[0],n=/^gltf-package:\/\/[^/]+\/(.*)$/.exec(r)?.[1],i=e.findIndex(s=>{let a=s.originalUri||s.name;return s.uri===r||!!(a&&(r===a||n===a))});if(i>=0)return{fileIndex:i,files:e};let o=e.findIndex(s=>{let a=s.originalUri||s.name;return!!(a&&(r.endsWith(`/${a}`)||r.endsWith(`:${a}`)))});return o<0?void 0:{fileIndex:o,files:e}}function zI(e,t){if(!t?.length)return e;if(!e?.length)return t;let r=new Set(t.flatMap(n=>[n.uri,n.originalUri,n.name].filter(Boolean)));return[...t,...e.filter(n=>![n.uri,n.originalUri,n.name].some(i=>i&&r.has(i)))]}function OB(e,t,r,n,i,o,s){let a=LI(e.tileAvailability,i),c=e.tilePropertyRows?.[a],l=Array.isArray(e.contentAvailability)?e.contentAvailability[0]:e.contentAvailability,h=l&&dl(l,i)?LI(l,i):-1,u=e.contentPropertyRows?.[h],f=e.tileTemplatePropertyRows?.[a]||c,d=e.contentTemplatePropertyRows?.[h]||u,m={...f,...d},p=BI(e.tileAttributes,a,"tile"),g=BI(e.contentAttributes,h,"content"),_=(t.contentUrlTemplates?.length?t.contentUrlTemplates:[t.contentUrlTemplate]).map((B,C)=>{if(!o[C]||!B)return null;let R=nu(B,n,m);if(/{[^{}]+}/.test(R))throw new Error(`Implicit content URI has unresolved template values: ${R}`);return{contentIndex:C,contentUrl:R}}).filter(B=>!!B),M=_.map(B=>B.contentUrl),b=zI(t.resourceFiles,e.resourceFiles),v=_.map(({contentIndex:B,contentUrl:C})=>{let R=GI(b,C);return{...t.contentHeaders?.[B]||(B===0?t.contentHeader:{})||{},...g,uri:C,...u?{metadata:{properties:u}}:{},...R?{_resource:R}:{}}}),T=M[0],S=t.rootLodMetricValue/2**n.level,E=p.geometricError??S,N=jI(t.rootBoundingVolume,n,t.subdivisionScheme);return{id:kI(r,n),children:s,contentUrl:T,content:v.length>1?v:v[0],contents:t.useCanonicalContents&&v.length?v:void 0,contentUrls:M,refine:p.refine||t.refine,type:FB(T),lodMetricType:t.lodMetricType,lodMetricValue:E,geometricError:E,boundingVolume:p.boundingVolume||N,transform:p.transform,transformMatrix:p.transform,metadata:c?{properties:c}:void 0,implicitMetadata:VI(e,c,u),_scaleGeometricError:t.scaleGeometricError!==!1}}function VI(e,t,r){if(!(!e.propertyTables&&e.tileMetadata===void 0&&!e.contentMetadata&&e.subtreeMetadata===void 0&&!t&&!r))return{propertyTables:e.propertyTables,tileMetadata:e.tileMetadata,contentMetadata:e.contentMetadata,subtreeMetadata:e.subtreeMetadata,tileProperties:t,contentProperties:r}}function kI(e,t){return`${e.subtreeUrl}#implicit=${t.level}/${t.x}/${t.y}/${t.z}`}function dl(e,t){if(typeof e?.constant=="number")return!!e.constant;let r=e?.explicitBitstream;if(!r)return!1;let n=Math.floor(t/8),i=t%8;return!!(r[n]>>i&1)}function BB(e,t){return(Array.isArray(e)?e:[e]).map(n=>dl(n||{constant:0},t))}function LB(e,t){return(e**t-1)/(e-1)}function DI(e,t,r){return{level:e.level+1,x:e.x*2+(t&1),y:e.y*2+(t>>1&1),z:r==="OCTREE"?e.z*2+(t>>2&1):0}}function qI(e){return e==="OCTREE"?RB:PB}function jI(e,t,r){if(e.region){let[n,i,o,s,a,c]=e.region,l=2**t.level,u=(o>=n?o-n:o+2*Math.PI-n)/l,f=(s-i)/l,d=FI(n+u*t.x),m=FI(n+u*(t.x+1)),p=i+f*t.y,g=a,y=c;if(r==="OCTREE"){let _=(c-a)/l;g=a+_*t.z,y=g+_}return{region:[d,p,m,p+f,g,y]}}if(e.box){if(e.s2VolumeInfo)return DB(e,t,r);if(e.extensions?.["3DTILES_shape_cylinder_region"])return{...e,box:[...e.box]};let n=e.box,i=2**t.level,o=-1+(2*t.x+1)/i,s=-1+(2*t.y+1)/i,a=-1+(2*t.z+1)/i,c=r==="OCTREE";return{box:[...[n[0]+n[3]*o+n[6]*s+(c?n[9]*a:0),n[1]+n[4]*o+n[7]*s+(c?n[10]*a:0),n[2]+n[5]*o+n[8]*s+(c?n[11]*a:0)],n[3]/i,n[4]/i,n[5]/i,n[6]/i,n[7]/i,n[8]/i,c?n[9]/i:n[9],c?n[10]/i:n[10],c?n[11]/i:n[11]]}}throw new Error(`Unsupported implicit 3D Tiles bounding volume: ${JSON.stringify(e)}`)}function DB(e,t,r){let n=e.s2VolumeInfo,i=hl(n.token),o=Zy(i,t.level,t.x,t.y),s=2**t.level,a=(n.maximumHeight-n.minimumHeight)/s,c={token:Zh(o),minimumHeight:n.minimumHeight+(r==="OCTREE"?a*t.z:0),maximumHeight:n.minimumHeight+(r==="OCTREE"?a*(t.z+1):a*s)},l=e.extensions?{...e.extensions}:void 0;return l?.["3DTILES_bounding_volume_S2"]&&(l["3DTILES_bounding_volume_S2"]=c),l?.["3DTILES_shape_s2"]&&(l["3DTILES_shape_s2"]=c),{...e,...l?{extensions:l}:{},s2VolumeInfo:c,box:vm(c)}}function FI(e){let t=e;for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function FB(e){if(!e)return Oi.EMPTY;let t=e.split("?")[0].split(".").pop()?.toLowerCase();switch(t){case"pnts":return Oi.POINTCLOUD;case"i3dm":case"b3dm":case"glb":case"gltf":return Oi.SCENEGRAPH;default:return t||Oi.EMPTY}}function UB(e){if(e.subdivisionScheme!=="QUADTREE"&&e.subdivisionScheme!=="OCTREE")throw new Error(`Unsupported implicit subdivision scheme: ${e.subdivisionScheme}`);if(!Number.isInteger(e.subtreeLevels)||e.subtreeLevels<1)throw new Error("Implicit subtreeLevels must be a positive integer");if(!Number.isInteger(e.maximumLevel)||e.maximumLevel<0)throw new Error("Implicit availableLevels must describe at least the root level")}var GB={draco:!1,meshopt:!1,dds:!1,ktx2:!1},zB=32,Tm=class{type=nr.TILES3D;loader;url;basePath;tileset=null;loadOptions;coreApi;contentFormats={...GB};asset;properties;extras;credits;metadata;queryParams={};tileUrlCache=new Map;tileContentHeaders=new WeakMap;nestedTilesetRoots=new WeakMap;packageNamespaces=new WeakMap;nextPackageNamespace=0;implicitSubtreeCache;implicitTilingStats={requestedSubtrees:0,loadedSubtrees:0,cacheHits:0,materializedTiles:0};destroyed=!1;extensionsUsed=[];resolver;rootTileset;spatialTransformer;preparedRootHeader;constructor(t,r={}){let n=VB(t);this.rootTileset=HI(t)?null:t,this.tileset=this.rootTileset,this.loader=n.loader,this.url=n.url,this.basePath=n.basePath||wn.dirname(n.url),this.resolver=n.resolver,this.coreApi=n.coreApi,this.loadOptions=r;let i=Number(r["3d-tiles"]?.maximumCachedSubtrees),o=Number.isFinite(i)?Math.max(0,Math.floor(i)):zB;this.implicitSubtreeCache=new Rh({maxEntries:o})}destroy(){this.destroyed=!0,this.tileUrlCache.clear(),this.implicitSubtreeCache.clear()}async initialize(){if(!this.rootTileset){let t=this.loadOptions[this.loader.id]||{};this.rootTileset=await this.loadRootData(this.url,{...this.loadOptions,[this.loader.id]:{...t,isTileset:!0}})}if(this.tileset=this.rootTileset,this.rootTileset.queryString){let t=new URLSearchParams(this.rootTileset.queryString);for(let[r,n]of t.entries())this.setQueryParameter(r,n)}if(this.asset=this.rootTileset.asset,!this.asset)throw new Error("Tileset must have an asset property.");if(this.rootTileset.formatVersion!=="2.0-draft"&&this.asset.version!=="0.0"&&this.asset.version!=="1.0"&&this.asset.version!=="1.1")throw new Error("The tileset must be 3D Tiles version 0.0, 1.0, 1.1, or 2.0-draft.");"tilesetVersion"in this.asset&&this.setQueryParameter("v",this.asset.tilesetVersion),this.properties=this.rootTileset.properties,this.extras=this.rootTileset.extras,this.credits={attributions:[]},this.extensionsUsed.splice(0,this.extensionsUsed.length,...this.rootTileset.extensionsUsed||[]),this.metadata={type:this.type,loader:this.loader,url:this.url,basePath:this.basePath,tileset:this.rootTileset,lodMetricType:this.rootTileset.lodMetricType,lodMetricValue:this.rootTileset.lodMetricValue,refine:this.rootTileset.root?.refine,spatialReference:Hd(this.rootTileset)}}getMetadata(){if(!this.metadata)throw new Error("Tiles3DSource has not been initialized");return this.metadata}async getRootTileset(){return this.getMetadata().tileset}async prepareTileset(t){let r=t.spatialReference;if(r.status==="unresolved")throw new Error(r.warnings[0]||"3D Tiles spatial operations cannot be resolved from the supplied metadata and options");r.status!=="transformable"&&r.status!=="transformed"||(this.spatialTransformer||=new ls(r,t.options.spatial),t.spatialReference=Yc(r),this.preparedRootHeader=this.transformTileHeader(this.getMetadata().tileset.root,new bt))}initializeTileHeaders(t,r,n){let i=n?r.root:this.preparedRootHeader||r.root,o=new bn(t,i,n||void 0);n&&(n.children.push(o),o.depth=n.depth+1);let s=[o];for(;s.length>0;){let a=s.pop();t.stats.get("Tiles In Tileset(s)").incrementCount();let c=a.header.children||[];for(let l of c){let h=new bn(t,l,a);if(h.contentUrl?.includes("?session=")){let f=new URL(h.contentUrl).searchParams.get("session");f&&this.setQueryParameter("session",f)}a.children.push(h),h.depth=a.depth+1,s.push(h)}}return o}createTraverser(t){return new jd(t)}async loadTileContent(t){let r=(t.contentUrls||[t.contentUrl]).filter(Boolean),n=this.tileContentHeaders.get(t),i=n||(Array.isArray(t.header?.content)?t.header.content:t.header?.content?[t.header.content]:[]);n||this.tileContentHeaders.set(t,i);let o=this.loadOptions[this.loader.id]||{},s={...this.loadOptions,[this.loader.id]:{...o,isTileset:"auto",assetGltfUpAxis:this.asset&&this.asset.gltfUpAxis||"Y",_tilesetOptions:{spatialReference:t.header?._spatialReference||t.tileset?.spatialReference,spatialOptions:t.tileset?.options.spatial,spatialTransform:t.header?._spatialTransform}}},a=await Promise.all(r.map((l,h)=>{let u=i[h]||{},f=u.extensions?.["3DTILES_content_gltf_vector"],d=u._vectorContent||(f?.vector===!0?{clip:f.clip===!0}:void 0),m=d?{...s,[this.loader.id]:{...s[this.loader.id],vectorContent:d}}:s;return this.loadContentResource(this.getTileUrl(l),u._resource,m)}));t.contents=a,t.content=a[0]||null;let c=a.filter(l=>l?.shape==="tileset3d");return{loaded:!0,contents:a,nestedTileset:c[0],nestedTilesets:c}}transformTileHeader(t,r=new bt){return this.spatialTransformer?this.transformTileHeaderWithTransformer(t,this.spatialTransformer,r):t}transformTileHeaderWithTransformer(t,r,n,i){let o=t.transform?new bt(t.transform):new bt,s=new bt(n).multiplyRight(o),a=Array.isArray(t.content)?t.content.map(c=>this.transformContentHeader(c,s,r)):t.content?this.transformContentHeader(t.content,s,r):t.content;return{...t,transform:void 0,boundingVolume:t.boundingVolume?r.transformBoundingVolume(t.boundingVolume,s):t.boundingVolume,_spatialReference:i,_spatialTransform:s.toArray(),content:a,children:Array.isArray(t.children)?t.children.map(c=>this.transformTileHeaderWithTransformer(c,r,s,i)):t.children}}transformContentHeader(t,r,n){return{...t,boundingVolume:t.boundingVolume?n.transformBoundingVolume(t.boundingVolume,r):t.boundingVolume}}async loadTileChildren(t,r){let n=t.header.implicitSubtree;if(!n)return{loaded:!1,tileCount:0,childSubtreeCount:0};let i=this.getTileUrl(n.subtreeUrl),o=await this.loadImplicitSubtreeResource(i,n.resource);if(this.destroyed||t.isDestroyed())return{loaded:!1,tileCount:0,childSubtreeCount:0};let s=Em(o,{...n,subtreeUrl:i}),a=t.header._spatialReference,c=a?new ls(a,t.tileset.options.spatial):this.spatialTransformer,l=c?this.transformTileHeaderWithTransformer(s.root,c,new bt,a):s.root;t.applyImplicitSubtreeHeader(l);let h=this.initializeMaterializedChildren(t.tileset,t,l.children);return this.implicitTilingStats.loadedSubtrees++,this.implicitTilingStats.materializedTiles+=h,{loaded:!0,tileCount:s.tileCount,childSubtreeCount:s.childSubtreeCount}}async loadTileChildrenForTraversal(t,r){WI(r);let n=await this.loadTileChildren(t,{});return WI(r),n}getImplicitTilingStats(){return{...this.implicitTilingStats,cachedSubtrees:this.implicitSubtreeCache.size-this.implicitSubtreeCache.pendingSize,pendingSubtrees:this.implicitSubtreeCache.pendingSize}}getTileUrl(t){if(t.startsWith("data:"))return t;let r=this.tileUrlCache.get(t);if(r)return r;if(!Object.keys(this.queryParams).length)return this.tileUrlCache.set(t,t),t;let[n,i=""]=t.split("?"),o=new URLSearchParams(i);for(let[c,l]of Object.entries(this.queryParams))o.has(c)||o.set(c,l);let s=o.toString(),a=s?`${n}?${s}`:n;return this.tileUrlCache.set(t,a),a}setQueryParameter(t,r){this.queryParams[t]!==r&&(this.queryParams[t]=r,this.tileUrlCache.clear())}getViewState(t){if(!t)return{asset:this.asset,properties:this.properties,extras:this.extras,credits:this.credits};let{center:r}=t.boundingVolume,n;return r&&(r[0]!==0||r[1]!==0||r[2]!==0)?(n=new I,pt.WGS84.cartesianToCartographic(r,n)):n=new I(0,0,-pt.WGS84.radii[0]),{asset:this.asset,properties:this.properties,extras:this.extras,credits:this.credits,boundingVolume:t.boundingVolume,cartographicCenter:n,cartesianCenter:r,zoom:xv(t.boundingVolume,n)}}hasExtension(t){return this.extensionsUsed.includes(t)}onTileLoaded(t,r,n){let o=(r.contents.length?r.contents:[r.content]).flatMap(c=>c?.gltf?.json.extensionsRemoved||[]);o.includes("KHR_draco_mesh_compression")&&(this.contentFormats.draco=!0),o.includes("EXT_meshopt_compression")&&(this.contentFormats.meshopt=!0),o.includes("KHR_texture_basisu")&&(this.contentFormats.ktx2=!0);let s=n.nestedTilesets||(n.nestedTileset?[n.nestedTileset]:[]),a=this.nestedTilesetRoots.get(r)||[];for(let[c,l]of s.entries()){let h=a[c];if(h&&r.children.includes(h))continue;let u=a.slice(c+1).find(d=>r.children.includes(d)),f=t._initializeTileHeaders(this.prepareNestedTileset(t,l),r);u&&(r.children.splice(r.children.indexOf(f),1),r.children.splice(r.children.indexOf(u),0,f)),a[c]=f,this.nestedTilesetRoots.set(r,a)}}prepareNestedTileset(t,r){let n=r.spatialMetadata,i=t.spatialReference;if(n?.status==="unresolved"||n?.crs.state==="unknown")throw new Error(n.warnings[0]||"Nested 3D Tiles CRS is explicitly unresolved and cannot be placed in the parent frame");if(!n||!n.sourceCrs)return this.spatialTransformer&&(i.status==="transformable"||i.status==="transformed")?{...r,spatialMetadata:i,root:this.transformTileHeaderWithTransformer(r.root,this.spatialTransformer,new bt,i)}:ew(r,i);let o=i.coordinateEpoch,s=n.coordinateEpoch;if(o!==void 0&&s!==void 0&&o!==s)throw new Error(`Nested 3D Tiles coordinate epoch ${s} differs from parent epoch ${o}; epoch-aware transformation is unavailable`);let a=i.targetCrs||i.sourceCrs;if(!a)return ew(r,n);let c=va(n,{...t.options.spatial,outputCoordinates:"target-crs",targetCrs:a});if(c.status==="unresolved")throw new Error(c.warnings[0]||"Nested 3D Tiles CRS cannot be resolved in the parent output frame");if(c.status==="native")return ew(r,c);let l=new ls(c,t.options.spatial);return{...r,spatialMetadata:c,root:this.transformTileHeaderWithTransformer(r.root,l,new bt,c)}}async loadWithCoreApi(t,r,n=this.loader){if(!this.coreApi)throw new Error("Tiles3DSource requires an injected coreApi to load tileset data");return await this.coreApi.load(t,n,r)}async loadRootData(t,r){return this.resolver?await this.resolver.loadRoot(t,this.loader,r):await this.loadWithCoreApi(t,r)}async loadResourceData(t,r,n=this.loader){return this.resolver?await this.resolver.loadResource(t,n,r):await this.loadWithCoreApi(t,r,n)}async loadContentResource(t,r,n){if(!r)return await this.loadResourceData(t,n);let i=r.files[r.fileIndex];if(!i)throw new Error(`3D Tiles package references missing file ${r.fileIndex}`);if(i.uri)return await this.loadResourceData(this.getTileUrl(i.uri),n);if(!this.coreApi)throw new Error("Tiles3DSource requires an injected coreApi to parse embedded package data");let o=await this.getPackageFileData(i),a=`gltf-package://${this.getPackageNamespace(r.files)}/${r.fileIndex}`,c=i.name||"content",l=c.lastIndexOf("/"),h=l>=0?`${a}/${c.slice(0,l)}`:a;return await this.coreApi.parse(o,this.loader,n,{url:`${a}/${c}`,filename:c,baseUrl:h,loaders:[this.loader],coreApi:this.coreApi,_parse:this.coreApi.parse,_tiles3dPackageFiles:r.files,fetch:async(u,f)=>{let d=u.startsWith(`${a}/`)?u.slice(a.length+1):u,m=r.files.find(g=>g.name===d||g.originalUri===d);if(!m)throw new Error(`3D Tiles glTF package does not contain file ${d}`);if(m.uri)return await this.coreApi.fetchFile(this.getTileUrl(m.uri),f);let p=await this.getPackageFileData(m);return new Response(p,{headers:{"content-type":m.mimeType}})}})}getPackageNamespace(t){let r=this.packageNamespaces.get(t);if(r!==void 0)return r;let n=this.nextPackageNamespace++;return this.packageNamespaces.set(t,n),n}async getPackageFileData(t){if(t.data)return wd(t.data,t.byteOffset,t.byteLength);if(t.bufferUri&&this.coreApi){let r=await this.coreApi.fetchFile(this.getTileUrl(t.bufferUri));if(!r.ok)throw new Error(`Failed to fetch 3D Tiles package buffer: HTTP ${r.status}`);let n=await r.arrayBuffer();return wd(n,t.byteOffset,t.byteLength)}throw new Error("3D Tiles package file has no available byte source")}async loadImplicitSubtreeResource(t,r){let n=this.implicitSubtreeCache.get(t);if(n)return this.implicitTilingStats.cacheHits++,await n;this.implicitTilingStats.requestedSubtrees++;let i=this.loadOptions[this.loader.id]||{};return await this.implicitSubtreeCache.getOrLoad(t,async()=>{let o={...this.loadOptions,[this.loader.id]:{...i,isTileset:!1,isSubtree:!0}};return await(r?this.loadContentResource(t,r,o):this.loadResourceData(t,o))})}initializeMaterializedChildren(t,r,n){let i=0,o=[{parentTile:r,childHeaders:n}];for(;o.length>0;){let s=o.pop();for(let a of s.childHeaders){let c=new bn(t,a,s.parentTile);s.parentTile.children.push(c),c.depth=s.parentTile.depth+1,t.stats.get("Tiles In Tileset(s)").incrementCount(),i++,a.children?.length&&o.push({parentTile:c,childHeaders:a.children})}}return i}};function WI(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted","AbortError")}function HI(e){return!!(e&&typeof e=="object"&&"url"in e&&"loader"in e&&!("type"in e))}function VB(e){return HI(e)?{...e,basePath:e.basePath||wn.dirname(e.url)}:{url:e.url,loader:e.loader,basePath:e.basePath||wn.dirname(e.url),resolver:e.resolver,coreApi:e.coreApi}}function ew(e,t){let r=n=>({...n,_spatialReference:t,children:Array.isArray(n.children)?n.children.map(r):n.children});return{...e,spatialMetadata:t,root:r(e.root)}}co();Dr();qt();var Im=class{frameNumberMap=new Map;register(t,r){let n=this.frameNumberMap.get(t)||new Map,i=n.get(r)||0;n.set(r,i+1),this.frameNumberMap.set(t,n)}deregister(t,r){let n=this.frameNumberMap.get(t);if(!n)return;let i=n.get(r)||1;n.set(r,i-1)}isZero(t,r){return(this.frameNumberMap.get(t)?.get(r)||0)===0}};var rw={REQUESTED:"REQUESTED",COMPLETED:"COMPLETED",ERROR:"ERROR"},Am=class{_statusMap;pendingTilesRegister=new Im;constructor(){this._statusMap={}}add(t,r,n,i){if(!this._statusMap[r]){let{frameNumber:o,viewport:{id:s}}=i;this._statusMap[r]={request:t,callback:n,key:r,frameState:i,status:rw.REQUESTED},this.pendingTilesRegister.register(s,o),t().then(a=>{this._statusMap[r].status=rw.COMPLETED;let{frameNumber:c,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,c),this._statusMap[r].callback(a,i)}).catch(a=>{this._statusMap[r].status=rw.ERROR;let{frameNumber:c,viewport:{id:l}}=this._statusMap[r].frameState;this.pendingTilesRegister.deregister(l,c),n(a)})}}update(t,r){if(this._statusMap[t]){let{frameNumber:n,viewport:{id:i}}=this._statusMap[t].frameState;this.pendingTilesRegister.deregister(i,n);let{frameNumber:o,viewport:{id:s}}=r;this.pendingTilesRegister.register(s,o),this._statusMap[t].frameState=r}}find(t){return this._statusMap[t]}hasPendingTiles(t,r){return!this.pendingTilesRegister.isZero(t,r)}};var Pm=class extends Bi{_tileManager;constructor(t){super(t),this._tileManager=new Am}traversalFinished(t){return!this._tileManager.hasPendingTiles(t.viewport.id,this._frameNumber||0)}shouldRefine(t,r){return t._lodJudge=qd(t,r),t._lodJudge==="DIG"}updateChildTiles(t,r){let n=t.header.children||[],i=t.children;for(let o of n){let s=`${o.id}-${r.viewport.id}`,a=i&&i.find(c=>c.id===s||c.header?.id===o.id);if(a)a&&this.updateTile(a,r);else{let c=()=>this._loadTile(t,o.id,r);this._tileManager.find(s)?this._tileManager.update(s,r):this._tileManager.add(c,s,h=>this._onTileLoad(h,t,s),r)}}return!1}async _loadTile(t,r,n){if(!t.tileset.source.loadChildTileHeader)throw new Error("I3S source does not support child tile header loading");return await t.tileset.source.loadChildTileHeader(t,r,n)}_onTileLoad(t,r,n){if(t instanceof Error){r.tileset._onSourceError(t,r);return}let i=new bn(r.tileset,t,r,n);r.children.push(i);let o=this._tileManager.find(i.id).frameState;this.updateTile(i,o),this._frameNumber===o.frameNumber&&(this.traversalFinished(o)||new Date().getTime()-this.lastUpdate>this.updateDebounceTime)&&this.executeTraversal(i,o)}};qt();Dr();var pl=class{spatialReference;targetCoordinateFrame;positionTransformer;sourceToGeographicTransformer;geographicToTargetTransformer;sourceCoordinateFrame;sourceVerticalUnitScale;elevationMode;elevationOffset;elevationProvider;providerUnitScale;providerHeightTransformer;constructor(t,r={}){if(t.status!=="transformable"&&t.status!=="transformed")throw new Error("I3SSpatialTransformer requires a requested, transformable spatial output");let n=t.targetCrs||t.sourceCrs;if(!n)throw new Error("I3S spatial transformation requires a target CRS");if(this.positionTransformer=new Hn(t,r),this.sourceCoordinateFrame=t.coordinateFrame,this.sourceVerticalUnitScale=t.verticalUnitScale,this.elevationMode=t.elevationMode,this.elevationOffset=(t.elevationOffset||0)*t.elevationUnitScale,this.elevationProvider=kB(this.elevationMode,r),this.elevationProvider&&(typeof this.elevationProvider.sampleElevations!="function"||typeof this.elevationProvider.getElevationRange!="function"))throw new Error("An I3S elevation provider must implement sampleElevations() and getElevationRange()");let i=Gh(this.elevationProvider?.unit||"meter");if(this.elevationProvider&&i===void 0)throw new Error(`Unsupported elevation-provider unit ${this.elevationProvider.unit}`);this.providerUnitScale=i||1,this.targetCoordinateFrame=_n(n),this.spatialReference=Yc(t);let o=Mn({sourceCrs:t.sourceCrs,heightReference:t.heightReference,coordinateFrame:t.coordinateFrame,axisOrder:t.axisOrder,provenance:t.provenance},{targetCrs:"EPSG:4326"});if(this.sourceToGeographicTransformer=new Hn(o),ml(this.elevationMode)){if(!this.elevationProvider){let c=this.elevationMode==="relativeToScene"?"scene":"terrain";throw new Error(`I3S elevation mode ${this.elevationMode} requires a ${c} elevation provider`)}if(t.heightReference==="unknown")throw new Error(`I3S elevation mode ${this.elevationMode} requires a known source height reference`);let a=this.elevationProvider.heightReference||t.heightReference;if(a!==t.heightReference){if(t.heightReference!=="ellipsoidal"&&t.heightReference!=="orthometric")throw new Error("Converting elevation-provider heights requires an ellipsoidal or orthometric source height reference");let c=Mn({sourceCrs:"EPSG:4326",heightReference:a,coordinateFrame:"geographic",axisOrder:"xyz",provenance:"caller-override"},{targetCrs:"EPSG:4326",targetHeightReference:t.heightReference,geoidModel:r.geoidModel});this.providerHeightTransformer=new Hn(c,r)}}let s=Mn({sourceCrs:"EPSG:4326",heightReference:t.heightReference,coordinateFrame:"geographic",axisOrder:"xyz",provenance:"format-default"},{targetCrs:n,targetHeightReference:t.targetHeightReference,geoidModel:r.geoidModel});this.geographicToTargetTransformer=new Hn(s,r)}transformPosition(t){let r=this.placeSourcePositionsSync(t),n=this.positionTransformer.transformPosition([r[0],r[1],r[2]]);return[n[0],n[1],n[2]]}async transformPositionAsync(t){let r=await this.placeSourcePositions(t),n=this.positionTransformer.transformPosition([r[0],r[1],r[2]]);return[n[0],n[1],n[2]]}transformPlacedPosition(t){let r=this.positionTransformer.transformPosition([t[0],t[1],t[2]]);return[r[0],r[1],r[2]]}transformSourcePositionToGeographic(t){let r=this.placeSourcePositionsSync(t),n=this.sourceToGeographicTransformer.transformPosition([r[0],r[1],r[2]]);return[n[0],n[1],n[2]]}async transformSourcePositionToGeographicAsync(t){let r=await this.placeSourcePositions(t),n=this.sourceToGeographicTransformer.transformPosition([r[0],r[1],r[2]]);return[n[0],n[1],n[2]]}transformPositions(t,r){let n=this.placeSourcePositionsSync(t),i=this.placeSourcePositionsSync(r);return this.transformPlacedPositions(n,i)}async transformPositionsAsync(t,r){let n=new Float64Array(t.length+3);n.set(Array.from(t),0),n.set(Array.from(r).slice(0,3),t.length);let i=await this.placeSourcePositions(n);return this.transformPlacedPositions(i.subarray(0,t.length),i.subarray(t.length))}async transformGeometryAsync(t,r,n="earth-centered"){if(t.length%3||r&&r.length!==t.length)throw new Error("Conversion positions and normals must contain matching finite xyz triples");for(let o=0;o<t.length;o++)if(!Number.isFinite(t[o])||r&&!Number.isFinite(r[o]))throw new Error("Conversion positions and normals must contain matching finite xyz triples");if(!["earth-centered","vertex-reference-frame"].includes(n))throw new Error("Unsupported I3S normal reference frame");let i=await this.placeSourcePositions(t);return{positions:this.positionTransformer.transformPositions(i),normals:r?this.transformNormals(r,i,n):void 0}}transformPlacedPositions(t,r){let n=this.transformPlacedPosition(r),i=new Float32Array(t.length),o=Float64Array.from(t);for(let c=0;c<t.length;c+=3){let l=this.transformPlacedPosition([t[c],t[c+1],t[c+2]]);i[c]=l[0]-n[0],i[c+1]=l[1]-n[1],i[c+2]=l[2]-n[2]}let s=this.targetCoordinateFrame==="geographic",a=s?new bt:new bt().translate(n);return{positions:i,sourcePositions:o,origin:n,cartographicOrigin:s?n:[0,0,0],coordinateSystem:s?"lnglat-offsets":"cartesian",modelMatrix:a}}transformNormals(t,r,n="earth-centered"){if(t.length!==r.length||t.length%3)throw new Error("I3S normals and positions must have matching xyz component counts");let i=new Float32Array(t.length);if(n==="earth-centered"&&(this.spatialReference.targetCrs||this.spatialReference.sourceCrs)==="EPSG:4978"){for(let o=0;o<t.length;o+=3){let s=Math.hypot(t[o],t[o+1],t[o+2]);for(let a=0;a<3;a++)i[o+a]=s?t[o+a]/s:t[o+a]}return i}for(let o=0;o<t.length;o+=3){let s=this.sourceToGeographicTransformer.transformPosition([r[o],r[o+1],r[o+2]]),a=new I([t[o],t[o+1],t[o+2]]).normalize(),c=n==="earth-centered"?a:ZI(a,s),l=this.transformEcefNormal(c,s);i.set(l,o)}return i}transformBoundingVolume(t){let n=this.getGeographicBoundSamples(t).map(i=>this.geographicToTargetTransformer.transformPosition(i));return this.targetCoordinateFrame==="geographic"?{region:hs(n)}:{box:Na(n)}}async transformBoundingVolumeAsync(t){let n=(await this.getGeographicBoundSamplesAsync(t)).map(i=>this.geographicToTargetTransformer.transformPosition(i));return this.targetCoordinateFrame==="geographic"?{region:hs(n)}:{box:Na(n)}}transformBoundingVolumeToGeographic(t){return{region:hs(this.getGeographicBoundSamples(t))}}async transformBoundingVolumeToGeographicAsync(t){return{region:hs(await this.getGeographicBoundSamplesAsync(t))}}transformBoundingVolumeToGeocentric(t){let r=this.getGeographicBoundSamples(t).map(n=>Array.from(pt.WGS84.cartographicToCartesian(new I(n))));return{box:Na(r)}}async transformBoundingVolumeToGeocentricAsync(t){let r=(await this.getGeographicBoundSamplesAsync(t)).map(n=>Array.from(pt.WGS84.cartographicToCartesian(new I(n))));return{box:Na(r)}}transformBoundingSphereToGeographic(t){let r=t.mbs?.length?Array.from(t.mbs).slice(0,3):t.obb?Array.from(t.obb.center).slice(0,3):null;if(!r)throw new Error("I3S spatial transformation requires an MBS or OBB bound");let n=this.placeSourcePositionsSync(r),i=this.sourceToGeographicTransformer.transformPosition(Array.from(n)),o=t.mbs?.length?t.mbs[3]:Math.hypot(...Array.from(t.obb.halfSize).slice(0,3));return[i[0],i[1],i[2],o]}async transformBoundingSphereToGeographicAsync(t){return $I(await this.getGeographicBoundSamplesAsync(t))}async transformBoundsAsync(t){let r=await this.getGeographicBoundSamplesAsync(t),n=r.map(o=>Array.from(pt.WGS84.cartographicToCartesian(new I(o)))),i=r.map(o=>this.geographicToTargetTransformer.transformPosition(o));return{boundingVolume:{box:Na(n)},spatialBoundingVolume:this.targetCoordinateFrame==="geographic"?{region:hs(i)}:{box:Na(i)},i3sLodMbs:ml(this.elevationMode)?$I(r):this.transformBoundingSphereToGeographic(t)}}async transformPointCloudBoundsAsync(t){let r=await this.getGeographicBoundSamplesAsync(t),n=r.map(i=>this.geographicToTargetTransformer.transformPosition(i));return{boundingVolume:{region:hs(r)},spatialBoundingVolume:this.targetCoordinateFrame==="geographic"?{region:hs(n)}:{box:Na(n)}}}getGeographicBoundSamples(t){let r=YI(t,this.sourceCoordinateFrame,this.sourceToGeographicTransformer,this.sourceVerticalUnitScale);if(!r.length)throw new Error("I3S spatial transformation requires an MBS or OBB bound");let n=this.placeSourcePositionsSync(r.flat(),!0),i=nw(n);return this.sourceCoordinateFrame==="geographic"?i:i.map(o=>this.sourceToGeographicTransformer.transformPosition(o))}async getGeographicBoundSamplesAsync(t){let r=YI(t,this.sourceCoordinateFrame,this.sourceToGeographicTransformer,this.sourceVerticalUnitScale);if(!r.length)throw new Error("I3S spatial transformation requires an MBS or OBB bound");if(ml(this.elevationMode)){let i=this.sourceCoordinateFrame==="geographic"?r:r.map(o=>this.sourceToGeographicTransformer.transformPosition(o));return await this.placeGeographicBoundSamples(i)}let n=nw(await this.placeSourcePositions(r.flat(),!0));return this.sourceCoordinateFrame==="geographic"?n:n.map(i=>this.sourceToGeographicTransformer.transformPosition(i))}async placeGeographicBoundSamples(t){let n=await this.elevationProvider.getElevationRange(qB(t)),i=n.minimum*this.providerUnitScale,o=n.maximum*this.providerUnitScale;if(!Number.isFinite(i)||!Number.isFinite(o)||i>o)throw new Error("Elevation provider returned an invalid range; minimum and maximum must be finite and ordered");let s=t.map(h=>h[2]),a=Math.min(...s),c=Math.max(...s),l=[];for(let[h,u]of t){let f=this.providerHeightTransformer?this.providerHeightTransformer.transformPosition([h,u,i])[2]:i,d=this.providerHeightTransformer?this.providerHeightTransformer.transformPosition([h,u,o])[2]:o,m=Math.min(f,d),p=Math.max(f,d),g=this.elevationMode==="onTheGround"?m:m+a+this.elevationOffset,y=this.elevationMode==="onTheGround"?p:p+c+this.elevationOffset;l.push([h,u,g],[h,u,y])}return l}placeSourcePositionsSync(t,r=!1){if(ml(this.elevationMode))throw new Error(`I3S elevation mode ${this.elevationMode} requires asynchronous surface placement`);let n=Float64Array.from(t),i=this.elevationMode==="absoluteHeight"?this.elevationOffset:0;for(let o=2;o<n.length;o+=3)n[o]=n[o]*(r?1:this.sourceVerticalUnitScale)+i;return n}async placeSourcePositions(t,r=!1){if(!ml(this.elevationMode))return this.placeSourcePositionsSync(t,r);let n=Float64Array.from(t),i=nw(n).map(s=>{let a=this.sourceToGeographicTransformer.transformPosition(s);return[a[0],a[1]]}),o=await this.elevationProvider.sampleElevations(i);if(o.length!==i.length)throw new Error(`Elevation provider returned ${o.length} heights for ${i.length} positions`);for(let s=0;s<i.length;s++){let a=o[s]*this.providerUnitScale;if(!Number.isFinite(a))throw new Error(`Elevation provider returned a non-finite height at index ${s}`);let[c,l]=i[s],h=this.providerHeightTransformer?this.providerHeightTransformer.transformPosition([c,l,a])[2]:a,u=n[s*3+2]*(r?1:this.sourceVerticalUnitScale);n[s*3+2]=this.elevationMode==="onTheGround"?h:h+u+this.elevationOffset}return n}transformEcefNormal(t,r){if(this.targetCoordinateFrame==="geocentric")return t.normalize();if(this.targetCoordinateFrame==="geographic")return WB(t,r).normalize();let n=pt.WGS84.cartographicToCartesian(new I(r)),i=[];for(let s of jB()){let a=pt.WGS84.cartesianToCartographic(new I(n).add(s)),c=pt.WGS84.cartesianToCartographic(new I(n).subtract(s)),l=this.geographicToTargetTransformer.transformPosition(a),h=this.geographicToTargetTransformer.transformPosition(c);i.push((l[0]-h[0])/2,(l[1]-h[1])/2,(l[2]-h[2])/2)}let o=new Qr(i);if(Math.abs(o.determinant())<1e-12)throw new Error("Cannot transform an I3S normal through a singular local projection");return o.invert().transpose(),new I(t).transformByMatrix3(o).normalize()}};function kB(e,t){return e==="relativeToScene"?t.sceneElevationProvider:ml(e)?t.terrainElevationProvider:void 0}function ml(e){return e==="onTheGround"||e==="relativeToGround"||e==="relativeToScene"}function nw(e){if(e.length%3!==0)throw new Error("I3S position arrays must contain complete XYZ tuples");let t=[];for(let r=0;r<e.length;r+=3)t.push([e[r],e[r+1],e[r+2]]);return t}function qB(e){let t=hs(e);return{west:t[0]*180/Math.PI,south:t[1]*180/Math.PI,east:t[2]*180/Math.PI,north:t[3]*180/Math.PI}}function $I(e){if(!e.length)throw new Error("I3S spatial transformation requires at least one bound sample");let t=e.map(o=>pt.WGS84.cartographicToCartesian(new I(o))),r=new I;for(let o of t)r.add(o);r.scale(1/t.length);let n=0;for(let o of t)n=Math.max(n,new I(o).subtract(r).magnitude());let i=pt.WGS84.cartesianToCartographic(r);return[i[0],i[1],i[2],n]}function YI(e,t,r,n){let i=e.obb;if(i){let c=Array.from(i.center).slice(0,3);c[2]*=n;let l=Array.from(i.halfSize).slice(0,3),h=new Xi().fromArray(Array.from(i.quaternion)),u=[new I([l[0],0,0]).transformByQuaternion(h),new I([0,l[1],0]).transformByQuaternion(h),new I([0,0,l[2]]).transformByQuaternion(h)];if(t==="geographic"){let f=r.transformPosition(c),d=pt.WGS84.cartographicToCartesian(new I(f)),m=e.normalReferenceFrame==="vertex-reference-frame"?u.map(p=>ZI(p,f)):u;return KI().map(p=>{let g=new I(d);for(let y=0;y<3;y++)g.add(new I(m[y]).scale(p[y]));return Array.from(pt.WGS84.cartesianToCartographic(g))})}return KI().map(f=>{let d=new I(c);for(let m=0;m<3;m++)d.add(new I(u[m]).scale(f[m]));return Array.from(d)})}let o=e.mbs?Array.from(e.mbs):[];if(o.length<4)return[];let s=o.slice(0,3);s[2]*=n;let a=o[3];if(t==="geographic"){let c=r.transformPosition(s),l=pt.WGS84.cartographicToCartesian(new I(c));return XI().map(h=>Array.from(pt.WGS84.cartesianToCartographic(new I(l).add(new I(h).scale(a)))))}return XI().map(c=>Array.from(new I(s).add(new I(c).scale(a))))}function KI(){return[-1,1].flatMap(e=>[-1,1].flatMap(t=>[-1,1].map(r=>[e,t,r])))}function XI(){return[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]]}function jB(){return[new I([1,0,0]),new I([0,1,0]),new I([0,0,1])]}function ZI(e,t){let r=t[0]*Math.PI/180,n=t[1]*Math.PI/180,i=new I([-Math.sin(r),Math.cos(r),0]),o=new I([-Math.sin(n)*Math.cos(r),-Math.sin(n)*Math.sin(r),Math.cos(n)]),s=new I([Math.cos(n)*Math.cos(r),Math.cos(n)*Math.sin(r),Math.sin(n)]);return i.scale(e[0]).add(o.scale(e[1])).add(s.scale(e[2]))}function WB(e,t){let r=t[0]*Math.PI/180,n=t[1]*Math.PI/180,i=new I([-Math.sin(r),Math.cos(r),0]),o=new I([-Math.sin(n)*Math.cos(r),-Math.sin(n)*Math.sin(r),Math.cos(n)]),s=new I([Math.cos(n)*Math.cos(r),Math.cos(n)*Math.sin(r),Math.sin(n)]);return new I([i.dot(e),o.dot(e),s.dot(e)])}function Na(e){let t=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(let o of e)for(let s=0;s<3;s++)t[s]=Math.min(t[s],o[s]),r[s]=Math.max(r[s],o[s]);let n=t.map((o,s)=>(o+r[s])/2),i=t.map((o,s)=>(r[s]-o)/2);return[n[0],n[1],n[2],i[0],0,0,0,i[1],0,0,0,i[2]]}function hs(e){let t=e[0][0],r=1/0,n=-1/0,i=1/0,o=-1/0,s=1/0,a=-1/0;for(let c of e){let l=t+iw(c[0]-t);r=Math.min(r,l),n=Math.max(n,l),i=Math.min(i,c[1]),o=Math.max(o,c[1]),s=Math.min(s,c[2]),a=Math.max(a,c[2])}return[iw(r)*Math.PI/180,i*Math.PI/180,iw(n)*Math.PI/180,o*Math.PI/180,s,a]}function iw(e){return((e+180)%360+360)%360-180}var HB={draco:!1,meshopt:!1,dds:!1,ktx2:!1},Rm=class{type=nr.I3S;loader;contentLoader;url;basePath;tileset=null;loadOptions;coreApi;contentFormats={...HB};asset;properties;extras;credits;metadata;queryParams={};resolver;rootTileset;spatialTransformer;preparedRootHeader;constructor(t,r={}){let n=YB(t);this.rootTileset=QI(t)?null:t,this.tileset=this.rootTileset,this.loader=n.loader,this.contentLoader=$B(n.loader),this.url=n.url,this.basePath=n.basePath||wn.dirname(n.url),this.resolver=n.resolver,this.coreApi=n.coreApi,this.loadOptions=r,this.initializeQueryParams(r)}async initialize(){this.rootTileset||(this.rootTileset=await this.loadRootData(this.getTileUrl(this.url),{...this.loadOptions,i3s:{...this.loadOptions.i3s,isTileset:!0}})),this.tileset=this.rootTileset,this.rootTileset.root&&typeof this.rootTileset.root.then=="function"&&(this.rootTileset.root=await this.rootTileset.root),this.metadata={type:this.type,loader:this.loader,url:this.url,basePath:this.basePath,tileset:this.rootTileset,lodMetricType:this.rootTileset.lodMetricType,lodMetricValue:this.rootTileset.lodMetricValue,refine:this.rootTileset.root?.refine,spatialReference:Wd(this.rootTileset)}}getMetadata(){if(!this.metadata)throw new Error("I3SSource has not been initialized");return this.metadata}async getRootTileset(){return this.getMetadata().tileset}async prepareTileset(t){let r=t.spatialReference;if(r.status==="unresolved")throw new Error(r.warnings[0]||"I3S spatial operations cannot be resolved from the supplied metadata and options");r.status!=="transformable"&&r.status!=="transformed"||(this.spatialTransformer||=new pl(r,t.options.spatial),t.spatialReference=this.spatialTransformer.spatialReference,this.preparedRootHeader=await this.transformTileHeader(this.getMetadata().tileset.root))}initializeTileHeaders(t,r,n){let i=n?r.root:this.preparedRootHeader||r.root;if(this.spatialTransformer&&!this.preparedRootHeader)throw new Error("I3S spatial root header was not prepared before tile initialization");let o=new bn(t,i,n||void 0);return n&&(n.children.push(o),o.depth=n.depth+1),o}createTraverser(t){return new Pm(t)}async loadTileContent(t){let r=this.getTileUrl(t.contentUrl),n=this.loader.id,i=this.loadOptions[n]||{},o=this.getMetadata(),s={...this.loadOptions,[n]:{...i,...t.tileset.options.i3s,_tileOptions:{attributeUrls:t.header.attributeUrls,textureUrl:t.header.textureUrl,textureUrls:t.header.textureUrls,textureFormat:t.header.textureFormat,textureLoaderOptions:t.header.textureLoaderOptions,materialDefinition:t.header.materialDefinition,layerType:t.header.layerType,pointRenderer:t.header.pointRenderer,pointSymbol:t.header.pointSymbol,isDracoGeometry:t.header.isDracoGeometry,mbs:t.header.mbs},_tilesetOptions:{store:o.tileset.store,attributeStorageInfo:o.tileset.attributeStorageInfo,fields:o.tileset.fields,spatialReference:t.tileset.spatialReference,spatialOptions:t.tileset.options.spatial},isTileHeader:!1}};t.content=await this.loadResourceData(r,s,this.contentLoader);let a={index:0,uri:t.contentUrl,type:t.header.layerType,payload:t.content,metadata:t.header.metadata||null,boundingVolume:t.boundingVolume,featureIds:t.featureIdSets,renderable:!!t.content};return{loaded:!0,contents:[t.content],contentEntries:[a]}}async loadChildTileHeader(t,r,n){let i=this.getMetadata();if(i.tileset.nodePages||i.tileset.pointNodePages){let l=await i.tileset.nodePagesTile.formTileFromNodePages(r);return await this.transformTileHeader(l)}let o=this.getTileUrl(`${this.url}/nodes/${r}`),s=this.loadOptions.i3s&&typeof this.loadOptions.i3s=="object"?this.loadOptions.i3s:{},a={...this.loadOptions,i3s:{...s,isTileHeader:!0}},c=await this.loadResourceData(o,a);return await this.transformTileHeader(c)}async loadTileChildrenForTraversal(t,r){let n=t.header.children||[],i=0,o=[];for(let a of n){JI(r);let c=a.id;if(typeof c!="string"&&typeof c!="number")throw new Error("I3S child header is missing its node ID");let l=t.children.find(f=>f.id===String(c)||f.header?.id===c);if(l){o.push(l);continue}let h=await this.loadChildTileHeader(t,String(c),null);JI(r);let u=new bn(t.tileset,h,t,String(c));o.push(u),i++}let s=new Set(o);return t.children=[...o,...t.children.filter(a=>!s.has(a))],{loaded:!0,tileCount:i,childSubtreeCount:0}}getTileUrl(t){if(t.startsWith("data:")||!Object.keys(this.queryParams).length)return t;let r=t.indexOf("#"),n=r>=0?t.slice(r):"",i=r>=0?t.slice(0,r):t,o=i.indexOf("?"),s=o===-1?i:i.slice(0,o),a=o===-1?"":i.slice(o+1),c=new URLSearchParams(a),l=new URLSearchParams;for(let[u,f]of Object.entries(this.queryParams))c.has(u)||l.set(u,f);let h=l.toString();return`${s}${a?`?${a}`:""}${h?`${a?"&":"?"}${h}`:""}${n}`}getViewState(t){if(this.spatialTransformer&&t){let o=new I(t.boundingVolume.center),s=new I(t.header.i3sLodMbs.slice(0,3));return this.spatialTransformer.targetCoordinateFrame==="geographic"?{boundingVolume:t.boundingVolume,cartographicCenter:s,cartesianCenter:o,zoom:1}:{boundingVolume:t.boundingVolume,cartographicCenter:s,cartesianCenter:o,zoom:1}}let r=this.getMetadata(),n=r.tileset.fullExtent;if(n){let{xmin:o,xmax:s,ymin:a,ymax:c,zmin:l,zmax:h}=n,u=new I(o+(s-o)/2,a+(c-a)/2,l+(h-l)/2),f=new I;return pt.WGS84.cartographicToCartesian(u,f),{cartographicCenter:u,cartesianCenter:f,zoom:F1(n,u,f)}}let i=r.tileset.store?.extent;if(i){let[o,s,a,c]=i,l=new I(o+(a-o)/2,s+(c-s)/2,0),h=new I;return pt.WGS84.cartographicToCartesian(l,h),{cartographicCenter:l,cartesianCenter:h,zoom:Sv(i,l,h)}}return console.warn("Extent is not defined in the tileset header"),{cartographicCenter:new I,zoom:1}}onTileLoaded(t,r){switch(r.header.isDracoGeometry&&(this.contentFormats.draco=!0),r.header.textureFormat){case"dds":this.contentFormats.dds=!0;break;case"ktx2":this.contentFormats.ktx2=!0;break;default:}}getTilesTotalCount(){return this.getMetadata().tileset?.nodePagesTile?.nodesInNodePages||null}async loadWithCoreApi(t,r,n=this.loader){if(!this.coreApi)throw new Error("I3SSource requires an injected coreApi to load tileset data");return await this.coreApi.load(t,n,r)}async loadRootData(t,r){return this.resolver?await this.resolver.loadRoot(t,this.loader,r):await this.loadWithCoreApi(t,r)}initializeQueryParams(t){for(let[n,i]of Object.entries(t.searchParams||{}))this.queryParams[n]=String(i);let r=t.i3s;if(r&&typeof r=="object"&&"token"in r){let n=r.token;typeof n=="string"&&(this.queryParams.token=n)}}async loadResourceData(t,r,n=this.loader){return this.resolver?await this.resolver.loadResource(t,n,r):await this.loadWithCoreApi(t,r,n)}async transformTileHeader(t){if(!this.spatialTransformer)return t;let r={mbs:t.mbs,obb:t.obb,normalReferenceFrame:this.getMetadata().tileset.store?.normalReferenceFrame},n=await this.spatialTransformer.transformBoundsAsync(r);return{...t,boundingVolume:n.boundingVolume,spatialBoundingVolume:n.spatialBoundingVolume,i3sLodMbs:n.i3sLodMbs}}};function JI(e){if(e?.aborted)throw e.reason??new DOMException("The operation was aborted","AbortError")}function $B(e){return e.contentLoader||e}function QI(e){return!!(e&&typeof e=="object"&&"url"in e&&"loader"in e&&!("type"in e))}function YB(e){return QI(e)?{...e,basePath:e.basePath||wn.dirname(e.url)}:{url:e.url,loader:e.loader,basePath:e.basePath||wn.dirname(e.url),resolver:e.resolver,coreApi:e.coreApi}}qt();ro();var gl=class{header;parent;children=[];childrenLoaded=!1;childrenPromise=null;selected=!1;viewportIds=[];content=null;contentAvailable=!1;contentFailed=!1;isContentLoading=!1;constructor(t,r=null){this.header=t,this.parent=r}get id(){return this.header.id}get level(){return this.header.level}get pointCount(){return this.header.pointCount}get geometricError(){return this.header.geometricError}get boundingVolume(){return this.header.boundingVolume}setSelected(t){this.selected=!0,this.viewportIds.includes(t)||this.viewportIds.push(t)}clearSelection(){this.selected=!1,this.viewportIds=[]}};var KB={debounceTime:0,minimumNodePixelSize:150,maximumScreenSpaceError:1,lodSelectionMetricType:"maxScreenThresholdSQ",densityThreshold:1,pointBudget:2e6,maxDepth:Number.POSITIVE_INFINITY,onTileLoad:()=>{},onTileError:()=>{},onTraversalComplete:e=>e,onUpdate:()=>{}},Cm=64,Nm=class{dataSource;options;root=null;cartographicCenter=null;zoom=1;boundingVolume=null;visibleTilesCount=0;frameNumberValue=0;pendingCount=0;lastUpdatedViewports=null;updatePromise=null;tilesMap=new Map;constructor(t,r={}){this.dataSource=t,this.options={...KB,...r},this.tilesetInitializationPromise=this.initialize()}tilesetInitializationPromise;get isReady(){return this.dataSource.isReady}get frameNumber(){return this.frameNumberValue}get tiles(){return Array.from(this.tilesMap.values())}isLoaded(){return this.frameNumberValue>0&&this.pendingCount===0&&this.selectedTiles.every(t=>t.contentAvailable||t.contentFailed)}selectedTiles=[];update(t=null){this.selectTiles(t).catch(()=>{})}destroy(){this.selectedTiles=[],this.tilesMap.clear(),this.root=null,this.cartographicCenter=null,this.boundingVolume=null,this.visibleTilesCount=0,this.pendingCount=0,this.lastUpdatedViewports=null,this.updatePromise=null}async initialize(){await this.dataSource.initialize();let t=await this.dataSource.getRootTile();this.root=this.getOrCreateTile(t,null);let r=await this.dataSource.getViewState?.();this.boundingVolume=r?.boundingVolume||this.root.boundingVolume;let n=r?.cartographicCenter||this.root.boundingVolume.center;this.cartographicCenter=new I(n),this.zoom=r?.zoom||this.estimateZoom(this.boundingVolume)}async selectTiles(t=null){return await this.tilesetInitializationPromise,t&&(this.lastUpdatedViewports=t),this.updatePromise||(this.updatePromise=new Promise((r,n)=>{setTimeout(()=>{this.doSelectTiles().then(()=>r(this.frameNumberValue)).catch(n).finally(()=>{this.updatePromise=null})},this.options.debounceTime)})),this.updatePromise}async doSelectTiles(){if(!this.root||!this.lastUpdatedViewports)return;let t=new Set(this.selectedTiles.map(a=>a.id));for(let a of this.tilesMap.values())a.clearSelection();this.frameNumberValue++;let r=Array.isArray(this.lastUpdatedViewports)?this.lastUpdatedViewports:[this.lastUpdatedViewports],n=new Map,i=new Set,o=0;for(let a of r){let c=this.getTraversalContext(a);o=await this.traverseTiles(c,n,o,i)}this.visibleTilesCount=i.size,this.selectedTiles=this.options.onTraversalComplete(Array.from(n.values()));for(let a of this.selectedTiles)this.loadTile(a).catch(()=>{});let s=new Set(this.selectedTiles.map(a=>a.id));this.haveSameIds(t,s)||this.options.onUpdate()}async traverseTiles(t,r,n,i){if(!this.root)return n;let o=n,s=[{tile:this.root,weight:this.estimateScreenRadius(this.root,t.viewport)}];for(;s.length>0;){s.sort((u,f)=>f.weight-u.weight);let a=s.shift();if(!a)break;let{tile:c,weight:l}=a;if(!this.isVisible(c,t))continue;if(i.add(c.id),!r.has(c.id)&&c.pointCount>0){if(o>0&&o+c.pointCount>this.options.pointBudget)break;r.set(c.id,c),o+=c.pointCount}if(r.has(c.id)&&c.setSelected(t.viewport.id),!this.shouldRefine(c,l))continue;let h=await this.getVisibleChildren(c,t);h.length>0&&s.push(...h)}return o}shouldRefine(t,r){if(t.level<this.options.maxDepth&&Number.isFinite(r)&&(t.header.lodSelectionMetricType||this.options.lodSelectionMetricType)==="density-threshold"){let n=Math.max(1,Math.PI*r*r),i=t.pointCount/n,o=t.header.lodThreshold||this.options.densityThreshold;return i<o}return t.level<this.options.maxDepth&&Number.isFinite(r)&&r>=this.options.minimumNodePixelSize}getTraversalContext(t){let r=this.getCullingVolume(t);return{viewport:t,cullingVolume:this.shouldUseCullingVolume(t,r)?r:null}}isVisible(t,r){if(r.cullingVolume){let i=this.getCommonSpaceBoundingSphere(t.boundingVolume,r.viewport);if(i)return this.isBoundingSphereInsideCullingVolume(i,r.cullingVolume)}let n=this.getProjectedFootprint(t.boundingVolume,r.viewport);return n?this.isProjectedFootprintVisible(n,r.viewport):!1}shouldUseCullingVolume(t,r){if(!this.root||!r)return!1;let n=this.getCommonSpaceBoundingSphere(this.root.boundingVolume,t);if(!n)return!1;if(this.isBoundingSphereInsideCullingVolume(n,r))return!0;let i=this.getProjectedFootprint(this.root.boundingVolume,t);return!i||!this.isProjectedFootprintVisible(i,t)}isBoundingSphereInsideCullingVolume(t,r){return r.computeVisibilityWithPlaneMask(t,sr.MASK_INDETERMINATE)!==sr.MASK_OUTSIDE}isProjectedFootprintVisible(t,r){return!(t.x+t.radius<-Cm||t.x-t.radius>r.width+Cm||t.y+t.radius<-Cm||t.y-t.radius>r.height+Cm)}estimateScreenRadius(t,r){let n=this.getProjectedFootprint(t.boundingVolume,r);return n?n.radius:0}projectBounds(t,r){let n=this.getBoundingVolumeCorners(t),i=Number.POSITIVE_INFINITY,o=Number.POSITIVE_INFINITY,s=Number.NEGATIVE_INFINITY,a=Number.NEGATIVE_INFINITY;try{for(let c of n){let[l,h]=r.project(c);!Number.isFinite(l)||!Number.isFinite(h)||(i=Math.min(i,l),o=Math.min(o,h),s=Math.max(s,l),a=Math.max(a,h))}}catch{return null}return!Number.isFinite(i)||!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(a)?null:{minX:i,minY:o,maxX:s,maxY:a}}getProjectedFootprint(t,r){let n=Number.NaN,i=Number.NaN;try{[n,i]=r.project(t.center)}catch{return null}if(!Number.isFinite(n)||!Number.isFinite(i))return null;let o=this.getBoundingVolumeCorners(t),s=0;try{for(let a of o){let[c,l]=r.project(a);!Number.isFinite(c)||!Number.isFinite(l)||(s=Math.max(s,Math.hypot(c-n,l-i)))}}catch{return null}if(s===0){let a=this.projectBounds(t,r);a&&(s=Math.max(a.maxX-a.minX,a.maxY-a.minY)/2)}return{x:n,y:i,radius:s}}async getVisibleChildren(t,r){return t.level>=this.options.maxDepth?[]:(await this.getChildren(t)).map(i=>({tile:i,weight:this.estimateScreenRadius(i,r.viewport)})).filter(i=>this.isVisible(i.tile,r))}async getChildren(t){if(t.childrenLoaded)return t.children;if(!t.childrenPromise){let r=this.dataSource.getChildren(t.header).then(n=>n.map(i=>this.getOrCreateTile(i,t))).then(n=>(t.children=n,t.childrenLoaded=!0,n));t.childrenPromise=r.finally(()=>{t.childrenPromise===r&&(t.childrenPromise=null)})}return t.childrenPromise}getOrCreateTile(t,r){let n=this.tilesMap.get(t.id);if(n)return n.header=t,r&&n.parent!==r&&(n.parent=r),n;let i=new gl(t,r);return this.tilesMap.set(t.id,i),r&&!r.children.find(o=>o.id===i.id)&&r.children.push(i),i}async loadTile(t){if(!(t.contentAvailable||t.isContentLoading||t.contentFailed)){t.isContentLoading=!0,this.pendingCount++;try{let r=await this.dataSource.loadTileContent(t.header);t.content=r,t.contentAvailable=!0,r&&this.options.onTileLoad(t)}catch(r){t.contentFailed=!0,this.options.onTileError(t,r)}finally{t.isContentLoading=!1,this.pendingCount--}}}estimateZoom(t){if(!t||t.coordinateFrame==="cartesian")return 1;let[r,n]=t.cartographicBounds,i=t.coversFullLongitude?360:t.wrapsDateline?360-Math.abs(n[0]-r[0]):Math.abs(n[0]-r[0]),o=Math.max(i,1e-6);return Math.max(1,Math.round(Math.log2(360/o)))}haveSameIds(t,r){if(t.size!==r.size)return!1;for(let n of t)if(!r.has(n))return!1;return!0}getBoundingVolumeCorners(t){let[r,n]=t.cartographicBounds,i=t.coversFullLongitude?[[-180,180]]:t.wrapsDateline?[[r[0],180],[-180,n[0]]]:[[r[0],n[0]]],o=[],s=360-Math.abs(n[0]-r[0]),a=r[0]+s/2;for(let[c,l]of i){let h=d=>{if(!t.wrapsDateline)return d;let m=d;for(;m-a>180;)m-=360;for(;m-a<-180;)m+=360;return m},u=h(c),f=h(l);o.push([u,r[1],r[2]||0],[u,r[1],n[2]||0],[u,n[1],r[2]||0],[u,n[1],n[2]||0],[f,r[1],r[2]||0],[f,r[1],n[2]||0],[f,n[1],r[2]||0],[f,n[1],n[2]||0])}return o}getCullingVolume(t){let r=t.getFrustumPlanes?.bind(t);if(!r)return null;let n=r(),i=["left","right","bottom","top","near","far"],o=[];for(let s of i){let a=n[s];if(!a)return null;o.push(new Ge(a.normal,-a.distance))}return new sr(o)}getCommonSpaceBoundingSphere(t,r){let n=r.projectPosition?.bind(r);if(!n)return null;let i=this.getBoundingVolumeCorners(t),o=Number.POSITIVE_INFINITY,s=Number.POSITIVE_INFINITY,a=Number.POSITIVE_INFINITY,c=Number.NEGATIVE_INFINITY,l=Number.NEGATIVE_INFINITY,h=Number.NEGATIVE_INFINITY;try{for(let u of i){let[f,d,m=0]=n(u);!Number.isFinite(f)||!Number.isFinite(d)||!Number.isFinite(m)||(o=Math.min(o,f),s=Math.min(s,d),a=Math.min(a,m),c=Math.max(c,f),l=Math.max(l,d),h=Math.max(h,m))}}catch{return null}return!Number.isFinite(o)||!Number.isFinite(s)||!Number.isFinite(a)||!Number.isFinite(c)||!Number.isFinite(l)||!Number.isFinite(h)?null:new en().fromCornerPoints([o,s,a],[c,l,h])}};AM();return PP(Qu);})();
|
|
29
29
|
return __exports__;
|
|
30
30
|
});
|