@gis_victory/gismap 2.0.46 → 2.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.es.js +12 -1
- package/dist/index.umd.js +1 -1
- package/package.json +2 -2
- package/dist/assets/data/mask.json +0 -14325
- package/dist/assets/icons/bg.png +0 -0
- package/dist/assets/icons/layer_default.png +0 -0
- package/dist/assets/icons/layer_group.png +0 -0
- package/dist/assets/icons/layer_query.png +0 -0
- package/dist/assets/icons//347/251/272/347/275/256/345/216/202/346/210/277.png +0 -0
- package/dist/assets/icons//351/227/262/347/275/256/345/234/260/345/235/227.png +0 -0
- package/dist/assets/template/data.json +0 -2671
- package/dist/assets/template/search_data.json +0 -14
- package/dist/hd.shared-CQ8V3LpU.js +0 -1
- package/dist/hd.worker-DtSZ3AI6.js +0 -1
- package/dist/hd.worker-DveeQM1R.js +0 -1
- package/dist/index-nTegTRc-.js +0 -13
- package/dist/vite.svg +0 -1
- package/dist/worker-DWfYi5c4.js +0 -1
package/dist/worker-DWfYi5c4.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=1e-6,t="undefined"!=typeof Float32Array?Float32Array:Array;function r(e,t){var r=t[0],n=t[1],i=t[2],s=t[3],o=t[4],a=t[5],l=t[6],u=t[7],c=t[8];return e[0]=o*c-a*u,e[1]=i*u-n*c,e[2]=n*a-i*o,e[3]=a*l-s*c,e[4]=r*c-i*l,e[5]=i*s-r*a,e[6]=s*u-o*l,e[7]=n*l-r*u,e[8]=r*o-n*s,e}function n(e,t,r){var n=t[0],i=t[1],s=t[2],o=t[3],a=t[4],l=t[5],u=t[6],c=t[7],h=t[8],p=r[0],d=r[1],f=r[2],m=r[3],y=r[4],g=r[5],x=r[6],v=r[7],b=r[8];return e[0]=p*n+d*o+f*u,e[1]=p*i+d*a+f*c,e[2]=p*s+d*l+f*h,e[3]=m*n+y*o+g*u,e[4]=m*i+y*a+g*c,e[5]=m*s+y*l+g*h,e[6]=x*n+v*o+b*u,e[7]=x*i+v*a+b*c,e[8]=x*s+v*l+b*h,e}function i(){var e=new t(16);return t!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0),e[0]=1,e[5]=1,e[10]=1,e[15]=1,e}function s(e){return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function o(e,t){var r=t[0],n=t[1],i=t[2],s=t[3],o=t[4],a=t[5],l=t[6],u=t[7],c=t[8],h=t[9],p=t[10],d=t[11],f=t[12],m=t[13],y=t[14],g=t[15],x=r*a-n*o,v=r*l-i*o,b=r*u-s*o,w=n*l-i*a,_=n*u-s*a,I=i*u-s*l,A=c*m-h*f,S=c*y-p*f,M=c*g-d*f,B=h*y-p*m,P=h*g-d*m,z=p*g-d*y,T=x*z-v*P+b*B+w*M-_*S+I*A;return T?(e[0]=(a*z-l*P+u*B)*(T=1/T),e[1]=(i*P-n*z-s*B)*T,e[2]=(m*I-y*_+g*w)*T,e[3]=(p*_-h*I-d*w)*T,e[4]=(l*M-o*z-u*S)*T,e[5]=(r*z-i*M+s*S)*T,e[6]=(y*b-f*I-g*v)*T,e[7]=(c*I-p*b+d*v)*T,e[8]=(o*P-a*M+u*A)*T,e[9]=(n*M-r*P-s*A)*T,e[10]=(f*_-m*b+g*x)*T,e[11]=(h*b-c*_-d*x)*T,e[12]=(a*S-o*B-l*A)*T,e[13]=(r*B-n*S+i*A)*T,e[14]=(m*v-f*w-y*x)*T,e[15]=(c*w-h*v+p*x)*T,e):null}function a(e,t,r){var n=t[0],i=t[1],s=t[2],o=t[3],a=t[4],l=t[5],u=t[6],c=t[7],h=t[8],p=t[9],d=t[10],f=t[11],m=t[12],y=t[13],g=t[14],x=t[15],v=r[0],b=r[1],w=r[2],_=r[3];return e[0]=v*n+b*a+w*h+_*m,e[1]=v*i+b*l+w*p+_*y,e[2]=v*s+b*u+w*d+_*g,e[3]=v*o+b*c+w*f+_*x,e[4]=(v=r[4])*n+(b=r[5])*a+(w=r[6])*h+(_=r[7])*m,e[5]=v*i+b*l+w*p+_*y,e[6]=v*s+b*u+w*d+_*g,e[7]=v*o+b*c+w*f+_*x,e[8]=(v=r[8])*n+(b=r[9])*a+(w=r[10])*h+(_=r[11])*m,e[9]=v*i+b*l+w*p+_*y,e[10]=v*s+b*u+w*d+_*g,e[11]=v*o+b*c+w*f+_*x,e[12]=(v=r[12])*n+(b=r[13])*a+(w=r[14])*h+(_=r[15])*m,e[13]=v*i+b*l+w*p+_*y,e[14]=v*s+b*u+w*d+_*g,e[15]=v*o+b*c+w*f+_*x,e}function l(e,t,r){var n,i,s,o,a,l,u,c,h,p,d,f,m=r[0],y=r[1],g=r[2];return t===e?(e[12]=t[0]*m+t[4]*y+t[8]*g+t[12],e[13]=t[1]*m+t[5]*y+t[9]*g+t[13],e[14]=t[2]*m+t[6]*y+t[10]*g+t[14],e[15]=t[3]*m+t[7]*y+t[11]*g+t[15]):(i=t[1],s=t[2],o=t[3],a=t[4],l=t[5],u=t[6],c=t[7],h=t[8],p=t[9],d=t[10],f=t[11],e[0]=n=t[0],e[1]=i,e[2]=s,e[3]=o,e[4]=a,e[5]=l,e[6]=u,e[7]=c,e[8]=h,e[9]=p,e[10]=d,e[11]=f,e[12]=n*m+a*y+h*g+t[12],e[13]=i*m+l*y+p*g+t[13],e[14]=s*m+u*y+d*g+t[14],e[15]=o*m+c*y+f*g+t[15]),e}function u(e,t,r){var n=r[0],i=r[1],s=r[2];return e[0]=t[0]*n,e[1]=t[1]*n,e[2]=t[2]*n,e[3]=t[3]*n,e[4]=t[4]*i,e[5]=t[5]*i,e[6]=t[6]*i,e[7]=t[7]*i,e[8]=t[8]*s,e[9]=t[9]*s,e[10]=t[10]*s,e[11]=t[11]*s,e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function c(e,t,r){var n=Math.sin(r),i=Math.cos(r),s=t[4],o=t[5],a=t[6],l=t[7],u=t[8],c=t[9],h=t[10],p=t[11];return t!==e&&(e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[4]=s*i+u*n,e[5]=o*i+c*n,e[6]=a*i+h*n,e[7]=l*i+p*n,e[8]=u*i-s*n,e[9]=c*i-o*n,e[10]=h*i-a*n,e[11]=p*i-l*n,e}function h(e,t,r){var n=Math.sin(r),i=Math.cos(r),s=t[0],o=t[1],a=t[2],l=t[3],u=t[8],c=t[9],h=t[10],p=t[11];return t!==e&&(e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=s*i-u*n,e[1]=o*i-c*n,e[2]=a*i-h*n,e[3]=l*i-p*n,e[8]=s*n+u*i,e[9]=o*n+c*i,e[10]=a*n+h*i,e[11]=l*n+p*i,e}function p(e,t,r){var n=Math.sin(r),i=Math.cos(r),s=t[0],o=t[1],a=t[2],l=t[3],u=t[4],c=t[5],h=t[6],p=t[7];return t!==e&&(e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15]),e[0]=s*i+u*n,e[1]=o*i+c*n,e[2]=a*i+h*n,e[3]=l*i+p*n,e[4]=u*i-s*n,e[5]=c*i-o*n,e[6]=h*i-a*n,e[7]=p*i-l*n,e}function d(){var e=new t(3);return t!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e}function f(e){var r=new t(3);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r}function m(e){var t=e[0],r=e[1],n=e[2];return Math.sqrt(t*t+r*r+n*n)}function y(e,r,n){var i=new t(3);return i[0]=e,i[1]=r,i[2]=n,i}function g(e,t,r,n){return e[0]=t,e[1]=r,e[2]=n,e}function x(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e[2]=t[2]+r[2],e}function v(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e[2]=t[2]-r[2],e}function b(e,t,r){return e[0]=Math.min(t[0],r[0]),e[1]=Math.min(t[1],r[1]),e[2]=Math.min(t[2],r[2]),e}function w(e,t,r){return e[0]=Math.max(t[0],r[0]),e[1]=Math.max(t[1],r[1]),e[2]=Math.max(t[2],r[2]),e}function _(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e}function I(e,t,r,n){return e[0]=t[0]+r[0]*n,e[1]=t[1]+r[1]*n,e[2]=t[2]+r[2]*n,e}function A(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return Math.sqrt(r*r+n*n+i*i)}function S(e,t){var r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return r*r+n*n+i*i}function M(e,t){return e[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e}function B(e,t){var r=t[0],n=t[1],i=t[2],s=r*r+n*n+i*i;return s>0&&(s=1/Math.sqrt(s)),e[0]=t[0]*s,e[1]=t[1]*s,e[2]=t[2]*s,e}function P(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]}function z(e,t,r){var n=t[0],i=t[1],s=t[2],o=r[0],a=r[1],l=r[2];return e[0]=i*l-s*a,e[1]=s*o-n*l,e[2]=n*a-i*o,e}function T(e,t,r,n){var i=t[0],s=t[1],o=t[2];return e[0]=i+n*(r[0]-i),e[1]=s+n*(r[1]-s),e[2]=o+n*(r[2]-o),e}function k(e,t,r){var n=t[0],i=t[1],s=t[2],o=r[3]*n+r[7]*i+r[11]*s+r[15];return e[0]=(r[0]*n+r[4]*i+r[8]*s+r[12])/(o=o||1),e[1]=(r[1]*n+r[5]*i+r[9]*s+r[13])/o,e[2]=(r[2]*n+r[6]*i+r[10]*s+r[14])/o,e}function V(e,t,r){var n=t[0],i=t[1],s=t[2];return e[0]=n*r[0]+i*r[3]+s*r[6],e[1]=n*r[1]+i*r[4]+s*r[7],e[2]=n*r[2]+i*r[5]+s*r[8],e}function E(e,t,r){var n=r[0],i=r[1],s=r[2],o=r[3],a=t[0],l=t[1],u=t[2],c=i*u-s*l,h=s*a-n*u,p=n*l-i*a;return e[0]=a+o*(c+=c)+i*(p+=p)-s*(h+=h),e[1]=l+o*h+s*c-n*p,e[2]=u+o*p+n*h-i*c,e}function D(e,t){return e[0]===t[0]&&e[1]===t[1]&&e[2]===t[2]}var C,F=v,L=m;function R(e,t,r){var n=t[0],i=t[1],s=t[2],o=t[3];return e[0]=r[0]*n+r[4]*i+r[8]*s+r[12]*o,e[1]=r[1]*n+r[5]*i+r[9]*s+r[13]*o,e[2]=r[2]*n+r[6]*i+r[10]*s+r[14]*o,e[3]=r[3]*n+r[7]*i+r[11]*s+r[15]*o,e}function O(){var e=new t(4);return t!=Float32Array&&(e[0]=0,e[1]=0,e[2]=0),e[3]=1,e}function U(e){return e[0]=0,e[1]=0,e[2]=0,e[3]=1,e}d(),C=new t(4),t!=Float32Array&&(C[0]=0,C[1]=0,C[2]=0,C[3]=0);var N,j,$,G,X,q=function(e,t){var r=t[0],n=t[1],i=t[2],s=t[3],o=r*r+n*n+i*i+s*s;return o>0&&(o=1/Math.sqrt(o)),e[0]=r*o,e[1]=n*o,e[2]=i*o,e[3]=s*o,e},H=(N=d(),j=y(1,0,0),$=y(0,1,0),function(e,t,r){var n=P(t,r);return n<-.999999?(z(N,j,t),L(N)<1e-6&&z(N,$,t),B(N,N),function(e,t,r){r*=.5;var n=Math.sin(r);e[0]=n*t[0],e[1]=n*t[1],e[2]=n*t[2],e[3]=Math.cos(r)}(e,N,Math.PI),e):n>.999999?(e[0]=0,e[1]=0,e[2]=0,e[3]=1,e):(z(N,t,r),e[0]=N[0],e[1]=N[1],e[2]=N[2],e[3]=1+n,q(e,e))});function Z(){var e=new t(2);return t!=Float32Array&&(e[0]=0,e[1]=0),e}function Y(e,r){var n=new t(2);return n[0]=e,n[1]=r,n}function W(e,t,r){return e[0]=t,e[1]=r,e}function J(e,t,r){return e[0]=t[0]+r[0],e[1]=t[1]+r[1],e}function K(e,t,r){return e[0]=t[0]-r[0],e[1]=t[1]-r[1],e}function Q(e,t,r){return e[0]=t[0]*r,e[1]=t[1]*r,e}function ee(e){var t=e[0],r=e[1];return Math.sqrt(t*t+r*r)}function te(e,t){var r=t[0],n=t[1],i=r*r+n*n;return i>0&&(i=1/Math.sqrt(i)),e[0]=t[0]*i,e[1]=t[1]*i,e}function re(e,t){return e[0]*t[0]+e[1]*t[1]}function ne(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}O(),O(),function(){var e=new t(9);t!=Float32Array&&(e[1]=0,e[2]=0,e[3]=0,e[5]=0,e[6]=0,e[7]=0),e[0]=1,e[4]=1,e[8]=1}(),Z();var ie=function(){if(X)return G;function e(e,t,r,n){this.cx=3*e,this.bx=3*(r-e)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*t,this.by=3*(n-t)-this.cy,this.ay=1-this.cy-this.by,this.p1x=e,this.p1y=t,this.p2x=r,this.p2y=n}return X=1,G=e,e.prototype={sampleCurveX:function(e){return((this.ax*e+this.bx)*e+this.cx)*e},sampleCurveY:function(e){return((this.ay*e+this.by)*e+this.cy)*e},sampleCurveDerivativeX:function(e){return(3*this.ax*e+2*this.bx)*e+this.cx},solveCurveX:function(e,t){if(void 0===t&&(t=1e-6),e<0)return 0;if(e>1)return 1;for(var r=e,n=0;n<8;n++){var i=this.sampleCurveX(r)-e;if(Math.abs(i)<t)return r;var s=this.sampleCurveDerivativeX(r);if(Math.abs(s)<1e-6)break;r-=i/s}var o=0,a=1;for(r=e,n=0;n<20&&(i=this.sampleCurveX(r),!(Math.abs(i-e)<t));n++)e>i?o=r:a=r,r=.5*(a-o)+o;return r},solve:function(e,t){return this.sampleCurveY(this.solveCurveX(e,t))}},G}();const se=ne(ie);function oe(e,t){this.x=e,this.y=t}function ae(e,t){if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!ae(e[r],t[r]))return!1;return!0}if("object"==typeof e&&null!==e&&null!==t){if("object"!=typeof t)return!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(!ae(e[r],t[r]))return!1;return!0}return e===t}oe.prototype={clone(){return new oe(this.x,this.y)},add(e){return this.clone()._add(e)},sub(e){return this.clone()._sub(e)},multByPoint(e){return this.clone()._multByPoint(e)},divByPoint(e){return this.clone()._divByPoint(e)},mult(e){return this.clone()._mult(e)},div(e){return this.clone()._div(e)},rotate(e){return this.clone()._rotate(e)},rotateAround(e,t){return this.clone()._rotateAround(e,t)},matMult(e){return this.clone()._matMult(e)},unit(){return this.clone()._unit()},perp(){return this.clone()._perp()},round(){return this.clone()._round()},mag(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals(e){return this.x===e.x&&this.y===e.y},dist(e){return Math.sqrt(this.distSqr(e))},distSqr(e){const t=e.x-this.x,r=e.y-this.y;return t*t+r*r},angle(){return Math.atan2(this.y,this.x)},angleTo(e){return Math.atan2(this.y-e.y,this.x-e.x)},angleWith(e){return this.angleWithSep(e.x,e.y)},angleWithSep(e,t){return Math.atan2(this.x*t-this.y*e,this.x*e+this.y*t)},_matMult(e){const t=e[2]*this.x+e[3]*this.y;return this.x=e[0]*this.x+e[1]*this.y,this.y=t,this},_add(e){return this.x+=e.x,this.y+=e.y,this},_sub(e){return this.x-=e.x,this.y-=e.y,this},_mult(e){return this.x*=e,this.y*=e,this},_div(e){return this.x/=e,this.y/=e,this},_multByPoint(e){return this.x*=e.x,this.y*=e.y,this},_divByPoint(e){return this.x/=e.x,this.y/=e.y,this},_unit(){return this._div(this.mag()),this},_perp(){const e=this.y;return this.y=this.x,this.x=-e,this},_rotate(e){const t=Math.cos(e),r=Math.sin(e),n=r*this.x+t*this.y;return this.x=t*this.x-r*this.y,this.y=n,this},_rotateAround(e,t){const r=Math.cos(e),n=Math.sin(e),i=t.y+n*(this.x-t.x)+r*(this.y-t.y);return this.x=t.x+r*(this.x-t.x)-n*(this.y-t.y),this.y=i,this},_round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this},constructor:oe},oe.convert=function(e){if(e instanceof oe)return e;if(Array.isArray(e))return new oe(+e[0],+e[1]);if(void 0!==e.x&&void 0!==e.y)return new oe(+e.x,+e.y);throw new Error("Expected [x, y] or {x, y} point format")};const le=Math.PI/180,ue=180/Math.PI;function ce(e){return e*le}function he(e){return e*ue}function pe(e,t,r){return Math.min(r,Math.max(t,e))}function de(e,t,r){return(r=pe((r-e)/(t-e),0,1))*r*(3-2*r)}function fe(e,t,r){const n=r-t,i=((e-t)%n+n)%n+t;return i===t?r:i}function me(e,t){e.forEach(e=>{t[e]&&(t[e]=t[e].bind(t))})}function ye(e,t,r){const n={};for(const i in e)n[i]=t.call(this,e[i],i,e);return n}function ge(e){return Array.isArray(e)?e.map(ge):"object"==typeof e&&e?ye(e,ge):e}function xe(e,t){for(let r=0;r<e.length;r++)if(t.includes(e[r]))return!0;return!1}!function(e,t,r,n){const i=new se(e,t,r,n)}(.25,.1,.25,1);const ve={};function be(e){ve[e]||(ve[e]=!0)}function we(e,t,r){return(r.y-e.y)*(t.x-e.x)>(t.y-e.y)*(r.x-e.x)}function _e(e){let t=0;for(let r,n,i=0,s=e.length,o=s-1;i<s;o=i++)r=e[i],n=e[o],t+=(n.x-r.x)*(r.y+n.y);return t}function Ie(e){return("undefined"!=typeof self||void 0!==e)&&"undefined"!=typeof WorkerGlobalScope&&(void 0!==e?e:self)instanceof WorkerGlobalScope}function Ae(e){const t={};if(e.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(e,r,n,i)=>{const s=n||i;return t[r]=!s||s.toLowerCase(),""}),t["max-age"]){const e=parseInt(t["max-age"],10);isNaN(e)?delete t["max-age"]:t["max-age"]=e}return t}function Se(e){return e?{cacheControl:e.get("cache-control"),expires:e.get("expires")}:{cacheControl:void 0,expires:void 0}}let Me;function Be(e,t){return[e[4*t],e[4*t+1],e[4*t+2],e[4*t+3]]}function Pe(e,t,r,n){for(;t<r;){const i=t+r>>1;e[i]<n?t=i+1:r=i}return t}function ze(e,t,r,n){for(;t<r;){const i=t+r>>1;e[i]<=n?t=i+1:r=i}return t}function Te(e,t,r){return(e-t.min)*(r.max-r.min)/(t.max-t.min)+r.min}const ke={API_URL:"https://api.mapbox.com",API_URL_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i,API_TILEJSON_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i,API_SPRITE_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i,API_FONTS_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i,API_STYLE_REGEX:/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i,API_CDN_URL_REGEX:/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i,get EVENTS_URL(){if(!ke.API_URL)return null;try{const e=new URL(ke.API_URL);return"api.mapbox.cn"===e.hostname?"https://events.mapbox.cn/events/v2":"api.mapbox.com"===e.hostname?"https://events.mapbox.com/events/v2":null}catch(C){return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!1,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"/mapbox-gl-js/building-gen/building_gen_v1.2.4.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1",TILE_PROVIDER_URLS:Object.assign(/* @__PURE__ */Object.create(null),{pmtiles:"/mapbox-gl-js/mapbox-gl-pmtiles-provider-v0.0.1.js"})};function Ve(){return new URL(ke.BUILDING_GEN_URL,ke.API_URL).href}function Ee(e){return ke.API_URL_REGEX.test(e)}let De,Ce,Fe,Le,Re,Oe;function Ue(){return null==De&&(De=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&"function"==typeof self.createImageBitmap),De}const Ne={requestIdleCallback:e=>{if("undefined"!=typeof requestIdleCallback)return requestIdleCallback(e);setTimeout(()=>e({didTimeout:!1,timeRemaining:()=>50}),0)},now:()=>void 0!==Le?Le:performance.now(),setNow(e){Le=e},restoreNow(){Le=void 0},frame(e){const t=requestAnimationFrame(e);return{cancel:()=>cancelAnimationFrame(t)}},getImageData(e,t=0){const{width:r,height:n}=e;Re||(Re=document.createElement("canvas"));const i=Re.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return(r>Re.width||n>Re.height)&&(Re.width=r,Re.height=n),i.clearRect(-t,-t,r+2*t,n+2*t),i.drawImage(e,0,0,r,n),i.getImageData(-t,-t,r+2*t,n+2*t)},resolveURL:e=>(Ce||(Ce=document.createElement("a")),Ce.href=e,Ce.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(null==Fe&&(Fe=window.matchMedia("(prefers-reduced-motion: reduce)")),Fe.matches)},hasCanvasFingerprintNoise(){if(void 0!==Oe)return Oe;if(!Ue())return Oe=!1,!1;const e=new OffscreenCanvas(85,1),t=e.getContext("2d",{willReadFrequently:!0});let r=0;for(let i=0;i<e.width;++i)t.fillStyle=`rgba(${r++},${r++},${r++}, 255)`,t.fillRect(i,0,1,1);const n=t.getImageData(0,0,e.width,e.height);r=0;for(let i=0;i<n.data.length;++i)if(i%4!=3&&r++!==n.data[i])return Oe=!0,!0;return Oe=!1,!1}};function je(e,t){const r=e.indexOf("?");if(r<0)return`${e}?${new URLSearchParams(t).toString()}`;const n=new URLSearchParams(e.slice(r));for(const i in t)n.set(i,t[i]);return`${e.slice(0,r)}?${n.toString()}`}function $e(e,t={persistentParams:[]}){const r=e.indexOf("?");if(r<0)return e;const n=new URLSearchParams,i=new URLSearchParams(e.slice(r));for(const o of t.persistentParams){const e=i.get(o);e&&n.set(o,e)}const s=n.toString();return`${e.slice(0,r)}${s.length>0?`?${s}`:""}`}const Ge=["language","worldview","jobid"];let Xe;function qe(){const e=function(){try{return caches}catch(e){}}();e&&null==Xe&&(Xe=e.open("mapbox-tiles"))}const He={supported:!1,testSupport:function(e){!We&&Ye&&(Je?Qe(e):Ze=e)}};let Ze,Ye,We=!1,Je=!1;const Ke="undefined"!=typeof self?self:{};function Qe(e){const t=e.createTexture();e.bindTexture(e.TEXTURE_2D,t);try{if(e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,Ye),e.isContextLost())return;He.supported=!0}catch(r){}e.deleteTexture(t),We=!0}Ke.document&&(Ye=Ke.document.createElement("img"),Ye.onload=function(){Ze&&Qe(Ze),Ze=null,Je=!0},Ye.onerror=function(){We=!0,Ze=null},Ye.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const et={Unknown:"Unknown",Style:"Style",Source:"Source",Tile:"Tile",Glyphs:"Glyphs",SpriteImage:"SpriteImage",SpriteJSON:"SpriteJSON",Iconset:"Iconset",Image:"Image",Model:"Model"};Object.freeze(et);class tt extends Error{constructor(e,t,r){401===t&&Ee(r)&&(e+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(e),this.status=t,this.url=r}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const rt=Ie()?()=>self.worker.referrer:()=>("blob:"===location.protocol?parent:self).location.href,nt=/^\w+:/,it=/[\r\n]+/,st=function(e,t){return(r=e.url).startsWith("file:")||rt().startsWith("file:")&&!nt.test(r)?function(e,t){const r=new XMLHttpRequest;r.open(e.method||"GET",e.url,!0),"arrayBuffer"===e.type&&(r.responseType="arraybuffer");for(const n in e.headers)r.setRequestHeader(n,e.headers[n]);return"json"===e.type&&(r.responseType="text",r.setRequestHeader("Accept","application/json")),r.withCredentials="include"===e.credentials,r.onerror=()=>{t(new Error(r.statusText))},r.onload=()=>{if((r.status>=200&&r.status<300||0===r.status)&&null!==r.response){let i=r.response;if("json"===e.type)try{i=JSON.parse(r.response)}catch(n){return t(n)}const s=new Headers;r.getAllResponseHeaders().trim().split(it).forEach(e=>{const t=e.split(": "),r=t.shift(),n=t.join(": ");s.append(r,n)}),t(null,i,s)}else t(new tt(r.statusText,r.status,e.url))},r.send(e.body),{cancel:()=>r.abort()}}(e,t):function(e,t){const r=new AbortController,n=new Request(e.url,{method:e.method||"GET",body:e.body,credentials:e.credentials,headers:e.headers,referrer:rt(),referrerPolicy:e.referrerPolicy,signal:r.signal});let i=!1,s=!1;const o=(a=n.url).indexOf("sku=")>0&&Ee(a);var a;"json"===e.type&&n.headers.set("Accept","application/json");const l=(r,i,a)=>{if(s)return;if(r&&"SecurityError"!==r.message&&be(r.toString()),i&&a)return u(i);const l=Date.now();fetch(n).then(r=>{if(r.ok){const e=o?r.clone():null;return u(r,e,l)}return t(new tt(r.statusText,r.status,e.url))}).catch(r=>{"AbortError"!==r.name&&t(new Error(`${r.message} ${e.url}`))})},u=(r,o,a)=>{("arrayBuffer"===e.type?r.arrayBuffer():"json"===e.type?r.json():r.text()).then(e=>{s||(o&&a&&function(e,t,r){if(qe(),null==Xe)return;const n=Ae(t.headers.get("cache-control")||"");if(n["no-store"])return;const i={status:t.status,statusText:t.statusText,headers:new Headers};t.headers.forEach((e,t)=>i.headers.set(t,e)),n["max-age"]&&i.headers.set("Expires",new Date(r+1e3*n["max-age"]).toUTCString());const s=i.headers.get("expires");if(!s)return;if(new Date(s).getTime()-r<42e4)return;let o=$e(e.url,{persistentParams:Ge});if(206===t.status){const t=e.headers.get("Range");if(!t)return;i.status=200,o=je(o,{range:t})}const a=new Response(200!==(l=t.status)&&404!==l&&[101,103,204,205,304].includes(l)?null:t.body,i);var l;qe(),null!=Xe&&Xe.then(e=>e.put(o,a)).catch(e=>be(e.message))}(n,o,a),i=!0,t(null,e,r.headers))}).catch(e=>{s||t(new Error(e.message))})};return o?function(e,t){if(qe(),null==Xe)return t(null);Xe.then(r=>{let n=$e(e.url,{persistentParams:Ge});const i=e.headers.get("Range");i&&(n=je(n,{range:i})),r.match(n).then(e=>{const i=function(e){if(!e)return!1;const t=new Date(e.headers.get("expires")||0),r=Ae(e.headers.get("cache-control")||"");return Number(t)>Date.now()&&!r["no-cache"]}(e);r.delete(n).catch(t),i&&r.put(n,e.clone()).catch(t),t(null,e,i)}).catch(t)}).catch(t)}(n,l):l(null,null),{cancel:()=>{s=!0,i||r.abort()}}}(e,t);var r},ot=function(e,t){return st(Object.assign(e,{type:"arrayBuffer"}),t)};let at,lt;at=[],lt=0;const ut=function(e,t){if(He.supported&&(e.headers||(e.headers={}),e.headers.accept="image/webp,*/*"),lt>=ke.MAX_PARALLEL_IMAGE_REQUESTS){const r={requestParameters:e,callback:t,cancelled:!1,cancel(){this.cancelled=!0}};return at.push(r),r}lt++;let r=!1;const n=()=>{if(!r)for(r=!0,lt--;at.length&<<ke.MAX_PARALLEL_IMAGE_REQUESTS;){const e=at.shift(),{requestParameters:t,callback:r,cancelled:n}=e;n||(e.cancel=ut(t,r).cancel)}},i=ot(e,(e,r,i)=>{n(),e?t(e):r&&function(e,t){const r=new Blob([new Uint8Array(e)],{type:"image/png"});createImageBitmap(r).then(e=>{t(null,e)}).catch(e=>{t(new Error(`Could not load image because of ${e.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(r,(e,r)=>t(e,r,i))});return{cancel:()=>{i.cancel(),n()}}};var ct,ht,pt,dt={exports:{}},ft={exports:{}},mt={exports:{}},yt=function(){if(pt)return dt.exports;pt=1;var e=(ct||(ct=1,ft.exports=function(e,t){var r,n,i,s,o,a,l,u;for(n=e.length-(r=3&e.length),i=t,o=3432918353,a=461845907,u=0;u<n;)l=255&e.charCodeAt(u)|(255&e.charCodeAt(++u))<<8|(255&e.charCodeAt(++u))<<16|(255&e.charCodeAt(++u))<<24,++u,i=27492+(65535&(s=5*(65535&(i=(i^=l=(65535&(l=(l=(65535&l)*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295)<<13|i>>>19))+((5*(i>>>16)&65535)<<16)&4294967295))+(((s>>>16)+58964&65535)<<16);switch(l=0,r){case 3:l^=(255&e.charCodeAt(u+2))<<16;case 2:l^=(255&e.charCodeAt(u+1))<<8;case 1:i^=l=(65535&(l=(l=(65535&(l^=255&e.charCodeAt(u)))*o+(((l>>>16)*o&65535)<<16)&4294967295)<<15|l>>>17))*a+(((l>>>16)*a&65535)<<16)&4294967295}return i^=e.length,i=2246822507*(65535&(i^=i>>>16))+((2246822507*(i>>>16)&65535)<<16)&4294967295,i=3266489909*(65535&(i^=i>>>13))+((3266489909*(i>>>16)&65535)<<16)&4294967295,(i^=i>>>16)>>>0}),ft.exports),t=(ht||(ht=1,mt.exports=function(e,t){for(var r,n=e.length,i=t^n,s=0;n>=4;)r=1540483477*(65535&(r=255&e.charCodeAt(s)|(255&e.charCodeAt(++s))<<8|(255&e.charCodeAt(++s))<<16|(255&e.charCodeAt(++s))<<24))+((1540483477*(r>>>16)&65535)<<16),i=1540483477*(65535&i)+((1540483477*(i>>>16)&65535)<<16)^(r=1540483477*(65535&(r^=r>>>24))+((1540483477*(r>>>16)&65535)<<16)),n-=4,++s;switch(n){case 3:i^=(255&e.charCodeAt(s+2))<<16;case 2:i^=(255&e.charCodeAt(s+1))<<8;case 1:i=1540483477*(65535&(i^=255&e.charCodeAt(s)))+((1540483477*(i>>>16)&65535)<<16)}return i=1540483477*(65535&(i^=i>>>13))+((1540483477*(i>>>16)&65535)<<16),(i^=i>>>15)>>>0}),mt.exports);return dt.exports=e,dt.exports.murmur3=e,dt.exports.murmur2=t,dt.exports}();const gt=ne(yt);class xt{constructor(e,...t){Object.assign(this,t[0]||{}),this.type=e}}class vt extends xt{constructor(e,t={}){super("error",Object.assign({error:e},t))}}function bt(e,t,r){r[e]&&r[e].includes(t)||(r[e]=r[e]||[],r[e].push(t))}function wt(e,t,r){if(r&&r[e]){const n=r[e].indexOf(t);-1!==n&&r[e].splice(n,1)}}class _t{on(e,t){return this._listeners=this._listeners||{},bt(e,t,this._listeners),this}off(e,t){return wt(e,t,this._listeners),wt(e,t,this._oneTimeListeners),this}once(e,t){return t?(this._oneTimeListeners=this._oneTimeListeners||{},bt(e,t,this._oneTimeListeners),this):new Promise(t=>{this.once(e,t)})}fire(e,t){const r="string"==typeof e?new xt(e,t):e,n=r.type;if(this.listens(n)){r.target=this;const e=this._listeners&&this._listeners[n]?this._listeners[n].slice():[];for(const n of e)n.call(this,r);const t=this._oneTimeListeners&&this._oneTimeListeners[n]?this._oneTimeListeners[n].slice():[];for(const s of t)wt(n,s,this._oneTimeListeners),s.call(this,r);const i=this._eventedParent;if(i){const e="function"==typeof this._eventedParentData?this._eventedParentData():this._eventedParentData;Object.assign(r,e),i.fire(r)}}return this}listens(e){return!!(this._listeners&&this._listeners[e]&&this._listeners[e].length>0||this._oneTimeListeners&&this._oneTimeListeners[e]&&this._oneTimeListeners[e].length>0||this._eventedParent&&this._eventedParent.listens(e))}setEventedParent(e,t){return this._eventedParent=e,this._eventedParentData=t,this}}class It{constructor(e){"string"==typeof e?this.name=e:(this.name=e.name,this.iconsetId=e.iconsetId)}static from(e){return new It(e)}static toString(e){return e.iconsetId?`${e.name}${e.iconsetId}`:e.name}static parse(e){const[t,r]=e.split("");return new It({name:t,iconsetId:r})}static isEqual(e,t){return e.name===t.name&&e.iconsetId===t.iconsetId}toString(){return It.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var At,St={},Mt=function(){if(At)return St;At=1;var e={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function t(e){return(e=Math.round(e))<0?0:e>255?255:e}function r(e){return t("%"===e[e.length-1]?parseFloat(e)/100*255:parseInt(e))}function n(e){return(t="%"===e[e.length-1]?parseFloat(e)/100:parseFloat(e))<0?0:t>1?1:t;var t}function i(e,t,r){return r<0?r+=1:r>1&&(r-=1),6*r<1?e+(t-e)*r*6:2*r<1?t:3*r<2?e+(t-e)*(2/3-r)*6:e}try{St.parseCSSColor=function(s){var o,a=s.replace(/ /g,"").toLowerCase();if(a in e)return e[a].slice();if("#"===a[0])return 4===a.length?(o=parseInt(a.substr(1),16))>=0&&o<=4095?[(3840&o)>>4|(3840&o)>>8,240&o|(240&o)>>4,15&o|(15&o)<<4,1]:null:7===a.length&&(o=parseInt(a.substr(1),16))>=0&&o<=16777215?[(16711680&o)>>16,(65280&o)>>8,255&o,1]:null;var l=a.indexOf("("),u=a.indexOf(")");if(-1!==l&&u+1===a.length){var c=a.substr(0,l),h=a.substr(l+1,u-(l+1)).split(","),p=1;switch(c){case"rgba":if(4!==h.length)return null;p=n(h.pop());case"rgb":return 3!==h.length?null:[r(h[0]),r(h[1]),r(h[2]),p];case"hsla":if(4!==h.length)return null;p=n(h.pop());case"hsl":if(3!==h.length)return null;var d=(parseFloat(h[0])%360+360)%360/360,f=n(h[1]),m=n(h[2]),y=m<=.5?m*(f+1):m+f-m*f,g=2*m-y;return[t(255*i(g,y,d+1/3)),t(255*i(g,y,d)),t(255*i(g,y,d-1/3)),p];default:return null}}return null}}catch(s){}return St}();function Bt(e,t,r){return e*(1-r)+t*r}class Pt{constructor(e,t,r,n=1){this.r=e,this.g=t,this.b=r,this.a=n}static parse(e){if(!e)return;if(e instanceof Pt)return e;if("string"!=typeof e)return;const t=Mt.parseCSSColor(e);return t?new Pt(t[0]/255,t[1]/255,t[2]/255,t[3]):void 0}toString(){const[e,t,r,n]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*e)},${Math.round(255*t)},${Math.round(255*r)},${n})`}toNonPremultipliedRenderColor(e){const{r:t,g:r,b:n,a:i}=this;return new Tt(e,t,r,n,i)}toPremultipliedRenderColor(e){const{r:t,g:r,b:n,a:i}=this;return new kt(e,t*i,r*i,n*i,i)}clone(){return new Pt(this.r,this.g,this.b,this.a)}}class zt{constructor(e,t,r,n,i,s=!1){if(this.premultiplied=!1,this.premultiplied=s,e){const s=e.image.height,o=s*s;this.premultiplied?(t=0===i?0:t/i*(s-1),r=0===i?0:r/i*(s-1),n=0===i?0:n/i*(s-1)):(t*=s-1,r*=s-1,n*=s-1),t=Math.max(0,Math.min(s-1,t)),r=Math.max(0,Math.min(s-1,r)),n=Math.max(0,Math.min(s-1,n));const a=Math.floor(t),l=Math.floor(r),u=Math.floor(n),c=Math.ceil(t),h=Math.ceil(r),p=Math.ceil(n),d=t-a,f=r-l,m=n-u,y=e.image.data,g=4*(a+l*o+u*s),x=4*(a+l*o+p*s),v=4*(a+h*o+u*s),b=4*(a+h*o+p*s),w=4*(c+l*o+u*s),_=4*(c+l*o+p*s),I=4*(c+h*o+u*s),A=4*(c+h*o+p*s);this.r=Bt(Bt(Bt(y[g],y[x],m),Bt(y[v],y[b],m),f),Bt(Bt(y[w],y[_],m),Bt(y[I],y[A],m),f),d)/255*(this.premultiplied?i:1),this.g=Bt(Bt(Bt(y[g+1],y[x+1],m),Bt(y[v+1],y[b+1],m),f),Bt(Bt(y[w+1],y[_+1],m),Bt(y[I+1],y[A+1],m),f),d)/255*(this.premultiplied?i:1),this.b=Bt(Bt(Bt(y[g+2],y[x+2],m),Bt(y[v+2],y[b+2],m),f),Bt(Bt(y[w+2],y[_+2],m),Bt(y[I+2],y[A+2],m),f),d)/255*(this.premultiplied?i:1),this.a=i}else this.r=t,this.g=r,this.b=n,this.a=i}toArray(){const{r:e,g:t,b:r,a:n}=this;return[255*e,255*t,255*r,n]}toHslaArray(){let{r:e,g:t,b:r,a:n}=this;if(this.premultiplied){if(0===n)return[0,0,0,0];const i=1/n;e*=i,t*=i,r*=i}const i=Math.min(Math.max(e,0),1),s=Math.min(Math.max(t,0),1),o=Math.min(Math.max(r,0),1),a=Math.min(i,s,o),l=Math.max(i,s,o),u=l-a,c=.5*(a+l);if(0===u)return[0,0,100*c,n];const h=c>.5?u/(2-l-a):u/(l+a);let p;switch(l){case i:p=60*((s-o)/u+(s<o?6:0));break;case s:p=60*((o-i)/u+2);break;default:p=60*((i-s)/u+4)}return[p,100*h,100*c,n]}toArray01(){const{r:e,g:t,b:r,a:n}=this;return[e,t,r,n]}toArray01Scaled(e){const{r:t,g:r,b:n}=this;return[t*e,r*e,n*e]}toArray01Linear(){const{r:e,g:t,b:r,a:n}=this;return[Math.pow(e,2.2),Math.pow(t,2.2),Math.pow(r,2.2),n]}}class Tt extends zt{constructor(e,t,r,n,i){super(e,t,r,n,i,!1)}}class kt extends zt{constructor(e,t,r,n,i){super(e,t,r,n,i,!0)}}Pt.black=new Pt(0,0,0,1),Pt.white=new Pt(1,1,1,1),Pt.transparent=new Pt(0,0,0,0),Pt.red=new Pt(1,0,0,1),Pt.blue=new Pt(0,0,1,1);const Vt=Object.freeze(Object.defineProperty({__proto__:null,array:function(e,t,r){return e.map((e,n)=>Bt(e,t[n],r))},color:function(e,t,r){return new Pt(Bt(e.r,t.r,r),Bt(e.g,t.g,r),Bt(e.b,t.b,r),Bt(e.a,t.a,r))},number:Bt},Symbol.toStringTag,{value:"Module"}));class Et extends Error{constructor(e,t){super(t),this.message=t,this.key=e}}class Dt{constructor(e,t=[]){this.parent=e,this.bindings={};for(const[r,n]of t)this.bindings[r]=n}concat(e){return new Dt(this,e)}get(e){if(this.bindings[e])return this.bindings[e];if(this.parent)return this.parent.get(e);throw new Error(`${e} not found in scope.`)}has(e){return!!this.bindings[e]||!!this.parent&&this.parent.has(e)}}const Ct={kind:"null"},Ft={kind:"number"},Lt={kind:"string"},Rt={kind:"boolean"},Ot={kind:"color"},Ut={kind:"object"},Nt={kind:"value"},jt={kind:"collator"},$t={kind:"formatted"},Gt={kind:"resolvedImage"};function Xt(e,t){return{kind:"array",itemType:e,N:t}}function qt(e){if("array"===e.kind){const t=qt(e.itemType);return"number"==typeof e.N?`array<${t}, ${e.N}>`:"value"===e.itemType.kind?"array":`array<${t}>`}return e.kind}const Ht=[Ct,Ft,Lt,Rt,Ot,$t,Ut,Xt(Nt),Gt];function Zt(e,t){if("error"===t.kind)return null;if("array"===e.kind){if("array"===t.kind&&(0===t.N&&"value"===t.itemType.kind||!Zt(e.itemType,t.itemType))&&("number"!=typeof e.N||e.N===t.N))return null}else{if(e.kind===t.kind)return null;if("value"===e.kind)for(const e of Ht)if(!Zt(e,t))return null}return`Expected ${qt(e)} but found ${qt(t)} instead.`}function Yt(e,t){return t.some(t=>t.kind===e.kind)}function Wt(e,t){return t.some(t=>"null"===t?null===e:"array"===t?Array.isArray(e):"object"===t?e&&!Array.isArray(e)&&"object"==typeof e:t===typeof e)}function Jt(e,t){return"array"===e.kind&&"array"===t.kind?e.N===t.N&&Jt(e.itemType,t.itemType):e.kind===t.kind}class Kt{constructor(e,t,r){this.sensitivity=e?t?"variant":"case":t?"accent":"base",this.locale=r,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(e,t){return this.collator.compare(e,t)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class Qt{constructor(e,t,r,n,i){this.text=e.normalize?e.normalize():e,this.image=t,this.scale=r,this.fontStack=n,this.textColor=i}}class er{constructor(e){this.sections=e}static fromString(e){return new er([new Qt(e,null,null,null,null)])}isEmpty(){return 0===this.sections.length||!this.sections.some(e=>0!==e.text.length||!!e.image&&e.image.hasPrimary())}static factory(e){return e instanceof er?e:er.fromString(e)}toString(){return 0===this.sections.length?"":this.sections.map(e=>e.text).join("")}serialize(){const e=["format"];for(const t of this.sections){if(t.image){const r=t.image.getPrimary().id.toString();e.push(["image",r]);continue}e.push(t.text);const r={};t.fontStack&&(r["text-font"]=["literal",t.fontStack.split(",")]),t.scale&&(r["font-scale"]=t.scale),t.textColor&&(r["text-color"]=["rgba"].concat(t.textColor.toNonPremultipliedRenderColor(null).toArray())),e.push(r)}return e}}class tr{constructor(e,t={}){this.id=It.from(e),this.params=t.params,this.sx=t.sx||1,this.sy=t.sy||1}toString(){return JSON.stringify(this)}static parse(e){let t,r,n,i;try{({id:t,params:r,sx:n,sy:i}=JSON.parse(e)||{})}catch(s){return null}return t?new tr(t,{params:r,sx:n,sy:i}):null}scaleSelf(e,t=e){return this.sx*=e,this.sy*=t,this}}class rr{constructor(e,t,r,n,i=!1){this.primaryId=It.from(e),this.primaryOptions=t,r&&(this.secondaryId=It.from(r)),this.secondaryOptions=n,this.available=i}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new tr(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new tr(this.secondaryId,this.secondaryOptions):null}static from(e){return"string"==typeof e?rr.build({name:e}):e}static build(e,t,r,n){return!e||"object"==typeof e&&!("name"in e)?null:new rr(e,r,t,n)}}function nr(e,t,r,n){return"number"==typeof e&&e>=0&&e<=255&&"number"==typeof t&&t>=0&&t<=255&&"number"==typeof r&&r>=0&&r<=255?void 0===n||"number"==typeof n&&n>=0&&n<=1?null:`Invalid rgba value [${[e,t,r,n].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${("number"==typeof n?[e,t,r,n]:[e,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function ir(e){if(null===e)return!0;if("string"==typeof e)return!0;if("boolean"==typeof e)return!0;if("number"==typeof e)return!0;if(e instanceof Pt)return!0;if(e instanceof Kt)return!0;if(e instanceof er)return!0;if(e instanceof rr)return!0;if(Array.isArray(e)){for(const t of e)if(!ir(t))return!1;return!0}if("object"==typeof e){for(const t in e)if(!ir(e[t]))return!1;return!0}return!1}function sr(e){if(null===e)return Ct;if("string"==typeof e)return Lt;if("boolean"==typeof e)return Rt;if("number"==typeof e)return Ft;if(e instanceof Pt)return Ot;if(e instanceof Kt)return jt;if(e instanceof er)return $t;if(e instanceof rr)return Gt;if(Array.isArray(e)){const t=e.length;let r;for(const n of e){const e=sr(n);if(r){if(r===e)continue;r=Nt;break}r=e}return Xt(r||Nt,t)}return Ut}function or(e){const t=typeof e;return null===e?"":"string"===t||"number"===t||"boolean"===t?String(e):e instanceof er||e instanceof rr||e instanceof Pt?e.toString():JSON.stringify(e)}class ar{constructor(e,t){this.type=e,this.value=t}static parse(e,t){if(2!==e.length)return t.error(`'literal' expression requires exactly one argument, but found ${e.length-1} instead.`);if(!ir(e[1]))return t.error("invalid value");const r=e[1];let n=sr(r);const i=t.expectedType;return"array"!==n.kind||0!==n.N||!i||"array"!==i.kind||"number"==typeof i.N&&0!==i.N||(n=i),new ar(n,r)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return"array"===this.type.kind||"object"===this.type.kind?["literal",this.value]:this.value instanceof Pt?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof er?this.value.serialize():this.value}}class lr{constructor(e){this.name="ExpressionEvaluationError",this.message=e}toJSON(){return this.message}}const ur={string:Lt,number:Ft,boolean:Rt,object:Ut};class cr{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");let r,n=1;const i=e[0];if("array"===i){let i,s;if(e.length>2){const r=e[1];if("string"!=typeof r||!(r in ur)||"object"===r)return t.error('The item type argument of "array" must be one of string, number, boolean',1);i=ur[r],n++}else i=Nt;if(e.length>3){if(null!==e[2]&&("number"!=typeof e[2]||e[2]<0||e[2]!==Math.floor(e[2])))return t.error('The length argument to "array" must be a positive integer literal',2);s=e[2],n++}r=Xt(i,s)}else r=ur[i];const s=[];for(;n<e.length;n++){const r=t.parse(e[n],n,Nt);if(!r)return null;s.push(r)}return new cr(r,s)}evaluate(e){for(let t=0;t<this.args.length;t++){const r=this.args[t].evaluate(e);if(!Zt(this.type,sr(r)))return r;if(t===this.args.length-1)throw new lr(`The expression ${JSON.stringify(this.args[t].serialize())} evaluated to ${qt(sr(r))} but was expected to be of type ${qt(this.type)}.`)}return null}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=this.type,t=[e.kind];if("array"===e.kind){const r=e.itemType;if("string"===r.kind||"number"===r.kind||"boolean"===r.kind){t.push(r.kind);const n=e.N;("number"==typeof n||this.args.length>1)&&t.push(n)}}return t.concat(this.args.map(e=>e.serialize()))}}class hr{constructor(e){this.type=$t,this.sections=e}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const r=e[1];if(!Array.isArray(r)&&"object"==typeof r)return t.error("First argument must be an image or text section.");const n=[];let i=!1;for(let s=1;s<=e.length-1;++s){const r=e[s];if(i&&"object"==typeof r&&!Array.isArray(r)){i=!1;let e=null;if(r["font-scale"]&&(e=t.parseObjectValue(r["font-scale"],s,"font-scale",Ft),!e))return null;let o=null;if(r["text-font"]&&(o=t.parseObjectValue(r["text-font"],s,"text-font",Xt(Lt)),!o))return null;let a=null;if(r["text-color"]&&(a=t.parseObjectValue(r["text-color"],s,"text-color",Ot),!a))return null;const l=n.at(-1);l.scale=e,l.font=o,l.textColor=a}else{const r=t.parse(e[s],s,Nt);if(!r)return null;const o=r.type.kind;if("string"!==o&&"value"!==o&&"null"!==o&&"resolvedImage"!==o)return t.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");i=!0,n.push({content:r,scale:null,font:null,textColor:null})}}return new hr(n)}evaluate(e){return new er(this.sections.map(t=>{const r=t.content.evaluate(e);return Jt(sr(r),Gt)?new Qt("",r,null,null,null):new Qt(or(r),null,t.scale?t.scale.evaluate(e):null,t.font?t.font.evaluate(e).join(","):null,t.textColor?t.textColor.evaluate(e):null)}))}eachChild(e){for(const t of this.sections)e(t.content),t.scale&&e(t.scale),t.font&&e(t.font),t.textColor&&e(t.textColor)}outputDefined(){return!1}serialize(){const e=["format"];for(const t of this.sections){e.push(t.content.serialize());const r={};t.scale&&(r["font-scale"]=t.scale.serialize()),t.font&&(r["text-font"]=t.font.serialize()),t.textColor&&(r["text-color"]=t.textColor.serialize()),e.push(r)}return e}}class pr{constructor(e,t,r,n){this._imageWarnHistory={},this.type=Gt,this.namePrimary=e,this.nameSecondary=t,r&&(this.paramsPrimary=r.params,this.iconsetIdPrimary=r.iconset?r.iconset.id:void 0),n&&(this.paramsSecondary=n.params,this.iconsetIdSecondary=n.iconset?n.iconset.id:void 0)}static parse(e,t){if(e.length<2)return t.error("Expected two or more arguments.");let r=1;const n=[];function i(){if(r<e.length){const i=t.parse(e[r],r++,Lt);return i?(n.push({image:i,options:{}}),!0):(t.error(n.length?"Secondary image variant is not a string.":"No image name provided."),!1)}return!0}function s(){if(r<e.length){const s=e[r];if(null===(i=s)||"object"!=typeof i||Array.isArray(i))return!0;const o=s.params,a=s.iconset,l=t.concat(r);if(!o&&!a)return r++,!0;if(o){if("object"!=typeof o||o.constructor!==Object)return l.error('Image options "params" should be an object'),!1;const e={},t=l.concat(void 0,"params");for(const r in o){if(!r)return t.error("Image parameter name should be non-empty"),!1;const n=t.concat(void 0,r).parse(o[r],void 0,Ot,void 0,{typeAnnotation:"coerce"});if(!n)return!1;e[r]=n}n.at(-1).options.params=e}if(a){if("object"!=typeof a||a.constructor!==Object)return l.error('Image options "iconset" should be an object'),!1;if(!a.id)return l.error('Image options "iconset" should have an "id" property'),!1;n.at(-1).options.iconset=a}return r++,!0}var i;return!0}for(let o=0;o<2;o++)if(!i()||!s())return;return new pr(n[0].image,n[1]?n[1].image:void 0,n[0].options,n[1]?n[1].options:void 0)}evaluateParams(e,t){const r={};if(t){for(const i in t)if(t[i])try{r[i]=t[i].evaluate(e)}catch(n){continue}if(0!==Object.keys(r).length)return{params:r}}}evaluate(e){const t={name:this.namePrimary.evaluate(e),iconsetId:this.iconsetIdPrimary},r=this.nameSecondary?{name:this.nameSecondary.evaluate(e),iconsetId:this.iconsetIdSecondary}:void 0,n=rr.build(t,r,this.paramsPrimary?this.evaluateParams(e,this.paramsPrimary):void 0,this.paramsSecondary?this.evaluateParams(e,this.paramsSecondary):void 0);if(n&&e.availableImages){const t=n.getPrimary().id;if(n.available=e.availableImages.some(e=>It.isEqual(e,t)),n.available){const t=n.getSecondary()?n.getSecondary().id:null;t&&(n.available=e.availableImages.some(e=>It.isEqual(e,t)))}}return n}eachChild(e){if(e(this.namePrimary),this.paramsPrimary)for(const t in this.paramsPrimary)this.paramsPrimary[t]&&e(this.paramsPrimary[t]);if(this.nameSecondary&&(e(this.nameSecondary),this.paramsSecondary))for(const t in this.paramsSecondary)this.paramsSecondary[t]&&e(this.paramsSecondary[t])}outputDefined(){return!1}serializeOptions(e,t){const r={};if(t&&(r.iconset={id:t}),e){r.params={};for(const t in e)e[t]&&(r.params[t]=e[t].serialize())}return Object.keys(r).length>0?r:void 0}serialize(){const e=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const t=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);t&&e.push(t)}if(this.nameSecondary&&(e.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const t=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);t&&e.push(t)}return e}}function dr(e){return function(e){return"string"==typeof e||e instanceof String}(e)?"string":fr(e)?"number":function(e){return"boolean"==typeof e||e instanceof Boolean}(e)?"boolean":Array.isArray(e)?"array":null===e?"null":function(e){return null!=e&&!Array.isArray(e)&&"function"!=typeof e&&!(e instanceof String||e instanceof Number||e instanceof Boolean)&&"object"==typeof e}(e)?"object":typeof e}function fr(e){return"number"==typeof e||e instanceof Number}const mr={"to-boolean":Rt,"to-color":Ot,"to-number":Ft,"to-string":Lt};class yr{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expected at least one argument.");const r=e[0],n=[];let i=Ct;if("to-array"===r){if(!Array.isArray(e[1]))return null;const r=e[1].length;if(t.expectedType){if("array"!==t.expectedType.kind)return t.error(`Expected ${t.expectedType.kind} but found array.`);i=Xt(t.expectedType.itemType,r)}else{if(!(r>0&&ir(e[1][0])))return null;i=Xt(sr(e[1][0]),r)}for(let s=0;s<r;s++){const r=e[1][s];let o;if(Array.isArray(r))o=t.parse(r,void 0,i.itemType);else{const e=dr(r);if(e!==i.itemType.kind)return t.error(`Expected ${i.itemType.kind} but found ${e}.`);o=t.registry.literal.parse(["literal",void 0===r?null:r],t)}if(!o)return null;n.push(o)}}else{if(("to-boolean"===r||"to-string"===r)&&2!==e.length)return t.error("Expected one argument.");i=mr[r];for(let r=1;r<e.length;r++){const i=t.parse(e[r],r,Nt);if(!i)return null;n.push(i)}}return new yr(i,n)}evaluate(e){if("boolean"===this.type.kind)return Boolean(this.args[0].evaluate(e));if("color"===this.type.kind){let t,r;for(const n of this.args){if(t=n.evaluate(e),r=null,t instanceof Pt)return t;if("string"==typeof t){const r=e.parseColor(t);if(r)return r}else if(Array.isArray(t)&&(r=t.length<3||t.length>4?`Invalid rbga value ${JSON.stringify(t)}: expected an array containing either three or four numeric values.`:nr(t[0],t[1],t[2],t[3]),!r))return new Pt(t[0]/255,t[1]/255,t[2]/255,t[3])}throw new lr(r||`Could not parse color from value '${"string"==typeof t?t:String(JSON.stringify(t))}'`)}if("number"===this.type.kind){let t=null;for(const r of this.args){if(t=r.evaluate(e),null===t)return 0;const n=Number(t);if(!isNaN(n))return n}throw new lr(`Could not convert ${JSON.stringify(t)} to number.`)}return"formatted"===this.type.kind?er.fromString(or(this.args[0].evaluate(e))):"resolvedImage"===this.type.kind?rr.build(or(this.args[0].evaluate(e))):"array"===this.type.kind?this.args.map(t=>t.evaluate(e)):or(this.args[0].evaluate(e))}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){if("formatted"===this.type.kind)return new hr([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if("resolvedImage"===this.type.kind)return new pr(this.args[0]).serialize();const e="array"===this.type.kind?[]:[`to-${this.type.kind}`];return this.eachChild(t=>{e.push(t.serialize())}),e}}const gr=["Unknown","Point","LineString","Polygon"];class xr{constructor(e,t,r){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=e,this.options=t,this.iconImageUseTheme=r}id(){return this.feature&&void 0!==this.feature.id?this.feature.id:null}geometryType(){return this.feature?"number"==typeof this.feature.type?gr[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(e){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const e=this.featureDistanceData.center,t=this.featureDistanceData.scale,{x:r,y:n}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(r*t-e[0])+this.featureDistanceData.bearing[1]*(n*t-e[1])}return 0}parseColor(e){let t=this._parseColorCache[e];return t||(t=this._parseColorCache[e]=Pt.parse(e)),t}getConfig(e){return this.options?this.options.get(e):null}}class vr{constructor(e,t,r,n,i){this.name=e,this.type=t,this._evaluate=r,this.args=n,this._overloadIndex=i}evaluate(e){if(!this._evaluate){const e=vr.definitions[this.name];this._evaluate=Array.isArray(e)?e[2]:e.overloads[this._overloadIndex][1]}return this._evaluate(e,this.args)}eachChild(e){this.args.forEach(e)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(e=>e.serialize()))}static parse(e,t){const r=e[0],n=vr.definitions[r];if(!n)return t.error(`Unknown expression "${r}". If you wanted a literal array, use ["literal", [...]].`,0);const i=Array.isArray(n)?n[0]:n.type,s=Array.isArray(n)?[[n[1],n[2]]]:n.overloads,o=[];let a=null,l=-1;for(const[u,c]of s){if(Array.isArray(u)&&u.length!==e.length-1)continue;o.push(u),l++,a=new On(t.registry,t.path,null,t.scope,void 0,t._scope,t.options,t.iconImageUseTheme);const n=[];let s=!1;for(let t=1;t<e.length;t++){const r=e[t],i=Array.isArray(u)?u[t-1]:u.type,o=a.parse(r,1+n.length,i);if(!o){s=!0;break}n.push(o)}if(!s)if(Array.isArray(u)&&u.length!==n.length)a.error(`Expected ${u.length} arguments, but found ${n.length} instead.`);else{for(let e=0;e<n.length;e++){const t=Array.isArray(u)?u[e]:u.type,r=n[e];a.concat(e+1).checkSubtype(t,r.type)}if(0===a.errors.length)return new vr(r,i,c,n,l)}}if(1===o.length)t.errors.push(...a.errors);else{const r=(o.length?o:s.map(([e])=>e)).map(br).join(" | "),n=[];for(let i=1;i<e.length;i++){const r=t.parse(e[i],1+n.length);if(!r)return null;n.push(qt(r.type))}t.error(`Expected arguments of type ${r}, but found (${n.join(", ")}) instead.`)}return null}static register(e,t){vr.definitions=t;for(const r in t)e[r]=vr}}function br(e){return Array.isArray(e)?`(${e.map(qt).join(", ")})`:`(${qt(e.type)}...)`}class wr{constructor(e,t,r){this.type=jt,this.locale=r,this.caseSensitive=e,this.diacriticSensitive=t}static parse(e,t){if(2!==e.length)return t.error("Expected one argument."),null;const r=e[1];if("object"!=typeof r||Array.isArray(r))return t.error("Collator options argument must be an object."),null;const n=void 0===r["case-sensitive"]?t.parse(!1,1,Rt):t.parseObjectValue(r["case-sensitive"],1,"case-sensitive",Rt);if(!n)return null;const i=void 0===r["diacritic-sensitive"]?t.parse(!1,1,Rt):t.parseObjectValue(r["diacritic-sensitive"],1,"diacritic-sensitive",Rt);if(!i)return null;let s=null;return r.locale&&(s=t.parseObjectValue(r.locale,1,"locale",Lt),!s)?null:new wr(n,i,s)}evaluate(e){return new Kt(this.caseSensitive.evaluate(e),this.diacriticSensitive.evaluate(e),this.locale?this.locale.evaluate(e):null)}eachChild(e){e(this.caseSensitive),e(this.diacriticSensitive),this.locale&&e(this.locale)}outputDefined(){return!1}serialize(){const e={};return e["case-sensitive"]=this.caseSensitive.serialize(),e["diacritic-sensitive"]=this.diacriticSensitive.serialize(),this.locale&&(e.locale=this.locale.serialize()),["collator",e]}}function _r(e,t,r=0,n=e.length-1,i=Ar){for(;n>r;){if(n-r>600){const s=n-r+1,o=t-r+1,a=Math.log(s),l=.5*Math.exp(2*a/3),u=.5*Math.sqrt(a*l*(s-l)/s)*(o-s/2<0?-1:1);_r(e,t,Math.max(r,Math.floor(t-o*l/s+u)),Math.min(n,Math.floor(t+(s-o)*l/s+u)),i)}const s=e[t];let o=r,a=n;for(Ir(e,r,t),i(e[n],s)>0&&Ir(e,r,n);o<a;){for(Ir(e,o,a),o++,a--;i(e[o],s)<0;)o++;for(;i(e[a],s)>0;)a--}0===i(e[r],s)?Ir(e,r,a):(a++,Ir(e,a,n)),a<=t&&(r=a+1),t<=a&&(n=a-1)}}function Ir(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function Ar(e,t){return e<t?-1:e>t?1:0}function Sr(e){let t=0;for(let r,n,i=0,s=e.length,o=s-1;i<s;o=i++)r=e[i],n=e[o],t+=(n.x-r.x)*(r.y+n.y);return t}function Mr(e,t){e[0]=Math.min(e[0],t[0]),e[1]=Math.min(e[1],t[1]),e[2]=Math.max(e[2],t[0]),e[3]=Math.max(e[3],t[1])}function Br(e,t){return!(e[0]<=t[0]||e[2]>=t[2]||e[1]<=t[1]||e[3]>=t[3])}function Pr(e,t,r){const n=e[0]-t[0],i=e[1]-t[1],s=e[0]-r[0],o=e[1]-r[1];return n*o-s*i===0&&n*s<=0&&i*o<=0}function zr(e,t,r){return t[1]>e[1]!=r[1]>e[1]&&e[0]<(r[0]-t[0])*(e[1]-t[1])/(r[1]-t[1])+t[0]}function Tr(e,t,r=!1){let n=!1;for(let i=0,s=t.length;i<s;i++){const s=t[i];for(let t=0,i=s.length,o=i-1;t<i;o=t++){const i=s[o],a=s[t];if(Pr(e,i,a))return r;zr(e,i,a)&&(n=!n)}}return n}function kr(e,t,r,n){const i=n[0]-r[0],s=n[1]-r[1],o=(e[0]-r[0])*s-i*(e[1]-r[1]),a=(t[0]-r[0])*s-i*(t[1]-r[1]);return o>0&&a<0||o<0&&a>0}function Vr(e,t,r,n){return 0!==(i=[n[0]-r[0],n[1]-r[1]])[0]*(s=[t[0]-e[0],t[1]-e[1]])[1]-i[1]*s[0]&&!(!kr(e,t,r,n)||!kr(r,n,e,t));var i,s}function Er(e){const t=new oe(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),r=new oe(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const n of e[0])t.x>n.x&&(t.x=n.x),t.y>n.y&&(t.y=n.y),r.x<n.x&&(r.x=n.x),r.y<n.y&&(r.y=n.y);return{min:t,max:r}}const Dr=8192;function Cr(e,t){const r=(180+e[0])/360,n=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e[1]*Math.PI/360)))/360,i=Math.pow(2,t.z);return[Math.round(r*i*Dr),Math.round(n*i*Dr)]}function Fr(e,t){for(let r=0;r<t.length;r++)if(Tr(e,t[r]))return!0;return!1}function Lr(e,t,r){for(const n of r)for(let r=0,i=n.length,s=i-1;r<i;s=r++)if(Vr(e,t,n[s],n[r]))return!0;return!1}function Rr(e,t){for(let r=0;r<e.length;++r)if(!Tr(e[r],t))return!1;for(let r=0;r<e.length-1;++r)if(Lr(e[r],e[r+1],t))return!1;return!0}function Or(e,t){for(let r=0;r<t.length;r++)if(Rr(e,t[r]))return!0;return!1}function Ur(e,t,r){const n=[];for(let i=0;i<e.length;i++){const s=[];for(let n=0;n<e[i].length;n++){const o=Cr(e[i][n],r);Mr(t,o),s.push(o)}n.push(s)}return n}function Nr(e,t,r){const n=[];for(let i=0;i<e.length;i++){const s=Ur(e[i],t,r);n.push(s)}return n}function jr(e,t,r,n){if(e[0]<r[0]||e[0]>r[2]){const t=.5*n;let i=e[0]-r[0]>t?-n:r[0]-e[0]>t?n:0;0===i&&(i=e[0]-r[2]>t?-n:r[2]-e[0]>t?n:0),e[0]+=i}Mr(t,e)}function $r(e,t,r,n){const i=Math.pow(2,n.z)*Dr,s=[n.x*Dr,n.y*Dr],o=[];if(!e)return o;for(const a of e)for(const e of a){const n=[e.x+s[0],e.y+s[1]];jr(n,t,r,i),o.push(n)}return o}function Gr(e,t,r,n){const i=Math.pow(2,n.z)*Dr,s=[n.x*Dr,n.y*Dr],o=[];if(!e)return o;for(const l of e){const e=[];for(const r of l){const n=[r.x+s[0],r.y+s[1]];Mr(t,n),e.push(n)}o.push(e)}if(t[2]-t[0]<=i/2){(a=t)[0]=a[1]=1/0,a[2]=a[3]=-1/0;for(const e of o)for(const n of e)jr(n,t,r,i)}var a;return o}class Xr{constructor(e,t){this.type=Rt,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'within' expression requires exactly one argument, but found ${e.length-1} instead.`);if(ir(e[1])){const t=e[1];if("FeatureCollection"===t.type)for(let e=0;e<t.features.length;++e){const r=t.features[e].geometry.type;if("Polygon"===r||"MultiPolygon"===r)return new Xr(t,t.features[e].geometry)}else if("Feature"===t.type){const e=t.geometry.type;if("Polygon"===e||"MultiPolygon"===e)return new Xr(t,t.geometry)}else if("Polygon"===t.type||"MultiPolygon"===t.type)return new Xr(t,t)}return t.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(e){if(null!=e.geometry()&&null!=e.canonicalID()){if("Point"===e.geometryType())return function(e,t){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if(!i)return!1;if("Polygon"===t.type){const s=Ur(t.coordinates,n,i),o=$r(e.geometry(),r,n,i);if(!Br(r,n))return!1;for(const e of o)if(!Tr(e,s))return!1}if("MultiPolygon"===t.type){const s=Nr(t.coordinates,n,i),o=$r(e.geometry(),r,n,i);if(!Br(r,n))return!1;for(const e of o)if(!Fr(e,s))return!1}return!0}(e,this.geometries);if("LineString"===e.geometryType())return function(e,t){const r=[1/0,1/0,-1/0,-1/0],n=[1/0,1/0,-1/0,-1/0],i=e.canonicalID();if(!i)return!1;if("Polygon"===t.type){const s=Ur(t.coordinates,n,i),o=Gr(e.geometry(),r,n,i);if(!Br(r,n))return!1;for(const e of o)if(!Rr(e,s))return!1}if("MultiPolygon"===t.type){const s=Nr(t.coordinates,n,i),o=Gr(e.geometry(),r,n,i);if(!Br(r,n))return!1;for(const e of o)if(!Or(e,s))return!1}return!0}(e,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}serialize(){return["within",this.geojson]}}const qr={kilometers:1,miles:1e3/1609.344,nauticalmiles:1e3/1852,meters:1e3,metres:1e3,yards:1e3/.9144,feet:1e3/.3048,inches:1e3/.0254},Hr=1/298.257223563,Zr=Hr*(2-Hr),Yr=Math.PI/180;class Wr{static fromTile(e,t,r){const n=Math.PI*(1-2*(e+.5)/Math.pow(2,t)),i=Math.atan(.5*(Math.exp(n)-Math.exp(-n)))/Yr;return new Wr(i,r)}static get units(){return qr}constructor(e,t){if(void 0===e)throw new Error("No latitude given.");if(t&&!qr[t])throw new Error(`Unknown unit ${t}. Use one of: ${Object.keys(qr).join(", ")}`);const r=6378.137*Yr*(t?qr[t]:1),n=Math.cos(e*Yr),i=1/(1-Zr*(1-n*n)),s=Math.sqrt(i);this.kx=r*s*n,this.ky=r*s*i*(1-Zr)}distance(e,t){const r=Qr(e[0]-t[0])*this.kx,n=(e[1]-t[1])*this.ky;return Math.sqrt(r*r+n*n)}bearing(e,t){const r=Qr(t[0]-e[0])*this.kx;return Math.atan2(r,(t[1]-e[1])*this.ky)/Yr}destination(e,t,r){const n=r*Yr;return this.offset(e,Math.sin(n)*t,Math.cos(n)*t)}offset(e,t,r){return[e[0]+t/this.kx,e[1]+r/this.ky]}lineDistance(e){let t=0;for(let r=0;r<e.length-1;r++)t+=this.distance(e[r],e[r+1]);return t}area(e){let t=0;for(let r=0;r<e.length;r++){const n=e[r];for(let e=0,i=n.length,s=i-1;e<i;s=e++)t+=Qr(n[e][0]-n[s][0])*(n[e][1]+n[s][1])*(r?-1:1)}return Math.abs(t)/2*this.kx*this.ky}along(e,t){let r=0;if(t<=0)return e[0];for(let n=0;n<e.length-1;n++){const i=e[n],s=e[n+1],o=this.distance(i,s);if(r+=o,r>t)return Kr(i,s,(t-(r-o))/o)}return e[e.length-1]}pointToSegmentDistance(e,t,r){let[n,i]=t,s=Qr(r[0]-n)*this.kx,o=(r[1]-i)*this.ky;if(0!==s||0!==o){const t=(Qr(e[0]-n)*this.kx*s+(e[1]-i)*this.ky*o)/(s*s+o*o);t>1?(n=r[0],i=r[1]):t>0&&(n+=s/this.kx*t,i+=o/this.ky*t)}return s=Qr(e[0]-n)*this.kx,o=(e[1]-i)*this.ky,Math.sqrt(s*s+o*o)}pointOnLine(e,t){let r=1/0,n=e[0][0],i=e[0][1],s=0,o=0;for(let a=0;a<e.length-1;a++){let l=e[a][0],u=e[a][1],c=Qr(e[a+1][0]-l)*this.kx,h=(e[a+1][1]-u)*this.ky,p=0;0===c&&0===h||(p=(Qr(t[0]-l)*this.kx*c+(t[1]-u)*this.ky*h)/(c*c+h*h),p>1?(l=e[a+1][0],u=e[a+1][1]):p>0&&(l+=c/this.kx*p,u+=h/this.ky*p)),c=Qr(t[0]-l)*this.kx,h=(t[1]-u)*this.ky;const d=c*c+h*h;d<r&&(r=d,n=l,i=u,s=a,o=p)}return{point:[n,i],index:s,t:Math.max(0,Math.min(1,o))}}lineSlice(e,t,r){let n=this.pointOnLine(r,e),i=this.pointOnLine(r,t);if(n.index>i.index||n.index===i.index&&n.t>i.t){const e=n;n=i,i=e}const s=[n.point],o=n.index+1,a=i.index;!Jr(r[o],s[0])&&o<=a&&s.push(r[o]);for(let l=o+1;l<=a;l++)s.push(r[l]);return Jr(r[a],i.point)||s.push(i.point),s}lineSliceAlong(e,t,r){let n=0;const i=[];for(let s=0;s<r.length-1;s++){const o=r[s],a=r[s+1],l=this.distance(o,a);if(n+=l,n>e&&0===i.length&&i.push(Kr(o,a,(e-(n-l))/l)),n>=t)return i.push(Kr(o,a,(t-(n-l))/l)),i;n>e&&i.push(a)}return i}bufferPoint(e,t){const r=t/this.ky,n=t/this.kx;return[e[0]-n,e[1]-r,e[0]+n,e[1]+r]}bufferBBox(e,t){const r=t/this.ky,n=t/this.kx;return[e[0]-n,e[1]-r,e[2]+n,e[3]+r]}insideBBox(e,t){return Qr(e[0]-t[0])>=0&&Qr(e[0]-t[2])<=0&&e[1]>=t[1]&&e[1]<=t[3]}}function Jr(e,t){return e[0]===t[0]&&e[1]===t[1]}function Kr(e,t,r){const n=Qr(t[0]-e[0]);return[e[0]+n*r,e[1]+(t[1]-e[1])*r]}function Qr(e){for(;e<-180;)e+=360;for(;e>180;)e-=360;return e}class en{constructor(e=[],t=(e,t)=>e<t?-1:e>t?1:0){if(this.data=e,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(e){this.data.push(e),this._up(this.length++)}pop(){if(0===this.length)return;const e=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:t,compare:r}=this,n=t[e];for(;e>0;){const i=e-1>>1,s=t[i];if(r(n,s)>=0)break;t[e]=s,e=i}t[e]=n}_down(e){const{data:t,compare:r}=this,n=this.length>>1,i=t[e];for(;e<n;){let n=1+(e<<1);const s=n+1;if(s<this.length&&r(t[s],t[n])<0&&(n=s),r(t[n],i)>=0)break;t[e]=t[n],e=n}t[e]=i}}const tn=8192;function rn(e,t){return t.dist-e.dist}function nn(e){const t=[1/0,1/0,-1/0,-1/0];if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(t[r]!==e[r])return!1;return!0}function sn(e){return e[1]-e[0]+1}function on(e,t){const r=e[1]>=e[0]&&e[1]<t;return r}function an(e,t){if(e[0]>e[1])return[null,null];const r=sn(e);if(t){if(2===r)return[e,null];const t=Math.floor(r/2);return[[e[0],e[0]+t],[e[0]+t,e[1]]]}{if(1===r)return[e,null];const t=Math.floor(r/2)-1;return[[e[0],e[0]+t],[e[0]+t+1,e[1]]]}}function ln(e,t){const r=[1/0,1/0,-1/0,-1/0];if(!on(t,e.length))return r;for(let n=t[0];n<=t[1];++n)Mr(r,e[n]);return r}function un(e){const t=[1/0,1/0,-1/0,-1/0];for(let r=0;r<e.length;++r)for(let n=0;n<e[r].length;++n)Mr(t,e[r][n]);return t}function cn(e,t,r){if(nn(e)||nn(t))return NaN;let n=0,i=0;return e[2]<t[0]&&(n=t[0]-e[2]),e[0]>t[2]&&(n=e[0]-t[2]),e[1]>t[3]&&(i=e[1]-t[3]),e[3]<t[1]&&(i=t[1]-e[3]),r.distance([0,0],[n,i])}function hn(e){return 360*e-180}function pn(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}function dn(e,t,r=8192){const n=Math.pow(2,t.z),i=(e.y/r+t.y)/n;return[hn((e.x/r+t.x)/n),pn(i)]}function fn(e,t){const r=[];for(let n=0;n<e.length;++n)r.push(dn(e[n],t));return r}function mn(e,t,r){const n=r.pointOnLine(t,e).point;return r.distance(e,n)}function yn(e,t,r,n,i){const s=r.slice(n[0],n[1]+1);let o=1/0;for(let a=t[0];a<=t[1];++a)if(0===(o=Math.min(o,mn(e[a],s,i))))return 0;return o}function gn(e,t,r,n,i){const s=Math.min(i.pointToSegmentDistance(e,r,n),i.pointToSegmentDistance(t,r,n)),o=Math.min(i.pointToSegmentDistance(r,e,t),i.pointToSegmentDistance(n,e,t));return Math.min(s,o)}function xn(e,t,r,n,i){if(!on(t,e.length)||!on(n,r.length))return NaN;let s=1/0;for(let o=t[0];o<t[1];++o)for(let t=n[0];t<n[1];++t){if(Vr(e[o],e[o+1],r[t],r[t+1]))return 0;s=Math.min(s,gn(e[o],e[o+1],r[t],r[t+1],i))}return s}function vn(e,t,r,n,i){if(!on(t,e.length)||!on(n,r.length))return NaN;let s=1/0;for(let o=t[0];o<=t[1];++o)for(let t=n[0];t<=n[1];++t)if(0===(s=Math.min(s,i.distance(e[o],r[t]))))return s;return s}function bn(e,t,r){if(Tr(e,t,!0))return 0;let n=1/0;for(const i of t){const t=i.length;if(t<2)return NaN;if(i[0]!==i[t-1]&&0===(n=Math.min(n,r.pointToSegmentDistance(e,i[t-1],i[0]))))return n;if(0===(n=Math.min(n,mn(e,i,r))))return n}return n}function wn(e,t,r,n){if(!on(t,e.length))return NaN;for(let s=t[0];s<=t[1];++s)if(Tr(e[s],r,!0))return 0;let i=1/0;for(let s=t[0];s<t[1];++s)for(const t of r)for(let r=0,o=t.length,a=o-1;r<o;a=r++){if(Vr(e[s],e[s+1],t[a],t[r]))return 0;i=Math.min(i,gn(e[s],e[s+1],t[a],t[r],n))}return i}function _n(e,t){for(const r of e)for(let e=0;e<=r.length-1;++e)if(Tr(r[e],t,!0))return!0;return!1}function In(e,t,r,n=1/0){const i=un(e),s=un(t);if(n!==1/0&&cn(i,s,r)>=n)return n;if(Br(i,s)){if(_n(e,t))return 0}else if(_n(t,e))return 0;let o=n;for(const a of e)for(let e=0,n=a.length,i=n-1;e<n;i=e++)for(const s of t)for(let t=0,n=s.length,l=n-1;t<n;l=t++){if(Vr(a[i],a[e],s[l],s[t]))return 0;o=Math.min(o,gn(a[i],a[e],s[l],s[t],r))}return o}function An(e,t,r,n,i,s,o){if(null===s||null===o)return;const a=cn(ln(n,s),ln(i,o),r);a<t&&e.push({dist:a,range1:s,range2:o})}function Sn(e,t,r,n,i=1/0){let s=Math.min(n.distance(e[0],r[0][0]),i);if(0===s)return s;const o=new en([{dist:0,range1:[0,e.length-1],range2:[0,0]}],rn),a=t?50:100,l=un(r);for(;o.length;){const i=o.pop();if(i.dist>=s)continue;const u=i.range1;if(sn(u)<=a){if(!on(u,e.length))return NaN;if(t){const t=wn(e,u,r,n);if(0===(s=Math.min(s,t)))return s}else for(let t=u[0];t<=u[1];++t){const i=bn(e[t],r,n);if(0===(s=Math.min(s,i)))return s}}else{const r=an(u,t);if(null!==r[0]){const t=cn(ln(e,r[0]),l,n);t<s&&o.push({dist:t,range1:r[0],range2:[0,0]})}if(null!==r[1]){const t=cn(ln(e,r[1]),l,n);t<s&&o.push({dist:t,range1:r[1],range2:[0,0]})}}}return s}function Mn(e,t,r,n,i,s=1/0){let o=Math.min(s,i.distance(e[0],r[0]));if(0===o)return o;const a=new en([{dist:0,range1:[0,e.length-1],range2:[0,r.length-1]}],rn),l=t?50:100,u=n?50:100;for(;a.length;){const s=a.pop();if(s.dist>=o)continue;const c=s.range1,h=s.range2;if(sn(c)<=l&&sn(h)<=u){if(!on(c,e.length)||!on(h,r.length))return NaN;if(t&&n?o=Math.min(o,xn(e,c,r,h,i)):t||n?t&&!n?o=Math.min(o,yn(r,h,e,c,i)):!t&&n&&(o=Math.min(o,yn(e,c,r,h,i))):o=Math.min(o,vn(e,c,r,h,i)),0===o)return o}else{const s=an(c,t),l=an(h,n);An(a,o,i,e,r,s[0],l[0]),An(a,o,i,e,r,s[0],l[1]),An(a,o,i,e,r,s[1],l[0]),An(a,o,i,e,r,s[1],l[1])}}return o}function Bn(e,t,r,n,i=1/0){let s=i;const o=ln(e,[0,e.length-1]);for(const a of r)if(!(s!==1/0&&cn(o,ln(a,[0,a.length-1]),n)>=s)&&(s=Math.min(s,Mn(e,t,a,!0,n,s)),0===s))return s;return s}function Pn(e,t,r,n,i=1/0){let s=i;const o=ln(e,[0,e.length-1]);for(const a of r){if(s!==1/0&&cn(o,un(a),n)>=s)continue;const r=Sn(e,t,a,n,s);if(isNaN(r))return r;if(0===(s=Math.min(s,r)))return s}return s}function zn(e){return"Point"===e||"MultiPoint"===e||"LineString"===e||"MultiLineString"===e||"Polygon"===e||"MultiPolygon"===e}class Tn{constructor(e,t){this.type=Ft,this.geojson=e,this.geometries=t}static parse(e,t){if(2!==e.length)return t.error(`'distance' expression requires either one argument, but found ' ${e.length-1} instead.`);if(ir(e[1])){const t=e[1];if("FeatureCollection"===t.type){for(let e=0;e<t.features.length;++e)if(zn(t.features[e].geometry.type))return new Tn(t,t.features[e].geometry)}else if("Feature"===t.type){if(zn(t.geometry.type))return new Tn(t,t.geometry)}else if(zn(t.type))return new Tn(t,t)}return t.error("'distance' expression needs to be an array with format ['Distance', GeoJSONObj].")}evaluate(e){const t=e.geometry(),r=e.canonicalID();if(null!=t&&null!=r){if("Point"===e.geometryType())return function(e,t,r){const n=[];for(const s of e)for(const e of s)n.push(dn(e,t));const i=new Wr(n[0][1],"meters");return"Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type?Mn(n,!1,"Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,i):"MultiLineString"===r.type?Bn(n,!1,r.coordinates,i):"Polygon"===r.type||"MultiPolygon"===r.type?Pn(n,!1,"Polygon"===r.type?[r.coordinates]:r.coordinates,i):null}(t,r,this.geometries);if("LineString"===e.geometryType())return function(e,t,r){const n=[];for(const s of e){const e=[];for(const r of s)e.push(dn(r,t));n.push(e)}const i=new Wr(n[0][0][1],"meters");if("Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type)return Bn("Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,n,i);if("MultiLineString"===r.type){let e=1/0;for(let t=0;t<r.coordinates.length;t++){const s=Bn(r.coordinates[t],!0,n,i,e);if(isNaN(s))return s;if(0===(e=Math.min(e,s)))return e}return e}if("Polygon"===r.type||"MultiPolygon"===r.type){let e=1/0;for(let t=0;t<n.length;t++){const s=Pn(n[t],!0,"Polygon"===r.type?[r.coordinates]:r.coordinates,i,e);if(isNaN(s))return s;if(0===(e=Math.min(e,s)))return e}return e}return null}(t,r,this.geometries);if("Polygon"===e.geometryType())return function(e,t,r){const n=[];for(const s of function(e){const t=e.length;if(t<=1)return[e];const r=[];let n,i;for(let s=0;s<t;s++){const t=Sr(e[s]);0!==t&&(e[s].area=Math.abs(t),void 0===i&&(i=t<0),i===t<0?(n&&r.push(n),n=[e[s]]):n.push(e[s]))}return n&&r.push(n),r}(e)){const e=[];for(let r=0;r<s.length;++r)e.push(fn(s[r],t));n.push(e)}const i=new Wr(n[0][0][0][1],"meters");if("Point"===r.type||"MultiPoint"===r.type||"LineString"===r.type)return Pn("Point"===r.type?[r.coordinates]:r.coordinates,"LineString"===r.type,n,i);if("MultiLineString"===r.type){let e=1/0;for(let t=0;t<r.coordinates.length;t++){const s=Pn(r.coordinates[t],!0,n,i,e);if(isNaN(s))return s;if(0===(e=Math.min(e,s)))return e}return e}return"Polygon"===r.type||"MultiPolygon"===r.type?function(e,t,r){let n=1/0;for(const i of e)for(const e of t){const t=In(i,e,r,n);if(isNaN(t))return t;if(0===(n=Math.min(n,t)))return n}return n}("Polygon"===r.type?[r.coordinates]:r.coordinates,n,i):null}(t,r,this.geometries)}return null}eachChild(){}outputDefined(){return!0}serialize(){return["distance",this.geojson]}}function kn(e){if(e instanceof vr){if("get"===e.name&&1===e.args.length)return!1;if("feature-state"===e.name)return!1;if("has"===e.name&&1===e.args.length)return!1;if("properties"===e.name||"geometry-type"===e.name||"id"===e.name)return!1;if(e.name.startsWith("filter-"))return!1}if(e instanceof Xr)return!1;if(e instanceof Tn)return!1;if(e instanceof Ln)return e.featureConstant;let t=!0;return e.eachChild(e=>{t&&!kn(e)&&(t=!1)}),t}function Vn(e){if(e instanceof vr&&"feature-state"===e.name)return!1;let t=!0;return e.eachChild(e=>{t&&!Vn(e)&&(t=!1)}),t}function En(e,t){if(e instanceof vr&&t.includes(e.name))return!1;let r=!0;return e.eachChild(e=>{r&&!En(e,t)&&(r=!1)}),r}function Dn(e,t,r){return[e,t,r].filter(Boolean).join("")}function Cn(e,t){switch(e){case"string":return or(t);case"number":return+t;case"boolean":return!!t;case"color":return Pt.parse(t);case"formatted":return er.fromString(or(t));case"resolvedImage":return rr.build(or(t))}return t}function Fn(e,t,r,n){return void 0!==n&&(e=n*Math.round(e/n)),void 0!==t&&e<t&&(e=t),void 0!==r&&e>r&&(e=r),e}class Ln{constructor(e,t,r,n=!1){this.type=e,this.key=t,this.scope=r,this.featureConstant=n}static parse(e,t){let r=t.expectedType;if(null==r&&(r=Nt),e.length<2||e.length>3)return t.error("Invalid number of arguments for 'config' expression.");const n=t.parse(e[1],1);if(!(n instanceof ar))return t.error("Key name of 'config' expression must be a string literal.");let i,s=!0;const o=or(n.value);if(e.length>=3){const r=t.parse(e[2],2);if(!(r instanceof ar))return t.error("Scope of 'config' expression must be a string literal.");i=or(r.value)}if(t.options){const e=Dn(o,i,t._scope),r=t.options.get(e);r&&(s=kn(r.value||r.default))}return new Ln(r,o,i,s)}evaluate(e){const t=Dn(this.key,this.scope,e.scope),r=e.getConfig(t);if(!r)return null;const{type:n,value:i,values:s,minValue:o,maxValue:a,stepValue:l}=r,u=r.default.evaluate(e);let c=u;if(i){const t=e.scope;e.scope=(t||"").split("").slice(1).join(""),c=i.evaluate(e),e.scope=t}return n&&(c=Cn(n,c)),void 0===c||void 0===o&&void 0===a&&void 0===l||("number"==typeof c?c=Fn(c,o,a,l):Array.isArray(c)&&(c=c.map(e=>"number"==typeof e?Fn(e,o,a,l):e))),void 0!==i&&void 0!==c&&s&&!s.includes(c)&&(c=u,n&&(c=Cn(n,c))),(n&&n!==this.type||void 0!==c&&!Jt(sr(c),this.type))&&(c=Cn(this.type.kind,c)),c}eachChild(){}outputDefined(){return!1}serialize(){const e=["config",this.key];return this.scope&&e.concat(this.scope),e}}class Rn{constructor(e,t){this.type=t.type,this.name=e,this.boundExpression=t}static parse(e,t){if(2!==e.length||"string"!=typeof e[1])return t.error("'var' expression requires exactly one string literal argument.");const r=e[1];return t.scope.has(r)?new Rn(r,t.scope.get(r)):t.error(`Unknown variable "${r}". Make sure "${r}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(e){return this.boundExpression.evaluate(e)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class On{constructor(e,t=[],r,n=new Dt,i=[],s,o,a){this.registry=e,this.path=t,this.key=t.map(e=>"string"==typeof e?`['${e}']`:`[${e}]`).join(""),this.scope=n,this.errors=i,this.expectedType=r,this._scope=s,this.options=o,this.iconImageUseTheme=a}parse(e,t,r,n,i={}){return t||r?this.concat(t,null,r,n)._parse(e,i):this._parse(e,i)}parseObjectValue(e,t,r,n,i,s={}){return this.concat(t,r,n,i)._parse(e,s)}_parse(e,t){function r(e,t,r){return"assert"===r?new cr(t,[e]):"coerce"===r?new yr(t,[e]):e}if(null!==e&&"string"!=typeof e&&"boolean"!=typeof e&&"number"!=typeof e||(e=["literal",e]),Array.isArray(e)){if(0===e.length)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const i="string"==typeof e[0]?this.registry[e[0]]:void 0;if(i){let s=i.parse(e,this);if(!s)return null;if(this.expectedType){const e=this.expectedType,n=s.type;if("string"!==e.kind&&"number"!==e.kind&&"boolean"!==e.kind&&"object"!==e.kind&&"array"!==e.kind||"value"!==n.kind)if("color"!==e.kind&&"formatted"!==e.kind&&"resolvedImage"!==e.kind||"value"!==n.kind&&"string"!==n.kind){if(this.checkSubtype(e,n))return null}else s=r(s,e,t.typeAnnotation||"coerce");else s=r(s,e,t.typeAnnotation||"assert")}if(!(s instanceof ar)&&"resolvedImage"!==s.type.kind&&Un(s)){const e=new xr(this._scope,this.options,this.iconImageUseTheme);try{s=new ar(s.type,s.evaluate(e))}catch(n){return this.error(n.message),null}}return s}return yr.parse(["to-array",e],this)}return this.error(void 0===e?"'undefined' value invalid. Use null instead.":"object"==typeof e?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof e} instead.`)}concat(e,t,r,n){let i="number"==typeof e?this.path.concat(e):this.path;i="string"==typeof t?i.concat(t):i;const s=n?this.scope.concat(n):this.scope;return new On(this.registry,i,r||null,s,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(e,...t){const r=`${this.key}${t.map(e=>`[${e}]`).join("")}`;this.errors.push(new Et(r,e))}checkSubtype(e,t){const r=Zt(e,t);return r&&this.error(r),r}}function Un(e){if(e instanceof Rn)return Un(e.boundExpression);if(e instanceof vr&&"error"===e.name)return!1;if(e instanceof wr)return!1;if(e instanceof Xr)return!1;if(e instanceof Tn)return!1;if(e instanceof Ln)return!1;const t=e instanceof yr||e instanceof cr;let r=!0;return e.eachChild(e=>{r=t?r&&Un(e):r&&e instanceof ar}),!!r&&kn(e)&&En(e,["zoom","heatmap-density","worldview","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed","is-active-floor"])}function Nn(e,t){const r=e.length-1;let n,i,s=0,o=r,a=0;for(;s<=o;)if(a=Math.floor((s+o)/2),n=e[a],i=e[a+1],n<=t){if(a===r||t<i)return a;s=a+1}else{if(!(n>t))throw new lr("Input is not a number.");o=a-1}return 0}class jn{constructor(e,t,r){this.type=e,this.input=t,this.labels=[],this.outputs=[];for(const[n,i]of r)this.labels.push(n),this.outputs.push(i)}static parse(e,t){if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if((e.length-1)%2!=0)return t.error("Expected an even number of arguments.");const r=t.parse(e[1],1,Ft);if(!r)return null;const n=[];let i=null;t.expectedType&&"value"!==t.expectedType.kind&&(i=t.expectedType);for(let s=1;s<e.length;s+=2){const r=1===s?-1/0:e[s],o=e[s+1],a=s,l=s+1;if("number"!=typeof r)return t.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',a);if(n.length&&n.at(-1)[0]>=r)return t.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',a);const u=t.parse(o,l,i);if(!u)return null;i=i||u.type,n.push([r,u])}return new jn(i,r,n)}evaluate(e){const t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);const n=this.input.evaluate(e);if(n<=t[0])return r[0].evaluate(e);const i=t.length;return n>=t[i-1]?r[i-1].evaluate(e):r[Nn(t,n)].evaluate(e)}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){const e=["step",this.input.serialize()];for(let t=0;t<this.labels.length;t++)t>0&&e.push(this.labels[t]),e.push(this.outputs[t].serialize());return e}}const $n=.95047,Gn=1.08883,Xn=4/29,qn=6/29,Hn=3*qn*qn,Zn=qn*qn*qn,Yn=Math.PI/180,Wn=180/Math.PI;function Jn(e){return e>Zn?Math.pow(e,1/3):e/Hn+Xn}function Kn(e){return e>qn?e*e*e:Hn*(e-Xn)}function Qn(e){return 255*(e<=.0031308?12.92*e:1.055*Math.pow(e,1/2.4)-.055)}function ei(e){return(e/=255)<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4)}function ti(e){const t=ei(e.r),r=ei(e.g),n=ei(e.b),i=Jn((.4124564*t+.3575761*r+.1804375*n)/$n),s=Jn((.2126729*t+.7151522*r+.072175*n)/1);return{l:116*s-16,a:500*(i-s),b:200*(s-Jn((.0193339*t+.119192*r+.9503041*n)/Gn)),alpha:e.a}}function ri(e){let t=(e.l+16)/116,r=isNaN(e.a)?t:t+e.a/500,n=isNaN(e.b)?t:t-e.b/200;return t=1*Kn(t),r=$n*Kn(r),n=Gn*Kn(n),new Pt(Qn(3.2404542*r-1.5371385*t-.4985314*n),Qn(-.969266*r+1.8760108*t+.041556*n),Qn(.0556434*r-.2040259*t+1.0572252*n),e.alpha)}function ni(e,t,r){const n=t-e;return e+r*(n>180||n<-180?n-360*Math.round(n/360):n)}const ii={forward:ti,reverse:ri,interpolate:function(e,t,r){return{l:Bt(e.l,t.l,r),a:Bt(e.a,t.a,r),b:Bt(e.b,t.b,r),alpha:Bt(e.alpha,t.alpha,r)}}},si={forward:function(e){const{l:t,a:r,b:n}=ti(e),i=Math.atan2(n,r)*Wn;return{h:i<0?i+360:i,c:Math.sqrt(r*r+n*n),l:t,alpha:e.a}},reverse:function(e){const t=e.h*Yn,r=e.c;return ri({l:e.l,a:Math.cos(t)*r,b:Math.sin(t)*r,alpha:e.alpha})},interpolate:function(e,t,r){return{h:ni(e.h,t.h,r),c:Bt(e.c,t.c,r),l:Bt(e.l,t.l,r),alpha:Bt(e.alpha,t.alpha,r)}}},oi=Object.freeze(Object.defineProperty({__proto__:null,hcl:si,lab:ii},Symbol.toStringTag,{value:"Module"}));class ai{constructor(e,t,r,n,i){this.type=e,this.operator=t,this.interpolation=r,this.input=n,this.labels=[],this.outputs=[];for(const[s,o]of i)this.labels.push(s),this.outputs.push(o)}static interpolationFactor(e,t,r,n){let i=0;if("exponential"===e.name)i=li(t,e.base,r,n);else if("linear"===e.name)i=li(t,1,r,n);else if("cubic-bezier"===e.name){const s=e.controlPoints;i=new se(s[0],s[1],s[2],s[3]).solve(li(t,1,r,n))}return i}static parse(e,t){let[r,n,i,...s]=e;if(!Array.isArray(n)||0===n.length)return t.error("Expected an interpolation type expression.",1);if("linear"===n[0])n={name:"linear"};else if("exponential"===n[0]){const e=n[1];if("number"!=typeof e)return t.error("Exponential interpolation requires a numeric base.",1,1);n={name:"exponential",base:e}}else{if("cubic-bezier"!==n[0])return t.error(`Unknown interpolation type ${String(n[0])}`,1,0);{const e=n.slice(1);if(4!==e.length||e.some(e=>"number"!=typeof e||e<0||e>1))return t.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);n={name:"cubic-bezier",controlPoints:e}}}if(e.length-1<4)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length-1>3&&(e.length-1)%2!=0)return t.error("Expected an even number of arguments.");if(i=t.parse(i,2,Ft),!i)return null;const o=[];let a=null;"interpolate-hcl"===r||"interpolate-lab"===r?a=Ot:t.expectedType&&"value"!==t.expectedType.kind&&(a=t.expectedType);for(let l=0;l<s.length;l+=2){const e=s[l],r=s[l+1],n=l+3,i=l+4;if("number"!=typeof e)return t.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',n);if(o.length&&o.at(-1)[0]>=e)return t.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',n);const u=t.parse(r,i,a);if(!u)return null;a=a||u.type,o.push([e,u])}return"number"===a.kind||"color"===a.kind||"array"===a.kind&&"number"===a.itemType.kind&&"number"==typeof a.N?new ai(a,r,n,i,o):t.error(`Type ${qt(a)} is not interpolatable.`)}evaluate(e){const t=this.labels,r=this.outputs;if(1===t.length)return r[0].evaluate(e);const n=this.input.evaluate(e);if(n<=t[0])return r[0].evaluate(e);const i=t.length;if(n>=t[i-1])return r[i-1].evaluate(e);const s=Nn(t,n),o=ai.interpolationFactor(this.interpolation,n,t[s],t[s+1]),a=r[s].evaluate(e),l=r[s+1].evaluate(e);return"interpolate"===this.operator?Vt[this.type.kind.toLowerCase()](a,l,o):"interpolate-hcl"===this.operator?si.reverse(si.interpolate(si.forward(a),si.forward(l),o)):ii.reverse(ii.interpolate(ii.forward(a),ii.forward(l),o))}eachChild(e){e(this.input);for(const t of this.outputs)e(t)}outputDefined(){return this.outputs.every(e=>e.outputDefined())}serialize(){let e;e="linear"===this.interpolation.name?["linear"]:"exponential"===this.interpolation.name?1===this.interpolation.base?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const t=[this.operator,e,this.input.serialize()];for(let r=0;r<this.labels.length;r++)t.push(this.labels[r],this.outputs[r].serialize());return t}}function li(e,t,r,n){const i=n-r,s=e-r;return 0===i?0:1===t?s/i:(Math.pow(t,s)-1)/(Math.pow(t,i)-1)}class ui{constructor(e,t){this.type=e,this.args=t}static parse(e,t){if(e.length<2)return t.error("Expectected at least one argument."),null;let r=null;const n=t.expectedType;n&&"value"!==n.kind&&(r=n);const i=[];for(const o of e.slice(1)){const e=t.parse(o,1+i.length,r,void 0,{typeAnnotation:"omit"});if(!e)return null;r=r||e.type,i.push(e)}const s=n&&i.some(e=>Zt(n,e.type));return new ui(s?Nt:r,i)}evaluate(e){let t,r=null,n=0;for(const i of this.args){if(n++,r=i.evaluate(e),r&&r instanceof rr&&!r.available&&(t||(t=r),r=null,n===this.args.length))return t;if(null!==r)break}return r}eachChild(e){this.args.forEach(e)}outputDefined(){return this.args.every(e=>e.outputDefined())}serialize(){const e=["coalesce"];return this.eachChild(t=>{e.push(t.serialize())}),e}}const ci=/[^a-zA-Z0-9_]/;class hi{constructor(e,t){this.type=t.type,this.bindings=[].concat(e),this.result=t}evaluate(e){return this.result.evaluate(e)}eachChild(e){for(const t of this.bindings)e(t[1]);e(this.result)}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found ${e.length-1} instead.`);const r=[];for(let i=1;i<e.length-1;i+=2){const n=e[i];if("string"!=typeof n)return t.error(`Expected string, but found ${typeof n} instead.`,i);if(ci.test(n))return t.error("Variable names must contain only alphanumeric characters or '_'.",i);const s=t.parse(e[i+1],i+1);if(!s)return null;r.push([n,s])}const n=t.parse(e.at(-1),e.length-1,t.expectedType,r);return n?new hi(r,n):null}outputDefined(){return this.result.outputDefined()}serialize(){const e=["let"];for(const[t,r]of this.bindings)e.push(t,r.serialize());return e.push(this.result.serialize()),e}}class pi{constructor(e,t,r){this.type=e,this.index=t,this.input=r}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,Ft),n=t.parse(e[2],2,Xt(t.expectedType||Nt));return r&&n?new pi(n.type.itemType,r,n):null}evaluate(e){const t=this.index.evaluate(e),r=this.input.evaluate(e);if(t<0)throw new lr("Array index out of bounds: negative index");if(t>=r.length)throw new lr("Array index out of bounds: index exceeds array size");if(t!==Math.floor(t))throw new lr("Array index must be an integer. Use at-interpolated for fractional indices");return r[t]}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class di{constructor(e,t,r){this.type=e,this.index=t,this.input=r}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,Ft),n=t.parse(e[2],2,Xt(t.expectedType||Nt));return r&&n?new di(n.type.itemType,r,n):null}evaluate(e){const t=this.index.evaluate(e),r=this.input.evaluate(e);if(t<0)throw new lr(`Array index out of bounds: ${t} < 0.`);if(t>r.length-1)throw new lr(`Array index out of bounds: ${t} > ${r.length-1}.`);if(t===Math.floor(t))return r[t];const n=Math.floor(t),i=Math.ceil(t),s=r[n],o=r[i];if("number"!=typeof s||"number"!=typeof o)throw new lr(`Cannot interpolate between non-number values at index ${t}.`);const a=t-n;return s*(1-a)+o*a}eachChild(e){e(this.index),e(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class fi{constructor(e,t){this.type=Rt,this.needle=e,this.haystack=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`),null;const r=t.parse(e[1],1,Nt),n=t.parse(e[2],2,Nt);return r&&n?Yt(r.type,[Rt,Lt,Ft,Ct,Nt])?new fi(r,n):(t.error(`Expected first argument to be of type boolean, string, number or null, but found ${qt(r.type)} instead`),null):null}evaluate(e){const t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(null==r)return!1;if(!Wt(t,["boolean","string","number","null"]))throw new lr(`Expected first argument to be of type boolean, string, number or null, but found ${qt(sr(t))} instead.`);if(!Wt(r,["string","array"]))throw new lr(`Expected second argument to be of type array or string, but found ${qt(sr(r))} instead.`);return r.includes(t)}eachChild(e){e(this.needle),e(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class mi{constructor(e,t,r){this.type=Ft,this.needle=e,this.haystack=t,this.fromIndex=r}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`),null;const r=t.parse(e[1],1,Nt),n=t.parse(e[2],2,Nt);if(!r||!n)return null;if(!Yt(r.type,[Rt,Lt,Ft,Ct,Nt]))return t.error(`Expected first argument to be of type boolean, string, number or null, but found ${qt(r.type)} instead`),null;if(4===e.length){const i=t.parse(e[3],3,Ft);return i?new mi(r,n,i):null}return new mi(r,n)}evaluate(e){const t=this.needle.evaluate(e),r=this.haystack.evaluate(e);if(!Wt(t,["boolean","string","number","null"]))throw new lr(`Expected first argument to be of type boolean, string, number or null, but found ${qt(sr(t))} instead.`);if(!Wt(r,["string","array"]))throw new lr(`Expected second argument to be of type array or string, but found ${qt(sr(r))} instead.`);if(this.fromIndex){const n=this.fromIndex.evaluate(e);return r.indexOf(t,n)}return r.indexOf(t)}eachChild(e){e(this.needle),e(this.haystack),this.fromIndex&&e(this.fromIndex)}outputDefined(){return!1}serialize(){if(null!=this.fromIndex&&void 0!==this.fromIndex){const e=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),e]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class yi{constructor(e,t,r,n,i,s){this.inputType=e,this.type=t,this.input=r,this.cases=n,this.outputs=i,this.otherwise=s}static parse(e,t){if(e.length<5)return t.error(`Expected at least 4 arguments, but found only ${e.length-1}.`);if(e.length%2!=1)return t.error("Expected an even number of arguments.");let r,n;t.expectedType&&"value"!==t.expectedType.kind&&(n=t.expectedType);const i={},s=[];for(let l=2;l<e.length-1;l+=2){let o=e[l];const a=e[l+1];Array.isArray(o)||(o=[o]);const u=t.concat(l);if(0===o.length)return u.error("Expected at least one branch label.");for(const e of o){if("number"!=typeof e&&"string"!=typeof e)return u.error("Branch labels must be numbers or strings.");if("number"==typeof e&&Math.abs(e)>Number.MAX_SAFE_INTEGER)return u.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if("number"==typeof e&&Math.floor(e)!==e)return u.error("Numeric branch labels must be integer values.");if(r){if(u.checkSubtype(r,sr(e)))return null}else r=sr(e);if(void 0!==i[String(e)])return u.error("Branch labels must be unique.");i[String(e)]=s.length}const c=t.parse(a,l,n);if(!c)return null;n=n||c.type,s.push(c)}const o=t.parse(e[1],1,Nt);if(!o)return null;const a=t.parse(e.at(-1),e.length-1,n);return a?"value"!==o.type.kind&&t.concat(1).checkSubtype(r,o.type)?null:new yi(r,n,o,i,s,a):null}evaluate(e){const t=this.input.evaluate(e);return(Jt(sr(t),this.inputType)&&this.outputs[this.cases[t]]||this.otherwise).evaluate(e)}eachChild(e){e(this.input),this.outputs.forEach(e),e(this.otherwise)}outputDefined(){return this.outputs.every(e=>e.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["match",this.input.serialize()],t=Object.keys(this.cases).sort(),r=[],n={};for(const s of t){const e=n[this.cases[s]];void 0===e?(n[this.cases[s]]=r.length,r.push([this.cases[s],[s]])):r[e][1].push(s)}const i=e=>"number"===this.inputType.kind?Number(e):e;for(const[s,o]of r)e.push(1===o.length?i(o[0]):o.map(i)),e.push(this.outputs[s].serialize());return e.push(this.otherwise.serialize()),e}}class gi{constructor(e,t,r){this.type=e,this.branches=t,this.otherwise=r}static parse(e,t){if(e.length<4)return t.error(`Expected at least 3 arguments, but found only ${e.length-1}.`),null;if(e.length%2!=0)return t.error("Expected an odd number of arguments."),null;let r;t.expectedType&&"value"!==t.expectedType.kind&&(r=t.expectedType);const n=[];for(let s=1;s<e.length-1;s+=2){const i=t.parse(e[s],s,Rt);if(!i)return null;const o=t.parse(e[s+1],s+1,r);if(!o)return null;n.push([i,o]),r=r||o.type}const i=t.parse(e.at(-1),e.length-1,r);return i?new gi(r,n,i):null}evaluate(e){for(const[t,r]of this.branches)if(t.evaluate(e))return r.evaluate(e);return this.otherwise.evaluate(e)}eachChild(e){for(const[t,r]of this.branches)e(t),e(r);e(this.otherwise)}outputDefined(){return this.branches.every(([e,t])=>t.outputDefined())&&this.otherwise.outputDefined()}serialize(){const e=["case"];return this.eachChild(t=>{e.push(t.serialize())}),e}}class xi{constructor(e,t,r,n){this.type=e,this.input=t,this.beginIndex=r,this.endIndex=n}static parse(e,t){if(e.length<=2||e.length>=5)return t.error(`Expected 3 or 4 arguments, but found ${e.length-1} instead.`),null;const r=t.parse(e[1],1,Nt),n=t.parse(e[2],2,Ft);if(!r||!n)return null;if(!Yt(r.type,[Xt(Nt),Lt,Nt]))return t.error(`Expected first argument to be of type array or string, but found ${qt(r.type)} instead`),null;if(4===e.length){const i=t.parse(e[3],3,Ft);return i?new xi(r.type,r,n,i):null}return new xi(r.type,r,n)}evaluate(e){const t=this.input.evaluate(e),r=this.beginIndex.evaluate(e);if(!Wt(t,["string","array"]))throw new lr(`Expected first argument to be of type array or string, but found ${qt(sr(t))} instead.`);if(this.endIndex){const n=this.endIndex.evaluate(e);return t.slice(r,n)}return t.slice(r)}eachChild(e){e(this.input),e(this.beginIndex),this.endIndex&&e(this.endIndex)}outputDefined(){return!1}serialize(){if(null!=this.endIndex&&void 0!==this.endIndex){const e=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),e]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class vi{constructor(e,t){this.type=Xt(Lt),this.str=e,this.delimiter=t}static parse(e,t){if(3!==e.length)return t.error(`Expected 2 arguments, but found ${e.length-1} instead.`);const r=t.parse(e[1],1,Lt),n=t.parse(e[2],2,Lt);return r&&n?new vi(r,n):void 0}evaluate(e){const t=this.str.evaluate(e),r=this.delimiter.evaluate(e);return t.split(r)}eachChild(e){e(this.str),e(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function bi(e,t){return"=="===e||"!="===e?"boolean"===t.kind||"string"===t.kind||"number"===t.kind||"null"===t.kind||"value"===t.kind:"string"===t.kind||"number"===t.kind||"value"===t.kind}function wi(e,t,r,n){return 0===n.compare(t,r)}function _i(e,t,r){const n="=="!==e&&"!="!==e;return class i{constructor(e,t,r){this.type=Rt,this.lhs=e,this.rhs=t,this.collator=r,this.hasUntypedArgument="value"===e.type.kind||"value"===t.type.kind}static parse(e,t){if(3!==e.length&&4!==e.length)return t.error("Expected two or three arguments.");const r=e[0];let s=t.parse(e[1],1,Nt);if(!s)return null;if(!bi(r,s.type))return t.concat(1).error(`"${r}" comparisons are not supported for type '${qt(s.type)}'.`);let o=t.parse(e[2],2,Nt);if(!o)return null;if(!bi(r,o.type))return t.concat(2).error(`"${r}" comparisons are not supported for type '${qt(o.type)}'.`);if(s.type.kind!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return t.error(`Cannot compare types '${qt(s.type)}' and '${qt(o.type)}'.`);n&&("value"===s.type.kind&&"value"!==o.type.kind?s=new cr(o.type,[s]):"value"!==s.type.kind&&"value"===o.type.kind&&(o=new cr(s.type,[o])));let a=null;if(4===e.length){if("string"!==s.type.kind&&"string"!==o.type.kind&&"value"!==s.type.kind&&"value"!==o.type.kind)return t.error("Cannot use collator to compare non-string types.");if(a=t.parse(e[3],3,jt),!a)return null}return new i(s,o,a)}evaluate(i){const s=this.lhs.evaluate(i),o=this.rhs.evaluate(i);if(n&&this.hasUntypedArgument){const t=sr(s),r=sr(o);if(t.kind!==r.kind||"string"!==t.kind&&"number"!==t.kind)throw new lr(`Expected arguments for "${e}" to be (string, string) or (number, number), but found (${t.kind}, ${r.kind}) instead.`)}if(this.collator&&!n&&this.hasUntypedArgument){const e=sr(s),r=sr(o);if("string"!==e.kind||"string"!==r.kind)return t(i,s,o)}return this.collator?r(i,s,o,this.collator.evaluate(i)):t(i,s,o)}eachChild(e){e(this.lhs),e(this.rhs),this.collator&&e(this.collator)}outputDefined(){return!0}serialize(){const t=[e];return this.eachChild(e=>{t.push(e.serialize())}),t}}}const Ii=_i("==",function(e,t,r){return t===r},wi),Ai=_i("!=",function(e,t,r){return t!==r},function(e,t,r,n){return!wi(0,t,r,n)}),Si=_i("<",function(e,t,r){return t<r},function(e,t,r,n){return n.compare(t,r)<0}),Mi=_i(">",function(e,t,r){return t>r},function(e,t,r,n){return n.compare(t,r)>0}),Bi=_i("<=",function(e,t,r){return t<=r},function(e,t,r,n){return n.compare(t,r)<=0}),Pi=_i(">=",function(e,t,r){return t>=r},function(e,t,r,n){return n.compare(t,r)>=0});class zi{constructor(e,t,r,n,i,s){this.type=Lt,this.number=e,this.locale=t,this.currency=r,this.unit=n,this.minFractionDigits=i,this.maxFractionDigits=s}static parse(e,t){if(3!==e.length)return t.error("Expected two arguments.");const r=t.parse(e[1],1,Ft);if(!r)return null;const n=e[2];if("object"!=typeof n||Array.isArray(n))return t.error("NumberFormat options argument must be an object.");let i=null;if(n.locale&&(i=t.parseObjectValue(n.locale,2,"locale",Lt),!i))return null;let s=null;if(n.currency&&(s=t.parseObjectValue(n.currency,2,"currency",Lt),!s))return null;let o=null;if(n.unit&&(o=t.parseObjectValue(n.unit,2,"unit",Lt),!o))return null;let a=null;if(n["min-fraction-digits"]&&(a=t.parseObjectValue(n["min-fraction-digits"],2,"min-fraction-digits",Ft),!a))return null;let l=null;return n["max-fraction-digits"]&&(l=t.parseObjectValue(n["max-fraction-digits"],2,"max-fraction-digits",Ft),!l)?null:new zi(r,i,s,o,a,l)}evaluate(e){return new Intl.NumberFormat(this.locale?this.locale.evaluate(e):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(e):void 0,unit:this.unit?this.unit.evaluate(e):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(e):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(e):void 0}).format(this.number.evaluate(e))}eachChild(e){e(this.number),this.locale&&e(this.locale),this.currency&&e(this.currency),this.unit&&e(this.unit),this.minFractionDigits&&e(this.minFractionDigits),this.maxFractionDigits&&e(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const e={};return this.locale&&(e.locale=this.locale.serialize()),this.currency&&(e.currency=this.currency.serialize()),this.unit&&(e.unit=this.unit.serialize()),this.minFractionDigits&&(e["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(e["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),e]}}class Ti{constructor(e){this.type=Ft,this.input=e}static parse(e,t){if(2!==e.length)return t.error(`Expected 1 argument, but found ${e.length-1} instead.`),null;const r=t.parse(e[1],1);return r?"array"!==r.type.kind&&"string"!==r.type.kind&&"value"!==r.type.kind?(t.error(`Expected argument of type string or array, but found ${qt(r.type)} instead.`),null):new Ti(r):null}evaluate(e){const t=this.input.evaluate(e);if("string"==typeof t)return t.length;if(Array.isArray(t))return t.length;throw new lr(`Expected value to be of type string or array, but found ${qt(sr(t))} instead.`)}eachChild(e){e(this.input)}outputDefined(){return!1}serialize(){const e=["length"];return this.eachChild(t=>{e.push(t.serialize())}),e}}function ki(e){return function(){e=1831565813+(e|=0)|0;let t=Math.imul(e^e>>>15,1|e);return t=t+Math.imul(t^t>>>7,61|t)^t,((t^t>>>14)>>>0)/4294967296}}const Vi={"==":Ii,"!=":Ai,">":Mi,"<":Si,">=":Pi,"<=":Bi,array:cr,at:pi,"at-interpolated":di,boolean:cr,case:gi,coalesce:ui,collator:wr,format:hr,image:pr,in:fi,"index-of":mi,interpolate:ai,"interpolate-hcl":ai,"interpolate-lab":ai,length:Ti,let:hi,literal:ar,match:yi,number:cr,"number-format":zi,object:cr,slice:xi,step:jn,string:cr,"to-boolean":yr,"to-color":yr,"to-number":yr,"to-string":yr,var:Rn,within:Xr,distance:Tn,config:Ln,split:vi};function Ei(e,[t,r,n,i]){t=t.evaluate(e),r=r.evaluate(e),n=n.evaluate(e);const s=i?i.evaluate(e):1,o=nr(t,r,n,s);if(o)throw new lr(o);return new Pt(t/255,r/255,n/255,s)}function Di(e,[t,r,n,i]){t=t.evaluate(e),r=r.evaluate(e),n=n.evaluate(e);const s=i?i.evaluate(e):1,o=(l=r,u=n,c=s,"number"==typeof(a=t)&&a>=0&&a<=360?"number"==typeof l&&l>=0&&l<=100&&"number"==typeof u&&u>=0&&u<=100?void 0===c||"number"==typeof c&&c>=0&&c<=1?null:`Invalid hsla value [${[a,l,u,c].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${("number"==typeof c?[a,l,u,c]:[a,l,u]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${("number"==typeof c?[a,l,u,c]:[a,l,u]).join(", ")}]: 'h' must be between 0 and 360.`);var a,l,u,c;if(o)throw new lr(o);const h=`hsla(${t}, ${r}%, ${n}%, ${s})`,p=Pt.parse(h);if(!p)throw new lr(`Failed to parse HSLA color: ${h}`);return p}function Ci(e,t){return e in t}function Fi(e,t){const r=t[e];return void 0===r?null:r}function Li(e){return{type:e}}function Ri(e){if(e instanceof Ln)/* @__PURE__ */return new Set([e.key]);let t=/* @__PURE__ */new Set;return e.eachChild(e=>{t=/* @__PURE__ */new Set([...t,...Ri(e)])}),t}function Oi(e){if(e instanceof vr&&"is-active-floor"===e.name)return!0;let t=!1;return e.eachChild(e=>{!t&&Oi(e)&&(t=!0)}),t}function Ui(e){return{result:"success",value:e}}function Ni(e){return{result:"error",value:e}}function ji(e,t){return!!e&&!!e.parameters&&e.parameters.includes(t)}function $i(e){return"data-driven"===e["property-type"]}function Gi(e){return!!e.expression&&e.expression.interpolated}function Xi(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function qi(e){return e}function Hi(e,t){const r="color"===t.type,n=e.stops&&"object"==typeof e.stops[0][0],i=n||!(n||void 0!==e.property),s=e.type||(Gi(t)?"exponential":"interval");if(r&&((e=Object.assign({},e)).stops&&(e.stops=e.stops.map(e=>[e[0],Pt.parse(e[1])])),e.default=Pt.parse(e.default?e.default:t.default)),e.colorSpace&&"rgb"!==e.colorSpace&&!oi[e.colorSpace])throw new Error(`Unknown color space: ${e.colorSpace}`);let o,a,l;if("exponential"===s)o=Ji;else if("interval"===s)o=Wi;else if("categorical"===s){o=Yi,a=/* @__PURE__ */Object.create(null);for(const t of e.stops)a[t[0]]=t[1];l=typeof e.stops[0][0]}else{if("identity"!==s)throw new Error(`Unknown function type "${s}"`);o=Ki}if(n){const r={},n=[];for(let t=0;t<e.stops.length;t++){const i=e.stops[t],s=i[0].zoom;void 0===r[s]&&(r[s]={zoom:s,type:e.type,property:e.property,default:e.default,stops:[]},n.push(s)),r[s].stops.push([i[0].value,i[1]])}const i=[];for(const e of n)i.push([r[e].zoom,Hi(r[e],t)]);const s={name:"linear"};return{kind:"composite",interpolationType:s,interpolationFactor:ai.interpolationFactor.bind(void 0,s),zoomStops:i.map(e=>e[0]),evaluate:({zoom:r},n)=>Ji({stops:i,base:e.base},t,r).evaluate(r,n)}}if(i){const r="exponential"===s?{name:"exponential",base:void 0!==e.base?e.base:1}:null;return{kind:"camera",interpolationType:r,interpolationFactor:ai.interpolationFactor.bind(void 0,r),zoomStops:e.stops.map(e=>e[0]),evaluate:({zoom:r})=>o(e,t,r,a,l)}}return{kind:"source",evaluate(r,n){const i=n&&n.properties?n.properties[e.property]:void 0;return void 0===i?Zi(e.default,t.default):o(e,t,i,a,l)}}}function Zi(e,t,r){return void 0!==e?e:void 0!==t?t:void 0!==r?r:void 0}function Yi(e,t,r,n,i){return Zi(typeof r===i?n[r]:void 0,e.default,t.default)}function Wi(e,t,r){if(!fr(r))return Zi(e.default,t.default);const n=e.stops.length;if(1===n)return e.stops[0][1];if(r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[n-1][0])return e.stops[n-1][1];const i=Nn(e.stops.map(e=>e[0]),r);return e.stops[i][1]}function Ji(e,t,r){const n=void 0!==e.base?e.base:1;if(!fr(r))return Zi(e.default,t.default);const i=e.stops.length;if(1===i)return e.stops[0][1];if(r<=e.stops[0][0])return e.stops[0][1];if(r>=e.stops[i-1][0])return e.stops[i-1][1];const s=Nn(e.stops.map(e=>e[0]),r),o=function(e,t,r,n){const i=n-r,s=e-r;return 0===i?0:1===t?s/i:(Math.pow(t,s)-1)/(Math.pow(t,i)-1)}(r,n,e.stops[s][0],e.stops[s+1][0]),a=e.stops[s][1],l=e.stops[s+1][1];let u=Vt[t.type]||qi;if(e.colorSpace&&"rgb"!==e.colorSpace){const t=oi[e.colorSpace];u=(e,r)=>t.reverse(t.interpolate(t.forward(e),t.forward(r),o))}return"function"==typeof a.evaluate?{evaluate(...e){const t=a.evaluate.apply(void 0,e),r=l.evaluate.apply(void 0,e);if(void 0!==t&&void 0!==r)return u(t,r,o)}}:u(a,l,o)}function Ki(e,t,r){return"color"===t.type?r=Pt.parse(r):"formatted"===t.type?r=er.fromString(r.toString()):"resolvedImage"===t.type?r=rr.build(r.toString()):dr(r)===t.type||"enum"===t.type&&t.values[r]||(r=void 0),Zi(r,e.default,t.default)}vr.register(Vi,{error:[{kind:"error"},[Lt],(e,[t])=>{throw new lr(t.evaluate(e))}],typeof:[Lt,[Nt],(e,[t])=>qt(sr(t.evaluate(e)))],"to-rgba":[Xt(Ft,4),[Ot],(e,[t])=>t.evaluate(e).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Xt(Ft,4),[Ot],(e,[t])=>t.evaluate(e).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[Ot,[Ft,Ft,Ft],Ei],rgba:[Ot,[Ft,Ft,Ft,Ft],Ei],hsl:[Ot,[Ft,Ft,Ft],Di],hsla:[Ot,[Ft,Ft,Ft,Ft],Di],has:{type:Rt,overloads:[[[Lt],(e,[t])=>Ci(t.evaluate(e),e.properties())],[[Lt,Ut],(e,[t,r])=>Ci(t.evaluate(e),r.evaluate(e))]]},get:{type:Nt,overloads:[[[Lt],(e,[t])=>Fi(t.evaluate(e),e.properties())],[[Lt,Ut],(e,[t,r])=>Fi(t.evaluate(e),r.evaluate(e))]]},"feature-state":[Nt,[Lt],(e,[t])=>Fi(t.evaluate(e),e.featureState||{})],properties:[Ut,[],e=>e.properties()],"geometry-type":[Lt,[],e=>e.geometryType()],worldview:[Lt,[],e=>e.globals.worldview||""],"is-active-floor":[Rt,Li(Lt),(e,t)=>{if(!(e.globals&&e.globals.activeFloors&&e.globals.activeFloors.size>0))return!1;if(0===t.length)return!0;const r=e.globals.activeFloors;return t.some(t=>{const n=t.evaluate(e);return r.has(n)})}],id:[Nt,[],e=>e.id()],zoom:[Ft,[],e=>e.globals.zoom],pitch:[Ft,[],e=>e.globals.pitch||0],"distance-from-center":[Ft,[],e=>e.distanceFromCenter()],"measure-light":[Ft,[Lt],(e,[t])=>e.measureLight(t.evaluate(e))],"heatmap-density":[Ft,[],e=>e.globals.heatmapDensity||0],"line-progress":[Ft,[],e=>e.globals.lineProgress||0],"raster-value":[Ft,[],e=>e.globals.rasterValue||0],"raster-particle-speed":[Ft,[],e=>e.globals.rasterParticleSpeed||0],"sky-radial-progress":[Ft,[],e=>e.globals.skyRadialProgress||0],accumulated:[Nt,[],e=>void 0===e.globals.accumulated?null:e.globals.accumulated],"+":[Ft,Li(Ft),(e,t)=>{let r=0;for(const n of t)r+=n.evaluate(e);return r}],"*":[Ft,Li(Ft),(e,t)=>{let r=1;for(const n of t)r*=n.evaluate(e);return r}],"-":{type:Ft,overloads:[[[Ft,Ft],(e,[t,r])=>t.evaluate(e)-r.evaluate(e)],[[Ft],(e,[t])=>-t.evaluate(e)]]},"/":[Ft,[Ft,Ft],(e,[t,r])=>t.evaluate(e)/r.evaluate(e)],"%":[Ft,[Ft,Ft],(e,[t,r])=>t.evaluate(e)%r.evaluate(e)],ln2:[Ft,[],()=>Math.LN2],pi:[Ft,[],()=>Math.PI],e:[Ft,[],()=>Math.E],"^":[Ft,[Ft,Ft],(e,[t,r])=>Math.pow(t.evaluate(e),r.evaluate(e))],sqrt:[Ft,[Ft],(e,[t])=>Math.sqrt(t.evaluate(e))],log10:[Ft,[Ft],(e,[t])=>Math.log(t.evaluate(e))/Math.LN10],ln:[Ft,[Ft],(e,[t])=>Math.log(t.evaluate(e))],log2:[Ft,[Ft],(e,[t])=>Math.log2(t.evaluate(e))],sin:[Ft,[Ft],(e,[t])=>Math.sin(t.evaluate(e))],cos:[Ft,[Ft],(e,[t])=>Math.cos(t.evaluate(e))],tan:[Ft,[Ft],(e,[t])=>Math.tan(t.evaluate(e))],asin:[Ft,[Ft],(e,[t])=>Math.asin(t.evaluate(e))],acos:[Ft,[Ft],(e,[t])=>Math.acos(t.evaluate(e))],atan:[Ft,[Ft],(e,[t])=>Math.atan(t.evaluate(e))],min:[Ft,Li(Ft),(e,t)=>Math.min(...t.map(t=>t.evaluate(e)))],max:[Ft,Li(Ft),(e,t)=>Math.max(...t.map(t=>t.evaluate(e)))],abs:[Ft,[Ft],(e,[t])=>Math.abs(t.evaluate(e))],round:[Ft,[Ft],(e,[t])=>{const r=t.evaluate(e);return r<0?-Math.round(-r):Math.round(r)}],floor:[Ft,[Ft],(e,[t])=>Math.floor(t.evaluate(e))],ceil:[Ft,[Ft],(e,[t])=>Math.ceil(t.evaluate(e))],"filter-==":[Rt,[Lt,Nt],(e,[t,r])=>e.properties()[t.value]===r.value],"filter-id-==":[Rt,[Nt],(e,[t])=>e.id()===t.value],"filter-type-==":[Rt,[Lt],(e,[t])=>e.geometryType()===t.value],"filter-<":[Rt,[Lt,Nt],(e,[t,r])=>{const n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n<i}],"filter-id-<":[Rt,[Nt],(e,[t])=>{const r=e.id(),n=t.value;return typeof r==typeof n&&r<n}],"filter->":[Rt,[Lt,Nt],(e,[t,r])=>{const n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n>i}],"filter-id->":[Rt,[Nt],(e,[t])=>{const r=e.id(),n=t.value;return typeof r==typeof n&&r>n}],"filter-<=":[Rt,[Lt,Nt],(e,[t,r])=>{const n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n<=i}],"filter-id-<=":[Rt,[Nt],(e,[t])=>{const r=e.id(),n=t.value;return typeof r==typeof n&&r<=n}],"filter->=":[Rt,[Lt,Nt],(e,[t,r])=>{const n=e.properties()[t.value],i=r.value;return typeof n==typeof i&&n>=i}],"filter-id->=":[Rt,[Nt],(e,[t])=>{const r=e.id(),n=t.value;return typeof r==typeof n&&r>=n}],"filter-has":[Rt,[Nt],(e,[t])=>t.value in e.properties()],"filter-has-id":[Rt,[],e=>null!==e.id()&&void 0!==e.id()],"filter-type-in":[Rt,[Xt(Lt)],(e,[t])=>t.value.includes(e.geometryType())],"filter-id-in":[Rt,[Xt(Nt)],(e,[t])=>t.value.includes(e.id())],"filter-in-small":[Rt,[Lt,Xt(Nt)],(e,[t,r])=>r.value.includes(e.properties()[t.value])],"filter-in-large":[Rt,[Lt,Xt(Nt)],(e,[t,r])=>function(e,t,r,n){for(;r<=n;){const i=r+n>>1;if(t[i]===e)return!0;t[i]>e?n=i-1:r=i+1}return!1}(e.properties()[t.value],r.value,0,r.value.length-1)],all:{type:Rt,overloads:[[[Rt,Rt],(e,[t,r])=>t.evaluate(e)&&r.evaluate(e)],[Li(Rt),(e,t)=>{for(const r of t)if(!r.evaluate(e))return!1;return!0}]]},any:{type:Rt,overloads:[[[Rt,Rt],(e,[t,r])=>t.evaluate(e)||r.evaluate(e)],[Li(Rt),(e,t)=>{for(const r of t)if(r.evaluate(e))return!0;return!1}]]},"!":[Rt,[Rt],(e,[t])=>!t.evaluate(e)],"is-supported-script":[Rt,[Lt],(e,[t])=>{const r=e.globals&&e.globals.isSupportedScript;return!r||r(t.evaluate(e))}],upcase:[Lt,[Lt],(e,[t])=>t.evaluate(e).toUpperCase()],downcase:[Lt,[Lt],(e,[t])=>t.evaluate(e).toLowerCase()],concat:[Lt,Li(Nt),(e,t)=>t.map(t=>or(t.evaluate(e))).join("")],"resolved-locale":[Lt,[jt],(e,[t])=>t.evaluate(e).resolvedLocale()],random:[Ft,[Ft,Ft,Nt],(e,t)=>{const[r,n,i]=t.map(t=>t.evaluate(e));if(r>n)return r;if(r===n)return r;let s;if("string"==typeof i)s=function(e){let t=0;if(0===e.length)return t;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return t}(i);else{if("number"!=typeof i)throw new lr(`Invalid seed input: ${i}`);s=i}return r+ki(s)()*(n-r)}]});class Qi{constructor(e,t,r,n,i){var s;this.expression=e,this._warningHistory={},this._scope=r,this._options=n,this._iconImageUseTheme=i,this._evaluator=new xr(r,n,i),this._defaultValue=t?"color"===(s=t).type&&(Xi(s.default)||Array.isArray(s.default))?new Pt(0,0,0,0):"color"===s.type?Pt.parse(s.default)||null:void 0===s.default?null:s.default:null,this._enumValues=t&&"enum"===t.type?t.values:null,this.configDependencies=Ri(e),this.isIndoorDependent=Oi(e)}evaluateWithoutErrorHandling(e,t,r,n,i,s,o,a){return this._evaluator.globals=e,this._evaluator.feature=t,this._evaluator.featureState=r,this._evaluator.canonical=n||null,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s,this._evaluator.featureTileCoord=o||null,this._evaluator.featureDistanceData=a||null,this.expression.evaluate(this._evaluator)}evaluate(e,t,r,n,i,s,o,a,l){this._evaluator||(this._evaluator=new xr(this._scope,this._options,this._iconImageUseTheme)),this._evaluator.globals=e,this._evaluator.feature=t||null,this._evaluator.featureState=r||null,this._evaluator.canonical=n||null,this._evaluator.availableImages=i||null,this._evaluator.formattedSection=s||null,this._evaluator.featureTileCoord=o||null,this._evaluator.featureDistanceData=a||null,this._evaluator.iconImageUseTheme=l||null;try{const e=this.expression.evaluate(this._evaluator);if(null==e||"number"==typeof e&&e!=e)return this._defaultValue;if(this._enumValues&&!(e in this._enumValues))throw new lr(`Expected value to be one of ${Object.keys(this._enumValues).map(e=>JSON.stringify(e)).join(", ")}, but found ${JSON.stringify(e)} instead.`);return e}catch(u){const e=u;return this._warningHistory[e.message]||(this._warningHistory[e.message]=!0),this._defaultValue}}}function es(e){return Array.isArray(e)&&e.length>0&&"string"==typeof e[0]&&e[0]in Vi}function ts(e,t,r,n,i){const s=new On(Vi,[],t?function(e){const t={color:Ot,string:Lt,number:Ft,enum:Lt,boolean:Rt,formatted:$t,resolvedImage:Gt};return"array"===e.type?Xt(t[e.value]||Nt,e.length):t[e.type]}(t):void 0,void 0,void 0,r,n,i),o=s.parse(e,void 0,void 0,void 0,t&&"string"===t.type?{typeAnnotation:"coerce"}:void 0);return o?Ui(new Qi(o,t,r,n,i)):Ni(s.errors)}class rs{constructor(e,t,r,n){this.kind=e,this._styleExpression=t,this.isLightConstant=r,this.isLineProgressConstant=n,this.isStateDependent="constant"!==e&&!Vn(t.expression),this.configDependencies=Ri(t.expression),this.isIndoorDependent=Oi(t.expression)}evaluateWithoutErrorHandling(e,t,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(e,t,r,n,i,s)}evaluate(e,t,r,n,i,s,o){return this._styleExpression.evaluate(e,t,r,n,i,s,void 0,void 0,o)}}class ns{constructor(e,t,r,n,i,s){this.kind=e,this.zoomStops=r,this._styleExpression=t,this.isStateDependent="camera"!==e&&!Vn(t.expression),this.isIndoorDependent=Oi(t.expression),this.isLightConstant=i,this.isLineProgressConstant=s,this.configDependencies=Ri(t.expression),this.interpolationType=n}evaluateWithoutErrorHandling(e,t,r,n,i,s){return this._styleExpression.evaluateWithoutErrorHandling(e,t,r,n,i,s)}evaluate(e,t,r,n,i,s){return this._styleExpression.evaluate(e,t,r,n,i,s)}interpolationFactor(e,t,r){return this.interpolationType?ai.interpolationFactor(this.interpolationType,e,t,r):0}}function is(e,t,r,n,i){if("error"===(e=ts(e,t,r,n,i)).result)return e;const s=e.value.expression,o=kn(s);if(!o&&!$i(t))return Ni([new Et("","data expressions not supported")]);const a=En(s,["zoom","pitch","distance-from-center"]);if(!a&&!function(e){return ji(e.expression,"zoom")}(t))return Ni([new Et("","zoom expressions not supported")]);const l=En(s,["measure-light"]);if(!l&&!function(e){return ji(e.expression,"measure-light")}(t))return Ni([new Et("","measure-light expression not supported")]);const u=En(s,["line-progress"]);if(!u&&!ji(t.expression,"line-progress"))return Ni([new Et("","line-progress expression not supported")]);const c=t.expression&&t.expression.relaxZoomRestriction,h=os(s);return h||a||c?h instanceof Et?Ni([h]):h instanceof ai&&!Gi(t)?Ni([new Et("",'"interpolate" expressions cannot be used with this property')]):Ui(h?new ns(o&&u?"camera":"composite",e.value,h.labels,h instanceof ai?h.interpolation:void 0,l,u):new rs(o&&u?"constant":"source",e.value,l,u)):Ni([new Et("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class ss{constructor(e,t){this._parameters=e,this._specification=t,Object.assign(this,Hi(this._parameters,this._specification))}static deserialize(e){return new ss(e._parameters,e._specification)}static serialize(e){return{_parameters:e._parameters,_specification:e._specification}}}function os(e){let t=null;if(e instanceof hi)t=os(e.result);else if(e instanceof ui){for(const r of e.args)if(t=os(r),t)break}else(e instanceof jn||e instanceof ai)&&e.input instanceof vr&&"zoom"===e.input.name&&(t=e);return t instanceof Et||e.eachChild(e=>{const r=os(e);r instanceof Et?t=r:t&&r&&t!==r&&(t=new Et("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}var as,ls,us=function(){if(ls)return as;ls=1,as=t;var e=3;function t(t,r,n){var i=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;var s=new Int32Array(this.arrayBuffer);t=s[0],this.d=(r=s[1])+2*(n=s[2]);for(var o=0;o<this.d*this.d;o++){var a=s[e+o],l=s[e+o+1];i.push(a===l?null:s.subarray(a,l))}var u=s[e+i.length+1];this.keys=s.subarray(s[e+i.length],u),this.bboxes=s.subarray(u),this.insert=this._insertReadonly}else{this.d=r+2*n;for(var c=0;c<this.d*this.d;c++)i.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=n,this.scale=r/t,this.uid=0;var h=n/r*t;this.min=-h,this.max=t+h}return t.prototype.insert=function(e,t,r,n,i){this._forEachCell(t,r,n,i,this._insertCell,this.uid++),this.keys.push(e),this.bboxes.push(t),this.bboxes.push(r),this.bboxes.push(n),this.bboxes.push(i)},t.prototype._insertReadonly=function(){throw"Cannot insert into a GridIndex created from an ArrayBuffer."},t.prototype._insertCell=function(e,t,r,n,i,s){this.cells[i].push(s)},t.prototype.query=function(e,t,r,n,i){var s=this.min,o=this.max;if(e<=s&&t<=s&&o<=r&&o<=n&&!i)return Array.prototype.slice.call(this.keys);var a=[];return this._forEachCell(e,t,r,n,this._queryCell,a,{},i),a},t.prototype._queryCell=function(e,t,r,n,i,s,o,a){var l=this.cells[i];if(null!==l)for(var u=this.keys,c=this.bboxes,h=0;h<l.length;h++){var p=l[h];if(void 0===o[p]){var d=4*p;(a?a(c[d+0],c[d+1],c[d+2],c[d+3]):e<=c[d+2]&&t<=c[d+3]&&r>=c[d+0]&&n>=c[d+1])?(o[p]=!0,s.push(u[p])):o[p]=!1}}},t.prototype._forEachCell=function(e,t,r,n,i,s,o,a){for(var l=this._convertToCellCoord(e),u=this._convertToCellCoord(t),c=this._convertToCellCoord(r),h=this._convertToCellCoord(n),p=l;p<=c;p++)for(var d=u;d<=h;d++){var f=this.d*d+p;if((!a||a(this._convertFromCellCoord(p),this._convertFromCellCoord(d),this._convertFromCellCoord(p+1),this._convertFromCellCoord(d+1)))&&i.call(this,e,t,r,n,f,s,o,a))return}},t.prototype._convertFromCellCoord=function(e){return(e-this.padding)/this.scale},t.prototype._convertToCellCoord=function(e){return Math.max(0,Math.min(this.d-1,Math.floor(e*this.scale)+this.padding))},t.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var t=this.cells,r=e+this.cells.length+1+1,n=0,i=0;i<this.cells.length;i++)n+=this.cells[i].length;var s=new Int32Array(r+n+this.keys.length+this.bboxes.length);s[0]=this.extent,s[1]=this.n,s[2]=this.padding;for(var o=r,a=0;a<t.length;a++){var l=t[a];s[e+a]=o,s.set(l,o),o+=l.length}return s[e+t.length]=o,s.set(this.keys,o),s[e+t.length+1]=o+=this.keys.length,s.set(this.bboxes,o),o+=this.bboxes.length,s.buffer},as}();const cs=ne(us),hs={};function ps(e,t,r={}){Object.defineProperty(e,"_classRegistryKey",{value:t,writable:!1}),hs[t]={klass:e,omit:r.omit||[]}}ps(Object,"Object"),cs.serialize=function(e,t){const r=e.toArrayBuffer();return t&&t.add(r),{buffer:r}},cs.deserialize=function(e){return new cs(e.buffer)},Object.defineProperty(cs,"name",{value:"Grid"}),ps(cs,"Grid"),delete oe.prototype.constructor,ps(Pt,"Color"),ps(Error,"Error"),ps(er,"Formatted"),ps(Qt,"FormattedSection"),ps(tt,"AJAXError"),ps(rr,"ResolvedImage"),ps(ss,"StylePropertyFunction"),ps(Qi,"StyleExpression",{omit:["_evaluator"]}),ps(It,"ImageId"),ps(tr,"ImageVariant"),ps(ns,"ZoomDependentExpression"),ps(rs,"ZoomConstantExpression"),ps(vr,"CompoundExpression",{omit:["_evaluate"]});for(const h_ in Vi)hs[Vi[h_]._classRegistryKey]||ps(Vi[h_],`Expression${h_}`);function ds(e){return e&&(e instanceof ArrayBuffer||e.constructor&&"ArrayBuffer"===e.constructor.name)}function fs(e,t){if(null===e)return null;const r=typeof e;if("object"!==r)return"bigint"===r?{$name:"BigInt",value:e.toString()}:e;if(Array.isArray(e)){const r=e.length,n=[];n.length=r;for(let i=0;i<r;i++)n[i]=fs(e[i],t);return n}if(ArrayBuffer.isView(e))return t&&t.add(e.buffer),e;if(ds(e)||e instanceof ImageBitmap)return t&&t.add(e),e;if(e instanceof ImageData)return t&&t.add(e.data.buffer),e;if(e instanceof Map){const r={$name:"Map",entries:[]};for(const[n,i]of e.entries())r.entries.push(fs(n),fs(i,t));return r}if(e instanceof Set){const t={$name:"Set"};let r=0;for(const n of e.values())t[++r]=fs(n);return t}if(e instanceof Date||e instanceof RegExp||e instanceof Boolean||e instanceof Number||e instanceof String)return e;const n=e.constructor,i=n._classRegistryKey;if(!i)throw new Error(`Can't serialize object of unregistered class "${n.name}".`);const s=n.serialize?n.serialize(e,t):{};if(!n.serialize){const r=hs[i].omit,n=e;for(const e in n)Object.hasOwn(n,e)&&(r.includes(e)||(s[e]=fs(n[e],t)));e instanceof Error&&(s.message=e.message)}if(s.$name)throw new Error("$name property is reserved for worker serialization logic.");return"Object"!==i&&(s.$name=i),s}function ms(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e)){for(let t=0;t<e.length;t++)e[t]=ms(e[t]);return e}if(ArrayBuffer.isView(e)||ds(e)||e instanceof ImageBitmap||e instanceof ImageData||e instanceof Date||e instanceof RegExp||e instanceof Boolean||e instanceof Number||e instanceof String)return e;const t=e.$name||"Object";if("Map"===t){const t=e.entries||[],r=/* @__PURE__ */new Map;for(let e=0;e<t.length;e+=2)r.set(ms(t[e]),ms(t[e+1]));return r}if("Set"===t){const t=/* @__PURE__ */new Set;for(const r in e)"$name"!==r&&t.add(ms(e[r]));return t}if("BigInt"===t)return BigInt(e.value);const{klass:r}=hs[t];if(!r)throw new Error(`Can't deserialize unregistered class "${t}".`);if(r.deserialize)return r.deserialize(e);const n=Object.create(r.prototype);for(const i in e)"$name"!==i&&(n[i]=ms(e[i]));return n}const ys=e=>e>=1536&&e<=1791,gs=e=>e>=1872&&e<=1919,xs=e=>e>=2208&&e<=2303,vs=e=>e>=11904&&e<=12031,bs=e=>e>=12032&&e<=12255,ws=e=>e>=12272&&e<=12287,_s=e=>e>=12288&&e<=12351,Is=e=>e>=12352&&e<=12447,As=e=>e>=12448&&e<=12543,Ss=e=>e>=12544&&e<=12591,Ms=e=>e>=12704&&e<=12735,Bs=e=>e>=12736&&e<=12783,Ps=e=>e>=12784&&e<=12799,zs=e=>e>=12800&&e<=13055,Ts=e=>e>=13056&&e<=13311,ks=e=>e>=13312&&e<=19903,Vs=e=>e>=19968&&e<=40959,Es=e=>e>=40960&&e<=42127,Ds=e=>e>=42128&&e<=42191,Cs=e=>e>=63744&&e<=64255,Fs=e=>e>=64336&&e<=65023,Ls=e=>e>=65040&&e<=65055,Rs=e=>e>=65072&&e<=65103,Os=e=>e>=65104&&e<=65135,Us=e=>e>=65136&&e<=65279,Ns=e=>e>=65280&&e<=65519;function js(e){for(const t of e)if(qs(t.charCodeAt(0)))return!0;return!1}function $s(e){for(const t of e)if(!Gs(t.charCodeAt(0)))return!1;return!0}function Gs(e){return!(ys(e)||gs(e)||xs(e)||Fs(e)||Us(e))}function Xs(e){return!(e<11904||!(Ms(e)||Ss(e)||Rs(e)||Cs(e)||Ts(e)||vs(e)||Bs(e)||_s(e)||ks(e)||Vs(e)||zs(e)||Ns(e)||Is(e)||ws(e)||bs(e)||Ps(e)||As(e)||Ls(e)||Ds(e)||Es(e)))}function qs(e){return!(746!==e&&747!==e&&(e<4352||!(Ms(e)||Ss(e)||Rs(e)&&!(e>=65097&&e<=65103)||Cs(e)||Ts(e)||vs(e)||Bs(e)||!(!_s(e)||e>=12296&&e<=12305||e>=12308&&e<=12319||12336===e)||ks(e)||Vs(e)||zs(e)||(t=e,t>=12592&&t<=12687)||(e=>e>=43360&&e<=43391)(e)||(e=>e>=55216&&e<=55295)(e)||(e=>e>=4352&&e<=4607)(e)||(e=>e>=44032&&e<=55215)(e)||Is(e)||ws(e)||(e=>e>=12688&&e<=12703)(e)||bs(e)||Ps(e)||As(e)&&12540!==e||!(!Ns(e)||65288===e||65289===e||65293===e||e>=65306&&e<=65310||65339===e||65341===e||65343===e||e>=65371&&e<=65503||65507===e||e>=65512&&e<=65519)||!(!Os(e)||e>=65112&&e<=65118||e>=65123&&e<=65126)||(e=>e>=5120&&e<=5759)(e)||(e=>e>=6320&&e<=6399)(e)||Ls(e)||(e=>e>=19904&&e<=19967)(e)||Es(e)||Ds(e))));var t}function Hs(e){return 12312===e||12313===e||12316===e||12540===e||12448===e}function Zs(e){return!(qs(e)||(t=e,(r=t)>=128&&r<=255&&(167===t||169===t||174===t||177===t||188===t||189===t||190===t||215===t||247===t)||(e=>e>=8192&&e<=8303)(t)&&(8214===t||8224===t||8225===t||8240===t||8241===t||8251===t||8252===t||8258===t||8263===t||8264===t||8265===t||8273===t)||(e=>e>=8448&&e<=8527)(t)||(e=>e>=8528&&e<=8591)(t)||(e=>e>=8960&&e<=9215)(t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||9003===t||t>=9085&&t<=9114||t>=9150&&t<=9165||9167===t||t>=9169&&t<=9179||t>=9186&&t<=9215)||(e=>e>=9216&&e<=9279)(t)&&9251!==t||(e=>e>=9280&&e<=9311)(t)||(e=>e>=9312&&e<=9471)(t)||(e=>e>=9632&&e<=9727)(t)||(e=>e>=9728&&e<=9983)(t)&&!(t>=9754&&t<=9759)||(e=>e>=11008&&e<=11263)(t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||_s(t)||As(t)||(e=>e>=57344&&e<=63743)(t)||Rs(t)||Os(t)||Ns(t)||8734===t||8756===t||8757===t||t>=9984&&t<=10087||t>=10102&&t<=10131||65532===t||65533===t));var t,r}function Ys(e){return ys(e)||gs(e)||xs(e)||Fs(e)||Us(e)}function Ws(e){return e>=1424&&e<=2303||Fs(e)||Us(e)}function Js(e,t){return!(!t&&Ws(e)||e>=2304&&e<=3583||e>=3840&&e<=4255||(r=e,r>=6016&&r<=6143));var r}function Ks(e){for(const t of e)if(Ws(t.charCodeAt(0)))return!0;return!1}const Qs="loading",eo="parsing",to="parsed",ro="loaded",no="error";let io="unavailable",so=null;const oo=function(){return io},ao={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>io===ro||null!=ao.applyArabicShaping,isLoading:()=>io===Qs,setState(e){io=e.pluginStatus,so=e.pluginURL},isParsing:()=>io===eo,isParsed:()=>io===to,getPluginURL:()=>so};class lo{constructor(e,t){this.zoom=e,t?(this.now=t.now,this.fadeDuration=t.fadeDuration,this.transition=t.transition,this.pitch=t.pitch,this.brightness=t.brightness,this.worldview=t.worldview,this.activeFloors=t.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(e){return function(e,t){for(const r of e)if(!Js(r.charCodeAt(0),t))return!1;return!0}(e,ao.isLoaded())}}class uo{constructor(e,t,r,n,i){this.property=e,this.value=t,this.expression=function(e,t,r,n,i){if(Xi(e))return new ss(e,t);if(es(e)||Array.isArray(e)&&e.length>0){const s=is(e,t,r,n,i);if("error"===s.result)throw new Error(s.value.map(e=>`${e.key}: ${e.message}`).join(", "));return s.value}{let r=e;return"string"==typeof e&&"color"===t.type&&(r=Pt.parse(e)),{kind:"constant",configDependencies:/* @__PURE__ */new Set,isIndoorDependent:!1,evaluate:()=>r}}}(void 0===t?e.specification.default:t,e.specification,r,n,i)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return"source"===this.expression.kind||"composite"===this.expression.kind}possiblyEvaluate(e,t,r,n){return this.property.possiblyEvaluate(this,e,t,r,n)}}class co{constructor(e,t,r,n){this.property=e,this.value=new uo(e,void 0,t,r,n)}transitioned(e,t){return new po(this.property,this.value,t,Object.assign({},e.transition,this.transition),e.now)}untransitioned(){return new po(this.property,this.value,null,{},0)}}class ho{constructor(e,t,r,n){this._properties=e,this._values=Object.create(e.defaultTransitionablePropertyValues),this._scope=t,this._options=r,this._iconImageUseTheme=n,this._isIndoorDependent=!1,this.configDependencies=/* @__PURE__ */new Set}getValue(e){return ge(this._values[e].value.value)}setValue(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new co(this._values[e].property,this._scope,this._options,this._iconImageUseTheme)),this._values[e].value=new uo(this._values[e].property,null===t?void 0:ge(t),this._scope,this._options,this._iconImageUseTheme),this._values[e].value.expression.configDependencies&&(this.configDependencies=/* @__PURE__ */new Set([...this.configDependencies,...this._values[e].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].value.isIndoorDependent())}setTransitionOrValue(e,t){t&&(this._options=t);const r=this._properties.properties;if(e)for(const n in e){const t=e[n];if(n.endsWith("-transition")){const e=n.slice(0,-11);r[e]&&this.setTransition(e,t)}else Object.hasOwn(r,n)&&this.setValue(n,t)}}getTransition(e){return ge(this._values[e].transition)}setTransition(e,t){Object.hasOwn(this._values,e)||(this._values[e]=new co(this._values[e].property)),this._values[e].transition=ge(t)||void 0}serialize(){const e={};for(const t of Object.keys(this._values)){const r=this.getValue(t);void 0!==r&&(e[t]=r);const n=this.getTransition(t);void 0!==n&&(e[`${t}-transition`]=n)}return e}transitioned(e,t){const r=new fo(this._properties);for(const n of Object.keys(this._values))r._values[n]=this._values[n].transitioned(e,t._values[n]);return r}untransitioned(){const e=new fo(this._properties);for(const t of Object.keys(this._values))e._values[t]=this._values[t].untransitioned();return e}isIndoorDependent(){return this._isIndoorDependent}}class po{constructor(e,t,r,n,i){const s=n.delay||0,o=n.duration||0;i=i||0,this.property=e,this.value=t,this.begin=i+s,this.end=this.begin+o,e.specification.transition&&(n.delay||n.duration)&&(this.prior=r)}possiblyEvaluate(e,t,r){const n=e.now||0,i=this.value.possiblyEvaluate(e,t,r),s=this.prior;if(s){if(n>this.end)return this.prior=null,i;if(this.value.isDataDriven())return this.prior=null,i;if(n<this.begin)return s.possiblyEvaluate(e,t,r);{const o=(n-this.begin)/(this.end-this.begin);return this.property.interpolate(s.possiblyEvaluate(e,t,r),i,function(e){if(e<=0)return 0;if(e>=1)return 1;const t=e*e,r=t*e;return 4*(e<.5?r:3*(e-t)+r-.75)}(o))}}return i}}class fo{constructor(e){this._properties=e,this._values=Object.create(e.defaultTransitioningPropertyValues)}possiblyEvaluate(e,t,r){const n=new go(this._properties);for(const i of Object.keys(this._values))n._values[i]=this._values[i].possiblyEvaluate(e,t,r);return n}hasTransition(){for(const e of Object.keys(this._values))if(this._values[e].prior)return!0;return!1}}class mo{constructor(e,t,r,n){this._properties=e,this._values=Object.create(e.defaultPropertyValues),this._scope=t,this._options=r,this._iconImageUseTheme=n,this._isIndoorDependent=!1,this.configDependencies=/* @__PURE__ */new Set}getValue(e){return ge(this._values[e].value)}setValue(e,t){this._values[e]=new uo(this._values[e].property,null===t?void 0:ge(t),this._scope,this._options,this._iconImageUseTheme),this._values[e].expression.configDependencies&&(this.configDependencies=/* @__PURE__ */new Set([...this.configDependencies,...this._values[e].expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[e].isIndoorDependent())}serialize(){const e={};for(const t of Object.keys(this._values)){const r=this.getValue(t);void 0!==r&&(e[t]=r)}return e}possiblyEvaluate(e,t,r,n){const i=new go(this._properties);for(const s of Object.keys(this._values))i._values[s]=this._values[s].possiblyEvaluate(e,t,r,n);return i}isIndoorDependent(){return this._isIndoorDependent}}class yo{constructor(e,t,r,n){this.property=e,this.value=t,this.parameters=r,this.iconImageUseTheme=n}isConstant(){return"constant"===this.value.kind}constantOr(e){return"constant"===this.value.kind?this.value.value:e}evaluate(e,t,r,n,i){return this.property.evaluate(this.value,this.parameters,e,t,r,n,this.iconImageUseTheme,i)}}class go{constructor(e){this._properties=e,this._values=Object.create(e.defaultPossiblyEvaluatedValues)}get(e){return this._values[e]}}class xo{constructor(e){this.specification=e}possiblyEvaluate(e,t){return e.expression.evaluate(t)}interpolate(e,t,r){const n=Vt[this.specification.type];return n?n(e,t,r):e}}class vo{constructor(e,t){this.specification=e,this.overrides=t}possiblyEvaluate(e,t,r,n,i){return"constant"===e.expression.kind||"camera"===e.expression.kind?new yo(this,{kind:"constant",value:e.expression.evaluate(t,null,{},r,n,void 0,i)},t):new yo(this,e.expression,t,i)}interpolate(e,t,r){if("constant"!==e.value.kind||"constant"!==t.value.kind)return e;if(void 0===e.value.value||void 0===t.value.value)return new yo(this,{kind:"constant",value:void 0},e.parameters);const n=Vt[this.specification.type];return n?new yo(this,{kind:"constant",value:n(e.value.value,t.value.value,r)},e.parameters):e}evaluate(e,t,r,n,i,s,o,a){return"constant"===e.kind?e.value:e.evaluate(t,r,n,i,s,a,o)}}class bo{constructor(e){this.specification=e}possiblyEvaluate(e,t,r,n){return!!e.expression.evaluate(t,null,{},r,n)}interpolate(){return!1}}class wo{constructor(e){this.properties=e,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];const t=new lo(0,{});for(const r in e){const n=e[r],i=n.specification;i&&i.overridable&&this.overridableProperties.push(r);const s=this.defaultPropertyValues[r]=new uo(n,void 0),o=this.defaultTransitionablePropertyValues[r]=new co(n);this.defaultTransitioningPropertyValues[r]=o.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=s.possiblyEvaluate(t)}}}ps(vo,"DataDrivenProperty"),ps(xo,"DataConstantProperty"),ps(bo,"ColorRampProperty");const _o=JSON.parse('{"$version":8,"$root":{"version":{"type":"enum","values":[8]},"fragment":{"type":"boolean"},"name":{"type":"string"},"metadata":{"type":"*"},"center":{"type":"array","value":"number"},"zoom":{"type":"number"},"bearing":{"type":"number","default":0,"period":360},"pitch":{"type":"number","default":0},"light":{"type":"light"},"lights":{"type":"array","value":"light-3d"},"terrain":{"type":"terrain","optional":true},"fog":{"type":"fog"},"snow":{"type":"snow"},"rain":{"type":"rain"},"camera":{"type":"camera"},"color-theme":{"type":"colorTheme"},"indoor":{"type":"indoor"},"imports":{"type":"array","value":"import"},"iconsets":{"type":"iconsets"},"schema":{"type":"schema"},"sources":{"type":"sources"},"sprite":{"type":"string"},"glyphs":{"type":"string","default":"mapbox://fonts/mapbox/{fontstack}/{range}.pbf"},"transition":{"type":"transition"},"projection":{"type":"projection"},"layers":{"type":"array","value":"layer"},"models":{"type":"models"},"featuresets":{"type":"featuresets"}},"featuresets":{"*":{"type":"featureset"}},"featureset":{"metadata":{"type":"*"},"selectors":{"type":"array","value":"selector"}},"selector":{"layer":{"type":"string"},"properties":{"type":"selectorProperty"},"featureNamespace":{"type":"string"},"_uniqueFeatureID":{"type":"boolean"}},"selectorProperty":{"*":{"type":"*"}},"model":{"type":"string"},"import":{"id":{"type":"string"},"url":{"type":"string"},"config":{"type":"config"},"data":{"type":"$root"},"color-theme":{"type":"colorTheme","optional":true}},"config":{"*":{"type":"*"}},"schema":{"*":{"type":"option"}},"option":{"default":{"type":"*","expression":{}},"type":{"type":"enum","values":{"string":1,"number":1,"boolean":1,"color":1}},"array":{"type":"boolean"},"minValue":{"type":"number"},"maxValue":{"type":"number"},"stepValue":{"type":"number"},"values":{"type":"array","value":"*"},"metadata":{"type":"*"}},"models":{"*":{"type":"model"}},"light-3d":{"id":{"type":"string"},"properties":{"type":"properties"},"type":{"type":"enum","values":{"ambient":{},"directional":{},"flat":{}}}},"properties":["properties_light_directional","properties_light_ambient","properties_light_flat"],"properties_light_directional":{"direction":{"type":"array","default":[210,30],"minimum":[0,0],"maximum":[360,90],"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"cast-shadows":{"type":"boolean","default":false},"shadow-quality":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"parameters":["zoom"]}},"shadow-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"shadow-draw-before-layer":{"type":"string"}},"properties_light_ambient":{"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"properties_light_flat":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"iconsets":{"*":{"type":"iconset"}},"iconset":["iconset_sprite","iconset_source"],"iconset_sprite":{"type":{"type":"enum","values":{"sprite":1}},"url":{"type":"string"}},"iconset_source":{"type":{"type":"enum","values":{"source":1}},"source":{"type":"string"}},"sources":{"*":{"type":"source"}},"source":["source_vector","source_raster","source_raster_dem","source_raster_array","source_geojson","source_video","source_image","source_model"],"source_vector":{"type":{"type":"enum","values":{"vector":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"attribution":{"type":"string"},"promoteId":{"type":"promoteId"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster":{"type":{"type":"enum","values":{"raster":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"scheme":{"type":"enum","values":{"xyz":1,"tms":1},"default":"xyz"},"attribution":{"type":"string"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_dem":{"type":{"type":"enum","values":{"raster-dem":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"encoding":{"type":"enum","values":{"terrarium":1,"mapbox":1},"default":"mapbox"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_raster_array":{"type":{"type":"enum","values":{"raster-array":1}},"url":{"type":"string"},"tiles":{"type":"array","value":"string"},"bounds":{"type":"array","value":"number","length":4,"default":[-180,-85.051129,180,85.051129]},"extra_bounds":{"type":"array","value":{"type":"array","value":"number","length":4}},"minzoom":{"type":"number","default":0},"maxzoom":{"type":"number","default":22},"tileSize":{"type":"number","default":512},"attribution":{"type":"string"},"rasterLayers":{"type":"*"},"volatile":{"type":"boolean","default":false},"*":{"type":"*"}},"source_geojson":{"type":{"type":"enum","values":{"geojson":1}},"data":{"type":"*"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"attribution":{"type":"string"},"buffer":{"type":"number","default":128,"maximum":512,"minimum":0},"filter":{"type":"*"},"tolerance":{"type":"number","default":0.375},"cluster":{"type":"boolean","default":false},"clusterRadius":{"type":"number","default":50,"minimum":0},"clusterMaxZoom":{"type":"number"},"clusterMinPoints":{"type":"number"},"clusterProperties":{"type":"*"},"lineMetrics":{"type":"boolean","default":false},"generateId":{"type":"boolean","default":false},"promoteId":{"type":"promoteId"},"dynamic":{"type":"boolean","default":false}},"source_video":{"type":{"type":"enum","values":{"video":1}},"urls":{"type":"array","value":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"source_image":{"type":{"type":"enum","values":{"image":1}},"url":{"type":"string"},"coordinates":{"type":"array","length":4,"value":{"type":"array","length":2,"value":"number"}}},"modelNodeOverride":{"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360}},"modelNodeOverrides":{"*":{"type":"modelNodeOverride"}},"modelMaterialOverride":{"model-color":{"type":"color"},"model-color-mix-intensity":{"type":"number"},"model-opacity":{"type":"number"},"model-emissive-strength":{"type":"number"}},"modelMaterialOverrides":{"*":{"type":"modelMaterialOverride"}},"modelSourceModel":{"uri":{"type":"string"},"position":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[-180,-90],"maximum":[180,90]},"orientation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360},"nodeOverrides":{"type":"modelNodeOverrides"},"materialOverrides":{"type":"modelMaterialOverrides"},"nodeOverrideNames":{"type":"array","value":"string"},"materialOverrideNames":{"type":"array","value":"string"},"featureProperties":{"type":"*"}},"modelSourceModels":{"*":{"type":"modelSourceModel"}},"source_model":{"type":{"type":"enum","values":{"model":1,"batched-model":1}},"url":{"type":"string"},"maxzoom":{"type":"number","default":18},"minzoom":{"type":"number","default":0},"tiles":{"type":"array","value":"string"},"models":{"type":"modelSourceModels"}},"layer":{"id":{"type":"string"},"type":{"type":"enum","values":{"fill":{},"line":{},"symbol":{},"circle":{},"heatmap":{},"fill-extrusion":{},"building":{},"raster":{},"raster-particle":{},"hillshade":{},"model":{},"background":{},"sky":{},"slot":{},"clip":{}}},"metadata":{"type":"*"},"source":{"type":"string"},"source-layer":{"type":"string"},"slot":{"type":"string"},"minzoom":{"type":"number","minimum":0,"maximum":24},"maxzoom":{"type":"number","minimum":0,"maximum":24},"filter":{"type":"filter"},"layout":{"type":"layout"},"paint":{"type":"paint"},"appearances":{"type":"array","value":"appearance","supported-layer-types":["symbol"]}},"appearance":{"condition":{"type":"boolean","expression":{"interpolated":true,"parameters":["zoom","pitch","feature","feature-state","measure-light","distance-from-center"]},"property-type":"data-driven"},"name":{"type":"string"},"properties":{"type":"*"}},"layout":["layout_clip","layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_building","layout_symbol","layout_raster","layout_raster-particle","layout_hillshade","layout_background","layout_sky","layout_model"],"layout_background":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_sky":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_model":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"model-id":{"type":"string","default":"","property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"model-allow-density-reduction":{"type":"boolean","default":true}},"layout_clip":{"clip-layer-types":{"type":"array","value":"enum","values":{"model":1,"symbol":1},"default":[],"expression":{}},"clip-layer-scope":{"type":"array","value":"string","default":[],"expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill":{"fill-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-base":1,"hd-road-markup":1},"default":"none","expression":{}},"fill-construct-bridge-guard-rail":{"type":"boolean","default":"true","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"}},"layout_circle":{"circle-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"circle-elevation-reference":{"type":"enum","values":{"none":1,"hd-road-markup":1},"default":"none","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_heatmap":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_fill-extrusion":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"fill-extrusion-edge-radius":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"source-max-zoom":{"type":"number","minimum":0,"maximum":24}},"layout_building":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"building-facade":{"type":"boolean","default":false,"expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-facade-floors":{"type":"number","minimum":1,"maximum":200,"default":3,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-unit-width":{"type":"number","minimum":1,"maximum":20,"default":3.1,"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-facade-window":{"type":"array","length":2,"value":"number","minimum":0.1,"maximum":1,"default":[0.9,0.9],"property-type":"data-driven","expression":{"parameters":["feature"]}},"building-roof-shape":{"type":"enum","values":{"flat":1,"hipped":1,"gabled":1,"parapet":1,"mansard":1,"skillion":1,"pyramidal":1},"default":"flat","expression":{"parameters":["feature"]},"property-type":"data-driven"},"building-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{},"property-type":"data-driven"},"building-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"building-flip-roof-orientation":{"property-type":"data-driven","type":"boolean","default":false,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}}},"layout_line":{"line-cap":{"type":"enum","values":{"butt":1,"round":1,"square":1},"default":"butt","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-join":{"type":"enum","values":{"bevel":1,"round":1,"miter":1,"none":1},"default":"miter","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{"type":"number","default":2,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-round-limit":{"type":"number","default":1.05,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-z-offset":{"type":"number","default":0,"expression":{"parameters":["zoom","feature","line-progress"]},"property-type":"data-driven"},"line-elevation-reference":{"type":"enum","values":{"none":1,"sea":1,"ground":1,"hd-road-markup":1},"default":"none","expression":{}},"line-cross-slope":{"type":"number","expression":{}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}},"line-width-unit":{"type":"enum","values":{"pixels":1,"meters":1},"default":"pixels","expression":{"parameters":["zoom"]}},"line-elevation-ground-scale":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","feature","line-progress"]},"transition":true,"property-type":"data-driven"}},"layout_symbol":{"symbol-placement":{"type":"enum","values":{"point":1,"line":1,"line-center":1},"default":"point","expression":{"parameters":["zoom"]}},"symbol-spacing":{"type":"number","default":250,"minimum":1,"expression":{"interpolated":true,"parameters":["zoom"]}},"symbol-avoid-edges":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-sort-key":{"type":"number","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{"type":"enum","values":{"auto":1,"viewport-y":1,"source":1},"default":"auto","expression":{"parameters":["zoom"]}},"symbol-z-elevate":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"symbol-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{"parameters":["zoom"]}},"icon-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"icon-size":{"type":"number","default":1,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"icon-text-fit":{"type":"enum","values":{"none":1,"width":1,"height":1,"both":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit-padding":{"type":"array","value":"number","length":4,"default":[0,0,0,0],"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-image":{"type":"resolvedImage","tokens":true,"appearance":true,"use-theme":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-keep-upright":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"icon-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-rotation-alignment":{"type":"enum","values":{"map":1,"viewport":1,"auto":1},"default":"auto","expression":{"parameters":["zoom"]}},"text-field":{"type":"formatted","default":"","tokens":true,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-font":{"type":"array","value":"string","default":["Open Sans Regular","Arial Unicode MS Regular"],"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size":{"type":"number","default":16,"minimum":0,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-size-scale-range":{"type":"array","value":"number","length":2,"default":[0.8,2],"minimum":[0.1,0.1],"maximum":[10,10],"expression":{}},"text-max-width":{"type":"number","default":10,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{"type":"number","default":1.2,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-letter-spacing":{"type":"number","default":0,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-justify":{"type":"enum","values":{"auto":1,"left":1,"center":1,"right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{"type":"number","default":0,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["zoom","feature"]}},"text-variable-anchor":{"type":"array","value":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"expression":{"parameters":["zoom"]}},"text-anchor":{"type":"enum","values":{"center":1,"left":1,"right":1,"top":1,"bottom":1,"top-left":1,"top-right":1,"bottom-left":1,"bottom-right":1},"default":"center","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{"type":"number","default":45,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-writing-mode":{"type":"array","value":"enum","values":{"horizontal":1,"vertical":1},"expression":{"parameters":["zoom"]}},"text-rotate":{"type":"number","default":0,"period":360,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-padding":{"type":"number","default":2,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-keep-upright":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"text-transform":{"type":"enum","values":{"none":1,"uppercase":1,"lowercase":1},"default":"none","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-offset":{"type":"array","value":"number","length":2,"default":[0,0],"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-ignore-placement":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"text-optional":{"type":"boolean","default":false,"expression":{"parameters":["zoom"]}},"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_raster-particle":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"layout_hillshade":{"visibility":{"type":"enum","values":{"visible":1,"none":1},"default":"visible","expression":{}}},"filter":{"type":"array","value":"*"},"filter_symbol":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature","pitch","distance-from-center"]}},"filter_fill":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_hillshade":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_raster-particle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_clip":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_model":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_line":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_circle":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_fill-extrusion":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_building":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_heatmap":{"type":"boolean","default":false,"property-type":"data-driven","expression":{"parameters":["zoom","feature"]}},"filter_operator":{"type":"enum","values":{"==":1,"!=":1,">":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"line-blend-mode":{"type":"enum","values":{"default":1,"multiply":1,"additive":1},"default":"default","expression":{"parameters":["zoom"]}}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"appearance":true,"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"appearance":true,"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"appearance":true,"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"appearance":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1},"default":"sea","expression":{}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}},"model-ignore-line-cutout":{"type":"boolean","default":false,"expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function Io(e){if(Array.isArray(e))return e.map(Io);if(e instanceof Object&&!(e instanceof Number||e instanceof String||e instanceof Boolean)){const t={};for(const r in e)t[r]=Io(e[r]);return t}return function(e){return e instanceof Number||e instanceof String||e instanceof Boolean?e.valueOf():e}(e)}function Ao(e){if(!0===e||!1===e)return!0;if(!Array.isArray(e)||0===e.length)return!1;switch(e[0]){case"has":return e.length>=2&&"$id"!==e[1]&&"$type"!==e[1];case"in":return e.length>=3&&("string"!=typeof e[1]||Array.isArray(e[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return 3!==e.length||Array.isArray(e[1])||Array.isArray(e[2]);case"any":case"all":for(const t of e.slice(1))if(!Ao(t)&&"boolean"!=typeof t)return!1;return!0;default:return!0}}function So(e,t="",r=null,n="fill"){if(null==e)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Ao(e)||(e=Vo(e));const i=e;let s=!0;try{s=function(e){if(!Po(e))return e;let t=Io(e);return Bo(t),t=Mo(t),t}(i)}catch(c){}let o=null,a=null;if("background"!==n&&"sky"!==n&&"slot"!==n){a=_o[`filter_${n}`];const e=ts(s,a,t,r);if("error"===e.result)throw new Error(e.value.map(e=>`${e.key}: ${e.message}`).join(", "));o=(t,r,n)=>e.value.evaluate(t,r,{},n)}let l=null,u=null;if(s!==i){const e=ts(i,a,t,r);if("error"===e.result)throw new Error(e.value.map(e=>`${e.key}: ${e.message}`).join(", "));l=(t,r,n,i,s)=>e.value.evaluate(t,r,{},n,void 0,void 0,i,s),u=!kn(e.value.expression)}return{filter:o,dynamicFilter:l||void 0,needGeometry:ko(s),needFeature:!!u}}function Mo(e){if(!Array.isArray(e))return e;const t=function(e){if(zo.has(e[0]))for(let t=1;t<e.length;t++)if(Po(e[t]))return!0;return e}(e);return!0===t?t:t.map(e=>Mo(e))}function Bo(e){let t=!1;const r=[];if("case"===e[0]){for(let n=1;n<e.length-1;n+=2)t=t||Po(e[n]),r.push(e[n+1]);r.push(e.at(-1))}else if("match"===e[0]){t=t||Po(e[1]);for(let t=2;t<e.length-1;t+=2)r.push(e[t+1]);r.push(e.at(-1))}else if("step"===e[0]){t=t||Po(e[1]);for(let t=1;t<e.length-1;t+=2)r.push(e[t+1])}t&&(e.length=0,e.push("any",...r));for(let n=1;n<e.length;n++)Bo(e[n])}function Po(e){if(!Array.isArray(e))return!1;if("pitch"===(t=e[0])||"distance-from-center"===t)return!0;var t;for(let r=1;r<e.length;r++)if(Po(e[r]))return!0;return!1}const zo=/* @__PURE__ */new Set(["in","==","!=",">",">=","<","<=","to-boolean"]);function To(e,t){return e<t?-1:e>t?1:0}function ko(e){if(!Array.isArray(e))return!1;if("within"===e[0]||"distance"===e[0])return!0;for(let t=1;t<e.length;t++)if(ko(e[t]))return!0;return!1}function Vo(e){if(!e)return!0;const t=e[0];return e.length<=1?"any"!==t:"=="===t?Eo(e[1],e[2],"=="):"!="===t?Fo(Eo(e[1],e[2],"==")):"<"===t||">"===t||"<="===t||">="===t?Eo(e[1],e[2],t):"any"===t?(r=e.slice(1),["any"].concat(r.map(Vo))):"all"===t?["all"].concat(e.slice(1).map(Vo)):"none"===t?["all"].concat(e.slice(1).map(Vo).map(Fo)):"in"===t?Do(e[1],e.slice(2)):"!in"===t?Fo(Do(e[1],e.slice(2))):"has"===t?Co(e[1]):"!has"!==t||Fo(Co(e[1]));var r}function Eo(e,t,r){switch(e){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,e,t]}}function Do(e,t){if(0===t.length)return!1;switch(e){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(e=>typeof e!=typeof t[0])?["filter-in-large",e,["literal",t.sort(To)]]:["filter-in-small",e,["literal",t]]}}function Co(e){switch(e){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",e]}}function Fo(e){return["!",e]}function Lo(e,t){return t?`${e}${t}`:e}function Ro(e){const t=e.indexOf("");return t>=0?e.slice(t+1):""}let Oo;const Uo=()=>Oo||(Oo=new wo({"icon-size":new vo(_o.layout_symbol["icon-size"]),"icon-image":new vo(_o.layout_symbol["icon-image"]),"icon-rotate":new vo(_o.layout_symbol["icon-rotate"]),"icon-offset":new vo(_o.layout_symbol["icon-offset"]),"text-size":new vo(_o.layout_symbol["text-size"]),"text-rotate":new vo(_o.layout_symbol["text-rotate"]),"text-offset":new vo(_o.layout_symbol["text-offset"])}));let No;const jo=()=>No||(No=new wo({"icon-opacity":new vo(_o.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new vo(_o.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new vo(_o.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new vo(_o.paint_symbol["text-emissive-strength"]),"icon-color":new vo(_o.paint_symbol["icon-color"]),"icon-halo-color":new vo(_o.paint_symbol["icon-halo-color"]),"icon-halo-width":new vo(_o.paint_symbol["icon-halo-width"]),"icon-halo-blur":new vo(_o.paint_symbol["icon-halo-blur"]),"icon-translate":new vo(_o.paint_symbol["icon-translate"]),"text-opacity":new vo(_o.paint_symbol["text-opacity"]),"text-occlusion-opacity":new vo(_o.paint_symbol["text-occlusion-opacity"]),"text-color":new vo(_o.paint_symbol["text-color"],{runtimeType:Ot,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new vo(_o.paint_symbol["text-halo-color"]),"text-halo-width":new vo(_o.paint_symbol["text-halo-width"]),"text-halo-blur":new vo(_o.paint_symbol["text-halo-blur"]),"text-translate":new vo(_o.paint_symbol["text-translate"]),"symbol-z-offset":new vo(_o.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"})}));class $o{constructor(e,t,r,n,i,s){this._conditionSpec=e,this._propertiesSpec=r;const o=ts(e,_o.appearance.condition);if("success"===o.result&&(this.condition=o.value),this.name=t,r){this.layoutProperties=new go(Uo()),this.unevaluatedLayout=new mo(Uo(),n,i,s),this.paintProperties=new go(jo()),this.unevaluatedPaint=new mo(jo(),n,i,"");for(const e in r)e in this.unevaluatedLayout._values?this.unevaluatedLayout.setValue(e,r[e]):e in this.unevaluatedPaint._values&&this.unevaluatedPaint.setValue(e,r[e])}}isActive(e){return!(this.condition||!e.isHidden||"hidden"!==this.name)||this.condition.evaluate(e.globals,e.feature,e.featureState,e.canonical)}getCondition(){return this.condition}getName(){return this.name}getLayoutProperty(e){return this.layoutProperties.get(e)}getPaintProperty(e){return this.paintProperties.get(e)}getUnevaluatedLayoutProperties(){return this.unevaluatedLayout}getUnevaluatedLayoutProperty(e){return this.unevaluatedLayout._values[e]}getUnevaluatedPaintProperty(e){return this.unevaluatedPaint._values[e]}recalculate(e,t,r){this.unevaluatedLayout&&(this.layoutProperties=this.unevaluatedLayout.possiblyEvaluate(e,void 0,t,r)),this.unevaluatedPaint&&(this.paintProperties=this.unevaluatedPaint.possiblyEvaluate(e,void 0,t,""))}serialize(){const e={};e.condition=this.condition.expression.serialize(),this.name&&(e.name=this.name);const t=this.unevaluatedLayout?this.unevaluatedLayout.serialize():{},r=this.unevaluatedPaint?this.unevaluatedPaint.serialize():{},n=Object.assign({},t,r);return Object.keys(n).length>0&&(e.properties=n),e}hasIconLayoutProperties(){const e=this.hasLayoutProperty("icon-image"),t=this.hasLayoutProperty("icon-size"),r=this.hasLayoutProperty("icon-offset"),n=this.hasLayoutProperty("icon-rotate");return e||t||r||n}hasTextLayoutProperties(){const e=this.hasLayoutProperty("text-size"),t=this.hasLayoutProperty("text-offset"),r=this.hasLayoutProperty("text-rotate");return e||t||r}hasIconPaintProperties(){return!!this.unevaluatedPaint&&Object.keys(this.unevaluatedPaint._values).filter(e=>!e.endsWith("-use-theme")).some(e=>(e.startsWith("icon-")||"symbol-z-offset"===e)&&this.hasPaintProperty(e))}hasTextPaintProperties(){return!!this.unevaluatedPaint&&Object.keys(this.unevaluatedPaint._values).filter(e=>!e.endsWith("-use-theme")).some(e=>(e.startsWith("text-")||"symbol-z-offset"===e)&&this.hasPaintProperty(e))}hasLayoutProperty(e){return this.unevaluatedLayout&&void 0!==this.unevaluatedLayout._values[e].value}hasPaintProperty(e){return this.unevaluatedPaint&&void 0!==this.unevaluatedPaint._values[e].value}}const Go="-transition",Xo=/* @__PURE__ */new Set(["fill","line","background","hillshade","raster"]);class qo extends _t{constructor(e,t,r,n,i,s){if(super(),this.id=e.id,this.fqid=Lo(this.id,r),this.type=e.type,this.scope=r,this.lut=n,this.options=i,this.iconImageUseTheme=s,this.appearances=new Array,this.appearancesVersion=0,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:/* @__PURE__ */new Set},"custom"!==e.type){if(this.metadata=e.metadata,this.minzoom=e.minzoom,this.maxzoom=e.maxzoom,e.type&&"background"!==e.type&&"sky"!==e.type&&"slot"!==e.type){this.source=e.source,this.sourceLayer=e["source-layer"],this.filter=e.filter;const t=ts(this.filter,_o[`filter_${e.type}`]);"error"!==t.result&&(this.expressionDependencies.configDependencies=/* @__PURE__ */new Set([...this.expressionDependencies.configDependencies,...t.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||t.value.isIndoorDependent)}if(e.slot&&(this.slot=e.slot),e.appearances&&this.setAppearances(e.appearances),t.layout&&(this._unevaluatedLayout=new mo(t.layout,this.scope,i,this.iconImageUseTheme),this.expressionDependencies.configDependencies=/* @__PURE__ */new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),t.paint){this._transitionablePaint=new ho(t.paint,this.scope,i);for(const t in e.paint)this.setPaintProperty(t,e.paint[t]);for(const t in e.layout)this.setLayoutProperty(t,e.layout[t]);this.expressionDependencies.configDependencies=/* @__PURE__ */new Set([...this.expressionDependencies.configDependencies,...this._transitionablePaint.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._transitionablePaint.isIndoorDependent(),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new go(t.paint)}}}onAdd(e){}onRemove(e){}isDraped(e){return!this.is3D(!0)&&Xo.has(this.type)}getLayoutProperty(e){return"visibility"===e?this.visibility:this._unevaluatedLayout.getValue(e)}setLayoutProperty(e,t){if("custom"===this.type&&"visibility"===e)return void(this.visibility=t);const r=this._unevaluatedLayout;r._properties.properties[e]&&(r.setValue(e,t),this.expressionDependencies.configDependencies=/* @__PURE__ */new Set([...this.expressionDependencies.configDependencies,...r.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||r.isIndoorDependent(),"visibility"===e&&this.possiblyEvaluateVisibility())}setAppearances(e){this.appearances=[],e.forEach(e=>{this.appearances.push(new $o(e.condition,e.name,e.properties,this.scope,this.options,this.iconImageUseTheme))}),this.appearancesVersion++}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(e){return e.endsWith(Go)?this._transitionablePaint.getTransition(e.slice(0,-11)):this._transitionablePaint.getValue(e)}isPaintProperty(e){return!!this._transitionablePaint._properties.properties[e]}setPaintProperty(e,t){const r=this._transitionablePaint,n=r._properties.properties;if(e.endsWith(Go)){const i=e.slice(0,-11);return n[i]&&r.setTransition(i,t||void 0),!1}if(!n[e])return!1;const i=r._values[e],s=i.value.isDataDriven(),o=i.value;r.setValue(e,t),this.expressionDependencies.configDependencies=/* @__PURE__ */new Set([...this.expressionDependencies.configDependencies,...r.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||r.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(e);const a=r._values[e].value,l=a.isDataDriven(),u=e.endsWith("pattern")||"line-dasharray"===e;return l||s||u||this._handleOverridablePaintPropertyUpdate(e,o,a)}_handleSpecialPaintPropertyUpdate(e){}getProgramIds(){return null}getDefaultProgramParams(e,t,r){return null}_handleOverridablePaintPropertyUpdate(e,t,r){return!1}isHidden(e){return!!(this.minzoom&&e<this.minzoom)||!!(this.maxzoom&&e>=this.maxzoom)||"none"===this.visibility}updateTransitions(e){this._transitioningPaint=this._transitionablePaint.transitioned(e,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(e,t){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(e,void 0,t,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(e,void 0,t)}serialize(){const e={id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return 0!==this.appearances.length&&(e.appearances=this.appearances.map(e=>e.serialize())),function(e,t){const r={};for(const n in e)t.call(this,e[n],n,e)&&(r[n]=e[n]);return r}(e,(e,t)=>!(void 0===e||"layout"===t&&!Object.keys(e).length||"paint"===t&&!Object.keys(e).length))}is3D(e){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(const e in this.paint._values){const t=this.paint.get(e);if(t instanceof yo&&$i(t.property.specification)&&("source"===t.value.kind||"composite"===t.value.kind)&&t.value.isStateDependent)return!0}for(const e of this.appearances)if(!Vn(e.condition.expression))return!0;return!1}compileFilter(e){this._filterCompiled||(this._featureFilter=So(this.filter,this.scope,e),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}dynamicFilterNeedsGeometry(){return this._featureFilter.needGeometry}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(e){this._stats&&("shadow"===e.renderPass?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(e,t,r){return{}}queryRadius(e){}queryIntersectsFeature(e,t,r,n,i,s,o,a,l,u){}}const Ho={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Zo{constructor(e,t){this._structArray=e,this._pos1=t*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const Yo=new ArrayBuffer(0);class Wo{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(e,t){return e._trim(),t&&e.arrayBuffer&&t.add(e.arrayBuffer),{length:e.length,arrayBuffer:e.arrayBuffer}}static deserialize(e){const t=Object.create(this.prototype);return t.arrayBuffer=e.arrayBuffer,t.length=e.length,e.arrayBuffer?t.capacity=e.arrayBuffer.byteLength/t.bytesPerElement:(t.capacity=0,t.arrayBuffer=Yo),t._refreshViews(),t}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(e){this.reserve(e),this.length=e}reserve(e){if(e>this.capacity){this._reallocCount++,this.capacity=Math.max(e,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const t=this.uint8;this._refreshViews(),t&&this.uint8.set(t)}}reserveForAdditional(e){this.reserve(this.length+e)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...e){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...e){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function Jo(e,t=1){let r=0,n=0;return{members:e.map(e=>{const i=Ho[e.type].BYTES_PER_ELEMENT,s=r=Ko(r,Math.max(t,i)),o=e.components||1;return n=Math.max(n,i),r+=i*o,{name:e.name,type:e.type,components:o,offset:s}}),size:Ko(r,Math.max(n,t)),alignment:t}}function Ko(e,t){return Math.ceil(e/t)*t}class Qo extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t){const r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){const n=2*e;return this.int16[n+0]=t,this.int16[n+1]=r,e}}Qo.prototype.bytesPerElement=4,ps(Qo,"StructArrayLayout2i4");class ea extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,r)}emplace(e,t,r,n){const i=3*e;return this.int16[i+0]=t,this.int16[i+1]=r,this.int16[i+2]=n,e}}ea.prototype.bytesPerElement=6,ps(ea,"StructArrayLayout3i6");class ta extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r,n)}emplace(e,t,r,n,i){const s=4*e;return this.int16[s+0]=t,this.int16[s+1]=r,this.uint16[s+2]=n,this.uint16[s+3]=i,e}}ta.prototype.bytesPerElement=8,ps(ta,"StructArrayLayout2i2ui8");class ra extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.float32[1*e+0]=t,e}}ra.prototype.bytesPerElement=4,ps(ra,"StructArrayLayout1f4");class na extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,r)}emplace(e,t,r,n){const i=4*e,s=2*e;return this.int16[i+0]=t,this.int16[i+1]=r,this.float32[s+1]=n,e}}na.prototype.bytesPerElement=8,ps(na,"StructArrayLayout2i1f8");class ia extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,r)}emplace(e,t,r,n){const i=4*e;return this.int16[i+0]=t,this.int16[i+1]=r,this.int16[i+2]=n,e}}ia.prototype.bytesPerElement=8,ps(ia,"StructArrayLayout3i8");class sa extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r,n)}emplace(e,t,r,n,i){const s=4*e;return this.int16[s+0]=t,this.int16[s+1]=r,this.int16[s+2]=n,this.int16[s+3]=i,e}}sa.prototype.bytesPerElement=8,ps(sa,"StructArrayLayout4i8");class oa extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,n,i)}emplace(e,t,r,n,i,s){const o=5*e;return this.int16[o+0]=t,this.int16[o+1]=r,this.int16[o+2]=n,this.int16[o+3]=i,this.int16[o+4]=s,e}}oa.prototype.bytesPerElement=10,ps(oa,"StructArrayLayout5i10");class aa extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,s,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,n,i,s,o)}emplace(e,t,r,n,i,s,o,a){const l=6*e,u=12*e,c=3*e;return this.int16[l+0]=t,this.int16[l+1]=r,this.uint8[u+4]=n,this.uint8[u+5]=i,this.uint8[u+6]=s,this.uint8[u+7]=o,this.float32[c+2]=a,e}}aa.prototype.bytesPerElement=12,ps(aa,"StructArrayLayout2i4ub1f12");class la extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,r)}emplace(e,t,r,n){const i=3*e;return this.float32[i+0]=t,this.float32[i+1]=r,this.float32[i+2]=n,e}}la.prototype.bytesPerElement=12,ps(la,"StructArrayLayout3f12");class ua extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,n,i)}emplace(e,t,r,n,i,s){const o=6*e,a=3*e;return this.uint16[o+0]=t,this.uint16[o+1]=r,this.uint16[o+2]=n,this.uint16[o+3]=i,this.float32[a+2]=s,e}}ua.prototype.bytesPerElement=12,ps(ua,"StructArrayLayout4ui1f12");class ca extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r,n)}emplace(e,t,r,n,i){const s=4*e;return this.uint16[s+0]=t,this.uint16[s+1]=r,this.uint16[s+2]=n,this.uint16[s+3]=i,e}}ca.prototype.bytesPerElement=8,ps(ca,"StructArrayLayout4ui8");class ha extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,r,n,i,s)}emplace(e,t,r,n,i,s,o){const a=6*e;return this.int16[a+0]=t,this.int16[a+1]=r,this.int16[a+2]=n,this.int16[a+3]=i,this.int16[a+4]=s,this.int16[a+5]=o,e}}ha.prototype.bytesPerElement=12,ps(ha,"StructArrayLayout6i12");class pa extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,s,o,a,l,u,c,h){const p=this.length;return this.resize(p+1),this.emplace(p,e,t,r,n,i,s,o,a,l,u,c,h)}emplace(e,t,r,n,i,s,o,a,l,u,c,h,p){const d=12*e;return this.int16[d+0]=t,this.int16[d+1]=r,this.int16[d+2]=n,this.int16[d+3]=i,this.uint16[d+4]=s,this.uint16[d+5]=o,this.uint16[d+6]=a,this.uint16[d+7]=l,this.int16[d+8]=u,this.int16[d+9]=c,this.int16[d+10]=h,this.int16[d+11]=p,e}}pa.prototype.bytesPerElement=24,ps(pa,"StructArrayLayout4i4ui4i24");class da extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,r,n,i,s)}emplace(e,t,r,n,i,s,o){const a=10*e,l=5*e;return this.int16[a+0]=t,this.int16[a+1]=r,this.int16[a+2]=n,this.float32[l+2]=i,this.float32[l+3]=s,this.float32[l+4]=o,e}}da.prototype.bytesPerElement=20,ps(da,"StructArrayLayout3i3f20");class fa extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r,n)}emplace(e,t,r,n,i){const s=4*e;return this.float32[s+0]=t,this.float32[s+1]=r,this.float32[s+2]=n,this.float32[s+3]=i,e}}fa.prototype.bytesPerElement=16,ps(fa,"StructArrayLayout4f16");class ma extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint32[1*e+0]=t,e}}ma.prototype.bytesPerElement=4,ps(ma,"StructArrayLayout1ul4");class ya extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t){const r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){const n=2*e;return this.uint16[n+0]=t,this.uint16[n+1]=r,e}}ya.prototype.bytesPerElement=4,ps(ya,"StructArrayLayout2ui4");class ga extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,s,o,a,l,u,c,h,p){const d=this.length;return this.resize(d+1),this.emplace(d,e,t,r,n,i,s,o,a,l,u,c,h,p)}emplace(e,t,r,n,i,s,o,a,l,u,c,h,p,d){const f=20*e,m=10*e;return this.int16[f+0]=t,this.int16[f+1]=r,this.int16[f+2]=n,this.int16[f+3]=i,this.int16[f+4]=s,this.float32[m+3]=o,this.float32[m+4]=a,this.float32[m+5]=l,this.float32[m+6]=u,this.int16[f+14]=c,this.uint32[m+8]=h,this.uint16[f+18]=p,this.uint16[f+19]=d,e}}ga.prototype.bytesPerElement=40,ps(ga,"StructArrayLayout5i4f1i1ul2ui40");class xa extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,s,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,n,i,s,o)}emplace(e,t,r,n,i,s,o,a){const l=8*e;return this.int16[l+0]=t,this.int16[l+1]=r,this.int16[l+2]=n,this.int16[l+4]=i,this.int16[l+5]=s,this.int16[l+6]=o,this.int16[l+7]=a,e}}xa.prototype.bytesPerElement=16,ps(xa,"StructArrayLayout3i2i2i16");class va extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,n,i)}emplace(e,t,r,n,i,s){const o=4*e,a=8*e;return this.float32[o+0]=t,this.float32[o+1]=r,this.float32[o+2]=n,this.int16[a+6]=i,this.int16[a+7]=s,e}}va.prototype.bytesPerElement=16,ps(va,"StructArrayLayout2f1f2i16");class ba extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,r,n,i,s)}emplace(e,t,r,n,i,s,o){const a=20*e,l=5*e;return this.uint8[a+0]=t,this.uint8[a+1]=r,this.float32[l+1]=n,this.float32[l+2]=i,this.float32[l+3]=s,this.float32[l+4]=o,e}}ba.prototype.bytesPerElement=20,ps(ba,"StructArrayLayout2ub4f20");class wa extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r){const n=this.length;return this.resize(n+1),this.emplace(n,e,t,r)}emplace(e,t,r,n){const i=3*e;return this.uint16[i+0]=t,this.uint16[i+1]=r,this.uint16[i+2]=n,e}}wa.prototype.bytesPerElement=6,ps(wa,"StructArrayLayout3ui6");class _a extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y,g,x,v,b){const w=this.length;return this.resize(w+1),this.emplace(w,e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y,g,x,v,b)}emplace(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y,g,x,v,b,w){const _=30*e,I=15*e,A=60*e;return this.int16[_+0]=t,this.int16[_+1]=r,this.int16[_+2]=n,this.float32[I+2]=i,this.float32[I+3]=s,this.uint16[_+8]=o,this.uint16[_+9]=a,this.uint32[I+5]=l,this.uint32[I+6]=u,this.uint32[I+7]=c,this.uint16[_+16]=h,this.uint16[_+17]=p,this.uint16[_+18]=d,this.float32[I+10]=f,this.float32[I+11]=m,this.uint8[A+48]=y,this.uint8[A+49]=g,this.uint8[A+50]=x,this.uint32[I+13]=v,this.int16[_+28]=b,this.uint8[A+58]=w,e}}_a.prototype.bytesPerElement=60,ps(_a,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class Ia extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y,g,x,v,b,w,_,I,A,S,M,B,P,z,T,k,V){const E=this.length;return this.resize(E+1),this.emplace(E,e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y,g,x,v,b,w,_,I,A,S,M,B,P,z,T,k,V)}emplace(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y,g,x,v,b,w,_,I,A,S,M,B,P,z,T,k,V,E){const D=20*e,C=40*e,F=80*e;return this.float32[D+0]=t,this.float32[D+1]=r,this.int16[C+4]=n,this.int16[C+5]=i,this.int16[C+6]=s,this.int16[C+7]=o,this.int16[C+8]=a,this.int16[C+9]=l,this.int16[C+10]=u,this.int16[C+11]=c,this.int16[C+12]=h,this.uint16[C+13]=p,this.uint16[C+14]=d,this.uint16[C+15]=f,this.uint16[C+16]=m,this.uint16[C+17]=y,this.uint16[C+18]=g,this.uint16[C+19]=x,this.uint16[C+20]=v,this.uint16[C+21]=b,this.uint16[C+22]=w,this.uint16[C+23]=_,this.uint16[C+24]=I,this.uint16[C+25]=A,this.uint16[C+26]=S,this.uint16[C+27]=M,this.uint32[D+14]=B,this.float32[D+15]=P,this.float32[D+16]=z,this.float32[D+17]=T,this.float32[D+18]=k,this.uint8[F+76]=V,this.uint16[C+39]=E,e}}Ia.prototype.bytesPerElement=80,ps(Ia,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class Aa extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,s){const o=this.length;return this.resize(o+1),this.emplace(o,e,t,r,n,i,s)}emplace(e,t,r,n,i,s,o){const a=6*e;return this.float32[a+0]=t,this.float32[a+1]=r,this.float32[a+2]=n,this.float32[a+3]=i,this.float32[a+4]=s,this.float32[a+5]=o,e}}Aa.prototype.bytesPerElement=24,ps(Aa,"StructArrayLayout6f24");class Sa extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i){const s=this.length;return this.resize(s+1),this.emplace(s,e,t,r,n,i)}emplace(e,t,r,n,i,s){const o=5*e;return this.float32[o+0]=t,this.float32[o+1]=r,this.float32[o+2]=n,this.float32[o+3]=i,this.float32[o+4]=s,e}}Sa.prototype.bytesPerElement=20,ps(Sa,"StructArrayLayout5f20");class Ma extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,s,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,n,i,s,o)}emplace(e,t,r,n,i,s,o,a){const l=7*e;return this.float32[l+0]=t,this.float32[l+1]=r,this.float32[l+2]=n,this.float32[l+3]=i,this.float32[l+4]=s,this.float32[l+5]=o,this.float32[l+6]=a,e}}Ma.prototype.bytesPerElement=28,ps(Ma,"StructArrayLayout7f28");class Ba extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,s,o,a,l,u,c){const h=this.length;return this.resize(h+1),this.emplace(h,e,t,r,n,i,s,o,a,l,u,c)}emplace(e,t,r,n,i,s,o,a,l,u,c,h){const p=11*e;return this.float32[p+0]=t,this.float32[p+1]=r,this.float32[p+2]=n,this.float32[p+3]=i,this.float32[p+4]=s,this.float32[p+5]=o,this.float32[p+6]=a,this.float32[p+7]=l,this.float32[p+8]=u,this.float32[p+9]=c,this.float32[p+10]=h,e}}Ba.prototype.bytesPerElement=44,ps(Ba,"StructArrayLayout11f44");class Pa extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,s,o,a,l){const u=this.length;return this.resize(u+1),this.emplace(u,e,t,r,n,i,s,o,a,l)}emplace(e,t,r,n,i,s,o,a,l,u){const c=9*e;return this.float32[c+0]=t,this.float32[c+1]=r,this.float32[c+2]=n,this.float32[c+3]=i,this.float32[c+4]=s,this.float32[c+5]=o,this.float32[c+6]=a,this.float32[c+7]=l,this.float32[c+8]=u,e}}Pa.prototype.bytesPerElement=36,ps(Pa,"StructArrayLayout9f36");class za extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t){const r=this.length;return this.resize(r+1),this.emplace(r,e,t)}emplace(e,t,r){const n=2*e;return this.float32[n+0]=t,this.float32[n+1]=r,e}}za.prototype.bytesPerElement=8,ps(za,"StructArrayLayout2f8");class Ta extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e,t,r,n){const i=this.length;return this.resize(i+1),this.emplace(i,e,t,r,n)}emplace(e,t,r,n,i){const s=6*e;return this.uint32[3*e+0]=t,this.uint16[s+2]=r,this.uint16[s+3]=n,this.uint16[s+4]=i,e}}Ta.prototype.bytesPerElement=12,ps(Ta,"StructArrayLayout1ul3ui12");class ka extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint16[1*e+0]=t,e}}ka.prototype.bytesPerElement=2,ps(ka,"StructArrayLayout1ui2");class Va extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m){const y=this.length;return this.resize(y+1),this.emplace(y,e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m)}emplace(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y){const g=16*e;return this.float32[g+0]=t,this.float32[g+1]=r,this.float32[g+2]=n,this.float32[g+3]=i,this.float32[g+4]=s,this.float32[g+5]=o,this.float32[g+6]=a,this.float32[g+7]=l,this.float32[g+8]=u,this.float32[g+9]=c,this.float32[g+10]=h,this.float32[g+11]=p,this.float32[g+12]=d,this.float32[g+13]=f,this.float32[g+14]=m,this.float32[g+15]=y,e}}Va.prototype.bytesPerElement=64,ps(Va,"StructArrayLayout16f64");class Ea extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(e,t,r,n,i,s,o){const a=this.length;return this.resize(a+1),this.emplace(a,e,t,r,n,i,s,o)}emplace(e,t,r,n,i,s,o,a){const l=10*e,u=5*e;return this.uint16[l+0]=t,this.uint16[l+1]=r,this.uint16[l+2]=n,this.uint16[l+3]=i,this.float32[u+2]=s,this.float32[u+3]=o,this.float32[u+4]=a,e}}Ea.prototype.bytesPerElement=20,ps(Ea,"StructArrayLayout4ui3f20");class Da extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.int16[1*e+0]=t,e}}Da.prototype.bytesPerElement=2,ps(Da,"StructArrayLayout1i2");class Ca extends Wo{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(e){const t=this.length;return this.resize(t+1),this.emplace(t,e)}emplace(e,t){return this.uint8[1*e+0]=t,e}}Ca.prototype.bytesPerElement=1,ps(Ca,"StructArrayLayout1ub1");class Fa extends Zo{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.int16[this._pos2+3]}get tileAnchorY(){return this._structArray.int16[this._pos2+4]}get x1(){return this._structArray.float32[this._pos4+3]}get y1(){return this._structArray.float32[this._pos4+4]}get x2(){return this._structArray.float32[this._pos4+5]}get y2(){return this._structArray.float32[this._pos4+6]}get padding(){return this._structArray.int16[this._pos2+14]}get featureIndex(){return this._structArray.uint32[this._pos4+8]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+18]}get bucketIndex(){return this._structArray.uint16[this._pos2+19]}}Fa.prototype.size=40;class La extends ga{get(e){return new Fa(this,e)}}ps(La,"CollisionBoxArray");class Ra extends Zo{get projectedAnchorX(){return this._structArray.int16[this._pos2+0]}get projectedAnchorY(){return this._structArray.int16[this._pos2+1]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+2]}get tileAnchorX(){return this._structArray.float32[this._pos4+2]}get tileAnchorY(){return this._structArray.float32[this._pos4+3]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+8]}get numGlyphs(){return this._structArray.uint16[this._pos2+9]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+5]}get lineStartIndex(){return this._structArray.uint32[this._pos4+6]}get lineLength(){return this._structArray.uint32[this._pos4+7]}get segment(){return this._structArray.uint16[this._pos2+16]}get lowerSize(){return this._structArray.uint16[this._pos2+17]}get upperSize(){return this._structArray.uint16[this._pos2+18]}get lineOffsetX(){return this._structArray.float32[this._pos4+10]}get lineOffsetY(){return this._structArray.float32[this._pos4+11]}get writingMode(){return this._structArray.uint8[this._pos1+48]}get placedOrientation(){return this._structArray.uint8[this._pos1+49]}set placedOrientation(e){this._structArray.uint8[this._pos1+49]=e}get hidden(){return this._structArray.uint8[this._pos1+50]}set hidden(e){this._structArray.uint8[this._pos1+50]=e}get crossTileID(){return this._structArray.uint32[this._pos4+13]}set crossTileID(e){this._structArray.uint32[this._pos4+13]=e}get associatedIconIndex(){return this._structArray.int16[this._pos2+28]}get flipState(){return this._structArray.uint8[this._pos1+58]}set flipState(e){this._structArray.uint8[this._pos1+58]=e}}Ra.prototype.size=60;class Oa extends _a{get(e){return new Ra(this,e)}}ps(Oa,"PlacedSymbolArray");class Ua extends Zo{get tileAnchorX(){return this._structArray.float32[this._pos4+0]}get tileAnchorY(){return this._structArray.float32[this._pos4+1]}get projectedAnchorX(){return this._structArray.int16[this._pos2+4]}get projectedAnchorY(){return this._structArray.int16[this._pos2+5]}get projectedAnchorZ(){return this._structArray.int16[this._pos2+6]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+7]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+8]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+9]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+10]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+11]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+12]}get key(){return this._structArray.uint16[this._pos2+13]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+14]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+15]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+16]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+17]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+18]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+19]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+20]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+21]}get featureIndex(){return this._structArray.uint16[this._pos2+22]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+23]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+24]}get numIconVertices(){return this._structArray.uint16[this._pos2+25]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+26]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+27]}get crossTileID(){return this._structArray.uint32[this._pos4+14]}set crossTileID(e){this._structArray.uint32[this._pos4+14]=e}get textOffset0(){return this._structArray.float32[this._pos4+15]}get textOffset1(){return this._structArray.float32[this._pos4+16]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+17]}get zOffset(){return this._structArray.float32[this._pos4+18]}set zOffset(e){this._structArray.float32[this._pos4+18]=e}get hasIconTextFit(){return this._structArray.uint8[this._pos1+76]}get elevationFeatureIndex(){return this._structArray.uint16[this._pos2+39]}}Ua.prototype.size=80;class Na extends Ia{get(e){return new Ua(this,e)}}ps(Na,"SymbolInstanceArray");class ja extends ra{getoffsetX(e){return this.float32[1*e+0]}}ps(ja,"GlyphOffsetArray");class $a extends Qo{getx(e){return this.int16[2*e+0]}gety(e){return this.int16[2*e+1]}}ps($a,"SymbolLineVertexArray");class Ga extends Zo{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}get layoutVertexArrayOffset(){return this._structArray.uint16[this._pos2+4]}}Ga.prototype.size=12;class Xa extends Ta{get(e){return new Ga(this,e)}}ps(Xa,"FeatureIndexArray");class qa extends ya{geta_centroid_pos0(e){return this.uint16[2*e+0]}geta_centroid_pos1(e){return this.uint16[2*e+1]}}ps(qa,"FillExtrusionCentroidArray");class Ha extends Zo{get a_join_normal_inside0(){return this._structArray.int16[this._pos2+0]}get a_join_normal_inside1(){return this._structArray.int16[this._pos2+1]}get a_join_normal_inside2(){return this._structArray.int16[this._pos2+2]}}Ha.prototype.size=6;class Za extends ea{get(e){return new Ha(this,e)}}ps(Za,"FillExtrusionWallArray");const Ya=Jo([{name:"a_pos",components:2,type:"Int16"}],4),Wa=Jo([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),Ja=Jo([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Ka{constructor(e=[]){this.segments=e}_prepareSegment(e,t,r,n,i){let s=this.segments.at(-1);return e>Ka.MAX_VERTEX_ARRAY_LENGTH&&be(`Max vertices per segment is ${Ka.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${e}`),(!s||s.vertexLength+e>Ka.MAX_VERTEX_ARRAY_LENGTH||s.sortKey!==n||void 0!==i&&s&&void 0!==s.batchIndex&&s.batchIndex!==i)&&(s={vertexOffset:t,primitiveOffset:r,vertexLength:0,primitiveLength:0},void 0!==n&&(s.sortKey=n),void 0!==i&&(s.batchIndex=i),this.segments.push(s)),s}prepareSegment(e,t,r,n,i){return this._prepareSegment(e,t.length,r.length,n,i)}get(){return this.segments}destroy(){for(const e of this.segments)for(const t in e.vaos)e.vaos[t].destroy()}static simpleSegment(e,t,r,n){return new Ka([{vertexOffset:e,primitiveOffset:t,vertexLength:r,primitiveLength:n,vaos:{},sortKey:0}])}}function Qa(e,t){return 256*(e=pe(Math.floor(e),0,255))+pe(Math.floor(t),0,255)}Ka.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,ps(Ka,"SegmentVector");const el=Jo([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),tl=Jo([{name:"a_pattern_b",components:4,type:"Uint16"}]),rl=Jo([{name:"a_dash",components:4,type:"Uint16"}]);class nl{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(e,t,r,n){this.ids.push(il(e)),this.positions.push(t,r,n)}eachPosition(e,t){const r=il(e);let n=0,i=this.ids.length-1;for(;n<i;){const e=n+i>>1;this.ids[e]>=r?i=e:n=e+1}for(;this.ids[n]===r;)t(this.positions[3*n],this.positions[3*n+1],this.positions[3*n+2]),n++}static serialize(e,t){const r=new Float64Array(e.ids),n=new Uint32Array(e.positions);return sl(r,n,0,r.length-1),t&&(t.add(r.buffer),t.add(n.buffer)),{ids:r,positions:n}}static deserialize(e){const t=new nl;let r;t.ids=e.ids,t.positions=e.positions;for(const n of t.ids)n!==r&&t.uniqueIds.push(n),r=n;return t.indexed=!0,t}}function il(e){const t=+e;return Number.isSafeInteger(t)?t:gt(String(e))}function sl(e,t,r,n){for(;r<n;){const i=e[r+n>>1];let s=r-1,o=n+1;for(;;){do{s++}while(e[s]<i);do{o--}while(e[o]>i);if(s>=o)break;ol(e,s,o),ol(t,3*s,3*o),ol(t,3*s+1,3*o+1),ol(t,3*s+2,3*o+2)}o-r<n-o?(sl(e,t,r,o),r=o+1):(sl(e,t,o+1,n),n=o)}}function ol(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}ps(nl,"FeaturePositionMap");class al{constructor(e){this.gl=e.gl,this.initialized=!1}fetchUniformLocation(e,t){return this.location||this.initialized||(this.location=this.gl.getUniformLocation(e,t),this.initialized=!0),!!this.location}set(e,t,r){throw new Error("Uniform#set() must be implemented by each concrete Uniform")}}class ll extends al{constructor(e){super(e),this.current=0}set(e,t,r){this.fetchUniformLocation(e,t)&&this.current!==r&&(this.current=r,this.gl.uniform1f(this.location,r))}}class ul extends al{constructor(e){super(e),this.current=[0,0,0,0]}set(e,t,r){this.fetchUniformLocation(e,t)&&(r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]&&r[3]===this.current[3]||(this.current=r,this.gl.uniform4ui(this.location,r[0],r[1],r[2],r[3])))}}class cl extends al{constructor(e){super(e),this.current=Pt.transparent.toPremultipliedRenderColor(null)}set(e,t,r){this.fetchUniformLocation(e,t)&&(r.r===this.current.r&&r.g===this.current.g&&r.b===this.current.b&&r.a===this.current.a||(this.current=r,this.gl.uniform4f(this.location,r.r,r.g,r.b,r.a)))}}function hl(e){return[Qa(255*e.r,255*e.g),Qa(255*e.b,255*e.a)]}function pl(e,t,r,n,i,s,o,a){return!!e&&("composite"===e.kind||"source"===e.kind?"none"===e.evaluate(new lo(0,{brightness:s,worldview:a}),t,r,i,n,o):"none"===e.value)}class dl{constructor(e,t,r,n){this.value=e,this.uniformNames=t.map(e=>`u_${e}`),this.type=r,this.context=n}setUniform(e,t,r,n,i){const s=n.constantOr(this.value);t.set(e,i,s instanceof Pt?s.toPremultipliedRenderColor(this.lutExpression&&"constant"===this.lutExpression.kind&&"none"===this.lutExpression.value?null:this.context.lut):s)}getBinding(e,t){return"color"===this.type?new cl(e):new ll(e)}}class fl{constructor(e,t){this.uniformNames=t.map(e=>`u_${e}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(e,t){this.pixelRatio=e.pixelRatio||1,this.pattern=e.tl.concat(e.br),this.patternTransition=t?t.tl.concat(t.br):this.pattern}setUniform(e,t,r,n,i){let s=null;"u_pattern"!==i&&"u_dash"!==i||(s=this.pattern),"u_pattern_b"===i&&(s=this.patternTransition),"u_pixel_ratio"===i&&(s=this.pixelRatio),s&&t.set(e,i,s)}getBinding(e,t){return"u_pattern"===t||"u_pattern_b"===t||"u_dash"===t?new ul(e):new ll(e)}}class ml{constructor(e,t,r,n){this.expression=e,this.type=r,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===r?2:1,offset:0})),this.paintVertexArray=new n}populatePaintArray(e,t,r,n,i,s,o,a){const l=this.paintVertexArray.length,u="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate(new lo(0,{brightness:s,worldview:a}),t,{},i,n,o):"constant"===this.expression.kind&&this.expression.value,c=pl(this.lutExpression,t,{},n,i,s,o,a);this.paintVertexArray.resize(e),this._setPaintValue(l,e,u,c?null:this.context.lut)}updatePaintArray(e,t,r,n,i,s,o,a){const l="composite"===this.expression.kind||"source"===this.expression.kind?this.expression.evaluate({zoom:0,brightness:o,worldview:a},r,n,void 0,i):"constant"===this.expression.kind&&this.expression.value,u=pl(this.lutExpression,r,n,i,void 0,o,void 0,a);this._setPaintValue(e,t,l,u?null:this.context.lut)}_setPaintValue(e,t,r,n){if("color"===this.type){const i=hl(r.toPremultipliedRenderColor(n));for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,i[0],i[1])}else{for(let n=e;n<t;n++)this.paintVertexArray.emplace(n,r);this.maxValue=Math.max(this.maxValue,Math.abs(r))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.lutExpression&&"constant"!==this.lutExpression.kind&&(this.lutExpression.isStateDependent||!this.lutExpression.isLightConstant)||"constant"!==this.expression.kind&&(this.expression.isStateDependent||!this.expression.isLightConstant)))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class yl{constructor(e,t,r,n,i,s){this.expression=e,this.uniformNames=t.map(e=>`u_${e}_t`),this.type=r,this.useIntegerZoom=n,this.context=i,this.maxValue=0,this.paintVertexAttributes=t.map(e=>({name:`a_${e}`,type:"Float32",components:"color"===r?4:2,offset:0})),this.paintVertexArray=new s}populatePaintArray(e,t,r,n,i,s,o,a){const l=this.expression.evaluate(new lo(this.context.zoom,{brightness:s,worldview:a}),t,{},i,n,o),u=this.expression.evaluate(new lo(this.context.zoom+1,{brightness:s,worldview:a}),t,{},i,n,o),c=pl(this.lutExpression,t,{},n,i,s,o,a),h=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValue(h,e,l,u,c?null:this.context.lut)}updatePaintArray(e,t,r,n,i,s,o,a){const l=this.expression.evaluate({zoom:this.context.zoom,brightness:o,worldview:a},r,n,void 0,i),u=this.expression.evaluate({zoom:this.context.zoom+1,brightness:o,worldview:a},r,n,void 0,i),c=pl(this.lutExpression,r,n,i,void 0,o,void 0,a);this._setPaintValue(e,t,l,u,c?null:this.context.lut)}_setPaintValue(e,t,r,n,i){if("color"===this.type){const s=hl(r.toPremultipliedRenderColor(i)),o=hl(n.toPremultipliedRenderColor(i));for(let r=e;r<t;r++)this.paintVertexArray.emplace(r,s[0],s[1],o[0],o[1])}else{for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,r,n);this.maxValue=Math.max(this.maxValue,Math.abs(r),Math.abs(n))}}upload(e){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent||!this.expression.isLightConstant))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(e,t,r,n,i){const s=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,o=pe(this.expression.interpolationFactor(s,this.context.zoom,this.context.zoom+1),0,1);t.set(e,i,o)}getBinding(e,t){return new ll(e)}}class gl{constructor(e,t,r,n,i){this.expression=e,this.layerId=i,this.paintVertexAttributes=("array"===r?rl:el).members,this.paintVertexArray=new n,this.paintTransitionVertexArray=new ca}populatePaintArray(e,t,r,n){const i=this.paintVertexArray.length;this.paintVertexArray.resize(e),this._setPaintValues(i,e,t.patterns&&t.patterns[this.layerId],r)}updatePaintArray(e,t,r,n,i,s,o){this._setPaintValues(e,t,r.patterns&&r.patterns[this.layerId],s)}_setPaintValues(e,t,r,n){if(!n||!r)return;const i=n[r[0]],s=n[r[1]];if(i){if(i){const{tl:r,br:n,pixelRatio:s}=i;for(let i=e;i<t;i++)this.paintVertexArray.emplace(i,r[0],r[1],n[0],n[1],s)}if(s){this.paintTransitionVertexArray.resize(this.paintVertexArray.length);const{tl:r,br:n}=s;for(let i=e;i<t;i++)this.paintTransitionVertexArray.emplace(i,r[0],r[1],n[0],n[1])}}}upload(e){const t=this.expression.isStateDependent||!this.expression.isLightConstant;this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer=e.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,t)),this.paintTransitionVertexArray&&this.paintTransitionVertexArray.length&&(this.paintTransitionVertexBuffer=e.createVertexBuffer(this.paintTransitionVertexArray,tl.members,t))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy(),this.paintTransitionVertexBuffer&&this.paintTransitionVertexBuffer.destroy()}}class xl{constructor(e,t,r=()=>!0){this.binders={},this._buffers=[],this.context=t;const n=[],i=e;for(const s in e.paint._values){const o=i.paint.get(s);if(s.endsWith("-use-theme"))continue;if(!r(s))continue;if(!(o instanceof yo&&$i(o.property.specification)))continue;const a=wl(s,e.type),l=o.value,u=o.property.specification.type,c=!!o.property.useIntegerZoom,h="line-dasharray"===s||s.endsWith("pattern"),p=i.paint.get(`${s}-use-theme`),d="line-dasharray"===s&&"constant"!==i.layout.get("line-cap").value.kind||p&&"constant"!==p.value.kind;if("constant"!==l.kind||d)if("source"===l.kind||d||h){const t=Al(s,u,"source");this.binders[s]=h?new gl(l,a,u,t,e.id):new ml(l,a,u,t),n.push(`/a_${s}`)}else{const e=Al(s,u,"composite");this.binders[s]=new yl(l,a,u,c,t,e),n.push(`/z_${s}`)}else this.binders[s]=h?new fl(l.value,a):new dl(l.value,a,u,t),n.push(`/u_${s}`);p&&(this.binders[s].lutExpression=p.value)}this.cacheKey=n.sort().join("")}updateExpressions(e){const t=e;for(const r in this.binders){const e=this.binders[r];if(e instanceof ml||e instanceof yl||e instanceof gl){const n=t.paint.get(r);e.expression=n.value}}}getMaxValue(e){const t=this.binders[e];return t instanceof ml||t instanceof yl?t.maxValue:0}populatePaintArrays(e,t,r,n,i,s,o,a){for(const l in this.binders){const u=this.binders[l];u.context=this.context,(u instanceof ml||u instanceof yl||u instanceof gl)&&u.populatePaintArray(e,t,r,n,i,s,o,a)}}setConstantPatternPositions(e,t){for(const r in this.binders){const n=this.binders[r];n instanceof fl&&n.setConstantPatternPositions(e,t)}}getPatternTransitionVertexBuffer(e){const t=this.binders[e];return t instanceof gl?t.paintTransitionVertexBuffer:null}updatePaintArrays(e,t,r,n,i,s,o,a,l,u){let c=!1;const h=Object.keys(e),p=0!==h.length&&!a,d=p?h:t.uniqueIds;this.context.lut=i.lut;for(const f in this.binders){const a=this.binders[f];if(a.context=this.context,(a instanceof ml||a instanceof yl||a instanceof gl)&&a.expression&&a.expression.kind&&"constant"!==a.expression.kind&&(!0===a.expression.isStateDependent||!1===a.expression.isLightConstant)){const h=i.paint.get(f);a.expression=h.value;for(const r of d){const i=e[r.toString()];t.eachPosition(r,(e,t,r)=>{const c=n.feature(e);a.updatePaintArray(t,r,c,i,s,o,l,u)})}if(!p)for(const t of r.uniqueIds){const i=e[t.toString()];r.eachPosition(t,(e,t,r)=>{const c=n.feature(e);a.updatePaintArray(t,r,c,i,s,o,l,u)})}c=!0}}return c}defines(){const e=[];for(const t in this.binders){const r=this.binders[t];(r instanceof dl||r instanceof fl)&&e.push(...r.uniformNames.map(e=>`#define HAS_UNIFORM_${e}`))}return e}getPaintVertexBuffers(){return this._buffers}getUniforms(e){const t=[];for(const r in this.binders){const n=this.binders[r];if(n instanceof dl||n instanceof fl||n instanceof yl)for(const i of n.uniformNames)t.push({name:i,property:r,binding:n.getBinding(e,i)})}return t}setUniforms(e,t,r,n,i){for(const{name:s,property:o,binding:a}of r)this.binders[o].setUniform(e,a,i,n.get(o),s)}updatePaintBuffers(){this._buffers=[];for(const e in this.binders){const t=this.binders[e];(t instanceof ml||t instanceof yl||t instanceof gl)&&t.paintVertexBuffer&&this._buffers.push(t.paintVertexBuffer),t instanceof gl&&t.paintTransitionVertexBuffer&&this._buffers.push(t.paintTransitionVertexBuffer)}}upload(e){for(const t in this.binders){const r=this.binders[t];(r instanceof ml||r instanceof yl||r instanceof gl)&&r.upload(e)}this.updatePaintBuffers()}destroy(){for(const e in this.binders){const t=this.binders[e];(t instanceof ml||t instanceof yl||t instanceof gl)&&t.destroy()}}}class vl{constructor(e,t,r=()=>!0){this.programConfigurations={};for(const n of e)this.programConfigurations[n.id]=new xl(n,t,r);this.needsUpload=!1,this._featureMap=new nl,this._featureMapWithoutIds=new nl,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(e,t,r,n,i,s,o,a,l){for(const u in this.programConfigurations)this.programConfigurations[u].populatePaintArrays(e,t,n,i,s,o,a,l);void 0!==t.id?this._featureMap.add(t.id,r,this._bufferOffset,e):(this._featureMapWithoutIds.add(this._idlessCounter,r,this._bufferOffset,e),this._idlessCounter+=1),this._bufferOffset=e,this.needsUpload=!0}updatePaintArrays(e,t,r,n,i,s,o,a){for(const l of r)this.needsUpload=this.programConfigurations[l.id].updatePaintArrays(e,this._featureMap,this._featureMapWithoutIds,t,l,n,i,s,o||0,a)||this.needsUpload}get(e){return this.programConfigurations[e]}upload(e){if(this.needsUpload){for(const t in this.programConfigurations)this.programConfigurations[t].upload(e);this.needsUpload=!1}}destroy(){for(const e in this.programConfigurations)this.programConfigurations[e].destroy()}updateExpressions(e){const t=/* @__PURE__ */new Set;for(const r of e){const e=this.programConfigurations[r.id];e&&(e.updateExpressions(r),t.add(r.id))}for(const r in this.programConfigurations)t.has(r)||delete this.programConfigurations[r]}}const bl={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"symbol-z-offset":["z_offset"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"],"fill-bridge-guard-rail-color":["structure_color"],"fill-tunnel-structure-color":["structure_color"]};function wl(e,t){return bl[e]||[e.replace(`${t}-`,"").replace(/-/g,"_")]}const _l={"line-pattern":{source:ua,composite:ua},"fill-pattern":{source:ua,composite:ua},"fill-extrusion-pattern":{source:ua,composite:ua},"line-dasharray":{source:ca,composite:ca}},Il={color:{source:za,composite:fa},number:{source:ra,composite:za}};function Al(e,t,r){const n=_l[e];return n&&n[r]||Il[t][r]}ps(dl,"ConstantBinder"),ps(fl,"PatternConstantBinder"),ps(ml,"SourceExpressionBinder",{omit:["expression"]}),ps(gl,"PatternCompositeBinder",{omit:["expression"]}),ps(yl,"CompositeExpressionBinder",{omit:["expression"]}),ps(xl,"ProgramConfiguration",{omit:["_buffers"]}),ps(vl,"ProgramConfigurationSet");const Sl=tn/Math.PI/2,Ml=-Sl,Bl=Sl;function Pl(e,t,r,n=Sl){return r=ce(r),[e*Math.sin(r)*n,-t*n,e*Math.cos(r)*n]}function zl(e,t,r){return Pl(Math.cos(ce(e)),Math.sin(ce(e)),t,r)}const Tl=6371008.8,kl=2*Math.PI*Tl;class Vl{constructor(e,t){if(isNaN(e)||isNaN(t))throw new Error(`Invalid LngLat object: (${e}, ${t})`);if(this.lng=+e,this.lat=+t,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new Vl(fe(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(e){const t=Math.PI/180,r=this.lat*t,n=e.lat*t,i=Math.sin(r)*Math.sin(n)+Math.cos(r)*Math.cos(n)*Math.cos((e.lng-this.lng)*t);return Tl*Math.acos(Math.min(i,1))}toBounds(e=0){const t=360*e/40075017,r=t/Math.cos(Math.PI/180*this.lat);return new El({lng:this.lng-r,lat:this.lat-t},{lng:this.lng+r,lat:this.lat+t})}toEcef(e){return zl(this.lat,this.lng,Sl+e*Sl/Tl)}static convert(e){if(e instanceof Vl)return e;if(Array.isArray(e)&&(2===e.length||3===e.length))return new Vl(Number(e[0]),Number(e[1]));if(!Array.isArray(e)&&"object"==typeof e&&null!==e)return new Vl(Number("lng"in e?e.lng:e.lon),Number(e.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}class El{constructor(e,t){e&&(t?this.setSouthWest(e).setNorthEast(t):Array.isArray(e)&&4===e.length?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1]))}setNorthEast(e){return this._ne=e instanceof Vl?new Vl(e.lng,e.lat):Vl.convert(e),this}setSouthWest(e){return this._sw=e instanceof Vl?new Vl(e.lng,e.lat):Vl.convert(e),this}extend(e){const t=this._sw,r=this._ne;let n,i;if(e instanceof Vl)n=e,i=e;else{if(!(e instanceof El))return Array.isArray(e)?4===e.length||e.every(Array.isArray)?this.extend(El.convert(e)):this.extend(Vl.convert(e)):"object"==typeof e&&null!==e&&Object.hasOwn(e,"lat")&&(Object.hasOwn(e,"lon")||Object.hasOwn(e,"lng"))?this.extend(Vl.convert(e)):this;if(n=e._sw,i=e._ne,!n||!i)return this}return t||r?(t.lng=Math.min(n.lng,t.lng),t.lat=Math.min(n.lat,t.lat),r.lng=Math.max(i.lng,r.lng),r.lat=Math.max(i.lat,r.lat)):(this._sw=new Vl(n.lng,n.lat),this._ne=new Vl(i.lng,i.lat)),this}getCenter(){return new Vl((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new Vl(this.getWest(),this.getNorth())}getSouthEast(){return new Vl(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:t,lat:r}=Vl.convert(e);let n=this._sw.lng<=t&&t<=this._ne.lng;return this._sw.lng>this._ne.lng&&(n=this._sw.lng>=t&&t>=this._ne.lng),this._sw.lat<=r&&r<=this._ne.lat&&n}static convert(e){if(e)return e instanceof El?e:new El(e)}}function Dl(e){return kl*Math.cos(e*Math.PI/180)}function Cl(e){return(180+e)/360}function Fl(e){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+e*Math.PI/360)))/360}function Ll(e,t){return e/Dl(t)}function Rl(e){return 360*e-180}function Ol(e){return 360/Math.PI*Math.atan(Math.exp((180-360*e)*Math.PI/180))-90}const Ul=85.051129;function Nl(e){return Math.cos(ce(pe(e,-85.051129,Ul)))}function jl(e,t){const r=pe(t,0,25.5),n=Math.pow(2,r);return Nl(e)*kl/(512*n)}function $l(e,t=0){const r=Math.exp(Math.PI*(1-(e.y+t/tn)/(1<<e.z)*2));return 80150034*r/(r*r+1)/tn/(1<<e.z)}class Gl{constructor(e,t,r=0){this.x=+e,this.y=+t,this.z=+r}static fromLngLat(e,t=0){const r=Vl.convert(e);return new Gl(Cl(r.lng),Fl(r.lat),Ll(t,r.lat))}toLngLat(){return new Vl(Rl(this.x),Ol(this.y))}toAltitude(){return function(e,t){return e*Dl(Ol(t))}(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/kl*function(e){return 1/Math.cos(e*Math.PI/180)}(Ol(this.y))}}function Xl(e,t,r,n,i,s,o,a,l){const u=(t+n)/2,c=(r+i)/2,h=new oe(u,c);a(h),function(e,t,r,n,i,s){const o=r-i,a=n-s;return Math.abs((n-t)*o-(r-e)*a)/Math.hypot(o,a)}(h.x,h.y,s.x,s.y,o.x,o.y)>=l?(Xl(e,t,r,u,c,s,h,a,l),Xl(e,u,c,n,i,h,o,a,l)):e.push(o)}function ql(e,t,r){let n=e[0],i=n.x,s=n.y;t(n);const o=[n];for(let a=1;a<e.length;a++){const l=e[a],{x:u,y:c}=l;t(l),Xl(o,i,s,u,c,n,l,t,r),i=u,s=c,n=l}return o}function Hl(e,t,r,n){if(n(t,r)){const i=t.add(r)._mult(.5);Hl(e,t,i,n),Hl(e,i,r,n)}else e.push(r)}function Zl(e,t){let r=e[0];const n=[r];for(let i=1;i<e.length;i++){const s=e[i];Hl(n,r,s,t),r=s}return n}const Yl=Math.pow(2,14)-1,Wl=-Yl-1;function Jl(e,t){const r=Math.round(e.x*t),n=Math.round(e.y*t);return e.x=pe(r,Wl,Yl),e.y=pe(n,Wl,Yl),(r<e.x||r>e.x+1||n<e.y||n>e.y+1)&&be("Geometry exceeds allowed extent, reduce your vector tile buffer size"),e}function Kl(e,t,r){const n=e.loadGeometry(),i=e.extent,s=tn/i;if(t&&r&&r.projection.isReprojectedInTileSpace){const s=1<<t.z,{scale:o,x:a,y:l,projection:u}=r,c=e=>{const r=Rl((t.x+e.x/i)/s),n=Ol((t.y+e.y/i)/s),c=u.project(r,n);e.x=(c.x*o-a)*i,e.y=(c.y*o-l)*i};for(let t=0;t<n.length;t++)if(1!==e.type)n[t]=ql(n[t],c,1);else{const e=[];for(const r of n[t])r.x<0||r.x>=i||r.y<0||r.y>=i||(c(r),e.push(r));n[t]=e}}for(const o of n)for(const e of o)Jl(e,s);return n}function Ql(e,t){return{type:e.type,id:e.id,properties:e.properties,geometry:t?Kl(e):[]}}class eu{constructor(e,t,r,n,i){this.properties={},this.extent=r,this.type=0,this.id=void 0,this._pbf=e,this._geometry=-1,this._keys=n,this._values=i,e.readFields(tu,this,t)}loadGeometry(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos,r=[];let n,i=1,s=0,o=0,a=0;for(;e.pos<t;){if(s<=0){const t=e.readVarint();i=7&t,s=t>>3}if(s--,1===i||2===i)o+=e.readSVarint(),a+=e.readSVarint(),1===i&&(n&&r.push(n),n=[]),n&&n.push(new oe(o,a));else{if(7!==i)throw new Error(`unknown command ${i}`);n&&n.push(n[0].clone())}}return n&&r.push(n),r}bbox(){const e=this._pbf;e.pos=this._geometry;const t=e.readVarint()+e.pos;let r=1,n=0,i=0,s=0,o=1/0,a=-1/0,l=1/0,u=-1/0;for(;e.pos<t;){if(n<=0){const t=e.readVarint();r=7&t,n=t>>3}if(n--,1===r||2===r)i+=e.readSVarint(),s+=e.readSVarint(),i<o&&(o=i),i>a&&(a=i),s<l&&(l=s),s>u&&(u=s);else if(7!==r)throw new Error(`unknown command ${r}`)}return[o,l,a,u]}toGeoJSON(e,t,r){const n=this.extent*Math.pow(2,r),i=this.extent*e,s=this.extent*t,o=this.loadGeometry();function a(e){return[360*(e.x+i)/n-180,360/Math.PI*Math.atan(Math.exp((1-2*(e.y+s)/n)*Math.PI))-90]}function l(e){return e.map(a)}let u;if(1===this.type){const e=[];for(const r of o)e.push(r[0]);const t=l(e);u=1===e.length?{type:"Point",coordinates:t[0]}:{type:"MultiPoint",coordinates:t}}else if(2===this.type){const e=o.map(l);u=1===e.length?{type:"LineString",coordinates:e[0]}:{type:"MultiLineString",coordinates:e}}else{if(3!==this.type)throw new Error("unknown feature type");{const e=function(e){const t=e.length;if(t<=1)return[e];const r=[];let n,i;for(let s=0;s<t;s++){const t=ru(e[s]);0!==t&&(void 0===i&&(i=t<0),i===t<0?(n&&r.push(n),n=[e[s]]):n&&n.push(e[s]))}return n&&r.push(n),r}(o),t=[];for(const r of e)t.push(r.map(l));u=1===t.length?{type:"Polygon",coordinates:t[0]}:{type:"MultiPolygon",coordinates:t}}}const c={type:"Feature",geometry:u,properties:this.properties};return null!=this.id&&(c.id=this.id),c}}function tu(e,t,r){1===e?t.id=r.readVarint():2===e?function(e,t){const r=e.readVarint()+e.pos;for(;e.pos<r;){const r=t._keys[e.readVarint()],n=t._values[e.readVarint()];t.properties[r]=n}}(r,t):3===e?t.type=r.readVarint():4===e&&(t._geometry=r.pos)}function ru(e){let t=0;for(let r,n,i=0,s=e.length,o=s-1;i<s;o=i++)r=e[i],n=e[o],t+=(n.x-r.x)*(r.y+n.y);return t}eu.types=["Unknown","Point","LineString","Polygon"];class nu{constructor(e,t){this.version=1,this.name="",this.extent=4096,this.length=0,this._pbf=e,this._keys=[],this._values=[],this._features=[],e.readFields(iu,this,t),this.length=this._features.length}feature(e){if(e<0||e>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[e];const t=this._pbf.readVarint()+this._pbf.pos;return new eu(this._pbf,t,this.extent,this._keys,this._values)}}function iu(e,t,r){15===e?t.version=r.readVarint():1===e?t.name=r.readString():5===e?t.extent=r.readVarint():2===e?t._features.push(r.pos):3===e?t._keys.push(r.readString()):4===e&&t._values.push(function(e){let t=null;const r=e.readVarint()+e.pos;for(;e.pos<r;){const r=e.readVarint()>>3;t=1===r?e.readString():2===r?e.readFloat():3===r?e.readDouble():4===r?e.readVarint64():5===r?e.readVarint():6===r?e.readSVarint():7===r?e.readBoolean():null}if(null==t)throw new Error("unknown feature value");return t}(r))}class su{constructor(e,t){this.layers=e.readFields(ou,{},t)}}function ou(e,t,r){if(3===e){const e=new nu(r,r.readVarint()+r.pos);e.length&&(t[e.name]=e)}}const au="3d_elevation_id",lu="level",uu="hd_road_elevation";class cu{constructor(){this._valid=!1}reset(e){return this.feature=e,this._valid=!0,this._geometry=e.loadGeometry(),0!==this._geometry.length&&0!==this._geometry[0].length||(this._valid=!1),this}geometry(e,t){return this._valid&&e(t(this._geometry)),this}require(e,t,r){return this.get(e,!0,t,r)}optional(e,t,r){return this.get(e,!1,t,r)}success(){return this._valid}get(e,t,r,n){const i=Object.hasOwn(this.feature.properties,e)?+this.feature.properties[e]:void 0;return this._valid&&void 0!==i&&!Number.isNaN(i)?r(n?n(i):i):t&&(this._valid=!1),this}}class hu{constructor(e,t){this.featureFunc=e,this.vertexFunc=t}parseFeature(e,t,r){return this.featureFunc(e,t,r)}parseVertex(e,t,r){return this.vertexFunc(e,t,r)}}const pu=new hu((e,t,r)=>e.reset(t).require(au,e=>{r.id=e}).optional("fixed_height_relative",e=>{r.constantHeight=e},fu.decodeRelativeHeight).geometry(e=>{r.bounds=e},Er).success(),(e,t,r)=>e.reset(t).require(au,e=>{r.id=e}).require("elevation_idx",e=>{r.idx=e}).require("extent",e=>{r.extent=e}).require("height_relative",e=>{r.height=e},fu.decodeRelativeHeight).geometry(e=>{r.position=e},fu.getPoint).success()),du=new hu((e,t,r)=>e.reset(t).require(au,e=>{r.id=e}).optional("fixed_height",e=>{r.constantHeight=e},fu.decodeMetricHeight).geometry(e=>{r.bounds=e},Er).success(),(e,t,r)=>e.reset(t).require(au,e=>{r.id=e}).require("elevation_idx",e=>{r.idx=e}).require("extent",e=>{r.extent=e}).require("height",e=>{r.height=e},fu.decodeMetricHeight).geometry(e=>{r.position=e},fu.getPoint).success());class fu{static getPoint(e){return Y(e[0][0].x,e[0][0].y)}static decodeRelativeHeight(e){return 1e-4*e*5}static decodeMetricHeight(e){return 1e-4*e}static getVersionSchema(e){return e?"1.0.1"===e?du:void 0:pu}static parse(e){const t=[],r=[],n=e.length,i=new cu;for(let s=0;s<n;s++){const n=e.feature(s),o=n.properties.version,a=fu.getVersionSchema(o);if(void 0===a){be(`Unknown elevation feature version number ${o||"(unknown)"}`);continue}const l=n.properties.type;if(!l)continue;const u=eu.types[n.type];if("Point"===u&&"curve_point"===l){const e={};a.parseVertex(i,n,e)&&t.push(e)}else if("Polygon"===u&&"curve_meta"===l){const e={};a.parseFeature(i,n,e)&&r.push(e)}}return{vertices:t,features:r}}}class mu{constructor(e,t){this.pos=e,this.dir=t}intersectsPlane(e,t,r){const n=re(t,this.dir);if(Math.abs(n)<1e-6)return!1;const i=((e[0]-this.pos[0])*t[0]+(e[1]-this.pos[1])*t[1])/n;return r[0]=this.pos[0]+this.dir[0]*i,r[1]=this.pos[1]+this.dir[1]*i,!0}}class yu{constructor(e,t){this.pos=e,this.dir=t}intersectsPlane(e,t,r){const n=P(t,this.dir);if(Math.abs(n)<1e-6)return!1;const i=((e[0]-this.pos[0])*t[0]+(e[1]-this.pos[1])*t[1]+(e[2]-this.pos[2])*t[2])/n;return r[0]=this.pos[0]+this.dir[0]*i,r[1]=this.pos[1]+this.dir[1]*i,r[2]=this.pos[2]+this.dir[2]*i,!0}closestPointOnSphere(t,r,n){if(i=this.pos,s=t,o=i[0],a=i[1],l=i[2],u=s[0],c=s[1],h=s[2],Math.abs(o-u)<=e*Math.max(1,Math.abs(o),Math.abs(u))&&Math.abs(a-c)<=e*Math.max(1,Math.abs(a),Math.abs(c))&&Math.abs(l-h)<=e*Math.max(1,Math.abs(l),Math.abs(h))||0===r)return n[0]=n[1]=n[2]=0,!1;var i,s,o,a,l,u,c,h;const[p,d,f]=this.dir,m=this.pos[0]-t[0],y=this.pos[1]-t[1],g=this.pos[2]-t[2],x=p*p+d*d+f*f,v=2*(m*p+y*d+g*f),b=v*v-4*x*(m*m+y*y+g*g-r*r);if(b<0){const e=Math.max(-v/2,0),t=m+p*e,i=y+d*e,s=g+f*e,o=Math.hypot(t,i,s);return n[0]=t*r/o,n[1]=i*r/o,n[2]=s*r/o,!1}{const e=(-v-Math.sqrt(b))/(2*x);if(e<0){const e=Math.hypot(m,y,g);return n[0]=m*r/e,n[1]=y*r/e,n[2]=g*r/e,!1}return n[0]=m+p*e,n[1]=y+d*e,n[2]=g+f*e,!0}}}function gu(e,t,r,n){const i=t[0],s=t[1],o=t[2],a=r[0],l=r[1],u=r[2];let c=1/0,h=-1/0;for(let p=0;p<e.length;p++){const t=e[p],r=(t[0]-i)*a+(t[1]-s)*l+(t[2]-o)*u;r<c&&(c=r),r>h&&(h=r)}return n[0]=c,n[1]=h,n}function xu(e,t){let r=!0;for(let n=0;n<e.planes.length;n++){const i=e.planes[n];let s=0;for(let e=0;e<t.length;e++)s+=+(P(i,t[e])+i[3]>=0);if(0===s)return 0;s!==t.length&&(r=!1)}return r?2:1}const vu=[0,0];function bu(e,t){for(const r of e.projections){const n=gu(t,e.points[0],r.axis,vu);if(r.projection[1]<n[0]||r.projection[0]>n[1])return 0}return 1}class wu{static fromPoints(e){const t=[1/0,1/0,1/0],r=[-1/0,-1/0,-1/0];for(const n of e)b(t,t,n),w(r,r,n);return new wu(t,r)}static fromTileIdAndHeight(e,t,r){const n=1<<e.canonical.z,i=e.canonical.x,s=e.canonical.y;return new wu([i/n,s/n,t],[(i+1)/n,(s+1)/n,r])}static applyTransform(e,t){const r=e.getCorners();for(let n=0;n<r.length;++n)k(r[n],r[n],t);return wu.fromPoints(r)}static applyTransformFast(e,t){const r=[t[12],t[13],t[14]],n=[...r];for(let i=0;i<3;i++)for(let s=0;s<3;s++){const o=t[4*s+i],a=o*e.min[s],l=o*e.max[s];r[i]+=Math.min(a,l),n[i]+=Math.max(a,l)}return new wu(r,n)}static projectAabbCorners(e,t){const r=e.getCorners();for(let n=0;n<r.length;++n)k(r[n],r[n],t);return r}constructor(e,t){this.min=e,this.max=t,this.center=_([],x([],this.min,this.max),.5)}quadrant(e){const t=[e%2==0,e<2],r=f(this.min),n=f(this.max);for(let i=0;i<t.length;i++)r[i]=t[i]?this.min[i]:this.center[i],n[i]=t[i]?this.center[i]:this.max[i];return n[2]=this.max[2],new wu(r,n)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}distanceZ(e){return Math.max(Math.min(this.max[2],e[2]),this.min[2])-e[2]}getCorners(){const e=this.min,t=this.max;return[[e[0],e[1],e[2]],[t[0],e[1],e[2]],[t[0],t[1],e[2]],[e[0],t[1],e[2]],[e[0],e[1],t[2]],[t[0],e[1],t[2]],[t[0],t[1],t[2]],[e[0],t[1],t[2]]]}intersects(e){return this.intersectsAabb(e.bounds)?xu(e,this.getCorners()):0}intersectsFlat(e){return this.intersectsAabb(e.bounds)?xu(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsPrecise(e,t){return t||this.intersects(e)?bu(e,this.getCorners()):0}intersectsPreciseFlat(e,t){return t||this.intersectsFlat(e)?bu(e,[[this.min[0],this.min[1],0],[this.max[0],this.min[1],0],[this.max[0],this.max[1],0],[this.min[0],this.max[1],0]]):0}intersectsAabb(e){for(let t=0;t<3;++t)if(this.min[t]>e.max[t]||e.min[t]>this.max[t])return!1;return!0}intersectsAabbXY(e){return!(this.min[0]>e.max[0]||e.min[0]>this.max[0]||this.min[1]>e.max[1]||e.min[1]>this.max[1])}encapsulate(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e.min[t]),this.max[t]=Math.max(this.max[t],e.max[t])}encapsulatePoint(e){for(let t=0;t<3;t++)this.min[t]=Math.min(this.min[t],e[t]),this.max[t]=Math.max(this.max[t],e[t])}closestPoint(e){return[Math.max(Math.min(this.max[0],e[0]),this.min[0]),Math.max(Math.min(this.max[1],e[1]),this.min[1]),Math.max(Math.min(this.max[2],e[2]),this.min[2])]}}ps(wu,"Aabb");class _u{constructor(e,t){this.feature=e,this.metersToTile=t,this.index=0}get(){const e=this.feature.vertices[this.index],t=this.feature.vertexProps[this.index].dir,r=t[1],n=-t[0],i=(e.extent+1)*this.metersToTile;return[new oe(Math.trunc(e.position[0]+r*i),Math.trunc(e.position[1]+n*i)),new oe(Math.trunc(e.position[0]-r*i),Math.trunc(e.position[1]-n*i))]}next(){this.index++}valid(){return this.index<this.feature.vertices.length}}class Iu{constructor(e,t,r,n,i,s){if(this.vertices=new Array,this.vertexProps=new Array,this.edges=new Array,this.edgeProps=new Array,this._tmpVec2=[Z(),Z(),Z(),Z(),Z(),Z(),Z()],this.id=e,this.heightRange={min:r,max:r},this.safeArea=t,this.constantHeight=r,null==this.constantHeight&&(null!=this.constantHeight||0!==n.length)){this.vertices=n,this.edges=i,this.edges=this.edges.filter(e=>{return e.a<this.vertices.length&&e.b<this.vertices.length&&!((t=this.vertices[e.a].position)[0]===(r=this.vertices[e.b].position)[0]&&t[1]===r[1]);var t,r}),this.heightRange={min:Number.POSITIVE_INFINITY,max:Number.NEGATIVE_INFINITY};for(const e of this.vertices)this.vertexProps.push({dir:Y(0,0)}),this.heightRange.min=Math.min(this.heightRange.min,e.height),this.heightRange.max=Math.max(this.heightRange.max,e.height);for(const e of this.edges){const t=this.vertices[e.a].position,r=this.vertices[e.b].position,n=K(Z(),r,t),i=ee(n),s=Q(Z(),n,1/i);this.edgeProps.push({vec:n,dir:s,len:i});const o=this.vertexProps[e.a].dir,a=this.vertexProps[e.b].dir;J(o,o,s),J(a,a,s)}for(const e of this.vertexProps)0===e.dir[0]&&0===e.dir[1]||te(e.dir,e.dir);this.tessellate(s)}}pointElevation(e){if(null!=this.constantHeight)return this.constantHeight;const t=this.getClosestEdge(e);if(null==t)return 0;const[r,n]=t;return Bt(this.vertices[this.edges[r].a].height,this.vertices[this.edges[r].b].height,n)}computeSlopeNormal(e,t){const r=this.getClosestEdge(e);if(!r)return y(0,0,1);const n=r[0],i=this.edges[n],s=this.edgeProps[n].vec,o=y(s[0],s[1],(this.vertices[i.b].height-this.vertices[i.a].height)*t),a=y(o[1],-o[0],0);z(a,a,o);const l=m(a);return l>0?_(a,a,1/l):g(a,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(e){if(0===this.edges.length)return;let t=0,r=Number.POSITIVE_INFINITY,n=0;const[i,s,o,a,l,u,c]=this._tmpVec2;W(c,e.x,e.y);const h=new mu(c,null);for(let p=0;p<this.edges.length;p++){const e=this.edges[p],d=this.edgeProps[p].dir;h.dir=d;const f=this.vertices[e.a].position,m=this.vertices[e.b].position,y=h.intersectsPlane(f,this.vertexProps[e.a].dir,i),g=h.intersectsPlane(m,this.vertexProps[e.b].dir,s);if(!y||!g)continue;K(o,s,i),K(a,c,i);const x=re(o,o),v=x>0?re(a,o)/x:0,b=pe(v,0,1),w=Math.abs((v-b)*this.edgeProps[p].len);K(l,c,f),W(u,d[1],-d[0]);const _=w+Math.abs(re(l,u));_<r&&(t=p,r=_,n=b)}return[t,n]}tessellate(e){const t=d(),r=d(),n=d(),i=d();for(let s=this.edges.length-1;s>=0;--s){const o=this.edges[s].a,a=this.edges[s].b,{position:l,height:u,extent:c}=this.vertices[o],{position:h,height:p,extent:d}=this.vertices[a],f=this.vertexProps[o].dir,m=this.vertexProps[a].dir;if(g(t,l[0]/e,l[1]/e,u),g(r,h[0]/e,h[1]/e,p),g(n,f[1],-f[0],0),_(n,n,c),g(i,m[1],-m[0],0),_(i,i,d),this.distSqLines(y(t[0]+.5*n[0],t[1]+.5*n[1],t[2]+.5*n[2]),y(r[0]-.5*i[0],r[1]-.5*i[1],r[2]-.5*i[2]),y(t[0]-.5*n[0],t[1]-.5*n[1],t[2]-.5*n[2]),y(r[0]+.5*i[0],r[1]+.5*i[1],r[2]+.5*i[2]))<=.0025000000000000005)continue;const x=this.vertices.length,v=J(Z(),l,h);this.vertices.push({position:Q(v,v,.5),height:.5*(u+p),extent:.5*(c+d)});const b=J(Z(),f,m);this.vertexProps.push({dir:te(b,b)}),this.edges.splice(s,1),this.edgeProps.splice(s,1),this.edges.push({a:o,b:x}),this.edges.push({a:x,b:a});const w=K(Z(),this.vertices[x].position,l),I=ee(w),A={vec:w,dir:Q(Z(),w,1/I),len:I};this.edgeProps.push(A),this.edgeProps.push(A)}}distSqLines(e,t,r,n){const i=v(d(),t,e),s=v(d(),n,r),o=v(d(),e,r),a=P(i,i),l=P(i,s),u=P(i,o),c=P(s,s),h=P(s,o),p=a*c-l*l;if(0===p)return S(T(i,r,n,P(o,s)/P(s,s)),e);const f=(a*h-l*u)/p;return S(T(i,e,t,(l*h-u*c)/p),T(s,r,n,f))}}class Au{static parseFrom(e,t){const r=fu.parse(e);if(!r)return[];let{vertices:n,features:i}=r;const s=1/$l(t);i.sort((e,t)=>e.id-t.id),n.sort((e,t)=>e.id-t.id||e.idx-t.idx),n=n.filter((e,t,r)=>t===r.findIndex(t=>t.id===e.id&&t.idx===e.idx));const o=new Array;let a=0;const l=n.length;for(const u of i){if(u.constantHeight){o.push(new Iu(u.id,u.bounds,u.constantHeight));continue}for(;a!==l&&n[a].id<u.id;)a++;if(a===l||n[a].id!==u.id)continue;const e=new Array,t=new Array,r=a;for(;a!==l&&n[a].id===u.id;){const i=n[a];if(e.push({position:i.position,height:i.height,extent:i.extent}),a!==r&&n[a-1].idx===i.idx-1){const e=a-r;t.push({a:e-1,b:e})}a++}o.push(new Iu(u.id,u.bounds,void 0,e,t,s))}return o}static getElevationFeature(e,t){if(!t)return;const r=+e.properties[au];return Number.isNaN(r)?void 0:t.find(e=>e.id===r)}}class Su{constructor(e,t){this.zScale=1,this.xOffset=0,this.yOffset=0,e.equals(t)||(this.zScale=Math.pow(2,t.z-e.z),this.xOffset=(e.x*this.zScale-t.x)*tn,this.yOffset=(e.y*this.zScale-t.y)*tn)}constantElevation(e,t){if(null!=e.constantHeight)return this.computeBiasedHeight(e.constantHeight,t)}pointElevation(e,t,r){const n=this.constantElevation(t,r);return null!=n?n:(e.x=e.x*this.zScale+this.xOffset,e.y=e.y*this.zScale+this.yOffset,this.computeBiasedHeight(t.pointElevation(e),r))}computeBiasedHeight(e,t){return t<=0?e:e+t*de(0,t,e>=0?e:Math.abs(.5*e))}}function Mu(e){if(0===e)return[0,0,0];const t=ki(e);return[t(),t(),t()]}ps(Iu,"ElevationFeature");class Bu{constructor(e){this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.projection=e.projection,this.layoutVertexArray=new Qo,this.indexArray=new wa,this.segments=new Ka,this.programConfigurations=new vl(e.layers,{zoom:e.zoom,lut:e.lut}),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,"none"!==this.elevationMode&&(this.elevatedLayoutVertexArray=new ra),this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,r,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,r,n){const i=this.layers[0],s=[];let o=null;"circle"===i.type&&(o=i.layout.get("circle-sort-key"));for(const{feature:l,id:u,index:c,sourceLayerIndex:h}of e){const e=this.layers[0]._featureFilter.needGeometry,i=Ql(l,e);if(!this.layers[0]._featureFilter.filter(new lo(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),i,r))continue;const a=o?o.evaluate(i,{},r):void 0,p={id:u,properties:l.properties,type:l.type,sourceLayerIndex:h,index:c,geometry:e?i.geometry:Kl(l,r,n),patterns:{},sortKey:a};s.push(p)}o&&s.sort((e,t)=>e.sortKey-t.sortKey);let a=null;"globe"===n.projection.name&&(this.globeExtVertexArray=new ha,a=n.projection);for(const l of s){const{geometry:n,index:i,sourceLayerIndex:s}=l,o=e[i].feature;this.addFeature(l,n,i,t.availableImages,r,a,t.brightness,t.elevationFeatures),t.featureIndex.insert(o,n,i,s,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(e,t,r,n,i,s,o){this.programConfigurations.updatePaintArrays(e,t,i,r,n,s,o,this.worldview)}updateExpressions(e){this.programConfigurations.updateExpressions(e)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Ya.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Ja.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,Wa.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(e,t,r,n,i,s,o,a){let l;"none"!==this.elevationMode&&(l=Au.getElevationFeature(e,a));for(const u of t)for(const t of u){const r=t.x,n=t.y;if(r<0||r>=tn||n<0||n>=tn)continue;if(s){const e=s.projectTilePoint(r,n,i),t=s.upVector(i,r,n);this.addGlobeExtVertex(e,t),this.addGlobeExtVertex(e,t),this.addGlobeExtVertex(e,t),this.addGlobeExtVertex(e,t)}const o=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,e.sortKey),a=o.vertexLength;if(this.addCircleVertex(r,n,-1,-1),this.addCircleVertex(r,n,1,-1),this.addCircleVertex(r,n,1,1),this.addCircleVertex(r,n,-1,1),"none"!==this.elevationMode){const e=l?l.pointElevation(new oe(r,n)):0;this.hasElevation=this.hasElevation||0!==e;for(let t=0;t<4;t++)this.elevatedLayoutVertexArray.emplaceBack(e)}this.indexArray.emplaceBack(a,a+1,a+2),this.indexArray.emplaceBack(a,a+2,a+3),o.vertexLength+=4,o.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,{},n,i,o,void 0,this.worldview)}addCircleVertex(e,t,r,n){this.layoutVertexArray.emplaceBack(2*e+(r+1)/2,2*t+(n+1)/2)}addGlobeExtVertex(e,t){const r=16384;this.globeExtVertexArray.emplaceBack(e.x,e.y,e.z,t[0]*r,t[1]*r,t[2]*r)}}function Pu(e,t){for(let r=0;r<e.length;r++)if(Ou(t,e[r]))return!0;for(let r=0;r<t.length;r++)if(Ou(e,t[r]))return!0;return!!Vu(e,t)}function zu(e,t,r){return!!Ou(e,t)||!!Fu(t,e,r)}function Tu(e,t){if(1===e.length)return Ru(t,e[0]);for(let r=0;r<t.length;r++){const n=t[r];for(let t=0;t<n.length;t++)if(Ou(e,n[t]))return!0}for(let r=0;r<e.length;r++)if(Ru(t,e[r]))return!0;for(let r=0;r<t.length;r++)if(Vu(e,t[r]))return!0;return!1}function ku(e,t,r){if(e.length>1){if(Vu(e,t))return!0;for(let n=0;n<t.length;n++)if(Fu(t[n],e,r))return!0}for(let n=0;n<e.length;n++)if(Fu(e[n],t,r))return!0;return!1}function Vu(e,t){if(0===e.length||0===t.length)return!1;for(let r=0;r<e.length-1;r++){const n=e[r],i=e[r+1];for(let e=0;e<t.length-1;e++)if(Eu(n,i,t[e],t[e+1]))return!0}return!1}function Eu(e,t,r,n){return we(e,r,n)!==we(t,r,n)&&we(e,t,r)!==we(e,t,n)}function Du(e,t,r){return(e.x-r.x)*(t.y-r.y)-(e.y-r.y)*(t.x-r.x)}function Cu(e,t,r,n){const i=Du(e,t,n),s=Du(e,t,r);if(Math.sign(i)===Math.sign(s))return;const o=Du(r,n,e),a=o+s-i;return Math.sign(o)!==Math.sign(a)?[o/(o-a),s/(s-i)]:void 0}function Fu(e,t,r){const n=r*r;if(1===t.length)return e.distSqr(t[0])<n;for(let i=1;i<t.length;i++)if(Lu(e,t[i-1],t[i])<n)return!0;return!1}function Lu(e,t,r){const n=t.distSqr(r);if(0===n)return e.distSqr(t);const i=((e.x-t.x)*(r.x-t.x)+(e.y-t.y)*(r.y-t.y))/n;return e.distSqr(i<0?t:i>1?r:r.sub(t)._mult(i)._add(t))}function Ru(e,t){let r,n,i,s=!1;for(let o=0;o<e.length;o++){r=e[o];for(let e=0,o=r.length-1;e<r.length;o=e++)n=r[e],i=r[o],n.y>t.y!=i.y>t.y&&t.x<(i.x-n.x)*(t.y-n.y)/(i.y-n.y)+n.x&&(s=!s)}return s}function Ou(e,t){let r=!1;for(let n=0,i=e.length-1;n<e.length;i=n++){const s=e[n],o=e[i];s.y>t.y!=o.y>t.y&&t.x<(o.x-s.x)*(t.y-s.y)/(o.y-s.y)+s.x&&(r=!r)}return r}function Uu(e,t,r){const n=r[0],i=r[2];if(e.x<n.x&&t.x<n.x||e.x>i.x&&t.x>i.x||e.y<n.y&&t.y<n.y||e.y>i.y&&t.y>i.y)return!1;const s=we(e,t,r[0]);return s!==we(e,t,r[1])||s!==we(e,t,r[2])||s!==we(e,t,r[3])}function Nu(e,t,r,n,i,s){let o=t.y-e.y,a=e.x-t.x;if(s=s||0){const e=o*o+a*a;if(0===e)return!0;const t=Math.sqrt(e);o/=t,a/=t}return!((r.x-e.x)*o+(r.y-e.y)*a-s<0||(n.x-e.x)*o+(n.y-e.y)*a-s<0||(i.x-e.x)*o+(i.y-e.y)*a-s<0)}function ju(e,t,r,n,i,s,o){return!(Nu(e,t,n,i,s,o)||Nu(t,r,n,i,s,o)||Nu(r,e,n,i,s,o)||Nu(n,i,e,t,r,o)||Nu(i,s,e,t,r,o)||Nu(s,n,e,t,r,o))}function $u(e,t,r){const n=t.paint.get(e).value;return"constant"===n.kind?n.value:r.programConfigurations.get(t.id).getMaxValue(e)}function Gu(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1])}function Xu(e,t,r,n,i){if(!t[0]&&!t[1])return e;const s=oe.convert(t)._mult(i);"viewport"===r&&s._rotate(-n);const o=[];for(let a=0;a<e.length;a++)o.push(e[a].sub(s));return o}function qu(e,t,r,n){const i=oe.convert(e)._mult(n);return"viewport"===t&&i._rotate(-r),i}let Hu,Zu;ps(Bu,"CircleBucket",{omit:["layers"]});class Yu{constructor(e,t,r){this.z=e,this.x=t,this.y=r,this.key=Ku(0,e,e,t,r)}equals(e){return this.z===e.z&&this.x===e.x&&this.y===e.y}isChildOf(e){const t=this.z-e.z;return 0===e.z||e.z<this.z&&e.x===this.x>>t&&e.y===this.y>>t}url(e,t){const r=function(e,t,r){const n=2**r,i=2*Math.PI*6378137,s=i*(e/n-.5),o=i*(.5-(t+1)/n);return`${s},${o},${s+i/n},${o+i/n}`}(this.x,this.y,this.z),n=function(e,t,r){let n,i="";for(let s=e;s>0;s--)n=1<<s-1,i+=(t&n?1:0)+(r&n?2:0);return i}(this.z,this.x,this.y);return e[(this.x+this.y)%e.length].replace("{prefix}",(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String("tms"===t?Math.pow(2,this.z)-this.y-1:this.y)).replace("{quadkey}",n).replace("{bbox-epsg-3857}",r).replace("{bbox-epsg-4490}",function(e,t,r){const n=Math.pow(2,r),i=360/n,s=180/(n>>1);return[e*i-180,90-(t+1)*s,(e+1)*i-180,90-t*s].join(",")}(this.x,this.y,this.z))}toString(){return`${this.z}/${this.x}/${this.y}`}}class Wu{constructor(e,t){this.wrap=e,this.canonical=t,this.key=Ku(e,t.z,t.z,t.x,t.y)}}class Ju{constructor(e,t,r,n,i){this.overscaledZ=e,this.wrap=t,this.canonical=new Yu(r,+n,+i),this.key=0===t&&e===r?this.canonical.key:Ku(t,e,r,n,i)}equals(e){return this.overscaledZ===e.overscaledZ&&this.wrap===e.wrap&&this.canonical.equals(e.canonical)}scaledTo(e){const t=this.canonical.z-e;return e>this.canonical.z?new Ju(e,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ju(e,this.wrap,e,this.canonical.x>>t,this.canonical.y>>t)}calculateScaledKey(e,t=!0){if(this.overscaledZ===e&&t)return this.key;if(e>this.canonical.z)return Ku(this.wrap*+t,e,this.canonical.z,this.canonical.x,this.canonical.y);{const r=this.canonical.z-e;return Ku(this.wrap*+t,e,e,this.canonical.x>>r,this.canonical.y>>r)}}isChildOf(e){if(e.wrap!==this.wrap)return!1;const t=this.canonical.z-e.canonical.z;return 0===e.overscaledZ||e.overscaledZ<this.overscaledZ&&e.canonical.z<this.canonical.z&&e.canonical.x===this.canonical.x>>t&&e.canonical.y===this.canonical.y>>t}children(e){if(this.overscaledZ>=e)return[new Ju(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const t=this.canonical.z+1,r=2*this.canonical.x,n=2*this.canonical.y;return[new Ju(t,this.wrap,t,r,n),new Ju(t,this.wrap,t,r+1,n),new Ju(t,this.wrap,t,r,n+1),new Ju(t,this.wrap,t,r+1,n+1)]}isLessThan(e){return this.wrap<e.wrap||!(this.wrap>e.wrap)&&(this.overscaledZ<e.overscaledZ||!(this.overscaledZ>e.overscaledZ)&&(this.canonical.x<e.canonical.x||!(this.canonical.x>e.canonical.x)&&this.canonical.y<e.canonical.y))}wrapped(){return new Ju(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(e){return new Ju(this.overscaledZ,e,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Wu(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}}function Ku(e,t,r,n,i){const s=1<<Math.min(r,22);let o=s*(i%s)+n%s;return e&&r<22&&(o+=s*s*((e<0?-2*e-1:2*e)%(1<<2*(22-r)))),16*(32*o+r)+(t-r)}function Qu(e){return e*Sl/Tl}ps(Yu,"CanonicalTileID"),ps(Ju,"OverscaledTileID",{omit:["projMatrix","expandedProjMatrix"]}),Jo([{type:"Float32",name:"a_globe_pos",components:3},{type:"Float32",name:"a_uv",components:2}]),Jo([{name:"a_pos_3",components:3,type:"Int16"}]),Jo([{name:"a_pos",type:"Int16",components:2}]);const ec=[new wu([Ml,Ml,Ml],[Bl,Bl,Bl]),new wu([Ml,Ml,Ml],[0,0,Bl]),new wu([0,Ml,Ml],[Bl,0,Bl]),new wu([Ml,0,Ml],[0,Bl,Bl]),new wu([0,0,Ml],[Bl,Bl,Bl])];function tc(e,t,r,n=!0){const i=_([],e._camera.position,e.worldSize),s=[t,r,1,1];R(s,s,e.pixelMatrixInverse),function(e,t,r){e[0]=t[0]*r,e[1]=t[1]*r,e[2]=t[2]*r,e[3]=t[3]*r}(s,s,1/s[3]);const o=B([],F([],s,i)),a=e.globeMatrix,l=[a[12],a[13],a[14]],u=F([],l,i),c=m(u),h=B([],u),p=e.worldSize/(2*Math.PI),d=P(h,o),f=Math.asin(p/c);if(f<Math.acos(d)){if(!n)return null;const e=[],t=[];_(e,o,c/d),B(t,F(t,e,u)),B(o,x(o,u,_(o,t,Math.tan(f)*c)))}const y=[];new yu(i,o).closestPointOnSphere(l,p,y);const g=B([],Be(a,0)),v=B([],Be(a,1)),b=B([],Be(a,2)),w=P(g,y),I=P(v,y),A=P(b,y),S=he(Math.asin(-I/p));let M=he(Math.atan2(w,A));M=e.center.lng+function(e,t){const r=(t-e+180)%360-180;return r<-180?r+360:r}(e.center.lng,M);const z=Cl(M),T=pe(Fl(S),0,1);return new Gl(z,T)}function rc(e){if(e.z<=1)return ec[e.z+2*e.y+e.x];const t=function(e,t=Sl){const r=ce(e.getNorth()),n=ce(e.getSouth()),i=Math.cos(r),s=Math.cos(n),o=Math.sin(r),a=Math.sin(n),l=e.getWest(),u=e.getEast();return[Pl(s,a,l,t),Pl(s,a,u,t),Pl(i,o,u,t),Pl(i,o,l,t)]}(function({x:e,y:t,z:r},n=!1){const i=1/(1<<r),s=new Vl(Rl(e*i),t===(1<<r)-1&&n?-90:Ol((t+1)*i)),o=new Vl(Rl((e+1)*i),0===t&&n?90:Ol(t*i));return new El(s,o)}(e));return wu.fromPoints(t)}function nc(e,t,r){return _(e,e,1-r),I(e,e,t,r)}function ic(e,t,r,n){const i=1<<r.z,s=(e/tn+r.x)/i;return zl(Ol((t/tn+r.y)/i),Rl(s),n)}function sc({min:e,max:t}){return 16383/Math.max(t[0]-e[0],t[1]-e[1],t[2]-e[2])}const oc=new Float64Array(16);function ac(e){const t=sc(e),r=function(e,t){return e[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}(oc,[t,t,t]);return l(r,r,M([],e.min))}function lc(e){const t=tn/(2*Math.PI);return e/(2*Math.PI)/t}function uc(e){return de(5,6,e)}i();function cc(e,t,r,n,i,s,o,a,l){if(s&&e.queryGeometry.isAboveHorizon)return!1;s&&(l*=e.pixelToTileUnitsFactor);const u=e.tileID.canonical,c=r.projection.upVectorScale(u,r.center.lat,r.worldSize).metersToTile;for(const h of t)for(const t of h){const h=t.add(a),p=i&&r.elevation?r.elevation.exaggeration()*i.getElevationAt(h.x,h.y,!0):0,d=r.projection.projectTilePoint(h.x,h.y,u);if(p>0){const e=r.projection.upVector(u,h.x,h.y);d.x+=e[0]*c*p,d.y+=e[1]*c*p,d.z+=e[2]*c*p}const f=s?h:hc(d.x,d.y,d.z,n),m=s?e.tilespaceRays.map(e=>fc(e,p)):e.queryGeometry.screenGeometry,y=R([],[d.x,d.y,d.z,1],n);if(!o&&s?l*=y[3]/r.cameraToCenterDistance:o&&!s&&(l*=r.cameraToCenterDistance/y[3]),s){const e=Ol((t.y/tn+u.y)/(1<<u.z));l/=r.projection.pixelsPerMeter(e,1)/Ll(1,e)}if(zu(m,f,l))return!0}return!1}function hc(e,t,r,n){const i=R([],[e,t,r,1],n);return new oe(i[0]/i[3],i[1]/i[3])}const pc=y(0,0,0),dc=y(0,0,1);function fc(e,t){const r=d();return pc[2]=t,e.intersectsPlane(pc,dc,r),new oe(r[0],r[1])}class mc extends Bu{}let yc,gc,xc,vc;function bc(e,{width:t,height:r},n,i){if(i){if(i instanceof Uint8ClampedArray)i=new Uint8Array(i.buffer);else if(i.length!==t*r*n)throw new RangeError("mismatched image size")}else i=new Uint8Array(t*r*n);return e.width=t,e.height=r,e.data=i,e}function wc(e,t,r){const{width:n,height:i}=t;n===e.width&&i===e.height||(_c(e,t,{x:0,y:0},{x:0,y:0},{width:Math.min(e.width,n),height:Math.min(e.height,i)},r,null),e.width=n,e.height=i,e.data=t.data)}function _c(e,t,r,n,i,s,o,a){if(0===i.width||0===i.height)return t;if(i.width>e.width||i.height>e.height||r.x>e.width-i.width||r.y>e.height-i.height)throw new RangeError("out of range source coordinates for image copy");if(i.width>t.width||i.height>t.height||n.x>t.width-i.width||n.y>t.height-i.height)throw new RangeError("out of range destination coordinates for image copy");const l=e.data,u=t.data,c=4===s&&a;for(let h=0;h<i.height;h++){const a=((r.y+h)*e.width+r.x)*s,p=((n.y+h)*t.width+n.x)*s;if(c)for(let e=0;e<i.width;e++){const t=a+e*s+3,r=p+e*s;u[r+0]=255,u[r+1]=255,u[r+2]=255,u[r+3]=l[t]}else if(o)for(let e=0;e<i.width;e++){const t=a+e*s,r=p+e*s,n=new Pt(l[t+0]/255,l[t+1]/255,l[t+2]/255,l[t+3]).toNonPremultipliedRenderColor(o).toArray();u[r+0]=n[0],u[r+1]=n[1],u[r+2]=n[2],u[r+3]=n[3]}else for(let e=0;e<i.width*s;e++)u[p+e]=l[a+e]}return t}ps(mc,"HeatmapBucket",{omit:["layers"]});class Ic{constructor(e,t){bc(this,e,1,t)}resize(e){wc(this,new Ic(e),1)}clone(){return new Ic({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,r,n,i){_c(e,t,r,n,i,1,null)}}class Ac{constructor(e,t){bc(this,e,4,t)}resize(e){wc(this,new Ac(e),4)}replace(e,t){t?this.data.set(e):this.data=e instanceof Uint8ClampedArray?new Uint8Array(e.buffer):e}clone(){return new Ac({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(e,t,r,n,i,s,o){_c(e,t,r,n,i,4,s,o)}}class Sc{constructor(e,t){this.width=e.width,this.height=e.height,this.data=t instanceof Uint8Array?new Float32Array(t.buffer):t}}function Mc(e){const t={},r=e.resolution||256,n=e.clips?e.clips.length:1,i=e.image||new Ac({width:r,height:n}),s=(r,n,s)=>{t[e.evaluationKey]=s;const o=e.expression.evaluate(t),a=o?o.toNonPremultipliedRenderColor(null):null;a&&(i.data[r+n+0]=Math.floor(255*a.r),i.data[r+n+1]=Math.floor(255*a.g),i.data[r+n+2]=Math.floor(255*a.b),i.data[r+n+3]=Math.floor(255*a.a))};if(e.clips)for(let o=0,a=0;o<n;++o,a+=4*r)for(let t=0,n=0;t<r;t++,n+=4){const i=t/(r-1),{start:l,end:u}=e.clips[o];s(a,n,l*(1-i)+u*i)}else for(let o=0,a=0;o<r;o++,a+=4)s(0,a,o/(r-1));return i}ps(Ic,"AlphaImage"),ps(Ac,"RGBAImage");const Bc=Jo([{name:"a_pos",components:2,type:"Int16"}],4),Pc=Jo([{name:"a_road_z_offset",components:1,type:"Float32"}],4),zc=Jo([{name:"a_pos",components:2,type:"Int16"},{name:"a_height",components:1,type:"Float32"}],4),Tc=Jo([{name:"a_pos_normal_3",components:3,type:"Int16"}],4);function kc(e,t,r=2){const n=t&&t.length,i=n?t[0]*r:e.length;let s=Vc(e,0,i,r,!0);const o=[];if(!s||s.next===s.prev)return o;let a,l,u;if(n&&(s=function(e,t,r,n){const i=[];for(let s=0,o=t.length;s<o;s++){const r=Vc(e,t[s]*n,s<o-1?t[s+1]*n:e.length,n,!1);r===r.next&&(r.steiner=!0),i.push($c(r))}i.sort(Oc);for(let s=0;s<i.length;s++)r=Uc(i[s],r);return r}(e,t,s,r)),e.length>80*r){a=e[0],l=e[1];let t=a,n=l;for(let s=r;s<i;s+=r){const r=e[s],i=e[s+1];r<a&&(a=r),i<l&&(l=i),r>t&&(t=r),i>n&&(n=i)}u=Math.max(t-a,n-l),u=0!==u?32767/u:0}return Dc(s,o,r,a,l,u,0),o}function Vc(e,t,r,n,i){let s;if(i===function(e,t,r,n){let i=0;for(let s=t,o=r-n;s<r;s+=n)i+=(e[o]-e[s])*(e[s+1]+e[o+1]),o=s;return i}(e,t,r,n)>0)for(let o=t;o<r;o+=n)s=eh(o/n|0,e[o],e[o+1],s);else for(let o=r-n;o>=t;o-=n)s=eh(o/n|0,e[o],e[o+1],s);return s&&Zc(s,s.next)&&(th(s),s=s.next),s}function Ec(e,t){if(!e)return e;t||(t=e);let r,n=e;do{if(r=!1,n.steiner||!Zc(n,n.next)&&0!==Hc(n.prev,n,n.next))n=n.next;else{if(th(n),n=t=n.prev,n===n.next)break;r=!0}}while(r||n!==t);return t}function Dc(e,t,r,n,i,s,o){if(!e)return;!o&&s&&function(e,t,r,n){let i=e;do{0===i.z&&(i.z=jc(i.x,i.y,t,r,n)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,function(e){let t,r=1;do{let n,i=e;e=null;let s=null;for(t=0;i;){t++;let o=i,a=0;for(let e=0;e<r&&(a++,o=o.nextZ,o);e++);let l=r;for(;a>0||l>0&&o;)0!==a&&(0===l||!o||i.z<=o.z)?(n=i,i=i.nextZ,a--):(n=o,o=o.nextZ,l--),s?s.nextZ=n:e=n,n.prevZ=s,s=n;i=o}s.nextZ=null,r*=2}while(t>1)}(i)}(e,n,i,s);let a=e;for(;e.prev!==e.next;){const l=e.prev,u=e.next;if(s?Fc(e,n,i,s):Cc(e))t.push(l.i,e.i,u.i),th(e),e=u.next,a=u.next;else if((e=u)===a){o?1===o?Dc(e=Lc(Ec(e),t),t,r,n,i,s,2):2===o&&Rc(e,t,r,n,i,s):Dc(Ec(e),t,r,n,i,s,1);break}}}function Cc(e){const t=e.prev,r=e,n=e.next;if(Hc(t,r,n)>=0)return!1;const i=t.x,s=r.x,o=n.x,a=t.y,l=r.y,u=n.y,c=Math.min(i,s,o),h=Math.min(a,l,u),p=Math.max(i,s,o),d=Math.max(a,l,u);let f=n.next;for(;f!==t;){if(f.x>=c&&f.x<=p&&f.y>=h&&f.y<=d&&Xc(i,a,s,l,o,u,f.x,f.y)&&Hc(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function Fc(e,t,r,n){const i=e.prev,s=e,o=e.next;if(Hc(i,s,o)>=0)return!1;const a=i.x,l=s.x,u=o.x,c=i.y,h=s.y,p=o.y,d=Math.min(a,l,u),f=Math.min(c,h,p),m=Math.max(a,l,u),y=Math.max(c,h,p),g=jc(d,f,t,r,n),x=jc(m,y,t,r,n);let v=e.prevZ,b=e.nextZ;for(;v&&v.z>=g&&b&&b.z<=x;){if(v.x>=d&&v.x<=m&&v.y>=f&&v.y<=y&&v!==i&&v!==o&&Xc(a,c,l,h,u,p,v.x,v.y)&&Hc(v.prev,v,v.next)>=0)return!1;if(v=v.prevZ,b.x>=d&&b.x<=m&&b.y>=f&&b.y<=y&&b!==i&&b!==o&&Xc(a,c,l,h,u,p,b.x,b.y)&&Hc(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;v&&v.z>=g;){if(v.x>=d&&v.x<=m&&v.y>=f&&v.y<=y&&v!==i&&v!==o&&Xc(a,c,l,h,u,p,v.x,v.y)&&Hc(v.prev,v,v.next)>=0)return!1;v=v.prevZ}for(;b&&b.z<=x;){if(b.x>=d&&b.x<=m&&b.y>=f&&b.y<=y&&b!==i&&b!==o&&Xc(a,c,l,h,u,p,b.x,b.y)&&Hc(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function Lc(e,t){let r=e;do{const n=r.prev,i=r.next.next;!Zc(n,i)&&Yc(n,r,r.next,i)&&Kc(n,i)&&Kc(i,n)&&(t.push(n.i,r.i,i.i),th(r),th(r.next),r=e=i),r=r.next}while(r!==e);return Ec(r)}function Rc(e,t,r,n,i,s){let o=e;do{let e=o.next.next;for(;e!==o.prev;){if(o.i!==e.i&&qc(o,e)){let a=Qc(o,e);return o=Ec(o,o.next),a=Ec(a,a.next),Dc(o,t,r,n,i,s,0),void Dc(a,t,r,n,i,s,0)}e=e.next}o=o.next}while(o!==e)}function Oc(e,t){let r=e.x-t.x;return 0===r&&(r=e.y-t.y,0===r)&&(r=(e.next.y-e.y)/(e.next.x-e.x)-(t.next.y-t.y)/(t.next.x-t.x)),r}function Uc(e,t){const r=function(e,t){let r=t;const n=e.x,i=e.y;let s,o=-1/0;if(Zc(e,r))return r;do{if(Zc(e,r.next))return r.next;if(i<=r.y&&i>=r.next.y&&r.next.y!==r.y){const e=r.x+(i-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(e<=n&&e>o&&(o=e,s=r.x<r.next.x?r:r.next,e===n))return s}r=r.next}while(r!==t);if(!s)return null;const a=s,l=s.x,u=s.y;let c=1/0;r=s;do{if(n>=r.x&&r.x>=l&&n!==r.x&&Gc(i<u?n:o,i,l,u,i<u?o:n,i,r.x,r.y)){const t=Math.abs(i-r.y)/(n-r.x);Kc(r,e)&&(t<c||t===c&&(r.x>s.x||r.x===s.x&&Nc(s,r)))&&(s=r,c=t)}r=r.next}while(r!==a);return s}(e,t);if(!r)return t;const n=Qc(r,e);return Ec(n,n.next),Ec(r,r.next)}function Nc(e,t){return Hc(e.prev,e,t.prev)<0&&Hc(t.next,e,e.next)<0}function jc(e,t,r,n,i){return(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-r)*i|0)|e<<8))|e<<4))|e<<2))|e<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-n)*i|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function $c(e){let t=e,r=e;do{(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next}while(t!==e);return r}function Gc(e,t,r,n,i,s,o,a){return(i-o)*(t-a)>=(e-o)*(s-a)&&(e-o)*(n-a)>=(r-o)*(t-a)&&(r-o)*(s-a)>=(i-o)*(n-a)}function Xc(e,t,r,n,i,s,o,a){return!(e===o&&t===a)&&Gc(e,t,r,n,i,s,o,a)}function qc(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!function(e,t){let r=e;do{if(r.i!==e.i&&r.next.i!==e.i&&r.i!==t.i&&r.next.i!==t.i&&Yc(r,r.next,e,t))return!0;r=r.next}while(r!==e);return!1}(e,t)&&(Kc(e,t)&&Kc(t,e)&&function(e,t){let r=e,n=!1;const i=(e.x+t.x)/2,s=(e.y+t.y)/2;do{r.y>s!=r.next.y>s&&r.next.y!==r.y&&i<(r.next.x-r.x)*(s-r.y)/(r.next.y-r.y)+r.x&&(n=!n),r=r.next}while(r!==e);return n}(e,t)&&(Hc(e.prev,e,t.prev)||Hc(e,t.prev,t))||Zc(e,t)&&Hc(e.prev,e,e.next)>0&&Hc(t.prev,t,t.next)>0)}function Hc(e,t,r){return(t.y-e.y)*(r.x-t.x)-(t.x-e.x)*(r.y-t.y)}function Zc(e,t){return e.x===t.x&&e.y===t.y}function Yc(e,t,r,n){const i=Jc(Hc(e,t,r)),s=Jc(Hc(e,t,n)),o=Jc(Hc(r,n,e)),a=Jc(Hc(r,n,t));return i!==s&&o!==a||!(0!==i||!Wc(e,r,t))||!(0!==s||!Wc(e,n,t))||!(0!==o||!Wc(r,e,n))||!(0!==a||!Wc(r,t,n))}function Wc(e,t,r){return t.x<=Math.max(e.x,r.x)&&t.x>=Math.min(e.x,r.x)&&t.y<=Math.max(e.y,r.y)&&t.y>=Math.min(e.y,r.y)}function Jc(e){return e>0?1:e<0?-1:0}function Kc(e,t){return Hc(e.prev,e,e.next)<0?Hc(e,t,e.next)>=0&&Hc(e,e.prev,t)>=0:Hc(e,t,e.prev)<0||Hc(e,e.next,t)<0}function Qc(e,t){const r=rh(e.i,e.x,e.y),n=rh(t.i,t.x,t.y),i=e.next,s=t.prev;return e.next=t,t.prev=e,r.next=i,i.prev=r,n.next=r,r.prev=n,s.next=n,n.prev=s,n}function eh(e,t,r,n){const i=rh(e,t,r);return n?(i.next=n.next,i.prev=n,n.next.prev=i,n.next=i):(i.prev=i,i.next=i),i}function th(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function rh(e,t,r){return{i:e,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function nh(e,t){const r=e.length;if(r<=1)return[e];const n=[];let i,s;for(let o=0;o<r;o++){const t=_e(e[o]);0!==t&&(e[o].area=Math.abs(t),void 0===s&&(s=t<0),s===t<0?(i&&n.push(i),i=[e[o]]):i.push(e[o]))}if(i&&n.push(i),t>1)for(let o=0;o<n.length;o++)n[o].length<=t||(_r(n[o],t,1,n[o].length-1,ih),n[o]=n[o].slice(0,t));return n}function ih(e,t){return t.area-e.area}function sh(e,t,r=1){if(!e)return null;const n="string"==typeof e?rr.from(e).getPrimary():e.getPrimary(),i="string"==typeof e?null:e.getSecondary();for(const s of[n,i]){if(!s)continue;const e=s.id.toString();t.has(e)||t.set(e,[]),s.scaleSelf(r),t.get(e).push(s)}return{primary:n.toString(),secondary:i?i.toString():null}}function oh(e,t,r,n){const i=n.patternDependencies;let s=!1;for(const o of t){const t=o.paint.get(`${e}-pattern`);t.isConstant()||(s=!0),sh(t.constantOr(null),i,r)&&(s=!0)}return s}function ah(e,t,r,n,i,s){const o=s.patternDependencies;for(const a of t){const t=a.paint.get(`${e}-pattern`).value;if("constant"!==t.kind){const e=sh(t.evaluate({zoom:n},r,{},void 0,s.availableImages),o,i);if(!e)continue;const{primary:l,secondary:u}=e;l&&(r.patterns[a.id]=[l,u].filter(Boolean))}}return r}class lh{constructor(){this.portals=[]}static isOnBorder(e,t){return e<=0&&t<=0||e>=tn&&t>=tn}static evaluate(e){if(0===e.length)return new lh;let t=[];for(const a of e)t.push(...a.portals);if(0===t.length)return new lh;for(const a of t){const e=a.va,t=a.vb;(lh.isOnBorder(e.x,t.x)||lh.isOnBorder(e.y,t.y))&&(a.type="border")}const r=t.filter(e=>"unevaluated"!==e.type),n=t.filter(e=>"unevaluated"===e.type);if(0===n.length)return new lh;n.sort((e,t)=>e.hash===t.hash?e.isTunnel===t.isTunnel?0:e.isTunnel?-1:1:e.hash<t.hash?1:-1),t=r.concat(n);let i=r.length,s=i,o=i;do{if(s++,s===t.length||t[i].hash!==t[s].hash){if(s-i===2){o<i&&(t[o]=t[i],t[i]=null);const e=t[o],r=t[s-1];e.type=e.isTunnel!==r.isTunnel?"tunnel":"polygon",e.connection={a:e.connection.a,b:r.connection.a},o++}i=s}}while(i!==t.length);return t.splice(o),t.sort((e,t)=>e.hash<t.hash?1:-1),{portals:t}}}ps(lh,"ElevationPortalGraph");class uh{constructor(e,t,r){this.outPositions=e,this.outNormals=t,this.outIndices=r,this.vertexLookup=/* @__PURE__ */new Map}addVertex(e,t,r){let n=e[2];null!=r&&(n*=r);const i=`${e[0]},${e[1]},${e[2]},${t[0]},${t[1]},${t[2]}`,s=this.vertexLookup.get(i);if(null!=s)return s;const o=this.outPositions.length;this.vertexLookup.set(i,o);const a=Math.trunc(16384*t[0]),l=Math.trunc(16384*t[1]),u=Math.trunc(16384*t[2]);return this.outPositions.emplaceBack(e[0],e[1],n),this.outNormals.emplaceBack(a,l,u),o}addTriangle(e,t,r){this.outIndices.emplaceBack(e,t,r)}addTriangles(e,t,r){if(0===e.length)return;const n=1===r.length,i=d(),s=d();for(let o=0;o<e.length;o+=3){const a=t[e[o+0]],l=t[e[o+1]],u=t[e[o+2]],c=n?r[0]:r[e[o+1]],h=n?r[0]:r[e[o+2]];g(i,a.x,a.y,n?r[0]:r[e[o+0]]);const p=this.addVertex(i,s);g(i,l.x,l.y,c);const d=this.addVertex(i,s);g(i,u.x,u.y,h);const f=this.addVertex(i,s);this.outIndices.emplaceBack(p,d,f)}}addQuad(e,t,r,n,i,s){const o=this.addVertex(e,i,s),a=this.addVertex(t,i,s),l=this.addVertex(r,i,s),u=this.addVertex(n,i,s);this.addTriangle(o,a,l),this.addTriangle(l,u,o)}getVertexCount(){return this.outPositions.length}clearVertexLookup(){this.vertexLookup.clear()}}class ch{constructor(e,t,r,n){this.unevaluatedPortals=new lh,this.bridgeFeatureSections=[],this.tunnelFeatureSections=[],this.vertexHashLookup=/* @__PURE__ */new Map,this.unevalVertices=[],this.unevalHeights=[],this.unevalTriangles=[],this.unevalTunnelTriangles=[],this.unevalEdges=[],this.vertexPositions=new na,this.vertexNormals=new ia,this.indexArray=new wa,this.tileToMeters=$l(e),this.bridgeProgramConfigurations=new vl(t,{zoom:r,lut:n},e=>"fill-tunnel-structure-color"!==e),this.tunnelProgramConfigurations=new vl(t,{zoom:r,lut:n},e=>"fill-bridge-guard-rail-color"!==e)}addVertices(e,t){const r=this.unevalVertices.length;for(let n=0;n<e.length;n++)this.unevalVertices.push(e[n]),this.unevalHeights.push(t[n]);return r}addTriangles(e,t,r){const n=r?this.unevalTunnelTriangles:this.unevalTriangles;for(const i of e)n.push(i+t)}addRenderableRing(e,t,r,n,i,s){const o=[new oe(i.min.x,i.min.y),new oe(i.max.x,i.min.y),new oe(i.max.x,i.max.y),new oe(i.min.x,i.max.y)];for(let a=0;a<r-1;a++){const r=t+a,l=r+1,u=this.unevalVertices[r],c=this.unevalVertices[l];if(!(u.x>=i.min.x&&u.x<=i.max.x&&u.y>=i.min.y&&u.y<=i.max.y||c.x>=i.min.x&&c.x<=i.max.x&&c.y>=i.min.y&&c.y<=i.max.y||Uu(u,c,o)))continue;if(this.isOnBorder(u.x,c.x)||this.isOnBorder(u.y,c.y))continue;const h=ch.computeEdgeHash(this.unevalVertices[r],this.unevalVertices[l]);let p,d=this.vertexHashLookup.get(ch.computePosHash(u));null!=d?p=d.next:(d=this.vertexHashLookup.get(ch.computePosHash(c)),p=null!=d?d.prev:h),this.unevalEdges.push({polygonIdx:e,a:r,b:l,hash:h,portalHash:p,isTunnel:n,type:"unevaluated",featureInfo:s})}}addPortalCandidates(e,t,r,n,i){if(0!==t.length){this.vertexHashLookup.clear();for(const i of t){if(0===i.length)continue;const t=i[0];let s=ch.computeEdgeHash(t[t.length-2],t.at(-1));for(let i=0;i<t.length-1;i++){const o=t[i+0],a=t[i+1],l=Y(a.x-o.x,a.y-o.y),u=ee(l);if(0===u)continue;let c="unevaluated";const h=n.pointElevation(o),p=n.pointElevation(a);Math.abs(h)<.01&&Math.abs(p)<.01?c="entrance":(this.isOnBorder(o.x,a.x)||this.isOnBorder(o.y,a.y))&&(c="border");const d=ch.computeEdgeHash(o,a);this.unevaluatedPortals.portals.push({connection:{a:e,b:void 0},va:o,vb:a,vab:l,length:u,hash:d,isTunnel:r,type:c});const f=ch.computePosHash(o);this.vertexHashLookup.set(f,{prev:s,next:d}),s=d}}}}construct(e){if(0===this.unevalVertices.length)return;const t=()=>({vertexOffset:0,primitiveOffset:this.indexArray.length}),r=e=>{e.primitiveLength=this.indexArray.length-e.primitiveOffset},n=new uh(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(e.portals,this.unevalEdges);const i=t(),s=t(),o=t(),a=(e,t)=>{e.sort((e,r)=>e.type===t&&r.type!==t?-1:e.type!==t&&r.type===t?1:0);const r=e.findIndex(e=>e.type!==t);return r>=0?r:e.length};let l=0;this.unevalEdges.length>0&&(l=a(this.unevalEdges,"none"),this.constructBridgeStructures(n,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:l},this.tileToMeters)),r(o);const u=t(),c=t();if(this.unevalEdges.length>0){const e=this.unevalEdges.splice(l),t=a(e,"tunnel")+l;this.unevalEdges.push(...e),this.constructTunnelStructures(n,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:l},{min:l,max:t})}r(u),n.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),r(c),n.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),r(s),n.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),r(i),this.maskSegments=Ka.simpleSegment(0,c.primitiveOffset,0,c.primitiveLength),this.depthSegments=Ka.simpleSegment(0,s.primitiveOffset,0,s.primitiveLength),this.renderableBridgeSegments=Ka.simpleSegment(0,o.primitiveOffset,0,o.primitiveLength),this.renderableTunnelSegments=Ka.simpleSegment(0,u.primitiveOffset,0,u.primitiveLength),this.shadowCasterSegments=Ka.simpleSegment(0,i.primitiveOffset,0,i.primitiveLength)}update(e,t,r,n,i,s,o,a){this.bridgeProgramConfigurations.updatePaintArrays(e,t,i,r,n,s,o,a),this.tunnelProgramConfigurations.updatePaintArrays(e,t,i,r,n,s,o,a)}upload(e){this.vertexBuffer||0===this.vertexPositions.length||0===this.vertexNormals.length||0===this.indexArray.length||(this.vertexBuffer=e.createVertexBuffer(this.vertexPositions,zc.members),this.vertexBufferNormal=e.createVertexBuffer(this.vertexNormals,Tc.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(e),this.tunnelProgramConfigurations.upload(e))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableBridgeSegments.destroy(),this.renderableTunnelSegments.destroy(),this.shadowCasterSegments.destroy()),this.bridgeProgramConfigurations.destroy(),this.tunnelProgramConfigurations.destroy()}populatePaintArrays(e,t,r,n,i){const s=(s,o)=>{for(let a=0;a<o.length-1;a++){const l=o[a].featureIndex,u=o[a+1].vertexStart,c=e.feature(l);s.populatePaintArrays(u,c,l,{},r,t,n,void 0,i)}};s(this.bridgeProgramConfigurations,this.bridgeFeatureSections),s(this.tunnelProgramConfigurations,this.tunnelFeatureSections)}computeVertexConnections(e,t,r,n,i){const s=/* @__PURE__ */new Map;for(let o=n;o<i;o++){const n=r[o],i=n.a,a=n.b,l=ch.computePosHash(e[i]),u=ch.computePosHash(e[a]);let c=s.get(l);c||(c={},s.set(l,c));let h=s.get(u);h||(h={},s.set(u,h)),t[i]<=0&&t[a]<=0||(c.to=a,h.from=i)}return s}isTerminalVertex(e,t){const r=ch.computePosHash(this.unevalVertices[e]),n=t.get(r);return!n||!n.from||!n.to}constructBridgeStructures(e,t,r,n,i,s){e.clearVertexLookup();const o=this.computeVertexConnections(t,r,n,i.min,i.max),a=1/s,l=.5*a,u=(e,n)=>g(e,t[n].x,t[n].y,r[n]*a),c=d(),h=d(),p=d(),f=d(),m=d(),y=(e,r)=>{const n=o.get(ch.computePosHash(t[r])),i=n.from,s=n.to;if(!i||!s)return;u(c,i),u(h,r),u(p,s),function(e){e[0]=0,e[1]=0,e[2]=0}(f),D(c,h)||(F(m,h,c),B(f,m)),D(p,h)||(F(m,p,h),x(f,f,B(m,m)));const a=L(f);return a>0?_(e,f,1/a):void 0};let v=Number.POSITIVE_INFINITY;this.sortSubarray(n,i.min,i.max,(e,t)=>e.featureInfo.featureIndex-t.featureInfo.featureIndex);const b=d(),w=d(),I=d(),A=d(),S=d(),P=d(),T=d(),k=d(),V=d(),E=[d(),d(),d(),d()],C=[d(),d(),d(),d()],R=[{coord:new oe(0,0),height:0},{coord:new oe(0,0),height:0}],O=(e,t)=>e>t;for(let d=i.min;d<i.max;d++){const i=n[d];if(!i.featureInfo.guardRailEnabled)continue;if(!this.prepareEdgePoints(R,t,r,i,O))continue;const[u,c]=R;if(g(b,u.coord.x,u.coord.y,a*u.height),g(w,c.coord.x,c.coord.y,a*c.height),D(b,w))continue;F(I,w,b),B(I,I);const h=y(k,i.a)||I,p=y(V,i.b)||I;g(A,h[1],-h[0],0),B(A,A),g(S,p[1],-p[0],0),B(S,S),z(k,A,h),B(P,k),z(k,S,p),B(T,k),x(E[0],b,_(k,F(k,A,P),l)),x(E[1],b,_(k,x(k,A,P),l)),x(E[2],b,_(k,P,l)),E[3]=b,x(C[0],w,_(k,F(k,S,T),l)),x(C[1],w,_(k,x(k,S,T),l)),x(C[2],w,_(k,T,l)),C[3]=w,v=this.addFeatureSection(i.featureInfo.featureIndex,v,this.bridgeFeatureSections,e);const f=e.addVertex(E[0],A,s),m=e.addVertex(E[1],A,s),L=e.addVertex(C[0],S,s),U=e.addVertex(C[1],S,s);e.addTriangle(f,m,L),e.addTriangle(m,U,L);const N=e.addVertex(E[1],P,s),j=e.addVertex(E[2],P,s),$=e.addVertex(C[1],T,s),G=e.addVertex(C[2],T,s);e.addTriangle(N,j,$),e.addTriangle(j,G,$),M(A,A),M(S,S);const X=e.addVertex(E[2],A,s),q=e.addVertex(E[3],A,s),H=e.addVertex(C[2],S,s),Z=e.addVertex(C[3],S,s);e.addTriangle(X,q,H),e.addTriangle(q,Z,H);const Y=this.isTerminalVertex(i.a,o),W=this.isTerminalVertex(i.b,o);u.height<.01&&Y&&e.addQuad(E[3],E[2],E[1],E[0],M(h,h),s),c.height<.01&&W&&e.addQuad(C[0],C[1],C[2],C[3],p,s)}this.bridgeFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}constructTunnelStructures(e,t,r,n,i,s){e.clearVertexLookup();let o=Number.POSITIVE_INFINITY;const a=(e,t)=>e.featureInfo.featureIndex-t.featureInfo.featureIndex;this.sortSubarray(n,i.min,i.max,a),this.sortSubarray(n,s.min,s.max,a);const l=e=>B(e,e),u=[{coord:new oe(0,0),height:0},{coord:new oe(0,0),height:0}],c=(e,t)=>e<t,h=d(),p=d(),f=d(),m=d(),y=d();for(let d=i.min;d<i.max;d++){if(!this.prepareEdgePoints(u,t,r,n[d],c))continue;const[i,s]=u,a=l(g(y,-(s.coord.y-i.coord.y),s.coord.x-i.coord.x,0));o=this.addFeatureSection(n[d].featureInfo.featureIndex,o,this.tunnelFeatureSections,e),e.addQuad(g(h,i.coord.x,i.coord.y,i.height),g(p,s.coord.x,s.coord.y,s.height),g(f,s.coord.x,s.coord.y,n[d].isTunnel?-.1:0),g(m,i.coord.x,i.coord.y,n[d].isTunnel?-.1:0),a)}for(let d=s.min;d<s.max;d++){const i=n[d];i.isTunnel&&([i.a,i.b]=[i.b,i.a]);const s=t[i.a],a=t[i.b],u=l(g(y,-(a.y-s.y),a.x-s.x,0));o=this.addFeatureSection(i.featureInfo.featureIndex,o,this.tunnelFeatureSections,e),e.addQuad(g(h,a.x,a.y,0),g(p,s.x,s.y,0),g(f,s.x,s.y,r[i.a]+4),g(m,a.x,a.y,r[i.b]+4),u),e.addQuad(g(h,s.x,s.y,0),g(p,a.x,a.y,0),g(f,a.x,a.y,r[i.b]+4),g(m,s.x,s.y,r[i.a]+4),u)}this.tunnelFeatureSections.push({featureIndex:Number.POSITIVE_INFINITY,vertexStart:e.getVertexCount()})}setElevatedPoint(e,t,r,n){e.coord.x=t,e.coord.y=r,e.height=n}prepareEdgePoints(e,t,r,n,i){let s=t[n.a].x,o=t[n.a].y,a=t[n.b].x,l=t[n.b].y,u=r[n.a],c=r[n.b];const h=i(u,0),p=i(c,0);if(h&&p)return this.setElevatedPoint(e[0],s,o,u),this.setElevatedPoint(e[1],a,l,c),!0;if(!h&&!p)return!1;if(h){if(!p){const e=c/(c-u);a=Bt(a,s,e),l=Bt(l,o,e),c=Bt(c,u,e)}}else{const e=u/(u-c);s=Bt(s,a,e),o=Bt(o,l,e),u=Bt(u,c,e)}return this.setElevatedPoint(e[0],s,o,u),this.setElevatedPoint(e[1],a,l,c),!0}prepareEdges(e,t){if(0===t.length)return;t.sort((e,t)=>e.hash===t.hash?t.polygonIdx-e.polygonIdx:t.hash>e.hash?1:-1);let r=0,n=0,i=0,s=t[r].polygonIdx;do{n++,(n===t.length||t[r].hash!==t[n].hash)&&((1===n-r||t[n-1].polygonIdx!==s)&&(i<r&&(t[i]=t[r],t[r]=null),t[i].type="none",i++),r=n,r!==t.length&&(s=t[r].polygonIdx))}while(r!==t.length);if(t.splice(i),0!==t.length&&0!==e.length){t.sort((e,t)=>e.portalHash<t.portalHash?1:-1);let r=0,n=0;for(;r!==t.length&&n!==e.length;){const i=t[r],s=e[n];i.portalHash>s.hash?r++:s.hash>i.portalHash?n++:(i.type=s.type,r++)}}}isOnBorder(e,t){return e<=0&&t<=0||e>=tn&&t>=tn}addFeatureSection(e,t,r,n){return e!==t&&(t=e,r.push({featureIndex:e,vertexStart:n.getVertexCount()}),n.clearVertexLookup()),t}sortSubarray(e,t,r,n){const i=e.slice(t,r);i.sort(n),e.splice(t,i.length,...i)}static computeEdgeHash(e,t){return(e.y===t.y&&e.x>t.x||e.y>t.y)&&([e,t]=[t,e]),BigInt(ch.computePosHash(e))<<32n|BigInt(ch.computePosHash(t))}static computePosHash(e){return((65535&e.x)<<16|65535&e.y)>>>0}}function hh(e,t){return e>t?1:e<t?-1:0}class ph{constructor(e=hh,t=!1){this._compare=e,this._root=null,this._size=0,this._noDuplicates=!!t}rotateLeft(e){var t=e.right;t&&(e.right=t.left,t.left&&(t.left.parent=e),t.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.left=e),e.parent=t}rotateRight(e){var t=e.left;t&&(e.left=t.right,t.right&&(t.right.parent=e),t.parent=e.parent),e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.right=e),e.parent=t}_splay(e){for(;e.parent;){var t=e.parent;t.parent?t.left===e&&t.parent.left===t?(this.rotateRight(t.parent),this.rotateRight(t)):t.right===e&&t.parent.right===t?(this.rotateLeft(t.parent),this.rotateLeft(t)):t.left===e&&t.parent.right===t?(this.rotateRight(t),this.rotateLeft(t)):(this.rotateLeft(t),this.rotateRight(t)):t.left===e?this.rotateRight(t):this.rotateLeft(t)}}splay(e){for(var t,r,n,i,s;e.parent;)(r=(t=e.parent).parent)&&r.parent?((n=r.parent).left===r?n.left=e:n.right=e,e.parent=n):(e.parent=null,this._root=e),i=e.left,s=e.right,e===t.left?(r&&(r.left===t?(t.right?(r.left=t.right,r.left.parent=r):r.left=null,t.right=r,r.parent=t):(i?(r.right=i,i.parent=r):r.right=null,e.left=r,r.parent=e)),s?(t.left=s,s.parent=t):t.left=null,e.right=t,t.parent=e):(r&&(r.right===t?(t.left?(r.right=t.left,r.right.parent=r):r.right=null,t.left=r,r.parent=t):(s?(r.left=s,s.parent=r):r.left=null,e.right=r,r.parent=e)),i?(t.right=i,i.parent=t):t.right=null,e.left=t,t.parent=e)}replace(e,t){e.parent?e===e.parent.left?e.parent.left=t:e.parent.right=t:this._root=t,t&&(t.parent=e.parent)}minNode(e=this._root){if(e)for(;e.left;)e=e.left;return e}maxNode(e=this._root){if(e)for(;e.right;)e=e.right;return e}insert(e,t){var r=this._root,n=null,i=this._compare;if(this._noDuplicates)for(;r;){if(n=r,0===i(r.key,e))return;r=i(r.key,e)<0?r.right:r.left}else for(;r;)n=r,r=i(r.key,e)<0?r.right:r.left;return r={key:e,data:t,left:null,right:null,parent:n},n?i(n.key,r.key)<0?n.right=r:n.left=r:this._root=r,this.splay(r),this._size++,r}find(e){for(var t=this._root,r=this._compare;t;){var n=r(t.key,e);if(n<0)t=t.right;else{if(!(n>0))return t;t=t.left}}return null}contains(e){for(var t=this._root,r=this._compare;t;){var n=r(e,t.key);if(0===n)return!0;t=n<0?t.left:t.right}return!1}remove(e){var t=this.find(e);if(!t)return!1;if(this.splay(t),t.left)if(t.right){var r=this.minNode(t.right);r.parent!==t&&(this.replace(r,r.right),r.right=t.right,r.right.parent=r),this.replace(t,r),r.left=t.left,r.left.parent=r}else this.replace(t,t.left);else this.replace(t,t.right);return this._size--,!0}removeNode(e){if(!e)return!1;if(this.splay(e),e.left)if(e.right){var t=this.minNode(e.right);t.parent!==e&&(this.replace(t,t.right),t.right=e.right,t.right.parent=t),this.replace(e,t),t.left=e.left,t.left.parent=t}else this.replace(e,e.left);else this.replace(e,e.right);return this._size--,!0}erase(e){var t=this.find(e);if(t){this.splay(t);var r=t.left,n=t.right,i=null;r&&(r.parent=null,i=this.maxNode(r),this.splay(i),this._root=i),n&&(r?i.right=n:this._root=n,n.parent=i),this._size--}}pop(){var e=this._root,t=null;if(e){for(;e.left;)e=e.left;t={key:e.key,data:e.data},this.remove(e.key)}return t}next(e){var t=e;if(t)if(t.right)for(t=t.right;t&&t.left;)t=t.left;else for(t=e.parent;t&&t.right===e;)e=t,t=t.parent;return t}prev(e){var t=e;if(t)if(t.left)for(t=t.left;t&&t.right;)t=t.right;else for(t=e.parent;t&&t.left===e;)e=t,t=t.parent;return t}forEach(e){for(var t=this._root,r=[],n=!1,i=0;!n;)t?(r.push(t),t=t.left):r.length>0?(e(t=r.pop(),i++),t=t.right):n=!0;return this}range(e,t,r,n){const i=[],s=this._compare;let o,a=this._root;for(;0!==i.length||a;)if(a)i.push(a),a=a.left;else{if(a=i.pop(),o=s(a.key,t),o>0)break;if(s(a.key,e)>=0&&r.call(n,a))return this;a=a.right}return this}keys(){for(var e=this._root,t=[],r=[],n=!1;!n;)e?(t.push(e),e=e.left):t.length>0?(e=t.pop(),r.push(e.key),e=e.right):n=!0;return r}values(){for(var e=this._root,t=[],r=[],n=!1;!n;)e?(t.push(e),e=e.left):t.length>0?(e=t.pop(),r.push(e.data),e=e.right):n=!0;return r}at(e){for(var t=this._root,r=[],n=!1,i=0;!n;)if(t)r.push(t),t=t.left;else if(r.length>0){if(t=r.pop(),i===e)return t;i++,t=t.right}else n=!0;return null}load(e=[],t=[],r=!1){if(0!==this._size)throw new Error("bulk-load: tree is not empty");const n=e.length;return r&&fh(e,t,0,n-1,this._compare),this._root=dh(null,e,t,0,n),this._size=n,this}min(){var e=this.minNode(this._root);return e?e.key:null}max(){var e=this.maxNode(this._root);return e?e.key:null}isEmpty(){return null===this._root}get size(){return this._size}static createTree(e,t,r,n,i){return new ph(r,i).load(e,t,n)}}function dh(e,t,r,n,i){const s=i-n;if(s>0){const o=n+Math.floor(s/2),a={key:t[o],data:r[o],parent:e};return a.left=dh(a,t,r,n,o),a.right=dh(a,t,r,o+1,i),a}return null}function fh(e,t,r,n,i){if(r>=n)return;const s=e[r+n>>1];let o=r-1,a=n+1;for(;;){do{o++}while(i(e[o],s)<0);do{a--}while(i(e[a],s)>0);if(o>=a)break;let r=e[o];e[o]=e[a],e[a]=r,r=t[o],t[o]=t[a],t[a]=r}fh(e,t,r,a,i),fh(e,t,a+1,n,i)}const mh=11102230246251565e-32,yh=134217729,gh=(3+8*mh)*mh;function xh(e,t,r,n,i){let s,o,a,l,u=t[0],c=n[0],h=0,p=0;c>u==c>-u?(s=u,u=t[++h]):(s=c,c=n[++p]);let d=0;if(h<e&&p<r)for(c>u==c>-u?(o=u+s,a=s-(o-u),u=t[++h]):(o=c+s,a=s-(o-c),c=n[++p]),s=o,0!==a&&(i[d++]=a);h<e&&p<r;)c>u==c>-u?(o=s+u,l=o-s,a=s-(o-l)+(u-l),u=t[++h]):(o=s+c,l=o-s,a=s-(o-l)+(c-l),c=n[++p]),s=o,0!==a&&(i[d++]=a);for(;h<e;)o=s+u,l=o-s,a=s-(o-l)+(u-l),u=t[++h],s=o,0!==a&&(i[d++]=a);for(;p<r;)o=s+c,l=o-s,a=s-(o-l)+(c-l),c=n[++p],s=o,0!==a&&(i[d++]=a);return 0===s&&0!==d||(i[d++]=s),d}function vh(e){return new Float64Array(e)}const bh=vh(4),wh=vh(8),_h=vh(12),Ih=vh(16),Ah=vh(4);function Sh(e,t,r){null===t?(e.inOut=!1,e.otherInOut=!0):(e.isSubject===t.isSubject?(e.inOut=!t.inOut,e.otherInOut=t.otherInOut):(e.inOut=!t.otherInOut,e.otherInOut=t.isVertical()?!t.inOut:t.inOut),t&&(e.prevInResult=!Mh(t,r)||t.isVertical()?t.prevInResult:t)),e.resultTransition=Mh(e,r)?function(e,t){let r,n=!e.inOut,i=!e.otherInOut;switch(t){case 0:r=n&&i;break;case 1:r=n||i;break;case 3:r=n!==i;break;case 2:r=e.isSubject?n&&!i:i&&!n}return r?1:-1}(e,r):0}function Mh(e,t){switch(e.type){case 0:switch(t){case 0:return!e.otherInOut;case 1:return e.otherInOut;case 2:return e.isSubject&&e.otherInOut||!e.isSubject&&!e.otherInOut;case 3:return!0}break;case 2:return 0===t||1===t;case 3:return 2===t;case 1:return!1}return!1}class Bh{constructor(e,t,r,n,i){this.left=t,this.point=e,this.otherEvent=r,this.isSubject=n??!1,this.type=i||0,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0}isBelow(e){const t=this.point,r=this.otherEvent.point;return this.left?(t[0]-e[0])*(r[1]-e[1])-(r[0]-e[0])*(t[1]-e[1])>0:(r[0]-e[0])*(t[1]-e[1])-(t[0]-e[0])*(r[1]-e[1])>0}isAbove(e){return!this.isBelow(e)}isVertical(){return this.point[0]===this.otherEvent.point[0]}get inResult(){return 0!==this.resultTransition}clone(){const e=new Bh(this.point,this.left,this.otherEvent,this.isSubject,this.type);return e.contourId=this.contourId,e.resultTransition=this.resultTransition,e.prevInResult=this.prevInResult,e.isExteriorRing=this.isExteriorRing,e.inOut=this.inOut,e.otherInOut=this.otherInOut,e}}function Ph(e,t){return e[0]===t[0]&&e[1]===t[1]}function zh(e,t,r){const n=function(e,t,r,n,i,s){const o=(t-s)*(r-i),a=(e-i)*(n-s),l=o-a;if(0===o||0===a||o>0!=a>0)return l;const u=Math.abs(o+a);return Math.abs(l)>=33306690738754716e-32*u?l:-function(e,t,r,n,i,s,o){let a,l,u,c,h,p,d,f,m,y,g,x,v,b,w,_,I,A;const S=e-i,M=r-i,B=t-s,P=n-s;b=S*P,p=yh*S,d=p-(p-S),f=S-d,p=yh*P,m=p-(p-P),y=P-m,w=f*y-(b-d*m-f*m-d*y),_=B*M,p=yh*B,d=p-(p-B),f=B-d,p=yh*M,m=p-(p-M),y=M-m,I=f*y-(_-d*m-f*m-d*y),g=w-I,h=w-g,bh[0]=w-(g+h)+(h-I),x=b+g,h=x-b,v=b-(x-h)+(g-h),g=v-_,h=v-g,bh[1]=v-(g+h)+(h-_),A=x+g,h=A-x,bh[2]=x-(A-h)+(g-h),bh[3]=A;let z=function(e,t){let r=t[0];for(let n=1;n<4;n++)r+=t[n];return r}(0,bh),T=22204460492503146e-32*o;if(z>=T||-z>=T)return z;if(h=e-S,a=e-(S+h)+(h-i),h=r-M,u=r-(M+h)+(h-i),h=t-B,l=t-(B+h)+(h-s),h=n-P,c=n-(P+h)+(h-s),0===a&&0===l&&0===u&&0===c)return z;if(T=11093356479670487e-47*o+gh*Math.abs(z),z+=S*c+P*a-(B*u+M*l),z>=T||-z>=T)return z;b=a*P,p=yh*a,d=p-(p-a),f=a-d,p=yh*P,m=p-(p-P),y=P-m,w=f*y-(b-d*m-f*m-d*y),_=l*M,p=yh*l,d=p-(p-l),f=l-d,p=yh*M,m=p-(p-M),y=M-m,I=f*y-(_-d*m-f*m-d*y),g=w-I,h=w-g,Ah[0]=w-(g+h)+(h-I),x=b+g,h=x-b,v=b-(x-h)+(g-h),g=v-_,h=v-g,Ah[1]=v-(g+h)+(h-_),A=x+g,h=A-x,Ah[2]=x-(A-h)+(g-h),Ah[3]=A;const k=xh(4,bh,4,Ah,wh);b=S*c,p=yh*S,d=p-(p-S),f=S-d,p=yh*c,m=p-(p-c),y=c-m,w=f*y-(b-d*m-f*m-d*y),_=B*u,p=yh*B,d=p-(p-B),f=B-d,p=yh*u,m=p-(p-u),y=u-m,I=f*y-(_-d*m-f*m-d*y),g=w-I,h=w-g,Ah[0]=w-(g+h)+(h-I),x=b+g,h=x-b,v=b-(x-h)+(g-h),g=v-_,h=v-g,Ah[1]=v-(g+h)+(h-_),A=x+g,h=A-x,Ah[2]=x-(A-h)+(g-h),Ah[3]=A;const V=xh(k,wh,4,Ah,_h);b=a*c,p=yh*a,d=p-(p-a),f=a-d,p=yh*c,m=p-(p-c),y=c-m,w=f*y-(b-d*m-f*m-d*y),_=l*u,p=yh*l,d=p-(p-l),f=l-d,p=yh*u,m=p-(p-u),y=u-m,I=f*y-(_-d*m-f*m-d*y),g=w-I,h=w-g,Ah[0]=w-(g+h)+(h-I),x=b+g,h=x-b,v=b-(x-h)+(g-h),g=v-_,h=v-g,Ah[1]=v-(g+h)+(h-_),A=x+g,h=A-x,Ah[2]=x-(A-h)+(g-h),Ah[3]=A;const E=xh(V,_h,4,Ah,Ih);return Ih[E-1]}(e,t,r,n,i,s,u)}(e[0],e[1],t[0],t[1],r[0],r[1]);return n>0?-1:n<0?1:0}function Th(e,t){const r=e.point,n=t.point;return r[0]>n[0]?1:r[0]<n[0]?-1:r[1]!==n[1]?r[1]>n[1]?1:-1:(s=t,o=r,(i=e).left!==s.left?i.left?1:-1:0!==zh(o,i.otherEvent.point,s.otherEvent.point)?i.isBelow(s.otherEvent.point)?-1:1:!i.isSubject&&s.isSubject?1:-1);var i,s,o}function kh(e,t,r){const n=new Bh(t,!1,e,e.isSubject),i=new Bh(t,!0,e.otherEvent,e.isSubject);return Ph(e.point,e.otherEvent.point),n.contourId=i.contourId=e.contourId,Th(i,e.otherEvent)>0&&(e.otherEvent.left=!0,i.left=!1),e.otherEvent.otherEvent=i,e.otherEvent=n,r.push(i),r.push(n),r}function Vh(e,t){return e[0]*t[1]-e[1]*t[0]}function Eh(e,t){return e[0]*t[0]+e[1]*t[1]}function Dh(e,t,r){const n=function(e,t,r,n){const i=[t[0]-e[0],t[1]-e[1]],s=[n[0]-r[0],n[1]-r[1]];function o(e,t,r){return[e[0]+t*r[0],e[1]+t*r[1]]}const a=[r[0]-e[0],r[1]-e[1]];let l=Vh(i,s),u=l*l;const c=Eh(i,i);if(u>0){const t=Vh(a,s)/l;if(t<0||t>1)return null;const n=Vh(a,i)/l;return n<0||n>1?null:0===t||1===t?[o(e,t,i)]:0===n||1===n?[o(r,n,s)]:[o(e,t,i)]}if(l=Vh(a,i),u=l*l,u>0)return null;const h=Eh(i,a)/c,p=h+Eh(i,s)/c,d=Math.min(h,p),f=Math.max(h,p);return d<=1&&f>=0?1===d?[o(e,d>0?d:0,i)]:0===f?[o(e,f<1?f:1,i)]:[o(e,d>0?d:0,i),o(e,f<1?f:1,i)]:null}(e.point,e.otherEvent.point,t.point,t.otherEvent.point),i=n?n.length:0;if(0===i||1===i&&(Ph(e.point,t.point)||Ph(e.otherEvent.point,t.otherEvent.point))||2===i&&e.isSubject===t.isSubject)return 0;if(1===i)return!Ph(e.point,n[0])&&!Ph(e.otherEvent.point,n[0])&&kh(e,n[0],r),!Ph(t.point,n[0])&&!Ph(t.otherEvent.point,n[0])&&kh(t,n[0],r),1;const s=[];let o=!1,a=!1;return Ph(e.point,t.point)?o=!0:1===Th(e,t)?s.push(t,e):s.push(e,t),Ph(e.otherEvent.point,t.otherEvent.point)?a=!0:1===Th(e.otherEvent,t.otherEvent)?s.push(t.otherEvent,e.otherEvent):s.push(e.otherEvent,t.otherEvent),o&&a||o?(t.type=1,e.type=t.inOut===e.inOut?2:3,o&&!a&&kh(s[1].otherEvent,s[0].point,r),2):a?(kh(s[0],s[1].point,r),3):s[0]!==s[3].otherEvent?(kh(s[0],s[1].point,r),kh(s[1],s[2].point,r),3):(kh(s[0],s[1].point,r),kh(s[3].otherEvent,s[2].point,r),3)}function Ch(e,t){if(e===t)return 0;if(0!==zh(e.point,e.otherEvent.point,t.point)||0!==zh(e.point,e.otherEvent.point,t.otherEvent.point))return Ph(e.point,t.point)?e.isBelow(t.otherEvent.point)?-1:1:e.point[0]===t.point[0]?e.point[1]<t.point[1]?-1:1:1===Th(e,t)?t.isAbove(e.point)?-1:1:e.isBelow(t.point)?-1:1;if(e.isSubject!==t.isSubject)return e.isSubject?-1:1;{let r=e.point,n=t.point;if(r[0]===n[0]&&r[1]===n[1])return r=e.otherEvent.point,n=t.otherEvent.point,r[0]===n[0]&&r[1]===n[1]?0:(e.contourId??0)>(t.contourId??0)?1:-1}return 1===Th(e,t)?1:-1}class Fh{constructor(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null}isExterior(){return null==this.holeOf}}function Lh(e,t,r,n){let i,s=e+1,o=t[e].point;const a=t.length;for(s<a&&(i=t[s].point);s<a&&i[0]===o[0]&&i[1]===o[1];){if(!r[s])return s;s++,s<a&&(i=t[s].point)}for(s=e-1;r[s]&&s>n;)s--;return s}function Rh(e,t,r){const n=new Fh;if(null!=e.prevInResult){const i=e.prevInResult,s=i.outputContourId;if(i.resultTransition>0){const e=t[s];if(null!=e.holeOf){const i=e.holeOf;t[i].holeIds.push(r),n.holeOf=i,n.depth=t[s].depth}else t[s].holeIds.push(r),n.holeOf=s,n.depth=t[s].depth+1}else n.holeOf=null,n.depth=t[s].depth}else n.holeOf=null,n.depth=0;return n}const Oh=Math.max,Uh=Math.min;let Nh=0;function jh(e,t,r,n,i,s){let o,a,l,u,c,h;for(o=0,a=e.length-1;o<a;o++){if(l=e[o],u=e[o+1],c=new Bh(l,!1,void 0,t),h=new Bh(u,!1,c,t),c.otherEvent=h,l[0]===u[0]&&l[1]===u[1])continue;c.contourId=h.contourId=r,s||(c.isExteriorRing=!1,h.isExteriorRing=!1),Th(c,h)>0?h.left=!0:c.left=!0;const a=l[0],p=l[1];i[0]=Uh(i[0],a),i[1]=Uh(i[1],p),i[2]=Oh(i[2],a),i[3]=Oh(i[3],p),n.push(c),n.push(h)}}const $h=[];function Gh(e,t,r){let n=e,i=t;"number"==typeof e[0][0][0]&&(n=[e]),"number"==typeof t[0][0][0]&&(i=[t]);let s=function(e,t,r){let n=null;return e.length*t.length===0&&(0===r?n=$h:2===r?n=e:(1===r||3===r)&&(n=0===e.length?t:e)),n}(n,i,r);if(s)return s===$h?null:s;const o=[1/0,1/0,-1/0,-1/0],a=[1/0,1/0,-1/0,-1/0],l=function(e,t,r,n,i){const s=new en(void 0,Th);let o,a,l,u,c,h;for(l=0,u=e.length;l<u;l++)for(o=e[l],c=0,h=o.length;c<h;c++)a=0===c,a&&Nh++,jh(o[c],!0,Nh,s,r,a);for(l=0,u=t.length;l<u;l++)for(o=t[l],c=0,h=o.length;c<h;c++)a=0===c,2===i&&(a=!1),a&&Nh++,jh(o[c],!1,Nh,s,n,a);return s}(n,i,o,a,r);if(s=function(e,t,r,n,i){let s=null;return(r[0]>n[2]||n[0]>r[2]||r[1]>n[3]||n[1]>r[3])&&(0===i?s=$h:2===i?s=e:(1===i||3===i)&&(s=e.concat(t))),s}(n,i,o,a,r),s)return s===$h?null:s;const u=function(e){let t,r;const n=function(e){let t,r,n,i,s;const o=[];for(r=0,n=e.length;r<n;r++)t=e[r],(t.left&&t.inResult||!t.left&&t.otherEvent.inResult)&&o.push(t);let a=!1;for(;!a;)for(a=!0,r=0,n=o.length;r<n;r++)r+1<n&&1===Th(o[r],o[r+1])&&(i=o[r],o[r]=o[r+1],o[r+1]=i,a=!1);for(r=0,n=o.length;r<n;r++)t=o[r],t.otherPos=r;for(r=0,n=o.length;r<n;r++)t=o[r],t.left||(s=t.otherPos,t.otherPos=t.otherEvent.otherPos,t.otherEvent.otherPos=s);return o}(e),i={},s=[];for(t=0,r=n.length;t<r;t++){if(i[t])continue;const e=s.length,r=Rh(n[t],s,e),o=t=>{i[t]=!0,t<n.length&&n[t]&&(n[t].outputContourId=e)};let a=t,l=t;for(r.points.push(n[t].point);o(a),a=n[a].otherPos,o(a),r.points.push(n[a].point),a=Lh(a,n,i,l),!(a==l||a>=n.length)&&n[a];);s.push(r)}return s}(function(e,t,r,n,i,s){const o=new ph(Ch),a=[],l=Math.min(n[2],i[2]);let u,c,h;for(;0!==e.length;){let t=e.pop();if(a.push(t),0===s&&t.point[0]>l||2===s&&t.point[0]>n[2])break;if(t.left){c=u=o.insert(t),h=o.minNode(),u=u!==h?o.prev(u):null,c=o.next(c);const r=u?u.key:null;let n;if(Sh(t,r,s),c&&2===Dh(t,c.key,e)&&(Sh(t,r,s),Sh(c.key,t,s)),u&&2===Dh(u.key,t,e)){let e=u;e=e!==h?o.prev(e):null,n=e?e.key:null,Sh(r,n,s),Sh(t,r,s)}}else t=t.otherEvent,c=u=o.find(t),u&&c&&(u=u!==h?o.prev(u):null,c=o.next(c),o.remove(t),c&&u&&Dh(u.key,c.key,e))}return a}(l,0,0,o,a,r)),c=[];for(let h=0;h<u.length;h++){let e=u[h];if(e.isExterior()){let t=[e.points];for(let r=0;r<e.holeIds.length;r++)t.push(u[e.holeIds[r]].points);c.push(t)}}return c}function Xh(e,t,r,n){const i=[],s=0===n?(e,t,r,n,i,s)=>{e.push(new oe(s,r+(s-t)/(n-t)*(i-r)))}:(e,t,r,n,i,s)=>{e.push(new oe(t+(s-r)/(i-r)*(n-t),s))};for(const o of e){const e=[];for(const i of o){if(i.length<=2)continue;const o=[];for(let e=0;e<i.length-1;e++){const a=i[e].x,l=i[e].y,u=i[e+1].x,c=i[e+1].y,h=0===n?a:l,p=0===n?u:c;h<t?p>t&&s(o,a,l,u,c,t):h>r?p<r&&s(o,a,l,u,c,r):o.push(i[e]),p<t&&h>=t&&s(o,a,l,u,c,t),p>r&&h<=r&&s(o,a,l,u,c,r)}let a=i.at(-1);const l=0===n?a.x:a.y;l>=t&&l<=r&&o.push(a),o.length&&(a=o.at(-1),o[0].x===a.x&&o[0].y===a.y||o.push(o[0]),e.push(o))}e.length&&i.push(e)}return i}function qh(e,t){const r=Gh(Zh(e),Zh([t]),0);return null==r?[]:Yh(r)}function Hh(e,t,r=0){const n=65536;let i=Zh(e,n);const s=[];for(;t.valid();t.next()){const[e,i]=t.get();let o=e.x*n,a=e.y*n,l=i.x*n,u=i.y*n;const c=l-o,h=u-a,p=Math.hypot(c,h);if(0===p)continue;o-=c*r,a-=h*r,l+=c*r,u+=h*r;const d=Math.trunc(h/p*3),f=-Math.trunc(c/p*3);s.push([[[o,a],[l,u],[l+d,u+f],[o+d,a+f],[o,a]]])}return s.length>0&&(i=Gh(i,s,2)),Yh(i,1/n,128)}function Zh(e,t=1){return[e.map(e=>e.map(e=>[e.x*t,e.y*t]))]}function Yh(e,t=1,r){return e.map(e=>e.map((e,n)=>{const i=e.map(e=>{let n=e[0],i=e[1];return r&&(n=Math.round(n/r)*r,i=Math.round(i/r)*r),new oe(n*t,i*t)._round()});return n>0&&i.reverse(),i}))}class Wh{constructor(e,t){this.layoutVertexArray=new Qo,this.indexArray=new wa,this.lineIndexArray=new ya,this.triangleSegments=new Ka,this.lineSegments=new Ka,this.programConfigurations=new vl(e.layers,{zoom:e.zoom,lut:e.lut}),this.uploaded=!1,t&&(this.elevatedLayoutVertexArray=new ra)}update(e,t,r,n,i,s,o,a){this.programConfigurations.updatePaintArrays(e,t,i,r,n,s,o,a)}isEmpty(){return 0===this.layoutVertexArray.length}needsUpload(){return this.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Bc.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.lineIndexBuffer=e.createIndexBuffer(this.lineIndexArray),this.elevatedLayoutVertexArray&&this.elevatedLayoutVertexArray.length>0&&(this.elevatedLayoutVertexBuffer=e.createVertexBuffer(this.elevatedLayoutVertexArray,Pc.members))),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(e,t,r,n,i,s,o){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,t,r,n,i,s,void 0,o)}}class Jh{constructor(e){this.zoom=e.zoom,this.pixelRatio=e.pixelRatio,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=e.lut,this.bufferData=new Wh(e,!1),this.elevationBufferData=new Wh(e,!0),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.projection=e.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=e.sourceLayerIndex,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,r,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,r,n){this.hasPattern=oh("fill",this.layers,this.pixelRatio,t);const i=this.layers[0].layout.get("fill-sort-key"),s=[];for(const{feature:o,id:a,index:l,sourceLayerIndex:u}of e){const e=this.layers[0]._featureFilter.needGeometry,c=Ql(o,e);if(!this.layers[0]._featureFilter.filter(new lo(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),c,r))continue;const h=i?i.evaluate(c,{},r,t.availableImages):void 0,p={id:a,properties:o.properties,type:o.type,sourceLayerIndex:u,index:l,geometry:e?c.geometry:Kl(o,r,n),patterns:{},sortKey:h};s.push(p)}i&&s.sort((e,t)=>e.sortKey-t.sortKey);for(const o of s){const{geometry:n,index:i,sourceLayerIndex:s}=o;if(this.hasPattern){const e=ah("fill",this.layers,o,this.zoom,this.pixelRatio,t);this.patternFeatures.push(e)}else this.addFeature(o,n,i,r,{},t.availableImages,t.brightness,t.elevationFeatures);t.featureIndex.insert(e[i].feature,n,i,s,this.index)}}update(e,t,r,n,i,s,o){this.bufferData.update(e,t,r,n,i,s,o,this.worldview),this.elevationBufferData.update(e,t,r,n,i,s,o,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(e,t,r,n,i,s,o,this.worldview)}updateExpressions(e){this.bufferData.programConfigurations.updateExpressions(e),this.elevationBufferData.programConfigurations.updateExpressions(e),this.elevatedStructures&&(this.elevatedStructures.bridgeProgramConfigurations.updateExpressions(e),this.elevatedStructures.tunnelProgramConfigurations.updateExpressions(e))}addFeatures(e,t,r,n,i,s){for(const o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,t,r,n,s,e.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(e){this.bufferData.upload(e),this.elevationBufferData.upload(e),this.elevatedStructures&&this.elevatedStructures.upload(e)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(e,t,r,n,i,s=[],o,a){const l=nh(t,500);"none"!==this.elevationMode?this.addElevatedRoadFeature(e,l,n,r,a):this.addGeometry(l,this.bufferData),this.bufferData.populatePaintArrays(e,r,i,s,n,o,this.worldview),this.elevationBufferData.populatePaintArrays(e,r,i,s,n,o,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}setEvaluatedPortalGraph(e,t,r,n,i){this.elevatedStructures&&(this.elevatedStructures.construct(e),this.elevatedStructures.populatePaintArrays(t,r,n,i,this.worldview))}addElevatedRoadFeature(e,t,r,n,i){const s=new Array,o=Au.getElevationFeature(e,i);if(!o)return void this.addGeometry(t,this.bufferData);{const e=this.clipPolygonsToTile(t,1);e.length>0&&s.push({polygons:e,elevationFeature:o,elevationTileID:r})}const a={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(e,{},r),featureIndex:n};for(const l of s)if(l.elevationFeature){if("hd-road-base"===this.elevationMode){this.elevatedStructures||(this.elevatedStructures=new ch(l.elevationTileID,this.layers,this.zoom,this.lut));const t=l.elevationFeature.isTunnel();let r=0;Object.hasOwn(e.properties,lu)&&(r=+e.properties[lu]),this.elevatedStructures.addPortalCandidates(l.elevationFeature.id,l.polygons,t,l.elevationFeature,r)}null==l.elevationFeature.constantHeight&&(l.polygons=this.prepareElevatedPolygons(l.polygons,l.elevationFeature,l.elevationTileID));const t=new Su(r,l.elevationTileID);this.addElevatedGeometry(l.polygons,t,l.elevationFeature,"hd-road-base"===this.elevationMode?0:.05,n,a)}}addElevatedGeometry(e,t,r,n,i,s){const o={elevation:r,elevationSampler:t,bias:n,index:i,featureInfo:s},[a,l]=this.addGeometry(e,this.elevationBufferData,o);null==this.elevationBufferData.heightRange?this.elevationBufferData.heightRange={min:a,max:l}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,a),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,l))}addGeometry(e,t,r){let n=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY,s=null;r&&(s=r.elevationSampler.constantElevation(r.elevation,r.bias),null!=s&&(n=s,i=s));const o=(e,o,a)=>{if(null!=r)if(o.push(e),null!=s)t.elevatedLayoutVertexArray.emplaceBack(s),a.push(s);else{const s=r.elevationSampler.pointElevation(e,r.elevation,r.bias);t.elevatedLayoutVertexArray.emplaceBack(s),a.push(s),n=Math.min(n,s),i=Math.max(i,s)}};for(const a of e){let e=0;for(const t of a)e+=t.length;const n=t.triangleSegments.prepareSegment(e,t.layoutVertexArray,t.indexArray),i=n.vertexLength,s=[],l=[],u=[],c=[],h=[],p=t.layoutVertexArray.length;for(const f of a){if(0===f.length)continue;f!==a[0]&&l.push(s.length/2);const e=t.lineSegments.prepareSegment(f.length,t.layoutVertexArray,t.lineIndexArray),n=e.vertexLength;r&&h.push(t.layoutVertexArray.length-p),o(f[0],u,c),t.layoutVertexArray.emplaceBack(f[0].x,f[0].y),t.lineIndexArray.emplaceBack(n+f.length-1,n),s.push(f[0].x),s.push(f[0].y);for(let r=1;r<f.length;r++)o(f[r],u,c),t.layoutVertexArray.emplaceBack(f[r].x,f[r].y),t.lineIndexArray.emplaceBack(n+r-1,n+r),s.push(f[r].x),s.push(f[r].y);e.vertexLength+=f.length,e.primitiveLength+=f.length}const d=kc(s,l);for(let r=0;r<d.length;r+=3)t.indexArray.emplaceBack(i+d[r],i+d[r+1],i+d[r+2]);if(d.length>0&&r&&"hd-road-base"===this.elevationMode){const e=r.elevation.isTunnel(),t=r.elevation.safeArea,n=this.elevatedStructures.addVertices(u,c);this.elevatedStructures.addTriangles(d,n,e);const i=h.length;if(i>0){for(let s=0;s<i-1;s++)this.elevatedStructures.addRenderableRing(r.index,h[s]+n,h[s+1]-h[s],e,t,r.featureInfo);this.elevatedStructures.addRenderableRing(r.index,h[i-1]+n,u.length-h[i-1],e,t,r.featureInfo)}}n.vertexLength+=e,n.primitiveLength+=d.length/3}return[n,i]}prepareElevatedPolygons(e,t,r){const n=1/$l(r),i=[];for(const s of e){const e=Hh(s,new _u(t,n),.1);i.push(...e)}return i}clipPolygonsToTile(e,t){const r=-t,n=-t,i=tn+t,s=tn+t;let o=0;const a=[],l=[];for(;o<e.length;o++){const t=e[o],u=Er(t);(u.min.x>=r&&u.max.x<=i&&u.min.y>=n&&u.max.y<=s?a:l).push(t)}if(a.length===e.length)return e;const u=[new oe(r,n),new oe(i,n),new oe(i,s),new oe(r,s),new oe(r,n)],c=a;for(const h of l)c.push(...qh(h,u));return c}}let Kh,Qh,ep,tp;ps(Jh,"FillBucket",{omit:["layers","patternFeatures"]}),ps(Wh,"FillBufferData"),ps(ch,"ElevatedStructures");class rp{constructor(e,t,r,n){if(this.triangleCount=t.length/3,this.min=new oe(0,0),this.max=new oe(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],0===this.triangleCount||0===e.length)return;const[i,s]=[e[0].clone(),e[0].clone()];for(let c=1;c<e.length;++c){const t=e[c];i.x=Math.min(i.x,t.x),i.y=Math.min(i.y,t.y),s.x=Math.max(s.x,t.x),s.y=Math.max(s.y,t.y)}if(n){const e=Math.ceil(Math.max(s.x-i.x,s.y-i.y)/n);r=Math.max(r,e)}if(0===r)return;this.min=i,this.max=s;const o=this.max.sub(this.min);o.x=Math.max(o.x,1),o.y=Math.max(o.y,1);const a=Math.max(o.x,o.y)/r;this.cellsX=Math.max(1,Math.ceil(o.x/a)),this.cellsY=Math.max(1,Math.ceil(o.y/a)),this.xScale=1/a,this.yScale=1/a;const l=[];for(let c=0;c<this.triangleCount;c++){const r=e[t[3*c+0]].sub(this.min),n=e[t[3*c+1]].sub(this.min),i=e[t[3*c+2]].sub(this.min),s=np(Math.floor(Math.min(r.x,n.x,i.x)),this.xScale,this.cellsX),o=np(Math.floor(Math.max(r.x,n.x,i.x)),this.xScale,this.cellsX),u=np(Math.floor(Math.min(r.y,n.y,i.y)),this.yScale,this.cellsY),h=np(Math.floor(Math.max(r.y,n.y,i.y)),this.yScale,this.cellsY),p=new oe(0,0),d=new oe(0,0),f=new oe(0,0),m=new oe(0,0);for(let e=u;e<=h;++e){p.y=d.y=e*a,f.y=m.y=(e+1)*a;for(let t=s;t<=o;++t)p.x=f.x=t*a,d.x=m.x=(t+1)*a,(ju(r,n,i,p,d,m)||ju(r,n,i,p,m,f))&&l.push({cellIdx:e*this.cellsX+t,triIdx:c})}}if(0===l.length)return;l.sort((e,t)=>e.cellIdx-t.cellIdx||e.triIdx-t.triIdx);let u=0;for(;u<l.length;){const e=l[u].cellIdx,t={start:this.payload.length,len:0};for(;u<l.length&&l[u].cellIdx===e;)++t.len,this.payload.push(l[u++].triIdx);this.cells[e]=t}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(e,t){if(0===this.triangleCount||0===this.cells.length)return;if(e.x>this.max.x||this.min.x>e.x||e.y>this.max.y||this.min.y>e.y)return;const r=np(e.x-this.min.x,this.xScale,this.cellsX),n=np(e.y-this.min.y,this.yScale,this.cellsY),i=this.cells[n*this.cellsX+r];if(i){this._lazyInitLookup();for(let e=0;e<i.len;e++){const r=this.payload[i.start+e],n=Math.floor(r/8),s=1<<r%8;if(!(this.lookup[n]&s)&&(this.lookup[n]|=s,t.push(r),t.length===this.triangleCount))return}}}query(e,t,r){if(0===this.triangleCount||0===this.cells.length)return;if(e.x>this.max.x||this.min.x>t.x)return;if(e.y>this.max.y||this.min.y>t.y)return;this._lazyInitLookup();const n=np(e.x-this.min.x,this.xScale,this.cellsX),i=np(t.x-this.min.x,this.xScale,this.cellsX),s=np(e.y-this.min.y,this.yScale,this.cellsY),o=np(t.y-this.min.y,this.yScale,this.cellsY);for(let a=s;a<=o;a++)for(let e=n;e<=i;e++){const t=this.cells[a*this.cellsX+e];if(t)for(let e=0;e<t.len;e++){const n=this.payload[t.start+e],i=Math.floor(n/8),s=1<<n%8;if(!(this.lookup[i]&s)&&(this.lookup[i]|=s,r.push(n),r.length===this.triangleCount))return}}}}function np(e,t,r){return Math.max(0,Math.min(r-1,Math.floor(e*t)))}ps(rp,"TriangleGridIndex");class ip{constructor(e){this.zoom=e.zoom,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.footprints=[],this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){for(const r of this.footprints)t.push({footprint:r,id:e})}updateAppearances(e,t,r,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,r,n){const i=[];for(const{feature:s,id:o,index:a,sourceLayerIndex:l}of e){const e=this.layers[0]._featureFilter.needGeometry,u=Ql(s,e);if(!this.layers[0]._featureFilter.filter(new lo(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),u,r))continue;const c={id:o,properties:s.properties,type:s.type,sourceLayerIndex:l,index:a,geometry:e?u.geometry:Kl(s,r,n),patterns:{}};i.push(c)}for(const s of i){const{geometry:n,index:i,sourceLayerIndex:o}=s;this.addFeature(s,n,i,r,{},t.availableImages,t.brightness),t.featureIndex.insert(e[i].feature,n,i,o,this.index)}}isEmpty(){return 0===this.footprints.length}uploadPending(){return!1}upload(e){}update(e,t,r,n,i,s,o){}destroy(){}addFeature(e,t,r,n,i,s=[],o){for(const a of nh(t,2)){const e=[],t=[],r=[],n=new oe(1/0,1/0),i=new oe(-1/0,-1/0);for(const l of a)if(0!==l.length){l!==a[0]&&r.push(t.length/2);for(let r=0;r<l.length;r++)t.push(l[r].x),t.push(l[r].y),e.push(l[r]),n.x=Math.min(n.x,l[r].x),n.y=Math.min(n.y,l[r].y),i.x=Math.max(i.x,l[r].x),i.y=Math.max(i.y,l[r].y)}const s=kc(t,r),o=new rp(e,s,8,256);this.footprints.push({vertices:e,indices:s,grid:o,min:n,max:i})}}}ps(ip,"ClipBucket",{omit:["layers"]});const sp=Jo([{name:"a_pos_normal_ed",components:4,type:"Int16"}]),op=Jo([{name:"a_pos_end",components:4,type:"Int16"},{name:"a_angular_offset_factor",components:1,type:"Int16"}]),ap=Jo([{name:"a_flood_light_ground_radius",components:1,type:"Float32"}]),lp=Jo([{name:"a_centroid_pos",components:2,type:"Uint16"}]),up=Jo([{name:"a_join_normal_inside",components:3,type:"Int16"}]),cp=Jo([{name:"a_hidden_by_landmark",components:1,type:"Uint8"}]),hp=Jo([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]),{members:pp}=sp,dp=Number.MAX_SAFE_INTEGER;function fp(e,t,r,n){return e.order<t||e.order===dp||!(e.clipMask&r)||function(e,t){if(0===t.length)return!1;let r=e;for(;""!==r;){if(t.includes(r))return!1;r=Ro(r)}return!0}(n,e.clipScope)}function mp(e,t){return e.x-t.x||e.y-t.y}function yp(e,t){return 0===mp(e.min,t.min)&&0===mp(e.max,t.max)}function gp(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r].sourceId!==t[r].sourceId||!yp(e[r],t[r])||e[r].order!==t[r].order||e[r].clipMask!==t[r].clipMask||!ae(e[r].clipScope,t[r].clipScope))return!1;return!0}function xp(e,t,r,n,i,s,o){const a=e.indices,l=e.vertices,u=[];for(let c=n;c<n+i;c+=3){const n=t[r[c+0]+s],i=t[r[c+1]+s],h=t[r[c+2]+s],p=Math.min(n.x,i.x,h.x),d=Math.max(n.x,i.x,h.x),f=Math.min(n.y,i.y,h.y),m=Math.max(n.y,i.y,h.y);u.length=0,e.grid.query(new oe(p,f),new oe(d,m),u);for(let e=0;e<u.length;e++){const t=u[e];if(ju(l[a[3*t+0]],l[a[3*t+1]],l[a[3*t+2]],n,i,h,o))return!0}}return!1}function vp(e,t,r,n){const i=Math.pow(2,n.z-r.z);return new oe((e+r.x*tn)*i-n.x*tn,(t+r.y*tn)*i-n.y*tn)}function bp(e,t){const r=[];t.grid.queryPoint(e,r);const n=t.indices,i=t.vertices;for(let s=0;s<r.length;s++){const t=r[s];if(Ou([i[n[3*t+0]],i[n[3*t+1]],i[n[3*t+2]]],e))return!0}return!1}const wp=0,_p=1,Ip=[new oe(0,0),new oe(tn,0),new oe(tn,tn),new oe(0,tn)];function Ap(e,t){const r=[];let n=[];if(!t||e.length<2)return[e];if(2===e.length)return Uu(e[0],e[1],Ip)?[e]:[];for(let i=0;i<e.length+2;i++){const t=0===i?e.at(-1):e[(i-1)%e.length],s=e[i%e.length],o=e[(i+1)%e.length],a=Uu(t,s,Ip),l=Uu(s,o,Ip),u=a||l;u&&n.push(s),u&&l||n.length>0&&(n.length>1&&r.push(n),n=[])}return n.length>1&&r.push(n),r}const Sp=eu.types,Mp=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],Bp=["fill-extrusion-flood-light-ground-radius"],Pp=Math.pow(2,13),zp=Math.pow(2,15)-1,Tp=new oe(0,1),kp=2147483648,Vp=1073741824;function Ep(e,t,r,n,i,s,o,a){e.emplaceBack((t<<1)+o,(r<<1)+s,(Math.floor(n*Pp)<<1)+i,Math.round(a))}function Dp(e,t,r){e.emplaceBack(t.x*tn,t.y*tn,r?1:0)}function Cp(e,t,r,n,i,s){e.emplaceBack(t.x,t.y,(r.x<<1)+n,(r.y<<1)+i,s)}function Fp(e,t,r){const n=16384;e.emplaceBack(t.x,t.y,t.z,r[0]*n,r[1]*n,r[2]*n)}class Lp{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class Rp{constructor(){this.data=[]}get length(){return this.data.length}push(e){this.data.push(e)}get(e){return this.data[e]}static serialize(e,t){const r=e.data.length,n=new Uint32Array(4*r),i=[];i.length=r;for(let s=0;s<r;s++){const t=e.data[s],r=4*s;n[r]=t.vertexOffset,n[r+1]=t.vertexCount,n[r+2]=t.indexOffset,n[r+3]=t.indexCount,i[s]=t.ringIndices}return t&&t.add(n.buffer),{scalars:n,rings:i}}static deserialize(e){const{scalars:t,rings:r}=e,n=t.length/4,i=new Rp,s=[];s.length=n,i.data=s;for(let o=0;o<n;o++){const e=4*o,n=new Lp;n.vertexOffset=t[e],n.vertexCount=t[e+1],n.indexOffset=t[e+2],n.indexCount=t[e+3],n.ringIndices=r[o],i.data[o]=n}return i}}class Op{constructor(){this.centroidXY=new oe(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new oe(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new oe(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0,this.groupCentroidPos=new oe(0,0)}span(){return new oe(this.max.x-this.min.x,this.max.y-this.min.y)}}class Up{constructor(){this.data=[],this.buffer=null}get length(){return this.data.length}push(e){this.data.push(e)}get(e){return this.data[e]}find(e){return this.data.find(e)}[Symbol.iterator](){return this.data[Symbol.iterator]()}static serialize(e,t){const r=e.data.length,n=new Float64Array(15*r);for(let i=0;i<r;i++){const t=e.data[i],r=15*i;n[r]=t.centroidXY.x,n[r+1]=t.centroidXY.y,n[r+2]=t.min.x,n[r+3]=t.min.y,n[r+4]=t.max.x,n[r+5]=t.max.y,n[r+6]=t.groupCentroidPos.x,n[r+7]=t.groupCentroidPos.y,n[r+8]=t.vertexArrayOffset,n[r+9]=t.vertexCount,n[r+10]=t.groundVertexArrayOffset,n[r+11]=t.groundVertexCount,n[r+12]=t.footprintSegLen,n[r+13]=t.height,n[r+14]=t.buildingId}return t&&t.add(n.buffer),{buffer:n}}static deserialize(e){const t=e.buffer,r=t.length/15,n=new Up;n.buffer=t;const i=[];i.length=r,n.data=i;let s=0;for(let o=0;o<r;o++){const e=15*o,r=new Op;r.centroidXY=new oe(t[e],t[e+1]),r.min=new oe(t[e+2],t[e+3]),r.max=new oe(t[e+4],t[e+5]),r.groupCentroidPos=new oe(t[e+6],t[e+7]),r.vertexArrayOffset=t[e+8],r.vertexCount=t[e+9],r.groundVertexArrayOffset=t[e+10],r.groundVertexCount=t[e+11],r.footprintSegLen=t[e+12],r.height=t[e+13],r.buildingId=t[e+14],r.footprintSegIdx=s,s+=r.footprintSegLen,n.data[o]=r}return n}}class Np{constructor(){this.acc=new oe(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(e,t){e.min.x===Number.MAX_VALUE&&(e.min.x=e.max.x=t.x,e.min.y=e.max.y=t.y)}appendEdge(e,t,r){this.accCount++,this.acc._add(t);let n=!!this.borders;t.x<e.min.x?(e.min.x=t.x,n=!0):t.x>e.max.x&&(e.max.x=t.x,n=!0),t.y<e.min.y?(e.min.y=t.y,n=!0):t.y>e.max.y&&(e.max.y=t.y,n=!0),((0===t.x||t.x===tn)&&t.x===r.x)!=((0===t.y||t.y===tn)&&t.y===r.y)&&this.processBorderOverlap(t,r),n&&this.checkBorderIntersection(t,r)}checkBorderIntersection(e,t){t.x<0!=e.x<0&&this.addBorderIntersection(0,Bt(t.y,e.y,(0-t.x)/(e.x-t.x))),t.x>tn!=e.x>tn&&this.addBorderIntersection(1,Bt(t.y,e.y,(tn-t.x)/(e.x-t.x))),t.y<0!=e.y<0&&this.addBorderIntersection(2,Bt(t.x,e.x,(0-t.y)/(e.y-t.y))),t.y>tn!=e.y>tn&&this.addBorderIntersection(3,Bt(t.x,e.x,(tn-t.y)/(e.y-t.y)))}addBorderIntersection(e,t){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const r=this.borders[e];t<r[0]&&(r[0]=t),t>r[1]&&(r[1]=t)}processBorderOverlap(e,t){if(e.x===t.x){if(e.y===t.y)return;const r=0===e.x?0:1;this.addBorderIntersection(r,t.y),this.addBorderIntersection(r,e.y)}else{const r=0===e.y?2:3;this.addBorderIntersection(r,t.x),this.addBorderIntersection(r,e.x)}}centroid(){return 0===this.accCount?new oe(0,0):new oe(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((e,t)=>e+ +(t[0]!==Number.MAX_VALUE),0):0}}function jp(e,t){const r=e.add(t)._unit(),n=pe(e.x*r.x+e.y*r.y,-1,1);var i,s,o;return o=Math.acos(n),Math.min(4,Math.max(-4,Math.tan(o)))/4*zp*((i=e).x*(s=t).y-i.y*s.x<0?-1:1)}const $p=[e=>e.x<0,e=>e.x>tn,e=>e.y<0,e=>e.y>tn];function Gp(e,t,r,n){const i=[4];if(0===n)return i;r._mult(n);const s=e.sub(r),o=t.sub(r),a=[e,t,s,o];for(let l=0;l<4;l++)for(const e of a)if($p[l](e)){i.push(l);break}return i}class Xp{constructor(e){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new oa,this.indexArray=new wa,this.programConfigurations=new vl(e.layers,{zoom:e.zoom,lut:e.lut},e=>Bp.includes(e)),this._segments=new Ka,this.hiddenByLandmarkVertexArray=new Ca,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Ka}getDefaultSegment(){return this.regionSegments[4]}hasData(){return 0!==this.vertexArray.length}addData(e,t,r,n=!1){const i=e.length;if(i>2){let s=Math.max(0,this._segments.get().length-1);const o=this._segments._prepareSegment(4*i,this.vertexArray.length,2*this._segmentToGroundQuads[s].length);let a;s!==this._segments.get().length-1&&(s++,this._segmentToGroundQuads[s]=[],this._segmentToRegionTriCounts[s]=[0,0,0,0,0]);{const t=e[0],r=e[1];a=jp(t.sub(e[i-1])._perp()._unit(),r.sub(t)._perp()._unit())}for(let l=0;l<i;l++){const u=l===i-1?0:l+1,c=e[l],h=e[u],p=e[u===i-1?0:u+1],d=h.sub(c)._perp()._unit(),f=jp(d,p.sub(h)._perp()._unit()),m=a,y=f;if(Wp(c,h,t)||n&&Jp(c,t)&&Jp(h,t)){a=f;continue}const g=o.vertexLength;Cp(this.vertexArray,c,h,1,1,m),Cp(this.vertexArray,c,h,1,0,m),Cp(this.vertexArray,c,h,0,1,y),Cp(this.vertexArray,c,h,0,0,y),o.vertexLength+=4;const x=Gp(c,h,d,r);for(const e of x)this._segmentToGroundQuads[s].push({id:g,region:e}),this._segmentToRegionTriCounts[s][e]+=2,o.primitiveLength+=2;a=f}}}prepareBorderSegments(){if(!this.hasData())return;const e=this._segments.get(),t=e.length;for(let r=0;r<t;r++)this._segmentToGroundQuads[r].sort((e,t)=>e.region-t.region);for(let r=0;r<t;r++){const t=this._segmentToGroundQuads[r],n=e[r],i=this._segmentToRegionTriCounts[r];i.reduce((e,t)=>e+t,0);let s=0;for(let e=0;e<=4;e++){const t=i[e];if(0!==t){let r=this.regionSegments[e];r||(r=this.regionSegments[e]=new Ka);const i={vertexOffset:n.vertexOffset,primitiveOffset:n.primitiveOffset+s,vertexLength:n.vertexLength,primitiveLength:t};r.get().push(i)}s+=t}for(let e=0;e<t.length;e++){const r=t[e].id;this.indexArray.emplaceBack(r,r+1,r+3),this.indexArray.emplaceBack(r,r+3,r+2)}}this._segmentToGroundQuads=null,this._segmentToRegionTriCounts=null,this._segments.destroy(),this._segments=null}addPaintPropertiesData(e,t,r,n,i,s,o){this.hasData()&&this.programConfigurations.populatePaintArrays(this.vertexArray.length,e,t,r,n,i,s,void 0,o)}upload(e){this.hasData()&&(this.vertexBuffer=e.createVertexBuffer(this.vertexArray,op.members),this.indexBuffer=e.createIndexBuffer(this.indexArray),null!=this.groundRadiusArray&&(this.groundRadiusBuffer=e.createVertexBuffer(this.groundRadiusArray,ap.members)))}uploadPaintProperties(e){this.hasData()&&this.programConfigurations.upload(e)}update(e,t,r,n,i,s,o,a){this.hasData()&&this.programConfigurations.updatePaintArrays(e,t,r,n,i,s,o,a)}updateHiddenByLandmark(e){this.updateHiddenByLandmarkRange(e.groundVertexArrayOffset,e.groundVertexCount,!!(e.flags&kp||e.flags&Vp))}updateHiddenByLandmarkRange(e,t,r){if(!this.hasData())return;const n=t+e;if(0!==t){for(let t=e;t<n;++t)this.hiddenByLandmarkVertexArray.emplace(t,r?1:0);this._needsHiddenByLandmarkUpdate=!0}}uploadHiddenByLandmark(e){this.hasData()&&this._needsHiddenByLandmarkUpdate&&(!this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexArray.length>0?this.hiddenByLandmarkVertexBuffer=e.createVertexBuffer(this.hiddenByLandmarkVertexArray,cp.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this.groundRadiusBuffer&&this.groundRadiusBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let e=0;e<=4;e++){const t=this.regionSegments[e];t&&t.destroy()}}}}class qp{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaling=e.overscaling,this.layers=e.layers,this.pixelRatio=e.pixelRatio,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=e.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=new Up,this.footprintIndices=new wa,this.footprintVertices=new Qo,this.footprintSegments=new Rp,this.layoutVertexArray=new sa,this.centroidVertexArray=new qa,this.wallVertexArray=new Za,this.indexArray=new wa,this.programConfigurations=new vl(e.layers,{zoom:e.zoom,lut:e.lut},e=>Mp.includes(e)),this.segments=new Ka,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.groundEffect=new Xp(e),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.buildingGroups=/* @__PURE__ */new Map,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,r,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,r,n){this.features=[],this.hasPattern=oh("fill-extrusion",this.layers,this.pixelRatio,t),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=$l(r),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=0!==this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1);for(const{feature:i,id:s,index:o,sourceLayerIndex:a}of e){const e=this.layers[0]._featureFilter.needGeometry,l=Ql(i,e);if(!this.layers[0]._featureFilter.filter(new lo(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),l,r))continue;const u={id:s,sourceLayerIndex:a,index:o,geometry:e?l.geometry:Kl(i,r,n),properties:i.properties,type:i.type,patterns:{}},c=this.layoutVertexArray.length,h="Polygon"===Sp[u.type];if(this.hasPattern)this.features.push({featureId:i.id,feature:ah("fill-extrusion",this.layers,u,this.zoom,this.pixelRatio,t)});else if(this.wallMode)for(const s of u.geometry)for(const e of Ap(s,h))this.addFeature(i.id,u,[e],o,r,{},t.availableImages,n,t.brightness);else this.addFeature(i.id,u,u.geometry,o,r,{},t.availableImages,n,t.brightness);t.featureIndex.insert(i,u.geometry,o,a,this.index,c)}this._finalizeBuildingGroups(),this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(e,t,r,n,i,s){for(const{featureId:o,feature:a}of this.features){const e="Polygon"===Sp[a.type],{geometry:l}=a;if(this.wallMode)for(const u of l)for(const l of Ap(u,e))this.addFeature(o,a,[l],a.index,t,r,n,i,s);else this.addFeature(o,a,l,a.index,t,r,n,i,s)}this._finalizeBuildingGroups(),this.sortBorders(),"mercator"===this.projection.name&&this.splitToSubtiles()}update(e,t,r,n,i,s,o){this.programConfigurations.updatePaintArrays(e,t,i,r,n,s,o,this.worldview),this.groundEffect.update(e,t,i,r,n,s,o,this.worldview)}updateExpressions(e){this.programConfigurations.updateExpressions(e),this.groundEffect.programConfigurations.updateExpressions(e)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(e){this.uploaded||(this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,pp),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.wallVertexBuffer=e.createVertexBuffer(this.wallVertexArray,up.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=e.createVertexBuffer(this.layoutVertexExtArray,hp.members,!0)),this.groundEffect.upload(e)),this.groundEffect.uploadPaintProperties(e),this.programConfigurations.upload(e),this.uploaded=!0}uploadCentroid(e){this.groundEffect.uploadHiddenByLandmark(e),this.needsCentroidUpdate&&(!this.centroidVertexBuffer&&this.centroidVertexArray.length>0?this.centroidVertexBuffer=e.createVertexBuffer(this.centroidVertexArray,lp.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(e,t,r,n,i,s,o,a,l){const u=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(t,{})/this.tileToMeter,c=[new oe(0,0),new oe(tn,tn)],h=a.projection,p="globe"===h.name,d=this.wallMode||"Polygon"===Sp[t.type],f=new Np;f.centroidDataIndex=this.centroidData.length;const m=new Op;m.buildingId=e,t.properties&&Object.hasOwn(t.properties,"building_id")&&(m.buildingId=Number(t.properties.building_id)),f.buildingId=m.buildingId;const y=this.layers[0].paint.get("fill-extrusion-base").evaluate(t,{},i)<=0,g=this.layers[0].paint.get("fill-extrusion-height").evaluate(t,{},i);let x;if(m.height=g,m.vertexArrayOffset=this.layoutVertexArray.length,m.groundVertexArrayOffset=this.groundEffect.vertexArray.length,p&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new ha),this.wallMode){if(p)return void be("Non zero fill-extrusion-line-width is not yet supported on globe.");if(1!==r.length)return;x=function(e){const t=e[0].x===e.at(-1).x&&e[0].y===e.at(-1).y;(function(e){let t=0;const r=e.length;for(let n=0;n<r;n++)t+=(e[(n+1)%r].x-e[n].x)*(e[(n+1)%r].y+e[n].y);return t>=0})(e)||(e=e.reverse());const r={geometry:[],joinNormals:[],indices:[]},n=[],i=[],s=[];let o=e.length;for(;o>=2&&e[o-1].equals(e[o-2]);)o--;if(o<(t?3:2))return r;let a,l,u,c,h,p=0;for(;p<o-1&&e[p].equals(e[p+1]);)p++;t&&(a=e[o-2],h=e[p].sub(a)._unit()._perp());for(let f=p;f<o;f++){if(u=f===o-1?t?e[p+1]:void 0:e[f+1],u&&e[f].equals(u))continue;h&&(c=h),a&&(l=a),a=e[f],h=u?u.sub(a)._unit()._perp():c,c=c||h;let r=c.add(h);0===r.x&&0===r.y||r._unit();const d=r.x*h.x+r.y*h.y,m=0!==d?1/d:1/0,y=c.x*h.y-c.y*h.x>0;let g="miter";const x=2;"miter"===g&&m>x&&(g="bevel"),"bevel"===g&&(m>100&&(g="flipbevel"),m<x&&(g="miter"));const v=(e,t,r,o)=>{const a=new oe(e.x,e.y),l=new oe(e.x,e.y);a.x+=t.x*o,a.y+=t.y*o,l.x-=t.x*Math.max(r,1),l.y-=t.y*Math.max(r,1),s.push(t),n.push(a),i.push(l)};if("miter"===g)r._mult(m),v(a,r,0,0);else if("flipbevel"===g)r=h.mult(-1),v(a,r,0,0),v(a,r.mult(-1),0,0);else{const e=-Math.sqrt(m*m-1),t=y?e:0,r=y?0:e;l&&v(a,c,t,r),u&&v(a,h,t,r)}}r.geometry=[...n,...i.reverse(),n[0]],r.joinNormals=[...s,...s.reverse(),s.at(-1)];const d=r.geometry.length-1;for(let f=0;f<d/2;f++)if(f+1<d/2){let e=f,t=f+1,n=d-1-f,i=d-2-f;e=0===e?d-1:e-1,t=0===t?d-1:t-1,n=0===n?d-1:n-1,i=0===i?d-1:i-1,r.indices.push(n),r.indices.push(t),r.indices.push(e),r.indices.push(n),r.indices.push(i),r.indices.push(t)}return r}(r[0]),r=[x.geometry]}const v=(e,t)=>e<(t.length-1)/2||e===t.length-1,b=this.wallMode?[r]:nh(r,500);for(let S=b.length-1;S>=0;S--){const e=b[S];(0===e.length||Kp(e[0]))&&b.splice(S,1)}let w;if(p)w=td(b,c,i);else{w=[];for(const e of b)w.push({polygon:e,bounds:c})}const _=d?this.edgeRadius:0,I=_>0&&this.zoom<17,A=(e,t)=>{if(0===e.length)return!1;const r=e.at(-1);return t.x===r.x&&t.y===r.y};for(const{polygon:S,bounds:M}of w){let e=0,t=0;for(const i of S)d&&!i[0].equals(i.at(-1))&&i.push(i[0]),t+=d?i.length-1:i.length;const r=this.segments.prepareSegment((d?5:4)*t,this.layoutVertexArray,this.indexArray);m.footprintSegIdx<0&&(m.footprintSegIdx=this.footprintSegments.length),m.polygonSegIdx<0&&(m.polygonSegIdx=this.polygonSegments.length);const n={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},s=new Lp;if(s.vertexOffset=this.footprintVertices.length,s.indexOffset=3*this.footprintIndices.length,s.ringIndices=[],d){const t=[],n=[];e=r.vertexLength;for(let e=0;e<S.length;e++){const o=S[e];o.length&&0!==e&&n.push(t.length/2);const a=[];let l,c;l=o[1].sub(o[0])._perp()._unit(),s.ringIndices.push(o.length-1);for(let e=1;e<o.length;e++){const n=o[e],s=o[e===o.length-1?1:e+1],u=n.clone();if(_){c=s.sub(n)._perp()._unit();const e=l.add(c)._unit(),t=_*Math.min(4,1/(l.x*e.x+l.y*e.y));u.x+=t*e.x,u.y+=t*e.y,u.x=Math.round(u.x),u.y=Math.round(u.y),l=c}if(!y||0!==_&&!I||A(a,u)||a.push(u),Ep(this.layoutVertexArray,u.x,u.y,0,0,1,1,0),this.wallMode){const t=v(e,o);Dp(this.wallVertexArray,x.joinNormals[e],!t)}r.vertexLength++,this.footprintVertices.emplaceBack(n.x,n.y),t.push(n.x,n.y),p&&Fp(this.layoutVertexExtArray,h.projectTilePoint(u.x,u.y,i),h.upVector(i,u.x,u.y))}y&&(0===_||I)&&(0!==a.length&&A(a,a[0])&&a.pop(),this.groundEffect.addData(a,M,u))}const o=this.wallMode?x.indices:kc(t,n);for(let i=0;i<o.length;i+=3)this.footprintIndices.emplaceBack(s.vertexOffset+o[i+0],s.vertexOffset+o[i+1],s.vertexOffset+o[i+2]),this.indexArray.emplaceBack(e+o[i],e+o[i+2],e+o[i+1]),r.primitiveLength++;s.indexCount+=o.length,s.vertexCount+=this.footprintVertices.length-s.vertexOffset}for(let o=0;o<S.length;o++){const t=S[o];f.startRing(m,t[0]);let n=t.length>4&&Qp(t[t.length-2],t[0],t[1]),s=_?Zp(t[t.length-2],t[0],t[1],_):0;const a=[];let l,c,g;c=t[1].sub(t[0])._perp()._unit();let b=!0;for(let o=1,u=0;o<t.length;o++){let d=t[o-1],w=t[o];const I=t[o===t.length-1?1:o+1];if(f.appendEdge(m,w,d),Wp(w,d,M)){_&&(c=I.sub(w)._perp()._unit(),b=!b);continue}const S=w.sub(d)._perp(),B=S.x/(Math.abs(S.x)+Math.abs(S.y)),P=S.y>0?1:0,z=d.dist(w);if(u+z>32768&&(u=0),_){g=I.sub(w)._perp()._unit();let e=Yp(d,w,I,Hp(c,g),_);isNaN(e)&&(e=0);const t=w.sub(d)._unit();d=d.add(t.mult(s))._round(),w=w.add(t.mult(-e))._round(),s=e,c=g,y&&this.zoom>=17&&(A(a,d)||a.push(d),A(a,w)||a.push(w))}const T=r.vertexLength,k=t.length>4&&Qp(d,w,I);let V=ed(u,n,b);if(Ep(this.layoutVertexArray,d.x,d.y,B,P,0,0,V),Ep(this.layoutVertexArray,d.x,d.y,B,P,0,1,V),this.wallMode){const e=v(o-1,t),r=x.joinNormals[o-1];Dp(this.wallVertexArray,r,e),Dp(this.wallVertexArray,r,e)}if(u+=z,V=ed(u,k,!b),n=k,Ep(this.layoutVertexArray,w.x,w.y,B,P,0,0,V),Ep(this.layoutVertexArray,w.x,w.y,B,P,0,1,V),this.wallMode){const e=v(o,t),r=x.joinNormals[o];Dp(this.wallVertexArray,r,e),Dp(this.wallVertexArray,r,e)}if(r.vertexLength+=4,this.indexArray.emplaceBack(T+0,T+1,T+2),this.indexArray.emplaceBack(T+1,T+3,T+2),r.primitiveLength+=2,_){const n=e+(1===o?t.length-2:o-2),i=1===o?e:n+1;if(this.indexArray.emplaceBack(T+1,n,T+3),this.indexArray.emplaceBack(n,i,T+3),r.primitiveLength+=2,void 0===l&&(l=T),!Wp(I,t[o],M)){const e=o===t.length-1?l:r.vertexLength;this.indexArray.emplaceBack(T+2,T+3,e),this.indexArray.emplaceBack(T+3,e+1,e),this.indexArray.emplaceBack(T+3,i,e+1),r.primitiveLength+=3}b=!b}if(p){const e=this.layoutVertexExtArray,t=h.projectTilePoint(d.x,d.y,i),r=h.projectTilePoint(w.x,w.y,i),n=h.upVector(i,d.x,d.y),s=h.upVector(i,w.x,w.y);Fp(e,t,n),Fp(e,t,n),Fp(e,r,s),Fp(e,r,s)}}d&&(e+=t.length-1),y&&_&&this.zoom>=17&&(0!==a.length&&A(a,a[0])&&a.pop(),this.groundEffect.addData(a,M,u,_>0))}this.footprintSegments.push(s),n.triangleCount=this.indexArray.length-n.triangleArrayOffset,this.polygonSegments.push(n),++m.footprintSegLen,++m.polygonSegLen}if(m.vertexCount=this.layoutVertexArray.length-m.vertexArrayOffset,m.groundVertexCount=this.groundEffect.vertexArray.length-m.groundVertexArrayOffset,0!==m.vertexCount){if(m.centroidXY=f.borders?Tp:this.encodeCentroid(f,m),t.properties&&Object.hasOwn(t.properties,"building_id")){const e=m.buildingId;let t=this.buildingGroups.get(e);t||(t={accX:0,accY:0,accCount:0,mergedMin:new oe(Number.MAX_VALUE,Number.MAX_VALUE),mergedMax:new oe(-Number.MAX_VALUE,-Number.MAX_VALUE),partIndices:[]},this.buildingGroups.set(e,t)),t.accX+=f.acc.x,t.accY+=f.acc.y,t.accCount+=f.accCount,t.mergedMin.x=Math.min(t.mergedMin.x,m.min.x),t.mergedMin.y=Math.min(t.mergedMin.y,m.min.y),t.mergedMax.x=Math.max(t.mergedMax.x,m.max.x),t.mergedMax.y=Math.max(t.mergedMax.y,m.max.y),t.partIndices.push(this.centroidData.length)}if(this.centroidData.push(m),f.borders){this.featuresOnBorder.push(f);const e=this.featuresOnBorder.length-1;for(let t=0;t<f.borders.length;t++)f.borders[t][0]!==Number.MAX_VALUE&&this.borderFeatureIndices[t].push(e)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,n,s,o,i,l,void 0,this.worldview),this.groundEffect.addPaintPropertiesData(t,n,s,o,i,l,this.worldview),this.maxHeight=Math.max(this.maxHeight,g)}}_finalizeBuildingGroups(){for(const[,e]of this.buildingGroups){if(0===e.partIndices.length)continue;const t=new Np;t.acc=new oe(e.accX,e.accY),t.accCount=e.accCount;const r=new Op;r.min=e.mergedMin,r.max=e.mergedMax;const n=this.encodeCentroid(t,r),i=t.centroid();for(const s of e.partIndices){const t=this.centroidData.get(s);t.centroidXY.x===Tp.x&&t.centroidXY.y===Tp.y||(t.centroidXY=n),t.min=e.mergedMin,t.max=e.mergedMax,t.groupCentroidPos=i}}this.buildingGroups.clear()}sortBorders(){for(let e=0;e<this.borderFeatureIndices.length;e++)this.borderFeatureIndices[e].sort((t,r)=>this.featuresOnBorder[t].borders[e][0]-this.featuresOnBorder[r].borders[e][0])}splitToSubtiles(){const e=[];for(let o=0;o<this.centroidData.length;o++){const t=this.centroidData.get(o),r=+(t.min.y+t.max.y>tn),n=2*r+(+(t.min.x+t.max.x>tn)^r);for(let i=0;i<t.polygonSegLen;i++){const r=t.polygonSegIdx+i;e.push({centroidIdx:o,subtile:n,polygonSegmentIdx:r,triangleSegmentIdx:this.polygonSegments[r].triangleSegIdx})}}const t=new wa;e.sort((e,t)=>e.triangleSegmentIdx===t.triangleSegmentIdx?e.subtile-t.subtile:e.triangleSegmentIdx-t.triangleSegmentIdx);let r=0,n=0,i=0;for(const o of e){if(o.triangleSegmentIdx!==r)break;i++}const s=e.length;for(;n!==e.length;){r=e[n].triangleSegmentIdx;let o=0,a=n,l=n;for(let t=a;t<i&&e[t].subtile===o;t++)l++;for(;a!==i;){const n=e[a];o=n.subtile;const s=this.centroidData.get(n.centroidIdx).min.clone(),u=this.centroidData.get(n.centroidIdx).max.clone(),c={vertexOffset:this.segments.segments[r].vertexOffset,primitiveOffset:t.length,vertexLength:this.segments.segments[r].vertexLength,primitiveLength:0,sortKey:void 0,vaos:{}};for(let r=a;r<l;r++){const n=e[r],i=this.polygonSegments[n.polygonSegmentIdx],o=this.centroidData.get(n.centroidIdx).min,a=this.centroidData.get(n.centroidIdx).max,l=this.indexArray.uint16;for(let e=i.triangleArrayOffset;e<i.triangleArrayOffset+i.triangleCount;e++)t.emplaceBack(l[3*e],l[3*e+1],l[3*e+2]);c.primitiveLength+=i.triangleCount,s.x=Math.min(s.x,o.x),s.y=Math.min(s.y,o.y),u.x=Math.max(u.x,a.x),u.y=Math.max(u.y,a.y)}c.primitiveLength>0&&this.triangleSubSegments.push({segment:c,min:s,max:u}),a=l;for(let t=a;t<i&&e[t].subtile===e[a].subtile;t++)l++}n=i;for(let t=n;t<s&&e[t].triangleSegmentIdx===e[n].triangleSegmentIdx;t++)i++}t._trim(),this.indexArray=t}getVisibleSegments(e,t,r){const n=new Ka;if(this.wallMode){for(const e of this.triangleSubSegments)n.segments.push(e.segment);return n}let i=0,s=0;const o=1<<e.canonical.z;if(t){const r=t.getMinMaxForTile(e);r&&(i=r.min,s=r.max)}s+=this.maxHeight;const a=e.toUnwrapped();let l;const u=[a.canonical.x/o+a.wrap,a.canonical.y/o],c=[(a.canonical.x+1)/o+a.wrap,(a.canonical.y+1)/o],h=(e,t,r)=>[e[0]*(1-r[0])+t[0]*r[0],e[1]*(1-r[1])+t[1]*r[1]],p=[],d=[];for(const f of this.triangleSubSegments){p[0]=f.min.x/tn,p[1]=f.min.y/tn,d[0]=f.max.x/tn,d[1]=f.max.y/tn;const e=h(u,c,p),t=h(u,c,d);if(0===new wu([e[0],e[1],i],[t[0],t[1],s]).intersectsPrecise(r)){l&&(n.segments.push(l),l=void 0);continue}const o=f.segment;l&&l.vertexOffset!==o.vertexOffset&&(n.segments.push(l),l=void 0),l?(l.vertexLength+=o.vertexLength,l.primitiveLength+=o.primitiveLength):l={vertexOffset:o.vertexOffset,primitiveLength:o.primitiveLength,vertexLength:o.vertexLength,primitiveOffset:o.primitiveOffset,sortKey:void 0,vaos:{}}}return l&&n.segments.push(l),n}encodeCentroid(e,t){const r=e.centroid(),n=t.span(),i=Math.min(7,Math.round(n.x*this.tileToMeter/10)),s=Math.min(6,Math.round(n.y*this.tileToMeter/10));return new oe(pe(r.x,1,8191)<<3|i,pe(r.y,1,8191)<<3|s)}encodeBorderCentroid(e){if(!e.borders)return new oe(0,0);const t=e.borders,r=Number.MAX_VALUE;if(t[0][0]!==r||t[1][0]!==r){const e=t[0][0]!==r?0:1;return new oe(6|(t[0][0]!==r?0:65528),(t[e][0]+t[e][1])/2<<3|6)}{const e=t[2][0]!==r?2:3;return new oe((t[e][0]+t[e][1])/2<<3|6,6|(t[2][0]!==r?0:65528))}}showCentroid(e){const t=this.centroidData.get(e.centroidDataIndex);if(t.flags&=kp,0!==t.groupCentroidPos.x||0!==t.groupCentroidPos.y){const e=t.span(),r=Math.min(7,Math.round(e.x*this.tileToMeter/10)),n=Math.min(6,Math.round(e.y*this.tileToMeter/10));t.centroidXY=new oe(pe(t.groupCentroidPos.x,1,8191)<<3|r,pe(t.groupCentroidPos.y,1,8191)<<3|n)}else t.centroidXY=new oe(0,0);this.writeCentroidToBuffer(t)}writeCentroidToBuffer(e){this.groundEffect.updateHiddenByLandmark(e);const t=e.vertexArrayOffset,r=e.vertexCount+e.vertexArrayOffset,n=-1073741824&e.flags?Tp:e.centroidXY,i=this.centroidVertexArray.geta_centroid_pos0(t);if(this.centroidVertexArray.geta_centroid_pos1(t)!==n.y||i!==n.x){for(let e=t;e<r;++e)this.centroidVertexArray.emplace(e,n.x,n.y);this.needsCentroidUpdate=!0}}createCentroidsBuffer(){this.centroidVertexArray.resize(this.layoutVertexArray.length),this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const e of this.centroidData)this.writeCentroidToBuffer(e)}updateReplacement(e,t,r){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const n=t.getReplacementRegionsForTile(e.toUnwrapped());if(gp(this.activeReplacements,n))return;if(this.activeReplacements=n,0===this.centroidVertexArray.length)this.createCentroidsBuffer();else for(const s of this.centroidData)s.flags&=1073741823;const i=[];for(const s of this.activeReplacements){if(s.order<r)continue;const t=Math.max(1,Math.pow(2,s.footprintTileId.canonical.z-e.canonical.z));if(s.footprint.buildingIds)for(const e of this.centroidData)e.flags&kp||e.flags&Vp||s.min.x>e.max.x||e.min.x>s.max.x||s.min.y>e.max.y||e.min.y>s.max.y||s.footprint.buildingIds.has(e.buildingId)&&(e.flags|=s.clipMask!==wp?-1073741824:kp);else for(const r of this.centroidData)if(!(r.flags&kp||r.flags&Vp||s.min.x>r.max.x||r.min.x>s.max.x||s.min.y>r.max.y||r.min.y>s.max.y))for(let n=0;n<r.footprintSegLen;n++){const o=this.footprintSegments.get(r.footprintSegIdx+n);if(i.length=0,rd(this.footprintVertices,o.vertexOffset,o.vertexCount,s.footprintTileId.canonical,e.canonical,i),xp(s.footprint,i,this.footprintIndices.uint16,o.indexOffset,o.indexCount,-o.vertexOffset,-t)){r.flags|=s.clipMask!==wp?-1073741824:kp;break}}}for(const s of this.centroidData)this.writeCentroidToBuffer(s);this.borderDoneWithNeighborZ=[-1,-1,-1,-1]}footprintContainsPoint(e,t,r){let n=!1;for(let i=0;i<r.footprintSegLen;i++){const s=this.footprintSegments.get(r.footprintSegIdx+i);let o=0;for(const r of s.ringIndices){for(let i=o,a=r+o-1;i<r+o;a=i++){const r=this.footprintVertices.int16[2*(i+s.vertexOffset)+0],o=this.footprintVertices.int16[2*(i+s.vertexOffset)+1],l=this.footprintVertices.int16[2*(a+s.vertexOffset)+1];o>t!=l>t&&e<(this.footprintVertices.int16[2*(a+s.vertexOffset)+0]-r)*(t-o)/(l-o)+r&&(n=!n)}o=r}}return n}getHeightAtTileCoord(e,t){let r=Number.NEGATIVE_INFINITY,n=!0;const i=4*(e+tn)*tn+(t+tn);if(Object.hasOwn(this.partLookup,i)){const e=this.partLookup[i];return e?{height:e.height,hidden:!!(e.flags&kp)}:void 0}const s=this.centroidData.buffer,o=this.centroidData.length;for(let a=0;a<o;a++){const o=15*a;if(e>s[o+4]||s[o+2]>e||t>s[o+5]||s[o+3]>t)continue;const l=s[o+13];if(l<=r)continue;const u=this.centroidData.get(a);this.footprintContainsPoint(e,t,u)&&(r=l,this.partLookup[i]=u,n=!!(u.flags&kp))}if(r!==Number.NEGATIVE_INFINITY)return{height:r,hidden:n};this.partLookup[i]=void 0}}function Hp(e,t){const r=e.add(t)._unit();return e.x*r.x+e.y*r.y}function Zp(e,t,r,n){const i=t.sub(e)._perp()._unit(),s=r.sub(t)._perp()._unit();return Yp(e,t,r,Hp(i,s),n)}function Yp(e,t,r,n,i){const s=Math.sqrt(1-n*n);return Math.min(e.dist(t)/3,t.dist(r)/3,i*s/n)}function Wp(e,t,r){return e.x<r[0].x&&t.x<r[0].x||e.x>r[1].x&&t.x>r[1].x||e.y<r[0].y&&t.y<r[0].y||e.y>r[1].y&&t.y>r[1].y}function Jp(e,t){return e.x<t[0].x||e.x>t[1].x||e.y<t[0].y||e.y>t[1].y}function Kp(e){return e.every(e=>e.x<=0)||e.every(e=>e.x>=tn)||e.every(e=>e.y<=0)||e.every(e=>e.y>=tn)}function Qp(e,t,r){if(e.x<0||e.x>=tn||t.x<0||t.x>=tn||r.x<0||r.x>=tn)return!1;const n=r.sub(t),i=n.perp(),s=e.sub(t);return(n.x*s.x+n.y*s.y)/Math.sqrt((n.x*n.x+n.y*n.y)*(s.x*s.x+s.y*s.y))>-.866&&i.x*s.x+i.y*s.y<0}function ed(e,t,r){const n=t?2|e:-3&e;return r?1|n:-2&n}function td(e,t,r){const n=1<<r.z,i=Rl(r.x/n),s=Rl((r.x+1)/n),o=Ol(r.y/n),a=Ol((r.y+1)/n);return function(e,t,r,n,i=0,s){const o=[];if(!e.length||!r||!n)return o;const a=(e,t)=>{for(const r of e)o.push({polygon:r,bounds:t})},l=Math.ceil(Math.log2(r)),u=Math.ceil(Math.log2(n)),c=l-u,h=[];for(let f=0;f<Math.abs(c);f++)h.push(c>0?0:1);for(let f=0;f<Math.min(l,u);f++)h.push(0),h.push(1);let p=e;if(p=Xh(p,t[0].y-i,t[1].y+i,1),p=Xh(p,t[0].x-i,t[1].x+i,0),!p.length)return o;const d=[];for(h.length?d.push({polygons:p,bounds:t,depth:0}):a(p,t);d.length;){const e=d.pop(),t=e.depth,r=h[t],n=e.bounds[0],o=e.bounds[1],l=0===r?n.x:n.y,u=0===r?o.x:o.y,c=s?s(r,l,u):.5*(l+u),p=Xh(e.polygons,l-i,c+i,r),f=Xh(e.polygons,c-i,u+i,r);if(p.length){const e=[n,new oe(0===r?c:o.x,1===r?c:o.y)];h.length>t+1?d.push({polygons:p,bounds:e,depth:t+1}):a(p,e)}if(f.length){const e=[new oe(0===r?c:n.x,1===r?c:n.y),o];h.length>t+1?d.push({polygons:f,bounds:e,depth:t+1}):a(f,e)}}return o}(e,t,Math.ceil((s-i)/11.25),Math.ceil((o-a)/11.25),1,(e,t,i)=>{if(0===e)return.5*(t+i);{const e=Ol((r.y+t/tn)/n);return(Fl(.5*(Ol((r.y+i/tn)/n)+e))*n-r.y)*tn}})}function rd(e,t,r,n,i,s){const o=Math.pow(2,n.z-i.z);for(let a=0;a<r;a++){let r=e.int16[2*(a+t)+0],l=e.int16[2*(a+t)+1];r=(r+i.x*tn)*o-n.x*tn,l=(l+i.y*tn)*o-n.y*tn,s.push(new oe(r,l))}}let nd,id;ps(qp,"FillExtrusionBucket",{omit:["layers","features"]}),ps(Op,"PartData"),ps(Up,"PartDataArray"),ps(Rp,"FootprintSegmentArray"),ps(Np,"BorderCentroidData"),ps(Xp,"GroundEffect");class sd extends oe{constructor(e,t,r){super(e,t),this.z=r}}class od extends sd{constructor(e,t,r,n){super(e,t,r),this.w=n}}function ad(e,t,r,n){const i="x"===r?"y":"x",s=(n-e[r])/(t[r]-e[r]);e[i]=Math.round(e[i]+(t[i]-e[i])*s),e[r]=n,Object.hasOwn(e,"z")&&(e.z=Bt(e.z,t.z,s)),Object.hasOwn(e,"w")&&(e.w=Bt(e.w,t.w,s))}function ld(e,t,r,n){const i=r,s=n;for(const o of["x","y"]){let r=e,n=t;r[o]>=n[o]&&(r=t,n=e),r[o]<i&&n[o]>i&&ad(r,n,o,i),r[o]<s&&n[o]>s&&ad(n,r,o,s)}}function ud(e,t,r,n,i,s){const o=[];for(let a=0;a<e.length;a++){const l=e[a];let u;const c=o.length;let h=0;for(let e=0;e<l.length-1;e++){let c=l[e],p=l[e+1],d=0;const f=h;let m,y;s&&(d=Math.hypot(p.x-c.x,p.y-c.y),h+=d,m=c,y=p),c.x<t&&p.x<t||(c.x<t?c=new oe(t,c.y+(t-c.x)/(p.x-c.x)*(p.y-c.y))._round():p.x<t&&(p=new oe(t,c.y+(t-c.x)/(p.x-c.x)*(p.y-c.y))._round()),c.y<r&&p.y<r||(c.y<r?c=new oe(c.x+(r-c.y)/(p.y-c.y)*(p.x-c.x),r)._round():p.y<r&&(p=new oe(c.x+(r-c.y)/(p.y-c.y)*(p.x-c.x),r)._round()),c.x>=n&&p.x>=n||(c.x>=n?c=new oe(n,c.y+(n-c.x)/(p.x-c.x)*(p.y-c.y))._round():p.x>=n&&(p=new oe(n,c.y+(n-c.x)/(p.x-c.x)*(p.y-c.y))._round()),c.y>=i&&p.y>=i||(c.y>=i?c=new oe(c.x+(i-c.y)/(p.y-c.y)*(p.x-c.x),i)._round():p.y>=i&&(p=new oe(c.x+(i-c.y)/(p.y-c.y)*(p.x-c.x),i)._round()),u&&c.equals(u.at(-1))||(u=[c],o.push(u),s&&s.push({progress:{min:f+hd(m,y,c)*d,max:1},parentIndex:a,prevPoint:m,nextPoint:y})),u.push(p),s&&(s.at(-1).progress.max=f+hd(m,y,p)*d,s.at(-1).nextPoint=y)))))}if(s&&h>0)for(let e=c;e<o.length;e++)s[e].progress.min/=h,s[e].progress.max/=h}return o}function cd(e,t,r,n,i){if(e.length<2)return void n.push(e);const s=[];for(;t.valid();){const[r,n]=t.get();for(let t=0;t<e.length-1;t++){const i=e[t],o=e[t+1],a=Cu(i,o,r,n);if(a){const[e]=a,r=new oe(Bt(i.x,o.x,e),Bt(i.y,o.y,e));s.push({t:t+e,distance:0,point:r})}}t.next()}if(0===s.length)return void n.push(e);s.sort((e,t)=>e.t-t.t);let o=0,a=0,l=[];for(n.push(l);o!==e.length;){if(a===s.length){for(;o!==e.length;)0!==l.length&&l.at(-1).equals(e[o])||l.push(e[o]),o++;break}s[a].t<=o?(0!==l.length&&l.at(-1).equals(s[a].point)||l.push(s[a].point),a++):(0!==l.length&&l.at(-1).equals(e[o])||l.push(e[o]),o++)}}function hd(e,t,r){return e.x!==t.x?(r.x-e.x)/(t.x-e.x):e.y!==t.y?(r.y-e.y)/(t.y-e.y):0}function pd(e,t){return e.x*t.x+e.y*t.y}function dd(e,t){if(1===e.length){let r=0;const n=t[r++];let i;for(;!i||n.equals(i);)if(i=t[r++],!i)return 1/0;for(;r<t.length;r++){const s=t[r],o=e[0],a=i.sub(n),l=s.sub(n),u=o.sub(n),c=pd(a,a),h=pd(a,l),p=pd(l,l),d=pd(u,a),f=pd(u,l),m=c*p-h*h,y=(p*d-h*f)/m,g=(c*f-h*d)/m,x=n.z*(1-y-g)+i.z*y+s.z*g;if(isFinite(x))return x}return 1/0}{let e=1/0;for(const r of t)e=Math.min(e,r.z);return e}}function fd(e,t,r){let n=1/0;Tu(r,t)&&(n=dd(r,t[0]));for(let i=0;i<t.length;i++){const s=t[i],o=e[i];for(let e=0;e<s.length-1;e++){const t=s[e],i=[t,s[e+1],o[e+1],o[e],t];Pu(r,i)&&(n=Math.min(n,dd(r,i)))}}return n!==1/0&&n}function md(e,t,r,n,i,s,o,a,l,u,c){return"globe"===e.projection.name?function(e,t,r,n,i,s,o,a,l,u,c){const h=[],p=[],d=e.projection.upVectorScale(c,e.center.lat,e.worldSize).metersToTile,f=[0,0,0,1],m=[0,0,0,1],y=(e,t,r,n)=>{e[0]=t,e[1]=r,e[2]=n,e[3]=1},g=function(){const e=Math.PI/32,t=Math.tan(e),r=Tl;return r*Math.sqrt(1+2*t*t)-r}();r>0&&(r+=g),n+=g;for(const x of t){const t=[],g=[];for(const h of x){const p=h.x+i.x,x=h.y+i.y,v=e.projection.projectTilePoint(p,x,c),b=e.projection.upVector(c,h.x,h.y);let w=r,_=n;if(o){const e=yd(p,x,r,n,o,a,l,u);w+=e.base,_+=e.top}0!==r?y(f,v.x+b[0]*d*w,v.y+b[1]*d*w,v.z+b[2]*d*w):y(f,v.x,v.y,v.z),y(m,v.x+b[0]*d*_,v.y+b[1]*d*_,v.z+b[2]*d*_),k(f,f,s),k(m,m,s),t.push(new sd(f[0],f[1],f[2])),g.push(new sd(m[0],m[1],m[2]))}h.push(t),p.push(g)}return[h,p]}(e,t,r,n,i,s,o,a,l,u,c):o?function(e,t,r,n,i,s,o,a,l){const u=[],c=[],h=[0,0,0,1];for(const p of e){const e=[],d=[];for(const u of p){const c=u.x+n.x,p=u.y+n.y,f=yd(c,p,t,r,s,o,a,l);h[0]=c,h[1]=p,h[2]=f.base,h[3]=1,R(h,h,i),h[3]=Math.max(h[3],1e-5);const m=new sd(h[0]/h[3],h[1]/h[3],h[2]/h[3]);h[0]=c,h[1]=p,h[2]=f.top,h[3]=1,R(h,h,i),h[3]=Math.max(h[3],1e-5);const y=new sd(h[0]/h[3],h[1]/h[3],h[2]/h[3]);e.push(m),d.push(y)}u.push(e),c.push(d)}return[u,c]}(t,r,n,i,s,o,a,l,u):function(e,t,r,n,i){const s=[],o=[],a=i[8]*t,l=i[9]*t,u=i[10]*t,c=i[11]*t,h=i[8]*r,p=i[9]*r,d=i[10]*r,f=i[11]*r;for(const m of e){const e=[],t=[];for(const r of m){const s=r.x+n.x,o=r.y+n.y,m=i[0]*s+i[4]*o+i[12],y=i[1]*s+i[5]*o+i[13],g=i[2]*s+i[6]*o+i[14],x=i[3]*s+i[7]*o+i[15],v=m+a,b=y+l,w=g+u,_=Math.max(x+c,1e-5),I=m+h,A=y+p,S=g+d,M=Math.max(x+f,1e-5);e.push(new sd(v/_,b/_,w/_)),t.push(new sd(I/M,A/M,S/M))}s.push(e),o.push(t)}return[s,o]}(t,r,n,i,s)}function yd(e,t,r,n,i,s,o,a){const l=o*i.getElevationAt(e,t,!0,!0),u=0!==s[0],c=u?0===s[1]?o*(s[0]/7-450):o*function(e,t,r){const n=Math.floor(t[0]/8),i=Math.floor(t[1]/8),s=10*(t[0]-8*n),o=10*(t[1]-8*i),a=e.getElevationAt(n,i,!0,!0),l=e.getMeterToDEM(r),u=Math.floor(.5*(s*l-1)),c=Math.floor(.5*(o*l-1)),h=e.tileCoordToPixel(n,i),p=2*u+1,d=2*c+1,f=(b=e,w=h.x-u,_=h.y-c,I=p,A=d,[b.getElevationAtPixel(w,_,!0),b.getElevationAtPixel(w+A,_,!0),b.getElevationAtPixel(w,_+A,!0),b.getElevationAtPixel(w+I,_+A,!0)]),m=Math.abs(f[0]-f[1]),y=Math.abs(f[2]-f[3]),g=Math.abs(f[0]-f[2])+Math.abs(f[1]-f[3]),x=Math.min(.25,.5*l*(m+y)/p),v=Math.min(.25,.5*l*g/d);var b,w,_,I,A;return a+Math.max(x*s,v*o)}(i,s,a):l;return{base:l+(0===r?-1:r),top:u?Math.max(c+n,l+r+2):l+n}}const gd=0,xd=1;let vd,bd,wd;const _d=Jo([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"},{name:"a_linesofar",components:1,type:"Float32"}],4),Id=Jo([{name:"a_z_offset_width",components:3,type:"Float32"}],4),Ad=Jo([{name:"a_elevation_id_col",components:3,type:"Float32"}],4),Sd=Jo([{name:"a_elevation_ground_scale",components:1,type:"Float32"}],4),{members:Md}=_d,Bd=Jo([{name:"a_packed",components:3,type:"Float32"}]),{members:Pd}=Bd,zd=Jo([{name:"a_pattern_data",components:3,type:"Float32"}]),{members:Td}=zd;class kd{constructor(e,t){this.width=e,this.height=t,this.nextRow=0,this.image=new Ic({width:e,height:t}),this.positions={},this.uploaded=!1}getDash(e,t){const r=this.getKey(e,t);return this.positions[r]}trim(){const e=this.width,t=this.height=function(e){return e<=1?1:Math.pow(2,Math.ceil(Math.log2(e)))}(this.nextRow);this.image.resize({width:e,height:t})}getKey(e,t){return e.join(",")+t}getDashRanges(e,t,r){const n=[];let i=e.length%2==1?-e.at(-1)*r:0,s=e[0]*r,o=!0;n.push({left:i,right:s,isDash:o,zeroLength:0===e[0]});let a=e[0];for(let l=1;l<e.length;l++){o=!o;const t=e[l];i=a*r,a+=t,s=a*r,n.push({left:i,right:s,isDash:o,zeroLength:0===t})}return n}addRoundDash(e,t,r){const n=t/2;for(let i=-r;i<=r;i++){const t=this.width*(this.nextRow+r+i);let s=0,o=e[s];for(let a=0;a<this.width;a++){a/o.right>1&&(o=e[++s]);const l=Math.abs(a-o.left),u=Math.abs(a-o.right),c=Math.min(l,u);let h;const p=i/r*(n+1);if(o.isDash){const e=n-Math.abs(p);h=Math.sqrt(c*c+e*e)}else h=n-Math.sqrt(c*c+p*p);this.image.data[t+a]=Math.max(0,Math.min(255,h+128))}}}addRegularDash(e,t){for(let a=e.length-1;a>=0;--a){const t=e[a],r=e[a+1];t.zeroLength?e.splice(a,1):r&&r.isDash===t.isDash&&(r.left=t.left,e.splice(a,1))}const r=e[0],n=e.at(-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,o=e[s];for(let a=0;a<this.width;a++){a/o.right>1&&(o=e[++s]);const r=Math.abs(a-o.left),n=Math.abs(a-o.right),l=Math.min(r,n);this.image.data[i+a]=Math.max(0,Math.min(255,(o.isDash?l:-l)+t+128))}}addDash(e,t){const r=this.getKey(e,t);if(this.positions[r])return this.positions[r];const n="round"===t,i=n?7:0,s=2*i+1;if(this.nextRow+s>this.height)return be("LineAtlas out of space"),null;0===e.length&&e.push(1);let o=0;for(let c=0;c<e.length;c++)e[c]<0&&(be("Negative value is found in line dasharray, replacing values with 0"),e[c]=0),o+=e[c];if(0!==o){const r=this.width/o,s=this.getDashRanges(e,this.width,r);n?this.addRoundDash(s,r,i):this.addRegularDash(s,"square"===t?.5*r:0)}const a=this.nextRow+i;this.nextRow+=s;const l=Math.floor(o),u={tl:[a,i],br:[l,Math.round(65535*(o-l))]};return this.positions[r]=u,u}}ps(kd,"LineAtlas");const Vd=eu.types,Ed=Math.cos(Math.PI/180*37.5),Dd=Math.cos(Math.PI/180*5);class Cd{constructor(e){this.evaluationGlobals={zoom:0,lineProgress:void 0},this.elevationType="none",this.isSeaLevelReference=!1,this.showElevationIdDebug=!1,this.zoom=e.zoom,this.evaluationGlobals.zoom=this.zoom,this.overscaling=e.overscaling,this.pixelRatio=e.pixelRatio,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.projection=e.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(e=>{this.gradients[e.id]={}}),this.layoutVertexArray=new aa,this.layoutVertexArray2=new la,this.patternVertexArray=new la,this.indexArray=new wa,this.programConfigurations=new vl(e.layers,{zoom:e.zoom,lut:e.lut}),this.segments=new Ka,this.maxLineLength=0,this.zOffsetVertexArray=new la,this.elevationIdColVertexArray=new la,this.elevationGroundScaleVertexArray=new ra,this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.tessellationStep=e.tessellationStep?e.tessellationStep:128,this.worldview=e.worldview,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,r,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,r,n){this.showElevationIdDebug=t.showElevationIdDebug,this.hasPattern=oh("line",this.layers,this.pixelRatio,t);const i=this.layers[0].layout.get("line-sort-key");this.tileToMeter=$l(r);const s=this.layers[0].layout.get("line-elevation-reference");if("hd-road-markup"===s)this.elevationType="road";else{const e=this.layers[0].layout.get("line-z-offset"),t=e.isConstant()&&!e.constantOr(0);this.elevationType="sea"!==s&&"ground"!==s&&t?"none":"offset","offset"===this.elevationType&&"none"===s&&be(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`),this.isSeaLevelReference="sea"===s}const o=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope="offset"===this.elevationType&&void 0!==o;const a=[];for(const{feature:h,id:p,index:d,sourceLayerIndex:f}of e){const e=this.layers[0]._featureFilter.needGeometry,s=Ql(h,e);if(!this.layers[0]._featureFilter.filter(new lo(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),s,r))continue;const o=i?i.evaluate(s,{},r):void 0,l={id:p,properties:h.properties,type:h.type,sourceLayerIndex:f,index:d,geometry:e?s.geometry:Kl(h,r,n),patterns:{},sortKey:o};a.push(l)}i&&a.sort((e,t)=>e.sortKey-t.sortKey);const{lineAtlas:l,featureIndex:u}=t,c=this.addConstantDashes(l);for(const h of a){const{geometry:n,index:i,sourceLayerIndex:s}=h;if(c&&this.addFeatureDashes(h,l),this.hasPattern){const e=ah("line",this.layers,h,this.zoom,this.pixelRatio,t);this.patternFeatures.push(e)}else this.addFeature(h,n,i,r,l.positions,t.availableImages,t.brightness,t.elevationFeatures);u.insert(e[i].feature,n,i,s,this.index)}}addConstantDashes(e){let t=!1;for(const r of this.layers){const n=r.paint.get("line-dasharray").value,i=r.layout.get("line-cap").value;if("constant"!==n.kind||"constant"!==i.kind)t=!0;else{const t=i.value,r=n.value;if(!r)continue;e.addDash(r,t)}}return t}addFeatureDashes(e,t){const r=this.zoom;for(const n of this.layers){const i=n.paint.get("line-dasharray").value,s=n.layout.get("line-cap").value;if("constant"===i.kind&&"constant"===s.kind)continue;let o,a;if("constant"===i.kind){if(o=i.value,!o)continue}else o=i.evaluate({zoom:r},e);a="constant"===s.kind?s.value:s.evaluate({zoom:r},e),t.addDash(o,a),e.patterns[n.id]=[t.getKey(o,a)]}}update(e,t,r,n,i,s,o,a,l){this.programConfigurations.updatePaintArrays(e,t,i,r,n,s,o,l)}updateExpressions(e){this.programConfigurations.updateExpressions(e)}addFeatures(e,t,r,n,i,s){for(const o of this.patternFeatures)this.addFeature(o,o.geometry,o.index,t,r,n,s,e.elevationFeatures)}isEmpty(){return 0===this.layoutVertexArray.length}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(e){this.uploaded||(0!==this.layoutVertexArray2.length&&(this.layoutVertexBuffer2=e.createVertexBuffer(this.layoutVertexArray2,Pd)),0!==this.patternVertexArray.length&&(this.patternVertexBuffer=e.createVertexBuffer(this.patternVertexArray,Td)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Id.members,!0)),!this.elevationIdColVertexBuffer&&this.elevationIdColVertexArray.length>0&&(this.elevationIdColVertexBuffer=e.createVertexBuffer(this.elevationIdColVertexArray,Ad.members,!0)),!this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexArray.length>0&&(this.elevationGroundScaleVertexBuffer=e.createVertexBuffer(this.elevationGroundScaleVertexArray,Sd.members,!0)),this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Md),this.indexBuffer=e.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(e),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.elevationIdColVertexBuffer&&this.elevationIdColVertexBuffer.destroy(),this.elevationGroundScaleVertexBuffer&&this.elevationGroundScaleVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(e,t){let r,n;if(t&&t>0?(r=`mapbox_clip_start_${t}`,n=`mapbox_clip_end_${t}`):(r="mapbox_clip_start",n="mapbox_clip_end"),e.properties&&Object.hasOwn(e.properties,r)&&Object.hasOwn(e.properties,n))return{start:+e.properties[r],end:+e.properties[n]}}addFeature(e,t,r,n,i,s,o,a){const l=this.layers[0].layout,u=l.get("line-join").evaluate(e,{}),c=l.get("line-cap").evaluate(e,{}),h=l.get("line-miter-limit"),p=l.get("line-round-limit");this.lineClips=this.lineFeatureClips(e),this.lineFeature=e;const d=!(!e.properties||!Object.hasOwn(e.properties,"mapbox_line_metrics"))&&e.properties.mapbox_line_metrics;this.zOffsetValue=l.get("line-z-offset").value;const f=this.layers[0].paint.get("line-width").value;if("constant"!==f.kind&&!1===f.isLineProgressConstant&&(this.variableWidthValue=f),this.isSeaLevelReference){const e=l.get("line-elevation-ground-scale").value;"constant"===e.kind&&0===e.value||(this.elevationGroundScaleValue=e)}if("road"===this.elevationType){const r=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(e,t,n,a,u,c,h,p)){const[i,s]=this.clipRuntimeLinesToTile(t,1);for(let t=0;t<i.length;t++){const r=i[t],o=s[t],a={progress:{min:o.progress.min,max:o.progress.max},nextDir:this.computeSegNextDir(o,r),prevDir:this.computeSegPrevDir(o,r)};this.addLine(r,e,n,u,c,h,p,a,d&&o.parentIndex>0?o.parentIndex:null)}this.fillNonElevatedRoadSegment(r)}}else for(let m=0;m<t.length;m++)this.addLine(t[m],e,n,u,c,h,p,void 0,d&&m>0?m:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,e,r,i,s,n,o,void 0,this.worldview)}computeSegNextDir(e,t){return e.nextPoint.sub(t.at(-2)).unit()}computeSegPrevDir(e,t){return t[1].sub(e.prevPoint).unit()}clipLinesToTile(e,t){return ud(e,-t,-t,tn+t,tn+t)}clipRuntimeLinesToTile(e,t){const r=[];return[ud(e,-t,-t,tn+t,tn+t,r),r]}addElevatedRoadFeature(e,t,r,n,i,s,o,a){const l=[],u=Au.getElevationFeature(e,n);if(u){const e=this.clipLinesToTile(t,1),n=this.prepareElevatedLines(e,u,r);for(const t of n)l.push({geometry:t,elevation:u,elevationTileID:r,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if(0===l.length)return!1;for(const c of l){const t=this.layoutVertexArray.length;this.addLine(c.geometry,e,r,i,s,o,a);const n=new Su(r,c.elevationTileID);if(c.elevation){const e=this.showElevationIdDebug?Mu(c.elevation.id):null;for(let r=t;r<this.layoutVertexArray.length;r++){const t=new oe(this.layoutVertexArray.int16[6*r]>>1,this.layoutVertexArray.int16[6*r+1]>>1),i=n.pointElevation(t,c.elevation,.05);this.updateHeightRange(i),this.zOffsetVertexArray.emplaceBack(i,0,0),e?this.elevationIdColVertexArray.emplaceBack(e[0],e[1],e[2]):this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)}}else this.fillNonElevatedRoadSegment(t)}return!0}prepareElevatedLines(e,t,r){if(null!=t.constantHeight)return e;const n=[],i=1/$l(r);for(const s of e)cd(s,new _u(t,i),0,n);return n}fillNonElevatedRoadSegment(e){for(let t=e;t<this.layoutVertexArray.length;t++)this.zOffsetVertexArray.emplaceBack(0,0,0),this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)}updateHeightRange(e){this.heightRange?(this.heightRange.min=Math.min(this.heightRange.min,e),this.heightRange.max=Math.max(this.heightRange.max,e)):this.heightRange={min:e,max:e}}addLine(e,t,r,n,i,s,o,a,l){this.distance=0,this.prevDistance=0,this.scaledDistance=0,this.totalDistance=0,this.totalFeatureLength=0,this.lineSoFar=0,this.currentVertex=void 0,this.lineClips=l?this.lineFeatureClips(t,l):this.lineClips;const u="none"===n;this.patternJoinNone=this.hasPattern&&u,this.currentLineJoinType=n,this.segmentStart=0,this.segmentStartf32=0,this.segmentPoints=[];const c=a&&a.progress.min>0,h=a&&a.progress.max<1;if(this.lineClips){let r={min:this.lineClips.start,max:this.lineClips.end},n=1;if(a){const e=this.lineClips.end-this.lineClips.start;p=a.progress,d={min:0,max:1},f=r,r={min:Te(p.min,d,f),max:Te(p.max,d,f)},e>0&&(n=(r.max-r.min)/e)}const i=+t.properties.mapbox_clip_feature_len,s=+t.properties.mapbox_clip_seg_len;if(Number.isNaN(i)||Number.isNaN(s)){for(let r=0;r<e.length-1;r++)this.totalDistance+=e[r].dist(e[r+1]);const t=this.totalDistance/(r.max-r.min);this.totalFeatureLength=Number.isFinite(t)?t:0,this.lineClips.start=r.min,this.lineClips.end=r.max,this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}else this.totalFeatureLength=i,this.distance=s*n,this.lineClips.start=r.min,this.lineClips.end=r.max,this.maxLineLength=Math.max(this.maxLineLength,this.distance);this.lineClipsArray.push(this.lineClips),this.updateScaledDistance()}var p,d,f;const m="Polygon"===Vd[t.type];let y=e.length;for(;y>=2&&e[y-1].equals(e[y-2]);)y--;let g=0;for(;g<y-1&&e[g].equals(e[g+1]);)g++;if(y<(m?3:2))return;"bevel"===n&&(s=1.05);const x=this.segments.prepareSegment(10*y,this.layoutVertexArray,this.indexArray);let v,b,w,_,I,A,S,M;a&&a.prevDir&&(A=a.prevDir.perp()),a&&a.nextDir&&(S=a.nextDir.perp()),this.e1=this.e2=-1,m&&(v=e[y-2],I=e[g].sub(v)._unit()._perp());for(let B=g;B<y;B++){if(w=B===y-1?m?e[g+1]:void 0:e[B+1],w&&e[B].equals(w))continue;I&&(_=I),v&&(b=v),v=e[B],M=this.evaluateLineProgressFeatures(b?b.dist(v):0),I=w?w.sub(v)._unit()._perp():_,_=_||I;const t=b&&w;let r=t?n:m||u?"butt":i;const a=_.x*I.x+_.y*I.y;if(u){const e=function(e){if(e.patternJoinNone){const t=e.segmentPoints.length/2,r=e.lineSoFar-e.segmentStart;for(let n=0;n<t;++n){const t=e.segmentPoints[2*n+1],i=Math.round(e.segmentPoints[2*n])+.5+.25*t;e.patternVertexArray.emplaceBack(i,r,e.segmentStart),e.patternVertexArray.emplaceBack(i,r,e.segmentStart)}e.segmentPoints.length=0}e.e1=e.e2=-1};if(t&&a<Dd){this.updateDistance(b,v),this.addCurrentVertex(v,_,1,1,x,M),e(this),this.addCurrentVertex(v,I,-1,-1,x,M);continue}if(b){if(!w){this.updateDistance(b,v),this.addCurrentVertex(v,_,1,1,x,M),e(this);continue}r="miter"}}let l=_.add(I);0===l.x&&0===l.y||l._unit();const p=l.x*I.x+l.y*I.y,d=0!==p?1/p:1/0,f=2*Math.sqrt(2-2*p),P=p<Ed&&b&&w,z=_.x*I.y-_.y*I.x>0,T=this.overscaling<=16?122880/(512*this.overscaling):0;if(t&&"round"===r)if(d<o)r="miter";else if(d<=2){const e=Fd(v,-10,8202);r="offset"===this.elevationType&&(e||this.hasCrossSlope)?"miter":"fakeround"}if("miter"===r&&d>s&&(r="bevel"),"bevel"===r&&(d>2&&(r="flipbevel"),d<s&&(r="miter")),b&&!("miter"===r&&P)&&this.updateDistance(b,v),"miter"===r)if(P){const e=v.dist(b);if(e>2*T){const t=v.sub(v.sub(b)._mult(T/e)._round());this.updateDistance(b,t),this.addCurrentVertex(t,_,0,0,x,M),b=t}this.updateDistance(b,v),l._mult(d),this.addCurrentVertex(v,l,0,0,x,M);const t=v.dist(w);if(t>2*T){const e=v.add(w.sub(v)._mult(T/t)._round());this.updateDistance(v,e),this.addCurrentVertex(e,I,0,0,x,M),v=e}}else l._mult(d),this.addCurrentVertex(v,l,0,0,x,M);else if("flipbevel"===r){if(d>100)l=I.mult(-1);else{const e=d*_.add(I).mag()/_.sub(I).mag();l._perp()._mult(e*(z?-1:1))}this.addCurrentVertex(v,l,0,0,x,M),this.addCurrentVertex(v,l.mult(-1),0,0,x,M)}else if("bevel"===r||"fakeround"===r){const e=v.dist(b);let t=1;if("offset"===this.elevationType&&"bevel"===r&&"round"!==this.currentLineJoinType&&!this.patternJoinNone&&null!=M&&b&&w){const r=4*T;e<r&&(t=Math.max(0,e/r))}null!=M&&b&&this.addCurrentVertex(v,S||_,-t,-t,x,M);const n=e<=2*T&&"bevel"!==r,i=l.mult(z?1:-1);i._mult(d);const s=I.mult(z?-1:1),o=_.mult(z?-1:1),u=this.evaluateLineProgressFeatures(this.distance);if(null==M&&(this.addHalfVertex(v,i.x,i.y,!1,!z,0,x,u),n||this.addHalfVertex(v,i.x+2*o.x,i.y+2*o.y,!1,z,0,x,u)),"fakeround"===r){const e=Math.round(180*f/Math.PI/20);this.addHalfVertex(v,o.x,o.y,!1,z,0,x,u);for(let t=0;t<e;t++){let r=t/e;if(.5!==r){const e=r-.5;r+=r*e*(r-1)*((1.0904+a*(a*(3.55645-1.43519*a)-3.2452))*e*e+(.848013+a*(.215638*a-1.06021)))}const n=s.sub(o)._mult(r)._add(o)._unit();this.addHalfVertex(v,n.x,n.y,!1,z,0,x,u)}this.addHalfVertex(v,s.x,s.y,!1,z,0,x,u)}n||null!=M||this.addHalfVertex(v,i.x+2*s.x,i.y+2*s.y,!1,z,0,x,u),null!=M&&w&&this.addCurrentVertex(v,A||I,t,t,x,M)}else if("butt"===r)this.addCurrentVertex(v,l,0,0,x,M);else if("square"===r){if(!b){const e=c?0:-1;this.addCurrentVertex(v,l,e,e,x,M)}if(this.addCurrentVertex(v,l,0,0,x,M),b){const e=h?0:1;this.addCurrentVertex(v,l,e,e,x,M)}}else if("round"===r){if(b){const e=!t&&S?S:_;this.addCurrentVertex(v,e,0,0,x,M),!t&&h||this.addCurrentVertex(v,e,1,1,x,M,!0)}if(w){const e=!t&&A?A:I;!t&&c||this.addCurrentVertex(v,e,-1,-1,x,M,!0),this.addCurrentVertex(v,e,0,0,x,M)}}}}addVerticesTo(e,t,r,n,i,s,o,a,l,u){const c=(t.w-e.w)/this.tessellationStep|0;let h=0;const p=this.scaledDistance;if(c>1){this.lineSoFar=e.w;const r=(t.x-e.x)/c,n=(t.y-e.y)/c,i=(t.z-e.z)/c,s=(t.w-e.w)/c,o=t.x-e.x,a=t.y-e.y,p=Math.sqrt(o*o+a*a);if(0===p)return;const d=-a/p,f=o/p,m=d,y=f,g=-d,x=-f;for(let t=1;t<c;++t){e.x+=r,e.y+=n,e.z+=i,this.lineSoFar+=s,h+=s;const t=this.evaluateLineProgressFeatures(this.prevDistance+h);this.scaledDistance=(this.prevDistance+h)/this.totalDistance,this.addHalfVertex(e,m,y,u,!1,0,l,t),this.addHalfVertex(e,g,x,u,!0,0,l,t)}}this.lineSoFar=t.w,this.scaledDistance=p;const d=this.evaluateLineProgressFeatures(this.distance);this.addHalfVertex(t,r,n,u,!1,o,l,d),this.addHalfVertex(t,i,s,u,!0,-a,l,d)}evaluateLineProgressFeatures(e){if(!this.variableWidthValue&&"offset"!==this.elevationType)return null;this.evaluationGlobals.lineProgress=0,this.lineClips?this.evaluationGlobals.lineProgress=Math.min(1,(this.totalFeatureLength*this.lineClips.start+e)/this.totalFeatureLength):be(`line-progress evaluation for ${this.layerIds[0]} requires enabling 'lineMetrics' for the source.`);let t=0;this.variableWidthValue&&"constant"!==this.variableWidthValue.kind&&(t=this.variableWidthValue.evaluate(this.evaluationGlobals,this.lineFeature)||0);const r=this.evaluateElevationGroundScale();return"offset"!==this.elevationType?{zOffset:0,variableWidth:t,elevationGroundScale:r}:"constant"===this.zOffsetValue.kind?{zOffset:this.zOffsetValue.value,variableWidth:t,elevationGroundScale:r}:{zOffset:this.zOffsetValue.evaluate(this.evaluationGlobals,this.lineFeature)||0,variableWidth:t,elevationGroundScale:r}}evaluateElevationGroundScale(){return this.elevationGroundScaleValue?"constant"===this.elevationGroundScaleValue.kind?this.elevationGroundScaleValue.value:this.elevationGroundScaleValue.evaluate(this.evaluationGlobals,this.lineFeature)||0:0}addCurrentVertex(e,t,r,n,i,s,o=!1){const a=t.x+t.y*r,l=t.y-t.x*r,u=t.y*n-t.x,c=-t.y-t.x*n;if(null!=s){const t="offset"===this.elevationType,h="offset"===this.elevationType?2:10,p=-h,d=tn+h,f=s.zOffset,m=new od(e.x,e.y,f,this.lineSoFar),y=!!t&&Fd(e,p,d),g=this.lineSoFar,x=this.distance;if(this.currentVertex)if(y){const t=this.currentVertexIsOutside,s=this.currentVertex,h=new od(e.x,e.y,f,this.lineSoFar);if(ld(s,h,p,d),!Fd(h,p,d)){if(t){this.e1=this.e2=-1,this.distance-=s.dist(m),this.lineSoFar=s.w;const e=this.evaluateLineProgressFeatures(s.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(s,a,l,o,!1,r,i,e),this.addHalfVertex(s,u,c,o,!0,-n,i,e),this.prevDistance=this.distance}this.distance=this.prevDistance+s.dist(h),this.scaledDistance=this.distance/this.totalDistance,this.addVerticesTo(s,h,a,l,u,c,r,n,i,o),this.distance=x,this.scaledDistance=this.distance/this.totalDistance}}else{const e=this.currentVertex;if(this.currentVertexIsOutside){ld(e,m,p,d),this.e1=this.e2=-1,this.distance-=e.dist(m),this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=e.w;const t=this.evaluateLineProgressFeatures(e.w-this.totalFeatureLength*(this.lineClips?this.lineClips.start:0));this.addHalfVertex(e,a,l,o,!1,r,i,t),this.addHalfVertex(e,u,c,o,!0,-n,i,t),this.prevDistance=this.distance,this.distance=x,this.scaledDistance=this.distance/this.totalDistance}this.addVerticesTo(e,m,a,l,u,c,r,n,i,o)}else y||(this.addHalfVertex(e,a,l,o,!1,r,i,s),this.addHalfVertex(e,u,c,o,!0,-n,i,s));this.currentVertex=m,this.currentVertexIsOutside=y,this.lineSoFar=g}else this.addHalfVertex(e,a,l,o,!1,r,i,s),this.addHalfVertex(e,u,c,o,!0,-n,i,s)}addHalfVertex({x:e,y:t},r,n,i,s,o,a,l){if(this.patternJoinNone&&(0===this.segmentPoints.length&&(this.segmentStart=this.lineSoFar,this.segmentStartf32=Math.fround(this.lineSoFar)),s||this.segmentPoints.push(this.lineSoFar-this.segmentStart,o)),this.layoutVertexArray.emplaceBack((e<<1)+(i?1:0),(t<<1)+(s?1:0),Math.round(63*r)+128,Math.round(63*n)+128,1+(0===o?0:o<0?-1:1),0,this.lineSoFar-this.segmentStartf32),this.lineClips){const e=Bt(this.lineClips.start,this.lineClips.end,this.scaledDistance);this.layoutVertexArray2.emplaceBack(this.scaledDistance,this.lineClipsArray.length,e)}const u=a.vertexLength++;if(this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,u),a.primitiveLength++),s?this.e2=u:this.e1=u,null!=l&&(this.zOffsetVertexArray.emplaceBack(l.zOffset,l.variableWidth,l.variableWidth),this.showElevationIdDebug&&this.elevationIdColVertexArray.emplaceBack(0,0,0)),this.elevationGroundScaleValue){const e=l?l.elevationGroundScale:this.evaluateElevationGroundScale();this.elevationGroundScaleVertexArray.emplaceBack(e)}}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(e,t){this.prevDistance=this.distance,this.distance+=e.dist(t),this.updateScaledDistance()}}function Fd(e,t,r){return e.x<t||e.x>r||e.y<t||e.y>r}let Ld,Rd;ps(Cd,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});let Od;const Ud=()=>Od||(Od={layout:Ld||(Ld=new wo({"line-cap":new vo(_o.layout_line["line-cap"]),"line-join":new vo(_o.layout_line["line-join"]),"line-miter-limit":new xo(_o.layout_line["line-miter-limit"]),"line-round-limit":new xo(_o.layout_line["line-round-limit"]),"line-sort-key":new vo(_o.layout_line["line-sort-key"]),"line-z-offset":new vo(_o.layout_line["line-z-offset"]),"line-elevation-reference":new xo(_o.layout_line["line-elevation-reference"]),"line-cross-slope":new xo(_o.layout_line["line-cross-slope"]),visibility:new xo(_o.layout_line.visibility),"line-width-unit":new xo(_o.layout_line["line-width-unit"]),"line-elevation-ground-scale":new vo(_o.layout_line["line-elevation-ground-scale"])})),paint:Rd||(Rd=new wo({"line-opacity":new vo(_o.paint_line["line-opacity"]),"line-color":new vo(_o.paint_line["line-color"]),"line-translate":new xo(_o.paint_line["line-translate"]),"line-translate-anchor":new xo(_o.paint_line["line-translate-anchor"]),"line-width":new vo(_o.paint_line["line-width"]),"line-gap-width":new vo(_o.paint_line["line-gap-width"]),"line-offset":new vo(_o.paint_line["line-offset"]),"line-blur":new vo(_o.paint_line["line-blur"]),"line-dasharray":new vo(_o.paint_line["line-dasharray"]),"line-pattern":new vo(_o.paint_line["line-pattern"]),"line-pattern-cross-fade":new xo(_o.paint_line["line-pattern-cross-fade"]),"line-gradient":new bo(_o.paint_line["line-gradient"]),"line-trim-offset":new xo(_o.paint_line["line-trim-offset"]),"line-trim-fade-range":new xo(_o.paint_line["line-trim-fade-range"]),"line-trim-color":new xo(_o.paint_line["line-trim-color"]),"line-emissive-strength":new vo(_o.paint_line["line-emissive-strength"]),"line-border-width":new vo(_o.paint_line["line-border-width"]),"line-border-color":new vo(_o.paint_line["line-border-color"]),"line-occlusion-opacity":new xo(_o.paint_line["line-occlusion-opacity"]),"line-blend-mode":new xo(_o.paint_line["line-blend-mode"]),"line-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"})}))},Od);class Nd extends vo{possiblyEvaluate(e,t){return t=new lo(Math.floor(t.zoom),{now:t.now,fadeDuration:t.fadeDuration,transition:t.transition,worldview:t.worldview}),super.possiblyEvaluate(e,t)}evaluate(e,t,r,n){return t=Object.assign({},t,{zoom:Math.floor(t.zoom)}),super.evaluate(e,t,r,n)}}let jd;function $d(e,t){return t>0?t+2*e:e}const Gd=Jo([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Xd=Jo([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),qd=Jo([{name:"a_projected_pos",components:4,type:"Float32"}],4);Jo([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Hd=Jo([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),Zd=Jo([{name:"a_feature_index",components:1,type:"Float32"}],4),Yd=Jo([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),Wd=Jo([{name:"a_texb",components:2,type:"Uint16"}]),Jd=Jo([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),Kd=Jo([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Jo([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Qd=Jo([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4);Jo([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4),Jo([{name:"triangle",components:3,type:"Uint16"}]),Jo([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),Jo([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"},{type:"Uint16",name:"elevationFeatureIndex"}]),Jo([{type:"Float32",name:"offsetX"}]),Jo([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);const ef=class e{constructor(t=null,r=0,n=4096){if(this.batchIndex=r,this.headerBuffer=null,this.propertiesBuffer=null,this.blockIndicesBuffer=null,this.context=t||null,this.propsDwords=n,this.totalBytes=4*this.propsDwords,this.headerData=new Uint32Array(e.HEADER_DWORDS),this.propertiesData=new Float32Array(this.propsDwords),!e._blockIndicesTemplate){e._blockIndicesTemplate=new Uint32Array(this.propsDwords);for(let t=0;t<this.propsDwords;t++)e._blockIndicesTemplate[t]=t}this.blockIndicesData=new Uint32Array(e._blockIndicesTemplate),t&&this._initBuffers(t)}_initBuffers(t){const r=t.gl;if(this.totalBytes>t.maxUniformBlockSize)throw new Error(`UBO size ${this.totalBytes} exceeds device limit ${t.maxUniformBlockSize}`);if(this.headerBuffer=r.createBuffer(),!this.headerBuffer)throw new Error("Failed to create header UBO buffer");if(r.bindBuffer(r.UNIFORM_BUFFER,this.headerBuffer),r.bufferData(r.UNIFORM_BUFFER,e.HEADER_BYTES,r.DYNAMIC_DRAW),this.propertiesBuffer=r.createBuffer(),!this.propertiesBuffer)throw new Error("Failed to create properties UBO buffer");if(r.bindBuffer(r.UNIFORM_BUFFER,this.propertiesBuffer),r.bufferData(r.UNIFORM_BUFFER,this.totalBytes,r.DYNAMIC_DRAW),this.blockIndicesBuffer=r.createBuffer(),!this.blockIndicesBuffer)throw new Error("Failed to create block-indices UBO buffer");r.bindBuffer(r.UNIFORM_BUFFER,this.blockIndicesBuffer),r.bufferData(r.UNIFORM_BUFFER,this.totalBytes,r.DYNAMIC_DRAW),r.bindBuffer(r.UNIFORM_BUFFER,null)}writeHeader(e){const t=this.headerData;t[0]=e.dataDrivenMask,t[1]=e.zoomDependentMask,t[2]=e.dataDrivenBlockSizeVec4,t[3]=e.offsets[0],t[4]=e.offsets[1],t[5]=e.offsets[2],t[6]=e.offsets[3],t[7]=e.offsets[4],t[8]=e.offsets[5],t[9]=e.offsets[6],t[10]=e.offsets[7],t[11]=e.offsets[8]}writeDataDrivenBlock(t,r,n){const i=4*n.dataDrivenBlockSizeVec4;if(0===i)return;const s=r*i;if(s+i>this.propertiesData.length)throw new Error(`UBO write out of bounds: feature index ${r} exceeds propertiesData capacity`);for(let o=0;o<9;o++)n.dataDrivenMask&1<<o&&this._copyFromFlat(s+n.offsets[o],o,t,e.EVAL_FLAT_OFFSETS[o],n.zoomDependentMask)}static getMaxFeatureCount(e,t=4096){const r=4*e.dataDrivenBlockSizeVec4;return 0===r?1/0:Math.floor(t/r)}_copyFromFlat(e,t,r,n,i){const s=this.propertiesData,o=8===t,a=!!(i&1<<t);t<2||o&&a?(s[e]=r[n],s[e+1]=r[n+1],s[e+2]=r[n+2],s[e+3]=r[n+3]):o||a?(s[e]=r[n],s[e+1]=r[n+1]):s[e]=r[n]}upload(e){this.context||(this.context=e);const t=e.gl;this.headerBuffer&&this.propertiesBuffer&&this.blockIndicesBuffer||this._initBuffers(e),t.bindBuffer(t.UNIFORM_BUFFER,this.headerBuffer),t.bufferSubData(t.UNIFORM_BUFFER,0,this.headerData),t.bindBuffer(t.UNIFORM_BUFFER,this.propertiesBuffer),t.bufferSubData(t.UNIFORM_BUFFER,0,this.propertiesData),t.bindBuffer(t.UNIFORM_BUFFER,this.blockIndicesBuffer),t.bufferSubData(t.UNIFORM_BUFFER,0,this.blockIndicesData),t.bindBuffer(t.UNIFORM_BUFFER,null)}bind(e,t){const r=e.gl,n=(e,n,i)=>{if(!n)return;const s=r.getUniformBlockIndex(t,e);s!==r.INVALID_INDEX&&(r.uniformBlockBinding(t,s,i),r.bindBufferBase(r.UNIFORM_BUFFER,i,n))},i=3*this.batchIndex;n("SymbolPaintPropertiesHeaderUniform",this.headerBuffer,i),n("SymbolPaintPropertiesUniform",this.propertiesBuffer,i+1),n("SymbolPaintPropertiesIndexUniform",this.blockIndicesBuffer,i+2)}destroy(){if(this.context){const e=this.context.gl;this.headerBuffer&&(e.deleteBuffer(this.headerBuffer),this.headerBuffer=null),this.propertiesBuffer&&(e.deleteBuffer(this.propertiesBuffer),this.propertiesBuffer=null),this.blockIndicesBuffer&&(e.deleteBuffer(this.blockIndicesBuffer),this.blockIndicesBuffer=null)}}};ef.HEADER_DWORDS=12,ef.HEADER_BYTES=48,ef.EVAL_FLAT_OFFSETS=[0,4,8,10,12,14,16,18,20],ef.EVAL_FLAT_SIZES=[4,4,2,2,2,2,2,2,4],ef.EVAL_FLAT_TOTAL=24,ef._blockIndicesTemplate=null;let tf=ef;function rf(e,t,r,n,i,s,o,a){return!!e&&("constant"===e.kind?"none"===e.value:"composite"===e.kind||"source"===e.kind?"none"===e.evaluate({zoom:0,brightness:s,worldview:a},t,r,i,n,o):"string"==typeof e&&"none"===e)}ps(tf,"SymbolPropertiesUBO",{omit:["headerBuffer","propertiesBuffer","blockIndicesBuffer"]});class nf{constructor(e,t,r,n,i="",s,o){this.layer=e,this.zoom=t,this.lut=r,this.isText=n,this.propDefs=this._getPropDefs(),this.worldview=i,this.maxUniformBufferBindings=s||24,this.uboSizeDwords=o||4096,this.featureVertexRangesFromId=/* @__PURE__ */new Map,this.allFeatures=[],this.ubos=[],this.featureCount=0,this.cachedHeader=null,this.maxFeaturesPerBatch=0,this.propertyHashToUBOIndex=/* @__PURE__ */new Map,this.canDeduplicate=this._checkIfAllPropertiesAreConstant(e,n),this.cachedParams=null,this.cachedParamsNext=null,this.cachedBrightness=void 0,this.cachedConstantUniforms=null,this.cachedConstantRenderZoom=null,this.cachedConstantBrightness=void 0,this.activeAppearanceByVtIndex=/* @__PURE__ */new Map,this.isLightConstant=!0,this._evalFlat=new Float32Array(tf.EVAL_FLAT_TOTAL)}_getPropDefs(){const e=this.isText?"text":"icon";return[{name:`${e}-color`,useThemeName:`${e}-color-use-theme`,isColor:!0},{name:`${e}-halo-color`,useThemeName:`${e}-halo-color-use-theme`,isColor:!0},{name:`${e}-opacity`,useThemeName:null,isColor:!1},{name:`${e}-halo-width`,useThemeName:null,isColor:!1},{name:`${e}-halo-blur`,useThemeName:null,isColor:!1},{name:`${e}-emissive-strength`,useThemeName:null,isColor:!1},{name:`${e}-occlusion-opacity`,useThemeName:null,isColor:!1},{name:"symbol-z-offset",useThemeName:null,isColor:!1},{name:`${e}-translate`,useThemeName:null,isColor:!1,isVec2:!0}]}buildHeader(){const e=this.layer.paint,t=this.propDefs;let r=0,n=0,i=0,s=0,o=!0;const a=[0,0,0,0,0,0,0,0,0];for(let u=0;u<9;u++){const{name:l,isColor:c,isVec2:h}=t[u],p=e.get(l),d=!(!p||"function"!=typeof p.isConstant||p.isConstant()),f=this._appearancesHavePaintProperties(l),m=d||f,y=!(!p||!p.value||"composite"!==p.value.kind),g=this.layer._transitionablePaint._values[l],x=!m&&"camera"===(g&&g.value&&g.value.expression&&g.value.expression.kind);if(m){r|=1<<u,y&&(n|=1<<u);const e=p&&p.value;e&&!1===e.isLightConstant&&(o=!1),c?(s%4!=0&&(s=s+3&-4),a[u]=s,s+=4):h?y?(s%4!=0&&(s=s+3&-4),a[u]=s,s+=4):(s%4==3&&s++,a[u]=s,s+=2):(a[u]=s,s+=y?2:1)}else x&&(i|=1<<u)}const l=(0===s?0:s+3&-4)/4;return this.isLightConstant=o,{dataDrivenMask:r,zoomDependentMask:n,cameraMask:i,dataDrivenBlockSizeVec4:l,offsets:a}}get hasCameraExpression(){return!(!this.cachedHeader||!this.cachedHeader.cameraMask)}evaluateAllProperties(e,t,r,n,i,s,o){const{params:a,paramsNext:l}=this._getCachedParams(i),u={feature:e,featureState:t,canonical:r,availableImages:n,params:a,paramsNext:l,formattedSection:s},c=this.cachedHeader,h=this.propDefs;this._evalFlat||(this._evalFlat=new Float32Array(tf.EVAL_FLAT_TOTAL));const p=this._evalFlat;for(let d=0;d<9;d++){const{name:e,useThemeName:t,isColor:r,isVec2:n}=h[d],s=!!(c&&c.zoomDependentMask&1<<d),a=tf.EVAL_FLAT_OFFSETS[d];r?this._evaluateColorValue(e,t,u,i,s,o,p,a):n?this._evaluateTranslateValue(e,s,u,o,p,a):this._evaluateFloatValue(e,s,u,o,p,a)}return p}_evaluateColorValue(e,t,r,n,i,s,o,a){const l=this.layer.paint,u=e,c=s&&s.hasPaintProperty(u)?s.paintProperties.get(u):l.get(e),h=t,p=t&&s&&s.hasPaintProperty(h)?s.paintProperties.get(h):t?l.get(t):void 0;if(!c)return o[a]=0,o[a+1]=0,o[a+2]=0,void(o[a+3]=1);const d=rf(p&&"string"!=typeof p?p.value:void 0,r.feature,r.featureState,r.availableImages,r.canonical,n,r.formattedSection,this.worldview)?null:this.lut;let f,m;c.isConstant()?f=m=c.constantOr(Pt.transparent):(f=c.property.evaluate(c.value,r.params,r.feature,r.featureState,r.canonical,r.availableImages,c.iconImageUseTheme,r.formattedSection),m=i?c.property.evaluate(c.value,r.paramsNext,r.feature,r.featureState,r.canonical,r.availableImages,c.iconImageUseTheme,r.formattedSection):f);const y=(f||Pt.transparent).toNonPremultipliedRenderColor(d);if(o[a]=Qa(255*y.r,255*y.g),o[a+1]=Qa(255*y.b,255*y.a),i){const e=(m||Pt.transparent).toNonPremultipliedRenderColor(d);o[a+2]=Qa(255*e.r,255*e.g),o[a+3]=Qa(255*e.b,255*e.a)}else o[a+2]=0,o[a+3]=0}_evaluateFloatValue(e,t,r,n,i,s){const o=this.layer.paint,a=e.endsWith("opacity")?1:0,l=e,u=n&&n.hasPaintProperty(l)?n.paintProperties.get(l):o.get(e);if(!u)return i[s]=a,void(i[s+1]=0);if(u.isConstant())return i[s]=u.constantOr(a),void(i[s+1]=0);const c=u.property.evaluate(u.value,r.params,r.feature,r.featureState,r.canonical,r.availableImages,u.iconImageUseTheme,r.formattedSection);if(i[s]=null!=c?c:a,t){const e=u.property.evaluate(u.value,r.paramsNext,r.feature,r.featureState,r.canonical,r.availableImages,u.iconImageUseTheme,r.formattedSection);i[s+1]=null!=e?e:a}else i[s+1]=0}_evaluateTranslateValue(e,t,r,n,i,s){const o=this.layer.paint,a=e,l=n&&n.hasPaintProperty(a)?n.paintProperties.get(a):o.get(e);if(!l)return i[s]=0,i[s+1]=0,i[s+2]=0,void(i[s+3]=0);if("function"!=typeof l.isConstant){const e=l||[0,0];return i[s]=e[0],i[s+1]=e[1],i[s+2]=0,void(i[s+3]=0)}if(l.isConstant()){const e=l.constantOr([0,0]);return i[s]=e[0],i[s+1]=e[1],i[s+2]=0,void(i[s+3]=0)}const u=l.property.evaluate(l.value,r.params,r.feature,r.featureState,r.canonical,r.availableImages,l.iconImageUseTheme,r.formattedSection)||[0,0];if(i[s]=u[0],i[s+1]=u[1],t){const e=l.property.evaluate(l.value,r.paramsNext,r.feature,r.featureState,r.canonical,r.availableImages,l.iconImageUseTheme,r.formattedSection)||[0,0];i[s+2]=e[0],i[s+3]=e[1]}else i[s+2]=0,i[s+3]=0}_getCachedParams(e){return this.cachedParams&&this.cachedParamsNext&&this.cachedBrightness===e||(this.cachedParams=new lo(this.zoom,{brightness:e,worldview:this.worldview}),this.cachedParamsNext=new lo(this.zoom+1,{brightness:e,worldview:this.worldview}),this.cachedBrightness=e),{params:this.cachedParams,paramsNext:this.cachedParamsNext}}_appearancesHavePaintProperties(e){return this.layer.getAppearances().some(void 0!==e?t=>t.hasPaintProperty(e):this.isText?e=>e.hasTextPaintProperties():e=>e.hasIconPaintProperties())}_checkIfAllPropertiesAreConstant(e,t){const r=e.paint,n=t?"text":"icon",i=[`${n}-color`,`${n}-halo-color`,`${n}-opacity`,`${n}-halo-width`,`${n}-halo-blur`,`${n}-emissive-strength`,`${n}-occlusion-opacity`,"symbol-z-offset",`${n}-translate`];for(const s of i){const e=r.get(s);if(e&&"object"==typeof e&&"isConstant"in e&&!e.isConstant())return!1}return!this._appearancesHavePaintProperties()}_hashDataDrivenValues(e,t){if(0===t.dataDrivenMask)return"";const r=[];for(let n=0;n<this.propDefs.length;n++){if(!(t.dataDrivenMask&1<<n))continue;const i=tf.EVAL_FLAT_OFFSETS[n],s=tf.EVAL_FLAT_SIZES[n];let o=String(e[i]);for(let t=1;t<s;t++)o+=`,${String(e[i+t])}`;r.push(o)}return r.join("|")}getCurrentBatchIndex(){return this.cachedHeader&&0!==this.maxFeaturesPerBatch?Math.floor(this.featureCount/this.maxFeaturesPerBatch):0}populateUBO(e,t,r,n,i,s,o){const a=e.id;if(!this.cachedHeader){this.cachedHeader=this.buildHeader();const e=tf.getMaxFeatureCount(this.cachedHeader,this.uboSizeDwords);this.maxFeaturesPerBatch=isFinite(e)?e:Number.MAX_SAFE_INTEGER}const l=this.cachedHeader,u=this.evaluateAllProperties(e,{},r,n,i,s);if(this.canDeduplicate){const e=this._hashDataDrivenValues(u,l),r=this.propertyHashToUBOIndex.get(e);if(void 0!==r){const e=isFinite(this.maxFeaturesPerBatch)?Math.floor(r/this.maxFeaturesPerBatch):0,n=isFinite(this.maxFeaturesPerBatch)?r%this.maxFeaturesPerBatch:r,i={batchIndex:e,localFeatureIndex:n,vtFeatureIndex:t,featureId:a};return this.allFeatures.push(i),null!=a&&(this.featureVertexRangesFromId.has(a)||this.featureVertexRangesFromId.set(a,[]),this.featureVertexRangesFromId.get(a).push(i)),n}this.propertyHashToUBOIndex.set(e,this.featureCount)}const c=this.featureCount++,h=isFinite(this.maxFeaturesPerBatch)?Math.floor(c/this.maxFeaturesPerBatch):0,p=isFinite(this.maxFeaturesPerBatch)?c%this.maxFeaturesPerBatch:c,d=o?o.maxUniformBufferBindings:this.maxUniformBufferBindings;if(3*h+2>=d){be(`Too many symbol features: batch ${h} requires binding points up to ${3*h+2}, device limit ${d}. Some features will render incorrectly.`);const e={batchIndex:0,localFeatureIndex:0,vtFeatureIndex:t,featureId:a};return this.allFeatures.push(e),null!=a&&(this.featureVertexRangesFromId.has(a)||this.featureVertexRangesFromId.set(a,[]),this.featureVertexRangesFromId.get(a).push(e)),0}this.ubos[h]||(this.ubos[h]=new tf(o,h,this.uboSizeDwords),this.ubos[h].writeHeader(l)),this.ubos[h].writeDataDrivenBlock(u,p,l);const f={batchIndex:h,localFeatureIndex:p,vtFeatureIndex:t,featureId:a};return this.allFeatures.push(f),null!=a&&(this.featureVertexRangesFromId.has(a)||this.featureVertexRangesFromId.set(a,[]),this.featureVertexRangesFromId.get(a).push(f)),p}updateFeatures(e,t,r,n,i,s,o){if(this.layer=t,this.cachedConstantUniforms=null,!this.cachedHeader)return;const a=this.cachedHeader;for(const l of e){const e=this.featureVertexRangesFromId.get(l);if(!e)continue;const t=s[l]||{};for(const s of e){if(!r)continue;const e=r.feature(s.vtFeatureIndex);if(!e)continue;const u={type:e.type,id:l,properties:e.properties||{},geometry:[]},c=this.activeAppearanceByVtIndex?this.activeAppearanceByVtIndex.get(s.vtFeatureIndex):void 0,h=this.evaluateAllProperties(u,t,n,i,o,void 0,c);this.ubos[s.batchIndex]&&this.ubos[s.batchIndex].writeDataDrivenBlock(h,s.localFeatureIndex,a)}}}updateDynamicExpressions(e,t,r,n,i,s){if(this.layer=e,this.cachedConstantUniforms=null,!this.cachedHeader)return;if(0===this.cachedHeader.dataDrivenMask)return;const o=this.cachedHeader;for(const a of this.allFeatures){if(!t)continue;const e=t.feature(a.vtFeatureIndex);if(!e)continue;const l=null!=a.featureId&&i[a.featureId]||{},u={type:e.type,id:a.featureId,properties:e.properties||{},geometry:[]},c=this.activeAppearanceByVtIndex?this.activeAppearanceByVtIndex.get(a.vtFeatureIndex):void 0,h=this.evaluateAllProperties(u,l,r,n,s,void 0,c);this.ubos[a.batchIndex]&&this.ubos[a.batchIndex].writeDataDrivenBlock(h,a.localFeatureIndex,o)}}updateFeaturePaintForAppearance(e,t,r,n,i,s,o){if(!this.layer)return!1;if(this.activeAppearanceByVtIndex||(this.activeAppearanceByVtIndex=/* @__PURE__ */new Map),this.activeAppearanceByVtIndex.set(e,o||null),!this.cachedHeader)return!1;const a=this.cachedHeader;if(0===a.dataDrivenMask)return!1;let l=!1;for(const u of this.allFeatures){if(u.vtFeatureIndex!==e)continue;const c=this.evaluateAllProperties(t,r,n,i,s,void 0,o);this.ubos[u.batchIndex]&&(this.ubos[u.batchIndex].writeDataDrivenBlock(c,u.localFeatureIndex,a),l=!0)}return l}getConstantUniformValues(e,t){const r=this.cachedHeader,n=!(!r||!r.cameraMask);if(this.cachedConstantUniforms&&this.cachedConstantBrightness===t&&(!n||this.cachedConstantRenderZoom===e))return this.cachedConstantUniforms;const i=this.layer.paint,s=this.propDefs,o=n?new lo(e,{brightness:t,worldview:this.worldview}):null,a={type:1,id:void 0,properties:{},geometry:[]},l=e=>{const n=s[e],l=i.get(n.name);if(!l)return[0,0,0,1];const u=n.useThemeName?i.get(n.useThemeName):void 0,c=rf(u&&"string"!=typeof u?u.value:void 0,a,{},[],void 0,t,void 0,this.worldview)?null:this.lut;let h;h=r&&r.cameraMask&1<<e&&o?l.property.evaluate(l.value,o,a,{},void 0,[]):l.constantOr(Pt.transparent);const p=(h||Pt.transparent).toNonPremultipliedRenderColor(c);return[p.r,p.g,p.b,p.a]},u=(e,t)=>{const n=i.get(s[e].name);if(!n)return t;if(r&&r.cameraMask&1<<e&&o){const e=n.property.evaluate(n.value,o,a,{},void 0,[]);return null!=e?e:t}return n.constantOr(t)},c={fill_np_color:l(0),halo_np_color:l(1),opacity:u(2,1),halo_width:u(3,0),halo_blur:u(4,0),emissive_strength:u(5,0),occlusion_opacity:u(6,1),z_offset:u(7,0)};return this.cachedConstantUniforms=c,this.cachedConstantRenderZoom=e,this.cachedConstantBrightness=t,c}upload(e){for(const t of this.ubos)t.upload(e)}bind(e,t,r=0){this.ubos[r]&&this.ubos[r].bind(e,t)}destroy(){for(const e of this.ubos)e.destroy();this.ubos=[],this.featureVertexRangesFromId.clear(),this.allFeatures=[],this.featureCount=0,this.cachedHeader=null,this.maxFeaturesPerBatch=0,this.propertyHashToUBOIndex&&this.propertyHashToUBOIndex.clear()}}ps(nf,"SymbolPropertyBinderUBO",{omit:["layer","cachedParams","cachedParamsNext","cachedBrightness","propertyHashToUBOIndex","cachedConstantUniforms","cachedConstantRenderZoom","cachedConstantBrightness","activeAppearanceByVtIndex","_evalFlat"]});const sf=24;function of(e,t,r){return e.sections.forEach(e=>{e.text=function(e,t,r){const n=t.layout.get("text-transform").evaluate(r,{});return"uppercase"===n?e=e.toLocaleUpperCase():"lowercase"===n&&(e=e.toLocaleLowerCase()),ao.applyArabicShaping&&(e=ao.applyArabicShaping(e)),e}(e.text,t,r)}),e}const af={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function lf(e){return"︶"===e||"﹈"===e||"︸"===e||"﹄"===e||"﹂"===e||"︾"===e||"︼"===e||"︺"===e||"︘"===e||"﹀"===e||"︐"===e||"︓"===e||"︔"===e||"`"===e||" ̄"===e||"︑"===e||"︒"===e}function uf(e){return"︵"===e||"﹇"===e||"︷"===e||"﹃"===e||"﹁"===e||"︽"===e||"︻"===e||"︹"===e||"︗"===e||"︿"===e}const cf=4294967296,hf=1/cf,pf="undefined"==typeof TextDecoder?null:new TextDecoder("utf-8");let df=class{constructor(e=new Uint8Array(16)){this.buf=ArrayBuffer.isView(e)?e:new Uint8Array(e),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(e,t,r=this.length){for(;this.pos<r;){const r=this.readVarint(),n=r>>3,i=this.pos;this.type=7&r,e(n,t,this),this.pos===i&&this.skip(r)}return t}readMessage(e,t){return this.readFields(e,t,this.readVarint()+this.pos)}readFixed32(){const e=this.dataView.getUint32(this.pos,!0);return this.pos+=4,e}readSFixed32(){const e=this.dataView.getInt32(this.pos,!0);return this.pos+=4,e}readFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*cf;return this.pos+=8,e}readSFixed64(){const e=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*cf;return this.pos+=8,e}readFloat(){const e=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,e}readDouble(){const e=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,e}readVarint(e){const t=this.buf;let r,n;return n=t[this.pos++],r=127&n,n<128?r:(n=t[this.pos++],r|=(127&n)<<7,n<128?r:(n=t[this.pos++],r|=(127&n)<<14,n<128?r:(n=t[this.pos++],r|=(127&n)<<21,n<128?r:(n=t[this.pos],r|=(15&n)<<28,function(e,t,r){const n=r.buf;let i,s;if(s=n[r.pos++],i=(112&s)>>4,s<128)return ff(e,i,t);if(s=n[r.pos++],i|=(127&s)<<3,s<128)return ff(e,i,t);if(s=n[r.pos++],i|=(127&s)<<10,s<128)return ff(e,i,t);if(s=n[r.pos++],i|=(127&s)<<17,s<128)return ff(e,i,t);if(s=n[r.pos++],i|=(127&s)<<24,s<128)return ff(e,i,t);if(s=n[r.pos++],i|=(1&s)<<31,s<128)return ff(e,i,t);throw new Error("Expected varint not more than 10 bytes")}(r,e,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const e=this.readVarint();return e%2==1?(e+1)/-2:e/2}readBoolean(){return Boolean(this.readVarint())}readString(){const e=this.readVarint()+this.pos,t=this.pos;return this.pos=e,e-t>=12&&pf?pf.decode(this.buf.subarray(t,e)):function(e,t,r){let n="",i=t;for(;i<r;){const t=e[i];let s,o,a,l=null,u=t>239?4:t>223?3:t>191?2:1;if(i+u>r)break;1===u?t<128&&(l=t):2===u?(s=e[i+1],128==(192&s)&&(l=(31&t)<<6|63&s,l<=127&&(l=null))):3===u?(s=e[i+1],o=e[i+2],128==(192&s)&&128==(192&o)&&(l=(15&t)<<12|(63&s)<<6|63&o,(l<=2047||l>=55296&&l<=57343)&&(l=null))):4===u&&(s=e[i+1],o=e[i+2],a=e[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(l=(15&t)<<18|(63&s)<<12|(63&o)<<6|63&a,(l<=65535||l>=1114112)&&(l=null))),null===l?(l=65533,u=1):l>65535&&(l-=65536,n+=String.fromCharCode(l>>>10&1023|55296),l=56320|1023&l),n+=String.fromCharCode(l),i+=u}return n}(this.buf,t,e)}readBytes(){const e=this.readVarint()+this.pos,t=this.buf.subarray(this.pos,e);return this.pos=e,t}readPackedVarint(e=[],t){const r=this.readPackedEnd();for(;this.pos<r;)e.push(this.readVarint(t));return e}readPackedSVarint(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSVarint());return e}readPackedBoolean(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readBoolean());return e}readPackedFloat(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFloat());return e}readPackedDouble(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readDouble());return e}readPackedFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed32());return e}readPackedSFixed32(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed32());return e}readPackedFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readFixed64());return e}readPackedSFixed64(e=[]){const t=this.readPackedEnd();for(;this.pos<t;)e.push(this.readSFixed64());return e}readPackedEnd(){return 2===this.type?this.readVarint()+this.pos:this.pos+1}skip(e){const t=7&e;if(0===t)for(;this.buf[this.pos++]>127;);else if(2===t)this.pos=this.readVarint()+this.pos;else if(5===t)this.pos+=4;else{if(1!==t)throw new Error(`Unimplemented type: ${t}`);this.pos+=8}}writeTag(e,t){this.writeVarint(e<<3|t)}realloc(e){let t=this.length||16;for(;t<this.pos+e;)t*=2;if(t!==this.length){const e=new Uint8Array(t);e.set(this.buf),this.buf=e,this.dataView=new DataView(e.buffer),this.length=t}}finish(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)}writeFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeSFixed32(e){this.realloc(4),this.dataView.setInt32(this.pos,e,!0),this.pos+=4}writeFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*hf),!0),this.pos+=8}writeSFixed64(e){this.realloc(8),this.dataView.setInt32(this.pos,-1&e,!0),this.dataView.setInt32(this.pos+4,Math.floor(e*hf),!0),this.pos+=8}writeVarint(e){(e=+e||0)>268435455||e<0?function(e,t){let r,n;if(e>=0?(r=e%4294967296|0,n=e/4294967296|0):(r=~(-e%4294967296),n=~(-e/4294967296),4294967295^r?r=r+1|0:(r=0,n=n+1|0)),e>=0x10000000000000000||e<-0x10000000000000000)throw new Error("Given varint doesn't fit into 10 bytes");var i,s;t.realloc(10),i=r,(s=t).buf[s.pos++]=127&i|128,i>>>=7,s.buf[s.pos++]=127&i|128,i>>>=7,s.buf[s.pos++]=127&i|128,i>>>=7,s.buf[s.pos++]=127&i|128,s.buf[s.pos]=127&(i>>>=7),function(e,t){const r=(7&e)<<4;t.buf[t.pos++]|=r|((e>>>=3)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e|((e>>>=7)?128:0),e&&(t.buf[t.pos++]=127&e)))))}(n,t)}(e,this):(this.realloc(4),this.buf[this.pos++]=127&e|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=127&(e>>>=7)|(e>127?128:0),e<=127||(this.buf[this.pos++]=e>>>7&127))))}writeSVarint(e){this.writeVarint(e<0?2*-e-1:2*e)}writeBoolean(e){this.writeVarint(+e)}writeString(e){e=String(e),this.realloc(4*e.length),this.pos++;const t=this.pos;this.pos=function(e,t,r){for(let n,i,s=0;s<t.length;s++){if(n=t.charCodeAt(s),n>55295&&n<57344){if(!i){n>56319||s+1===t.length?(e[r++]=239,e[r++]=191,e[r++]=189):i=n;continue}if(n<56320){e[r++]=239,e[r++]=191,e[r++]=189,i=n;continue}n=i-55296<<10|n-56320|65536,i=null}else i&&(e[r++]=239,e[r++]=191,e[r++]=189,i=null);n<128?e[r++]=n:(n<2048?e[r++]=n>>6|192:(n<65536?e[r++]=n>>12|224:(e[r++]=n>>18|240,e[r++]=n>>12&63|128),e[r++]=n>>6&63|128),e[r++]=63&n|128)}return r}(this.buf,e,this.pos);const r=this.pos-t;r>=128&&mf(t,r,this),this.pos=t-1,this.writeVarint(r),this.pos+=r}writeFloat(e){this.realloc(4),this.dataView.setFloat32(this.pos,e,!0),this.pos+=4}writeDouble(e){this.realloc(8),this.dataView.setFloat64(this.pos,e,!0),this.pos+=8}writeBytes(e){const t=e.length;this.writeVarint(t),this.realloc(t);for(let r=0;r<t;r++)this.buf[this.pos++]=e[r]}writeRawMessage(e,t){this.pos++;const r=this.pos;e(t,this);const n=this.pos-r;n>=128&&mf(r,n,this),this.pos=r-1,this.writeVarint(n),this.pos+=n}writeMessage(e,t,r){this.writeTag(e,2),this.writeRawMessage(t,r)}writePackedVarint(e,t){t.length&&this.writeMessage(e,yf,t)}writePackedSVarint(e,t){t.length&&this.writeMessage(e,gf,t)}writePackedBoolean(e,t){t.length&&this.writeMessage(e,bf,t)}writePackedFloat(e,t){t.length&&this.writeMessage(e,xf,t)}writePackedDouble(e,t){t.length&&this.writeMessage(e,vf,t)}writePackedFixed32(e,t){t.length&&this.writeMessage(e,wf,t)}writePackedSFixed32(e,t){t.length&&this.writeMessage(e,_f,t)}writePackedFixed64(e,t){t.length&&this.writeMessage(e,If,t)}writePackedSFixed64(e,t){t.length&&this.writeMessage(e,Af,t)}writeBytesField(e,t){this.writeTag(e,2),this.writeBytes(t)}writeFixed32Field(e,t){this.writeTag(e,5),this.writeFixed32(t)}writeSFixed32Field(e,t){this.writeTag(e,5),this.writeSFixed32(t)}writeFixed64Field(e,t){this.writeTag(e,1),this.writeFixed64(t)}writeSFixed64Field(e,t){this.writeTag(e,1),this.writeSFixed64(t)}writeVarintField(e,t){this.writeTag(e,0),this.writeVarint(t)}writeSVarintField(e,t){this.writeTag(e,0),this.writeSVarint(t)}writeStringField(e,t){this.writeTag(e,2),this.writeString(t)}writeFloatField(e,t){this.writeTag(e,5),this.writeFloat(t)}writeDoubleField(e,t){this.writeTag(e,1),this.writeDouble(t)}writeBooleanField(e,t){this.writeVarintField(e,+t)}};function ff(e,t,r){return r?4294967296*t+(e>>>0):4294967296*(t>>>0)+(e>>>0)}function mf(e,t,r){const n=t<=16383?1:t<=2097151?2:t<=268435455?3:Math.floor(Math.log(t)/(7*Math.LN2));r.realloc(n);for(let i=r.pos-1;i>=e;i--)r.buf[i+n]=r.buf[i]}function yf(e,t){for(let r=0;r<e.length;r++)t.writeVarint(e[r])}function gf(e,t){for(let r=0;r<e.length;r++)t.writeSVarint(e[r])}function xf(e,t){for(let r=0;r<e.length;r++)t.writeFloat(e[r])}function vf(e,t){for(let r=0;r<e.length;r++)t.writeDouble(e[r])}function bf(e,t){for(let r=0;r<e.length;r++)t.writeBoolean(e[r])}function wf(e,t){for(let r=0;r<e.length;r++)t.writeFixed32(e[r])}function _f(e,t){for(let r=0;r<e.length;r++)t.writeSFixed32(e[r])}function If(e,t){for(let r=0;r<e.length;r++)t.writeFixed64(e[r])}function Af(e,t){for(let r=0;r<e.length;r++)t.writeSFixed64(e[r])}const Sf={horizontal:1,vertical:2,horizontalOnly:3};class Mf{constructor(){this.scale=1,this.fontStack="",this.image=null}static forText(e,t){const r=new Mf;return r.scale=e||1,r.fontStack=t,r}static forImage(e){const t=new Mf;return t.image=e,t}}class Bf{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(e,t,r,n=1){const i=new Bf;for(let s=0;s<e.sections.length;s++){const o=e.sections[s];o.image?i.addImageSection(o,r,n):i.addTextSection(o,t)}return i}length(){return this.text.length}getSection(e){return this.sections[this.sectionIndex[e]]}getSections(){return this.sections}getSectionIndex(e){return this.sectionIndex[e]}getCodePoint(e){return this.text.codePointAt(e)}verticalizePunctuation(e){this.text=function(e,t){let r="";for(let n=0;n<e.length;n++){const i=e.charCodeAt(n+1)||null,s=e.charCodeAt(n-1)||null;r+=!t&&(i&&Zs(i)&&!af[e[n+1]]||s&&Zs(s)&&!af[e[n-1]])||!af[e[n]]?e[n]:af[e[n]]}return r}(this.text,e)}trim(){let e=0;for(let r=0;r<this.text.length&&zf[this.text.charCodeAt(r)];r++)e++;let t=this.text.length;for(let r=this.text.length-1;r>=0&&r>=e&&zf[this.text.charCodeAt(r)];r--)t--;this.text=this.text.substring(e,t),this.sectionIndex=this.sectionIndex.slice(e,t)}substring(e,t){const r=new Bf;return r.text=this.text.substring(e,t),r.sectionIndex=this.sectionIndex.slice(e,t),r.sections=this.sections,r}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((e,t)=>Math.max(e,this.sections[t].scale),0)}addTextSection(e,t){this.text+=e.text,this.sections.push(Mf.forText(e.scale,e.fontStack||t));const r=this.sections.length-1;for(let n=0;n<e.text.length;++n)this.sectionIndex.push(r)}addImageSection(e,t,r=1){const n=e.image?e.image.getPrimary():null;if(!n)return void be("Can't add FormattedSection with an empty image.");n.scaleSelf(t*r);const i=this.getNextImageSectionCharCode();i?(this.text+=String.fromCodePoint(i),this.sections.push(Mf.forImage(n)),this.sectionIndex.push(this.sections.length-1)):be("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function Pf(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m=1,y=1){const g=Bf.fromFeature(e,i,m,y);h===Sf.vertical&&g.verticalizePunctuation(p);let x=[];const v=function(e,t,r,n,i,s,o=1){if(!e)return[];const a=[],l=function(e,t,r,n,i,s,o=1){let a=0;for(let l=0;l<e.length();l++){const r=e.getSection(l);a+=kf(e.getCodePoint(l),r,n,i,t,s,o)}return a/Math.max(1,Math.ceil(a/r))}(e,t,r,n,i,s,o),u=e.text.includes("");let c=0;for(let h=0;h<e.length();h++){const r=e.getSection(h),p=e.getCodePoint(h);if(zf[p]||(c+=kf(p,r,n,i,t,s,o)),h<e.length()-1){const t=Xs(p);(Tf[p]||t||r.image)&&a.push(Df(h+1,c,l,a,Ef(p,e.getCodePoint(h+1),t&&u),!1))}}return Cf(Df(e.length(),c,l,a,0,!0))}(g,u,s,t,n,d,y),{processBidirectionalText:b,processStyledBidirectionalText:w}=ao;if(b&&1===g.sections.length){const e=b(g.toString(),v);for(const t of e){const e=new Bf;e.text=t,e.sections=g.sections;for(let r=0;r<t.length;r++)e.sectionIndex.push(0);x.push(e)}}else if(w){const e=w(g.text,g.sectionIndex,v);for(const t of e){const e=new Bf;e.text=t[0],e.sectionIndex=t[1],e.sections=g.sections,x.push(e)}}else x=function(e,t){const r=[],n=e.text;let i=0;for(const s of t)r.push(e.substring(i,s)),i=s;return i<n.length&&r.push(e.substring(i,n.length)),r}(g,v);const _=[],I={positionedLines:_,text:g.toString(),top:c[1],bottom:c[1],left:c[0],right:c[0],writingMode:h,iconsInText:!1,verticalizable:!1,hasBaseline:!1};if(function(e,t,r,n,i,s,o,a,l,u,c,h,p=1){let d=0,f=0,m=0;const y="right"===a?1:"left"===a?0:.5;let g=!1;for(const _ of i){const e=_.getSections();for(const r of e){if(r.image)continue;const e=t[r.fontStack];if(e&&(g=void 0!==e.ascender&&void 0!==e.descender,!g))break}if(!g)break}let x=0;for(const _ of i){_.trim();const i=_.getMaxScale(),o=(i-1)*sf,a={positionedGlyphs:[],lineOffset:0};e.positionedLines[x]=a;const v=a.positionedGlyphs;let b=0;if(!_.length()){f+=s,++x;continue}let w=0,I=0;for(let s=0;s<_.length();s++){const o=_.getSection(s),a=_.getSectionIndex(s),m=_.getCodePoint(s);let y=o.scale,x=null,A=null,S=null,M=sf,B=0,P=l;P===Sf.vertical&&Hs(m)&&(P=Sf.horizontal);const z=!(P===Sf.horizontal||!c&&!qs(m)||c&&(zf[m]||Ys(m)));if(o.image){const t=n.get(o.image.toString());if(!t)continue;S=o.image,e.iconsInText=e.iconsInText||!0,A=t.paddedRect;const r=t.displaySize,s=r[0]*p,a=r[1]*p;y=y*sf/h,x={width:s,height:a,left:0,top:-3,advance:z?a:s,localGlyph:!1},B=g?-x.height*y:i*sf-17-a*y,M=x.advance;const l=(z?s:a)*y-sf*i;l>0&&l>b&&(b=l)}else{const e=r[o.fontStack];if(!e)continue;e[m]&&(A=e[m]);const n=t[o.fontStack];if(!n)continue;const s=n.glyphs[m];if(!s)continue;if(x=s.metrics,M=8203!==m?sf:0,g){const e=void 0!==n.ascender?Math.abs(n.ascender):0,t=void 0!==n.descender?Math.abs(n.descender):0,r=(e+t)*y;w<r&&(w=r,I=(e-t)/2*y),B=-e*y}else B=(i-y)*sf-17}z?(e.verticalizable=!0,v.push({glyph:m,image:S,x:d,y:f+B,vertical:z,scale:y,localGlyph:x.localGlyph,fontStack:o.fontStack,sectionIndex:a,metrics:x,rect:A}),d+=M*y+u):(v.push({glyph:m,image:S,x:d,y:f+B,vertical:z,scale:y,localGlyph:x.localGlyph,fontStack:o.fontStack,sectionIndex:a,metrics:x,rect:A}),d+=x.advance*y+u)}0!==v.length&&(m=Math.max(d-u,m),g?Lf(v,y,b,I,s*i/2):Lf(v,y,b,0,s/2)),d=0;const A=s*i+b;a.lineOffset=Math.max(b,o),f+=A,++x}const v=f,{horizontalAlign:b,verticalAlign:w}=Ff(o);(function(e,t,r,n,i,s){const o=(t-r)*i,a=-s*n;for(const l of e)for(const e of l.positionedGlyphs)e.x+=o,e.y+=a})(e.positionedLines,y,b,w,m,v),e.top+=-w*v,e.bottom=e.top+v,e.left+=-b*m,e.right=e.left+m,e.hasBaseline=g}(I,t,r,n,x,o,a,l,h,u,p,f,y),!function(e){for(const t of e)if(0!==t.positionedGlyphs.length)return!1;return!0}(_))return I}const zf={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Tf={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function kf(e,t,r,n,i,s,o=1){if(t.image){const e=n.get(t.image.toString());return e?e.displaySize[0]*o*t.scale*sf/s+i:0}{const n=r[t.fontStack],s=n&&n.glyphs[e];return s?s.metrics.advance*t.scale+i:0}}function Vf(e,t,r,n){const i=Math.pow(e-t,2);return n?e<t?i/2:2*i:i+Math.abs(r)*r}function Ef(e,t,r){let n=0;return 10===e&&(n-=1e4),r&&(n+=150),40!==e&&65288!==e||(n+=50),41!==t&&65289!==t||(n+=50),n}function Df(e,t,r,n,i,s){let o=null,a=Vf(t,r,i,s);for(const l of n){const e=Vf(t-l.x,r,i,s)+l.badness;e<=a&&(o=l,a=e)}return{index:e,x:t,priorBreak:o,badness:a}}function Cf(e){return e?Cf(e.priorBreak).concat(e.index):[]}function Ff(e){let t=.5,r=.5;switch(e){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(e){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}function Lf(e,t,r,n,i){if(!(t||r||n||i))return;const s=e.length-1,o=e[s],a=(o.x+o.metrics.advance*o.scale)*t;for(let l=0;l<=s;l++)e[l].x-=a,e[l].y+=r+n+i}function Rf(e){return void 0!==e.imagePrimary&&void 0!==e.top&&void 0!==e.bottom&&void 0!==e.left&&void 0!==e.right}function Of(e,t,r,n){const{horizontalAlign:i,verticalAlign:s}=Ff(n),o=r[0]-e.displaySize[0]*i,a=r[1]-e.displaySize[1]*s;return{imagePrimary:e,imageSecondary:t,top:a,bottom:a+e.displaySize[1],left:o,right:o+e.displaySize[0]}}function Uf(e,t,r,n,i,s){const o=e.imagePrimary;let a;if(o.content){const e=o.content,t=o.pixelRatio||1;a=[e[0]/t,e[1]/t,o.displaySize[0]-e[2]/t,o.displaySize[1]-e[3]/t]}const l=t.left*s,u=t.right*s;let c,h,p,d;"width"===r||"both"===r?(d=i[0]+l-n[3],h=i[0]+u+n[1]):(d=i[0]+(l+u-o.displaySize[0])/2,h=d+o.displaySize[0]);const f=t.top*s,m=t.bottom*s;return"height"===r||"both"===r?(c=i[1]+f-n[0],p=i[1]+m+n[2]):(c=i[1]+(f+m-o.displaySize[1])/2,p=c+o.displaySize[1]),{imagePrimary:o,imageSecondary:void 0,top:c,right:h,bottom:p,left:d,collisionPadding:a}}function Nf(e){return!e.imagePrimary.stretchX}function jf(e){return!e.imagePrimary.stretchY}function $f(e){return{width:e.right-e.left,height:e.bottom-e.top}}const Gf=128;function Xf(e,t,r,n){const{expression:i}=t;if("constant"===i.kind)return{kind:"constant",layoutSize:i.evaluate(new lo(e+1,{worldview:r}),void 0,void 0,void 0,n)};if("source"===i.kind)return{kind:"source"};{const{zoomStops:t,interpolationType:s}=i;let o=0;for(;o<t.length&&t[o]<=e;)o++;o=Math.max(0,o-1);let a=o;for(;a<t.length&&t[a]<e+1;)a++;a=Math.min(t.length-1,a);const l=t[o],u=t[a];return"composite"===i.kind?{kind:"composite",minZoom:l,maxZoom:u,interpolationType:s}:{kind:"camera",minZoom:l,maxZoom:u,minSize:i.evaluate(new lo(l,{worldview:r}),void 0,void 0,void 0,n),maxSize:i.evaluate(new lo(u,{worldview:r}),void 0,void 0,void 0,n),interpolationType:s}}}function qf(e,{uSize:t,uSizeT:r},{lowerSize:n,upperSize:i}){return"source"===e.kind?n/Gf:"composite"===e.kind?Bt(n/Gf,i/Gf,r):t}function Hf(e,t,r=1){let n=0,i=0;if("constant"===e.kind)i=e.layoutSize*r;else if("source"!==e.kind){const{interpolationType:s,minZoom:o,maxZoom:a}=e,l=s?pe(ai.interpolationFactor(s,t,o,a),0,1):0;"camera"===e.kind?i=Bt(e.minSize,e.maxSize,l)*r:n=l*r}return{uSizeT:n,uSize:i}}class Zf extends oe{constructor(e,t,r,n,i){super(e,t),this.angle=n,this.z=r,void 0!==i&&(this.segment=i)}clone(){return new Zf(this.x,this.y,this.z,this.angle,this.segment)}}function Yf(e,t,r,n,i){if(void 0===t.segment)return!0;let s=t,o=t.segment+1,a=0;for(;a>-r/2;){if(o--,o<0)return!1;a-=e[o].dist(s),s=e[o]}a+=e[o].dist(e[o+1]),o++;const l=[];let u=0;for(;a<r/2;){const t=e[o],r=e[o+1];if(!r)return!1;let s=e[o-1].angleTo(t)-t.angleTo(r);for(s=Math.abs((s+3*Math.PI)%(2*Math.PI)-Math.PI),l.push({distance:a,angleDelta:s}),u+=s;a-l[0].distance>n;)u-=l.shift().angleDelta;if(u>i)return!1;o++,a+=t.dist(r)}return!0}function Wf(e){let t=0;for(let r=0;r<e.length-1;r++)t+=e[r].dist(e[r+1]);return t}function Jf(e,t,r){return e?.6*t*r:0}function Kf(e,t){return Math.max(e?e.right-e.left:0,t?t.right-t.left:0)}function Qf(e,t,r,n,i,s){const o=Jf(r,i,s),a=Kf(r,n)*s;let l=0;const u=Wf(e)/2;for(let c=0;c<e.length-1;c++){const r=e[c],n=e[c+1],i=r.dist(n);if(l+i>u){const s=(u-l)/i,h=Bt(r.x,n.x,s),p=Bt(r.y,n.y,s),d=new Zf(h,p,0,n.angleTo(r),c);return!o||Yf(e,d,a,o,t)?d:void 0}l+=i}}function em(e,t,r,n,i,s,o,a,l){const u=Jf(n,s,o),c=Kf(n,i),h=c*o,p=0===e[0].x||e[0].x===l||0===e[0].y||e[0].y===l;return t-h<t/4&&(t=h+t/4),tm(e,p?t/2*a%t:(c/2+2*s)*o*a%t,t,u,r,h,p,!1,l)}function tm(e,t,r,n,i,s,o,a,l){const u=s/2,c=Wf(e);let h=0,p=t-r,d=[];for(let f=0;f<e.length-1;f++){const t=e[f],o=e[f+1],a=t.dist(o),m=o.angleTo(t);for(;p+r<h+a;){p+=r;const y=(p-h)/a,g=Bt(t.x,o.x,y),x=Bt(t.y,o.y,y);if(g>=0&&g<l&&x>=0&&x<l&&p-u>=0&&p+u<=c){const t=new Zf(g,x,0,m,f);n&&!Yf(e,t,s,n,i)||d.push(t)}}h+=a}return a||d.length||o||(d=tm(e,h/2,r,n,i,s,o,!0,l)),d}function rm(e){let t=0,r=0;for(const o of e)t+=o.w*o.h,r=Math.max(r,o.w);e.sort((e,t)=>t.h-e.h);const n=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}];let i=0,s=0;for(const o of e)for(let e=n.length-1;e>=0;e--){const t=n[e];if(!(o.w>t.w||o.h>t.h)){if(o.x=t.x,o.y=t.y,s=Math.max(s,o.y+o.h),i=Math.max(i,o.x+o.w),o.w===t.w&&o.h===t.h){const t=n.pop();t&&e<n.length&&(n[e]=t)}else o.h===t.h?(t.x+=o.w,t.w-=o.w):o.w===t.w?(t.y+=o.h,t.h-=o.h):(n.push({x:t.x+o.w,y:t.y,w:t.w-o.w,h:o.h}),t.y+=o.h,t.h-=o.h);break}}return{w:i,h:s,fill:t/(i*s)||0}}function nm(e,t){return e.id<t.id?-1:e.id>t.id?1:e.version<t.version?-1:e.version>t.version?1:e.sx<t.sx?-1:e.sx>t.sx?1:e.sy<t.sy?-1:e.sy>t.sy?1:0}function im(e){let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t&=t;return t}function sm(e,t){return(e<<5)-e+t}function om(e,t,r,n){for(const[i]of e.entries()){const e=n&&n.get(i)||tr.parse(i),s=e.id.toString(),o=t.get(s)||0;r.push({id:i,version:o,sx:e.sx,sy:e.sy})}}ps(Zf,"Anchor");class am{constructor(e,t,r,n,i){this.iconDescriptors=[],this.patternDescriptors=[],this.requiresMipMaps=t.size>0,om(e,r,this.iconDescriptors,i),om(t,r,this.patternDescriptors,i),this.iconDescriptors.sort(nm),this.patternDescriptors.sort(nm);let s=0;const o=n?n.data:"";o&&(s=sm(s,im(o))),s=sm(s,1);for(const a of this.iconDescriptors)s=sm(s,im(a.id)),s=sm(s,a.version),s=sm(s,a.sx),s=sm(s,a.sy);s=sm(s,1);for(const a of this.patternDescriptors)s=sm(s,im(a.id)),s=sm(s,a.version),s=sm(s,a.sx),s=sm(s,a.sy);this.hash=s}subsetOf(e){return this.isSubsetArray(this.iconDescriptors,e.iconDescriptors,nm)&&this.isSubsetArray(this.patternDescriptors,e.patternDescriptors,nm)}isSubsetArray(e,t,r){let n=0,i=0;if(e.length>t.length)return!1;for(;n<e.length&&i<t.length;){const s=r(e[n],t[i]);if(0===s)n++,i++;else{if(s<0)return!1;i++}}return n===e.length}}function lm(e){switch(e){case WebGL2RenderingContext.RGBA8:case WebGL2RenderingContext.RGBA16F:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function um(e){switch(e){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.RGBA16F:return WebGL2RenderingContext.HALF_FLOAT;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}ps(am,"AtlasContentDescriptor");class cm{constructor(e,t,r,n){this.context=e,this.format=r,this.useMipmap=n&&n.useMipmap,this.texture=e.gl.createTexture(),this.update(t,{premultiply:n&&n.premultiply})}update(e,t){const r=e&&e instanceof HTMLVideoElement&&0===e.width?e.videoWidth:e.width,n=e&&e instanceof HTMLVideoElement&&0===e.height?e.videoHeight:e.height,{context:i}=this,{gl:s}=i,{x:o,y:a}=t&&t.position?t.position:{x:0,y:0},l=o+r,u=a+n;this.size&&(this.size[0]!==l||this.size[1]!==u)&&(!t||void 0===t.recreateWhenResize||t.recreateWhenResize)&&(s.bindTexture(s.TEXTURE_2D,null),s.deleteTexture(this.texture),this.texture=s.createTexture(),this.size=null),s.bindTexture(s.TEXTURE_2D,this.texture),i.pixelStoreUnpackFlipY.set(!1),i.pixelStoreUnpack.set(1),i.pixelStoreUnpackPremultiplyAlpha.set(this.format===s.RGBA8&&(!t||!1!==t.premultiply));const c=e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||ImageBitmap&&e instanceof ImageBitmap;if(!this.size&&l>0&&u>0){const e=this.useMipmap?Math.floor(Math.log2(Math.max(l,u)))+1:1;s.texStorage2D(s.TEXTURE_2D,e,this.format,l,u),this.size=[l,u]}this.size&&(c?s.texSubImage2D(s.TEXTURE_2D,0,o,a,lm(this.format),um(this.format),e):"data"in e&&e.data&&s.texSubImage2D(s.TEXTURE_2D,0,o,a,r,n,lm(this.format),um(this.format),e.data)),this.useMipmap&&s.generateMipmap(s.TEXTURE_2D)}bind(e,t,r=!1){const{context:n}=this,{gl:i}=n;i.bindTexture(i.TEXTURE_2D,this.texture),e!==this.minFilter&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,e),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,this.useMipmap&&!r?e===i.NEAREST?i.NEAREST_MIPMAP_NEAREST:i.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),t!==this.wrapS&&(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,t),this.wrapS=t)}bindExtraParam(e,t,r,n,i){const{context:s}=this,{gl:o}=s;o.bindTexture(o.TEXTURE_2D,this.texture),t!==this.magFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,t),this.magFilter=t),e!==this.minFilter&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,this.useMipmap?e===o.NEAREST?o.NEAREST_MIPMAP_NEAREST:o.LINEAR_MIPMAP_LINEAR:e),this.minFilter=e),r!==this.wrapS&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_S,r),this.wrapS=r),n!==this.wrapT&&(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_WRAP_T,n),this.wrapT=n),i!==this.compareMode&&(i?(o.texParameteri(o.TEXTURE_2D,o.TEXTURE_COMPARE_MODE,o.COMPARE_REF_TO_TEXTURE),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_COMPARE_FUNC,i)):o.texParameteri(o.TEXTURE_2D,o.TEXTURE_COMPARE_MODE,o.NONE),this.compareMode=i)}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}class hm{constructor(e,t){this.context=e,this.texture=t}bind(e,t){const{context:r}=this,{gl:n}=r;n.bindTexture(n.TEXTURE_2D,this.texture),e!==this.minFilter&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,e),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,e),this.minFilter=e),t!==this.wrapS&&(n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,t),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,t),this.wrapS=t)}}class pm{static getImagePositionScale(e,t,r){if(t&&e){const{sx:t,sy:r}=e;return{x:t,y:r}}return{x:r,y:r}}constructor(e,t,r,n){this.paddedRect=e;const{pixelRatio:i,version:s,stretchX:o,stretchY:a,content:l,sdf:u,usvg:c}=t;this.pixelRatio=i,this.stretchX=o,this.stretchY=a,this.content=l,this.version=s,this.padding=r,this.sdf=u,this.usvg=c,this.scale=pm.getImagePositionScale(n,c,i)}get tl(){return[this.paddedRect.x+this.padding,this.paddedRect.y+this.padding]}get br(){return[this.paddedRect.x+this.paddedRect.w-this.padding,this.paddedRect.y+this.paddedRect.h-this.padding]}get displaySize(){return[(this.paddedRect.w-2*this.padding)/this.scale.x,(this.paddedRect.h-2*this.padding)/this.scale.y]}}function dm(e,t,r){const n=tr.parse(e),i=function(e,t,r=[1,1]){return{x:0,y:0,w:(e.data?e.data.width:e.width*r[0])+2*t,h:(e.data?e.data.height:e.height*r[1])+2*t}}(t,r,[n.sx,n.sy]);return{bin:i,imagePosition:new pm(i,t,r,n),imageVariant:n}}function fm(e,t){const r=[];for(const[i,s]of e.entries()){const e=tr.parse(i);e&&(r.push({key:i,value:s,variant:e}),t&&t.set(i,e))}r.sort((e,t)=>{const r=e.variant.id.toString().localeCompare(t.variant.id.toString());return 0!==r?r:e.variant.sx!==t.variant.sx?e.variant.sx-t.variant.sx:e.variant.sy!==t.variant.sy?e.variant.sy-t.variant.sy:0});const n=/* @__PURE__ */new Map;for(const i of r)n.set(i.key,i.value);return n}class mm{constructor(e){this.sourceAtlasHash=e}}class ym{constructor(e,t,r,n){const i=/* @__PURE__ */new Map,s=/* @__PURE__ */new Map;this.haveRenderCallbacks=[];const o=[],a=void 0!==n,l=a?/* @__PURE__ */new Map:void 0,u=a?fm(e,l):e,c=a?fm(t,l):t;this.addImages(u,i,1,o),this.addImages(c,s,2,o);const{w:h,h:p}=rm(o),d=new Ac({width:h||1,height:p||1});for(const[f,m]of u.entries()){const e=i.get(f).paddedRect;Ac.copy(m.data,d,{x:0,y:0},{x:e.x+1,y:e.y+1},m.data,null,m.sdf)}for(const[f,m]of c.entries()){const e=s.get(f),t=e.paddedRect;let n=e.padding;const i=t.x+n,o=t.y+n,a=m.data.width,l=m.data.height;n=n>1?n-1:n,Ac.copy(m.data,d,{x:0,y:0},{x:i,y:o},m.data,r),Ac.copy(m.data,d,{x:0,y:l-n},{x:i,y:o-n},{width:a,height:n},r),Ac.copy(m.data,d,{x:0,y:0},{x:i,y:o+l},{width:a,height:n},r),Ac.copy(m.data,d,{x:a-n,y:0},{x:i-n,y:o},{width:n,height:l},r),Ac.copy(m.data,d,{x:0,y:0},{x:i+a,y:o},{width:n,height:l},r),Ac.copy(m.data,d,{x:a-n,y:l-n},{x:i-n,y:o-n},{width:n,height:n},r),Ac.copy(m.data,d,{x:0,y:l-n},{x:i+a,y:o-n},{width:n,height:n},r),Ac.copy(m.data,d,{x:0,y:0},{x:i+a,y:o+l},{width:n,height:n},r),Ac.copy(m.data,d,{x:a-n,y:0},{x:i-n,y:o+l},{width:n,height:n},r)}this.lut=r,this.image=d,this.iconPositions=i,this.patternPositions=s,a&&(this.contentDescriptor=new am(u,c,n,r,l))}addImages(e,t,r,n){for(const[i,s]of e.entries()){const{bin:e,imagePosition:o,imageVariant:a}=dm(i,s,r);t.set(i,o),n.push(e),s.hasRenderCallback&&this.haveRenderCallbacks.push(a.id)}}patchUpdatedImages(e,t,r,n){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(t=>e.hasImage(t,r)),e.dispatchRenderCallbacks(this.haveRenderCallbacks,r);for(const i of e.getUpdatedImages(r)){for(const n of this.iconPositions.keys()){const s=tr.parse(n);if(It.isEqual(s.id,i)){const s=e.getImage(i,r);this.patchUpdatedImage(this.iconPositions.get(n),s,t,null)}}for(const s of this.patternPositions.keys()){const o=tr.parse(s);if(It.isEqual(o.id,i)){const o=e.getImage(i,r);this.patchUpdatedImage(this.patternPositions.get(s),o,t,n||this.lut)}}}}patchUpdatedImage(e,t,r,n=null){if(!e||!t)return;if(e.version===t.version)return;e.version=t.version;const[i,s]=e.tl,o=e.sdf;if(this.lut||o){const e={width:t.data.width,height:t.data.height},a=new Ac(e);Ac.copy(t.data,a,{x:0,y:0},{x:0,y:0},e,n,o),r.update(a,{position:{x:i,y:s},recreateWhenResize:!1})}else r.update(t.data,{position:{x:i,y:s},recreateWhenResize:!1})}}ps(pm,"ImagePosition"),ps(ym,"ImageAtlas",{omit:["lut"]}),ps(mm,"ImageAtlasReference");const gm=new Float64Array(256);for(let h_=0;h_<256;h_++){const e=.5-Math.pow(h_/255,1/2.2);gm[h_]=e*Math.abs(e)}gm[255]=-1e20;function xm(e,t){return e+t[1]-t[0]}function vm(e,t,r,n,i=1){const s=[],o=e.imagePrimary,a=o.pixelRatio,l=o.paddedRect.w-2,u=o.paddedRect.h-2,c=(e.right-e.left)*i,h=(e.bottom-e.top)*i,p=o.stretchX||[[0,l]],d=o.stretchY||[[0,u]],f=p.reduce(xm,0),m=d.reduce(xm,0),y=l-f,g=u-m;let x=0,v=f,b=0,w=m,_=0,I=y,A=0,S=g;if(o.content&&n){const e=o.content;x=wm(p,0,e[0]),b=wm(d,0,e[1]),v=wm(p,e[0],e[2]),w=wm(d,e[1],e[3]),_=e[0]-x,A=e[1]-b,I=e[2]-e[0]-v,S=e[3]-e[1]-w}const M=(n,s,l,u)=>{const p=Am(n.stretch-x,v,c,e.left*i),d=Sm(n.fixed-_,I,n.stretch,f),y=Am(s.stretch-b,w,h,e.top*i),g=Sm(s.fixed-A,S,s.stretch,m),M=Am(l.stretch-x,v,c,e.left*i),B=Sm(l.fixed-_,I,l.stretch,f),P=Am(u.stretch-b,w,h,e.top*i),z=Sm(u.fixed-A,S,u.stretch,m),T=new oe(p,y),k=new oe(M,y),V=new oe(M,P),E=new oe(p,P),D=new oe(d/a,g/a),C=new oe(B/a,z/a),F=t*Math.PI/180;if(F){const e=Math.sin(F),t=Math.cos(F),r=[t,-e,e,t];T._matMult(r),k._matMult(r),E._matMult(r),V._matMult(r)}const L=n.stretch+n.fixed,R=l.stretch+l.fixed,O=s.stretch+s.fixed,U=u.stretch+u.fixed,N=e.imageSecondary;return{tl:T,tr:k,bl:E,br:V,texPrimary:{x:o.paddedRect.x+1+L,y:o.paddedRect.y+1+O,w:R-L,h:U-O},texSecondary:N?{x:N.paddedRect.x+1+L,y:N.paddedRect.y+1+O,w:R-L,h:U-O}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:D,pixelOffsetBR:C,minFontScaleX:I/a/c,minFontScaleY:S/a/h,isSDF:r}};if(o.stretchX||o.stretchY){const e=_m(p,y,f),t=_m(d,g,m);for(let r=0;r<e.length-1;r++){const n=e[r],i=e[r+1];for(let e=0;e<t.length-1;e++)s.push(M(n,t[e],i,t[e+1]))}}else s.push(M({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:l+1},{fixed:0,stretch:u+1}));return s}function bm(e,t){const r=e.stretchY||[[0,e.paddedRect.h-2]];return e.stretchX||e.stretchY?Im(e.stretchX||[[0,e.paddedRect.w-2]])*Im(r):1}function wm(e,t,r){let n=0;for(const i of e)n+=Math.max(t,Math.min(r,i[1]))-Math.max(t,Math.min(r,i[0]));return n}function _m(e,t,r){const n=[{fixed:-1,stretch:0}];for(const[i,s]of e){const e=n.at(-1);n.push({fixed:i-e.stretch,stretch:e.stretch}),n.push({fixed:i-e.stretch,stretch:e.stretch+(s-i)})}return n.push({fixed:t+1,stretch:r}),n}function Im(e){return 2*e.length+1}function Am(e,t,r,n){return e/t*r+n}function Sm(e,t,r,n){return e-t*r/n}function Mm(e,t,r,n){const i=t+e.positionedLines[n].lineOffset;return 0===n?r+i/2:r+(i+(t+e.positionedLines[n-1].lineOffset))/2}function Bm(e,t,r,n,i,s,o,a,l,u=1){const c=[];if(0===t.positionedLines.length)return c;const h=(void 0!==l?l:n.layout.get("text-rotate").evaluate(s,{}))*Math.PI/180,p=function(e){const t=e[0],r=e[1],n=t*r;return n>0?[t,-r]:n<0?[-t,r]:0===t?[r,t]:[r,-t]}(r);let d=Math.abs(t.top-t.bottom);for(const g of t.positionedLines)d-=g.lineOffset;const f=t.positionedLines.length,m=d/f;let y=t.top-r[1];for(let g=0;g<f;++g){const e=t.positionedLines[g];y=Mm(t,m,y,g);for(const n of e.positionedGlyphs){if(!n.rect)continue;const e=n.rect||{};let s=4,l=!0,d=1,f=0;if(n.image){const e=o.get(n.image.toString());if(!e)continue;if(e.sdf){be("SDF images are not supported in formatted text and will be ignored.");continue}l=!1,d=e.pixelRatio,s=1/d,e.usvg||(d/=u)}const m=(i||a)&&n.vertical,g=n.metrics.advance*n.scale/2,x=n.metrics,v=n.rect;if(null===v)continue;a&&t.verticalizable&&(f=n.image?g-n.metrics.width*n.scale/2:0);const b=i?[n.x+g,n.y]:[0,0];let w=[0,0],_=[0,0],I=!1;i||(m?(_=[n.x+g+p[0],n.y+p[1]-f],I=!0):w=[n.x+g+r[0],n.y+r[1]-f]);const A=v.w*n.scale/(d*(n.localGlyph?2:1)),S=v.h*n.scale/(d*(n.localGlyph?2:1));let M,B,P,z;if(m){const e=n.y-y,t=new oe(-g,g-e),r=-Math.PI/2,i=new oe(..._);M=new oe(-g+w[0],w[1]),M._rotateAround(r,t)._add(i),M.x+=-e+g,M.y-=(x.left-s)*n.scale;const o=n.image?x.advance*n.scale:sf*n.scale,a=String.fromCodePoint(n.glyph);lf(a)?M.x+=(1-s)*n.scale:uf(a)?M.x+=o-x.height*n.scale+(-s-1)*n.scale:M.x+=n.image||x.width+2*s===v.w&&x.height+2*s===v.h?(o-S)/2:(o-(x.height+2*s)*n.scale)/2,B=new oe(M.x,M.y-A),P=new oe(M.x+S,M.y),z=new oe(M.x+S,M.y-A)}else{const e=(x.left-s)*n.scale-g+w[0],t=(-x.top-s)*n.scale+w[1],r=e+A,i=t+S;M=new oe(e,t),B=new oe(r,t),P=new oe(e,i),z=new oe(r,i)}if(h){let e;e=i?new oe(0,0):I?new oe(p[0],p[1]):new oe(r[0],r[1]),M._rotateAround(h,e),B._rotateAround(h,e),P._rotateAround(h,e),z._rotateAround(h,e)}const T=new oe(0,0),k=new oe(0,0);c.push({tl:M,tr:B,bl:P,br:z,texPrimary:e,texSecondary:void 0,writingMode:t.writingMode,glyphOffset:b,sectionIndex:n.sectionIndex,isSDF:l,pixelOffsetTL:T,pixelOffsetBR:k,minFontScaleX:0,minFontScaleY:0})}}return c}function Pm(e,t=1,r=!1){let n=1/0,i=1/0,s=-1/0,o=-1/0;const a=e[0];for(let d=0;d<a.length;d++){const e=a[d];(!d||e.x<n)&&(n=e.x),(!d||e.y<i)&&(i=e.y),(!d||e.x>s)&&(s=e.x),(!d||e.y>o)&&(o=e.y)}const l=Math.min(s-n,o-i);let u=l/2;const c=new en([],zm);if(0===l)return new oe(n,i);for(let d=n;d<s;d+=l)for(let t=i;t<o;t+=l)c.push(new Tm(d+u,t+u,u,e));let h=function(e){let t=0,r=0,n=0;const i=e[0];for(let s=0,o=i.length,a=o-1;s<o;a=s++){const e=i[s],o=i[a],l=e.x*o.y-o.x*e.y;r+=(e.x+o.x)*l,n+=(e.y+o.y)*l,t+=3*l}return new Tm(r/t,n/t,0,e)}(e),p=c.length;for(;c.length;){const r=c.pop();(r.d>h.d||!h.d)&&(h=r),r.max-h.d<=t||(u=r.h/2,c.push(new Tm(r.p.x-u,r.p.y-u,u,e)),c.push(new Tm(r.p.x+u,r.p.y-u,u,e)),c.push(new Tm(r.p.x-u,r.p.y+u,u,e)),c.push(new Tm(r.p.x+u,r.p.y+u,u,e)),p+=4)}return h.p}function zm(e,t){return t.max-e.max}class Tm{constructor(e,t,r,n){this.p=new oe(e,t),this.h=r,this.d=function(e,t){let r=!1,n=1/0;for(let i=0;i<t.length;i++){const s=t[i];for(let t=0,i=s.length,o=i-1;t<i;o=t++){const i=s[t],a=s[o];i.y>e.y!=a.y>e.y&&e.x<(a.x-i.x)*(e.y-i.y)/(a.y-i.y)+i.x&&(r=!r),n=Math.min(n,Lu(e,i,a))}}return(r?1:-1)*Math.sqrt(n)}(this.p,n),this.max=this.d+this.h*Math.SQRT2}}const km=Object.keys,Vm=Number.POSITIVE_INFINITY,Em=Math.sqrt(2);function Dm(e,t,r,n,i,s){const o=Rf(e)&&e.collisionPadding?e.collisionPadding:[0,0,0,0],a={top:e.top-o[1],bottom:e.bottom+o[3],left:e.left-o[0],right:e.right+o[2],scaled:!1};return void 0!==n&&(u=n,(l=a).top*=u,l.bottom*=u,l.left*=u,l.right*=u,l.scaled=!0),s&&(a.left+=s[0],a.right+=s[0],a.top+=s[1],a.bottom+=s[1]),r&&function(e,t,r){if(!t)return;const n=ce(t),i=new oe(r?r[0]:0,r?r[1]:0),s=new oe(e.left,e.top),o=new oe(e.right,e.top),a=new oe(e.left,e.bottom),l=new oe(e.right,e.bottom);s._rotateAround(n,i),o._rotateAround(n,i),a._rotateAround(n,i),l._rotateAround(n,i),e.left=Math.min(s.x,o.x,a.x,l.x),e.right=Math.max(s.x,o.x,a.x,l.x),e.top=Math.min(s.y,o.y,a.y,l.y),e.bottom=Math.max(s.y,o.y,a.y,l.y)}(a,r,i),t?{top:Math.min(t.top,a.top),bottom:Math.max(t.bottom,a.bottom),left:Math.min(t.left,a.left),right:Math.max(t.right,a.right),scaled:t.scaled||a.scaled}:a;var l,u}function Cm(e,[t,r]){let n=0,i=0;if(r===Vm){t<0&&(t=0);const r=t/Em;switch(e){case"top-right":case"top-left":i=r-7;break;case"bottom-right":case"bottom-left":i=7-r;break;case"bottom":i=7-t;break;case"top":i=t-7}switch(e){case"top-right":case"bottom-right":n=-r;break;case"top-left":case"bottom-left":n=r;break;case"left":n=t;break;case"right":n=-t}}else{switch(t=Math.abs(t),r=Math.abs(r),e){case"top-right":case"top-left":case"top":i=r-7;break;case"bottom-right":case"bottom-left":case"bottom":i=7-r}switch(e){case"top-right":case"bottom-right":case"right":n=-t;break;case"top-left":case"bottom-left":case"left":n=t}}return[n,i]}function Fm(e,t,r,n,i,s,o,a=1,l,u,c,h){e.createArrays(),e.tilePixelRatio=tn/(512*e.overscaling),e.compareText={},e.iconsNeedLinear=!1;const p=e.layers[0].layout,d=e.layers[0]._unevaluatedLayout._values,f={};f.scaleFactor=a,f.textSizeScaleRange=p.get("text-size-scale-range"),f.iconSizeScaleRange=p.get("icon-size-scale-range");const[m,y]=f.textSizeScaleRange,[g,x]=f.iconSizeScaleRange;f.textScaleFactor=pe(f.scaleFactor,m,y),f.iconScaleFactor=pe(f.scaleFactor,g,x);const v=d["text-size"],b=d["icon-size"];if("composite"===e.textSizeData.kind){const{minZoom:t,maxZoom:r}=e.textSizeData;f.compositeTextSizes=[v.possiblyEvaluate(new lo(t,{worldview:c}),s),v.possiblyEvaluate(new lo(r,{worldview:c}),s)]}if("composite"===e.iconSizeData.kind){const{minZoom:t,maxZoom:r}=e.iconSizeData;f.compositeIconSizes=[b.possiblyEvaluate(new lo(t,{worldview:c}),s,h),b.possiblyEvaluate(new lo(r,{worldview:c}),s,h)]}f.layoutTextSize=v.possiblyEvaluate(new lo(o+1,{worldview:c}),s),f.layoutIconSize=b.possiblyEvaluate(new lo(o+1,{worldview:c}),s,h),f.textMaxSize=v.possiblyEvaluate(new lo(18,{worldview:c}),s);const w=p.get("symbol-placement"),_="map"===p.get("text-rotation-alignment")&&"point"!==w,I=p.get("text-size");let A=!1;const S=[];for(const M of e.features){const o=p.get("text-font").evaluate(M,{},s).join(","),a=I.evaluate(M,{},s)*f.textScaleFactor,m=f.layoutTextSize.evaluate(M,{},s)*f.textScaleFactor,y=f.layoutIconSize.evaluate(M,{},s,h)*f.iconScaleFactor,g={horizontal:{},vertical:void 0},x=M.text;let v,b=[0,0];if(x){const n=x.toString(),u=p.get("text-letter-spacing").evaluate(M,{},s)*sf,c=p.get("text-line-height").evaluate(M,{},s)*sf,h=$s(n)?u:0,d=p.get("text-anchor").evaluate(M,{},s),y=p.get("text-variable-anchor");if(!y){const e=p.get("text-radial-offset").evaluate(M,{},s);if(e)b=Cm(d,[e*sf,Vm]);else{const e=p.get("text-offset").evaluate(M,{},s);b=[e[0]*sf,e[1]*sf]}}let v=_?"center":p.get("text-justify").evaluate(M,{},s);const I="point"===w,A=I?p.get("text-max-width").evaluate(M,{},s)*sf:1/0,S=s=>{e.allowVerticalPlacement&&js(n)&&(g.vertical=Pf(x,t,r,i,o,A,c,d,s,h,b,Sf.vertical,!0,m,a,l,f.textScaleFactor))};if(!_&&y){const e="auto"===v?y.map(e=>Wm(e)):[v];let n=!1;for(let s=0;s<e.length;s++){const u=e[s];if(!g.horizontal[u])if(n)g.horizontal[u]=g.horizontal[0];else{const e=Pf(x,t,r,i,o,A,c,"center",u,h,b,Sf.horizontal,!1,m,a,l,f.textScaleFactor);e&&(g.horizontal[u]=e,n=1===e.positionedLines.length)}}S("left")}else{if("auto"===v&&(v=Wm(d)),I||p.get("text-writing-mode").includes("horizontal")||!js(n)){const e=Pf(x,t,r,i,o,A,c,d,v,h,b,Sf.horizontal,!1,m,a,l,f.textScaleFactor);e&&(g.horizontal[v]=e)}S(I?"left":v)}}let B,P,z,T,k,V,E=!1;const D=p.get("icon-text-fit").evaluate(M,{},s);if(M.icon&&M.icon.hasPrimary()){const t=Gm(M.icon,e.iconSizeData,d["icon-size"],s,e.zoom,M,l,f.iconScaleFactor,c,h);B=t.iconPrimary,z=t.iconSecondary;const r=B.toString();if(P=n.get(r),P&&(k=p.get("icon-offset").evaluate(M,{},s),V=p.get("icon-anchor").evaluate(M,{},s),v=Of(i.get(r),z?i.get(z.toString()):void 0,k,V),E=P.sdf,void 0===e.sdfIcons?e.sdfIcons=P.sdf:e.sdfIcons!==P.sdf&&be("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(P.pixelRatio!==e.pixelRatio||0!==p.get("icon-rotate").constantOr(1))&&(e.iconsNeedLinear=!0)),z){const e=z.toString();T=n.get(e)}}A=A||!(!M.icon||!M.icon.hasSecondary());const C=iy(g.horizontal)||g.vertical;e.iconsInText||(e.iconsInText=!!C&&C.iconsInText);const F=m*f.textScaleFactor/sf,{defaultShapedIcon:L,verticallyShapedIcon:R}=Jm(e,v,p,M,s,g,F,k,D);"none"!==D&&v&&(Nf(v)||jf(v))&&(jm(0,P,B,v,L,D,u,n,i),jm(0,T,z,v,L,D,u,n,i),R&&(jm(0,P,B,v,R,D,u,n,i),jm(0,T,z,v,R,D,u,n,i))),v=L;const{iconBBox:O,iconVerticalBBox:U,textBBox:N,textVerticalBBox:j}=Lm(e,v,R,p,M,s,y,k,f,i,V,g,m,b,h);S.push({feature:M,shapedTextOrientations:g,shapedText:C,shapedIcon:v,iconPrimary:B,iconSecondary:z,iconOffset:k,iconAnchor:V,verticallyShapedIcon:R,layoutTextSize:m,layoutIconSize:y,textOffset:b,isSDFIcon:E,iconTextFit:D,iconCollisionBounds:O,iconVerticalCollisionBounds:U,textCollisionBounds:N,textVerticalCollisionBounds:j})}return{featureData:S,sizes:f,hasAnySecondaryIcon:A,textAlongLine:_,symbolPlacement:w}}function Lm(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f){const m=e.layers[0],y=m.appearances;if(0===y.length)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const g={iconBBox:null,iconVerticalBBox:null},x={textBBox:null,textVerticalBBox:null},{baseIconRotate:v,baseTextRotate:b,iconScaleFactor:w}=function(e,t,r){const n=e.get("icon-rotate").evaluate(t,{},r),i=e.get("text-rotate").evaluate(t,{},r),[s,o]=e.get("icon-size-scale-range");return{baseIconRotate:n,baseTextRotate:i,iconScaleFactor:pe(1,s,o)}}(n,i,s);t&&(g.iconBBox=Dm(t,g.iconBBox,v),r)&&(g.iconVerticalBBox=Dm(r,g.iconVerticalBBox,v+90));const _=iy(h.horizontal);_&&(x.textBBox=Dm(_,x.textBBox,b,1,d)),h.vertical&&(x.textVerticalBBox=Dm(h.vertical,x.textVerticalBBox,b+90,1,d));for(const I of y)I.hasIconLayoutProperties()&&Rm(g,e,m,I,i,s,a,v,o,l,t,u,w,c,f),I.hasTextLayoutProperties()&&Um(x,m,I,i,s,d,b,p,_,h.vertical);return{iconBBox:g.iconBBox,iconVerticalBBox:g.iconVerticalBBox,textBBox:x.textBBox,textVerticalBBox:x.textVerticalBBox}}function Rm(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f){const{appearanceIconOffset:m,appearanceIconRotate:y,appearanceIconSize:g}=Om(n,r,i,s,o,a,l,u.iconScaleFactor);let x=null,v=null,b=null;n.hasLayoutProperty("icon-image")?b=function(e,t,r,n,i,s,o,a){let l=null;const u=t.getAppearanceValueAndResolveTokens(r,"icon-image",n,i,a);if(u){const c=e.getResolvedImageFromTokens(u),h=r.hasLayoutProperty("icon-size")?r.getUnevaluatedLayoutProperty("icon-size"):t._unevaluatedLayout._values["icon-size"],p=Gm(c,Xf(e.zoom,h,e.worldview,a),h,i,e.zoom,n,e.pixelRatio,o,e.worldview,a);l=s.get(p.iconPrimary.toString())}return l}(t,r,n,i,s,h,p,f):c&&(b=c.imagePrimary),b&&(x=Of(b,null,m,d),t.allowVerticalPlacement&&(v=Of(b,null,m,d)));const w=l>0?g/l:1;x&&(e.iconBBox=Dm(x,e.iconBBox,y,1!==w?w:void 0)),v&&(e.iconVerticalBBox=Dm(v,e.iconVerticalBBox,y+90,1!==w?w:void 0))}function Om(e,t,r,n,i,s,o,a){const l=e.hasLayoutProperty("icon-offset")?t.getAppearanceValueAndResolveTokens(e,"icon-offset",r,n,[]):null,u=l&&Array.isArray(l)?l:i,c=e.hasLayoutProperty("icon-rotate")?t.getAppearanceValueAndResolveTokens(e,"icon-rotate",r,n,[]):null,h="number"==typeof c?c:s,p=e.hasLayoutProperty("icon-size")?t.getAppearanceValueAndResolveTokens(e,"icon-size",r,n,[]):null;return{appearanceIconOffset:u,appearanceIconRotate:h,appearanceIconSize:"number"==typeof p?p*a:o}}function Um(e,t,r,n,i,s,o,a,l,u){const{appearanceTextOffset:c,appearanceTextRotate:h,appearanceTextSize:p}=Nm(r,t,n,i,s,o,a),d=p/a,f=[(c[0]-s[0])*d,(c[1]-s[1])*d],m=0!==f[0]||0!==f[1];l&&(e.textBBox=Dm(l,e.textBBox,h,d,c,m?f:void 0)),u&&(e.textVerticalBBox=Dm(u,e.textVerticalBBox,h+90,d,c,m?f:void 0))}function Nm(e,t,r,n,i,s,o){const a=e.hasLayoutProperty("text-offset")?t.getAppearanceValueAndResolveTokens(e,"text-offset",r,n,[]):null,l=a&&Array.isArray(a)?[a[0]*sf,a[1]*sf]:i,u=e.hasLayoutProperty("text-rotate")?t.getAppearanceValueAndResolveTokens(e,"text-rotate",r,n,[]):null,c="number"==typeof u?u:s,h=e.hasLayoutProperty("text-size")?t.getAppearanceValueAndResolveTokens(e,"text-size",r,n,[]):null;return{appearanceTextOffset:l,appearanceTextRotate:c,appearanceTextSize:"number"==typeof h?h:o}}function jm(e,t,r,n,i,s,o,a,l){if(!t||!t.usvg)return;const u=$f(n),c=$f(i),h="both"!==s&&"width"!==s||!Nf(n)?1:c.width/u.width,p="both"!==s&&"height"!==s||!jf(n)?1:c.height/u.height;r.scaleSelf(h,p);const d=r.toString();o.set(d,r),a.set(d,t);const{imagePosition:f}=dm(d,t,1);l.set(d,f)}function $m(e,t,r,n,i,s,o,a,l,u){if(!e)return;const c=function(e,t,r,n,i,s,o){if("camera"===e.kind)return e.maxSize;if("composite"===e.kind){const n=t.possiblyEvaluate(new lo(e.maxZoom,{worldview:s}),r,o).evaluate(i,{},r,o),a=t.possiblyEvaluate(new lo(e.minZoom,{worldview:s}),r,o).evaluate(i,{},r,o);return Math.max(n,a)}return t.possiblyEvaluate(new lo(n,{worldview:s}),r,o).evaluate(i,{},r,o)}(t,r,n,i,s,l,u);return e.scaleSelf(c*a*o)}function Gm(e,t,r,n,i,s,o,a,l,u){return{iconPrimary:$m(e.getPrimary(),t,r,n,i,s,o,a,l,u),iconSecondary:$m(e.getSecondary(),t,r,n,i,s,o,a,l,u)}}function Xm(e,t,r){if(!t)return;const n=r.get(e.toString()),i=r.get(t.toString());n&&i&&(n.paddedRect.w===i.paddedRect.w&&n.paddedRect.h===i.paddedRect.h||be(`Mismatch in icon variant sizes: ${e.toString()} and ${t.toString()}`),n.usvg!==i.usvg&&be(`Mismatch in icon variant image types: ${e.id} and ${t.id}`))}function qm(e,t,r,n,i,s,o,a,l,u){e.iconAtlasPositions=u.iconPositions;const{featureData:c,hasAnySecondaryIcon:h,sizes:p,textAlongLine:d,symbolPlacement:f}=t;for(const m of c){const{shapedIcon:t,verticallyShapedIcon:r,feature:s,shapedTextOrientations:c,shapedText:y,layoutTextSize:g,textOffset:x,isSDFIcon:v,iconPrimary:b,iconSecondary:w,iconTextFit:_,iconOffset:I,iconCollisionBounds:A,iconVerticalCollisionBounds:S,textCollisionBounds:M}=m;Hm(t,u.iconPositions,b,w),Hm(r,u.iconPositions,b,w),Zm(c,u.iconPositions),Xm(b,w,u.iconPositions),(y||t)&&Qm(e,s,c,t,r,l,p,g,0,x,v,n,i,o,a,h,_,I,d,f,A,S,M)}r&&e.generateCollisionDebugBuffers(s,e.collisionBoxArray,p.textScaleFactor)}function Hm(e,t,r,n){if(!e)return;const i=t.get(r.toString());if(i&&(e.imagePrimary=i),n){const r=t.get(n.toString());e.imageSecondary=r}}function Zm(e,t){for(const r in e.horizontal)Ym(e.horizontal[r],t);Ym(e.vertical,t)}function Ym(e,t){if(e)for(const r of e.positionedLines)for(const e of r.positionedGlyphs)if(null!==e.image){const r=e.image.toString();e.rect=t.get(r).paddedRect}}function Wm(e){switch(e){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Jm(e,t,r,n,i,s,o,a,l){const u=iy(s.horizontal)||s.vertical,c=r.get("icon-text-fit-padding").evaluate(n,{},i);let h,p=t;return t&&"none"!==l&&(e.allowVerticalPlacement&&s.vertical&&(h=Uf(t,s.vertical,l,c,a,o)),u&&(p=Uf(t,u,l,c,a,o))),{defaultShapedIcon:p,verticallyShapedIcon:h}}function Km(e,t){return e*t/24}function Qm(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y,g,x,v,b,w,_,I){let A=o.textMaxSize.evaluate(t,{},p);void 0===A?A=a*o.textScaleFactor:A*=o.textScaleFactor;const S=e.layers[0].layout,M=Km(a,o.textScaleFactor),B=iy(r.horizontal)||r.vertical,P=e.hasAnyAppearanceLayoutProperty(["text-size","text-offset","text-rotate"]),z=e.getAppearanceFeatureData(t.index);("none"!==y||P)&&z&&(z.textShaping=B,z.iconTextFitPadding=S.get("icon-text-fit-padding").evaluate(t,{},p),z.fontScale=M,z.textScaleFactor=o.textScaleFactor);const T="globe"===d.name,k=e.tilePixelRatio*A/24,V=(R=e.overscaling,e.zoom>18&&R>2&&(R>>=1),Math.max(tn/(512*R),1)*S.get("symbol-spacing")),E=S.get("text-padding")*e.tilePixelRatio,D=S.get("icon-padding")*e.tilePixelRatio,C=ce(S.get("text-max-angle")),F="map"===S.get("icon-rotation-alignment")&&"point"!==v,L=V/2;var R;!1===e.hasAnyIconTextFit&&"none"!==y&&(e.hasAnyIconTextFit=!0);const O=t.properties?+t.properties[au]:null,U=O&&e.elevationFeatureIdToIndex?e.elevationFeatureIdToIndex.get(O):65535,N=(a,l,v)=>{if(l.x<0||l.x>=tn||l.y<0||l.y>=tn)return;let I=null;if(T){const{x:e,y:t,z:r}=d.projectTilePoint(l.x,l.y,v);I={anchor:new Zf(e,t,r,0,void 0),up:d.upVector(v,l.x,l.y)}}!function(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y,g,x,v,b,w,_,I,A,S,M,B,P,z,T,k){const V=e.addToLineVertexArray(t,n);let E,D,C,F,L,R,O,U=0,N=0,j=0,$=0,G=-1,X=-1;const q={};let H=gt("");const Z=r?r.anchor:t,Y="none"!==B;let W=0,J=0;if(void 0===l._unevaluatedLayout.getValue("text-radial-offset")){const e=l.layout.get("text-offset").evaluate(b,{},A);W=e[0]*sf,J=e[1]*sf}else W=l.layout.get("text-radial-offset").evaluate(b,{},A)*sf,J=Vm;if(e.allowVerticalPlacement&&i.vertical){const e=i.vertical;if(f)R=oy(e),a&&(O=oy(a));else{const r=l.layout.get("text-rotate").evaluate(b,{},A)+90;C=sy(u,Z,t,c,h,p,e,d,r,m,k),a&&(F=sy(u,Z,t,c,h,p,a,g,r,null,T))}}if(s){const n=l.layout.get("icon-rotate").evaluate(b,{},A),i=vm(s,n,_,Y,w.iconScaleFactor),o=a?vm(a,n,_,Y,w.iconScaleFactor):void 0;D=sy(u,Z,t,c,h,p,s,g,n,null,z);const d=function(e,t,r,n,i,s,o,a,l,u){const c=e.layers[0],h=c.appearances;let p=t.length;if(r&&(p=Math.max(p,r.length)),0===h.length)return p;const[d,f]=n.get("icon-size-scale-range"),m=pe(1,d,f);for(const y of h)if(y.hasLayoutProperty("icon-image")){const t=c.getAppearanceValueAndResolveTokens(y,"icon-image",s,o,u);if(t){const r=e.getResolvedImageFromTokens(t);if(r){const t=y.hasLayoutProperty("icon-size")?y.getUnevaluatedLayoutProperty("icon-size"):i._values["icon-size"],n=Gm(r,Xf(e.zoom,t,e.worldview,u),t,o,e.zoom,s,e.pixelRatio,m,e.worldview,u),l=a.get(n.iconPrimary.toString());l&&(p=Math.max(p,bm(l)))}}}return p}(e,i,o,l.layout,l._unevaluatedLayout,b,A,e.iconAtlasPositions,0,I);U=4*d;const f=l.layout.get("icon-size").evaluate(b,{},A,I),m=w.compositeIconSizes?w.compositeIconSizes[0].evaluate(b,{},A,I):0,y=w.compositeIconSizes?w.compositeIconSizes[1].evaluate(b,{},A,I):0,B=ny(e.layerIds[0],e.iconSizeData,f,s.imagePrimary.usvg?1:w.iconScaleFactor,m,y);e.addSymbols(e.icon,i,B,v,x,b,void 0,r,t,V.lineStartIndex,V.lineLength,-1,I,A,S,M,e.symbolInstances.length,d),G=e.icon.placedSymbolArray.length-1,o&&(N=4*d,e.addSymbols(e.icon,o,B,v,x,b,Sf.vertical,r,t,V.lineStartIndex,V.lineLength,-1,I,A,S,M,e.symbolInstances.length,d),X=e.icon.placedSymbolArray.length-1)}for(const te in i.horizontal){const n=te,s=i.horizontal[n];E||(H=gt(s.text),f?L=oy(s):E=sy(u,Z,t,c,h,p,s,d,l.layout.get("text-rotate").evaluate(b,{},A),m,k));const a=1===s.positionedLines.length;if(j+=ry(e,r,t,s,o,l,f,b,m,V,i.vertical?Sf.horizontal:Sf.horizontalOnly,a?km(i.horizontal):[n],q,G,w,I,A,e.symbolInstances.length,S),a)break}i.vertical&&($+=ry(e,r,t,i.vertical,o,l,f,b,m,V,Sf.vertical,["vertical"],q,X,w,I,A,e.symbolInstances.length,S));let K=-1;const Q=(e,t)=>e?Math.max(e,t):t;K=Q(L,K),K=Q(R,K),K=Q(O,K);const ee=K>-1?1:0;e.glyphOffsetArray.length>=65535&&be("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),void 0!==b.sortKey&&e.addToSortKeyRanges(e.symbolInstances.length,b.sortKey),e.symbolInstances.emplaceBack(t.x,t.y,Z.x,Z.y,Z.z,q.right>=0?q.right:-1,q.center>=0?q.center:-1,q.left>=0?q.left:-1,q.vertical>=0?q.vertical:-1,G,X,H,void 0!==E?E:e.collisionBoxArray.length,void 0!==E?E+1:e.collisionBoxArray.length,void 0!==C?C:e.collisionBoxArray.length,void 0!==C?C+1:e.collisionBoxArray.length,void 0!==D?D:e.collisionBoxArray.length,void 0!==D?D+1:e.collisionBoxArray.length,F||e.collisionBoxArray.length,F?F+1:e.collisionBoxArray.length,c,j,$,U,N,ee,0,W,J,K,0,Y?1:0,P)}(e,l,I,a,r,n,s,i,e.layers[0],e.collisionBoxArray,t.index,t.sourceLayerIndex,e.index,E,x,u,0,D,F,g,t,o,c,h,p,f,m,y,U,b,w,_)};if("line"===v)for(const j of ud(t.geometry,0,0,tn,tn)){const t=em(j,V,C,r.vertical||B,n,24,k,e.overscaling,tn);for(const r of t)B&&ay(e,B.text,L,r)||N(j,r,p)}else if("line-center"===v){for(const j of t.geometry)if(j.length>1){const e=Qf(j,C,r.vertical||B,n,24,k);e&&N(j,e,p)}}else if("Polygon"===t.type)for(const j of nh(t.geometry,0)){const e=Pm(j,16);N(j[0],new Zf(e.x,e.y,0,0,void 0),p)}else if("LineString"===t.type)for(const j of t.geometry)N(j,new Zf(j[0].x,j[0].y,0,0,void 0),p);else if("Point"===t.type)for(const j of t.geometry)for(const e of j)N([e],new Zf(e.x,e.y,0,0,void 0),p)}const ey=255,ty=ey*Gf;function ry(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y,g,x){const v=Bm(0,n,l,s,o,a,i,e.allowVerticalPlacement,void 0,f.textScaleFactor),b=s.layout.get("text-size").evaluate(a,{},y),w=f.compositeTextSizes?f.compositeTextSizes[0].evaluate(a,{},y):0,_=f.compositeTextSizes?f.compositeTextSizes[1].evaluate(a,{},y):0,I=ny(e.layerIds[0],e.textSizeData,b,f.textScaleFactor,w,_);e.addSymbols(e.text,v,I,l,o,a,c,t,r,u.lineStartIndex,u.lineLength,d,m,y,x,!1,g,v.length);for(const A of h)p[A]=e.text.placedSymbolArray.length-1;return 4*v.length}function ny(e,t,r,n,i,s){const o=t;let a=null;return"source"===o.kind?(a=[Gf*r*n],a[0]>ty&&be(`${e}: Value for "text-size" or "icon-size" is >= ${ey}. Reduce your "text-size" or "icon-size".`)):"composite"===o.kind&&(a=[Gf*i*n,Gf*s*n],(a[0]>ty||a[1]>ty)&&be(`${e}: Value for "text-size" or "icon-size" is >= ${ey}. Reduce your "text-size" or "icon-size".`)),a}function iy(e){for(const t in e)return e[t];return null}function sy(e,t,r,n,i,s,o,a,l,u,c){let h,p,d,f;if(h=c?c.top:o.top,p=c?c.bottom:o.bottom,d=c?c.left:o.left,f=c?c.right:o.right,Rf(o)&&o.collisionPadding){const e=o.collisionPadding;d-=e[0],h-=e[1],f+=e[2],p+=e[3]}if(l){const e=new oe(d,h),t=new oe(f,h),r=new oe(d,p),n=new oe(f,p),i=ce(l);let s=new oe(0,0);u&&(s=new oe(u[0],u[1])),e._rotateAround(i,s),t._rotateAround(i,s),r._rotateAround(i,s),n._rotateAround(i,s),d=Math.min(e.x,t.x,r.x,n.x),f=Math.max(e.x,t.x,r.x,n.x),h=Math.min(e.y,t.y,r.y,n.y),p=Math.max(e.y,t.y,r.y,n.y)}return e.emplaceBack(t.x,t.y,t.z,r.x,r.y,d,h,f,p,a,n,i,s),e.length-1}function oy(e){Rf(e)&&e.collisionPadding&&(e.top-=e.collisionPadding[1],e.bottom+=e.collisionPadding[3]);const t=e.bottom-e.top;return t>0?Math.max(10,t):null}function ay(e,t,r,n){const i=e.compareText;if(t in i){const e=i[t];for(let t=e.length-1;t>=0;t--)if(n.dist(e[t])<r)return!0}else i[t]=[];return i[t].push(n),!1}function ly(e,t){const r=e.fovAboveCenter,n=e.elevation?e.elevation.getMinElevationBelowMSL()*t:0,i=Math.min(n,e.isOrthographic?-10*t:0),s=(e._camera.position[2]*e.worldSize-i)/Math.cos(e._pitch),o=Math.sin(r)*s/Math.sin(Math.max(Math.PI/2-e._pitch-r,.01));let a=Math.sin(e._pitch)*o+s;const l=s*(1/e._horizonShift);if(!e.elevation||0===e.elevation.exaggeration()){let t=Math.max(e.zoom-17,0);e.isOrthographic&&(t/=10),a*=1+t}return Math.min(1.01*a,l)}function uy(e,t){if(!t.isReprojectedInTileSpace)return{scale:1<<e.z,x:e.x,y:e.y,x2:e.x+1,y2:e.y+1,projection:t};const r=Math.pow(2,-e.z),n=e.x*r,i=(e.x+1)*r,s=e.y*r,o=(e.y+1)*r,a=Rl(n),l=Rl(i),u=Ol(s),c=Ol(o),h=t.project(a,u),p=t.project(l,u),d=t.project(l,c),f=t.project(a,c);let m=Math.min(h.x,p.x,d.x,f.x),y=Math.min(h.y,p.y,d.y,f.y),g=Math.max(h.x,p.x,d.x,f.x),x=Math.max(h.y,p.y,d.y,f.y);const v=r/16;function b(e,r,n,i,s,o){const a=(n+s)/2,l=(i+o)/2,u=t.project(Rl(a),Ol(l)),c=Math.max(0,m-u.x,y-u.y,u.x-g,u.y-x);m=Math.min(m,u.x),g=Math.max(g,u.x),y=Math.min(y,u.y),x=Math.max(x,u.y),c>v&&(b(e,u,n,i,a,l),b(u,r,a,l,s,o))}b(h,p,n,s,i,s),b(p,d,i,s,i,o),b(d,f,i,o,n,o),b(f,h,n,o,n,s),m-=v,y-=v,g+=v,x+=v;const w=1/Math.max(g-m,x-y);return{scale:w,x:m*w,y:y*w,x2:g*w,y2:x*w,projection:t}}const cy=s(new Float32Array(16));class hy{constructor(e){this.spec=e,this.name=e.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(e,t){return{x:0,y:0,z:0}}unproject(e,t){return new Vl(0,0)}projectTilePoint(e,t,r){return{x:e,y:t,z:0}}locationPoint(e,t,r,n=!0){return e._coordinatePoint(e.locationCoordinate(t,r),n)}pixelsPerMeter(e,t){return Ll(1,e)*t}pixelSpaceConversion(e,t,r){return 1}farthestPixelDistance(e){return ly(e,e.pixelsPerMeter)}pointCoordinate(e,t,r,n){const i=e.horizonLineFromTop(!1),s=new oe(t,Math.max(i,r));return e.rayIntersectionCoordinate(e.pointRayIntersection(s,n))}pointCoordinate3D(e,t,r){const n=new oe(t,r);if(e.elevation)return e.elevation.pointCoordinate(n);{const t=this.pointCoordinate(e,n.x,n.y,0);return[t.x,t.y,t.z]}}isPointAboveHorizon(e,t){if(e.elevation&&e.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(e,t.x,t.y);const r=e.horizonLineFromTop();return t.y<r}createInversionMatrix(e,t){return cy}createTileMatrix(e,t,r){let n,i,o;const a=r.canonical,c=s(new Float64Array(16));if(this.isReprojectedInTileSpace){const s=uy(a,this);n=1,i=s.x+r.wrap*s.scale,o=s.y,u(c,c,[n/s.scale,n/s.scale,e.pixelsPerMeter/t])}else n=t/e.zoomScale(a.z),i=(a.x+Math.pow(2,a.z)*r.wrap)*n,o=a.y*n;return l(c,c,[i,o,0]),u(c,c,[n/tn,n/tn,1]),c}upVector(e,t,r){return[0,0,1]}upVectorScale(e,t,r){return{metersToTile:1}}}class py extends hy{constructor(e){super(e),this.range=[4,7],this.center=e.center||[-96,37.5];const[t,r]=this.parallels=e.parallels||[29.5,45.5],n=Math.sin(ce(t));this.n=(n+Math.sin(ce(r)))/2,this.c=1+n*(2*this.n-n),this.r0=Math.sqrt(this.c)/this.n}project(e,t){const{n:r,c:n,r0:i}=this,s=ce(e-this.center[0]),o=ce(t),a=Math.sqrt(n-2*r*Math.sin(o))/r;return{x:a*Math.sin(s*r),y:a*Math.cos(s*r)-i,z:0}}unproject(e,t){const{n:r,c:n,r0:i}=this,s=i+t;let o=Math.atan2(e,Math.abs(s))*Math.sign(s);s*r<0&&(o-=Math.PI*Math.sign(e)*Math.sign(s));const a=ce(this.center[0])*r;o=fe(o,-Math.PI-a,Math.PI-a);const l=pe(he(o/r)+this.center[0],-180,180),u=Math.asin(pe((n-(e*e+s*s)*r*r)/(2*r),-1,1)),c=pe(he(u),-85.051129,Ul);return new Vl(l,c)}}const dy=1.340264,fy=-.081106,my=893e-6,yy=.003796,gy=Math.sqrt(3)/2;class xy extends hy{project(e,t){t=t/180*Math.PI,e=e/180*Math.PI;const r=Math.asin(gy*Math.sin(t)),n=r*r,i=n*n*n;return{x:.5*(e*Math.cos(r)/(gy*(dy+3*fy*n+i*(7*my+9*yy*n)))/Math.PI+.5),y:1-.5*(r*(dy+fy*n+i*(my+yy*n))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let r=t=(2*(1-t)-1)*Math.PI,n=r*r,i=n*n*n;for(let u,c,h,p=0;p<12&&(c=r*(dy+fy*n+i*(my+yy*n))-t,h=dy+3*fy*n+i*(7*my+9*yy*n),u=c/h,r=pe(r-u,-Math.PI/3,Math.PI/3),n=r*r,i=n*n*n,!(Math.abs(u)<1e-12));++p);const s=gy*e*(dy+3*fy*n+i*(7*my+9*yy*n))/Math.cos(r),o=Math.asin(Math.sin(r)/gy),a=pe(180*s/Math.PI,-180,180),l=pe(180*o/Math.PI,-85.051129,Ul);return new Vl(a,l)}}class vy extends hy{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){return{x:.5+e/360,y:.5-t/360,z:0}}unproject(e,t){const r=360*(e-.5),n=pe(360*(.5-t),-85.051129,Ul);return new Vl(r,n)}}const by=Math.PI/2;function wy(e){return Math.tan((by+e)/2)}class _y extends hy{constructor(e){super(e),this.center=e.center||[0,30];const[t,r]=this.parallels=e.parallels||[30,30];let n=ce(t),i=ce(r);this.southernCenter=n+i<0,this.southernCenter&&(n=-n,i=-i);const s=Math.cos(n),o=wy(n);this.n=n===i?Math.sin(n):Math.log(s/Math.cos(i))/Math.log(wy(i)/o),this.f=s*Math.pow(wy(n),this.n)/this.n}project(e,t){t=ce(t),this.southernCenter&&(t=-t),e=ce(e-this.center[0]);const r=1e-6,{n:n,f:i}=this;i>0?t<-by+r&&(t=-by+r):t>by-r&&(t=by-r);const s=i/Math.pow(wy(t),n);let o=s*Math.sin(n*e),a=i-s*Math.cos(n*e);return o=.5*(o/Math.PI+.5),a=.5*(a/Math.PI+.5),{x:o,y:this.southernCenter?a:1-a,z:0}}unproject(e,t){e=(2*e-.5)*Math.PI,this.southernCenter&&(t=1-t),t=(2*(1-t)-.5)*Math.PI;const{n:r,f:n}=this,i=n-t,s=Math.sign(i),o=Math.sign(r)*Math.sqrt(e*e+i*i);let a=Math.atan2(e,Math.abs(i))*s;i*r<0&&(a-=Math.PI*Math.sign(e)*s);const l=pe(he(a/r)+this.center[0],-180,180),u=pe(he(2*Math.atan(Math.pow(n/o,1/r))-by),-85.051129,Ul);return new Vl(l,this.southernCenter?-u:u)}}class Iy extends hy{constructor(e){super(e),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(e,t){return{x:Cl(e),y:Fl(t),z:0}}unproject(e,t){const r=Rl(e),n=Ol(t);return new Vl(r,n)}}const Ay=ce(Ul);class Sy extends hy{project(e,t){const r=(t=ce(t))*t,n=r*r;return{x:.5*((e=ce(e))*(.8707-.131979*r+n*(n*(.003971*r-.001529*n)-.013791))/Math.PI+.5),y:1-.5*(t*(1.007226+r*(.015085+n*(.028874*r-.044475-.005916*n)))/Math.PI+1),z:0}}unproject(e,t){e=(2*e-.5)*Math.PI;let r=t=(2*(1-t)-1)*Math.PI,n=25,i=0,s=r*r;do{s=r*r;const e=s*s;i=(r*(1.007226+s*(.015085+e*(.028874*s-.044475-.005916*e)))-t)/(1.007226+s*(.045255+e*(.259866*s-.311325-.005916*11*e))),r=pe(r-i,-Ay,Ay)}while(Math.abs(i)>1e-6&&--n>0);s=r*r;const o=pe(he(e/(.8707+s*(s*(s*s*s*(.003971-.001529*s)-.013791)-.131979))),-180,180),a=he(r);return new Vl(o,a)}}const My=ce(Ul);class By extends hy{project(e,t){t=ce(t),e=ce(e);const r=Math.cos(t),n=2/Math.PI,i=Math.acos(r*Math.cos(e/2)),s=Math.sin(i)/i,o=.5*(e*n+2*r*Math.sin(e/2)/s)||0,a=.5*(t+Math.sin(t)/s)||0;return{x:.5*(o/Math.PI+.5),y:1-.5*(a/Math.PI+1),z:0}}unproject(e,t){let r=e=(2*e-.5)*Math.PI,n=t=(2*(1-t)-1)*Math.PI,i=25;const s=1e-6;let o=0,a=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),d=2*h*p,f=p*p,m=1-c*h*h,y=m?1/m:0,g=m?Math.acos(i*h)*Math.sqrt(1/m):0,x=.5*(2*g*i*p+2*r/Math.PI)-e,v=.5*(g*s+n)-t,b=.5*y*(c*f+g*i*h*u)+1/Math.PI,w=y*(d*l/4-g*s*p),_=.125*y*(l*p-g*s*c*d),I=.5*y*(u*h+g*f*i)+.5,A=w*_-I*b;o=(v*w-x*I)/A,a=(x*_-v*b)/A,r=pe(r-o,-Math.PI,Math.PI),n=pe(n-a,-My,My)}while((Math.abs(o)>s||Math.abs(a)>s)&&--i>0);return new Vl(he(r),he(n))}}class Py extends hy{constructor(e){super(e),this.center=e.center||[0,0],this.parallels=e.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(ce(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(e,t){const{scale:r,cosPhi:n}=this;return{x:ce(e)*n*r+.5,y:-Math.sin(ce(t))/n*r+.5,z:0}}unproject(e,t){const{scale:r,cosPhi:n}=this,i=-(t-.5)/r,s=pe(he((e-.5)/r)/n,-180,180),o=Math.asin(pe(i*n,-1,1)),a=pe(he(o),-85.051129,Ul);return new Vl(s,a)}}class zy extends Iy{constructor(e){super(e),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(e,t,r){const n=ic(e,t,r);return k(n,n,ac(rc(r))),{x:n[0],y:n[1],z:n[2]}}locationPoint(e,t,r){const n=zl(t.lat,t.lng),i=B([],n),o=r?e._centerAltitude+r:e.elevation?e.elevation.getAtPointOrZero(e.locationCoordinate(t),e._centerAltitude):e._centerAltitude;I(n,n,i,Ll(1,0)*tn*o);const l=s(new Float64Array(16));return a(l,e.pixelMatrix,e.globeMatrix),k(n,n,l),new oe(n[0],n[1])}pixelsPerMeter(e,t){return Ll(1,0)*t}pixelSpaceConversion(e,t,r){const n=Ll(1,e)*t,i=Bt(Ll(1,45)*t,n,r);return this.pixelsPerMeter(e,t)/i}createTileMatrix(e,t,r){const n=function(e){const t=1/sc(e);return function(e,t){e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1}(oc,e.min),u(oc,oc,[t,t,t])}(rc(r.canonical));return a(new Float64Array(16),e.globeMatrix,n)}createInversionMatrix(e,t){const{center:r}=e,n=ac(rc(t));return h(n,n,ce(r.lng)),c(n,n,ce(r.lat)),u(n,n,[e._pixelsPerMercatorPixel,e._pixelsPerMercatorPixel,1]),Float32Array.from(n)}pointCoordinate(e,t,r,n){return tc(e,t,r,!0)||new Gl(0,0)}pointCoordinate3D(e,t,r){const n=this.pointCoordinate(e,t,r,0);return[n.x,n.y,n.z]}isPointAboveHorizon(e,t){return!tc(e,t.x,t.y,!1)}farthestPixelDistance(e){const t=function(e,t){const r=e.cameraToCenterDistance,n=e._centerAltitude*t,i=e._camera,s=e._camera.forward(),o=x([],_([],s,-r),[0,0,n]),a=e.worldSize/(2*Math.PI),l=[0,0,-a],u=e.width/e.height,c=Math.tan(e.fovAboveCenter),h=_([],i.up(),c),p=_([],i.right(),c*u),d=B([],x([],x([],s,h),p)),f=[];let y;if(new yu(o,d).closestPointOnSphere(l,a,f)){const t=x([],f,l),r=F([],t,o);y=Math.cos(e.fovAboveCenter)*m(r)}else{const e=F([],o,l),t=F([],l,o);B(t,t);const r=m(e)-a;y=Math.sqrt(r*(r+2*a));const n=Math.acos(y/(a+r))-Math.acos(P(s,t));y*=Math.cos(n)}return 1.01*y}(e,this.pixelsPerMeter(e.center.lat,e.worldSize)),r=uc(e.zoom);if(r>0){const n=ly(e,Ll(1,e.center.lat)*e.worldSize),i=e.worldSize/(2*Math.PI),s=Math.max(e.width,e.height)/e.worldSize*Math.PI;return Bt(t,n+i*(1-Math.cos(s)),Math.pow(r,10))}return t}upVector(e,t,r){return ic(t,r,e,1)}upVectorScale(e){return{metersToTile:Qu(sc(rc(e)))}}}function Ty(e){const t=e.parallels,r=!!t&&Math.abs(t[0]+t[1])<.01;switch(e.name){case"mercator":return new Iy(e);case"equirectangular":return new vy(e);case"naturalEarth":return new Sy(e);case"equalEarth":return new xy(e);case"winkelTripel":return new By(e);case"albers":return r?new Py(e):new py(e);case"lambertConformalConic":return r?new Py(e):new _y(e);case"globe":return new zy(e)}throw new Error(`Invalid projection name: ${e.name}`)}class ky{constructor(e,t){this.lastParams=null,this.lastAllFeaturesIndex=-2,this.appearancesVersion=t,this.appearances=e;const r=e.map(e=>function(e){if(!e.condition)return{featureDependent:!1,stateDependent:!1,zoomDependent:!1,pitchDependent:!1,brightnessDependent:!1,worldviewDependent:!1};const t=e.condition.expression;return{featureDependent:!kn(t),stateDependent:!Vn(t),zoomDependent:!En(t,["zoom"]),pitchDependent:!En(t,["pitch"]),brightnessDependent:!En(t,["brightness","measure-light"]),worldviewDependent:!En(t,["worldview"])}}(e));this.anyFeatureDependent=r.some(e=>e.featureDependent),this.anyStateDependent=r.some(e=>e.stateDependent)}update(e,t){const r=this.lastParams,n=!r||r.zoom!==e.zoom||r.pitch!==(e.pitch||0)||r.brightness!==(e.brightness||0)||r.worldview!==e.worldview;this.lastParams={zoom:e.zoom,pitch:e.pitch||0,brightness:e.brightness||0,worldview:e.worldview};const i=t&&this.anyStateDependent;if(!n&&!i&&-2!==this.lastAllFeaturesIndex)return{kind:"no-changes"};if(!this.anyFeatureDependent&&!i){const t=this.evaluateAllFeatures(e);return t===this.lastAllFeaturesIndex?{kind:"no-changes"}:(this.lastAllFeaturesIndex=t,{kind:"all-features",appearanceIndex:t})}return{kind:"per-feature"}}evaluateAllFeatures(e){for(let t=0;t<this.appearances.length;t++){const r=this.appearances[t];if(r.condition&&r.condition.evaluate(e,void 0,void 0,void 0))return t}return-1}}const Vy=eu.types,Ey=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function Dy(e,t,r,n,i,s,o,a,l,u,c,h,p){const d=a?Math.min(ty,Math.round(a[0])):0,f=a?Math.min(ty,Math.round(a[1])):0;e.emplaceBack(t,r,Math.round(32*n),Math.round(32*i),s,o,(d<<1)+(l?1:0),0+(f<<1),16*u,16*c,256*h,256*p)}function Cy(e,t,r){e.emplaceBack(t,r)}function Fy(e,t,r,n,i,s,o){e.emplaceBack(t,r,n,i,s,o)}const Ly=(e,t,r,n)=>{for(let i=0;i<t;i++)e.emplaceBack(r[0],r[1],r[2],n[0],n[1],n[2])};function Ry(e,t,r,n,i){e.emplaceBack(t,r,n,i),e.emplaceBack(t,r,n,i),e.emplaceBack(t,r,n,i),e.emplaceBack(t,r,n,i)}function Oy(e){for(const t of e.sections)if(Ks(t.text))return!0;return!1}const Uy=12;class Ny{constructor(e){this.layoutVertexArray=new pa,this.indexArray=new wa,this.programConfigurations=e,this.segments=new Ka,this.dynamicLayoutVertexArray=new fa,this.opacityVertexArray=new ma,this.placedSymbolArray=new Oa,this.iconTransitioningVertexArray=new ya,this.globeExtVertexArray=new da,this.zOffsetVertexArray=new ra,this.orientationVertexArray=new Aa,this.symbolInstanceIndices=[],this.uboBinder=null,this.featureIdArray=new ra,this.featureIdBuffer=null,this.cachedBatchIndices=null,this.cachedBatchSegments=null}isEmpty(){return 0===this.layoutVertexArray.length&&0===this.indexArray.length&&0===this.dynamicLayoutVertexArray.length&&0===this.opacityVertexArray.length&&0===this.iconTransitioningVertexArray.length}getBatchGrouping(e){const t=e.get().length===this.segments.get().length;if(t&&this.cachedBatchIndices&&this.cachedBatchSegments)return{batchIndices:this.cachedBatchIndices,batchSegments:this.cachedBatchSegments};const r=/* @__PURE__ */new Map;for(const s of e.get()){const e=void 0!==s.batchIndex?s.batchIndex:0;r.has(e)||r.set(e,[]),r.get(e).push(s)}const n=Array.from(r.keys()).sort((e,t)=>e-t),i=/* @__PURE__ */new Map;for(const s of n){const e=r.get(s);i.set(s,new Ka(e))}return t&&(this.cachedBatchIndices=n,this.cachedBatchSegments=i),{batchIndices:n,batchSegments:i}}snapshotSymbolVertexData(e,t){const r=e*Uy;return this.layoutVertexArray.uint16.slice(r,r+t*Uy)}restoreSymbolVertexData(e,t){this.layoutVertexArray.uint16.set(t,e*Uy)}updateSymbolVertexData(e,t,r,n,i,s,o,a,l,u,c,h,p){const d=this.layoutVertexArray.uint16,f=e*Uy;d[f]=t,d[f+1]=r,d[f+2]=n,d[f+3]=i,d[f+4]=s,d[f+5]=o,d[f+6]=a,d[f+7]=l,d[f+8]=u,d[f+9]=c,d[f+10]=h,d[f+11]=p}upload(e,t,r,n,i,s){this.isEmpty()||(r&&(this.cachedBatchIndices=null,this.cachedBatchSegments=null,this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,Gd.members,!!s),this.indexBuffer=e.createIndexBuffer(this.indexArray,t),this.dynamicLayoutVertexBuffer=e.createVertexBuffer(this.dynamicLayoutVertexArray,qd.members,!0),this.opacityVertexBuffer=e.createVertexBuffer(this.opacityVertexArray,Ey,!0),this.iconTransitioningVertexArray.length>0&&(this.iconTransitioningVertexBuffer=e.createVertexBuffer(this.iconTransitioningVertexArray,Wd.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=e.createVertexBuffer(this.globeExtVertexArray,Xd.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||i)&&(this.zOffsetVertexBuffer=e.createVertexBuffer(this.zOffsetVertexArray,Hd.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=e.createVertexBuffer(this.orientationVertexArray,Yd.members,!0)),this.opacityVertexBuffer.itemSize=1,this.featureIdArray&&this.featureIdArray.length>0&&(this.featureIdBuffer=e.createVertexBuffer(this.featureIdArray,Zd.members,!1))),(r||n)&&(this.programConfigurations.upload(e),this.uboBinder&&this.uboBinder.upload(e)))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy(),this.featureIdBuffer&&this.featureIdBuffer.destroy(),this.uboBinder&&this.uboBinder.destroy())}}ps(Ny,"SymbolBuffers",{omit:["cachedBatchIndices","cachedBatchSegments"]});class jy{constructor(e,t,r){this.layoutVertexArray=new e,this.layoutAttributes=t,this.indexArray=new r,this.segments=new Ka,this.collisionVertexArray=new ba,this.collisionVertexArrayExt=new fa}upload(e){this.layoutVertexBuffer=e.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=e.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=e.createVertexBuffer(this.collisionVertexArray,Jd.members,!0),this.collisionVertexBufferExt=e.createVertexBuffer(this.collisionVertexArrayExt,Kd.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}ps(jy,"CollisionBuffers");class $y{constructor(e){this.collisionBoxArray=e.collisionBoxArray,this.zoom=e.zoom,this.overscaling=e.overscaling,this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.index=e.index,this.pixelRatio=e.pixelRatio,this.sourceLayerIndex=e.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=s([]),this.placementViewportMatrix=s([]);const t=this.layers[0]._unevaluatedLayout._values;this.worldview=e.worldview,this.localizable=e.localizable,this.maxUniformBufferBindings=e.maxUniformBufferBindings,this.maxUniformBlockSizeDwords=e.maxUniformBlockSizeDwords,this.disableSymbolUBO=e.disableSymbolUBO,this.textSizeData=Xf(this.zoom,t["text-size"],this.worldview,e.availableImages),this.iconSizeData=Xf(this.zoom,t["icon-size"],this.worldview,e.availableImages);const r=this.layers[0].layout,n=r.get("symbol-sort-key"),i=r.get("symbol-z-order");this.lut=e.lut,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(e=>Sf[e]),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.sourceID=e.sourceID,this.projection=e.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.featureAppearances=null,this.featureAppearanceData=/* @__PURE__ */new Map}hasAnyAppearanceLayoutProperty(e){const t=this.layers[0].getAppearances();if(!t||0===t.length)return!1;const r=Array.isArray(e)?e:[e];return t.some(e=>r.some(t=>e.hasLayoutProperty(t)))}getAppearanceFeatureData(e){return this.featureAppearanceData.get(e)}createArrays(){this.text=new Ny(new vl(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("text")||e.startsWith("symbol"))),this.icon=new Ny(new vl(this.layers,{zoom:this.zoom,lut:this.lut},e=>e.startsWith("icon")||e.startsWith("symbol"))),this.disableSymbolUBO||(this.text.uboBinder=new nf(this.layers[0],this.zoom,this.lut,!0,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords),this.icon.uboBinder=new nf(this.layers[0],this.zoom,this.lut,!1,"",this.maxUniformBufferBindings,this.maxUniformBlockSizeDwords)),this.glyphOffsetArray=new ja,this.lineVertexArray=new $a,this.symbolInstances=new Na}calculateGlyphDependencies(e,t,r,n,i){for(const s of e){const e=s.codePointAt(0);if(void 0===e)break;if(t[e]=!0,n&&i&&e<=65535){const e=af[s];e&&(t[e.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(e,t,r,n,i,s,o){if(!e.hasLayoutProperty("icon-size"))return o*s;let a=1;const l=e.getUnevaluatedLayoutProperty("icon-size"),u=Xf(this.zoom,l,this.worldview,i),c=Hf(u,t);if("constant"!==u.kind&&"camera"!==u.kind||(a=c.uSize),"composite"===u.kind){const{minZoom:e,maxZoom:t}=u,s=l.possiblyEvaluate(new lo(e,{worldview:this.worldview}),n),o=l.possiblyEvaluate(new lo(t,{worldview:this.worldview}),n),h=s.evaluate(r,{},n,i);a=h+(o.evaluate(r,{},n,i)-h)*c.uSizeT}return"source"===u.kind&&(a=l.possiblyEvaluate(new lo(this.zoom,{worldview:this.worldview}),n).evaluate(r,{},n,i)),a*s}updateFootprints(e,t){}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const r=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);return!gp(this.activeReplacements,r)&&(this.activeReplacements=r,!0)}getResolvedImageFromTokens(e){return"string"==typeof e?rr.build(e):e}populate(e,t,r,n){const i=this.layers[0],s=i.layout,o="globe"===this.projection.name,a=s.get("text-font"),l=s.get("text-field"),u=s.get("icon-image"),[c,h]=s.get("icon-size-scale-range"),p=pe(t.scaleFactor||1,c,h),[d,f]=s.get("text-size-scale-range"),m=pe(t.scaleFactor||1,d,f),y=("constant"!==l.value.kind||l.value.value instanceof er&&!l.value.value.isEmpty()||l.value.value.toString().length>0)&&("constant"!==a.value.kind||a.value.value.length>0),g="constant"!==u.value.kind||!!u.value.value||Object.keys(u.parameters).length>0,x=this.hasAnyAppearanceLayoutProperty("icon-image"),v=s.get("symbol-sort-key");if(this.features=[],this.featureAppearanceData=/* @__PURE__ */new Map,!y&&!g&&!x)return;const b=t.iconDependencies,w=t.glyphDependencies,_=t.availableImages,I=new lo(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),A=e=>{const t=e.id.toString();b.has(t)?b.get(t).push(e):b.set(t,[e])};for(const S of e){const{feature:e,id:t,index:l,sourceLayerIndex:u}=S,c=i._featureFilter.needGeometry,h=Ql(e,c);if(!i._featureFilter.filter(I,h,r))continue;if(c||(h.geometry=Kl(e,r,n)),o&&1!==e.type&&r.z<=5){const e=h.geometry,t=.98078528056,n=(e,n)=>P(ic(e.x,e.y,r,1),ic(n.x,n.y,r,1))<t;for(let r=0;r<e.length;r++)e[r]=Zl(e[r],n)}let d,f;if(y){const e=i.getValueAndResolveTokens("text-field",h,r,_),t=er.factory(e);Oy(t)&&(this.hasRTLText=!0),(!this.hasRTLText||"unavailable"===oo()||this.hasRTLText&&ao.isParsed())&&(d=of(t,i,h))}if(g){const e=i.getValueAndResolveTokens("icon-image",h,r,_);f=this.getResolvedImageFromTokens(e)}const M=this.layers[0];let B=!1;if(!f&&x){const e=M.getAppearances();for(const t of e)if(t.getLayoutProperty("icon-image")){const e=M.getAppearanceValueAndResolveTokens(t,"icon-image",h,r,_);if(e){f=this.getResolvedImageFromTokens(e),B=!0;break}}}if(!d&&!f)continue;const z=this.sortFeaturesByKey?v.evaluate(h,{},r):void 0,T={id:t,text:d,icon:f,index:l,sourceLayerIndex:u,geometry:h.geometry,properties:e.properties,type:Vy[e.type],sortKey:z};if(this.features.push(T),this.featureAppearanceData.set(l,{id:t,properties:e.properties,usesAppearanceIconAsPlaceholder:B}),f){const e=M._unevaluatedLayout._values,{iconPrimary:t,iconSecondary:n}=Gm(f,this.iconSizeData,e["icon-size"],r,this.zoom,T,this.pixelRatio,p,this.worldview,_);A(t),n&&(this.hasAnySecondaryIcon=!0,A(n))}const k=M.getAppearances();if(0!==k.length&&k.forEach(e=>{if(!e.getLayoutProperty("icon-image"))return;const t=this.getCombinedIconPrimary(e,M,h,r,_,T,p);t&&A(t)}),d){const e=a.evaluate(h,{},r).join(","),t="map"===s.get("text-rotation-alignment")&&"point"!==s.get("symbol-placement");this.allowVerticalPlacement=this.writingModes&&this.writingModes.includes(Sf.vertical);for(const r of d.sections)if(r.image){const e=r.image.getPrimary().scaleSelf(this.pixelRatio*m),t=e.id.toString(),n=b.get(t)||[];n.push(e),b.set(t,n)}else{const n=js(d.toString()),i=r.fontStack||e,s=w[i]=w[i]||{};this.calculateGlyphDependencies(r.text,s,t,this.allowVerticalPlacement,n)}}}if("line"===s.get("symbol-placement")&&(this.features=function(e){const t={},r={},n=[];let i=0;function s(t){n.push(e[t]),i++}function o(e,t,i){const s=r[e];return delete r[e],r[t]=s,n[s].geometry[0].pop(),n[s].geometry[0]=n[s].geometry[0].concat(i[0]),s}function a(e,r,i){const s=t[r];return delete t[r],t[e]=s,n[s].geometry[0].shift(),n[s].geometry[0]=i[0].concat(n[s].geometry[0]),s}function l(e,t,r){const n=r?t[0].at(-1):t[0][0];return`${e}:${n.x}:${n.y}`}for(let u=0;u<e.length;u++){const c=e[u],h=c.geometry,p=c.text?c.text.toString():null;if(!p){s(u);continue}const d=l(p,h),f=l(p,h,!0);if(d in r&&f in t&&r[d]!==t[f]){const e=a(d,f,h),i=o(d,f,n[e].geometry);delete t[d],delete r[f],r[l(p,n[i].geometry,!0)]=i,n[e].geometry=null}else d in r?o(d,f,h):f in t?a(d,f,h):(s(u),t[d]=i-1,r[f]=i-1)}return n.filter(e=>e.geometry)}(this.features)),"hd-road-markup"===s.get("symbol-elevation-reference")){if(this.elevationType="road",t.elevationFeatures){!this.elevationFeatures&&t.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=/* @__PURE__ */new Map);for(const e of t.elevationFeatures)this.elevationFeatureIdToIndex.set(e.id,this.elevationFeatures.length),this.elevationFeatures.push(e)}}else s.get("symbol-z-elevate")&&(this.elevationType="offset");"none"!==this.elevationType&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((e,t)=>e.sortKey-t.sortKey)}getCombinedIconPrimary(e,t,r,n,i,s,o){let a,l;if(e.hasLayoutProperty("icon-image")){const s=t.getAppearanceValueAndResolveTokens(e,"icon-image",r,n,i);a=this.getResolvedImageFromTokens(s)}else{const e=t.getValueAndResolveTokens("icon-image",r,n,i);a=this.getResolvedImageFromTokens(e)}if(a){const r=e.hasLayoutProperty("icon-size")?e.getUnevaluatedLayoutProperty("icon-size"):t._unevaluatedLayout._values["icon-size"];l=Gm(a,Xf(this.zoom,r,this.worldview,i),r,n,this.zoom,s,this.pixelRatio,o,this.worldview,i).iconPrimary}return l}updateSymbolInstanceIconVertices(e,t,r,n,i,s){const{canonical:o,availableImages:a,globalProperties:l,layer:u,iconScaleFactor:c,featureState:h,layoutIconOffset:p,layoutIconSize:d,layoutIconRotate:f}=s;if(e.placedIconSymbolIndex<0)return{vertexOffsetDelta:0,hasChanges:!1};if(t.activeAppearanceIndex===r)return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1};const m=r>=0?u.appearances[r]:null;if(m){const r=this.getCombinedIconPrimary(m,u,n,o,a,{sortKey:void 0,text:void 0,icon:null,index:e.featureIndex,sourceLayerIndex:e.featureIndex,geometry:[],properties:t.properties,type:"Point",id:t.id},c);if(!r)return{vertexOffsetDelta:0,hasChanges:!1};const s=r.toString(),y=this.iconAtlasPositions&&this.iconAtlasPositions.get(s);if(y){const{appearanceIconOffset:r,appearanceIconRotate:s}=Om(m,u,n,o,p,f,d,c);let g=Of(y,void 0,r,u.layout.get("icon-anchor").evaluate(n,h,o));const x=y.sdf,v=u.layout.get("icon-text-fit").constantOr("none");"none"!==v&&t.textShaping&&t.iconTextFitPadding&&t.fontScale&&(g=Uf(g,t.textShaping,v,t.iconTextFitPadding,r,t.fontScale));const b=this.calculateEffectiveAppearanceIconSize(m,l.zoom,n,o,a,c,d),w=0,_=1+(Math.min(ty,Math.round(b*Gf))<<1),I=vm(g,s,x,"none"!==v,c);t.isUsingAppearanceIconVertexData||(t.isUsingAppearanceIconVertexData=!0,t.layoutBasedIconVertexData=this.icon.snapshotSymbolVertexData(i,e.numIconVertices));const A=Math.floor(e.numIconVertices/4),S=Math.min(I.length,A);let M=i;for(let n=0;n<S;++n){const r=I[n],i=t.layoutBasedIconVertexData[0]||e.tileAnchorX,s=t.layoutBasedIconVertexData[1]||e.tileAnchorY,o=16*r.pixelOffsetTL.x,a=16*r.pixelOffsetTL.y,l=16*r.pixelOffsetBR.x,u=16*r.pixelOffsetBR.y,c=16*r.minFontScaleX,h=16*r.minFontScaleY;this.icon.updateSymbolVertexData(M,i,s,Math.round(32*r.tl.x),Math.round(32*r.tl.y),r.texPrimary.x,r.texPrimary.y,w,_,o,a,c,h),this.icon.updateSymbolVertexData(M+1,i,s,Math.round(32*r.tr.x),Math.round(32*r.tr.y),r.texPrimary.x+r.texPrimary.w,r.texPrimary.y,w,_,l,a,c,h),this.icon.updateSymbolVertexData(M+2,i,s,Math.round(32*r.bl.x),Math.round(32*r.bl.y),r.texPrimary.x,r.texPrimary.y+r.texPrimary.h,w,_,o,u,c,h),this.icon.updateSymbolVertexData(M+3,i,s,Math.round(32*r.br.x),Math.round(32*r.br.y),r.texPrimary.x+r.texPrimary.w,r.texPrimary.y+r.texPrimary.h,w,_,l,u,c,h),M+=4}const B=e.numIconVertices-4*S;for(let e=0;e<B;++e)this.icon.updateSymbolVertexData(M+e,0,0,0,0,0,0,0,0,0,0,0,0);return{vertexOffsetDelta:e.numIconVertices,hasChanges:!0}}}else{if(t.usesAppearanceIconAsPlaceholder)return this.icon.updateSymbolVertexData(i,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(i+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(i+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateSymbolVertexData(i+3,0,0,0,0,0,0,0,0,0,0,0,0),{vertexOffsetDelta:e.numIconVertices,hasChanges:!0};if(t.isUsingAppearanceIconVertexData)return this.icon.restoreSymbolVertexData(i,t.layoutBasedIconVertexData),t.isUsingAppearanceIconVertexData=!1,{vertexOffsetDelta:t.layoutBasedIconVertexData.length/Uy,hasChanges:!0}}return{vertexOffsetDelta:e.numIconVertices,hasChanges:!1}}updateSymbolInstanceTextVertices(e,t,r,n,i,s){const{canonical:o,layer:a,textScaleFactor:l,imageMap:u,featureState:c,layoutTextOffset:h,layoutTextSize:p,layoutTextRotate:d,layoutMinZoomSize:f,layoutMaxZoomSize:m,layoutTextSizeMinZoom:y,layoutTextSizeMaxZoom:g,availableImages:x}=s,v=e.numHorizontalGlyphVertices>0||e.numVerticalGlyphVertices>0;if(!v)return{vertexOffsetDelta:v?e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices:0,hasChanges:!1};if(t.activeAppearanceIndex===r)return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1};const b=r>=0?a.appearances[r]:null;if(b&&t.textShaping){const{appearanceTextOffset:r,appearanceTextRotate:s,appearanceTextSize:v}=Nm(b,a,n,o,h,d,p);t.fontScale=Km(v,t.textScaleFactor);const w=b.getUnevaluatedLayoutProperty("text-size");let _=this.textSizeData,I=y,A=g;b.hasLayoutProperty("text-size")&&(_=Xf(this.zoom,w,this.worldview,x),I="composite"===this.textSizeData.kind?this.textSizeData.minZoom:0,A="composite"===this.textSizeData.kind?this.textSizeData.maxZoom:0);const S=t.textShaping.bottom-h[1],M=t.textShaping.left-h[0],B=t.textShaping.right-h[0];t.textShaping.top=r[1]+(t.textShaping.top-h[1]),t.textShaping.bottom=r[1]+S,t.textShaping.left=r[0]+M,t.textShaping.right=r[0]+B;const P=Bm(0,t.textShaping,r,a,!1,n,u,this.allowVerticalPlacement,s),z=v&&"composite"===_.kind?w.possiblyEvaluate(new lo(I,{}),o).evaluate(n,c,o):f,T=v&&"composite"===_.kind?w.possiblyEvaluate(new lo(A,{}),o).evaluate(n,c,o):m,k=ny(b.name,_,v,l,z,T),V=Array.isArray(k)?k[1]:v,E=0,D=1+(Math.min(ty,Math.round(V*Gf))<<1);t.isUsingAppearanceTextVertexData||(t.isUsingAppearanceTextVertexData=!0,t.layoutBasedTextVertexData=this.text.snapshotSymbolVertexData(i,e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices));for(let t=0;t<P.length&&t<(e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices)/4;++t){const r=P[t],n=r.glyphOffset[1],s=e.tileAnchorX,o=e.tileAnchorY,a=i+4*t;this.text.updateSymbolVertexData(a,s,o,Math.round(32*r.tl.x),Math.round(32*(n+r.tl.y)),r.texPrimary.x,r.texPrimary.y,E,D,r.pixelOffsetTL.x,r.pixelOffsetTL.y,r.minFontScaleX,r.minFontScaleY),this.text.updateSymbolVertexData(a+1,s,o,Math.round(32*r.tr.x),Math.round(32*(n+r.tr.y)),r.texPrimary.x+r.texPrimary.w,r.texPrimary.y,E,D,r.pixelOffsetBR.x,r.pixelOffsetTL.y,r.minFontScaleX,r.minFontScaleY),this.text.updateSymbolVertexData(a+2,s,o,Math.round(32*r.bl.x),Math.round(32*(n+r.bl.y)),r.texPrimary.x,r.texPrimary.y+r.texPrimary.h,E,D,r.pixelOffsetTL.x,r.pixelOffsetBR.y,r.minFontScaleX,r.minFontScaleY),this.text.updateSymbolVertexData(a+3,s,o,Math.round(32*r.br.x),Math.round(32*(n+r.br.y)),r.texPrimary.x+r.texPrimary.w,r.texPrimary.y+r.texPrimary.h,E,D,r.pixelOffsetBR.x,r.pixelOffsetBR.y,r.minFontScaleX,r.minFontScaleY)}return{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!0}}return t.isUsingAppearanceTextVertexData?(this.text.restoreSymbolVertexData(i,t.layoutBasedTextVertexData),t.isUsingAppearanceTextVertexData=!1,{vertexOffsetDelta:t.layoutBasedTextVertexData.length/Uy,hasChanges:!0}):{vertexOffsetDelta:e.numHorizontalGlyphVertices+e.numVerticalGlyphVertices,hasChanges:!1}}updateExpressions(e){this.text&&this.text.programConfigurations.updateExpressions(e),this.icon&&this.icon.programConfigurations.updateExpressions(e)}update(e,t,r,n,i,s,o,a){if(this.text.uboBinder||this.text.programConfigurations.updatePaintArrays(e,t,i,r,n,s,o,this.worldview),this.icon.uboBinder||this.icon.programConfigurations.updatePaintArrays(e,t,i,r,n,s,o,this.worldview),a)if(s)this.text.uboBinder&&!this.text.uboBinder.isLightConstant&&this.text.uboBinder.updateDynamicExpressions(i[0],t,a,r,e,o),this.icon.uboBinder&&!this.icon.uboBinder.isLightConstant&&this.icon.uboBinder.updateDynamicExpressions(i[0],t,a,r,e,o);else if(Object.keys(e).length>0){const n=new Set(Object.keys(e).map(e=>{const t=Number(e);return!isNaN(t)&&Number.isSafeInteger(t)&&String(t)===e?t:e}));this.text.uboBinder&&this.text.uboBinder.updateFeatures(n,i[0],t,a,r,e,o),this.icon.uboBinder&&this.icon.uboBinder.updateFeatures(n,i[0],t,a,r,e,o)}}updateRoadElevation(e){if("road"!==this.elevationType||!this.elevationFeatures)return;if(this.elevationStateComplete)return;this.elevationStateComplete=!0,this.hasAnyZOffset=!1;let t=!1;const r=$l(e),n=1/r;let i=!1,s=!1;for(let o=0;o<this.symbolInstances.length;o++){const e=this.symbolInstances.get(o),a=y(1,0,0),l=y(0,1,0),{numHorizontalGlyphVertices:u,numVerticalGlyphVertices:c,numIconVertices:h,numVerticalIconVertices:p}=e,d=u>0||c>0,f=h>0,m=this.elevationFeatures[e.elevationFeatureIndex];if(m){const o=new oe(e.tileAnchorX,e.tileAnchorY),u=.075+m.pointElevation(o);e.zOffset!==u&&(t=!0,e.zOffset=u),0!==u&&(this.hasAnyZOffset=!0);const c=m.computeSlopeNormal(o,n),h=H(O(),y(0,0,1),c);E(a,a,h),E(l,l,h),a[2]*=r,l[2]*=r,1===a[0]&&0===a[1]&&0===a[2]&&0===l[0]&&1===l[1]&&0===l[2]||(i=i||d,s=s||f)}if(d&&(Ly(this.text.orientationVertexArray,u,a,l),Ly(this.text.orientationVertexArray,c,a,l)),f){const{placedIconSymbolIndex:t,verticalPlacedIconSymbolIndex:r}=e;t>=0&&Ly(this.icon.orientationVertexArray,h,a,l),r>=0&&Ly(this.icon.orientationVertexArray,p,a,l)}}i||(this.text.orientationVertexArray=void 0),s||(this.icon.orientationVertexArray=void 0),t&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const e=(e,t,n)=>{r+=t,r>e.length&&e.resize(r);for(let i=-t;i<0;i++)e.emplace(i+r,n)},t=(e,t,r)=>{n+=t,n>e.length&&e.resize(n);for(let i=-t;i<0;i++)e.emplace(i+n,r)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let r=0,n=0;for(let i=0;i<this.symbolInstances.length;i++){const r=this.symbolInstances.get(i),{numHorizontalGlyphVertices:n,numVerticalGlyphVertices:s,numIconVertices:o}=r,a=r.zOffset,l=o>0;if((n>0||s>0)&&(e(this.text.zOffsetVertexArray,n,a),e(this.text.zOffsetVertexArray,s,a)),l){const{placedIconSymbolIndex:e,verticalPlacedIconSymbolIndex:n}=r;e>=0&&t(this.icon.zOffsetVertexArray,o,a),n>=0&&t(this.icon.zOffsetVertexArray,r.numVerticalIconVertices,a)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return 0===this.symbolInstances.length&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(e,t,r,n,i){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(e),this.iconCollisionBox.upload(e)),this.text.upload(e,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),null===this.hasAppearances&&(this.hasAppearances=this.layers.some(e=>e.appearances&&e.appearances.length>0)),this.icon.upload(e,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(e,t,r,n,i,s=!1){const o={hasLayoutChanges:!1,hasUboChanges:!1};if(!e||!r||!this.featureAppearanceData)return o;const a=t||{},l=this.icon.layoutVertexArray&&this.icon.layoutVertexArray.length>0&&this.icon.layoutVertexArray.arrayBuffer,u=this.text.layoutVertexArray&&this.text.layoutVertexArray.length>0&&this.text.layoutVertexArray.arrayBuffer;if(!l&&!u)return o;const c=this.layers[0],h=c.layout;this.featureAppearances&&this.featureAppearances.appearancesVersion===c.appearancesVersion||(this.featureAppearances=new ky(c.appearances,c.appearancesVersion));const p=this.featureAppearances.update(n,s);if("no-changes"===p.kind)return o;let d=1,f=0,m=!1,y=!1;if(l){const[e,t]=h.get("icon-size-scale-range");d=pe(1,e,t)}let g=1,x=0,v=!1;if(u){const[e,t]=h.get("text-size-scale-range");g=pe(1,e,t)}const b=/* @__PURE__ */new Map;if(i&&r)for(const w of r){const e=i.getImage(w,c.scope);if(e){const t=new tr(w.toString());b.set(t.toString(),e)}}for(let w=0;w<this.symbolInstances.length;w++){const t=this.symbolInstances.get(w),i=this.getAppearanceFeatureData(t.featureIndex);if(!i)continue;const s=i.id,o=void 0!==s?a[String(s)]:void 0,_={type:"Point",id:i.id,properties:i.properties,geometry:[]};let I;if("all-features"===p.kind)I=p.appearanceIndex;else{const t=c.appearances?c.appearances.findIndex(t=>t.isActive({globals:n,feature:_,canonical:e,featureState:o})):-1;I=t>=0?t:-1}const A=i.activeAppearanceIndex!==I;if(u){const n=h.get("text-size"),s="composite"===this.textSizeData.kind?this.textSizeData.minZoom:0,a="composite"===this.textSizeData.kind?this.textSizeData.maxZoom:0,l={canonical:e,layer:c,featureState:o,availableImages:r,textScaleFactor:g,imageMap:b,layoutTextOffset:h.get("text-offset").evaluate(_,o,e).map(e=>e*sf),layoutTextSize:n.evaluate(_,o,e),layoutTextRotate:h.get("text-rotate").evaluate(_,o,e),layoutMinZoomSize:n.evaluate(_,{zoom:s},e),layoutMaxZoomSize:n.evaluate(_,{zoom:a},e),layoutTextSizeMinZoom:s,layoutTextSizeMaxZoom:a},u=this.updateSymbolInstanceTextVertices(t,i,I,_,x,l);x+=u.vertexOffsetDelta,v=v||u.hasChanges}if(l){const s={canonical:e,layer:c,featureState:o,availableImages:r,globalProperties:n,iconScaleFactor:d,layoutIconOffset:h.get("icon-offset").evaluate(_,o,e),layoutIconSize:h.get("icon-size").evaluate(_,o,e,r),layoutIconRotate:h.get("icon-rotate").evaluate(_,o,e)},a=this.updateSymbolInstanceIconVertices(t,i,I,_,f,s);f+=a.vertexOffsetDelta,m=m||a.hasChanges}if(A){const i=t.featureIndex,s=n?n.brightness:null,a=o||{},l=I>=0?c.appearances[I]:null;this.text.uboBinder&&(this.text.uboBinder.layer=c,y=this.text.uboBinder.updateFeaturePaintForAppearance(i,_,a,e,r,s,l)||y),this.icon.uboBinder&&(this.icon.uboBinder.layer=c,y=this.icon.uboBinder.updateFeaturePaintForAppearance(i,_,a,e,r,s,l)||y)}i.activeAppearanceIndex=I}return m&&this.icon.layoutVertexBuffer&&null!==this.icon.layoutVertexArray.arrayBuffer&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray),v&&this.text.layoutVertexBuffer&&null!==this.text.layoutVertexArray.arrayBuffer&&this.text.layoutVertexArray.length===this.text.layoutVertexBuffer.length&&this.text.layoutVertexBuffer.updateData(this.text.layoutVertexArray),{hasLayoutChanges:m||v,hasUboChanges:y}}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Ty(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(e,t){const r=this.lineVertexArray.length;if(void 0!==e.segment)for(const{x:n,y:i}of t)this.lineVertexArray.emplaceBack(n,i);return{lineStartIndex:r,lineLength:this.lineVertexArray.length-r}}addSymbols(e,t,r,n,i,s,o,a,l,u,c,h,p,d,f,m,y,g){const x=e.indexArray,v=e.layoutVertexArray,b=e.globeExtVertexArray,w=g,_=e.uboBinder?e.uboBinder.getCurrentBatchIndex():void 0,I=e.segments.prepareSegment(4*w,v,x,this.canOverlap?s.sortKey:void 0,_),A=this.glyphOffsetArray.length,S=I.vertexLength,M=this.allowVerticalPlacement&&o===Sf.vertical?Math.PI/2:0,B=s.text&&s.text.sections;let P=v.length,z=-1;for(let V=0;V<t.length;V++){const{tl:n,tr:i,bl:o,br:u,texPrimary:c,texSecondary:h,pixelOffsetTL:y,pixelOffsetBR:g,minFontScaleX:w,minFontScaleY:_,glyphOffset:A,isSDF:S,sectionIndex:T}=t[V],k=I.vertexLength,E=A[1];if(Dy(v,l.x,l.y,n.x,E+n.y,c.x,c.y,r,S,y.x,y.y,w,_),Dy(v,l.x,l.y,i.x,E+i.y,c.x+c.w,c.y,r,S,g.x,y.y,w,_),Dy(v,l.x,l.y,o.x,E+o.y,c.x,c.y+c.h,r,S,y.x,g.y,w,_),Dy(v,l.x,l.y,u.x,E+u.y,c.x+c.w,c.y+c.h,r,S,g.x,g.y,w,_),a){const{x:t,y:r,z:n}=a.anchor,[i,s,o]=a.up;Fy(b,t,r,n,i,s,o),Fy(b,t,r,n,i,s,o),Fy(b,t,r,n,i,s,o),Fy(b,t,r,n,i,s,o),Ry(e.dynamicLayoutVertexArray,t,r,n,M)}else Ry(e.dynamicLayoutVertexArray,l.x,l.y,l.z,M);if(m){const t=h||c;Cy(e.iconTransitioningVertexArray,t.x,t.y),Cy(e.iconTransitioningVertexArray,t.x+t.w,t.y),Cy(e.iconTransitioningVertexArray,t.x,t.y+t.h),Cy(e.iconTransitioningVertexArray,t.x+t.w,t.y+t.h)}if(x.emplaceBack(k,k+1,k+2),x.emplaceBack(k+1,k+2,k+3),I.vertexLength+=4,I.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(A[0]),(V===t.length-1||T!==t[V+1].sectionIndex)&&(e.uboBinder||e.programConfigurations.populatePaintArrays(v.length,s,s.index,{},p,d,f,B&&B[T],this.worldview),e.uboBinder&&e.featureIdArray)){const t=e.uboBinder.populateUBO(s,s.index,d,p,f,B&&B[T],void 0);z=t;const r=v.length-P;for(let n=0;n<r;n++)e.featureIdArray.emplaceBack(t);P=v.length}}const T=g-t.length;if(0!==T&&(this._addNullVertices(T,v,r,a,b,e,m,I,x),e.uboBinder&&e.featureIdArray&&z>=0)){const t=4*T;for(let r=0;r<t;r++)e.featureIdArray.emplaceBack(z)}const k=a?a.anchor:l;e.placedSymbolArray.emplaceBack(k.x,k.y,k.z,l.x,l.y,A,this.glyphOffsetArray.length-A,S,u,c,l.segment,r?r[0]:0,r?r[1]:0,n[0],n[1],o,0,0,0,h,0),e.symbolInstanceIndices.push(y)}_addNullVertices(e,t,r,n,i,s,o,a,l){for(let u=0;u<e;u++){for(let a=0;a<4;a++)Dy(t,0,0,0,0,0,0,r,!1,0,0,0,0),n?(Fy(i,0,0,0,0,0,0),Ry(s.dynamicLayoutVertexArray,0,0,0,0)):Ry(s.dynamicLayoutVertexArray,0,0,0,0),o&&Cy(s.iconTransitioningVertexArray,0,0);const e=a.vertexLength;l.emplaceBack(e,e+1,e+2),l.emplaceBack(e+1,e+2,e+3),a.vertexLength+=4,a.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(0)}}_commitLayoutVertex(e,t,r,n,i,s,o){e.emplaceBack(t,r,n,i,s,Math.round(o.x),Math.round(o.y))}_addCollisionDebugVertices(e,t,r,n,i,s,o){const a=r.segments.prepareSegment(4,r.layoutVertexArray,r.indexArray),l=a.vertexLength,u=o.tileAnchorX,c=o.tileAnchorY;for(let p=0;p<4;p++)r.collisionVertexArray.emplaceBack(0,0,0,0,0,0);this._commitDebugCollisionVertexUpdate(r.collisionVertexArrayExt,t,e.padding,o.zOffset),this._commitLayoutVertex(r.layoutVertexArray,n,i,s,u,c,new oe(e.x1,e.y1)),this._commitLayoutVertex(r.layoutVertexArray,n,i,s,u,c,new oe(e.x2,e.y1)),this._commitLayoutVertex(r.layoutVertexArray,n,i,s,u,c,new oe(e.x2,e.y2)),this._commitLayoutVertex(r.layoutVertexArray,n,i,s,u,c,new oe(e.x1,e.y2)),a.vertexLength+=4;const h=r.indexArray;h.emplaceBack(l,l+1),h.emplaceBack(l+1,l+2),h.emplaceBack(l+2,l+3),h.emplaceBack(l+3,l),a.primitiveLength+=4}_addTextDebugCollisionBoxes(e,t,r,n,i,s){for(let o=n;o<i;o++){const n=r.get(o),i=this.getSymbolInstanceTextSize(e,s,t,o);this._addCollisionDebugVertices(n,i,this.textCollisionBox,n.projectedAnchorX,n.projectedAnchorY,n.projectedAnchorZ,s)}}_addIconDebugCollisionBoxes(e,t,r,n,i,s){for(let o=n;o<i;o++){const n=r.get(o),i=this.getSymbolInstanceIconSize(e,t,s.placedIconSymbolIndex);this._addCollisionDebugVertices(n,i,this.iconCollisionBox,n.projectedAnchorX,n.projectedAnchorY,n.projectedAnchorZ,s)}}generateCollisionDebugBuffers(e,t,r){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new jy(xa,Qd.members,ya),this.iconCollisionBox=new jy(xa,Qd.members,ya);const n=Hf(this.iconSizeData,e),i=Hf(this.textSizeData,e,r);for(let s=0;s<this.symbolInstances.length;s++){const r=this.symbolInstances.get(s);this._addTextDebugCollisionBoxes(i,e,t,r.textBoxStartIndex,r.textBoxEndIndex,r),this._addTextDebugCollisionBoxes(i,e,t,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r),this._addIconDebugCollisionBoxes(n,e,t,r.iconBoxStartIndex,r.iconBoxEndIndex,r),this._addIconDebugCollisionBoxes(n,e,t,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r)}}getSymbolInstanceTextSize(e,t,r,n){const i=this.text.placedSymbolArray.get(t.rightJustifiedTextSymbolIndex>=0?t.rightJustifiedTextSymbolIndex:t.centerJustifiedTextSymbolIndex>=0?t.centerJustifiedTextSymbolIndex:t.leftJustifiedTextSymbolIndex>=0?t.leftJustifiedTextSymbolIndex:t.verticalPlacedTextSymbolIndex>=0?t.verticalPlacedTextSymbolIndex:n),s=qf(this.textSizeData,e,i)/sf;return this.tilePixelRatio*s}getSymbolInstanceIconSize(e,t,r){const n=this.icon.placedSymbolArray.get(r),i=qf(this.iconSizeData,e,n);return this.tilePixelRatio*i}_commitDebugCollisionVertexUpdate(e,t,r,n){e.emplaceBack(t,-r,-r,n),e.emplaceBack(t,r,-r,n),e.emplaceBack(t,r,r,n),e.emplaceBack(t,-r,r,n)}_updateTextDebugCollisionBoxes(e,t,r,n,i,s,o){for(let a=n;a<i;a++){const n=r.get(a),i=this.getSymbolInstanceTextSize(e,s,t,a);this._commitDebugCollisionVertexUpdate(this.textCollisionBox.collisionVertexArrayExt,i,n.padding,s.zOffset)}}_updateIconDebugCollisionBoxes(e,t,r,n,i,s,o){for(let a=n;a<i;a++){const n=r.get(a),i=this.getSymbolInstanceIconSize(e,t,s.placedIconSymbolIndex);this._commitDebugCollisionVertexUpdate(this.iconCollisionBox.collisionVertexArrayExt,i,n.padding,s.zOffset)}}updateCollisionDebugBuffers(e,t,r,n){if(!this.hasDebugData())return;this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexArrayExt.clear(),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexArrayExt.clear();const i=Hf(this.iconSizeData,e,n),s=Hf(this.textSizeData,e,r);for(let o=0;o<this.symbolInstances.length;o++){const a=this.symbolInstances.get(o);this._updateTextDebugCollisionBoxes(s,e,t,a.textBoxStartIndex,a.textBoxEndIndex,a,r),this._updateTextDebugCollisionBoxes(s,e,t,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a,r),this._updateIconDebugCollisionBoxes(i,e,t,a.iconBoxStartIndex,a.iconBoxEndIndex,a,n),this._updateIconDebugCollisionBoxes(i,e,t,a.verticalIconBoxStartIndex,a.verticalIconBoxEndIndex,a,n)}this.hasTextCollisionBoxData()&&this.textCollisionBox.collisionVertexBufferExt&&this.textCollisionBox.collisionVertexBufferExt.updateData(this.textCollisionBox.collisionVertexArrayExt),this.hasIconCollisionBoxData()&&this.iconCollisionBox.collisionVertexBufferExt&&this.iconCollisionBox.collisionVertexBufferExt.updateData(this.iconCollisionBox.collisionVertexArrayExt)}_deserializeCollisionBoxesForSymbol(e,t,r,n,i,s,o,a,l){const u={};if(t<r){const{x1:r,y1:n,x2:i,y2:s,padding:o,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p,featureIndex:d}=e.get(t);u.textBox={x1:r,y1:n,x2:i,y2:s,padding:o,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p},u.textFeatureIndex=d}if(n<i){const{x1:t,y1:r,x2:i,y2:s,padding:o,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p,featureIndex:d}=e.get(n);u.verticalTextBox={x1:t,y1:r,x2:i,y2:s,padding:o,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p},u.verticalTextFeatureIndex=d}if(s<o){const{x1:t,y1:r,x2:n,y2:i,padding:o,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p,featureIndex:d}=e.get(s);u.iconBox={x1:t,y1:r,x2:n,y2:i,padding:o,projectedAnchorX:a,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p},u.iconFeatureIndex=d}if(a<l){const{x1:t,y1:r,x2:n,y2:i,padding:s,projectedAnchorX:o,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p,featureIndex:d}=e.get(a);u.verticalIconBox={x1:t,y1:r,x2:n,y2:i,padding:s,projectedAnchorX:o,projectedAnchorY:l,projectedAnchorZ:c,tileAnchorX:h,tileAnchorY:p},u.verticalIconFeatureIndex=d}return u}deserializeCollisionBoxes(e){this.collisionArrays=[];for(let t=0;t<this.symbolInstances.length;t++){const r=this.symbolInstances.get(t);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(e,r.textBoxStartIndex,r.textBoxEndIndex,r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r.iconBoxStartIndex,r.iconBoxEndIndex,r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}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}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(e,t){const r=e.placedSymbolArray.get(t),n=r.vertexStartIndex+4*r.numGlyphs;for(let i=r.vertexStartIndex;i<n;i+=4)e.indexArray.emplaceBack(i,i+1,i+2),e.indexArray.emplaceBack(i+1,i+2,i+3)}getSortedSymbolIndexes(e){if(this.sortedAngle===e&&void 0!==this.symbolInstanceIndexes)return this.symbolInstanceIndexes;const t=Math.sin(e),r=Math.cos(e),n=[],i=[],s=[];for(let o=0;o<this.symbolInstances.length;++o){s.push(o);const e=this.symbolInstances.get(o);n.push(0|Math.round(t*e.tileAnchorX+r*e.tileAnchorY)),i.push(e.featureIndex)}return s.sort((e,t)=>n[e]-n[t]||i[t]-i[e]),s}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let e=0;e<this.symbolInstances.length;++e)this.symbolInstanceIndexesSortedZOffset.push(e)}return this.zOffsetSortDirty=!1,this.symbolInstanceIndexesSortedZOffset.sort((e,t)=>this.symbolInstances.get(t).zOffset-this.symbolInstances.get(e).zOffset)}addToSortKeyRanges(e,t){const r=this.sortKeyRanges.at(-1);r&&r.sortKey===t?r.symbolInstanceEnd=e+1:this.sortKeyRanges.push({sortKey:t,symbolInstanceStart:e,symbolInstanceEnd:e+1})}sortFeatures(e){if(this.sortFeaturesByY&&this.sortedAngle!==e)if(this.text.segments.get().length>1||this.icon.segments.get().length>1)this.sortFeaturesWithinSegments();else{this.symbolInstanceIndexes=this.getSortedSymbolIndexes(e),this.sortedAngle=e,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const e of this.symbolInstanceIndexes){const t=this.symbolInstances.get(e);this.featureSortOrder.push(t.featureIndex);const{rightJustifiedTextSymbolIndex:r,centerJustifiedTextSymbolIndex:n,leftJustifiedTextSymbolIndex:i,verticalPlacedTextSymbolIndex:s,placedIconSymbolIndex:o,verticalPlacedIconSymbolIndex:a}=t;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),o>=0&&this.addIndicesForPlacedSymbol(this.icon,o),a>=0&&this.addIndicesForPlacedSymbol(this.icon,a)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getOrCreateSortedSymbolsByBatch(e,t){const r=(this.text.uboBinder&&this.text.uboBinder.maxFeaturesPerBatch>0?this.text.uboBinder:this.icon.uboBinder&&this.icon.uboBinder.maxFeaturesPerBatch>0?this.icon.uboBinder:null).maxFeaturesPerBatch;if(this.symbolsByBatch)for(const n of this.symbolsByBatch.values())for(const r of n){const n=this.symbolInstances.get(r.index);r.rotatedY=0|Math.round(e*n.tileAnchorX+t*n.tileAnchorY)}else{this.symbolsByBatch=/* @__PURE__ */new Map;for(let n=0;n<this.symbolInstances.length;n++){const i=this.symbolInstances.get(n),s=Math.floor(n/r),o=0|Math.round(e*i.tileAnchorX+t*i.tileAnchorY);this.symbolsByBatch.has(s)||this.symbolsByBatch.set(s,[]),this.symbolsByBatch.get(s).push({index:n,rotatedY:o,featureIndex:i.featureIndex})}}for(const n of this.symbolsByBatch.values())n.sort((e,t)=>e.rotatedY-t.rotatedY||t.featureIndex-e.featureIndex);return this.symbolsByBatch}rebuildTextSegmentIndices(e,t){for(const r of e){const e=r.batchIndex;if(void 0===e)continue;const n=t.get(e);if(!n){r.primitiveOffset=this.text.indexArray.length,r.primitiveLength=0;continue}r.primitiveOffset=this.text.indexArray.length;const i=this.text.indexArray.length;for(const{index:t}of n){const e=this.symbolInstances.get(t),{rightJustifiedTextSymbolIndex:r,centerJustifiedTextSymbolIndex:n,leftJustifiedTextSymbolIndex:i,verticalPlacedTextSymbolIndex:s}=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)}r.primitiveLength=this.text.indexArray.length-i}}rebuildIconSegmentIndices(e,t){for(const r of e){const e=r.batchIndex;if(void 0===e)continue;const n=t.get(e);if(!n){r.primitiveOffset=this.icon.indexArray.length,r.primitiveLength=0;continue}r.primitiveOffset=this.icon.indexArray.length;const i=this.icon.indexArray.length;for(const{index:t}of n){const e=this.symbolInstances.get(t),{placedIconSymbolIndex:r,verticalPlacedIconSymbolIndex:n}=e;r>=0&&this.addIndicesForPlacedSymbol(this.icon,r),n>=0&&this.addIndicesForPlacedSymbol(this.icon,n)}r.primitiveLength=this.icon.indexArray.length-i}}sortFeaturesWithinSegments(){this.featureSortOrder=[];const e=Math.sin(this.sortedAngle),t=Math.cos(this.sortedAngle),r=this.getOrCreateSortedSymbolsByBatch(e,t),n=Array.from(r.keys()).sort((e,t)=>e-t);for(const i of n){const e=r.get(i);for(const{index:t}of e){const e=this.symbolInstances.get(t);this.featureSortOrder.push(e.featureIndex)}}this.text.indexArray.clear(),this.icon.indexArray.clear(),this.rebuildTextSegmentIndices(this.text.segments.get(),r),this.rebuildIconSegmentIndices(this.icon.segments.get(),r),this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}getElevationFeatureForText(e){const t=this.symbolInstances.get(this.text.symbolInstanceIndices[e]).elevationFeatureIndex;let r;return this.elevationFeatures&&t<this.elevationFeatures.length&&(r=this.elevationFeatures[t]),r}}function Gy(e,t){return t.replace(/{([^{}]+)}/g,(t,r)=>r in e?String(e[r]):"")}let Xy,qy,Hy;ps($y,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),$y.addDynamicAttributes=Ry;class Zy{constructor(e){this.type=e.property.overrides?e.property.overrides.runtimeType:Ct,this.defaultValue=e}evaluate(e){if(e.formattedSection){const t=this.defaultValue.property.overrides;if(t&&t.hasOverride(e.formattedSection))return t.getOverride(e.formattedSection)}return e.feature&&e.featureState?this.defaultValue.evaluate(e.feature,e.featureState):this.defaultValue.property.specification.default}eachChild(e){this.defaultValue.isConstant()||e(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}ps(Zy,"FormatSectionOverride",{omit:["defaultValue"]});const Yy=()=>Hy||(Hy={layout:Xy||(Xy=new wo({"symbol-placement":new xo(_o.layout_symbol["symbol-placement"]),"symbol-spacing":new xo(_o.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new xo(_o.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new vo(_o.layout_symbol["symbol-sort-key"]),"symbol-z-order":new xo(_o.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new xo(_o.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new xo(_o.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new xo(_o.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new xo(_o.layout_symbol["icon-ignore-placement"]),"icon-optional":new xo(_o.layout_symbol["icon-optional"]),"icon-rotation-alignment":new xo(_o.layout_symbol["icon-rotation-alignment"]),"icon-size":new vo(_o.layout_symbol["icon-size"]),"icon-size-scale-range":new xo(_o.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new vo(_o.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new vo(_o.layout_symbol["icon-text-fit-padding"]),"icon-image":new vo(_o.layout_symbol["icon-image"]),"icon-image-use-theme":new xo({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new vo(_o.layout_symbol["icon-rotate"]),"icon-padding":new xo(_o.layout_symbol["icon-padding"]),"icon-keep-upright":new xo(_o.layout_symbol["icon-keep-upright"]),"icon-offset":new vo(_o.layout_symbol["icon-offset"]),"icon-anchor":new vo(_o.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new xo(_o.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new xo(_o.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new xo(_o.layout_symbol["text-rotation-alignment"]),"text-field":new vo(_o.layout_symbol["text-field"]),"text-font":new vo(_o.layout_symbol["text-font"]),"text-size":new vo(_o.layout_symbol["text-size"]),"text-size-scale-range":new xo(_o.layout_symbol["text-size-scale-range"]),"text-max-width":new vo(_o.layout_symbol["text-max-width"]),"text-line-height":new vo(_o.layout_symbol["text-line-height"]),"text-letter-spacing":new vo(_o.layout_symbol["text-letter-spacing"]),"text-justify":new vo(_o.layout_symbol["text-justify"]),"text-radial-offset":new vo(_o.layout_symbol["text-radial-offset"]),"text-variable-anchor":new xo(_o.layout_symbol["text-variable-anchor"]),"text-anchor":new vo(_o.layout_symbol["text-anchor"]),"text-max-angle":new xo(_o.layout_symbol["text-max-angle"]),"text-writing-mode":new xo(_o.layout_symbol["text-writing-mode"]),"text-rotate":new vo(_o.layout_symbol["text-rotate"]),"text-padding":new xo(_o.layout_symbol["text-padding"]),"text-keep-upright":new xo(_o.layout_symbol["text-keep-upright"]),"text-transform":new vo(_o.layout_symbol["text-transform"]),"text-offset":new vo(_o.layout_symbol["text-offset"]),"text-allow-overlap":new xo(_o.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new xo(_o.layout_symbol["text-ignore-placement"]),"text-optional":new xo(_o.layout_symbol["text-optional"]),visibility:new xo(_o.layout_symbol.visibility)})),paint:qy||(qy=new wo({"icon-opacity":new vo(_o.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new vo(_o.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new vo(_o.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new vo(_o.paint_symbol["text-emissive-strength"]),"icon-color":new vo(_o.paint_symbol["icon-color"]),"icon-halo-color":new vo(_o.paint_symbol["icon-halo-color"]),"icon-halo-width":new vo(_o.paint_symbol["icon-halo-width"]),"icon-halo-blur":new vo(_o.paint_symbol["icon-halo-blur"]),"icon-translate":new xo(_o.paint_symbol["icon-translate"]),"icon-translate-anchor":new xo(_o.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new xo(_o.paint_symbol["icon-image-cross-fade"]),"text-opacity":new vo(_o.paint_symbol["text-opacity"]),"text-occlusion-opacity":new vo(_o.paint_symbol["text-occlusion-opacity"]),"text-color":new vo(_o.paint_symbol["text-color"],{runtimeType:Ot,getOverride:e=>e.textColor,hasOverride:e=>!!e.textColor}),"text-halo-color":new vo(_o.paint_symbol["text-halo-color"]),"text-halo-width":new vo(_o.paint_symbol["text-halo-width"]),"text-halo-blur":new vo(_o.paint_symbol["text-halo-blur"]),"text-translate":new xo(_o.paint_symbol["text-translate"]),"text-translate-anchor":new xo(_o.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new xo(_o.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new xo(_o.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new xo(_o.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new xo(_o.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new vo(_o.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"})}))},Hy);class Wy extends qo{constructor(e,t,r,n){super(e,Yy(),t,r,n,e.layout?e.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=s([]),this.hasOcclusionOpacityProperties=void 0!==e.paint&&("icon-occlusion-opacity"in e.paint||"text-occlusion-opacity"in e.paint)}_handleSpecialPaintPropertyUpdate(e){"icon-occlusion-opacity"!==e&&"text-occlusion-opacity"!==e||(this.hasOcclusionOpacityProperties=!0)}recalculate(e,t){super.recalculate(e,t),this.appearances&&this.appearances.forEach(r=>{r.recalculate(e,t,this.iconImageUseTheme)}),"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 e=[];for(const t of r)e.includes(t)||e.push(t);this.layout._values["text-writing-mode"]=e}else this.layout._values["text-writing-mode"]="point"===this.layout.get("symbol-placement")?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(e,t,r,n){return this._saturation===e&&this._contrast===t&&this._brightnessMin===r&&this._brightnessMax===n||(this._colorAdjustmentMatrix=function(e,t,r,n){e=function(e){return e>0?1-1/(1.001-e):-e}(e),t=function(e){return e>0?1/(1.001-e):1+e}(t);const s=i(),o=e/3,l=1-2*o,u=[l,o,o,0,o,l,o,0,o,o,l,0,0,0,0,1],c=.5-.5*t,h=n-r;return a(s,[h,0,0,0,0,h,0,0,0,0,h,0,r,r,r,1],[t,0,0,0,0,t,0,0,0,0,t,0,c,c,c,1]),a(s,s,u),s}(e,t,r,n),this._saturation=e,this._contrast=t,this._brightnessMin=r,this._brightnessMax=n),this._colorAdjustmentMatrix}getValueAndResolveTokens(e,t,r,n){const i=this.layout.get(e).evaluate(t,{},r,n),s=this._unevaluatedLayout._values[e];return s.isDataDriven()||es(s.value)||!i?i:Gy(t.properties,i)}getAppearanceValueAndResolveTokens(e,t,r,n,i){const s=e.getLayoutProperty(t);if(!s)return;const o=s.evaluate(r,{},n,i),a=e.getUnevaluatedLayoutProperties()._values[t];return a.isDataDriven()||es(a.value)||!o||"string"!=typeof o?o:Gy(r.properties,o)}createBucket(e){return new $y(e)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const e of Yy().paint.overridableProperties){if(!Wy.hasPaintOverride(this.layout,e))continue;const t=this.paint.get(e),r=new Zy(t),n=new Qi(r,t.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let i=null;i="constant"===t.value.kind||"source"===t.value.kind?new rs("source",n):new ns("composite",n,t.value.zoomStops,t.value.interpolationType),this.paint._values[e]=new yo(t.property,i,t.parameters)}}_handleOverridablePaintPropertyUpdate(e,t,r){return!(!this.layout||t.isDataDriven()||r.isDataDriven())&&Wy.hasPaintOverride(this.layout,e)}static hasPaintOverride(e,t){const r=e.get("text-field"),n=Yy().paint.properties[t];let i=!1;const s=e=>{for(const t of e)if(n.overrides&&n.overrides.hasOverride(t))return void(i=!0)};if("constant"===r.value.kind&&r.value.value instanceof er)s(r.value.value.sections);else if("source"===r.value.kind){const e=t=>{i||(t instanceof ar&&sr(t.value)===$t?s(t.value.sections):t instanceof hr?s(t.sections):t.eachChild(e))},t=r.value;t._styleExpression&&e(t._styleExpression.expression)}return i}getProgramIds(){return["symbol"]}getDefaultProgramParams(e,t,r){return{config:new xl(this,{zoom:t,lut:r}),overrideFog:!1}}hasElevation(){return this.layout&&"hd-road-markup"===this.layout.get("symbol-elevation-reference")}}let Jy,Ky,Qy,eg;const tg=Jo([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Uint16",components:2}]);function rg(e,t,i,s,o,a,l,u){const c=[e,t,1,i,s,1,o,a,1],h=[l,u,1],p=r([],c),[d,f,m]=V(h,h,p);return n(c,c,[d,0,0,0,f,0,0,0,m])}function ng(e,t,i,s,o,a,l,u){const c=function(e,t,i,s,o,a,l,u){const c=rg(0,0,1,0,1,1,0,1),h=rg(e,t,i,s,o,a,l,u);return n(h,h,r([],c))}(e,t,i,s,o,a,l,u);return[c[2]/c[8]/tn,c[5]/c[8]/tn]}function ig(e){return[e[0],Math.min(Math.max(e[1],-85.051129),Ul)]}class sg extends _t{constructor(e,t,r,n){super(),this.id=e,this.dispatcher=r,this.coordinates=t.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(n),this.options=t,this._dirty=!1}load(e,t){if(this._loaded=t||!1,this.fire(new xt("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return e&&(this.coordinates=e),this._loaded=!0,void this._finishLoading();this._imageRequest=ut(this.map._requestManager.transformRequest(this.url,et.Image),(t,r)=>{this._imageRequest=null,this._loaded=!0,t?this.fire(new vt(t)):r&&(this.image=r,this._dirty=!0,this.width=this.image.width,this.height=this.image.height,e&&(this.coordinates=e),this._finishLoading())})}loaded(){return this._loaded}updateImage(e){return e.url?(this._imageRequest&&e.url!==this.options.url&&(this._imageRequest.cancel(),this._imageRequest=null),this.options.url=e.url,this.load(e.coordinates,this._loaded),this):this}setTexture(e){if(!(e.handle instanceof WebGLTexture))throw new Error("The provided handle is not a WebGLTexture instance");return this.texture=new hm(this.map.painter.context,e.handle),this.width=e.dimensions[0],this.height=e.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new xt("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(e){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof hm||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(e){if(this.coordinates=e,this._boundsArray=void 0,this._unsupportedCoords=!1,!e.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let t=e[0][1],r=e[0][1];for(const i of e)i[1]>r&&(r=i[1]),i[1]<t&&(t=i[1]);const n=(r+t)/2;if(n>Ul?this.onNorthPole=!0:n<-85.051129&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const t=e.map(Gl.fromLngLat);this.tileID=function(e){let t=1/0,r=1/0,n=-1/0,i=-1/0;for(const u of e)t=Math.min(t,u.x),r=Math.min(r,u.y),n=Math.max(n,u.x),i=Math.max(i,u.y);const s=Math.max(n-t,i-r),o=Math.max(0,Math.floor(-Math.log2(s))),a=Math.pow(2,o);let l=Math.floor((t+n)/2*a);return l>1&&(l-=1),new Yu(o,l,Math.floor((r+i)/2*a))}(t),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new xt("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof hm||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(e){for(const r in this.tiles){const e=this.tiles[r];"loaded"!==e.state&&(e.state="loaded",e.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const t=uy(new Yu(0,0,0),this.map.transform.projection),i=[t.projection.project(this.coordinates[0][0],this.coordinates[0][1]),t.projection.project(this.coordinates[1][0],this.coordinates[1][1]),t.projection.project(this.coordinates[2][0],this.coordinates[2][1]),t.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(e){const t=e[1].x-e[0].x,r=e[1].y-e[0].y,n=e[2].x-e[1].x,i=e[2].y-e[1].y,s=e[3].x-e[2].x,o=e[3].y-e[2].y,a=e[0].x-e[3].x,l=e[0].y-e[3].y,u=t*i-n*r,c=n*o-s*i,h=s*l-a*o,p=a*r-t*l;return u>0&&c>0&&h>0&&p>0||u<0&&c<0&&h<0&&p<0}(i))return void(this._unsupportedCoords=!0);const s=uy(this.tileID,this.map.transform.projection),[o,a,l,u]=this.coordinates.map(e=>{const t=s.projection.project(e[0],e[1]);return function(e,{x:t,y:r},n=0){return new oe(((t-n)*e.scale-e.x)*tn,(r*e.scale-e.y)*tn)}(s,t)._round()});this.perspectiveTransform=ng(o.x,o.y,a.x,a.y,l.x,l.y,u.x,u.y);const c=this._boundsArray=new ta;c.emplaceBack(o.x,o.y,0,0),c.emplaceBack(a.x,a.y,tn,0),c.emplaceBack(u.x,u.y,0,tn),c.emplaceBack(l.x,l.y,tn,tn),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=e.createVertexBuffer(c,tg.members),this.boundsSegments=Ka.simpleSegment(0,0,4,2);const h=[],p=[ig((g=this.coordinates)[0]),ig(g[1]),ig(g[2]),ig(g[3])],[d,f,m,y]=function(e){let t=e[0][0],r=t,n=e[0][1],i=n;for(let s=1;s<e.length;s++)e[s][0]<t?t=e[s][0]:e[s][0]>r&&(r=e[s][0]),e[s][1]<n?n=e[s][1]:e[s][1]>i&&(i=e[s][1]);return[t,n,r-t,i-n]}(p);var g;{const s=new ta,[o,a,l,u]=function(e){let t=e[0].x,r=t,n=e[0].y,i=n;for(let s=1;s<e.length;s++)e[s].x<t?t=e[s].x:e[s].x>r&&(r=e[s].x),e[s].y<n?n=e[s].y:e[s].y>i&&(i=e[s].y);return[t,n,r-t,i-n]}(i),c=e=>[(e.x-o)/l,(e.y-a)/u],[p,g,x,v]=i.map(c),b=function(e,t,i,s,o,a,l,u){const c=rg(0,0,1,0,1,1,0,1);return n(c,c,r([],rg(e,t,i,s,o,a,l,u)))}(p[0],p[1],g[0],g[1],x[0],x[1],v[0],v[1]);this.elevatedGlobePerspectiveTransform=ng(p[0],p[1],g[0],g[1],x[0],x[1],v[0],v[1]);const w=(e,t)=>{h.push(e.lng);const r=Math.round((e.lng-d)/m*tn),n=Math.round((e.lat-f)/y*tn),i=c(t),o=V([],[i[0],i[1],1],b),a=Math.round(o[0]/o[2]*tn),l=Math.round(o[1]/o[2]*tn);s.emplaceBack(r,n,a,l)},_=i[3].x-i[0].x,I=i[3].y-i[0].y,A=i[2].x-i[1].x,S=i[2].y-i[1].y;for(let e=0;e<65;e++){const r=e/64,n=[i[0].x+r*_,i[0].y+r*I],s=[i[1].x+r*A,i[1].y+r*S],o=s[0]-n[0],a=s[1]-n[1];for(let e=0;e<65;e++){const r=e/64,i={x:n[0]+o*r,y:n[1]+a*r};w(t.projection.unproject(i.x,i.y),i)}}this.elevatedGlobeVertexBuffer=e.createVertexBuffer(s,tg.members)}{this.maxLongitudeTriangleSize=0;let t=[],r=new wa;const n=(e,n,i)=>{r.emplaceBack(e,n,i);const s=h[e],o=h[n],a=h[i],l=Math.min(Math.min(s,o),a),u=Math.max(Math.max(s,o),a)-l;u>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=u),t.push(l+u/2)};for(let e=0;e<64;e++)for(let t=0;t<64;t++){const r=65*e+t,i=r+1,s=r+65,o=s+1;n(r,s,i),n(i,s,o)}[t,r]=function(e,t){const r=Array.from({length:e.length},(e,t)=>t);r.sort((t,r)=>e[t]-e[r]);const n=[],i=new wa;for(let s=0;s<r.length;s++){const o=r[s];n.push(e[o]);const a=3*o,l=a+1;i.emplaceBack(t.uint16[a],t.uint16[l],t.uint16[l+1])}return[n,i]}(t,r),this.elevatedGlobeTrianglesCenterLongitudes=t,this.elevatedGlobeIndexBuffer=e.createIndexBuffer(r)}this.elevatedGlobeSegments=Ka.simpleSegment(0,0,4225,8192),this.elevatedGlobeGridMatrix=new Float32Array([0,m/tn,0,y/tn,0,0,f,d,0])}prepare(){const e=0!==Object.keys(this.tiles).length;if(this.tileID&&!e)return;const t=this.map.painter.context,r=t.gl;!this._dirty||this.texture instanceof hm||(this.texture?this.texture.update(this.image):(this.texture=new cm(t,this.image,r.RGBA8),this.texture.bind(r.LINEAR,r.CLAMP_TO_EDGE)),this._dirty=!1),e&&this._prepareData(t)}loadTile(e,t){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={},t(null)):(e.state="errored",t(null))}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}getSegmentsForLongitude(e){const t=this.elevatedGlobeSegments;if(!this.elevatedGlobeTrianglesCenterLongitudes||!t)return null;const r=this.elevatedGlobeTrianglesCenterLongitudes;let n=(i=e+180)+360*Math.round((r[0]-i)/360);var i;const s=new Ka,o=(e,r)=>{s.segments.push({vertexOffset:0,primitiveOffset:e,vertexLength:t.segments[0].vertexLength,primitiveLength:r,sortKey:void 0,vaos:{}})},a=.51*this.maxLongitudeTriangleSize;if(Math.abs(r[0]-n)<=a){const e=ze(r,0,r.length,n+a);return e===r.length||o(e,Pe(r,e+1,r.length,n+360-a)-e),s}n<r[0]&&(n+=360);const l=Pe(r,0,r.length,n-a);if(l===r.length)return o(0,r.length),s;o(0,l-0);const u=ze(r,l+1,r.length,n+a);return u!==r.length&&o(u,r.length-u),s}}let og,ag,lg,ug,cg;class hg extends qo{constructor(e,t){super(e,{},t,null),this.implementation=e,e.slot&&(this.slot=e.slot)}is3D(e){return"3d"===this.implementation.renderingMode}hasOffscreenPass(){return void 0!==this.implementation.prerender}isDraped(e){return void 0!==this.implementation.renderToTile}shouldRedrape(){return!!this.implementation.shouldRerenderTiles&&this.implementation.shouldRerenderTiles()}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){}onAdd(e){this.implementation.onAdd&&this.implementation.onAdd(e,e.painter.context.gl)}onRemove(e){this.implementation.onRemove&&this.implementation.onRemove(e,e.painter.context.gl)}}function pg(e,t,r){const n=[0,0,1],i=U([]);return function(e,t,r){r*=.5;var n=t[0],i=t[1],s=t[2],o=t[3],a=Math.sin(r),l=Math.cos(r);e[0]=n*l-s*a,e[1]=i*l+o*a,e[2]=s*l+n*a,e[3]=o*l-i*a}(i,i,r?-ce(e)+Math.PI:ce(e)),function(e,t,r){r*=.5;var n=t[0],i=t[1],s=t[2],o=t[3],a=Math.sin(r),l=Math.cos(r);e[0]=n*l+o*a,e[1]=i*l+s*a,e[2]=s*l-i*a,e[3]=o*l-n*a}(i,i,-ce(t)),E(n,n,i),B(n,n)}const dg=new Float64Array([1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1]);function fg(e,t,r){s(e),p(e,e,ce(t[2])),c(e,e,ce(t[0])),h(e,e,ce(t[1])),u(e,e,r),a(e,e,dg)}function mg(e,t,r,n,i,s,o,a){const l=[r[0]-t[0],r[1]-t[1],0],u=[n[0]-t[0],n[1]-t[1],0];if(m(l)<1e-12||m(u)<1e-12)return U(e);const c=z([],l,u);B(c,c),v(u,n,t),l[2]=(s-i)*a,u[2]=(o-i)*a;const h=l;return z(h,l,u),B(h,h),H(e,c,h)}function yg(e,t,r=!1){const n=uc(t.zoom),i=function(e,t,r){const n=t.worldSize,i=[e[12],e[13],e[14]],o=Ol(i[1]/n),c=Rl(i[0]/n),h=s([]),p=Ll(1,o)*n,d=Ll(1,0)*n*jl(o,t.zoom),f=1/lc(n);let m=d*f;if(r){const e=function(e,t,r,n,i=1/0){const s=e.range;if(!s)return 0;const o=Math.min(i,Math.max(r,n)),a=Math.log2(o/1024);return de(s[0]+a,s[1]+a,t)}(t.projection,t.zoom,t.width,t.height,1024);m=f*t.projection.pixelSpaceConversion(t.center.lat,n,e)}const y=zl(o,c);x(y,y,_([],B([],y),p*m*i[2]));const g=function(e){const t=[e[0],e[1],e[2]];let r=[0,1,0];const n=z([],r,t);return z(r,t,n),0===function(e){var t=e[0],r=e[1],n=e[2];return t*t+r*r+n*n}(r)&&(r=[0,1,0],z(n,t,r)),B(n,n),B(r,r),B(t,t),[n[0],n[1],n[2],0,r[0],r[1],r[2],0,t[0],t[1],t[2],0,e[0],e[1],e[2],1]}(y);u(h,h,[m,m,m*p]),l(h,h,[-i[0],-i[1],-i[2]]);const v=a([],t.globeMatrix,g);return a(v,v,h),a(v,v,e),v}(e,t,r);if(n>0){return function(e,t,r){const n=(e,t,r)=>{const n=m(e),i=m(t),s=nc(e,t,r);return _(s,s,1/m(s)*Bt(n,i,r))},i=n([e[0],e[1],e[2]],[t[0],t[1],t[2]],r),s=n([e[4],e[5],e[6]],[t[4],t[5],t[6]],r),o=n([e[8],e[9],e[10]],[t[8],t[9],t[10]],r),a=nc([e[12],e[13],e[14]],[t[12],t[13],t[14]],r);return[i[0],i[1],i[2],0,s[0],s[1],s[2],0,o[0],o[1],o[2],0,a[0],a[1],a[2],1]}(i,function(e,t){const r=t.worldSize,n=Ll(1,0)*r*jl(t.center.lat,t.zoom)/lc(r),i=Ll(1,t.center.lat)*r,o=s([]);h(o,o,ce(t.center.lng)),c(o,o,ce(t.center.lat)),l(o,o,[0,0,Sl]),u(o,o,[n,n,n*i]);const p=t.point;return l(o,o,[-p.x,-p.y,0]),a(o,o,e),a(o,t.globeMatrix,o)}(e,t),n)}return i}function gg(e,t,r,n){const i=wu.projectAabbCorners(n,r);let s=Number.MAX_VALUE;for(let o=0;o<i.length;++o){const e=i[o];e[0]=(.5*e[0]+.5)*t.width,e[1]=(.5-.5*e[1])*t.height,e[2]<s&&(s=e[2])}if(Pu(e,function(e){const t=[];let r=0;for(let o=1;o<e.length;o++)(e[o][0]<e[r][0]||e[o][0]===e[r][0]&&e[o][1]<e[r][1])&&(r=o);let n,i=r;const s=new Uint8Array(e.length);do{if(s[i])break;t.push(new oe(e[i][0],e[i][1])),s[i]=1,n=(i+1)%e.length;for(let t=0;t<e.length;t++){if(e[t][0]===e[n][0]&&e[t][1]===e[n][1]||e[t][0]===e[i][0]&&e[t][1]===e[i][1])continue;const r=[e[t][0]-e[i][0],e[t][1]-e[i][1]],s=[e[n][0]-e[i][0],e[n][1]-e[i][1]],o=r[0]*s[1]-r[1]*s[0];(o>0||0===o&&r[0]*s[0]+r[1]*s[1]>=0&&r[0]*r[0]+r[1]*r[1]>s[0]*s[0]+s[1]*s[1])&&(n=t)}i=n}while(i!==r);return t.length>0&&t.push(t[0]),t}(i)))return s}const xg=Jo([{name:"a_pos_3f",components:3,type:"Float32"}]),vg=Jo([{name:"a_color_3f",components:3,type:"Float32"}]),bg=Jo([{name:"a_color_4f",components:4,type:"Float32"}]),wg=Jo([{name:"a_uv_2f",components:2,type:"Float32"}]),_g=Jo([{name:"a_normal_3f",components:3,type:"Float32"}]),Ig=Jo([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),Ag=Jo([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);class Sg{constructor(e,t){this.feature=e,this.instancedDataOffset=t,this.instancedDataCount=0,this.rotation=[0,0,0],this.scale=[1,1,1],this.translation=[0,0,0]}}class Mg{constructor(){this.maxScale=1,this.maxXYTranslationDistance=0,this.instancedDataArray=new Va,this.instancesEvaluatedElevation=[],this.features=[],this.idToFeaturesIndex={}}colorForInstance(e){const t=16*e,r=this.instancedDataArray.float32;let n=Math.floor(r[t+2]);const i=1.05*(r[t+2]-n);return n/=100,[r[t]%1*1.05,r[t+1]%1*1.05,i,n]}tileCoordinatesForInstance(e){const t=16*e,r=this.instancedDataArray.float32;let n=r[t+0];return n=n>tn?n-tn:n,new oe(Math.trunc(n),Math.trunc(r[t+1]))}translationForInstance(e){const t=16*e,r=this.instancedDataArray.float32;return[r[t+4],r[t+5],r[t+6]]}rotationScaleForInstance(e){const t=16*e,r=this.instancedDataArray.float32;return[r[t+7],r[t+8],r[t+9],r[t+10],r[t+11],r[t+12],r[t+13],r[t+14],r[t+15]]}transformForInstance(e){const t=16*e,r=this.instancedDataArray.float32;return[r[t+7],r[t+8],r[t+9],r[t+4],r[t+10],r[t+11],r[t+12],r[t+5],r[t+13],r[t+14],r[t+15],r[t+6],0,0,0,1]}}class Bg{constructor(e){this.zoom=e.zoom,this.canonical=e.canonical,this.overscaledZ=this.canonical.z+Math.log2(e.overscaling),this.layers=e.layers,this.layerIds=this.layers.map(e=>e.fqid),this.projection=e.projection,this.index=e.index,this.worldview=e.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z+1?0:this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=e.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(e,t){}updateAppearances(e,t,r,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}populate(e,t,r,n){this.tileToMeter=$l(r);const i=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);const s="hd-road-markup"===this.layers[0].paint.get("model-elevation-reference")?t.elevationFeatures:void 0;for(const{feature:o,id:a,index:l,sourceLayerIndex:u}of e){const e=null!=a?a:o.properties&&Object.hasOwn(o.properties,"id")?o.properties.id:void 0,c=Ql(o,i);if(!this.layers[0]._featureFilter.filter(new lo(this.zoom,{worldview:this.worldview,activeFloors:t.activeFloors}),c,r))continue;const h={id:e,sourceLayerIndex:u,index:l,geometry:i?c.geometry:Kl(o,r,n),properties:o.properties,type:o.type,patterns:{}},p=this.addFeature(h,h.geometry,c,s,r);p&&t.featureIndex.insert(o,h.geometry,l,u,this.index,this.instancesPerModel[p].instancedDataArray.length,256)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const e=this.layers[0].modelManager,t=this.layers[0].scope;let r=0;for(const n of this.modelUris){const i=e.getModel(n,t);if(!i)continue;const s=this.instancesPerModel[n];if(s){const e=.5*A(i.aabb.max,i.aabb.min)*s.maxScale+s.maxXYTranslationDistance,t=Math.min(tn,Math.max(e/this.tileToMeter,256));r=Math.max(t,r)}}return r}update(e,t,r,n){for(const i in this.instancesPerModel){const t=this.instancesPerModel[i];for(const r in e)Object.hasOwn(t.idToFeaturesIndex,r)&&(this.evaluate(t.features[t.idToFeaturesIndex[r]],e[r],t,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let e=!1;for(const t in this.instancesPerModel){const r=this.instancesPerModel[t];for(const t of r.features){const n=this.layers[0],i=t.feature,s=this.canonical,o=n.paint.get("model-rotation").evaluate(i,{},s),a=n.paint.get("model-scale").evaluate(i,{},s),l=n.paint.get("model-translation").evaluate(i,{},s);D(t.rotation,o)&&D(t.scale,a)&&D(t.translation,l)||(this.evaluate(t,t.featureStates,r,!0),e=!0)}}return e}updateReplacement(e,t,r,n){if(t.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=t.updateTime;const i=t.getReplacementRegionsForTile(e.toUnwrapped(),!0);if(gp(this.activeReplacements,i))return!1;this.activeReplacements=i;let s=!1;for(const o in this.instancesPerModel){const t=this.instancesPerModel[o],i=t.instancedDataArray;for(const o of t.features){const t=o.instancedDataOffset,a=o.instancedDataCount;for(let o=0;o<a;o++){const a=16*(o+t);let l=i.float32[a+0];const u=l>tn;l=u?l-tn:l;const c=Math.floor(l),h=Math.floor(i.float32[a+1]);let p=!1;for(const t of this.activeReplacements)if(!fp(t,r,_p,n)&&!(t.min.x>c||c>t.max.x||t.min.y>h||h>t.max.y)&&(p=bp(vp(c,h,e.canonical,t.footprintTileId.canonical),t.footprint),p))break;i.float32[a]=p?l+tn:l,s=s||p!==u}}}return s}isEmpty(){for(const e in this.instancesPerModel)if(0!==this.instancesPerModel[e].instancedDataArray.length)return!1;return!0}uploadPending(){return!this.uploaded}upload(e){if(!this.uploaded)for(const t in this.instancesPerModel){const r=this.instancesPerModel[t];r.instancedDataArray.length<0||0===r.instancedDataArray.length||(r.instancedDataBuffer?r.instancedDataBuffer.updateData(r.instancedDataArray):r.instancedDataBuffer=e.createVertexBuffer(r.instancedDataArray,Ig.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(e){for(const r in this.instancesPerModel){const e=this.instancesPerModel[r];0!==e.instancedDataArray.length&&e.instancedDataBuffer&&e.instancedDataBuffer.destroy()}const t=this.layers[0].modelManager;if(e&&t&&this.modelUris&&this.modelsRequested)for(const r of this.modelUris)t.removeModel(r,"",!0)}addFeature(e,t,r,n,i){const s=this.layers[0],o=s.layout.get("model-id"),a=s.layout.get("model-allow-density-reduction"),l=o.evaluate(r,{},this.canonical);if(!l)return be(`modelId is not evaluated for layer ${s.id} and it is not going to get rendered.`),l;(function(e,t){const r=!e.includes("://");try{return new URL(e,r&&t?"http://example.com":void 0),!0}catch(n){return!1}}(l,!1)||void 0!==this.styleDefinedModelURLs[l])&&(this.modelUris.includes(l)||this.modelUris.push(l)),this.instancesPerModel[l]||(this.instancesPerModel[l]=new Mg);const u=this.instancesPerModel[l],c=u.instancedDataArray,h=new Sg(r,c.length);let p;n&&(p=Au.getElevationFeature(e,n));for(const d of t)for(const e of d){if(e.x<0||e.x>=tn||e.y<0||e.y>=tn)continue;if(0!==this.lookupDim&&a){const t=(this.lookupDim-1)/tn,r=this.lookupDim*(e.y*t|0)+e.x*t|0;if(this.lookup){if(0!==this.lookup[r])continue;this.lookup[r]=1}}this.instanceCount++;const t=c.length;if(c.resize(t+1),n){u.instancesRoadElevation||(u.instancesRoadElevation=[]);const t=p?p.pointElevation(new oe(e.x,e.y)):0;u.instancesRoadElevation.push(t)}u.instancesEvaluatedElevation.push(0),c.float32[16*t]=e.x,c.float32[16*t+1]=e.y}return h.instancedDataCount=u.instancedDataArray.length-h.instancedDataOffset,h.instancedDataCount>0&&(e.id&&(u.idToFeaturesIndex[e.id]=u.features.length),u.features.push(h),this.evaluate(h,{},u,!1)),l}getModelUris(){return this.modelUris}evaluate(e,t,r,n){const i=this.layers[0],s=e.feature,o=this.canonical,a=e.rotation=i.paint.get("model-rotation").evaluate(s,t,o),l=e.scale=i.paint.get("model-scale").evaluate(s,t,o),u=e.translation=i.paint.get("model-translation").evaluate(s,t,o),c=Object.assign({},i.paint.get("model-color").evaluate(s,t,o));c.a=i.paint.get("model-color-mix-intensity").evaluate(s,t,o);const h=[];this.maxVerticalOffset<u[2]&&(this.maxVerticalOffset=u[2]);const p=u[0]*u[0]+u[1]*u[1],d=p>0?Math.sqrt(p):0;r.maxScale=Math.max(Math.max(r.maxScale,l[0]),Math.max(l[1],l[2])),r.maxXYTranslationDistance=Math.max(r.maxXYTranslationDistance,d),this.maxScale=Math.max(Math.max(this.maxScale,l[0]),Math.max(l[1],l[2])),fg(h,a,l);const f=Math.round(100*c.a)+c.b/1.05;for(let m=0;m<e.instancedDataCount;++m){const t=e.instancedDataOffset+m,i=16*t,s=r.instancedDataArray.float32;let a=0;n&&(a=s[i+6]-r.instancesEvaluatedElevation[t]);const l=0|s[i+1];s[i]=(0|s[i])+c.r/1.05,s[i+1]=l+c.g/1.05,s[i+2]=f,s[i+3]=1/(o.z>10?this.tileToMeter:$l(o,l)),s[i+4]=u[0],s[i+5]=u[1],s[i+6]=u[2]+(r.instancesRoadElevation?r.instancesRoadElevation[t]:0)+a,s[i+7]=h[0],s[i+8]=h[1],s[i+9]=h[2],s[i+10]=h[4],s[i+11]=h[5],s[i+12]=h[6],s[i+13]=h[8],s[i+14]=h[9],s[i+15]=h[10],r.instancesEvaluatedElevation[t]=u[2]}}}let Pg,zg;ps(Bg,"ModelBucket",{omit:["layers"]}),ps(Mg,"PerModelAttributes"),ps(Sg,"ModelFeature");const Tg=64,kg=1,Vg=4,Eg=8;function Dg(e,t,r,n,i,o,c,h,p,d=!1){const f=r.zoom,m=r.project(n),y=jl(n.lat,f),g=1/y;s(e),l(e,e,[m.x+c[0]*g,m.y+c[1]*g,c[2]]);let x=1,v=1;const b=r.worldSize;if(d){if("mercator"===r.projection.name){let e=0;r.elevation&&(e=r.elevation.getAtPointOrZero(new Gl(m.x/b,m.y/b),0));const t=R([],[m.x,m.y,e,1],r.projMatrix)[3]/r.cameraToCenterDistance;x=t,v=t*jl(r.center.lat,f)}else if("globe"===r.projection.name){const t=yg(e,r),i=[0,0,0,1];R(i,i,a([],r.projMatrix,t));const s=i[3]/r.cameraToCenterDistance,o=uc(f),l=r.projection.pixelsPerMeter(n.lat,b)*jl(n.lat,f),u=r.projection.pixelsPerMeter(r.center.lat,b)*jl(r.center.lat,f);x=s/Bt(l,Nl(r.center.lat),o),v=s*y/l,x*=u,v*=u}}else x=g;u(e,e,[x,x,v]);const w=[...e],_=t.orientation,I=[];if(fg(I,[_[0]+(i?i[0]:0),_[1]+(i?i[1]:0),_[2]+(i?i[2]:0)],o),a(e,w,I),h&&r.elevation){let i=0;const s=[];if(p&&r.elevation){i=function(e,t,r,n,i){const s=t.elevation;if(!s)return 0;const o=wu.projectAabbCorners(r,n),a=Ll(1,i.lat)*t.worldSize,l=function(e,t){const r=[0,0,1],n=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const i of n){const n=e[i.corners[0]],s=e[i.corners[1]],o=e[i.corners[2]],a=[s[0]-n[0],s[1]-n[1],t*(s[2]-n[2])],l=z(a,a,[o[0]-n[0],o[1]-n[1],t*(o[2]-n[2])]);B(l,l),i.dotProductWithUp=P(l,r)}return n.sort((e,t)=>e.dotProductWithUp-t.dotProductWithUp),n[0].corners}(o,a),u=o[l[0]],c=o[l[1]],h=o[l[2]],p=o[l[3]],d=s.getAtPointOrZero(new Gl(u[0]/t.worldSize,u[1]/t.worldSize),0),f=s.getAtPointOrZero(new Gl(c[0]/t.worldSize,c[1]/t.worldSize),0),m=s.getAtPointOrZero(new Gl(h[0]/t.worldSize,h[1]/t.worldSize),0),y=s.getAtPointOrZero(new Gl(p[0]/t.worldSize,p[1]/t.worldSize),0),g=(d+y)/2,x=(f+m)/2;return g>x?f<m?mg(e,c,p,u,f,y,d,a):mg(e,h,u,p,m,d,y,a):d<y?mg(e,u,c,h,d,f,m,a):mg(e,p,h,c,y,m,f,a),Math.max(g,x)}(s,r,t.aabb,e,n);const o=a([],function(e,t){var r=t[0],n=t[1],i=t[2],s=t[3],o=r+r,a=n+n,l=i+i,u=r*o,c=n*o,h=n*a,p=i*o,d=i*a,f=i*l,m=s*o,y=s*a,g=s*l;return e[0]=1-h-f,e[1]=c+g,e[2]=p-y,e[3]=0,e[4]=c-g,e[5]=1-u-f,e[6]=d+m,e[7]=0,e[8]=p+y,e[9]=d-m,e[10]=1-u-h,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}([],s),I);a(e,w,o)}else i=r.elevation.getAtPointOrZero(new Gl(m.x/b,m.y/b),0);0!==i&&(e[14]+=i)}}class Cg{constructor(e,t,r,n,i){this.materialOverrides=/* @__PURE__ */new Map,this.nodeOverrides=/* @__PURE__ */new Map,this.materialOverrideNames=[],this.nodeOverrideNames=[],this.featureProperties={},this.id=e,this.uri=t,this.position=null!=r?new Vl(r[0],r[1]):new Vl(0,0),this.orientation=null!=n?n:[0,0,0],this.nodes=i,this.uploaded=!1,this.aabb=new wu([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),this.matrix=[]}_applyTransformations(e,t){a(e.globalMatrix,t,e.localMatrix);const r=this.nodeOverrides.get(e.name);if(void 0!==r){const t=[];i=r.orientation,s(n=t),h(n,n,ce(i[1])),p(n,n,ce(i[2])),c(n,n,ce(i[0])),a(e.globalMatrix,e.globalMatrix,t)}var n,i;if(e.meshes)for(const s of e.meshes){const t=wu.applyTransformFast(s.aabb,e.globalMatrix);this.aabb.encapsulate(t)}if(e.children)for(const s of e.children)this._applyTransformations(s,e.globalMatrix)}computeBoundsAndApplyParent(){const e=s([]);this.aabb=new wu([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const t of this.nodes)this._applyTransformations(t,e)}computeModelMatrix(e,t,r,n,i,s,o=!1){Dg(this.matrix,this,e.transform,this.position,t,r,n,i,s,o)}upload(e){if(!this.uploaded){for(const t of this.nodes)Rg(t,e);for(const e of this.nodes)Og(e);this.uploaded=!0}}destroy(){for(const e of this.nodes)Ng(e)}}function Fg(e,t,r=!1){e.uploaded||(e.gfxTexture=new cm(t,e.image,r?t.gl.R8:t.gl.RGBA8,{useMipmap:e.sampler.minFilter>=t.gl.NEAREST_MIPMAP_NEAREST}),e.uploaded=!0,e.image=null)}function Lg(e,t,r){e.indexBuffer=t.createIndexBuffer(e.indexArray,!1,!0),e.vertexBuffer=t.createVertexBuffer(e.vertexArray,xg.members,!1,!0),e.normalArray&&(e.normalBuffer=t.createVertexBuffer(e.normalArray,_g.members,!1,!0)),e.texcoordArray&&(e.texcoordBuffer=t.createVertexBuffer(e.texcoordArray,wg.members,!1,!0)),e.colorArray&&(e.colorBuffer=t.createVertexBuffer(e.colorArray,(12===e.colorArray.bytesPerElement?vg:bg).members,!1,!0)),e.featureArray&&(e.pbrBuffer=t.createVertexBuffer(e.featureArray,Ag.members,!0)),e.segments=Ka.simpleSegment(0,0,e.vertexArray.length,e.indexArray.length);const n=e.material;n.pbrMetallicRoughness.baseColorTexture&&Fg(n.pbrMetallicRoughness.baseColorTexture,t),n.pbrMetallicRoughness.metallicRoughnessTexture&&Fg(n.pbrMetallicRoughness.metallicRoughnessTexture,t),n.normalTexture&&Fg(n.normalTexture,t),n.occlusionTexture&&Fg(n.occlusionTexture,t,r),n.emissionTexture&&Fg(n.emissionTexture,t)}function Rg(e,t,r){if(e.meshes)for(const n of e.meshes)Lg(n,t,r);if(e.children)for(const n of e.children)Rg(n,t,r)}function Og(e){if(e.meshes)for(const t of e.meshes)t.indexArray.destroy(),t.vertexArray.destroy(),t.colorArray&&t.colorArray.destroy(),t.normalArray&&t.normalArray.destroy(),t.texcoordArray&&t.texcoordArray.destroy(),t.featureArray&&t.featureArray.destroy();if(e.children)for(const t of e.children)Og(t)}function Ug(e){e.pbrMetallicRoughness.baseColorTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture&&e.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),e.pbrMetallicRoughness.metallicRoughnessTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&e.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),e.normalTexture&&e.normalTexture.gfxTexture&&e.normalTexture.gfxTexture.destroy(),e.emissionTexture&&e.emissionTexture.gfxTexture&&e.emissionTexture.gfxTexture.destroy(),e.occlusionTexture&&e.occlusionTexture.gfxTexture&&e.occlusionTexture.gfxTexture.destroy()}function Ng(e){if(e.meshes)for(const t of e.meshes)t.vertexBuffer&&(t.vertexBuffer.destroy(),t.indexBuffer.destroy(),t.normalBuffer&&t.normalBuffer.destroy(),t.texcoordBuffer&&t.texcoordBuffer.destroy(),t.colorBuffer&&t.colorBuffer.destroy(),t.pbrBuffer&&t.pbrBuffer.destroy(),t.segments.destroy(),t.material&&Ug(t.material));if(e.footprintDebugMesh&&(e.footprintDebugMesh.vertexBuffer.destroy(),e.footprintDebugMesh.indexBuffer.destroy(),e.footprintDebugMesh.segments.destroy()),e.children)for(const t of e.children)Ng(t)}class jg{constructor(e,t,r){this._demTile=e,this._dem=this._demTile.dem,this._scale=t,this._offset=r}static create(e,t,r){const n=r||e.findDEMTileFor(t);if(!n||!n.dem)return;const i=n.dem,s=n.tileID,o=1<<t.canonical.z-s.canonical.z;return new jg(n,i.dim/tn/o,[(t.canonical.x/o-s.canonical.x)*i.dim,(t.canonical.y/o-s.canonical.y)*i.dim])}tileCoordToPixel(e,t){const r=t*this._scale+this._offset[1];return new oe(Math.floor(e*this._scale+this._offset[0]),Math.floor(r))}getElevationAt(e,t,r,n){const i=e*this._scale+this._offset[0],s=t*this._scale+this._offset[1],o=Math.floor(i),a=Math.floor(s),l=this._dem;return n=!!n,r?Bt(Bt(l.get(o,a,n),l.get(o,a+1,n),s-a),Bt(l.get(o+1,a,n),l.get(o+1,a+1,n),s-a),i-o):l.get(o,a,n)}getElevationAtPixel(e,t,r){return this._dem.get(e,t,!!r)}getMeterToDEM(e){return(1<<this._demTile.tileID.canonical.z)*Ll(1,e)*this._dem.stride}}const $g=new Float32Array(262144),Gg=new Uint8Array(262144);function Xg(e){let t=0;if(e.meshes)for(const r of e.meshes)t=Math.max(t,r.aabb.max[2]);if(e.children)for(const r of e.children)t=Math.max(t,Xg(r));return t}function qg(e,t,r){if(e.meshes)for(const n of e.meshes){if(n.aabb.min[0]===1/0)continue;const i=wu.applyTransform(n.aabb,e.globalMatrix);r.insert(t,i.min[0],i.min[1],i.max[0],i.max[1])}if(e.children)for(const n of e.children)qg(n,t,r)}const Hg=["","wall","door","roof","window","lamp","logo"];class Zg{constructor(e){this.node=e,this.evaluatedRMEA=[[1,0,0,1],[1,0,0,1],[1,0,0,1],[1,0,0,1],[.4,1,0,1],[1,0,0,1],[1,0,0,1]],this.hiddenByReplacement=!1,this.evaluatedTranslation=[0,0,0],this.evaluatedScale=[1,1,1],this.evaluatedColor=[],this.emissionHeightBasedParams=[],this.cameraCollisionOpacity=1,this.feature={type:"Point",id:e.id,geometry:[],properties:{height:Xg(e)}},this.aabb=this._getLocalBounds(),this.state=null}_getLocalBounds(){if(!this.node.meshes)return new wu([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);if(!this.aabb){let e=0;const t=new wu([1/0,1/0,1/0],[-1/0,-1/0,-1/0]);for(const r of this.node.meshes)this.node.lightMeshIndex!==e&&(r.transformedAabb=wu.applyTransformFast(r.aabb,this.node.globalMatrix),t.encapsulate(r.transformedAabb)),e++;this.aabb=t}return this.aabb}}class Yg{constructor(e,t,r,n,i,s,o,a){this.id=r,this.layers=e,this.layerIds=this.layers.map(e=>e.fqid),this.stateDependentLayerIds=this.layers.filter(e=>e.isStateDependent()).map(e=>e.id),this.modelTraits|=kg,this.uploaded=!1,this.hasPattern=!1,n&&(this.modelTraits|=Vg),i&&(this.modelTraits|=Eg),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=s,this.worldview=a,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const l of t)this.nodesInfo.push(new Zg(l)),qg(l,o.featureIndexArray.length,o.grid),o.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,o.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(e,t){for(const r of this.getNodesInfo()){const n=r.node;n.footprint&&t.push({footprint:n.footprint,id:e})}}updateAppearances(e,t,r,n){return{hasLayoutChanges:!1,hasUboChanges:!1}}update(e){const t=0!==Object.keys(e).length;if(t&&!this.stateDependentLayers.length)return;const r=t?this.stateDependentLayers:this.layers;if(!ae(e,this.states))for(const n of r)this.evaluate(n,e);this.states=structuredClone(e)}populate(){}uploadPending(){return!this.uploaded||this.needsUpload}upload(e){if(!this.needsUpload)return;const t=this.getNodesInfo();for(const r of t){const t=r.node;this.uploaded?this.updatePbrBuffer(t):Rg(t,e,!0)}for(const r of t)Og(r.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(e){let t=!1;if(!e.meshes)return t;for(const r of e.meshes)r.pbrBuffer&&(r.pbrBuffer.updateData(r.featureArray),t=!0);return t}needsReEvaluation(e,t,r){const n=e.transform.projectionOptions,i=e.style.getBrightness(),s=this.brightness!==i;if(!this.uploaded||this.dirty||n.name!==this.projection.name||Wg(r.paint.get("model-color").value,s)||Wg(r.paint.get("model-color-mix-intensity").value,s)||Wg(r.paint.get("model-roughness").value,s)||Wg(r.paint.get("model-emissive-strength").value,s)||Wg(r.paint.get("model-height-based-emissive-strength-multiplier").value,s)){this.projection=n,this.brightness=i;const e=this.getNodesInfo();for(const t of e)t.state=null;return!0}return!1}evaluateTransform(e,t){if(e.transform.zoom===this.zoom)return;this.zoom=e.transform.zoom;const r=this.getNodesInfo(),n=this.id.canonical;for(const i of r){const e=i.feature;i.evaluatedTranslation=t.paint.get("model-translation").evaluate(e,{},n),i.evaluatedScale=t.paint.get("model-scale").evaluate(e,{},n)}}evaluate(e,t){const r=this.getNodesInfo();for(const n of r){if(!n.node.meshes)continue;const r=n.feature,i=t&&t[r.id];if(ae(i,n.state))continue;n.state=structuredClone(i);const s=n.node.meshes&&n.node.meshes[0].featureData,o=n.evaluatedColor[2],a=n.evaluatedRMEA[2],l=this.id.canonical;if(n.hasTranslucentParts=!1,s){for(let t=0;t<Hg.length;t++){const s=Hg[t];s.length&&(r.properties.part=s);const o=e.paint.get("model-color").evaluate(r,i,l).toPremultipliedRenderColor(null),a=e.paint.get("model-color-mix-intensity").evaluate(r,i,l);n.evaluatedColor[t]=[o.r,o.g,o.b,a],n.evaluatedRMEA[t][0]=e.paint.get("model-roughness").evaluate(r,i,l),n.evaluatedRMEA[t][2]=e.paint.get("model-emissive-strength").evaluate(r,i,l),n.evaluatedRMEA[t][3]=o.a,n.emissionHeightBasedParams[t]=e.paint.get("model-height-based-emissive-strength-multiplier").evaluate(r,i,l),!n.hasTranslucentParts&&o.a<1&&(n.hasTranslucentParts=!0)}delete r.properties.part,Kg(n,o!==n.evaluatedColor[2]||a!==n.evaluatedRMEA[2],this.modelTraits)}else n.evaluatedRMEA[0][2]=e.paint.get("model-emissive-strength").evaluate(r,i,l);n.evaluatedTranslation=e.paint.get("model-translation").evaluate(r,i,l),n.evaluatedScale=e.paint.get("model-scale").evaluate(r,i,l),this.updatePbrBuffer(n.node)||(this.needsUpload=!0)}this.dirty=!1}elevationUpdate(e,t,r,n){const i=e.findDEMTileFor(r);if(i&&(i.tileID.canonical!==this.terrainTile||t!==this.terrainExaggeration)){if(i.dem&&i.tileID.overscaledZ!==this.elevationReadFromZ){this.elevationReadFromZ=i.tileID.overscaledZ;const t=jg.create(e,r,i);if(!t)return;this.modelTraits&Vg&&this.updateDEM(e,t,r,n);for(const e of this.getNodesInfo()){const r=e.node;if(!r.footprint||!r.footprint.vertices||!r.footprint.vertices.length)continue;const n=r.footprint.vertices;let i=t.getElevationAt(n[0].x,n[0].y,!0,!0);for(let e=1;e<n.length;e++)i=Math.min(i,t.getElevationAt(n[e].x,n[e].y,!0,!0));r.elevation=i}}this.terrainTile=i.tileID.canonical,this.terrainExaggeration=t}}updateDEM(e,t,r,n){let i=t._dem._modifiedForSources[n];if(void 0===i&&(t._dem._modifiedForSources[n]=[],i=t._dem._modifiedForSources[n]),i.includes(r.canonical))return;const s=t._dem.dim;i.push(r.canonical);let o=!1;for(const a of this.getNodesInfo()){const e=a.node;if(!e.footprint||!e.footprint.grid)continue;const r=e.footprint.grid,n=t.tileCoordToPixel(r.min.x,r.min.y),i=t.tileCoordToPixel(r.max.x,r.max.y),l=Math.min(Math.min(s-i.y,n.x),Math.min(n.y,s-i.x));if(l<0)continue;const u=pe(l,2,5);let c=Math.max(0,n.x-u),h=Math.max(0,n.y-u),p=Math.min(i.x+u,s-1),d=Math.min(i.y+u,s-1);for(let t=h;t<=d;++t)for(let e=c;e<=p;++e)Gg[t*s+e]=255;let f=0,m=0;for(let o=0;o<r.cellsY;++o)for(let e=0;e<r.cellsX;++e){if(!r.cells[o*r.cellsX+e])continue;const n=t.tileCoordToPixel(r.min.x+e/r.xScale,r.min.y+o/r.yScale),i=t.tileCoordToPixel(r.min.x+(e+1)/r.xScale,r.min.y+(o+1)/r.yScale);for(let e=n.y;e<=Math.min(i.y+1,s-1);++e)for(let r=n.x;r<=Math.min(i.x+1,s-1);++r)255===Gg[e*s+r]&&(Gg[e*s+r]=0,f+=t.getElevationAtPixel(r,e),m++)}const y=f/m;c=Math.max(1,n.x-u),h=Math.max(1,n.y-u),p=Math.min(i.x+u,s-2),d=Math.min(i.y+u,s-2),o=!0;for(let o=h;o<=d;++o)for(let e=c;e<=p;++e)0===Gg[o*s+e]&&($g[o*s+e]=t._dem.set(e,o,y));for(let o=1;o<u;++o){c=Math.max(1,n.x-o),h=Math.max(1,n.y-o),p=Math.min(i.x+o,s-2),d=Math.min(i.y+o,s-2);for(let e=h;e<=d;++e)for(let r=c;r<=p;++r){const n=e*s+r;if(255===Gg[n]){let i=0,a=0,l=-1,c=-1;for(let t=-1;t<=1;++t)for(let n=-1;n<=1;++n){const u=(e+t)*s+r+n;if(Gg[u]>=o)continue;const h=$g[u],p=Math.abs(h);p>a&&(i=h,a=p,l=n,c=t)}if(a>.1){const s=1-(o+.5*Math.abs(l*c))/u;let a=t._dem.get(r,e)+i*s;const h=t._dem.get(r+l,e+c),p=t._dem.get(r-l,e-c,!0);(a-h)*(a-p)>0&&(a=(h+p)/2),$g[n]=t._dem.set(r,e,a),Gg[n]=o}}}}}o&&(t._demTile.needsDEMTextureUpload=!0,t._dem._timestamp=Ne.now())}setFilter(e){this.filter=e?So(e):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(e=>this.filter.filter(new lo(this.id.overscaledZ,{worldview:this.worldview}),e.feature,this.id.canonical)):this.nodesInfo}destroy(){const e=this.getNodesInfo();for(const t of e)Og(t.node),Ng(t.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(e,t){if(t.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=t.updateTime;const r=t.getReplacementRegionsForTile(e.toUnwrapped());for(const n of this.getNodesInfo()){const e=n.node.footprint;n.hiddenByReplacement=!!e&&!r.some(t=>t.footprint===e)}}getHeightAtTileCoord(e,t){const r=[],n=[0,0,0],i=s([]);for(const s of this.getNodesInfo()){const a=s.node.meshes[0],l=a.transformedAabb;if(e<l.min[0]||t<l.min[1]||e>l.max[0]||t>l.max[1])continue;if(!0===s.node.hidden)return{height:1/0,maxHeight:s.feature.properties.height,hidden:!1,verticalScale:s.evaluatedScale[2]};o(i,s.node.globalMatrix),n[0]=e,n[1]=t,k(n,n,i);const u=(n[0]-a.aabb.min[0])/(a.aabb.max[0]-a.aabb.min[0])*Tg|0,c=Math.min(63,(n[1]-a.aabb.min[1])/(a.aabb.max[1]-a.aabb.min[1])*Tg|0)*Tg+Math.min(63,u),h=a.heightmap[c];if(!(h<0&&s.node.footprint)){if(s.hiddenByReplacement)return;return{height:h,maxHeight:s.feature.properties.height,hidden:!1,verticalScale:s.evaluatedScale[2]}}if(s.node.footprint.grid.query(new oe(e,t),new oe(e,t),r),r.length>0)return{height:void 0,maxHeight:s.feature.properties.height,hidden:s.hiddenByReplacement,verticalScale:s.evaluatedScale[2]}}}}function Wg(e,t){return e instanceof rs&&!e.isLightConstant&&t}function Jg(e,t,r,n,i,s,o,a){let l=(61440&t|(61440&t)>>4)>>8,u=(3840&t|(3840&t)>>4)>>4,c=240&t|(240&t)>>4;r[3]>0&&(l=Bt(l,255*r[0],r[3]),u=Bt(u,255*r[1],r[3]),c=Bt(c,255*r[2],r[3]));const h=l<<8|u,p=c<<8|Math.floor(255*n[3]),d=function(e){const t=pe(e,0,2);return Math.min(Math.round(.5*t*255),255)}(n[2])<<8|15*n[0]<<4|15*n[1],f=pe(i[0],0,1),m=pe(i[1],0,1),y=pe(i[2],0,1),g=pe(i[3],0,1);let x,v,b,w;if(f!==m&&o!==s&&m!==f){const e=o-s;v=1/(e*(m-f)),b=-(s+e*f)/(e*(m-f));const t=pe(i[4],-1,1);w=Math.pow(10,t),x=255*y<<8|255*g}else x=65535,v=0,b=1,w=1;if(e.emplaceBack(h,p,d,x,v,b,w),a){const e=a.length;a.clear();for(let t=0;t<e;t++)a.emplaceBack(h,p,d,x,v,b,w)}}function Kg(e,t,r){const n=e.node;let i=0;const s=r&Eg;for(const o of n.meshes){if(n.lights&&n.lightMeshIndex===i)continue;if(!o.featureData)continue;o.featureArray=new Ea,o.featureArray.reserve(o.featureData.length);let r=t;for(const t of o.featureData){const i=s?65535&t:t>>16&65535,a=s?t>>16&65535:65535&t,l=(15&a)<8?15&a:0,u=e.evaluatedRMEA[l],c=e.evaluatedColor[l],h=e.emissionHeightBasedParams[l];let p;if(r&&2===l&&n.lights&&(p=new Ea,p.resize(10*n.lights.length)),Jg(o.featureArray,i,c,u,h,o.aabb.min[2],o.aabb.max[2],p),p&&r){r=!1;const e=n.meshes[n.lightMeshIndex];e.featureArray=p,e.featureArray._trim()}}o.featureArray._trim(),i++}}ps(Yg,"Tiled3dModelBucket",{omit:["layers"]}),ps(Zg,"Tiled3dModelFeature");const Qg=["id","tile","layer","source","sourceLayer","state"];class ex{constructor(e,t,r,n,i){this.type="Feature",this._vectorTileFeature=e,this._z=t,this._x=r,this._y=n,this.properties=e?e.properties:{},this.id=i}clone(){const e=new ex(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(e.state=Object.assign({},this.state)),this.layer&&(e.layer=Object.assign({},this.layer)),this.source&&(e.source=this.source),this.sourceLayer&&(e.sourceLayer=this.sourceLayer),e}get geometry(){return void 0===this._geometry&&this._vectorTileFeature&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(e){this._geometry=e}toJSON(){const e={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const t of Qg)void 0!==this[t]&&(e[t]=this[t]);return e}}let tx=null,rx=null,nx=null,ix=null;const sx=5120,ox=5121,ax=5122,lx=5123,ux=5125,cx=5126,hx={[sx]:Int8Array,[ox]:Uint8Array,[ax]:Int16Array,[lx]:Uint16Array,[ux]:Uint32Array,[cx]:Float32Array},px={[sx]:"DT_INT8",[ox]:"DT_UINT8",[ax]:"DT_INT16",[lx]:"DT_UINT16",[ux]:"DT_UINT32",[cx]:"DT_FLOAT32"},dx={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};function fx(e,t,r){const n=r.json.bufferViews.length,i=r.buffers.length;t.bufferView=n,r.json.bufferViews[n]={buffer:i,byteLength:e.byteLength},r.buffers[i]=e}const mx="KHR_draco_mesh_compression";function yx(e,t){const r=e.extensions&&e.extensions[mx];if(!r)return;const n=new tx.Decoder,i=Ix(t,r.bufferView),s=new tx.Mesh;if(!n.DecodeArrayToMesh(i,i.byteLength,s))throw new Error("Failed to decode Draco mesh");const o=t.json.accessors[e.indices],a=hx[o.componentType],l=o.count*a.BYTES_PER_ELEMENT,u=tx._malloc(l);a===Uint16Array?n.GetTrianglesUInt16Array(s,l,u):n.GetTrianglesUInt32Array(s,l,u),fx(tx.memory.buffer.slice(u,u+l),o,t),tx._free(u);for(const c of Object.keys(r.attributes)){const i=n.GetAttributeByUniqueId(s,r.attributes[c]),o=t.json.accessors[e.attributes[c]],a=px[o.componentType],l=o.count*dx[o.type]*hx[o.componentType].BYTES_PER_ELEMENT,u=tx._malloc(l);n.GetAttributeDataArrayForAllPoints(s,i,tx[a],l,u),fx(tx.memory.buffer.slice(u,u+l),o,t),tx._free(u)}n.destroy(),s.destroy(),delete e.extensions[mx]}const gx="EXT_meshopt_compression";function xx(e,t){if(!e.extensions||!e.extensions[gx])return;const r=e.extensions[gx],n=new Uint8Array(t.buffers[r.buffer],r.byteOffset||0,r.byteLength||0),i=new Uint8Array(r.count*r.byteStride);nx.decodeGltfBuffer(i,r.count,r.byteStride,n,r.mode,r.filter),e.buffer=t.buffers.length,e.byteOffset=0,t.buffers[e.buffer]=i.buffer,delete e.extensions[gx]}const vx=1179937895,bx=new TextDecoder("utf8");function wx(e,t){return new URL(e,t).href}async function _x(e,t,r,n,i){const s=await fetch(wx(e.uri,n),{signal:i}),o=await s.arrayBuffer();t.buffers[r]=o}function Ix(e,t){const r=e.json.bufferViews[t];return new Uint8Array(e.buffers[r.buffer],r.byteOffset||0,r.byteLength)}async function Ax(e,t,r,n,i){if(e.uri){const s=wx(e.uri,n),o=await fetch(s,{signal:i}),a=await o.blob(),l=await createImageBitmap(a);t.images[r]=l}else if(void 0!==e.bufferView){const n=Ix(t,e.bufferView),i=new Blob([n],{type:e.mimeType}),s=await createImageBitmap(i);t.images[r]=s}}async function Sx(e,t=0,r,n){const i={json:null,images:[],buffers:[]};if(new Uint32Array(e,t,1)[0]===vx){const r=new Uint32Array(e,t);let n=2;const s=(r[n++]>>2)-3,o=r[n++]>>2;if(n++,i.json=JSON.parse(bx.decode(r.subarray(n,n+o))),n+=o,n<s){const s=r[n++];n++;const o=t+(n<<2);i.buffers[0]=e.slice(o,o+s)}}else i.json=JSON.parse(bx.decode(new Uint8Array(e,t)));const{buffers:s,images:o,meshes:a,extensionsUsed:l,bufferViews:u}=i.json;if(s){const e=[];for(let t=0;t<s.length;t++){const o=s[t];o.uri?e.push(_x(o,i,t,r,n)):i.buffers[t]||(i.buffers[t]=null)}await Promise.all(e)}if(n&&n.aborted)throw new DOMException("Aborted","AbortError");const c=[],h=l&&l.includes(mx),p=l&&l.includes(gx);if(h&&c.push(function(){if(!tx)return null!=rx||(rx=function(e){let t,r=null;function n(){t=new Uint8Array(r.buffer)}function i(){throw new Error("Unexpected Draco error.")}return WebAssembly.instantiateStreaming(e,{a:{a:i,d:function(e,r,n){return t.copyWithin(e,r,r+n)},c:function(e){const i=t.length,s=Math.max(e>>>0,Math.ceil(1.2*i)),o=Math.ceil((s-i)/65536);try{return r.grow(o),n(),!0}catch(a){return!1}},b:i}}).then(e=>{const{Rb:i,Qb:s,P:o,T:a,X:l,Ja:u,La:c,Qa:h,Va:p,Wa:d,eb:f,jb:m,f:y,e:g,yb:x,zb:v,Ab:b,Bb:w,Db:_,Gb:I}=e.instance.exports;r=g;const A=/* @__PURE__ */(()=>{let e=0,r=0,n=0,o=0;return a=>{n&&(i(o),i(e),r+=n,n=e=0),e||(r+=128,e=s(r));const l=a.length+7&-8;let u=e;l>=r&&(n=l,u=o=s(l));for(let e=0;e<a.length;e++)t[u+e]=a[e];return u}})();return n(),y(),{memory:g,_free:i,_malloc:s,Mesh:class{constructor(){this.ptr=o()}destroy(){a(this.ptr)}},Decoder:class{constructor(){this.ptr=u()}destroy(){m(this.ptr)}DecodeArrayToMesh(e,t,r){const n=A(e),i=c(this.ptr,n,t,r.ptr);return!!l(i)}GetAttributeByUniqueId(e,t){return{ptr:h(this.ptr,e.ptr,t)}}GetTrianglesUInt16Array(e,t,r){p(this.ptr,e.ptr,t,r)}GetTrianglesUInt32Array(e,t,r){d(this.ptr,e.ptr,t,r)}GetAttributeDataArrayForAllPoints(e,t,r,n,i){f(this.ptr,e.ptr,t.ptr,r,n,i)}},DT_INT8:x(),DT_UINT8:v(),DT_INT16:b(),DT_UINT16:w(),DT_UINT32:_(),DT_FLOAT32:I()}})}(fetch(new URL(ke.DRACO_URL,ke.API_URL).href)).then(e=>{tx=e,rx=null})),rx}()),p&&c.push(function(){var e;if(!nx)return null!=ix||(ix=(e=fetch(function(){if("object"!=typeof WebAssembly)throw new Error("WebAssembly not supported, cannot instantiate meshoptimizer");return new URL(function(){if(void 0===Me){if("object"!=typeof WebAssembly)return!1;const e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);Me=WebAssembly.validate(e)}return Me}()?ke.MESHOPT_SIMD_URL:ke.MESHOPT_URL,ke.API_URL).href}()),WebAssembly.instantiateStreaming(e,{}).then(e=>{const{sbrk:t,memory:r,meshopt_decodeVertexBuffer:n,meshopt_decodeIndexBuffer:i,meshopt_decodeIndexSequence:s,meshopt_decodeFilterOct:o,meshopt_decodeFilterQuat:a,meshopt_decodeFilterExp:l}=e.instance.exports,u={ATTRIBUTES:n,TRIANGLES:i,INDICES:s},c={OCTAHEDRAL:o,QUATERNION:a,EXPONENTIAL:l};return e.instance.exports.__wasm_call_ctors(),{decodeGltfBuffer(e,n,i,s,o,a){const l=n+3&-4,h=t(l*i),p=t(s.length),d=new Uint8Array(r.buffer);d.set(s,p);const f=u[o](h,n,i,p,s.length);if(0===f&&c[a]&&c[a](h,l,i),e.set(d.subarray(h,h+n*i)),t(h-t(0)),0!==f)throw new Error(`Malformed buffer data: ${f}`)}}})).then(e=>{nx=e,ix=null})),ix}()),o)for(let d=0;d<o.length;d++)c.push(Ax(o[d],i,d,r,n));if(c.length&&await Promise.all(c),n&&n.aborted)throw new DOMException("Aborted","AbortError");if(h&&a)for(const{primitives:d}of a)for(const e of d)yx(e,i);if(p&&a&&u)for(const d of u)xx(d,i);return i}function Mx(e,t){const r=e.json.bufferViews[t.bufferView],n=hx[t.componentType];return new n(e.buffers[r.buffer],(t.byteOffset||0)+(r.byteOffset||0),t.count*(r.byteStride&&r.byteStride!==dx[t.type]*n.BYTES_PER_ELEMENT?r.byteStride/n.BYTES_PER_ELEMENT:dx[t.type]))}function Bx(e,t,r,n){const i=hx[t.componentType],s=function(e){switch(e){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(i),o=e.json.bufferViews[t.bufferView],a=o.byteStride?o.byteStride/i.BYTES_PER_ELEMENT:dx[t.type],l=r.float32,u=l.length/r.capacity;for(let c=0,h=0;c<t.count*a;c+=a,h+=u)for(let e=0;e<u;e++)l[h+e]=n[c+e]*s;r._trim()}function Px(e,t,r){const n=e.indices,i=e.attributes,s={};s.indexArray=new wa;const o=t.json.accessors[n],a=o.count/3;s.indexArray.reserve(a);const l=Mx(t,o);for(let p=0;p<a;p++)s.indexArray.emplaceBack(l[3*p],l[3*p+1],l[3*p+2]);s.indexArray._trim(),s.vertexArray=new la;const u=t.json.accessors[i.POSITION];s.vertexArray.reserve(u.count);const c=Mx(t,u);for(let p=0;p<u.count;p++)s.vertexArray.emplaceBack(c[3*p],c[3*p+1],c[3*p+2]);if(s.vertexArray._trim(),s.aabb=new wu(u.min,u.max),s.centroid=function(e,t){const r=[0,0,0],n=e.length;if(n>0){for(let i=0;i<n;i++){const n=3*e[i];r[0]+=t[n],r[1]+=t[n+1],r[2]+=t[n+2]}r[0]/=n,r[1]/=n,r[2]/=n}return r}(l,c),void 0!==i.COLOR_0){const e=t.json.accessors[i.COLOR_0],r=dx[e.type],n=Mx(t,e);s.colorArray=3===r?new la:new fa,s.colorArray.resize(e.count),Bx(t,e,s.colorArray,n)}if(void 0!==i.NORMAL){s.normalArray=new la;const e=t.json.accessors[i.NORMAL];s.normalArray.resize(e.count);const r=Mx(t,e);Bx(t,e,s.normalArray,r)}if(void 0!==i.TEXCOORD_0&&r.length>0){s.texcoordArray=new za;const e=t.json.accessors[i.TEXCOORD_0];s.texcoordArray.resize(e.count);const r=Mx(t,e);Bx(t,e,s.texcoordArray,r)}if(void 0!==i._FEATURE_ID_RGBA4444){const e=t.json.accessors[i._FEATURE_ID_RGBA4444];t.json.extensionsUsed&&t.json.extensionsUsed.includes("EXT_meshopt_compression")&&(s.featureData=Mx(t,e))}void 0!==i._FEATURE_RGBA4444&&(s.featureData=new Uint32Array(Mx(t,t.json.accessors[i._FEATURE_RGBA4444]).buffer));const h=e.material;return s.material=function(e,t){const{emissiveFactor:r=[0,0,0],alphaMode:n="OPAQUE",alphaCutoff:i=.5,normalTexture:s,occlusionTexture:o,emissiveTexture:a,doubleSided:l,name:u}=e,{baseColorFactor:c=[1,1,1,1],metallicFactor:h=1,roughnessFactor:p=1,baseColorTexture:d,metallicRoughnessTexture:f}=e.pbrMetallicRoughness||{},m=o?t[o.index]:void 0;if(o&&o.extensions&&o.extensions.KHR_texture_transform&&m){const e=o.extensions.KHR_texture_transform;m.offsetScale=[e.offset[0],e.offset[1],e.scale[0],e.scale[1]]}return{name:u,pbrMetallicRoughness:{baseColorFactor:new Pt(...c),metallicFactor:h,roughnessFactor:p,baseColorTexture:d?t[d.index]:void 0,metallicRoughnessTexture:f?t[f.index]:void 0},doubleSided:l,emissiveFactor:new Pt(...r),alphaMode:n,alphaCutoff:i,normalTexture:s?t[s.index]:void 0,occlusionTexture:m,emissionTexture:a?t[a.index]:void 0,defined:void 0===e.defined}}(void 0!==h?t.json.materials[h]:{defined:!1},r),s}function zx(e,r,n){const{matrix:i,rotation:s,translation:o,scale:a,mesh:l,extras:u,children:c,name:h}=e,p={};if(p.name=h,p.localMatrix=i||(d=[],m=o||[0,0,0],y=a||[1,1,1],g=(f=s||[0,0,0,1])[0],x=f[1],v=f[2],b=f[3],A=g*(w=g+g),S=g*(_=x+x),M=g*(I=v+v),B=x*_,P=x*I,z=v*I,T=b*w,k=b*_,V=b*I,E=y[0],D=y[1],C=y[2],d[0]=(1-(B+z))*E,d[1]=(S+V)*E,d[2]=(M-k)*E,d[3]=0,d[4]=(S-V)*D,d[5]=(1-(A+z))*D,d[6]=(P+T)*D,d[7]=0,d[8]=(M+k)*C,d[9]=(P-T)*C,d[10]=(1-(A+B))*C,d[11]=0,d[12]=m[0],d[13]=m[1],d[14]=m[2],d[15]=1,d),p.globalMatrix=function(e){var r=new t(16);return r[0]=e[0],r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=e[4],r[5]=e[5],r[6]=e[6],r[7]=e[7],r[8]=e[8],r[9]=e[9],r[10]=e[10],r[11]=e[11],r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15],r}(p.localMatrix),void 0!==l){p.meshes=n[l];const e=p.anchor=[0,0];for(const t of p.meshes){const{min:r,max:n}=t.aabb;e[0]+=r[0]+n[0],e[1]+=r[1]+n[1]}e[0]=Math.floor(e[0]/p.meshes.length/2),e[1]=Math.floor(e[1]/p.meshes.length/2)}var d,f,m,y,g,x,v,b,w,_,I,A,S,M,B,P,z,T,k,V,E,D,C;if(u&&(u.id&&(p.id=u.id),u.lights&&(p.lights=function(e){if(!e.length)return[];const t=function(e){const t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.codePointAt(n);return r}(e),r=[],n=t.length/24,i=new Uint16Array(t.buffer),s=new Float32Array(t.buffer);for(let o=0;o<n;o++){const e=i[2*o*6]/30,t=i[2*o*6+1]/30,n=i[2*o*6+10]/100,a=s[6*o+1],l=s[6*o+2],u=s[6*o+3],c=s[6*o+4],h=u-a,p=c-l,d=Math.hypot(h,p);r.push({pos:[a+.5*h,l+.5*p,t],normal:[p/d,-h/d,0],width:d,height:e,depth:n,points:[a,l,u,c]})}return r}(u.lights)),u.MAPBOX_geometry_bloom&&(p.isGeometryBloom=u.MAPBOX_geometry_bloom)),c){const e=[];for(const t of c)e.push(zx(r.json.nodes[t],r,n));p.children=e}return p}function Tx(e){if(0===e.vertices.length||0===e.indices.length)return null;const t=new rp(e.vertices,e.indices,8,256),[r,n]=[t.min.clone(),t.max.clone()];return{vertices:e.vertices,indices:e.indices,grid:t,min:r,max:n}}function kx(e){if(!e.extras||!e.extras.ground)return null;const t=e.extras.ground;if(!t||!Array.isArray(t)||0===t.length)return null;const r=t[0];if(!r||!Array.isArray(r)||0===r.length)return null;const n=[];for(const o of r){if(!Array.isArray(o)||2!==o.length)continue;const e=o[0],t=o[1];"number"==typeof e&&"number"==typeof t&&n.push(new oe(e,t))}if(n.length<3)return null;n.length>1&&n.at(-1).equals(n[0])&&n.pop();let i=0;for(let o=0;o<n.length;o++){const e=n[o],t=n[(o+1)%n.length],r=n[(o+2)%n.length];i+=(e.x-t.x)*(r.y-t.y)-(r.x-t.x)*(e.y-t.y)}i>0&&n.reverse();const s=kc(n.flatMap(e=>[e.x,e.y]),[]);return 0===s.length?null:{vertices:n,indices:s}}function Vx(e,t){const r=[],n=[];let i=0;const s=[];for(const o of e){i=r.length;const e=o.vertexArray.float32,a=o.indexArray.uint16;for(let n=0;n<o.vertexArray.length;n++)s[0]=e[3*n+0],s[1]=e[3*n+1],s[2]=e[3*n+2],k(s,s,t),r.push(new oe(s[0],s[1]));for(let t=0;t<3*o.indexArray.length;t++)n.push(a[t]+i)}if(n.length%3!=0)return null;for(let o=0;o<n.length;o+=3){const e=r[n[o+0]],t=r[n[o+1]],i=r[n[o+2]];(e.x-t.x)*(i.y-t.y)-(i.x-t.x)*(e.y-t.y)>0&&([n[o+1],n[o+2]]=[n[o+2],n[o+1]])}return{vertices:r,indices:n}}function Ex(e){const t=function(e,t){const r=[];for(const n of e.json.meshes){const i=[];for(const r of n.primitives)i.push(Px(r,e,t));r.push(i)}return r}(e,function(e,t){const r=[],n=WebGL2RenderingContext;if(e.json.textures)for(const i of e.json.textures){const s={magFilter:n.LINEAR,minFilter:n.NEAREST,wrapS:n.REPEAT,wrapT:n.REPEAT};void 0!==i.sampler&&Object.assign(s,e.json.samplers[i.sampler]),r.push({image:t[i.source],sampler:s,uploaded:!1})}return r}(e,e.images)),{scenes:r,scene:n,nodes:i}=e.json,s=r?r[n||0].nodes:[...i.keys()],o=[];for(const a of s)o.push(zx(i[a],e,t));return function(e,t,r){const n={},i=/* @__PURE__ */new Set;for(let s=0;s<e.length;s++){const e=r[t[s]];if(!e.extras)continue;const o=e.extras["mapbox:footprint:version"],a=e.extras["mapbox:footprint:id"];(o||a)&&i.add(s),"1.0.0"===o&&a&&(n[a]=s)}for(let s=0;s<e.length;s++){if(i.has(s))continue;const o=e[s],a=r[t[s]];if(!a.extras)continue;let l=null;o.id in n&&(l=Vx(e[n[o.id]].meshes,o.localMatrix)),l||(l=kx(a)),l&&(o.footprint=Tx(l))}if(i.size>0){const t=Array.from(i.values()).sort((e,t)=>e-t);for(let r=t.length-1;r>=0;r--)e.splice(t[r],1)}}(o,s,e.json.nodes),o}function Dx(e,t){const r=Ex(e);for(const n of r){for(const e of n.meshes)Cx(e);n.lights&&(n.lightMeshIndex=n.meshes.length,n.meshes.push(Lx(n.lights,t)))}return r}function Cx(e){e.heightmap=new Float32Array(4096),e.heightmap.fill(-1);const t=e.vertexArray.float32,r=e.aabb.min[0]-1,n=e.aabb.min[1]-1,i=Tg/(e.aabb.max[0]-r+2),s=Tg/(e.aabb.max[1]-n+2);for(let o=0;o<t.length;o+=3){const a=t[o+2],l=(t[o+0]-r)*i|0,u=(t[o+1]-n)*s|0;a>e.heightmap[u*Tg+l]&&(e.heightmap[u*Tg+l]=a)}}function Fx(e,t,r,n,i){r.reserve(r.length+4*e.length),n.reserve(n.length+10*e.length),i.reserve(i.length+10*e.length);let s=n.length;for(const o of e){const e=Math.min(10,Math.max(4,1.3*o.height))*t,a=[-o.normal[1],o.normal[0],0],l=Math.min(.29,.1*o.width/o.depth),u=o.width-2*o.depth*t*(l+.01),c=I([],o.pos,a,u/2),h=I([],o.pos,a,-u/2),p=[c[0],c[1],c[2]+o.height],d=[h[0],h[1],h[2]+o.height],f=I([],o.normal,a,l);_(f,f,e);const m=I([],o.normal,a,-l);_(m,m,e),x(f,c,f),x(m,h,m),c[2]+=.1,h[2]+=.1,n.emplaceBack(f[0],f[1],f[2]),n.emplaceBack(m[0],m[1],m[2]),n.emplaceBack(c[0],c[1],c[2]),n.emplaceBack(h[0],h[1],h[2]),n.emplaceBack(p[0],p[1],p[2]),n.emplaceBack(d[0],d[1],d[2]),n.emplaceBack(c[0],c[1],c[2]),n.emplaceBack(h[0],h[1],h[2]),n.emplaceBack(f[0],f[1],f[2]),n.emplaceBack(m[0],m[1],m[2]);const y=u/e/2;i.emplaceBack(-y-l,-1,y,.8),i.emplaceBack(y+l,-1,y,.8),i.emplaceBack(-y,0,y,1.3),i.emplaceBack(y,0,y,1.3),i.emplaceBack(y+l,-.8,y,.7),i.emplaceBack(y+l,-.8,y,.7),i.emplaceBack(0,0,y,1.3),i.emplaceBack(0,0,y,1.3),i.emplaceBack(y+l,-1.2,y,.8),i.emplaceBack(y+l,-1.2,y,.8),r.emplaceBack(6+s,4+s,8+s),r.emplaceBack(7+s,9+s,5+s),r.emplaceBack(0+s,1+s,2+s),r.emplaceBack(1+s,3+s,2+s),s+=10}}function Lx(e,t){const r={};r.indexArray=new wa,r.vertexArray=new la,r.colorArray=new fa,Fx(e,t,r.indexArray,r.vertexArray,r.colorArray);const n={defined:!0};n.emissiveFactor=Pt.black;const i={};return i.baseColorFactor=Pt.white,n.pbrMetallicRoughness=i,r.material=n,r.aabb=new wu([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),r}class Rx extends _t{constructor(e,t,r,n){super(),this.id=e,this.type="model",this.models=[],this._options=t,this._modelsInfo=/* @__PURE__ */new Map,this._abortController=null}cancelModelRequests(){this._abortController&&(this._abortController.abort(),this._abortController=null)}loadGLTFFromURI(e,t){return async function(e,t){return Sx(await async function(e,t){if(t&&t.aborted)throw new DOMException("Aborted","AbortError");return new Promise((r,n)=>{const i=st(e,(e,t)=>{e?n(e):r(t)});t&&t.addEventListener("abort",()=>{i.cancel(),n(new DOMException("Aborted","AbortError"))},{once:!0})})}({url:e,type:"arrayBuffer"},t),0,e,t)}(this.map._requestManager.transformRequest(e,et.Model).url,t)}async loadModel(e,t,r){try{const n=await this.loadGLTFFromURI(t.uri,r);if(r.aborted)return;const i=this._modelsInfo.get(e);if(!i)return;const s=Ex(n),o=i.modelSpec,a=new Cg(e,o.uri,o.position,o.orientation,s);Rx.applyModelSpecification(a,o),a.computeBoundsAndApplyParent(),this.models.push(a),i.model=a}catch(n){if(n instanceof Error&&"AbortError"===n.name)return;const r=n instanceof Error?n.message:"Unknown error";this.fire(new vt(new Error(`Could not load model ${e} from ${t.uri}: ${r}`)))}}async load(){this._abortController||(this._abortController=new AbortController);const e=this._abortController.signal,t=[];for(const r in this._options.models){const n=this._options.models[r],i=this._modelsInfo.get(r);if(i&&i.model){i.modelSpec=n;const e=i.model;e.position=null!=n.position?new Vl(n.position[0],n.position[1]):new Vl(0,0),e.orientation=null!=n.orientation?n.orientation:[0,0,0],Rx.applyModelSpecification(e,n),e.computeBoundsAndApplyParent(),this.models.push(e)}else i?i.modelSpec=n:(this._modelsInfo.set(r,{modelSpec:n,model:null}),t.push(this.loadModel(r,n,e)))}0!==t.length?(await Promise.allSettled(t),e.aborted||this.fire(new xt("data",{dataType:"source",sourceDataType:"metadata"}))):this.loaded()&&this.fire(new xt("data",{dataType:"source",sourceDataType:"metadata"}))}static applyModelSpecification(e,t){t.nodeOverrides&&Rx.convertNodeOverrides(e,t.nodeOverrides),t.materialOverrides&&Rx.convertMaterialOverrides(e,t.materialOverrides),t.nodeOverrideNames&&(e.nodeOverrideNames=[...t.nodeOverrideNames]),t.materialOverrideNames&&(e.materialOverrideNames=[...t.materialOverrideNames]),t.featureProperties&&(e.featureProperties=t.featureProperties)}static convertNodeOverrides(e,t){if(Array.isArray(t)&&t.every(e=>"string"==typeof e)){e.nodeOverrideNames=[];for(const r of t)e.nodeOverrideNames.push(r)}else Object.entries(t).forEach(([t,r])=>{const n={orientation:[0,0,0]};if(Object.hasOwn(r,"orientation")){const e=r.orientation;e&&(n.orientation=e)}e.nodeOverrides.set(t,n)})}static convertMaterialOverrides(e,t){if(Array.isArray(t)&&t.every(e=>"string"==typeof e)){e.materialOverrideNames=[];for(const r of t)e.materialOverrideNames.push(r)}else Object.entries(t).forEach(([t,r])=>{const n={color:new Pt(1,1,1),colorMix:0,emissionStrength:0,opacity:1},i=r["model-color"];void 0!==i&&(n.color.r=i[0],n.color.g=i[1],n.color.b=i[2]);const s=r["model-color-mix-intensity"];void 0!==s&&(n.colorMix=s);const o=r["model-emissive-strength"];void 0!==o&&(n.emissionStrength=o);const a=r["model-opacity"];void 0!==a&&(n.opacity=a),e.materialOverrides.set(t,n)})}onAdd(e){this.map=e,this.load()}hasTransition(){return!1}loaded(){if(0===this._modelsInfo.size)return!0;for(const e of this._modelsInfo.values())if(null==e.model)return!1;return!0}getModels(){return this.models}loadTile(e,t){}serialize(){return this._options}setProperty(e,t){return!1}reload(){this.cancelModelRequests();const e=Lo(this.id,this.scope);this.map.style.clearSource(e),this.models=[],this._modelsInfo.clear(),this.load()}onRemove(e){this.cancelModelRequests()}setModels(e){this.models=[];const t=/* @__PURE__ */new Map;for(const r in e){const n=e[r],i=this._modelsInfo.get(r);i&&i.modelSpec.uri===n.uri&&t.set(r,i)}if(this._modelsInfo.size!==t.size){this.cancelModelRequests();for(const[e,r]of t)r.model||t.delete(e)}this._modelsInfo=t,this._options.models=e,this.load()}}function Ox(e,t,r,n){const i=1<<e.z;t.lat=Ol((n/tn+e.y)/i),t.lng=Rl((r/tn+e.x)/i)}function Ux(e,t,r,n){const i=e.getNodesInfo()[t];if(!i||i.hiddenByReplacement||!i.node.meshes)return;let s=Number.MAX_VALUE;const o=i.node,c=r.tile,h=n.calculatePosMatrix(c.tileID.toUnwrapped(),n.worldSize),p=i.evaluatedScale;let d=0;n.elevation&&o.elevation&&(d=o.elevation*n.elevation.exaggeration()),l(h,h,[(o.anchor?o.anchor[0]:0)*(p[0]-1),(o.anchor?o.anchor[1]:0)*(p[1]-1),d]),u(h,h,p);const f=r.queryGeometry,m=f.isPointQuery()?f.screenBounds:f.screenGeometry,y=function(e){const t=a([],h,e.globalMatrix);a(t,n.expandedFarZProjMatrix,t);for(let r=0;r<e.meshes.length;++r){const i=e.meshes[r];if(r===e.lightMeshIndex)continue;const o=gg(m,n,t,i.aabb);null!=o&&(s=Math.min(o,s))}if(e.children)for(const r of e.children)y(r)};if(y(o),s===Number.MAX_VALUE)return;const g=new Vl(0,0);return Ox(c.tileID.canonical,g,i.node.anchor[0],i.node.anchor[1]),{intersectionZ:s,position:g,feature:i.feature}}const Nx={circle:class extends qo{constructor(e,t,r,n){super(e,{layout:Hu||(Hu=new wo({"circle-sort-key":new vo(_o.layout_circle["circle-sort-key"]),"circle-elevation-reference":new xo(_o.layout_circle["circle-elevation-reference"]),visibility:new xo(_o.layout_circle.visibility)})),paint:Zu||(Zu=new wo({"circle-radius":new vo(_o.paint_circle["circle-radius"]),"circle-color":new vo(_o.paint_circle["circle-color"]),"circle-blur":new vo(_o.paint_circle["circle-blur"]),"circle-opacity":new vo(_o.paint_circle["circle-opacity"]),"circle-translate":new xo(_o.paint_circle["circle-translate"]),"circle-translate-anchor":new xo(_o.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new xo(_o.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new xo(_o.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new vo(_o.paint_circle["circle-stroke-width"]),"circle-stroke-color":new vo(_o.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new vo(_o.paint_circle["circle-stroke-opacity"]),"circle-emissive-strength":new xo(_o.paint_circle["circle-emissive-strength"]),"circle-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"}),"circle-stroke-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"})}))},t,r,n)}createBucket(e){return new Bu(e)}queryRadius(e){const t=e;return $u("circle-radius",this,t)+$u("circle-stroke-width",this,t)+Gu(this.paint.get("circle-translate"))}queryIntersectsFeature(e,t,r,n,i,s,o,a){const l=qu(this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),s.angle,e.pixelToTileUnitsFactor),u=this.paint.get("circle-radius").evaluate(t,r)+this.paint.get("circle-stroke-width").evaluate(t,r);return cc(e,n,s,o,a,"map"===this.paint.get("circle-pitch-alignment"),"map"===this.paint.get("circle-pitch-scale"),l,u)}getProgramIds(){return["circle"]}getDefaultProgramParams(e,t,r){const n=(e=>{const t=[];return"map"===e.paint.get("circle-pitch-alignment")&&t.push("PITCH_WITH_MAP"),"map"===e.paint.get("circle-pitch-scale")&&t.push("SCALE_WITH_MAP"),t})(this);return{config:new xl(this,{zoom:t,lut:r}),defines:n,overrideFog:!1}}is3D(e){return!e&&!!this.layout&&"none"!==this.layout.get("circle-elevation-reference")}hasElevation(){return this.layout&&"none"!==this.layout.get("circle-elevation-reference")}},heatmap:class extends qo{createBucket(e){return new mc(e)}constructor(e,t,r,n){super(e,{layout:yc||(yc=new wo({visibility:new xo(_o.layout_heatmap.visibility)})),paint:gc||(gc=new wo({"heatmap-radius":new vo(_o.paint_heatmap["heatmap-radius"]),"heatmap-weight":new vo(_o.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new xo(_o.paint_heatmap["heatmap-intensity"]),"heatmap-color":new bo(_o.paint_heatmap["heatmap-color"]),"heatmap-opacity":new xo(_o.paint_heatmap["heatmap-opacity"]),"heatmap-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"})}))},t,r,n),this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(e){"heatmap-color"===e&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Mc({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)}_clear(){this.heatmapFbo&&(this.heatmapFbo.destroy(),this.heatmapFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}queryRadius(e){return $u("heatmap-radius",this,e)}queryIntersectsFeature(e,t,r,n,i,s,o,a){const l=this.paint.get("heatmap-radius").evaluate(t,r);return cc(e,n,s,o,a,!0,!0,new oe(0,0),l)}hasOffscreenPass(){return 0!==this.paint.get("heatmap-opacity")&&"none"!==this.visibility}getProgramIds(){return["heatmap","heatmapTexture"]}getDefaultProgramParams(e,t,r){return"heatmap"===e?{config:new xl(this,{zoom:t,lut:r}),overrideFog:!1}:{}}},hillshade:class extends qo{constructor(e,t,r,n){super(e,{layout:xc||(xc=new wo({visibility:new xo(_o.layout_hillshade.visibility)})),paint:vc||(vc=new wo({"hillshade-illumination-direction":new xo(_o.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new xo(_o.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new xo(_o.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new xo(_o.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new xo(_o.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new xo(_o.paint_hillshade["hillshade-accent-color"]),"hillshade-emissive-strength":new xo(_o.paint_hillshade["hillshade-emissive-strength"]),"hillshade-shadow-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"}),"hillshade-highlight-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"}),"hillshade-accent-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"})}))},t,r,n)}shouldRedrape(){return this.hasOffscreenPass()&&"viewport"===this.paint.get("hillshade-illumination-anchor")}hasOffscreenPass(){return 0!==this.paint.get("hillshade-exaggeration")&&"none"!==this.visibility}getProgramIds(){return["hillshade","hillshadePrepare"]}getDefaultProgramParams(e,t,r){return{overrideFog:!1}}},fill:class extends qo{constructor(e,t,r,n){super(e,{layout:Kh||(Kh=new wo({"fill-sort-key":new vo(_o.layout_fill["fill-sort-key"]),visibility:new xo(_o.layout_fill.visibility),"fill-elevation-reference":new xo(_o.layout_fill["fill-elevation-reference"]),"fill-construct-bridge-guard-rail":new vo(_o.layout_fill["fill-construct-bridge-guard-rail"])})),paint:Qh||(Qh=new wo({"fill-antialias":new xo(_o.paint_fill["fill-antialias"]),"fill-opacity":new vo(_o.paint_fill["fill-opacity"]),"fill-color":new vo(_o.paint_fill["fill-color"]),"fill-outline-color":new vo(_o.paint_fill["fill-outline-color"]),"fill-translate":new xo(_o.paint_fill["fill-translate"]),"fill-translate-anchor":new xo(_o.paint_fill["fill-translate-anchor"]),"fill-pattern":new vo(_o.paint_fill["fill-pattern"]),"fill-pattern-cross-fade":new xo(_o.paint_fill["fill-pattern-cross-fade"]),"fill-emissive-strength":new xo(_o.paint_fill["fill-emissive-strength"]),"fill-z-offset":new vo(_o.paint_fill["fill-z-offset"]),"fill-bridge-guard-rail-color":new vo(_o.paint_fill["fill-bridge-guard-rail-color"]),"fill-tunnel-structure-color":new vo(_o.paint_fill["fill-tunnel-structure-color"]),"fill-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"}),"fill-outline-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"}),"fill-bridge-guard-rail-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"}),"fill-tunnel-structure-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"})}))},t,r,n)}getProgramIds(){const e=this.paint.get("fill-pattern"),t=e&&e.constantOr(1),r=[t?"fillPattern":"fill"];return this.paint.get("fill-antialias")&&r.push(t&&!this.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline"),r}getDefaultProgramParams(e,t,r){return{config:new xl(this,{zoom:t,lut:r}),overrideFog:!1}}recalculate(e,t){super.recalculate(e,t);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(e){return new Jh(e)}queryRadius(){return Gu(this.paint.get("fill-translate"))}queryIntersectsFeature(e,t,r,n,i,s){return!e.queryGeometry.isAboveHorizon&&Tu(Xu(e.tilespaceGeometry,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),s.angle,e.pixelToTileUnitsFactor),n)}isTileClipped(){return 0===this.paint.get("fill-z-offset").constantOr(1)}is3D(e){if(0!==this.paint.get("fill-z-offset").constantOr(1))return!0;const t=this.layout&&"none"!==this.layout.get("fill-elevation-reference");return null!=e?t&&!e:t}hasElevation(){return this.layout&&"none"!==this.layout.get("fill-elevation-reference")}hasShadowPass(){return this.layout&&"none"!==this.layout.get("fill-elevation-reference")}},"fill-extrusion":class extends qo{constructor(e,t,r,n){super(e,{layout:nd||(nd=new wo({visibility:new xo(_o["layout_fill-extrusion"].visibility),"fill-extrusion-edge-radius":new xo(_o["layout_fill-extrusion"]["fill-extrusion-edge-radius"]),"source-max-zoom":new xo(_o["layout_fill-extrusion"]["source-max-zoom"])})),paint:id||(id=new wo({"fill-extrusion-opacity":new xo(_o["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new vo(_o["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new xo(_o["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new xo(_o["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new vo(_o["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-pattern-cross-fade":new xo(_o["paint_fill-extrusion"]["fill-extrusion-pattern-cross-fade"]),"fill-extrusion-height":new vo(_o["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new vo(_o["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-height-alignment":new xo(_o["paint_fill-extrusion"]["fill-extrusion-height-alignment"]),"fill-extrusion-base-alignment":new xo(_o["paint_fill-extrusion"]["fill-extrusion-base-alignment"]),"fill-extrusion-vertical-gradient":new xo(_o["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"]),"fill-extrusion-ambient-occlusion-intensity":new xo(_o["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-intensity"]),"fill-extrusion-ambient-occlusion-radius":new xo(_o["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-radius"]),"fill-extrusion-ambient-occlusion-wall-radius":new xo(_o["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-wall-radius"]),"fill-extrusion-ambient-occlusion-ground-radius":new xo(_o["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-radius"]),"fill-extrusion-ambient-occlusion-ground-attenuation":new xo(_o["paint_fill-extrusion"]["fill-extrusion-ambient-occlusion-ground-attenuation"]),"fill-extrusion-flood-light-color":new xo(_o["paint_fill-extrusion"]["fill-extrusion-flood-light-color"]),"fill-extrusion-flood-light-intensity":new xo(_o["paint_fill-extrusion"]["fill-extrusion-flood-light-intensity"]),"fill-extrusion-flood-light-wall-radius":new vo(_o["paint_fill-extrusion"]["fill-extrusion-flood-light-wall-radius"]),"fill-extrusion-flood-light-ground-radius":new vo(_o["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-radius"]),"fill-extrusion-flood-light-ground-attenuation":new xo(_o["paint_fill-extrusion"]["fill-extrusion-flood-light-ground-attenuation"]),"fill-extrusion-vertical-scale":new xo(_o["paint_fill-extrusion"]["fill-extrusion-vertical-scale"]),"fill-extrusion-rounded-roof":new xo(_o["paint_fill-extrusion"]["fill-extrusion-rounded-roof"]),"fill-extrusion-cutoff-fade-range":new xo(_o["paint_fill-extrusion"]["fill-extrusion-cutoff-fade-range"]),"fill-extrusion-front-cutoff":new xo(_o["paint_fill-extrusion"]["fill-extrusion-front-cutoff"]),"fill-extrusion-emissive-strength":new vo(_o["paint_fill-extrusion"]["fill-extrusion-emissive-strength"]),"fill-extrusion-line-width":new vo(_o["paint_fill-extrusion"]["fill-extrusion-line-width"]),"fill-extrusion-cast-shadows":new xo(_o["paint_fill-extrusion"]["fill-extrusion-cast-shadows"]),"fill-extrusion-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"}),"fill-extrusion-flood-light-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"})}))},t,r,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new qp(e)}queryRadius(){return Gu(this.paint.get("fill-extrusion-translate"))}is3D(e){return!0}hasShadowPass(){return this.paint.get("fill-extrusion-cast-shadows")}cutoffRange(){return this.paint.get("fill-extrusion-cutoff-fade-range")}canCastShadows(){return!0}getProgramIds(){return[this.paint.get("fill-extrusion-pattern").constantOr(1)?"fillExtrusionPattern":"fillExtrusion"]}queryIntersectsFeature(e,t,r,n,i,s,o,a,l){const u=qu(this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),s.angle,e.pixelToTileUnitsFactor),c=this.paint.get("fill-extrusion-height").evaluate(t,r),h=this.paint.get("fill-extrusion-base").evaluate(t,r),p=[0,0],d=a&&s.elevation,f=s.elevation?s.elevation.exaggeration():1,m=e.tile.getBucket(this);if(m instanceof qp){const e=m.centroidData.find(e=>l>=e.vertexArrayOffset&&l<e.vertexArrayOffset+e.vertexCount);if(e&&e.flags&Vp)return!1;if(d){const e=m.centroidVertexArray,t=l+1;t<e.length&&(p[0]=e.geta_centroid_pos0(t),p[1]=e.geta_centroid_pos1(t))}}if(0===p[0]&&1===p[1])return!1;"globe"===s.projection.name&&(n=td([n],[new oe(0,0),new oe(tn,tn)],e.tileID.canonical).map(e=>e.polygon).flat());const y=d?a:null,[g,x]=md(s,n,h,c,u,o,y,p,f,s.center.lat,e.tileID.canonical),v=e.queryGeometry;return fd(g,x,v.isPointQuery()?v.screenBounds:v.screenGeometry)}},building:class extends qo{constructor(e,t,r,n){super(e,{layout:vd||(vd=new wo({visibility:new xo(_o.layout_building.visibility),"building-facade":new vo(_o.layout_building["building-facade"]),"building-facade-floors":new vo(_o.layout_building["building-facade-floors"]),"building-facade-unit-width":new vo(_o.layout_building["building-facade-unit-width"]),"building-facade-window":new vo(_o.layout_building["building-facade-window"]),"building-roof-shape":new vo(_o.layout_building["building-roof-shape"]),"building-height":new vo(_o.layout_building["building-height"]),"building-base":new vo(_o.layout_building["building-base"]),"building-flood-light-wall-radius":new vo(_o.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new vo(_o.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new vo(_o.layout_building["building-flip-roof-orientation"])})),paint:bd||(bd=new wo({"building-opacity":new xo(_o.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new xo(_o.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new xo(_o.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new xo(_o.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new xo(_o.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new xo(_o.paint_building["building-vertical-scale"]),"building-cast-shadows":new xo(_o.paint_building["building-cast-shadows"]),"building-color":new vo(_o.paint_building["building-color"]),"building-emissive-strength":new vo(_o.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new xo(_o.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new xo(_o.paint_building["building-cutoff-fade-range"]),"building-front-cutoff":new xo(_o.paint_building["building-front-cutoff"]),"building-flood-light-color":new xo(_o.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new xo(_o.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new xo(_o.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"})}))},t,r,n),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}prepare(){return async function(){try{const e=await import("./hd.worker-DveeQM1R.js");await e.waitForBuildingGen(),wd=e.BuildingBucket}catch(C){be("Could not load HD module.")}}()}createBucket(e){return new wd(e)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(e){return!0}queryRadius(e){return 0}queryIntersectsFeature(e,t,r,n,i,s,o,a,l,u){let c=this.layout.get("building-height").evaluate(t,r);const h=this.layout.get("building-base").evaluate(t,r),p=e.tile.getBucket(this).getFootprint(t);if(p){if(0!==p.hiddenFlags)return!1;c=p.height}const[d,f]=md(s,n,h,c,new oe(0,0),o,null,[0,0],1,s.center.lat,e.tileID.canonical),m=e.queryGeometry;return fd(d,f,m.isPointQuery()?m.screenBounds:m.screenGeometry)}},line:class extends qo{constructor(e,t,r,n){const i=Ud();super(e,i,t,r,n),i.layout&&(this.layout=new go(i.layout)),this.gradientVersion=0,this.hasElevatedBuckets=!1,this.hasNonElevatedBuckets=!1}_handleSpecialPaintPropertyUpdate(e){if("line-gradient"===e){const e=this._transitionablePaint._values["line-gradient"].value.expression;this.stepInterpolant=e._styleExpression&&e._styleExpression.expression instanceof jn,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}widthExpression(){return this._transitionablePaint._values["line-width"].value.expression}emissiveStrengthExpression(){return this._transitionablePaint._values["line-emissive-strength"].value.expression}recalculate(e,t){super.recalculate(e,t),this.paint._values["line-floorwidth"]=(()=>{if(jd)return jd;const e=Ud();return jd=new Nd(e.paint.properties["line-width"].specification),jd.useIntegerZoom=!0,jd})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,e)}createBucket(e){return new Cd(e)}getProgramIds(){const e=[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"];return"default"!==this.paint.get("line-blend-mode")&&e.push("lineBlendComposite"),e}getDefaultProgramParams(e,t,r){if("lineBlendComposite"===e)return{};const n=(e=>{const t=[];(function(e){const t=e.paint.get("line-dasharray").value;return"constant"!==t.kind||t.value})(e)&&t.push("RENDER_LINE_DASH"),e.paint.get("line-gradient")&&t.push("RENDER_LINE_GRADIENT"),"multiply"===e.paint.get("line-blend-mode")&&t.push("LINE_BLEND_MULTIPLY");const r=e.paint.get("line-trim-offset");0===r[0]&&0===r[1]||t.push("RENDER_LINE_TRIM_OFFSET"),0!==e.paint.get("line-border-width").constantOr(1)&&t.push("RENDER_LINE_BORDER");const n="none"===e.layout.get("line-join").constantOr("miter"),i=!!e.paint.get("line-pattern").constantOr(1);return n&&i&&t.push("LINE_JOIN_NONE"),t})(this);return{config:new xl(this,{zoom:t,lut:r}),defines:n,overrideFog:!1}}queryRadius(e){const t=e,r=$d($u("line-width",this,t),$u("line-gap-width",this,t)),n=$u("line-offset",this,t);return r/2+Math.abs(n)+Gu(this.paint.get("line-translate"))}queryIntersectsFeature(e,t,r,n,i,s){if(e.queryGeometry.isAboveHorizon)return!1;const o=Xu(e.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),s.angle,e.pixelToTileUnitsFactor),a=e.pixelToTileUnitsFactor/2*$d(this.paint.get("line-width").evaluate(t,r),this.paint.get("line-gap-width").evaluate(t,r)),l=this.paint.get("line-offset").evaluate(t,r);return l&&(n=function(e,t){const r=[],n=new oe(0,0);for(let i=0;i<e.length;i++){const s=e[i],o=[];for(let e=0;e<s.length;e++){const r=s[e],i=s[e+1],a=0===e?n:r.sub(s[e-1])._unit()._perp(),l=e===s.length-1?n:i.sub(r)._unit()._perp(),u=a._add(l)._unit();u._mult(1/(u.x*l.x+u.y*l.y)),o.push(u._mult(t)._add(r))}r.push(o)}return r}(n,l*e.pixelToTileUnitsFactor)),function(e,t,r){for(let n=0;n<t.length;n++){const i=t[n];if(e.length>=3)for(let t=0;t<i.length;t++)if(Ou(e,i[t]))return!0;if(ku(e,i,r))return!0}return!1}(o,n,a)}isTileClipped(){return this.hasNonElevatedBuckets}isDraped(e){return!this.hasElevatedBuckets||this.layout&&"hd-road-markup"===this.layout.get("line-elevation-reference")}hasElevation(){return this.layout&&"none"!==this.layout.get("line-elevation-reference")}hasOffscreenPass(){return"default"!==this.paint.get("line-blend-mode")&&0!==this.paint.get("line-opacity").constantOr(1)&&0!==this.paint.get("line-width").constantOr(1)&&"none"!==this.visibility}resize(){this._destroyLineBlendFbo()}_clear(){this._destroyLineBlendFbo()}_destroyLineBlendFbo(){this.lineBlendFbo&&(this.lineBlendFbo.destroy(),this.lineBlendFbo=null),this.lineBlendStencil=null,this.lineBlendDrapeFbo&&(this.lineBlendDrapeFbo.destroy(),this.lineBlendDrapeFbo=null),this.lineBlendDrapeStencil=null}},symbol:Wy,background:class extends qo{constructor(e,t,r,n){super(e,{layout:Jy||(Jy=new wo({visibility:new xo(_o.layout_background.visibility)})),paint:Ky||(Ky=new wo({"background-pitch-alignment":new xo(_o.paint_background["background-pitch-alignment"]),"background-color":new xo(_o.paint_background["background-color"]),"background-pattern":new xo(_o.paint_background["background-pattern"]),"background-opacity":new xo(_o.paint_background["background-opacity"]),"background-emissive-strength":new xo(_o.paint_background["background-emissive-strength"]),"background-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"})}))},t,r,n)}getProgramIds(){return[this.paint.get("background-pattern")?"backgroundPattern":"background"]}getDefaultProgramParams(e,t,r){return{overrideFog:!1}}is3D(e){return"viewport"===this.paint.get("background-pitch-alignment")}},raster:class extends qo{constructor(e,t,r,n){super(e,{layout:Qy||(Qy=new wo({visibility:new xo(_o.layout_raster.visibility)})),paint:eg||(eg=new wo({"raster-opacity":new xo(_o.paint_raster["raster-opacity"]),"raster-color":new bo(_o.paint_raster["raster-color"]),"raster-color-mix":new xo(_o.paint_raster["raster-color-mix"]),"raster-color-range":new xo(_o.paint_raster["raster-color-range"]),"raster-hue-rotate":new xo(_o.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new xo(_o.paint_raster["raster-brightness-min"]),"raster-brightness-max":new xo(_o.paint_raster["raster-brightness-max"]),"raster-saturation":new xo(_o.paint_raster["raster-saturation"]),"raster-contrast":new xo(_o.paint_raster["raster-contrast"]),"raster-resampling":new xo(_o.paint_raster["raster-resampling"]),"raster-fade-duration":new xo(_o.paint_raster["raster-fade-duration"]),"raster-emissive-strength":new xo(_o.paint_raster["raster-emissive-strength"]),"raster-array-band":new xo(_o.paint_raster["raster-array-band"]),"raster-elevation":new xo(_o.paint_raster["raster-elevation"]),"raster-elevation-reference":new xo(_o.paint_raster["raster-elevation-reference"]),"raster-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"})}))},t,r,n),this.updateColorRamp(),this._curRampRange=[NaN,NaN]}getProgramIds(){return["raster"]}hasColorMap(){return!!this._transitionablePaint._values["raster-color"].value.value}tileCoverLift(){return this.paint.get("raster-elevation")}isDraped(e){return!(e&&e._source instanceof sg&&(e._source.onNorthPole||e._source.onSouthPole))&&0===this.paint.get("raster-elevation")}_handleSpecialPaintPropertyUpdate(e){"raster-color"!==e&&"raster-color-range"!==e||(this._curRampRange=[NaN,NaN],this.updateColorRamp())}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}updateColorRamp(e){if(!this.hasColorMap())return;if(!this._curRampRange)return;const t=this._transitionablePaint._values["raster-color"].value.expression,[r,n]=e||this._transitionablePaint._values["raster-color-range"].value.expression.evaluate({zoom:0})||[NaN,NaN];isNaN(r)&&isNaN(n)||r===this._curRampRange[0]&&n===this._curRampRange[1]||(this.colorRamp=Mc({expression:t,evaluationKey:"rasterValue",image:this.colorRamp,clips:[{start:r,end:n}],resolution:1024}),this.colorRampTexture=null,this._curRampRange=[r,n])}is3D(e){return this.paint.get("raster-elevation")>0}},"raster-particle":class extends qo{constructor(e,t,r,n){super(e,{layout:og||(og=new wo({visibility:new xo(_o["layout_raster-particle"].visibility)})),paint:ag||(ag=new wo({"raster-particle-array-band":new xo(_o["paint_raster-particle"]["raster-particle-array-band"]),"raster-particle-count":new xo(_o["paint_raster-particle"]["raster-particle-count"]),"raster-particle-color":new bo(_o["paint_raster-particle"]["raster-particle-color"]),"raster-particle-max-speed":new xo(_o["paint_raster-particle"]["raster-particle-max-speed"]),"raster-particle-speed-factor":new xo(_o["paint_raster-particle"]["raster-particle-speed-factor"]),"raster-particle-fade-opacity-factor":new xo(_o["paint_raster-particle"]["raster-particle-fade-opacity-factor"]),"raster-particle-reset-rate-factor":new xo(_o["paint_raster-particle"]["raster-particle-reset-rate-factor"]),"raster-particle-elevation":new xo(_o["paint_raster-particle"]["raster-particle-elevation"]),"raster-particle-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"})}))},t,r,n),this._updateColorRamp(),this.lastInvalidatedAt=Ne.now()}_clear(){this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this.tileFramebuffer&&(this.tileFramebuffer.destroy(),this.tileFramebuffer=null),this.particleFramebuffer&&(this.particleFramebuffer.destroy(),this.particleFramebuffer=null)}onRemove(e){this.colorRampTexture&&this.colorRampTexture.destroy(),this.tileFramebuffer&&this.tileFramebuffer.destroy(),this.particleFramebuffer&&this.particleFramebuffer.destroy()}hasColorMap(){return!!this._transitionablePaint._values["raster-particle-color"].value.value}getProgramIds(){return["rasterParticle"]}hasOffscreenPass(){return"none"!==this.visibility}isDraped(e){return!1}_handleSpecialPaintPropertyUpdate(e){"raster-particle-color"!==e&&"raster-particle-max-speed"!==e||(this._updateColorRamp(),this._invalidateAnimationState()),"raster-particle-count"===e&&this._invalidateAnimationState()}_updateColorRamp(){if(!this.hasColorMap())return;const e=this._transitionablePaint._values["raster-particle-color"].value.expression,t=this._transitionablePaint._values["raster-particle-max-speed"].value.expression.evaluate({zoom:0});this.colorRamp=Mc({expression:e,evaluationKey:"rasterParticleSpeed",image:this.colorRamp,clips:[{start:0,end:t}],resolution:256}),this.colorRampTexture=null}_invalidateAnimationState(){this.lastInvalidatedAt=Ne.now()}tileCoverLift(){return this.paint.get("raster-particle-elevation")}},sky:class extends qo{constructor(e,t,r,n){super(e,{layout:lg||(lg=new wo({visibility:new xo(_o.layout_sky.visibility)})),paint:ug||(ug=new wo({"sky-type":new xo(_o.paint_sky["sky-type"]),"sky-atmosphere-sun":new xo(_o.paint_sky["sky-atmosphere-sun"]),"sky-atmosphere-sun-intensity":new xo(_o.paint_sky["sky-atmosphere-sun-intensity"]),"sky-gradient-center":new xo(_o.paint_sky["sky-gradient-center"]),"sky-gradient-radius":new xo(_o.paint_sky["sky-gradient-radius"]),"sky-gradient":new bo(_o.paint_sky["sky-gradient"]),"sky-atmosphere-halo-color":new xo(_o.paint_sky["sky-atmosphere-halo-color"]),"sky-atmosphere-color":new xo(_o.paint_sky["sky-atmosphere-color"]),"sky-opacity":new xo(_o.paint_sky["sky-opacity"]),"sky-gradient-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-halo-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"}),"sky-atmosphere-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"})}))},t,r,n),this._updateColorRamp()}_clear(){this.skyboxFbo&&(this.skyboxFbo.destroy(),this.skyboxFbo=null),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null),this._skyboxInvalidated=!0}_handleSpecialPaintPropertyUpdate(e){"sky-gradient"===e?this._updateColorRamp():"sky-atmosphere-sun"!==e&&"sky-atmosphere-halo-color"!==e&&"sky-atmosphere-color"!==e&&"sky-atmosphere-sun-intensity"!==e||(this._skyboxInvalidated=!0)}_updateColorRamp(){this.colorRamp=Mc({expression:this._transitionablePaint._values["sky-gradient"].value.expression,evaluationKey:"skyRadialProgress"}),this.colorRampTexture&&(this.colorRampTexture.destroy(),this.colorRampTexture=null)}needsSkyboxCapture(e){if(this._skyboxInvalidated||!this.skyboxTexture||!this.skyboxGeometry)return!0;if(!this.paint.get("sky-atmosphere-sun")){const t=e.style.light.properties.get("position");return this._lightPosition.azimuthal!==t.azimuthal||this._lightPosition.polar!==t.polar}return!1}getCenter(e,t){if("atmosphere"===this.paint.get("sky-type")){const r=this.paint.get("sky-atmosphere-sun"),n=!r,i=e.style.light,s=i.properties.get("position");return n&&"viewport"===i.properties.get("anchor")&&be("The sun direction is attached to a light with viewport anchor, lighting may behave unexpectedly."),n?pg(s.azimuthal,90-s.polar,t):pg(r[0],90-r[1],t)}const r=this.paint.get("sky-gradient-center");return pg(r[0],90-r[1],t)}isSky(){return!0}markSkyboxValid(e){this._skyboxInvalidated=!1,this._lightPosition=e.style.light.properties.get("position")}hasOffscreenPass(){return!0}getProgramIds(){const e=this.paint.get("sky-type");return"atmosphere"===e?["skyboxCapture","skybox"]:"gradient"===e?["skyboxGradient"]:null}},slot:class extends qo{constructor(e,t,r,n){super(e,{paint:cg||(cg=new wo({}))},t,null)}},model:class extends qo{constructor(e,t,r,n){super(e,{layout:Pg||(Pg=new wo({visibility:new xo(_o.layout_model.visibility),"model-id":new vo(_o.layout_model["model-id"]),"model-allow-density-reduction":new xo(_o.layout_model["model-allow-density-reduction"])})),paint:zg||(zg=new wo({"model-opacity":new vo(_o.paint_model["model-opacity"]),"model-rotation":new vo(_o.paint_model["model-rotation"]),"model-scale":new vo(_o.paint_model["model-scale"]),"model-translation":new vo(_o.paint_model["model-translation"]),"model-color":new vo(_o.paint_model["model-color"]),"model-color-mix-intensity":new vo(_o.paint_model["model-color-mix-intensity"]),"model-type":new xo(_o.paint_model["model-type"]),"model-cast-shadows":new xo(_o.paint_model["model-cast-shadows"]),"model-receive-shadows":new xo(_o.paint_model["model-receive-shadows"]),"model-ambient-occlusion-intensity":new xo(_o.paint_model["model-ambient-occlusion-intensity"]),"model-emissive-strength":new vo(_o.paint_model["model-emissive-strength"]),"model-roughness":new vo(_o.paint_model["model-roughness"]),"model-height-based-emissive-strength-multiplier":new vo(_o.paint_model["model-height-based-emissive-strength-multiplier"]),"model-cutoff-fade-range":new xo(_o.paint_model["model-cutoff-fade-range"]),"model-front-cutoff":new xo(_o.paint_model["model-front-cutoff"]),"model-elevation-reference":new xo(_o.paint_model["model-elevation-reference"]),"model-ignore-line-cutout":new xo(_o.paint_model["model-ignore-line-cutout"]),"model-color-use-theme":new vo({type:"string",default:"default","property-type":"data-driven"})}))},t,r,n),this.layer=e,this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(e){return new Bg(e)}getProgramIds(){return["model"]}is3D(e){return!0}hasShadowPass(){return!0}canCastShadows(){return!0}hasLightBeamPass(){return!0}cutoffRange(){return this.paint.get("model-cutoff-fade-range")}queryRadius(e){return e instanceof Yg?8191:0}queryRenderedFeatures(e,t,r){const n=t.getSource();if(!(n&&n instanceof Rx))return{};const i=n,s={};s[this.id]=[];const o=s[this.id];let l=0;for(const u of i.models){const n=t.getFeatureState(this.sourceLayer,u.id),i={type:"Unknown",id:u.id,properties:u.featureProperties},s=this.paint.get("model-rotation").evaluate(i,n),c=this.paint.get("model-scale").evaluate(i,n),h=this.paint.get("model-translation").evaluate(i,n),p=this.paint.get("model-elevation-reference");let d=[];Dg(d,u,r,u.position,s,c,h,"ground"===p,"ground"===p,!1),"globe"===r.projection.name&&(d=yg(d,r));const f=a([],r.projMatrix,d),m=gg(e.isPointQuery()?e.screenBounds:e.screenGeometry,r,f,u.aabb);if(null!=m){const e=new ex(void 0,0,0,0,u.id);e.layer=this.layer,e.properties=structuredClone(u.featureProperties),e.properties.layer=this.id,e.properties.uri=u.uri,e.properties.orientation=u.orientation,e.sourceLayer=this.sourceLayer,e.geometry={type:"Point",coordinates:[u.position.lng,u.position.lat]},e.state=n,e.source=this.source,o.push({featureIndex:l,feature:e,intersectionZ:m})}++l}return s}queryIntersectsFeature(e,t,r,n,i,s,o,l,u,c){if(!this.modelManager)return!1;const h=this.modelManager,p=e.tile.getBucket(this);if(!(p&&p instanceof Bg))return!1;for(const d in p.instancesPerModel){const r=p.instancesPerModel[d],n=void 0!==t.id?t.id:t.properties&&Object.hasOwn(t.properties,"id")?t.properties.id:void 0;if(Object.hasOwn(r.idToFeaturesIndex,n)){const t=r.features[r.idToFeaturesIndex[n]],i=h.getModel(d,c||this.scope);if(!i)return!1;let o=[];const l=new Vl(0,0),u=p.canonical;let f=Number.MAX_VALUE;for(let n=0;n<t.instancedDataCount;++n){const c=16*(t.instancedDataOffset+n),h=r.instancedDataArray.float32,p=[h[c+4],h[c+5],h[c+6]];Ox(u,l,Math.floor(h[c]),Math.floor(h[c+1])),Dg(o,i,s,l,t.rotation,t.scale,p,!1,!1,!1),"globe"===s.projection.name&&(o=yg(o,s));const d=a([],s.projMatrix,o),m=e.queryGeometry,y=gg(m.isPointQuery()?m.screenBounds:m.screenGeometry,s,d,i.aabb);null!=y&&(f=Math.min(y,f))}return f!==Number.MAX_VALUE&&f}}return!1}_handleOverridablePaintPropertyUpdate(e,t,r){return!(!this.layout||t.isDataDriven()||r.isDataDriven()||"model-color"!==e&&"model-color-mix-intensity"!==e&&"model-rotation"!==e&&"model-scale"!==e&&"model-translation"!==e&&"model-emissive-strength"!==e)}_isPropertyZoomDependent(e){const t=this._transitionablePaint._values[e];return null!=t&&null!=t.value&&null!=t.value.expression&&t.value.expression instanceof ns}isZoomDependent(){return this._isPropertyZoomDependent("model-scale")||this._isPropertyZoomDependent("model-rotation")||this._isPropertyZoomDependent("model-translation")}},clip:class extends qo{constructor(e,t,r,n){super(e,{layout:ep||(ep=new wo({"clip-layer-types":new xo(_o.layout_clip["clip-layer-types"]),"clip-layer-scope":new xo(_o.layout_clip["clip-layer-scope"]),visibility:new xo(_o.layout_clip.visibility)})),paint:tp||(tp=new wo({}))},t,r,n)}recalculate(e,t){super.recalculate(e,t)}createBucket(e){return new ip(e)}is3D(e){return!0}}};function jx(e,t,r,n){return"custom"===e.type?new hg(e,t):new Nx[e.type](e,t,r,n)}class $x{constructor(e){this._callback=e,this._triggered=!1,"undefined"!=typeof MessageChannel&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{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 Gx{constructor(e){this._stringToNumber={},this._numberToString=[];for(let t=0;t<e.length;t++){const r=e[t];this._stringToNumber[r]=t,this._numberToString[t]=r}}encode(e){return this._stringToNumber[e]}decode(e){return this._numberToString[e]}}class Xx{constructor(e,t){this.tileID=e,this.x=e.canonical.x,this.y=e.canonical.y,this.z=e.canonical.z,this.grid=new cs(tn,16,0),this.featureIndexArray=new Xa,this.promoteId=t,this.is3DTile=!1,this.serializedLayersCache=/* @__PURE__ */new Map}insert(e,t,r,n,i,s=0,o=0){const a=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(r,n,i,s);const l=this.grid;for(let u=0;u<t.length;u++){const e=t[u],r=[1/0,1/0,-1/0,-1/0];for(let t=0;t<e.length;t++){const n=e[t];r[0]=Math.min(r[0],n.x),r[1]=Math.min(r[1],n.y),r[2]=Math.max(r[2],n.x),r[3]=Math.max(r[3],n.y)}0!==o&&(r[0]-=o,r[1]-=o,r[2]+=o,r[3]+=o),r[0]<tn&&r[1]<tn&&r[2]>=0&&r[3]>=0&&l.insert(a,r[0],r[1],r[2],r[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new su(new df(this.rawTileData)).layers,this.sourceLayerCoder=new Gx(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const e in this.vtLayers)this.vtFeatures[e]=[]}return this.vtLayers}query(e,t){const{tilespaceGeometry:r,transform:n,tileTransform:i,pixelPosMatrix:s,availableImages:o,worldview:a}=t;this.loadVTLayers(),this.serializedLayersCache.clear();const l=t.queryRadius?t.queryRadius:0,u=r.bufferedTilespaceBounds,c=this.grid.query(u.min.x,u.min.y,u.max.x,u.max.y,(e,t,n,i)=>function(e,t,r,n,i){for(const o of e)if(t<=o.x&&r<=o.y&&n>=o.x&&i>=o.y)return!0;const s=[new oe(t,r),new oe(t,i),new oe(n,i),new oe(n,r)];if(e.length>2)for(const o of s)if(Ou(e,o))return!0;for(let o=0;o<e.length-1;o++)if(Uu(e[o],e[o+1],s))return!0;return!1}(r.bufferedTilespaceGeometry,e-l,t-l,n+l,i+l));c.sort(Hx);let h=null;n.elevation&&c.length>0&&(h=jg.create(n.elevation,this.tileID));const p={};let d;for(let f=0;f<c.length;f++){const l=c[f];if(l===d)continue;d=l;const u=this.featureIndexArray.get(l);let m=null;this.is3DTile?this.loadMatchingModelFeature(p,u,e,r,n,a):this.loadMatchingFeature(p,u,e,o,a,(e,o,a,l=0)=>(m||(m=Kl(e,this.tileID.canonical,i)),o.queryIntersectsFeature(r,e,a,m,this.z,n,s,h,l,t.scope)))}return p}loadMatchingFeature(e,t,r,n,i,s){const{featureIndex:o,bucketIndex:a,sourceLayerIndex:l,layoutVertexArrayOffset:u}=t,c=this.bucketLayerIDs[a],h=r.layers,p=Object.keys(h);if(p.length&&!xe(p,c))return;const d=r.sourceCache,f=this.sourceLayerCoder.decode(l),m=this.vtLayers[f].feature(o),y=this.getId(m,f);for(let g=0;g<c.length;g++){const t=c[g];if(!h[t])continue;const{styleLayer:r,targets:a}=h[t];let l={};void 0!==y&&(l=d.getFeatureState(r.sourceLayer,y));const p=!s||s(m,r,l,u);if(!p)continue;const f=new ex(m,this.z,this.x,this.y,y);f.tile=this.tileID.canonical,f.state=l;let x=this.serializedLayersCache.get(t);x||(x=r.serialize(),x.id=t,this.serializedLayersCache.set(t,x)),f.source=x.source,f.sourceLayer=x["source-layer"],f.layer=Object.assign({},x),f.layer.paint=qx(x.paint,r.paint,m,l,n),f.layer.layout=qx(x.layout,r.layout,m,l,n);let v=!1;for(const e of a){this.updateFeatureProperties(f,e);const{filter:t}=e;if(t)if(m.properties=f.properties,t.needGeometry){const e=Ql(m,!0);if(!t.filter(new lo(this.tileID.overscaledZ,{worldview:i}),e,this.tileID.canonical))continue}else if(!t.filter(new lo(this.tileID.overscaledZ,{worldview:i}),m))continue;v=!0,e.targetId&&this.addFeatureVariant(f,e)}v&&this.appendToResult(e,t,o,f,p)}}loadMatchingModelFeature(e,t,r,n,i,s){const{featureIndex:o,bucketIndex:a}=t,l=this.bucketLayerIDs[a],u=r.layers,c=Object.keys(u);if(!c.length||xe(c,l))for(let h=0;h<l.length;h++){const t=l[h],{styleLayer:a,targets:c}=u[t];if("model"!==a.type)continue;const p=n.tile,d=p.getBucket(a);if(!(d&&d instanceof Yg))continue;const f=Ux(d,o,n,i);if(!f)continue;const{z:m,x:y,y:g}=p.tileID.canonical,{feature:x,intersectionZ:v,position:b}=f;let w={};void 0!==x.id&&(w=r.sourceCache.getFeatureState(a.sourceLayer,x.id));const _=new ex({},m,y,g,x.id);_.tile=this.tileID.canonical,_.state=w,_.properties=x.properties,_.geometry={type:"Point",coordinates:[b.lng,b.lat]};let I=this.serializedLayersCache.get(t);I||(I=a.serialize(),I.id=t,this.serializedLayersCache.set(t,I)),_.source=I.source,_.sourceLayer=I["source-layer"],_.layer=Object.assign({},I);let A=!1;for(const e of c){this.updateFeatureProperties(_,e);const{filter:t}=e;if(t)if(x.properties=_.properties,t.needGeometry){if(!t.filter(new lo(this.tileID.overscaledZ,{worldview:s}),x,this.tileID.canonical))continue}else if(!t.filter(new lo(this.tileID.overscaledZ,{worldview:s}),x))continue;A=!0,e.targetId&&this.addFeatureVariant(_,e)}A&&this.appendToResult(e,t,o,_,v)}}updateFeatureProperties(e,t,r){if(t.properties){const n={};for(const i in t.properties){const s=t.properties[i].evaluate({zoom:this.z},e._vectorTileFeature,e.state,e.tile,r);null!=s&&(n[i]=s)}e.properties=n}}addFeatureVariant(e,t,r){const n={target:t.target,namespace:t.namespace,uniqueFeatureID:t.uniqueFeatureID};t.properties&&(n.properties=e.properties),e.variants=e.variants||{},e.variants[t.targetId]=e.variants[t.targetId]||[],e.variants[t.targetId].push(n)}appendToResult(e,t,r,n,i){let s=e[t];void 0===s&&(s=e[t]=[]),s.push({featureIndex:r,feature:n,intersectionZ:i})}lookupSymbolFeatures(e,t,r,n,i,s){const o={};this.loadVTLayers();for(const a of e)this.loadMatchingFeature(o,{bucketIndex:t,sourceLayerIndex:r,featureIndex:a,layoutVertexArrayOffset:0},n,i,s);return o}loadFeature(e){const{featureIndex:t,sourceLayerIndex:r}=e;this.loadVTLayers();const n=this.sourceLayerCoder.decode(r),i=this.vtFeatures[n];if(i[t])return i[t];const s=this.vtLayers[n].feature(t);return i[t]=s,s}hasLayer(e){for(const t of this.bucketLayerIDs)for(const r of t)if(e===r)return!0;return!1}getId(e,t){let r=e.id;if(this.promoteId){const n=Array.isArray(this.promoteId)||"object"!=typeof this.promoteId?this.promoteId:this.promoteId[t];if(null!=n)if(Array.isArray(n)){if(!this.promoteIdExpression){const e=ts(n);if("success"!==e.result){return void be(`Failed to create expression for promoteId: ${e.value.map(e=>`${e.key}: ${e.message}`).join(", ")}`)}this.promoteIdExpression=e.value}r=this.promoteIdExpression.evaluate({zoom:0},e)}else r=e.properties[n];"boolean"==typeof r&&(r=Number(r))}return r}}function qx(e,t,r,n,i){return ye(e,(e,s)=>{const o=t instanceof go?t.get(s):null;return o&&o.evaluate?o.evaluate(r,n,void 0,i):o})}function Hx(e,t){return t-e}ps(Xx,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const Zx=new Uint16Array(8184);for(let h_=0;h_<2046;h_++){let e=h_+2,t=0,r=0,n=0,i=0,s=0,o=0;for(1&e?n=i=s=32:t=r=o=32;(e>>=1)>1;){const a=t+n>>1,l=r+i>>1;1&e?(n=t,i=r,t=s,r=o):(t=n,r=i,n=s,i=o),s=a,o=l}const a=4*h_;Zx[a+0]=t,Zx[a+1]=r,Zx[a+2]=n,Zx[a+3]=i}const Yx=0,Wx=1,Jx=2;class Kx{constructor(){this.tasks={},this.taskQueue=[],me(["process"],this),this.invoker=new $x(this.process),this.nextId=0}add(e,t){const r=this.nextId++,n=function({type:e,renderSourceType:t,zoom:r}){r=r||0;const n=t===Wx;return"message"===e?0:"maybePrepare"!==e||n?"parseTile"!==e||n?"parseTile"===e&&n?300-r:"maybePrepare"===e&&n?400-r:500:200-r:100-r}(t);if(0===n){try{e()}finally{}return null}return this.tasks[r]={fn:e,metadata:t,priority:n,id:r},this.taskQueue.push(r),this.invoker.trigger(),{cancel:()=>{delete this.tasks[r]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(e=>!!this.tasks[e]),!this.taskQueue.length)return;const e=this.pick();if(null===e)return;const t=this.tasks[e];if(delete this.tasks[e],this.taskQueue.length&&this.invoker.trigger(),!t)return;t.fn()}finally{}}pick(){let e=null,t=1/0;for(let n=0;n<this.taskQueue.length;n++){const r=this.tasks[this.taskQueue[n]];r.priority<t&&(t=r.priority,e=n)}if(null===e)return null;const r=this.taskQueue[e];return this.taskQueue.splice(e,1),r}remove(){this.invoker.remove()}}class Qx{constructor(e,t,r){this.target=e,this.parent=t,this.mapId=r,this.callbacks={},this.cancelCallbacks={},me(["receive"],this),this.target.addEventListener("message",this.receive,!1),this.scheduler=new Kx}send(e,t,r,n,i=!1,s){const o=Math.round(1e18*Math.random()).toString(36).substring(0,10);r&&(r.metadata=s,this.callbacks[o]=r);const a=/* @__PURE__ */new Set;return this.target.postMessage({id:o,type:e,hasCallback:!!r,targetMapId:n,mustQueue:i,sourceMapId:this.mapId,data:fs(t,a)},a),{cancel:()=>{r&&delete this.callbacks[o],this.target.postMessage({id:o,type:"<cancel>",targetMapId:n,sourceMapId:this.mapId})}}}receive(e){const t=e.data;if(!t)return;const r=t.id;if(r&&(!t.targetMapId||this.mapId===t.targetMapId))if("<cancel>"===t.type){const e=this.cancelCallbacks[r];delete this.cancelCallbacks[r],e&&e.cancel()}else if(t.mustQueue||Ie(self)){const e=this.callbacks[r],n=this.scheduler.add(()=>this.processTask(r,t),e&&e.metadata||{type:"message"});n&&(this.cancelCallbacks[r]=n)}else this.processTask(r,t)}processTask(e,t){if(delete this.cancelCallbacks[e],"<response>"===t.type){const r=this.callbacks[e];delete this.callbacks[e],r&&(t.error?r(ms(t.error)):r(null,ms(t.data)))}else{const r=/* @__PURE__ */new Set,n=t.hasCallback?(t,n)=>{this.target.postMessage({id:e,type:"<response>",sourceMapId:this.mapId,error:t?fs(t):null,data:fs(n,r)},r)}:()=>{},i=ms(t.data);if(this.parent[t.type])this.parent[t.type](t.sourceMapId,i,n);else if(this.parent.getWorkerSource){const e=t.type.split("."),{source:r,scope:s}=i;this.parent.getWorkerSource(t.sourceMapId,{type:e[0],source:r,scope:s,uid:0})[e[1]](i,n)}else n(new Error(`Could not find function ${t.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}class ev{static calculate(e={},t=[]){const r=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map;if(0===Object.keys(e).length)return r;t.forEach(e=>{n.set(e.name,e.rgb_color||new Pt(0,0,0))});for(const[i,s]of Object.entries(e))n.has(i)&&r.set(n.get(i).toString(),s);return r}}function tv(e,t=255,r){const n=t/255,i=e.toString(),s=r.has(i)?r.get(i).clone():e.clone();return s.a*=n,s.toString()}function rv(e,t){if(!Ue()){const r=document.createElement("canvas");return r.width=e,r.height=t,r}return new OffscreenCanvas(e,t)}let nv,iv=null;function sv(e,t,r,n,i){for(const s of n.children)ov(e,t,r,s,i)}function ov(e,t,r,n,i){var s,o,a,l,u;n.group?(e.save(),function(e,t,r,n,i){const s=null!=n.mask_idx?r.masks[n.mask_idx]:null,o=null!=n.clip_path_idx?r.clip_paths[n.clip_path_idx]:null;if(n.transform&&(t=mv(n.transform).preMultiplySelf(t)),a=null!=o,l=null!=s,255===n.opacity&&!a&&!l)return void sv(e,t,r,n,i);var a,l;const u=rv(e.canvas.width,e.canvas.height),c=u.getContext("2d");sv(c,t,r,n,i),o&&dv(c,t,r,o),s&&fv(c,t,r,s,i),e.globalAlpha=n.opacity/255,e.drawImage(u,0,0)}(e,t,r,n.group,i),e.restore()):n.path&&(e.save(),s=e,o=t,a=r,l=n.path,u=i,s.setTransform(o),1===l.paint_order?(av(s,a,l,u),uv(s,a,l,u)):(uv(s,a,l,u),av(s,a,l,u)),e.restore())}function av(e,t,r,n){const i=r.fill;if(!i)return;const s=i.opacity/255;switch(e.save(),e.beginPath(),yv(r,e),i.paint){case"rgb_color":e.fillStyle=tv(i.rgb_color,i.opacity,n);break;case"linear_gradient_idx":{const r=t.linear_gradients[i.linear_gradient_idx];r.transform&&e.setTransform(mv(r.transform).preMultiplySelf(e.getTransform())),e.fillStyle=cv(e,r,s,n);break}case"radial_gradient_idx":{const r=t.radial_gradients[i.radial_gradient_idx];r.transform&&e.setTransform(mv(r.transform).preMultiplySelf(e.getTransform())),e.fillStyle=hv(e,r,s,n)}}e.fill(lv(r)),e.restore()}function lv(e){return 1===e.rule?"nonzero":2===e.rule?"evenodd":void 0}function uv(e,t,r,n){const i=r.stroke;if(!i)return;const s=gv(r);e.lineWidth=i.width,e.miterLimit=i.miterlimit,e.setLineDash(i.dasharray),e.lineDashOffset=i.dashoffset;const o=i.opacity/255;switch(i.paint){case"rgb_color":e.strokeStyle=tv(i.rgb_color,i.opacity,n);break;case"linear_gradient_idx":e.strokeStyle=cv(e,t.linear_gradients[i.linear_gradient_idx],o,n,!0);break;case"radial_gradient_idx":e.strokeStyle=hv(e,t.radial_gradients[i.radial_gradient_idx],o,n,!0)}switch(i.linejoin){case 2:case 1:e.lineJoin="miter";break;case 3:e.lineJoin="round";break;case 4:e.lineJoin="bevel"}switch(i.linecap){case 1:e.lineCap="butt";break;case 2:e.lineCap="round";break;case 3:e.lineCap="square"}e.stroke(s)}function cv(e,t,r,n,i=!1){if(1===t.stops.length){const e=t.stops[0];return tv(e.rgb_color,e.opacity*r,n)}const{x1:s,y1:o,x2:a,y2:l}=t;let u=new DOMPoint(s,o),c=new DOMPoint(a,l);if(i){const e=mv(t.transform);u=e.transformPoint(u),c=e.transformPoint(c)}const h=e.createLinearGradient(u.x,u.y,c.x,c.y);for(const p of t.stops)h.addColorStop(p.offset,tv(p.rgb_color,p.opacity*r,n));return h}function hv(e,t,r,n,i=!1){if(1===t.stops.length){const e=t.stops[0];return tv(e.rgb_color,e.opacity*r,n)}const s=mv(t.transform),{fx:o,fy:a,fr:l,cx:u,cy:c,r:h}=t;let p=new DOMPoint(o,a),d=new DOMPoint(u,c),f=l,m=h;if(i){p=s.transformPoint(p),d=s.transformPoint(d);const e=(s.a+s.d)/2;f=l*e,m=t.r*e}const y=e.createRadialGradient(p.x,p.y,f,d.x,d.y,m);for(const g of t.stops)y.addColorStop(g.offset,tv(g.rgb_color,g.opacity*r,n));return y}function pv(e,t,r,n){const i=n.transform?mv(n.transform).preMultiplySelf(t):t,s=rv(e.canvas.width,e.canvas.height),o=s.getContext("2d");for(const l of n.children)if(l.group)pv(o,i,r,l.group);else if(l.path){const e=l.path,t=new Path2D;t.addPath(gv(e),i),o.fill(t,lv(e))}const a=null!=n.clip_path_idx?r.clip_paths[n.clip_path_idx]:null;a&&dv(o,i,r,a),e.globalCompositeOperation="source-over",e.drawImage(s,0,0)}function dv(e,t,r,n){const i=rv(e.canvas.width,e.canvas.height);pv(i.getContext("2d"),t,r,n),e.globalCompositeOperation="destination-in",e.drawImage(i,0,0)}function fv(e,t,r,n,i){if(0===n.children.length)return;const s=null!=n.mask_idx?r.masks[n.mask_idx]:null;s&&fv(e,t,r,s,i);const o=e.canvas.width,a=e.canvas.height,l=rv(o,a),u=l.getContext("2d"),c=n.width,h=n.height,p=n.left,d=n.top,f=new Path2D,m=new Path2D;m.rect(p,d,c,h),f.addPath(m,t),u.clip(f);for(const x of n.children)ov(u,t,r,x,i);const y=u.getImageData(0,0,o,a),g=y.data;if(1===n.mask_type)for(let x=0;x<g.length;x+=4)g[x+3]=g[x+3]/255*(.2126*g[x]+.7152*g[x+1]+.0722*g[x+2]);u.putImageData(y,0,0),e.globalCompositeOperation="destination-in",e.drawImage(l,0,0)}function mv(e){return e?new DOMMatrix([e.sx,e.ky,e.kx,e.sy,e.tx,e.ty]):new DOMMatrix}function yv(e,t){const r=e.step;let n=e.diffs[0]*r,i=e.diffs[1]*r;t.moveTo(n,i);for(let s=0,o=2;s<e.commands.length;s++)switch(e.commands[s]){case 1:n+=e.diffs[o++]*r,i+=e.diffs[o++]*r,t.moveTo(n,i);break;case 2:n+=e.diffs[o++]*r,i+=e.diffs[o++]*r,t.lineTo(n,i);break;case 3:{const s=n+e.diffs[o++]*r,a=i+e.diffs[o++]*r;n=s+e.diffs[o++]*r,i=a+e.diffs[o++]*r,t.quadraticCurveTo(s,a,n,i);break}case 4:{const s=n+e.diffs[o++]*r,a=i+e.diffs[o++]*r,l=s+e.diffs[o++]*r,u=a+e.diffs[o++]*r;n=l+e.diffs[o++]*r,i=u+e.diffs[o++]*r,t.bezierCurveTo(s,a,l,u,n,i);break}case 5:t.closePath()}return t}function gv(e){return yv(e,new Path2D)}class xv{constructor(e){this.capacity=e,this.cache=/* @__PURE__ */new Map}get(e){if(!this.cache.has(e))return;const t=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,t),t}put(e,t){this.cache.has(e)?this.cache.delete(e):this.cache.size===this.capacity&&this.cache.delete(this.cache.keys().next().value),this.cache.set(e,t)}delete(e){this.cache.delete(e)}}ps(xv,"LRUCache");class vv{constructor(){this.cacheMap=/* @__PURE__ */new Map,this.cacheDependenciesMap=/* @__PURE__ */new Map}static _getImage(e){return new Ac(e,e.data)}getFromCache(e,t,r){return this.cacheMap.has(r)||this.cacheMap.set(r,new xv(150)),this.cacheMap.get(r).get(Lo(e.toString(),t))}setInCache(e,t,r,n){this.cacheDependenciesMap.has(n)||this.cacheDependenciesMap.set(n,/* @__PURE__ */new Map),this.cacheMap.has(n)||this.cacheMap.set(n,new xv(150));const i=this.cacheDependenciesMap.get(n),s=Lo(e.id.toString(),r);i.get(s)||i.set(s,/* @__PURE__ */new Set);const o=this.cacheMap.get(n),a=e.toString();i.get(s).add(a),o.put(Lo(e.toString(),r),t)}removeImagesFromCacheByIds(e,t,r=0){if(!this.cacheMap.has(r)||!this.cacheDependenciesMap.has(r))return;const n=this.cacheMap.get(r),i=this.cacheDependenciesMap.get(r);for(const s of e){const e=Lo(s.toString(),t);if(i.has(e)){for(const t of i.get(e))n.delete(t);i.delete(e)}}}rasterize(e,t,r,n){const i=this.getFromCache(e,r,n);if(i)return i.clone();const s=function(e,t){const r=ev.calculate(t.params,e.metadata?e.metadata.variables:[]),n=e.usvg_tree,i=n.width,s=n.height,o=Math.max(1,Math.round(i*t.sx)),a=Math.max(1,Math.round(s*t.sy)),l=new DOMMatrix([o/i,0,0,a/s,0,0]);return null===iv&&(iv=rv(10,10),nv=iv.getContext("2d",{willReadFrequently:!0})),iv.width=o,iv.height=a,sv(nv,l,n,n,r),nv.getImageData(0,0,o,a)}(t.icon,e),o=vv._getImage(s);return this.setInCache(e,o,r,n),o.clone()}}class bv{constructor(e){this.entries={},this.scheduler=e}request(e,t,r,n){const i=this.entries[e]=this.entries[e]||{callbacks:[]};if(i.result){const[e,r]=i.result;return this.scheduler?this.scheduler.add(()=>{n(e,r)},t):n(e,r),()=>{}}return i.callbacks.push(n),i.cancel||(i.cancel=r((r,n)=>{i.result=[r,n];for(const e of i.callbacks)this.scheduler?this.scheduler.add(()=>{e(r,n)},t):e(r,n);setTimeout(()=>delete this.entries[e],3e3)})),()=>{i.result||(i.callbacks=i.callbacks.filter(e=>e!==n),i.callbacks.length||(i.cancel(),delete this.entries[e]))}}}function wv(e,t,r){const n=JSON.stringify(e.request);return e.data&&(this.deduped.entries[n]={result:[null,e.data]}),this.deduped.request(n,{type:"parseTile",renderSourceType:e.renderSourceType,zoom:e.tileZoom},t=>{const n=ot(e.request,(e,n,i)=>{e?function(e){return"object"==typeof e&&null!==e&&"status"in e&&404===e.status}(e)?t(null,null):t(e):n&&t(null,{rawData:n,vectorTile:r?void 0:new su(new df(n)),responseHeaders:new Map(i.entries())})});return()=>{n.cancel(),t(null,null)}},t)}const _v=/* @__PURE__ */new Map,Iv=/* @__PURE__ */new Map;class Av{constructor(e){this.size=e,this.minimums=[],this.maximums=[],this.leaves=[]}getElevation(e,t){const r=this.toIdx(e,t);return{min:this.minimums[r],max:this.maximums[r]}}isLeaf(e,t){return this.leaves[this.toIdx(e,t)]}toIdx(e,t){return t*this.size+e}}function Sv(e,t,r,n){let i=0,s=Number.MAX_VALUE;for(let o=0;o<3;o++)if(Math.abs(n[o])<1e-15){if(r[o]<e[o]||r[o]>t[o])return null}else{const a=1/n[o];let l=(e[o]-r[o])*a,u=(t[o]-r[o])*a;if(l>u){const e=l;l=u,u=e}if(l>i&&(i=l),u<s&&(s=u),i>s)return null}return i}function Mv(e,t,r,n,i,s,o,a,l,u,c){const h=n-e,p=i-t,d=s-r,f=o-e,m=a-t,y=l-r,g=c[1]*y-c[2]*m,x=c[2]*f-c[0]*y,v=c[0]*m-c[1]*f,b=h*g+p*x+d*v;if(Math.abs(b)<1e-15)return null;const w=1/b,_=u[0]-e,I=u[1]-t,A=u[2]-r,S=(_*g+I*x+A*v)*w;if(S<0||S>1)return null;const M=I*d-A*p,B=A*h-_*d,P=_*p-I*h,z=(c[0]*M+c[1]*B+c[2]*P)*w;return z<0||S+z>1?null:(f*M+m*B+y*P)*w}function Bv(e,t,r){return(e-t)/(r-t)}function Pv(e,t,r,n,i,s,o,a,l){const u=1<<r,c=s-n,h=o-i,p=(e+1)/u*c+n,d=(t+0)/u*h+i,f=(t+1)/u*h+i;a[0]=(e+0)/u*c+n,a[1]=d,l[0]=p,l[1]=f}class zv{constructor(e){if(this.maximums=[],this.minimums=[],this.leaves=[],this.childOffsets=[],this.nodeCount=0,this.dem=e,this._siblingOffset=[[0,0],[1,0],[0,1],[1,1]],!this.dem)return;const t=function(e){const t=Math.ceil(Math.log2(e.dim/8)),r=[];let n=Math.ceil(Math.pow(2,t));const i=1/n,s=(e,t,r,n,i)=>{const s=n?1:0,o=(e+1)*r-s,a=t*r,l=(t+1)*r-s;i[0]=e*r,i[1]=a,i[2]=o,i[3]=l};let o=new Av(n);const a=[];for(let l=0;l<n*n;l++){s(l%n,Math.floor(l/n),i,!1,a);const t=kv(a[0],a[1],e),r=kv(a[2],a[1],e),u=kv(a[2],a[3],e),c=kv(a[0],a[3],e);o.minimums.push(Math.min(t,r,u,c)),o.maximums.push(Math.max(t,r,u,c)),o.leaves.push(1)}for(r.push(o),n/=2;n>=1;n/=2){const e=r.at(-1);o=new Av(n);for(let t=0;t<n*n;t++){s(t%n,Math.floor(t/n),2,!0,a);const r=e.getElevation(a[0],a[1]),i=e.getElevation(a[2],a[1]),l=e.getElevation(a[2],a[3]),u=e.getElevation(a[0],a[3]),c=e.isLeaf(a[0],a[1]),h=e.isLeaf(a[2],a[1]),p=e.isLeaf(a[2],a[3]),d=e.isLeaf(a[0],a[3]),f=Math.min(r.min,i.min,l.min,u.min),m=Math.max(r.max,i.max,l.max,u.max),y=c&&h&&p&&d;o.maximums.push(m),o.minimums.push(f),o.leaves.push(m-f<=5&&y?1:0)}r.push(o)}return r}(this.dem),r=t.length-1,n=t[r];this._addNode(n.minimums[0],n.maximums[0],n.leaves[0]),this._construct(t,0,0,r,0)}raycastRoot(e,t,r,n,i,s,o=1){return Sv([e,t,-100],[r,n,this.maximums[0]*o],i,s)}raycast(e,t,r,n,i,s,o=1){if(!this.nodeCount)return null;const a=this.raycastRoot(e,t,r,n,i,s,o);if(null==a)return null;const l=[],u=[],c=[],h=[],p=[{idx:0,t:a,nodex:0,nodey:0,depth:0}];for(;p.length>0;){const{idx:a,t:d,nodex:f,nodey:m,depth:y}=p.pop();if(this.leaves[a]){Pv(f,m,y,e,t,r,n,c,h);const a=1<<y,l=(f+0)/a,u=(f+1)/a,p=(m+0)/a,g=(m+1)/a,x=kv(l,p,this.dem)*o,v=kv(u,p,this.dem)*o,b=kv(u,g,this.dem)*o,w=kv(l,g,this.dem)*o,_=Mv(c[0],c[1],x,h[0],c[1],v,h[0],h[1],b,i,s),A=Mv(h[0],h[1],b,c[0],h[1],w,c[0],c[1],x,i,s),S=Math.min(null!==_?_:Number.MAX_VALUE,null!==A?A:Number.MAX_VALUE);if(S!==Number.MAX_VALUE)return S;{const e=I([],i,s,d);if(Tv(x,v,w,b,Bv(e[0],c[0],h[0]),Bv(e[1],c[1],h[1]))>=e[2])return d}continue}let g=0;for(let p=0;p<this._siblingOffset.length;p++){Pv((f<<1)+this._siblingOffset[p][0],(m<<1)+this._siblingOffset[p][1],y+1,e,t,r,n,c,h),c[2]=-100,h[2]=this.maximums[this.childOffsets[a]+p]*o;const d=Sv(c,h,i,s);if(null!=d){const e=d;l[p]=e;let t=!1;for(let r=0;r<g&&!t;r++)e>=l[u[r]]&&(u.splice(r,0,p),t=!0);t||(u[g]=p),g++}}for(let e=0;e<g;e++){const t=u[e];p.push({idx:this.childOffsets[a]+t,t:l[t],nodex:(f<<1)+this._siblingOffset[t][0],nodey:(m<<1)+this._siblingOffset[t][1],depth:y+1})}}return null}_addNode(e,t,r){return this.minimums.push(e),this.maximums.push(t),this.leaves.push(r),this.childOffsets.push(0),this.nodeCount++}_construct(e,t,r,n,i){if(1===e[n].isLeaf(t,r))return;this.childOffsets[i]||(this.childOffsets[i]=this.nodeCount);const s=n-1,o=e[s];let a=0,l=0;for(let u=0;u<this._siblingOffset.length;u++){const e=2*t+this._siblingOffset[u][0],n=2*r+this._siblingOffset[u][1],i=o.getElevation(e,n),s=o.isLeaf(e,n),c=this._addNode(i.min,i.max,s);s&&(a|=1<<u),l||(l=c)}for(let u=0;u<this._siblingOffset.length;u++)a&1<<u||this._construct(e,2*t+this._siblingOffset[u][0],2*r+this._siblingOffset[u][1],s,l+u)}}function Tv(e,t,r,n,i,s){return Bt(Bt(e,r,s),Bt(t,n,s),i)}function kv(e,t,r){const n=r.dim,i=pe(e*n-.5,0,n-1),s=pe(t*n-.5,0,n-1),o=Math.floor(i),a=Math.floor(s),l=Math.min(o+1,n-1),u=Math.min(a+1,n-1);return Tv(r.get(o,a),r.get(l,a),r.get(o,u),r.get(l,u),i-o,s-a)}const Vv={mapbox:[6553.6,25.6,.1,1e4],terrarium:[256,1,1/256,32768]};function Ev(e,t,r){return(256*e*256+256*t+r)/10-1e4}function Dv(e,t,r){return 256*e+t+r/256-32768}class Cv{get tree(){return this._tree||this._buildQuadTree(),this._tree}constructor(e,t,r,n=!1){if(this.uid=e,t.height!==t.width)throw new RangeError("DEM tiles must be square");if(r&&"mapbox"!==r&&"terrarium"!==r)return void be(`"${r}" is not a valid encoding type. Valid types include "mapbox" and "terrarium".`);this.stride=t.height;const i=this.dim=t.height-2,s=new Uint32Array(t.data.buffer);if(this.pixels=new Uint8Array(t.data.buffer),this.floatView=new Float32Array(t.data.buffer),this.borderReady=n,this._modifiedForSources={},!n){for(let e=0;e<i;e++)s[this._idx(-1,e)]=s[this._idx(0,e)],s[this._idx(i,e)]=s[this._idx(i-1,e)],s[this._idx(e,-1)]=s[this._idx(e,0)],s[this._idx(e,i)]=s[this._idx(e,i-1)];s[this._idx(-1,-1)]=s[this._idx(0,0)],s[this._idx(i,-1)]=s[this._idx(i-1,0)],s[this._idx(-1,i)]=s[this._idx(0,i-1)],s[this._idx(i,i)]=s[this._idx(i-1,i-1)]}const o="terrarium"===r?Dv:Ev;for(let a=0;a<s.length;++a){const e=4*a;this.floatView[a]=o(this.pixels[e],this.pixels[e+1],this.pixels[e+2])}this._timestamp=Ne.now()}_buildQuadTree(){this._tree=new zv(this)}get(e,t,r=!1){r&&(e=pe(e,-1,this.dim),t=pe(t,-1,this.dim));const n=this._idx(e,t);return this.floatView[n]}set(e,t,r){const n=this._idx(e,t),i=this.floatView[n];return this.floatView[n]=r,r-i}static getUnpackVector(e){return Vv[e]}_idx(e,t){if(e<-1||e>=this.dim+1||t<-1||t>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(t+1)*this.stride+(e+1)}static pack(e,t){const r=[0,0,0,0],n=Cv.getUnpackVector(t);let i=Math.floor((e+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 Sc({width:this.stride,height:this.stride},this.pixels)}backfillBorder(e,t,r){if(this.dim!==e.dim)throw new Error("dem dimension mismatch");let n=t*this.dim,i=t*this.dim+this.dim,s=r*this.dim,o=r*this.dim+this.dim;switch(t){case-1:n=i-1;break;case 1:i=n+1}switch(r){case-1:s=o-1;break;case 1:o=s+1}const a=-t*this.dim,l=-r*this.dim;for(let u=s;u<o;u++)for(let t=n;t<i;t++){const r=4*this._idx(t,u),n=4*this._idx(t+a,u+l);this.pixels[r+0]=e.pixels[n+0],this.pixels[r+1]=e.pixels[n+1],this.pixels[r+2]=e.pixels[n+2],this.pixels[r+3]=e.pixels[n+3]}}onDeserialize(){this._tree&&(this._tree.dem=this)}}function Fv(e,t,r){var n,i;1===e?t.headerLength=r.readFixed32():2===e?t.x=r.readVarint():3===e?t.y=r.readVarint():4===e?t.z=r.readVarint():5===e&&t.layers.push((n=r,i=r.readVarint()+r.pos,n.readFields(Nv,{version:0,name:"",units:"",tileSize:0,buffer:0,pixelFormat:0,dataIndex:[]},i)))}function Lv(e,t,r){var n,i;1===e?(t.delta_filter=(n=r,i=r.readVarint()+r.pos,n.readFields(Rv,{blockSize:0},i)),t.filter="delta_filter"):2===e?(r.readVarint(),t.filter="zigzag_filter"):3===e?(r.readVarint(),t.filter="bitshuffle_filter"):4===e&&(r.readVarint(),t.filter="byteshuffle_filter")}function Rv(e,t,r){1===e&&(t.blockSize=r.readVarint())}function Ov(e,t,r){1===e?(r.readVarint(),t.codec="gzip_data"):2===e?(r.readVarint(),t.codec="jpeg_image"):3===e?(r.readVarint(),t.codec="webp_image"):4===e&&(r.readVarint(),t.codec="png_image")}function Uv(e,t,r){let n=0,i=0;var s,o;1===e?t.firstByte=r.readFixed64():2===e?t.lastByte=r.readFixed64():3===e?t.filters.push((s=r,o=r.readVarint()+r.pos,s.readFields(Lv,{},o))):4===e?t.codec=function(e,t){return e.readFields(Ov,{},t)}(r,r.readVarint()+r.pos):5===e?i=r.readFloat():6===e?n=r.readFloat():7===e?t.bands.push(r.readString()):8===e?t.offset=r.readDouble():9===e&&(t.scale=r.readDouble()),0===t.offset&&(t.offset=i),0===t.scale&&(t.scale=n)}function Nv(e,t,r){var n,i;1===e?t.version=r.readVarint():2===e?t.name=r.readString():3===e?t.units=r.readString():4===e?t.tileSize=r.readVarint():5===e?t.buffer=r.readVarint():6===e?t.pixelFormat=r.readVarint():7===e&&t.dataIndex.push((n=r,i=r.readVarint()+r.pos,n.readFields(Uv,{firstByte:0,lastByte:0,filters:[],codec:null,offset:0,scale:0,bands:[]},i)))}function jv(e,t,r){if(2===e)n=r,i=r.readVarint()+r.pos,s=t,n.readFields($v,s,i);else if(3===e)throw new Error("Not implemented");var n,i,s}function $v(e,t,r){if(1===e){let e=0;const n=r.readVarint()+r.pos;for(;r.pos<n;)t[e++]=r.readVarint()}}function Gv(e,t){if(4!==t.length)throw new Error(`Expected data of dimension 4 but got ${t.length}.`);let r=t[3];for(let n=2;n>=1;n--){const i=1===n?1:0,s=2===n?1:0;for(let n=0;n<t[0];n++){const o=t[1]*n;for(let n=i;n<t[1];n++){const i=t[2]*(n+o);for(let n=s;n<t[2];n++){const s=t[3]*(n+i);for(let n=0;n<t[3];n++){const t=s+n;e[t]+=e[t-r]}}}}r*=t[n]}return e}function Xv(e){for(let t=0,r=e.length;t<r;t++)e[t]=e[t]>>>1^-(1&e[t]);return e}function qv(e,t){switch(t){case"uint32":return e;case"uint16":for(let t=0;t<e.length;t+=2){const r=e[t],n=e[t+1];e[t]=(240&r)>>4|(61440&r)>>8|(240&n)<<4|61440&n,e[t+1]=15&r|(3840&r)>>4|(15&n)<<8|(3840&n)<<4}return e;case"uint8":for(let t=0;t<e.length;t+=4){const r=e[t],n=e[t+1],i=e[t+2],s=e[t+3];e[t+0]=(192&r)>>6|(192&n)>>4|(192&i)>>2|192&s,e[t+1]=(48&r)>>4|(48&n)>>2|48&i|(48&s)<<2,e[t+2]=(12&r)>>2|12&n|(12&i)<<2|(12&s)<<4,e[t+3]=3&r|(3&n)<<2|(3&i)<<4|(3&s)<<6}return e;default:throw new Error(`Invalid pixel format, "${t}"`)}}ps(Cv,"DEMData"),ps(zv,"DemMinMaxQuadTree",{omit:["dem"]});var Hv=Uint8Array,Zv=Uint16Array,Yv=Int32Array,Wv=new Hv([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Jv=new Hv([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Kv=new Hv([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Qv=function(e,t){for(var r=new Zv(31),n=0;n<31;++n)r[n]=t+=1<<e[n-1];var i=new Yv(r[30]);for(n=1;n<30;++n)for(var s=r[n];s<r[n+1];++s)i[s]=s-r[n]<<5|n;return{b:r,r:i}},eb=Qv(Wv,2),tb=eb.b,rb=eb.r;tb[28]=258,rb[258]=28;for(var nb=Qv(Jv,0).b,ib=new Zv(32768),sb=0;sb<32768;++sb){var ob=(43690&sb)>>1|(21845&sb)<<1;ib[sb]=((65280&(ob=(61680&(ob=(52428&ob)>>2|(13107&ob)<<2))>>4|(3855&ob)<<4))>>8|(255&ob)<<8)>>1}var ab=function(e,t,r){for(var n=e.length,i=0,s=new Zv(t);i<n;++i)e[i]&&++s[e[i]-1];var o,a=new Zv(t);for(i=1;i<t;++i)a[i]=a[i-1]+s[i-1]<<1;o=new Zv(1<<t);var l=15-t;for(i=0;i<n;++i)if(e[i])for(var u=i<<4|e[i],c=t-e[i],h=a[e[i]-1]++<<c,p=h|(1<<c)-1;h<=p;++h)o[ib[h]>>l]=u;return o},lb=new Hv(288);for(sb=0;sb<144;++sb)lb[sb]=8;for(sb=144;sb<256;++sb)lb[sb]=9;for(sb=256;sb<280;++sb)lb[sb]=7;for(sb=280;sb<288;++sb)lb[sb]=8;var ub=new Hv(32);for(sb=0;sb<32;++sb)ub[sb]=5;var cb=ab(lb,9),hb=ab(ub,5),pb=function(e){for(var t=e[0],r=1;r<e.length;++r)e[r]>t&&(t=e[r]);return t},db=function(e,t,r){var n=t/8|0;return(e[n]|e[n+1]<<8)>>(7&t)&r},fb=function(e,t){var r=t/8|0;return(e[r]|e[r+1]<<8|e[r+2]<<16)>>(7&t)},mb=function(e){return(e+7)/8|0},yb=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],gb=function(e,t,r){var n=new Error(t||yb[e]);if(n.code=e,Error.captureStackTrace&&Error.captureStackTrace(n,gb),!r)throw n;return n},xb=new Hv(0),vb="undefined"!=typeof TextDecoder&&new TextDecoder;try{vb.decode(xb,{stream:!0})}catch(C){}const bb={gzip_data:"gzip"};class wb extends Error{constructor(e){super(e),this.name="MRTError"}}const _b={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},Ib={uint32:1,uint16:2,uint8:4},Ab={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let Sb;class Mb{constructor(e=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=e}getLayer(e){const t=this.layers[e];if(!t)throw new wb(`Layer '${e}' not found`);return t}getHeaderLength(e){const t=new Uint8Array(e),r=new DataView(e);if(13!==t[0])throw new wb("File is not a valid MRT.");return r.getUint32(1,!0)}parseHeader(e){const t=new Uint8Array(e),r=this.getHeaderLength(e);if(t.length<r)throw new wb(`Expected header with length >= ${r} but got buffer of length ${t.length}`);const n=new Sb(t.subarray(0,r)).readFields(Fv,{headerLength:0,x:0,y:0,z:0,layers:[]},void 0);if(!isNaN(this.x)&&(this.x!==n.x||this.y!==n.y||this.z!==n.z))throw new wb(`Invalid attempt to parse header ${n.z}/${n.x}/${n.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=n.x,this.y=n.y,this.z=n.z;for(const i of n.layers)this.layers[i.name]=new Bb(i,{cacheSize:this._cacheSize});return this}createDecodingTask(e){const t=[],r=this.getLayer(e.layerName);for(let n of e.blockIndices){const i=r.dataIndex[n],s=i.firstByte-e.firstByte,o=i.lastByte-e.firstByte;if(r._blocksInProgress.has(n))continue;const a={layerName:r.name,firstByte:s,lastByte:o,pixelFormat:r.pixelFormat,blockIndex:n,blockShape:[i.bands.length].concat(r.bandShape),buffer:r.buffer,codec:i.codec.codec,filters:i.filters.map(e=>e.filter)};r._blocksInProgress.add(n),t.push(a)}return new Pb(t,()=>{t.forEach(e=>r._blocksInProgress.delete(e.blockIndex))},(e,n)=>{if(t.forEach(e=>r._blocksInProgress.delete(e.blockIndex)),e)throw e;n.forEach(e=>{this.getLayer(e.layerName).processDecodedData(e)})})}}class Bb{constructor({version:e,name:t,units:r,tileSize:n,pixelFormat:i,buffer:s,dataIndex:o},a){if(this.version=e,1!==this.version)throw new wb(`Cannot parse raster layer encoded with MRT version ${e}`);this.name=t,this.units=r,this.tileSize=n,this.buffer=s,this.pixelFormat=_b[i],this.dataIndex=o,this.bandShape=[n+2*s,n+2*s,Ib[this.pixelFormat]],this._decodedBlocks=new xv(a?a.cacheSize:5),this._blocksInProgress=/* @__PURE__ */new Set}get dimension(){return Ib[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:e})=>e).flat()}processDecodedData(e){const t=e.blockIndex.toString();this._decodedBlocks.get(t)||this._decodedBlocks.put(t,e.data)}getBlockForBand(e){let t=0;switch(typeof e){case"string":for(const[r,n]of this.dataIndex.entries()){for(const[i,s]of n.bands.entries())if(s===e)return{bandIndex:t+i,blockIndex:r,blockBandIndex:i};t+=n.bands.length}break;case"number":for(const[r,n]of this.dataIndex.entries()){if(e>=t&&e<t+n.bands.length)return{bandIndex:e,blockIndex:r,blockBandIndex:e-t};t+=n.bands.length}break;default:throw new wb(`Invalid band \`${JSON.stringify(e)}\`. Expected string or integer.`)}return{blockIndex:-1,blockBandIndex:-1}}getDataRange(e){let t=1/0,r=-1/0;const n=[],i=/* @__PURE__ */new Set;for(const s of e){const{blockIndex:e}=this.getBlockForBand(s);if(e<0)throw new wb(`Invalid band: ${JSON.stringify(s)}`);const o=this.dataIndex[e];n.includes(e)||n.push(e),i.add(e),t=Math.min(t,o.firstByte),r=Math.max(r,o.lastByte)}if(i.size>this.cacheSize)throw new wb(`Number of blocks to decode (${i.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:t,lastByte:r,blockIndices:n}}hasBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0}hasDataForBand(e){const{blockIndex:t}=this.getBlockForBand(e);return t>=0&&!!this._decodedBlocks.get(t.toString())}getBandView(e){const{blockIndex:t,blockBandIndex:r}=this.getBlockForBand(e);if(t<0)throw new wb(`Band not found: ${JSON.stringify(e)}`);const n=this._decodedBlocks.get(t.toString());if(!n)throw new wb(`Data for band ${JSON.stringify(e)} of layer "${this.name}" not decoded.`);const i=this.dataIndex[t],s=this.bandShape.reduce((e,t)=>e*t,1),o=r*s,a=n.subarray(o,o+s);return{data:a,bytes:new Uint8Array(a.buffer).subarray(a.byteOffset,a.byteOffset+a.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:i.offset,scale:i.scale}}}Mb.setPbf=function(e){Sb=e};class Pb{constructor(e,t,r){this.tasks=e,this._onCancel=t,this._onComplete=r,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(e,t){this._finalized||(this._onComplete(e,t),this._finalized=!0)}}Mb.performDecoding=function(e,t){const r=new Uint8Array(e);return Promise.all(t.tasks.map(e=>{const{layerName:t,firstByte:n,lastByte:i,pixelFormat:s,blockShape:o,blockIndex:a,filters:l,codec:u}=e,c=r.subarray(n,i+1),h=new Uint32Array(o[0]*o[1]*o[2]);let p;if("gzip_data"!==u)throw new wb(`Unhandled codec: ${u}`);return p=function(e,t){if(!globalThis.DecompressionStream&&"gzip_data"===t)return Promise.resolve(((s=function(e){31==e[0]&&139==e[1]&&8==e[2]||gb(6,"invalid gzip data");var t=e[3],r=10;4&t&&(r+=2+(e[10]|e[11]<<8));for(var n=(t>>3&1)+(t>>4&1);n>0;n-=!e[r++]);return r+(2&t)}(r=e))+8>r.length&&gb(6,"invalid gzip data"),function(e,t,r,n){var i=e.length;if(!i||t.f&&!t.l)return r||new Hv(0);var s=!r,o=s||2!=t.i;s&&(r=new Hv(3*i));var a,l,u=function(e){var t=r.length;if(e>t){var n=new Hv(Math.max(2*t,e));n.set(r),r=n}},c=t.f||0,h=t.p||0,p=t.b||0,d=t.l,f=t.d,m=t.m,y=t.n,g=8*i;do{if(!d){c=db(e,h,1);var x=db(e,h+1,3);if(h+=3,!x){var v=e[(T=mb(h)+4)-4]|e[T-3]<<8,b=T+v;if(b>i){gb(0);break}o&&u(p+v),r.set(e.subarray(T,b),p),t.b=p+=v,t.p=h=8*b,t.f=c;continue}if(1==x)d=cb,f=hb,m=9,y=5;else if(2==x){var w=db(e,h,31)+257,_=db(e,h+10,15)+4,I=w+db(e,h+5,31)+1;h+=14;for(var A=new Hv(I),S=new Hv(19),M=0;M<_;++M)S[Kv[M]]=db(e,h+3*M,7);h+=3*_;var B=pb(S),P=(1<<B)-1,z=ab(S,B);for(M=0;M<I;){var T,k=z[db(e,h,P)];if(h+=15&k,(T=k>>4)<16)A[M++]=T;else{var V=0,E=0;for(16==T?(E=3+db(e,h,3),h+=2,V=A[M-1]):17==T?(E=3+db(e,h,7),h+=3):18==T&&(E=11+db(e,h,127),h+=7);E--;)A[M++]=V}}var D=A.subarray(0,w),C=A.subarray(w);m=pb(D),y=pb(C),d=ab(D,m),f=ab(C,y)}else gb(1);if(h>g){gb(0);break}}o&&u(p+131072);for(var F=(1<<m)-1,L=(1<<y)-1,R=h;;R=h){var O=(V=d[fb(e,h)&F])>>4;if((h+=15&V)>g){gb(0);break}if(V||gb(2),O<256)r[p++]=O;else{if(256==O){R=h,d=null;break}var U=O-254;O>264&&(U=db(e,h,(1<<($=Wv[M=O-257]))-1)+tb[M],h+=$);var N=f[fb(e,h)&L],j=N>>4;if(N||gb(3),h+=15&N,C=nb[j],j>3){var $=Jv[j];C+=fb(e,h)&(1<<$)-1,h+=$}if(h>g){gb(0);break}o&&u(p+131072);var G=p+U;if(p<C){var X=0-C,q=Math.min(C,G);for(X+p<0&&gb(3);p<q;++p)r[p]=n[X+p]}for(;p<G;++p)r[p]=r[p-C]}}t.l=d,t.p=R,t.b=p,t.f=c,d&&(c=1,t.m=m,t.d=f,t.n=y)}while(!c);return p!=r.length&&s?(a=r,(null==(l=p)||l>a.length)&&(l=a.length),new Hv(a.subarray(0,l))):r.subarray(0,p)}(r.subarray(s,-8),{i:2},new Hv(((n=r)[(i=n.length)-4]|n[i-3]<<8|n[i-2]<<16|n[i-1]<<24)>>>0),void 0)));var r,n,i,s;const o=bb[t];if(!o)throw new Error(`Unhandled codec: ${t}`);const a=new globalThis.DecompressionStream(o);return new Response(new Blob([e]).stream().pipeThrough(a)).arrayBuffer().then(e=>new Uint8Array(e))}(c,u).then(e=>{return t=new Sb(e),r=h,t.readFields(jv,r),new Ab[s](h.buffer);var t,r}),p.then(e=>{for(let t=l.length-1;t>=0;t--)switch(l[t]){case"delta_filter":Gv(e,o);break;case"zigzag_filter":Xv(e);break;case"bitshuffle_filter":qv(e,s);break;default:throw new wb(`Unhandled filter "${l[t]}"`)}return{layerName:t,blockIndex:a,data:e}}).catch(e=>{throw e})}))},ps(Pb,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),ps(Mb,"MapboxRasterTile"),ps(Bb,"MapboxRasterLayer",{omit:["_blocksInProgress"]});const zb=["type","source","source-layer","minzoom","maxzoom","filter","layout"],Tb=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class kb{static from(e){if(!(e instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[t,r]=new Uint8Array(e,0,2);if(219!==t)throw new Error("Data does not appear to be in a KDBush format.");const n=r>>4;if(1!==n)throw new Error(`Got v${n} data when expected v1.`);const i=Tb[15&r];if(!i)throw new Error("Unrecognized array type.");const[s]=new Uint16Array(e,2,1),[o]=new Uint32Array(e,4,1);return new kb(o,s,i,e)}constructor(e,t=64,r=Float64Array,n){if(isNaN(e)||e<0)throw new Error(`Unpexpected numItems value: ${e}.`);this.numItems=+e,this.nodeSize=Math.min(Math.max(+t,2),65535),this.ArrayType=r,this.IndexArrayType=e<65536?Uint16Array:Uint32Array;const i=Tb.indexOf(this.ArrayType),s=2*e*this.ArrayType.BYTES_PER_ELEMENT,o=e*this.IndexArrayType.BYTES_PER_ELEMENT,a=(8-o%8)%8;if(i<0)throw new Error(`Unexpected typed array class: ${r}.`);n&&n instanceof ArrayBuffer?(this.data=n,this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+o+a,2*e),this._pos=2*e,this._finished=!0):(this.data=new ArrayBuffer(8+s+o+a),this.ids=new this.IndexArrayType(this.data,8,e),this.coords=new this.ArrayType(this.data,8+o+a,2*e),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+i]),new Uint16Array(this.data,2,1)[0]=t,new Uint32Array(this.data,4,1)[0]=e)}add(e,t){const r=this._pos>>1;return this.ids[r]=r,this.coords[this._pos++]=e,this.coords[this._pos++]=t,r}finish(){const e=this._pos>>1;if(e!==this.numItems)throw new Error(`Added ${e} items when expected ${this.numItems}.`);return Vb(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(e,t,r,n){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:i,coords:s,nodeSize:o}=this,a=[0,i.length-1,0],l=[];for(;a.length;){const u=a.pop()||0,c=a.pop()||0,h=a.pop()||0;if(c-h<=o){for(let o=h;o<=c;o++){const a=s[2*o],u=s[2*o+1];a>=e&&a<=r&&u>=t&&u<=n&&l.push(i[o])}continue}const p=h+c>>1,d=s[2*p],f=s[2*p+1];d>=e&&d<=r&&f>=t&&f<=n&&l.push(i[p]),(0===u?e<=d:t<=f)&&(a.push(h),a.push(p-1),a.push(1-u)),(0===u?r>=d:n>=f)&&(a.push(p+1),a.push(c),a.push(1-u))}return l}within(e,t,r){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:n,coords:i,nodeSize:s}=this,o=[0,n.length-1,0],a=[],l=r*r;for(;o.length;){const u=o.pop()||0,c=o.pop()||0,h=o.pop()||0;if(c-h<=s){for(let r=h;r<=c;r++)Fb(i[2*r],i[2*r+1],e,t)<=l&&a.push(n[r]);continue}const p=h+c>>1,d=i[2*p],f=i[2*p+1];Fb(d,f,e,t)<=l&&a.push(n[p]),(0===u?e-r<=d:t-r<=f)&&(o.push(h),o.push(p-1),o.push(1-u)),(0===u?e+r>=d:t+r>=f)&&(o.push(p+1),o.push(c),o.push(1-u))}return a}}function Vb(e,t,r,n,i,s){if(i-n<=r)return;const o=n+i>>1;Eb(e,t,o,n,i,s),Vb(e,t,r,n,o-1,1-s),Vb(e,t,r,o+1,i,1-s)}function Eb(e,t,r,n,i,s){for(;i>n;){if(i-n>600){const o=i-n+1,a=r-n+1,l=Math.log(o),u=.5*Math.exp(2*l/3),c=.5*Math.sqrt(l*u*(o-u)/o)*(a-o/2<0?-1:1);Eb(e,t,r,Math.max(n,Math.floor(r-a*u/o+c)),Math.min(i,Math.floor(r+(o-a)*u/o+c)),s)}const o=t[2*r+s];let a=n,l=i;for(Db(e,t,n,r),t[2*i+s]>o&&Db(e,t,n,i);a<l;){for(Db(e,t,a,l),a++,l--;t[2*a+s]<o;)a++;for(;t[2*l+s]>o;)l--}t[2*n+s]===o?Db(e,t,n,l):(l++,Db(e,t,l,i)),l<=r&&(n=l+1),r<=l&&(i=l-1)}}function Db(e,t,r,n){Cb(e,r,n),Cb(t,2*r,2*n),Cb(t,2*r+1,2*n+1)}function Cb(e,t,r){const n=e[t];e[t]=e[r],e[r]=n}function Fb(e,t,r,n){const i=e-r,s=t-n;return i*i+s*s}class Lb{static calculate(e,t,r){const n=/* @__PURE__ */new Set,i=/* @__PURE__ */new Map,s=/* @__PURE__ */new Set,o=/* @__PURE__ */new Set;for(const l of Object.values(e))for(const[e,r]of Object.entries(l.floors)){s.add(e),r.isDefault&&o.add(e),r.conflicts&&i.set(e,r.conflicts);const a=e===t,l=r.connections&&t&&r.connections.has(t);(a||l)&&n.add(e)}const a=e=>{const t=i.get(e)||/* @__PURE__ */new Set;for(const r of n)if((i.get(r)||/* @__PURE__ */new Set).has(e)||t.has(r))return!0;return!1};if(r)for(const l of r)s.has(l)&&(a(l)||n.add(l));for(const l of o)n.has(l)||a(l)||n.add(l);return n}}function Rb(e){const t=e?e.url.toString():void 0;return t?performance.getEntriesByName(t):[]}function Ob(e){if("number"==typeof e||"boolean"==typeof e||"string"==typeof e||null==e)return JSON.stringify(e);if(Array.isArray(e)){let t="[";for(const r of e)t+=`${Ob(r)},`;return`${t}]`}let t="{";for(const r of Object.keys(e).sort())t+=`${r}:${Ob(e[r])},`;return`${t}}`}function Ub(e){let t="";for(const r of zb)t+=`/${Ob(e[r])}`;return t}function Nb(e,t){return function e(r){return"string"==typeof r&&r===t||(Array.isArray(r)?r.some(e):!(!r||"object"!=typeof r)&&Object.values(r).some(e))}(e)}class jb{constructor(e){this.keyCache=/* @__PURE__ */Object.create(null),this._layers=/* @__PURE__ */Object.create(null),this._layerConfigs=/* @__PURE__ */Object.create(null),e&&this.replace(e)}replace(e,t){this._layerConfigs=/* @__PURE__ */Object.create(null),this._layers=/* @__PURE__ */Object.create(null),this.update(e,[],t)}update(e,t,r){this._options=r;for(const i of e)this._layerConfigs[i.id]=i,(this._layers[i.id]=jx(i,this.scope,null,this._options)).compileFilter(r),this.keyCache[i.id]&&delete this.keyCache[i.id];for(const i of t)delete this.keyCache[i],delete this._layerConfigs[i],delete this._layers[i];this.familiesBySource=/* @__PURE__ */Object.create(null);const n=function(e,t){const r=/* @__PURE__ */Object.create(null);for(let i=0;i<e.length;i++){const n=e[i];let s=t&&t[n.id];s||("symbol"===n.type?s=n.id:(s=Ub(n),"line"===n.type&&n.paint&&Nb(n.paint["line-width"],"line-progress")&&(s+=`/${Ob(n.paint["line-width"])}`))),t&&(t[n.id]=s);let o=r[s];o||(o=r[s]=[]),o.push(n)}const n=[];for(const i in r)n.push(r[i]);return n}(Object.values(this._layerConfigs),this.keyCache);for(const i of n){const e=i.map(e=>this._layers[e.id]),t=e[0];if("none"===t.visibility)continue;const r=t.source||"";let n=this.familiesBySource[r];n||(n=this.familiesBySource[r]=/* @__PURE__ */Object.create(null));const s=t.sourceLayer||"_geojsonTileLayer";let o=n[s];o||(o=n[s]=[]),o.push(e)}}}class $b{constructor(e){const t={},r=[];for(const o in e){const n=e[o],i=t[o]={};for(const e in n.glyphs){const t=n.glyphs[+e];if(!t||0===t.bitmap.width||0===t.bitmap.height)continue;const s=t.metrics.localGlyph?2:1,o={x:0,y:0,w:t.bitmap.width+2*s,h:t.bitmap.height+2*s};r.push(o),i[e]=o}}const{w:n,h:i}=rm(r),s=new Ic({width:n||1,height:i||1});for(const o in e){const r=e[o];for(const e in r.glyphs){const n=r.glyphs[+e];if(!n||0===n.bitmap.width||0===n.bitmap.height)continue;const i=t[o][e],a=n.metrics.localGlyph?2:1;Ic.copy(n.bitmap,s,{x:0,y:0},{x:i.x+a,y:i.y+a},n.bitmap)}}this.image=s,this.positions=t}}function Gb(e,t,r){e[t]?r&&(e[t].center=r):e[t]={floorIds:/* @__PURE__ */new Set,center:r||[0,0],floors:{}}}function Xb(e,t,r,n){for(const i of t)Gb(e,i),e[i].floors[r]=n,e[i].floorIds.add(r)}function qb(e){return{id:e.properties.id.toString(),center:[e.properties.center_lon||0,e.properties.center_lat||0]}}function Hb(e,t){return{id:e.properties.id.toString(),isDefault:!!e.properties.is_default&&e.properties.is_default,connections:e.properties.connected_floor_ids?new Set(e.properties.connected_floor_ids.toString().split(";")):/* @__PURE__ */new Set,conflicts:e.properties.conflicted_floor_ids?new Set(e.properties.conflicted_floor_ids.toString().split(";")):/* @__PURE__ */new Set,buildings:e.properties.structure_ids?new Set(e.properties.structure_ids.toString().split(";")):/* @__PURE__ */new Set,name:e.properties.name.toString(),zIndex:e.properties.z_index,geometry:function(e,t){const r=e.loadGeometry();if(!r||0===r.length)return;const n=r.map(r=>r.map(r=>dn(r,t,e.extent)));return 0===n.length?void 0:{type:"Polygon",coordinates:[n[0]]}}(e,t)}}function Zb(e,t){return t.every(t=>e.properties&&null!=e.properties[t])}function Yb(e){return Zb(e,["type","id","name"])&&"structure"===e.properties.type}function Wb(e){return Zb(e,["type","id","name","z_index"])&&"floor"===e.properties.type}ps($b,"GlyphAtlas");class Jb{constructor(e){this.tileID=new Ju(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.tileZoom=e.tileZoom,this.uid=e.uid,this.zoom=e.zoom,this.lut=e.lut,this.canonical=e.tileID.canonical,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.scope=e.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=e.showCollisionBoxes,this.showElevationIdDebug=e.showElevationIdDebug,this.collectResourceTiming=!!e.request&&e.request.collectResourceTiming,this.promoteId=e.promoteId,this.renderSourceType=e.renderSourceType,this.tileTransform=uy(e.tileID.canonical,e.projection),this.projection=e.projection,this.worldview=e.worldview,this.localizableLayerIds=e.localizableLayerIds,this.brightness=e.brightness,this.extraShadowCaster=!!e.extraShadowCaster,this.tessellationStep=e.tessellationStep,this.scaleFactor=e.scaleFactor,this.worldview=e.worldview,this.indoor=e.indoor}parse(e,t,r,n,i,s){this.status="parsing",this.data=e,this.collisionBoxArray=new La;const o=new Gx(Object.keys(e.layers).sort()),a=new Xx(this.tileID,this.promoteId);a.bucketLayerIDs=[];const l={},u=new kd(256,256),c={featureIndex:a,iconDependencies:/* @__PURE__ */new Map,patternDependencies:/* @__PURE__ */new Map,glyphDependencies:{},lineAtlas:u,availableImages:r,brightness:this.brightness,scaleFactor:this.scaleFactor,showElevationIdDebug:this.showElevationIdDebug,elevationFeatures:void 0,activeFloors:void 0};this.indoor&&(c.activeFloors=function(e,t,r,n){const i=t.indoorState.activeFloorsVisible;if(!t.sourceLayers)return i?t.indoorState.activeFloors:void 0;const s=function(e,t){if(!e)return be("No source layers defined in indoor specification"),t;if(0===e.size)return t;const r=e.difference(t);for(const n of r)be(`Missing source layer required in indoor specification: ${n}`);return t.intersection(t)}(t.sourceLayers,new Set(Object.keys(e.layers))),o=t.indoorState,a=function(e,t,r,n,i){const s={};for(const o of t){const t=e.layers[o];if(t)for(let e=0;e<t.length;e++){const r=t.feature(e);if(Yb(r)){const{id:e,center:t}=qb(r);Gb(s,e,t);continue}if(Wb(r)){const e=Hb(r,i);Xb(s,e.buildings,e.id,e)}}else be(`indoor source layer not found: ${o}`)}return{buildings:s,activeFloors:Lb.calculate(s,n,r)}}(e,s,o.activeFloors,o.selectedFloorId,n);return r.send("setIndoorData",a),i?a.activeFloors:void 0}(e,this.indoor,i,this.canonical));const h=[],p=t.familiesBySource[this.source];for(const f in p){const t=e.layers[f];if(!t)continue;let i=!1,s=!1,u=!1,d=!1;for(const e of p[f])"symbol"===e[0].type?i=!0:"fill-extrusion"===e[0].type?s=!0:u=!0,e[0].is3D()&&"model"!==e[0].type&&(d=!0);if(this.extraShadowCaster&&!d)continue;if(this.renderSourceType===Wx&&!i)continue;if(this.renderSourceType===Jx&&!s)continue;if(this.renderSourceType===Yx&&!u)continue;1===t.version&&be(`Vector tile source "${this.source}" layer "${f}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const m=o.encode(f),y=[],g=this.localizableLayerIds&&this.localizableLayerIds.has(f);let x=!1;for(let e=0,r=0;e<t.length;e++){const n=t.feature(e),i=a.getId(n,f),s=n.properties?n.properties.worldview:null;if(g&&this.worldview&&"string"==typeof s)if("all"===s)n.properties.$localized=!0;else{if(!s.split(",").includes(this.worldview))continue;n.properties.$localized=!0,n.properties.worldview=this.worldview}!x&&n.properties&&Object.hasOwn(n.properties,au)&&(x=!0),y.push({feature:n,id:i,index:r,sourceLayerIndex:m}),r++}x&&!c.elevationFeatures&&Object.hasOwn(e.layers,uu)&&(c.elevationFeatures=Au.parseFrom(e.layers[uu],this.canonical));for(const e of p[f]){const t=e[0];if(this.extraShadowCaster&&(!t.is3D()||"model"===t.type))continue;if(this.renderSourceType===Wx&&"symbol"!==t.type)continue;if(this.renderSourceType===Jx&&"fill-extrusion"!==t.type)continue;if(this.renderSourceType===Yx&&("symbol"===t.type||"fill-extrusion"===t.type))continue;if(t.minzoom&&this.zoom<Math.floor(t.minzoom))continue;if(t.maxzoom&&this.zoom>=t.maxzoom)continue;if("none"===t.visibility)continue;Kb(e,this.zoom,c.brightness,r,this.worldview,c.activeFloors);const i=()=>{const i=l[t.id]=t.createBucket({index:a.bucketLayerIDs.length,layers:e,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:m,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:n,worldview:this.worldview,localizable:g,availableImages:r,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords,disableSymbolUBO:this.disableSymbolUBO});a.bucketLayerIDs.push(e.map(e=>Lo(e.id,e.scope))),i.populate(y,c,this.tileID.canonical,this.tileTransform)};if("prepare"in t){const e=t.prepare().then(()=>i());h.push(e)}else i()}}const d=()=>{u.trim();const t=!(!c.elevationFeatures||!c.elevationFeatures.some(e=>e.heightRange.min<0));let n,h,p,d,f,m,y;const g={type:"maybePrepare",renderSourceType:this.renderSourceType,zoom:this.zoom},x=()=>{if(n)return this.status="done",s(n);if(this.extraShadowCaster)this.status="done",s(null,{buckets:Object.values(l).filter(e=>!e.isEmpty()),featureIndex:a,collisionBoxArray:null,hasTunnelGeometry:t,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:c.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(h&&p&&d&&y){const e=void 0,t=new $b(h),n=/* @__PURE__ */new Map;for(const[r,i]of p.entries()){const{imagePosition:e}=dm(r,i,1);n.set(r,e)}const s={};for(const i in l){const e=l[i];e instanceof $y&&(Kb(e.layers,this.zoom,c.brightness,r,this.worldview,c.activeFloors),s[i]=Fm(e,h,t.positions,p,n,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,f,this.worldview,r))}const o={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(i,p,f,()=>{o.iconsPending=!1,v(s,t,o,e,y)}),this.rasterizeIfNeeded(i,d,m,()=>{o.patternsPending=!1,v(s,t,o,e,y)})}},v=(e,n,o,h,f)=>{if(o.iconsPending||o.patternsPending)return;const m=p.size>0||d.size>0,y=Object.keys(e).length>0;if(!m&&!y)return this.status="done",void s(null,{buckets:Object.values(l).filter(e=>!e.isEmpty()),featureIndex:a,collisionBoxArray:this.collisionBoxArray,hasTunnelGeometry:t,glyphAtlasImage:n.image,lineAtlas:u,imageAtlas:null,brightness:c.brightness});const g=(i,o)=>{for(const t in l){const n=l[t];if(t in e)qm(n,e[t],this.showCollisionBoxes,r,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,p,o);else if(n.hasPattern&&(n instanceof Cd||n instanceof Jh||n instanceof qp)){Kb(n.layers,this.zoom,c.brightness,r,this.worldview,c.activeFloors);const e=Object.fromEntries(o.patternPositions);n.addFeatures(c,this.tileID.canonical,e,r,this.tileTransform,this.brightness)}}this.status="done",s(null,{buckets:Object.values(l).filter(e=>!e.isEmpty()),featureIndex:a,collisionBoxArray:this.collisionBoxArray,hasTunnelGeometry:t,glyphAtlasImage:n.image,lineAtlas:u,imageAtlas:i,brightness:c.brightness})};if(m){const e=/* @__PURE__ */new Map,t=fm(p,e),r=fm(d,e),n=new am(t,r,f,this.lut,e);i.send("checkAtlasCache",{descriptor:n,scope:this.scope},(e,t)=>{let r,n;if(e&&be(`[Worker] Error checking atlas cache: ${e.message}`),t)r=new mm(t.sourceHash),n=t;else{const e=new ym(p,d,this.lut,f);r=e,n=e}g(r,n)})}else g(null,{iconPositions:/* @__PURE__ */new Map,patternPositions:/* @__PURE__ */new Map})};if(!this.extraShadowCaster){const e=ye(c.glyphDependencies,e=>Object.keys(e).map(Number));Object.keys(e).length?i.send("getGlyphs",{uid:this.uid,stacks:e},(e,t)=>{n||(n=e,h=t,x())},void 0,!1,g):h={},y=/* @__PURE__ */new Map;const t=Array.from(c.iconDependencies.keys()).map(e=>It.parse(e));t.length?i.send("getImages",{images:t,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(e,t)=>{if(!n){n=e,p=/* @__PURE__ */new Map,f=this.updateImageMapAndGetImageTaskQueue(p,t.images,c.iconDependencies);for(const[e,r]of t.versions.entries())y.set(e,r);x()}},void 0,!1,g):(p=/* @__PURE__ */new Map,f=/* @__PURE__ */new Map);const r=Array.from(c.patternDependencies.keys()).map(e=>It.parse(e));r.length?i.send("getImages",{images:r,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(e,t)=>{if(!n){n=e,d=/* @__PURE__ */new Map,m=this.updateImageMapAndGetImageTaskQueue(d,t.images,c.patternDependencies);for(const[e,r]of t.versions.entries())y.set(e,r);x()}},void 0,!1,g):(d=/* @__PURE__ */new Map,m=/* @__PURE__ */new Map)}if(c.elevationFeatures&&c.elevationFeatures.length>0){const t=[];for(const e of Object.values(l))if(e instanceof Jh){const r=e.getUnevaluatedPortalGraph();r&&t.push(r)}const r=lh.evaluate(t);for(const n of Object.values(l))if(n instanceof Jh){const t=e.layers[o.decode(n.sourceLayerIndex)];n.setEvaluatedPortalGraph(r,t,this.tileID.canonical,c.availableImages,c.brightness)}}x()};h.length>0?Promise.allSettled(h).then(d).catch(s):d()}updateParameters(e){this.scaleFactor=e.scaleFactor,this.showCollisionBoxes=e.showCollisionBoxes,this.showElevationIdDebug=e.showElevationIdDebug,this.projection=e.projection,this.brightness=e.brightness,this.tileTransform=uy(e.tileID.canonical,e.projection),this.extraShadowCaster=e.extraShadowCaster,this.lut=e.lut,this.worldview=e.worldview,this.indoor=e.indoor}rasterizeIfNeeded(e,t,r,n){Array.from(t.values()).some(e=>e.usvg)?this.rasterize(e,t,r,n):n()}updateImageMapAndGetImageTaskQueue(e,t,r){const n=/* @__PURE__ */new Map;for(const i of t.keys()){const s=r.get(i)||[];for(const r of s){const i=r.toString(),s=t.get(r.id.toString());s.usvg?n.has(i)||(n.set(i,r),e.set(i,Object.assign({},s))):e.set(i,s)}}return n}rasterize(e,t,r,n){this.rasterizeTask=e.send("rasterizeImages",{scope:this.scope,tasks:r},(e,r)=>{if(!e)for(const[n,i]of r.entries()){const e=Object.assign(t.get(n),{data:i});t.set(n,e)}n()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function Kb(e,t,r,n,i,s){const o=new lo(t,{brightness:r,worldview:i,activeFloors:s});for(const a of e)a.recalculate(o,n)}class Qb extends _t{constructor({actor:e,layerIndex:t,availableImages:r,availableModels:n,isSpriteLoaded:i,tileProvider:s,brightness:o,maxUniformBufferBindings:a,maxUniformBlockSizeDwords:l,disableSymbolUBO:u}){super(),this.actor=e,this.layerIndex=t,this.availableImages=r,this.availableModels=n,this.loadVectorData=wv,this.tileProvider=s,this.loading={},this.loaded={},this.deduped=new bv(e.scheduler),this.isSpriteLoaded=i,this.scheduler=e.scheduler,this.brightness=o,this.maxUniformBufferBindings=a,this.maxUniformBlockSizeDwords=l,this.disableSymbolUBO=u}loadTileData(e,t){if(!this.tileProvider)return this.loadVectorData(e,t);const r=new AbortController;return this.loadTileWithProvider(this.tileProvider,e,r,t),()=>r.abort()}async loadTileWithProvider(e,t,r,n){const{z:i,x:s,y:o}=t.tileID.canonical;try{const a=await e.loadTile({z:i,x:s,y:o},{request:t.request,signal:r.signal});if(r.signal.aborted)return;if(null==a){const e=new Error("Tile not found");return e.status=404,n(e)}if(null==a.data)return n(null,null);const l=/* @__PURE__ */new Map;a.expires&&l.set("expires",a.expires),a.cacheControl&&l.set("cache-control",a.cacheControl),n(null,{rawData:a.data,responseHeaders:l})}catch(a){if(r.signal.aborted)return;n(a instanceof Error?a:new Error(String(a)))}}loadTile(e,t){const r=e.uid,n=e&&e.request,i=n&&n.collectResourceTiming,s=this.loading[r]=new Jb(e);s.maxUniformBufferBindings=this.maxUniformBufferBindings,s.maxUniformBlockSizeDwords=this.maxUniformBlockSizeDwords,s.disableSymbolUBO=this.disableSymbolUBO,s.abort=this.loadTileData(e,(o,a)=>{const l=!this.loading[r];if(delete this.loading[r],s.cancelRasterize(),l||o||!a)return s.status="done",l||(this.loaded[r]=s),t(o);const u=a.rawData,c={},h=Se(a.responseHeaders);h&&h.expires&&(c.expires=h.expires),h&&h.cacheControl&&(c.cacheControl=h.cacheControl),s.vectorTile=a.vectorTile||new su(new df(u));const p=()=>{s.parse(s.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(e,r)=>{if(e||!r)return t(e);const s={};if(i){const e=Rb(n);e.length>0&&(s.resourceTiming=JSON.parse(JSON.stringify(e)))}t(null,Object.assign({rawTileData:u.slice(0),responseHeaders:a.responseHeaders},r,c,s))})};this.isSpriteLoaded?p():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(p,{type:"parseTile",renderSourceType:e.renderSourceType,zoom:e.tileZoom}):p()}),this.loaded=this.loaded||{},this.loaded[r]=s})}reloadTile(e,t){const r=this.loaded,n=e.uid;if(r&&r[n]){const i=r[n];i.updateParameters(e);const s=(e,r)=>{const n=i.reloadCallback;n&&(delete i.reloadCallback,i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,n)),t(e,r)};"parsing"===i.status?i.reloadCallback=s:"done"===i.status&&(i.vectorTile?i.parse(i.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,s):s())}else t(null,void 0)}abortTile(e,t){const r=e.uid,n=this.loading[r];n&&(n.abort&&n.abort(),delete this.loading[r]),t()}removeTile(e,t){const r=this.loaded,n=e.uid;r&&r[n]&&delete r[n],t()}}class ew{constructor(e){this.tileProvider=e.tileProvider,this.loading={}}loadTile(e,t){const r=e.uid;if(this.tileProvider){const n=new AbortController;return this.loading[r]={cancel:()=>n.abort()},void this.loadTileWithProvider(this.tileProvider,r,e,n,t)}const{cancel:n}=ot(e.request,(n,i,s)=>{const o=!this.loading[r];if(delete this.loading[r],o||n||!i)return t(n);this.decodeTile(r,i,e.encoding).then(e=>{const{expires:r,cacheControl:n}=Se(s);t(null,Object.assign(e,{expires:r,cacheControl:n}))}).catch(e=>t(e))});this.loading[r]={cancel:n}}async decodeTile(e,t,r){const n=await createImageBitmap(new Blob([new Uint8Array(t)],{type:"image/png"})),i=1-(n.width-function(e){return e<=1?1:Math.pow(2,Math.floor(Math.log2(e)))}(n.width))/2,s=i<1,o=this.getImageData(n,i);return n.close(),{dem:new Cv(e,o,r,s),borderReady:s}}async loadTileWithProvider(e,t,r,n,i){const{z:s,x:o,y:a}=r.tileID.canonical;try{const l=await e.loadTile({z:s,x:o,y:a},{request:r.request,signal:n.signal});if(n.signal.aborted)return i(null,null);if(null==l){const e=new Error("Tile not found");return e.status=404,i(e)}if(null==l.data)return i(null,null);const u=await this.decodeTile(t,l.data,r.encoding);if(n.signal.aborted)return i(null,null);i(null,Object.assign(u,{expires:l.expires,cacheControl:l.cacheControl}))}catch(l){if(n.signal.aborted)return i(null,null);if(l instanceof DOMException&&"AbortError"===l.name)return i(null,null);i(l instanceof Error?l:new Error(String(l)))}finally{delete this.loading[t]}}reloadTile(e,t){t(null,null)}abortTile(e,t){const r=e.uid,n=this.loading[r];n&&(n.cancel(),delete this.loading[r]),t()}removeTile(e,t){t()}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}}Mb.setPbf(df);class tw{constructor(e){this._mrt=new Mb(e.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=e.uid,this.tileID=e.tileID,this.source=e.source}parse(e,t){const r=this._mrt;this.status="parsing",this._entireBuffer=e;try{r.parseHeader(e),this._isHeaderLoaded=!0;const n=[];for(const t in r.layers){const i=r.getLayer(t),s=i.getDataRange(i.getBandList()),o=r.createDecodingTask(s),a=e.slice(s.firstByte,s.lastByte+1),l=Mb.performDecoding(a,o).then(e=>o.complete(null,e)).catch(e=>o.complete(e,null));n.push(l)}Promise.allSettled(n).then(()=>t(null,r)).catch(e=>t(e))}catch(n){t(n)}}}class rw{constructor({actor:e}){this.actor=e,this.loading={},this.loaded={}}loadTile(e,t){const r=e.uid,n=e.request,i=this.loading[r]=new tw(e),{cancel:s}=ot(n,(e,n,s)=>{const o=!this.loading[r];if(delete this.loading[r],o||e||!n)return i.status="done",o||(this.loaded[r]=i),t(e);i.parse(n,(e,r)=>{if(e||!r)return t(e);t(null,r,s)}),this.loaded[r]=i});i.abort=s}reloadTile(e,t){t(null,void 0)}abortTile(e,t){const r=e.uid,n=this.loading[r];n&&(n.abort&&n.abort(),delete this.loading[r]),t()}removeTile(e,t){const r=e.uid;this.loaded[r]&&delete this.loaded[r],t()}decodeRasterArray(e,t){Mb.performDecoding(e.buffer,e.task).then(e=>t(null,e)).catch(e=>t(e))}}const nw=eu.prototype.toGeoJSON;class iw{constructor(e){this._feature=e,this.extent=tn,this.type=e.type,this.properties=e.tags,"id"in e&&!isNaN(e.id)&&(this.id=parseInt(e.id,10))}loadGeometry(){if(1===this._feature.type){const e=[];for(const t of this._feature.geometry)e.push([new oe(t[0],t[1])]);return e}{const e=[];for(const t of this._feature.geometry){const r=[];for(const e of t)r.push(new oe(e[0],e[1]));e.push(r)}return e}}toGeoJSON(e,t,r){return nw.call(this,e,t,r)}}class sw{constructor(e,t){this.name=e,this.extent=tn,this.length=t.length,this._jsonFeatures=t}feature(e){return new iw(this._jsonFeatures[e])}}class ow{constructor(e){this.layers={},this.extent=tn;for(const t of Object.keys(e))this.layers[t]=new sw(t,e[t])}}const aw=64/4096;class lw{constructor(){this.features=/* @__PURE__ */new Map}clear(){this.features.clear()}load(e=[],t){for(const r of e){const e=r.id;if(null==e)continue;let n=this.features.get(e);n&&this.updateCache(n,t),r.geometry?(n=cw(r),this.updateCache(n,t),this.features.set(e,n)):this.features.delete(e),this.updateCache(n,t)}}updateCache(e,t){for(const{canonical:r,uid:n}of Object.values(t)){const{z:i,x:s,y:o}=r;uw(e,Math.pow(2,i),s,o)&&delete t[n]}}getTile(e,t,r){const n=Math.pow(2,e),i=[];for(const s of this.features.values())uw(s,n,t,r)&&i.push(fw(s,n,t,r));return{features:i}}getFeatures(){return[...this.features.values()]}}function uw({minX:e,minY:t,maxX:r,maxY:n},i,s,o){return e<(s+1+aw)/i&&t<(o+1+aw)/i&&r>(s-aw)/i&&n>(o-aw)/i}function cw(e){const{id:t,geometry:r,properties:n}=e;if(!r)return;if("GeometryCollection"===r.type)throw new Error("GeometryCollection not supported in dynamic mode.");const{type:i,coordinates:s}=r,o={id:t,type:1,geometry:[],tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},a=o.geometry;if("Point"===i)hw(s,a,o);else if("MultiPoint"===i)for(const l of s)hw(l,a,o);else if("LineString"===i)o.type=2,pw(s,a,o);else if("MultiLineString"===i)o.type=2,dw(s,a,o);else if("Polygon"===i)o.type=3,dw(s,a,o,!0);else{if("MultiPolygon"!==i)throw new Error("Input data is not a valid GeoJSON object.");o.type=3;for(const e of s)dw(e,a,o,!0)}return o}function hw([e,t],r,n){const i=Cl(e);let s=Fl(t);s=s<0?0:s>1?1:s,r.push(i,s),n.minX=Math.min(n.minX,i),n.minY=Math.min(n.minY,s),n.maxX=Math.max(n.maxX,i),n.maxY=Math.max(n.maxY,s)}function pw(e,t,r,n=!1,i=!1){const s=[];for(const o of e)hw(o,s,r);t.push(s),n&&function(e,t){let r=0;for(let n=0,i=e.length,s=i-2;n<i;s=n,n+=2)r+=(e[n]-e[s])*(e[n+1]+e[s+1]);if(r>0===t)for(let n=0,i=e.length;n<i/2;n+=2){const t=e[n],r=e[n+1];e[n]=e[i-2-n],e[n+1]=e[i-1-n],e[i-2-n]=t,e[i-1-n]=r}}(s,i)}function dw(e,t,r,n=!1){for(let i=0;i<e.length;i++)pw(e[i],t,r,n,0===i)}function fw(e,t,r,n){const{id:i,type:s,geometry:o,tags:a}=e,l=[];if(1===s)!function(e,t,r,n,i){for(let s=0;s<e.length;s+=2){const o=Math.round(tn*(e[s+0]*t-r)),a=Math.round(tn*(e[s+1]*t-n));i.push([o,a])}}(o,t,r,n,l);else if(2===s)for(const u of o)mw(u,t,r,n,l);else if(3===s)for(const u of o)yw(u,t,r,n,l);return{id:i,type:s,geometry:l,tags:a}}function mw(e,t,r,n,i){const s=-128,o=8320;let a;for(let l=0;l<e.length-2;l+=2){let u=Math.round(tn*(e[l+0]*t-r)),c=Math.round(tn*(e[l+1]*t-n)),h=Math.round(tn*(e[l+2]*t-r)),p=Math.round(tn*(e[l+3]*t-n));const d=h-u,f=p-c;u<s&&h<s||(u<s?(c+=Math.round(f*((s-u)/d)),u=s):h<s&&(p=c+Math.round(f*((s-u)/d)),h=s),c<s&&p<s||(c<s?(u+=Math.round(d*((s-c)/f)),c=s):p<s&&(h=u+Math.round(d*((s-c)/f)),p=s),u>=o&&h>=o||(u>=o?(c+=Math.round(f*((o-u)/d)),u=o):h>=o&&(p=c+Math.round(f*((o-u)/d)),h=o),c>=o&&p>=o||(c>=o?(u+=Math.round(d*((o-c)/f)),c=o):p>=o&&(h=u+Math.round(d*((o-c)/f)),p=o),a&&u===a.at(-1)[0]&&c===a.at(-1)[1]||(a=[[u,c]],i.push(a)),a.push([h,p])))))}}function yw(e,t,r,n,i){const s=(r-aw)/t,o=(n-aw)/t,a=(r+1+aw)/t,l=(n+1+aw)/t;function u(e,t){let r=0;return e<s?r|=1:e>a&&(r|=2),t<o?r|=4:t>l&&(r|=8),r}let c=[];for(let p=1;p<=8;p*=2){let t=e[e.length-2],r=e.at(-1),n=!(u(t,r)&p);for(let i=0;i<e.length;i+=2){const h=e[i],d=e[i+1],f=!(u(h,d)&p);f!==n&&(8&p?c.push(t+(h-t)*(l-r)/(d-r),l):4&p?c.push(t+(h-t)*(o-r)/(d-r),o):2&p?c.push(a,r+(d-r)*(a-t)/(h-t)):1&p&&c.push(s,r+(d-r)*(s-t)/(h-t))),f&&c.push(h,d),t=h,r=d,n=f}if(!(e=c).length||8===p)break;c=[]}const h=[];for(let p=0;p<c.length;p+=2)h.push([Math.round(tn*(c[p]*t-r)),Math.round(tn*(c[p+1]*t-n))]);h.length&&i.push(h)}function gw({name:e,features:t},r){r.writeStringField(1,e),r.writeVarintField(5,tn);const n=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map,s={keys:n,values:i,feature:null};for(const o of t)s.feature=o,r.writeMessage(2,xw,s);for(const o of n.keys())r.writeStringField(3,o);for(const o of i.keys())r.writeMessage(4,Iw,o)}function xw(e,t){const r=e.feature;void 0!==r.id&&Number.isSafeInteger(+r.id)&&t.writeVarintField(1,+r.id),r.tags&&t.writeMessage(2,vw,e),t.writeVarintField(3,r.type),t.writeMessage(4,_w,r)}function vw({keys:e,values:t,feature:r},n){for(const i of Object.keys(r.tags)){let s=r.tags[i];if(null===s)continue;let o=e.get(i);void 0===o&&(o=e.size,e.set(i,o)),n.writeVarint(o);const a=typeof s;"string"!==a&&"boolean"!==a&&"number"!==a&&(s=JSON.stringify(s));let l=t.get(s);void 0===l&&(l=t.size,t.set(s,l)),n.writeVarint(l)}}function bw(e,t){return(t<<3)+(7&e)}function ww(e){return e<<1^e>>31}function _w(e,t){const{geometry:r,type:n}=e;let i=0,s=0;if(1===n){t.writeVarint(bw(1,r.length));for(const e of r){const r=e[0]-i,n=e[1]-s;t.writeVarint(ww(r)),t.writeVarint(ww(n)),i+=r,s+=n}}else for(const o of r){if(0===o.length)continue;t.writeVarint(bw(1,1));const e=o.length-(3===n?1:0);for(let r=0;r<e;r++){1===r&&t.writeVarint(bw(2,e-1));const n=o[r][0]-i,a=o[r][1]-s;t.writeVarint(ww(n)),t.writeVarint(ww(a)),i+=n,s+=a}3===n&&t.writeVarint(bw(7,1))}}function Iw(e,t){const r=typeof e;"string"===r?t.writeStringField(1,e):"boolean"===r?t.writeBooleanField(7,e):"number"===r&&(e%1!=0?t.writeDoubleField(3,e):e<0?t.writeSVarintField(6,e):t.writeVarintField(5,e))}const Aw={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:e=>e},Sw=Math.fround||(Mw=new Float32Array(1),e=>(Mw[0]=+e,Mw[0]));var Mw;class Bw{constructor(e){this.options=Object.assign(Object.create(Aw),e),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(e){const{log:t,minZoom:r,maxZoom:n}=this.options;e.length;this.points=e;const i=[];for(let o=0;o<e.length;o++){const t=e[o];if(!t.geometry)continue;const[r,n]=t.geometry.coordinates,s=Sw(Tw(r)),a=Sw(kw(n));i.push(s,a,1/0,o,-1,1),this.options.reduce&&i.push(0)}let s=this.trees[n+1]=this._createTree(i);for(let o=n;o>=r;o--){Date.now();s=this.trees[o]=this._createTree(this._cluster(s,o))}return this}getClusters(e,t){let r=((e[0]+180)%360+360)%360-180;const n=Math.max(-90,Math.min(90,e[1]));let i=180===e[2]?180:((e[2]+180)%360+360)%360-180;const s=Math.max(-90,Math.min(90,e[3]));if(e[2]-e[0]>=360)r=-180,i=180;else if(r>i){const e=this.getClusters([r,n,180,s],t),o=this.getClusters([-180,n,i,s],t);return e.concat(o)}const o=this.trees[this._limitZoom(t)],a=o.range(Tw(r),kw(s),Tw(i),kw(n)),l=o.data,u=[];for(const c of a){const e=this.stride*c;u.push(l[e+5]>1?Pw(l,e,this.clusterProps):this.points[l[e+3]])}return u}getChildren(e){const t=this._getOriginId(e),r=this._getOriginZoom(e),n="No cluster with the specified id.",i=this.trees[r];if(!i)throw new Error(n);const s=i.data;if(t*this.stride>=s.length)throw new Error(n);const o=this.options.radius/(this.options.extent*Math.pow(2,r-1)),a=i.within(s[t*this.stride],s[t*this.stride+1],o),l=[];for(const u of a){const t=u*this.stride;s[t+4]===e&&l.push(s[t+5]>1?Pw(s,t,this.clusterProps):this.points[s[t+3]])}if(0===l.length)throw new Error(n);return l}getLeaves(e,t,r){const n=[];return this._appendLeaves(n,e,t=t||10,r=r||0,0),n}getTile(e,t,r){const n=this.trees[this._limitZoom(e)],i=Math.pow(2,e),{extent:s,radius:o}=this.options,a=o/s,l=(r-a)/i,u=(r+1+a)/i,c={features:[]};return this._addTileFeatures(n.range((t-a)/i,l,(t+1+a)/i,u),n.data,t,r,i,c),0===t&&this._addTileFeatures(n.range(1-a/i,l,1,u),n.data,i,r,i,c),t===i-1&&this._addTileFeatures(n.range(0,l,a/i,u),n.data,-1,r,i,c),c.features.length?c: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,n,i){const s=this.getChildren(t);for(const o of s){const t=o.properties;if(t&&t.cluster?i+t.point_count<=n?i+=t.point_count:i=this._appendLeaves(e,t.cluster_id,r,n,i):i<n?i++:e.push(o),e.length===r)break}return i}_createTree(e){const t=new kb(e.length/this.stride|0,this.options.nodeSize,Float32Array);for(let r=0;r<e.length;r+=this.stride)t.add(e[r],e[r+1]);return t.finish(),t.data=e,t}_addTileFeatures(e,t,r,n,i,s){for(const o of e){const e=o*this.stride,a=t[e+5]>1;let l,u,c;if(a)l=zw(t,e,this.clusterProps),u=t[e],c=t[e+1];else{const r=this.points[t[e+3]];l=r.properties;const[n,i]=r.geometry.coordinates;u=Tw(n),c=kw(i)}const h={type:1,geometry:[[Math.round(this.options.extent*(u*i-r)),Math.round(this.options.extent*(c*i-n))]],tags:l};let p;p=a||this.options.generateId?t[e+3]:this.points[t[e+3]].id,void 0!==p&&(h.id=p),s.features.push(h)}}_limitZoom(e){return Math.max(this.options.minZoom,Math.min(Math.floor(+e),this.options.maxZoom+1))}_cluster(e,t){const{radius:r,extent:n,reduce:i,minPoints:s}=this.options,o=r/(n*Math.pow(2,t)),a=e.data,l=[],u=this.stride;for(let c=0;c<a.length;c+=u){if(a[c+2]<=t)continue;a[c+2]=t;const r=a[c],n=a[c+1],h=e.within(a[c],a[c+1],o),p=a[c+5];let d=p;for(const e of h){const r=e*u;a[r+2]>t&&(d+=a[r+5])}if(d>p&&d>=s){let e,s=r*p,o=n*p,f=-1;const m=(c/u<<5)+(t+1)+this.points.length;for(const r of h){const n=r*u;if(a[n+2]<=t)continue;a[n+2]=t;const l=a[n+5];s+=a[n]*l,o+=a[n+1]*l,a[n+4]=m,i&&(e||(e=this._map(a,c,!0),f=this.clusterProps.length,this.clusterProps.push(e)),i(e,this._map(a,n)))}a[c+4]=m,l.push(s/d,o/d,1/0,m,-1,d),i&&l.push(f)}else{for(let e=0;e<u;e++)l.push(a[c+e]);if(d>1)for(const e of h){const r=e*u;if(!(a[r+2]<=t)){a[r+2]=t;for(let e=0;e<u;e++)l.push(a[r+e])}}}}return l}_getOriginId(e){return e-this.points.length>>5}_getOriginZoom(e){return(e-this.points.length)%32}_map(e,t,r){if(e[t+5]>1){const n=this.clusterProps[e[t+6]];return r?Object.assign({},n):n}const n=this.points[e[t+3]].properties,i=this.options.map(n);return r&&i===n?Object.assign({},i):i}}function Pw(e,t,r){return{type:"Feature",id:e[t+3],properties:zw(e,t,r),geometry:{type:"Point",coordinates:[(n=e[t],360*(n-.5)),Vw(e[t+1])]}};var n}function zw(e,t,r){const n=e[t+5],i=n>=1e4?`${Math.round(n/1e3)}k`:n>=1e3?Math.round(n/100)/10+"k":n,s=e[t+6],o=-1===s?{}:Object.assign({},r[s]);return Object.assign(o,{cluster:!0,cluster_id:e[t+3],point_count:n,point_count_abbreviated:i})}function Tw(e){return e/360+.5}function kw(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 Vw(e){const t=(180-360*e)*Math.PI/180;return 360*Math.atan(Math.exp(t))/Math.PI-90}function Ew(e,t,r,n){let i=n;const s=t+(r-t>>1);let o,a=r-t;const l=e[t],u=e[t+1],c=e[r],h=e[r+1];for(let p=t+3;p<r;p+=3){const t=Dw(e[p],e[p+1],l,u,c,h);if(t>i)o=p,i=t;else if(t===i){const e=Math.abs(p-s);e<a&&(o=p,a=e)}}i>n&&(o-t>3&&Ew(e,t,o,n),e[o+2]=i,r-o>3&&Ew(e,o,r,n))}function Dw(e,t,r,n,i,s){let o=i-r,a=s-n;if(0!==o||0!==a){const l=((e-r)*o+(t-n)*a)/(o*o+a*a);l>1?(r=i,n=s):l>0&&(r+=o*l,n+=a*l)}return o=e-r,a=t-n,o*o+a*a}function Cw(e,t,r,n){const i={id:e??null,type:t,geometry:r,tags:n,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if("Point"===t||"MultiPoint"===t||"LineString"===t)Fw(i,r);else if("Polygon"===t)Fw(i,r[0]);else if("MultiLineString"===t)for(const s of r)Fw(i,s);else if("MultiPolygon"===t)for(const s of r)Fw(i,s[0]);return i}function Fw(e,t){for(let r=0;r<t.length;r+=3)e.minX=Math.min(e.minX,t[r]),e.minY=Math.min(e.minY,t[r+1]),e.maxX=Math.max(e.maxX,t[r]),e.maxY=Math.max(e.maxY,t[r+1])}function Lw(e,t,r,n){if(!t.geometry)return;const i=t.geometry.coordinates;if(i&&0===i.length)return;const s=t.geometry.type,o=Math.pow(r.tolerance/((1<<r.maxZoom)*r.extent),2);let a=[],l=t.id;if(r.promoteId?l=t.properties[r.promoteId]:r.generateId&&(l=n||0),"Point"===s)Rw(i,a);else if("MultiPoint"===s)for(const u of i)Rw(u,a);else if("LineString"===s)Ow(i,a,o,!1);else if("MultiLineString"===s){if(r.lineMetrics){for(const r of i)a=[],Ow(r,a,o,!1),e.push(Cw(l,"LineString",a,t.properties));return}Uw(i,a,o,!1)}else if("Polygon"===s)Uw(i,a,o,!0);else{if("MultiPolygon"!==s){if("GeometryCollection"===s){for(const i of t.geometry.geometries)Lw(e,{id:l,geometry:i,properties:t.properties},r,n);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const e of i){const t=[];Uw(e,t,o,!0),a.push(t)}}e.push(Cw(l,s,a,t.properties))}function Rw(e,t){t.push(Nw(e[0]),jw(e[1]),0)}function Ow(e,t,r,n){let i,s,o=0;for(let l=0;l<e.length;l++){const r=Nw(e[l][0]),a=jw(e[l][1]);t.push(r,a,0),l>0&&(o+=n?(i*a-r*s)/2:Math.sqrt(Math.pow(r-i,2)+Math.pow(a-s,2))),i=r,s=a}const a=t.length-3;t[2]=1,Ew(t,0,a,r),t[a+2]=1,t.size=Math.abs(o),t.start=0,t.end=t.size}function Uw(e,t,r,n){for(let i=0;i<e.length;i++){const s=[];Ow(e[i],s,r,n),t.push(s)}}function Nw(e){return e/360+.5}function jw(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 $w(e,t,r,n,i,s,o,a){if(n/=t,s>=(r/=t)&&o<n)return e;if(o<r||s>=n)return null;const l=[];for(const u of e){const e=u.geometry;let t=u.type;const s=0===i?u.minX:u.minY,o=0===i?u.maxX:u.maxY;if(s>=r&&o<n){l.push(u);continue}if(o<r||s>=n)continue;let c=[];if("Point"===t||"MultiPoint"===t)Gw(e,c,r,n,i);else if("LineString"===t)Xw(e,c,r,n,i,!1,a.lineMetrics);else if("MultiLineString"===t)Hw(e,c,r,n,i,!1);else if("Polygon"===t)Hw(e,c,r,n,i,!0);else if("MultiPolygon"===t)for(const a of e){const e=[];Hw(a,e,r,n,i,!0),e.length&&c.push(e)}if(c.length){if(a.lineMetrics&&"LineString"===t){for(const e of c)l.push(Cw(u.id,t,e,u.tags));continue}"LineString"!==t&&"MultiLineString"!==t||(1===c.length?(t="LineString",c=c[0]):t="MultiLineString"),"Point"!==t&&"MultiPoint"!==t||(t=3===c.length?"Point":"MultiPoint"),l.push(Cw(u.id,t,c,u.tags))}}return l.length?l:null}function Gw(e,t,r,n,i){for(let s=0;s<e.length;s+=3){const o=e[s+i];o>=r&&o<=n&&Zw(t,e[s],e[s+1],e[s+2])}}function Xw(e,t,r,n,i,s,o){let a=qw(e);const l=0===i?Yw:Ww;let u,c,h=e.start;for(let y=0;y<e.length-3;y+=3){const p=e[y],d=e[y+1],f=e[y+2],m=e[y+3],g=e[y+4],x=0===i?p:d,v=0===i?m:g;let b=!1;o&&(u=Math.sqrt(Math.pow(p-m,2)+Math.pow(d-g,2))),x<r?v>r&&(c=l(a,p,d,m,g,r),o&&(a.start=h+u*c)):x>n?v<n&&(c=l(a,p,d,m,g,n),o&&(a.start=h+u*c)):Zw(a,p,d,f),v<r&&x>=r&&(c=l(a,p,d,m,g,r),b=!0),v>n&&x<=n&&(c=l(a,p,d,m,g,n),b=!0),!s&&b&&(o&&(a.end=h+u*c),t.push(a),a=qw(e)),o&&(h+=u)}let p=e.length-3;const d=e[p],f=e[p+1],m=0===i?d:f;m>=r&&m<=n&&Zw(a,d,f,e[p+2]),p=a.length-3,s&&p>=3&&(a[p]!==a[0]||a[p+1]!==a[1])&&Zw(a,a[0],a[1],a[2]),a.length&&t.push(a)}function qw(e){const t=[];return t.size=e.size,t.start=e.start,t.end=e.end,t}function Hw(e,t,r,n,i,s){for(const o of e)Xw(o,t,r,n,i,s,!1)}function Zw(e,t,r,n){e.push(t,r,n)}function Yw(e,t,r,n,i,s){const o=(s-t)/(n-t);return Zw(e,s,r+(i-r)*o,1),o}function Ww(e,t,r,n,i,s){const o=(s-r)/(i-r);return Zw(e,t+(n-t)*o,s,1),o}function Jw(e,t){const r=[];for(let n=0;n<e.length;n++){const i=e[n],s=i.type;let o;if("Point"===s||"MultiPoint"===s||"LineString"===s)o=Kw(i.geometry,t);else if("MultiLineString"===s||"Polygon"===s){o=[];for(const e of i.geometry)o.push(Kw(e,t))}else if("MultiPolygon"===s){o=[];for(const e of i.geometry){const r=[];for(const n of e)r.push(Kw(n,t));o.push(r)}}r.push(Cw(i.id,s,o,i.tags))}return r}function Kw(e,t){const r=[];r.size=e.size,void 0!==e.start&&(r.start=e.start,r.end=e.end);for(let n=0;n<e.length;n+=3)r.push(e[n]+t,e[n+1],e[n+2]);return r}function Qw(e,t){if(e.transformed)return e;const r=1<<e.z,n=e.x,i=e.y;for(const s of e.features){const e=s.geometry,o=s.type;if(s.geometry=[],1===o)for(let a=0;a<e.length;a+=2)s.geometry.push(e_(e[a],e[a+1],t,r,n,i));else for(let a=0;a<e.length;a++){const o=[];for(let s=0;s<e[a].length;s+=2)o.push(e_(e[a][s],e[a][s+1],t,r,n,i));s.geometry.push(o)}}return e.transformed=!0,e}function e_(e,t,r,n,i,s){return[Math.round(r*(e*n-i)),Math.round(r*(t*n-s))]}function t_(e,t,r,n,i){const s=t===i.maxZoom?0:i.tolerance/((1<<t)*i.extent),o={features:[],numPoints:0,numSimplified:0,numFeatures:e.length,source:null,x:r,y:n,z:t,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const a of e)r_(o,a,s,i);return o}function r_(e,t,r,n){const i=t.geometry,s=t.type,o=[];if(e.minX=Math.min(e.minX,t.minX),e.minY=Math.min(e.minY,t.minY),e.maxX=Math.max(e.maxX,t.maxX),e.maxY=Math.max(e.maxY,t.maxY),"Point"===s||"MultiPoint"===s)for(let a=0;a<i.length;a+=3)o.push(i[a],i[a+1]),e.numPoints++,e.numSimplified++;else if("LineString"===s)n_(o,i,e,r,!1,!1);else if("MultiLineString"===s||"Polygon"===s)for(let a=0;a<i.length;a++)n_(o,i[a],e,r,"Polygon"===s,0===a);else if("MultiPolygon"===s)for(let a=0;a<i.length;a++){const t=i[a];for(let n=0;n<t.length;n++)n_(o,t[n],e,r,!0,0===n)}if(o.length){let r=t.tags||null;if("LineString"===s&&n.lineMetrics){r={};for(const e in t.tags)r[e]=t.tags[e];r.mapbox_clip_start=i.start/i.size,r.mapbox_clip_end=i.end/i.size}const a={geometry:o,type:"Polygon"===s||"MultiPolygon"===s?3:"LineString"===s||"MultiLineString"===s?2:1,tags:r};null!==t.id&&(a.id=t.id),e.features.push(a)}}function n_(e,t,r,n,i,s){const o=n*n;if(n>0&&t.size<(i?o:n))return void(r.numPoints+=t.length/3);const a=[];for(let l=0;l<t.length;l+=3)(0===n||t[l+2]>o)&&(r.numSimplified++,a.push(t[l],t[l+1])),r.numPoints++;i&&function(e,t){let r=0;for(let n=0,i=e.length,s=i-2;n<i;s=n,n+=2)r+=(e[n]-e[s])*(e[n+1]+e[s+1]);if(r>0===t)for(let n=0,i=e.length;n<i/2;n+=2){const t=e[n],r=e[n+1];e[n]=e[i-2-n],e[n+1]=e[i-1-n],e[i-2-n]=t,e[i-1-n]=r}}(a,s),e.push(a)}const i_={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class s_{constructor(e,t){const r=(t=this.options=function(e,t){for(const r in t)e[r]=t[r];return e}(Object.create(i_),t)).debug;if(t.maxZoom<0||t.maxZoom>24)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.");let n=function(e,t){const r=[];if("FeatureCollection"===e.type)for(let n=0;n<e.features.length;n++)Lw(r,e.features[n],t,n);else Lw(r,"Feature"===e.type?e:{geometry:e},t);return r}(e,t);this.tiles={},this.tileCoords=[],r&&(this.stats={},this.total=0),n=function(e,t){const r=t.buffer/t.extent;let n=e;const i=$w(e,1,-1-r,r,0,-1,2,t),s=$w(e,1,1-r,2+r,0,-1,2,t);return(i||s)&&(n=$w(e,1,-r,1+r,0,-1,2,t)||[],i&&(n=Jw(i,1).concat(n)),s&&(n=n.concat(Jw(s,-1)))),n}(n,t),n.length&&this.splitTile(n,0,0,0),r&&n.length}splitTile(e,t,r,n,i,s,o){const a=[e,t,r,n],l=this.options,u=l.debug;for(;a.length;){n=a.pop(),r=a.pop(),t=a.pop(),e=a.pop();const c=1<<t,h=o_(t,r,n);let p=this.tiles[h];if(!p&&(p=this.tiles[h]=t_(e,t,r,n,l),this.tileCoords.push({z:t,x:r,y:n}),u)){const e=`z${t}`;this.stats[e]=(this.stats[e]||0)+1,this.total++}if(p.source=e,null==i){if(t===l.indexMaxZoom||p.numPoints<=l.indexMaxPoints)continue}else{if(t===l.maxZoom||t===i)continue;if(null!=i){const e=i-t;if(r!==s>>e||n!==o>>e)continue}}if(p.source=null,0===e.length)continue;const d=.5*l.buffer/l.extent,f=.5-d,m=.5+d,y=1+d;let g=null,x=null,v=null,b=null,w=$w(e,c,r-d,r+m,0,p.minX,p.maxX,l),_=$w(e,c,r+f,r+y,0,p.minX,p.maxX,l);e=null,w&&(g=$w(w,c,n-d,n+m,1,p.minY,p.maxY,l),x=$w(w,c,n+f,n+y,1,p.minY,p.maxY,l),w=null),_&&(v=$w(_,c,n-d,n+m,1,p.minY,p.maxY,l),b=$w(_,c,n+f,n+y,1,p.minY,p.maxY,l),_=null),a.push(g||[],t+1,2*r,2*n),a.push(x||[],t+1,2*r,2*n+1),a.push(v||[],t+1,2*r+1,2*n),a.push(b||[],t+1,2*r+1,2*n+1)}}getTile(e,t,r){e=+e,t=+t,r=+r;const n=this.options,{extent:i,debug:s}=n;if(e<0||e>24)return null;const o=1<<e,a=o_(e,t=t+o&o-1,r);if(this.tiles[a])return Qw(this.tiles[a],i);let l,u=e,c=t,h=r;for(;!l&&u>0;)u--,c>>=1,h>>=1,l=this.tiles[o_(u,c,h)];return l&&l.source?(this.splitTile(l.source,u,c,h,e,t,r),this.tiles[a]?Qw(this.tiles[a],i):null):null}}function o_(e,t,r){return 32*((1<<e)*r+t)+e}function a_(e,t){const r=e.tileID.canonical;if(!this._geoJSONIndex)return void t(null,null);const n=this._geoJSONIndex.getTile(r.z,r.x,r.y);if(!n)return void t(null,null);const i=e=>e.tags&&"3d_elevation_id"in e.tags&&"source"in e.tags&&"elevation"===e.tags.source,s=n.features.filter(e=>i(e));let o={_geojsonTileLayer:n.features};s.length>0&&(o={_geojsonTileLayer:n.features.filter(e=>!i(e)),hd_road_elevation:s});t(null,{vectorTile:new ow(o),rawData:function(e){const t=new df;for(const r of Object.keys(e))t.writeMessage(3,gw,{name:r,features:e[r]});return t.finish()}(o).buffer})}class l_ extends Qb{constructor(e){super(e),this.loadVectorData=a_,this._dynamicIndex=new lw}loadData(e,t){const r=e&&e.request,n=r&&r.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(e,(i,s)=>{if(i||!s)return t(i);if("object"!=typeof s)return t(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));{try{if(e.filter){const t=ts(e.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if("error"===t.result)throw new Error(t.value.map(e=>`${e.key}: ${e.message}`).join(", "));s.features=s.features.filter(e=>t.value.evaluate({zoom:0},e))}e.dynamic?("Feature"===s.type&&(s={type:"FeatureCollection",features:[s]}),e.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(s.features,this.loaded),e.cluster&&(s.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=e.cluster?new Bw(function({superclusterOptions:e,clusterProperties:t}){if(!t||!e)return e;const r={},n={},i={accumulated:null,zoom:0},s={properties:null},o=Object.keys(t);for(const a of o){const[e,i]=t[a],s=ts(i),o=ts("string"==typeof e?[e,["accumulated"],["get",a]]:e);r[a]=s.value,n[a]=o.value}return e.map=e=>{s.properties=e;const t={};for(const n of o)t[n]=r[n].evaluate(i,s);return t},e.reduce=(e,t)=>{s.properties=t;for(const r of o)i.accumulated=e[r],e[r]=n[r].evaluate(i,s)},e}(e)).load(s.features):e.dynamic?this._dynamicIndex:(o=s,a=e.geojsonVtOptions,new s_(o,a))}catch(o){return t(o)}const i={};if(n){const t=Rb(r);t&&(i.resourceTiming={},i.resourceTiming[e.source]=JSON.parse(JSON.stringify(t)))}t(null,i)}var o,a})}reloadTile(e,t){const r=this.loaded;return r&&r[e.uid]?e.partial?t(null,void 0):super.reloadTile(e,t):this.loadTile(e,t)}loadGeoJSON(e,t){if(e.request)!function(e,t){st(Object.assign(e,{type:"json"}),t)}(e.request,t);else{if("string"!=typeof e.data)return t(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return t(null,JSON.parse(e.data))}catch(r){return t(new Error(`Input data given to '${e.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(e,t){try{t(null,this._geoJSONIndex.getClusterExpansionZoom(e.clusterId))}catch(r){t(r)}}getClusterChildren(e,t){try{t(null,this._geoJSONIndex.getChildren(e.clusterId))}catch(r){t(r)}}getClusterLeaves(e,t){try{t(null,this._geoJSONIndex.getLeaves(e.clusterId,e.limit,e.offset))}catch(r){t(r)}}}class u_{constructor(e,t,r){this.tileID=new Ju(e.tileID.overscaledZ,e.tileID.wrap,e.tileID.canonical.z,e.tileID.canonical.x,e.tileID.canonical.y),this.tileZoom=e.tileZoom,this.uid=e.uid,this.zoom=e.zoom,this.canonical=e.tileID.canonical,this.pixelRatio=e.pixelRatio,this.tileSize=e.tileSize,this.source=e.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=e.projection,this.brightness=t,this.worldview=r}parse(e,t,r,n){this.status="parsing";const i=new Ju(r.tileID.overscaledZ,r.tileID.wrap,r.tileID.canonical.z,r.tileID.canonical.x,r.tileID.canonical.y),s=[],o=t.familiesBySource[r.source],a=new Xx(i,r.promoteId);a.bucketLayerIDs=[],a.is3DTile=!0,function(e){let t=0;if(new Uint32Array(e,0,1)[0]!==vx){const r=new Uint32Array(e,0,7),[,,n,i,s,o]=r;t=r.byteLength+i+s+o+s,(n!==e.byteLength||t>=e.byteLength)&&be("Invalid b3dm header information.")}return Sx(e,t)}(e).then(e=>{const t=e.json.extensionsUsed&&e.json.extensionsUsed.includes("MAPBOX_mesh_features")||e.json.asset.extras&&e.json.asset.extras.MAPBOX_mesh_features,l=e.json.extensionsUsed&&e.json.extensionsUsed.includes("EXT_meshopt_compression"),u=new lo(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const n in o)for(const c of o[n]){const n=c[0];a.bucketLayerIDs.push(c.map(e=>Lo(e.id,e.scope))),n.recalculate(u,[]);const o=Dx(e,1/$l(r.tileID.canonical)),h=new Yg(c,o,i,t,l,this.brightness,a,this.worldview);t||(h.needsUpload=!0),s.push(h),h.evaluate(n)}this.status="done",n(null,{buckets:s,featureIndex:a,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(e=>n(new Error(e.message)))}}class c_{constructor({actor:e,layerIndex:t,availableImages:r,availableModels:n,brightness:i,worldview:s}){this.actor=e,this.layerIndex=t,this.availableImages=r,this.availableModels=n,this.brightness=i,this.loading={},this.loaded={},this.worldview=s}loadTile(e,t){const r=e.uid,n=this.loading[r]=new u_(e,this.brightness,this.worldview);ot(e.request,(i,s)=>{const o=!this.loading[r];return delete this.loading[r],o||i?(n.status="done",o||(this.loaded[r]=n),t(i)):s&&0!==s.byteLength?void n.parse(s,this.layerIndex,e,(e,i)=>{n.status="done",this.loaded=this.loaded||{},this.loaded[r]=n,e||!i?t(e):t(null,i)}):(n.status="done",this.loaded[r]=n,t())})}reloadTile(e,t){const r=this.loaded,n=e.uid;if(r&&r[n]){const i=r[n];i.projection=e.projection,i.brightness=e.brightness;const s=(r,n)=>{i.reloadCallback&&(delete i.reloadCallback,this.loadTile(e,t)),t(r,n)};"parsing"===i.status?i.reloadCallback=s:"done"===i.status&&this.loadTile(e,t)}}abortTile(e,t){const r=e.uid;this.loading[r]&&delete this.loading[r],t()}removeTile(e,t){const r=this.loaded,n=e.uid;r&&r[n]&&delete r[n],t()}}Ie(self)&&(self.worker=new class{constructor(e){this.self=e,this.actor=new Qx(e,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new vv,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=Ty({name:"mercator"}),this.workerSourceTypes={vector:Qb,geojson:l_,"raster-dem":ew,"raster-array":rw,"batched-model":c_},this.workerSources={},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=e=>{if(ao.isParsed())throw new Error("RTL text plugin already registered.");ao.setState({pluginStatus:to,pluginURL:ao.getPluginURL()}),ao.applyArabicShaping=e.applyArabicShaping,ao.processBidirectionalText=e.processBidirectionalText,ao.processStyledBidirectionalText=e.processStyledBidirectionalText;for(const t of this.rtlPluginParsingListeners)t(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(e,t,r){delete this.layerIndexes[e],delete this.availableImages[e],delete this.availableModels[e],delete this.workerSources[e],r()}checkIfReady(e,t,r){r()}setReferrer(e,t){this.referrer=t}spriteLoaded(e,t){this.isSpriteLoaded[e]||(this.isSpriteLoaded[e]={});const{scope:r,isLoaded:n}=t;if(this.isSpriteLoaded[e][r]=n,this.workerSources[e]&&this.workerSources[e][r])for(const i in this.workerSources[e][r]){const t=this.workerSources[e][r][i];for(const e in t){const r=t[e];r instanceof Qb&&(r.isSpriteLoaded=n,r.fire(new xt("isSpriteLoaded")))}}}setImages(e,t,r){this.availableImages[e]||(this.availableImages[e]={});const{scope:n,images:i}=t;if(this.availableImages[e][n]=i,this.workerSources[e]&&this.workerSources[e][n]){for(const t in this.workerSources[e][n]){const r=this.workerSources[e][n][t];for(const e in r)r[e].availableImages=i}r()}else r()}setModels(e,{scope:t,models:r},n){if(this.availableModels[e]||(this.availableModels[e]={}),this.availableModels[e][t]=r,this.workerSources[e]&&this.workerSources[e][t]){for(const n in this.workerSources[e][t]){const i=this.workerSources[e][t][n];for(const e in i)i[e].availableModels=r}n()}else n()}setProjection(e,t){this.projections[e]=Ty(t)}setBrightness(e,t,r){this.brightness=t,r()}setContextParams(e,t,r){this.maxUniformBufferBindings=t.maxBindingPoints,this.maxUniformBlockSizeDwords=t.maxUniformBlockSizeDwords,this.disableSymbolUBO=t.disableSymbolUBO,r()}setWorldview(e,t,r){this.worldview=t,r()}setLayers(e,t,r){this.getLayerIndex(e,t.scope).replace(t.layers,t.options),r()}updateLayers(e,t,r){this.getLayerIndex(e,t.scope).update(t.layers,t.removedIds,t.options),r()}loadTile(e,t,r){t.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,t).loadTile(t,r)}decodeRasterArray(e,t,r){this.getWorkerSource(e,t).decodeRasterArray(t,r)}reloadTile(e,t,r){t.projection=this.projections[e]||this.defaultProjection,this.getWorkerSource(e,t).reloadTile(t,r)}abortTile(e,t,r){this.getWorkerSource(e,t).abortTile(t,r)}removeTile(e,t,r){this.getWorkerSource(e,t).removeTile(t,r)}removeSource(e,t,r){if(!(this.workerSources[e]&&this.workerSources[e][t.scope]&&this.workerSources[e][t.scope][t.type]&&this.workerSources[e][t.scope][t.type][t.source]))return;const n=this.workerSources[e][t.scope][t.type][t.source];delete this.workerSources[e][t.scope][t.type][t.source],void 0!==n.removeSource?n.removeSource(t,r):r()}loadTileProvider(e,t,r){(async function(e,t){const r=Iv.get(e);if(r)return r;const n=_v.get(e);if(void 0!==n)return n;const i=import(t).catch(t=>{throw new Error(`TileProvider "${e}" failed to load: ${t instanceof Error?t.message:String(t)}`)}).then(t=>{const r=t.default;if("function"!=typeof r)throw new Error(`TileProvider "${e}" module must default-export a class`);if("function"!=typeof r.prototype.loadTile)throw new Error(`TileProvider "${e}" class must have a loadTile method`);return Iv.set(e,r),r}).finally(()=>{_v.delete(e)});return _v.set(e,i),i})(t.name,t.url).then(r=>{const n=new r(t.options);return this.getWorkerSource(e,{type:t.type,source:t.source,scope:t.scope},n),n.load&&t.request?n.load({request:t.request}):null}).then(e=>r(null,e)).catch(e=>r(e instanceof Error?e:new Error(String(e))))}async syncRTLPluginState(e,t,r){if(ao.isParsed())return void r(null,!0);if(ao.isParsing())return void this.rtlPluginParsingListeners.push(r);ao.setState(t);const n=ao.getPluginURL();if(!ao.isLoaded()||ao.isParsed()||ao.isParsing())r(null,!1);else{ao.setState({pluginStatus:eo,pluginURL:n});try{await import(n),ao.isParsed()?r(null,!0):this.rtlPluginParsingListeners.push(r)}catch(i){ao.setState({pluginStatus:no,pluginURL:n}),r(i);for(const e of this.rtlPluginParsingListeners)e(i);this.rtlPluginParsingListeners=[]}}}setConfig(e,t){Object.assign(ke,t)}getAvailableImages(e,t){this.availableImages[e]||(this.availableImages[e]={});let r=this.availableImages[e][t];return r||(r=[]),r}getAvailableModels(e,t){this.availableModels[e]||(this.availableModels[e]={});let r=this.availableModels[e][t];return r||(r={}),r}getLayerIndex(e,t){this.layerIndexes[e]||(this.layerIndexes[e]={});let r=this.layerIndexes[e][t];return r||(r=this.layerIndexes[e][t]=new jb,r.scope=t),r}getWorkerSource(e,t,r){const{type:n,source:i,scope:s}=t,o=this.workerSources;if(o[e]||(o[e]={}),o[e][s]||(o[e][s]={}),o[e][s][n]||(o[e][s][n]={}),this.isSpriteLoaded[e]||(this.isSpriteLoaded[e]={}),o[e][s][n][i])r&&(o[e][s][n][i].tileProvider=r);else{const t={send:(t,r,n,i,s,o)=>this.actor.send(t,r,n,e,s,o),scheduler:this.actor.scheduler},a=this.workerSourceTypes[n];if(!a)throw new Error(`Unknown worker source type "${n}".`);o[e][s][n][i]=new a({actor:t,layerIndex:this.getLayerIndex(e,s),availableImages:this.getAvailableImages(e,s),availableModels:this.getAvailableModels(e,s),isSpriteLoaded:this.isSpriteLoaded[e][s],tileProvider:r,brightness:this.brightness,worldview:this.worldview,maxUniformBufferBindings:this.maxUniformBufferBindings,maxUniformBlockSizeDwords:this.maxUniformBlockSizeDwords,disableSymbolUBO:this.disableSymbolUBO})}return o[e][s][n][i]}rasterizeImagesWorker(e,t,r){const n=/* @__PURE__ */new Map;for(const[i,{image:s,imageVariant:o}]of t.tasks.entries()){const r=this.imageRasterizer.rasterize(o,s,t.scope,e);n.set(i,r)}r(void 0,n)}removeRasterizedImages(e,t,r){this.imageRasterizer.removeImagesFromCacheByIds(t.imageIds,t.scope,e),r()}enforceCacheSizeLimit(e,t){!function(e){qe(),null!=Xe&&Xe.then(t=>{t.keys().then(r=>{for(let n=0;n<r.length-e;n++)t.delete(r[n]).catch(e=>be(e.message))}).catch(e=>be(e.message))}).catch(e=>be(e.message))}(t)}getWorkerPerformanceMetrics(e,t,r){r(void 0,void 0)}}(self));export{oe as $,Xp as A,rp as B,wa as E,ka as G,Da as H,xd as J,tn as K,vl as L,Kl as M,za as N,Ql as S,nh as T,Ie as V,Ca as X,gd as Y,xp as Z,ca as _,be as a,eu as b,lo as c,Ka as d,la as e,ra as f,ea as g,ya as h,fa as i,pe as l,Fx as m,Ve as n,ps as p,gp as q,kc as t,Jo as u,$l as y};
|