=0||!bs(n)){const t=rp(g,e,r,i,l,_,u,d,b,p,v,Qh.horizontal,!1,y,h);t&&(m.horizontal[b]=t);}A(w?\"left\":b);}}let b=!1;if(s.icon&&s.icon.name){const e=n[s.icon.name];e&&(x=pp(i[s.icon.name],c.get(\"icon-offset\").evaluate(s,{},o),c.get(\"icon-anchor\").evaluate(s,{},o)),b=e.sdf,void 0===t.sdfIcons?t.sdfIcons=e.sdf:t.sdfIcons!==e.sdf&&$(\"Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer\"),(e.pixelRatio!==t.pixelRatio||0!==c.get(\"icon-rotate\").constantOr(1))&&(t.iconsNeedLinear=!0));}const w=Zp(m.horizontal)||m.vertical;t.iconsInText||(t.iconsInText=!!w&&w.iconsInText),(w||x)&&Np(t,s,m,x,n,p,y,0,v,b,a,o,u);}s&&t.generateCollisionDebugBuffers(l,t.collisionBoxArray);}function qp(t){switch(t){case\"right\":case\"top-right\":case\"bottom-right\":return \"right\";case\"left\":case\"top-left\":case\"bottom-left\":return \"left\"}return \"center\"}function Np(t,e,r,n,i,s,a,o,l,u,c,h,p){let f=s.textMaxSize.evaluate(e,{},h);void 0===f&&(f=a);const d=t.layers[0].layout,y=d.get(\"icon-offset\").evaluate(e,{},h),m=Zp(r.horizontal)||r.vertical,g=\"globe\"===p.name,v=a/24,b=t.tilePixelRatio*f/24,w=(z=t.overscaling,t.zoom>18&&z>2&&(z>>=1),Math.max(So/(512*z),1)*d.get(\"symbol-spacing\")),_=d.get(\"text-padding\")*t.tilePixelRatio,A=d.get(\"icon-padding\")*t.tilePixelRatio,S=x(d.get(\"text-max-angle\")),k=\"map\"===d.get(\"text-rotation-alignment\")&&\"point\"!==d.get(\"symbol-placement\"),I=\"map\"===d.get(\"icon-rotation-alignment\")&&\"point\"!==d.get(\"symbol-placement\"),M=d.get(\"symbol-placement\"),T=w/2;var z;const B=d.get(\"icon-text-fit\");let E;n&&\"none\"!==B&&(t.allowVerticalPlacement&&r.vertical&&(E=fp(n,r.vertical,B,d.get(\"icon-text-fit-padding\"),y,v)),m&&(n=fp(n,m,B,d.get(\"icon-text-fit-padding\"),y,v)));const C=(a,o,f)=>{if(o.x<0||o.x>=So||o.y<0||o.y>=So)return;let d=null;if(g){const{x:t,y:e,z:r}=p.projectTilePoint(o.x,o.y,f);d={anchor:new dp(t,e,r,0,void 0),up:p.upVector(f,o.x,o.y)};}!function(t,e,r,n,i,s,a,o,l,u,c,h,p,f,d,y,m,g,x,v,b,w,_,A,S){const k=t.addToLineVertexArray(e,n);let I,M,T,z,B,E,C,P=0,D=0,V=0,L=0,F=-1,R=-1;const j={};let U=qa.exports(\"\");const O=r?r.anchor:e;let q=0,N=0;if(void 0===l._unevaluatedLayout.getValue(\"text-radial-offset\")?[q,N]=l.layout.get(\"text-offset\").evaluate(b,{},S).map((t=>t*yh)):(q=l.layout.get(\"text-radial-offset\").evaluate(b,{},S)*yh,N=jp),t.allowVerticalPlacement&&i.vertical){const t=i.vertical;if(d)E=Yp(t),o&&(C=Yp(o));else {const r=l.layout.get(\"text-rotate\").evaluate(b,{},S)+90;T=Kp(u,O,e,c,h,p,t,f,r,y),o&&(z=Kp(u,O,e,c,h,p,o,g,r));}}if(s){const n=l.layout.get(\"icon-rotate\").evaluate(b,{},S),i=\"none\"!==l.layout.get(\"icon-text-fit\"),a=Tp(s,n,_,i),f=o?Tp(o,n,_,i):void 0;M=Kp(u,O,e,c,h,p,s,g,n),P=4*a.length;const d=t.iconSizeData;let y=null;\"source\"===d.kind?(y=[mh*l.layout.get(\"icon-size\").evaluate(b,{},S)],y[0]>Gp&&$(`${t.layerIds[0]}: Value for \"icon-size\" is >= 255. Reduce your \"icon-size\".`)):\"composite\"===d.kind&&(y=[mh*w.compositeIconSizes[0].evaluate(b,{},S),mh*w.compositeIconSizes[1].evaluate(b,{},S)],(y[0]>Gp||y[1]>Gp)&&$(`${t.layerIds[0]}: Value for \"icon-size\" is >= 255. Reduce your \"icon-size\".`)),t.addSymbols(t.icon,a,y,v,x,b,!1,r,e,k.lineStartIndex,k.lineLength,-1,A,S),F=t.icon.placedSymbolArray.length-1,f&&(D=4*f.length,t.addSymbols(t.icon,f,y,v,x,b,Qh.vertical,r,e,k.lineStartIndex,k.lineLength,-1,A,S),R=t.icon.placedSymbolArray.length-1);}for(const n in i.horizontal){const s=i.horizontal[n];I||(U=qa.exports(s.text),d?B=Yp(s):I=Kp(u,O,e,c,h,p,s,f,l.layout.get(\"text-rotate\").evaluate(b,{},S),y));const o=1===s.positionedLines.length;if(V+=Xp(t,r,e,s,a,l,d,b,y,k,i.vertical?Qh.horizontal:Qh.horizontalOnly,o?Object.keys(i.horizontal):[n],j,F,w,A,S),o)break}i.vertical&&(L+=Xp(t,r,e,i.vertical,a,l,d,b,y,k,Qh.vertical,[\"vertical\"],j,R,w,A,S));let G=-1;const X=(t,e)=>t?Math.max(t,e):e;G=X(B,G),G=X(E,G),G=X(C,G);const Z=G>-1?1:0;t.glyphOffsetArray.length>=cd.MAX_GLYPHS&&$(\"Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907\"),void 0!==b.sortKey&&t.addToSortKeyRanges(t.symbolInstances.length,b.sortKey),t.symbolInstances.emplaceBack(O.x,O.y,O.z,e.x,e.y,j.right>=0?j.right:-1,j.center>=0?j.center:-1,j.left>=0?j.left:-1,j.vertical>=0?j.vertical:-1,F,R,U,void 0!==I?I:t.collisionBoxArray.length,void 0!==I?I+1:t.collisionBoxArray.length,void 0!==T?T:t.collisionBoxArray.length,void 0!==T?T+1:t.collisionBoxArray.length,void 0!==M?M:t.collisionBoxArray.length,void 0!==M?M+1:t.collisionBoxArray.length,z||t.collisionBoxArray.length,z?z+1:t.collisionBoxArray.length,c,V,L,P,D,Z,0,q,N,G);}(t,o,d,a,r,n,i,E,t.layers[0],t.collisionBoxArray,e.index,e.sourceLayerIndex,t.index,_,k,l,0,A,I,y,e,s,u,c,h);};if(\"line\"===M)for(const i of _p(e.geometry,0,0,So,So)){const e=bp(i,w,S,r.vertical||m,n,24,b,t.overscaling,So);for(const r of e){const e=m;e&&Hp(t,e.text,T,r)||C(i,r,h);}}else if(\"line-center\"===M){for(const t of e.geometry)if(t.length>1){const e=vp(t,S,r.vertical||m,n,24,b);e&&C(t,e,h);}}else if(\"Polygon\"===e.type)for(const t of tc(e.geometry,0)){const e=Lp(t,16);C(t[0],new dp(e.x,e.y,0,0,void 0),h);}else if(\"LineString\"===e.type)for(const t of e.geometry)C(t,new dp(t[0].x,t[0].y,0,0,void 0),h);else if(\"Point\"===e.type)for(const t of e.geometry)for(const e of t)C([e],new dp(e.x,e.y,0,0,void 0),h);}const Gp=32640;function Xp(t,e,r,n,i,s,a,o,l,u,c,h,p,f,y,m,g){const x=function(t,e,r,n,i,s,a,o){const l=[];if(0===e.positionedLines.length)return l;const u=n.layout.get(\"text-rotate\").evaluate(s,{})*Math.PI/180,c=function(t){const e=t[0],r=t[1],n=e*r;return n>0?[e,-r]:n<0?[-e,r]:0===e?[r,e]:[r,-e]}(r);let h=Math.abs(e.top-e.bottom);for(const t of e.positionedLines)h-=t.lineOffset;const p=e.positionedLines.length,f=h/p;let y=e.top-r[1];for(let t=0;tGp&&$(`${t.layerIds[0]}: Value for \"text-size\" is >= 255. Reduce your \"text-size\".`)):\"composite\"===v.kind&&(b=[mh*y.compositeTextSizes[0].evaluate(o,{},g),mh*y.compositeTextSizes[1].evaluate(o,{},g)],(b[0]>Gp||b[1]>Gp)&&$(`${t.layerIds[0]}: Value for \"text-size\" is >= 255. Reduce your \"text-size\".`)),t.addSymbols(t.text,x,b,l,a,o,c,e,r,u.lineStartIndex,u.lineLength,f,m,g);for(const e of h)p[e]=t.text.placedSymbolArray.length-1;return 4*x.length}function Zp(t){for(const e in t)return t[e];return null}function Kp(t,e,r,n,i,s,a,o,l,u){let c=a.top,h=a.bottom,p=a.left,f=a.right;const y=a.collisionPadding;if(y&&(p-=y[0],c-=y[1],f+=y[2],h+=y[3]),l){const t=new d(p,c),e=new d(f,c),r=new d(p,h),n=new d(f,h),i=x(l);let s=new d(0,0);u&&(s=new d(u[0],u[1])),t._rotateAround(i,s),e._rotateAround(i,s),r._rotateAround(i,s),n._rotateAround(i,s),p=Math.min(t.x,e.x,r.x,n.x),f=Math.max(t.x,e.x,r.x,n.x),c=Math.min(t.y,e.y,r.y,n.y),h=Math.max(t.y,e.y,r.y,n.y);}return t.emplaceBack(e.x,e.y,e.z,r.x,r.y,p,c,f,h,o,n,i,s),t.length-1}function Yp(t){t.collisionPadding&&(t.top-=t.collisionPadding[1],t.bottom+=t.collisionPadding[3]);const e=t.bottom-t.top;return e>0?Math.max(10,e):null}function Hp(t,e,r,n){const i=t.compareText;if(e in i){const t=i[e];for(let e=t.length-1;e>=0;e--)if(n.dist(t[e])1?null:function(t,e,r,n){const i=Math.sin(r);return t*(Math.sin((1-n)*r)/i)+e*(Math.sin(n*r)/i)}(t.a[e],t.b[e],t.angle,S(r,0,1))+t.center[e]}function pf(t){if(t.z<=1)return lf[t.z+2*t.y+t.x];const e=xf(gf(t));return au.fromPoints(e)}function ff(t,e,r){return Rl(t,t,1-r),jl(t,t,e,r)}function df(t,e){const r=Mf(e.zoom);if(0===r)return pf(t);const n=gf(t),i=xf(n),s=Bo(n.getWest())*e.worldSize,a=Bo(n.getEast())*e.worldSize,o=Eo(n.getNorth())*e.worldSize,l=Eo(n.getSouth())*e.worldSize,u=[s,o,0],c=[a,o,0],h=[s,l,0],p=[a,l,0],f=bl([],e.globeMatrix);return ql(u,u,f),ql(c,c,f),ql(h,h,f),ql(p,p,f),i[0]=ff(i[0],h,r),i[1]=ff(i[1],p,r),i[2]=ff(i[2],c,r),i[3]=ff(i[3],u,r),au.fromPoints(i)}function yf(t,e,r){for(const n of t)ql(n,n,e),Rl(n,n,r);}function mf(t,e,r){const n=e/t.worldSize,i=t.globeMatrix;if(r.z<=1){const t=pf(r).getCorners();return yf(t,i,n),au.fromPoints(t)}const s=gf(r),a=xf(s);yf(a,i,n);const o=Number.MAX_VALUE,l=[-o,-o,-o],u=[o,o,o];if(s.contains(t.center)){for(const t of a)Ll(u,u,t),Fl(l,l,t);l[2]=0;const e=t.point,r=[e.x*n,e.y*n,0];return Ll(u,u,r),Fl(l,l,r),new au(u,l)}const c=[i[12]*n,i[13]*n,i[14]*n],h=s.getCenter(),p=S(t.center.lat,-85.051129,Lo),f=S(h.lat,-85.051129,Lo),d=Bo(t.center.lng),y=Eo(p);let m=d-Bo(h.lng);const g=y-Eo(f);m>.5?m-=1:m<-.5&&(m+=1);let v=0;Math.abs(m)>Math.abs(g)?v=m>=0?1:3:(v=g>=0?0:2,jl(c,c,[i[4]*n,i[5]*n,i[6]*n],-Math.sin(x(g>=0?s.getSouth():s.getNorth()))*ef));const b=a[v],w=a[(v+1)%4],_=new cf(b,w,c),A=[hf(_,0)||b[0],hf(_,1)||b[1],hf(_,2)||b[2]],k=Mf(t.zoom);if(k>0){const n=function({x:t,y:e,z:r},n,i,s,a){const o=1/(1<.5?p=-1:f<-.5&&(p=1),l=((l+p)*n-(s*=n))*i+s,u=((u+p)*n-s)*i+s,c=(c*n-(a*=n))*i+a,h=(h*n-a)*i+a,[[l,h,0],[u,h,0],[u,c,0],[l,c,0]]}(r,e,t._pixelsPerMercatorPixel,d,y);for(let t=0;tMath.PI/2*1.01}const Bf=x(85),Ef=Math.cos(Bf),Cf=Math.sin(Bf);function Pf(t,e){const r=t.fovAboveCenter,n=t.elevation?t.elevation.getMinElevationBelowMSL()*e:0,i=(t._camera.position[2]*t.worldSize-n)/Math.cos(t._pitch),s=Math.sin(r)*i/Math.sin(Math.max(Math.PI/2-t._pitch-r,.01)),a=Math.sin(t._pitch)*s+i;return Math.min(1.01*a,i*(1/t._horizonShift))}function Df(t,e){if(!e.isReprojectedInTileSpace)return {scale:1<v&&(b(t,u,n,i,o,l),b(u,r,o,l,s,a));}b(h,p,n,s,i,s),b(p,f,i,s,i,a),b(f,d,i,a,n,a),b(d,h,n,a,n,s),y-=v,m-=v,g+=v,x+=v;const w=1/Math.max(g-y,x-m);return {scale:w,x:y*w,y:m*w,x2:g*w,y2:x*w,projection:e}}const Vf=vl(new Float32Array(16));class Lf{constructor(t){this.spec=t,this.name=t.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit=\"meters\",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=[\"custom\"],this.center=[0,0],this.range=[3.5,7];}project(t,e){return {x:0,y:0,z:0}}unproject(t,e){return new Mo(0,0)}projectTilePoint(t,e,r){return {x:t,y:e,z:0}}locationPoint(t,e,r=!0){return t._coordinatePoint(t.locationCoordinate(e),r)}pixelsPerMeter(t,e){return Co(1,t)*e}pixelSpaceConversion(t,e,r){return 1}farthestPixelDistance(t){return Pf(t,t.pixelsPerMeter)}pointCoordinate(t,e,r,n){const i=t.horizonLineFromTop(!1),s=new d(e,Math.max(i,r));return t.rayIntersectionCoordinate(t.pointRayIntersection(s,n))}pointCoordinate3D(t,e,r){const n=new d(e,r);if(t.elevation)return t.elevation.pointCoordinate(n);{const e=this.pointCoordinate(t,n.x,n.y,0);return [e.x,e.y,e.z]}}isPointAboveHorizon(t,e){if(t.elevation)return !this.pointCoordinate3D(t,e.x,e.y);const r=t.horizonLineFromTop();return e.y0?e<-Gf+r&&(e=-Gf+r):e>Gf-r&&(e=Gf-r);const s=i/Math.pow(Xf(e),n);let a=s*Math.sin(n*t),o=i-s*Math.cos(n*t);return a=.5*(a/Math.PI+.5),o=.5*(o/Math.PI+.5),{x:a,y:this.southernCenter?o:1-o,z:0}}unproject(t,e){t=(2*t-.5)*Math.PI,this.southernCenter&&(e=1-e),e=(2*(1-e)-.5)*Math.PI;const{n:r,f:n}=this,i=n-e,s=Math.sign(i),a=Math.sign(r)*Math.sqrt(t*t+i*i);let o=Math.atan2(t,Math.abs(i))*s;i*r<0&&(o-=Math.PI*Math.sign(t)*s);const l=S(v(o/r)+this.center[0],-180,180),u=S(v(2*Math.atan(Math.pow(n/a,1/r))-Gf),-85.051129,Lo);return new Mo(l,this.southernCenter?-u:u)}}class Kf extends Lf{constructor(t){super(t),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null;}project(t,e){return {x:Bo(t),y:Eo(e),z:0}}unproject(t,e){const r=Po(t),n=Do(e);return new Mo(r,n)}}const Yf=x(Lo);class Hf extends Lf{project(t,e){const r=(e=x(e))*e,n=r*r;return {x:.5*((t=x(t))*(.8707-.131979*r+n*(n*(.003971*r-.001529*n)-.013791))/Math.PI+.5),y:1-.5*(e*(1.007226+r*(.015085+n*(.028874*r-.044475-.005916*n)))/Math.PI+1),z:0}}unproject(t,e){t=(2*t-.5)*Math.PI;let r=e=(2*(1-e)-1)*Math.PI,n=25,i=0,s=r*r;do{s=r*r;const t=s*s;i=(r*(1.007226+s*(.015085+t*(.028874*s-.044475-.005916*t)))-e)/(1.007226+s*(.045255+t*(.259866*s-.311325-.005916*11*t))),r=S(r-i,-Yf,Yf);}while(Math.abs(i)>1e-6&&--n>0);s=r*r;const a=S(v(t/(.8707+s*(s*(s*s*s*(.003971-.001529*s)-.013791)-.131979))),-180,180),o=v(r);return new Mo(a,o)}}const Wf=x(Lo);class Jf extends Lf{project(t,e){e=x(e),t=x(t);const r=Math.cos(e),n=2/Math.PI,i=Math.acos(r*Math.cos(t/2)),s=Math.sin(i)/i,a=.5*(t*n+2*r*Math.sin(t/2)/s)||0,o=.5*(e+Math.sin(e)/s)||0;return {x:.5*(a/Math.PI+.5),y:1-.5*(o/Math.PI+1),z:0}}unproject(t,e){let r=t=(2*t-.5)*Math.PI,n=e=(2*(1-e)-1)*Math.PI,i=25;const s=1e-6;let a=0,o=0;do{const i=Math.cos(n),s=Math.sin(n),l=2*s*i,u=s*s,c=i*i,h=Math.cos(r/2),p=Math.sin(r/2),f=2*h*p,d=p*p,y=1-c*h*h,m=y?1/y:0,g=y?Math.acos(i*h)*Math.sqrt(1/y):0,x=.5*(2*g*i*p+2*r/Math.PI)-t,v=.5*(g*s+n)-e,b=.5*m*(c*d+g*i*h*u)+1/Math.PI,w=m*(f*l/4-g*s*p),_=.125*m*(l*p-g*s*c*f),A=.5*m*(u*h+g*d*i)+.5,k=w*_-A*b;a=(v*w-x*A)/k,o=(x*_-v*b)/k,r=S(r-a,-Math.PI,Math.PI),n=S(n-o,-Wf,Wf);}while((Math.abs(a)>s||Math.abs(o)>s)&&--i>0);return new Mo(v(r),v(n))}}class Qf extends Lf{constructor(t){super(t),this.center=t.center||[0,0],this.parallels=t.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(x(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0;}project(t,e){const{scale:r,cosPhi:n}=this;return {x:x(t)*n*r+.5,y:-Math.sin(x(e))/n*r+.5,z:0}}unproject(t,e){const{scale:r,cosPhi:n}=this,i=-(e-.5)/r,s=S(v((t-.5)/r)/n,-180,180),a=Math.asin(S(i*n,-1,1)),o=S(v(a),-85.051129,Lo);return new Mo(s,o)}}class td extends Kf{constructor(t){super(t),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit=\"pixels\",this.unsupportedLayers=[\"debug\",\"custom\"],this.range=[3,5];}projectTilePoint(t,e,r){const n=wf(t,e,r);return ql(n,n,Sf(pf(r))),{x:n[0],y:n[1],z:n[2]}}locationPoint(t,e){const r=bf(e.lat,e.lng),n=Ul([],r),i=t.elevation?t.elevation.getAtPointOrZero(t.locationCoordinate(e),t._centerAltitude):t._centerAltitude;jl(r,r,n,Co(1,0)*So*i);const s=vl(new Float64Array(16));return wl(s,t.pixelMatrix,t.globeMatrix),ql(r,r,s),new d(r[0],r[1])}pixelsPerMeter(t,e){return Co(1,0)*e}pixelSpaceConversion(t,e,r){const n=Co(1,t)*e,i=Mr(Co(1,45)*e,n,r);return this.pixelsPerMeter(t,e)/i}createTileMatrix(t,e,r){const n=kf(pf(r.canonical));return wl(new Float64Array(16),t.globeMatrix,n)}createInversionMatrix(t,e){const{center:r}=t,n=Sf(pf(e));return kl(n,n,x(r.lng)),Sl(n,n,x(r.lat)),Al(n,n,[t._pixelsPerMercatorPixel,t._pixelsPerMercatorPixel,1]),Float32Array.from(n)}pointCoordinate(t,e,r,n){return uf(t,e,r,!0)||new Ro(0,0)}pointCoordinate3D(t,e,r){const n=this.pointCoordinate(t,e,r,0);return [n.x,n.y,n.z]}isPointAboveHorizon(t,e){return !uf(t,e.x,e.y,!1)}farthestPixelDistance(t){const e=function(t,e){const r=t.cameraToCenterDistance,n=t._centerAltitude*e,i=t._camera,s=t._camera.forward(),a=Pl([],Rl([],s,-r),[0,0,n]),o=t.worldSize/(2*Math.PI),l=[0,0,-o],u=t.width/t.height,c=Math.tan(t.fovAboveCenter),h=Rl([],i.up(),c),p=Rl([],i.right(),c*u),f=Ul([],Pl([],Pl([],s,h),p)),d=[];let y;if(new nu(a,f).closestPointOnSphere(l,o,d)){const e=Pl([],d,l),r=Xl([],e,a);y=Math.cos(t.fovAboveCenter)*El(r);}else {const t=Xl([],a,l),e=Xl([],l,a);Ul(e,e);const r=El(t)-o;y=Math.sqrt(r*(r+2*o));const n=Math.acos(y/(o+r))-Math.acos($l(s,e));y*=Math.cos(n);}return 1.01*y}(t,this.pixelsPerMeter(t.center.lat,t.worldSize)),r=Mf(t.zoom);if(r>0){const n=Pf(t,Co(1,t.center.lat)*t.worldSize),i=t.worldSize/(2*Math.PI),s=Math.max(t.width,t.height)/t.worldSize*Math.PI;return Mr(e,n+i*(1-Math.cos(s)),Math.pow(r,10))}return e}upVector(t,e,r){return wf(e,r,t,1)}upVectorScale(t){return {metersToTile:rf*_f(pf(t))}}}function ed(t){const e=t.parallels,r=!!e&&Math.abs(e[0]+e[1])<.01;switch(t.name){case\"mercator\":return new Kf(t);case\"equirectangular\":return new Nf(t);case\"naturalEarth\":return new Hf(t);case\"equalEarth\":return new qf(t);case\"winkelTripel\":return new Jf(t);case\"albers\":return r?new Qf(t):new Ff(t);case\"lambertConformalConic\":return r?new Qf(t):new Zf(t);case\"globe\":return new td(t)}throw new Error(`Invalid projection name: ${t.name}`)}const rd=Sc.types,nd=[{name:\"a_fade_opacity\",components:1,type:\"Uint8\",offset:0}];function id(t,e,r,n,i,s,a,o,l,u,c,h,p){const f=o?Math.min(Gp,Math.round(o[0])):0,d=o?Math.min(Gp,Math.round(o[1])):0;t.emplaceBack(e,r,Math.round(32*n),Math.round(32*i),s,a,(f<<1)+(l?1:0),d,16*u,16*c,256*h,256*p);}function sd(t,e,r,n,i,s,a){t.emplaceBack(e,r,n,i,s,a);}function ad(t,e,r,n,i){t.emplaceBack(e,r,n,i),t.emplaceBack(e,r,n,i),t.emplaceBack(e,r,n,i),t.emplaceBack(e,r,n,i);}function od(t){for(const e of t.sections)if(Ms(e.text))return !0;return !1}class ld{constructor(t){this.layoutVertexArray=new fa,this.indexArray=new wa,this.programConfigurations=t,this.segments=new Ao,this.dynamicLayoutVertexArray=new ua,this.opacityVertexArray=new ya,this.placedSymbolArray=new Pa,this.globeExtVertexArray=new da;}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length}upload(t,e,r,n){this.isEmpty()||(r&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,lh.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,e),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,ch.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,nd,!0),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=t.createVertexBuffer(this.globeExtVertexArray,uh.members,!0)),this.opacityVertexBuffer.itemSize=1),(r||n)&&this.programConfigurations.upload(t));}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy());}}Oi(ld,\"SymbolBuffers\");class ud{constructor(t,e,r){this.layoutVertexArray=new t,this.layoutAttributes=e,this.indexArray=new r,this.segments=new Ao,this.collisionVertexArray=new va,this.collisionVertexArrayExt=new ba;}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,hh.members,!0),this.collisionVertexBufferExt=t.createVertexBuffer(this.collisionVertexArrayExt,ph.members,!0);}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy());}}Oi(ud,\"CollisionBuffers\");class cd{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map((t=>t.id)),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=vl([]),this.placementViewportMatrix=vl([]);const e=this.layers[0]._unevaluatedLayout._values;this.textSizeData=gh(this.zoom,e[\"text-size\"]),this.iconSizeData=gh(this.zoom,e[\"icon-size\"]);const r=this.layers[0].layout,n=r.get(\"symbol-sort-key\"),i=r.get(\"symbol-z-order\");this.canOverlap=r.get(\"text-allow-overlap\")||r.get(\"icon-allow-overlap\")||r.get(\"text-ignore-placement\")||r.get(\"icon-ignore-placement\"),this.sortFeaturesByKey=\"viewport-y\"!==i&&void 0!==n.constantOr(1),this.sortFeaturesByY=(\"viewport-y\"===i||\"auto\"===i&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=r.get(\"text-writing-mode\").map((t=>Qh[t])),this.stateDependentLayerIds=this.layers.filter((t=>t.isStateDependent())).map((t=>t.id)),this.sourceID=t.sourceID,this.projection=t.projection;}createArrays(){this.text=new ld(new po(this.layers,this.zoom,(t=>/^text/.test(t)))),this.icon=new ld(new po(this.layers,this.zoom,(t=>/^icon/.test(t)))),this.glyphOffsetArray=new La,this.lineVertexArray=new Fa,this.symbolInstances=new Va;}calculateGlyphDependencies(t,e,r,n,i){for(let r=0;r0)&&(\"constant\"!==o.value.kind||o.value.value.length>0),h=\"constant\"!==u.value.kind||!!u.value.value||Object.keys(u.parameters).length>0,p=s.get(\"symbol-sort-key\");if(this.features=[],!c&&!h)return;const f=e.iconDependencies,d=e.glyphDependencies,y=e.availableImages,m=new Us(this.zoom);for(const{feature:e,id:l,index:u,sourceLayerIndex:g}of t){const t=i._featureFilter.needGeometry,x=Zo(e,t);if(!i._featureFilter.filter(m,x,r))continue;if(t||(x.geometry=Xo(e,r,n)),a&&1!==e.type&&r.z<=5){const t=x.geometry,e=.98078528056,n=(t,n)=>$l(wf(t.x,t.y,r,1),wf(n.x,n.y,r,1))=0;for(const r of v.sections)if(r.image)f[r.image.name]=!0;else {const n=bs(v.toString()),i=r.fontStack||t,s=d[i]=d[i]||{};this.calculateGlyphDependencies(r.text,s,e,this.allowVerticalPlacement,n);}}}\"line\"===s.get(\"symbol-placement\")&&(this.features=function(t){const e={},r={},n=[];let i=0;function s(e){n.push(t[e]),i++;}function a(t,e,i){const s=r[t];return delete r[t],r[e]=s,n[s].geometry[0].pop(),n[s].geometry[0]=n[s].geometry[0].concat(i[0]),s}function o(t,r,i){const s=e[r];return delete e[r],e[t]=s,n[s].geometry[0].shift(),n[s].geometry[0]=i[0].concat(n[s].geometry[0]),s}function l(t,e,r){const n=r?e[0][e[0].length-1]:e[0][0];return `${t}:${n.x}:${n.y}`}for(let u=0;ut.geometry))}(this.features)),this.sortFeaturesByKey&&this.features.sort(((t,e)=>t.sortKey-e.sortKey));}update(t,e,r,n){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,e,this.layers,r,n),this.icon.programConfigurations.updatePaintArrays(t,e,this.layers,r,n));}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return !this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0;}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy();}getProjection(){return this.projectionInstance||(this.projectionInstance=ed(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData();}addToLineVertexArray(t,e){const r=this.lineVertexArray.length;if(void 0!==t.segment)for(const{x:t,y:r}of e)this.lineVertexArray.emplaceBack(t,r);return {lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(t,e,r,n,i,s,a,o,l,u,c,h,p,f){const d=t.indexArray,y=t.layoutVertexArray,m=t.globeExtVertexArray,g=t.segments.prepareSegment(4*e.length,y,d,this.canOverlap?s.sortKey:void 0),x=this.glyphOffsetArray.length,v=g.vertexLength,b=this.allowVerticalPlacement&&a===Qh.vertical?Math.PI/2:0,w=s.text&&s.text.sections;for(let n=0;n=0?e.rightJustifiedTextSymbolIndex:e.centerJustifiedTextSymbolIndex>=0?e.centerJustifiedTextSymbolIndex:e.leftJustifiedTextSymbolIndex>=0?e.leftJustifiedTextSymbolIndex:e.verticalPlacedTextSymbolIndex>=0?e.verticalPlacedTextSymbolIndex:n),s=xh(this.textSizeData,t,i)/yh;return this.tilePixelRatio*s}getSymbolInstanceIconSize(t,e,r){const n=this.icon.placedSymbolArray.get(r),i=xh(this.iconSizeData,t,n);return this.tilePixelRatio*i}_commitDebugCollisionVertexUpdate(t,e,r){t.emplaceBack(e,-r,-r),t.emplaceBack(e,r,-r),t.emplaceBack(e,r,r),t.emplaceBack(e,-r,r);}_updateTextDebugCollisionBoxes(t,e,r,n,i,s){for(let a=n;a0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,e){const r=t.placedSymbolArray.get(e),n=r.vertexStartIndex+4*r.numGlyphs;for(let e=r.vertexStartIndex;en[t]-n[e]||i[e]-i[t])),s}addToSortKeyRanges(t,e){const r=this.sortKeyRanges[this.sortKeyRanges.length-1];r&&r.sortKey===e?r.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:e,symbolInstanceStart:t,symbolInstanceEnd:t+1});}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const t of this.symbolInstanceIndexes){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex);const{rightJustifiedTextSymbolIndex:r,centerJustifiedTextSymbolIndex:n,leftJustifiedTextSymbolIndex:i,verticalPlacedTextSymbolIndex:s,placedIconSymbolIndex:a,verticalPlacedIconSymbolIndex:o}=e;r>=0&&this.addIndicesForPlacedSymbol(this.text,r),n>=0&&n!==r&&this.addIndicesForPlacedSymbol(this.text,n),i>=0&&i!==n&&i!==r&&this.addIndicesForPlacedSymbol(this.text,i),s>=0&&this.addIndicesForPlacedSymbol(this.text,s),a>=0&&this.addIndicesForPlacedSymbol(this.icon,a),o>=0&&this.addIndicesForPlacedSymbol(this.icon,o);}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray);}}}Oi(cd,\"SymbolBucket\",{omit:[\"layers\",\"collisionBoxArray\",\"features\",\"compareText\"]}),cd.MAX_GLYPHS=65535,cd.addDynamicAttributes=ad;const hd=new Js({\"symbol-placement\":new Ys(Ht.layout_symbol[\"symbol-placement\"]),\"symbol-spacing\":new Ys(Ht.layout_symbol[\"symbol-spacing\"]),\"symbol-avoid-edges\":new Ys(Ht.layout_symbol[\"symbol-avoid-edges\"]),\"symbol-sort-key\":new Hs(Ht.layout_symbol[\"symbol-sort-key\"]),\"symbol-z-order\":new Ys(Ht.layout_symbol[\"symbol-z-order\"]),\"icon-allow-overlap\":new Ys(Ht.layout_symbol[\"icon-allow-overlap\"]),\"icon-ignore-placement\":new Ys(Ht.layout_symbol[\"icon-ignore-placement\"]),\"icon-optional\":new Ys(Ht.layout_symbol[\"icon-optional\"]),\"icon-rotation-alignment\":new Ys(Ht.layout_symbol[\"icon-rotation-alignment\"]),\"icon-size\":new Hs(Ht.layout_symbol[\"icon-size\"]),\"icon-text-fit\":new Ys(Ht.layout_symbol[\"icon-text-fit\"]),\"icon-text-fit-padding\":new Ys(Ht.layout_symbol[\"icon-text-fit-padding\"]),\"icon-image\":new Hs(Ht.layout_symbol[\"icon-image\"]),\"icon-rotate\":new Hs(Ht.layout_symbol[\"icon-rotate\"]),\"icon-padding\":new Ys(Ht.layout_symbol[\"icon-padding\"]),\"icon-keep-upright\":new Ys(Ht.layout_symbol[\"icon-keep-upright\"]),\"icon-offset\":new Hs(Ht.layout_symbol[\"icon-offset\"]),\"icon-anchor\":new Hs(Ht.layout_symbol[\"icon-anchor\"]),\"icon-pitch-alignment\":new Ys(Ht.layout_symbol[\"icon-pitch-alignment\"]),\"text-pitch-alignment\":new Ys(Ht.layout_symbol[\"text-pitch-alignment\"]),\"text-rotation-alignment\":new Ys(Ht.layout_symbol[\"text-rotation-alignment\"]),\"text-field\":new Hs(Ht.layout_symbol[\"text-field\"]),\"text-font\":new Hs(Ht.layout_symbol[\"text-font\"]),\"text-size\":new Hs(Ht.layout_symbol[\"text-size\"]),\"text-max-width\":new Hs(Ht.layout_symbol[\"text-max-width\"]),\"text-line-height\":new Hs(Ht.layout_symbol[\"text-line-height\"]),\"text-letter-spacing\":new Hs(Ht.layout_symbol[\"text-letter-spacing\"]),\"text-justify\":new Hs(Ht.layout_symbol[\"text-justify\"]),\"text-radial-offset\":new Hs(Ht.layout_symbol[\"text-radial-offset\"]),\"text-variable-anchor\":new Ys(Ht.layout_symbol[\"text-variable-anchor\"]),\"text-anchor\":new Hs(Ht.layout_symbol[\"text-anchor\"]),\"text-max-angle\":new Ys(Ht.layout_symbol[\"text-max-angle\"]),\"text-writing-mode\":new Ys(Ht.layout_symbol[\"text-writing-mode\"]),\"text-rotate\":new Hs(Ht.layout_symbol[\"text-rotate\"]),\"text-padding\":new Ys(Ht.layout_symbol[\"text-padding\"]),\"text-keep-upright\":new Ys(Ht.layout_symbol[\"text-keep-upright\"]),\"text-transform\":new Hs(Ht.layout_symbol[\"text-transform\"]),\"text-offset\":new Hs(Ht.layout_symbol[\"text-offset\"]),\"text-allow-overlap\":new Ys(Ht.layout_symbol[\"text-allow-overlap\"]),\"text-ignore-placement\":new Ys(Ht.layout_symbol[\"text-ignore-placement\"]),\"text-optional\":new Ys(Ht.layout_symbol[\"text-optional\"])});var pd={paint:new Js({\"icon-opacity\":new Hs(Ht.paint_symbol[\"icon-opacity\"]),\"icon-color\":new Hs(Ht.paint_symbol[\"icon-color\"]),\"icon-halo-color\":new Hs(Ht.paint_symbol[\"icon-halo-color\"]),\"icon-halo-width\":new Hs(Ht.paint_symbol[\"icon-halo-width\"]),\"icon-halo-blur\":new Hs(Ht.paint_symbol[\"icon-halo-blur\"]),\"icon-translate\":new Ys(Ht.paint_symbol[\"icon-translate\"]),\"icon-translate-anchor\":new Ys(Ht.paint_symbol[\"icon-translate-anchor\"]),\"text-opacity\":new Hs(Ht.paint_symbol[\"text-opacity\"]),\"text-color\":new Hs(Ht.paint_symbol[\"text-color\"],{runtimeType:le,getOverride:t=>t.textColor,hasOverride:t=>!!t.textColor}),\"text-halo-color\":new Hs(Ht.paint_symbol[\"text-halo-color\"]),\"text-halo-width\":new Hs(Ht.paint_symbol[\"text-halo-width\"]),\"text-halo-blur\":new Hs(Ht.paint_symbol[\"text-halo-blur\"]),\"text-translate\":new Ys(Ht.paint_symbol[\"text-translate\"]),\"text-translate-anchor\":new Ys(Ht.paint_symbol[\"text-translate-anchor\"])}),layout:hd};class fd{constructor(t){this.type=t.property.overrides?t.property.overrides.runtimeType:ie,this.defaultValue=t;}evaluate(t){if(t.formattedSection){const e=this.defaultValue.property.overrides;if(e&&e.hasOverride(t.formattedSection))return e.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression);}outputDefined(){return !1}serialize(){return null}}Oi(fd,\"FormatSectionOverride\",{omit:[\"defaultValue\"]});class dd extends bo{constructor(t){super(t,pd);}recalculate(t,e){super.recalculate(t,e),\"auto\"===this.layout.get(\"icon-rotation-alignment\")&&(this.layout._values[\"icon-rotation-alignment\"]=\"point\"!==this.layout.get(\"symbol-placement\")?\"map\":\"viewport\"),\"auto\"===this.layout.get(\"text-rotation-alignment\")&&(this.layout._values[\"text-rotation-alignment\"]=\"point\"!==this.layout.get(\"symbol-placement\")?\"map\":\"viewport\"),\"auto\"===this.layout.get(\"text-pitch-alignment\")&&(this.layout._values[\"text-pitch-alignment\"]=this.layout.get(\"text-rotation-alignment\")),\"auto\"===this.layout.get(\"icon-pitch-alignment\")&&(this.layout._values[\"icon-pitch-alignment\"]=this.layout.get(\"icon-rotation-alignment\"));const r=this.layout.get(\"text-writing-mode\");if(r){const t=[];for(const e of r)t.indexOf(e)<0&&t.push(e);this.layout._values[\"text-writing-mode\"]=t;}else this.layout._values[\"text-writing-mode\"]=\"point\"===this.layout.get(\"symbol-placement\")?[\"horizontal\"]:[\"horizontal\",\"vertical\"];this._setPaintOverrides();}getValueAndResolveTokens(t,e,r,n){const i=this.layout.get(t).evaluate(e,{},r,n),s=this._unevaluatedLayout._values[t];return s.isDataDriven()||Nn(s.value)||!i?i:function(t,e){return e.replace(/{([^{}]+)}/g,((e,r)=>r in t?String(t[r]):\"\"))}(e.properties,i)}createBucket(t){return new cd(t)}queryRadius(){return 0}queryIntersectsFeature(){return !1}_setPaintOverrides(){for(const t of pd.paint.overridableProperties){if(!dd.hasPaintOverride(this.layout,t))continue;const e=this.paint.get(t),r=new fd(e),n=new qn(r,e.property.specification);let i=null;i=\"constant\"===e.value.kind||\"source\"===e.value.kind?new Xn(\"source\",n):new Zn(\"composite\",n,e.value.zoomStops,e.value._interpolationType),this.paint._values[t]=new Zs(e.property,i,e.parameters);}}_handleOverridablePaintPropertyUpdate(t,e,r){return !(!this.layout||e.isDataDriven()||r.isDataDriven())&&dd.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,e){const r=t.get(\"text-field\"),n=pd.paint.properties[e];let i=!1;const s=t=>{for(const e of t)if(n.overrides&&n.overrides.hasOverride(e))return void(i=!0)};if(\"constant\"===r.value.kind&&r.value.value instanceof Be)s(r.value.value.sections);else if(\"source\"===r.value.kind){const t=e=>{i||(e instanceof Fe&&De(e.value)===pe?s(e.value.sections):e instanceof Oe?s(e.sections):e.eachChild(t));},e=r.value;e._styleExpression&&t(e._styleExpression.expression);}return i}getProgramConfiguration(t){return new ho(this,t)}}var yd={paint:new Js({\"background-color\":new Ys(Ht.paint_background[\"background-color\"]),\"background-pattern\":new Ys(Ht.paint_background[\"background-pattern\"]),\"background-opacity\":new Ys(Ht.paint_background[\"background-opacity\"])})},md={paint:new Js({\"raster-opacity\":new Ys(Ht.paint_raster[\"raster-opacity\"]),\"raster-hue-rotate\":new Ys(Ht.paint_raster[\"raster-hue-rotate\"]),\"raster-brightness-min\":new Ys(Ht.paint_raster[\"raster-brightness-min\"]),\"raster-brightness-max\":new Ys(Ht.paint_raster[\"raster-brightness-max\"]),\"raster-saturation\":new Ys(Ht.paint_raster[\"raster-saturation\"]),\"raster-contrast\":new Ys(Ht.paint_raster[\"raster-contrast\"]),\"raster-resampling\":new Ys(Ht.paint_raster[\"raster-resampling\"]),\"raster-fade-duration\":new Ys(Ht.paint_raster[\"raster-fade-duration\"])})};class gd extends bo{constructor(t){super(t,{}),this.implementation=t;}is3D(){return \"3d\"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}recalculate(){}updateTransitions(){}hasTransition(){return !1}serialize(){}onAdd(t){this.implementation.onAdd&&this.implementation.onAdd(t,t.painter.context.gl);}onRemove(t){this.implementation.onRemove&&this.implementation.onRemove(t,t.painter.context.gl);}}var xd={paint:new Js({\"sky-type\":new Ys(Ht.paint_sky[\"sky-type\"]),\"sky-atmosphere-sun\":new Ys(Ht.paint_sky[\"sky-atmosphere-sun\"]),\"sky-atmosphere-sun-intensity\":new Ys(Ht.paint_sky[\"sky-atmosphere-sun-intensity\"]),\"sky-gradient-center\":new Ys(Ht.paint_sky[\"sky-gradient-center\"]),\"sky-gradient-radius\":new Ys(Ht.paint_sky[\"sky-gradient-radius\"]),\"sky-gradient\":new Ws(Ht.paint_sky[\"sky-gradient\"]),\"sky-atmosphere-halo-color\":new Ys(Ht.paint_sky[\"sky-atmosphere-halo-color\"]),\"sky-atmosphere-color\":new Ys(Ht.paint_sky[\"sky-atmosphere-color\"]),\"sky-opacity\":new Ys(Ht.paint_sky[\"sky-opacity\"])})};function vd(t,e,r){const n=[0,0,1],i=Ql([]);return eu(i,i,r?-x(t)+Math.PI:x(t)),tu(i,i,-x(e)),Nl(n,n,i),Ul(n,n)}const bd={circle:class extends bo{constructor(t){super(t,dl);}createBucket(t){return new Ho(t)}queryRadius(t){const e=t;return ul(\"circle-radius\",this,e)+ul(\"circle-stroke-width\",this,e)+cl(this.paint.get(\"circle-translate\"))}queryIntersectsFeature(t,e,r,n,i,s,a,o){const l=pl(this.paint.get(\"circle-translate\"),this.paint.get(\"circle-translate-anchor\"),s.angle,t.pixelToTileUnitsFactor),u=this.paint.get(\"circle-radius\").evaluate(e,r)+this.paint.get(\"circle-stroke-width\").evaluate(e,r);return ou(t,n,s,a,o,\"map\"===this.paint.get(\"circle-pitch-alignment\"),\"map\"===this.paint.get(\"circle-pitch-scale\"),l,u)}getProgramIds(){return [\"circle\"]}getProgramConfiguration(t){return new ho(this,t)}},heatmap:class extends bo{createBucket(t){return new pu(t)}constructor(t){super(t,xu),this._updateColorRamp();}_handleSpecialPaintPropertyUpdate(t){\"heatmap-color\"===t&&this._updateColorRamp();}_updateColorRamp(){this.colorRamp=vu({expression:this._transitionablePaint._values[\"heatmap-color\"].value.expression,evaluationKey:\"heatmapDensity\",image:this.colorRamp}),this.colorRampTexture=null;}resize(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null);}queryRadius(t){return ul(\"heatmap-radius\",this,t)}queryIntersectsFeature(t,e,r,n,i,s,a,o){const l=this.paint.get(\"heatmap-radius\").evaluate(e,r);return ou(t,n,s,a,o,!0,!0,new d(0,0),l)}hasOffscreenPass(){return 0!==this.paint.get(\"heatmap-opacity\")&&\"none\"!==this.visibility}getProgramIds(){return [\"heatmap\",\"heatmapTexture\"]}getProgramConfiguration(t){return new ho(this,t)}},hillshade:class extends bo{constructor(t){super(t,bu);}hasOffscreenPass(){return 0!==this.paint.get(\"hillshade-exaggeration\")&&\"none\"!==this.visibility}getProgramIds(){return [\"hillshade\",\"hillshadePrepare\"]}},fill:class extends bo{constructor(t){super(t,ac);}getProgramIds(){const t=this.paint.get(\"fill-pattern\"),e=t&&t.constantOr(1),r=[e?\"fillPattern\":\"fill\"];return this.paint.get(\"fill-antialias\")&&r.push(e&&!this.getPaintProperty(\"fill-outline-color\")?\"fillOutlinePattern\":\"fillOutline\"),r}getProgramConfiguration(t){return new ho(this,t)}recalculate(t,e){super.recalculate(t,e);const r=this.paint._values[\"fill-outline-color\"];\"constant\"===r.value.kind&&void 0===r.value.value&&(this.paint._values[\"fill-outline-color\"]=this.paint._values[\"fill-color\"]);}createBucket(t){return new ic(t)}queryRadius(){return cl(this.paint.get(\"fill-translate\"))}queryIntersectsFeature(t,e,r,n,i,s){return !t.queryGeometry.isAboveHorizon&&Qo(hl(t.tilespaceGeometry,this.paint.get(\"fill-translate\"),this.paint.get(\"fill-translate-anchor\"),s.angle,t.pixelToTileUnitsFactor),n)}isTileClipped(){return !0}},\"fill-extrusion\":class extends bo{constructor(t){super(t,$c);}createBucket(t){return new Ec(t)}queryRadius(){return cl(this.paint.get(\"fill-extrusion-translate\"))}is3D(){return !0}getProgramIds(){return [this.paint.get(\"fill-extrusion-pattern\").constantOr(1)?\"fillExtrusionPattern\":\"fillExtrusion\"]}getProgramConfiguration(t){return new ho(this,t)}queryIntersectsFeature(t,e,r,n,i,s,a,o,l){const u=pl(this.paint.get(\"fill-extrusion-translate\"),this.paint.get(\"fill-extrusion-translate-anchor\"),s.angle,t.pixelToTileUnitsFactor),c=this.paint.get(\"fill-extrusion-height\").evaluate(e,r),h=this.paint.get(\"fill-extrusion-base\").evaluate(e,r),p=[0,0],f=o&&s.elevation,y=s.elevation?s.elevation.exaggeration():1,m=t.tile.getBucket(this);if(f&&m instanceof Ec){const t=m.centroidVertexArray,e=l+1;et.polygon)).flat());const g=f?o:null,[x,v]=function(t,e,r,n,i,s,a,o,l,u,c){return \"globe\"===t.projection.name?function(t,e,r,n,i,s,a,o,l,u,c){const h=[],p=[],f=t.projection.upVectorScale(c,t.center.lat,t.worldSize).metersToTile,d=[0,0,0,1],y=[0,0,0,1],m=(t,e,r,n)=>{t[0]=e,t[1]=r,t[2]=n,t[3]=1;},g=Rc();r>0&&(r+=g),n+=g;for(const g of e){const e=[],x=[];for(const h of g){const p=h.x+i.x,g=h.y+i.y,v=t.projection.projectTilePoint(p,g,c),b=t.projection.upVector(c,h.x,h.y);let w=r,_=n;if(a){const t=Hc(p,g,r,n,a,o,l,u);w+=t.base,_+=t.top;}0!==r?m(d,v.x+b[0]*f*w,v.y+b[1]*f*w,v.z+b[2]*f*w):m(d,v.x,v.y,v.z),m(y,v.x+b[0]*f*_,v.y+b[1]*f*_,v.z+b[2]*f*_),ql(d,d,s),ql(y,y,s),e.push(new Zc(d[0],d[1],d[2])),x.push(new Zc(y[0],y[1],y[2]));}h.push(e),p.push(x);}return [h,p]}(t,e,r,n,i,s,a,o,l,u,c):a?function(t,e,r,n,i,s,a,o,l){const u=[],c=[],h=[0,0,0,1];for(const p of t){const t=[],f=[];for(const u of p){const c=u.x+n.x,p=u.y+n.y,d=Hc(c,p,e,r,s,a,o,l);h[0]=c,h[1]=p,h[2]=d.base,h[3]=1,Wl(h,h,i),h[3]=Math.max(h[3],1e-5);const y=new Zc(h[0]/h[3],h[1]/h[3],h[2]/h[3]);h[0]=c,h[1]=p,h[2]=d.top,h[3]=1,Wl(h,h,i),h[3]=Math.max(h[3],1e-5);const m=new Zc(h[0]/h[3],h[1]/h[3],h[2]/h[3]);t.push(y),f.push(m);}u.push(t),c.push(f);}return [u,c]}(e,r,n,i,s,a,o,l,u):function(t,e,r,n,i){const s=[],a=[],o=i[8]*e,l=i[9]*e,u=i[10]*e,c=i[11]*e,h=i[8]*r,p=i[9]*r,f=i[10]*r,d=i[11]*r;for(const e of t){const t=[],r=[];for(const s of e){const e=s.x+n.x,a=s.y+n.y,y=i[0]*e+i[4]*a+i[12],m=i[1]*e+i[5]*a+i[13],g=i[2]*e+i[6]*a+i[14],x=i[3]*e+i[7]*a+i[15],v=y+o,b=m+l,w=g+u,_=Math.max(x+c,1e-5),A=y+h,S=m+p,k=g+f,I=Math.max(x+d,1e-5);t.push(new Zc(v/_,b/_,w/_)),r.push(new Zc(A/I,S/I,k/I));}s.push(t),a.push(r);}return [s,a]}(e,r,n,i,s)}(s,n,h,c,u,a,g,p,y,s.center.lat,t.tileID.canonical),b=t.queryGeometry;return function(t,e,r){let n=1/0;Qo(r,e)&&(n=Yc(r,e[0]));for(let i=0;i=3)for(let e=0;e{this._triggered=!1,this._callback();});}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout((()=>{this._triggered=!1,this._callback();}),0));}remove(){this._channel=void 0,this._callback=()=>{};}}class Ad{constructor(){this.tasks={},this.taskQueue=[],V([\"process\"],this),this.invoker=new _d(this.process),this.nextId=0;}add(t,e){const r=this.nextId++,n=function({type:t,isSymbolTile:e,zoom:r}){return r=r||0,\"message\"===t?0:\"maybePrepare\"!==t||e?\"parseTile\"!==t||e?\"parseTile\"===t&&e?300-r:\"maybePrepare\"===t&&e?400-r:500:200-r:100-r}(e);if(0===n){N();try{t();}finally{}return {cancel:()=>{}}}return this.tasks[r]={fn:t,metadata:e,priority:n,id:r},this.taskQueue.push(r),this.invoker.trigger(),{cancel:()=>{delete this.tasks[r];}}}process(){N();try{if(this.taskQueue=this.taskQueue.filter((t=>!!this.tasks[t])),!this.taskQueue.length)return;const t=this.pick();if(null===t)return;const e=this.tasks[t];if(delete this.tasks[t],this.taskQueue.length&&this.invoker.trigger(),!e)return;e.fn();}finally{}}pick(){let t=null,e=1/0;for(let r=0;r>=1)>1;){const t=r+i>>1,l=n+s>>1;1&e?(i=r,s=n,r=a,n=o):(r=i,n=s,i=a,s=o),a=t,o=l;}const l=4*t;zd[l+0]=r,zd[l+1]=n,zd[l+2]=i,zd[l+3]=s;}const Bd=new Uint16Array(2178),Ed=new Uint8Array(1089),Cd=new Uint16Array(1089);function Pd(t){return 0===t?-.03125:32===t?.03125:0}var Dd=na([{name:\"a_pos\",type:\"Int16\",components:2},{name:\"a_texture_pos\",type:\"Int16\",components:2}]);const Vd={type:2,extent:So,loadGeometry:()=>[[new d(0,0),new d(8193,0),new d(8193,8193),new d(0,8193),new d(0,0)]]};class Ld{constructor(t,e,r,n,i){this.tileID=t,this.uid=E(),this.uses=0,this.tileSize=e,this.tileZoom=r,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=i,this.expiredRequestCount=0,this.state=\"loading\",n&&n.transform&&(this.projection=n.transform.projection);}registerFadeDuration(t){const e=t+this.timeAdded;ee.getLayer(t))).filter(Boolean);if(0!==t.length){n.layers=t,n.stateDependentLayerIds&&(n.stateDependentLayers=n.stateDependentLayerIds.map((e=>t.filter((t=>t.id===e))[0])));for(const e of t)r[e.id]=n;}}return r}(t.buckets,e.style),this.hasSymbolBuckets=!1;for(const t in this.buckets){const e=this.buckets[t];if(e instanceof cd){if(this.hasSymbolBuckets=!0,!r)break;e.justReloaded=!0;}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const t in this.buckets){const e=this.buckets[t];if(e instanceof cd&&e.hasRTLText){this.hasRTLText=!0,js.isLoading()||js.isLoaded()||\"deferred\"!==Fs()||Rs();break}}this.queryPadding=0;for(const t in this.buckets){const r=this.buckets[t];this.queryPadding=Math.max(this.queryPadding,e.style.getLayer(t).queryRadius(r));}t.imageAtlas&&(this.imageAtlas=t.imageAtlas),t.glyphAtlasImage&&(this.glyphAtlasImage=t.glyphAtlasImage),t.lineAtlas&&(this.lineAtlas=t.lineAtlas);}else this.collisionBoxArray=new Ea;}unloadVectorData(){if(this.hasData()){for(const t in this.buckets)this.buckets[t].destroy();this.buckets={},this.imageAtlas&&(this.imageAtlas=null),this.lineAtlas&&(this.lineAtlas=null),this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.lineAtlasTexture&&this.lineAtlasTexture.destroy(),this._tileBoundsBuffer&&(this._tileBoundsBuffer.destroy(),this._tileBoundsIndexBuffer.destroy(),this._tileBoundsSegments.destroy(),this._tileBoundsBuffer=null),this._tileDebugBuffer&&(this._tileDebugBuffer.destroy(),this._tileDebugSegments.destroy(),this._tileDebugBuffer=null),this._tileDebugIndexBuffer&&(this._tileDebugIndexBuffer.destroy(),this._tileDebugIndexBuffer=null),this._globeTileDebugBorderBuffer&&(this._globeTileDebugBorderBuffer.destroy(),this._globeTileDebugBorderBuffer=null),this._tileDebugTextBuffer&&(this._tileDebugTextBuffer.destroy(),this._tileDebugTextSegments.destroy(),this._tileDebugTextIndexBuffer.destroy(),this._tileDebugTextBuffer=null),this._globeTileDebugTextBuffer&&(this._globeTileDebugTextBuffer.destroy(),this._globeTileDebugTextBuffer=null),this.latestFeatureIndex=null,this.state=\"unloaded\";}}getBucket(t){return this.buckets[t.id]}upload(t){for(const e in this.buckets){const r=this.buckets[e];r.uploadPending()&&r.upload(t);}const e=t.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new wd(t,this.imageAtlas.image,e.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new wd(t,this.glyphAtlasImage,e.ALPHA),this.glyphAtlasImage=null),this.lineAtlas&&!this.lineAtlas.uploaded&&(this.lineAtlasTexture=new wd(t,this.lineAtlas.image,e.ALPHA),this.lineAtlas.uploaded=!0);}prepare(t){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(t,this.imageAtlasTexture);}queryRenderedFeatures(t,e,r,n,i,s,a,o){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({tileResult:n,pixelPosMatrix:a,transform:s,params:i,tileTransform:this.tileTransform},t,e,r):{}}querySourceFeatures(t,e){const r=this.latestFeatureIndex;if(!r||!r.rawTileData)return;const n=r.loadVTLayers(),i=e?e.sourceLayer:\"\",s=n._geojsonTileLayer||n[i];if(!s)return;const a=ai(e&&e.filter),{z:o,x:l,y:u}=this.tileID.canonical,c={z:o,x:l,y:u};for(let e=0;et)r=!1;else if(e)if(this.expirationTime=0;t--){const e=4*t,r=zd[e+0],n=zd[e+1],i=zd[e+2],s=zd[e+3],a=r+i>>1,o=n+s>>1,l=a+o-n,u=o+r-a,c=n*Td+r,h=s*Td+i,p=o*Td+a,f=Math.hypot((Bd[2*c+0]+Bd[2*h+0])/2-Bd[2*p+0],(Bd[2*c+1]+Bd[2*h+1])/2-Bd[2*p+1])>=16;if(Ed[p]=Ed[p]||(f?1:0),t<1022){const t=(n+u>>1)*Td+(r+l>>1),e=(s+u>>1)*Td+(i+l>>1);Ed[p]=Ed[p]||Ed[t]||Ed[e];}}const i=new oa,s=new wa;let a=0;function o(t,e){const r=e*Td+t;return 0===Cd[r]&&(i.emplaceBack(Bd[2*r+0],Bd[2*r+1],t*So/Md,e*So/Md),Cd[r]=++a),Cd[r]-1}function l(t,e,r,n,i,a){const u=t+r>>1,c=e+n>>1;if(Math.abs(t-i)+Math.abs(e-a)>1&&Ed[c*Td+u])l(i,a,t,e,u,c),l(r,n,i,a,u,c);else {const l=o(t,e),u=o(r,n),c=o(i,a);s.emplaceBack(l,u,c);}}return l(0,0,Md,Md,Md,0),l(Md,Md,0,0,0,Md),{vertices:i,indices:s}}(this.tileID.canonical,e);n=t.vertices,i=t.indices;}else {n=new oa,i=new wa;for(const{x:t,y:e}of r)n.emplaceBack(t,e,0,0);const t=Au.exports(n.int16,void 0,4);for(let e=0;e0&&(a=bl(new Float64Array(16),e.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(t,n,e,i,a,s),this._makeGlobeTileDebugTextBuffer(t,n,e,i,a,s);}_globePoint(t,e,r,n,i,s,a){let o=wf(t,e,r);if(s){const i=1<.5?h=-1:c<-.5&&(h=1);let p=(t/So+r.x)/i+h,f=(e/So+r.y)/i;p=(p-l)*n._pixelsPerMercatorPixel+l,f=(f-u)*n._pixelsPerMercatorPixel+u;const d=[p*n.worldSize,f*n.worldSize,0];ql(d,d,s),o=ff(o,d,a);}return ql(o,o,i)}_makeGlobeTileDebugBorderBuffer(t,e,r,n,i,s){const a=new sa,o=new Ta,l=new aa,u=(t,u,c,h,p)=>{const f=(c-t)/(p-1),d=(h-u)/(p-1),y=a.length;for(let c=0;cu*t+e;for(let t=0;te[a])return null}else {const o=1/n[a];let l=(t[a]-r[a])*o,u=(e[a]-r[a])*o;if(l>u){const t=l;l=u,u=t;}if(l>i&&(i=l),us)return null}return i}function Ud(t,e,r,n,i,s,a,o,l,u,c){const h=n-t,p=i-e,f=s-r,d=a-t,y=o-e,m=l-r,g=c[1]*m-c[2]*y,x=c[2]*d-c[0]*m,v=c[0]*y-c[1]*d,b=h*g+p*x+f*v;if(Math.abs(b)<1e-15)return null;const w=1/b,_=u[0]-t,A=u[1]-e,S=u[2]-r,k=(_*g+A*x+S*v)*w;if(k<0||k>1)return null;const I=A*f-S*p,M=S*h-_*f,T=_*p-A*h,z=(c[0]*I+c[1]*M+c[2]*T)*w;return z<0||k+z>1?null:(d*I+y*M+m*T)*w}function $d(t,e,r){return (t-e)/(r-e)}function Od(t,e,r,n,i,s,a,o,l){const u=1<{const s=n?1:0,a=(t+1)*r-s,o=e*r,l=(e+1)*r-s;i[0]=t*r,i[1]=o,i[2]=a,i[3]=l;};let a=new Rd(n);const o=[];for(let e=0;e=1;n/=2){const t=r[r.length-1];a=new Rd(n);for(let e=0;e0;){const{idx:o,t:f,nodex:d,nodey:y,depth:m}=p.pop();if(this.leaves[o]){Od(d,y,m,t,e,r,n,c,h);const o=1<=t[2])return f}continue}let g=0;for(let p=0;p=l[u[r]]&&(u.splice(r,0,p),e=!0);e||(u[g]=p),g++;}}for(let t=0;t=this.dim+1||e<-1||e>=this.dim+1)throw new RangeError(\"out of range source coordinates for DEM data\");return (e+1)*this.stride+(t+1)}_unpackMapbox(t,e,r){return (256*t*256+256*e+r)/10-1e4}_unpackTerrarium(t,e,r){return 256*t+e+r/256-32768}static pack(t,e){const r=[0,0,0,0],n=Zd.getUnpackVector(e);let i=Math.floor((t+n[3])/n[2]);return r[2]=i%256,i=Math.floor(i/256),r[1]=i%256,i=Math.floor(i/256),r[0]=i,r}getPixels(){return new gu({width:this.stride,height:this.stride},this.pixels)}backfillBorder(t,e,r){if(this.dim!==t.dim)throw new Error(\"dem dimension mismatch\");let n=e*this.dim,i=e*this.dim+this.dim,s=r*this.dim,a=r*this.dim+this.dim;switch(e){case-1:n=i-1;break;case 1:i=n+1;}switch(r){case-1:s=a-1;break;case 1:a=s+1;}const o=-e*this.dim,l=-r*this.dim;for(let e=s;e{this.remove(t,i);}),r)),this.data[n].push(i),this.order.push(n),this.order.length>this.max){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t);}return this}has(t){return t.wrapped().key in this.data}getAndRemove(t){return this.has(t)?this._getAndRemoveByKey(t.wrapped().key):null}_getAndRemoveByKey(t){const e=this.data[t].shift();return e.timeout&&clearTimeout(e.timeout),0===this.data[t].length&&delete this.data[t],this.order.splice(this.order.indexOf(t),1),e.value}getByKey(t){const e=this.data[t];return e?e[0].value:null}get(t){return this.has(t)?this.data[t.wrapped().key][0].value:null}remove(t,e){if(!this.has(t))return this;const r=t.wrapped().key,n=void 0===e?0:this.data[r].indexOf(e),i=this.data[r][n];return this.data[r].splice(n,1),i.timeout&&clearTimeout(i.timeout),0===this.data[r].length&&delete this.data[r],this.onRemove(i.value),this.order.splice(this.order.indexOf(r),1),this}setMaxSize(t){for(this.max=t;this.order.length>this.max;){const t=this._getAndRemoveByKey(this.order[0]);t&&this.onRemove(t);}return this}filter(t){const e=[];for(const r in this.data)for(const n of this.data[r])t(n.value)||e.push(n);for(const t of e)this.remove(t.value.tileID,t);}}class Yd{constructor(t,e,r){this.func=t,this.mask=e,this.range=r;}}Yd.ReadOnly=!1,Yd.ReadWrite=!0,Yd.disabled=new Yd(519,Yd.ReadOnly,[0,1]);const Hd=7680;class Wd{constructor(t,e,r,n,i,s){this.test=t,this.ref=e,this.mask=r,this.fail=n,this.depthFail=i,this.pass=s;}}Wd.disabled=new Wd({func:519,mask:0},0,0,Hd,Hd,Hd);class Jd{constructor(t,e,r){this.blendFunction=t,this.blendColor=e,this.mask=r;}}Jd.Replace=[1,0],Jd.disabled=new Jd(Jd.Replace,Me.transparent,[!1,!1,!1,!1]),Jd.unblended=new Jd(Jd.Replace,Me.transparent,[!0,!0,!0,!0]),Jd.alphaBlended=new Jd([1,771],Me.transparent,[!0,!0,!0,!0]);const Qd=1029,ty=2305;class ey{constructor(t,e,r){this.enable=t,this.mode=e,this.frontFace=r;}}ey.disabled=new ey(!1,Qd,ty),ey.backCCW=new ey(!0,Qd,ty),ey.backCW=new ey(!0,Qd,2304),ey.frontCW=new ey(!0,1028,2304),ey.frontCCW=new ey(!0,1028,ty);class ry extends Yt{constructor(t,e,r){super(),this.id=t,this._onlySymbols=r,e.on(\"data\",(t=>{\"source\"===t.dataType&&\"metadata\"===t.sourceDataType&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&\"source\"===t.dataType&&\"content\"===t.sourceDataType&&(this.reload(),this.transform&&this.update(this.transform));})),e.on(\"error\",(()=>{this._sourceErrored=!0;})),this._source=e,this._tiles={},this._cache=new Kd(0,this._unloadTile.bind(this)),this._timers={},this._cacheTimers={},this._minTileCacheSize=e.minTileCacheSize,this._maxTileCacheSize=e.maxTileCacheSize,this._loadedParentTiles={},this._coveredTiles={},this._state=new Fd,this._isRaster=\"raster\"===this._source.type||\"raster-dem\"===this._source.type||\"custom\"===this._source.type&&\"raster\"===this._source._dataType;}onAdd(t){this.map=t,this._minTileCacheSize=void 0===this._minTileCacheSize&&t?t._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=void 0===this._maxTileCacheSize&&t?t._maxTileCacheSize:this._maxTileCacheSize;}loaded(){if(this._sourceErrored)return !0;if(!this._sourceLoaded)return !1;if(!this._source.loaded())return !1;for(const t in this._tiles){const e=this._tiles[t];if(\"loaded\"!==e.state&&\"errored\"!==e.state)return !1}return !0}getSource(){return this._source}pause(){this._paused=!0;}resume(){if(!this._paused)return;const t=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,t&&this.reload(),this.transform&&this.update(this.transform);}_loadTile(t,e){return t.isSymbolTile=this._onlySymbols,this._source.loadTile(t,e)}_unloadTile(t){if(this._source.unloadTile)return this._source.unloadTile(t,(()=>{}))}_abortTile(t){if(this._source.abortTile)return this._source.abortTile(t,(()=>{}))}serialize(){return this._source.serialize()}prepare(t){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const e in this._tiles){const r=this._tiles[e];r.upload(t),r.prepare(this.map.style.imageManager);}}getIds(){return T(this._tiles).map((t=>t.tileID)).sort(ny).map((t=>t.key))}getRenderableIds(t){const e=[];for(const r in this._tiles)this._isIdRenderable(+r,t)&&e.push(this._tiles[r]);return t?e.sort(((t,e)=>{const r=t.tileID,n=e.tileID,i=new d(r.canonical.x,r.canonical.y)._rotate(this.transform.angle),s=new d(n.canonical.x,n.canonical.y)._rotate(this.transform.angle);return r.overscaledZ-n.overscaledZ||s.y-i.y||s.x-i.x})).map((t=>t.tileID.key)):e.map((t=>t.tileID)).sort(ny).map((t=>t.key))}hasRenderableParent(t){const e=this.findLoadedParent(t,0);return !!e&&this._isIdRenderable(e.tileID.key)}_isIdRenderable(t,e){return this._tiles[t]&&this._tiles[t].hasData()&&!this._coveredTiles[t]&&(e||!this._tiles[t].holdingForFade())}reload(){if(this._paused)this._shouldReloadOnResume=!0;else {this._cache.reset();for(const t in this._tiles)\"errored\"!==this._tiles[t].state&&this._reloadTile(+t,\"reloading\");}}_reloadTile(t,e){const r=this._tiles[t];r&&(\"loading\"!==r.state&&(r.state=e),this._loadTile(r,this._tileLoaded.bind(this,r,t,e)));}_tileLoaded(t,e,r,n){if(n)if(t.state=\"errored\",404!==n.status)this._source.fire(new Kt(n,{tile:t}));else if(\"raster-dem\"===this._source.type&&this.usedForTerrain&&this.map.painter.terrain){const t=this.map.painter.terrain;this.update(this.transform,t.getScaledDemTileSize(),!0),t.resetTileLookupCache(this.id);}else this.update(this.transform);else t.timeAdded=Nt.now(),\"expired\"===r&&(t.refreshedUponExpiration=!0),this._setTileReloadTimer(e,t),\"raster-dem\"===this._source.type&&t.dem&&this._backfillDEM(t),this._state.initializeTileState(t,this.map?this.map.painter:null),this._source.fire(new Zt(\"data\",{dataType:\"source\",tile:t,coord:t.tileID,sourceCacheId:this.id}));}_backfillDEM(t){const e=this.getRenderableIds();for(let n=0;n1||(Math.abs(r)>1&&(1===Math.abs(r+i)?r+=i:1===Math.abs(r-i)&&(r-=i)),e.dem&&t.dem&&(t.dem.backfillBorder(e.dem,r,n),t.neighboringTiles&&t.neighboringTiles[s]&&(t.neighboringTiles[s].backfilled=!0)));}}getTile(t){return this.getTileByID(t.key)}getTileByID(t){return this._tiles[t]}_retainLoadedChildren(t,e,r,n){for(const i in this._tiles){let s=this._tiles[i];if(n[i]||!s.hasData()||s.tileID.overscaledZ<=e||s.tileID.overscaledZ>r)continue;let a=s.tileID;for(;s&&s.tileID.overscaledZ>e+1;){const t=s.tileID.scaledTo(s.tileID.overscaledZ-1);s=this._tiles[t.key],s&&s.hasData()&&(a=t);}let o=a;for(;o.overscaledZ>e;)if(o=o.scaledTo(o.overscaledZ-1),t[o.key]){n[a.key]=a;break}}}findLoadedParent(t,e){if(t.key in this._loadedParentTiles){const r=this._loadedParentTiles[t.key];return r&&r.tileID.overscaledZ>=e?r:null}for(let r=t.overscaledZ-1;r>=e;r--){const e=t.scaledTo(r),n=this._getLoadedTile(e);if(n)return n}}_getLoadedTile(t){const e=this._tiles[t.key];return e&&e.hasData()?e:this._cache.getByKey(this._source.reparseOverscaled?t.wrapped().key:t.canonical.key)}updateCacheSize(t,e){e=e||this._source.tileSize;const r=Math.ceil(t.width/e)+1,n=Math.ceil(t.height/e)+1,i=Math.floor(r*n*5),s=\"number\"==typeof this._minTileCacheSize?Math.max(this._minTileCacheSize,i):i,a=\"number\"==typeof this._maxTileCacheSize?Math.min(this._maxTileCacheSize,s):s;this._cache.setMaxSize(a);}handleWrapJump(t){const e=Math.round((t-(void 0===this._prevLng?t:this._prevLng))/360);if(this._prevLng=t,e){const t={};for(const r in this._tiles){const n=this._tiles[r];n.tileID=n.tileID.unwrapTo(n.tileID.wrap+e),t[n.tileID.key]=n;}this._tiles=t;for(const t in this._timers)clearTimeout(this._timers[t]),delete this._timers[t];for(const t in this._tiles)this._setTileReloadTimer(+t,this._tiles[t]);}}update(t,e,r){if(this.transform=t,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage)return;if(this.usedForTerrain&&!r)return;let n;this.updateCacheSize(t,e),\"globe\"!==this.transform.projection.name&&this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?n=t.getVisibleUnwrappedCoordinates(this._source.tileID).map((t=>new Gc(t.canonical.z,t.wrap,t.canonical.z,t.canonical.x,t.canonical.y))):(n=t.coveringTiles({tileSize:e||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!r,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain}),this._source.hasTile&&(n=n.filter((t=>this._source.hasTile(t))))):n=[];const i=this._updateRetainedTiles(n);if(iy(this._source.type)&&0!==n.length){const t={},e={},r=Object.keys(i);for(const n of r){const r=i[n],s=this._tiles[n];if(!s||s.fadeEndTime&&s.fadeEndTime<=Nt.now())continue;const a=this.findLoadedParent(r,Math.max(r.overscaledZ-ry.maxOverzooming,this._source.minzoom));a&&(this._addTile(a.tileID),t[a.tileID.key]=a.tileID),e[n]=r;}const s=n[n.length-1].overscaledZ;for(const t in this._tiles){const r=this._tiles[t];if(i[t]||!r.hasData())continue;let n=r.tileID;for(;n.overscaledZ>s;){n=n.scaledTo(n.overscaledZ-1);const s=this._tiles[n.key];if(s&&s.hasData()&&e[n.key]){i[t]=r.tileID;break}}}for(const e in t)i[e]||(this._coveredTiles[e]=!0,i[e]=t[e]);}for(const t in i)this._tiles[t].clearFadeHold();const s=function(t,e){const r=[];for(const n in t)n in e||r.push(n);return r}(this._tiles,i);for(const t of s){const e=this._tiles[t];e.hasSymbolBuckets&&!e.holdingForFade()?e.setHoldDuration(this.map._fadeDuration):e.hasSymbolBuckets&&!e.symbolFadeFinished()||this._removeTile(+t);}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate();}releaseSymbolFadeTiles(){for(const t in this._tiles)this._tiles[t].holdingForFade()&&this._removeTile(+t);}_updateRetainedTiles(t){const e={};if(0===t.length)return e;const r={},n=t.reduce(((t,e)=>Math.min(t,e.overscaledZ)),1/0),i=t[0].overscaledZ,s=Math.max(i-ry.maxOverzooming,this._source.minzoom),a=Math.max(i+ry.maxUnderzooming,this._source.minzoom),o={};for(const r of t){const t=this._addTile(r);e[r.key]=r,t.hasData()||n=this._source.maxzoom){const t=n.children(this._source.maxzoom)[0],r=this.getTile(t);if(r&&r.hasData()){e[t.key]=t;continue}}else {const t=n.children(this._source.maxzoom);if(e[t[0].key]&&e[t[1].key]&&e[t[2].key]&&e[t[3].key])continue}let i=t.wasRequested();for(let a=n.overscaledZ-1;a>=s;--a){const s=n.scaledTo(a);if(r[s.key])break;if(r[s.key]=!0,t=this.getTile(s),!t&&i&&(t=this._addTile(s)),t&&(e[s.key]=s,i=t.wasRequested(),t.hasData()))break}}return e}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const t in this._tiles){const e=[];let r,n=this._tiles[t].tileID;for(;n.overscaledZ>0;){if(n.key in this._loadedParentTiles){r=this._loadedParentTiles[n.key];break}e.push(n.key);const t=n.scaledTo(n.overscaledZ-1);if(r=this._getLoadedTile(t),r)break;n=t;}for(const t of e)this._loadedParentTiles[t]=r;}}_addTile(t){let e=this._tiles[t.key];if(e)return e;e=this._cache.getAndRemove(t),e&&(this._setTileReloadTimer(t.key,e),e.tileID=t,this._state.initializeTileState(e,this.map?this.map.painter:null),this._cacheTimers[t.key]&&(clearTimeout(this._cacheTimers[t.key]),delete this._cacheTimers[t.key],this._setTileReloadTimer(t.key,e)));const r=Boolean(e);if(!r){const r=this.map?this.map.painter:null;e=new Ld(t,this._source.tileSize*t.overscaleFactor(),this.transform.tileZoom,r,this._isRaster),this._loadTile(e,this._tileLoaded.bind(this,e,t.key,e.state));}return e?(e.uses++,this._tiles[t.key]=e,r||this._source.fire(new Zt(\"dataloading\",{tile:e,coord:e.tileID,dataType:\"source\"})),e):null}_setTileReloadTimer(t,e){t in this._timers&&(clearTimeout(this._timers[t]),delete this._timers[t]);const r=e.getExpiryTimeout();r&&(this._timers[t]=setTimeout((()=>{this._reloadTile(t,\"expired\"),delete this._timers[t];}),r));}_removeTile(t){const e=this._tiles[t];e&&(e.uses--,delete this._tiles[t],this._timers[t]&&(clearTimeout(this._timers[t]),delete this._timers[t]),e.uses>0||(e.hasData()&&\"reloading\"!==e.state?this._cache.add(e.tileID,e,e.getExpiryTimeout()):(e.aborted=!0,this._abortTile(e),this._unloadTile(e))));}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const t in this._tiles)this._removeTile(+t);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id);}tilesIn(t,e,r){const n=[],i=this.transform;if(!i)return n;const s=\"globe\"===i.projection.name,a=Bo(i.center.lng);for(const o in this._tiles){const l=this._tiles[o];if(r&&l.clearQueryDebugViz(),l.holdingForFade())continue;let u;if(s){const t=l.tileID.canonical;if(0===t.z){const e=[Math.abs(S(a,...sy(t,-1))-a),Math.abs(S(a,...sy(t,1))-a)];u=[0,2*e.indexOf(Math.min(...e))-1];}else {const e=[Math.abs(S(a,...sy(t,-1))-a),Math.abs(S(a,...sy(t,0))-a),Math.abs(S(a,...sy(t,1))-a)];u=[e.indexOf(Math.min(...e))-1];}}else u=[0];for(const r of u){const s=t.containsTile(l,i,e,r);s&&n.push(s);}}return n}getVisibleCoordinates(t){const e=this.getRenderableIds(t).map((t=>this._tiles[t].tileID));for(const t of e)t.projMatrix=this.transform.calculateProjMatrix(t.toUnwrapped());return e}hasTransition(){if(this._source.hasTransition())return !0;if(iy(this._source.type))for(const t in this._tiles){const e=this._tiles[t];if(void 0!==e.fadeEndTime&&e.fadeEndTime>=Nt.now())return !0}return !1}setFeatureState(t,e,r){this._state.updateState(t=t||\"_geojsonTileLayer\",e,r);}removeFeatureState(t,e,r){this._state.removeFeatureState(t=t||\"_geojsonTileLayer\",e,r);}getFeatureState(t,e){return this._state.getState(t=t||\"_geojsonTileLayer\",e)}setDependencies(t,e,r){const n=this._tiles[t];n&&n.setDependencies(e,r);}reloadTilesForDependencies(t,e){for(const r in this._tiles)this._tiles[r].hasDependency(t,e)&&this._reloadTile(+r,\"reloading\");this._cache.filter((r=>!r.hasDependency(t,e)));}_preloadTiles(t,e){const r=new Map,n=Array.isArray(t)?t:[t],i=this.map.painter.terrain,s=this.usedForTerrain&&i?i.getScaledDemTileSize():this._source.tileSize;for(const t of n){const e=t.coveringTiles({tileSize:s,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const t of e)r.set(t.key,t);this.usedForTerrain&&t.updateElevation(!1);}M(Array.from(r.values()),((t,e)=>{const r=new Ld(t,this._source.tileSize*t.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster);this._loadTile(r,(t=>{\"raster-dem\"===this._source.type&&r.dem&&this._backfillDEM(r),e(t,r);}));}),e);}}function ny(t,e){const r=Math.abs(2*t.wrap)-+(t.wrap<0),n=Math.abs(2*e.wrap)-+(e.wrap<0);return t.overscaledZ-e.overscaledZ||n-r||e.canonical.y-t.canonical.y||e.canonical.x-t.canonical.x}function iy(t){return \"raster\"===t||\"image\"===t||\"video\"===t||\"custom\"===t}function sy(t,e){const r=1<=0&&n[3]>=0&&o.insert(a,n[0],n[1],n[2],n[3]);}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Ac(new kh(this.rawTileData)).layers,this.sourceLayerCoder=new Sd(this.vtLayers?Object.keys(this.vtLayers).sort():[\"_geojsonTileLayer\"]),this.vtFeatures={};for(const t in this.vtLayers)this.vtFeatures[t]=[];}return this.vtLayers}query(t,e,r,n){this.loadVTLayers();const i=t.params||{},s=ai(i.filter),a=t.tileResult,o=t.transform,l=a.bufferedTilespaceBounds,u=this.grid.query(l.min.x,l.min.y,l.max.x,l.max.y,((t,e,r,n)=>ol(a.bufferedTilespaceGeometry,t,e,r,n)));u.sort(uy);let c=null;o.elevation&&u.length>0&&(c=ay.create(o.elevation,this.tileID));const h={};let p;for(let o=0;o(d||(d=Xo(e,this.tileID.canonical,t.tileTransform)),r.queryIntersectsFeature(a,e,n,d,this.z,t.transform,t.pixelPosMatrix,c,i))));}return h}loadMatchingFeature(t,e,r,n,i,s,a,o,l){const{featureIndex:u,bucketIndex:c,sourceLayerIndex:h,layoutVertexArrayOffset:p}=e,f=this.bucketLayerIDs[c];if(n&&!function(t,e){for(let r=0;r=0)return !0;return !1}(n,f))return;const d=this.sourceLayerCoder.decode(h),y=this.vtLayers[d].feature(u);if(r.needGeometry){const t=Zo(y,!0);if(!r.filter(new Us(this.tileID.overscaledZ),t,this.tileID.canonical))return}else if(!r.filter(new Us(this.tileID.overscaledZ),y))return;const m=this.getId(y,d);for(let e=0;e{const a=e instanceof Ks?e.get(s):null;return a&&a.evaluate?a.evaluate(r,n,i):a}))}function uy(t,e){return e-t}Oi(oy,\"FeatureIndex\",{omit:[\"rawTileData\",\"sourceLayerCoder\"]});class cy{constructor(t,e){this.width=t,this.height=e,this.nextRow=0,this.image=new mu({width:t,height:e}),this.positions={},this.uploaded=!1;}getDash(t,e){const r=this.getKey(t,e);return this.positions[r]}trim(){const t=this.width,e=this.height=P(this.nextRow);this.image.resize({width:t,height:e});}getKey(t,e){return t.join(\",\")+e}getDashRanges(t,e,r){const n=[];let i=t.length%2==1?-t[t.length-1]*r:0,s=t[0]*r,a=!0;n.push({left:i,right:s,isDash:a,zeroLength:0===t[0]});let o=t[0];for(let e=1;e1&&(a=t[++s]);const l=Math.abs(o-a.left),u=Math.abs(o-a.right),c=Math.min(l,u);let h;const p=e/r*(n+1);if(a.isDash){const t=n-Math.abs(p);h=Math.sqrt(c*c+t*t);}else h=n-Math.sqrt(c*c+p*p);this.image.data[i+o]=Math.max(0,Math.min(255,h+128));}}}addRegularDash(t,e){for(let e=t.length-1;e>=0;--e){const r=t[e],n=t[e+1];r.zeroLength?t.splice(e,1):n&&n.isDash===r.isDash&&(n.left=r.left,t.splice(e,1));}const r=t[0],n=t[t.length-1];r.isDash===n.isDash&&(r.left=n.left-this.width,n.right=r.right+this.width);const i=this.width*this.nextRow;let s=0,a=t[s];for(let r=0;r1&&(a=t[++s]);const n=Math.abs(r-a.left),o=Math.abs(r-a.right),l=Math.min(n,o);this.image.data[i+r]=Math.max(0,Math.min(255,(a.isDash?l:-l)+e+128));}}addDash(t,e){const r=this.getKey(t,e);if(this.positions[r])return this.positions[r];const n=\"round\"===e,i=n?7:0,s=2*i+1;if(this.nextRow+s>this.height)return $(\"LineAtlas out of space\"),null;0===t.length&&t.push(1);let a=0;for(let e=0;e=e.maxzoom||\"none\"!==e.visibility&&(fy(t,this.zoom,r),(o[e.id]=e.createBucket({index:a.bucketLayerIDs.length,layers:t,zoom:this.zoom,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:h,sourceID:this.source,enableTerrain:this.enableTerrain,projection:this.projection.spec,availableImages:r})).populate(p,u,this.tileID.canonical,this.tileTransform),a.bucketLayerIDs.push(t.map((t=>t.id))));}}let h,p,f,d;l.trim();const y={type:\"maybePrepare\",isSymbolTile:this.isSymbolTile,zoom:this.zoom},m=F(u.glyphDependencies,(t=>Object.keys(t).map(Number)));Object.keys(m).length?n.send(\"getGlyphs\",{uid:this.uid,stacks:m},((t,e)=>{h||(h=t,p=e,v.call(this));}),void 0,!1,y):p={};const g=Object.keys(u.iconDependencies);g.length?n.send(\"getImages\",{icons:g,source:this.source,tileID:this.tileID,type:\"icons\"},((t,e)=>{h||(h=t,f=e,v.call(this));}),void 0,!1,y):f={};const x=Object.keys(u.patternDependencies);function v(){if(h)return i(h);if(p&&f&&d){const t=new hy(p),e=new Jh(f,d);for(const n in o){const i=o[n];i instanceof cd?(fy(i.layers,this.zoom,r),Op(i,p,t.positions,f,e.iconPositions,this.showCollisionBoxes,r,this.tileID.canonical,this.tileZoom,this.projection)):i.hasPattern&&(i instanceof nh||i instanceof ic||i instanceof Ec)&&(fy(i.layers,this.zoom,r),i.addFeatures(u,this.tileID.canonical,e.patternPositions,r,this.tileTransform));}this.status=\"done\",i(null,{buckets:T(o).filter((t=>!t.isEmpty())),featureIndex:a,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:t.image,lineAtlas:l,imageAtlas:e,glyphMap:this.returnDependencies?p:null,iconMap:this.returnDependencies?f:null,glyphPositions:this.returnDependencies?t.positions:null});}}x.length?n.send(\"getImages\",{icons:x,source:this.source,tileID:this.tileID,type:\"patterns\"},((t,e)=>{h||(h=t,d=e,v.call(this));}),void 0,!1,y):d={},v.call(this);}}function fy(t,e,r){const n=new Us(e);for(const e of t)e.recalculate(n,r);}class dy{constructor(t){this.entries={},this.scheduler=t;}request(t,e,r,n){const i=this.entries[t]=this.entries[t]||{callbacks:[]};if(i.result){const[t,r]=i.result;return this.scheduler?this.scheduler.add((()=>{n(t,r);}),e):n(t,r),()=>{}}return i.callbacks.push(n),i.cancel||(i.cancel=r(((r,n)=>{i.result=[r,n];for(const t of i.callbacks)this.scheduler?this.scheduler.add((()=>{t(r,n);}),e):t(r,n);setTimeout((()=>delete this.entries[t]),3e3);}))),()=>{i.result||(i.callbacks=i.callbacks.filter((t=>t!==n)),i.callbacks.length||(i.cancel(),delete this.entries[t]));}}}function yy(t,e,r){const n=JSON.stringify(t.request);return t.data&&(this.deduped.entries[n]={result:[null,t.data]}),this.deduped.request(n,{type:\"parseTile\",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom},(e=>{const n=ut(t.request,((t,n,i,s)=>{t?e(t):n&&e(null,{vectorTile:r?void 0:new Ac(new kh(n)),rawData:n,cacheControl:i,expires:s});}));return ()=>{n.cancel(),e();}}),e)}t.ARRAY_TYPE=ml,t.AUTH_ERR_MSG=yt,t.Aabb=au,t.Actor=class{constructor(t,r,n){this.target=t,this.parent=r,this.mapId=n,this.callbacks={},this.cancelCallbacks={},V([\"receive\"],this),this.target.addEventListener(\"message\",this.receive,!1),this.globalScope=N()?t:e,this.scheduler=new Ad;}send(t,e,r,n,i=!1,s){const a=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(r.metadata=s,this.callbacks[a]=r);const o=Z(this.globalScope)?void 0:[];return this.target.postMessage({id:a,type:t,hasCallback:!!r,targetMapId:n,mustQueue:i,sourceMapId:this.mapId,data:Gi(e,o)},o),{cancel:()=>{r&&delete this.callbacks[a],this.target.postMessage({id:a,type:\"\",targetMapId:n,sourceMapId:this.mapId});}}}receive(t){const e=t.data,r=e.id;if(r&&(!e.targetMapId||this.mapId===e.targetMapId))if(\"\"===e.type){const t=this.cancelCallbacks[r];delete this.cancelCallbacks[r],t&&t.cancel();}else if(e.mustQueue||N()){const t=this.callbacks[r];this.cancelCallbacks[r]=this.scheduler.add((()=>this.processTask(r,e)),t&&t.metadata||{type:\"message\"});}else this.processTask(r,e);}processTask(t,e){if(\"\"===e.type){const r=this.callbacks[t];delete this.callbacks[t],r&&(e.error?r(Xi(e.error)):r(null,Xi(e.data)));}else {const r=Z(this.globalScope)?void 0:[],n=e.hasCallback?(e,n)=>{delete this.cancelCallbacks[t],this.target.postMessage({id:t,type:\"\",sourceMapId:this.mapId,error:e?Gi(e):null,data:Gi(n,r)},r);}:t=>{},i=Xi(e.data);if(this.parent[e.type])this.parent[e.type](e.sourceMapId,i,n);else if(this.parent.getWorkerSource){const t=e.type.split(\".\");this.parent.getWorkerSource(e.sourceMapId,t[0],i.source)[t[1]](i,n);}else n(new Error(`Could not find function ${e.type}`));}}remove(){this.scheduler.remove(),this.target.removeEventListener(\"message\",this.receive,!1);}},t.CanonicalTileID=qc,t.Color=Me,t.ColorMode=Jd,t.CullFaceMode=ey,t.DEMData=Zd,t.DataConstantProperty=Ys,t.DedupedRequest=dy,t.DepthMode=Yd,t.EXTENT=So,t.Elevation=class{isDataAvailableAtPoint(t){const e=this._source();if(this.isUsingMockSource()||!e||t.y<0||t.y>1)return !1;const r=e.getSource().maxzoom,n=1<1)return e;const i=n.getSource().maxzoom,s=1<{const s=this.getAtTileOffset(t,i.x,i.y),a=n.upVector(t.canonical,i.x,i.y);return Rl(a,a,s*n.upVectorScale(t.canonical,e,r).metersToTile),a}}getForTilePoints(t,e,r,n){if(this.isUsingMockSource())return !1;const i=ay.create(this,t,n);return !!i&&(e.forEach((t=>{t[2]=this.exaggeration()*i.getElevationAt(t[0],t[1],r);})),!0)}getMinMaxForTile(t){if(this.isUsingMockSource())return null;const e=this.findDEMTileFor(t);if(!e||!e.dem)return null;const r=e.dem.tree,n=e.tileID,i=1<this._skuTokenExpiresAt}transformRequest(t,e){return this._transformRequestFn&&this._transformRequestFn(t,e)||{url:t}}normalizeStyleURL(t,e){if(!mt(t))return t;const r=_t(t);return r.path=`/styles/v1${r.path}`,this._makeAPIURL(r,this._customAccessToken||e)}normalizeGlyphsURL(t,e){if(!mt(t))return t;const r=_t(t);return r.path=`/fonts/v1${r.path}`,this._makeAPIURL(r,this._customAccessToken||e)}normalizeSourceURL(t,e,r,n){if(!mt(t))return t;const i=_t(t);return i.path=`/v4/${i.authority}.json`,i.params.push(\"secure\"),r&&i.params.push(`language=${r}`),n&&i.params.push(`worldview=${n}`),this._makeAPIURL(i,this._customAccessToken||e)}normalizeSpriteURL(t,e,r,n){const i=_t(t);return mt(t)?(i.path=`/styles/v1${i.path}/sprite${e}${r}`,this._makeAPIURL(i,this._customAccessToken||n)):(i.path+=`${e}${r}`,At(i))}normalizeTileURL(t,e,r){if(this._isSkuTokenExpired()&&this._createSkuToken(),t&&!mt(t))return t;const n=_t(t);n.path=n.path.replace(/(\\.(png|jpg)\\d*)(?=$)/,`${e||r&&\"raster\"!==n.authority&&512===r?\"@2x\":\"\"}${s.supported?\".webp\":\"$1\"}`),\"raster\"===n.authority?n.path=`/${i.RASTER_URL_PREFIX}${n.path}`:(n.path=n.path.replace(/^.+\\/v4\\//,\"/\"),n.path=`/${i.TILE_URL_VERSION}${n.path}`);const a=this._customAccessToken||function(t){for(const e of t){const t=e.match(/^access_token=(.*)$/);if(t)return t[1]}return null}(n.params)||i.ACCESS_TOKEN;return i.REQUIRE_ACCESS_TOKEN&&a&&this._skuToken&&n.params.push(`sku=${this._skuToken}`),this._makeAPIURL(n,a)}canonicalizeTileURL(t,e){const r=_t(t);if(!r.path.match(/^(\\/v4\\/|\\/raster\\/v1\\/)/)||!r.path.match(/\\.[\\w]+$/))return t;let n=\"mapbox://\";r.path.match(/^\\/raster\\/v1\\//)?n+=`raster/${r.path.replace(`/${i.RASTER_URL_PREFIX}/`,\"\")}`:n+=`tiles/${r.path.replace(`/${i.TILE_URL_VERSION}/`,\"\")}`;let s=r.params;return e&&(s=s.filter((t=>!t.match(/^access_token=/)))),s.length&&(n+=`?${s.join(\"&\")}`),n}canonicalizeTileset(t,e){const r=!!e&&mt(e),n=[];for(const e of t.tiles||[])gt(e)?n.push(this.canonicalizeTileURL(e,r)):n.push(e);return n}_makeAPIURL(t,e){const r=\"See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes\",n=_t(i.API_URL);if(t.protocol=n.protocol,t.authority=n.authority,\"http\"===t.protocol){const e=t.params.indexOf(\"secure\");e>=0&&t.params.splice(e,1);}if(\"/\"!==n.path&&(t.path=`${n.path}${t.path}`),!i.REQUIRE_ACCESS_TOKEN)return At(t);if(e=e||i.ACCESS_TOKEN,!this._silenceAuthErrors){if(!e)throw new Error(`An API access token is required to use Mapbox GL. ${r}`);if(\"s\"===e[0])throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${r}`)}return t.params=t.params.filter((t=>-1===t.indexOf(\"access_token\"))),t.params.push(`access_token=${e||\"\"}`),At(t)}},t.ResourceType=st,t.SegmentVector=Ao,t.SourceCache=ry,t.StencilMode=Wd,t.StructArrayLayout1ui2=Ta,t.StructArrayLayout2f1f2i16=xa,t.StructArrayLayout2i4=sa,t.StructArrayLayout2ui4=Ma,t.StructArrayLayout3f12=ba,t.StructArrayLayout3ui6=wa,t.StructArrayLayout4i8=oa,t.StructArrayLayout5f20=ka,t.Texture=wd,t.Tile=Ld,t.Transitionable=qs,t.Uniform1f=Qa,t.Uniform1i=class extends Ja{constructor(t){super(t),this.current=0;}set(t,e,r){this.fetchUniformLocation(t,e)&&this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r));}},t.Uniform2f=class extends Ja{constructor(t){super(t),this.current=[0,0];}set(t,e,r){this.fetchUniformLocation(t,e)&&(r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1])));}},t.Uniform3f=class extends Ja{constructor(t){super(t),this.current=[0,0,0];}set(t,e,r){this.fetchUniformLocation(t,e)&&(r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2])));}},t.Uniform4f=to,t.UniformColor=eo,t.UniformMatrix2f=class extends Ja{constructor(t){super(t),this.current=io;}set(t,e,r){if(this.fetchUniformLocation(t,e))for(let t=0;t<4;t++)if(r[t]!==this.current[t]){this.current=r,this.gl.uniformMatrix2fv(this.location,!1,r);break}}},t.UniformMatrix3f=class extends Ja{constructor(t){super(t),this.current=no;}set(t,e,r){if(this.fetchUniformLocation(t,e))for(let t=0;t<9;t++)if(r[t]!==this.current[t]){this.current=r,this.gl.uniformMatrix3fv(this.location,!1,r);break}}},t.UniformMatrix4f=class extends Ja{constructor(t){super(t),this.current=ro;}set(t,e,r){if(this.fetchUniformLocation(t,e)){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let t=1;t<16;t++)if(r[t]!==this.current[t]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}}},t.UnwrappedTileID=Nc,t.ValidationError=Wn,t.VectorTileFeature=Sc,t.VectorTileWorkerSource=class extends Yt{constructor(t,e,r,n,i){super(),this.actor=t,this.layerIndex=e,this.availableImages=r,this.loadVectorData=i||yy,this.loading={},this.loaded={},this.deduped=new dy(t.scheduler),this.isSpriteLoaded=n,this.scheduler=t.scheduler;}loadTile(t,e){const r=t.uid,n=t&&t.request,i=n&&n.collectResourceTiming,s=this.loading[r]=new py(t);s.abort=this.loadVectorData(t,((a,o)=>{const l=!this.loading[r];if(delete this.loading[r],l||a||!o)return s.status=\"done\",l||(this.loaded[r]=s),e(a);const u=o.rawData,c={};o.expires&&(c.expires=o.expires),o.cacheControl&&(c.cacheControl=o.cacheControl),s.vectorTile=o.vectorTile||new Ac(new kh(u));const h=()=>{s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,((t,r)=>{if(t||!r)return e(t);const s={};if(i){const t=jt(n);t.length>0&&(s.resourceTiming=JSON.parse(JSON.stringify(t)));}e(null,z({rawTileData:u.slice(0)},r,c,s));}));};this.isSpriteLoaded?h():this.once(\"isSpriteLoaded\",(()=>{this.scheduler?this.scheduler.add(h,{type:\"parseTile\",isSymbolTile:t.isSymbolTile,zoom:t.tileZoom}):h();})),this.loaded=this.loaded||{},this.loaded[r]=s;}));}reloadTile(t,e){const r=this.loaded,n=t.uid,i=this;if(r&&r[n]){const s=r[n];s.showCollisionBoxes=t.showCollisionBoxes,s.enableTerrain=!!t.enableTerrain,s.projection=t.projection,s.tileTransform=Df(t.tileID.canonical,t.projection);const a=(t,r)=>{const n=s.reloadCallback;n&&(delete s.reloadCallback,s.parse(s.vectorTile,i.layerIndex,this.availableImages,i.actor,n)),e(t,r);};\"parsing\"===s.status?s.reloadCallback=a:\"done\"===s.status&&(s.vectorTile?s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.actor,a):a());}}abortTile(t,e){const r=t.uid,n=this.loading[r];n&&(n.abort&&n.abort(),delete this.loading[r]),e();}removeTile(t,e){const r=this.loaded,n=t.uid;r&&r[n]&&delete r[n],e();}},t.WritingMode=Qh,t.add=Pl,t.addDynamicAttributes=ad,t.adjoint=function(t,e){var r=e[0],n=e[1],i=e[2],s=e[3],a=e[4],o=e[5],l=e[6],u=e[7],c=e[8];return t[0]=a*c-o*u,t[1]=i*u-n*c,t[2]=n*o-i*a,t[3]=o*l-s*c,t[4]=r*c-i*l,t[5]=i*s-r*o,t[6]=s*u-a*l,t[7]=n*l-r*u,t[8]=r*a-n*s,t},t.asyncAll=M,t.bezier=_,t.bindAll=V,t.boundsAttributes=Dd,t.bufferConvexPolygon=function(t,e){const r=[];for(let n=0;ntt&&(t.getActor().send(\"enforceCacheSizeLimit\",Q),it=0);},t.calculateGlobeLabelMatrix=function(t,e){const{x:r,y:n}=t.point,i=If(r,n,t.worldSize/t._pixelsPerMercatorPixel,0,0);return wl(i,i,kf(pf(e)))},t.calculateGlobeMatrix=function(t){const{x:e,y:r}=t.point,{lng:n,lat:i}=t._center;return If(e,r,t.worldSize,n,i)},t.calculateGlobeMercatorMatrix=function(t){const e=t.pixelsPerMeter,r=e/Co(1,t.center.lat),n=vl(new Float64Array(16));return _l(n,n,[t.point.x,t.point.y,0]),Al(n,n,[r,r,e]),Float32Array.from(n)},t.circumferenceAtLatitude=zo,t.clamp=S,t.clearTileCache=function(t){if(!et())return;const r=e.caches.delete(H);t&&r.catch(t).then((()=>t()));},t.clipLine=_p,t.clone=function(t){var e=new ml(16);return e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e},t.clone$1=j,t.collisionCircleLayout=dh,t.config=i,t.conjugate=function(t,e){return t[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=e[3],t},t.create=function(){var t=new ml(16);return ml!=Float32Array&&(t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0),t[0]=1,t[5]=1,t[10]=1,t[15]=1,t},t.create$1=gl,t.createExpression=Gn,t.createLayout=na,t.createStyleLayer=function(t){return \"custom\"===t.type?new gd(t):new bd[t.type](t)},t.cross=Ol,t.degToRad=x,t.distance=function(t,e){return Math.hypot(e[0]-t[0],e[1]-t[1],e[2]-t[2])},t.div=function(t,e,r){return t[0]=e[0]/r[0],t[1]=e[1]/r[1],t[2]=e[2]/r[2],t},t.dot=$l,t.earthRadius=Io,t.ease=A,t.easeCubicInOut=w,t.ecefToLatLng=function([t,e,r]){const n=Math.hypot(t,e,r),i=Math.atan2(t,r),s=.5*Math.PI-Math.acos(-e/n);return new Mo(v(i),v(s))},t.emitValidationErrors=Ri,t.endsWith=L,t.enforceCacheSizeLimit=function(t){rt(),W&&W.then((e=>{e.keys().then((r=>{for(let n=0;ns&&(n+=(t[i]-s)*(t[i]-s)),e[i]0){const t=180/n;xl(f,f,[t/u+1,0,0,0,t/c+1,0,-.5*t/h,.5*t/p,1]);}return f[2]=l,f[5]=t.x,f[8]=t.y,f},t.getImage=dt,t.getJSON=function(t,e){return lt(z(t,{type:\"json\"}),e)},t.getLatitudinalLod=function(t){const e=80.051129;t=S(t,-80.051129,e)/e*90;const r=Math.pow(Math.abs(Math.sin(x(t))),3);return Math.round(r*(sf.length-1))},t.getMapSessionAPI=Pt,t.getPerformanceMeasurement=jt,t.getProjection=ed,t.getRTLTextPluginStatus=Fs,t.getReferrer=ot,t.getTilePoint=function(t,{x:e,y:r},n=0){return new d(((e-n)*t.scale-t.x)*So,(r*t.scale-t.y)*So)},t.getTileVec3=function(t,e,r=0){return Cl(((e.x-r)*t.scale-t.x)*So,(e.y*t.scale-t.y)*So,Vo(e.z,e.y))},t.getVideo=function(t,r){const n=e.document.createElement(\"video\");n.muted=!0,n.onloadstart=function(){r(null,n);};for(let r=0;r{}}},t.globeCenterToScreenPoint=function(t){const e=[0,0,0],r=vl(new Float64Array(16));return wl(r,t.pixelMatrix,t.globeMatrix),ql(e,e,r),new d(e[0],e[1])},t.globeDenormalizeECEF=kf,t.globeECEFOrigin=function(t,e){const r=[0,0,0];return ql(r,r,Sf(pf(e.canonical))),ql(r,r,t),r},t.globeNormalizeECEF=Sf,t.globePixelsToTileUnits=function(t,e){return So/(512*Math.pow(2,t))*_f(pf(e))},t.globePoleMatrixForTile=function(t,e,r){const n=vl(new Float64Array(16)),i=(e/(1<0;return 0===n&&!i&&!a&&s},t.identity=vl,t.identity$1=Ql,t.invert=bl,t.isFullscreen=function(){return !!e.document.fullscreenElement||!!e.document.webkitFullscreenElement},t.isLngLatBehindGlobe=zf,t.isMapAuthenticated=function(t){return Dt.has(t)},t.isMapboxURL=mt,t.isSafariWithAntialiasingBug=function(t){const e=t.navigator?t.navigator.userAgent:null;return !!Z(t)&&e&&(e.match(\"Version/15.4\")||e.match(\"Version/15.5\")||e.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/))},t.latFromMercatorY=Do,t.latLngToECEF=bf,t.len=Kl,t.length=El,t.length$1=function(t){return Math.hypot(t[0],t[1],t[2],t[3])},t.lngFromMercatorX=Po,t.loadVectorTile=yy,t.makeRequest=lt,t.mapValue=function(t,e,r,n,i){return S((t-e)/(r-e)*(i-n)+n,n,i)},t.mercatorScale=Fo,t.mercatorXfromLng=Bo,t.mercatorYfromLat=Eo,t.mercatorZfromAltitude=Co,t.mul=Tl,t.mul$1=Zl,t.multiply=wl,t.multiply$1=xl,t.multiply$2=Vl,t.nextPowerOfTwo=P,t.normalize=Ul,t.normalize$1=ru,t.normalize$2=Hl,t.number=Mr,t.ortho=function(t,e,r,n,i,s,a){var o=1/(e-r),l=1/(n-i),u=1/(s-a);return t[0]=-2*o,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=-2*l,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=2*u,t[11]=0,t[12]=(e+r)*o,t[13]=(i+n)*l,t[14]=(a+s)*u,t[15]=1,t},t.pbf=kh,t.perspective=function(t,e,r,n,i){var s,a=1/Math.tan(e/2);return t[0]=a/r,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=a,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[11]=-1,t[12]=0,t[13]=0,t[15]=0,null!=i&&i!==1/0?(t[10]=(i+n)*(s=1/(n-i)),t[14]=2*i*n*s):(t[10]=-1,t[14]=-2*n),t},t.pick=function(t,e){const r={};for(let n=0;n0&&r[0]<=t.width&&r[1]>0&&r[1]<=t.height&&!zf(t,new Mo(t.center.lat,90)),n[0]>0&&n[0]<=t.width&&n[1]>0&&n[1]<=t.height&&!zf(t,new Mo(t.center.lat,-90))]},t.polygonContainsPoint=al,t.polygonIntersectsBox=ol,t.polygonIntersectsPolygon=Wo,t.polygonizeBounds=function(t,e,r=0,n=!0){const i=new d(r,r),s=t.sub(i),a=e.add(i),o=[s,new d(a.x,s.y),a,new d(s.x,a.y)];return n&&o.push(s.clone()),o},t.posAttributes=tf,t.postMapLoadEvent=zt,t.postPerformanceEvent=Et,t.postTurnstileEvent=Mt,t.potpack=Hh,t.prevPowerOfTwo=function(t){return t<=1?1:Math.pow(2,Math.floor(Math.log(t)/Math.LN2))},t.radToDeg=v,t.refProperties=[\"type\",\"source\",\"source-layer\",\"minzoom\",\"maxzoom\",\"filter\",\"layout\"],t.registerForPluginStateChange=function(t){return t({pluginStatus:Cs,pluginURL:Ps}),Ls.on(\"pluginStateChange\",t),t},t.removeAuthState=function(t){Dt.delete(t);},t.renderColorRamp=vu,t.resample=Uo,t.rotateX=Sl,t.rotateX$1=tu,t.rotateY=kl,t.rotateY$1=eu,t.rotateZ=function(t,e,r){var n=Math.sin(r),i=Math.cos(r),s=e[0],a=e[1],o=e[2],l=e[3],u=e[4],c=e[5],h=e[6],p=e[7];return e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=s*i+u*n,t[1]=a*i+c*n,t[2]=o*i+h*n,t[3]=l*i+p*n,t[4]=u*i-s*n,t[5]=c*i-a*n,t[6]=h*i-o*n,t[7]=p*i-l*n,t},t.rotateZ$1=function(t,e,r){r*=.5;var n=e[0],i=e[1],s=e[2],a=e[3],o=Math.sin(r),l=Math.cos(r);return t[0]=n*l+i*o,t[1]=i*l-n*o,t[2]=s*l+a*o,t[3]=a*l-s*o,t},t.scale=Al,t.scale$1=Yl,t.scale$2=Rl,t.scaleAndAdd=jl,t.set=function(t,e,r,n){return t[0]=e,t[1]=r,t[2]=n,t},t.setCacheLimits=function(t,e){Q=t,tt=e;},t.setColumn=function(t,e,r){t[4*e+0]=r[0],t[4*e+1]=r[1],t[4*e+2]=r[2],t[4*e+3]=r[3];},t.setRTLTextPlugin=function(t,e,r=!1){if(Cs===Ts||Cs===zs||Cs===Bs)throw new Error(\"setRTLTextPlugin cannot be called multiple times.\");Ps=Nt.resolveURL(t),Cs=Ts,Es=e,Vs(),r||Rs();},t.smoothstep=k,t.spec=Ht,t.squaredLength=function(t){var e=t[0],r=t[1],n=t[2];return e*e+r*r+n*n},t.storeAuthState=function(t,e){e?Dt.add(t):Dt.delete(t);},t.sub=Xl,t.subtract=Dl,t.symbolSize=bh,t.tileAABB=function(t,e,r,n,i,s,a,o,l){if(\"globe\"===l.name)return mf(t,e,new qc(r,n,i));const u=Df({z:r,x:n,y:i},l);return new au([(s+u.x/u.scale)*e,e*(u.y/u.scale),a],[(s+u.x2/u.scale)*e,e*(u.y2/u.scale),o])},t.tileCornersToBounds=gf,t.tileTransform=Df,t.transformMat3=function(t,e,r){var n=e[0],i=e[1],s=e[2];return t[0]=n*r[0]+i*r[3]+s*r[6],t[1]=n*r[1]+i*r[4]+s*r[7],t[2]=n*r[2]+i*r[5]+s*r[8],t},t.transformMat4=ql,t.transformMat4$1=Wl,t.transformQuat=Nl,t.transitionTileAABBinECEF=df,t.translate=_l,t.transpose=function(t,e){if(t===e){var r=e[1],n=e[2],i=e[5];t[1]=e[3],t[2]=e[6],t[3]=r,t[5]=e[7],t[6]=n,t[7]=i;}else t[0]=e[0],t[1]=e[3],t[2]=e[6],t[3]=e[1],t[4]=e[4],t[5]=e[7],t[6]=e[2],t[7]=e[5],t[8]=e[8];return t},t.triggerPluginCompletionEvent=Ds,t.uniqueId=E,t.updateGlobeVertexNormal=function(t,e,r,n,i){const s=5*e+2;t.float32[s+0]=r,t.float32[s+1]=n,t.float32[s+2]=i;},t.validateCustomStyleLayer=function(t){const e=[],r=t.id;return void 0===r&&e.push({message:`layers.${r}: missing required property \"id\"`}),void 0===t.render&&e.push({message:`layers.${r}: missing required method \"render\"`}),t.renderingMode&&\"2d\"!==t.renderingMode&&\"3d\"!==t.renderingMode&&e.push({message:`layers.${r}: property \"renderingMode\" must be either \"2d\" or \"3d\"`}),e},t.validateFilter=t=>Fi(xi(t)),t.validateFog=t=>Fi(Bi(t)),t.validateLayer=t=>Fi(Ai(t)),t.validateLight=t=>Fi(Ti(t)),t.validateSource=t=>Fi(Ii(t)),t.validateStyle=Di,t.validateTerrain=t=>Fi(zi(t)),t.values=T,t.vectorTile=hc,t.version=r,t.warnOnce=$,t.window=e,t.wrap=I;}));\n\ndefine([\"./shared\"],(function(e){\"use strict\";function t(e){if(\"number\"==typeof e||\"boolean\"==typeof e||\"string\"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){let r=\"[\";for(const o of e)r+=`${t(o)},`;return `${r}]`}let r=\"{\";for(const o of Object.keys(e).sort())r+=`${o}:${t(e[o])},`;return `${r}}`}function r(r){let o=\"\";for(const n of e.refProperties)o+=`/${t(r[n])}`;return o}class o{constructor(e){this.keyCache={},e&&this.replace(e);}replace(e){this._layerConfigs={},this._layers={},this.update(e,[]);}update(t,o){for(const r of t)this._layerConfigs[r.id]=r,(this._layers[r.id]=e.createStyleLayer(r)).compileFilter(),this.keyCache[r.id]&&delete this.keyCache[r.id];for(const e of o)delete this.keyCache[e],delete this._layerConfigs[e],delete this._layers[e];this.familiesBySource={};const n=function(e,t){const o={};for(let n=0;nthis._layers[e.id])),r=t[0];if(\"none\"===r.visibility)continue;const o=r.source||\"\";let n=this.familiesBySource[o];n||(n=this.familiesBySource[o]={});const i=r.sourceLayer||\"_geojsonTileLayer\";let s=n[i];s||(s=n[i]=[]),s.push(t);}}}class n{loadTile(t,r){const{uid:o,encoding:n,rawImageData:i,padding:s,buildQuadTree:a}=t,l=e.window.ImageBitmap&&i instanceof e.window.ImageBitmap?this.getImageData(i,s):i;r(null,new e.DEMData(o,l,n,s<1,a));}getImageData(e,t){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(e.width,e.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext(\"2d\",{willReadFrequently:!0})),this.offscreenCanvas.width=e.width,this.offscreenCanvas.height=e.height,this.offscreenCanvasContext.drawImage(e,0,0,e.width,e.height);const r=this.offscreenCanvasContext.getImageData(-t,-t,e.width+2*t,e.height+2*t);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),r}}var i=function e(t,r){var o,n=t&&t.type;if(\"FeatureCollection\"===n)for(o=0;o=Math.abs(a)?r-l+a:a-l+r,r=l;}r+o>=0!=!!t&&e.reverse();}const l=e.VectorTileFeature.prototype.toGeoJSON;class u{constructor(t){this._feature=t,this.extent=e.EXTENT,this.type=t.type,this.properties=t.tags,\"id\"in t&&!isNaN(t.id)&&(this.id=parseInt(t.id,10));}loadGeometry(){if(1===this._feature.type){const t=[];for(const r of this._feature.geometry)t.push([new e.pointGeometry(r[0],r[1])]);return t}{const t=[];for(const r of this._feature.geometry){const o=[];for(const t of r)o.push(new e.pointGeometry(t[0],t[1]));t.push(o);}return t}}toGeoJSON(e,t,r){return l.call(this,e,t,r)}}class h{constructor(t){this.layers={_geojsonTileLayer:this},this.name=\"_geojsonTileLayer\",this.extent=e.EXTENT,this.length=t.length,this._features=t;}feature(e){return new u(this._features[e])}}var c={exports:{}},f=e.pointGeometry,p=e.vectorTile.VectorTileFeature,g=d;function d(e,t){this.options=t||{},this.features=e,this.length=e.length;}function m(e,t){this.id=\"number\"==typeof e.id?e.id:void 0,this.type=e.type,this.rawGeometry=1===e.type?[e.geometry]:e.geometry,this.properties=e.tags,this.extent=t||4096;}d.prototype.feature=function(e){return new m(this.features[e],this.options.extent)},m.prototype.loadGeometry=function(){var e=this.rawGeometry;this.geometry=[];for(var t=0;t>31}function k(e,t){for(var r=e.loadGeometry(),o=e.type,n=0,i=0,s=r.length,a=0;a>1;_(e,t,s,o,n,i%2),T(e,t,r,o,s-1,i+1),T(e,t,r,s+1,n,i+1);}function _(e,t,r,o,n,i){for(;n>o;){if(n-o>600){const s=n-o+1,a=r-o+1,l=Math.log(s),u=.5*Math.exp(2*l/3),h=.5*Math.sqrt(l*u*(s-u)/s)*(a-s/2<0?-1:1);_(e,t,r,Math.max(o,Math.floor(r-a*u/s+h)),Math.min(n,Math.floor(r+(s-a)*u/s+h)),i);}const s=t[2*r+i];let a=o,l=n;for(L(e,t,o,r),t[2*n+i]>s&&L(e,t,o,n);as;)l--;}t[2*o+i]===s?L(e,t,o,l):(l++,L(e,t,l,n)),l<=r&&(o=l+1),r<=l&&(n=l-1);}}function L(e,t,r,o){C(e,r,o),C(t,2*r,2*o),C(t,2*r+1,2*o+1);}function C(e,t,r){const o=e[t];e[t]=e[r],e[r]=o;}function O(e,t,r,o){const n=e-r,i=t-o;return n*n+i*i}c.exports=x,c.exports.fromVectorTileJs=x,c.exports.fromGeojsonVt=function(e,t){t=t||{};var r={};for(var o in e)r[o]=new v(e[o].features,t),r[o].name=o,r[o].version=t.version,r[o].extent=t.extent;return x({layers:r})},c.exports.GeoJSONWrapper=v;const z=e=>e[0],E=e=>e[1];class F{constructor(e,t=z,r=E,o=64,n=Float64Array){this.nodeSize=o,this.points=e;const i=e.length<65536?Uint16Array:Uint32Array,s=this.ids=new i(e.length),a=this.coords=new n(2*e.length);for(let o=0;o=r&&u<=n&&h>=o&&h<=i&&l.push(e[s]);continue}const g=Math.floor((p+f)/2);u=t[2*g],h=t[2*g+1],u>=r&&u<=n&&h>=o&&h<=i&&l.push(e[g]);const d=(c+1)%2;(0===c?r<=u:o<=h)&&(a.push(p),a.push(g-1),a.push(d)),(0===c?n>=u:i>=h)&&(a.push(g+1),a.push(f),a.push(d));}return l}(this.ids,this.coords,e,t,r,o,this.nodeSize)}within(e,t,r){return function(e,t,r,o,n,i){const s=[0,e.length-1,0],a=[],l=n*n;for(;s.length;){const u=s.pop(),h=s.pop(),c=s.pop();if(h-c<=i){for(let n=c;n<=h;n++)O(t[2*n],t[2*n+1],r,o)<=l&&a.push(e[n]);continue}const f=Math.floor((c+h)/2),p=t[2*f],g=t[2*f+1];O(p,g,r,o)<=l&&a.push(e[f]);const d=(u+1)%2;(0===u?r-n<=p:o-n<=g)&&(s.push(c),s.push(f-1),s.push(d)),(0===u?r+n>=p:o+n>=g)&&(s.push(f+1),s.push(h),s.push(d));}return a}(this.ids,this.coords,e,t,r,this.nodeSize)}}const N={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},j=Math.fround||(Z=new Float32Array(1),e=>(Z[0]=+e,Z[0]));var Z;class G{constructor(e){this.options=$(Object.create(N),e),this.trees=new Array(this.options.maxZoom+1);}load(e){const{log:t,minZoom:r,maxZoom:o,nodeSize:n}=this.options;t&&console.time(\"total time\");const i=`prepare ${e.length} points`;t&&console.time(i),this.points=e;let s=[];for(let t=0;t=r;e--){const r=+Date.now();s=this._cluster(s,e),this.trees[e]=new F(s,B,R,n,Float32Array),t&&console.log(\"z%d: %d clusters in %dms\",e,s.length,+Date.now()-r);}return t&&console.timeEnd(\"total time\"),this}getClusters(e,t){let r=((e[0]+180)%360+360)%360-180;const o=Math.max(-90,Math.min(90,e[1]));let n=180===e[2]?180:((e[2]+180)%360+360)%360-180;const i=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)r=-180,n=180;else if(r>n){const e=this.getClusters([r,o,180,i],t),s=this.getClusters([-180,o,n,i],t);return e.concat(s)}const s=this.trees[this._limitZoom(t)],a=s.range(V(r),A(i),V(n),A(o)),l=[];for(const e of a){const t=s.points[e];l.push(t.numPoints?Y(t):this.points[t.index]);}return l}getChildren(e){const t=this._getOriginId(e),r=this._getOriginZoom(e),o=\"No cluster with the specified id.\",n=this.trees[r];if(!n)throw new Error(o);const i=n.points[t];if(!i)throw new Error(o);const s=this.options.radius/(this.options.extent*Math.pow(2,r-1)),a=n.within(i.x,i.y,s),l=[];for(const t of a){const r=n.points[t];r.parentId===e&&l.push(r.numPoints?Y(r):this.points[r.index]);}if(0===l.length)throw new Error(o);return l}getLeaves(e,t,r){const o=[];return this._appendLeaves(o,e,t=t||10,r=r||0,0),o}getTile(e,t,r){const o=this.trees[this._limitZoom(e)],n=Math.pow(2,e),{extent:i,radius:s}=this.options,a=s/i,l=(r-a)/n,u=(r+1+a)/n,h={features:[]};return this._addTileFeatures(o.range((t-a)/n,l,(t+1+a)/n,u),o.points,t,r,n,h),0===t&&this._addTileFeatures(o.range(1-a/n,l,1,u),o.points,n,r,n,h),t===n-1&&this._addTileFeatures(o.range(0,l,a/n,u),o.points,-1,r,n,h),h.features.length?h:null}getClusterExpansionZoom(e){let t=this._getOriginZoom(e)-1;for(;t<=this.options.maxZoom;){const r=this.getChildren(e);if(t++,1!==r.length)break;e=r[0].properties.cluster_id;}return t}_appendLeaves(e,t,r,o,n){const i=this.getChildren(t);for(const t of i){const i=t.properties;if(i&&i.cluster?n+i.point_count<=o?n+=i.point_count:n=this._appendLeaves(e,i.cluster_id,r,o,n):nt&&(c+=r.numPoints||1);}if(c>h&&c>=s){let e=n.x*h,s=n.y*h,a=i&&h>1?this._map(n,!0):null;const f=(o<<5)+(t+1)+this.points.length;for(const r of u){const o=l.points[r];if(o.zoom<=t)continue;o.zoom=t;const u=o.numPoints||1;e+=o.x*u,s+=o.y*u,o.parentId=f,i&&(a||(a=this._map(n,!0)),i(a,this._map(o)));}n.parentId=f,r.push(J(e/c,s/c,f,c,a));}else if(r.push(n),c>1)for(const e of u){const o=l.points[e];o.zoom<=t||(o.zoom=t,r.push(o));}}return r}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return (e-this.points.length)%32}_map(e,t){if(e.numPoints)return t?$({},e.properties):e.properties;const r=this.points[e.index].properties,o=this.options.map(r);return t&&o===r?$({},o):o}}function J(e,t,r,o,n){return {x:j(e),y:j(t),zoom:1/0,id:r,parentId:-1,numPoints:o,properties:n}}function W(e,t){const[r,o]=e.geometry.coordinates;return {x:j(V(r)),y:j(A(o)),zoom:1/0,index:t,parentId:-1}}function Y(e){return {type:\"Feature\",id:e.id,properties:X(e),geometry:{type:\"Point\",coordinates:[(t=e.x,360*(t-.5)),D(e.y)]}};var t;}function X(e){const t=e.numPoints,r=t>=1e4?`${Math.round(t/1e3)}k`:t>=1e3?Math.round(t/100)/10+\"k\":t;return $($({},e.properties),{cluster:!0,cluster_id:e.id,point_count:t,point_count_abbreviated:r})}function V(e){return e/360+.5}function A(e){const t=Math.sin(e*Math.PI/180),r=.5-.25*Math.log((1+t)/(1-t))/Math.PI;return r<0?0:r>1?1:r}function D(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function $(e,t){for(const r in t)e[r]=t[r];return e}function B(e){return e.x}function R(e){return e.y}function q(e,t,r,o){for(var n,i=o,s=r-t>>1,a=r-t,l=e[t],u=e[t+1],h=e[r],c=e[r+1],f=t+3;fi)n=f,i=p;else if(p===i){var g=Math.abs(f-s);go&&(n-t>3&&q(e,t,n,o),e[n+2]=i,r-n>3&&q(e,n,r,o));}function U(e,t,r,o,n,i){var s=n-r,a=i-o;if(0!==s||0!==a){var l=((e-r)*s+(t-o)*a)/(s*s+a*a);l>1?(r=n,o=i):l>0&&(r+=s*l,o+=a*l);}return (s=e-r)*s+(a=t-o)*a}function Q(e,t,r,o){var n={id:void 0===e?null:e,type:t,geometry:r,tags:o,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};return function(e){var t=e.geometry,r=e.type;if(\"Point\"===r||\"MultiPoint\"===r||\"LineString\"===r)H(e,t);else if(\"Polygon\"===r||\"MultiLineString\"===r)for(var o=0;o0&&(s+=o?(n*u-l*i)/2:Math.sqrt(Math.pow(l-n,2)+Math.pow(u-i,2))),n=l,i=u;}var h=t.length-3;t[2]=1,q(t,0,h,r),t[h+2]=1,t.size=Math.abs(s),t.start=0,t.end=t.size;}function re(e,t,r,o){for(var n=0;n1?1:r}function ie(e,t,r,o,n,i,s,a){if(o/=t,i>=(r/=t)&&s=o)return null;for(var l=[],u=0;u=r&&g=o)){var d=[];if(\"Point\"===f||\"MultiPoint\"===f)se(c,d,r,o,n);else if(\"LineString\"===f)ae(c,d,r,o,n,!1,a.lineMetrics);else if(\"MultiLineString\"===f)ue(c,d,r,o,n,!1);else if(\"Polygon\"===f)ue(c,d,r,o,n,!0);else if(\"MultiPolygon\"===f)for(var m=0;m=r&&s<=o&&(t.push(e[i]),t.push(e[i+1]),t.push(e[i+2]));}}function ae(e,t,r,o,n,i,s){for(var a,l,u=le(e),h=0===n?ce:fe,c=e.start,f=0;fr&&(l=h(u,p,g,m,y,r),s&&(u.start=c+a*l)):v>o?x=r&&(l=h(u,p,g,m,y,r),w=!0),x>o&&v<=o&&(l=h(u,p,g,m,y,o),w=!0),!i&&w&&(s&&(u.end=c+a*l),t.push(u),u=le(e)),s&&(c+=a);}var S=e.length-3;p=e[S],g=e[S+1],d=e[S+2],(v=0===n?p:g)>=r&&v<=o&&he(u,p,g,d),S=u.length-3,i&&S>=3&&(u[S]!==u[0]||u[S+1]!==u[1])&&he(u,u[0],u[1],u[2]),u.length&&t.push(u);}function le(e){var t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function ue(e,t,r,o,n,i){for(var s=0;ss.maxX&&(s.maxX=h),c>s.maxY&&(s.maxY=c);}return s}function ve(e,t,r,o){var n=t.geometry,i=t.type,s=[];if(\"Point\"===i||\"MultiPoint\"===i)for(var a=0;a0&&t.size<(n?s:o))r.numPoints+=t.length/3;else {for(var a=[],l=0;ls)&&(r.numSimplified++,a.push(t[l]),a.push(t[l+1])),r.numPoints++;n&&function(e,t){for(var r=0,o=0,n=e.length,i=n-2;o0===t)for(o=0,n=e.length;o24)throw new Error(\"maxZoom should be in the 0-24 range\");if(t.promoteId&&t.generateId)throw new Error(\"promoteId and generateId cannot be used together.\");var o=function(e,t){var r=[];if(\"FeatureCollection\"===e.type)for(var o=0;o1&&console.time(\"creation\"),f=this.tiles[c]=ye(e,t,r,o,l),this.tileCoords.push({z:t,x:r,y:o}),u)){u>1&&(console.log(\"tile z%d-%d-%d (features: %d, points: %d, simplified: %d)\",t,r,o,f.numFeatures,f.numPoints,f.numSimplified),console.timeEnd(\"creation\"));var p=\"z\"+t;this.stats[p]=(this.stats[p]||0)+1,this.total++;}if(f.source=e,n){if(t===l.maxZoom||t===n)continue;var g=1<1&&console.time(\"clipping\");var d,m,y,v,x,w,S=.5*l.buffer/l.extent,M=.5-S,P=.5+S,b=1+S;d=m=y=v=null,x=ie(e,h,r-S,r+P,0,f.minX,f.maxX,l),w=ie(e,h,r+M,r+b,0,f.minX,f.maxX,l),e=null,x&&(d=ie(x,h,o-S,o+P,1,f.minY,f.maxY,l),m=ie(x,h,o+M,o+b,1,f.minY,f.maxY,l),x=null),w&&(y=ie(w,h,o-S,o+P,1,f.minY,f.maxY,l),v=ie(w,h,o+M,o+b,1,f.minY,f.maxY,l),w=null),u>1&&console.timeEnd(\"clipping\"),a.push(d||[],t+1,2*r,2*o),a.push(m||[],t+1,2*r,2*o+1),a.push(y||[],t+1,2*r+1,2*o),a.push(v||[],t+1,2*r+1,2*o+1);}}},we.prototype.getTile=function(e,t,r){var o=this.options,n=o.extent,i=o.debug;if(e<0||e>24)return null;var s=1<1&&console.log(\"drilling down to z%d-%d-%d\",e,t,r);for(var l,u=e,h=t,c=r;!l&&u>0;)u--,h=Math.floor(h/2),c=Math.floor(c/2),l=this.tiles[Se(u,h,c)];return l&&l.source?(i>1&&console.log(\"found parent tile z%d-%d-%d\",u,h,c),i>1&&console.time(\"drilling down\"),this.splitTile(l.source,u,h,c,e,t,r),i>1&&console.timeEnd(\"drilling down\"),this.tiles[a]?de(this.tiles[a],n):null):null};class Pe extends e.VectorTileWorkerSource{constructor(e,t,r,o,n){super(e,t,r,o,Me),n&&(this.loadGeoJSON=n);}loadData(t,r){const o=t&&t.request,n=o&&o.collectResourceTiming;this.loadGeoJSON(t,((s,a)=>{if(s||!a)return r(s);if(\"object\"!=typeof a)return r(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));{i(a,!0);try{if(t.filter){const r=e.createExpression(t.filter,{type:\"boolean\",\"property-type\":\"data-driven\",overridable:!1,transition:!1});if(\"error\"===r.result)throw new Error(r.value.map((e=>`${e.key}: ${e.message}`)).join(\", \"));const o=a.features.filter((e=>r.value.evaluate({zoom:0},e)));a={type:\"FeatureCollection\",features:o};}this._geoJSONIndex=t.cluster?new G(function({superclusterOptions:t,clusterProperties:r}){if(!r||!t)return t;const o={},n={},i={accumulated:null,zoom:0},s={properties:null},a=Object.keys(r);for(const t of a){const[i,s]=r[t],a=e.createExpression(s),l=e.createExpression(\"string\"==typeof i?[i,[\"accumulated\"],[\"get\",t]]:i);o[t]=a.value,n[t]=l.value;}return t.map=e=>{s.properties=e;const t={};for(const e of a)t[e]=o[e].evaluate(i,s);return t},t.reduce=(e,t)=>{s.properties=t;for(const t of a)i.accumulated=e[t],e[t]=n[t].evaluate(i,s);},t}(t)).load(a.features):function(e,t){return new we(e,t)}(a,t.geojsonVtOptions);}catch(s){return r(s)}this.loaded={};const l={};if(n){const r=e.getPerformanceMeasurement(o);r&&(l.resourceTiming={},l.resourceTiming[t.source]=JSON.parse(JSON.stringify(r)));}r(null,l);}}));}reloadTile(e,t){const r=this.loaded;return r&&r[e.uid]?super.reloadTile(e,t):this.loadTile(e,t)}loadGeoJSON(t,r){if(t.request)e.getJSON(t.request,r);else {if(\"string\"!=typeof t.data)return r(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`));try{return r(null,JSON.parse(t.data))}catch(e){return r(new Error(`Input data given to '${t.source}' is not a valid GeoJSON object.`))}}}getClusterExpansionZoom(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId));}catch(e){t(e);}}getClusterChildren(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId));}catch(e){t(e);}}getClusterLeaves(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset));}catch(e){t(e);}}}class be{constructor(t){this.self=t,this.actor=new e.Actor(t,this),this.layerIndexes={},this.availableImages={},this.isSpriteLoaded={},this.projections={},this.defaultProjection=e.getProjection({name:\"mercator\"}),this.workerSourceTypes={vector:e.VectorTileWorkerSource,geojson:Pe},this.workerSources={},this.demWorkerSources={},this.self.registerWorkerSource=(e,t)=>{if(this.workerSourceTypes[e])throw new Error(`Worker source with name \"${e}\" already registered.`);this.workerSourceTypes[e]=t;},this.self.registerRTLTextPlugin=t=>{if(e.plugin.isParsed())throw new Error(\"RTL text plugin already registered.\");e.plugin.applyArabicShaping=t.applyArabicShaping,e.plugin.processBidirectionalText=t.processBidirectionalText,e.plugin.processStyledBidirectionalText=t.processStyledBidirectionalText;};}clearCaches(e,t,r){delete this.layerIndexes[e],delete this.availableImages[e],delete this.workerSources[e],delete this.demWorkerSources[e],r();}checkIfReady(e,t,r){r();}setReferrer(e,t){this.referrer=t;}spriteLoaded(t,r){this.isSpriteLoaded[t]=r;for(const o in this.workerSources[t]){const n=this.workerSources[t][o];for(const t in n)n[t]instanceof e.VectorTileWorkerSource&&(n[t].isSpriteLoaded=r,n[t].fire(new e.Event(\"isSpriteLoaded\")));}}setImages(e,t,r){this.availableImages[e]=t;for(const r in this.workerSources[e]){const o=this.workerSources[e][r];for(const e in o)o[e].availableImages=t;}r();}enableTerrain(e,t,r){this.terrain=t,r();}setProjection(t,r){this.projections[t]=e.getProjection(r);}setLayers(e,t,r){this.getLayerIndex(e).replace(t),r();}updateLayers(e,t,r){this.getLayerIndex(e).update(t.layers,t.removedIds),r();}loadTile(t,r,o){const n=this.enableTerrain?e.extend({enableTerrain:this.terrain},r):r;n.projection=this.projections[t]||this.defaultProjection,this.getWorkerSource(t,r.type,r.source).loadTile(n,o);}loadDEMTile(t,r,o){const n=this.enableTerrain?e.extend({buildQuadTree:this.terrain},r):r;this.getDEMWorkerSource(t,r.source).loadTile(n,o);}reloadTile(t,r,o){const n=this.enableTerrain?e.extend({enableTerrain:this.terrain},r):r;n.projection=this.projections[t]||this.defaultProjection,this.getWorkerSource(t,r.type,r.source).reloadTile(n,o);}abortTile(e,t,r){this.getWorkerSource(e,t.type,t.source).abortTile(t,r);}removeTile(e,t,r){this.getWorkerSource(e,t.type,t.source).removeTile(t,r);}removeSource(e,t,r){if(!this.workerSources[e]||!this.workerSources[e][t.type]||!this.workerSources[e][t.type][t.source])return;const o=this.workerSources[e][t.type][t.source];delete this.workerSources[e][t.type][t.source],void 0!==o.removeSource?o.removeSource(t,r):r();}loadWorkerSource(e,t,r){try{this.self.importScripts(t.url),r();}catch(e){r(e.toString());}}syncRTLPluginState(t,r,o){try{e.plugin.setState(r);const t=e.plugin.getPluginURL();if(e.plugin.isLoaded()&&!e.plugin.isParsed()&&null!=t){this.self.importScripts(t);const r=e.plugin.isParsed();o(r?void 0:new Error(`RTL Text Plugin failed to import scripts from ${t}`),r);}}catch(e){o(e.toString());}}getAvailableImages(e){let t=this.availableImages[e];return t||(t=[]),t}getLayerIndex(e){let t=this.layerIndexes[e];return t||(t=this.layerIndexes[e]=new o),t}getWorkerSource(e,t,r){if(this.workerSources[e]||(this.workerSources[e]={}),this.workerSources[e][t]||(this.workerSources[e][t]={}),!this.workerSources[e][t][r]){const o={send:(t,r,o,n,i,s)=>{this.actor.send(t,r,o,e,i,s);},scheduler:this.actor.scheduler};this.workerSources[e][t][r]=new this.workerSourceTypes[t](o,this.getLayerIndex(e),this.getAvailableImages(e),this.isSpriteLoaded[e]);}return this.workerSources[e][t][r]}getDEMWorkerSource(e,t){return this.demWorkerSources[e]||(this.demWorkerSources[e]={}),this.demWorkerSources[e][t]||(this.demWorkerSources[e][t]=new n),this.demWorkerSources[e][t]}enforceCacheSizeLimit(t,r){e.enforceCacheSizeLimit(r);}getWorkerPerformanceMetrics(e,t,r){r(void 0,void 0);}}return \"undefined\"!=typeof WorkerGlobalScope&&\"undefined\"!=typeof self&&self instanceof WorkerGlobalScope&&(self.worker=new be(self)),be}));\n\ndefine([\"./shared\"],(function(e){\"use strict\";function t(e,i){if(Array.isArray(e)){if(!Array.isArray(i)||e.length!==i.length)return !1;for(let o=0;o{e.window.removeEventListener(\"click\",_,!0);}),0);}function p(e,t){const i=e.getBoundingClientRect();return g(e,i,t)}function m(e,t){const i=e.getBoundingClientRect(),o=[];for(let r=0;r=0?0:t.button}function g(t,i,o){const r=t.offsetWidth===i.width?1:t.offsetWidth/i.width;return new e.pointGeometry((o.clientX-i.left)*r,(o.clientY-i.top)*r)}function v(e,t){var i=t[0],o=t[1],r=t[2],n=t[3],s=i*n-r*o;return s?(e[0]=n*(s=1/s),e[1]=-o*s,e[2]=-r*s,e[3]=i*s,e):null}function x(e){const{userImage:t}=e;return !!(t&&t.render&&t.render())&&(e.data.replace(new Uint8Array(t.data.buffer)),!0)}class y extends e.Evented{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new e.RGBAImage({width:1,height:1}),this.dirty=!0;}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:e,callback:t}of this.requestors)this._notify(e,t);this.requestors=[];}}hasImage(e){return !!this.getImage(e)}getImage(e){return this.images[e]}addImage(e,t){this._validate(e,t)&&(this.images[e]=t);}_validate(t,i){let o=!0;return this._validateStretch(i.stretchX,i.data&&i.data.width)||(this.fire(new e.ErrorEvent(new Error(`Image \"${t}\" has invalid \"stretchX\" value`))),o=!1),this._validateStretch(i.stretchY,i.data&&i.data.height)||(this.fire(new e.ErrorEvent(new Error(`Image \"${t}\" has invalid \"stretchY\" value`))),o=!1),this._validateContent(i.content,i)||(this.fire(new e.ErrorEvent(new Error(`Image \"${t}\" has invalid \"content\" value`))),o=!1),o}_validateStretch(e,t){if(!e)return !0;let i=0;for(const o of e){if(o[0]{this.ready=!0;}));}broadcast(t,i,o){e.asyncAll(this.actors,((e,o)=>{e.send(t,i,o);}),o=o||function(){});}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach((e=>{e.remove();})),this.actors=[],this.workerPool.release(this.id);}}function P(t,i,o){return i*(e.EXTENT/(t.tileSize*Math.pow(2,o-t.tileID.overscaledZ)))}z.Actor=e.Actor;class R{constructor(e,t,i,o){this.screenBounds=e,this.cameraPoint=t,this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=i,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,o);}static createFromScreenPoints(t,i){let o,r;if(t instanceof e.pointGeometry||\"number\"==typeof t[0]){const n=e.pointGeometry.convert(t);o=[n],r=i.isPointAboveHorizon(n);}else {const n=e.pointGeometry.convert(t[0]),s=e.pointGeometry.convert(t[1]);o=[n,s],r=e.polygonizeBounds(n,s).every((e=>i.isPointAboveHorizon(e)));}return new R(o,i.getCameraPoint(),r,i)}isPointQuery(){return 1===this.screenBounds.length}bufferedScreenGeometry(t){return e.polygonizeBounds(this.screenBounds[0],1===this.screenBounds.length?this.screenBounds[0]:this.screenBounds[1],t)}bufferedCameraGeometry(t){const i=this.screenBounds[0],o=1===this.screenBounds.length?this.screenBounds[0].add(new e.pointGeometry(1,1)):this.screenBounds[1],r=e.polygonizeBounds(i,o,0,!1);return this.cameraPoint.y>o.y&&(this.cameraPoint.x>i.x&&this.cameraPoint.x=o.x?r[2]=this.cameraPoint:this.cameraPoint.x<=i.x&&(r[3]=this.cameraPoint)),e.bufferConvexPolygon(r,t)}bufferedCameraGeometryGlobe(t){const i=this.screenBounds[0],o=1===this.screenBounds.length?this.screenBounds[0].add(new e.pointGeometry(1,1)):this.screenBounds[1],r=e.polygonizeBounds(i,o,t),n=this.cameraPoint.clone();switch(3*((n.y>i.y)+(n.y>o.y))+((n.x>i.x)+(n.x>o.x))){case 0:r[0]=n,r[4]=n.clone();break;case 1:r.splice(1,0,n);break;case 2:r[1]=n;break;case 3:r.splice(4,0,n);break;case 5:r.splice(2,0,n);break;case 6:r[3]=n;break;case 7:r.splice(3,0,n);break;case 8:r[2]=n;}return r}containsTile(t,i,o,r=0){const n=t.queryPadding/i._pixelsPerMercatorPixel+1,s=o?this._bufferedCameraMercator(n,i):this._bufferedScreenMercator(n,i);let a=t.tileID.wrap+(s.unwrapped?r:0);const l=s.polygon.map((i=>e.getTilePoint(t.tileTransform,i,a)));if(!e.polygonIntersectsBox(l,0,0,e.EXTENT,e.EXTENT))return;a=t.tileID.wrap+(this.screenGeometryMercator.unwrapped?r:0);const c=this.screenGeometryMercator.polygon.map((i=>e.getTileVec3(t.tileTransform,i,a))),h=c.map((t=>new e.pointGeometry(t[0],t[1]))),u=i.getFreeCameraOptions().position||new e.MercatorCoordinate(0,0,0),_=e.getTileVec3(t.tileTransform,u,a),d=c.map((t=>{const i=e.sub(t,t,_);return e.normalize(i,i),new e.Ray(_,i)})),p=P(t,1,i.zoom)*i._pixelsPerMercatorPixel;return {queryGeometry:this,tilespaceGeometry:h,tilespaceRays:d,bufferedTilespaceGeometry:l,bufferedTilespaceBounds:(m=e.getBounds(l),m.min.x=e.clamp(m.min.x,0,e.EXTENT),m.min.y=e.clamp(m.min.y,0,e.EXTENT),m.max.x=e.clamp(m.max.x,0,e.EXTENT),m.max.y=e.clamp(m.max.y,0,e.EXTENT),m),tile:t,tileID:t.tileID,pixelToTileUnitsFactor:p};var m;}_bufferedScreenMercator(e,t){const i=k(e);if(this._screenRaycastCache[i])return this._screenRaycastCache[i];{let o;return o=\"globe\"===t.projection.name?this._projectAndResample(this.bufferedScreenGeometry(e),t):{polygon:this.bufferedScreenGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._screenRaycastCache[i]=o,o}}_bufferedCameraMercator(e,t){const i=k(e);if(this._cameraRaycastCache[i])return this._cameraRaycastCache[i];{let o;return o=\"globe\"===t.projection.name?this._projectAndResample(this.bufferedCameraGeometryGlobe(e),t):{polygon:this.bufferedCameraGeometry(e).map((e=>t.pointCoordinate3D(e))),unwrapped:!0},this._cameraRaycastCache[i]=o,o}}_projectAndResample(t,i){const o=function(t,i){const o=e.multiply([],i.pixelMatrix,i.globeMatrix),r=[0,-e.GLOBE_RADIUS,0,1],n=[0,e.GLOBE_RADIUS,0,1],s=[0,0,0,1];e.transformMat4$1(r,r,o),e.transformMat4$1(n,n,o),e.transformMat4$1(s,s,o);const a=new e.pointGeometry(r[0]/r[3],r[1]/r[3]),l=new e.pointGeometry(n[0]/n[3],n[1]/n[3]),c=e.polygonContainsPoint(t,a)&&r[3]1?O(t.slice(0,_),i):[],m=_new e.pointGeometry(B(t.x),t.y))),m=m.map((t=>new e.pointGeometry(B(t.x),t.y)));const f=[...p];0===f.length&&f.push(m[m.length-1]);const g=e.number(f[f.length-1].y,(0===m.length?p[0]:m[0]).y,d);let v;return v=c?[new e.pointGeometry(0,g),new e.pointGeometry(0,0),new e.pointGeometry(1,0),new e.pointGeometry(1,g)]:[new e.pointGeometry(1,g),new e.pointGeometry(1,1),new e.pointGeometry(0,1),new e.pointGeometry(0,g)],f.push(...v),0===m.length?f.push(p[0]):f.push(...m),{polygon:f.map((t=>new e.MercatorCoordinate(t.x,t.y))),unwrapped:!1}}(t,i);if(o)return o;const r=function(t,i){let o=!1,r=-1/0,n=0;for(let e=0;er&&(r=t[e].x,n=e);for(let e=0;e.5&&(r.x