maplibre-gl-components 0.12.1 → 0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/{ControlGrid-3Y_umzvK.cjs → ControlGrid-BHj06tuI.cjs} +5 -5
  2. package/dist/{ControlGrid-CeKq8xm8.js → ControlGrid-CcOIR0lI.js} +18 -18
  3. package/dist/{deflate-CCnKrMSU.js → deflate-BeG874Ez.js} +1 -1
  4. package/dist/{deflate-Dj9xAuf-.cjs → deflate-Buv4KFPQ.cjs} +1 -1
  5. package/dist/{geotiff-CkM7wOor.js → geotiff-CY9Ly-G7.js} +8 -8
  6. package/dist/{geotiff-C-MHEjS3.cjs → geotiff-D9Jxidvv.cjs} +2 -2
  7. package/dist/index-Bhn2Pjz_.js +4 -0
  8. package/dist/{index-rhQrpZSD.cjs → index-ChPRo5p6.cjs} +1 -1
  9. package/dist/{index-Dv6tRl9f.js → index-CkoU3LUr.js} +2 -2
  10. package/dist/{index-C8CBe27l.cjs → index-CsAfY_en.cjs} +1 -1
  11. package/dist/index.cjs +1 -1
  12. package/dist/index.mjs +2 -2
  13. package/dist/{jpeg-D2rka1FK.js → jpeg-DxFhLjr0.js} +1 -1
  14. package/dist/{jpeg-Cr0iCWxG.cjs → jpeg-K5f1PGmj.cjs} +1 -1
  15. package/dist/{lerc-BuHKAAJ5.js → lerc-BKz5PmNT.js} +2 -2
  16. package/dist/{lerc-Du5hw3rN.cjs → lerc-DBi1jyo4.cjs} +1 -1
  17. package/dist/{lzw-BHeSwe4R.cjs → lzw-1pa4hURZ.cjs} +1 -1
  18. package/dist/{lzw-CIvsR7yQ.js → lzw-_5PJSl3d.js} +1 -1
  19. package/dist/maplibre-gl-components.css +1 -1
  20. package/dist/{packbits-C9seKA6S.cjs → packbits-D8NpPMS2.cjs} +1 -1
  21. package/dist/{packbits-CGqapXxr.js → packbits-DB0-GTif.js} +1 -1
  22. package/dist/{raw-BOD2Kcq8.cjs → raw-Ady0oBU-.cjs} +1 -1
  23. package/dist/{raw-Cxjry7D7.js → raw-DaYOG1dh.js} +1 -1
  24. package/dist/react.cjs +1 -1
  25. package/dist/react.mjs +1 -1
  26. package/dist/{webimage-BDD8ZjeE.js → webimage-B65eRBzD.js} +1 -1
  27. package/dist/{webimage-BaGAucPQ.cjs → webimage-CI-Xhwi8.cjs} +1 -1
  28. package/package.json +1 -1
  29. package/dist/index-GVloud5I.js +0 -4
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("./index-IrsIiQNM.cjs"),G=require("./geotiff-C-MHEjS3.cjs"),V=require("./index-B-Nr9y7J.cjs"),m=require("./ControlGrid-3Y_umzvK.cjs"),ze="Queued Requests",Ne="Active Requests",Ve="Cancelled Requests",Fe="Queued Requests Ever",qe="Active Requests Ever",Ge={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0};class Be{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...Ge,...t},this.stats=new m.Stats({id:this.props.id}),this.stats.get(ze),this.stats.get(Ne),this.stats.get(Ve),this.stats.get(Fe),this.stats.get(qe)}scheduleRequest(t,e=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);const s={handle:t,priority:0,getPriority:e},i=new Promise(o=>(s.resolve=o,s));return this.requestQueue.push(s),this.requestMap.set(t,i),this._issueNewRequests(),i}_issueRequest(t){const{handle:e,resolve:s}=t;let i=!1;const o=()=>{i||(i=!0,this.requestMap.delete(e),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,s?s({done:o}):Promise.resolve({done:o})}_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;const t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let e=0;e<t;++e){const s=this.requestQueue.shift();s&&this._issueRequest(s)}}}_updateAllRequests(){const t=this.requestQueue;for(let e=0;e<t.length;++e){const s=t[e];this._updateRequest(s)||(t.splice(e,1),this.requestMap.delete(s.handle),e--)}t.sort((e,s)=>e.priority-s.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}}function De(n){let t=1/0,e=1/0,s=1/0,i=-1/0,o=-1/0,r=-1/0;const a=n.POSITION?n.POSITION.value:[],c=a&&a.length;for(let h=0;h<c;h+=3){const u=a[h],l=a[h+1],d=a[h+2];t=u<t?u:t,e=l<e?l:e,s=d<s?d:s,i=u>i?u:i,o=l>o?l:o,r=d>r?d:r}return[[t,e,s],[i,o,r]]}let Y;class xt extends m.Vector{static get ZERO(){return Y||(Y=new xt(0,0,0,0),Object.freeze(Y)),Y}constructor(t=0,e=0,s=0,i=0){super(-0,-0,-0,-0),m.isArray(t)&&arguments.length===1?this.copy(t):(m.config.debug&&(m.checkNumber(t),m.checkNumber(e),m.checkNumber(s),m.checkNumber(i)),this[0]=t,this[1]=e,this[2]=s,this[3]=i)}set(t,e,s,i){return this[0]=t,this[1]=e,this[2]=s,this[3]=i,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return m.config.debug&&(m.checkNumber(t.x),m.checkNumber(t.y),m.checkNumber(t.z),m.checkNumber(t.w)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t.w=this[3],t}get ELEMENTS(){return 4}get z(){return this[2]}set z(t){this[2]=m.checkNumber(t)}get w(){return this[3]}set w(t){this[3]=m.checkNumber(t)}transform(t){return m.transformMat4(this,this,t),this.check()}transformByMatrix3(t){return m.vec4_transformMat3(this,this,t),this.check()}transformByMatrix2(t){return m.vec4_transformMat2(this,this,t),this.check()}transformByQuaternion(t){return m.transformQuat(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}}function Ue(){const n=new m.ARRAY_TYPE(9);return m.ARRAY_TYPE!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[5]=0,n[6]=0,n[7]=0),n[0]=1,n[4]=1,n[8]=1,n}function ke(n,t){if(n===t){const e=t[1],s=t[2],i=t[5];n[1]=t[3],n[2]=t[6],n[3]=e,n[5]=t[7],n[6]=s,n[7]=i}else n[0]=t[0],n[1]=t[3],n[2]=t[6],n[3]=t[1],n[4]=t[4],n[5]=t[7],n[6]=t[2],n[7]=t[5],n[8]=t[8];return n}function We(n,t){const e=t[0],s=t[1],i=t[2],o=t[3],r=t[4],a=t[5],c=t[6],h=t[7],u=t[8],l=u*r-a*h,d=-u*o+a*c,f=h*o-r*c;let p=e*l+s*d+i*f;return p?(p=1/p,n[0]=l*p,n[1]=(-u*s+i*h)*p,n[2]=(a*s-i*r)*p,n[3]=d*p,n[4]=(u*e-i*c)*p,n[5]=(-a*e+i*o)*p,n[6]=f*p,n[7]=(-h*e+s*c)*p,n[8]=(r*e-s*o)*p,n):null}function je(n){const t=n[0],e=n[1],s=n[2],i=n[3],o=n[4],r=n[5],a=n[6],c=n[7],h=n[8];return t*(h*o-r*c)+e*(-h*i+r*a)+s*(c*i-o*a)}function Nt(n,t,e){const s=t[0],i=t[1],o=t[2],r=t[3],a=t[4],c=t[5],h=t[6],u=t[7],l=t[8],d=e[0],f=e[1],p=e[2],g=e[3],y=e[4],_=e[5],x=e[6],M=e[7],T=e[8];return n[0]=d*s+f*r+p*h,n[1]=d*i+f*a+p*u,n[2]=d*o+f*c+p*l,n[3]=g*s+y*r+_*h,n[4]=g*i+y*a+_*u,n[5]=g*o+y*c+_*l,n[6]=x*s+M*r+T*h,n[7]=x*i+M*a+T*u,n[8]=x*o+M*c+T*l,n}function Ye(n,t,e){const s=t[0],i=t[1],o=t[2],r=t[3],a=t[4],c=t[5],h=t[6],u=t[7],l=t[8],d=e[0],f=e[1];return n[0]=s,n[1]=i,n[2]=o,n[3]=r,n[4]=a,n[5]=c,n[6]=d*s+f*r+h,n[7]=d*i+f*a+u,n[8]=d*o+f*c+l,n}function Xe(n,t,e){const s=t[0],i=t[1],o=t[2],r=t[3],a=t[4],c=t[5],h=t[6],u=t[7],l=t[8],d=Math.sin(e),f=Math.cos(e);return n[0]=f*s+d*r,n[1]=f*i+d*a,n[2]=f*o+d*c,n[3]=f*r-d*s,n[4]=f*a-d*i,n[5]=f*c-d*o,n[6]=h,n[7]=u,n[8]=l,n}function Vt(n,t,e){const s=e[0],i=e[1];return n[0]=s*t[0],n[1]=s*t[1],n[2]=s*t[2],n[3]=i*t[3],n[4]=i*t[4],n[5]=i*t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n}function $e(n,t){const e=t[0],s=t[1],i=t[2],o=t[3],r=e+e,a=s+s,c=i+i,h=e*r,u=s*r,l=s*a,d=i*r,f=i*a,p=i*c,g=o*r,y=o*a,_=o*c;return n[0]=1-l-p,n[3]=u-_,n[6]=d+y,n[1]=u+_,n[4]=1-h-p,n[7]=f-g,n[2]=d-y,n[5]=f+g,n[8]=1-h-l,n}var dt;(function(n){n[n.COL0ROW0=0]="COL0ROW0",n[n.COL0ROW1=1]="COL0ROW1",n[n.COL0ROW2=2]="COL0ROW2",n[n.COL1ROW0=3]="COL1ROW0",n[n.COL1ROW1=4]="COL1ROW1",n[n.COL1ROW2=5]="COL1ROW2",n[n.COL2ROW0=6]="COL2ROW0",n[n.COL2ROW1=7]="COL2ROW1",n[n.COL2ROW2=8]="COL2ROW2"})(dt||(dt={}));const Ze=Object.freeze([1,0,0,0,1,0,0,0,1]);class E extends m.Matrix{static get IDENTITY(){return Ke()}static get ZERO(){return He()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return dt}constructor(t,...e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):e.length>0?this.copy([t,...e]):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(Ze)}fromObject(t){return this.check()}fromQuaternion(t){return $e(this,t),this.check()}set(t,e,s,i,o,r,a,c,h){return this[0]=t,this[1]=e,this[2]=s,this[3]=i,this[4]=o,this[5]=r,this[6]=a,this[7]=c,this[8]=h,this.check()}setRowMajor(t,e,s,i,o,r,a,c,h){return this[0]=t,this[1]=i,this[2]=a,this[3]=e,this[4]=o,this[5]=c,this[6]=s,this[7]=r,this[8]=h,this.check()}determinant(){return je(this)}transpose(){return ke(this,this),this.check()}invert(){return We(this,this),this.check()}multiplyLeft(t){return Nt(this,t,this),this.check()}multiplyRight(t){return Nt(this,this,t),this.check()}rotate(t){return Xe(this,this,t),this.check()}scale(t){return Array.isArray(t)?Vt(this,this,t):Vt(this,this,[t,t]),this.check()}translate(t){return Ye(this,this,t),this.check()}transform(t,e){let s;switch(t.length){case 2:s=m.transformMat3$1(e||[-0,-0],t,this);break;case 3:s=m.transformMat3(e||[-0,-0,-0],t,this);break;case 4:s=m.vec4_transformMat3(e||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return m.checkVector(s,t.length),s}transformVector(t,e){return this.transform(t,e)}transformVector2(t,e){return this.transform(t,e)}transformVector3(t,e){return this.transform(t,e)}}let X,$=null;function He(){return X||(X=new E([0,0,0,0,0,0,0,0,0]),Object.freeze(X)),X}function Ke(){return $||($=new E,Object.freeze($)),$}function Ft(){const n=new m.ARRAY_TYPE(4);return m.ARRAY_TYPE!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n[3]=1,n}function Qe(n){return n[0]=0,n[1]=0,n[2]=0,n[3]=1,n}function le(n,t,e){e=e*.5;const s=Math.sin(e);return n[0]=s*t[0],n[1]=s*t[1],n[2]=s*t[2],n[3]=Math.cos(e),n}function qt(n,t,e){const s=t[0],i=t[1],o=t[2],r=t[3],a=e[0],c=e[1],h=e[2],u=e[3];return n[0]=s*u+r*a+i*h-o*c,n[1]=i*u+r*c+o*a-s*h,n[2]=o*u+r*h+s*c-i*a,n[3]=r*u-s*a-i*c-o*h,n}function Je(n,t,e){e*=.5;const s=t[0],i=t[1],o=t[2],r=t[3],a=Math.sin(e),c=Math.cos(e);return n[0]=s*c+r*a,n[1]=i*c+o*a,n[2]=o*c-i*a,n[3]=r*c-s*a,n}function ts(n,t,e){e*=.5;const s=t[0],i=t[1],o=t[2],r=t[3],a=Math.sin(e),c=Math.cos(e);return n[0]=s*c-o*a,n[1]=i*c+r*a,n[2]=o*c+s*a,n[3]=r*c-i*a,n}function es(n,t,e){e*=.5;const s=t[0],i=t[1],o=t[2],r=t[3],a=Math.sin(e),c=Math.cos(e);return n[0]=s*c+i*a,n[1]=i*c-s*a,n[2]=o*c+r*a,n[3]=r*c-o*a,n}function ss(n,t){const e=t[0],s=t[1],i=t[2];return n[0]=e,n[1]=s,n[2]=i,n[3]=Math.sqrt(Math.abs(1-e*e-s*s-i*i)),n}function et(n,t,e,s){const i=t[0],o=t[1],r=t[2],a=t[3];let c=e[0],h=e[1],u=e[2],l=e[3],d,f,p,g,y;return d=i*c+o*h+r*u+a*l,d<0&&(d=-d,c=-c,h=-h,u=-u,l=-l),1-d>m.EPSILON?(f=Math.acos(d),y=Math.sin(f),p=Math.sin((1-s)*f)/y,g=Math.sin(s*f)/y):(p=1-s,g=s),n[0]=p*i+g*c,n[1]=p*o+g*h,n[2]=p*r+g*u,n[3]=p*a+g*l,n}function ns(n,t){const e=t[0],s=t[1],i=t[2],o=t[3],r=e*e+s*s+i*i+o*o,a=r?1/r:0;return n[0]=-e*a,n[1]=-s*a,n[2]=-i*a,n[3]=o*a,n}function is(n,t){return n[0]=-t[0],n[1]=-t[1],n[2]=-t[2],n[3]=t[3],n}function he(n,t){const e=t[0]+t[4]+t[8];let s;if(e>0)s=Math.sqrt(e+1),n[3]=.5*s,s=.5/s,n[0]=(t[5]-t[7])*s,n[1]=(t[6]-t[2])*s,n[2]=(t[1]-t[3])*s;else{let i=0;t[4]>t[0]&&(i=1),t[8]>t[i*3+i]&&(i=2);const o=(i+1)%3,r=(i+2)%3;s=Math.sqrt(t[i*3+i]-t[o*3+o]-t[r*3+r]+1),n[i]=.5*s,s=.5/s,n[3]=(t[o*3+r]-t[r*3+o])*s,n[o]=(t[o*3+i]+t[i*3+o])*s,n[r]=(t[r*3+i]+t[i*3+r])*s}return n}const os=m.add,rs=m.scale,as=m.dot,cs=m.lerp,ls=m.length,hs=m.squaredLength,ue=m.normalize$1,us=(function(){const n=m.create(),t=m.fromValues(1,0,0),e=m.fromValues(0,1,0);return function(s,i,o){const r=m.dot$1(i,o);return r<-.999999?(m.cross(n,t,i),m.len(n)<1e-6&&m.cross(n,e,i),m.normalize(n,n),le(s,n,Math.PI),s):r>.999999?(s[0]=0,s[1]=0,s[2]=0,s[3]=1,s):(m.cross(n,i,o),s[0]=n[0],s[1]=n[1],s[2]=n[2],s[3]=1+r,ue(s,s))}})();(function(){const n=Ft(),t=Ft();return function(e,s,i,o,r,a){return et(n,s,r,a),et(t,i,o,a),et(e,n,t,2*a*(1-a)),e}})();(function(){const n=Ue();return function(t,e,s,i){return n[0]=s[0],n[3]=s[1],n[6]=s[2],n[1]=i[0],n[4]=i[1],n[7]=i[2],n[2]=-e[0],n[5]=-e[1],n[8]=-e[2],ue(t,he(t,n))}})();const ds=[0,0,0,1];class Gt extends m.MathArray{constructor(t=0,e=0,s=0,i=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,e,s,i)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,e,s,i){return this[0]=t,this[1]=e,this[2]=s,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 he(this,t),this.check()}fromAxisRotation(t,e){return le(this,t,e),this.check()}identity(){return Qe(this),this.check()}setAxisAngle(t,e){return this.fromAxisRotation(t,e)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=m.checkNumber(t)}get y(){return this[1]}set y(t){this[1]=m.checkNumber(t)}get z(){return this[2]}set z(t){this[2]=m.checkNumber(t)}get w(){return this[3]}set w(t){this[3]=m.checkNumber(t)}len(){return ls(this)}lengthSquared(){return hs(this)}dot(t){return as(this,t)}rotationTo(t,e){return us(this,t,e),this.check()}add(t){return os(this,this,t),this.check()}calculateW(){return ss(this,this),this.check()}conjugate(){return is(this,this),this.check()}invert(){return ns(this,this),this.check()}lerp(t,e,s){return s===void 0?this.lerp(this,t,e):(cs(this,t,e,s),this.check())}multiplyRight(t){return qt(this,this,t),this.check()}multiplyLeft(t){return qt(this,t,this),this.check()}normalize(){const t=this.len(),e=t>0?1/t:0;return this[0]=this[0]*e,this[1]=this[1]*e,this[2]=this[2]*e,this[3]=this[3]*e,t===0&&(this[3]=1),this.check()}rotateX(t){return Je(this,this,t),this.check()}rotateY(t){return ts(this,this,t),this.check()}rotateZ(t){return es(this,this,t),this.check()}scale(t){return rs(this,this,t),this.check()}slerp(t,e,s){let i,o,r;switch(arguments.length){case 1:({start:i=ds,target:o,ratio:r}=t);break;case 2:i=this,o=t,r=e;break;default:i=t,o=e,r=s}return et(this,i,o,r),this.check()}transformVector4(t,e=new xt){return m.transformQuat$1(e,t,this),m.checkVector(e,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,e){return this.setAxisAngle(t,e)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}}const fs=1e-15,ms=1e-20,de={name:"phongMaterial",dependencies:[m.lighting],source:m.PHONG_WGSL,vs:m.PHONG_VS,fs:m.PHONG_FS,defines:{LIGHTING_FRAGMENT:!0},uniformTypes:{ambient:"f32",diffuse:"f32",shininess:"f32",specularColor:"vec3<f32>"},defaultUniforms:{ambient:.35,diffuse:.6,shininess:32,specularColor:[.15,.15,.15]},getUniforms(n){const t={...n};return t.specularColor&&(t.specularColor=t.specularColor.map(e=>e/255)),{...de.defaultUniforms,...t}}},fe=[0,0,0,255],ps=[0,0,0,255],gs={stroked:!0,filled:!0,extruded:!1,elevationScale:1,wireframe:!1,_normalize:!0,_windingOrder:"CW",lineWidthUnits:"meters",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,lineJointRounded:!1,lineMiterLimit:4,getPolygon:{type:"accessor",value:n=>n.polygon},getFillColor:{type:"accessor",value:ps},getLineColor:{type:"accessor",value:fe},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0};class Mt extends m.CompositeLayer{initializeState(){this.state={paths:[],pathsDiff:null},this.props.getLineDashArray&&m.defaultLogger.removed("getLineDashArray","PathStyleExtension")()}updateState({changeFlags:t}){const e=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getPolygon);if(e&&Array.isArray(t.dataChanged)){const s=this.state.paths.slice(),i=t.dataChanged.map(o=>m.replaceInRange({data:s,getIndex:r=>r.__source.index,dataRange:o,replace:this._getPaths(o)}));this.setState({paths:s,pathsDiff:i})}else e&&this.setState({paths:this._getPaths(),pathsDiff:null})}_getPaths(t={}){const{data:e,getPolygon:s,positionFormat:i,_normalize:o}=this.props,r=[],a=i==="XY"?2:3,{startRow:c,endRow:h}=t,{iterable:u,objectInfo:l}=m.createIterable(e,c,h);for(const d of u){l.index++;let f=s(d,l);o&&(f=m.normalize$2(f,a));const{holeIndices:p}=f,g=f.positions||f;if(p)for(let y=0;y<=p.length;y++){const _=g.slice(p[y-1]||0,p[y]||g.length);r.push(this.getSubLayerRow({path:_},d,l.index))}else r.push(this.getSubLayerRow({path:g},d,l.index))}return r}renderLayers(){const{data:t,_dataDiff:e,stroked:s,filled:i,extruded:o,wireframe:r,_normalize:a,_windingOrder:c,elevationScale:h,transitions:u,positionFormat:l}=this.props,{lineWidthUnits:d,lineWidthScale:f,lineWidthMinPixels:p,lineWidthMaxPixels:g,lineJointRounded:y,lineMiterLimit:_,lineDashJustified:x}=this.props,{getFillColor:M,getLineColor:T,getLineWidth:w,getLineDashArray:S,getElevation:L,getPolygon:R,updateTriggers:b,material:C}=this.props,{paths:q,pathsDiff:k}=this.state,ot=this.getSubLayerClass("fill",m.SolidPolygonLayer),rt=this.getSubLayerClass("stroke",m.PathLayer),W=this.shouldRenderSubLayer("fill",q)&&new ot({_dataDiff:e,extruded:o,elevationScale:h,filled:i,wireframe:r,_normalize:a,_windingOrder:c,getElevation:L,getFillColor:M,getLineColor:o&&r?T:fe,material:C,transitions:u},this.getSubLayerProps({id:"fill",updateTriggers:b&&{getPolygon:b.getPolygon,getElevation:b.getElevation,getFillColor:b.getFillColor,lineColors:o&&r,getLineColor:b.getLineColor}}),{data:t,positionFormat:l,getPolygon:R}),Oe=!o&&s&&this.shouldRenderSubLayer("stroke",q)&&new rt({_dataDiff:k&&(()=>k),widthUnits:d,widthScale:f,widthMinPixels:p,widthMaxPixels:g,jointRounded:y,miterLimit:_,dashJustified:x,_pathType:"loop",transitions:u&&{getWidth:u.getLineWidth,getColor:u.getLineColor,getPath:u.getPolygon},getColor:this.getSubLayerAccessor(T),getWidth:this.getSubLayerAccessor(w),getDashArray:this.getSubLayerAccessor(S)},this.getSubLayerProps({id:"stroke",updateTriggers:b&&{getWidth:b.getLineWidth,getColor:b.getLineColor,getDashArray:b.getLineDashArray}}),{data:q,positionFormat:l,getPath:ve=>ve.path});return[!o&&W,Oe,o&&W]}}Mt.layerName="PolygonLayer";Mt.defaultProps=gs;class ys{constructor(t){this.index=t,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(t){this._bbox||(this._bbox=t,"west"in t?this.boundingBox=[[t.west,t.south],[t.east,t.north]]:this.boundingBox=[[t.left,t.top],[t.right,t.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return!!this._loader&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){const t=this.content?this.content.byteLength:0;return Number.isFinite(t)||console.error("byteLength not defined in tile data"),t}async _loadData({getData:t,requestScheduler:e,onLoad:s,onError:i}){const{index:o,id:r,bbox:a,userData:c,zoom:h}=this,u=this._loaderId;this._abortController=new AbortController;const{signal:l}=this._abortController,d=await e.scheduleRequest(this,g=>g.isSelected?1:-1);if(!d){this._isCancelled=!0;return}if(this._isCancelled){d.done();return}let f=null,p;try{f=await t({index:o,id:r,bbox:a,userData:c,zoom:h,signal:l})}catch(g){p=g||!0}finally{d.done()}if(u===this._loaderId){if(this._loader=void 0,this.content=f,this._isCancelled&&!f){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,p?i(p,this):s(this)}}loadData(t){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(t),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}}const P={OUTSIDE:-1,INTERSECTING:0,INSIDE:1},Bt=new m.Vector3,_s=new m.Vector3;class Tt{constructor(t=[0,0,0],e=[0,0,0],s){s=s||Bt.copy(t).add(e).scale(.5),this.center=new m.Vector3(s),this.halfDiagonal=new m.Vector3(e).subtract(this.center),this.minimum=new m.Vector3(t),this.maximum=new m.Vector3(e)}clone(){return new Tt(this.minimum,this.maximum,this.center)}equals(t){return this===t||!!t&&this.minimum.equals(t.minimum)&&this.maximum.equals(t.maximum)}transform(t){return this.center.transformAsPoint(t),this.halfDiagonal.transform(t),this.minimum.transform(t),this.maximum.transform(t),this}intersectPlane(t){const{halfDiagonal:e}=this,s=_s.from(t.normal),i=e.x*Math.abs(s.x)+e.y*Math.abs(s.y)+e.z*Math.abs(s.z),o=this.center.dot(s)+t.distance;return o-i>0?P.INSIDE:o+i<0?P.OUTSIDE:P.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=Bt.from(t).subtract(this.center),{halfDiagonal:s}=this;let i=0,o;return o=Math.abs(e.x)-s.x,o>0&&(i+=o*o),o=Math.abs(e.y)-s.y,o>0&&(i+=o*o),o=Math.abs(e.z)-s.z,o>0&&(i+=o*o),i}}const j=new m.Vector3,Dt=new m.Vector3;class wt{constructor(t=[0,0,0],e=0){this.radius=-0,this.center=new m.Vector3,this.fromCenterRadius(t,e)}fromCenterRadius(t,e){return this.center.from(t),this.radius=e,this}fromCornerPoints(t,e){return e=j.from(e),this.center=new m.Vector3().from(t).add(e).scale(.5),this.radius=this.center.distance(e),this}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new wt(this.center,this.radius)}union(t){const e=this.center,s=this.radius,i=t.center,o=t.radius,r=j.copy(i).subtract(e),a=r.magnitude();if(s>=a+o)return this.clone();if(o>=a+s)return t.clone();const c=(s+a+o)*.5;return Dt.copy(r).scale((-s+c)/a).add(e),this.center.copy(Dt),this.radius=c,this}expand(t){const s=j.from(t).subtract(this.center).magnitude();return s>this.radius&&(this.radius=s),this}transform(t){this.center.transform(t);const e=m.getScaling(j,t);return this.radius=Math.max(e[0],Math.max(e[1],e[2]))*this.radius,this}distanceSquaredTo(t){const e=this.distanceTo(t);return e*e}distanceTo(t){const s=j.from(t).subtract(this.center);return Math.max(0,s.len()-this.radius)}intersectPlane(t){const e=this.center,s=this.radius,o=t.normal.dot(e)+t.distance;return o<-s?P.OUTSIDE:o<s?P.INTERSECTING:P.INSIDE}}const xs=new m.Vector3,Ms=new m.Vector3,Z=new m.Vector3,H=new m.Vector3,K=new m.Vector3,Ts=new m.Vector3,ws=new m.Vector3,O={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8};class bt{constructor(t=[0,0,0],e=[0,0,0,0,0,0,0,0,0]){this.center=new m.Vector3().from(t),this.halfAxes=new E(e)}get halfSize(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),s=this.halfAxes.getColumn(2);return[new m.Vector3(t).len(),new m.Vector3(e).len(),new m.Vector3(s).len()]}get quaternion(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),s=this.halfAxes.getColumn(2),i=new m.Vector3(t).normalize(),o=new m.Vector3(e).normalize(),r=new m.Vector3(s).normalize();return new Gt().fromMatrix3(new E([...i,...o,...r]))}fromCenterHalfSizeQuaternion(t,e,s){const i=new Gt(s),o=new E().fromQuaternion(i);return o[0]=o[0]*e[0],o[1]=o[1]*e[0],o[2]=o[2]*e[0],o[3]=o[3]*e[1],o[4]=o[4]*e[1],o[5]=o[5]*e[1],o[6]=o[6]*e[2],o[7]=o[7]*e[2],o[8]=o[8]*e[2],this.center=new m.Vector3().from(t),this.halfAxes=o,this}clone(){return new bt(this.center,this.halfAxes)}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new wt){const e=this.halfAxes,s=e.getColumn(0,Z),i=e.getColumn(1,H),o=e.getColumn(2,K),r=xs.copy(s).add(i).add(o);return t.center.copy(this.center),t.radius=r.magnitude(),t}intersectPlane(t){const e=this.center,s=t.normal,i=this.halfAxes,o=s.x,r=s.y,a=s.z,c=Math.abs(o*i[O.COLUMN0ROW0]+r*i[O.COLUMN0ROW1]+a*i[O.COLUMN0ROW2])+Math.abs(o*i[O.COLUMN1ROW0]+r*i[O.COLUMN1ROW1]+a*i[O.COLUMN1ROW2])+Math.abs(o*i[O.COLUMN2ROW0]+r*i[O.COLUMN2ROW1]+a*i[O.COLUMN2ROW2]),h=s.dot(e)+t.distance;return h<=-c?P.OUTSIDE:h>=c?P.INSIDE:P.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=Ms.from(t).subtract(this.center),s=this.halfAxes,i=s.getColumn(0,Z),o=s.getColumn(1,H),r=s.getColumn(2,K),a=i.magnitude(),c=o.magnitude(),h=r.magnitude();i.normalize(),o.normalize(),r.normalize();let u=0,l;return l=Math.abs(e.dot(i))-a,l>0&&(u+=l*l),l=Math.abs(e.dot(o))-c,l>0&&(u+=l*l),l=Math.abs(e.dot(r))-h,l>0&&(u+=l*l),u}computePlaneDistances(t,e,s=[-0,-0]){let i=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY;const r=this.center,a=this.halfAxes,c=a.getColumn(0,Z),h=a.getColumn(1,H),u=a.getColumn(2,K),l=Ts.copy(c).add(h).add(u).add(r),d=ws.copy(l).subtract(t);let f=e.dot(d);return i=Math.min(f,i),o=Math.max(f,o),l.copy(r).add(c).add(h).subtract(u),d.copy(l).subtract(t),f=e.dot(d),i=Math.min(f,i),o=Math.max(f,o),l.copy(r).add(c).subtract(h).add(u),d.copy(l).subtract(t),f=e.dot(d),i=Math.min(f,i),o=Math.max(f,o),l.copy(r).add(c).subtract(h).subtract(u),d.copy(l).subtract(t),f=e.dot(d),i=Math.min(f,i),o=Math.max(f,o),r.copy(l).subtract(c).add(h).add(u),d.copy(l).subtract(t),f=e.dot(d),i=Math.min(f,i),o=Math.max(f,o),r.copy(l).subtract(c).add(h).subtract(u),d.copy(l).subtract(t),f=e.dot(d),i=Math.min(f,i),o=Math.max(f,o),r.copy(l).subtract(c).subtract(h).add(u),d.copy(l).subtract(t),f=e.dot(d),i=Math.min(f,i),o=Math.max(f,o),r.copy(l).subtract(c).subtract(h).subtract(u),d.copy(l).subtract(t),f=e.dot(d),i=Math.min(f,i),o=Math.max(f,o),s[0]=i,s[1]=o,s}transform(t){this.center.transformAsPoint(t);const e=this.halfAxes.getColumn(0,Z);e.transformAsPoint(t);const s=this.halfAxes.getColumn(1,H);s.transformAsPoint(t);const i=this.halfAxes.getColumn(2,K);return i.transformAsPoint(t),this.halfAxes=new E([...e,...s,...i]),this}getTransform(){throw new Error("not implemented")}}const Ut=new m.Vector3,kt=new m.Vector3;class U{constructor(t=[0,0,1],e=0){this.normal=new m.Vector3,this.distance=-0,this.fromNormalDistance(t,e)}fromNormalDistance(t,e){return m.assert(Number.isFinite(e)),this.normal.from(t).normalize(),this.distance=e,this}fromPointNormal(t,e){t=Ut.from(t),this.normal.from(e).normalize();const s=-this.normal.dot(t);return this.distance=s,this}fromCoefficients(t,e,s,i){return this.normal.set(t,e,s),m.assert(m.equals(this.normal.len(),1)),this.distance=i,this}clone(){return new U(this.normal,this.distance)}equals(t){return m.equals(this.distance,t.distance)&&m.equals(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){const e=kt.copy(this.normal).transformAsVector(t).normalize(),s=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(s,e)}projectPointOntoPlane(t,e=[0,0,0]){const s=Ut.from(t),i=this.getPointDistance(s),o=kt.copy(this.normal).scale(i);return s.subtract(o).to(e)}}const Wt=[new m.Vector3([1,0,0]),new m.Vector3([0,1,0]),new m.Vector3([0,0,1])],jt=new m.Vector3,bs=new m.Vector3;class A{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*Wt.length;const e=t.center,s=t.radius;let i=0;for(const o of Wt){let r=this.planes[i],a=this.planes[i+1];r||(r=this.planes[i]=new U),a||(a=this.planes[i+1]=new U);const c=jt.copy(o).scale(-s).add(e);r.fromPointNormal(c,o);const h=jt.copy(o).scale(s).add(e),u=bs.copy(o).negate();a.fromPointNormal(h,u),i+=2}return this}computeVisibility(t){let e=P.INSIDE;for(const s of this.planes)switch(t.intersectPlane(s)){case P.OUTSIDE:return P.OUTSIDE;case P.INTERSECTING:e=P.INTERSECTING;break}return e}computeVisibilityWithPlaneMask(t,e){if(m.assert(Number.isFinite(e),"parentPlaneMask is required."),e===A.MASK_OUTSIDE||e===A.MASK_INSIDE)return e;let s=A.MASK_INSIDE;const i=this.planes;for(let o=0;o<this.planes.length;++o){const r=o<31?1<<o:0;if(o<31&&(e&r)===0)continue;const a=i[o],c=t.intersectPlane(a);if(c===P.OUTSIDE)return A.MASK_OUTSIDE;c===P.INTERSECTING&&(s|=r)}return s}}A.MASK_OUTSIDE=4294967295;A.MASK_INSIDE=0;A.MASK_INDETERMINATE=2147483647;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;const I=new E,Ss=new E,Cs=new E,Q=new E,Yt=new E;function Ls(n,t={}){const e=ms,s=10;let i=0,o=0;const r=Ss,a=Cs;r.identity(),a.copy(n);const c=e*Es(a);for(;o<s&&Ps(a)>c;)Rs(a,Q),Yt.copy(Q).transpose(),a.multiplyRight(Q),a.multiplyLeft(Yt),r.multiplyRight(Q),++i>2&&(++o,i=0);return t.unitary=r.toTarget(t.unitary),t.diagonal=a.toTarget(t.diagonal),t}function Es(n){let t=0;for(let e=0;e<9;++e){const s=n[e];t+=s*s}return Math.sqrt(t)}const ft=[1,0,0],mt=[2,2,1];function Ps(n){let t=0;for(let e=0;e<3;++e){const s=n[I.getElementIndex(mt[e],ft[e])];t+=2*s*s}return Math.sqrt(t)}function Rs(n,t){const e=fs;let s=0,i=1;for(let h=0;h<3;++h){const u=Math.abs(n[I.getElementIndex(mt[h],ft[h])]);u>s&&(i=h,s=u)}const o=ft[i],r=mt[i];let a=1,c=0;if(Math.abs(n[I.getElementIndex(r,o)])>e){const h=n[I.getElementIndex(r,r)],u=n[I.getElementIndex(o,o)],l=n[I.getElementIndex(r,o)],d=(h-u)/2/l;let f;d<0?f=-1/(-d+Math.sqrt(1+d*d)):f=1/(d+Math.sqrt(1+d*d)),a=1/Math.sqrt(1+f*f),c=f*a}return E.IDENTITY.to(t),t[I.getElementIndex(o,o)]=t[I.getElementIndex(r,r)]=a,t[I.getElementIndex(r,o)]=c,t[I.getElementIndex(o,r)]=-c,t}const z=new m.Vector3,Is=new m.Vector3,As=new m.Vector3,Os=new m.Vector3,vs=new m.Vector3,zs=new E,Ns={diagonal:new E,unitary:new E};function me(n,t=new bt){if(!n||n.length===0)return t.halfAxes=new E([0,0,0,0,0,0,0,0,0]),t.center=new m.Vector3,t;const e=n.length,s=new m.Vector3(0,0,0);for(const b of n)s.add(b);const i=1/e;s.multiplyByScalar(i);let o=0,r=0,a=0,c=0,h=0,u=0;for(const b of n){const C=z.copy(b).subtract(s);o+=C.x*C.x,r+=C.x*C.y,a+=C.x*C.z,c+=C.y*C.y,h+=C.y*C.z,u+=C.z*C.z}o*=i,r*=i,a*=i,c*=i,h*=i,u*=i;const l=zs;l[0]=o,l[1]=r,l[2]=a,l[3]=r,l[4]=c,l[5]=h,l[6]=a,l[7]=h,l[8]=u;const{unitary:d}=Ls(l,Ns),f=t.halfAxes.copy(d);let p=f.getColumn(0,As),g=f.getColumn(1,Os),y=f.getColumn(2,vs),_=-Number.MAX_VALUE,x=-Number.MAX_VALUE,M=-Number.MAX_VALUE,T=Number.MAX_VALUE,w=Number.MAX_VALUE,S=Number.MAX_VALUE;for(const b of n)z.copy(b),_=Math.max(z.dot(p),_),x=Math.max(z.dot(g),x),M=Math.max(z.dot(y),M),T=Math.min(z.dot(p),T),w=Math.min(z.dot(g),w),S=Math.min(z.dot(y),S);p=p.multiplyByScalar(.5*(T+_)),g=g.multiplyByScalar(.5*(w+x)),y=y.multiplyByScalar(.5*(S+M)),t.center.copy(p).add(g).add(y);const L=Is.set(_-T,x-w,M-S).multiplyByScalar(.5),R=new E([L[0],0,0,0,L[1],0,0,0,L[2]]);return t.halfAxes.multiplyRight(R),t}const B=512,Xt=3,pe=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],ge=pe.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),Vs=ge.concat([[.25,.5],[.75,.5]]);class D{constructor(t,e,s){this.x=t,this.y=e,this.z=s}get children(){if(!this._children){const t=this.x*2,e=this.y*2,s=this.z+1;this._children=[new D(t,e,s),new D(t,e+1,s),new D(t+1,e,s),new D(t+1,e+1,s)]}return this._children}update(t){const{viewport:e,cullingVolume:s,elevationBounds:i,minZ:o,maxZ:r,bounds:a,offset:c,project:h}=t,u=this.getBoundingVolume(i,c,h);if(a&&!this.insideBounds(a)||s.computeVisibility(u)<0)return!1;if(!this.childVisible){let{z:d}=this;if(d<r&&d>=o){const f=u.distanceTo(e.cameraPosition)*e.scale/e.height;d+=Math.floor(Math.log2(f))}if(d>=r)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(const d of this.children)d.update(t);return!0}getSelected(t=[]){if(this.selected&&t.push(this),this._children)for(const e of this._children)e.getSelected(t);return t}insideBounds([t,e,s,i]){const o=Math.pow(2,this.z),r=B/o;return this.x*r<s&&this.y*r<i&&(this.x+1)*r>t&&(this.y+1)*r>e}getBoundingVolume(t,e,s){if(s){const c=this.z<1?Vs:this.z<2?ge:pe,h=[];for(const u of c){const l=gt(this.x+u[0],this.y+u[1],this.z);l[2]=t[0],h.push(s(l)),t[0]!==t[1]&&(l[2]=t[1],h.push(s(l)))}return me(h)}const i=Math.pow(2,this.z),o=B/i,r=this.x*o+e*B,a=B-(this.y+1)*o;return new Tt([r,a,t[0]],[r+o,a+o,t[1]])}}function Fs(n,t,e,s){const i=n instanceof m.GlobeViewport&&n.resolution?n.projectPosition:null,o=Object.values(n.getFrustumPlanes()).map(({normal:f,distance:p})=>new U(f.clone().negate(),p)),r=new A(o),a=n.distanceScales.unitsPerMeter[2],c=e&&e[0]*a||0,h=e&&e[1]*a||0,u=n instanceof m.WebMercatorViewport&&n.pitch<=60?t:0;if(s){const[f,p,g,y]=s,_=m.lngLatToWorld([f,y]),x=m.lngLatToWorld([g,p]);s=[_[0],B-_[1],x[0],B-x[1]]}const l=new D(0,0,0),d={viewport:n,project:i,cullingVolume:r,elevationBounds:[c,h],minZ:u,maxZ:t,bounds:s,offset:0};if(l.update(d),n instanceof m.WebMercatorViewport&&n.subViewports&&n.subViewports.length>1){for(d.offset=-1;l.update(d)&&!(--d.offset<-Xt););for(d.offset=1;l.update(d)&&!(++d.offset>Xt););}return l.getSelected()}const v=512,qs=[-1/0,-1/0,1/0,1/0],Gs={equal:(n,t)=>{if(n===t)return!0;if(!Array.isArray(n)||!Array.isArray(t))return!1;const e=n.length;if(e!==t.length)return!1;for(let s=0;s<e;s++)if(n[s]!==t[s])return!1;return!0}};function St(n,t){const e=[t.transformAsPoint([n[0],n[1]]),t.transformAsPoint([n[2],n[1]]),t.transformAsPoint([n[0],n[3]]),t.transformAsPoint([n[2],n[3]])];return[Math.min(...e.map(i=>i[0])),Math.min(...e.map(i=>i[1])),Math.max(...e.map(i=>i[0])),Math.max(...e.map(i=>i[1]))]}function Bs(n){return Math.abs(n.split("").reduce((t,e)=>(t<<5)-t+e.charCodeAt(0)|0,0))}function Ds(n,t){if(!n||!n.length)return null;const{index:e,id:s}=t;if(Array.isArray(n)){const o=Bs(s)%n.length;n=n[o]}let i=n;for(const o of Object.keys(e)){const r=new RegExp(`{${o}}`,"g");i=i.replace(r,String(e[o]))}return Number.isInteger(e.y)&&Number.isInteger(e.z)&&(i=i.replace(/\{-y\}/g,String(Math.pow(2,e.z)-e.y-1))),i}function Us(n,t,e){let s;return s=n.getBounds(),n.isGeospatial?[Math.max(s[0],e[0]),Math.max(s[1],e[1]),Math.min(s[2],e[2]),Math.min(s[3],e[3])]:[Math.max(Math.min(s[0],e[2]),e[0]),Math.max(Math.min(s[1],e[3]),e[1]),Math.min(Math.max(s[2],e[0]),e[2]),Math.min(Math.max(s[3],e[1]),e[3])]}function ks({viewport:n,z:t,cullRect:e}){return(n.subViewports||[n]).map(i=>pt(i,t||0,e))}function pt(n,t,e){if(!Array.isArray(t)){const o=e.x-n.x,r=e.y-n.y,{width:a,height:c}=e,h={targetZ:t},u=n.unproject([o,r],h),l=n.unproject([o+a,r],h),d=n.unproject([o,r+c],h),f=n.unproject([o+a,r+c],h);return[Math.min(u[0],l[0],d[0],f[0]),Math.min(u[1],l[1],d[1],f[1]),Math.max(u[0],l[0],d[0],f[0]),Math.max(u[1],l[1],d[1],f[1])]}const s=pt(n,t[0],e),i=pt(n,t[1],e);return[Math.min(s[0],i[0]),Math.min(s[1],i[1]),Math.max(s[2],i[2]),Math.max(s[3],i[3])]}function Ws(n,t,e){return e?St(n,e).map(i=>i*t/v):n.map(s=>s*t/v)}function Ct(n,t){return Math.pow(2,n)*v/t}function gt(n,t,e){const s=Ct(e,v),i=n/s*360-180,o=Math.PI-2*Math.PI*t/s,r=180/Math.PI*Math.atan(.5*(Math.exp(o)-Math.exp(-o)));return[i,r]}function $t(n,t,e,s){const i=Ct(e,s);return[n/i*v,t/i*v]}function js(n,t,e,s,i=v){if(n.isGeospatial){const[h,u]=gt(t,e,s),[l,d]=gt(t+1,e+1,s);return{west:h,north:u,east:l,south:d}}const[o,r]=$t(t,e,s,i),[a,c]=$t(t+1,e+1,s,i);return{left:o,top:r,right:a,bottom:c}}function Ys(n,t,e,s,i){const o=Us(n,null,s),r=Ct(t,e),[a,c,h,u]=Ws(o,r,i),l=[];for(let d=Math.floor(a);d<h;d++)for(let f=Math.floor(c);f<u;f++)l.push({x:d,y:f,z:t});return l}function Xs({viewport:n,maxZoom:t,minZoom:e,zRange:s,extent:i,tileSize:o=v,modelMatrix:r,modelMatrixInverse:a,zoomOffset:c=0}){let h=n.isGeospatial?Math.round(n.zoom+Math.log2(v/o))+c:Math.ceil(n.zoom)+c;if(typeof e=="number"&&Number.isFinite(e)&&h<e){if(!i)return[];h=e}typeof t=="number"&&Number.isFinite(t)&&h>t&&(h=t);let u=i;return r&&a&&i&&!n.isGeospatial&&(u=St(i,r)),n.isGeospatial?Fs(n,h,s,i):Ys(n,h,o,u||qs,a)}function $s(n){let t={},e;return s=>{for(const i in s)if(!Zs(s[i],t[i])){e=n(s),t=s;break}return e}}function Zs(n,t){if(n===t)return!0;if(Array.isArray(n)){const e=n.length;if(!t||t.length!==e)return!1;for(let s=0;s<e;s++)if(n[s]!==t[s])return!1;return!0}return!1}const Zt=1,nt=2,Hs="never",Ks="no-overlap",Lt="best-available",Qs=5,Js={[Lt]:en,[Ks]:sn,[Hs]:()=>{}},tn={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}};class Et{constructor(t){this._getCullBounds=$s(ks),this.opts={...tn,...t},this.setOptions(this.opts),this.onTileLoad=e=>{this.opts.onTileLoad?.(e),this.opts.maxCacheByteSize!==null&&(this._cacheByteSize+=e.byteLength,this._resizeCache())},this._requestScheduler=new Be({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new m.Matrix4,this._modelMatrixInverse=new m.Matrix4}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(t=>t.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(t=>t.needsReload)}setOptions(t){Object.assign(this.opts,t),Number.isFinite(t.maxZoom)&&(this._maxZoom=Math.floor(t.maxZoom)),Number.isFinite(t.minZoom)&&(this._minZoom=Math.ceil(t.minZoom))}finalize(){for(const t of this._cache.values())t.isLoading&&t.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(const t of this._cache.keys()){const e=this._cache.get(t);!this._selectedTiles||!this._selectedTiles.includes(e)?this._cache.delete(t):e.setNeedsReload()}}update(t,{zRange:e,modelMatrix:s}={zRange:null,modelMatrix:null}){const i=s?new m.Matrix4(s):new m.Matrix4,o=!i.equals(this._modelMatrix);if(!this._viewport||!t.equals(this._viewport)||!m.equals(this._zRange,e)||o){o&&(this._modelMatrixInverse=i.clone().invert(),this._modelMatrix=i),this._viewport=t,this._zRange=e;const a=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:e,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=a.map(c=>this._getTile(c,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(a=>this._getTile(a.index,!0)));const r=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),r&&this._frameNumber++,this._frameNumber}isTileVisible(t,e,s){if(!t.isVisible)return!1;if(e&&this._viewport){const i=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:e});let{bbox:o}=t;for(const[r,a,c,h]of i){let u;if("west"in o)u=o.west<c&&o.east>r&&o.south<h&&o.north>a;else{if(s&&!m.Matrix4.IDENTITY.equals(s)){const[f,p,g,y]=St([o.left,o.top,o.right,o.bottom],s);o={left:f,top:p,right:g,bottom:y}}const l=Math.min(o.top,o.bottom),d=Math.max(o.top,o.bottom);u=o.left<c&&o.right>r&&l<h&&d>a}if(u)return!0}return!1}return!0}getTileIndices({viewport:t,maxZoom:e,minZoom:s,zRange:i,modelMatrix:o,modelMatrixInverse:r}){const{tileSize:a,extent:c,zoomOffset:h}=this.opts;return Xs({viewport:t,maxZoom:e,minZoom:s,zRange:i,tileSize:a,extent:c,modelMatrix:o,modelMatrixInverse:r,zoomOffset:h})}getTileId(t){return`${t.x}-${t.y}-${t.z}`}getTileZoom(t){return t.z}getTileMetadata(t){const{tileSize:e}=this.opts;return{bbox:js(this._viewport,t.x,t.y,t.z,e)}}getParentIndex(t){const e=Math.floor(t.x/2),s=Math.floor(t.y/2),i=t.z-1;return{x:e,y:s,z:i}}updateTileStates(){const t=this.opts.refinementStrategy||Lt,e=new Array(this._cache.size);let s=0;for(const i of this._cache.values())e[s++]=i.isVisible,i.isSelected=!1,i.isVisible=!1;for(const i of this._selectedTiles)i.isSelected=!0,i.isVisible=!0;(typeof t=="function"?t:Js[t])(Array.from(this._cache.values())),s=0;for(const i of this._cache.values())if(e[s++]!==i.isVisible)return!0;return!1}_pruneRequests(){const{maxRequests:t=0}=this.opts,e=[];let s=0;for(const i of this._cache.values())i.isLoading&&(s++,!i.isSelected&&!i.isVisible&&e.push(i));for(;t>0&&s>t&&e.length>0;)e.shift().abort(),s--}_rebuildTree(){const{_cache:t}=this;for(const e of t.values())e.parent=null,e.children&&(e.children.length=0);for(const e of t.values()){const s=this._getNearestAncestor(e);e.parent=s,s?.children&&s.children.push(e)}}_resizeCache(){const{_cache:t,opts:e}=this,s=e.maxCacheSize??(e.maxCacheByteSize!==null?1/0:Qs*this.selectedTiles.length),i=e.maxCacheByteSize??1/0;if(t.size>s||this._cacheByteSize>i){for(const[r,a]of t)if(!a.isVisible&&!a.isSelected&&(this._cacheByteSize-=e.maxCacheByteSize!==null?a.byteLength:0,t.delete(r),this.opts.onTileUnload?.(a)),t.size<=s&&this._cacheByteSize<=i)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((r,a)=>r.zoom-a.zoom),this._dirty=!1)}_getTile(t,e){const s=this.getTileId(t);let i=this._cache.get(s),o=!1;return!i&&e?(i=new ys(t),Object.assign(i,this.getTileMetadata(i.index)),Object.assign(i,{id:s,zoom:this.getTileZoom(i.index)}),o=!0,this._cache.set(s,i),this._dirty=!0):i&&i.needsReload&&(o=!0),i&&o&&i.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),i}_getNearestAncestor(t){const{_minZoom:e=0}=this;let s=t.index;for(;this.getTileZoom(s)>e;){s=this.getParentIndex(s);const i=this._getTile(s);if(i)return i}return null}}function en(n){for(const t of n)t.state=0;for(const t of n)t.isSelected&&!ye(t)&&Pt(t);for(const t of n)t.isVisible=!!(t.state&nt)}function sn(n){for(const e of n)e.state=0;for(const e of n)e.isSelected&&ye(e);const t=Array.from(n).sort((e,s)=>e.zoom-s.zoom);for(const e of t)if(e.isVisible=!!(e.state&nt),e.children&&(e.isVisible||e.state&Zt))for(const s of e.children)s.state=Zt;else e.isSelected&&Pt(e)}function ye(n){let t=n;for(;t;){if(t.isLoaded||t.content)return t.state|=nt,!0;t=t.parent}return!1}function Pt(n){for(const t of n.children)t.isLoaded||t.content?t.state|=nt:Pt(t)}const nn={TilesetClass:Et,data:{type:"data",value:[]},dataComparator:Gs.equal,renderSubLayers:{type:"function",value:n=>new m.GeoJsonLayer(n)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:n=>{}},onTileUnload:{type:"function",value:n=>{}},onTileError:{type:"function",value:n=>console.error(n)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:Lt,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0};class it extends m.CompositeLayer{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return!!this.state?.tileset?.selectedTiles?.every(t=>t.isLoaded&&t.layers&&t.layers.every(e=>e.isLoaded))}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({changeFlags:t}){let{tileset:e}=this.state;const s=t.propsOrDataChanged||t.updateTriggersChanged,i=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getTileData);e?s&&(e.setOptions(this._getTilesetOptions()),i?e.reloadAll():e.tiles.forEach(o=>{o.layers=null})):(e=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:e})),this._updateTileset()}_getTilesetOptions(){const{tileSize:t,maxCacheSize:e,maxCacheByteSize:s,refinementStrategy:i,extent:o,maxZoom:r,minZoom:a,maxRequests:c,debounceTime:h,zoomOffset:u}=this.props;return{maxCacheSize:e,maxCacheByteSize:s,maxZoom:r,minZoom:a,tileSize:t,refinementStrategy:i,extent:o,maxRequests:c,debounceTime:h,zoomOffset:u,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){const t=this.state.tileset,{zRange:e,modelMatrix:s}=this.props,i=t.update(this.context.viewport,{zRange:e,modelMatrix:s}),{isLoaded:o}=t,r=this.state.isLoaded!==o,a=this.state.frameNumber!==i;o&&(r||a)&&this._onViewportLoad(),a&&this.setState({frameNumber:i}),this.state.isLoaded=o}_onViewportLoad(){const{tileset:t}=this.state,{onViewportLoad:e}=this.props;e&&e(t.selectedTiles)}_onTileLoad(t){this.props.onTileLoad(t),t.layers=null,this.setNeedsUpdate()}_onTileError(t,e){this.props.onTileError(t),e.layers=null,this.setNeedsUpdate()}_onTileUnload(t){this.props.onTileUnload(t)}getTileData(t){const{data:e,getTileData:s,fetch:i}=this.props,{signal:o}=t;return t.url=typeof e=="string"||Array.isArray(e)?Ds(e,t):null,s?s(t):i&&t.url?i(t.url,{propName:"data",layer:this,signal:o}):null}renderSubLayers(t){return this.props.renderSubLayers(t)}getSubLayerPropsByTile(t){return null}getPickingInfo(t){const e=t.sourceLayer,s=e.props.tile,i=t.info;return i.picked&&(i.tile=s),i.sourceTile=s,i.sourceTileSubLayer=e,i}_updateAutoHighlight(t){t.sourceTileSubLayer.updateAutoHighlight(t)}renderLayers(){return this.state.tileset.tiles.map(t=>{const e=this.getSubLayerPropsByTile(t);if(!(!t.isLoaded&&!t.content))if(t.layers)e&&t.layers[0]&&Object.keys(e).some(s=>t.layers[0].props[s]!==e[s])&&(t.layers=t.layers.map(s=>s.clone(e)));else{const s=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:t.id,updateTriggers:this.props.updateTriggers}),data:t.content,_offset:0,tile:t});t.layers=m.flatten(s,Boolean).map(i=>i.clone({tile:t,...e}))}return t.layers})}filterSubLayer({layer:t,cullRect:e}){const{tile:s}=t.props,{modelMatrix:i}=this.props;return this.state.tileset.isTileVisible(s,e,i?new m.Matrix4(i):null)}}it.defaultProps=nn;it.layerName="TileLayer";const at=Math.PI/180,J=new Float32Array(16),Ht=new Float32Array(12);function Kt(n,t,e){const s=t[0]*at,i=t[1]*at,o=t[2]*at,r=Math.sin(o),a=Math.sin(s),c=Math.sin(i),h=Math.cos(o),u=Math.cos(s),l=Math.cos(i),d=e[0],f=e[1],p=e[2];n[0]=d*l*u,n[1]=d*c*u,n[2]=d*-a,n[3]=f*(-c*h+l*a*r),n[4]=f*(l*h+c*a*r),n[5]=f*u*r,n[6]=p*(c*r+l*a*h),n[7]=p*(-l*r+c*a*h),n[8]=p*u*h}function Qt(n){return n[0]=n[0],n[1]=n[1],n[2]=n[2],n[3]=n[4],n[4]=n[5],n[5]=n[6],n[6]=n[8],n[7]=n[9],n[8]=n[10],n[9]=n[12],n[10]=n[13],n[11]=n[14],n.subarray(0,12)}const on={size:12,accessor:["getOrientation","getScale","getTranslation","getTransformMatrix"],shaderAttributes:{instanceModelMatrixCol0:{size:3,elementOffset:0},instanceModelMatrixCol1:{size:3,elementOffset:3},instanceModelMatrixCol2:{size:3,elementOffset:6},instanceTranslation:{size:3,elementOffset:9}},update(n,{startRow:t,endRow:e}){const{data:s,getOrientation:i,getScale:o,getTranslation:r,getTransformMatrix:a}=this.props,c=Array.isArray(a),h=c&&a.length===16,u=Array.isArray(o),l=Array.isArray(i),d=Array.isArray(r),f=h||!c&&!!a(s[0]);f?n.constant=h:n.constant=l&&u&&d;const p=n.value;if(n.constant){let g;f?(J.set(a),g=Qt(J)):(g=Ht,Kt(g,i,o),g.set(r,9)),n.value=new Float32Array(g)}else{let g=t*n.size;const{iterable:y,objectInfo:_}=m.createIterable(s,t,e);for(const x of y){_.index++;let M;if(f)J.set(h?a:a(x,_)),M=Qt(J);else{M=Ht;const T=l?i:i(x,_),w=u?o:o(x,_);Kt(M,T,w),M.set(d?r:r(x,_),9)}p[g++]=M[0],p[g++]=M[1],p[g++]=M[2],p[g++]=M[3],p[g++]=M[4],p[g++]=M[5],p[g++]=M[6],p[g++]=M[7],p[g++]=M[8],p[g++]=M[9],p[g++]=M[10],p[g++]=M[11]}}}};function rn(n,t){return t===m.COORDINATE_SYSTEM.CARTESIAN||t===m.COORDINATE_SYSTEM.METER_OFFSETS||t===m.COORDINATE_SYSTEM.DEFAULT&&!n.isGeospatial}const Jt=`uniform simpleMeshUniforms {
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("./index-IrsIiQNM.cjs"),G=require("./geotiff-D9Jxidvv.cjs"),V=require("./index-B-Nr9y7J.cjs"),m=require("./ControlGrid-BHj06tuI.cjs"),ze="Queued Requests",Ne="Active Requests",Ve="Cancelled Requests",Fe="Queued Requests Ever",qe="Active Requests Ever",Ge={id:"request-scheduler",throttleRequests:!0,maxRequests:6,debounceTime:0};class Be{props;stats;activeRequestCount=0;requestQueue=[];requestMap=new Map;updateTimer=null;constructor(t={}){this.props={...Ge,...t},this.stats=new m.Stats({id:this.props.id}),this.stats.get(ze),this.stats.get(Ne),this.stats.get(Ve),this.stats.get(Fe),this.stats.get(qe)}scheduleRequest(t,e=()=>0){if(!this.props.throttleRequests)return Promise.resolve({done:()=>{}});if(this.requestMap.has(t))return this.requestMap.get(t);const s={handle:t,priority:0,getPriority:e},i=new Promise(o=>(s.resolve=o,s));return this.requestQueue.push(s),this.requestMap.set(t,i),this._issueNewRequests(),i}_issueRequest(t){const{handle:e,resolve:s}=t;let i=!1;const o=()=>{i||(i=!0,this.requestMap.delete(e),this.activeRequestCount--,this._issueNewRequests())};return this.activeRequestCount++,s?s({done:o}):Promise.resolve({done:o})}_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;const t=Math.max(this.props.maxRequests-this.activeRequestCount,0);if(t!==0){this._updateAllRequests();for(let e=0;e<t;++e){const s=this.requestQueue.shift();s&&this._issueRequest(s)}}}_updateAllRequests(){const t=this.requestQueue;for(let e=0;e<t.length;++e){const s=t[e];this._updateRequest(s)||(t.splice(e,1),this.requestMap.delete(s.handle),e--)}t.sort((e,s)=>e.priority-s.priority)}_updateRequest(t){return t.priority=t.getPriority(t.handle),t.priority<0?(t.resolve(null),!1):!0}}function De(n){let t=1/0,e=1/0,s=1/0,i=-1/0,o=-1/0,r=-1/0;const a=n.POSITION?n.POSITION.value:[],c=a&&a.length;for(let h=0;h<c;h+=3){const u=a[h],l=a[h+1],d=a[h+2];t=u<t?u:t,e=l<e?l:e,s=d<s?d:s,i=u>i?u:i,o=l>o?l:o,r=d>r?d:r}return[[t,e,s],[i,o,r]]}let Y;class xt extends m.Vector{static get ZERO(){return Y||(Y=new xt(0,0,0,0),Object.freeze(Y)),Y}constructor(t=0,e=0,s=0,i=0){super(-0,-0,-0,-0),m.isArray(t)&&arguments.length===1?this.copy(t):(m.config.debug&&(m.checkNumber(t),m.checkNumber(e),m.checkNumber(s),m.checkNumber(i)),this[0]=t,this[1]=e,this[2]=s,this[3]=i)}set(t,e,s,i){return this[0]=t,this[1]=e,this[2]=s,this[3]=i,this.check()}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}fromObject(t){return m.config.debug&&(m.checkNumber(t.x),m.checkNumber(t.y),m.checkNumber(t.z),m.checkNumber(t.w)),this[0]=t.x,this[1]=t.y,this[2]=t.z,this[3]=t.w,this}toObject(t){return t.x=this[0],t.y=this[1],t.z=this[2],t.w=this[3],t}get ELEMENTS(){return 4}get z(){return this[2]}set z(t){this[2]=m.checkNumber(t)}get w(){return this[3]}set w(t){this[3]=m.checkNumber(t)}transform(t){return m.transformMat4(this,this,t),this.check()}transformByMatrix3(t){return m.vec4_transformMat3(this,this,t),this.check()}transformByMatrix2(t){return m.vec4_transformMat2(this,this,t),this.check()}transformByQuaternion(t){return m.transformQuat(this,this,t),this.check()}applyMatrix4(t){return t.transform(this,this),this}}function Ue(){const n=new m.ARRAY_TYPE(9);return m.ARRAY_TYPE!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[5]=0,n[6]=0,n[7]=0),n[0]=1,n[4]=1,n[8]=1,n}function ke(n,t){if(n===t){const e=t[1],s=t[2],i=t[5];n[1]=t[3],n[2]=t[6],n[3]=e,n[5]=t[7],n[6]=s,n[7]=i}else n[0]=t[0],n[1]=t[3],n[2]=t[6],n[3]=t[1],n[4]=t[4],n[5]=t[7],n[6]=t[2],n[7]=t[5],n[8]=t[8];return n}function We(n,t){const e=t[0],s=t[1],i=t[2],o=t[3],r=t[4],a=t[5],c=t[6],h=t[7],u=t[8],l=u*r-a*h,d=-u*o+a*c,f=h*o-r*c;let p=e*l+s*d+i*f;return p?(p=1/p,n[0]=l*p,n[1]=(-u*s+i*h)*p,n[2]=(a*s-i*r)*p,n[3]=d*p,n[4]=(u*e-i*c)*p,n[5]=(-a*e+i*o)*p,n[6]=f*p,n[7]=(-h*e+s*c)*p,n[8]=(r*e-s*o)*p,n):null}function je(n){const t=n[0],e=n[1],s=n[2],i=n[3],o=n[4],r=n[5],a=n[6],c=n[7],h=n[8];return t*(h*o-r*c)+e*(-h*i+r*a)+s*(c*i-o*a)}function Nt(n,t,e){const s=t[0],i=t[1],o=t[2],r=t[3],a=t[4],c=t[5],h=t[6],u=t[7],l=t[8],d=e[0],f=e[1],p=e[2],g=e[3],y=e[4],_=e[5],x=e[6],M=e[7],T=e[8];return n[0]=d*s+f*r+p*h,n[1]=d*i+f*a+p*u,n[2]=d*o+f*c+p*l,n[3]=g*s+y*r+_*h,n[4]=g*i+y*a+_*u,n[5]=g*o+y*c+_*l,n[6]=x*s+M*r+T*h,n[7]=x*i+M*a+T*u,n[8]=x*o+M*c+T*l,n}function Ye(n,t,e){const s=t[0],i=t[1],o=t[2],r=t[3],a=t[4],c=t[5],h=t[6],u=t[7],l=t[8],d=e[0],f=e[1];return n[0]=s,n[1]=i,n[2]=o,n[3]=r,n[4]=a,n[5]=c,n[6]=d*s+f*r+h,n[7]=d*i+f*a+u,n[8]=d*o+f*c+l,n}function Xe(n,t,e){const s=t[0],i=t[1],o=t[2],r=t[3],a=t[4],c=t[5],h=t[6],u=t[7],l=t[8],d=Math.sin(e),f=Math.cos(e);return n[0]=f*s+d*r,n[1]=f*i+d*a,n[2]=f*o+d*c,n[3]=f*r-d*s,n[4]=f*a-d*i,n[5]=f*c-d*o,n[6]=h,n[7]=u,n[8]=l,n}function Vt(n,t,e){const s=e[0],i=e[1];return n[0]=s*t[0],n[1]=s*t[1],n[2]=s*t[2],n[3]=i*t[3],n[4]=i*t[4],n[5]=i*t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n}function $e(n,t){const e=t[0],s=t[1],i=t[2],o=t[3],r=e+e,a=s+s,c=i+i,h=e*r,u=s*r,l=s*a,d=i*r,f=i*a,p=i*c,g=o*r,y=o*a,_=o*c;return n[0]=1-l-p,n[3]=u-_,n[6]=d+y,n[1]=u+_,n[4]=1-h-p,n[7]=f-g,n[2]=d-y,n[5]=f+g,n[8]=1-h-l,n}var dt;(function(n){n[n.COL0ROW0=0]="COL0ROW0",n[n.COL0ROW1=1]="COL0ROW1",n[n.COL0ROW2=2]="COL0ROW2",n[n.COL1ROW0=3]="COL1ROW0",n[n.COL1ROW1=4]="COL1ROW1",n[n.COL1ROW2=5]="COL1ROW2",n[n.COL2ROW0=6]="COL2ROW0",n[n.COL2ROW1=7]="COL2ROW1",n[n.COL2ROW2=8]="COL2ROW2"})(dt||(dt={}));const Ze=Object.freeze([1,0,0,0,1,0,0,0,1]);class E extends m.Matrix{static get IDENTITY(){return Ke()}static get ZERO(){return He()}get ELEMENTS(){return 9}get RANK(){return 3}get INDICES(){return dt}constructor(t,...e){super(-0,-0,-0,-0,-0,-0,-0,-0,-0),arguments.length===1&&Array.isArray(t)?this.copy(t):e.length>0?this.copy([t,...e]):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(Ze)}fromObject(t){return this.check()}fromQuaternion(t){return $e(this,t),this.check()}set(t,e,s,i,o,r,a,c,h){return this[0]=t,this[1]=e,this[2]=s,this[3]=i,this[4]=o,this[5]=r,this[6]=a,this[7]=c,this[8]=h,this.check()}setRowMajor(t,e,s,i,o,r,a,c,h){return this[0]=t,this[1]=i,this[2]=a,this[3]=e,this[4]=o,this[5]=c,this[6]=s,this[7]=r,this[8]=h,this.check()}determinant(){return je(this)}transpose(){return ke(this,this),this.check()}invert(){return We(this,this),this.check()}multiplyLeft(t){return Nt(this,t,this),this.check()}multiplyRight(t){return Nt(this,this,t),this.check()}rotate(t){return Xe(this,this,t),this.check()}scale(t){return Array.isArray(t)?Vt(this,this,t):Vt(this,this,[t,t]),this.check()}translate(t){return Ye(this,this,t),this.check()}transform(t,e){let s;switch(t.length){case 2:s=m.transformMat3$1(e||[-0,-0],t,this);break;case 3:s=m.transformMat3(e||[-0,-0,-0],t,this);break;case 4:s=m.vec4_transformMat3(e||[-0,-0,-0,-0],t,this);break;default:throw new Error("Illegal vector")}return m.checkVector(s,t.length),s}transformVector(t,e){return this.transform(t,e)}transformVector2(t,e){return this.transform(t,e)}transformVector3(t,e){return this.transform(t,e)}}let X,$=null;function He(){return X||(X=new E([0,0,0,0,0,0,0,0,0]),Object.freeze(X)),X}function Ke(){return $||($=new E,Object.freeze($)),$}function Ft(){const n=new m.ARRAY_TYPE(4);return m.ARRAY_TYPE!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n[3]=1,n}function Qe(n){return n[0]=0,n[1]=0,n[2]=0,n[3]=1,n}function le(n,t,e){e=e*.5;const s=Math.sin(e);return n[0]=s*t[0],n[1]=s*t[1],n[2]=s*t[2],n[3]=Math.cos(e),n}function qt(n,t,e){const s=t[0],i=t[1],o=t[2],r=t[3],a=e[0],c=e[1],h=e[2],u=e[3];return n[0]=s*u+r*a+i*h-o*c,n[1]=i*u+r*c+o*a-s*h,n[2]=o*u+r*h+s*c-i*a,n[3]=r*u-s*a-i*c-o*h,n}function Je(n,t,e){e*=.5;const s=t[0],i=t[1],o=t[2],r=t[3],a=Math.sin(e),c=Math.cos(e);return n[0]=s*c+r*a,n[1]=i*c+o*a,n[2]=o*c-i*a,n[3]=r*c-s*a,n}function ts(n,t,e){e*=.5;const s=t[0],i=t[1],o=t[2],r=t[3],a=Math.sin(e),c=Math.cos(e);return n[0]=s*c-o*a,n[1]=i*c+r*a,n[2]=o*c+s*a,n[3]=r*c-i*a,n}function es(n,t,e){e*=.5;const s=t[0],i=t[1],o=t[2],r=t[3],a=Math.sin(e),c=Math.cos(e);return n[0]=s*c+i*a,n[1]=i*c-s*a,n[2]=o*c+r*a,n[3]=r*c-o*a,n}function ss(n,t){const e=t[0],s=t[1],i=t[2];return n[0]=e,n[1]=s,n[2]=i,n[3]=Math.sqrt(Math.abs(1-e*e-s*s-i*i)),n}function et(n,t,e,s){const i=t[0],o=t[1],r=t[2],a=t[3];let c=e[0],h=e[1],u=e[2],l=e[3],d,f,p,g,y;return d=i*c+o*h+r*u+a*l,d<0&&(d=-d,c=-c,h=-h,u=-u,l=-l),1-d>m.EPSILON?(f=Math.acos(d),y=Math.sin(f),p=Math.sin((1-s)*f)/y,g=Math.sin(s*f)/y):(p=1-s,g=s),n[0]=p*i+g*c,n[1]=p*o+g*h,n[2]=p*r+g*u,n[3]=p*a+g*l,n}function ns(n,t){const e=t[0],s=t[1],i=t[2],o=t[3],r=e*e+s*s+i*i+o*o,a=r?1/r:0;return n[0]=-e*a,n[1]=-s*a,n[2]=-i*a,n[3]=o*a,n}function is(n,t){return n[0]=-t[0],n[1]=-t[1],n[2]=-t[2],n[3]=t[3],n}function he(n,t){const e=t[0]+t[4]+t[8];let s;if(e>0)s=Math.sqrt(e+1),n[3]=.5*s,s=.5/s,n[0]=(t[5]-t[7])*s,n[1]=(t[6]-t[2])*s,n[2]=(t[1]-t[3])*s;else{let i=0;t[4]>t[0]&&(i=1),t[8]>t[i*3+i]&&(i=2);const o=(i+1)%3,r=(i+2)%3;s=Math.sqrt(t[i*3+i]-t[o*3+o]-t[r*3+r]+1),n[i]=.5*s,s=.5/s,n[3]=(t[o*3+r]-t[r*3+o])*s,n[o]=(t[o*3+i]+t[i*3+o])*s,n[r]=(t[r*3+i]+t[i*3+r])*s}return n}const os=m.add,rs=m.scale,as=m.dot,cs=m.lerp,ls=m.length,hs=m.squaredLength,ue=m.normalize$1,us=(function(){const n=m.create(),t=m.fromValues(1,0,0),e=m.fromValues(0,1,0);return function(s,i,o){const r=m.dot$1(i,o);return r<-.999999?(m.cross(n,t,i),m.len(n)<1e-6&&m.cross(n,e,i),m.normalize(n,n),le(s,n,Math.PI),s):r>.999999?(s[0]=0,s[1]=0,s[2]=0,s[3]=1,s):(m.cross(n,i,o),s[0]=n[0],s[1]=n[1],s[2]=n[2],s[3]=1+r,ue(s,s))}})();(function(){const n=Ft(),t=Ft();return function(e,s,i,o,r,a){return et(n,s,r,a),et(t,i,o,a),et(e,n,t,2*a*(1-a)),e}})();(function(){const n=Ue();return function(t,e,s,i){return n[0]=s[0],n[3]=s[1],n[6]=s[2],n[1]=i[0],n[4]=i[1],n[7]=i[2],n[2]=-e[0],n[5]=-e[1],n[8]=-e[2],ue(t,he(t,n))}})();const ds=[0,0,0,1];class Gt extends m.MathArray{constructor(t=0,e=0,s=0,i=1){super(-0,-0,-0,-0),Array.isArray(t)&&arguments.length===1?this.copy(t):this.set(t,e,s,i)}copy(t){return this[0]=t[0],this[1]=t[1],this[2]=t[2],this[3]=t[3],this.check()}set(t,e,s,i){return this[0]=t,this[1]=e,this[2]=s,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 he(this,t),this.check()}fromAxisRotation(t,e){return le(this,t,e),this.check()}identity(){return Qe(this),this.check()}setAxisAngle(t,e){return this.fromAxisRotation(t,e)}get ELEMENTS(){return 4}get x(){return this[0]}set x(t){this[0]=m.checkNumber(t)}get y(){return this[1]}set y(t){this[1]=m.checkNumber(t)}get z(){return this[2]}set z(t){this[2]=m.checkNumber(t)}get w(){return this[3]}set w(t){this[3]=m.checkNumber(t)}len(){return ls(this)}lengthSquared(){return hs(this)}dot(t){return as(this,t)}rotationTo(t,e){return us(this,t,e),this.check()}add(t){return os(this,this,t),this.check()}calculateW(){return ss(this,this),this.check()}conjugate(){return is(this,this),this.check()}invert(){return ns(this,this),this.check()}lerp(t,e,s){return s===void 0?this.lerp(this,t,e):(cs(this,t,e,s),this.check())}multiplyRight(t){return qt(this,this,t),this.check()}multiplyLeft(t){return qt(this,t,this),this.check()}normalize(){const t=this.len(),e=t>0?1/t:0;return this[0]=this[0]*e,this[1]=this[1]*e,this[2]=this[2]*e,this[3]=this[3]*e,t===0&&(this[3]=1),this.check()}rotateX(t){return Je(this,this,t),this.check()}rotateY(t){return ts(this,this,t),this.check()}rotateZ(t){return es(this,this,t),this.check()}scale(t){return rs(this,this,t),this.check()}slerp(t,e,s){let i,o,r;switch(arguments.length){case 1:({start:i=ds,target:o,ratio:r}=t);break;case 2:i=this,o=t,r=e;break;default:i=t,o=e,r=s}return et(this,i,o,r),this.check()}transformVector4(t,e=new xt){return m.transformQuat$1(e,t,this),m.checkVector(e,4)}lengthSq(){return this.lengthSquared()}setFromAxisAngle(t,e){return this.setAxisAngle(t,e)}premultiply(t){return this.multiplyLeft(t)}multiply(t){return this.multiplyRight(t)}}const fs=1e-15,ms=1e-20,de={name:"phongMaterial",dependencies:[m.lighting],source:m.PHONG_WGSL,vs:m.PHONG_VS,fs:m.PHONG_FS,defines:{LIGHTING_FRAGMENT:!0},uniformTypes:{ambient:"f32",diffuse:"f32",shininess:"f32",specularColor:"vec3<f32>"},defaultUniforms:{ambient:.35,diffuse:.6,shininess:32,specularColor:[.15,.15,.15]},getUniforms(n){const t={...n};return t.specularColor&&(t.specularColor=t.specularColor.map(e=>e/255)),{...de.defaultUniforms,...t}}},fe=[0,0,0,255],ps=[0,0,0,255],gs={stroked:!0,filled:!0,extruded:!1,elevationScale:1,wireframe:!1,_normalize:!0,_windingOrder:"CW",lineWidthUnits:"meters",lineWidthScale:1,lineWidthMinPixels:0,lineWidthMaxPixels:Number.MAX_SAFE_INTEGER,lineJointRounded:!1,lineMiterLimit:4,getPolygon:{type:"accessor",value:n=>n.polygon},getFillColor:{type:"accessor",value:ps},getLineColor:{type:"accessor",value:fe},getLineWidth:{type:"accessor",value:1},getElevation:{type:"accessor",value:1e3},material:!0};class Mt extends m.CompositeLayer{initializeState(){this.state={paths:[],pathsDiff:null},this.props.getLineDashArray&&m.defaultLogger.removed("getLineDashArray","PathStyleExtension")()}updateState({changeFlags:t}){const e=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getPolygon);if(e&&Array.isArray(t.dataChanged)){const s=this.state.paths.slice(),i=t.dataChanged.map(o=>m.replaceInRange({data:s,getIndex:r=>r.__source.index,dataRange:o,replace:this._getPaths(o)}));this.setState({paths:s,pathsDiff:i})}else e&&this.setState({paths:this._getPaths(),pathsDiff:null})}_getPaths(t={}){const{data:e,getPolygon:s,positionFormat:i,_normalize:o}=this.props,r=[],a=i==="XY"?2:3,{startRow:c,endRow:h}=t,{iterable:u,objectInfo:l}=m.createIterable(e,c,h);for(const d of u){l.index++;let f=s(d,l);o&&(f=m.normalize$2(f,a));const{holeIndices:p}=f,g=f.positions||f;if(p)for(let y=0;y<=p.length;y++){const _=g.slice(p[y-1]||0,p[y]||g.length);r.push(this.getSubLayerRow({path:_},d,l.index))}else r.push(this.getSubLayerRow({path:g},d,l.index))}return r}renderLayers(){const{data:t,_dataDiff:e,stroked:s,filled:i,extruded:o,wireframe:r,_normalize:a,_windingOrder:c,elevationScale:h,transitions:u,positionFormat:l}=this.props,{lineWidthUnits:d,lineWidthScale:f,lineWidthMinPixels:p,lineWidthMaxPixels:g,lineJointRounded:y,lineMiterLimit:_,lineDashJustified:x}=this.props,{getFillColor:M,getLineColor:T,getLineWidth:w,getLineDashArray:S,getElevation:L,getPolygon:R,updateTriggers:b,material:C}=this.props,{paths:q,pathsDiff:k}=this.state,ot=this.getSubLayerClass("fill",m.SolidPolygonLayer),rt=this.getSubLayerClass("stroke",m.PathLayer),W=this.shouldRenderSubLayer("fill",q)&&new ot({_dataDiff:e,extruded:o,elevationScale:h,filled:i,wireframe:r,_normalize:a,_windingOrder:c,getElevation:L,getFillColor:M,getLineColor:o&&r?T:fe,material:C,transitions:u},this.getSubLayerProps({id:"fill",updateTriggers:b&&{getPolygon:b.getPolygon,getElevation:b.getElevation,getFillColor:b.getFillColor,lineColors:o&&r,getLineColor:b.getLineColor}}),{data:t,positionFormat:l,getPolygon:R}),Oe=!o&&s&&this.shouldRenderSubLayer("stroke",q)&&new rt({_dataDiff:k&&(()=>k),widthUnits:d,widthScale:f,widthMinPixels:p,widthMaxPixels:g,jointRounded:y,miterLimit:_,dashJustified:x,_pathType:"loop",transitions:u&&{getWidth:u.getLineWidth,getColor:u.getLineColor,getPath:u.getPolygon},getColor:this.getSubLayerAccessor(T),getWidth:this.getSubLayerAccessor(w),getDashArray:this.getSubLayerAccessor(S)},this.getSubLayerProps({id:"stroke",updateTriggers:b&&{getWidth:b.getLineWidth,getColor:b.getLineColor,getDashArray:b.getLineDashArray}}),{data:q,positionFormat:l,getPath:ve=>ve.path});return[!o&&W,Oe,o&&W]}}Mt.layerName="PolygonLayer";Mt.defaultProps=gs;class ys{constructor(t){this.index=t,this.isVisible=!1,this.isSelected=!1,this.parent=null,this.children=[],this.content=null,this._loader=void 0,this._abortController=null,this._loaderId=0,this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1}get bbox(){return this._bbox}set bbox(t){this._bbox||(this._bbox=t,"west"in t?this.boundingBox=[[t.west,t.south],[t.east,t.north]]:this.boundingBox=[[t.left,t.top],[t.right,t.bottom]])}get data(){return this.isLoading&&this._loader?this._loader.then(()=>this.data):this.content}get isLoaded(){return this._isLoaded&&!this._needsReload}get isLoading(){return!!this._loader&&!this._isCancelled}get needsReload(){return this._needsReload||this._isCancelled}get byteLength(){const t=this.content?this.content.byteLength:0;return Number.isFinite(t)||console.error("byteLength not defined in tile data"),t}async _loadData({getData:t,requestScheduler:e,onLoad:s,onError:i}){const{index:o,id:r,bbox:a,userData:c,zoom:h}=this,u=this._loaderId;this._abortController=new AbortController;const{signal:l}=this._abortController,d=await e.scheduleRequest(this,g=>g.isSelected?1:-1);if(!d){this._isCancelled=!0;return}if(this._isCancelled){d.done();return}let f=null,p;try{f=await t({index:o,id:r,bbox:a,userData:c,zoom:h,signal:l})}catch(g){p=g||!0}finally{d.done()}if(u===this._loaderId){if(this._loader=void 0,this.content=f,this._isCancelled&&!f){this._isLoaded=!1;return}this._isLoaded=!0,this._isCancelled=!1,p?i(p,this):s(this)}}loadData(t){return this._isLoaded=!1,this._isCancelled=!1,this._needsReload=!1,this._loaderId++,this._loader=this._loadData(t),this._loader}setNeedsReload(){this.isLoading&&(this.abort(),this._loader=void 0),this._needsReload=!0}abort(){this.isLoaded||(this._isCancelled=!0,this._abortController?.abort())}}const P={OUTSIDE:-1,INTERSECTING:0,INSIDE:1},Bt=new m.Vector3,_s=new m.Vector3;class Tt{constructor(t=[0,0,0],e=[0,0,0],s){s=s||Bt.copy(t).add(e).scale(.5),this.center=new m.Vector3(s),this.halfDiagonal=new m.Vector3(e).subtract(this.center),this.minimum=new m.Vector3(t),this.maximum=new m.Vector3(e)}clone(){return new Tt(this.minimum,this.maximum,this.center)}equals(t){return this===t||!!t&&this.minimum.equals(t.minimum)&&this.maximum.equals(t.maximum)}transform(t){return this.center.transformAsPoint(t),this.halfDiagonal.transform(t),this.minimum.transform(t),this.maximum.transform(t),this}intersectPlane(t){const{halfDiagonal:e}=this,s=_s.from(t.normal),i=e.x*Math.abs(s.x)+e.y*Math.abs(s.y)+e.z*Math.abs(s.z),o=this.center.dot(s)+t.distance;return o-i>0?P.INSIDE:o+i<0?P.OUTSIDE:P.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=Bt.from(t).subtract(this.center),{halfDiagonal:s}=this;let i=0,o;return o=Math.abs(e.x)-s.x,o>0&&(i+=o*o),o=Math.abs(e.y)-s.y,o>0&&(i+=o*o),o=Math.abs(e.z)-s.z,o>0&&(i+=o*o),i}}const j=new m.Vector3,Dt=new m.Vector3;class wt{constructor(t=[0,0,0],e=0){this.radius=-0,this.center=new m.Vector3,this.fromCenterRadius(t,e)}fromCenterRadius(t,e){return this.center.from(t),this.radius=e,this}fromCornerPoints(t,e){return e=j.from(e),this.center=new m.Vector3().from(t).add(e).scale(.5),this.radius=this.center.distance(e),this}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.radius===t.radius}clone(){return new wt(this.center,this.radius)}union(t){const e=this.center,s=this.radius,i=t.center,o=t.radius,r=j.copy(i).subtract(e),a=r.magnitude();if(s>=a+o)return this.clone();if(o>=a+s)return t.clone();const c=(s+a+o)*.5;return Dt.copy(r).scale((-s+c)/a).add(e),this.center.copy(Dt),this.radius=c,this}expand(t){const s=j.from(t).subtract(this.center).magnitude();return s>this.radius&&(this.radius=s),this}transform(t){this.center.transform(t);const e=m.getScaling(j,t);return this.radius=Math.max(e[0],Math.max(e[1],e[2]))*this.radius,this}distanceSquaredTo(t){const e=this.distanceTo(t);return e*e}distanceTo(t){const s=j.from(t).subtract(this.center);return Math.max(0,s.len()-this.radius)}intersectPlane(t){const e=this.center,s=this.radius,o=t.normal.dot(e)+t.distance;return o<-s?P.OUTSIDE:o<s?P.INTERSECTING:P.INSIDE}}const xs=new m.Vector3,Ms=new m.Vector3,Z=new m.Vector3,H=new m.Vector3,K=new m.Vector3,Ts=new m.Vector3,ws=new m.Vector3,O={COLUMN0ROW0:0,COLUMN0ROW1:1,COLUMN0ROW2:2,COLUMN1ROW0:3,COLUMN1ROW1:4,COLUMN1ROW2:5,COLUMN2ROW0:6,COLUMN2ROW1:7,COLUMN2ROW2:8};class bt{constructor(t=[0,0,0],e=[0,0,0,0,0,0,0,0,0]){this.center=new m.Vector3().from(t),this.halfAxes=new E(e)}get halfSize(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),s=this.halfAxes.getColumn(2);return[new m.Vector3(t).len(),new m.Vector3(e).len(),new m.Vector3(s).len()]}get quaternion(){const t=this.halfAxes.getColumn(0),e=this.halfAxes.getColumn(1),s=this.halfAxes.getColumn(2),i=new m.Vector3(t).normalize(),o=new m.Vector3(e).normalize(),r=new m.Vector3(s).normalize();return new Gt().fromMatrix3(new E([...i,...o,...r]))}fromCenterHalfSizeQuaternion(t,e,s){const i=new Gt(s),o=new E().fromQuaternion(i);return o[0]=o[0]*e[0],o[1]=o[1]*e[0],o[2]=o[2]*e[0],o[3]=o[3]*e[1],o[4]=o[4]*e[1],o[5]=o[5]*e[1],o[6]=o[6]*e[2],o[7]=o[7]*e[2],o[8]=o[8]*e[2],this.center=new m.Vector3().from(t),this.halfAxes=o,this}clone(){return new bt(this.center,this.halfAxes)}equals(t){return this===t||!!t&&this.center.equals(t.center)&&this.halfAxes.equals(t.halfAxes)}getBoundingSphere(t=new wt){const e=this.halfAxes,s=e.getColumn(0,Z),i=e.getColumn(1,H),o=e.getColumn(2,K),r=xs.copy(s).add(i).add(o);return t.center.copy(this.center),t.radius=r.magnitude(),t}intersectPlane(t){const e=this.center,s=t.normal,i=this.halfAxes,o=s.x,r=s.y,a=s.z,c=Math.abs(o*i[O.COLUMN0ROW0]+r*i[O.COLUMN0ROW1]+a*i[O.COLUMN0ROW2])+Math.abs(o*i[O.COLUMN1ROW0]+r*i[O.COLUMN1ROW1]+a*i[O.COLUMN1ROW2])+Math.abs(o*i[O.COLUMN2ROW0]+r*i[O.COLUMN2ROW1]+a*i[O.COLUMN2ROW2]),h=s.dot(e)+t.distance;return h<=-c?P.OUTSIDE:h>=c?P.INSIDE:P.INTERSECTING}distanceTo(t){return Math.sqrt(this.distanceSquaredTo(t))}distanceSquaredTo(t){const e=Ms.from(t).subtract(this.center),s=this.halfAxes,i=s.getColumn(0,Z),o=s.getColumn(1,H),r=s.getColumn(2,K),a=i.magnitude(),c=o.magnitude(),h=r.magnitude();i.normalize(),o.normalize(),r.normalize();let u=0,l;return l=Math.abs(e.dot(i))-a,l>0&&(u+=l*l),l=Math.abs(e.dot(o))-c,l>0&&(u+=l*l),l=Math.abs(e.dot(r))-h,l>0&&(u+=l*l),u}computePlaneDistances(t,e,s=[-0,-0]){let i=Number.POSITIVE_INFINITY,o=Number.NEGATIVE_INFINITY;const r=this.center,a=this.halfAxes,c=a.getColumn(0,Z),h=a.getColumn(1,H),u=a.getColumn(2,K),l=Ts.copy(c).add(h).add(u).add(r),d=ws.copy(l).subtract(t);let f=e.dot(d);return i=Math.min(f,i),o=Math.max(f,o),l.copy(r).add(c).add(h).subtract(u),d.copy(l).subtract(t),f=e.dot(d),i=Math.min(f,i),o=Math.max(f,o),l.copy(r).add(c).subtract(h).add(u),d.copy(l).subtract(t),f=e.dot(d),i=Math.min(f,i),o=Math.max(f,o),l.copy(r).add(c).subtract(h).subtract(u),d.copy(l).subtract(t),f=e.dot(d),i=Math.min(f,i),o=Math.max(f,o),r.copy(l).subtract(c).add(h).add(u),d.copy(l).subtract(t),f=e.dot(d),i=Math.min(f,i),o=Math.max(f,o),r.copy(l).subtract(c).add(h).subtract(u),d.copy(l).subtract(t),f=e.dot(d),i=Math.min(f,i),o=Math.max(f,o),r.copy(l).subtract(c).subtract(h).add(u),d.copy(l).subtract(t),f=e.dot(d),i=Math.min(f,i),o=Math.max(f,o),r.copy(l).subtract(c).subtract(h).subtract(u),d.copy(l).subtract(t),f=e.dot(d),i=Math.min(f,i),o=Math.max(f,o),s[0]=i,s[1]=o,s}transform(t){this.center.transformAsPoint(t);const e=this.halfAxes.getColumn(0,Z);e.transformAsPoint(t);const s=this.halfAxes.getColumn(1,H);s.transformAsPoint(t);const i=this.halfAxes.getColumn(2,K);return i.transformAsPoint(t),this.halfAxes=new E([...e,...s,...i]),this}getTransform(){throw new Error("not implemented")}}const Ut=new m.Vector3,kt=new m.Vector3;class U{constructor(t=[0,0,1],e=0){this.normal=new m.Vector3,this.distance=-0,this.fromNormalDistance(t,e)}fromNormalDistance(t,e){return m.assert(Number.isFinite(e)),this.normal.from(t).normalize(),this.distance=e,this}fromPointNormal(t,e){t=Ut.from(t),this.normal.from(e).normalize();const s=-this.normal.dot(t);return this.distance=s,this}fromCoefficients(t,e,s,i){return this.normal.set(t,e,s),m.assert(m.equals(this.normal.len(),1)),this.distance=i,this}clone(){return new U(this.normal,this.distance)}equals(t){return m.equals(this.distance,t.distance)&&m.equals(this.normal,t.normal)}getPointDistance(t){return this.normal.dot(t)+this.distance}transform(t){const e=kt.copy(this.normal).transformAsVector(t).normalize(),s=this.normal.scale(-this.distance).transform(t);return this.fromPointNormal(s,e)}projectPointOntoPlane(t,e=[0,0,0]){const s=Ut.from(t),i=this.getPointDistance(s),o=kt.copy(this.normal).scale(i);return s.subtract(o).to(e)}}const Wt=[new m.Vector3([1,0,0]),new m.Vector3([0,1,0]),new m.Vector3([0,0,1])],jt=new m.Vector3,bs=new m.Vector3;class A{constructor(t=[]){this.planes=t}fromBoundingSphere(t){this.planes.length=2*Wt.length;const e=t.center,s=t.radius;let i=0;for(const o of Wt){let r=this.planes[i],a=this.planes[i+1];r||(r=this.planes[i]=new U),a||(a=this.planes[i+1]=new U);const c=jt.copy(o).scale(-s).add(e);r.fromPointNormal(c,o);const h=jt.copy(o).scale(s).add(e),u=bs.copy(o).negate();a.fromPointNormal(h,u),i+=2}return this}computeVisibility(t){let e=P.INSIDE;for(const s of this.planes)switch(t.intersectPlane(s)){case P.OUTSIDE:return P.OUTSIDE;case P.INTERSECTING:e=P.INTERSECTING;break}return e}computeVisibilityWithPlaneMask(t,e){if(m.assert(Number.isFinite(e),"parentPlaneMask is required."),e===A.MASK_OUTSIDE||e===A.MASK_INSIDE)return e;let s=A.MASK_INSIDE;const i=this.planes;for(let o=0;o<this.planes.length;++o){const r=o<31?1<<o:0;if(o<31&&(e&r)===0)continue;const a=i[o],c=t.intersectPlane(a);if(c===P.OUTSIDE)return A.MASK_OUTSIDE;c===P.INTERSECTING&&(s|=r)}return s}}A.MASK_OUTSIDE=4294967295;A.MASK_INSIDE=0;A.MASK_INDETERMINATE=2147483647;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;new m.Vector3;const I=new E,Ss=new E,Cs=new E,Q=new E,Yt=new E;function Ls(n,t={}){const e=ms,s=10;let i=0,o=0;const r=Ss,a=Cs;r.identity(),a.copy(n);const c=e*Es(a);for(;o<s&&Ps(a)>c;)Rs(a,Q),Yt.copy(Q).transpose(),a.multiplyRight(Q),a.multiplyLeft(Yt),r.multiplyRight(Q),++i>2&&(++o,i=0);return t.unitary=r.toTarget(t.unitary),t.diagonal=a.toTarget(t.diagonal),t}function Es(n){let t=0;for(let e=0;e<9;++e){const s=n[e];t+=s*s}return Math.sqrt(t)}const ft=[1,0,0],mt=[2,2,1];function Ps(n){let t=0;for(let e=0;e<3;++e){const s=n[I.getElementIndex(mt[e],ft[e])];t+=2*s*s}return Math.sqrt(t)}function Rs(n,t){const e=fs;let s=0,i=1;for(let h=0;h<3;++h){const u=Math.abs(n[I.getElementIndex(mt[h],ft[h])]);u>s&&(i=h,s=u)}const o=ft[i],r=mt[i];let a=1,c=0;if(Math.abs(n[I.getElementIndex(r,o)])>e){const h=n[I.getElementIndex(r,r)],u=n[I.getElementIndex(o,o)],l=n[I.getElementIndex(r,o)],d=(h-u)/2/l;let f;d<0?f=-1/(-d+Math.sqrt(1+d*d)):f=1/(d+Math.sqrt(1+d*d)),a=1/Math.sqrt(1+f*f),c=f*a}return E.IDENTITY.to(t),t[I.getElementIndex(o,o)]=t[I.getElementIndex(r,r)]=a,t[I.getElementIndex(r,o)]=c,t[I.getElementIndex(o,r)]=-c,t}const z=new m.Vector3,Is=new m.Vector3,As=new m.Vector3,Os=new m.Vector3,vs=new m.Vector3,zs=new E,Ns={diagonal:new E,unitary:new E};function me(n,t=new bt){if(!n||n.length===0)return t.halfAxes=new E([0,0,0,0,0,0,0,0,0]),t.center=new m.Vector3,t;const e=n.length,s=new m.Vector3(0,0,0);for(const b of n)s.add(b);const i=1/e;s.multiplyByScalar(i);let o=0,r=0,a=0,c=0,h=0,u=0;for(const b of n){const C=z.copy(b).subtract(s);o+=C.x*C.x,r+=C.x*C.y,a+=C.x*C.z,c+=C.y*C.y,h+=C.y*C.z,u+=C.z*C.z}o*=i,r*=i,a*=i,c*=i,h*=i,u*=i;const l=zs;l[0]=o,l[1]=r,l[2]=a,l[3]=r,l[4]=c,l[5]=h,l[6]=a,l[7]=h,l[8]=u;const{unitary:d}=Ls(l,Ns),f=t.halfAxes.copy(d);let p=f.getColumn(0,As),g=f.getColumn(1,Os),y=f.getColumn(2,vs),_=-Number.MAX_VALUE,x=-Number.MAX_VALUE,M=-Number.MAX_VALUE,T=Number.MAX_VALUE,w=Number.MAX_VALUE,S=Number.MAX_VALUE;for(const b of n)z.copy(b),_=Math.max(z.dot(p),_),x=Math.max(z.dot(g),x),M=Math.max(z.dot(y),M),T=Math.min(z.dot(p),T),w=Math.min(z.dot(g),w),S=Math.min(z.dot(y),S);p=p.multiplyByScalar(.5*(T+_)),g=g.multiplyByScalar(.5*(w+x)),y=y.multiplyByScalar(.5*(S+M)),t.center.copy(p).add(g).add(y);const L=Is.set(_-T,x-w,M-S).multiplyByScalar(.5),R=new E([L[0],0,0,0,L[1],0,0,0,L[2]]);return t.halfAxes.multiplyRight(R),t}const B=512,Xt=3,pe=[[.5,.5],[0,0],[0,1],[1,0],[1,1]],ge=pe.concat([[0,.5],[.5,0],[1,.5],[.5,1]]),Vs=ge.concat([[.25,.5],[.75,.5]]);class D{constructor(t,e,s){this.x=t,this.y=e,this.z=s}get children(){if(!this._children){const t=this.x*2,e=this.y*2,s=this.z+1;this._children=[new D(t,e,s),new D(t,e+1,s),new D(t+1,e,s),new D(t+1,e+1,s)]}return this._children}update(t){const{viewport:e,cullingVolume:s,elevationBounds:i,minZ:o,maxZ:r,bounds:a,offset:c,project:h}=t,u=this.getBoundingVolume(i,c,h);if(a&&!this.insideBounds(a)||s.computeVisibility(u)<0)return!1;if(!this.childVisible){let{z:d}=this;if(d<r&&d>=o){const f=u.distanceTo(e.cameraPosition)*e.scale/e.height;d+=Math.floor(Math.log2(f))}if(d>=r)return this.selected=!0,!0}this.selected=!1,this.childVisible=!0;for(const d of this.children)d.update(t);return!0}getSelected(t=[]){if(this.selected&&t.push(this),this._children)for(const e of this._children)e.getSelected(t);return t}insideBounds([t,e,s,i]){const o=Math.pow(2,this.z),r=B/o;return this.x*r<s&&this.y*r<i&&(this.x+1)*r>t&&(this.y+1)*r>e}getBoundingVolume(t,e,s){if(s){const c=this.z<1?Vs:this.z<2?ge:pe,h=[];for(const u of c){const l=gt(this.x+u[0],this.y+u[1],this.z);l[2]=t[0],h.push(s(l)),t[0]!==t[1]&&(l[2]=t[1],h.push(s(l)))}return me(h)}const i=Math.pow(2,this.z),o=B/i,r=this.x*o+e*B,a=B-(this.y+1)*o;return new Tt([r,a,t[0]],[r+o,a+o,t[1]])}}function Fs(n,t,e,s){const i=n instanceof m.GlobeViewport&&n.resolution?n.projectPosition:null,o=Object.values(n.getFrustumPlanes()).map(({normal:f,distance:p})=>new U(f.clone().negate(),p)),r=new A(o),a=n.distanceScales.unitsPerMeter[2],c=e&&e[0]*a||0,h=e&&e[1]*a||0,u=n instanceof m.WebMercatorViewport&&n.pitch<=60?t:0;if(s){const[f,p,g,y]=s,_=m.lngLatToWorld([f,y]),x=m.lngLatToWorld([g,p]);s=[_[0],B-_[1],x[0],B-x[1]]}const l=new D(0,0,0),d={viewport:n,project:i,cullingVolume:r,elevationBounds:[c,h],minZ:u,maxZ:t,bounds:s,offset:0};if(l.update(d),n instanceof m.WebMercatorViewport&&n.subViewports&&n.subViewports.length>1){for(d.offset=-1;l.update(d)&&!(--d.offset<-Xt););for(d.offset=1;l.update(d)&&!(++d.offset>Xt););}return l.getSelected()}const v=512,qs=[-1/0,-1/0,1/0,1/0],Gs={equal:(n,t)=>{if(n===t)return!0;if(!Array.isArray(n)||!Array.isArray(t))return!1;const e=n.length;if(e!==t.length)return!1;for(let s=0;s<e;s++)if(n[s]!==t[s])return!1;return!0}};function St(n,t){const e=[t.transformAsPoint([n[0],n[1]]),t.transformAsPoint([n[2],n[1]]),t.transformAsPoint([n[0],n[3]]),t.transformAsPoint([n[2],n[3]])];return[Math.min(...e.map(i=>i[0])),Math.min(...e.map(i=>i[1])),Math.max(...e.map(i=>i[0])),Math.max(...e.map(i=>i[1]))]}function Bs(n){return Math.abs(n.split("").reduce((t,e)=>(t<<5)-t+e.charCodeAt(0)|0,0))}function Ds(n,t){if(!n||!n.length)return null;const{index:e,id:s}=t;if(Array.isArray(n)){const o=Bs(s)%n.length;n=n[o]}let i=n;for(const o of Object.keys(e)){const r=new RegExp(`{${o}}`,"g");i=i.replace(r,String(e[o]))}return Number.isInteger(e.y)&&Number.isInteger(e.z)&&(i=i.replace(/\{-y\}/g,String(Math.pow(2,e.z)-e.y-1))),i}function Us(n,t,e){let s;return s=n.getBounds(),n.isGeospatial?[Math.max(s[0],e[0]),Math.max(s[1],e[1]),Math.min(s[2],e[2]),Math.min(s[3],e[3])]:[Math.max(Math.min(s[0],e[2]),e[0]),Math.max(Math.min(s[1],e[3]),e[1]),Math.min(Math.max(s[2],e[0]),e[2]),Math.min(Math.max(s[3],e[1]),e[3])]}function ks({viewport:n,z:t,cullRect:e}){return(n.subViewports||[n]).map(i=>pt(i,t||0,e))}function pt(n,t,e){if(!Array.isArray(t)){const o=e.x-n.x,r=e.y-n.y,{width:a,height:c}=e,h={targetZ:t},u=n.unproject([o,r],h),l=n.unproject([o+a,r],h),d=n.unproject([o,r+c],h),f=n.unproject([o+a,r+c],h);return[Math.min(u[0],l[0],d[0],f[0]),Math.min(u[1],l[1],d[1],f[1]),Math.max(u[0],l[0],d[0],f[0]),Math.max(u[1],l[1],d[1],f[1])]}const s=pt(n,t[0],e),i=pt(n,t[1],e);return[Math.min(s[0],i[0]),Math.min(s[1],i[1]),Math.max(s[2],i[2]),Math.max(s[3],i[3])]}function Ws(n,t,e){return e?St(n,e).map(i=>i*t/v):n.map(s=>s*t/v)}function Ct(n,t){return Math.pow(2,n)*v/t}function gt(n,t,e){const s=Ct(e,v),i=n/s*360-180,o=Math.PI-2*Math.PI*t/s,r=180/Math.PI*Math.atan(.5*(Math.exp(o)-Math.exp(-o)));return[i,r]}function $t(n,t,e,s){const i=Ct(e,s);return[n/i*v,t/i*v]}function js(n,t,e,s,i=v){if(n.isGeospatial){const[h,u]=gt(t,e,s),[l,d]=gt(t+1,e+1,s);return{west:h,north:u,east:l,south:d}}const[o,r]=$t(t,e,s,i),[a,c]=$t(t+1,e+1,s,i);return{left:o,top:r,right:a,bottom:c}}function Ys(n,t,e,s,i){const o=Us(n,null,s),r=Ct(t,e),[a,c,h,u]=Ws(o,r,i),l=[];for(let d=Math.floor(a);d<h;d++)for(let f=Math.floor(c);f<u;f++)l.push({x:d,y:f,z:t});return l}function Xs({viewport:n,maxZoom:t,minZoom:e,zRange:s,extent:i,tileSize:o=v,modelMatrix:r,modelMatrixInverse:a,zoomOffset:c=0}){let h=n.isGeospatial?Math.round(n.zoom+Math.log2(v/o))+c:Math.ceil(n.zoom)+c;if(typeof e=="number"&&Number.isFinite(e)&&h<e){if(!i)return[];h=e}typeof t=="number"&&Number.isFinite(t)&&h>t&&(h=t);let u=i;return r&&a&&i&&!n.isGeospatial&&(u=St(i,r)),n.isGeospatial?Fs(n,h,s,i):Ys(n,h,o,u||qs,a)}function $s(n){let t={},e;return s=>{for(const i in s)if(!Zs(s[i],t[i])){e=n(s),t=s;break}return e}}function Zs(n,t){if(n===t)return!0;if(Array.isArray(n)){const e=n.length;if(!t||t.length!==e)return!1;for(let s=0;s<e;s++)if(n[s]!==t[s])return!1;return!0}return!1}const Zt=1,nt=2,Hs="never",Ks="no-overlap",Lt="best-available",Qs=5,Js={[Lt]:en,[Ks]:sn,[Hs]:()=>{}},tn={extent:null,tileSize:512,maxZoom:null,minZoom:null,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:"best-available",zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0,onTileLoad:()=>{},onTileUnload:()=>{},onTileError:()=>{}};class Et{constructor(t){this._getCullBounds=$s(ks),this.opts={...tn,...t},this.setOptions(this.opts),this.onTileLoad=e=>{this.opts.onTileLoad?.(e),this.opts.maxCacheByteSize!==null&&(this._cacheByteSize+=e.byteLength,this._resizeCache())},this._requestScheduler=new Be({throttleRequests:this.opts.maxRequests>0||this.opts.debounceTime>0,maxRequests:this.opts.maxRequests,debounceTime:this.opts.debounceTime}),this._cache=new Map,this._tiles=[],this._dirty=!1,this._cacheByteSize=0,this._viewport=null,this._zRange=null,this._selectedTiles=null,this._frameNumber=0,this._modelMatrix=new m.Matrix4,this._modelMatrixInverse=new m.Matrix4}get tiles(){return this._tiles}get selectedTiles(){return this._selectedTiles}get isLoaded(){return this._selectedTiles!==null&&this._selectedTiles.every(t=>t.isLoaded)}get needsReload(){return this._selectedTiles!==null&&this._selectedTiles.some(t=>t.needsReload)}setOptions(t){Object.assign(this.opts,t),Number.isFinite(t.maxZoom)&&(this._maxZoom=Math.floor(t.maxZoom)),Number.isFinite(t.minZoom)&&(this._minZoom=Math.ceil(t.minZoom))}finalize(){for(const t of this._cache.values())t.isLoading&&t.abort();this._cache.clear(),this._tiles=[],this._selectedTiles=null}reloadAll(){for(const t of this._cache.keys()){const e=this._cache.get(t);!this._selectedTiles||!this._selectedTiles.includes(e)?this._cache.delete(t):e.setNeedsReload()}}update(t,{zRange:e,modelMatrix:s}={zRange:null,modelMatrix:null}){const i=s?new m.Matrix4(s):new m.Matrix4,o=!i.equals(this._modelMatrix);if(!this._viewport||!t.equals(this._viewport)||!m.equals(this._zRange,e)||o){o&&(this._modelMatrixInverse=i.clone().invert(),this._modelMatrix=i),this._viewport=t,this._zRange=e;const a=this.getTileIndices({viewport:t,maxZoom:this._maxZoom,minZoom:this._minZoom,zRange:e,modelMatrix:this._modelMatrix,modelMatrixInverse:this._modelMatrixInverse});this._selectedTiles=a.map(c=>this._getTile(c,!0)),this._dirty&&this._rebuildTree()}else this.needsReload&&(this._selectedTiles=this._selectedTiles.map(a=>this._getTile(a.index,!0)));const r=this.updateTileStates();return this._pruneRequests(),this._dirty&&this._resizeCache(),r&&this._frameNumber++,this._frameNumber}isTileVisible(t,e,s){if(!t.isVisible)return!1;if(e&&this._viewport){const i=this._getCullBounds({viewport:this._viewport,z:this._zRange,cullRect:e});let{bbox:o}=t;for(const[r,a,c,h]of i){let u;if("west"in o)u=o.west<c&&o.east>r&&o.south<h&&o.north>a;else{if(s&&!m.Matrix4.IDENTITY.equals(s)){const[f,p,g,y]=St([o.left,o.top,o.right,o.bottom],s);o={left:f,top:p,right:g,bottom:y}}const l=Math.min(o.top,o.bottom),d=Math.max(o.top,o.bottom);u=o.left<c&&o.right>r&&l<h&&d>a}if(u)return!0}return!1}return!0}getTileIndices({viewport:t,maxZoom:e,minZoom:s,zRange:i,modelMatrix:o,modelMatrixInverse:r}){const{tileSize:a,extent:c,zoomOffset:h}=this.opts;return Xs({viewport:t,maxZoom:e,minZoom:s,zRange:i,tileSize:a,extent:c,modelMatrix:o,modelMatrixInverse:r,zoomOffset:h})}getTileId(t){return`${t.x}-${t.y}-${t.z}`}getTileZoom(t){return t.z}getTileMetadata(t){const{tileSize:e}=this.opts;return{bbox:js(this._viewport,t.x,t.y,t.z,e)}}getParentIndex(t){const e=Math.floor(t.x/2),s=Math.floor(t.y/2),i=t.z-1;return{x:e,y:s,z:i}}updateTileStates(){const t=this.opts.refinementStrategy||Lt,e=new Array(this._cache.size);let s=0;for(const i of this._cache.values())e[s++]=i.isVisible,i.isSelected=!1,i.isVisible=!1;for(const i of this._selectedTiles)i.isSelected=!0,i.isVisible=!0;(typeof t=="function"?t:Js[t])(Array.from(this._cache.values())),s=0;for(const i of this._cache.values())if(e[s++]!==i.isVisible)return!0;return!1}_pruneRequests(){const{maxRequests:t=0}=this.opts,e=[];let s=0;for(const i of this._cache.values())i.isLoading&&(s++,!i.isSelected&&!i.isVisible&&e.push(i));for(;t>0&&s>t&&e.length>0;)e.shift().abort(),s--}_rebuildTree(){const{_cache:t}=this;for(const e of t.values())e.parent=null,e.children&&(e.children.length=0);for(const e of t.values()){const s=this._getNearestAncestor(e);e.parent=s,s?.children&&s.children.push(e)}}_resizeCache(){const{_cache:t,opts:e}=this,s=e.maxCacheSize??(e.maxCacheByteSize!==null?1/0:Qs*this.selectedTiles.length),i=e.maxCacheByteSize??1/0;if(t.size>s||this._cacheByteSize>i){for(const[r,a]of t)if(!a.isVisible&&!a.isSelected&&(this._cacheByteSize-=e.maxCacheByteSize!==null?a.byteLength:0,t.delete(r),this.opts.onTileUnload?.(a)),t.size<=s&&this._cacheByteSize<=i)break;this._rebuildTree(),this._dirty=!0}this._dirty&&(this._tiles=Array.from(this._cache.values()).sort((r,a)=>r.zoom-a.zoom),this._dirty=!1)}_getTile(t,e){const s=this.getTileId(t);let i=this._cache.get(s),o=!1;return!i&&e?(i=new ys(t),Object.assign(i,this.getTileMetadata(i.index)),Object.assign(i,{id:s,zoom:this.getTileZoom(i.index)}),o=!0,this._cache.set(s,i),this._dirty=!0):i&&i.needsReload&&(o=!0),i&&o&&i.loadData({getData:this.opts.getTileData,requestScheduler:this._requestScheduler,onLoad:this.onTileLoad,onError:this.opts.onTileError}),i}_getNearestAncestor(t){const{_minZoom:e=0}=this;let s=t.index;for(;this.getTileZoom(s)>e;){s=this.getParentIndex(s);const i=this._getTile(s);if(i)return i}return null}}function en(n){for(const t of n)t.state=0;for(const t of n)t.isSelected&&!ye(t)&&Pt(t);for(const t of n)t.isVisible=!!(t.state&nt)}function sn(n){for(const e of n)e.state=0;for(const e of n)e.isSelected&&ye(e);const t=Array.from(n).sort((e,s)=>e.zoom-s.zoom);for(const e of t)if(e.isVisible=!!(e.state&nt),e.children&&(e.isVisible||e.state&Zt))for(const s of e.children)s.state=Zt;else e.isSelected&&Pt(e)}function ye(n){let t=n;for(;t;){if(t.isLoaded||t.content)return t.state|=nt,!0;t=t.parent}return!1}function Pt(n){for(const t of n.children)t.isLoaded||t.content?t.state|=nt:Pt(t)}const nn={TilesetClass:Et,data:{type:"data",value:[]},dataComparator:Gs.equal,renderSubLayers:{type:"function",value:n=>new m.GeoJsonLayer(n)},getTileData:{type:"function",optional:!0,value:null},onViewportLoad:{type:"function",optional:!0,value:null},onTileLoad:{type:"function",value:n=>{}},onTileUnload:{type:"function",value:n=>{}},onTileError:{type:"function",value:n=>console.error(n)},extent:{type:"array",optional:!0,value:null,compare:!0},tileSize:512,maxZoom:null,minZoom:0,maxCacheSize:null,maxCacheByteSize:null,refinementStrategy:Lt,zRange:null,maxRequests:6,debounceTime:0,zoomOffset:0};class it extends m.CompositeLayer{initializeState(){this.state={tileset:null,isLoaded:!1}}finalizeState(){this.state?.tileset?.finalize()}get isLoaded(){return!!this.state?.tileset?.selectedTiles?.every(t=>t.isLoaded&&t.layers&&t.layers.every(e=>e.isLoaded))}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState({changeFlags:t}){let{tileset:e}=this.state;const s=t.propsOrDataChanged||t.updateTriggersChanged,i=t.dataChanged||t.updateTriggersChanged&&(t.updateTriggersChanged.all||t.updateTriggersChanged.getTileData);e?s&&(e.setOptions(this._getTilesetOptions()),i?e.reloadAll():e.tiles.forEach(o=>{o.layers=null})):(e=new this.props.TilesetClass(this._getTilesetOptions()),this.setState({tileset:e})),this._updateTileset()}_getTilesetOptions(){const{tileSize:t,maxCacheSize:e,maxCacheByteSize:s,refinementStrategy:i,extent:o,maxZoom:r,minZoom:a,maxRequests:c,debounceTime:h,zoomOffset:u}=this.props;return{maxCacheSize:e,maxCacheByteSize:s,maxZoom:r,minZoom:a,tileSize:t,refinementStrategy:i,extent:o,maxRequests:c,debounceTime:h,zoomOffset:u,getTileData:this.getTileData.bind(this),onTileLoad:this._onTileLoad.bind(this),onTileError:this._onTileError.bind(this),onTileUnload:this._onTileUnload.bind(this)}}_updateTileset(){const t=this.state.tileset,{zRange:e,modelMatrix:s}=this.props,i=t.update(this.context.viewport,{zRange:e,modelMatrix:s}),{isLoaded:o}=t,r=this.state.isLoaded!==o,a=this.state.frameNumber!==i;o&&(r||a)&&this._onViewportLoad(),a&&this.setState({frameNumber:i}),this.state.isLoaded=o}_onViewportLoad(){const{tileset:t}=this.state,{onViewportLoad:e}=this.props;e&&e(t.selectedTiles)}_onTileLoad(t){this.props.onTileLoad(t),t.layers=null,this.setNeedsUpdate()}_onTileError(t,e){this.props.onTileError(t),e.layers=null,this.setNeedsUpdate()}_onTileUnload(t){this.props.onTileUnload(t)}getTileData(t){const{data:e,getTileData:s,fetch:i}=this.props,{signal:o}=t;return t.url=typeof e=="string"||Array.isArray(e)?Ds(e,t):null,s?s(t):i&&t.url?i(t.url,{propName:"data",layer:this,signal:o}):null}renderSubLayers(t){return this.props.renderSubLayers(t)}getSubLayerPropsByTile(t){return null}getPickingInfo(t){const e=t.sourceLayer,s=e.props.tile,i=t.info;return i.picked&&(i.tile=s),i.sourceTile=s,i.sourceTileSubLayer=e,i}_updateAutoHighlight(t){t.sourceTileSubLayer.updateAutoHighlight(t)}renderLayers(){return this.state.tileset.tiles.map(t=>{const e=this.getSubLayerPropsByTile(t);if(!(!t.isLoaded&&!t.content))if(t.layers)e&&t.layers[0]&&Object.keys(e).some(s=>t.layers[0].props[s]!==e[s])&&(t.layers=t.layers.map(s=>s.clone(e)));else{const s=this.renderSubLayers({...this.props,...this.getSubLayerProps({id:t.id,updateTriggers:this.props.updateTriggers}),data:t.content,_offset:0,tile:t});t.layers=m.flatten(s,Boolean).map(i=>i.clone({tile:t,...e}))}return t.layers})}filterSubLayer({layer:t,cullRect:e}){const{tile:s}=t.props,{modelMatrix:i}=this.props;return this.state.tileset.isTileVisible(s,e,i?new m.Matrix4(i):null)}}it.defaultProps=nn;it.layerName="TileLayer";const at=Math.PI/180,J=new Float32Array(16),Ht=new Float32Array(12);function Kt(n,t,e){const s=t[0]*at,i=t[1]*at,o=t[2]*at,r=Math.sin(o),a=Math.sin(s),c=Math.sin(i),h=Math.cos(o),u=Math.cos(s),l=Math.cos(i),d=e[0],f=e[1],p=e[2];n[0]=d*l*u,n[1]=d*c*u,n[2]=d*-a,n[3]=f*(-c*h+l*a*r),n[4]=f*(l*h+c*a*r),n[5]=f*u*r,n[6]=p*(c*r+l*a*h),n[7]=p*(-l*r+c*a*h),n[8]=p*u*h}function Qt(n){return n[0]=n[0],n[1]=n[1],n[2]=n[2],n[3]=n[4],n[4]=n[5],n[5]=n[6],n[6]=n[8],n[7]=n[9],n[8]=n[10],n[9]=n[12],n[10]=n[13],n[11]=n[14],n.subarray(0,12)}const on={size:12,accessor:["getOrientation","getScale","getTranslation","getTransformMatrix"],shaderAttributes:{instanceModelMatrixCol0:{size:3,elementOffset:0},instanceModelMatrixCol1:{size:3,elementOffset:3},instanceModelMatrixCol2:{size:3,elementOffset:6},instanceTranslation:{size:3,elementOffset:9}},update(n,{startRow:t,endRow:e}){const{data:s,getOrientation:i,getScale:o,getTranslation:r,getTransformMatrix:a}=this.props,c=Array.isArray(a),h=c&&a.length===16,u=Array.isArray(o),l=Array.isArray(i),d=Array.isArray(r),f=h||!c&&!!a(s[0]);f?n.constant=h:n.constant=l&&u&&d;const p=n.value;if(n.constant){let g;f?(J.set(a),g=Qt(J)):(g=Ht,Kt(g,i,o),g.set(r,9)),n.value=new Float32Array(g)}else{let g=t*n.size;const{iterable:y,objectInfo:_}=m.createIterable(s,t,e);for(const x of y){_.index++;let M;if(f)J.set(h?a:a(x,_)),M=Qt(J);else{M=Ht;const T=l?i:i(x,_),w=u?o:o(x,_);Kt(M,T,w),M.set(d?r:r(x,_),9)}p[g++]=M[0],p[g++]=M[1],p[g++]=M[2],p[g++]=M[3],p[g++]=M[4],p[g++]=M[5],p[g++]=M[6],p[g++]=M[7],p[g++]=M[8],p[g++]=M[9],p[g++]=M[10],p[g++]=M[11]}}}};function rn(n,t){return t===m.COORDINATE_SYSTEM.CARTESIAN||t===m.COORDINATE_SYSTEM.METER_OFFSETS||t===m.COORDINATE_SYSTEM.DEFAULT&&!n.isGeospatial}const Jt=`uniform simpleMeshUniforms {
2
2
  float sizeScale;
3
3
  bool composeModelMatrix;
4
4
  bool hasTexture;
@@ -1,7 +1,7 @@
1
1
  import q from "./index-DQXdX5y1.js";
2
- import { f as $e, b as Xe, c as Ze, d as He, e as Ke, P as Qe } from "./geotiff-CkM7wOor.js";
2
+ import { f as $e, b as Xe, c as Ze, d as He, e as Ke, P as Qe } from "./geotiff-CY9Ly-G7.js";
3
3
  import { CreateTexture as xe, cieLabToRGB as Je, YCbCrToRGB as ts, CMYKToRGB as es, Colormap as ss, FilterNoDataVal as ns } from "./index-C9fk_HKR.js";
4
- import { aO as is, aP as os, aQ as rs, aR as Wt, aS as R, aT as as, aU as Me, aV as cs, aW as ls, aX as it, aY as hs, aZ as us, a_ as ds, a$ as we, b0 as fs, b1 as ms, b2 as ps, b3 as gs, b4 as Vt, b5 as ys, b6 as ut, b7 as _s, b8 as xs, b9 as Ms, ba as ws, bb as Ts, bc as bs, bd as Ss, be as Cs, bf as Ls, bg as Es, bh as Ps, bi as Rs, bj as Is, bk as V, bl as Te, bm as As, bn as be, bo as vs, bp as Os, bq as Se, br as M, bs as zs, bt as xt, bu as st, bv as Ce, bw as kt, bx as ot, by as G, bz as Ns, bA as Fs, bB as dt, bC as qs, bD as Bs, bE as Gs, bF as Ds, bG as Us, bH as ft, bI as Ws, bJ as Vs } from "./ControlGrid-CeKq8xm8.js";
4
+ import { aO as is, aP as os, aQ as rs, aR as Wt, aS as R, aT as as, aU as Me, aV as cs, aW as ls, aX as it, aY as hs, aZ as us, a_ as ds, a$ as we, b0 as fs, b1 as ms, b2 as ps, b3 as gs, b4 as Vt, b5 as ys, b6 as ut, b7 as _s, b8 as xs, b9 as Ms, ba as ws, bb as Ts, bc as bs, bd as Ss, be as Cs, bf as Ls, bg as Es, bh as Ps, bi as Rs, bj as Is, bk as V, bl as Te, bm as As, bn as be, bo as vs, bp as Os, bq as Se, br as M, bs as zs, bt as xt, bu as st, bv as Ce, bw as kt, bx as ot, by as G, bz as Ns, bA as Fs, bB as dt, bC as qs, bD as Bs, bE as Gs, bF as Ds, bG as Us, bH as ft, bI as Ws, bJ as Vs } from "./ControlGrid-CcOIR0lI.js";
5
5
  const ks = "Queued Requests", js = "Active Requests", Ys = "Cancelled Requests", $s = "Queued Requests Ever", Xs = "Active Requests Ever", Zs = {
6
6
  id: "request-scheduler",
7
7
  /** Specifies if the request scheduler should throttle incoming requests, mainly for comparative testing. */
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ControlGrid-3Y_umzvK.cjs");exports.MapboxOverlay=e.MapboxOverlay;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./ControlGrid-BHj06tuI.cjs");exports.MapboxOverlay=e.MapboxOverlay;
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./ControlGrid-3Y_umzvK.cjs"),m=require("maplibre-gl"),S=require("./DuckDBConverter-BFCTc7WL.cjs"),c=require("./ShapefileConverter-AjbEjEyq.cjs");function d(o){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function E(o,t,a){return"#"+[o,t,a].map(e=>e.toString(16).padStart(2,"0")).join("")}function C(o,t,a){const e=d(o),n=d(t);if(!e||!n)return o;const s=Math.round(e.r+(n.r-e.r)*a),l=Math.round(e.g+(n.g-e.g)*a),i=Math.round(e.b+(n.b-e.b)*a);return E(s,l,i)}function L(o,t){const a=Math.max(0,Math.min(1,t));let e=o[0],n=o[o.length-1];for(let i=0;i<o.length-1;i++)if(o[i].position<=a&&o[i+1].position>=a){e=o[i],n=o[i+1];break}if(a<=e.position)return e.color;if(a>=n.position)return n.color;const s=n.position-e.position,l=s===0?0:(a-e.position)/s;return C(e.color,n.color,l)}function g(o,t="to right"){const a=o.map(e=>`${e.color} ${e.position*100}%`).join(", ");return`linear-gradient(${t}, ${a})`}const p=["globe","fullscreen","north","terrain","search","viewState","inspect","vectorDataset","basemap","measure","geoEditor","bookmark","print","minimap","swipe","streetView","addVector","cogLayer","zarrLayer","pmtilesLayer","stacLayer","stacSearch","planetaryComputer","gaussianSplat","lidar","usgsLidar"],u=["usgs-lidar-*","lidar-*","mapbox-gl-draw-*","gl-draw-*","gm_*","inspect-highlight-*","measure-*"];function O(o){if(o<=0)return{rows:1,columns:1};const t=Math.ceil(Math.sqrt(o));return{rows:Math.ceil(o/t),columns:t}}function N(o,t){const{exclude:a,...e}=t??{};if(e.defaultControls===void 0){const l=new Set(a??[]);e.defaultControls=p.filter(i=>!l.has(i))}const n=e.defaultControls.length;if(e.rows===void 0&&e.columns===void 0){const l=O(n);e.rows=l.rows,e.columns=l.columns}else e.rows===void 0&&e.columns!==void 0?e.rows=Math.ceil(n/e.columns):e.columns===void 0&&e.rows!==void 0&&(e.columns=Math.ceil(n/e.rows));e.position??="top-right",e.collapsible??=!0,e.collapsed??=!0,e.showRowColumnControls??=!0,e.gap??=2,e.excludeLayers??=[...u];const s=new r.ControlGrid(e);return o.addControl(s,e.position),s}function A(o){o.prototype.addControlGrid||(o.prototype.addControlGrid=function(t){return N(this,t)})}A(m.Map);exports.ADVANCED_EXTENSIONS=r.ADVANCED_EXTENSIONS;exports.ALL_EXTENSIONS=r.ALL_EXTENSIONS;exports.AddVectorAdapter=r.AddVectorAdapter;exports.AddVectorControl=r.AddVectorControl;exports.BasemapControl=r.BasemapControl;exports.BookmarkControl=r.BookmarkControl;exports.COLORMAPS=r.COLORMAPS;exports.CSV_EXTENSIONS=r.CSV_EXTENSIONS;exports.CogLayerAdapter=r.CogLayerAdapter;exports.CogLayerControl=r.CogLayerControl;exports.Colorbar=r.Colorbar;exports.ControlGrid=r.ControlGrid;exports.DUCKDB_EXTENSIONS=r.DUCKDB_EXTENSIONS;exports.DXF_EXTENSIONS=r.DXF_EXTENSIONS;exports.FLATGEOBUF_EXTENSIONS=r.FLATGEOBUF_EXTENSIONS;exports.GEOJSON_EXTENSIONS=r.GEOJSON_EXTENSIONS;exports.GEOPACKAGE_EXTENSIONS=r.GEOPACKAGE_EXTENSIONS;exports.GEOPARQUET_EXTENSIONS=r.GEOPARQUET_EXTENSIONS;exports.GML_EXTENSIONS=r.GML_EXTENSIONS;exports.GOOGLE_BASEMAPS=r.GOOGLE_BASEMAPS;exports.GPX_EXTENSIONS=r.GPX_EXTENSIONS;exports.GaussianSplatControl=r.GaussianSplatControl;exports.GaussianSplatLayerAdapter=r.GaussianSplatLayerAdapter;exports.GeoEditor=r.GeoEditor;exports.GeoEditorLayerAdapter=r.GeoEditorLayerAdapter;exports.HtmlControl=r.HtmlControl;exports.InspectControl=r.InspectControl;exports.KML_EXTENSIONS=r.KML_EXTENSIONS;exports.KMZ_EXTENSIONS=r.KMZ_EXTENSIONS;exports.Legend=r.Legend;exports.LidarControl=r.LidarControl;exports.LidarLayerAdapter=r.LidarLayerAdapter;exports.MeasureControl=r.MeasureControl;exports.MinimapControl=r.MinimapControl;exports.PMTilesLayerAdapter=r.PMTilesLayerAdapter;exports.PMTilesLayerControl=r.PMTilesLayerControl;exports.PlanetaryComputerControl=r.PlanetaryComputerControl;exports.PlanetaryComputerLayerAdapter=r.PlanetaryComputerLayerAdapter;exports.PrintControl=r.PrintControl;exports.RdBu=r.RdBu;exports.RdYlBu=r.RdYlBu;exports.RdYlGn=r.RdYlGn;exports.SHAPEFILE_EXTENSIONS=r.SHAPEFILE_EXTENSIONS;exports.SHPJS_EXTENSIONS=r.SHPJS_EXTENSIONS;exports.SearchControl=r.SearchControl;exports.StacLayerAdapter=r.StacLayerAdapter;exports.StacLayerControl=r.StacLayerControl;exports.StacSearchControl=r.StacSearchControl;exports.StreetViewControl=r.StreetViewControl;exports.SwipeControl=r.SwipeControl;exports.TOPOJSON_EXTENSIONS=r.TOPOJSON_EXTENSIONS;exports.TerrainControl=r.TerrainControl;exports.UsgsLidarControl=r.UsgsLidarControl;exports.UsgsLidarLayerAdapter=r.UsgsLidarLayerAdapter;exports.VectorDatasetControl=r.VectorDatasetControl;exports.ViewStateControl=r.ViewStateControl;exports.XLSX_EXTENSIONS=r.XLSX_EXTENSIONS;exports.XYZSERVICES_URL=r.XYZSERVICES_URL;exports.ZarrLayerAdapter=r.ZarrLayerAdapter;exports.ZarrLayerControl=r.ZarrLayerControl;exports.bone=r.bone;exports.buildTileUrl=r.buildTileUrl;exports.bwr=r.bwr;exports.cividis=r.cividis;exports.clamp=r.clamp;exports.classNames=r.classNames;exports.cool=r.cool;exports.coolwarm=r.coolwarm;exports.debounce=r.debounce;exports.detectFormat=r.detectFormat;exports.fetchProviders=r.fetchProviders;exports.filterBasemaps=r.filterBasemaps;exports.formatNumericValue=r.formatNumericValue;exports.generateId=r.generateId;exports.generateThumbnailUrl=r.generateThumbnailUrl;exports.getAcceptedExtensions=r.getAcceptedExtensions;exports.getColormap=r.getColormap;exports.getColormapNames=r.getColormapNames;exports.getFileExtension=r.getFileExtension;exports.getFormatDescription=r.getFormatDescription;exports.getFormatDisplayName=r.getFormatDisplayName;exports.gray=r.gray;exports.groupBasemaps=r.groupBasemaps;exports.hot=r.hot;exports.inferno=r.inferno;exports.isValidColormap=r.isValidColormap;exports.isValidExtension=r.isValidExtension;exports.jet=r.jet;exports.magma=r.magma;exports.ocean=r.ocean;exports.parseProviders=r.parseProviders;exports.plasma=r.plasma;exports.rainbow=r.rainbow;exports.readFileAsBuffer=r.readFileAsBuffer;exports.requiresConversion=r.requiresConversion;exports.requiresDuckDB=r.requiresDuckDB;exports.seismic=r.seismic;exports.spectral=r.spectral;exports.terrain=r.terrain;exports.throttle=r.throttle;exports.turbo=r.turbo;exports.viridis=r.viridis;exports.DuckDBConverter=S.DuckDBConverter;exports.getDuckDBConverter=S.getDuckDBConverter;exports.ShapefileConverter=c.ShapefileConverter;exports.getShapefileConverter=c.getShapefileConverter;exports.ALL_DEFAULT_CONTROLS=p;exports.DEFAULT_EXCLUDE_LAYERS=u;exports.addControlGrid=N;exports.generateGradientCSS=g;exports.getColorAtPosition=L;exports.hexToRgb=d;exports.interpolateColor=C;exports.rgbToHex=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./ControlGrid-BHj06tuI.cjs"),m=require("maplibre-gl"),S=require("./DuckDBConverter-BFCTc7WL.cjs"),c=require("./ShapefileConverter-AjbEjEyq.cjs");function d(o){const t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(o);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function E(o,t,a){return"#"+[o,t,a].map(e=>e.toString(16).padStart(2,"0")).join("")}function C(o,t,a){const e=d(o),n=d(t);if(!e||!n)return o;const s=Math.round(e.r+(n.r-e.r)*a),l=Math.round(e.g+(n.g-e.g)*a),i=Math.round(e.b+(n.b-e.b)*a);return E(s,l,i)}function L(o,t){const a=Math.max(0,Math.min(1,t));let e=o[0],n=o[o.length-1];for(let i=0;i<o.length-1;i++)if(o[i].position<=a&&o[i+1].position>=a){e=o[i],n=o[i+1];break}if(a<=e.position)return e.color;if(a>=n.position)return n.color;const s=n.position-e.position,l=s===0?0:(a-e.position)/s;return C(e.color,n.color,l)}function g(o,t="to right"){const a=o.map(e=>`${e.color} ${e.position*100}%`).join(", ");return`linear-gradient(${t}, ${a})`}const p=["globe","fullscreen","north","terrain","search","viewState","inspect","vectorDataset","basemap","measure","geoEditor","bookmark","print","minimap","swipe","streetView","addVector","cogLayer","zarrLayer","pmtilesLayer","stacLayer","stacSearch","planetaryComputer","gaussianSplat","lidar","usgsLidar"],u=["usgs-lidar-*","lidar-*","mapbox-gl-draw-*","gl-draw-*","gm_*","inspect-highlight-*","measure-*"];function O(o){if(o<=0)return{rows:1,columns:1};const t=Math.ceil(Math.sqrt(o));return{rows:Math.ceil(o/t),columns:t}}function N(o,t){const{exclude:a,...e}=t??{};if(e.defaultControls===void 0){const l=new Set(a??[]);e.defaultControls=p.filter(i=>!l.has(i))}const n=e.defaultControls.length;if(e.rows===void 0&&e.columns===void 0){const l=O(n);e.rows=l.rows,e.columns=l.columns}else e.rows===void 0&&e.columns!==void 0?e.rows=Math.ceil(n/e.columns):e.columns===void 0&&e.rows!==void 0&&(e.columns=Math.ceil(n/e.rows));e.position??="top-right",e.collapsible??=!0,e.collapsed??=!0,e.showRowColumnControls??=!0,e.gap??=2,e.excludeLayers??=[...u];const s=new r.ControlGrid(e);return o.addControl(s,e.position),s}function A(o){o.prototype.addControlGrid||(o.prototype.addControlGrid=function(t){return N(this,t)})}A(m.Map);exports.ADVANCED_EXTENSIONS=r.ADVANCED_EXTENSIONS;exports.ALL_EXTENSIONS=r.ALL_EXTENSIONS;exports.AddVectorAdapter=r.AddVectorAdapter;exports.AddVectorControl=r.AddVectorControl;exports.BasemapControl=r.BasemapControl;exports.BookmarkControl=r.BookmarkControl;exports.COLORMAPS=r.COLORMAPS;exports.CSV_EXTENSIONS=r.CSV_EXTENSIONS;exports.CogLayerAdapter=r.CogLayerAdapter;exports.CogLayerControl=r.CogLayerControl;exports.Colorbar=r.Colorbar;exports.ControlGrid=r.ControlGrid;exports.DUCKDB_EXTENSIONS=r.DUCKDB_EXTENSIONS;exports.DXF_EXTENSIONS=r.DXF_EXTENSIONS;exports.FLATGEOBUF_EXTENSIONS=r.FLATGEOBUF_EXTENSIONS;exports.GEOJSON_EXTENSIONS=r.GEOJSON_EXTENSIONS;exports.GEOPACKAGE_EXTENSIONS=r.GEOPACKAGE_EXTENSIONS;exports.GEOPARQUET_EXTENSIONS=r.GEOPARQUET_EXTENSIONS;exports.GML_EXTENSIONS=r.GML_EXTENSIONS;exports.GOOGLE_BASEMAPS=r.GOOGLE_BASEMAPS;exports.GPX_EXTENSIONS=r.GPX_EXTENSIONS;exports.GaussianSplatControl=r.GaussianSplatControl;exports.GaussianSplatLayerAdapter=r.GaussianSplatLayerAdapter;exports.GeoEditor=r.GeoEditor;exports.GeoEditorLayerAdapter=r.GeoEditorLayerAdapter;exports.HtmlControl=r.HtmlControl;exports.InspectControl=r.InspectControl;exports.KML_EXTENSIONS=r.KML_EXTENSIONS;exports.KMZ_EXTENSIONS=r.KMZ_EXTENSIONS;exports.Legend=r.Legend;exports.LidarControl=r.LidarControl;exports.LidarLayerAdapter=r.LidarLayerAdapter;exports.MeasureControl=r.MeasureControl;exports.MinimapControl=r.MinimapControl;exports.PMTilesLayerAdapter=r.PMTilesLayerAdapter;exports.PMTilesLayerControl=r.PMTilesLayerControl;exports.PlanetaryComputerControl=r.PlanetaryComputerControl;exports.PlanetaryComputerLayerAdapter=r.PlanetaryComputerLayerAdapter;exports.PrintControl=r.PrintControl;exports.RdBu=r.RdBu;exports.RdYlBu=r.RdYlBu;exports.RdYlGn=r.RdYlGn;exports.SHAPEFILE_EXTENSIONS=r.SHAPEFILE_EXTENSIONS;exports.SHPJS_EXTENSIONS=r.SHPJS_EXTENSIONS;exports.SearchControl=r.SearchControl;exports.StacLayerAdapter=r.StacLayerAdapter;exports.StacLayerControl=r.StacLayerControl;exports.StacSearchControl=r.StacSearchControl;exports.StreetViewControl=r.StreetViewControl;exports.SwipeControl=r.SwipeControl;exports.TOPOJSON_EXTENSIONS=r.TOPOJSON_EXTENSIONS;exports.TerrainControl=r.TerrainControl;exports.UsgsLidarControl=r.UsgsLidarControl;exports.UsgsLidarLayerAdapter=r.UsgsLidarLayerAdapter;exports.VectorDatasetControl=r.VectorDatasetControl;exports.ViewStateControl=r.ViewStateControl;exports.XLSX_EXTENSIONS=r.XLSX_EXTENSIONS;exports.XYZSERVICES_URL=r.XYZSERVICES_URL;exports.ZarrLayerAdapter=r.ZarrLayerAdapter;exports.ZarrLayerControl=r.ZarrLayerControl;exports.bone=r.bone;exports.buildTileUrl=r.buildTileUrl;exports.bwr=r.bwr;exports.cividis=r.cividis;exports.clamp=r.clamp;exports.classNames=r.classNames;exports.cool=r.cool;exports.coolwarm=r.coolwarm;exports.debounce=r.debounce;exports.detectFormat=r.detectFormat;exports.fetchProviders=r.fetchProviders;exports.filterBasemaps=r.filterBasemaps;exports.formatNumericValue=r.formatNumericValue;exports.generateId=r.generateId;exports.generateThumbnailUrl=r.generateThumbnailUrl;exports.getAcceptedExtensions=r.getAcceptedExtensions;exports.getColormap=r.getColormap;exports.getColormapNames=r.getColormapNames;exports.getFileExtension=r.getFileExtension;exports.getFormatDescription=r.getFormatDescription;exports.getFormatDisplayName=r.getFormatDisplayName;exports.gray=r.gray;exports.groupBasemaps=r.groupBasemaps;exports.hot=r.hot;exports.inferno=r.inferno;exports.isValidColormap=r.isValidColormap;exports.isValidExtension=r.isValidExtension;exports.jet=r.jet;exports.magma=r.magma;exports.ocean=r.ocean;exports.parseProviders=r.parseProviders;exports.plasma=r.plasma;exports.rainbow=r.rainbow;exports.readFileAsBuffer=r.readFileAsBuffer;exports.requiresConversion=r.requiresConversion;exports.requiresDuckDB=r.requiresDuckDB;exports.seismic=r.seismic;exports.spectral=r.spectral;exports.terrain=r.terrain;exports.throttle=r.throttle;exports.turbo=r.turbo;exports.viridis=r.viridis;exports.DuckDBConverter=S.DuckDBConverter;exports.getDuckDBConverter=S.getDuckDBConverter;exports.ShapefileConverter=c.ShapefileConverter;exports.getShapefileConverter=c.getShapefileConverter;exports.ALL_DEFAULT_CONTROLS=p;exports.DEFAULT_EXCLUDE_LAYERS=u;exports.addControlGrid=N;exports.generateGradientCSS=g;exports.getColorAtPosition=L;exports.hexToRgb=d;exports.interpolateColor=C;exports.rgbToHex=E;
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { C as d } from "./ControlGrid-CeKq8xm8.js";
2
- import { A as T, a as w, b as y, c as b, B as I, d as _, e as G, f as X, h as D, i as v, j as M, D as x, k as P, F as B, G as V, l as F, m as R, n as U, o as k, p as H, q as K, r as $, s as j, t as q, H as J, I as Y, K as Z, u as z, L as Q, v as W, w as aa, x as ra, y as oa, P as sa, z as ta, E as ea, J as na, N as ia, R as la, O as da, Q as ca, S as pa, T as ua, U as ma, V as Sa, W as Ca, X as Ea, Y as ga, Z as Na, _ as La, $ as fa, a0 as ha, a1 as Aa, a2 as Oa, a3 as Ta, a4 as wa, a5 as ya, a6 as ba, a7 as Ia, a8 as _a, a9 as Ga, aa as Xa, ab as Da, ac as va, ad as Ma, ae as xa, af as Pa, ag as Ba, ah as Va, ai as Fa, aj as Ra, ak as Ua, al as ka, am as Ha, an as Ka, ao as $a, ap as ja, aq as qa, ar as Ja, as as Ya, at as Za, au as za, av as Qa, aw as Wa, ax as ar, ay as rr, az as or, aA as sr, aB as tr, aC as er, aD as nr, aE as ir, aF as lr, aG as dr, aH as cr, aI as pr, aJ as ur, aK as mr, aL as Sr, aM as Cr, aN as Er } from "./ControlGrid-CeKq8xm8.js";
1
+ import { C as d } from "./ControlGrid-CcOIR0lI.js";
2
+ import { A as T, a as w, b as y, c as b, B as I, d as _, e as G, f as X, h as D, i as v, j as M, D as x, k as P, F as B, G as V, l as F, m as R, n as U, o as k, p as H, q as K, r as $, s as j, t as q, H as J, I as Y, K as Z, u as z, L as Q, v as W, w as aa, x as ra, y as oa, P as sa, z as ta, E as ea, J as na, N as ia, R as la, O as da, Q as ca, S as pa, T as ua, U as ma, V as Sa, W as Ca, X as Ea, Y as ga, Z as Na, _ as La, $ as fa, a0 as ha, a1 as Aa, a2 as Oa, a3 as Ta, a4 as wa, a5 as ya, a6 as ba, a7 as Ia, a8 as _a, a9 as Ga, aa as Xa, ab as Da, ac as va, ad as Ma, ae as xa, af as Pa, ag as Ba, ah as Va, ai as Fa, aj as Ra, ak as Ua, al as ka, am as Ha, an as Ka, ao as $a, ap as ja, aq as qa, ar as Ja, as as Ya, at as Za, au as za, av as Qa, aw as Wa, ax as ar, ay as rr, az as or, aA as sr, aB as tr, aC as er, aD as nr, aE as ir, aF as lr, aG as dr, aH as cr, aI as pr, aJ as ur, aK as mr, aL as Sr, aM as Cr, aN as Er } from "./ControlGrid-CcOIR0lI.js";
3
3
  import c from "maplibre-gl";
4
4
  import { DuckDBConverter as Nr, getDuckDBConverter as Lr } from "./DuckDBConverter-BJE6TxaX.js";
5
5
  import { ShapefileConverter as hr, getShapefileConverter as Ar } from "./ShapefileConverter-trvt8J3z.js";
@@ -1,4 +1,4 @@
1
- import { B as re } from "./geotiff-CkM7wOor.js";
1
+ import { B as re } from "./geotiff-CY9Ly-G7.js";
2
2
  const O = new Int32Array([
3
3
  0,
4
4
  1,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const re=require("./geotiff-C-MHEjS3.cjs"),J=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),Y=4017,Z=799,$=3406,N=2276,Q=1567,W=3784,R=5793,K=2896;function ne(q,l){let o=0;const u=[];let D=16;for(;D>0&&!q[D-1];)--D;u.push({children:[],index:0});let w=u[0],C;for(let t=0;t<D;t++){for(let h=0;h<q[t];h++){for(w=u.pop(),w.children[w.index]=l[o];w.index>0;)w=u.pop();for(w.index++,u.push(w);u.length<=t;)u.push(C={children:[],index:0}),w.children[w.index]=C.children,w=C;o++}t+1<D&&(u.push(C={children:[],index:0}),w.children[w.index]=C.children,w=C)}return u[0].children}function ce(q,l,o,u,D,w,C,t,h){const{mcusPerLine:F,progressive:c}=o,r=l;let b=l,i=0,d=0;function m(){if(d>0)return d--,i>>d&1;if(i=q[b++],i===255){const f=q[b++];if(f)throw new Error(`unexpected marker: ${(i<<8|f).toString(16)}`)}return d=7,i>>>7}function x(f){let a=f,p;for(;(p=m())!==null;){if(a=a[p],typeof a=="number")return a;if(typeof a!="object")throw new Error("invalid huffman sequence")}return null}function E(f){let a=f,p=0;for(;a>0;){const y=m();if(y===null)return;p=p<<1|y,--a}return p}function k(f){const a=E(f);return a>=1<<f-1?a:a+(-1<<f)+1}function v(f,a){const p=x(f.huffmanTableDC),y=p===0?0:k(p);f.pred+=y,a[0]=f.pred;let P=1;for(;P<64;){const T=x(f.huffmanTableAC),L=T&15,S=T>>4;if(L===0){if(S<15)break;P+=16}else{P+=S;const I=J[P];a[I]=k(L),P++}}}function A(f,a){const p=x(f.huffmanTableDC),y=p===0?0:k(p)<<h;f.pred+=y,a[0]=f.pred}function s(f,a){a[0]|=m()<<h}let n=0;function g(f,a){if(n>0){n--;return}let p=w;const y=C;for(;p<=y;){const P=x(f.huffmanTableAC),T=P&15,L=P>>4;if(T===0){if(L<15){n=E(L)+(1<<L)-1;break}p+=16}else{p+=L;const S=J[p];a[S]=k(T)*(1<<h),p++}}}let e=0,_;function te(f,a){let p=w;const y=C;let P=0;for(;p<=y;){const T=J[p],L=a[T]<0?-1:1;switch(e){case 0:{const S=x(f.huffmanTableAC),I=S&15;if(P=S>>4,I===0)P<15?(n=E(P)+(1<<P),e=4):(P=16,e=1);else{if(I!==1)throw new Error("invalid ACn encoding");_=k(I),e=P?2:3}continue}case 1:case 2:a[T]?a[T]+=(m()<<h)*L:(P--,P===0&&(e=e===2?3:0));break;case 3:a[T]?a[T]+=(m()<<h)*L:(a[T]=_<<h,e=0);break;case 4:a[T]&&(a[T]+=(m()<<h)*L);break}p++}e===4&&(n--,n===0&&(e=0))}function se(f,a,p,y,P){const T=p/F|0,L=p%F,S=T*f.v+y,I=L*f.h+P;a(f,f.blocks[S][I])}function oe(f,a,p){const y=p/f.blocksPerLine|0,P=p%f.blocksPerLine;a(f,f.blocks[y][P])}const V=u.length;let U,j,G,X,M,H;c?w===0?H=t===0?A:s:H=t===0?g:te:H=v;let B=0,z,O;V===1?O=u[0].blocksPerLine*u[0].blocksPerColumn:O=F*o.mcusPerColumn;const ee=D||O;for(;B<O;){for(j=0;j<V;j++)u[j].pred=0;if(n=0,V===1)for(U=u[0],M=0;M<ee;M++)oe(U,H,B),B++;else for(M=0;M<ee;M++){for(j=0;j<V;j++){U=u[j];const{h:f,v:a}=U;for(G=0;G<a;G++)for(X=0;X<f;X++)se(U,H,B,G,X)}if(B++,B===O)break}if(d=0,z=q[b]<<8|q[b+1],z<65280)throw new Error("marker was not found");if(z>=65488&&z<=65495)b+=2;else break}return b-r}function ie(q,l){const o=[],{blocksPerLine:u,blocksPerColumn:D}=l,w=u<<3,C=new Int32Array(64),t=new Uint8Array(64);function h(F,c,r){const b=l.quantizationTable;let i,d,m,x,E,k,v,A,s;const n=r;let g;for(g=0;g<64;g++)n[g]=F[g]*b[g];for(g=0;g<8;++g){const e=8*g;if(n[1+e]===0&&n[2+e]===0&&n[3+e]===0&&n[4+e]===0&&n[5+e]===0&&n[6+e]===0&&n[7+e]===0){s=R*n[0+e]+512>>10,n[0+e]=s,n[1+e]=s,n[2+e]=s,n[3+e]=s,n[4+e]=s,n[5+e]=s,n[6+e]=s,n[7+e]=s;continue}i=R*n[0+e]+128>>8,d=R*n[4+e]+128>>8,m=n[2+e],x=n[6+e],E=K*(n[1+e]-n[7+e])+128>>8,A=K*(n[1+e]+n[7+e])+128>>8,k=n[3+e]<<4,v=n[5+e]<<4,s=i-d+1>>1,i=i+d+1>>1,d=s,s=m*W+x*Q+128>>8,m=m*Q-x*W+128>>8,x=s,s=E-v+1>>1,E=E+v+1>>1,v=s,s=A+k+1>>1,k=A-k+1>>1,A=s,s=i-x+1>>1,i=i+x+1>>1,x=s,s=d-m+1>>1,d=d+m+1>>1,m=s,s=E*N+A*$+2048>>12,E=E*$-A*N+2048>>12,A=s,s=k*Z+v*Y+2048>>12,k=k*Y-v*Z+2048>>12,v=s,n[0+e]=i+A,n[7+e]=i-A,n[1+e]=d+v,n[6+e]=d-v,n[2+e]=m+k,n[5+e]=m-k,n[3+e]=x+E,n[4+e]=x-E}for(g=0;g<8;++g){const e=g;if(n[8+e]===0&&n[16+e]===0&&n[24+e]===0&&n[32+e]===0&&n[40+e]===0&&n[48+e]===0&&n[56+e]===0){s=R*r[g+0]+8192>>14,n[0+e]=s,n[8+e]=s,n[16+e]=s,n[24+e]=s,n[32+e]=s,n[40+e]=s,n[48+e]=s,n[56+e]=s;continue}i=R*n[0+e]+2048>>12,d=R*n[32+e]+2048>>12,m=n[16+e],x=n[48+e],E=K*(n[8+e]-n[56+e])+2048>>12,A=K*(n[8+e]+n[56+e])+2048>>12,k=n[24+e],v=n[40+e],s=i-d+1>>1,i=i+d+1>>1,d=s,s=m*W+x*Q+2048>>12,m=m*Q-x*W+2048>>12,x=s,s=E-v+1>>1,E=E+v+1>>1,v=s,s=A+k+1>>1,k=A-k+1>>1,A=s,s=i-x+1>>1,i=i+x+1>>1,x=s,s=d-m+1>>1,d=d+m+1>>1,m=s,s=E*N+A*$+2048>>12,E=E*$-A*N+2048>>12,A=s,s=k*Z+v*Y+2048>>12,k=k*Y-v*Z+2048>>12,v=s,n[0+e]=i+A,n[56+e]=i-A,n[8+e]=d+v,n[48+e]=d-v,n[16+e]=m+k,n[40+e]=m-k,n[24+e]=x+E,n[32+e]=x-E}for(g=0;g<64;++g){const e=128+(n[g]+8>>4);e<0?c[g]=0:e>255?c[g]=255:c[g]=e}}for(let F=0;F<D;F++){const c=F<<3;for(let r=0;r<8;r++)o.push(new Uint8Array(w));for(let r=0;r<u;r++){h(l.blocks[F][r],t,C);let b=0;const i=r<<3;for(let d=0;d<8;d++){const m=o[c+d];for(let x=0;x<8;x++)m[i+x]=t[b++]}}}return o}class le{constructor(){this.jfif=null,this.adobe=null,this.quantizationTables=[],this.huffmanTablesAC=[],this.huffmanTablesDC=[],this.resetFrames()}resetFrames(){this.frames=[]}parse(l){let o=0;function u(){const t=l[o]<<8|l[o+1];return o+=2,t}function D(){const t=u(),h=l.subarray(o,o+t-2);return o+=h.length,h}function w(t){let h=0,F=0,c,r;for(r in t.components)t.components.hasOwnProperty(r)&&(c=t.components[r],h<c.h&&(h=c.h),F<c.v&&(F=c.v));const b=Math.ceil(t.samplesPerLine/8/h),i=Math.ceil(t.scanLines/8/F);for(r in t.components)if(t.components.hasOwnProperty(r)){c=t.components[r];const d=Math.ceil(Math.ceil(t.samplesPerLine/8)*c.h/h),m=Math.ceil(Math.ceil(t.scanLines/8)*c.v/F),x=b*c.h,E=i*c.v,k=[];for(let v=0;v<E;v++){const A=[];for(let s=0;s<x;s++)A.push(new Int32Array(64));k.push(A)}c.blocksPerLine=d,c.blocksPerColumn=m,c.blocks=k}t.maxH=h,t.maxV=F,t.mcusPerLine=b,t.mcusPerColumn=i}let C=u();if(C!==65496)throw new Error("SOI not found");for(C=u();C!==65497;){switch(C){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:{const t=D();C===65504&&t[0]===74&&t[1]===70&&t[2]===73&&t[3]===70&&t[4]===0&&(this.jfif={version:{major:t[5],minor:t[6]},densityUnits:t[7],xDensity:t[8]<<8|t[9],yDensity:t[10]<<8|t[11],thumbWidth:t[12],thumbHeight:t[13],thumbData:t.subarray(14,14+3*t[12]*t[13])}),C===65518&&t[0]===65&&t[1]===100&&t[2]===111&&t[3]===98&&t[4]===101&&t[5]===0&&(this.adobe={version:t[6],flags0:t[7]<<8|t[8],flags1:t[9]<<8|t[10],transformCode:t[11]});break}case 65499:{const h=u()+o-2;for(;o<h;){const F=l[o++],c=new Int32Array(64);if(F>>4===0)for(let r=0;r<64;r++){const b=J[r];c[b]=l[o++]}else if(F>>4===1)for(let r=0;r<64;r++){const b=J[r];c[b]=u()}else throw new Error("DQT: invalid table spec");this.quantizationTables[F&15]=c}break}case 65472:case 65473:case 65474:{u();const t={extended:C===65473,progressive:C===65474,precision:l[o++],scanLines:u(),samplesPerLine:u(),components:{},componentsOrder:[]},h=l[o++];let F;for(let c=0;c<h;c++){F=l[o];const r=l[o+1]>>4,b=l[o+1]&15,i=l[o+2];t.componentsOrder.push(F),t.components[F]={h:r,v:b,quantizationIdx:i},o+=3}w(t),this.frames.push(t);break}case 65476:{const t=u();for(let h=2;h<t;){const F=l[o++],c=new Uint8Array(16);let r=0;for(let i=0;i<16;i++,o++)c[i]=l[o],r+=c[i];const b=new Uint8Array(r);for(let i=0;i<r;i++,o++)b[i]=l[o];h+=17+r,F>>4===0?this.huffmanTablesDC[F&15]=ne(c,b):this.huffmanTablesAC[F&15]=ne(c,b)}break}case 65501:u(),this.resetInterval=u();break;case 65498:{u();const t=l[o++],h=[],F=this.frames[0];for(let d=0;d<t;d++){const m=F.components[l[o++]],x=l[o++];m.huffmanTableDC=this.huffmanTablesDC[x>>4],m.huffmanTableAC=this.huffmanTablesAC[x&15],h.push(m)}const c=l[o++],r=l[o++],b=l[o++],i=ce(l,o,F,h,this.resetInterval,c,r,b>>4,b&15);o+=i;break}case 65535:l[o]!==255&&o--;break;default:if(l[o-3]===255&&l[o-2]>=192&&l[o-2]<=254){o-=3;break}throw new Error(`unknown JPEG marker ${C.toString(16)}`)}C=u()}}getResult(){const{frames:l}=this;if(this.frames.length===0)throw new Error("no frames were decoded");this.frames.length>1&&console.warn("more than one frame is not supported");for(let c=0;c<this.frames.length;c++){const r=this.frames[c].components;for(const b of Object.keys(r))r[b].quantizationTable=this.quantizationTables[r[b].quantizationIdx],delete r[b].quantizationIdx}const o=l[0],{components:u,componentsOrder:D}=o,w=[],C=o.samplesPerLine,t=o.scanLines;for(let c=0;c<D.length;c++){const r=u[D[c]];w.push({lines:ie(o,r),scaleX:r.h/o.maxH,scaleY:r.v/o.maxV})}const h=new Uint8Array(C*t*w.length);let F=0;for(let c=0;c<t;++c)for(let r=0;r<C;++r)for(let b=0;b<w.length;++b){const i=w[b];h[F]=i.lines[0|c*i.scaleY][0|r*i.scaleX],++F}return h}}class fe extends re.BaseDecoder{constructor(l){super(),this.reader=new le,l.JPEGTables&&this.reader.parse(l.JPEGTables)}decodeBlock(l){return this.reader.resetFrames(),this.reader.parse(new Uint8Array(l)),this.reader.getResult().buffer}}exports.default=fe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const re=require("./geotiff-D9Jxidvv.cjs"),J=new Int32Array([0,1,8,16,9,2,3,10,17,24,32,25,18,11,4,5,12,19,26,33,40,48,41,34,27,20,13,6,7,14,21,28,35,42,49,56,57,50,43,36,29,22,15,23,30,37,44,51,58,59,52,45,38,31,39,46,53,60,61,54,47,55,62,63]),Y=4017,Z=799,$=3406,N=2276,Q=1567,W=3784,R=5793,K=2896;function ne(q,l){let o=0;const u=[];let D=16;for(;D>0&&!q[D-1];)--D;u.push({children:[],index:0});let w=u[0],C;for(let t=0;t<D;t++){for(let h=0;h<q[t];h++){for(w=u.pop(),w.children[w.index]=l[o];w.index>0;)w=u.pop();for(w.index++,u.push(w);u.length<=t;)u.push(C={children:[],index:0}),w.children[w.index]=C.children,w=C;o++}t+1<D&&(u.push(C={children:[],index:0}),w.children[w.index]=C.children,w=C)}return u[0].children}function ce(q,l,o,u,D,w,C,t,h){const{mcusPerLine:F,progressive:c}=o,r=l;let b=l,i=0,d=0;function m(){if(d>0)return d--,i>>d&1;if(i=q[b++],i===255){const f=q[b++];if(f)throw new Error(`unexpected marker: ${(i<<8|f).toString(16)}`)}return d=7,i>>>7}function x(f){let a=f,p;for(;(p=m())!==null;){if(a=a[p],typeof a=="number")return a;if(typeof a!="object")throw new Error("invalid huffman sequence")}return null}function E(f){let a=f,p=0;for(;a>0;){const y=m();if(y===null)return;p=p<<1|y,--a}return p}function k(f){const a=E(f);return a>=1<<f-1?a:a+(-1<<f)+1}function v(f,a){const p=x(f.huffmanTableDC),y=p===0?0:k(p);f.pred+=y,a[0]=f.pred;let P=1;for(;P<64;){const T=x(f.huffmanTableAC),L=T&15,S=T>>4;if(L===0){if(S<15)break;P+=16}else{P+=S;const I=J[P];a[I]=k(L),P++}}}function A(f,a){const p=x(f.huffmanTableDC),y=p===0?0:k(p)<<h;f.pred+=y,a[0]=f.pred}function s(f,a){a[0]|=m()<<h}let n=0;function g(f,a){if(n>0){n--;return}let p=w;const y=C;for(;p<=y;){const P=x(f.huffmanTableAC),T=P&15,L=P>>4;if(T===0){if(L<15){n=E(L)+(1<<L)-1;break}p+=16}else{p+=L;const S=J[p];a[S]=k(T)*(1<<h),p++}}}let e=0,_;function te(f,a){let p=w;const y=C;let P=0;for(;p<=y;){const T=J[p],L=a[T]<0?-1:1;switch(e){case 0:{const S=x(f.huffmanTableAC),I=S&15;if(P=S>>4,I===0)P<15?(n=E(P)+(1<<P),e=4):(P=16,e=1);else{if(I!==1)throw new Error("invalid ACn encoding");_=k(I),e=P?2:3}continue}case 1:case 2:a[T]?a[T]+=(m()<<h)*L:(P--,P===0&&(e=e===2?3:0));break;case 3:a[T]?a[T]+=(m()<<h)*L:(a[T]=_<<h,e=0);break;case 4:a[T]&&(a[T]+=(m()<<h)*L);break}p++}e===4&&(n--,n===0&&(e=0))}function se(f,a,p,y,P){const T=p/F|0,L=p%F,S=T*f.v+y,I=L*f.h+P;a(f,f.blocks[S][I])}function oe(f,a,p){const y=p/f.blocksPerLine|0,P=p%f.blocksPerLine;a(f,f.blocks[y][P])}const V=u.length;let U,j,G,X,M,H;c?w===0?H=t===0?A:s:H=t===0?g:te:H=v;let B=0,z,O;V===1?O=u[0].blocksPerLine*u[0].blocksPerColumn:O=F*o.mcusPerColumn;const ee=D||O;for(;B<O;){for(j=0;j<V;j++)u[j].pred=0;if(n=0,V===1)for(U=u[0],M=0;M<ee;M++)oe(U,H,B),B++;else for(M=0;M<ee;M++){for(j=0;j<V;j++){U=u[j];const{h:f,v:a}=U;for(G=0;G<a;G++)for(X=0;X<f;X++)se(U,H,B,G,X)}if(B++,B===O)break}if(d=0,z=q[b]<<8|q[b+1],z<65280)throw new Error("marker was not found");if(z>=65488&&z<=65495)b+=2;else break}return b-r}function ie(q,l){const o=[],{blocksPerLine:u,blocksPerColumn:D}=l,w=u<<3,C=new Int32Array(64),t=new Uint8Array(64);function h(F,c,r){const b=l.quantizationTable;let i,d,m,x,E,k,v,A,s;const n=r;let g;for(g=0;g<64;g++)n[g]=F[g]*b[g];for(g=0;g<8;++g){const e=8*g;if(n[1+e]===0&&n[2+e]===0&&n[3+e]===0&&n[4+e]===0&&n[5+e]===0&&n[6+e]===0&&n[7+e]===0){s=R*n[0+e]+512>>10,n[0+e]=s,n[1+e]=s,n[2+e]=s,n[3+e]=s,n[4+e]=s,n[5+e]=s,n[6+e]=s,n[7+e]=s;continue}i=R*n[0+e]+128>>8,d=R*n[4+e]+128>>8,m=n[2+e],x=n[6+e],E=K*(n[1+e]-n[7+e])+128>>8,A=K*(n[1+e]+n[7+e])+128>>8,k=n[3+e]<<4,v=n[5+e]<<4,s=i-d+1>>1,i=i+d+1>>1,d=s,s=m*W+x*Q+128>>8,m=m*Q-x*W+128>>8,x=s,s=E-v+1>>1,E=E+v+1>>1,v=s,s=A+k+1>>1,k=A-k+1>>1,A=s,s=i-x+1>>1,i=i+x+1>>1,x=s,s=d-m+1>>1,d=d+m+1>>1,m=s,s=E*N+A*$+2048>>12,E=E*$-A*N+2048>>12,A=s,s=k*Z+v*Y+2048>>12,k=k*Y-v*Z+2048>>12,v=s,n[0+e]=i+A,n[7+e]=i-A,n[1+e]=d+v,n[6+e]=d-v,n[2+e]=m+k,n[5+e]=m-k,n[3+e]=x+E,n[4+e]=x-E}for(g=0;g<8;++g){const e=g;if(n[8+e]===0&&n[16+e]===0&&n[24+e]===0&&n[32+e]===0&&n[40+e]===0&&n[48+e]===0&&n[56+e]===0){s=R*r[g+0]+8192>>14,n[0+e]=s,n[8+e]=s,n[16+e]=s,n[24+e]=s,n[32+e]=s,n[40+e]=s,n[48+e]=s,n[56+e]=s;continue}i=R*n[0+e]+2048>>12,d=R*n[32+e]+2048>>12,m=n[16+e],x=n[48+e],E=K*(n[8+e]-n[56+e])+2048>>12,A=K*(n[8+e]+n[56+e])+2048>>12,k=n[24+e],v=n[40+e],s=i-d+1>>1,i=i+d+1>>1,d=s,s=m*W+x*Q+2048>>12,m=m*Q-x*W+2048>>12,x=s,s=E-v+1>>1,E=E+v+1>>1,v=s,s=A+k+1>>1,k=A-k+1>>1,A=s,s=i-x+1>>1,i=i+x+1>>1,x=s,s=d-m+1>>1,d=d+m+1>>1,m=s,s=E*N+A*$+2048>>12,E=E*$-A*N+2048>>12,A=s,s=k*Z+v*Y+2048>>12,k=k*Y-v*Z+2048>>12,v=s,n[0+e]=i+A,n[56+e]=i-A,n[8+e]=d+v,n[48+e]=d-v,n[16+e]=m+k,n[40+e]=m-k,n[24+e]=x+E,n[32+e]=x-E}for(g=0;g<64;++g){const e=128+(n[g]+8>>4);e<0?c[g]=0:e>255?c[g]=255:c[g]=e}}for(let F=0;F<D;F++){const c=F<<3;for(let r=0;r<8;r++)o.push(new Uint8Array(w));for(let r=0;r<u;r++){h(l.blocks[F][r],t,C);let b=0;const i=r<<3;for(let d=0;d<8;d++){const m=o[c+d];for(let x=0;x<8;x++)m[i+x]=t[b++]}}}return o}class le{constructor(){this.jfif=null,this.adobe=null,this.quantizationTables=[],this.huffmanTablesAC=[],this.huffmanTablesDC=[],this.resetFrames()}resetFrames(){this.frames=[]}parse(l){let o=0;function u(){const t=l[o]<<8|l[o+1];return o+=2,t}function D(){const t=u(),h=l.subarray(o,o+t-2);return o+=h.length,h}function w(t){let h=0,F=0,c,r;for(r in t.components)t.components.hasOwnProperty(r)&&(c=t.components[r],h<c.h&&(h=c.h),F<c.v&&(F=c.v));const b=Math.ceil(t.samplesPerLine/8/h),i=Math.ceil(t.scanLines/8/F);for(r in t.components)if(t.components.hasOwnProperty(r)){c=t.components[r];const d=Math.ceil(Math.ceil(t.samplesPerLine/8)*c.h/h),m=Math.ceil(Math.ceil(t.scanLines/8)*c.v/F),x=b*c.h,E=i*c.v,k=[];for(let v=0;v<E;v++){const A=[];for(let s=0;s<x;s++)A.push(new Int32Array(64));k.push(A)}c.blocksPerLine=d,c.blocksPerColumn=m,c.blocks=k}t.maxH=h,t.maxV=F,t.mcusPerLine=b,t.mcusPerColumn=i}let C=u();if(C!==65496)throw new Error("SOI not found");for(C=u();C!==65497;){switch(C){case 65280:break;case 65504:case 65505:case 65506:case 65507:case 65508:case 65509:case 65510:case 65511:case 65512:case 65513:case 65514:case 65515:case 65516:case 65517:case 65518:case 65519:case 65534:{const t=D();C===65504&&t[0]===74&&t[1]===70&&t[2]===73&&t[3]===70&&t[4]===0&&(this.jfif={version:{major:t[5],minor:t[6]},densityUnits:t[7],xDensity:t[8]<<8|t[9],yDensity:t[10]<<8|t[11],thumbWidth:t[12],thumbHeight:t[13],thumbData:t.subarray(14,14+3*t[12]*t[13])}),C===65518&&t[0]===65&&t[1]===100&&t[2]===111&&t[3]===98&&t[4]===101&&t[5]===0&&(this.adobe={version:t[6],flags0:t[7]<<8|t[8],flags1:t[9]<<8|t[10],transformCode:t[11]});break}case 65499:{const h=u()+o-2;for(;o<h;){const F=l[o++],c=new Int32Array(64);if(F>>4===0)for(let r=0;r<64;r++){const b=J[r];c[b]=l[o++]}else if(F>>4===1)for(let r=0;r<64;r++){const b=J[r];c[b]=u()}else throw new Error("DQT: invalid table spec");this.quantizationTables[F&15]=c}break}case 65472:case 65473:case 65474:{u();const t={extended:C===65473,progressive:C===65474,precision:l[o++],scanLines:u(),samplesPerLine:u(),components:{},componentsOrder:[]},h=l[o++];let F;for(let c=0;c<h;c++){F=l[o];const r=l[o+1]>>4,b=l[o+1]&15,i=l[o+2];t.componentsOrder.push(F),t.components[F]={h:r,v:b,quantizationIdx:i},o+=3}w(t),this.frames.push(t);break}case 65476:{const t=u();for(let h=2;h<t;){const F=l[o++],c=new Uint8Array(16);let r=0;for(let i=0;i<16;i++,o++)c[i]=l[o],r+=c[i];const b=new Uint8Array(r);for(let i=0;i<r;i++,o++)b[i]=l[o];h+=17+r,F>>4===0?this.huffmanTablesDC[F&15]=ne(c,b):this.huffmanTablesAC[F&15]=ne(c,b)}break}case 65501:u(),this.resetInterval=u();break;case 65498:{u();const t=l[o++],h=[],F=this.frames[0];for(let d=0;d<t;d++){const m=F.components[l[o++]],x=l[o++];m.huffmanTableDC=this.huffmanTablesDC[x>>4],m.huffmanTableAC=this.huffmanTablesAC[x&15],h.push(m)}const c=l[o++],r=l[o++],b=l[o++],i=ce(l,o,F,h,this.resetInterval,c,r,b>>4,b&15);o+=i;break}case 65535:l[o]!==255&&o--;break;default:if(l[o-3]===255&&l[o-2]>=192&&l[o-2]<=254){o-=3;break}throw new Error(`unknown JPEG marker ${C.toString(16)}`)}C=u()}}getResult(){const{frames:l}=this;if(this.frames.length===0)throw new Error("no frames were decoded");this.frames.length>1&&console.warn("more than one frame is not supported");for(let c=0;c<this.frames.length;c++){const r=this.frames[c].components;for(const b of Object.keys(r))r[b].quantizationTable=this.quantizationTables[r[b].quantizationIdx],delete r[b].quantizationIdx}const o=l[0],{components:u,componentsOrder:D}=o,w=[],C=o.samplesPerLine,t=o.scanLines;for(let c=0;c<D.length;c++){const r=u[D[c]];w.push({lines:ie(o,r),scaleX:r.h/o.maxH,scaleY:r.v/o.maxV})}const h=new Uint8Array(C*t*w.length);let F=0;for(let c=0;c<t;++c)for(let r=0;r<C;++r)for(let b=0;b<w.length;++b){const i=w[b];h[F]=i.lines[0|c*i.scaleY][0|r*i.scaleX],++F}return h}}class fe extends re.BaseDecoder{constructor(l){super(),this.reader=new le,l.JPEGTables&&this.reader.parse(l.JPEGTables)}decodeBlock(l){return this.reader.resetFrames(),this.reader.parse(new Uint8Array(l)),this.reader.getResult().buffer}}exports.default=fe;
@@ -1,6 +1,6 @@
1
1
  import { i as sA } from "./pako.esm-Bx5X36Wo.js";
2
- import { g as DA } from "./ControlGrid-CeKq8xm8.js";
3
- import { B as nA, L as fA, a as gA } from "./geotiff-CkM7wOor.js";
2
+ import { g as DA } from "./ControlGrid-CcOIR0lI.js";
3
+ import { B as nA, L as fA, a as gA } from "./geotiff-CY9Ly-G7.js";
4
4
  var BA = { exports: {} }, iA;
5
5
  function tA() {
6
6
  return iA || (iA = 1, (function(j) {